@yamada-ui/resizable 1.0.20-next-20240609092803 → 1.1.0-dev-20240609114752

Sign up to get free protection for your applications and to get access to all the features.
@@ -93,6 +93,7 @@ var useResizableItem = ({
93
93
  onExpand,
94
94
  onResize,
95
95
  order,
96
+ ...collapsible ? { "aria-labelledby": id } : { "aria-label": id },
96
97
  ...rest
97
98
  };
98
99
  },
@@ -185,4 +186,4 @@ export {
185
186
  useResizableItem,
186
187
  useResizableTrigger
187
188
  };
188
- //# sourceMappingURL=chunk-KP2DL4SB.mjs.map
189
+ //# sourceMappingURL=chunk-76SDRAIF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\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AEvD,QAAM,gBAAgB,YAAY,cAAc;AAEhD,QAAM,kBAAqC;AAAA,IACzC,CAAC,QAAQ,CAAC,OAAO;AAAA,MACf,GAAG;AAAA,MACH;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,MACV,YAAY,WAAW,YAAY,CAACE,cAAa,YAAYA,SAAQ,CAAC;AAAA,MACtE,GAAG;AAAA,MACH,eAAe,SAAS,QAAQ;AAAA,MAChC,OAAO;AAAA,QACL,GAAG,MAAM;AAAA,QACT,GAAG,KAAK;AAAA,QACR,GAAI,gBAAgB,EAAE,QAAQ,UAAU,IAAI,CAAC;AAAA,MAC/C;AAAA,IACF;AAAA,IACA,CAAC,IAAI,IAAI,eAAe,YAAY,MAAM,QAAQ;AAAA,EACpD;AAEA,QAAM,eAA6B;AAAA,IACjC,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;AAAI;AAET,UAAM,KAAK,uBAAuB,EAAE;AAGpC,QAAI;AAAK,UAAI,UAAU;AAAA,EACzB,GAAG,CAAC,KAAK,EAAE,CAAC;AAEZ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["ref","rest","isActive"]}
1
+ {"version":3,"sources":["../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;AAEA,SAAS,eAAe,UAAU,kBAAkB;AAEpD,SAAS,aAAa,WAAW,OAAO,gBAAgB;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAsCA,IAAM,CAAC,mBAAmB,mBAAmB,IAClD,cAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA8CI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,yBAAO,MAAM;AAEb,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,gBAAiC;AAAA,IACrC,CAAC,QAAQ,CAAC,MAAM;AACd,YAAM,EAAE,I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ClC;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,YAAU,MAAM;AACd,QAAI,CAAC;AAAI;AAET,UAAM,KAAK,uBAAuB,EAAE;AAGpC,QAAI;AAAK,UAAI,UAAU;AAAA,EACzB,GAAG,CAAC,KAAK,EAAE,CAAC;AAEZ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["ref","rest","isActive"]}
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ResizableProvider,
4
4
  useResizable
5
- } from "./chunk-KP2DL4SB.mjs";
5
+ } from "./chunk-76SDRAIF.mjs";
6
6
 
7
7
  // src/resizable.tsx
8
8
  import {
@@ -41,4 +41,4 @@ var Resizable = forwardRef(
41
41
  export {
42
42
  Resizable
43
43
  };
44
- //# sourceMappingURL=chunk-FUZV6XFV.mjs.map
44
+ //# sourceMappingURL=chunk-DU66FMGZ.mjs.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  useResizableContext,
4
4
  useResizableTrigger
5
- } from "./chunk-KP2DL4SB.mjs";
5
+ } from "./chunk-76SDRAIF.mjs";
6
6
 
7
7
  // src/resizable-trigger.tsx
8
8
  import { ui, forwardRef } from "@yamada-ui/core";
@@ -103,4 +103,4 @@ export {
103
103
  ResizableTrigger,
104
104
  ResizableTriggerIcon
105
105
  };
106
- //# sourceMappingURL=chunk-4NZ34PTB.mjs.map
106
+ //# sourceMappingURL=chunk-KSNUAKK5.mjs.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  useResizableContext,
4
4
  useResizableItem
5
- } from "./chunk-KP2DL4SB.mjs";
5
+ } from "./chunk-76SDRAIF.mjs";
6
6
 
7
7
  // src/resizable-item.tsx
8
8
  import { ui, forwardRef } from "@yamada-ui/core";
@@ -72,4 +72,4 @@ var ResizableItem = forwardRef(
72
72
  export {
73
73
  ResizableItem
74
74
  };
75
- //# sourceMappingURL=chunk-TZIYRIHX.mjs.map
75
+ //# sourceMappingURL=chunk-MGDZDA72.mjs.map
package/dist/index.js CHANGED
@@ -122,6 +122,7 @@ var useResizableItem = ({
122
122
  onExpand,
123
123
  onResize,
124
124
  order,
125
+ ...collapsible ? { "aria-labelledby": id } : { "aria-label": id },
125
126
  ...rest
126
127
  };
127
128
  },
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 ResizableTriggerProps,\n ResizableTriggerIconProps,\n} from \"./resizable-trigger\"\nexport type { ResizableStorage, ResizableItemControl } from \"./use-resizable\"\n","import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { ForwardedRef } from \"react\"\nimport { PanelGroup } from \"react-resizable-panels\"\nimport type { UseResizableProps } from \"./use-resizable\"\nimport { ResizableProvider, useResizable } from \"./use-resizable\"\n\ntype 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 type ResizableProps = Omit<HTMLUIProps<\"div\">, \"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] = useMultiComponentStyle(\"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 = { w: \"100%\", h: \"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","import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { ForwardedRef } from \"react\"\nimport { Panel } from \"react-resizable-panels\"\nimport type { UseResizableItemProps } from \"./use-resizable\"\nimport { useResizableContext, useResizableItem } from \"./use-resizable\"\n\nconst panelProps = new Set([\"order\"])\n\nconst UIPanel = ui(Panel, { disableStyleProp: (prop) => panelProps.has(prop) })\n\ntype ResizableItemOptions = {\n /**\n * Ref for resizable item inner element.\n */\n innerRef?: ForwardedRef<HTMLDivElement>\n}\n\nexport type ResizableItemProps = Omit<UseResizableItemProps, \"ref\"> &\n ResizableItemOptions\n\nexport const ResizableItem = forwardRef<ResizableItemProps, \"div\">(\n (\n {\n className,\n children,\n innerRef,\n w,\n width,\n minW,\n minWidth,\n maxW,\n maxWidth,\n h,\n height,\n minH,\n minHeight,\n maxH,\n maxHeight,\n boxSize,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useResizableContext()\n const { getPanelProps, getItemProps } = useResizableItem({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { boxSize: \"100%\", ...styles.item }\n\n return (\n <UIPanel\n {...getPanelProps({\n w,\n width,\n minW,\n minWidth,\n maxW,\n maxWidth,\n h,\n height,\n minH,\n minHeight,\n maxH,\n maxHeight,\n boxSize,\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","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { FC, ReactElement } from \"react\"\nimport { PanelResizeHandle } from \"react-resizable-panels\"\nimport type { UseResizableTriggerProps } from \"./use-resizable\"\nimport { useResizableContext, useResizableTrigger } from \"./use-resizable\"\n\ntype 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<\"div\">\n}\n\nexport type ResizableTriggerProps = Omit<HTMLUIProps<\"div\">, \"as\"> &\n Omit<UseResizableTriggerProps, \"ref\"> &\n ResizableTriggerOptions\n\nexport const ResizableTrigger = forwardRef<ResizableTriggerProps, \"div\", false>(\n ({ className, icon, children, iconProps, ...rest }, ref) => {\n const { styles } = useResizableContext()\n const { getTriggerProps, getIconProps } = 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 position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n transform: \"auto\",\n translateY: \"-50%\",\n translateX: \"-50%\",\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n ...styles.icon,\n }}\n {...getIconProps(iconProps)}\n >\n {icon}\n </ui.div>\n ) : null}\n\n {children}\n </ui.div>\n )\n },\n)\n\nexport type ResizableTriggerIconProps = IconProps\n\nexport const ResizableTriggerIcon: FC<ResizableTriggerIconProps> = (rest) => {\n return (\n <Icon viewBox=\"0 0 23 39\" w=\"0.5rem\" h=\"1rem\" {...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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kBAKO;AACP,IAAAA,gBAAmB;AAEnB,IAAAC,iCAA2B;;;ACP3B,mBAAoD;AAEpD,mBAAwD;AACxD,oCAIO;AAsCA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA8CI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,6BAAO,oBAAM;AAEb,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,oBAAiC;AAAA,IACrC,CAAC,QAAQ,CAAC,MAAM;AACd,YAAM,EAAE,IAAI,GAAGC,MAAK,IAAI,kCAAc,CAAC;AAEvC,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QACA;AAAA,QACA,SAAS;A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H;AAAA,cACC,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,UAAU;AAAA,gBACV,KAAK;AAAA,gBACL,MAAM;AAAA,gBACN,WAAW;AAAA,gBACX,YAAY;AAAA,gBACZ,YAAY;AAAA,gBACZ,SAAS;AAAA,gBACT,gBAAgB;AAAA,gBAChB,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;AAIO,IAAM,uBAAsD,CAAC,SAAS;AAC3E,SACE,8CAAC,oBAAK,SAAQ,aAAY,GAAE,UAAS,GAAE,QAAQ,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;","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_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 ResizableTriggerProps,\n ResizableTriggerIconProps,\n} from \"./resizable-trigger\"\nexport type { ResizableStorage, ResizableItemControl } from \"./use-resizable\"\n","import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { ForwardedRef } from \"react\"\nimport { PanelGroup } from \"react-resizable-panels\"\nimport type { UseResizableProps } from \"./use-resizable\"\nimport { ResizableProvider, useResizable } from \"./use-resizable\"\n\ntype 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 type ResizableProps = Omit<HTMLUIProps<\"div\">, \"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] = useMultiComponentStyle(\"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 = { w: \"100%\", h: \"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","import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { ForwardedRef } from \"react\"\nimport { Panel } from \"react-resizable-panels\"\nimport type { UseResizableItemProps } from \"./use-resizable\"\nimport { useResizableContext, useResizableItem } from \"./use-resizable\"\n\nconst panelProps = new Set([\"order\"])\n\nconst UIPanel = ui(Panel, { disableStyleProp: (prop) => panelProps.has(prop) })\n\ntype ResizableItemOptions = {\n /**\n * Ref for resizable item inner element.\n */\n innerRef?: ForwardedRef<HTMLDivElement>\n}\n\nexport type ResizableItemProps = Omit<UseResizableItemProps, \"ref\"> &\n ResizableItemOptions\n\nexport const ResizableItem = forwardRef<ResizableItemProps, \"div\">(\n (\n {\n className,\n children,\n innerRef,\n w,\n width,\n minW,\n minWidth,\n maxW,\n maxWidth,\n h,\n height,\n minH,\n minHeight,\n maxH,\n maxHeight,\n boxSize,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useResizableContext()\n const { getPanelProps, getItemProps } = useResizableItem({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { boxSize: \"100%\", ...styles.item }\n\n return (\n <UIPanel\n {...getPanelProps({\n w,\n width,\n minW,\n minWidth,\n maxW,\n maxWidth,\n h,\n height,\n minH,\n minHeight,\n maxH,\n maxHeight,\n boxSize,\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","import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { FC, ReactElement } from \"react\"\nimport { PanelResizeHandle } from \"react-resizable-panels\"\nimport type { UseResizableTriggerProps } from \"./use-resizable\"\nimport { useResizableContext, useResizableTrigger } from \"./use-resizable\"\n\ntype 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<\"div\">\n}\n\nexport type ResizableTriggerProps = Omit<HTMLUIProps<\"div\">, \"as\"> &\n Omit<UseResizableTriggerProps, \"ref\"> &\n ResizableTriggerOptions\n\nexport const ResizableTrigger = forwardRef<ResizableTriggerProps, \"div\", false>(\n ({ className, icon, children, iconProps, ...rest }, ref) => {\n const { styles } = useResizableContext()\n const { getTriggerProps, getIconProps } = 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 position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n transform: \"auto\",\n translateY: \"-50%\",\n translateX: \"-50%\",\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n ...styles.icon,\n }}\n {...getIconProps(iconProps)}\n >\n {icon}\n </ui.div>\n ) : null}\n\n {children}\n </ui.div>\n )\n },\n)\n\nexport type ResizableTriggerIconProps = IconProps\n\nexport const ResizableTriggerIcon: FC<ResizableTriggerIconProps> = (rest) => {\n return (\n <Icon viewBox=\"0 0 23 39\" w=\"0.5rem\" h=\"1rem\" {...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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,OAAO;AAAA,cACZ;AAAA,cACC,GAAG,aAAa,SAAS;AAAA,cAEzB;AAAA;AAAA,UACH,IACE;AAAA,UAEH;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAIO,IAAM,uBAAsD,CAAC,SAAS;AAC3E,SACE,8CAAC,oBAAK,SAAQ,aAAY,GAAE,UAAS,GAAE,QAAQ,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;","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_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-TZIYRIHX.mjs";
4
+ } from "./chunk-MGDZDA72.mjs";
5
5
  import {
6
6
  ResizableTrigger,
7
7
  ResizableTriggerIcon
8
- } from "./chunk-4NZ34PTB.mjs";
8
+ } from "./chunk-KSNUAKK5.mjs";
9
9
  import {
10
10
  Resizable
11
- } from "./chunk-FUZV6XFV.mjs";
12
- import "./chunk-KP2DL4SB.mjs";
11
+ } from "./chunk-DU66FMGZ.mjs";
12
+ import "./chunk-76SDRAIF.mjs";
13
13
  export {
14
14
  Resizable,
15
15
  ResizableItem,
@@ -70,6 +70,7 @@ var useResizableItem = ({
70
70
  onExpand,
71
71
  onResize,
72
72
  order,
73
+ ...collapsible ? { "aria-labelledby": id } : { "aria-label": id },
73
74
  ...rest
74
75
  };
75
76
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/resizable-item.tsx","../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { ForwardedRef } from \"react\"\nimport { Panel } from \"react-resizable-panels\"\nimport type { UseResizableItemProps } from \"./use-resizable\"\nimport { useResizableContext, useResizableItem } from \"./use-resizable\"\n\nconst panelProps = new Set([\"order\"])\n\nconst UIPanel = ui(Panel, { disableStyleProp: (prop) => panelProps.has(prop) })\n\ntype ResizableItemOptions = {\n /**\n * Ref for resizable item inner element.\n */\n innerRef?: ForwardedRef<HTMLDivElement>\n}\n\nexport type ResizableItemProps = Omit<UseResizableItemProps, \"ref\"> &\n ResizableItemOptions\n\nexport const ResizableItem = forwardRef<ResizableItemProps, \"div\">(\n (\n {\n className,\n children,\n innerRef,\n w,\n width,\n minW,\n minWidth,\n maxW,\n maxWidth,\n h,\n height,\n minH,\n minHeight,\n maxH,\n maxHeight,\n boxSize,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useResizableContext()\n const { getPanelProps, getItemProps } = useResizableItem({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { boxSize: \"100%\", ...styles.item }\n\n return (\n <UIPanel\n {...getPanelProps({\n w,\n width,\n minW,\n minWidth,\n maxW,\n maxWidth,\n h,\n height,\n minH,\n minHeight,\n maxH,\n maxHeight,\n boxSize,\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","import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAC/B,IAAAA,gBAAmB;AAEnB,IAAAC,iCAAsB;;;ACFtB,mBAAoD;AAEpD,mBAAwD;AACxD,oCAIO;AAsCA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAqKI,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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A,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,eAAe,aAAa,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;","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 { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { ForwardedRef } from \"react\"\nimport { Panel } from \"react-resizable-panels\"\nimport type { UseResizableItemProps } from \"./use-resizable\"\nimport { useResizableContext, useResizableItem } from \"./use-resizable\"\n\nconst panelProps = new Set([\"order\"])\n\nconst UIPanel = ui(Panel, { disableStyleProp: (prop) => panelProps.has(prop) })\n\ntype ResizableItemOptions = {\n /**\n * Ref for resizable item inner element.\n */\n innerRef?: ForwardedRef<HTMLDivElement>\n}\n\nexport type ResizableItemProps = Omit<UseResizableItemProps, \"ref\"> &\n ResizableItemOptions\n\nexport const ResizableItem = forwardRef<ResizableItemProps, \"div\">(\n (\n {\n className,\n children,\n innerRef,\n w,\n width,\n minW,\n minWidth,\n maxW,\n maxWidth,\n h,\n height,\n minH,\n minHeight,\n maxH,\n maxHeight,\n boxSize,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useResizableContext()\n const { getPanelProps, getItemProps } = useResizableItem({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { boxSize: \"100%\", ...styles.item }\n\n return (\n <UIPanel\n {...getPanelProps({\n w,\n width,\n minW,\n minWidth,\n maxW,\n maxWidth,\n h,\n height,\n minH,\n minHeight,\n maxH,\n maxHeight,\n boxSize,\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","import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAC/B,IAAAA,gBAAmB;AAEnB,IAAAC,iCAAsB;;;ACFtB,mBAAoD;AAEpD,mBAAwD;AACxD,oCAIO;AAsCA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAqKI,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,6BAAO,oBAAM;AAEb,QAAM,oBAAgC;AAAA,IACpC,CAAC,QAAQ,CAAC,MAAM;AACd,YAAM,EAAE,IAAI,GAAG,KAAK,IAAI,0CAAkB,CAAC;AAE3C,aAAO;AAAA,QACL,GAAG;AAAA,QACH,KAAK;AAAA,QACL;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAI,cAAc,EAAE,mBAAmB,GAAG,IAAI,EAAE,cAAc,GAAG;AAAA,QACjE,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;AA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C,OAAO;AAAA,YACN,GAAG,aAAa,CAAC,GAAG,QAAQ;AAAA,YAE5B;AAAA;AAAA,QACH;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;","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-TZIYRIHX.mjs";
5
- import "./chunk-KP2DL4SB.mjs";
4
+ } from "./chunk-MGDZDA72.mjs";
5
+ import "./chunk-76SDRAIF.mjs";
6
6
  export {
7
7
  ResizableItem
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/resizable-trigger.tsx","../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { FC, ReactElement } from \"react\"\nimport { PanelResizeHandle } from \"react-resizable-panels\"\nimport type { UseResizableTriggerProps } from \"./use-resizable\"\nimport { useResizableContext, useResizableTrigger } from \"./use-resizable\"\n\ntype 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<\"div\">\n}\n\nexport type ResizableTriggerProps = Omit<HTMLUIProps<\"div\">, \"as\"> &\n Omit<UseResizableTriggerProps, \"ref\"> &\n ResizableTriggerOptions\n\nexport const ResizableTrigger = forwardRef<ResizableTriggerProps, \"div\", false>(\n ({ className, icon, children, iconProps, ...rest }, ref) => {\n const { styles } = useResizableContext()\n const { getTriggerProps, getIconProps } = 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 position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n transform: \"auto\",\n translateY: \"-50%\",\n translateX: \"-50%\",\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n ...styles.icon,\n }}\n {...getIconProps(iconProps)}\n >\n {icon}\n </ui.div>\n ) : null}\n\n {children}\n </ui.div>\n )\n },\n)\n\nexport type ResizableTriggerIconProps = IconProps\n\nexport const ResizableTriggerIcon: FC<ResizableTriggerIconProps> = (rest) => {\n return (\n <Icon viewBox=\"0 0 23 39\" w=\"0.5rem\" h=\"1rem\" {...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","import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAE/B,kBAAqB;AACrB,IAAAA,gBAAmB;AAEnB,IAAAC,iCAAkC;;;ACJlC,mBAAoD;AAEpD,mBAAwD;AACxD,oCAIO;AAsCA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA2QI,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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ils","import_react_resizable_panels","isActive","ref"]}
1
+ {"version":3,"sources":["../src/resizable-trigger.tsx","../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { FC, ReactElement } from \"react\"\nimport { PanelResizeHandle } from \"react-resizable-panels\"\nimport type { UseResizableTriggerProps } from \"./use-resizable\"\nimport { useResizableContext, useResizableTrigger } from \"./use-resizable\"\n\ntype 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<\"div\">\n}\n\nexport type ResizableTriggerProps = Omit<HTMLUIProps<\"div\">, \"as\"> &\n Omit<UseResizableTriggerProps, \"ref\"> &\n ResizableTriggerOptions\n\nexport const ResizableTrigger = forwardRef<ResizableTriggerProps, \"div\", false>(\n ({ className, icon, children, iconProps, ...rest }, ref) => {\n const { styles } = useResizableContext()\n const { getTriggerProps, getIconProps } = 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 position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n transform: \"auto\",\n translateY: \"-50%\",\n translateX: \"-50%\",\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n ...styles.icon,\n }}\n {...getIconProps(iconProps)}\n >\n {icon}\n </ui.div>\n ) : null}\n\n {children}\n </ui.div>\n )\n },\n)\n\nexport type ResizableTriggerIconProps = IconProps\n\nexport const ResizableTriggerIcon: FC<ResizableTriggerIconProps> = (rest) => {\n return (\n <Icon viewBox=\"0 0 23 39\" w=\"0.5rem\" h=\"1rem\" {...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","import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAE/B,kBAAqB;AACrB,IAAAA,gBAAmB;AAEnB,IAAAC,iCAAkC;;;ACJlC,mBAAoD;AAEpD,mBAAwD;AACxD,oCAIO;AAsCA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA4QI,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAgC;AAC9B,6BAAO,oBAAM;AAEb,QAAM,EAAE,YAAY,gBAAgB,IAAI,oBAAoB;AAC5D,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAkB,KAAK;AAEvD,QAAM,gBAAgB,YAAY,cAAc;AAEhD,QAAM,sBAAqC;AAAA,IACzC,CAAC,QAAQ,CAAC,OAAO;AAAA,MACf,GAAG;AAAA,MACH;AAAA,MACA,SAAS;AAAA,MACT,UAAU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AO;AAAA,gBACL,UAAU;AAAA,gBACV,KAAK;AAAA,gBACL,MAAM;AAAA,gBACN,WAAW;AAAA,gBACX,YAAY;AAAA,gBACZ,YAAY;AAAA,gBACZ,SAAS;AAAA,gBACT,gBAAgB;AAAA,gBAChB,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;AAIO,IAAM,uBAAsD,CAAC,SAAS;AAC3E,SACE,6CAAC,oBAAK,SAAQ,aAAY,GAAE,UAAS,GAAE,QAAQ,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;","names":["import_utils","import_react_resizable_panels","isActive","ref"]}
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  ResizableTrigger,
4
4
  ResizableTriggerIcon
5
- } from "./chunk-4NZ34PTB.mjs";
6
- import "./chunk-KP2DL4SB.mjs";
5
+ } from "./chunk-KSNUAKK5.mjs";
6
+ import "./chunk-76SDRAIF.mjs";
7
7
  export {
8
8
  ResizableTrigger,
9
9
  ResizableTriggerIcon
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/resizable.tsx","../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { ForwardedRef } from \"react\"\nimport { PanelGroup } from \"react-resizable-panels\"\nimport type { UseResizableProps } from \"./use-resizable\"\nimport { ResizableProvider, useResizable } from \"./use-resizable\"\n\ntype 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 type ResizableProps = Omit<HTMLUIProps<\"div\">, \"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] = useMultiComponentStyle(\"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 = { w: \"100%\", h: \"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","import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAKO;AACP,IAAAA,gBAAmB;AAEnB,IAAAC,iCAA2B;;;ACP3B,mBAAoD;AAEpD,mBAAwD;AACxD,oCAIO;AAsCA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA8CI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,6BAAO,oBAAM;AAEb,QAAM,wBAAgC;AAAA,IACpC,CAAC,QAAQ,CAAC,GAAGC,OAAM,UAAU,EAAE,GAAG,OAAO,KAAAA,MAAK,GAAG,KAAK;AAAA,IACtD,C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Y,GAAG,cAAc,GAAI,UAAS;AAAA;AAAA,IAC7C,GACF;AAAA,EAEJ;AACF;","names":["import_utils","import_react_resizable_panels","ref","rest"]}
1
+ {"version":3,"sources":["../src/resizable.tsx","../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useMultiComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { ForwardedRef } from \"react\"\nimport { PanelGroup } from \"react-resizable-panels\"\nimport type { UseResizableProps } from \"./use-resizable\"\nimport { ResizableProvider, useResizable } from \"./use-resizable\"\n\ntype 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 type ResizableProps = Omit<HTMLUIProps<\"div\">, \"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] = useMultiComponentStyle(\"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 = { w: \"100%\", h: \"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","import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAKO;AACP,IAAAA,gBAAmB;AAEnB,IAAAC,iCAA2B;;;ACP3B,mBAAoD;AAEpD,mBAAwD;AACxD,oCAIO;AAsCA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA8CI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,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AK,GAC1C;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA,QACC,eAAW,kBAAG,gBAAgB,SAAS;AAAA,QACvC,OAAO;AAAA,QACN,GAAG,kBAAkB,CAAC,GAAG,YAAY;AAAA,QAEtC,sDAAC,6CAAY,GAAG,cAAc,GAAI,UAAS;AAAA;AAAA,IAC7C,GACF;AAAA,EAEJ;AACF;","names":["import_utils","import_react_resizable_panels","ref","rest"]}
@@ -1,8 +1,8 @@
1
1
  "use client"
2
2
  import {
3
3
  Resizable
4
- } from "./chunk-FUZV6XFV.mjs";
5
- import "./chunk-KP2DL4SB.mjs";
4
+ } from "./chunk-DU66FMGZ.mjs";
5
+ import "./chunk-76SDRAIF.mjs";
6
6
  export {
7
7
  Resizable
8
8
  };
@@ -116,6 +116,7 @@ var useResizableItem = ({
116
116
  onExpand,
117
117
  onResize,
118
118
  order,
119
+ ...collapsible ? { "aria-labelledby": id } : { "aria-label": id },
119
120
  ...rest
120
121
  };
121
122
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAoD;AAEpD,mBAAwD;AACxD,oCAIO;AAsCA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA8CI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,6BAAO,oBAAM;AAEb,QAAM,wBAAgC;AAAA,IACpC,CAAC,QAAQ,CAAC,GAAGA,OAAM,UAAU,EAAE,GAAG,OAAO,KAAAA,MAAK,GAAG,KAAK;AAAA,IACtD,CAAC,IAAI;AAAA,EACP;AAEA,QAAM,oBAAiC;AAAA,IACrC,CAAC,QAAQ,CAAC,MAAM;AACd,YAAM,EAAE,IAAI,GAAGC,MAAK,IAAI,kCAAc,CAAC;AAEvC,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QACA;AAAA,QACA,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,kBAAkB;AAAA,QAClB;AAAA,QACA;AAAA,QACA,GAAGA;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,IAAI,WAAW,YAAY,YAAY,cAAc,UAAU,OAAO;AAAA,EACzE;AAEA,8BAAU,MAAM;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A,EACF;AACF;AA6BO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAgC;AAC9B,6BAAO,oBAAM;AAEb,QAAM,EAAE,YAAY,gBAAgB,IAAI,oBAAoB;AAC5D,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAkB,KAAK;AAEvD,QAAM,gBAAgB,YAAY,cAAc;AAEhD,QAAM,sBAAqC;AAAA,IACzC,CAAC,QAAQ,CAAC,OAAO;AAAA,MACf,GAAG;AAAA,MACH;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,MACV,gBAAY,yBAAW,YAAY,CAACE,cAAa,YAAYA,SAAQ,CAAC;AAAA,MACtE,GAAG;AAAA,MACH,mBAAe,uBAAS,QAAQ;AAAA,MAChC,OAAO;AAAA,QACL,GAAG,MAAM;AAAA,QACT,GAAG,KAAK;AAAA,QACR,GAAI,gBAAgB,EAAE,QAAQ,UAAU,IAAI,CAAC;AAAA,MAC/C;AAAA,IACF;AAAA,IACA,CAAC,IAAI,IAAI,eAAe,YAAY,MAAM,QAAQ;AAAA,EACpD;AAEA,QAAM,mBAA6B;AAAA,IACjC,CAAC,QAAQ,CAAC,GAAGF,OAAM,UAAU;AAAA,MAC3B,GAAG;AAAA,MACH,KAAAA;AAAA,MACA,mBAAe,uBAAS,QAAQ;AAAA,IAClC;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC;AAAI;AAET,UAAM,SAAK,sDAAuB,EAAE;AAGpC,QAAI;AAAK,UAAI,UAAU;AAAA,EACzB,GAAG,CAAC,KAAK,EAAE,CAAC;AAEZ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["ref","rest","isActive"]}
1
+ {"version":3,"sources":["../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, UIPropGetter } from \"@yamada-ui/core\"\nimport type { PropGetter } from \"@yamada-ui/utils\"\nimport { createContext, dataAttr, handlerAll } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\nimport type {\n PanelResizeHandleProps,\n PanelGroupProps,\n PanelProps,\n PanelGroupOnLayout,\n PanelGroupStorage,\n ImperativePanelHandle,\n} from \"react-resizable-panels\"\n\ntype GroupPropGetter = (props?: Partial<PanelGroupProps>) => PanelGroupProps\ntype ItemPropGetter = (props?: HTMLUIProps<\"div\"> & PanelProps) => PanelProps\ntype TriggerPropGetter = (\n props?: PanelResizeHandleProps,\n) => PanelResizeHandleProps\n\ntype As = { as?: keyof HTMLElementTagNameMap }\n\ntype ResizableGroupProps = Omit<\n Partial<PanelGroupProps>,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\ntype ResizableItemProps = Omit<PanelProps, \"id\" | \"tagName\" | \"children\"> & As\ntype ResizableTriggerProps = Omit<\n PanelResizeHandleProps,\n \"id\" | \"tagName\" | \"children\"\n> &\n As\n\nexport type ResizableStorage = PanelGroupStorage\nexport type ResizableItemControl = ImperativePanelHandle\n\ntype ResizableContext = {\n isDisabled: boolean\n styles: Record<string, CSSUIObject>\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 type 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 * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n}\n\nexport const useResizable = ({\n id,\n direction = \"horizontal\",\n storageKey,\n keyboardStep,\n isDisabled = false,\n onLayout,\n storage,\n ref,\n groupProps,\n ...rest\n}: UseResizableProps) => {\n id ??= useId()\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps: GroupPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n direction,\n tagName: as,\n autoSaveId: storageKey,\n keyboardResizeBy: keyboardStep,\n onLayout,\n storage,\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 // @ts-expect-error\n if (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\ntype 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 * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\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 * Order for the resizable item.\n */\n order?: number\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps<\"div\">, \"as\"> & ResizableItemProps\n}\n\nexport type UseResizableItemProps = Omit<\n HTMLUIProps<\"div\">,\n keyof UseResizableItemOptions\n> &\n UseResizableItemOptions\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n controlRef,\n containerProps,\n ...innerProps\n}: UseResizableItemProps) => {\n id ??= useId()\n\n const getPanelProps: ItemPropGetter = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n ref: controlRef,\n id,\n tagName: as,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n collapsedSize,\n onCollapse,\n onExpand,\n onResize,\n order,\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: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getPanelProps,\n getItemProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ntype 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 type UseResizableTriggerProps = HTMLUIProps<\"div\"> &\n ResizableTriggerProps &\n UseResizableTriggerOptions\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n id ??= useId()\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: TriggerPropGetter = useCallback(\n (props = {}) => ({\n ...props,\n id,\n tagName: as,\n disabled: trulyDisabled,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n \"data-active\": dataAttr(isActive),\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n }),\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: UIPropGetter = 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 // @ts-expect-error\n if (ref) ref.current = el\n }, [ref, id])\n\n return {\n getTriggerProps,\n getIconProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAoD;AAEpD,mBAAwD;AACxD,oCAIO;AAsCA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA8CI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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I,gBAAgB,EAAE,QAAQ,UAAU,IAAI,CAAC;AAAA,MAC/C;AAAA,IACF;AAAA,IACA,CAAC,IAAI,IAAI,eAAe,YAAY,MAAM,QAAQ;AAAA,EACpD;AAEA,QAAM,mBAA6B;AAAA,IACjC,CAAC,QAAQ,CAAC,GAAGF,OAAM,UAAU;AAAA,MAC3B,GAAG;AAAA,MACH,KAAAA;AAAA,MACA,mBAAe,uBAAS,QAAQ;AAAA,IAClC;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC;AAAI;AAET,UAAM,SAAK,sDAAuB,EAAE;AAGpC,QAAI;AAAK,UAAI,UAAU;AAAA,EACzB,GAAG,CAAC,KAAK,EAAE,CAAC;AAEZ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["ref","rest","isActive"]}
@@ -5,7 +5,7 @@ import {
5
5
  useResizableContext,
6
6
  useResizableItem,
7
7
  useResizableTrigger
8
- } from "./chunk-KP2DL4SB.mjs";
8
+ } from "./chunk-76SDRAIF.mjs";
9
9
  export {
10
10
  ResizableProvider,
11
11
  useResizable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/resizable",
3
- "version": "1.0.20-next-20240609092803",
3
+ "version": "1.1.0-dev-20240609114752",
4
4
  "description": "Yamada UI resizable component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -37,9 +37,9 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "react-resizable-panels": "^2.0.8",
40
- "@yamada-ui/core": "1.7.1-next-20240609092803",
41
- "@yamada-ui/icon": "1.0.27-next-20240609092803",
42
- "@yamada-ui/utils": "1.2.1-next-20240609092803"
40
+ "@yamada-ui/core": "1.7.1-dev-20240609114752",
41
+ "@yamada-ui/icon": "1.0.27-dev-20240609114752",
42
+ "@yamada-ui/utils": "1.2.1-dev-20240609114752"
43
43
  },
44
44
  "devDependencies": {
45
45
  "clean-package": "2.2.0",