@yamada-ui/resizable 1.1.18-next-20241111190044 → 1.2.0-dev-20241114125332

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/dist/{chunk-OV5GGHOC.mjs → chunk-25QQGKDC.mjs} +2 -2
  2. package/dist/{chunk-72BYQXIX.mjs → chunk-JU7AHOX7.mjs} +2 -2
  3. package/dist/{chunk-EICWL7I5.mjs → chunk-NG4RLXOF.mjs} +2 -2
  4. package/dist/{chunk-HAROVF4B.mjs → chunk-WCMBVV3R.mjs} +42 -10
  5. package/dist/chunk-WCMBVV3R.mjs.map +1 -0
  6. package/dist/index.d.mts +1 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +38 -7
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +4 -4
  11. package/dist/resizable-item.d.mts +1 -0
  12. package/dist/resizable-item.d.ts +1 -0
  13. package/dist/resizable-item.js +0 -1
  14. package/dist/resizable-item.js.map +1 -1
  15. package/dist/resizable-item.mjs +2 -2
  16. package/dist/resizable-trigger.d.mts +1 -0
  17. package/dist/resizable-trigger.d.ts +1 -0
  18. package/dist/resizable-trigger.js +24 -5
  19. package/dist/resizable-trigger.js.map +1 -1
  20. package/dist/resizable-trigger.mjs +2 -2
  21. package/dist/resizable.d.mts +1 -0
  22. package/dist/resizable.d.ts +1 -0
  23. package/dist/resizable.js +14 -1
  24. package/dist/resizable.js.map +1 -1
  25. package/dist/resizable.mjs +2 -2
  26. package/dist/use-resizable.d.mts +289 -6
  27. package/dist/use-resizable.d.ts +289 -6
  28. package/dist/use-resizable.js +38 -7
  29. package/dist/use-resizable.js.map +1 -1
  30. package/dist/use-resizable.mjs +1 -1
  31. package/package.json +3 -3
  32. package/dist/chunk-HAROVF4B.mjs.map +0 -1
  33. /package/dist/{chunk-OV5GGHOC.mjs.map → chunk-25QQGKDC.mjs.map} +0 -0
  34. /package/dist/{chunk-72BYQXIX.mjs.map → chunk-JU7AHOX7.mjs.map} +0 -0
  35. /package/dist/{chunk-EICWL7I5.mjs.map → chunk-NG4RLXOF.mjs.map} +0 -0
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  useResizableContext,
4
4
  useResizableTrigger
5
- } from "./chunk-HAROVF4B.mjs";
5
+ } from "./chunk-WCMBVV3R.mjs";
6
6
 
7
7
  // src/resizable-trigger.tsx
8
8
  import { ui } from "@yamada-ui/core";
@@ -107,4 +107,4 @@ export {
107
107
  ResizableTrigger,
108
108
  ResizableTriggerIcon
109
109
  };
110
- //# sourceMappingURL=chunk-OV5GGHOC.mjs.map
110
+ //# sourceMappingURL=chunk-25QQGKDC.mjs.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  useResizableContext,
4
4
  useResizableItem
5
- } from "./chunk-HAROVF4B.mjs";
5
+ } from "./chunk-WCMBVV3R.mjs";
6
6
 
7
7
  // src/resizable-item.tsx
8
8
  import { forwardRef, ui } from "@yamada-ui/core";
@@ -74,4 +74,4 @@ ResizableItem.__ui__ = "ResizableItem";
74
74
  export {
75
75
  ResizableItem
76
76
  };
77
- //# sourceMappingURL=chunk-72BYQXIX.mjs.map
77
+ //# sourceMappingURL=chunk-JU7AHOX7.mjs.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ResizableProvider,
4
4
  useResizable
5
- } from "./chunk-HAROVF4B.mjs";
5
+ } from "./chunk-WCMBVV3R.mjs";
6
6
 
7
7
  // src/resizable.tsx
8
8
  import {
@@ -43,4 +43,4 @@ Resizable.__ui__ = "Resizable";
43
43
  export {
44
44
  Resizable
45
45
  };
46
- //# sourceMappingURL=chunk-EICWL7I5.mjs.map
46
+ //# sourceMappingURL=chunk-NG4RLXOF.mjs.map
@@ -5,9 +5,10 @@ import {
5
5
  createContext,
6
6
  dataAttr,
7
7
  handlerAll,
8
- isRefObject
8
+ isRefObject,
9
+ mergeRefs
9
10
  } from "@yamada-ui/utils";
10
- import { useCallback, useEffect, useId, useState } from "react";
11
+ import { useCallback, useEffect, useId, useRef, useState } from "react";
11
12
  import {
12
13
  getPanelElement,
13
14
  getPanelGroupElement,
@@ -20,6 +21,7 @@ var [ResizableProvider, useResizableContext] = createContext({
20
21
  var useResizable = ({
21
22
  id,
22
23
  ref,
24
+ controlRef: controlRefProp,
23
25
  direction = "horizontal",
24
26
  isDisabled = false,
25
27
  keyboardStep,
@@ -29,6 +31,7 @@ var useResizable = ({
29
31
  onLayout,
30
32
  ...rest
31
33
  }) => {
34
+ const controlRef = useRef(null);
32
35
  const uuid = useId();
33
36
  id != null ? id : id = uuid;
34
37
  const getContainerProps = useCallback(
@@ -41,6 +44,7 @@ var useResizable = ({
41
44
  return {
42
45
  ...props,
43
46
  id,
47
+ ref: mergeRefs(controlRefProp, controlRef),
44
48
  autoSaveId: storageKey,
45
49
  direction,
46
50
  keyboardResizeBy: keyboardStep,
@@ -50,7 +54,16 @@ var useResizable = ({
50
54
  ...rest2
51
55
  };
52
56
  },
53
- [id, direction, groupProps, storageKey, keyboardStep, onLayout, storage]
57
+ [
58
+ id,
59
+ direction,
60
+ groupProps,
61
+ controlRefProp,
62
+ storageKey,
63
+ keyboardStep,
64
+ onLayout,
65
+ storage
66
+ ]
54
67
  );
55
68
  useEffect(() => {
56
69
  if (!id) return;
@@ -58,6 +71,7 @@ var useResizable = ({
58
71
  if (isRefObject(ref)) ref.current = el;
59
72
  }, [ref, id]);
60
73
  return {
74
+ controlRef,
61
75
  isDisabled,
62
76
  getContainerProps,
63
77
  getGroupProps
@@ -98,7 +112,6 @@ var useResizableItem = ({
98
112
  onCollapse,
99
113
  onExpand,
100
114
  onResize,
101
- ...collapsible ? { "aria-labelledby": id } : { "aria-label": id },
102
115
  ...rest
103
116
  };
104
117
  },
@@ -137,30 +150,49 @@ var useResizableTrigger = ({
137
150
  as,
138
151
  disabled,
139
152
  isDisabled,
140
- onDragging,
141
153
  ...rest
142
154
  }) => {
143
155
  const uuid = useId();
144
156
  id != null ? id : id = uuid;
145
- const { isDisabled: isGroupDisabled } = useResizableContext();
157
+ const { controlRef, isDisabled: isGroupDisabled } = useResizableContext();
146
158
  const [isActive, setIsActive] = useState(false);
147
159
  const trulyDisabled = disabled || isDisabled || isGroupDisabled;
160
+ const onDoubleClick = useCallback(
161
+ (ev) => {
162
+ var _a, _b;
163
+ ev.preventDefault();
164
+ const layout = (_a = controlRef.current) == null ? void 0 : _a.getLayout();
165
+ if (!layout) return;
166
+ const count = layout.length;
167
+ const size = 100 / count;
168
+ const nextLayout = layout.map(() => size);
169
+ (_b = controlRef.current) == null ? void 0 : _b.setLayout(nextLayout);
170
+ },
171
+ [controlRef]
172
+ );
148
173
  const getTriggerProps = useCallback(
149
174
  (props = {}) => ({
150
175
  ...props,
151
176
  id,
152
177
  disabled: trulyDisabled,
153
178
  tagName: as,
154
- onDragging: handlerAll(onDragging, (isActive2) => setIsActive(isActive2)),
155
179
  ...rest,
156
180
  style: {
157
181
  ...props.style,
158
182
  ...rest.style,
159
183
  ...trulyDisabled ? { cursor: "default" } : {}
160
184
  },
161
- "data-active": dataAttr(isActive)
185
+ "data-active": dataAttr(isActive),
186
+ onDoubleClick: handlerAll(
187
+ rest.onDoubleClick,
188
+ onDoubleClick
189
+ ),
190
+ onDragging: handlerAll(
191
+ rest.onDragging,
192
+ (isActive2) => setIsActive(isActive2)
193
+ )
162
194
  }),
163
- [id, as, trulyDisabled, onDragging, rest, isActive]
195
+ [id, as, trulyDisabled, rest, onDoubleClick, isActive]
164
196
  );
165
197
  const getIconProps = useCallback(
166
198
  (props = {}, ref2 = null) => ({
@@ -188,4 +220,4 @@ export {
188
220
  useResizableItem,
189
221
  useResizableTrigger
190
222
  };
191
- //# sourceMappingURL=chunk-HAROVF4B.mjs.map
223
+ //# sourceMappingURL=chunk-WCMBVV3R.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/use-resizable.ts"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n MouseEvent,\n MouseEventHandler,\n RefObject,\n} from \"react\"\nimport type {\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableGroupControl extends ImperativePanelGroupHandle {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n controlRef: RefObject<ResizableGroupControl>\n isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: \"horizontal\" | \"vertical\"\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n direction,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const { controlRef, isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n disabled: trulyDisabled,\n tagName: as,\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(isActive),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (isActive) =>\n setIsActive(isActive),\n ),\n }) as PanelResizeHandleProps,\n [id, as, trulyDisabled, rest, onDoubleClick, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;AAsBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,WAAW,OAAO,QAAQ,gBAAgB;AAChE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA2BA,IAAM,CAAC,mBAAmB,mBAAmB,IAClD,cAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAkDI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,aAAa,OAA8B,IAAI;AACrD,QAAM,OAAO,MAAM;AAEnB,yBAAO;AAEP,QAAM,oBAAgC;AAAA,IACpC,CAAC,QAAQ,CAAC,GAAGA,OAAM,UAAU,EAAE,GAAG,OAAO,KAAAA,MAAK,GAAG,KAAK;AAAA,IACtD,CAAC,IAAI;AAAA,EACP;AAEA,QAAM,gBAAgB;AAAA,IACpB,CAAC,QAAkC,CAAC,MAAM;AACxC,YAAM,EAAE,IAAI,GAAGC,MAAK,IAAI,kCAAc,CAAC;AAEvC,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QACA,KAAK,UAAU,gBAAgB,UAAU;AAAA,QACzC,YAAY;AAAA,QACZ;AAAA,QACA,kBAAkB;AAAA,QAClB;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA,GAAGA;AAAA,MACL;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA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;AAAA,EACvD;AAEA,QAAM,eAA2B;AAAA,IAC/B,CAAC,QAAQ,CAAC,GAAGF,OAAM,UAAU;AAAA,MAC3B,GAAG;AAAA,MACH,KAAAA;AAAA,MACA,eAAe,SAAS,QAAQ;AAAA,IAClC;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,GAAI;AAET,UAAM,KAAK,uBAAuB,EAAE;AAEpC,QAAI,YAAY,GAAG,EAAG,KAAI,UAAU;AAAA,EACtC,GAAG,CAAC,KAAK,EAAE,CAAC;AAEZ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["ref","rest","isActive"]}
package/dist/index.d.mts CHANGED
@@ -6,4 +6,5 @@ import '@yamada-ui/core';
6
6
  import 'react';
7
7
  import '@yamada-ui/icon';
8
8
  import '@yamada-ui/utils';
9
+ import 'react-resizable-panels/dist/declarations/src/types';
9
10
  import 'react-resizable-panels';
package/dist/index.d.ts CHANGED
@@ -6,4 +6,5 @@ import '@yamada-ui/core';
6
6
  import 'react';
7
7
  import '@yamada-ui/icon';
8
8
  import '@yamada-ui/utils';
9
+ import 'react-resizable-panels/dist/declarations/src/types';
9
10
  import 'react-resizable-panels';
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ var [ResizableProvider, useResizableContext] = (0, import_utils.createContext)({
44
44
  var useResizable = ({
45
45
  id,
46
46
  ref,
47
+ controlRef: controlRefProp,
47
48
  direction = "horizontal",
48
49
  isDisabled = false,
49
50
  keyboardStep,
@@ -53,6 +54,7 @@ var useResizable = ({
53
54
  onLayout,
54
55
  ...rest
55
56
  }) => {
57
+ const controlRef = (0, import_react.useRef)(null);
56
58
  const uuid = (0, import_react.useId)();
57
59
  id != null ? id : id = uuid;
58
60
  const getContainerProps = (0, import_react.useCallback)(
@@ -65,6 +67,7 @@ var useResizable = ({
65
67
  return {
66
68
  ...props,
67
69
  id,
70
+ ref: (0, import_utils.mergeRefs)(controlRefProp, controlRef),
68
71
  autoSaveId: storageKey,
69
72
  direction,
70
73
  keyboardResizeBy: keyboardStep,
@@ -74,7 +77,16 @@ var useResizable = ({
74
77
  ...rest2
75
78
  };
76
79
  },
77
- [id, direction, groupProps, storageKey, keyboardStep, onLayout, storage]
80
+ [
81
+ id,
82
+ direction,
83
+ groupProps,
84
+ controlRefProp,
85
+ storageKey,
86
+ keyboardStep,
87
+ onLayout,
88
+ storage
89
+ ]
78
90
  );
79
91
  (0, import_react.useEffect)(() => {
80
92
  if (!id) return;
@@ -82,6 +94,7 @@ var useResizable = ({
82
94
  if ((0, import_utils.isRefObject)(ref)) ref.current = el;
83
95
  }, [ref, id]);
84
96
  return {
97
+ controlRef,
85
98
  isDisabled,
86
99
  getContainerProps,
87
100
  getGroupProps
@@ -122,7 +135,6 @@ var useResizableItem = ({
122
135
  onCollapse,
123
136
  onExpand,
124
137
  onResize,
125
- ...collapsible ? { "aria-labelledby": id } : { "aria-label": id },
126
138
  ...rest
127
139
  };
128
140
  },
@@ -161,30 +173,49 @@ var useResizableTrigger = ({
161
173
  as,
162
174
  disabled,
163
175
  isDisabled,
164
- onDragging,
165
176
  ...rest
166
177
  }) => {
167
178
  const uuid = (0, import_react.useId)();
168
179
  id != null ? id : id = uuid;
169
- const { isDisabled: isGroupDisabled } = useResizableContext();
180
+ const { controlRef, isDisabled: isGroupDisabled } = useResizableContext();
170
181
  const [isActive, setIsActive] = (0, import_react.useState)(false);
171
182
  const trulyDisabled = disabled || isDisabled || isGroupDisabled;
183
+ const onDoubleClick = (0, import_react.useCallback)(
184
+ (ev) => {
185
+ var _a, _b;
186
+ ev.preventDefault();
187
+ const layout = (_a = controlRef.current) == null ? void 0 : _a.getLayout();
188
+ if (!layout) return;
189
+ const count = layout.length;
190
+ const size = 100 / count;
191
+ const nextLayout = layout.map(() => size);
192
+ (_b = controlRef.current) == null ? void 0 : _b.setLayout(nextLayout);
193
+ },
194
+ [controlRef]
195
+ );
172
196
  const getTriggerProps = (0, import_react.useCallback)(
173
197
  (props = {}) => ({
174
198
  ...props,
175
199
  id,
176
200
  disabled: trulyDisabled,
177
201
  tagName: as,
178
- onDragging: (0, import_utils.handlerAll)(onDragging, (isActive2) => setIsActive(isActive2)),
179
202
  ...rest,
180
203
  style: {
181
204
  ...props.style,
182
205
  ...rest.style,
183
206
  ...trulyDisabled ? { cursor: "default" } : {}
184
207
  },
185
- "data-active": (0, import_utils.dataAttr)(isActive)
208
+ "data-active": (0, import_utils.dataAttr)(isActive),
209
+ onDoubleClick: (0, import_utils.handlerAll)(
210
+ rest.onDoubleClick,
211
+ onDoubleClick
212
+ ),
213
+ onDragging: (0, import_utils.handlerAll)(
214
+ rest.onDragging,
215
+ (isActive2) => setIsActive(isActive2)
216
+ )
186
217
  }),
187
- [id, as, trulyDisabled, onDragging, rest, isActive]
218
+ [id, as, trulyDisabled, rest, onDoubleClick, isActive]
188
219
  );
189
220
  const getIconProps = (0, import_react.useCallback)(
190
221
  (props = {}, ref2 = null) => ({
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/resizable.tsx","../src/use-resizable.ts","../src/resizable-item.tsx","../src/resizable-trigger.tsx"],"sourcesContent":["export { Resizable } from \"./resizable\"\nexport type { ResizableProps } from \"./resizable\"\nexport { ResizableItem } from \"./resizable-item\"\nexport type { ResizableItemProps } from \"./resizable-item\"\nexport { ResizableTrigger, ResizableTriggerIcon } from \"./resizable-trigger\"\nexport type {\n ResizableTriggerIconProps,\n ResizableTriggerProps,\n} from \"./resizable-trigger\"\nexport type { ResizableItemControl, ResizableStorage } from \"./use-resizable\"\n","import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableProps } from \"./use-resizable\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { PanelGroup } from \"react-resizable-panels\"\nimport { ResizableProvider, useResizable } from \"./use-resizable\"\n\ninterface ResizableOptions {\n /**\n * Ref for resizable container element.\n */\n containerRef?: ForwardedRef<HTMLDivElement>\n}\n\n/**\n * `Resizable` is accessible resizable panel groups and layouts with keyboard support.\n *\n * @see Docs https://yamada-ui.com/components/data-display/resizable\n */\nexport interface ResizableProps\n extends Omit<HTMLUIProps, \"direction\">,\n ThemeProps<\"Resizable\">,\n Omit<UseResizableProps, \"ref\">,\n ResizableOptions {}\n\nexport const Resizable = forwardRef<ResizableProps, \"div\">(\n ({ direction = \"horizontal\", ...props }, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Resizable\", {\n direction,\n ...props,\n })\n const { className, children, containerRef, ...computedProps } =\n omitThemeProps(mergedProps)\n const { getContainerProps, getGroupProps, ...rest } = useResizable({\n ref,\n ...computedProps,\n })\n\n const css: CSSUIObject = { h: \"100%\", w: \"100%\", ...styles.container }\n\n return (\n <ResizableProvider value={{ styles, ...rest }}>\n <ui.div\n className={cx(\"ui-resizable\", className)}\n __css={css}\n {...getContainerProps({}, containerRef)}\n >\n <PanelGroup {...getGroupProps()}>{children}</PanelGroup>\n </ui.div>\n </ResizableProvider>\n )\n },\n)\n\nResizable.displayName = \"Resizable\"\nResizable.__ui__ = \"Resizable\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport type {\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: \"horizontal\" | \"vertical\"\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}): PanelGroupProps => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [id, direction, groupProps, storageKey, keyboardStep, onLayout, storage],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...(collapsible ? { \"aria-labelledby\": id } : { \"aria-label\": id }),\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n disabled: trulyDisabled,\n tagName: as,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(isActive),\n }) as PanelResizeHandleProps,\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableItemProps } from \"./use-resizable\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { Panel } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableItem } from \"./use-resizable\"\n\nconst panelProps = new Set([\"order\"])\n\nconst UIPanel = ui(Panel, { disableStyleProp: (prop) => panelProps.has(prop) })\n\ninterface ResizableItemOptions {\n /**\n * Ref for resizable item inner element.\n */\n innerRef?: ForwardedRef<HTMLDivElement>\n}\n\nexport interface ResizableItemProps\n extends Omit<UseResizableItemProps, \"ref\">,\n ResizableItemOptions {}\n\nexport const ResizableItem = forwardRef<ResizableItemProps, \"div\">(\n (\n {\n className,\n boxSize,\n children,\n h,\n height,\n innerRef,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useResizableContext()\n const { getItemProps, getPanelProps } = useResizableItem({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { boxSize: \"100%\", ...styles.item }\n\n return (\n <UIPanel\n {...getPanelProps({\n boxSize,\n h,\n height,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n })}\n >\n <ui.div\n className={cx(\"ui-resizable__item\", className)}\n __css={css}\n {...getItemProps({}, innerRef)}\n >\n {children}\n </ui.div>\n </UIPanel>\n )\n },\n)\n\nResizableItem.displayName = \"ResizableItem\"\nResizableItem.__ui__ = \"ResizableItem\"\n","import type {\n ComponentArgs,\n CSSUIObject,\n FC,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type { ReactElement, RefAttributes } from \"react\"\nimport type { UseResizableTriggerProps } from \"./use-resizable\"\nimport { ui } from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { forwardRef } from \"react\"\nimport { PanelResizeHandle } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableTrigger } from \"./use-resizable\"\n\ninterface ResizableTriggerOptions {\n /**\n * The resizable trigger icon to use.\n */\n icon?: ReactElement\n /**\n * Props for resizable trigger icon component.\n */\n iconProps?: HTMLUIProps\n}\n\nexport interface ResizableTriggerProps\n extends Merge<\n Omit<UseResizableTriggerProps, \"ref\">,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n ResizableTriggerOptions {}\n\nexport const ResizableTrigger = forwardRef<HTMLElement, ResizableTriggerProps>(\n ({ className, children, icon, iconProps, ...rest }, ref) => {\n const { styles } = useResizableContext()\n const { getIconProps, getTriggerProps } = useResizableTrigger({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { position: \"relative\", ...styles.trigger }\n\n return (\n <ui.div\n as={PanelResizeHandle}\n className={cx(\"ui-resizable__trigger\", className)}\n __css={css}\n {...getTriggerProps()}\n >\n {icon ? (\n <ui.div\n className=\"ui-resizable__trigger__icon\"\n __css={{\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"center\",\n left: \"50%\",\n position: \"absolute\",\n top: \"50%\",\n transform: \"auto\",\n translateX: \"-50%\",\n translateY: \"-50%\",\n ...styles.icon,\n }}\n {...getIconProps(iconProps)}\n >\n {icon}\n </ui.div>\n ) : null}\n\n {children}\n </ui.div>\n )\n },\n) as {\n (props: RefAttributes<HTMLElement> & ResizableTriggerProps): ReactElement\n} & ComponentArgs\n\nResizableTrigger.displayName = \"ResizableTrigger\"\nResizableTrigger.__ui__ = \"ResizableTrigger\"\n\nexport type ResizableTriggerIconProps = IconProps\n\nexport const ResizableTriggerIcon: FC<ResizableTriggerIconProps> = (rest) => {\n return (\n <Icon h=\"1rem\" viewBox=\"0 0 23 39\" w=\"0.5rem\" {...rest}>\n <path\n d=\"M 5 0 C 7.761 0 10 2.239 10 5 C 10 7.761 7.761 10 5 10 C 2.239 10 0 7.761 0 5 C 0 2.239 2.239 0 5 0 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 0 C 21.761 0 24 2.239 24 5 C 24 7.761 21.761 10 19 10 C 16.239 10 14 7.761 14 5 C 14 2.239 16.239 0 19 0 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 14 C 21.761 14 24 16.239 24 19 C 24 21.761 21.761 24 19 24 C 16.239 24 14 21.761 14 19 C 14 16.239 16.239 14 19 14 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 5 14 C 7.761 14 10 16.239 10 19 C 10 21.761 7.761 24 5 24 C 2.239 24 0 21.761 0 19 C 0 16.239 2.239 14 5 14 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 5 28 C 7.761 28 10 30.239 10 33 C 10 35.761 7.761 38 5 38 C 2.239 38 0 35.761 0 33 C 0 30.239 2.239 28 5 28 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 28 C 21.761 28 24 30.239 24 33 C 24 35.761 21.761 38 19 38 C 16.239 38 14 35.761 14 33 C 14 30.239 16.239 28 19 28 Z\"\n fill=\"currentColor\"\n />\n </Icon>\n )\n}\n\nResizableTriggerIcon.__ui__ = \"ResizableTriggerIcon\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,kBAKO;AACP,IAAAA,gBAAmB;AACnB,IAAAC,iCAA2B;;;ACM3B,mBAKO;AACP,mBAAwD;AACxD,oCAIO;AAyBA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA8CI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,WAAO,oBAAM;AAEnB,yBAAO;AAEP,QAAM,wBAAgC;AAAA,IACpC,CAAC,QAAQ,CAAC,GAAGC,OAAM,UAAU,EAAE,GAAG,OAAO,KAAAA,MAAK,GAAG,KAAK;AAAA,IACtD,CAAC,IAAI;AAAA,EACP;AAEA,QAAM,oBAAgB;AAAA,IACpB,CAAC,QAAkC,CAAC,MAAuB;AACzD,YAAM,EAAE,IAAI,GAAGC,MAAK,IAAI,kCAAc,CAAC;AAEvC,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QACA,YAAY;AAAA,QACZ;AAAA,QACA,kBAAkB;AAAA,QAClB;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA,GAAGA;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,IAAI,WAAW,YAAY,YAAY,cAAc,UAAU,OAAO;AAAA,EACzE;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC,GAAI;AAET,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AC,gBAAG;AAAA,YAAH;AAAA,cACC,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,YAAY;AAAA,gBACZ,SAAS;AAAA,gBACT,gBAAgB;AAAA,gBAChB,MAAM;AAAA,gBACN,UAAU;AAAA,gBACV,KAAK;AAAA,gBACL,WAAW;AAAA,gBACX,YAAY;AAAA,gBACZ,YAAY;AAAA,gBACZ,GAAG,OAAO;AAAA,cACZ;AAAA,cACC,GAAG,aAAa,SAAS;AAAA,cAEzB;AAAA;AAAA,UACH,IACE;AAAA,UAEH;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAIA,iBAAiB,cAAc;AAC/B,iBAAiB,SAAS;AAInB,IAAM,uBAAsD,CAAC,SAAS;AAC3E,SACE,8CAAC,oBAAK,GAAE,QAAO,SAAQ,aAAY,GAAE,UAAU,GAAG,MAChD;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,KACF;AAEJ;AAEA,qBAAqB,SAAS;","names":["import_utils","import_react_resizable_panels","ref","rest","isActive","import_core","import_utils","import_react_resizable_panels","import_jsx_runtime","import_core","import_utils","import_react","import_react_resizable_panels","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/resizable.tsx","../src/use-resizable.ts","../src/resizable-item.tsx","../src/resizable-trigger.tsx"],"sourcesContent":["export { Resizable } from \"./resizable\"\nexport type { ResizableProps } from \"./resizable\"\nexport { ResizableItem } from \"./resizable-item\"\nexport type { ResizableItemProps } from \"./resizable-item\"\nexport { ResizableTrigger, ResizableTriggerIcon } from \"./resizable-trigger\"\nexport type {\n ResizableTriggerIconProps,\n ResizableTriggerProps,\n} from \"./resizable-trigger\"\nexport type { ResizableItemControl, ResizableStorage } from \"./use-resizable\"\n","import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableProps } from \"./use-resizable\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { PanelGroup } from \"react-resizable-panels\"\nimport { ResizableProvider, useResizable } from \"./use-resizable\"\n\ninterface ResizableOptions {\n /**\n * Ref for resizable container element.\n */\n containerRef?: ForwardedRef<HTMLDivElement>\n}\n\n/**\n * `Resizable` is accessible resizable panel groups and layouts with keyboard support.\n *\n * @see Docs https://yamada-ui.com/components/data-display/resizable\n */\nexport interface ResizableProps\n extends Omit<HTMLUIProps, \"direction\">,\n ThemeProps<\"Resizable\">,\n Omit<UseResizableProps, \"ref\">,\n ResizableOptions {}\n\nexport const Resizable = forwardRef<ResizableProps, \"div\">(\n ({ direction = \"horizontal\", ...props }, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Resizable\", {\n direction,\n ...props,\n })\n const { className, children, containerRef, ...computedProps } =\n omitThemeProps(mergedProps)\n const { getContainerProps, getGroupProps, ...rest } = useResizable({\n ref,\n ...computedProps,\n })\n\n const css: CSSUIObject = { h: \"100%\", w: \"100%\", ...styles.container }\n\n return (\n <ResizableProvider value={{ styles, ...rest }}>\n <ui.div\n className={cx(\"ui-resizable\", className)}\n __css={css}\n {...getContainerProps({}, containerRef)}\n >\n <PanelGroup {...getGroupProps()}>{children}</PanelGroup>\n </ui.div>\n </ResizableProvider>\n )\n },\n)\n\nResizable.displayName = \"Resizable\"\nResizable.__ui__ = \"Resizable\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n MouseEvent,\n MouseEventHandler,\n RefObject,\n} from \"react\"\nimport type {\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableGroupControl extends ImperativePanelGroupHandle {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n controlRef: RefObject<ResizableGroupControl>\n isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: \"horizontal\" | \"vertical\"\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n direction,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const { controlRef, isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n disabled: trulyDisabled,\n tagName: as,\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(isActive),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (isActive) =>\n setIsActive(isActive),\n ),\n }) as PanelResizeHandleProps,\n [id, as, trulyDisabled, rest, onDoubleClick, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableItemProps } from \"./use-resizable\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { Panel } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableItem } from \"./use-resizable\"\n\nconst panelProps = new Set([\"order\"])\n\nconst UIPanel = ui(Panel, { disableStyleProp: (prop) => panelProps.has(prop) })\n\ninterface ResizableItemOptions {\n /**\n * Ref for resizable item inner element.\n */\n innerRef?: ForwardedRef<HTMLDivElement>\n}\n\nexport interface ResizableItemProps\n extends Omit<UseResizableItemProps, \"ref\">,\n ResizableItemOptions {}\n\nexport const ResizableItem = forwardRef<ResizableItemProps, \"div\">(\n (\n {\n className,\n boxSize,\n children,\n h,\n height,\n innerRef,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useResizableContext()\n const { getItemProps, getPanelProps } = useResizableItem({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { boxSize: \"100%\", ...styles.item }\n\n return (\n <UIPanel\n {...getPanelProps({\n boxSize,\n h,\n height,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n })}\n >\n <ui.div\n className={cx(\"ui-resizable__item\", className)}\n __css={css}\n {...getItemProps({}, innerRef)}\n >\n {children}\n </ui.div>\n </UIPanel>\n )\n },\n)\n\nResizableItem.displayName = \"ResizableItem\"\nResizableItem.__ui__ = \"ResizableItem\"\n","import type {\n ComponentArgs,\n CSSUIObject,\n FC,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type { ReactElement, RefAttributes } from \"react\"\nimport type { UseResizableTriggerProps } from \"./use-resizable\"\nimport { ui } from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { forwardRef } from \"react\"\nimport { PanelResizeHandle } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableTrigger } from \"./use-resizable\"\n\ninterface ResizableTriggerOptions {\n /**\n * The resizable trigger icon to use.\n */\n icon?: ReactElement\n /**\n * Props for resizable trigger icon component.\n */\n iconProps?: HTMLUIProps\n}\n\nexport interface ResizableTriggerProps\n extends Merge<\n Omit<UseResizableTriggerProps, \"ref\">,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n ResizableTriggerOptions {}\n\nexport const ResizableTrigger = forwardRef<HTMLElement, ResizableTriggerProps>(\n ({ className, children, icon, iconProps, ...rest }, ref) => {\n const { styles } = useResizableContext()\n const { getIconProps, getTriggerProps } = useResizableTrigger({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { position: \"relative\", ...styles.trigger }\n\n return (\n <ui.div\n as={PanelResizeHandle}\n className={cx(\"ui-resizable__trigger\", className)}\n __css={css}\n {...getTriggerProps()}\n >\n {icon ? (\n <ui.div\n className=\"ui-resizable__trigger__icon\"\n __css={{\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"center\",\n left: \"50%\",\n position: \"absolute\",\n top: \"50%\",\n transform: \"auto\",\n translateX: \"-50%\",\n translateY: \"-50%\",\n ...styles.icon,\n }}\n {...getIconProps(iconProps)}\n >\n {icon}\n </ui.div>\n ) : null}\n\n {children}\n </ui.div>\n )\n },\n) as {\n (props: RefAttributes<HTMLElement> & ResizableTriggerProps): ReactElement\n} & ComponentArgs\n\nResizableTrigger.displayName = \"ResizableTrigger\"\nResizableTrigger.__ui__ = \"ResizableTrigger\"\n\nexport type ResizableTriggerIconProps = IconProps\n\nexport const ResizableTriggerIcon: FC<ResizableTriggerIconProps> = (rest) => {\n return (\n <Icon h=\"1rem\" viewBox=\"0 0 23 39\" w=\"0.5rem\" {...rest}>\n <path\n d=\"M 5 0 C 7.761 0 10 2.239 10 5 C 10 7.761 7.761 10 5 10 C 2.239 10 0 7.761 0 5 C 0 2.239 2.239 0 5 0 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 0 C 21.761 0 24 2.239 24 5 C 24 7.761 21.761 10 19 10 C 16.239 10 14 7.761 14 5 C 14 2.239 16.239 0 19 0 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 14 C 21.761 14 24 16.239 24 19 C 24 21.761 21.761 24 19 24 C 16.239 24 14 21.761 14 19 C 14 16.239 16.239 14 19 14 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 5 14 C 7.761 14 10 16.239 10 19 C 10 21.761 7.761 24 5 24 C 2.239 24 0 21.761 0 19 C 0 16.239 2.239 14 5 14 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 5 28 C 7.761 28 10 30.239 10 33 C 10 35.761 7.761 38 5 38 C 2.239 38 0 35.761 0 33 C 0 30.239 2.239 28 5 28 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 28 C 21.761 28 24 30.239 24 33 C 24 35.761 21.761 38 19 38 C 16.239 38 14 35.761 14 33 C 14 30.239 16.239 28 19 28 Z\"\n fill=\"currentColor\"\n />\n </Icon>\n )\n}\n\nResizableTriggerIcon.__ui__ = \"ResizableTri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AAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,KACF;AAEJ;AAEA,qBAAqB,SAAS;","names":["import_utils","import_react_resizable_panels","ref","rest","isActive","import_core","import_utils","import_react_resizable_panels","import_jsx_runtime","import_core","import_utils","import_react","import_react_resizable_panels","import_jsx_runtime"]}
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  "use client"
2
2
  import {
3
3
  ResizableItem
4
- } from "./chunk-72BYQXIX.mjs";
4
+ } from "./chunk-JU7AHOX7.mjs";
5
5
  import {
6
6
  ResizableTrigger,
7
7
  ResizableTriggerIcon
8
- } from "./chunk-OV5GGHOC.mjs";
8
+ } from "./chunk-25QQGKDC.mjs";
9
9
  import {
10
10
  Resizable
11
- } from "./chunk-EICWL7I5.mjs";
12
- import "./chunk-HAROVF4B.mjs";
11
+ } from "./chunk-NG4RLXOF.mjs";
12
+ import "./chunk-WCMBVV3R.mjs";
13
13
  export {
14
14
  Resizable,
15
15
  ResizableItem,
@@ -1,6 +1,7 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { ForwardedRef } from 'react';
3
3
  import { UseResizableItemProps } from './use-resizable.mjs';
4
+ import 'react-resizable-panels/dist/declarations/src/types';
4
5
  import '@yamada-ui/utils';
5
6
  import 'react-resizable-panels';
6
7
 
@@ -1,6 +1,7 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { ForwardedRef } from 'react';
3
3
  import { UseResizableItemProps } from './use-resizable.js';
4
+ import 'react-resizable-panels/dist/declarations/src/types';
4
5
  import '@yamada-ui/utils';
5
6
  import 'react-resizable-panels';
6
7
 
@@ -71,7 +71,6 @@ var useResizableItem = ({
71
71
  onCollapse,
72
72
  onExpand,
73
73
  onResize,
74
- ...collapsible ? { "aria-labelledby": id } : { "aria-label": id },
75
74
  ...rest
76
75
  };
77
76
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/resizable-item.tsx","../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableItemProps } from \"./use-resizable\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { Panel } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableItem } from \"./use-resizable\"\n\nconst panelProps = new Set([\"order\"])\n\nconst UIPanel = ui(Panel, { disableStyleProp: (prop) => panelProps.has(prop) })\n\ninterface ResizableItemOptions {\n /**\n * Ref for resizable item inner element.\n */\n innerRef?: ForwardedRef<HTMLDivElement>\n}\n\nexport interface ResizableItemProps\n extends Omit<UseResizableItemProps, \"ref\">,\n ResizableItemOptions {}\n\nexport const ResizableItem = forwardRef<ResizableItemProps, \"div\">(\n (\n {\n className,\n boxSize,\n children,\n h,\n height,\n innerRef,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useResizableContext()\n const { getItemProps, getPanelProps } = useResizableItem({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { boxSize: \"100%\", ...styles.item }\n\n return (\n <UIPanel\n {...getPanelProps({\n boxSize,\n h,\n height,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n })}\n >\n <ui.div\n className={cx(\"ui-resizable__item\", className)}\n __css={css}\n {...getItemProps({}, innerRef)}\n >\n {children}\n </ui.div>\n </UIPanel>\n )\n },\n)\n\nResizableItem.displayName = \"ResizableItem\"\nResizableItem.__ui__ = \"ResizableItem\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport type {\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: \"horizontal\" | \"vertical\"\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}): PanelGroupProps => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [id, direction, groupProps, storageKey, keyboardStep, onLayout, storage],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...(collapsible ? { \"aria-labelledby\": id } : { \"aria-label\": id }),\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n disabled: trulyDisabled,\n tagName: as,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(isActive),\n }) as PanelResizeHandleProps,\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA+B;AAC/B,IAAAA,gBAAmB;AACnB,IAAAC,iCAAsB;;;ACWtB,mBAKO;AACP,mBAAwD;AACxD,oCAIO;AAyBA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAoKI,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AACH,UAAM,EAAE,OAAO,IAAI,oBAAoB;AACvC,UAAM,EAAE,cAAc,cAAc,IAAI,iBAAiB;AAAA,MACvD;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAED,UAAM,MAAmB,EAAE,SAAS,QAAQ,GAAG,OAAO,KAAK;AAE3D,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG,cAAc;AAAA,UAChB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QAED;AAAA,UAAC,eAAG;AAAA,UAAH;AAAA,YACC,eAAW,kBAAG,sBAAsB,SAAS;AAAA,YAC7C,OAAO;AAAA,YACN,GAAG,aAAa,CAAC,GAAG,QAAQ;AAAA,YAE5B;AAAA;AAAA,QACH;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,cAAc,cAAc;AAC5B,cAAc,SAAS;","names":["import_utils","import_react_resizable_panels","ref"]}
1
+ {"version":3,"sources":["../src/resizable-item.tsx","../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableItemProps } from \"./use-resizable\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { Panel } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableItem } from \"./use-resizable\"\n\nconst panelProps = new Set([\"order\"])\n\nconst UIPanel = ui(Panel, { disableStyleProp: (prop) => panelProps.has(prop) })\n\ninterface ResizableItemOptions {\n /**\n * Ref for resizable item inner element.\n */\n innerRef?: ForwardedRef<HTMLDivElement>\n}\n\nexport interface ResizableItemProps\n extends Omit<UseResizableItemProps, \"ref\">,\n ResizableItemOptions {}\n\nexport const ResizableItem = forwardRef<ResizableItemProps, \"div\">(\n (\n {\n className,\n boxSize,\n children,\n h,\n height,\n innerRef,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useResizableContext()\n const { getItemProps, getPanelProps } = useResizableItem({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { boxSize: \"100%\", ...styles.item }\n\n return (\n <UIPanel\n {...getPanelProps({\n boxSize,\n h,\n height,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n })}\n >\n <ui.div\n className={cx(\"ui-resizable__item\", className)}\n __css={css}\n {...getItemProps({}, innerRef)}\n >\n {children}\n </ui.div>\n </UIPanel>\n )\n },\n)\n\nResizableItem.displayName = \"ResizableItem\"\nResizableItem.__ui__ = \"ResizableItem\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n MouseEvent,\n MouseEventHandler,\n RefObject,\n} from \"react\"\nimport type {\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableGroupControl extends ImperativePanelGroupHandle {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n controlRef: RefObject<ResizableGroupControl>\n isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: \"horizontal\" | \"vertical\"\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n direction,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const { controlRef, isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n disabled: trulyDisabled,\n tagName: as,\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(isActive),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (isActive) =>\n setIsActive(isActive),\n ),\n }) as PanelResizeHandleProps,\n [id, as, trulyDisabled, rest, onDoubleClick, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA+B;AAC/B,IAAAA,gBAAmB;AACnB,IAAAC,iCAAsB;;;ACiBtB,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA2BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAqLI,IAAM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AAM,oBAAgB;AAAA,EAC3B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AACH,UAAM,EAAE,OAAO,IAAI,oBAAoB;AACvC,UAAM,EAAE,cAAc,cAAc,IAAI,iBAAiB;AAAA,MACvD;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAED,UAAM,MAAmB,EAAE,SAAS,QAAQ,GAAG,OAAO,KAAK;AAE3D,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG,cAAc;AAAA,UAChB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QAED;AAAA,UAAC,eAAG;AAAA,UAAH;AAAA,YACC,eAAW,kBAAG,sBAAsB,SAAS;AAAA,YAC7C,OAAO;AAAA,YACN,GAAG,aAAa,CAAC,GAAG,QAAQ;AAAA,YAE5B;AAAA;AAAA,QACH;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,cAAc,cAAc;AAC5B,cAAc,SAAS;","names":["import_utils","import_react_resizable_panels","ref"]}
@@ -1,8 +1,8 @@
1
1
  "use client"
2
2
  import {
3
3
  ResizableItem
4
- } from "./chunk-72BYQXIX.mjs";
5
- import "./chunk-HAROVF4B.mjs";
4
+ } from "./chunk-JU7AHOX7.mjs";
5
+ import "./chunk-WCMBVV3R.mjs";
6
6
  export {
7
7
  ResizableItem
8
8
  };
@@ -3,6 +3,7 @@ import { IconProps } from '@yamada-ui/icon';
3
3
  import { Merge } from '@yamada-ui/utils';
4
4
  import { RefAttributes, ReactElement } from 'react';
5
5
  import { UseResizableTriggerProps } from './use-resizable.mjs';
6
+ import 'react-resizable-panels/dist/declarations/src/types';
6
7
  import 'react-resizable-panels';
7
8
 
8
9
  interface ResizableTriggerOptions {
@@ -3,6 +3,7 @@ import { IconProps } from '@yamada-ui/icon';
3
3
  import { Merge } from '@yamada-ui/utils';
4
4
  import { RefAttributes, ReactElement } from 'react';
5
5
  import { UseResizableTriggerProps } from './use-resizable.js';
6
+ import 'react-resizable-panels/dist/declarations/src/types';
6
7
  import 'react-resizable-panels';
7
8
 
8
9
  interface ResizableTriggerOptions {