@yamada-ui/resizable 1.2.0-next-20241123062048 → 1.2.0-next-20241125001849

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,6 @@ import {
6
6
 
7
7
  // src/resizable-trigger.tsx
8
8
  import { ui } from "@yamada-ui/core";
9
- import { Icon } from "@yamada-ui/icon";
10
9
  import { cx } from "@yamada-ui/utils";
11
10
  import { forwardRef } from "react";
12
11
  import { PanelResizeHandle } from "react-resizable-panels";
@@ -55,56 +54,8 @@ var ResizableTrigger = forwardRef(
55
54
  );
56
55
  ResizableTrigger.displayName = "ResizableTrigger";
57
56
  ResizableTrigger.__ui__ = "ResizableTrigger";
58
- var ResizableTriggerIcon = (rest) => {
59
- return /* @__PURE__ */ jsxs(Icon, { h: "1rem", viewBox: "0 0 23 39", w: "0.5rem", ...rest, children: [
60
- /* @__PURE__ */ jsx(
61
- "path",
62
- {
63
- 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",
64
- fill: "currentColor"
65
- }
66
- ),
67
- /* @__PURE__ */ jsx(
68
- "path",
69
- {
70
- 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",
71
- fill: "currentColor"
72
- }
73
- ),
74
- /* @__PURE__ */ jsx(
75
- "path",
76
- {
77
- 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",
78
- fill: "currentColor"
79
- }
80
- ),
81
- /* @__PURE__ */ jsx(
82
- "path",
83
- {
84
- 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",
85
- fill: "currentColor"
86
- }
87
- ),
88
- /* @__PURE__ */ jsx(
89
- "path",
90
- {
91
- 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",
92
- fill: "currentColor"
93
- }
94
- ),
95
- /* @__PURE__ */ jsx(
96
- "path",
97
- {
98
- 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",
99
- fill: "currentColor"
100
- }
101
- )
102
- ] });
103
- };
104
- ResizableTriggerIcon.__ui__ = "ResizableTriggerIcon";
105
57
 
106
58
  export {
107
- ResizableTrigger,
108
- ResizableTriggerIcon
59
+ ResizableTrigger
109
60
  };
110
- //# sourceMappingURL=chunk-RMHSHB7E.mjs.map
61
+ //# sourceMappingURL=chunk-GJEIDKF2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resizable-trigger.tsx"],"sourcesContent":["import type {\n ComponentArgs,\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n} from \"@yamada-ui/core\"\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 { 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"],"mappings":";;;;;;;AASA,SAAS,UAAU;AACnB,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,yBAAyB;AAgC5B,SAOI,KAPJ;AAXC,IAAM,mBAAmB;AAAA,EAC9B,CAAC,EAAE,WAAW,UAAU,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC1D,UAAM,EAAE,OAAO,IAAI,oBAAoB;AACvC,UAAM,EAAE,cAAc,gBAAgB,IAAI,oBAAoB;AAAA,MAC5D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAED,UAAM,MAAmB,EAAE,UAAU,YAAY,GAAG,OAAO,QAAQ;AAEnE,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC,IAAI;AAAA,QACJ,WAAW,GAAG,yBAAyB,SAAS;AAAA,QAChD,OAAO;AAAA,QACN,GAAG,gBAAgB;AAAA,QAEnB;AAAA,iBACC;AAAA,YAAC,GAAG;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;","names":[]}
package/dist/index.d.mts CHANGED
@@ -1,9 +1,8 @@
1
1
  export { Resizable, ResizableProps } from './resizable.mjs';
2
2
  export { ResizableItem, ResizableItemProps } from './resizable-item.mjs';
3
- export { ResizableTrigger, ResizableTriggerIcon, ResizableTriggerIconProps, ResizableTriggerProps } from './resizable-trigger.mjs';
3
+ export { ResizableTrigger, ResizableTriggerProps } from './resizable-trigger.mjs';
4
4
  export { ResizableItemControl, ResizableStorage } from './use-resizable.mjs';
5
5
  import '@yamada-ui/core';
6
6
  import 'react';
7
- import '@yamada-ui/icon';
8
7
  import '@yamada-ui/utils';
9
8
  import 'react-resizable-panels';
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  export { Resizable, ResizableProps } from './resizable.js';
2
2
  export { ResizableItem, ResizableItemProps } from './resizable-item.js';
3
- export { ResizableTrigger, ResizableTriggerIcon, ResizableTriggerIconProps, ResizableTriggerProps } from './resizable-trigger.js';
3
+ export { ResizableTrigger, ResizableTriggerProps } from './resizable-trigger.js';
4
4
  export { ResizableItemControl, ResizableStorage } from './use-resizable.js';
5
5
  import '@yamada-ui/core';
6
6
  import 'react';
7
- import '@yamada-ui/icon';
8
7
  import '@yamada-ui/utils';
9
8
  import 'react-resizable-panels';
package/dist/index.js CHANGED
@@ -23,8 +23,7 @@ var src_exports = {};
23
23
  __export(src_exports, {
24
24
  Resizable: () => Resizable,
25
25
  ResizableItem: () => ResizableItem,
26
- ResizableTrigger: () => ResizableTrigger,
27
- ResizableTriggerIcon: () => ResizableTriggerIcon
26
+ ResizableTrigger: () => ResizableTrigger
28
27
  });
29
28
  module.exports = __toCommonJS(src_exports);
30
29
 
@@ -339,7 +338,6 @@ ResizableItem.__ui__ = "ResizableItem";
339
338
 
340
339
  // src/resizable-trigger.tsx
341
340
  var import_core3 = require("@yamada-ui/core");
342
- var import_icon = require("@yamada-ui/icon");
343
341
  var import_utils4 = require("@yamada-ui/utils");
344
342
  var import_react2 = require("react");
345
343
  var import_react_resizable_panels4 = require("react-resizable-panels");
@@ -388,58 +386,10 @@ var ResizableTrigger = (0, import_react2.forwardRef)(
388
386
  );
389
387
  ResizableTrigger.displayName = "ResizableTrigger";
390
388
  ResizableTrigger.__ui__ = "ResizableTrigger";
391
- var ResizableTriggerIcon = (rest) => {
392
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_icon.Icon, { h: "1rem", viewBox: "0 0 23 39", w: "0.5rem", ...rest, children: [
393
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
394
- "path",
395
- {
396
- 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",
397
- fill: "currentColor"
398
- }
399
- ),
400
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
401
- "path",
402
- {
403
- 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",
404
- fill: "currentColor"
405
- }
406
- ),
407
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
408
- "path",
409
- {
410
- 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",
411
- fill: "currentColor"
412
- }
413
- ),
414
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
415
- "path",
416
- {
417
- 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",
418
- fill: "currentColor"
419
- }
420
- ),
421
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
422
- "path",
423
- {
424
- 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",
425
- fill: "currentColor"
426
- }
427
- ),
428
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
429
- "path",
430
- {
431
- 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",
432
- fill: "currentColor"
433
- }
434
- )
435
- ] });
436
- };
437
- ResizableTriggerIcon.__ui__ = "ResizableTriggerIcon";
438
389
  // Annotate the CommonJS export names for ESM import in node:
439
390
  0 && (module.exports = {
440
391
  Resizable,
441
392
  ResizableItem,
442
- ResizableTrigger,
443
- ResizableTriggerIcon
393
+ ResizableTrigger
444
394
  });
445
395
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/resizable.tsx","../src/use-resizable.ts","../src/resizable-item.tsx","../src/resizable-trigger.tsx"],"sourcesContent":["export { Resizable } from \"./resizable\"\nexport type { ResizableProps } from \"./resizable\"\nexport { ResizableItem } from \"./resizable-item\"\nexport type { ResizableItemProps } from \"./resizable-item\"\nexport { ResizableTrigger, ResizableTriggerIcon } from \"./resizable-trigger\"\nexport type {\n ResizableTriggerIconProps,\n ResizableTriggerProps,\n} from \"./resizable-trigger\"\nexport type { ResizableItemControl, ResizableStorage } from \"./use-resizable\"\n","import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableProps } from \"./use-resizable\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { PanelGroup } from \"react-resizable-panels\"\nimport { ResizableProvider, useResizable } from \"./use-resizable\"\n\ninterface ResizableOptions {\n /**\n * Ref for resizable container element.\n */\n containerRef?: ForwardedRef<HTMLDivElement>\n}\n\n/**\n * `Resizable` is accessible resizable panel groups and layouts with keyboard support.\n *\n * @see Docs https://yamada-ui.com/components/data-display/resizable\n */\nexport interface ResizableProps\n extends Omit<HTMLUIProps, \"direction\">,\n ThemeProps<\"Resizable\">,\n Omit<UseResizableProps, \"ref\">,\n ResizableOptions {}\n\nexport const Resizable = forwardRef<ResizableProps, \"div\">(\n ({ direction = \"horizontal\", ...props }, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Resizable\", {\n direction,\n ...props,\n })\n const { className, children, containerRef, ...computedProps } =\n omitThemeProps(mergedProps)\n const { getContainerProps, getGroupProps, ...rest } = useResizable({\n ref,\n ...computedProps,\n })\n\n const css: CSSUIObject = { h: \"100%\", w: \"100%\", ...styles.container }\n\n return (\n <ResizableProvider value={{ styles, ...rest }}>\n <ui.div\n className={cx(\"ui-resizable\", className)}\n __css={css}\n {...getContainerProps({}, containerRef)}\n >\n <PanelGroup {...getGroupProps()}>{children}</PanelGroup>\n </ui.div>\n </ResizableProvider>\n )\n },\n)\n\nResizable.displayName = \"Resizable\"\nResizable.__ui__ = \"Resizable\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n MouseEvent,\n MouseEventHandler,\n RefObject,\n} from \"react\"\nimport type {\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\ntype ResizableDirection = \"horizontal\" | \"vertical\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableGroupControl extends ImperativePanelGroupHandle {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n controlRef: RefObject<ResizableGroupControl>\n direction: ResizableDirection\n isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: ResizableDirection\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n direction,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n direction,\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const {\n controlRef,\n direction,\n isDisabled: isGroupDisabled,\n } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n \"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(isActive),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (isActive) =>\n setIsActive(isActive),\n ),\n }) as PanelResizeHandleProps,\n [id, as, direction, trulyDisabled, rest, onDoubleClick, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableItemProps } from \"./use-resizable\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { Panel } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableItem } from \"./use-resizable\"\n\nconst panelProps = new Set([\"order\"])\n\nconst UIPanel = ui(Panel, { disableStyleProp: (prop) => panelProps.has(prop) })\n\ninterface ResizableItemOptions {\n /**\n * Ref for resizable item inner element.\n */\n innerRef?: ForwardedRef<HTMLDivElement>\n}\n\nexport interface ResizableItemProps\n extends Omit<UseResizableItemProps, \"ref\">,\n ResizableItemOptions {}\n\nexport const ResizableItem = forwardRef<ResizableItemProps, \"div\">(\n (\n {\n className,\n boxSize,\n children,\n h,\n height,\n innerRef,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useResizableContext()\n const { getItemProps, getPanelProps } = useResizableItem({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { boxSize: \"100%\", ...styles.item }\n\n return (\n <UIPanel\n {...getPanelProps({\n boxSize,\n h,\n height,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n })}\n >\n <ui.div\n className={cx(\"ui-resizable__item\", className)}\n __css={css}\n {...getItemProps({}, innerRef)}\n >\n {children}\n </ui.div>\n </UIPanel>\n )\n },\n)\n\nResizableItem.displayName = \"ResizableItem\"\nResizableItem.__ui__ = \"ResizableItem\"\n","import type {\n ComponentArgs,\n CSSUIObject,\n FC,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n} from \"@yamada-ui/core\"\nimport type { IconProps } from \"@yamada-ui/icon\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type { ReactElement, RefAttributes } from \"react\"\nimport type { UseResizableTriggerProps } from \"./use-resizable\"\nimport { ui } from \"@yamada-ui/core\"\nimport { Icon } from \"@yamada-ui/icon\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { forwardRef } from \"react\"\nimport { PanelResizeHandle } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableTrigger } from \"./use-resizable\"\n\ninterface ResizableTriggerOptions {\n /**\n * The resizable trigger icon to use.\n */\n icon?: ReactElement\n /**\n * Props for resizable trigger icon component.\n */\n iconProps?: HTMLUIProps\n}\n\nexport interface ResizableTriggerProps\n extends Merge<\n Omit<UseResizableTriggerProps, \"ref\">,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n ResizableTriggerOptions {}\n\nexport const ResizableTrigger = forwardRef<HTMLElement, ResizableTriggerProps>(\n ({ className, children, icon, iconProps, ...rest }, ref) => {\n const { styles } = useResizableContext()\n const { getIconProps, getTriggerProps } = useResizableTrigger({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { position: \"relative\", ...styles.trigger }\n\n return (\n <ui.div\n as={PanelResizeHandle}\n className={cx(\"ui-resizable__trigger\", className)}\n __css={css}\n {...getTriggerProps()}\n >\n {icon ? (\n <ui.div\n className=\"ui-resizable__trigger__icon\"\n __css={{\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"center\",\n left: \"50%\",\n position: \"absolute\",\n top: \"50%\",\n transform: \"auto\",\n translateX: \"-50%\",\n translateY: \"-50%\",\n ...styles.icon,\n }}\n {...getIconProps(iconProps)}\n >\n {icon}\n </ui.div>\n ) : null}\n\n {children}\n </ui.div>\n )\n },\n) as {\n (props: RefAttributes<HTMLElement> & ResizableTriggerProps): ReactElement\n} & ComponentArgs\n\nResizableTrigger.displayName = \"ResizableTrigger\"\nResizableTrigger.__ui__ = \"ResizableTrigger\"\n\nexport type ResizableTriggerIconProps = IconProps\n\nexport const ResizableTriggerIcon: FC<ResizableTriggerIconProps> = (rest) => {\n return (\n <Icon h=\"1rem\" viewBox=\"0 0 23 39\" w=\"0.5rem\" {...rest}>\n <path\n d=\"M 5 0 C 7.761 0 10 2.239 10 5 C 10 7.761 7.761 10 5 10 C 2.239 10 0 7.761 0 5 C 0 2.239 2.239 0 5 0 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 0 C 21.761 0 24 2.239 24 5 C 24 7.761 21.761 10 19 10 C 16.239 10 14 7.761 14 5 C 14 2.239 16.239 0 19 0 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 14 C 21.761 14 24 16.239 24 19 C 24 21.761 21.761 24 19 24 C 16.239 24 14 21.761 14 19 C 14 16.239 16.239 14 19 14 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 5 14 C 7.761 14 10 16.239 10 19 C 10 21.761 7.761 24 5 24 C 2.239 24 0 21.761 0 19 C 0 16.239 2.239 14 5 14 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 5 28 C 7.761 28 10 30.239 10 33 C 10 35.761 7.761 38 5 38 C 2.239 38 0 35.761 0 33 C 0 30.239 2.239 28 5 28 Z\"\n fill=\"currentColor\"\n />\n\n <path\n d=\"M 19 28 C 21.761 28 24 30.239 24 33 C 24 35.761 21.761 38 19 38 C 16.239 38 14 35.761 14 33 C 14 30.239 16.239 28 19 28 Z\"\n fill=\"currentColor\"\n />\n </Icon>\n )\n}\n\nResizableTriggerIcon.__ui__ = \"ResizableTriggerIcon\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,kBAKO;AACP,IAAAA,gBAAmB;AACnB,IAAAC,iCAA2B;;;ACY3B,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc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AAO;AAAA,QACN,GAAG,gBAAgB;AAAA,QAEnB;AAAA,iBACC;AAAA,YAAC,gBAAG;AAAA,YAAH;AAAA,cACC,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,YAAY;AAAA,gBACZ,SAAS;AAAA,gBACT,gBAAgB;AAAA,gBAChB,MAAM;AAAA,gBACN,UAAU;AAAA,gBACV,KAAK;AAAA,gBACL,WAAW;AAAA,gBACX,YAAY;AAAA,gBACZ,YAAY;AAAA,gBACZ,GAAG,OAAO;AAAA,cACZ;AAAA,cACC,GAAG,aAAa,SAAS;AAAA,cAEzB;AAAA;AAAA,UACH,IACE;AAAA,UAEH;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAIA,iBAAiB,cAAc;AAC/B,iBAAiB,SAAS;AAInB,IAAM,uBAAsD,CAAC,SAAS;AAC3E,SACE,8CAAC,oBAAK,GAAE,QAAO,SAAQ,aAAY,GAAE,UAAU,GAAG,MAChD;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,GAAE;AAAA,QACF,MAAK;AAAA;AAAA,IACP;AAAA,KACF;AAEJ;AAEA,qBAAqB,SAAS;","names":["import_utils","import_react_resizable_panels","ref","rest","isActive","import_core","import_utils","import_react_resizable_panels","import_jsx_runtime","import_core","import_utils","import_react","import_react_resizable_panels","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/resizable.tsx","../src/use-resizable.ts","../src/resizable-item.tsx","../src/resizable-trigger.tsx"],"sourcesContent":["export { Resizable } from \"./resizable\"\nexport type { ResizableProps } from \"./resizable\"\nexport { ResizableItem } from \"./resizable-item\"\nexport type { ResizableItemProps } from \"./resizable-item\"\nexport { ResizableTrigger } from \"./resizable-trigger\"\nexport type { ResizableTriggerProps } from \"./resizable-trigger\"\nexport type { ResizableItemControl, ResizableStorage } from \"./use-resizable\"\n","import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableProps } from \"./use-resizable\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { PanelGroup } from \"react-resizable-panels\"\nimport { ResizableProvider, useResizable } from \"./use-resizable\"\n\ninterface ResizableOptions {\n /**\n * Ref for resizable container element.\n */\n containerRef?: ForwardedRef<HTMLDivElement>\n}\n\n/**\n * `Resizable` is accessible resizable panel groups and layouts with keyboard support.\n *\n * @see Docs https://yamada-ui.com/components/data-display/resizable\n */\nexport interface ResizableProps\n extends Omit<HTMLUIProps, \"direction\">,\n ThemeProps<\"Resizable\">,\n Omit<UseResizableProps, \"ref\">,\n ResizableOptions {}\n\nexport const Resizable = forwardRef<ResizableProps, \"div\">(\n ({ direction = \"horizontal\", ...props }, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Resizable\", {\n direction,\n ...props,\n })\n const { className, children, containerRef, ...computedProps } =\n omitThemeProps(mergedProps)\n const { getContainerProps, getGroupProps, ...rest } = useResizable({\n ref,\n ...computedProps,\n })\n\n const css: CSSUIObject = { h: \"100%\", w: \"100%\", ...styles.container }\n\n return (\n <ResizableProvider value={{ styles, ...rest }}>\n <ui.div\n className={cx(\"ui-resizable\", className)}\n __css={css}\n {...getContainerProps({}, containerRef)}\n >\n <PanelGroup {...getGroupProps()}>{children}</PanelGroup>\n </ui.div>\n </ResizableProvider>\n )\n },\n)\n\nResizable.displayName = \"Resizable\"\nResizable.__ui__ = \"Resizable\"\n","import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n MouseEvent,\n MouseEventHandler,\n RefObject,\n} from \"react\"\nimport type {\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\ntype ResizableDirection = \"horizontal\" | \"vertical\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableGroupControl extends ImperativePanelGroupHandle {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n controlRef: RefObject<ResizableGroupControl>\n direction: ResizableDirection\n isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: ResizableDirection\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n direction,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n direction,\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const {\n controlRef,\n direction,\n isDisabled: isGroupDisabled,\n } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n \"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(isActive),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (isActive) =>\n setIsActive(isActive),\n ),\n }) as PanelResizeHandleProps,\n [id, as, direction, trulyDisabled, rest, onDoubleClick, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport type { ForwardedRef } from \"react\"\nimport type { UseResizableItemProps } from \"./use-resizable\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { Panel } from \"react-resizable-panels\"\nimport { useResizableContext, useResizableItem } from \"./use-resizable\"\n\nconst panelProps = new Set([\"order\"])\n\nconst UIPanel = ui(Panel, { disableStyleProp: (prop) => panelProps.has(prop) })\n\ninterface ResizableItemOptions {\n /**\n * Ref for resizable item inner element.\n */\n innerRef?: ForwardedRef<HTMLDivElement>\n}\n\nexport interface ResizableItemProps\n extends Omit<UseResizableItemProps, \"ref\">,\n ResizableItemOptions {}\n\nexport const ResizableItem = forwardRef<ResizableItemProps, \"div\">(\n (\n {\n className,\n boxSize,\n children,\n h,\n height,\n innerRef,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useResizableContext()\n const { getItemProps, getPanelProps } = useResizableItem({\n ref,\n ...rest,\n })\n\n const css: CSSUIObject = { boxSize: \"100%\", ...styles.item }\n\n return (\n <UIPanel\n {...getPanelProps({\n boxSize,\n h,\n height,\n maxH,\n maxHeight,\n maxW,\n maxWidth,\n minH,\n minHeight,\n minW,\n minWidth,\n w,\n width,\n })}\n >\n <ui.div\n className={cx(\"ui-resizable__item\", className)}\n __css={css}\n {...getItemProps({}, innerRef)}\n >\n {children}\n </ui.div>\n </UIPanel>\n )\n },\n)\n\nResizableItem.displayName = \"ResizableItem\"\nResizableItem.__ui__ = \"ResizableItem\"\n","import type {\n ComponentArgs,\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n} from \"@yamada-ui/core\"\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 { 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,kBAKO;AACP,IAAAA,gBAAmB;AACnB,IAAAC,iCAA2B;;;ACY3B,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAkDI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,iBAAa,qBAA8B,IAAI;AACrD,QAAM,WAAO,oBAAM;AAEnB,yBAAO;AAEP,QAAM,wBAAgC;AAAA,IACpC,CAAC,QAAQ,CAAC,GAAGC,OAAM,UAAU,EAAE,GAAG,OAAO,KAAAA,MAAK,GAAG,KAAK;AAAA,IACtD,CAAC,IAAI;AAAA,EACP;AAEA,QAAM,oBAAgB;AAAA,IACpB,CAAC,QAAkC,CAAC,MAAM;AACxC,YAAM,EAAE,IAAI,GAAGC,MAAK,IAAI,kCAAc,CAAC;AAEvC,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QACA,SAAK,wBAAU,gBAAgB,UAAU;AAAA,QACzC,YAAY;AAAA,QACZ;AAAA,QACA,kBAAkB;AAAA,QAClB;AA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c,cAAc;AAC5B,cAAc,SAAS;;;AC5EvB,IAAAC,eAAmB;AACnB,IAAAC,gBAAmB;AACnB,IAAAC,gBAA2B;AAC3B,IAAAC,iCAAkC;AAgC5B,IAAAC,sBAAA;AAXC,IAAM,uBAAmB;AAAA,EAC9B,CAAC,EAAE,WAAW,UAAU,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC1D,UAAM,EAAE,OAAO,IAAI,oBAAoB;AACvC,UAAM,EAAE,cAAc,gBAAgB,IAAI,oBAAoB;AAAA,MAC5D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAED,UAAM,MAAmB,EAAE,UAAU,YAAY,GAAG,OAAO,QAAQ;AAEnE,WACE;AAAA,MAAC,gBAAG;AAAA,MAAH;AAAA,QACC,IAAI;AAAA,QACJ,eAAW,kBAAG,yBAAyB,SAAS;AAAA,QAChD,OAAO;AAAA,QACN,GAAG,gBAAgB;AAAA,QAEnB;AAAA,iBACC;AAAA,YAAC,gBAAG;AAAA,YAAH;AAAA,cACC,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,YAAY;AAAA,gBACZ,SAAS;AAAA,gBACT,gBAAgB;AAAA,gBAChB,MAAM;AAAA,gBACN,UAAU;AAAA,gBACV,KAAK;AAAA,gBACL,WAAW;AAAA,gBACX,YAAY;AAAA,gBACZ,YAAY;AAAA,gBACZ,GAAG,OAAO;AAAA,cACZ;AAAA,cACC,GAAG,aAAa,SAAS;AAAA,cAEzB;AAAA;AAAA,UACH,IACE;AAAA,UAEH;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAIA,iBAAiB,cAAc;AAC/B,iBAAiB,SAAS;","names":["import_utils","import_react_resizable_panels","ref","rest","isActive","import_core","import_utils","import_react_resizable_panels","import_jsx_runtime","import_core","import_utils","import_react","import_react_resizable_panels","import_jsx_runtime"]}
package/dist/index.mjs CHANGED
@@ -3,9 +3,8 @@ import {
3
3
  ResizableItem
4
4
  } from "./chunk-XC5BVPJT.mjs";
5
5
  import {
6
- ResizableTrigger,
7
- ResizableTriggerIcon
8
- } from "./chunk-RMHSHB7E.mjs";
6
+ ResizableTrigger
7
+ } from "./chunk-GJEIDKF2.mjs";
9
8
  import {
10
9
  Resizable
11
10
  } from "./chunk-4VJA4HKO.mjs";
@@ -13,7 +12,6 @@ import "./chunk-3Q7AOVVP.mjs";
13
12
  export {
14
13
  Resizable,
15
14
  ResizableItem,
16
- ResizableTrigger,
17
- ResizableTriggerIcon
15
+ ResizableTrigger
18
16
  };
19
17
  //# sourceMappingURL=index.mjs.map
@@ -1,5 +1,4 @@
1
- import { HTMLUIPropsWithoutAs, HTMLUIProps, ComponentArgs, FC } from '@yamada-ui/core';
2
- import { IconProps } from '@yamada-ui/icon';
1
+ import { HTMLUIPropsWithoutAs, HTMLUIProps, ComponentArgs } from '@yamada-ui/core';
3
2
  import { Merge } from '@yamada-ui/utils';
4
3
  import { RefAttributes, ReactElement } from 'react';
5
4
  import { UseResizableTriggerProps } from './use-resizable.mjs';
@@ -20,7 +19,5 @@ interface ResizableTriggerProps extends Merge<Omit<UseResizableTriggerProps, "re
20
19
  declare const ResizableTrigger: {
21
20
  (props: RefAttributes<HTMLElement> & ResizableTriggerProps): ReactElement;
22
21
  } & ComponentArgs;
23
- type ResizableTriggerIconProps = IconProps;
24
- declare const ResizableTriggerIcon: FC<ResizableTriggerIconProps>;
25
22
 
26
- export { ResizableTrigger, ResizableTriggerIcon, type ResizableTriggerIconProps, type ResizableTriggerProps };
23
+ export { ResizableTrigger, type ResizableTriggerProps };
@@ -1,5 +1,4 @@
1
- import { HTMLUIPropsWithoutAs, HTMLUIProps, ComponentArgs, FC } from '@yamada-ui/core';
2
- import { IconProps } from '@yamada-ui/icon';
1
+ import { HTMLUIPropsWithoutAs, HTMLUIProps, ComponentArgs } from '@yamada-ui/core';
3
2
  import { Merge } from '@yamada-ui/utils';
4
3
  import { RefAttributes, ReactElement } from 'react';
5
4
  import { UseResizableTriggerProps } from './use-resizable.js';
@@ -20,7 +19,5 @@ interface ResizableTriggerProps extends Merge<Omit<UseResizableTriggerProps, "re
20
19
  declare const ResizableTrigger: {
21
20
  (props: RefAttributes<HTMLElement> & ResizableTriggerProps): ReactElement;
22
21
  } & ComponentArgs;
23
- type ResizableTriggerIconProps = IconProps;
24
- declare const ResizableTriggerIcon: FC<ResizableTriggerIconProps>;
25
22
 
26
- export { ResizableTrigger, ResizableTriggerIcon, type ResizableTriggerIconProps, type ResizableTriggerProps };
23
+ export { ResizableTrigger, type ResizableTriggerProps };
@@ -21,12 +21,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  // src/resizable-trigger.tsx
22
22
  var resizable_trigger_exports = {};
23
23
  __export(resizable_trigger_exports, {
24
- ResizableTrigger: () => ResizableTrigger,
25
- ResizableTriggerIcon: () => ResizableTriggerIcon
24
+ ResizableTrigger: () => ResizableTrigger
26
25
  });
27
26
  module.exports = __toCommonJS(resizable_trigger_exports);
28
27
  var import_core = require("@yamada-ui/core");
29
- var import_icon = require("@yamada-ui/icon");
30
28
  var import_utils2 = require("@yamada-ui/utils");
31
29
  var import_react2 = require("react");
32
30
  var import_react_resizable_panels2 = require("react-resizable-panels");
@@ -159,56 +157,8 @@ var ResizableTrigger = (0, import_react2.forwardRef)(
159
157
  );
160
158
  ResizableTrigger.displayName = "ResizableTrigger";
161
159
  ResizableTrigger.__ui__ = "ResizableTrigger";
162
- var ResizableTriggerIcon = (rest) => {
163
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_icon.Icon, { h: "1rem", viewBox: "0 0 23 39", w: "0.5rem", ...rest, children: [
164
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
165
- "path",
166
- {
167
- 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",
168
- fill: "currentColor"
169
- }
170
- ),
171
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
172
- "path",
173
- {
174
- 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",
175
- fill: "currentColor"
176
- }
177
- ),
178
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
179
- "path",
180
- {
181
- 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",
182
- fill: "currentColor"
183
- }
184
- ),
185
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
186
- "path",
187
- {
188
- 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",
189
- fill: "currentColor"
190
- }
191
- ),
192
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
193
- "path",
194
- {
195
- 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",
196
- fill: "currentColor"
197
- }
198
- ),
199
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
200
- "path",
201
- {
202
- 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",
203
- fill: "currentColor"
204
- }
205
- )
206
- ] });
207
- };
208
- ResizableTriggerIcon.__ui__ = "ResizableTriggerIcon";
209
160
  // Annotate the CommonJS export names for ESM import in node:
210
161
  0 && (module.exports = {
211
- ResizableTrigger,
212
- ResizableTriggerIcon
162
+ ResizableTrigger
213
163
  });
214
164
  //# sourceMappingURL=resizable-trigger.js.map
@@ -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 isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: ResizableDirection\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n direction,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n direction,\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const {\n controlRef,\n direction,\n isDisabled: isGroupDisabled,\n } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n \"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(isActive),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (isActive) =>\n setIsActive(isActive),\n ),\n }) as PanelResizeHandleProps,\n [id, as, direction, trulyDisabled, rest, onDoubleClick, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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;AAmSI,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,YAAY;AAAA,EACd,IAAI,oBAAoB;AACxB,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAkB,KAAK;AAEvD,QAAM,gBAAgB,YAAY,cAAc;AAEhD,QAAM,oBAAgB;AAAA,IACpB,CAAC,OAAmC;AA7XxC;AA8XM,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,MACV,SAA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GAAG,gBAAgB;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","isActive","ref"]}
1
+ {"version":3,"sources":["../src/resizable-trigger.tsx","../src/use-resizable.ts"],"sourcesContent":["import type {\n ComponentArgs,\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n} from \"@yamada-ui/core\"\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 { 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","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 isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: ResizableDirection\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n direction,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n direction,\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const {\n controlRef,\n direction,\n isDisabled: isGroupDisabled,\n } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n \"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(isActive),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (isActive) =>\n setIsActive(isActive),\n ),\n }) as PanelResizeHandleProps,\n [id, as, direction, trulyDisabled, rest, onDoubleClick, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,kBAAmB;AACnB,IAAAA,gBAAmB;AACnB,IAAAC,gBAA2B;AAC3B,IAAAC,iCAAkC;;;ACUlC,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA8BA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAmSI,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,YAAY;AAAA,EACd,IAAI,oBAAoB;AACxB,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAkB,KAAK;AAEvD,QAAM,gBAAgB,YAAY,cAAc;AAEhD,QAAM,oBAAgB;AAAA,IACpB,CAAC,OAAmC;AA7XxC;AA8XM,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,IACh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AmB,EAAE,UAAU,YAAY,GAAG,OAAO,QAAQ;AAEnE,WACE;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA,QACC,IAAI;AAAA,QACJ,eAAW,kBAAG,yBAAyB,SAAS;AAAA,QAChD,OAAO;AAAA,QACN,GAAG,gBAAgB;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;","names":["import_utils","import_react","import_react_resizable_panels","isActive","ref"]}
@@ -1,11 +1,9 @@
1
1
  "use client"
2
2
  import {
3
- ResizableTrigger,
4
- ResizableTriggerIcon
5
- } from "./chunk-RMHSHB7E.mjs";
3
+ ResizableTrigger
4
+ } from "./chunk-GJEIDKF2.mjs";
6
5
  import "./chunk-3Q7AOVVP.mjs";
7
6
  export {
8
- ResizableTrigger,
9
- ResizableTriggerIcon
7
+ ResizableTrigger
10
8
  };
11
9
  //# sourceMappingURL=resizable-trigger.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/resizable",
3
- "version": "1.2.0-next-20241123062048",
3
+ "version": "1.2.0-next-20241125001849",
4
4
  "description": "Yamada UI resizable component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -38,7 +38,6 @@
38
38
  "dependencies": {
39
39
  "react-resizable-panels": "^2.1.6",
40
40
  "@yamada-ui/core": "1.15.5",
41
- "@yamada-ui/icon": "1.1.13-next-20241123062048",
42
41
  "@yamada-ui/utils": "1.5.4"
43
42
  },
44
43
  "devDependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/resizable-trigger.tsx"],"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__ = \"ResizableTriggerI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