@funstack/ui 0.1.0-alpha.3 → 0.1.0-alpha.5

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 (230) hide show
  1. package/dist/accordion/accordion-root.mjs +2 -1
  2. package/dist/accordion/accordion-root.mjs.map +1 -1
  3. package/dist/combobox/combobox-clear.mjs +2 -1
  4. package/dist/combobox/combobox-clear.mjs.map +1 -1
  5. package/dist/combobox/combobox-list.mjs +2 -1
  6. package/dist/combobox/combobox-list.mjs.map +1 -1
  7. package/dist/combobox/combobox-popup.d.mts.map +1 -1
  8. package/dist/combobox/combobox-popup.mjs +7 -2
  9. package/dist/combobox/combobox-popup.mjs.map +1 -1
  10. package/dist/combobox/combobox-root.mjs +1 -1
  11. package/dist/combobox/combobox-trigger.mjs +2 -1
  12. package/dist/combobox/combobox-trigger.mjs.map +1 -1
  13. package/dist/dialog/dialog-close.mjs +2 -1
  14. package/dist/dialog/dialog-close.mjs.map +1 -1
  15. package/dist/dialog/dialog-form.d.mts +14 -8
  16. package/dist/dialog/dialog-form.d.mts.map +1 -1
  17. package/dist/dialog/dialog-form.mjs +36 -5
  18. package/dist/dialog/dialog-form.mjs.map +1 -1
  19. package/dist/dialog/dialog-popup.d.mts.map +1 -1
  20. package/dist/dialog/dialog-popup.mjs +13 -5
  21. package/dist/dialog/dialog-popup.mjs.map +1 -1
  22. package/dist/dialog/dialog-root.mjs +1 -1
  23. package/dist/dialog/dialog-trigger.mjs +2 -1
  24. package/dist/dialog/dialog-trigger.mjs.map +1 -1
  25. package/dist/field/field-root.mjs +5 -3
  26. package/dist/field/field-root.mjs.map +1 -1
  27. package/dist/form/form-root.mjs +2 -1
  28. package/dist/form/form-root.mjs.map +1 -1
  29. package/dist/form/form-submit.mjs +2 -1
  30. package/dist/form/form-submit.mjs.map +1 -1
  31. package/dist/index.d.mts +27 -1
  32. package/dist/index.mjs +6 -1
  33. package/dist/internal/announce.mjs +53 -0
  34. package/dist/internal/announce.mjs.map +1 -0
  35. package/dist/internal/decimal.mjs +27 -0
  36. package/dist/internal/decimal.mjs.map +1 -0
  37. package/dist/internal/dev-warn.mjs +17 -0
  38. package/dist/internal/dev-warn.mjs.map +1 -0
  39. package/dist/internal/field-context.mjs.map +1 -1
  40. package/dist/internal/range-value.mjs +51 -0
  41. package/dist/internal/range-value.mjs.map +1 -0
  42. package/dist/internal/render-element.mjs +54 -0
  43. package/dist/internal/render-element.mjs.map +1 -0
  44. package/dist/internal/toolbar-context.mjs +17 -0
  45. package/dist/internal/toolbar-context.mjs.map +1 -0
  46. package/dist/internal/use-exit-animation.mjs +26 -6
  47. package/dist/internal/use-exit-animation.mjs.map +1 -1
  48. package/dist/internal/use-field-control.mjs +5 -3
  49. package/dist/internal/use-field-control.mjs.map +1 -1
  50. package/dist/internal/use-popover-popup.mjs +3 -2
  51. package/dist/internal/use-popover-popup.mjs.map +1 -1
  52. package/dist/internal/use-popover-trigger.mjs +1 -1
  53. package/dist/internal/use-render.mjs +11 -34
  54. package/dist/internal/use-render.mjs.map +1 -1
  55. package/dist/internal/use-roving-focus.mjs +301 -0
  56. package/dist/internal/use-roving-focus.mjs.map +1 -0
  57. package/dist/menu/menu-checkbox-item.mjs +2 -1
  58. package/dist/menu/menu-checkbox-item.mjs.map +1 -1
  59. package/dist/menu/menu-item.mjs +2 -1
  60. package/dist/menu/menu-item.mjs.map +1 -1
  61. package/dist/menu/menu-popup.d.mts.map +1 -1
  62. package/dist/menu/menu-popup.mjs +7 -2
  63. package/dist/menu/menu-popup.mjs.map +1 -1
  64. package/dist/menu/menu-radio-item.mjs +2 -1
  65. package/dist/menu/menu-radio-item.mjs.map +1 -1
  66. package/dist/menu/menu-root.mjs +1 -1
  67. package/dist/menu/menu-trigger.d.mts +2 -1
  68. package/dist/menu/menu-trigger.d.mts.map +1 -1
  69. package/dist/menu/menu-trigger.mjs +15 -4
  70. package/dist/menu/menu-trigger.mjs.map +1 -1
  71. package/dist/meter/index.d.mts +24 -0
  72. package/dist/meter/index.d.mts.map +1 -0
  73. package/dist/meter/index.mjs +23 -0
  74. package/dist/meter/index.mjs.map +1 -0
  75. package/dist/meter/meter-context.mjs +13 -0
  76. package/dist/meter/meter-context.mjs.map +1 -0
  77. package/dist/meter/meter-indicator.d.mts +19 -0
  78. package/dist/meter/meter-indicator.d.mts.map +1 -0
  79. package/dist/meter/meter-indicator.mjs +25 -0
  80. package/dist/meter/meter-indicator.mjs.map +1 -0
  81. package/dist/meter/meter-label.d.mts +19 -0
  82. package/dist/meter/meter-label.d.mts.map +1 -0
  83. package/dist/meter/meter-label.mjs +28 -0
  84. package/dist/meter/meter-label.mjs.map +1 -0
  85. package/dist/meter/meter-region.d.mts +4 -0
  86. package/dist/meter/meter-region.d.mts.map +1 -0
  87. package/dist/meter/meter-region.mjs +39 -0
  88. package/dist/meter/meter-region.mjs.map +1 -0
  89. package/dist/meter/meter-root.d.mts +71 -0
  90. package/dist/meter/meter-root.d.mts.map +1 -0
  91. package/dist/meter/meter-root.mjs +83 -0
  92. package/dist/meter/meter-root.mjs.map +1 -0
  93. package/dist/meter/meter-track.d.mts +19 -0
  94. package/dist/meter/meter-track.d.mts.map +1 -0
  95. package/dist/meter/meter-track.mjs +25 -0
  96. package/dist/meter/meter-track.mjs.map +1 -0
  97. package/dist/meter/meter-value.d.mts +20 -0
  98. package/dist/meter/meter-value.d.mts.map +1 -0
  99. package/dist/meter/meter-value.mjs +29 -0
  100. package/dist/meter/meter-value.mjs.map +1 -0
  101. package/dist/number-field/index.d.mts +26 -0
  102. package/dist/number-field/index.d.mts.map +1 -0
  103. package/dist/number-field/index.mjs +26 -0
  104. package/dist/number-field/index.mjs.map +1 -0
  105. package/dist/number-field/number-field-arithmetic.mjs +78 -0
  106. package/dist/number-field/number-field-arithmetic.mjs.map +1 -0
  107. package/dist/number-field/number-field-context.d.mts +2 -0
  108. package/dist/number-field/number-field-context.mjs +13 -0
  109. package/dist/number-field/number-field-context.mjs.map +1 -0
  110. package/dist/number-field/number-field-decrement.d.mts +16 -0
  111. package/dist/number-field/number-field-decrement.d.mts.map +1 -0
  112. package/dist/number-field/number-field-decrement.mjs +19 -0
  113. package/dist/number-field/number-field-decrement.mjs.map +1 -0
  114. package/dist/number-field/number-field-format.mjs +279 -0
  115. package/dist/number-field/number-field-format.mjs.map +1 -0
  116. package/dist/number-field/number-field-increment.d.mts +32 -0
  117. package/dist/number-field/number-field-increment.d.mts.map +1 -0
  118. package/dist/number-field/number-field-increment.mjs +68 -0
  119. package/dist/number-field/number-field-increment.mjs.map +1 -0
  120. package/dist/number-field/number-field-input.d.mts +29 -0
  121. package/dist/number-field/number-field-input.d.mts.map +1 -0
  122. package/dist/number-field/number-field-input.mjs +163 -0
  123. package/dist/number-field/number-field-input.mjs.map +1 -0
  124. package/dist/number-field/number-field-label.d.mts +23 -0
  125. package/dist/number-field/number-field-label.d.mts.map +1 -0
  126. package/dist/number-field/number-field-label.mjs +47 -0
  127. package/dist/number-field/number-field-label.mjs.map +1 -0
  128. package/dist/number-field/number-field-root.d.mts +108 -0
  129. package/dist/number-field/number-field-root.d.mts.map +1 -0
  130. package/dist/number-field/number-field-root.mjs +523 -0
  131. package/dist/number-field/number-field-root.mjs.map +1 -0
  132. package/dist/number-field/use-step-button.mjs +107 -0
  133. package/dist/number-field/use-step-button.mjs.map +1 -0
  134. package/dist/popover/popover-close.mjs +2 -1
  135. package/dist/popover/popover-close.mjs.map +1 -1
  136. package/dist/popover/popover-popup.d.mts.map +1 -1
  137. package/dist/popover/popover-popup.mjs +7 -2
  138. package/dist/popover/popover-popup.mjs.map +1 -1
  139. package/dist/popover/popover-root.mjs +1 -1
  140. package/dist/progress/index.d.mts +24 -0
  141. package/dist/progress/index.d.mts.map +1 -0
  142. package/dist/progress/index.mjs +24 -0
  143. package/dist/progress/index.mjs.map +1 -0
  144. package/dist/progress/progress-context.mjs +13 -0
  145. package/dist/progress/progress-context.mjs.map +1 -0
  146. package/dist/progress/progress-indicator.d.mts +19 -0
  147. package/dist/progress/progress-indicator.d.mts.map +1 -0
  148. package/dist/progress/progress-indicator.mjs +29 -0
  149. package/dist/progress/progress-indicator.mjs.map +1 -0
  150. package/dist/progress/progress-label.d.mts +19 -0
  151. package/dist/progress/progress-label.d.mts.map +1 -0
  152. package/dist/progress/progress-label.mjs +30 -0
  153. package/dist/progress/progress-label.mjs.map +1 -0
  154. package/dist/progress/progress-root.d.mts +68 -0
  155. package/dist/progress/progress-root.d.mts.map +1 -0
  156. package/dist/progress/progress-root.mjs +80 -0
  157. package/dist/progress/progress-root.mjs.map +1 -0
  158. package/dist/progress/progress-track.d.mts +19 -0
  159. package/dist/progress/progress-track.d.mts.map +1 -0
  160. package/dist/progress/progress-track.mjs +29 -0
  161. package/dist/progress/progress-track.mjs.map +1 -0
  162. package/dist/progress/progress-value.d.mts +20 -0
  163. package/dist/progress/progress-value.d.mts.map +1 -0
  164. package/dist/progress/progress-value.mjs +33 -0
  165. package/dist/progress/progress-value.mjs.map +1 -0
  166. package/dist/slider/slider-arithmetic.mjs +1 -17
  167. package/dist/slider/slider-arithmetic.mjs.map +1 -1
  168. package/dist/slider/slider-root.mjs +3 -2
  169. package/dist/slider/slider-root.mjs.map +1 -1
  170. package/dist/slider/slider-thumb.mjs +2 -1
  171. package/dist/slider/slider-thumb.mjs.map +1 -1
  172. package/dist/slider/slider-track.mjs +2 -1
  173. package/dist/slider/slider-track.mjs.map +1 -1
  174. package/dist/tabs/tabs-indicator.mjs +2 -1
  175. package/dist/tabs/tabs-indicator.mjs.map +1 -1
  176. package/dist/tabs/tabs-tab.mjs +2 -1
  177. package/dist/tabs/tabs-tab.mjs.map +1 -1
  178. package/dist/toast/toast-action.mjs +2 -1
  179. package/dist/toast/toast-action.mjs.map +1 -1
  180. package/dist/toast/toast-close.mjs +2 -1
  181. package/dist/toast/toast-close.mjs.map +1 -1
  182. package/dist/toast/toast-root.mjs +3 -2
  183. package/dist/toast/toast-root.mjs.map +1 -1
  184. package/dist/toast/toast-viewport.d.mts.map +1 -1
  185. package/dist/toast/toast-viewport.mjs +30 -7
  186. package/dist/toast/toast-viewport.mjs.map +1 -1
  187. package/dist/toast/toast.d.mts.map +1 -1
  188. package/dist/toast/toast.mjs +5 -1
  189. package/dist/toast/toast.mjs.map +1 -1
  190. package/dist/toggle/toggle.mjs +2 -1
  191. package/dist/toggle/toggle.mjs.map +1 -1
  192. package/dist/toggle-group/index.d.mts +16 -0
  193. package/dist/toggle-group/index.d.mts.map +1 -0
  194. package/dist/toggle-group/index.mjs +15 -0
  195. package/dist/toggle-group/index.mjs.map +1 -0
  196. package/dist/toggle-group/toggle-group-context.d.mts +4 -0
  197. package/dist/toggle-group/toggle-group-context.d.mts.map +1 -0
  198. package/dist/toggle-group/toggle-group-context.mjs +13 -0
  199. package/dist/toggle-group/toggle-group-context.mjs.map +1 -0
  200. package/dist/toggle-group/toggle-group-item.d.mts +47 -0
  201. package/dist/toggle-group/toggle-group-item.d.mts.map +1 -0
  202. package/dist/toggle-group/toggle-group-item.mjs +63 -0
  203. package/dist/toggle-group/toggle-group-item.mjs.map +1 -0
  204. package/dist/toggle-group/toggle-group-root.d.mts +95 -0
  205. package/dist/toggle-group/toggle-group-root.d.mts.map +1 -0
  206. package/dist/toggle-group/toggle-group-root.mjs +211 -0
  207. package/dist/toggle-group/toggle-group-root.mjs.map +1 -0
  208. package/dist/toolbar/index.d.mts +18 -0
  209. package/dist/toolbar/index.d.mts.map +1 -0
  210. package/dist/toolbar/index.mjs +18 -0
  211. package/dist/toolbar/index.mjs.map +1 -0
  212. package/dist/toolbar/toolbar-button.d.mts +42 -0
  213. package/dist/toolbar/toolbar-button.d.mts.map +1 -0
  214. package/dist/toolbar/toolbar-button.mjs +50 -0
  215. package/dist/toolbar/toolbar-button.mjs.map +1 -0
  216. package/dist/toolbar/toolbar-root.d.mts +38 -0
  217. package/dist/toolbar/toolbar-root.d.mts.map +1 -0
  218. package/dist/toolbar/toolbar-root.mjs +66 -0
  219. package/dist/toolbar/toolbar-root.mjs.map +1 -0
  220. package/dist/toolbar/toolbar-separator.d.mts +25 -0
  221. package/dist/toolbar/toolbar-separator.d.mts.map +1 -0
  222. package/dist/toolbar/toolbar-separator.mjs +31 -0
  223. package/dist/toolbar/toolbar-separator.mjs.map +1 -0
  224. package/dist/tooltip/tooltip-popup.mjs +2 -1
  225. package/dist/tooltip/tooltip-popup.mjs.map +1 -1
  226. package/dist/tooltip/tooltip-root.mjs +18 -2
  227. package/dist/tooltip/tooltip-root.mjs.map +1 -1
  228. package/dist/tooltip/tooltip-trigger.mjs +2 -1
  229. package/dist/tooltip/tooltip-trigger.mjs.map +1 -1
  230. package/package.json +6 -1
@@ -0,0 +1,107 @@
1
+ "use client";
2
+ import { useEffect, useRef } from "react";
3
+ /**
4
+ * The press-and-hold of `NumberField.Increment` / `Decrement` (design 4.3): one step at
5
+ * `pointerdown`, a repeat after 400 ms then every 60 ms, one commit at the release
6
+ * (`pointerup`, `pointercancel`, `lostpointercapture`, or `blur` on the window). The press is
7
+ * `preventDefault()`ed so focus stays where it is. A `click` with no pointer gesture before it
8
+ * (assistive technology: `detail === 0`) is a one-step gesture.
9
+ */
10
+ function useStepButton(ctx, direction, disabled) {
11
+ const active = useRef(null);
12
+ /** A pointer gesture started on this button; the click that follows it is not an activation. */
13
+ const pointerSeen = useRef(false);
14
+ const latest = useRef({
15
+ ctx,
16
+ disabled
17
+ });
18
+ useEffect(() => {
19
+ latest.current = {
20
+ ctx,
21
+ disabled
22
+ };
23
+ });
24
+ useEffect(() => () => {
25
+ active.current?.detach();
26
+ active.current = null;
27
+ }, []);
28
+ const onPointerDown = (event) => {
29
+ if (event.button !== 0 || !event.isPrimary) return;
30
+ if (disabled || active.current !== null) return;
31
+ const element = event.currentTarget;
32
+ const native = event.nativeEvent;
33
+ event.preventDefault();
34
+ pointerSeen.current = true;
35
+ const pointerId = native.pointerId;
36
+ try {
37
+ element.setPointerCapture(pointerId);
38
+ } catch {}
39
+ let timer;
40
+ const view = element.ownerDocument.defaultView;
41
+ const detach = () => {
42
+ if (timer !== void 0) clearTimeout(timer);
43
+ timer = void 0;
44
+ element.removeEventListener("pointerup", onEnd);
45
+ element.removeEventListener("pointercancel", onEnd);
46
+ element.removeEventListener("lostpointercapture", onEnd);
47
+ view?.removeEventListener("blur", onBlur);
48
+ if (active.current?.pointerId === pointerId) active.current = null;
49
+ setTimeout(() => {
50
+ pointerSeen.current = false;
51
+ }, 0);
52
+ };
53
+ function onEnd(endEvent) {
54
+ if (endEvent.pointerId !== pointerId) return;
55
+ detach();
56
+ latest.current.ctx.endHold(direction, endEvent);
57
+ }
58
+ function onBlur(blurEvent) {
59
+ detach();
60
+ latest.current.ctx.endHold(direction, blurEvent);
61
+ }
62
+ const tick = () => {
63
+ timer = setTimeout(() => {
64
+ timer = void 0;
65
+ if (latest.current.ctx.tickHold(direction, void 0)) tick();
66
+ else detach();
67
+ }, 60);
68
+ };
69
+ if (!ctx.beginHold(direction, native)) {
70
+ detach();
71
+ return;
72
+ }
73
+ element.addEventListener("pointerup", onEnd);
74
+ element.addEventListener("pointercancel", onEnd);
75
+ element.addEventListener("lostpointercapture", onEnd);
76
+ view?.addEventListener("blur", onBlur);
77
+ active.current = {
78
+ pointerId,
79
+ detach
80
+ };
81
+ timer = setTimeout(() => {
82
+ timer = void 0;
83
+ if (latest.current.ctx.tickHold(direction, void 0)) tick();
84
+ else detach();
85
+ }, 400);
86
+ };
87
+ const onClick = (event) => {
88
+ if (pointerSeen.current || active.current !== null || event.detail !== 0) {
89
+ pointerSeen.current = false;
90
+ return;
91
+ }
92
+ if (disabled) return;
93
+ ctx.activate(direction, event.nativeEvent);
94
+ };
95
+ const onContextMenu = (event) => {
96
+ if (active.current !== null) event.preventDefault();
97
+ };
98
+ return {
99
+ onPointerDown,
100
+ onClick,
101
+ onContextMenu
102
+ };
103
+ }
104
+ //#endregion
105
+ export { useStepButton };
106
+
107
+ //# sourceMappingURL=use-step-button.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-step-button.mjs","names":[],"sources":["../../src/number-field/use-step-button.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport type { MouseEvent as ReactMouseEvent, PointerEvent as ReactPointerEvent } from \"react\";\nimport type { NumberFieldContextValue, StepDirection } from \"./number-field-context.js\";\n\n/** First repeat after the press, then the interval between repeats (Base UI, React Aria). */\nexport const HOLD_DELAY = 400;\nexport const HOLD_INTERVAL = 60;\n\ninterface ActiveHold {\n readonly pointerId: number;\n readonly detach: () => void;\n}\n\nexport interface StepButtonHandlers {\n readonly onPointerDown: (event: ReactPointerEvent<HTMLElement>) => void;\n readonly onClick: (event: ReactMouseEvent<HTMLElement>) => void;\n readonly onContextMenu: (event: ReactMouseEvent<HTMLElement>) => void;\n}\n\n/**\n * The press-and-hold of `NumberField.Increment` / `Decrement` (design 4.3): one step at\n * `pointerdown`, a repeat after 400 ms then every 60 ms, one commit at the release\n * (`pointerup`, `pointercancel`, `lostpointercapture`, or `blur` on the window). The press is\n * `preventDefault()`ed so focus stays where it is. A `click` with no pointer gesture before it\n * (assistive technology: `detail === 0`) is a one-step gesture.\n */\nexport function useStepButton(\n ctx: NumberFieldContextValue,\n direction: StepDirection,\n disabled: boolean,\n): StepButtonHandlers {\n const active = useRef<ActiveHold | null>(null);\n /** A pointer gesture started on this button; the click that follows it is not an activation. */\n const pointerSeen = useRef(false);\n const latest = useRef({ ctx, disabled });\n useEffect(() => {\n latest.current = { ctx, disabled };\n });\n\n // An unmount mid-hold leaves no timer or listener behind.\n useEffect(\n () => () => {\n active.current?.detach();\n active.current = null;\n },\n [],\n );\n\n const onPointerDown = (event: ReactPointerEvent<HTMLElement>): void => {\n if (event.button !== 0 || !event.isPrimary) return;\n if (disabled || active.current !== null) return;\n const element = event.currentTarget;\n const native = event.nativeEvent;\n // No focus move off the input, no touch keyboard, no text selection.\n event.preventDefault();\n pointerSeen.current = true;\n const pointerId = native.pointerId;\n try {\n element.setPointerCapture(pointerId);\n } catch {\n // An inactive pointer id (a synthetic event): the hold still follows the element.\n }\n\n let timer: ReturnType<typeof setTimeout> | undefined;\n const view = element.ownerDocument.defaultView;\n const detach = (): void => {\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n element.removeEventListener(\"pointerup\", onEnd);\n element.removeEventListener(\"pointercancel\", onEnd);\n element.removeEventListener(\"lostpointercapture\", onEnd);\n view?.removeEventListener(\"blur\", onBlur);\n if (active.current?.pointerId === pointerId) active.current = null;\n // A click that follows this release (same task, or a touch tap later) is ignored; an\n // activation without a pointer afterwards is not.\n setTimeout(() => {\n pointerSeen.current = false;\n }, 0);\n };\n function onEnd(endEvent: Event): void {\n if ((endEvent as PointerEvent).pointerId !== pointerId) return;\n detach();\n latest.current.ctx.endHold(direction, endEvent);\n }\n function onBlur(blurEvent: Event): void {\n detach();\n latest.current.ctx.endHold(direction, blurEvent);\n }\n const tick = (): void => {\n timer = setTimeout(() => {\n timer = undefined;\n if (latest.current.ctx.tickHold(direction, undefined)) tick();\n else detach();\n }, HOLD_INTERVAL);\n };\n\n if (!ctx.beginHold(direction, native)) {\n // The first step reached the bound: the hold already committed.\n detach();\n return;\n }\n element.addEventListener(\"pointerup\", onEnd);\n element.addEventListener(\"pointercancel\", onEnd);\n element.addEventListener(\"lostpointercapture\", onEnd);\n view?.addEventListener(\"blur\", onBlur);\n active.current = { pointerId, detach };\n timer = setTimeout(() => {\n timer = undefined;\n if (latest.current.ctx.tickHold(direction, undefined)) tick();\n else detach();\n }, HOLD_DELAY);\n };\n\n const onClick = (event: ReactMouseEvent<HTMLElement>): void => {\n if (pointerSeen.current || active.current !== null || event.detail !== 0) {\n pointerSeen.current = false;\n return;\n }\n if (disabled) return;\n ctx.activate(direction, event.nativeEvent);\n };\n\n const onContextMenu = (event: ReactMouseEvent<HTMLElement>): void => {\n // A touch long-press would open the context menu mid-hold.\n if (active.current !== null) event.preventDefault();\n };\n\n return { onPointerDown, onClick, onContextMenu };\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,cACd,KACA,WACA,UACoB;CACpB,MAAM,SAAS,OAA0B,IAAI;;CAE7C,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,SAAS,OAAO;EAAE;EAAK;CAAS,CAAC;CACvC,gBAAgB;EACd,OAAO,UAAU;GAAE;GAAK;EAAS;CACnC,CAAC;CAGD,sBACc;EACV,OAAO,SAAS,OAAO;EACvB,OAAO,UAAU;CACnB,GACA,CAAC,CACH;CAEA,MAAM,iBAAiB,UAAgD;EACrE,IAAI,MAAM,WAAW,KAAK,CAAC,MAAM,WAAW;EAC5C,IAAI,YAAY,OAAO,YAAY,MAAM;EACzC,MAAM,UAAU,MAAM;EACtB,MAAM,SAAS,MAAM;EAErB,MAAM,eAAe;EACrB,YAAY,UAAU;EACtB,MAAM,YAAY,OAAO;EACzB,IAAI;GACF,QAAQ,kBAAkB,SAAS;EACrC,QAAQ,CAER;EAEA,IAAI;EACJ,MAAM,OAAO,QAAQ,cAAc;EACnC,MAAM,eAAqB;GACzB,IAAI,UAAU,KAAA,GAAW,aAAa,KAAK;GAC3C,QAAQ,KAAA;GACR,QAAQ,oBAAoB,aAAa,KAAK;GAC9C,QAAQ,oBAAoB,iBAAiB,KAAK;GAClD,QAAQ,oBAAoB,sBAAsB,KAAK;GACvD,MAAM,oBAAoB,QAAQ,MAAM;GACxC,IAAI,OAAO,SAAS,cAAc,WAAW,OAAO,UAAU;GAG9D,iBAAiB;IACf,YAAY,UAAU;GACxB,GAAG,CAAC;EACN;EACA,SAAS,MAAM,UAAuB;GACpC,IAAK,SAA0B,cAAc,WAAW;GACxD,OAAO;GACP,OAAO,QAAQ,IAAI,QAAQ,WAAW,QAAQ;EAChD;EACA,SAAS,OAAO,WAAwB;GACtC,OAAO;GACP,OAAO,QAAQ,IAAI,QAAQ,WAAW,SAAS;EACjD;EACA,MAAM,aAAmB;GACvB,QAAQ,iBAAiB;IACvB,QAAQ,KAAA;IACR,IAAI,OAAO,QAAQ,IAAI,SAAS,WAAW,KAAA,CAAS,GAAG,KAAK;SACvD,OAAO;GACd,GAAA,EAAgB;EAClB;EAEA,IAAI,CAAC,IAAI,UAAU,WAAW,MAAM,GAAG;GAErC,OAAO;GACP;EACF;EACA,QAAQ,iBAAiB,aAAa,KAAK;EAC3C,QAAQ,iBAAiB,iBAAiB,KAAK;EAC/C,QAAQ,iBAAiB,sBAAsB,KAAK;EACpD,MAAM,iBAAiB,QAAQ,MAAM;EACrC,OAAO,UAAU;GAAE;GAAW;EAAO;EACrC,QAAQ,iBAAiB;GACvB,QAAQ,KAAA;GACR,IAAI,OAAO,QAAQ,IAAI,SAAS,WAAW,KAAA,CAAS,GAAG,KAAK;QACvD,OAAO;EACd,GAAA,GAAa;CACf;CAEA,MAAM,WAAW,UAA8C;EAC7D,IAAI,YAAY,WAAW,OAAO,YAAY,QAAQ,MAAM,WAAW,GAAG;GACxE,YAAY,UAAU;GACtB;EACF;EACA,IAAI,UAAU;EACd,IAAI,SAAS,WAAW,MAAM,WAAW;CAC3C;CAEA,MAAM,iBAAiB,UAA8C;EAEnE,IAAI,OAAO,YAAY,MAAM,MAAM,eAAe;CACpD;CAEA,OAAO;EAAE;EAAe;EAAS;CAAc;AACjD"}
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import { createActionDetails } from "../internal/action-details.mjs";
3
3
  import { dataAttr } from "../internal/data-attr.mjs";
4
- import { rendersButton, useRender } from "../internal/use-render.mjs";
4
+ import { rendersButton } from "../internal/render-element.mjs";
5
+ import { useRender } from "../internal/use-render.mjs";
5
6
  import { useActionTrigger } from "../internal/use-action-trigger.mjs";
6
7
  import { usePopoverContext } from "./popover-context.mjs";
7
8
  import { useCallback } from "react";
@@ -1 +1 @@
1
- {"version":3,"file":"popover-close.mjs","names":[],"sources":["../../src/popover/popover-close.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { Action, ActionDetails, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport interface PopoverCloseState {\n /** The `action` is in flight. */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface PopoverCloseProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs inside this part's own transition (`data-pending` on the button), then closes the\n * popover: in library mode through the Root (`openChangeAction(false)` awaited, view\n * transition if set), in JS-free mode with `hidePopover()`. A rejection reaches the nearest\n * Error Boundary above the Close part and leaves the popover open. If the popover was\n * dismissed and opened again while the action ran, the close is dropped. Without `action` in JS-free\n * mode the button is a native `command=\"hide-popover\"` invoker.\n */\n action?: Action<[details: ActionDetails]>;\n /** Native `disabled`; owned, so a `render` element cannot re-enable the button. */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverCloseState>;\n style?: StateValue<CSSProperties | undefined, PopoverCloseState>;\n children?: StateValue<ReactNode, PopoverCloseState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverCloseState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nfunction isPopoverOpen(element: Element): boolean {\n try {\n return element.matches(\":popover-open\");\n } catch {\n return false;\n }\n}\n\n/**\n * A close button: `<button type=\"button\" commandfor command=\"hide-popover\">`. In JS-free mode\n * without `action` the browser hides the popover. In library mode the click is always cancelled\n * and the close goes through the Root (`openChangeAction(false)` awaited, `hidePopover()` in the\n * commit). With `action` the action runs first in this part's own transition (`data-pending` on\n * the button); a rejection leaves the popover open.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,\n * `command`, `onClick` (library mode, or with `action`), `data-pending`, `data-disabled`.\n */\nexport function PopoverClose({\n action,\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverCloseProps) {\n const ctx = usePopoverContext(\"Popover.Close\");\n const { ids, popupRef, recordCloseIntent, openGeneration } = ctx;\n const { pending, run } = useActionTrigger(openGeneration);\n const isLibrary = ctx.mode === \"library\";\n const hasAction = action !== undefined;\n const installClick = isLibrary || hasAction;\n\n const state: PopoverCloseState = { pending, disabled };\n\n const devRef = useCallback(\n (element: HTMLElement) => {\n if (isDev && !installClick && element.tagName !== \"BUTTON\") {\n console.error(\n `Popover.Close: rendered a <${element.tagName.toLowerCase()}> in JS-free mode without ` +\n '`action`. Only a <button> runs `command=\"hide-popover\"`; this element will not ' +\n \"close the popover.\",\n );\n }\n // A cleanup, so the merged ref never calls back with `null`.\n return () => {};\n },\n [installClick],\n );\n\n const close = (event: Event): void => {\n if (isLibrary) {\n // A library-owned close (design 2.3): awaited, then hidden in the commit.\n ctx.requestClose(event, \"activate\");\n return;\n }\n // JS-free mode with `action`: a browser-owned close; there is no Root state to notify.\n const popup = popupRef.current;\n if (popup === null || !popup.isConnected || !isPopoverOpen(popup)) return;\n recordCloseIntent({ reason: \"activate\", event });\n popup.hidePopover();\n };\n\n const onClick = (event: MouseEvent<HTMLElement>) => {\n // Cancelling the click cancels the command.\n event.preventDefault();\n if (disabled) return;\n const native = event.nativeEvent;\n if (action === undefined) {\n close(native);\n return;\n }\n const details = createActionDetails(native, {});\n // Repeated clicks re-run the action; the first close wins (design 3.4). A close whose open\n // was superseded by a newer one (dismissed and re-opened meanwhile) is dropped by the hook.\n run(\n () => action(details),\n () => close(native),\n );\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Close.\n disabled,\n commandfor: ids.popup,\n command: \"hide-popover\",\n ...(installClick && { onClick }),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, PopoverCloseState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: devRef,\n });\n}\n\nPopoverClose.displayName = \"PopoverClose\";\n"],"mappings":";;;;;;;;AAsCA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,SAAS,cAAc,SAA2B;CAChD,IAAI;EACF,OAAO,QAAQ,QAAQ,eAAe;CACxC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;;;AAYA,SAAgB,aAAa,EAC3B,QACA,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,EAAE,KAAK,UAAU,mBAAmB,mBAAmB;CAC7D,MAAM,EAAE,SAAS,QAAQ,iBAAiB,cAAc;CACxD,MAAM,YAAY,IAAI,SAAS;CAE/B,MAAM,eAAe,aADH,WAAW,KAAA;CAG7B,MAAM,QAA2B;EAAE;EAAS;CAAS;CAErD,MAAM,SAAS,aACZ,YAAyB;EACxB,IAAI,SAAS,CAAC,gBAAgB,QAAQ,YAAY,UAChD,QAAQ,MACN,8BAA8B,QAAQ,QAAQ,YAAY,EAAE,gIAG9D;EAGF,aAAa,CAAC;CAChB,GACA,CAAC,YAAY,CACf;CAEA,MAAM,SAAS,UAAuB;EACpC,IAAI,WAAW;GAEb,IAAI,aAAa,OAAO,UAAU;GAClC;EACF;EAEA,MAAM,QAAQ,SAAS;EACvB,IAAI,UAAU,QAAQ,CAAC,MAAM,eAAe,CAAC,cAAc,KAAK,GAAG;EACnE,kBAAkB;GAAE,QAAQ;GAAY;EAAM,CAAC;EAC/C,MAAM,YAAY;CACpB;CAEA,MAAM,WAAW,UAAmC;EAElD,MAAM,eAAe;EACrB,IAAI,UAAU;EACd,MAAM,SAAS,MAAM;EACrB,IAAI,WAAW,KAAA,GAAW;GACxB,MAAM,MAAM;GACZ;EACF;EACA,MAAM,UAAU,oBAAoB,QAAQ,CAAC,CAAC;EAG9C,UACQ,OAAO,OAAO,SACd,MAAM,MAAM,CACpB;CACF;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EAEvD;EACA,YAAY,IAAI;EAChB,SAAS;EACT,GAAI,gBAAgB,EAAE,QAAQ;EAC9B,gBAAgB,SAAS,OAAO;EAChC,iBAAiB,SAAS,QAAQ;CACpC;CAEA,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;AACH;AAEA,aAAa,cAAc"}
1
+ {"version":3,"file":"popover-close.mjs","names":[],"sources":["../../src/popover/popover-close.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { Action, ActionDetails, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { usePopoverContext } from \"./popover-context.js\";\n\nexport interface PopoverCloseState {\n /** The `action` is in flight. */\n readonly pending: boolean;\n readonly disabled: boolean;\n}\n\nexport interface PopoverCloseProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs inside this part's own transition (`data-pending` on the button), then closes the\n * popover: in library mode through the Root (`openChangeAction(false)` awaited, view\n * transition if set), in JS-free mode with `hidePopover()`. A rejection reaches the nearest\n * Error Boundary above the Close part and leaves the popover open. If the popover was\n * dismissed and opened again while the action ran, the close is dropped. Without `action` in JS-free\n * mode the button is a native `command=\"hide-popover\"` invoker.\n */\n action?: Action<[details: ActionDetails]>;\n /** Native `disabled`; owned, so a `render` element cannot re-enable the button. */\n disabled?: boolean;\n className?: StateValue<string | undefined, PopoverCloseState>;\n style?: StateValue<CSSProperties | undefined, PopoverCloseState>;\n children?: StateValue<ReactNode, PopoverCloseState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, PopoverCloseState>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nfunction isPopoverOpen(element: Element): boolean {\n try {\n return element.matches(\":popover-open\");\n } catch {\n return false;\n }\n}\n\n/**\n * A close button: `<button type=\"button\" commandfor command=\"hide-popover\">`. In JS-free mode\n * without `action` the browser hides the popover. In library mode the click is always cancelled\n * and the close goes through the Root (`openChangeAction(false)` awaited, `hidePopover()` in the\n * commit). With `action` the action runs first in this part's own transition (`data-pending` on\n * the button); a rejection leaves the popover open.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `disabled`, `commandfor`,\n * `command`, `onClick` (library mode, or with `action`), `data-pending`, `data-disabled`.\n */\nexport function PopoverClose({\n action,\n disabled = false,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverCloseProps) {\n const ctx = usePopoverContext(\"Popover.Close\");\n const { ids, popupRef, recordCloseIntent, openGeneration } = ctx;\n const { pending, run } = useActionTrigger(openGeneration);\n const isLibrary = ctx.mode === \"library\";\n const hasAction = action !== undefined;\n const installClick = isLibrary || hasAction;\n\n const state: PopoverCloseState = { pending, disabled };\n\n const devRef = useCallback(\n (element: HTMLElement) => {\n if (isDev && !installClick && element.tagName !== \"BUTTON\") {\n console.error(\n `Popover.Close: rendered a <${element.tagName.toLowerCase()}> in JS-free mode without ` +\n '`action`. Only a <button> runs `command=\"hide-popover\"`; this element will not ' +\n \"close the popover.\",\n );\n }\n // A cleanup, so the merged ref never calls back with `null`.\n return () => {};\n },\n [installClick],\n );\n\n const close = (event: Event): void => {\n if (isLibrary) {\n // A library-owned close (design 2.3): awaited, then hidden in the commit.\n ctx.requestClose(event, \"activate\");\n return;\n }\n // JS-free mode with `action`: a browser-owned close; there is no Root state to notify.\n const popup = popupRef.current;\n if (popup === null || !popup.isConnected || !isPopoverOpen(popup)) return;\n recordCloseIntent({ reason: \"activate\", event });\n popup.hidePopover();\n };\n\n const onClick = (event: MouseEvent<HTMLElement>) => {\n // Cancelling the click cancels the command.\n event.preventDefault();\n if (disabled) return;\n const native = event.nativeEvent;\n if (action === undefined) {\n close(native);\n return;\n }\n const details = createActionDetails(native, {});\n // Repeated clicks re-run the action; the first close wins (design 3.4). A close whose open\n // was superseded by a newer one (dismissed and re-opened meanwhile) is dropped by the hook.\n run(\n () => action(details),\n () => close(native),\n );\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n // Owned: a render element must not re-enable a disabled Close.\n disabled,\n commandfor: ids.popup,\n command: \"hide-popover\",\n ...(installClick && { onClick }),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n };\n\n return useRender<ComponentPropsWithRef<\"button\">, PopoverCloseState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps,\n ref: devRef,\n });\n}\n\nPopoverClose.displayName = \"PopoverClose\";\n"],"mappings":";;;;;;;;;AAsCA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,SAAS,cAAc,SAA2B;CAChD,IAAI;EACF,OAAO,QAAQ,QAAQ,eAAe;CACxC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;;;AAYA,SAAgB,aAAa,EAC3B,QACA,WAAW,OACX,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,EAAE,KAAK,UAAU,mBAAmB,mBAAmB;CAC7D,MAAM,EAAE,SAAS,QAAQ,iBAAiB,cAAc;CACxD,MAAM,YAAY,IAAI,SAAS;CAE/B,MAAM,eAAe,aADH,WAAW,KAAA;CAG7B,MAAM,QAA2B;EAAE;EAAS;CAAS;CAErD,MAAM,SAAS,aACZ,YAAyB;EACxB,IAAI,SAAS,CAAC,gBAAgB,QAAQ,YAAY,UAChD,QAAQ,MACN,8BAA8B,QAAQ,QAAQ,YAAY,EAAE,gIAG9D;EAGF,aAAa,CAAC;CAChB,GACA,CAAC,YAAY,CACf;CAEA,MAAM,SAAS,UAAuB;EACpC,IAAI,WAAW;GAEb,IAAI,aAAa,OAAO,UAAU;GAClC;EACF;EAEA,MAAM,QAAQ,SAAS;EACvB,IAAI,UAAU,QAAQ,CAAC,MAAM,eAAe,CAAC,cAAc,KAAK,GAAG;EACnE,kBAAkB;GAAE,QAAQ;GAAY;EAAM,CAAC;EAC/C,MAAM,YAAY;CACpB;CAEA,MAAM,WAAW,UAAmC;EAElD,MAAM,eAAe;EACrB,IAAI,UAAU;EACd,MAAM,SAAS,MAAM;EACrB,IAAI,WAAW,KAAA,GAAW;GACxB,MAAM,MAAM;GACZ;EACF;EACA,MAAM,UAAU,oBAAoB,QAAQ,CAAC,CAAC;EAG9C,UACQ,OAAO,OAAO,SACd,MAAM,MAAM,CACpB;CACF;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EAEvD;EACA,YAAY,IAAI;EAChB,SAAS;EACT,GAAI,gBAAgB,EAAE,QAAQ;EAC9B,gBAAgB,SAAS,OAAO;EAChC,iBAAiB,SAAS,QAAQ;CACpC;CAEA,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;AACH;AAEA,aAAa,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"popover-popup.d.mts","names":[],"sources":["../../src/popover/popover-popup.tsx"],"mappings":";;;YAkBY;YACA;iBAEK;;WAEN;WACA,MAAM;WACN,OAAO;;iBAGD,0BAA0B,KACzC;;;;;;EAgBA,OAAO;;EAEP,QAAQ;;;;;;;;;;;EAWR;;;;;;;;;;EAUA,eAAe,UAAU;;;;;;;;;;;;;EAazB,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;;;;;wBAmBvC,eACd,MACA,OACA,aACA,cACA,YACA,WACA,OACA,UACA,WACG,QACF,oBAAiB;yBAXJ"}
1
+ {"version":3,"file":"popover-popup.d.mts","names":[],"sources":["../../src/popover/popover-popup.tsx"],"mappings":";;;YAmBY;YACA;iBAEK;;WAEN;WACA,MAAM;WACN,OAAO;;iBAGD,0BAA0B,KACzC;;;;;;EAgBA,OAAO;;EAEP,QAAQ;;;;;;;;;;;EAWR;;;;;;;;;;EAUA,eAAe,UAAU;;;;;;;;;;;;;EAazB,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;;;;;;;;wBAmBvC,eACd,MACA,OACA,aACA,cACA,YACA,WACA,OACA,UACA,WACG,QACF,oBAAiB;yBAXJ"}
@@ -1,6 +1,8 @@
1
1
  "use client";
2
2
  import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
3
- import { resolveStateValue, useRender } from "../internal/use-render.mjs";
3
+ import { resolveStateValue } from "../internal/render-element.mjs";
4
+ import { useRender } from "../internal/use-render.mjs";
5
+ import { ToolbarContext } from "../internal/toolbar-context.mjs";
4
6
  import { useDevWarning } from "../internal/use-dev-warning.mjs";
5
7
  import { POSITION_TRY_FALLBACKS, positionArea } from "../internal/anchor-position.mjs";
6
8
  import { PopoverPopupContext, usePopoverContext } from "./popover-context.mjs";
@@ -51,7 +53,10 @@ function PopoverPopup({ side = "bottom", align = "center", keepMounted, initialF
51
53
  else node = visible ? wrapContent(resolveStateValue(children, s)) : null;
52
54
  return /* @__PURE__ */ jsx(PopoverPopupContext, {
53
55
  value: s,
54
- children: node
56
+ children: /* @__PURE__ */ jsx(ToolbarContext, {
57
+ value: null,
58
+ children: node
59
+ })
55
60
  });
56
61
  };
57
62
  const libraryProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"popover-popup.mjs","names":[],"sources":["../../src/popover/popover-popup.tsx"],"sourcesContent":["\"use client\";\nimport { Activity } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n ReactNode,\n RefObject,\n ViewTransitionClass,\n} from \"react\";\nimport { POSITION_TRY_FALLBACKS, positionArea } from \"../internal/anchor-position.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { usePopoverPopup } from \"../internal/use-popover-popup.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { PopoverPopupContext, usePopoverContext } from \"./popover-context.js\";\n\nexport type PopoverSide = \"top\" | \"bottom\" | \"left\" | \"right\";\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\nexport interface PopoverPopupState {\n /** Committed open state (library mode); `false` in JS-free mode. Read `:popover-open` for the DOM truth. */\n readonly open: boolean;\n readonly side: PopoverSide | null;\n readonly align: PopoverAlign;\n}\n\nexport interface PopoverPopupProps extends Omit<\n ComponentPropsWithRef<\"dialog\">,\n | \"id\"\n | \"popover\"\n | \"open\"\n | \"aria-modal\"\n | \"onToggle\"\n | \"onBeforeToggle\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Placement relative to the Trigger through inline `position-area`, with\n * `position-try-fallbacks` flipping it when it does not fit. Default `\"bottom\"`. `null` emits\n * no inline positioning (and no `data-side` / `data-align`), so a stylesheet owns placement.\n */\n side?: PopoverSide | null;\n /** Alignment along the side. Default `\"center\"`. Ignored when `side` is `null`. */\n align?: PopoverAlign;\n /**\n * Library mode: what happens to the children while the popover is closed.\n * - `false` (default): not rendered. Mounting them is part of the opening transition, so\n * content that suspends holds the open until it is ready. Unmount waits for the popover's\n * exit animation (CSS), or happens in the close commit when `transition` is set.\n * - `true`: rendered inside `<Activity mode=\"hidden\">`: DOM and state preserved, effects\n * stopped, pre-rendered at low priority. Not in the server HTML.\n *\n * Ignored in JS-free mode (always mounted).\n */\n keepMounted?: boolean;\n /**\n * Element to focus when the popover opens: a ref, or a selector resolved inside the popup.\n * The library writes `autofocus` on it right before `showPopover()` and the platform focuses\n * it. Default: the platform's choice for a `<dialog>` (first focusable descendant; the popup\n * itself if none); for `render={<div />}` focus stays on the Trigger.\n *\n * In JS-free mode the browser opens the popover itself, so the attribute is written after\n * hydration and kept while mounted; before hydration only `autoFocus` in the markup works.\n */\n initialFocus?: RefObject<HTMLElement | null> | string;\n /**\n * Library mode only. Forwarded to the `<ViewTransition default>` around the popover element\n * itself. Animates the opening commit, content changes while open, and every library-driven\n * close (Trigger, Close, controlled `open={false}`), in all engines; dismissals (Escape,\n * click outside) are the browser's and animate with CSS only. Ignored (dev warning) in JS-free\n * mode.\n *\n * Static: without `transition` the part renders no `<ViewTransition>`; changing it between\n * `undefined` and a value remounts the element. A Root inserted by a transition with\n * `transition` set on its Popup pays the page cross-fade (issue #35); a plain open does not,\n * because the children mount under the already-mounted popover element.\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, PopoverPopupState>;\n style?: StateValue<CSSProperties | undefined, PopoverPopupState>;\n children?: StateValue<ReactNode, PopoverPopupState>;\n /** A `<dialog>` (default) or a `<div>` (focus stays on the Trigger). */\n render?: RenderProp<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>;\n}\n\n/**\n * The popover itself: a `<dialog popover=\"auto\" aria-modal=\"false\" role=\"dialog\">` with the id\n * the Trigger's `commandfor` names, placed against the Trigger with CSS Anchor Positioning and\n * wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with\n * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`.\n *\n * In library mode the children render from committed state, so content that suspends keeps the\n * popover closed (and the Trigger pending) until it is ready; `showPopover({ source: trigger })`\n * runs in the layout effect of the commit that mounted them, and a library-driven close runs\n * `hidePopover()` in the commit that ends it. Dismissals are the browser's: the native `toggle`\n * event becomes `openChangeAction(false, { reason: \"dismiss\" })`.\n *\n * Owned keys (conventions 1.2): `id`, `popover`, `open`, `aria-modal`, `aria-labelledby` and\n * `aria-describedby` (token-merged), and `data-side` / `data-align` unless `side` is `null`.\n * `role` is a default (`\"dialog\"`) the consumer may override.\n */\nexport function PopoverPopup({\n side = \"bottom\",\n align = \"center\",\n keepMounted,\n initialFocus,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverPopupProps) {\n const ctx = usePopoverContext(\"Popover.Popup\");\n const isLibrary = ctx.mode === \"library\";\n const { ids } = ctx;\n\n useDevWarning(\n !isLibrary && transition !== undefined,\n \"Popover.Popup: `transition` has no effect in JS-free mode; the browser opens and closes the \" +\n \"popover outside any React transition. Animate it with CSS (`@starting-style`).\",\n );\n useDevWarning(\n !isLibrary && keepMounted === false,\n \"Popover.Popup: `keepMounted={false}` cannot be honoured in JS-free mode; the content is \" +\n \"always mounted so that the server HTML is complete.\",\n );\n\n const { setElement, visible, wrapContent } = usePopoverPopup(ctx, {\n part: \"Popover.Popup\",\n initialFocus,\n keepMounted,\n transition: isLibrary ? transition : undefined,\n });\n\n const state: PopoverPopupState = { open: ctx.committed, side, align };\n\n const content = (s: PopoverPopupState): ReactNode => {\n let node: ReactNode;\n if (!isLibrary) {\n node = resolveStateValue(children, s);\n } else if (keepMounted === true) {\n // The mode changes with committed state, inside the Root's transition (conventions 5.5);\n // it stays visible while an exit animation runs.\n node = (\n <Activity mode={visible ? \"visible\" : \"hidden\"}>\n {wrapContent(resolveStateValue(children, s))}\n </Activity>\n );\n } else {\n node = visible ? wrapContent(resolveStateValue(children, s)) : null;\n }\n return <PopoverPopupContext value={s}>{node}</PopoverPopupContext>;\n };\n\n const libraryProps: ComponentPropsWithRef<\"dialog\"> & DataAttributes = {\n id: ids.popup,\n popover: \"auto\",\n // Never rendered: `showPopover()` does not set it, and an `open` attribute would show the\n // <dialog> outside the top layer. Owned so a `render` element cannot add it.\n open: undefined,\n // Chromium exposes a <dialog popover> as modal without it (research; issue #44).\n \"aria-modal\": \"false\",\n \"aria-labelledby\": ids.title,\n \"aria-describedby\": ids.description,\n // Not owned with `side={null}`: the stylesheet (or a render element) may set them.\n ...(side !== null && { \"data-side\": side, \"data-align\": align }),\n };\n\n const element = useRender<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>({\n defaultElement: \"dialog\",\n render,\n state,\n className,\n // The inline placement sits under the consumer's style: the consumer wins (design 8).\n style:\n side === null\n ? style\n : (s) => ({\n positionArea: positionArea(side, align),\n positionTryFallbacks: POSITION_TRY_FALLBACKS,\n ...resolveStateValue(style, s),\n }),\n children: content,\n // `role` is a default the consumer's `rest` overrides (design 3.3): WebKit implements no\n // minimum role for `[popover]`, and a `<div>` popup needs it.\n props: { role: \"dialog\", ...rest },\n libraryProps,\n ref: setElement,\n });\n\n return useTransitionBoundary(\"Popover.Popup\", isLibrary ? transition : undefined, element);\n}\n\nPopoverPopup.displayName = \"PopoverPopup\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,SAAgB,aAAa,EAC3B,OAAO,UACP,QAAQ,UACR,aACA,cACA,YACA,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,QAAQ;CAEhB,cACE,CAAC,aAAa,eAAe,KAAA,GAC7B,4KAEF;CACA,cACE,CAAC,aAAa,gBAAgB,OAC9B,6IAEF;CAEA,MAAM,EAAE,YAAY,SAAS,gBAAgB,gBAAgB,KAAK;EAChE,MAAM;EACN;EACA;EACA,YAAY,YAAY,aAAa,KAAA;CACvC,CAAC;CAED,MAAM,QAA2B;EAAE,MAAM,IAAI;EAAW;EAAM;CAAM;CAEpE,MAAM,WAAW,MAAoC;EACnD,IAAI;EACJ,IAAI,CAAC,WACH,OAAO,kBAAkB,UAAU,CAAC;OAC/B,IAAI,gBAAgB,MAGzB,OACE,oBAAC,UAAD;GAAU,MAAM,UAAU,YAAY;GACnC,UAAA,YAAY,kBAAkB,UAAU,CAAC,CAAC;EACnC,CAAA;OAGZ,OAAO,UAAU,YAAY,kBAAkB,UAAU,CAAC,CAAC,IAAI;EAEjE,OAAO,oBAAC,qBAAD;GAAqB,OAAO;GAAI,UAAA;EAA0B,CAAA;CACnE;CAEA,MAAM,eAAiE;EACrE,IAAI,IAAI;EACR,SAAS;EAGT,MAAM,KAAA;EAEN,cAAc;EACd,mBAAmB,IAAI;EACvB,oBAAoB,IAAI;EAExB,GAAI,SAAS,QAAQ;GAAE,aAAa;GAAM,cAAc;EAAM;CAChE;CAEA,MAAM,UAAU,UAA8D;EAC5E,gBAAgB;EAChB;EACA;EACA;EAEA,OACE,SAAS,OACL,SACC,OAAO;GACN,cAAc,aAAa,MAAM,KAAK;GACtC,sBAAsB;GACtB,GAAG,kBAAkB,OAAO,CAAC;EAC/B;EACN,UAAU;EAGV,OAAO;GAAE,MAAM;GAAU,GAAG;EAAK;EACjC;EACA,KAAK;CACP,CAAC;CAED,OAAO,sBAAsB,iBAAiB,YAAY,aAAa,KAAA,GAAW,OAAO;AAC3F;AAEA,aAAa,cAAc"}
1
+ {"version":3,"file":"popover-popup.mjs","names":[],"sources":["../../src/popover/popover-popup.tsx"],"sourcesContent":["\"use client\";\nimport { Activity } from \"react\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n ReactNode,\n RefObject,\n ViewTransitionClass,\n} from \"react\";\nimport { POSITION_TRY_FALLBACKS, positionArea } from \"../internal/anchor-position.js\";\nimport { ToolbarContext } from \"../internal/toolbar-context.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { usePopoverPopup } from \"../internal/use-popover-popup.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport { PopoverPopupContext, usePopoverContext } from \"./popover-context.js\";\n\nexport type PopoverSide = \"top\" | \"bottom\" | \"left\" | \"right\";\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\nexport interface PopoverPopupState {\n /** Committed open state (library mode); `false` in JS-free mode. Read `:popover-open` for the DOM truth. */\n readonly open: boolean;\n readonly side: PopoverSide | null;\n readonly align: PopoverAlign;\n}\n\nexport interface PopoverPopupProps extends Omit<\n ComponentPropsWithRef<\"dialog\">,\n | \"id\"\n | \"popover\"\n | \"open\"\n | \"aria-modal\"\n | \"onToggle\"\n | \"onBeforeToggle\"\n | \"className\"\n | \"style\"\n | \"children\"\n> {\n /**\n * Placement relative to the Trigger through inline `position-area`, with\n * `position-try-fallbacks` flipping it when it does not fit. Default `\"bottom\"`. `null` emits\n * no inline positioning (and no `data-side` / `data-align`), so a stylesheet owns placement.\n */\n side?: PopoverSide | null;\n /** Alignment along the side. Default `\"center\"`. Ignored when `side` is `null`. */\n align?: PopoverAlign;\n /**\n * Library mode: what happens to the children while the popover is closed.\n * - `false` (default): not rendered. Mounting them is part of the opening transition, so\n * content that suspends holds the open until it is ready. Unmount waits for the popover's\n * exit animation (CSS), or happens in the close commit when `transition` is set.\n * - `true`: rendered inside `<Activity mode=\"hidden\">`: DOM and state preserved, effects\n * stopped, pre-rendered at low priority. Not in the server HTML.\n *\n * Ignored in JS-free mode (always mounted).\n */\n keepMounted?: boolean;\n /**\n * Element to focus when the popover opens: a ref, or a selector resolved inside the popup.\n * The library writes `autofocus` on it right before `showPopover()` and the platform focuses\n * it. Default: the platform's choice for a `<dialog>` (first focusable descendant; the popup\n * itself if none); for `render={<div />}` focus stays on the Trigger.\n *\n * In JS-free mode the browser opens the popover itself, so the attribute is written after\n * hydration and kept while mounted; before hydration only `autoFocus` in the markup works.\n */\n initialFocus?: RefObject<HTMLElement | null> | string;\n /**\n * Library mode only. Forwarded to the `<ViewTransition default>` around the popover element\n * itself. Animates the opening commit, content changes while open, and every library-driven\n * close (Trigger, Close, controlled `open={false}`), in all engines; dismissals (Escape,\n * click outside) are the browser's and animate with CSS only. Ignored (dev warning) in JS-free\n * mode.\n *\n * Static: without `transition` the part renders no `<ViewTransition>`; changing it between\n * `undefined` and a value remounts the element. A Root inserted by a transition with\n * `transition` set on its Popup pays the page cross-fade (issue #35); a plain open does not,\n * because the children mount under the already-mounted popover element.\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, PopoverPopupState>;\n style?: StateValue<CSSProperties | undefined, PopoverPopupState>;\n children?: StateValue<ReactNode, PopoverPopupState>;\n /** A `<dialog>` (default) or a `<div>` (focus stays on the Trigger). */\n render?: RenderProp<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>;\n}\n\n/**\n * The popover itself: a `<dialog popover=\"auto\" aria-modal=\"false\" role=\"dialog\">` with the id\n * the Trigger's `commandfor` names, placed against the Trigger with CSS Anchor Positioning and\n * wired to Title and Description through `aria-labelledby` / `aria-describedby`. Style it with\n * `:popover-open`; it emits `data-side` / `data-align` but no `data-open`.\n *\n * In library mode the children render from committed state, so content that suspends keeps the\n * popover closed (and the Trigger pending) until it is ready; `showPopover({ source: trigger })`\n * runs in the layout effect of the commit that mounted them, and a library-driven close runs\n * `hidePopover()` in the commit that ends it. Dismissals are the browser's: the native `toggle`\n * event becomes `openChangeAction(false, { reason: \"dismiss\" })`.\n *\n * Owned keys (conventions 1.2): `id`, `popover`, `open`, `aria-modal`, `aria-labelledby` and\n * `aria-describedby` (token-merged), and `data-side` / `data-align` unless `side` is `null`.\n * `role` is a default (`\"dialog\"`) the consumer may override.\n */\nexport function PopoverPopup({\n side = \"bottom\",\n align = \"center\",\n keepMounted,\n initialFocus,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: PopoverPopupProps) {\n const ctx = usePopoverContext(\"Popover.Popup\");\n const isLibrary = ctx.mode === \"library\";\n const { ids } = ctx;\n\n useDevWarning(\n !isLibrary && transition !== undefined,\n \"Popover.Popup: `transition` has no effect in JS-free mode; the browser opens and closes the \" +\n \"popover outside any React transition. Animate it with CSS (`@starting-style`).\",\n );\n useDevWarning(\n !isLibrary && keepMounted === false,\n \"Popover.Popup: `keepMounted={false}` cannot be honoured in JS-free mode; the content is \" +\n \"always mounted so that the server HTML is complete.\",\n );\n\n const { setElement, visible, wrapContent } = usePopoverPopup(ctx, {\n part: \"Popover.Popup\",\n initialFocus,\n keepMounted,\n transition: isLibrary ? transition : undefined,\n });\n\n const state: PopoverPopupState = { open: ctx.committed, side, align };\n\n const content = (s: PopoverPopupState): ReactNode => {\n let node: ReactNode;\n if (!isLibrary) {\n node = resolveStateValue(children, s);\n } else if (keepMounted === true) {\n // The mode changes with committed state, inside the Root's transition (conventions 5.5);\n // it stays visible while an exit animation runs.\n node = (\n <Activity mode={visible ? \"visible\" : \"hidden\"}>\n {wrapContent(resolveStateValue(children, s))}\n </Activity>\n );\n } else {\n node = visible ? wrapContent(resolveStateValue(children, s)) : null;\n }\n // Popup content is not part of an enclosing Toolbar's sequence (the engine excludes\n // `[popover]`), so parts inside it must not see the Toolbar either.\n return (\n <PopoverPopupContext value={s}>\n <ToolbarContext value={null}>{node}</ToolbarContext>\n </PopoverPopupContext>\n );\n };\n\n const libraryProps: ComponentPropsWithRef<\"dialog\"> & DataAttributes = {\n id: ids.popup,\n popover: \"auto\",\n // Never rendered: `showPopover()` does not set it, and an `open` attribute would show the\n // <dialog> outside the top layer. Owned so a `render` element cannot add it.\n open: undefined,\n // Chromium exposes a <dialog popover> as modal without it (research; issue #44).\n \"aria-modal\": \"false\",\n \"aria-labelledby\": ids.title,\n \"aria-describedby\": ids.description,\n // Not owned with `side={null}`: the stylesheet (or a render element) may set them.\n ...(side !== null && { \"data-side\": side, \"data-align\": align }),\n };\n\n const element = useRender<ComponentPropsWithRef<\"dialog\">, PopoverPopupState>({\n defaultElement: \"dialog\",\n render,\n state,\n className,\n // The inline placement sits under the consumer's style: the consumer wins (design 8).\n style:\n side === null\n ? style\n : (s) => ({\n positionArea: positionArea(side, align),\n positionTryFallbacks: POSITION_TRY_FALLBACKS,\n ...resolveStateValue(style, s),\n }),\n children: content,\n // `role` is a default the consumer's `rest` overrides (design 3.3): WebKit implements no\n // minimum role for `[popover]`, and a `<div>` popup needs it.\n props: { role: \"dialog\", ...rest },\n libraryProps,\n ref: setElement,\n });\n\n return useTransitionBoundary(\"Popover.Popup\", isLibrary ? transition : undefined, element);\n}\n\nPopoverPopup.displayName = \"PopoverPopup\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0GA,SAAgB,aAAa,EAC3B,OAAO,UACP,QAAQ,UACR,aACA,cACA,YACA,WACA,OACA,UACA,QACA,GAAG,QACiB;CACpB,MAAM,MAAM,kBAAkB,eAAe;CAC7C,MAAM,YAAY,IAAI,SAAS;CAC/B,MAAM,EAAE,QAAQ;CAEhB,cACE,CAAC,aAAa,eAAe,KAAA,GAC7B,4KAEF;CACA,cACE,CAAC,aAAa,gBAAgB,OAC9B,6IAEF;CAEA,MAAM,EAAE,YAAY,SAAS,gBAAgB,gBAAgB,KAAK;EAChE,MAAM;EACN;EACA;EACA,YAAY,YAAY,aAAa,KAAA;CACvC,CAAC;CAED,MAAM,QAA2B;EAAE,MAAM,IAAI;EAAW;EAAM;CAAM;CAEpE,MAAM,WAAW,MAAoC;EACnD,IAAI;EACJ,IAAI,CAAC,WACH,OAAO,kBAAkB,UAAU,CAAC;OAC/B,IAAI,gBAAgB,MAGzB,OACE,oBAAC,UAAD;GAAU,MAAM,UAAU,YAAY;GACnC,UAAA,YAAY,kBAAkB,UAAU,CAAC,CAAC;EACnC,CAAA;OAGZ,OAAO,UAAU,YAAY,kBAAkB,UAAU,CAAC,CAAC,IAAI;EAIjE,OACE,oBAAC,qBAAD;GAAqB,OAAO;GAC1B,UAAA,oBAAC,gBAAD;IAAgB,OAAO;IAAO,UAAA;GAAqB,CAAA;EAChC,CAAA;CAEzB;CAEA,MAAM,eAAiE;EACrE,IAAI,IAAI;EACR,SAAS;EAGT,MAAM,KAAA;EAEN,cAAc;EACd,mBAAmB,IAAI;EACvB,oBAAoB,IAAI;EAExB,GAAI,SAAS,QAAQ;GAAE,aAAa;GAAM,cAAc;EAAM;CAChE;CAEA,MAAM,UAAU,UAA8D;EAC5E,gBAAgB;EAChB;EACA;EACA;EAEA,OACE,SAAS,OACL,SACC,OAAO;GACN,cAAc,aAAa,MAAM,KAAK;GACtC,sBAAsB;GACtB,GAAG,kBAAkB,OAAO,CAAC;EAC/B;EACN,UAAU;EAGV,OAAO;GAAE,MAAM;GAAU,GAAG;EAAK;EACjC;EACA,KAAK;CACP,CAAC;CAED,OAAO,sBAAsB,iBAAiB,YAAY,aAAa,KAAA,GAAW,OAAO;AAC3F;AAEA,aAAa,cAAc"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { resolveStateValue } from "../internal/use-render.mjs";
2
+ import { resolveStateValue } from "../internal/render-element.mjs";
3
3
  import { PopoverContext } from "./popover-context.mjs";
4
4
  import { usePopoverRoot } from "../internal/use-popover-root.mjs";
5
5
  import { jsx } from "react/jsx-runtime";
@@ -0,0 +1,24 @@
1
+ import "../internal/platform-attributes.mjs";
2
+ import { ProgressRoot, ProgressRootProps, ProgressState } from "./progress-root.mjs";
3
+ import { ProgressIndicator, ProgressIndicatorProps } from "./progress-indicator.mjs";
4
+ import { ProgressLabel, ProgressLabelProps } from "./progress-label.mjs";
5
+ import { ProgressTrack, ProgressTrackProps } from "./progress-track.mjs";
6
+ import { ProgressValue, ProgressValueProps } from "./progress-value.mjs";
7
+ //#region src/progress/index.d.ts
8
+ /**
9
+ * Progress (WAI-ARIA `progressbar`): `Root` (`div[role=progressbar]`, directive-free, so a
10
+ * Server Component may render it and it runs on the server), `Track` (the rail), `Indicator`
11
+ * (the fill, sized by your CSS from `--progress-value`), `Label` and `Value`. Output-only: no
12
+ * actions and no pending state; a `value` of `null` (the default) is indeterminate. Write a value
13
+ * that reports on a pending action with a plain `setState`, never inside `startTransition`.
14
+ */
15
+ export declare const Progress: {
16
+ readonly Root: typeof ProgressRoot;
17
+ readonly Track: typeof ProgressTrack;
18
+ readonly Indicator: typeof ProgressIndicator;
19
+ readonly Label: typeof ProgressLabel;
20
+ readonly Value: typeof ProgressValue;
21
+ };
22
+ //#endregion
23
+ export type { ProgressIndicatorProps, ProgressLabelProps, ProgressRootProps, ProgressState, ProgressTrackProps, ProgressValueProps };
24
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/progress/index.ts"],"mappings":";;;;;;;;;;;;;;qBAgBa;WACX,aAAI;WACJ,cAAK;WACL,kBAAS;WACT,cAAK;WACL,cAAK"}
@@ -0,0 +1,24 @@
1
+ import { ProgressIndicator } from "./progress-indicator.mjs";
2
+ import { ProgressLabel } from "./progress-label.mjs";
3
+ import { ProgressRoot } from "./progress-root.mjs";
4
+ import { ProgressTrack } from "./progress-track.mjs";
5
+ import { ProgressValue } from "./progress-value.mjs";
6
+ //#region src/progress/index.ts
7
+ /**
8
+ * Progress (WAI-ARIA `progressbar`): `Root` (`div[role=progressbar]`, directive-free, so a
9
+ * Server Component may render it and it runs on the server), `Track` (the rail), `Indicator`
10
+ * (the fill, sized by your CSS from `--progress-value`), `Label` and `Value`. Output-only: no
11
+ * actions and no pending state; a `value` of `null` (the default) is indeterminate. Write a value
12
+ * that reports on a pending action with a plain `setState`, never inside `startTransition`.
13
+ */
14
+ const Progress = {
15
+ Root: ProgressRoot,
16
+ Track: ProgressTrack,
17
+ Indicator: ProgressIndicator,
18
+ Label: ProgressLabel,
19
+ Value: ProgressValue
20
+ };
21
+ //#endregion
22
+ export { Progress };
23
+
24
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/progress/index.ts"],"sourcesContent":["// Ships the platform attribute typings with this subpath (conventions 7.4). Type-only: the\n// built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { ProgressIndicator } from \"./progress-indicator.js\";\nimport { ProgressLabel } from \"./progress-label.js\";\nimport { ProgressRoot } from \"./progress-root.js\";\nimport { ProgressTrack } from \"./progress-track.js\";\nimport { ProgressValue } from \"./progress-value.js\";\n\n/**\n * Progress (WAI-ARIA `progressbar`): `Root` (`div[role=progressbar]`, directive-free, so a\n * Server Component may render it and it runs on the server), `Track` (the rail), `Indicator`\n * (the fill, sized by your CSS from `--progress-value`), `Label` and `Value`. Output-only: no\n * actions and no pending state; a `value` of `null` (the default) is indeterminate. Write a value\n * that reports on a pending action with a plain `setState`, never inside `startTransition`.\n */\nexport const Progress = {\n Root: ProgressRoot,\n Track: ProgressTrack,\n Indicator: ProgressIndicator,\n Label: ProgressLabel,\n Value: ProgressValue,\n} as const;\n\nexport type { ProgressRootProps, ProgressState } from \"./progress-root.js\";\nexport type { ProgressTrackProps } from \"./progress-track.js\";\nexport type { ProgressIndicatorProps } from \"./progress-indicator.js\";\nexport type { ProgressLabelProps } from \"./progress-label.js\";\nexport type { ProgressValueProps } from \"./progress-value.js\";\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAa,WAAW;CACtB,MAAM;CACN,OAAO;CACP,WAAW;CACX,OAAO;CACP,OAAO;AACT"}
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { createContext, use } from "react";
3
+ //#region src/progress/progress-context.ts
4
+ const ProgressContext = createContext(null);
5
+ function useProgressContext(part) {
6
+ const context = use(ProgressContext);
7
+ if (context === null) throw new Error(`${part} must be rendered inside a Progress.Root.`);
8
+ return context;
9
+ }
10
+ //#endregion
11
+ export { ProgressContext, useProgressContext };
12
+
13
+ //# sourceMappingURL=progress-context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-context.mjs","names":[],"sources":["../../src/progress/progress-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext, use } from \"react\";\nimport type { ProgressState } from \"./progress-root.js\";\n\n/**\n * What the directive-free `Progress.Root` provides to its parts: plain serialisable data, so the\n * provider can be rendered by a Root running as a Server Component (design 8.1).\n */\nexport interface ProgressContextValue {\n /** The Root's `useId`; `Progress.Label` renders `${id}-label`. */\n readonly id: string;\n readonly state: ProgressState;\n}\n\nexport const ProgressContext = createContext<ProgressContextValue | null>(null);\n\nexport function useProgressContext(part: string): ProgressContextValue {\n const context = use(ProgressContext);\n if (context === null) {\n throw new Error(`${part} must be rendered inside a Progress.Root.`);\n }\n return context;\n}\n"],"mappings":";;;AAcA,MAAa,kBAAkB,cAA2C,IAAI;AAE9E,SAAgB,mBAAmB,MAAoC;CACrE,MAAM,UAAU,IAAI,eAAe;CACnC,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,GAAG,KAAK,0CAA0C;CAEpE,OAAO;AACT"}
@@ -0,0 +1,19 @@
1
+ import { RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { ProgressState } from "./progress-root.mjs";
3
+ import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
4
+ //#region src/progress/progress-indicator.d.ts
5
+ export interface ProgressIndicatorProps extends Omit<ComponentPropsWithRef<"span">, "className" | "style" | "children"> {
6
+ className?: StateValue<string | undefined, ProgressState>;
7
+ style?: StateValue<CSSProperties | undefined, ProgressState>;
8
+ children?: StateValue<ReactNode, ProgressState>;
9
+ render?: RenderProp<ComponentPropsWithRef<"span">, ProgressState>;
10
+ }
11
+ /**
12
+ * `Progress.Indicator`: the fill. It renders no inline size: the consumer's CSS sizes it from the Root's inherited custom property. Owned keys: `data-indeterminate`, `data-complete`.
13
+ */
14
+ export declare function ProgressIndicator({ className, style, children, render, ...rest }: ProgressIndicatorProps): ReactNode;
15
+ export declare namespace ProgressIndicator {
16
+ var displayName: string;
17
+ }
18
+ //#endregion
19
+ //# sourceMappingURL=progress-indicator.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-indicator.d.mts","names":[],"sources":["../../src/progress/progress-indicator.tsx"],"mappings":";;;;iBAQiB,+BAA+B,KAC9C;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,+BAA+B;;;;;wBAMrC,oBACd,WACA,OACA,UACA,WACG,QACF,yBAAsB;yBANT"}
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { dataAttr } from "../internal/data-attr.mjs";
3
+ import { useRender } from "../internal/use-render.mjs";
4
+ import { useProgressContext } from "./progress-context.mjs";
5
+ //#region src/progress/progress-indicator.tsx
6
+ /**
7
+ * `Progress.Indicator`: the fill. It renders no inline size: the consumer's CSS sizes it from the Root's inherited custom property. Owned keys: `data-indeterminate`, `data-complete`.
8
+ */
9
+ function ProgressIndicator({ className, style, children, render, ...rest }) {
10
+ const { state } = useProgressContext("Progress.Indicator");
11
+ return useRender({
12
+ defaultElement: "span",
13
+ render,
14
+ state,
15
+ className,
16
+ style,
17
+ children,
18
+ props: rest,
19
+ libraryProps: {
20
+ "data-indeterminate": dataAttr(state.indeterminate),
21
+ "data-complete": dataAttr(state.complete)
22
+ }
23
+ });
24
+ }
25
+ ProgressIndicator.displayName = "ProgressIndicator";
26
+ //#endregion
27
+ export { ProgressIndicator };
28
+
29
+ //# sourceMappingURL=progress-indicator.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-indicator.mjs","names":[],"sources":["../../src/progress/progress-indicator.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useProgressContext } from \"./progress-context.js\";\nimport type { ProgressState } from \"./progress-root.js\";\n\nexport interface ProgressIndicatorProps extends Omit<\n ComponentPropsWithRef<\"span\">,\n \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, ProgressState>;\n style?: StateValue<CSSProperties | undefined, ProgressState>;\n children?: StateValue<ReactNode, ProgressState>;\n render?: RenderProp<ComponentPropsWithRef<\"span\">, ProgressState>;\n}\n\n/**\n * `Progress.Indicator`: the fill. It renders no inline size: the consumer's CSS sizes it from the Root's inherited custom property. Owned keys: `data-indeterminate`, `data-complete`.\n */\nexport function ProgressIndicator({\n className,\n style,\n children,\n render,\n ...rest\n}: ProgressIndicatorProps) {\n const { state } = useProgressContext(\"Progress.Indicator\");\n return useRender<ComponentPropsWithRef<\"span\">, ProgressState>({\n defaultElement: \"span\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n \"data-indeterminate\": dataAttr(state.indeterminate),\n \"data-complete\": dataAttr(state.complete),\n },\n });\n}\n\nProgressIndicator.displayName = \"ProgressIndicator\";\n"],"mappings":";;;;;;;;AAqBA,SAAgB,kBAAkB,EAChC,WACA,OACA,UACA,QACA,GAAG,QACsB;CACzB,MAAM,EAAE,UAAU,mBAAmB,oBAAoB;CACzD,OAAO,UAAwD;EAC7D,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,sBAAsB,SAAS,MAAM,aAAa;GAClD,iBAAiB,SAAS,MAAM,QAAQ;EAC1C;CACF,CAAC;AACH;AAEA,kBAAkB,cAAc"}
@@ -0,0 +1,19 @@
1
+ import { RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { ProgressState } from "./progress-root.mjs";
3
+ import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
4
+ //#region src/progress/progress-label.d.ts
5
+ export interface ProgressLabelProps extends Omit<ComponentPropsWithRef<"span">, "id" | "className" | "style" | "children"> {
6
+ className?: StateValue<string | undefined, ProgressState>;
7
+ style?: StateValue<CSSProperties | undefined, ProgressState>;
8
+ children?: StateValue<ReactNode, ProgressState>;
9
+ render?: RenderProp<ComponentPropsWithRef<"span">, ProgressState>;
10
+ }
11
+ /**
12
+ * `Progress.Label`: a `span` whose id the Root always references through `aria-labelledby` (the Root is not a labelable element, so a `<label for>` would associate nothing). Owned keys: `id`, `data-indeterminate`, `data-complete`.
13
+ */
14
+ export declare function ProgressLabel({ className, style, children, render, ...rest }: ProgressLabelProps): ReactNode;
15
+ export declare namespace ProgressLabel {
16
+ var displayName: string;
17
+ }
18
+ //#endregion
19
+ //# sourceMappingURL=progress-label.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-label.d.mts","names":[],"sources":["../../src/progress/progress-label.tsx"],"mappings":";;;;iBAQiB,2BAA2B,KAC1C;EAGA,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,+BAA+B;;;;;wBAMrC,gBAAgB,WAAW,OAAO,UAAU,WAAW,QAAQ,qBAAkB;yBAAjF"}
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { dataAttr } from "../internal/data-attr.mjs";
3
+ import { useRender } from "../internal/use-render.mjs";
4
+ import { useProgressContext } from "./progress-context.mjs";
5
+ //#region src/progress/progress-label.tsx
6
+ /**
7
+ * `Progress.Label`: a `span` whose id the Root always references through `aria-labelledby` (the Root is not a labelable element, so a `<label for>` would associate nothing). Owned keys: `id`, `data-indeterminate`, `data-complete`.
8
+ */
9
+ function ProgressLabel({ className, style, children, render, ...rest }) {
10
+ const { id, state } = useProgressContext("Progress.Label");
11
+ return useRender({
12
+ defaultElement: "span",
13
+ render,
14
+ state,
15
+ className,
16
+ style,
17
+ children,
18
+ props: rest,
19
+ libraryProps: {
20
+ id: `${id}-label`,
21
+ "data-indeterminate": dataAttr(state.indeterminate),
22
+ "data-complete": dataAttr(state.complete)
23
+ }
24
+ });
25
+ }
26
+ ProgressLabel.displayName = "ProgressLabel";
27
+ //#endregion
28
+ export { ProgressLabel };
29
+
30
+ //# sourceMappingURL=progress-label.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-label.mjs","names":[],"sources":["../../src/progress/progress-label.tsx"],"sourcesContent":["\"use client\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useProgressContext } from \"./progress-context.js\";\nimport type { ProgressState } from \"./progress-root.js\";\n\nexport interface ProgressLabelProps extends Omit<\n ComponentPropsWithRef<\"span\">,\n \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, ProgressState>;\n style?: StateValue<CSSProperties | undefined, ProgressState>;\n children?: StateValue<ReactNode, ProgressState>;\n render?: RenderProp<ComponentPropsWithRef<\"span\">, ProgressState>;\n}\n\n/**\n * `Progress.Label`: a `span` whose id the Root always references through `aria-labelledby` (the Root is not a labelable element, so a `<label for>` would associate nothing). Owned keys: `id`, `data-indeterminate`, `data-complete`.\n */\nexport function ProgressLabel({ className, style, children, render, ...rest }: ProgressLabelProps) {\n const { id, state } = useProgressContext(\"Progress.Label\");\n return useRender<ComponentPropsWithRef<\"span\">, ProgressState>({\n defaultElement: \"span\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n id: `${id}-label`,\n \"data-indeterminate\": dataAttr(state.indeterminate),\n \"data-complete\": dataAttr(state.complete),\n },\n });\n}\n\nProgressLabel.displayName = \"ProgressLabel\";\n"],"mappings":";;;;;;;;AAqBA,SAAgB,cAAc,EAAE,WAAW,OAAO,UAAU,QAAQ,GAAG,QAA4B;CACjG,MAAM,EAAE,IAAI,UAAU,mBAAmB,gBAAgB;CACzD,OAAO,UAAwD;EAC7D,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,cAAc;GACZ,IAAI,GAAG,GAAG;GACV,sBAAsB,SAAS,MAAM,aAAa;GAClD,iBAAiB,SAAS,MAAM,QAAQ;EAC1C;CACF,CAAC;AACH;AAEA,cAAc,cAAc"}
@@ -0,0 +1,68 @@
1
+ import { RenderProp, StateValue } from "../internal/types.mjs";
2
+ import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
+ //#region src/progress/progress-root.d.ts
4
+ /** The state every Progress part receives. */
5
+ export interface ProgressState {
6
+ /** The value clamped to `[min, max]`, or `null` while indeterminate. */
7
+ readonly value: number | null;
8
+ readonly min: number;
9
+ readonly max: number;
10
+ /** `(value - min) / (max - min) * 100`, a number 0–100; `null` while indeterminate. */
11
+ readonly percentage: number | null;
12
+ /**
13
+ * The `Intl.NumberFormat` text of the value (or of the fraction, for the percent style): what
14
+ * `Progress.Value` shows. `null` while indeterminate.
15
+ */
16
+ readonly formattedValue: string | null;
17
+ /** What `aria-valuetext` carries: `getAriaValueText`'s result, else `formattedValue`. */
18
+ readonly valueText: string | null;
19
+ /** `value` is `null`. */
20
+ readonly indeterminate: boolean;
21
+ /** The clamped value has reached `max`. */
22
+ readonly complete: boolean;
23
+ }
24
+ export interface ProgressRootProps extends Omit<ComponentPropsWithRef<"div">, "role" | "aria-valuemin" | "aria-valuemax" | "aria-valuenow" | "aria-valuetext" | "defaultValue" | "defaultChecked" | "className" | "style" | "children"> {
25
+ /** The current value. Absent or `null`: indeterminate. Clamped to `[min, max]`. */
26
+ value?: number | null;
27
+ /** @default 0 */
28
+ min?: number;
29
+ /** @default 100 */
30
+ max?: number;
31
+ /**
32
+ * `Intl.NumberFormat` options for `aria-valuetext` and `Progress.Value`. Default
33
+ * `{ style: "percent" }`. A `percent` style formats the fraction of the range; any other style
34
+ * formats the value. Serialisable: a Server Component may pass it.
35
+ */
36
+ format?: Intl.NumberFormatOptions;
37
+ /**
38
+ * BCP 47 tag for `Intl.NumberFormat`; default: the runtime's locale. Pass it when a client
39
+ * tree is server-rendered.
40
+ */
41
+ locale?: string;
42
+ /**
43
+ * The `aria-valuetext` to render instead of `formattedValue`. Called with the clamped value
44
+ * (`null` while indeterminate) and the state as it would be without this prop. Return `null`
45
+ * to render no `aria-valuetext`. A function: from a Server Component it works when this Root
46
+ * is rendered by that Server Component (the Root runs on the server), not when the Root is
47
+ * rendered by a client component.
48
+ */
49
+ getAriaValueText?: (value: number | null, state: ProgressState) => string | null | undefined;
50
+ className?: StateValue<string | undefined, ProgressState>;
51
+ style?: StateValue<CSSProperties | undefined, ProgressState>;
52
+ children?: StateValue<ReactNode, ProgressState>;
53
+ render?: RenderProp<ComponentPropsWithRef<"div">, ProgressState>;
54
+ }
55
+ /**
56
+ * `Progress.Root`: a `div[role=progressbar]` with the ARIA values, `aria-valuetext` from
57
+ * `Intl.NumberFormat`, `data-indeterminate` / `data-complete`, and `--progress-value` (the
58
+ * percentage, absent while indeterminate) in `style`, where the consumer's entries win. Owned
59
+ * keys: `role`, `aria-valuemin`, `aria-valuemax`, `aria-valuenow`, `aria-valuetext`,
60
+ * `aria-labelledby` (token-merged: the consumer's tokens, then `Progress.Label`'s id, always),
61
+ * `data-indeterminate`, `data-complete`.
62
+ */
63
+ export declare function ProgressRoot({ value, min, max, format, locale, getAriaValueText, className, style, children, render, ref, ...rest }: ProgressRootProps): import("react").JSX.Element;
64
+ export declare namespace ProgressRoot {
65
+ var displayName: string;
66
+ }
67
+ //#endregion
68
+ //# sourceMappingURL=progress-root.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-root.d.mts","names":[],"sources":["../../src/progress/progress-root.tsx"],"mappings":";;;;iBAeiB;;WAEN;WACA;WACA;;WAEA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;iBAGM,0BAA0B,KACzC;;EAaA;;EAEA;;EAEA;;;;;;EAMA,SAAS,KAAK;;;;;EAKd;;;;;;;;EAQA,oBAAoB,sBAAsB,OAAO;EACjD,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,WAAW,WAAW,WAAW;EACjC,SAAS,WAAW,8BAA8B;;;;;;;;;;wBAWpC,eACd,OACA,KACA,KACA,QACA,QACA,kBACA,WACA,OACA,UACA,QACA,QACG,QACF,oCAAiB,IAAA;yBAbJ"}
@@ -0,0 +1,80 @@
1
+ import { dataAttr } from "../internal/data-attr.mjs";
2
+ import { mergeRenderRef, renderElement, resolveStateValue } from "../internal/render-element.mjs";
3
+ import { ProgressContext } from "./progress-context.mjs";
4
+ import { warnOnce } from "../internal/dev-warn.mjs";
5
+ import { clamp, formatRangeValue, isDegenerate, percentage } from "../internal/range-value.mjs";
6
+ import { useId } from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ //#region src/progress/progress-root.tsx
9
+ /**
10
+ * `Progress.Root`: a `div[role=progressbar]` with the ARIA values, `aria-valuetext` from
11
+ * `Intl.NumberFormat`, `data-indeterminate` / `data-complete`, and `--progress-value` (the
12
+ * percentage, absent while indeterminate) in `style`, where the consumer's entries win. Owned
13
+ * keys: `role`, `aria-valuemin`, `aria-valuemax`, `aria-valuenow`, `aria-valuetext`,
14
+ * `aria-labelledby` (token-merged: the consumer's tokens, then `Progress.Label`'s id, always),
15
+ * `data-indeterminate`, `data-complete`.
16
+ */
17
+ function ProgressRoot({ value = null, min = 0, max = 100, format, locale, getAriaValueText, className, style, children, render, ref, ...rest }) {
18
+ const id = useId();
19
+ let given = value;
20
+ if (given !== null && !Number.isFinite(given)) {
21
+ warnOnce(`Progress.Root:non-finite:${given}`, `Progress.Root: \`value\` is ${given}, which is not a finite number; the bar is rendered as indeterminate. Pass \`null\` for an unknown value.`);
22
+ given = null;
23
+ }
24
+ const degenerate = isDegenerate(min, max);
25
+ if (degenerate) warnOnce(`Progress.Root:degenerate:${min}:${max}`, `Progress.Root: \`max\` (${max}) must be greater than \`min\` (${min}); the percentage is rendered as 0. Pass \`value={null}\` while the total is unknown or empty.`);
26
+ const clamped = given === null ? null : clamp(given, min, max);
27
+ const formattedValue = clamped === null ? null : formatRangeValue(clamped, min, max, format, locale);
28
+ const base = {
29
+ value: clamped,
30
+ min,
31
+ max,
32
+ percentage: clamped === null ? null : percentage(clamped, min, max),
33
+ formattedValue,
34
+ valueText: formattedValue,
35
+ indeterminate: clamped === null,
36
+ complete: clamped !== null && !degenerate && clamped >= max
37
+ };
38
+ const valueText = getAriaValueText === void 0 ? formattedValue : getAriaValueText(clamped, base) ?? null;
39
+ const state = valueText === base.valueText ? base : {
40
+ ...base,
41
+ valueText
42
+ };
43
+ const variables = state.percentage === null ? {} : { "--progress-value": `${state.percentage}%` };
44
+ const libraryProps = {
45
+ role: "progressbar",
46
+ "aria-valuemin": min,
47
+ "aria-valuemax": max,
48
+ "aria-valuenow": clamped ?? void 0,
49
+ "aria-valuetext": valueText ?? void 0,
50
+ "aria-labelledby": `${id}-label`,
51
+ "data-indeterminate": dataAttr(state.indeterminate),
52
+ "data-complete": dataAttr(state.complete)
53
+ };
54
+ const element = renderElement({
55
+ defaultElement: "div",
56
+ render,
57
+ state,
58
+ className,
59
+ style: (s) => ({
60
+ ...variables,
61
+ ...resolveStateValue(style, s)
62
+ }),
63
+ children,
64
+ props: rest,
65
+ libraryProps,
66
+ ref: mergeRenderRef(ref, render)
67
+ });
68
+ return /* @__PURE__ */ jsx(ProgressContext, {
69
+ value: {
70
+ id,
71
+ state
72
+ },
73
+ children: element
74
+ });
75
+ }
76
+ ProgressRoot.displayName = "ProgressRoot";
77
+ //#endregion
78
+ export { ProgressRoot };
79
+
80
+ //# sourceMappingURL=progress-root.mjs.map