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