@womp/kookie-ui 0.29.1 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/components.css +94 -2
  2. package/dist/cjs/components/_internal/navigator-host.d.ts +21 -0
  3. package/dist/cjs/components/_internal/navigator-host.d.ts.map +1 -0
  4. package/dist/cjs/components/_internal/navigator-host.js +3 -0
  5. package/dist/cjs/components/_internal/navigator-host.js.map +7 -0
  6. package/dist/cjs/components/combobox.js +1 -1
  7. package/dist/cjs/components/combobox.js.map +4 -4
  8. package/dist/cjs/components/dialog.d.ts.map +1 -1
  9. package/dist/cjs/components/dialog.js +1 -1
  10. package/dist/cjs/components/dialog.js.map +4 -4
  11. package/dist/cjs/components/index.d.ts +1 -0
  12. package/dist/cjs/components/index.d.ts.map +1 -1
  13. package/dist/cjs/components/index.js +2 -2
  14. package/dist/cjs/components/index.js.map +4 -4
  15. package/dist/cjs/components/navigator.d.ts +99 -0
  16. package/dist/cjs/components/navigator.d.ts.map +1 -0
  17. package/dist/cjs/components/navigator.js +3 -0
  18. package/dist/cjs/components/navigator.js.map +7 -0
  19. package/dist/cjs/components/popover.d.ts.map +1 -1
  20. package/dist/cjs/components/popover.js +1 -1
  21. package/dist/cjs/components/popover.js.map +4 -4
  22. package/dist/cjs/components/select.d.ts.map +1 -1
  23. package/dist/cjs/components/select.js +1 -1
  24. package/dist/cjs/components/select.js.map +3 -3
  25. package/dist/cjs/components/sheet.d.ts.map +1 -1
  26. package/dist/cjs/components/sheet.js +1 -1
  27. package/dist/cjs/components/sheet.js.map +4 -4
  28. package/dist/cjs/components/sidebar.js +1 -1
  29. package/dist/cjs/components/sidebar.js.map +4 -4
  30. package/dist/cjs/components/text-field.d.ts.map +1 -1
  31. package/dist/cjs/components/text-field.js +2 -2
  32. package/dist/cjs/components/text-field.js.map +3 -3
  33. package/dist/cjs/components/text-field.props.d.ts +4 -1
  34. package/dist/cjs/components/text-field.props.d.ts.map +1 -1
  35. package/dist/cjs/components/text-field.props.js.map +1 -1
  36. package/dist/cjs/index.js +5 -5
  37. package/dist/cjs/index.js.map +4 -4
  38. package/dist/cjs/props/index.js.map +1 -1
  39. package/dist/esm/chunk-4KBKS3ZE.js +3 -0
  40. package/dist/esm/chunk-4KBKS3ZE.js.map +7 -0
  41. package/dist/esm/chunk-5KX3RA3P.js +3 -0
  42. package/dist/esm/chunk-5KX3RA3P.js.map +7 -0
  43. package/dist/esm/chunk-676Y7ZUT.js +3 -0
  44. package/dist/esm/chunk-676Y7ZUT.js.map +7 -0
  45. package/dist/esm/chunk-6UFIS6B2.js +3 -0
  46. package/dist/esm/chunk-6UFIS6B2.js.map +7 -0
  47. package/dist/esm/chunk-CMHKCUHP.js +3 -0
  48. package/dist/esm/chunk-CMHKCUHP.js.map +7 -0
  49. package/dist/esm/{chunk-4LV37PHM.js → chunk-D74WY6UO.js} +2 -2
  50. package/dist/esm/chunk-E4KT72IB.js +2 -0
  51. package/dist/esm/chunk-EQE6QQXM.js +3 -0
  52. package/dist/esm/chunk-EQE6QQXM.js.map +7 -0
  53. package/dist/esm/{chunk-FIMFM25N.js → chunk-EXF5SF27.js} +1 -1
  54. package/dist/esm/{chunk-FIMFM25N.js.map → chunk-EXF5SF27.js.map} +1 -1
  55. package/dist/esm/{chunk-2E57H3NH.js → chunk-FRFVGYGX.js} +2 -2
  56. package/dist/esm/chunk-K5V53KTJ.js +6 -0
  57. package/dist/esm/chunk-K5V53KTJ.js.map +7 -0
  58. package/dist/esm/{chunk-2FYUM6TA.js → chunk-NEKIU24N.js} +2 -2
  59. package/dist/esm/{chunk-WAXRIARV.js → chunk-R4UKO4UK.js} +2 -2
  60. package/dist/esm/{chunk-AS2STDGA.js → chunk-VGJALIJ5.js} +2 -2
  61. package/dist/esm/{chunk-JTMLFTNZ.js → chunk-WAE4MLBN.js} +2 -2
  62. package/dist/esm/{chunk-MJROOEPE.js → chunk-YMRN5ESN.js} +2 -2
  63. package/dist/esm/{chunk-324VC67W.js → chunk-ZYQEFENG.js} +2 -2
  64. package/dist/esm/components/_internal/base-menu.utils.js +1 -1
  65. package/dist/esm/components/_internal/menu-context.js +1 -1
  66. package/dist/esm/components/_internal/navigator-host.d.ts +21 -0
  67. package/dist/esm/components/_internal/navigator-host.d.ts.map +1 -0
  68. package/dist/esm/components/_internal/navigator-host.js +3 -0
  69. package/dist/esm/components/_internal/navigator-host.js.map +7 -0
  70. package/dist/esm/components/_internal/pane-chrome.js +1 -1
  71. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  72. package/dist/esm/components/alert-dialog.js +1 -1
  73. package/dist/esm/components/combobox.js +1 -1
  74. package/dist/esm/components/context-menu.js +1 -1
  75. package/dist/esm/components/dialog.d.ts.map +1 -1
  76. package/dist/esm/components/dialog.js +1 -1
  77. package/dist/esm/components/dropdown-menu.js +1 -1
  78. package/dist/esm/components/index.d.ts +1 -0
  79. package/dist/esm/components/index.d.ts.map +1 -1
  80. package/dist/esm/components/index.js +1 -1
  81. package/dist/esm/components/navigator.d.ts +99 -0
  82. package/dist/esm/components/navigator.d.ts.map +1 -0
  83. package/dist/esm/components/navigator.js +3 -0
  84. package/dist/esm/components/navigator.js.map +7 -0
  85. package/dist/esm/components/popover.d.ts.map +1 -1
  86. package/dist/esm/components/popover.js +1 -1
  87. package/dist/esm/components/schemas/index.js +1 -1
  88. package/dist/esm/components/select.d.ts.map +1 -1
  89. package/dist/esm/components/select.js +1 -1
  90. package/dist/esm/components/separator.js +1 -1
  91. package/dist/esm/components/sheet.d.ts.map +1 -1
  92. package/dist/esm/components/sheet.js +1 -1
  93. package/dist/esm/components/shell.js +1 -1
  94. package/dist/esm/components/sidebar.js +1 -1
  95. package/dist/esm/components/text-field.d.ts.map +1 -1
  96. package/dist/esm/components/text-field.js +1 -1
  97. package/dist/esm/components/text-field.props.d.ts +4 -1
  98. package/dist/esm/components/text-field.props.d.ts.map +1 -1
  99. package/dist/esm/components/text-field.props.js +1 -1
  100. package/dist/esm/components/toolbar.js +1 -1
  101. package/dist/esm/components/virtual-menu.js +1 -1
  102. package/dist/esm/hooks/index.js +1 -1
  103. package/dist/esm/index.js +1 -1
  104. package/dist/esm/props/index.js +1 -1
  105. package/package.json +1 -1
  106. package/src/components/_internal/navigator-host.ts +17 -0
  107. package/src/components/dialog.tsx +8 -0
  108. package/src/components/index.css +1 -0
  109. package/src/components/index.tsx +14 -0
  110. package/src/components/navigator.css +85 -0
  111. package/src/components/navigator.tsx +385 -0
  112. package/src/components/popover.tsx +18 -1
  113. package/src/components/select.css +2 -2
  114. package/src/components/select.tsx +15 -1
  115. package/src/components/sheet.tsx +8 -0
  116. package/src/components/text-field.css +8 -1
  117. package/src/components/text-field.props.tsx +4 -1
  118. package/src/components/text-field.tsx +66 -86
  119. package/styles.css +94 -2
  120. package/dist/esm/chunk-5BX2YZV6.js +0 -3
  121. package/dist/esm/chunk-5BX2YZV6.js.map +0 -7
  122. package/dist/esm/chunk-GPZHRZBE.js +0 -6
  123. package/dist/esm/chunk-GPZHRZBE.js.map +0 -7
  124. package/dist/esm/chunk-HR2VHGJ5.js +0 -3
  125. package/dist/esm/chunk-HR2VHGJ5.js.map +0 -7
  126. package/dist/esm/chunk-MJKVVGGV.js +0 -3
  127. package/dist/esm/chunk-MJKVVGGV.js.map +0 -7
  128. package/dist/esm/chunk-NG54K6FL.js +0 -2
  129. package/dist/esm/chunk-VQDCHBZR.js +0 -3
  130. package/dist/esm/chunk-VQDCHBZR.js.map +0 -7
  131. /package/dist/esm/{chunk-4LV37PHM.js.map → chunk-D74WY6UO.js.map} +0 -0
  132. /package/dist/esm/{chunk-NG54K6FL.js.map → chunk-E4KT72IB.js.map} +0 -0
  133. /package/dist/esm/{chunk-2E57H3NH.js.map → chunk-FRFVGYGX.js.map} +0 -0
  134. /package/dist/esm/{chunk-2FYUM6TA.js.map → chunk-NEKIU24N.js.map} +0 -0
  135. /package/dist/esm/{chunk-WAXRIARV.js.map → chunk-R4UKO4UK.js.map} +0 -0
  136. /package/dist/esm/{chunk-AS2STDGA.js.map → chunk-VGJALIJ5.js.map} +0 -0
  137. /package/dist/esm/{chunk-JTMLFTNZ.js.map → chunk-WAE4MLBN.js.map} +0 -0
  138. /package/dist/esm/{chunk-MJROOEPE.js.map → chunk-YMRN5ESN.js.map} +0 -0
  139. /package/dist/esm/{chunk-324VC67W.js.map → chunk-ZYQEFENG.js.map} +0 -0
@@ -23,8 +23,14 @@ type TextFieldRootOwnProps = GetPropDefTypes<typeof textFieldRootPropDefs> & {
23
23
  type TextFieldInputProps = ComponentPropsWithout<'input', NotInputTextualAttributes | 'color' | 'defaultValue' | 'size' | 'type' | 'value'>;
24
24
  interface TextFieldRootProps extends TextFieldInputProps, TextFieldRootOwnProps {}
25
25
 
26
- // Each Slot registers its id here, so the input can list slot content in aria-describedby.
27
- type TextFieldContextValue = { registerSlot: (id: string) => () => void };
26
+ // Each Slot registers its id here, so the input can list slot content in aria-describedby. A scrub
27
+ // slot also registers its arrow-key step, and reads whether the field takes input at all.
28
+ type ScrubKeyHandler = (direction: 1 | -1, shiftKey: boolean, altKey: boolean) => void;
29
+ type TextFieldContextValue = {
30
+ registerSlot: (id: string) => () => void;
31
+ registerScrub: (handler: ScrubKeyHandler) => () => void;
32
+ inert: boolean;
33
+ };
28
34
  const TextFieldContext = React.createContext<TextFieldContextValue | null>(null);
29
35
 
30
36
  // Clicking anything a person could mean to press keeps its own press: the guard is a focusability
@@ -64,7 +70,16 @@ const TextFieldRoot = React.forwardRef<TextFieldRootElement, TextFieldRootProps>
64
70
  setSlotIds((prev) => (prev.includes(id) ? prev : [...prev, id]));
65
71
  return () => setSlotIds((prev) => prev.filter((slotId) => slotId !== id));
66
72
  }, []);
67
- const contextValue = React.useMemo(() => ({ registerSlot }), [registerSlot]);
73
+ const scrubKeyRef = React.useRef<ScrubKeyHandler | null>(null);
74
+ const registerScrub = React.useCallback((handler: ScrubKeyHandler) => {
75
+ scrubKeyRef.current = handler;
76
+ return () => {
77
+ if (scrubKeyRef.current === handler) scrubKeyRef.current = null;
78
+ };
79
+ }, []);
80
+ // A disabled or read-only field takes no input, so its slot does not scrub or step either.
81
+ const inert = Boolean(inputProps.disabled || inputProps.readOnly);
82
+ const contextValue = React.useMemo(() => ({ registerSlot, registerScrub, inert }), [registerSlot, registerScrub, inert]);
68
83
 
69
84
  const { 'aria-describedby': ariaDescribedby, 'aria-labelledby': ariaLabelledby, 'aria-invalid': ariaInvalid } = inputProps;
70
85
 
@@ -91,7 +106,16 @@ const TextFieldRoot = React.forwardRef<TextFieldRootElement, TextFieldRootProps>
91
106
  );
92
107
 
93
108
  // Filter out our custom props to avoid DOM warnings
94
- const { error, errorMessage, required, 'aria-describedby': _ariaDescribedby, 'aria-labelledby': _ariaLabelledby, ...nativeInputProps } = inputProps;
109
+ const { error, errorMessage, required, 'aria-describedby': _ariaDescribedby, 'aria-labelledby': _ariaLabelledby, onKeyDown, ...nativeInputProps } = inputProps;
110
+
111
+ // With a scrub slot, Up and Down step the value at once, by the slot's step, with the same Shift
112
+ // and Option multipliers as a drag. The caller's handler runs first and can prevent it.
113
+ const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
114
+ const step = scrubKeyRef.current;
115
+ if (!step || inert || (event.key !== 'ArrowUp' && event.key !== 'ArrowDown')) return;
116
+ event.preventDefault();
117
+ step(event.key === 'ArrowUp' ? 1 : -1, event.shiftKey, event.altKey);
118
+ };
95
119
 
96
120
  // Clicking the padding or a passive slot focuses the input. preventDefault stops the browser
97
121
  // from moving focus to the root first, so the input is focused once, synchronously.
@@ -132,7 +156,14 @@ const TextFieldRoot = React.forwardRef<TextFieldRootElement, TextFieldRootProps>
132
156
  })}
133
157
  onMouseDown={handleMouseDown}
134
158
  >
135
- <input {...nativeInputProps} required={required || undefined} {...ariaProps} ref={composeRefs(inputRef, forwardedRef)} className="kui-reset kui-TextFieldInput" />
159
+ <input
160
+ {...nativeInputProps}
161
+ required={required || undefined}
162
+ {...ariaProps}
163
+ onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}
164
+ ref={composeRefs(inputRef, forwardedRef)}
165
+ className="kui-reset kui-TextFieldInput"
166
+ />
136
167
  <TextFieldContext.Provider value={contextValue}>{children}</TextFieldContext.Provider>
137
168
  </div>
138
169
  );
@@ -185,19 +216,9 @@ type TextFieldSlotElement = React.ElementRef<'div'>;
185
216
  type TextFieldSlotOwnProps = GetPropDefTypes<typeof textFieldSlotPropDefs> & TextFieldSlotScrubProps;
186
217
  interface TextFieldSlotProps extends ComponentPropsWithout<'div', RemovedProps>, TextFieldSlotOwnProps {}
187
218
 
188
- // Detect if we should use pointer capture instead of pointer lock
189
- // Safari and Firefox show intrusive browser warnings with pointer lock
190
- const usePointerCapture = (() => {
191
- if (typeof navigator === 'undefined') return false;
192
- const ua = navigator.userAgent;
193
- const isSafari = /^((?!chrome|android).)*safari/i.test(ua);
194
- const isFirefox = /firefox/i.test(ua);
195
- return isSafari || isFirefox;
196
- })();
197
-
198
219
  const TextFieldSlot = React.forwardRef<TextFieldSlotElement, TextFieldSlotProps>((props, forwardedRef) => {
199
220
  // Extract scrub props first (not part of PropDef system)
200
- const { scrub, scrubValue, scrubStep = 1, scrubSensitivity = 1, scrubMin, scrubMax, scrubShiftMultiplier = 10, scrubAltMultiplier = 0.1, onScrub, ...restProps } = props;
221
+ const { scrub: scrubProp, scrubValue, scrubStep = 1, scrubSensitivity = 1, scrubMin, scrubMax, scrubShiftMultiplier = 10, scrubAltMultiplier = 0.1, onScrub, ...restProps } = props;
201
222
 
202
223
  // Then extract styling props
203
224
  const { className, color, side, onPointerDown, onPointerMove, onPointerUp, onLostPointerCapture, ...slotProps } = extractProps(
@@ -210,7 +231,10 @@ const TextFieldSlot = React.forwardRef<TextFieldSlotElement, TextFieldSlotProps>
210
231
  // by the button's name.
211
232
  const generatedId = React.useId();
212
233
  const slotId = slotProps.id ?? generatedId;
213
- const registerSlot = React.useContext(TextFieldContext)?.registerSlot;
234
+ const fieldContext = React.useContext(TextFieldContext);
235
+ const registerSlot = fieldContext?.registerSlot;
236
+ const registerScrub = fieldContext?.registerScrub;
237
+ const scrub = Boolean(scrubProp) && !fieldContext?.inert;
214
238
  const slotRef = React.useRef<HTMLDivElement>(null);
215
239
  // Unknown until the slot has rendered; it registers once it is known to hold only text.
216
240
  const [holdsControl, setHoldsControl] = React.useState<boolean | null>(null);
@@ -227,8 +251,6 @@ const TextFieldSlot = React.forwardRef<TextFieldSlotElement, TextFieldSlotProps>
227
251
  const cursorRef = React.useRef<HTMLImageElement>(null);
228
252
  // Virtual cursor Y, tracked beside virtualX
229
253
  const virtualY = React.useRef(0);
230
- // Whether this slot asked for the pointer lock, so a lock change elsewhere is not ours
231
- const lockedByMe = React.useRef(false);
232
254
 
233
255
  // Track accumulated sub-step movement for precision
234
256
  const accumulatedMovement = React.useRef(0);
@@ -284,45 +306,18 @@ const TextFieldSlot = React.forwardRef<TextFieldSlotElement, TextFieldSlotProps>
284
306
  const slot = slotRef.current;
285
307
  if (!slot) return;
286
308
 
287
- if (usePointerCapture) {
288
- // Safari/Firefox: Use pointer capture (no browser warning)
289
- pointerIdRef.current = event.pointerId;
290
- lastXRef.current = event.clientX;
291
- slot.setPointerCapture(event.pointerId);
292
- setIsScrubbing(true);
293
- } else {
294
- // Chrome: Use pointer lock for infinite movement
295
- lockedByMe.current = true;
296
- slot.requestPointerLock();
297
- }
309
+ // Pointer capture in every browser. Pointer lock gave endless travel in Chrome, but Chrome
310
+ // shows its "Press Esc to show your cursor" banner on every drag, which is noise for a
311
+ // gesture repeated all day. Captured, the drag keeps going past the window, up to the edge
312
+ // of the screen.
313
+ pointerIdRef.current = event.pointerId;
314
+ lastXRef.current = event.clientX;
315
+ slot.setPointerCapture(event.pointerId);
316
+ setIsScrubbing(true);
298
317
  },
299
318
  [scrub, scrubValue],
300
319
  );
301
320
 
302
- // Handle pointer lock state changes (Chrome only). Only a scrub slot listens, and only a lock
303
- // this slot asked for starts or ends its scrub.
304
- React.useEffect(() => {
305
- if (usePointerCapture || !scrub) return;
306
-
307
- const handlePointerLockChange = () => {
308
- if (!lockedByMe.current) return;
309
- const isLocked = document.pointerLockElement === slotRef.current;
310
- setIsScrubbing(isLocked);
311
- if (!isLocked) {
312
- lockedByMe.current = false;
313
- // Fire callback with isChanging = false when scrubbing ends
314
- scrubConfigRef.current.onScrub?.(0, false);
315
- accumulatedMovement.current = 0;
316
- currentValue.current = 0;
317
- }
318
- };
319
-
320
- document.addEventListener('pointerlockchange', handlePointerLockChange);
321
- return () => {
322
- document.removeEventListener('pointerlockchange', handlePointerLockChange);
323
- };
324
- }, [scrub]);
325
-
326
321
  // Shared scrub calculation logic
327
322
  const processScrubMovement = React.useCallback((movementX: number, movementY: number, shiftKey: boolean, altKey: boolean) => {
328
323
  const config = scrubConfigRef.current;
@@ -401,10 +396,9 @@ const TextFieldSlot = React.forwardRef<TextFieldSlotElement, TextFieldSlotProps>
401
396
  setIsScrubbing(false);
402
397
  }, []);
403
398
 
404
- // Handle pointer capture mode events (Safari/Firefox)
405
399
  const handlePointerMove = React.useCallback(
406
400
  (event: React.PointerEvent) => {
407
- if (!isScrubbing || !usePointerCapture) return;
401
+ if (!isScrubbing) return;
408
402
 
409
403
  const movementX = event.clientX - lastXRef.current;
410
404
  lastXRef.current = event.clientX;
@@ -416,7 +410,7 @@ const TextFieldSlot = React.forwardRef<TextFieldSlotElement, TextFieldSlotProps>
416
410
 
417
411
  const handlePointerUp = React.useCallback(
418
412
  (event: React.PointerEvent) => {
419
- if (!usePointerCapture || pointerIdRef.current !== event.pointerId) return;
413
+ if (pointerIdRef.current !== event.pointerId) return;
420
414
 
421
415
  const slot = slotRef.current;
422
416
  if (slot && pointerIdRef.current !== null) {
@@ -428,41 +422,14 @@ const TextFieldSlot = React.forwardRef<TextFieldSlotElement, TextFieldSlotProps>
428
422
  );
429
423
 
430
424
  const handleLostPointerCapture = React.useCallback(() => {
431
- if (usePointerCapture && isScrubbing) {
425
+ if (isScrubbing) {
432
426
  endScrubbing();
433
427
  }
434
428
  }, [isScrubbing, endScrubbing]);
435
429
 
436
- // Attach document-level listeners for pointer lock mode (Chrome)
437
- React.useEffect(() => {
438
- if (!isScrubbing || usePointerCapture) return;
439
-
440
- const handleMouseMove = (event: MouseEvent) => {
441
- processScrubMovement(event.movementX, event.movementY, event.shiftKey, event.altKey);
442
- };
443
-
444
- const handleMouseUp = () => {
445
- // Exit pointer lock to end scrubbing
446
- document.exitPointerLock();
447
- };
448
-
449
- // Use mousemove for pointer lock (pointermove doesn't work well with pointer lock)
450
- document.addEventListener('mousemove', handleMouseMove);
451
- document.addEventListener('mouseup', handleMouseUp);
452
-
453
- // Disable text selection during scrubbing
454
- document.body.style.userSelect = 'none';
455
-
456
- return () => {
457
- document.removeEventListener('mousemove', handleMouseMove);
458
- document.removeEventListener('mouseup', handleMouseUp);
459
- document.body.style.userSelect = '';
460
- };
461
- }, [isScrubbing, processScrubMovement]);
462
-
463
430
  // Hide native cursor and disable text selection during pointer capture scrubbing
464
431
  React.useEffect(() => {
465
- if (!isScrubbing || !usePointerCapture) return;
432
+ if (!isScrubbing) return;
466
433
 
467
434
  // Create a style element to hide cursor globally during scrub
468
435
  const style = document.createElement('style');
@@ -474,6 +441,19 @@ const TextFieldSlot = React.forwardRef<TextFieldSlotElement, TextFieldSlotProps>
474
441
  };
475
442
  }, [isScrubbing]);
476
443
 
444
+ // Up and Down on the input step once. The step is a whole change, so it reports isChanging
445
+ // false at once: one undo step per press, as a drag is one per release.
446
+ React.useEffect(() => {
447
+ if (!scrub || !registerScrub) return;
448
+ return registerScrub((direction, shiftKey, altKey) => {
449
+ const config = scrubConfigRef.current;
450
+ const multiplier = shiftKey ? config.scrubShiftMultiplier : altKey ? config.scrubAltMultiplier : 1;
451
+ const start = config.scrubValue ?? 0;
452
+ const next = Math.max(config.scrubMin ?? -Infinity, Math.min(config.scrubMax ?? Infinity, start + direction * config.scrubStep * multiplier));
453
+ if (next !== start) config.onScrub?.(next - start, false);
454
+ });
455
+ }, [scrub, registerScrub]);
456
+
477
457
  // Render virtual cursor via portal to body so it's not clipped
478
458
  // Using a data URI of ew-resize cursor for a native look
479
459
  const virtualCursor = isScrubbing
package/styles.css CHANGED
@@ -11399,6 +11399,12 @@
11399
11399
  -ms-user-select: none;
11400
11400
  user-select: none;
11401
11401
  position: relative;
11402
+ border-radius: calc(var(--text-field-border-radius, var(--radius-2)) - 2px);
11403
+ }
11404
+ @media (hover: hover) {
11405
+ .kui-TextFieldSlot:where([data-scrub]):where(:hover:not([data-scrubbing])) {
11406
+ background-color: var(--neutral-a3);
11407
+ }
11402
11408
  }
11403
11409
  .kui-TextFieldSlot:where([data-scrub]) * {
11404
11410
  cursor: ew-resize !important;
@@ -14759,12 +14765,12 @@
14759
14765
  -webkit-padding-end: var(--space-4);
14760
14766
  padding-inline-end: var(--space-4);
14761
14767
  }
14762
- .kui-SelectItem:where(.kui-SelectItemRich) {
14768
+ .kui-SelectItem:where(.kui-SelectItemRich[data-multiline]) {
14763
14769
  -webkit-box-align: start;
14764
14770
  -ms-flex-align: start;
14765
14771
  align-items: flex-start;
14766
14772
  }
14767
- .kui-SelectItem:where(.kui-SelectItemRich) :where(.kui-SelectItemIndicator) {
14773
+ .kui-SelectItem:where(.kui-SelectItemRich[data-multiline]) :where(.kui-SelectItemIndicator) {
14768
14774
  bottom: auto;
14769
14775
  height: var(--base-menu-item-height);
14770
14776
  }
@@ -20490,6 +20496,92 @@
20490
20496
  border-style: none;
20491
20497
  }
20492
20498
  }
20499
+ .kui-Navigator,
20500
+ .kui-NavigatorLevel,
20501
+ .kui-NavigatorScreen {
20502
+ display: -webkit-box;
20503
+ display: -ms-flexbox;
20504
+ display: flex;
20505
+ -webkit-box-orient: vertical;
20506
+ -webkit-box-direction: normal;
20507
+ -ms-flex-direction: column;
20508
+ flex-direction: column;
20509
+ min-block-size: 0;
20510
+ }
20511
+ .kui-NavigatorBar {
20512
+ -webkit-margin-before: calc(-1 * var(--layout-space-2));
20513
+ margin-block-start: calc(-1 * var(--layout-space-2));
20514
+ margin-inline: calc(-1 * var(--layout-space-2));
20515
+ -webkit-margin-after: var(--layout-space-6);
20516
+ margin-block-end: var(--layout-space-6);
20517
+ }
20518
+ .kui-NavigatorBarTitle {
20519
+ -webkit-margin-end: auto;
20520
+ margin-inline-end: auto;
20521
+ min-inline-size: 0;
20522
+ }
20523
+ .kui-NavigatorBarTitle:where(:first-child) {
20524
+ -webkit-padding-start: var(--layout-space-2);
20525
+ padding-inline-start: var(--layout-space-2);
20526
+ }
20527
+ .kui-NavigatorBackGlyph,
20528
+ .kui-NavigatorLinkGlyph {
20529
+ inline-size: 1em;
20530
+ block-size: 1em;
20531
+ }
20532
+ .kui-NavigatorBackGlyph:where(:dir(rtl)),
20533
+ .kui-NavigatorLinkGlyph:where(:dir(rtl)) {
20534
+ -webkit-transform: scaleX(-1);
20535
+ transform: scaleX(-1);
20536
+ }
20537
+ .kui-NavigatorLink {
20538
+ display: -webkit-box;
20539
+ display: -ms-flexbox;
20540
+ display: flex;
20541
+ -webkit-box-align: center;
20542
+ -ms-flex-align: center;
20543
+ align-items: center;
20544
+ gap: var(--layout-space-3);
20545
+ inline-size: 100%;
20546
+ min-block-size: var(--control-height-3);
20547
+ padding-inline: var(--layout-space-3);
20548
+ border-radius: var(--radius-control-3);
20549
+ color: var(--gray-12);
20550
+ font-size: var(--font-size-3);
20551
+ line-height: var(--line-height-3);
20552
+ text-align: start;
20553
+ cursor: var(--cursor-button);
20554
+ }
20555
+ .kui-NavigatorLinkLabel {
20556
+ display: -webkit-box;
20557
+ display: -ms-flexbox;
20558
+ display: flex;
20559
+ -webkit-box-align: center;
20560
+ -ms-flex-align: center;
20561
+ align-items: center;
20562
+ gap: var(--layout-space-3);
20563
+ -webkit-box-flex: 1;
20564
+ -ms-flex: 1;
20565
+ flex: 1;
20566
+ min-inline-size: 0;
20567
+ }
20568
+ .kui-NavigatorLinkGlyph {
20569
+ -ms-flex-negative: 0;
20570
+ flex-shrink: 0;
20571
+ color: var(--gray-a10);
20572
+ }
20573
+ @media (hover: hover) {
20574
+ .kui-NavigatorLink:where(:hover) {
20575
+ background-color: var(--gray-a3);
20576
+ }
20577
+ }
20578
+ .kui-NavigatorLink:where(:active) {
20579
+ background-color: var(--gray-a4);
20580
+ }
20581
+ .kui-NavigatorLink:where(:focus-visible) {
20582
+ outline: 2px solid var(--focus-8);
20583
+ outline-offset: -2px;
20584
+ }
20493
20585
  .kui-TooltipContent {
20494
20586
  -webkit-box-sizing: border-box;
20495
20587
  box-sizing: border-box;
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{a as p}from"./chunk-FATCGZZE.js";import{a as D}from"./chunk-7VJF6EXN.js";import{a as g}from"./chunk-JP36JSNP.js";import{a as l}from"./chunk-TGRHRMQI.js";import{a as m}from"./chunk-4MNRLB57.js";import{c as r}from"./chunk-OKQAVYW4.js";import{a as n}from"./chunk-AQKSO3SW.js";import{c as s}from"./chunk-5ON3XLRD.js";import{a as w}from"./chunk-VQPANPMI.js";var S={};w(S,{Close:()=>y,Content:()=>C,Description:()=>R,Root:()=>c,Title:()=>d,Trigger:()=>f});import*as o from"react";import W from"classnames";import{Dialog as t}from"radix-ui";var c=e=>o.createElement(t.Root,{...e,modal:!0});c.displayName="Dialog.Root";var f=o.forwardRef(({children:e,...i},a)=>o.createElement(t.Trigger,{...i,ref:a,asChild:!0},l(e)));f.displayName="Dialog.Trigger";var{align:O,...P}=p,B={align:O},C=o.forwardRef(({align:e,...i},a)=>{let T=s(i,P.size),{className:v}=r({align:e},B),{className:u,forceMount:h,container:E,onCloseAutoFocus:N,...x}=r(T,P);return D(),o.createElement(t.Portal,{container:E,forceMount:h},o.createElement(n,{asChild:!0},o.createElement(t.Overlay,{className:"kui-BaseDialogOverlay kui-DialogOverlay"},o.createElement("div",{className:"kui-BaseDialogScroll kui-DialogScroll"},o.createElement("div",{className:`kui-BaseDialogScrollPadding kui-DialogScrollPadding ${v}`},o.createElement(t.Content,{...x,ref:a,className:W("kui-BaseDialogContent","kui-DialogContent",u),"aria-modal":"true",onCloseAutoFocus:k=>{N?.(k),document.body.style.pointerEvents=""}}))))))});C.displayName="Dialog.Content";var d=o.forwardRef((e,i)=>o.createElement(t.Title,{asChild:!0},o.createElement(g,{size:"5",trim:"start",...e,asChild:!1,ref:i})));d.displayName="Dialog.Title";var R=o.forwardRef((e,i)=>o.createElement(t.Description,{asChild:!0},o.createElement(m,{as:"p",size:"3",...e,asChild:!1,ref:i})));R.displayName="Dialog.Description";var y=o.forwardRef(({children:e,...i},a)=>o.createElement(t.Close,{...i,ref:a,asChild:!0},l(e)));y.displayName="Dialog.Close";export{c as a,f as b,C as c,d,R as e,y as f,S as g};
3
- //# sourceMappingURL=chunk-5BX2YZV6.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/dialog.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\n\nimport { dialogContentPropDefs } from './dialog.props.js';\nimport { Heading } from './heading.js';\nimport { Text } from './text.js';\nimport { PortalTheme } from './_internal/portal-theme.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { useBodyPointerEventsCleanup } from '../hooks/use-body-pointer-events-cleanup.js';\n\nimport type { DialogContentOwnProps } from './dialog.props.js';\nimport type { ComponentPropsWithout, RemovedProps, ComponentPropsAs } from '../helpers/component-props.js';\n\ninterface DialogRootProps extends ComponentPropsWithout<typeof DialogPrimitive.Root, 'modal'> {}\nconst DialogRoot: React.FC<DialogRootProps> = (props) => <DialogPrimitive.Root {...props} modal />;\nDialogRoot.displayName = 'Dialog.Root';\n\ntype DialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ninterface DialogTriggerProps extends ComponentPropsWithout<typeof DialogPrimitive.Trigger, RemovedProps> {}\nconst DialogTrigger = React.forwardRef<DialogTriggerElement, DialogTriggerProps>(({ children, ...props }, forwardedRef) => (\n <DialogPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Trigger>\n));\nDialogTrigger.displayName = 'Dialog.Trigger';\n\n// Split once at module scope. `extractProps` memoises on the identity of the\n// prop def objects it is handed, so rebuilding these per render would recompile\n// them on every render.\nconst { align: alignPropDef, ...contentPropDefs } = dialogContentPropDefs;\nconst alignPropDefs = { align: alignPropDef };\n\ntype DialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ninterface DialogContentProps extends ComponentPropsWithout<typeof DialogPrimitive.Content, RemovedProps>, DialogContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>['container'];\n}\nconst DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(({ align, ...ownProps }, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, contentPropDefs.size);\n const { className: alignClassName } = extractProps({ align }, alignPropDefs);\n\n const { className, forceMount, container, onCloseAutoFocus, ...contentProps } = extractProps(props, contentPropDefs);\n\n // Cleanup stuck pointer-events on body\n useBodyPointerEventsCleanup();\n\n return (\n <DialogPrimitive.Portal container={container} forceMount={forceMount}>\n <PortalTheme asChild>\n <DialogPrimitive.Overlay className=\"kui-BaseDialogOverlay kui-DialogOverlay\">\n <div className=\"kui-BaseDialogScroll kui-DialogScroll\">\n <div className={`kui-BaseDialogScrollPadding kui-DialogScrollPadding ${alignClassName}`}>\n <DialogPrimitive.Content\n {...contentProps}\n ref={forwardedRef}\n className={classNames('kui-BaseDialogContent', 'kui-DialogContent', className)}\n aria-modal=\"true\"\n onCloseAutoFocus={(event) => {\n // Radix returns focus to the trigger unless the caller prevents it.\n onCloseAutoFocus?.(event);\n // Restore pointer-events to body (Radix UI fix for issue #1241)\n document.body.style.pointerEvents = '';\n }}\n />\n </div>\n </div>\n </DialogPrimitive.Overlay>\n </PortalTheme>\n </DialogPrimitive.Portal>\n );\n});\nDialogContent.displayName = 'Dialog.Content';\n\ntype DialogTitleElement = React.ElementRef<typeof Heading>;\ntype DialogTitleProps = ComponentPropsWithout<typeof Heading, 'asChild'>;\nconst DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>((props, forwardedRef) => (\n <DialogPrimitive.Title asChild>\n <Heading size=\"5\" trim=\"start\" {...props} asChild={false} ref={forwardedRef} />\n </DialogPrimitive.Title>\n));\nDialogTitle.displayName = 'Dialog.Title';\n\ntype DialogDescriptionElement = HTMLParagraphElement;\ntype DialogDescriptionProps = ComponentPropsAs<typeof Text, 'p'>;\nconst DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>((props, forwardedRef) => (\n <DialogPrimitive.Description asChild>\n <Text as=\"p\" size=\"3\" {...props} asChild={false} ref={forwardedRef} />\n </DialogPrimitive.Description>\n));\nDialogDescription.displayName = 'Dialog.Description';\n\ntype DialogCloseElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface DialogCloseProps extends ComponentPropsWithout<typeof DialogPrimitive.Close, RemovedProps> {}\nconst DialogClose = React.forwardRef<DialogCloseElement, DialogCloseProps>(({ children, ...props }, forwardedRef) => (\n <DialogPrimitive.Close {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Close>\n));\nDialogClose.displayName = 'Dialog.Close';\n\nexport { DialogRoot as Root, DialogTrigger as Trigger, DialogContent as Content, DialogTitle as Title, DialogDescription as Description, DialogClose as Close };\n\nexport type {\n DialogRootProps as RootProps,\n DialogTriggerProps as TriggerProps,\n DialogContentProps as ContentProps,\n DialogTitleProps as TitleProps,\n DialogDescriptionProps as DescriptionProps,\n DialogCloseProps as CloseProps,\n};\n"],
5
- "mappings": ";wWAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,YAAAC,EAAA,gBAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,YAAAC,IAAA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,UAAUC,MAAuB,WAe1C,IAAMC,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sB,QAAO,IAC5B,gBAACyB,EAAA,CAAQ,KAAK,IAAI,KAAK,QAAS,GAAG1B,EAAO,QAAS,GAAO,IAAKI,EAAc,CAC/E,CACD,EACDqB,EAAY,YAAc,eAI1B,IAAME,EAA0B,aAA6D,CAAC3B,EAAOI,IACnG,gBAACH,EAAgB,YAAhB,CAA4B,QAAO,IAClC,gBAAC2B,EAAA,CAAK,GAAG,IAAI,KAAK,IAAK,GAAG5B,EAAO,QAAS,GAAO,IAAKI,EAAc,CACtE,CACD,EACDuB,EAAkB,YAAc,qBAIhC,IAAME,EAAoB,aAAiD,CAAC,CAAE,SAAA1B,EAAU,GAAGH,CAAM,EAAGI,IAClG,gBAACH,EAAgB,MAAhB,CAAuB,GAAGD,EAAO,IAAKI,EAAc,QAAO,IACzDC,EAAoBF,CAAQ,CAC/B,CACD,EACD0B,EAAY,YAAc",
6
- "names": ["dialog_exports", "__export", "DialogClose", "DialogContent", "DialogDescription", "DialogRoot", "DialogTitle", "DialogTrigger", "React", "classNames", "DialogPrimitive", "DialogRoot", "props", "DialogPrimitive", "DialogTrigger", "children", "forwardedRef", "requireReactElement", "alignPropDef", "contentPropDefs", "dialogContentPropDefs", "alignPropDefs", "DialogContent", "align", "ownProps", "useThemeSizeProps", "alignClassName", "extractProps", "className", "forceMount", "container", "onCloseAutoFocus", "contentProps", "useBodyPointerEventsCleanup", "PortalTheme", "classNames", "event", "DialogTitle", "Heading", "DialogDescription", "Text", "DialogClose"]
7
- }
@@ -1,6 +0,0 @@
1
- "use client";
2
- import{a as me}from"./chunk-YCLPURTD.js";import{a as K}from"./chunk-OAJ5DARR.js";import{b as fe,c as U}from"./chunk-OKQAVYW4.js";import{c as ie}from"./chunk-5ON3XLRD.js";import{c as j}from"./chunk-HBWBPBSA.js";import{b as ne}from"./chunk-XU74PNM2.js";import{a as Ee}from"./chunk-VQPANPMI.js";var ze={};Ee(ze,{Group:()=>he,Root:()=>ge,Slot:()=>Se});import*as e from"react";import*as Pe from"react-dom";import Z from"classnames";import{composeEventHandlers as $,composeRefs as ye,useLayoutEffect as Ge}from"radix-ui/internal";var be=["1","2","3","4"],Le=["raised","surface","soft","ghost","outline"],ae={size:{type:"enum",className:"kui-r-size",values:be,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:Le,default:"raised"},error:{type:"boolean",default:!1},errorMessage:{type:"string",default:void 0},required:{type:"boolean",default:!1},"aria-describedby":{type:"string",default:void 0},"aria-labelledby":{type:"string",default:void 0},...j,...ne},Ie=["raised","surface","soft","outline","ghost"],le={size:{type:"enum",className:"kui-r-size",values:be,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:Ie,default:"raised"},disabled:{type:"boolean",default:!1},...j,...ne},Ne=["left","right"],xe={side:{type:"enum",values:Ne},...j,gap:me.gap,px:K.px,pl:K.pl,pr:K.pr};var Re=e.createContext(null),ue="button, a, input, select, textarea, label, [tabindex], [contenteditable]",ve=e.createContext(null),ge=e.forwardRef((a,g)=>{let r=e.useContext(ve),f=r?{...a,size:r.size,variant:r.variant,radius:r.radius,color:a.color??r.color,disabled:!!(r.disabled||a.disabled)}:a,{className:P,style:m,...y}=ie(f,ae.size),b=e.useRef(null),{children:F,className:M,color:w,radius:H,style:k,...l}=U(y,ae),c=!!l.errorMessage,D=e.useId(),[E,L]=e.useState([]),I=e.useCallback(o=>(L(s=>s.includes(o)?s:[...s,o]),()=>L(s=>s.filter(i=>i!==o))),[]),N=e.useMemo(()=>({registerSlot:I}),[I]),{"aria-describedby":G,"aria-labelledby":C,"aria-invalid":h}=l,x=!!l.error||h===!0||h==="true",z=e.useMemo(()=>{let o=[];return l.errorMessage&&o.push(D),G&&o.push(G),o.push(...E),o.length>0?o.join(" "):void 0},[l.errorMessage,G,D,E]),J=e.useMemo(()=>({"aria-invalid":x?!0:h,"aria-describedby":z,"aria-labelledby":C}),[x,h,z,C]),{error:u,errorMessage:B,required:X,"aria-describedby":ce,"aria-labelledby":Q,...V}=l,O=e.useCallback(o=>{let s=o.target;if(s.closest(ue))return;let i=b.current;if(!i)return;let S=s.closest(`
3
- .kui-TextFieldSlot[data-side='right'],
4
- .kui-TextFieldSlot:not([data-side='right']) ~ .kui-TextFieldSlot:not([data-side='left'])
5
- `)?i.value.length:0;o.preventDefault(),i.focus();try{i.setSelectionRange(S,S)}catch{}},[]),R=e.createElement("div",{"data-accent-color":w,"data-radius":H,style:c?k:fe(k,m),className:Z("kui-TextFieldRoot",M,!c&&P,{"kui-error":x}),onMouseDown:O},e.createElement("input",{...V,required:X||void 0,...J,ref:ye(b,g),className:"kui-reset kui-TextFieldInput"}),e.createElement(Re.Provider,{value:N},F));return e.createElement("div",{className:Z("kui-TextFieldWrapper",c&&P),style:c?m:void 0,"data-message":c||void 0},R,c?e.createElement("div",{id:D,className:"kui-TextFieldErrorMessage",role:"alert"},l.errorMessage):null)});ge.displayName="TextField.Root";var he=e.forwardRef((a,g)=>{let r=ie(a,le.size),{size:f,variant:P,radius:m,color:y,disabled:b}=r,{className:F,children:M,radius:w,color:H,disabled:k,...l}=U(r,le),c=e.useMemo(()=>({size:f,variant:P,radius:m,color:y,disabled:b}),[f,P,m,y,b]);return e.createElement("div",{role:"group","data-accent-color":y,"data-radius":m,"data-disabled":b||void 0,...l,ref:g,className:Z("kui-TextFieldGroup",F)},e.createElement(ve.Provider,{value:c},M))});he.displayName="TextField.Group";var T=(()=>{if(typeof navigator>"u")return!1;let a=navigator.userAgent,g=/^((?!chrome|android).)*safari/i.test(a),r=/firefox/i.test(a);return g||r})(),Se=e.forwardRef((a,g)=>{let{scrub:r,scrubValue:f,scrubStep:P=1,scrubSensitivity:m=1,scrubMin:y,scrubMax:b,scrubShiftMultiplier:F=10,scrubAltMultiplier:M=.1,onScrub:w,...H}=a,{className:k,color:l,side:c,onPointerDown:D,onPointerMove:E,onPointerUp:L,onLostPointerCapture:I,...N}=U(H,xe),G=e.useId(),C=N.id??G,h=e.useContext(Re)?.registerSlot,x=e.useRef(null),[z,J]=e.useState(null);Ge(()=>{let t=!!x.current?.querySelector(ue);J(n=>n===t?n:t)}),e.useEffect(()=>z===!1?h?.(C):void 0,[h,C,z]);let[u,B]=e.useState(!1),[X,ce]=e.useState({x:0,y:0}),Q=e.useRef(null),V=e.useRef(0),O=e.useRef(!1),R=e.useRef(0),o=e.useRef(0),s=e.useRef(0),i=e.useRef(null),A=e.useRef(0),S=e.useRef({scrubValue:f,scrubStep:P,scrubSensitivity:m,scrubMin:y,scrubMax:b,scrubShiftMultiplier:F,scrubAltMultiplier:M,onScrub:w});S.current={scrubValue:f,scrubStep:P,scrubSensitivity:m,scrubMin:y,scrubMax:b,scrubShiftMultiplier:F,scrubAltMultiplier:M,onScrub:w};let Te=e.useCallback(t=>{if(!r||t.target.closest(ue))return;t.preventDefault(),R.current=0,o.current=f??0,s.current=t.clientX,V.current=t.clientY,ce({x:t.clientX,y:t.clientY});let d=x.current;d&&(T?(i.current=t.pointerId,A.current=t.clientX,d.setPointerCapture(t.pointerId),B(!0)):(O.current=!0,d.requestPointerLock()))},[r,f]);e.useEffect(()=>{if(T||!r)return;let t=()=>{if(!O.current)return;let n=document.pointerLockElement===x.current;B(n),n||(O.current=!1,S.current.onScrub?.(0,!1),R.current=0,o.current=0)};return document.addEventListener("pointerlockchange",t),()=>{document.removeEventListener("pointerlockchange",t)}},[r]);let W=e.useCallback((t,n,d,we)=>{let p=S.current,q=window.innerWidth,Y=window.innerHeight;s.current+=t,s.current>q?s.current=s.current%q:s.current<0&&(s.current=q+s.current%q);let v=V.current+n;v>Y?v=v%Y:v<0&&(v=Y+v%Y),V.current=v;let ee=Q.current;ee&&(ee.style.left=`${s.current}px`,ee.style.top=`${v}px`),R.current+=t;let te=R.current/p.scrubSensitivity;if(Math.abs(te)>=1){let re=1;d?re=p.scrubShiftMultiplier:we&&(re=p.scrubAltMultiplier);let de=Math.trunc(te),oe=de*p.scrubStep*re,se=oe;if(p.scrubMin!==void 0||p.scrubMax!==void 0){let ke=o.current+oe,pe=Math.max(p.scrubMin??-1/0,Math.min(p.scrubMax??1/0,ke));se=pe-o.current,o.current=pe}else o.current+=oe;se!==0&&p.onScrub?.(se,!0),R.current=(te-de)*p.scrubSensitivity}},[]),_=e.useCallback(()=>{S.current.onScrub?.(0,!1),R.current=0,o.current=0,i.current=null,B(!1)},[]),Fe=e.useCallback(t=>{if(!u||!T)return;let n=t.clientX-A.current;A.current=t.clientX,W(n,t.movementY,t.shiftKey,t.altKey)},[u,W]),Me=e.useCallback(t=>{if(!T||i.current!==t.pointerId)return;let n=x.current;n&&i.current!==null&&n.releasePointerCapture(i.current),_()},[_]),De=e.useCallback(()=>{T&&u&&_()},[u,_]);e.useEffect(()=>{if(!u||T)return;let t=d=>{W(d.movementX,d.movementY,d.shiftKey,d.altKey)},n=()=>{document.exitPointerLock()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n),document.body.style.userSelect=""}},[u,W]),e.useEffect(()=>{if(!u||!T)return;let t=document.createElement("style");return t.textContent="* { cursor: none !important; user-select: none !important; }",document.head.appendChild(t),()=>{document.head.removeChild(t)}},[u]);let Ce=u?Pe.createPortal(e.createElement("img",{ref:Q,className:"kui-TextFieldSlotScrubCursor",src:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='black' stroke='white' stroke-width='1' d='M0 12 L5 7 L5 10 L19 10 L19 7 L24 12 L19 17 L19 14 L5 14 L5 17 Z'/%3E%3C/svg%3E",alt:"",style:{position:"fixed",left:X.x,top:X.y,transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:99999,width:24,height:24},"aria-hidden":"true"}),document.body):null;return e.createElement("div",{"data-accent-color":l,"data-side":c,"data-scrub":r||void 0,"data-scrubbing":u||void 0,...N,id:C,ref:ye(x,g),className:Z("kui-TextFieldSlot",k),onPointerDown:r?$(D,Te):D,onPointerMove:r?$(E,Fe):E,onPointerUp:r?$(L,Me):L,onLostPointerCapture:r?$(I,De):I},N.children,Ce)});Se.displayName="TextField.Slot";export{ge as a,he as b,Se as c,ze as d};
6
- //# sourceMappingURL=chunk-GPZHRZBE.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/text-field.tsx", "../../src/components/text-field.props.tsx"],
4
- "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport classNames from 'classnames';\nimport { composeEventHandlers, composeRefs, useLayoutEffect } from 'radix-ui/internal';\n\nimport { textFieldRootPropDefs, textFieldGroupPropDefs, textFieldSlotPropDefs, type TextFieldSlotScrubProps } from './text-field.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { mergeStyles } from '../helpers/merge-styles.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { NotInputTextualAttributes } from '../helpers/input-attributes.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype TextFieldRootElement = React.ElementRef<'input'>;\ntype TextFieldRootOwnProps = GetPropDefTypes<typeof textFieldRootPropDefs> & {\n defaultValue?: string | number;\n value?: string | number;\n type?: 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';\n};\ntype TextFieldInputProps = ComponentPropsWithout<'input', NotInputTextualAttributes | 'color' | 'defaultValue' | 'size' | 'type' | 'value'>;\ninterface TextFieldRootProps extends TextFieldInputProps, TextFieldRootOwnProps {}\n\n// Each Slot registers its id here, so the input can list slot content in aria-describedby.\ntype TextFieldContextValue = { registerSlot: (id: string) => () => void };\nconst TextFieldContext = React.createContext<TextFieldContextValue | null>(null);\n\n// Clicking anything a person could mean to press keeps its own press: the guard is a focusability\n// list, not a tag list. `[tabindex]` catches role-based widgets; `label` already redirects a click.\nconst FOCUSABLE_IN_SLOT = 'button, a, input, select, textarea, label, [tabindex], [contenteditable]';\n\n// A Group decides the look of its fields: their size, variant and radius come from it. A field\n// can still take its own color, and is disabled when either it or the group is.\ntype TextFieldGroupContextValue = Pick<TextFieldGroupOwnProps, 'size' | 'variant' | 'radius' | 'color' | 'disabled'>;\nconst TextFieldGroupContext = React.createContext<TextFieldGroupContextValue | null>(null);\n\nconst TextFieldRoot = React.forwardRef<TextFieldRootElement, TextFieldRootProps>((fieldProps, forwardedRef) => {\n const group = React.useContext(TextFieldGroupContext);\n const ownProps = group\n ? {\n ...fieldProps,\n size: group.size,\n variant: group.variant,\n radius: group.radius,\n color: fieldProps.color ?? group.color,\n disabled: Boolean(group.disabled || fieldProps.disabled),\n }\n : fieldProps;\n // The caller's className and style are kept apart from the size and variant classes: with an\n // error message they go on the wrapper, which is then the one box the parent lays out.\n const { className: ownClassName, style: ownStyle, ...themedProps } = useThemeSizeProps(ownProps, textFieldRootPropDefs.size);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const { children, className, color, radius, style, ...inputProps } = extractProps(themedProps, textFieldRootPropDefs);\n const wrapped = Boolean(inputProps.errorMessage);\n\n // Generate unique IDs for accessibility\n const errorId = React.useId();\n\n // Slot content qualifies the value, so it describes the input (as in v2), in mount order.\n const [slotIds, setSlotIds] = React.useState<string[]>([]);\n const registerSlot = React.useCallback((id: string) => {\n setSlotIds((prev) => (prev.includes(id) ? prev : [...prev, id]));\n return () => setSlotIds((prev) => prev.filter((slotId) => slotId !== id));\n }, []);\n const contextValue = React.useMemo(() => ({ registerSlot }), [registerSlot]);\n\n const { 'aria-describedby': ariaDescribedby, 'aria-labelledby': ariaLabelledby, 'aria-invalid': ariaInvalid } = inputProps;\n\n // Invalid when `error` is set or the caller passes aria-invalid; the CSS keys on aria-invalid only.\n const isInvalid = Boolean(inputProps.error) || ariaInvalid === true || ariaInvalid === 'true';\n\n // Build aria-describedby string. The caller's ids stay; ours are appended.\n const describedBy = React.useMemo(() => {\n const parts = [];\n if (inputProps.errorMessage) parts.push(errorId);\n if (ariaDescribedby) parts.push(ariaDescribedby);\n parts.push(...slotIds);\n return parts.length > 0 ? parts.join(' ') : undefined;\n }, [inputProps.errorMessage, ariaDescribedby, errorId, slotIds]);\n\n // Build aria attributes\n const ariaProps = React.useMemo(\n () => ({\n 'aria-invalid': isInvalid ? true : ariaInvalid,\n 'aria-describedby': describedBy,\n 'aria-labelledby': ariaLabelledby,\n }),\n [isInvalid, ariaInvalid, describedBy, ariaLabelledby],\n );\n\n // Filter out our custom props to avoid DOM warnings\n const { error, errorMessage, required, 'aria-describedby': _ariaDescribedby, 'aria-labelledby': _ariaLabelledby, ...nativeInputProps } = inputProps;\n\n // Clicking the padding or a passive slot focuses the input. preventDefault stops the browser\n // from moving focus to the root first, so the input is focused once, synchronously.\n const handleMouseDown = React.useCallback((event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n if (target.closest(FOCUSABLE_IN_SLOT)) return;\n\n const input = inputRef.current;\n if (!input) return;\n\n // Same selector as in the CSS to find the right slot\n const isRightSlot = target.closest(`\n .kui-TextFieldSlot[data-side='right'],\n .kui-TextFieldSlot:not([data-side='right']) ~ .kui-TextFieldSlot:not([data-side='left'])\n `);\n\n const cursorPosition = isRightSlot ? input.value.length : 0;\n\n event.preventDefault();\n input.focus();\n // Only some input types support this, browsers will throw an error if not supported\n // See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange#:~:text=Note%20that%20according,not%20support%20selection%22.\n try {\n input.setSelectionRange(cursorPosition, cursorPosition);\n } catch {}\n }, []);\n\n // A pointer-only hit-target redirect to the input; keyboard users reach the input directly.\n const field = (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n data-accent-color={color}\n data-radius={radius}\n style={wrapped ? style : mergeStyles(style, ownStyle)}\n className={classNames('kui-TextFieldRoot', className, !wrapped && ownClassName, {\n // Not used by the library's CSS (invalid styling keys on aria-invalid); kept as a hook for app styles.\n 'kui-error': isInvalid,\n })}\n onMouseDown={handleMouseDown}\n >\n <input {...nativeInputProps} required={required || undefined} {...ariaProps} ref={composeRefs(inputRef, forwardedRef)} className=\"kui-reset kui-TextFieldInput\" />\n <TextFieldContext.Provider value={contextValue}>{children}</TextFieldContext.Provider>\n </div>\n );\n // The wrapper is always there, so a message coming or going never moves the field in the tree:\n // moving it would remount the input, dropping focus, the caret and an uncontrolled value. With\n // no message it is `display: contents` and the field is the box the parent lays out; with one\n // it holds the field and the message below it, and the caller's className and style size the pair.\n return (\n <div className={classNames('kui-TextFieldWrapper', wrapped && ownClassName)} style={wrapped ? ownStyle : undefined} data-message={wrapped || undefined}>\n {field}\n {wrapped ? (\n <div id={errorId} className=\"kui-TextFieldErrorMessage\" role=\"alert\">\n {inputProps.errorMessage}\n </div>\n ) : null}\n </div>\n );\n});\nTextFieldRoot.displayName = 'TextField.Root';\n\ntype TextFieldGroupOwnProps = GetPropDefTypes<typeof textFieldGroupPropDefs>;\ninterface TextFieldGroupProps extends ComponentPropsWithout<'div', RemovedProps>, TextFieldGroupOwnProps {}\n\n/**\n * Joins two or more fields into one, such as X, Y and Z: one edge, square inner corners and a\n * hairline between the fields. The group draws the edge, so each field keeps only its fill.\n */\nconst TextFieldGroup = React.forwardRef<HTMLDivElement, TextFieldGroupProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, textFieldGroupPropDefs.size);\n const { size, variant, radius, color, disabled } = props;\n const { className, children, radius: _radius, color: _color, disabled: _disabled, ...domProps } = extractProps(props, textFieldGroupPropDefs);\n const contextValue = React.useMemo(() => ({ size, variant, radius, color, disabled }), [size, variant, radius, color, disabled]);\n return (\n <div\n role=\"group\"\n data-accent-color={color}\n data-radius={radius}\n data-disabled={disabled || undefined}\n {...domProps}\n ref={forwardedRef}\n className={classNames('kui-TextFieldGroup', className)}\n >\n <TextFieldGroupContext.Provider value={contextValue}>{children}</TextFieldGroupContext.Provider>\n </div>\n );\n});\nTextFieldGroup.displayName = 'TextField.Group';\n\ntype TextFieldSlotElement = React.ElementRef<'div'>;\ntype TextFieldSlotOwnProps = GetPropDefTypes<typeof textFieldSlotPropDefs> & TextFieldSlotScrubProps;\ninterface TextFieldSlotProps extends ComponentPropsWithout<'div', RemovedProps>, TextFieldSlotOwnProps {}\n\n// Detect if we should use pointer capture instead of pointer lock\n// Safari and Firefox show intrusive browser warnings with pointer lock\nconst usePointerCapture = (() => {\n if (typeof navigator === 'undefined') return false;\n const ua = navigator.userAgent;\n const isSafari = /^((?!chrome|android).)*safari/i.test(ua);\n const isFirefox = /firefox/i.test(ua);\n return isSafari || isFirefox;\n})();\n\nconst TextFieldSlot = React.forwardRef<TextFieldSlotElement, TextFieldSlotProps>((props, forwardedRef) => {\n // Extract scrub props first (not part of PropDef system)\n const { scrub, scrubValue, scrubStep = 1, scrubSensitivity = 1, scrubMin, scrubMax, scrubShiftMultiplier = 10, scrubAltMultiplier = 0.1, onScrub, ...restProps } = props;\n\n // Then extract styling props\n const { className, color, side, onPointerDown, onPointerMove, onPointerUp, onLostPointerCapture, ...slotProps } = extractProps(\n restProps,\n textFieldSlotPropDefs,\n );\n\n // A slot of text describes the input (see TextFieldRoot); a caller's own id is kept. A slot\n // holding a control, such as a show-password button, does not: the input would be described\n // by the button's name.\n const generatedId = React.useId();\n const slotId = slotProps.id ?? generatedId;\n const registerSlot = React.useContext(TextFieldContext)?.registerSlot;\n const slotRef = React.useRef<HTMLDivElement>(null);\n // Unknown until the slot has rendered; it registers once it is known to hold only text.\n const [holdsControl, setHoldsControl] = React.useState<boolean | null>(null);\n useLayoutEffect(() => {\n const next = Boolean(slotRef.current?.querySelector(FOCUSABLE_IN_SLOT));\n setHoldsControl((prev) => (prev === next ? prev : next));\n });\n React.useEffect(() => (holdsControl === false ? registerSlot?.(slotId) : undefined), [registerSlot, slotId, holdsControl]);\n\n const [isScrubbing, setIsScrubbing] = React.useState(false);\n // Where the virtual cursor starts. Movement is written straight to the cursor element, so a\n // scrub does not re-render the slot on every mouse move.\n const [cursorStart, setCursorStart] = React.useState({ x: 0, y: 0 });\n const cursorRef = React.useRef<HTMLImageElement>(null);\n // Virtual cursor Y, tracked beside virtualX\n const virtualY = React.useRef(0);\n // Whether this slot asked for the pointer lock, so a lock change elsewhere is not ours\n const lockedByMe = React.useRef(false);\n\n // Track accumulated sub-step movement for precision\n const accumulatedMovement = React.useRef(0);\n // Track current value for clamping (initialized to scrubValue when scrubbing starts)\n const currentValue = React.useRef(0);\n // Track virtual X position for wrap-around (separate from rendered position)\n const virtualX = React.useRef(0);\n // Track pointer ID for capture mode\n const pointerIdRef = React.useRef<number | null>(null);\n // Track last X position for capture mode (movementX calculation)\n const lastXRef = React.useRef(0);\n\n // Store scrub config in refs so document handlers can access latest values\n const scrubConfigRef = React.useRef({\n scrubValue,\n scrubStep,\n scrubSensitivity,\n scrubMin,\n scrubMax,\n scrubShiftMultiplier,\n scrubAltMultiplier,\n onScrub,\n });\n scrubConfigRef.current = {\n scrubValue,\n scrubStep,\n scrubSensitivity,\n scrubMin,\n scrubMax,\n scrubShiftMultiplier,\n scrubAltMultiplier,\n onScrub,\n };\n\n const handlePointerDown = React.useCallback(\n (event: React.PointerEvent) => {\n if (!scrub) return;\n\n // Don't start scrubbing if clicking on interactive elements\n const target = event.target as HTMLElement;\n if (target.closest(FOCUSABLE_IN_SLOT)) return;\n\n event.preventDefault();\n accumulatedMovement.current = 0;\n // Initialize to current value so min/max clamping works correctly\n currentValue.current = scrubValue ?? 0;\n\n // Initialize virtual cursor at actual mouse position\n virtualX.current = event.clientX;\n virtualY.current = event.clientY;\n setCursorStart({ x: event.clientX, y: event.clientY });\n\n const slot = slotRef.current;\n if (!slot) return;\n\n if (usePointerCapture) {\n // Safari/Firefox: Use pointer capture (no browser warning)\n pointerIdRef.current = event.pointerId;\n lastXRef.current = event.clientX;\n slot.setPointerCapture(event.pointerId);\n setIsScrubbing(true);\n } else {\n // Chrome: Use pointer lock for infinite movement\n lockedByMe.current = true;\n slot.requestPointerLock();\n }\n },\n [scrub, scrubValue],\n );\n\n // Handle pointer lock state changes (Chrome only). Only a scrub slot listens, and only a lock\n // this slot asked for starts or ends its scrub.\n React.useEffect(() => {\n if (usePointerCapture || !scrub) return;\n\n const handlePointerLockChange = () => {\n if (!lockedByMe.current) return;\n const isLocked = document.pointerLockElement === slotRef.current;\n setIsScrubbing(isLocked);\n if (!isLocked) {\n lockedByMe.current = false;\n // Fire callback with isChanging = false when scrubbing ends\n scrubConfigRef.current.onScrub?.(0, false);\n accumulatedMovement.current = 0;\n currentValue.current = 0;\n }\n };\n\n document.addEventListener('pointerlockchange', handlePointerLockChange);\n return () => {\n document.removeEventListener('pointerlockchange', handlePointerLockChange);\n };\n }, [scrub]);\n\n // Shared scrub calculation logic\n const processScrubMovement = React.useCallback((movementX: number, movementY: number, shiftKey: boolean, altKey: boolean) => {\n const config = scrubConfigRef.current;\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n // Update virtual position with wrap-around at viewport edges\n virtualX.current += movementX;\n if (virtualX.current > viewportWidth) {\n virtualX.current = virtualX.current % viewportWidth;\n } else if (virtualX.current < 0) {\n virtualX.current = viewportWidth + (virtualX.current % viewportWidth);\n }\n\n // Also track Y with wrap-around\n let newY = virtualY.current + movementY;\n if (newY > viewportHeight) {\n newY = newY % viewportHeight;\n } else if (newY < 0) {\n newY = viewportHeight + (newY % viewportHeight);\n }\n virtualY.current = newY;\n\n const cursor = cursorRef.current;\n if (cursor) {\n cursor.style.left = `${virtualX.current}px`;\n cursor.style.top = `${newY}px`;\n }\n\n // Accumulate movement for sensitivity calculation\n accumulatedMovement.current += movementX;\n\n // Calculate how many steps we've moved\n const stepsFromMovement = accumulatedMovement.current / config.scrubSensitivity;\n\n if (Math.abs(stepsFromMovement) >= 1) {\n // Determine modifier multiplier\n let multiplier = 1;\n if (shiftKey) {\n multiplier = config.scrubShiftMultiplier;\n } else if (altKey) {\n multiplier = config.scrubAltMultiplier;\n }\n\n // Calculate delta\n const wholeSteps = Math.trunc(stepsFromMovement);\n const delta = wholeSteps * config.scrubStep * multiplier;\n\n // Apply min/max clamping if bounds are set\n let clampedDelta = delta;\n if (config.scrubMin !== undefined || config.scrubMax !== undefined) {\n const newValue = currentValue.current + delta;\n const clampedValue = Math.max(config.scrubMin ?? -Infinity, Math.min(config.scrubMax ?? Infinity, newValue));\n clampedDelta = clampedValue - currentValue.current;\n currentValue.current = clampedValue;\n } else {\n currentValue.current += delta;\n }\n\n // Fire callback with clamped delta (isChanging = true during drag)\n if (clampedDelta !== 0) {\n config.onScrub?.(clampedDelta, true);\n }\n\n // Keep the fractional remainder for smooth sub-pixel accumulation\n accumulatedMovement.current = (stepsFromMovement - wholeSteps) * config.scrubSensitivity;\n }\n }, []);\n\n // End scrubbing helper\n const endScrubbing = React.useCallback(() => {\n scrubConfigRef.current.onScrub?.(0, false);\n accumulatedMovement.current = 0;\n currentValue.current = 0;\n pointerIdRef.current = null;\n setIsScrubbing(false);\n }, []);\n\n // Handle pointer capture mode events (Safari/Firefox)\n const handlePointerMove = React.useCallback(\n (event: React.PointerEvent) => {\n if (!isScrubbing || !usePointerCapture) return;\n\n const movementX = event.clientX - lastXRef.current;\n lastXRef.current = event.clientX;\n\n processScrubMovement(movementX, event.movementY, event.shiftKey, event.altKey);\n },\n [isScrubbing, processScrubMovement],\n );\n\n const handlePointerUp = React.useCallback(\n (event: React.PointerEvent) => {\n if (!usePointerCapture || pointerIdRef.current !== event.pointerId) return;\n\n const slot = slotRef.current;\n if (slot && pointerIdRef.current !== null) {\n slot.releasePointerCapture(pointerIdRef.current);\n }\n endScrubbing();\n },\n [endScrubbing],\n );\n\n const handleLostPointerCapture = React.useCallback(() => {\n if (usePointerCapture && isScrubbing) {\n endScrubbing();\n }\n }, [isScrubbing, endScrubbing]);\n\n // Attach document-level listeners for pointer lock mode (Chrome)\n React.useEffect(() => {\n if (!isScrubbing || usePointerCapture) return;\n\n const handleMouseMove = (event: MouseEvent) => {\n processScrubMovement(event.movementX, event.movementY, event.shiftKey, event.altKey);\n };\n\n const handleMouseUp = () => {\n // Exit pointer lock to end scrubbing\n document.exitPointerLock();\n };\n\n // Use mousemove for pointer lock (pointermove doesn't work well with pointer lock)\n document.addEventListener('mousemove', handleMouseMove);\n document.addEventListener('mouseup', handleMouseUp);\n\n // Disable text selection during scrubbing\n document.body.style.userSelect = 'none';\n\n return () => {\n document.removeEventListener('mousemove', handleMouseMove);\n document.removeEventListener('mouseup', handleMouseUp);\n document.body.style.userSelect = '';\n };\n }, [isScrubbing, processScrubMovement]);\n\n // Hide native cursor and disable text selection during pointer capture scrubbing\n React.useEffect(() => {\n if (!isScrubbing || !usePointerCapture) return;\n\n // Create a style element to hide cursor globally during scrub\n const style = document.createElement('style');\n style.textContent = '* { cursor: none !important; user-select: none !important; }';\n document.head.appendChild(style);\n\n return () => {\n document.head.removeChild(style);\n };\n }, [isScrubbing]);\n\n // Render virtual cursor via portal to body so it's not clipped\n // Using a data URI of ew-resize cursor for a native look\n const virtualCursor = isScrubbing\n ? ReactDOM.createPortal(\n <img\n ref={cursorRef}\n className=\"kui-TextFieldSlotScrubCursor\"\n src=\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='black' stroke='white' stroke-width='1' d='M0 12 L5 7 L5 10 L19 10 L19 7 L24 12 L19 17 L19 14 L5 14 L5 17 Z'/%3E%3C/svg%3E\"\n alt=\"\"\n style={{\n position: 'fixed',\n left: cursorStart.x,\n top: cursorStart.y,\n transform: 'translate(-50%, -50%)',\n pointerEvents: 'none',\n zIndex: 99999,\n width: 24,\n height: 24,\n }}\n aria-hidden=\"true\"\n />,\n document.body,\n )\n : null;\n\n return (\n <div\n data-accent-color={color}\n data-side={side}\n data-scrub={scrub || undefined}\n data-scrubbing={isScrubbing || undefined}\n {...slotProps}\n id={slotId}\n ref={composeRefs(slotRef, forwardedRef)}\n className={classNames('kui-TextFieldSlot', className)}\n // The caller's handlers run first; the scrub handlers only when `scrub` is set.\n onPointerDown={scrub ? composeEventHandlers(onPointerDown, handlePointerDown) : onPointerDown}\n onPointerMove={scrub ? composeEventHandlers(onPointerMove, handlePointerMove) : onPointerMove}\n onPointerUp={scrub ? composeEventHandlers(onPointerUp, handlePointerUp) : onPointerUp}\n onLostPointerCapture={scrub ? composeEventHandlers(onLostPointerCapture, handleLostPointerCapture) : onLostPointerCapture}\n >\n {slotProps.children}\n {virtualCursor}\n </div>\n );\n});\nTextFieldSlot.displayName = 'TextField.Slot';\n\nexport { TextFieldRoot as Root, TextFieldGroup as Group, TextFieldSlot as Slot };\nexport type { TextFieldRootProps as RootProps, TextFieldGroupProps as GroupProps, TextFieldSlotProps as SlotProps };\n", "import { colorPropDef } from '../props/color.prop.js';\nimport { paddingPropDefs } from '../props/padding.props.js';\nimport { radiusPropDef } from '../props/radius.prop.js';\nimport { flexPropDefs } from './flex.props.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3', '4'] as const;\nconst variants = ['raised', 'surface', 'soft', 'ghost', 'outline'] as const;\n\nconst textFieldRootPropDefs = {\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'kui-variant', values: variants, default: 'raised' },\n // Error and validation props\n error: { type: 'boolean', default: false },\n errorMessage: { type: 'string', default: undefined },\n required: { type: 'boolean', default: false },\n // Accessibility props\n 'aria-describedby': { type: 'string', default: undefined },\n 'aria-labelledby': { type: 'string', default: undefined },\n ...colorPropDef,\n ...radiusPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n error: PropDef<boolean>;\n errorMessage: PropDef<string | undefined>;\n required: PropDef<boolean>;\n 'aria-describedby': PropDef<string | undefined>;\n 'aria-labelledby': PropDef<string | undefined>;\n};\n\n// Ghost is the dividers alone: no fill, no edge.\nconst groupVariants = ['raised', 'surface', 'soft', 'outline', 'ghost'] as const;\n\nconst textFieldGroupPropDefs = {\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'kui-variant', values: groupVariants, default: 'raised' },\n disabled: { type: 'boolean', default: false },\n ...colorPropDef,\n ...radiusPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof groupVariants)[number]>;\n disabled: PropDef<boolean>;\n};\n\nconst sides = ['left', 'right'] as const;\n\nconst textFieldSlotPropDefs = {\n side: { type: 'enum', values: sides },\n ...colorPropDef,\n gap: flexPropDefs.gap,\n px: paddingPropDefs.px,\n pl: paddingPropDefs.pl,\n pr: paddingPropDefs.pr,\n} satisfies {\n side: PropDef<(typeof sides)[number]>;\n gap: typeof flexPropDefs.gap;\n px: typeof paddingPropDefs.px;\n pl: typeof paddingPropDefs.pl;\n pr: typeof paddingPropDefs.pr;\n};\n\n/** Scrubbing props for TextField.Slot - handled separately from PropDef system */\ninterface TextFieldSlotScrubProps {\n /** Enable scrubbing behavior on this slot */\n scrub?: boolean;\n /** Current value (required for min/max clamping to work correctly) */\n scrubValue?: number;\n /** Base value change per movement unit (default: 1) */\n scrubStep?: number;\n /** Pixels of movement per step - higher = less sensitive (default: 1) */\n scrubSensitivity?: number;\n /** Minimum allowed value */\n scrubMin?: number;\n /** Maximum allowed value */\n scrubMax?: number;\n /** Step multiplier when Shift is held (default: 10) */\n scrubShiftMultiplier?: number;\n /** Step multiplier when Alt/Option is held (default: 0.1) */\n scrubAltMultiplier?: number;\n /**\n * Callback fired during scrubbing with the value delta\n * @param delta - The change in value\n * @param isChanging - true while dragging, false when released\n */\n onScrub?: (delta: number, isChanging: boolean) => void;\n}\n\nexport type { TextFieldSlotScrubProps };\n\nexport { textFieldRootPropDefs, textFieldGroupPropDefs, textFieldSlotPropDefs };\n"],
5
- "mappings": ";oSAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,WAAAE,GAAA,SAAAC,GAAA,SAAAC,KAEA,UAAYC,MAAW,QACvB,UAAYC,OAAc,YAC1B,OAAOC,MAAgB,aACvB,OAAS,wBAAAC,EAAs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,iBAAgBuB,GAAe,OAC9B,GAAGR,EACJ,GAAItD,EACJ,IAAKuB,GAAYkC,EAAShF,CAAY,EACtC,UAAW6C,EAAW,oBAAqBnC,CAAS,EAEpD,cAAeoD,EAAQgE,EAAqBrD,EAAeyB,EAAiB,EAAIzB,EAChF,cAAeX,EAAQgE,EAAqBpD,EAAe8C,EAAiB,EAAI9C,EAChF,YAAaZ,EAAQgE,EAAqBnD,EAAa8C,EAAe,EAAI9C,EAC1E,qBAAsBb,EAAQgE,EAAqBlD,EAAsB8C,EAAwB,EAAI9C,GAEpGC,EAAU,SACVgD,EACH,CAEJ,CAAC,EACDhE,GAAc,YAAc",
6
- "names": ["text_field_exports", "__export", "TextFieldGroup", "TextFieldRoot", "TextFieldSlot", "React", "ReactDOM", "classNames", "composeEventHandlers", "composeRefs", "useLayoutEffect", "sizes", "variants", "textFieldRootPropDefs", "colorPropDef", "radiusPropDef", "groupVariants", "textFieldGroupPropDefs", "sides", "textFieldSlotPropDefs", "flexPropDefs", "paddingPropDefs", "TextFieldContext", "FOCUSABLE_IN_SLOT", "TextFieldGroupContext", "TextFieldRoot", "fieldProps", "forwardedRef", "group", "ownProps", "ownClassName", "ownStyle", "themedProps", "useThemeSizeProps", "textFieldRootPropDefs", "inputRef", "children", "className", "color", "radius", "style", "inputProps", "extractProps", "wrapped", "errorId", "slotIds", "setSlotIds", "registerSlot", "id", "prev", "slotId", "contextValue", "ariaDescribedby", "ariaLabelledby", "ariaInvalid", "isInvalid", "describedBy", "parts", "ariaProps", "error", "errorMessage", "required", "_ariaDescribedby", "_ariaLabelledby", "nativeInputProps", "handleMouseDown", "event", "target", "input", "cursorPosition", "field", "mergeStyles", "classNames", "composeRefs", "TextFieldGroup", "props", "textFieldGroupPropDefs", "size", "variant", "disabled", "_radius", "_color", "_disabled", "domProps", "usePointerCapture", "ua", "isSafari", "isFirefox", "TextFieldSlot", "scrub", "scrubValue", "scrubStep", "scrubSensitivity", "scrubMin", "scrubMax", "scrubShiftMultiplier", "scrubAltMultiplier", "onScrub", "restProps", "side", "onPointerDown", "onPointerMove", "onPointerUp", "onLostPointerCapture", "slotProps", "textFieldSlotPropDefs", "generatedId", "slotRef", "holdsControl", "setHoldsControl", "useLayoutEffect", "next", "isScrubbing", "setIsScrubbing", "cursorStart", "setCursorStart", "cursorRef", "virtualY", "lockedByMe", "accumulatedMovement", "currentValue", "virtualX", "pointerIdRef", "lastXRef", "scrubConfigRef", "handlePointerDown", "slot", "handlePointerLockChange", "isLocked", "processScrubMovement", "movementX", "movementY", "shiftKey", "altKey", "config", "viewportWidth", "viewportHeight", "newY", "cursor", "stepsFromMovement", "multiplier", "wholeSteps", "delta", "clampedDelta", "newValue", "clampedValue", "endScrubbing", "handlePointerMove", "handlePointerUp", "handleLostPointerCapture", "handleMouseMove", "handleMouseUp", "virtualCursor", "composeEventHandlers"]
7
- }
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{a as P}from"./chunk-FATCGZZE.js";import{a as g}from"./chunk-7VJF6EXN.js";import{a as h}from"./chunk-JP36JSNP.js";import{a}from"./chunk-TGRHRMQI.js";import{a as f}from"./chunk-4MNRLB57.js";import{c as p}from"./chunk-OKQAVYW4.js";import{a as c}from"./chunk-AQKSO3SW.js";import{c as m}from"./chunk-5ON3XLRD.js";import{a as W}from"./chunk-VQPANPMI.js";var B={};W(B,{Close:()=>T,Content:()=>R,Description:()=>D,Root:()=>C,Title:()=>y,Trigger:()=>u});import*as e from"react";import k from"classnames";import{Dialog as r}from"radix-ui";var C=o=>e.createElement(r.Root,{...o,modal:!0});C.displayName="Sheet.Root";var u=e.forwardRef(({children:o,...t},i)=>e.createElement(r.Trigger,{...t,ref:i,asChild:!0},a(o)));u.displayName="Sheet.Trigger";var{align:Q,...w}=P,d=w,S=e.createContext(null),R=e.forwardRef((o,t)=>{let{side:i="start",forceMount:s,container:n,className:v,...E}=o,b=m(E,d.size),N={left:"start",right:"end",start:"start",end:"end",top:"top",bottom:"bottom"}[i],{className:x,...O}=p(b,d),z=e.useRef(0),M=e.useCallback(l=>{typeof t=="function"?t(l):t&&(t.current=l)},[t]);return g(),e.createElement(r.Portal,{container:n,forceMount:s},e.createElement(S.Provider,{value:z},e.createElement(c,{asChild:!0},e.createElement(r.Overlay,{className:"kui-BaseDialogOverlay kui-DialogOverlay kui-SheetOverlay"},e.createElement(r.Content,{...O,ref:M,className:k("kui-BaseDialogContent","kui-SheetContent",v,x),"data-side":N,"aria-modal":"true"})))))});R.displayName="Sheet.Content";var y=e.forwardRef(({size:o="4",weight:t="medium",...i},s)=>{let n=e.useContext(S);return e.useLayoutEffect(()=>{if(n)return n.current+=1,()=>{n.current-=1}},[n]),e.createElement(r.Title,{asChild:!0},e.createElement(h,{ref:s,size:o,weight:t,...i}))});y.displayName="Sheet.Title";var D=e.forwardRef(({size:o="2",emphasis:t="medium",...i},s)=>e.createElement(r.Description,{asChild:!0},e.createElement(f,{ref:s,size:o,emphasis:t,...i})));D.displayName="Sheet.Description";var T=e.forwardRef(({children:o,...t},i)=>e.createElement(r.Close,{...t,ref:i,asChild:!0},a(o)));T.displayName="Sheet.Close";export{C as a,u as b,R as c,y as d,D as e,T as f,B as g};
3
- //# sourceMappingURL=chunk-HR2VHGJ5.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/sheet.tsx"],
4
- "sourcesContent": ["'use client';\n\n/**\n * Sheet\n *\n * A side-placed overlay built on top of Radix Dialog. It inherits accessibility,\n * focus management, overlay behavior, and sizing scales from the base dialog, and\n * adds side placement and slide motion suited for navigation panels and drawers.\n *\n * Structure mirrors Dialog:\n * - Root, Trigger, Content, Title, Description, Close\n *\n * Notes\n * - Side: set with `side` on `Sheet.Content`. Aliases: `left` \u2192 `start`, `right` \u2192 `end`.\n * - Sizing: reuses Dialog content prop defs (width/min/max/height/size). Size follows the\n * Theme size; start/end sheets cap at the size's overlay width unless maxWidth is set.\n * - A11y: provide an accessible name via `Sheet.Title` or `aria-label` on `Sheet.Content`.\n * Radix owns the focus trap, initial focus and the return of focus to the trigger.\n *\n * Example\n * <Sheet.Root>\n * <Sheet.Trigger>\n * <Button>Open</Button>\n * </Sheet.Trigger>\n * <Sheet.Content side=\"end\" width={{ initial: '280px', md: '360px' }}>\n * <Sheet.Title>Details</Sheet.Title>\n * ...\n * <Sheet.Close>\n * <Button>Close</Button>\n * </Sheet.Close>\n * </Sheet.Content>\n * </Sheet.Root>\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\n\nimport { dialogContentPropDefs } from './dialog.props.js';\nimport type { DialogContentOwnProps } from './dialog.props.js';\nimport { PortalTheme } from './_internal/portal-theme.js';\nimport { Heading } from './heading.js';\nimport { Text } from './text.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { useBodyPointerEventsCleanup } from '../hooks/use-body-pointer-events-cleanup.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { HeadingProps } from './heading.js';\n\n/**\n * Supported sides for the Sheet.\n * Aliases are normalized RTL-aware: `left` \u2192 `start`, `right` \u2192 `end`.\n */\ntype SheetSide = 'start' | 'end' | 'top' | 'bottom' | 'left' | 'right';\n\n/**\n * Sheet is a side-placed overlay built on the Dialog primitive.\n * It reuses Dialog's accessibility, focus, overlay, and size scales, while adding side placement and slide motion.\n */\n\n// Root\n/**\n * Props for `Sheet.Root` (Radix Dialog root with `modal` forced on).\n */\ninterface SheetRootProps extends ComponentPropsWithout<typeof DialogPrimitive.Root, 'modal'> {}\nconst Root: React.FC<SheetRootProps> = (props) => <DialogPrimitive.Root {...props} modal />;\nRoot.displayName = 'Sheet.Root';\n\n// Trigger\n/** Element type for `Sheet.Trigger`. */\ntype SheetTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\n/** Props for `Sheet.Trigger` (expects a single element child). */\ninterface SheetTriggerProps extends ComponentPropsWithout<typeof DialogPrimitive.Trigger, RemovedProps> {}\nconst Trigger = React.forwardRef<SheetTriggerElement, SheetTriggerProps>(({ children, ...props }, ref) => (\n <DialogPrimitive.Trigger {...props} ref={ref} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Trigger>\n));\nTrigger.displayName = 'Sheet.Trigger';\n\n// Content\n/** Element type for `Sheet.Content`. */\n// Reuse dialog content prop defs for size/width/height tokens.\n// Built once at module scope: `extractProps` memoises on the identity of the\n// prop def objects it is handed, so rebuilding these per render would recompile\n// them every time a sheet renders.\nconst { align: _alignPropDef, ...dialogPropDefsForSheet } = dialogContentPropDefs;\nconst sheetPropDefs = dialogPropDefsForSheet;\n\n/** Counts the Sheet.Title elements mounted inside a Sheet.Content, for the dev-only name check. */\nconst SheetTitleCountContext = React.createContext<React.MutableRefObject<number> | null>(null);\n\ntype SheetContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ninterface SheetContentProps\n extends ComponentPropsWithout<typeof DialogPrimitive.Content, RemovedProps>,\n Omit<DialogContentOwnProps, 'align'> {\n /** Side where the Sheet should appear. `left`/`right` alias to `start`/`end`. */\n side?: SheetSide;\n /** Optional DOM container to portal into. Defaults to `document.body`. */\n container?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>['container'];\n}\n\n/**\n * Renders the Sheet panel. Normalizes left/right to logical start/end and\n * forwards dialog sizing props. Provide an accessible name via `Sheet.Title`\n * or `aria-label`.\n */\nconst Content = React.forwardRef<SheetContentElement, SheetContentProps>((allProps, forwardedRef) => {\n const { side = 'start', forceMount, container, className, ...ownProps } = allProps;\n const restProps = useThemeSizeProps(ownProps, sheetPropDefs.size);\n const normalizedSideMap: Record<SheetSide, 'start' | 'end' | 'top' | 'bottom'> = {\n left: 'start',\n right: 'end',\n start: 'start',\n end: 'end',\n top: 'top',\n bottom: 'bottom',\n };\n const normalizedSide = normalizedSideMap[side];\n // Size/width/height class names come from the dialog defs \u2014 see `sheetPropDefs`.\n const { className: extractedClassName, ...contentProps } = extractProps(restProps, sheetPropDefs);\n\n // Dev-only a11y guard: the panel needs a name. A Sheet.Title anywhere inside counts it\n // in a layout effect, which runs before this ref is attached, so nesting doesn't matter.\n const titleCountRef = React.useRef(0);\n const combinedRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n if (process.env.NODE_ENV !== 'production' && node) {\n const hasName = titleCountRef.current > 0 || Boolean(node.getAttribute('aria-label')) || Boolean(node.getAttribute('aria-labelledby'));\n if (!hasName) {\n console.warn('Sheet.Content: Missing accessible name. Include Sheet.Title inside it or provide aria-label.');\n }\n }\n },\n [forwardedRef],\n );\n\n useBodyPointerEventsCleanup();\n\n return (\n <DialogPrimitive.Portal container={container} forceMount={forceMount}>\n <SheetTitleCountContext.Provider value={titleCountRef}>\n <PortalTheme asChild>\n <DialogPrimitive.Overlay className=\"kui-BaseDialogOverlay kui-DialogOverlay kui-SheetOverlay\">\n <DialogPrimitive.Content\n {...contentProps}\n ref={combinedRef}\n className={classNames('kui-BaseDialogContent', 'kui-SheetContent', className, extractedClassName)}\n data-side={normalizedSide}\n aria-modal=\"true\"\n />\n </DialogPrimitive.Overlay>\n </PortalTheme>\n </SheetTitleCountContext.Provider>\n </DialogPrimitive.Portal>\n );\n});\nContent.displayName = 'Sheet.Content';\n\n// Title - renders as Heading with sensible defaults\ntype SheetTitleElement = React.ElementRef<typeof Heading>;\ntype SheetTitleProps = HeadingProps;\n/** Accessible title for the Sheet. Renders as Heading with sensible defaults. */\nconst Title = React.forwardRef<SheetTitleElement, SheetTitleProps>(({ size = '4', weight = 'medium', ...props }, ref) => {\n const titleCountRef = React.useContext(SheetTitleCountContext);\n React.useLayoutEffect(() => {\n if (!titleCountRef) return;\n titleCountRef.current += 1;\n return () => {\n titleCountRef.current -= 1;\n };\n }, [titleCountRef]);\n return (\n <DialogPrimitive.Title asChild>\n <Heading ref={ref} size={size} weight={weight} {...props} />\n </DialogPrimitive.Title>\n );\n});\nTitle.displayName = 'Sheet.Title';\n\n// Description - renders as Text with sensible defaults\ntype SheetDescriptionElement = React.ElementRef<typeof Text>;\ntype SheetDescriptionProps = React.ComponentPropsWithoutRef<typeof Text>;\n/** Supplementary description text for Sheet content. Renders as Text with sensible defaults. */\nconst Description = React.forwardRef<SheetDescriptionElement, SheetDescriptionProps>(({ size = '2', emphasis = 'medium', ...rest }, ref) => (\n <DialogPrimitive.Description asChild>\n <Text ref={ref} size={size} emphasis={emphasis} {...rest} />\n </DialogPrimitive.Description>\n));\nDescription.displayName = 'Sheet.Description';\n\ntype SheetCloseElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface SheetCloseProps extends ComponentPropsWithout<typeof DialogPrimitive.Close, RemovedProps> {}\n/** Close button for the Sheet. Expects a single element child rendered via `asChild`. */\nconst Close = React.forwardRef<SheetCloseElement, SheetCloseProps>(({ children, ...props }, ref) => (\n <DialogPrimitive.Close {...props} ref={ref} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Close>\n));\nClose.displayName = 'Sheet.Close';\n\nexport { Root, Trigger, Content, Title, Description, Close };\nexport type {\n SheetRootProps as RootProps,\n SheetTriggerProps as TriggerProps,\n SheetContentProps as ContentProps,\n SheetTitleProps as TitleProps,\n SheetDescriptionProps as DescriptionProps,\n SheetCloseProps as CloseProps,\n};\n"],
5
- "mappings": ";mWAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,YAAAC,EAAA,gBAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,YAAAC,IAkCA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,UAAUC,MAAuB,WA+B1C,IAAMC,EAAkCC,GAAU,gBAACC,EAAgB,KAAhB,CAAsB,GAAGD,EAAO,MAAK,GAAC,EACzFD,EAAK,YAAc,aAOnB,IAAMG,EAAgB,aAAmD,CAAC,CAAE,SAAAC,EAAU,GAAGH,CAAM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Q,CACvH,IAAMqB,EAAsB,aAAWf,CAAsB,EAC7D,OAAM,kBAAgB,IAAM,CAC1B,GAAKe,EACL,OAAAA,EAAc,SAAW,EAClB,IAAM,CACXA,EAAc,SAAW,CAC3B,CACF,EAAG,CAACA,CAAa,CAAC,EAEhB,gBAACxB,EAAgB,MAAhB,CAAsB,QAAO,IAC5B,gBAACiC,EAAA,CAAQ,IAAK9B,EAAK,KAAM4B,EAAM,OAAQC,EAAS,GAAGjC,EAAO,CAC5D,CAEJ,CAAC,EACD+B,EAAM,YAAc,cAMpB,IAAMI,EAAoB,aAA2D,CAAC,CAAE,KAAAH,EAAO,IAAK,SAAAI,EAAW,SAAU,GAAGC,CAAK,EAAGjC,IAClI,gBAACH,EAAgB,YAAhB,CAA4B,QAAO,IAClC,gBAACqC,EAAA,CAAK,IAAKlC,EAAK,KAAM4B,EAAM,SAAUI,EAAW,GAAGC,EAAM,CAC5D,CACD,EACDF,EAAY,YAAc,oBAK1B,IAAMI,EAAc,aAA+C,CAAC,CAAE,SAAApC,EAAU,GAAGH,CAAM,EAAGI,IAC1F,gBAACH,EAAgB,MAAhB,CAAuB,GAAGD,EAAO,IAAKI,EAAK,QAAO,IAChDC,EAAoBF,CAAQ,CAC/B,CACD,EACDoC,EAAM,YAAc",
6
- "names": ["sheet_exports", "__export", "Close", "Content", "Description", "Root", "Title", "Trigger", "React", "classNames", "DialogPrimitive", "Root", "props", "DialogPrimitive", "Trigger", "children", "ref", "requireReactElement", "_alignPropDef", "dialogPropDefsForSheet", "dialogContentPropDefs", "sheetPropDefs", "SheetTitleCountContext", "Content", "allProps", "forwardedRef", "side", "forceMount", "container", "className", "ownProps", "restProps", "useThemeSizeProps", "normalizedSide", "extractedClassName", "contentProps", "extractProps", "titleCountRef", "combinedRef", "node", "useBodyPointerEventsCleanup", "PortalTheme", "classNames", "Title", "size", "weight", "Heading", "Description", "emphasis", "rest", "Text", "Close"]
7
- }
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{a as v}from"./chunk-TGRHRMQI.js";import{a as d}from"./chunk-LPLW7OWA.js";import{a as P}from"./chunk-L54FWKJE.js";import{c as m}from"./chunk-OKQAVYW4.js";import{a as C}from"./chunk-AQKSO3SW.js";import{c as T}from"./chunk-5ON3XLRD.js";import{a as f}from"./chunk-CLJ6SEGP.js";import{a as k}from"./chunk-VQPANPMI.js";var I={};k(I,{Anchor:()=>x,Close:()=>g,Content:()=>y,Root:()=>u,Toolbar:()=>z,Trigger:()=>h});import*as o from"react";import i from"classnames";import{Popover as n}from"radix-ui";var M=["1","2","3","4"],c={...f,size:{type:"enum",className:"kui-r-size",values:M,default:"2",responsive:!0},width:P.width,minWidth:P.minWidth,maxWidth:{...P.maxWidth,default:"480px"},...d};var R=o.createContext(null),b=e=>{let r=o.useContext(R);return r},u=e=>o.createElement(n.Root,{...e});u.displayName="Popover.Root";var h=o.forwardRef(({children:e,...r},t)=>o.createElement(n.Trigger,{...r,ref:t,asChild:!0},v(e)));h.displayName="Popover.Trigger";var y=o.forwardRef((e,r)=>{let t=T(e,c.size),{className:s,forceMount:a,container:l,...p}=m(t,c),[L,A]=o.useState(void 0),S=o.useMemo(()=>({setLabelId:A}),[]);return o.createElement(n.Portal,{container:l,forceMount:a},o.createElement(C,{asChild:!0},o.createElement(n.Content,{align:"start",sideOffset:8,collisionPadding:10,...p,ref:r,"aria-labelledby":L??p["aria-labelledby"],className:i("kui-PopperContent","kui-PopoverContent",s)},o.createElement(R.Provider,{value:S},t.children))))});y.displayName="Popover.Content";var g=o.forwardRef(({children:e,...r},t)=>o.createElement(n.Close,{...r,ref:t,asChild:!0},v(e)));g.displayName="Popover.Close";var x=o.forwardRef((e,r)=>o.createElement(n.Anchor,{...e,ref:r}));x.displayName="Popover.Anchor";var E=o.forwardRef(({className:e,children:r,...t},s)=>(b("Popover.Toolbar"),o.createElement("div",{...t,ref:s,className:i("kui-PopoverToolbar",e)},r)));E.displayName="Popover.Toolbar";var w=o.forwardRef(({className:e,...r},t)=>o.createElement("div",{...r,ref:t,className:i("kui-PopoverToolbarSection","kui-PopoverToolbarLeft",e)}));w.displayName="Popover.Toolbar.Left";var D=o.forwardRef(({className:e,...r},t)=>o.createElement("div",{...r,ref:t,className:i("kui-PopoverToolbarSection","kui-PopoverToolbarCenter",e)}));D.displayName="Popover.Toolbar.Center";var N=o.forwardRef(({className:e,...r},t)=>o.createElement("div",{...r,ref:t,className:i("kui-PopoverToolbarSection","kui-PopoverToolbarRight",e)}));N.displayName="Popover.Toolbar.Right";var W=o.forwardRef(({className:e,id:r,...t},s)=>{let a=b("Popover.Toolbar.Title"),l=o.useId(),p=r??`kui-popover-toolbar-title-${l}`;return o.useEffect(()=>(a?.setLabelId(p),()=>a?.setLabelId(void 0)),[a,p]),o.createElement("span",{...t,id:p,ref:s,className:i("kui-PopoverToolbarTitle",e)})});W.displayName="Popover.Toolbar.Title";var z=Object.assign(E,{Left:w,Center:D,Right:N,Title:W});export{u as a,h as b,y as c,g as d,x as e,z as f,I as g};
3
- //# sourceMappingURL=chunk-MJKVVGGV.js.map