indira-workspace-ui 0.1.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.
@@ -0,0 +1,1522 @@
1
+ import { createContext as e, forwardRef as t, useCallback as n, useContext as r, useEffect as i, useId as a, useLayoutEffect as o, useMemo as s, useRef as c, useState as l } from "react";
2
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
3
+ import { ArrowDown as p, ArrowUp as m, Ban as h, Bell as g, Briefcase as _, Building2 as v, Check as y, ChevronDown as b, ChevronLeft as x, ChevronRight as S, CircleAlert as C, CircleCheck as w, Clock as T, File as E, Inbox as D, Info as O, LogOut as k, Mail as A, Minimize2 as j, Moon as ee, Search as M, Send as N, Sparkles as te, Sun as ne, Undo2 as re, UserRound as ie, X as P } from "lucide-react";
4
+ import { createPortal as F } from "react-dom";
5
+ //#region src/components/Button.jsx
6
+ var I = t(function({ variant: e = "outlined", size: t = "md", icon: n, iconEnd: r, iconOnly: i = !1, attention: a = !1, loading: o = !1, as: s = "button", className: c = "", children: l, type: u, ...p }, m) {
7
+ let h = t === "sm" ? 16 : 18, g = [
8
+ "btn",
9
+ `btn--${e}`,
10
+ t === "sm" && "btn--sm",
11
+ i && "btn--icon",
12
+ a && "btn--attention",
13
+ c
14
+ ].filter(Boolean).join(" ");
15
+ return /* @__PURE__ */ f(s, {
16
+ ref: m,
17
+ className: g,
18
+ type: s === "button" ? u ?? "button" : void 0,
19
+ "aria-busy": o || void 0,
20
+ "aria-label": i ? p["aria-label"] ?? p.title : p["aria-label"],
21
+ ...p,
22
+ children: [
23
+ o ? /* @__PURE__ */ d("span", {
24
+ className: "btn-spinner",
25
+ "aria-hidden": "true"
26
+ }) : n && /* @__PURE__ */ d(n, {
27
+ size: h,
28
+ "aria-hidden": "true"
29
+ }),
30
+ !i && l != null && /* @__PURE__ */ d("span", {
31
+ className: "truncate",
32
+ children: l
33
+ }),
34
+ !i && r && /* @__PURE__ */ d(r, {
35
+ size: h,
36
+ "aria-hidden": "true"
37
+ })
38
+ ]
39
+ });
40
+ }), L = t(function({ as: e = "section", className: t = "", children: n, ...r }, i) {
41
+ return /* @__PURE__ */ d(e, {
42
+ ref: i,
43
+ className: `card ${t}`,
44
+ ...r,
45
+ children: n
46
+ });
47
+ });
48
+ function ae({ title: e, icon: t, action: n, className: r = "", children: i }) {
49
+ return /* @__PURE__ */ f("header", {
50
+ className: `card-h ${r}`,
51
+ children: [/* @__PURE__ */ f("div", {
52
+ className: "flex items-center gap-4 min-w-0",
53
+ children: [
54
+ t && /* @__PURE__ */ d(t, {
55
+ size: 20,
56
+ className: "text-ink-muted",
57
+ "aria-hidden": "true"
58
+ }),
59
+ e && /* @__PURE__ */ d("h2", {
60
+ className: "card-title truncate",
61
+ children: e
62
+ }),
63
+ i
64
+ ]
65
+ }), n && /* @__PURE__ */ d("div", {
66
+ className: "flex items-center gap-2 shrink-0",
67
+ children: n
68
+ })]
69
+ });
70
+ }
71
+ function oe({ compact: e = !1, className: t = "", children: n }) {
72
+ return /* @__PURE__ */ d("div", {
73
+ className: `card-b ${e ? "card-b--compact" : ""} ${t}`,
74
+ children: n
75
+ });
76
+ }
77
+ L.Header = ae, L.Body = oe;
78
+ //#endregion
79
+ //#region src/components/status.js
80
+ var se = [
81
+ "draft",
82
+ "submitted",
83
+ "review",
84
+ "approved",
85
+ "rejected",
86
+ "sentback"
87
+ ], R = {
88
+ draft: {
89
+ label: "Draft",
90
+ icon: E,
91
+ token: "--c-st-draft"
92
+ },
93
+ submitted: {
94
+ label: "Submitted",
95
+ icon: N,
96
+ token: "--c-st-submitted"
97
+ },
98
+ review: {
99
+ label: "In review",
100
+ icon: T,
101
+ token: "--c-st-review"
102
+ },
103
+ approved: {
104
+ label: "Approved",
105
+ icon: w,
106
+ token: "--c-st-approved"
107
+ },
108
+ rejected: {
109
+ label: "Rejected",
110
+ icon: h,
111
+ token: "--c-st-rejected"
112
+ },
113
+ sentback: {
114
+ label: "Sent back",
115
+ icon: re,
116
+ token: "--c-st-sentback"
117
+ }
118
+ };
119
+ function z(e) {
120
+ return R[e]?.label ?? e;
121
+ }
122
+ function ce(e) {
123
+ return R[e]?.icon ?? E;
124
+ }
125
+ function le(e) {
126
+ return `rgb(var(${R[e]?.token ?? "--c-st-draft"}))`;
127
+ }
128
+ function B(e) {
129
+ return `var(${R[e]?.token ?? "--c-st-draft"})`;
130
+ }
131
+ //#endregion
132
+ //#region src/components/StatusGlyph.jsx
133
+ function V({ status: e, size: t = 16, ...n }) {
134
+ let r = R[e]?.icon ?? E;
135
+ return /* @__PURE__ */ d(r, {
136
+ size: t,
137
+ "aria-hidden": "true",
138
+ ...n
139
+ });
140
+ }
141
+ //#endregion
142
+ //#region src/components/StatTile.jsx
143
+ function ue({ status: e = "draft", icon: t, figure: n, label: r, active: i = !1, onClick: a, className: o = "", ...s }) {
144
+ let c = t;
145
+ return /* @__PURE__ */ f(a ? "button" : "div", {
146
+ type: a ? "button" : void 0,
147
+ className: `stat-tile ${o}`,
148
+ "data-active": i ? "true" : void 0,
149
+ "aria-pressed": a ? i : void 0,
150
+ onClick: a,
151
+ style: { "--tile-tone": B(e) },
152
+ ...s,
153
+ children: [/* @__PURE__ */ d("span", {
154
+ className: "stat-tile__icon",
155
+ children: c ? /* @__PURE__ */ d(c, {
156
+ size: 24,
157
+ "aria-hidden": "true"
158
+ }) : /* @__PURE__ */ d(V, {
159
+ status: e,
160
+ size: 24
161
+ })
162
+ }), /* @__PURE__ */ f("span", {
163
+ className: "min-w-0",
164
+ children: [/* @__PURE__ */ d("span", {
165
+ className: "stat-tile__figure block",
166
+ children: n
167
+ }), /* @__PURE__ */ d("span", {
168
+ className: "stat-tile__label block truncate",
169
+ children: r
170
+ })]
171
+ })]
172
+ });
173
+ }
174
+ //#endregion
175
+ //#region src/components/avatar-utils.js
176
+ var H = [
177
+ "#1D4ED8",
178
+ "#6D28D9",
179
+ "#15803D",
180
+ "#B45309",
181
+ "#475569",
182
+ "#0F766E"
183
+ ], U = [
184
+ 20,
185
+ 24,
186
+ 28,
187
+ 32,
188
+ 40,
189
+ 44,
190
+ 48
191
+ ];
192
+ function W(e = "") {
193
+ let t = String(e).trim().split(/[\s.@_-]+/).filter(Boolean);
194
+ return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
195
+ }
196
+ function G(e = "") {
197
+ let t = 0;
198
+ for (let n = 0; n < e.length; n += 1) t = t * 31 + e.charCodeAt(n) >>> 0;
199
+ return H[t % H.length];
200
+ }
201
+ //#endregion
202
+ //#region src/components/Avatar.jsx
203
+ function K({ name: e = "", photo: t, size: n = 32, className: r = "", title: i, ...a }) {
204
+ let o = U.includes(n) ? n : 32, s = o <= 24 ? 10 : o <= 32 ? 12 : 14;
205
+ return /* @__PURE__ */ d("span", {
206
+ className: `avatar ${r}`,
207
+ style: {
208
+ width: o,
209
+ height: o,
210
+ fontSize: s,
211
+ "--avatar-tint": G(e)
212
+ },
213
+ title: i ?? e,
214
+ role: "img",
215
+ "aria-label": e,
216
+ ...a,
217
+ children: t ? /* @__PURE__ */ d("img", {
218
+ src: t,
219
+ alt: ""
220
+ }) : W(e)
221
+ });
222
+ }
223
+ function de({ people: e = [], max: t = 4, size: n = 24, className: r = "" }) {
224
+ let i = e.slice(0, t), a = e.length - i.length;
225
+ return /* @__PURE__ */ f("span", {
226
+ className: `avatar-stack ${r}`,
227
+ title: e.map((e) => e.name).join(", "),
228
+ children: [i.map((e) => /* @__PURE__ */ d(K, {
229
+ name: e.name,
230
+ photo: e.photo,
231
+ size: n
232
+ }, e.id ?? e.email ?? e.name)), a > 0 && /* @__PURE__ */ f("span", {
233
+ className: "avatar-more",
234
+ style: {
235
+ width: n,
236
+ height: n
237
+ },
238
+ "aria-label": `${a} more`,
239
+ children: ["+", a]
240
+ })]
241
+ });
242
+ }
243
+ //#endregion
244
+ //#region src/components/RecordCard.jsx
245
+ function fe({ id: e, status: t = "draft", title: n, meta: r = [], approvers: i = [], progress: a, onClick: o, href: s, className: c = "", ...l }) {
246
+ let u = s ? "a" : o ? "button" : "article", p = [e, z(t)].filter(Boolean).join(" · ");
247
+ return /* @__PURE__ */ f(u, {
248
+ className: `brd-card ${c}`,
249
+ href: s,
250
+ type: u === "button" ? "button" : void 0,
251
+ onClick: o,
252
+ title: p,
253
+ ...l,
254
+ children: [
255
+ /* @__PURE__ */ d("span", {
256
+ className: "brd-card__orb",
257
+ style: { "--orb-tone": B(t) },
258
+ "aria-hidden": "true",
259
+ children: /* @__PURE__ */ d(V, {
260
+ status: t,
261
+ size: 24
262
+ })
263
+ }),
264
+ /* @__PURE__ */ f("span", {
265
+ className: "sr-only",
266
+ children: [e ? `${e}, ` : "", z(t)]
267
+ }),
268
+ /* @__PURE__ */ d("h3", {
269
+ className: "brd-card__title",
270
+ children: n
271
+ }),
272
+ /* @__PURE__ */ d("div", {
273
+ className: "brd-card__meta",
274
+ children: r.slice(0, 2).map((e, t) => /* @__PURE__ */ f("div", {
275
+ className: "brd-card__meta-row",
276
+ title: e.title ?? e.text,
277
+ children: [e.icon && /* @__PURE__ */ d(e.icon, {
278
+ size: 14,
279
+ "aria-hidden": "true"
280
+ }), /* @__PURE__ */ d("span", { children: e.text })]
281
+ }, t))
282
+ }),
283
+ /* @__PURE__ */ f("div", {
284
+ className: "brd-card__foot",
285
+ children: [/* @__PURE__ */ f("span", {
286
+ className: "min-w-0",
287
+ children: [/* @__PURE__ */ d("span", {
288
+ className: "brd-card__foot-label",
289
+ children: "Approvers"
290
+ }), /* @__PURE__ */ d(de, {
291
+ people: i,
292
+ size: 24,
293
+ max: 4
294
+ })]
295
+ }), a != null && /* @__PURE__ */ f("span", {
296
+ className: "text-right",
297
+ children: [/* @__PURE__ */ d("span", {
298
+ className: "brd-card__foot-label",
299
+ children: "Progress"
300
+ }), /* @__PURE__ */ f("span", {
301
+ className: "brd-card__pct",
302
+ children: [Math.round(a), "%"]
303
+ })]
304
+ })]
305
+ })
306
+ ]
307
+ });
308
+ }
309
+ function pe({ className: e = "", children: t }) {
310
+ return /* @__PURE__ */ d("div", {
311
+ className: `brd-grid ${e}`,
312
+ children: t
313
+ });
314
+ }
315
+ //#endregion
316
+ //#region src/components/Table.jsx
317
+ function me({ columns: e = [], rows: t = [], getRowId: n = (e, t) => e.id ?? t, onRowClick: r, sortKey: i, sortDir: a = "asc", onSortChange: o, plan: s, empty: c = null, caption: l, className: h = "" }) {
318
+ let g = s ?? (e.length > 5 || e.every((e) => e.width)), _ = (e) => {
319
+ if (!e.sortable || !o) return;
320
+ let t = i === e.key && a === "asc" ? "desc" : "asc";
321
+ o(e.key, t);
322
+ };
323
+ return /* @__PURE__ */ d("div", {
324
+ className: "overflow-x-auto",
325
+ children: /* @__PURE__ */ f("table", {
326
+ className: `table ${g ? "table-plan" : ""} ${h}`,
327
+ children: [
328
+ l && /* @__PURE__ */ d("caption", {
329
+ className: "sr-only",
330
+ children: l
331
+ }),
332
+ g && /* @__PURE__ */ d("colgroup", { children: e.map((e) => /* @__PURE__ */ d("col", { style: e.width ? { width: e.width } : void 0 }, e.key)) }),
333
+ /* @__PURE__ */ d("thead", { children: /* @__PURE__ */ d("tr", { children: e.map((e) => {
334
+ let t = i === e.key, n = a === "asc" ? m : p;
335
+ return /* @__PURE__ */ d("th", {
336
+ scope: "col",
337
+ className: `th ${e.sortable && o ? "th--sortable" : ""} ${e.align === "right" ? "td--num" : ""}`,
338
+ style: !g && e.width ? { width: e.width } : void 0,
339
+ title: e.title ?? e.label,
340
+ "aria-sort": t ? a === "asc" ? "ascending" : "descending" : void 0,
341
+ onClick: () => _(e),
342
+ children: /* @__PURE__ */ f("span", {
343
+ className: "inline-flex items-center gap-1",
344
+ children: [e.label, t && /* @__PURE__ */ d(n, {
345
+ size: 14,
346
+ "aria-hidden": "true"
347
+ })]
348
+ })
349
+ }, e.key);
350
+ }) }) }),
351
+ /* @__PURE__ */ f("tbody", { children: [t.length === 0 && c && /* @__PURE__ */ d("tr", { children: /* @__PURE__ */ d("td", {
352
+ className: "td",
353
+ colSpan: e.length,
354
+ children: c
355
+ }) }), t.map((t, i) => {
356
+ let a = n(t, i), o = !!r;
357
+ return /* @__PURE__ */ d("tr", {
358
+ className: o ? "row-link" : void 0,
359
+ onClick: o ? () => r(t) : void 0,
360
+ onKeyDown: o ? (e) => {
361
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r(t));
362
+ } : void 0,
363
+ tabIndex: o ? 0 : void 0,
364
+ children: e.map((e) => {
365
+ let n = t[e.key], r = e.render ? e.render(t) : n, i = e.sub ? e.sub(t) : null, a = e.truncate !== !1 && !e.render, o = typeof n == "string" || typeof n == "number" ? String(n) : void 0;
366
+ return /* @__PURE__ */ d("td", {
367
+ className: `td ${e.align === "right" ? "td--num" : ""} ${a && !i ? "td--truncate" : ""}`,
368
+ title: a ? o : void 0,
369
+ children: i ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", {
370
+ className: "block truncate",
371
+ title: o,
372
+ children: r
373
+ }), /* @__PURE__ */ d("span", {
374
+ className: "td-sub",
375
+ title: typeof i == "string" ? i : void 0,
376
+ children: i
377
+ })] }) : r
378
+ }, e.key);
379
+ })
380
+ }, a);
381
+ })] })
382
+ ]
383
+ })
384
+ });
385
+ }
386
+ //#endregion
387
+ //#region src/components/FilterChip.jsx
388
+ function he({ active: e = !1, count: t, icon: n, className: r = "", children: i, ...a }) {
389
+ return /* @__PURE__ */ f("button", {
390
+ type: "button",
391
+ className: `fchip ${r}`,
392
+ "aria-pressed": e,
393
+ ...a,
394
+ children: [
395
+ n && /* @__PURE__ */ d(n, {
396
+ size: 14,
397
+ "aria-hidden": "true"
398
+ }),
399
+ /* @__PURE__ */ d("span", { children: i }),
400
+ t != null && /* @__PURE__ */ d("span", {
401
+ className: "fcount",
402
+ children: t
403
+ })
404
+ ]
405
+ });
406
+ }
407
+ function ge({ options: e = [], value: t, onChange: n, className: r = "" }) {
408
+ return /* @__PURE__ */ d("div", {
409
+ className: `flex items-center gap-3 flex-wrap ${r}`,
410
+ role: "group",
411
+ children: e.map((e) => /* @__PURE__ */ d(he, {
412
+ icon: e.icon,
413
+ count: e.count,
414
+ active: t === e.value,
415
+ title: e.title,
416
+ onClick: () => n?.(e.value),
417
+ children: e.label
418
+ }, e.value))
419
+ });
420
+ }
421
+ //#endregion
422
+ //#region src/components/Tabs.jsx
423
+ function _e({ tabs: e = [], value: t, onChange: n, className: r = "", "aria-label": i }) {
424
+ let o = a();
425
+ return /* @__PURE__ */ d("div", {
426
+ className: `tabs ${r}`,
427
+ role: "tablist",
428
+ "aria-label": i,
429
+ onKeyDown: (r) => {
430
+ let i = e.findIndex((e) => e.value === t);
431
+ if (i < 0) return;
432
+ let a = -1;
433
+ r.key === "ArrowRight" && (a = (i + 1) % e.length), r.key === "ArrowLeft" && (a = (i - 1 + e.length) % e.length), r.key === "Home" && (a = 0), r.key === "End" && (a = e.length - 1), a >= 0 && (r.preventDefault(), n?.(e[a].value), document.getElementById(`${o}-${e[a].value}`)?.focus());
434
+ },
435
+ children: e.map((e) => {
436
+ let r = e.value === t;
437
+ return /* @__PURE__ */ f("button", {
438
+ id: `${o}-${e.value}`,
439
+ type: "button",
440
+ role: "tab",
441
+ className: "tab",
442
+ "aria-selected": r,
443
+ tabIndex: r ? 0 : -1,
444
+ title: e.title,
445
+ onClick: () => n?.(e.value),
446
+ children: [
447
+ e.icon && /* @__PURE__ */ d(e.icon, {
448
+ size: 16,
449
+ "aria-hidden": "true"
450
+ }),
451
+ e.label,
452
+ e.badge != null && /* @__PURE__ */ d("span", {
453
+ className: "tab-badge",
454
+ children: e.badge
455
+ }),
456
+ e.alert && /* @__PURE__ */ d("span", {
457
+ className: "tab-alert",
458
+ "aria-label": "Has empty required fields"
459
+ })
460
+ ]
461
+ }, e.value);
462
+ })
463
+ });
464
+ }
465
+ //#endregion
466
+ //#region src/components/ToolbarButton.jsx
467
+ function ve({ icon: e, active: t = !1, iconOnly: n = !1, className: r = "", children: i, ...a }) {
468
+ return /* @__PURE__ */ f("button", {
469
+ type: "button",
470
+ className: `tbtn ${n ? "tbtn--icon" : ""} ${r}`,
471
+ "aria-pressed": t,
472
+ "aria-label": n ? a["aria-label"] ?? a.title : void 0,
473
+ ...a,
474
+ children: [e && /* @__PURE__ */ d(e, {
475
+ size: 16,
476
+ "aria-hidden": "true"
477
+ }), !n && i]
478
+ });
479
+ }
480
+ function ye({ options: e = [], value: t, onChange: n, className: r = "" }) {
481
+ return /* @__PURE__ */ d("div", {
482
+ className: `inline-flex gap-1 ${r}`,
483
+ role: "group",
484
+ children: e.map((e) => /* @__PURE__ */ d(ve, {
485
+ icon: e.icon,
486
+ iconOnly: !0,
487
+ title: e.title,
488
+ active: t === e.value,
489
+ onClick: () => n?.(e.value)
490
+ }, e.value))
491
+ });
492
+ }
493
+ //#endregion
494
+ //#region src/components/Input.jsx
495
+ function be({ htmlFor: e, required: t, className: n = "", children: r }) {
496
+ return /* @__PURE__ */ f("label", {
497
+ htmlFor: e,
498
+ className: `lbl ${n}`,
499
+ children: [r, t && /* @__PURE__ */ d("span", {
500
+ className: "lbl__req",
501
+ "aria-hidden": "true",
502
+ children: "*"
503
+ })]
504
+ });
505
+ }
506
+ function xe({ error: e, id: t, className: n = "", children: r }) {
507
+ return r ? /* @__PURE__ */ d("span", {
508
+ id: t,
509
+ className: `hint ${e ? "hint--error" : ""} ${n}`,
510
+ children: r
511
+ }) : null;
512
+ }
513
+ function q({ id: e, label: t, required: n, hint: r, error: i, className: a, children: o }) {
514
+ return /* @__PURE__ */ f("div", {
515
+ className: a,
516
+ children: [
517
+ t && /* @__PURE__ */ d(be, {
518
+ htmlFor: e,
519
+ required: n,
520
+ children: t
521
+ }),
522
+ o,
523
+ /* @__PURE__ */ d(xe, {
524
+ id: `${e}-hint`,
525
+ error: !!i,
526
+ children: i || r
527
+ })
528
+ ]
529
+ });
530
+ }
531
+ var Se = t(function({ id: e, label: t, required: n, hint: r, error: i, dense: o = !1, icon: s, className: c = "", inputClassName: l = "", ...u }, p) {
532
+ let m = a(), h = e ?? m, g = /* @__PURE__ */ d("input", {
533
+ ref: p,
534
+ id: h,
535
+ required: n,
536
+ "aria-invalid": i ? "true" : void 0,
537
+ "aria-describedby": r || i ? `${h}-hint` : void 0,
538
+ className: `inp ${o ? "inp--dense" : ""} ${s ? "inp--glyph" : ""} ${l}`,
539
+ ...u
540
+ });
541
+ return /* @__PURE__ */ d(q, {
542
+ id: h,
543
+ label: t,
544
+ required: n,
545
+ hint: r,
546
+ error: i,
547
+ className: c,
548
+ children: s ? /* @__PURE__ */ f("div", {
549
+ className: "inp-wrap",
550
+ children: [/* @__PURE__ */ d(s, {
551
+ size: 16,
552
+ className: "inp-glyph",
553
+ "aria-hidden": "true"
554
+ }), g]
555
+ }) : g
556
+ });
557
+ }), Ce = t(function({ id: e, label: t, required: n, hint: r, error: i, className: o = "", inputClassName: s = "", ...c }, l) {
558
+ let u = a(), f = e ?? u;
559
+ return /* @__PURE__ */ d(q, {
560
+ id: f,
561
+ label: t,
562
+ required: n,
563
+ hint: r,
564
+ error: i,
565
+ className: o,
566
+ children: /* @__PURE__ */ d("textarea", {
567
+ ref: l,
568
+ id: f,
569
+ required: n,
570
+ "aria-invalid": i ? "true" : void 0,
571
+ className: `inp ${s}`,
572
+ ...c
573
+ })
574
+ });
575
+ }), we = t(function({ id: e, label: t, required: n, hint: r, error: i, dense: o = !1, className: s = "", inputClassName: c = "", children: l, ...u }, p) {
576
+ let m = a(), h = e ?? m;
577
+ return /* @__PURE__ */ d(q, {
578
+ id: h,
579
+ label: t,
580
+ required: n,
581
+ hint: r,
582
+ error: i,
583
+ className: s,
584
+ children: /* @__PURE__ */ f("div", {
585
+ className: "inp-wrap",
586
+ children: [/* @__PURE__ */ d("select", {
587
+ ref: p,
588
+ id: h,
589
+ required: n,
590
+ "aria-invalid": i ? "true" : void 0,
591
+ className: `inp ${o ? "inp--dense" : ""} ${c}`,
592
+ ...u,
593
+ children: l
594
+ }), /* @__PURE__ */ d(b, {
595
+ size: 16,
596
+ className: "inp-glyph inp-glyph--right",
597
+ "aria-hidden": "true"
598
+ })]
599
+ })
600
+ });
601
+ }), Te = t(function({ value: e, onClear: t, dense: n = !1, className: r = "", placeholder: i = "Search", ...a }, o) {
602
+ let s = e != null && String(e).length > 0;
603
+ return /* @__PURE__ */ f("div", {
604
+ className: `inp-wrap ${r}`,
605
+ children: [
606
+ /* @__PURE__ */ d(M, {
607
+ size: 16,
608
+ className: "inp-glyph",
609
+ "aria-hidden": "true"
610
+ }),
611
+ /* @__PURE__ */ d("input", {
612
+ ref: o,
613
+ type: "search",
614
+ value: e,
615
+ placeholder: i,
616
+ "aria-label": i,
617
+ className: `inp inp-search inp--glyph ${n ? "inp--dense" : ""} ${t ? "inp--glyph-right" : ""}`,
618
+ ...a
619
+ }),
620
+ t && s && /* @__PURE__ */ d("button", {
621
+ type: "button",
622
+ onClick: t,
623
+ title: "Clear search",
624
+ "aria-label": "Clear search",
625
+ className: "absolute right-2 top-1/2 -translate-y-1/2 grid place-items-center w-6 h-6 rounded-full text-ink-faint hover:text-ink hover:bg-surface-2",
626
+ children: /* @__PURE__ */ d(P, {
627
+ size: 14,
628
+ "aria-hidden": "true"
629
+ })
630
+ })
631
+ ]
632
+ });
633
+ });
634
+ function Ee({ label: e, className: t = "", ...n }) {
635
+ let r = a();
636
+ return /* @__PURE__ */ f("label", {
637
+ htmlFor: n.id ?? r,
638
+ className: `inline-flex items-center gap-2 text-sm cursor-pointer ${t}`,
639
+ children: [/* @__PURE__ */ d("input", {
640
+ type: "checkbox",
641
+ id: n.id ?? r,
642
+ className: "checkbox",
643
+ ...n
644
+ }), e && /* @__PURE__ */ d("span", { children: e })]
645
+ });
646
+ }
647
+ //#endregion
648
+ //#region src/components/Chip.jsx
649
+ function De({ status: e = "draft", label: t, icon: n = !1, className: r = "", ...i }) {
650
+ return /* @__PURE__ */ f("span", {
651
+ className: `chip chip--${e} ${r}`,
652
+ ...i,
653
+ children: [n && /* @__PURE__ */ d(V, {
654
+ status: e,
655
+ size: 14
656
+ }), t ?? z(e)]
657
+ });
658
+ }
659
+ function Oe({ icon: e, className: t = "", children: n, ...r }) {
660
+ return /* @__PURE__ */ f("span", {
661
+ className: `tag ${t}`,
662
+ ...r,
663
+ children: [e && /* @__PURE__ */ d(e, {
664
+ size: 14,
665
+ "aria-hidden": "true"
666
+ }), n]
667
+ });
668
+ }
669
+ function ke({ version: e, current: t = !1, className: n = "", ...r }) {
670
+ return /* @__PURE__ */ d("span", {
671
+ className: `tag vchip ${n}`,
672
+ "data-current": t ? "true" : void 0,
673
+ ...r,
674
+ children: e
675
+ });
676
+ }
677
+ //#endregion
678
+ //#region src/components/Notice.jsx
679
+ var Ae = {
680
+ default: O,
681
+ accent: te,
682
+ alert: C
683
+ };
684
+ function je({ tone: e = "default", icon: t, action: n, className: r = "", children: i, ...a }) {
685
+ let o = t ?? Ae[e] ?? O, s = e === "default" ? "" : `notice--${e}`;
686
+ return /* @__PURE__ */ f("div", {
687
+ className: `notice ${s} ${r}`,
688
+ role: e === "alert" ? "alert" : "status",
689
+ ...a,
690
+ children: [
691
+ /* @__PURE__ */ d(o, {
692
+ size: 20,
693
+ className: "notice__icon",
694
+ "aria-hidden": "true"
695
+ }),
696
+ /* @__PURE__ */ d("div", {
697
+ className: "notice__text",
698
+ children: i
699
+ }),
700
+ n && /* @__PURE__ */ d("div", {
701
+ className: "notice__action",
702
+ children: n
703
+ })
704
+ ]
705
+ });
706
+ }
707
+ //#endregion
708
+ //#region src/components/usePerson.js
709
+ var Me = e(null);
710
+ function Ne(e, { id: t, email: n, name: r }) {
711
+ if (!e) return null;
712
+ let i = n?.toLowerCase(), a = r?.trim().toLowerCase();
713
+ return t != null && e.find((e) => String(e.id) === String(t)) || i && e.find((e) => e.email?.toLowerCase() === i) || a && e.find((e) => e.name?.trim().toLowerCase() === a) || null;
714
+ }
715
+ function Pe({ id: e, email: t, name: n }) {
716
+ let a = r(Me), o = Ne(a?.list, {
717
+ id: e,
718
+ email: t,
719
+ name: n
720
+ }), [s, c] = l(null);
721
+ return i(() => {
722
+ if (o || !a) return;
723
+ let r = !0;
724
+ return a.ensure().then((i) => {
725
+ r && c(Ne(i, {
726
+ id: e,
727
+ email: t,
728
+ name: n
729
+ }));
730
+ }), () => {
731
+ r = !1;
732
+ };
733
+ }, [
734
+ a,
735
+ o,
736
+ e,
737
+ t,
738
+ n
739
+ ]), o ?? s;
740
+ }
741
+ //#endregion
742
+ //#region src/components/Person.jsx
743
+ function Fe({ people: e, load: t, children: r }) {
744
+ let [i, a] = l(null), o = c(null), u = e ?? i, f = n(() => u ? Promise.resolve(u) : t ? (o.current ||= Promise.resolve(t()).then((e) => (a(e), e)), o.current) : Promise.resolve([]), [u, t]), p = s(() => ({
745
+ list: u,
746
+ ensure: f
747
+ }), [u, f]);
748
+ return /* @__PURE__ */ d(Me.Provider, {
749
+ value: p,
750
+ children: r
751
+ });
752
+ }
753
+ var Ie = 300, Le = 8;
754
+ function Re({ person: e, anchorRef: t, id: n }) {
755
+ let r = c(null), [i, a] = l({
756
+ top: -9999,
757
+ left: -9999
758
+ });
759
+ o(() => {
760
+ let e = t.current;
761
+ if (!e || !r.current) return;
762
+ let n = e.getBoundingClientRect(), i = r.current.offsetHeight, o = window.innerWidth, s = window.innerHeight, c = n.bottom + Le;
763
+ c + i > s - 12 && (c = Math.max(12, n.top - Le - i));
764
+ let l = n.left;
765
+ l + Ie > o - 12 && (l = Math.max(12, o - 12 - Ie)), a({
766
+ top: c,
767
+ left: l
768
+ });
769
+ }, [t, e]);
770
+ let s = e.status && e.status.toLowerCase() !== "active";
771
+ return F(/* @__PURE__ */ f("div", {
772
+ ref: r,
773
+ id: n,
774
+ role: "dialog",
775
+ "aria-label": e.name,
776
+ className: "person-card",
777
+ style: i,
778
+ children: [/* @__PURE__ */ f("div", {
779
+ className: "person-card__head",
780
+ children: [
781
+ /* @__PURE__ */ d(K, {
782
+ name: e.name,
783
+ photo: e.photo,
784
+ size: 48
785
+ }),
786
+ /* @__PURE__ */ f("div", {
787
+ className: "min-w-0 flex-1",
788
+ children: [/* @__PURE__ */ d("div", {
789
+ className: "person-card__name",
790
+ children: e.name
791
+ }), e.designation && /* @__PURE__ */ d("div", {
792
+ className: "person-card__desig",
793
+ children: e.designation
794
+ })]
795
+ }),
796
+ s && /* @__PURE__ */ d(Oe, { children: e.status })
797
+ ]
798
+ }), /* @__PURE__ */ f("div", {
799
+ className: "person-card__body",
800
+ children: [
801
+ e.email && /* @__PURE__ */ f("div", {
802
+ className: "person-card__row",
803
+ children: [/* @__PURE__ */ d(A, {
804
+ size: 16,
805
+ "aria-hidden": "true"
806
+ }), /* @__PURE__ */ d("a", {
807
+ href: `mailto:${e.email}`,
808
+ children: e.email
809
+ })]
810
+ }),
811
+ e.department && /* @__PURE__ */ f("div", {
812
+ className: "person-card__row",
813
+ children: [/* @__PURE__ */ d(v, {
814
+ size: 16,
815
+ "aria-hidden": "true"
816
+ }), /* @__PURE__ */ d("span", { children: e.department })]
817
+ }),
818
+ e.reportsTo && /* @__PURE__ */ f("div", {
819
+ className: "person-card__row",
820
+ children: [/* @__PURE__ */ d(ie, {
821
+ size: 16,
822
+ "aria-hidden": "true"
823
+ }), /* @__PURE__ */ f("span", { children: ["Reports to ", e.reportsTo] })]
824
+ }),
825
+ e.role && /* @__PURE__ */ f("div", {
826
+ className: "person-card__row",
827
+ children: [/* @__PURE__ */ d(_, {
828
+ size: 16,
829
+ "aria-hidden": "true"
830
+ }), /* @__PURE__ */ d("span", { children: e.role })]
831
+ })
832
+ ]
833
+ })]
834
+ }), document.body);
835
+ }
836
+ var ze = 350, Be = 180;
837
+ function Ve({ id: e, email: t, name: n, person: r, size: o = 32, sub: s, showEmail: p = !1, avatarOnly: m = !1, hoverOnly: h = !1, className: g = "" }) {
838
+ let _ = Pe({
839
+ id: e,
840
+ email: t,
841
+ name: n
842
+ }), v = r ?? _ ?? (n || t ? {
843
+ name: n ?? t,
844
+ email: t
845
+ } : null), [y, b] = l(!1), x = c(null), S = c(null), C = a(), w = () => {
846
+ S.current && clearTimeout(S.current), S.current = null;
847
+ }, T = () => {
848
+ w(), S.current = setTimeout(() => b(!0), ze);
849
+ }, E = () => {
850
+ w(), S.current = setTimeout(() => b(!1), Be);
851
+ }, D = () => {
852
+ w(), b(!0);
853
+ }, O = () => {
854
+ w(), b(!1);
855
+ };
856
+ if (i(() => () => S.current && clearTimeout(S.current), []), i(() => {
857
+ if (!y) return;
858
+ let e = (e) => e.key === "Escape" && b(!1), t = () => b(!1);
859
+ return window.addEventListener("keydown", e), window.addEventListener("scroll", t, !0), () => {
860
+ window.removeEventListener("keydown", e), window.removeEventListener("scroll", t, !0);
861
+ };
862
+ }, [y]), !v) return null;
863
+ let k = p ? v.email ?? v.name : v.name, A = /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(K, {
864
+ name: v.name,
865
+ photo: v.photo,
866
+ size: o
867
+ }), !m && /* @__PURE__ */ f("span", {
868
+ className: "min-w-0",
869
+ children: [/* @__PURE__ */ d("span", {
870
+ className: "person__name block",
871
+ children: k
872
+ }), s && /* @__PURE__ */ d("span", {
873
+ className: "person__sub",
874
+ children: s
875
+ })]
876
+ })] });
877
+ return /* @__PURE__ */ f(u, { children: [h ? /* @__PURE__ */ d("span", {
878
+ ref: x,
879
+ className: `person ${g}`,
880
+ onMouseEnter: T,
881
+ onMouseLeave: E,
882
+ "aria-describedby": y ? C : void 0,
883
+ title: v.email,
884
+ children: A
885
+ }) : /* @__PURE__ */ d("button", {
886
+ ref: x,
887
+ type: "button",
888
+ className: `person ${g}`,
889
+ onMouseEnter: T,
890
+ onMouseLeave: E,
891
+ onFocus: D,
892
+ onBlur: O,
893
+ "aria-describedby": y ? C : void 0,
894
+ children: A
895
+ }), y && /* @__PURE__ */ d(Re, {
896
+ person: v,
897
+ anchorRef: x,
898
+ id: C
899
+ })] });
900
+ }
901
+ //#endregion
902
+ //#region src/components/Stepper.jsx
903
+ function He({ steps: e = [], orientation: t = "horizontal", className: n = "" }) {
904
+ let r = t === "vertical";
905
+ return /* @__PURE__ */ d("ol", {
906
+ className: `stepper ${r ? "stepper--v" : "stepper--h"} ${n}`,
907
+ children: e.map((e, t) => {
908
+ let n = e.state ?? "waiting";
909
+ return /* @__PURE__ */ f("li", {
910
+ className: "step",
911
+ "data-state": n,
912
+ "aria-current": n === "current" ? "step" : void 0,
913
+ children: [
914
+ /* @__PURE__ */ d("span", {
915
+ className: "stamp",
916
+ "aria-hidden": "true",
917
+ children: n === "done" ? /* @__PURE__ */ d(y, { size: 18 }) : n === "rejected" ? /* @__PURE__ */ d(P, { size: 18 }) : t + 1
918
+ }),
919
+ /* @__PURE__ */ d("span", {
920
+ className: "sr-only",
921
+ children: n
922
+ }),
923
+ /* @__PURE__ */ f("div", {
924
+ className: "step__body",
925
+ children: [
926
+ /* @__PURE__ */ d("div", {
927
+ className: "step__title",
928
+ title: e.label,
929
+ children: e.label
930
+ }),
931
+ e.sub && /* @__PURE__ */ d("div", {
932
+ className: "step__sub",
933
+ title: e.sub,
934
+ children: e.sub
935
+ }),
936
+ r && e.children
937
+ ]
938
+ })
939
+ ]
940
+ }, e.id ?? t);
941
+ })
942
+ });
943
+ }
944
+ //#endregion
945
+ //#region src/components/scroll-lock.js
946
+ var J = 0;
947
+ function Y() {
948
+ return J += 1, document.body.style.overflow = "hidden", () => {
949
+ J = Math.max(0, J - 1), J === 0 && (document.body.style.overflow = "");
950
+ };
951
+ }
952
+ //#endregion
953
+ //#region src/components/Dialog.jsx
954
+ var Ue = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
955
+ function We({ open: e, onClose: t, title: n, size: r = 640, footer: o, children: s, className: l = "" }) {
956
+ let u = c(null), p = c(null), m = a();
957
+ return i(() => {
958
+ if (!e) return;
959
+ p.current = document.activeElement;
960
+ let n = Y();
961
+ (u.current?.querySelector(Ue) ?? u.current)?.focus();
962
+ let r = (e) => {
963
+ if (e.key === "Escape") {
964
+ e.stopPropagation(), t?.();
965
+ return;
966
+ }
967
+ if (e.key !== "Tab" || !u.current) return;
968
+ let n = Array.from(u.current.querySelectorAll(Ue));
969
+ if (n.length === 0) {
970
+ e.preventDefault();
971
+ return;
972
+ }
973
+ let r = n[0], i = n[n.length - 1];
974
+ e.shiftKey && document.activeElement === r ? (e.preventDefault(), i.focus()) : !e.shiftKey && document.activeElement === i && (e.preventDefault(), r.focus());
975
+ };
976
+ return document.addEventListener("keydown", r), () => {
977
+ document.removeEventListener("keydown", r), n(), p.current && typeof p.current.focus == "function" && p.current.focus();
978
+ };
979
+ }, [e, t]), e ? F(/* @__PURE__ */ d("div", {
980
+ className: "modal-scrim",
981
+ onMouseDown: (e) => e.target === e.currentTarget && t?.(),
982
+ children: /* @__PURE__ */ f("div", {
983
+ ref: u,
984
+ role: "dialog",
985
+ "aria-modal": "true",
986
+ "aria-labelledby": n ? m : void 0,
987
+ tabIndex: -1,
988
+ className: `modal modal--${r} ${l}`,
989
+ children: [
990
+ /* @__PURE__ */ f("header", {
991
+ className: "modal__h",
992
+ children: [/* @__PURE__ */ d("h2", {
993
+ id: m,
994
+ className: "modal__title truncate",
995
+ children: n
996
+ }), /* @__PURE__ */ d(I, {
997
+ variant: "text",
998
+ size: "sm",
999
+ iconOnly: !0,
1000
+ icon: P,
1001
+ title: "Close",
1002
+ onClick: t
1003
+ })]
1004
+ }),
1005
+ /* @__PURE__ */ d("div", {
1006
+ className: "modal__b",
1007
+ children: s
1008
+ }),
1009
+ o && /* @__PURE__ */ d("footer", {
1010
+ className: "modal__f",
1011
+ children: o
1012
+ })
1013
+ ]
1014
+ })
1015
+ }), document.body) : null;
1016
+ }
1017
+ //#endregion
1018
+ //#region src/components/DocFull.jsx
1019
+ function Ge({ open: e, onClose: t, children: n, label: r = "Document" }) {
1020
+ return i(() => {
1021
+ if (!e) return;
1022
+ let n = Y(), r = (e) => e.key === "Escape" && t?.();
1023
+ return document.addEventListener("keydown", r), () => {
1024
+ document.removeEventListener("keydown", r), n();
1025
+ };
1026
+ }, [e, t]), e ? F(/* @__PURE__ */ f("div", {
1027
+ className: "doc-full",
1028
+ role: "dialog",
1029
+ "aria-modal": "true",
1030
+ "aria-label": r,
1031
+ children: [/* @__PURE__ */ d(I, {
1032
+ variant: "outlined",
1033
+ icon: j,
1034
+ className: "doc-full__exit",
1035
+ onClick: t,
1036
+ children: "Exit"
1037
+ }), /* @__PURE__ */ d("div", {
1038
+ className: "doc-full__page doc",
1039
+ children: n
1040
+ })]
1041
+ }), document.body) : null;
1042
+ }
1043
+ //#endregion
1044
+ //#region src/components/Skeleton.jsx
1045
+ function X({ w: e = "100%", h: t = 12, circle: n = !1, className: r = "", style: i, ...a }) {
1046
+ return /* @__PURE__ */ d("span", {
1047
+ className: `skel ${n ? "skel--circle" : ""} ${r}`,
1048
+ style: {
1049
+ width: e,
1050
+ height: t,
1051
+ ...i
1052
+ },
1053
+ "aria-hidden": "true",
1054
+ ...a
1055
+ });
1056
+ }
1057
+ function Ke() {
1058
+ return /* @__PURE__ */ f("div", {
1059
+ className: "brd-card",
1060
+ "aria-hidden": "true",
1061
+ children: [
1062
+ /* @__PURE__ */ d("span", {
1063
+ className: "brd-card__orb",
1064
+ style: {
1065
+ background: "rgb(var(--c-surface-3))",
1066
+ boxShadow: "none"
1067
+ }
1068
+ }),
1069
+ /* @__PURE__ */ d(X, {
1070
+ h: 16,
1071
+ w: "88%"
1072
+ }),
1073
+ /* @__PURE__ */ d(X, {
1074
+ h: 16,
1075
+ w: "64%",
1076
+ className: "mt-2"
1077
+ }),
1078
+ /* @__PURE__ */ f("div", {
1079
+ className: "brd-card__meta",
1080
+ children: [/* @__PURE__ */ d("div", {
1081
+ className: "brd-card__meta-row",
1082
+ children: /* @__PURE__ */ d(X, {
1083
+ h: 12,
1084
+ w: "56%"
1085
+ })
1086
+ }), /* @__PURE__ */ d("div", {
1087
+ className: "brd-card__meta-row",
1088
+ children: /* @__PURE__ */ d(X, {
1089
+ h: 12,
1090
+ w: "44%"
1091
+ })
1092
+ })]
1093
+ }),
1094
+ /* @__PURE__ */ f("div", {
1095
+ className: "brd-card__foot",
1096
+ children: [/* @__PURE__ */ f("span", {
1097
+ className: "flex items-center gap-1",
1098
+ children: [
1099
+ /* @__PURE__ */ d(X, {
1100
+ circle: !0,
1101
+ w: 24,
1102
+ h: 24
1103
+ }),
1104
+ /* @__PURE__ */ d(X, {
1105
+ circle: !0,
1106
+ w: 24,
1107
+ h: 24
1108
+ }),
1109
+ /* @__PURE__ */ d(X, {
1110
+ circle: !0,
1111
+ w: 24,
1112
+ h: 24
1113
+ })
1114
+ ]
1115
+ }), /* @__PURE__ */ d(X, {
1116
+ h: 14,
1117
+ w: 40
1118
+ })]
1119
+ })
1120
+ ]
1121
+ });
1122
+ }
1123
+ function qe({ columns: e = 5, rows: t = 6 }) {
1124
+ return /* @__PURE__ */ f("table", {
1125
+ className: "table table-plan",
1126
+ "aria-hidden": "true",
1127
+ children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ d("tr", { children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ d("th", {
1128
+ className: "th",
1129
+ children: /* @__PURE__ */ d(X, {
1130
+ h: 10,
1131
+ w: "60%"
1132
+ })
1133
+ }, t)) }) }), /* @__PURE__ */ d("tbody", { children: Array.from({ length: t }, (t, n) => /* @__PURE__ */ d("tr", { children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ d("td", {
1134
+ className: "td",
1135
+ children: /* @__PURE__ */ d(X, {
1136
+ h: 12,
1137
+ w: t === 0 ? "80%" : "50%"
1138
+ })
1139
+ }, t)) }, n)) })]
1140
+ });
1141
+ }
1142
+ function Je() {
1143
+ return /* @__PURE__ */ f("div", {
1144
+ className: "stat-tile",
1145
+ "aria-hidden": "true",
1146
+ children: [/* @__PURE__ */ d(X, {
1147
+ w: 44,
1148
+ h: 44,
1149
+ style: { borderRadius: 8 }
1150
+ }), /* @__PURE__ */ f("span", {
1151
+ className: "min-w-0 flex-1",
1152
+ children: [/* @__PURE__ */ d(X, {
1153
+ h: 24,
1154
+ w: 56
1155
+ }), /* @__PURE__ */ d(X, {
1156
+ h: 12,
1157
+ w: "60%",
1158
+ className: "mt-2"
1159
+ })]
1160
+ })]
1161
+ });
1162
+ }
1163
+ //#endregion
1164
+ //#region src/components/EmptyState.jsx
1165
+ function Ye({ icon: e = D, title: t, line: n, action: r, className: i = "" }) {
1166
+ return /* @__PURE__ */ f("div", {
1167
+ className: `empty ${i}`,
1168
+ children: [
1169
+ /* @__PURE__ */ d("span", {
1170
+ className: "empty__well",
1171
+ children: /* @__PURE__ */ d(e, {
1172
+ size: 20,
1173
+ "aria-hidden": "true"
1174
+ })
1175
+ }),
1176
+ t && /* @__PURE__ */ d("p", {
1177
+ className: "empty__title",
1178
+ children: t
1179
+ }),
1180
+ n && /* @__PURE__ */ d("p", {
1181
+ className: "empty__line",
1182
+ children: n
1183
+ }),
1184
+ r && /* @__PURE__ */ d("div", {
1185
+ className: "mt-2",
1186
+ children: r
1187
+ })
1188
+ ]
1189
+ });
1190
+ }
1191
+ //#endregion
1192
+ //#region src/components/toast-context.js
1193
+ var Z = e(null);
1194
+ function Xe() {
1195
+ let e = r(Z);
1196
+ if (!e) throw Error("useToast must be used inside <ToastProvider>");
1197
+ return e.toast;
1198
+ }
1199
+ function Ze() {
1200
+ let e = r(Z);
1201
+ if (!e) throw Error("useToastDismiss must be used inside <ToastProvider>");
1202
+ return e.dismiss;
1203
+ }
1204
+ //#endregion
1205
+ //#region src/components/Toast.jsx
1206
+ function Qe({ children: e, duration: t = 4e3 }) {
1207
+ let [r, a] = l(null), o = c(null), u = n(() => {
1208
+ o.current && clearTimeout(o.current), o.current = null, a(null);
1209
+ }, []), p = n((e) => {
1210
+ let n = typeof e == "string" ? { message: e } : e;
1211
+ o.current && clearTimeout(o.current), a({
1212
+ tone: "default",
1213
+ ...n,
1214
+ key: Date.now()
1215
+ }), o.current = setTimeout(() => a(null), n.duration ?? t);
1216
+ }, [t]);
1217
+ i(() => () => o.current && clearTimeout(o.current), []);
1218
+ let m = s(() => ({
1219
+ toast: p,
1220
+ dismiss: u
1221
+ }), [p, u]);
1222
+ return /* @__PURE__ */ f(Z.Provider, {
1223
+ value: m,
1224
+ children: [e, r && F(/* @__PURE__ */ f("div", {
1225
+ className: `toast ${r.tone === "error" ? "toast--error" : ""}`,
1226
+ role: r.tone === "error" ? "alert" : "status",
1227
+ children: [
1228
+ r.tone === "error" ? /* @__PURE__ */ d(C, {
1229
+ size: 18,
1230
+ "aria-hidden": "true"
1231
+ }) : /* @__PURE__ */ d(w, {
1232
+ size: 18,
1233
+ "aria-hidden": "true"
1234
+ }),
1235
+ /* @__PURE__ */ d("span", {
1236
+ className: "toast__text",
1237
+ title: r.message,
1238
+ children: r.message
1239
+ }),
1240
+ r.action,
1241
+ /* @__PURE__ */ d("button", {
1242
+ type: "button",
1243
+ className: "toast__close",
1244
+ onClick: u,
1245
+ "aria-label": "Dismiss",
1246
+ children: /* @__PURE__ */ d(P, {
1247
+ size: 16,
1248
+ "aria-hidden": "true"
1249
+ })
1250
+ })
1251
+ ]
1252
+ }, r.key), document.body)]
1253
+ });
1254
+ }
1255
+ //#endregion
1256
+ //#region src/components/theme.js
1257
+ var Q = "iw-theme", $e = "(prefers-color-scheme: dark)";
1258
+ function et() {
1259
+ try {
1260
+ let e = localStorage.getItem(Q);
1261
+ return e === "dark" || e === "light" ? e : "system";
1262
+ } catch {
1263
+ return "system";
1264
+ }
1265
+ }
1266
+ function tt() {
1267
+ return typeof window < "u" && window.matchMedia?.($e).matches === !0;
1268
+ }
1269
+ function nt() {
1270
+ let [e, t] = l(et), [r, a] = l(tt), o = e === "system" ? r ? "dark" : "light" : e;
1271
+ return i(() => {
1272
+ let t = document.documentElement;
1273
+ e === "system" ? t.removeAttribute("data-theme") : t.setAttribute("data-theme", e);
1274
+ try {
1275
+ e === "system" ? localStorage.removeItem(Q) : localStorage.setItem(Q, e);
1276
+ } catch {}
1277
+ }, [e]), i(() => {
1278
+ let e = window.matchMedia?.($e);
1279
+ if (!e) return;
1280
+ let t = (e) => a(e.matches);
1281
+ return e.addEventListener("change", t), () => e.removeEventListener("change", t);
1282
+ }, []), {
1283
+ theme: e,
1284
+ resolved: o,
1285
+ setTheme: t,
1286
+ toggle: n(() => {
1287
+ t((e) => (e === "system" ? tt() ? "dark" : "light" : e) === "dark" ? "light" : "dark");
1288
+ }, [])
1289
+ };
1290
+ }
1291
+ //#endregion
1292
+ //#region src/components/Shell.jsx
1293
+ var rt = 1e3;
1294
+ function it(e = /* @__PURE__ */ new Date()) {
1295
+ let t = e.getHours();
1296
+ return t < 12 ? "Good morning," : t < 17 ? "Good afternoon," : "Good evening,";
1297
+ }
1298
+ function at({ brand: e = {
1299
+ mark: "IW",
1300
+ name: "Indira Workspace"
1301
+ }, nav: t = [], activeId: n, onNavigate: r, user: a, search: o, notifications: s = 0, onBell: u, onSignOut: p, userMenu: m = [], rail: h, onRailChange: _, children: v }) {
1302
+ let [y, C] = l(!1), [w, T] = l(() => window.innerWidth < rt), E = w || (h ?? y), D = (e) => {
1303
+ _ ? _(e) : C(e);
1304
+ }, [O, A] = l(!1), j = c(null), { resolved: M, toggle: N } = nt();
1305
+ i(() => {
1306
+ let e = window.matchMedia("(max-width: 999px)"), t = () => T(e.matches);
1307
+ return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
1308
+ }, []), i(() => {
1309
+ let e = 0, t = (t) => {
1310
+ if (t.key !== " " || t.repeat) return;
1311
+ let n = t.target, r = n?.tagName;
1312
+ if (r === "INPUT" || r === "TEXTAREA" || r === "SELECT" || r === "BUTTON" || r === "A" || n?.isContentEditable) return;
1313
+ let i = Date.now();
1314
+ i - e < 350 ? (t.preventDefault(), document.fullscreenElement ? document.exitFullscreen?.() : document.documentElement.requestFullscreen?.(), e = 0) : e = i;
1315
+ };
1316
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
1317
+ }, []), i(() => {
1318
+ if (!O) return;
1319
+ let e = (e) => !j.current?.contains(e.target) && A(!1), t = (e) => e.key === "Escape" && A(!1);
1320
+ return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
1321
+ document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
1322
+ };
1323
+ }, [O]);
1324
+ let te = M === "dark" ? ne : ee;
1325
+ return /* @__PURE__ */ f("div", {
1326
+ className: "shell",
1327
+ "data-rail": E ? "true" : "false",
1328
+ children: [/* @__PURE__ */ f("aside", {
1329
+ className: "shell__sidebar",
1330
+ children: [
1331
+ /* @__PURE__ */ f("div", {
1332
+ className: "shell__brand",
1333
+ title: e.name,
1334
+ children: [/* @__PURE__ */ d("span", {
1335
+ className: "shell__brand-mark",
1336
+ "aria-hidden": "true",
1337
+ children: e.mark
1338
+ }), /* @__PURE__ */ d("span", {
1339
+ className: "shell__brand-name",
1340
+ children: e.name
1341
+ })]
1342
+ }),
1343
+ !w && /* @__PURE__ */ d("button", {
1344
+ type: "button",
1345
+ className: "shell__collapse",
1346
+ onClick: () => D(!E),
1347
+ title: E ? "Expand navigation" : "Collapse navigation",
1348
+ "aria-label": E ? "Expand navigation" : "Collapse navigation",
1349
+ "aria-expanded": !E,
1350
+ children: d(E ? S : x, { size: 16 })
1351
+ }),
1352
+ /* @__PURE__ */ d("nav", {
1353
+ className: "shell__nav",
1354
+ "aria-label": "Primary",
1355
+ children: t.map((e, t) => e === "gap" ? /* @__PURE__ */ d("span", {
1356
+ className: "shell__nav-gap",
1357
+ "aria-hidden": "true"
1358
+ }, `gap-${t}`) : /* @__PURE__ */ d($, {
1359
+ icon: e.icon,
1360
+ label: e.label,
1361
+ count: e.count,
1362
+ title: e.title,
1363
+ active: e.id === n,
1364
+ onClick: () => r?.(e.id)
1365
+ }, e.id))
1366
+ }),
1367
+ /* @__PURE__ */ f("div", {
1368
+ className: "shell__foot",
1369
+ children: [/* @__PURE__ */ d($, {
1370
+ icon: te,
1371
+ label: M === "dark" ? "Light theme" : "Dark theme",
1372
+ onClick: N
1373
+ }), p && /* @__PURE__ */ d($, {
1374
+ icon: k,
1375
+ label: "Sign out",
1376
+ onClick: p
1377
+ })]
1378
+ })
1379
+ ]
1380
+ }), /* @__PURE__ */ f("div", {
1381
+ className: "shell__main",
1382
+ children: [/* @__PURE__ */ f("header", {
1383
+ className: "shell__header",
1384
+ children: [
1385
+ a && /* @__PURE__ */ f("div", {
1386
+ className: "shell__greeting",
1387
+ children: [/* @__PURE__ */ d("div", {
1388
+ className: "shell__greeting-hi",
1389
+ children: it()
1390
+ }), /* @__PURE__ */ d("div", {
1391
+ className: "shell__greeting-name",
1392
+ children: a.name
1393
+ })]
1394
+ }),
1395
+ o && /* @__PURE__ */ d(Te, {
1396
+ className: "shell__search",
1397
+ value: o.value ?? "",
1398
+ onChange: o.onChange,
1399
+ onClear: o.onClear,
1400
+ placeholder: o.placeholder ?? "Search"
1401
+ }),
1402
+ /* @__PURE__ */ f("button", {
1403
+ type: "button",
1404
+ className: "btn btn--text btn--icon bell",
1405
+ onClick: u,
1406
+ title: "Notifications",
1407
+ "aria-label": `Notifications${s ? `, ${s} unread` : ""}`,
1408
+ children: [/* @__PURE__ */ d(g, {
1409
+ size: 20,
1410
+ "aria-hidden": "true"
1411
+ }), s > 0 && /* @__PURE__ */ d("span", {
1412
+ className: "bell__badge",
1413
+ children: s > 99 ? "99+" : s
1414
+ })]
1415
+ }),
1416
+ a && /* @__PURE__ */ f("div", {
1417
+ className: "relative",
1418
+ ref: j,
1419
+ children: [/* @__PURE__ */ f("button", {
1420
+ type: "button",
1421
+ className: "user-pill",
1422
+ onClick: () => A((e) => !e),
1423
+ "aria-haspopup": "menu",
1424
+ "aria-expanded": O,
1425
+ title: a.email,
1426
+ children: [
1427
+ /* @__PURE__ */ d(K, {
1428
+ name: a.name,
1429
+ photo: a.photo,
1430
+ size: 40
1431
+ }),
1432
+ /* @__PURE__ */ f("span", {
1433
+ className: "min-w-0",
1434
+ children: [/* @__PURE__ */ d("span", {
1435
+ className: "user-pill__name block truncate",
1436
+ children: a.name
1437
+ }), a.role && /* @__PURE__ */ d("span", {
1438
+ className: "user-pill__role block truncate",
1439
+ children: a.role
1440
+ })]
1441
+ }),
1442
+ /* @__PURE__ */ d(b, {
1443
+ size: 16,
1444
+ className: "text-ink-faint",
1445
+ "aria-hidden": "true"
1446
+ })
1447
+ ]
1448
+ }), O && /* @__PURE__ */ f("div", {
1449
+ className: "menu",
1450
+ role: "menu",
1451
+ children: [m.map((e) => /* @__PURE__ */ f("button", {
1452
+ type: "button",
1453
+ role: "menuitem",
1454
+ className: "menu__item",
1455
+ onClick: () => {
1456
+ A(!1), e.onClick?.();
1457
+ },
1458
+ children: [e.icon && /* @__PURE__ */ d(e.icon, {
1459
+ size: 16,
1460
+ "aria-hidden": "true"
1461
+ }), e.label]
1462
+ }, e.label)), p && /* @__PURE__ */ f("button", {
1463
+ type: "button",
1464
+ role: "menuitem",
1465
+ className: "menu__item",
1466
+ onClick: () => {
1467
+ A(!1), p();
1468
+ },
1469
+ children: [/* @__PURE__ */ d(k, {
1470
+ size: 16,
1471
+ "aria-hidden": "true"
1472
+ }), "Sign out"]
1473
+ })]
1474
+ })]
1475
+ })
1476
+ ]
1477
+ }), /* @__PURE__ */ d("main", {
1478
+ className: "shell__content",
1479
+ children: v
1480
+ })]
1481
+ })]
1482
+ });
1483
+ }
1484
+ function $({ icon: e, label: t, count: n, active: r = !1, title: i, ...a }) {
1485
+ return /* @__PURE__ */ f("button", {
1486
+ type: "button",
1487
+ className: "nav-item",
1488
+ "aria-current": r ? "page" : void 0,
1489
+ title: i ?? t,
1490
+ ...a,
1491
+ children: [
1492
+ e && /* @__PURE__ */ d(e, {
1493
+ size: 20,
1494
+ "aria-hidden": "true"
1495
+ }),
1496
+ /* @__PURE__ */ d("span", {
1497
+ className: "nav-item__label",
1498
+ children: t
1499
+ }),
1500
+ n != null && /* @__PURE__ */ d("span", {
1501
+ className: "nav-item__count",
1502
+ children: n
1503
+ })
1504
+ ]
1505
+ });
1506
+ }
1507
+ function ot({ left: e, right: t, className: n = "" }) {
1508
+ return /* @__PURE__ */ f("div", {
1509
+ className: `toolbar ${n}`,
1510
+ children: [/* @__PURE__ */ d("div", {
1511
+ className: "toolbar__left",
1512
+ children: e
1513
+ }), /* @__PURE__ */ d("div", {
1514
+ className: "toolbar__right",
1515
+ children: t
1516
+ })]
1517
+ });
1518
+ }
1519
+ //#endregion
1520
+ export { U as AVATAR_SIZES, H as AVATAR_TINTS, K as Avatar, de as AvatarStack, I as Button, L as Card, Ee as Checkbox, We as Dialog, Ge as DocFull, Ye as EmptyState, he as FilterChip, ge as FilterChips, xe as Hint, Se as Input, be as Label, $ as NavItem, je as Notice, Ve as Person, Fe as PersonDirectoryProvider, fe as RecordCard, pe as RecordCardGrid, Ke as RecordCardSkeleton, se as STATUSES, R as STATUS_META, Te as SearchInput, we as Select, at as Shell, X as Skeleton, ue as StatTile, Je as StatTileSkeleton, De as StatusChip, V as StatusGlyph, He as Stepper, me as Table, qe as TableSkeleton, _e as Tabs, Oe as Tag, Ce as Textarea, Qe as ToastProvider, ot as Toolbar, ve as ToolbarButton, ye as ToolbarToggle, ke as VersionChip, W as initialsOf, Y as lockBodyScroll, le as statusColor, ce as statusIcon, z as statusLabel, B as statusTriplet, G as tintOf, Pe as usePerson, nt as useTheme, Xe as useToast, Ze as useToastDismiss };
1521
+
1522
+ //# sourceMappingURL=indira-workspace-ui.mjs.map