@photon-ai/pho-ui 2.3.0 → 2.5.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 (51) hide show
  1. package/dist/chunks/basic-page-w6ftlo0h.js +1284 -0
  2. package/dist/chunks/basic-page-w6ftlo0h.js.map +1 -0
  3. package/dist/chunks/{dialog-fWS3A3Z-.js → dialog-8SRNi_rv.js} +2 -2
  4. package/dist/chunks/{dialog-fWS3A3Z-.js.map → dialog-8SRNi_rv.js.map} +1 -1
  5. package/dist/chunks/{input-CCd6XK7Z.js → input-DjvZoF8v.js} +45 -41
  6. package/dist/chunks/input-DjvZoF8v.js.map +1 -0
  7. package/dist/chunks/{input-group-5AtpIhC_.js → input-group-fc9_jD4d.js} +44 -38
  8. package/dist/chunks/input-group-fc9_jD4d.js.map +1 -0
  9. package/dist/chunks/kbd-DNI10uy7.js +18 -0
  10. package/dist/chunks/kbd-DNI10uy7.js.map +1 -0
  11. package/dist/chunks/{scroll-area-DkZHKfqH.js → scroll-area-Bu7egArU.js} +40 -26
  12. package/dist/chunks/scroll-area-Bu7egArU.js.map +1 -0
  13. package/dist/chunks/sidebar-DvB-G0BP.js +231 -0
  14. package/dist/chunks/sidebar-DvB-G0BP.js.map +1 -0
  15. package/dist/chunks/toast-DoXaRPIZ.js +167 -0
  16. package/dist/chunks/toast-DoXaRPIZ.js.map +1 -0
  17. package/dist/components/command.js +125 -172
  18. package/dist/components/command.js.map +1 -1
  19. package/dist/components/dialog.js +1 -1
  20. package/dist/components/input-group.js +1 -1
  21. package/dist/components/input.js +1 -1
  22. package/dist/components/kbd.js +2 -15
  23. package/dist/components/phone-input.js +1 -1
  24. package/dist/components/scroll-area.js +3 -2
  25. package/dist/components/toast.js +3 -57
  26. package/dist/index.js +65 -58
  27. package/dist/primitives.js +1 -1
  28. package/dist/sections/basic-page.js +15 -8
  29. package/dist/sections/sidebar.js +1 -1
  30. package/dist/src/components/command/command.d.ts +5 -4
  31. package/dist/src/components/input/input.d.ts +10 -1
  32. package/dist/src/components/input-group/input-group.d.ts +9 -2
  33. package/dist/src/components/scroll-area/index.d.ts +1 -0
  34. package/dist/src/components/scroll-area/scroll-area-edges.d.ts +6 -0
  35. package/dist/src/components/scroll-area/scroll-area.d.ts +15 -2
  36. package/dist/src/components/toast/index.d.ts +1 -1
  37. package/dist/src/components/toast/toast.d.ts +22 -7
  38. package/dist/src/sections/basic-page/basic-page.d.ts +140 -3
  39. package/dist/src/sections/basic-page/index.d.ts +1 -1
  40. package/dist/src/sections/sidebar/sidebar.d.ts +33 -3
  41. package/package.json +1 -1
  42. package/src/styles/pho.css +19 -0
  43. package/dist/chunks/basic-page-BkLG3Ybg.js +0 -942
  44. package/dist/chunks/basic-page-BkLG3Ybg.js.map +0 -1
  45. package/dist/chunks/input-CCd6XK7Z.js.map +0 -1
  46. package/dist/chunks/input-group-5AtpIhC_.js.map +0 -1
  47. package/dist/chunks/scroll-area-DkZHKfqH.js.map +0 -1
  48. package/dist/chunks/sidebar-Dt1F_CEP.js +0 -186
  49. package/dist/chunks/sidebar-Dt1F_CEP.js.map +0 -1
  50. package/dist/components/kbd.js.map +0 -1
  51. package/dist/components/toast.js.map +0 -1
@@ -1,942 +0,0 @@
1
- "use client";
2
- import { t as u } from "./cn-ChIgwEl3.js";
3
- import { n as ie } from "./link-provider-9TFNyDqO.js";
4
- import { a as re, o as se } from "./button-DNNs5RsT.js";
5
- import { t as be } from "./createReactComponent-BqCmnqfX.js";
6
- import { t as Ne } from "./error-Crs-wqMC.js";
7
- import { t as H } from "./IconChevronLeft-CSWMKQ4C.js";
8
- import { t as we } from "./animated-height-C2eQstGy.js";
9
- import { t as Ce } from "./form-AiHbbw4m.js";
10
- import { i as T } from "./menu-BQeprfxB.js";
11
- import { Children as W, Fragment as Ae, createContext as V, isValidElement as _e, useContext as S, useEffect as P, useLayoutEffect as D, useMemo as X, useRef as k, useState as N } from "react";
12
- import { Fragment as Ee, jsx as n, jsxs as g } from "react/jsx-runtime";
13
- import { AnimatePresence as z, motion as v, useIsPresent as Re, useReducedMotion as E } from "motion/react";
14
- var ke = [["path", {
15
- d: "M9 6l6 6l-6 6",
16
- key: "svg-0"
17
- }]], Se = be("outline", "chevron-right", "ChevronRight", ke), Y = "rounded-base border border-pho-secondary bg-pho-primary", F = "divide-y divide-pho-secondary [&>:has(+[data-basic-page-alert])]:border-b-0", Ie = `${Y} ${F}`, J = "flex min-w-0 flex-col gap-3 rounded-base border border-pho-secondary bg-pho-page p-5", Te = "flex min-h-[4.25rem] min-w-0 flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6", Oe = "flex flex-col gap-3 px-5 py-4", Le = "-mx-5 -mb-4 flex items-center rounded-b-[calc(0.75rem-1px)] bg-pho-secondary py-1 pr-3 pl-5", Pe = "-mx-2 -mt-1.5 flex items-center rounded-sm bg-pho-secondary px-2 py-0.5", b = {
18
- type: "spring",
19
- stiffness: 400,
20
- damping: 40
21
- }, A = {
22
- duration: 0.25,
23
- ease: "easeOut"
24
- }, L = 12;
25
- function Be({ condense: e = !0, className: t, children: a, ...i }) {
26
- const [r, o] = N(null), [c, l] = N(null), s = X(() => ({
27
- setTitle: o,
28
- setTail: l
29
- }), []);
30
- return /* @__PURE__ */ g("div", {
31
- "data-basic-page-root": "",
32
- className: u("relative flex min-h-full w-full min-w-0 flex-col", t),
33
- ...i,
34
- children: [e && /* @__PURE__ */ n(Me, {
35
- title: r,
36
- tail: c
37
- }), /* @__PURE__ */ n("div", {
38
- "data-basic-page-column": "",
39
- className: "mx-auto flex w-full max-w-[44.5rem] min-w-0 flex-1 flex-col px-5 pt-12 pb-12 *:min-w-0 has-[[data-basic-page-back]]:pt-16",
40
- children: e ? /* @__PURE__ */ n(q.Provider, {
41
- value: s,
42
- children: a
43
- }) : a
44
- })]
45
- });
46
- }
47
- function Me({ title: e, tail: t }) {
48
- const a = E(), [i, r] = N(!1), o = e?.el ?? null;
49
- return P(() => {
50
- if (o == null || typeof IntersectionObserver > "u") return;
51
- const c = new IntersectionObserver(([l]) => r(l != null && !l.isIntersecting), { root: Xe(o) });
52
- return c.observe(o), () => c.disconnect();
53
- }, [o]), /* @__PURE__ */ n("div", {
54
- "data-basic-page-condense": "",
55
- className: "sticky top-0 z-20 h-0 overflow-visible",
56
- children: /* @__PURE__ */ n(z, { children: i && /* @__PURE__ */ g(v.div, {
57
- initial: {
58
- opacity: 0,
59
- y: a ? 0 : te
60
- },
61
- animate: {
62
- opacity: 1,
63
- y: 0
64
- },
65
- exit: {
66
- opacity: 0,
67
- y: a ? 0 : te
68
- },
69
- transition: We,
70
- className: "border-pho-secondary bg-pho-page/85 relative grid h-12 grid-cols-[1fr_minmax(0,auto)_1fr] items-center border-b px-3 backdrop-blur",
71
- children: [/* @__PURE__ */ n("div", {
72
- className: "flex min-w-0 items-center justify-start",
73
- children: t != null && /* @__PURE__ */ n(se, {
74
- variant: "ghost",
75
- size: "sm",
76
- href: t.href,
77
- onClick: t.onClick,
78
- prefix: /* @__PURE__ */ n("span", {
79
- className: "inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0",
80
- children: /* @__PURE__ */ n(H, {})
81
- }),
82
- className: "min-w-max",
83
- children: t.label
84
- })
85
- }), /* @__PURE__ */ n("span", {
86
- className: "text-pho-primary block max-w-full min-w-0 truncate text-center text-base font-medium",
87
- children: e?.label
88
- })]
89
- }) })
90
- });
91
- }
92
- function He(e) {
93
- return e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
94
- }
95
- function De(e) {
96
- if (!(typeof e != "string" && typeof e != "number"))
97
- return He(String(e)) || void 0;
98
- }
99
- function U(e, t) {
100
- if (e !== "")
101
- return e ?? De(t);
102
- }
103
- var Fe = (e) => `basic-page-morph-${e}`, Ge = { layout: b }, Z = 10, ee = {
104
- delay: 0.2,
105
- duration: 0.12,
106
- ease: "easeOut"
107
- }, Ve = {
108
- duration: 0.18,
109
- ease: "easeOut"
110
- }, ze = -8, $e = {
111
- duration: 0.16,
112
- ease: "easeOut"
113
- }, je = {
114
- delay: 0.14,
115
- duration: 0.16,
116
- ease: "easeOut"
117
- }, oe = {
118
- duration: 0.12,
119
- ease: "easeOut"
120
- }, O = [];
121
- function Ke(e) {
122
- const t = k({ labels: e });
123
- t.current.labels = e, D(() => {
124
- const a = t.current;
125
- return O.push(a), () => {
126
- O.splice(O.indexOf(a), 1);
127
- };
128
- }, []);
129
- }
130
- function le() {
131
- const [e] = N(() => {
132
- const t = O[O.length - 1];
133
- return t ? { labels: [...t.labels] } : null;
134
- });
135
- return e;
136
- }
137
- var q = V(null), We = {
138
- duration: 0.2,
139
- ease: "easeOut"
140
- }, te = -8;
141
- function Xe(e) {
142
- if (typeof getComputedStyle != "function") return null;
143
- for (let t = e.parentElement; t != null && t !== document.body; t = t.parentElement) {
144
- const { overflowY: a } = getComputedStyle(t);
145
- if (a === "auto" || a === "scroll") return t;
146
- }
147
- return null;
148
- }
149
- var j = /* @__PURE__ */ new Map(), Ye = 96;
150
- function Ue(e) {
151
- const t = e.closest("[data-basic-page-root]"), a = t?.querySelector("[data-basic-page-column]");
152
- return !t || !a ? 0 : a.getBoundingClientRect().left - t.getBoundingClientRect().left;
153
- }
154
- function ce(e) {
155
- const [t] = N(() => {
156
- if (e == null) return !1;
157
- const i = j.get(e);
158
- return i != null && i.visible && i.el.isConnected && Ue(i.el) <= Ye;
159
- }), a = k(null);
160
- return P(() => {
161
- if (e == null || typeof IntersectionObserver > "u") return;
162
- const i = a.current;
163
- if (!i) return;
164
- const r = new IntersectionObserver(([o]) => {
165
- o && j.set(e, {
166
- visible: o.isIntersecting,
167
- el: i
168
- });
169
- });
170
- return r.observe(i), () => {
171
- r.disconnect(), j.delete(e);
172
- };
173
- }, [e]), {
174
- fly: t,
175
- ref: a
176
- };
177
- }
178
- var qe = {
179
- fade: {
180
- initial: { opacity: 0 },
181
- animate: { opacity: 1 },
182
- transition: { opacity: A }
183
- },
184
- rise: {
185
- initial: {
186
- opacity: 0,
187
- y: L
188
- },
189
- animate: {
190
- opacity: 1,
191
- y: 0
192
- },
193
- transition: {
194
- y: b,
195
- opacity: A
196
- }
197
- },
198
- slide: {
199
- initial: { x: "-100%" },
200
- animate: { x: 0 },
201
- transition: { x: je }
202
- }
203
- };
204
- function ue({ morphId: e, fromClassName: t, fly: a, morphRef: i, arrival: r, className: o, children: c }) {
205
- const [l, s] = N(!1), d = !a && r != null ? qe[r] : null;
206
- return /* @__PURE__ */ g(v.span, {
207
- ref: i,
208
- layoutId: Fe(e),
209
- initial: d?.initial,
210
- animate: d?.animate,
211
- transition: a ? Ge : {
212
- layout: { duration: 0 },
213
- ...d?.transition
214
- },
215
- onLayoutAnimationStart: () => {
216
- a && s(!0);
217
- },
218
- onLayoutAnimationComplete: () => s(!1),
219
- className: u("relative inline-block", o),
220
- children: [c, l && /* @__PURE__ */ n(v.span, {
221
- "aria-hidden": !0,
222
- initial: { opacity: 1 },
223
- animate: { opacity: 0 },
224
- transition: Ve,
225
- onAnimationComplete: () => s(!1),
226
- className: u("absolute inset-0", t),
227
- children: c
228
- })]
229
- });
230
- }
231
- var ne = "max-w-full min-w-0 truncate align-top";
232
- function Qe({ id: e, morphId: t, enter: a, className: i, children: r, ...o }) {
233
- const c = U(e, r), l = E(), s = ce(t), d = le(), p = !l && (t != null || a === !0), m = a || d != null ? "rise" : void 0, f = S(q), y = k(null);
234
- D(() => {
235
- if (f != null)
236
- return f.setTitle({
237
- label: r,
238
- el: y.current
239
- }), () => f.setTitle(null);
240
- }, [f, r]);
241
- const [x, w] = N(s.fly && d != null);
242
- return D(() => {
243
- O.length > 0 && w(!1);
244
- }, []), /* @__PURE__ */ g("h1", {
245
- id: c,
246
- className: u("text-display-base text-pho-primary max-w-full min-w-0 scroll-mt-12 px-5 font-medium", p ? "whitespace-nowrap" : "truncate", i),
247
- ...o,
248
- ref: (h) => {
249
- y.current = h;
250
- const _ = o.ref;
251
- typeof _ == "function" ? _(h) : _ != null && (_.current = h);
252
- },
253
- children: [t != null && !l ? /* @__PURE__ */ n(ue, {
254
- morphId: t,
255
- fromClassName: "text-pho-secondary",
256
- fly: s.fly,
257
- morphRef: s.ref,
258
- arrival: m,
259
- className: ne,
260
- children: r
261
- }) : a && !l ? /* @__PURE__ */ n(v.span, {
262
- initial: {
263
- opacity: 0,
264
- y: L
265
- },
266
- animate: {
267
- opacity: 1,
268
- y: 0
269
- },
270
- transition: {
271
- y: b,
272
- opacity: A
273
- },
274
- className: u("inline-block", ne),
275
- children: r
276
- }) : r, x && /* @__PURE__ */ n(v.span, {
277
- "aria-hidden": !0,
278
- initial: { opacity: 1 },
279
- animate: { opacity: 0 },
280
- transition: oe,
281
- onAnimationComplete: () => w(!1),
282
- className: u("text-pho-secondary pointer-events-none absolute inline-flex items-center", Ct),
283
- children: /* @__PURE__ */ n(H, {})
284
- })]
285
- });
286
- }
287
- var de = V(!1);
288
- function Je() {
289
- const e = S(de), t = E(), [a] = N(() => e && !t);
290
- return a;
291
- }
292
- var Ze = {
293
- height: 0,
294
- opacity: 0,
295
- paddingTop: 0,
296
- paddingBottom: 0,
297
- borderTopWidth: 0
298
- }, et = {
299
- y: b,
300
- opacity: A,
301
- height: b,
302
- paddingTop: b,
303
- paddingBottom: b,
304
- borderTopWidth: b
305
- };
306
- function Q() {
307
- const e = Je(), t = Re(), a = E();
308
- return {
309
- initial: e ? {
310
- opacity: 0,
311
- y: L
312
- } : !1,
313
- animate: {
314
- opacity: 1,
315
- y: 0
316
- },
317
- exit: Ze,
318
- transition: a ? { duration: 0 } : et,
319
- leaving: !t
320
- };
321
- }
322
- var tt = typeof process < "u" && process.env.NODE_ENV !== "production";
323
- function me(e, t, a, i) {
324
- P(() => {
325
- if (!tt || e.current == null || typeof getComputedStyle != "function") return;
326
- const r = (c) => {
327
- const l = getComputedStyle(c).rowGap;
328
- return l === "" || l === "normal" ? null : parseFloat(l);
329
- }, o = r(e.current);
330
- o != null && o !== a && console.warn(`[BasicPage.${t}] spaced at ${o}px instead of ${a}px. Spacing is the system's: Stack gap-10 between blocks, a block gap-3, Fields gap-5. Remove the class and move the wrapper instead.`, e.current);
331
- for (const c of Array.from(e.current.children)) {
332
- const l = i(c);
333
- if (l == null || getComputedStyle(c).display === "contents") continue;
334
- const s = r(c);
335
- s != null && s !== l && console.warn(`[BasicPage.${t}] a child is spaced at ${s}px instead of ${l}px. Spacing is the system's: Stack gap-10 between blocks, a block gap-3, Fields gap-5. Remove the class and move the wrapper instead.`, c);
336
- }
337
- });
338
- }
339
- function nt({ className: e, children: t, ...a }) {
340
- const i = E(), r = k(null);
341
- me(r, "Stack", 40, (d) => d.hasAttribute("data-basic-page-fields") ? 20 : 12);
342
- const o = a["aria-busy"], c = o === !0 || o === "true", l = k(c), s = l.current && !c;
343
- return P(() => {
344
- l.current = c;
345
- }), /* @__PURE__ */ n(v.div, {
346
- ref: (d) => {
347
- r.current = d;
348
- const p = a.ref;
349
- typeof p == "function" ? p(d) : p != null && (p.current = d);
350
- },
351
- "data-basic-page-stack": "",
352
- initial: i ? !1 : {
353
- opacity: 0,
354
- y: L
355
- },
356
- animate: {
357
- opacity: 1,
358
- y: 0
359
- },
360
- transition: {
361
- y: b,
362
- opacity: A
363
- },
364
- className: u("mt-6 flex min-w-0 flex-col gap-10", "*:flex *:min-w-0 *:flex-col [&>*:not([data-basic-page-fields])]:gap-3", e),
365
- ...a,
366
- children: /* @__PURE__ */ n(de.Provider, {
367
- value: s,
368
- children: t
369
- })
370
- });
371
- }
372
- var ae = "flex min-w-0 flex-col mb-3 [[data-basic-page-stack]>*>&]:mb-0";
373
- function at({ enter: e, className: t, ...a }) {
374
- const i = E();
375
- return e && !i ? /* @__PURE__ */ n(v.div, {
376
- initial: {
377
- opacity: 0,
378
- y: L
379
- },
380
- animate: {
381
- opacity: 1,
382
- y: 0
383
- },
384
- transition: {
385
- y: b,
386
- opacity: A
387
- },
388
- "data-basic-page-header": "",
389
- className: u(ae, t),
390
- ...a
391
- }) : /* @__PURE__ */ n("div", {
392
- "data-basic-page-header": "",
393
- className: u(ae, t),
394
- ...a
395
- });
396
- }
397
- function it({ id: e, className: t, children: a, ...i }) {
398
- const r = U(e, a);
399
- return /* @__PURE__ */ n("h2", {
400
- id: r,
401
- className: u("text-display-xs text-pho-primary max-w-full min-w-0 scroll-mt-12 truncate px-5 font-medium", "mb-3 [[data-basic-page-header]>&]:mb-0 [[data-basic-page-stack]>*>&]:mb-0", t),
402
- ...i,
403
- children: a
404
- });
405
- }
406
- function rt({ className: e, ...t }) {
407
- return /* @__PURE__ */ n("p", {
408
- className: u("text-display-xs text-pho-description px-5 font-normal", e),
409
- ...t
410
- });
411
- }
412
- function st({ className: e, ...t }) {
413
- return /* @__PURE__ */ n("p", {
414
- className: u("text-pho-description px-5 text-xs font-normal", "mt-3 [[data-basic-page-stack]>*>&]:mt-0", e),
415
- ...t
416
- });
417
- }
418
- function ot({ animateHeight: e, className: t, children: a, ...i }) {
419
- const r = /* @__PURE__ */ n(z, { children: W.toArray(a) });
420
- return e ? /* @__PURE__ */ n("div", {
421
- className: u(Y, "min-h-0 overflow-hidden", t),
422
- ...i,
423
- children: /* @__PURE__ */ n(we, {
424
- transition: b,
425
- className: F,
426
- children: r
427
- })
428
- }) : /* @__PURE__ */ n("div", {
429
- className: u(Ie, t),
430
- ...i,
431
- children: r
432
- });
433
- }
434
- function lt({ className: e, ...t }) {
435
- const { leaving: a, ...i } = Q();
436
- return /* @__PURE__ */ n(v.div, {
437
- ...i,
438
- className: u(Oe, a && "overflow-hidden", e),
439
- ...t
440
- });
441
- }
442
- function ct({ divided: e = !1, className: t, ...a }) {
443
- return /* @__PURE__ */ n("div", {
444
- className: u(e ? Pe : Le, t),
445
- ...a
446
- });
447
- }
448
- function ut({ className: e, icon: t, children: a, ...i }) {
449
- if (t == null || t === !1 || t === !0) return /* @__PURE__ */ n("div", {
450
- className: u(J, e),
451
- ...i,
452
- children: a
453
- });
454
- const [r, ...o] = W.toArray(a);
455
- return /* @__PURE__ */ g("div", {
456
- className: u(J, e),
457
- ...i,
458
- children: [/* @__PURE__ */ g("div", {
459
- className: "relative",
460
- children: [/* @__PURE__ */ n("div", {
461
- className: "min-w-0 pr-16",
462
- children: r
463
- }), /* @__PURE__ */ n("div", {
464
- "aria-hidden": !0,
465
- className: "text-pho-description pointer-events-none absolute top-1/2 right-0 size-14 -translate-y-1/2 opacity-50 [&>svg]:size-full",
466
- children: t
467
- })]
468
- }), o]
469
- });
470
- }
471
- function dt({ id: e, className: t, children: a, ...i }) {
472
- const r = U(e, a);
473
- return /* @__PURE__ */ n("h2", {
474
- id: r,
475
- className: u("text-display-xs text-pho-primary max-w-full min-w-0 scroll-mt-12 truncate font-medium", t),
476
- ...i,
477
- children: a
478
- });
479
- }
480
- function mt({ className: e, ...t }) {
481
- return /* @__PURE__ */ n("p", {
482
- className: u("text-display-xs text-pho-description font-normal", e),
483
- ...t
484
- });
485
- }
486
- function pt({ label: e, description: t, htmlFor: a, stacked: i = !1, className: r, children: o, ...c }) {
487
- const { leaving: l, ...s } = Q();
488
- return /* @__PURE__ */ g(v.div, {
489
- ...s,
490
- className: u(Te, i && "sm:flex-col sm:items-stretch sm:justify-start sm:gap-3", l && "overflow-hidden", r),
491
- ...c,
492
- children: [/* @__PURE__ */ g("div", {
493
- className: "min-w-0",
494
- children: [a ? /* @__PURE__ */ n("label", {
495
- htmlFor: a,
496
- className: "text-pho-primary block text-base font-normal",
497
- children: e
498
- }) : /* @__PURE__ */ n("div", {
499
- className: "text-pho-primary text-base font-normal",
500
- children: e
501
- }), t ? /* @__PURE__ */ n("p", {
502
- className: "text-pho-description text-xs",
503
- children: t
504
- }) : null]
505
- }), /* @__PURE__ */ n("div", {
506
- className: u("flex w-full min-w-0 items-center gap-2 sm:w-auto", i && "sm:w-full"),
507
- children: o
508
- })]
509
- });
510
- }
511
- function ft({ className: e, ...t }) {
512
- return /* @__PURE__ */ n("p", {
513
- className: u("text-pho-description max-w-full min-w-0 truncate text-base", e),
514
- ...t
515
- });
516
- }
517
- function ht({ error: e, show: t, className: a, children: i, ...r }) {
518
- const o = E(), c = S($), l = e ?? c?.error ?? void 0;
519
- return /* @__PURE__ */ n(z, {
520
- initial: !1,
521
- children: (t ?? !0) && (l != null || i != null) ? /* @__PURE__ */ n(v.div, {
522
- "data-basic-page-alert": "",
523
- className: "overflow-hidden",
524
- initial: {
525
- height: 0,
526
- opacity: 0
527
- },
528
- animate: {
529
- height: "auto",
530
- opacity: 1
531
- },
532
- exit: {
533
- height: 0,
534
- opacity: 0
535
- },
536
- transition: o ? { duration: 0 } : {
537
- height: b,
538
- opacity: A
539
- },
540
- children: /* @__PURE__ */ n(Ne, {
541
- error: l,
542
- className: u("px-5 pb-3", a),
543
- ...r,
544
- children: i
545
- })
546
- }) : null
547
- });
548
- }
549
- var $ = V(null);
550
- function gt({ action: e, errors: t, className: a, children: i, onChange: r, ...o }) {
551
- const [c, l] = N(!1), [s, d] = N(!1), [p, m] = N(null), [f, y] = N(t ?? {}), x = X(() => ({
552
- pending: c,
553
- dirty: s,
554
- error: p
555
- }), [
556
- c,
557
- s,
558
- p
559
- ]);
560
- return /* @__PURE__ */ n($.Provider, {
561
- value: x,
562
- children: /* @__PURE__ */ n(Ce, {
563
- errors: f,
564
- onFormSubmit: async (w) => {
565
- if (e != null) {
566
- l(!0), m(null);
567
- try {
568
- const h = (await e(w))?.errors;
569
- if (h != null && Object.keys(h).length > 0) {
570
- y(h);
571
- return;
572
- }
573
- y({}), d(!1);
574
- } catch (h) {
575
- m(h);
576
- } finally {
577
- l(!1);
578
- }
579
- }
580
- },
581
- onChange: (w) => {
582
- d(!0), m(null);
583
- const h = w.target.name;
584
- h && h in f && y((_) => {
585
- const { [h]: R, ...C } = _;
586
- return C;
587
- }), r?.(w);
588
- },
589
- className: u("contents [[data-basic-page-stack]>&]:flex [[data-basic-page-stack]>&]:min-w-0 [[data-basic-page-stack]>&]:flex-col", a),
590
- ...o,
591
- children: /* @__PURE__ */ n("fieldset", {
592
- disabled: c,
593
- "aria-busy": c || void 0,
594
- className: "contents",
595
- children: i
596
- })
597
- })
598
- });
599
- }
600
- var vt = "flex min-w-0 flex-col gap-5 p-5 [&>[data-basic-page-alert]]:-mx-5 [&>[data-basic-page-alert]]:-mt-2 [&>[data-basic-page-alert]]:-mb-5 [&>[data-basic-page-footer]]:pr-0 [&>[data-basic-page-reveal]]:flex [&>[data-basic-page-reveal]]:flex-col [&>[data-basic-page-reveal]]:gap-5";
601
- function yt({ className: e, ...t }) {
602
- const a = k(null);
603
- return me(a, "Fields", 20, () => null), /* @__PURE__ */ n("div", {
604
- "data-basic-page-fields": "",
605
- className: u(Y, vt, e),
606
- ...t,
607
- ref: (i) => {
608
- a.current = i;
609
- const r = t.ref;
610
- typeof r == "function" ? r(i) : r != null && (r.current = i);
611
- }
612
- });
613
- }
614
- function xt({ className: e, ...t }) {
615
- return /* @__PURE__ */ n("div", {
616
- className: u("flex min-w-0 flex-col gap-5 *:min-w-0 sm:flex-row sm:gap-3 sm:*:flex-1", e),
617
- ...t
618
- });
619
- }
620
- function bt({ children: e = "Save changes", ...t }) {
621
- const a = S($);
622
- return /* @__PURE__ */ n(re, {
623
- type: "submit",
624
- variant: "effect",
625
- size: "sm",
626
- loading: a?.pending,
627
- ...t,
628
- children: e
629
- });
630
- }
631
- function Nt({ show: e, className: t, ...a }) {
632
- const i = S($), r = e === "dirty" ? i?.dirty ?? !1 : e, o = /* @__PURE__ */ n("div", {
633
- "data-basic-page-footer": "",
634
- className: u("flex items-center justify-end gap-3 pr-[calc(1.25rem+2.5px)]", t),
635
- ...a
636
- });
637
- return r === void 0 ? o : /* @__PURE__ */ n(pe, {
638
- show: r,
639
- gap: "block",
640
- clip: !1,
641
- children: o
642
- });
643
- }
644
- var wt = {
645
- stack: "-2.5rem",
646
- block: "-0.75rem",
647
- fields: "-1.25rem",
648
- none: "0px"
649
- };
650
- function pe({ show: e, clip: t = !0, gap: a = "stack", dividers: i, className: r, ...o }) {
651
- const c = E(), l = wt[i ? "none" : a], s = k(null), d = k(e !== !0);
652
- P(() => {
653
- d.current = !0;
654
- }, []);
655
- const p = () => {
656
- t && s.current && (s.current.style.overflow = "hidden");
657
- }, m = () => {
658
- s.current && (s.current.style.overflow = "");
659
- };
660
- return e === void 0 ? /* @__PURE__ */ n(v.div, {
661
- initial: c ? !1 : {
662
- opacity: 0,
663
- y: L
664
- },
665
- animate: {
666
- opacity: 1,
667
- y: 0
668
- },
669
- transition: {
670
- y: b,
671
- opacity: A
672
- },
673
- className: u(i && F, r),
674
- ...o
675
- }) : /* @__PURE__ */ n(z, {
676
- initial: !1,
677
- children: e ? /* @__PURE__ */ n(v.div, {
678
- "data-basic-page-reveal": "",
679
- ref: (f) => {
680
- s.current = f, t && f && d.current && (f.style.overflow = "hidden");
681
- },
682
- onAnimationStart: p,
683
- onAnimationComplete: m,
684
- initial: {
685
- height: 0,
686
- opacity: 0,
687
- marginTop: l
688
- },
689
- animate: {
690
- height: "auto",
691
- opacity: 1,
692
- marginTop: 0
693
- },
694
- exit: {
695
- height: 0,
696
- opacity: 0,
697
- marginTop: l
698
- },
699
- transition: c ? { duration: 0 } : {
700
- height: b,
701
- marginTop: b,
702
- opacity: A
703
- },
704
- className: u(i && F, r),
705
- ...o
706
- }) : null
707
- });
708
- }
709
- var Ct = "top-4 left-5 h-8 text-base [&>svg]:size-[1.125em] [&>svg]:shrink-0", At = "(min-width: 40rem)";
710
- function _t() {
711
- return typeof window < "u" && typeof window.matchMedia == "function" && !window.matchMedia(At).matches;
712
- }
713
- var fe = V(null);
714
- function he({ className: e, children: t, ...a }) {
715
- const i = W.toArray(t).filter(_e), r = i.map((R) => R.props.children ?? null), o = le();
716
- Ke(r);
717
- const [c] = N(_t), l = E(), s = i.length, d = ie(), p = !c && s >= Et, m = S(q), f = s > 0 ? i[s - 1]?.props : null, y = f?.children ?? "Back", x = f?.href, w = f?.onClick;
718
- D(() => {
719
- if (!(m == null || x == null))
720
- return m.setTail({
721
- label: y,
722
- href: x,
723
- onClick: w
724
- }), () => m.setTail(null);
725
- }, [
726
- m,
727
- y,
728
- x,
729
- w
730
- ]);
731
- const [h, _] = N(!l && !c && o != null && o.labels.length > s);
732
- return /* @__PURE__ */ n("nav", {
733
- "aria-label": "Breadcrumb",
734
- "data-basic-page-back": "",
735
- className: u("absolute top-4 left-3 flex min-w-max items-center", e),
736
- ...a,
737
- children: /* @__PURE__ */ g("ol", {
738
- className: "m-0 flex list-none items-center p-0",
739
- children: [i.map((R, C) => p && C > 0 && C < s - 2 ? null : /* @__PURE__ */ g(Ae, { children: [p && C === s - 2 && /* @__PURE__ */ g("li", {
740
- className: "m-0 flex items-center max-sm:hidden",
741
- children: [/* @__PURE__ */ n("span", {
742
- "aria-hidden": !0,
743
- className: K,
744
- children: G
745
- }), /* @__PURE__ */ g(T.Root, { children: [/* @__PURE__ */ n(T.Trigger, { render: /* @__PURE__ */ n(re, {
746
- variant: "ghost",
747
- size: "sm",
748
- "aria-label": "Hidden pages",
749
- className: "px-2",
750
- children: Rt
751
- }) }), /* @__PURE__ */ n(T.Portal, { children: /* @__PURE__ */ n(T.Positioner, {
752
- align: "start",
753
- sideOffset: 4,
754
- children: /* @__PURE__ */ n(T.Popup, { children: i.slice(1, s - 2).map((B, M) => {
755
- const I = B.props;
756
- return /* @__PURE__ */ n(T.LinkItem, {
757
- render: /* @__PURE__ */ n(d, {
758
- href: I.href,
759
- onClick: I.onClick
760
- }),
761
- children: I.children ?? "Back"
762
- }, B.key ?? M);
763
- }) })
764
- }) })] })]
765
- }), /* @__PURE__ */ n("li", {
766
- className: u("m-0 flex items-center", C < s - 1 && "max-sm:hidden"),
767
- children: /* @__PURE__ */ n(fe.Provider, {
768
- value: {
769
- index: C,
770
- count: s,
771
- departing: o,
772
- narrow: c
773
- },
774
- children: R
775
- })
776
- })] }, R.key ?? C)), h && /* @__PURE__ */ n("li", {
777
- "aria-hidden": !0,
778
- className: "m-0 flex items-center max-sm:hidden",
779
- children: /* @__PURE__ */ n(v.span, {
780
- initial: { opacity: 1 },
781
- animate: { opacity: 0 },
782
- transition: oe,
783
- onAnimationComplete: () => _(!1),
784
- className: K,
785
- children: G
786
- })
787
- })]
788
- })
789
- });
790
- }
791
- var K = "text-pho-description -mx-1 inline-flex shrink-0 text-base select-none", G = "/", Et = 4, Rt = "…";
792
- function ge({ href: e, className: t, morphId: a, children: i = "Back", ...r }) {
793
- const o = S(fe), c = E(), l = a != null && !c, s = ce(l ? a : void 0);
794
- if (o == null) throw new Error("BasicPage.Crumb must be rendered inside BasicPage.Breadcrumbs");
795
- const { index: d, count: p, departing: m, narrow: f } = o, y = d === 0, x = d === p - 1, w = m != null && m.labels.length < p, h = m != null && m.labels.length > p, _ = x && (m == null || w || f), R = y || x, C = y && x ? "" : y ? "max-sm:hidden" : "sm:hidden", B = m != null, M = x ? f ? h ? "slide" : "fade" : _ ? "fade" : void 0 : void 0, [I, ve] = N(l && f && s.fly && m != null && !h ? m.labels[m.labels.length - 1] : null), ye = l && R && !B, xe = l && !y && x && (m == null || w);
796
- return /* @__PURE__ */ g(Ee, { children: [!y && /* @__PURE__ */ n("span", {
797
- "aria-hidden": !0,
798
- className: u(K, "max-sm:hidden"),
799
- children: xe ? /* @__PURE__ */ n(v.span, {
800
- initial: s.fly ? {
801
- opacity: 0,
802
- x: Z
803
- } : { opacity: 0 },
804
- animate: s.fly ? {
805
- opacity: 1,
806
- x: 0
807
- } : { opacity: 1 },
808
- transition: s.fly ? ee : A,
809
- className: "inline-flex",
810
- children: G
811
- }) : G
812
- }), /* @__PURE__ */ n(se, {
813
- variant: "ghost",
814
- size: "sm",
815
- href: e,
816
- prefix: R ? ye ? /* @__PURE__ */ n(v.span, {
817
- initial: s.fly ? {
818
- opacity: 0,
819
- x: Z
820
- } : { opacity: 0 },
821
- animate: s.fly ? {
822
- opacity: 1,
823
- x: 0
824
- } : { opacity: 1 },
825
- transition: s.fly ? ee : A,
826
- className: u("inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0", C),
827
- children: /* @__PURE__ */ n(H, {})
828
- }) : /* @__PURE__ */ n("span", {
829
- className: u("inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0", C),
830
- children: /* @__PURE__ */ n(H, {})
831
- }) : /* @__PURE__ */ n("span", { className: "hidden" }),
832
- className: u("min-w-max", t),
833
- ...r,
834
- children: l && a != null ? /* @__PURE__ */ g("span", {
835
- className: u("relative block", !s.fly && M === "slide" && "overflow-hidden", !x && "max-w-40 truncate"),
836
- children: [/* @__PURE__ */ n(ue, {
837
- morphId: a,
838
- fromClassName: "text-pho-primary",
839
- fly: s.fly,
840
- morphRef: s.ref,
841
- arrival: M,
842
- children: i
843
- }), I != null && /* @__PURE__ */ n(v.span, {
844
- "aria-hidden": !0,
845
- initial: {
846
- x: 0,
847
- opacity: 1
848
- },
849
- animate: {
850
- x: ze,
851
- opacity: 0
852
- },
853
- transition: $e,
854
- onAnimationComplete: () => ve(null),
855
- className: "pointer-events-none absolute inset-y-0 left-0 whitespace-nowrap",
856
- children: I
857
- })]
858
- }) : /* @__PURE__ */ n("span", {
859
- className: u("block", !x && "max-w-40 truncate"),
860
- children: i
861
- })
862
- })] });
863
- }
864
- function kt({ className: e, ...t }) {
865
- return /* @__PURE__ */ n(he, {
866
- className: e,
867
- children: /* @__PURE__ */ n(ge, { ...t })
868
- });
869
- }
870
- function St({ label: e, description: t, leading: a, href: i, className: r, children: o, ...c }) {
871
- const l = ie(), s = X(() => v.create(l), [l]), { leaving: d, ...p } = Q();
872
- return /* @__PURE__ */ g(s, {
873
- href: i,
874
- ...p,
875
- ...c,
876
- className: u("flex min-h-[4.25rem] min-w-0 flex-row items-center justify-between gap-6 px-5 py-4", "group outline-pho-brand hover:bg-pho-primary-hover cursor-pointer transition-colors focus-visible:outline-2 focus-visible:-outline-offset-2", "first:rounded-t-[calc(var(--radius-base)-1px)] last:rounded-b-[calc(var(--radius-base)-1px)]", d && "overflow-hidden", r),
877
- children: [/* @__PURE__ */ g("div", {
878
- className: u("flex min-w-0 flex-1 items-center", a != null && "gap-3"),
879
- children: [a, /* @__PURE__ */ g("div", {
880
- className: "min-w-0",
881
- children: [/* @__PURE__ */ n("div", {
882
- className: "flex min-w-0 items-center gap-1",
883
- children: typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ n("p", {
884
- className: "text-pho-primary truncate text-base font-medium",
885
- children: e
886
- }) : e
887
- }), t ? /* @__PURE__ */ n("div", {
888
- className: "text-pho-description truncate text-xs",
889
- children: t
890
- }) : null]
891
- })]
892
- }), /* @__PURE__ */ g("div", {
893
- className: "flex min-w-0 items-center justify-end gap-2",
894
- children: [o != null ? /* @__PURE__ */ n("div", {
895
- className: "min-w-0",
896
- children: o
897
- }) : null, /* @__PURE__ */ n(Se, {
898
- "aria-hidden": !0,
899
- className: "text-pho-secondary group-hover:text-pho-secondary-hover size-4 shrink-0 transition-colors"
900
- })]
901
- })]
902
- });
903
- }
904
- var zt = {
905
- Root: Be,
906
- Breadcrumbs: he,
907
- Crumb: ge,
908
- Back: kt,
909
- Title: Qe,
910
- Stack: nt,
911
- Header: at,
912
- SectionTitle: it,
913
- Description: rt,
914
- SectionFooter: st,
915
- Card: ot,
916
- Item: lt,
917
- ItemPanel: ct,
918
- Callout: ut,
919
- CalloutTitle: dt,
920
- CalloutDescription: mt,
921
- Row: pt,
922
- RowLink: St,
923
- Value: ft,
924
- Alert: ht,
925
- Footer: Nt,
926
- Form: gt,
927
- Fields: yt,
928
- Inline: xt,
929
- Submit: bt,
930
- Reveal: pe
931
- };
932
- export {
933
- Pe as a,
934
- Le as i,
935
- Ie as n,
936
- Te as o,
937
- Oe as r,
938
- zt as s,
939
- J as t
940
- };
941
-
942
- //# sourceMappingURL=basic-page-BkLG3Ybg.js.map