@doist/reactist 17.0.1 → 17.2.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 +64 -27
- 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/components/menu/menu.js +63 -29
- package/es/components/menu/menu.js.map +1 -1
- package/es/index.js +1 -1
- package/es/new-components/modal/modal.js +3 -2
- package/es/new-components/modal/modal.js.map +1 -1
- package/lib/components/menu/index.d.ts +2 -3
- package/lib/components/menu/menu.d.ts +4 -3
- package/lib/components/menu/menu.js +1 -1
- package/lib/components/menu/menu.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/new-components/modal/modal.d.ts +6 -2
- package/lib/new-components/modal/modal.js +1 -1
- package/lib/new-components/modal/modal.js.map +1 -1
- package/package.json +1 -1
|
@@ -2053,7 +2053,7 @@ function Badge(_ref) {
|
|
|
2053
2053
|
|
|
2054
2054
|
var modules_8f59d13b = {"overlay":"_868392ae","fadein":"_63d7ee15","fitContent":"b8548bf2","container":"_31956461","full":"_1007df83","large":"_10c275aa","medium":"_0ac526b4","small":"_30f38fdb","xlarge":"_54868e8b","expand":"c0bc68bc","buttonContainer":"_6527332a","headerContent":"_4750dc1b"};
|
|
2055
2055
|
|
|
2056
|
-
const _excluded$q = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"],
|
|
2056
|
+
const _excluded$q = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "exceptionallySetOverlayClassName", "autoFocus", "children"],
|
|
2057
2057
|
_excluded2$1 = ["children", "button", "withDivider", "exceptionallySetClassName"],
|
|
2058
2058
|
_excluded3 = ["exceptionallySetClassName", "children"],
|
|
2059
2059
|
_excluded4 = ["exceptionallySetClassName", "withDivider"],
|
|
@@ -2084,6 +2084,7 @@ function Modal(_ref) {
|
|
|
2084
2084
|
height = 'fitContent',
|
|
2085
2085
|
width = 'medium',
|
|
2086
2086
|
exceptionallySetClassName,
|
|
2087
|
+
exceptionallySetOverlayClassName,
|
|
2087
2088
|
autoFocus = true,
|
|
2088
2089
|
children
|
|
2089
2090
|
} = _ref,
|
|
@@ -2135,7 +2136,7 @@ function Modal(_ref) {
|
|
|
2135
2136
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
2136
2137
|
"data-testid": "modal-overlay",
|
|
2137
2138
|
"data-overlay": true,
|
|
2138
|
-
className: classNames(modules_8f59d13b.overlay, modules_8f59d13b[height], modules_8f59d13b[width]),
|
|
2139
|
+
className: classNames(modules_8f59d13b.overlay, modules_8f59d13b[height], modules_8f59d13b[width], exceptionallySetOverlayClassName),
|
|
2139
2140
|
onClick: handleBackdropClick,
|
|
2140
2141
|
ref: backdropRef
|
|
2141
2142
|
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
@@ -3299,9 +3300,10 @@ Time.defaultProps = {
|
|
|
3299
3300
|
|
|
3300
3301
|
const _excluded$v = ["children", "onItemSelect"],
|
|
3301
3302
|
_excluded2$3 = ["exceptionallySetClassName"],
|
|
3302
|
-
_excluded3$2 = ["
|
|
3303
|
-
_excluded4$1 = ["
|
|
3304
|
-
_excluded5$1 = ["
|
|
3303
|
+
_excluded3$2 = ["as"],
|
|
3304
|
+
_excluded4$1 = ["exceptionallySetClassName"],
|
|
3305
|
+
_excluded5$1 = ["value", "children", "onSelect", "hideOnSelect", "onClick", "exceptionallySetClassName", "as"],
|
|
3306
|
+
_excluded6 = ["label", "children", "exceptionallySetClassName"];
|
|
3305
3307
|
const MenuContext = /*#__PURE__*/React.createContext( // Ariakit gives us no means to obtain a valid initial/default value of type MenuStateReturn
|
|
3306
3308
|
// (it is normally obtained by calling useMenuState but we can't call hooks outside components).
|
|
3307
3309
|
// This is however of little consequence since this value is only used if some of the components
|
|
@@ -3321,17 +3323,23 @@ function Menu(_ref) {
|
|
|
3321
3323
|
} = _ref,
|
|
3322
3324
|
props = _objectWithoutProperties(_ref, _excluded$v);
|
|
3323
3325
|
|
|
3326
|
+
const [anchorRect, handleAnchorRectChange] = React.useState(null);
|
|
3327
|
+
const getAnchorRect = React.useMemo(() => {
|
|
3328
|
+
return anchorRect ? () => anchorRect : undefined;
|
|
3329
|
+
}, [anchorRect]);
|
|
3324
3330
|
const state = Ariakit.useMenuState(_objectSpread2({
|
|
3325
3331
|
focusLoop: true,
|
|
3326
3332
|
gutter: 8,
|
|
3327
|
-
shift: 4
|
|
3333
|
+
shift: 4,
|
|
3334
|
+
getAnchorRect
|
|
3328
3335
|
}, props));
|
|
3329
3336
|
const handleItemSelect = React.useCallback(function handleItemSelect(value) {
|
|
3330
3337
|
if (onItemSelect) onItemSelect(value);
|
|
3331
3338
|
}, [onItemSelect]);
|
|
3332
3339
|
const value = React.useMemo(() => ({
|
|
3333
3340
|
state,
|
|
3334
|
-
handleItemSelect
|
|
3341
|
+
handleItemSelect,
|
|
3342
|
+
handleAnchorRectChange
|
|
3335
3343
|
}), [state, handleItemSelect]);
|
|
3336
3344
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
3337
3345
|
value: value
|
|
@@ -3356,36 +3364,60 @@ const MenuButton = /*#__PURE__*/polymorphicComponent(function MenuButton(_ref2,
|
|
|
3356
3364
|
ref: ref,
|
|
3357
3365
|
className: classNames('reactist_menubutton', exceptionallySetClassName)
|
|
3358
3366
|
}));
|
|
3367
|
+
}); //
|
|
3368
|
+
// ContextMenuTrigger
|
|
3369
|
+
//
|
|
3370
|
+
|
|
3371
|
+
const ContextMenuTrigger = /*#__PURE__*/polymorphicComponent(function ContextMenuTrigger(_ref3, ref) {
|
|
3372
|
+
let {
|
|
3373
|
+
as: component = 'div'
|
|
3374
|
+
} = _ref3,
|
|
3375
|
+
props = _objectWithoutProperties(_ref3, _excluded3$2);
|
|
3376
|
+
|
|
3377
|
+
const {
|
|
3378
|
+
handleAnchorRectChange,
|
|
3379
|
+
state
|
|
3380
|
+
} = React.useContext(MenuContext);
|
|
3381
|
+
const handleContextMenu = React.useCallback(event => {
|
|
3382
|
+
event.preventDefault();
|
|
3383
|
+
handleAnchorRectChange({
|
|
3384
|
+
x: event.clientX,
|
|
3385
|
+
y: event.clientY
|
|
3386
|
+
});
|
|
3387
|
+
state.show();
|
|
3388
|
+
}, [handleAnchorRectChange, state]);
|
|
3389
|
+
return /*#__PURE__*/React.createElement(component, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3390
|
+
onContextMenu: handleContextMenu,
|
|
3391
|
+
ref
|
|
3392
|
+
}));
|
|
3359
3393
|
});
|
|
3360
3394
|
/**
|
|
3361
3395
|
* The dropdown menu itself, containing a list of menu items.
|
|
3362
3396
|
*/
|
|
3363
3397
|
|
|
3364
|
-
const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(
|
|
3398
|
+
const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref4, ref) {
|
|
3365
3399
|
let {
|
|
3366
3400
|
exceptionallySetClassName
|
|
3367
|
-
} =
|
|
3368
|
-
props = _objectWithoutProperties(
|
|
3401
|
+
} = _ref4,
|
|
3402
|
+
props = _objectWithoutProperties(_ref4, _excluded4$1);
|
|
3369
3403
|
|
|
3370
3404
|
const {
|
|
3371
3405
|
state
|
|
3372
3406
|
} = React.useContext(MenuContext);
|
|
3373
3407
|
return state.visible ? /*#__PURE__*/React.createElement(portal.Portal, {
|
|
3374
3408
|
preserveTabOrder: true
|
|
3375
|
-
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
3376
|
-
returnFocus: true
|
|
3377
3409
|
}, /*#__PURE__*/React.createElement(Ariakit.Menu, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3378
3410
|
state: state,
|
|
3379
3411
|
ref: ref,
|
|
3380
3412
|
className: classNames('reactist_menulist', exceptionallySetClassName)
|
|
3381
|
-
})))
|
|
3413
|
+
}))) : null;
|
|
3382
3414
|
});
|
|
3383
3415
|
/**
|
|
3384
3416
|
* A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`
|
|
3385
3417
|
* callback.
|
|
3386
3418
|
*/
|
|
3387
3419
|
|
|
3388
|
-
const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(
|
|
3420
|
+
const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref5, ref) {
|
|
3389
3421
|
let {
|
|
3390
3422
|
value,
|
|
3391
3423
|
children,
|
|
@@ -3394,8 +3426,8 @@ const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref4, ref)
|
|
|
3394
3426
|
onClick,
|
|
3395
3427
|
exceptionallySetClassName,
|
|
3396
3428
|
as = 'button'
|
|
3397
|
-
} =
|
|
3398
|
-
props = _objectWithoutProperties(
|
|
3429
|
+
} = _ref5,
|
|
3430
|
+
props = _objectWithoutProperties(_ref5, _excluded5$1);
|
|
3399
3431
|
|
|
3400
3432
|
const {
|
|
3401
3433
|
handleItemSelect,
|
|
@@ -3458,16 +3490,20 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
|
3458
3490
|
parentMenuItemSelect(value);
|
|
3459
3491
|
parentMenuHide();
|
|
3460
3492
|
}, [parentMenuHide, parentMenuItemSelect, onItemSelect]);
|
|
3461
|
-
const [button, list] = React.Children.toArray(children);
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3493
|
+
const [button, list] = React.Children.toArray(children); // Ariakit needs to be able to pass props to the MenuButton
|
|
3494
|
+
// and combine it with the MenuItem component
|
|
3495
|
+
|
|
3496
|
+
const renderMenuButton = React.useCallback(function renderMenuButton(props) {
|
|
3497
|
+
return /*#__PURE__*/React.cloneElement(button, props);
|
|
3498
|
+
}, [button]);
|
|
3465
3499
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
3466
3500
|
onItemSelect: handleSubItemSelect
|
|
3467
|
-
}, /*#__PURE__*/React.
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3501
|
+
}, /*#__PURE__*/React.createElement(Ariakit.MenuItem, {
|
|
3502
|
+
as: "div",
|
|
3503
|
+
state: state,
|
|
3504
|
+
ref: ref,
|
|
3505
|
+
hideOnClick: false
|
|
3506
|
+
}, renderMenuButton), list);
|
|
3471
3507
|
});
|
|
3472
3508
|
/**
|
|
3473
3509
|
* A way to semantically group some menu items.
|
|
@@ -3476,13 +3512,13 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
|
3476
3512
|
* before and/or after the group if you so wish.
|
|
3477
3513
|
*/
|
|
3478
3514
|
|
|
3479
|
-
const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(
|
|
3515
|
+
const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(_ref6, ref) {
|
|
3480
3516
|
let {
|
|
3481
3517
|
label,
|
|
3482
3518
|
children,
|
|
3483
3519
|
exceptionallySetClassName
|
|
3484
|
-
} =
|
|
3485
|
-
props = _objectWithoutProperties(
|
|
3520
|
+
} = _ref6,
|
|
3521
|
+
props = _objectWithoutProperties(_ref6, _excluded6);
|
|
3486
3522
|
|
|
3487
3523
|
const {
|
|
3488
3524
|
state
|
|
@@ -3834,6 +3870,7 @@ exports.CheckboxField = CheckboxField;
|
|
|
3834
3870
|
exports.ColorPicker = ColorPicker;
|
|
3835
3871
|
exports.Column = Column;
|
|
3836
3872
|
exports.Columns = Columns;
|
|
3873
|
+
exports.ContextMenuTrigger = ContextMenuTrigger;
|
|
3837
3874
|
exports.DeprecatedButton = Button$1;
|
|
3838
3875
|
exports.DeprecatedDropdown = Dropdown;
|
|
3839
3876
|
exports.DeprecatedInput = Input;
|