@databricks/design-system 1.9.2 → 1.10.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.
- package/dist/{Typography-74e19785.js → Spinner-140f57ac.js} +1080 -27
- package/dist/Spinner-140f57ac.js.map +1 -0
- package/dist/common-3ab0e300.js +15 -0
- package/dist/common-3ab0e300.js.map +1 -0
- package/dist/design-system/Button/Button.d.ts +5 -1
- package/dist/design-system/Button/Button.d.ts.map +1 -1
- package/dist/design-system/Button/styles.d.ts.map +1 -1
- package/dist/design-system/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/design-system/DatePicker/DatePicker.d.ts +18 -14
- package/dist/design-system/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/design-system/Drawer/Drawer.d.ts +6 -1
- package/dist/design-system/Drawer/Drawer.d.ts.map +1 -1
- package/dist/design-system/FormV2/RHFAdapters.d.ts +7 -7
- package/dist/design-system/FormV2/RHFAdapters.d.ts.map +1 -1
- package/dist/design-system/Icon/__generated/icons/index.d.ts +0 -35
- package/dist/design-system/Icon/__generated/icons/index.d.ts.map +1 -1
- package/dist/design-system/LegacyTable/LegacyTable.d.ts +100 -0
- package/dist/design-system/LegacyTable/LegacyTable.d.ts.map +1 -0
- package/dist/design-system/LegacyTable/index.d.ts +2 -0
- package/dist/design-system/LegacyTable/index.d.ts.map +1 -0
- package/dist/design-system/Modal/Modal.d.ts +3 -1
- package/dist/design-system/Modal/Modal.d.ts.map +1 -1
- package/dist/design-system/Notification/Notification.d.ts.map +1 -1
- package/dist/design-system/PageWrapper/PageWrapper.d.ts.map +1 -1
- package/dist/design-system/PopoverV2/PopoverV2.d.ts +1 -0
- package/dist/design-system/PopoverV2/PopoverV2.d.ts.map +1 -1
- package/dist/design-system/Radio/Radio.d.ts.map +1 -1
- package/dist/design-system/SegmentedControl/SegmentedControl.d.ts +0 -2
- package/dist/design-system/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/design-system/SplitButton/Dropdown/DropdownButton.d.ts.map +1 -1
- package/dist/design-system/Table/index.d.ts +1 -1
- package/dist/design-system/index.d.ts +1 -1
- package/dist/design-system/index.d.ts.map +1 -1
- package/dist/development/Filter/Filter.d.ts +10 -0
- package/dist/development/Filter/Filter.d.ts.map +1 -0
- package/dist/development/Filter/Filter.test.d.ts +2 -0
- package/dist/development/Filter/Filter.test.d.ts.map +1 -0
- package/dist/development/Filter/FilterButtonContainer.d.ts +2 -0
- package/dist/development/Filter/FilterButtonContainer.d.ts.map +1 -0
- package/dist/development/Filter/FilterContent.d.ts +14 -0
- package/dist/development/Filter/FilterContent.d.ts.map +1 -0
- package/dist/development/Filter/FilterCountBadge.d.ts +2 -0
- package/dist/development/Filter/FilterCountBadge.d.ts.map +1 -0
- package/dist/development/Filter/FilterLoadingSpinner.d.ts +2 -0
- package/dist/development/Filter/FilterLoadingSpinner.d.ts.map +1 -0
- package/dist/development/Filter/FilterOptionControlledList.d.ts +9 -0
- package/dist/development/Filter/FilterOptionControlledList.d.ts.map +1 -0
- package/dist/development/Filter/FilterOptionList.d.ts +10 -0
- package/dist/development/Filter/FilterOptionList.d.ts.map +1 -0
- package/dist/development/Filter/FilterOptionListCheckboxItem.d.ts +11 -0
- package/dist/development/Filter/FilterOptionListCheckboxItem.d.ts.map +1 -0
- package/dist/development/Filter/FilterOptionListSearch.d.ts +7 -0
- package/dist/development/Filter/FilterOptionListSearch.d.ts.map +1 -0
- package/dist/development/Filter/FilterOptionListSelectItem.d.ts +10 -0
- package/dist/development/Filter/FilterOptionListSelectItem.d.ts.map +1 -0
- package/dist/development/Filter/FilterSectionHeader.d.ts +2 -0
- package/dist/development/Filter/FilterSectionHeader.d.ts.map +1 -0
- package/dist/development/Filter/FilterSeparator.d.ts +2 -0
- package/dist/development/Filter/FilterSeparator.d.ts.map +1 -0
- package/dist/development/Filter/FilterTrigger.d.ts +15 -0
- package/dist/development/Filter/FilterTrigger.d.ts.map +1 -0
- package/dist/development/Filter/hooks/useFilterContext.d.ts +2 -0
- package/dist/development/Filter/hooks/useFilterContext.d.ts.map +1 -0
- package/dist/development/Filter/hooks/useFilterOptionListContext.d.ts +2 -0
- package/dist/development/Filter/hooks/useFilterOptionListContext.d.ts.map +1 -0
- package/dist/development/Filter/index.d.ts +14 -0
- package/dist/development/Filter/index.d.ts.map +1 -0
- package/dist/development/Filter/providers/FilterContext.d.ts +15 -0
- package/dist/development/Filter/providers/FilterContext.d.ts.map +1 -0
- package/dist/development/Filter/providers/FilterOptionListContext.d.ts +10 -0
- package/dist/development/Filter/providers/FilterOptionListContext.d.ts.map +1 -0
- package/dist/development/Filter/shared.d.ts +3 -0
- package/dist/development/Filter/shared.d.ts.map +1 -0
- package/dist/development/TableUI/index.d.ts +19 -0
- package/dist/development/TableUI/index.d.ts.map +1 -1
- package/dist/development/index.d.ts +1 -0
- package/dist/development/index.d.ts.map +1 -1
- package/dist/development.js +1052 -52
- package/dist/development.js.map +1 -1
- package/dist/index.js +573 -1523
- package/dist/index.js.map +1 -1
- package/dist/test-utils/common.d.ts +11 -0
- package/dist/test-utils/common.d.ts.map +1 -0
- package/dist/test-utils/enzyme/index.d.ts +1 -0
- package/dist/test-utils/enzyme/index.d.ts.map +1 -1
- package/dist/test-utils/enzyme/selectEvent.d.ts +42 -0
- package/dist/test-utils/enzyme/selectEvent.d.ts.map +1 -0
- package/dist/test-utils/enzyme/selectEvent.test.d.ts +2 -0
- package/dist/test-utils/enzyme/selectEvent.test.d.ts.map +1 -0
- package/dist/test-utils/enzyme/utils.d.ts +33 -0
- package/dist/test-utils/enzyme/utils.d.ts.map +1 -0
- package/dist/test-utils/enzyme.js +258 -1
- package/dist/test-utils/enzyme.js.map +1 -1
- package/dist/test-utils/rtl/index.d.ts +1 -0
- package/dist/test-utils/rtl/index.d.ts.map +1 -1
- package/dist/test-utils/rtl/selectEvent.d.ts +41 -0
- package/dist/test-utils/rtl/selectEvent.d.ts.map +1 -0
- package/dist/test-utils/rtl/selectEvent.test.d.ts +2 -0
- package/dist/test-utils/rtl/selectEvent.test.d.ts.map +1 -0
- package/dist/test-utils/rtl.js +135 -1
- package/dist/test-utils/rtl.js.map +1 -1
- package/dist/test-utils/types.d.ts +1 -14
- package/dist/test-utils/types.d.ts.map +1 -1
- package/dist/theme/colorList.d.ts +6 -7
- package/dist/theme/colorList.d.ts.map +1 -1
- package/dist/theme/colors.d.ts +6 -7
- package/dist/theme/colors.d.ts.map +1 -1
- package/package.json +5 -4
- package/dist/Typography-04e40f87.js +0 -1465
- package/dist/Typography-04e40f87.js.map +0 -1
- package/dist/Typography-52abe0b7.js +0 -1142
- package/dist/Typography-52abe0b7.js.map +0 -1
- package/dist/Typography-74e19785.js.map +0 -1
- package/dist/Typography-84a00e02.js +0 -1465
- package/dist/Typography-84a00e02.js.map +0 -1
- package/dist/design-system/Icon/__generated/icons/ArrayIcon.v2.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/ArrayIcon.v2.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/BookmarkBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/BookmarkBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/BracketsIcon.v2.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/BracketsIcon.v2.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/CheckCircleBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/CheckCircleBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/ClusterIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/ClusterIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/ClustersIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/ClustersIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/DataMarketplace.v2.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/DataMarketplace.v2.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/ErrorBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/ErrorBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/ErrorFillIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/ErrorFillIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/ExperimentIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/ExperimentIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/Folder1Icon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/Folder1Icon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/Gear1Icon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/Gear1Icon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/InfoBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/InfoBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/LifesaverIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/LifesaverIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/LinkRemoveIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/LinkRemoveIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/LockBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/LockBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/MinusCircleBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/MinusCircleBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/NotificationsOffIcon.v2.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/NotificationsOffIcon.v2.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/PinBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/PinBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/PlayCircleBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/PlayCircleBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/PlusCircleBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/PlusCircleBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/QueryListViewIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/QueryListViewIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/QueryNavIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/QueryNavIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/QuestionMarkBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/QuestionMarkBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/Redo.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/Redo.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/RedoIcon.v2.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/RedoIcon.v2.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/Refresh.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/Refresh.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/Refresh.v2.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/Refresh.v2.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/RefreshIcon.v2.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/RefreshIcon.v2.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/Search1Icon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/Search1Icon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/StarBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/StarBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/StopCircleBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/StopCircleBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/StopCricleFillIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/StopCricleFillIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/Undo.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/Undo.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/Visible.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/Visible.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/VisibleOff.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/VisibleOff.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/WarningBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/WarningBorderIcon.d.ts.map +0 -1
- package/dist/design-system/Icon/__generated/icons/XCircleBorderIcon.d.ts +0 -4
- package/dist/design-system/Icon/__generated/icons/XCircleBorderIcon.d.ts.map +0 -1
- package/dist/test-utils/enzyme.d.ts +0 -8
- package/dist/test-utils/enzyme.d.ts.map +0 -1
- package/dist/test-utils/rtl.d.ts +0 -7
- package/dist/test-utils/rtl.d.ts.map +0 -1
package/dist/development.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { useContext,
|
|
3
|
-
import { jsx,
|
|
4
|
-
import { u as useDesignSystemTheme,
|
|
2
|
+
import React__default, { createContext, useContext, useState, useEffect, forwardRef } from 'react';
|
|
3
|
+
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
4
|
+
import { u as useDesignSystemTheme, S as Spinner, c as useDesignSystemContext, i as importantify, j as Checkbox, h as Input, x as SearchIcon, d as CheckIcon, X as XCircleFillIcon, C as ChevronDownIcon, e as Tooltip, B as Button, b as CloseIcon, T as Typography, y as SortAscendingIcon, z as SortDescendingIcon, E as SortUnsortedIcon } from './Spinner-140f57ac.js';
|
|
5
|
+
import * as Popover from '@radix-ui/react-popover';
|
|
5
6
|
import * as RadixSlider from '@radix-ui/react-slider';
|
|
6
7
|
import 'antd';
|
|
7
8
|
import 'classnames';
|
|
8
|
-
import 'chroma-js';
|
|
9
|
-
import '@ant-design/icons';
|
|
10
9
|
import 'lodash/isNil';
|
|
11
10
|
import 'lodash/endsWith';
|
|
12
11
|
import 'lodash/isBoolean';
|
|
@@ -14,65 +13,943 @@ import 'lodash/isNumber';
|
|
|
14
13
|
import 'lodash/isString';
|
|
15
14
|
import 'lodash/mapValues';
|
|
16
15
|
import '@emotion/unitless';
|
|
16
|
+
import 'chroma-js';
|
|
17
|
+
import '@ant-design/icons';
|
|
18
|
+
|
|
19
|
+
const filterContextDefaults = {
|
|
20
|
+
label: '',
|
|
21
|
+
value: [],
|
|
22
|
+
isInsideFilter: false,
|
|
23
|
+
multiSelect: false,
|
|
24
|
+
setValue: () => {},
|
|
25
|
+
setIsControlled: () => {}
|
|
26
|
+
};
|
|
27
|
+
const FilterContext = /*#__PURE__*/createContext(filterContextDefaults);
|
|
28
|
+
const FilterContextProvider = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
children,
|
|
31
|
+
value
|
|
32
|
+
} = _ref;
|
|
33
|
+
return jsx(FilterContext.Provider, {
|
|
34
|
+
value: value,
|
|
35
|
+
children: children
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const useFilterContext = () => {
|
|
40
|
+
return useContext(FilterContext);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const Filter = _ref => {
|
|
44
|
+
let {
|
|
45
|
+
children,
|
|
46
|
+
label,
|
|
47
|
+
value = [],
|
|
48
|
+
...props
|
|
49
|
+
} = _ref;
|
|
50
|
+
// Used to avoid infinite loop when value is controlled from within the component (FilterOptionControlledList)
|
|
51
|
+
// We can't remove setValue altogether because uncontrolled component users need to be able to set the value from root for trigger to update
|
|
52
|
+
const [isControlled, setIsControlled] = useState(false);
|
|
53
|
+
const [selectedValue, setSelectedValue] = useState(value);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!isControlled) {
|
|
56
|
+
setSelectedValue(value);
|
|
57
|
+
}
|
|
58
|
+
}, [value, isControlled]);
|
|
59
|
+
return jsx(FilterContextProvider, {
|
|
60
|
+
value: {
|
|
61
|
+
label,
|
|
62
|
+
value: selectedValue,
|
|
63
|
+
setValue: setSelectedValue,
|
|
64
|
+
setIsControlled,
|
|
65
|
+
isInsideFilter: true,
|
|
66
|
+
multiSelect: props.multiSelect
|
|
67
|
+
},
|
|
68
|
+
children: jsx(Root$1, {
|
|
69
|
+
...props,
|
|
70
|
+
children: children
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const Root$1 = props => {
|
|
75
|
+
const {
|
|
76
|
+
children,
|
|
77
|
+
stayOpenOnSelection,
|
|
78
|
+
open,
|
|
79
|
+
multiSelect,
|
|
80
|
+
...restProps
|
|
81
|
+
} = props;
|
|
82
|
+
const {
|
|
83
|
+
value
|
|
84
|
+
} = useFilterContext();
|
|
85
|
+
const [isOpen, setIsOpen] = useState(!!open);
|
|
86
|
+
const handleOpenChange = open => {
|
|
87
|
+
setIsOpen(open);
|
|
88
|
+
};
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (!stayOpenOnSelection && (typeof stayOpenOnSelection === 'boolean' || !multiSelect)) {
|
|
91
|
+
setIsOpen(false);
|
|
92
|
+
}
|
|
93
|
+
}, [value, stayOpenOnSelection, multiSelect]);
|
|
94
|
+
return jsx(Popover.Root, {
|
|
95
|
+
open: open !== undefined ? open : isOpen,
|
|
96
|
+
onOpenChange: handleOpenChange,
|
|
97
|
+
...restProps,
|
|
98
|
+
children: children
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const getFilterButtonContainerStyles = theme => {
|
|
103
|
+
return /*#__PURE__*/css({
|
|
104
|
+
display: 'flex',
|
|
105
|
+
flexDirection: 'row',
|
|
106
|
+
justifyContent: 'flex-end',
|
|
107
|
+
alignItems: 'flex-end',
|
|
108
|
+
padding: "".concat(theme.spacing.sm, "px ").concat(theme.spacing.lg / 2, "px ").concat(theme.spacing.sm, "px ").concat(theme.spacing.lg / 2, "px"),
|
|
109
|
+
gap: theme.spacing.sm,
|
|
110
|
+
alignSelf: 'stretch'
|
|
111
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getFilterButtonContainerStyles;");
|
|
112
|
+
};
|
|
113
|
+
const FilterButtonContainer = _ref => {
|
|
114
|
+
let {
|
|
115
|
+
children,
|
|
116
|
+
...restProps
|
|
117
|
+
} = _ref;
|
|
118
|
+
const {
|
|
119
|
+
theme
|
|
120
|
+
} = useDesignSystemTheme();
|
|
121
|
+
const {
|
|
122
|
+
isInsideFilter
|
|
123
|
+
} = useFilterContext();
|
|
124
|
+
if (!isInsideFilter) {
|
|
125
|
+
throw new Error('`FilterButtonContainer` must be used within `Filter`');
|
|
126
|
+
}
|
|
127
|
+
return jsx("div", {
|
|
128
|
+
...restProps,
|
|
129
|
+
css: getFilterButtonContainerStyles(theme),
|
|
130
|
+
children: children
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const FilterLoadingSpinner = props => {
|
|
135
|
+
const {
|
|
136
|
+
theme
|
|
137
|
+
} = useDesignSystemTheme();
|
|
138
|
+
return jsx(Spinner, {
|
|
139
|
+
css: /*#__PURE__*/css({
|
|
140
|
+
display: 'flex',
|
|
141
|
+
alignSelf: 'center',
|
|
142
|
+
justifyContent: 'center',
|
|
143
|
+
alignItems: 'center',
|
|
144
|
+
height: theme.general.heightSm,
|
|
145
|
+
width: theme.general.heightSm,
|
|
146
|
+
'> span': {
|
|
147
|
+
fontSize: 20
|
|
148
|
+
}
|
|
149
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:FilterLoadingSpinner;"),
|
|
150
|
+
...props
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__$6() { 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)."; }
|
|
155
|
+
const getContentWrapperStyles = (theme, _ref) => {
|
|
156
|
+
let {
|
|
157
|
+
maxHeight = '100vh',
|
|
158
|
+
maxWidth = '100vw',
|
|
159
|
+
minHeight = 0,
|
|
160
|
+
minWidth = 0
|
|
161
|
+
} = _ref;
|
|
162
|
+
return /*#__PURE__*/css({
|
|
163
|
+
maxHeight,
|
|
164
|
+
maxWidth,
|
|
165
|
+
minHeight,
|
|
166
|
+
minWidth,
|
|
167
|
+
background: theme.colors.backgroundPrimary,
|
|
168
|
+
color: theme.colors.textPrimary,
|
|
169
|
+
overflow: 'auto',
|
|
170
|
+
// Making sure the content popover overlaps the remove button when opens to the right
|
|
171
|
+
zIndex: theme.options.zIndexBase + 10,
|
|
172
|
+
boxSizing: 'border-box',
|
|
173
|
+
padding: "".concat(theme.spacing.xs, "px 0"),
|
|
174
|
+
border: "1px solid ".concat(theme.colors.border),
|
|
175
|
+
boxShadow: theme.general.shadowLow,
|
|
176
|
+
borderRadius: 4,
|
|
177
|
+
colorScheme: theme.isDarkMode ? 'dark' : 'light'
|
|
178
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getContentWrapperStyles;");
|
|
179
|
+
};
|
|
180
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
181
|
+
name: "1ij1o5n",
|
|
182
|
+
styles: "display:flex;flex-direction:column;align-items:flex-start;justify-content:center"
|
|
183
|
+
} : {
|
|
184
|
+
name: "qbojwf-FilterContent",
|
|
185
|
+
styles: "display:flex;flex-direction:column;align-items:flex-start;justify-content:center;label:FilterContent;",
|
|
186
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$6
|
|
187
|
+
};
|
|
188
|
+
const FilterContent = /*#__PURE__*/forwardRef((_ref2, forwardedRef) => {
|
|
189
|
+
let {
|
|
190
|
+
children,
|
|
191
|
+
loading,
|
|
192
|
+
maxHeight,
|
|
193
|
+
maxWidth,
|
|
194
|
+
minHeight,
|
|
195
|
+
minWidth = 240,
|
|
196
|
+
align = 'start',
|
|
197
|
+
side = 'bottom',
|
|
198
|
+
sideOffset = 4,
|
|
199
|
+
...restProps
|
|
200
|
+
} = _ref2;
|
|
201
|
+
const {
|
|
202
|
+
theme
|
|
203
|
+
} = useDesignSystemTheme();
|
|
204
|
+
const {
|
|
205
|
+
label,
|
|
206
|
+
isInsideFilter
|
|
207
|
+
} = useFilterContext();
|
|
208
|
+
const {
|
|
209
|
+
getPopupContainer
|
|
210
|
+
} = useDesignSystemContext();
|
|
211
|
+
if (!isInsideFilter) {
|
|
212
|
+
throw new Error('`FilterContent` must be used within `Filter`');
|
|
213
|
+
}
|
|
214
|
+
return jsx(Popover.Portal, {
|
|
215
|
+
container: getPopupContainer && getPopupContainer(),
|
|
216
|
+
children: jsx(Popover.Content, {
|
|
217
|
+
"aria-label": "".concat(label, " filter options"),
|
|
218
|
+
"aria-busy": loading,
|
|
219
|
+
css: getContentWrapperStyles(theme, {
|
|
220
|
+
maxHeight,
|
|
221
|
+
maxWidth,
|
|
222
|
+
minHeight,
|
|
223
|
+
minWidth
|
|
224
|
+
}),
|
|
225
|
+
align: align,
|
|
226
|
+
side: side,
|
|
227
|
+
sideOffset: sideOffset,
|
|
228
|
+
...restProps,
|
|
229
|
+
ref: forwardedRef,
|
|
230
|
+
children: jsx("div", {
|
|
231
|
+
css: _ref3,
|
|
232
|
+
children: loading ? jsx(FilterLoadingSpinner, {
|
|
233
|
+
"aria-label": "Loading",
|
|
234
|
+
alt: "Loading spinner"
|
|
235
|
+
}) : children
|
|
236
|
+
})
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
const getCountBadgeStyles = theme => /*#__PURE__*/css(importantify({
|
|
242
|
+
display: 'inline-flex',
|
|
243
|
+
alignItems: 'center',
|
|
244
|
+
justifyContent: 'center',
|
|
245
|
+
boxSizing: 'border-box',
|
|
246
|
+
padding: "".concat(theme.spacing.xs / 2, "px ").concat(theme.spacing.xs, "px"),
|
|
247
|
+
background: theme.colors.tagDefault,
|
|
248
|
+
borderRadius: theme.general.borderRadiusBase,
|
|
249
|
+
fontWeight: theme.typography.typographyBoldFontWeight,
|
|
250
|
+
fontSize: theme.typography.fontSizeSm,
|
|
251
|
+
height: 20
|
|
252
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:getCountBadgeStyles;");
|
|
253
|
+
const FilterCountBadge = props => {
|
|
254
|
+
const {
|
|
255
|
+
theme
|
|
256
|
+
} = useDesignSystemTheme();
|
|
257
|
+
const {
|
|
258
|
+
value
|
|
259
|
+
} = useFilterContext();
|
|
260
|
+
return jsx("div", {
|
|
261
|
+
...props,
|
|
262
|
+
css: getCountBadgeStyles(theme),
|
|
263
|
+
children: Array.isArray(value) ? value.length : value ? 1 : 0
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const FilterOptionListContext = /*#__PURE__*/createContext({});
|
|
268
|
+
const FilterOptionListContextProvider = _ref => {
|
|
269
|
+
let {
|
|
270
|
+
children,
|
|
271
|
+
value
|
|
272
|
+
} = _ref;
|
|
273
|
+
return jsx(FilterOptionListContext.Provider, {
|
|
274
|
+
value: value,
|
|
275
|
+
children: children
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const useFilterOptionListContext = () => {
|
|
280
|
+
return useContext(FilterOptionListContext);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const getFilterOptionItemWrapperStyles = theme => {
|
|
284
|
+
return /*#__PURE__*/css(importantify({
|
|
285
|
+
display: 'flex',
|
|
286
|
+
flexDirection: 'row',
|
|
287
|
+
alignItems: 'center',
|
|
288
|
+
justifyContent: 'flex-start',
|
|
289
|
+
alignSelf: 'stretch',
|
|
290
|
+
padding: '6px 32px 6px 12px',
|
|
291
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
292
|
+
height: theme.typography.lineHeightBase,
|
|
293
|
+
cursor: 'pointer',
|
|
294
|
+
userSelect: 'none',
|
|
295
|
+
'&:hover': {
|
|
296
|
+
background: theme.colors.actionTertiaryBackgroundHover
|
|
297
|
+
}
|
|
298
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:getFilterOptionItemWrapperStyles;");
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__$5() { 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)."; }
|
|
302
|
+
var _ref2$3 = process.env.NODE_ENV === "production" ? {
|
|
303
|
+
name: "je8g23",
|
|
304
|
+
styles: "pointer-events:none"
|
|
305
|
+
} : {
|
|
306
|
+
name: "1v7dgvu-FilterOptionListCheckboxItem",
|
|
307
|
+
styles: "pointer-events:none;label:FilterOptionListCheckboxItem;",
|
|
308
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$5
|
|
309
|
+
};
|
|
310
|
+
const FilterOptionListCheckboxItem = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
311
|
+
let {
|
|
312
|
+
value,
|
|
313
|
+
checked,
|
|
314
|
+
indeterminate,
|
|
315
|
+
onChange,
|
|
316
|
+
children,
|
|
317
|
+
...props
|
|
318
|
+
} = _ref;
|
|
319
|
+
const {
|
|
320
|
+
theme
|
|
321
|
+
} = useDesignSystemTheme();
|
|
322
|
+
const {
|
|
323
|
+
isInsideFilterOptionList
|
|
324
|
+
} = useFilterOptionListContext();
|
|
325
|
+
if (!isInsideFilterOptionList) {
|
|
326
|
+
throw new Error('`FilterOptionListCheckboxItem` must be used within `FilterOptionList`');
|
|
327
|
+
}
|
|
328
|
+
const handleSelect = () => {
|
|
329
|
+
if (onChange) {
|
|
330
|
+
onChange(value);
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
return jsx("div", {
|
|
334
|
+
ref: ref,
|
|
335
|
+
role: "option"
|
|
336
|
+
// Using aria-selected instead of aria-checked because the parent listbox
|
|
337
|
+
,
|
|
338
|
+
"aria-selected": indeterminate ? false : checked,
|
|
339
|
+
css: [getFilterOptionItemWrapperStyles(theme), process.env.NODE_ENV === "production" ? "" : ";label:FilterOptionListCheckboxItem;"],
|
|
340
|
+
onClick: handleSelect,
|
|
341
|
+
...props,
|
|
342
|
+
children: jsx(Checkbox, {
|
|
343
|
+
isChecked: indeterminate ? null : checked,
|
|
344
|
+
css: _ref2$3
|
|
345
|
+
// Needed because Antd handles keyboard inputs as clicks
|
|
346
|
+
,
|
|
347
|
+
onClick: e => {
|
|
348
|
+
e.stopPropagation();
|
|
349
|
+
handleSelect();
|
|
350
|
+
},
|
|
351
|
+
children: children !== null && children !== void 0 ? children : value
|
|
352
|
+
})
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
const filterChildren = (children, searchValue) => {
|
|
357
|
+
var _React$Children$map;
|
|
358
|
+
return (_React$Children$map = React__default.Children.map(children, child => {
|
|
359
|
+
if (child !== null && child !== void 0 && child.props.value.toLowerCase().includes(searchValue)) {
|
|
360
|
+
return child;
|
|
361
|
+
}
|
|
362
|
+
return null;
|
|
363
|
+
})) === null || _React$Children$map === void 0 ? void 0 : _React$Children$map.filter(child => child);
|
|
364
|
+
};
|
|
365
|
+
const FilterOptionListSearch = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
366
|
+
var _filteredChildren, _filteredChildren$pro, _filteredChildren2;
|
|
367
|
+
let {
|
|
368
|
+
onChange,
|
|
369
|
+
children,
|
|
370
|
+
hasWrapper,
|
|
371
|
+
...restProps
|
|
372
|
+
} = _ref;
|
|
373
|
+
const {
|
|
374
|
+
theme
|
|
375
|
+
} = useDesignSystemTheme();
|
|
376
|
+
const {
|
|
377
|
+
isInsideFilterOptionList
|
|
378
|
+
} = useFilterOptionListContext();
|
|
379
|
+
const [searchValue, setSearchValue] = React__default.useState();
|
|
380
|
+
if (!isInsideFilterOptionList) {
|
|
381
|
+
throw new Error('`FilterOptionListSearch` must be used within `FilterOptionList`');
|
|
382
|
+
}
|
|
383
|
+
const handleOnChange = event => {
|
|
384
|
+
setSearchValue(event.target.value.toLowerCase());
|
|
385
|
+
};
|
|
386
|
+
let filteredChildren = children;
|
|
387
|
+
if (searchValue) {
|
|
388
|
+
filteredChildren = filterChildren(hasWrapper ? children.props.children : children, searchValue);
|
|
389
|
+
if (hasWrapper) {
|
|
390
|
+
filteredChildren = /*#__PURE__*/React__default.cloneElement(children, {}, filteredChildren);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return jsxs(Fragment, {
|
|
394
|
+
children: [jsx("div", {
|
|
395
|
+
css: /*#__PURE__*/css({
|
|
396
|
+
padding: "".concat(theme.spacing.sm, "px ").concat(theme.spacing.lg / 2, "px ").concat(theme.spacing.sm, "px"),
|
|
397
|
+
width: '100%',
|
|
398
|
+
boxSizing: 'border-box'
|
|
399
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:FilterOptionListSearch;"),
|
|
400
|
+
children: jsx(Input, {
|
|
401
|
+
ref: forwardedRef,
|
|
402
|
+
prefix: jsx(SearchIcon, {}),
|
|
403
|
+
placeholder: "Search",
|
|
404
|
+
onChange: handleOnChange,
|
|
405
|
+
value: searchValue,
|
|
406
|
+
...restProps
|
|
407
|
+
})
|
|
408
|
+
}), hasWrapper && (_filteredChildren = filteredChildren) !== null && _filteredChildren !== void 0 && (_filteredChildren$pro = _filteredChildren.props.children) !== null && _filteredChildren$pro !== void 0 && _filteredChildren$pro.length || !hasWrapper && (_filteredChildren2 = filteredChildren) !== null && _filteredChildren2 !== void 0 && _filteredChildren2.length ? filteredChildren : jsx("div", {
|
|
409
|
+
css: /*#__PURE__*/css({
|
|
410
|
+
color: theme.colors.textSecondary,
|
|
411
|
+
textAlign: 'center',
|
|
412
|
+
padding: '6px 32px 6px 12px',
|
|
413
|
+
width: '100%',
|
|
414
|
+
boxSizing: 'border-box'
|
|
415
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:FilterOptionListSearch;"),
|
|
416
|
+
children: "No results found"
|
|
417
|
+
})]
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__$4() { 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)."; }
|
|
422
|
+
var _ref2$2 = process.env.NODE_ENV === "production" ? {
|
|
423
|
+
name: "1cjitc6",
|
|
424
|
+
styles: "width:16px"
|
|
425
|
+
} : {
|
|
426
|
+
name: "1lwu3su-FilterOptionListSelectItem",
|
|
427
|
+
styles: "width:16px;label:FilterOptionListSelectItem;",
|
|
428
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$4
|
|
429
|
+
};
|
|
430
|
+
const FilterOptionListSelectItem = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
431
|
+
let {
|
|
432
|
+
value,
|
|
433
|
+
checked,
|
|
434
|
+
onChange,
|
|
435
|
+
children,
|
|
436
|
+
...props
|
|
437
|
+
} = _ref;
|
|
438
|
+
const {
|
|
439
|
+
theme
|
|
440
|
+
} = useDesignSystemTheme();
|
|
441
|
+
const {
|
|
442
|
+
isInsideFilterOptionList
|
|
443
|
+
} = useFilterOptionListContext();
|
|
444
|
+
if (!isInsideFilterOptionList) {
|
|
445
|
+
throw new Error('`FilterOptionListSelectItem` must be used within `FilterOptionList`');
|
|
446
|
+
}
|
|
447
|
+
const handleSelect = () => {
|
|
448
|
+
if (onChange) {
|
|
449
|
+
onChange(value);
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
return jsxs("div", {
|
|
453
|
+
ref: ref,
|
|
454
|
+
css: [getFilterOptionItemWrapperStyles(theme), {
|
|
455
|
+
'&:focus': {
|
|
456
|
+
background: theme.colors.actionTertiaryBackgroundHover,
|
|
457
|
+
outline: 'none'
|
|
458
|
+
}
|
|
459
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:FilterOptionListSelectItem;"],
|
|
460
|
+
...props,
|
|
461
|
+
onClick: handleSelect,
|
|
462
|
+
tabIndex: 0,
|
|
463
|
+
onKeyDown: e => {
|
|
464
|
+
switch (e.key) {
|
|
465
|
+
case 'ArrowDown':
|
|
466
|
+
e.preventDefault();
|
|
467
|
+
const nextSibling = e.currentTarget.nextElementSibling;
|
|
468
|
+
nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.focus();
|
|
469
|
+
break;
|
|
470
|
+
case 'ArrowUp':
|
|
471
|
+
e.preventDefault();
|
|
472
|
+
const previousSibling = e.currentTarget.previousElementSibling;
|
|
473
|
+
previousSibling === null || previousSibling === void 0 ? void 0 : previousSibling.focus();
|
|
474
|
+
break;
|
|
475
|
+
case ' ':
|
|
476
|
+
case 'Enter':
|
|
477
|
+
e.preventDefault();
|
|
478
|
+
handleSelect();
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
role: "option",
|
|
483
|
+
"aria-selected": checked,
|
|
484
|
+
children: [checked ? jsx(CheckIcon, {}) : jsx("div", {
|
|
485
|
+
css: _ref2$2
|
|
486
|
+
}), jsx("label", {
|
|
487
|
+
style: {
|
|
488
|
+
marginLeft: theme.spacing.sm,
|
|
489
|
+
cursor: 'pointer'
|
|
490
|
+
},
|
|
491
|
+
children: children !== null && children !== void 0 ? children : value
|
|
492
|
+
})]
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__$3() { 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)."; }
|
|
497
|
+
var _ref2$1 = process.env.NODE_ENV === "production" ? {
|
|
498
|
+
name: "6kz1wu",
|
|
499
|
+
styles: "display:flex;flex-direction:column;align-items:flex-start"
|
|
500
|
+
} : {
|
|
501
|
+
name: "160mr8t-FilterOptionControlledList",
|
|
502
|
+
styles: "display:flex;flex-direction:column;align-items:flex-start;label:FilterOptionControlledList;",
|
|
503
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$3
|
|
504
|
+
};
|
|
505
|
+
const FilterOptionControlledList = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
506
|
+
let {
|
|
507
|
+
options,
|
|
508
|
+
onChange,
|
|
509
|
+
loading,
|
|
510
|
+
withProgressiveLoading,
|
|
511
|
+
withSearch,
|
|
512
|
+
showSelectAndClearAll,
|
|
513
|
+
...restProps
|
|
514
|
+
} = _ref;
|
|
515
|
+
const {
|
|
516
|
+
isInsideFilter,
|
|
517
|
+
multiSelect,
|
|
518
|
+
value,
|
|
519
|
+
setValue,
|
|
520
|
+
setIsControlled
|
|
521
|
+
} = useFilterContext();
|
|
522
|
+
if (!isInsideFilter) {
|
|
523
|
+
throw new Error('`FilterOptionControlledList` must be used within `Filter`');
|
|
524
|
+
}
|
|
525
|
+
const isOptionChecked = options.reduce((acc, option) => {
|
|
526
|
+
acc[option] = value === null || value === void 0 ? void 0 : value.includes(option);
|
|
527
|
+
return acc;
|
|
528
|
+
}, {});
|
|
529
|
+
const handleUpdate = updatedValue => {
|
|
530
|
+
setIsControlled(true);
|
|
531
|
+
let newValue = [];
|
|
532
|
+
if (multiSelect) {
|
|
533
|
+
if (value.find(item => item === updatedValue)) {
|
|
534
|
+
newValue = value.filter(item => item !== updatedValue);
|
|
535
|
+
} else {
|
|
536
|
+
newValue = [...value, updatedValue];
|
|
537
|
+
}
|
|
538
|
+
} else {
|
|
539
|
+
newValue = [updatedValue];
|
|
540
|
+
}
|
|
541
|
+
setValue(newValue);
|
|
542
|
+
isOptionChecked[updatedValue] = !isOptionChecked[updatedValue];
|
|
543
|
+
if (onChange) {
|
|
544
|
+
onChange(newValue);
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
const handleSelectAll = () => {
|
|
548
|
+
setIsControlled(true);
|
|
549
|
+
if (value.length === options.length) {
|
|
550
|
+
setValue([]);
|
|
551
|
+
options.forEach(option => {
|
|
552
|
+
isOptionChecked[option] = false;
|
|
553
|
+
});
|
|
554
|
+
if (onChange) {
|
|
555
|
+
onChange([]);
|
|
556
|
+
}
|
|
557
|
+
} else {
|
|
558
|
+
setValue(options);
|
|
559
|
+
options.forEach(option => {
|
|
560
|
+
isOptionChecked[option] = true;
|
|
561
|
+
});
|
|
562
|
+
if (onChange) {
|
|
563
|
+
onChange(options);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
const renderedOptions = jsxs(Fragment, {
|
|
568
|
+
children: [showSelectAndClearAll && multiSelect && jsx(FilterOptionListCheckboxItem, {
|
|
569
|
+
value: "all",
|
|
570
|
+
onChange: handleSelectAll,
|
|
571
|
+
checked: value.length === options.length,
|
|
572
|
+
indeterminate: !!value.length && value.length !== options.length,
|
|
573
|
+
children: value.length === options.length ? 'Clear all' : 'Select all'
|
|
574
|
+
}), options === null || options === void 0 ? void 0 : options.map((option, key) => multiSelect ? jsx(FilterOptionListCheckboxItem, {
|
|
575
|
+
value: option,
|
|
576
|
+
checked: isOptionChecked[option],
|
|
577
|
+
onChange: handleUpdate,
|
|
578
|
+
children: option
|
|
579
|
+
}, key) : jsx(FilterOptionListSelectItem, {
|
|
580
|
+
value: option,
|
|
581
|
+
checked: isOptionChecked[option],
|
|
582
|
+
onChange: handleUpdate,
|
|
583
|
+
children: option
|
|
584
|
+
}, key))]
|
|
585
|
+
});
|
|
586
|
+
return jsx("div", {
|
|
587
|
+
ref: forwardedRef,
|
|
588
|
+
"aria-busy": loading,
|
|
589
|
+
css: _ref2$1,
|
|
590
|
+
...restProps,
|
|
591
|
+
children: jsx(FilterOptionListContextProvider, {
|
|
592
|
+
value: {
|
|
593
|
+
isInsideFilterOptionList: true
|
|
594
|
+
},
|
|
595
|
+
children: jsx(Fragment, {
|
|
596
|
+
children: loading ? withProgressiveLoading ? jsxs(Fragment, {
|
|
597
|
+
children: [withSearch ? jsx(FilterOptionListSearch, {
|
|
598
|
+
hasWrapper: true,
|
|
599
|
+
children: renderedOptions
|
|
600
|
+
}) : renderedOptions, jsx(FilterLoadingSpinner, {
|
|
601
|
+
"aria-label": "Loading",
|
|
602
|
+
alt: "Loading spinner"
|
|
603
|
+
})]
|
|
604
|
+
}) : jsx(FilterLoadingSpinner, {
|
|
605
|
+
"aria-label": "Loading",
|
|
606
|
+
alt: "Loading spinner"
|
|
607
|
+
}) : withSearch ? jsx(FilterOptionListSearch, {
|
|
608
|
+
hasWrapper: true,
|
|
609
|
+
children: renderedOptions
|
|
610
|
+
}) : renderedOptions
|
|
611
|
+
})
|
|
612
|
+
})
|
|
613
|
+
});
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__$2() { 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)."; }
|
|
617
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
618
|
+
name: "1pgv7dg",
|
|
619
|
+
styles: "display:flex;flex-direction:column;align-items:flex-start;width:100%"
|
|
620
|
+
} : {
|
|
621
|
+
name: "s7a3b7-FilterOptionList",
|
|
622
|
+
styles: "display:flex;flex-direction:column;align-items:flex-start;width:100%;label:FilterOptionList;",
|
|
623
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2
|
|
624
|
+
};
|
|
625
|
+
const FilterOptionList = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
626
|
+
let {
|
|
627
|
+
children,
|
|
628
|
+
onChange,
|
|
629
|
+
loading,
|
|
630
|
+
withProgressiveLoading,
|
|
631
|
+
...restProps
|
|
632
|
+
} = _ref;
|
|
633
|
+
const {
|
|
634
|
+
isInsideFilter,
|
|
635
|
+
value
|
|
636
|
+
} = useFilterContext();
|
|
637
|
+
if (!isInsideFilter) {
|
|
638
|
+
throw new Error('`FilterOptionList` must be used within `Filter`');
|
|
639
|
+
}
|
|
640
|
+
useEffect(() => {
|
|
641
|
+
if (onChange) {
|
|
642
|
+
onChange(value);
|
|
643
|
+
}
|
|
644
|
+
}, [value, onChange]);
|
|
645
|
+
return jsx("div", {
|
|
646
|
+
ref: forwardedRef,
|
|
647
|
+
"aria-busy": loading,
|
|
648
|
+
role: "list",
|
|
649
|
+
css: _ref2,
|
|
650
|
+
...restProps,
|
|
651
|
+
children: jsx(FilterOptionListContextProvider, {
|
|
652
|
+
value: {
|
|
653
|
+
isInsideFilterOptionList: true
|
|
654
|
+
},
|
|
655
|
+
children: loading ? withProgressiveLoading ? jsxs(Fragment, {
|
|
656
|
+
children: [children, jsx(FilterLoadingSpinner, {
|
|
657
|
+
"aria-label": "Loading",
|
|
658
|
+
alt: "Loading spinner"
|
|
659
|
+
})]
|
|
660
|
+
}) : jsx(FilterLoadingSpinner, {
|
|
661
|
+
"aria-label": "Loading",
|
|
662
|
+
alt: "Loading spinner"
|
|
663
|
+
}) : children
|
|
664
|
+
})
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
const FilterSectionHeader = _ref => {
|
|
669
|
+
let {
|
|
670
|
+
children,
|
|
671
|
+
...props
|
|
672
|
+
} = _ref;
|
|
673
|
+
const {
|
|
674
|
+
theme
|
|
675
|
+
} = useDesignSystemTheme();
|
|
676
|
+
const {
|
|
677
|
+
isInsideFilter
|
|
678
|
+
} = useFilterContext();
|
|
679
|
+
if (!isInsideFilter) {
|
|
680
|
+
throw new Error('`FilterSectionHeader` must be used within `Filter`');
|
|
681
|
+
}
|
|
682
|
+
return jsx("div", {
|
|
683
|
+
...props,
|
|
684
|
+
css: /*#__PURE__*/css({
|
|
685
|
+
display: 'flex',
|
|
686
|
+
flexDirection: 'row',
|
|
687
|
+
alignItems: 'flex-start',
|
|
688
|
+
padding: "".concat(theme.spacing.xs, "px ").concat(theme.spacing.lg / 2, "px"),
|
|
689
|
+
alignSelf: 'stretch',
|
|
690
|
+
fontWeight: 400,
|
|
691
|
+
color: theme.colors.textSecondary
|
|
692
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:FilterSectionHeader;"),
|
|
693
|
+
children: children
|
|
694
|
+
});
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
const FilterSeparator = props => {
|
|
698
|
+
const {
|
|
699
|
+
theme
|
|
700
|
+
} = useDesignSystemTheme();
|
|
701
|
+
const {
|
|
702
|
+
isInsideFilter
|
|
703
|
+
} = useFilterContext();
|
|
704
|
+
if (!isInsideFilter) {
|
|
705
|
+
throw new Error('`FilterSeparator` must be used within `Filter`');
|
|
706
|
+
}
|
|
707
|
+
return jsx("div", {
|
|
708
|
+
...props,
|
|
709
|
+
css: /*#__PURE__*/css({
|
|
710
|
+
display: 'flex',
|
|
711
|
+
flexDirection: 'row',
|
|
712
|
+
alignItems: 'center',
|
|
713
|
+
margin: "".concat(theme.spacing.xs, "px ").concat(theme.spacing.lg / 2, "px"),
|
|
714
|
+
border: "1px solid ".concat(theme.colors.borderDecorative),
|
|
715
|
+
borderBottom: 0,
|
|
716
|
+
alignSelf: 'stretch'
|
|
717
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:FilterSeparator;")
|
|
718
|
+
});
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
const getTriggerWrapperStyles = removable => /*#__PURE__*/css(importantify({
|
|
722
|
+
display: 'inline-flex',
|
|
723
|
+
alignItems: 'center',
|
|
724
|
+
...(removable && {
|
|
725
|
+
'& > button:last-of-type': importantify({
|
|
726
|
+
borderBottomLeftRadius: 0,
|
|
727
|
+
borderTopLeftRadius: 0,
|
|
728
|
+
marginLeft: -1
|
|
729
|
+
})
|
|
730
|
+
})
|
|
731
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:getTriggerWrapperStyles;");
|
|
732
|
+
const getTriggerStyles = (theme, maxWidth, removable) => {
|
|
733
|
+
const removeButtonInteractionStyles = {
|
|
734
|
+
...(removable && {
|
|
735
|
+
zIndex: theme.options.zIndexBase + 2,
|
|
736
|
+
'&& + button': {
|
|
737
|
+
marginLeft: -1,
|
|
738
|
+
zIndex: theme.options.zIndexBase + 1
|
|
739
|
+
}
|
|
740
|
+
})
|
|
741
|
+
};
|
|
742
|
+
return /*#__PURE__*/css(importantify({
|
|
743
|
+
position: 'relative',
|
|
744
|
+
display: 'inline-flex',
|
|
745
|
+
alignItems: 'center',
|
|
746
|
+
maxWidth: maxWidth,
|
|
747
|
+
justifyContent: 'center',
|
|
748
|
+
background: 'transparent',
|
|
749
|
+
padding: '6px 8px 6px 12px',
|
|
750
|
+
boxSizing: 'border-box',
|
|
751
|
+
height: theme.general.heightSm,
|
|
752
|
+
border: "1px solid ".concat(theme.colors.actionDefaultBorderDefault),
|
|
753
|
+
borderRadius: 4,
|
|
754
|
+
color: theme.colors.textPrimary,
|
|
755
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
756
|
+
cursor: 'pointer',
|
|
757
|
+
...(removable && {
|
|
758
|
+
borderBottomRightRadius: 0,
|
|
759
|
+
borderTopRightRadius: 0,
|
|
760
|
+
borderRightColor: 'transparent'
|
|
761
|
+
}),
|
|
762
|
+
'&:hover': {
|
|
763
|
+
background: theme.colors.actionDefaultBackgroundHover,
|
|
764
|
+
borderColor: theme.colors.actionDefaultBorderHover,
|
|
765
|
+
...removeButtonInteractionStyles
|
|
766
|
+
},
|
|
767
|
+
'&:focus': {
|
|
768
|
+
borderColor: theme.colors.actionDefaultBorderFocus,
|
|
769
|
+
...removeButtonInteractionStyles
|
|
770
|
+
}
|
|
771
|
+
}), process.env.NODE_ENV === "production" ? "" : ";label:getTriggerStyles;");
|
|
772
|
+
};
|
|
773
|
+
const FilterTrigger = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
774
|
+
let {
|
|
775
|
+
removable = false,
|
|
776
|
+
onRemove,
|
|
777
|
+
children,
|
|
778
|
+
maxWidth = 9999,
|
|
779
|
+
withCountBadge,
|
|
780
|
+
showBadgeAfterValueCount = 3,
|
|
781
|
+
allowClear = true,
|
|
782
|
+
controlled,
|
|
783
|
+
onClear,
|
|
784
|
+
...restProps
|
|
785
|
+
} = _ref;
|
|
786
|
+
const {
|
|
787
|
+
theme
|
|
788
|
+
} = useDesignSystemTheme();
|
|
789
|
+
const {
|
|
790
|
+
label,
|
|
791
|
+
value,
|
|
792
|
+
isInsideFilter,
|
|
793
|
+
multiSelect,
|
|
794
|
+
setValue
|
|
795
|
+
} = useFilterContext();
|
|
796
|
+
if (!isInsideFilter) {
|
|
797
|
+
throw new Error('`FilterTrigger` must be used within `Filter`');
|
|
798
|
+
}
|
|
799
|
+
const handleRemove = () => {
|
|
800
|
+
if (!onRemove) {
|
|
801
|
+
console.warn('Filter.Trigger: Attempted remove without providing onRemove handler');
|
|
802
|
+
} else {
|
|
803
|
+
onRemove();
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
const handleClear = e => {
|
|
807
|
+
e.stopPropagation();
|
|
808
|
+
if (controlled) {
|
|
809
|
+
setValue([]);
|
|
810
|
+
} else if (!onClear) {
|
|
811
|
+
console.warn('Filter.Trigger: Attempted clear without providing onClear handler');
|
|
812
|
+
} else {
|
|
813
|
+
onClear();
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
const [showTooltip, setShowTooltip] = React__default.useState();
|
|
817
|
+
const triggerContentRef = React__default.useRef(null);
|
|
818
|
+
useEffect(() => {
|
|
819
|
+
if ((value === null || value === void 0 ? void 0 : value.length) > showBadgeAfterValueCount) {
|
|
820
|
+
setShowTooltip(true);
|
|
821
|
+
} else if (triggerContentRef.current) {
|
|
822
|
+
const {
|
|
823
|
+
clientWidth,
|
|
824
|
+
scrollWidth
|
|
825
|
+
} = triggerContentRef.current;
|
|
826
|
+
setShowTooltip(clientWidth < scrollWidth);
|
|
827
|
+
}
|
|
828
|
+
}, [showBadgeAfterValueCount, value]);
|
|
829
|
+
const concatenatedValues = Array.isArray(value) ? value.join(', ') : value;
|
|
830
|
+
const displayedValues = jsx("span", {
|
|
831
|
+
children: concatenatedValues
|
|
832
|
+
});
|
|
833
|
+
let ariaLabel = "".concat(label, " filter");
|
|
834
|
+
if (value !== null && value !== void 0 && value.length) {
|
|
835
|
+
ariaLabel += multiSelect ? ", multiselectable, ".concat(value.length, " options selected: ").concat(concatenatedValues) : ", selected option: ".concat(concatenatedValues);
|
|
836
|
+
} else {
|
|
837
|
+
ariaLabel += multiSelect ? ', multiselectable, 0 options selected' : ', no option selected';
|
|
838
|
+
}
|
|
839
|
+
const triggerContent = children !== null && children !== void 0 ? children : jsxs(Popover.Trigger, {
|
|
840
|
+
"aria-label": ariaLabel,
|
|
841
|
+
ref: forwardedRef,
|
|
842
|
+
...restProps,
|
|
843
|
+
css: getTriggerStyles(theme, maxWidth, removable),
|
|
844
|
+
role: "listbox",
|
|
845
|
+
"aria-multiselectable": multiSelect,
|
|
846
|
+
children: [jsxs("span", {
|
|
847
|
+
css: /*#__PURE__*/css({
|
|
848
|
+
whiteSpace: 'nowrap',
|
|
849
|
+
overflow: 'hidden',
|
|
850
|
+
textOverflow: 'ellipsis',
|
|
851
|
+
height: theme.typography.lineHeightBase
|
|
852
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:triggerContent;"),
|
|
853
|
+
ref: triggerContentRef,
|
|
854
|
+
children: [jsx("span", {
|
|
855
|
+
css: /*#__PURE__*/css({
|
|
856
|
+
marginRight: theme.spacing.xs,
|
|
857
|
+
fontWeight: theme.typography.typographyBoldFontWeight
|
|
858
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:triggerContent;"),
|
|
859
|
+
children: label
|
|
860
|
+
}), withCountBadge || (value === null || value === void 0 ? void 0 : value.length) > showBadgeAfterValueCount ? jsx(FilterCountBadge, {
|
|
861
|
+
role: "status",
|
|
862
|
+
"aria-label": "Filter options selected count"
|
|
863
|
+
}) : displayedValues]
|
|
864
|
+
}), allowClear && value !== null && value !== void 0 && value.length ? jsx(XCircleFillIcon, {
|
|
865
|
+
onClick: handleClear,
|
|
866
|
+
css: /*#__PURE__*/css({
|
|
867
|
+
color: theme.colors.textPlaceholder,
|
|
868
|
+
fontSize: theme.typography.fontSizeSm,
|
|
869
|
+
marginLeft: theme.spacing.xs,
|
|
870
|
+
':hover': {
|
|
871
|
+
color: theme.colors.actionTertiaryTextHover
|
|
872
|
+
}
|
|
873
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:triggerContent;")
|
|
874
|
+
}) : null, jsx(ChevronDownIcon, {
|
|
875
|
+
css: /*#__PURE__*/css({
|
|
876
|
+
color: theme.colors.textSecondary,
|
|
877
|
+
marginLeft: 4
|
|
878
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:triggerContent;")
|
|
879
|
+
})]
|
|
880
|
+
});
|
|
881
|
+
return jsxs("div", {
|
|
882
|
+
css: getTriggerWrapperStyles(removable),
|
|
883
|
+
children: [showTooltip && value !== null && value !== void 0 && value.length ? jsx(Tooltip, {
|
|
884
|
+
title: displayedValues,
|
|
885
|
+
children: triggerContent
|
|
886
|
+
}) : triggerContent, removable && jsx(Button, {
|
|
887
|
+
"aria-label": "Remove ".concat(label, " filters"),
|
|
888
|
+
onClick: handleRemove,
|
|
889
|
+
dangerouslySetForceIconStyles: true,
|
|
890
|
+
children: jsx(CloseIcon, {})
|
|
891
|
+
})]
|
|
892
|
+
});
|
|
893
|
+
});
|
|
17
894
|
|
|
18
895
|
function _EMOTION_STRINGIFIED_CSS_ERROR__$1() { 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)."; }
|
|
19
896
|
// For performance, these styles are defined outside of the component so they are not redefined on every render.
|
|
20
897
|
// We're also using CSS Variables rather than any dynamic styles so that the style object remains static.
|
|
21
898
|
const tableStyles = {
|
|
22
899
|
row: process.env.NODE_ENV === "production" ? {
|
|
23
|
-
name: "
|
|
24
|
-
styles: "display:flex;border-bottom:1px solid;border-color:var(--table-separator-color);.table-row-select-cell input[type=\"checkbox\"] ~ *{opacity:var(--row-checkbox-opacity, 0);}&:hover{
|
|
900
|
+
name: "v9xe5f",
|
|
901
|
+
styles: "display:flex;border-bottom:1px solid;border-color:var(--table-separator-color);.table-row-select-cell input[type=\"checkbox\"] ~ *{opacity:var(--row-checkbox-opacity, 0);}&:hover{> *{background-color:var(--table-row-hover);}.table-row-select-cell input[type=\"checkbox\"] ~ *{opacity:1;}}.table-row-select-cell input[type=\"checkbox\"]:focus ~ *{opacity:1;}> *{padding-top:var(--table-row-vertical-padding);padding-bottom:var(--table-row-vertical-padding);}"
|
|
25
902
|
} : {
|
|
26
|
-
name: "
|
|
27
|
-
styles: "display:flex;border-bottom:1px solid;border-color:var(--table-separator-color);.table-row-select-cell input[type=\"checkbox\"] ~ *{opacity:var(--row-checkbox-opacity, 0);}&:hover{
|
|
903
|
+
name: "19eijcc-row",
|
|
904
|
+
styles: "display:flex;border-bottom:1px solid;border-color:var(--table-separator-color);.table-row-select-cell input[type=\"checkbox\"] ~ *{opacity:var(--row-checkbox-opacity, 0);}&:hover{> *{background-color:var(--table-row-hover);}.table-row-select-cell input[type=\"checkbox\"] ~ *{opacity:1;}}.table-row-select-cell input[type=\"checkbox\"]:focus ~ *{opacity:1;}> *{padding-top:var(--table-row-vertical-padding);padding-bottom:var(--table-row-vertical-padding);};label:row;",
|
|
28
905
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
29
906
|
},
|
|
30
907
|
cell: process.env.NODE_ENV === "production" ? {
|
|
31
|
-
name: "
|
|
32
|
-
styles: "display:inline-grid;position:relative;align-items:var(--table-row-vertical-alignment, flex-start);flex:1;line-height:initial;
|
|
908
|
+
name: "11nbh8q",
|
|
909
|
+
styles: "display:inline-grid;position:relative;align-items:var(--table-row-vertical-alignment, flex-start);flex:1;line-height:initial;box-sizing:border-box;padding-left:var(--table-spacing-sm);padding-right:var(--table-spacing-sm);word-break:break-word;overflow:hidden"
|
|
33
910
|
} : {
|
|
34
|
-
name: "
|
|
35
|
-
styles: "display:inline-grid;position:relative;align-items:var(--table-row-vertical-alignment, flex-start);flex:1;line-height:initial;
|
|
911
|
+
name: "pezdmp-cell",
|
|
912
|
+
styles: "display:inline-grid;position:relative;align-items:var(--table-row-vertical-alignment, flex-start);flex:1;line-height:initial;box-sizing:border-box;padding-left:var(--table-spacing-sm);padding-right:var(--table-spacing-sm);word-break:break-word;overflow:hidden;label:cell;",
|
|
36
913
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
37
914
|
},
|
|
38
|
-
|
|
39
|
-
name: "
|
|
40
|
-
styles: "padding:
|
|
915
|
+
rowMenuContainer: process.env.NODE_ENV === "production" ? {
|
|
916
|
+
name: "1o9y8zx",
|
|
917
|
+
styles: "padding-left:var(--table-spacing-xs);padding-right:var(--table-spacing-xs)"
|
|
41
918
|
} : {
|
|
42
|
-
name: "
|
|
43
|
-
styles: "padding:
|
|
919
|
+
name: "1gopnk4-rowMenuContainer",
|
|
920
|
+
styles: "padding-left:var(--table-spacing-xs);padding-right:var(--table-spacing-xs);label:rowMenuContainer;",
|
|
44
921
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
45
922
|
},
|
|
46
923
|
header: process.env.NODE_ENV === "production" ? {
|
|
47
|
-
name: "
|
|
48
|
-
styles: "font-weight:bold;align-items:flex-end;display:flex;overflow:hidden;&[aria-sort]{cursor:pointer;user-select:none;}[
|
|
924
|
+
name: "753xvu",
|
|
925
|
+
styles: "font-weight:bold;align-items:flex-end;display:flex;overflow:hidden;&[aria-sort]{cursor:pointer;user-select:none;}.table-header-text{color:var(--table-header-text-color);}.table-header-icon-container{color:var(--table-header-sort-icon-color);display:none;}&:hover{.table-header-icon-container, .table-header-text{color:var(--table-header-focus-color);}}&:active{.table-header-icon-container, .table-header-text{color:var(--table-header-active-color);}}&:hover, &[aria-sort=\"ascending\"], &[aria-sort=\"descending\"]{.table-header-icon-container{display:inline;}}"
|
|
49
926
|
} : {
|
|
50
|
-
name: "
|
|
51
|
-
styles: "font-weight:bold;align-items:flex-end;display:flex;overflow:hidden;&[aria-sort]{cursor:pointer;user-select:none;}[
|
|
927
|
+
name: "1shmncy-header",
|
|
928
|
+
styles: "font-weight:bold;align-items:flex-end;display:flex;overflow:hidden;&[aria-sort]{cursor:pointer;user-select:none;}.table-header-text{color:var(--table-header-text-color);}.table-header-icon-container{color:var(--table-header-sort-icon-color);display:none;}&:hover{.table-header-icon-container, .table-header-text{color:var(--table-header-focus-color);}}&:active{.table-header-icon-container, .table-header-text{color:var(--table-header-active-color);}}&:hover, &[aria-sort=\"ascending\"], &[aria-sort=\"descending\"]{.table-header-icon-container{display:inline;}};label:header;",
|
|
52
929
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
53
930
|
},
|
|
54
931
|
headerButtonTarget: process.env.NODE_ENV === "production" ? {
|
|
55
|
-
name: "
|
|
56
|
-
styles: "align-items:flex-end;display:flex;overflow:hidden;width:100
|
|
932
|
+
name: "dpqgee",
|
|
933
|
+
styles: "align-items:flex-end;display:flex;overflow:hidden;width:100%;&:focus{.table-header-text{color:var(--table-header-focus-color);}.table-header-icon-container{color:var(--table-header-focus-color);display:inline;}}&:active{.table-header-icon-container, .table-header-text{color:var(--table-header-active-color);}}"
|
|
57
934
|
} : {
|
|
58
|
-
name: "
|
|
59
|
-
styles: "align-items:flex-end;display:flex;overflow:hidden;width:100
|
|
935
|
+
name: "s60l4r-headerButtonTarget",
|
|
936
|
+
styles: "align-items:flex-end;display:flex;overflow:hidden;width:100%;&:focus{.table-header-text{color:var(--table-header-focus-color);}.table-header-icon-container{color:var(--table-header-focus-color);display:inline;}}&:active{.table-header-icon-container, .table-header-text{color:var(--table-header-active-color);}};label:headerButtonTarget;",
|
|
60
937
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
61
938
|
},
|
|
62
939
|
checkboxCell: process.env.NODE_ENV === "production" ? {
|
|
63
|
-
name: "
|
|
64
|
-
styles: "
|
|
940
|
+
name: "mozdib",
|
|
941
|
+
styles: "display:flex;align-items:center;flex:0;padding-left:var(--table-spacing-sm);padding-top:0;padding-bottom:0;min-width:var(--table-spacing-md);max-width:var(--table-spacing-md)"
|
|
65
942
|
} : {
|
|
66
|
-
name: "
|
|
67
|
-
styles: "
|
|
943
|
+
name: "101mdic-checkboxCell",
|
|
944
|
+
styles: "display:flex;align-items:center;flex:0;padding-left:var(--table-spacing-sm);padding-top:0;padding-bottom:0;min-width:var(--table-spacing-md);max-width:var(--table-spacing-md);label:checkboxCell;",
|
|
68
945
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
69
946
|
},
|
|
70
947
|
resizeHandleContainer: /*#__PURE__*/css({
|
|
71
948
|
position: 'absolute',
|
|
72
949
|
right: -3,
|
|
73
|
-
top:
|
|
74
|
-
bottom:
|
|
75
|
-
width:
|
|
950
|
+
top: 'var(--table-spacing-sm)',
|
|
951
|
+
bottom: 'var(--table-spacing-sm)',
|
|
952
|
+
width: 'var(--table-spacing-sm)',
|
|
76
953
|
display: 'flex',
|
|
77
954
|
justifyContent: 'center',
|
|
78
955
|
cursor: 'col-resize',
|
|
@@ -87,6 +964,14 @@ const tableStyles = {
|
|
|
87
964
|
name: "1n6mwr7-resizeHandle",
|
|
88
965
|
styles: "width:1px;background:var(--table-separator-color);label:resizeHandle;",
|
|
89
966
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
967
|
+
},
|
|
968
|
+
paginationContainer: process.env.NODE_ENV === "production" ? {
|
|
969
|
+
name: "eb4gqw",
|
|
970
|
+
styles: "display:flex;justify-content:flex-end;margin-top:var(--table-spacing-sm)"
|
|
971
|
+
} : {
|
|
972
|
+
name: "e4q60i-paginationContainer",
|
|
973
|
+
styles: "display:flex;justify-content:flex-end;margin-top:var(--table-spacing-sm);label:paginationContainer;",
|
|
974
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
90
975
|
}
|
|
91
976
|
};
|
|
92
977
|
const TableContext = /*#__PURE__*/createContext({
|
|
@@ -97,7 +982,9 @@ const Table = _ref => {
|
|
|
97
982
|
children,
|
|
98
983
|
size = 'default',
|
|
99
984
|
someRowsSelected,
|
|
100
|
-
style
|
|
985
|
+
style,
|
|
986
|
+
pagination,
|
|
987
|
+
empty
|
|
101
988
|
} = _ref;
|
|
102
989
|
const {
|
|
103
990
|
theme
|
|
@@ -107,18 +994,30 @@ const Table = _ref => {
|
|
|
107
994
|
size,
|
|
108
995
|
someRowsSelected
|
|
109
996
|
},
|
|
110
|
-
children:
|
|
111
|
-
role: "table"
|
|
997
|
+
children: jsxs("div", {
|
|
112
998
|
// This is a performance optimization; we want to statically create the styles for the table,
|
|
113
999
|
// but for the dynamic theme values, we need to use CSS variables.
|
|
114
1000
|
// See: https://emotion.sh/docs/best-practices#advanced-css-variables-with-style
|
|
115
|
-
,
|
|
116
1001
|
style: {
|
|
117
1002
|
...style,
|
|
118
1003
|
['--table-separator-color']: theme.colors.tableSeparatorColor,
|
|
119
|
-
['--table-row-hover']: theme.colors.tableRowHover
|
|
1004
|
+
['--table-row-hover']: theme.colors.tableRowHover,
|
|
1005
|
+
['--table-spacing-xs']: "".concat(theme.spacing.xs, "px"),
|
|
1006
|
+
['--table-spacing-sm']: "".concat(theme.spacing.sm, "px"),
|
|
1007
|
+
['--table-spacing-md']: "".concat(theme.spacing.md, "px")
|
|
120
1008
|
},
|
|
121
|
-
children:
|
|
1009
|
+
children: [jsxs("div", {
|
|
1010
|
+
role: "table",
|
|
1011
|
+
children: [children, empty && jsx("div", {
|
|
1012
|
+
css: /*#__PURE__*/css({
|
|
1013
|
+
padding: theme.spacing.lg
|
|
1014
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:Table;"),
|
|
1015
|
+
children: empty
|
|
1016
|
+
})]
|
|
1017
|
+
}), !empty && pagination && jsx("div", {
|
|
1018
|
+
css: tableStyles.paginationContainer,
|
|
1019
|
+
children: pagination
|
|
1020
|
+
})]
|
|
122
1021
|
})
|
|
123
1022
|
});
|
|
124
1023
|
};
|
|
@@ -131,14 +1030,32 @@ const TableRow = _ref2 => {
|
|
|
131
1030
|
isHeader = false,
|
|
132
1031
|
verticalAlignment = 'top'
|
|
133
1032
|
} = _ref2;
|
|
1033
|
+
const {
|
|
1034
|
+
size
|
|
1035
|
+
} = useContext(TableContext);
|
|
1036
|
+
const {
|
|
1037
|
+
theme
|
|
1038
|
+
} = useDesignSystemTheme();
|
|
1039
|
+
|
|
1040
|
+
// Vertical only be larger if the row is a header AND size is large.
|
|
1041
|
+
const shouldUseLargeVerticalPadding = isHeader && size === 'default';
|
|
1042
|
+
let rowPadding;
|
|
1043
|
+
if (shouldUseLargeVerticalPadding) {
|
|
1044
|
+
rowPadding = theme.spacing.sm;
|
|
1045
|
+
} else if (size === 'default') {
|
|
1046
|
+
rowPadding = 6;
|
|
1047
|
+
} else {
|
|
1048
|
+
rowPadding = theme.spacing.xs;
|
|
1049
|
+
}
|
|
134
1050
|
return jsx(TableRowContext.Provider, {
|
|
135
1051
|
value: {
|
|
136
1052
|
isHeader
|
|
137
1053
|
},
|
|
138
1054
|
children: jsx("div", {
|
|
139
|
-
css: tableStyles.row,
|
|
1055
|
+
css: [tableStyles.row, process.env.NODE_ENV === "production" ? "" : ";label:TableRow;"],
|
|
140
1056
|
role: "row",
|
|
141
1057
|
style: {
|
|
1058
|
+
['--table-row-vertical-padding']: "".concat(rowPadding, "px"),
|
|
142
1059
|
['--table-row-vertical-alignment']: verticalAlignment === 'top' ? 'flex-start' : 'center'
|
|
143
1060
|
},
|
|
144
1061
|
children: children
|
|
@@ -159,7 +1076,7 @@ const TableCell = _ref3 => {
|
|
|
159
1076
|
typographySize = 'sm';
|
|
160
1077
|
}
|
|
161
1078
|
return jsx("div", {
|
|
162
|
-
css: [tableStyles.cell,
|
|
1079
|
+
css: [tableStyles.cell, process.env.NODE_ENV === "production" ? "" : ";label:TableCell;"],
|
|
163
1080
|
role: "cell",
|
|
164
1081
|
style: style,
|
|
165
1082
|
children: jsx(Typography.Text, {
|
|
@@ -212,22 +1129,30 @@ const TableHeader = _ref4 => {
|
|
|
212
1129
|
typographySize = 'sm';
|
|
213
1130
|
}
|
|
214
1131
|
const textContents = jsx(Typography.Text, {
|
|
1132
|
+
className: "table-header-text"
|
|
215
1133
|
// If sortable, we must use ellipsis to prevent wrapping and misalignment.
|
|
1134
|
+
,
|
|
216
1135
|
ellipsis: ellipsis || sortable,
|
|
217
1136
|
size: typographySize,
|
|
218
1137
|
title: ellipsis && typeof children === 'string' && children || undefined,
|
|
219
1138
|
children: children
|
|
220
1139
|
});
|
|
221
1140
|
return jsx("div", {
|
|
222
|
-
css: [tableStyles.cell, tableStyles.header,
|
|
1141
|
+
css: [tableStyles.cell, tableStyles.header, process.env.NODE_ENV === "production" ? "" : ";label:TableHeader;"],
|
|
223
1142
|
role: "columnheader",
|
|
224
1143
|
"aria-sort": sortable && ariaSort || undefined,
|
|
225
|
-
|
|
1144
|
+
onClick: onToggleSort,
|
|
1145
|
+
style: {
|
|
1146
|
+
...style,
|
|
1147
|
+
['--table-header-text-color']: theme.colors.actionDefaultTextDefault,
|
|
1148
|
+
['--table-header-focus-color']: theme.colors.actionDefaultTextHover,
|
|
1149
|
+
['--table-header-active-color']: theme.colors.actionDefaultTextPress,
|
|
1150
|
+
['--table-header-sort-icon-color']: theme.colors.textSecondary
|
|
1151
|
+
},
|
|
226
1152
|
children: sortable ? jsxs("div", {
|
|
227
1153
|
css: [tableStyles.headerButtonTarget, process.env.NODE_ENV === "production" ? "" : ";label:TableHeader;"],
|
|
228
1154
|
role: "button",
|
|
229
1155
|
tabIndex: 0,
|
|
230
|
-
onClick: onToggleSort,
|
|
231
1156
|
onKeyDown: event => {
|
|
232
1157
|
if (sortable && (event.key === 'Enter' || event.key === ' ')) {
|
|
233
1158
|
event.preventDefault();
|
|
@@ -235,8 +1160,9 @@ const TableHeader = _ref4 => {
|
|
|
235
1160
|
}
|
|
236
1161
|
},
|
|
237
1162
|
children: [textContents, jsx("span", {
|
|
1163
|
+
className: "table-header-icon-container",
|
|
238
1164
|
style: {
|
|
239
|
-
|
|
1165
|
+
marginLeft: 4
|
|
240
1166
|
},
|
|
241
1167
|
children: sortIcon
|
|
242
1168
|
})]
|
|
@@ -286,12 +1212,6 @@ const TableRowSelectCell = _ref6 => {
|
|
|
286
1212
|
return jsx("div", {
|
|
287
1213
|
css: tableStyles.checkboxCell,
|
|
288
1214
|
style: {
|
|
289
|
-
paddingLeft: 8,
|
|
290
|
-
paddingTop: 0,
|
|
291
|
-
paddingBottom: 0,
|
|
292
|
-
flex: 0,
|
|
293
|
-
minWidth: 16,
|
|
294
|
-
maxWidth: 16,
|
|
295
1215
|
['--row-checkbox-opacity']: someRowsSelected ? 1 : 0
|
|
296
1216
|
},
|
|
297
1217
|
role: isHeader ? 'columnheader' : 'cell'
|
|
@@ -305,6 +1225,86 @@ const TableRowSelectCell = _ref6 => {
|
|
|
305
1225
|
})
|
|
306
1226
|
});
|
|
307
1227
|
};
|
|
1228
|
+
const TableRowMenuContainer = _ref7 => {
|
|
1229
|
+
let {
|
|
1230
|
+
children,
|
|
1231
|
+
style
|
|
1232
|
+
} = _ref7;
|
|
1233
|
+
return jsx("div", {
|
|
1234
|
+
css: tableStyles.rowMenuContainer,
|
|
1235
|
+
style: style,
|
|
1236
|
+
children: children
|
|
1237
|
+
});
|
|
1238
|
+
};
|
|
1239
|
+
const TableSkeletonStyles = {
|
|
1240
|
+
container: process.env.NODE_ENV === "production" ? {
|
|
1241
|
+
name: "uxqssl",
|
|
1242
|
+
styles: "display:flex;flex-direction:column;align-items:flex-start;margin:6px 0;gap:12px"
|
|
1243
|
+
} : {
|
|
1244
|
+
name: "1zl9za-container",
|
|
1245
|
+
styles: "display:flex;flex-direction:column;align-items:flex-start;margin:6px 0;gap:12px;label:container;",
|
|
1246
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
1247
|
+
},
|
|
1248
|
+
cell: process.env.NODE_ENV === "production" ? {
|
|
1249
|
+
name: "18wj7jq",
|
|
1250
|
+
styles: "width:100%;height:8px;border-radius:4px;background:var(--table-skeleton-color)"
|
|
1251
|
+
} : {
|
|
1252
|
+
name: "2md9en-cell",
|
|
1253
|
+
styles: "width:100%;height:8px;border-radius:4px;background:var(--table-skeleton-color);label:cell;",
|
|
1254
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
const TableSkeleton = _ref8 => {
|
|
1258
|
+
let {
|
|
1259
|
+
lines = 1,
|
|
1260
|
+
seed = '',
|
|
1261
|
+
style
|
|
1262
|
+
} = _ref8;
|
|
1263
|
+
const {
|
|
1264
|
+
theme
|
|
1265
|
+
} = useDesignSystemTheme();
|
|
1266
|
+
|
|
1267
|
+
// This is a very simple PRNG that is seeded (so that the output is deterministic).
|
|
1268
|
+
// We need this in order to produce a random ragged edge for the table skeleton.
|
|
1269
|
+
function pseudoRandomNumberGeneratorFromSeed(seed) {
|
|
1270
|
+
// This is a simple way to get a consistent number from a string;
|
|
1271
|
+
// `charCodeAt` returns a number between 0 and 65535, and we then just add them all up.
|
|
1272
|
+
const seedValue = seed.split('').map(char => char.charCodeAt(0)).reduce((prev, curr) => prev + curr, 0);
|
|
1273
|
+
|
|
1274
|
+
// This is a simple sine wave function that will always return a number between 0 and 1.
|
|
1275
|
+
// This produces a value akin to `Math.random()`, but has deterministic output.
|
|
1276
|
+
// Of course, sine curves are not a perfectly random distribution between 0 and 1, but
|
|
1277
|
+
// it's close enough for our purposes.
|
|
1278
|
+
return Math.sin(seedValue) / 2 + 0.5;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
// This is a simple Fisher-Yates shuffler using the above PRNG.
|
|
1282
|
+
function shuffleArray(arr, seed) {
|
|
1283
|
+
for (let i = arr.length - 1; i > 0; i--) {
|
|
1284
|
+
const j = Math.floor(pseudoRandomNumberGeneratorFromSeed(seed + String(i)) * (i + 1));
|
|
1285
|
+
[arr[i], arr[j]] = [arr[j], arr[i]];
|
|
1286
|
+
}
|
|
1287
|
+
return arr;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
// Finally, we shuffle a list off offsets to apply to the widths of the cells.
|
|
1291
|
+
// This ensures that the cells are not all the same width, but that they are
|
|
1292
|
+
// random to produce a more realistic looking skeleton.
|
|
1293
|
+
const widths = shuffleArray([48, 24, 0], seed);
|
|
1294
|
+
return jsx("div", {
|
|
1295
|
+
css: TableSkeletonStyles.container,
|
|
1296
|
+
style: {
|
|
1297
|
+
...style,
|
|
1298
|
+
// TODO: Pull this from the themes; it's not currently available.
|
|
1299
|
+
['--table-skeleton-color']: theme.isDarkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(31, 38, 45, 0.1)'
|
|
1300
|
+
},
|
|
1301
|
+
children: [...Array(lines)].map((_, idx) => jsx("div", {
|
|
1302
|
+
css: [TableSkeletonStyles.cell, {
|
|
1303
|
+
width: "calc(100% - ".concat(widths[idx % widths.length], "px)")
|
|
1304
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:TableSkeleton;"]
|
|
1305
|
+
}, idx))
|
|
1306
|
+
});
|
|
1307
|
+
};
|
|
308
1308
|
|
|
309
1309
|
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)."; }
|
|
310
1310
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
@@ -410,5 +1410,5 @@ var Slider = /*#__PURE__*/Object.freeze({
|
|
|
410
1410
|
Thumb: Thumb
|
|
411
1411
|
});
|
|
412
1412
|
|
|
413
|
-
export { Slider, Table, TableCell, TableHeader, TableHeaderResizeHandle, TableRow, TableRowSelectCell };
|
|
1413
|
+
export { Filter, FilterButtonContainer, FilterContent, FilterCountBadge, FilterLoadingSpinner, FilterOptionControlledList, FilterOptionList, FilterOptionListCheckboxItem, FilterOptionListSearch, FilterOptionListSelectItem, FilterSectionHeader, FilterSeparator, FilterTrigger, Slider, Table, TableCell, TableHeader, TableHeaderResizeHandle, TableRow, TableRowMenuContainer, TableRowSelectCell, TableSkeleton };
|
|
414
1414
|
//# sourceMappingURL=development.js.map
|