@lumx/react 2.2.21 → 2.2.22-alpha-icons-tree-shake.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 (105) hide show
  1. package/esm/_internal/AutocompleteMultiple.js.map +1 -1
  2. package/esm/_internal/Avatar2.js.map +1 -1
  3. package/esm/_internal/ButtonRoot.js.map +1 -1
  4. package/esm/_internal/Checkbox2.js.map +1 -1
  5. package/esm/_internal/Chip2.js.map +1 -1
  6. package/esm/_internal/ClickAwayProvider.js +43 -24
  7. package/esm/_internal/ClickAwayProvider.js.map +1 -1
  8. package/esm/_internal/CommentBlock.js.map +1 -1
  9. package/esm/_internal/Dialog2.js +6 -3
  10. package/esm/_internal/Dialog2.js.map +1 -1
  11. package/esm/_internal/Divider2.js.map +1 -1
  12. package/esm/_internal/DragHandle.js.map +1 -1
  13. package/esm/_internal/Dropdown2.js.map +1 -1
  14. package/esm/_internal/ExpansionPanel.js.map +1 -1
  15. package/esm/_internal/Flag2.js.map +1 -1
  16. package/esm/_internal/GenericBlock.js +79 -22
  17. package/esm/_internal/GenericBlock.js.map +1 -1
  18. package/esm/_internal/Icon2.js.map +1 -1
  19. package/esm/_internal/ImageBlock.js.map +1 -1
  20. package/esm/_internal/InputHelper.js.map +1 -1
  21. package/esm/_internal/InputLabel.js.map +1 -1
  22. package/esm/_internal/Lightbox2.js +1 -1
  23. package/esm/_internal/Lightbox2.js.map +1 -1
  24. package/esm/_internal/LinkPreview.js.map +1 -1
  25. package/esm/_internal/Mosaic2.js.map +1 -1
  26. package/esm/_internal/Notification2.js.map +1 -1
  27. package/esm/_internal/Popover2.js +1 -1
  28. package/esm/_internal/Popover2.js.map +1 -1
  29. package/esm/_internal/PostBlock.js.map +1 -1
  30. package/esm/_internal/Progress2.js.map +1 -1
  31. package/esm/_internal/RadioGroup.js.map +1 -1
  32. package/esm/_internal/SelectMultiple.js.map +1 -1
  33. package/esm/_internal/SideNavigationItem.js.map +1 -1
  34. package/esm/_internal/SkeletonTypography.js.map +1 -1
  35. package/esm/_internal/Slider2.js.map +1 -1
  36. package/esm/_internal/Slides.js.map +1 -1
  37. package/esm/_internal/Switch2.js.map +1 -1
  38. package/esm/_internal/TabPanel.js.map +1 -1
  39. package/esm/_internal/TableRow.js.map +1 -1
  40. package/esm/_internal/TextField.js.map +1 -1
  41. package/esm/_internal/Thumbnail2.js.map +1 -1
  42. package/esm/_internal/Uploader2.js.map +1 -1
  43. package/esm/_internal/UserBlock.js.map +1 -1
  44. package/esm/_internal/_rollupPluginBabelHelpers.js +5 -1
  45. package/esm/_internal/_rollupPluginBabelHelpers.js.map +1 -1
  46. package/esm/_internal/generic-block.js +8 -0
  47. package/esm/_internal/generic-block.js.map +1 -1
  48. package/esm/_internal/type.js +11 -1
  49. package/esm/_internal/type.js.map +1 -1
  50. package/package.json +4 -4
  51. package/src/components/autocomplete/Autocomplete.tsx +6 -8
  52. package/src/components/avatar/Avatar.tsx +2 -4
  53. package/src/components/button/Button.test.tsx +1 -1
  54. package/src/components/button/ButtonRoot.tsx +3 -4
  55. package/src/components/button/IconButton.test.tsx +1 -1
  56. package/src/components/checkbox/Checkbox.tsx +2 -4
  57. package/src/components/chip/Chip.tsx +2 -4
  58. package/src/components/comment-block/CommentBlock.tsx +2 -4
  59. package/src/components/dialog/Dialog.stories.tsx +3 -3
  60. package/src/components/dialog/Dialog.tsx +11 -4
  61. package/src/components/divider/Divider.tsx +2 -5
  62. package/src/components/drag-handle/DragHandle.tsx +2 -5
  63. package/src/components/dropdown/Dropdown.tsx +4 -3
  64. package/src/components/expansion-panel/ExpansionPanel.tsx +2 -3
  65. package/src/components/flag/Flag.tsx +2 -4
  66. package/src/components/generic-block/GenericBlock.stories.tsx +92 -123
  67. package/src/components/generic-block/GenericBlock.test.tsx +128 -4
  68. package/src/components/generic-block/GenericBlock.tsx +127 -33
  69. package/src/components/icon/Icon.tsx +2 -4
  70. package/src/components/image-block/ImageBlock.tsx +2 -4
  71. package/src/components/input-helper/InputHelper.tsx +2 -4
  72. package/src/components/input-label/InputLabel.tsx +2 -4
  73. package/src/components/lightbox/Lightbox.tsx +4 -6
  74. package/src/components/lightbox/__snapshots__/Lightbox.test.tsx.snap +1 -1
  75. package/src/components/link-preview/LinkPreview.tsx +2 -4
  76. package/src/components/mosaic/Mosaic.tsx +2 -4
  77. package/src/components/notification/Notification.tsx +2 -4
  78. package/src/components/popover/Popover.tsx +1 -1
  79. package/src/components/popover/__snapshots__/Popover.test.tsx.snap +10 -10
  80. package/src/components/post-block/PostBlock.tsx +2 -4
  81. package/src/components/progress/Progress.tsx +2 -4
  82. package/src/components/radio-button/RadioButton.tsx +2 -4
  83. package/src/components/select/constants.ts +2 -5
  84. package/src/components/side-navigation/SideNavigation.tsx +2 -4
  85. package/src/components/skeleton/SkeletonCircle.tsx +2 -4
  86. package/src/components/skeleton/SkeletonRectangle.tsx +2 -4
  87. package/src/components/skeleton/SkeletonTypography.tsx +2 -4
  88. package/src/components/slider/Slider.tsx +2 -4
  89. package/src/components/slideshow/Slides.tsx +2 -7
  90. package/src/components/slideshow/SlideshowControls.tsx +2 -4
  91. package/src/components/switch/Switch.tsx +2 -4
  92. package/src/components/table/Table.tsx +2 -4
  93. package/src/components/tabs/TabList.tsx +2 -4
  94. package/src/components/text-field/TextField.tsx +6 -8
  95. package/src/components/thumbnail/Thumbnail.tsx +3 -5
  96. package/src/components/uploader/Uploader.tsx +2 -4
  97. package/src/components/user-block/UserBlock.tsx +2 -4
  98. package/src/hooks/useClickAway.tsx +5 -5
  99. package/src/testing/utils/commonTestsSuite.ts +2 -2
  100. package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.jsx +58 -0
  101. package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +51 -19
  102. package/src/utils/type.ts +19 -2
  103. package/types.d.ts +104 -138
  104. package/src/components/generic-block/__snapshots__/GenericBlock.test.tsx.snap +0 -92
  105. package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.tsx +0 -75
@@ -1,29 +1,47 @@
1
- import React, { forwardRef, ReactNode } from 'react';
1
+ import React, { Children, forwardRef, ReactElement, ReactNode } from 'react';
2
2
  import classNames from 'classnames';
3
- import { Comp, getRootClassName } from '@lumx/react/utils';
3
+ import isEmpty from 'lodash/isEmpty';
4
+ import { Comp, getRootClassName, isComponentType, partitionMulti } from '@lumx/react/utils';
4
5
  import { Orientation, Size, FlexBox, FlexBoxProps, Alignment, HorizontalAlignment } from '@lumx/react';
5
6
 
6
7
  export interface GenericBlockProps extends FlexBoxProps {
7
- /** Component to use as visual element. */
8
+ /**
9
+ * Component to use as visual element.
10
+ */
8
11
  figure?: ReactNode;
9
- /** Actions to set after the main content. */
12
+ /**
13
+ * Actions to set after the main content.
14
+ */
10
15
  actions?: ReactNode;
11
- /** Main content to display */
16
+ /**
17
+ * Main content to display or sections components
18
+ * ({@see GenericBlock.Figure}, {@see GenericBlock.Content} & {@see GenericBlock.Actions})
19
+ */
12
20
  children: ReactNode;
13
- /** Orientation of the 3 sections */
21
+ /**
22
+ * Orientation of the 3 sections
23
+ */
14
24
  orientation?: FlexBoxProps['orientation'];
15
- /** Horizontal alignment. */
25
+ /**
26
+ * Horizontal alignment.
27
+ */
16
28
  hAlign?: FlexBoxProps['hAlign'];
17
- /** Vertical alignment. */
29
+ /**
30
+ * Vertical alignment.
31
+ */
18
32
  vAlign?: FlexBoxProps['vAlign'];
19
33
  /**
20
34
  * The props to forward to the content.
21
35
  * By default, the content will have the same alignment as wrapper.
22
36
  */
23
37
  contentProps?: Omit<FlexBoxProps, 'children'>;
24
- /** props to forward to the actions element. */
38
+ /**
39
+ * props to forward to the actions element.
40
+ */
25
41
  actionsProps?: Omit<FlexBoxProps, 'children'>;
26
- /** props to forward to the figure element. */
42
+ /**
43
+ * props to forward to the figure element.
44
+ */
27
45
  figureProps?: Omit<FlexBoxProps, 'children'>;
28
46
  }
29
47
 
@@ -41,24 +59,53 @@ const CLASSNAME = getRootClassName(COMPONENT_NAME);
41
59
  * Component default props.
42
60
  */
43
61
  const DEFAULT_PROPS: Partial<GenericBlockProps> = {
44
- gap: Size.regular,
45
- orientation: Orientation.vertical,
46
- hAlign: Alignment.center,
62
+ gap: Size.big,
63
+ orientation: Orientation.horizontal,
64
+ hAlign: Alignment.top,
47
65
  vAlign: Alignment.center,
48
66
  };
49
67
 
68
+ type BaseGenericBlock = Comp<GenericBlockProps, HTMLDivElement>;
69
+
70
+ interface GenericBlock extends BaseGenericBlock {
71
+ /**
72
+ * Use `GenericBlock.Figure` component as children of the `GenericBlock` component as an alternative way to inject
73
+ * the "figure" section of the block (instead of using `figure` and `figureProps` props).
74
+ */
75
+ Figure: Comp<FlexBoxProps>;
76
+ /**
77
+ * Use `GenericBlock.Content` component as children of the `GenericBlock` component as an alternative way to inject
78
+ * the "content" section of the block (instead of using `content` and `contentProps` props).
79
+ */
80
+ Content: Comp<FlexBoxProps>;
81
+ /**
82
+ * Use `GenericBlock.Actions` component as children of the `GenericBlock` component as an alternative way to inject
83
+ * the "actions" section of the block (instead of using `actions` and `actionsProps` props).
84
+ */
85
+ Actions: Comp<FlexBoxProps>;
86
+ }
87
+
88
+ const Figure = (() => null) as any;
89
+ const isFigure = isComponentType(Figure);
90
+
91
+ const Content = (() => null) as any;
92
+ const isContent = isComponentType(Content);
93
+
94
+ const Actions = (() => null) as any;
95
+ const isActions = isComponentType(Actions);
96
+
50
97
  /**
51
98
  * The GenericBlock is a layout component made of 3 sections that can be
52
99
  * displayed either horizontally of vertically with the same gap between each section.
53
100
  *
54
101
  * The sections are:
55
- * * (Optional) `Figure` => A visual element to display before the main content.
56
- * * (Required) `Content` => The main content displayed
57
- * * (Optional) `Actions` => One or more actions to set after the element.
102
+ * - `Figure` => A visual element to display before the main content.
103
+ * - `Content` => The main content displayed
104
+ * - `Actions` => One or more actions to set after the element.
58
105
  *
59
106
  * @see https://www.figma.com/file/lzzrQmsfaXRaOyRfoEogPZ/DS%3A-playground?node-id=1%3A4076
60
107
  */
61
- export const GenericBlock: Comp<GenericBlockProps, HTMLDivElement> = forwardRef((props, ref) => {
108
+ const BaseGenericBlock: BaseGenericBlock = forwardRef((props, ref) => {
62
109
  const {
63
110
  className,
64
111
  figure,
@@ -72,6 +119,23 @@ export const GenericBlock: Comp<GenericBlockProps, HTMLDivElement> = forwardRef(
72
119
  ...forwardedProps
73
120
  } = props;
74
121
 
122
+ const sections = React.useMemo(() => {
123
+ // Split children by section type
124
+ const [[figureChild], [contentChild], [actionsChild], ...otherChildren] = partitionMulti(
125
+ Children.toArray(children),
126
+ [isFigure, isContent, isActions],
127
+ );
128
+ return {
129
+ figureChild,
130
+ figureChildProps: (figureChild as ReactElement)?.props,
131
+ contentChild,
132
+ contentChildProps: (contentChild as ReactElement)?.props,
133
+ actionsChild,
134
+ actionsChildProps: (actionsChild as ReactElement)?.props,
135
+ otherChildren: otherChildren.filter((child) => !isEmpty(child)),
136
+ };
137
+ }, [children]);
138
+
75
139
  let actionsVAlign: HorizontalAlignment = Alignment.center;
76
140
  if (orientation === Orientation.horizontal) {
77
141
  actionsVAlign = Alignment.right;
@@ -89,32 +153,62 @@ export const GenericBlock: Comp<GenericBlockProps, HTMLDivElement> = forwardRef(
89
153
  orientation={orientation}
90
154
  {...forwardedProps}
91
155
  >
92
- <FlexBox {...figureProps} className={classNames(figureProps?.className, `${CLASSNAME}__figure`)}>
93
- {figure}
94
- </FlexBox>
156
+ {(figure || sections.figureChildProps?.children) && (
157
+ <FlexBox
158
+ ref={(sections.figureChild as any)?.ref}
159
+ {...figureProps}
160
+ {...sections.figureChildProps}
161
+ className={classNames(
162
+ figureProps?.className,
163
+ sections.figureChildProps?.className,
164
+ `${CLASSNAME}__figure`,
165
+ )}
166
+ >
167
+ {figure}
168
+ {sections.figureChildProps?.children}
169
+ </FlexBox>
170
+ )}
95
171
 
96
- {children && (
172
+ {(sections.contentChildProps?.children || sections.otherChildren.length > 0) && (
97
173
  <FlexBox
174
+ ref={(sections.contentChild as any)?.ref}
98
175
  orientation={Orientation.vertical}
99
176
  fillSpace
100
177
  vAlign={contentVAlign}
101
178
  {...contentProps}
102
- className={classNames(contentProps?.className, `${CLASSNAME}__content`)}
179
+ {...sections.contentChildProps}
180
+ className={classNames(
181
+ contentProps?.className,
182
+ sections.contentChildProps?.className,
183
+ `${CLASSNAME}__content`,
184
+ )}
103
185
  >
104
- {children}
186
+ {sections.contentChildProps?.children}
187
+ {sections.otherChildren}
105
188
  </FlexBox>
106
189
  )}
107
190
 
108
- <FlexBox
109
- vAlign={actionsVAlign}
110
- {...actionsProps}
111
- className={classNames(actionsProps?.className, `${CLASSNAME}__actions`)}
112
- >
113
- {actions}
114
- </FlexBox>
191
+ {(actions || sections.actionsChildProps?.children) && (
192
+ <FlexBox
193
+ ref={(sections.actionsChild as any)?.ref}
194
+ vAlign={actionsVAlign}
195
+ {...actionsProps}
196
+ {...sections.actionsChildProps}
197
+ className={classNames(
198
+ actionsProps?.className,
199
+ sections.actionsChildProps?.className,
200
+ `${CLASSNAME}__actions`,
201
+ )}
202
+ >
203
+ {actions}
204
+ {sections.actionsChildProps?.children}
205
+ </FlexBox>
206
+ )}
115
207
  </FlexBox>
116
208
  );
117
209
  });
118
- GenericBlock.displayName = COMPONENT_NAME;
119
- GenericBlock.className = CLASSNAME;
120
- GenericBlock.defaultProps = DEFAULT_PROPS;
210
+ BaseGenericBlock.displayName = COMPONENT_NAME;
211
+ BaseGenericBlock.className = CLASSNAME;
212
+ BaseGenericBlock.defaultProps = DEFAULT_PROPS;
213
+
214
+ export const GenericBlock: GenericBlock = Object.assign(BaseGenericBlock, { Figure, Content, Actions });
@@ -3,7 +3,7 @@ import React, { forwardRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
 
5
5
  import { Color, ColorPalette, ColorVariant, Size, Theme } from '@lumx/react';
6
- import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
6
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';
7
7
  import { mdiAlertCircle } from '@lumx/icons';
8
8
 
9
9
  export type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;
@@ -11,7 +11,7 @@ export type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'x
11
11
  /**
12
12
  * Defines the props of the component.
13
13
  */
14
- export interface IconProps extends GenericProps {
14
+ export interface IconProps extends GenericProps, HasTheme {
15
15
  /** Color variant. */
16
16
  color?: Color;
17
17
  /** Lightened or darkened variant of the selected icon color. */
@@ -25,8 +25,6 @@ export interface IconProps extends GenericProps {
25
25
  icon: string;
26
26
  /** Size variant. */
27
27
  size?: IconSizes;
28
- /** Theme adapting the component to light or dark background. */
29
- theme?: Theme;
30
28
  /** Sets an alternative text on the svg. Will set an `img` role to the svg. */
31
29
  alt?: string;
32
30
  }
@@ -6,7 +6,7 @@ import isObject from 'lodash/isObject';
6
6
 
7
7
  import { Alignment, HorizontalAlignment, Size, Theme, Thumbnail } from '@lumx/react';
8
8
 
9
- import { Comp, GenericProps, getRootClassName, handleBasicClasses, ValueOf } from '@lumx/react/utils';
9
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme, ValueOf } from '@lumx/react/utils';
10
10
  import { ThumbnailProps } from '../thumbnail/Thumbnail';
11
11
 
12
12
  /**
@@ -26,7 +26,7 @@ export type ImageBlockSize = Extract<Size, 'xl' | 'xxl'>;
26
26
  /**
27
27
  * Defines the props of the component.
28
28
  */
29
- export interface ImageBlockProps extends GenericProps {
29
+ export interface ImageBlockProps extends GenericProps, HasTheme {
30
30
  /** Action toolbar content. */
31
31
  actions?: ReactNode;
32
32
  /** Alignment. */
@@ -47,8 +47,6 @@ export interface ImageBlockProps extends GenericProps {
47
47
  size?: ImageBlockSize;
48
48
  /** Tag content. */
49
49
  tags?: ReactNode;
50
- /** Theme adapting the component to light or dark background. */
51
- theme?: Theme;
52
50
  /** Props to pass to the thumbnail (minus those already set by the ImageBlock props). */
53
51
  thumbnailProps?: Omit<ThumbnailProps, 'image' | 'size' | 'theme' | 'align' | 'fillHeight'>;
54
52
  /** Image title to display in the caption. */
@@ -1,5 +1,5 @@
1
1
  import { Kind, Theme } from '@lumx/react';
2
- import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
2
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';
3
3
  import classNames from 'classnames';
4
4
  import React, { forwardRef, ReactNode } from 'react';
5
5
 
@@ -8,13 +8,11 @@ import { INPUT_HELPER_CONFIGURATION } from './constants';
8
8
  /**
9
9
  * Defines the props of the component.
10
10
  */
11
- export interface InputHelperProps extends GenericProps {
11
+ export interface InputHelperProps extends GenericProps, HasTheme {
12
12
  /** Helper content. */
13
13
  children: string | ReactNode;
14
14
  /** Helper variant. */
15
15
  kind?: Kind;
16
- /** Theme adapting the component to light or dark background. */
17
- theme?: Theme;
18
16
  }
19
17
 
20
18
  /**
@@ -1,20 +1,18 @@
1
1
  import { Theme } from '@lumx/react';
2
- import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
2
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';
3
3
  import classNames from 'classnames';
4
4
  import React, { forwardRef, ReactNode } from 'react';
5
5
 
6
6
  /**
7
7
  * Defines the props of the component.
8
8
  */
9
- export interface InputLabelProps extends GenericProps {
9
+ export interface InputLabelProps extends GenericProps, HasTheme {
10
10
  /** Label content. */
11
11
  children: string | ReactNode;
12
12
  /** Native htmlFor property. */
13
13
  htmlFor: string;
14
14
  /** Whether the component is required or not. */
15
15
  isRequired?: boolean;
16
- /** Theme adapting the component to light or dark background. */
17
- theme?: Theme;
18
16
  }
19
17
 
20
18
  /**
@@ -4,9 +4,9 @@ import classNames from 'classnames';
4
4
  import { createPortal } from 'react-dom';
5
5
 
6
6
  import { mdiClose } from '@lumx/icons';
7
- import { ColorPalette, Emphasis, IconButton, IconButtonProps, Theme } from '@lumx/react';
7
+ import { ColorPalette, Emphasis, IconButton, IconButtonProps } from '@lumx/react';
8
8
  import { DOCUMENT } from '@lumx/react/constants';
9
- import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
9
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';
10
10
 
11
11
  import { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';
12
12
  import { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';
@@ -20,7 +20,7 @@ const LIGHTBOX_TRANSITION_DURATION = 400;
20
20
  /**
21
21
  * Defines the props of the component.
22
22
  */
23
- export interface LightboxProps extends GenericProps {
23
+ export interface LightboxProps extends GenericProps, HasTheme {
24
24
  /** Props to pass to the close button (minus those already set by the Lightbox props). */
25
25
  closeButtonProps?: Pick<IconButtonProps, 'label'> &
26
26
  Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;
@@ -30,8 +30,6 @@ export interface LightboxProps extends GenericProps {
30
30
  parentElement: RefObject<any>;
31
31
  /** Whether to keep the dialog open on clickaway or escape press. */
32
32
  preventAutoClose?: boolean;
33
- /** Theme adapting the component to light or dark background. */
34
- theme?: Theme;
35
33
  /** Z-axis position. */
36
34
  zIndex?: number;
37
35
  /** On close callback. */
@@ -143,7 +141,7 @@ export const Lightbox: Comp<LightboxProps, HTMLDivElement> = forwardRef((props,
143
141
  onClick={onClose}
144
142
  />
145
143
  )}
146
- <ClickAwayProvider callback={!preventAutoClose && onClose} refs={clickAwayRefs}>
144
+ <ClickAwayProvider callback={!preventAutoClose && onClose} childrenRefs={clickAwayRefs}>
147
145
  <div ref={childrenRef} className={`${CLASSNAME}__wrapper`} role="presentation">
148
146
  {children}
149
147
  </div>
@@ -26,7 +26,7 @@ exports[`<Lightbox> Snapshots and structure should render story 'Default' 1`] =
26
26
  />
27
27
  <ClickAwayProvider
28
28
  callback={[Function]}
29
- refs={
29
+ childrenRefs={
30
30
  Object {
31
31
  "current": Array [
32
32
  Object {
@@ -14,12 +14,12 @@ import {
14
14
  ThumbnailProps,
15
15
  } from '@lumx/react';
16
16
 
17
- import { Comp, GenericProps, getRootClassName, handleBasicClasses, HeadingElement } from '@lumx/react/utils';
17
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HeadingElement, HasTheme } from '@lumx/react/utils';
18
18
 
19
19
  /**
20
20
  * Defines the props of the component.
21
21
  */
22
- export interface LinkPreviewProps extends GenericProps {
22
+ export interface LinkPreviewProps extends GenericProps, HasTheme {
23
23
  /** Description. */
24
24
  description?: string;
25
25
  /** Link URL. */
@@ -30,8 +30,6 @@ export interface LinkPreviewProps extends GenericProps {
30
30
  linkProps?: Omit<LinkProps, 'color' | 'colorVariant' | 'href' | 'target'>;
31
31
  /** Size variant. */
32
32
  size?: Extract<Size, 'regular' | 'big'>;
33
- /** Theme adapting the component to light or dark background. */
34
- theme?: Theme;
35
33
  /** Thumbnail for the link preview. */
36
34
  thumbnailProps?: ThumbnailProps;
37
35
  /** Title. */
@@ -1,16 +1,14 @@
1
1
  import React, { forwardRef, MouseEventHandler, useMemo } from 'react';
2
2
 
3
3
  import { Alignment, AspectRatio, Theme, Thumbnail, ThumbnailProps } from '@lumx/react';
4
- import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
4
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';
5
5
  import classNames from 'classnames';
6
6
  import take from 'lodash/take';
7
7
 
8
8
  /**
9
9
  * Defines the props of the component.
10
10
  */
11
- export interface MosaicProps extends GenericProps {
12
- /** Theme adapting the component to light or dark background. */
13
- theme?: Theme;
11
+ export interface MosaicProps extends GenericProps, HasTheme {
14
12
  /** Thumbnails. */
15
13
  thumbnails: ThumbnailProps[];
16
14
  /** On image click callback. */
@@ -9,22 +9,20 @@ import { Button, Emphasis, Icon, Kind, Size, Theme } from '@lumx/react';
9
9
 
10
10
  import { DOCUMENT, NOTIFICATION_TRANSITION_DURATION } from '@lumx/react/constants';
11
11
  import { NOTIFICATION_CONFIGURATION } from '@lumx/react/components/notification/constants';
12
- import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
12
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';
13
13
 
14
14
  import { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';
15
15
 
16
16
  /**
17
17
  * Defines the props of the component.
18
18
  */
19
- export interface NotificationProps extends GenericProps {
19
+ export interface NotificationProps extends GenericProps, HasTheme {
20
20
  /** Action button label. */
21
21
  actionLabel?: string;
22
22
  /** Content. */
23
23
  content?: React.ReactNode;
24
24
  /** Whether the component is open or not. */
25
25
  isOpen?: boolean;
26
- /** Theme adapting the component to light or dark background. */
27
- theme?: Theme;
28
26
  /** Notification type. */
29
27
  type?: Kind;
30
28
  /** Z-axis position. */
@@ -342,7 +342,7 @@ export const Popover: Comp<PopoverProps, HTMLDivElement> = forwardRef((props, re
342
342
  style={popoverStyle}
343
343
  {...attributes.popper}
344
344
  >
345
- <ClickAwayProvider callback={closeOnClickAway && handleClose} refs={clickAwayRefs}>
345
+ <ClickAwayProvider callback={closeOnClickAway && handleClose} childrenRefs={clickAwayRefs}>
346
346
  {hasArrow && <div ref={setArrowElement} className={`${CLASSNAME}__arrow`} style={styles.arrow} />}
347
347
  {children}
348
348
  </ClickAwayProvider>
@@ -17,7 +17,7 @@ Array [
17
17
  }
18
18
  >
19
19
  <ClickAwayProvider
20
- refs={
20
+ childrenRefs={
21
21
  Object {
22
22
  "current": Array [
23
23
  Object {
@@ -49,7 +49,7 @@ Array [
49
49
  }
50
50
  >
51
51
  <ClickAwayProvider
52
- refs={
52
+ childrenRefs={
53
53
  Object {
54
54
  "current": Array [
55
55
  Object {
@@ -85,7 +85,7 @@ exports[`<Popover> Snapshots and structure should render story 'Auto' 1`] = `
85
85
  }
86
86
  >
87
87
  <ClickAwayProvider
88
- refs={
88
+ childrenRefs={
89
89
  Object {
90
90
  "current": Array [
91
91
  Object {
@@ -120,7 +120,7 @@ exports[`<Popover> Snapshots and structure should render story 'Default' 1`] = `
120
120
  }
121
121
  >
122
122
  <ClickAwayProvider
123
- refs={
123
+ childrenRefs={
124
124
  Object {
125
125
  "current": Array [
126
126
  Object {
@@ -155,7 +155,7 @@ exports[`<Popover> Snapshots and structure should render story 'MatchingWidth' 1
155
155
  }
156
156
  >
157
157
  <ClickAwayProvider
158
- refs={
158
+ childrenRefs={
159
159
  Object {
160
160
  "current": Array [
161
161
  Object {
@@ -190,7 +190,7 @@ exports[`<Popover> Snapshots and structure should render story 'Offset' 1`] = `
190
190
  }
191
191
  >
192
192
  <ClickAwayProvider
193
- refs={
193
+ childrenRefs={
194
194
  Object {
195
195
  "current": Array [
196
196
  Object {
@@ -226,7 +226,7 @@ Array [
226
226
  }
227
227
  >
228
228
  <ClickAwayProvider
229
- refs={
229
+ childrenRefs={
230
230
  Object {
231
231
  "current": Array [
232
232
  Object {
@@ -258,7 +258,7 @@ Array [
258
258
  }
259
259
  >
260
260
  <ClickAwayProvider
261
- refs={
261
+ childrenRefs={
262
262
  Object {
263
263
  "current": Array [
264
264
  Object {
@@ -290,7 +290,7 @@ Array [
290
290
  }
291
291
  >
292
292
  <ClickAwayProvider
293
- refs={
293
+ childrenRefs={
294
294
  Object {
295
295
  "current": Array [
296
296
  Object {
@@ -322,7 +322,7 @@ Array [
322
322
  }
323
323
  >
324
324
  <ClickAwayProvider
325
- refs={
325
+ childrenRefs={
326
326
  Object {
327
327
  "current": Array [
328
328
  Object {
@@ -6,12 +6,12 @@ import isObject from 'lodash/isObject';
6
6
 
7
7
  import { Orientation, Theme, Thumbnail, ThumbnailProps, ThumbnailVariant } from '@lumx/react';
8
8
 
9
- import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
9
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';
10
10
 
11
11
  /**
12
12
  * Defines the props of the component.
13
13
  */
14
- export interface PostBlockProps extends GenericProps {
14
+ export interface PostBlockProps extends GenericProps, HasTheme {
15
15
  /** Action toolbar content. */
16
16
  actions?: ReactNode;
17
17
  /** Attachment content. */
@@ -26,8 +26,6 @@ export interface PostBlockProps extends GenericProps {
26
26
  tags?: ReactNode;
27
27
  /** Content (string, or sanitized html). */
28
28
  text?: string | { __html: string };
29
- /** Theme adapting the component to light or dark background. */
30
- theme?: Theme;
31
29
  /** Thumbnail. */
32
30
  thumbnailProps?: ThumbnailProps;
33
31
  /** Title. */
@@ -4,7 +4,7 @@ import classNames from 'classnames';
4
4
 
5
5
  import { Theme } from '@lumx/react';
6
6
 
7
- import { Comp, GenericProps, getRootClassName, handleBasicClasses, ValueOf } from '@lumx/react/utils';
7
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme, ValueOf } from '@lumx/react/utils';
8
8
 
9
9
  /**
10
10
  * Progress variants.
@@ -15,9 +15,7 @@ export type ProgressVariant = ValueOf<typeof ProgressVariant>;
15
15
  /**
16
16
  * Defines the props of the component.
17
17
  */
18
- export interface ProgressProps extends GenericProps {
19
- /** Theme adapting the component to light or dark background. */
20
- theme?: Theme;
18
+ export interface ProgressProps extends GenericProps, HasTheme {
21
19
  /** Progress variant. */
22
20
  variant?: ProgressVariant;
23
21
  }
@@ -5,12 +5,12 @@ import { uid } from 'uid';
5
5
 
6
6
  import { InputHelper, InputLabel, Theme } from '@lumx/react';
7
7
 
8
- import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
8
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';
9
9
 
10
10
  /**
11
11
  * Defines the props of the component.
12
12
  */
13
- export interface RadioButtonProps extends GenericProps {
13
+ export interface RadioButtonProps extends GenericProps, HasTheme {
14
14
  /** Helper text. */
15
15
  helper?: string;
16
16
  /** Native input id property. */
@@ -25,8 +25,6 @@ export interface RadioButtonProps extends GenericProps {
25
25
  label?: ReactNode;
26
26
  /** Native input name property. */
27
27
  name?: string;
28
- /** Theme adapting the component to light or dark background. */
29
- theme?: Theme;
30
28
  /** Native input value property. */
31
29
  value?: string;
32
30
  /** On change callback. */
@@ -1,6 +1,5 @@
1
1
  import { IconButtonProps } from '@lumx/react';
2
- import { Theme } from '@lumx/react/components';
3
- import { GenericProps, ValueOf } from '@lumx/react/utils';
2
+ import { GenericProps, HasTheme, ValueOf } from '@lumx/react/utils';
4
3
  import { ReactNode, SyntheticEvent } from 'react';
5
4
 
6
5
  /**
@@ -9,7 +8,7 @@ import { ReactNode, SyntheticEvent } from 'react';
9
8
  export const SelectVariant = { input: 'input', chip: 'chip' } as const;
10
9
  export type SelectVariant = ValueOf<typeof SelectVariant>;
11
10
 
12
- export interface CoreSelectProps extends GenericProps {
11
+ export interface CoreSelectProps extends GenericProps, HasTheme {
13
12
  /** Props to pass to the clear button (minus those already set by the Select props). If not specified, the button won't be displayed. */
14
13
  clearButtonProps?: Pick<IconButtonProps, 'label'> &
15
14
  Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;
@@ -35,8 +34,6 @@ export interface CoreSelectProps extends GenericProps {
35
34
  label?: string;
36
35
  /** Placeholder input text. */
37
36
  placeholder?: string;
38
- /** Theme adapting the component to light or dark background. */
39
- theme?: Theme;
40
37
  /** Select variant. */
41
38
  variant?: SelectVariant;
42
39
  /** On clear callback. */
@@ -4,16 +4,14 @@ import classNames from 'classnames';
4
4
 
5
5
  import { SideNavigationItem, Theme } from '@lumx/react';
6
6
 
7
- import { Comp, GenericProps, getRootClassName, handleBasicClasses, isComponent } from '@lumx/react/utils';
7
+ import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme, isComponent } from '@lumx/react/utils';
8
8
 
9
9
  /**
10
10
  * Defines the props of the component.
11
11
  */
12
- export interface SideNavigationProps extends GenericProps {
12
+ export interface SideNavigationProps extends GenericProps, HasTheme {
13
13
  /** SideNavigationItem elements. */
14
14
  children: ReactNode;
15
- /** Theme adapting the component to light or dark background. */
16
- theme?: Theme;
17
15
  }
18
16
 
19
17
  /**