@lumx/react 3.1.5 → 3.2.1-alpha.0
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/_internal/types.d.ts +16 -5
- package/index.d.ts +45 -4
- package/index.js +632 -423
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/alert-dialog/AlertDialog.stories.tsx +96 -165
- package/src/components/alert-dialog/AlertDialog.test.tsx +15 -23
- package/src/components/avatar/Avatar.stories.tsx +91 -62
- package/src/components/avatar/Avatar.test.tsx +9 -24
- package/src/components/badge/Badge.stories.tsx +63 -38
- package/src/components/button/Button.stories.tsx +147 -139
- package/src/components/button/IconButton.stories.tsx +45 -0
- package/src/components/checkbox/Checkbox.stories.tsx +37 -30
- package/src/components/chip/Chip.stories.tsx +77 -15
- package/src/components/comment-block/CommentBlock.stories.tsx +90 -25
- package/src/components/comment-block/CommentBlock.test.tsx +12 -17
- package/src/components/date-picker/DatePickerField.stories.tsx +52 -83
- package/src/components/dialog/Dialog.stories.tsx +131 -293
- package/src/components/dialog/Dialog.test.tsx +0 -32
- package/src/components/dropdown/Dropdown.stories.tsx +1 -186
- package/src/components/flag/Flag.stories.tsx +33 -18
- package/src/components/flag/Flag.test.tsx +1 -8
- package/src/components/flex-box/FlexBox.stories.tsx +151 -238
- package/src/components/flex-box/FlexBox.test.tsx +9 -49
- package/src/components/generic-block/GenericBlock.stories.jsx +1 -1
- package/src/components/grid-column/GridColumn.stories.tsx +46 -0
- package/src/components/heading/Heading.stories.tsx +57 -95
- package/src/components/icon/Icon.stories.tsx +67 -70
- package/src/components/image-block/ImageBlock.stories.tsx +103 -47
- package/src/components/image-block/ImageBlock.test.tsx +12 -17
- package/src/components/inline-list/InlineList.stories.tsx +45 -29
- package/src/components/input-helper/InputHelper.stories.tsx +31 -25
- package/src/components/input-label/InputLabel.stories.tsx +33 -10
- package/src/components/lightbox/Lightbox.stories.tsx +39 -77
- package/src/components/lightbox/Lightbox.test.tsx +12 -17
- package/src/components/link/Link.stories.tsx +98 -128
- package/src/components/link-preview/LinkPreview.stories.tsx +48 -75
- package/src/components/list/List.stories.tsx +59 -84
- package/src/components/list/List.test.tsx +8 -17
- package/src/components/list/ListDivider.stories.tsx +9 -4
- package/src/components/list/ListDivider.test.tsx +12 -17
- package/src/components/list/ListItem.stories.tsx +97 -59
- package/src/components/list/ListItem.test.tsx +12 -17
- package/src/components/list/ListSubheader.stories.tsx +8 -5
- package/src/components/list/ListSubheader.test.tsx +12 -18
- package/src/components/message/Message.stories.tsx +51 -22
- package/src/components/mosaic/Mosaic.stories.tsx +78 -74
- package/src/components/mosaic/Mosaic.test.tsx +0 -31
- package/src/components/navigation/Navigation.stories.tsx +67 -0
- package/src/components/navigation/Navigation.test.tsx +58 -0
- package/src/components/navigation/Navigation.tsx +62 -0
- package/src/components/navigation/NavigationItem.test.tsx +37 -0
- package/src/components/navigation/NavigationItem.tsx +89 -0
- package/src/components/navigation/NavigationSection.test.tsx +126 -0
- package/src/components/navigation/NavigationSection.tsx +109 -0
- package/src/components/navigation/context.tsx +6 -0
- package/src/components/navigation/index.ts +1 -0
- package/src/components/notification/Notifications.stories.tsx +52 -47
- package/src/components/popover/Popover.stories.tsx +68 -201
- package/src/components/popover/Popover.tsx +7 -9
- package/src/components/popover-dialog/PopoverDialog.stories.tsx +26 -65
- package/src/components/post-block/PostBlock.test.tsx +12 -17
- package/src/components/progress/ProgressCircular.stories.tsx +24 -12
- package/src/components/progress/ProgressLinear.stories.tsx +6 -2
- package/src/components/radio-button/RadioButton.stories.tsx +35 -24
- package/src/components/select/Select.stories.tsx +19 -23
- package/src/components/select/SelectMultiple.stories.tsx +105 -2
- package/src/components/select/WithSelectContext.tsx +10 -4
- package/src/components/skeleton/SkeletonCircle.stories.tsx +37 -21
- package/src/components/skeleton/SkeletonCircle.test.tsx +12 -17
- package/src/components/skeleton/SkeletonRectangle.stories.tsx +74 -99
- package/src/components/skeleton/SkeletonRectangle.test.tsx +12 -17
- package/src/components/skeleton/SkeletonTypography.test.tsx +12 -17
- package/src/components/slider/Slider.stories.tsx +41 -25
- package/src/components/slider/Slider.test.tsx +12 -18
- package/src/components/slideshow/Slideshow.stories.tsx +31 -61
- package/src/components/slideshow/Slideshow.test.tsx +15 -23
- package/src/components/slideshow/SlideshowControls.stories.tsx +4 -6
- package/src/components/switch/Switch.stories.tsx +35 -32
- package/src/components/table/Table.test.tsx +12 -17
- package/src/components/tabs/Tabs.stories.tsx +4 -3
- package/src/components/text/Text.stories.tsx +130 -0
- package/src/components/text-field/TextField.stories.tsx +114 -148
- package/src/components/thumbnail/Thumbnail.stories.tsx +106 -255
- package/src/components/thumbnail/Thumbnail.test.tsx +12 -35
- package/src/components/tooltip/Tooltip.stories.tsx +51 -136
- package/src/components/user-block/UserBlock.stories.tsx +67 -56
- package/src/components/user-block/UserBlock.test.tsx +1 -5
- package/src/hooks/useFocusTrap.ts +2 -2
- package/src/index.ts +1 -0
- package/src/stories/controls/color.ts +6 -0
- package/src/stories/controls/element.ts +6 -0
- package/src/stories/controls/focusPoint.ts +1 -0
- package/src/stories/controls/icons.ts +6 -0
- package/src/stories/{knobs → controls}/image.ts +6 -16
- package/src/stories/controls/selectArgType.ts +4 -0
- package/src/stories/controls/theme.ts +3 -0
- package/src/stories/controls/typography.ts +5 -0
- package/src/stories/controls/withUndefined.ts +1 -0
- package/src/stories/decorators/withChromaticForceScreenSize.tsx +8 -0
- package/src/stories/decorators/withCombinations.tsx +99 -0
- package/src/stories/decorators/withNestedProps.tsx +23 -0
- package/src/stories/{withResizableBox.tsx → decorators/withResizableBox.tsx} +6 -10
- package/src/stories/decorators/withValueOnChange.tsx +18 -0
- package/src/stories/decorators/withWrapper.tsx +19 -0
- package/src/stories/utils/CustomLink.tsx +8 -2
- package/src/stories/{knobs → utils}/lorem.ts +9 -9
- package/src/testing/utils/commonTestsSuiteRTL.ts +2 -3
- package/src/testing/utils/index.ts +0 -2
- package/src/untypped-modules.d.ts +0 -2
- package/src/utils/MaterialThemeSwitcher/MaterialThemeSwitcher.tsx +1 -1
- package/src/utils/ThemeContext.ts +4 -0
- package/src/utils/forwardRefPolymorphic.ts +9 -0
- package/src/utils/type.ts +28 -4
- package/src/components/alert-dialog/__snapshots__/AlertDialog.test.tsx.snap +0 -558
- package/src/components/avatar/__snapshots__/Avatar.test.tsx.snap +0 -681
- package/src/components/comment-block/__snapshots__/CommentBlock.test.tsx.snap +0 -92
- package/src/components/dialog/__snapshots__/Dialog.test.tsx.snap +0 -1133
- package/src/components/expansion-panel/ExpansionPanel.stories.tsx +0 -65
- package/src/components/flag/__snapshots__/Flag.test.tsx.snap +0 -133
- package/src/components/flex-box/__snapshots__/FlexBox.test.tsx.snap +0 -492
- package/src/components/grid-column/GridColumn.stories.jsx +0 -56
- package/src/components/image-block/__snapshots__/ImageBlock.test.tsx.snap +0 -64
- package/src/components/lightbox/__snapshots__/Lightbox.test.tsx.snap +0 -194
- package/src/components/list/__snapshots__/List.test.tsx.snap +0 -360
- package/src/components/list/__snapshots__/ListDivider.test.tsx.snap +0 -7
- package/src/components/list/__snapshots__/ListItem.test.tsx.snap +0 -160
- package/src/components/list/__snapshots__/ListSubheader.test.tsx.snap +0 -9
- package/src/components/mosaic/__snapshots__/Mosaic.test.tsx.snap +0 -357
- package/src/components/post-block/__snapshots__/PostBlock.test.tsx.snap +0 -139
- package/src/components/skeleton/__snapshots__/SkeletonCircle.test.tsx.snap +0 -54
- package/src/components/skeleton/__snapshots__/SkeletonRectangle.test.tsx.snap +0 -177
- package/src/components/skeleton/__snapshots__/SkeletonTypography.test.tsx.snap +0 -174
- package/src/components/slider/__snapshots__/Slider.test.tsx.snap +0 -122
- package/src/components/slideshow/__snapshots__/Slideshow.test.tsx.snap +0 -157
- package/src/components/table/__snapshots__/Table.test.tsx.snap +0 -263
- package/src/components/text/Text.stories.jsx +0 -75
- package/src/components/thumbnail/__snapshots__/Thumbnail.test.tsx.snap +0 -130
- package/src/components/user-block/__snapshots__/UserBlock.test.tsx.snap +0 -362
- package/src/stories/chromaticForceScreenSize.tsx +0 -7
- package/src/stories/knobs/buttonKnob.ts +0 -9
- package/src/stories/knobs/emphasisKnob.ts +0 -8
- package/src/stories/knobs/enumKnob.ts +0 -14
- package/src/stories/knobs/focusKnob.ts +0 -3
- package/src/stories/knobs/sizeKnob.ts +0 -5
- package/src/stories/knobs/thumbnailsKnob.ts +0 -9
- package/src/testing/utils/itShouldRenderStories.tsx +0 -103
|
@@ -1,45 +1,70 @@
|
|
|
1
1
|
import { mdiHeart } from '@lumx/icons';
|
|
2
2
|
import { AspectRatio, Badge, ColorPalette, Icon, Size, Thumbnail, ThumbnailVariant } from '@lumx/react';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { colorArgType } from '@lumx/react/stories/controls/color';
|
|
5
|
+
import { withCombinations } from '@lumx/react/stories/decorators/withCombinations';
|
|
6
|
+
import { withUndefined } from '@lumx/react/stories/controls/withUndefined';
|
|
5
7
|
|
|
6
|
-
export default {
|
|
8
|
+
export default {
|
|
9
|
+
title: 'LumX components/badge/Badge',
|
|
10
|
+
component: Badge,
|
|
11
|
+
argTypes: {
|
|
12
|
+
color: colorArgType,
|
|
13
|
+
children: { control: false },
|
|
14
|
+
},
|
|
15
|
+
};
|
|
7
16
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Using badge with text children
|
|
19
|
+
*/
|
|
20
|
+
export const WithText = {
|
|
21
|
+
args: { children: <span>30</span> },
|
|
22
|
+
};
|
|
13
23
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Using badge with icon children
|
|
26
|
+
*/
|
|
27
|
+
export const WithIcon = {
|
|
28
|
+
args: { children: <Icon icon={mdiHeart} /> },
|
|
29
|
+
};
|
|
19
30
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Using badge with thumbnail children
|
|
33
|
+
*/
|
|
34
|
+
export const WithThumbnail = {
|
|
35
|
+
args: {
|
|
36
|
+
children: (
|
|
37
|
+
<Thumbnail
|
|
38
|
+
alt="Logo"
|
|
39
|
+
aspectRatio={AspectRatio.square}
|
|
40
|
+
image="/logo.svg"
|
|
41
|
+
size={Size.xxs}
|
|
42
|
+
variant={ThumbnailVariant.rounded}
|
|
43
|
+
/>
|
|
44
|
+
),
|
|
45
|
+
},
|
|
46
|
+
};
|
|
31
47
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
/**
|
|
49
|
+
* All combinations of colors and children types
|
|
50
|
+
*/
|
|
51
|
+
export const AllColors = {
|
|
52
|
+
argTypes: {
|
|
53
|
+
color: { control: false },
|
|
54
|
+
},
|
|
55
|
+
decorators: [
|
|
56
|
+
withCombinations({
|
|
57
|
+
combinations: {
|
|
58
|
+
cols: {
|
|
59
|
+
key: 'color',
|
|
60
|
+
options: withUndefined(ColorPalette),
|
|
61
|
+
},
|
|
62
|
+
rows: {
|
|
63
|
+
'With text': WithText.args,
|
|
64
|
+
'With icon': WithIcon.args,
|
|
65
|
+
'With thumbnail': WithThumbnail.args,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
],
|
|
70
|
+
};
|
|
@@ -1,156 +1,164 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
>
|
|
28
|
-
{text('Button content', 'Simple button')}
|
|
29
|
-
</Button>
|
|
30
|
-
);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, ButtonSize, Emphasis, Size, Text } from '@lumx/react';
|
|
3
|
+
import { iconArgType } from '@lumx/react/stories/controls/icons';
|
|
4
|
+
import { colorArgType } from '@lumx/react/stories/controls/color';
|
|
5
|
+
import { getSelectArgType } from '@lumx/react/stories/controls/selectArgType';
|
|
6
|
+
import { withCombinations } from '@lumx/react/stories/decorators/withCombinations';
|
|
7
|
+
import { mdiAccountBox } from '@lumx/icons';
|
|
8
|
+
|
|
9
|
+
const buttonSizes = [Size.m, Size.s];
|
|
10
|
+
const buttonEmphasis = [Emphasis.low, Emphasis.medium, Emphasis.high];
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: 'LumX components/button/Button',
|
|
14
|
+
component: Button,
|
|
15
|
+
argTypes: {
|
|
16
|
+
isSelected: { control: 'boolean' },
|
|
17
|
+
isDisabled: { control: 'boolean' },
|
|
18
|
+
hasBackground: { control: 'boolean' },
|
|
19
|
+
emphasis: getSelectArgType(buttonEmphasis),
|
|
20
|
+
size: getSelectArgType<ButtonSize>(buttonSizes),
|
|
21
|
+
rightIcon: iconArgType,
|
|
22
|
+
leftIcon: iconArgType,
|
|
23
|
+
color: colorArgType,
|
|
24
|
+
onClick: { action: true },
|
|
25
|
+
},
|
|
26
|
+
args: Button.defaultProps,
|
|
31
27
|
};
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
theme={theme}
|
|
41
|
-
rightIcon={select('Right icon', { none: undefined, mdiSend }, undefined)}
|
|
42
|
-
leftIcon={select('Left icon', { none: undefined, mdiSend }, undefined)}
|
|
43
|
-
size={buttonSize()}
|
|
44
|
-
isSelected={boolean('isSelected', Boolean(DEFAULT_PROPS.isSelected))}
|
|
45
|
-
isDisabled={boolean('isDisabled', Boolean(DEFAULT_PROPS.isDisabled))}
|
|
46
|
-
color={select('color', ColorPalette, DEFAULT_PROPS.color)}
|
|
47
|
-
href={text('Button link', '')}
|
|
48
|
-
hasBackground={boolean('hasBackground', Boolean(DEFAULT_PROPS.hasBackground))}
|
|
49
|
-
fullWidth
|
|
50
|
-
title={buttonText}
|
|
51
|
-
>
|
|
52
|
-
<Text as="span" truncate>
|
|
53
|
-
{text('Button content', buttonText)}
|
|
54
|
-
</Text>
|
|
55
|
-
</Button>
|
|
56
|
-
);
|
|
29
|
+
/**
|
|
30
|
+
* Default button
|
|
31
|
+
*/
|
|
32
|
+
export const Default = {
|
|
33
|
+
args: {
|
|
34
|
+
children: 'Default button',
|
|
35
|
+
},
|
|
57
36
|
};
|
|
58
37
|
|
|
59
|
-
export const WithHref = () => <Button href="https://google.com">Button with redirection</Button>;
|
|
60
|
-
|
|
61
|
-
export const Disabled = () => <Button isDisabled>Disabled button</Button>;
|
|
62
|
-
|
|
63
|
-
export const DisabledWithHref = () => (
|
|
64
|
-
<Button href="https://google.com" isDisabled>
|
|
65
|
-
Disabled button with redirection
|
|
66
|
-
</Button>
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
export const IconButtonWithImage = ({ theme }: any) => (
|
|
70
|
-
<div>
|
|
71
|
-
<IconButton
|
|
72
|
-
theme={theme}
|
|
73
|
-
label="Image label"
|
|
74
|
-
image={squareImageKnob()}
|
|
75
|
-
size={buttonSize()}
|
|
76
|
-
hasBackground={boolean('Has background', false)}
|
|
77
|
-
emphasis={emphasis('Emphasis', DEFAULT_PROPS.emphasis)}
|
|
78
|
-
color={select('color', ColorPalette, DEFAULT_PROPS.color)}
|
|
79
|
-
/>
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
export const FullWidthButton = () => <Button fullWidth>Full width button</Button>;
|
|
84
|
-
|
|
85
38
|
/**
|
|
86
|
-
*
|
|
39
|
+
* Disabled button
|
|
87
40
|
*/
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
'Default (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
'Emphasis low': { emphasis: 'low' },
|
|
95
|
-
'Has background (emphasis low)': { emphasis: 'low', hasBackground: true },
|
|
96
|
-
'Has background + Full width': { emphasis: 'low', hasBackground: true, fullWidth: true },
|
|
97
|
-
} as const;
|
|
41
|
+
export const Disabled = {
|
|
42
|
+
args: {
|
|
43
|
+
isDisabled: true,
|
|
44
|
+
children: 'Default button (disabled)',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
98
47
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
48
|
+
/**
|
|
49
|
+
* All combinations of size, emphasis and hasBackground
|
|
50
|
+
*/
|
|
51
|
+
export const SizeEmphasisAndBackground = {
|
|
52
|
+
args: {
|
|
53
|
+
children: 'Button',
|
|
54
|
+
},
|
|
55
|
+
decorators: [
|
|
56
|
+
withCombinations({
|
|
57
|
+
tableStyle: { background: 'lightgray' },
|
|
58
|
+
cellStyle: { padding: '10px' },
|
|
59
|
+
combinations: {
|
|
60
|
+
rows: { medium: { size: Size.m }, small: { size: Size.s } },
|
|
61
|
+
cols: { key: 'emphasis', options: buttonEmphasis },
|
|
62
|
+
sections: {
|
|
63
|
+
'hasBackground: false': { hasBackground: false },
|
|
64
|
+
'hasBackground: true': { hasBackground: true },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
],
|
|
69
|
+
};
|
|
107
70
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Setting a href to transform the button into a link.
|
|
73
|
+
*/
|
|
74
|
+
export const LinkButton = {
|
|
75
|
+
args: {
|
|
76
|
+
href: 'https://example.com',
|
|
77
|
+
children: 'Link button',
|
|
78
|
+
},
|
|
79
|
+
};
|
|
117
80
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
))}
|
|
129
|
-
</tr>
|
|
81
|
+
/**
|
|
82
|
+
* Setting a href to transform the button into a link.
|
|
83
|
+
*/
|
|
84
|
+
export const LinkButtonDisabled = {
|
|
85
|
+
args: {
|
|
86
|
+
href: 'https://example.com',
|
|
87
|
+
children: 'Link button (disabled)',
|
|
88
|
+
isDisabled: true,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
130
91
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
</tr>
|
|
140
|
-
))}
|
|
141
|
-
</table>
|
|
142
|
-
</Fragment>
|
|
143
|
-
))}
|
|
144
|
-
</div>
|
|
145
|
-
);
|
|
92
|
+
/**
|
|
93
|
+
* Full width button
|
|
94
|
+
*/
|
|
95
|
+
export const FullWidth = {
|
|
96
|
+
args: {
|
|
97
|
+
fullWidth: true,
|
|
98
|
+
children: 'Full width button',
|
|
99
|
+
},
|
|
146
100
|
};
|
|
147
101
|
|
|
148
102
|
/**
|
|
149
|
-
*
|
|
103
|
+
* Full width button with long text truncated
|
|
150
104
|
*/
|
|
151
|
-
export const
|
|
105
|
+
export const FullWidthTruncated = {
|
|
106
|
+
argTypes: {
|
|
107
|
+
children: { control: false },
|
|
108
|
+
},
|
|
109
|
+
args: {
|
|
110
|
+
fullWidth: true,
|
|
111
|
+
children: (
|
|
112
|
+
<Text as="span" truncate>
|
|
113
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
114
|
+
dolore magna aliqua. Potenti nullam ac tortor vitae. Lorem ipsum dolor sit amet. Diam sollicitudin
|
|
115
|
+
tempor id eu nisl nunc mi ipsum. Elementum facilisis leo vel fringilla est ullamcorper eget nulla.
|
|
116
|
+
Mollis aliquam ut porttitor leo a diam sollicitudin tempor. Ultrices tincidunt arcu non sodales neque
|
|
117
|
+
sodales.
|
|
118
|
+
</Text>
|
|
119
|
+
),
|
|
120
|
+
},
|
|
121
|
+
};
|
|
152
122
|
|
|
153
123
|
/**
|
|
154
|
-
* Check
|
|
124
|
+
* Check button style variations (color, states, emphasis, etc.)
|
|
155
125
|
*/
|
|
156
|
-
export const
|
|
126
|
+
export const ButtonVariations = {
|
|
127
|
+
args: {
|
|
128
|
+
children: 'Button',
|
|
129
|
+
rightIcon: mdiAccountBox,
|
|
130
|
+
},
|
|
131
|
+
decorators: [
|
|
132
|
+
withCombinations({
|
|
133
|
+
tableStyle: { background: 'lightgray', width: '100%' },
|
|
134
|
+
firstColStyle: { whiteSpace: 'nowrap', width: '1%' },
|
|
135
|
+
combinations: {
|
|
136
|
+
// Colors
|
|
137
|
+
rows: {
|
|
138
|
+
Default: {},
|
|
139
|
+
'Color: red': { color: 'red' },
|
|
140
|
+
'Theme: dark': { theme: 'dark' },
|
|
141
|
+
'Theme: dark & color: green': { theme: 'dark', color: 'green' },
|
|
142
|
+
},
|
|
143
|
+
// States
|
|
144
|
+
cols: {
|
|
145
|
+
'Default state': {},
|
|
146
|
+
Selected: { isSelected: true },
|
|
147
|
+
Hovered: { isHovered: true },
|
|
148
|
+
Focused: { isFocused: true },
|
|
149
|
+
Active: { isActive: true },
|
|
150
|
+
Disabled: { isDisabled: true },
|
|
151
|
+
},
|
|
152
|
+
// Emphasis/Background
|
|
153
|
+
sections: {
|
|
154
|
+
'Default (emphasis high)': {},
|
|
155
|
+
'Emphasis medium': { emphasis: 'medium' },
|
|
156
|
+
'Emphasis low': { emphasis: 'low' },
|
|
157
|
+
'Full width': { fullWidth: true },
|
|
158
|
+
'Has background (emphasis low)': { emphasis: 'low', hasBackground: true },
|
|
159
|
+
'Has background + Full width': { emphasis: 'low', hasBackground: true, fullWidth: true },
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
}),
|
|
163
|
+
],
|
|
164
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { mdiSend } from '@lumx/icons';
|
|
2
|
+
import { ButtonSize, Emphasis, IconButton, Size } from '@lumx/react';
|
|
3
|
+
import { iconArgType } from '@lumx/react/stories/controls/icons';
|
|
4
|
+
import { colorArgType } from '@lumx/react/stories/controls/color';
|
|
5
|
+
import { SQUARE_IMAGES, squareImageArgType } from '@lumx/react/stories/controls/image';
|
|
6
|
+
import { getSelectArgType } from '@lumx/react/stories/controls/selectArgType';
|
|
7
|
+
import { ButtonVariations } from './Button.stories';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'LumX components/button/IconButton',
|
|
11
|
+
component: IconButton,
|
|
12
|
+
argTypes: {
|
|
13
|
+
isSelected: { control: 'boolean' },
|
|
14
|
+
isDisabled: { control: 'boolean' },
|
|
15
|
+
hasBackground: { control: 'boolean' },
|
|
16
|
+
emphasis: getSelectArgType(Emphasis),
|
|
17
|
+
size: getSelectArgType<ButtonSize>([Size.s, Size.m]),
|
|
18
|
+
icon: iconArgType,
|
|
19
|
+
color: colorArgType,
|
|
20
|
+
},
|
|
21
|
+
args: IconButton.defaultProps,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Default IconButton
|
|
26
|
+
*/
|
|
27
|
+
export const Default = {
|
|
28
|
+
args: { icon: mdiSend },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* IconButton using an image
|
|
33
|
+
*/
|
|
34
|
+
export const WithImage = {
|
|
35
|
+
argTypes: squareImageArgType,
|
|
36
|
+
args: { image: SQUARE_IMAGES.square1 },
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Check icon button style variations (color, states, emphasis, etc.)
|
|
41
|
+
*/
|
|
42
|
+
export const IconButtonVariations = {
|
|
43
|
+
...Default,
|
|
44
|
+
decorators: ButtonVariations.decorators,
|
|
45
|
+
};
|
|
@@ -1,37 +1,44 @@
|
|
|
1
1
|
import { Checkbox } from '@lumx/react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import React, { useState } from 'react';
|
|
2
|
+
import { withValueOnChange } from '@lumx/react/stories/decorators/withValueOnChange';
|
|
3
|
+
import { loremIpsum } from '@lumx/react/stories/utils/lorem';
|
|
5
4
|
|
|
6
|
-
export default {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export default {
|
|
6
|
+
title: 'LumX components/checkbox/Checkbox',
|
|
7
|
+
component: Checkbox,
|
|
8
|
+
decorators: [withValueOnChange({ valueProp: 'isChecked' })],
|
|
9
|
+
args: {
|
|
10
|
+
isChecked: false,
|
|
11
|
+
name: 'checkbox-html-name',
|
|
12
|
+
value: 'checkbox-html-value',
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
onChange: { action: true },
|
|
16
|
+
name: { control: false },
|
|
17
|
+
value: { control: false },
|
|
18
|
+
},
|
|
11
19
|
};
|
|
12
20
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Default checkbox
|
|
23
|
+
*/
|
|
24
|
+
export const Default = {};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* With label and helper
|
|
28
|
+
*/
|
|
29
|
+
export const LabelAndHelper = {
|
|
30
|
+
args: {
|
|
31
|
+
label: 'Checkbox label',
|
|
32
|
+
helper: loremIpsum('tiny'),
|
|
33
|
+
},
|
|
24
34
|
};
|
|
25
35
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onChange={setValue}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
36
|
+
/**
|
|
37
|
+
* Disabled
|
|
38
|
+
*/
|
|
39
|
+
export const Disabled = {
|
|
40
|
+
args: {
|
|
41
|
+
...LabelAndHelper.args,
|
|
42
|
+
isDisabled: true,
|
|
43
|
+
},
|
|
37
44
|
};
|
|
@@ -1,21 +1,83 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { mdiClose, mdiViewList } from '@lumx/icons';
|
|
4
|
-
import { Chip, Icon } from '@lumx/react';
|
|
4
|
+
import { Chip, ChipProps, ColorPalette, GridColumn, Icon, Size } from '@lumx/react';
|
|
5
|
+
import { getSelectArgType } from '@lumx/react/stories/controls/selectArgType';
|
|
6
|
+
import { withCombinations } from '@lumx/react/stories/decorators/withCombinations';
|
|
7
|
+
import { withUndefined } from '@lumx/react/stories/controls/withUndefined';
|
|
8
|
+
import { withWrapper } from '@lumx/react/stories/decorators/withWrapper';
|
|
5
9
|
|
|
6
|
-
|
|
10
|
+
const chipSizes = [Size.m, Size.s];
|
|
11
|
+
export default {
|
|
12
|
+
title: 'LumX components/chip/Chip',
|
|
13
|
+
component: Chip,
|
|
14
|
+
args: Chip.defaultProps,
|
|
15
|
+
argTypes: {
|
|
16
|
+
size: getSelectArgType<ChipProps['size']>(chipSizes),
|
|
17
|
+
before: { control: false },
|
|
18
|
+
after: { control: false },
|
|
19
|
+
},
|
|
20
|
+
};
|
|
7
21
|
|
|
8
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Default chip with label
|
|
24
|
+
*/
|
|
25
|
+
export const Default = {
|
|
26
|
+
args: { children: 'Chip label' },
|
|
27
|
+
};
|
|
9
28
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Clickable chip
|
|
31
|
+
*/
|
|
32
|
+
export const ChipButton = {
|
|
33
|
+
args: { children: 'Chip label' },
|
|
34
|
+
argTypes: { onClick: { action: true } },
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Link chip
|
|
39
|
+
*/
|
|
40
|
+
export const ChipLink = {
|
|
41
|
+
args: {
|
|
42
|
+
children: 'Chip link',
|
|
43
|
+
href: 'https://example.com',
|
|
44
|
+
target: '_blank',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* With custom elements at the start and end of the chip
|
|
50
|
+
*/
|
|
51
|
+
export const WithAfterAndBefore = {
|
|
52
|
+
argTypes: {
|
|
53
|
+
onBeforeClick: { action: true },
|
|
54
|
+
onClick: { action: true },
|
|
55
|
+
onAfterClick: { action: true },
|
|
56
|
+
},
|
|
57
|
+
args: {
|
|
58
|
+
before: <Icon icon={mdiViewList} />,
|
|
59
|
+
children: 'Chip label',
|
|
60
|
+
after: <Icon icon={mdiClose} />,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* All combinations of color, size and states.
|
|
66
|
+
*/
|
|
67
|
+
export const Variants = {
|
|
68
|
+
...WithAfterAndBefore,
|
|
69
|
+
decorators: [
|
|
70
|
+
withCombinations({
|
|
71
|
+
combinations: {
|
|
72
|
+
rows: { key: 'color', options: withUndefined(ColorPalette) },
|
|
73
|
+
cols: { key: 'size', options: chipSizes },
|
|
74
|
+
sections: {
|
|
75
|
+
Default: {},
|
|
76
|
+
Disabled: { isDisabled: true },
|
|
77
|
+
Highlighted: { isHighlighted: true },
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
withWrapper({ maxColumns: 3, itemMinWidth: 350 }, GridColumn),
|
|
82
|
+
],
|
|
83
|
+
};
|