@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
|
@@ -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
|
};
|
|
@@ -11,7 +11,7 @@ vi.mock('../../../providers/uniqueIds', () => ({
|
|
|
11
11
|
describe('TextInput Component', () => {
|
|
12
12
|
const setup = (props = {}) => {
|
|
13
13
|
const initialProps = Object.assign({ value: '', onChange: vi.fn(), onChangeRaw: vi.fn(), size: INPUT_SIZE.MD }, props);
|
|
14
|
-
return render(_jsx(ThemeProvider,
|
|
14
|
+
return render(_jsx(ThemeProvider, { theme: theme, children: _jsx(TextInput, Object.assign({}, initialProps)) }));
|
|
15
15
|
};
|
|
16
16
|
it('renders with the correct initial value', () => {
|
|
17
17
|
setup({ value: 'Initial value' });
|
|
@@ -34,7 +34,7 @@ describe('TextInput Component', () => {
|
|
|
34
34
|
expect(value).toBe('New value');
|
|
35
35
|
});
|
|
36
36
|
it('renders the left icon if provided', () => {
|
|
37
|
-
const MockIcon = () => _jsx("span",
|
|
37
|
+
const MockIcon = () => _jsx("span", { "data-testid": "mock-icon", children: "Icon" });
|
|
38
38
|
setup({ leftIcon: MockIcon });
|
|
39
39
|
expect(screen.getByTestId('mock-icon')).toBeInTheDocument();
|
|
40
40
|
});
|
|
@@ -28,18 +28,18 @@ export type TextInputProps = StyledElementProps<HTMLInputElement, {
|
|
|
28
28
|
onChangeRaw?: (e: string | React.ChangeEvent) => void;
|
|
29
29
|
}, string>;
|
|
30
30
|
export declare const TextInput: React.ForwardRefExoticComponent<{
|
|
31
|
-
sx?: import("../../../theme").StylesProp
|
|
31
|
+
sx?: import("../../../theme").StylesProp;
|
|
32
32
|
children?: string | undefined;
|
|
33
33
|
} & Omit<React.HTMLAttributes<HTMLInputElement>, "children" | "onChange"> & {
|
|
34
|
-
size?: INPUT_SIZE
|
|
35
|
-
leftIcon?: React.FC<any
|
|
36
|
-
inline?: boolean
|
|
37
|
-
inverted?: boolean
|
|
38
|
-
label?: string
|
|
39
|
-
disabled?: boolean
|
|
34
|
+
size?: INPUT_SIZE;
|
|
35
|
+
leftIcon?: React.FC<any>;
|
|
36
|
+
inline?: boolean;
|
|
37
|
+
inverted?: boolean;
|
|
38
|
+
label?: string;
|
|
39
|
+
disabled?: boolean;
|
|
40
40
|
value: string;
|
|
41
|
-
onChange?: (
|
|
42
|
-
onChangeRaw?: (
|
|
41
|
+
onChange?: (value: string) => void;
|
|
42
|
+
onChangeRaw?: (e: string | React.ChangeEvent) => void;
|
|
43
43
|
} & {
|
|
44
|
-
htmlFor?: string
|
|
44
|
+
htmlFor?: string;
|
|
45
45
|
} & React.RefAttributes<any>>;
|
|
@@ -65,8 +65,8 @@ export const TextInput = React.forwardRef((_a, ref) => {
|
|
|
65
65
|
: {
|
|
66
66
|
boxShadow: inverted ? BOX_SHADOW.INVERTED : BOX_SHADOW.NORMAL,
|
|
67
67
|
};
|
|
68
|
-
return (_jsxs("div",
|
|
69
|
-
display, px: paddingX, backgroundColor: inverted ? COLOR.DARK_GRAY : COLOR.WHITE, borderRadius: '4px', flexDirection: 'row', position: 'relative', alignItems: 'center', ':hover': focusStyles, ':focus': focusStyles }, typographyStyles), sx)
|
|
68
|
+
return (_jsxs("div", { ref: ref, onClick: onClick, id: id, sx: Object.assign(Object.assign({ height,
|
|
69
|
+
display, px: paddingX, backgroundColor: inverted ? COLOR.DARK_GRAY : COLOR.WHITE, borderRadius: '4px', flexDirection: 'row', position: 'relative', alignItems: 'center', ':hover': focusStyles, ':focus': focusStyles }, typographyStyles), sx), children: [_jsx("fieldset", { sx: {
|
|
70
70
|
textAlign: 'left',
|
|
71
71
|
position: 'absolute',
|
|
72
72
|
inset: '-4px 0px 0px 0px',
|
|
@@ -80,7 +80,7 @@ export const TextInput = React.forwardRef((_a, ref) => {
|
|
|
80
80
|
minWidth: '0%',
|
|
81
81
|
borderColor: inverted ? COLOR.GRAY : COLOR.LIGHT_GRAY,
|
|
82
82
|
zIndex: Z_INDEX.ELEVATED,
|
|
83
|
-
}
|
|
83
|
+
}, children: _jsx("legend", { style: {
|
|
84
84
|
width: 'auto',
|
|
85
85
|
float: 'unset',
|
|
86
86
|
overflow: 'hidden',
|
|
@@ -91,13 +91,13 @@ export const TextInput = React.forwardRef((_a, ref) => {
|
|
|
91
91
|
fontSize: '0.75em',
|
|
92
92
|
visibility: 'hidden',
|
|
93
93
|
whiteSpace: 'nowrap',
|
|
94
|
-
}
|
|
94
|
+
}, children: label && (_jsx(Label, { standalone: true, "aria-hidden": "true", sx: {
|
|
95
95
|
px: 1,
|
|
96
96
|
position: 'relative',
|
|
97
97
|
display: 'inline-flex',
|
|
98
98
|
opacity: '0',
|
|
99
99
|
visibility: 'hidden',
|
|
100
|
-
}, typography: labelTypographyMap[size]
|
|
100
|
+
}, typography: labelTypographyMap[size], children: label })) }) }), leftIcon && (_jsx(Icon, { icon: leftIcon, color: inverted ? COLOR.EXTRA_LIGHT_GRAY : COLOR.TEXT, sx: {
|
|
101
101
|
mr: 2,
|
|
102
102
|
fontSize: getIconSize(typographyStyles.fontSize),
|
|
103
103
|
} })), _jsx("input", Object.assign({ value: value, onChange: (event) => {
|
|
@@ -107,7 +107,7 @@ export const TextInput = React.forwardRef((_a, ref) => {
|
|
|
107
107
|
color: inverted ? COLOR.LIGHT_GRAY : COLOR.GRAY,
|
|
108
108
|
}, ':focus': {
|
|
109
109
|
outline: 'none',
|
|
110
|
-
} }), disabled: disabled }, rest)), label && (_jsx(Label,
|
|
110
|
+
} }), disabled: disabled }, rest)), label && (_jsx(Label, { htmlFor: id, typography: labelTypographyMap[size], sx: {
|
|
111
111
|
position: 'absolute',
|
|
112
112
|
color: inverted ? COLOR.EXTRA_LIGHT_GRAY : COLOR.ND_PROVOST_BLUE,
|
|
113
113
|
left: '0.5rem',
|
|
@@ -115,5 +115,5 @@ export const TextInput = React.forwardRef((_a, ref) => {
|
|
|
115
115
|
zIndex: (_b = theme.zIndex) === null || _b === void 0 ? void 0 : _b.ELEVATED,
|
|
116
116
|
px: 1,
|
|
117
117
|
top: labelOffsetMap[size],
|
|
118
|
-
}
|
|
118
|
+
}, children: label }))] }));
|
|
119
119
|
});
|
|
@@ -24,14 +24,14 @@ const StatefulInput = (props) => {
|
|
|
24
24
|
return _jsx(TextInputV2, Object.assign({ value: value, onChange: setValue }, props));
|
|
25
25
|
};
|
|
26
26
|
export const Default = {
|
|
27
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size, i) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2,
|
|
27
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size, i) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(StatefulInput, { size: size.size, leftIcon: SearchIcon, placeholder: "Placeholder", sx: { mt: 2 } })] }, i))) })),
|
|
28
28
|
};
|
|
29
29
|
export const WithLabel = {
|
|
30
|
-
render: () => (_jsx(ColumnV2, { children: sizes.map((size, i) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2,
|
|
30
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size, i) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2, { size: HEADINGV2_SIZE.MD, children: size.label }), _jsx(StatefulInput, { size: size.size, leftIcon: SearchIcon, label: "Search", placeholder: "Placeholder", sx: { mt: 2 } })] }, i))) })),
|
|
31
31
|
};
|
|
32
32
|
export const Inverted = {
|
|
33
|
-
render: () => (_jsx(ColumnV2,
|
|
33
|
+
render: () => (_jsx(ColumnV2, { sx: { backgroundColor: COLOR.BLACK, p: 2 }, children: sizes.map((size, i) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2, { size: HEADINGV2_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 } })] }, i))) })),
|
|
34
34
|
};
|
|
35
35
|
export const Disabled = {
|
|
36
|
-
render: () => (_jsx(ColumnV2,
|
|
36
|
+
render: () => (_jsx(ColumnV2, { sx: { p: 2 }, children: sizes.map((size, i) => (_jsxs(GroupV2, { children: [_jsx(HeadingV2, { size: HEADINGV2_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 } })] }, i))) })),
|
|
37
37
|
};
|
|
@@ -32,7 +32,7 @@ describe('TextInputV2 Component', () => {
|
|
|
32
32
|
expect(value).toBe('New value');
|
|
33
33
|
});
|
|
34
34
|
it('renders the left icon if provided', () => {
|
|
35
|
-
const MockIcon = () => _jsx("span",
|
|
35
|
+
const MockIcon = () => _jsx("span", { "data-testid": "mock-icon", children: "Icon" });
|
|
36
36
|
setup({ leftIcon: MockIcon });
|
|
37
37
|
expect(screen.getByTestId('mock-icon')).toBeInTheDocument();
|
|
38
38
|
});
|
|
@@ -29,19 +29,19 @@ export type TextInputV2Props = StyledElementPropsV2<HTMLInputElement, {
|
|
|
29
29
|
className?: string;
|
|
30
30
|
}, string>;
|
|
31
31
|
export declare const TextInputV2: React.ForwardRefExoticComponent<{
|
|
32
|
-
sx?: import("../../../theme").StylesPropV2
|
|
32
|
+
sx?: import("../../../theme").StylesPropV2;
|
|
33
33
|
children?: string | undefined;
|
|
34
34
|
} & Omit<React.HTMLAttributes<HTMLInputElement>, "children" | "onChange"> & {
|
|
35
|
-
size?: INPUTV2_SIZE
|
|
36
|
-
leftIcon?: React.FC<any
|
|
37
|
-
inline?: boolean
|
|
38
|
-
inverted?: boolean
|
|
39
|
-
label?: string
|
|
40
|
-
disabled?: boolean
|
|
35
|
+
size?: INPUTV2_SIZE;
|
|
36
|
+
leftIcon?: React.FC<any>;
|
|
37
|
+
inline?: boolean;
|
|
38
|
+
inverted?: boolean;
|
|
39
|
+
label?: string;
|
|
40
|
+
disabled?: boolean;
|
|
41
41
|
value: string;
|
|
42
|
-
onChange?: (
|
|
43
|
-
onChangeRaw?: (
|
|
44
|
-
className?: string
|
|
42
|
+
onChange?: (value: string) => void;
|
|
43
|
+
onChangeRaw?: (e: string | React.ChangeEvent) => void;
|
|
44
|
+
className?: string;
|
|
45
45
|
} & {
|
|
46
|
-
htmlFor?: string
|
|
46
|
+
htmlFor?: string;
|
|
47
47
|
} & React.RefAttributes<any>>;
|
|
@@ -74,19 +74,19 @@ export const TextInputV2 = React.forwardRef((_a, ref) => {
|
|
|
74
74
|
const appliedHoverStyles = isHovered ? focusStyles : {};
|
|
75
75
|
const appliedFocusStyles = isFocused ? focusStyles : {};
|
|
76
76
|
return (_jsxs("div", Object.assign({}, anchorElementProps, { ref: ref, onClick: onClick, id: id, className: clsx(`${typeSafeStyles.wrapper} ${inverted ? typeSafeStyles.inverted : ''}`, className), style: Object.assign(Object.assign(Object.assign({ height,
|
|
77
|
-
display, paddingLeft: paddingX, paddingRight: paddingX }, appliedHoverStyles), appliedFocusStyles), processedStyles)
|
|
77
|
+
display, paddingLeft: paddingX, paddingRight: paddingX }, appliedHoverStyles), appliedFocusStyles), processedStyles), children: [_jsx("fieldset", { className: `${typeSafeStyles.fieldset} ${inverted ? typeSafeStyles.inverted : ''}`, children: _jsx("legend", { className: typeSafeStyles.legend, children: label && (_jsx(LabelV2, { standalone: true, "aria-hidden": "true", sx: {
|
|
78
78
|
px: 1,
|
|
79
79
|
position: 'relative',
|
|
80
80
|
display: 'inline-flex',
|
|
81
81
|
opacity: '0',
|
|
82
82
|
visibility: 'hidden',
|
|
83
|
-
}, typography: labelTypographyMapV2[size]
|
|
83
|
+
}, typography: labelTypographyMapV2[size], children: label })) }) }), leftIcon && (_jsx(IconV2, { icon: leftIcon, color: inverted ? COLOR.EXTRA_LIGHT_GRAY : COLOR.TEXT, sx: {
|
|
84
84
|
mr: 2,
|
|
85
85
|
fontSize: getIconSize(typographyStyles.fontSize),
|
|
86
86
|
} })), _jsx("input", Object.assign({ value: value, onChange: (event) => {
|
|
87
87
|
onChange && onChange(event.target.value);
|
|
88
88
|
onChangeRaw && onChangeRaw(event.target.value);
|
|
89
|
-
}, className: `${typeSafeStyles.input} ${inverted ? typeSafeStyles.inverted : ''}`, style: Object.assign({}, processSx(Object.assign({}, typographyStyles))), disabled: disabled }, rest)), label && (_jsx(LabelV2,
|
|
89
|
+
}, className: `${typeSafeStyles.input} ${inverted ? typeSafeStyles.inverted : ''}`, style: Object.assign({}, processSx(Object.assign({}, typographyStyles))), disabled: disabled }, rest)), label && (_jsx(LabelV2, { htmlFor: id, typography: labelTypographyMapV2[size], sx: {
|
|
90
90
|
position: 'absolute',
|
|
91
91
|
color: inverted ? COLOR.EXTRA_LIGHT_GRAY : COLOR.ND_PROVOST_BLUE,
|
|
92
92
|
left: '0.5rem',
|
|
@@ -94,5 +94,5 @@ export const TextInputV2 = React.forwardRef((_a, ref) => {
|
|
|
94
94
|
zIndex: Z_INDEX.ELEVATED,
|
|
95
95
|
px: 1,
|
|
96
96
|
top: labelOffsetMapV2[size],
|
|
97
|
-
}
|
|
97
|
+
}, children: label }))] })));
|
|
98
98
|
});
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { StyledElementProps } from '../../../theme';
|
|
3
3
|
export type BoxProps = StyledElementProps<HTMLDivElement>;
|
|
4
4
|
export declare const Box: React.ForwardRefExoticComponent<{
|
|
5
|
-
sx?: import("../../../theme").StylesProp
|
|
5
|
+
sx?: import("../../../theme").StylesProp;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & object & {
|
|
8
|
-
htmlFor?: string
|
|
8
|
+
htmlFor?: string;
|
|
9
9
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -10,5 +10,5 @@ const meta = {
|
|
|
10
10
|
};
|
|
11
11
|
export default meta;
|
|
12
12
|
export const Box = {
|
|
13
|
-
render: () => (_jsx(BoxComponent,
|
|
13
|
+
render: () => (_jsx(BoxComponent, { sx: { p: 1, bg: COLOR.PRIMARY }, children: _jsx(BoxComponent, { sx: { p: 1, bg: COLOR.SECONDARY } }) })),
|
|
14
14
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FlexHelperProps } from './Row';
|
|
3
3
|
export declare const Column: React.ForwardRefExoticComponent<{
|
|
4
|
-
sx?: import("../../../theme").StylesProp
|
|
4
|
+
sx?: import("../../../theme").StylesProp;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & FlexHelperProps & {
|
|
7
|
-
htmlFor?: string
|
|
7
|
+
htmlFor?: string;
|
|
8
8
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -15,5 +15,5 @@ import { convertFlexHelperProps } from './Row';
|
|
|
15
15
|
export const Column = React.forwardRef((_a, ref) => {
|
|
16
16
|
var { sx, children } = _a, rest = __rest(_a, ["sx", "children"]);
|
|
17
17
|
const flexStyles = convertFlexHelperProps(rest);
|
|
18
|
-
return (_jsx("div", Object.assign({ ref: ref }, rest, { sx: Object.assign(Object.assign(Object.assign({}, flexStyles), sx), { display: 'flex', flexDirection: 'column' })
|
|
18
|
+
return (_jsx("div", Object.assign({ ref: ref }, rest, { sx: Object.assign(Object.assign(Object.assign({}, flexStyles), sx), { display: 'flex', flexDirection: 'column' }), children: children })));
|
|
19
19
|
});
|
|
@@ -12,17 +12,17 @@ const meta = {
|
|
|
12
12
|
};
|
|
13
13
|
export default meta;
|
|
14
14
|
export const Columns = {
|
|
15
|
-
render: () => (_jsxs(Row,
|
|
15
|
+
render: () => (_jsxs(Row, { justify: "space-between", children: [_jsx(Column, { children: _jsx(Paragraph, { children: "Column 1" }) }), _jsx(Column, { children: _jsx(Paragraph, { children: "Column 2" }) }), _jsx(Column, { children: _jsx(Paragraph, { children: "Column 3" }) })] })),
|
|
16
16
|
};
|
|
17
17
|
export const Rows = {
|
|
18
18
|
render: () => (_jsxs(Column, { children: [_jsx(Row, { children: _jsx(Paragraph, { children: "Row 1" }) }), _jsx(Row, { children: _jsx(Paragraph, { children: "Row 2" }) }), _jsx(Row, { children: _jsx(Paragraph, { children: "Row 3" }) })] })),
|
|
19
19
|
};
|
|
20
20
|
export const ResponsiveRow = {
|
|
21
|
-
render: () => (_jsxs(Row,
|
|
21
|
+
render: () => (_jsxs(Row, { justify: "space-between", breakpoint: 0, children: [_jsx(Column, { children: _jsx(Paragraph, { children: "Column 1" }) }), _jsx(Column, { children: _jsx(Paragraph, { children: "Column 2" }) }), _jsx(Column, { children: _jsx(Paragraph, { children: "Column 3" }) })] })),
|
|
22
22
|
};
|
|
23
23
|
export const FlexHelpers = {
|
|
24
|
-
render: () => (_jsxs(Row,
|
|
24
|
+
render: () => (_jsxs(Row, { justify: "space-between", children: [_jsx(Column, { align: "flex-end", grow: 1, sx: { bg: COLOR.PRIMARY, color: COLOR.TEXT_ON_PRIMARY }, children: _jsx(Row, { children: _jsx(Paragraph, { children: "Right-aligned" }) }) }), _jsx(Column, { grow: 1, children: _jsx(Paragraph, { children: "Growing Column...................................................." }) }), _jsx(Column, { shrink: 1, sx: { bg: COLOR.PRIMARY, color: COLOR.TEXT_ON_PRIMARY }, children: _jsx(Paragraph, { children: "Shrinking Column" }) })] })),
|
|
25
25
|
};
|
|
26
26
|
export const Centered = {
|
|
27
|
-
render: () => (_jsx(Row,
|
|
27
|
+
render: () => (_jsx(Row, { centered: true, sx: { width: '100%', height: '100px', border: 'solid black 1px' }, children: _jsx(Paragraph, { children: "Hello World" }) })),
|
|
28
28
|
};
|
|
@@ -8,7 +8,7 @@ describe('Row', () => {
|
|
|
8
8
|
expect(getByText('Foo')).toBeInTheDocument();
|
|
9
9
|
});
|
|
10
10
|
it('converts helper props to styles', () => {
|
|
11
|
-
const { getByText } = render(_jsx(Row,
|
|
11
|
+
const { getByText } = render(_jsx(Row, { grow: 1, shrink: 1, basis: "100px", align: "baseline", justify: "flex-start", children: "Foo" }));
|
|
12
12
|
const rendered = getByText('Foo');
|
|
13
13
|
expect(rendered).toHaveStyle('flex-grow: 1');
|
|
14
14
|
expect(rendered).toHaveStyle('flex-shrink: 1');
|
|
@@ -23,7 +23,7 @@ describe('Column', () => {
|
|
|
23
23
|
expect(getByText('Foo')).toBeInTheDocument();
|
|
24
24
|
});
|
|
25
25
|
it('converts helper props to styles', () => {
|
|
26
|
-
const { getByText } = render(_jsx(Column,
|
|
26
|
+
const { getByText } = render(_jsx(Column, { grow: 1, shrink: 1, basis: "100px", align: "baseline", justify: "flex-start", children: "Foo" }));
|
|
27
27
|
const rendered = getByText('Foo');
|
|
28
28
|
expect(rendered).toHaveStyle('flex-grow: 1');
|
|
29
29
|
expect(rendered).toHaveStyle('flex-shrink: 1');
|
|
@@ -11,10 +11,10 @@ export type FlexHelperProps = {
|
|
|
11
11
|
centered?: boolean;
|
|
12
12
|
};
|
|
13
13
|
export declare const Row: React.ForwardRefExoticComponent<{
|
|
14
|
-
sx?: import("../../../theme").StylesProp
|
|
14
|
+
sx?: import("../../../theme").StylesProp;
|
|
15
15
|
children?: React.ReactNode;
|
|
16
16
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & FlexHelperProps & {
|
|
17
|
-
breakpoint?: number
|
|
17
|
+
breakpoint?: number;
|
|
18
18
|
} & {
|
|
19
|
-
htmlFor?: string
|
|
19
|
+
htmlFor?: string;
|
|
20
20
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -48,5 +48,5 @@ export const Row = React.forwardRef((_a, ref) => {
|
|
|
48
48
|
}
|
|
49
49
|
flexDirection.push('row');
|
|
50
50
|
}
|
|
51
|
-
return (_jsx("div", Object.assign({}, rest, { ref: ref, sx: Object.assign(Object.assign(Object.assign({}, flexStyles), sx), { flexDirection, display: 'flex' })
|
|
51
|
+
return (_jsx("div", Object.assign({}, rest, { ref: ref, sx: Object.assign(Object.assign(Object.assign({}, flexStyles), sx), { flexDirection, display: 'flex' }), children: children })));
|
|
52
52
|
});
|
|
@@ -113,7 +113,7 @@ export const AlertsProvider = ({ domain = ALERT_DOMAIN.LIBRARY, endpoint, startT
|
|
|
113
113
|
const filteredAlerts = alerts
|
|
114
114
|
.filter((alert) => !dismissedAlerts.includes(alert.id))
|
|
115
115
|
.filter((alert) => { var _a; return (_a = alert === null || alert === void 0 ? void 0 : alert.domains) === null || _a === void 0 ? void 0 : _a.includes(domain); });
|
|
116
|
-
return (_jsx(AlertsContext.Provider,
|
|
116
|
+
return (_jsx(AlertsContext.Provider, { value: { alerts: filteredAlerts, dismiss }, children: children }));
|
|
117
117
|
};
|
|
118
118
|
export const useAlerts = (pageAlerts = []) => {
|
|
119
119
|
const { alerts: allAlerts, dismiss } = React.useContext(AlertsContext);
|
|
@@ -33,5 +33,5 @@ export const ComponentConfigContext = createContext(defaultComponentConfig);
|
|
|
33
33
|
export const useComponentConfig = () => useContext(ComponentConfigContext);
|
|
34
34
|
export const ComponentConfigProvider = ({ config: configParam, children }) => {
|
|
35
35
|
const config = useMemo(() => (Object.assign(Object.assign(Object.assign({}, defaultComponentConfig), configParam), { link: Object.assign(Object.assign({}, defaultComponentConfig.link), configParam.link) })), []);
|
|
36
|
-
return (_jsx(ComponentConfigContext.Provider,
|
|
36
|
+
return (_jsx(ComponentConfigContext.Provider, { value: config, children: children }));
|
|
37
37
|
};
|
|
@@ -33,5 +33,5 @@ export const ComponentConfigContextV2 = createContext(defaultComponentConfig);
|
|
|
33
33
|
export const useComponentConfigV2 = () => useContext(ComponentConfigContextV2);
|
|
34
34
|
export const ComponentConfigProviderV2 = ({ config: configParam, children }) => {
|
|
35
35
|
const config = useMemo(() => (Object.assign(Object.assign(Object.assign({}, defaultComponentConfig), configParam), { link: Object.assign(Object.assign({}, defaultComponentConfig.link), configParam.link) })), []);
|
|
36
|
-
return (_jsx(ComponentConfigContextV2.Provider,
|
|
36
|
+
return (_jsx(ComponentConfigContextV2.Provider, { value: config, children: children }));
|
|
37
37
|
};
|
|
@@ -13,11 +13,11 @@ export const DialogsProvider = ({ children }) => {
|
|
|
13
13
|
const close = (key) => {
|
|
14
14
|
setDialogs(Object.assign(Object.assign({}, dialogs), { [key]: { isOpen: false } }));
|
|
15
15
|
};
|
|
16
|
-
return (_jsx(DialogContext.Provider,
|
|
16
|
+
return (_jsx(DialogContext.Provider, { value: {
|
|
17
17
|
dialogs,
|
|
18
18
|
open,
|
|
19
19
|
close,
|
|
20
|
-
}
|
|
20
|
+
}, children: children }));
|
|
21
21
|
};
|
|
22
22
|
export const useDialog = (id) => {
|
|
23
23
|
const dialogs = React.useContext(DialogContext);
|
|
@@ -17,8 +17,8 @@ export const EnvironmentProvider = ({ env, children }) => {
|
|
|
17
17
|
else {
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
return (_jsx(EnvironmentContext.Provider,
|
|
20
|
+
return (_jsx(EnvironmentContext.Provider, { value: {
|
|
21
21
|
env,
|
|
22
22
|
flagInDevelopment,
|
|
23
|
-
}
|
|
23
|
+
}, children: children }));
|
|
24
24
|
};
|
|
@@ -40,9 +40,9 @@ export const MediaSizeProvider = ({ useHydrationPatch, ssrBreakpoint: ssrBreakpo
|
|
|
40
40
|
window.removeEventListener('resize', rerenderOnResize);
|
|
41
41
|
};
|
|
42
42
|
}, []);
|
|
43
|
-
return (_jsx(MediaContext.Provider,
|
|
43
|
+
return (_jsx(MediaContext.Provider, { value: {
|
|
44
44
|
breakpoint,
|
|
45
45
|
screenSize,
|
|
46
|
-
}
|
|
46
|
+
}, children: children }));
|
|
47
47
|
};
|
|
48
48
|
export const useMediaQuery = () => useContext(MediaContext);
|
|
@@ -40,9 +40,9 @@ export const MediaSizeProviderV2 = ({ useHydrationPatch, ssrBreakpoint: ssrBreak
|
|
|
40
40
|
window.removeEventListener('resize', rerenderOnResize);
|
|
41
41
|
};
|
|
42
42
|
}, []);
|
|
43
|
-
return (_jsx(MediaContextV2.Provider,
|
|
43
|
+
return (_jsx(MediaContextV2.Provider, { value: {
|
|
44
44
|
breakpoint,
|
|
45
45
|
screenSize,
|
|
46
|
-
}
|
|
46
|
+
}, children: children }));
|
|
47
47
|
};
|
|
48
48
|
export const useMediaQueryV2 = () => useContext(MediaContextV2);
|
|
@@ -300,5 +300,5 @@ export const MenuProvider = ({ menu, children, }) => {
|
|
|
300
300
|
getMenuProps,
|
|
301
301
|
getMenuItemProps,
|
|
302
302
|
};
|
|
303
|
-
return (_jsx(MenuContext.Provider,
|
|
303
|
+
return (_jsx(MenuContext.Provider, { value: contextValue, children: typeof children === 'function' ? children(contextValue) : children }));
|
|
304
304
|
};
|
|
@@ -41,12 +41,12 @@ export const SnackBarProvider = ({ children, }) => {
|
|
|
41
41
|
removeMessageTimeouts.current.forEach((timeout) => clearTimeout(timeout));
|
|
42
42
|
};
|
|
43
43
|
}, []);
|
|
44
|
-
return (_jsx(SnackBarContext.Provider,
|
|
44
|
+
return (_jsx(SnackBarContext.Provider, { value: {
|
|
45
45
|
messages,
|
|
46
46
|
removeMessage,
|
|
47
47
|
previousMessageCount: previousMessageCount.current,
|
|
48
48
|
addMessage,
|
|
49
|
-
}
|
|
49
|
+
}, children: children }));
|
|
50
50
|
};
|
|
51
51
|
export const useSnackBar = () => {
|
|
52
52
|
return useContext(SnackBarContext);
|
|
@@ -11,6 +11,6 @@ import StructuredData from '../composites/StructuredData';
|
|
|
11
11
|
import { SnackBarProvider } from './snackBar';
|
|
12
12
|
import { UniqueIdProvider } from './uniqueIds';
|
|
13
13
|
export const UiProvider = ({ structuredData, env, components, alertsConfig, children, includeTheme = true, loadFonts, loadGlobalStyles, useHydrationPatch, ssrBreakpoint, }) => {
|
|
14
|
-
const core = (_jsxs(EnvironmentProvider,
|
|
14
|
+
const core = (_jsxs(EnvironmentProvider, { env: env, children: [_jsx(MediaSizeProvider, { ssrBreakpoint: ssrBreakpoint, useHydrationPatch: useHydrationPatch, children: _jsx(ComponentConfigProvider, { config: components || {}, children: _jsx(UniqueIdProvider, { children: _jsx(SnackBarProvider, { children: _jsx(DialogsProvider, { children: _jsx(AlertsProvider, Object.assign({}, alertsConfig, { children: children })) }) }) }) }) }), loadGlobalStyles && _jsx(GlobalStyles, {}), loadFonts && _jsx(FontLoader, {}), structuredData && _jsx(StructuredData, Object.assign({}, structuredData))] }));
|
|
15
15
|
return includeTheme ? _jsx(ThemeProvider, { children: core }) : core;
|
|
16
16
|
};
|