@yamada-ui/react 2.2.1-dev-20260429025711 → 2.2.1-dev-20260429032041
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/cjs/components/resizable/use-resizable.cjs +40 -34
- package/dist/cjs/components/resizable/use-resizable.cjs.map +1 -1
- package/dist/cjs/components/scroll-area/use-scroll-area.cjs +18 -29
- package/dist/cjs/components/scroll-area/use-scroll-area.cjs.map +1 -1
- package/dist/esm/components/resizable/use-resizable.js +40 -34
- package/dist/esm/components/resizable/use-resizable.js.map +1 -1
- package/dist/esm/components/scroll-area/use-scroll-area.js +19 -30
- package/dist/esm/components/scroll-area/use-scroll-area.js.map +1 -1
- package/dist/types/components/accordion/accordion.d.ts +2 -2
- package/dist/types/components/accordion/accordion.style.d.ts +1 -1
- package/dist/types/components/accordion/use-accordion.d.ts +11 -11
- package/dist/types/components/action-bar/action-bar.d.ts +2 -2
- package/dist/types/components/airy/airy.d.ts +2 -2
- package/dist/types/components/alert/alert.d.ts +2 -2
- package/dist/types/components/alpha-slider/alpha-slider.d.ts +2 -2
- package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +2 -2
- package/dist/types/components/autocomplete/autocomplete.d.ts +2 -2
- package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
- package/dist/types/components/autocomplete/use-autocomplete.d.ts +5 -5
- package/dist/types/components/avatar/avatar.d.ts +3 -3
- package/dist/types/components/avatar/use-avatar-group.d.ts +2 -2
- package/dist/types/components/badge/badge.d.ts +2 -2
- package/dist/types/components/bleed/bleed.d.ts +2 -2
- package/dist/types/components/blockquote/blockquote.d.ts +2 -2
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
- package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +2 -2
- package/dist/types/components/button/button.d.ts +2 -2
- package/dist/types/components/button/icon-button.d.ts +2 -2
- package/dist/types/components/calendar/calendar.d.ts +2 -2
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/calendar/use-calendar.d.ts +8 -8
- package/dist/types/components/card/card.d.ts +2 -2
- package/dist/types/components/carousel/carousel.d.ts +2 -2
- package/dist/types/components/carousel/carousel.style.d.ts +2 -2
- package/dist/types/components/carousel/use-carousel.d.ts +3 -3
- package/dist/types/components/center/center.d.ts +2 -2
- package/dist/types/components/chart/area-chart.d.ts +2 -2
- package/dist/types/components/chart/bar-chart.d.ts +2 -2
- package/dist/types/components/chart/chart.d.ts +5 -5
- package/dist/types/components/chart/composed-chart.d.ts +2 -2
- package/dist/types/components/chart/donut-chart.d.ts +2 -2
- package/dist/types/components/chart/line-chart.d.ts +2 -2
- package/dist/types/components/chart/pie-chart.d.ts +2 -2
- package/dist/types/components/chart/radar-chart.d.ts +2 -2
- package/dist/types/components/chart/use-chart.d.ts +2 -2
- package/dist/types/components/checkbox/checkbox.d.ts +5 -5
- package/dist/types/components/checkbox/checkbox.style.d.ts +1 -1
- package/dist/types/components/checkbox/use-checkbox-group.d.ts +2 -2
- package/dist/types/components/checkbox-card/checkbox-card.d.ts +5 -5
- package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
- package/dist/types/components/circle-progress/circle-progress.d.ts +2 -2
- package/dist/types/components/close-button/close-button.d.ts +2 -2
- package/dist/types/components/code/code.d.ts +2 -2
- package/dist/types/components/collapse/collapse.d.ts +2 -2
- package/dist/types/components/color-picker/color-picker.d.ts +2 -2
- package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
- package/dist/types/components/color-picker/use-color-picker.d.ts +2 -2
- package/dist/types/components/color-selector/color-selector.d.ts +2 -2
- package/dist/types/components/color-selector/color-selector.style.d.ts +2 -2
- package/dist/types/components/color-selector/use-color-selector.d.ts +3 -3
- package/dist/types/components/color-swatch/color-swatch.d.ts +2 -2
- package/dist/types/components/container/container.d.ts +2 -2
- package/dist/types/components/data-list/data-list.d.ts +2 -2
- package/dist/types/components/data-list/data-list.style.d.ts +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +2 -2
- package/dist/types/components/date-picker/use-date-picker.d.ts +4 -4
- package/dist/types/components/drawer/drawer.d.ts +2 -2
- package/dist/types/components/dropzone/dropzone.d.ts +4 -4
- package/dist/types/components/editable/editable.d.ts +4 -4
- package/dist/types/components/editable/use-editable.d.ts +2 -2
- package/dist/types/components/em/em.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.style.d.ts +2 -2
- package/dist/types/components/fade/fade.d.ts +2 -2
- package/dist/types/components/field/field.d.ts +3 -3
- package/dist/types/components/field/use-field-props.d.ts +4 -4
- package/dist/types/components/fieldset/fieldset.d.ts +3 -3
- package/dist/types/components/file-button/file-button.d.ts +2 -2
- package/dist/types/components/file-button/use-file-button.d.ts +18 -18
- package/dist/types/components/file-input/file-input.d.ts +2 -2
- package/dist/types/components/file-input/use-file-input.d.ts +15 -15
- package/dist/types/components/flex/flex.d.ts +2 -2
- package/dist/types/components/flip/flip.d.ts +4 -4
- package/dist/types/components/flip/flip.style.d.ts +1 -1
- package/dist/types/components/float/float.d.ts +2 -2
- package/dist/types/components/form/form.d.ts +3 -3
- package/dist/types/components/format/format-byte.d.ts +4 -4
- package/dist/types/components/format/format-date-time.d.ts +4 -4
- package/dist/types/components/format/format-number.d.ts +2 -2
- package/dist/types/components/grid/grid-item.d.ts +2 -2
- package/dist/types/components/grid/grid.d.ts +2 -2
- package/dist/types/components/group/group.d.ts +2 -2
- package/dist/types/components/group/use-group.d.ts +2 -2
- package/dist/types/components/heading/heading.d.ts +2 -2
- package/dist/types/components/hue-slider/hue-slider.d.ts +3 -3
- package/dist/types/components/icon/icon.d.ts +5 -5
- package/dist/types/components/image/image.d.ts +2 -2
- package/dist/types/components/indicator/indicator.d.ts +4 -4
- package/dist/types/components/infinite-scroll-area/infinite-scroll-area.d.ts +2 -2
- package/dist/types/components/infinite-scroll-area/infinite-scroll-area.style.d.ts +2 -2
- package/dist/types/components/input/input-addon.d.ts +2 -2
- package/dist/types/components/input/input-element.d.ts +2 -2
- package/dist/types/components/input/input.d.ts +2 -2
- package/dist/types/components/kbd/kbd.d.ts +2 -2
- package/dist/types/components/link/link.d.ts +2 -2
- package/dist/types/components/link-box/link-box.d.ts +2 -2
- package/dist/types/components/list/list.d.ts +2 -2
- package/dist/types/components/list/list.style.d.ts +2 -2
- package/dist/types/components/loading/loading-provider.d.ts +2 -2
- package/dist/types/components/loading/loading.d.ts +3 -3
- package/dist/types/components/mark/mark.d.ts +2 -2
- package/dist/types/components/menu/menu.d.ts +2 -2
- package/dist/types/components/menu/use-menu.d.ts +11 -11
- package/dist/types/components/modal/modal.d.ts +2 -2
- package/dist/types/components/native-accordion/native-accordion.d.ts +2 -2
- package/dist/types/components/native-accordion/native-accordion.style.d.ts +2 -2
- package/dist/types/components/native-accordion/use-native-accordion.d.ts +2 -2
- package/dist/types/components/native-popover/native-popover.d.ts +2 -2
- package/dist/types/components/native-select/native-select.d.ts +2 -2
- package/dist/types/components/native-table/native-table.d.ts +4 -4
- package/dist/types/components/notice/notice.style.d.ts +1 -1
- package/dist/types/components/number-input/number-input.d.ts +2 -2
- package/dist/types/components/pagination/pagination.d.ts +2 -2
- package/dist/types/components/pagination/pagination.style.d.ts +1 -1
- package/dist/types/components/pagination/use-pagination.d.ts +2 -2
- package/dist/types/components/password-input/password-input.d.ts +2 -2
- package/dist/types/components/password-input/strength-meter.d.ts +2 -2
- package/dist/types/components/password-input/strength-meter.style.d.ts +1 -1
- package/dist/types/components/password-input/use-password-input.d.ts +2 -2
- package/dist/types/components/pin-input/pin-input.d.ts +2 -2
- package/dist/types/components/pin-input/use-pin-input.d.ts +7 -7
- package/dist/types/components/popover/popover.d.ts +2 -2
- package/dist/types/components/progress/progress.d.ts +4 -4
- package/dist/types/components/progress/use-progress.d.ts +706 -706
- package/dist/types/components/qr-code/qr-code.d.ts +2 -2
- package/dist/types/components/radio/radio.d.ts +5 -5
- package/dist/types/components/radio/radio.style.d.ts +1 -1
- package/dist/types/components/radio/use-radio-group.d.ts +2 -2
- package/dist/types/components/radio-card/radio-card.d.ts +5 -5
- package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
- package/dist/types/components/rating/rating.style.d.ts +2 -2
- package/dist/types/components/rating/use-rating.d.ts +7 -7
- package/dist/types/components/reorder/reorder.d.ts +2 -2
- package/dist/types/components/reorder/reorder.style.d.ts +1 -1
- package/dist/types/components/reorder/use-reorder.d.ts +3 -3
- package/dist/types/components/resizable/resizable.d.ts +2 -2
- package/dist/types/components/resizable/resizable.style.d.ts +2 -2
- package/dist/types/components/resizable/use-resizable.d.ts +2 -2
- package/dist/types/components/ripple/ripple.d.ts +2 -2
- package/dist/types/components/ripple/use-ripple.d.ts +2 -2
- package/dist/types/components/rotate/rotate.d.ts +2 -2
- package/dist/types/components/saturation-slider/saturation-slider.d.ts +2 -2
- package/dist/types/components/saturation-slider/use-saturation-slider.d.ts +2 -2
- package/dist/types/components/scroll-area/scroll-area.d.ts +2 -2
- package/dist/types/components/scroll-area/use-scroll-area.d.ts +0 -1
- package/dist/types/components/segmented-control/segmented-control.d.ts +2 -2
- package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
- package/dist/types/components/segmented-control/use-segmented-control.d.ts +9 -9
- package/dist/types/components/select/select.d.ts +2 -2
- package/dist/types/components/select/select.style.d.ts +1 -1
- package/dist/types/components/select/use-select.d.ts +4 -4
- package/dist/types/components/separator/separator.d.ts +2 -2
- package/dist/types/components/sidebar/sidebar.d.ts +2 -2
- package/dist/types/components/sidebar/use-sidebar.d.ts +9 -9
- package/dist/types/components/simple-grid/simple-grid.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton.d.ts +2 -2
- package/dist/types/components/slide/slide.d.ts +2 -2
- package/dist/types/components/slide-fade/slide-fade.d.ts +2 -2
- package/dist/types/components/slider/slider.d.ts +2 -2
- package/dist/types/components/slider/use-slider.d.ts +2 -2
- package/dist/types/components/stack/h-stack.d.ts +2 -2
- package/dist/types/components/stack/stack.d.ts +2 -2
- package/dist/types/components/stack/v-stack.d.ts +2 -2
- package/dist/types/components/stack/z-stack.d.ts +2 -2
- package/dist/types/components/stat/stat.d.ts +2 -2
- package/dist/types/components/stat/stat.style.d.ts +2 -2
- package/dist/types/components/status/status.d.ts +2 -2
- package/dist/types/components/status/status.style.d.ts +2 -2
- package/dist/types/components/steps/steps.d.ts +2 -2
- package/dist/types/components/steps/steps.style.d.ts +1 -1
- package/dist/types/components/steps/use-steps.d.ts +10 -10
- package/dist/types/components/switch/switch.d.ts +2 -2
- package/dist/types/components/table/table.d.ts +2 -2
- package/dist/types/components/tabs/tabs.d.ts +2 -2
- package/dist/types/components/tabs/use-tabs.d.ts +16 -16
- package/dist/types/components/tag/tag.d.ts +2 -2
- package/dist/types/components/tag/tag.style.d.ts +1 -1
- package/dist/types/components/text/text.d.ts +2 -2
- package/dist/types/components/textarea/textarea.d.ts +2 -2
- package/dist/types/components/textarea/use-autosize.d.ts +2 -2
- package/dist/types/components/timeline/timeline.d.ts +5 -5
- package/dist/types/components/timeline/timeline.style.d.ts +1 -1
- package/dist/types/components/toggle/toggle.d.ts +5 -5
- package/dist/types/components/toggle/use-toggle-group.d.ts +2 -2
- package/dist/types/components/toggle/use-toggle.d.ts +2 -2
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/tree/tree.d.ts +2 -2
- package/dist/types/components/tree/tree.style.d.ts +1 -1
- package/dist/types/components/tree/use-tree.d.ts +183 -183
- package/dist/types/components/visually-hidden/visually-hidden.d.ts +2 -2
- package/dist/types/components/wrap/wrap.d.ts +2 -2
- package/dist/types/core/components/create-component.d.ts +7 -7
- package/dist/types/core/system/color-mode-provider.d.ts +2 -2
- package/dist/types/core/system/storage-script.d.ts +3 -3
- package/dist/types/core/system/styled.d.ts +2 -2
- package/dist/types/core/system/system-provider.d.ts +2 -2
- package/dist/types/hooks/use-breakpoint/use-breakpoint-state.d.ts +2 -2
- package/dist/types/hooks/use-clickable/index.d.ts +7 -7
- package/dist/types/hooks/use-clipboard/index.d.ts +2 -2
- package/dist/types/hooks/use-combobox/index.d.ts +12 -12
- package/dist/types/hooks/use-descendants/index.d.ts +2 -2
- package/dist/types/providers/i18n-provider/i18n-provider.d.ts +3 -3
- package/dist/types/providers/ui-provider/ui-provider.d.ts +2 -2
- package/dist/types/utils/children.d.ts +2 -2
- package/package.json +2 -2
|
@@ -4,6 +4,8 @@ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
|
4
4
|
const require_context = require('../../utils/context.cjs');
|
|
5
5
|
const require_ref = require('../../utils/ref.cjs');
|
|
6
6
|
const require_utils_index = require('../../utils/index.cjs');
|
|
7
|
+
const require_props = require('../../core/components/props.cjs');
|
|
8
|
+
require('../../core/index.cjs');
|
|
7
9
|
let react = require("react");
|
|
8
10
|
let react_resizable_panels = require("react-resizable-panels");
|
|
9
11
|
|
|
@@ -15,22 +17,24 @@ const useResizable = ({ controlRef, disabled, orientation = "horizontal", ...res
|
|
|
15
17
|
disabled,
|
|
16
18
|
groupRef,
|
|
17
19
|
orientation,
|
|
18
|
-
getRootProps: (0, react.useCallback)((props = {}) =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
getRootProps: (0, react.useCallback)((props = {}) => {
|
|
21
|
+
return {
|
|
22
|
+
...require_props.mergeProps({
|
|
23
|
+
disabled,
|
|
24
|
+
orientation
|
|
25
|
+
}, rest, props)(),
|
|
26
|
+
style: {
|
|
27
|
+
height: void 0,
|
|
28
|
+
width: void 0,
|
|
29
|
+
...rest.style,
|
|
30
|
+
...props.style
|
|
31
|
+
},
|
|
32
|
+
elementRef: require_ref.mergeRefs(props.elementRef, rest.ref),
|
|
33
|
+
groupRef: require_ref.mergeRefs(props.groupRef, groupRef, controlRef),
|
|
34
|
+
onLayoutChange: (0, require_utils_index.utils_exports.fnAll)(props.onLayoutChange, rest.onLayoutChange),
|
|
35
|
+
onLayoutChanged: (0, require_utils_index.utils_exports.fnAll)(props.onLayoutChanged, rest.onLayoutChanged)
|
|
36
|
+
};
|
|
37
|
+
}, [
|
|
34
38
|
disabled,
|
|
35
39
|
orientation,
|
|
36
40
|
groupRef,
|
|
@@ -43,13 +47,14 @@ const useResizableItem = ({ controlRef, ...rest }) => {
|
|
|
43
47
|
const panelRef = (0, react_resizable_panels.usePanelRef)();
|
|
44
48
|
return {
|
|
45
49
|
panelRef,
|
|
46
|
-
getItemProps: (0, react.useCallback)((props = {}) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
getItemProps: (0, react.useCallback)((props = {}) => {
|
|
51
|
+
return {
|
|
52
|
+
...require_props.mergeProps(rest, props)(),
|
|
53
|
+
elementRef: require_ref.mergeRefs(props.elementRef, rest.ref),
|
|
54
|
+
panelRef: require_ref.mergeRefs(props.panelRef, panelRef, controlRef),
|
|
55
|
+
onResize: (0, require_utils_index.utils_exports.fnAll)(props.onResize, rest.onResize)
|
|
56
|
+
};
|
|
57
|
+
}, [
|
|
53
58
|
panelRef,
|
|
54
59
|
controlRef,
|
|
55
60
|
rest
|
|
@@ -67,17 +72,18 @@ const useResizableTrigger = ({ disabled, ...rest }) => {
|
|
|
67
72
|
const nextLayout = Object.fromEntries(Object.keys(layout).map((key) => [key, size]));
|
|
68
73
|
groupRef.current?.setLayout(nextLayout);
|
|
69
74
|
}, [groupRef]);
|
|
70
|
-
const getTriggerProps = (0, react.useCallback)((props = {}) =>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
const getTriggerProps = (0, react.useCallback)((props = {}) => {
|
|
76
|
+
return {
|
|
77
|
+
...require_props.mergeProps({
|
|
78
|
+
"aria-disabled": (0, require_utils_index.utils_exports.ariaAttr)(trulyDisabled),
|
|
79
|
+
"aria-orientation": orientation,
|
|
80
|
+
"data-disabled": (0, require_utils_index.utils_exports.dataAttr)(trulyDisabled),
|
|
81
|
+
disabled: trulyDisabled,
|
|
82
|
+
tabIndex: trulyDisabled ? -1 : 0
|
|
83
|
+
}, props, rest, { onDoubleClick })(),
|
|
84
|
+
elementRef: require_ref.mergeRefs(props.elementRef, rest.ref)
|
|
85
|
+
};
|
|
86
|
+
}, [
|
|
81
87
|
orientation,
|
|
82
88
|
trulyDisabled,
|
|
83
89
|
rest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-resizable.cjs","names":["createContext","mergeRefs","getTriggerProps: PropGetter<SeparatorProps>"],"sources":["../../../../src/components/resizable/use-resizable.ts"],"sourcesContent":["\"use client\"\n\nimport type { MouseEvent, RefObject } from \"react\"\nimport type {\n GroupImperativeHandle,\n GroupProps,\n LayoutStorage,\n PanelImperativeHandle,\n PanelProps,\n SeparatorProps,\n} from \"react-resizable-panels\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback } from \"react\"\nimport {\n useGroupRef,\n usePanelRef,\n useDefaultLayout as useResizableLayout,\n} from \"react-resizable-panels\"\nimport {\n ariaAttr,\n createContext,\n dataAttr,\n fnAll,\n
|
|
1
|
+
{"version":3,"file":"use-resizable.cjs","names":["createContext","mergeProps","mergeRefs","getTriggerProps: PropGetter<SeparatorProps>"],"sources":["../../../../src/components/resizable/use-resizable.ts"],"sourcesContent":["\"use client\"\n\nimport type { MouseEvent, RefObject } from \"react\"\nimport type {\n GroupImperativeHandle,\n GroupProps,\n LayoutStorage,\n PanelImperativeHandle,\n PanelProps,\n SeparatorProps,\n} from \"react-resizable-panels\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback } from \"react\"\nimport {\n useGroupRef,\n usePanelRef,\n useDefaultLayout as useResizableLayout,\n} from \"react-resizable-panels\"\nimport { mergeProps } from \"../../core\"\nimport {\n ariaAttr,\n createContext,\n dataAttr,\n fnAll,\n mergeRefs,\n} from \"../../utils\"\n\ninterface ResizableContext extends Omit<UseResizableReturn, \"getRootProps\"> {}\n\nconst [ResizableContext, useResizableContext] = createContext<ResizableContext>(\n {\n name: \"ResizableContext\",\n },\n)\n\nexport { ResizableContext, useResizableContext, useResizableLayout }\n\nexport interface ResizableStorage extends LayoutStorage {}\nexport interface ResizableRootControl extends GroupImperativeHandle {}\nexport interface ResizableItemControl extends PanelImperativeHandle {}\n\nexport interface UseResizableProps\n extends\n HTMLProps,\n Omit<GroupProps, \"color\" | \"content\" | \"elementRef\" | \"groupRef\"> {\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<null | ResizableRootControl>\n}\n\nexport const useResizable = ({\n controlRef,\n disabled,\n orientation = \"horizontal\",\n ...rest\n}: UseResizableProps = {}) => {\n const groupRef = useGroupRef()\n\n const getRootProps: PropGetter<GroupProps> = useCallback(\n (props = {}) => {\n const merged = mergeProps({ disabled, orientation }, rest, props)()\n\n return {\n ...merged,\n style: {\n height: undefined,\n width: undefined,\n ...rest.style,\n ...props.style,\n },\n elementRef: mergeRefs(props.elementRef, rest.ref),\n groupRef: mergeRefs(props.groupRef, groupRef, controlRef),\n onLayoutChange: fnAll(props.onLayoutChange, rest.onLayoutChange),\n onLayoutChanged: fnAll(props.onLayoutChanged, rest.onLayoutChanged),\n }\n },\n [disabled, orientation, groupRef, controlRef, rest],\n )\n\n return {\n disabled,\n groupRef,\n orientation,\n getRootProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\nexport interface UseResizableItemProps\n extends\n HTMLProps,\n Omit<PanelProps, \"color\" | \"content\" | \"elementRef\" | \"panelRef\"> {\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<null | ResizableItemControl>\n}\n\nexport const useResizableItem = ({\n controlRef,\n ...rest\n}: UseResizableItemProps) => {\n const panelRef = usePanelRef()\n\n const getItemProps: PropGetter<PanelProps> = useCallback(\n (props = {}) => {\n const merged = mergeProps(rest, props)()\n\n return {\n ...merged,\n elementRef: mergeRefs(props.elementRef, rest.ref),\n panelRef: mergeRefs(props.panelRef, panelRef, controlRef),\n onResize: fnAll(props.onResize, rest.onResize),\n }\n },\n [panelRef, controlRef, rest],\n )\n\n return {\n panelRef,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\nexport interface UseResizableTriggerProps\n extends HTMLProps, Omit<SeparatorProps, \"color\" | \"content\" | \"elementRef\"> {}\n\nexport const useResizableTrigger = ({\n disabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const {\n disabled: groupDisabled,\n groupRef,\n orientation,\n } = useResizableContext()\n const trulyDisabled = disabled || groupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = groupRef.current?.getLayout()\n\n if (!layout) return\n\n const count = Object.keys(layout).length\n const size = 100 / count\n const nextLayout = Object.fromEntries(\n Object.keys(layout).map((key) => [key, size]),\n )\n\n groupRef.current?.setLayout(nextLayout)\n },\n [groupRef],\n )\n\n const getTriggerProps: PropGetter<SeparatorProps> = useCallback(\n (props = {}) => {\n const merged = mergeProps(\n {\n \"aria-disabled\": ariaAttr(trulyDisabled),\n \"aria-orientation\": orientation,\n \"data-disabled\": dataAttr(trulyDisabled),\n disabled: trulyDisabled,\n tabIndex: trulyDisabled ? -1 : 0,\n },\n props,\n rest,\n { onDoubleClick },\n )()\n\n return {\n ...merged,\n elementRef: mergeRefs(props.elementRef, rest.ref),\n }\n },\n [orientation, trulyDisabled, rest, onDoubleClick],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}) => ({\n \"data-icon\": \"\",\n ...props,\n }),\n [],\n )\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAM,CAAC,kBAAkB,uBAAuBA,8BAC9C,EACE,MAAM,oBACP,CACF;AAkBD,MAAa,gBAAgB,EAC3B,YACA,UACA,cAAc,cACd,GAAG,SACkB,EAAE,KAAK;CAC5B,MAAM,oDAAwB;AAuB9B,QAAO;EACL;EACA;EACA;EACA,sCAxBC,QAAQ,EAAE,KAAK;AAGd,UAAO;IACL,GAHaC,yBAAW;KAAE;KAAU;KAAa,EAAE,MAAM,MAAM,EAAE;IAIjE,OAAO;KACL,QAAQ;KACR,OAAO;KACP,GAAG,KAAK;KACR,GAAG,MAAM;KACV;IACD,YAAYC,sBAAU,MAAM,YAAY,KAAK,IAAI;IACjD,UAAUA,sBAAU,MAAM,UAAU,UAAU,WAAW;IACzD,6DAAsB,MAAM,gBAAgB,KAAK,eAAe;IAChE,8DAAuB,MAAM,iBAAiB,KAAK,gBAAgB;IACpE;KAEH;GAAC;GAAU;GAAa;GAAU;GAAY;GAAK,CACpD;EAOA;;AAeH,MAAa,oBAAoB,EAC/B,YACA,GAAG,WACwB;CAC3B,MAAM,oDAAwB;AAgB9B,QAAO;EACL;EACA,sCAfC,QAAQ,EAAE,KAAK;AAGd,UAAO;IACL,GAHaD,yBAAW,MAAM,MAAM,EAAE;IAItC,YAAYC,sBAAU,MAAM,YAAY,KAAK,IAAI;IACjD,UAAUA,sBAAU,MAAM,UAAU,UAAU,WAAW;IACzD,uDAAgB,MAAM,UAAU,KAAK,SAAS;IAC/C;KAEH;GAAC;GAAU;GAAY;GAAK,CAC7B;EAKA;;AAQH,MAAa,uBAAuB,EAClC,UACA,GAAG,WAC2B;CAC9B,MAAM,EACJ,UAAU,eACV,UACA,gBACE,qBAAqB;CACzB,MAAM,gBAAgB,YAAY;CAElC,MAAM,wCACH,OAAmC;AAClC,KAAG,gBAAgB;EAEnB,MAAM,SAAS,SAAS,SAAS,WAAW;AAE5C,MAAI,CAAC,OAAQ;EAGb,MAAM,OAAO,MADC,OAAO,KAAK,OAAO,CAAC;EAElC,MAAM,aAAa,OAAO,YACxB,OAAO,KAAK,OAAO,CAAC,KAAK,QAAQ,CAAC,KAAK,KAAK,CAAC,CAC9C;AAED,WAAS,SAAS,UAAU,WAAW;IAEzC,CAAC,SAAS,CACX;CAED,MAAMC,0CACH,QAAQ,EAAE,KAAK;AAcd,SAAO;GACL,GAdaF,yBACb;IACE,iEAA0B,cAAc;IACxC,oBAAoB;IACpB,iEAA0B,cAAc;IACxC,UAAU;IACV,UAAU,gBAAgB,KAAK;IAChC,EACD,OACA,MACA,EAAE,eAAe,CAClB,EAAE;GAID,YAAYC,sBAAU,MAAM,YAAY,KAAK,IAAI;GAClD;IAEH;EAAC;EAAa;EAAe;EAAM;EAAc,CAClD;AAUD,QAAO;EACL,sCARC,QAAQ,EAAE,MAAM;GACf,aAAa;GACb,GAAG;GACJ,GACD,EAAE,CACH;EAIC;EACD"}
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
4
4
|
const require_effect = require('../../utils/effect.cjs');
|
|
5
|
-
const require_ref = require('../../utils/ref.cjs');
|
|
6
5
|
const require_utils_index = require('../../utils/index.cjs');
|
|
6
|
+
const require_props = require('../../core/components/props.cjs');
|
|
7
|
+
require('../../core/index.cjs');
|
|
7
8
|
let react = require("react");
|
|
8
9
|
|
|
9
10
|
//#region src/components/scroll-area/use-scroll-area.ts
|
|
10
|
-
const useScrollArea = ({ id,
|
|
11
|
+
const useScrollArea = ({ id, type = "hover", scrollHideDelay = 1e3, onScrollPositionChange, ...rest } = {}) => {
|
|
11
12
|
const [isHovered, setIsHovered] = (0, react.useState)(false);
|
|
12
13
|
const [isScrolling, setIsScrolling] = (0, react.useState)(false);
|
|
13
14
|
const isAlways = type === "always";
|
|
@@ -65,48 +66,36 @@ const useScrollArea = ({ id, ref, type = "hover", scrollHideDelay = 1e3, onScrol
|
|
|
65
66
|
if (scrollTimeout.current) clearTimeout(scrollTimeout.current);
|
|
66
67
|
};
|
|
67
68
|
}, []);
|
|
68
|
-
const safariProps = (0, react.useMemo)(() => ({
|
|
69
|
-
key,
|
|
70
|
-
ref: require_ref.mergeRefs(ref, scrollAreaRef),
|
|
71
|
-
"data-key": key
|
|
72
|
-
}), [
|
|
73
|
-
key,
|
|
74
|
-
ref,
|
|
75
|
-
scrollAreaRef
|
|
76
|
-
]);
|
|
77
69
|
return {
|
|
78
70
|
isAlways,
|
|
79
71
|
isHidden,
|
|
80
72
|
isHovered,
|
|
81
73
|
isNever,
|
|
82
74
|
isScrolling,
|
|
83
|
-
getRootProps: (0, react.useCallback)((
|
|
84
|
-
|
|
85
|
-
style: {
|
|
86
|
-
overflow: "auto",
|
|
87
|
-
...style
|
|
88
|
-
},
|
|
89
|
-
...rest,
|
|
90
|
-
...isSafari ? safariProps : {},
|
|
91
|
-
...props,
|
|
75
|
+
getRootProps: (0, react.useCallback)((props = {}) => require_props.mergeProps({
|
|
76
|
+
style: { overflow: "auto" },
|
|
92
77
|
"data-hidden": (0, require_utils_index.utils_exports.dataAttr)(isHidden),
|
|
93
78
|
"data-hover": (0, require_utils_index.utils_exports.dataAttr)(isHovered),
|
|
94
79
|
"data-never": (0, require_utils_index.utils_exports.dataAttr)(isNever),
|
|
95
80
|
"data-scroll": (0, require_utils_index.utils_exports.dataAttr)(isScrolling),
|
|
96
|
-
tabIndex: 0
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
81
|
+
tabIndex: 0
|
|
82
|
+
}, isSafari ? {
|
|
83
|
+
key,
|
|
84
|
+
ref: scrollAreaRef,
|
|
85
|
+
"data-key": key
|
|
86
|
+
} : {}, rest, props, {
|
|
87
|
+
onMouseEnter,
|
|
88
|
+
onMouseLeave,
|
|
89
|
+
onPointerEnter: onMouseEnter,
|
|
90
|
+
onPointerLeave: onMouseLeave,
|
|
91
|
+
onScroll
|
|
92
|
+
})(), [
|
|
103
93
|
isNever,
|
|
104
|
-
ref,
|
|
105
94
|
isHidden,
|
|
106
95
|
isHovered,
|
|
107
96
|
isScrolling,
|
|
108
97
|
isSafari,
|
|
109
|
-
|
|
98
|
+
key,
|
|
110
99
|
rest,
|
|
111
100
|
onMouseEnter,
|
|
112
101
|
onMouseLeave,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-scroll-area.cjs","names":["
|
|
1
|
+
{"version":3,"file":"use-scroll-area.cjs","names":["mergeProps"],"sources":["../../../../src/components/scroll-area/use-scroll-area.ts"],"sourcesContent":["\"use client\"\n\nimport type { UIEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { dataAttr, isMac, useSafeLayoutEffect, vendor } from \"../../utils\"\n\nexport interface UseScrollAreaProps extends HTMLProps {\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"hover\" | \"never\" | \"scroll\"\n /**\n * Callback function for when the scroll position changes.\n */\n onScrollPositionChange?: ({ x, y }: { x: number; y: number }) => void\n}\n\nexport const useScrollArea = ({\n id,\n type = \"hover\",\n scrollHideDelay = 1000,\n onScrollPositionChange,\n ...rest\n}: UseScrollAreaProps = {}) => {\n const [isHovered, setIsHovered] = useState<boolean>(false)\n const [isScrolling, setIsScrolling] = useState<boolean>(false)\n const isAlways = type === \"always\"\n const isNever = type === \"never\"\n const isHidden = !isAlways && !isHovered && !isScrolling\n const isSafari = isMac() && vendor(/apple/i)\n const uuid = useId()\n const key = `${id ?? uuid}-${isHovered}-${isScrolling}`\n\n const hoverTimeout = useRef<any>(undefined)\n const scrollTimeout = useRef<any>(undefined)\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const scrollPosition = useRef({ x: 0, y: 0 })\n\n useSafeLayoutEffect(() => {\n if (!scrollAreaRef.current || !isSafari) return\n\n scrollAreaRef.current.scrollLeft = scrollPosition.current.x\n scrollAreaRef.current.scrollTop = scrollPosition.current.y\n })\n\n const onMouseEnter = useCallback(() => {\n if (type !== \"hover\") return\n\n clearTimeout(hoverTimeout.current)\n\n setIsHovered(true)\n }, [type])\n\n const onMouseLeave = useCallback(() => {\n if (type !== \"hover\") return\n\n hoverTimeout.current = setTimeout(\n () => setIsHovered(false),\n scrollHideDelay,\n )\n }, [scrollHideDelay, type])\n\n const onScroll = useCallback(\n (ev: UIEvent<HTMLDivElement>) => {\n const el = ev.target as HTMLDivElement\n\n const { scrollLeft: x, scrollTop: y } = el\n const { x: prevX, y: prevY } = scrollPosition.current\n const isEqual = Math.abs(x - prevX) <= 5 && Math.abs(y - prevY) <= 5\n\n onScrollPositionChange?.({ x, y })\n scrollPosition.current = { x, y }\n\n if (type !== \"scroll\" || isEqual) return\n\n if (!isScrolling) setIsScrolling(true)\n\n clearTimeout(scrollTimeout.current)\n\n scrollTimeout.current = setTimeout(\n () => setIsScrolling(false),\n scrollHideDelay,\n )\n },\n [isScrolling, onScrollPositionChange, scrollHideDelay, type],\n )\n\n useEffect(() => {\n return () => {\n if (hoverTimeout.current) clearTimeout(hoverTimeout.current)\n if (scrollTimeout.current) clearTimeout(scrollTimeout.current)\n }\n }, [])\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n style: { overflow: \"auto\" },\n \"data-hidden\": dataAttr(isHidden),\n \"data-hover\": dataAttr(isHovered),\n \"data-never\": dataAttr(isNever),\n \"data-scroll\": dataAttr(isScrolling),\n tabIndex: 0,\n },\n isSafari ? { key, ref: scrollAreaRef, \"data-key\": key } : {},\n rest,\n props,\n {\n onMouseEnter,\n onMouseLeave,\n onPointerEnter: onMouseEnter,\n onPointerLeave: onMouseLeave,\n onScroll,\n },\n )(),\n [\n isNever,\n isHidden,\n isHovered,\n isScrolling,\n isSafari,\n key,\n rest,\n onMouseEnter,\n onMouseLeave,\n onScroll,\n ],\n )\n\n return {\n isAlways,\n isHidden,\n isHovered,\n isNever,\n isScrolling,\n getRootProps,\n }\n}\n\nexport type UseScrollAreaReturn = ReturnType<typeof useScrollArea>\n"],"mappings":";;;;;;;;;;AA2BA,MAAa,iBAAiB,EAC5B,IACA,OAAO,SACP,kBAAkB,KAClB,wBACA,GAAG,SACmB,EAAE,KAAK;CAC7B,MAAM,CAAC,WAAW,oCAAkC,MAAM;CAC1D,MAAM,CAAC,aAAa,sCAAoC,MAAM;CAC9D,MAAM,WAAW,SAAS;CAC1B,MAAM,UAAU,SAAS;CACzB,MAAM,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC;CAC7C,MAAM,yDAAkB,kDAAW,SAAS;CAC5C,MAAM,yBAAc;CACpB,MAAM,MAAM,GAAG,MAAM,KAAK,GAAG,UAAU,GAAG;CAE1C,MAAM,iCAA2B,OAAU;CAC3C,MAAM,kCAA4B,OAAU;CAC5C,MAAM,kCAAuC,KAAK;CAClD,MAAM,mCAAwB;EAAE,GAAG;EAAG,GAAG;EAAG,CAAC;AAE7C,0CAA0B;AACxB,MAAI,CAAC,cAAc,WAAW,CAAC,SAAU;AAEzC,gBAAc,QAAQ,aAAa,eAAe,QAAQ;AAC1D,gBAAc,QAAQ,YAAY,eAAe,QAAQ;GACzD;CAEF,MAAM,4CAAiC;AACrC,MAAI,SAAS,QAAS;AAEtB,eAAa,aAAa,QAAQ;AAElC,eAAa,KAAK;IACjB,CAAC,KAAK,CAAC;CAEV,MAAM,4CAAiC;AACrC,MAAI,SAAS,QAAS;AAEtB,eAAa,UAAU,iBACf,aAAa,MAAM,EACzB,gBACD;IACA,CAAC,iBAAiB,KAAK,CAAC;CAE3B,MAAM,mCACH,OAAgC;EAG/B,MAAM,EAAE,YAAY,GAAG,WAAW,MAFvB,GAAG;EAGd,MAAM,EAAE,GAAG,OAAO,GAAG,UAAU,eAAe;EAC9C,MAAM,UAAU,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI;AAEnE,2BAAyB;GAAE;GAAG;GAAG,CAAC;AAClC,iBAAe,UAAU;GAAE;GAAG;GAAG;AAEjC,MAAI,SAAS,YAAY,QAAS;AAElC,MAAI,CAAC,YAAa,gBAAe,KAAK;AAEtC,eAAa,cAAc,QAAQ;AAEnC,gBAAc,UAAU,iBAChB,eAAe,MAAM,EAC3B,gBACD;IAEH;EAAC;EAAa;EAAwB;EAAiB;EAAK,CAC7D;AAED,4BAAgB;AACd,eAAa;AACX,OAAI,aAAa,QAAS,cAAa,aAAa,QAAQ;AAC5D,OAAI,cAAc,QAAS,cAAa,cAAc,QAAQ;;IAE/D,EAAE,CAAC;AAsCN,QAAO;EACL;EACA;EACA;EACA;EACA;EACA,sCAzCC,QAAQ,EAAE,KACTA,yBACE;GACE,OAAO,EAAE,UAAU,QAAQ;GAC3B,+DAAwB,SAAS;GACjC,8DAAuB,UAAU;GACjC,8DAAuB,QAAQ;GAC/B,+DAAwB,YAAY;GACpC,UAAU;GACX,EACD,WAAW;GAAE;GAAK,KAAK;GAAe,YAAY;GAAK,GAAG,EAAE,EAC5D,MACA,OACA;GACE;GACA;GACA,gBAAgB;GAChB,gBAAgB;GAChB;GACD,CACF,EAAE,EACL;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;EASA"}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import { createContext as createContext$1 } from "../../utils/context.js";
|
|
4
4
|
import { mergeRefs } from "../../utils/ref.js";
|
|
5
5
|
import { utils_exports } from "../../utils/index.js";
|
|
6
|
+
import { mergeProps } from "../../core/components/props.js";
|
|
7
|
+
import "../../core/index.js";
|
|
6
8
|
import { useCallback } from "react";
|
|
7
9
|
import { useDefaultLayout as useResizableLayout, useGroupRef, usePanelRef } from "react-resizable-panels";
|
|
8
10
|
|
|
@@ -14,22 +16,24 @@ const useResizable = ({ controlRef, disabled, orientation = "horizontal", ...res
|
|
|
14
16
|
disabled,
|
|
15
17
|
groupRef,
|
|
16
18
|
orientation,
|
|
17
|
-
getRootProps: useCallback((props = {}) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
getRootProps: useCallback((props = {}) => {
|
|
20
|
+
return {
|
|
21
|
+
...mergeProps({
|
|
22
|
+
disabled,
|
|
23
|
+
orientation
|
|
24
|
+
}, rest, props)(),
|
|
25
|
+
style: {
|
|
26
|
+
height: void 0,
|
|
27
|
+
width: void 0,
|
|
28
|
+
...rest.style,
|
|
29
|
+
...props.style
|
|
30
|
+
},
|
|
31
|
+
elementRef: mergeRefs(props.elementRef, rest.ref),
|
|
32
|
+
groupRef: mergeRefs(props.groupRef, groupRef, controlRef),
|
|
33
|
+
onLayoutChange: (0, utils_exports.fnAll)(props.onLayoutChange, rest.onLayoutChange),
|
|
34
|
+
onLayoutChanged: (0, utils_exports.fnAll)(props.onLayoutChanged, rest.onLayoutChanged)
|
|
35
|
+
};
|
|
36
|
+
}, [
|
|
33
37
|
disabled,
|
|
34
38
|
orientation,
|
|
35
39
|
groupRef,
|
|
@@ -42,13 +46,14 @@ const useResizableItem = ({ controlRef, ...rest }) => {
|
|
|
42
46
|
const panelRef = usePanelRef();
|
|
43
47
|
return {
|
|
44
48
|
panelRef,
|
|
45
|
-
getItemProps: useCallback((props = {}) =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
getItemProps: useCallback((props = {}) => {
|
|
50
|
+
return {
|
|
51
|
+
...mergeProps(rest, props)(),
|
|
52
|
+
elementRef: mergeRefs(props.elementRef, rest.ref),
|
|
53
|
+
panelRef: mergeRefs(props.panelRef, panelRef, controlRef),
|
|
54
|
+
onResize: (0, utils_exports.fnAll)(props.onResize, rest.onResize)
|
|
55
|
+
};
|
|
56
|
+
}, [
|
|
52
57
|
panelRef,
|
|
53
58
|
controlRef,
|
|
54
59
|
rest
|
|
@@ -66,17 +71,18 @@ const useResizableTrigger = ({ disabled, ...rest }) => {
|
|
|
66
71
|
const nextLayout = Object.fromEntries(Object.keys(layout).map((key) => [key, size]));
|
|
67
72
|
groupRef.current?.setLayout(nextLayout);
|
|
68
73
|
}, [groupRef]);
|
|
69
|
-
const getTriggerProps = useCallback((props = {}) =>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const getTriggerProps = useCallback((props = {}) => {
|
|
75
|
+
return {
|
|
76
|
+
...mergeProps({
|
|
77
|
+
"aria-disabled": (0, utils_exports.ariaAttr)(trulyDisabled),
|
|
78
|
+
"aria-orientation": orientation,
|
|
79
|
+
"data-disabled": (0, utils_exports.dataAttr)(trulyDisabled),
|
|
80
|
+
disabled: trulyDisabled,
|
|
81
|
+
tabIndex: trulyDisabled ? -1 : 0
|
|
82
|
+
}, props, rest, { onDoubleClick })(),
|
|
83
|
+
elementRef: mergeRefs(props.elementRef, rest.ref)
|
|
84
|
+
};
|
|
85
|
+
}, [
|
|
80
86
|
orientation,
|
|
81
87
|
trulyDisabled,
|
|
82
88
|
rest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-resizable.js","names":["createContext","getTriggerProps: PropGetter<SeparatorProps>"],"sources":["../../../../src/components/resizable/use-resizable.ts"],"sourcesContent":["\"use client\"\n\nimport type { MouseEvent, RefObject } from \"react\"\nimport type {\n GroupImperativeHandle,\n GroupProps,\n LayoutStorage,\n PanelImperativeHandle,\n PanelProps,\n SeparatorProps,\n} from \"react-resizable-panels\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback } from \"react\"\nimport {\n useGroupRef,\n usePanelRef,\n useDefaultLayout as useResizableLayout,\n} from \"react-resizable-panels\"\nimport {\n ariaAttr,\n createContext,\n dataAttr,\n fnAll,\n
|
|
1
|
+
{"version":3,"file":"use-resizable.js","names":["createContext","getTriggerProps: PropGetter<SeparatorProps>"],"sources":["../../../../src/components/resizable/use-resizable.ts"],"sourcesContent":["\"use client\"\n\nimport type { MouseEvent, RefObject } from \"react\"\nimport type {\n GroupImperativeHandle,\n GroupProps,\n LayoutStorage,\n PanelImperativeHandle,\n PanelProps,\n SeparatorProps,\n} from \"react-resizable-panels\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback } from \"react\"\nimport {\n useGroupRef,\n usePanelRef,\n useDefaultLayout as useResizableLayout,\n} from \"react-resizable-panels\"\nimport { mergeProps } from \"../../core\"\nimport {\n ariaAttr,\n createContext,\n dataAttr,\n fnAll,\n mergeRefs,\n} from \"../../utils\"\n\ninterface ResizableContext extends Omit<UseResizableReturn, \"getRootProps\"> {}\n\nconst [ResizableContext, useResizableContext] = createContext<ResizableContext>(\n {\n name: \"ResizableContext\",\n },\n)\n\nexport { ResizableContext, useResizableContext, useResizableLayout }\n\nexport interface ResizableStorage extends LayoutStorage {}\nexport interface ResizableRootControl extends GroupImperativeHandle {}\nexport interface ResizableItemControl extends PanelImperativeHandle {}\n\nexport interface UseResizableProps\n extends\n HTMLProps,\n Omit<GroupProps, \"color\" | \"content\" | \"elementRef\" | \"groupRef\"> {\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<null | ResizableRootControl>\n}\n\nexport const useResizable = ({\n controlRef,\n disabled,\n orientation = \"horizontal\",\n ...rest\n}: UseResizableProps = {}) => {\n const groupRef = useGroupRef()\n\n const getRootProps: PropGetter<GroupProps> = useCallback(\n (props = {}) => {\n const merged = mergeProps({ disabled, orientation }, rest, props)()\n\n return {\n ...merged,\n style: {\n height: undefined,\n width: undefined,\n ...rest.style,\n ...props.style,\n },\n elementRef: mergeRefs(props.elementRef, rest.ref),\n groupRef: mergeRefs(props.groupRef, groupRef, controlRef),\n onLayoutChange: fnAll(props.onLayoutChange, rest.onLayoutChange),\n onLayoutChanged: fnAll(props.onLayoutChanged, rest.onLayoutChanged),\n }\n },\n [disabled, orientation, groupRef, controlRef, rest],\n )\n\n return {\n disabled,\n groupRef,\n orientation,\n getRootProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\nexport interface UseResizableItemProps\n extends\n HTMLProps,\n Omit<PanelProps, \"color\" | \"content\" | \"elementRef\" | \"panelRef\"> {\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<null | ResizableItemControl>\n}\n\nexport const useResizableItem = ({\n controlRef,\n ...rest\n}: UseResizableItemProps) => {\n const panelRef = usePanelRef()\n\n const getItemProps: PropGetter<PanelProps> = useCallback(\n (props = {}) => {\n const merged = mergeProps(rest, props)()\n\n return {\n ...merged,\n elementRef: mergeRefs(props.elementRef, rest.ref),\n panelRef: mergeRefs(props.panelRef, panelRef, controlRef),\n onResize: fnAll(props.onResize, rest.onResize),\n }\n },\n [panelRef, controlRef, rest],\n )\n\n return {\n panelRef,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\nexport interface UseResizableTriggerProps\n extends HTMLProps, Omit<SeparatorProps, \"color\" | \"content\" | \"elementRef\"> {}\n\nexport const useResizableTrigger = ({\n disabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const {\n disabled: groupDisabled,\n groupRef,\n orientation,\n } = useResizableContext()\n const trulyDisabled = disabled || groupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = groupRef.current?.getLayout()\n\n if (!layout) return\n\n const count = Object.keys(layout).length\n const size = 100 / count\n const nextLayout = Object.fromEntries(\n Object.keys(layout).map((key) => [key, size]),\n )\n\n groupRef.current?.setLayout(nextLayout)\n },\n [groupRef],\n )\n\n const getTriggerProps: PropGetter<SeparatorProps> = useCallback(\n (props = {}) => {\n const merged = mergeProps(\n {\n \"aria-disabled\": ariaAttr(trulyDisabled),\n \"aria-orientation\": orientation,\n \"data-disabled\": dataAttr(trulyDisabled),\n disabled: trulyDisabled,\n tabIndex: trulyDisabled ? -1 : 0,\n },\n props,\n rest,\n { onDoubleClick },\n )()\n\n return {\n ...merged,\n elementRef: mergeRefs(props.elementRef, rest.ref),\n }\n },\n [orientation, trulyDisabled, rest, onDoubleClick],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}) => ({\n \"data-icon\": \"\",\n ...props,\n }),\n [],\n )\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;AA6BA,MAAM,CAAC,kBAAkB,uBAAuBA,gBAC9C,EACE,MAAM,oBACP,CACF;AAkBD,MAAa,gBAAgB,EAC3B,YACA,UACA,cAAc,cACd,GAAG,SACkB,EAAE,KAAK;CAC5B,MAAM,WAAW,aAAa;AAuB9B,QAAO;EACL;EACA;EACA;EACA,cAzB2C,aAC1C,QAAQ,EAAE,KAAK;AAGd,UAAO;IACL,GAHa,WAAW;KAAE;KAAU;KAAa,EAAE,MAAM,MAAM,EAAE;IAIjE,OAAO;KACL,QAAQ;KACR,OAAO;KACP,GAAG,KAAK;KACR,GAAG,MAAM;KACV;IACD,YAAY,UAAU,MAAM,YAAY,KAAK,IAAI;IACjD,UAAU,UAAU,MAAM,UAAU,UAAU,WAAW;IACzD,yCAAsB,MAAM,gBAAgB,KAAK,eAAe;IAChE,0CAAuB,MAAM,iBAAiB,KAAK,gBAAgB;IACpE;KAEH;GAAC;GAAU;GAAa;GAAU;GAAY;GAAK,CACpD;EAOA;;AAeH,MAAa,oBAAoB,EAC/B,YACA,GAAG,WACwB;CAC3B,MAAM,WAAW,aAAa;AAgB9B,QAAO;EACL;EACA,cAhB2C,aAC1C,QAAQ,EAAE,KAAK;AAGd,UAAO;IACL,GAHa,WAAW,MAAM,MAAM,EAAE;IAItC,YAAY,UAAU,MAAM,YAAY,KAAK,IAAI;IACjD,UAAU,UAAU,MAAM,UAAU,UAAU,WAAW;IACzD,mCAAgB,MAAM,UAAU,KAAK,SAAS;IAC/C;KAEH;GAAC;GAAU;GAAY;GAAK,CAC7B;EAKA;;AAQH,MAAa,uBAAuB,EAClC,UACA,GAAG,WAC2B;CAC9B,MAAM,EACJ,UAAU,eACV,UACA,gBACE,qBAAqB;CACzB,MAAM,gBAAgB,YAAY;CAElC,MAAM,gBAAgB,aACnB,OAAmC;AAClC,KAAG,gBAAgB;EAEnB,MAAM,SAAS,SAAS,SAAS,WAAW;AAE5C,MAAI,CAAC,OAAQ;EAGb,MAAM,OAAO,MADC,OAAO,KAAK,OAAO,CAAC;EAElC,MAAM,aAAa,OAAO,YACxB,OAAO,KAAK,OAAO,CAAC,KAAK,QAAQ,CAAC,KAAK,KAAK,CAAC,CAC9C;AAED,WAAS,SAAS,UAAU,WAAW;IAEzC,CAAC,SAAS,CACX;CAED,MAAMC,kBAA8C,aACjD,QAAQ,EAAE,KAAK;AAcd,SAAO;GACL,GAda,WACb;IACE,6CAA0B,cAAc;IACxC,oBAAoB;IACpB,6CAA0B,cAAc;IACxC,UAAU;IACV,UAAU,gBAAgB,KAAK;IAChC,EACD,OACA,MACA,EAAE,eAAe,CAClB,EAAE;GAID,YAAY,UAAU,MAAM,YAAY,KAAK,IAAI;GAClD;IAEH;EAAC;EAAa;EAAe;EAAM;EAAc,CAClD;AAUD,QAAO;EACL,cAT+B,aAC9B,QAAQ,EAAE,MAAM;GACf,aAAa;GACb,GAAG;GACJ,GACD,EAAE,CACH;EAIC;EACD"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useSafeLayoutEffect } from "../../utils/effect.js";
|
|
4
|
-
import { mergeRefs } from "../../utils/ref.js";
|
|
5
4
|
import { utils_exports } from "../../utils/index.js";
|
|
6
|
-
import {
|
|
5
|
+
import { mergeProps } from "../../core/components/props.js";
|
|
6
|
+
import "../../core/index.js";
|
|
7
|
+
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
7
8
|
|
|
8
9
|
//#region src/components/scroll-area/use-scroll-area.ts
|
|
9
|
-
const useScrollArea = ({ id,
|
|
10
|
+
const useScrollArea = ({ id, type = "hover", scrollHideDelay = 1e3, onScrollPositionChange, ...rest } = {}) => {
|
|
10
11
|
const [isHovered, setIsHovered] = useState(false);
|
|
11
12
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
12
13
|
const isAlways = type === "always";
|
|
@@ -64,48 +65,36 @@ const useScrollArea = ({ id, ref, type = "hover", scrollHideDelay = 1e3, onScrol
|
|
|
64
65
|
if (scrollTimeout.current) clearTimeout(scrollTimeout.current);
|
|
65
66
|
};
|
|
66
67
|
}, []);
|
|
67
|
-
const safariProps = useMemo(() => ({
|
|
68
|
-
key,
|
|
69
|
-
ref: mergeRefs(ref, scrollAreaRef),
|
|
70
|
-
"data-key": key
|
|
71
|
-
}), [
|
|
72
|
-
key,
|
|
73
|
-
ref,
|
|
74
|
-
scrollAreaRef
|
|
75
|
-
]);
|
|
76
68
|
return {
|
|
77
69
|
isAlways,
|
|
78
70
|
isHidden,
|
|
79
71
|
isHovered,
|
|
80
72
|
isNever,
|
|
81
73
|
isScrolling,
|
|
82
|
-
getRootProps: useCallback((
|
|
83
|
-
|
|
84
|
-
style: {
|
|
85
|
-
overflow: "auto",
|
|
86
|
-
...style
|
|
87
|
-
},
|
|
88
|
-
...rest,
|
|
89
|
-
...isSafari ? safariProps : {},
|
|
90
|
-
...props,
|
|
74
|
+
getRootProps: useCallback((props = {}) => mergeProps({
|
|
75
|
+
style: { overflow: "auto" },
|
|
91
76
|
"data-hidden": (0, utils_exports.dataAttr)(isHidden),
|
|
92
77
|
"data-hover": (0, utils_exports.dataAttr)(isHovered),
|
|
93
78
|
"data-never": (0, utils_exports.dataAttr)(isNever),
|
|
94
79
|
"data-scroll": (0, utils_exports.dataAttr)(isScrolling),
|
|
95
|
-
tabIndex: 0
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
80
|
+
tabIndex: 0
|
|
81
|
+
}, isSafari ? {
|
|
82
|
+
key,
|
|
83
|
+
ref: scrollAreaRef,
|
|
84
|
+
"data-key": key
|
|
85
|
+
} : {}, rest, props, {
|
|
86
|
+
onMouseEnter,
|
|
87
|
+
onMouseLeave,
|
|
88
|
+
onPointerEnter: onMouseEnter,
|
|
89
|
+
onPointerLeave: onMouseLeave,
|
|
90
|
+
onScroll
|
|
91
|
+
})(), [
|
|
102
92
|
isNever,
|
|
103
|
-
ref,
|
|
104
93
|
isHidden,
|
|
105
94
|
isHovered,
|
|
106
95
|
isScrolling,
|
|
107
96
|
isSafari,
|
|
108
|
-
|
|
97
|
+
key,
|
|
109
98
|
rest,
|
|
110
99
|
onMouseEnter,
|
|
111
100
|
onMouseLeave,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-scroll-area.js","names":[],"sources":["../../../../src/components/scroll-area/use-scroll-area.ts"],"sourcesContent":["\"use client\"\n\nimport type { UIEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useEffect, useId,
|
|
1
|
+
{"version":3,"file":"use-scroll-area.js","names":[],"sources":["../../../../src/components/scroll-area/use-scroll-area.ts"],"sourcesContent":["\"use client\"\n\nimport type { UIEvent } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { dataAttr, isMac, useSafeLayoutEffect, vendor } from \"../../utils\"\n\nexport interface UseScrollAreaProps extends HTMLProps {\n /**\n * Delay in milliseconds before scrollbars are hidden.\n *\n * @default 1000\n */\n scrollHideDelay?: number\n /**\n * Scrollbar visibility type.\n *\n * @default 'hover'\n */\n type?: \"always\" | \"hover\" | \"never\" | \"scroll\"\n /**\n * Callback function for when the scroll position changes.\n */\n onScrollPositionChange?: ({ x, y }: { x: number; y: number }) => void\n}\n\nexport const useScrollArea = ({\n id,\n type = \"hover\",\n scrollHideDelay = 1000,\n onScrollPositionChange,\n ...rest\n}: UseScrollAreaProps = {}) => {\n const [isHovered, setIsHovered] = useState<boolean>(false)\n const [isScrolling, setIsScrolling] = useState<boolean>(false)\n const isAlways = type === \"always\"\n const isNever = type === \"never\"\n const isHidden = !isAlways && !isHovered && !isScrolling\n const isSafari = isMac() && vendor(/apple/i)\n const uuid = useId()\n const key = `${id ?? uuid}-${isHovered}-${isScrolling}`\n\n const hoverTimeout = useRef<any>(undefined)\n const scrollTimeout = useRef<any>(undefined)\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const scrollPosition = useRef({ x: 0, y: 0 })\n\n useSafeLayoutEffect(() => {\n if (!scrollAreaRef.current || !isSafari) return\n\n scrollAreaRef.current.scrollLeft = scrollPosition.current.x\n scrollAreaRef.current.scrollTop = scrollPosition.current.y\n })\n\n const onMouseEnter = useCallback(() => {\n if (type !== \"hover\") return\n\n clearTimeout(hoverTimeout.current)\n\n setIsHovered(true)\n }, [type])\n\n const onMouseLeave = useCallback(() => {\n if (type !== \"hover\") return\n\n hoverTimeout.current = setTimeout(\n () => setIsHovered(false),\n scrollHideDelay,\n )\n }, [scrollHideDelay, type])\n\n const onScroll = useCallback(\n (ev: UIEvent<HTMLDivElement>) => {\n const el = ev.target as HTMLDivElement\n\n const { scrollLeft: x, scrollTop: y } = el\n const { x: prevX, y: prevY } = scrollPosition.current\n const isEqual = Math.abs(x - prevX) <= 5 && Math.abs(y - prevY) <= 5\n\n onScrollPositionChange?.({ x, y })\n scrollPosition.current = { x, y }\n\n if (type !== \"scroll\" || isEqual) return\n\n if (!isScrolling) setIsScrolling(true)\n\n clearTimeout(scrollTimeout.current)\n\n scrollTimeout.current = setTimeout(\n () => setIsScrolling(false),\n scrollHideDelay,\n )\n },\n [isScrolling, onScrollPositionChange, scrollHideDelay, type],\n )\n\n useEffect(() => {\n return () => {\n if (hoverTimeout.current) clearTimeout(hoverTimeout.current)\n if (scrollTimeout.current) clearTimeout(scrollTimeout.current)\n }\n }, [])\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) =>\n mergeProps(\n {\n style: { overflow: \"auto\" },\n \"data-hidden\": dataAttr(isHidden),\n \"data-hover\": dataAttr(isHovered),\n \"data-never\": dataAttr(isNever),\n \"data-scroll\": dataAttr(isScrolling),\n tabIndex: 0,\n },\n isSafari ? { key, ref: scrollAreaRef, \"data-key\": key } : {},\n rest,\n props,\n {\n onMouseEnter,\n onMouseLeave,\n onPointerEnter: onMouseEnter,\n onPointerLeave: onMouseLeave,\n onScroll,\n },\n )(),\n [\n isNever,\n isHidden,\n isHovered,\n isScrolling,\n isSafari,\n key,\n rest,\n onMouseEnter,\n onMouseLeave,\n onScroll,\n ],\n )\n\n return {\n isAlways,\n isHidden,\n isHovered,\n isNever,\n isScrolling,\n getRootProps,\n }\n}\n\nexport type UseScrollAreaReturn = ReturnType<typeof useScrollArea>\n"],"mappings":";;;;;;;;;AA2BA,MAAa,iBAAiB,EAC5B,IACA,OAAO,SACP,kBAAkB,KAClB,wBACA,GAAG,SACmB,EAAE,KAAK;CAC7B,MAAM,CAAC,WAAW,gBAAgB,SAAkB,MAAM;CAC1D,MAAM,CAAC,aAAa,kBAAkB,SAAkB,MAAM;CAC9D,MAAM,WAAW,SAAS;CAC1B,MAAM,UAAU,SAAS;CACzB,MAAM,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC;CAC7C,MAAM,qCAAkB,8BAAW,SAAS;CAC5C,MAAM,OAAO,OAAO;CACpB,MAAM,MAAM,GAAG,MAAM,KAAK,GAAG,UAAU,GAAG;CAE1C,MAAM,eAAe,OAAY,OAAU;CAC3C,MAAM,gBAAgB,OAAY,OAAU;CAC5C,MAAM,gBAAgB,OAAuB,KAAK;CAClD,MAAM,iBAAiB,OAAO;EAAE,GAAG;EAAG,GAAG;EAAG,CAAC;AAE7C,2BAA0B;AACxB,MAAI,CAAC,cAAc,WAAW,CAAC,SAAU;AAEzC,gBAAc,QAAQ,aAAa,eAAe,QAAQ;AAC1D,gBAAc,QAAQ,YAAY,eAAe,QAAQ;GACzD;CAEF,MAAM,eAAe,kBAAkB;AACrC,MAAI,SAAS,QAAS;AAEtB,eAAa,aAAa,QAAQ;AAElC,eAAa,KAAK;IACjB,CAAC,KAAK,CAAC;CAEV,MAAM,eAAe,kBAAkB;AACrC,MAAI,SAAS,QAAS;AAEtB,eAAa,UAAU,iBACf,aAAa,MAAM,EACzB,gBACD;IACA,CAAC,iBAAiB,KAAK,CAAC;CAE3B,MAAM,WAAW,aACd,OAAgC;EAG/B,MAAM,EAAE,YAAY,GAAG,WAAW,MAFvB,GAAG;EAGd,MAAM,EAAE,GAAG,OAAO,GAAG,UAAU,eAAe;EAC9C,MAAM,UAAU,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI;AAEnE,2BAAyB;GAAE;GAAG;GAAG,CAAC;AAClC,iBAAe,UAAU;GAAE;GAAG;GAAG;AAEjC,MAAI,SAAS,YAAY,QAAS;AAElC,MAAI,CAAC,YAAa,gBAAe,KAAK;AAEtC,eAAa,cAAc,QAAQ;AAEnC,gBAAc,UAAU,iBAChB,eAAe,MAAM,EAC3B,gBACD;IAEH;EAAC;EAAa;EAAwB;EAAiB;EAAK,CAC7D;AAED,iBAAgB;AACd,eAAa;AACX,OAAI,aAAa,QAAS,cAAa,aAAa,QAAQ;AAC5D,OAAI,cAAc,QAAS,cAAa,cAAc,QAAQ;;IAE/D,EAAE,CAAC;AAsCN,QAAO;EACL;EACA;EACA;EACA;EACA;EACA,cA1C+B,aAC9B,QAAQ,EAAE,KACT,WACE;GACE,OAAO,EAAE,UAAU,QAAQ;GAC3B,2CAAwB,SAAS;GACjC,0CAAuB,UAAU;GACjC,0CAAuB,QAAQ;GAC/B,2CAAwB,YAAY;GACpC,UAAU;GACX,EACD,WAAW;GAAE;GAAK,KAAK;GAAe,YAAY;GAAK,GAAG,EAAE,EAC5D,MACA,OACA;GACE;GACA;GACA,gBAAgB;GAChB,gBAAgB;GAChB;GACD,CACF,EAAE,EACL;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;EASA"}
|
|
@@ -7,7 +7,7 @@ import { CollapseProps } from "../collapse/collapse.js";
|
|
|
7
7
|
import "../../index.js";
|
|
8
8
|
import { AccordionStyle } from "./accordion.style.js";
|
|
9
9
|
import { UseAccordionItemProps, UseAccordionProps } from "./use-accordion.js";
|
|
10
|
-
import * as
|
|
10
|
+
import * as react28 from "react";
|
|
11
11
|
|
|
12
12
|
//#region src/components/accordion/accordion.d.ts
|
|
13
13
|
interface AccordionCallBackProps {
|
|
@@ -31,7 +31,7 @@ interface AccordionRootProps extends Omit<HTMLStyledProps, "onChange">, ThemePro
|
|
|
31
31
|
*/
|
|
32
32
|
items?: AccordionItem[];
|
|
33
33
|
}
|
|
34
|
-
declare const AccordionPropsContext:
|
|
34
|
+
declare const AccordionPropsContext: react28.Context<Partial<AccordionRootProps> | undefined>, useAccordionPropsContext: () => Partial<AccordionRootProps> | undefined;
|
|
35
35
|
/**
|
|
36
36
|
* `Accordion` is a component for a list that displays information in an expandable or collapsible manner.
|
|
37
37
|
*
|
|
@@ -3,7 +3,7 @@ import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/
|
|
|
3
3
|
import "../../index.js";
|
|
4
4
|
|
|
5
5
|
//#region src/components/accordion/accordion.style.d.ts
|
|
6
|
-
declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "
|
|
6
|
+
declare const accordionStyle: ComponentSlotStyle<"button" | "panel" | "icon" | "root" | "item", CSSPropObject<CSSSlotObject<"button" | "panel" | "icon" | "root" | "item">>, CSSModifierObject<CSSSlotObject<"button" | "panel" | "icon" | "root" | "item">>, {
|
|
7
7
|
panel: {
|
|
8
8
|
button: {
|
|
9
9
|
rounded: "l2";
|
|
@@ -2,10 +2,10 @@ import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
|
|
|
2
2
|
import "../../core/index.js";
|
|
3
3
|
import { Descendant } from "../../hooks/use-descendants/index.js";
|
|
4
4
|
import "../../index.js";
|
|
5
|
-
import * as
|
|
5
|
+
import * as react29 from "react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/accordion/use-accordion.d.ts
|
|
8
|
-
declare const AccordionDescendantsContext:
|
|
8
|
+
declare const AccordionDescendantsContext: react29.Context<{
|
|
9
9
|
active: (target?: HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null | undefined, options?: FocusOptions) => void;
|
|
10
10
|
count: (props?: Partial<{}> | undefined) => number;
|
|
11
11
|
destroy: () => void;
|
|
@@ -24,7 +24,7 @@ declare const AccordionDescendantsContext: react152.Context<{
|
|
|
24
24
|
prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
25
25
|
register: (props?: {
|
|
26
26
|
disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
|
|
27
|
-
} | undefined) =>
|
|
27
|
+
} | undefined) => react29.RefCallback<HTMLButtonElement>;
|
|
28
28
|
unregister: (node?: HTMLButtonElement | null | undefined) => void;
|
|
29
29
|
value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
30
30
|
values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
|
|
@@ -50,12 +50,12 @@ declare const AccordionDescendantsContext: react152.Context<{
|
|
|
50
50
|
prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
51
51
|
register: (props?: {
|
|
52
52
|
disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
|
|
53
|
-
} | undefined) =>
|
|
53
|
+
} | undefined) => react29.RefCallback<HTMLButtonElement>;
|
|
54
54
|
unregister: (node?: HTMLButtonElement | null | undefined) => void;
|
|
55
55
|
value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
56
56
|
values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
|
|
57
57
|
};
|
|
58
|
-
register:
|
|
58
|
+
register: react29.RefCallback<HTMLButtonElement>;
|
|
59
59
|
}, useAccordionDescendants: () => {
|
|
60
60
|
active: (target?: HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null | undefined, options?: FocusOptions) => void;
|
|
61
61
|
count: (props?: Partial<{}> | undefined) => number;
|
|
@@ -75,15 +75,15 @@ declare const AccordionDescendantsContext: react152.Context<{
|
|
|
75
75
|
prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
76
76
|
register: (props?: {
|
|
77
77
|
disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
|
|
78
|
-
} | undefined) =>
|
|
78
|
+
} | undefined) => react29.RefCallback<HTMLButtonElement>;
|
|
79
79
|
unregister: (node?: HTMLButtonElement | null | undefined) => void;
|
|
80
80
|
value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
81
81
|
values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
|
|
82
82
|
};
|
|
83
83
|
interface AccordionContext extends Omit<UseAccordionReturn, "descendants" | "getRootProps"> {}
|
|
84
|
-
declare const AccordionContext:
|
|
84
|
+
declare const AccordionContext: react29.Context<AccordionContext>, useAccordionContext: () => AccordionContext;
|
|
85
85
|
interface AccordionItemContext extends Omit<UseAccordionItemReturn, "getItemProps"> {}
|
|
86
|
-
declare const AccordionItemContext:
|
|
86
|
+
declare const AccordionItemContext: react29.Context<AccordionItemContext>, useAccordionItemContext: () => AccordionItemContext;
|
|
87
87
|
interface UseAccordionProps extends Omit<HTMLProps, "onChange"> {
|
|
88
88
|
/**
|
|
89
89
|
* The initial index(es) of the accordion item to expand.
|
|
@@ -137,7 +137,7 @@ declare const useAccordion: ({
|
|
|
137
137
|
prevValue: (indexOrNode: number | HTMLButtonElement | Descendant<HTMLButtonElement, {}> | null, loop?: boolean, props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
138
138
|
register: (props?: {
|
|
139
139
|
disabled?: boolean | ((node: HTMLButtonElement) => boolean) | undefined;
|
|
140
|
-
} | undefined) =>
|
|
140
|
+
} | undefined) => react29.RefCallback<HTMLButtonElement>;
|
|
141
141
|
unregister: (node?: HTMLButtonElement | null | undefined) => void;
|
|
142
142
|
value: (indexOrNode: number | HTMLButtonElement | null) => Descendant<HTMLButtonElement, {}> | undefined;
|
|
143
143
|
values: (props?: Partial<{}> | undefined) => Descendant<HTMLButtonElement, {}>[];
|
|
@@ -145,8 +145,8 @@ declare const useAccordion: ({
|
|
|
145
145
|
focusedIndex: number;
|
|
146
146
|
index: number | number[];
|
|
147
147
|
multiple: boolean | undefined;
|
|
148
|
-
setFocusedIndex:
|
|
149
|
-
setIndex:
|
|
148
|
+
setFocusedIndex: react29.Dispatch<react29.SetStateAction<number>>;
|
|
149
|
+
setIndex: react29.Dispatch<react29.SetStateAction<number | number[]>>;
|
|
150
150
|
toggle: boolean | undefined;
|
|
151
151
|
getRootProps: PropGetter<"div", undefined, undefined>;
|
|
152
152
|
};
|