@loadsmart/loadsmart-ui 5.9.0 → 5.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/dist/common/SelectionWrapper.d.ts +1 -1
  2. package/dist/components/Accordion/Accordion.d.ts +1 -1
  3. package/dist/components/Accordion/Accordion.stories.d.ts +1 -1
  4. package/dist/components/Banner/Banner.stories.d.ts +1 -1
  5. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +1 -1
  6. package/dist/components/Button/Button.d.ts +4 -1
  7. package/dist/components/Button/Button.stories.d.ts +2 -1
  8. package/dist/components/Card/Card.stories.d.ts +1 -1
  9. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  10. package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -1
  11. package/dist/components/Dialog/Dialog.stories.d.ts +1 -1
  12. package/dist/components/DragDropFile/DragDropFile.stories.d.ts +1 -1
  13. package/dist/components/Drawer/Drawer.stories.d.ts +1 -1
  14. package/dist/components/Dropdown/Dropdown.stories.d.ts +1 -1
  15. package/dist/components/EmptyState/EmptyState.stories.d.ts +1 -1
  16. package/dist/components/ErrorMessage/ErrorMessage.stories.d.ts +1 -1
  17. package/dist/components/HighlightMatch/HighlightMatch.stories.d.ts +1 -1
  18. package/dist/components/IconFactory/IconFactory.stories.d.ts +1 -1
  19. package/dist/components/Label/Label.d.ts +2 -2
  20. package/dist/components/Label/Label.stories.d.ts +1 -1
  21. package/dist/components/Layout/Box.d.ts +1 -1
  22. package/dist/components/Layout/Grid.d.ts +1 -1
  23. package/dist/components/Layout/Layout.stories.d.ts +1 -1
  24. package/dist/components/Layout/Sidebar.d.ts +1 -1
  25. package/dist/components/Layout/Switcher.d.ts +1 -1
  26. package/dist/components/Link/Link.stories.d.ts +1 -1
  27. package/dist/components/Link/useSafeLink.d.ts +1 -1
  28. package/dist/components/Loaders/LoadingBar.stories.d.ts +1 -1
  29. package/dist/components/Loaders/LoadingDots.stories.d.ts +1 -1
  30. package/dist/components/Loaders/Spinner.stories.d.ts +1 -1
  31. package/dist/components/Modal/Modal.stories.d.ts +1 -1
  32. package/dist/components/Pagination/Pagination.stories.d.ts +1 -1
  33. package/dist/components/Pagination/Pagination.types.d.ts +2 -2
  34. package/dist/components/Popover/Popover.stories.d.ts +1 -1
  35. package/dist/components/ProgressBar/ProgressBar.stories.d.ts +1 -1
  36. package/dist/components/Radio/Radio.d.ts +1 -1
  37. package/dist/components/Radio/Radio.stories.d.ts +1 -1
  38. package/dist/components/Section/Sections.stories.d.ts +1 -1
  39. package/dist/components/Select/Select.fixtures.d.ts +2 -2
  40. package/dist/components/Select/Select.stories.d.ts +1 -1
  41. package/dist/components/Select/Select.types.d.ts +2 -2
  42. package/dist/components/Select/SelectCreatableOption.d.ts +1 -1
  43. package/dist/components/Select/SelectEmpty.d.ts +1 -1
  44. package/dist/components/Select/components.d.ts +1 -1
  45. package/dist/components/Select/useSelectExternal.d.ts +1 -1
  46. package/dist/components/SideNavigation/SideNavigation.stories.d.ts +1 -1
  47. package/dist/components/Steps/Steps.d.ts +1 -1
  48. package/dist/components/Steps/Steps.stories.d.ts +1 -1
  49. package/dist/components/Steps/StepsStep.d.ts +1 -1
  50. package/dist/components/Switch/Switch.stories.d.ts +1 -1
  51. package/dist/components/Table/Table.stories.d.ts +1 -1
  52. package/dist/components/Table/Table.types.d.ts +3 -4
  53. package/dist/components/Table/TableSortHandle.d.ts +1 -1
  54. package/dist/components/TablePagination/RowsPerPage.d.ts +1 -1
  55. package/dist/components/TablePagination/TablePagination.stories.d.ts +1 -1
  56. package/dist/components/TablePagination/TablePagination.types.d.ts +1 -1
  57. package/dist/components/TablePagination/TablePaginationActions.d.ts +1 -1
  58. package/dist/components/Tag/Tag.stories.d.ts +1 -1
  59. package/dist/components/Text/Text.d.ts +1 -1
  60. package/dist/components/Text/Text.stories.d.ts +1 -1
  61. package/dist/components/TextField/TextField.d.ts +1 -1
  62. package/dist/components/TextField/TextField.stories.d.ts +1 -1
  63. package/dist/components/Textarea/Textarea.d.ts +1 -1
  64. package/dist/components/Textarea/Textarea.stories.d.ts +1 -1
  65. package/dist/components/Toast/Toast.stories.d.ts +1 -1
  66. package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +1 -1
  67. package/dist/components/Tooltip/Tooltip.d.ts +3 -2
  68. package/dist/components/Tooltip/Tooltip.stories.d.ts +1 -1
  69. package/dist/hooks/useFocusTrap/useFocusTrap.stories.d.ts +1 -1
  70. package/dist/hooks/useHeightExpansionToggler/useHeightExpansionToggler.d.ts +1 -1
  71. package/dist/index.js +769 -909
  72. package/dist/index.js.map +1 -1
  73. package/dist/styles/activatable.d.ts +1 -1
  74. package/dist/styles/disableable.d.ts +1 -1
  75. package/dist/styles/focusable.d.ts +1 -1
  76. package/dist/styles/hoverable.d.ts +1 -1
  77. package/dist/testing/getInterpolatedStyles/getInterpolatedStyles.d.ts +1 -1
  78. package/dist/testing/index.js.map +1 -1
  79. package/dist/theming/index.d.ts +2 -2
  80. package/dist/theming/index.js.map +1 -1
  81. package/package.json +9 -10
  82. package/src/common/CloseButton/CloseButton.tsx +7 -11
  83. package/src/common/SelectionWrapper.tsx +8 -8
  84. package/src/components/Accordion/Accordion.stories.tsx +1 -1
  85. package/src/components/Accordion/Accordion.tsx +24 -29
  86. package/src/components/Banner/Banner.stories.tsx +1 -1
  87. package/src/components/Banner/Banner.tsx +2 -2
  88. package/src/components/Breadcrumbs/Breadcrumb.tsx +3 -4
  89. package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +1 -1
  90. package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
  91. package/src/components/Button/Button.stories.tsx +33 -13
  92. package/src/components/Button/Button.test.tsx +24 -8
  93. package/src/components/Button/Button.tsx +139 -46
  94. package/src/components/Calendar/Calendar.tsx +4 -8
  95. package/src/components/Calendar/PickerModeToggle.tsx +3 -6
  96. package/src/components/Calendar/Pickers/DayPicker.tsx +1 -1
  97. package/src/components/Calendar/Pickers/MonthPicker.tsx +1 -1
  98. package/src/components/Calendar/Pickers/PickerButton.tsx +29 -39
  99. package/src/components/Calendar/Pickers/YearPicker.tsx +1 -1
  100. package/src/components/Card/Card.stories.tsx +1 -1
  101. package/src/components/Card/Card.tsx +6 -9
  102. package/src/components/Card/CardTitle.tsx +3 -3
  103. package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
  104. package/src/components/Checkbox/Checkbox.tsx +15 -27
  105. package/src/components/Dialog/Dialog.stories.tsx +1 -1
  106. package/src/components/Dialog/Dialog.tsx +5 -5
  107. package/src/components/DragDropFile/DragDropFile.stories.tsx +1 -1
  108. package/src/components/DragDropFile/styles.tsx +6 -11
  109. package/src/components/Drawer/Drawer.stories.tsx +1 -1
  110. package/src/components/Drawer/Drawer.tsx +6 -6
  111. package/src/components/Dropdown/Dropdown.stories.tsx +1 -1
  112. package/src/components/Dropdown/DropdownMenu.tsx +15 -28
  113. package/src/components/Dropdown/DropdownTrigger.tsx +24 -34
  114. package/src/components/EmptyState/EmptyState.stories.tsx +1 -1
  115. package/src/components/ErrorMessage/ErrorMessage.stories.tsx +1 -1
  116. package/src/components/HighlightMatch/HighlightMatch.stories.tsx +1 -1
  117. package/src/components/HighlightMatch/HighlightMatch.test.tsx +1 -1
  118. package/src/components/HighlightMatch/HighlightMatch.tsx +1 -1
  119. package/src/components/IconFactory/IconFactory.stories.tsx +1 -1
  120. package/src/components/Label/Label.stories.tsx +1 -1
  121. package/src/components/Label/Label.tsx +5 -5
  122. package/src/components/Layout/Box.tsx +1 -1
  123. package/src/components/Layout/Grid.tsx +1 -1
  124. package/src/components/Layout/Layout.stories.tsx +1 -1
  125. package/src/components/Layout/Sidebar.tsx +1 -1
  126. package/src/components/Layout/Switcher.tsx +1 -1
  127. package/src/components/Link/Link.stories.tsx +1 -1
  128. package/src/components/Link/Link.tsx +9 -13
  129. package/src/components/Link/useSafeLink.ts +1 -1
  130. package/src/components/Loaders/LoadingBar.stories.tsx +1 -1
  131. package/src/components/Loaders/LoadingBar.tsx +2 -2
  132. package/src/components/Loaders/LoadingDots.stories.tsx +1 -1
  133. package/src/components/Loaders/Spinner.stories.tsx +1 -1
  134. package/src/components/Modal/Modal.stories.tsx +1 -1
  135. package/src/components/Modal/Modal.tsx +7 -12
  136. package/src/components/Pagination/Pagination.stories.tsx +1 -1
  137. package/src/components/Pagination/Pagination.test.tsx +1 -1
  138. package/src/components/Pagination/Pagination.types.ts +2 -2
  139. package/src/components/Popover/Popover.stories.tsx +1 -1
  140. package/src/components/ProgressBar/ProgressBar.stories.tsx +1 -1
  141. package/src/components/ProgressBar/ProgressBar.tsx +4 -6
  142. package/src/components/Radio/Radio.stories.tsx +1 -1
  143. package/src/components/Radio/Radio.tsx +12 -20
  144. package/src/components/Section/Section.tsx +6 -8
  145. package/src/components/Section/Sections.stories.tsx +1 -1
  146. package/src/components/Select/Select.fixtures.ts +3 -3
  147. package/src/components/Select/Select.stories.tsx +7 -5
  148. package/src/components/Select/Select.test.tsx +20 -40
  149. package/src/components/Select/Select.types.ts +2 -2
  150. package/src/components/Select/SelectCreatableOption.tsx +1 -1
  151. package/src/components/Select/SelectEmpty.tsx +5 -6
  152. package/src/components/Select/SelectOption.test.tsx +1 -1
  153. package/src/components/Select/SelectTrigger.tsx +6 -11
  154. package/src/components/Select/components.tsx +1 -1
  155. package/src/components/Select/useSelect.ts +1 -1
  156. package/src/components/Select/useSelectExternal.ts +1 -1
  157. package/src/components/SideNavigation/Menu/Menu.test.tsx +1 -1
  158. package/src/components/SideNavigation/Menu/Menu.tsx +3 -3
  159. package/src/components/SideNavigation/Menu/MenuBaseItem.tsx +4 -5
  160. package/src/components/SideNavigation/Menu/MenuExpandable.tsx +2 -3
  161. package/src/components/SideNavigation/SideNavigation.stories.tsx +1 -1
  162. package/src/components/Steps/ProgressSteps/ProgressStep.tsx +31 -39
  163. package/src/components/Steps/Steps.stories.tsx +1 -1
  164. package/src/components/Steps/Steps.tsx +2 -1
  165. package/src/components/Steps/StepsStep.tsx +2 -1
  166. package/src/components/Switch/Switch.stories.tsx +1 -1
  167. package/src/components/Switch/Switch.tsx +6 -18
  168. package/src/components/Table/Table.stories.tsx +1 -1
  169. package/src/components/Table/Table.tsx +2 -2
  170. package/src/components/Table/Table.types.ts +9 -4
  171. package/src/components/Table/TableSortHandle.tsx +1 -1
  172. package/src/components/TablePagination/RowsPerPage.tsx +2 -2
  173. package/src/components/TablePagination/TablePagination.stories.tsx +1 -1
  174. package/src/components/TablePagination/TablePagination.test.tsx +1 -1
  175. package/src/components/TablePagination/TablePagination.types.ts +1 -1
  176. package/src/components/TablePagination/TablePaginationActions.tsx +1 -1
  177. package/src/components/Tabs/Tabs.tsx +26 -32
  178. package/src/components/Tag/Tag.stories.tsx +1 -1
  179. package/src/components/Tag/Tag.tsx +35 -44
  180. package/src/components/Text/Text.stories.tsx +1 -1
  181. package/src/components/Text/Text.tsx +1 -1
  182. package/src/components/TextField/TextField.stories.tsx +1 -1
  183. package/src/components/TextField/TextField.tsx +16 -23
  184. package/src/components/Textarea/Textarea.stories.tsx +1 -1
  185. package/src/components/Textarea/Textarea.tsx +18 -23
  186. package/src/components/Toast/Toast.stories.tsx +1 -1
  187. package/src/components/Toast/Toast.tsx +3 -3
  188. package/src/components/ToggleGroup/Toggle.tsx +7 -7
  189. package/src/components/ToggleGroup/ToggleGroup.stories.tsx +1 -1
  190. package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
  191. package/src/components/Tooltip/Tooltip.tsx +23 -24
  192. package/src/components/TopNavigation/Menu/MenuItemDropdown.tsx +1 -1
  193. package/src/components/TopNavigation/OpenSideNavButton/OpenSideNavButton.tsx +1 -1
  194. package/src/hooks/useFocusTrap/useFocusTrap.stories.tsx +1 -1
  195. package/src/hooks/useHeightExpansionToggler/useHeightExpansionToggler.ts +1 -1
  196. package/src/styles/activatable.tsx +1 -1
  197. package/src/styles/disableable.tsx +1 -1
  198. package/src/styles/focusable.tsx +1 -1
  199. package/src/styles/font.tsx +3 -3
  200. package/src/styles/hoverable.tsx +1 -1
  201. package/src/testing/getInterpolatedStyles/getInterpolatedStyles.ts +1 -1
  202. package/src/theming/index.ts +3 -2
@@ -1,6 +1,6 @@
1
- import { HTMLAttributes } from 'react'
1
+ import type { HTMLAttributes } from 'react'
2
2
 
3
- import { ButtonProps } from 'components/Button'
3
+ import type { ButtonProps } from 'components/Button'
4
4
 
5
5
  export type PaginationProps = Omit<HTMLAttributes<HTMLElement>, 'onChange'> & {
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { Story, Meta } from '@storybook/react/types-6-0'
2
+ import type { Story, Meta } from '@storybook/react/types-6-0'
3
3
 
4
4
  import Popover from './Popover'
5
5
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import ProgressBar, { ProgressBarProps } from './ProgressBar'
3
- import { Meta } from '@storybook/react/types-6-0'
3
+ import type { Meta } from '@storybook/react/types-6-0'
4
4
  import Status from 'utils/types/Status'
5
5
 
6
6
  export default {
@@ -5,19 +5,17 @@ import conditional, { whenProps } from 'tools/conditional'
5
5
  import Status from 'utils/types/Status'
6
6
 
7
7
  const Bar = styled.div<{ rounded: boolean }>`
8
- align-items: center;
8
+ position: relative;
9
9
  display: flex;
10
10
  flex-grow: 0;
11
11
  flex-shrink: 1;
12
-
12
+ align-items: center;
13
13
  justify-content: center;
14
- overflow: hidden;
15
14
  width: 100%;
16
-
17
- position: relative;
18
-
19
15
  height: ${token('progressbar-height')};
20
16
 
17
+ overflow: hidden;
18
+
21
19
  ${({ rounded }) =>
22
20
  rounded &&
23
21
  css`
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import Radio, { RadioProps } from './Radio'
3
- import { Meta } from '@storybook/react/types-6-0'
3
+ import type { Meta } from '@storybook/react/types-6-0'
4
4
 
5
5
  import Status from 'utils/types/Status'
6
6
 
@@ -2,7 +2,7 @@ import React, { Fragment, InputHTMLAttributes, ReactNode } from 'react'
2
2
  import clsx from 'clsx'
3
3
 
4
4
  import { Icon } from 'components/Icon'
5
- import ColorScheme from 'utils/types/ColorScheme'
5
+ import type ColorScheme from 'utils/types/ColorScheme'
6
6
  import conditional, { whenProps } from 'tools/conditional'
7
7
  import disableable from 'styles/disableable'
8
8
  import focusable from 'styles/focusable'
@@ -21,45 +21,37 @@ export interface RadioProps extends InputHTMLAttributes<HTMLInputElement>, Selec
21
21
  const Check = styled(Icon)<SelectionStyleProps>`
22
22
  position: absolute;
23
23
  top: 50%;
24
-
25
24
  left: 50%;
26
25
 
27
26
  width: 10px;
28
27
  height: 10px;
29
28
 
30
- transform: translate(-50%, -50%);
31
-
32
29
  pointer-events: none;
33
30
 
34
31
  fill: currentColor;
32
+
33
+ transform: translate(-50%, -50%);
35
34
  `
36
35
 
37
36
  const Selector = styled.input<SelectionStyleProps>`
38
- ${transition()}
39
-
40
37
  display: inline-flex;
41
38
  flex-flow: row nowrap;
42
39
  align-items: center;
43
40
 
44
- cursor: pointer;
45
-
46
- appearance: none;
47
-
48
- outline: none;
49
-
50
- color: white;
51
-
52
- height: ${token('radio-small-selector-size')};
53
41
  width: ${token('radio-small-selector-size')};
54
-
55
- border-radius: ${token('radio-selector-border-radius')};
56
- border-width: ${token('button-border-width')};
57
- border-style: solid;
58
-
42
+ height: ${token('radio-small-selector-size')};
43
+ color: white;
44
+ cursor: pointer;
59
45
  background: ${conditional({
60
46
  'radio-selector-background': whenProps({ scheme: 'light' }),
61
47
  'radio-dark-selector-background': whenProps({ scheme: 'dark' }),
62
48
  })};
49
+ appearance: none;
50
+ border-style: solid;
51
+ border-width: ${token('button-border-width')};
52
+ border-radius: ${token('radio-selector-border-radius')};
53
+ outline: none;
54
+ ${transition()}
63
55
 
64
56
  &:not(:checked) {
65
57
  border-color: ${conditional({
@@ -12,18 +12,16 @@ const StyledSection = styled.section`
12
12
  `
13
13
 
14
14
  const StyledSectionTitle = styled.section`
15
- ${font({
16
- weight: 'font-weight-bold',
17
- height: 'font-height-2',
18
- })}
19
-
15
+ padding: ${token('space-s')} ${token('space-xs')};
16
+ margin-bottom: ${token('space-l')};
20
17
  font-size: ${token('font-size-3')};
21
18
  color: ${token('color-neutral-darker')};
22
-
23
19
  border-bottom: 2px solid ${token('color-neutral-light')};
24
20
 
25
- padding: ${token('space-s')} ${token('space-xs')};
26
- margin-bottom: ${token('space-l')};
21
+ ${font({
22
+ weight: 'font-weight-bold',
23
+ height: 'font-height-2',
24
+ })}
27
25
  `
28
26
 
29
27
  const StyledSpan = styled.span`
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { Meta } from '@storybook/react/types-6-0'
2
+ import type { Meta } from '@storybook/react/types-6-0'
3
3
  import Section from './Section'
4
4
  import type { SectionProps } from './Section'
5
5
 
@@ -1,4 +1,4 @@
1
- import { SelectableKeyType } from 'hooks/useSelectable'
1
+ import type { SelectableKeyType } from 'hooks/useSelectable'
2
2
  import generator from '../../../tests/generator'
3
3
 
4
4
  import type { SelectDatasource } from './Select.types'
@@ -22,7 +22,7 @@ export const SelectableKeyTypeOptions: { label: string; value: SelectableKeyType
22
22
  { label: 'String', value: 'string' },
23
23
  ]
24
24
 
25
- export const FRUITS: Fruit[] = [
25
+ export const FRUITS: Readonly<Fruit[]> = Object.freeze([
26
26
  { label: 'Acerola', value: 'acerola', family: 'Malpighiaceae' },
27
27
  { label: 'Apple', value: 'apple', family: 'Rosaceae' },
28
28
  { label: 'Apricots', value: 'apricots', family: 'Rosaceae' },
@@ -93,7 +93,7 @@ export const FRUITS: Fruit[] = [
93
93
  { label: 'Tamarind', value: 'tamarind', family: 'Fabaceae' },
94
94
  { label: 'Tangerine', value: 'tangerine', family: 'Rutaceae' },
95
95
  { label: 'Watermelon', value: 'watermelon', family: 'Cucurbitaceae' },
96
- ]
96
+ ])
97
97
 
98
98
  function generateSelectOptions() {
99
99
  return generator.array(() => {
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useState } from 'react'
2
- import { Story, Meta } from '@storybook/react/types-6-0'
2
+ import type { Story, Meta } from '@storybook/react/types-6-0'
3
3
  import omit from 'lodash.omit'
4
4
 
5
5
  import { Label } from 'components/Label'
@@ -441,11 +441,13 @@ const MixedCustomOption = ({ value }: SelectOptionProps) => {
441
441
  },
442
442
  }
443
443
 
444
+ const fruits = [...FRUITS]
445
+
444
446
  export const CreatableSync: Story<SelectProps> = (args: SelectProps) => {
445
447
  const handleCreate = useCallback(function handleCreate(query: string) {
446
448
  const item: Option = { label: query, value: query } as Option
447
449
 
448
- FRUITS.push(item as Fruit)
450
+ fruits.push(item as Fruit)
449
451
  return item
450
452
  }, [])
451
453
 
@@ -466,7 +468,7 @@ export const CreatableSync: Story<SelectProps> = (args: SelectProps) => {
466
468
  </div>
467
469
  <div className="text-sm" style={{ width: 720 }}>
468
470
  <p>Available options:</p>
469
- <code>{FRUITS.map(({ label }) => label).join(', ')}</code>
471
+ <code>{fruits.map(({ label }) => label).join(', ')}</code>
470
472
  </div>
471
473
  </div>
472
474
  )
@@ -604,7 +606,7 @@ export const CustomCreatableOption: Story<SelectProps> = ({ onCreate, ...args }:
604
606
  const item: Option = { label: query, value: query } as Option
605
607
 
606
608
  setValue(item)
607
- FRUITS.push(item as Fruit)
609
+ fruits.push(item as Fruit)
608
610
  },
609
611
  [onCreate]
610
612
  )
@@ -631,7 +633,7 @@ export const CustomCreatableOption: Story<SelectProps> = ({ onCreate, ...args }:
631
633
  </div>
632
634
  <div className="text-sm" style={{ width: 720 }}>
633
635
  <p>Available options:</p>
634
- <code>{FRUITS.map(({ label }) => label).join(', ')}</code>
636
+ <code>{fruits.map(({ label }) => label).join(', ')}</code>
635
637
  </div>
636
638
  </div>
637
639
  )
@@ -9,7 +9,7 @@ import generator from '../../../tests/generator'
9
9
  import renderer, { screen, fire, waitFor } from '../../../tests/renderer'
10
10
  import selectEvent from '../../testing/SelectEvent'
11
11
 
12
- import type { SelectProps, Option, GenericOption } from './Select.types'
12
+ import type { SelectProps, Option } from './Select.types'
13
13
  import Select from './Select'
14
14
  import userEvent from '@testing-library/user-event'
15
15
  import type { Selectable } from 'hooks/useSelectable'
@@ -142,7 +142,7 @@ describe('Select', () => {
142
142
  expect(screen.getByTestId('select-trigger-handle')).toBeDisabled()
143
143
  expect(screen.queryByRole('listbox')).not.toBeInTheDocument()
144
144
 
145
- rerender(<Playground options={FRUITS as GenericOption[]} />)
145
+ rerender(<Playground options={[...FRUITS]} />)
146
146
 
147
147
  await selectEvent.expand(searchInput)
148
148
 
@@ -213,10 +213,7 @@ describe('Select', () => {
213
213
  setup({})
214
214
 
215
215
  const searchInput = screen.getByLabelText('Select your favorite fruit')
216
- const selectedFruit = generator.pick(FRUITS, { amount: 1 }) as {
217
- label: string
218
- value: string
219
- }
216
+ const selectedFruit = generator.pickone([...FRUITS])
220
217
 
221
218
  await selectEvent.select(selectedFruit.label, searchInput)
222
219
 
@@ -229,10 +226,7 @@ describe('Select', () => {
229
226
  })
230
227
 
231
228
  it('initializes with a selected item', async () => {
232
- const selectedFruit = generator.pick(FRUITS, { amount: 1 }) as {
233
- label: string
234
- value: string
235
- }
229
+ const selectedFruit = generator.pickone([...FRUITS])
236
230
 
237
231
  setup({
238
232
  value: selectedFruit as Option,
@@ -248,10 +242,7 @@ describe('Select', () => {
248
242
  })
249
243
 
250
244
  it('updates selected item after the initially selected item changes', async () => {
251
- const selectedFruit = generator.pick(FRUITS, { amount: 1 }) as {
252
- label: string
253
- value: string
254
- }
245
+ const selectedFruit = generator.pickone([...FRUITS])
255
246
  const props = {
256
247
  value: selectedFruit as Option,
257
248
  }
@@ -265,10 +256,7 @@ describe('Select', () => {
265
256
 
266
257
  expect(selectedOptions[0]).toHaveTextContent(selectedFruit.label)
267
258
 
268
- const newSelectedFruit = generator.pick(FRUITS, { amount: 1 }) as {
269
- label: string
270
- value: string
271
- }
259
+ const newSelectedFruit = generator.pickone([...FRUITS])
272
260
  const newProps = {
273
261
  value: newSelectedFruit as Option,
274
262
  }
@@ -284,10 +272,7 @@ describe('Select', () => {
284
272
  })
285
273
 
286
274
  it('unselects the clicked item', async () => {
287
- const selectedFruit = generator.pick(FRUITS, { amount: 1 }) as {
288
- label: string
289
- value: string
290
- }
275
+ const selectedFruit = generator.pickone([...FRUITS])
291
276
 
292
277
  setup({
293
278
  value: selectedFruit as Option,
@@ -308,10 +293,7 @@ describe('Select', () => {
308
293
  })
309
294
 
310
295
  it('clears selection', async () => {
311
- const selectedFruit = generator.pick(FRUITS, { amount: 1 }) as {
312
- label: string
313
- value: string
314
- }
296
+ const selectedFruit = generator.pickone([...FRUITS])
315
297
 
316
298
  setup({
317
299
  value: selectedFruit as Option,
@@ -506,7 +488,7 @@ describe('Select', () => {
506
488
  setup({})
507
489
 
508
490
  const searchInput = screen.getByLabelText('Select your favorite fruit')
509
- const selectedFruit = generator.pick<Fruit>(FRUITS, { amount: 1 }) as Fruit
491
+ const selectedFruit = generator.pickone<Fruit>([...FRUITS])
510
492
  const optionText = getOptionText(selectedFruit)
511
493
 
512
494
  await selectEvent.select(optionText, searchInput)
@@ -520,23 +502,21 @@ describe('Select', () => {
520
502
  it('selects multiple clicked custom items', async () => {
521
503
  setup({ multiple: true })
522
504
 
523
- const amount = 2
505
+ const SELECTED_OPTIONS_AMOUNT = 2
524
506
  const searchInput = screen.getByLabelText('Select your favorite fruit')
525
- const options = generator.pick<Fruit>(FRUITS, { amount }) as Fruit[]
507
+ const options = generator.pickset([...FRUITS], SELECTED_OPTIONS_AMOUNT)
526
508
 
527
- for (let i = 0; i < options.length; i++) {
528
- const option = options[i]
509
+ for await (const option of options) {
529
510
  const optionText = getOptionText(option)
530
511
  await selectEvent.select(optionText, searchInput)
531
512
  }
532
513
 
533
514
  const selectedOptions = await selectEvent.getSelectedOptions(searchInput)
534
- expect(selectedOptions).toHaveLength(amount)
515
+ expect(selectedOptions).toHaveLength(SELECTED_OPTIONS_AMOUNT)
535
516
 
536
- for (let i = 0; i < options.length; i++) {
537
- const option = options[i]
517
+ for await (const [index, option] of options.entries()) {
538
518
  const optionText = getOptionText(option)
539
- expect(selectedOptions[i]).toHaveTextContent(optionText)
519
+ expect(selectedOptions[index]).toHaveTextContent(optionText)
540
520
  }
541
521
  })
542
522
 
@@ -642,7 +622,7 @@ describe('Select', () => {
642
622
  'renders creatable option at the end of the list when the entered query is not equal one of the available options - %s',
643
623
  async (args) => {
644
624
  setup({ ...args })
645
- const { label: availableOption } = generator.pick(FRUITS, { amount: 1 }) as Fruit
625
+ const { label: availableOption } = generator.pickone([...FRUITS])
646
626
  const query = availableOption.slice(0, availableOption.length - 1)
647
627
 
648
628
  const searchInput = screen.getByLabelText('Select your favorite fruit')
@@ -664,7 +644,7 @@ describe('Select', () => {
664
644
  onCreate: (null as unknown) as undefined,
665
645
  ...args,
666
646
  })
667
- const { label: availableOption } = generator.pick(FRUITS, { amount: 1 }) as Fruit
647
+ const { label: availableOption } = generator.pickone([...FRUITS])
668
648
  const query = availableOption.slice(0, availableOption.length - 1)
669
649
 
670
650
  const searchInput = screen.getByLabelText('Select your favorite fruit')
@@ -685,7 +665,7 @@ describe('Select', () => {
685
665
  setup({
686
666
  ...args,
687
667
  })
688
- const { label: availableOption } = generator.pick(FRUITS, { amount: 1 }) as Fruit
668
+ const { label: availableOption } = generator.pickone([...FRUITS])
689
669
 
690
670
  const searchInput = screen.getByLabelText('Select your favorite fruit')
691
671
  fire.change(searchInput, {
@@ -705,7 +685,7 @@ describe('Select', () => {
705
685
  setup({
706
686
  ...args,
707
687
  })
708
- const { label: availableOption } = generator.pick(FRUITS, { amount: 1 }) as Fruit
688
+ const { label: availableOption } = generator.pickone([...FRUITS])
709
689
 
710
690
  await expandSelect()
711
691
 
@@ -865,7 +845,7 @@ describe('Select', () => {
865
845
  )
866
846
  }
867
847
 
868
- const value = generator.pickone(FRUITS) as Selectable
848
+ const value = generator.pickone([...FRUITS]) as Selectable
869
849
 
870
850
  setup({
871
851
  ...args,
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import EventLike from 'utils/types/EventLike'
2
+ import type EventLike from 'utils/types/EventLike'
3
3
 
4
4
  import type { DropdownMenuItemProps, DropdownProps } from 'components/Dropdown'
5
5
  import type { TextFieldProps } from 'components/TextField'
@@ -9,7 +9,7 @@ import type {
9
9
  SelectableKeyType,
10
10
  SelectableState,
11
11
  } from 'hooks/useSelectable'
12
- import { useSelectableReturn } from 'hooks/useSelectable/useSelectable.types'
12
+ import type { useSelectableReturn } from 'hooks/useSelectable/useSelectable.types'
13
13
  import type { ChangeEvent, ComponentType, FocusEvent, HTMLAttributes } from 'react'
14
14
 
15
15
  export type Option = Selectable
@@ -1,7 +1,7 @@
1
1
  import React, { useContext } from 'react'
2
2
  import { Dropdown } from 'components/Dropdown'
3
3
  import { SelectContext } from './Select.context'
4
- import { SelectCreatableOptionProps } from './Select.types'
4
+ import type { SelectCreatableOptionProps } from './Select.types'
5
5
 
6
6
  function SelectCreatableOption({ children, ...rest }: SelectCreatableOptionProps): JSX.Element {
7
7
  const select =
@@ -2,23 +2,22 @@ import React from 'react'
2
2
  import styled from 'styled-components'
3
3
 
4
4
  import { getToken as token } from 'theming'
5
- import { SelectEmptyProps } from './Select.types'
5
+ import type { SelectEmptyProps } from './Select.types'
6
6
 
7
7
  const Wrapper = styled.div`
8
+ box-sizing: border-box;
8
9
  display: flex;
9
10
  flex-direction: column;
10
11
  align-items: flex-start;
11
12
  justify-content: center;
12
-
13
- box-sizing: border-box;
14
- margin: 0 ${token('space-s')};
15
13
  padding: ${token('space-s')};
16
-
17
- color: ${token('color-neutral')};
14
+ margin: 0 ${token('space-s')};
18
15
 
19
16
  font-size: 1em;
20
17
  line-height: ${token('font-height-3')};
21
18
 
19
+ color: ${token('color-neutral')};
20
+
22
21
  background: ${token('color-transparent')};
23
22
  `
24
23
 
@@ -3,7 +3,7 @@ import { render, screen, waitFor } from '@testing-library/react'
3
3
  import SelectOption from './SelectOption'
4
4
  import { SelectContext } from './Select.context'
5
5
  import useSelect from './useSelect'
6
- import { Option, SelectOptionProps, SelectProps, useSelectReturn } from './Select.types'
6
+ import type { Option, SelectOptionProps, SelectProps, useSelectReturn } from './Select.types'
7
7
 
8
8
  type Props = {
9
9
  optionProps: SelectOptionProps
@@ -13,19 +13,14 @@ const GenericSelectTrigger = styled(GenericDropdownTrigger)`
13
13
  `
14
14
 
15
15
  const SelectTriggerSearchField = styled(TextField)`
16
- ${focusable`
17
- box-shadow: none;
18
- `}
19
-
16
+ flex: 1;
17
+ height: 100%;
20
18
  background-color: transparent;
21
-
22
19
  border: none;
23
20
  border-radius: ${token('border-radius-s')} 0 0 ${token('border-radius-s')};
24
-
25
- height: 100%;
26
-
27
- flex: 1;
28
-
21
+ ${focusable`
22
+ box-shadow: none;
23
+ `}
29
24
  ${Trailing} {
30
25
  margin: 0 ${token('space-xs')} 0 0;
31
26
  }
@@ -37,8 +32,8 @@ const Separator = styled.span`
37
32
  margin: 0;
38
33
 
39
34
  border-right-color: ${token('color-neutral-light')};
40
- border-right-width: 1px;
41
35
  border-right-style: solid;
36
+ border-right-width: 1px;
42
37
  `
43
38
 
44
39
  const SelectTrigger = forwardRef<HTMLInputElement, SelectTriggerProps>(function SelectTrigger(
@@ -1,4 +1,4 @@
1
- import { Components, CreatableOptionType } from './Select.types'
1
+ import type { Components, CreatableOptionType } from './Select.types'
2
2
  import SelectCreatableOption from './SelectCreatableOption'
3
3
  import SelectEmpty from './SelectEmpty'
4
4
  import SelectOption from './SelectOption'
@@ -7,7 +7,7 @@ import isEmpty from 'utils/toolset/isEmpty'
7
7
  import { useDropdown } from 'components/Dropdown'
8
8
  import { useDidMount } from 'hooks/useDidMount'
9
9
  import { useFocusTrap } from 'hooks/useFocusTrap'
10
- import { SelectableKeyType } from 'hooks/useSelectable'
10
+ import type { SelectableKeyType } from 'hooks/useSelectable'
11
11
  import to from 'utils/toolset/awaitTo'
12
12
  import { isThenable } from 'utils/toolset/isThenable'
13
13
  import toArray from 'utils/toolset/toArray'
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useContext } from 'react'
2
2
 
3
3
  import { SelectContext } from './Select.context'
4
- import { Option, useSelectExternalReturn } from './Select.types'
4
+ import type { Option, useSelectExternalReturn } from './Select.types'
5
5
 
6
6
  export function useSelectExternal(): useSelectExternalReturn {
7
7
  const select =
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
 
3
3
  import { Menu } from './'
4
- import { MenuProps } from './Menu'
4
+ import type { MenuProps } from './Menu'
5
5
  import renderer, { screen } from '../../../../tests/renderer'
6
6
  import generator from '../../../../tests/generator'
7
7
  import userEvent from '@testing-library/user-event'
@@ -13,11 +13,11 @@ import { styledCompounds } from 'utils/toolset/styledCompounds'
13
13
  const MenuTitle = styled.div`
14
14
  padding: ${token('space-s')} 0;
15
15
  padding-left: ${token('space-l')};
16
-
17
- color: ${token('color-neutral')};
18
- font-weight: ${token('font-weight-bold')};
19
16
  font-size: ${token('font-size-5')};
17
+ font-weight: ${token('font-weight-bold')};
20
18
  line-height: ${token('font-height-3')};
19
+
20
+ color: ${token('color-neutral')};
21
21
  text-transform: uppercase;
22
22
  `
23
23
 
@@ -17,23 +17,22 @@ export type MenuBaseItemProps = HTMLAttributes<HTMLElement> & {
17
17
  }
18
18
 
19
19
  const StyledMenuItem = styled.button`
20
- ${transition({ duration: '0.25s' })};
21
-
22
20
  display: flex;
23
- width: 100%;
24
21
  align-items: center;
25
22
  justify-content: space-between;
23
+ width: 100%;
26
24
  padding: ${token('space-s')} 0;
27
25
  padding-right: ${rem('12px')};
28
26
  padding-left: ${token('space-l')};
29
27
 
30
- color: ${token('color-neutral-white')};
31
- font-weight: ${token('font-weight-bold')};
32
28
  font-size: ${token('font-size-4')};
29
+ font-weight: ${token('font-weight-bold')};
33
30
  line-height: ${token('font-height-3')};
31
+ color: ${token('color-neutral-white')};
34
32
 
35
33
  cursor: pointer;
36
34
 
35
+ ${transition({ duration: '0.25s' })};
37
36
  ${focusable`
38
37
  color: ${token('color-primary')};
39
38
  `}
@@ -35,11 +35,10 @@ const StyledIcon = styled(Icon)<IExpandable>`
35
35
  `
36
36
 
37
37
  const ExpandableItems = styled.div<IExpandable>`
38
- overflow: hidden;
39
- ${transition({ property: 'height' })}
40
-
41
38
  height: ${prop('$height', 0)}px;
39
+ overflow: hidden;
42
40
 
41
+ ${transition({ property: 'height' })}
43
42
  ${MenuLink} {
44
43
  padding-left: ${token('space-xl')};
45
44
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { Meta } from '@storybook/react/types-6-0'
2
+ import type { Meta } from '@storybook/react/types-6-0'
3
3
 
4
4
  import { Tag } from 'components/Tag'
5
5
  import { Icon } from 'components/Icon'