@yamada-ui/resizable 1.2.4-dev-20241212101624 → 1.3.0-dev-20241213204523
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-ECNT6LJV.mjs → chunk-KGV3GLXC.mjs} +2 -2
- package/dist/{chunk-G6HLTSUK.mjs → chunk-KTGBOEYI.mjs} +14 -13
- package/dist/chunk-KTGBOEYI.mjs.map +1 -0
- package/dist/{chunk-62N65DW7.mjs → chunk-VGX275YX.mjs} +4 -3
- package/dist/chunk-VGX275YX.mjs.map +1 -0
- package/dist/{chunk-P6HFD7WR.mjs → chunk-W4YKVFWF.mjs} +2 -2
- package/dist/index.js +15 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/resizable-item.js.map +1 -1
- package/dist/resizable-item.mjs +2 -2
- package/dist/resizable-trigger.js +7 -7
- package/dist/resizable-trigger.js.map +1 -1
- package/dist/resizable-trigger.mjs +2 -2
- package/dist/resizable.js +8 -6
- package/dist/resizable.js.map +1 -1
- package/dist/resizable.mjs +2 -2
- package/dist/use-resizable.d.mts +41 -33
- package/dist/use-resizable.d.ts +41 -33
- package/dist/use-resizable.js +13 -12
- package/dist/use-resizable.js.map +1 -1
- package/dist/use-resizable.mjs +1 -1
- package/package.json +4 -4
- package/dist/chunk-62N65DW7.mjs.map +0 -1
- package/dist/chunk-G6HLTSUK.mjs.map +0 -1
- /package/dist/{chunk-ECNT6LJV.mjs.map → chunk-KGV3GLXC.mjs.map} +0 -0
- /package/dist/{chunk-P6HFD7WR.mjs.map → chunk-W4YKVFWF.mjs.map} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/resizable-trigger.tsx","../src/use-resizable.ts"],"sourcesContent":["import type {\n ComponentArgs,\n CSSUIObject,\n FC,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type { ReactElement, RefAttributes } from \"react\"\nimport type { UseResizableTriggerProps } from \"./use-resizable\"\nimport { ui } from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { forwardRef } from \"react\"\nimport { PanelResizeHandle } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableTrigger } from \"./use-resizable\"\n\ninterface ResizableTriggerOptions {\n /**\n * The resizable trigger icon to use.\n */\n icon?: ReactElement\n /**\n * Props for resizable trigger icon component.\n */\n iconProps?: HTMLUIProps\n}\n\nexport interface ResizableTriggerProps\n extends Merge<\n Omit<UseResizableTriggerProps, \"ref\">,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n ResizableTriggerOptions {}\n\nexport const ResizableTrigger = forwardRef<HTMLElement, ResizableTriggerProps>(\n ({ className, children, icon, iconProps, ...rest }, ref) => {\n const { styles } = useResizableContext()\n const { getIconProps, getTriggerProps } = useResizableTrigger({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { position: \"relative\", ...styles.trigger }\n\n return (\n <ui.div\n as={PanelResizeHandle}\n className={cx(\"ui-resizable__trigger\", className)}\n __css={css}\n {...getTriggerProps()}\n >\n {icon ? (\n <ui.div\n className=\"ui-resizable__trigger__icon\"\n __css={{\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"center\",\n left: \"50%\",\n position: \"absolute\",\n top: \"50%\",\n transform: \"auto\",\n translateX: \"-50%\",\n translateY: \"-50%\",\n ...styles.icon,\n }}\n {...getIconProps(iconProps)}\n >\n {icon}\n </ui.div>\n ) : null}\n\n {children}\n </ui.div>\n )\n },\n) as {\n (props: RefAttributes<HTMLElement> & ResizableTriggerProps): ReactElement\n} & ComponentArgs\n\nResizableTrigger.displayName = \"ResizableTrigger\"\nResizableTrigger.__ui__ = \"ResizableTrigger\"\n\nexport type ResizableTriggerIconProps = IconProps\n\nexport const ResizableTriggerIcon: FC<ResizableTriggerIconProps> = (rest) => {\n return (\n <Icon h=\"1rem\" viewBox=\"0 0 23 39\" w=\"0.5rem\" {...rest}>\n <path\n d=\"M 5 0 C 7.761 0 10 2.239 10 5 C 10 7.761 7.761 10 5 10 C 2.239 10 0 7.761 0 5 C 0 2.239 2.239 0 5 0 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 0 C 21.761 0 24 2.239 24 5 C 24 7.761 21.761 10 19 10 C 16.239 10 14 7.761 14 5 C 14 2.239 16.239 0 19 0 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 14 C 21.761 14 24 16.239 24 19 C 24 21.761 21.761 24 19 24 C 16.239 24 14 21.761 14 19 C 14 16.239 16.239 14 19 14 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 5 14 C 7.761 14 10 16.239 10 19 C 10 21.761 7.761 24 5 24 C 2.239 24 0 21.761 0 19 C 0 16.239 2.239 14 5 14 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 5 28 C 7.761 28 10 30.239 10 33 C 10 35.761 7.761 38 5 38 C 2.239 38 0 35.761 0 33 C 0 30.239 2.239 28 5 28 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 28 C 21.761 28 24 30.239 24 33 C 24 35.761 21.761 38 19 38 C 16.239 38 14 35.761 14 33 C 14 30.239 16.239 28 19 28 Z\"\n fill=\"currentColor\"\n />\n </Icon>\n )\n}\n\nResizableTriggerIcon.__ui__ = \"ResizableTriggerIcon\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n MouseEvent,\n MouseEventHandler,\n RefObject,\n} from \"react\"\nimport type {\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\ntype ResizableDirection = \"horizontal\" | \"vertical\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableGroupControl extends ImperativePanelGroupHandle {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n controlRef: RefObject<ResizableGroupControl>\n direction: ResizableDirection\n disabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: ResizableDirection\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @deprecated Use `Disabled` instead.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n disabled = false,\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n direction,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n direction,\n disabled: disabled || isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n *\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const {\n controlRef,\n direction,\n disabled: groupDisabled,\n } = useResizableContext()\n const [active, setActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || groupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n \"aria-orientation\": direction,\n disabled: trulyDisabled,\n tagName: as,\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(active),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (active) => setActive(active)),\n }) as PanelResizeHandleProps,\n [id, as, direction, trulyDisabled, rest, onDoubleClick, active],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(active),\n }),\n [active],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,kBAAmB;AACnB,kBAAqB;AACrB,IAAAA,gBAAmB;AACnB,IAAAC,gBAA2B;AAC3B,IAAAC,iCAAkC;;;ACOlC,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAkTI,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAgC;AAC9B,QAAM,WAAO,oBAAM;AAEnB,yBAAO;AAEP,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,UAAU;AAAA,EACZ,IAAI,oBAAoB;AACxB,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAkB,KAAK;AAEnD,QAAM,gBAAgB,YAAY,cAAc;AAEhD,QAAM,oBAAgB;AAAA,IACpB,CAAC,OAAmC;AA5YxC;AA6YM,SAAG,eAAe;AAElB,YAAM,UAAS,gBAAW,YAAX,mBAAoB;AAEnC,UAAI,CAAC,OAAQ;AAEb,YAAM,QAAQ,OAAO;AACrB,YAAM,OAAO,MAAM;AACnB,YAAM,aAAa,OAAO,IAAI,MAAM,IAAI;AAExC,uBAAW,YAAX,mBAAoB,UAAU;AAAA,IAChC;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AAEA,QAAM,sBAGF;AAAA,IACF,CAAC,QAAQ,CAAC,OACP;AAAA,MACC,GAAG;AAAA,MACH;AAAA,MACA,oBAAoB;AAAA,MACpB,UAAU;AAAA,M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B;AAAA,QAEnB;AAAA,iBACC;AAAA,YAAC,eAAG;AAAA,YAAH;AAAA,cACC,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,YAAY;AAAA,gBACZ,SAAS;AAAA,gBACT,gBAAgB;AAAA,gBAChB,MAAM;AAAA,gBACN,UAAU;AAAA,gBACV,KAAK;AAAA,gBACL,WAAW;AAAA,gBACX,YAAY;AAAA,gBACZ,YAAY;AAAA,gBACZ,GAAG,OAAO;AAAA,cACZ;AAAA,cACC,GAAG,aAAa,SAAS;AAAA,cAEzB;AAAA;AAAA,UACH,IACE;AAAA,UAEH;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAIA,iBAAiB,cAAc;AAC/B,iBAAiB,SAAS;AAInB,IAAM,uBAAsD,CAAC,SAAS;AAC3E,SACE,6CAAC,oBAAK,GAAE,QAAO,SAAQ,aAAY,GAAE,UAAU,GAAG,MAChD;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,KACF;AAEJ;AAEA,qBAAqB,SAAS;","names":["import_utils","import_react","import_react_resizable_panels","active","ref"]}
|
1
|
+
{"version":3,"sources":["../src/resizable-trigger.tsx","../src/use-resizable.ts"],"sourcesContent":["import type {\n ComponentArgs,\n CSSUIObject,\n FC,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type { ReactElement, RefAttributes } from \"react\"\nimport type { UseResizableTriggerProps } from \"./use-resizable\"\nimport { ui } from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { forwardRef } from \"react\"\nimport { PanelResizeHandle } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableTrigger } from \"./use-resizable\"\n\ninterface ResizableTriggerOptions {\n /**\n * The resizable trigger icon to use.\n */\n icon?: ReactElement\n /**\n * Props for resizable trigger icon component.\n */\n iconProps?: HTMLUIProps\n}\n\nexport interface ResizableTriggerProps\n extends Merge<\n Omit<UseResizableTriggerProps, \"ref\">,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n ResizableTriggerOptions {}\n\nexport const ResizableTrigger = forwardRef<HTMLElement, ResizableTriggerProps>(\n ({ className, children, icon, iconProps, ...rest }, ref) => {\n const { styles } = useResizableContext()\n const { getIconProps, getTriggerProps } = useResizableTrigger({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { position: \"relative\", ...styles.trigger }\n\n return (\n <ui.div\n as={PanelResizeHandle}\n className={cx(\"ui-resizable__trigger\", className)}\n __css={css}\n {...getTriggerProps()}\n >\n {icon ? (\n <ui.div\n className=\"ui-resizable__trigger__icon\"\n __css={{\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"center\",\n left: \"50%\",\n position: \"absolute\",\n top: \"50%\",\n transform: \"auto\",\n translateX: \"-50%\",\n translateY: \"-50%\",\n ...styles.icon,\n }}\n {...getIconProps(iconProps)}\n >\n {icon}\n </ui.div>\n ) : null}\n\n {children}\n </ui.div>\n )\n },\n) as {\n (props: RefAttributes<HTMLElement> & ResizableTriggerProps): ReactElement\n} & ComponentArgs\n\nResizableTrigger.displayName = \"ResizableTrigger\"\nResizableTrigger.__ui__ = \"ResizableTrigger\"\n\nexport type ResizableTriggerIconProps = IconProps\n\nexport const ResizableTriggerIcon: FC<ResizableTriggerIconProps> = (rest) => {\n return (\n <Icon h=\"1rem\" viewBox=\"0 0 23 39\" w=\"0.5rem\" {...rest}>\n <path\n d=\"M 5 0 C 7.761 0 10 2.239 10 5 C 10 7.761 7.761 10 5 10 C 2.239 10 0 7.761 0 5 C 0 2.239 2.239 0 5 0 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 0 C 21.761 0 24 2.239 24 5 C 24 7.761 21.761 10 19 10 C 16.239 10 14 7.761 14 5 C 14 2.239 16.239 0 19 0 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 14 C 21.761 14 24 16.239 24 19 C 24 21.761 21.761 24 19 24 C 16.239 24 14 21.761 14 19 C 14 16.239 16.239 14 19 14 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 5 14 C 7.761 14 10 16.239 10 19 C 10 21.761 7.761 24 5 24 C 2.239 24 0 21.761 0 19 C 0 16.239 2.239 14 5 14 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 5 28 C 7.761 28 10 30.239 10 33 C 10 35.761 7.761 38 5 38 C 2.239 38 0 35.761 0 33 C 0 30.239 2.239 28 5 28 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 28 C 21.761 28 24 30.239 24 33 C 24 35.761 21.761 38 19 38 C 16.239 38 14 35.761 14 33 C 14 30.239 16.239 28 19 28 Z\"\n fill=\"currentColor\"\n />\n </Icon>\n )\n}\n\nResizableTriggerIcon.__ui__ = \"ResizableTriggerIcon\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n MouseEvent,\n MouseEventHandler,\n RefObject,\n} from \"react\"\nimport type {\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\ntype ResizableOrientation = \"horizontal\" | \"vertical\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableGroupControl extends ImperativePanelGroupHandle {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n controlRef: RefObject<ResizableGroupControl>\n disabled: boolean\n orientation: ResizableOrientation\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n *\n * @deprecated Use `orientation` instead.\n */\n direction?: ResizableOrientation\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @deprecated Use `Disabled` instead.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * The orientation of the resizable.\n *\n * @default \"horizontal\"\n */\n orientation?: ResizableOrientation\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n isDisabled = false,\n disabled = isDisabled,\n keyboardStep,\n orientation = direction,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction: orientation,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n orientation,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n disabled,\n orientation,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n *\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n isDisabled,\n disabled = isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n const {\n controlRef,\n disabled: groupDisabled,\n orientation,\n } = useResizableContext()\n\n id ??= uuid\n\n const [active, setActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || groupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n \"aria-orientation\": orientation,\n disabled: trulyDisabled,\n tagName: as,\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(active),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (active) => setActive(active)),\n }) as PanelResizeHandleProps,\n [id, as, orientation, trulyDisabled, rest, onDoubleClick, active],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(active),\n }),\n [active],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,kBAAmB;AACnB,kBAAqB;AACrB,IAAAA,gBAAmB;AACnB,IAAAC,gBAA2B;AAC3B,IAAAC,iCAAkC;;;ACOlC,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA2TI,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,MAAgC;AAC9B,QAAM,WAAO,oBAAM;AACnB,QAAM;AAAA,IACJ;AAAA,IACA,UAAU;AAAA,IACV;AAAA,EACF,IAAI,oBAAoB;AAExB,yBAAO;AAEP,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAkB,KAAK;AAEnD,QAAM,gBAAgB,YAAY;AAElC,QAAM,oBAAgB;AAAA,IACpB,CAAC,OAAmC;AArZxC;AAsZM,SAAG,eAAe;AAElB,YAAM,UAAS,gBAAW,YAAX,mBAAoB;AAEnC,UAAI,CAAC,OAAQ;AAEb,YAAM,QAAQ,OAAO;AACrB,YAAM,OAAO,MAAM;AACnB,YA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AA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,KACF;AAEJ;AAEA,qBAAqB,SAAS;","names":["import_utils","import_react","import_react_resizable_panels","active","ref"]}
|
package/dist/resizable.js
CHANGED
@@ -41,9 +41,10 @@ var useResizable = ({
|
|
41
41
|
ref,
|
42
42
|
controlRef: controlRefProp,
|
43
43
|
direction = "horizontal",
|
44
|
-
disabled = false,
|
45
44
|
isDisabled = false,
|
45
|
+
disabled = isDisabled,
|
46
46
|
keyboardStep,
|
47
|
+
orientation = direction,
|
47
48
|
storage,
|
48
49
|
storageKey,
|
49
50
|
groupProps,
|
@@ -65,7 +66,7 @@ var useResizable = ({
|
|
65
66
|
id,
|
66
67
|
ref: (0, import_utils.mergeRefs)(controlRefProp, controlRef),
|
67
68
|
autoSaveId: storageKey,
|
68
|
-
direction,
|
69
|
+
direction: orientation,
|
69
70
|
keyboardResizeBy: keyboardStep,
|
70
71
|
storage,
|
71
72
|
tagName: as,
|
@@ -75,7 +76,7 @@ var useResizable = ({
|
|
75
76
|
},
|
76
77
|
[
|
77
78
|
id,
|
78
|
-
|
79
|
+
orientation,
|
79
80
|
groupProps,
|
80
81
|
controlRefProp,
|
81
82
|
storageKey,
|
@@ -91,8 +92,8 @@ var useResizable = ({
|
|
91
92
|
}, [ref, id]);
|
92
93
|
return {
|
93
94
|
controlRef,
|
94
|
-
|
95
|
-
|
95
|
+
disabled,
|
96
|
+
orientation,
|
96
97
|
getContainerProps,
|
97
98
|
getGroupProps
|
98
99
|
};
|
@@ -101,9 +102,10 @@ var useResizable = ({
|
|
101
102
|
// src/resizable.tsx
|
102
103
|
var import_jsx_runtime = require("react/jsx-runtime");
|
103
104
|
var Resizable = (0, import_core.forwardRef)(
|
104
|
-
({ direction = "horizontal", ...props }, ref) => {
|
105
|
+
({ direction = "horizontal", orientation = direction, ...props }, ref) => {
|
105
106
|
const [styles, mergedProps] = (0, import_core.useComponentMultiStyle)("Resizable", {
|
106
107
|
direction,
|
108
|
+
orientation,
|
107
109
|
...props
|
108
110
|
});
|
109
111
|
const { className, children, containerRef, ...computedProps } = (0, import_core.omitThemeProps)(mergedProps);
|
package/dist/resizable.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/resizable.tsx","../src/use-resizable.ts"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableProps } from \"./use-resizable\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { PanelGroup } from \"react-resizable-panels\"\nimport { ResizableProvider, useResizable } from \"./use-resizable\"\n\ninterface ResizableOptions {\n /**\n * Ref for resizable container element.\n */\n containerRef?: ForwardedRef<HTMLDivElement>\n}\n\n/**\n * `Resizable` is accessible resizable panel groups and layouts with keyboard support.\n *\n * @see Docs https://yamada-ui.com/components/data-display/resizable\n */\nexport interface ResizableProps\n extends Omit<HTMLUIProps, \"direction\">,\n ThemeProps<\"Resizable\">,\n Omit<UseResizableProps, \"ref\">,\n ResizableOptions {}\n\nexport const Resizable = forwardRef<ResizableProps, \"div\">(\n ({ direction = \"horizontal\", ...props }, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Resizable\", {\n direction,\n ...props,\n })\n const { className, children, containerRef, ...computedProps } =\n omitThemeProps(mergedProps)\n const { getContainerProps, getGroupProps, ...rest } = useResizable({\n ref,\n ...computedProps,\n })\n\n const css: CSSUIObject = { h: \"100%\", w: \"100%\", ...styles.container }\n\n return (\n <ResizableProvider value={{ styles, ...rest }}>\n <ui.div\n className={cx(\"ui-resizable\", className)}\n __css={css}\n {...getContainerProps({}, containerRef)}\n >\n <PanelGroup {...getGroupProps()}>{children}</PanelGroup>\n </ui.div>\n </ResizableProvider>\n )\n },\n)\n\nResizable.displayName = \"Resizable\"\nResizable.__ui__ = \"Resizable\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n MouseEvent,\n MouseEventHandler,\n RefObject,\n} from \"react\"\nimport type {\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\ntype ResizableDirection = \"horizontal\" | \"vertical\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableGroupControl extends ImperativePanelGroupHandle {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n controlRef: RefObject<ResizableGroupControl>\n direction: ResizableDirection\n disabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: ResizableDirection\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @deprecated Use `Disabled` instead.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n disabled = false,\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n direction,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n direction,\n disabled: disabled || isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n *\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const {\n controlRef,\n direction,\n disabled: groupDisabled,\n } = useResizableContext()\n const [active, setActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || groupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n \"aria-orientation\": direction,\n disabled: trulyDisabled,\n tagName: as,\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(active),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (active) => setActive(active)),\n }) as PanelResizeHandleProps,\n [id, as, direction, trulyDisabled, rest, onDoubleClick, active],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(active),\n }),\n [active],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAKO;AACP,IAAAA,gBAAmB;AACnB,IAAAC,iCAA2B;;;ACY3B,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAwDI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,iBAAa,qBAA8B,IAAI;AACrD,QAAM,WAAO,oBAAM;AAEnB,yBAAO;AAEP,QAAM,wBAAgC;AAAA,IACpC,CAAC,QAAQ,CAAC,GAAGC,OAAM,UAAU,EAAE,GAAG,OAAO,KAAAA,MAAK,GAAG,KAAK;AAAA,IACtD,CAAC,IAAI;AAAA,EACP;AAEA,QAAM,oBAAgB;AAAA,IACpB,CAAC,QAAk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O;AAAA,QACN,GAAG,kBAAkB,CAAC,GAAG,YAAY;AAAA,QAEtC,sDAAC,6CAAY,GAAG,cAAc,GAAI,UAAS;AAAA;AAAA,IAC7C,GACF;AAAA,EAEJ;AACF;AAEA,UAAU,cAAc;AACxB,UAAU,SAAS;","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 type { ForwardedRef } from \"react\"\nimport type { UseResizableProps } from \"./use-resizable\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { PanelGroup } from \"react-resizable-panels\"\nimport { ResizableProvider, useResizable } from \"./use-resizable\"\n\ninterface ResizableOptions {\n /**\n * Ref for resizable container element.\n */\n containerRef?: ForwardedRef<HTMLDivElement>\n}\n\n/**\n * `Resizable` is accessible resizable panel groups and layouts with keyboard support.\n *\n * @see Docs https://yamada-ui.com/components/data-display/resizable\n */\nexport interface ResizableProps\n extends Omit<HTMLUIProps, \"direction\">,\n ThemeProps<\"Resizable\">,\n Omit<UseResizableProps, \"ref\">,\n ResizableOptions {}\n\nexport const Resizable = forwardRef<ResizableProps, \"div\">(\n ({ direction = \"horizontal\", orientation = direction, ...props }, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Resizable\", {\n direction,\n orientation,\n ...props,\n })\n const { className, children, containerRef, ...computedProps } =\n omitThemeProps(mergedProps)\n const { getContainerProps, getGroupProps, ...rest } = useResizable({\n ref,\n ...computedProps,\n })\n\n const css: CSSUIObject = { h: \"100%\", w: \"100%\", ...styles.container }\n\n return (\n <ResizableProvider value={{ styles, ...rest }}>\n <ui.div\n className={cx(\"ui-resizable\", className)}\n __css={css}\n {...getContainerProps({}, containerRef)}\n >\n <PanelGroup {...getGroupProps()}>{children}</PanelGroup>\n </ui.div>\n </ResizableProvider>\n )\n },\n)\n\nResizable.displayName = \"Resizable\"\nResizable.__ui__ = \"Resizable\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n MouseEvent,\n MouseEventHandler,\n RefObject,\n} from \"react\"\nimport type {\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\ntype ResizableOrientation = \"horizontal\" | \"vertical\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableGroupControl extends ImperativePanelGroupHandle {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n controlRef: RefObject<ResizableGroupControl>\n disabled: boolean\n orientation: ResizableOrientation\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n *\n * @deprecated Use `orientation` instead.\n */\n direction?: ResizableOrientation\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @deprecated Use `Disabled` instead.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * The orientation of the resizable.\n *\n * @default \"horizontal\"\n */\n orientation?: ResizableOrientation\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n isDisabled = false,\n disabled = isDisabled,\n keyboardStep,\n orientation = direction,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction: orientation,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n orientation,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n disabled,\n orientation,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n *\n * @deprecated Use `disabled` instead.\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n isDisabled,\n disabled = isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n const {\n controlRef,\n disabled: groupDisabled,\n orientation,\n } = useResizableContext()\n\n id ??= uuid\n\n const [active, setActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || groupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n \"aria-orientation\": orientation,\n disabled: trulyDisabled,\n tagName: as,\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(active),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (active) => setActive(active)),\n }) as PanelResizeHandleProps,\n [id, as, orientation, trulyDisabled, rest, onDoubleClick, active],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(active),\n }),\n [active],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAKO;AACP,IAAAA,gBAAmB;AACnB,IAAAC,iCAA2B;;;ACY3B,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAgEI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,WAAW;AAAA,EACX;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,iBAAa,qBAA8B,IAAI;AACrD,QAAM,WAAO,oBA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,CAAC;AAED,UAAM,MAAmB,EAAE,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,UAAU;AAErE,WACE,4CAAC,qBAAkB,OAAO,EAAE,QAAQ,GAAG,KAAK,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;AAEA,UAAU,cAAc;AACxB,UAAU,SAAS;","names":["import_utils","import_react_resizable_panels","ref","rest"]}
|
package/dist/resizable.mjs
CHANGED
package/dist/use-resizable.d.mts
CHANGED
@@ -4,7 +4,7 @@ import { PropGetter, HTMLUIProps, HTMLUIPropsWithoutAs, CSSUIObject } from '@yam
|
|
4
4
|
import { Merge } from '@yamada-ui/utils';
|
5
5
|
import { PanelGroupStorage, ImperativePanelGroupHandle, ImperativePanelHandle, PanelGroupOnLayout, PanelGroupProps, PanelProps, PanelResizeHandleProps } from 'react-resizable-panels';
|
6
6
|
|
7
|
-
type
|
7
|
+
type ResizableOrientation = "horizontal" | "vertical";
|
8
8
|
type As = keyof HTMLElementTagNameMap;
|
9
9
|
interface ResizableGroupProps extends Omit<Partial<PanelGroupProps>, "children" | "id" | "tagName"> {
|
10
10
|
as?: As;
|
@@ -23,8 +23,8 @@ interface ResizableItemControl extends ImperativePanelHandle {
|
|
23
23
|
}
|
24
24
|
interface ResizableContext {
|
25
25
|
controlRef: RefObject<ResizableGroupControl>;
|
26
|
-
direction: ResizableDirection;
|
27
26
|
disabled: boolean;
|
27
|
+
orientation: ResizableOrientation;
|
28
28
|
styles: {
|
29
29
|
[key: string]: CSSUIObject | undefined;
|
30
30
|
};
|
@@ -48,8 +48,10 @@ interface UseResizableProps {
|
|
48
48
|
* The direction of the resizable.
|
49
49
|
*
|
50
50
|
* @default "horizontal"
|
51
|
+
*
|
52
|
+
* @deprecated Use `orientation` instead.
|
51
53
|
*/
|
52
|
-
direction?:
|
54
|
+
direction?: ResizableOrientation;
|
53
55
|
/**
|
54
56
|
* If `true`, the resizable trigger will be disabled.
|
55
57
|
*/
|
@@ -66,6 +68,12 @@ interface UseResizableProps {
|
|
66
68
|
* @default 10
|
67
69
|
*/
|
68
70
|
keyboardStep?: number;
|
71
|
+
/**
|
72
|
+
* The orientation of the resizable.
|
73
|
+
*
|
74
|
+
* @default "horizontal"
|
75
|
+
*/
|
76
|
+
orientation?: ResizableOrientation;
|
69
77
|
/**
|
70
78
|
* A callback that gets and sets a value in custom storage.
|
71
79
|
*/
|
@@ -84,45 +92,41 @@ interface UseResizableProps {
|
|
84
92
|
*/
|
85
93
|
onLayout?: PanelGroupOnLayout;
|
86
94
|
}
|
87
|
-
declare const useResizable: ({ id, ref, controlRef: controlRefProp, direction,
|
95
|
+
declare const useResizable: ({ id, ref, controlRef: controlRefProp, direction, isDisabled, disabled, keyboardStep, orientation, storage, storageKey, groupProps, onLayout, ...rest }: UseResizableProps) => {
|
88
96
|
controlRef: RefObject<ResizableGroupControl>;
|
89
|
-
direction: ResizableDirection;
|
90
97
|
disabled: boolean;
|
98
|
+
orientation: ResizableOrientation;
|
91
99
|
getContainerProps: PropGetter<"div", undefined>;
|
92
100
|
getGroupProps: (props?: Partial<PanelGroupProps>) => {
|
93
|
-
"aria-disabled"?: (boolean | "false" | "true") | undefined;
|
94
|
-
slot?: string | undefined;
|
95
101
|
style?: react.CSSProperties | undefined;
|
102
|
+
slot?: string | undefined;
|
96
103
|
title?: string | undefined;
|
97
|
-
dir?: "ltr" | "rtl" | "auto" | undefined;
|
98
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
99
104
|
color?: string | undefined;
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
onDragEnd?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
105
|
-
onDrag?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
105
|
+
content?: string | undefined;
|
106
|
+
direction: "horizontal" | "vertical";
|
107
|
+
translate?: "yes" | "no" | undefined;
|
108
|
+
onResize?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
106
109
|
defaultChecked?: boolean | undefined;
|
110
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
107
111
|
suppressContentEditableWarning?: boolean | undefined;
|
108
112
|
suppressHydrationWarning?: boolean | undefined;
|
109
113
|
accessKey?: string | undefined;
|
110
114
|
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
|
111
115
|
autoFocus?: boolean | undefined;
|
112
116
|
className?: string | undefined;
|
113
|
-
contentEditable?: (boolean | "
|
117
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
114
118
|
contextMenu?: string | undefined;
|
115
|
-
|
119
|
+
dir?: "auto" | "ltr" | "rtl" | undefined;
|
120
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
116
121
|
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
117
122
|
hidden?: boolean | undefined;
|
118
123
|
lang?: string | undefined;
|
119
|
-
|
124
|
+
nonce?: string | undefined;
|
125
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
120
126
|
tabIndex?: number | undefined;
|
121
|
-
translate?: "yes" | "no" | undefined;
|
122
127
|
radioGroup?: string | undefined;
|
123
128
|
role?: react.AriaRole | undefined;
|
124
129
|
about?: string | undefined;
|
125
|
-
content?: string | undefined;
|
126
130
|
datatype?: string | undefined;
|
127
131
|
inlist?: any;
|
128
132
|
prefix?: string | undefined;
|
@@ -145,11 +149,11 @@ declare const useResizable: ({ id, ref, controlRef: controlRefProp, direction, d
|
|
145
149
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
146
150
|
is?: string | undefined;
|
147
151
|
"aria-activedescendant"?: string | undefined;
|
148
|
-
"aria-atomic"?: (boolean | "
|
152
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
149
153
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
150
154
|
"aria-braillelabel"?: string | undefined;
|
151
155
|
"aria-brailleroledescription"?: string | undefined;
|
152
|
-
"aria-busy"?: (boolean | "
|
156
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
153
157
|
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
|
154
158
|
"aria-colcount"?: number | undefined;
|
155
159
|
"aria-colindex"?: number | undefined;
|
@@ -160,36 +164,37 @@ declare const useResizable: ({ id, ref, controlRef: controlRefProp, direction, d
|
|
160
164
|
"aria-describedby"?: string | undefined;
|
161
165
|
"aria-description"?: string | undefined;
|
162
166
|
"aria-details"?: string | undefined;
|
167
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
163
168
|
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
164
169
|
"aria-errormessage"?: string | undefined;
|
165
|
-
"aria-expanded"?: (boolean | "
|
170
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
166
171
|
"aria-flowto"?: string | undefined;
|
167
|
-
"aria-grabbed"?: (boolean | "
|
172
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
168
173
|
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
169
|
-
"aria-hidden"?: (boolean | "
|
174
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
170
175
|
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
171
176
|
"aria-keyshortcuts"?: string | undefined;
|
172
177
|
"aria-label"?: string | undefined;
|
173
178
|
"aria-labelledby"?: string | undefined;
|
174
179
|
"aria-level"?: number | undefined;
|
175
180
|
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
176
|
-
"aria-modal"?: (boolean | "
|
177
|
-
"aria-multiline"?: (boolean | "
|
178
|
-
"aria-multiselectable"?: (boolean | "
|
181
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
182
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
183
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
179
184
|
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
180
185
|
"aria-owns"?: string | undefined;
|
181
186
|
"aria-placeholder"?: string | undefined;
|
182
187
|
"aria-posinset"?: number | undefined;
|
183
188
|
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
|
184
|
-
"aria-readonly"?: (boolean | "
|
189
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
185
190
|
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
|
186
|
-
"aria-required"?: (boolean | "
|
191
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
187
192
|
"aria-roledescription"?: string | undefined;
|
188
193
|
"aria-rowcount"?: number | undefined;
|
189
194
|
"aria-rowindex"?: number | undefined;
|
190
195
|
"aria-rowindextext"?: string | undefined;
|
191
196
|
"aria-rowspan"?: number | undefined;
|
192
|
-
"aria-selected"?: (boolean | "
|
197
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
193
198
|
"aria-setsize"?: number | undefined;
|
194
199
|
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
195
200
|
"aria-valuemax"?: number | undefined;
|
@@ -267,7 +272,6 @@ declare const useResizable: ({ id, ref, controlRef: controlRefProp, direction, d
|
|
267
272
|
onProgressCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
268
273
|
onRateChange?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
269
274
|
onRateChangeCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
270
|
-
onResize?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
271
275
|
onResizeCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
272
276
|
onSeeked?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
273
277
|
onSeekedCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
@@ -291,7 +295,9 @@ declare const useResizable: ({ id, ref, controlRef: controlRefProp, direction, d
|
|
291
295
|
onContextMenuCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
292
296
|
onDoubleClick?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
293
297
|
onDoubleClickCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
298
|
+
onDrag?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
294
299
|
onDragCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
300
|
+
onDragEnd?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
295
301
|
onDragEndCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
296
302
|
onDragEnter?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
297
303
|
onDragEnterCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
@@ -301,6 +307,7 @@ declare const useResizable: ({ id, ref, controlRef: controlRefProp, direction, d
|
|
301
307
|
onDragLeaveCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
302
308
|
onDragOver?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
303
309
|
onDragOverCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
310
|
+
onDragStart?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
304
311
|
onDragStartCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
305
312
|
onDrop?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
306
313
|
onDropCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
@@ -348,6 +355,7 @@ declare const useResizable: ({ id, ref, controlRef: controlRefProp, direction, d
|
|
348
355
|
onScrollCapture?: react.UIEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
349
356
|
onWheel?: react.WheelEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
350
357
|
onWheelCapture?: react.WheelEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
358
|
+
onAnimationStart?: react.AnimationEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
351
359
|
onAnimationStartCapture?: react.AnimationEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
352
360
|
onAnimationEnd?: react.AnimationEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
353
361
|
onAnimationEndCapture?: react.AnimationEventHandler<keyof HTMLElementTagNameMap> | undefined;
|
@@ -459,7 +467,7 @@ interface UseResizableTriggerOptions {
|
|
459
467
|
}
|
460
468
|
interface UseResizableTriggerProps extends Merge<ResizableTriggerProps, Omit<HTMLUIPropsWithoutAs, "id" | "onBlur" | "onFocus">>, UseResizableTriggerOptions {
|
461
469
|
}
|
462
|
-
declare const useResizableTrigger: ({ id, ref, as,
|
470
|
+
declare const useResizableTrigger: ({ id, ref, as, isDisabled, disabled, ...rest }: UseResizableTriggerProps) => {
|
463
471
|
getIconProps: PropGetter<"div", undefined>;
|
464
472
|
getTriggerProps: PropGetter<PanelResizeHandleProps, PanelResizeHandleProps>;
|
465
473
|
};
|