@jobber/components 4.58.5 → 4.59.1-st-spike-w.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/AnimatedSwitcher/index.js +5 -13
- package/dist/{AnimatedSwitcher-d1e1ddcf.js → AnimatedSwitcher-6ffd5003.js} +9 -15
- package/dist/Autocomplete/index.js +57 -68
- package/dist/Avatar/index.js +7 -15
- package/dist/{Avatar-1aa30ee1.js → Avatar-b2e862de.js} +13 -21
- package/dist/Banner/index.js +29 -38
- package/dist/Button/index.js +8 -16
- package/dist/{Button-db6114a6.js → Button-319d8fa0.js} +15 -22
- package/dist/ButtonDismiss/index.js +9 -17
- package/dist/ButtonDismiss-85986110.js +8 -0
- package/dist/Card/index.js +15 -23
- package/dist/{Card-116af709.js → Card-c1970a7c.js} +27 -34
- package/dist/Checkbox/index.js +11 -19
- package/dist/{Checkbox-bc4bc968.js → Checkbox-e4733fb4.js} +30 -37
- package/dist/Chip/index.js +24 -33
- package/dist/{Chip-4f12eec8.js → Chip-12a64c38.js} +94 -106
- package/dist/{Chip-f8b8fd89.js → Chip-40f5214c.js} +29 -37
- package/dist/Chips/index.js +25 -34
- package/dist/Combobox/Combobox.d.ts +3 -8
- package/dist/Combobox/Combobox.types.d.ts +71 -44
- package/dist/Combobox/ComboboxProvider.d.ts +12 -4
- package/dist/Combobox/components/ComboboxActivator/ComboboxActivator.d.ts +1 -4
- package/dist/Combobox/components/ComboboxOption/ComboboxOption.d.ts +6 -2
- package/dist/Combobox/components/ComboboxTrigger/ComboboxTrigger.d.ts +2 -6
- package/dist/Combobox/components/ComboboxTrigger/index.d.ts +0 -2
- package/dist/Combobox/hooks/useCombobox.d.ts +15 -0
- package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +1 -1
- package/dist/Combobox/hooks/useComboboxContent.d.ts +1 -6
- package/dist/Combobox/hooks/useComboboxValidation.d.ts +11 -9
- package/dist/Combobox/hooks/useMakeComboboxHandlers.d.ts +7 -0
- package/dist/Combobox/index.js +219 -247
- package/dist/ConfirmationModal/index.js +22 -30
- package/dist/{ConfirmationModal-285c3cbe.js → ConfirmationModal-86b42ca0.js} +14 -20
- package/dist/Content/index.js +4 -12
- package/dist/{Content-2ca1ffe1.js → Content-3354c281.js} +8 -14
- package/dist/Countdown/index.js +8 -17
- package/dist/DataDump/index.js +24 -32
- package/dist/DataList/index.js +256 -268
- package/dist/DataTable/index.js +92 -123
- package/dist/DatePicker/index.js +12 -20
- package/dist/{DatePicker-49213434.js → DatePicker-9f1e19a5.js} +30 -39
- package/dist/DescriptionList/index.js +9 -17
- package/dist/Disclosure/index.js +21 -29
- package/dist/Divider/index.js +7 -16
- package/dist/Drawer/index.js +24 -34
- package/dist/Emphasis/index.js +5 -13
- package/dist/Emphasis-edd2af9b.js +13 -0
- package/dist/FeatureSwitch/index.js +39 -48
- package/dist/Flex/index.js +6 -15
- package/dist/Form/index.js +11 -19
- package/dist/FormField/index.js +16 -24
- package/dist/{FormField-fa9254dc.js → FormField-99918ed4.js} +58 -65
- package/dist/FormatDate/index.js +2 -11
- package/dist/{FormatDate-70ea5b43.js → FormatDate-720b39cf.js} +3 -10
- package/dist/FormatEmail/index.js +7 -16
- package/dist/FormatFile/index.js +27 -35
- package/dist/{FormatFile-6423c3b5.js → FormatFile-e1498cb9.js} +44 -52
- package/dist/FormatRelativeDateTime/index.js +7 -15
- package/dist/FormatTime/index.js +3 -11
- package/dist/Gallery/index.js +40 -49
- package/dist/Glimmer/index.js +6 -15
- package/dist/{Glimmer-cfa92a88.js → Glimmer-d3be9219.js} +25 -33
- package/dist/Grid/index.js +14 -24
- package/dist/Heading/index.js +5 -13
- package/dist/{Heading-4cde9989.js → Heading-04994667.js} +4 -10
- package/dist/Icon/index.js +3 -11
- package/dist/Icon-22723fe6.js +34 -0
- package/dist/InlineLabel/index.js +5 -13
- package/dist/{InlineLabel-a24706c4.js → InlineLabel-4df86867.js} +9 -16
- package/dist/InputAvatar/index.js +32 -40
- package/dist/InputDate/index.js +26 -35
- package/dist/InputEmail/index.js +18 -27
- package/dist/InputFile/index.js +14 -23
- package/dist/{InputFile-25c3369b.js → InputFile-3bbaa09e.js} +24 -33
- package/dist/InputGroup/index.js +4 -12
- package/dist/{InputGroup-3fdde16b.js → InputGroup-1b4abd36.js} +9 -16
- package/dist/InputNumber/index.js +17 -25
- package/dist/{InputNumber-ea9fcee1.js → InputNumber-fa8132f3.js} +7 -13
- package/dist/InputPassword/index.js +19 -27
- package/dist/InputPhoneNumber/index.js +28 -36
- package/dist/InputText/index.js +17 -25
- package/dist/{InputText-ab237501.js → InputText-6d262128.js} +9 -15
- package/dist/InputTime/index.js +29 -38
- package/dist/InputValidation/index.js +9 -17
- package/dist/InputValidation-b6adff05.js +23 -0
- package/dist/LightBox/index.js +16 -24
- package/dist/LightBox-8c8f30b1.js +109 -0
- package/dist/Link/index.js +3 -11
- package/dist/List/index.js +47 -59
- package/dist/Markdown/index.js +10 -18
- package/dist/Markdown-2ec28e51.js +55 -0
- package/dist/Menu/index.js +13 -21
- package/dist/{Menu-2e64307a.js → Menu-10681184.js} +40 -47
- package/dist/Modal/index.js +16 -24
- package/dist/{Modal-c17cc105.js → Modal-06dc9551.js} +33 -41
- package/dist/MultiSelect/index.js +38 -47
- package/dist/Option-7967170c.js +12 -0
- package/dist/Page/index.js +48 -57
- package/dist/Popover/index.js +12 -20
- package/dist/{Popover-7c966790.js → Popover-a93db92d.js} +15 -21
- package/dist/ProgressBar/index.js +4 -12
- package/dist/{ProgressBar-5dfc1885.js → ProgressBar-04ee007d.js} +8 -15
- package/dist/RadioGroup/index.js +7 -16
- package/dist/{RadioGroup-9bdd8a59.js → RadioGroup-2ccd0678.js} +16 -23
- package/dist/RecurringSelect/index.js +90 -98
- package/dist/Select/index.js +17 -26
- package/dist/Spinner/index.js +4 -12
- package/dist/{Spinner-9d8fc7ff.js → Spinner-5d8359b8.js} +7 -14
- package/dist/StatusLabel/index.js +12 -21
- package/dist/Switch/index.js +5 -13
- package/dist/{Switch-cc9b645c.js → Switch-8bee06df.js} +17 -24
- package/dist/Table/index.js +19 -35
- package/dist/Tabs/index.js +23 -33
- package/dist/Text/index.js +5 -13
- package/dist/{Text-54334431.js → Text-703e2c21.js} +4 -10
- package/dist/Toast/index.js +32 -40
- package/dist/Tooltip/index.js +7 -15
- package/dist/{Tooltip-6b12f1c2.js → Tooltip-c80b9fb7.js} +22 -30
- package/dist/Typography/index.js +4 -12
- package/dist/{Typography-83915c54.js → Typography-09952a2f.js} +15 -22
- package/dist/{style-inject.es-9d2f5f4e.js → style-inject.es-a0e1a0ba.js} +1 -3
- package/dist/{tslib.es6-5b8768b7.js → tslib.es6-5849cd88.js} +1 -4
- package/package.json +3 -3
- package/rollup.config.js +1 -1
- package/dist/ButtonDismiss-1ccb84ec.js +0 -14
- package/dist/Combobox/components/ComboboxTrigger/ComboboxTriggerButton/ComboboxTriggerButton.d.ts +0 -3
- package/dist/Combobox/components/ComboboxTrigger/ComboboxTriggerChip/ComboboxTriggerChip.d.ts +0 -3
- package/dist/Emphasis-e10dde65.js +0 -19
- package/dist/Icon-405a216c.js +0 -40
- package/dist/InputValidation-377d6c62.js +0 -29
- package/dist/LightBox-93ef99b9.js +0 -117
- package/dist/Markdown-d53b01bf.js +0 -62
- package/dist/Option-07a24acd.js +0 -19
package/dist/DataList/index.js
CHANGED
|
@@ -1,65 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
require('lodash/sortBy');
|
|
44
|
-
require('@jobber/hooks/useLiveAnnounce');
|
|
45
|
-
require('../FormField-fa9254dc.js');
|
|
46
|
-
require('../InputValidation-377d6c62.js');
|
|
47
|
-
|
|
48
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
49
|
-
|
|
50
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
51
|
-
var noop__default = /*#__PURE__*/_interopDefaultLegacy(noop);
|
|
52
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
53
|
-
var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
|
|
54
|
-
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
1
|
+
import { _ as __rest } from '../tslib.es6-5849cd88.js';
|
|
2
|
+
import React, { createContext, useContext, useState, useEffect, useRef, Children, isValidElement, useMemo, useCallback, cloneElement } from 'react';
|
|
3
|
+
import { s as styleInject } from '../style-inject.es-a0e1a0ba.js';
|
|
4
|
+
import { T as Text } from '../Text-703e2c21.js';
|
|
5
|
+
import { G as Glimmer } from '../Glimmer-d3be9219.js';
|
|
6
|
+
import noop from 'lodash/noop';
|
|
7
|
+
import { tokens } from '@jobber/design';
|
|
8
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
9
|
+
import classnames from 'classnames';
|
|
10
|
+
import { T as Tooltip } from '../Tooltip-c80b9fb7.js';
|
|
11
|
+
import { B as Button } from '../Button-319d8fa0.js';
|
|
12
|
+
import { useInView } from '@jobber/hooks/useInView';
|
|
13
|
+
import isEmpty from 'lodash/isEmpty';
|
|
14
|
+
import { I as InlineLabel } from '../InlineLabel-4df86867.js';
|
|
15
|
+
import { F as FormatDate } from '../FormatDate-720b39cf.js';
|
|
16
|
+
import { H as Heading } from '../Heading-04994667.js';
|
|
17
|
+
import { useFocusTrap } from '@jobber/hooks/useFocusTrap';
|
|
18
|
+
import { useRefocusOnActivator } from '@jobber/hooks/useRefocusOnActivator';
|
|
19
|
+
import { useOnKeyDown } from '@jobber/hooks/useOnKeyDown';
|
|
20
|
+
import { createPortal } from 'react-dom';
|
|
21
|
+
import { C as Checkbox } from '../Checkbox-e4733fb4.js';
|
|
22
|
+
import { Link } from 'react-router-dom';
|
|
23
|
+
import { A as AnimatedSwitcher } from '../AnimatedSwitcher-6ffd5003.js';
|
|
24
|
+
import { P as Popover } from '../Popover-a93db92d.js';
|
|
25
|
+
import { C as Content } from '../Content-3354c281.js';
|
|
26
|
+
import { C as Chips, b as Chip } from '../Chip-12a64c38.js';
|
|
27
|
+
import '@jobber/hooks/useAssert';
|
|
28
|
+
import '../Avatar-b2e862de.js';
|
|
29
|
+
import 'color';
|
|
30
|
+
import { T as Typography } from '../Typography-09952a2f.js';
|
|
31
|
+
import 'react-popper';
|
|
32
|
+
import debounce from 'lodash/debounce';
|
|
33
|
+
import { I as InputText } from '../InputText-6d262128.js';
|
|
34
|
+
import { S as Spinner } from '../Spinner-5d8359b8.js';
|
|
35
|
+
import { I as Icon } from '../Icon-22723fe6.js';
|
|
36
|
+
import 'uuid';
|
|
37
|
+
import 'react-hook-form';
|
|
38
|
+
import '../ButtonDismiss-85986110.js';
|
|
39
|
+
import 'lodash/sortBy';
|
|
40
|
+
import '@jobber/hooks/useLiveAnnounce';
|
|
41
|
+
import '../FormField-99918ed4.js';
|
|
42
|
+
import '../InputValidation-b6adff05.js';
|
|
55
43
|
|
|
56
44
|
var css_248z$f = ".TkdrExYnvcY-,\n.TkdrExYnvcY- * {\n box-sizing: border-box;\n}\n\n.TkdrExYnvcY- {\n --data-list--minimum-item-height: calc(var(--base-unit) * 3.5);\n\n display: -ms-flexbox;\n\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n position: relative;\n z-index: 0;\n z-index: var(--elevation-default);\n -ms-flex: 1;\n flex: 1;\n}\n\n/*\n * Header\n */\n\n.IcAlZHoB4LI- {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n z-index: 1;\n z-index: var(--elevation-base);\n margin-bottom: calc(16px / 2);\n margin-bottom: var(--space-small);\n -ms-flex-align: center;\n align-items: center;\n}\n\n.TFO76ysivmg- {\n display: grid;\n padding: calc(16px / 2) 0;\n padding: var(--space-small) 0;\n gap: calc(16px / 2);\n grid-gap: calc(16px / 2);\n grid-gap: var(--space-small);\n gap: var(--space-small);\n grid-template-columns: auto -webkit-max-content;\n grid-template-columns: auto max-content;\n}\n\n.jGHZZYZm1ZY- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n -ms-flex-pack: center;\n justify-content: center;\n min-height: calc(16px * 3);\n min-height: var(--space-largest);\n padding: calc(16px / 2);\n padding: var(--space-small);\n border-bottom: calc(16px / 8) solid rgb(225, 225, 225);\n border-bottom: var(--border-thick) solid var(--color-border);\n}\n\n.GiD7MjZJbcw- {\n display: -ms-flexbox;\n display: flex;\n}\n\n@media (max-width: 489.98px) {\n\n.GiD7MjZJbcw- {\n -ms-flex-pack: justify;\n justify-content: space-between;\n width: 100%;\n}\n }\n\n@media (--small-screens-and-below) {\n\n.GiD7MjZJbcw- {\n -ms-flex-pack: justify;\n justify-content: space-between;\n width: 100%;\n}\n }\n\n.jMSVGIAr5tk- > p {\n font-weight: 500;\n white-space: nowrap;\n}\n\n.jMSVGIAr5tk- {\n display: -ms-flexbox;\n display: flex;\n margin: calc((16px / 2) * -1) 0;\n margin: calc(calc(16px / 2) * -1) 0;\n margin: calc(var(--space-small) * -1) 0;\n -ms-flex-align: center;\n align-items: center;\n gap: calc(16px / 4);\n gap: var(--space-smaller);\n}\n\n/*\n * List Item\n */\n\n.ise8kHCfhCY- {\n position: relative;\n padding: calc(16px / 2);\n padding: var(--space-small);\n border-bottom: calc(16px / 16) solid rgb(225, 225, 225);\n border-bottom: var(--border-base) solid var(--color-border);\n transition: all 200ms;\n transition: all var(--timing-base);\n}\n\n.ise8kHCfhCY-,\n.Tq6e0BGwcSM- {\n display: grid;\n grid-template-columns: minmax(0px, auto);\n min-height: var(--data-list--minimum-item-height);\n -ms-flex-align: center;\n align-items: center;\n}\n\n.ise8kHCfhCY-.Pc0JGX6jCD4-,\n.ise8kHCfhCY-:hover,\n.ise8kHCfhCY-:focus-within {\n --data-list-item-active-color: var(--color-surface--background);\n background-color: rgb(244, 244, 244);\n background-color: var(--data-list-item-active-color);\n}\n\n.Tq6e0BGwcSM- {\n margin: calc((16px / 2) * -1) 0;\n margin: calc(calc(16px / 2) * -1) 0;\n margin: calc(var(--space-small) * -1) 0;\n padding: calc(16px / 2) 0;\n padding: var(--space-small) 0;\n border: none;\n text-align: left;\n -webkit-text-decoration: none;\n text-decoration: none;\n background-color: transparent;\n cursor: pointer;\n}\n\n/**\n * Reset CSS properties on focus to ensure we only have the focus state on the\n * parent .listItem\n */\n\n.Tq6e0BGwcSM-:focus {\n outline: none;\n background-color: transparent;\n}\n\n/**\n * Enable a better hover and focus experience when :has() is supported.\n * This is a workaround for Firefox where the :has() selector is not supported.\n */\n\n@supports selector(*:has(*)) {\n .ise8kHCfhCY-:hover,\n .ise8kHCfhCY-:focus-within {\n background-color: transparent;\n }\n\n .ise8kHCfhCY-:has(.Tq6e0BGwcSM-:hover, .Tq6e0BGwcSM-:focus) {\n background-color: var(--data-list-item-active-color);\n }\n}\n\n/*\n * List Item Selection\n */\n\n.d-79rkMqufg- {\n display: grid;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n\n@media (min-width: 768px) {\n\n.d-79rkMqufg- {\n -ms-flex-align: center;\n align-items: center;\n}\n }\n\n@media (--medium-screens-and-up) {\n\n.d-79rkMqufg- {\n -ms-flex-align: center;\n align-items: center;\n}\n }\n\n.d-79rkMqufg-,\n.jGHZZYZm1ZY- .d-79rkMqufg- {\n grid-template-columns: -webkit-max-content minmax(0px, auto);\n grid-template-columns: max-content minmax(0px, auto);\n -webkit-column-gap: calc(16px / 2);\n -webkit-column-gap: var(--space-small);\n -moz-column-gap: calc(16px / 2);\n -moz-column-gap: var(--space-small);\n column-gap: calc(16px / 2);\n column-gap: var(--space-small);\n}\n\n.jGHZZYZm1ZY- .d-79rkMqufg- {\n display: grid;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.qm-SSuWTXkI- {\n display: -ms-flexbox;\n display: flex;\n visibility: hidden;\n\n /* To compensate the Checkbox's label margin that we are using for screen-readers */\n margin-right: calc((16px * 1) * -1);\n margin-right: calc(calc(16px * 1) * -1);\n margin-right: calc(var(--space-base) * -1);\n}\n\n.qm-SSuWTXkI-.VA9RnQp6nbI- {\n visibility: visible;\n}\n\n.ise8kHCfhCY- .d-79rkMqufg- > :first-child {\n -ms-flex-order: 2;\n order: 2;\n}\n\n.ise8kHCfhCY- .d-79rkMqufg- > :last-child {\n -ms-flex-order: 1;\n order: 1;\n padding-top: calc(16px / 4);\n padding-top: var(--space-smaller);\n opacity: 1;\n transition: opacity 100ms ease-in-out;\n transition: opacity var(--transition-properties);\n --transition-properties: var(--timing-quick) ease-in-out;\n}\n\n@media (min-width: 768px) {\n\n.ise8kHCfhCY- .d-79rkMqufg- > :last-child {\n padding-top: 0;\n opacity: 0;\n}\n }\n\n@media (--medium-screens-and-up) {\n\n.ise8kHCfhCY- .d-79rkMqufg- > :last-child {\n padding-top: 0;\n opacity: 0;\n}\n }\n\n.ise8kHCfhCY-:hover .d-79rkMqufg- > :last-child,\n.ise8kHCfhCY-:focus-within .d-79rkMqufg- > :last-child,\n.ise8kHCfhCY- .d-79rkMqufg-._4L7iXXzLr5k- > :last-child {\n opacity: 1;\n}\n\n/*\n * Filters\n */\n\n.Kkp-IYmwq-s- {\n display: -ms-flexbox;\n display: flex;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: rgba(255, 255, 255, 0.6);\n background-color: var(--color-overlay--dimmed);\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.m-eCShL7TU4- {\n position: sticky;\n top: 50vh;\n}\n\n/* This hides the text from the UI but not from the screen readers */\n\n.esUiRgWabYw- {\n position: absolute;\n top: auto;\n left: -10000px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n text-indent: -10000px;\n}\n";
|
|
57
45
|
var styles$f = {"wrapper":"TkdrExYnvcY-","titleContainer":"IcAlZHoB4LI-","headerFilters":"TFO76ysivmg-","headerTitles":"jGHZZYZm1ZY-","batchSelectContainer":"GiD7MjZJbcw-","headerBatchSelect":"jMSVGIAr5tk-","listItem":"ise8kHCfhCY-","listItemClickable":"Tq6e0BGwcSM-","active":"Pc0JGX6jCD4-","selectable":"d-79rkMqufg-","selectAllCheckbox":"qm-SSuWTXkI-","visible":"VA9RnQp6nbI-","selected":"_4L7iXXzLr5k-","filtering":"Kkp-IYmwq-s-","filteringSpinner":"m-eCShL7TU4-","srOnly":"esUiRgWabYw-"};
|
|
58
|
-
|
|
46
|
+
styleInject(css_248z$f);
|
|
59
47
|
|
|
60
48
|
var css_248z$e = ".F56prQsXm3A- {\n min-width: 80px;\n margin-left: calc(16px / 2);\n margin-left: var(--space-small);\n}\n";
|
|
61
49
|
var styles$e = {"results":"F56prQsXm3A-"};
|
|
62
|
-
|
|
50
|
+
styleInject(css_248z$e);
|
|
63
51
|
|
|
64
52
|
const DATALIST_TOTALCOUNT_TEST_ID = "ATL-DataList-TotalCount";
|
|
65
53
|
function DataListTotalCount({ totalCount, loading, }) {
|
|
@@ -67,15 +55,15 @@ function DataListTotalCount({ totalCount, loading, }) {
|
|
|
67
55
|
return null;
|
|
68
56
|
let output = null;
|
|
69
57
|
if (totalCount === null && loading) {
|
|
70
|
-
output =
|
|
58
|
+
output = React.createElement(Glimmer, { size: "auto", shape: "rectangle" });
|
|
71
59
|
}
|
|
72
60
|
if (typeof totalCount === "number") {
|
|
73
|
-
output = (
|
|
61
|
+
output = (React.createElement(Text, { variation: "subdued" },
|
|
74
62
|
"(",
|
|
75
63
|
totalCount.toLocaleString(),
|
|
76
64
|
" results)"));
|
|
77
65
|
}
|
|
78
|
-
return (
|
|
66
|
+
return (React.createElement("div", { className: styles$e.results, "data-testid": DATALIST_TOTALCOUNT_TEST_ID }, output));
|
|
79
67
|
}
|
|
80
68
|
|
|
81
69
|
const defaultValues$1 = {
|
|
@@ -85,19 +73,19 @@ const defaultValues$1 = {
|
|
|
85
73
|
children: [],
|
|
86
74
|
selected: [],
|
|
87
75
|
layoutBreakpoints: [],
|
|
88
|
-
registerLayoutBreakpoints:
|
|
76
|
+
registerLayoutBreakpoints: noop,
|
|
89
77
|
layouts: {
|
|
90
|
-
xs: children =>
|
|
91
|
-
sm: children =>
|
|
92
|
-
md: children =>
|
|
93
|
-
lg: children =>
|
|
94
|
-
xl: children =>
|
|
78
|
+
xs: children => React.createElement(React.Fragment, null, children),
|
|
79
|
+
sm: children => React.createElement(React.Fragment, null, children),
|
|
80
|
+
md: children => React.createElement(React.Fragment, null, children),
|
|
81
|
+
lg: children => React.createElement(React.Fragment, null, children),
|
|
82
|
+
xl: children => React.createElement(React.Fragment, null, children),
|
|
95
83
|
},
|
|
96
|
-
registerLayout:
|
|
84
|
+
registerLayout: noop,
|
|
97
85
|
};
|
|
98
|
-
const DataListContext =
|
|
86
|
+
const DataListContext = createContext(defaultValues$1);
|
|
99
87
|
function useDataListContext() {
|
|
100
|
-
return
|
|
88
|
+
return useContext(DataListContext);
|
|
101
89
|
}
|
|
102
90
|
|
|
103
91
|
function useMediaQuery(CSSMediaQuery) {
|
|
@@ -114,8 +102,8 @@ function useMediaQuery(CSSMediaQuery) {
|
|
|
114
102
|
*/
|
|
115
103
|
if (window.matchMedia === undefined)
|
|
116
104
|
return true;
|
|
117
|
-
const [matches, setMatches] =
|
|
118
|
-
|
|
105
|
+
const [matches, setMatches] = useState(window.matchMedia(CSSMediaQuery).matches);
|
|
106
|
+
useEffect(() => {
|
|
119
107
|
const media = window.matchMedia(CSSMediaQuery);
|
|
120
108
|
if (media.matches !== matches) {
|
|
121
109
|
setMatches(media.matches);
|
|
@@ -141,12 +129,12 @@ const BREAKPOINT_SIZES = {
|
|
|
141
129
|
lg: 1080,
|
|
142
130
|
xl: 1440,
|
|
143
131
|
};
|
|
144
|
-
const SEARCH_DEBOUNCE_DELAY =
|
|
132
|
+
const SEARCH_DEBOUNCE_DELAY = tokens["timing-slowest"];
|
|
145
133
|
const DATA_LIST_FILTERING_SPINNER_TEST_ID = "ATL-DataList-filteringSpinner";
|
|
146
134
|
const DATA_LIST_LOADING_MORE_SPINNER_TEST_ID = "ATL-DataList-loadingMoreSpinner";
|
|
147
135
|
const DATA_LOAD_MORE_TEST_ID = "ATL-DataList-LoadMore-trigger";
|
|
148
|
-
const TRANSITION_DURATION_IN_SECONDS =
|
|
149
|
-
const TRANSITION_DELAY_IN_SECONDS =
|
|
136
|
+
const TRANSITION_DURATION_IN_SECONDS = tokens["timing-base"] / 1000;
|
|
137
|
+
const TRANSITION_DELAY_IN_SECONDS = tokens["timing-quick"] / 1000;
|
|
150
138
|
|
|
151
139
|
function useResponsiveSizing() {
|
|
152
140
|
const xs = useMediaQuery(`(width > ${BREAKPOINT_SIZES.xs}px)`);
|
|
@@ -169,7 +157,7 @@ function useActiveLayout() {
|
|
|
169
157
|
|
|
170
158
|
var css_248z$d = "._8cMzUF8XEwY- {\n position: relative;\n}\n\n._8cMzUF8XEwY-::after {\n content: \"\";\n display: block;\n position: absolute;\n right: 0;\n bottom: 0;\n left: 0;\n height: 100px;\n background-image: linear-gradient(\n to top,\n rgba(255, 255, 255, 1) 0%,\n rgba(255, 255, 255, 0) 100%\n );\n background-image: linear-gradient(\n to top,\n var(--color-surface) 0%,\n rgba(var(--color-white--rgb), 0) 100%\n );\n}\n\n.Rh--6fVpkm4- {\n padding: calc(16px * 1) calc(16px / 2);\n padding: var(--space-base) var(--space-small);\n}\n\n.NFaWWvmxtkw- {\n width: 100%;\n min-width: calc(16px * 3);\n min-width: var(--space-largest);\n}\n";
|
|
171
159
|
var styles$d = {"wrapper":"_8cMzUF8XEwY-","loadingItem":"Rh--6fVpkm4-","glimmer":"NFaWWvmxtkw-"};
|
|
172
|
-
|
|
160
|
+
styleInject(css_248z$d);
|
|
173
161
|
|
|
174
162
|
const LOADING_STATE_LIMIT_ITEMS = 10;
|
|
175
163
|
const DATALIST_LOADINGSTATE_ROW_TEST_ID = "ATL-DataList-LoadingState-Row";
|
|
@@ -179,54 +167,54 @@ function DataListLoadingState() {
|
|
|
179
167
|
if (!layout)
|
|
180
168
|
return null;
|
|
181
169
|
const glimmerSize = activeBreakpoint === "xs" ? "small" : "large";
|
|
182
|
-
const glimmersFromHeader = Object.keys(headers).reduce((data, key) => (Object.assign(Object.assign({}, data), { [key]: (
|
|
183
|
-
|
|
170
|
+
const glimmersFromHeader = Object.keys(headers).reduce((data, key) => (Object.assign(Object.assign({}, data), { [key]: (React.createElement("div", { className: styles$d.glimmer },
|
|
171
|
+
React.createElement(Glimmer, { size: glimmerSize }))) })), {});
|
|
184
172
|
const loadingData = new Array(LOADING_STATE_LIMIT_ITEMS).fill(glimmersFromHeader);
|
|
185
|
-
return (
|
|
173
|
+
return (React.createElement("div", { className: styles$d.wrapper }, loadingData.map((child, i) => (React.createElement("div", { key: i, className: styles$d.loadingItem, "data-testid": DATALIST_LOADINGSTATE_ROW_TEST_ID }, layout(child))))));
|
|
186
174
|
}
|
|
187
175
|
|
|
188
176
|
const defaultValues = {
|
|
189
177
|
isInLayoutProvider: false,
|
|
190
178
|
hasInLayoutActions: false,
|
|
191
|
-
setHasInLayoutActions:
|
|
179
|
+
setHasInLayoutActions: noop,
|
|
192
180
|
};
|
|
193
|
-
const DataListLayoutContext =
|
|
181
|
+
const DataListLayoutContext = createContext(defaultValues);
|
|
194
182
|
function useDataListLayoutContext() {
|
|
195
|
-
return
|
|
183
|
+
return useContext(DataListLayoutContext);
|
|
196
184
|
}
|
|
197
185
|
|
|
198
186
|
var css_248z$c = ".jHcHGQ-HDbk- {\n display: -ms-flexbox;\n display: flex;\n position: absolute;\n top: calc((16px / 2) * -1);\n top: calc(calc(16px / 2) * -1);\n top: calc(var(--space-small) * -1);\n right: 0;\n z-index: 6;\n z-index: var(--elevation-menu);\n box-shadow: 0px calc(16px / 16) calc(16px / 4) 0px\n rgba(0, 0, 0, 0.1),\n 0px calc(16px / 4) 12px 0px rgba(0, 0, 0, 0.05);\n box-shadow: var(--shadow-base);\n padding: calc(16px / 4);\n padding: var(--space-smaller);\n border: calc(16px / 16) solid rgb(225, 225, 225);\n border: var(--border-base) solid var(--color-border);\n border-radius: calc(16px / 2);\n border-radius: var(--radius-larger);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n gap: calc(16px / 4);\n gap: var(--space-smaller);\n}\n";
|
|
199
187
|
var styles$c = {"menu":"jHcHGQ-HDbk-"};
|
|
200
|
-
|
|
188
|
+
styleInject(css_248z$c);
|
|
201
189
|
|
|
202
190
|
const CONTAINER_TEST_ID = "ATL-DataListFilters-Container";
|
|
203
191
|
|
|
204
192
|
var css_248z$b = ".jbBRoxlZlNI- {\n --overflow-fade--offset: var(--space-smaller);\n --overflow-fade--negative-offset: calc(var(--overflow-fade--offset) * -1);\n\n -ms-flex-item-align: center;\n\n align-self: center;\n position: relative;\n min-width: 0;\n}\n\n.MnN8qbS4hw4- {\n display: grid;\n margin: var(--overflow-fade--negative-offset);\n padding: var(--overflow-fade--offset);\n overflow-x: auto;\n overflow-y: visible;\n grid-auto-flow: column;\n grid-auto-columns: -webkit-max-content;\n grid-auto-columns: max-content;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.MnN8qbS4hw4- > :not(:nth-last-child(2)):not(.b-5P7Z8eGO8-) {\n margin-right: calc(16px / 2);\n margin-right: var(--space-small);\n}\n\n.b-5P7Z8eGO8- {\n visibility: hidden;\n}\n\n.xzaCS4slLpI-::before,\n.Jf227kC8Nu0-::after {\n content: \"\";\n position: absolute;\n top: 0;\n width: calc(16px * 1.5);\n width: var(--space-large);\n height: 100%;\n background-image: linear-gradient(\n to right,\n rgba(255, 255, 255, 1) 0%,\n rgba(255, 255, 255, 0) 100%\n );\n background-image: linear-gradient(\n var(--data-list-overflow-shadow-angle, to right),\n var(--color-surface) 0%,\n rgba(var(--color-white--rgb), 0) 100%\n );\n pointer-events: none;\n}\n\n.xzaCS4slLpI-::before {\n left: var(--overflow-fade--negative-offset);\n}\n\n.Jf227kC8Nu0-::after {\n --data-list-overflow-shadow-angle: to left;\n right: var(--overflow-fade--negative-offset);\n}\n";
|
|
205
193
|
var styles$b = {"fadeContainer":"jbBRoxlZlNI-","overflowGrid":"MnN8qbS4hw4-","overflowTrigger":"b-5P7Z8eGO8-","overflowLeft":"xzaCS4slLpI-","overflowRight":"Jf227kC8Nu0-"};
|
|
206
|
-
|
|
194
|
+
styleInject(css_248z$b);
|
|
207
195
|
|
|
208
196
|
function DataListOverflowFade({ children }) {
|
|
209
|
-
const [leftRef, isLeftVisible] = useInView
|
|
210
|
-
const [rightRef, isRightVisible] = useInView
|
|
211
|
-
return (
|
|
197
|
+
const [leftRef, isLeftVisible] = useInView();
|
|
198
|
+
const [rightRef, isRightVisible] = useInView();
|
|
199
|
+
return (React.createElement("div", { "data-testid": CONTAINER_TEST_ID, className: classnames(styles$b.fadeContainer, {
|
|
212
200
|
[styles$b.overflowLeft]: !isLeftVisible,
|
|
213
201
|
[styles$b.overflowRight]: !isRightVisible,
|
|
214
202
|
}) },
|
|
215
|
-
|
|
216
|
-
|
|
203
|
+
React.createElement("div", { className: styles$b.overflowGrid },
|
|
204
|
+
React.createElement("span", { ref: leftRef, className: styles$b.overflowTrigger }),
|
|
217
205
|
children,
|
|
218
|
-
|
|
206
|
+
React.createElement("span", { ref: rightRef, className: styles$b.overflowTrigger }))));
|
|
219
207
|
}
|
|
220
208
|
|
|
221
209
|
var css_248z$a = ".WRV-UmQmPzo- {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n z-index: 0;\n z-index: var(--elevation-default);\n overflow: hidden;\n gap: calc(16px / 2);\n gap: var(--space-small);\n white-space: nowrap;\n}\n\n.liQeWCMenD0- {\n --overflow-bg: var(--data-list-item-active-color, var(--color-surface));\n\n display: -ms-flexbox;\n\n display: flex;\n position: absolute;\n top: 0;\n right: 0;\n height: 100%;\n padding-left: calc(16px * 1);\n padding-left: var(--space-base);\n background-image: linear-gradient(\n 90deg,\n transparent 0,\n rgba(255, 255, 255, 1) calc(16px * 1),\n rgba(255, 255, 255, 1) 100%\n );\n background-image: linear-gradient(\n 90deg,\n transparent 0,\n var(--overflow-bg) var(--space-base),\n var(--overflow-bg) 100%\n );\n -ms-flex-align: center;\n align-items: center;\n transition: all 200ms;\n transition: all var(--timing-base);\n}\n";
|
|
222
210
|
var styles$a = {"tags":"WRV-UmQmPzo-","tagCount":"liQeWCMenD0-"};
|
|
223
|
-
|
|
211
|
+
styleInject(css_248z$a);
|
|
224
212
|
|
|
225
213
|
function DataListTags({ items }) {
|
|
226
|
-
const ref =
|
|
227
|
-
const [visibleIndex, setVisibleIndex] =
|
|
214
|
+
const ref = useRef(null);
|
|
215
|
+
const [visibleIndex, setVisibleIndex] = useState([]);
|
|
228
216
|
const visibleItems = visibleIndex.filter(Boolean).length;
|
|
229
|
-
|
|
217
|
+
useEffect(() => {
|
|
230
218
|
var _a;
|
|
231
219
|
if (!window.IntersectionObserver)
|
|
232
220
|
return;
|
|
@@ -240,11 +228,11 @@ function DataListTags({ items }) {
|
|
|
240
228
|
elements === null || elements === void 0 ? void 0 : elements.forEach(element => observer.unobserve(element));
|
|
241
229
|
};
|
|
242
230
|
}, [items]);
|
|
243
|
-
return (
|
|
244
|
-
items.filter(Boolean).map((tag, index) => (
|
|
245
|
-
|
|
246
|
-
Boolean(visibleItems) && (
|
|
247
|
-
|
|
231
|
+
return (React.createElement("div", { className: styles$a.tags, ref: ref },
|
|
232
|
+
items.filter(Boolean).map((tag, index) => (React.createElement("div", { key: tag, "data-tag-element": index },
|
|
233
|
+
React.createElement(InlineLabel, null, tag)))),
|
|
234
|
+
Boolean(visibleItems) && (React.createElement("div", { className: styles$a.tagCount },
|
|
235
|
+
React.createElement(Text, null,
|
|
248
236
|
"+",
|
|
249
237
|
visibleItems)))));
|
|
250
238
|
function handleIntersection(...[entries]) {
|
|
@@ -274,18 +262,18 @@ function buildIntersectionThreshold(items) {
|
|
|
274
262
|
|
|
275
263
|
var css_248z$9 = ".fLmJZJJqMcE- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n padding: 0;\n border: none;\n background-color: transparent;\n}\n\n.UG8cHUT3Hds- {\n cursor: pointer;\n}\n";
|
|
276
264
|
var styles$9 = {"headerLabel":"fLmJZJJqMcE-","sortable":"UG8cHUT3Hds-"};
|
|
277
|
-
|
|
265
|
+
styleInject(css_248z$9);
|
|
278
266
|
|
|
279
267
|
var css_248z$8 = ".AN5egORYy-0- {\n padding-right: calc(16px / 2);\n padding-right: var(--space-small);\n}\n\n.AN5egORYy-0- path {\n fill: rgba(101, 120, 132, 1);\n fill: var(--color-greyBlue);\n transition: all 200ms ease;\n transition: all var(--timing-base) ease;\n}\n\n.AN5egORYy-0- path.F1uTDCK0Sb0- {\n fill: rgb(1, 41, 57);\n fill: var(--color-blue);\n}\n\n.AN5egORYy-0- path._6KYeQXWXLQ8- {\n fill: rgb(193, 201, 206);\n fill: var(--color-greyBlue--lighter);\n}\n";
|
|
280
268
|
var styles$8 = {"sortIcon":"AN5egORYy-0-","active":"F1uTDCK0Sb0-","inactive":"_6KYeQXWXLQ8-"};
|
|
281
|
-
|
|
269
|
+
styleInject(css_248z$8);
|
|
282
270
|
|
|
283
271
|
const SORTING_ICON_TEST_ID = "ATL-DataList-Sorting-Icon";
|
|
284
272
|
function DataListSortingArrows({ order }) {
|
|
285
|
-
return (
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
273
|
+
return (React.createElement("div", { className: styles$8.sortIcon, "data-testid": SORTING_ICON_TEST_ID },
|
|
274
|
+
React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
275
|
+
React.createElement("path", { className: getActiveClassName("asc"), d: "M16.2929 10.6661C15.9024 11.0566 15.2692 11.0566 14.8787 10.6661L12.2891 8.14263L9.70711 10.6661C9.31658 11.0566 8.68342 11.0566 8.29289 10.6661C7.90237 10.2756 7.90237 9.64239 8.29289 9.25186L11.5858 5.95897C11.9763 5.56845 12.6095 5.56845 13 5.95897L16.2929 9.25186C16.6834 9.64239 16.6834 10.2756 16.2929 10.6661Z" }),
|
|
276
|
+
React.createElement("path", { className: getActiveClassName("desc"), d: "M8.29292 13.3339C8.68345 12.9434 9.31661 12.9434 9.70714 13.3339L12.2968 15.8573L14.8787 13.3339C15.2692 12.9434 15.9024 12.9434 16.2929 13.3339C16.6834 13.7244 16.6834 14.3576 16.2929 14.7481L13 18.041C12.6095 18.4315 11.9763 18.4315 11.5858 18.041L8.29292 14.7481C7.9024 14.3576 7.9024 13.7244 8.29292 13.3339Z" }))));
|
|
289
277
|
function getActiveClassName(targetOrder) {
|
|
290
278
|
return order === targetOrder ? styles$8.active : styles$8.inactive;
|
|
291
279
|
}
|
|
@@ -296,11 +284,11 @@ function DataListHeaderTile({ headers, headerKey, }) {
|
|
|
296
284
|
const isSortable = sorting === null || sorting === void 0 ? void 0 : sorting.sortable.includes(headerKey);
|
|
297
285
|
const sortingState = sorting === null || sorting === void 0 ? void 0 : sorting.state;
|
|
298
286
|
const Tag = isSortable ? "button" : "div";
|
|
299
|
-
return (
|
|
287
|
+
return (React.createElement(Tag, { className: classnames(styles$9.headerLabel, {
|
|
300
288
|
[styles$9.sortable]: isSortable,
|
|
301
289
|
}), onClick: handleOnClick },
|
|
302
|
-
|
|
303
|
-
(sortingState === null || sortingState === void 0 ? void 0 : sortingState.key) === headerKey && (
|
|
290
|
+
React.createElement(Text, { maxLines: "single" }, headers[headerKey]),
|
|
291
|
+
(sortingState === null || sortingState === void 0 ? void 0 : sortingState.key) === headerKey && (React.createElement(DataListSortingArrows, { order: sortingState.order }))));
|
|
304
292
|
function toggleSorting(sortingKey) {
|
|
305
293
|
if ((sortingState === null || sortingState === void 0 ? void 0 : sortingState.order) === "desc") {
|
|
306
294
|
sorting === null || sorting === void 0 ? void 0 : sorting.onSort(undefined);
|
|
@@ -322,17 +310,17 @@ function DataListHeaderTile({ headers, headerKey, }) {
|
|
|
322
310
|
* Return the child component that matches the `type` provided
|
|
323
311
|
*/
|
|
324
312
|
function getCompoundComponent(children, type) {
|
|
325
|
-
const childrenArray =
|
|
326
|
-
const element = childrenArray.find(child =>
|
|
313
|
+
const childrenArray = Children.toArray(children);
|
|
314
|
+
const element = childrenArray.find(child => isValidElement(child) && child.type === type);
|
|
327
315
|
// Comply with the return type without casting it
|
|
328
|
-
return
|
|
316
|
+
return isValidElement(element) ? element : undefined;
|
|
329
317
|
}
|
|
330
318
|
/**
|
|
331
319
|
* Return all instances child component that matches the `type` provided
|
|
332
320
|
*/
|
|
333
321
|
function getCompoundComponents(children, type) {
|
|
334
|
-
const childrenArray =
|
|
335
|
-
const elements = childrenArray.filter((child) =>
|
|
322
|
+
const childrenArray = Children.toArray(children);
|
|
323
|
+
const elements = childrenArray.filter((child) => isValidElement(child) && child.type === type);
|
|
336
324
|
return elements;
|
|
337
325
|
}
|
|
338
326
|
/**
|
|
@@ -345,20 +333,20 @@ function generateListItemElement(item) {
|
|
|
345
333
|
return acc;
|
|
346
334
|
}
|
|
347
335
|
if (key === "tags" && Array.isArray(currentItem)) {
|
|
348
|
-
acc[key] =
|
|
336
|
+
acc[key] = React.createElement(DataListTags, { items: currentItem });
|
|
349
337
|
}
|
|
350
338
|
else if (key === "label" && typeof currentItem === "string") {
|
|
351
|
-
acc[key] =
|
|
339
|
+
acc[key] = React.createElement(Heading, { level: 5 }, currentItem);
|
|
352
340
|
}
|
|
353
|
-
else if (
|
|
341
|
+
else if (isValidElement(currentItem)) {
|
|
354
342
|
acc[key] = currentItem;
|
|
355
343
|
}
|
|
356
344
|
else if (currentItem instanceof Date) {
|
|
357
|
-
acc[key] = (
|
|
358
|
-
|
|
345
|
+
acc[key] = (React.createElement(Text, { variation: "subdued" },
|
|
346
|
+
React.createElement(FormatDate, { date: currentItem })));
|
|
359
347
|
}
|
|
360
348
|
else {
|
|
361
|
-
acc[key] =
|
|
349
|
+
acc[key] = React.createElement(Text, { variation: "subdued" }, currentItem);
|
|
362
350
|
}
|
|
363
351
|
return acc;
|
|
364
352
|
}, {});
|
|
@@ -367,8 +355,8 @@ function generateListItemElement(item) {
|
|
|
367
355
|
* Generate the header elements with the default styling
|
|
368
356
|
*/
|
|
369
357
|
function generateHeaderElements(headers) {
|
|
370
|
-
const headerElements = Object.keys(headers).reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]:
|
|
371
|
-
return
|
|
358
|
+
const headerElements = Object.keys(headers).reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: React.createElement(DataListHeaderTile, { headers: headers, headerKey: key }) })), {});
|
|
359
|
+
return isEmpty(headerElements) ? undefined : headerElements;
|
|
372
360
|
}
|
|
373
361
|
function sortBreakpoints(sizeProp) {
|
|
374
362
|
return sizeProp.sort((a, b) => BREAKPOINTS.indexOf(a) - BREAKPOINTS.indexOf(b));
|
|
@@ -388,27 +376,27 @@ function getExposedActions(childrenArray, childCount = 2) {
|
|
|
388
376
|
}, []);
|
|
389
377
|
}
|
|
390
378
|
|
|
391
|
-
const DataListLayoutActionsContext =
|
|
379
|
+
const DataListLayoutActionsContext = createContext({ activeItem: undefined });
|
|
392
380
|
function useDataListLayoutActionsContext() {
|
|
393
|
-
return
|
|
381
|
+
return useContext(DataListLayoutActionsContext);
|
|
394
382
|
}
|
|
395
383
|
|
|
396
384
|
var css_248z$7 = ".aokwZU8jbWU- {\n position: fixed;\n top: 0;\n top: var(--actions-menu-y, 0);\n left: 0;\n left: var(--actions-menu-x, 0);\n z-index: 6;\n z-index: var(--elevation-menu);\n min-width: 150px;\n box-shadow: 0px calc(16px / 16) calc(16px / 4) 0px\n rgba(0, 0, 0, 0.1),\n 0px calc(16px / 4) 12px 0px rgba(0, 0, 0, 0.05);\n box-shadow: var(--shadow-base);\n padding: calc(16px / 4);\n padding: var(--space-smaller);\n border: calc(16px / 16) solid rgb(225, 225, 225);\n border: var(--border-base) solid var(--color-border);\n border-radius: calc(16px / 2);\n border-radius: var(--radius-larger);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.XtVRP97TVSE- {\n position: fixed;\n top: 0;\n left: 0;\n z-index: calc(6 - 1);\n z-index: calc(var(--elevation-menu) - 1);\n width: 100%;\n height: 100%;\n padding: 0;\n border: none;\n background-color: transparent;\n}\n";
|
|
397
385
|
var styles$7 = {"menu":"aokwZU8jbWU-","overlay":"XtVRP97TVSE-"};
|
|
398
|
-
|
|
386
|
+
styleInject(css_248z$7);
|
|
399
387
|
|
|
400
388
|
const variants$1 = {
|
|
401
389
|
hidden: { opacity: 0, y: -10 },
|
|
402
390
|
visible: { opacity: 1, y: 0 },
|
|
403
391
|
};
|
|
404
392
|
function DataListActionsMenu({ visible = false, position, onRequestClose, children, }) {
|
|
405
|
-
const [ref, setRef] =
|
|
406
|
-
useRefocusOnActivator
|
|
407
|
-
const focusTrapRef = useFocusTrap
|
|
408
|
-
useOnKeyDown
|
|
409
|
-
return
|
|
410
|
-
|
|
411
|
-
|
|
393
|
+
const [ref, setRef] = useState();
|
|
394
|
+
useRefocusOnActivator(visible);
|
|
395
|
+
const focusTrapRef = useFocusTrap(visible);
|
|
396
|
+
useOnKeyDown(onRequestClose, "Escape");
|
|
397
|
+
return createPortal(React.createElement(AnimatePresence, null, visible && (React.createElement("div", { ref: focusTrapRef, onClick: handleClick },
|
|
398
|
+
React.createElement(motion.div, { role: "menu", ref: setRef, variants: variants$1, initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: TRANSITION_DELAY_IN_SECONDS }, className: styles$7.menu, style: getPositionCssVars(), onClick: onRequestClose }, children),
|
|
399
|
+
React.createElement("button", { className: styles$7.overlay, onClick: onRequestClose, "aria-label": "Close menu" })))), document.body);
|
|
412
400
|
function handleClick(event) {
|
|
413
401
|
// Prevent menu from firing the parent's onClick event when it is nested
|
|
414
402
|
// within a clickable list item
|
|
@@ -427,7 +415,7 @@ function DataListActionsMenu({ visible = false, position, onRequestClose, childr
|
|
|
427
415
|
const { x, y } = position;
|
|
428
416
|
const xIsOffScreen = x + width > window.innerWidth;
|
|
429
417
|
const yIsOffScreen = y + height > window.innerHeight;
|
|
430
|
-
const xOffSet = x + width - window.innerWidth +
|
|
418
|
+
const xOffSet = x + width - window.innerWidth + tokens["space-base"];
|
|
431
419
|
const yOffSet = y + height - window.innerHeight;
|
|
432
420
|
const newPosX = Math.floor(xIsOffScreen ? x - xOffSet : x);
|
|
433
421
|
const newPosY = Math.floor(yIsOffScreen ? y - yOffSet : y);
|
|
@@ -436,14 +424,14 @@ function DataListActionsMenu({ visible = false, position, onRequestClose, childr
|
|
|
436
424
|
}
|
|
437
425
|
|
|
438
426
|
function DataListItemActionsOverflow({ actions, }) {
|
|
439
|
-
const [menuPosition, setMenuPosition] =
|
|
440
|
-
const [showMenu, setShowMenu] =
|
|
427
|
+
const [menuPosition, setMenuPosition] = useState({ x: 0, y: 0 });
|
|
428
|
+
const [showMenu, setShowMenu] = useState(false);
|
|
441
429
|
if (actions.length === 0)
|
|
442
430
|
return null;
|
|
443
|
-
return (
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
431
|
+
return (React.createElement(React.Fragment, null,
|
|
432
|
+
React.createElement(Tooltip, { message: "More actions" },
|
|
433
|
+
React.createElement(Button, { icon: "more", ariaLabel: "More actions", type: "secondary", variation: "subtle", onClick: handleMoreClick })),
|
|
434
|
+
React.createElement(DataListActionsMenu, { visible: showMenu, position: menuPosition, onRequestClose: handleClose }, actions)));
|
|
447
435
|
function handleMoreClick(event) {
|
|
448
436
|
// Prevent firing the parent's onClick event when it is nested
|
|
449
437
|
// within a clickable list item
|
|
@@ -461,15 +449,15 @@ function DataListItemActionsOverflow({ actions, }) {
|
|
|
461
449
|
|
|
462
450
|
function DataListActions({ children, itemsToExpose = 2, }) {
|
|
463
451
|
const { activeItem } = useDataListLayoutActionsContext();
|
|
464
|
-
const childrenArray =
|
|
452
|
+
const childrenArray = Children.toArray(children).filter(isValidElement);
|
|
465
453
|
const exposedActions = getExposedActions(childrenArray, itemsToExpose);
|
|
466
454
|
childrenArray.splice(0, exposedActions.length);
|
|
467
|
-
return (
|
|
455
|
+
return (React.createElement(DataListOverflowFade, null,
|
|
468
456
|
exposedActions.map(({ props }) => {
|
|
469
457
|
if (!props.icon)
|
|
470
458
|
return null;
|
|
471
|
-
return (
|
|
472
|
-
|
|
459
|
+
return (React.createElement(Tooltip, { key: props.label, message: props.label },
|
|
460
|
+
React.createElement(Button, { icon: props.icon, ariaLabel: props.label, onClick: () => {
|
|
473
461
|
var _a, _b;
|
|
474
462
|
if (activeItem) {
|
|
475
463
|
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
|
|
@@ -479,7 +467,7 @@ function DataListActions({ children, itemsToExpose = 2, }) {
|
|
|
479
467
|
}
|
|
480
468
|
}, type: "secondary", variation: "subtle" })));
|
|
481
469
|
}),
|
|
482
|
-
|
|
470
|
+
React.createElement(DataListItemActionsOverflow, { actions: childrenArray })));
|
|
483
471
|
}
|
|
484
472
|
|
|
485
473
|
// This component is meant to capture the props of the DataList.ItemActions
|
|
@@ -499,11 +487,11 @@ function InternalDataListItemActions() {
|
|
|
499
487
|
const { children } = itemActionComponent.props;
|
|
500
488
|
if (!children)
|
|
501
489
|
return null;
|
|
502
|
-
return (
|
|
490
|
+
return (React.createElement(motion.div, { variants: variants, initial: "hidden", animate: "visible", exit: "hidden", transition: {
|
|
503
491
|
duration: TRANSITION_DURATION_IN_SECONDS,
|
|
504
492
|
delay: TRANSITION_DELAY_IN_SECONDS,
|
|
505
493
|
}, className: styles$c.menu, onContextMenu: handleContextMenu },
|
|
506
|
-
|
|
494
|
+
React.createElement(DataListActions, null, children)));
|
|
507
495
|
}
|
|
508
496
|
function handleContextMenu(event) {
|
|
509
497
|
event.stopPropagation();
|
|
@@ -512,11 +500,11 @@ function handleContextMenu(event) {
|
|
|
512
500
|
function DataListItemInternal({ children, item, }) {
|
|
513
501
|
const { selected, onSelect } = useDataListContext();
|
|
514
502
|
if (selected !== undefined && onSelect) {
|
|
515
|
-
return (
|
|
503
|
+
return (React.createElement("div", { className: classnames(styles$f.selectable, {
|
|
516
504
|
[styles$f.selected]: selected === null || selected === void 0 ? void 0 : selected.length,
|
|
517
505
|
}) },
|
|
518
506
|
children,
|
|
519
|
-
|
|
507
|
+
React.createElement(Checkbox, { checked: selected === null || selected === void 0 ? void 0 : selected.includes(item.id), onChange: handleChange })));
|
|
520
508
|
}
|
|
521
509
|
return children;
|
|
522
510
|
function handleChange() {
|
|
@@ -532,27 +520,27 @@ function DataListItemInternal({ children, item, }) {
|
|
|
532
520
|
function DataListItemClickableInternal({ onClick, url, to, children, }) {
|
|
533
521
|
const { activeItem } = useDataListLayoutActionsContext();
|
|
534
522
|
if (!activeItem)
|
|
535
|
-
return
|
|
523
|
+
return React.createElement(React.Fragment, null, children);
|
|
536
524
|
if (to) {
|
|
537
525
|
const computedTo = typeof to === "string" ? to : to(activeItem);
|
|
538
|
-
return (
|
|
526
|
+
return (React.createElement(Link, { className: styles$f.listItemClickable, to: computedTo, onClick: handleClick }, children));
|
|
539
527
|
}
|
|
540
528
|
if (url) {
|
|
541
529
|
const href = typeof url === "string" ? url : url(activeItem);
|
|
542
|
-
return (
|
|
530
|
+
return (React.createElement("a", { className: styles$f.listItemClickable, href: href, onClick: handleClick }, children));
|
|
543
531
|
}
|
|
544
532
|
if (onClick) {
|
|
545
533
|
return (
|
|
546
534
|
// A button can be nested within the list item. To prevent a button inside
|
|
547
535
|
// button error, we need to manually declare a div to be a button
|
|
548
|
-
|
|
536
|
+
React.createElement("div", { role: "button", tabIndex: 0, className: styles$f.listItemClickable, onClick: handleClick, onKeyDown: e => {
|
|
549
537
|
if (e.key === "Enter" || e.key === " ") {
|
|
550
538
|
e.preventDefault();
|
|
551
539
|
handleClick();
|
|
552
540
|
}
|
|
553
541
|
} }, children));
|
|
554
542
|
}
|
|
555
|
-
return
|
|
543
|
+
return React.createElement(React.Fragment, null, children);
|
|
556
544
|
function handleClick() {
|
|
557
545
|
activeItem && (onClick === null || onClick === void 0 ? void 0 : onClick(activeItem));
|
|
558
546
|
}
|
|
@@ -562,29 +550,29 @@ function DataListItemClickable({ children }) {
|
|
|
562
550
|
const { itemActionComponent } = useDataListContext();
|
|
563
551
|
if (itemActionComponent) {
|
|
564
552
|
const props = itemActionComponent.props;
|
|
565
|
-
return (
|
|
553
|
+
return (React.createElement(DataListItemClickableInternal, Object.assign({}, props), children));
|
|
566
554
|
}
|
|
567
|
-
return
|
|
555
|
+
return React.createElement(React.Fragment, null, children);
|
|
568
556
|
}
|
|
569
557
|
|
|
570
558
|
function DataListItem({ item, layout, }) {
|
|
571
559
|
const { itemActionComponent } = useDataListContext();
|
|
572
560
|
const { hasInLayoutActions } = useDataListLayoutContext();
|
|
573
|
-
const [showMenu, setShowMenu] =
|
|
574
|
-
const [contextPosition, setContextPosition] =
|
|
575
|
-
const generatedItem =
|
|
561
|
+
const [showMenu, setShowMenu] = useState(false);
|
|
562
|
+
const [contextPosition, setContextPosition] = useState();
|
|
563
|
+
const generatedItem = useMemo(() => generateListItemElement(item), [item]);
|
|
576
564
|
const contextMenuActions = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children;
|
|
577
565
|
const isContextMenuVisible = Boolean(contextPosition);
|
|
578
566
|
const shouldShowContextMenu = showMenu && isContextMenuVisible && Boolean(contextMenuActions);
|
|
579
|
-
return (
|
|
580
|
-
|
|
567
|
+
return (React.createElement(DataListLayoutActionsContext.Provider, { value: { activeItem: item } },
|
|
568
|
+
React.createElement("div", { onMouseEnter: handleShowMenu, onMouseLeave: handleHideMenu, onFocus: handleShowMenu, onBlur: handleHideMenu, onContextMenu: handleContextMenu, className: classnames(styles$f.listItem, {
|
|
581
569
|
[styles$f.active]: showMenu && isContextMenuVisible,
|
|
582
570
|
}), key: item.id },
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
showMenu && !hasInLayoutActions &&
|
|
587
|
-
|
|
571
|
+
React.createElement(DataListItemInternal, { item: item },
|
|
572
|
+
React.createElement(DataListItemClickable, null, layout(generatedItem))),
|
|
573
|
+
React.createElement(AnimatePresence, null,
|
|
574
|
+
showMenu && !hasInLayoutActions && React.createElement(InternalDataListItemActions, null),
|
|
575
|
+
React.createElement(DataListActionsMenu, { key: item.id, visible: shouldShowContextMenu, position: contextPosition || { x: 0, y: 0 }, onRequestClose: () => setContextPosition(undefined) }, contextMenuActions)))));
|
|
588
576
|
function handleShowMenu() {
|
|
589
577
|
setShowMenu(true);
|
|
590
578
|
}
|
|
@@ -604,38 +592,38 @@ function DataListItem({ item, layout, }) {
|
|
|
604
592
|
|
|
605
593
|
function DataListItems({ size = "xs", }) {
|
|
606
594
|
const { data, layouts } = useDataListContext();
|
|
607
|
-
const [hasInLayoutActions, setHasInLayoutActions] =
|
|
595
|
+
const [hasInLayoutActions, setHasInLayoutActions] = useState(false);
|
|
608
596
|
const layout = layouts[size];
|
|
609
597
|
if (!layout)
|
|
610
598
|
return null;
|
|
611
|
-
return (
|
|
599
|
+
return (React.createElement(DataListLayoutContext.Provider, { value: {
|
|
612
600
|
isInLayoutProvider: true,
|
|
613
601
|
hasInLayoutActions,
|
|
614
602
|
setHasInLayoutActions,
|
|
615
|
-
} }, data.map((child, i) => (
|
|
603
|
+
} }, data.map((child, i) => (React.createElement(DataListItem, { key: data[i].id, index: i, item: child, layout: layout })))));
|
|
616
604
|
}
|
|
617
605
|
|
|
618
606
|
function DataListLayout({ children, size = "xs", }) {
|
|
619
607
|
const { layoutBreakpoints, registerLayout, registerLayoutBreakpoints, loadingState, } = useDataListContext();
|
|
620
608
|
const breakpoints = useResponsiveSizing();
|
|
621
|
-
|
|
609
|
+
useEffect(() => {
|
|
622
610
|
registerLayoutBreakpoints(size);
|
|
623
611
|
}, [size]);
|
|
624
|
-
|
|
612
|
+
useEffect(() => {
|
|
625
613
|
registerLayout(size, children);
|
|
626
614
|
}, [size, children]);
|
|
627
615
|
const sizeIndex = layoutBreakpoints.indexOf(size);
|
|
628
616
|
const nextAvailableSize = layoutBreakpoints[sizeIndex + 1];
|
|
629
617
|
const shouldRenderList = breakpoints[size] && !breakpoints[nextAvailableSize];
|
|
630
618
|
if (loadingState !== "initial" && shouldRenderList) {
|
|
631
|
-
return
|
|
619
|
+
return React.createElement(DataListItems, { size: size });
|
|
632
620
|
}
|
|
633
621
|
return null;
|
|
634
622
|
}
|
|
635
623
|
|
|
636
624
|
var css_248z$6 = ".v-GrdlFpBLk- {\n /* Offset the button's padding so the height of the header bar doesn't change */\n margin: calc((16px / 2) * -1) 0;\n margin: calc(calc(16px / 2) * -1) 0;\n margin: calc(var(--space-small) * -1) 0;\n}\n";
|
|
637
625
|
var styles$6 = {"bulkActions":"v-GrdlFpBLk-"};
|
|
638
|
-
|
|
626
|
+
styleInject(css_248z$6);
|
|
639
627
|
|
|
640
628
|
// This component is meant to capture the props of the DataList.BulkActions
|
|
641
629
|
function DataListBulkActions(
|
|
@@ -651,8 +639,8 @@ function InternalDataListBulkActions() {
|
|
|
651
639
|
const { sm } = useResponsiveSizing();
|
|
652
640
|
// Collapse all actions under "More actions" when breakpoint is smaller than sm
|
|
653
641
|
const itemsToExpose = sm ? 3 : 0;
|
|
654
|
-
return (
|
|
655
|
-
|
|
642
|
+
return (React.createElement("div", { className: styles$6.bulkActions },
|
|
643
|
+
React.createElement(DataListActions, { itemsToExpose: itemsToExpose }, children)));
|
|
656
644
|
}
|
|
657
645
|
|
|
658
646
|
function DataListHeaderCheckbox({ children }) {
|
|
@@ -663,19 +651,19 @@ function DataListHeaderCheckbox({ children }) {
|
|
|
663
651
|
// Show "Deselect All" if breakpoint is sm or higher
|
|
664
652
|
const deselectText = sm ? "Deselect All" : "Deselect";
|
|
665
653
|
const selectedLabel = selected.length ? `${selected.length} selected` : "";
|
|
666
|
-
return (
|
|
667
|
-
|
|
654
|
+
return (React.createElement("div", { className: classnames(styles$f.selectable) },
|
|
655
|
+
React.createElement("div", { className: classnames(styles$f.selectAllCheckbox, {
|
|
668
656
|
[styles$f.visible]: Boolean(onSelectAll),
|
|
669
657
|
}) },
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
658
|
+
React.createElement(Checkbox, { checked: isAllSelected(), indeterminate: selected.length > 0 && !isAllSelected(), onChange: onSelectAll },
|
|
659
|
+
React.createElement("div", { className: styles$f.srOnly }, selectedLabel))),
|
|
660
|
+
React.createElement(AnimatedSwitcher, { switched: Boolean(selected.length), initialChild: children, switchTo: React.createElement("div", { className: styles$f.batchSelectContainer },
|
|
661
|
+
React.createElement("div", { className: styles$f.headerBatchSelect },
|
|
662
|
+
React.createElement(Text, null,
|
|
675
663
|
selected.length,
|
|
676
664
|
" selected"),
|
|
677
|
-
|
|
678
|
-
|
|
665
|
+
React.createElement(Button, { label: deselectText, onClick: () => onSelect === null || onSelect === void 0 ? void 0 : onSelect([]), type: "tertiary" })),
|
|
666
|
+
React.createElement(InternalDataListBulkActions, null)) })));
|
|
679
667
|
function isAllSelected() {
|
|
680
668
|
// If there's a totalCount, we can use that to accurately determine if the
|
|
681
669
|
// user have "selected all".
|
|
@@ -702,8 +690,8 @@ function DataListHeader() {
|
|
|
702
690
|
const headerData = generateHeaderElements(headers);
|
|
703
691
|
if (!headerData)
|
|
704
692
|
return null;
|
|
705
|
-
return (
|
|
706
|
-
|
|
693
|
+
return (React.createElement("div", { className: styles$f.headerTitles },
|
|
694
|
+
React.createElement(DataListHeaderCheckbox, null, layout(headerData))));
|
|
707
695
|
function getVisibleSize() {
|
|
708
696
|
const visibilityKeys = Object.keys(headerVisibility);
|
|
709
697
|
const headerBreakpoints = sortBreakpoints(visibilityKeys).reverse();
|
|
@@ -714,24 +702,24 @@ function DataListHeader() {
|
|
|
714
702
|
|
|
715
703
|
function DataListSort() {
|
|
716
704
|
const { sorting, headers } = useDataListContext();
|
|
717
|
-
const divRef =
|
|
718
|
-
const [showPopover, setShowPopover] =
|
|
705
|
+
const divRef = useRef(null);
|
|
706
|
+
const [showPopover, setShowPopover] = useState(false);
|
|
719
707
|
if (!sorting)
|
|
720
708
|
return null;
|
|
721
709
|
const { sortable, state, onSort } = sorting;
|
|
722
710
|
const sortByOptions = getSortByOptions();
|
|
723
711
|
const canChangeOrder = !(state === null || state === void 0 ? void 0 : state.key);
|
|
724
|
-
return (
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
712
|
+
return (React.createElement(React.Fragment, null,
|
|
713
|
+
React.createElement("span", { ref: divRef },
|
|
714
|
+
React.createElement(Button, Object.assign({}, (!state && { icon: "add", iconOnRight: true }), { label: getButtonLabel(), variation: "subtle", onClick: () => setShowPopover(!showPopover) }))),
|
|
715
|
+
React.createElement(Popover, { attachTo: divRef, open: showPopover, onRequestClose: () => setShowPopover(false) },
|
|
716
|
+
React.createElement(Content, null,
|
|
717
|
+
React.createElement(Heading, { level: 5 }, "Sort by"),
|
|
718
|
+
React.createElement(Chips, { selected: (state === null || state === void 0 ? void 0 : state.key) || "none", onChange: handleKeyChange }, sortByOptions.map(({ label, value }) => (React.createElement(Chip, { key: label, label: label, value: value })))),
|
|
719
|
+
React.createElement(Heading, { level: 5 }, "Ordered by"),
|
|
720
|
+
React.createElement(Chips, { selected: state === null || state === void 0 ? void 0 : state.order, onChange: handleSortingChange },
|
|
721
|
+
React.createElement(Chip, { label: "Ascending", value: "asc", disabled: canChangeOrder }),
|
|
722
|
+
React.createElement(Chip, { label: "Descending", value: "desc", disabled: canChangeOrder }))))));
|
|
735
723
|
function getSortByOptions() {
|
|
736
724
|
const options = sortable.reduce((acc, sort) => {
|
|
737
725
|
const label = headers[sort];
|
|
@@ -795,20 +783,20 @@ function InternalDataListFilters() {
|
|
|
795
783
|
if (!showSortButton && !component)
|
|
796
784
|
return null;
|
|
797
785
|
const children = component === null || component === void 0 ? void 0 : component.props.children;
|
|
798
|
-
return (
|
|
786
|
+
return (React.createElement(DataListOverflowFade, null,
|
|
799
787
|
children && children,
|
|
800
|
-
showSortButton &&
|
|
788
|
+
showSortButton && React.createElement(DataListSort, null)));
|
|
801
789
|
}
|
|
802
790
|
|
|
803
791
|
var css_248z$5 = ".PGOHzrMh374- {\n --offset: 1px;\n --sticky-header-transition-properties: var(--timing-base) ease-in-out;\n\n position: sticky;\n top: calc(1px * -1);\n top: calc(var(--offset) * -1);\n z-index: 1;\n z-index: var(--elevation-base);\n padding-top: 1px;\n padding-top: var(--offset);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n/**\n * Draw a border that gets covered by the column headers border when it shows up.\n *\n * Mostly to prevent us from writing some complex JS to remove the border when\n * the column headers show up.\n */\n\n.PGOHzrMh374-::before {\n content: \"\";\n display: block;\n position: absolute;\n bottom: 0;\n left: 50%;\n z-index: -1;\n width: 0;\n height: 0;\n background-color: rgb(225, 225, 225);\n background-color: var(--color-border);\n -webkit-transform: translateX(-50%);\n transform: translateX(-50%);\n transition: height var(--sticky-header-transition-properties)\n 100ms,\n width var(--sticky-header-transition-properties);\n transition: height var(--sticky-header-transition-properties)\n var(--timing-quick),\n width var(--sticky-header-transition-properties);\n}\n\n.PGjWc5ocjpI-::before {\n width: 100%;\n height: calc(16px / 8);\n height: var(--border-thick);\n transition: height var(--sticky-header-transition-properties),\n width var(--sticky-header-transition-properties) 100ms;\n transition: height var(--sticky-header-transition-properties),\n width var(--sticky-header-transition-properties) var(--timing-quick);\n}\n";
|
|
804
792
|
var styles$5 = {"header":"PGOHzrMh374-","stuck":"PGjWc5ocjpI-"};
|
|
805
|
-
|
|
793
|
+
styleInject(css_248z$5);
|
|
806
794
|
|
|
807
795
|
function DataListStickyHeader({ children }) {
|
|
808
|
-
const [isStuck, setIsStuck] =
|
|
809
|
-
const ref =
|
|
810
|
-
const handleObserver =
|
|
811
|
-
|
|
796
|
+
const [isStuck, setIsStuck] = useState(false);
|
|
797
|
+
const ref = useRef(null);
|
|
798
|
+
const handleObserver = useCallback(([e]) => setIsStuck(e.intersectionRatio < 1), [setIsStuck]);
|
|
799
|
+
useEffect(() => {
|
|
812
800
|
if (!window.IntersectionObserver)
|
|
813
801
|
return;
|
|
814
802
|
const observer = new IntersectionObserver(handleObserver, { threshold: 1 });
|
|
@@ -817,12 +805,12 @@ function DataListStickyHeader({ children }) {
|
|
|
817
805
|
ref.current && observer.unobserve(ref.current);
|
|
818
806
|
};
|
|
819
807
|
}, [handleObserver, ref.current]);
|
|
820
|
-
return (
|
|
808
|
+
return (React.createElement("div", { ref: ref, className: classnames(styles$5.header, { [styles$5.stuck]: isStuck }) }, children));
|
|
821
809
|
}
|
|
822
810
|
|
|
823
811
|
var css_248z$4 = ".SaPMOnvw-3c- {\n --transition-properties: var(--timing-base) ease-in-out;\n --button-offset: calc(var(--space-largest) - var(--space-smallest));\n\n position: absolute;\n /* Inputs are off by 1 when put beside a button */\n top: calc((16px / 2) + 1px);\n top: calc(calc(16px / 2) + 1px);\n top: calc(var(--space-small) + 1px);\n right: calc((16px * 3) - (16px / 8));\n right: calc(calc(16px * 3) - calc(16px / 8));\n right: var(--button-offset);\n visibility: hidden;\n width: 0;\n opacity: 0;\n transition: opacity 200ms ease-in-out,\n width 200ms ease-in-out, visibility 200ms ease-in-out;\n transition: opacity var(--transition-properties),\n width var(--transition-properties), visibility var(--transition-properties);\n}\n\n._3S1-91v2SYI- {\n visibility: visible;\n width: calc(100% - var(--button-offset));\n opacity: 1;\n}\n\n@media (min-width: 768px) {\n\n.SaPMOnvw-3c-,\n._3S1-91v2SYI- {\n position: static;\n visibility: visible;\n width: auto;\n opacity: 1;\n transition: none;\n}\n }\n\n@media (--medium-screens-and-up) {\n\n.SaPMOnvw-3c-,\n._3S1-91v2SYI- {\n position: static;\n visibility: visible;\n width: auto;\n opacity: 1;\n transition: none;\n}\n }\n\n._9GlBktsUALw- {\n display: block;\n}\n\n@media (min-width: 768px) {\n\n._9GlBktsUALw- {\n display: none;\n}\n }\n\n@media (--medium-screens-and-up) {\n\n._9GlBktsUALw- {\n display: none;\n}\n }\n\n/*\n * No Filters Styling\n *\n * When there are no filters, the search input is always visible.\n * ------------------------------------------------------------------------- */\n\n._3Pjrt42x454- .SaPMOnvw-3c- {\n position: static;\n visibility: visible;\n width: auto;\n opacity: 1;\n transition: none;\n}\n\n@media (min-width: 768px) {\n\n._3Pjrt42x454- .SaPMOnvw-3c- {\n max-width: 30%;\n}\n }\n\n@media (--medium-screens-and-up) {\n\n._3Pjrt42x454- .SaPMOnvw-3c- {\n max-width: 30%;\n}\n }\n\n._3Pjrt42x454- ._9GlBktsUALw- {\n display: none;\n}\n";
|
|
824
812
|
var styles$4 = {"searchInput":"SaPMOnvw-3c-","searchInputVisible":"_3S1-91v2SYI-","searchButton":"_9GlBktsUALw-","withNoFilters":"_3Pjrt42x454-"};
|
|
825
|
-
|
|
813
|
+
styleInject(css_248z$4);
|
|
826
814
|
|
|
827
815
|
const DATA_LIST_SEARCH_TEST_ID = "ATL-DataList-Search-input-wrapper";
|
|
828
816
|
// This component is meant to capture the props of the DataList.Search
|
|
@@ -834,26 +822,26 @@ function DataListSearch(_) {
|
|
|
834
822
|
* Renders the DataList.Search component.
|
|
835
823
|
*/
|
|
836
824
|
function InternalDataListSearch() {
|
|
837
|
-
const inputRef =
|
|
838
|
-
const [visible, setVisible] =
|
|
825
|
+
const inputRef = useRef(null);
|
|
826
|
+
const [visible, setVisible] = useState(false);
|
|
839
827
|
const { searchComponent, filterComponent, sorting, title } = useDataListContext();
|
|
840
|
-
const debouncedSearch =
|
|
828
|
+
const debouncedSearch = useCallback(debounce((value) => { var _a; return (_a = searchComponent === null || searchComponent === void 0 ? void 0 : searchComponent.props) === null || _a === void 0 ? void 0 : _a.onSearch(value); }, SEARCH_DEBOUNCE_DELAY), [searchComponent === null || searchComponent === void 0 ? void 0 : searchComponent.props.onSearch]);
|
|
841
829
|
if (!searchComponent)
|
|
842
830
|
return null;
|
|
843
831
|
const { placeholder, initialValue } = searchComponent.props;
|
|
844
|
-
return (
|
|
832
|
+
return (React.createElement("div", { className: classnames({
|
|
845
833
|
[styles$4.withNoFilters]: !filterComponent && !sorting,
|
|
846
834
|
}) },
|
|
847
|
-
|
|
835
|
+
React.createElement("div", { "data-testid": DATA_LIST_SEARCH_TEST_ID, className: classnames(styles$4.searchInput, {
|
|
848
836
|
[styles$4.searchInputVisible]: visible,
|
|
849
837
|
}) },
|
|
850
|
-
|
|
838
|
+
React.createElement(InputText
|
|
851
839
|
// If the initial value changes, reset the input.
|
|
852
840
|
, {
|
|
853
841
|
// If the initial value changes, reset the input.
|
|
854
842
|
key: initialValue, defaultValue: initialValue, ref: inputRef, placeholder: getPlaceholder(), onChange: debouncedSearch, prefix: { icon: "search" }, size: "small" })),
|
|
855
|
-
|
|
856
|
-
|
|
843
|
+
React.createElement("div", { className: styles$4.searchButton },
|
|
844
|
+
React.createElement(AnimatedSwitcher, { switched: visible, initialChild: React.createElement(Button, { variation: "subtle", icon: "search", ariaLabel: "Search", onClick: toggleSearch }), switchTo: React.createElement(Button, { variation: "subtle", icon: "remove", ariaLabel: "Close search bar", onClick: toggleSearch }) }))));
|
|
857
845
|
function getPlaceholder() {
|
|
858
846
|
if (placeholder)
|
|
859
847
|
return placeholder;
|
|
@@ -865,24 +853,24 @@ function InternalDataListSearch() {
|
|
|
865
853
|
const visibility = !visible;
|
|
866
854
|
setVisible(visibility);
|
|
867
855
|
if (visibility && inputRef.current) {
|
|
868
|
-
setTimeout(inputRef.current.focus,
|
|
856
|
+
setTimeout(inputRef.current.focus, tokens["timing-quick"]);
|
|
869
857
|
}
|
|
870
858
|
}
|
|
871
859
|
}
|
|
872
860
|
|
|
873
861
|
var css_248z$3 = ".zg3w9nQga-M- {\n display: -ms-flexbox;\n display: flex;\n box-sizing: border-box;\n padding: calc(16px * 1);\n padding: var(--space-base);\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-direction: column;\n flex-direction: column;\n row-gap: calc(16px * 1);\n row-gap: var(--space-base);\n -ms-flex-align: center;\n align-items: center;\n -ms-flex: 1;\n flex: 1;\n}\n";
|
|
874
862
|
var styles$3 = {"emptyStateWrapper":"zg3w9nQga-M-"};
|
|
875
|
-
|
|
863
|
+
styleInject(css_248z$3);
|
|
876
864
|
|
|
877
865
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
878
866
|
function DataListEmptyState(_) {
|
|
879
867
|
return null;
|
|
880
868
|
}
|
|
881
869
|
function InternalDataListEmptyState() {
|
|
882
|
-
const { emptyStateComponents: components, filtered } =
|
|
870
|
+
const { emptyStateComponents: components, filtered } = useContext(DataListContext);
|
|
883
871
|
const { message, action } = getMessages();
|
|
884
|
-
return (
|
|
885
|
-
|
|
872
|
+
return (React.createElement("div", { className: styles$3.emptyStateWrapper },
|
|
873
|
+
React.createElement(Text, { align: "center" }, message),
|
|
886
874
|
renderButton(action)));
|
|
887
875
|
function getMessages() {
|
|
888
876
|
const { defaultEmptyState, filteredEmptyState } = getEmptyStates(components);
|
|
@@ -900,8 +888,8 @@ function InternalDataListEmptyState() {
|
|
|
900
888
|
}
|
|
901
889
|
function renderButton(action) {
|
|
902
890
|
if (action) {
|
|
903
|
-
if (action.type === Button
|
|
904
|
-
return
|
|
891
|
+
if (action.type === Button) {
|
|
892
|
+
return cloneElement(action, {
|
|
905
893
|
variation: action.props.variation || "subtle",
|
|
906
894
|
});
|
|
907
895
|
}
|
|
@@ -917,40 +905,40 @@ function getEmptyStates(components) {
|
|
|
917
905
|
|
|
918
906
|
var css_248z$2 = ".IC-Y9bTIVFo- {\n position: relative;\n -webkit-transform: translateY(calc((16px * 3) * -1));\n -webkit-transform: translateY(calc(calc(16px * 3) * -1));\n -webkit-transform: translateY(calc(var(--space-largest) * -1));\n transform: translateY(calc((16px * 3) * -1));\n transform: translateY(calc(calc(16px * 3) * -1));\n transform: translateY(calc(var(--space-largest) * -1));\n}\n\n.PbZLGpbI6ZM-,\n._6zA6B-jmz6o- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-pack: center;\n justify-content: center;\n padding: calc(16px / 2);\n padding: var(--space-small);\n}\n\n._6zA6B-jmz6o- {\n opacity: 0;\n -webkit-animation: gZ4DUv82g5I- 200ms ease 200ms forwards;\n -webkit-animation: gZ4DUv82g5I- var(--timing-base) ease var(--timing-base) forwards;\n animation: gZ4DUv82g5I- 200ms ease 200ms forwards;\n animation: gZ4DUv82g5I- var(--timing-base) ease var(--timing-base) forwards;\n}\n\n@-webkit-keyframes gZ4DUv82g5I- {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n\n@keyframes gZ4DUv82g5I- {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n";
|
|
919
907
|
var styles$2 = {"trigger":"IC-Y9bTIVFo-","loadingMore":"PbZLGpbI6ZM-","backToTop":"_6zA6B-jmz6o-","fadeIn":"gZ4DUv82g5I-"};
|
|
920
|
-
|
|
908
|
+
styleInject(css_248z$2);
|
|
921
909
|
|
|
922
910
|
function DataListLoadMoreTrigger() {
|
|
923
911
|
const { onLoadMore } = useDataListContext();
|
|
924
|
-
const [inViewRef, isInView] = useInView
|
|
925
|
-
|
|
912
|
+
const [inViewRef, isInView] = useInView();
|
|
913
|
+
useEffect(() => {
|
|
926
914
|
isInView && (onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore());
|
|
927
915
|
}, [isInView]);
|
|
928
|
-
return (
|
|
916
|
+
return (React.createElement("div", { ref: inViewRef, className: styles$2.trigger, "data-testid": DATA_LOAD_MORE_TEST_ID }));
|
|
929
917
|
}
|
|
930
918
|
|
|
931
919
|
const MAX_DATA_COUNT = 50;
|
|
932
920
|
function DataListLoadMore({ onBackToTop }) {
|
|
933
921
|
const { loadingState, data } = useDataListContext();
|
|
934
922
|
const showBackToTop = data.length > MAX_DATA_COUNT && loadingState !== "loadingMore";
|
|
935
|
-
return (
|
|
936
|
-
|
|
937
|
-
loadingState === "loadingMore" && (
|
|
938
|
-
|
|
939
|
-
showBackToTop && (
|
|
940
|
-
|
|
923
|
+
return (React.createElement(React.Fragment, null,
|
|
924
|
+
React.createElement(DataListLoadMoreTrigger, { key: data.length }),
|
|
925
|
+
loadingState === "loadingMore" && (React.createElement("div", { "data-testid": DATA_LIST_LOADING_MORE_SPINNER_TEST_ID, className: styles$2.loadingMore },
|
|
926
|
+
React.createElement(Spinner, { size: "small" }))),
|
|
927
|
+
showBackToTop && (React.createElement("div", { className: styles$2.backToTop },
|
|
928
|
+
React.createElement(Button, { label: "Back to top", onClick: onBackToTop, size: "small", variation: "subtle" })))));
|
|
941
929
|
}
|
|
942
930
|
|
|
943
931
|
var css_248z$1 = ".iyg43v-S9yU- {\n display: -ms-flexbox;\n display: flex;\n width: 100%;\n min-height: 44px;\n padding: calc(16px / 2);\n padding: var(--space-small);\n border: none;\n border-radius: 0;\n font-size: calc((16px * 1) * 0.875);\n font-size: calc(calc(16px * 1) * 0.875);\n font-size: var(--typography--fontSize-base);\n text-align: left;\n background: none;\n cursor: pointer;\n transition: background 200ms ease;\n transition: background var(--timing-base) ease;\n -webkit-appearance: none;\n appearance: none;\n -ms-flex-align: center;\n align-items: center;\n gap: calc(16px / 2);\n gap: var(--space-small);\n}\n\n.iyg43v-S9yU-:hover,\n.iyg43v-S9yU-:focus {\n background-color: rgb(250, 246, 219);\n background-color: var(--color-surface--hover);\n}\n\n.AUJNqz93ZDA- {\n font-weight: 500;\n}\n";
|
|
944
932
|
var styles$1 = {"action":"iyg43v-S9yU-","label":"AUJNqz93ZDA-"};
|
|
945
|
-
|
|
933
|
+
styleInject(css_248z$1);
|
|
946
934
|
|
|
947
935
|
function DataListAction({ label, icon, destructive, onClick, }) {
|
|
948
936
|
const { activeItem } = useDataListLayoutActionsContext();
|
|
949
937
|
const color = destructive ? "critical" : "blue";
|
|
950
|
-
return (
|
|
951
|
-
icon &&
|
|
952
|
-
|
|
953
|
-
|
|
938
|
+
return (React.createElement("button", { className: styles$1.action, onClick: handleClick },
|
|
939
|
+
icon && React.createElement(Icon, { name: icon, color: color }),
|
|
940
|
+
React.createElement(Typography, { textColor: color },
|
|
941
|
+
React.createElement("span", { className: styles$1.label }, label))));
|
|
954
942
|
function handleClick() {
|
|
955
943
|
if (activeItem) {
|
|
956
944
|
onClick === null || onClick === void 0 ? void 0 : onClick(activeItem);
|
|
@@ -963,33 +951,33 @@ function DataListAction({ label, icon, destructive, onClick, }) {
|
|
|
963
951
|
|
|
964
952
|
var css_248z = "._0m75bgCVBhk- {\n visibility: hidden;\n}\n";
|
|
965
953
|
var styles = {"hidden":"_0m75bgCVBhk-"};
|
|
966
|
-
|
|
954
|
+
styleInject(css_248z);
|
|
967
955
|
|
|
968
956
|
function DataListLayoutActions() {
|
|
969
957
|
const { itemActionComponent, loadingState } = useDataListContext();
|
|
970
958
|
const { setHasInLayoutActions } = useDataListLayoutContext();
|
|
971
959
|
const { children: actionsChildren } = (itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props) || {};
|
|
972
|
-
const actions =
|
|
960
|
+
const actions = Children.toArray(actionsChildren);
|
|
973
961
|
const hasActions = actions.length > 0;
|
|
974
|
-
|
|
962
|
+
useEffect(() => {
|
|
975
963
|
setHasInLayoutActions(hasActions);
|
|
976
964
|
return () => {
|
|
977
965
|
setHasInLayoutActions(false);
|
|
978
966
|
};
|
|
979
967
|
}, []);
|
|
980
968
|
if (loadingState === "initial") {
|
|
981
|
-
return
|
|
969
|
+
return React.createElement(Glimmer, { shape: "square", size: "large" });
|
|
982
970
|
}
|
|
983
971
|
if (!hasActions)
|
|
984
972
|
return null;
|
|
985
|
-
return (
|
|
986
|
-
|
|
973
|
+
return (React.createElement(DataListLayoutActionsWrapper, null,
|
|
974
|
+
React.createElement(DataListItemActionsOverflow, { actions: actions })));
|
|
987
975
|
}
|
|
988
976
|
function DataListLayoutActionsWrapper({ children }) {
|
|
989
977
|
const { isInLayoutProvider } = useDataListLayoutContext();
|
|
990
978
|
if (isInLayoutProvider)
|
|
991
|
-
return
|
|
992
|
-
return
|
|
979
|
+
return React.createElement(React.Fragment, null, children);
|
|
980
|
+
return React.createElement("div", { className: styles.hidden }, children);
|
|
993
981
|
}
|
|
994
982
|
|
|
995
983
|
// This component is meant to capture the props of the DataList.Filters
|
|
@@ -1006,20 +994,20 @@ function InternalDataListStatusBar() {
|
|
|
1006
994
|
if (!component)
|
|
1007
995
|
return null;
|
|
1008
996
|
const children = component === null || component === void 0 ? void 0 : component.props.children;
|
|
1009
|
-
return
|
|
997
|
+
return React.createElement(React.Fragment, null, children);
|
|
1010
998
|
}
|
|
1011
999
|
|
|
1012
1000
|
function DataList(_a) {
|
|
1013
|
-
var { selected = [], sorting } = _a, props =
|
|
1014
|
-
const [layoutBreakpoints, setLayoutBreakpoints] =
|
|
1015
|
-
const [layouts, setLayouts] =
|
|
1001
|
+
var { selected = [], sorting } = _a, props = __rest(_a, ["selected", "sorting"]);
|
|
1002
|
+
const [layoutBreakpoints, setLayoutBreakpoints] = useState([]);
|
|
1003
|
+
const [layouts, setLayouts] = useState({});
|
|
1016
1004
|
const searchComponent = getCompoundComponent(props.children, DataListSearch);
|
|
1017
1005
|
const filterComponent = getCompoundComponent(props.children, DataListFilters);
|
|
1018
1006
|
const layoutComponents = getCompoundComponents(props.children, DataListLayout);
|
|
1019
1007
|
const emptyStateComponents = getCompoundComponents(props.children, DataListEmptyState);
|
|
1020
1008
|
const itemActionComponent = getCompoundComponent(props.children, DataListItemActions);
|
|
1021
1009
|
const bulkActionsComponent = getCompoundComponent(props.children, DataListBulkActions);
|
|
1022
|
-
return (
|
|
1010
|
+
return (React.createElement(DataListContext.Provider, { value: Object.assign(Object.assign({ searchComponent,
|
|
1023
1011
|
filterComponent,
|
|
1024
1012
|
layoutComponents,
|
|
1025
1013
|
emptyStateComponents,
|
|
@@ -1031,7 +1019,7 @@ function DataList(_a) {
|
|
|
1031
1019
|
registerLayout }, props), { selected,
|
|
1032
1020
|
// T !== DataListObject
|
|
1033
1021
|
sorting: sorting }) },
|
|
1034
|
-
|
|
1022
|
+
React.createElement(InternalDataList, null)));
|
|
1035
1023
|
function registerLayoutBreakpoints(size) {
|
|
1036
1024
|
setLayoutBreakpoints(prev => sortBreakpoints([...prev, size]));
|
|
1037
1025
|
}
|
|
@@ -1041,28 +1029,28 @@ function DataList(_a) {
|
|
|
1041
1029
|
}
|
|
1042
1030
|
function InternalDataList() {
|
|
1043
1031
|
const { data, title, totalCount, loadingState = "none", layoutComponents, } = useDataListContext();
|
|
1044
|
-
const backToTopRef =
|
|
1032
|
+
const backToTopRef = useRef(null);
|
|
1045
1033
|
const initialLoading = loadingState === "initial";
|
|
1046
1034
|
const showEmptyState = !initialLoading && data.length === 0;
|
|
1047
1035
|
const shouldRenderLoadMoreTrigger = !initialLoading && !showEmptyState;
|
|
1048
|
-
return (
|
|
1049
|
-
|
|
1050
|
-
title &&
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
initialLoading &&
|
|
1060
|
-
showEmptyState &&
|
|
1036
|
+
return (React.createElement("div", { className: styles$f.wrapper },
|
|
1037
|
+
React.createElement("div", { className: styles$f.titleContainer },
|
|
1038
|
+
title && React.createElement(Heading, { level: 3 }, title),
|
|
1039
|
+
React.createElement(DataListTotalCount, { totalCount: totalCount, loading: initialLoading })),
|
|
1040
|
+
React.createElement("div", { ref: backToTopRef }),
|
|
1041
|
+
React.createElement(DataListStickyHeader, null,
|
|
1042
|
+
React.createElement("div", { className: styles$f.headerFilters },
|
|
1043
|
+
React.createElement(InternalDataListFilters, null),
|
|
1044
|
+
React.createElement(InternalDataListSearch, null)),
|
|
1045
|
+
React.createElement(InternalDataListStatusBar, null),
|
|
1046
|
+
React.createElement(DataListHeader, null)),
|
|
1047
|
+
initialLoading && React.createElement(DataListLoadingState, null),
|
|
1048
|
+
showEmptyState && React.createElement(InternalDataListEmptyState, null),
|
|
1061
1049
|
layoutComponents,
|
|
1062
|
-
loadingState === "filtering" && (
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
shouldRenderLoadMoreTrigger && (
|
|
1050
|
+
loadingState === "filtering" && (React.createElement("div", { "data-testid": DATA_LIST_FILTERING_SPINNER_TEST_ID, className: styles$f.filtering },
|
|
1051
|
+
React.createElement("div", { className: styles$f.filteringSpinner },
|
|
1052
|
+
React.createElement(Spinner, { size: "small" })))),
|
|
1053
|
+
shouldRenderLoadMoreTrigger && (React.createElement(DataListLoadMore, { onBackToTop: handleBackToTop }))));
|
|
1066
1054
|
function handleBackToTop() {
|
|
1067
1055
|
var _a;
|
|
1068
1056
|
// For testing purposes since jest doesn't know scrollIntoView.
|
|
@@ -1119,11 +1107,11 @@ DataList.ItemAction = DataListAction;
|
|
|
1119
1107
|
* DataListBulkActions component.
|
|
1120
1108
|
*/
|
|
1121
1109
|
DataList.BatchAction = function DataListBatchAction(props) {
|
|
1122
|
-
return
|
|
1110
|
+
return React.createElement(DataListAction, Object.assign({}, props));
|
|
1123
1111
|
};
|
|
1124
1112
|
/**
|
|
1125
1113
|
* Defines a status bar that is rendered between the filters and the header.
|
|
1126
1114
|
*/
|
|
1127
1115
|
DataList.StatusBar = DataListStatusBar;
|
|
1128
1116
|
|
|
1129
|
-
|
|
1117
|
+
export { DataList };
|