@ndlib/component-library 1.0.44 → 1.0.46
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.d.ts +8 -0
- package/dist/components/composites/DropdownLinksV2/DropdownLinksV2.stories.js +27 -0
- package/dist/components/composites/DropdownLinksV2/index.d.ts +15 -0
- package/dist/components/composites/DropdownLinksV2/index.js +27 -0
- package/dist/components/composites/EmptyState/EmptyState.stories.js +1 -1
- package/dist/components/composites/EmptyState/index.js +2 -2
- 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 +4 -4
- 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,7 +18,7 @@ const sizes = [
|
|
|
18
18
|
{ size: PILLV2_SIZE.SM, label: 'Small' },
|
|
19
19
|
];
|
|
20
20
|
export const Default = {
|
|
21
|
-
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
21
|
+
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsxs(RowV2, { sx: { mt: 2 }, children: [_jsx(PillV2, Object.assign({}, args, { size: size.size, sx: { mr: 1 } })), _jsx(PillV2, Object.assign({}, args, { size: size.size, type: PILLV2_TYPE.OUTLINE }))] })] }))) })),
|
|
22
22
|
args: {
|
|
23
23
|
type: PILLV2_TYPE.DEFAULT,
|
|
24
24
|
children: 'Virtual Event',
|
|
@@ -26,7 +26,7 @@ export const Default = {
|
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
export const Icon = {
|
|
29
|
-
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
29
|
+
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsxs(RowV2, { sx: { mt: 2 }, children: [_jsx(PillV2, Object.assign({}, args, { size: size.size, sx: { mr: 1 }, icon: SearchIcon })), _jsx(PillV2, Object.assign({}, args, { size: size.size, type: PILLV2_TYPE.OUTLINE, icon: SearchIcon }))] })] }))) })),
|
|
30
30
|
args: {
|
|
31
31
|
type: PILLV2_TYPE.DEFAULT,
|
|
32
32
|
children: 'Virtual Event',
|
|
@@ -34,7 +34,7 @@ export const Icon = {
|
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
export const NoAction = {
|
|
37
|
-
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
37
|
+
render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsxs(RowV2, { sx: { mt: 2 }, children: [_jsx(PillV2, Object.assign({}, args, { size: size.size, sx: { mr: 1 } })), _jsx(PillV2, Object.assign({}, args, { size: size.size, type: PILLV2_TYPE.OUTLINE }))] })] }))) })),
|
|
38
38
|
args: {
|
|
39
39
|
type: PILLV2_TYPE.DEFAULT,
|
|
40
40
|
children: 'Virtual Event',
|
|
@@ -9,13 +9,13 @@ export declare enum PILLV2_TYPE {
|
|
|
9
9
|
OUTLINE = "outline"
|
|
10
10
|
}
|
|
11
11
|
export declare const PillV2: React.ForwardRefExoticComponent<{
|
|
12
|
-
sx?: import("../../../theme").StylesPropV2
|
|
12
|
+
sx?: import("../../../theme").StylesPropV2;
|
|
13
13
|
children?: React.ReactNode;
|
|
14
14
|
} & Omit<React.HTMLAttributes<HTMLButtonElement>, "children" | "onChange"> & {
|
|
15
|
-
size?: PILLV2_SIZE
|
|
16
|
-
type?: PILLV2_TYPE
|
|
17
|
-
color?: COLOR
|
|
18
|
-
icon?: React.FC<any
|
|
15
|
+
size?: PILLV2_SIZE;
|
|
16
|
+
type?: PILLV2_TYPE;
|
|
17
|
+
color?: COLOR;
|
|
18
|
+
icon?: React.FC<any>;
|
|
19
19
|
} & {
|
|
20
|
-
htmlFor?: string
|
|
20
|
+
htmlFor?: string;
|
|
21
21
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -75,5 +75,5 @@ export const PillV2 = React.forwardRef((_a, ref) => {
|
|
|
75
75
|
const processedSx = processSx(Object.assign(Object.assign({}, typographyStyles), sx));
|
|
76
76
|
return (_jsxs("button", Object.assign({ ref: ref, tabIndex: onClick ? 0 : -1, onClick: onClick, className: clsx(typeSafeStyles.pillButton, {
|
|
77
77
|
[typeSafeStyles.clickable]: clickable,
|
|
78
|
-
}), style: Object.assign(Object.assign({}, processedSx), { cursor, backgroundColor: colors[bg], color: colors[textColor], paddingLeft: paddingX, paddingRight: paddingX, height: height, borderColor: colors[borderColor] }) }, rest, { children: [icon && (_jsx(IconV2, { icon: icon, size: typographyStyles.fontSize, sx: { mr: iconMargin[size] }, color: textColor })), _jsx("div",
|
|
78
|
+
}), style: Object.assign(Object.assign({}, processedSx), { cursor, backgroundColor: colors[bg], color: colors[textColor], paddingLeft: paddingX, paddingRight: paddingX, height: height, borderColor: colors[borderColor] }) }, rest, { children: [icon && (_jsx(IconV2, { icon: icon, size: typographyStyles.fontSize, sx: { mr: iconMargin[size] }, color: textColor })), _jsx("div", { className: typeSafeStyles.pillContent, children: body })] })));
|
|
79
79
|
});
|
|
@@ -19,10 +19,10 @@ import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography'
|
|
|
19
19
|
import { Radio } from '../Radio';
|
|
20
20
|
export function RadioGroup(_a) {
|
|
21
21
|
var { options, checked, onChange, columnStyles, rowStyles } = _a, rest = __rest(_a, ["options", "checked", "onChange", "columnStyles", "rowStyles"]);
|
|
22
|
-
return (_jsx(Column, Object.assign({}, rest, { sx: columnStyles
|
|
22
|
+
return (_jsx(Column, Object.assign({}, rest, { sx: 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(Radio, { onChange: () => {
|
|
23
23
|
onChange(option.value);
|
|
24
24
|
}, checked: checked === option.value, id: labelTargetId, sx: {
|
|
25
25
|
mr: 2,
|
|
26
26
|
flexShrink: 0,
|
|
27
|
-
}, disabled: option.disabled }), _jsx(Label,
|
|
27
|
+
}, disabled: option.disabled }), _jsx(Label, { sx: Object.assign({ cursor: option.disabled ? 'not-allowed' : 'pointer' }, getTypographyStyles(TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM)), children: option.label })] })) }, option.value))) })));
|
|
28
28
|
}
|
|
@@ -18,10 +18,10 @@ import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography'
|
|
|
18
18
|
import { RadioV2 } from '../RadioV2';
|
|
19
19
|
export function RadioGroupV2(_a) {
|
|
20
20
|
var { options, checked, onChange, columnStyles, rowStyles } = _a, rest = __rest(_a, ["options", "checked", "onChange", "columnStyles", "rowStyles"]);
|
|
21
|
-
return (_jsx(ColumnV2, Object.assign({}, rest, { sx: columnStyles
|
|
21
|
+
return (_jsx(ColumnV2, Object.assign({}, rest, { sx: 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(RadioV2, { onChange: () => {
|
|
22
22
|
onChange(option.value);
|
|
23
23
|
}, checked: checked === option.value, id: labelTargetId, sx: {
|
|
24
24
|
mr: 2,
|
|
25
25
|
flexShrink: 0,
|
|
26
|
-
}, disabled: option.disabled }), _jsx(LabelV2,
|
|
26
|
+
}, disabled: option.disabled }), _jsx(LabelV2, { htmlFor: labelTargetId, sx: Object.assign({ cursor: option.disabled ? 'not-allowed' : 'pointer' }, getTypographyStyles(TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM)), children: option.label })] })) }, option.value))) })));
|
|
27
27
|
}
|
|
@@ -14,15 +14,15 @@ export default meta;
|
|
|
14
14
|
const p1 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ultrices venenatis purus at porta. Etiam congue sapien leo, sed malesuada justo commodo in. Nunc consequat, massa non cursus posuere, magna eros lacinia lectus, eget lobortis mi erat ut justo. Maecenas nisi mi, mollis sed ornare vitae, pharetra sed augue. Curabitur mollis orci risus, sed imperdiet nisi aliquet et. Ut non elit nec magna rhoncus maximus sit amet ut dui. Mauris sit amet eleifend lectus. Aliquam consectetur posuere libero eu ultricies. Etiam rutrum non orci nec vulputate. Sed vel accumsan diam. Cras aliquet eros eros, sit amet pharetra eros tincidunt ut. Vestibulum est erat, eleifend dapibus eros vel, elementum vehicula risus. Etiam blandit condimentum sodales. Donec non libero in orci aliquam egestas fringilla eget purus. Suspendisse pellentesque at ligula ut accumsan.';
|
|
15
15
|
const p2 = 'Lorem ipsum dolor sit';
|
|
16
16
|
export const Default = {
|
|
17
|
-
render: () => (_jsx(Column, { children: _jsx(ReadMore,
|
|
17
|
+
render: () => (_jsx(Column, { children: _jsx(ReadMore, { sx: { width: '250px' }, lines: 2, typography: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM, children: p1 }) })),
|
|
18
18
|
};
|
|
19
19
|
export const NotTruncated = {
|
|
20
|
-
render: () => (_jsx(Column, { children: _jsx(ReadMore,
|
|
20
|
+
render: () => (_jsx(Column, { children: _jsx(ReadMore, { sx: { width: '250px' }, lines: 2, typography: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM, children: p2 }) })),
|
|
21
21
|
};
|
|
22
22
|
export const CustomColor = {
|
|
23
|
-
render: () => (_jsx(Column, { children: _jsx(ReadMore,
|
|
23
|
+
render: () => (_jsx(Column, { children: _jsx(ReadMore, { lines: 2, typography: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM, sx: {
|
|
24
24
|
color: COLOR.BACKGROUND,
|
|
25
25
|
bg: COLOR.PRIMARY,
|
|
26
26
|
width: '250px',
|
|
27
|
-
}
|
|
27
|
+
}, children: p1 }) })),
|
|
28
28
|
};
|
|
@@ -20,18 +20,18 @@ import { useManualRerender } from '../../../utils/hooks/useManualRerender';
|
|
|
20
20
|
const ReadMoreLink = (props) => {
|
|
21
21
|
const bg = colors[props.bg || COLOR.BACKGROUND];
|
|
22
22
|
const color = colors[props.color || COLOR.ND_BLUE_LIGHT];
|
|
23
|
-
return (_jsx("div",
|
|
23
|
+
return (_jsx("div", { css: {
|
|
24
24
|
whiteSpace: 'nowrap',
|
|
25
25
|
position: 'absolute',
|
|
26
26
|
right: 0,
|
|
27
27
|
bottom: 0,
|
|
28
28
|
paddingLeft: '3rem',
|
|
29
29
|
background: `linear-gradient(to right, ${bg}00, ${bg} 30%, ${bg} 100%)`,
|
|
30
|
-
}
|
|
30
|
+
}, children: _jsx("div", { "aria-hidden": "true", sx: {
|
|
31
31
|
color,
|
|
32
32
|
transform: 'scale(0.9)',
|
|
33
33
|
cursor: 'pointer',
|
|
34
|
-
}
|
|
34
|
+
}, children: "Read More..." }) }));
|
|
35
35
|
};
|
|
36
36
|
export const useLinesHeight = (args) => {
|
|
37
37
|
var _a, _b;
|
|
@@ -14,15 +14,15 @@ export default meta;
|
|
|
14
14
|
const p1 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ultrices venenatis purus at porta. Etiam congue sapien leo, sed malesuada justo commodo in. Nunc consequat, massa non cursus posuere, magna eros lacinia lectus, eget lobortis mi erat ut justo. Maecenas nisi mi, mollis sed ornare vitae, pharetra sed augue. Curabitur mollis orci risus, sed imperdiet nisi aliquet et. Ut non elit nec magna rhoncus maximus sit amet ut dui. Mauris sit amet eleifend lectus. Aliquam consectetur posuere libero eu ultricies. Etiam rutrum non orci nec vulputate. Sed vel accumsan diam. Cras aliquet eros eros, sit amet pharetra eros tincidunt ut. Vestibulum est erat, eleifend dapibus eros vel, elementum vehicula risus. Etiam blandit condimentum sodales. Donec non libero in orci aliquam egestas fringilla eget purus. Suspendisse pellentesque at ligula ut accumsan.';
|
|
15
15
|
const p2 = 'Lorem ipsum dolor sit';
|
|
16
16
|
export const Default = {
|
|
17
|
-
render: () => (_jsx(ColumnV2, { children: _jsx(ReadMoreV2,
|
|
17
|
+
render: () => (_jsx(ColumnV2, { children: _jsx(ReadMoreV2, { sx: { width: '250px' }, lines: 2, typography: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM, children: p1 }) })),
|
|
18
18
|
};
|
|
19
19
|
export const NotTruncated = {
|
|
20
|
-
render: () => (_jsx(ColumnV2, { children: _jsx(ReadMoreV2,
|
|
20
|
+
render: () => (_jsx(ColumnV2, { children: _jsx(ReadMoreV2, { sx: { width: '250px' }, lines: 2, typography: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM, children: p2 }) })),
|
|
21
21
|
};
|
|
22
22
|
export const CustomColor = {
|
|
23
|
-
render: () => (_jsx(ColumnV2, { children: _jsx(ReadMoreV2,
|
|
23
|
+
render: () => (_jsx(ColumnV2, { children: _jsx(ReadMoreV2, { lines: 2, typography: TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM, sx: {
|
|
24
24
|
color: COLOR.BACKGROUND,
|
|
25
25
|
bg: COLOR.PRIMARY,
|
|
26
26
|
width: '250px',
|
|
27
|
-
}
|
|
27
|
+
}, children: p1 }) })),
|
|
28
28
|
};
|
|
@@ -23,11 +23,11 @@ const typeSafeStyles = styles;
|
|
|
23
23
|
const ReadMoreLinkV2 = (props) => {
|
|
24
24
|
const bg = colors[props.bg || COLOR.BACKGROUND];
|
|
25
25
|
const color = props.color ? colors[props.color] : '';
|
|
26
|
-
return (_jsx("div",
|
|
26
|
+
return (_jsx("div", { className: typeSafeStyles.linkOuterWrapper, style: {
|
|
27
27
|
background: `linear-gradient(to right, ${bg}00, ${bg} 30%, ${bg} 100%)`,
|
|
28
|
-
}
|
|
28
|
+
}, children: _jsx("div", { className: typeSafeStyles.linkInnerWrapper, "aria-hidden": "true", style: {
|
|
29
29
|
color,
|
|
30
|
-
}
|
|
30
|
+
}, children: "Read More..." }) }));
|
|
31
31
|
};
|
|
32
32
|
export const useLinesHeightV2 = (args) => {
|
|
33
33
|
const styles = getTypographyStyles(args.typography);
|
|
@@ -10,11 +10,11 @@ export type FlexHelperPropsV2 = {
|
|
|
10
10
|
centered?: boolean;
|
|
11
11
|
};
|
|
12
12
|
export declare const RowV2: React.ForwardRefExoticComponent<{
|
|
13
|
-
sx?: import("../../../theme").StylesPropV2
|
|
13
|
+
sx?: import("../../../theme").StylesPropV2;
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & FlexHelperPropsV2 & {
|
|
16
|
-
breakpoint?: number
|
|
17
|
-
className?: string
|
|
16
|
+
breakpoint?: number;
|
|
17
|
+
className?: string;
|
|
18
18
|
} & {
|
|
19
|
-
htmlFor?: string
|
|
19
|
+
htmlFor?: string;
|
|
20
20
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -52,5 +52,5 @@ export const RowV2 = React.forwardRef((_a, ref) => {
|
|
|
52
52
|
return typeSafeStyles.flexRow;
|
|
53
53
|
};
|
|
54
54
|
const flexBreakpointClass = getBreakpointClass(breakpointParam);
|
|
55
|
-
return (_jsx("div", Object.assign({}, rest, { ref: ref, style: Object.assign(Object.assign({}, flexStyles), processedStyles), className: clsx(typeSafeStyles.row, flexBreakpointClass, className)
|
|
55
|
+
return (_jsx("div", Object.assign({}, rest, { ref: ref, style: Object.assign(Object.assign({}, flexStyles), processedStyles), className: clsx(typeSafeStyles.row, flexBreakpointClass, className), children: children })));
|
|
56
56
|
});
|
|
@@ -31,11 +31,11 @@ const StatefulSelect = (props) => {
|
|
|
31
31
|
return (_jsx(Select, Object.assign({ options: options }, props, { value: value, onSelectOption: setValue, placeholder: "Select A Fruit..." })));
|
|
32
32
|
};
|
|
33
33
|
export const Default = {
|
|
34
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading,
|
|
34
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(StatefulSelect, { size: size.size, leftIcon: AppleIcon, sx: { mt: 2 } })] }))) })),
|
|
35
35
|
};
|
|
36
36
|
export const WithLabel = {
|
|
37
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading,
|
|
37
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(StatefulSelect, { size: size.size, leftIcon: AppleIcon, sx: { mt: 2 }, label: "Fruit" })] }))) })),
|
|
38
38
|
};
|
|
39
39
|
export const InvertedColors = {
|
|
40
|
-
render: () => (_jsx(Column,
|
|
40
|
+
render: () => (_jsx(Column, { sx: { backgroundColor: COLOR.BLACK, p: 4 }, children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, { size: HEADING_SIZE.MD, sx: { color: COLOR.WHITE }, children: size.label }), _jsx(StatefulSelect, { inverted: true, size: size.size, leftIcon: AppleIcon, sx: { mt: 2 }, label: "Fruit" })] }))) })),
|
|
41
41
|
};
|
|
@@ -118,7 +118,7 @@ export function Select({ size: sizeParam, placeholder, leftIcon, value, label, o
|
|
|
118
118
|
const focusStyles = {
|
|
119
119
|
boxShadow: inverted ? BOX_SHADOW.INVERTED : BOX_SHADOW.NORMAL,
|
|
120
120
|
};
|
|
121
|
-
return (_jsxs(Box,
|
|
121
|
+
return (_jsxs(Box, { sx: Object.assign({ width: DEFAULT_WIDTH, position: 'relative', borderRadius: '4px', backgroundColor: inverted ? COLOR.DARK_GRAY : COLOR.WHITE, ':hover fieldset': focusStyles, ':focus fieldset': focusStyles }, sx), children: [_jsx("fieldset", { sx: {
|
|
122
122
|
textAlign: 'left',
|
|
123
123
|
position: 'absolute',
|
|
124
124
|
inset: '-4px 0px 0px 0px',
|
|
@@ -132,7 +132,7 @@ export function Select({ size: sizeParam, placeholder, leftIcon, value, label, o
|
|
|
132
132
|
minWidth: '0%',
|
|
133
133
|
borderColor: inverted ? COLOR.WHITE : COLOR.LIGHT_GRAY,
|
|
134
134
|
zIndex: Z_INDEX.ELEVATED,
|
|
135
|
-
}
|
|
135
|
+
}, children: _jsx("legend", { style: {
|
|
136
136
|
width: 'auto',
|
|
137
137
|
float: 'unset',
|
|
138
138
|
overflow: 'hidden',
|
|
@@ -143,13 +143,13 @@ export function Select({ size: sizeParam, placeholder, leftIcon, value, label, o
|
|
|
143
143
|
fontSize: '0.75em',
|
|
144
144
|
visibility: 'hidden',
|
|
145
145
|
whiteSpace: 'nowrap',
|
|
146
|
-
}
|
|
146
|
+
}, children: label && (_jsx(Label, { standalone: true, sx: {
|
|
147
147
|
px: 1,
|
|
148
148
|
position: 'relative',
|
|
149
149
|
display: 'inline-flex',
|
|
150
150
|
opacity: '0',
|
|
151
151
|
visibility: 'hidden',
|
|
152
|
-
}, typography: labelTypographyMap[size]
|
|
152
|
+
}, typography: labelTypographyMap[size], children: label })) }) }), _jsx(Label, { id: inputId, typography: labelTypographyMap[size], sx: {
|
|
153
153
|
position: 'absolute',
|
|
154
154
|
left: '0.5rem',
|
|
155
155
|
lineHeight: 1,
|
|
@@ -157,7 +157,7 @@ export function Select({ size: sizeParam, placeholder, leftIcon, value, label, o
|
|
|
157
157
|
color: inverted ? COLOR.WHITE : COLOR.PRIMARY,
|
|
158
158
|
px: 1,
|
|
159
159
|
top: labelOffsetMap[size],
|
|
160
|
-
}
|
|
160
|
+
}, children: label }), _jsx(Button, { ref: refs.setReference, disableFocusStyles: true, role: "combobox", "aria-controls": listboxId, "aria-expanded": isOpen, "aria-labelledby": inputId, "aria-autocomplete": "none", "aria-activedescendant": isOpen && stagedOptionValue
|
|
161
161
|
? getOptionId(stagedOptionValue)
|
|
162
162
|
: undefined, type: BUTTON_TYPE.OUTLINE, size: buttonSize, onBlur: () => close(), onFocus: () => open(), onKeyDown: onKeyDown, onMouseDown: () => {
|
|
163
163
|
if (!isOpen) {
|
|
@@ -166,10 +166,10 @@ export function Select({ size: sizeParam, placeholder, leftIcon, value, label, o
|
|
|
166
166
|
else {
|
|
167
167
|
close();
|
|
168
168
|
}
|
|
169
|
-
}, color: inverted ? COLOR.WHITE : COLOR.TEXT, sx: Object.assign({ height, width: '100%', border: 'solid 0px', flexDirection: 'row', alignItems: 'center', position: 'relative', zIndex: Z_INDEX.NORMAL, background: 'none' }, typographyStyles), leftIcon: leftIcon, rightIcon: ArrowDropDownIcon
|
|
169
|
+
}, color: inverted ? COLOR.WHITE : COLOR.TEXT, sx: Object.assign({ height, width: '100%', border: 'solid 0px', flexDirection: 'row', alignItems: 'center', position: 'relative', zIndex: Z_INDEX.NORMAL, background: 'none' }, typographyStyles), leftIcon: leftIcon, rightIcon: ArrowDropDownIcon, children: currentOption ? renderOptionLabel(currentOption) : placeholder }), isOpen && (_jsx(ListBox, { id: listboxId, options: options, selected: value, focused: stagedOptionValue, selectOption: (option) => {
|
|
170
170
|
onSelectOption && onSelectOption(option.value);
|
|
171
171
|
close();
|
|
172
172
|
}, ref: refs.setFloating, renderOption: renderOption, sx: {
|
|
173
173
|
zIndex: Z_INDEX.DIALOG,
|
|
174
|
-
}, style: Object.assign(Object.assign({ minWidth: dropdownMinWidth }, floatingStyles), { boxShadow: inverted ? BOX_SHADOW.INVERTED : BOX_SHADOW.NORMAL }) }))] }))
|
|
174
|
+
}, style: Object.assign(Object.assign({ minWidth: dropdownMinWidth }, floatingStyles), { boxShadow: inverted ? BOX_SHADOW.INVERTED : BOX_SHADOW.NORMAL }) }))] }));
|
|
175
175
|
}
|
|
@@ -31,11 +31,11 @@ const StatefulSelect = (props) => {
|
|
|
31
31
|
return (_jsx(SelectV2, Object.assign({ options: options }, props, { value: value, onSelectOption: setValue, placeholder: "Select A Fruit..." })));
|
|
32
32
|
};
|
|
33
33
|
export const Default = {
|
|
34
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2,
|
|
34
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(StatefulSelect, { size: size.size, leftIcon: AppleIcon, sx: { mt: 2 } })] }))) })),
|
|
35
35
|
};
|
|
36
36
|
export const WithLabel = {
|
|
37
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2,
|
|
37
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(StatefulSelect, { size: size.size, leftIcon: AppleIcon, sx: { mt: 2 }, label: "Fruit" })] }))) })),
|
|
38
38
|
};
|
|
39
39
|
export const InvertedColors = {
|
|
40
|
-
render: () => (_jsx(ColumnV2,
|
|
40
|
+
render: () => (_jsx(ColumnV2, { sx: { backgroundColor: COLOR.BLACK, p: 4 }, children: sizes.map((size) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, sx: { color: COLOR.WHITE }, children: size.label }), _jsx(StatefulSelect, { inverted: true, size: size.size, leftIcon: AppleIcon, sx: { mt: 2 }, label: "Fruit" })] }))) })),
|
|
41
41
|
};
|
|
@@ -130,13 +130,13 @@ export function SelectV2({ size: sizeParam, placeholder, leftIcon, value, label,
|
|
|
130
130
|
const fieldsetBorderColor = processSx({
|
|
131
131
|
borderColor: inverted ? COLOR.WHITE : COLOR.LIGHT_GRAY,
|
|
132
132
|
});
|
|
133
|
-
return (_jsxs(BoxV2, Object.assign({}, anchorElementProps, { className: className, sx: Object.assign(Object.assign(Object.assign({ width: DEFAULT_WIDTH, position: 'relative', borderRadius: '4px', backgroundColor: inverted ? COLOR.DARK_GRAY : COLOR.WHITE }, appliedHoverStyles), appliedFocusStyles), sx)
|
|
133
|
+
return (_jsxs(BoxV2, Object.assign({}, anchorElementProps, { className: className, sx: Object.assign(Object.assign(Object.assign({ width: DEFAULT_WIDTH, position: 'relative', borderRadius: '4px', backgroundColor: inverted ? COLOR.DARK_GRAY : COLOR.WHITE }, appliedHoverStyles), appliedFocusStyles), sx), children: [_jsx("fieldset", { className: typeSafeStyles.fieldset, style: Object.assign({}, fieldsetBorderColor), children: _jsx("legend", { className: typeSafeStyles.legend, children: label && (_jsx(LabelV2, { standalone: true, sx: {
|
|
134
134
|
px: 1,
|
|
135
135
|
position: 'relative',
|
|
136
136
|
display: 'inline-flex',
|
|
137
137
|
opacity: '0',
|
|
138
138
|
visibility: 'hidden',
|
|
139
|
-
}, typography: labelTypographyMapV2[size]
|
|
139
|
+
}, typography: labelTypographyMapV2[size], children: label })) }) }), _jsx(LabelV2, { id: inputId, typography: labelTypographyMapV2[size], sx: {
|
|
140
140
|
position: 'absolute',
|
|
141
141
|
left: '0.5rem',
|
|
142
142
|
lineHeight: 1,
|
|
@@ -144,7 +144,7 @@ export function SelectV2({ size: sizeParam, placeholder, leftIcon, value, label,
|
|
|
144
144
|
color: inverted ? COLOR.WHITE : COLOR.PRIMARY,
|
|
145
145
|
px: 1,
|
|
146
146
|
top: labelOffsetMapV2[size],
|
|
147
|
-
}
|
|
147
|
+
}, children: label }), _jsx(ButtonV2, { ref: refs.setReference, disableFocusStyles: true, role: "combobox", "aria-controls": listboxId, "aria-expanded": isOpen, "aria-labelledby": inputId, "aria-autocomplete": "none", "aria-activedescendant": isOpen && stagedOptionValue
|
|
148
148
|
? getOptionId(stagedOptionValue)
|
|
149
149
|
: undefined, type: BUTTONV2_TYPE.OUTLINE, size: buttonSize, onBlur: () => close(), onFocus: () => open(), onKeyDown: onKeyDown, onMouseDown: () => {
|
|
150
150
|
if (!isOpen) {
|
|
@@ -153,7 +153,7 @@ export function SelectV2({ size: sizeParam, placeholder, leftIcon, value, label,
|
|
|
153
153
|
else {
|
|
154
154
|
close();
|
|
155
155
|
}
|
|
156
|
-
}, color: inverted ? COLOR.WHITE : COLOR.TEXT, sx: Object.assign({ height, width: '100%', border: 'solid 0px', flexDirection: 'row', alignItems: 'center', position: 'relative', zIndex: Z_INDEX.NORMAL, background: 'none' }, typographyStyles), leftIcon: leftIcon, rightIcon: ArrowDropDownIcon
|
|
156
|
+
}, color: inverted ? COLOR.WHITE : COLOR.TEXT, sx: Object.assign({ height, width: '100%', border: 'solid 0px', flexDirection: 'row', alignItems: 'center', position: 'relative', zIndex: Z_INDEX.NORMAL, background: 'none' }, typographyStyles), leftIcon: leftIcon, rightIcon: ArrowDropDownIcon, children: currentOption ? renderOptionLabel(currentOption) : placeholder }), isOpen && (_jsx(ListBoxV2, { id: listboxId, options: options, selected: value, focused: stagedOptionValue, selectOption: (option) => {
|
|
157
157
|
onSelectOption && onSelectOption(option.value);
|
|
158
158
|
close();
|
|
159
159
|
}, ref: refs.setFloating, renderOption: renderOption, sx: {
|
|
@@ -17,7 +17,7 @@ const sizes = [
|
|
|
17
17
|
{ size: SPINNER_SIZE.SM, label: 'Small' },
|
|
18
18
|
];
|
|
19
19
|
export const Default = {
|
|
20
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group,
|
|
20
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { type: GROUP_TYPE.REGION, children: [_jsx(Heading, { size: HEADING_SIZE.SM, children: size.label }), _jsx(Spinner, { size: size.size })] }))) })),
|
|
21
21
|
args: {},
|
|
22
22
|
};
|
|
23
23
|
export const CustomColor = {
|
|
@@ -18,7 +18,7 @@ const sizes = [
|
|
|
18
18
|
{ size: SPINNERV2_SIZE.SM, label: 'Small' },
|
|
19
19
|
];
|
|
20
20
|
export const Default = {
|
|
21
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2,
|
|
21
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, { type: GROUPV2_TYPE.REGION, children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.SM, children: size.label }), _jsx(SpinnerV2, { size: size.size })] }))) })),
|
|
22
22
|
args: {},
|
|
23
23
|
};
|
|
24
24
|
export const CustomColor = {
|
|
@@ -31,6 +31,6 @@ const StateManager = ({ children }) => {
|
|
|
31
31
|
const [selected, setSelected] = React.useState('1');
|
|
32
32
|
return _jsx(_Fragment, { children: children({ selected, setSelected }) });
|
|
33
33
|
};
|
|
34
|
-
export const ExampleTabs = () => (_jsx(StateManager, { children: ({ selected, setSelected }) => (_jsx(TabList, { children: items.map((item) => (_jsx(Tab,
|
|
34
|
+
export const ExampleTabs = () => (_jsx(StateManager, { children: ({ selected, setSelected }) => (_jsx(TabList, { children: items.map((item) => (_jsx(Tab, { onClick: () => {
|
|
35
35
|
setSelected(item.id);
|
|
36
|
-
}, selected: selected === item.id
|
|
36
|
+
}, selected: selected === item.id, children: item.label }, item.id))) })) }));
|
|
@@ -21,10 +21,10 @@ export const Tab = (_a) => {
|
|
|
21
21
|
var { selected, children } = _a, rest = __rest(_a, ["selected", "children"]);
|
|
22
22
|
const typographyStyles = getTypographyStyles(TYPOGRAPHY_TYPE.CONDENSED_TEXT_LARGE);
|
|
23
23
|
const labelId = useUniqueId('tab-label');
|
|
24
|
-
return (_jsx("button", Object.assign({ role: "tab", sx: Object.assign({ height: '3.25rem', boxSizing: 'border-box', px: 4, bg: COLOR.WHITE, color: selected ? COLOR.DARK_GRAY : COLOR.GRAY, border: 'none', borderBottom: selected ? 'solid 3px' : 'solid 1px', borderColor: selected ? COLOR.ND_BLUE_BRIGHT : COLOR.LIGHT_GRAY, cursor: 'pointer' }, typographyStyles), "aria-labelledby": labelId, "aria-selected": selected ? 'true' : 'false' }, rest, { children: _jsx("div",
|
|
24
|
+
return (_jsx("button", Object.assign({ role: "tab", sx: Object.assign({ height: '3.25rem', boxSizing: 'border-box', px: 4, bg: COLOR.WHITE, color: selected ? COLOR.DARK_GRAY : COLOR.GRAY, border: 'none', borderBottom: selected ? 'solid 3px' : 'solid 1px', borderColor: selected ? COLOR.ND_BLUE_BRIGHT : COLOR.LIGHT_GRAY, cursor: 'pointer' }, typographyStyles), "aria-labelledby": labelId, "aria-selected": selected ? 'true' : 'false' }, rest, { children: _jsx("div", { id: labelId, sx: {
|
|
25
25
|
transform: selected ? 'scale(1.1)' : undefined,
|
|
26
26
|
':hover': {
|
|
27
27
|
transform: selected ? 'scale(1.1)' : 'scale(1.05)',
|
|
28
28
|
},
|
|
29
|
-
}
|
|
29
|
+
}, children: children }) })));
|
|
30
30
|
};
|
|
@@ -31,6 +31,6 @@ const StateManager = ({ children }) => {
|
|
|
31
31
|
const [selected, setSelected] = React.useState('1');
|
|
32
32
|
return _jsx(_Fragment, { children: children({ selected, setSelected }) });
|
|
33
33
|
};
|
|
34
|
-
export const ExampleTabsV2 = () => (_jsx(StateManager, { children: ({ selected, setSelected }) => (_jsx(TabListV2, { children: items.map((item) => (_jsx(TabV2,
|
|
34
|
+
export const ExampleTabsV2 = () => (_jsx(StateManager, { children: ({ selected, setSelected }) => (_jsx(TabListV2, { children: items.map((item) => (_jsx(TabV2, { onClick: () => {
|
|
35
35
|
setSelected(item.id);
|
|
36
|
-
}, selected: selected === item.id
|
|
36
|
+
}, selected: selected === item.id, children: item.label }, item.id))) })) }));
|
|
@@ -25,7 +25,7 @@ export const TabV2 = (_a) => {
|
|
|
25
25
|
const typographyStyles = getTypographyStyles(TYPOGRAPHY_TYPE.CONDENSED_TEXT_LARGE);
|
|
26
26
|
const processedSx = processSx(Object.assign(Object.assign({}, sx), typographyStyles));
|
|
27
27
|
const labelId = useUniqueId('tab-label');
|
|
28
|
-
return (_jsx("button", Object.assign({ role: "tab", className: typeSafeStyles.tabBtn, style: Object.assign({ color: selected ? 'var(--darkGray)' : 'var(--gray)', borderBottom: selected ? 'solid 3px' : 'solid 1px', borderColor: selected ? 'var(--ndBlueBright)' : 'var(--lightGray)' }, processedSx), "aria-labelledby": labelId, "aria-selected": selected ? 'true' : 'false' }, rest, { children: _jsx("div",
|
|
28
|
+
return (_jsx("button", Object.assign({ role: "tab", className: typeSafeStyles.tabBtn, style: Object.assign({ color: selected ? 'var(--darkGray)' : 'var(--gray)', borderBottom: selected ? 'solid 3px' : 'solid 1px', borderColor: selected ? 'var(--ndBlueBright)' : 'var(--lightGray)' }, processedSx), "aria-labelledby": labelId, "aria-selected": selected ? 'true' : 'false' }, rest, { children: _jsx("div", { id: labelId, className: selected
|
|
29
29
|
? typeSafeStyles.tabLabelSelected
|
|
30
|
-
: typeSafeStyles.tabLabelUnselected
|
|
30
|
+
: typeSafeStyles.tabLabelUnselected, children: children }) })));
|
|
31
31
|
};
|
|
@@ -38,41 +38,41 @@ const data = [
|
|
|
38
38
|
},
|
|
39
39
|
];
|
|
40
40
|
export const Default = {
|
|
41
|
-
render: () => (_jsxs(Table,
|
|
41
|
+
render: () => (_jsxs(Table, { data: data, alternateRowColor: true, children: [_jsx(TableColumn, { header: "Name", dataKey: "name", sx: {
|
|
42
42
|
width: '160px',
|
|
43
|
-
} }), _jsx(TableColumn,
|
|
43
|
+
} }), _jsx(TableColumn, { header: "Age", sx: {
|
|
44
44
|
width: '100px',
|
|
45
|
-
}
|
|
45
|
+
}, children: (row) => row.age }), _jsx(TableColumn, { header: "Occupation", children: (row) => row.position })] })),
|
|
46
46
|
};
|
|
47
47
|
export const OmitColumn = {
|
|
48
48
|
render: () => {
|
|
49
49
|
const someCondition = false;
|
|
50
|
-
return (_jsxs(Table,
|
|
50
|
+
return (_jsxs(Table, { data: data, alternateRowColor: true, children: [_jsx(TableColumn, { header: "Name", dataKey: "name", sx: {
|
|
51
51
|
width: '160px',
|
|
52
|
-
} }), someCondition ? (_jsx(TableColumn,
|
|
52
|
+
} }), someCondition ? (_jsx(TableColumn, { header: "Age", sx: {
|
|
53
53
|
width: '100px',
|
|
54
|
-
}
|
|
54
|
+
}, children: (row) => row.age })) : null, _jsx(TableColumn, { header: "Occupation", children: (row) => row.position })] }));
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
57
|
export const ResponsiveColumn = {
|
|
58
58
|
render: () => {
|
|
59
|
-
return (_jsxs(Table,
|
|
59
|
+
return (_jsxs(Table, { data: data, alternateRowColor: true, children: [_jsx(TableColumn, { header: "Name", dataKey: "name", sx: {
|
|
60
60
|
width: '160px',
|
|
61
|
-
} }), _jsx(TableColumn,
|
|
61
|
+
} }), _jsx(TableColumn, { breakpoint: 2, header: "Age", sx: {
|
|
62
62
|
width: '100px',
|
|
63
|
-
}
|
|
63
|
+
}, children: (row) => row.age }), _jsx(TableColumn, { header: "Occupation", children: (row) => row.position })] }));
|
|
64
64
|
},
|
|
65
65
|
};
|
|
66
66
|
export const ColumnGroup = {
|
|
67
67
|
render: () => {
|
|
68
|
-
return (_jsxs(Table,
|
|
68
|
+
return (_jsxs(Table, { data: data, alternateRowColor: true, children: [_jsx(TableColumn, { header: "Name", dataKey: "name", sx: {
|
|
69
69
|
width: '160px',
|
|
70
70
|
} }), [
|
|
71
|
-
_jsx(TableColumn,
|
|
71
|
+
_jsx(TableColumn, { header: "Age", sx: {
|
|
72
72
|
width: '100px',
|
|
73
|
-
}
|
|
74
|
-
_jsx(TableColumn,
|
|
75
|
-
]] }))
|
|
73
|
+
}, children: (row) => row.age }),
|
|
74
|
+
_jsx(TableColumn, { header: "Occupation", children: (row) => row.position }),
|
|
75
|
+
]] }));
|
|
76
76
|
},
|
|
77
77
|
};
|
|
78
78
|
const SortableStory = () => {
|
|
@@ -84,14 +84,14 @@ const SortableStory = () => {
|
|
|
84
84
|
items: data,
|
|
85
85
|
config: sortConfig,
|
|
86
86
|
});
|
|
87
|
-
return (_jsxs(Table,
|
|
87
|
+
return (_jsxs(Table, { data: sorted, alternateRowColor: true, sortConfig: sortConfig, updateSort: setSortConfig, children: [_jsx(TableColumn, { header: "Name", dataKey: "name", sortable: true, sx: {
|
|
88
88
|
width: '160px',
|
|
89
89
|
} }), [
|
|
90
|
-
_jsx(TableColumn,
|
|
90
|
+
_jsx(TableColumn, { header: "Age", sortKey: "age", sortable: true, sx: {
|
|
91
91
|
width: '100px',
|
|
92
|
-
}
|
|
92
|
+
}, children: (row) => row.age }),
|
|
93
93
|
_jsx(TableColumn, { header: "Occupation", sortable: true, dataKey: "position" }),
|
|
94
|
-
]] }))
|
|
94
|
+
]] }));
|
|
95
95
|
};
|
|
96
96
|
export const Sortable = {
|
|
97
97
|
render: SortableStory,
|
|
@@ -13,7 +13,7 @@ const data = [
|
|
|
13
13
|
col3: 'Cell 2-3',
|
|
14
14
|
},
|
|
15
15
|
];
|
|
16
|
-
export const testExample = (_jsxs(Table,
|
|
16
|
+
export const testExample = (_jsxs(Table, { data: data, children: [_jsx(TableColumn, { header: "Column 1", dataKey: "col1" }), _jsx(TableColumn, { header: "Column 2", children: (row) => row.col2 }), _jsx(TableColumn, { dataKey: "col3", header: "Column 3" })] }));
|
|
17
17
|
describe('Table', () => {
|
|
18
18
|
it('renders all headers and cells', () => {
|
|
19
19
|
const { getByText } = render(testExample);
|
|
@@ -64,7 +64,7 @@ export function Table(props) {
|
|
|
64
64
|
: COLOR.WHITE, p: 3, borderBottom: showRowDividers && !isLastRow ? '1px solid' : 'none', borderRight: showColumnDividers && !isLastColumn ? '1px solid' : 'none', borderColor: COLOR.LIGHT_GRAY, textAlign: cellAlign }, cellTypographyStyles);
|
|
65
65
|
return Object.assign(Object.assign(Object.assign({}, styles), cellStyles), columnProps.sx);
|
|
66
66
|
};
|
|
67
|
-
return (_jsxs("table",
|
|
67
|
+
return (_jsxs("table", { role: role, sx: sx, children: [_jsx("thead", { role: "rowgroup", children: _jsx("tr", { children: columnSpec.map((column, i) => {
|
|
68
68
|
const isLastColumn = i === columnSpec.length - 1;
|
|
69
69
|
if (column.breakpoint && breakpoint < column.breakpoint) {
|
|
70
70
|
return null;
|
|
@@ -80,11 +80,11 @@ export function Table(props) {
|
|
|
80
80
|
updateSort({ key: sortKey, direction });
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
return (_jsx("th",
|
|
83
|
+
return (_jsx("th", { role: "columnheader", sx: Object.assign(Object.assign({ textAlign: column.alignHeader || column.align || 'left', borderBottom: '1px solid', borderRight: showColumnDividers && !isLastColumn ? '1px solid' : 'none', borderColor: COLOR.LIGHT_GRAY, px: 3, pb: 1 }, headerTypographyStyles), column.headerStyles), children: _jsxs(Row, { onClick: onSort, tabIndex: canSort ? 0 : undefined, sx: { cursor: canSort ? 'pointer' : 'default' }, children: [column.header, canSort &&
|
|
84
84
|
sortConfig.key === sortKey &&
|
|
85
|
-
(sortConfig.direction === SORT_DIRECTION.ASC ? (_jsx(Icon, { icon: ArrowDropUp, sx: { ml: 1 }, size: FONT_SIZE.MD })) : (_jsx(Icon, { icon: ArrowDropDown, sx: { ml: 1 }, size: FONT_SIZE.MD })))] })
|
|
86
|
-
}) }) })
|
|
87
|
-
return (_jsx("tr",
|
|
85
|
+
(sortConfig.direction === SORT_DIRECTION.ASC ? (_jsx(Icon, { icon: ArrowDropUp, sx: { ml: 1 }, size: FONT_SIZE.MD })) : (_jsx(Icon, { icon: ArrowDropDown, sx: { ml: 1 }, size: FONT_SIZE.MD })))] }) }, i));
|
|
86
|
+
}) }) }), _jsx("tbody", { role: "rowgroup", children: data.map((rowData, rowIndex) => {
|
|
87
|
+
return (_jsx("tr", { role: "row", children: columnSpec.map((column, columnIndex) => {
|
|
88
88
|
if (column.breakpoint && breakpoint < column.breakpoint) {
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
@@ -94,7 +94,7 @@ export function Table(props) {
|
|
|
94
94
|
rowIndex,
|
|
95
95
|
columnIndex,
|
|
96
96
|
});
|
|
97
|
-
return (_jsx("td",
|
|
98
|
-
}) }
|
|
99
|
-
}) })
|
|
97
|
+
return (_jsx("td", { sx: cellStyles, children: _jsxs(_Fragment, { children: [dataKey ? rowData[dataKey] : null, !dataKey && children && children(rowData)] }) }, columnIndex));
|
|
98
|
+
}) }, rowIndex));
|
|
99
|
+
}) })] }));
|
|
100
100
|
}
|
|
@@ -24,14 +24,14 @@ const StatefulInput = (props) => {
|
|
|
24
24
|
return _jsx(TextInput, Object.assign({ value: value, onChange: setValue }, props));
|
|
25
25
|
};
|
|
26
26
|
export const Default = {
|
|
27
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading,
|
|
27
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(StatefulInput, { size: size.size, leftIcon: SearchIcon, placeholder: "Placeholder", sx: { mt: 2 } })] }))) })),
|
|
28
28
|
};
|
|
29
29
|
export const WithLabel = {
|
|
30
|
-
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading,
|
|
30
|
+
render: () => (_jsx(Column, { children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, { size: HEADING_SIZE.MD, children: size.label }), _jsx(StatefulInput, { size: size.size, leftIcon: SearchIcon, label: "Search", placeholder: "Placeholder", sx: { mt: 2 } })] }))) })),
|
|
31
31
|
};
|
|
32
32
|
export const Inverted = {
|
|
33
|
-
render: () => (_jsx(Column,
|
|
33
|
+
render: () => (_jsx(Column, { sx: { backgroundColor: COLOR.BLACK, p: 2 }, children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, { size: HEADING_SIZE.MD, sx: { color: COLOR.WHITE }, children: size.label }), _jsx(StatefulInput, { inverted: true, size: size.size, leftIcon: SearchIcon, placeholder: "Placeholder", label: "Search", sx: { mt: 2 } })] }))) })),
|
|
34
34
|
};
|
|
35
35
|
export const Disabled = {
|
|
36
|
-
render: () => (_jsx(Column,
|
|
36
|
+
render: () => (_jsx(Column, { sx: { p: 2 }, children: sizes.map((size) => (_jsxs(Group, { children: [_jsx(Heading, { size: HEADING_SIZE.MD, sx: { color: COLOR.WHITE }, children: size.label }), _jsx(StatefulInput, { disabled: true, size: size.size, leftIcon: SearchIcon, placeholder: "Placeholder", label: "Search", sx: { mt: 2 } })] }))) })),
|
|
37
37
|
};
|