@sproutsocial/racine 22.5.1 → 23.0.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 +12 -0
- 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 +27 -11
- 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/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/Listbox/ListboxTypes.d.ts +1 -1
- package/dist/types/Listbox/ListboxTypes.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/ThemeProvider/index.d.ts +1 -1
- package/dist/types/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/Toast/Toast.d.ts +23 -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 +11 -15
- package/dist/types/Toast/styles.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/utils/react-testing-library.d.ts +61 -121
- package/dist/types/utils/react-testing-library.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 +30 -11
- 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 +37 -33
- 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
|
@@ -1,5 +1,10 @@
|
|
|
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 = ["isLoading", "disabled", "loaderLabel", "children", "appearance"];
|
|
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";
|
|
@@ -7,6 +12,8 @@ import styled from "styled-components";
|
|
|
7
12
|
import Box from "../Box";
|
|
8
13
|
import Button from "../Button";
|
|
9
14
|
import Loader from "../Loader";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
17
|
var StyledLoaderButton = styled(Button).withConfig({
|
|
11
18
|
displayName: "LoaderButton__StyledLoaderButton",
|
|
12
19
|
componentId: "sc-taipe0-0"
|
|
@@ -33,25 +40,30 @@ export var LoaderButton = function LoaderButton(_ref3) {
|
|
|
33
40
|
_ref3$appearance = _ref3.appearance,
|
|
34
41
|
appearance = _ref3$appearance === void 0 ? "unstyled" : _ref3$appearance,
|
|
35
42
|
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
36
|
-
return /*#__PURE__*/
|
|
43
|
+
return /*#__PURE__*/_jsx(StyledLoaderButton, _objectSpread(_objectSpread({
|
|
37
44
|
disabled: disabled || isLoading,
|
|
38
45
|
appearance: appearance,
|
|
39
46
|
"data-qa-button-isloading": isLoading === true
|
|
40
|
-
}, rest),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
}, rest), {}, {
|
|
48
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
49
|
+
position: "relative",
|
|
50
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
51
|
+
opacity: isLoading ? 0 : 1,
|
|
52
|
+
"aria-hidden": isLoading,
|
|
53
|
+
children: children
|
|
54
|
+
}), isLoading && /*#__PURE__*/_jsx(Box, {
|
|
55
|
+
position: "absolute",
|
|
56
|
+
top: -2,
|
|
57
|
+
left: 0,
|
|
58
|
+
right: 0,
|
|
59
|
+
bottom: 0,
|
|
60
|
+
children: /*#__PURE__*/_jsx(Loader, {
|
|
61
|
+
text: loaderLabel,
|
|
62
|
+
size: "small",
|
|
63
|
+
delay: false
|
|
64
|
+
})
|
|
65
|
+
})]
|
|
66
|
+
})
|
|
67
|
+
}));
|
|
56
68
|
};
|
|
57
69
|
export default LoaderButton;
|
package/lib/Menu/Menu.js
CHANGED
|
@@ -12,7 +12,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
12
12
|
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; }
|
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
14
|
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); }
|
|
15
|
-
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); }
|
|
16
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
16
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
17
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -33,7 +32,7 @@ import Button from "../Button";
|
|
|
33
32
|
import Checkbox from "@sproutsocial/seeds-react-checkbox";
|
|
34
33
|
import Icon from "../Icon";
|
|
35
34
|
import Input from "../Input";
|
|
36
|
-
import Popout from "
|
|
35
|
+
import Popout from "@sproutsocial/seeds-react-popout";
|
|
37
36
|
import Radio from "../Radio";
|
|
38
37
|
import Switch from "../Switch";
|
|
39
38
|
import Text from "../Text";
|
|
@@ -41,6 +40,9 @@ import { MENU_ITEM_ROLES, MENU_ROLES, DescendantProvider, useDescendant, useDesc
|
|
|
41
40
|
import { MenuItemContainer, MenuItemsContainer } from "./styles";
|
|
42
41
|
|
|
43
42
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
43
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
44
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
45
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
44
46
|
var noop = function noop() {};
|
|
45
47
|
var getMenuItemRole = function getMenuItemRole(menuRole) {
|
|
46
48
|
switch (menuRole) {
|
|
@@ -161,7 +163,7 @@ export var MenuItem = function MenuItem(_ref) {
|
|
|
161
163
|
var before = useMemo(function () {
|
|
162
164
|
if (elemBefore) return elemBefore;
|
|
163
165
|
if (itemRole === MENU_ITEM_ROLES.CHECKBOX) {
|
|
164
|
-
return /*#__PURE__*/
|
|
166
|
+
return /*#__PURE__*/_jsx(Checkbox, {
|
|
165
167
|
id: "Checkbox-".concat(id),
|
|
166
168
|
checked: isSelected,
|
|
167
169
|
"aria-hidden": "true",
|
|
@@ -170,7 +172,7 @@ export var MenuItem = function MenuItem(_ref) {
|
|
|
170
172
|
mr: 300
|
|
171
173
|
});
|
|
172
174
|
} else if (itemRole === MENU_ITEM_ROLES.RADIO) {
|
|
173
|
-
return /*#__PURE__*/
|
|
175
|
+
return /*#__PURE__*/_jsx(Radio, {
|
|
174
176
|
id: "Radio-".concat(id),
|
|
175
177
|
name: "Radio-".concat(id),
|
|
176
178
|
checked: isSelected,
|
|
@@ -183,7 +185,7 @@ export var MenuItem = function MenuItem(_ref) {
|
|
|
183
185
|
var after = useMemo(function () {
|
|
184
186
|
if (elemAfter) return elemAfter;
|
|
185
187
|
if (isSelected && !isCheckboxOrRadio) {
|
|
186
|
-
return /*#__PURE__*/
|
|
188
|
+
return /*#__PURE__*/_jsx(Icon, {
|
|
187
189
|
name: "check-solid",
|
|
188
190
|
"aria-hidden": true,
|
|
189
191
|
size: "small",
|
|
@@ -191,9 +193,9 @@ export var MenuItem = function MenuItem(_ref) {
|
|
|
191
193
|
});
|
|
192
194
|
}
|
|
193
195
|
}, [elemAfter, isCheckboxOrRadio, isSelected]);
|
|
194
|
-
return /*#__PURE__*/
|
|
196
|
+
return /*#__PURE__*/_jsx(MenuItemContainer, _objectSpread(_objectSpread({
|
|
195
197
|
"data-qa-menu-item": label
|
|
196
|
-
}, props, {
|
|
198
|
+
}, props), {}, {
|
|
197
199
|
active: isActive,
|
|
198
200
|
"data-qa-is-active": isActive,
|
|
199
201
|
id: id,
|
|
@@ -215,33 +217,36 @@ export var MenuItem = function MenuItem(_ref) {
|
|
|
215
217
|
onClick: !disabled ? handleClick : undefined,
|
|
216
218
|
role: itemRole,
|
|
217
219
|
selected: isSelected,
|
|
218
|
-
tabIndex: itemRole !== MENU_ITEM_ROLES.LISTITEM && !disabled ? -1 : undefined
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
220
|
+
tabIndex: itemRole !== MENU_ITEM_ROLES.LISTITEM && !disabled ? -1 : undefined,
|
|
221
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
222
|
+
ref: ref,
|
|
223
|
+
style: {
|
|
224
|
+
display: "flex",
|
|
225
|
+
alignItems: props.alignItems || "center",
|
|
226
|
+
justifyContent: "space-between"
|
|
227
|
+
},
|
|
228
|
+
children: [before, /*#__PURE__*/_jsx("div", {
|
|
229
|
+
style: {
|
|
230
|
+
flexGrow: 1,
|
|
231
|
+
wordBreak: "break-word",
|
|
232
|
+
minWidth: 0
|
|
233
|
+
}
|
|
234
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
235
|
+
//@ts-ignore some legacy ref type mismatch between divs
|
|
236
|
+
,
|
|
237
|
+
ref: textContent,
|
|
238
|
+
children: children
|
|
239
|
+
}), after]
|
|
240
|
+
})
|
|
241
|
+
}));
|
|
237
242
|
};
|
|
238
243
|
export var MenuCheckbox = function MenuCheckbox(props) {
|
|
239
|
-
return /*#__PURE__*/
|
|
244
|
+
return /*#__PURE__*/_jsx(MenuItem, _objectSpread({
|
|
240
245
|
role: MENU_ITEM_ROLES.CHECKBOX
|
|
241
246
|
}, props));
|
|
242
247
|
};
|
|
243
248
|
export var MenuRadio = function MenuRadio(props) {
|
|
244
|
-
return /*#__PURE__*/
|
|
249
|
+
return /*#__PURE__*/_jsx(MenuItem, _objectSpread({
|
|
245
250
|
role: MENU_ITEM_ROLES.RADIO
|
|
246
251
|
}, props));
|
|
247
252
|
};
|
|
@@ -261,7 +266,7 @@ export var MenuSwitch = function MenuSwitch(props) {
|
|
|
261
266
|
return id || uniqueId("MenuItem-");
|
|
262
267
|
}, [id]);
|
|
263
268
|
var labelId = "".concat(menuItemId, "-label");
|
|
264
|
-
var switchElement = /*#__PURE__*/
|
|
269
|
+
var switchElement = /*#__PURE__*/_jsx(Switch, _objectSpread(_objectSpread(_objectSpread({
|
|
265
270
|
id: "".concat(menuItemId, "-switch"),
|
|
266
271
|
checked: props.selected || isValueSelected(menuValue, props.value),
|
|
267
272
|
"aria-hidden": "true",
|
|
@@ -271,7 +276,7 @@ export var MenuSwitch = function MenuSwitch(props) {
|
|
|
271
276
|
mr: 300
|
|
272
277
|
} : {
|
|
273
278
|
ml: 300
|
|
274
|
-
}, switchProps, {
|
|
279
|
+
}), switchProps), {}, {
|
|
275
280
|
// This prop is passed after switchProps to disallow overrides.
|
|
276
281
|
onClick: noop
|
|
277
282
|
}));
|
|
@@ -280,15 +285,17 @@ export var MenuSwitch = function MenuSwitch(props) {
|
|
|
280
285
|
label: label,
|
|
281
286
|
elemBefore: placement === "before" ? switchElement : undefined,
|
|
282
287
|
// Empty fragment prevents a check icon in elemAfter when the switch is checked. Can be overridden.
|
|
283
|
-
elemAfter: placement === "before" ? /*#__PURE__*/
|
|
288
|
+
elemAfter: placement === "before" ? /*#__PURE__*/_jsx(_Fragment, {}) : switchElement
|
|
284
289
|
}, rest);
|
|
285
|
-
return /*#__PURE__*/
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
return /*#__PURE__*/_jsx(MenuItem, _objectSpread(_objectSpread({}, menuItemProps), {}, {
|
|
291
|
+
children: /*#__PURE__*/_jsx(Text, _objectSpread(_objectSpread({
|
|
292
|
+
id: labelId
|
|
293
|
+
}, labelProps), {}, {
|
|
294
|
+
// This prop is passed after labelProps to disallow overrides.
|
|
295
|
+
// Fall back to the label prop if children is falsy.
|
|
296
|
+
children: children || label
|
|
297
|
+
}))
|
|
298
|
+
}));
|
|
292
299
|
};
|
|
293
300
|
var MenuTitle = styled(Text).withConfig({
|
|
294
301
|
displayName: "Menu__MenuTitle",
|
|
@@ -322,22 +329,27 @@ export var MenuGroup = function MenuGroup(_ref6) {
|
|
|
322
329
|
var menuTitleId = useMemo(function () {
|
|
323
330
|
return uniqueId("menu-title-");
|
|
324
331
|
}, []);
|
|
325
|
-
return /*#__PURE__*/
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
332
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
333
|
+
children: /*#__PURE__*/_jsxs(Box, _objectSpread(_objectSpread({
|
|
334
|
+
p: 300,
|
|
335
|
+
role: "group",
|
|
336
|
+
"aria-labelledby": title ? menuTitleId : undefined,
|
|
337
|
+
borderTop: "1px solid",
|
|
338
|
+
borderColor: "container.border.base"
|
|
339
|
+
}, props), {}, {
|
|
340
|
+
children: [title && /*#__PURE__*/_jsx(_StyledMenuTitle, {
|
|
341
|
+
id: menuTitleId,
|
|
342
|
+
role: "presentation",
|
|
343
|
+
fontSize: 200,
|
|
344
|
+
forwardedAs: titleAs || "li",
|
|
345
|
+
$_css: isDisabled ? disabled : undefined,
|
|
346
|
+
children: title
|
|
347
|
+
}), children]
|
|
348
|
+
}))
|
|
349
|
+
});
|
|
338
350
|
};
|
|
339
351
|
export var MenuDivider = function MenuDivider(props) {
|
|
340
|
-
return /*#__PURE__*/
|
|
352
|
+
return /*#__PURE__*/_jsx(Box, _objectSpread({
|
|
341
353
|
as: "li",
|
|
342
354
|
role: "separator",
|
|
343
355
|
borderTop: "1px solid",
|
|
@@ -372,7 +384,7 @@ var MenuFilterInput = function MenuFilterInput(_ref7) {
|
|
|
372
384
|
isFilterInputFocused: false
|
|
373
385
|
});
|
|
374
386
|
}, [setState, onBlur]);
|
|
375
|
-
return /*#__PURE__*/
|
|
387
|
+
return /*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({}, props), {}, {
|
|
376
388
|
type: type,
|
|
377
389
|
value: state.filterQuery,
|
|
378
390
|
onChange: handleOnChange,
|
|
@@ -389,7 +401,7 @@ var MenuItems = function MenuItems(_ref8) {
|
|
|
389
401
|
var _useMenuKeyDown = useMenuKeyDown(),
|
|
390
402
|
handleKeyDown = _useMenuKeyDown.handleKeyDown,
|
|
391
403
|
activeDescendent = _useMenuKeyDown.activeDescendent;
|
|
392
|
-
return /*#__PURE__*/
|
|
404
|
+
return /*#__PURE__*/_jsx(MenuItemsContainer, _objectSpread(_objectSpread({}, props), {}, {
|
|
393
405
|
forwardedAs: "ul",
|
|
394
406
|
ref: innerRef,
|
|
395
407
|
role: role
|
|
@@ -402,8 +414,9 @@ var MenuItems = function MenuItems(_ref8) {
|
|
|
402
414
|
onKeyDown: handleKeyDown,
|
|
403
415
|
margin: 0,
|
|
404
416
|
padding: 0,
|
|
405
|
-
overflow: "hidden"
|
|
406
|
-
|
|
417
|
+
overflow: "hidden",
|
|
418
|
+
children: children
|
|
419
|
+
}));
|
|
407
420
|
};
|
|
408
421
|
var MenuFooter = function MenuFooter(_ref9) {
|
|
409
422
|
var children = _ref9.children;
|
|
@@ -419,10 +432,11 @@ var MenuFooter = function MenuFooter(_ref9) {
|
|
|
419
432
|
isFooterFocused: true
|
|
420
433
|
});
|
|
421
434
|
}, [setState]);
|
|
422
|
-
return /*#__PURE__*/
|
|
435
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
423
436
|
onBlur: handleOnBlur,
|
|
424
|
-
onFocus: handleOnFocus
|
|
425
|
-
|
|
437
|
+
onFocus: handleOnFocus,
|
|
438
|
+
children: children
|
|
439
|
+
});
|
|
426
440
|
};
|
|
427
441
|
export var Menu = function Menu(_ref10) {
|
|
428
442
|
var _ref10$role = _ref10.role,
|
|
@@ -453,28 +467,33 @@ export var Menu = function Menu(_ref10) {
|
|
|
453
467
|
var setContextState = useCallback(function (newState) {
|
|
454
468
|
setState(_objectSpread(_objectSpread({}, state), newState));
|
|
455
469
|
}, [state]);
|
|
456
|
-
return /*#__PURE__*/
|
|
470
|
+
return /*#__PURE__*/_jsx(DescendantProvider, {
|
|
457
471
|
context: MenuDescendantContext,
|
|
458
472
|
items: descendants,
|
|
459
|
-
set: setDescendants
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
473
|
+
set: setDescendants,
|
|
474
|
+
children: /*#__PURE__*/_jsxs(MenuContext.Provider, {
|
|
475
|
+
value: {
|
|
476
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
477
|
+
// @ts-ignore
|
|
478
|
+
menuRef: innerRef || menuRef,
|
|
479
|
+
role: role,
|
|
480
|
+
onChange: onChange,
|
|
481
|
+
value: value,
|
|
482
|
+
multiselect: multiselect,
|
|
483
|
+
state: state,
|
|
484
|
+
setState: setContextState,
|
|
485
|
+
selectCallbacks: selectCallbacks
|
|
486
|
+
},
|
|
487
|
+
children: [/*#__PURE__*/_jsx(MenuItems, _objectSpread(_objectSpread({}, props), {}, {
|
|
488
|
+
role: role,
|
|
489
|
+
multiselect: multiselect,
|
|
490
|
+
innerRef: menuRef,
|
|
491
|
+
children: children
|
|
492
|
+
})), footerContent ? /*#__PURE__*/_jsx(MenuFooter, {
|
|
493
|
+
children: footerContent
|
|
494
|
+
}) : null]
|
|
495
|
+
})
|
|
496
|
+
});
|
|
478
497
|
};
|
|
479
498
|
MenuGroup.displayName = "Menu.Group";
|
|
480
499
|
MenuItem.displayName = "Menu.Item";
|
|
@@ -525,34 +544,39 @@ export var MenuButton = function MenuButton(_ref11) {
|
|
|
525
544
|
}, [setIsShown]);
|
|
526
545
|
var ariaLabelledBy = props["aria-labelledby"] ? "".concat(props["aria-labelledby"], " ").concat(id) : undefined;
|
|
527
546
|
var ariaLabel = props["aria-label"] ? "".concat(props["aria-label"], " ").concat(innerText(children)) : undefined;
|
|
528
|
-
return /*#__PURE__*/
|
|
547
|
+
return /*#__PURE__*/_jsx(MenuButtonContext.Provider, {
|
|
529
548
|
value: {
|
|
530
549
|
closePopout: closePopout,
|
|
531
550
|
closeOnItemClick: closeOnItemClick
|
|
532
|
-
}
|
|
533
|
-
}, /*#__PURE__*/React.createElement(Popout, _extends({
|
|
534
|
-
isOpen: isShown,
|
|
535
|
-
setIsOpen: setIsShown,
|
|
536
|
-
content: /*#__PURE__*/React.createElement(CustomPopoutContent, null, content),
|
|
537
|
-
placement: placement
|
|
538
|
-
}, popoutProps, {
|
|
539
|
-
width: props.width
|
|
540
|
-
}), /*#__PURE__*/React.createElement(Button, _extends({}, props, {
|
|
541
|
-
id: id,
|
|
542
|
-
"aria-labelledby": ariaLabelledBy === null || ariaLabelledBy === void 0 ? void 0 : ariaLabelledBy.trim(),
|
|
543
|
-
"aria-label": ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.trim(),
|
|
544
|
-
active: isShown,
|
|
545
|
-
onKeyDown: function onKeyDown(e) {
|
|
546
|
-
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
547
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
548
|
-
_onClick && _onClick(e); // @ts-notes unfortunately we're passing in a keyboard event here and not the mouse event it expects, so no way to coerce it
|
|
549
|
-
setIsShown(true);
|
|
550
|
-
}
|
|
551
551
|
},
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
setIsShown
|
|
555
|
-
|
|
556
|
-
|
|
552
|
+
children: /*#__PURE__*/_jsx(Popout, _objectSpread(_objectSpread({
|
|
553
|
+
isOpen: isShown,
|
|
554
|
+
setIsOpen: setIsShown,
|
|
555
|
+
content: /*#__PURE__*/_jsx(CustomPopoutContent, {
|
|
556
|
+
children: content
|
|
557
|
+
}),
|
|
558
|
+
placement: placement
|
|
559
|
+
}, popoutProps), {}, {
|
|
560
|
+
width: props.width,
|
|
561
|
+
children: /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
562
|
+
id: id,
|
|
563
|
+
"aria-labelledby": ariaLabelledBy === null || ariaLabelledBy === void 0 ? void 0 : ariaLabelledBy.trim(),
|
|
564
|
+
"aria-label": ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.trim(),
|
|
565
|
+
active: isShown,
|
|
566
|
+
onKeyDown: function onKeyDown(e) {
|
|
567
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
568
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
569
|
+
_onClick && _onClick(e); // @ts-notes unfortunately we're passing in a keyboard event here and not the mouse event it expects, so no way to coerce it
|
|
570
|
+
setIsShown(true);
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
onClick: function onClick(e) {
|
|
574
|
+
_onClick && _onClick(e);
|
|
575
|
+
setIsShown(!isShown);
|
|
576
|
+
},
|
|
577
|
+
children: children
|
|
578
|
+
}))
|
|
579
|
+
}))
|
|
580
|
+
});
|
|
557
581
|
};
|
|
558
582
|
export default Menu;
|
|
@@ -27,7 +27,7 @@ import { createContext, useState, useLayoutEffect, useEffect, useContext, useCal
|
|
|
27
27
|
* pre-release and unstable, so instead of importing it, we copied it here and changed the types from TypeScript to
|
|
28
28
|
* Flow. If the package ever stabilizes, we can import these functions from there and remove this file.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
31
31
|
var noop = function noop() {};
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -229,9 +229,10 @@ export function DescendantProvider(_ref2) {
|
|
|
229
229
|
unregisterDescendant: unregisterDescendant
|
|
230
230
|
};
|
|
231
231
|
}, [items, registerDescendant, unregisterDescendant]);
|
|
232
|
-
return /*#__PURE__*/
|
|
233
|
-
value: value
|
|
234
|
-
|
|
232
|
+
return /*#__PURE__*/_jsx(Ctx.Provider, {
|
|
233
|
+
value: value,
|
|
234
|
+
children: children
|
|
235
|
+
});
|
|
235
236
|
}
|
|
236
237
|
export function useDescendantKeyDown(context, options) {
|
|
237
238
|
var _useContext2 = useContext(context),
|