@yamada-ui/resizable 1.1.18 → 1.2.0-dev-20241114143508

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/dist/{chunk-OV5GGHOC.mjs → chunk-25QQGKDC.mjs} +2 -2
  2. package/dist/{chunk-72BYQXIX.mjs → chunk-JU7AHOX7.mjs} +2 -2
  3. package/dist/{chunk-EICWL7I5.mjs → chunk-NG4RLXOF.mjs} +2 -2
  4. package/dist/{chunk-HAROVF4B.mjs → chunk-WCMBVV3R.mjs} +42 -10
  5. package/dist/chunk-WCMBVV3R.mjs.map +1 -0
  6. package/dist/index.d.mts +1 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +38 -7
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +4 -4
  11. package/dist/resizable-item.d.mts +1 -0
  12. package/dist/resizable-item.d.ts +1 -0
  13. package/dist/resizable-item.js +0 -1
  14. package/dist/resizable-item.js.map +1 -1
  15. package/dist/resizable-item.mjs +2 -2
  16. package/dist/resizable-trigger.d.mts +1 -0
  17. package/dist/resizable-trigger.d.ts +1 -0
  18. package/dist/resizable-trigger.js +24 -5
  19. package/dist/resizable-trigger.js.map +1 -1
  20. package/dist/resizable-trigger.mjs +2 -2
  21. package/dist/resizable.d.mts +1 -0
  22. package/dist/resizable.d.ts +1 -0
  23. package/dist/resizable.js +14 -1
  24. package/dist/resizable.js.map +1 -1
  25. package/dist/resizable.mjs +2 -2
  26. package/dist/use-resizable.d.mts +289 -6
  27. package/dist/use-resizable.d.ts +289 -6
  28. package/dist/use-resizable.js +38 -7
  29. package/dist/use-resizable.js.map +1 -1
  30. package/dist/use-resizable.mjs +1 -1
  31. package/package.json +2 -2
  32. package/dist/chunk-HAROVF4B.mjs.map +0 -1
  33. /package/dist/{chunk-OV5GGHOC.mjs.map → chunk-25QQGKDC.mjs.map} +0 -0
  34. /package/dist/{chunk-72BYQXIX.mjs.map → chunk-JU7AHOX7.mjs.map} +0 -0
  35. /package/dist/{chunk-EICWL7I5.mjs.map → chunk-NG4RLXOF.mjs.map} +0 -0
@@ -1,8 +1,9 @@
1
+ import * as react_resizable_panels_dist_declarations_src_types from 'react-resizable-panels/dist/declarations/src/types';
1
2
  import * as react from 'react';
2
- import { ForwardedRef, RefObject } from 'react';
3
+ import { ForwardedRef, RefObject, MouseEventHandler } from 'react';
3
4
  import { PropGetter, HTMLUIProps, HTMLUIPropsWithoutAs, CSSUIObject } from '@yamada-ui/core';
4
5
  import { Merge } from '@yamada-ui/utils';
5
- import { PanelGroupStorage, ImperativePanelHandle, PanelGroupOnLayout, PanelGroupProps, PanelProps, PanelResizeHandleProps } from 'react-resizable-panels';
6
+ import { PanelGroupStorage, ImperativePanelGroupHandle, ImperativePanelHandle, PanelGroupOnLayout, PanelGroupProps, PanelProps, PanelResizeHandleProps } from 'react-resizable-panels';
6
7
 
7
8
  type As = keyof HTMLElementTagNameMap;
8
9
  interface ResizableGroupProps extends Omit<Partial<PanelGroupProps>, "children" | "id" | "tagName"> {
@@ -16,9 +17,12 @@ interface ResizableTriggerProps extends Omit<PanelResizeHandleProps, "children"
16
17
  }
17
18
  interface ResizableStorage extends PanelGroupStorage {
18
19
  }
20
+ interface ResizableGroupControl extends ImperativePanelGroupHandle {
21
+ }
19
22
  interface ResizableItemControl extends ImperativePanelHandle {
20
23
  }
21
24
  interface ResizableContext {
25
+ controlRef: RefObject<ResizableGroupControl>;
22
26
  isDisabled: boolean;
23
27
  styles: {
24
28
  [key: string]: CSSUIObject | undefined;
@@ -35,6 +39,10 @@ interface UseResizableProps {
35
39
  * Ref for resizable element.
36
40
  */
37
41
  ref?: ForwardedRef<HTMLElement>;
42
+ /**
43
+ * Ref of the resizable item callback.
44
+ */
45
+ controlRef?: RefObject<ResizableGroupControl>;
38
46
  /**
39
47
  * The direction of the resizable.
40
48
  *
@@ -69,10 +77,285 @@ interface UseResizableProps {
69
77
  */
70
78
  onLayout?: PanelGroupOnLayout;
71
79
  }
72
- declare const useResizable: ({ id, ref, direction, isDisabled, keyboardStep, storage, storageKey, groupProps, onLayout, ...rest }: UseResizableProps) => {
80
+ declare const useResizable: ({ id, ref, controlRef: controlRefProp, direction, isDisabled, keyboardStep, storage, storageKey, groupProps, onLayout, ...rest }: UseResizableProps) => {
81
+ controlRef: RefObject<ResizableGroupControl>;
73
82
  isDisabled: boolean;
74
83
  getContainerProps: PropGetter<"div", undefined>;
75
- getGroupProps: (props?: Partial<PanelGroupProps>) => PanelGroupProps;
84
+ getGroupProps: (props?: Partial<PanelGroupProps>) => {
85
+ "aria-disabled"?: (boolean | "false" | "true") | undefined;
86
+ slot?: string | undefined;
87
+ style?: react.CSSProperties | undefined;
88
+ title?: string | undefined;
89
+ dir?: "auto" | "ltr" | "rtl" | undefined;
90
+ defaultValue?: string | number | readonly string[] | undefined;
91
+ color?: string | undefined;
92
+ direction: react_resizable_panels_dist_declarations_src_types.Direction;
93
+ nonce?: string | undefined;
94
+ onAnimationStart?: react.AnimationEventHandler<keyof HTMLElementTagNameMap> | undefined;
95
+ onDragStart?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
96
+ onDragEnd?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
97
+ onDrag?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
98
+ defaultChecked?: boolean | undefined;
99
+ suppressContentEditableWarning?: boolean | undefined;
100
+ suppressHydrationWarning?: boolean | undefined;
101
+ accessKey?: string | undefined;
102
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
103
+ autoFocus?: boolean | undefined;
104
+ className?: string | undefined;
105
+ contentEditable?: (boolean | "false" | "true") | "inherit" | "plaintext-only" | undefined;
106
+ contextMenu?: string | undefined;
107
+ draggable?: (boolean | "false" | "true") | undefined;
108
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
109
+ hidden?: boolean | undefined;
110
+ lang?: string | undefined;
111
+ spellCheck?: (boolean | "false" | "true") | undefined;
112
+ tabIndex?: number | undefined;
113
+ translate?: "yes" | "no" | undefined;
114
+ radioGroup?: string | undefined;
115
+ role?: react.AriaRole | undefined;
116
+ about?: string | undefined;
117
+ content?: string | undefined;
118
+ datatype?: string | undefined;
119
+ inlist?: any;
120
+ prefix?: string | undefined;
121
+ property?: string | undefined;
122
+ rel?: string | undefined;
123
+ resource?: string | undefined;
124
+ rev?: string | undefined;
125
+ typeof?: string | undefined;
126
+ vocab?: string | undefined;
127
+ autoCorrect?: string | undefined;
128
+ autoSave?: string | undefined;
129
+ itemProp?: string | undefined;
130
+ itemScope?: boolean | undefined;
131
+ itemType?: string | undefined;
132
+ itemID?: string | undefined;
133
+ itemRef?: string | undefined;
134
+ results?: number | undefined;
135
+ security?: string | undefined;
136
+ unselectable?: "on" | "off" | undefined;
137
+ inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
138
+ is?: string | undefined;
139
+ "aria-activedescendant"?: string | undefined;
140
+ "aria-atomic"?: (boolean | "false" | "true") | undefined;
141
+ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
142
+ "aria-braillelabel"?: string | undefined;
143
+ "aria-brailleroledescription"?: string | undefined;
144
+ "aria-busy"?: (boolean | "false" | "true") | undefined;
145
+ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
146
+ "aria-colcount"?: number | undefined;
147
+ "aria-colindex"?: number | undefined;
148
+ "aria-colindextext"?: string | undefined;
149
+ "aria-colspan"?: number | undefined;
150
+ "aria-controls"?: string | undefined;
151
+ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
152
+ "aria-describedby"?: string | undefined;
153
+ "aria-description"?: string | undefined;
154
+ "aria-details"?: string | undefined;
155
+ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
156
+ "aria-errormessage"?: string | undefined;
157
+ "aria-expanded"?: (boolean | "false" | "true") | undefined;
158
+ "aria-flowto"?: string | undefined;
159
+ "aria-grabbed"?: (boolean | "false" | "true") | undefined;
160
+ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
161
+ "aria-hidden"?: (boolean | "false" | "true") | undefined;
162
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
163
+ "aria-keyshortcuts"?: string | undefined;
164
+ "aria-label"?: string | undefined;
165
+ "aria-labelledby"?: string | undefined;
166
+ "aria-level"?: number | undefined;
167
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
168
+ "aria-modal"?: (boolean | "false" | "true") | undefined;
169
+ "aria-multiline"?: (boolean | "false" | "true") | undefined;
170
+ "aria-multiselectable"?: (boolean | "false" | "true") | undefined;
171
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
172
+ "aria-owns"?: string | undefined;
173
+ "aria-placeholder"?: string | undefined;
174
+ "aria-posinset"?: number | undefined;
175
+ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
176
+ "aria-readonly"?: (boolean | "false" | "true") | undefined;
177
+ "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
178
+ "aria-required"?: (boolean | "false" | "true") | undefined;
179
+ "aria-roledescription"?: string | undefined;
180
+ "aria-rowcount"?: number | undefined;
181
+ "aria-rowindex"?: number | undefined;
182
+ "aria-rowindextext"?: string | undefined;
183
+ "aria-rowspan"?: number | undefined;
184
+ "aria-selected"?: (boolean | "false" | "true") | undefined;
185
+ "aria-setsize"?: number | undefined;
186
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
187
+ "aria-valuemax"?: number | undefined;
188
+ "aria-valuemin"?: number | undefined;
189
+ "aria-valuenow"?: number | undefined;
190
+ "aria-valuetext"?: string | undefined;
191
+ dangerouslySetInnerHTML?: {
192
+ __html: string | TrustedHTML;
193
+ } | undefined;
194
+ onCopy?: react.ClipboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
195
+ onCopyCapture?: react.ClipboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
196
+ onCut?: react.ClipboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
197
+ onCutCapture?: react.ClipboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
198
+ onPaste?: react.ClipboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
199
+ onPasteCapture?: react.ClipboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
200
+ onCompositionEnd?: react.CompositionEventHandler<keyof HTMLElementTagNameMap> | undefined;
201
+ onCompositionEndCapture?: react.CompositionEventHandler<keyof HTMLElementTagNameMap> | undefined;
202
+ onCompositionStart?: react.CompositionEventHandler<keyof HTMLElementTagNameMap> | undefined;
203
+ onCompositionStartCapture?: react.CompositionEventHandler<keyof HTMLElementTagNameMap> | undefined;
204
+ onCompositionUpdate?: react.CompositionEventHandler<keyof HTMLElementTagNameMap> | undefined;
205
+ onCompositionUpdateCapture?: react.CompositionEventHandler<keyof HTMLElementTagNameMap> | undefined;
206
+ onFocus?: react.FocusEventHandler<keyof HTMLElementTagNameMap> | undefined;
207
+ onFocusCapture?: react.FocusEventHandler<keyof HTMLElementTagNameMap> | undefined;
208
+ onBlur?: react.FocusEventHandler<keyof HTMLElementTagNameMap> | undefined;
209
+ onBlurCapture?: react.FocusEventHandler<keyof HTMLElementTagNameMap> | undefined;
210
+ onChange?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
211
+ onChangeCapture?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
212
+ onBeforeInput?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
213
+ onBeforeInputCapture?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
214
+ onInput?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
215
+ onInputCapture?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
216
+ onReset?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
217
+ onResetCapture?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
218
+ onSubmit?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
219
+ onSubmitCapture?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
220
+ onInvalid?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
221
+ onInvalidCapture?: react.FormEventHandler<keyof HTMLElementTagNameMap> | undefined;
222
+ onLoad?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
223
+ onLoadCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
224
+ onError?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
225
+ onErrorCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
226
+ onKeyDown?: react.KeyboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
227
+ onKeyDownCapture?: react.KeyboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
228
+ onKeyPress?: react.KeyboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
229
+ onKeyPressCapture?: react.KeyboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
230
+ onKeyUp?: react.KeyboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
231
+ onKeyUpCapture?: react.KeyboardEventHandler<keyof HTMLElementTagNameMap> | undefined;
232
+ onAbort?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
233
+ onAbortCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
234
+ onCanPlay?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
235
+ onCanPlayCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
236
+ onCanPlayThrough?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
237
+ onCanPlayThroughCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
238
+ onDurationChange?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
239
+ onDurationChangeCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
240
+ onEmptied?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
241
+ onEmptiedCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
242
+ onEncrypted?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
243
+ onEncryptedCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
244
+ onEnded?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
245
+ onEndedCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
246
+ onLoadedData?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
247
+ onLoadedDataCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
248
+ onLoadedMetadata?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
249
+ onLoadedMetadataCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
250
+ onLoadStart?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
251
+ onLoadStartCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
252
+ onPause?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
253
+ onPauseCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
254
+ onPlay?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
255
+ onPlayCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
256
+ onPlaying?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
257
+ onPlayingCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
258
+ onProgress?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
259
+ onProgressCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
260
+ onRateChange?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
261
+ onRateChangeCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
262
+ onResize?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
263
+ onResizeCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
264
+ onSeeked?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
265
+ onSeekedCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
266
+ onSeeking?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
267
+ onSeekingCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
268
+ onStalled?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
269
+ onStalledCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
270
+ onSuspend?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
271
+ onSuspendCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
272
+ onTimeUpdate?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
273
+ onTimeUpdateCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
274
+ onVolumeChange?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
275
+ onVolumeChangeCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
276
+ onWaiting?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
277
+ onWaitingCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
278
+ onAuxClick?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
279
+ onAuxClickCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
280
+ onClick?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
281
+ onClickCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
282
+ onContextMenu?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
283
+ onContextMenuCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
284
+ onDoubleClick?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
285
+ onDoubleClickCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
286
+ onDragCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
287
+ onDragEndCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
288
+ onDragEnter?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
289
+ onDragEnterCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
290
+ onDragExit?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
291
+ onDragExitCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
292
+ onDragLeave?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
293
+ onDragLeaveCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
294
+ onDragOver?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
295
+ onDragOverCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
296
+ onDragStartCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
297
+ onDrop?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
298
+ onDropCapture?: react.DragEventHandler<keyof HTMLElementTagNameMap> | undefined;
299
+ onMouseDown?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
300
+ onMouseDownCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
301
+ onMouseEnter?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
302
+ onMouseLeave?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
303
+ onMouseMove?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
304
+ onMouseMoveCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
305
+ onMouseOut?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
306
+ onMouseOutCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
307
+ onMouseOver?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
308
+ onMouseOverCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
309
+ onMouseUp?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
310
+ onMouseUpCapture?: MouseEventHandler<keyof HTMLElementTagNameMap> | undefined;
311
+ onSelect?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
312
+ onSelectCapture?: react.ReactEventHandler<keyof HTMLElementTagNameMap> | undefined;
313
+ onTouchCancel?: react.TouchEventHandler<keyof HTMLElementTagNameMap> | undefined;
314
+ onTouchCancelCapture?: react.TouchEventHandler<keyof HTMLElementTagNameMap> | undefined;
315
+ onTouchEnd?: react.TouchEventHandler<keyof HTMLElementTagNameMap> | undefined;
316
+ onTouchEndCapture?: react.TouchEventHandler<keyof HTMLElementTagNameMap> | undefined;
317
+ onTouchMove?: react.TouchEventHandler<keyof HTMLElementTagNameMap> | undefined;
318
+ onTouchMoveCapture?: react.TouchEventHandler<keyof HTMLElementTagNameMap> | undefined;
319
+ onTouchStart?: react.TouchEventHandler<keyof HTMLElementTagNameMap> | undefined;
320
+ onTouchStartCapture?: react.TouchEventHandler<keyof HTMLElementTagNameMap> | undefined;
321
+ onPointerDown?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
322
+ onPointerDownCapture?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
323
+ onPointerMove?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
324
+ onPointerMoveCapture?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
325
+ onPointerUp?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
326
+ onPointerUpCapture?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
327
+ onPointerCancel?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
328
+ onPointerCancelCapture?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
329
+ onPointerEnter?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
330
+ onPointerLeave?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
331
+ onPointerOver?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
332
+ onPointerOverCapture?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
333
+ onPointerOut?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
334
+ onPointerOutCapture?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
335
+ onGotPointerCapture?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
336
+ onGotPointerCaptureCapture?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
337
+ onLostPointerCapture?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
338
+ onLostPointerCaptureCapture?: react.PointerEventHandler<keyof HTMLElementTagNameMap> | undefined;
339
+ onScroll?: react.UIEventHandler<keyof HTMLElementTagNameMap> | undefined;
340
+ onScrollCapture?: react.UIEventHandler<keyof HTMLElementTagNameMap> | undefined;
341
+ onWheel?: react.WheelEventHandler<keyof HTMLElementTagNameMap> | undefined;
342
+ onWheelCapture?: react.WheelEventHandler<keyof HTMLElementTagNameMap> | undefined;
343
+ onAnimationStartCapture?: react.AnimationEventHandler<keyof HTMLElementTagNameMap> | undefined;
344
+ onAnimationEnd?: react.AnimationEventHandler<keyof HTMLElementTagNameMap> | undefined;
345
+ onAnimationEndCapture?: react.AnimationEventHandler<keyof HTMLElementTagNameMap> | undefined;
346
+ onAnimationIteration?: react.AnimationEventHandler<keyof HTMLElementTagNameMap> | undefined;
347
+ onAnimationIterationCapture?: react.AnimationEventHandler<keyof HTMLElementTagNameMap> | undefined;
348
+ onTransitionEnd?: react.TransitionEventHandler<keyof HTMLElementTagNameMap> | undefined;
349
+ onTransitionEndCapture?: react.TransitionEventHandler<keyof HTMLElementTagNameMap> | undefined;
350
+ autoSaveId: string | null;
351
+ keyboardResizeBy: number | null;
352
+ onLayout: PanelGroupOnLayout | null;
353
+ storage: PanelGroupStorage;
354
+ id: string;
355
+ ref: (node: ResizableGroupControl | null) => void;
356
+ tagName: keyof HTMLElementTagNameMap | undefined;
357
+ children?: react.ReactNode | undefined;
358
+ };
76
359
  };
77
360
  type UseResizableReturn = ReturnType<typeof useResizable>;
78
361
  interface UseResizableItemOptions {
@@ -160,10 +443,10 @@ interface UseResizableTriggerOptions {
160
443
  }
161
444
  interface UseResizableTriggerProps extends Merge<ResizableTriggerProps, Omit<HTMLUIPropsWithoutAs, "id" | "onBlur" | "onFocus">>, UseResizableTriggerOptions {
162
445
  }
163
- declare const useResizableTrigger: ({ id, ref, as, disabled, isDisabled, onDragging, ...rest }: UseResizableTriggerProps) => {
446
+ declare const useResizableTrigger: ({ id, ref, as, disabled, isDisabled, ...rest }: UseResizableTriggerProps) => {
164
447
  getIconProps: PropGetter<"div", undefined>;
165
448
  getTriggerProps: PropGetter<PanelResizeHandleProps, PanelResizeHandleProps>;
166
449
  };
167
450
  type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>;
168
451
 
169
- export { type As, type ResizableItemControl, ResizableProvider, type ResizableStorage, type UseResizableItemProps, type UseResizableItemReturn, type UseResizableProps, type UseResizableReturn, type UseResizableTriggerProps, type UseResizableTriggerReturn, useResizable, useResizableContext, useResizableItem, useResizableTrigger };
452
+ export { type As, type ResizableGroupControl, type ResizableItemControl, ResizableProvider, type ResizableStorage, type UseResizableItemProps, type UseResizableItemReturn, type UseResizableProps, type UseResizableReturn, type UseResizableTriggerProps, type UseResizableTriggerReturn, useResizable, useResizableContext, useResizableItem, useResizableTrigger };
@@ -38,6 +38,7 @@ var [ResizableProvider, useResizableContext] = (0, import_utils.createContext)({
38
38
  var useResizable = ({
39
39
  id,
40
40
  ref,
41
+ controlRef: controlRefProp,
41
42
  direction = "horizontal",
42
43
  isDisabled = false,
43
44
  keyboardStep,
@@ -47,6 +48,7 @@ var useResizable = ({
47
48
  onLayout,
48
49
  ...rest
49
50
  }) => {
51
+ const controlRef = (0, import_react.useRef)(null);
50
52
  const uuid = (0, import_react.useId)();
51
53
  id != null ? id : id = uuid;
52
54
  const getContainerProps = (0, import_react.useCallback)(
@@ -59,6 +61,7 @@ var useResizable = ({
59
61
  return {
60
62
  ...props,
61
63
  id,
64
+ ref: (0, import_utils.mergeRefs)(controlRefProp, controlRef),
62
65
  autoSaveId: storageKey,
63
66
  direction,
64
67
  keyboardResizeBy: keyboardStep,
@@ -68,7 +71,16 @@ var useResizable = ({
68
71
  ...rest2
69
72
  };
70
73
  },
71
- [id, direction, groupProps, storageKey, keyboardStep, onLayout, storage]
74
+ [
75
+ id,
76
+ direction,
77
+ groupProps,
78
+ controlRefProp,
79
+ storageKey,
80
+ keyboardStep,
81
+ onLayout,
82
+ storage
83
+ ]
72
84
  );
73
85
  (0, import_react.useEffect)(() => {
74
86
  if (!id) return;
@@ -76,6 +88,7 @@ var useResizable = ({
76
88
  if ((0, import_utils.isRefObject)(ref)) ref.current = el;
77
89
  }, [ref, id]);
78
90
  return {
91
+ controlRef,
79
92
  isDisabled,
80
93
  getContainerProps,
81
94
  getGroupProps
@@ -116,7 +129,6 @@ var useResizableItem = ({
116
129
  onCollapse,
117
130
  onExpand,
118
131
  onResize,
119
- ...collapsible ? { "aria-labelledby": id } : { "aria-label": id },
120
132
  ...rest
121
133
  };
122
134
  },
@@ -155,30 +167,49 @@ var useResizableTrigger = ({
155
167
  as,
156
168
  disabled,
157
169
  isDisabled,
158
- onDragging,
159
170
  ...rest
160
171
  }) => {
161
172
  const uuid = (0, import_react.useId)();
162
173
  id != null ? id : id = uuid;
163
- const { isDisabled: isGroupDisabled } = useResizableContext();
174
+ const { controlRef, isDisabled: isGroupDisabled } = useResizableContext();
164
175
  const [isActive, setIsActive] = (0, import_react.useState)(false);
165
176
  const trulyDisabled = disabled || isDisabled || isGroupDisabled;
177
+ const onDoubleClick = (0, import_react.useCallback)(
178
+ (ev) => {
179
+ var _a, _b;
180
+ ev.preventDefault();
181
+ const layout = (_a = controlRef.current) == null ? void 0 : _a.getLayout();
182
+ if (!layout) return;
183
+ const count = layout.length;
184
+ const size = 100 / count;
185
+ const nextLayout = layout.map(() => size);
186
+ (_b = controlRef.current) == null ? void 0 : _b.setLayout(nextLayout);
187
+ },
188
+ [controlRef]
189
+ );
166
190
  const getTriggerProps = (0, import_react.useCallback)(
167
191
  (props = {}) => ({
168
192
  ...props,
169
193
  id,
170
194
  disabled: trulyDisabled,
171
195
  tagName: as,
172
- onDragging: (0, import_utils.handlerAll)(onDragging, (isActive2) => setIsActive(isActive2)),
173
196
  ...rest,
174
197
  style: {
175
198
  ...props.style,
176
199
  ...rest.style,
177
200
  ...trulyDisabled ? { cursor: "default" } : {}
178
201
  },
179
- "data-active": (0, import_utils.dataAttr)(isActive)
202
+ "data-active": (0, import_utils.dataAttr)(isActive),
203
+ onDoubleClick: (0, import_utils.handlerAll)(
204
+ rest.onDoubleClick,
205
+ onDoubleClick
206
+ ),
207
+ onDragging: (0, import_utils.handlerAll)(
208
+ rest.onDragging,
209
+ (isActive2) => setIsActive(isActive2)
210
+ )
180
211
  }),
181
- [id, as, trulyDisabled, onDragging, rest, isActive]
212
+ [id, as, trulyDisabled, rest, onDoubleClick, isActive]
182
213
  );
183
214
  const getIconProps = (0, import_react.useCallback)(
184
215
  (props = {}, ref2 = null) => ({
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-resizable.ts"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport type {\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: \"horizontal\" | \"vertical\"\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}): PanelGroupProps => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [id, direction, groupProps, storageKey, keyboardStep, onLayout, storage],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...(collapsible ? { \"aria-labelledby\": id } : { \"aria-label\": id }),\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n disabled: trulyDisabled,\n tagName: as,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(isActive),\n }) as PanelResizeHandleProps,\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,mBAKO;AACP,mBAAwD;AACxD,oCAIO;AAyBA,IAAM,CAAC,mBAAmB,mBAAmB,QAClD,4BAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA8CI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,WAAO,oBAAM;AAEnB,yBAAO;AAEP,QAAM,wBAAgC;AAAA,IACpC,CAAC,QAAQ,CAAC,GAAGA,OAAM,UAAU,EAAE,GAAG,OAAO,KAAAA,MAAK,GAAG,KAAK;AAAA,IACtD,CAAC,IAAI;AAAA,EACP;AAEA,QAAM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AAM,mBAA2B;AAAA,IAC/B,CAAC,QAAQ,CAAC,GAAGF,OAAM,UAAU;AAAA,MAC3B,GAAG;AAAA,MACH,KAAAA;AAAA,MACA,mBAAe,uBAAS,QAAQ;AAAA,IAClC;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC,GAAI;AAET,UAAM,SAAK,sDAAuB,EAAE;AAEpC,YAAI,0BAAY,GAAG,EAAG,KAAI,UAAU;AAAA,EACtC,GAAG,CAAC,KAAK,EAAE,CAAC;AAEZ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["ref","rest","isActive"]}
1
+ {"version":3,"sources":["../src/use-resizable.ts"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ForwardedRef,\n MouseEvent,\n MouseEventHandler,\n RefObject,\n} from \"react\"\nimport type {\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n mergeRefs,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableGroupControl extends ImperativePanelGroupHandle {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n controlRef: RefObject<ResizableGroupControl>\n isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableGroupControl>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: \"horizontal\" | \"vertical\"\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n controlRef: controlRefProp,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const controlRef = useRef<ResizableGroupControl>(null)\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}) => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n ref: mergeRefs(controlRefProp, controlRef),\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [\n id,\n direction,\n groupProps,\n controlRefProp,\n storageKey,\n keyboardStep,\n onLayout,\n storage,\n ],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n controlRef,\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const { controlRef, isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const onDoubleClick = useCallback(\n (ev: MouseEvent<HTMLDivElement>) => {\n ev.preventDefault()\n\n const layout = controlRef.current?.getLayout()\n\n if (!layout) return\n\n const count = layout.length\n const size = 100 / count\n const nextLayout = layout.map(() => size)\n\n controlRef.current?.setLayout(nextLayout)\n },\n [controlRef],\n )\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n disabled: trulyDisabled,\n tagName: as,\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(isActive),\n onDoubleClick: handlerAll(\n rest.onDoubleClick as MouseEventHandler<keyof typeof as>,\n onDoubleClick,\n ),\n onDragging: handlerAll(rest.onDragging, (isActive) =>\n setIsActive(isActive),\n ),\n }) as PanelResizeHandleProps,\n [id, as, trulyDisabled, rest, onDoubleClick, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBA,mBAMO;AACP,mBAAgE;AAChE,oCAIO;AA2BA,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;A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AA,IAChC;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AAEA,QAAM,sBAGF;AAAA,IACF,CAAC,QAAQ,CAAC,OACP;AAAA,MACC,GAAG;AAAA,MACH;AAAA,MACA,UAAU;AAAA,MACV,SAAS;AAAA,MACT,GAAG;AAAA,MACH,OAAO;AAAA,QACL,GAAG,MAAM;AAAA,QACT,GAAG,KAAK;AAAA,QACR,GAAI,gBAAgB,EAAE,QAAQ,UAAU,IAAI,CAAC;AAAA,MAC/C;AAAA,MACA,mBAAe,uBAAS,QAAQ;AAAA,MAChC,mBAAe;AAAA,QACb,KAAK;AAAA,QACL;AAAA,MACF;AAAA,MACA,gBAAY;AAAA,QAAW,KAAK;AAAA,QAAY,CAACE,cACvC,YAAYA,SAAQ;AAAA,MACtB;AAAA,IACF;AAAA,IACF,CAAC,IAAI,IAAI,eAAe,MAAM,eAAe,QAAQ;AAAA,EACvD;AAEA,QAAM,mBAA2B;AAAA,IAC/B,CAAC,QAAQ,CAAC,GAAGF,OAAM,UAAU;AAAA,MAC3B,GAAG;AAAA,MACH,KAAAA;AAAA,MACA,mBAAe,uBAAS,QAAQ;AAAA,IAClC;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,8BAAU,MAAM;AACd,QAAI,CAAC,GAAI;AAET,UAAM,SAAK,sDAAuB,EAAE;AAEpC,YAAI,0BAAY,GAAG,EAAG,KAAI,UAAU;AAAA,EACtC,GAAG,CAAC,KAAK,EAAE,CAAC;AAEZ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":["ref","rest","isActive"]}
@@ -5,7 +5,7 @@ import {
5
5
  useResizableContext,
6
6
  useResizableItem,
7
7
  useResizableTrigger
8
- } from "./chunk-HAROVF4B.mjs";
8
+ } from "./chunk-WCMBVV3R.mjs";
9
9
  export {
10
10
  ResizableProvider,
11
11
  useResizable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/resizable",
3
- "version": "1.1.18",
3
+ "version": "1.2.0-dev-20241114143508",
4
4
  "description": "Yamada UI resizable component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "react-resizable-panels": "^2.1.6",
40
- "@yamada-ui/core": "1.15.5",
41
40
  "@yamada-ui/icon": "1.1.12",
41
+ "@yamada-ui/core": "1.15.5",
42
42
  "@yamada-ui/utils": "1.5.4"
43
43
  },
44
44
  "devDependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/use-resizable.ts"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n HTMLUIPropsWithoutAs,\n PropGetter,\n} from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type { ForwardedRef, RefObject } from \"react\"\nimport type {\n ImperativePanelHandle,\n PanelGroupOnLayout,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandleProps,\n} from \"react-resizable-panels\"\nimport {\n createContext,\n dataAttr,\n handlerAll,\n isRefObject,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useState } from \"react\"\nimport {\n getPanelElement,\n getPanelGroupElement,\n getResizeHandleElement,\n} from \"react-resizable-panels\"\n\nexport type As = keyof HTMLElementTagNameMap\n\ninterface ResizableGroupProps\n extends Omit<Partial<PanelGroupProps>, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableItemProps\n extends Omit<PanelProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\ninterface ResizableTriggerProps\n extends Omit<PanelResizeHandleProps, \"children\" | \"id\" | \"tagName\"> {\n as?: As\n}\n\nexport interface ResizableStorage extends PanelGroupStorage {}\nexport interface ResizableItemControl extends ImperativePanelHandle {}\n\ninterface ResizableContext {\n isDisabled: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ResizableProvider, useResizableContext] =\n createContext<ResizableContext>({\n name: \"ResizableContext\",\n errorMessage: `useResizableContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Resizable />\"`,\n })\n\nexport interface UseResizableProps {\n /**\n * id assigned to resizable element.\n */\n id?: string\n /**\n * Ref for resizable element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The direction of the resizable.\n *\n * @default \"horizontal\"\n */\n direction?: \"horizontal\" | \"vertical\"\n /**\n * If `true`, the resizable trigger will be disabled.\n */\n isDisabled?: boolean\n /**\n * Unit to resize by keyboard operation.\n *\n * @default 10\n */\n keyboardStep?: number\n /**\n * A callback that gets and sets a value in custom storage.\n */\n storage?: PanelGroupStorage\n /**\n * Key of value saved in storage.\n * By default, it is saved to `local storage`.\n */\n storageKey?: string\n /**\n * Props for resizable component.\n */\n groupProps?: ResizableGroupProps\n /**\n * The callback invoked when resizable items are resized.\n */\n onLayout?: PanelGroupOnLayout\n}\n\nexport const useResizable = ({\n id,\n ref,\n direction = \"horizontal\",\n isDisabled = false,\n keyboardStep,\n storage,\n storageKey,\n groupProps,\n onLayout,\n ...rest\n}: UseResizableProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...rest }),\n [rest],\n )\n\n const getGroupProps = useCallback(\n (props: Partial<PanelGroupProps> = {}): PanelGroupProps => {\n const { as, ...rest } = groupProps ?? {}\n\n return {\n ...props,\n id,\n autoSaveId: storageKey,\n direction,\n keyboardResizeBy: keyboardStep,\n storage,\n tagName: as,\n onLayout,\n ...rest,\n }\n },\n [id, direction, groupProps, storageKey, keyboardStep, onLayout, storage],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelGroupElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n isDisabled,\n getContainerProps,\n getGroupProps,\n }\n}\n\nexport type UseResizableReturn = ReturnType<typeof useResizable>\n\ninterface UseResizableItemOptions {\n /**\n * id assigned to resizable item element.\n */\n id?: string\n /**\n * Ref for resizable item element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * The collapsed size of the resizable item.\n */\n collapsedSize?: number\n /**\n * If `true`, the resizable item can be collapsed.\n *\n * @default false\n */\n collapsible?: boolean\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<ResizableItemControl>\n /**\n * The initial size of the resizable item.\n */\n defaultSize?: number\n /**\n * The maximum allowed value of the resizable item.\n */\n maxSize?: number\n /**\n * The minimum allowed value of the resizable item.\n */\n minSize?: number\n /**\n * Order for the resizable item.\n */\n order?: number\n /**\n * Props for resizable item container element.\n */\n containerProps?: Omit<HTMLUIProps, \"as\"> & ResizableItemProps\n /**\n * The callback invoked when resizable item are collapsed.\n */\n onCollapse?: () => void\n /**\n * The callback invoked when resizable item are expanded.\n */\n onExpand?: () => void\n /**\n * The callback invoked when resizable item are resized.\n */\n onResize?: (size: number, prevSize: number | undefined) => void\n}\n\nexport interface UseResizableItemProps\n extends Omit<HTMLUIProps, keyof UseResizableItemOptions>,\n UseResizableItemOptions {}\n\nexport const useResizableItem = ({\n id,\n ref,\n collapsedSize,\n collapsible,\n controlRef,\n defaultSize,\n maxSize,\n minSize,\n order,\n containerProps,\n onCollapse,\n onExpand,\n onResize,\n ...innerProps\n}: UseResizableItemProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const getPanelProps: PropGetter<\n Merge<HTMLUIProps, PanelProps>,\n PanelProps\n > = useCallback(\n (props = {}) => {\n const { as, ...rest } = containerProps ?? {}\n\n return {\n ...props,\n id,\n ref: controlRef,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n order,\n tagName: as,\n onCollapse,\n onExpand,\n onResize,\n ...(collapsible ? { \"aria-labelledby\": id } : { \"aria-label\": id }),\n ...rest,\n }\n },\n [\n id,\n controlRef,\n containerProps,\n collapsedSize,\n collapsible,\n defaultSize,\n maxSize,\n minSize,\n onCollapse,\n onExpand,\n onResize,\n order,\n ],\n )\n\n const getItemProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({ ...props, ref, ...innerProps }),\n [innerProps],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getPanelElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getItemProps,\n getPanelProps,\n }\n}\n\nexport type UseResizableItemReturn = ReturnType<typeof useResizableItem>\n\ninterface UseResizableTriggerOptions {\n /**\n * id assigned to resizable trigger element.\n */\n id?: string\n /**\n * Ref for resizable trigger element.\n */\n ref?: ForwardedRef<HTMLElement>\n /**\n * If `true`, the resizable trigger will be disabled.\n *\n * @default false\n */\n isDisabled?: boolean\n /**\n * The callback invoked when resizable trigger are dragged.\n */\n onDragging?: (isDragging: boolean) => void\n}\n\nexport interface UseResizableTriggerProps\n extends Merge<\n ResizableTriggerProps,\n Omit<HTMLUIPropsWithoutAs, \"id\" | \"onBlur\" | \"onFocus\">\n >,\n UseResizableTriggerOptions {}\n\nexport const useResizableTrigger = ({\n id,\n ref,\n as,\n disabled,\n isDisabled,\n onDragging,\n ...rest\n}: UseResizableTriggerProps) => {\n const uuid = useId()\n\n id ??= uuid\n\n const { isDisabled: isGroupDisabled } = useResizableContext()\n const [isActive, setIsActive] = useState<boolean>(false)\n\n const trulyDisabled = disabled || isDisabled || isGroupDisabled\n\n const getTriggerProps: PropGetter<\n PanelResizeHandleProps,\n PanelResizeHandleProps\n > = useCallback(\n (props = {}) =>\n ({\n ...props,\n id,\n disabled: trulyDisabled,\n tagName: as,\n onDragging: handlerAll(onDragging, (isActive) => setIsActive(isActive)),\n ...rest,\n style: {\n ...props.style,\n ...rest.style,\n ...(trulyDisabled ? { cursor: \"default\" } : {}),\n },\n \"data-active\": dataAttr(isActive),\n }) as PanelResizeHandleProps,\n [id, as, trulyDisabled, onDragging, rest, isActive],\n )\n\n const getIconProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n \"data-active\": dataAttr(isActive),\n }),\n [isActive],\n )\n\n useEffect(() => {\n if (!id) return\n\n const el = getResizeHandleElement(id)\n\n if (isRefObject(ref)) ref.current = el\n }, [ref, id])\n\n return {\n getIconProps,\n getTriggerProps,\n }\n}\n\nexport type UseResizableTriggerReturn = ReturnType<typeof useResizableTrigger>\n"],"mappings":";;;AAgBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,WAAW,OAAO,gBAAgB;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAyBA,IAAM,CAAC,mBAAmB,mBAAmB,IAClD,cAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA8CI,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,OAAO,MAAM;AAEnB,yBAAO;AAEP,QAAM,oBAAgC;AAAA,IACpC,CAAC,QAAQ,CAAC,GAAGA,OAAM,UAAU,EAAE,GAAG,OAAO,KAAAA,MAAK,GAAG,KAAK;AAAA,IACtD,CAAC,IAAI;AAAA,EACP;AAEA,QAAM,gBAAgB;AAAA,IACpB,CAAC,QAAkC,CAAC,MAAuB;AACzD,YAAM,EAAE,IAAI,GAAGC,MAAK,IAAI,kCAAc,CAAC;AAEvC,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QACA,YAAY;AAAA,QACZ;AAAA,QACA,kBAAkB;AAAA,QAClB;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA,GAAGA;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,IAAI,WAAW,YAAY,YAAY,cAAc,UAAU,OAAO;AAAA,EACzE;AAEA,YAAU,MAAM;AACd,QAAI,CAAC,GAAI;AAET,UAAM,KAAK,qBAAqB,EAAE;AAElC,QAAI,YAAY,GAAG,EAAG,KAAI,UAAU;AAAA,EACtC,GAAG,CAAC,KAAK,EA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