@ultraviolet/ui 1.0.0

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.
Files changed (115) hide show
  1. package/LICENSE +189 -0
  2. package/README.md +64 -0
  3. package/dist/index.d.ts +2427 -0
  4. package/dist/react-datepicker/dist/react-datepicker.min.css.js +3 -0
  5. package/dist/react-toastify/dist/ReactToastify.min.css.js +3 -0
  6. package/dist/src/components/ActionBar/index.js +55 -0
  7. package/dist/src/components/Alert/index.js +144 -0
  8. package/dist/src/components/Avatar/index.js +90 -0
  9. package/dist/src/components/Badge/index.js +143 -0
  10. package/dist/src/components/Banner/index.js +117 -0
  11. package/dist/src/components/BarChart/Tooltip.js +63 -0
  12. package/dist/src/components/BarChart/index.js +94 -0
  13. package/dist/src/components/BarStack/index.js +223 -0
  14. package/dist/src/components/Breadcrumbs/index.js +89 -0
  15. package/dist/src/components/Bullet/index.js +137 -0
  16. package/dist/src/components/Button/index.js +303 -0
  17. package/dist/src/components/Card/index.js +81 -0
  18. package/dist/src/components/Carousel/index.js +162 -0
  19. package/dist/src/components/Checkbox/index.js +338 -0
  20. package/dist/src/components/CopyButton/index.js +92 -0
  21. package/dist/src/components/DateInput/index.js +250 -0
  22. package/dist/src/components/EmptyState/index.js +124 -0
  23. package/dist/src/components/Expandable/index.js +84 -0
  24. package/dist/src/components/Icon/index.js +350 -0
  25. package/dist/src/components/LineChart/CustomLegend.js +147 -0
  26. package/dist/src/components/LineChart/Tooltip.js +58 -0
  27. package/dist/src/components/LineChart/helpers.js +75 -0
  28. package/dist/src/components/LineChart/index.js +139 -0
  29. package/dist/src/components/Link/index.js +159 -0
  30. package/dist/src/components/List/Body.js +22 -0
  31. package/dist/src/components/List/Cell.js +38 -0
  32. package/dist/src/components/List/HeaderCell.js +118 -0
  33. package/dist/src/components/List/HeaderRow.js +47 -0
  34. package/dist/src/components/List/ListContext.js +120 -0
  35. package/dist/src/components/List/Row.js +211 -0
  36. package/dist/src/components/List/SelectBar.js +52 -0
  37. package/dist/src/components/List/SkeletonRows.js +54 -0
  38. package/dist/src/components/List/constants.js +3 -0
  39. package/dist/src/components/List/index.js +77 -0
  40. package/dist/src/components/Loader/index.js +87 -0
  41. package/dist/src/components/Menu/Item.js +122 -0
  42. package/dist/src/components/Menu/index.js +143 -0
  43. package/dist/src/components/Modal/index.js +279 -0
  44. package/dist/src/components/Notice/index.js +33 -0
  45. package/dist/src/components/NumberInput/helpers.js +6 -0
  46. package/dist/src/components/NumberInput/index.js +366 -0
  47. package/dist/src/components/Pagination/getPageNumbers.js +32 -0
  48. package/dist/src/components/Pagination/index.js +118 -0
  49. package/dist/src/components/PasswordCheck/index.js +42 -0
  50. package/dist/src/components/PasswordStrengthMeter/index.js +116 -0
  51. package/dist/src/components/PieChart/Legends.js +183 -0
  52. package/dist/src/components/PieChart/Tooltip.js +64 -0
  53. package/dist/src/components/PieChart/index.js +133 -0
  54. package/dist/src/components/PieChart/patterns.js +9 -0
  55. package/dist/src/components/Popover/index.js +131 -0
  56. package/dist/src/components/ProgressBar/index.js +72 -0
  57. package/dist/src/components/Radio/index.js +231 -0
  58. package/dist/src/components/Row/index.js +43 -0
  59. package/dist/src/components/SelectInput/index.js +662 -0
  60. package/dist/src/components/SelectableCard/index.js +154 -0
  61. package/dist/src/components/Separator/index.js +91 -0
  62. package/dist/src/components/Skeleton/Block.js +53 -0
  63. package/dist/src/components/Skeleton/Blocks.js +52 -0
  64. package/dist/src/components/Skeleton/BoxWithIcon.js +47 -0
  65. package/dist/src/components/Skeleton/Donut.js +58 -0
  66. package/dist/src/components/Skeleton/IconSkeleton.js +37 -0
  67. package/dist/src/components/Skeleton/Line.js +19 -0
  68. package/dist/src/components/Skeleton/List.js +60 -0
  69. package/dist/src/components/Skeleton/Slider.js +57 -0
  70. package/dist/src/components/Skeleton/index.js +85 -0
  71. package/dist/src/components/Snippet/index.js +250 -0
  72. package/dist/src/components/Stack/index.js +24 -0
  73. package/dist/src/components/Status/index.js +101 -0
  74. package/dist/src/components/StepList/index.js +81 -0
  75. package/dist/src/components/Stepper/index.js +217 -0
  76. package/dist/src/components/SwitchButton/FocusOverlay.js +47 -0
  77. package/dist/src/components/SwitchButton/index.js +131 -0
  78. package/dist/src/components/Table/Body.js +12 -0
  79. package/dist/src/components/Table/Cell.js +27 -0
  80. package/dist/src/components/Table/Header.js +21 -0
  81. package/dist/src/components/Table/HeaderCell.js +119 -0
  82. package/dist/src/components/Table/HeaderRow.js +35 -0
  83. package/dist/src/components/Table/Row.js +70 -0
  84. package/dist/src/components/Table/SelectBar.js +52 -0
  85. package/dist/src/components/Table/SkeletonRows.js +52 -0
  86. package/dist/src/components/Table/TableContext.js +91 -0
  87. package/dist/src/components/Table/index.js +84 -0
  88. package/dist/src/components/Tabs/Tab.js +165 -0
  89. package/dist/src/components/Tabs/TabMenu.js +46 -0
  90. package/dist/src/components/Tabs/TabMenuItem.js +40 -0
  91. package/dist/src/components/Tabs/TabsContext.js +6 -0
  92. package/dist/src/components/Tabs/index.js +117 -0
  93. package/dist/src/components/Tag/index.js +177 -0
  94. package/dist/src/components/TagInput/index.js +277 -0
  95. package/dist/src/components/TagList/index.js +110 -0
  96. package/dist/src/components/Text/index.js +106 -0
  97. package/dist/src/components/TextInput/index.js +529 -0
  98. package/dist/src/components/TimeInput/index.js +38 -0
  99. package/dist/src/components/Toaster/index.js +116 -0
  100. package/dist/src/components/Toggle/index.js +192 -0
  101. package/dist/src/components/Tooltip/helpers.js +131 -0
  102. package/dist/src/components/Tooltip/index.js +275 -0
  103. package/dist/src/components/VerificationCode/index.js +203 -0
  104. package/dist/src/helpers/isJSON.js +11 -0
  105. package/dist/src/helpers/legend.js +13 -0
  106. package/dist/src/helpers/recursivelyGetChildrenString.js +12 -0
  107. package/dist/src/index.js +63 -0
  108. package/dist/src/theme/index.js +25 -0
  109. package/dist/src/utils/animations.js +250 -0
  110. package/dist/src/utils/capitalize.js +4 -0
  111. package/dist/src/utils/ids.js +12 -0
  112. package/dist/src/utils/normalize.js +36 -0
  113. package/dist/src/utils/responsive/Breakpoint.js +12 -0
  114. package/dist/src/utils/responsive/utilities.js +12 -0
  115. package/package.json +70 -0
@@ -0,0 +1,118 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { Icon } from '../Icon/index.js';
3
+ import { Stack } from '../Stack/index.js';
4
+ import { Tooltip } from '../Tooltip/index.js';
5
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
6
+
7
+ const ArrowDownIcon = /*#__PURE__*/_styled(Icon, {
8
+ target: "e1q5cnom3"
9
+ })();
10
+ const ArrowUpIcon = /*#__PURE__*/_styled(Icon, {
11
+ target: "e1q5cnom2"
12
+ })();
13
+ const StyledIconContainer = /*#__PURE__*/_styled(Stack, {
14
+ target: "e1q5cnom1"
15
+ })("color:", _ref => {
16
+ let {
17
+ theme
18
+ } = _ref;
19
+ return theme.colors.neutral.textWeak;
20
+ }, ";&[aria-disabled='true']{cursor:not-allowed;}");
21
+ const SortIcon = () => jsxs(StyledIconContainer, {
22
+ children: [jsx(ArrowUpIcon, {
23
+ name: "arrow-up",
24
+ size: 10
25
+ }), jsx(ArrowDownIcon, {
26
+ name: "arrow-down",
27
+ size: 10
28
+ })]
29
+ });
30
+ const StyledHeaderCell = /*#__PURE__*/_styled("div", {
31
+ target: "e1q5cnom0"
32
+ })("display:flex;text-align:left;flex-direction:row;align-items:center;font-size:", _ref2 => {
33
+ let {
34
+ theme
35
+ } = _ref2;
36
+ return theme.typography.bodySmall.fontSize;
37
+ }, ";font-weight:", _ref3 => {
38
+ let {
39
+ theme
40
+ } = _ref3;
41
+ return theme.typography.bodySmall.weight;
42
+ }, ";font-family:", _ref4 => {
43
+ let {
44
+ theme
45
+ } = _ref4;
46
+ return theme.typography.bodySmall.fontFamily;
47
+ }, ";color:", _ref5 => {
48
+ let {
49
+ theme
50
+ } = _ref5;
51
+ return theme.colors.neutral.textWeak;
52
+ }, ";gap:", _ref6 => {
53
+ let {
54
+ theme
55
+ } = _ref6;
56
+ return theme.space['1'];
57
+ }, ";&[role*='button']{cursor:pointer;user-select:none;}&[aria-sort]{color:", _ref7 => {
58
+ let {
59
+ theme
60
+ } = _ref7;
61
+ return theme.colors.primary.textWeak;
62
+ }, ";}&[aria-sort='ascending'] ", ArrowUpIcon, "{color:", _ref8 => {
63
+ let {
64
+ theme
65
+ } = _ref8;
66
+ return theme.colors.primary.textWeak;
67
+ }, ";}&[aria-sort='descending'] ", ArrowDownIcon, "{color:", _ref9 => {
68
+ let {
69
+ theme
70
+ } = _ref9;
71
+ return theme.colors.primary.textWeak;
72
+ }, ";}");
73
+ const HeaderCell = _ref10 => {
74
+ let {
75
+ children,
76
+ isOrdered,
77
+ orderDirection,
78
+ onOrder,
79
+ className,
80
+ info
81
+ } = _ref10;
82
+ let order;
83
+ if (isOrdered && orderDirection === 'asc') {
84
+ order = 'ascending';
85
+ } else if (isOrdered && orderDirection === 'desc') {
86
+ order = 'descending';
87
+ }
88
+ const handleOrder = onOrder ? () => onOrder(order === 'ascending' ? 'desc' : 'asc') : undefined;
89
+ return jsxs(StyledHeaderCell, {
90
+ "aria-sort": order,
91
+ className: className,
92
+ onClick: handleOrder,
93
+ onKeyDown: handleOrder ? event => {
94
+ if (event.key === ' ' || event.key === 'Enter') {
95
+ handleOrder();
96
+ if (event.key === ' ') {
97
+ // @note: it avoid scroll when pressing Space
98
+ event.preventDefault();
99
+ }
100
+ }
101
+ } : undefined,
102
+ role: onOrder ? 'button columnheader' : undefined,
103
+ tabIndex: handleOrder ? 0 : -1,
104
+ children: [children, info ? jsx(Tooltip, {
105
+ text: info,
106
+ children: jsx(Icon, {
107
+ name: "information-outline",
108
+ size: 20,
109
+ prominence: "weak",
110
+ color: "neutral"
111
+ })
112
+ }) : null, orderDirection !== undefined && isOrdered !== undefined ? jsx(SortIcon, {
113
+ "data-sorted": order !== undefined
114
+ }) : null]
115
+ });
116
+ };
117
+
118
+ export { HeaderCell };
@@ -0,0 +1,47 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { Checkbox } from '../Checkbox/index.js';
3
+ import { HeaderCell } from './HeaderCell.js';
4
+ import { useListContext } from './ListContext.js';
5
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
6
+
7
+ const StyledHeaderRow = /*#__PURE__*/_styled("div", {
8
+ target: "epvvdb70"
9
+ })("column-gap:", _ref => {
10
+ let {
11
+ theme
12
+ } = _ref;
13
+ return theme.space['2'];
14
+ }, ";padding:0 ", _ref2 => {
15
+ let {
16
+ theme
17
+ } = _ref2;
18
+ return theme.space['2'];
19
+ }, ";");
20
+ const HeaderRow = _ref3 => {
21
+ let {
22
+ children,
23
+ hasSelectAllColumn
24
+ } = _ref3;
25
+ const {
26
+ allRowSelectValue,
27
+ selectAll,
28
+ unselectAll,
29
+ selectedRowIds
30
+ } = useListContext();
31
+ const selectableRowCount = Object.keys(selectedRowIds).length;
32
+ return jsxs(StyledHeaderRow, {
33
+ role: "row",
34
+ children: [hasSelectAllColumn ? jsx(HeaderCell, {
35
+ children: jsx(Checkbox, {
36
+ name: "list-select-checkbox",
37
+ value: "all",
38
+ "aria-label": "select all",
39
+ checked: allRowSelectValue,
40
+ onChange: allRowSelectValue === false ? selectAll : unselectAll,
41
+ disabled: selectableRowCount === 0
42
+ })
43
+ }) : null, children]
44
+ });
45
+ };
46
+
47
+ export { HeaderRow };
@@ -0,0 +1,120 @@
1
+ import { useContext, createContext, useState, useCallback, useMemo } from 'react';
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+
4
+ const ListContext = /*#__PURE__*/createContext(undefined);
5
+ const ListProvider = _ref => {
6
+ let {
7
+ children,
8
+ autoCollapse,
9
+ selectable
10
+ } = _ref;
11
+ const [expandedRowIds, setExpandedRowIds] = useState({});
12
+ const [selectedRowIds, setSelectedRowIds] = useState({});
13
+ const registerExpandableRow = useCallback(rowId => {
14
+ setExpandedRowIds(current => ({
15
+ ...current,
16
+ [rowId]: false
17
+ }));
18
+ return () => {
19
+ setExpandedRowIds(current => {
20
+ const {
21
+ [rowId]: relatedId,
22
+ ...otherIds
23
+ } = current;
24
+ return otherIds;
25
+ });
26
+ };
27
+ }, []);
28
+ const registerSelectableRow = useCallback(rowId => {
29
+ setSelectedRowIds(current => ({
30
+ ...current,
31
+ [rowId]: false
32
+ }));
33
+ return () => {
34
+ setSelectedRowIds(current => {
35
+ const {
36
+ [rowId]: relatedId,
37
+ ...otherIds
38
+ } = current;
39
+ return otherIds;
40
+ });
41
+ };
42
+ }, []);
43
+ const expandRow = useCallback(rowId => {
44
+ setExpandedRowIds(current => ({
45
+ ...(autoCollapse ? {} : current),
46
+ [rowId]: true
47
+ }));
48
+ }, [autoCollapse]);
49
+ const collapseRow = useCallback(rowId => {
50
+ setExpandedRowIds(current => ({
51
+ ...current,
52
+ [rowId]: false
53
+ }));
54
+ }, []);
55
+ const allRowSelectValue = useMemo(() => {
56
+ const selectableRowCount = Object.keys(selectedRowIds).length;
57
+ if (!selectableRowCount) {
58
+ return false;
59
+ }
60
+ const selectedRowCount = Object.values(selectedRowIds).reduce((acc, isSelected) => acc + (isSelected ? 1 : 0), 0);
61
+ if (selectedRowCount === 0) {
62
+ return false;
63
+ }
64
+ if (selectableRowCount === selectedRowCount) {
65
+ return true;
66
+ }
67
+ return 'indeterminate';
68
+ }, [selectedRowIds]);
69
+ const selectAll = useCallback(() => {
70
+ setSelectedRowIds(current => Object.keys(current).reduce((acc, rowId) => ({
71
+ ...acc,
72
+ [rowId]: true
73
+ }), {}));
74
+ }, []);
75
+ const unselectAll = useCallback(() => {
76
+ setSelectedRowIds(current => Object.keys(current).reduce((acc, rowId) => ({
77
+ ...acc,
78
+ [rowId]: false
79
+ }), {}));
80
+ }, []);
81
+ const selectRow = useCallback(rowId => {
82
+ setSelectedRowIds(current => ({
83
+ ...current,
84
+ [rowId]: true
85
+ }));
86
+ }, []);
87
+ const unselectRow = useCallback(rowId => {
88
+ setSelectedRowIds(current => ({
89
+ ...current,
90
+ [rowId]: false
91
+ }));
92
+ }, []);
93
+ const value = useMemo(() => ({
94
+ registerExpandableRow,
95
+ expandedRowIds,
96
+ expandRow,
97
+ collapseRow,
98
+ registerSelectableRow,
99
+ selectedRowIds,
100
+ selectRow,
101
+ unselectRow,
102
+ selectable,
103
+ selectAll,
104
+ unselectAll,
105
+ allRowSelectValue
106
+ }), [registerExpandableRow, expandedRowIds, expandRow, collapseRow, registerSelectableRow, selectedRowIds, selectRow, unselectRow, selectable, selectAll, unselectAll, allRowSelectValue]);
107
+ return jsx(ListContext.Provider, {
108
+ value: value,
109
+ children: children
110
+ });
111
+ };
112
+ const useListContext = () => {
113
+ const context = useContext(ListContext);
114
+ if (!context) {
115
+ throw new Error('useListContext should be used inside a List component');
116
+ }
117
+ return context;
118
+ };
119
+
120
+ export { ListProvider, useListContext };
@@ -0,0 +1,211 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { forwardRef, useEffect } from 'react';
3
+ import { Checkbox } from '../Checkbox/index.js';
4
+ import { Tooltip } from '../Tooltip/index.js';
5
+ import { Cell } from './Cell.js';
6
+ import { useListContext } from './ListContext.js';
7
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
8
+
9
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
10
+ const ExpandableWrapper = /*#__PURE__*/_styled("div", {
11
+ target: "ei4uyz12"
12
+ })("grid-column:1/-1;grid-column-start:1;border-top:1px solid ", _ref => {
13
+ let {
14
+ theme
15
+ } = _ref;
16
+ return theme.colors.neutral.borderWeak;
17
+ }, ";margin:0 -", _ref2 => {
18
+ let {
19
+ theme
20
+ } = _ref2;
21
+ return theme.space['2'];
22
+ }, ";padding:", _ref3 => {
23
+ let {
24
+ theme
25
+ } = _ref3;
26
+ return theme.space['2'];
27
+ }, ";cursor:auto;");
28
+ const StyledRow = /*#__PURE__*/_styled('div', {
29
+ shouldForwardProp: prop => !['sentiment'].includes(prop),
30
+ target: "ei4uyz11"
31
+ })("position:relative;border:1px solid ", _ref4 => {
32
+ let {
33
+ theme
34
+ } = _ref4;
35
+ return theme.colors.neutral.borderWeak;
36
+ }, ";border-radius:", _ref5 => {
37
+ let {
38
+ theme
39
+ } = _ref5;
40
+ return theme.radii.default;
41
+ }, ";transition:box-shadow 200ms ease,border-color 200ms ease;box-shadow:none;background-color:", _ref6 => {
42
+ let {
43
+ theme
44
+ } = _ref6;
45
+ return theme.colors.neutral.background;
46
+ }, ";font-size:", _ref7 => {
47
+ let {
48
+ theme
49
+ } = _ref7;
50
+ return theme.typography.bodySmall.fontSize;
51
+ }, ";column-gap:", _ref8 => {
52
+ let {
53
+ theme
54
+ } = _ref8;
55
+ return theme.space['2'];
56
+ }, ";padding:0 ", _ref9 => {
57
+ let {
58
+ theme
59
+ } = _ref9;
60
+ return theme.space['2'];
61
+ }, ";&[role='button row']{cursor:pointer;}", _ref10 => {
62
+ let {
63
+ theme,
64
+ sentiment
65
+ } = _ref10;
66
+ return `
67
+ color: ${theme.colors[sentiment].text};
68
+ border-color: ${theme.colors[sentiment].border};
69
+ background-color: ${theme.colors[sentiment].background};
70
+ & [data-expandable-content] {
71
+ border-color: ${theme.colors[sentiment].border};
72
+ }
73
+
74
+ ${sentiment === 'neutral' ? `&:hover {
75
+ border-color: ${theme.colors.primary.border};
76
+ box-shadow: ${theme.shadows.hoverPrimary};
77
+ }
78
+ ` : ''}
79
+ `;
80
+ }, " &[data-highlight='true']{border-color:", _ref11 => {
81
+ let {
82
+ theme
83
+ } = _ref11;
84
+ return theme.colors.primary.border;
85
+ }, ";box-shadow:", _ref12 => {
86
+ let {
87
+ theme
88
+ } = _ref12;
89
+ return theme.shadows.hoverPrimary;
90
+ }, ";}&[aria-disabled='true']{border:1px solid ", _ref13 => {
91
+ let {
92
+ theme
93
+ } = _ref13;
94
+ return theme.colors.neutral.borderDisabled;
95
+ }, ";background-color:", _ref14 => {
96
+ let {
97
+ theme
98
+ } = _ref14;
99
+ return theme.colors.neutral.backgroundDisabled;
100
+ }, ";color:", _ref15 => {
101
+ let {
102
+ theme
103
+ } = _ref15;
104
+ return theme.colors.neutral.textDisabled;
105
+ }, ";cursor:not-allowed;}& [data-visibility='hover']{opacity:0;}&:hover:not([aria-disabled='true']) [data-visibility='hover']{opacity:1;}");
106
+ const StyledCheckboxContainer = /*#__PURE__*/_styled("div", {
107
+ target: "ei4uyz10"
108
+ })(process.env.NODE_ENV === "production" ? {
109
+ name: "zjik7",
110
+ styles: "display:flex"
111
+ } : {
112
+ name: "zjik7",
113
+ styles: "display:flex",
114
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
115
+ });
116
+ const Row = /*#__PURE__*/forwardRef((_ref16, ref) => {
117
+ let {
118
+ children,
119
+ id,
120
+ expandable,
121
+ disabled,
122
+ selectDisabled,
123
+ sentiment = 'neutral',
124
+ className,
125
+ 'data-testid': dataTestid
126
+ } = _ref16;
127
+ const {
128
+ allRowSelectValue,
129
+ selectable,
130
+ registerExpandableRow,
131
+ expandedRowIds,
132
+ expandRow,
133
+ collapseRow,
134
+ registerSelectableRow,
135
+ selectedRowIds,
136
+ selectRow,
137
+ unselectRow
138
+ } = useListContext();
139
+ const isSelectDisabled = disabled || selectDisabled !== undefined && selectDisabled !== false;
140
+ const hasExpandable = !!expandable;
141
+ useEffect(() => {
142
+ if (hasExpandable) {
143
+ const unregisterCallback = registerExpandableRow(id);
144
+ return unregisterCallback;
145
+ }
146
+ return undefined;
147
+ }, [id, hasExpandable, registerExpandableRow]);
148
+ useEffect(() => {
149
+ if (!isSelectDisabled) {
150
+ const unregisterCallback = registerSelectableRow(id);
151
+ return unregisterCallback;
152
+ }
153
+ return undefined;
154
+ }, [id, registerSelectableRow, isSelectDisabled]);
155
+ const toggleRowExpand = () => {
156
+ if (expandedRowIds[id]) {
157
+ collapseRow(id);
158
+ } else {
159
+ expandRow(id);
160
+ }
161
+ };
162
+ return jsxs(StyledRow, {
163
+ className: className,
164
+ ref: ref,
165
+ role: !disabled && expandable ? 'button row' : 'row',
166
+ onClick: !disabled && expandable ? toggleRowExpand : undefined,
167
+ onKeyDown: !disabled && expandable ? event => {
168
+ if (event.key === ' ') {
169
+ toggleRowExpand();
170
+ event.preventDefault();
171
+ }
172
+ } : undefined,
173
+ tabIndex: !disabled && expandable ? 0 : -1,
174
+ sentiment: sentiment,
175
+ "aria-disabled": disabled,
176
+ "aria-expanded": expandable ? expandedRowIds[id] : undefined,
177
+ "data-highlight": !!selectedRowIds[id],
178
+ "data-testid": dataTestid,
179
+ children: [selectable ? jsx(Cell, {
180
+ preventClick: true,
181
+ children: jsx(StyledCheckboxContainer, {
182
+ "data-visibility": allRowSelectValue === false ? 'hover' : undefined,
183
+ children: jsx(Tooltip, {
184
+ text: typeof selectDisabled === 'string' ? selectDisabled : undefined,
185
+ children: jsx(Checkbox, {
186
+ name: "list-select-checkbox",
187
+ "aria-label": "select",
188
+ checked: selectedRowIds[id],
189
+ value: id,
190
+ onChange: () => {
191
+ if (selectedRowIds[id]) {
192
+ unselectRow(id);
193
+ } else {
194
+ selectRow(id);
195
+ }
196
+ },
197
+ disabled: isSelectDisabled
198
+ })
199
+ })
200
+ })
201
+ }) : null, children, expandable && expandedRowIds[id] ? jsx(ExpandableWrapper, {
202
+ "data-expandable-content": true,
203
+ onClick: e => {
204
+ e.stopPropagation();
205
+ },
206
+ children: expandable
207
+ }) : null]
208
+ });
209
+ });
210
+
211
+ export { Row, StyledRow };
@@ -0,0 +1,52 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { useMemo } from 'react';
3
+ import { ActionBar } from '../ActionBar/index.js';
4
+ import { useListContext } from './ListContext.js';
5
+ import { jsx } from '@emotion/react/jsx-runtime';
6
+
7
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
8
+ const StyledActionBar = /*#__PURE__*/_styled(ActionBar, {
9
+ target: "eo69e461"
10
+ })("display:flex;align-items:center;padding:0 ", _ref => {
11
+ let {
12
+ theme
13
+ } = _ref;
14
+ return theme.space['1'];
15
+ }, ";");
16
+ const FlexDiv = /*#__PURE__*/_styled("div", {
17
+ target: "eo69e460"
18
+ })(process.env.NODE_ENV === "production" ? {
19
+ name: "82a6rk",
20
+ styles: "flex:1"
21
+ } : {
22
+ name: "82a6rk",
23
+ styles: "flex:1",
24
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
25
+ });
26
+ function SelectBar(_ref2) {
27
+ let {
28
+ children,
29
+ data,
30
+ idKey,
31
+ className
32
+ } = _ref2;
33
+ const {
34
+ selectedRowIds,
35
+ unselectAll
36
+ } = useListContext();
37
+ const selectedItems = useMemo(() => data.filter(item => selectedRowIds[item[idKey]]), [data, idKey, selectedRowIds]);
38
+ if (selectedItems.length === 0) {
39
+ return null;
40
+ }
41
+ return jsx(StyledActionBar, {
42
+ className: className,
43
+ children: jsx(FlexDiv, {
44
+ children: children({
45
+ selectedItems,
46
+ unselectAll
47
+ })
48
+ })
49
+ });
50
+ }
51
+
52
+ export { SelectBar };
@@ -0,0 +1,54 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { Skeleton } from '../Skeleton/index.js';
3
+ import { Cell } from './Cell.js';
4
+ import { StyledRow } from './Row.js';
5
+ import { jsx, Fragment, jsxs } from '@emotion/react/jsx-runtime';
6
+
7
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
8
+ const StyledLoadingRow = /*#__PURE__*/_styled(StyledRow, {
9
+ target: "efawmbb1"
10
+ })(process.env.NODE_ENV === "production" ? {
11
+ name: "g8zzui",
12
+ styles: "cursor:progress"
13
+ } : {
14
+ name: "g8zzui",
15
+ styles: "cursor:progress",
16
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
17
+ });
18
+ const StyledSkeleton = /*#__PURE__*/_styled(Skeleton, {
19
+ target: "efawmbb0"
20
+ })(process.env.NODE_ENV === "production" ? {
21
+ name: "bet25o",
22
+ styles: "width:80%;max-width:100%"
23
+ } : {
24
+ name: "bet25o",
25
+ styles: "width:80%;max-width:100%",
26
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
27
+ });
28
+ const SkeletonRows = _ref => {
29
+ let {
30
+ selectable,
31
+ rows,
32
+ cols
33
+ } = _ref;
34
+ const rowArray = Array.from({
35
+ length: rows
36
+ }, (_, index) => index);
37
+ const colArray = Array.from({
38
+ length: cols
39
+ }, (_, index) => index);
40
+ return jsx(Fragment, {
41
+ children: rowArray.map(index => jsxs(StyledLoadingRow, {
42
+ sentiment: "neutral",
43
+ role: "row",
44
+ id: `skeleton-${index}`,
45
+ children: [selectable ? jsx("div", {}) : null, colArray.map(columnIndex => jsx(Cell, {
46
+ children: jsx(StyledSkeleton, {
47
+ variant: "line"
48
+ })
49
+ }, columnIndex))]
50
+ }, index))
51
+ });
52
+ };
53
+
54
+ export { SkeletonRows };
@@ -0,0 +1,3 @@
1
+ const SELECTABLE_CHECKBOX_SIZE = 24;
2
+
3
+ export { SELECTABLE_CHECKBOX_SIZE };
@@ -0,0 +1,77 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { forwardRef } from 'react';
3
+ import { Body } from './Body.js';
4
+ import { Cell } from './Cell.js';
5
+ import { HeaderCell } from './HeaderCell.js';
6
+ import { HeaderRow } from './HeaderRow.js';
7
+ import { useListContext, ListProvider } from './ListContext.js';
8
+ import { Row } from './Row.js';
9
+ import { SelectBar } from './SelectBar.js';
10
+ import { SkeletonRows } from './SkeletonRows.js';
11
+ import { SELECTABLE_CHECKBOX_SIZE } from './constants.js';
12
+ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
13
+
14
+ const StyledList = /*#__PURE__*/_styled('div', {
15
+ shouldForwardProp: prop => !['template'].includes(prop),
16
+ target: "ef5qi0"
17
+ })("display:flex;flex-flow:column nowrap;width:100%;gap:", _ref => {
18
+ let {
19
+ theme
20
+ } = _ref;
21
+ return theme.space['1'];
22
+ }, ";[role='row'],[role='button row']{display:grid;width:100%;grid-template-columns:", _ref2 => {
23
+ let {
24
+ template
25
+ } = _ref2;
26
+ return template;
27
+ }, ";align-items:center;}");
28
+ const BaseList = /*#__PURE__*/forwardRef((_ref3, ref) => {
29
+ let {
30
+ selectable = false,
31
+ columns,
32
+ children,
33
+ loading,
34
+ autoCollapse = false
35
+ } = _ref3;
36
+ const computeTemplate = `${selectable ? `${SELECTABLE_CHECKBOX_SIZE}px ` : ''}${columns.map(_ref4 => {
37
+ let {
38
+ width
39
+ } = _ref4;
40
+ return width ?? 'minmax(0, 1fr)';
41
+ }).join(' ')}`;
42
+ return jsx(ListProvider, {
43
+ selectable: selectable,
44
+ autoCollapse: autoCollapse,
45
+ children: jsxs(StyledList, {
46
+ ref: ref,
47
+ role: "grid",
48
+ template: computeTemplate,
49
+ children: [jsx(HeaderRow, {
50
+ hasSelectAllColumn: selectable,
51
+ children: columns.map((column, index) => jsx(HeaderCell
52
+ // eslint-disable-next-line react/no-array-index-key
53
+ , {
54
+ isOrdered: column.isOrdered,
55
+ orderDirection: column.orderDirection,
56
+ onOrder: column.onOrder,
57
+ info: column.info,
58
+ children: column.label
59
+ }, `header-column-${index}`))
60
+ }), jsx(Body, {
61
+ children: loading ? jsx(SkeletonRows, {
62
+ selectable: selectable,
63
+ rows: 5,
64
+ cols: columns.length
65
+ }) : children
66
+ })]
67
+ })
68
+ });
69
+ });
70
+ const List = /*#__PURE__*/Object.assign(BaseList, {
71
+ Row,
72
+ Cell,
73
+ SelectBar,
74
+ useListContext
75
+ });
76
+
77
+ export { List };