@box/blueprint-web 19.6.0 → 20.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/THIRD_PARTY_LICENSES +119 -0
- package/dist/lib-esm/accordion/accordion.js +6 -6
- package/dist/lib-esm/accordion/types.d.ts +1 -1
- package/dist/lib-esm/checkbox/checkbox-item.js +3 -3
- package/dist/lib-esm/checkbox/types.d.ts +1 -1
- package/dist/lib-esm/collapsible/collapsible-section.js +5 -5
- package/dist/lib-esm/collapsible/types.d.ts +1 -1
- package/dist/lib-esm/combobox-group/combobox-group-combobox.js +1 -1
- package/dist/lib-esm/date-picker/date-picker.js +8 -7
- package/dist/lib-esm/guided-tooltip/guided-tooltip.js +7 -7
- package/dist/lib-esm/guided-tooltip/types.d.ts +1 -1
- package/dist/lib-esm/modal/alert-modal.types.d.ts +1 -1
- package/dist/lib-esm/modal/modal-close.js +2 -2
- package/dist/lib-esm/modal/modal-content.d.ts +1 -1
- package/dist/lib-esm/modal/modal-content.js +4 -4
- package/dist/lib-esm/modal/modal-description.js +2 -2
- package/dist/lib-esm/modal/modal-title.js +2 -2
- package/dist/lib-esm/modal/modal-trigger.js +2 -2
- package/dist/lib-esm/modal/modal.d.ts +1 -1
- package/dist/lib-esm/modal/modal.js +1 -1
- package/dist/lib-esm/modal/types.d.ts +1 -1
- package/dist/lib-esm/navigation-menu/index.d.ts +4 -2
- package/dist/lib-esm/navigation-menu/navigation-menu-item.d.ts +1 -1
- package/dist/lib-esm/navigation-menu/navigation-menu-trigger.d.ts +3 -1
- package/dist/lib-esm/primitives/chips/chip.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/chip.js +2 -2
- package/dist/lib-esm/primitives/chips/chips-group.js +2 -2
- package/dist/lib-esm/primitives/chips/filter-chip/filter-chip-button.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/filter-chip/filter-chip.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/filter-chip/filter-combo-chip.d.ts +2 -2
- package/dist/lib-esm/primitives/chips/filter-chip/filter-trigger-chip.d.ts +1 -1
- package/dist/lib-esm/primitives/chips/filter-chip/index.d.ts +5 -5
- package/dist/lib-esm/primitives/chips/types.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-item.d.ts +2 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-item.js +2 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-content.js +5 -5
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-header.js +3 -10
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-root.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-trigger.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-trigger.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-content.js +5 -5
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-root.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-trigger.d.ts +2 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-trigger.js +1 -1
- package/dist/lib-esm/primitives/context-menu/index.d.ts +3 -3
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-checkbox-item.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-checkbox-item.js +3 -3
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-content.js +5 -5
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-group.d.ts +4 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-group.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-item.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-item.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-group.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-group.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-select-item.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-radio-select-item.js +3 -3
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-root.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-header.d.ts +4 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-header.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-content.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-content.js +5 -5
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-root.d.ts +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-root.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-trigger.d.ts +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-sub-menu-trigger.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-trigger.d.ts +4 -2
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu-trigger.js +2 -2
- package/dist/lib-esm/primitives/dropdown-menu/index.d.ts +14 -8
- package/dist/lib-esm/primitives/notification/hooks/use-notification-layer.d.ts +15 -0
- package/dist/lib-esm/primitives/notification/hooks/use-notification-layer.js +49 -0
- package/dist/lib-esm/primitives/notification/notification-provider.js +2 -2
- package/dist/lib-esm/primitives/notification/notification.viewport-animated.js +12 -8
- package/dist/lib-esm/primitives/notification/notification.viewport.js +5 -1
- package/dist/lib-esm/primitives/notification/private-notification-element-animated.js +44 -6
- package/dist/lib-esm/primitives/notification/private-notification-element.js +34 -4
- package/dist/lib-esm/primitives/popover/index.d.ts +11 -5
- package/dist/lib-esm/primitives/popover/popover-anchor.d.ts +4 -2
- package/dist/lib-esm/primitives/popover/popover-anchor.js +2 -2
- package/dist/lib-esm/primitives/popover/popover-close.d.ts +4 -2
- package/dist/lib-esm/primitives/popover/popover-close.js +2 -2
- package/dist/lib-esm/primitives/popover/popover-content-container.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-content-container.js +3 -3
- package/dist/lib-esm/primitives/popover/popover-footer.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-main-content.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-root.d.ts +1 -1
- package/dist/lib-esm/primitives/popover/popover-root.js +2 -2
- package/dist/lib-esm/primitives/popover/popover-trigger.d.ts +4 -2
- package/dist/lib-esm/primitives/popover/popover-trigger.js +2 -2
- package/dist/lib-esm/radio-group/index.d.ts +1 -1
- package/dist/lib-esm/radio-group/radio-group.d.ts +1 -1
- package/dist/lib-esm/radio-group/radio-group.js +2 -2
- package/dist/lib-esm/radio-group/radio-item.js +3 -3
- package/dist/lib-esm/radio-group/types.d.ts +1 -1
- package/dist/lib-esm/select/select.js +12 -12
- package/dist/lib-esm/select/types.d.ts +1 -1
- package/dist/lib-esm/select/utils/use-select-exit-animation.d.ts +3 -3
- package/dist/lib-esm/select/utils/use-select-exit-animation.js +3 -3
- package/dist/lib-esm/side-panel/side-panel-close.js +2 -2
- package/dist/lib-esm/side-panel/side-panel-content.js +3 -3
- package/dist/lib-esm/side-panel/side-panel-header.js +2 -2
- package/dist/lib-esm/side-panel/side-panel-overlay.js +3 -3
- package/dist/lib-esm/side-panel/side-panel-trigger.js +2 -2
- package/dist/lib-esm/side-panel/side-panel.js +1 -1
- package/dist/lib-esm/side-panel/types.d.ts +1 -1
- package/dist/lib-esm/switch/switch-item.js +3 -3
- package/dist/lib-esm/switch/types.d.ts +1 -1
- package/dist/lib-esm/toolbar/index.d.ts +2 -2
- package/dist/lib-esm/toolbar/toolbar-button.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-input.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-link.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-root.js +3 -3
- package/dist/lib-esm/toolbar/toolbar-separator.d.ts +1 -1
- package/dist/lib-esm/toolbar/toolbar-separator.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-text-toggle-item.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-toggle-group.d.ts +1 -2
- package/dist/lib-esm/toolbar/toolbar-toggle-group.js +2 -2
- package/dist/lib-esm/toolbar/toolbar-toggle-item.js +2 -2
- package/dist/lib-esm/toolbar/types.d.ts +1 -1
- package/dist/lib-esm/tooltip/tooltip.d.ts +1 -1
- package/dist/lib-esm/tooltip/tooltip.js +6 -6
- package/dist/lib-esm/tooltip/types.d.ts +1 -1
- package/dist/lib-esm/utils/radix-compat/accordion.d.ts +45 -0
- package/dist/lib-esm/utils/radix-compat/accordion.js +299 -0
- package/dist/lib-esm/utils/radix-compat/allow-auto-focus.d.ts +9 -0
- package/dist/lib-esm/utils/radix-compat/allow-auto-focus.js +16 -0
- package/dist/lib-esm/utils/radix-compat/bubble-input.d.ts +14 -0
- package/dist/lib-esm/utils/radix-compat/bubble-input.js +70 -0
- package/dist/lib-esm/utils/radix-compat/button-controls.d.ts +9 -0
- package/dist/lib-esm/utils/radix-compat/button-controls.js +6 -0
- package/dist/lib-esm/utils/radix-compat/checkbox.d.ts +18 -0
- package/dist/lib-esm/utils/radix-compat/checkbox.js +131 -0
- package/dist/lib-esm/utils/radix-compat/collapsible.d.ts +33 -0
- package/dist/lib-esm/utils/radix-compat/collapsible.js +133 -0
- package/dist/lib-esm/utils/radix-compat/collection.d.ts +21 -0
- package/dist/lib-esm/utils/radix-compat/collection.js +82 -0
- package/dist/lib-esm/utils/radix-compat/compose-refs.d.ts +8 -0
- package/dist/lib-esm/utils/radix-compat/compose-refs.js +44 -0
- package/dist/lib-esm/utils/radix-compat/content-size.d.ts +15 -0
- package/dist/lib-esm/utils/radix-compat/content-size.js +61 -0
- package/dist/lib-esm/utils/radix-compat/context-menu.d.ts +56 -0
- package/dist/lib-esm/utils/radix-compat/context-menu.js +191 -0
- package/dist/lib-esm/utils/radix-compat/dialog.d.ts +50 -0
- package/dist/lib-esm/utils/radix-compat/dialog.js +367 -0
- package/dist/lib-esm/utils/radix-compat/dismiss-marker.d.ts +5 -0
- package/dist/lib-esm/utils/radix-compat/dismiss-marker.js +12 -0
- package/dist/lib-esm/utils/radix-compat/dismissable.d.ts +34 -0
- package/dist/lib-esm/utils/radix-compat/dismissable.js +205 -0
- package/dist/lib-esm/utils/radix-compat/dropdown-menu.d.ts +57 -0
- package/dist/lib-esm/utils/radix-compat/dropdown-menu.js +187 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope-component.d.ts +16 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope-component.js +41 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope.d.ts +37 -0
- package/dist/lib-esm/utils/radix-compat/focus-scope.js +288 -0
- package/dist/lib-esm/utils/radix-compat/hide-others.d.ts +6 -0
- package/dist/lib-esm/utils/radix-compat/hide-others.js +18 -0
- package/dist/lib-esm/utils/radix-compat/index.d.ts +14 -0
- package/dist/lib-esm/utils/radix-compat/layers.d.ts +25 -0
- package/dist/lib-esm/utils/radix-compat/layers.js +61 -0
- package/dist/lib-esm/utils/radix-compat/menu.d.ts +98 -0
- package/dist/lib-esm/utils/radix-compat/menu.js +1041 -0
- package/dist/lib-esm/utils/radix-compat/popover.d.ts +44 -0
- package/dist/lib-esm/utils/radix-compat/popover.js +386 -0
- package/dist/lib-esm/utils/radix-compat/popper.d.ts +60 -0
- package/dist/lib-esm/utils/radix-compat/popper.js +416 -0
- package/dist/lib-esm/utils/radix-compat/portal.d.ts +11 -0
- package/dist/lib-esm/utils/radix-compat/portal.js +20 -0
- package/dist/lib-esm/utils/radix-compat/presence.d.ts +20 -0
- package/dist/lib-esm/utils/radix-compat/presence.js +110 -0
- package/dist/lib-esm/utils/radix-compat/radio-group.d.ts +27 -0
- package/dist/lib-esm/utils/radix-compat/radio-group.js +189 -0
- package/dist/lib-esm/utils/radix-compat/roving-focus.d.ts +35 -0
- package/dist/lib-esm/utils/radix-compat/roving-focus.js +237 -0
- package/dist/lib-esm/utils/radix-compat/select.d.ts +82 -0
- package/dist/lib-esm/utils/radix-compat/select.js +901 -0
- package/dist/lib-esm/utils/radix-compat/slot.d.ts +31 -0
- package/dist/lib-esm/utils/radix-compat/slot.js +119 -0
- package/dist/lib-esm/utils/radix-compat/store-options.d.ts +8 -0
- package/dist/lib-esm/utils/radix-compat/store-options.js +10 -0
- package/dist/lib-esm/utils/radix-compat/switch.d.ts +16 -0
- package/dist/lib-esm/utils/radix-compat/switch.js +97 -0
- package/dist/lib-esm/utils/radix-compat/toggle-group.d.ts +41 -0
- package/dist/lib-esm/utils/radix-compat/toggle-group.js +195 -0
- package/dist/lib-esm/utils/radix-compat/toolbar.d.ts +32 -0
- package/dist/lib-esm/utils/radix-compat/toolbar.js +136 -0
- package/dist/lib-esm/utils/radix-compat/tooltip.d.ts +59 -0
- package/dist/lib-esm/utils/radix-compat/tooltip.js +636 -0
- package/dist/lib-esm/utils/radix-compat/typeahead.d.ts +22 -0
- package/dist/lib-esm/utils/radix-compat/typeahead.js +64 -0
- package/dist/lib-esm/utils/radix-compat/types.d.ts +53 -0
- package/dist/lib-esm/utils/radix-compat/viewport-height.d.ts +5 -0
- package/dist/lib-esm/utils/radix-compat/viewport-height.js +28 -0
- package/dist/lib-esm/utils/radix-compat/visually-hidden.d.ts +2 -0
- package/dist/lib-esm/utils/radix-compat/visually-hidden.js +24 -0
- package/package.json +8 -19
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useState, useRef, useEffect, useContext, createContext } from 'react';
|
|
3
|
+
import { composeEventHandlers } from '../composeEventHandlers.js';
|
|
4
|
+
import { useControllableState } from '../useControllableState.js';
|
|
5
|
+
import { BubbleInput } from './bubble-input.js';
|
|
6
|
+
import { ButtonCheckbox } from './button-controls.js';
|
|
7
|
+
import { useComposedRefs } from './compose-refs.js';
|
|
8
|
+
import { Presence } from './presence.js';
|
|
9
|
+
import { Slot } from './slot.js';
|
|
10
|
+
|
|
11
|
+
function isIndeterminate(checked) {
|
|
12
|
+
return checked === 'indeterminate';
|
|
13
|
+
}
|
|
14
|
+
function getState(checked) {
|
|
15
|
+
if (isIndeterminate(checked)) {
|
|
16
|
+
return 'indeterminate';
|
|
17
|
+
}
|
|
18
|
+
return checked ? 'checked' : 'unchecked';
|
|
19
|
+
}
|
|
20
|
+
const CheckboxContext = /*#__PURE__*/createContext({
|
|
21
|
+
state: false
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Checkbox rendered as a `<button role="checkbox">` with the Radix API and DOM
|
|
25
|
+
* (`data-state`, `data-disabled`, hidden form input), on top of the Ariakit `Checkbox`.
|
|
26
|
+
*/
|
|
27
|
+
const Root = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
28
|
+
const {
|
|
29
|
+
name,
|
|
30
|
+
checked: checkedProp,
|
|
31
|
+
defaultChecked,
|
|
32
|
+
required,
|
|
33
|
+
disabled,
|
|
34
|
+
value = 'on',
|
|
35
|
+
onCheckedChange,
|
|
36
|
+
asChild,
|
|
37
|
+
...checkboxProps
|
|
38
|
+
} = props;
|
|
39
|
+
const [button, setButton] = useState(null);
|
|
40
|
+
const composedRefs = useComposedRefs(forwardedRef, setButton);
|
|
41
|
+
const hasConsumerStoppedPropagationRef = useRef(false);
|
|
42
|
+
// Only a checkbox inside a form needs the hidden input. Until the button mounts it renders, like in Radix.
|
|
43
|
+
const isFormControl = button ? Boolean(button.closest('form')) : true;
|
|
44
|
+
const [checked = false, setChecked] = useControllableState({
|
|
45
|
+
prop: checkedProp,
|
|
46
|
+
defaultProp: defaultChecked,
|
|
47
|
+
onChange: onCheckedChange
|
|
48
|
+
});
|
|
49
|
+
const initialCheckedStateRef = useRef(checked);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const form = button?.form;
|
|
52
|
+
if (!form) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const reset = () => setChecked(initialCheckedStateRef.current);
|
|
56
|
+
form.addEventListener('reset', reset);
|
|
57
|
+
return () => form.removeEventListener('reset', reset);
|
|
58
|
+
}, [button, setChecked]);
|
|
59
|
+
return jsxs(CheckboxContext.Provider, {
|
|
60
|
+
value: {
|
|
61
|
+
state: checked,
|
|
62
|
+
disabled
|
|
63
|
+
},
|
|
64
|
+
children: [jsx(ButtonCheckbox, {
|
|
65
|
+
"aria-required": required,
|
|
66
|
+
checked: isIndeterminate(checked) ? 'mixed' : checked,
|
|
67
|
+
clickOnEnter: false,
|
|
68
|
+
"data-disabled": disabled ? '' : undefined,
|
|
69
|
+
"data-state": getState(checked),
|
|
70
|
+
...checkboxProps,
|
|
71
|
+
ref: composedRefs,
|
|
72
|
+
// Radix ignores Enter on checkboxes, as per WAI-ARIA.
|
|
73
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, event => {
|
|
74
|
+
if (event.key === 'Enter') {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
onClick: composeEventHandlers(props.onClick, event => {
|
|
79
|
+
setChecked(prevChecked => isIndeterminate(prevChecked) ? true : !prevChecked);
|
|
80
|
+
if (isFormControl) {
|
|
81
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
82
|
+
// Inside a form only the hidden input propagates the click, so form events reflect the change.
|
|
83
|
+
if (!hasConsumerStoppedPropagationRef.current) {
|
|
84
|
+
event.stopPropagation();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}),
|
|
88
|
+
// Ariakit would also make a disabled checkbox `aria-disabled` and ignore pointer events, unlike Radix.
|
|
89
|
+
render: asChild ? jsx(Slot, {
|
|
90
|
+
disabled: disabled
|
|
91
|
+
}) : jsx("button", {
|
|
92
|
+
disabled: disabled,
|
|
93
|
+
type: "button",
|
|
94
|
+
value: value
|
|
95
|
+
})
|
|
96
|
+
}), isFormControl && jsx(BubbleInput, {
|
|
97
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
98
|
+
checked: checked,
|
|
99
|
+
control: button,
|
|
100
|
+
disabled: disabled,
|
|
101
|
+
name: name,
|
|
102
|
+
required: required,
|
|
103
|
+
value: value
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
Root.displayName = 'Checkbox';
|
|
108
|
+
const Indicator = /*#__PURE__*/forwardRef(({
|
|
109
|
+
forceMount,
|
|
110
|
+
asChild,
|
|
111
|
+
...indicatorProps
|
|
112
|
+
}, forwardedRef) => {
|
|
113
|
+
const context = useContext(CheckboxContext);
|
|
114
|
+
const Comp = asChild ? Slot : 'span';
|
|
115
|
+
return jsx(Presence, {
|
|
116
|
+
present: Boolean(forceMount) || isIndeterminate(context.state) || context.state === true,
|
|
117
|
+
children: jsx(Comp, {
|
|
118
|
+
"data-disabled": context.disabled ? '' : undefined,
|
|
119
|
+
"data-state": getState(context.state),
|
|
120
|
+
...indicatorProps,
|
|
121
|
+
ref: forwardedRef,
|
|
122
|
+
style: {
|
|
123
|
+
pointerEvents: 'none',
|
|
124
|
+
...indicatorProps.style
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
Indicator.displayName = 'CheckboxIndicator';
|
|
130
|
+
|
|
131
|
+
export { Indicator, Root };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useDisclosureStore } from '@ariakit/react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type PrimitiveProps } from './types';
|
|
4
|
+
export declare const getOpenState: (open?: boolean) => "open" | "closed";
|
|
5
|
+
interface CollapsibleContextValue {
|
|
6
|
+
contentId: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
open: boolean;
|
|
9
|
+
onOpenToggle(): void;
|
|
10
|
+
store: ReturnType<typeof useDisclosureStore>;
|
|
11
|
+
}
|
|
12
|
+
declare const useCollapsibleContext: () => CollapsibleContextValue;
|
|
13
|
+
export interface CollapsibleProps extends PrimitiveProps<'div'> {
|
|
14
|
+
defaultOpen?: boolean;
|
|
15
|
+
open?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
onOpenChange?(open: boolean): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Collapsible section with the Radix API and DOM (`data-state`, size CSS variables, content unmounted
|
|
21
|
+
* after its exit animation), with its state in an Ariakit disclosure store.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Root: import("react").ForwardRefExoticComponent<CollapsibleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export type CollapsibleTriggerProps = PrimitiveProps<'button'>;
|
|
25
|
+
export declare const Trigger: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
26
|
+
asChild?: boolean;
|
|
27
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
28
|
+
export interface CollapsibleContentProps extends PrimitiveProps<'div'> {
|
|
29
|
+
forceMount?: true;
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
export declare const Content: import("react").ForwardRefExoticComponent<CollapsibleContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
33
|
+
export { useCollapsibleContext };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useDisclosureStore, DisclosureContent } from '@ariakit/react';
|
|
3
|
+
import { forwardRef, useId, useCallback, createContext, useContext, useRef } from 'react';
|
|
4
|
+
import { composeEventHandlers } from '../composeEventHandlers.js';
|
|
5
|
+
import { useControllableState } from '../useControllableState.js';
|
|
6
|
+
import { useComposedRefs } from './compose-refs.js';
|
|
7
|
+
import { useCollapsibleContentSize } from './content-size.js';
|
|
8
|
+
import { Presence } from './presence.js';
|
|
9
|
+
import { Slot, getAsChildRender } from './slot.js';
|
|
10
|
+
|
|
11
|
+
const getOpenState = open => open ? 'open' : 'closed';
|
|
12
|
+
const CollapsibleContext = /*#__PURE__*/createContext(null);
|
|
13
|
+
const useCollapsibleContext = () => {
|
|
14
|
+
const context = useContext(CollapsibleContext);
|
|
15
|
+
if (!context) {
|
|
16
|
+
throw new Error('Collapsible parts must be used within Collapsible.Root');
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Collapsible section with the Radix API and DOM (`data-state`, size CSS variables, content unmounted
|
|
22
|
+
* after its exit animation), with its state in an Ariakit disclosure store.
|
|
23
|
+
*/
|
|
24
|
+
const Root = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
25
|
+
const {
|
|
26
|
+
open: openProp,
|
|
27
|
+
defaultOpen,
|
|
28
|
+
disabled,
|
|
29
|
+
onOpenChange,
|
|
30
|
+
asChild,
|
|
31
|
+
...collapsibleProps
|
|
32
|
+
} = props;
|
|
33
|
+
const [open = false, setOpen] = useControllableState({
|
|
34
|
+
prop: openProp,
|
|
35
|
+
defaultProp: defaultOpen,
|
|
36
|
+
onChange: onOpenChange
|
|
37
|
+
});
|
|
38
|
+
const store = useDisclosureStore({
|
|
39
|
+
open
|
|
40
|
+
});
|
|
41
|
+
const contentId = useId();
|
|
42
|
+
const onOpenToggle = useCallback(() => setOpen(prevOpen => !prevOpen), [setOpen]);
|
|
43
|
+
const Comp = asChild ? Slot : 'div';
|
|
44
|
+
return jsx(CollapsibleContext.Provider, {
|
|
45
|
+
value: {
|
|
46
|
+
contentId,
|
|
47
|
+
disabled,
|
|
48
|
+
open,
|
|
49
|
+
onOpenToggle,
|
|
50
|
+
store
|
|
51
|
+
},
|
|
52
|
+
children: jsx(Comp, {
|
|
53
|
+
"data-disabled": disabled ? '' : undefined,
|
|
54
|
+
"data-state": getOpenState(open),
|
|
55
|
+
...collapsibleProps,
|
|
56
|
+
ref: forwardedRef
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
Root.displayName = 'Collapsible';
|
|
61
|
+
const Trigger = /*#__PURE__*/forwardRef(({
|
|
62
|
+
asChild,
|
|
63
|
+
...triggerProps
|
|
64
|
+
}, forwardedRef) => {
|
|
65
|
+
const context = useCollapsibleContext();
|
|
66
|
+
const Comp = asChild ? Slot : 'button';
|
|
67
|
+
return jsx(Comp, {
|
|
68
|
+
"aria-controls": context.contentId,
|
|
69
|
+
"aria-expanded": context.open || false,
|
|
70
|
+
"data-disabled": context.disabled ? '' : undefined,
|
|
71
|
+
"data-state": getOpenState(context.open),
|
|
72
|
+
disabled: context.disabled,
|
|
73
|
+
type: "button",
|
|
74
|
+
...triggerProps,
|
|
75
|
+
ref: forwardedRef,
|
|
76
|
+
onClick: composeEventHandlers(triggerProps.onClick, context.onOpenToggle)
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
Trigger.displayName = 'CollapsibleTrigger';
|
|
80
|
+
const ContentImpl = /*#__PURE__*/forwardRef(({
|
|
81
|
+
present,
|
|
82
|
+
children,
|
|
83
|
+
asChild,
|
|
84
|
+
...contentProps
|
|
85
|
+
}, forwardedRef) => {
|
|
86
|
+
const context = useCollapsibleContext();
|
|
87
|
+
const ref = useRef(null);
|
|
88
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
89
|
+
const {
|
|
90
|
+
isOpen,
|
|
91
|
+
style
|
|
92
|
+
} = useCollapsibleContentSize(ref, {
|
|
93
|
+
open: context.open,
|
|
94
|
+
present,
|
|
95
|
+
cssVariablePrefixes: ['--radix-collapsible']
|
|
96
|
+
});
|
|
97
|
+
const asChildRender = getAsChildRender(asChild, children, contentChildren => isOpen && contentChildren);
|
|
98
|
+
return jsx(DisclosureContent, {
|
|
99
|
+
alwaysVisible: true,
|
|
100
|
+
"data-disabled": context.disabled ? '' : undefined,
|
|
101
|
+
"data-state": getOpenState(context.open),
|
|
102
|
+
hidden: !isOpen,
|
|
103
|
+
id: context.contentId,
|
|
104
|
+
render: asChildRender.render,
|
|
105
|
+
store: context.store,
|
|
106
|
+
...contentProps,
|
|
107
|
+
ref: composedRefs,
|
|
108
|
+
style: {
|
|
109
|
+
...style,
|
|
110
|
+
...contentProps.style
|
|
111
|
+
},
|
|
112
|
+
children: asChildRender.children
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
const Content = /*#__PURE__*/forwardRef(({
|
|
116
|
+
forceMount,
|
|
117
|
+
...contentProps
|
|
118
|
+
}, forwardedRef) => {
|
|
119
|
+
const context = useCollapsibleContext();
|
|
120
|
+
return jsx(Presence, {
|
|
121
|
+
present: Boolean(forceMount) || context.open,
|
|
122
|
+
children: ({
|
|
123
|
+
present
|
|
124
|
+
}) => jsx(ContentImpl, {
|
|
125
|
+
...contentProps,
|
|
126
|
+
ref: forwardedRef,
|
|
127
|
+
present: present
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
Content.displayName = 'CollapsibleContent';
|
|
132
|
+
|
|
133
|
+
export { Content, Root, Trigger, getOpenState, useCollapsibleContext };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
2
|
+
export declare const COLLECTION_ITEM_ATTRIBUTE = "data-radix-collection-item";
|
|
3
|
+
type ItemData = Record<string, unknown>;
|
|
4
|
+
export type CollectionItem<T extends ItemData> = T & {
|
|
5
|
+
ref: RefObject<HTMLElement | null>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A registry of items ordered like their elements in the DOM, as in the Radix `Collection`.
|
|
9
|
+
* Items rendered outside the collection element (for example in a portal) are listed first.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createCollection<T extends ItemData>(): {
|
|
12
|
+
CollectionProvider: ({ children }: {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
useCollection: () => () => CollectionItem<T>[];
|
|
16
|
+
useCollectionItem: (ref: RefObject<HTMLElement | null>, data: T) => {
|
|
17
|
+
"data-radix-collection-item": string;
|
|
18
|
+
};
|
|
19
|
+
useCollectionRef: () => (node: HTMLElement | null) => void;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useCallback, useEffect, useRef, useMemo, useContext, createContext } from 'react';
|
|
3
|
+
|
|
4
|
+
const COLLECTION_ITEM_ATTRIBUTE = 'data-radix-collection-item';
|
|
5
|
+
/**
|
|
6
|
+
* A registry of items ordered like their elements in the DOM, as in the Radix `Collection`.
|
|
7
|
+
* Items rendered outside the collection element (for example in a portal) are listed first.
|
|
8
|
+
*/
|
|
9
|
+
function createCollection() {
|
|
10
|
+
const Context = /*#__PURE__*/createContext(null);
|
|
11
|
+
const CollectionProvider = ({
|
|
12
|
+
children
|
|
13
|
+
}) => {
|
|
14
|
+
const collectionRef = useRef(null);
|
|
15
|
+
const itemMap = useRef(new Map()).current;
|
|
16
|
+
const value = useMemo(() => ({
|
|
17
|
+
collectionRef,
|
|
18
|
+
itemMap
|
|
19
|
+
}), [itemMap]);
|
|
20
|
+
return jsx(Context.Provider, {
|
|
21
|
+
value: value,
|
|
22
|
+
children: children
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const useCollectionContext = () => {
|
|
26
|
+
const context = useContext(Context);
|
|
27
|
+
if (!context) {
|
|
28
|
+
throw new Error('Collection item must be used within its collection provider');
|
|
29
|
+
}
|
|
30
|
+
return context;
|
|
31
|
+
};
|
|
32
|
+
/** Ref callback for the element that contains the collection items. */
|
|
33
|
+
const useCollectionRef = () => {
|
|
34
|
+
const {
|
|
35
|
+
collectionRef
|
|
36
|
+
} = useCollectionContext();
|
|
37
|
+
return useCallback(node => {
|
|
38
|
+
collectionRef.current = node;
|
|
39
|
+
}, [collectionRef]);
|
|
40
|
+
};
|
|
41
|
+
/** Registers an item. Returns the props to spread on the item element. */
|
|
42
|
+
const useCollectionItem = (ref, data) => {
|
|
43
|
+
const {
|
|
44
|
+
itemMap
|
|
45
|
+
} = useCollectionContext();
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
itemMap.set(ref, {
|
|
48
|
+
ref,
|
|
49
|
+
...data
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
useEffect(() => () => {
|
|
53
|
+
itemMap.delete(ref);
|
|
54
|
+
}, [itemMap, ref]);
|
|
55
|
+
return {
|
|
56
|
+
[COLLECTION_ITEM_ATTRIBUTE]: ''
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const useCollection = () => {
|
|
60
|
+
const {
|
|
61
|
+
collectionRef,
|
|
62
|
+
itemMap
|
|
63
|
+
} = useCollectionContext();
|
|
64
|
+
return useCallback(() => {
|
|
65
|
+
const collectionNode = collectionRef.current;
|
|
66
|
+
if (!collectionNode) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${COLLECTION_ITEM_ATTRIBUTE}]`));
|
|
70
|
+
const items = Array.from(itemMap.values());
|
|
71
|
+
return items.sort((a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current));
|
|
72
|
+
}, [collectionRef, itemMap]);
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
CollectionProvider,
|
|
76
|
+
useCollection,
|
|
77
|
+
useCollectionItem,
|
|
78
|
+
useCollectionRef
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { COLLECTION_ITEM_ATTRIBUTE, createCollection };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Ref, type RefCallback } from 'react';
|
|
2
|
+
type PossibleRef<T> = Ref<T> | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Combines refs into one callback ref. React 19 cleanup functions returned by callback refs are honored.
|
|
5
|
+
*/
|
|
6
|
+
export declare function composeRefs<T>(...refs: PossibleRef<T>[]): RefCallback<T>;
|
|
7
|
+
export declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): RefCallback<T>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
function setRef(ref, value) {
|
|
4
|
+
if (typeof ref === 'function') {
|
|
5
|
+
return ref(value);
|
|
6
|
+
}
|
|
7
|
+
if (ref !== null && ref !== undefined) {
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Combines refs into one callback ref. React 19 cleanup functions returned by callback refs are honored.
|
|
14
|
+
*/
|
|
15
|
+
function composeRefs(...refs) {
|
|
16
|
+
return node => {
|
|
17
|
+
let hasCleanup = false;
|
|
18
|
+
const cleanups = refs.map(ref => {
|
|
19
|
+
const cleanup = setRef(ref, node);
|
|
20
|
+
if (typeof cleanup === 'function') {
|
|
21
|
+
hasCleanup = true;
|
|
22
|
+
}
|
|
23
|
+
return cleanup;
|
|
24
|
+
});
|
|
25
|
+
if (!hasCleanup) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return () => {
|
|
29
|
+
cleanups.forEach((cleanup, index) => {
|
|
30
|
+
if (typeof cleanup === 'function') {
|
|
31
|
+
cleanup();
|
|
32
|
+
} else {
|
|
33
|
+
setRef(refs[index], null);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function useComposedRefs(...refs) {
|
|
40
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
+
return useCallback(composeRefs(...refs), refs);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { composeRefs, useComposedRefs };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CSSProperties, type RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Measures collapsible content so CSS animations can use its size, like the Radix `Collapsible`.
|
|
4
|
+
* Content that starts open doesn't animate on mount.
|
|
5
|
+
*
|
|
6
|
+
* Returns whether the content should render (open, or still animating closed) and the size CSS variables.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useCollapsibleContentSize(contentRef: RefObject<HTMLElement | null>, { open, present, cssVariablePrefixes }: {
|
|
9
|
+
open: boolean;
|
|
10
|
+
present: boolean;
|
|
11
|
+
cssVariablePrefixes: string[];
|
|
12
|
+
}): {
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
style: CSSProperties;
|
|
15
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { useEnhancedEffect } from '../useEnhancedEffect.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Measures collapsible content so CSS animations can use its size, like the Radix `Collapsible`.
|
|
6
|
+
* Content that starts open doesn't animate on mount.
|
|
7
|
+
*
|
|
8
|
+
* Returns whether the content should render (open, or still animating closed) and the size CSS variables.
|
|
9
|
+
*/
|
|
10
|
+
function useCollapsibleContentSize(contentRef, {
|
|
11
|
+
open,
|
|
12
|
+
present,
|
|
13
|
+
cssVariablePrefixes
|
|
14
|
+
}) {
|
|
15
|
+
const [isPresent, setIsPresent] = useState(present);
|
|
16
|
+
const heightRef = useRef(0);
|
|
17
|
+
const widthRef = useRef(0);
|
|
18
|
+
const isOpen = open || isPresent;
|
|
19
|
+
const isMountAnimationPreventedRef = useRef(isOpen);
|
|
20
|
+
const originalStylesRef = useRef(undefined);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const rAF = requestAnimationFrame(() => {
|
|
23
|
+
isMountAnimationPreventedRef.current = false;
|
|
24
|
+
});
|
|
25
|
+
return () => cancelAnimationFrame(rAF);
|
|
26
|
+
}, []);
|
|
27
|
+
useEnhancedEffect(() => {
|
|
28
|
+
const node = contentRef.current;
|
|
29
|
+
if (!node) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
originalStylesRef.current = originalStylesRef.current || {
|
|
33
|
+
transitionDuration: node.style.transitionDuration,
|
|
34
|
+
animationName: node.style.animationName
|
|
35
|
+
};
|
|
36
|
+
// Block animations to measure the full size of the content.
|
|
37
|
+
node.style.transitionDuration = '0s';
|
|
38
|
+
node.style.animationName = 'none';
|
|
39
|
+
const rect = node.getBoundingClientRect();
|
|
40
|
+
heightRef.current = rect.height;
|
|
41
|
+
widthRef.current = rect.width;
|
|
42
|
+
if (!isMountAnimationPreventedRef.current) {
|
|
43
|
+
node.style.transitionDuration = originalStylesRef.current.transitionDuration;
|
|
44
|
+
node.style.animationName = originalStylesRef.current.animationName;
|
|
45
|
+
}
|
|
46
|
+
setIsPresent(present);
|
|
47
|
+
}, [contentRef, open, present]);
|
|
48
|
+
const height = heightRef.current;
|
|
49
|
+
const width = widthRef.current;
|
|
50
|
+
const style = {};
|
|
51
|
+
cssVariablePrefixes.forEach(prefix => {
|
|
52
|
+
style[`${prefix}-content-height`] = height ? `${height}px` : undefined;
|
|
53
|
+
style[`${prefix}-content-width`] = width ? `${width}px` : undefined;
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
isOpen,
|
|
57
|
+
style: style
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { useCollapsibleContentSize };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import * as MenuPrimitive from './menu';
|
|
3
|
+
import { type Direction, type PrimitiveProps } from './types';
|
|
4
|
+
export interface ContextMenuProps {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
onOpenChange?(open: boolean): void;
|
|
7
|
+
dir?: Direction;
|
|
8
|
+
modal?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Context menu with the Radix API, DOM and keyboard model; its content is an Ariakit popover with `role="menu"`. */
|
|
11
|
+
export declare const Root: {
|
|
12
|
+
(props: ContextMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
export interface ContextMenuTriggerProps extends PrimitiveProps<'span'> {
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Opens the menu at the pointer position on `contextmenu`, or after a 700ms touch or pen press. */
|
|
19
|
+
export declare const Trigger: import("react").ForwardRefExoticComponent<ContextMenuTriggerProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
20
|
+
export type ContextMenuPortalProps = MenuPrimitive.MenuPortalProps;
|
|
21
|
+
export declare const Portal: {
|
|
22
|
+
({ forceMount, children, container }: MenuPrimitive.MenuPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
25
|
+
export type ContextMenuContentProps = Omit<MenuPrimitive.MenuContentProps, 'onEntryFocus' | 'side' | 'sideOffset' | 'align'>;
|
|
26
|
+
export declare const Content: import("react").ForwardRefExoticComponent<ContextMenuContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export type ContextMenuGroupProps = MenuPrimitive.MenuGroupProps;
|
|
28
|
+
export type ContextMenuLabelProps = MenuPrimitive.MenuLabelProps;
|
|
29
|
+
export type ContextMenuItemProps = MenuPrimitive.MenuItemProps;
|
|
30
|
+
export type ContextMenuCheckboxItemProps = MenuPrimitive.MenuCheckboxItemProps;
|
|
31
|
+
export type ContextMenuRadioGroupProps = MenuPrimitive.MenuRadioGroupProps;
|
|
32
|
+
export type ContextMenuRadioItemProps = MenuPrimitive.MenuRadioItemProps;
|
|
33
|
+
export type ContextMenuItemIndicatorProps = MenuPrimitive.MenuItemIndicatorProps;
|
|
34
|
+
export type ContextMenuSeparatorProps = MenuPrimitive.MenuSeparatorProps;
|
|
35
|
+
export type ContextMenuArrowProps = MenuPrimitive.MenuArrowProps;
|
|
36
|
+
export type ContextMenuSubTriggerProps = MenuPrimitive.MenuSubTriggerProps;
|
|
37
|
+
export type { MenuSubContentProps } from './menu';
|
|
38
|
+
export declare const Group: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
39
|
+
asChild?: boolean;
|
|
40
|
+
} & import("react").RefAttributes<HTMLDivElement>>, Label: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
} & import("react").RefAttributes<HTMLDivElement>>, Item: import("react").ForwardRefExoticComponent<MenuPrimitive.MenuItemProps & import("react").RefAttributes<HTMLDivElement>>, CheckboxItem: import("react").ForwardRefExoticComponent<MenuPrimitive.MenuCheckboxItemProps & import("react").RefAttributes<HTMLDivElement>>, RadioGroup: import("react").ForwardRefExoticComponent<MenuPrimitive.MenuRadioGroupProps & import("react").RefAttributes<HTMLDivElement>>, RadioItem: import("react").ForwardRefExoticComponent<MenuPrimitive.MenuRadioItemProps & import("react").RefAttributes<HTMLDivElement>>, ItemIndicator: import("react").ForwardRefExoticComponent<MenuPrimitive.MenuItemIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>, Separator: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
43
|
+
asChild?: boolean;
|
|
44
|
+
} & import("react").RefAttributes<HTMLDivElement>>, Arrow: import("react").ForwardRefExoticComponent<Omit<import("./popper").PopperArrowProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>, SubTrigger: import("react").ForwardRefExoticComponent<MenuPrimitive.MenuItemImplProps & import("react").RefAttributes<HTMLDivElement>>, useMenuClose: typeof MenuPrimitive.useMenuClose;
|
|
45
|
+
export interface ContextMenuSubProps {
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
open?: boolean;
|
|
48
|
+
defaultOpen?: boolean;
|
|
49
|
+
onOpenChange?(open: boolean): void;
|
|
50
|
+
}
|
|
51
|
+
export declare const Sub: {
|
|
52
|
+
(props: ContextMenuSubProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
displayName: string;
|
|
54
|
+
};
|
|
55
|
+
export type ContextMenuSubContentProps = MenuPrimitive.MenuSubContentProps;
|
|
56
|
+
export declare const SubContent: import("react").ForwardRefExoticComponent<MenuPrimitive.MenuSubContentProps & import("react").RefAttributes<HTMLDivElement>>;
|