@omerdlw/base-framework 3.4.1 → 4.0.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 (149) hide show
  1. package/dist/ambient/index.js +4 -5
  2. package/dist/background/index.js +3 -4
  3. package/dist/{chunk-DC4XZPDK.js → chunk-3FSDBJ7V.js} +4 -4
  4. package/dist/{chunk-DC4XZPDK.js.map → chunk-3FSDBJ7V.js.map} +1 -1
  5. package/dist/{chunk-GTJMM32W.js → chunk-5TQSH6KE.js} +6 -7
  6. package/dist/chunk-5TQSH6KE.js.map +1 -0
  7. package/dist/{chunk-DGVRHX3C.js → chunk-6P3F4JU3.js} +5 -6
  8. package/dist/{chunk-DGVRHX3C.js.map → chunk-6P3F4JU3.js.map} +1 -1
  9. package/dist/{chunk-3JLG24KI.js → chunk-AKPH5CEJ.js} +199 -9
  10. package/dist/chunk-AKPH5CEJ.js.map +1 -0
  11. package/dist/{chunk-KRHH3UQ6.js → chunk-AWLK2I56.js} +7 -8
  12. package/dist/{chunk-KRHH3UQ6.js.map → chunk-AWLK2I56.js.map} +1 -1
  13. package/dist/{chunk-M36DFIJ6.js → chunk-C527JOJQ.js} +4 -4
  14. package/dist/{chunk-M36DFIJ6.js.map → chunk-C527JOJQ.js.map} +1 -1
  15. package/dist/{chunk-E2QQJZYY.js → chunk-EXB7VFD3.js} +4 -4
  16. package/dist/{chunk-E2QQJZYY.js.map → chunk-EXB7VFD3.js.map} +1 -1
  17. package/dist/chunk-FG2AKFXP.js +108 -0
  18. package/dist/chunk-FG2AKFXP.js.map +1 -0
  19. package/dist/chunk-GA5SZ6E2.js +17 -0
  20. package/dist/{chunk-2E6OASVV.js.map → chunk-GA5SZ6E2.js.map} +1 -1
  21. package/dist/chunk-GG2ILNK2.js +44 -0
  22. package/dist/chunk-GG2ILNK2.js.map +1 -0
  23. package/dist/{chunk-VMR7ZKIF.js → chunk-JA75E4BG.js} +5 -5
  24. package/dist/{chunk-VMR7ZKIF.js.map → chunk-JA75E4BG.js.map} +1 -1
  25. package/dist/{chunk-BLWJZHRL.js → chunk-QZA5AIT6.js} +6 -9
  26. package/dist/chunk-QZA5AIT6.js.map +1 -0
  27. package/dist/{chunk-ST7QOM4O.js → chunk-T53WFIZN.js} +3 -3
  28. package/dist/{chunk-ST7QOM4O.js.map → chunk-T53WFIZN.js.map} +1 -1
  29. package/dist/{chunk-KN4KOTC7.js → chunk-WVED7PDH.js} +4 -4
  30. package/dist/{chunk-KN4KOTC7.js.map → chunk-WVED7PDH.js.map} +1 -1
  31. package/dist/{chunk-HPJWMBUS.js → chunk-XIFQMK2Z.js} +34 -37
  32. package/dist/chunk-XIFQMK2Z.js.map +1 -0
  33. package/dist/{chunk-7A47AXKI.js → chunk-YKHAFHB7.js} +4 -5
  34. package/dist/{chunk-7A47AXKI.js.map → chunk-YKHAFHB7.js.map} +1 -1
  35. package/dist/context-menu/index.js +7 -10
  36. package/dist/controls/index.js +3 -3
  37. package/dist/core/error/boundary.d.ts.map +1 -1
  38. package/dist/core/provider/index.d.ts +3 -8
  39. package/dist/core/provider/index.d.ts.map +1 -1
  40. package/dist/dock/index.js +6 -9
  41. package/dist/error/index.js +2 -5
  42. package/dist/foundation/recipes/index.d.ts +0 -7
  43. package/dist/foundation/recipes/index.d.ts.map +1 -1
  44. package/dist/index.js +15 -18
  45. package/dist/loading/index.js +2 -4
  46. package/dist/modal/index.js +10 -12
  47. package/dist/modal/index.js.map +1 -1
  48. package/dist/modules/dock/card/icon.d.ts.map +1 -1
  49. package/dist/modules/dock/card/use-card.d.ts +38 -38
  50. package/dist/modules/dock/media/controls.d.ts.map +1 -1
  51. package/dist/modules/dock/motion.d.ts +24 -24
  52. package/dist/modules/dock/status/model.d.ts.map +1 -1
  53. package/dist/modules/dock/surface/controls.d.ts.map +1 -1
  54. package/dist/modules/dock/surface/header-button.d.ts.map +1 -1
  55. package/dist/modules/dock/theme.d.ts +14 -14
  56. package/dist/modules/index.js +13 -16
  57. package/dist/modules/modal/container.d.ts.map +1 -1
  58. package/dist/notification/index.js +4 -4
  59. package/dist/overlay-ZCMQVNYT.js +12 -0
  60. package/dist/{overlay-YMLS3SAQ.js.map → overlay-ZCMQVNYT.js.map} +1 -1
  61. package/dist/provider/index.js +3 -8
  62. package/dist/react/theme/index.d.ts +7 -2
  63. package/dist/react/theme/index.d.ts.map +1 -1
  64. package/dist/react/theme/parts.d.ts +89 -0
  65. package/dist/react/theme/parts.d.ts.map +1 -0
  66. package/dist/recipes/index.js +1 -115
  67. package/dist/recipes/index.js.map +1 -1
  68. package/dist/theme/index.js +1 -1
  69. package/docs/README.md +11 -12
  70. package/docs/architecture-and-rules.md +8 -8
  71. package/docs/core-engine.md +11 -13
  72. package/docs/custom-modules.md +1 -1
  73. package/docs/design.md +60 -153
  74. package/docs/getting-started.md +3 -5
  75. package/docs/modules/README.md +1 -1
  76. package/docs/modules/background.md +1 -1
  77. package/docs/modules/context-menu.md +1 -1
  78. package/docs/modules/dock.md +23 -23
  79. package/docs/modules/error-boundary.md +1 -1
  80. package/docs/modules/loading.md +1 -1
  81. package/docs/modules/modal.md +1 -1
  82. package/package.json +1 -7
  83. package/templates/AGENTS.md +4 -3
  84. package/MIGRATION.md +0 -99
  85. package/dist/chunk-2E6OASVV.js +0 -17
  86. package/dist/chunk-3JLG24KI.js.map +0 -1
  87. package/dist/chunk-6LWCTP2Y.js +0 -448
  88. package/dist/chunk-6LWCTP2Y.js.map +0 -1
  89. package/dist/chunk-BLWJZHRL.js.map +0 -1
  90. package/dist/chunk-EBNZXYLT.js +0 -704
  91. package/dist/chunk-EBNZXYLT.js.map +0 -1
  92. package/dist/chunk-FLYL76ZT.js +0 -139
  93. package/dist/chunk-FLYL76ZT.js.map +0 -1
  94. package/dist/chunk-GTJMM32W.js.map +0 -1
  95. package/dist/chunk-HPJWMBUS.js.map +0 -1
  96. package/dist/chunk-ICFPSAJZ.js +0 -112
  97. package/dist/chunk-ICFPSAJZ.js.map +0 -1
  98. package/dist/chunk-S2ZOLTTS.js +0 -140
  99. package/dist/chunk-S2ZOLTTS.js.map +0 -1
  100. package/dist/foundation/recipes/anatomy.d.ts +0 -139
  101. package/dist/foundation/recipes/anatomy.d.ts.map +0 -1
  102. package/dist/foundation/recipes/define.d.ts +0 -133
  103. package/dist/foundation/recipes/define.d.ts.map +0 -1
  104. package/dist/overlay-YMLS3SAQ.js +0 -14
  105. package/dist/react/ui/components/avatar.d.ts +0 -10
  106. package/dist/react/ui/components/avatar.d.ts.map +0 -1
  107. package/dist/react/ui/components/button.d.ts +0 -6
  108. package/dist/react/ui/components/button.d.ts.map +0 -1
  109. package/dist/react/ui/components/carousel.d.ts +0 -27
  110. package/dist/react/ui/components/carousel.d.ts.map +0 -1
  111. package/dist/react/ui/components/checkbox.d.ts +0 -10
  112. package/dist/react/ui/components/checkbox.d.ts.map +0 -1
  113. package/dist/react/ui/components/icon.d.ts +0 -6
  114. package/dist/react/ui/components/icon.d.ts.map +0 -1
  115. package/dist/react/ui/components/image.d.ts +0 -6
  116. package/dist/react/ui/components/image.d.ts.map +0 -1
  117. package/dist/react/ui/components/indicator.d.ts +0 -55
  118. package/dist/react/ui/components/indicator.d.ts.map +0 -1
  119. package/dist/react/ui/components/input.d.ts +0 -10
  120. package/dist/react/ui/components/input.d.ts.map +0 -1
  121. package/dist/react/ui/components/loader.d.ts +0 -10
  122. package/dist/react/ui/components/loader.d.ts.map +0 -1
  123. package/dist/react/ui/components/segmented.d.ts +0 -6
  124. package/dist/react/ui/components/segmented.d.ts.map +0 -1
  125. package/dist/react/ui/components/select/options.d.ts +0 -22
  126. package/dist/react/ui/components/select/options.d.ts.map +0 -1
  127. package/dist/react/ui/components/select/select.d.ts +0 -6
  128. package/dist/react/ui/components/select/select.d.ts.map +0 -1
  129. package/dist/react/ui/components/skeleton.d.ts +0 -10
  130. package/dist/react/ui/components/skeleton.d.ts.map +0 -1
  131. package/dist/react/ui/components/switch.d.ts +0 -6
  132. package/dist/react/ui/components/switch.d.ts.map +0 -1
  133. package/dist/react/ui/components/tooltip/group.d.ts +0 -35
  134. package/dist/react/ui/components/tooltip/group.d.ts.map +0 -1
  135. package/dist/react/ui/components/tooltip/placement.d.ts +0 -42
  136. package/dist/react/ui/components/tooltip/placement.d.ts.map +0 -1
  137. package/dist/react/ui/components/tooltip/slot.d.ts +0 -23
  138. package/dist/react/ui/components/tooltip/slot.d.ts.map +0 -1
  139. package/dist/react/ui/components/tooltip/tooltip.d.ts +0 -13
  140. package/dist/react/ui/components/tooltip/tooltip.d.ts.map +0 -1
  141. package/dist/react/ui/index.d.ts +0 -20
  142. package/dist/react/ui/index.d.ts.map +0 -1
  143. package/dist/react/ui/provider.d.ts +0 -22
  144. package/dist/react/ui/provider.d.ts.map +0 -1
  145. package/dist/react/ui/types.d.ts +0 -341
  146. package/dist/react/ui/types.d.ts.map +0 -1
  147. package/dist/ui/index.d.ts +0 -1
  148. package/dist/ui/index.js +0 -2259
  149. package/dist/ui/index.js.map +0 -1
package/dist/ui/index.js DELETED
@@ -1,2259 +0,0 @@
1
- "use client";
2
- export { Tooltip, TooltipProvider } from '../chunk-EBNZXYLT.js';
3
- import { usePortalTarget, useClientValue } from '../chunk-ST7QOM4O.js';
4
- import { useControllableState, useEscapeKey, useScrollLock } from '../chunk-JWUKAZ3A.js';
5
- import { splitVariants, Button } from '../chunk-S2ZOLTTS.js';
6
- export { Button, splitVariants, variantNames } from '../chunk-S2ZOLTTS.js';
7
- import { useUi, useUiMotion, Icon, Loader } from '../chunk-6LWCTP2Y.js';
8
- export { ANATOMY, DEFAULT_LABELS, Icon, Loader, Spinner, UiProvider, defaultUi, defineUi, useUi, useUiMotion } from '../chunk-6LWCTP2Y.js';
9
- export { cn, compileRecipe, createCn, defineRecipe, extendRecipe, joinClasses, resolveRecipe } from '../chunk-ICFPSAJZ.js';
10
- import '../chunk-3JLG24KI.js';
11
- import { trimToNull } from '../chunk-S67HGKJ2.js';
12
- import '../chunk-J3VTDBC6.js';
13
- import '../chunk-YHWA7FXX.js';
14
- import { c } from 'react/compiler-runtime';
15
- import { motion, LayoutGroup, animate, AnimatePresence } from 'motion/react';
16
- import { createContext, useEffect, useRef, useState, Children, Fragment, useId, use, useLayoutEffect, useEffectEvent, createElement } from 'react';
17
- import { jsx, jsxs } from 'react/jsx-runtime';
18
- import { createPortal } from 'react-dom';
19
-
20
- var NEAR_END_VIEWPORTS = 2;
21
- var SIDES = ["left", "right"];
22
- var EDGE_TOLERANCE = 4;
23
- var DRAG_THRESHOLD = 5;
24
- var SCROLL_STEP = 0.8;
25
- var END_SNAP_RATIO = 0.25;
26
- var FRAME_SELECTOR = "[data-carousel-frame]";
27
- function readScroll(track) {
28
- return {
29
- left: track.scrollLeft > EDGE_TOLERANCE,
30
- right: track.scrollLeft + track.clientWidth < track.scrollWidth - EDGE_TOLERANCE
31
- };
32
- }
33
- function glideTarget(track, direction) {
34
- const max = track.scrollWidth - track.clientWidth;
35
- const wanted = track.scrollLeft + track.clientWidth * SCROLL_STEP * direction;
36
- const edges = Array.from(track.children, (child) => child.offsetLeft - track.offsetLeft).filter((edge) => edge <= max);
37
- if (edges.length === 0) return Math.min(max, Math.max(0, wanted));
38
- let target = edges.reduce((best, edge) => Math.abs(edge - wanted) < Math.abs(best - wanted) ? edge : best);
39
- const snapDistance = track.clientWidth * END_SNAP_RATIO;
40
- if (direction === 1) {
41
- if (target <= track.scrollLeft + EDGE_TOLERANCE) {
42
- target = edges.find((edge) => edge > track.scrollLeft + EDGE_TOLERANCE) ?? max;
43
- }
44
- if (max - target < snapDistance) target = max;
45
- } else {
46
- if (target >= track.scrollLeft - EDGE_TOLERANCE) {
47
- target = [...edges].reverse().find((edge) => edge < track.scrollLeft - EDGE_TOLERANCE) ?? 0;
48
- }
49
- if (target < snapDistance) target = 0;
50
- }
51
- return target;
52
- }
53
- function offsetTopWithin(frame, track) {
54
- let offset = 0;
55
- for (let node = frame; node && node !== track; node = node.offsetParent) {
56
- offset += node.offsetTop;
57
- }
58
- return offset;
59
- }
60
- function clipPathFor(width, height, top, bottom, r) {
61
- const arc = (x, y) => `A${r} ${r} 0 0 1 ${x} ${y}`;
62
- return `path("${[`M0 0H${width}V${top}L${width - r} ${top}`, arc(width, top + r), `V${bottom - r}`, arc(width - r, bottom), `L${width} ${bottom}V${height}H0V${bottom}L${r} ${bottom}`, arc(0, bottom - r), `V${top + r}`, arc(r, top), `L0 ${top}Z`].join("")}")`;
63
- }
64
- function rackClip(track, selector = FRAME_SELECTOR) {
65
- const frame = track.querySelector(selector);
66
- if (!frame) return null;
67
- const radius = Number.parseFloat(getComputedStyle(frame).borderTopLeftRadius);
68
- if (!(radius > 0)) return null;
69
- const width = track.offsetWidth;
70
- const height = track.offsetHeight;
71
- const offset = offsetTopWithin(frame, track);
72
- const top = Math.max(0, offset);
73
- const bottom = Math.min(height, offset + frame.offsetHeight);
74
- const r = Math.min(radius, (bottom - top) / 2, width / 2);
75
- if (!(r > 0) || width === 0) return null;
76
- return clipPathFor(width, height, top, bottom, r);
77
- }
78
- function syncScroll(el, onNearEnd, setScroll) {
79
- if (!el) return;
80
- const isNearEnd = el.clientWidth > 0 && el.scrollLeft + el.clientWidth * NEAR_END_VIEWPORTS >= el.scrollWidth;
81
- if (isNearEnd) onNearEnd?.();
82
- const next = readScroll(el);
83
- setScroll((previous) => previous.left === next.left && previous.right === next.right ? previous : next);
84
- }
85
- function useDragScroll(ref) {
86
- const $ = c(3);
87
- let t0;
88
- let t1;
89
- if ($[0] !== ref) {
90
- t0 = () => {
91
- const track = ref.current;
92
- if (!track) {
93
- return;
94
- }
95
- let startX = 0;
96
- let startLeft = 0;
97
- let pressed = false;
98
- let dragged = false;
99
- const onDown = (event) => {
100
- if (event.pointerType !== "mouse" || event.button !== 0) {
101
- return;
102
- }
103
- pressed = true;
104
- dragged = false;
105
- startX = event.clientX;
106
- startLeft = track.scrollLeft;
107
- };
108
- const onMove = (event_0) => {
109
- if (!pressed) {
110
- return;
111
- }
112
- const delta = event_0.clientX - startX;
113
- if (!dragged && Math.abs(delta) > DRAG_THRESHOLD) {
114
- dragged = true;
115
- track.dataset.dragging = "true";
116
- }
117
- if (dragged) {
118
- track.scrollLeft = startLeft - delta;
119
- }
120
- };
121
- const onUp = () => {
122
- pressed = false;
123
- delete track.dataset.dragging;
124
- };
125
- const onClickCapture = (event_1) => {
126
- if (!dragged) {
127
- return;
128
- }
129
- event_1.preventDefault();
130
- event_1.stopPropagation();
131
- dragged = false;
132
- };
133
- track.addEventListener("pointerdown", onDown);
134
- track.addEventListener("click", onClickCapture, true);
135
- window.addEventListener("pointermove", onMove);
136
- window.addEventListener("pointerup", onUp);
137
- return () => {
138
- track.removeEventListener("pointerdown", onDown);
139
- track.removeEventListener("click", onClickCapture, true);
140
- window.removeEventListener("pointermove", onMove);
141
- window.removeEventListener("pointerup", onUp);
142
- };
143
- };
144
- t1 = [ref];
145
- $[0] = ref;
146
- $[1] = t0;
147
- $[2] = t1;
148
- } else {
149
- t0 = $[1];
150
- t1 = $[2];
151
- }
152
- useEffect(t0, t1);
153
- }
154
- var defaultSlide = ({
155
- children,
156
- className
157
- }) => /* @__PURE__ */ jsx("div", { className, children });
158
- function CarouselArrow(t0) {
159
- const $ = c(20);
160
- const {
161
- arrowClassName,
162
- classNames,
163
- onClick,
164
- side,
165
- visible
166
- } = t0;
167
- const {
168
- icons,
169
- labels,
170
- parts
171
- } = useUi();
172
- const isLeft = side === "left";
173
- const icon = isLeft ? icons.previous : icons.next;
174
- const label = isLeft ? labels.previous : labels.next;
175
- const direction = isLeft ? -1 : 1;
176
- const t1 = !visible;
177
- let t2;
178
- if ($[0] !== arrowClassName || $[1] !== classNames.arrow || $[2] !== parts.carousel || $[3] !== side || $[4] !== visible) {
179
- t2 = parts.carousel.arrow({
180
- side,
181
- visible,
182
- className: [classNames.arrow, arrowClassName]
183
- });
184
- $[0] = arrowClassName;
185
- $[1] = classNames.arrow;
186
- $[2] = parts.carousel;
187
- $[3] = side;
188
- $[4] = visible;
189
- $[5] = t2;
190
- } else {
191
- t2 = $[5];
192
- }
193
- let t3;
194
- if ($[6] !== direction || $[7] !== onClick) {
195
- t3 = () => onClick(direction);
196
- $[6] = direction;
197
- $[7] = onClick;
198
- $[8] = t3;
199
- } else {
200
- t3 = $[8];
201
- }
202
- const t4 = visible ? 0 : -1;
203
- let t5;
204
- if ($[9] !== classNames.icon || $[10] !== icon || $[11] !== parts.carousel) {
205
- t5 = icon ? /* @__PURE__ */ jsx(Icon, { className: parts.carousel.icon({
206
- className: classNames.icon
207
- }), icon }) : null;
208
- $[9] = classNames.icon;
209
- $[10] = icon;
210
- $[11] = parts.carousel;
211
- $[12] = t5;
212
- } else {
213
- t5 = $[12];
214
- }
215
- let t6;
216
- if ($[13] !== label || $[14] !== t1 || $[15] !== t2 || $[16] !== t3 || $[17] !== t4 || $[18] !== t5) {
217
- t6 = /* @__PURE__ */ jsx(Button, { "aria-hidden": t1, "aria-label": label, className: t2, onClick: t3, tabIndex: t4, children: t5 });
218
- $[13] = label;
219
- $[14] = t1;
220
- $[15] = t2;
221
- $[16] = t3;
222
- $[17] = t4;
223
- $[18] = t5;
224
- $[19] = t6;
225
- } else {
226
- t6 = $[19];
227
- }
228
- return t6;
229
- }
230
- function Carousel(t0) {
231
- const $ = c(32);
232
- const {
233
- arrowClassName,
234
- children,
235
- className,
236
- classNames: t1,
237
- frameSelector: t2,
238
- glide,
239
- itemClassName,
240
- label,
241
- onNearEnd,
242
- ready: t3,
243
- renderSlide: t4,
244
- trackProps
245
- } = t0;
246
- const classNames = t1 === void 0 ? {} : t1;
247
- const frameSelector = t2 === void 0 ? FRAME_SELECTOR : t2;
248
- const ready = t3 === void 0 ? true : t3;
249
- const renderSlide = t4 === void 0 ? defaultSlide : t4;
250
- const {
251
- parts
252
- } = useUi();
253
- const motionTokens = useUiMotion();
254
- const track = useRef(null);
255
- const stopGlide = useRef(null);
256
- let t5;
257
- if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
258
- t5 = {
259
- left: false,
260
- right: false
261
- };
262
- $[0] = t5;
263
- } else {
264
- t5 = $[0];
265
- }
266
- const [scroll, setScroll] = useState(t5);
267
- const nearEnd = useRef(onNearEnd);
268
- useDragScroll(track);
269
- let t6;
270
- if ($[1] !== onNearEnd) {
271
- t6 = () => {
272
- nearEnd.current = onNearEnd;
273
- };
274
- $[1] = onNearEnd;
275
- $[2] = t6;
276
- } else {
277
- t6 = $[2];
278
- }
279
- useEffect(t6);
280
- let t7;
281
- if ($[3] !== frameSelector) {
282
- t7 = () => {
283
- const el = track.current;
284
- if (!el) {
285
- return;
286
- }
287
- const sync = () => syncScroll(el, nearEnd.current, setScroll);
288
- const clip = () => {
289
- el.style.clipPath = rackClip(el, frameSelector) ?? "";
290
- };
291
- sync();
292
- clip();
293
- if (typeof ResizeObserver === "undefined") {
294
- return;
295
- }
296
- const observer = new ResizeObserver(() => {
297
- sync();
298
- clip();
299
- });
300
- observer.observe(el);
301
- return () => observer.disconnect();
302
- };
303
- $[3] = frameSelector;
304
- $[4] = t7;
305
- } else {
306
- t7 = $[4];
307
- }
308
- let t8;
309
- if ($[5] !== children || $[6] !== frameSelector) {
310
- t8 = [children, frameSelector];
311
- $[5] = children;
312
- $[6] = frameSelector;
313
- $[7] = t8;
314
- } else {
315
- t8 = $[7];
316
- }
317
- useEffect(t7, t8);
318
- let t9;
319
- if ($[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
320
- t9 = () => {
321
- stopGlide.current?.();
322
- stopGlide.current = null;
323
- };
324
- $[8] = t9;
325
- } else {
326
- t9 = $[8];
327
- }
328
- const stop = t9;
329
- let t10;
330
- if ($[9] !== glide || $[10] !== motionTokens || $[11] !== stop) {
331
- t10 = (direction) => {
332
- const el_0 = track.current;
333
- if (!el_0) {
334
- return;
335
- }
336
- const target = glideTarget(el_0, direction);
337
- stop();
338
- if (glide) {
339
- stopGlide.current = glide(el_0, target) ?? null;
340
- return;
341
- }
342
- const motion4 = motionTokens.glide;
343
- if (motionTokens.reduced || !motion4) {
344
- el_0.scrollLeft = target;
345
- return;
346
- }
347
- const controls = animate(el_0.scrollLeft, target, {
348
- duration: motion4.duration,
349
- ease: [...motion4.ease],
350
- onUpdate: (left) => {
351
- el_0.scrollLeft = left;
352
- }
353
- });
354
- stopGlide.current = () => controls.stop();
355
- };
356
- $[9] = glide;
357
- $[10] = motionTokens;
358
- $[11] = stop;
359
- $[12] = t10;
360
- } else {
361
- t10 = $[12];
362
- }
363
- const scrollBy = t10;
364
- const left_0 = ready && scroll.left;
365
- const right = ready && scroll.right;
366
- const slideClass = parts.carousel.slide({
367
- className: [classNames.slide, itemClassName]
368
- });
369
- const t11 = "carousel";
370
- const t12 = parts.carousel.root({
371
- className: classNames.root
372
- });
373
- const t13 = "group";
374
- const t14 = parts.carousel.track({
375
- className: [classNames.track, className]
376
- });
377
- const t15 = _temp;
378
- let t16;
379
- if ($[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
380
- t16 = () => syncScroll(track.current, nearEnd.current, setScroll);
381
- $[13] = t16;
382
- } else {
383
- t16 = $[13];
384
- }
385
- const t17 = Children.toArray(children).map((child, index) => {
386
- const slideKey = child.key ?? index;
387
- return /* @__PURE__ */ jsx(Fragment, { children: renderSlide({
388
- children: child,
389
- className: slideClass,
390
- index,
391
- slideKey
392
- }) }, slideKey);
393
- });
394
- let t18;
395
- if ($[14] !== stop || $[15] !== t14 || $[16] !== t15 || $[17] !== t16 || $[18] !== t17 || $[19] !== trackProps) {
396
- t18 = /* @__PURE__ */ jsx("div", { ...trackProps, className: t14, onDragStart: t15, onPointerDown: stop, onScroll: t16, onTouchStart: stop, onWheel: stop, ref: track, children: t17 });
397
- $[14] = stop;
398
- $[15] = t14;
399
- $[16] = t15;
400
- $[17] = t16;
401
- $[18] = t17;
402
- $[19] = trackProps;
403
- $[20] = t18;
404
- } else {
405
- t18 = $[20];
406
- }
407
- let t19;
408
- if ($[21] !== arrowClassName || $[22] !== classNames || $[23] !== left_0 || $[24] !== right || $[25] !== scrollBy) {
409
- t19 = SIDES.map((side) => /* @__PURE__ */ jsx(CarouselArrow, { arrowClassName, classNames, onClick: scrollBy, side, visible: side === "left" ? left_0 : right }, side));
410
- $[21] = arrowClassName;
411
- $[22] = classNames;
412
- $[23] = left_0;
413
- $[24] = right;
414
- $[25] = scrollBy;
415
- $[26] = t19;
416
- } else {
417
- t19 = $[26];
418
- }
419
- let t20;
420
- if ($[27] !== label || $[28] !== t12 || $[29] !== t18 || $[30] !== t19) {
421
- t20 = /* @__PURE__ */ jsxs("div", { "aria-label": label, "aria-roledescription": t11, className: t12, role: t13, children: [
422
- t18,
423
- t19
424
- ] });
425
- $[27] = label;
426
- $[28] = t12;
427
- $[29] = t18;
428
- $[30] = t19;
429
- $[31] = t20;
430
- } else {
431
- t20 = $[31];
432
- }
433
- return t20;
434
- }
435
- function _temp(event) {
436
- return event.preventDefault();
437
- }
438
- var INSTANT = {
439
- duration: 0
440
- };
441
- var HIGHLIGHT_STYLE = {
442
- inset: 0,
443
- pointerEvents: "none",
444
- position: "absolute"
445
- };
446
- var PILL_STYLE = {
447
- left: 0,
448
- pointerEvents: "none",
449
- position: "absolute"
450
- };
451
- var PILL_BOX_STYLE = {
452
- ...PILL_STYLE,
453
- top: 0
454
- };
455
- function SlidingHighlight(t0) {
456
- const $ = c(9);
457
- const {
458
- className,
459
- layoutId
460
- } = t0;
461
- const {
462
- parts
463
- } = useUi();
464
- const {
465
- follow,
466
- reduced
467
- } = useUiMotion();
468
- let t1;
469
- if ($[0] !== className || $[1] !== parts) {
470
- t1 = className ?? parts.highlight.fill();
471
- $[0] = className;
472
- $[1] = parts;
473
- $[2] = t1;
474
- } else {
475
- t1 = $[2];
476
- }
477
- const t2 = reduced ? INSTANT : follow ?? INSTANT;
478
- let t3;
479
- if ($[3] !== t2) {
480
- t3 = {
481
- layout: t2
482
- };
483
- $[3] = t2;
484
- $[4] = t3;
485
- } else {
486
- t3 = $[4];
487
- }
488
- let t4;
489
- if ($[5] !== layoutId || $[6] !== t1 || $[7] !== t3) {
490
- t4 = /* @__PURE__ */ jsx(motion.span, { "aria-hidden": "true", className: t1, layoutId, style: HIGHLIGHT_STYLE, transition: t3 });
491
- $[5] = layoutId;
492
- $[6] = t1;
493
- $[7] = t3;
494
- $[8] = t4;
495
- } else {
496
- t4 = $[8];
497
- }
498
- return t4;
499
- }
500
- var HighlightContext = createContext(null);
501
- function HighlightGroup(t0) {
502
- const $ = c(13);
503
- const {
504
- children,
505
- className
506
- } = t0;
507
- const id = useId();
508
- const [hovered, setHovered] = useState(null);
509
- const [focused, setFocused] = useState(null);
510
- const t1 = hovered ?? focused;
511
- let t2;
512
- if ($[0] !== id || $[1] !== t1) {
513
- t2 = {
514
- active: t1,
515
- focus: setFocused,
516
- hover: setHovered,
517
- id
518
- };
519
- $[0] = id;
520
- $[1] = t1;
521
- $[2] = t2;
522
- } else {
523
- t2 = $[2];
524
- }
525
- const tracker = t2;
526
- let t3;
527
- if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
528
- t3 = () => setHovered(null);
529
- $[3] = t3;
530
- } else {
531
- t3 = $[3];
532
- }
533
- let t4;
534
- if ($[4] !== children || $[5] !== className) {
535
- t4 = /* @__PURE__ */ jsx("div", { className, onPointerLeave: t3, children });
536
- $[4] = children;
537
- $[5] = className;
538
- $[6] = t4;
539
- } else {
540
- t4 = $[6];
541
- }
542
- let t5;
543
- if ($[7] !== id || $[8] !== t4) {
544
- t5 = /* @__PURE__ */ jsx(LayoutGroup, { id, children: t4 });
545
- $[7] = id;
546
- $[8] = t4;
547
- $[9] = t5;
548
- } else {
549
- t5 = $[9];
550
- }
551
- let t6;
552
- if ($[10] !== t5 || $[11] !== tracker) {
553
- t6 = /* @__PURE__ */ jsx(HighlightContext, { value: tracker, children: t5 });
554
- $[10] = t5;
555
- $[11] = tracker;
556
- $[12] = t6;
557
- } else {
558
- t6 = $[12];
559
- }
560
- return t6;
561
- }
562
- function useHighlight(key, className) {
563
- const $ = c(17);
564
- const tracker = use(HighlightContext);
565
- let t0;
566
- if ($[0] !== className || $[1] !== key || $[2] !== tracker) {
567
- t0 = tracker?.active === key ? /* @__PURE__ */ jsx(SlidingHighlight, { className, layoutId: `highlight-${tracker.id}` }) : null;
568
- $[0] = className;
569
- $[1] = key;
570
- $[2] = tracker;
571
- $[3] = t0;
572
- } else {
573
- t0 = $[3];
574
- }
575
- let t1;
576
- if ($[4] !== tracker) {
577
- t1 = () => tracker?.focus(null);
578
- $[4] = tracker;
579
- $[5] = t1;
580
- } else {
581
- t1 = $[5];
582
- }
583
- let t2;
584
- let t3;
585
- if ($[6] !== key || $[7] !== tracker) {
586
- t2 = (event) => {
587
- if (event.target.matches(":focus-visible")) {
588
- tracker?.focus(key);
589
- }
590
- };
591
- t3 = () => tracker?.hover(key);
592
- $[6] = key;
593
- $[7] = tracker;
594
- $[8] = t2;
595
- $[9] = t3;
596
- } else {
597
- t2 = $[8];
598
- t3 = $[9];
599
- }
600
- let t4;
601
- if ($[10] !== t1 || $[11] !== t2 || $[12] !== t3) {
602
- t4 = {
603
- onBlur: t1,
604
- onFocus: t2,
605
- onPointerEnter: t3
606
- };
607
- $[10] = t1;
608
- $[11] = t2;
609
- $[12] = t3;
610
- $[13] = t4;
611
- } else {
612
- t4 = $[13];
613
- }
614
- let t5;
615
- if ($[14] !== t0 || $[15] !== t4) {
616
- t5 = {
617
- node: t0,
618
- props: t4
619
- };
620
- $[14] = t0;
621
- $[15] = t4;
622
- $[16] = t5;
623
- } else {
624
- t5 = $[16];
625
- }
626
- return t5;
627
- }
628
- function useHighlightReset() {
629
- const tracker = use(HighlightContext);
630
- return {
631
- onPointerEnter: () => tracker?.hover(null)
632
- };
633
- }
634
- function SlidingPill(t0) {
635
- const $ = c(11);
636
- const {
637
- box,
638
- className
639
- } = t0;
640
- const {
641
- follow,
642
- reduced
643
- } = useUiMotion();
644
- const isSingleLine = box.height === void 0;
645
- let t1;
646
- if ($[0] !== box.height || $[1] !== box.width || $[2] !== box.x || $[3] !== box.y || $[4] !== isSingleLine) {
647
- t1 = isSingleLine ? {
648
- width: box.width,
649
- x: box.x
650
- } : {
651
- height: box.height,
652
- width: box.width,
653
- x: box.x,
654
- y: box.y
655
- };
656
- $[0] = box.height;
657
- $[1] = box.width;
658
- $[2] = box.x;
659
- $[3] = box.y;
660
- $[4] = isSingleLine;
661
- $[5] = t1;
662
- } else {
663
- t1 = $[5];
664
- }
665
- const t2 = isSingleLine ? PILL_STYLE : PILL_BOX_STYLE;
666
- const t3 = reduced ? INSTANT : follow ?? INSTANT;
667
- let t4;
668
- if ($[6] !== className || $[7] !== t1 || $[8] !== t2 || $[9] !== t3) {
669
- t4 = /* @__PURE__ */ jsx(motion.span, { animate: t1, "aria-hidden": "true", className, "data-pill": "", initial: false, style: t2, transition: t3 });
670
- $[6] = className;
671
- $[7] = t1;
672
- $[8] = t2;
673
- $[9] = t3;
674
- $[10] = t4;
675
- } else {
676
- t4 = $[10];
677
- }
678
- return t4;
679
- }
680
- function measureBox(chosen, wrapping) {
681
- return wrapping ? {
682
- height: chosen.offsetHeight,
683
- width: chosen.offsetWidth,
684
- x: chosen.offsetLeft,
685
- y: chosen.offsetTop
686
- } : {
687
- width: chosen.offsetWidth,
688
- x: chosen.offsetLeft
689
- };
690
- }
691
- function sameBox(a, b) {
692
- return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
693
- }
694
- function useSlidingPill(selector, key, t0) {
695
- const $ = c(11);
696
- let t1;
697
- if ($[0] !== t0) {
698
- t1 = t0 === void 0 ? {} : t0;
699
- $[0] = t0;
700
- $[1] = t1;
701
- } else {
702
- t1 = $[1];
703
- }
704
- const {
705
- wrapping: t2
706
- } = t1;
707
- const wrapping = t2 === void 0 ? false : t2;
708
- const ref = useRef(null);
709
- const [box, setBox] = useState(null);
710
- let t3;
711
- if ($[2] !== selector || $[3] !== wrapping) {
712
- t3 = () => {
713
- const list = ref.current;
714
- if (!list) {
715
- return;
716
- }
717
- const measure = () => {
718
- const chosen = list.querySelector(selector);
719
- if (!chosen) {
720
- return;
721
- }
722
- const next = measureBox(chosen, wrapping);
723
- setBox((prev) => prev && sameBox(prev, next) ? prev : next);
724
- };
725
- measure();
726
- if (typeof ResizeObserver === "undefined") {
727
- return;
728
- }
729
- const observer = new ResizeObserver(measure);
730
- observer.observe(list);
731
- for (const child of list.children) {
732
- observer.observe(child);
733
- }
734
- return () => observer.disconnect();
735
- };
736
- $[2] = selector;
737
- $[3] = wrapping;
738
- $[4] = t3;
739
- } else {
740
- t3 = $[4];
741
- }
742
- let t4;
743
- if ($[5] !== key || $[6] !== selector || $[7] !== wrapping) {
744
- t4 = [key, selector, wrapping];
745
- $[5] = key;
746
- $[6] = selector;
747
- $[7] = wrapping;
748
- $[8] = t4;
749
- } else {
750
- t4 = $[8];
751
- }
752
- useLayoutEffect(t3, t4);
753
- let t5;
754
- if ($[9] !== box) {
755
- t5 = {
756
- box,
757
- ref
758
- };
759
- $[9] = box;
760
- $[10] = t5;
761
- } else {
762
- t5 = $[10];
763
- }
764
- return t5;
765
- }
766
- var FAR_ROOT_MARGIN = "50% 25%";
767
- var farSight = null;
768
- function watchDistance(frame) {
769
- if (typeof IntersectionObserver === "undefined") {
770
- frame.removeAttribute("data-far");
771
- return () => {
772
- };
773
- }
774
- farSight ??= new IntersectionObserver((entries) => {
775
- for (const entry of entries) entry.target.toggleAttribute("data-far", !entry.isIntersecting);
776
- }, {
777
- rootMargin: FAR_ROOT_MARGIN
778
- });
779
- farSight.observe(frame);
780
- return () => farSight?.unobserve(frame);
781
- }
782
- function Image(t0) {
783
- const $ = c(36);
784
- const {
785
- alt: t1,
786
- className,
787
- crossOrigin,
788
- decoding: t2,
789
- fallback,
790
- fetchPriority,
791
- fill,
792
- loading,
793
- onError,
794
- onLoad,
795
- priority: t3,
796
- src,
797
- wrapperClassName,
798
- ...rest
799
- } = t0;
800
- const alt = t1 === void 0 ? "" : t1;
801
- const decoding = t2 === void 0 ? "async" : t2;
802
- const priority = t3 === void 0 ? false : t3;
803
- const {
804
- parts
805
- } = useUi();
806
- const [variants, props] = splitVariants(rest, parts.image.frame, parts.image.picture);
807
- const layout = variants.layout;
808
- const imageRef = useRef(null);
809
- const frameRef = useRef(null);
810
- let t4;
811
- if ($[0] !== src) {
812
- t4 = trimToNull(src);
813
- $[0] = src;
814
- $[1] = t4;
815
- } else {
816
- t4 = $[1];
817
- }
818
- const resolvedSrc = t4;
819
- const [hasLoaded, setHasLoaded] = useState(false);
820
- const [hasFailed, setHasFailed] = useState(false);
821
- const [refused, setRefused] = useState(null);
822
- const corsRefused = refused !== null && refused === resolvedSrc;
823
- const fillsFrame = layout !== "intrinsic" && ((fill ?? (!props.width && !props.height)) || void 0);
824
- const waiting = Boolean(resolvedSrc) && !hasLoaded && !hasFailed;
825
- let t5;
826
- let t6;
827
- if ($[2] !== waiting) {
828
- t5 = () => {
829
- const frame = frameRef.current;
830
- if (!waiting || !frame) {
831
- return;
832
- }
833
- return watchDistance(frame);
834
- };
835
- t6 = [waiting];
836
- $[2] = waiting;
837
- $[3] = t5;
838
- $[4] = t6;
839
- } else {
840
- t5 = $[3];
841
- t6 = $[4];
842
- }
843
- useEffect(t5, t6);
844
- let t7;
845
- if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
846
- t7 = () => {
847
- const image = imageRef.current;
848
- setHasLoaded(Boolean(image?.complete && image.naturalWidth > 0));
849
- setHasFailed(false);
850
- };
851
- $[5] = t7;
852
- } else {
853
- t7 = $[5];
854
- }
855
- let t8;
856
- if ($[6] !== resolvedSrc) {
857
- t8 = [resolvedSrc];
858
- $[6] = resolvedSrc;
859
- $[7] = t8;
860
- } else {
861
- t8 = $[7];
862
- }
863
- useEffect(t7, t8);
864
- if (!resolvedSrc || hasFailed && fallback) {
865
- let t92;
866
- if ($[8] !== fallback || $[9] !== parts.image || $[10] !== wrapperClassName) {
867
- t92 = fallback ? /* @__PURE__ */ jsx("div", { className: parts.image.fallback({
868
- className: wrapperClassName
869
- }), suppressHydrationWarning: true, children: fallback }) : null;
870
- $[8] = fallback;
871
- $[9] = parts.image;
872
- $[10] = wrapperClassName;
873
- $[11] = t92;
874
- } else {
875
- t92 = $[11];
876
- }
877
- return t92;
878
- }
879
- let t9;
880
- if ($[12] !== onLoad) {
881
- t9 = (event) => {
882
- setHasLoaded(true);
883
- setHasFailed(false);
884
- onLoad?.(event);
885
- };
886
- $[12] = onLoad;
887
- $[13] = t9;
888
- } else {
889
- t9 = $[13];
890
- }
891
- const handleLoad = t9;
892
- let t10;
893
- if ($[14] !== corsRefused || $[15] !== crossOrigin || $[16] !== onError || $[17] !== resolvedSrc) {
894
- t10 = (event_0) => {
895
- if (crossOrigin && !corsRefused) {
896
- setRefused(resolvedSrc);
897
- return;
898
- }
899
- setHasFailed(true);
900
- onError?.(event_0);
901
- };
902
- $[14] = corsRefused;
903
- $[15] = crossOrigin;
904
- $[16] = onError;
905
- $[17] = resolvedSrc;
906
- $[18] = t10;
907
- } else {
908
- t10 = $[18];
909
- }
910
- const handleError = t10;
911
- const t11 = parts.image.frame({
912
- ...variants,
913
- loading: !hasLoaded && !hasFailed,
914
- className: wrapperClassName
915
- });
916
- const t12 = "";
917
- const t13 = true;
918
- const t14 = false;
919
- const t15 = _temp2;
920
- const t16 = parts.image.picture({
921
- ...variants,
922
- className
923
- });
924
- const t17 = corsRefused ? void 0 : crossOrigin;
925
- const t18 = hasLoaded ? "loaded" : "loading";
926
- const t19 = loading || (priority ? "eager" : "lazy");
927
- const t20 = fetchPriority || (priority ? "high" : void 0);
928
- let t21;
929
- if ($[19] !== alt || $[20] !== decoding || $[21] !== fillsFrame || $[22] !== handleError || $[23] !== handleLoad || $[24] !== props || $[25] !== resolvedSrc || $[26] !== t15 || $[27] !== t16 || $[28] !== t17 || $[29] !== t18 || $[30] !== t19 || $[31] !== t20) {
930
- t21 = /* @__PURE__ */ jsx("img", { ref: imageRef, src: resolvedSrc, alt, draggable: t14, onDragStart: t15, className: t16, crossOrigin: t17, "data-fill": fillsFrame, "data-state": t18, onLoad: handleLoad, onError: handleError, loading: t19, fetchPriority: t20, decoding, suppressHydrationWarning: true, ...props });
931
- $[19] = alt;
932
- $[20] = decoding;
933
- $[21] = fillsFrame;
934
- $[22] = handleError;
935
- $[23] = handleLoad;
936
- $[24] = props;
937
- $[25] = resolvedSrc;
938
- $[26] = t15;
939
- $[27] = t16;
940
- $[28] = t17;
941
- $[29] = t18;
942
- $[30] = t19;
943
- $[31] = t20;
944
- $[32] = t21;
945
- } else {
946
- t21 = $[32];
947
- }
948
- let t22;
949
- if ($[33] !== t11 || $[34] !== t21) {
950
- t22 = /* @__PURE__ */ jsx("div", { className: t11, "data-far": t12, ref: frameRef, suppressHydrationWarning: t13, children: t21 });
951
- $[33] = t11;
952
- $[34] = t21;
953
- $[35] = t22;
954
- } else {
955
- t22 = $[35];
956
- }
957
- return t22;
958
- }
959
- function _temp2(event_1) {
960
- return event_1.preventDefault();
961
- }
962
- var DEFAULT_ALT = "Avatar";
963
- function Avatar(t0) {
964
- const $ = c(37);
965
- let alt;
966
- let children;
967
- let className;
968
- let classNames;
969
- let fallback;
970
- let name;
971
- let props;
972
- let ref;
973
- let size;
974
- let src;
975
- let style;
976
- if ($[0] !== t0) {
977
- ({
978
- alt,
979
- children,
980
- className,
981
- classNames,
982
- fallback,
983
- name,
984
- ref,
985
- size,
986
- src,
987
- style,
988
- ...props
989
- } = t0);
990
- $[0] = t0;
991
- $[1] = alt;
992
- $[2] = children;
993
- $[3] = className;
994
- $[4] = classNames;
995
- $[5] = fallback;
996
- $[6] = name;
997
- $[7] = props;
998
- $[8] = ref;
999
- $[9] = size;
1000
- $[10] = src;
1001
- $[11] = style;
1002
- } else {
1003
- alt = $[1];
1004
- children = $[2];
1005
- className = $[3];
1006
- classNames = $[4];
1007
- fallback = $[5];
1008
- name = $[6];
1009
- props = $[7];
1010
- ref = $[8];
1011
- size = $[9];
1012
- src = $[10];
1013
- style = $[11];
1014
- }
1015
- const {
1016
- parts
1017
- } = useUi();
1018
- const [failedSrc, setFailedSrc] = useState(null);
1019
- const dimension = typeof size === "number" ? `${size}px` : size;
1020
- let t1;
1021
- if ($[12] !== dimension) {
1022
- t1 = dimension ? {
1023
- height: dimension,
1024
- width: dimension
1025
- } : null;
1026
- $[12] = dimension;
1027
- $[13] = t1;
1028
- } else {
1029
- t1 = $[13];
1030
- }
1031
- const box = t1;
1032
- let t2;
1033
- if ($[14] !== box || $[15] !== style) {
1034
- t2 = {
1035
- ...box,
1036
- ...style
1037
- };
1038
- $[14] = box;
1039
- $[15] = style;
1040
- $[16] = t2;
1041
- } else {
1042
- t2 = $[16];
1043
- }
1044
- let t3;
1045
- if ($[17] !== className || $[18] !== classNames?.root || $[19] !== parts.avatar) {
1046
- t3 = parts.avatar.root({
1047
- className: [classNames?.root, className]
1048
- });
1049
- $[17] = className;
1050
- $[18] = classNames?.root;
1051
- $[19] = parts.avatar;
1052
- $[20] = t3;
1053
- } else {
1054
- t3 = $[20];
1055
- }
1056
- let t4;
1057
- if ($[21] !== alt || $[22] !== children || $[23] !== classNames?.image || $[24] !== classNames?.initials || $[25] !== failedSrc || $[26] !== fallback || $[27] !== name || $[28] !== parts.avatar || $[29] !== src) {
1058
- t4 = src && src !== failedSrc ? /* @__PURE__ */ jsx(Image, { src, alt: alt || name || DEFAULT_ALT, onError: () => setFailedSrc(src), className: parts.avatar.image({
1059
- className: classNames?.image
1060
- }) }) : /* @__PURE__ */ jsx("span", { className: parts.avatar.initials({
1061
- className: classNames?.initials
1062
- }), children: fallback ?? children ?? initialsOf(name || alt) });
1063
- $[21] = alt;
1064
- $[22] = children;
1065
- $[23] = classNames?.image;
1066
- $[24] = classNames?.initials;
1067
- $[25] = failedSrc;
1068
- $[26] = fallback;
1069
- $[27] = name;
1070
- $[28] = parts.avatar;
1071
- $[29] = src;
1072
- $[30] = t4;
1073
- } else {
1074
- t4 = $[30];
1075
- }
1076
- let t5;
1077
- if ($[31] !== props || $[32] !== ref || $[33] !== t2 || $[34] !== t3 || $[35] !== t4) {
1078
- t5 = /* @__PURE__ */ jsx("span", { ref, style: t2, className: t3, ...props, children: t4 });
1079
- $[31] = props;
1080
- $[32] = ref;
1081
- $[33] = t2;
1082
- $[34] = t3;
1083
- $[35] = t4;
1084
- $[36] = t5;
1085
- } else {
1086
- t5 = $[36];
1087
- }
1088
- return t5;
1089
- }
1090
- function initialsOf(name) {
1091
- const parts = name?.trim().split(/\s+/).filter(Boolean) ?? [];
1092
- if (parts.length === 0) return "?";
1093
- if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
1094
- return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase();
1095
- }
1096
- function CheckboxIndicator(t0) {
1097
- const $ = c(6);
1098
- const {
1099
- className,
1100
- icon,
1101
- pending: t1,
1102
- ...props
1103
- } = t0;
1104
- const pending = t1 === void 0 ? false : t1;
1105
- const {
1106
- icons,
1107
- parts
1108
- } = useUi();
1109
- const [variants] = splitVariants(props, parts.checkbox.box);
1110
- const glyph = icon ?? icons.check;
1111
- const glyphNode = glyph ? /* @__PURE__ */ jsx(Icon, { className: parts.checkbox.glyph(variants), icon: glyph }) : null;
1112
- const t2 = "true";
1113
- const t3 = parts.checkbox.box({
1114
- ...variants,
1115
- className
1116
- });
1117
- let t4;
1118
- if ($[0] !== glyphNode || $[1] !== pending) {
1119
- t4 = pending ? /* @__PURE__ */ jsx(Loader, {}) : glyphNode;
1120
- $[0] = glyphNode;
1121
- $[1] = pending;
1122
- $[2] = t4;
1123
- } else {
1124
- t4 = $[2];
1125
- }
1126
- let t5;
1127
- if ($[3] !== t3 || $[4] !== t4) {
1128
- t5 = /* @__PURE__ */ jsx("span", { "aria-hidden": t2, className: t3, children: t4 });
1129
- $[3] = t3;
1130
- $[4] = t4;
1131
- $[5] = t5;
1132
- } else {
1133
- t5 = $[5];
1134
- }
1135
- return t5;
1136
- }
1137
- function Checkbox(t0) {
1138
- const $ = c(26);
1139
- const {
1140
- checked,
1141
- children,
1142
- className,
1143
- classNames,
1144
- disabled,
1145
- icon,
1146
- onCheckedChange,
1147
- onClick,
1148
- pending,
1149
- ref,
1150
- type: t1,
1151
- ...props
1152
- } = t0;
1153
- const type = t1 === void 0 ? "button" : t1;
1154
- const {
1155
- parts
1156
- } = useUi();
1157
- const [variants, rest] = splitVariants(props, parts.checkbox.box);
1158
- const t2 = pending || void 0;
1159
- let t3;
1160
- if ($[0] !== checked || $[1] !== disabled || $[2] !== onCheckedChange || $[3] !== onClick) {
1161
- t3 = (event) => {
1162
- onClick?.(event);
1163
- if (!event.defaultPrevented && !disabled) {
1164
- onCheckedChange?.(!checked);
1165
- }
1166
- };
1167
- $[0] = checked;
1168
- $[1] = disabled;
1169
- $[2] = onCheckedChange;
1170
- $[3] = onClick;
1171
- $[4] = t3;
1172
- } else {
1173
- t3 = $[4];
1174
- }
1175
- let t4;
1176
- if ($[5] !== className || $[6] !== classNames?.root || $[7] !== parts.checkbox) {
1177
- t4 = parts.checkbox.root({
1178
- className: [classNames?.root, className]
1179
- });
1180
- $[5] = className;
1181
- $[6] = classNames?.root;
1182
- $[7] = parts.checkbox;
1183
- $[8] = t4;
1184
- } else {
1185
- t4 = $[8];
1186
- }
1187
- const t5 = classNames?.box;
1188
- let t6;
1189
- if ($[9] !== checked || $[10] !== icon || $[11] !== pending || $[12] !== t5 || $[13] !== variants) {
1190
- t6 = /* @__PURE__ */ jsx(CheckboxIndicator, { ...variants, checked, className: t5, icon, pending });
1191
- $[9] = checked;
1192
- $[10] = icon;
1193
- $[11] = pending;
1194
- $[12] = t5;
1195
- $[13] = variants;
1196
- $[14] = t6;
1197
- } else {
1198
- t6 = $[14];
1199
- }
1200
- let t7;
1201
- if ($[15] !== checked || $[16] !== children || $[17] !== disabled || $[18] !== ref || $[19] !== rest || $[20] !== t2 || $[21] !== t3 || $[22] !== t4 || $[23] !== t6 || $[24] !== type) {
1202
- t7 = /* @__PURE__ */ jsxs("button", { ref, type, role: "checkbox", "aria-checked": checked, "aria-busy": t2, disabled, onClick: t3, className: t4, ...rest, children: [
1203
- t6,
1204
- children
1205
- ] });
1206
- $[15] = checked;
1207
- $[16] = children;
1208
- $[17] = disabled;
1209
- $[18] = ref;
1210
- $[19] = rest;
1211
- $[20] = t2;
1212
- $[21] = t3;
1213
- $[22] = t4;
1214
- $[23] = t6;
1215
- $[24] = type;
1216
- $[25] = t7;
1217
- } else {
1218
- t7 = $[25];
1219
- }
1220
- return t7;
1221
- }
1222
- function Input(t0) {
1223
- const $ = c(5);
1224
- const {
1225
- className,
1226
- ref,
1227
- type: t1,
1228
- ...props
1229
- } = t0;
1230
- const type = t1 === void 0 ? "text" : t1;
1231
- const {
1232
- parts
1233
- } = useUi();
1234
- const [variants, rest] = splitVariants(props, parts.input.field);
1235
- const t2 = parts.input.field({
1236
- ...variants,
1237
- className
1238
- });
1239
- let t3;
1240
- if ($[0] !== ref || $[1] !== rest || $[2] !== t2 || $[3] !== type) {
1241
- t3 = /* @__PURE__ */ jsx("input", { ref, type, className: t2, ...rest });
1242
- $[0] = ref;
1243
- $[1] = rest;
1244
- $[2] = t2;
1245
- $[3] = type;
1246
- $[4] = t3;
1247
- } else {
1248
- t3 = $[4];
1249
- }
1250
- return t3;
1251
- }
1252
- function Textarea(t0) {
1253
- const $ = c(9);
1254
- const {
1255
- className,
1256
- maxHeight,
1257
- minHeight,
1258
- ref,
1259
- style,
1260
- ...props
1261
- } = t0;
1262
- const {
1263
- parts
1264
- } = useUi();
1265
- const [variants, rest] = splitVariants(props, parts.input.field, parts.input.area);
1266
- const t1 = parts.input.field({
1267
- ...variants,
1268
- className: [parts.input.area(variants), className]
1269
- });
1270
- let t2;
1271
- if ($[0] !== maxHeight || $[1] !== minHeight || $[2] !== style) {
1272
- t2 = {
1273
- maxHeight,
1274
- minHeight,
1275
- ...style
1276
- };
1277
- $[0] = maxHeight;
1278
- $[1] = minHeight;
1279
- $[2] = style;
1280
- $[3] = t2;
1281
- } else {
1282
- t2 = $[3];
1283
- }
1284
- let t3;
1285
- if ($[4] !== ref || $[5] !== rest || $[6] !== t1 || $[7] !== t2) {
1286
- t3 = /* @__PURE__ */ jsx("textarea", { ref, className: t1, style: t2, ...rest });
1287
- $[4] = ref;
1288
- $[5] = rest;
1289
- $[6] = t1;
1290
- $[7] = t2;
1291
- $[8] = t3;
1292
- } else {
1293
- t3 = $[8];
1294
- }
1295
- return t3;
1296
- }
1297
- function Segment(t0) {
1298
- const $ = c(35);
1299
- const {
1300
- active,
1301
- classNames,
1302
- iconSize,
1303
- item,
1304
- onSelect,
1305
- pillReady,
1306
- variants
1307
- } = t0;
1308
- const {
1309
- parts
1310
- } = useUi();
1311
- const hasCount = item.count !== void 0 && item.count > 0;
1312
- let T0;
1313
- let t1;
1314
- let t2;
1315
- if ($[0] !== active || $[1] !== classNames?.chosen || $[2] !== classNames?.segment || $[3] !== parts.segmented || $[4] !== pillReady || $[5] !== variants) {
1316
- const chosenClass = active && !pillReady && parts.segmented.chosen({
1317
- className: classNames?.chosen
1318
- });
1319
- T0 = Button;
1320
- t1 = active;
1321
- t2 = parts.segmented.segment({
1322
- ...variants,
1323
- active,
1324
- className: [classNames?.segment, chosenClass]
1325
- });
1326
- $[0] = active;
1327
- $[1] = classNames?.chosen;
1328
- $[2] = classNames?.segment;
1329
- $[3] = parts.segmented;
1330
- $[4] = pillReady;
1331
- $[5] = variants;
1332
- $[6] = T0;
1333
- $[7] = t1;
1334
- $[8] = t2;
1335
- } else {
1336
- T0 = $[6];
1337
- t1 = $[7];
1338
- t2 = $[8];
1339
- }
1340
- const t3 = active ? "" : void 0;
1341
- let t4;
1342
- if ($[9] !== item.key || $[10] !== onSelect) {
1343
- t4 = () => onSelect(item.key);
1344
- $[9] = item.key;
1345
- $[10] = onSelect;
1346
- $[11] = t4;
1347
- } else {
1348
- t4 = $[11];
1349
- }
1350
- let t5;
1351
- if ($[12] !== classNames?.icon || $[13] !== iconSize || $[14] !== item.icon || $[15] !== parts.segmented || $[16] !== variants) {
1352
- t5 = item.icon ? /* @__PURE__ */ jsx(Icon, { className: parts.segmented.icon({
1353
- ...variants,
1354
- className: classNames?.icon
1355
- }), icon: item.icon, size: iconSize }) : null;
1356
- $[12] = classNames?.icon;
1357
- $[13] = iconSize;
1358
- $[14] = item.icon;
1359
- $[15] = parts.segmented;
1360
- $[16] = variants;
1361
- $[17] = t5;
1362
- } else {
1363
- t5 = $[17];
1364
- }
1365
- let t6;
1366
- if ($[18] !== item.label) {
1367
- t6 = /* @__PURE__ */ jsx("span", { children: item.label });
1368
- $[18] = item.label;
1369
- $[19] = t6;
1370
- } else {
1371
- t6 = $[19];
1372
- }
1373
- let t7;
1374
- if ($[20] !== classNames?.count || $[21] !== hasCount || $[22] !== item.count || $[23] !== parts.segmented) {
1375
- t7 = hasCount ? /* @__PURE__ */ jsx("span", { className: parts.segmented.count({
1376
- className: classNames?.count
1377
- }), children: item.count }) : null;
1378
- $[20] = classNames?.count;
1379
- $[21] = hasCount;
1380
- $[22] = item.count;
1381
- $[23] = parts.segmented;
1382
- $[24] = t7;
1383
- } else {
1384
- t7 = $[24];
1385
- }
1386
- let t8;
1387
- if ($[25] !== T0 || $[26] !== item.disabled || $[27] !== t1 || $[28] !== t2 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5 || $[32] !== t6 || $[33] !== t7) {
1388
- t8 = /* @__PURE__ */ jsxs(T0, { "aria-selected": t1, className: t2, "data-pill-target": t3, disabled: item.disabled, onClick: t4, role: "tab", children: [
1389
- t5,
1390
- t6,
1391
- t7
1392
- ] });
1393
- $[25] = T0;
1394
- $[26] = item.disabled;
1395
- $[27] = t1;
1396
- $[28] = t2;
1397
- $[29] = t3;
1398
- $[30] = t4;
1399
- $[31] = t5;
1400
- $[32] = t6;
1401
- $[33] = t7;
1402
- $[34] = t8;
1403
- } else {
1404
- t8 = $[34];
1405
- }
1406
- return t8;
1407
- }
1408
- function SegmentedControl(t0) {
1409
- const $ = c(21);
1410
- const {
1411
- ariaLabel,
1412
- className,
1413
- classNames,
1414
- iconSize,
1415
- items,
1416
- onChange,
1417
- value,
1418
- ...props
1419
- } = t0;
1420
- const {
1421
- parts
1422
- } = useUi();
1423
- const [variants] = splitVariants(props, parts.segmented.root, parts.segmented.segment, parts.segmented.pill);
1424
- const {
1425
- box: pill,
1426
- ref: listRef
1427
- } = useSlidingPill("[data-pill-target]", value);
1428
- if (items.length === 0) {
1429
- return null;
1430
- }
1431
- const t1 = parts.segmented.root({
1432
- ...variants,
1433
- className: [classNames?.root, className]
1434
- });
1435
- const t2 = "tablist";
1436
- const t3 = pill ? /* @__PURE__ */ jsx(SlidingPill, { box: pill, className: parts.segmented.pill({
1437
- ...variants,
1438
- className: classNames?.pill
1439
- }) }) : null;
1440
- let t4;
1441
- if ($[0] !== classNames || $[1] !== iconSize || $[2] !== items || $[3] !== onChange || $[4] !== pill || $[5] !== value || $[6] !== variants) {
1442
- let t52;
1443
- if ($[8] !== classNames || $[9] !== iconSize || $[10] !== onChange || $[11] !== pill || $[12] !== value || $[13] !== variants) {
1444
- t52 = (item) => /* @__PURE__ */ jsx(Segment, { active: item.key === value, classNames, iconSize, item, onSelect: onChange, pillReady: Boolean(pill), variants }, item.key);
1445
- $[8] = classNames;
1446
- $[9] = iconSize;
1447
- $[10] = onChange;
1448
- $[11] = pill;
1449
- $[12] = value;
1450
- $[13] = variants;
1451
- $[14] = t52;
1452
- } else {
1453
- t52 = $[14];
1454
- }
1455
- t4 = items.map(t52);
1456
- $[0] = classNames;
1457
- $[1] = iconSize;
1458
- $[2] = items;
1459
- $[3] = onChange;
1460
- $[4] = pill;
1461
- $[5] = value;
1462
- $[6] = variants;
1463
- $[7] = t4;
1464
- } else {
1465
- t4 = $[7];
1466
- }
1467
- let t5;
1468
- if ($[15] !== ariaLabel || $[16] !== listRef || $[17] !== t1 || $[18] !== t3 || $[19] !== t4) {
1469
- t5 = /* @__PURE__ */ jsxs("div", { "aria-label": ariaLabel, className: t1, ref: listRef, role: t2, children: [
1470
- t3,
1471
- t4
1472
- ] });
1473
- $[15] = ariaLabel;
1474
- $[16] = listRef;
1475
- $[17] = t1;
1476
- $[18] = t3;
1477
- $[19] = t4;
1478
- $[20] = t5;
1479
- } else {
1480
- t5 = $[20];
1481
- }
1482
- return t5;
1483
- }
1484
- function stepHighlight(enabled, highlighted, key) {
1485
- const at = enabled.indexOf(highlighted);
1486
- const last = enabled.length - 1;
1487
- if (key === "ArrowDown") return at < 0 || at >= last ? 0 : at + 1;
1488
- return at <= 0 ? last : at - 1;
1489
- }
1490
- function menuPlacementStyle(anchor, anchored, anchorName, offset) {
1491
- if (anchored) {
1492
- return {
1493
- left: "anchor(left)",
1494
- marginTop: offset,
1495
- position: "fixed",
1496
- positionAnchor: anchorName,
1497
- positionTryFallbacks: "flip-block",
1498
- top: "anchor(bottom)",
1499
- width: "anchor-size(width)"
1500
- };
1501
- }
1502
- return {
1503
- "--select-available-height": `${anchor.maxHeight}px`,
1504
- left: anchor.left,
1505
- marginBottom: anchor.up ? offset : 0,
1506
- marginTop: anchor.up ? 0 : offset,
1507
- position: "fixed",
1508
- width: anchor.width,
1509
- ...anchor.up ? {
1510
- bottom: anchor.edge,
1511
- top: "auto"
1512
- } : {
1513
- top: anchor.edge
1514
- }
1515
- };
1516
- }
1517
- function SelectOptionRow(t0) {
1518
- const $ = c(61);
1519
- const {
1520
- classNames,
1521
- highlighted,
1522
- index,
1523
- onChoose,
1524
- onHover,
1525
- option,
1526
- optionMotion,
1527
- selected,
1528
- variants
1529
- } = t0;
1530
- const {
1531
- icons,
1532
- parts
1533
- } = useUi();
1534
- const t1 = optionMotion ? "initial" : false;
1535
- const t2 = option.disabled;
1536
- const t3 = highlighted || void 0;
1537
- let t4;
1538
- if ($[0] !== index || $[1] !== onHover || $[2] !== option.disabled) {
1539
- t4 = () => {
1540
- if (!option.disabled) {
1541
- onHover(index);
1542
- }
1543
- };
1544
- $[0] = index;
1545
- $[1] = onHover;
1546
- $[2] = option.disabled;
1547
- $[3] = t4;
1548
- } else {
1549
- t4 = $[3];
1550
- }
1551
- let t5;
1552
- if ($[4] !== onChoose || $[5] !== option) {
1553
- t5 = () => onChoose(option);
1554
- $[4] = onChoose;
1555
- $[5] = option;
1556
- $[6] = t5;
1557
- } else {
1558
- t5 = $[6];
1559
- }
1560
- let t6;
1561
- if ($[7] !== classNames.option || $[8] !== parts.select || $[9] !== variants) {
1562
- t6 = parts.select.option({
1563
- ...variants,
1564
- className: classNames.option
1565
- });
1566
- $[7] = classNames.option;
1567
- $[8] = parts.select;
1568
- $[9] = variants;
1569
- $[10] = t6;
1570
- } else {
1571
- t6 = $[10];
1572
- }
1573
- let t7;
1574
- if ($[11] !== classNames.highlight || $[12] !== highlighted || $[13] !== parts.select) {
1575
- t7 = highlighted ? /* @__PURE__ */ jsx(SlidingHighlight, { className: parts.select.highlight({
1576
- className: classNames.highlight
1577
- }), layoutId: "select-option-highlight" }) : null;
1578
- $[11] = classNames.highlight;
1579
- $[12] = highlighted;
1580
- $[13] = parts.select;
1581
- $[14] = t7;
1582
- } else {
1583
- t7 = $[14];
1584
- }
1585
- let t8;
1586
- if ($[15] !== classNames.optionBody || $[16] !== parts.select) {
1587
- t8 = parts.select.optionBody({
1588
- className: classNames.optionBody
1589
- });
1590
- $[15] = classNames.optionBody;
1591
- $[16] = parts.select;
1592
- $[17] = t8;
1593
- } else {
1594
- t8 = $[17];
1595
- }
1596
- let t9;
1597
- if ($[18] !== classNames.icon || $[19] !== option.icon || $[20] !== parts.select) {
1598
- t9 = option.icon ? /* @__PURE__ */ jsx(Icon, { icon: option.icon, className: parts.select.icon({
1599
- className: classNames.icon
1600
- }) }) : null;
1601
- $[18] = classNames.icon;
1602
- $[19] = option.icon;
1603
- $[20] = parts.select;
1604
- $[21] = t9;
1605
- } else {
1606
- t9 = $[21];
1607
- }
1608
- let t10;
1609
- if ($[22] !== classNames.text || $[23] !== parts.select) {
1610
- t10 = parts.select.text({
1611
- className: classNames.text
1612
- });
1613
- $[22] = classNames.text;
1614
- $[23] = parts.select;
1615
- $[24] = t10;
1616
- } else {
1617
- t10 = $[24];
1618
- }
1619
- let t11;
1620
- if ($[25] !== classNames.label || $[26] !== parts.select) {
1621
- t11 = parts.select.label({
1622
- className: classNames.label
1623
- });
1624
- $[25] = classNames.label;
1625
- $[26] = parts.select;
1626
- $[27] = t11;
1627
- } else {
1628
- t11 = $[27];
1629
- }
1630
- let t12;
1631
- if ($[28] !== option.label || $[29] !== t11) {
1632
- t12 = /* @__PURE__ */ jsx("span", { className: t11, children: option.label });
1633
- $[28] = option.label;
1634
- $[29] = t11;
1635
- $[30] = t12;
1636
- } else {
1637
- t12 = $[30];
1638
- }
1639
- let t13;
1640
- if ($[31] !== classNames.description || $[32] !== option.description || $[33] !== parts.select) {
1641
- t13 = option.description ? /* @__PURE__ */ jsx("span", { className: parts.select.description({
1642
- className: classNames.description
1643
- }), children: option.description }) : null;
1644
- $[31] = classNames.description;
1645
- $[32] = option.description;
1646
- $[33] = parts.select;
1647
- $[34] = t13;
1648
- } else {
1649
- t13 = $[34];
1650
- }
1651
- let t14;
1652
- if ($[35] !== t10 || $[36] !== t12 || $[37] !== t13) {
1653
- t14 = /* @__PURE__ */ jsxs("span", { className: t10, children: [
1654
- t12,
1655
- t13
1656
- ] });
1657
- $[35] = t10;
1658
- $[36] = t12;
1659
- $[37] = t13;
1660
- $[38] = t14;
1661
- } else {
1662
- t14 = $[38];
1663
- }
1664
- let t15;
1665
- if ($[39] !== t14 || $[40] !== t8 || $[41] !== t9) {
1666
- t15 = /* @__PURE__ */ jsxs("span", { className: t8, children: [
1667
- t9,
1668
- t14
1669
- ] });
1670
- $[39] = t14;
1671
- $[40] = t8;
1672
- $[41] = t9;
1673
- $[42] = t15;
1674
- } else {
1675
- t15 = $[42];
1676
- }
1677
- let t16;
1678
- if ($[43] !== classNames.check || $[44] !== icons || $[45] !== parts.select || $[46] !== selected) {
1679
- t16 = selected && icons.selected ? /* @__PURE__ */ jsx(Icon, { icon: icons.selected, className: parts.select.check({
1680
- className: classNames.check
1681
- }) }) : null;
1682
- $[43] = classNames.check;
1683
- $[44] = icons;
1684
- $[45] = parts.select;
1685
- $[46] = selected;
1686
- $[47] = t16;
1687
- } else {
1688
- t16 = $[47];
1689
- }
1690
- let t17;
1691
- if ($[48] !== index || $[49] !== option.disabled || $[50] !== optionMotion || $[51] !== selected || $[52] !== t1 || $[53] !== t15 || $[54] !== t16 || $[55] !== t3 || $[56] !== t4 || $[57] !== t5 || $[58] !== t6 || $[59] !== t7) {
1692
- t17 = /* @__PURE__ */ jsxs(motion.div, { animate: "animate", custom: index, initial: t1, role: "option", variants: optionMotion, "aria-selected": selected, "aria-disabled": t2, "data-highlighted": t3, onMouseEnter: t4, onClick: t5, className: t6, children: [
1693
- t7,
1694
- t15,
1695
- t16
1696
- ] });
1697
- $[48] = index;
1698
- $[49] = option.disabled;
1699
- $[50] = optionMotion;
1700
- $[51] = selected;
1701
- $[52] = t1;
1702
- $[53] = t15;
1703
- $[54] = t16;
1704
- $[55] = t3;
1705
- $[56] = t4;
1706
- $[57] = t5;
1707
- $[58] = t6;
1708
- $[59] = t7;
1709
- $[60] = t17;
1710
- } else {
1711
- t17 = $[60];
1712
- }
1713
- return t17;
1714
- }
1715
- var NO_HIGHLIGHT = -1;
1716
- var ARROW_KEYS = ["ArrowDown", "ArrowUp"];
1717
- var SELECT_KEYS = ["Enter", " "];
1718
- var NON_IDENTIFIER_CHARS = /[^a-zA-Z0-9_-]/g;
1719
- var canAnchor = () => typeof CSS !== "undefined" && typeof CSS.supports === "function" && CSS.supports("anchor-name", "--a");
1720
- function Select(t0) {
1721
- const $ = c(67);
1722
- const {
1723
- ariaLabel,
1724
- className,
1725
- classNames: t1,
1726
- collisionPadding: t2,
1727
- defaultValue,
1728
- disabled,
1729
- empty,
1730
- floatingProps,
1731
- name,
1732
- offset: t3,
1733
- onChange,
1734
- options,
1735
- placeholder,
1736
- placement: t4,
1737
- value: valueProp,
1738
- ...props
1739
- } = t0;
1740
- const classNames = t1 === void 0 ? {} : t1;
1741
- const collisionPadding = t2 === void 0 ? 0 : t2;
1742
- const offset = t3 === void 0 ? 0 : t3;
1743
- const placement = t4 === void 0 ? "popover" : t4;
1744
- const {
1745
- icons,
1746
- labels,
1747
- parts
1748
- } = useUi();
1749
- const motionTokens = useUiMotion();
1750
- const [variants] = splitVariants(props, parts.select.trigger, parts.select.menu, parts.select.option);
1751
- const generatedId = useId();
1752
- const listboxId = `select-listbox-${generatedId}`;
1753
- let t5;
1754
- if ($[0] !== defaultValue || $[1] !== valueProp) {
1755
- t5 = {
1756
- defaultValue,
1757
- value: valueProp
1758
- };
1759
- $[0] = defaultValue;
1760
- $[1] = valueProp;
1761
- $[2] = t5;
1762
- } else {
1763
- t5 = $[2];
1764
- }
1765
- const [selectedValue, setSelectedValue] = useControllableState(t5);
1766
- const [isOpen, setIsOpen] = useState(false);
1767
- const [highlightedIndex, setHighlightedIndex] = useState(NO_HIGHLIGHT);
1768
- const rootRef = useRef(null);
1769
- const triggerRef = useRef(null);
1770
- const menuRef = useRef(null);
1771
- const host = usePortalTarget();
1772
- const [anchor, setAnchor] = useState(null);
1773
- const floating = placement === "popover" && host !== null && anchor !== null;
1774
- const anchored = useClientValue(canAnchor, false);
1775
- let t6;
1776
- if ($[3] !== generatedId) {
1777
- t6 = generatedId.replace(NON_IDENTIFIER_CHARS, "");
1778
- $[3] = generatedId;
1779
- $[4] = t6;
1780
- } else {
1781
- t6 = $[4];
1782
- }
1783
- const anchorName = `--select-${t6}`;
1784
- let t7;
1785
- if ($[5] !== collisionPadding || $[6] !== offset || $[7] !== options.length) {
1786
- t7 = () => {
1787
- const box = triggerRef.current?.getBoundingClientRect();
1788
- if (!box) {
1789
- return;
1790
- }
1791
- const wanted = options.length * box.height;
1792
- const below = window.innerHeight - box.bottom - offset - collisionPadding;
1793
- const above = box.top - offset - collisionPadding;
1794
- const up = wanted > below && above > below;
1795
- setAnchor({
1796
- edge: up ? window.innerHeight - box.top : box.bottom,
1797
- left: box.left,
1798
- maxHeight: Math.max(0, up ? above : below),
1799
- up,
1800
- width: box.width
1801
- });
1802
- };
1803
- $[5] = collisionPadding;
1804
- $[6] = offset;
1805
- $[7] = options.length;
1806
- $[8] = t7;
1807
- } else {
1808
- t7 = $[8];
1809
- }
1810
- const place = t7;
1811
- const onViewportChange = useEffectEvent(place);
1812
- let t8;
1813
- if ($[9] !== options || $[10] !== selectedValue) {
1814
- t8 = options.find((option) => option.value === selectedValue) ?? null;
1815
- $[9] = options;
1816
- $[10] = selectedValue;
1817
- $[11] = t8;
1818
- } else {
1819
- t8 = $[11];
1820
- }
1821
- const selectedOption = t8;
1822
- let t9;
1823
- if ($[12] !== options) {
1824
- t9 = options.flatMap(_temp3);
1825
- $[12] = options;
1826
- $[13] = t9;
1827
- } else {
1828
- t9 = $[13];
1829
- }
1830
- const enabledIndices = t9;
1831
- let t10;
1832
- if ($[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1833
- t10 = () => setIsOpen(false);
1834
- $[14] = t10;
1835
- } else {
1836
- t10 = $[14];
1837
- }
1838
- const close = t10;
1839
- let t11;
1840
- if ($[15] !== enabledIndices || $[16] !== options || $[17] !== place || $[18] !== selectedValue) {
1841
- t11 = () => {
1842
- place();
1843
- setIsOpen(true);
1844
- const selected = options.findIndex((option_1) => option_1.value === selectedValue && !option_1.disabled);
1845
- setHighlightedIndex(selected >= 0 ? selected : enabledIndices[0] ?? NO_HIGHLIGHT);
1846
- };
1847
- $[15] = enabledIndices;
1848
- $[16] = options;
1849
- $[17] = place;
1850
- $[18] = selectedValue;
1851
- $[19] = t11;
1852
- } else {
1853
- t11 = $[19];
1854
- }
1855
- const open = t11;
1856
- let t12;
1857
- if ($[20] !== isOpen) {
1858
- t12 = () => {
1859
- if (!isOpen) {
1860
- return;
1861
- }
1862
- close();
1863
- triggerRef.current?.focus();
1864
- };
1865
- $[20] = isOpen;
1866
- $[21] = t12;
1867
- } else {
1868
- t12 = $[21];
1869
- }
1870
- useEscapeKey(t12, isOpen);
1871
- let t13;
1872
- let t14;
1873
- if ($[22] !== isOpen) {
1874
- t13 = () => {
1875
- if (!isOpen) {
1876
- return;
1877
- }
1878
- const handlePointerDownOutside = (event) => {
1879
- const target = event.target;
1880
- if (!rootRef.current?.contains(target) && !menuRef.current?.contains(target)) {
1881
- setIsOpen(false);
1882
- }
1883
- };
1884
- document.addEventListener("mousedown", handlePointerDownOutside);
1885
- return () => document.removeEventListener("mousedown", handlePointerDownOutside);
1886
- };
1887
- t14 = [isOpen];
1888
- $[22] = isOpen;
1889
- $[23] = t13;
1890
- $[24] = t14;
1891
- } else {
1892
- t13 = $[23];
1893
- t14 = $[24];
1894
- }
1895
- useEffect(t13, t14);
1896
- let t15;
1897
- if ($[25] !== anchored || $[26] !== isOpen || $[27] !== onViewportChange || $[28] !== placement) {
1898
- t15 = () => {
1899
- if (!isOpen || placement !== "popover" || anchored) {
1900
- return;
1901
- }
1902
- const handleViewportChange = () => onViewportChange();
1903
- window.addEventListener("scroll", handleViewportChange, {
1904
- capture: true,
1905
- passive: true
1906
- });
1907
- window.addEventListener("resize", handleViewportChange);
1908
- return () => {
1909
- window.removeEventListener("scroll", handleViewportChange, {
1910
- capture: true
1911
- });
1912
- window.removeEventListener("resize", handleViewportChange);
1913
- };
1914
- };
1915
- $[25] = anchored;
1916
- $[26] = isOpen;
1917
- $[27] = onViewportChange;
1918
- $[28] = placement;
1919
- $[29] = t15;
1920
- } else {
1921
- t15 = $[29];
1922
- }
1923
- let t16;
1924
- if ($[30] !== anchored || $[31] !== isOpen || $[32] !== placement) {
1925
- t16 = [anchored, isOpen, placement];
1926
- $[30] = anchored;
1927
- $[31] = isOpen;
1928
- $[32] = placement;
1929
- $[33] = t16;
1930
- } else {
1931
- t16 = $[33];
1932
- }
1933
- useEffect(t15, t16);
1934
- useScrollLock(isOpen);
1935
- let t17;
1936
- if ($[34] !== onChange || $[35] !== setSelectedValue) {
1937
- t17 = (option_2) => {
1938
- if (option_2.disabled) {
1939
- return;
1940
- }
1941
- setSelectedValue(option_2.value);
1942
- onChange?.(option_2.value, option_2);
1943
- close();
1944
- triggerRef.current?.focus();
1945
- };
1946
- $[34] = onChange;
1947
- $[35] = setSelectedValue;
1948
- $[36] = t17;
1949
- } else {
1950
- t17 = $[36];
1951
- }
1952
- const choose = t17;
1953
- let t18;
1954
- if ($[37] !== choose || $[38] !== enabledIndices || $[39] !== highlightedIndex || $[40] !== isOpen || $[41] !== open || $[42] !== options) {
1955
- t18 = (event_0) => {
1956
- if (ARROW_KEYS.includes(event_0.key)) {
1957
- event_0.preventDefault();
1958
- if (!isOpen) {
1959
- open();
1960
- return;
1961
- }
1962
- if (enabledIndices.length === 0) {
1963
- return;
1964
- }
1965
- const next = stepHighlight(enabledIndices, highlightedIndex, event_0.key);
1966
- setHighlightedIndex(enabledIndices[next]);
1967
- return;
1968
- }
1969
- if (SELECT_KEYS.includes(event_0.key)) {
1970
- event_0.preventDefault();
1971
- if (!isOpen) {
1972
- open();
1973
- return;
1974
- }
1975
- const candidate = options[highlightedIndex];
1976
- if (candidate && !candidate.disabled) {
1977
- choose(candidate);
1978
- } else {
1979
- close();
1980
- }
1981
- }
1982
- };
1983
- $[37] = choose;
1984
- $[38] = enabledIndices;
1985
- $[39] = highlightedIndex;
1986
- $[40] = isOpen;
1987
- $[41] = open;
1988
- $[42] = options;
1989
- $[43] = t18;
1990
- } else {
1991
- t18 = $[43];
1992
- }
1993
- const handleTriggerKeyDown = t18;
1994
- const rise = floating && anchor.up ? -1 : 1;
1995
- const {
1996
- menu: menuMotion,
1997
- option: optionMotion
1998
- } = motionTokens;
1999
- const iconClass = parts.select.icon({
2000
- className: classNames.icon
2001
- });
2002
- const labelClass = parts.select.label({
2003
- className: classNames.label
2004
- });
2005
- let t19;
2006
- if ($[44] !== anchor || $[45] !== anchorName || $[46] !== anchored || $[47] !== floating || $[48] !== offset) {
2007
- t19 = floating ? menuPlacementStyle(anchor, anchored, anchorName, offset) : {};
2008
- $[44] = anchor;
2009
- $[45] = anchorName;
2010
- $[46] = anchored;
2011
- $[47] = floating;
2012
- $[48] = offset;
2013
- $[49] = t19;
2014
- } else {
2015
- t19 = $[49];
2016
- }
2017
- const menuStyle = t19;
2018
- const t20 = isOpen ? /* @__PURE__ */ createElement(motion.div, { ...floating ? floatingProps : null, animate: "animate", custom: rise, exit: "exit", id: listboxId, initial: menuMotion ? "initial" : false, key: "listbox", ref: menuRef, role: "listbox", style: {
2019
- ...menuStyle,
2020
- transformOrigin: floating && anchor.up ? "bottom" : "top"
2021
- }, variants: menuMotion, className: parts.select.menu({
2022
- ...variants,
2023
- className: [classNames.menu, classNames.content]
2024
- }) }, options.length === 0 ? /* @__PURE__ */ jsx("div", { className: parts.select.empty({
2025
- className: classNames.empty
2026
- }), children: empty ?? labels.empty }) : /* @__PURE__ */ jsx(LayoutGroup, { id: `select-options-${generatedId}`, children: options.map((option_3, index_0) => /* @__PURE__ */ jsx(SelectOptionRow, { classNames, highlighted: index_0 === highlightedIndex && !option_3.disabled, index: index_0, onChoose: choose, onHover: setHighlightedIndex, option: option_3, optionMotion, selected: option_3.value === selectedValue, variants }, option_3.value)) })) : null;
2027
- let t21;
2028
- if ($[50] !== rise || $[51] !== t20) {
2029
- t21 = /* @__PURE__ */ jsx(AnimatePresence, { custom: rise, children: t20 });
2030
- $[50] = rise;
2031
- $[51] = t20;
2032
- $[52] = t21;
2033
- } else {
2034
- t21 = $[52];
2035
- }
2036
- const menu = t21;
2037
- let t22;
2038
- if ($[53] !== name || $[54] !== selectedValue) {
2039
- t22 = name ? /* @__PURE__ */ jsx("input", { type: "hidden", name, value: selectedValue ?? "" }) : null;
2040
- $[53] = name;
2041
- $[54] = selectedValue;
2042
- $[55] = t22;
2043
- } else {
2044
- t22 = $[55];
2045
- }
2046
- let t23;
2047
- if ($[56] !== anchorName || $[57] !== anchored || $[58] !== placement) {
2048
- t23 = anchored && placement === "popover" ? {
2049
- anchorName
2050
- } : void 0;
2051
- $[56] = anchorName;
2052
- $[57] = anchored;
2053
- $[58] = placement;
2054
- $[59] = t23;
2055
- } else {
2056
- t23 = $[59];
2057
- }
2058
- let t24;
2059
- if ($[60] !== isOpen || $[61] !== open) {
2060
- t24 = () => isOpen ? close() : open();
2061
- $[60] = isOpen;
2062
- $[61] = open;
2063
- $[62] = t24;
2064
- } else {
2065
- t24 = $[62];
2066
- }
2067
- let t25;
2068
- if ($[63] !== floating || $[64] !== host || $[65] !== menu) {
2069
- t25 = floating ? createPortal(menu, host) : menu;
2070
- $[63] = floating;
2071
- $[64] = host;
2072
- $[65] = menu;
2073
- $[66] = t25;
2074
- } else {
2075
- t25 = $[66];
2076
- }
2077
- return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: parts.select.root({
2078
- className: [classNames.root, className]
2079
- }), children: [
2080
- t22,
2081
- /* @__PURE__ */ jsxs("button", { ref: triggerRef, style: t23, type: "button", role: "combobox", "aria-label": ariaLabel, "aria-expanded": isOpen, "aria-haspopup": "listbox", "aria-controls": listboxId, disabled, onClick: t24, onKeyDown: handleTriggerKeyDown, className: parts.select.trigger({
2082
- ...variants,
2083
- className: classNames.trigger
2084
- }), children: [
2085
- /* @__PURE__ */ jsxs("span", { className: parts.select.value({
2086
- className: classNames.value
2087
- }), children: [
2088
- selectedOption?.icon ? /* @__PURE__ */ jsx(Icon, { icon: selectedOption.icon, className: iconClass }) : null,
2089
- selectedOption ? /* @__PURE__ */ jsx("span", { className: labelClass, children: selectedOption.label }) : /* @__PURE__ */ jsx("span", { className: parts.select.placeholder({
2090
- className: classNames.placeholder
2091
- }), children: placeholder ?? labels.placeholder })
2092
- ] }),
2093
- icons.chevron ? /* @__PURE__ */ jsx(Icon, { icon: icons.chevron, className: parts.select.chevron({
2094
- className: classNames.chevron
2095
- }) }) : null
2096
- ] }),
2097
- t25
2098
- ] });
2099
- }
2100
- function _temp3(option_0, index) {
2101
- return option_0.disabled ? [] : [index];
2102
- }
2103
- function SkeletonBlock(t0) {
2104
- const $ = c(3);
2105
- const {
2106
- className,
2107
- style,
2108
- ...props
2109
- } = t0;
2110
- const {
2111
- parts
2112
- } = useUi();
2113
- const t1 = "true";
2114
- const t2 = parts.skeleton.block({
2115
- ...props,
2116
- className
2117
- });
2118
- let t3;
2119
- if ($[0] !== style || $[1] !== t2) {
2120
- t3 = /* @__PURE__ */ jsx("div", { "aria-hidden": t1, className: t2, style });
2121
- $[0] = style;
2122
- $[1] = t2;
2123
- $[2] = t3;
2124
- } else {
2125
- t3 = $[2];
2126
- }
2127
- return t3;
2128
- }
2129
- function SkeletonLines(t0) {
2130
- const $ = c(13);
2131
- const {
2132
- className,
2133
- height,
2134
- widths
2135
- } = t0;
2136
- const {
2137
- parts
2138
- } = useUi();
2139
- let t1;
2140
- if ($[0] !== className || $[1] !== parts.skeleton) {
2141
- t1 = parts.skeleton.lines({
2142
- className
2143
- });
2144
- $[0] = className;
2145
- $[1] = parts.skeleton;
2146
- $[2] = t1;
2147
- } else {
2148
- t1 = $[2];
2149
- }
2150
- let t2;
2151
- if ($[3] !== height || $[4] !== parts.skeleton || $[5] !== widths) {
2152
- let t32;
2153
- if ($[7] !== height || $[8] !== parts.skeleton) {
2154
- t32 = (width, index) => /* @__PURE__ */ jsx("div", { className: parts.skeleton.line(), children: /* @__PURE__ */ jsx(SkeletonBlock, { className: parts.skeleton.bar(), style: {
2155
- height,
2156
- width
2157
- } }) }, index);
2158
- $[7] = height;
2159
- $[8] = parts.skeleton;
2160
- $[9] = t32;
2161
- } else {
2162
- t32 = $[9];
2163
- }
2164
- t2 = widths.map(t32);
2165
- $[3] = height;
2166
- $[4] = parts.skeleton;
2167
- $[5] = widths;
2168
- $[6] = t2;
2169
- } else {
2170
- t2 = $[6];
2171
- }
2172
- let t3;
2173
- if ($[10] !== t1 || $[11] !== t2) {
2174
- t3 = /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: t1, children: t2 });
2175
- $[10] = t1;
2176
- $[11] = t2;
2177
- $[12] = t3;
2178
- } else {
2179
- t3 = $[12];
2180
- }
2181
- return t3;
2182
- }
2183
- function Switch(t0) {
2184
- const $ = c(18);
2185
- const {
2186
- checked: t1,
2187
- className,
2188
- classNames,
2189
- disabled: t2,
2190
- onCheckedChange,
2191
- onClick,
2192
- ref,
2193
- type: t3,
2194
- ...props
2195
- } = t0;
2196
- const checked = t1 === void 0 ? false : t1;
2197
- const disabled = t2 === void 0 ? false : t2;
2198
- const type = t3 === void 0 ? "button" : t3;
2199
- const {
2200
- parts
2201
- } = useUi();
2202
- const [variants, rest] = splitVariants(props, parts.switch.track, parts.switch.thumb);
2203
- const state = checked ? "checked" : "unchecked";
2204
- const t4 = "switch";
2205
- let t5;
2206
- if ($[0] !== checked || $[1] !== disabled || $[2] !== onCheckedChange || $[3] !== onClick) {
2207
- t5 = (event) => {
2208
- onClick?.(event);
2209
- if (!event.defaultPrevented && !disabled) {
2210
- onCheckedChange?.(!checked);
2211
- }
2212
- };
2213
- $[0] = checked;
2214
- $[1] = disabled;
2215
- $[2] = onCheckedChange;
2216
- $[3] = onClick;
2217
- $[4] = t5;
2218
- } else {
2219
- t5 = $[4];
2220
- }
2221
- const t6 = parts.switch.track({
2222
- ...variants,
2223
- className: [classNames?.track, className]
2224
- });
2225
- const t7 = parts.switch.thumb({
2226
- ...variants,
2227
- className: classNames?.thumb
2228
- });
2229
- let t8;
2230
- if ($[5] !== state || $[6] !== t7) {
2231
- t8 = /* @__PURE__ */ jsx("span", { "data-state": state, className: t7 });
2232
- $[5] = state;
2233
- $[6] = t7;
2234
- $[7] = t8;
2235
- } else {
2236
- t8 = $[7];
2237
- }
2238
- let t9;
2239
- if ($[8] !== checked || $[9] !== disabled || $[10] !== ref || $[11] !== rest || $[12] !== state || $[13] !== t5 || $[14] !== t6 || $[15] !== t8 || $[16] !== type) {
2240
- t9 = /* @__PURE__ */ jsx("button", { ref, type, role: t4, "aria-checked": checked, "data-state": state, disabled, onClick: t5, className: t6, ...rest, children: t8 });
2241
- $[8] = checked;
2242
- $[9] = disabled;
2243
- $[10] = ref;
2244
- $[11] = rest;
2245
- $[12] = state;
2246
- $[13] = t5;
2247
- $[14] = t6;
2248
- $[15] = t8;
2249
- $[16] = type;
2250
- $[17] = t9;
2251
- } else {
2252
- t9 = $[17];
2253
- }
2254
- return t9;
2255
- }
2256
-
2257
- export { Avatar, Carousel, Checkbox, CheckboxIndicator, FRAME_SELECTOR, HighlightGroup, Image, Input, SegmentedControl, Select, SkeletonBlock, SkeletonLines, SlidingHighlight, SlidingPill, Switch, Textarea, glideTarget, initialsOf, rackClip, readScroll, useDragScroll, useHighlight, useHighlightReset, useSlidingPill };
2258
- //# sourceMappingURL=index.js.map
2259
- //# sourceMappingURL=index.js.map