@doist/reactist 22.0.0-beta → 22.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/dist/reactist.cjs.development.js +60 -517
- package/dist/reactist.cjs.development.js.map +1 -1
- package/dist/reactist.cjs.production.min.js +1 -1
- package/dist/reactist.cjs.production.min.js.map +1 -1
- package/es/index.js +1 -2
- package/es/index.js.map +1 -1
- package/es/menu/menu.js +56 -301
- package/es/menu/menu.js.map +1 -1
- package/es/text-area/text-area.module.css.js +1 -1
- package/es/toast/use-toasts.js +5 -3
- package/es/toast/use-toasts.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -1
- package/lib/menu/index.d.ts +2 -1
- package/lib/menu/menu.d.ts +23 -163
- package/lib/menu/menu.js +1 -1
- package/lib/menu/menu.js.map +1 -1
- package/lib/text-area/text-area.module.css.js +1 -1
- package/lib/toast/use-toasts.d.ts +5 -1
- package/lib/toast/use-toasts.js +1 -1
- package/lib/toast/use-toasts.js.map +1 -1
- package/package.json +1 -2
- package/styles/menu.css +1 -8
- package/styles/reactist.css +4 -5
- package/styles/text-area.css +1 -1
- package/styles/text-area.module.css.css +1 -1
- package/es/deprecated-modal/modal.js +0 -219
- package/es/deprecated-modal/modal.js.map +0 -1
- package/es/deprecated-modal/modal.module.css.js +0 -4
- package/es/deprecated-modal/modal.module.css.js.map +0 -1
- package/es/menu/menu.module.css.js +0 -4
- package/es/menu/menu.module.css.js.map +0 -1
- package/lib/deprecated-modal/index.d.ts +0 -1
- package/lib/deprecated-modal/modal.d.ts +0 -157
- package/lib/deprecated-modal/modal.js +0 -2
- package/lib/deprecated-modal/modal.js.map +0 -1
- package/lib/deprecated-modal/modal.module.css.js +0 -2
- package/lib/deprecated-modal/modal.module.css.js.map +0 -1
- package/lib/deprecated-modal/modal.test.d.ts +0 -1
- package/lib/menu/menu.module.css.js +0 -2
- package/lib/menu/menu.module.css.js.map +0 -1
- package/styles/menu.module.css.css +0 -1
|
@@ -20,7 +20,6 @@ var Ariakit = require('ariakit/menu');
|
|
|
20
20
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
21
21
|
var dayjs = _interopDefault(require('dayjs'));
|
|
22
22
|
var LocalizedFormat = _interopDefault(require('dayjs/plugin/localizedFormat'));
|
|
23
|
-
var dialog$1 = require('@reach/dialog');
|
|
24
23
|
|
|
25
24
|
function ownKeys(object, enumerableOnly) {
|
|
26
25
|
var keys = Object.keys(object);
|
|
@@ -1321,7 +1320,8 @@ function ToastsProvider({
|
|
|
1321
1320
|
defaultAutoDismissDelay = 10
|
|
1322
1321
|
/* seconds */
|
|
1323
1322
|
,
|
|
1324
|
-
defaultDismissLabel = 'Close'
|
|
1323
|
+
defaultDismissLabel = 'Close',
|
|
1324
|
+
containerClassName
|
|
1325
1325
|
}) {
|
|
1326
1326
|
const [toasts, setToasts] = React__default.useState([]);
|
|
1327
1327
|
const {
|
|
@@ -1355,11 +1355,12 @@ function ToastsProvider({
|
|
|
1355
1355
|
return /*#__PURE__*/React__default.createElement(ToastsContext.Provider, {
|
|
1356
1356
|
value: showToast
|
|
1357
1357
|
}, children, /*#__PURE__*/React__default.createElement(portal.Portal, null, toasts.length === 0 ? null : /*#__PURE__*/React__default.createElement(Box, {
|
|
1358
|
-
className: modules_d11e18f0.stackedToastsView,
|
|
1358
|
+
className: [modules_d11e18f0.stackedToastsView, containerClassName],
|
|
1359
1359
|
position: "fixed",
|
|
1360
1360
|
width: "full",
|
|
1361
1361
|
paddingX: padding,
|
|
1362
|
-
paddingBottom: padding
|
|
1362
|
+
paddingBottom: padding,
|
|
1363
|
+
"data-testid": "toasts-container"
|
|
1363
1364
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
1364
1365
|
space: "medium"
|
|
1365
1366
|
}, toasts.map(_ref => {
|
|
@@ -2044,7 +2045,7 @@ const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref
|
|
|
2044
2045
|
}, hint) : null);
|
|
2045
2046
|
});
|
|
2046
2047
|
|
|
2047
|
-
var modules_2728c236 = {"textAreaContainer":"
|
|
2048
|
+
var modules_2728c236 = {"textAreaContainer":"_29503131","innerContainer":"_6ea894ce","bordered":"e1e8b6a7","error":"_1b94ff46","autoExpand":"e82223c4"};
|
|
2048
2049
|
|
|
2049
2050
|
const _excluded$o = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "hidden", "aria-describedby", "rows", "autoExpand"];
|
|
2050
2051
|
const TextArea = /*#__PURE__*/React.forwardRef(function TextArea(_ref, ref) {
|
|
@@ -2647,18 +2648,12 @@ function TabAwareSlot({
|
|
|
2647
2648
|
}) : null;
|
|
2648
2649
|
}
|
|
2649
2650
|
|
|
2650
|
-
var modules_2befbba6 = {"menuList":"c63e79f3","subMenuList":"_1e89cfc6","iconMenuItem":"_1b808bea","menuItem":"_8607099d","legacyLayout":"_609759d5","menuGroupLabel":"f1730843","menuItemIcon":"_7cec7dce","menuItemLabel":"_91c012d8","menuItemDescription":"bb494fd4","destructive":"_503b074a","menuGroupInfo":"ad6d2e4a","iconsMenuGroup":"_410b11f2"};
|
|
2651
|
-
|
|
2652
2651
|
const _excluded$t = ["children", "onItemSelect"],
|
|
2653
2652
|
_excluded2$3 = ["exceptionallySetClassName"],
|
|
2654
|
-
_excluded3$2 = ["
|
|
2655
|
-
_excluded4$1 = ["
|
|
2656
|
-
_excluded5$1 = ["exceptionallySetClassName", "
|
|
2657
|
-
_excluded6 = ["
|
|
2658
|
-
_excluded7 = ["value", "label", "description", "icon", "shortcut", "tone", "children", "onSelect", "hideOnSelect", "onClick", "exceptionallySetClassName", "as"],
|
|
2659
|
-
_excluded8 = ["label", "info", "children", "exceptionallySetClassName"],
|
|
2660
|
-
_excluded9 = ["value", "label", "description", "icon", "onSelect", "hideOnSelect", "onClick", "exceptionallySetClassName", "as"],
|
|
2661
|
-
_excluded10 = ["children"];
|
|
2653
|
+
_excluded3$2 = ["as"],
|
|
2654
|
+
_excluded4$1 = ["exceptionallySetClassName", "modal"],
|
|
2655
|
+
_excluded5$1 = ["value", "children", "onSelect", "hideOnSelect", "onClick", "exceptionallySetClassName", "as"],
|
|
2656
|
+
_excluded6 = ["label", "children", "exceptionallySetClassName"];
|
|
2662
2657
|
const MenuContext = /*#__PURE__*/React.createContext( // Ariakit gives us no means to obtain a valid initial/default value of type MenuStateReturn
|
|
2663
2658
|
// (it is normally obtained by calling useMenuState but we can't call hooks outside components).
|
|
2664
2659
|
// This is however of little consequence since this value is only used if some of the components
|
|
@@ -2670,7 +2665,7 @@ const MenuContext = /*#__PURE__*/React.createContext( // Ariakit gives us no mea
|
|
|
2670
2665
|
* management for the menu components inside it.
|
|
2671
2666
|
*/
|
|
2672
2667
|
|
|
2673
|
-
|
|
2668
|
+
function Menu(_ref) {
|
|
2674
2669
|
let {
|
|
2675
2670
|
children,
|
|
2676
2671
|
onItemSelect
|
|
@@ -2690,9 +2685,6 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, ref) {
|
|
|
2690
2685
|
React.useEffect(() => {
|
|
2691
2686
|
if (!state.open) handleAnchorRectChange(null);
|
|
2692
2687
|
}, [state.open]);
|
|
2693
|
-
React.useImperativeHandle(ref, () => ({
|
|
2694
|
-
open: state.show
|
|
2695
|
-
}));
|
|
2696
2688
|
const handleItemSelect = React.useCallback(function handleItemSelect(value) {
|
|
2697
2689
|
if (onItemSelect) onItemSelect(value);
|
|
2698
2690
|
}, [onItemSelect]);
|
|
@@ -2704,11 +2696,12 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, ref) {
|
|
|
2704
2696
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
2705
2697
|
value: value
|
|
2706
2698
|
}, children);
|
|
2707
|
-
}
|
|
2699
|
+
}
|
|
2708
2700
|
/**
|
|
2709
2701
|
* A button to toggle a dropdown menu open or closed.
|
|
2710
2702
|
*/
|
|
2711
2703
|
|
|
2704
|
+
|
|
2712
2705
|
const MenuButton = /*#__PURE__*/polymorphicComponent(function MenuButton(_ref2, ref) {
|
|
2713
2706
|
let {
|
|
2714
2707
|
exceptionallySetClassName
|
|
@@ -2721,104 +2714,17 @@ const MenuButton = /*#__PURE__*/polymorphicComponent(function MenuButton(_ref2,
|
|
|
2721
2714
|
return /*#__PURE__*/React.createElement(Ariakit.MenuButton, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2722
2715
|
state: state,
|
|
2723
2716
|
ref: ref,
|
|
2724
|
-
className: exceptionallySetClassName
|
|
2725
|
-
}));
|
|
2726
|
-
});
|
|
2727
|
-
/**
|
|
2728
|
-
* Renders the content inside a standard MenuItem. It is extracted into a component for reuse in
|
|
2729
|
-
* the SubMenuItem, which is a MenuItem visually, but semantically it's closer to be a MenuButton.
|
|
2730
|
-
* @private
|
|
2731
|
-
*/
|
|
2732
|
-
|
|
2733
|
-
function MenuItemContent({
|
|
2734
|
-
label,
|
|
2735
|
-
description,
|
|
2736
|
-
icon,
|
|
2737
|
-
shortcut,
|
|
2738
|
-
id
|
|
2739
|
-
}) {
|
|
2740
|
-
if (!label) return null;
|
|
2741
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
2742
|
-
display: "flex",
|
|
2743
|
-
gap: "small",
|
|
2744
|
-
alignItems: "center",
|
|
2745
|
-
width: "full",
|
|
2746
|
-
"aria-hidden": true
|
|
2747
|
-
}, icon ? /*#__PURE__*/React.createElement("div", {
|
|
2748
|
-
className: modules_2befbba6.menuItemIcon
|
|
2749
|
-
}, icon) : null, /*#__PURE__*/React.createElement(Box, {
|
|
2750
|
-
display: "inlineFlex",
|
|
2751
|
-
flexDirection: "column",
|
|
2752
|
-
gap: "xsmall",
|
|
2753
|
-
paddingY: "xsmall",
|
|
2754
|
-
alignItems: "flexStart",
|
|
2755
|
-
overflow: "hidden",
|
|
2756
|
-
flexGrow: 1
|
|
2757
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
2758
|
-
id: id + "-label",
|
|
2759
|
-
weight: description ? 'semibold' : 'regular',
|
|
2760
|
-
size: "copy",
|
|
2761
|
-
lineClamp: 1,
|
|
2762
|
-
exceptionallySetClassName: modules_2befbba6.menuItemLabel
|
|
2763
|
-
}, label), description ? /*#__PURE__*/React.createElement(Text, {
|
|
2764
|
-
id: id + "-description",
|
|
2765
|
-
size: "copy",
|
|
2766
|
-
tone: "secondary",
|
|
2767
|
-
exceptionallySetClassName: modules_2befbba6.menuItemDescription
|
|
2768
|
-
}, description) : null), shortcut ? /*#__PURE__*/React.createElement("div", null, shortcut) : null);
|
|
2769
|
-
} //
|
|
2770
|
-
// SubMenuItem
|
|
2771
|
-
//
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
function ArrowRightIcon() {
|
|
2775
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
2776
|
-
width: "24",
|
|
2777
|
-
height: "24"
|
|
2778
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
2779
|
-
d: "M14.243 12L9.646 7.404a.5.5 0 1 1 .708-.707l4.95 4.95a.5.5 0 0 1 0 .707l-4.95 4.95a.5.5 0 0 1-.708-.708L14.243 12z",
|
|
2780
|
-
fill: "currentColor",
|
|
2781
|
-
fillRule: "evenodd"
|
|
2782
|
-
}));
|
|
2783
|
-
}
|
|
2784
|
-
/**
|
|
2785
|
-
* A menu item to toggle a sub-menu open or closed.
|
|
2786
|
-
*/
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
const SubMenuItem = /*#__PURE__*/polymorphicComponent(function SubMenuItem(_ref3, ref) {
|
|
2790
|
-
let {
|
|
2791
|
-
exceptionallySetClassName,
|
|
2792
|
-
label,
|
|
2793
|
-
icon
|
|
2794
|
-
} = _ref3,
|
|
2795
|
-
props = _objectWithoutProperties(_ref3, _excluded3$2);
|
|
2796
|
-
|
|
2797
|
-
const id = useId(props.id);
|
|
2798
|
-
const {
|
|
2799
|
-
state
|
|
2800
|
-
} = React.useContext(MenuContext);
|
|
2801
|
-
return /*#__PURE__*/React.createElement(Ariakit.MenuButton, _objectSpread2(_objectSpread2({
|
|
2802
|
-
"aria-labelledby": label && !props['aria-label'] ? id + "-label" : undefined
|
|
2803
|
-
}, props), {}, {
|
|
2804
|
-
state: state,
|
|
2805
|
-
ref: ref,
|
|
2806
|
-
className: classNames(modules_2befbba6.menuItem, exceptionallySetClassName)
|
|
2807
|
-
}), /*#__PURE__*/React.createElement(MenuItemContent, {
|
|
2808
|
-
id: id,
|
|
2809
|
-
icon: icon,
|
|
2810
|
-
label: label,
|
|
2811
|
-
shortcut: /*#__PURE__*/React.createElement(ArrowRightIcon, null)
|
|
2717
|
+
className: classNames('reactist_menubutton', exceptionallySetClassName)
|
|
2812
2718
|
}));
|
|
2813
2719
|
}); //
|
|
2814
2720
|
// ContextMenuTrigger
|
|
2815
2721
|
//
|
|
2816
2722
|
|
|
2817
|
-
const ContextMenuTrigger = /*#__PURE__*/polymorphicComponent(function ContextMenuTrigger(
|
|
2723
|
+
const ContextMenuTrigger = /*#__PURE__*/polymorphicComponent(function ContextMenuTrigger(_ref3, ref) {
|
|
2818
2724
|
let {
|
|
2819
2725
|
as: component = 'div'
|
|
2820
|
-
} =
|
|
2821
|
-
props = _objectWithoutProperties(
|
|
2726
|
+
} = _ref3,
|
|
2727
|
+
props = _objectWithoutProperties(_ref3, _excluded3$2);
|
|
2822
2728
|
|
|
2823
2729
|
const {
|
|
2824
2730
|
handleAnchorRectChange,
|
|
@@ -2841,59 +2747,42 @@ const ContextMenuTrigger = /*#__PURE__*/polymorphicComponent(function ContextMen
|
|
|
2841
2747
|
* The dropdown menu itself, containing a list of menu items.
|
|
2842
2748
|
*/
|
|
2843
2749
|
|
|
2844
|
-
const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(
|
|
2750
|
+
const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref4, ref) {
|
|
2845
2751
|
let {
|
|
2846
2752
|
exceptionallySetClassName,
|
|
2847
2753
|
modal = true
|
|
2848
|
-
} =
|
|
2849
|
-
props = _objectWithoutProperties(
|
|
2754
|
+
} = _ref4,
|
|
2755
|
+
props = _objectWithoutProperties(_ref4, _excluded4$1);
|
|
2850
2756
|
|
|
2851
2757
|
const {
|
|
2852
2758
|
state
|
|
2853
2759
|
} = React.useContext(MenuContext);
|
|
2854
|
-
|
|
2855
|
-
return /*#__PURE__*/React.createElement(portal.Portal, {
|
|
2760
|
+
return state.open ? /*#__PURE__*/React.createElement(portal.Portal, {
|
|
2856
2761
|
preserveTabOrder: true
|
|
2857
2762
|
}, /*#__PURE__*/React.createElement(Ariakit.Menu, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2858
2763
|
state: state,
|
|
2859
2764
|
ref: ref,
|
|
2860
|
-
className: classNames(
|
|
2765
|
+
className: classNames('reactist_menulist', exceptionallySetClassName),
|
|
2861
2766
|
modal: modal
|
|
2862
|
-
})));
|
|
2767
|
+
}))) : null;
|
|
2863
2768
|
});
|
|
2864
2769
|
/**
|
|
2865
|
-
*
|
|
2770
|
+
* A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`
|
|
2771
|
+
* callback.
|
|
2866
2772
|
*/
|
|
2867
2773
|
|
|
2868
|
-
const
|
|
2774
|
+
const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref5, ref) {
|
|
2869
2775
|
let {
|
|
2776
|
+
value,
|
|
2777
|
+
children,
|
|
2778
|
+
onSelect,
|
|
2779
|
+
hideOnSelect = true,
|
|
2780
|
+
onClick,
|
|
2870
2781
|
exceptionallySetClassName,
|
|
2871
|
-
|
|
2872
|
-
} =
|
|
2873
|
-
props = _objectWithoutProperties(
|
|
2874
|
-
|
|
2875
|
-
const {
|
|
2876
|
-
state
|
|
2877
|
-
} = React.useContext(MenuContext);
|
|
2878
|
-
if (!state.open) return null;
|
|
2879
|
-
return /*#__PURE__*/React.createElement(portal.Portal, {
|
|
2880
|
-
preserveTabOrder: true
|
|
2881
|
-
}, /*#__PURE__*/React.createElement(Ariakit.Menu, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2882
|
-
state: state,
|
|
2883
|
-
ref: ref,
|
|
2884
|
-
className: classNames(modules_2befbba6.menuList, modules_2befbba6.subMenuList, exceptionallySetClassName),
|
|
2885
|
-
modal: modal
|
|
2886
|
-
})));
|
|
2887
|
-
}); //
|
|
2888
|
-
// MenuItem
|
|
2889
|
-
//
|
|
2782
|
+
as = 'button'
|
|
2783
|
+
} = _ref5,
|
|
2784
|
+
props = _objectWithoutProperties(_ref5, _excluded5$1);
|
|
2890
2785
|
|
|
2891
|
-
function useMenuItemClickHandler({
|
|
2892
|
-
value,
|
|
2893
|
-
hideOnSelect,
|
|
2894
|
-
onClick,
|
|
2895
|
-
onSelect
|
|
2896
|
-
}) {
|
|
2897
2786
|
const {
|
|
2898
2787
|
handleItemSelect,
|
|
2899
2788
|
state
|
|
@@ -2901,95 +2790,42 @@ function useMenuItemClickHandler({
|
|
|
2901
2790
|
const {
|
|
2902
2791
|
hide
|
|
2903
2792
|
} = state;
|
|
2904
|
-
|
|
2793
|
+
const handleClick = React.useCallback(function handleClick(event) {
|
|
2905
2794
|
onClick == null ? void 0 : onClick(event);
|
|
2906
2795
|
const onSelectResult = onSelect && !event.defaultPrevented ? onSelect() : undefined;
|
|
2907
2796
|
const shouldClose = onSelectResult !== false && hideOnSelect;
|
|
2908
2797
|
handleItemSelect(value);
|
|
2909
2798
|
if (shouldClose) hide();
|
|
2910
2799
|
}, [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value]);
|
|
2911
|
-
}
|
|
2912
|
-
/**
|
|
2913
|
-
* A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`
|
|
2914
|
-
* callback.
|
|
2915
|
-
*/
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref7, ref) {
|
|
2919
|
-
let {
|
|
2920
|
-
value,
|
|
2921
|
-
label,
|
|
2922
|
-
description,
|
|
2923
|
-
icon,
|
|
2924
|
-
shortcut,
|
|
2925
|
-
tone,
|
|
2926
|
-
children,
|
|
2927
|
-
onSelect,
|
|
2928
|
-
hideOnSelect = true,
|
|
2929
|
-
onClick,
|
|
2930
|
-
exceptionallySetClassName,
|
|
2931
|
-
as = 'button'
|
|
2932
|
-
} = _ref7,
|
|
2933
|
-
props = _objectWithoutProperties(_ref7, _excluded7);
|
|
2934
|
-
|
|
2935
|
-
const id = useId(props.id);
|
|
2936
|
-
const {
|
|
2937
|
-
state
|
|
2938
|
-
} = React.useContext(MenuContext);
|
|
2939
|
-
const handleClick = useMenuItemClickHandler({
|
|
2940
|
-
value,
|
|
2941
|
-
onSelect,
|
|
2942
|
-
onClick,
|
|
2943
|
-
hideOnSelect
|
|
2944
|
-
});
|
|
2945
|
-
return /*#__PURE__*/React.createElement(Ariakit.MenuItem, _objectSpread2(_objectSpread2({
|
|
2946
|
-
"aria-labelledby": label && !props['aria-label'] ? id + "-label" : undefined,
|
|
2947
|
-
"aria-describedby": label && description ? id + "-description" : undefined
|
|
2948
|
-
}, props), {}, {
|
|
2800
|
+
return /*#__PURE__*/React.createElement(Ariakit.MenuItem, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2949
2801
|
as: as,
|
|
2950
2802
|
state: state,
|
|
2951
2803
|
ref: ref,
|
|
2952
2804
|
onClick: handleClick,
|
|
2953
|
-
className:
|
|
2805
|
+
className: exceptionallySetClassName,
|
|
2954
2806
|
hideOnClick: false
|
|
2955
|
-
}), children
|
|
2956
|
-
width: "full",
|
|
2957
|
-
className: label ? undefined : modules_2befbba6.legacyLayout
|
|
2958
|
-
}, children) : null, /*#__PURE__*/React.createElement(MenuItemContent, {
|
|
2959
|
-
id: id,
|
|
2960
|
-
icon: icon,
|
|
2961
|
-
label: label,
|
|
2962
|
-
description: description,
|
|
2963
|
-
shortcut: shortcut
|
|
2964
|
-
}));
|
|
2807
|
+
}), children);
|
|
2965
2808
|
});
|
|
2966
2809
|
/**
|
|
2967
|
-
* This component can be rendered alongside other `MenuItem`
|
|
2968
|
-
* sub-menu.
|
|
2810
|
+
* This component can be rendered alongside other `MenuItem` inside a `MenuList` in order to have
|
|
2811
|
+
* a sub-menu.
|
|
2969
2812
|
*
|
|
2970
|
-
* Its children are expected to
|
|
2971
|
-
*
|
|
2972
|
-
* 1. A `SubMenuItem` element: the menu item that triggers the sub-menu to open.
|
|
2973
|
-
* 2. A `SubMenuList` element: the list of menu items that will be shown when the sub-menu is open.
|
|
2974
|
-
*
|
|
2975
|
-
* ## Usage
|
|
2813
|
+
* Its children are expected to have the structure of a first level menu (a `MenuButton` and a
|
|
2814
|
+
* `MenuList`).
|
|
2976
2815
|
*
|
|
2977
2816
|
* ```jsx
|
|
2978
|
-
* <
|
|
2979
|
-
*
|
|
2817
|
+
* <MenuItem label="Edit profile" />
|
|
2818
|
+
* <SubMenu>
|
|
2819
|
+
* <MenuButton>More options</MenuButton>
|
|
2980
2820
|
* <MenuList>
|
|
2981
|
-
* <MenuItem label="
|
|
2982
|
-
* <MenuItem label="
|
|
2983
|
-
* <SubMenu>
|
|
2984
|
-
* <SubMenuItem label="Submenu" />
|
|
2985
|
-
* <SubMenuList>
|
|
2986
|
-
* <MenuItem label="Submenu Item 1" />
|
|
2987
|
-
* <MenuItem label="Submenu Item 2" />
|
|
2988
|
-
* </SubMenuList>
|
|
2989
|
-
* </SubMenu>
|
|
2821
|
+
* <MenuItem label="Preferences" />
|
|
2822
|
+
* <MenuItem label="Sign out" />
|
|
2990
2823
|
* </MenuList>
|
|
2991
|
-
* </
|
|
2824
|
+
* </SubMenu>
|
|
2992
2825
|
* ```
|
|
2826
|
+
*
|
|
2827
|
+
* The `MenuButton` will become a menu item in the current menu items list, and it will lead to
|
|
2828
|
+
* opening a sub-menu with the menu items list below it.
|
|
2993
2829
|
*/
|
|
2994
2830
|
|
|
2995
2831
|
const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
@@ -3021,9 +2857,7 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
|
3021
2857
|
state: state,
|
|
3022
2858
|
ref: ref,
|
|
3023
2859
|
hideOnClick: false
|
|
3024
|
-
}, renderMenuButton),
|
|
3025
|
-
className: modules_2befbba6.subMenuContainer
|
|
3026
|
-
}, list));
|
|
2860
|
+
}, renderMenuButton), list);
|
|
3027
2861
|
});
|
|
3028
2862
|
/**
|
|
3029
2863
|
* A way to semantically group some menu items.
|
|
@@ -3032,100 +2866,25 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
|
3032
2866
|
* before and/or after the group if you so wish.
|
|
3033
2867
|
*/
|
|
3034
2868
|
|
|
3035
|
-
const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(
|
|
2869
|
+
const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(_ref6, ref) {
|
|
3036
2870
|
let {
|
|
3037
2871
|
label,
|
|
3038
|
-
info,
|
|
3039
2872
|
children,
|
|
3040
2873
|
exceptionallySetClassName
|
|
3041
|
-
} =
|
|
3042
|
-
props = _objectWithoutProperties(
|
|
2874
|
+
} = _ref6,
|
|
2875
|
+
props = _objectWithoutProperties(_ref6, _excluded6);
|
|
3043
2876
|
|
|
3044
|
-
const id = useId(props.id);
|
|
3045
2877
|
const {
|
|
3046
2878
|
state
|
|
3047
2879
|
} = React.useContext(MenuContext);
|
|
3048
|
-
return /*#__PURE__*/React.createElement(Ariakit.MenuGroup, _objectSpread2(_objectSpread2({
|
|
3049
|
-
"aria-labelledby": "menugroup-label-" + id
|
|
3050
|
-
}, props), {}, {
|
|
3051
|
-
id: id,
|
|
2880
|
+
return /*#__PURE__*/React.createElement(Ariakit.MenuGroup, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3052
2881
|
ref: ref,
|
|
3053
2882
|
state: state,
|
|
3054
2883
|
className: exceptionallySetClassName
|
|
3055
|
-
}), /*#__PURE__*/React.createElement(
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
className: modules_2befbba6.menuGroupLabel
|
|
3060
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
3061
|
-
id: "menugroup-label-" + id,
|
|
3062
|
-
size: "copy",
|
|
3063
|
-
weight: "semibold"
|
|
3064
|
-
}, label), info ? /*#__PURE__*/React.createElement(Box, {
|
|
3065
|
-
flexShrink: 0,
|
|
3066
|
-
display: "flex",
|
|
3067
|
-
alignItems: "center",
|
|
3068
|
-
justifyContent: "center",
|
|
3069
|
-
className: modules_2befbba6.menuGroupInfo
|
|
3070
|
-
}, info) : null), children);
|
|
3071
|
-
});
|
|
3072
|
-
/**
|
|
3073
|
-
* A menu item that visually only shows as an icon. It must be used inside an `IconsMenuGroup`.
|
|
3074
|
-
*/
|
|
3075
|
-
|
|
3076
|
-
const IconMenuItem = /*#__PURE__*/polymorphicComponent(function IconMenuItem(_ref9, ref) {
|
|
3077
|
-
let {
|
|
3078
|
-
value,
|
|
3079
|
-
label,
|
|
3080
|
-
description,
|
|
3081
|
-
icon,
|
|
3082
|
-
onSelect,
|
|
3083
|
-
hideOnSelect = true,
|
|
3084
|
-
onClick,
|
|
3085
|
-
exceptionallySetClassName,
|
|
3086
|
-
as = 'button'
|
|
3087
|
-
} = _ref9,
|
|
3088
|
-
props = _objectWithoutProperties(_ref9, _excluded9);
|
|
3089
|
-
|
|
3090
|
-
const id = useId(props.id);
|
|
3091
|
-
const {
|
|
3092
|
-
state
|
|
3093
|
-
} = React.useContext(MenuContext);
|
|
3094
|
-
const handleClick = useMenuItemClickHandler({
|
|
3095
|
-
value,
|
|
3096
|
-
onSelect,
|
|
3097
|
-
onClick,
|
|
3098
|
-
hideOnSelect
|
|
3099
|
-
});
|
|
3100
|
-
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
3101
|
-
content: label
|
|
3102
|
-
}, /*#__PURE__*/React.createElement(Ariakit.MenuItem, _objectSpread2(_objectSpread2({
|
|
3103
|
-
"aria-label": label,
|
|
3104
|
-
"aria-describedby": id + "-description"
|
|
3105
|
-
}, props), {}, {
|
|
3106
|
-
as: as,
|
|
3107
|
-
state: state,
|
|
3108
|
-
ref: ref,
|
|
3109
|
-
onClick: handleClick,
|
|
3110
|
-
className: classNames(modules_2befbba6.iconMenuItem, exceptionallySetClassName),
|
|
3111
|
-
hideOnClick: false
|
|
3112
|
-
}), icon));
|
|
3113
|
-
});
|
|
3114
|
-
/**
|
|
3115
|
-
* Semantically equivalent to `MenuGroup`, but meant to group `IconMenuItem`s only.
|
|
3116
|
-
*/
|
|
3117
|
-
|
|
3118
|
-
const IconsMenuGroup = /*#__PURE__*/polymorphicComponent(function IconsMenuGroup(_ref10, ref) {
|
|
3119
|
-
let {
|
|
3120
|
-
children
|
|
3121
|
-
} = _ref10,
|
|
3122
|
-
props = _objectWithoutProperties(_ref10, _excluded10);
|
|
3123
|
-
|
|
3124
|
-
return /*#__PURE__*/React.createElement(MenuGroup, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3125
|
-
ref: ref
|
|
3126
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
3127
|
-
className: modules_2befbba6.iconsMenuGroup
|
|
3128
|
-
}, children));
|
|
2884
|
+
}), label ? /*#__PURE__*/React.createElement("div", {
|
|
2885
|
+
role: "presentation",
|
|
2886
|
+
className: "reactist_menugroup__label"
|
|
2887
|
+
}, label) : null, children);
|
|
3129
2888
|
});
|
|
3130
2889
|
|
|
3131
2890
|
const _excluded$u = ["type", "variant", "size", "loading", "disabled", "tooltip", "onClick", "children"];
|
|
@@ -3979,212 +3738,6 @@ Select.defaultProps = {
|
|
|
3979
3738
|
disabled: false
|
|
3980
3739
|
};
|
|
3981
3740
|
|
|
3982
|
-
var modules_8f59d13b$1 = {"reach-portal":"ad18b0a0","fadein":"f7a1b219","fitContent":"_8ed9bb5c","container":"f67e892e","full":"_4139421e","large":"_649eb5fe","medium":"_5323e676","small":"_56ca7ae6","xlarge":"a7be0fce","overlay":"_88a7a680","expand":"b29456b8","buttonContainer":"_09ef1f4f","headerContent":"_0e5b530a"};
|
|
3983
|
-
|
|
3984
|
-
const _excluded$y = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"],
|
|
3985
|
-
_excluded2$4 = ["children", "button", "withDivider", "exceptionallySetClassName"],
|
|
3986
|
-
_excluded3$3 = ["exceptionallySetClassName", "children"],
|
|
3987
|
-
_excluded4$2 = ["exceptionallySetClassName", "withDivider"],
|
|
3988
|
-
_excluded5$2 = ["children"];
|
|
3989
|
-
const ModalContext$1 = /*#__PURE__*/React.createContext({
|
|
3990
|
-
onDismiss: undefined,
|
|
3991
|
-
height: 'fitContent'
|
|
3992
|
-
});
|
|
3993
|
-
|
|
3994
|
-
function isNotInternalFrame$1(element) {
|
|
3995
|
-
return !(element.ownerDocument === document && element.tagName.toLowerCase() === 'iframe');
|
|
3996
|
-
}
|
|
3997
|
-
/**
|
|
3998
|
-
* Renders a modal that sits on top of the rest of the content in the entire page.
|
|
3999
|
-
*
|
|
4000
|
-
* Follows the WAI-ARIA Dialog (Modal) Pattern.
|
|
4001
|
-
*
|
|
4002
|
-
* @see DeprecatedModalHeader
|
|
4003
|
-
* @see DeprecatedModalFooter
|
|
4004
|
-
* @see DeprecatedModalBody
|
|
4005
|
-
* @deprecated
|
|
4006
|
-
*/
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
function DeprecatedModal(_ref) {
|
|
4010
|
-
let {
|
|
4011
|
-
isOpen,
|
|
4012
|
-
onDismiss,
|
|
4013
|
-
height = 'fitContent',
|
|
4014
|
-
width = 'medium',
|
|
4015
|
-
exceptionallySetClassName,
|
|
4016
|
-
autoFocus = true,
|
|
4017
|
-
children
|
|
4018
|
-
} = _ref,
|
|
4019
|
-
props = _objectWithoutProperties(_ref, _excluded$y);
|
|
4020
|
-
|
|
4021
|
-
const contextValue = React.useMemo(() => ({
|
|
4022
|
-
onDismiss,
|
|
4023
|
-
height
|
|
4024
|
-
}), [onDismiss, height]);
|
|
4025
|
-
return /*#__PURE__*/React.createElement(dialog$1.DialogOverlay, {
|
|
4026
|
-
isOpen: isOpen,
|
|
4027
|
-
onDismiss: onDismiss,
|
|
4028
|
-
dangerouslyBypassFocusLock // We're setting up our own focus lock below
|
|
4029
|
-
: true,
|
|
4030
|
-
className: classNames(modules_8f59d13b$1.overlay, modules_8f59d13b$1[height], modules_8f59d13b$1[width]),
|
|
4031
|
-
"data-testid": "modal-overlay"
|
|
4032
|
-
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
4033
|
-
autoFocus: autoFocus,
|
|
4034
|
-
whiteList: isNotInternalFrame$1,
|
|
4035
|
-
returnFocus: true
|
|
4036
|
-
}, /*#__PURE__*/React.createElement(dialog$1.DialogContent, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
4037
|
-
as: Box,
|
|
4038
|
-
borderRadius: "full",
|
|
4039
|
-
background: "default",
|
|
4040
|
-
display: "flex",
|
|
4041
|
-
flexDirection: "column",
|
|
4042
|
-
overflow: "hidden",
|
|
4043
|
-
height: height === 'expand' ? 'full' : undefined,
|
|
4044
|
-
flexGrow: height === 'expand' ? 1 : 0,
|
|
4045
|
-
className: [exceptionallySetClassName, modules_8f59d13b$1.container]
|
|
4046
|
-
}), /*#__PURE__*/React.createElement(ModalContext$1.Provider, {
|
|
4047
|
-
value: contextValue
|
|
4048
|
-
}, children))));
|
|
4049
|
-
}
|
|
4050
|
-
/**
|
|
4051
|
-
* The close button rendered by ModalHeader. Provided independently so that consumers can customize
|
|
4052
|
-
* the button's label.
|
|
4053
|
-
*
|
|
4054
|
-
* @see DeprecatedModalHeader
|
|
4055
|
-
*/
|
|
4056
|
-
|
|
4057
|
-
function DeprecatedModalCloseButton(props) {
|
|
4058
|
-
const {
|
|
4059
|
-
onDismiss
|
|
4060
|
-
} = React.useContext(ModalContext$1);
|
|
4061
|
-
const [includeInTabOrder, setIncludeInTabOrder] = React.useState(false);
|
|
4062
|
-
const [isMounted, setIsMounted] = React.useState(false);
|
|
4063
|
-
React.useEffect(function skipAutoFocus() {
|
|
4064
|
-
if (isMounted) {
|
|
4065
|
-
setIncludeInTabOrder(true);
|
|
4066
|
-
} else {
|
|
4067
|
-
setIsMounted(true);
|
|
4068
|
-
}
|
|
4069
|
-
}, [isMounted]);
|
|
4070
|
-
return /*#__PURE__*/React.createElement(Button, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
4071
|
-
variant: "quaternary",
|
|
4072
|
-
onClick: onDismiss,
|
|
4073
|
-
icon: /*#__PURE__*/React.createElement(CloseIcon, null),
|
|
4074
|
-
tabIndex: includeInTabOrder ? 0 : -1
|
|
4075
|
-
}));
|
|
4076
|
-
}
|
|
4077
|
-
/**
|
|
4078
|
-
* Renders a standard modal header area with an optional close button.
|
|
4079
|
-
*
|
|
4080
|
-
* @see DeprecatedModal
|
|
4081
|
-
* @see DeprecatedModalFooter
|
|
4082
|
-
* @see DeprecatedModalBody
|
|
4083
|
-
*/
|
|
4084
|
-
|
|
4085
|
-
function DeprecatedModalHeader(_ref2) {
|
|
4086
|
-
let {
|
|
4087
|
-
children,
|
|
4088
|
-
button = true,
|
|
4089
|
-
withDivider = false,
|
|
4090
|
-
exceptionallySetClassName
|
|
4091
|
-
} = _ref2,
|
|
4092
|
-
props = _objectWithoutProperties(_ref2, _excluded2$4);
|
|
4093
|
-
|
|
4094
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
4095
|
-
as: "header",
|
|
4096
|
-
paddingLeft: "large",
|
|
4097
|
-
paddingRight: button === false || button === null ? 'large' : 'small',
|
|
4098
|
-
paddingY: "small",
|
|
4099
|
-
className: exceptionallySetClassName
|
|
4100
|
-
}), /*#__PURE__*/React.createElement(Columns, {
|
|
4101
|
-
space: "large",
|
|
4102
|
-
alignY: "center"
|
|
4103
|
-
}, /*#__PURE__*/React.createElement(Column, {
|
|
4104
|
-
width: "auto"
|
|
4105
|
-
}, children), button === false || button === null ? /*#__PURE__*/React.createElement("div", {
|
|
4106
|
-
className: modules_8f59d13b$1.headerContent
|
|
4107
|
-
}) : /*#__PURE__*/React.createElement(Column, {
|
|
4108
|
-
width: "content",
|
|
4109
|
-
exceptionallySetClassName: modules_8f59d13b$1.buttonContainer,
|
|
4110
|
-
"data-testid": "button-container"
|
|
4111
|
-
}, typeof button === 'boolean' ? /*#__PURE__*/React.createElement(DeprecatedModalCloseButton, {
|
|
4112
|
-
"aria-label": "Close modal",
|
|
4113
|
-
autoFocus: false
|
|
4114
|
-
}) : button))), withDivider ? /*#__PURE__*/React.createElement(Divider, null) : null);
|
|
4115
|
-
}
|
|
4116
|
-
/**
|
|
4117
|
-
* Renders the body of a modal.
|
|
4118
|
-
*
|
|
4119
|
-
* Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other
|
|
4120
|
-
* things, that the contet of the modal body expands or contracts depending on the modal height
|
|
4121
|
-
* setting or the size of the content. The body content also automatically scrolls when it's too
|
|
4122
|
-
* large to fit the available space.
|
|
4123
|
-
*
|
|
4124
|
-
* @see DeprecatedModal
|
|
4125
|
-
* @see DeprecatedModalHeader
|
|
4126
|
-
* @see DeprecatedModalFooter
|
|
4127
|
-
*/
|
|
4128
|
-
|
|
4129
|
-
function DeprecatedModalBody(_ref3) {
|
|
4130
|
-
let {
|
|
4131
|
-
exceptionallySetClassName,
|
|
4132
|
-
children
|
|
4133
|
-
} = _ref3,
|
|
4134
|
-
props = _objectWithoutProperties(_ref3, _excluded3$3);
|
|
4135
|
-
|
|
4136
|
-
const {
|
|
4137
|
-
height
|
|
4138
|
-
} = React.useContext(ModalContext$1);
|
|
4139
|
-
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
4140
|
-
className: exceptionallySetClassName,
|
|
4141
|
-
flexGrow: height === 'expand' ? 1 : 0,
|
|
4142
|
-
height: height === 'expand' ? 'full' : undefined,
|
|
4143
|
-
overflow: "auto"
|
|
4144
|
-
}), /*#__PURE__*/React.createElement(Box, {
|
|
4145
|
-
padding: "large",
|
|
4146
|
-
paddingBottom: "xxlarge"
|
|
4147
|
-
}, children));
|
|
4148
|
-
}
|
|
4149
|
-
/**
|
|
4150
|
-
* Renders a standard modal footer area.
|
|
4151
|
-
*
|
|
4152
|
-
* @see DeprecatedModal
|
|
4153
|
-
* @see DeprecatedModalHeader
|
|
4154
|
-
* @see DeprecatedModalBody
|
|
4155
|
-
*/
|
|
4156
|
-
|
|
4157
|
-
function DeprecatedModalFooter(_ref4) {
|
|
4158
|
-
let {
|
|
4159
|
-
exceptionallySetClassName,
|
|
4160
|
-
withDivider = false
|
|
4161
|
-
} = _ref4,
|
|
4162
|
-
props = _objectWithoutProperties(_ref4, _excluded4$2);
|
|
4163
|
-
|
|
4164
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, withDivider ? /*#__PURE__*/React.createElement(Divider, null) : null, /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({
|
|
4165
|
-
as: "footer"
|
|
4166
|
-
}, props), {}, {
|
|
4167
|
-
className: exceptionallySetClassName,
|
|
4168
|
-
padding: "large"
|
|
4169
|
-
})));
|
|
4170
|
-
}
|
|
4171
|
-
/**
|
|
4172
|
-
* A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).
|
|
4173
|
-
* @see DeprecatedModalFooter
|
|
4174
|
-
*/
|
|
4175
|
-
|
|
4176
|
-
function DeprecatedModalActions(_ref5) {
|
|
4177
|
-
let {
|
|
4178
|
-
children
|
|
4179
|
-
} = _ref5,
|
|
4180
|
-
props = _objectWithoutProperties(_ref5, _excluded5$2);
|
|
4181
|
-
|
|
4182
|
-
return /*#__PURE__*/React.createElement(DeprecatedModalFooter, _objectSpread2({}, props), /*#__PURE__*/React.createElement(Inline, {
|
|
4183
|
-
align: "right",
|
|
4184
|
-
space: "large"
|
|
4185
|
-
}, children));
|
|
4186
|
-
}
|
|
4187
|
-
|
|
4188
3741
|
exports.Alert = Alert;
|
|
4189
3742
|
exports.Avatar = Avatar;
|
|
4190
3743
|
exports.Badge = Badge;
|
|
@@ -4201,19 +3754,11 @@ exports.ContextMenuTrigger = ContextMenuTrigger;
|
|
|
4201
3754
|
exports.DeprecatedButton = Button$1;
|
|
4202
3755
|
exports.DeprecatedDropdown = Dropdown;
|
|
4203
3756
|
exports.DeprecatedInput = Input;
|
|
4204
|
-
exports.DeprecatedModal = DeprecatedModal;
|
|
4205
|
-
exports.DeprecatedModalActions = DeprecatedModalActions;
|
|
4206
|
-
exports.DeprecatedModalBody = DeprecatedModalBody;
|
|
4207
|
-
exports.DeprecatedModalCloseButton = DeprecatedModalCloseButton;
|
|
4208
|
-
exports.DeprecatedModalFooter = DeprecatedModalFooter;
|
|
4209
|
-
exports.DeprecatedModalHeader = DeprecatedModalHeader;
|
|
4210
3757
|
exports.DeprecatedSelect = Select;
|
|
4211
3758
|
exports.Divider = Divider;
|
|
4212
3759
|
exports.Heading = Heading;
|
|
4213
3760
|
exports.Hidden = Hidden;
|
|
4214
3761
|
exports.HiddenVisually = HiddenVisually;
|
|
4215
|
-
exports.IconMenuItem = IconMenuItem;
|
|
4216
|
-
exports.IconsMenuGroup = IconsMenuGroup;
|
|
4217
3762
|
exports.Inline = Inline;
|
|
4218
3763
|
exports.KeyCapturer = KeyCapturer;
|
|
4219
3764
|
exports.KeyboardShortcut = KeyboardShortcut;
|
|
@@ -4238,8 +3783,6 @@ exports.SelectField = SelectField;
|
|
|
4238
3783
|
exports.Stack = Stack;
|
|
4239
3784
|
exports.StaticToast = StaticToast;
|
|
4240
3785
|
exports.SubMenu = SubMenu;
|
|
4241
|
-
exports.SubMenuItem = SubMenuItem;
|
|
4242
|
-
exports.SubMenuList = SubMenuList;
|
|
4243
3786
|
exports.SwitchField = SwitchField;
|
|
4244
3787
|
exports.Tab = Tab;
|
|
4245
3788
|
exports.TabAwareSlot = TabAwareSlot;
|