@yamada-ui/resizable 1.2.4-dev-20241212101624 → 1.3.0-dev-20241213204523

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  useResizableContext,
4
4
  useResizableTrigger
5
- } from "./chunk-G6HLTSUK.mjs";
5
+ } from "./chunk-KTGBOEYI.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-ECNT6LJV.mjs.map
110
+ //# sourceMappingURL=chunk-KGV3GLXC.mjs.map
@@ -23,9 +23,10 @@ var useResizable = ({
23
23
  ref,
24
24
  controlRef: controlRefProp,
25
25
  direction = "horizontal",
26
- disabled = false,
27
26
  isDisabled = false,
27
+ disabled = isDisabled,
28
28
  keyboardStep,
29
+ orientation = direction,
29
30
  storage,
30
31
  storageKey,
31
32
  groupProps,
@@ -47,7 +48,7 @@ var useResizable = ({
47
48
  id,
48
49
  ref: mergeRefs(controlRefProp, controlRef),
49
50
  autoSaveId: storageKey,
50
- direction,
51
+ direction: orientation,
51
52
  keyboardResizeBy: keyboardStep,
52
53
  storage,
53
54
  tagName: as,
@@ -57,7 +58,7 @@ var useResizable = ({
57
58
  },
58
59
  [
59
60
  id,
60
- direction,
61
+ orientation,
61
62
  groupProps,
62
63
  controlRefProp,
63
64
  storageKey,
@@ -73,8 +74,8 @@ var useResizable = ({
73
74
  }, [ref, id]);
74
75
  return {
75
76
  controlRef,
76
- direction,
77
- disabled: disabled || isDisabled,
77
+ disabled,
78
+ orientation,
78
79
  getContainerProps,
79
80
  getGroupProps
80
81
  };
@@ -150,19 +151,19 @@ var useResizableTrigger = ({
150
151
  id,
151
152
  ref,
152
153
  as,
153
- disabled,
154
154
  isDisabled,
155
+ disabled = isDisabled,
155
156
  ...rest
156
157
  }) => {
157
158
  const uuid = useId();
158
- id != null ? id : id = uuid;
159
159
  const {
160
160
  controlRef,
161
- direction,
162
- disabled: groupDisabled
161
+ disabled: groupDisabled,
162
+ orientation
163
163
  } = useResizableContext();
164
+ id != null ? id : id = uuid;
164
165
  const [active, setActive] = useState(false);
165
- const trulyDisabled = disabled || isDisabled || groupDisabled;
166
+ const trulyDisabled = disabled || groupDisabled;
166
167
  const onDoubleClick = useCallback(
167
168
  (ev) => {
168
169
  var _a, _b;
@@ -180,7 +181,7 @@ var useResizableTrigger = ({
180
181
  (props = {}) => ({
181
182
  ...props,
182
183
  id,
183
- "aria-orientation": direction,
184
+ "aria-orientation": orientation,
184
185
  disabled: trulyDisabled,
185
186
  tagName: as,
186
187
  ...rest,
@@ -196,7 +197,7 @@ var useResizableTrigger = ({
196
197
  ),
197
198
  onDragging: handlerAll(rest.onDragging, (active2) => setActive(active2))
198
199
  }),
199
- [id, as, direction, trulyDisabled, rest, onDoubleClick, active]
200
+ [id, as, orientation, trulyDisabled, rest, onDoubleClick, active]
200
201
  );
201
202
  const getIconProps = useCallback(
202
203
  (props = {}, ref2 = null) => ({
@@ -224,4 +225,4 @@ export {
224
225
  useResizableItem,
225
226
  useResizableTrigger
226
227
  };
227
- //# sourceMappingURL=chunk-G6HLTSUK.mjs.map
228
+ //# sourceMappingURL=chunk-KTGBOEYI.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\ntype ResizableOrientation = \"horizontal\" | \"vertical\"\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 disabled: boolean\n orientation: ResizableOrientation\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 * @deprecated Use `orientation` instead.\n */\n direction?: ResizableOrientation\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @deprecated Use `Disabled` instead.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * The orientation of the resizable.\n *\n * @default \"horizontal\"\n */\n orientation?: ResizableOrientation\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 disabled = isDisabled,\n keyboardStep,\n orientation = direction,\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: orientation,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n orientation,\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 disabled,\n orientation,\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 disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n *\n * @deprecated Use `disabled` instead.\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 isDisabled,\n disabled = isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n const {\n controlRef,\n disabled: groupDisabled,\n orientation,\n } = useResizableContext()\n\n id ??= uuid\n\n const [active, setActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || groupDisabled\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 \"aria-orientation\": orientation,\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(active),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (active) => setActive(active)),\n }) as PanelResizeHandleProps,\n [id, as, orientation, trulyDisabled, rest, onDoubleClick, active],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(active),\n }),\n [active],\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;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,IAClD,cAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAgEI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,WAAW;AAAA,EACX;AAAA,EACA,cAAc;AAAA,EACd;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,WAAW;AAAA,QACX,kBAAkB;AAAA,QAClB;AAAA,QACA,SAAS;AAA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QACL;AAAA,MACF;AAAA,MACA,YAAY,WAAW,KAAK,YAAY,CAACE,YAAW,UAAUA,OAAM,CAAC;AAAA,IACvE;AAAA,IACF,CAAC,IAAI,IAAI,aAAa,eAAe,MAAM,eAAe,MAAM;AAAA,EAClE;AAEA,QAAM,eAA2B;AAAA,IAC/B,CAAC,QAAQ,CAAC,GAAGF,OAAM,UAAU;AAAA,MAC3B,GAAG;AAAA,MACH,KAAAA;AAAA,MACA,eAAe,SAAS,MAAM;AAAA,IAChC;AAAA,IACA,CAAC,MAAM;AAAA,EACT;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","active"]}
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ResizableProvider,
4
4
  useResizable
5
- } from "./chunk-G6HLTSUK.mjs";
5
+ } from "./chunk-KTGBOEYI.mjs";
6
6
 
7
7
  // src/resizable.tsx
8
8
  import {
@@ -15,9 +15,10 @@ import { cx } from "@yamada-ui/utils";
15
15
  import { PanelGroup } from "react-resizable-panels";
16
16
  import { jsx } from "react/jsx-runtime";
17
17
  var Resizable = forwardRef(
18
- ({ direction = "horizontal", ...props }, ref) => {
18
+ ({ direction = "horizontal", orientation = direction, ...props }, ref) => {
19
19
  const [styles, mergedProps] = useComponentMultiStyle("Resizable", {
20
20
  direction,
21
+ orientation,
21
22
  ...props
22
23
  });
23
24
  const { className, children, containerRef, ...computedProps } = omitThemeProps(mergedProps);
@@ -43,4 +44,4 @@ Resizable.__ui__ = "Resizable";
43
44
  export {
44
45
  Resizable
45
46
  };
46
- //# sourceMappingURL=chunk-62N65DW7.mjs.map
47
+ //# sourceMappingURL=chunk-VGX275YX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resizable.tsx"],"sourcesContent":["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\", orientation = direction, ...props }, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Resizable\", {\n direction,\n orientation,\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"],"mappings":";;;;;;;AAGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AACnB,SAAS,kBAAkB;AA4CjB;AAvBH,IAAM,YAAY;AAAA,EACvB,CAAC,EAAE,YAAY,cAAc,cAAc,WAAW,GAAG,MAAM,GAAG,QAAQ;AACxE,UAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,aAAa;AAAA,MAChE;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AACD,UAAM,EAAE,WAAW,UAAU,cAAc,GAAG,cAAc,IAC1D,eAAe,WAAW;AAC5B,UAAM,EAAE,mBAAmB,eAAe,GAAG,KAAK,IAAI,aAAa;AAAA,MACjE;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAED,UAAM,MAAmB,EAAE,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,UAAU;AAErE,WACE,oBAAC,qBAAkB,OAAO,EAAE,QAAQ,GAAG,KAAK,GAC1C;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC,WAAW,GAAG,gBAAgB,SAAS;AAAA,QACvC,OAAO;AAAA,QACN,GAAG,kBAAkB,CAAC,GAAG,YAAY;AAAA,QAEtC,8BAAC,cAAY,GAAG,cAAc,GAAI,UAAS;AAAA;AAAA,IAC7C,GACF;AAAA,EAEJ;AACF;AAEA,UAAU,cAAc;AACxB,UAAU,SAAS;","names":[]}
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  useResizableContext,
4
4
  useResizableItem
5
- } from "./chunk-G6HLTSUK.mjs";
5
+ } from "./chunk-KTGBOEYI.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-P6HFD7WR.mjs.map
77
+ //# sourceMappingURL=chunk-W4YKVFWF.mjs.map
package/dist/index.js CHANGED
@@ -46,9 +46,10 @@ var useResizable = ({
46
46
  ref,
47
47
  controlRef: controlRefProp,
48
48
  direction = "horizontal",
49
- disabled = false,
50
49
  isDisabled = false,
50
+ disabled = isDisabled,
51
51
  keyboardStep,
52
+ orientation = direction,
52
53
  storage,
53
54
  storageKey,
54
55
  groupProps,
@@ -70,7 +71,7 @@ var useResizable = ({
70
71
  id,
71
72
  ref: (0, import_utils.mergeRefs)(controlRefProp, controlRef),
72
73
  autoSaveId: storageKey,
73
- direction,
74
+ direction: orientation,
74
75
  keyboardResizeBy: keyboardStep,
75
76
  storage,
76
77
  tagName: as,
@@ -80,7 +81,7 @@ var useResizable = ({
80
81
  },
81
82
  [
82
83
  id,
83
- direction,
84
+ orientation,
84
85
  groupProps,
85
86
  controlRefProp,
86
87
  storageKey,
@@ -96,8 +97,8 @@ var useResizable = ({
96
97
  }, [ref, id]);
97
98
  return {
98
99
  controlRef,
99
- direction,
100
- disabled: disabled || isDisabled,
100
+ disabled,
101
+ orientation,
101
102
  getContainerProps,
102
103
  getGroupProps
103
104
  };
@@ -173,19 +174,19 @@ var useResizableTrigger = ({
173
174
  id,
174
175
  ref,
175
176
  as,
176
- disabled,
177
177
  isDisabled,
178
+ disabled = isDisabled,
178
179
  ...rest
179
180
  }) => {
180
181
  const uuid = (0, import_react.useId)();
181
- id != null ? id : id = uuid;
182
182
  const {
183
183
  controlRef,
184
- direction,
185
- disabled: groupDisabled
184
+ disabled: groupDisabled,
185
+ orientation
186
186
  } = useResizableContext();
187
+ id != null ? id : id = uuid;
187
188
  const [active, setActive] = (0, import_react.useState)(false);
188
- const trulyDisabled = disabled || isDisabled || groupDisabled;
189
+ const trulyDisabled = disabled || groupDisabled;
189
190
  const onDoubleClick = (0, import_react.useCallback)(
190
191
  (ev) => {
191
192
  var _a, _b;
@@ -203,7 +204,7 @@ var useResizableTrigger = ({
203
204
  (props = {}) => ({
204
205
  ...props,
205
206
  id,
206
- "aria-orientation": direction,
207
+ "aria-orientation": orientation,
207
208
  disabled: trulyDisabled,
208
209
  tagName: as,
209
210
  ...rest,
@@ -219,7 +220,7 @@ var useResizableTrigger = ({
219
220
  ),
220
221
  onDragging: (0, import_utils.handlerAll)(rest.onDragging, (active2) => setActive(active2))
221
222
  }),
222
- [id, as, direction, trulyDisabled, rest, onDoubleClick, active]
223
+ [id, as, orientation, trulyDisabled, rest, onDoubleClick, active]
223
224
  );
224
225
  const getIconProps = (0, import_react.useCallback)(
225
226
  (props = {}, ref2 = null) => ({
@@ -243,9 +244,10 @@ var useResizableTrigger = ({
243
244
  // src/resizable.tsx
244
245
  var import_jsx_runtime = require("react/jsx-runtime");
245
246
  var Resizable = (0, import_core.forwardRef)(
246
- ({ direction = "horizontal", ...props }, ref) => {
247
+ ({ direction = "horizontal", orientation = direction, ...props }, ref) => {
247
248
  const [styles, mergedProps] = (0, import_core.useComponentMultiStyle)("Resizable", {
248
249
  direction,
250
+ orientation,
249
251
  ...props
250
252
  });
251
253
  const { className, children, containerRef, ...computedProps } = (0, import_core.omitThemeProps)(mergedProps);
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 {\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\ntype ResizableDirection = \"horizontal\" | \"vertical\"\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 direction: ResizableDirection\n disabled: 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?: ResizableDirection\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @deprecated Use `Disabled` instead.\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 disabled = false,\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 direction,\n disabled: disabled || 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 disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n *\n * @deprecated Use `disabled` instead.\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 {\n controlRef,\n direction,\n disabled: groupDisabled,\n } = useResizableContext()\n const [active, setActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || groupDisabled\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 \"aria-orientation\": direction,\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(active),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (active) => setActive(active)),\n }) as PanelResizeHandleProps,\n [id, as, direction, trulyDisabled, rest, onDoubleClick, active],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(active),\n }),\n [active],\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;;;ACY3B,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAwDI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,a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AAO;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","active","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\", orientation = direction, ...props }, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Resizable\", {\n direction,\n orientation,\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\ntype ResizableOrientation = \"horizontal\" | \"vertical\"\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 disabled: boolean\n orientation: ResizableOrientation\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 * @deprecated Use `orientation` instead.\n */\n direction?: ResizableOrientation\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @deprecated Use `Disabled` instead.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * The orientation of the resizable.\n *\n * @default \"horizontal\"\n */\n orientation?: ResizableOrientation\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 disabled = isDisabled,\n keyboardStep,\n orientation = direction,\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: orientation,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n orientation,\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 disabled,\n orientation,\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 disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n *\n * @deprecated Use `disabled` instead.\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 isDisabled,\n disabled = isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n const {\n controlRef,\n disabled: groupDisabled,\n orientation,\n } = useResizableContext()\n\n id ??= uuid\n\n const [active, setActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || groupDisabled\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 \"aria-orientation\": orientation,\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(active),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (active) => setActive(active)),\n }) as PanelResizeHandleProps,\n [id, as, orientation, trulyDisabled, rest, onDoubleClick, active],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(active),\n }),\n [active],\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;;;ACY3B,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAgEI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,WAAW;AAAA,EACX;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,iBAAa,qBAA8B,IAAI;AACrD,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,MAAM;AACxC,YAAM,EAAE,IAAI,GAAGC,MAAK,IAAI,kCAAc,CAAC;AAEvC,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QACA,SAAK,wBAAU,gBAAgB,UAAU;AAAA,QACzC,YAAY;AA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AAE;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","active","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-P6HFD7WR.mjs";
4
+ } from "./chunk-W4YKVFWF.mjs";
5
5
  import {
6
6
  ResizableTrigger,
7
7
  ResizableTriggerIcon
8
- } from "./chunk-ECNT6LJV.mjs";
8
+ } from "./chunk-KGV3GLXC.mjs";
9
9
  import {
10
10
  Resizable
11
- } from "./chunk-62N65DW7.mjs";
12
- import "./chunk-G6HLTSUK.mjs";
11
+ } from "./chunk-VGX275YX.mjs";
12
+ import "./chunk-KTGBOEYI.mjs";
13
13
  export {
14
14
  Resizable,
15
15
  ResizableItem,
@@ -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 {\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\ntype ResizableDirection = \"horizontal\" | \"vertical\"\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 direction: ResizableDirection\n disabled: 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?: ResizableDirection\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @deprecated Use `Disabled` instead.\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 disabled = false,\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 direction,\n disabled: disabled || 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 disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n *\n * @deprecated Use `disabled` instead.\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 {\n controlRef,\n direction,\n disabled: groupDisabled,\n } = useResizableContext()\n const [active, setActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || groupDisabled\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 \"aria-orientation\": direction,\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(active),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (active) => setActive(active)),\n }) as PanelResizeHandleProps,\n [id, as, direction, trulyDisabled, rest, onDoubleClick, active],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(active),\n }),\n [active],\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;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA6LI,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;AAAA,EACA,GAAG;AACL,MAA6B;AAC3B,QAAM,WAAO,oBAAM;AAEnB,yBAAO;AAEP,QAAM,oBAGF;AAAA,IACF,CAAC,QAAQ,CAAC,MAAM;AACd,YAAM,EAAE,IAAI,GAAG,KAAK,IAAI,0CAAkB,CAAC;AAE3C,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QACA,KAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MACL;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,mBAA2B;AAAA,IAC/B,CAAC,QAAQ,CAAC,GAAGC,OAAM,UAAU,EAAE,GAAG,OAAO,KAA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;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\ntype ResizableOrientation = \"horizontal\" | \"vertical\"\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 disabled: boolean\n orientation: ResizableOrientation\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 * @deprecated Use `orientation` instead.\n */\n direction?: ResizableOrientation\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @deprecated Use `Disabled` instead.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * The orientation of the resizable.\n *\n * @default \"horizontal\"\n */\n orientation?: ResizableOrientation\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 disabled = isDisabled,\n keyboardStep,\n orientation = direction,\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: orientation,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n orientation,\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 disabled,\n orientation,\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 disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n *\n * @deprecated Use `disabled` instead.\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 isDisabled,\n disabled = isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n const {\n controlRef,\n disabled: groupDisabled,\n orientation,\n } = useResizableContext()\n\n id ??= uuid\n\n const [active, setActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || groupDisabled\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 \"aria-orientation\": orientation,\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(active),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (active) => setActive(active)),\n }) as PanelResizeHandleProps,\n [id, as, orientation, trulyDisabled, rest, onDoubleClick, active],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(active),\n }),\n [active],\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;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAsMI,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;AAAA,EACA,GAAG;AACL,MAA6B;AAC3B,QAAM,WAAO,oBAAM;AAEnB,yBAAO;AAEP,QAAM,oBAGF;AAAA,IACF,CAAC,QAAQ,CAAC,MAAM;AACd,YAAM,EAAE,IAAI,GAAG,KAAK,IAAI,0CAAkB,CAAC;AAE3C,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QACA,K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,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-P6HFD7WR.mjs";
5
- import "./chunk-G6HLTSUK.mjs";
4
+ } from "./chunk-W4YKVFWF.mjs";
5
+ import "./chunk-KTGBOEYI.mjs";
6
6
  export {
7
7
  ResizableItem
8
8
  };
@@ -43,19 +43,19 @@ var useResizableTrigger = ({
43
43
  id,
44
44
  ref,
45
45
  as,
46
- disabled,
47
46
  isDisabled,
47
+ disabled = isDisabled,
48
48
  ...rest
49
49
  }) => {
50
50
  const uuid = (0, import_react.useId)();
51
- id != null ? id : id = uuid;
52
51
  const {
53
52
  controlRef,
54
- direction,
55
- disabled: groupDisabled
53
+ disabled: groupDisabled,
54
+ orientation
56
55
  } = useResizableContext();
56
+ id != null ? id : id = uuid;
57
57
  const [active, setActive] = (0, import_react.useState)(false);
58
- const trulyDisabled = disabled || isDisabled || groupDisabled;
58
+ const trulyDisabled = disabled || groupDisabled;
59
59
  const onDoubleClick = (0, import_react.useCallback)(
60
60
  (ev) => {
61
61
  var _a, _b;
@@ -73,7 +73,7 @@ var useResizableTrigger = ({
73
73
  (props = {}) => ({
74
74
  ...props,
75
75
  id,
76
- "aria-orientation": direction,
76
+ "aria-orientation": orientation,
77
77
  disabled: trulyDisabled,
78
78
  tagName: as,
79
79
  ...rest,
@@ -89,7 +89,7 @@ var useResizableTrigger = ({
89
89
  ),
90
90
  onDragging: (0, import_utils.handlerAll)(rest.onDragging, (active2) => setActive(active2))
91
91
  }),
92
- [id, as, direction, trulyDisabled, rest, onDoubleClick, active]
92
+ [id, as, orientation, trulyDisabled, rest, onDoubleClick, active]
93
93
  );
94
94
  const getIconProps = (0, import_react.useCallback)(
95
95
  (props = {}, ref2 = null) => ({