@lumx/react 3.14.1 → 3.14.2-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/package.json
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"url": "https://github.com/lumapps/design-system/issues"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@lumx/core": "^3.14.
|
|
10
|
-
"@lumx/icons": "^3.14.
|
|
9
|
+
"@lumx/core": "^3.14.2-alpha.0",
|
|
10
|
+
"@lumx/icons": "^3.14.2-alpha.0",
|
|
11
11
|
"@popperjs/core": "^2.5.4",
|
|
12
12
|
"body-scroll-lock": "^3.1.5",
|
|
13
13
|
"classnames": "^2.3.2",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"build:storybook": "storybook build"
|
|
111
111
|
},
|
|
112
112
|
"sideEffects": false,
|
|
113
|
-
"version": "3.14.
|
|
113
|
+
"version": "3.14.2-alpha.0"
|
|
114
114
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
import { mdiMenuDown, mdiStar } from '@lumx/icons';
|
|
4
|
-
import { Badge, ColorPalette, Icon, IconButton, Orientation, Size, Text } from '@lumx/react';
|
|
5
|
+
import { Badge, ColorPalette, Icon, IconButton, Link, Orientation, Size, Text } from '@lumx/react';
|
|
5
6
|
import { CustomLink } from '@lumx/react/stories/utils/CustomLink';
|
|
6
7
|
|
|
7
8
|
import { AVATAR_IMAGES } from '@lumx/react/stories/controls/image';
|
|
8
9
|
import { withCombinations } from '@lumx/react/stories/decorators/withCombinations';
|
|
9
10
|
import { getSelectArgType } from '@lumx/react/stories/controls/selectArgType';
|
|
11
|
+
import { withResizableBox } from '@lumx/react/stories/decorators/withResizableBox';
|
|
10
12
|
import { UserBlock } from './UserBlock';
|
|
11
13
|
|
|
12
14
|
const sizes = [Size.xs, Size.s, Size.m, Size.l];
|
|
@@ -19,6 +21,7 @@ export default {
|
|
|
19
21
|
size: getSelectArgType(sizes),
|
|
20
22
|
orientation: getSelectArgType(Orientation),
|
|
21
23
|
},
|
|
24
|
+
decorators: [withResizableBox({ width: 'auto', minWidth: 'min-content', height: 'auto' })],
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
/** Only an avatar */
|
|
@@ -33,19 +36,28 @@ export const AvatarAndName = {
|
|
|
33
36
|
|
|
34
37
|
/** Avatar and children */
|
|
35
38
|
export const AvatarAndCustomName = {
|
|
36
|
-
args: {
|
|
39
|
+
args: {
|
|
40
|
+
...AvatarOnly.args,
|
|
41
|
+
name: (
|
|
42
|
+
<Text as="span" color="green">
|
|
43
|
+
Emmitt O. Lum
|
|
44
|
+
</Text>
|
|
45
|
+
),
|
|
46
|
+
},
|
|
37
47
|
};
|
|
38
48
|
|
|
39
49
|
/** Avatar, name and secondary fields */
|
|
40
50
|
export const AvatarAndNameAndSecondaryFields = {
|
|
41
|
-
args: {
|
|
51
|
+
args: {
|
|
52
|
+
...AvatarAndName.args,
|
|
53
|
+
fields: ['Creative developer', 'Denpasar'],
|
|
54
|
+
},
|
|
42
55
|
};
|
|
43
56
|
|
|
44
57
|
/** With Right component */
|
|
45
58
|
export const WithAfter = {
|
|
46
59
|
args: {
|
|
47
|
-
...
|
|
48
|
-
fields: ['Creative developer', 'Denpasar'],
|
|
60
|
+
...AvatarAndNameAndSecondaryFields.args,
|
|
49
61
|
after: <IconButton label="View" icon={mdiMenuDown} emphasis="low" />,
|
|
50
62
|
},
|
|
51
63
|
};
|
|
@@ -54,18 +66,27 @@ export const WithAfter = {
|
|
|
54
66
|
export const WithAdditionalFields = {
|
|
55
67
|
args: {
|
|
56
68
|
...AvatarAndName.args,
|
|
57
|
-
fields: [
|
|
69
|
+
fields: [
|
|
70
|
+
<Text key={0} as="span" color="dark">
|
|
71
|
+
Published a post in <Link href="#">Space</Link>
|
|
72
|
+
</Text>,
|
|
73
|
+
<time key={1}>May 13, 2025</time>,
|
|
74
|
+
],
|
|
58
75
|
additionalFields: (
|
|
59
76
|
<Text as="span" typography="body1">
|
|
60
77
|
Works at the Toronto office
|
|
61
78
|
</Text>
|
|
62
79
|
),
|
|
63
80
|
},
|
|
81
|
+
parameters: {
|
|
82
|
+
// Testing constrained space
|
|
83
|
+
wrapperProps: { style: { width: 245 } },
|
|
84
|
+
},
|
|
64
85
|
};
|
|
65
86
|
|
|
66
87
|
/** Size variants */
|
|
67
88
|
export const SizesAndOrientations = {
|
|
68
|
-
|
|
89
|
+
args: AvatarAndNameAndSecondaryFields.args,
|
|
69
90
|
decorators: [
|
|
70
91
|
withCombinations({
|
|
71
92
|
combinations: {
|
|
@@ -78,7 +99,7 @@ export const SizesAndOrientations = {
|
|
|
78
99
|
|
|
79
100
|
/** Setting `onClick` to use it as a button */
|
|
80
101
|
export const AsButton = {
|
|
81
|
-
|
|
102
|
+
args: AvatarAndNameAndSecondaryFields.args,
|
|
82
103
|
argTypes: { onClick: { action: true } },
|
|
83
104
|
};
|
|
84
105
|
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
1
2
|
import { withWrapper } from './withWrapper';
|
|
2
3
|
|
|
3
4
|
/** Storybook decorator wrapping story in a resizable box */
|
|
4
|
-
export const withResizableBox = ({
|
|
5
|
-
|
|
5
|
+
export const withResizableBox = ({
|
|
6
|
+
width = 150,
|
|
7
|
+
height = 50,
|
|
8
|
+
...style
|
|
9
|
+
}: Pick<CSSProperties, 'height' | 'minWidth' | 'width'> = {}) => {
|
|
10
|
+
return withWrapper({
|
|
6
11
|
style: {
|
|
7
12
|
display: 'flex',
|
|
8
13
|
width,
|
|
@@ -10,5 +15,7 @@ export const withResizableBox = ({ width = 150, height = 50 } = {}) =>
|
|
|
10
15
|
border: '1px solid red',
|
|
11
16
|
resize: 'both',
|
|
12
17
|
overflow: 'hidden',
|
|
18
|
+
...style,
|
|
13
19
|
},
|
|
14
20
|
});
|
|
21
|
+
};
|
|
@@ -8,10 +8,12 @@ export const withWrapper = <E extends React.ElementType = 'div'>(
|
|
|
8
8
|
as?: E,
|
|
9
9
|
) => {
|
|
10
10
|
// eslint-disable-next-line react/display-name
|
|
11
|
-
return (Story: any) => {
|
|
11
|
+
return (Story: any, ctx: any) => {
|
|
12
12
|
const Wrapper = as || 'div';
|
|
13
|
+
const { wrapperProps } = ctx.parameters;
|
|
14
|
+
const overriddenProps = { ...props, ...wrapperProps, style: { ...props?.style, ...wrapperProps?.style } };
|
|
13
15
|
return (
|
|
14
|
-
<Wrapper {...
|
|
16
|
+
<Wrapper {...overriddenProps}>
|
|
15
17
|
<Story />
|
|
16
18
|
</Wrapper>
|
|
17
19
|
);
|