@lumx/react 3.10.1-alpha.6 → 3.10.1-alpha.8

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 (166) hide show
  1. package/index.d.ts +86 -12
  2. package/index.js +299 -296
  3. package/index.js.map +1 -1
  4. package/package.json +3 -3
  5. package/src/components/alert-dialog/AlertDialog.tsx +6 -3
  6. package/src/components/autocomplete/Autocomplete.stories.tsx +1 -2
  7. package/src/components/autocomplete/Autocomplete.tsx +3 -3
  8. package/src/components/autocomplete/AutocompleteMultiple.stories.tsx +2 -5
  9. package/src/components/autocomplete/AutocompleteMultiple.tsx +2 -2
  10. package/src/components/avatar/Avatar.tsx +3 -3
  11. package/src/components/badge/Badge.tsx +3 -3
  12. package/src/components/badge/BadgeWrapper.tsx +3 -2
  13. package/src/components/button/Button.tsx +9 -8
  14. package/src/components/button/ButtonGroup.tsx +9 -3
  15. package/src/components/button/ButtonRoot.tsx +6 -2
  16. package/src/components/button/IconButton.tsx +2 -2
  17. package/src/components/checkbox/Checkbox.tsx +4 -4
  18. package/src/components/chip/Chip.tsx +15 -9
  19. package/src/components/chip/ChipGroup.tsx +3 -2
  20. package/src/components/comment-block/CommentBlock.stories.tsx +4 -7
  21. package/src/components/comment-block/CommentBlock.tsx +3 -3
  22. package/src/components/date-picker/constants.ts +2 -2
  23. package/src/components/dialog/Dialog.tsx +9 -7
  24. package/src/components/divider/Divider.tsx +3 -3
  25. package/src/components/drag-handle/DragHandle.tsx +3 -3
  26. package/src/components/dropdown/Dropdown.tsx +4 -3
  27. package/src/components/expansion-panel/ExpansionPanel.tsx +26 -20
  28. package/src/components/flag/Flag.tsx +3 -3
  29. package/src/components/flex-box/FlexBox.tsx +4 -4
  30. package/src/components/generic-block/GenericBlock.tsx +10 -8
  31. package/src/components/generic-block/constants.ts +4 -9
  32. package/src/components/grid/Grid.tsx +5 -3
  33. package/src/components/grid/GridItem.tsx +5 -3
  34. package/src/components/grid-column/GridColumn.tsx +5 -3
  35. package/src/components/heading/Heading.tsx +7 -2
  36. package/src/components/icon/Icon.tsx +3 -3
  37. package/src/components/image-block/ImageBlock.tsx +3 -3
  38. package/src/components/image-lightbox/ImageLightbox.tsx +1 -1
  39. package/src/components/image-lightbox/constants.ts +2 -2
  40. package/src/components/image-lightbox/internal/ImageSlide.tsx +1 -1
  41. package/src/components/image-lightbox/internal/ImageSlideshow.tsx +9 -5
  42. package/src/components/image-lightbox/useImageLightbox.tsx +2 -1
  43. package/src/components/inline-list/InlineList.tsx +7 -3
  44. package/src/components/input-helper/InputHelper.tsx +3 -3
  45. package/src/components/input-label/InputLabel.tsx +3 -3
  46. package/src/components/lightbox/Lightbox.tsx +6 -4
  47. package/src/components/link/Link.tsx +11 -7
  48. package/src/components/link-preview/LinkPreview.tsx +3 -3
  49. package/src/components/list/List.tsx +4 -4
  50. package/src/components/list/ListDivider.tsx +3 -2
  51. package/src/components/list/ListItem.tsx +6 -5
  52. package/src/components/list/ListSubheader.tsx +3 -2
  53. package/src/components/list/useInteractiveList.tsx +7 -6
  54. package/src/components/message/Message.tsx +3 -3
  55. package/src/components/mosaic/Mosaic.test.tsx +3 -3
  56. package/src/components/mosaic/Mosaic.tsx +6 -5
  57. package/src/components/navigation/Navigation.stories.tsx +2 -2
  58. package/src/components/navigation/Navigation.tsx +3 -3
  59. package/src/components/navigation/NavigationItem.tsx +3 -9
  60. package/src/components/navigation/NavigationSection.tsx +3 -3
  61. package/src/components/notification/Notification.tsx +9 -5
  62. package/src/components/popover/Popover.stories.tsx +13 -15
  63. package/src/components/popover/Popover.test.tsx +6 -1
  64. package/src/components/popover/Popover.tsx +6 -6
  65. package/src/components/popover/usePopoverStyle.tsx +1 -3
  66. package/src/components/popover/useRestoreFocusOnClose.tsx +1 -1
  67. package/src/components/popover-dialog/PopoverDialog.tsx +3 -2
  68. package/src/components/post-block/PostBlock.tsx +11 -7
  69. package/src/components/progress/Progress.tsx +3 -3
  70. package/src/components/progress/ProgressCircular.tsx +3 -3
  71. package/src/components/progress/ProgressLinear.tsx +3 -3
  72. package/src/components/progress-tracker/ProgressTracker.stories.tsx +11 -11
  73. package/src/components/progress-tracker/ProgressTracker.tsx +4 -3
  74. package/src/components/progress-tracker/ProgressTrackerStep.tsx +3 -3
  75. package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +2 -0
  76. package/src/components/radio-button/RadioButton.tsx +3 -3
  77. package/src/components/radio-button/RadioGroup.stories.tsx +1 -4
  78. package/src/components/radio-button/RadioGroup.tsx +3 -2
  79. package/src/components/select/Select.stories.tsx +19 -38
  80. package/src/components/select/Select.tsx +5 -5
  81. package/src/components/select/SelectMultiple.stories.tsx +15 -30
  82. package/src/components/select/SelectMultiple.tsx +3 -4
  83. package/src/components/select/WithSelectContext.tsx +3 -4
  84. package/src/components/select/constants.ts +3 -1
  85. package/src/components/side-navigation/SideNavigation.stories.tsx +1 -1
  86. package/src/components/side-navigation/SideNavigation.tsx +4 -3
  87. package/src/components/side-navigation/SideNavigationItem.tsx +7 -7
  88. package/src/components/skeleton/SkeletonCircle.tsx +3 -3
  89. package/src/components/skeleton/SkeletonRectangle.tsx +3 -3
  90. package/src/components/skeleton/SkeletonTypography.stories.tsx +7 -12
  91. package/src/components/skeleton/SkeletonTypography.tsx +3 -3
  92. package/src/components/slider/Slider.tsx +4 -4
  93. package/src/components/slider/index.ts +1 -1
  94. package/src/components/slideshow/Slides.tsx +6 -4
  95. package/src/components/slideshow/Slideshow.stories.tsx +1 -3
  96. package/src/components/slideshow/Slideshow.tsx +3 -1
  97. package/src/components/slideshow/SlideshowControls.stories.tsx +1 -4
  98. package/src/components/slideshow/SlideshowControls.tsx +4 -4
  99. package/src/components/slideshow/SlideshowItem.tsx +5 -2
  100. package/src/components/slideshow/SlideshowItemGroup.tsx +5 -3
  101. package/src/components/switch/Switch.test.tsx +1 -1
  102. package/src/components/switch/Switch.tsx +7 -4
  103. package/src/components/table/Table.tsx +5 -3
  104. package/src/components/table/TableBody.tsx +7 -3
  105. package/src/components/table/TableCell.tsx +5 -3
  106. package/src/components/table/TableHeader.tsx +7 -3
  107. package/src/components/table/TableRow.tsx +5 -3
  108. package/src/components/tabs/TabList.tsx +1 -1
  109. package/src/components/tabs/TabPanel.tsx +2 -0
  110. package/src/components/tabs/Tabs.stories.tsx +12 -11
  111. package/src/components/text/Text.tsx +14 -5
  112. package/src/components/text-field/TextField.test.tsx +2 -2
  113. package/src/components/text-field/TextField.tsx +8 -7
  114. package/src/components/thumbnail/Thumbnail.tsx +4 -4
  115. package/src/components/toolbar/Toolbar.tsx +3 -3
  116. package/src/components/tooltip/Tooltip.tsx +4 -4
  117. package/src/components/tooltip/context.tsx +1 -1
  118. package/src/components/tooltip/useInjectTooltipRef.tsx +1 -1
  119. package/src/components/uploader/Uploader.tsx +3 -3
  120. package/src/components/user-block/UserBlock.tsx +12 -10
  121. package/src/hooks/useCallbackOnEscape.ts +1 -1
  122. package/src/hooks/useClickAway.tsx +2 -1
  123. package/src/hooks/useFocusTrap.ts +1 -1
  124. package/src/hooks/useInterval.tsx +4 -1
  125. package/src/hooks/useKeyboardListNavigation.tsx +4 -2
  126. package/src/hooks/useSizeOnWindowResize.ts +10 -14
  127. package/src/hooks/useStopPropagation.ts +2 -1
  128. package/src/stories/decorators/withCombinations.tsx +1 -1
  129. package/src/testing/utils/commonTestsSuiteRTL.tsx +2 -2
  130. package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +4 -0
  131. package/src/utils/className/getRootClassName.test.ts +11 -0
  132. package/src/utils/className/getRootClassName.ts +24 -0
  133. package/src/utils/className/index.ts +1 -0
  134. package/src/utils/date/getMonthCalendar.ts +4 -3
  135. package/src/utils/{makeListenerTowerContext.ts → function/makeListenerTowerContext.ts} +2 -2
  136. package/src/utils/{collection/partitionMulti.ts → partitionMulti.ts} +12 -13
  137. package/src/utils/{flattenChildren.ts → react/flattenChildren.ts} +3 -2
  138. package/src/utils/{renderButtonOrLink.tsx → react/renderButtonOrLink.tsx} +1 -1
  139. package/src/utils/{skipRender.tsx → react/skipRender.tsx} +1 -1
  140. package/src/utils/type/index.ts +18 -18
  141. package/src/utils/type/isComponent.ts +33 -0
  142. package/utils/index.d.ts +4 -0
  143. package/utils/index.js +96 -1
  144. package/utils/index.js.map +1 -1
  145. package/_internal/index.js +0 -99
  146. package/_internal/index.js.map +0 -1
  147. package/src/utils/collection/castArray.test.ts +0 -15
  148. package/src/utils/collection/castArray.ts +0 -3
  149. package/src/utils/collection/chunk.test.ts +0 -15
  150. package/src/utils/collection/chunk.ts +0 -6
  151. package/src/utils/collection/isEmpty.test.js +0 -20
  152. package/src/utils/collection/isEmpty.ts +0 -4
  153. package/src/utils/collection/last.ts +0 -2
  154. package/src/utils/collection/partitionMulti.test.ts +0 -35
  155. package/src/utils/collection/pull.test.ts +0 -17
  156. package/src/utils/collection/pull.ts +0 -7
  157. package/src/utils/collection/range.test.js +0 -9
  158. package/src/utils/collection/range.ts +0 -2
  159. package/src/utils/function/memoize.test.ts +0 -36
  160. package/src/utils/function/memoize.ts +0 -13
  161. package/src/utils/type/ComponentClassName.ts +0 -7
  162. package/src/utils/type/KebabCase.ts +0 -6
  163. /package/src/utils/{clamp.ts → number/clamp.ts} +0 -0
  164. /package/src/utils/{OnBeforeUnmount.tsx → react/OnBeforeUnmount.tsx} +0 -0
  165. /package/src/utils/{mergeRefs.ts → react/mergeRefs.ts} +0 -0
  166. /package/src/utils/{renderLink.tsx → react/renderLink.tsx} +0 -0
@@ -8,6 +8,8 @@ import {
8
8
  ProgressTrackerStep,
9
9
  ProgressTrackerStepPanel,
10
10
  } from '@lumx/react';
11
+ import cloneDeep from 'lodash/cloneDeep';
12
+ import set from 'lodash/set';
11
13
  import React, { useState } from 'react';
12
14
 
13
15
  export default { title: 'LumX components/progress-tracker/Progress Tracker' };
@@ -50,26 +52,24 @@ export const Controlled = () => {
50
52
  ]);
51
53
 
52
54
  const toggleError = (index: number) => () => {
53
- const newSteps = [...steps];
54
- const step = steps[index];
55
- const newStep = { ...step, hasError: !step?.hasError, isComplete: false };
56
- newSteps[index] = newStep;
57
- setSteps(newSteps);
55
+ const clonedSteps = cloneDeep(steps);
56
+ set(clonedSteps, [index, 'hasError'], !steps[index].hasError);
57
+ set(clonedSteps, [index, 'isComplete'], false);
58
+ setSteps(clonedSteps);
58
59
  };
59
60
 
60
61
  const previous = (index: number) => () => setActiveStep(index - 1);
61
62
 
62
63
  const next = (index: number) => () => {
63
64
  const isLast = index === steps.length - 1;
64
- const step = steps[index];
65
- const newSteps = [...steps];
66
- const newStep = { ...step, hasError: false, isComplete: true };
65
+ const clonedSteps = cloneDeep(steps);
66
+ set(clonedSteps, [index, 'isComplete'], true);
67
+ set(clonedSteps, [index, 'hasError'], false);
67
68
  if (!isLast) {
68
- newSteps[index + 1].isDisabled = false;
69
+ set(clonedSteps, [index + 1, 'isDisabled'], false);
69
70
  setActiveStep(index + 1);
70
71
  }
71
- newSteps[index] = newStep;
72
- setSteps(newSteps);
72
+ setSteps(clonedSteps);
73
73
  };
74
74
 
75
75
  return (
@@ -2,8 +2,9 @@ import React, { ReactNode } from 'react';
2
2
 
3
3
  import classNames from 'classnames';
4
4
 
5
- import type { GenericProps, ComponentClassName } from '@lumx/react/utils/type';
6
- import { mergeRefs } from '@lumx/react/utils/mergeRefs';
5
+ import { GenericProps } from '@lumx/react/utils/type';
6
+ import { getRootClassName } from '@lumx/react/utils/className';
7
+ import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
7
8
  import { forwardRef } from '@lumx/react/utils/react/forwardRef';
8
9
 
9
10
  import { useRovingTabIndex } from '../../hooks/useRovingTabIndex';
@@ -27,7 +28,7 @@ const COMPONENT_NAME = 'ProgressTracker';
27
28
  /**
28
29
  * Component default class name and class prefix.
29
30
  */
30
- const CLASSNAME: ComponentClassName<typeof COMPONENT_NAME> = 'lumx-progress-tracker';
31
+ const CLASSNAME = getRootClassName(COMPONENT_NAME);
31
32
 
32
33
  /**
33
34
  * Component default props.
@@ -4,8 +4,8 @@ import classNames from 'classnames';
4
4
 
5
5
  import { mdiAlertCircle, mdiCheckCircle, mdiRadioboxBlank, mdiRadioboxMarked } from '@lumx/icons';
6
6
  import { Icon, InputHelper, InputLabel, Kind, Size } from '@lumx/react';
7
- import type { GenericProps, ComponentClassName } from '@lumx/react/utils/type';
8
- import { handleBasicClasses } from '@lumx/react/utils/className';
7
+ import { GenericProps } from '@lumx/react/utils/type';
8
+ import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
9
9
  import { forwardRef } from '@lumx/react/utils/react/forwardRef';
10
10
 
11
11
  import { useTabProviderContext } from '../tabs/state';
@@ -40,7 +40,7 @@ const COMPONENT_NAME = 'ProgressTrackerStep';
40
40
  /**
41
41
  * Component default class name and class prefix.
42
42
  */
43
- const CLASSNAME: ComponentClassName<typeof COMPONENT_NAME> = 'lumx-progress-tracker-step';
43
+ const CLASSNAME = getRootClassName(COMPONENT_NAME);
44
44
 
45
45
  /**
46
46
  * Component default props.
@@ -16,6 +16,8 @@ export interface ProgressTrackerStepPanelProps extends GenericProps {
16
16
  id?: string;
17
17
  /** Whether the step is active or not. */
18
18
  isActive?: boolean;
19
+ /** Children */
20
+ children?: React.ReactNode;
19
21
  }
20
22
 
21
23
  /**
@@ -3,8 +3,8 @@ import React, { ReactNode, SyntheticEvent, InputHTMLAttributes } from 'react';
3
3
  import classNames from 'classnames';
4
4
 
5
5
  import { InputHelper, InputLabel, Theme } from '@lumx/react';
6
- import type { GenericProps, HasTheme, ComponentClassName } from '@lumx/react/utils/type';
7
- import { handleBasicClasses } from '@lumx/react/utils/className';
6
+ import { GenericProps, HasTheme } from '@lumx/react/utils/type';
7
+ import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
8
8
  import { useId } from '@lumx/react/hooks/useId';
9
9
  import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
10
10
  import { forwardRef } from '@lumx/react/utils/react/forwardRef';
@@ -43,7 +43,7 @@ const COMPONENT_NAME = 'RadioButton';
43
43
  /**
44
44
  * Component default class name and class prefix.
45
45
  */
46
- const CLASSNAME: ComponentClassName<typeof COMPONENT_NAME> = 'lumx-radio-button';
46
+ const CLASSNAME = getRootClassName(COMPONENT_NAME);
47
47
 
48
48
  /**
49
49
  * Component default props.
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
3
3
 
4
4
  export default { title: 'LumX components/radio-button/Radio Group' };
5
5
 
6
- export const Simple = ({ theme }: any) => {
6
+ export const Simple = () => {
7
7
  const [value, onChange] = useState('lorem');
8
8
 
9
9
  return (
@@ -13,7 +13,6 @@ export const Simple = ({ theme }: any) => {
13
13
  helper="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed posuere faucibus efficitur."
14
14
  label="Radio button with help 1"
15
15
  name="test2"
16
- theme={theme}
17
16
  value="lorem"
18
17
  onChange={onChange as any}
19
18
  />
@@ -23,7 +22,6 @@ export const Simple = ({ theme }: any) => {
23
22
  helper="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed posuere faucibus efficitur."
24
23
  label="Radio button with help 2"
25
24
  name="test2"
26
- theme={theme}
27
25
  value="ipsum"
28
26
  onChange={onChange as any}
29
27
  />
@@ -33,7 +31,6 @@ export const Simple = ({ theme }: any) => {
33
31
  helper="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed posuere faucibus efficitur."
34
32
  label="Radio button with help 3"
35
33
  name="test2"
36
- theme={theme}
37
34
  value="dolor"
38
35
  onChange={onChange as any}
39
36
  />
@@ -2,7 +2,8 @@ import React, { ReactNode } from 'react';
2
2
 
3
3
  import classNames from 'classnames';
4
4
 
5
- import type { GenericProps, ComponentClassName } from '@lumx/react/utils/type';
5
+ import { GenericProps } from '@lumx/react/utils/type';
6
+ import { getRootClassName } from '@lumx/react/utils/className';
6
7
  import { forwardRef } from '@lumx/react/utils/react/forwardRef';
7
8
 
8
9
  /**
@@ -21,7 +22,7 @@ const COMPONENT_NAME = 'RadioGroup';
21
22
  /**
22
23
  * Component default class name and class prefix.
23
24
  */
24
- const CLASSNAME: ComponentClassName<typeof COMPONENT_NAME> = 'lumx-radio-group';
25
+ const CLASSNAME = getRootClassName(COMPONENT_NAME);
25
26
 
26
27
  /**
27
28
  * RadioGroup component.
@@ -1,6 +1,7 @@
1
1
  import { mdiBullhornOutline } from '@lumx/icons';
2
2
  import { List, ListItem, Select, Size, TextField } from '@lumx/react';
3
3
  import { useBooleanState } from '@lumx/react/hooks/useBooleanState';
4
+ import noop from 'lodash/noop';
4
5
  import range from 'lodash/range';
5
6
  import React, { SyntheticEvent, useState } from 'react';
6
7
  import { SelectVariant } from './constants';
@@ -8,15 +9,11 @@ import { SelectVariant } from './constants';
8
9
  export default {
9
10
  title: 'LumX components/select/Select',
10
11
  component: Select,
11
- argTypes: {
12
- onInputClick: { action: true },
13
- onDropdownClose: { action: true },
14
- },
15
12
  };
16
13
 
17
14
  const CHOICES = ['First item', 'Second item', 'Third item'];
18
15
 
19
- export const SimpleSelect = ({ theme }: any) => {
16
+ export const SimpleSelect = () => {
20
17
  const PLACEHOLDER = 'Select a value';
21
18
  const LABEL = 'Select label';
22
19
 
@@ -35,7 +32,6 @@ export const SimpleSelect = ({ theme }: any) => {
35
32
  value={value}
36
33
  label={LABEL}
37
34
  placeholder={PLACEHOLDER}
38
- theme={theme}
39
35
  onInputClick={toggleSelect}
40
36
  onDropdownClose={closeSelect}
41
37
  icon={mdiBullhornOutline}
@@ -62,7 +58,7 @@ export const SimpleSelect = ({ theme }: any) => {
62
58
  );
63
59
  };
64
60
 
65
- export const SimpleSelectWithInfiniteScroll = ({ theme }: any) => {
61
+ export const SimpleSelectWithInfiniteScroll = () => {
66
62
  const PLACEHOLDER = 'Select a value';
67
63
  const LABEL = 'Select label';
68
64
  const [items, setItems] = useState(CHOICES);
@@ -85,7 +81,6 @@ export const SimpleSelectWithInfiniteScroll = ({ theme }: any) => {
85
81
  value={value}
86
82
  label={LABEL}
87
83
  placeholder={PLACEHOLDER}
88
- theme={theme}
89
84
  onInputClick={toggleSelect}
90
85
  onDropdownClose={closeSelect}
91
86
  onInfiniteScroll={onInfinite}
@@ -112,19 +107,18 @@ export const SimpleSelectWithInfiniteScroll = ({ theme }: any) => {
112
107
  );
113
108
  };
114
109
 
115
- export const DisabledSelect = ({ theme, onInputClick, onDropdownClose }: any) => {
110
+ export const DisabledSelect = () => {
116
111
  return (
117
112
  <Select
118
113
  isOpen={false}
119
114
  value=""
120
115
  label="My select"
121
116
  placeholder="Placeholder"
122
- theme={theme}
123
- onInputClick={onInputClick}
124
- onDropdownClose={onDropdownClose}
117
+ onInputClick={noop}
118
+ onDropdownClose={noop}
125
119
  isDisabled
126
120
  >
127
- <List theme={theme} isClickable>
121
+ <List isClickable>
128
122
  <ListItem key={0} size={Size.tiny}>
129
123
  No data
130
124
  </ListItem>
@@ -133,7 +127,7 @@ export const DisabledSelect = ({ theme, onInputClick, onDropdownClose }: any) =>
133
127
  );
134
128
  };
135
129
 
136
- export const SelectWithClearButton = ({ theme }: any) => {
130
+ export const SelectWithClearButton = () => {
137
131
  const PLACEHOLDER = 'Select a value';
138
132
  const LABEL = 'Select label';
139
133
 
@@ -159,7 +153,6 @@ export const SelectWithClearButton = ({ theme }: any) => {
159
153
  clearButtonProps={{ label: 'Clear' }}
160
154
  label={LABEL}
161
155
  placeholder={PLACEHOLDER}
162
- theme={theme}
163
156
  onInputClick={toggleSelect}
164
157
  onDropdownClose={closeSelect}
165
158
  >
@@ -185,7 +178,7 @@ export const SelectWithClearButton = ({ theme }: any) => {
185
178
  );
186
179
  };
187
180
 
188
- export const SelectWithAnotherField = ({ theme }: any) => {
181
+ export const SelectWithAnotherField = () => {
189
182
  const PLACEHOLDER = 'Select a value';
190
183
  const LABEL = 'Select label';
191
184
 
@@ -209,13 +202,7 @@ export const SelectWithAnotherField = ({ theme }: any) => {
209
202
 
210
203
  return (
211
204
  <>
212
- <TextField
213
- value="myvalue"
214
- label="I am the label"
215
- placeholder="ex: A value"
216
- theme={theme}
217
- onChange={() => {}}
218
- />
205
+ <TextField value="myvalue" label="I am the label" placeholder="ex: A value" onChange={noop} />
219
206
  <Select
220
207
  style={{ width: '100%' }}
221
208
  isOpen={isOpen}
@@ -224,7 +211,6 @@ export const SelectWithAnotherField = ({ theme }: any) => {
224
211
  clearButtonProps={{ label: 'Clear' }}
225
212
  label={LABEL}
226
213
  placeholder={PLACEHOLDER}
227
- theme={theme}
228
214
  onInputClick={toggleSelect}
229
215
  onDropdownClose={closeSelect}
230
216
  onBlur={onBlur}
@@ -253,7 +239,7 @@ export const SelectWithAnotherField = ({ theme }: any) => {
253
239
  );
254
240
  };
255
241
 
256
- export const SelectWithNoData = ({ theme }: any) => {
242
+ export const SelectWithNoData = () => {
257
243
  const [isOpen, closeSelect, , toggleSelect] = useBooleanState(true);
258
244
 
259
245
  return (
@@ -262,11 +248,10 @@ export const SelectWithNoData = ({ theme }: any) => {
262
248
  value=""
263
249
  label="My select"
264
250
  placeholder="Placeholder"
265
- theme={theme}
266
251
  onInputClick={toggleSelect}
267
252
  onDropdownClose={closeSelect}
268
253
  >
269
- <List theme={theme} isClickable>
254
+ <List isClickable>
270
255
  <ListItem key={0} size={Size.tiny}>
271
256
  No data
272
257
  </ListItem>
@@ -275,7 +260,7 @@ export const SelectWithNoData = ({ theme }: any) => {
275
260
  );
276
261
  };
277
262
 
278
- export const SelectWithHelper = ({ theme }: any) => {
263
+ export const SelectWithHelper = () => {
279
264
  const [isOpen, closeSelect, , toggleSelect] = useBooleanState(false);
280
265
 
281
266
  return (
@@ -284,12 +269,11 @@ export const SelectWithHelper = ({ theme }: any) => {
284
269
  value=""
285
270
  label="Country"
286
271
  placeholder="Your country"
287
- theme={theme}
288
272
  helper="This is used in analytics"
289
273
  onInputClick={toggleSelect}
290
274
  onDropdownClose={closeSelect}
291
275
  >
292
- <List theme={theme} isClickable>
276
+ <List isClickable>
293
277
  {CHOICES.map((choice) => (
294
278
  <ListItem key={choice} size={Size.tiny}>
295
279
  {choice}
@@ -300,7 +284,7 @@ export const SelectWithHelper = ({ theme }: any) => {
300
284
  );
301
285
  };
302
286
 
303
- export const SelectWithError = ({ theme }: any) => {
287
+ export const SelectWithError = () => {
304
288
  const [isOpen, closeSelect, , toggleSelect] = useBooleanState(false);
305
289
 
306
290
  return (
@@ -309,14 +293,13 @@ export const SelectWithError = ({ theme }: any) => {
309
293
  value=""
310
294
  label="Country"
311
295
  placeholder="Your country"
312
- theme={theme}
313
296
  helper="This is used in analytics"
314
297
  onInputClick={toggleSelect}
315
298
  onDropdownClose={closeSelect}
316
299
  hasError
317
300
  error="Please select something :)"
318
301
  >
319
- <List theme={theme} isClickable>
302
+ <List isClickable>
320
303
  {CHOICES.map((choice) => (
321
304
  <ListItem key={choice} size={Size.tiny}>
322
305
  {choice}
@@ -327,7 +310,7 @@ export const SelectWithError = ({ theme }: any) => {
327
310
  );
328
311
  };
329
312
 
330
- export const SelectSuccess = ({ theme }: any) => {
313
+ export const SelectSuccess = () => {
331
314
  const [isOpen, closeSelect, , toggleSelect] = useBooleanState(false);
332
315
 
333
316
  return (
@@ -336,13 +319,12 @@ export const SelectSuccess = ({ theme }: any) => {
336
319
  value=""
337
320
  label="Country"
338
321
  placeholder="Your country"
339
- theme={theme}
340
322
  helper="This is used in analytics"
341
323
  onInputClick={toggleSelect}
342
324
  onDropdownClose={closeSelect}
343
325
  isValid
344
326
  >
345
- <List theme={theme} isClickable>
327
+ <List isClickable>
346
328
  {CHOICES.map((choice) => (
347
329
  <ListItem key={choice} size={Size.tiny}>
348
330
  {choice}
@@ -353,7 +335,7 @@ export const SelectSuccess = ({ theme }: any) => {
353
335
  );
354
336
  };
355
337
 
356
- export const SelectWithChipVariant = ({ theme }: any) => {
338
+ export const SelectWithChipVariant = () => {
357
339
  const PLACEHOLDER = 'Select a value';
358
340
  const LABEL = 'Select label';
359
341
 
@@ -374,7 +356,6 @@ export const SelectWithChipVariant = ({ theme }: any) => {
374
356
  value={value}
375
357
  label={LABEL}
376
358
  placeholder={PLACEHOLDER}
377
- theme={theme}
378
359
  onInputClick={toggleSelect}
379
360
  onDropdownClose={closeSelect}
380
361
  variant={SelectVariant.chip}
@@ -1,6 +1,7 @@
1
1
  import React, { RefObject } from 'react';
2
2
 
3
3
  import classNames from 'classnames';
4
+ import lodashIsEmpty from 'lodash/isEmpty';
4
5
 
5
6
  import { mdiAlertCircle, mdiCheckCircle, mdiCloseCircle, mdiMenuDown } from '@lumx/icons';
6
7
  import { Emphasis, Size, Theme } from '@lumx/react/components';
@@ -8,10 +9,9 @@ import { IconButton } from '@lumx/react/components/button/IconButton';
8
9
  import { Chip } from '@lumx/react/components/chip/Chip';
9
10
  import { Icon } from '@lumx/react/components/icon/Icon';
10
11
  import { InputLabel } from '@lumx/react/components/input-label/InputLabel';
11
- import { handleBasicClasses } from '@lumx/react/utils/className';
12
- import { mergeRefs } from '@lumx/react/utils/mergeRefs';
12
+ import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
13
+ import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
13
14
  import { forwardRef } from '@lumx/react/utils/react/forwardRef';
14
- import type { ComponentClassName } from '@lumx/react/utils/type';
15
15
 
16
16
  import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
17
17
  import { WithSelectContext } from './WithSelectContext';
@@ -29,7 +29,7 @@ export { SelectVariant };
29
29
  const COMPONENT_NAME = 'Select';
30
30
 
31
31
  /** The default class name and classes prefix for this component. */
32
- const CLASSNAME: ComponentClassName<typeof COMPONENT_NAME> = 'lumx-select';
32
+ const CLASSNAME = getRootClassName(COMPONENT_NAME);
33
33
 
34
34
  /** The default value of props. */
35
35
  const DEFAULT_PROPS: Partial<SelectProps> = {
@@ -170,7 +170,7 @@ const SelectField: React.FC<SelectProps> = (props) => {
170
170
  * @return React element.
171
171
  */
172
172
  export const Select = forwardRef<SelectProps, HTMLDivElement>((props, ref) => {
173
- const isEmpty = !props.value;
173
+ const isEmpty = lodashIsEmpty(props.value);
174
174
  const hasInputClear = props.onClear && props.clearButtonProps && !isEmpty;
175
175
 
176
176
  return WithSelectContext(
@@ -13,19 +13,17 @@ import {
13
13
  Toolbar,
14
14
  } from '@lumx/react';
15
15
  import { useBooleanState } from '@lumx/react/hooks/useBooleanState';
16
+ import noop from 'lodash/noop';
16
17
  import React, { MouseEventHandler, SyntheticEvent, useRef, useState } from 'react';
17
18
  import { SelectVariant } from './constants';
18
19
 
19
- export default {
20
- title: 'LumX components/select/Select Multiple',
21
- argTypes: { onClear: { action: true }, onInputClick: { action: true }, onDropdownClose: { action: true } },
22
- };
20
+ export default { title: 'LumX components/select/Select Multiple' };
23
21
 
24
22
  const PLACEHOLDER = 'Select values';
25
23
  const LABEL = 'Select label';
26
24
  const CHOICES = ['First item', 'Second item', 'Third item'];
27
25
 
28
- export const DefaultSelectMultiple = ({ theme }: any) => {
26
+ export const DefaultSelectMultiple = () => {
29
27
  const [values, setValues] = useState<string[]>([]);
30
28
  const [isOpen, closeSelect, , toggleSelect] = useBooleanState(false);
31
29
 
@@ -51,7 +49,6 @@ export const DefaultSelectMultiple = ({ theme }: any) => {
51
49
  clearButtonProps={{ label: 'Clear' }}
52
50
  label={LABEL}
53
51
  placeholder={PLACEHOLDER}
54
- theme={theme}
55
52
  onInputClick={toggleSelect}
56
53
  onDropdownClose={closeSelect}
57
54
  icon={mdiTram}
@@ -78,18 +75,17 @@ export const DefaultSelectMultiple = ({ theme }: any) => {
78
75
  );
79
76
  };
80
77
 
81
- export const SelectMultipleWithNoData = ({ theme, onClear, onInputClick, onDropdownClose }: any) => {
78
+ export const SelectMultipleWithNoData = () => {
82
79
  return (
83
80
  <SelectMultiple
84
81
  isOpen
85
82
  value={[]}
86
- onClear={onClear}
83
+ onClear={noop}
87
84
  clearButtonProps={{ label: 'Clear' }}
88
85
  label="Select label"
89
86
  placeholder="Select values"
90
- theme={theme}
91
- onInputClick={onInputClick}
92
- onDropdownClose={onDropdownClose}
87
+ onInputClick={noop}
88
+ onDropdownClose={noop}
93
89
  >
94
90
  <List isClickable>
95
91
  <ListItem key={0} size={Size.tiny}>
@@ -100,24 +96,23 @@ export const SelectMultipleWithNoData = ({ theme, onClear, onInputClick, onDropd
100
96
  );
101
97
  };
102
98
 
103
- export const DisabledSelectMultiple = ({ theme, onClear, onInputClick, onDropdownClose }: any) => {
99
+ export const DisabledSelectMultiple = () => {
104
100
  return (
105
101
  <SelectMultiple
106
102
  isOpen
107
103
  value={[]}
108
- onClear={onClear}
104
+ onClear={noop}
109
105
  clearButtonProps={{ label: 'Clear' }}
110
106
  label="Select label"
111
107
  placeholder="Select values"
112
- theme={theme}
113
- onInputClick={onInputClick}
114
- onDropdownClose={onDropdownClose}
108
+ onInputClick={noop}
109
+ onDropdownClose={noop}
115
110
  isDisabled
116
111
  />
117
112
  );
118
113
  };
119
114
 
120
- export const ChipsSelectMultiple = ({ theme }: any) => {
115
+ export const ChipsSelectMultiple = () => {
121
116
  const [values, setValues] = useState<string[]>([]);
122
117
  const [isOpen, closeSelect, , toggleSelect] = useBooleanState(false);
123
118
 
@@ -144,7 +139,6 @@ export const ChipsSelectMultiple = ({ theme }: any) => {
144
139
  clearButtonProps={{ label: 'Clear' }}
145
140
  label={LABEL}
146
141
  placeholder={PLACEHOLDER}
147
- theme={theme}
148
142
  onInputClick={toggleSelect}
149
143
  onDropdownClose={closeSelect}
150
144
  >
@@ -170,7 +164,7 @@ export const ChipsSelectMultiple = ({ theme }: any) => {
170
164
  );
171
165
  };
172
166
 
173
- export const ChipsCustomSelectMultiple = ({ theme }: any) => {
167
+ export const ChipsCustomSelectMultiple = () => {
174
168
  const [values, setValues] = useState<string[]>([]);
175
169
  const [isOpen, closeSelect, , toggleSelect] = useBooleanState(false);
176
170
 
@@ -191,14 +185,7 @@ export const ChipsCustomSelectMultiple = ({ theme }: any) => {
191
185
  const customSelectChipRenderer = (choice: string, index: number, onClear: any, isDisabled: any) => {
192
186
  const onClick: MouseEventHandler = (event) => onClear && onClear(event, choice);
193
187
  return (
194
- <Chip
195
- key={choice}
196
- isDisabled={isDisabled}
197
- size={Size.s}
198
- onAfterClick={onClick}
199
- onClick={onClick}
200
- theme={theme}
201
- >
188
+ <Chip key={choice} isDisabled={isDisabled} size={Size.s} onAfterClick={onClick} onClick={onClick}>
202
189
  {choice}
203
190
  </Chip>
204
191
  );
@@ -212,7 +199,6 @@ export const ChipsCustomSelectMultiple = ({ theme }: any) => {
212
199
  clearButtonProps={{ label: 'Clear' }}
213
200
  label={LABEL}
214
201
  placeholder={PLACEHOLDER}
215
- theme={theme}
216
202
  onInputClick={toggleSelect}
217
203
  onDropdownClose={closeSelect}
218
204
  selectedChipRender={customSelectChipRenderer}
@@ -242,7 +228,7 @@ export const ChipsCustomSelectMultiple = ({ theme }: any) => {
242
228
  /**
243
229
  * Test select focus trap (focus is contained inside the dialog then inside the select dropdown)
244
230
  */
245
- export const SelectWithinADialog = ({ theme }: any) => {
231
+ export const SelectWithinADialog = () => {
246
232
  const searchFieldRef = useRef(null);
247
233
 
248
234
  const [searchText, setSearchText] = useState<string>();
@@ -285,7 +271,6 @@ export const SelectWithinADialog = ({ theme }: any) => {
285
271
  clearButtonProps={{ label: 'Clear' }}
286
272
  label={LABEL}
287
273
  placeholder={PLACEHOLDER}
288
- theme={theme}
289
274
  onInputClick={toggleSelect}
290
275
  onDropdownClose={closeSelect}
291
276
  icon={mdiTram}
@@ -7,11 +7,10 @@ import { Size, Theme } from '@lumx/react/components';
7
7
  import { Chip } from '@lumx/react/components/chip/Chip';
8
8
  import { Icon } from '@lumx/react/components/icon/Icon';
9
9
  import { InputLabel } from '@lumx/react/components/input-label/InputLabel';
10
- import { handleBasicClasses } from '@lumx/react/utils/className';
11
- import { mergeRefs } from '@lumx/react/utils/mergeRefs';
10
+ import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
11
+ import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
12
12
  import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
13
13
  import { forwardRef } from '@lumx/react/utils/react/forwardRef';
14
- import type { ComponentClassName } from '@lumx/react/utils/type';
15
14
 
16
15
  import { WithSelectContext } from './WithSelectContext';
17
16
  import { CoreSelectProps, SelectVariant } from './constants';
@@ -34,7 +33,7 @@ export interface SelectMultipleProps extends CoreSelectProps {
34
33
  const COMPONENT_NAME = 'Select';
35
34
 
36
35
  /** The default class name and classes prefix for this component. */
37
- const CLASSNAME: ComponentClassName<typeof COMPONENT_NAME> = 'lumx-select';
36
+ const CLASSNAME = getRootClassName(COMPONENT_NAME);
38
37
 
39
38
  /** The default value of props. */
40
39
  const DEFAULT_PROPS: Partial<SelectMultipleProps> = {
@@ -7,9 +7,8 @@ import { Dropdown } from '@lumx/react/components/dropdown/Dropdown';
7
7
  import { InputHelper } from '@lumx/react/components/input-helper/InputHelper';
8
8
  import { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';
9
9
  import { useListenFocus } from '@lumx/react/hooks/useListenFocus';
10
- import { handleBasicClasses } from '@lumx/react/utils/className';
11
- import { mergeRefs } from '@lumx/react/utils/mergeRefs';
12
- import type { ComponentClassName } from '@lumx/react/utils/type';
10
+ import { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';
11
+ import { mergeRefs } from '@lumx/react/utils/react/mergeRefs';
13
12
 
14
13
  import { useId } from '@lumx/react/hooks/useId';
15
14
  import { useTheme } from '@lumx/react/utils/theme/ThemeContext';
@@ -19,7 +18,7 @@ import { CoreSelectProps, SelectVariant } from './constants';
19
18
  const COMPONENT_NAME = 'Select';
20
19
 
21
20
  /** The default class name and classes prefix for this component. */
22
- const CLASSNAME: ComponentClassName<typeof COMPONENT_NAME> = 'lumx-select';
21
+ const CLASSNAME = getRootClassName(COMPONENT_NAME);
23
22
 
24
23
  /** The default value of props. */
25
24
  export const DEFAULT_PROPS: Partial<CoreSelectProps> = {
@@ -1,6 +1,6 @@
1
1
  import { IconButtonProps } from '@lumx/react';
2
2
  import { GenericProps, HasTheme, ValueOf } from '@lumx/react/utils/type';
3
- import { ReactNode, SyntheticEvent } from 'react';
3
+ import React, { ReactNode, SyntheticEvent } from 'react';
4
4
 
5
5
  /**
6
6
  * Select variants.
@@ -50,4 +50,6 @@ export interface CoreSelectProps extends GenericProps, HasTheme {
50
50
  onInfiniteScroll?(): void;
51
51
  /** Render value function. Default: Renders the value as a string. */
52
52
  selectedValueRender?(choice: string): ReactNode | string;
53
+ /** Children */
54
+ children?: React.ReactNode;
53
55
  }
@@ -6,7 +6,7 @@ import { Emphasis, SideNavigation, SideNavigationItem } from '@lumx/react';
6
6
 
7
7
  export default { title: 'LumX components/side-navigation/Side Navigation' };
8
8
 
9
- const CustomLink: React.FC = ({ children, ...props }) =>
9
+ const CustomLink: React.FC<{ children?: React.ReactNode }> = ({ children, ...props }) =>
10
10
  React.createElement('a', { ...props, style: { color: 'red' } }, children);
11
11
 
12
12
  export const Simple = () => (