@ndlib/component-library 1.0.45 → 1.0.47
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/dist/components/composites/Card/Card.stories.js +7 -7
- package/dist/components/composites/Card/Card.test.js +1 -1
- package/dist/components/composites/Card/index.js +10 -10
- package/dist/components/composites/CardV2/CardV2.stories.js +14 -14
- package/dist/components/composites/CardV2/CardV2.test.js +1 -1
- package/dist/components/composites/CardV2/index.js +11 -11
- package/dist/components/composites/DragDropList/DragDrop.test.js +1 -1
- package/dist/components/composites/DragDropList/DragDropList.stories.d.ts +2 -3
- package/dist/components/composites/DragDropList/DragDropList.stories.js +2 -2
- package/dist/components/composites/DragDropList/index.d.ts +1 -2
- package/dist/components/composites/DragDropList/index.js +5 -5
- package/dist/components/composites/DropdownLinks/DropdownLinks.stories.js +3 -3
- package/dist/components/composites/DropdownLinks/DropdownLinks.test.js +1 -1
- package/dist/components/composites/DropdownLinks/index.js +2 -2
- package/dist/components/composites/DropdownLinksV2/DropdownLinksV2.stories.js +3 -3
- package/dist/components/composites/DropdownLinksV2/index.js +2 -2
- package/dist/components/composites/EmptyState/EmptyState.stories.js +1 -1
- package/dist/components/composites/EmptyState/index.js +2 -2
- package/dist/components/composites/EmptyStateV2/EmptyStateV2.module.css +10 -0
- package/dist/components/composites/EmptyStateV2/EmptyStateV2.stories.d.ts +10 -0
- package/dist/components/composites/EmptyStateV2/EmptyStateV2.stories.js +33 -0
- package/dist/components/composites/EmptyStateV2/index.d.ts +15 -0
- package/dist/components/composites/EmptyStateV2/index.js +36 -0
- package/dist/components/composites/Modal/Modal.stories.js +2 -2
- package/dist/components/composites/Modal/Modal.test.js +4 -4
- package/dist/components/composites/Modal/index.js +5 -5
- package/dist/components/composites/ModalV2/ModalV2.stories.js +2 -2
- package/dist/components/composites/ModalV2/ModalV2.test.js +4 -4
- package/dist/components/composites/ModalV2/index.js +5 -5
- package/dist/components/composites/NavMenu/demo.js +1 -1
- package/dist/components/composites/NavMenu/index.js +6 -6
- package/dist/components/composites/NavMenuV2/demoV2.js +2 -2
- package/dist/components/composites/NavMenuV2/index.js +3 -3
- package/dist/components/composites/Seo/SeoDataDisplay/index.js +1 -1
- package/dist/components/composites/Seo/index.js +1 -1
- package/dist/components/composites/SnackBar/examples.js +7 -7
- package/dist/components/composites/SnackBar/index.js +4 -4
- package/dist/components/composites/StructuredData/index.d.ts +0 -1
- package/dist/components/composites/StructuredData/index.js +1 -1
- package/dist/components/elements/Alerts/Alerts.stories.js +2 -2
- package/dist/components/elements/Alerts/index.js +2 -2
- package/dist/components/elements/AlertsV2/AlertsV2.stories.js +2 -2
- package/dist/components/elements/AlertsV2/index.js +1 -1
- package/dist/components/elements/ArrowLink/ArrowLink.stories.js +1 -1
- package/dist/components/elements/ArrowLink/ArrowLink.test.js +5 -5
- package/dist/components/elements/ArrowLink/index.d.ts +0 -1
- package/dist/components/elements/ArrowLink/index.js +3 -3
- package/dist/components/elements/ArrowLinkV2/ArrowLinkV2.stories.js +1 -1
- package/dist/components/elements/ArrowLinkV2/index.d.ts +0 -1
- package/dist/components/elements/ArrowLinkV2/index.js +1 -1
- package/dist/components/elements/AutoComplete/AutoComplete.stories.js +1 -1
- package/dist/components/elements/BoxV2/BoxV2.stories.js +1 -1
- package/dist/components/elements/BoxV2/index.d.ts +2 -2
- package/dist/components/elements/BrandingBar/index.d.ts +0 -1
- package/dist/components/elements/BrandingBar/index.js +4 -4
- package/dist/components/elements/BrandingBarV2/index.js +1 -1
- package/dist/components/elements/Button/Button.stories.js +9 -9
- package/dist/components/elements/Button/Button.test.js +1 -1
- package/dist/components/elements/Button/index.d.ts +14 -14
- package/dist/components/elements/Button/index.js +4 -4
- package/dist/components/elements/ButtonV2/ButtonV2.stories.js +9 -9
- package/dist/components/elements/ButtonV2/ButtonV2.test.js +1 -1
- package/dist/components/elements/ButtonV2/index.d.ts +15 -15
- package/dist/components/elements/ButtonV2/index.js +2 -2
- package/dist/components/elements/CheckboxGroup/index.js +2 -2
- package/dist/components/elements/CheckboxGroupV2/index.js +2 -2
- package/dist/components/elements/ColumnV2/index.d.ts +2 -2
- package/dist/components/elements/ColumnV2/index.js +1 -1
- package/dist/components/elements/ConsentBanner/ConsentBanner.stories.js +1 -1
- package/dist/components/elements/ConsentBanner/index.js +4 -4
- package/dist/components/elements/DatePicker/DatePicker.stories.js +3 -3
- package/dist/components/elements/DatePicker/index.d.ts +3 -3
- package/dist/components/elements/DatePickerV2/DatePickerV2.stories.js +3 -3
- package/dist/components/elements/DatePickerV2/index.d.ts +3 -3
- package/dist/components/elements/Dropdown/Dropdown.stories.js +3 -3
- package/dist/components/elements/Dropdown/index.js +2 -2
- package/dist/components/elements/DropdownV2/DropdownV2.stories.js +3 -3
- package/dist/components/elements/DropdownV2/index.js +2 -2
- package/dist/components/elements/Group/index.js +1 -1
- package/dist/components/elements/GroupV2/index.js +1 -1
- package/dist/components/elements/Heading/Heading.stories.js +3 -3
- package/dist/components/elements/Heading/Heading.test.js +2 -2
- package/dist/components/elements/HeadingV2/HeadingV2.stories.js +3 -3
- package/dist/components/elements/HeadingV2/HeadingV2.test.js +2 -2
- package/dist/components/elements/Icon/Icon.stories.js +1 -1
- package/dist/components/elements/IconV2/IconV2.stories.js +1 -1
- package/dist/components/elements/Label/Label.stories.js +1 -1
- package/dist/components/elements/Label/Label.test.js +5 -5
- package/dist/components/elements/LabelV2/LabelV2.stories.js +1 -1
- package/dist/components/elements/LabelV2/LabelV2.test.js +5 -5
- package/dist/components/elements/Link/Link.stories.js +1 -1
- package/dist/components/elements/Link/Link.test.js +7 -7
- package/dist/components/elements/List/List.stories.js +5 -5
- package/dist/components/elements/List/List.test.js +2 -2
- package/dist/components/elements/List/index.js +5 -5
- package/dist/components/elements/ListBox/index.d.ts +2 -17
- package/dist/components/elements/ListBox/index.js +3 -3
- package/dist/components/elements/ListBoxV2/index.d.ts +2 -18
- package/dist/components/elements/ListBoxV2/index.js +2 -2
- package/dist/components/elements/ListV2/ListV2.stories.js +5 -5
- package/dist/components/elements/ListV2/index.js +5 -5
- package/dist/components/elements/Markdown/index.d.ts +0 -1
- package/dist/components/elements/Markdown/index.js +2 -2
- package/dist/components/elements/MarkdownV2/index.d.ts +0 -1
- package/dist/components/elements/MarkdownV2/index.js +2 -2
- package/dist/components/elements/MonthPicker/MonthPicker.stories.js +2 -2
- package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.js +2 -2
- package/dist/components/elements/Paragraph/Paragraph.stories.js +2 -2
- package/dist/components/elements/ParagraphV2/ParagraphV2.stories.js +2 -2
- package/dist/components/elements/Pill/Pill.stories.js +3 -3
- package/dist/components/elements/Pill/index.d.ts +6 -6
- package/dist/components/elements/Pill/index.js +2 -2
- package/dist/components/elements/PillV2/PillV2.stories.js +3 -3
- package/dist/components/elements/PillV2/index.d.ts +6 -6
- package/dist/components/elements/PillV2/index.js +1 -1
- package/dist/components/elements/RadioGroup/index.js +2 -2
- package/dist/components/elements/RadioGroupV2/index.js +2 -2
- package/dist/components/elements/RawHtml/index.d.ts +0 -1
- package/dist/components/elements/ReadMore/ReadMore.stories.js +4 -4
- package/dist/components/elements/ReadMore/index.js +3 -3
- package/dist/components/elements/ReadMoreV2/ReadMoreV2.stories.js +4 -4
- package/dist/components/elements/ReadMoreV2/index.js +3 -3
- package/dist/components/elements/RowV2/index.d.ts +4 -4
- package/dist/components/elements/RowV2/index.js +1 -1
- package/dist/components/elements/Select/Select.stories.js +3 -3
- package/dist/components/elements/Select/index.js +7 -7
- package/dist/components/elements/SelectV2/SelectV2.stories.js +3 -3
- package/dist/components/elements/SelectV2/index.js +4 -4
- package/dist/components/elements/Spinner/Spinner.stories.js +1 -1
- package/dist/components/elements/Spinner/index.d.ts +0 -1
- package/dist/components/elements/SpinnerV2/SpinnerV2.stories.js +1 -1
- package/dist/components/elements/SpinnerV2/index.d.ts +0 -1
- package/dist/components/elements/TabList/example.js +2 -2
- package/dist/components/elements/TabList/index.js +2 -2
- package/dist/components/elements/TabListV2/example.js +2 -2
- package/dist/components/elements/TabListV2/index.js +2 -2
- package/dist/components/elements/Table/Table.stories.js +18 -18
- package/dist/components/elements/Table/Table.test.js +1 -1
- package/dist/components/elements/Table/index.d.ts +0 -1
- package/dist/components/elements/Table/index.js +8 -8
- package/dist/components/elements/TextInput/TextInput.stories.js +4 -4
- package/dist/components/elements/TextInput/TextInput.test.js +2 -2
- package/dist/components/elements/TextInput/index.d.ts +10 -10
- package/dist/components/elements/TextInput/index.js +7 -7
- package/dist/components/elements/TextInputV2/TextInputV2.stories.js +4 -4
- package/dist/components/elements/TextInputV2/TextInputV2.test.js +1 -1
- package/dist/components/elements/TextInputV2/index.d.ts +11 -11
- package/dist/components/elements/TextInputV2/index.js +4 -4
- package/dist/components/elements/layout/Box.d.ts +2 -2
- package/dist/components/elements/layout/Box.stories.js +1 -1
- package/dist/components/elements/layout/Column.d.ts +2 -2
- package/dist/components/elements/layout/Column.js +1 -1
- package/dist/components/elements/layout/Flex.stories.js +4 -4
- package/dist/components/elements/layout/Flex.test.js +2 -2
- package/dist/components/elements/layout/Row.d.ts +3 -3
- package/dist/components/elements/layout/Row.js +1 -1
- package/dist/components/elements/option.d.ts +0 -1
- package/dist/components/providers/alerts.js +1 -1
- package/dist/components/providers/componentConfig.js +1 -1
- package/dist/components/providers/componentConfigV2.js +1 -1
- package/dist/components/providers/dialogs.js +2 -2
- package/dist/components/providers/env.js +2 -2
- package/dist/components/providers/media.js +2 -2
- package/dist/components/providers/mediaV2.js +2 -2
- package/dist/components/providers/menu.js +1 -1
- package/dist/components/providers/snackBar.d.ts +0 -1
- package/dist/components/providers/snackBar.js +2 -2
- package/dist/components/providers/ui.js +1 -1
- package/dist/components/providers/uiV2.js +1 -1
- package/dist/components/providers/uniqueIds.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/theme/Color.stories.js +1 -1
- package/dist/theme/Typography.stories.js +1 -1
- package/dist/theme/colors.d.ts +2 -2
- package/dist/theme/colors.js +4 -2
- package/dist/theme/css-variables.css +2 -2
- package/dist/theme/index.d.ts +7 -90
- package/dist/theme/index.js +2 -2
- package/dist/theme/typography.d.ts +1 -1
- package/dist/utils/test.js +2 -2
- package/package.json +5 -5
|
@@ -18,19 +18,19 @@ const sizes = [
|
|
|
18
18
|
{ size: HEADING_SIZE.SM, label: 'Small (Default Level 4-6)' },
|
|
19
19
|
];
|
|
20
20
|
export const Default = {
|
|
21
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsx(Group,
|
|
21
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsx(Group, { type: GROUP_TYPE.REGION, children: _jsx(Heading, { size: size.size, children: size.label }) }))) })),
|
|
22
22
|
args: {
|
|
23
23
|
children: 'Heading',
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
export const Color = {
|
|
27
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsx(Group,
|
|
27
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsx(Group, { type: GROUP_TYPE.REGION, children: _jsx(Heading, { size: size.size, sx: { color: COLOR.TEXT }, children: size.label }) }))) })),
|
|
28
28
|
args: {
|
|
29
29
|
children: 'Heading',
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
export const Underline = {
|
|
33
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsx(Group,
|
|
33
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsx(Group, { type: GROUP_TYPE.REGION, children: _jsx(Heading, { size: size.size, underline: true, children: size.label }) }))) })),
|
|
34
34
|
args: {
|
|
35
35
|
children: 'Heading',
|
|
36
36
|
},
|
|
@@ -26,7 +26,7 @@ describe('Heading', () => {
|
|
|
26
26
|
vi.useRealTimers();
|
|
27
27
|
});
|
|
28
28
|
it('renders without an error if passed standalone prop', () => {
|
|
29
|
-
const { getByText } = render(_jsx(Heading,
|
|
29
|
+
const { getByText } = render(_jsx(Heading, { standalone: true, children: "Foo" }));
|
|
30
30
|
expect(getByText('Foo')).toBeInTheDocument();
|
|
31
31
|
});
|
|
32
32
|
it('renders without an error if used within region Group component', () => {
|
|
@@ -37,7 +37,7 @@ describe('Heading', () => {
|
|
|
37
37
|
expect(() => render(_jsx(Heading, { children: "Foo" }))).toThrow();
|
|
38
38
|
}));
|
|
39
39
|
it('throws if used within non-region Group component', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
expect(() => render(_jsx(Group,
|
|
40
|
+
expect(() => render(_jsx(Group, { type: GROUP_TYPE.GROUP, children: _jsx(Heading, { children: "Foo" }) }))).toThrow();
|
|
41
41
|
}));
|
|
42
42
|
it('labels group target automatically', () => {
|
|
43
43
|
const { getByText } = render(_jsx(Group, { children: _jsx(Heading, { children: "Foo" }) }));
|
|
@@ -18,19 +18,19 @@ const sizes = [
|
|
|
18
18
|
{ size: HEADINGV2_SIZE.SM, label: 'Small (Default Level 4-6)' },
|
|
19
19
|
];
|
|
20
20
|
export const Default = {
|
|
21
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsx(GroupV2,
|
|
21
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsx(GroupV2, { type: GROUPV2_TYPE.REGION, children: _jsx(HeadingV2, { size: size.size, children: size.label }) }))) })),
|
|
22
22
|
args: {
|
|
23
23
|
children: 'Heading V2',
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
export const Color = {
|
|
27
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsx(GroupV2,
|
|
27
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsx(GroupV2, { type: GROUPV2_TYPE.REGION, children: _jsx(HeadingV2, { size: size.size, sx: { color: COLOR.TEXT }, children: size.label }) }))) })),
|
|
28
28
|
args: {
|
|
29
29
|
children: 'Heading V2',
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
export const Underline = {
|
|
33
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsx(GroupV2,
|
|
33
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsx(GroupV2, { type: GROUPV2_TYPE.REGION, children: _jsx(HeadingV2, { size: size.size, underline: true, children: size.label }) }))) })),
|
|
34
34
|
args: {
|
|
35
35
|
children: 'Heading V2',
|
|
36
36
|
},
|
|
@@ -26,7 +26,7 @@ describe('HeadingV2', () => {
|
|
|
26
26
|
vi.useRealTimers();
|
|
27
27
|
});
|
|
28
28
|
it('renders without an error if passed standalone prop', () => {
|
|
29
|
-
const { getByText } = render(_jsx(HeadingV2,
|
|
29
|
+
const { getByText } = render(_jsx(HeadingV2, { standalone: true, children: "Foo" }));
|
|
30
30
|
expect(getByText('Foo')).toBeInTheDocument();
|
|
31
31
|
});
|
|
32
32
|
it('renders without an error if used within region Group component', () => {
|
|
@@ -37,7 +37,7 @@ describe('HeadingV2', () => {
|
|
|
37
37
|
expect(() => render(_jsx(HeadingV2, { children: "Foo" }))).toThrow();
|
|
38
38
|
}));
|
|
39
39
|
it('throws if used within non-region Group component', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
expect(() => render(_jsx(GroupV2,
|
|
40
|
+
expect(() => render(_jsx(GroupV2, { type: GROUPV2_TYPE.GROUP, children: _jsx(HeadingV2, { children: "Foo" }) }))).toThrow();
|
|
41
41
|
}));
|
|
42
42
|
it('labels group target automatically', () => {
|
|
43
43
|
const { getByText } = render(_jsx(GroupV2, { children: _jsx(HeadingV2, { children: "Foo" }) }));
|
|
@@ -24,7 +24,7 @@ const sizes = [
|
|
|
24
24
|
{ size: FONT_SIZE.XS, label: 'X Small' },
|
|
25
25
|
];
|
|
26
26
|
export const Default = {
|
|
27
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group,
|
|
27
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { type: GROUP_TYPE.REGION, children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(Icon, { icon: AccessAlarmIcon, size: size.size })] }))) })),
|
|
28
28
|
};
|
|
29
29
|
export const CustomColor = {
|
|
30
30
|
render: () => (_jsx(Icon, { icon: AccessAlarmIcon, color: COLOR.SECONDARY, size: FONT_SIZE.LG })),
|
|
@@ -24,7 +24,7 @@ const sizes = [
|
|
|
24
24
|
{ size: FONT_SIZE.XS, label: 'X Small' },
|
|
25
25
|
];
|
|
26
26
|
export const Default = {
|
|
27
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
27
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(IconV2, { icon: AccessAlarmIcon, size: size.size })] }))) })),
|
|
28
28
|
};
|
|
29
29
|
export const CustomColor = {
|
|
30
30
|
render: () => (_jsx(IconV2, { icon: AccessAlarmIcon, color: COLOR.SECONDARY, size: FONT_SIZE.LG })),
|
|
@@ -15,7 +15,7 @@ const sizes = [
|
|
|
15
15
|
{ size: LABEL_SIZE.SM, label: 'Small' },
|
|
16
16
|
];
|
|
17
17
|
export const Default = {
|
|
18
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsx(Group,
|
|
18
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsx(Group, { type: GROUP_TYPE.GROUP, children: _jsx(Label, { size: size.size, children: size.label }) }))) })),
|
|
19
19
|
args: {
|
|
20
20
|
children: 'Label',
|
|
21
21
|
},
|
|
@@ -28,26 +28,26 @@ describe('Label', () => {
|
|
|
28
28
|
vi.useRealTimers();
|
|
29
29
|
});
|
|
30
30
|
it('renders without an error if passed standalone prop', () => {
|
|
31
|
-
const { getByText } = render(_jsx(Label,
|
|
31
|
+
const { getByText } = render(_jsx(Label, { standalone: true, children: "Foo" }));
|
|
32
32
|
expect(getByText('Foo')).toBeInTheDocument();
|
|
33
33
|
});
|
|
34
34
|
it('renders without an error if used within region Group component', () => {
|
|
35
|
-
const { getByText } = render(_jsx(Group,
|
|
35
|
+
const { getByText } = render(_jsx(Group, { type: GROUP_TYPE.GROUP, children: _jsx(Label, { children: "Foo" }) }));
|
|
36
36
|
expect(getByText('Foo')).toBeInTheDocument();
|
|
37
37
|
});
|
|
38
38
|
it('throws if used outside a Group component', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
39
|
expect(() => render(_jsx(Label, { children: "Foo" }))).toThrow();
|
|
40
40
|
}));
|
|
41
41
|
it('throws if used within non-group-type Group component', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
-
expect(() => render(_jsx(Group,
|
|
42
|
+
expect(() => render(_jsx(Group, { type: GROUP_TYPE.REGION, children: _jsx(Label, { children: "Foo" }) }))).toThrow();
|
|
43
43
|
}));
|
|
44
44
|
it('labels group target automatically', () => {
|
|
45
|
-
const { getByLabelText } = render(_jsx(Group,
|
|
45
|
+
const { getByLabelText } = render(_jsx(Group, { type: GROUP_TYPE.GROUP, children: _jsx(Label, { children: "Foo" }) }));
|
|
46
46
|
expect(getByLabelText('Foo')).toBeDefined();
|
|
47
47
|
});
|
|
48
48
|
it('can send focus to label target', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
49
|
const INPUT_TEST_ID = 'input-test-id';
|
|
50
|
-
const { getByText, getByTestId } = render(_jsx(Group,
|
|
50
|
+
const { getByText, getByTestId } = render(_jsx(Group, { type: GROUP_TYPE.GROUP, children: ({ labelTargetId }) => (_jsxs(_Fragment, { children: [_jsx(Label, { children: "Foo" }), _jsx("input", { id: labelTargetId, "data-testid": INPUT_TEST_ID })] })) }));
|
|
51
51
|
userEvent.click(getByText('Foo'));
|
|
52
52
|
yield waitFor(() => {
|
|
53
53
|
expect(getByTestId(INPUT_TEST_ID)).toHaveFocus();
|
|
@@ -15,7 +15,7 @@ const sizes = [
|
|
|
15
15
|
{ size: LABELV2_SIZE.SM, label: 'Small' },
|
|
16
16
|
];
|
|
17
17
|
export const Default = {
|
|
18
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsx(GroupV2,
|
|
18
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsx(GroupV2, { type: GROUPV2_TYPE.GROUP, children: _jsx(LabelV2, { size: size.size, children: size.label }) }))) })),
|
|
19
19
|
args: {
|
|
20
20
|
children: 'Label',
|
|
21
21
|
},
|
|
@@ -28,26 +28,26 @@ describe('LabelV2', () => {
|
|
|
28
28
|
vi.useRealTimers();
|
|
29
29
|
});
|
|
30
30
|
it('renders without an error if passed standalone prop', () => {
|
|
31
|
-
const { getByText } = render(_jsx(LabelV2,
|
|
31
|
+
const { getByText } = render(_jsx(LabelV2, { standalone: true, children: "Foo" }));
|
|
32
32
|
expect(getByText('Foo')).toBeInTheDocument();
|
|
33
33
|
});
|
|
34
34
|
it('renders without an error if used within region Group component', () => {
|
|
35
|
-
const { getByText } = render(_jsx(GroupV2,
|
|
35
|
+
const { getByText } = render(_jsx(GroupV2, { type: GROUPV2_TYPE.GROUP, children: _jsx(LabelV2, { children: "Foo" }) }));
|
|
36
36
|
expect(getByText('Foo')).toBeInTheDocument();
|
|
37
37
|
});
|
|
38
38
|
it('throws if used outside a Group component', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
39
|
expect(() => render(_jsx(LabelV2, { children: "Foo" }))).toThrow();
|
|
40
40
|
}));
|
|
41
41
|
it('throws if used within non-group-type Group component', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
-
expect(() => render(_jsx(GroupV2,
|
|
42
|
+
expect(() => render(_jsx(GroupV2, { type: GROUPV2_TYPE.REGION, children: _jsx(LabelV2, { children: "Foo" }) }))).toThrow();
|
|
43
43
|
}));
|
|
44
44
|
it('labels group target automatically', () => {
|
|
45
|
-
const { getByLabelText } = render(_jsx(GroupV2,
|
|
45
|
+
const { getByLabelText } = render(_jsx(GroupV2, { type: GROUPV2_TYPE.GROUP, children: _jsx(LabelV2, { children: "Foo" }) }));
|
|
46
46
|
expect(getByLabelText('Foo')).toBeDefined();
|
|
47
47
|
});
|
|
48
48
|
it('can send focus to label target', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
49
|
const INPUT_TEST_ID = 'input-test-id';
|
|
50
|
-
const { getByText, getByTestId } = render(_jsx(GroupV2,
|
|
50
|
+
const { getByText, getByTestId } = render(_jsx(GroupV2, { type: GROUPV2_TYPE.GROUP, children: ({ labelTargetId }) => (_jsxs(_Fragment, { children: [_jsx(LabelV2, { children: "Foo" }), _jsx("input", { id: labelTargetId, "data-testid": INPUT_TEST_ID })] })) }));
|
|
51
51
|
userEvent.click(getByText('Foo'));
|
|
52
52
|
yield waitFor(() => {
|
|
53
53
|
expect(getByTestId(INPUT_TEST_ID)).toHaveFocus();
|
|
@@ -16,7 +16,7 @@ const sizes = [
|
|
|
16
16
|
{ size: LINK_SIZE.SM, label: 'Small' },
|
|
17
17
|
];
|
|
18
18
|
export const Default = {
|
|
19
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading,
|
|
19
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(Link, { size: size.size, to: "/", children: "Click Me" })] }))) })),
|
|
20
20
|
args: {
|
|
21
21
|
children: 'Click Me',
|
|
22
22
|
},
|
|
@@ -12,15 +12,15 @@ const CustomExternalLink = (props) => {
|
|
|
12
12
|
};
|
|
13
13
|
describe('Link', () => {
|
|
14
14
|
it('renders default external link component without throwing', () => {
|
|
15
|
-
const { getByRole } = render(_jsx(Link,
|
|
15
|
+
const { getByRole } = render(_jsx(Link, { to: "https://google.com", children: "Foo" }));
|
|
16
16
|
expect(getByRole('link')).toBeInTheDocument();
|
|
17
17
|
});
|
|
18
18
|
it('renders default internal link component without throwing', () => {
|
|
19
|
-
const { getByRole } = render(_jsx(Link,
|
|
19
|
+
const { getByRole } = render(_jsx(Link, { to: "/test/path", children: "Foo" }));
|
|
20
20
|
expect(getByRole('link')).toBeInTheDocument();
|
|
21
21
|
});
|
|
22
22
|
it('renders custom external component if passed', () => {
|
|
23
|
-
const { getByTestId } = render(_jsx(Link,
|
|
23
|
+
const { getByTestId } = render(_jsx(Link, { to: "https://google.com", children: "Foo" }), {
|
|
24
24
|
components: {
|
|
25
25
|
link: {
|
|
26
26
|
externalLinkComponent: CustomExternalLink,
|
|
@@ -32,7 +32,7 @@ describe('Link', () => {
|
|
|
32
32
|
expect(() => getByTestId(CUSTOM_INTERNAL_TEST_ID)).toThrow();
|
|
33
33
|
});
|
|
34
34
|
it('renders custom internal component if passed', () => {
|
|
35
|
-
const { getByTestId } = render(_jsx(Link,
|
|
35
|
+
const { getByTestId } = render(_jsx(Link, { to: "/test/route", children: "Foo" }), {
|
|
36
36
|
components: {
|
|
37
37
|
link: {
|
|
38
38
|
externalLinkComponent: CustomExternalLink,
|
|
@@ -44,7 +44,7 @@ describe('Link', () => {
|
|
|
44
44
|
expect(() => getByTestId(CUSTOM_EXTERNAL_TEST_ID)).toThrow();
|
|
45
45
|
});
|
|
46
46
|
it('passes styles to custom component', () => {
|
|
47
|
-
const { getByTestId } = render(_jsxs(_Fragment, { children: [_jsx(Link,
|
|
47
|
+
const { getByTestId } = render(_jsxs(_Fragment, { children: [_jsx(Link, { to: "https://google.com", sx: { mt: 1 }, children: "Foo" }), _jsx(Link, { to: "/test/route", sx: { mt: 1 }, children: "Foo" })] }), {
|
|
48
48
|
components: {
|
|
49
49
|
link: {
|
|
50
50
|
externalLinkComponent: CustomExternalLink,
|
|
@@ -52,7 +52,7 @@ describe('Link', () => {
|
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
54
|
});
|
|
55
|
-
expect(getByTestId(CUSTOM_EXTERNAL_TEST_ID)).toHaveStyle(`margin-top:
|
|
56
|
-
expect(getByTestId(CUSTOM_INTERNAL_TEST_ID)).toHaveStyle(`margin-top:
|
|
55
|
+
expect(getByTestId(CUSTOM_EXTERNAL_TEST_ID)).toHaveStyle(`margin-top: 4px`);
|
|
56
|
+
expect(getByTestId(CUSTOM_INTERNAL_TEST_ID)).toHaveStyle(`margin-top: 4px`);
|
|
57
57
|
});
|
|
58
58
|
});
|
|
@@ -18,7 +18,7 @@ const meta = {
|
|
|
18
18
|
};
|
|
19
19
|
export default meta;
|
|
20
20
|
export const Default = {
|
|
21
|
-
render: () => (_jsx(Row, { children: _jsxs(List, { children: [_jsx(ListItem,
|
|
21
|
+
render: () => (_jsx(Row, { children: _jsxs(List, { children: [_jsx(ListItem, { index: 0, children: "List Item 1" }), _jsx(ListItem, { index: 1, children: "List Item 2" }), _jsxs(ListItem, { index: 2, children: ["List Item 3", _jsxs(List, { children: [_jsx(ListItem, { index: 0, children: "List Item 3.1" }), _jsx(ListItem, { index: 1, children: "List Item 3.2" })] })] })] }) })),
|
|
22
22
|
};
|
|
23
23
|
const sizes = [
|
|
24
24
|
{ size: LIST_SIZE.LG, label: 'Large' },
|
|
@@ -26,14 +26,14 @@ const sizes = [
|
|
|
26
26
|
{ size: LIST_SIZE.SM, label: 'Small' },
|
|
27
27
|
];
|
|
28
28
|
export const Sizes = {
|
|
29
|
-
render: () => (_jsx(Column, { children: sizes.map((size, i) => (_jsxs(Group,
|
|
29
|
+
render: () => (_jsx(Column, { children: sizes.map((size, i) => (_jsxs(Group, { type: GROUP_TYPE.REGION, sx: { mt: 3 }, children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(Row, { sx: { mt: 2 }, children: _jsxs(List, { size: size.size, children: [_jsx(ListItem, { index: 0, children: "List Item 1" }), _jsx(ListItem, { index: 1, children: "List Item 2" }), _jsx(ListItem, { index: 2, children: "List Item 3" })] }) })] }, i))) })),
|
|
30
30
|
};
|
|
31
31
|
export const Ordered = {
|
|
32
|
-
render: () => (_jsx(Row, { children: _jsxs(List,
|
|
32
|
+
render: () => (_jsx(Row, { children: _jsxs(List, { icon: ChevronRightIcon, ordered: true, children: [_jsx(ListItem, { index: 0, children: "List Item 1" }), _jsx(ListItem, { index: 1, children: "List Item 2" }), _jsx(ListItem, { index: 2, children: "List Item 3" })] }) })),
|
|
33
33
|
};
|
|
34
34
|
export const CustomIcon = {
|
|
35
|
-
render: () => (_jsx(Row, { children: _jsxs(List,
|
|
35
|
+
render: () => (_jsx(Row, { children: _jsxs(List, { icon: ChevronRightIcon, iconColor: COLOR.PRIMARY, children: [_jsx(ListItem, { index: 0, children: "List Item 1" }), _jsx(ListItem, { index: 1, children: "List Item 2" }), _jsx(ListItem, { index: 2, children: "List Item 3" })] }) })),
|
|
36
36
|
};
|
|
37
37
|
export const CustomIconPerItem = {
|
|
38
|
-
render: () => (_jsx(Row, { children: _jsxs(List,
|
|
38
|
+
render: () => (_jsx(Row, { children: _jsxs(List, { iconSize: FONT_SIZE.ML, children: [_jsx(ListItem, { index: 0, icon: BookmarkIcon, onIconClick: () => { }, iconLabel: "Unfavorite", children: "Favorite 1" }), _jsx(ListItem, { index: 1, icon: BookmarkIcon, onIconClick: () => { }, iconLabel: "Favorite", children: "Favorited 2" }), _jsx(ListItem, { index: 2, icon: BookmarkBorderIcon, onIconClick: () => { }, iconLabel: "Favorite", children: "Not Favorited" })] }) })),
|
|
39
39
|
};
|
|
@@ -13,12 +13,12 @@ import { List, ListItem } from '.';
|
|
|
13
13
|
const MockIcon = () => _jsx("div", { "data-testid": "mock-icon" });
|
|
14
14
|
describe('List', () => {
|
|
15
15
|
it('renders children inside list', () => {
|
|
16
|
-
const { getByRole, getAllByRole } = render(_jsxs(List, { children: [_jsx(ListItem,
|
|
16
|
+
const { getByRole, getAllByRole } = render(_jsxs(List, { children: [_jsx(ListItem, { index: 0, children: "Item 1" }), _jsx(ListItem, { index: 1, children: "Item 2" })] }));
|
|
17
17
|
expect(getByRole('list')).toBeDefined();
|
|
18
18
|
expect(getAllByRole('listitem')).toHaveLength(2);
|
|
19
19
|
});
|
|
20
20
|
it('renders custom component if provided', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
-
const { getAllByTestId } = render(_jsxs(List,
|
|
21
|
+
const { getAllByTestId } = render(_jsxs(List, { icon: MockIcon, children: [_jsx(ListItem, { index: 0, children: "Item 1" }), _jsx(ListItem, { index: 1, children: "Item 2" })] }));
|
|
22
22
|
expect(getAllByTestId('mock-icon')).toHaveLength(2);
|
|
23
23
|
}));
|
|
24
24
|
});
|
|
@@ -70,14 +70,14 @@ export const List = ({ sx, size: sizeParam, ordered, icon, iconSize: iconSizePar
|
|
|
70
70
|
const size = sizeParam || parentSize || LIST_SIZE.MD;
|
|
71
71
|
const iconSize = iconSizeParam || parentIconSize || iconSizeMap[size];
|
|
72
72
|
const iconColor = iconColorParam || parentIconColor || COLOR.TEXT;
|
|
73
|
-
return (_jsx(ListConfigContext.Provider,
|
|
73
|
+
return (_jsx(ListConfigContext.Provider, { value: {
|
|
74
74
|
size,
|
|
75
75
|
icon: icon || defaultIcon,
|
|
76
76
|
iconColor,
|
|
77
77
|
iconSize,
|
|
78
78
|
ordered: ordered || false,
|
|
79
79
|
depth,
|
|
80
|
-
}
|
|
80
|
+
}, children: ordered ? (_jsx("ul", { sx: Object.assign(Object.assign({}, defaultStyles), sx), children: children })) : (_jsx("ol", { sx: Object.assign(Object.assign({}, defaultStyles), sx), children: children })) }));
|
|
81
81
|
};
|
|
82
82
|
export const ListItem = (_a) => {
|
|
83
83
|
var { index, sx, icon: iconParam, iconSize: iconSizeParam, iconColor: iconColorParam, onIconClick, onClick, children, iconLabel, tabIndex: tabIndexParam } = _a, rest = __rest(_a, ["index", "sx", "icon", "iconSize", "iconColor", "onIconClick", "onClick", "children", "iconLabel", "tabIndex"]);
|
|
@@ -93,10 +93,10 @@ export const ListItem = (_a) => {
|
|
|
93
93
|
const typographyStyles = getTypographyStyles(sizeTypographyMap[size]);
|
|
94
94
|
const lineHeight = useLinesHeight({ typography, lines: 1 });
|
|
95
95
|
const tabIndex = tabIndexParam || (onClick ? 0 : undefined);
|
|
96
|
-
return (_jsxs("li", Object.assign({ sx: Object.assign(Object.assign({ depth, display: 'flex', mt: index === 0 && depth === 0 ? 0 : marginSizeMap[size], ml: 1 }, typographyStyles), sx), tabIndex: tabIndex }, rest, { children: [ordered ? (_jsxs(Label,
|
|
96
|
+
return (_jsxs("li", Object.assign({ sx: Object.assign(Object.assign({ depth, display: 'flex', mt: index === 0 && depth === 0 ? 0 : marginSizeMap[size], ml: 1 }, typographyStyles), sx), tabIndex: tabIndex }, rest, { children: [ordered ? (_jsxs(Label, { standalone: true, sx: { mr: 2 }, children: [index + 1, "."] })) : (_jsx(Column, { sx: { height: lineHeight }, justify: "center", children: _jsx(Icon, { icon: icon, color: iconColor, size: iconSize, onClick: onIconClick, "aria-label": iconLabel, sx: {
|
|
97
97
|
mr: 3,
|
|
98
98
|
alignItems: 'flex-start',
|
|
99
|
-
} }) }))
|
|
99
|
+
} }) })), _jsx("div", { sx: {
|
|
100
100
|
cursor: onClick ? 'pointer' : 'default',
|
|
101
|
-
}
|
|
101
|
+
}, children: children })] })));
|
|
102
102
|
};
|
|
@@ -12,22 +12,7 @@ type ListBoxProps<Value extends Key, Option extends BasicOption<Value>> = Styled
|
|
|
12
12
|
onSelect?: () => void;
|
|
13
13
|
onBlur?: () => void;
|
|
14
14
|
}>;
|
|
15
|
-
export declare const ListBox: <Value extends
|
|
16
|
-
|
|
17
|
-
children?: React.ReactNode;
|
|
18
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & {
|
|
19
|
-
options: Option[];
|
|
20
|
-
renderOption?: RenderOption<Value, Option> | undefined;
|
|
21
|
-
selected?: Value | undefined;
|
|
22
|
-
focused?: Value | undefined;
|
|
23
|
-
selectOption?: ((option: Option) => void) | undefined;
|
|
24
|
-
onDownPress?: (() => void) | undefined;
|
|
25
|
-
onUpPress?: (() => void) | undefined;
|
|
26
|
-
onSelect?: (() => void) | undefined;
|
|
27
|
-
onBlur?: (() => void) | undefined;
|
|
28
|
-
} & {
|
|
29
|
-
htmlFor?: string | undefined;
|
|
30
|
-
} & {
|
|
31
|
-
ref?: React.ForwardedRef<HTMLDivElement> | undefined;
|
|
15
|
+
export declare const ListBox: <Value extends Key = string, Option extends BasicOption<Value> = any>(props: ListBoxProps<Value, Option> & {
|
|
16
|
+
ref?: React.ForwardedRef<HTMLDivElement>;
|
|
32
17
|
}) => any;
|
|
33
18
|
export {};
|
|
@@ -20,7 +20,7 @@ function ListBoxInner(_a, ref) {
|
|
|
20
20
|
const typography = getTypographyStyles(TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM);
|
|
21
21
|
return (_jsx("div", Object.assign({ role: "listbox", ref: ref, sx: Object.assign(Object.assign({ border: 'solid 1px', borderRadius: '4px', borderColor: COLOR.LIGHT_GRAY, backgroundColor: COLOR.BACKGROUND, boxShadow: '0px 0px 8px 2px #dddddd' }, typography), sx), onKeyDown: (e) => {
|
|
22
22
|
console.log(e);
|
|
23
|
-
} }, rest, { children: options.map((option) => (_jsx("div",
|
|
23
|
+
} }, rest, { children: options.map((option) => (_jsx("div", { id: getOptionId(option.value), "aria-selected": selected === option.value, role: "option", onClick: option.onClick, onMouseDown: () => selectOption && selectOption(option), sx: {
|
|
24
24
|
px: 4,
|
|
25
25
|
py: 3,
|
|
26
26
|
backgroundColor: focused === option.value
|
|
@@ -42,10 +42,10 @@ function ListBoxInner(_a, ref) {
|
|
|
42
42
|
':hover': {
|
|
43
43
|
backgroundColor: COLOR.EXTRA_EXTRA_LIGHT_GRAY,
|
|
44
44
|
},
|
|
45
|
-
}
|
|
45
|
+
}, children: renderOption({
|
|
46
46
|
option,
|
|
47
47
|
selected: selected === option.value,
|
|
48
48
|
focused: focused === option.value,
|
|
49
|
-
}) }
|
|
49
|
+
}) }, option.value))) })));
|
|
50
50
|
}
|
|
51
51
|
export const ListBox = React.forwardRef(ListBoxInner);
|
|
@@ -13,23 +13,7 @@ type ListBoxV2Props<Value extends Key, Option extends BasicOption<Value>> = Styl
|
|
|
13
13
|
onSelect?: () => void;
|
|
14
14
|
onBlur?: () => void;
|
|
15
15
|
}>;
|
|
16
|
-
export declare const ListBoxV2: <Value extends
|
|
17
|
-
|
|
18
|
-
children?: React.ReactNode;
|
|
19
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & {
|
|
20
|
-
options: Option[];
|
|
21
|
-
className?: string | undefined;
|
|
22
|
-
renderOption?: RenderOption<Value, Option> | undefined;
|
|
23
|
-
selected?: Value | undefined;
|
|
24
|
-
focused?: Value | undefined;
|
|
25
|
-
selectOption?: ((option: Option) => void) | undefined;
|
|
26
|
-
onDownPress?: (() => void) | undefined;
|
|
27
|
-
onUpPress?: (() => void) | undefined;
|
|
28
|
-
onSelect?: (() => void) | undefined;
|
|
29
|
-
onBlur?: (() => void) | undefined;
|
|
30
|
-
} & {
|
|
31
|
-
htmlFor?: string | undefined;
|
|
32
|
-
} & {
|
|
33
|
-
ref?: React.ForwardedRef<HTMLDivElement> | undefined;
|
|
16
|
+
export declare const ListBoxV2: <Value extends Key = string, Option extends BasicOption<Value> = any>(props: ListBoxV2Props<Value, Option> & {
|
|
17
|
+
ref?: React.ForwardedRef<HTMLDivElement>;
|
|
34
18
|
}) => any;
|
|
35
19
|
export {};
|
|
@@ -18,11 +18,11 @@ import * as styles from './ListBoxV2.module.css';
|
|
|
18
18
|
import clsx from 'clsx';
|
|
19
19
|
const typeSafeStyles = styles;
|
|
20
20
|
function ListBoxOption({ option, selected, focused, selectOption, renderOption, }) {
|
|
21
|
-
return (_jsx("div",
|
|
21
|
+
return (_jsx("div", { id: getOptionId(option.value), "aria-selected": selected === option.value, role: "option", onClick: option.onClick, onMouseDown: () => selectOption && selectOption(option), className: typeSafeStyles.listBoxOption, children: renderOption({
|
|
22
22
|
option,
|
|
23
23
|
selected: selected === option.value,
|
|
24
24
|
focused: focused === option.value,
|
|
25
|
-
}) }
|
|
25
|
+
}) }, option.value));
|
|
26
26
|
}
|
|
27
27
|
function ListBoxInnerV2(_a, ref) {
|
|
28
28
|
var { options, renderOption: renderOptionParam, selected, focused, selectOption, className, sx, style } = _a, rest = __rest(_a, ["options", "renderOption", "selected", "focused", "selectOption", "className", "sx", "style"]);
|
|
@@ -18,7 +18,7 @@ const meta = {
|
|
|
18
18
|
};
|
|
19
19
|
export default meta;
|
|
20
20
|
export const Default = {
|
|
21
|
-
render: () => (_jsx(RowV2, { children: _jsxs(ListV2, { children: [_jsx(ListItemV2,
|
|
21
|
+
render: () => (_jsx(RowV2, { children: _jsxs(ListV2, { children: [_jsx(ListItemV2, { index: 0, children: "List Item 1" }), _jsx(ListItemV2, { index: 1, children: "List Item 2" }), _jsxs(ListItemV2, { index: 2, children: ["List Item 3", _jsxs(ListV2, { children: [_jsx(ListItemV2, { index: 0, children: "List Item 3.1" }), _jsx(ListItemV2, { index: 1, children: "List Item 3.2" })] })] })] }) })),
|
|
22
22
|
};
|
|
23
23
|
const sizes = [
|
|
24
24
|
{ size: LISTV2_SIZE.LG, label: 'Large' },
|
|
@@ -26,14 +26,14 @@ const sizes = [
|
|
|
26
26
|
{ size: LISTV2_SIZE.SM, label: 'Small' },
|
|
27
27
|
];
|
|
28
28
|
export const Sizes = {
|
|
29
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size, i) => (_jsxs(GroupV2,
|
|
29
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size, i) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, sx: { mt: 3 }, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(RowV2, { sx: { mt: 2 }, children: _jsxs(ListV2, { size: size.size, children: [_jsx(ListItemV2, { index: 0, children: "List Item 1" }), _jsx(ListItemV2, { index: 1, children: "List Item 2" }), _jsx(ListItemV2, { index: 2, children: "List Item 3" })] }) })] }, i))) })),
|
|
30
30
|
};
|
|
31
31
|
export const Ordered = {
|
|
32
|
-
render: () => (_jsx(RowV2, { children: _jsxs(ListV2,
|
|
32
|
+
render: () => (_jsx(RowV2, { children: _jsxs(ListV2, { icon: ChevronRightIcon, ordered: true, children: [_jsx(ListItemV2, { index: 0, children: "List Item 1" }), _jsx(ListItemV2, { index: 1, children: "List Item 2" }), _jsx(ListItemV2, { index: 2, children: "List Item 3" })] }) })),
|
|
33
33
|
};
|
|
34
34
|
export const CustomIcon = {
|
|
35
|
-
render: () => (_jsx(RowV2, { children: _jsxs(ListV2,
|
|
35
|
+
render: () => (_jsx(RowV2, { children: _jsxs(ListV2, { icon: ChevronRightIcon, iconColor: COLOR.PRIMARY, children: [_jsx(ListItemV2, { index: 0, children: "List Item 1" }), _jsx(ListItemV2, { index: 1, children: "List Item 2" }), _jsx(ListItemV2, { index: 2, children: "List Item 3" })] }) })),
|
|
36
36
|
};
|
|
37
37
|
export const CustomIconPerItem = {
|
|
38
|
-
render: () => (_jsx(RowV2, { children: _jsxs(ListV2,
|
|
38
|
+
render: () => (_jsx(RowV2, { children: _jsxs(ListV2, { iconSize: FONT_SIZE.ML, children: [_jsx(ListItemV2, { index: 0, icon: BookmarkIcon, onIconClick: () => { }, iconLabel: "Unfavorite", children: "Favorite 1" }), _jsx(ListItemV2, { index: 1, icon: BookmarkIcon, onIconClick: () => { }, iconLabel: "Favorite", children: "Favorited 2" }), _jsx(ListItemV2, { index: 2, icon: BookmarkBorderIcon, onIconClick: () => { }, iconLabel: "Favorite", children: "Not Favorited" })] }) })),
|
|
39
39
|
};
|
|
@@ -73,14 +73,14 @@ export const ListV2 = ({ sx, size: sizeParam, ordered, icon, iconSize: iconSizeP
|
|
|
73
73
|
const iconSize = iconSizeParam || parentIconSize || iconSizeMap[size];
|
|
74
74
|
const iconColor = iconColorParam || parentIconColor || COLOR.TEXT;
|
|
75
75
|
const processedStyles = processSx(Object.assign(Object.assign({}, defaultStyles), sx));
|
|
76
|
-
return (_jsx(ListConfigContext.Provider,
|
|
76
|
+
return (_jsx(ListConfigContext.Provider, { value: {
|
|
77
77
|
size,
|
|
78
78
|
icon: icon || defaultIcon,
|
|
79
79
|
iconColor,
|
|
80
80
|
iconSize,
|
|
81
81
|
ordered: ordered || false,
|
|
82
82
|
depth,
|
|
83
|
-
}
|
|
83
|
+
}, children: ordered ? (_jsx("ul", { style: processedStyles, children: children })) : (_jsx("ol", { style: processedStyles, children: children })) }));
|
|
84
84
|
};
|
|
85
85
|
export const ListItemV2 = (_a) => {
|
|
86
86
|
var { index, sx, icon: iconParam, iconSize: iconSizeParam, iconColor: iconColorParam, onIconClick, onClick, children, iconLabel, tabIndex: tabIndexParam } = _a, rest = __rest(_a, ["index", "sx", "icon", "iconSize", "iconColor", "onIconClick", "onClick", "children", "iconLabel", "tabIndex"]);
|
|
@@ -93,10 +93,10 @@ export const ListItemV2 = (_a) => {
|
|
|
93
93
|
const lineHeight = useLinesHeightV2({ typography, lines: 1 });
|
|
94
94
|
const tabIndex = tabIndexParam || (onClick ? 0 : undefined);
|
|
95
95
|
const processedStyles = processSx(Object.assign(Object.assign({}, sx), typographyStyles));
|
|
96
|
-
return (_jsxs("li", Object.assign({ style: Object.assign({ display: 'flex', marginTop: index === 0 && depth === 0 ? 0 : marginSizeMap[size], marginLeft: '0.25rem' }, processedStyles), tabIndex: tabIndex }, rest, { children: [ordered ? (_jsxs(LabelV2,
|
|
96
|
+
return (_jsxs("li", Object.assign({ style: Object.assign({ display: 'flex', marginTop: index === 0 && depth === 0 ? 0 : marginSizeMap[size], marginLeft: '0.25rem' }, processedStyles), tabIndex: tabIndex }, rest, { children: [ordered ? (_jsxs(LabelV2, { standalone: true, sx: { mr: 2 }, children: [index + 1, "."] })) : (_jsx(ColumnV2, { sx: { height: lineHeight }, justify: "center", children: _jsx(IconV2, { icon: icon, color: iconColor, size: iconSize, onClick: onIconClick, "aria-label": iconLabel, sx: {
|
|
97
97
|
mr: 3,
|
|
98
98
|
alignItems: 'flex-start',
|
|
99
|
-
} }) }))
|
|
99
|
+
} }) })), _jsx(BoxV2, { style: {
|
|
100
100
|
cursor: onClick ? 'pointer' : 'default',
|
|
101
|
-
}
|
|
101
|
+
}, children: children })] })));
|
|
102
102
|
};
|
|
@@ -98,7 +98,7 @@ export const Markdown = (_a) => {
|
|
|
98
98
|
.replace(/^-+/, '')
|
|
99
99
|
.replace(/-+$/, ''));
|
|
100
100
|
};
|
|
101
|
-
return (_jsx("div", Object.assign({}, rest, { children: _jsx(ReactMarkdown,
|
|
101
|
+
return (_jsx("div", Object.assign({}, rest, { children: _jsx(ReactMarkdown, { rehypePlugins: enableHtml ? [rehypeRaw, remarkGfm] : [remarkGfm], components: {
|
|
102
102
|
h1: (props) => (_jsx(Heading, Object.assign({ size: HEADING_SIZE.XL }, props, { level: props.level + headingLevelOffset, standalone: true, id: slugify(props.children.toString()), sx: Object.assign(Object.assign({}, dynamicTopMarginStyles), customStyles.h1) }))),
|
|
103
103
|
h2: (props) => (_jsx(Heading, Object.assign({ size: HEADING_SIZE.LG }, props, { level: props.level + headingLevelOffset, standalone: true, id: slugify(props.children.toString()), sx: Object.assign(Object.assign({}, dynamicTopMarginStyles), customStyles.h2) }))),
|
|
104
104
|
h3: (props) => (_jsx(Heading, Object.assign({ size: HEADING_SIZE.MD }, props, { level: props.level + headingLevelOffset, standalone: true, id: slugify(props.children.toString()), sx: Object.assign(Object.assign({}, dynamicTopMarginStyles), customStyles.h3) }))),
|
|
@@ -122,5 +122,5 @@ export const Markdown = (_a) => {
|
|
|
122
122
|
return _jsx("img", Object.assign({}, props, { style: styles, alt: alt }));
|
|
123
123
|
},
|
|
124
124
|
blockquote: (props) => (_jsx(BlockQuote, Object.assign({}, props, { sx: Object.assign(Object.assign(Object.assign({}, dynamicTopMarginStyles), { my: 5 }), customStyles.blockquote) }))),
|
|
125
|
-
}
|
|
125
|
+
}, children: sanitizedContent }) })));
|
|
126
126
|
};
|
|
@@ -95,7 +95,7 @@ export const MarkdownV2 = (_a) => {
|
|
|
95
95
|
.replace(/^-+/, '')
|
|
96
96
|
.replace(/-+$/, ''));
|
|
97
97
|
};
|
|
98
|
-
return (_jsx("div", Object.assign({ className: clsx(typeSafeStyles.markdownWrapper, className) }, rest, { children: _jsx(ReactMarkdown,
|
|
98
|
+
return (_jsx("div", Object.assign({ className: clsx(typeSafeStyles.markdownWrapper, className) }, rest, { children: _jsx(ReactMarkdown, { rehypePlugins: enableHtml ? [rehypeRaw, remarkGfm] : [remarkGfm], components: {
|
|
99
99
|
h1: (props) => (_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.XL }, props, { level: props.level + headingLevelOffset, standalone: true, id: slugify(props.children.toString()), sx: customStyles.h1 }))),
|
|
100
100
|
h2: (props) => (_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.LG }, props, { level: props.level + headingLevelOffset, standalone: true, id: slugify(props.children.toString()), sx: customStyles.h2 }))),
|
|
101
101
|
h3: (props) => (_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.MD }, props, { level: props.level + headingLevelOffset, standalone: true, id: slugify(props.children.toString()), sx: customStyles.h3 }))),
|
|
@@ -119,5 +119,5 @@ export const MarkdownV2 = (_a) => {
|
|
|
119
119
|
return _jsx("img", Object.assign({}, props, { style: styles, alt: alt }));
|
|
120
120
|
},
|
|
121
121
|
blockquote: (props) => (_jsx(BlockQuoteV2, Object.assign({}, props, { sx: Object.assign({ my: 5 }, customStyles.blockquote) }))),
|
|
122
|
-
}
|
|
122
|
+
}, children: sanitizedContent }) })));
|
|
123
123
|
};
|
|
@@ -15,7 +15,7 @@ const StatefulMonthPicker = (props) => {
|
|
|
15
15
|
return _jsx(MonthPicker, Object.assign({}, props, { value: date, onChange: setDate }));
|
|
16
16
|
};
|
|
17
17
|
export const Default = {
|
|
18
|
-
render: () => (_jsx(Box,
|
|
18
|
+
render: () => (_jsx(Box, { sx: { height: '500px' }, children: _jsx(StatefulMonthPicker, {}) })),
|
|
19
19
|
};
|
|
20
20
|
export const Inline = {
|
|
21
21
|
argTypes: {
|
|
@@ -28,6 +28,6 @@ export const Inline = {
|
|
|
28
28
|
},
|
|
29
29
|
render: (args) => {
|
|
30
30
|
const { backgroundColor } = args;
|
|
31
|
-
return (_jsx(Box,
|
|
31
|
+
return (_jsx(Box, { sx: { height: '500px' }, children: _jsx(StatefulMonthPicker, { backgroundColor: backgroundColor, inline: true }) }));
|
|
32
32
|
},
|
|
33
33
|
};
|
|
@@ -15,7 +15,7 @@ const StatefulMonthPickerV2 = (props) => {
|
|
|
15
15
|
return _jsx(MonthPickerV2, Object.assign({}, props, { value: date, onChange: setDate }));
|
|
16
16
|
};
|
|
17
17
|
export const Default = {
|
|
18
|
-
render: () => (_jsx(BoxV2,
|
|
18
|
+
render: () => (_jsx(BoxV2, { sx: { height: '500px' }, children: _jsx(StatefulMonthPickerV2, {}) })),
|
|
19
19
|
};
|
|
20
20
|
export const Inline = {
|
|
21
21
|
argTypes: {
|
|
@@ -28,6 +28,6 @@ export const Inline = {
|
|
|
28
28
|
},
|
|
29
29
|
render: (args) => {
|
|
30
30
|
const { backgroundColor } = args;
|
|
31
|
-
return (_jsx(BoxV2,
|
|
31
|
+
return (_jsx(BoxV2, { sx: { height: '500px' }, children: _jsx(StatefulMonthPickerV2, { backgroundColor: backgroundColor, inline: true }) }));
|
|
32
32
|
},
|
|
33
33
|
};
|