@lumx/react 3.14.1 → 3.14.2-alpha.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.
- package/index.d.ts +8 -1
- package/index.js +13 -9
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/dialog/Dialog.tsx +4 -9
- package/src/components/progress/ProgressCircular.stories.tsx +15 -1
- package/src/components/progress/ProgressCircular.test.tsx +6 -0
- package/src/components/progress/ProgressCircular.tsx +22 -7
- package/src/components/user-block/UserBlock.stories.tsx +29 -8
- package/src/stories/decorators/withResizableBox.tsx +9 -2
- package/src/stories/decorators/withWrapper.tsx +4 -2
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.1",
|
|
10
|
-
"@lumx/icons": "^3.14.1",
|
|
9
|
+
"@lumx/core": "^3.14.2-alpha.1",
|
|
10
|
+
"@lumx/icons": "^3.14.2-alpha.1",
|
|
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.1"
|
|
113
|
+
"version": "3.14.2-alpha.1"
|
|
114
114
|
}
|
|
@@ -214,18 +214,13 @@ export const Dialog = forwardRef<DialogProps, HTMLDivElement>((props, ref) => {
|
|
|
214
214
|
|
|
215
215
|
<HeadingLevelProvider level={2}>
|
|
216
216
|
<ThemeProvider value={undefined}>
|
|
217
|
-
<
|
|
218
|
-
className={`${CLASSNAME}__container`}
|
|
219
|
-
role="dialog"
|
|
220
|
-
aria-modal="true"
|
|
221
|
-
{...dialogProps}
|
|
222
|
-
>
|
|
217
|
+
<div className={`${CLASSNAME}__container`} role="dialog" aria-modal="true" {...dialogProps}>
|
|
223
218
|
<ClickAwayProvider
|
|
224
219
|
callback={!shouldPreventCloseOnClickAway && onClose}
|
|
225
220
|
childrenRefs={clickAwayRefs}
|
|
226
221
|
parentRef={rootRef}
|
|
227
222
|
>
|
|
228
|
-
<
|
|
223
|
+
<section className={`${CLASSNAME}__wrapper`} ref={wrapperRef}>
|
|
229
224
|
{(header || headerChildContent) && (
|
|
230
225
|
<header
|
|
231
226
|
{...headerChildProps}
|
|
@@ -278,9 +273,9 @@ export const Dialog = forwardRef<DialogProps, HTMLDivElement>((props, ref) => {
|
|
|
278
273
|
<Progress variant={ProgressVariant.circular} />
|
|
279
274
|
</div>
|
|
280
275
|
)}
|
|
281
|
-
</
|
|
276
|
+
</section>
|
|
282
277
|
</ClickAwayProvider>
|
|
283
|
-
</
|
|
278
|
+
</div>
|
|
284
279
|
</ThemeProvider>
|
|
285
280
|
</HeadingLevelProvider>
|
|
286
281
|
</div>,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ProgressCircular, ProgressCircularSize, Size, Text } from '@lumx/react';
|
|
2
3
|
import { getSelectArgType } from '@lumx/react/stories/controls/selectArgType';
|
|
3
4
|
import { withCombinations } from '@lumx/react/stories/decorators/withCombinations';
|
|
4
5
|
|
|
@@ -28,3 +29,16 @@ export const AllSizes = {
|
|
|
28
29
|
}),
|
|
29
30
|
],
|
|
30
31
|
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Inline display variant to use inside text
|
|
35
|
+
*/
|
|
36
|
+
export const Inline = {
|
|
37
|
+
render() {
|
|
38
|
+
return (
|
|
39
|
+
<Text as="p">
|
|
40
|
+
Some text with <ProgressCircular display="inline" size="xxs" /> inline progress
|
|
41
|
+
</Text>
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -21,6 +21,7 @@ describe(`<${ProgressCircular.displayName}>`, () => {
|
|
|
21
21
|
it('should render default', () => {
|
|
22
22
|
const { element } = setup();
|
|
23
23
|
expect(element).toHaveClass(`${CLASSNAME}--size-m`);
|
|
24
|
+
expect(element.tagName).toBe('DIV');
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
it('should render size xs', () => {
|
|
@@ -28,6 +29,11 @@ describe(`<${ProgressCircular.displayName}>`, () => {
|
|
|
28
29
|
expect(element).toHaveClass(`${CLASSNAME}--size-xs`);
|
|
29
30
|
});
|
|
30
31
|
|
|
32
|
+
it('should render display inline', () => {
|
|
33
|
+
const { element } = setup({ display: 'inline' });
|
|
34
|
+
expect(element.tagName).toBe('SPAN');
|
|
35
|
+
});
|
|
36
|
+
|
|
31
37
|
commonTestsSuiteRTL(setup, {
|
|
32
38
|
baseClassName: CLASSNAME,
|
|
33
39
|
forwardClassName: 'element',
|
|
@@ -17,8 +17,15 @@ export type ProgressCircularSize = Extract<Size, 'xxs' | 'xs' | 's' | 'm'>;
|
|
|
17
17
|
* Defines the props of the component.
|
|
18
18
|
*/
|
|
19
19
|
export interface ProgressCircularProps extends GenericProps, HasTheme {
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Progress circular size.
|
|
22
|
+
*/
|
|
21
23
|
size?: ProgressCircularSize;
|
|
24
|
+
/**
|
|
25
|
+
* Progress display type (inline or block).
|
|
26
|
+
* @default 'block'
|
|
27
|
+
*/
|
|
28
|
+
display?: 'inline' | 'block';
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
/**
|
|
@@ -36,6 +43,7 @@ const CLASSNAME = getRootClassName(COMPONENT_NAME);
|
|
|
36
43
|
*/
|
|
37
44
|
const DEFAULT_PROPS: Partial<ProgressCircularProps> = {
|
|
38
45
|
size: Size.m,
|
|
46
|
+
display: 'block',
|
|
39
47
|
};
|
|
40
48
|
|
|
41
49
|
/**
|
|
@@ -47,21 +55,28 @@ const DEFAULT_PROPS: Partial<ProgressCircularProps> = {
|
|
|
47
55
|
*/
|
|
48
56
|
export const ProgressCircular = forwardRef<ProgressCircularProps, HTMLDivElement>((props, ref) => {
|
|
49
57
|
const defaultTheme = useTheme() || Theme.light;
|
|
50
|
-
const {
|
|
58
|
+
const {
|
|
59
|
+
className,
|
|
60
|
+
theme = defaultTheme,
|
|
61
|
+
size = DEFAULT_PROPS.size,
|
|
62
|
+
display = DEFAULT_PROPS.display,
|
|
63
|
+
...forwardedProps
|
|
64
|
+
} = props;
|
|
65
|
+
const Element = display === 'block' ? 'div' : 'span';
|
|
51
66
|
|
|
52
67
|
return (
|
|
53
|
-
<
|
|
68
|
+
<Element
|
|
54
69
|
ref={ref}
|
|
55
70
|
{...forwardedProps}
|
|
56
|
-
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme, size }))}
|
|
71
|
+
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme, size, display }))}
|
|
57
72
|
>
|
|
58
|
-
<
|
|
59
|
-
<
|
|
73
|
+
<Element className="lumx-progress-circular__double-bounce1" />
|
|
74
|
+
<Element className="lumx-progress-circular__double-bounce2" />
|
|
60
75
|
|
|
61
76
|
<svg className="lumx-progress-circular__svg" viewBox="25 25 50 50">
|
|
62
77
|
<circle className="lumx-progress-circular__path" cx="50" cy="50" r="20" fill="none" strokeWidth="5" />
|
|
63
78
|
</svg>
|
|
64
|
-
</
|
|
79
|
+
</Element>
|
|
65
80
|
);
|
|
66
81
|
});
|
|
67
82
|
ProgressCircular.displayName = COMPONENT_NAME;
|
|
@@ -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
|
);
|