@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
|
@@ -23,7 +23,7 @@ const sizes = [
|
|
|
23
23
|
{ size: BUTTON_SIZE.SM, label: 'Small' },
|
|
24
24
|
];
|
|
25
25
|
export const Default = {
|
|
26
|
-
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group,
|
|
26
|
+
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { type: GROUP_TYPE.REGION, children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(Button, Object.assign({}, args, { size: size.size, sx: { mt: 1 } }))] }))) })),
|
|
27
27
|
args: {
|
|
28
28
|
type: BUTTON_TYPE.DEFAULT,
|
|
29
29
|
children: 'Click Me',
|
|
@@ -38,14 +38,14 @@ export const CustomColor = {
|
|
|
38
38
|
},
|
|
39
39
|
};
|
|
40
40
|
export const Link = {
|
|
41
|
-
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group,
|
|
41
|
+
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { type: GROUP_TYPE.REGION, children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(LinkButton, Object.assign({}, args, { sx: { mt: 1 } }))] }))) })),
|
|
42
42
|
args: {
|
|
43
43
|
type: BUTTON_TYPE.DEFAULT,
|
|
44
44
|
children: 'Click Me',
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
export const OutlineButton = {
|
|
48
|
-
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group,
|
|
48
|
+
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { type: GROUP_TYPE.REGION, children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(Button, Object.assign({}, args, { size: size.size, sx: { mt: 1 } }))] }))) })),
|
|
49
49
|
args: {
|
|
50
50
|
type: BUTTON_TYPE.OUTLINE,
|
|
51
51
|
children: 'Click Me',
|
|
@@ -53,7 +53,7 @@ export const OutlineButton = {
|
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
55
|
export const TextButton = {
|
|
56
|
-
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group,
|
|
56
|
+
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { type: GROUP_TYPE.REGION, children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(Button, Object.assign({}, args, { size: size.size, sx: { mt: 1 } }))] }))) })),
|
|
57
57
|
args: {
|
|
58
58
|
type: BUTTON_TYPE.TEXT,
|
|
59
59
|
onClick: () => { },
|
|
@@ -61,7 +61,7 @@ export const TextButton = {
|
|
|
61
61
|
},
|
|
62
62
|
};
|
|
63
63
|
export const IconButton = {
|
|
64
|
-
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group,
|
|
64
|
+
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { type: GROUP_TYPE.REGION, children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(Button, Object.assign({}, args, { size: size.size, sx: { mt: 1 }, primaryIcon: SettingsIcon }))] }))) })),
|
|
65
65
|
args: {
|
|
66
66
|
type: BUTTON_TYPE.TEXT,
|
|
67
67
|
children: 'Click Me',
|
|
@@ -69,22 +69,22 @@ export const IconButton = {
|
|
|
69
69
|
},
|
|
70
70
|
};
|
|
71
71
|
export const LeftIcon = {
|
|
72
|
-
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group,
|
|
72
|
+
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { type: GROUP_TYPE.REGION, children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(Button, Object.assign({}, args, { size: size.size, sx: { mt: 1 }, leftIcon: SearchIcon }))] }))) })),
|
|
73
73
|
args: {
|
|
74
74
|
onClick: () => { },
|
|
75
75
|
children: 'Search',
|
|
76
76
|
},
|
|
77
77
|
};
|
|
78
78
|
export const RightIcon = {
|
|
79
|
-
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group,
|
|
79
|
+
render: (args) => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { type: GROUP_TYPE.REGION, children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(Button, Object.assign({}, args, { size: size.size, sx: { mt: 1 }, rightIcon: ArrowDropDownIcon }))] }))) })),
|
|
80
80
|
args: {
|
|
81
81
|
onClick: () => { },
|
|
82
82
|
children: 'Select',
|
|
83
83
|
},
|
|
84
84
|
};
|
|
85
85
|
export const Loading = {
|
|
86
|
-
render: () => (_jsxs(Column, { children: [_jsx(Row, { children: _jsx(Button,
|
|
86
|
+
render: () => (_jsxs(Column, { children: [_jsx(Row, { children: _jsx(Button, { loading: true, children: "Click Me" }) }), _jsx(Row, { sx: { mt: 1 }, children: _jsx(Button, { type: BUTTON_TYPE.OUTLINE, loading: true, children: "Click Me" }) }), _jsx(Row, { sx: { mt: 1 }, children: _jsx(Button, { type: BUTTON_TYPE.TEXT, loading: true, children: "Click Me" }) })] })),
|
|
87
87
|
};
|
|
88
88
|
export const Disabled = {
|
|
89
|
-
render: () => (_jsxs(Column, { children: [_jsx(Row, { children: _jsx(Button,
|
|
89
|
+
render: () => (_jsxs(Column, { children: [_jsx(Row, { children: _jsx(Button, { disabled: true, children: "Click Me" }) }), _jsx(Row, { sx: { mt: 1 }, children: _jsx(Button, { type: BUTTON_TYPE.OUTLINE, disabled: true, children: "Click Me" }) }), _jsx(Row, { sx: { mt: 1 }, children: _jsx(Button, { type: BUTTON_TYPE.TEXT, disabled: true, children: "Click Me" }) })] })),
|
|
90
90
|
};
|
|
@@ -16,7 +16,7 @@ describe('Button', () => {
|
|
|
16
16
|
expect(getByText('Foo')).toBeInTheDocument();
|
|
17
17
|
});
|
|
18
18
|
it('renders icon component passed to it', () => {
|
|
19
|
-
const { getByText } = render(_jsxs(_Fragment, { children: [_jsx(Button,
|
|
19
|
+
const { getByText } = render(_jsxs(_Fragment, { children: [_jsx(Button, { leftIcon: MockLeftIcon, children: "Click Me" }), _jsx(Button, { primaryIcon: MockPrimaryIcon, children: "Click Me" }), _jsx(Button, { rightIcon: MockRightIcon, children: "Click Me" })] }));
|
|
20
20
|
expect(getByText('Mock Primary Icon')).toBeDefined();
|
|
21
21
|
expect(getByText('Mock Left Icon')).toBeDefined();
|
|
22
22
|
expect(getByText('Mock Right Icon')).toBeDefined();
|
|
@@ -26,23 +26,23 @@ export type ButtonProps = StyledElementProps<HTMLButtonElement, {
|
|
|
26
26
|
disableFocusStyles?: boolean;
|
|
27
27
|
}>;
|
|
28
28
|
export declare const Button: React.ForwardRefExoticComponent<{
|
|
29
|
-
sx?: import("../../../theme").StylesProp
|
|
29
|
+
sx?: import("../../../theme").StylesProp;
|
|
30
30
|
children?: React.ReactNode;
|
|
31
31
|
} & Omit<React.HTMLAttributes<HTMLButtonElement>, "children" | "onChange"> & {
|
|
32
|
-
size?: BUTTON_SIZE
|
|
33
|
-
type?: BUTTON_TYPE
|
|
34
|
-
color?: COLOR
|
|
35
|
-
textColor?: COLOR
|
|
36
|
-
customColor?: string
|
|
37
|
-
primaryIcon?: React.FC<any
|
|
38
|
-
leftIcon?: React.FC<any
|
|
39
|
-
rightIcon?: React.FC<any
|
|
40
|
-
accessibleLabel?: string
|
|
41
|
-
loading?: boolean
|
|
42
|
-
disabled?: boolean
|
|
43
|
-
disableFocusStyles?: boolean
|
|
32
|
+
size?: BUTTON_SIZE;
|
|
33
|
+
type?: BUTTON_TYPE;
|
|
34
|
+
color?: COLOR;
|
|
35
|
+
textColor?: COLOR;
|
|
36
|
+
customColor?: string;
|
|
37
|
+
primaryIcon?: React.FC<any>;
|
|
38
|
+
leftIcon?: React.FC<any>;
|
|
39
|
+
rightIcon?: React.FC<any>;
|
|
40
|
+
accessibleLabel?: string;
|
|
41
|
+
loading?: boolean;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
disableFocusStyles?: boolean;
|
|
44
44
|
} & {
|
|
45
|
-
htmlFor?: string
|
|
45
|
+
htmlFor?: string;
|
|
46
46
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
47
47
|
type LinkButtonProps = Omit<ButtonProps, 'type' | 'color' | 'textColor'>;
|
|
48
48
|
export declare const LinkButton: React.FC<LinkButtonProps>;
|
|
@@ -107,12 +107,12 @@ export const Button = React.forwardRef((_a, ref) => {
|
|
|
107
107
|
body = (_jsx(Icon, { icon: primaryIcon, size: getIconSize(typographyStyles.fontSize), color: textColor }));
|
|
108
108
|
}
|
|
109
109
|
if (loading) {
|
|
110
|
-
body = (_jsxs("div",
|
|
110
|
+
body = (_jsxs("div", { sx: {
|
|
111
111
|
position: 'relative',
|
|
112
112
|
display: 'flex',
|
|
113
113
|
alignItems: 'center',
|
|
114
114
|
justifyContent: 'center',
|
|
115
|
-
}
|
|
115
|
+
}, children: [_jsx(Spinner, { size: SPINNER_SIZE.SM, color: textColor, sx: { position: 'absolute' } }), _jsx("div", { sx: { visibility: 'hidden' }, children: body })] }));
|
|
116
116
|
}
|
|
117
117
|
const hoverStyles = !disabled
|
|
118
118
|
? {
|
|
@@ -123,14 +123,14 @@ export const Button = React.forwardRef((_a, ref) => {
|
|
|
123
123
|
: undefined;
|
|
124
124
|
return (_jsxs("button", Object.assign({ ref: ref, tabIndex: disabled ? -1 : 0, disabled: disabled, css: {
|
|
125
125
|
backgroundColor: customColor,
|
|
126
|
-
}, sx: Object.assign(Object.assign({ cursor, bg: customColor ? undefined : bg, color: textColor, px: paddingX, width: width, height: height, border: 'solid 1px', borderRadius: '4px', borderColor, display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', ':hover': !disableFocusStyles ? hoverStyles : {}, ':focus': !disableFocusStyles ? hoverStyles : {} }, typographyStyles), sx) }, rest, { children: [leftIcon && (_jsx(Icon, { icon: leftIcon, size: typographyStyles.fontSize, sx: { mr: iconMargin[size] }, color: textColor })), _jsx("div",
|
|
126
|
+
}, sx: Object.assign(Object.assign({ cursor, bg: customColor ? undefined : bg, color: textColor, px: paddingX, width: width, height: height, border: 'solid 1px', borderRadius: '4px', borderColor, display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', ':hover': !disableFocusStyles ? hoverStyles : {}, ':focus': !disableFocusStyles ? hoverStyles : {} }, typographyStyles), sx) }, rest, { children: [leftIcon && (_jsx(Icon, { icon: leftIcon, size: typographyStyles.fontSize, sx: { mr: iconMargin[size] }, color: textColor })), _jsx("div", { css: {
|
|
127
127
|
flexGrow: 1,
|
|
128
128
|
justifyContent: 'flex-start',
|
|
129
129
|
textOverflow: 'ellipsis',
|
|
130
130
|
whiteSpace: 'nowrap',
|
|
131
131
|
overflow: 'hidden',
|
|
132
132
|
textAlign: 'start',
|
|
133
|
-
}
|
|
133
|
+
}, children: body }), rightIcon && (_jsx(Icon, { icon: rightIcon, size: typographyStyles.fontSize, sx: { ml: iconMargin[size] }, color: textColor }))] })));
|
|
134
134
|
});
|
|
135
135
|
export const LinkButton = (props) => {
|
|
136
136
|
return (_jsx(Button, Object.assign({}, props, { color: COLOR.ND_BLUE_BRIGHT, textColor: COLOR.WHITE })));
|
|
@@ -23,7 +23,7 @@ const sizes = [
|
|
|
23
23
|
{ size: BUTTONV2_SIZE.SM, label: 'Small' },
|
|
24
24
|
];
|
|
25
25
|
export const Default = {
|
|
26
|
-
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
26
|
+
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(ButtonV2, Object.assign({}, args, { size: size.size, sx: { mt: 1 } }))] }))) })),
|
|
27
27
|
args: {
|
|
28
28
|
type: BUTTONV2_TYPE.DEFAULT,
|
|
29
29
|
children: 'Click Me',
|
|
@@ -38,14 +38,14 @@ export const CustomColor = {
|
|
|
38
38
|
},
|
|
39
39
|
};
|
|
40
40
|
export const Link = {
|
|
41
|
-
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
41
|
+
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(LinkButtonV2, Object.assign({}, args, { sx: { mt: 1 } }))] }))) })),
|
|
42
42
|
args: {
|
|
43
43
|
type: BUTTONV2_TYPE.DEFAULT,
|
|
44
44
|
children: 'Click Me',
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
export const OutlineButton = {
|
|
48
|
-
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
48
|
+
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(ButtonV2, Object.assign({}, args, { size: size.size, sx: { mt: 1 } }))] }))) })),
|
|
49
49
|
args: {
|
|
50
50
|
type: BUTTONV2_TYPE.OUTLINE,
|
|
51
51
|
children: 'Click Me',
|
|
@@ -53,7 +53,7 @@ export const OutlineButton = {
|
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
55
|
export const TextButton = {
|
|
56
|
-
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
56
|
+
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(ButtonV2, Object.assign({}, args, { size: size.size, sx: { mt: 1 } }))] }))) })),
|
|
57
57
|
args: {
|
|
58
58
|
type: BUTTONV2_TYPE.TEXT,
|
|
59
59
|
onClick: () => { },
|
|
@@ -61,7 +61,7 @@ export const TextButton = {
|
|
|
61
61
|
},
|
|
62
62
|
};
|
|
63
63
|
export const IconButton = {
|
|
64
|
-
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
64
|
+
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(ButtonV2, Object.assign({}, args, { size: size.size, sx: { mt: 1 }, primaryIcon: SettingsIcon }))] }))) })),
|
|
65
65
|
args: {
|
|
66
66
|
type: BUTTONV2_TYPE.TEXT,
|
|
67
67
|
children: 'Click Me',
|
|
@@ -69,22 +69,22 @@ export const IconButton = {
|
|
|
69
69
|
},
|
|
70
70
|
};
|
|
71
71
|
export const LeftIcon = {
|
|
72
|
-
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
72
|
+
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(ButtonV2, Object.assign({}, args, { size: size.size, sx: { mt: 1 }, leftIcon: SearchIcon }))] }))) })),
|
|
73
73
|
args: {
|
|
74
74
|
onClick: () => { },
|
|
75
75
|
children: 'Search',
|
|
76
76
|
},
|
|
77
77
|
};
|
|
78
78
|
export const RightIcon = {
|
|
79
|
-
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
79
|
+
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(ButtonV2, Object.assign({}, args, { size: size.size, sx: { mt: 1 }, rightIcon: ArrowDropDownIcon }))] }))) })),
|
|
80
80
|
args: {
|
|
81
81
|
onClick: () => { },
|
|
82
82
|
children: 'Select',
|
|
83
83
|
},
|
|
84
84
|
};
|
|
85
85
|
export const Loading = {
|
|
86
|
-
render: () => (_jsxs(ColumnV2, { children: [_jsx(RowV2, { children: _jsx(ButtonV2,
|
|
86
|
+
render: () => (_jsxs(ColumnV2, { children: [_jsx(RowV2, { children: _jsx(ButtonV2, { loading: true, children: "Click Me" }) }), _jsx(RowV2, { sx: { mt: 1 }, children: _jsx(ButtonV2, { type: BUTTONV2_TYPE.OUTLINE, loading: true, children: "Click Me" }) }), _jsx(RowV2, { sx: { mt: 1 }, children: _jsx(ButtonV2, { type: BUTTONV2_TYPE.TEXT, loading: true, children: "Click Me" }) })] })),
|
|
87
87
|
};
|
|
88
88
|
export const Disabled = {
|
|
89
|
-
render: () => (_jsxs(ColumnV2, { children: [_jsx(RowV2, { children: _jsx(ButtonV2,
|
|
89
|
+
render: () => (_jsxs(ColumnV2, { children: [_jsx(RowV2, { children: _jsx(ButtonV2, { disabled: true, children: "Click Me" }) }), _jsx(RowV2, { sx: { mt: 1 }, children: _jsx(ButtonV2, { type: BUTTONV2_TYPE.OUTLINE, disabled: true, children: "Click Me" }) }), _jsx(RowV2, { sx: { mt: 1 }, children: _jsx(ButtonV2, { type: BUTTONV2_TYPE.TEXT, disabled: true, children: "Click Me" }) })] })),
|
|
90
90
|
};
|
|
@@ -16,7 +16,7 @@ describe('Button', () => {
|
|
|
16
16
|
expect(getByText('Foo')).toBeInTheDocument();
|
|
17
17
|
});
|
|
18
18
|
it('renders icon component passed to it', () => {
|
|
19
|
-
const { getByText } = render(_jsxs(_Fragment, { children: [_jsx(ButtonV2,
|
|
19
|
+
const { getByText } = render(_jsxs(_Fragment, { children: [_jsx(ButtonV2, { leftIcon: MockLeftIcon, children: "Click Me" }), _jsx(ButtonV2, { primaryIcon: MockPrimaryIcon, children: "Click Me" }), _jsx(ButtonV2, { rightIcon: MockRightIcon, children: "Click Me" })] }));
|
|
20
20
|
expect(getByText('Mock Primary Icon')).toBeDefined();
|
|
21
21
|
expect(getByText('Mock Left Icon')).toBeDefined();
|
|
22
22
|
expect(getByText('Mock Right Icon')).toBeDefined();
|
|
@@ -27,24 +27,24 @@ export type ButtonV2Props = StyledElementPropsV2<HTMLButtonElement, {
|
|
|
27
27
|
className?: string;
|
|
28
28
|
}>;
|
|
29
29
|
export declare const ButtonV2: React.ForwardRefExoticComponent<{
|
|
30
|
-
sx?: import("../../../theme").StylesPropV2
|
|
30
|
+
sx?: import("../../../theme").StylesPropV2;
|
|
31
31
|
children?: React.ReactNode;
|
|
32
32
|
} & Omit<React.HTMLAttributes<HTMLButtonElement>, "children" | "onChange"> & {
|
|
33
|
-
size?: BUTTONV2_SIZE
|
|
34
|
-
type?: BUTTONV2_TYPE
|
|
35
|
-
color?: COLOR
|
|
36
|
-
textColor?: COLOR
|
|
37
|
-
customColor?: string
|
|
38
|
-
primaryIcon?: React.FC<any
|
|
39
|
-
leftIcon?: React.FC<any
|
|
40
|
-
rightIcon?: React.FC<any
|
|
41
|
-
accessibleLabel?: string
|
|
42
|
-
loading?: boolean
|
|
43
|
-
disabled?: boolean
|
|
44
|
-
disableFocusStyles?: boolean
|
|
45
|
-
className?: string
|
|
33
|
+
size?: BUTTONV2_SIZE;
|
|
34
|
+
type?: BUTTONV2_TYPE;
|
|
35
|
+
color?: COLOR;
|
|
36
|
+
textColor?: COLOR;
|
|
37
|
+
customColor?: string;
|
|
38
|
+
primaryIcon?: React.FC<any>;
|
|
39
|
+
leftIcon?: React.FC<any>;
|
|
40
|
+
rightIcon?: React.FC<any>;
|
|
41
|
+
accessibleLabel?: string;
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
disableFocusStyles?: boolean;
|
|
45
|
+
className?: string;
|
|
46
46
|
} & {
|
|
47
|
-
htmlFor?: string
|
|
47
|
+
htmlFor?: string;
|
|
48
48
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
49
49
|
type LinkButtonV2Props = Omit<ButtonV2Props, 'type' | 'color' | 'textColor'>;
|
|
50
50
|
export declare const LinkButtonV2: React.FC<LinkButtonV2Props>;
|
|
@@ -115,7 +115,7 @@ export const ButtonV2 = React.forwardRef((_a, ref) => {
|
|
|
115
115
|
body = (_jsx(IconV2, { icon: primaryIcon, size: getIconSize(typographyStyles.fontSize), color: textColor }));
|
|
116
116
|
}
|
|
117
117
|
if (loading) {
|
|
118
|
-
body = (_jsxs("div",
|
|
118
|
+
body = (_jsxs("div", { className: typeSafeStyles.spinnerWrapper, children: [_jsx(SpinnerV2, { size: SPINNERV2_SIZE.SM, color: textColor, sx: { position: 'absolute' } }), _jsx("div", { style: { visibility: 'hidden' }, children: body })] }));
|
|
119
119
|
}
|
|
120
120
|
const processedStyles = processSx(Object.assign(Object.assign({ bg: customColor ? customColor : bg }, typographyStyles), sx));
|
|
121
121
|
const hoverStyles = !disabled
|
|
@@ -130,7 +130,7 @@ export const ButtonV2 = React.forwardRef((_a, ref) => {
|
|
|
130
130
|
return (_jsxs("button", Object.assign({}, anchorElementProps, { ref: ref, tabIndex: disabled ? -1 : 0, disabled: disabled, className: clsx(typeSafeStyles.button, className), style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ cursor }, processSx({
|
|
131
131
|
color: textColor,
|
|
132
132
|
borderColor,
|
|
133
|
-
})), { paddingLeft: paddingX, paddingRight: paddingX, width: width, height: height }), appliedHoverStyles), appliedFocusStyles), processedStyles) }, rest, { children: [leftIcon && (_jsx(IconV2, { icon: leftIcon, size: typographyStyles.fontSize, sx: { mr: iconMargin[size] }, color: textColor })), _jsx("div",
|
|
133
|
+
})), { paddingLeft: paddingX, paddingRight: paddingX, width: width, height: height }), appliedHoverStyles), appliedFocusStyles), processedStyles) }, rest, { children: [leftIcon && (_jsx(IconV2, { icon: leftIcon, size: typographyStyles.fontSize, sx: { mr: iconMargin[size] }, color: textColor })), _jsx("div", { className: typeSafeStyles.bodyWrapper, children: body }), rightIcon && (_jsx(IconV2, { icon: rightIcon, size: typographyStyles.fontSize, sx: { ml: iconMargin[size] }, color: textColor }))] })));
|
|
134
134
|
});
|
|
135
135
|
export const LinkButtonV2 = (props) => {
|
|
136
136
|
return (_jsx(ButtonV2, Object.assign({}, props, { color: COLOR.ND_BLUE_BRIGHT, textColor: COLOR.WHITE })));
|
|
@@ -34,7 +34,7 @@ export function CheckboxGroup(_a) {
|
|
|
34
34
|
}
|
|
35
35
|
return optionsByColumn;
|
|
36
36
|
}, [options, columns]);
|
|
37
|
-
return (_jsx(Row, Object.assign({}, rest, { children: optionsByColumn.map((options, index) => (_jsx(Column,
|
|
37
|
+
return (_jsx(Row, Object.assign({}, rest, { children: optionsByColumn.map((options, index) => (_jsx(Column, { grow: 1, sx: Object.assign({ mr: 4 }, columnStyles), children: options.map((option) => (_jsx(Group, { type: GROUP_TYPE.RAW, children: ({ labelTargetId }) => (_jsxs(Row, { sx: Object.assign({ mb: 2, alignItems: 'center' }, rowStyles), children: [_jsx(Checkbox, { onChange: (checked) => {
|
|
38
38
|
const updatedSet = new Set(checkedOptions || []);
|
|
39
39
|
if (checked) {
|
|
40
40
|
updatedSet.add(option.value);
|
|
@@ -46,5 +46,5 @@ export function CheckboxGroup(_a) {
|
|
|
46
46
|
}, checked: !!(checkedOptions === null || checkedOptions === void 0 ? void 0 : checkedOptions.has(option.value)), id: labelTargetId, disabled: option.disabled, sx: {
|
|
47
47
|
mr: 2,
|
|
48
48
|
flexShrink: 0,
|
|
49
|
-
} }), _jsx(Label,
|
|
49
|
+
} }), _jsx(Label, { sx: Object.assign(Object.assign({ cursor: option.disabled ? 'not-allowed' : 'pointer' }, getTypographyStyles(TYPOGRAPHY_TYPE.CONDENSED_TEXT_MEDIUM)), { color: option.disabled ? COLOR.GRAY : undefined }), children: option.label })] })) }, option.value))) }, index))) })));
|
|
50
50
|
}
|
|
@@ -34,7 +34,7 @@ export function CheckboxGroupV2(_a) {
|
|
|
34
34
|
}
|
|
35
35
|
return optionsByColumn;
|
|
36
36
|
}, [options, columns]);
|
|
37
|
-
return (_jsx(RowV2, Object.assign({}, rest, { children: optionsByColumn.map((options, index) => (_jsx(ColumnV2,
|
|
37
|
+
return (_jsx(RowV2, Object.assign({}, rest, { children: optionsByColumn.map((options, index) => (_jsx(ColumnV2, { grow: 1, sx: Object.assign({ mr: 4 }, columnStyles), children: options.map((option) => (_jsx(GroupV2, { type: GROUPV2_TYPE.RAW, children: ({ labelTargetId }) => (_jsxs(RowV2, { sx: Object.assign({ mb: 2, alignItems: 'center' }, rowStyles), children: [_jsx(CheckboxV2, { onChange: (checked) => {
|
|
38
38
|
const updatedSet = new Set(checkedOptions || []);
|
|
39
39
|
if (checked) {
|
|
40
40
|
updatedSet.add(option.value);
|
|
@@ -46,5 +46,5 @@ export function CheckboxGroupV2(_a) {
|
|
|
46
46
|
}, checked: !!(checkedOptions === null || checkedOptions === void 0 ? void 0 : checkedOptions.has(option.value)), id: labelTargetId, disabled: option.disabled, sx: {
|
|
47
47
|
mr: 2,
|
|
48
48
|
flexShrink: 0,
|
|
49
|
-
} }), _jsx(LabelV2,
|
|
49
|
+
} }), _jsx(LabelV2, { sx: Object.assign(Object.assign({ cursor: option.disabled ? 'not-allowed' : 'pointer' }, getTypographyStyles(TYPOGRAPHY_TYPE.CONDENSED_TEXT_MEDIUM)), { color: option.disabled ? COLOR.GRAY : undefined }), children: option.label })] })) }, option.value))) }, index))) })));
|
|
50
50
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FlexHelperPropsV2 } from '../RowV2';
|
|
3
3
|
export declare const ColumnV2: React.ForwardRefExoticComponent<{
|
|
4
|
-
sx?: import("../../../theme").StylesPropV2
|
|
4
|
+
sx?: import("../../../theme").StylesPropV2;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & FlexHelperPropsV2 & {
|
|
7
|
-
htmlFor?: string
|
|
7
|
+
htmlFor?: string;
|
|
8
8
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -17,5 +17,5 @@ export const ColumnV2 = React.forwardRef((_a, ref) => {
|
|
|
17
17
|
var { sx, children } = _a, rest = __rest(_a, ["sx", "children"]);
|
|
18
18
|
const flexStyles = convertFlexHelperPropsV2(rest);
|
|
19
19
|
const processedStyles = processSx(sx);
|
|
20
|
-
return (_jsx("div", Object.assign({ ref: ref }, rest, { style: Object.assign(Object.assign(Object.assign({}, flexStyles), processedStyles), { display: 'flex', flexDirection: 'column' })
|
|
20
|
+
return (_jsx("div", Object.assign({ ref: ref }, rest, { style: Object.assign(Object.assign(Object.assign({}, flexStyles), processedStyles), { display: 'flex', flexDirection: 'column' }), children: children })));
|
|
21
21
|
});
|
|
@@ -45,7 +45,7 @@ const meta = {
|
|
|
45
45
|
padding: 16,
|
|
46
46
|
position: 'relative',
|
|
47
47
|
};
|
|
48
|
-
return (_jsxs("div",
|
|
48
|
+
return (_jsxs("div", { style: containerStyle, children: [_jsx("p", { style: { marginTop: 0 }, children: "The banner (if shown) is fixed to the bottom of the viewport." }), _jsx(Story, {})] }));
|
|
49
49
|
},
|
|
50
50
|
],
|
|
51
51
|
parameters: {
|
|
@@ -174,13 +174,13 @@ export const ConsentBanner = ({ clarityProjectId, countryCode = null, autoDetect
|
|
|
174
174
|
};
|
|
175
175
|
if (!shouldShow)
|
|
176
176
|
return null;
|
|
177
|
-
return (_jsxs("div",
|
|
177
|
+
return (_jsxs("div", { role: "dialog", "aria-live": "polite", "aria-label": "Consent for analytics", className: className, style: Object.assign({ position: 'fixed', bottom: 0, left: 0, right: 0, zIndex: 99999, display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '0.75rem', padding: '0.9rem 1rem', background: 'rgba(17, 24, 39, 0.98)', color: 'white', boxShadow: '0 -6px 24px rgba(0,0,0,0.25)', flexWrap: 'wrap' }, style), children: [_jsx("p", { style: {
|
|
178
178
|
fontFamily: 'Arial, sans-serif',
|
|
179
179
|
textAlign: 'center',
|
|
180
180
|
margin: 0,
|
|
181
181
|
lineHeight: 1.4,
|
|
182
182
|
flex: '1 1 420px',
|
|
183
|
-
}
|
|
183
|
+
}, children: "We use Microsoft Clarity to improve our site. Do you consent to analytics cookies?" }), _jsxs("div", { style: { display: 'flex', gap: '0.5rem', flexShrink: 0 }, children: [_jsx("button", { onClick: handleDeny, type: "button", style: {
|
|
184
184
|
border: '1px solid rgba(255,255,255,0.65)',
|
|
185
185
|
background: 'transparent',
|
|
186
186
|
color: 'white',
|
|
@@ -188,7 +188,7 @@ export const ConsentBanner = ({ clarityProjectId, countryCode = null, autoDetect
|
|
|
188
188
|
borderRadius: 8,
|
|
189
189
|
cursor: 'pointer',
|
|
190
190
|
fontWeight: 600,
|
|
191
|
-
}
|
|
191
|
+
}, children: "Deny" }), _jsx("button", { onClick: handleAccept, type: "button", style: {
|
|
192
192
|
border: 'none',
|
|
193
193
|
background: 'white',
|
|
194
194
|
color: '#111827',
|
|
@@ -196,6 +196,6 @@ export const ConsentBanner = ({ clarityProjectId, countryCode = null, autoDetect
|
|
|
196
196
|
borderRadius: 8,
|
|
197
197
|
cursor: 'pointer',
|
|
198
198
|
fontWeight: 700,
|
|
199
|
-
}
|
|
199
|
+
}, children: "Accept" })] })] }));
|
|
200
200
|
};
|
|
201
201
|
export default ConsentBanner;
|
|
@@ -17,7 +17,7 @@ const StatefulDatePicker = (props) => {
|
|
|
17
17
|
} })));
|
|
18
18
|
};
|
|
19
19
|
export const Default = {
|
|
20
|
-
render: () => (_jsx(Box,
|
|
20
|
+
render: () => (_jsx(Box, { sx: { height: '500px' }, children: _jsx(StatefulDatePicker, { placeholder: "test" }) })),
|
|
21
21
|
};
|
|
22
22
|
export const Inline = {
|
|
23
23
|
argTypes: {
|
|
@@ -30,7 +30,7 @@ export const Inline = {
|
|
|
30
30
|
},
|
|
31
31
|
render: (args) => {
|
|
32
32
|
const { backgroundColor } = args;
|
|
33
|
-
return (_jsx(Box,
|
|
33
|
+
return (_jsx(Box, { sx: { height: '500px' }, children: _jsx(StatefulDatePicker, { backgroundColor: backgroundColor, inline: true }) }));
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
export const HighlightedDates = {
|
|
@@ -48,6 +48,6 @@ export const HighlightedDates = {
|
|
|
48
48
|
highlightedDate1.setDate(highlightedDate1.getDate() + 1);
|
|
49
49
|
const highlightedDate2 = new Date();
|
|
50
50
|
highlightedDate2.setDate(highlightedDate2.getDate() - 1);
|
|
51
|
-
return (_jsx(Box,
|
|
51
|
+
return (_jsx(Box, { sx: { height: '500px' }, children: _jsx(StatefulDatePicker, { inline: true, backgroundColor: backgroundColor, highlightDates: [highlightedDate1, highlightedDate2] }) }));
|
|
52
52
|
},
|
|
53
53
|
};
|
|
@@ -3,9 +3,9 @@ import 'react-datepicker/dist/react-datepicker.css';
|
|
|
3
3
|
import { TextInputProps } from '../TextInput';
|
|
4
4
|
import { BoxProps } from '../layout/Box';
|
|
5
5
|
export declare const InputWrapper: React.ForwardRefExoticComponent<{
|
|
6
|
-
onChange?: (
|
|
7
|
-
onClick?: (
|
|
8
|
-
value?: string
|
|
6
|
+
onChange?: (e: React.ChangeEvent) => void;
|
|
7
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
8
|
+
value?: string;
|
|
9
9
|
children: React.ReactElement;
|
|
10
10
|
} & React.RefAttributes<any>>;
|
|
11
11
|
export declare const areDatesEqual: (d1: Date, d2: Date) => boolean;
|
|
@@ -17,7 +17,7 @@ const StatefulDatePickerV2 = (props) => {
|
|
|
17
17
|
} })));
|
|
18
18
|
};
|
|
19
19
|
export const Default = {
|
|
20
|
-
render: () => (_jsx(BoxV2,
|
|
20
|
+
render: () => (_jsx(BoxV2, { sx: { height: '500px' }, children: _jsx(StatefulDatePickerV2, { placeholder: "test" }) })),
|
|
21
21
|
};
|
|
22
22
|
export const Inline = {
|
|
23
23
|
argTypes: {
|
|
@@ -30,7 +30,7 @@ export const Inline = {
|
|
|
30
30
|
},
|
|
31
31
|
render: (args) => {
|
|
32
32
|
const { backgroundColor } = args;
|
|
33
|
-
return (_jsx(BoxV2,
|
|
33
|
+
return (_jsx(BoxV2, { sx: { height: '500px' }, children: _jsx(StatefulDatePickerV2, { backgroundColor: backgroundColor, inline: true }) }));
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
export const HighlightedDates = {
|
|
@@ -48,6 +48,6 @@ export const HighlightedDates = {
|
|
|
48
48
|
highlightedDate1.setDate(highlightedDate1.getDate() + 1);
|
|
49
49
|
const highlightedDate2 = new Date();
|
|
50
50
|
highlightedDate2.setDate(highlightedDate2.getDate() - 1);
|
|
51
|
-
return (_jsx(BoxV2,
|
|
51
|
+
return (_jsx(BoxV2, { sx: { height: '500px' }, children: _jsx(StatefulDatePickerV2, { inline: true, backgroundColor: backgroundColor, highlightDates: [highlightedDate1, highlightedDate2] }) }));
|
|
52
52
|
},
|
|
53
53
|
};
|
|
@@ -3,9 +3,9 @@ import 'react-datepicker/dist/react-datepicker.css';
|
|
|
3
3
|
import { TextInputV2Props } from '../TextInputV2';
|
|
4
4
|
import { BoxV2Props } from '../BoxV2';
|
|
5
5
|
export declare const InputWrapperV2: React.ForwardRefExoticComponent<{
|
|
6
|
-
onChange?: (
|
|
7
|
-
onClick?: (
|
|
8
|
-
value?: string
|
|
6
|
+
onChange?: (e: React.ChangeEvent) => void;
|
|
7
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
8
|
+
value?: string;
|
|
9
9
|
children: React.ReactElement;
|
|
10
10
|
} & React.RefAttributes<any>>;
|
|
11
11
|
export declare const areDatesEqual: (d1: Date, d2: Date) => boolean;
|
|
@@ -16,11 +16,11 @@ export default meta;
|
|
|
16
16
|
const lorem = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
17
17
|
Nullam id nunc vitae magna aliquam aliquet. In hac habitasse platea dictumst.`;
|
|
18
18
|
export const Default = {
|
|
19
|
-
render: () => (_jsx(Box,
|
|
19
|
+
render: () => (_jsx(Box, { sx: { width: '200px', height: '200px' }, children: _jsx(Dropdown, { renderAnchor: ({ anchorProps }) => (_jsx(Button, Object.assign({}, anchorProps, { rightIcon: ArrowDropDownIcon, children: "Open Dropdown" }))), renderDropdown: () => _jsx(Paragraph, { children: lorem }) }) })),
|
|
20
20
|
};
|
|
21
21
|
export const MatchWidth = {
|
|
22
|
-
render: () => (_jsx(Box,
|
|
22
|
+
render: () => (_jsx(Box, { sx: { width: '200px', height: '200px' }, children: _jsx(Dropdown, { matchWidth: true, renderAnchor: ({ anchorProps }) => (_jsx(Button, Object.assign({}, anchorProps, { rightIcon: ArrowDropDownIcon, children: "Open Dropdown" }))), renderDropdown: () => _jsx(Paragraph, { children: lorem }) }) })),
|
|
23
23
|
};
|
|
24
24
|
export const ForcePlacement = {
|
|
25
|
-
render: () => (_jsx(Column,
|
|
25
|
+
render: () => (_jsx(Column, { sx: { width: '200x', height: '100vh' }, justify: "flex-end", children: _jsx(Dropdown, { allowedPlacements: ['bottom-start'], renderAnchor: ({ anchorProps }) => (_jsx(Button, Object.assign({}, anchorProps, { rightIcon: ArrowDropDownIcon, children: "Open Dropdown" }))), renderDropdown: () => _jsx(Paragraph, { children: lorem }) }) })),
|
|
26
26
|
};
|
|
@@ -66,13 +66,13 @@ export const Dropdown = (_a) => {
|
|
|
66
66
|
anchorProps: dropdownAnchorProps,
|
|
67
67
|
isOpen,
|
|
68
68
|
setIsOpen,
|
|
69
|
-
}), isOpen && (_jsxs(_Fragment, { children: [shouldRenderDropdownContainer ? (_jsx(Box,
|
|
69
|
+
}), isOpen && (_jsxs(_Fragment, { children: [shouldRenderDropdownContainer ? (_jsx(Box, { id: dropdownId, ref: refs.setFloating, style: dropdownBoxStyles, children: renderDropdown({
|
|
70
70
|
styles: dropdownBoxStyles,
|
|
71
71
|
ref: refs.setFloating,
|
|
72
72
|
setIsOpen,
|
|
73
73
|
isOpen,
|
|
74
74
|
id: dropdownId,
|
|
75
|
-
}) }))
|
|
75
|
+
}) })) : (renderDropdown({
|
|
76
76
|
styles: dropdownBoxStyles,
|
|
77
77
|
ref: refs.setFloating,
|
|
78
78
|
isOpen,
|
|
@@ -16,11 +16,11 @@ export default meta;
|
|
|
16
16
|
const lorem = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
17
17
|
Nullam id nunc vitae magna aliquam aliquet. In hac habitasse platea dictumst.`;
|
|
18
18
|
export const Default = {
|
|
19
|
-
render: () => (_jsx(BoxV2,
|
|
19
|
+
render: () => (_jsx(BoxV2, { sx: { width: '200px', height: '200px' }, children: _jsx(DropdownV2, { renderAnchor: ({ anchorProps }) => (_jsx(ButtonV2, Object.assign({}, anchorProps, { rightIcon: ArrowDropDownIcon, children: "Open Dropdown" }))), renderDropdown: () => _jsx(ParagraphV2, { children: lorem }) }) })),
|
|
20
20
|
};
|
|
21
21
|
export const MatchWidth = {
|
|
22
|
-
render: () => (_jsx(BoxV2,
|
|
22
|
+
render: () => (_jsx(BoxV2, { sx: { width: '200px', height: '200px' }, children: _jsx(DropdownV2, { matchWidth: true, renderAnchor: ({ anchorProps }) => (_jsx(ButtonV2, Object.assign({}, anchorProps, { rightIcon: ArrowDropDownIcon, children: "Open Dropdown" }))), renderDropdown: () => _jsx(ParagraphV2, { children: lorem }) }) })),
|
|
23
23
|
};
|
|
24
24
|
export const ForcePlacement = {
|
|
25
|
-
render: () => (_jsx(ColumnV2,
|
|
25
|
+
render: () => (_jsx(ColumnV2, { sx: { width: '200x', height: '100vh' }, justify: "flex-end", children: _jsx(DropdownV2, { allowedPlacements: ['bottom-start'], renderAnchor: ({ anchorProps }) => (_jsx(ButtonV2, Object.assign({}, anchorProps, { rightIcon: ArrowDropDownIcon, children: "Open Dropdown" }))), renderDropdown: () => _jsx(ParagraphV2, { children: lorem }) }) })),
|
|
26
26
|
};
|
|
@@ -65,13 +65,13 @@ export const DropdownV2 = (_a) => {
|
|
|
65
65
|
anchorProps: dropdownAnchorProps,
|
|
66
66
|
isOpen,
|
|
67
67
|
setIsOpen,
|
|
68
|
-
}), isOpen && (_jsxs(_Fragment, { children: [shouldRenderDropdownContainer ? (_jsx("div",
|
|
68
|
+
}), isOpen && (_jsxs(_Fragment, { children: [shouldRenderDropdownContainer ? (_jsx("div", { id: dropdownId, ref: refs.setFloating, style: dropdownBoxStyles, children: renderDropdown({
|
|
69
69
|
styles: dropdownBoxStyles,
|
|
70
70
|
ref: refs.setFloating,
|
|
71
71
|
setIsOpen,
|
|
72
72
|
isOpen,
|
|
73
73
|
id: dropdownId,
|
|
74
|
-
}) }))
|
|
74
|
+
}) })) : (renderDropdown({
|
|
75
75
|
styles: dropdownBoxStyles,
|
|
76
76
|
ref: refs.setFloating,
|
|
77
77
|
isOpen,
|
|
@@ -61,7 +61,7 @@ export const Group = (_a) => {
|
|
|
61
61
|
labelId,
|
|
62
62
|
labelTargetId,
|
|
63
63
|
};
|
|
64
|
-
const Main = (_jsx(GroupContext.Provider,
|
|
64
|
+
const Main = (_jsx(GroupContext.Provider, { value: contextValue, children: typeof children === 'function' ? children(contextValue) : children }));
|
|
65
65
|
if (type === GROUP_TYPE.RAW) {
|
|
66
66
|
return Main;
|
|
67
67
|
}
|
|
@@ -63,7 +63,7 @@ export const GroupV2 = (_a) => {
|
|
|
63
63
|
labelId,
|
|
64
64
|
labelTargetId,
|
|
65
65
|
};
|
|
66
|
-
const Main = (_jsx(GroupV2Context.Provider,
|
|
66
|
+
const Main = (_jsx(GroupV2Context.Provider, { value: contextValue, children: typeof children === 'function' ? children(contextValue) : children }));
|
|
67
67
|
if (type === GROUPV2_TYPE.RAW) {
|
|
68
68
|
return Main;
|
|
69
69
|
}
|