Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use explicit import for lodash (to reduce bundling whole lib) #774

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion react/.storybook/foundations/Colours/ColourTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Tr,
useTheme,
} from '@chakra-ui/react'
import { get } from 'lodash'
import get from 'lodash/get'

export interface ColourTableProps {
label: string
Expand Down
2 changes: 1 addition & 1 deletion react/.storybook/foundations/Typography/Typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Text,
useTheme,
} from '@chakra-ui/react'
import { get } from 'lodash'
import get from 'lodash/get'

export const Typography: FC = () => {
const theme = useTheme()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Story } from '@storybook/react'
import { Meta, StoryFn } from '@storybook/react'

import { Principles as Component } from './Principles'

Expand All @@ -10,5 +10,5 @@ export default {
},
} as Meta

export const Principles: Story = () => <Component />
export const Principles: StoryFn = () => <Component />
Principles.storyName = 'Guiding principles'
1 change: 1 addition & 0 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "https://github.com/opengovsg/design-system/react#readme",
"bugs": "https://github.com/opengovsg/design-system/issues",
"license": "SEE LICENSE IN LICENSE.md",
"sideEffects": false,
"files": [
"build/main",
"build/module",
Expand Down
2 changes: 1 addition & 1 deletion react/src/Attachment/Attachment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
useMultiStyleConfig,
} from '@chakra-ui/react'
import { dataAttr } from '@chakra-ui/utils'
import { omit } from 'lodash'
import omit from 'lodash/omit'
import type { Promisable } from 'type-fest'

import { getErrorMessage } from './utils/getErrorMessage'
Expand Down
2 changes: 1 addition & 1 deletion react/src/AvatarMenu/AvatarMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
MenuProps,
useMultiStyleConfig,
} from '@chakra-ui/react'
import { merge } from 'lodash'
import merge from 'lodash/merge'

import { Menu, MenuButtonProps } from '~/Menu'

Expand Down
2 changes: 1 addition & 1 deletion react/src/Calendar/CalendarBase/CalendarContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
startOfDay,
} from 'date-fns'
import { Props as DayzedProps, RenderProps, useDayzed } from 'dayzed'
import { inRange } from 'lodash'
import inRange from 'lodash/inRange'
import { customAlphabet } from 'nanoid/non-secure'
import { useKey } from 'rooks'

Expand Down
2 changes: 1 addition & 1 deletion react/src/Calendar/CalendarBase/DayOfMonth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
isSunday,
} from 'date-fns'
import { DateObj } from 'dayzed'
import { get } from 'lodash'
import get from 'lodash/get'

import { useCalendar } from './CalendarContext'

Expand Down
2 changes: 1 addition & 1 deletion react/src/DatePicker/utils/pickCalendarProps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pick } from 'lodash'
import pick from 'lodash/pick'

import { DatePickerProps } from '../DatePicker'

Expand Down
2 changes: 1 addition & 1 deletion react/src/FormControl/FormHelperText/FormHelperText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ThemingProps,
useMultiStyleConfig,
} from '@chakra-ui/react'
import { merge } from 'lodash'
import merge from 'lodash/merge'

import { BxsCheckCircle } from '~/icons'

Expand Down
2 changes: 1 addition & 1 deletion react/src/FormControl/FormLabel/FormLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
useMultiStyleConfig,
VisuallyHidden,
} from '@chakra-ui/react'
import { merge } from 'lodash'
import merge from 'lodash/merge'

import { BxsHelpCircle } from '~/icons/BxsHelpCircle'
import { Tooltip } from '~/Tooltip'
Expand Down
3 changes: 2 additions & 1 deletion react/src/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
InputRightElement,
useMultiStyleConfig,
} from '@chakra-ui/react'
import { merge, omit } from 'lodash'
import merge from 'lodash/merge'
import omit from 'lodash/omit'

import { BxsCheckCircle } from '~/icons/BxsCheckCircle'

Expand Down
2 changes: 1 addition & 1 deletion react/src/Pagination/usePaginationRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { useMemo } from 'react'
import { range } from 'lodash'
import range from 'lodash/range'

interface UsePaginationRangeProps<T = string> {
/**
Expand Down
2 changes: 1 addition & 1 deletion react/src/Sidebar/SidebarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Icon,
} from '@chakra-ui/react'
import { dataAttr, isFunction } from '@chakra-ui/utils'
import { merge } from 'lodash'
import merge from 'lodash/merge'

import { useSidebarNestContext, useSidebarStyles } from './SidebarContext'
import type { BaseSidebarItemProps } from './types'
Expand Down
2 changes: 1 addition & 1 deletion react/src/Sidebar/SidebarList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
type UseDisclosureReturn,
} from '@chakra-ui/react'
import { dataAttr, isFunction } from '@chakra-ui/utils'
import { merge } from 'lodash'
import merge from 'lodash/merge'

import { ToggleChevron } from '~/icons'

Expand Down
2 changes: 1 addition & 1 deletion react/src/Tile/Tile.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react'
import { ListItem, Stack, UnorderedList } from '@chakra-ui/react'
import { Meta, StoryFn } from '@storybook/react'
import { values } from 'lodash'
import values from 'lodash/values'

import { Badge } from '~/Badge'
import { BxLockAlt, BxMailSend } from '~/icons'
Expand Down
2 changes: 1 addition & 1 deletion react/src/Tile/Tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ThemingProps,
useMultiStyleConfig,
} from '@chakra-ui/react'
import { merge } from 'lodash'
import merge from 'lodash/merge'

const [TileStylesProvider, useTileStyles] = createStylesContext('Tile')

Expand Down
2 changes: 1 addition & 1 deletion react/src/Toast/useToast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
useToast as useChakraToast,
UseToastOptions as ChakraUseToastOptions,
} from '@chakra-ui/react'
import { omit } from 'lodash'
import omit from 'lodash/omit'

import { Toast } from './Toast'

Expand Down
2 changes: 1 addition & 1 deletion react/src/icons/BxCheckAnimated.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { motion } from 'framer-motion'
import { omit } from 'lodash'
import omit from 'lodash/omit'

// icon:bx-check | Boxicons https://boxicons.com/ | Atisa
/**
Expand Down
2 changes: 1 addition & 1 deletion react/src/theme/components/Button.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineStyle, defineStyleConfig } from '@chakra-ui/react'
import { getColor, StyleFunctionProps } from '@chakra-ui/theme-tools'
import { memoizedGet as get } from '@chakra-ui/utils'
import { merge } from 'lodash'
import merge from 'lodash/merge'

import { layerStyles } from '../layerStyles'
import { getContrastColor } from '../utils'
Expand Down
3 changes: 2 additions & 1 deletion react/src/theme/components/MultiSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
mergeThemeOverride,
} from '@chakra-ui/react'
import { anatomy } from '@chakra-ui/theme-tools'
import { omit, pick } from 'lodash'
import omit from 'lodash/omit'
import pick from 'lodash/pick'

import { Input } from './Input'
import { comboboxParts, SingleSelect } from './SingleSelect'
Expand Down
2 changes: 1 addition & 1 deletion react/src/theme/components/SingleSelect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createMultiStyleConfigHelpers, defineStyle } from '@chakra-ui/react'
import { anatomy } from '@chakra-ui/theme-tools'
import { merge } from 'lodash'
import merge from 'lodash/merge'

import { Input } from './Input'
import { Menu } from './Menu'
Expand Down
Loading