@sproutsocial/racine 22.5.1 → 23.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +3 -3
- package/__flow__/Toast/Toast.flow.js +4 -0
- package/commonjs/Avatar/Avatar.js +24 -16
- package/commonjs/Badge/Badge.js +20 -13
- package/commonjs/Banner/Banner.js +35 -25
- package/commonjs/Box/Box.js +7 -2
- package/commonjs/Breadcrumb/Breadcrumb.js +36 -23
- package/commonjs/Button/Button.js +11 -3
- package/commonjs/Card/Card.js +25 -18
- package/commonjs/Card/subComponents.js +32 -15
- package/commonjs/CharacterCounter/CharacterCounter.js +7 -3
- package/commonjs/ChartLegend/ChartLegend.js +10 -3
- package/commonjs/ChartLegend/useChartLabels.js +12 -10
- package/commonjs/Checkbox/Checkbox.js +55 -45
- package/commonjs/Checkbox/styles.js +20 -17
- package/commonjs/Collapsible/Collapsible.js +22 -16
- package/commonjs/DatePicker/DateRangePicker/DateRangePicker.js +26 -16
- package/commonjs/DatePicker/DateRangePicker/StatefulDateRangePicker.js +7 -2
- package/commonjs/DatePicker/SingleDatePicker/SingleDatePicker.js +24 -14
- package/commonjs/DatePicker/SingleDatePicker/StatefulSingleDatePicker.js +7 -2
- package/commonjs/DatePicker/common.js +8 -6
- package/commonjs/Drawer/Drawer.js +160 -113
- package/commonjs/EmptyState/EmptyState.js +44 -31
- package/commonjs/Fieldset/Fieldset.js +31 -14
- package/commonjs/FormField/FormField.js +37 -31
- package/commonjs/Icon/Icon.js +35 -30
- package/commonjs/Image/Image.js +5 -3
- package/commonjs/Indicator/Indicator.js +12 -6
- package/commonjs/Input/Input.js +57 -51
- package/commonjs/KeyboardKey/KeyboardKey.js +12 -3
- package/commonjs/Label/Label.js +15 -9
- package/commonjs/Link/Link.js +10 -3
- package/commonjs/Listbox/Listbox.js +16 -13
- package/commonjs/Loader/Loader.js +9 -3
- package/commonjs/LoaderButton/LoaderButton.js +28 -18
- package/commonjs/Menu/Menu.js +128 -107
- package/commonjs/Menu/utils/descendants.js +6 -6
- package/commonjs/Message/Message.js +79 -59
- package/commonjs/Modal/Modal.js +54 -31
- package/commonjs/Modal/styles.js +8 -4
- package/commonjs/Numeral/Numeral.js +46 -13
- package/commonjs/Numeral/index.js +12 -3
- package/commonjs/PartnerLogo/PartnerLogo.js +22 -12
- package/commonjs/Radio/Radio.js +28 -22
- package/commonjs/SegmentedControl/SegmentedControl.js +38 -24
- package/commonjs/Select/Select.js +32 -25
- package/commonjs/SpotIllustration/SpotIllustration.js +13 -5
- package/commonjs/Stack/Stack.js +15 -8
- package/commonjs/Switch/Switch.js +14 -7
- package/commonjs/Table/Table.js +65 -45
- package/commonjs/TableCell/TableCell.js +6 -3
- package/commonjs/TableHeaderCell/TableHeaderCell.js +20 -12
- package/commonjs/TableRowAccordion/TableRowAccordion.js +35 -29
- package/commonjs/Tabs/Tabs.js +37 -30
- package/commonjs/Text/Text.js +10 -3
- package/commonjs/Textarea/Textarea.js +37 -32
- package/commonjs/ThemeProvider/index.js +8 -5
- package/commonjs/Toast/Toast.js +127 -91
- package/commonjs/Toast/index.js +15 -15
- package/commonjs/Toast/styles.js +56 -30
- package/commonjs/ToggleHint/ToggleHint.js +11 -5
- package/commonjs/Token/Token.js +39 -25
- package/commonjs/TokenInput/TokenInput.js +55 -47
- package/commonjs/TokenInput/TokenScreenReaderStatus.js +5 -3
- package/commonjs/Tooltip/Tooltip.js +34 -27
- package/dist/types/Avatar/Avatar.d.ts.map +1 -1
- package/dist/types/Badge/BadgeTypes.d.ts +0 -1
- package/dist/types/Badge/BadgeTypes.d.ts.map +1 -1
- package/dist/types/Badge/styles.d.ts +1 -1
- package/dist/types/Badge/styles.d.ts.map +1 -1
- package/dist/types/Box/BoxTypes.d.ts +0 -1
- package/dist/types/Box/BoxTypes.d.ts.map +1 -1
- package/dist/types/Box/styles.d.ts +1 -1
- package/dist/types/Box/styles.d.ts.map +1 -1
- package/dist/types/Button/Button.d.ts +1 -1
- package/dist/types/Button/Button.d.ts.map +1 -1
- package/dist/types/Card/subComponents.d.ts.map +1 -1
- package/dist/types/Card/utils.d.ts +0 -2
- package/dist/types/Card/utils.d.ts.map +1 -1
- package/dist/types/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/types/Collapsible/styles.d.ts +2 -3
- package/dist/types/Collapsible/styles.d.ts.map +1 -1
- package/dist/types/DatePicker/DateRangePicker/DateRangePickerTypes.d.ts +0 -1
- package/dist/types/DatePicker/DateRangePicker/DateRangePickerTypes.d.ts.map +1 -1
- package/dist/types/DatePicker/SingleDatePicker/SingleDatePickerTypes.d.ts +0 -1
- package/dist/types/DatePicker/SingleDatePicker/SingleDatePickerTypes.d.ts.map +1 -1
- package/dist/types/DatePicker/common.d.ts.map +1 -1
- package/dist/types/DatePicker/styles.d.ts +0 -1
- package/dist/types/DatePicker/styles.d.ts.map +1 -1
- package/dist/types/Drawer/Drawer.d.ts.map +1 -1
- package/dist/types/Drawer/DrawerTypes.d.ts +6 -3
- package/dist/types/Drawer/DrawerTypes.d.ts.map +1 -1
- package/dist/types/Drawer/styles.d.ts +0 -1
- package/dist/types/Drawer/styles.d.ts.map +1 -1
- package/dist/types/Fieldset/styles.d.ts +0 -1
- package/dist/types/Fieldset/styles.d.ts.map +1 -1
- package/dist/types/Icon/styles.d.ts +1 -1
- package/dist/types/Icon/styles.d.ts.map +1 -1
- package/dist/types/Image/Image.d.ts.map +1 -1
- package/dist/types/Input/Input.d.ts.map +1 -1
- package/dist/types/Input/styles.d.ts +3 -3
- package/dist/types/Input/styles.d.ts.map +1 -1
- package/dist/types/Listbox/ListboxTypes.d.ts +1 -1
- package/dist/types/Listbox/ListboxTypes.d.ts.map +1 -1
- package/dist/types/Loader/LoaderTypes.d.ts +0 -1
- package/dist/types/Loader/LoaderTypes.d.ts.map +1 -1
- package/dist/types/Menu/MenuTypes.d.ts +4 -4
- package/dist/types/Menu/MenuTypes.d.ts.map +1 -1
- package/dist/types/Menu/styles.d.ts +0 -1
- package/dist/types/Menu/styles.d.ts.map +1 -1
- package/dist/types/Menu/utils/descendants.d.ts.map +1 -1
- package/dist/types/Menu/utils/hooks.d.ts +0 -2
- package/dist/types/Menu/utils/hooks.d.ts.map +1 -1
- package/dist/types/Message/Message.d.ts +1 -1
- package/dist/types/Message/Message.d.ts.map +1 -1
- package/dist/types/Message/styles.d.ts +0 -2
- package/dist/types/Message/styles.d.ts.map +1 -1
- package/dist/types/Modal/styles.d.ts +3 -3
- package/dist/types/Modal/styles.d.ts.map +1 -1
- package/dist/types/Numeral/Numeral.d.ts +3 -1
- package/dist/types/Numeral/Numeral.d.ts.map +1 -1
- package/dist/types/Numeral/__tests__/features/testNumeral.d.ts.map +1 -1
- package/dist/types/Numeral/index.d.ts +2 -1
- package/dist/types/Numeral/index.d.ts.map +1 -1
- package/dist/types/Radio/Radio.d.ts.map +1 -1
- package/dist/types/Radio/styles.d.ts +3 -3
- package/dist/types/Radio/styles.d.ts.map +1 -1
- package/dist/types/SegmentedControl/styles.d.ts +0 -1
- package/dist/types/SegmentedControl/styles.d.ts.map +1 -1
- package/dist/types/Select/Select.d.ts.map +1 -1
- package/dist/types/Skeleton/Skeleton.d.ts +0 -1
- package/dist/types/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/types/StatefulStory.d.ts +0 -1
- package/dist/types/StatefulStory.d.ts.map +1 -1
- package/dist/types/TableHeaderCell/TableHeaderCell.d.ts.map +1 -1
- package/dist/types/TableHeaderCell/styles.d.ts +1 -1
- package/dist/types/TableHeaderCell/styles.d.ts.map +1 -1
- package/dist/types/Tabs/Tabs.d.ts.map +1 -1
- package/dist/types/Textarea/Textarea.d.ts.map +1 -1
- package/dist/types/ThemeProvider/index.d.ts +1 -1
- package/dist/types/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/Toast/Toast.d.ts +22 -2
- package/dist/types/Toast/Toast.d.ts.map +1 -1
- package/dist/types/Toast/ToastTypes.d.ts +27 -13
- package/dist/types/Toast/ToastTypes.d.ts.map +1 -1
- package/dist/types/Toast/index.d.ts +2 -4
- package/dist/types/Toast/index.d.ts.map +1 -1
- package/dist/types/Toast/styles.d.ts +10 -16
- package/dist/types/Toast/styles.d.ts.map +1 -1
- package/dist/types/TokenInput/TokenInput.d.ts +1 -1
- package/dist/types/TokenInput/TokenInput.d.ts.map +1 -1
- package/dist/types/Tooltip/TooltipTypes.d.ts +2 -2
- package/dist/types/Tooltip/TooltipTypes.d.ts.map +1 -1
- package/dist/types/Tooltip/styles.d.ts +0 -1
- package/dist/types/Tooltip/styles.d.ts.map +1 -1
- package/dist/types/themes/dark/theme.d.ts +2 -2
- package/dist/types/themes/dark/theme.d.ts.map +1 -1
- package/dist/types/utils/hooks.d.ts.map +1 -1
- package/dist/types/utils/react-testing-library.d.ts +109 -169
- package/dist/types/utils/react-testing-library.d.ts.map +1 -1
- package/dist/types/utils/responsiveProps/index.d.ts.map +1 -1
- package/lib/Avatar/Avatar.js +25 -16
- package/lib/Badge/Badge.js +22 -13
- package/lib/Banner/Banner.js +37 -25
- package/lib/Box/Box.js +8 -2
- package/lib/Breadcrumb/Breadcrumb.js +37 -23
- package/lib/Button/Button.js +11 -3
- package/lib/Card/Card.js +17 -8
- package/lib/Card/subComponents.js +35 -15
- package/lib/CharacterCounter/CharacterCounter.js +7 -3
- package/lib/ChartLegend/ChartLegend.js +11 -3
- package/lib/ChartLegend/useChartLabels.js +13 -10
- package/lib/Checkbox/Checkbox.js +56 -45
- package/lib/Checkbox/styles.js +20 -17
- package/lib/Collapsible/Collapsible.js +22 -16
- package/lib/DatePicker/DateRangePicker/DateRangePicker.js +29 -16
- package/lib/DatePicker/DateRangePicker/StatefulDateRangePicker.js +8 -2
- package/lib/DatePicker/SingleDatePicker/SingleDatePicker.js +27 -14
- package/lib/DatePicker/SingleDatePicker/StatefulSingleDatePicker.js +8 -2
- package/lib/DatePicker/common.js +8 -6
- package/lib/Drawer/Drawer.js +159 -111
- package/lib/EmptyState/EmptyState.js +46 -31
- package/lib/Fieldset/Fieldset.js +33 -14
- package/lib/FormField/FormField.js +38 -31
- package/lib/Icon/Icon.js +36 -30
- package/lib/Image/Image.js +5 -3
- package/lib/Indicator/Indicator.js +13 -6
- package/lib/Input/Input.js +57 -49
- package/lib/KeyboardKey/KeyboardKey.js +12 -3
- package/lib/Label/Label.js +16 -9
- package/lib/Link/Link.js +11 -3
- package/lib/Listbox/Listbox.js +17 -13
- package/lib/Loader/Loader.js +9 -3
- package/lib/LoaderButton/LoaderButton.js +30 -18
- package/lib/Menu/Menu.js +128 -104
- package/lib/Menu/utils/descendants.js +5 -4
- package/lib/Message/Message.js +80 -59
- package/lib/Modal/Modal.js +56 -31
- package/lib/Modal/styles.js +8 -2
- package/lib/Numeral/Numeral.js +48 -12
- package/lib/Numeral/index.js +2 -1
- package/lib/PartnerLogo/PartnerLogo.js +22 -12
- package/lib/Radio/Radio.js +29 -22
- package/lib/SegmentedControl/SegmentedControl.js +40 -24
- package/lib/Select/Select.js +33 -25
- package/lib/SpotIllustration/SpotIllustration.js +13 -5
- package/lib/Stack/Stack.js +17 -8
- package/lib/Switch/Switch.js +15 -7
- package/lib/Table/Table.js +65 -43
- package/lib/TableCell/TableCell.js +5 -2
- package/lib/TableHeaderCell/TableHeaderCell.js +20 -11
- package/lib/TableRowAccordion/TableRowAccordion.js +35 -28
- package/lib/Tabs/Tabs.js +37 -30
- package/lib/Text/Text.js +11 -3
- package/lib/Textarea/Textarea.js +37 -30
- package/lib/ThemeProvider/index.js +8 -3
- package/lib/Toast/Toast.js +130 -90
- package/lib/Toast/index.js +3 -5
- package/lib/Toast/styles.js +55 -26
- package/lib/ToggleHint/ToggleHint.js +12 -5
- package/lib/Token/Token.js +42 -25
- package/lib/TokenInput/TokenInput.js +56 -47
- package/lib/TokenInput/TokenScreenReaderStatus.js +5 -3
- package/lib/Tooltip/Tooltip.js +34 -27
- package/package.json +40 -36
- package/commonjs/Drawer/SlideTransition.js +0 -47
- package/commonjs/Popout/Popout.js +0 -313
- package/commonjs/Popout/PopoutTypes.js +0 -5
- package/commonjs/Popout/index.js +0 -30
- package/commonjs/Popout/styles.js +0 -13
- package/dist/types/Drawer/SlideTransition.d.ts +0 -15
- package/dist/types/Drawer/SlideTransition.d.ts.map +0 -1
- package/dist/types/Popout/Popout.d.ts +0 -14
- package/dist/types/Popout/Popout.d.ts.map +0 -1
- package/dist/types/Popout/PopoutTypes.d.ts +0 -90
- package/dist/types/Popout/PopoutTypes.d.ts.map +0 -1
- package/dist/types/Popout/index.d.ts +0 -5
- package/dist/types/Popout/index.d.ts.map +0 -1
- package/dist/types/Popout/styles.d.ts +0 -2
- package/dist/types/Popout/styles.d.ts.map +0 -1
- package/lib/Drawer/SlideTransition.js +0 -38
- package/lib/Popout/Popout.js +0 -303
- package/lib/Popout/PopoutTypes.js +0 -1
- package/lib/Popout/index.js +0 -4
- package/lib/Popout/styles.js +0 -6
package/lib/Drawer/Drawer.js
CHANGED
|
@@ -1,28 +1,52 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
1
|
var _excluded = ["title", "id", "children", "render"],
|
|
3
2
|
_excluded2 = ["children"],
|
|
4
|
-
_excluded3 = ["id", "
|
|
3
|
+
_excluded3 = ["id", "offset", "direction", "children", "disableCloseOnClickOutside", "onClose", "zIndex", "closeTargets", "width", "focusLockExemptCheck", "isOpen"],
|
|
5
4
|
_excluded4 = ["children", "closeButtonLabel", "direction", "disableCloseOnClickOutside", "id", "isOpen", "offset", "onClose", "zIndex", "closeTargets", "width"];
|
|
5
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
6
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
10
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
12
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
12
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
13
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
13
|
import * as React from "react";
|
|
15
14
|
import { useContext, useEffect, useRef } from "react";
|
|
16
15
|
import FocusLock from "react-focus-lock";
|
|
17
|
-
import { animated } from "react-spring";
|
|
16
|
+
import { animated, useTransition } from "@react-spring/web";
|
|
17
|
+
import { MOTION_DURATION_MEDIUM } from "@sproutsocial/seeds-motion/dist/seeds-motion-unitless";
|
|
18
18
|
import Box from "../Box";
|
|
19
19
|
import Button from "../Button";
|
|
20
20
|
import Icon from "../Icon";
|
|
21
21
|
// eslint-disable-next-line import/no-deprecated
|
|
22
22
|
import Text from "../Text";
|
|
23
23
|
import Portal from "../Portal";
|
|
24
|
-
import { SlideTransition } from "./SlideTransition";
|
|
25
24
|
import Container, { Content } from "./styles";
|
|
25
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
+
var useSlideTransition = function useSlideTransition(_ref) {
|
|
28
|
+
var isVisible = _ref.isVisible,
|
|
29
|
+
width = _ref.width,
|
|
30
|
+
direction = _ref.direction;
|
|
31
|
+
var offset = width * (direction === "left" ? -1 : 1);
|
|
32
|
+
return useTransition(isVisible, {
|
|
33
|
+
from: {
|
|
34
|
+
opacity: 0,
|
|
35
|
+
x: offset
|
|
36
|
+
},
|
|
37
|
+
enter: {
|
|
38
|
+
opacity: 1,
|
|
39
|
+
x: 0
|
|
40
|
+
},
|
|
41
|
+
leave: {
|
|
42
|
+
opacity: 0,
|
|
43
|
+
x: offset
|
|
44
|
+
},
|
|
45
|
+
config: {
|
|
46
|
+
duration: MOTION_DURATION_MEDIUM * 1000
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
};
|
|
26
50
|
var AnimatedDrawer = animated(Container);
|
|
27
51
|
var doesRefContainEventTarget = function doesRefContainEventTarget(ref, event) {
|
|
28
52
|
return ref.current && event.target instanceof Node && ref.current.contains(event.target);
|
|
@@ -39,65 +63,65 @@ var DrawerCloseButton = function DrawerCloseButton(props) {
|
|
|
39
63
|
closeButtonLabel: closeButtonLabel
|
|
40
64
|
})) !== null && _props$render !== void 0 ? _props$render : null;
|
|
41
65
|
}
|
|
42
|
-
return /*#__PURE__*/
|
|
66
|
+
return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
43
67
|
appearance: "pill",
|
|
44
68
|
"aria-label": closeButtonLabel,
|
|
45
69
|
onClick: onClose
|
|
46
|
-
}, props),
|
|
47
|
-
|
|
48
|
-
|
|
70
|
+
}, props), {}, {
|
|
71
|
+
children: props.children || /*#__PURE__*/_jsx(Icon, {
|
|
72
|
+
"aria-hidden": true,
|
|
73
|
+
name: "x-outline"
|
|
74
|
+
})
|
|
49
75
|
}));
|
|
50
76
|
};
|
|
51
|
-
var DrawerHeader = function DrawerHeader(
|
|
52
|
-
var
|
|
53
|
-
title =
|
|
54
|
-
|
|
55
|
-
id =
|
|
56
|
-
children =
|
|
57
|
-
render =
|
|
58
|
-
rest = _objectWithoutProperties(
|
|
77
|
+
var DrawerHeader = function DrawerHeader(_ref2) {
|
|
78
|
+
var _ref2$title = _ref2.title,
|
|
79
|
+
title = _ref2$title === void 0 ? "" : _ref2$title,
|
|
80
|
+
_ref2$id = _ref2.id,
|
|
81
|
+
id = _ref2$id === void 0 ? undefined : _ref2$id,
|
|
82
|
+
children = _ref2.children,
|
|
83
|
+
render = _ref2.render,
|
|
84
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
59
85
|
var drawerContext = useContext(DrawerContext);
|
|
60
86
|
if (render) {
|
|
61
87
|
return render(drawerContext);
|
|
62
88
|
}
|
|
63
|
-
return /*#__PURE__*/
|
|
89
|
+
return /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
|
|
64
90
|
display: "flex",
|
|
65
91
|
flex: "0 0 auto",
|
|
66
92
|
justifyContent: "space-between",
|
|
67
93
|
alignItems: "center",
|
|
68
94
|
pt: 400,
|
|
69
95
|
px: 450
|
|
70
|
-
}, rest),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
96
|
+
}, rest), {}, {
|
|
97
|
+
children: children || /*#__PURE__*/_jsxs(React.Fragment, {
|
|
98
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
99
|
+
as: "h2",
|
|
100
|
+
fontSize: 400,
|
|
101
|
+
fontWeight: "semibold",
|
|
102
|
+
color: "text.headline",
|
|
103
|
+
id: id,
|
|
104
|
+
children: title
|
|
105
|
+
}), /*#__PURE__*/_jsx(DrawerCloseButton, {})]
|
|
106
|
+
})
|
|
107
|
+
}));
|
|
77
108
|
};
|
|
78
|
-
var DrawerContent = function DrawerContent(
|
|
79
|
-
var children =
|
|
80
|
-
rest = _objectWithoutProperties(
|
|
81
|
-
return /*#__PURE__*/
|
|
109
|
+
var DrawerContent = function DrawerContent(_ref3) {
|
|
110
|
+
var children = _ref3.children,
|
|
111
|
+
rest = _objectWithoutProperties(_ref3, _excluded2);
|
|
112
|
+
return /*#__PURE__*/_jsx(Content, _objectSpread(_objectSpread({
|
|
82
113
|
height: "100%",
|
|
83
114
|
p: 450,
|
|
84
115
|
color: "text.body"
|
|
85
|
-
}, rest),
|
|
116
|
+
}, rest), {}, {
|
|
117
|
+
children: children
|
|
118
|
+
}));
|
|
86
119
|
};
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
children = _ref3.children,
|
|
93
|
-
disableCloseOnClickOutside = _ref3.disableCloseOnClickOutside,
|
|
94
|
-
onClose = _ref3.onClose,
|
|
95
|
-
zIndex = _ref3.zIndex,
|
|
96
|
-
closeTargets = _ref3.closeTargets,
|
|
97
|
-
width = _ref3.width,
|
|
98
|
-
focusLockExemptCheck = _ref3.focusLockExemptCheck,
|
|
99
|
-
rest = _objectWithoutProperties(_ref3, _excluded3);
|
|
100
|
-
var drawerRef = useRef(null);
|
|
120
|
+
var useCloseOnBodyClick = function useCloseOnBodyClick(_ref4) {
|
|
121
|
+
var ref = _ref4.ref,
|
|
122
|
+
disableCloseOnClickOutside = _ref4.disableCloseOnClickOutside,
|
|
123
|
+
onClose = _ref4.onClose,
|
|
124
|
+
closeTargets = _ref4.closeTargets;
|
|
101
125
|
useEffect(function () {
|
|
102
126
|
var documentBody = document.body;
|
|
103
127
|
if (!documentBody) {
|
|
@@ -109,7 +133,7 @@ var Drawer = function Drawer(_ref3) {
|
|
|
109
133
|
}
|
|
110
134
|
};
|
|
111
135
|
var bodyClick = function bodyClick(event) {
|
|
112
|
-
if (!doesRefContainEventTarget(
|
|
136
|
+
if (!doesRefContainEventTarget(ref, event) && !disableCloseOnClickOutside) {
|
|
113
137
|
onClose();
|
|
114
138
|
}
|
|
115
139
|
};
|
|
@@ -145,75 +169,99 @@ var Drawer = function Drawer(_ref3) {
|
|
|
145
169
|
});
|
|
146
170
|
}
|
|
147
171
|
};
|
|
148
|
-
}, [onClose, disableCloseOnClickOutside, closeTargets]);
|
|
149
|
-
|
|
150
|
-
|
|
172
|
+
}, [onClose, disableCloseOnClickOutside, closeTargets, ref]);
|
|
173
|
+
};
|
|
174
|
+
var Drawer = function Drawer(_ref5) {
|
|
175
|
+
var id = _ref5.id,
|
|
176
|
+
offset = _ref5.offset,
|
|
177
|
+
direction = _ref5.direction,
|
|
178
|
+
children = _ref5.children,
|
|
179
|
+
disableCloseOnClickOutside = _ref5.disableCloseOnClickOutside,
|
|
180
|
+
onClose = _ref5.onClose,
|
|
181
|
+
zIndex = _ref5.zIndex,
|
|
182
|
+
closeTargets = _ref5.closeTargets,
|
|
183
|
+
width = _ref5.width,
|
|
184
|
+
focusLockExemptCheck = _ref5.focusLockExemptCheck,
|
|
185
|
+
isOpen = _ref5.isOpen,
|
|
186
|
+
rest = _objectWithoutProperties(_ref5, _excluded3);
|
|
187
|
+
var ref = useRef(null);
|
|
188
|
+
useCloseOnBodyClick({
|
|
189
|
+
ref: ref,
|
|
190
|
+
disableCloseOnClickOutside: disableCloseOnClickOutside,
|
|
191
|
+
onClose: onClose,
|
|
192
|
+
closeTargets: closeTargets
|
|
193
|
+
});
|
|
194
|
+
var transition = useSlideTransition({
|
|
195
|
+
isVisible: isOpen,
|
|
196
|
+
width: width,
|
|
197
|
+
direction: direction
|
|
198
|
+
});
|
|
199
|
+
return /*#__PURE__*/_jsx(FocusLock, {
|
|
151
200
|
autoFocus: true,
|
|
152
201
|
returnFocus: true,
|
|
153
202
|
whiteList: focusLockExemptCheck ? function (e) {
|
|
154
203
|
return !focusLockExemptCheck(e);
|
|
155
|
-
} : undefined
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
204
|
+
} : undefined,
|
|
205
|
+
children: transition(function (style, isVisible) {
|
|
206
|
+
return isVisible ? /*#__PURE__*/_jsx(AnimatedDrawer, _objectSpread(_objectSpread({
|
|
207
|
+
ref: ref,
|
|
208
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
209
|
+
zIndex: zIndex
|
|
210
|
+
}),
|
|
211
|
+
width: width,
|
|
212
|
+
offset: offset,
|
|
213
|
+
direction: direction,
|
|
214
|
+
"data-qa-drawer": id,
|
|
215
|
+
role: "dialog"
|
|
216
|
+
}, rest), {}, {
|
|
217
|
+
children: children
|
|
218
|
+
})) : null;
|
|
219
|
+
})
|
|
220
|
+
}, id);
|
|
165
221
|
};
|
|
166
|
-
var DrawerContainer = function DrawerContainer(
|
|
167
|
-
var children =
|
|
168
|
-
closeButtonLabel =
|
|
169
|
-
|
|
170
|
-
direction =
|
|
171
|
-
|
|
172
|
-
disableCloseOnClickOutside =
|
|
173
|
-
id =
|
|
174
|
-
isOpen =
|
|
175
|
-
|
|
176
|
-
offset =
|
|
177
|
-
onClose =
|
|
178
|
-
|
|
179
|
-
zIndex =
|
|
180
|
-
|
|
181
|
-
closeTargets =
|
|
182
|
-
|
|
183
|
-
width =
|
|
184
|
-
rest = _objectWithoutProperties(
|
|
185
|
-
return /*#__PURE__*/
|
|
186
|
-
id: id
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
onClose: onClose,
|
|
210
|
-
zIndex: zIndex,
|
|
211
|
-
closeTargets: closeTargets,
|
|
212
|
-
width: width,
|
|
213
|
-
"data-qa-drawer": id || "",
|
|
214
|
-
"data-qa-drawer-isopen": isOpen === true
|
|
215
|
-
}, rest), children);
|
|
216
|
-
})));
|
|
222
|
+
var DrawerContainer = function DrawerContainer(_ref6) {
|
|
223
|
+
var children = _ref6.children,
|
|
224
|
+
closeButtonLabel = _ref6.closeButtonLabel,
|
|
225
|
+
_ref6$direction = _ref6.direction,
|
|
226
|
+
direction = _ref6$direction === void 0 ? "right" : _ref6$direction,
|
|
227
|
+
_ref6$disableCloseOnC = _ref6.disableCloseOnClickOutside,
|
|
228
|
+
disableCloseOnClickOutside = _ref6$disableCloseOnC === void 0 ? false : _ref6$disableCloseOnC,
|
|
229
|
+
id = _ref6.id,
|
|
230
|
+
isOpen = _ref6.isOpen,
|
|
231
|
+
_ref6$offset = _ref6.offset,
|
|
232
|
+
offset = _ref6$offset === void 0 ? 0 : _ref6$offset,
|
|
233
|
+
onClose = _ref6.onClose,
|
|
234
|
+
_ref6$zIndex = _ref6.zIndex,
|
|
235
|
+
zIndex = _ref6$zIndex === void 0 ? 7 : _ref6$zIndex,
|
|
236
|
+
_ref6$closeTargets = _ref6.closeTargets,
|
|
237
|
+
closeTargets = _ref6$closeTargets === void 0 ? [] : _ref6$closeTargets,
|
|
238
|
+
_ref6$width = _ref6.width,
|
|
239
|
+
width = _ref6$width === void 0 ? 600 : _ref6$width,
|
|
240
|
+
rest = _objectWithoutProperties(_ref6, _excluded4);
|
|
241
|
+
return /*#__PURE__*/_jsx(Portal, {
|
|
242
|
+
id: id,
|
|
243
|
+
children: /*#__PURE__*/_jsx(DrawerContext.Provider, {
|
|
244
|
+
value: {
|
|
245
|
+
onClose: onClose,
|
|
246
|
+
closeButtonLabel: closeButtonLabel
|
|
247
|
+
},
|
|
248
|
+
children: /*#__PURE__*/_jsx(Drawer, _objectSpread(_objectSpread({
|
|
249
|
+
isOpen: isOpen,
|
|
250
|
+
id: id,
|
|
251
|
+
offset: offset,
|
|
252
|
+
direction: direction,
|
|
253
|
+
disableCloseOnClickOutside: disableCloseOnClickOutside,
|
|
254
|
+
onClose: onClose,
|
|
255
|
+
zIndex: zIndex,
|
|
256
|
+
closeTargets: closeTargets,
|
|
257
|
+
width: width,
|
|
258
|
+
"data-qa-drawer": id || "",
|
|
259
|
+
"data-qa-drawer-isopen": isOpen
|
|
260
|
+
}, rest), {}, {
|
|
261
|
+
children: children
|
|
262
|
+
}))
|
|
263
|
+
})
|
|
264
|
+
});
|
|
217
265
|
};
|
|
218
266
|
DrawerHeader.displayName = "Drawer.Header";
|
|
219
267
|
DrawerContent.displayName = "Drawer.Content";
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
2
|
var _excluded = ["media", "headline", "subtext", "primaryAction", "secondaryAction"];
|
|
2
|
-
function
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3
8
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
10
|
import * as React from "react";
|
|
6
11
|
import Box from "../Box";
|
|
7
12
|
// eslint-disable-next-line import/no-deprecated
|
|
8
13
|
import Text from "../Text";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
16
|
var EmptyState = function EmptyState(_ref) {
|
|
10
17
|
var media = _ref.media,
|
|
11
18
|
headline = _ref.headline,
|
|
@@ -13,38 +20,46 @@ var EmptyState = function EmptyState(_ref) {
|
|
|
13
20
|
primaryAction = _ref.primaryAction,
|
|
14
21
|
secondaryAction = _ref.secondaryAction,
|
|
15
22
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
-
return /*#__PURE__*/
|
|
23
|
+
return /*#__PURE__*/_jsxs(Box, _objectSpread(_objectSpread({
|
|
17
24
|
maxWidth: "400px",
|
|
18
25
|
mx: "auto",
|
|
19
26
|
"data-qa-emptystate": headline
|
|
20
|
-
}, rest),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
}, rest), {}, {
|
|
28
|
+
children: [media && /*#__PURE__*/_jsx(Box, {
|
|
29
|
+
display: "flex",
|
|
30
|
+
flexDirection: "column",
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
mb: 450,
|
|
33
|
+
children: media
|
|
34
|
+
}), /*#__PURE__*/_jsxs(Text, {
|
|
35
|
+
as: "div",
|
|
36
|
+
textAlign: "center",
|
|
37
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
38
|
+
as: "p",
|
|
39
|
+
m: 0,
|
|
40
|
+
color: "text.headline",
|
|
41
|
+
fontWeight: "semibold",
|
|
42
|
+
fontSize: 400,
|
|
43
|
+
children: headline
|
|
44
|
+
}), subtext && /*#__PURE__*/_jsx(Text, {
|
|
45
|
+
as: "p",
|
|
46
|
+
color: "text.subtext",
|
|
47
|
+
fontSize: 200,
|
|
48
|
+
mb: 0,
|
|
49
|
+
mt: 400,
|
|
50
|
+
children: subtext
|
|
51
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
52
|
+
mt: primaryAction || secondaryAction ? 450 : 0,
|
|
53
|
+
children: [primaryAction && /*#__PURE__*/React.cloneElement(primaryAction, {
|
|
54
|
+
appearance: "primary"
|
|
55
|
+
}), secondaryAction && /*#__PURE__*/_jsx(Box, {
|
|
56
|
+
mt: 400,
|
|
57
|
+
children: /*#__PURE__*/React.cloneElement(secondaryAction, {
|
|
58
|
+
appearance: "unstyled"
|
|
59
|
+
})
|
|
60
|
+
})]
|
|
61
|
+
})]
|
|
62
|
+
})]
|
|
63
|
+
}));
|
|
49
64
|
};
|
|
50
65
|
export default EmptyState;
|
package/lib/Fieldset/Fieldset.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
2
|
var _excluded = ["layout", "label", "helperText", "children"],
|
|
2
3
|
_excluded2 = ["children"],
|
|
3
4
|
_excluded3 = ["children"];
|
|
4
|
-
function
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
10
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
12
|
import * as React from "react";
|
|
@@ -9,6 +14,8 @@ import Box from "../Box";
|
|
|
9
14
|
// eslint-disable-next-line import/no-deprecated
|
|
10
15
|
import Text from "../Text";
|
|
11
16
|
import { ChildContainer } from "./styles";
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
19
|
/**
|
|
13
20
|
* Fieldset Component
|
|
14
21
|
*/
|
|
@@ -19,39 +26,51 @@ var Fieldset = function Fieldset(_ref) {
|
|
|
19
26
|
helperText = _ref.helperText,
|
|
20
27
|
children = _ref.children,
|
|
21
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
-
return /*#__PURE__*/
|
|
29
|
+
return /*#__PURE__*/_jsxs(Box, _objectSpread(_objectSpread({
|
|
23
30
|
as: "fieldset",
|
|
24
31
|
border: "none",
|
|
25
32
|
p: 0,
|
|
26
33
|
"data-qa-fieldset": ""
|
|
27
|
-
}, rest),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
}, rest), {}, {
|
|
35
|
+
children: [typeof label === "string" ? /*#__PURE__*/_jsx(Fieldset.Legend, {
|
|
36
|
+
children: label
|
|
37
|
+
}) : label, typeof helperText === "string" ? /*#__PURE__*/_jsx(Fieldset.HelperText, {
|
|
38
|
+
children: helperText
|
|
39
|
+
}) : helperText, /*#__PURE__*/_jsx(Box, {
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexDirection: layout === "vertical" ? "column" : "row",
|
|
42
|
+
children: React.Children.map(children, function (child) {
|
|
43
|
+
return /*#__PURE__*/_jsx(ChildContainer, {
|
|
44
|
+
layout: layout,
|
|
45
|
+
children: child
|
|
46
|
+
});
|
|
47
|
+
})
|
|
48
|
+
})]
|
|
49
|
+
}));
|
|
35
50
|
};
|
|
36
51
|
var FieldsetLegend = function FieldsetLegend(_ref2) {
|
|
37
52
|
var children = _ref2.children,
|
|
38
53
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
39
|
-
return /*#__PURE__*/
|
|
54
|
+
return /*#__PURE__*/_jsx(Text, _objectSpread(_objectSpread({
|
|
40
55
|
as: "legend",
|
|
41
56
|
fontSize: 300,
|
|
42
57
|
fontWeight: "semibold",
|
|
43
58
|
color: "text.body",
|
|
44
59
|
mb: 300
|
|
45
|
-
}, rest),
|
|
60
|
+
}, rest), {}, {
|
|
61
|
+
children: children
|
|
62
|
+
}));
|
|
46
63
|
};
|
|
47
64
|
var FieldsetHelperText = function FieldsetHelperText(_ref3) {
|
|
48
65
|
var children = _ref3.children,
|
|
49
66
|
rest = _objectWithoutProperties(_ref3, _excluded3);
|
|
50
|
-
return /*#__PURE__*/
|
|
67
|
+
return /*#__PURE__*/_jsx(Text, _objectSpread(_objectSpread({
|
|
51
68
|
as: "p",
|
|
52
69
|
fontSize: 200,
|
|
53
70
|
mb: 300
|
|
54
|
-
}, rest),
|
|
71
|
+
}, rest), {}, {
|
|
72
|
+
children: children
|
|
73
|
+
}));
|
|
55
74
|
};
|
|
56
75
|
FieldsetLegend.displayName = "Fieldset.Legend";
|
|
57
76
|
FieldsetHelperText.displayName = "Fieldset.HelperText";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["children", "error", "helperText", "id", "isInvalid", "label", "mb", "qa", "isLabelHidden", "required"];
|
|
3
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -20,6 +19,8 @@ import Box from "../Box";
|
|
|
20
19
|
import Label from "../Label";
|
|
21
20
|
import Text from "../Text";
|
|
22
21
|
import { VisuallyHidden } from "../VisuallyHidden";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
24
|
var idCounter = 0;
|
|
24
25
|
var FormField = function FormField(_ref) {
|
|
25
26
|
var children = _ref.children,
|
|
@@ -42,37 +43,43 @@ var FormField = function FormField(_ref) {
|
|
|
42
43
|
var errorId = "Error-".concat(id);
|
|
43
44
|
var containerText = useTextContent("");
|
|
44
45
|
var errorContainerText = useTextContent("");
|
|
45
|
-
return /*#__PURE__*/
|
|
46
|
+
return /*#__PURE__*/_jsxs(Box, _objectSpread(_objectSpread(_objectSpread({}, rest), qa), {}, {
|
|
46
47
|
mb: mb,
|
|
47
48
|
"data-qa-formfield": qa && qa["data-qa-formfield"] || id || containerText.current,
|
|
48
|
-
"data-qa-formfield-isinvalid": isInvalid === true
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
49
|
+
"data-qa-formfield-isinvalid": isInvalid === true,
|
|
50
|
+
children: [isLabelHidden ? /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
51
|
+
"data-testid": "visually-hidden",
|
|
52
|
+
children: /*#__PURE__*/_jsx(Label, {
|
|
53
|
+
htmlFor: id,
|
|
54
|
+
required: required,
|
|
55
|
+
children: label
|
|
56
|
+
})
|
|
57
|
+
}) : /*#__PURE__*/_jsx(Label, {
|
|
58
|
+
mb: helperText ? 100 : 300,
|
|
59
|
+
htmlFor: id,
|
|
60
|
+
required: required,
|
|
61
|
+
children: label
|
|
62
|
+
}), helperText && /*#__PURE__*/_jsx(Text, {
|
|
63
|
+
as: "p",
|
|
64
|
+
fontSize: 200,
|
|
65
|
+
mb: 300,
|
|
66
|
+
color: "text.subtext",
|
|
67
|
+
children: helperText
|
|
68
|
+
}), children(_objectSpread({
|
|
69
|
+
id: id,
|
|
70
|
+
isInvalid: isInvalid,
|
|
71
|
+
ariaDescribedby: errorId
|
|
72
|
+
}, required !== undefined && {
|
|
73
|
+
required: required
|
|
74
|
+
})), isInvalid && error && /*#__PURE__*/_jsx(Text, {
|
|
75
|
+
as: "div",
|
|
76
|
+
fontSize: 200,
|
|
77
|
+
color: "text.error",
|
|
78
|
+
mt: 300,
|
|
79
|
+
id: errorId,
|
|
80
|
+
"data-qa-formfield-error": qa && qa["data-qa-formfield-error"] || errorContainerText.current,
|
|
81
|
+
children: error
|
|
82
|
+
})]
|
|
83
|
+
}));
|
|
77
84
|
};
|
|
78
85
|
export default FormField;
|