@doist/reactist 25.0.0-beta → 25.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/reactist.cjs.development.js +116 -91
- 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/avatar/avatar.js.map +1 -1
- package/es/banner/banner.js.map +1 -1
- package/es/button/button.js +1 -1
- package/es/button/button.js.map +1 -1
- package/es/checkbox-field/checkbox-field.js.map +1 -1
- package/es/components/deprecated-dropdown/dropdown.js.map +1 -1
- package/es/components/deprecated-input/input.js +5 -1
- package/es/components/deprecated-input/input.js.map +1 -1
- package/es/heading/heading.js.map +1 -1
- package/es/loading/loading.js.map +1 -1
- package/es/menu/menu.js +56 -34
- package/es/menu/menu.js.map +1 -1
- package/es/modal/modal.js +16 -14
- package/es/modal/modal.js.map +1 -1
- package/es/password-field/password-field.js.map +1 -1
- package/es/prose/prose.js.map +1 -1
- package/es/select-field/select-field.js.map +1 -1
- package/es/switch-field/switch-field.js.map +1 -1
- package/es/tabs/tabs.js +26 -32
- package/es/tabs/tabs.js.map +1 -1
- package/es/text-area/text-area.js.map +1 -1
- package/es/text-field/text-field.js.map +1 -1
- package/es/tooltip/tooltip.js +13 -12
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/utils/polymorphism.js +1 -1
- package/es/utils/polymorphism.js.map +1 -1
- package/lib/alert/alert.d.ts +1 -1
- package/lib/avatar/avatar.d.ts +4 -4
- package/lib/avatar/avatar.js.map +1 -1
- package/lib/badge/badge.d.ts +2 -2
- package/lib/banner/banner.d.ts +2 -2
- package/lib/banner/banner.js.map +1 -1
- package/lib/base-field/base-field.d.ts +3 -3
- package/lib/button/button.d.ts +2 -2
- package/lib/button/button.js.map +1 -1
- package/lib/checkbox-field/checkbox-field.d.ts +29 -17
- package/lib/checkbox-field/checkbox-field.js.map +1 -1
- package/lib/checkbox-field/checkbox-icon.d.ts +1 -1
- package/lib/components/color-picker/color-picker.d.ts +2 -2
- package/lib/components/deprecated-dropdown/dropdown.d.ts +5 -5
- package/lib/components/deprecated-dropdown/dropdown.js.map +1 -1
- package/lib/components/deprecated-input/input.d.ts +6 -6
- package/lib/components/deprecated-input/input.js +1 -1
- package/lib/components/deprecated-input/input.js.map +1 -1
- package/lib/components/deprecated-select/select.d.ts +2 -2
- package/lib/components/icons/CloseIcon.svg.d.ts +2 -2
- package/lib/components/icons/ThinQuestionMarkIcon.svg.d.ts +2 -2
- package/lib/components/icons/ThreeDotsIcon.svg.d.ts +2 -2
- package/lib/components/keyboard-shortcut/keyboard-shortcut.d.ts +1 -1
- package/lib/components/progress-bar/progress-bar.d.ts +2 -2
- package/lib/components/time/time.d.ts +1 -1
- package/lib/divider/divider.d.ts +2 -2
- package/lib/heading/heading.d.ts +4 -12
- package/lib/heading/heading.js.map +1 -1
- package/lib/icons/alert-icon.d.ts +2 -2
- package/lib/icons/close-icon.d.ts +2 -2
- package/lib/icons/password-hidden-icon.d.ts +2 -2
- package/lib/icons/password-visible-icon.d.ts +2 -2
- package/lib/loading/loading.d.ts +4 -5
- package/lib/loading/loading.js.map +1 -1
- package/lib/menu/menu.d.ts +20 -19
- package/lib/menu/menu.js +1 -1
- package/lib/menu/menu.js.map +1 -1
- package/lib/modal/modal-stories-components.d.ts +9 -9
- package/lib/modal/modal.d.ts +20 -28
- package/lib/modal/modal.js +1 -1
- package/lib/modal/modal.js.map +1 -1
- package/lib/notice/notice.d.ts +1 -1
- package/lib/password-field/password-field.d.ts +3 -8
- package/lib/password-field/password-field.js.map +1 -1
- package/lib/prose/prose.d.ts +4 -7
- package/lib/prose/prose.js.map +1 -1
- package/lib/select-field/select-field.d.ts +3 -7
- package/lib/select-field/select-field.js.map +1 -1
- package/lib/spinner/spinner.d.ts +2 -2
- package/lib/switch-field/switch-field.d.ts +12 -11
- package/lib/switch-field/switch-field.js.map +1 -1
- package/lib/tabs/tabs.d.ts +24 -16
- package/lib/tabs/tabs.js +1 -1
- package/lib/tabs/tabs.js.map +1 -1
- package/lib/text-area/text-area.d.ts +3 -8
- package/lib/text-area/text-area.js.map +1 -1
- package/lib/text-field/text-field.d.ts +5 -10
- package/lib/text-field/text-field.js.map +1 -1
- package/lib/toast/use-toasts.d.ts +1 -1
- package/lib/tooltip/tooltip.d.ts +4 -7
- package/lib/tooltip/tooltip.js +1 -1
- package/lib/tooltip/tooltip.js.map +1 -1
- package/lib/utils/polymorphism.d.ts +4 -2
- package/lib/utils/polymorphism.js.map +1 -1
- package/lib/utils/test-helpers.d.ts +2 -2
- package/package.json +3 -3
|
@@ -111,7 +111,7 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
111
111
|
* convenience over merely using React.forwardRef directly, and then manually forcing the resulting
|
|
112
112
|
* value to be typed using `as PolymorphicComponent<…>`.
|
|
113
113
|
*
|
|
114
|
-
* @
|
|
114
|
+
* @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)
|
|
115
115
|
*/
|
|
116
116
|
|
|
117
117
|
function polymorphicComponent(render) {
|
|
@@ -577,19 +577,20 @@ function Tooltip({
|
|
|
577
577
|
render: child,
|
|
578
578
|
store: tooltip,
|
|
579
579
|
ref: child.ref
|
|
580
|
-
}), isOpen && content ? /*#__PURE__*/React.createElement(
|
|
581
|
-
as: react.Tooltip,
|
|
582
|
-
gutter: gapSize,
|
|
580
|
+
}), isOpen && content ? /*#__PURE__*/React.createElement(react.Tooltip, {
|
|
583
581
|
store: tooltip,
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
582
|
+
gutter: gapSize,
|
|
583
|
+
render: /*#__PURE__*/React.createElement(Box, {
|
|
584
|
+
className: [modules_95f1407a.tooltip, exceptionallySetClassName],
|
|
585
|
+
background: "toast",
|
|
586
|
+
borderRadius: "standard",
|
|
587
|
+
paddingX: "small",
|
|
588
|
+
paddingY: "xsmall",
|
|
589
|
+
maxWidth: "medium",
|
|
590
|
+
width: "fitContent",
|
|
591
|
+
overflow: "hidden",
|
|
592
|
+
textAlign: "center"
|
|
593
|
+
})
|
|
593
594
|
}, withArrow ? /*#__PURE__*/React.createElement(react.TooltipArrow, null) : null, typeof content === 'function' ? content() : content) : null);
|
|
594
595
|
}
|
|
595
596
|
|
|
@@ -663,7 +664,7 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
|
663
664
|
* [WAI-ARIA Button Pattern](https://www.w3.org/TR/wai-aria-practices/#button).
|
|
664
665
|
*/
|
|
665
666
|
|
|
666
|
-
const IconButton = /*#__PURE__*/React.forwardRef(function
|
|
667
|
+
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref2, ref) {
|
|
667
668
|
let {
|
|
668
669
|
variant,
|
|
669
670
|
tone = 'normal',
|
|
@@ -2192,7 +2193,7 @@ function Badge(_ref) {
|
|
|
2192
2193
|
|
|
2193
2194
|
var modules_8f59d13b = {"overlay":"_8aa86dd3","fadein":"_20c07ee6","fitContent":"_713bc08f","container":"_45139719","full":"ec8619a2","large":"_86a1d5a4","medium":"_11d61de3","small":"aee19643","xlarge":"fe449c81","expand":"_61ffb38f","buttonContainer":"_49ffdac0","headerContent":"ee92ccb3"};
|
|
2194
2195
|
|
|
2195
|
-
const _excluded$p = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "exceptionallySetOverlayClassName", "autoFocus", "hideOnEscape", "hideOnInteractOutside", "children", "portalElement", "onKeyDown"],
|
|
2196
|
+
const _excluded$p = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "exceptionallySetOverlayClassName", "autoFocus", "hideOnEscape", "hideOnInteractOutside", "children", "portalElement", "onKeyDown", "className"],
|
|
2196
2197
|
_excluded2$2 = ["children", "button", "withDivider", "exceptionallySetClassName"],
|
|
2197
2198
|
_excluded3 = ["exceptionallySetClassName", "children"],
|
|
2198
2199
|
_excluded4 = ["exceptionallySetClassName", "withDivider"],
|
|
@@ -2229,7 +2230,9 @@ function Modal(_ref) {
|
|
|
2229
2230
|
hideOnInteractOutside = true,
|
|
2230
2231
|
children,
|
|
2231
2232
|
portalElement,
|
|
2232
|
-
onKeyDown
|
|
2233
|
+
onKeyDown,
|
|
2234
|
+
// @ts-expect-error we want to make sure to not pass it to the Dialog component
|
|
2235
|
+
className
|
|
2233
2236
|
} = _ref,
|
|
2234
2237
|
props = _objectWithoutProperties(_ref, _excluded$p);
|
|
2235
2238
|
|
|
@@ -2289,9 +2292,8 @@ function Modal(_ref) {
|
|
|
2289
2292
|
className: classNames(modules_8f59d13b.overlay, modules_8f59d13b[height], modules_8f59d13b[width], exceptionallySetOverlayClassName),
|
|
2290
2293
|
|
|
2291
2294
|
/**
|
|
2292
|
-
* We're using `onPointerDown` instead of `onClick` to prevent
|
|
2293
|
-
*
|
|
2294
|
-
* and ends on the backdrop.
|
|
2295
|
+
* We're using `onPointerDown` instead of `onClick` to prevent the modal from
|
|
2296
|
+
* closing when the click starts inside the modal and ends on the backdrop.
|
|
2295
2297
|
*/
|
|
2296
2298
|
onPointerDown: hideOnInteractOutside ? handleBackdropClick : undefined,
|
|
2297
2299
|
ref: backdropRef
|
|
@@ -2301,17 +2303,18 @@ function Modal(_ref) {
|
|
|
2301
2303
|
returnFocus: true
|
|
2302
2304
|
}, /*#__PURE__*/React.createElement(react.Dialog, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2303
2305
|
ref: dialogRef,
|
|
2304
|
-
|
|
2306
|
+
render: /*#__PURE__*/React.createElement(Box, {
|
|
2307
|
+
borderRadius: "full",
|
|
2308
|
+
background: "default",
|
|
2309
|
+
display: "flex",
|
|
2310
|
+
flexDirection: "column",
|
|
2311
|
+
overflow: "hidden",
|
|
2312
|
+
height: height === 'expand' ? 'full' : undefined,
|
|
2313
|
+
flexGrow: height === 'expand' ? 1 : 0
|
|
2314
|
+
}),
|
|
2315
|
+
className: classNames(exceptionallySetClassName, modules_8f59d13b.container),
|
|
2305
2316
|
store: store,
|
|
2306
2317
|
preventBodyScroll: true,
|
|
2307
|
-
borderRadius: "full",
|
|
2308
|
-
background: "default",
|
|
2309
|
-
display: "flex",
|
|
2310
|
-
flexDirection: "column",
|
|
2311
|
-
overflow: "hidden",
|
|
2312
|
-
height: height === 'expand' ? 'full' : undefined,
|
|
2313
|
-
flexGrow: height === 'expand' ? 1 : 0,
|
|
2314
|
-
className: [exceptionallySetClassName, modules_8f59d13b.container],
|
|
2315
2318
|
// Disable focus lock as we set up our own using ReactFocusLock
|
|
2316
2319
|
modal: false,
|
|
2317
2320
|
autoFocus: false,
|
|
@@ -2467,9 +2470,8 @@ function ModalActions(_ref5) {
|
|
|
2467
2470
|
|
|
2468
2471
|
var modules_40c67f5b = {"tab":"e96bf360","track":"_430e252d","tab-neutral":"f631ccbe","tab-themed":"_6ba96acc","track-neutral":"ef4cd8d3","track-themed":"_344b3b10"};
|
|
2469
2472
|
|
|
2470
|
-
const _excluded$q = ["
|
|
2471
|
-
_excluded2$3 = ["children", "
|
|
2472
|
-
_excluded3$1 = ["children", "id", "as", "render"];
|
|
2473
|
+
const _excluded$q = ["children", "space"],
|
|
2474
|
+
_excluded2$3 = ["children", "id", "renderMode"];
|
|
2473
2475
|
const TabsContext = /*#__PURE__*/React.createContext(null);
|
|
2474
2476
|
/**
|
|
2475
2477
|
* Used to group components that compose a set of tabs. There can only be one active tab within the same `<Tabs>` group.
|
|
@@ -2506,15 +2508,12 @@ function Tabs({
|
|
|
2506
2508
|
*/
|
|
2507
2509
|
|
|
2508
2510
|
|
|
2509
|
-
const Tab = /*#__PURE__*/
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
} = _ref2,
|
|
2516
|
-
props = _objectWithoutProperties(_ref2, _excluded$q);
|
|
2517
|
-
|
|
2511
|
+
const Tab = /*#__PURE__*/React.forwardRef(function Tab({
|
|
2512
|
+
children,
|
|
2513
|
+
id,
|
|
2514
|
+
exceptionallySetClassName,
|
|
2515
|
+
render
|
|
2516
|
+
}, ref) {
|
|
2518
2517
|
const tabContextValue = React.useContext(TabsContext);
|
|
2519
2518
|
if (!tabContextValue) return null;
|
|
2520
2519
|
const {
|
|
@@ -2522,24 +2521,24 @@ const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref2, ref) {
|
|
|
2522
2521
|
tabStore
|
|
2523
2522
|
} = tabContextValue;
|
|
2524
2523
|
const className = classNames(exceptionallySetClassName, modules_40c67f5b.tab, modules_40c67f5b["tab-" + variant]);
|
|
2525
|
-
return /*#__PURE__*/React.createElement(react.Tab,
|
|
2526
|
-
|
|
2524
|
+
return /*#__PURE__*/React.createElement(react.Tab, {
|
|
2525
|
+
render: render,
|
|
2527
2526
|
className: className,
|
|
2528
2527
|
id: id,
|
|
2529
2528
|
store: tabStore,
|
|
2530
2529
|
ref: ref
|
|
2531
|
-
}
|
|
2530
|
+
}, children);
|
|
2532
2531
|
});
|
|
2533
2532
|
/**
|
|
2534
2533
|
* A component used to group `<Tab>` elements together.
|
|
2535
2534
|
*/
|
|
2536
2535
|
|
|
2537
|
-
function TabList(
|
|
2536
|
+
function TabList(_ref2) {
|
|
2538
2537
|
let {
|
|
2539
2538
|
children,
|
|
2540
2539
|
space
|
|
2541
|
-
} =
|
|
2542
|
-
props = _objectWithoutProperties(
|
|
2540
|
+
} = _ref2,
|
|
2541
|
+
props = _objectWithoutProperties(_ref2, _excluded$q);
|
|
2543
2542
|
|
|
2544
2543
|
const tabContextValue = React.useContext(TabsContext);
|
|
2545
2544
|
|
|
@@ -2553,13 +2552,14 @@ function TabList(_ref3) {
|
|
|
2553
2552
|
} = tabContextValue;
|
|
2554
2553
|
return (
|
|
2555
2554
|
/*#__PURE__*/
|
|
2556
|
-
// The extra <
|
|
2555
|
+
// The extra <div> prevents <Inline>'s negative margins from collapsing when used in a flex container
|
|
2557
2556
|
// which will render the track with the wrong height
|
|
2558
|
-
React.createElement(
|
|
2557
|
+
React.createElement("div", null, /*#__PURE__*/React.createElement(react.TabList, _objectSpread2({
|
|
2559
2558
|
store: tabStore,
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2559
|
+
render: /*#__PURE__*/React.createElement(Box, {
|
|
2560
|
+
position: "relative",
|
|
2561
|
+
width: "maxContent"
|
|
2562
|
+
})
|
|
2563
2563
|
}, props), /*#__PURE__*/React.createElement(Box, {
|
|
2564
2564
|
className: [modules_40c67f5b.track, modules_40c67f5b["track-" + variant]]
|
|
2565
2565
|
}), /*#__PURE__*/React.createElement(Inline, {
|
|
@@ -2573,14 +2573,13 @@ function TabList(_ref3) {
|
|
|
2573
2573
|
*/
|
|
2574
2574
|
|
|
2575
2575
|
|
|
2576
|
-
const TabPanel = /*#__PURE__*/
|
|
2576
|
+
const TabPanel = /*#__PURE__*/React.forwardRef(function TabPanel(_ref3, ref) {
|
|
2577
2577
|
let {
|
|
2578
2578
|
children,
|
|
2579
2579
|
id,
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
props = _objectWithoutProperties(_ref4, _excluded3$1);
|
|
2580
|
+
renderMode = 'always'
|
|
2581
|
+
} = _ref3,
|
|
2582
|
+
props = _objectWithoutProperties(_ref3, _excluded2$3);
|
|
2584
2583
|
|
|
2585
2584
|
const tabContextValue = React.useContext(TabsContext);
|
|
2586
2585
|
const [tabRendered, setTabRendered] = React.useState(false);
|
|
@@ -2599,11 +2598,10 @@ const TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref4, ref)
|
|
|
2599
2598
|
const {
|
|
2600
2599
|
tabStore
|
|
2601
2600
|
} = tabContextValue;
|
|
2602
|
-
const shouldRender =
|
|
2601
|
+
const shouldRender = renderMode === 'always' || renderMode === 'active' && tabIsActive || renderMode === 'lazy' && (tabIsActive || tabRendered);
|
|
2603
2602
|
return shouldRender ? /*#__PURE__*/React.createElement(react.TabPanel, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2604
2603
|
tabId: id,
|
|
2605
2604
|
store: tabStore,
|
|
2606
|
-
as: as,
|
|
2607
2605
|
ref: ref
|
|
2608
2606
|
}), children) : null;
|
|
2609
2607
|
});
|
|
@@ -2624,16 +2622,16 @@ function TabAwareSlot({
|
|
|
2624
2622
|
|
|
2625
2623
|
const _excluded$r = ["children", "onItemSelect"],
|
|
2626
2624
|
_excluded2$4 = ["exceptionallySetClassName"],
|
|
2627
|
-
_excluded3$
|
|
2625
|
+
_excluded3$1 = ["render"],
|
|
2628
2626
|
_excluded4$1 = ["exceptionallySetClassName", "modal"],
|
|
2629
|
-
_excluded5$1 = ["value", "children", "onSelect", "hideOnSelect", "onClick", "exceptionallySetClassName"
|
|
2627
|
+
_excluded5$1 = ["value", "children", "onSelect", "hideOnSelect", "onClick", "exceptionallySetClassName"],
|
|
2630
2628
|
_excluded6 = ["label", "children", "exceptionallySetClassName"];
|
|
2631
|
-
const MenuContext = /*#__PURE__*/React.createContext(
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2629
|
+
const MenuContext = /*#__PURE__*/React.createContext({
|
|
2630
|
+
menuStore: null,
|
|
2631
|
+
handleItemSelect: () => undefined,
|
|
2632
|
+
getAnchorRect: null,
|
|
2633
|
+
setAnchorRect: () => undefined
|
|
2634
|
+
});
|
|
2637
2635
|
/**
|
|
2638
2636
|
* Wrapper component to control a menu. It does not render anything, only providing the state
|
|
2639
2637
|
* management for the menu components inside it.
|
|
@@ -2666,7 +2664,7 @@ function Menu(_ref) {
|
|
|
2666
2664
|
*/
|
|
2667
2665
|
|
|
2668
2666
|
|
|
2669
|
-
const MenuButton = /*#__PURE__*/
|
|
2667
|
+
const MenuButton = /*#__PURE__*/React.forwardRef(function MenuButton(_ref2, ref) {
|
|
2670
2668
|
let {
|
|
2671
2669
|
exceptionallySetClassName
|
|
2672
2670
|
} = _ref2,
|
|
@@ -2675,25 +2673,32 @@ const MenuButton = /*#__PURE__*/polymorphicComponent(function MenuButton(_ref2,
|
|
|
2675
2673
|
const {
|
|
2676
2674
|
menuStore
|
|
2677
2675
|
} = React.useContext(MenuContext);
|
|
2676
|
+
|
|
2677
|
+
if (!menuStore) {
|
|
2678
|
+
throw new Error('MenuButton must be wrapped in <Menu/>');
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2678
2681
|
return /*#__PURE__*/React.createElement(react.MenuButton, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2679
2682
|
store: menuStore,
|
|
2680
2683
|
ref: ref,
|
|
2681
2684
|
className: classNames('reactist_menubutton', exceptionallySetClassName)
|
|
2682
2685
|
}));
|
|
2683
|
-
});
|
|
2684
|
-
|
|
2685
|
-
//
|
|
2686
|
-
|
|
2687
|
-
const ContextMenuTrigger = /*#__PURE__*/polymorphicComponent(function ContextMenuTrigger(_ref3, ref) {
|
|
2686
|
+
});
|
|
2687
|
+
const ContextMenuTrigger = /*#__PURE__*/React.forwardRef(function ContextMenuTrigger(_ref3, ref) {
|
|
2688
2688
|
let {
|
|
2689
|
-
|
|
2689
|
+
render
|
|
2690
2690
|
} = _ref3,
|
|
2691
|
-
props = _objectWithoutProperties(_ref3, _excluded3$
|
|
2691
|
+
props = _objectWithoutProperties(_ref3, _excluded3$1);
|
|
2692
2692
|
|
|
2693
2693
|
const {
|
|
2694
2694
|
setAnchorRect,
|
|
2695
2695
|
menuStore
|
|
2696
2696
|
} = React.useContext(MenuContext);
|
|
2697
|
+
|
|
2698
|
+
if (!menuStore) {
|
|
2699
|
+
throw new Error('ContextMenuTrigger must be wrapped in <Menu/>');
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2697
2702
|
const handleContextMenu = React.useCallback(function handleContextMenu(event) {
|
|
2698
2703
|
event.preventDefault();
|
|
2699
2704
|
setAnchorRect({
|
|
@@ -2706,16 +2711,17 @@ const ContextMenuTrigger = /*#__PURE__*/polymorphicComponent(function ContextMen
|
|
|
2706
2711
|
React.useEffect(() => {
|
|
2707
2712
|
if (!isOpen) setAnchorRect(null);
|
|
2708
2713
|
}, [isOpen, setAnchorRect]);
|
|
2709
|
-
return /*#__PURE__*/React.createElement(
|
|
2714
|
+
return /*#__PURE__*/React.createElement(react.Role.div, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2710
2715
|
onContextMenu: handleContextMenu,
|
|
2711
|
-
ref
|
|
2716
|
+
ref: ref,
|
|
2717
|
+
render: render
|
|
2712
2718
|
}));
|
|
2713
2719
|
});
|
|
2714
2720
|
/**
|
|
2715
2721
|
* The dropdown menu itself, containing a list of menu items.
|
|
2716
2722
|
*/
|
|
2717
2723
|
|
|
2718
|
-
const MenuList = /*#__PURE__*/
|
|
2724
|
+
const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(_ref4, ref) {
|
|
2719
2725
|
let {
|
|
2720
2726
|
exceptionallySetClassName,
|
|
2721
2727
|
modal = true
|
|
@@ -2726,6 +2732,11 @@ const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref4, ref)
|
|
|
2726
2732
|
menuStore,
|
|
2727
2733
|
getAnchorRect
|
|
2728
2734
|
} = React.useContext(MenuContext);
|
|
2735
|
+
|
|
2736
|
+
if (!menuStore) {
|
|
2737
|
+
throw new Error('MenuList must be wrapped in <Menu/>');
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2729
2740
|
const isOpen = menuStore.useState('open');
|
|
2730
2741
|
return isOpen ? /*#__PURE__*/React.createElement(react.Portal, {
|
|
2731
2742
|
preserveTabOrder: true
|
|
@@ -2744,15 +2755,14 @@ const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref4, ref)
|
|
|
2744
2755
|
* callback.
|
|
2745
2756
|
*/
|
|
2746
2757
|
|
|
2747
|
-
const MenuItem = /*#__PURE__*/
|
|
2758
|
+
const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(_ref5, ref) {
|
|
2748
2759
|
let {
|
|
2749
2760
|
value,
|
|
2750
2761
|
children,
|
|
2751
2762
|
onSelect,
|
|
2752
2763
|
hideOnSelect = true,
|
|
2753
2764
|
onClick,
|
|
2754
|
-
exceptionallySetClassName
|
|
2755
|
-
as = 'button'
|
|
2765
|
+
exceptionallySetClassName
|
|
2756
2766
|
} = _ref5,
|
|
2757
2767
|
props = _objectWithoutProperties(_ref5, _excluded5$1);
|
|
2758
2768
|
|
|
@@ -2760,6 +2770,11 @@ const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref5, ref)
|
|
|
2760
2770
|
handleItemSelect,
|
|
2761
2771
|
menuStore
|
|
2762
2772
|
} = React.useContext(MenuContext);
|
|
2773
|
+
|
|
2774
|
+
if (!menuStore) {
|
|
2775
|
+
throw new Error('MenuItem must be wrapped in <Menu/>');
|
|
2776
|
+
}
|
|
2777
|
+
|
|
2763
2778
|
const {
|
|
2764
2779
|
hide
|
|
2765
2780
|
} = menuStore;
|
|
@@ -2771,7 +2786,6 @@ const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref5, ref)
|
|
|
2771
2786
|
if (shouldClose) hide();
|
|
2772
2787
|
}, [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value]);
|
|
2773
2788
|
return /*#__PURE__*/React.createElement(react.MenuItem, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2774
|
-
as: as,
|
|
2775
2789
|
store: menuStore,
|
|
2776
2790
|
ref: ref,
|
|
2777
2791
|
onClick: handleClick,
|
|
@@ -2809,6 +2823,11 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
|
2809
2823
|
handleItemSelect: parentMenuItemSelect,
|
|
2810
2824
|
menuStore
|
|
2811
2825
|
} = React.useContext(MenuContext);
|
|
2826
|
+
|
|
2827
|
+
if (!menuStore) {
|
|
2828
|
+
throw new Error('SubMenu must be wrapped in <Menu/>');
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2812
2831
|
const {
|
|
2813
2832
|
hide: parentMenuHide
|
|
2814
2833
|
} = menuStore;
|
|
@@ -2817,19 +2836,16 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
|
2817
2836
|
parentMenuItemSelect == null ? void 0 : parentMenuItemSelect(value);
|
|
2818
2837
|
parentMenuHide();
|
|
2819
2838
|
}, [parentMenuHide, parentMenuItemSelect, onItemSelect]);
|
|
2820
|
-
const [button, list] = React.Children.toArray(children);
|
|
2821
|
-
|
|
2822
|
-
const renderMenuButton = React.useCallback(function renderMenuButton(props) {
|
|
2823
|
-
return /*#__PURE__*/React.cloneElement(button, props);
|
|
2824
|
-
}, [button]);
|
|
2839
|
+
const [button, list] = React.Children.toArray(children);
|
|
2840
|
+
const buttonElement = button;
|
|
2825
2841
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
2826
2842
|
onItemSelect: handleSubItemSelect
|
|
2827
2843
|
}, /*#__PURE__*/React.createElement(react.MenuItem, {
|
|
2828
|
-
as: "div",
|
|
2829
2844
|
store: menuStore,
|
|
2830
2845
|
ref: ref,
|
|
2831
|
-
hideOnClick: false
|
|
2832
|
-
|
|
2846
|
+
hideOnClick: false,
|
|
2847
|
+
render: buttonElement
|
|
2848
|
+
}, buttonElement.props.children), list);
|
|
2833
2849
|
});
|
|
2834
2850
|
/**
|
|
2835
2851
|
* A way to semantically group some menu items.
|
|
@@ -2838,7 +2854,7 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
|
2838
2854
|
* before and/or after the group if you so wish.
|
|
2839
2855
|
*/
|
|
2840
2856
|
|
|
2841
|
-
const MenuGroup = /*#__PURE__*/
|
|
2857
|
+
const MenuGroup = /*#__PURE__*/React.forwardRef(function MenuGroup(_ref6, ref) {
|
|
2842
2858
|
let {
|
|
2843
2859
|
label,
|
|
2844
2860
|
children,
|
|
@@ -2849,6 +2865,11 @@ const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(_ref6, re
|
|
|
2849
2865
|
const {
|
|
2850
2866
|
menuStore
|
|
2851
2867
|
} = React.useContext(MenuContext);
|
|
2868
|
+
|
|
2869
|
+
if (!menuStore) {
|
|
2870
|
+
throw new Error('MenuGroup must be wrapped in <Menu/>');
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2852
2873
|
return /*#__PURE__*/React.createElement(react.MenuGroup, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2853
2874
|
ref: ref,
|
|
2854
2875
|
store: menuStore,
|
|
@@ -3666,7 +3687,11 @@ Time.defaultProps = {
|
|
|
3666
3687
|
}
|
|
3667
3688
|
};
|
|
3668
3689
|
|
|
3669
|
-
|
|
3690
|
+
/**
|
|
3691
|
+
* @deprecated
|
|
3692
|
+
*/
|
|
3693
|
+
|
|
3694
|
+
const Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
3670
3695
|
const className = classNames('reactist_input', props.className);
|
|
3671
3696
|
return /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3672
3697
|
className: className,
|