@lumx/react 2.2.20 → 2.2.22
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.
- package/esm/_internal/AutocompleteMultiple.js.map +1 -1
- package/esm/_internal/Avatar2.js.map +1 -1
- package/esm/_internal/ButtonRoot.js.map +1 -1
- package/esm/_internal/Checkbox2.js.map +1 -1
- package/esm/_internal/Chip2.js.map +1 -1
- package/esm/_internal/ClickAwayProvider.js +45 -26
- package/esm/_internal/ClickAwayProvider.js.map +1 -1
- package/esm/_internal/CommentBlock.js.map +1 -1
- package/esm/_internal/Dialog2.js +6 -3
- package/esm/_internal/Dialog2.js.map +1 -1
- package/esm/_internal/Divider2.js.map +1 -1
- package/esm/_internal/DragHandle.js.map +1 -1
- package/esm/_internal/Dropdown2.js.map +1 -1
- package/esm/_internal/ExpansionPanel.js.map +1 -1
- package/esm/_internal/Flag2.js.map +1 -1
- package/esm/_internal/GenericBlock.js +70 -15
- package/esm/_internal/GenericBlock.js.map +1 -1
- package/esm/_internal/Icon2.js.map +1 -1
- package/esm/_internal/ImageBlock.js.map +1 -1
- package/esm/_internal/InputHelper.js.map +1 -1
- package/esm/_internal/InputLabel.js.map +1 -1
- package/esm/_internal/Lightbox2.js +1 -1
- package/esm/_internal/Lightbox2.js.map +1 -1
- package/esm/_internal/LinkPreview.js.map +1 -1
- package/esm/_internal/Mosaic2.js.map +1 -1
- package/esm/_internal/Notification2.js.map +1 -1
- package/esm/_internal/Popover2.js +1 -1
- package/esm/_internal/Popover2.js.map +1 -1
- package/esm/_internal/PostBlock.js.map +1 -1
- package/esm/_internal/Progress2.js.map +1 -1
- package/esm/_internal/RadioGroup.js.map +1 -1
- package/esm/_internal/SelectMultiple.js.map +1 -1
- package/esm/_internal/SideNavigationItem.js.map +1 -1
- package/esm/_internal/SkeletonTypography.js.map +1 -1
- package/esm/_internal/Slider2.js.map +1 -1
- package/esm/_internal/Slides.js.map +1 -1
- package/esm/_internal/Switch2.js.map +1 -1
- package/esm/_internal/TabPanel.js.map +1 -1
- package/esm/_internal/TableRow.js.map +1 -1
- package/esm/_internal/TextField.js.map +1 -1
- package/esm/_internal/Thumbnail2.js.map +1 -1
- package/esm/_internal/Uploader2.js.map +1 -1
- package/esm/_internal/UserBlock.js.map +1 -1
- package/esm/_internal/_rollupPluginBabelHelpers.js +5 -1
- package/esm/_internal/_rollupPluginBabelHelpers.js.map +1 -1
- package/esm/_internal/generic-block.js +8 -0
- package/esm/_internal/generic-block.js.map +1 -1
- package/esm/_internal/type.js +11 -1
- package/esm/_internal/type.js.map +1 -1
- package/package.json +5 -5
- package/src/components/autocomplete/Autocomplete.tsx +6 -8
- package/src/components/avatar/Avatar.tsx +2 -4
- package/src/components/button/Button.test.tsx +1 -1
- package/src/components/button/ButtonRoot.tsx +3 -4
- package/src/components/button/IconButton.test.tsx +1 -1
- package/src/components/checkbox/Checkbox.tsx +2 -4
- package/src/components/chip/Chip.tsx +2 -4
- package/src/components/comment-block/CommentBlock.tsx +2 -4
- package/src/components/dialog/Dialog.stories.tsx +7 -3
- package/src/components/dialog/Dialog.tsx +11 -4
- package/src/components/dialog/__snapshots__/Dialog.test.tsx.snap +7 -0
- package/src/components/divider/Divider.tsx +2 -5
- package/src/components/drag-handle/DragHandle.tsx +2 -5
- package/src/components/dropdown/Dropdown.tsx +4 -3
- package/src/components/expansion-panel/ExpansionPanel.tsx +2 -3
- package/src/components/flag/Flag.tsx +2 -4
- package/src/components/generic-block/GenericBlock.stories.tsx +65 -124
- package/src/components/generic-block/GenericBlock.test.tsx +111 -4
- package/src/components/generic-block/GenericBlock.tsx +107 -18
- package/src/components/icon/Icon.tsx +2 -4
- package/src/components/image-block/ImageBlock.tsx +2 -4
- package/src/components/input-helper/InputHelper.tsx +2 -4
- package/src/components/input-label/InputLabel.tsx +2 -4
- package/src/components/lightbox/Lightbox.tsx +4 -6
- package/src/components/lightbox/__snapshots__/Lightbox.test.tsx.snap +1 -1
- package/src/components/link-preview/LinkPreview.tsx +2 -4
- package/src/components/mosaic/Mosaic.tsx +2 -4
- package/src/components/notification/Notification.tsx +2 -4
- package/src/components/popover/Popover.tsx +1 -1
- package/src/components/popover/__snapshots__/Popover.test.tsx.snap +10 -10
- package/src/components/post-block/PostBlock.tsx +2 -4
- package/src/components/progress/Progress.tsx +2 -4
- package/src/components/radio-button/RadioButton.tsx +2 -4
- package/src/components/select/constants.ts +2 -5
- package/src/components/side-navigation/SideNavigation.tsx +2 -4
- package/src/components/skeleton/SkeletonCircle.tsx +2 -4
- package/src/components/skeleton/SkeletonRectangle.tsx +2 -4
- package/src/components/skeleton/SkeletonTypography.tsx +2 -4
- package/src/components/slider/Slider.tsx +2 -4
- package/src/components/slideshow/Slides.tsx +2 -7
- package/src/components/slideshow/SlideshowControls.tsx +2 -4
- package/src/components/switch/Switch.tsx +2 -4
- package/src/components/table/Table.tsx +2 -4
- package/src/components/tabs/TabList.tsx +2 -4
- package/src/components/text-field/TextField.tsx +6 -8
- package/src/components/thumbnail/Thumbnail.tsx +3 -5
- package/src/components/uploader/Uploader.tsx +2 -4
- package/src/components/user-block/UserBlock.tsx +2 -4
- package/src/hooks/useClickAway.tsx +5 -5
- package/src/testing/utils/commonTestsSuite.ts +2 -2
- package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.jsx +58 -0
- package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +51 -19
- package/src/utils/focus/getFirstAndLastFocusable.test.ts +6 -0
- package/src/utils/focus/getFirstAndLastFocusable.ts +2 -2
- package/src/utils/type.ts +19 -2
- package/types.d.ts +112 -139
- package/src/components/generic-block/__snapshots__/GenericBlock.test.tsx.snap +0 -92
- package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.tsx +0 -75
|
@@ -1,29 +1,46 @@
|
|
|
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 { Comp, getRootClassName, isComponentType, partitionMulti } from '@lumx/react/utils';
|
|
4
4
|
import { Orientation, Size, FlexBox, FlexBoxProps, Alignment, HorizontalAlignment } from '@lumx/react';
|
|
5
5
|
|
|
6
6
|
export interface GenericBlockProps extends FlexBoxProps {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Component to use as visual element.
|
|
9
|
+
*/
|
|
8
10
|
figure?: ReactNode;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Actions to set after the main content.
|
|
13
|
+
*/
|
|
10
14
|
actions?: ReactNode;
|
|
11
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Main content to display or sections components
|
|
17
|
+
* ({@see GenericBlock.Figure}, {@see GenericBlock.Content} & {@see GenericBlock.Actions})
|
|
18
|
+
*/
|
|
12
19
|
children: ReactNode;
|
|
13
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Orientation of the 3 sections
|
|
22
|
+
*/
|
|
14
23
|
orientation?: FlexBoxProps['orientation'];
|
|
15
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Horizontal alignment.
|
|
26
|
+
*/
|
|
16
27
|
hAlign?: FlexBoxProps['hAlign'];
|
|
17
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Vertical alignment.
|
|
30
|
+
*/
|
|
18
31
|
vAlign?: FlexBoxProps['vAlign'];
|
|
19
32
|
/**
|
|
20
33
|
* The props to forward to the content.
|
|
21
34
|
* By default, the content will have the same alignment as wrapper.
|
|
22
35
|
*/
|
|
23
36
|
contentProps?: Omit<FlexBoxProps, 'children'>;
|
|
24
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* props to forward to the actions element.
|
|
39
|
+
*/
|
|
25
40
|
actionsProps?: Omit<FlexBoxProps, 'children'>;
|
|
26
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* props to forward to the figure element.
|
|
43
|
+
*/
|
|
27
44
|
figureProps?: Omit<FlexBoxProps, 'children'>;
|
|
28
45
|
}
|
|
29
46
|
|
|
@@ -47,6 +64,35 @@ const DEFAULT_PROPS: Partial<GenericBlockProps> = {
|
|
|
47
64
|
vAlign: Alignment.center,
|
|
48
65
|
};
|
|
49
66
|
|
|
67
|
+
type BaseGenericBlock = Comp<GenericBlockProps, HTMLDivElement>;
|
|
68
|
+
|
|
69
|
+
interface GenericBlock extends BaseGenericBlock {
|
|
70
|
+
/**
|
|
71
|
+
* Use `GenericBlock.Figure` component as children of the `GenericBlock` component as an alternative way to inject
|
|
72
|
+
* the "figure" section of the block (instead of using `figure` and `figureProps` props).
|
|
73
|
+
*/
|
|
74
|
+
Figure: Comp<FlexBoxProps>;
|
|
75
|
+
/**
|
|
76
|
+
* Use `GenericBlock.Content` component as children of the `GenericBlock` component as an alternative way to inject
|
|
77
|
+
* the "content" section of the block (instead of using `content` and `contentProps` props).
|
|
78
|
+
*/
|
|
79
|
+
Content: Comp<FlexBoxProps>;
|
|
80
|
+
/**
|
|
81
|
+
* Use `GenericBlock.Actions` component as children of the `GenericBlock` component as an alternative way to inject
|
|
82
|
+
* the "actions" section of the block (instead of using `actions` and `actionsProps` props).
|
|
83
|
+
*/
|
|
84
|
+
Actions: Comp<FlexBoxProps>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const Figure = (() => null) as any;
|
|
88
|
+
const isFigure = isComponentType(Figure);
|
|
89
|
+
|
|
90
|
+
const Content = (() => null) as any;
|
|
91
|
+
const isContent = isComponentType(Content);
|
|
92
|
+
|
|
93
|
+
const Actions = (() => null) as any;
|
|
94
|
+
const isActions = isComponentType(Actions);
|
|
95
|
+
|
|
50
96
|
/**
|
|
51
97
|
* The GenericBlock is a layout component made of 3 sections that can be
|
|
52
98
|
* displayed either horizontally of vertically with the same gap between each section.
|
|
@@ -58,7 +104,7 @@ const DEFAULT_PROPS: Partial<GenericBlockProps> = {
|
|
|
58
104
|
*
|
|
59
105
|
* @see https://www.figma.com/file/lzzrQmsfaXRaOyRfoEogPZ/DS%3A-playground?node-id=1%3A4076
|
|
60
106
|
*/
|
|
61
|
-
|
|
107
|
+
const BaseGenericBlock: BaseGenericBlock = forwardRef((props, ref) => {
|
|
62
108
|
const {
|
|
63
109
|
className,
|
|
64
110
|
figure,
|
|
@@ -72,6 +118,23 @@ export const GenericBlock: Comp<GenericBlockProps, HTMLDivElement> = forwardRef(
|
|
|
72
118
|
...forwardedProps
|
|
73
119
|
} = props;
|
|
74
120
|
|
|
121
|
+
const sections = React.useMemo(() => {
|
|
122
|
+
// Split children by section type
|
|
123
|
+
const [[figureChild], [contentChild], [actionsChild], ...otherChildren] = partitionMulti(
|
|
124
|
+
Children.toArray(children),
|
|
125
|
+
[isFigure, isContent, isActions],
|
|
126
|
+
);
|
|
127
|
+
return {
|
|
128
|
+
figureChild,
|
|
129
|
+
figureChildProps: (figureChild as ReactElement)?.props || {},
|
|
130
|
+
contentChild,
|
|
131
|
+
contentChildProps: (contentChild as ReactElement)?.props || {},
|
|
132
|
+
actionsChild,
|
|
133
|
+
actionsChildProps: (actionsChild as ReactElement)?.props || {},
|
|
134
|
+
otherChildren,
|
|
135
|
+
};
|
|
136
|
+
}, [children]);
|
|
137
|
+
|
|
75
138
|
let actionsVAlign: HorizontalAlignment = Alignment.center;
|
|
76
139
|
if (orientation === Orientation.horizontal) {
|
|
77
140
|
actionsVAlign = Alignment.right;
|
|
@@ -89,32 +152,58 @@ export const GenericBlock: Comp<GenericBlockProps, HTMLDivElement> = forwardRef(
|
|
|
89
152
|
orientation={orientation}
|
|
90
153
|
{...forwardedProps}
|
|
91
154
|
>
|
|
92
|
-
<FlexBox
|
|
155
|
+
<FlexBox
|
|
156
|
+
ref={(sections.figureChild as any)?.ref}
|
|
157
|
+
{...figureProps}
|
|
158
|
+
{...sections.figureChildProps}
|
|
159
|
+
className={classNames(
|
|
160
|
+
figureProps?.className,
|
|
161
|
+
sections.figureChildProps?.className,
|
|
162
|
+
`${CLASSNAME}__figure`,
|
|
163
|
+
)}
|
|
164
|
+
>
|
|
93
165
|
{figure}
|
|
166
|
+
{sections.figureChildProps?.children}
|
|
94
167
|
</FlexBox>
|
|
95
168
|
|
|
96
169
|
{children && (
|
|
97
170
|
<FlexBox
|
|
171
|
+
ref={(sections.contentChild as any)?.ref}
|
|
98
172
|
orientation={Orientation.vertical}
|
|
99
173
|
fillSpace
|
|
100
174
|
vAlign={contentVAlign}
|
|
101
175
|
{...contentProps}
|
|
102
|
-
|
|
176
|
+
{...sections.contentChildProps}
|
|
177
|
+
className={classNames(
|
|
178
|
+
contentProps?.className,
|
|
179
|
+
sections.contentChildProps?.className,
|
|
180
|
+
`${CLASSNAME}__content`,
|
|
181
|
+
)}
|
|
103
182
|
>
|
|
104
|
-
{children}
|
|
183
|
+
{sections.contentChildProps?.children}
|
|
184
|
+
{sections.otherChildren}
|
|
105
185
|
</FlexBox>
|
|
106
186
|
)}
|
|
107
187
|
|
|
108
188
|
<FlexBox
|
|
189
|
+
ref={(sections.actionsChild as any)?.ref}
|
|
109
190
|
vAlign={actionsVAlign}
|
|
110
191
|
{...actionsProps}
|
|
111
|
-
|
|
192
|
+
{...sections.actionsChildProps}
|
|
193
|
+
className={classNames(
|
|
194
|
+
actionsProps?.className,
|
|
195
|
+
sections.actionsChildProps?.className,
|
|
196
|
+
`${CLASSNAME}__actions`,
|
|
197
|
+
)}
|
|
112
198
|
>
|
|
113
199
|
{actions}
|
|
200
|
+
{sections.actionsChildProps?.children}
|
|
114
201
|
</FlexBox>
|
|
115
202
|
</FlexBox>
|
|
116
203
|
);
|
|
117
204
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
205
|
+
BaseGenericBlock.displayName = COMPONENT_NAME;
|
|
206
|
+
BaseGenericBlock.className = CLASSNAME;
|
|
207
|
+
BaseGenericBlock.defaultProps = DEFAULT_PROPS;
|
|
208
|
+
|
|
209
|
+
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
|
|
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}
|
|
144
|
+
<ClickAwayProvider callback={!preventAutoClose && onClose} childrenRefs={clickAwayRefs}>
|
|
147
145
|
<div ref={childrenRef} className={`${CLASSNAME}__wrapper`} role="presentation">
|
|
148
146
|
{children}
|
|
149
147
|
</div>
|
|
@@ -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}
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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
|
/**
|
|
@@ -2,16 +2,14 @@ import classNames from 'classnames';
|
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { GlobalSize, Theme, ColorPalette } from '@lumx/react';
|
|
5
|
-
import { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';
|
|
5
|
+
import { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Defines the props of the component.
|
|
9
9
|
*/
|
|
10
|
-
export interface SkeletonCircleProps extends GenericProps {
|
|
10
|
+
export interface SkeletonCircleProps extends GenericProps, HasTheme {
|
|
11
11
|
/** Size variant. */
|
|
12
12
|
size: GlobalSize;
|
|
13
|
-
/** Theme. */
|
|
14
|
-
theme?: Theme;
|
|
15
13
|
/** The color of the skeleton. */
|
|
16
14
|
color?: ColorPalette;
|
|
17
15
|
}
|