@doist/reactist 17.0.0 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/reactist.cjs.development.js +62 -26
- 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/checkbox-field/checkbox-field.module.css.js +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/checkbox-field/checkbox-field.module.css.js +1 -1
- package/package.json +1 -1
- package/styles/checkbox-field.css +1 -1
- package/styles/checkbox-field.module.css.css +1 -1
- package/styles/reactist.css +1 -1
|
@@ -1486,7 +1486,7 @@ function CheckboxIcon(_ref) {
|
|
|
1486
1486
|
}));
|
|
1487
1487
|
}
|
|
1488
1488
|
|
|
1489
|
-
var modules_664a6a80 = {"container":"
|
|
1489
|
+
var modules_664a6a80 = {"container":"_699e1db3","disabled":"_75d63cc5","checked":"_9b28a965","keyFocused":"f892a2b4"};
|
|
1490
1490
|
|
|
1491
1491
|
const _excluded$i = ["label", "disabled", "indeterminate", "defaultChecked", "onChange"];
|
|
1492
1492
|
const CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, ref) {
|
|
@@ -3299,9 +3299,10 @@ Time.defaultProps = {
|
|
|
3299
3299
|
|
|
3300
3300
|
const _excluded$v = ["children", "onItemSelect"],
|
|
3301
3301
|
_excluded2$3 = ["exceptionallySetClassName"],
|
|
3302
|
-
_excluded3$2 = ["
|
|
3303
|
-
_excluded4$1 = ["
|
|
3304
|
-
_excluded5$1 = ["
|
|
3302
|
+
_excluded3$2 = ["as"],
|
|
3303
|
+
_excluded4$1 = ["exceptionallySetClassName"],
|
|
3304
|
+
_excluded5$1 = ["value", "children", "onSelect", "hideOnSelect", "onClick", "exceptionallySetClassName", "as"],
|
|
3305
|
+
_excluded6 = ["label", "children", "exceptionallySetClassName"];
|
|
3305
3306
|
const MenuContext = /*#__PURE__*/React.createContext( // Ariakit gives us no means to obtain a valid initial/default value of type MenuStateReturn
|
|
3306
3307
|
// (it is normally obtained by calling useMenuState but we can't call hooks outside components).
|
|
3307
3308
|
// This is however of little consequence since this value is only used if some of the components
|
|
@@ -3321,17 +3322,23 @@ function Menu(_ref) {
|
|
|
3321
3322
|
} = _ref,
|
|
3322
3323
|
props = _objectWithoutProperties(_ref, _excluded$v);
|
|
3323
3324
|
|
|
3325
|
+
const [anchorRect, handleAnchorRectChange] = React.useState(null);
|
|
3326
|
+
const getAnchorRect = React.useMemo(() => {
|
|
3327
|
+
return anchorRect ? () => anchorRect : undefined;
|
|
3328
|
+
}, [anchorRect]);
|
|
3324
3329
|
const state = Ariakit.useMenuState(_objectSpread2({
|
|
3325
3330
|
focusLoop: true,
|
|
3326
3331
|
gutter: 8,
|
|
3327
|
-
shift: 4
|
|
3332
|
+
shift: 4,
|
|
3333
|
+
getAnchorRect
|
|
3328
3334
|
}, props));
|
|
3329
3335
|
const handleItemSelect = React.useCallback(function handleItemSelect(value) {
|
|
3330
3336
|
if (onItemSelect) onItemSelect(value);
|
|
3331
3337
|
}, [onItemSelect]);
|
|
3332
3338
|
const value = React.useMemo(() => ({
|
|
3333
3339
|
state,
|
|
3334
|
-
handleItemSelect
|
|
3340
|
+
handleItemSelect,
|
|
3341
|
+
handleAnchorRectChange
|
|
3335
3342
|
}), [state, handleItemSelect]);
|
|
3336
3343
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
3337
3344
|
value: value
|
|
@@ -3356,36 +3363,60 @@ const MenuButton = /*#__PURE__*/polymorphicComponent(function MenuButton(_ref2,
|
|
|
3356
3363
|
ref: ref,
|
|
3357
3364
|
className: classNames('reactist_menubutton', exceptionallySetClassName)
|
|
3358
3365
|
}));
|
|
3366
|
+
}); //
|
|
3367
|
+
// ContextMenuTrigger
|
|
3368
|
+
//
|
|
3369
|
+
|
|
3370
|
+
const ContextMenuTrigger = /*#__PURE__*/polymorphicComponent(function ContextMenuTrigger(_ref3, ref) {
|
|
3371
|
+
let {
|
|
3372
|
+
as: component = 'div'
|
|
3373
|
+
} = _ref3,
|
|
3374
|
+
props = _objectWithoutProperties(_ref3, _excluded3$2);
|
|
3375
|
+
|
|
3376
|
+
const {
|
|
3377
|
+
handleAnchorRectChange,
|
|
3378
|
+
state
|
|
3379
|
+
} = React.useContext(MenuContext);
|
|
3380
|
+
const handleContextMenu = React.useCallback(event => {
|
|
3381
|
+
event.preventDefault();
|
|
3382
|
+
handleAnchorRectChange({
|
|
3383
|
+
x: event.clientX,
|
|
3384
|
+
y: event.clientY
|
|
3385
|
+
});
|
|
3386
|
+
state.show();
|
|
3387
|
+
}, [handleAnchorRectChange, state]);
|
|
3388
|
+
return /*#__PURE__*/React.createElement(component, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3389
|
+
onContextMenu: handleContextMenu,
|
|
3390
|
+
ref
|
|
3391
|
+
}));
|
|
3359
3392
|
});
|
|
3360
3393
|
/**
|
|
3361
3394
|
* The dropdown menu itself, containing a list of menu items.
|
|
3362
3395
|
*/
|
|
3363
3396
|
|
|
3364
|
-
const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(
|
|
3397
|
+
const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref4, ref) {
|
|
3365
3398
|
let {
|
|
3366
3399
|
exceptionallySetClassName
|
|
3367
|
-
} =
|
|
3368
|
-
props = _objectWithoutProperties(
|
|
3400
|
+
} = _ref4,
|
|
3401
|
+
props = _objectWithoutProperties(_ref4, _excluded4$1);
|
|
3369
3402
|
|
|
3370
3403
|
const {
|
|
3371
3404
|
state
|
|
3372
3405
|
} = React.useContext(MenuContext);
|
|
3373
3406
|
return state.visible ? /*#__PURE__*/React.createElement(portal.Portal, {
|
|
3374
3407
|
preserveTabOrder: true
|
|
3375
|
-
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
3376
|
-
returnFocus: true
|
|
3377
3408
|
}, /*#__PURE__*/React.createElement(Ariakit.Menu, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3378
3409
|
state: state,
|
|
3379
3410
|
ref: ref,
|
|
3380
3411
|
className: classNames('reactist_menulist', exceptionallySetClassName)
|
|
3381
|
-
})))
|
|
3412
|
+
}))) : null;
|
|
3382
3413
|
});
|
|
3383
3414
|
/**
|
|
3384
3415
|
* A menu item inside a menu list. It can be selected by the user, triggering the `onSelect`
|
|
3385
3416
|
* callback.
|
|
3386
3417
|
*/
|
|
3387
3418
|
|
|
3388
|
-
const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(
|
|
3419
|
+
const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref5, ref) {
|
|
3389
3420
|
let {
|
|
3390
3421
|
value,
|
|
3391
3422
|
children,
|
|
@@ -3394,8 +3425,8 @@ const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref4, ref)
|
|
|
3394
3425
|
onClick,
|
|
3395
3426
|
exceptionallySetClassName,
|
|
3396
3427
|
as = 'button'
|
|
3397
|
-
} =
|
|
3398
|
-
props = _objectWithoutProperties(
|
|
3428
|
+
} = _ref5,
|
|
3429
|
+
props = _objectWithoutProperties(_ref5, _excluded5$1);
|
|
3399
3430
|
|
|
3400
3431
|
const {
|
|
3401
3432
|
handleItemSelect,
|
|
@@ -3458,16 +3489,20 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
|
3458
3489
|
parentMenuItemSelect(value);
|
|
3459
3490
|
parentMenuHide();
|
|
3460
3491
|
}, [parentMenuHide, parentMenuItemSelect, onItemSelect]);
|
|
3461
|
-
const [button, list] = React.Children.toArray(children);
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3492
|
+
const [button, list] = React.Children.toArray(children); // Ariakit needs to be able to pass props to the MenuButton
|
|
3493
|
+
// and combine it with the MenuItem component
|
|
3494
|
+
|
|
3495
|
+
const renderMenuButton = React.useCallback(function renderMenuButton(props) {
|
|
3496
|
+
return /*#__PURE__*/React.cloneElement(button, props);
|
|
3497
|
+
}, [button]);
|
|
3465
3498
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
3466
3499
|
onItemSelect: handleSubItemSelect
|
|
3467
|
-
}, /*#__PURE__*/React.
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3500
|
+
}, /*#__PURE__*/React.createElement(Ariakit.MenuItem, {
|
|
3501
|
+
as: "div",
|
|
3502
|
+
state: state,
|
|
3503
|
+
ref: ref,
|
|
3504
|
+
hideOnClick: false
|
|
3505
|
+
}, renderMenuButton), list);
|
|
3471
3506
|
});
|
|
3472
3507
|
/**
|
|
3473
3508
|
* A way to semantically group some menu items.
|
|
@@ -3476,13 +3511,13 @@ const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
|
3476
3511
|
* before and/or after the group if you so wish.
|
|
3477
3512
|
*/
|
|
3478
3513
|
|
|
3479
|
-
const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(
|
|
3514
|
+
const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(_ref6, ref) {
|
|
3480
3515
|
let {
|
|
3481
3516
|
label,
|
|
3482
3517
|
children,
|
|
3483
3518
|
exceptionallySetClassName
|
|
3484
|
-
} =
|
|
3485
|
-
props = _objectWithoutProperties(
|
|
3519
|
+
} = _ref6,
|
|
3520
|
+
props = _objectWithoutProperties(_ref6, _excluded6);
|
|
3486
3521
|
|
|
3487
3522
|
const {
|
|
3488
3523
|
state
|
|
@@ -3834,6 +3869,7 @@ exports.CheckboxField = CheckboxField;
|
|
|
3834
3869
|
exports.ColorPicker = ColorPicker;
|
|
3835
3870
|
exports.Column = Column;
|
|
3836
3871
|
exports.Columns = Columns;
|
|
3872
|
+
exports.ContextMenuTrigger = ContextMenuTrigger;
|
|
3837
3873
|
exports.DeprecatedButton = Button$1;
|
|
3838
3874
|
exports.DeprecatedDropdown = Dropdown;
|
|
3839
3875
|
exports.DeprecatedInput = Input;
|