@jobber/components 4.42.0 → 4.42.1-update-hov.11
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/Chip.d.ts +1 -0
- package/Chip.js +17 -0
- package/Combobox.d.ts +1 -0
- package/Combobox.js +17 -0
- package/Flex.d.ts +1 -0
- package/Flex.js +17 -0
- package/dist/Autocomplete/index.js +8 -8
- package/dist/Avatar/index.js +1 -1
- package/dist/{Avatar-1aa30ee1.js → Avatar-76a799fa.js} +1 -1
- package/dist/Banner/index.js +5 -5
- package/dist/Button/index.js +2 -2
- package/dist/Button-163a0641.js +57 -0
- package/dist/ButtonDismiss/index.js +3 -3
- package/dist/{ButtonDismiss-82680c7d.js → ButtonDismiss-2b98d075.js} +1 -1
- package/dist/Card/index.js +5 -5
- package/dist/{Card-cc2ffbaa.js → Card-3178033c.js} +4 -4
- package/dist/Checkbox/index.js +3 -3
- package/dist/{Checkbox-3bccf65c.js → Checkbox-ad7ec2e7.js} +2 -2
- package/dist/Chip/Chip.d.ts +8 -0
- package/dist/Chip/components/ChipDismissible/ChipDismissible.d.ts +3 -0
- package/dist/Chip/components/ChipPrefix/Chip.Prefix.d.ts +2 -0
- package/dist/Chip/components/ChipSelectable/ChipSelectable.d.ts +3 -0
- package/dist/Chip/components/ChipSuffix/Chip.Suffix.d.ts +6 -0
- package/dist/Chip/hooks/index.d.ts +1 -0
- package/dist/Chip/hooks/useChildComponent.d.ts +8 -0
- package/dist/Chip/index.d.ts +3 -0
- package/dist/Chip/index.js +40 -0
- package/dist/Chip-55e6da05.js +89 -0
- package/dist/Chips/index.js +505 -19
- package/dist/Combobox/Combobox.d.ts +11 -0
- package/dist/Combobox/Combobox.types.d.ts +189 -0
- package/dist/Combobox/ComboboxProvider.d.ts +20 -0
- package/dist/Combobox/components/ComboboxAction/ComboboxAction.d.ts +3 -0
- package/dist/Combobox/components/ComboboxAction/index.d.ts +1 -0
- package/dist/Combobox/components/ComboboxActivator/ComboboxActivator.d.ts +3 -0
- package/dist/Combobox/components/ComboboxActivator/index.d.ts +1 -0
- package/dist/Combobox/components/ComboboxContent/ComboboxContent.d.ts +3 -0
- package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/ComboboxContentHeader.d.ts +3 -0
- package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.d.ts +1 -0
- package/dist/Combobox/components/ComboboxContent/ComboboxContentList/ComboboxContentList.d.ts +3 -0
- package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.d.ts +1 -0
- package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/ComboboxContentSearch.d.ts +3 -0
- package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.d.ts +1 -0
- package/dist/Combobox/components/ComboboxContent/index.d.ts +1 -0
- package/dist/Combobox/components/ComboboxOption/ComboboxOption.d.ts +6 -0
- package/dist/Combobox/components/ComboboxOption/index.d.ts +1 -0
- package/dist/Combobox/components/ComboboxTrigger/ComboboxTrigger.d.ts +3 -0
- package/dist/Combobox/components/ComboboxTrigger/index.d.ts +1 -0
- package/dist/Combobox/hooks/useCombobox.d.ts +15 -0
- package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +13 -0
- package/dist/Combobox/hooks/useComboboxContent.d.ts +8 -0
- package/dist/Combobox/hooks/useComboboxValidation.d.ts +12 -0
- package/dist/Combobox/hooks/useMakeComboboxHandlers.d.ts +7 -0
- package/dist/Combobox/index.d.ts +3 -0
- package/dist/Combobox/index.js +31 -0
- package/dist/Combobox-0044641d.js +403 -0
- package/dist/ConfirmationModal/index.js +9 -9
- package/dist/{ConfirmationModal-6b61ebf5.js → ConfirmationModal-f7234e44.js} +2 -2
- package/dist/Content/Content.d.ts +1 -1
- package/dist/DataDump/index.js +6 -6
- package/dist/DataList/DataList.d.ts +8 -3
- package/dist/DataList/DataList.types.d.ts +71 -7
- package/dist/DataList/DataList.utils.d.ts +5 -4
- package/dist/DataList/components/DataListAction/DataListAction.d.ts +2 -3
- package/dist/DataList/components/DataListActions/DataListActions.d.ts +3 -0
- package/dist/DataList/components/DataListActions/index.d.ts +1 -0
- package/dist/DataList/components/DataListBulkActions/DataListBulkActions.const.d.ts +1 -0
- package/dist/DataList/components/DataListBulkActions/DataListBulkActions.d.ts +4 -0
- package/dist/DataList/components/DataListBulkActions/index.d.ts +1 -0
- package/dist/DataList/components/DataListHeader/DataListHeader.d.ts +2 -0
- package/dist/DataList/components/DataListHeader/index.d.ts +1 -0
- package/dist/DataList/components/DataListItem/DataListItem.d.ts +9 -0
- package/dist/DataList/components/{DataListLayoutInternal → DataListItem}/DataListItemInternal.d.ts +1 -1
- package/dist/DataList/components/DataListItem/components/DataListItemClickable/DataListItemClickable.d.ts +2 -0
- package/dist/DataList/components/DataListItem/components/DataListItemClickable/DataListItemClickableInternal.d.ts +3 -0
- package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.d.ts +1 -0
- package/dist/DataList/components/DataListItem/index.d.ts +1 -0
- package/dist/DataList/components/DataListItemActions/DataListItemActions.d.ts +4 -4
- package/dist/DataList/components/DataListItemActionsOverflow/DataListItemActionsOverflow.d.ts +7 -0
- package/dist/DataList/components/DataListItemActionsOverflow/index.d.ts +1 -0
- package/dist/DataList/components/DataListItems/DataListItems.d.ts +7 -0
- package/dist/DataList/components/DataListItems/index.d.ts +1 -0
- package/dist/DataList/components/DataListLayout/DataListLayout.d.ts +2 -2
- package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/DataListLayoutContext.d.ts +4 -0
- package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.d.ts +1 -0
- package/dist/DataList/components/DataListLoadingState/DataListLoadingState.d.ts +2 -9
- package/dist/DataList/components/DataListOverflowFade/DataListOverflowFade.d.ts +6 -0
- package/dist/DataList/components/DataListOverflowFade/index.d.ts +2 -0
- package/dist/DataList/components/DataListSearch/DataListSearch.d.ts +1 -1
- package/dist/DataList/components/DataListStatusBar/DataListStatusBar.d.ts +10 -0
- package/dist/DataList/components/DataListStatusBar/index.d.ts +1 -0
- package/dist/DataList/context/DataListContext/DataListContext.d.ts +3 -3
- package/dist/DataList/context/DataListLayoutContext/DataListLayoutContext.d.ts +4 -4
- package/dist/DataList/hooks/useActiveLayout.d.ts +4 -0
- package/dist/DataList/hooks/useGetItemActions.d.ts +6 -0
- package/dist/DataList/index.js +583 -417
- package/dist/DataTable/DataTable.d.ts +10 -10
- package/dist/DataTable/Pagination.d.ts +6 -5
- package/dist/DataTable/index.js +20 -14
- package/dist/DatePicker/index.js +3 -3
- package/dist/{DatePicker-b31baae4.js → DatePicker-c18f1739.js} +3 -3
- package/dist/DescriptionList/index.js +2 -2
- package/dist/Disclosure/index.js +2 -2
- package/dist/Drawer/index.js +5 -5
- package/dist/Emphasis/index.js +2 -2
- package/dist/{Emphasis-76a10790.js → Emphasis-b2d1b3aa.js} +1 -1
- package/dist/FeatureSwitch/index.js +7 -7
- package/dist/Flex/Flex.d.ts +32 -0
- package/dist/Flex/Flex.types.d.ts +6 -0
- package/dist/Flex/index.d.ts +1 -0
- package/dist/Flex/index.js +40 -0
- package/dist/FormField/index.js +5 -5
- package/dist/{FormField-d6138b7f.js → FormField-0b529c0b.js} +4 -4
- package/dist/FormatFile/index.js +11 -11
- package/dist/{FormatFile-aa1898f9.js → FormatFile-6bc7f045.js} +6 -6
- package/dist/Gallery/index.js +12 -12
- package/dist/Heading/index.js +2 -2
- package/dist/{Heading-a1191b15.js → Heading-0f4ecb0c.js} +1 -1
- package/dist/InlineLabel/index.js +2 -2
- package/dist/{InlineLabel-afd5fc6f.js → InlineLabel-9a517c19.js} +2 -2
- package/dist/InputAvatar/index.js +5 -5
- package/dist/InputDate/index.js +6 -6
- package/dist/InputEmail/index.js +5 -5
- package/dist/InputFile/index.js +3 -3
- package/dist/{InputFile-2a06c2c0.js → InputFile-8a21a5fb.js} +3 -3
- package/dist/InputNumber/index.js +6 -6
- package/dist/{InputNumber-07b03067.js → InputNumber-6a7cefc6.js} +1 -1
- package/dist/InputPassword/index.js +5 -5
- package/dist/InputPhoneNumber/index.js +5 -5
- package/dist/InputText/index.js +6 -6
- package/dist/{InputText-d1a52550.js → InputText-dcf6c428.js} +1 -1
- package/dist/InputTime/index.js +5 -5
- package/dist/InputValidation/index.js +3 -3
- package/dist/{InputValidation-b5a3d92c.js → InputValidation-179f0926.js} +2 -2
- package/dist/LightBox/index.js +4 -4
- package/dist/{LightBox-437a1c8b.js → LightBox-3f4dbc33.js} +2 -2
- package/dist/Link/Link.d.ts +1 -2
- package/dist/Link/index.d.ts +1 -1
- package/dist/List/index.js +7 -7
- package/dist/Markdown/index.js +5 -5
- package/dist/{Markdown-f6748dcb.js → Markdown-96070121.js} +3 -3
- package/dist/Menu/index.js +3 -3
- package/dist/{Menu-51f8712f.js → Menu-d7ea093c.js} +3 -3
- package/dist/Modal/index.js +5 -5
- package/dist/{Modal-a9ab9565.js → Modal-b9d194e4.js} +4 -4
- package/dist/MultiSelect/index.js +5 -5
- package/dist/{Option-b903e7ac.js → Option-752ce1e8.js} +1 -1
- package/dist/Page/index.js +7 -7
- package/dist/Popover/index.js +50 -9
- package/dist/ProgressBar/index.js +1 -1
- package/dist/{ProgressBar-5dfc1885.js → ProgressBar-250e7b24.js} +1 -1
- package/dist/RadioGroup/index.js +3 -3
- package/dist/{RadioGroup-8e76d20b.js → RadioGroup-ebaa4f87.js} +2 -2
- package/dist/RecurringSelect/index.js +11 -11
- package/dist/Select/index.js +6 -6
- package/dist/StatusLabel/index.js +2 -2
- package/dist/Switch/index.js +2 -2
- package/dist/{Switch-e75145cc.js → Switch-b85272bf.js} +2 -2
- package/dist/Tabs/Tabs.d.ts +12 -1
- package/dist/Tabs/index.js +8 -4
- package/dist/Text/index.js +2 -2
- package/dist/{Text-e7ed0974.js → Text-4a2bc89f.js} +1 -1
- package/dist/Toast/index.js +2 -2
- package/dist/Tooltip/index.js +1 -3
- package/dist/{Tooltip-bf67fe6e.js → Tooltip-6b12f1c2.js} +6 -8
- package/dist/Typography/index.js +1 -1
- package/dist/{Typography-fd6f932a.js → Typography-973b122e.js} +3 -3
- package/package.json +7 -7
- package/rollup.config.js +3 -5
- package/dist/Button-fd8413b2.js +0 -57
- package/dist/Chip-4916a642.js +0 -514
- package/dist/DataList/components/DataListItemActions/DataListItemActionsOverflow.d.ts +0 -7
- package/dist/DataList/components/DataListLayoutInternal/DataListHeader.d.ts +0 -11
- package/dist/DataList/components/DataListLayoutInternal/DataListItems.d.ts +0 -10
- package/dist/DataList/components/DataListLayoutInternal/DataListLayoutInternal.d.ts +0 -10
- package/dist/DataList/components/DataListLayoutInternal/index.d.ts +0 -3
- package/dist/DataList/hooks/useLayoutMediaQueries.d.ts +0 -1
- package/dist/Popover-bbfc6aa1.js +0 -53
- /package/dist/DataList/components/{DataListLayoutInternal → DataListHeader}/DataListHeaderCheckbox.d.ts +0 -0
- /package/dist/DataList/components/{DataListFilters/DataListFilter.const.d.ts → DataListOverflowFade/DataListOverflowFade.const.d.ts} +0 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var classnames = require('classnames');
|
|
5
|
+
var ReactDOM = require('react-dom');
|
|
6
|
+
var styleInject_es = require('./style-inject.es-9d2f5f4e.js');
|
|
7
|
+
var Icon = require('./Icon-405a216c.js');
|
|
8
|
+
var Text = require('./Text-4a2bc89f.js');
|
|
9
|
+
var Typography = require('./Typography-973b122e.js');
|
|
10
|
+
var Button = require('./Button-163a0641.js');
|
|
11
|
+
var useRefocusOnActivator = require('@jobber/hooks/useRefocusOnActivator');
|
|
12
|
+
var useFocusTrap = require('@jobber/hooks/useFocusTrap');
|
|
13
|
+
var reactPopper = require('react-popper');
|
|
14
|
+
var useOnKeyDown = require('@jobber/hooks/useOnKeyDown');
|
|
15
|
+
var Chip = require('./Chip-55e6da05.js');
|
|
16
|
+
require('@jobber/design');
|
|
17
|
+
var useAssert = require('@jobber/hooks/useAssert');
|
|
18
|
+
|
|
19
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
+
|
|
21
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
23
|
+
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
24
|
+
|
|
25
|
+
var css_248z$6 = ".m1w5vdUZ6rQ- {\n z-index: 1002;\n z-index: var(--elevation-tooltip);\n max-width: var(--popover--width);\n min-width: calc((16px * 4) * 3.75);\n min-width: calc(calc(16px * 4) * 3.75);\n min-width: calc(var(--space-extravagant) * 3.75);\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 margin-top: calc(16px / 2);\n margin-top: var(--space-small);\n border: calc(16px / 16) solid rgb(217, 223, 225);\n border: var(--border-base) solid var(--color-border);\n border-radius: calc(16px / 2);\n border-radius: var(--radius-larger);\n overflow: scroll;\n overflow-y: auto;\n background: rgba(255, 255, 255, 1);\n background: var(--color-surface);\n}\n\n/* CAUTION: Tests for content visibility assume this class' presence hides the content\n* so please be careful if you change this class name, or the css rules within.\n*/\n\n.m1w5vdUZ6rQ-.Zlkv2HA096A- {\n display: none;\n visibility: hidden;\n}\n\n.YQry-Rd6zfQ- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n position: sticky;\n gap: calc(16px / 4);\n gap: var(--space-smaller);\n bottom: 0;\n width: 100%;\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.TcpqL34s4lI- {\n padding-bottom: calc(16px / 2);\n padding-bottom: var(--space-small);\n}\n";
|
|
26
|
+
var styles$6 = {"content":"m1w5vdUZ6rQ-","hidden":"Zlkv2HA096A-","actions":"YQry-Rd6zfQ-","actionPadding":"TcpqL34s4lI-"};
|
|
27
|
+
styleInject_es.styleInject(css_248z$6);
|
|
28
|
+
|
|
29
|
+
var css_248z$5 = ".MIyb-oFZg9w- {\n position: relative;\n}\n\n.WZPK91I4aJs- {\n width: 100%;\n padding: calc(16px * 1);\n padding: var(--space-base);\n padding-right: calc((16px * 1.5) * 2.25);\n padding-right: calc(calc(16px * 1.5) * 2.25);\n padding-right: calc(var(--space-large) * 2.25);\n border: none;\n border-bottom: calc(16px / 16) solid rgb(217, 223, 225);\n border-bottom: var(--border-base) solid var(--color-border);\n font-family: \"Inter\", Helvetica, Arial, sans-serif;\n font-family: var(--typography--fontFamily-normal);\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}\n\n.WZPK91I4aJs-::-webkit-search-decoration,\n.WZPK91I4aJs-::-webkit-search-cancel-button,\n.WZPK91I4aJs-::-webkit-search-results-button,\n.WZPK91I4aJs-::-webkit-search-results-decoration {\n -webkit-appearance: none;\n}\n\n.WZPK91I4aJs-:focus {\n outline: none;\n}\n\n._7loHrVUe-Rk- {\n display: -ms-flexbox;\n display: flex;\n position: absolute;\n top: 50%;\n right: calc(16px * 1);\n right: var(--space-base);\n z-index: 1002;\n z-index: var(--elevation-tooltip);\n width: calc(16px * 1.5);\n width: var(--space-large);\n height: calc(16px * 1.5);\n height: var(--space-large);\n padding: 0;\n border: none;\n border-radius: 100%;\n border-radius: var(--radius-circle);\n background-color: rgb(238, 240, 242);\n background-color: var(--color-surface--background);\n cursor: pointer;\n -webkit-transform: translateY(-50%);\n transform: translateY(-50%);\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n._7loHrVUe-Rk-:focus {\n box-shadow: 0px 0px 0px calc(16px / 8) rgba(255, 255, 255, 1),\n 0px 0px 0px calc(16px / 4) rgb(147, 161, 169);\n box-shadow: var(--shadow-focus);\n}\n";
|
|
30
|
+
var styles$5 = {"search":"MIyb-oFZg9w-","searchInput":"WZPK91I4aJs-","clearSearch":"_7loHrVUe-Rk-"};
|
|
31
|
+
styleInject_es.styleInject(css_248z$5);
|
|
32
|
+
|
|
33
|
+
function ComboboxContentSearch(props) {
|
|
34
|
+
const searchRef = React.useRef(null);
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
if (props.open) {
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
var _a;
|
|
39
|
+
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
40
|
+
}, 0);
|
|
41
|
+
}
|
|
42
|
+
}, [props.open]);
|
|
43
|
+
return (React__default["default"].createElement("div", { className: styles$5.search },
|
|
44
|
+
React__default["default"].createElement("input", { type: "search", ref: searchRef, className: styles$5.searchInput, placeholder: props.placeholder ? `Search ${props.placeholder}` : "Search", onChange: (event) => handleSearch(event), value: props.searchValue }),
|
|
45
|
+
props.searchValue && (React__default["default"].createElement("button", { className: styles$5.clearSearch, onClick: clearSearch, type: "button", "data-testid": "ATL-Combobox-Content-Search-Clear", "aria-label": "Clear search" },
|
|
46
|
+
React__default["default"].createElement(Icon.Icon, { name: "remove", size: "small" })))));
|
|
47
|
+
function clearSearch() {
|
|
48
|
+
var _a;
|
|
49
|
+
props.setSearchValue("");
|
|
50
|
+
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
51
|
+
}
|
|
52
|
+
function handleSearch(event) {
|
|
53
|
+
props.setSearchValue(event.target.value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var css_248z$4 = ".SgMzjOcdE-E- {\n position: relative;\n padding: calc(16px / 2) 0;\n padding: var(--space-small) 0;\n}\n\n.TwoTCjgcssc- {\n display: -ms-flexbox;\n display: flex;\n max-height: calc((16px / 2) * 33.33);\n max-height: calc(calc(16px / 2) * 33.33);\n max-height: calc(var(--space-small) * 33.33);\n margin: 0;\n padding: 0;\n overflow: scroll;\n list-style: none;\n -ms-flex-direction: column;\n flex-direction: column;\n gap: calc(16px / 4);\n gap: var(--space-smaller);\n}\n\n._8T5M7MGwCRE-,\n._4y5NXkNeIQM- {\n padding: calc(16px / 2) calc(16px * 1);\n padding: var(--space-small) var(--space-base);\n}\n\n.SgMzjOcdE-E-::after {\n content: \"\";\n display: block;\n position: absolute;\n right: 0;\n bottom: calc(16px / 2);\n bottom: var(--space-small);\n left: 0;\n height: calc(16px * 1);\n height: var(--space-base);\n background: linear-gradient(\n 180deg,\n rgba(255, 255, 255, 0) 0%,\n rgb(255, 255, 255) 100%\n );\n pointer-events: none;\n}\n\n.SgMzjOcdE-E-::before {\n content: \"\";\n display: block;\n position: absolute;\n top: calc(16px / 2);\n top: var(--space-small);\n right: 0;\n left: 0;\n height: calc(16px * 1);\n height: var(--space-base);\n background: linear-gradient(\n to bottom,\n rgba(255, 255, 255, 1),\n rgba(255, 255, 255, 0)\n );\n pointer-events: none;\n}\n";
|
|
58
|
+
var styles$4 = {"container":"SgMzjOcdE-E-","optionsList":"TwoTCjgcssc-","filterMessage":"_8T5M7MGwCRE-","emptyStateMessage":"_4y5NXkNeIQM-"};
|
|
59
|
+
styleInject_es.styleInject(css_248z$4);
|
|
60
|
+
|
|
61
|
+
var css_248z$3 = "._5QdRGmaNHvc- {\n display: -ms-flexbox;\n display: flex;\n min-height: calc((calc(16px * 3) - calc(16px / 4)));\n min-height: calc((var(--space-largest) - var(--space-smaller)));\n box-sizing: border-box;\n margin: 0 calc(16px / 2);\n margin: 0 var(--space-small);\n padding: calc(16px / 2);\n padding: var(--space-small);\n border-radius: calc(16px / 4);\n border-radius: var(--radius-large);\n color: rgb(1, 41, 57);\n color: var(--color-heading);\n font-weight: 500;\n cursor: pointer;\n transition: all 200ms;\n transition: all var(--timing-base);\n -ms-flex-pack: justify;\n justify-content: space-between;\n -ms-flex-align: center;\n align-items: center;\n}\n\n._5QdRGmaNHvc-:hover,\n._5QdRGmaNHvc-:focus {\n background-color: rgb(238, 240, 242);\n background-color: var(--color-surface--background);\n}\n\n._5QdRGmaNHvc-:focus {\n box-shadow: 0px 0px 0px calc(16px / 8) rgba(255, 255, 255, 1),\n 0px 0px 0px calc(16px / 4) rgb(147, 161, 169);\n box-shadow: var(--shadow-focus);\n}\n";
|
|
62
|
+
var styles$3 = {"option":"_5QdRGmaNHvc-"};
|
|
63
|
+
styleInject_es.styleInject(css_248z$3);
|
|
64
|
+
|
|
65
|
+
const ComboboxContext = React__default["default"].createContext({});
|
|
66
|
+
function ComboboxContextProvider(props) {
|
|
67
|
+
return (React__default["default"].createElement(ComboboxContext.Provider, { value: {
|
|
68
|
+
open: props.open,
|
|
69
|
+
setOpen: props.setOpen,
|
|
70
|
+
selected: props.selected,
|
|
71
|
+
selectionHandler: props.selectionHandler,
|
|
72
|
+
handleClose: props.handleClose,
|
|
73
|
+
shouldScroll: props.shouldScroll,
|
|
74
|
+
} }, props.children));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function ComboboxOption(props) {
|
|
78
|
+
const { selected, selectionHandler } = React.useContext(ComboboxContext);
|
|
79
|
+
const isSelected = selected.some(selection => selection.id.toString() === props.id.toString());
|
|
80
|
+
return (React__default["default"].createElement("li", { key: props.id, tabIndex: -1, "data-selected": isSelected, role: "option", "aria-selected": isSelected, onClick: () => selectionHandler &&
|
|
81
|
+
selectionHandler({ id: props.id, label: props.label }), className: classnames__default["default"](styles$3.option) },
|
|
82
|
+
props.label,
|
|
83
|
+
isSelected && React__default["default"].createElement(Icon.Icon, { name: "checkmark", color: "blue" })));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function ComboboxContentList(props) {
|
|
87
|
+
return (React__default["default"].createElement("div", { className: styles$4.container },
|
|
88
|
+
!props.showEmptyState && props.options.length > 0 && (React__default["default"].createElement("ul", { className: styles$4.optionsList, role: "listbox", "aria-multiselectable": props.multiselect, ref: props.optionsListRef }, !props.showEmptyState &&
|
|
89
|
+
props.options.map(option => {
|
|
90
|
+
return (React__default["default"].createElement(ComboboxOption, { key: option.id, id: option.id, label: option.label }));
|
|
91
|
+
}))),
|
|
92
|
+
!props.showEmptyState && props.options.length === 0 && (React__default["default"].createElement("div", { className: styles$4.filterMessage },
|
|
93
|
+
React__default["default"].createElement(Text.Text, { variation: "subdued" },
|
|
94
|
+
"No results for ",
|
|
95
|
+
`“${props.searchValue}”`))),
|
|
96
|
+
props.showEmptyState && (React__default["default"].createElement("div", { className: styles$4.emptyStateMessage },
|
|
97
|
+
React__default["default"].createElement(Text.Text, { variation: "subdued" }, getZeroIndexStateText(props.subjectNoun))))));
|
|
98
|
+
}
|
|
99
|
+
function getZeroIndexStateText(subjectNoun) {
|
|
100
|
+
if (subjectNoun) {
|
|
101
|
+
return `You don't have any ${subjectNoun} yet`;
|
|
102
|
+
}
|
|
103
|
+
return "No options yet";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
var css_248z$2 = ".Q-mwo-g5Fi8- {\n display: -ms-flexbox;\n display: flex;\n padding: calc(16px * 1) calc(16px / 2) 0 calc(16px * 1);\n padding: var(--space-base) var(--space-small) 0 var(--space-base);\n -ms-flex-pack: justify;\n justify-content: space-between;\n gap: calc(16px / 4);\n gap: var(--space-smaller);\n}\n";
|
|
107
|
+
var styles$2 = {"header":"Q-mwo-g5Fi8-"};
|
|
108
|
+
styleInject_es.styleInject(css_248z$2);
|
|
109
|
+
|
|
110
|
+
function ComboboxContentHeader(props) {
|
|
111
|
+
const hasSelected = props.selectedCount > 0;
|
|
112
|
+
const actionLabel = hasSelected ? "Clear" : "Select all";
|
|
113
|
+
const label = getLabel(hasSelected, props.selectedCount, props.subjectNoun);
|
|
114
|
+
const handleSelectAll = hasSelected ? props.onClearAll : props.onSelectAll;
|
|
115
|
+
const showAction = hasSelected || props.hasOptionsVisible;
|
|
116
|
+
return (React__default["default"].createElement("div", { className: styles$2.header, "data-testid": "ATL-Combobox-Header" },
|
|
117
|
+
React__default["default"].createElement(Typography.Typography, { textColor: "heading", fontWeight: "semiBold" }, label),
|
|
118
|
+
showAction && (React__default["default"].createElement(Button.Button, { size: "small", label: actionLabel, type: "tertiary", onClick: handleSelectAll }))));
|
|
119
|
+
}
|
|
120
|
+
function getLabel(hasSelected, count, subjectNoun) {
|
|
121
|
+
if (hasSelected) {
|
|
122
|
+
return `${count} selected`;
|
|
123
|
+
}
|
|
124
|
+
if (subjectNoun) {
|
|
125
|
+
return `Select ${subjectNoun}`;
|
|
126
|
+
}
|
|
127
|
+
return "Select";
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function useComboboxContent(options, open, selected, searchValue) {
|
|
131
|
+
const { shouldScroll } = React.useContext(ComboboxContext);
|
|
132
|
+
const optionsListRef = React.useRef(null);
|
|
133
|
+
const filteredOptions = options.filter(option => option.label.toLowerCase().includes(searchValue.toLowerCase()));
|
|
134
|
+
React.useEffect(() => {
|
|
135
|
+
var _a;
|
|
136
|
+
if (open && shouldScroll.current && optionsListRef.current) {
|
|
137
|
+
const firstSelected = Array.from((_a = optionsListRef === null || optionsListRef === void 0 ? void 0 : optionsListRef.current) === null || _a === void 0 ? void 0 : _a.children).find(child => {
|
|
138
|
+
if (child instanceof HTMLElement) {
|
|
139
|
+
return child.dataset.selected === "true";
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
scrollToFirstSelected(firstSelected, shouldScroll);
|
|
143
|
+
}
|
|
144
|
+
}, [open, selected]);
|
|
145
|
+
return {
|
|
146
|
+
filteredOptions,
|
|
147
|
+
optionsListRef,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function scrollToFirstSelected(firstSelected, shouldScroll) {
|
|
151
|
+
if (firstSelected) {
|
|
152
|
+
firstSelected.scrollIntoView({
|
|
153
|
+
block: "nearest",
|
|
154
|
+
});
|
|
155
|
+
shouldScroll.current = false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// eslint-disable-next-line max-statements
|
|
160
|
+
function useComboboxAccessibility(selectionCallback, filteredOptions, optionsListRef, open, wrapperRef) {
|
|
161
|
+
const { handleClose } = React.useContext(ComboboxContext);
|
|
162
|
+
const hasOptionsVisible = open && filteredOptions.length > 0;
|
|
163
|
+
const focusedIndex = React.useRef(null);
|
|
164
|
+
useRefocusOnActivator.useRefocusOnActivator(open);
|
|
165
|
+
const popperRef = useFocusTrap.useFocusTrap(open);
|
|
166
|
+
const { styles: popperStyles, attributes, update, } = reactPopper.usePopper(wrapperRef.current, popperRef.current, {
|
|
167
|
+
modifiers: [
|
|
168
|
+
{
|
|
169
|
+
name: "flip",
|
|
170
|
+
options: {
|
|
171
|
+
fallbackPlacements: ["top-start"],
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
placement: "bottom-start",
|
|
176
|
+
});
|
|
177
|
+
React.useEffect(() => {
|
|
178
|
+
focusedIndex.current = null;
|
|
179
|
+
if (open) {
|
|
180
|
+
update === null || update === void 0 ? void 0 : update();
|
|
181
|
+
}
|
|
182
|
+
}, [open, filteredOptions.length]);
|
|
183
|
+
React.useEffect(() => {
|
|
184
|
+
var _a;
|
|
185
|
+
if (open) {
|
|
186
|
+
(_a = popperRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("keydown", handleContentKeydown);
|
|
187
|
+
}
|
|
188
|
+
return () => {
|
|
189
|
+
var _a;
|
|
190
|
+
(_a = popperRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("keydown", handleContentKeydown);
|
|
191
|
+
};
|
|
192
|
+
}, [open, optionsListRef, filteredOptions]);
|
|
193
|
+
useOnKeyDown.useOnKeyDown(() => {
|
|
194
|
+
if (open) {
|
|
195
|
+
handleClose();
|
|
196
|
+
}
|
|
197
|
+
}, "Escape");
|
|
198
|
+
function handleContentKeydown(event) {
|
|
199
|
+
var _a;
|
|
200
|
+
if (!hasOptionsVisible)
|
|
201
|
+
return;
|
|
202
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
203
|
+
const activeElementInList = (_a = optionsListRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement);
|
|
204
|
+
if (!activeElementInList)
|
|
205
|
+
return;
|
|
206
|
+
handleKeyboardSelection(event);
|
|
207
|
+
}
|
|
208
|
+
if (event.key === "ArrowDown") {
|
|
209
|
+
handleKeyboardNavigation(event, 1);
|
|
210
|
+
}
|
|
211
|
+
if (event.key === "ArrowUp") {
|
|
212
|
+
handleKeyboardNavigation(event, -1);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function handleKeyboardNavigation(event, indexChange) {
|
|
216
|
+
var _a;
|
|
217
|
+
const newIndex = focusedIndex.current === null ? 0 : focusedIndex.current + indexChange;
|
|
218
|
+
if (newIndex < 0 || newIndex >= filteredOptions.length)
|
|
219
|
+
return;
|
|
220
|
+
const optionElement = (_a = optionsListRef.current) === null || _a === void 0 ? void 0 : _a.children[newIndex];
|
|
221
|
+
optionElement === null || optionElement === void 0 ? void 0 : optionElement.focus();
|
|
222
|
+
focusedIndex.current = newIndex;
|
|
223
|
+
event.preventDefault();
|
|
224
|
+
event.stopPropagation();
|
|
225
|
+
}
|
|
226
|
+
function handleKeyboardSelection(event) {
|
|
227
|
+
event.preventDefault();
|
|
228
|
+
event.stopPropagation();
|
|
229
|
+
if (focusedIndex.current !== null) {
|
|
230
|
+
selectionCallback(filteredOptions[focusedIndex.current]);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
popperRef,
|
|
235
|
+
popperStyles,
|
|
236
|
+
attributes,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function ComboboxContent(props) {
|
|
241
|
+
const optionsExist = props.options.length > 0;
|
|
242
|
+
const { filteredOptions, optionsListRef } = useComboboxContent(props.options, props.open, props.selected, props.searchValue);
|
|
243
|
+
const { popperRef, popperStyles, attributes } = useComboboxAccessibility(props.handleSelection, filteredOptions, optionsListRef, props.open, props.wrapperRef);
|
|
244
|
+
const template = (React__default["default"].createElement("div", Object.assign({ ref: popperRef, id: "ATL-Combobox-Content", "data-testid": "ATL-Combobox-Content", tabIndex: 0, className: classnames__default["default"](styles$6.content, { [styles$6.hidden]: !props.open }), style: popperStyles.popper }, attributes.popper),
|
|
245
|
+
React__default["default"].createElement(ComboboxContentSearch, { open: props.open, placeholder: props.subjectNoun, searchValue: props.searchValue, setSearchValue: props.setSearchValue }),
|
|
246
|
+
props.multiselect && optionsExist && (React__default["default"].createElement(ComboboxContentHeader, { hasOptionsVisible: filteredOptions.length > 0, subjectNoun: props.subjectNoun, selectedCount: props.selected.length, onClearAll: () => {
|
|
247
|
+
props.selectedStateSetter([]);
|
|
248
|
+
}, onSelectAll: () => {
|
|
249
|
+
props.selectedStateSetter(filteredOptions);
|
|
250
|
+
} })),
|
|
251
|
+
React__default["default"].createElement(ComboboxContentList, { multiselect: props.multiselect, showEmptyState: !optionsExist, options: filteredOptions, selected: props.selected, optionsListRef: optionsListRef, searchValue: props.searchValue, subjectNoun: props.subjectNoun }),
|
|
252
|
+
props.actionElements && (React__default["default"].createElement("div", { className: styles$6.actions, role: "group" }, props.actionElements.map((child, index, childrenArray) => (React__default["default"].createElement("div", { key: index, className: classnames__default["default"]({
|
|
253
|
+
[styles$6.actionPadding]: index === childrenArray.length - 1,
|
|
254
|
+
}) }, child)))))));
|
|
255
|
+
return ReactDOM__default["default"].createPortal(template, document.body);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
var css_248z$1 = ".Ow9wSNnGP-g- {\n width: 100%;\n box-sizing: border-box;\n padding: 0 calc(16px / 2);\n padding: 0 var(--space-small);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n}\n\n.ncp0nKHQ7d8- {\n position: relative;\n width: 100%;\n min-height: calc((calc(16px * 3) - calc(16px / 2)));\n min-height: calc((var(--space-largest) - var(--space-small)));\n padding: calc(16px / 2) 0;\n padding: var(--space-small) 0;\n border: none;\n border-radius: calc(16px / 4);\n border-radius: var(--radius-large);\n text-align: left;\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--color-surface);\n cursor: pointer;\n transition: all 200ms;\n transition: all var(--timing-base);\n}\n\n.ncp0nKHQ7d8-:focus {\n box-shadow: 0px 0px 0px calc(16px / 8) rgba(255, 255, 255, 1),\n 0px 0px 0px calc(16px / 4) rgb(147, 161, 169);\n box-shadow: var(--shadow-focus);\n background-color: rgb(238, 240, 242);\n background-color: var(--color-surface--background);\n}\n\n.ncp0nKHQ7d8-:hover {\n background-color: rgb(238, 240, 242);\n background-color: var(--color-surface--background);\n}\n\n.ncp0nKHQ7d8- span {\n margin-left: calc(16px / 2);\n margin-left: var(--space-small);\n}\n";
|
|
259
|
+
var styles$1 = {"actionContainer":"Ow9wSNnGP-g-","actionButton":"ncp0nKHQ7d8-"};
|
|
260
|
+
styleInject_es.styleInject(css_248z$1);
|
|
261
|
+
|
|
262
|
+
function ComboboxAction(props) {
|
|
263
|
+
return (React__default["default"].createElement("div", { className: styles$1.actionContainer },
|
|
264
|
+
React__default["default"].createElement("button", { className: styles$1.actionButton, onClick: props.onClick, type: "button", "aria-label": props.label },
|
|
265
|
+
React__default["default"].createElement(Typography.Typography, { element: "span", size: "base", textColor: "green", fontWeight: "semiBold" }, props.label))));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function ComboboxTrigger({ label = "Select", selected, }) {
|
|
269
|
+
const { handleClose, open, setOpen } = React__default["default"].useContext(ComboboxContext);
|
|
270
|
+
const hasSelection = selected.length;
|
|
271
|
+
const selectedLabel = selected.map(option => option.label).join(", ");
|
|
272
|
+
return (React__default["default"].createElement(Chip.Chip, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", heading: label, onClick: () => {
|
|
273
|
+
if (open) {
|
|
274
|
+
handleClose();
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
setOpen(true);
|
|
278
|
+
}
|
|
279
|
+
}, role: "combobox" }, !hasSelection && (React__default["default"].createElement(Chip.Chip.Suffix, null,
|
|
280
|
+
React__default["default"].createElement(Icon.Icon, { name: "add", size: "small" })))));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
var css_248z = ".W8qMZnORYxI- {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 6;\n z-index: var(--elevation-menu);\n background-color: transparent;\n}\n\n._-0dkolvLF-Y- {\n display: inline-block;\n}\n";
|
|
284
|
+
var styles = {"overlay":"W8qMZnORYxI-","wrapper":"_-0dkolvLF-Y-"};
|
|
285
|
+
styleInject_es.styleInject(css_248z);
|
|
286
|
+
|
|
287
|
+
function useMakeComboboxHandlers(setOpen, setSearchValue, selectedOptions, shouldScroll, selectedStateSetter, multiSelect, onClose) {
|
|
288
|
+
const handleClose = React.useCallback(() => {
|
|
289
|
+
setOpen(false);
|
|
290
|
+
setSearchValue("");
|
|
291
|
+
onClose && onClose();
|
|
292
|
+
if (selectedOptions.length > 0) {
|
|
293
|
+
shouldScroll.current = true;
|
|
294
|
+
}
|
|
295
|
+
}, [setOpen, setSearchValue, onClose, selectedOptions.length]);
|
|
296
|
+
const handleSelection = React.useCallback((selection) => {
|
|
297
|
+
if (multiSelect) {
|
|
298
|
+
handleMultiSelect(selectedStateSetter, selectedOptions, selection);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
handleSingleSelect(selectedStateSetter, selection);
|
|
302
|
+
}
|
|
303
|
+
}, [multiSelect, selectedStateSetter, selectedOptions]);
|
|
304
|
+
const handleSingleSelect = React.useCallback((selectCallback, selection) => {
|
|
305
|
+
selectCallback([selection]);
|
|
306
|
+
handleClose();
|
|
307
|
+
}, []);
|
|
308
|
+
return {
|
|
309
|
+
handleClose,
|
|
310
|
+
handleSelection,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function handleMultiSelect(selectCallback, selected, selection) {
|
|
314
|
+
if (selected.some(s => s.id === selection.id)) {
|
|
315
|
+
selectCallback(selected.filter(s => s.id !== selection.id));
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
selectCallback([...selected, selection]);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function useCombobox(selected, onSelect, onClose, multiSelect) {
|
|
323
|
+
const wrapperRef = React.useRef(null);
|
|
324
|
+
const shouldScroll = React.useRef(false);
|
|
325
|
+
const [open, setOpen] = React.useState(false);
|
|
326
|
+
const [searchValue, setSearchValue] = React.useState("");
|
|
327
|
+
const { handleClose, handleSelection } = useMakeComboboxHandlers(setOpen, setSearchValue, selected, shouldScroll, onSelect, multiSelect, onClose);
|
|
328
|
+
return {
|
|
329
|
+
wrapperRef,
|
|
330
|
+
searchValue,
|
|
331
|
+
setSearchValue,
|
|
332
|
+
open,
|
|
333
|
+
setOpen,
|
|
334
|
+
selectedOptions: selected,
|
|
335
|
+
selectedStateSetter: onSelect,
|
|
336
|
+
shouldScroll,
|
|
337
|
+
handleClose,
|
|
338
|
+
handleSelection,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function ComboboxActivator(props) {
|
|
343
|
+
const { handleClose, open, setOpen } = React__default["default"].useContext(ComboboxContext);
|
|
344
|
+
if (props.children.type === Button.Button || props.children.type === Chip.Chip) {
|
|
345
|
+
return React__default["default"].cloneElement(props.children, {
|
|
346
|
+
role: "combobox",
|
|
347
|
+
onClick: () => {
|
|
348
|
+
if (open) {
|
|
349
|
+
handleClose();
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
setOpen(true);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
return props.children;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const COMBOBOX_TRIGGER_COUNT_ERROR_MESSAGE = "Combobox must have exactly one Trigger element";
|
|
361
|
+
function useComboboxValidation(children) {
|
|
362
|
+
const optionElements = getCompoundComponents(ComboboxOption, children);
|
|
363
|
+
const actionElements = getCompoundComponents(ComboboxAction, children);
|
|
364
|
+
const activatorElements = getCompoundComponents(ComboboxActivator, children);
|
|
365
|
+
const shouldThrowTriggerError = isInvalid(activatorElements);
|
|
366
|
+
useAssert.useAssert(shouldThrowTriggerError, COMBOBOX_TRIGGER_COUNT_ERROR_MESSAGE);
|
|
367
|
+
return {
|
|
368
|
+
optionElements,
|
|
369
|
+
triggerElement: activatorElements[0],
|
|
370
|
+
actionElements,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function isInvalid(activators) {
|
|
374
|
+
return activators.length > 1 ? true : false;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Return all instances child component that matches the `type` provided
|
|
378
|
+
*/
|
|
379
|
+
function getCompoundComponents(type, children) {
|
|
380
|
+
const childrenArray = React.Children.toArray(children);
|
|
381
|
+
const elements = childrenArray.filter((child) => React.isValidElement(child) && child.type === type);
|
|
382
|
+
return elements;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function Combobox(props) {
|
|
386
|
+
const { optionElements, triggerElement, actionElements } = useComboboxValidation(props.children);
|
|
387
|
+
const options = React.useMemo(() => (optionElements === null || optionElements === void 0 ? void 0 : optionElements.map(option => ({
|
|
388
|
+
id: option.props.id,
|
|
389
|
+
label: option.props.label,
|
|
390
|
+
}))) || [], [optionElements]);
|
|
391
|
+
const { selectedOptions, selectedStateSetter, shouldScroll, wrapperRef, searchValue, setSearchValue, open, setOpen, handleClose, handleSelection, } = useCombobox(props.selected, props.onSelect, props.onClose, props.multiSelect);
|
|
392
|
+
return (React__default["default"].createElement(ComboboxContextProvider, { selected: selectedOptions, selectionHandler: handleSelection, open: open, setOpen: setOpen, handleClose: handleClose, shouldScroll: shouldScroll },
|
|
393
|
+
React__default["default"].createElement("div", { ref: wrapperRef, className: styles.wrapper },
|
|
394
|
+
open && (React__default["default"].createElement("div", { className: styles.overlay, onClick: () => handleClose(), "data-testid": "ATL-Combobox-Overlay" })),
|
|
395
|
+
triggerElement || (React__default["default"].createElement(ComboboxTrigger, { label: props.label, selected: props.selected })),
|
|
396
|
+
React__default["default"].createElement(ComboboxContent, { multiselect: props.multiSelect, searchPlaceholder: props.searchPlaceholder, subjectNoun: props.subjectNoun, selected: selectedOptions, actionElements: actionElements, selectedStateSetter: selectedStateSetter, handleSelection: handleSelection, searchValue: searchValue, setSearchValue: setSearchValue, wrapperRef: wrapperRef, open: open, setOpen: setOpen, options: options }))));
|
|
397
|
+
}
|
|
398
|
+
Combobox.Activator = ComboboxActivator;
|
|
399
|
+
Combobox.Action = ComboboxAction;
|
|
400
|
+
Combobox.Option = ComboboxOption;
|
|
401
|
+
|
|
402
|
+
exports.Combobox = Combobox;
|
|
403
|
+
exports.ComboboxContextProvider = ComboboxContextProvider;
|
|
@@ -2,28 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ConfirmationModal = require('../ConfirmationModal-
|
|
5
|
+
var ConfirmationModal = require('../ConfirmationModal-f7234e44.js');
|
|
6
6
|
require('react');
|
|
7
7
|
require('@jobber/hooks/useOnKeyDown');
|
|
8
|
-
require('../Modal-
|
|
8
|
+
require('../Modal-b9d194e4.js');
|
|
9
9
|
require('react-dom');
|
|
10
10
|
require('classnames');
|
|
11
11
|
require('framer-motion');
|
|
12
12
|
require('@jobber/hooks/useRefocusOnActivator');
|
|
13
13
|
require('@jobber/hooks/useFocusTrap');
|
|
14
14
|
require('../style-inject.es-9d2f5f4e.js');
|
|
15
|
-
require('../Heading-
|
|
16
|
-
require('../Typography-
|
|
17
|
-
require('../Button-
|
|
15
|
+
require('../Heading-0f4ecb0c.js');
|
|
16
|
+
require('../Typography-973b122e.js');
|
|
17
|
+
require('../Button-163a0641.js');
|
|
18
18
|
require('react-router-dom');
|
|
19
19
|
require('../Icon-405a216c.js');
|
|
20
20
|
require('@jobber/design');
|
|
21
|
-
require('../ButtonDismiss-
|
|
21
|
+
require('../ButtonDismiss-2b98d075.js');
|
|
22
22
|
require('../Content-2ca1ffe1.js');
|
|
23
|
-
require('../Markdown-
|
|
23
|
+
require('../Markdown-96070121.js');
|
|
24
24
|
require('react-markdown');
|
|
25
|
-
require('../Text-
|
|
26
|
-
require('../Emphasis-
|
|
25
|
+
require('../Text-4a2bc89f.js');
|
|
26
|
+
require('../Emphasis-b2d1b3aa.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var useOnKeyDown = require('@jobber/hooks/useOnKeyDown');
|
|
5
|
-
var Modal = require('./Modal-
|
|
5
|
+
var Modal = require('./Modal-b9d194e4.js');
|
|
6
6
|
var Content = require('./Content-2ca1ffe1.js');
|
|
7
|
-
var Markdown = require('./Markdown-
|
|
7
|
+
var Markdown = require('./Markdown-96070121.js');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
10
|
|
package/dist/DataDump/index.js
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var Card = require('../Card-
|
|
6
|
+
var Card = require('../Card-3178033c.js');
|
|
7
7
|
var Content = require('../Content-2ca1ffe1.js');
|
|
8
|
-
var Emphasis = require('../Emphasis-
|
|
8
|
+
var Emphasis = require('../Emphasis-b2d1b3aa.js');
|
|
9
9
|
require('classnames');
|
|
10
10
|
require('../style-inject.es-9d2f5f4e.js');
|
|
11
|
-
require('../Heading-
|
|
12
|
-
require('../Typography-
|
|
13
|
-
require('../Button-
|
|
11
|
+
require('../Heading-0f4ecb0c.js');
|
|
12
|
+
require('../Typography-973b122e.js');
|
|
13
|
+
require('../Button-163a0641.js');
|
|
14
14
|
require('react-router-dom');
|
|
15
15
|
require('../Icon-405a216c.js');
|
|
16
16
|
require('@jobber/design');
|
|
17
|
-
require('../Menu-
|
|
17
|
+
require('../Menu-d7ea093c.js');
|
|
18
18
|
require('uuid');
|
|
19
19
|
require('framer-motion');
|
|
20
20
|
require('@jobber/hooks/useOnKeyDown');
|
|
@@ -6,8 +6,10 @@ import { DataListEmptyState } from "./components/DataListEmptyState";
|
|
|
6
6
|
import { DataListItemActions } from "./components/DataListItemActions";
|
|
7
7
|
import { DataListAction } from "./components/DataListAction";
|
|
8
8
|
import { DataListLayoutActions } from "./components/DataListLayoutActions";
|
|
9
|
-
import { DataListObject, DataListProps } from "./DataList.types";
|
|
10
|
-
|
|
9
|
+
import { DataListBulkActionProps, DataListObject, DataListProps } from "./DataList.types";
|
|
10
|
+
import { DataListBulkActions } from "./components/DataListBulkActions";
|
|
11
|
+
import { DataListStatusBar } from "./components/DataListStatusBar";
|
|
12
|
+
export declare function DataList<T extends DataListObject>({ selected, sorting, ...props }: DataListProps<T>): JSX.Element;
|
|
11
13
|
export declare namespace DataList {
|
|
12
14
|
var Layout: typeof DataListLayout;
|
|
13
15
|
var LayoutActions: typeof DataListLayoutActions;
|
|
@@ -15,5 +17,8 @@ export declare namespace DataList {
|
|
|
15
17
|
var Filters: typeof DataListFilters;
|
|
16
18
|
var Search: typeof DataListSearch;
|
|
17
19
|
var ItemActions: typeof DataListItemActions;
|
|
18
|
-
var
|
|
20
|
+
var BulkActions: typeof DataListBulkActions;
|
|
21
|
+
var ItemAction: typeof DataListAction;
|
|
22
|
+
var BatchAction: (props: DataListBulkActionProps) => JSX.Element;
|
|
23
|
+
var StatusBar: typeof DataListStatusBar;
|
|
19
24
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { IconNames } from "@jobber/design";
|
|
3
|
+
import { XOR } from "ts-xor";
|
|
3
4
|
import { Breakpoints } from "./DataList.const";
|
|
4
5
|
import { ButtonProps } from "../Button";
|
|
5
6
|
export { Breakpoints } from "./DataList.const";
|
|
@@ -101,8 +102,9 @@ export interface DataListProps<T extends DataListObject> {
|
|
|
101
102
|
readonly selected?: T["id"][];
|
|
102
103
|
readonly onSelectAll?: () => void;
|
|
103
104
|
}
|
|
105
|
+
export type LayoutRenderer<T extends DataListObject> = (item: DataListItemType<T[]>) => JSX.Element;
|
|
104
106
|
export interface DataListLayoutProps<T extends DataListObject> {
|
|
105
|
-
readonly children:
|
|
107
|
+
readonly children: LayoutRenderer<T>;
|
|
106
108
|
/**
|
|
107
109
|
* The breakpoint at which the layout should be displayed. It will be rendered until a layout with a larger breakpoint is found.
|
|
108
110
|
* @default "xs"
|
|
@@ -115,7 +117,15 @@ export interface DataListSearchProps {
|
|
|
115
117
|
* prepended by "Search" or just falls back to "Search".
|
|
116
118
|
*/
|
|
117
119
|
readonly placeholder?: string;
|
|
118
|
-
|
|
120
|
+
/**
|
|
121
|
+
* The initial value of the search input.
|
|
122
|
+
*
|
|
123
|
+
* Updating this prop after the component has mounted will rerender the
|
|
124
|
+
* component with the new value. Only update the value of this when you
|
|
125
|
+
* absolutely have to.
|
|
126
|
+
*/
|
|
127
|
+
readonly initialValue?: string;
|
|
128
|
+
readonly onSearch: (value: string) => void;
|
|
119
129
|
}
|
|
120
130
|
export interface DataListFiltersProps {
|
|
121
131
|
readonly children: ReactElement | ReactElement[];
|
|
@@ -147,10 +157,16 @@ export interface DataListContextProps<T extends DataListObject> extends DataList
|
|
|
147
157
|
readonly emptyStateComponents?: ReactElement<DataListEmptyStateProps>[];
|
|
148
158
|
readonly layoutComponents?: ReactElement<DataListLayoutProps<T>>[];
|
|
149
159
|
readonly itemActionComponent?: ReactElement<DataListItemActionsProps<T>>;
|
|
160
|
+
readonly bulkActionsComponent?: ReactElement<DataListItemActionsProps<T>>;
|
|
161
|
+
readonly layoutBreakpoints: Breakpoints[];
|
|
162
|
+
readonly registerLayoutBreakpoints: (breakpoint: Breakpoints) => void;
|
|
163
|
+
readonly layouts: {
|
|
164
|
+
readonly [Breakpoint in Breakpoints]?: LayoutRenderer<T>;
|
|
165
|
+
};
|
|
166
|
+
readonly registerLayout: (size: Breakpoints, layout: LayoutRenderer<T>) => void;
|
|
150
167
|
}
|
|
151
|
-
export interface DataListLayoutContextProps
|
|
168
|
+
export interface DataListLayoutContextProps {
|
|
152
169
|
readonly isInLayoutProvider: boolean;
|
|
153
|
-
readonly activeItem?: T;
|
|
154
170
|
/**
|
|
155
171
|
* Determine if the consumer of the DataList manually added an action to the
|
|
156
172
|
* layout. This is used to determine if the DataList should render the
|
|
@@ -159,14 +175,43 @@ export interface DataListLayoutContextProps<T extends DataListObject> {
|
|
|
159
175
|
readonly hasInLayoutActions: boolean;
|
|
160
176
|
readonly setHasInLayoutActions: (state: boolean) => void;
|
|
161
177
|
}
|
|
178
|
+
export interface DataListLayoutActionsContextProps<T extends DataListObject> {
|
|
179
|
+
readonly activeItem?: T;
|
|
180
|
+
}
|
|
162
181
|
type Fragment<T> = T | T[];
|
|
163
|
-
|
|
182
|
+
interface BaseDataListItemActionsProps<T extends DataListObject> {
|
|
164
183
|
/**
|
|
165
184
|
* The actions to render for each item in the DataList. This only accepts the
|
|
166
185
|
* DataList.Action component.
|
|
167
186
|
*/
|
|
168
187
|
readonly children?: Fragment<ReactElement<DataListActionProps<T>>>;
|
|
188
|
+
/**
|
|
189
|
+
* Callback when an item is clicked.
|
|
190
|
+
*/
|
|
191
|
+
readonly onClick?: (item: T) => void;
|
|
192
|
+
}
|
|
193
|
+
export interface DataListBulkActionsProps {
|
|
194
|
+
/**
|
|
195
|
+
* The actions to render on the top of the DataList to make actions to multiple items.
|
|
196
|
+
* This only accepts the DataList.BatchAction component.
|
|
197
|
+
*/
|
|
198
|
+
readonly children?: Fragment<ReactElement<DataListBulkActionProps>>;
|
|
169
199
|
}
|
|
200
|
+
interface DataListItemActionsPropsWithURL<T extends DataListObject> extends BaseDataListItemActionsProps<T> {
|
|
201
|
+
/**
|
|
202
|
+
* If a normal page navigation is needed, use this prop to change the element
|
|
203
|
+
* to an `a` tag with an `href`.
|
|
204
|
+
*/
|
|
205
|
+
readonly url?: string | ((item: T) => string);
|
|
206
|
+
}
|
|
207
|
+
interface DataListItemActionsPropsWithTo<T extends DataListObject> extends BaseDataListItemActionsProps<T> {
|
|
208
|
+
/**
|
|
209
|
+
* If a React Navigation is needed, use this prop to use the `Link` component
|
|
210
|
+
* that comes with React Router.
|
|
211
|
+
*/
|
|
212
|
+
readonly to?: string | ((item: T) => string);
|
|
213
|
+
}
|
|
214
|
+
export type DataListItemActionsProps<T extends DataListObject> = XOR<DataListItemActionsPropsWithURL<T>, DataListItemActionsPropsWithTo<T>>;
|
|
170
215
|
export interface DataListActionProps<T extends DataListObject> {
|
|
171
216
|
/**
|
|
172
217
|
* The label of the action
|
|
@@ -180,11 +225,30 @@ export interface DataListActionProps<T extends DataListObject> {
|
|
|
180
225
|
* Adjust the styling of an action label and icon to be more destructive.
|
|
181
226
|
*/
|
|
182
227
|
readonly destructive?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Determine if the action is visible for a given item.
|
|
230
|
+
*/
|
|
231
|
+
readonly visible?: (item: T) => boolean;
|
|
183
232
|
/**
|
|
184
233
|
* The callback function when the action is clicked.
|
|
185
234
|
*/
|
|
186
235
|
readonly onClick?: (data: T) => void;
|
|
187
236
|
}
|
|
188
|
-
export interface
|
|
189
|
-
|
|
237
|
+
export interface DataListActionsProps<T extends DataListObject> {
|
|
238
|
+
/**
|
|
239
|
+
* The actions to render for each item in the DataList. This only accepts the
|
|
240
|
+
* DataList.Action component.
|
|
241
|
+
*/
|
|
242
|
+
readonly children?: Fragment<ReactElement<DataListActionProps<T>>>;
|
|
243
|
+
/**
|
|
244
|
+
* The number of items to expose before the "More" button is shown.
|
|
245
|
+
* @default 2
|
|
246
|
+
*/
|
|
247
|
+
readonly itemsToExpose?: number;
|
|
248
|
+
}
|
|
249
|
+
export interface DataListBulkActionProps extends Omit<DataListActionProps<DataListObject>, "visible"> {
|
|
250
|
+
/**
|
|
251
|
+
* The callback function when the action is clicked.
|
|
252
|
+
*/
|
|
253
|
+
readonly onClick?: () => void;
|
|
190
254
|
}
|