@jobber/components 4.59.0 → 4.59.1-st-spike-w.1
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/index.js +94 -105
- 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 +22 -780
- 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 -5
- package/dist/ButtonDismiss-1ccb84ec.js +0 -14
- 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/Combobox/index.js
CHANGED
|
@@ -1,46 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
require('../Avatar-1aa30ee1.js');
|
|
23
|
-
require('color');
|
|
24
|
-
require('../Tooltip-6b12f1c2.js');
|
|
25
|
-
require('framer-motion');
|
|
26
|
-
|
|
27
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
|
-
|
|
29
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
30
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
31
|
-
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
1
|
+
import React, { useRef, useEffect, useContext, useCallback, useState, Children, isValidElement, useMemo } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
|
+
import { s as styleInject } from '../style-inject.es-a0e1a0ba.js';
|
|
5
|
+
import { I as Icon } from '../Icon-22723fe6.js';
|
|
6
|
+
import { T as Text } from '../Text-703e2c21.js';
|
|
7
|
+
import { T as Typography } from '../Typography-09952a2f.js';
|
|
8
|
+
import { B as Button } from '../Button-319d8fa0.js';
|
|
9
|
+
import { useRefocusOnActivator } from '@jobber/hooks/useRefocusOnActivator';
|
|
10
|
+
import { useFocusTrap } from '@jobber/hooks/useFocusTrap';
|
|
11
|
+
import { usePopper } from 'react-popper';
|
|
12
|
+
import { useOnKeyDown } from '@jobber/hooks/useOnKeyDown';
|
|
13
|
+
import { C as Chip } from '../Chip-40f5214c.js';
|
|
14
|
+
import '@jobber/design';
|
|
15
|
+
import { useAssert } from '@jobber/hooks/useAssert';
|
|
16
|
+
import 'react-router-dom';
|
|
17
|
+
import '@jobber/hooks/useInView';
|
|
18
|
+
import '../Avatar-b2e862de.js';
|
|
19
|
+
import 'color';
|
|
20
|
+
import '../Tooltip-c80b9fb7.js';
|
|
21
|
+
import 'framer-motion';
|
|
32
22
|
|
|
33
23
|
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(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 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";
|
|
34
24
|
var styles$6 = {"content":"m1w5vdUZ6rQ-","hidden":"Zlkv2HA096A-","actions":"YQry-Rd6zfQ-","actionPadding":"TcpqL34s4lI-"};
|
|
35
|
-
|
|
25
|
+
styleInject(css_248z$6);
|
|
36
26
|
|
|
37
27
|
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(225, 225, 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(244, 244, 244);\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 calc(16px / 4) calc(16px / 8)\n rgb(231, 213, 87);\n box-shadow: var(--shadow-focus);\n}\n";
|
|
38
28
|
var styles$5 = {"search":"MIyb-oFZg9w-","searchInput":"WZPK91I4aJs-","clearSearch":"_7loHrVUe-Rk-"};
|
|
39
|
-
|
|
29
|
+
styleInject(css_248z$5);
|
|
40
30
|
|
|
41
31
|
function ComboboxContentSearch(props) {
|
|
42
|
-
const searchRef =
|
|
43
|
-
|
|
32
|
+
const searchRef = useRef(null);
|
|
33
|
+
useEffect(() => {
|
|
44
34
|
if (props.open) {
|
|
45
35
|
setTimeout(() => {
|
|
46
36
|
var _a;
|
|
@@ -48,10 +38,10 @@ function ComboboxContentSearch(props) {
|
|
|
48
38
|
}, 0);
|
|
49
39
|
}
|
|
50
40
|
}, [props.open]);
|
|
51
|
-
return (
|
|
52
|
-
|
|
53
|
-
props.searchValue && (
|
|
54
|
-
|
|
41
|
+
return (React.createElement("div", { className: styles$5.search },
|
|
42
|
+
React.createElement("input", { type: "search", ref: searchRef, className: styles$5.searchInput, placeholder: props.placeholder ? `Search ${props.placeholder}` : "Search", onChange: (event) => handleSearch(event), value: props.searchValue }),
|
|
43
|
+
props.searchValue && (React.createElement("button", { className: styles$5.clearSearch, onClick: clearSearch, type: "button", "data-testid": "ATL-Combobox-Content-Search-Clear", "aria-label": "Clear search" },
|
|
44
|
+
React.createElement(Icon, { name: "remove", size: "small" })))));
|
|
55
45
|
function clearSearch() {
|
|
56
46
|
var _a;
|
|
57
47
|
props.setSearchValue("");
|
|
@@ -64,15 +54,15 @@ function ComboboxContentSearch(props) {
|
|
|
64
54
|
|
|
65
55
|
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}\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}\n";
|
|
66
56
|
var styles$4 = {"container":"SgMzjOcdE-E-","optionsList":"TwoTCjgcssc-","filterMessage":"_8T5M7MGwCRE-","emptyStateMessage":"_4y5NXkNeIQM-"};
|
|
67
|
-
|
|
57
|
+
styleInject(css_248z$4);
|
|
68
58
|
|
|
69
59
|
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(244, 244, 244);\n background-color: var(--color-surface--background);\n}\n\n._5QdRGmaNHvc-:focus {\n box-shadow: 0px 0px calc(16px / 4) calc(16px / 8)\n rgb(231, 213, 87);\n box-shadow: var(--shadow-focus);\n}\n";
|
|
70
60
|
var styles$3 = {"option":"_5QdRGmaNHvc-"};
|
|
71
|
-
|
|
61
|
+
styleInject(css_248z$3);
|
|
72
62
|
|
|
73
|
-
const ComboboxContext =
|
|
63
|
+
const ComboboxContext = React.createContext({});
|
|
74
64
|
function ComboboxContextProvider(props) {
|
|
75
|
-
return (
|
|
65
|
+
return (React.createElement(ComboboxContext.Provider, { value: {
|
|
76
66
|
open: props.open,
|
|
77
67
|
setOpen: props.setOpen,
|
|
78
68
|
selected: props.selected,
|
|
@@ -83,26 +73,26 @@ function ComboboxContextProvider(props) {
|
|
|
83
73
|
}
|
|
84
74
|
|
|
85
75
|
function ComboboxOption(props) {
|
|
86
|
-
const { selected, selectionHandler } =
|
|
76
|
+
const { selected, selectionHandler } = useContext(ComboboxContext);
|
|
87
77
|
const isSelected = selected.some(selection => selection.id.toString() === props.id.toString());
|
|
88
|
-
return (
|
|
89
|
-
selectionHandler({ id: props.id, label: props.label }), className:
|
|
78
|
+
return (React.createElement("li", { key: props.id, tabIndex: -1, "data-selected": isSelected, role: "option", "aria-selected": isSelected, onClick: () => selectionHandler &&
|
|
79
|
+
selectionHandler({ id: props.id, label: props.label }), className: classnames(styles$3.option) },
|
|
90
80
|
props.label,
|
|
91
|
-
isSelected &&
|
|
81
|
+
isSelected && React.createElement(Icon, { name: "checkmark", color: "blue" })));
|
|
92
82
|
}
|
|
93
83
|
|
|
94
84
|
function ComboboxContentList(props) {
|
|
95
|
-
return (
|
|
96
|
-
!props.showEmptyState && props.options.length > 0 && (
|
|
85
|
+
return (React.createElement("div", { className: styles$4.container },
|
|
86
|
+
!props.showEmptyState && props.options.length > 0 && (React.createElement("ul", { className: styles$4.optionsList, role: "listbox", "aria-multiselectable": props.multiselect, ref: props.optionsListRef }, !props.showEmptyState &&
|
|
97
87
|
props.options.map(option => {
|
|
98
|
-
return (
|
|
88
|
+
return (React.createElement(ComboboxOption, { key: option.id, id: option.id, label: option.label }));
|
|
99
89
|
}))),
|
|
100
|
-
!props.showEmptyState && props.options.length === 0 && (
|
|
101
|
-
|
|
90
|
+
!props.showEmptyState && props.options.length === 0 && (React.createElement("div", { className: styles$4.filterMessage },
|
|
91
|
+
React.createElement(Text, { variation: "subdued" },
|
|
102
92
|
"No results for ",
|
|
103
93
|
`“${props.searchValue}”`))),
|
|
104
|
-
props.showEmptyState && (
|
|
105
|
-
|
|
94
|
+
props.showEmptyState && (React.createElement("div", { className: styles$4.emptyStateMessage },
|
|
95
|
+
React.createElement(Text, { variation: "subdued" }, getZeroIndexStateText(props.subjectNoun))))));
|
|
106
96
|
}
|
|
107
97
|
function getZeroIndexStateText(subjectNoun) {
|
|
108
98
|
if (subjectNoun) {
|
|
@@ -113,7 +103,7 @@ function getZeroIndexStateText(subjectNoun) {
|
|
|
113
103
|
|
|
114
104
|
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";
|
|
115
105
|
var styles$2 = {"header":"Q-mwo-g5Fi8-"};
|
|
116
|
-
|
|
106
|
+
styleInject(css_248z$2);
|
|
117
107
|
|
|
118
108
|
function ComboboxContentHeader(props) {
|
|
119
109
|
const hasSelected = props.selectedCount > 0;
|
|
@@ -121,9 +111,9 @@ function ComboboxContentHeader(props) {
|
|
|
121
111
|
const label = getLabel(hasSelected, props.selectedCount, props.subjectNoun);
|
|
122
112
|
const handleSelectAll = hasSelected ? props.onClearAll : props.onSelectAll;
|
|
123
113
|
const showAction = hasSelected || props.hasOptionsVisible;
|
|
124
|
-
return (
|
|
125
|
-
|
|
126
|
-
showAction && (
|
|
114
|
+
return (React.createElement("div", { className: styles$2.header, "data-testid": "ATL-Combobox-Header" },
|
|
115
|
+
React.createElement(Typography, { textColor: "heading", fontWeight: "semiBold" }, label),
|
|
116
|
+
showAction && (React.createElement(Button, { size: "small", label: actionLabel, type: "tertiary", onClick: handleSelectAll }))));
|
|
127
117
|
}
|
|
128
118
|
function getLabel(hasSelected, count, subjectNoun) {
|
|
129
119
|
if (hasSelected) {
|
|
@@ -136,10 +126,10 @@ function getLabel(hasSelected, count, subjectNoun) {
|
|
|
136
126
|
}
|
|
137
127
|
|
|
138
128
|
function useComboboxContent(options, open, selected, searchValue) {
|
|
139
|
-
const { shouldScroll } =
|
|
140
|
-
const optionsListRef =
|
|
129
|
+
const { shouldScroll } = useContext(ComboboxContext);
|
|
130
|
+
const optionsListRef = useRef(null);
|
|
141
131
|
const filteredOptions = options.filter(option => option.label.toLowerCase().includes(searchValue.toLowerCase()));
|
|
142
|
-
|
|
132
|
+
useEffect(() => {
|
|
143
133
|
var _a;
|
|
144
134
|
if (open && shouldScroll.current && optionsListRef.current) {
|
|
145
135
|
const firstSelected = Array.from((_a = optionsListRef === null || optionsListRef === void 0 ? void 0 : optionsListRef.current) === null || _a === void 0 ? void 0 : _a.children).find(child => {
|
|
@@ -166,12 +156,12 @@ function scrollToFirstSelected(firstSelected, shouldScroll) {
|
|
|
166
156
|
|
|
167
157
|
// eslint-disable-next-line max-statements
|
|
168
158
|
function useComboboxAccessibility(selectionCallback, filteredOptions, optionsListRef, open, wrapperRef) {
|
|
169
|
-
const { handleClose } =
|
|
159
|
+
const { handleClose } = useContext(ComboboxContext);
|
|
170
160
|
const hasOptionsVisible = open && filteredOptions.length > 0;
|
|
171
|
-
const focusedIndex =
|
|
172
|
-
useRefocusOnActivator
|
|
173
|
-
const popperRef = useFocusTrap
|
|
174
|
-
const { styles: popperStyles, attributes } =
|
|
161
|
+
const focusedIndex = useRef(null);
|
|
162
|
+
useRefocusOnActivator(open);
|
|
163
|
+
const popperRef = useFocusTrap(open);
|
|
164
|
+
const { styles: popperStyles, attributes } = usePopper(wrapperRef.current, popperRef.current, {
|
|
175
165
|
modifiers: [
|
|
176
166
|
{
|
|
177
167
|
name: "flip",
|
|
@@ -182,10 +172,10 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
182
172
|
],
|
|
183
173
|
placement: "bottom-start",
|
|
184
174
|
});
|
|
185
|
-
|
|
175
|
+
useEffect(() => {
|
|
186
176
|
focusedIndex.current = null;
|
|
187
177
|
}, [open, filteredOptions.length]);
|
|
188
|
-
|
|
178
|
+
useEffect(() => {
|
|
189
179
|
var _a;
|
|
190
180
|
if (open) {
|
|
191
181
|
(_a = popperRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("keydown", handleContentKeydown);
|
|
@@ -195,7 +185,7 @@ function useComboboxAccessibility(selectionCallback, filteredOptions, optionsLis
|
|
|
195
185
|
(_a = popperRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("keydown", handleContentKeydown);
|
|
196
186
|
};
|
|
197
187
|
}, [open, optionsListRef, filteredOptions]);
|
|
198
|
-
useOnKeyDown
|
|
188
|
+
useOnKeyDown(() => {
|
|
199
189
|
if (open) {
|
|
200
190
|
handleClose();
|
|
201
191
|
}
|
|
@@ -246,51 +236,51 @@ function ComboboxContent(props) {
|
|
|
246
236
|
const optionsExist = props.options.length > 0;
|
|
247
237
|
const { filteredOptions, optionsListRef } = useComboboxContent(props.options, props.open, props.selected, props.searchValue);
|
|
248
238
|
const { popperRef, popperStyles, attributes } = useComboboxAccessibility(props.handleSelection, filteredOptions, optionsListRef, props.open, props.wrapperRef);
|
|
249
|
-
const template = (
|
|
250
|
-
|
|
251
|
-
props.multiselect && optionsExist && (
|
|
239
|
+
const template = (React.createElement("div", Object.assign({ ref: popperRef, id: "ATL-Combobox-Content", "data-testid": "ATL-Combobox-Content", tabIndex: 0, className: classnames(styles$6.content, { [styles$6.hidden]: !props.open }), style: popperStyles.popper }, attributes.popper),
|
|
240
|
+
React.createElement(ComboboxContentSearch, { open: props.open, placeholder: props.subjectNoun, searchValue: props.searchValue, setSearchValue: props.setSearchValue }),
|
|
241
|
+
props.multiselect && optionsExist && (React.createElement(ComboboxContentHeader, { hasOptionsVisible: filteredOptions.length > 0, subjectNoun: props.subjectNoun, selectedCount: props.selected.length, onClearAll: () => {
|
|
252
242
|
props.selectedStateSetter([]);
|
|
253
243
|
}, onSelectAll: () => {
|
|
254
244
|
props.selectedStateSetter(filteredOptions);
|
|
255
245
|
} })),
|
|
256
|
-
|
|
257
|
-
props.actionElements && (
|
|
246
|
+
React.createElement(ComboboxContentList, { multiselect: props.multiselect, showEmptyState: !optionsExist, options: filteredOptions, selected: props.selected, optionsListRef: optionsListRef, searchValue: props.searchValue, subjectNoun: props.subjectNoun }),
|
|
247
|
+
props.actionElements && (React.createElement("div", { className: styles$6.actions, role: "group" }, props.actionElements.map((child, index, childrenArray) => (React.createElement("div", { key: index, className: classnames({
|
|
258
248
|
[styles$6.actionPadding]: index === childrenArray.length - 1,
|
|
259
249
|
}) }, child)))))));
|
|
260
|
-
return
|
|
250
|
+
return ReactDOM.createPortal(template, document.body);
|
|
261
251
|
}
|
|
262
252
|
|
|
263
253
|
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 calc(16px / 4) calc(16px / 8)\n rgb(231, 213, 87);\n box-shadow: var(--shadow-focus);\n background-color: rgb(244, 244, 244);\n background-color: var(--color-surface--background);\n}\n\n.ncp0nKHQ7d8-:hover {\n background-color: rgb(244, 244, 244);\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";
|
|
264
254
|
var styles$1 = {"actionContainer":"Ow9wSNnGP-g-","actionButton":"ncp0nKHQ7d8-"};
|
|
265
|
-
|
|
255
|
+
styleInject(css_248z$1);
|
|
266
256
|
|
|
267
257
|
function ComboboxAction(props) {
|
|
268
|
-
return (
|
|
269
|
-
|
|
270
|
-
|
|
258
|
+
return (React.createElement("div", { className: styles$1.actionContainer },
|
|
259
|
+
React.createElement("button", { className: styles$1.actionButton, onClick: props.onClick, type: "button", "aria-label": props.label },
|
|
260
|
+
React.createElement(Typography, { element: "span", size: "base", textColor: "green", fontWeight: "semiBold" }, props.label))));
|
|
271
261
|
}
|
|
272
262
|
|
|
273
263
|
function ComboboxTrigger({ label = "Select", selected, }) {
|
|
274
|
-
const { handleClose, open, setOpen } =
|
|
264
|
+
const { handleClose, open, setOpen } = React.useContext(ComboboxContext);
|
|
275
265
|
const hasSelection = selected.length;
|
|
276
266
|
const selectedLabel = selected.map(option => option.label).join(", ");
|
|
277
|
-
return (
|
|
267
|
+
return (React.createElement(Chip, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", heading: label, onClick: () => {
|
|
278
268
|
if (open) {
|
|
279
269
|
handleClose();
|
|
280
270
|
}
|
|
281
271
|
else {
|
|
282
272
|
setOpen(true);
|
|
283
273
|
}
|
|
284
|
-
}, role: "combobox" }, !hasSelection && (
|
|
285
|
-
|
|
274
|
+
}, role: "combobox" }, !hasSelection && (React.createElement(Chip.Suffix, null,
|
|
275
|
+
React.createElement(Icon, { name: "add", size: "small" })))));
|
|
286
276
|
}
|
|
287
277
|
|
|
288
278
|
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";
|
|
289
279
|
var styles = {"overlay":"W8qMZnORYxI-","wrapper":"_-0dkolvLF-Y-"};
|
|
290
|
-
|
|
280
|
+
styleInject(css_248z);
|
|
291
281
|
|
|
292
282
|
function useMakeComboboxHandlers(setOpen, setSearchValue, selectedOptions, shouldScroll, selectedStateSetter, multiSelect, onClose) {
|
|
293
|
-
const handleClose =
|
|
283
|
+
const handleClose = useCallback(() => {
|
|
294
284
|
setOpen(false);
|
|
295
285
|
setSearchValue("");
|
|
296
286
|
onClose && onClose();
|
|
@@ -298,7 +288,7 @@ function useMakeComboboxHandlers(setOpen, setSearchValue, selectedOptions, shoul
|
|
|
298
288
|
shouldScroll.current = true;
|
|
299
289
|
}
|
|
300
290
|
}, [setOpen, setSearchValue, onClose, selectedOptions.length]);
|
|
301
|
-
const handleSelection =
|
|
291
|
+
const handleSelection = useCallback((selection) => {
|
|
302
292
|
if (multiSelect) {
|
|
303
293
|
handleMultiSelect(selectedStateSetter, selectedOptions, selection);
|
|
304
294
|
}
|
|
@@ -306,7 +296,7 @@ function useMakeComboboxHandlers(setOpen, setSearchValue, selectedOptions, shoul
|
|
|
306
296
|
handleSingleSelect(selectedStateSetter, selection);
|
|
307
297
|
}
|
|
308
298
|
}, [multiSelect, selectedStateSetter, selectedOptions]);
|
|
309
|
-
const handleSingleSelect =
|
|
299
|
+
const handleSingleSelect = useCallback((selectCallback, selection) => {
|
|
310
300
|
selectCallback([selection]);
|
|
311
301
|
handleClose();
|
|
312
302
|
}, []);
|
|
@@ -325,10 +315,10 @@ function handleMultiSelect(selectCallback, selected, selection) {
|
|
|
325
315
|
}
|
|
326
316
|
|
|
327
317
|
function useCombobox(selected, onSelect, onClose, multiSelect) {
|
|
328
|
-
const wrapperRef =
|
|
329
|
-
const shouldScroll =
|
|
330
|
-
const [open, setOpen] =
|
|
331
|
-
const [searchValue, setSearchValue] =
|
|
318
|
+
const wrapperRef = useRef(null);
|
|
319
|
+
const shouldScroll = useRef(false);
|
|
320
|
+
const [open, setOpen] = useState(false);
|
|
321
|
+
const [searchValue, setSearchValue] = useState("");
|
|
332
322
|
const { handleClose, handleSelection } = useMakeComboboxHandlers(setOpen, setSearchValue, selected, shouldScroll, onSelect, multiSelect, onClose);
|
|
333
323
|
return {
|
|
334
324
|
wrapperRef,
|
|
@@ -345,9 +335,9 @@ function useCombobox(selected, onSelect, onClose, multiSelect) {
|
|
|
345
335
|
}
|
|
346
336
|
|
|
347
337
|
function ComboboxActivator(props) {
|
|
348
|
-
const { handleClose, open, setOpen } =
|
|
349
|
-
if (props.children.type === Button
|
|
350
|
-
return
|
|
338
|
+
const { handleClose, open, setOpen } = React.useContext(ComboboxContext);
|
|
339
|
+
if (props.children.type === Button || props.children.type === Chip) {
|
|
340
|
+
return React.cloneElement(props.children, {
|
|
351
341
|
role: "combobox",
|
|
352
342
|
onClick: () => {
|
|
353
343
|
if (open) {
|
|
@@ -368,7 +358,7 @@ function useComboboxValidation(children) {
|
|
|
368
358
|
const actionElements = getCompoundComponents(ComboboxAction, children);
|
|
369
359
|
const activatorElements = getCompoundComponents(ComboboxActivator, children);
|
|
370
360
|
const shouldThrowTriggerError = isInvalid(activatorElements);
|
|
371
|
-
useAssert
|
|
361
|
+
useAssert(shouldThrowTriggerError, COMBOBOX_TRIGGER_COUNT_ERROR_MESSAGE);
|
|
372
362
|
return {
|
|
373
363
|
optionElements,
|
|
374
364
|
triggerElement: activatorElements[0],
|
|
@@ -382,27 +372,26 @@ function isInvalid(activators) {
|
|
|
382
372
|
* Return all instances child component that matches the `type` provided
|
|
383
373
|
*/
|
|
384
374
|
function getCompoundComponents(type, children) {
|
|
385
|
-
const childrenArray =
|
|
386
|
-
const elements = childrenArray.filter((child) =>
|
|
375
|
+
const childrenArray = Children.toArray(children);
|
|
376
|
+
const elements = childrenArray.filter((child) => isValidElement(child) && child.type === type);
|
|
387
377
|
return elements;
|
|
388
378
|
}
|
|
389
379
|
|
|
390
380
|
function Combobox(props) {
|
|
391
381
|
const { optionElements, triggerElement, actionElements } = useComboboxValidation(props.children);
|
|
392
|
-
const options =
|
|
382
|
+
const options = useMemo(() => (optionElements === null || optionElements === void 0 ? void 0 : optionElements.map(option => ({
|
|
393
383
|
id: option.props.id,
|
|
394
384
|
label: option.props.label,
|
|
395
385
|
}))) || [], [optionElements]);
|
|
396
386
|
const { selectedOptions, selectedStateSetter, shouldScroll, wrapperRef, searchValue, setSearchValue, open, setOpen, handleClose, handleSelection, } = useCombobox(props.selected, props.onSelect, props.onClose, props.multiSelect);
|
|
397
|
-
return (
|
|
398
|
-
|
|
399
|
-
open && (
|
|
400
|
-
triggerElement || (
|
|
401
|
-
|
|
387
|
+
return (React.createElement(ComboboxContextProvider, { selected: selectedOptions, selectionHandler: handleSelection, open: open, setOpen: setOpen, handleClose: handleClose, shouldScroll: shouldScroll },
|
|
388
|
+
React.createElement("div", { ref: wrapperRef, className: styles.wrapper },
|
|
389
|
+
open && (React.createElement("div", { className: styles.overlay, onClick: () => handleClose(), "data-testid": "ATL-Combobox-Overlay" })),
|
|
390
|
+
triggerElement || (React.createElement(ComboboxTrigger, { label: props.label, selected: props.selected })),
|
|
391
|
+
React.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 }))));
|
|
402
392
|
}
|
|
403
393
|
Combobox.Activator = ComboboxActivator;
|
|
404
394
|
Combobox.Action = ComboboxAction;
|
|
405
395
|
Combobox.Option = ComboboxOption;
|
|
406
396
|
|
|
407
|
-
|
|
408
|
-
exports.ComboboxContextProvider = ComboboxContextProvider;
|
|
397
|
+
export { Combobox, ComboboxContextProvider };
|
|
@@ -1,30 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
require('../Markdown-d53b01bf.js');
|
|
24
|
-
require('react-markdown');
|
|
25
|
-
require('../Text-54334431.js');
|
|
26
|
-
require('../Emphasis-e10dde65.js');
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
exports.ConfirmationModal = ConfirmationModal.ConfirmationModal;
|
|
1
|
+
export { C as ConfirmationModal } from '../ConfirmationModal-86b42ca0.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '@jobber/hooks/useOnKeyDown';
|
|
4
|
+
import '../Modal-06dc9551.js';
|
|
5
|
+
import 'react-dom';
|
|
6
|
+
import 'classnames';
|
|
7
|
+
import 'framer-motion';
|
|
8
|
+
import '@jobber/hooks/useRefocusOnActivator';
|
|
9
|
+
import '@jobber/hooks/useFocusTrap';
|
|
10
|
+
import '../style-inject.es-a0e1a0ba.js';
|
|
11
|
+
import '../Heading-04994667.js';
|
|
12
|
+
import '../Typography-09952a2f.js';
|
|
13
|
+
import '../Button-319d8fa0.js';
|
|
14
|
+
import 'react-router-dom';
|
|
15
|
+
import '../Icon-22723fe6.js';
|
|
16
|
+
import '@jobber/design';
|
|
17
|
+
import '../ButtonDismiss-85986110.js';
|
|
18
|
+
import '../Content-3354c281.js';
|
|
19
|
+
import '../Markdown-2ec28e51.js';
|
|
20
|
+
import 'react-markdown';
|
|
21
|
+
import '../Text-703e2c21.js';
|
|
22
|
+
import '../Emphasis-edd2af9b.js';
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var Content = require('./Content-2ca1ffe1.js');
|
|
7
|
-
var Markdown = require('./Markdown-d53b01bf.js');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
1
|
+
import React, { forwardRef, useReducer, useImperativeHandle, useEffect } from 'react';
|
|
2
|
+
import { useOnKeyDown } from '@jobber/hooks/useOnKeyDown';
|
|
3
|
+
import { M as Modal } from './Modal-06dc9551.js';
|
|
4
|
+
import { C as Content } from './Content-3354c281.js';
|
|
5
|
+
import { M as Markdown } from './Markdown-2ec28e51.js';
|
|
12
6
|
|
|
13
7
|
function confirmationModalReducer(state, action) {
|
|
14
8
|
switch (action.type) {
|
|
@@ -26,8 +20,8 @@ function confirmationModalReducer(state, action) {
|
|
|
26
20
|
throw new Error();
|
|
27
21
|
}
|
|
28
22
|
}
|
|
29
|
-
const ConfirmationModal =
|
|
30
|
-
const [state, dispatch] =
|
|
23
|
+
const ConfirmationModal = forwardRef(function ConfirmationModalInternal({ title, message, open = false, confirmLabel = "Confirm", cancelLabel = "Cancel", onConfirm, onCancel, onRequestClose, variation = "work", size, children, }, ref) {
|
|
24
|
+
const [state, dispatch] = useReducer(confirmationModalReducer, {
|
|
31
25
|
title,
|
|
32
26
|
message,
|
|
33
27
|
open: false,
|
|
@@ -37,7 +31,7 @@ const ConfirmationModal = React.forwardRef(function ConfirmationModalInternal({
|
|
|
37
31
|
onCancel,
|
|
38
32
|
});
|
|
39
33
|
// Expose a `show` method through this component's ref.
|
|
40
|
-
|
|
34
|
+
useImperativeHandle(ref, () => ({
|
|
41
35
|
show: ({ title: newTitle, message: newMessage, confirmLabel: newConfirmLabel, cancelLabel: newCancelLabel, onConfirm: newOnConfirm, onCancel: newOnCancel, }) => {
|
|
42
36
|
dispatch({
|
|
43
37
|
type: "display",
|
|
@@ -50,7 +44,7 @@ const ConfirmationModal = React.forwardRef(function ConfirmationModalInternal({
|
|
|
50
44
|
});
|
|
51
45
|
},
|
|
52
46
|
}));
|
|
53
|
-
|
|
47
|
+
useEffect(() => {
|
|
54
48
|
dispatch({
|
|
55
49
|
type: "reset",
|
|
56
50
|
state: Object.assign(Object.assign({}, state), { title, message: message, confirmLabel,
|
|
@@ -59,16 +53,16 @@ const ConfirmationModal = React.forwardRef(function ConfirmationModalInternal({
|
|
|
59
53
|
onCancel }),
|
|
60
54
|
});
|
|
61
55
|
}, [title, message, confirmLabel, cancelLabel, onConfirm, onCancel]);
|
|
62
|
-
useOnKeyDown
|
|
63
|
-
return (
|
|
56
|
+
useOnKeyDown(handleKeyboardShortcut, ["Escape", "Enter"]);
|
|
57
|
+
return (React.createElement(Modal, { title: state.title, open: open || state.open, size: size, dismissible: false, primaryAction: {
|
|
64
58
|
label: state.confirmLabel,
|
|
65
59
|
onClick: handleAction("confirm"),
|
|
66
60
|
variation: variation === "destructive" ? "destructive" : "work",
|
|
67
61
|
}, secondaryAction: {
|
|
68
62
|
label: state.cancelLabel,
|
|
69
63
|
onClick: handleAction("cancel"),
|
|
70
|
-
} }, state.message ? (
|
|
71
|
-
|
|
64
|
+
} }, state.message ? (React.createElement(Content, null,
|
|
65
|
+
React.createElement(Markdown, { content: state.message }))) : (children)));
|
|
72
66
|
function handleAction(type) {
|
|
73
67
|
return () => {
|
|
74
68
|
dispatch({ type });
|
|
@@ -97,4 +91,4 @@ const ConfirmationModal = React.forwardRef(function ConfirmationModalInternal({
|
|
|
97
91
|
}
|
|
98
92
|
});
|
|
99
93
|
|
|
100
|
-
|
|
94
|
+
export { ConfirmationModal as C };
|
package/dist/Content/index.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var Content = require('../Content-2ca1ffe1.js');
|
|
6
|
-
require('react');
|
|
7
|
-
require('classnames');
|
|
8
|
-
require('../style-inject.es-9d2f5f4e.js');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.Content = Content.Content;
|
|
1
|
+
export { C as Content } from '../Content-3354c281.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import '../style-inject.es-a0e1a0ba.js';
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var classnames = require('classnames');
|
|
5
|
-
var styleInject_es = require('./style-inject.es-9d2f5f4e.js');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { s as styleInject } from './style-inject.es-a0e1a0ba.js';
|
|
10
4
|
|
|
11
5
|
var css_248z$1 = ".SRYe3DkjH1c- > :not(:last-child) {\n margin-bottom: calc(16px * 1);\n margin-bottom: var(--space-base);\n}\n\n.rDJFaGPzCbE- > :not(:last-child) {\n margin-bottom: calc(16px / 2);\n margin-bottom: var(--space-small);\n}\n\n._7TZ4MI3kr4Y- > :not(:last-child) {\n margin-bottom: calc(16px * 1.5);\n margin-bottom: var(--space-large);\n}\n";
|
|
12
6
|
var spacings = {"base":"SRYe3DkjH1c-","small":"rDJFaGPzCbE-","large":"_7TZ4MI3kr4Y-"};
|
|
13
|
-
|
|
7
|
+
styleInject(css_248z$1);
|
|
14
8
|
|
|
15
9
|
var css_248z = "._4On2F-4nWuY- {\n padding: 0;\n padding: var(--public-content--padding, 0);\n}\n";
|
|
16
10
|
var styles = {"padded":"_4On2F-4nWuY-"};
|
|
17
|
-
|
|
11
|
+
styleInject(css_248z);
|
|
18
12
|
|
|
19
13
|
function Content({ children, spacing = "base", type = "div", }) {
|
|
20
|
-
const className =
|
|
21
|
-
return
|
|
14
|
+
const className = classnames(styles.padded, spacings[spacing]);
|
|
15
|
+
return createElement(type, { className }, children);
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
|
|
18
|
+
export { Content as C };
|