@lumx/react 2.2.21 → 2.2.22-alpha-fix-generic-block.2
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 +43 -24
- 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/FlexBox.js.map +1 -1
- package/esm/_internal/GenericBlock.js +72 -37
- 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 +4 -4
- 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 +3 -3
- package/src/components/dialog/Dialog.tsx +11 -4
- 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/flex-box/FlexBox.stories.tsx +1 -1
- package/src/components/flex-box/FlexBox.tsx +1 -1
- package/src/components/generic-block/GenericBlock.stories.jsx +106 -0
- package/src/components/generic-block/GenericBlock.test.tsx +129 -5
- package/src/components/generic-block/GenericBlock.tsx +132 -44
- 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/type.ts +19 -2
- package/types.d.ts +105 -139
- package/src/components/generic-block/GenericBlock.stories.tsx +0 -149
- package/src/components/generic-block/__snapshots__/GenericBlock.test.tsx.snap +0 -92
- package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.tsx +0 -75
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { mdiPencil } from '@lumx/icons';
|
|
3
|
-
import { GenericBlock, Button, Icon, Size, Orientation, Alignment } from '@lumx/react';
|
|
4
|
-
|
|
5
|
-
export default { title: 'LumX components/generic-block/GenericBlock' };
|
|
6
|
-
|
|
7
|
-
export const Horizontal = ({ theme }: any) => (
|
|
8
|
-
<GenericBlock
|
|
9
|
-
orientation={Orientation.horizontal}
|
|
10
|
-
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
11
|
-
actionsProps={{
|
|
12
|
-
style: { border: '1px solid red' },
|
|
13
|
-
}}
|
|
14
|
-
figureProps={{
|
|
15
|
-
style: { border: '1px solid red' },
|
|
16
|
-
}}
|
|
17
|
-
contentProps={{
|
|
18
|
-
style: { border: '1px solid red' },
|
|
19
|
-
}}
|
|
20
|
-
actions={<Button theme={theme}>Button</Button>}
|
|
21
|
-
>
|
|
22
|
-
Content
|
|
23
|
-
</GenericBlock>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export const HorizontalWithAlignment = ({ theme }: any) => (
|
|
27
|
-
<GenericBlock
|
|
28
|
-
orientation={Orientation.horizontal}
|
|
29
|
-
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
30
|
-
actionsProps={{
|
|
31
|
-
fillSpace: true,
|
|
32
|
-
style: { border: '1px solid red' },
|
|
33
|
-
vAlign: 'center',
|
|
34
|
-
}}
|
|
35
|
-
figureProps={{
|
|
36
|
-
style: { border: '1px solid red' },
|
|
37
|
-
}}
|
|
38
|
-
contentProps={{
|
|
39
|
-
style: { border: '1px solid red' },
|
|
40
|
-
}}
|
|
41
|
-
actions={<Button theme={theme}>Centered button</Button>}
|
|
42
|
-
>
|
|
43
|
-
Content
|
|
44
|
-
</GenericBlock>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
export const HorizontalTop = ({ theme }: any) => (
|
|
48
|
-
<GenericBlock
|
|
49
|
-
orientation={Orientation.horizontal}
|
|
50
|
-
hAlign={Alignment.top}
|
|
51
|
-
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
52
|
-
actionsProps={{
|
|
53
|
-
style: { border: '1px solid red' },
|
|
54
|
-
}}
|
|
55
|
-
figureProps={{
|
|
56
|
-
style: { border: '1px solid red' },
|
|
57
|
-
}}
|
|
58
|
-
contentProps={{
|
|
59
|
-
style: { border: '1px solid red' },
|
|
60
|
-
}}
|
|
61
|
-
actions={<Button theme={theme}>Centered button</Button>}
|
|
62
|
-
>
|
|
63
|
-
Content
|
|
64
|
-
</GenericBlock>
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
export const Vertical = ({ theme }: any) => (
|
|
68
|
-
<GenericBlock
|
|
69
|
-
orientation={Orientation.vertical}
|
|
70
|
-
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
71
|
-
actionsProps={{
|
|
72
|
-
fillSpace: true,
|
|
73
|
-
style: { border: '1px solid red' },
|
|
74
|
-
}}
|
|
75
|
-
figureProps={{
|
|
76
|
-
style: { border: '1px solid red' },
|
|
77
|
-
}}
|
|
78
|
-
contentProps={{
|
|
79
|
-
style: { border: '1px solid red' },
|
|
80
|
-
}}
|
|
81
|
-
actions={<Button theme={theme}>Button</Button>}
|
|
82
|
-
>
|
|
83
|
-
Content
|
|
84
|
-
</GenericBlock>
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
export const GapSizes = ({ theme }: any) => (
|
|
88
|
-
<>
|
|
89
|
-
<GenericBlock
|
|
90
|
-
orientation={Orientation.vertical}
|
|
91
|
-
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
92
|
-
gap={Size.regular}
|
|
93
|
-
style={{ marginBottom: 40 }}
|
|
94
|
-
actionsProps={{
|
|
95
|
-
style: { border: '1px solid red' },
|
|
96
|
-
}}
|
|
97
|
-
figureProps={{
|
|
98
|
-
style: { border: '1px solid red' },
|
|
99
|
-
}}
|
|
100
|
-
contentProps={{
|
|
101
|
-
style: { border: '1px solid red' },
|
|
102
|
-
}}
|
|
103
|
-
actions={<Button theme={theme}>Button</Button>}
|
|
104
|
-
>
|
|
105
|
-
<h2>Small gap size</h2>
|
|
106
|
-
<p>For small blocks</p>
|
|
107
|
-
</GenericBlock>
|
|
108
|
-
|
|
109
|
-
<GenericBlock
|
|
110
|
-
orientation={Orientation.vertical}
|
|
111
|
-
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
112
|
-
gap={Size.big}
|
|
113
|
-
style={{ marginBottom: 40 }}
|
|
114
|
-
actionsProps={{
|
|
115
|
-
style: { border: '1px solid red' },
|
|
116
|
-
}}
|
|
117
|
-
figureProps={{
|
|
118
|
-
style: { border: '1px solid red' },
|
|
119
|
-
}}
|
|
120
|
-
contentProps={{
|
|
121
|
-
style: { border: '1px solid red' },
|
|
122
|
-
}}
|
|
123
|
-
actions={<Button theme={theme}>Button</Button>}
|
|
124
|
-
>
|
|
125
|
-
<h2>Medium gap size</h2>
|
|
126
|
-
<p>For medium blocks</p>
|
|
127
|
-
</GenericBlock>
|
|
128
|
-
|
|
129
|
-
<GenericBlock
|
|
130
|
-
orientation={Orientation.vertical}
|
|
131
|
-
figure={<Icon icon={mdiPencil} size={Size.m} />}
|
|
132
|
-
gap={Size.huge}
|
|
133
|
-
style={{ marginBottom: 40 }}
|
|
134
|
-
actionsProps={{
|
|
135
|
-
style: { border: '1px solid red' },
|
|
136
|
-
}}
|
|
137
|
-
figureProps={{
|
|
138
|
-
style: { border: '1px solid red' },
|
|
139
|
-
}}
|
|
140
|
-
contentProps={{
|
|
141
|
-
style: { border: '1px solid red' },
|
|
142
|
-
}}
|
|
143
|
-
actions={<Button theme={theme}>Button</Button>}
|
|
144
|
-
>
|
|
145
|
-
<h2>Big gap size</h2>
|
|
146
|
-
<p>For large blocks</p>
|
|
147
|
-
</GenericBlock>
|
|
148
|
-
</>
|
|
149
|
-
);
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<GenericBlock> Snapshots and structure should render story 'Default' 1`] = `
|
|
4
|
-
Array [
|
|
5
|
-
<FlexBox
|
|
6
|
-
className="lumx-generic-block"
|
|
7
|
-
gap="regular"
|
|
8
|
-
hAlign="center"
|
|
9
|
-
orientation="vertical"
|
|
10
|
-
vAlign="center"
|
|
11
|
-
>
|
|
12
|
-
<FlexBox
|
|
13
|
-
className="lumx-generic-block__figure"
|
|
14
|
-
>
|
|
15
|
-
<Avatar
|
|
16
|
-
alt=""
|
|
17
|
-
image="/demo-assets/persona.png"
|
|
18
|
-
size="m"
|
|
19
|
-
theme="light"
|
|
20
|
-
/>
|
|
21
|
-
</FlexBox>
|
|
22
|
-
<FlexBox
|
|
23
|
-
className="lumx-generic-block__content"
|
|
24
|
-
fillSpace={true}
|
|
25
|
-
orientation="vertical"
|
|
26
|
-
vAlign="center"
|
|
27
|
-
>
|
|
28
|
-
<h2>
|
|
29
|
-
Content title
|
|
30
|
-
</h2>
|
|
31
|
-
<p>
|
|
32
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus libero aliquet pharetra luctus. Fusce nisl turpis, posuere ac tellus at, euismod vulputate libero...
|
|
33
|
-
</p>
|
|
34
|
-
</FlexBox>
|
|
35
|
-
<FlexBox
|
|
36
|
-
className="lumx-generic-block__actions"
|
|
37
|
-
vAlign="center"
|
|
38
|
-
>
|
|
39
|
-
<Button
|
|
40
|
-
emphasis="high"
|
|
41
|
-
size="m"
|
|
42
|
-
theme="light"
|
|
43
|
-
>
|
|
44
|
-
Actions
|
|
45
|
-
</Button>
|
|
46
|
-
</FlexBox>
|
|
47
|
-
</FlexBox>,
|
|
48
|
-
<FlexBox
|
|
49
|
-
className="lumx-generic-block"
|
|
50
|
-
gap="regular"
|
|
51
|
-
hAlign="center"
|
|
52
|
-
orientation="horizontal"
|
|
53
|
-
vAlign="center"
|
|
54
|
-
>
|
|
55
|
-
<FlexBox
|
|
56
|
-
className="lumx-generic-block__figure"
|
|
57
|
-
>
|
|
58
|
-
<Avatar
|
|
59
|
-
alt=""
|
|
60
|
-
image="/demo-assets/persona.png"
|
|
61
|
-
size="m"
|
|
62
|
-
theme="light"
|
|
63
|
-
/>
|
|
64
|
-
</FlexBox>
|
|
65
|
-
<FlexBox
|
|
66
|
-
className="lumx-generic-block__content"
|
|
67
|
-
fillSpace={true}
|
|
68
|
-
orientation="vertical"
|
|
69
|
-
vAlign="left"
|
|
70
|
-
>
|
|
71
|
-
<h2>
|
|
72
|
-
Content title
|
|
73
|
-
</h2>
|
|
74
|
-
<p>
|
|
75
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus libero aliquet pharetra luctus. Fusce nisl turpis, posuere ac tellus at, euismod vulputate libero...
|
|
76
|
-
</p>
|
|
77
|
-
</FlexBox>
|
|
78
|
-
<FlexBox
|
|
79
|
-
className="lumx-generic-block__actions"
|
|
80
|
-
vAlign="right"
|
|
81
|
-
>
|
|
82
|
-
<Button
|
|
83
|
-
emphasis="high"
|
|
84
|
-
size="m"
|
|
85
|
-
theme="light"
|
|
86
|
-
>
|
|
87
|
-
Actions
|
|
88
|
-
</Button>
|
|
89
|
-
</FlexBox>
|
|
90
|
-
</FlexBox>,
|
|
91
|
-
]
|
|
92
|
-
`;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2
|
-
import { Button } from '@lumx/react';
|
|
3
|
-
import { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';
|
|
4
|
-
import React, { useCallback, useRef, useState } from 'react';
|
|
5
|
-
import { createPortal } from 'react-dom';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'LumX components/ClickAwayProvider',
|
|
9
|
-
parameters: {
|
|
10
|
-
// Disables Chromatic snapshot (not relevant for this story).
|
|
11
|
-
chromatic: { disable: true },
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// eslint-disable-next-line react/display-name
|
|
16
|
-
const Card = React.forwardRef<any, any>(({ children, close }, ref) => (
|
|
17
|
-
<ClickAwayProvider callback={close} refs={[ref as any]}>
|
|
18
|
-
{createPortal(
|
|
19
|
-
<div className="lumx-spacing-padding" ref={ref} style={{ border: '1px solid red' }}>
|
|
20
|
-
{children}
|
|
21
|
-
</div>,
|
|
22
|
-
document.body,
|
|
23
|
-
)}
|
|
24
|
-
</ClickAwayProvider>
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* This story showcases the detection of click away inside a nested React portal tree.
|
|
29
|
-
*
|
|
30
|
-
* @return Component story.
|
|
31
|
-
*/
|
|
32
|
-
export const NestedClickAway = () => {
|
|
33
|
-
const ref1 = useRef<HTMLDivElement>();
|
|
34
|
-
const [isOpen1, setOpen1] = useState(false);
|
|
35
|
-
const open1 = useCallback(() => setOpen1(true), []);
|
|
36
|
-
const close1 = useCallback(() => {
|
|
37
|
-
setOpen1(false);
|
|
38
|
-
setOpen2(false);
|
|
39
|
-
setOpen3(false);
|
|
40
|
-
}, []);
|
|
41
|
-
|
|
42
|
-
const ref2 = useRef<HTMLDivElement>();
|
|
43
|
-
const [isOpen2, setOpen2] = useState(false);
|
|
44
|
-
const open2 = useCallback(() => setOpen2(true), []);
|
|
45
|
-
const close2 = useCallback(() => {
|
|
46
|
-
setOpen2(false);
|
|
47
|
-
setOpen3(false);
|
|
48
|
-
}, []);
|
|
49
|
-
|
|
50
|
-
const ref3 = useRef<HTMLDivElement>();
|
|
51
|
-
const [isOpen3, setOpen3] = useState(false);
|
|
52
|
-
const open3 = useCallback(() => setOpen3(true), []);
|
|
53
|
-
const close3 = useCallback(() => setOpen3(false), []);
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<>
|
|
57
|
-
Level 0 - <Button onClick={open1}>Open level 1</Button>
|
|
58
|
-
{isOpen1 && (
|
|
59
|
-
<Card ref={ref1} close={close1}>
|
|
60
|
-
Level 1 - <Button onClick={open2}>Open level 2</Button>
|
|
61
|
-
{isOpen2 && (
|
|
62
|
-
<Card ref={ref2} close={close2}>
|
|
63
|
-
Level 2 - <Button onClick={open3}>Open level 3</Button>
|
|
64
|
-
{isOpen3 && (
|
|
65
|
-
<Card ref={ref3} close={close3}>
|
|
66
|
-
Level 3
|
|
67
|
-
</Card>
|
|
68
|
-
)}
|
|
69
|
-
</Card>
|
|
70
|
-
)}
|
|
71
|
-
</Card>
|
|
72
|
-
)}
|
|
73
|
-
</>
|
|
74
|
-
);
|
|
75
|
-
};
|