@lumx/react 3.6.7 → 3.6.8
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 +29 -29
- package/index.d.ts +45 -45
- package/index.js +28 -16
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/alert-dialog/AlertDialog.tsx +2 -12
- package/src/components/autocomplete/Autocomplete.test.tsx +1 -1
- package/src/components/autocomplete/AutocompleteMultiple.test.tsx +1 -1
- package/src/components/badge/Badge.test.tsx +1 -1
- package/src/components/button/Button.test.tsx +2 -2
- package/src/components/button/IconButton.test.tsx +1 -1
- package/src/components/chip/Chip.test.tsx +22 -5
- package/src/components/chip/Chip.tsx +9 -5
- package/src/components/date-picker/DatePickerControlled.tsx +5 -4
- package/src/components/generic-block/GenericBlock.test.tsx +9 -9
- package/src/components/grid-column/GridColumn.tsx +32 -34
- package/src/components/icon/Icon.test.tsx +1 -1
- package/src/components/input-helper/InputHelper.test.tsx +1 -1
- package/src/components/link/Link.test.tsx +3 -3
- package/src/components/link-preview/LinkPreview.test.tsx +1 -2
- package/src/components/message/Message.test.tsx +1 -1
- package/src/components/mosaic/Mosaic.tsx +5 -4
- package/src/components/popover/Popover.tsx +13 -20
- package/src/components/select/Select.test.tsx +3 -3
- package/src/components/select/SelectMultiple.stories.tsx +56 -58
- package/src/components/select/SelectMultiple.test.tsx +4 -4
- package/src/components/side-navigation/SideNavigation.test.tsx +2 -2
- package/src/components/slideshow/SlideshowControls.stories.tsx +4 -9
- package/src/components/slideshow/useSlideFocusManagement.tsx +1 -1
- package/src/components/tabs/TabProvider.test.tsx +1 -1
- package/src/components/thumbnail/Thumbnail.stories.tsx +5 -5
- package/src/constants.ts +2 -2
- package/src/stories/decorators/withCombinations.tsx +76 -74
- package/src/utils/date/getFirstDayOfWeek.ts +2 -1
- package/src/utils/date/getMonthCalendar.test.ts +4 -0
- package/src/utils/date/getMonthCalendar.ts +10 -2
- package/src/utils/focus/constants.ts +4 -2
- package/src/utils/focus/getFirstAndLastFocusable.test.ts +19 -19
- package/src/utils/focus/getFocusableElements.test.ts +13 -13
- package/src/utils/type.ts +17 -13
- package/src/utils/utils.test.ts +5 -5
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@juggle/resize-observer": "^3.2.0",
|
|
10
|
-
"@lumx/core": "^3.6.
|
|
11
|
-
"@lumx/icons": "^3.6.
|
|
10
|
+
"@lumx/core": "^3.6.8",
|
|
11
|
+
"@lumx/icons": "^3.6.8",
|
|
12
12
|
"@popperjs/core": "^2.5.4",
|
|
13
13
|
"body-scroll-lock": "^3.1.5",
|
|
14
14
|
"classnames": "^2.3.2",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"rollup-plugin-ts-paths-resolve": "^1.3.0",
|
|
70
70
|
"rollup-plugin-typescript-paths": "^1.2.2",
|
|
71
71
|
"storybook": "^7.6.3",
|
|
72
|
-
"typescript": "^4.
|
|
72
|
+
"typescript": "^5.4.3",
|
|
73
73
|
"vite": "^4.2.1",
|
|
74
74
|
"vite-tsconfig-paths": "^4.0.7",
|
|
75
75
|
"yargs": "^15.4.1"
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"build:storybook": "storybook build"
|
|
113
113
|
},
|
|
114
114
|
"sideEffects": false,
|
|
115
|
-
"version": "3.6.
|
|
115
|
+
"version": "3.6.8"
|
|
116
116
|
}
|
|
@@ -78,18 +78,8 @@ const DEFAULT_PROPS: Partial<DialogProps> = {
|
|
|
78
78
|
* Children of this component should only be strings, paragraphs or links.
|
|
79
79
|
*/
|
|
80
80
|
export const AlertDialog: Comp<AlertDialogProps, HTMLDivElement> = forwardRef((props, ref) => {
|
|
81
|
-
const {
|
|
82
|
-
|
|
83
|
-
title,
|
|
84
|
-
className,
|
|
85
|
-
cancelProps,
|
|
86
|
-
confirmProps,
|
|
87
|
-
kind,
|
|
88
|
-
size,
|
|
89
|
-
dialogProps,
|
|
90
|
-
children,
|
|
91
|
-
...forwardedProps
|
|
92
|
-
} = props;
|
|
81
|
+
const { id, title, className, cancelProps, confirmProps, kind, size, dialogProps, children, ...forwardedProps } =
|
|
82
|
+
props;
|
|
93
83
|
|
|
94
84
|
const cancelButtonRef = React.useRef(null);
|
|
95
85
|
const confirmationButtonRef = React.useRef(null);
|
|
@@ -38,7 +38,7 @@ describe(`<${Autocomplete.displayName}>`, () => {
|
|
|
38
38
|
it('should render default', () => {
|
|
39
39
|
const { autocomplete, textField, getDropdown } = setup();
|
|
40
40
|
|
|
41
|
-
expect(autocomplete.className).toMatchInlineSnapshot(
|
|
41
|
+
expect(autocomplete.className).toMatchInlineSnapshot('"lumx-autocomplete"');
|
|
42
42
|
expect(textField).toBeInTheDocument();
|
|
43
43
|
expect(getDropdown()).not.toBeInTheDocument();
|
|
44
44
|
});
|
|
@@ -36,7 +36,7 @@ describe(`<${AutocompleteMultiple.displayName}>`, () => {
|
|
|
36
36
|
const { autocompleteMultiple, textField, getDropdown } = setup({});
|
|
37
37
|
|
|
38
38
|
expect(autocompleteMultiple).toBeInTheDocument();
|
|
39
|
-
expect(autocompleteMultiple.className).toMatchInlineSnapshot(
|
|
39
|
+
expect(autocompleteMultiple.className).toMatchInlineSnapshot('"lumx-autocomplete-multiple lumx-autocomplete"');
|
|
40
40
|
expect(textField).toBeInTheDocument();
|
|
41
41
|
expect(getDropdown()).not.toBeInTheDocument();
|
|
42
42
|
});
|
|
@@ -26,7 +26,7 @@ describe(`<${Badge.displayName}>`, () => {
|
|
|
26
26
|
it('should use default props', () => {
|
|
27
27
|
const { badge } = setup();
|
|
28
28
|
|
|
29
|
-
expect(badge.className).toMatchInlineSnapshot(
|
|
29
|
+
expect(badge.className).toMatchInlineSnapshot('"lumx-badge lumx-badge--color-primary"');
|
|
30
30
|
expect(badge).toHaveTextContent(/30/);
|
|
31
31
|
});
|
|
32
32
|
|
|
@@ -32,7 +32,7 @@ describe(`<${Button.displayName}>`, () => {
|
|
|
32
32
|
expect(button).toBe(screen.queryByRole('button', { name: label }));
|
|
33
33
|
expect(button).toHaveAttribute('type', 'button');
|
|
34
34
|
expect(button.className).toMatchInlineSnapshot(
|
|
35
|
-
|
|
35
|
+
'"lumx-button lumx-button--color-primary lumx-button--emphasis-high lumx-button--size-m lumx-button--theme-light lumx-button--variant-button"',
|
|
36
36
|
);
|
|
37
37
|
expect(icons.length).toBe(0);
|
|
38
38
|
});
|
|
@@ -53,7 +53,7 @@ describe(`<${Button.displayName}>`, () => {
|
|
|
53
53
|
it('should render emphasis low', () => {
|
|
54
54
|
const { button } = setup({ emphasis: Emphasis.low });
|
|
55
55
|
expect(button.className).toMatchInlineSnapshot(
|
|
56
|
-
|
|
56
|
+
'"lumx-button lumx-button--color-dark lumx-button--emphasis-low lumx-button--size-m lumx-button--variant-button"',
|
|
57
57
|
);
|
|
58
58
|
});
|
|
59
59
|
|
|
@@ -30,7 +30,7 @@ describe(`<${IconButton.displayName}>`, () => {
|
|
|
30
30
|
const { iconButton, icon, img } = setup();
|
|
31
31
|
expect(iconButton).toBeInTheDocument();
|
|
32
32
|
expect(iconButton.className).toMatchInlineSnapshot(
|
|
33
|
-
|
|
33
|
+
'"lumx-button lumx-button--color-primary lumx-button--emphasis-high lumx-button--size-m lumx-button--theme-light lumx-button--variant-icon"',
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
expect(icon).toBeInTheDocument();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Theme } from '@lumx/react';
|
|
4
4
|
import { commonTestsSuiteRTL } from '@lumx/react/testing/utils';
|
|
5
|
-
import {
|
|
6
|
-
import { render } from '@testing-library/react';
|
|
5
|
+
import { render, screen } from '@testing-library/react';
|
|
7
6
|
import { getByClassName, queryByClassName } from '@lumx/react/testing/utils/queries';
|
|
8
7
|
import userEvent from '@testing-library/user-event';
|
|
9
8
|
import { Chip, ChipProps } from './Chip';
|
|
@@ -33,7 +32,7 @@ describe('<Chip />', () => {
|
|
|
33
32
|
expect(chip).toBeInTheDocument();
|
|
34
33
|
expect(chip).toHaveTextContent('Chip text');
|
|
35
34
|
expect(chip.className).toMatchInlineSnapshot(
|
|
36
|
-
|
|
35
|
+
'"lumx-chip lumx-chip--color-dark lumx-chip--size-m lumx-chip--is-unselected"',
|
|
37
36
|
);
|
|
38
37
|
});
|
|
39
38
|
|
|
@@ -47,9 +46,27 @@ describe('<Chip />', () => {
|
|
|
47
46
|
const { chip } = setup({ children: 'Chip text', onClick });
|
|
48
47
|
expect(chip).toHaveAttribute('role', 'button');
|
|
49
48
|
expect(chip.className).toMatchInlineSnapshot(
|
|
50
|
-
|
|
49
|
+
'"lumx-chip lumx-chip--is-clickable lumx-chip--color-dark lumx-chip--size-m lumx-chip--is-unselected"',
|
|
51
50
|
);
|
|
52
51
|
});
|
|
52
|
+
|
|
53
|
+
it('should render a link', () => {
|
|
54
|
+
setup({ children: 'Chip text', href: 'https://google.com', target: '_blank' });
|
|
55
|
+
const chip = screen.getByRole('link', { name: 'Chip text' });
|
|
56
|
+
expect(chip).toHaveAttribute('href', 'https://google.com');
|
|
57
|
+
expect(chip).toHaveAttribute('target', '_blank');
|
|
58
|
+
expect(chip).toHaveAttribute('tabIndex', '0');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should override the role', () => {
|
|
62
|
+
setup({ children: 'Chip text', role: 'radio' });
|
|
63
|
+
expect(screen.getByRole('radio', { name: 'Chip text' })).toBeInTheDocument();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should override the tabIndex', () => {
|
|
67
|
+
const { chip } = setup({ children: 'Chip text', tabIndex: -1 });
|
|
68
|
+
expect(chip).toHaveAttribute('tabIndex', '-1');
|
|
69
|
+
});
|
|
53
70
|
});
|
|
54
71
|
|
|
55
72
|
describe('Events', () => {
|
|
@@ -74,7 +74,7 @@ export const Chip: Comp<ChipProps, HTMLAnchorElement> = forwardRef((props, ref)
|
|
|
74
74
|
className,
|
|
75
75
|
color,
|
|
76
76
|
disabled,
|
|
77
|
-
isClickable,
|
|
77
|
+
isClickable: propIsClickable,
|
|
78
78
|
isDisabled = disabled,
|
|
79
79
|
isHighlighted,
|
|
80
80
|
isSelected,
|
|
@@ -83,11 +83,14 @@ export const Chip: Comp<ChipProps, HTMLAnchorElement> = forwardRef((props, ref)
|
|
|
83
83
|
onClick,
|
|
84
84
|
size,
|
|
85
85
|
theme,
|
|
86
|
+
href,
|
|
86
87
|
...forwardedProps
|
|
87
88
|
} = props;
|
|
88
89
|
const hasAfterClick = isFunction(onAfterClick);
|
|
89
90
|
const hasBeforeClick = isFunction(onBeforeClick);
|
|
90
91
|
const hasOnClick = isFunction(onClick);
|
|
92
|
+
const isButton = hasOnClick && !href;
|
|
93
|
+
const isClickable = Boolean(hasOnClick) || Boolean(href) || propIsClickable;
|
|
91
94
|
|
|
92
95
|
// Adapt color to the theme.
|
|
93
96
|
const chipColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);
|
|
@@ -98,12 +101,15 @@ export const Chip: Comp<ChipProps, HTMLAnchorElement> = forwardRef((props, ref)
|
|
|
98
101
|
return (
|
|
99
102
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
100
103
|
<a
|
|
104
|
+
role={isButton ? 'button' : undefined}
|
|
105
|
+
tabIndex={isClickable ? 0 : undefined}
|
|
101
106
|
{...forwardedProps}
|
|
107
|
+
href={href}
|
|
102
108
|
ref={ref}
|
|
103
109
|
className={classNames(
|
|
104
110
|
className,
|
|
105
111
|
handleBasicClasses({
|
|
106
|
-
clickable:
|
|
112
|
+
clickable: isClickable,
|
|
107
113
|
color: chipColor,
|
|
108
114
|
isDisabled,
|
|
109
115
|
hasAfter: Boolean(after),
|
|
@@ -115,9 +121,7 @@ export const Chip: Comp<ChipProps, HTMLAnchorElement> = forwardRef((props, ref)
|
|
|
115
121
|
unselected: Boolean(!isSelected),
|
|
116
122
|
}),
|
|
117
123
|
)}
|
|
118
|
-
|
|
119
|
-
tabIndex={isDisabled || !hasOnClick ? -1 : 0}
|
|
120
|
-
aria-disabled={(hasOnClick && isDisabled) || undefined}
|
|
124
|
+
aria-disabled={(isClickable && isDisabled) || undefined}
|
|
121
125
|
onClick={hasOnClick ? onClick : undefined}
|
|
122
126
|
onKeyDown={hasOnClick ? onEnterPressed(onClick) : undefined}
|
|
123
127
|
>
|
|
@@ -77,10 +77,11 @@ export const DatePickerControlled: Comp<DatePickerControlledProps, HTMLDivElemen
|
|
|
77
77
|
|
|
78
78
|
const monthYear = selectedMonth.toLocaleDateString(locale, { year: 'numeric', month: 'long' });
|
|
79
79
|
|
|
80
|
-
// Year can only be
|
|
81
|
-
const handleKeyPress: KeyboardEventHandler = React.useMemo(
|
|
82
|
-
updateMonthOffset,
|
|
83
|
-
|
|
80
|
+
// Year can only be validated by pressing Enter key or on Blur. The below handles the press Enter key case
|
|
81
|
+
const handleKeyPress: KeyboardEventHandler = React.useMemo(
|
|
82
|
+
() => onEnterPressed(updateMonthOffset),
|
|
83
|
+
[updateMonthOffset],
|
|
84
|
+
);
|
|
84
85
|
|
|
85
86
|
// Required to update year in the TextField when the user changes year by using prev next month arrows
|
|
86
87
|
React.useEffect(() => {
|
|
@@ -26,13 +26,13 @@ describe(`<${GenericBlock.displayName}>`, () => {
|
|
|
26
26
|
const { genericBlock, content, figure, actions } = setup({ children: 'Content' });
|
|
27
27
|
expect(genericBlock).toBeInTheDocument();
|
|
28
28
|
expect(genericBlock.className).toMatchInlineSnapshot(
|
|
29
|
-
|
|
29
|
+
'"lumx-generic-block lumx-flex-box lumx-flex-box--orientation-horizontal lumx-flex-box--gap-big"',
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
expect(content).toBeInTheDocument();
|
|
33
33
|
expect(content).toHaveTextContent('Content');
|
|
34
34
|
expect(content?.className).toMatchInlineSnapshot(
|
|
35
|
-
|
|
35
|
+
'"lumx-generic-block__content lumx-flex-box lumx-flex-box--orientation-vertical lumx-flex-box--fill-space"',
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
expect(figure).not.toBeInTheDocument();
|
|
@@ -49,16 +49,16 @@ describe(`<${GenericBlock.displayName}>`, () => {
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
expect(genericBlock?.className).toMatchInlineSnapshot(
|
|
52
|
-
|
|
52
|
+
'"lumx-generic-block lumx-flex-box lumx-flex-box--orientation-horizontal lumx-flex-box--v-align-left lumx-flex-box--h-align-bottom lumx-flex-box--gap-big"',
|
|
53
53
|
);
|
|
54
54
|
expect(figure?.className).toMatchInlineSnapshot(
|
|
55
|
-
|
|
55
|
+
'"lumx-generic-block__figure lumx-flex-box lumx-flex-box--orientation-horizontal lumx-flex-box--v-align-left lumx-flex-box--h-align-bottom"',
|
|
56
56
|
);
|
|
57
57
|
expect(content?.className).toMatchInlineSnapshot(
|
|
58
|
-
|
|
58
|
+
'"lumx-generic-block__content lumx-flex-box lumx-flex-box--orientation-vertical lumx-flex-box--v-align-left lumx-flex-box--h-align-bottom lumx-flex-box--fill-space"',
|
|
59
59
|
);
|
|
60
60
|
expect(actions?.className).toMatchInlineSnapshot(
|
|
61
|
-
|
|
61
|
+
'"lumx-generic-block__actions lumx-flex-box lumx-flex-box--orientation-horizontal lumx-flex-box--v-align-left lumx-flex-box--h-align-bottom"',
|
|
62
62
|
);
|
|
63
63
|
});
|
|
64
64
|
|
|
@@ -75,7 +75,7 @@ describe(`<${GenericBlock.displayName}>`, () => {
|
|
|
75
75
|
|
|
76
76
|
// Merged class names
|
|
77
77
|
expect(figure?.className).toMatchInlineSnapshot(
|
|
78
|
-
|
|
78
|
+
'"figure1 figure2 lumx-generic-block__figure lumx-flex-box lumx-flex-box--orientation-horizontal lumx-flex-box--v-align-left lumx-flex-box--fill-space"',
|
|
79
79
|
);
|
|
80
80
|
// Merged content
|
|
81
81
|
expect(figure).toHaveTextContent('Figure 1Figure 2');
|
|
@@ -97,7 +97,7 @@ describe(`<${GenericBlock.displayName}>`, () => {
|
|
|
97
97
|
|
|
98
98
|
// Merged class names
|
|
99
99
|
expect(content?.className).toMatchInlineSnapshot(
|
|
100
|
-
|
|
100
|
+
'"content1 content2 lumx-generic-block__content lumx-flex-box lumx-flex-box--orientation-vertical lumx-flex-box--v-align-left lumx-flex-box--fill-space"',
|
|
101
101
|
);
|
|
102
102
|
// Merged content
|
|
103
103
|
expect(content).toHaveTextContent('Content 2Content 1');
|
|
@@ -119,7 +119,7 @@ describe(`<${GenericBlock.displayName}>`, () => {
|
|
|
119
119
|
|
|
120
120
|
// Merged class names
|
|
121
121
|
expect(actions?.className).toMatchInlineSnapshot(
|
|
122
|
-
|
|
122
|
+
'"actions1 actions2 lumx-generic-block__actions lumx-flex-box lumx-flex-box--orientation-horizontal lumx-flex-box--v-align-left lumx-flex-box--fill-space"',
|
|
123
123
|
);
|
|
124
124
|
// Merged content
|
|
125
125
|
expect(actions).toHaveTextContent('Actions 1Actions 2');
|
|
@@ -50,41 +50,39 @@ const DEFAULT_PROPS: Partial<GridColumnProps> = {};
|
|
|
50
50
|
* @param ref Component ref.
|
|
51
51
|
* @return React element.
|
|
52
52
|
*/
|
|
53
|
-
export const GridColumn: Comp<GridColumnProps> = forwardRef(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = props;
|
|
53
|
+
export const GridColumn: Comp<GridColumnProps> = forwardRef((props, ref): ReactElement => {
|
|
54
|
+
const {
|
|
55
|
+
as: Component = 'div',
|
|
56
|
+
gap,
|
|
57
|
+
maxColumns,
|
|
58
|
+
itemMinWidth,
|
|
59
|
+
children,
|
|
60
|
+
className,
|
|
61
|
+
style = {},
|
|
62
|
+
...forwardedProps
|
|
63
|
+
} = props;
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
);
|
|
65
|
+
return (
|
|
66
|
+
<Component
|
|
67
|
+
{...forwardedProps}
|
|
68
|
+
ref={ref as React.Ref<any>}
|
|
69
|
+
className={classNames(
|
|
70
|
+
className,
|
|
71
|
+
handleBasicClasses({
|
|
72
|
+
prefix: CLASSNAME,
|
|
73
|
+
}),
|
|
74
|
+
)}
|
|
75
|
+
style={{
|
|
76
|
+
...style,
|
|
77
|
+
['--lumx-grid-column-item-min-width' as any]: isInteger(itemMinWidth) && `${itemMinWidth}px`,
|
|
78
|
+
['--lumx-grid-column-columns' as any]: maxColumns,
|
|
79
|
+
['--lumx-grid-column-gap' as any]: gap && `var(--lumx-spacing-unit-${gap})`,
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
{children}
|
|
83
|
+
</Component>
|
|
84
|
+
);
|
|
85
|
+
});
|
|
88
86
|
GridColumn.displayName = COMPONENT_NAME;
|
|
89
87
|
GridColumn.className = CLASSNAME;
|
|
90
88
|
GridColumn.defaultProps = DEFAULT_PROPS;
|
|
@@ -35,7 +35,7 @@ describe(`<${Icon.displayName}>`, () => {
|
|
|
35
35
|
|
|
36
36
|
expect(i).toBeInTheDocument();
|
|
37
37
|
expect(i).toHaveClass(CLASSNAME);
|
|
38
|
-
expect(i?.className).toMatchInlineSnapshot(
|
|
38
|
+
expect(i?.className).toMatchInlineSnapshot('"lumx-icon lumx-icon--no-shape lumx-icon--path"');
|
|
39
39
|
|
|
40
40
|
expect(svg).toBeInTheDocument();
|
|
41
41
|
expect(svg).toHaveAttribute('aria-hidden', 'true');
|
|
@@ -28,7 +28,7 @@ describe(`<${InputHelper.displayName}>`, () => {
|
|
|
28
28
|
const { props, helper } = setup({ children: 'helper text' });
|
|
29
29
|
|
|
30
30
|
expect(helper).toHaveTextContent(props.children);
|
|
31
|
-
expect(helper.className).toMatchInlineSnapshot(
|
|
31
|
+
expect(helper.className).toMatchInlineSnapshot('"lumx-input-helper lumx-input-helper--theme-light"');
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it('should render dark theme', () => {
|
|
@@ -30,7 +30,7 @@ describe(`<${Link.displayName}>`, () => {
|
|
|
30
30
|
|
|
31
31
|
expect(link).toBe(screen.queryByRole('link', { name }));
|
|
32
32
|
expect(link).toHaveAttribute('href', props.href);
|
|
33
|
-
expect(link.className).toMatchInlineSnapshot(
|
|
33
|
+
expect(link.className).toMatchInlineSnapshot('"lumx-link"');
|
|
34
34
|
|
|
35
35
|
expect(rightIcon).not.toBeInTheDocument();
|
|
36
36
|
expect(leftIcon).not.toBeInTheDocument();
|
|
@@ -43,13 +43,13 @@ describe(`<${Link.displayName}>`, () => {
|
|
|
43
43
|
colorVariant: ColorVariant.D1,
|
|
44
44
|
});
|
|
45
45
|
expect(link.className).toMatchInlineSnapshot(
|
|
46
|
-
|
|
46
|
+
'"lumx-link lumx-link--color-primary lumx-link--color-variant-D1"',
|
|
47
47
|
);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
it('should render typography', () => {
|
|
51
51
|
const { content } = setup({ href: 'https://google.com', typography: Typography.title });
|
|
52
|
-
expect(content?.className).toMatchInlineSnapshot(
|
|
52
|
+
expect(content?.className).toMatchInlineSnapshot('undefined');
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it('should render a button', () => {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { commonTestsSuiteRTL } from '@lumx/react/testing/utils';
|
|
4
|
-
import {
|
|
5
|
-
import { Link, Thumbnail } from '@lumx/react';
|
|
4
|
+
import { Thumbnail } from '@lumx/react';
|
|
6
5
|
import { render, screen, within } from '@testing-library/react';
|
|
7
6
|
import { getByClassName, queryByClassName, queryAllByClassName } from '@lumx/react/testing/utils/queries';
|
|
8
7
|
|
|
@@ -30,7 +30,7 @@ describe(`<${Message.displayName}>`, () => {
|
|
|
30
30
|
it('should render default', () => {
|
|
31
31
|
const { message, icon } = setup({ children: 'Message text' });
|
|
32
32
|
expect(message).toBeInTheDocument();
|
|
33
|
-
expect(message.className).toMatchInlineSnapshot(
|
|
33
|
+
expect(message.className).toMatchInlineSnapshot('"lumx-message"');
|
|
34
34
|
expect(message).toHaveTextContent('Message text');
|
|
35
35
|
|
|
36
36
|
expect(icon).not.toBeInTheDocument();
|
|
@@ -45,10 +45,11 @@ export const Mosaic: Comp<MosaicProps, HTMLDivElement> = forwardRef((props, ref)
|
|
|
45
45
|
const handleImageClick = useMemo(() => {
|
|
46
46
|
if (!onImageClick) return undefined;
|
|
47
47
|
|
|
48
|
-
return (index: number, onClick?: MouseEventHandler): MouseEventHandler =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
return (index: number, onClick?: MouseEventHandler): MouseEventHandler =>
|
|
49
|
+
(event) => {
|
|
50
|
+
onClick?.(event);
|
|
51
|
+
onImageClick?.(index);
|
|
52
|
+
};
|
|
52
53
|
}, [onImageClick]);
|
|
53
54
|
|
|
54
55
|
return (
|
|
@@ -127,26 +127,19 @@ const _InnerPopover: Comp<PopoverProps, HTMLDivElement> = forwardRef((props, ref
|
|
|
127
127
|
} = props;
|
|
128
128
|
const popoverRef = useRef<HTMLDivElement>(null);
|
|
129
129
|
|
|
130
|
-
const {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
boundaryRef,
|
|
144
|
-
anchorRef,
|
|
145
|
-
children,
|
|
146
|
-
placement,
|
|
147
|
-
style,
|
|
148
|
-
zIndex,
|
|
149
|
-
});
|
|
130
|
+
const { styles, attributes, isPositioned, position, setArrowElement, setPopperElement, popperElement } =
|
|
131
|
+
usePopoverStyle({
|
|
132
|
+
offset,
|
|
133
|
+
hasArrow,
|
|
134
|
+
fitToAnchorWidth,
|
|
135
|
+
fitWithinViewportHeight,
|
|
136
|
+
boundaryRef,
|
|
137
|
+
anchorRef,
|
|
138
|
+
children,
|
|
139
|
+
placement,
|
|
140
|
+
style,
|
|
141
|
+
zIndex,
|
|
142
|
+
});
|
|
150
143
|
|
|
151
144
|
const unmountSentinel = useRestoreFocusOnClose({ focusAnchorOnClose, anchorRef, parentElement }, popperElement);
|
|
152
145
|
const focusZoneElement = focusTrapZoneElement?.current || popoverRef?.current;
|
|
@@ -42,7 +42,7 @@ describe(`<${Select.displayName}>`, () => {
|
|
|
42
42
|
const { select, getDropdown } = setup();
|
|
43
43
|
expect(getDropdown()).not.toBeInTheDocument();
|
|
44
44
|
expect(select.className).toMatchInlineSnapshot(
|
|
45
|
-
|
|
45
|
+
'"lumx-select lumx-select--has-unique lumx-select lumx-select--is-empty lumx-select--theme-light"',
|
|
46
46
|
);
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -120,7 +120,7 @@ describe(`<${Select.displayName}>`, () => {
|
|
|
120
120
|
expect(inputWrapper).not.toBeInTheDocument();
|
|
121
121
|
expect(chip).toBeInTheDocument();
|
|
122
122
|
expect(select.className).toMatchInlineSnapshot(
|
|
123
|
-
|
|
123
|
+
'"lumx-select lumx-select--has-unique lumx-select lumx-select--is-empty lumx-select--theme-light"',
|
|
124
124
|
);
|
|
125
125
|
});
|
|
126
126
|
|
|
@@ -128,7 +128,7 @@ describe(`<${Select.displayName}>`, () => {
|
|
|
128
128
|
const { select, chip, props } = setup({ variant: SelectVariant.chip, value: 'val1' });
|
|
129
129
|
expect(chip).toHaveTextContent(props.value);
|
|
130
130
|
expect(select.className).toMatchInlineSnapshot(
|
|
131
|
-
|
|
131
|
+
'"lumx-select lumx-select--has-unique lumx-select lumx-select--has-value lumx-select--theme-light"',
|
|
132
132
|
);
|
|
133
133
|
});
|
|
134
134
|
|