@blakesteve/roster 5.6.0 → 5.7.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 (36) hide show
  1. package/README.md +106 -1
  2. package/dist/components/atoms/LoadingDots/LoadingDots.cjs +1 -0
  3. package/dist/components/atoms/LoadingDots/LoadingDots.d.ts +20 -0
  4. package/dist/components/atoms/LoadingDots/LoadingDots.js +43 -0
  5. package/dist/components/atoms/Progress/Progress.cjs +1 -0
  6. package/dist/components/atoms/Progress/Progress.d.ts +61 -0
  7. package/dist/components/atoms/Progress/Progress.js +106 -0
  8. package/dist/components/atoms/Progress/progress-values.cjs +1 -0
  9. package/dist/components/atoms/Progress/progress-values.d.ts +26 -0
  10. package/dist/components/atoms/Progress/progress-values.js +12 -0
  11. package/dist/components/atoms/Skeleton/Skeleton.cjs +1 -0
  12. package/dist/components/atoms/Skeleton/Skeleton.d.ts +79 -0
  13. package/dist/components/atoms/Skeleton/Skeleton.js +80 -0
  14. package/dist/components/atoms/Stat/Stat.cjs +1 -1
  15. package/dist/components/atoms/Stat/Stat.js +19 -19
  16. package/dist/components/atoms/Stat/stat-variants.cjs +1 -1
  17. package/dist/components/atoms/Stat/stat-variants.d.ts +1 -0
  18. package/dist/components/atoms/Stat/stat-variants.js +5 -4
  19. package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
  20. package/dist/components/molecules/FileUpload/FileUpload.js +120 -141
  21. package/dist/components/molecules/ProgressField/ProgressField.cjs +1 -0
  22. package/dist/components/molecules/ProgressField/ProgressField.d.ts +23 -0
  23. package/dist/components/molecules/ProgressField/ProgressField.js +32 -0
  24. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -0
  25. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +55 -0
  26. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +45 -0
  27. package/dist/components/molecules/StepProgress/StepProgress.cjs +1 -0
  28. package/dist/components/molecules/StepProgress/StepProgress.d.ts +36 -0
  29. package/dist/components/molecules/StepProgress/StepProgress.js +89 -0
  30. package/dist/components/organisms/Dialog/Dialog.d.ts +1 -1
  31. package/dist/index.d.ts +6 -0
  32. package/dist/meta.json +3 -3
  33. package/dist/roster.cjs +1 -1
  34. package/dist/roster.css +1 -1
  35. package/dist/roster.js +174 -157
  36. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
1
  "use client";
2
- import { jsxs as g, jsx as n } from "react/jsx-runtime";
3
- import { useId as vr, useState as L, useRef as p, useCallback as U, useLayoutEffect as Y, useEffect as xr } from "react";
4
- import { cn as f } from "../../../lib/utils.js";
2
+ import { jsxs as p, jsx as n } from "react/jsx-runtime";
3
+ import { useId as vr, useState as L, useRef as f, useCallback as U, useLayoutEffect as Y, useEffect as xr } from "react";
4
+ import { cn as g } from "../../../lib/utils.js";
5
5
  import { Button as G } from "../../atoms/Button/Button.js";
6
- import { formatBytes as Z, acceptList as yr, sameFile as br, matchesType as kr } from "./file-rules.js";
7
- const Nr = {
6
+ import { Progress as yr } from "../../atoms/Progress/Progress.js";
7
+ import { formatBytes as Z, acceptList as br, sameFile as kr, matchesType as Nr } from "./file-rules.js";
8
+ const wr = {
8
9
  choose: "Choose photos",
9
10
  dropHint: "or drag them here",
10
11
  dropHere: "Drop to add them",
@@ -28,7 +29,7 @@ const Nr = {
28
29
  rejectedNotice: (s, d) => `${s} wasn't added. ${d}`,
29
30
  removed: (s) => `${s} removed.`
30
31
  };
31
- function wr({ file: s, status: d }) {
32
+ function $r({ file: s, status: d }) {
32
33
  const [T, D] = L(!1), B = !T && (s.type.startsWith("image/") || /\.(jpe?g|png|gif|webp|avif|heic|heif)$/i.test(s.name)), $ = U(
33
34
  (q) => {
34
35
  if (!q) return;
@@ -43,16 +44,16 @@ function wr({ file: s, status: d }) {
43
44
  ref: $,
44
45
  alt: "",
45
46
  onError: () => D(!0),
46
- className: f(v, "rst:object-cover", d === "rejected" && "rst:opacity-50"),
47
+ className: g(v, "rst:object-cover", d === "rejected" && "rst:opacity-50"),
47
48
  "data-file-thumb": "image"
48
49
  }
49
50
  ) : /* @__PURE__ */ n(
50
51
  "span",
51
52
  {
52
53
  "aria-hidden": "true",
53
- className: f(v, "rst:flex rst:items-center rst:justify-center rst:text-gray-500 rst:dark:text-gray-400"),
54
+ className: g(v, "rst:flex rst:items-center rst:justify-center rst:text-gray-500 rst:dark:text-gray-400"),
54
55
  "data-file-thumb": "placeholder",
55
- children: /* @__PURE__ */ g("svg", { viewBox: "0 0 24 24", width: "24", height: "24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
56
+ children: /* @__PURE__ */ p("svg", { viewBox: "0 0 24 24", width: "24", height: "24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
56
57
  /* @__PURE__ */ n("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
57
58
  /* @__PURE__ */ n("circle", { cx: "9", cy: "10", r: "1.6" }),
58
59
  /* @__PURE__ */ n("path", { d: "m21 15-4.2-4.2a1.6 1.6 0 0 0-2.3 0L7 18" })
@@ -61,7 +62,7 @@ function wr({ file: s, status: d }) {
61
62
  );
62
63
  }
63
64
  const V = "rst:cursor-not-allowed rst:opacity-50", I = { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" };
64
- function Dr({
65
+ function Rr({
65
66
  label: s,
66
67
  upload: d,
67
68
  onChange: T,
@@ -73,72 +74,72 @@ function Dr({
73
74
  concurrency: j = 3,
74
75
  helperText: S,
75
76
  errorMessage: R,
76
- disabled: c = !1,
77
+ disabled: i = !1,
77
78
  strings: rr,
78
79
  className: tr
79
80
  }) {
80
- const o = { ...Nr, ...rr }, C = vr(), F = `${C}-label`, X = `${C}-help`, _ = `${C}-error`, [z, er] = L([]), l = p(z), sr = p(0), x = p(/* @__PURE__ */ new Map()), O = p(null), J = p(null), h = p({ upload: d, onChange: T, concurrency: j, t: o, pump: () => {
81
- } }), [A, nr] = L({ text: "", n: 0 }), y = p([]), b = p(null), M = U((r, e = !1) => {
81
+ const a = { ...wr, ...rr }, C = vr(), z = `${C}-label`, _ = `${C}-help`, J = `${C}-error`, [F, er] = L([]), u = f(F), sr = f(0), x = f(/* @__PURE__ */ new Map()), O = f(null), K = f(null), h = f({ upload: d, onChange: T, concurrency: j, t: a, pump: () => {
82
+ } }), [A, nr] = L({ text: "", n: 0 }), y = f([]), b = f(null), M = U((r, e = !1) => {
82
83
  e && (y.current = y.current.filter((t) => !t.count)), y.current.push({ text: r, count: e }), !b.current && (b.current = setTimeout(() => {
83
84
  b.current = null;
84
- const t = y.current.map((i) => i.text).join(" ");
85
- y.current = [], nr((i) => ({ text: t, n: i.n + 1 }));
85
+ const t = y.current.map((c) => c.text).join(" ");
86
+ y.current = [], nr((c) => ({ text: t, n: c.n + 1 }));
86
87
  }, 0));
87
- }, []), H = p(null), [ar, or] = L(0), K = (r) => {
88
- H.current = r, or((e) => e + 1);
88
+ }, []), H = f(null), [or, ar] = L(0), Q = (r) => {
89
+ H.current = r, ar((e) => e + 1);
89
90
  };
90
91
  Y(() => {
91
92
  const r = H.current;
92
93
  if (!r) return;
93
94
  H.current = null, (O.current?.querySelector(r) ?? O.current?.querySelector("[data-file-choose]"))?.focus();
94
- }, [ar]);
95
+ }, [or]);
95
96
  const k = U((r) => {
96
- l.current = r, er(r), h.current.onChange?.(r);
97
+ u.current = r, er(r), h.current.onChange?.(r);
97
98
  }, []), N = U(
98
99
  (r, e) => {
99
- l.current.some((t) => t.id === r) && k(l.current.map((t) => t.id === r ? { ...t, ...e } : t));
100
+ u.current.some((t) => t.id === r) && k(u.current.map((t) => t.id === r ? { ...t, ...e } : t));
100
101
  },
101
102
  [k]
102
103
  );
103
104
  function w() {
104
- const { concurrency: r } = h.current, e = l.current.filter((i) => i.status === "uploading" || i.status === "processing").length, t = l.current.filter((i) => i.status === "queued").slice(0, Math.max(0, Math.max(1, r) - e));
105
- for (const i of t) ir(i);
105
+ const { concurrency: r } = h.current, e = u.current.filter((c) => c.status === "uploading" || c.status === "processing").length, t = u.current.filter((c) => c.status === "queued").slice(0, Math.max(0, Math.max(1, r) - e));
106
+ for (const c of t) cr(c);
106
107
  }
107
- function ir(r) {
108
+ function cr(r) {
108
109
  const e = new AbortController();
109
110
  x.current.set(r.id, e), N(r.id, { status: "uploading", progress: null, reason: void 0 });
110
- const t = () => !e.signal.aborted && x.current.get(r.id) === e, i = {
111
- onProgress: (a) => {
111
+ const t = () => !e.signal.aborted && x.current.get(r.id) === e, c = {
112
+ onProgress: (o) => {
112
113
  if (!t()) return;
113
- const u = Math.round(Math.min(1, Math.max(0, Number.isFinite(a) ? a : 0)) * 100) / 100, m = l.current.find((mr) => mr.id === r.id);
114
- m?.status === "uploading" && m.progress !== u && N(r.id, { progress: u });
114
+ const l = Math.round(Math.min(1, Math.max(0, Number.isFinite(o) ? o : 0)) * 100) / 100, m = u.current.find((mr) => mr.id === r.id);
115
+ m?.status === "uploading" && m.progress !== l && N(r.id, { progress: l });
115
116
  },
116
117
  onProcessing: () => {
117
118
  t() && N(r.id, { status: "processing" });
118
119
  },
119
120
  signal: e.signal
120
121
  };
121
- new Promise((a) => a(h.current.upload(r.file, i))).then(
122
- (a) => {
122
+ new Promise((o) => o(h.current.upload(r.file, c))).then(
123
+ (o) => {
123
124
  if (!t()) return;
124
- x.current.delete(r.id), N(r.id, { status: "done", progress: 1, result: a });
125
- const u = l.current.filter((m) => m.status !== "rejected");
126
- M(h.current.t.progress(u.filter((m) => m.status === "done").length, u.length), !0), w();
125
+ x.current.delete(r.id), N(r.id, { status: "done", progress: 1, result: o });
126
+ const l = u.current.filter((m) => m.status !== "rejected");
127
+ M(h.current.t.progress(l.filter((m) => m.status === "done").length, l.length), !0), w();
127
128
  },
128
- (a) => {
129
+ (o) => {
129
130
  if (!t()) return;
130
131
  x.current.delete(r.id);
131
- const u = h.current.t.uploadError(a);
132
- N(r.id, { status: "failed", reason: u }), M(h.current.t.failedNotice(r.file.name, u)), w();
132
+ const l = h.current.t.uploadError(o);
133
+ N(r.id, { status: "failed", reason: l }), M(h.current.t.failedNotice(r.file.name, l)), w();
133
134
  }
134
135
  );
135
136
  }
136
137
  Y(() => {
137
- h.current = { upload: d, onChange: T, concurrency: j, t: o, pump: w };
138
+ h.current = { upload: d, onChange: T, concurrency: j, t: a, pump: w };
138
139
  }), xr(() => {
139
140
  const r = x.current;
140
- return l.current.some((t) => (t.status === "uploading" || t.status === "processing") && !r.has(t.id)) && (k(
141
- l.current.map(
141
+ return u.current.some((t) => (t.status === "uploading" || t.status === "processing") && !r.has(t.id)) && (k(
142
+ u.current.map(
142
143
  (t) => (t.status === "uploading" || t.status === "processing") && !r.has(t.id) ? { ...t, status: "queued", progress: null } : t
143
144
  )
144
145
  ), h.current.pump()), () => {
@@ -146,92 +147,92 @@ function Dr({
146
147
  r.clear(), b.current && clearTimeout(b.current), b.current = null, y.current = [];
147
148
  };
148
149
  }, [k]);
149
- const cr = B ?? yr(D), dr = (r, e) => {
150
- if (e.some((i) => br(i.file, r))) return o.duplicate(r);
150
+ const ir = B ?? br(D), dr = (r, e) => {
151
+ if (e.some((c) => kr(c.file, r))) return a.duplicate(r);
151
152
  const t = q?.(r);
152
153
  if (t) return t;
153
- if (!kr(r, cr)) return o.wrongType(r);
154
- if ($ !== void 0 && r.size > $) return o.tooLarge(r, $);
155
- if (v !== void 0 && e.length >= v) return o.tooMany(v);
156
- }, Q = (r) => {
157
- if (c || r.length === 0) return;
158
- const e = l.current.filter((a) => a.status !== "rejected"), t = [];
159
- for (const a of r) {
160
- const u = dr(a, [...e, ...t.filter((m) => m.status !== "rejected")]);
161
- t.push({ id: `${C}-file-${sr.current++}`, file: a, status: u ? "rejected" : "queued", progress: null, reason: u });
154
+ if (!Nr(r, ir)) return a.wrongType(r);
155
+ if ($ !== void 0 && r.size > $) return a.tooLarge(r, $);
156
+ if (v !== void 0 && e.length >= v) return a.tooMany(v);
157
+ }, X = (r) => {
158
+ if (i || r.length === 0) return;
159
+ const e = u.current.filter((o) => o.status !== "rejected"), t = [];
160
+ for (const o of r) {
161
+ const l = dr(o, [...e, ...t.filter((m) => m.status !== "rejected")]);
162
+ t.push({ id: `${C}-file-${sr.current++}`, file: o, status: l ? "rejected" : "queued", progress: null, reason: l });
162
163
  }
163
- k([...l.current, ...t]);
164
- const i = t.filter((a) => a.status === "queued").length;
165
- i && M(o.added(i));
166
- for (const a of t) a.reason && M(o.rejectedNotice(a.file.name, a.reason));
164
+ k([...u.current, ...t]);
165
+ const c = t.filter((o) => o.status === "queued").length;
166
+ c && M(a.added(c));
167
+ for (const o of t) o.reason && M(a.rejectedNotice(o.file.name, o.reason));
167
168
  w();
168
- }, lr = (r) => {
169
- if (c) return;
170
- const e = l.current, t = e.findIndex((a) => a.id === r);
169
+ }, ur = (r) => {
170
+ if (i) return;
171
+ const e = u.current, t = e.findIndex((o) => o.id === r);
171
172
  if (t < 0) return;
172
173
  x.current.get(r)?.abort(), x.current.delete(r);
173
- const i = e[t + 1] ?? e[t - 1];
174
- k(e.filter((a) => a.id !== r)), M(o.removed(e[t].file.name)), K(i ? `[data-file-remove="${i.id}"]` : "[data-file-choose]"), w();
175
- }, ur = (r) => {
176
- c || (N(r, { status: "queued", progress: null, reason: void 0 }), K(`[data-file-remove="${r}"]`), w());
177
- }, [fr, W] = L(0), E = (r) => Array.from(r.dataTransfer?.types ?? []).includes("Files"), pr = {
174
+ const c = e[t + 1] ?? e[t - 1];
175
+ k(e.filter((o) => o.id !== r)), M(a.removed(e[t].file.name)), Q(c ? `[data-file-remove="${c.id}"]` : "[data-file-choose]"), w();
176
+ }, lr = (r) => {
177
+ i || (N(r, { status: "queued", progress: null, reason: void 0 }), Q(`[data-file-remove="${r}"]`), w());
178
+ }, [fr, P] = L(0), E = (r) => Array.from(r.dataTransfer?.types ?? []).includes("Files"), pr = {
178
179
  onDragEnter: (r) => {
179
- E(r) && (r.preventDefault(), W((e) => e + 1));
180
+ E(r) && (r.preventDefault(), P((e) => e + 1));
180
181
  },
181
182
  onDragOver: (r) => {
182
- E(r) && (r.preventDefault(), r.dataTransfer.dropEffect = c ? "none" : "copy");
183
+ E(r) && (r.preventDefault(), r.dataTransfer.dropEffect = i ? "none" : "copy");
183
184
  },
184
185
  onDragLeave: (r) => {
185
- E(r) && W((e) => Math.max(0, e - 1));
186
+ E(r) && P((e) => Math.max(0, e - 1));
186
187
  },
187
188
  onDrop: (r) => {
188
- E(r) && (r.preventDefault(), W(0), Q(Array.from(r.dataTransfer.files)));
189
+ E(r) && (r.preventDefault(), P(0), X(Array.from(r.dataTransfer.files)));
189
190
  }
190
- }, P = fr > 0 && !c, gr = (r) => {
191
+ }, W = fr > 0 && !i, gr = (r) => {
191
192
  switch (r.status) {
192
193
  case "queued":
193
- return o.queued;
194
+ return a.queued;
194
195
  case "uploading":
195
- return o.uploading(r.progress === null ? null : Math.round(r.progress * 100));
196
+ return a.uploading(r.progress === null ? null : Math.round(r.progress * 100));
196
197
  case "processing":
197
- return o.processing;
198
+ return a.processing;
198
199
  case "done":
199
- return o.done;
200
+ return a.done;
200
201
  case "failed":
201
- return `${o.failed} ${r.reason ?? ""}`.trim();
202
+ return `${a.failed} ${r.reason ?? ""}`.trim();
202
203
  case "rejected":
203
- return `${o.rejected} ${r.reason ?? ""}`.trim();
204
+ return `${a.rejected} ${r.reason ?? ""}`.trim();
204
205
  }
205
- }, hr = [S ? X : null, R ? _ : null].filter(Boolean).join(" ") || void 0;
206
- return /* @__PURE__ */ g(
206
+ }, hr = [S ? _ : null, R ? J : null].filter(Boolean).join(" ") || void 0;
207
+ return /* @__PURE__ */ p(
207
208
  "div",
208
209
  {
209
210
  ref: O,
210
211
  role: "group",
211
- "aria-labelledby": F,
212
- className: f("rst:font-ui rst:w-full", tr),
212
+ "aria-labelledby": z,
213
+ className: g("rst:font-ui rst:w-full", tr),
213
214
  "data-file-upload": "",
214
215
  children: [
215
216
  /* @__PURE__ */ n(
216
217
  "p",
217
218
  {
218
- id: F,
219
- className: f(
219
+ id: z,
220
+ className: g(
220
221
  "rst:mb-1.5 rst:text-left rst:text-sm rst:font-medium rst:leading-none rst:text-[var(--roster-control-text)]",
221
- c && "rst:opacity-70"
222
+ i && "rst:opacity-70"
222
223
  ),
223
224
  children: s
224
225
  }
225
226
  ),
226
- /* @__PURE__ */ g(
227
+ /* @__PURE__ */ p(
227
228
  "div",
228
229
  {
229
230
  ...pr,
230
231
  "data-file-drop": "",
231
- "data-dragging": P ? "" : void 0,
232
- className: f(
232
+ "data-dragging": W ? "" : void 0,
233
+ className: g(
233
234
  "rst:flex rst:flex-col rst:items-center rst:justify-center rst:gap-2 rst:rounded-lg rst:border-2 rst:border-dashed rst:px-4 rst:py-6 rst:text-center rst:transition-colors rst:motion-reduce:transition-none",
234
- P ? "rst:border-primary-500 rst:bg-primary-500/10" : R ? "rst:border-error-500 rst:dark:border-error-400" : "rst:border-gray-300 rst:dark:border-gray-600"
235
+ W ? "rst:border-primary-500 rst:bg-primary-500/10" : R ? "rst:border-error-500 rst:dark:border-error-400" : "rst:border-gray-300 rst:dark:border-gray-600"
235
236
  ),
236
237
  children: [
237
238
  /* @__PURE__ */ n(
@@ -241,13 +242,13 @@ function Dr({
241
242
  variant: "outline",
242
243
  colorScheme: "neutral",
243
244
  size: "lg",
244
- className: f("rst:px-5", c && V),
245
- "aria-disabled": c || void 0,
245
+ className: g("rst:px-5", i && V),
246
+ "aria-disabled": i || void 0,
246
247
  "aria-describedby": hr,
247
- onClick: () => J.current?.click(),
248
+ onClick: () => K.current?.click(),
248
249
  "data-file-choose": "",
249
250
  startIcon: /* @__PURE__ */ n("svg", { ...I, "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M12 16V4M7 9l5-5 5 5M5 20h14" }) }),
250
- children: o.choose
251
+ children: a.choose
251
252
  }
252
253
  ),
253
254
  /* @__PURE__ */ n(
@@ -255,21 +256,21 @@ function Dr({
255
256
  {
256
257
  className: "rst:hidden rst:text-xs rst:text-gray-600 rst:pointer-fine:block rst:dark:text-gray-400",
257
258
  "data-file-drop-hint": "",
258
- children: P ? o.dropHere : o.dropHint
259
+ children: W ? a.dropHere : a.dropHint
259
260
  }
260
261
  ),
261
262
  /* @__PURE__ */ n(
262
263
  "input",
263
264
  {
264
- ref: J,
265
+ ref: K,
265
266
  type: "file",
266
267
  hidden: !0,
267
268
  tabIndex: -1,
268
269
  accept: D,
269
270
  multiple: v !== 1,
270
- disabled: c,
271
+ disabled: i,
271
272
  onChange: (r) => {
272
- Q(Array.from(r.currentTarget.files ?? [])), r.currentTarget.value = "";
273
+ X(Array.from(r.currentTarget.files ?? [])), r.currentTarget.value = "";
273
274
  },
274
275
  "data-file-input": ""
275
276
  }
@@ -277,69 +278,47 @@ function Dr({
277
278
  ]
278
279
  }
279
280
  ),
280
- S && /* @__PURE__ */ n("p", { id: X, className: "rst:mt-1.5 rst:text-left rst:text-xs rst:text-gray-500 rst:dark:text-gray-400", children: S }),
281
- R && /* @__PURE__ */ n("p", { id: _, className: "rst:mt-1.5 rst:text-left rst:text-xs rst:font-medium rst:text-error-600 rst:dark:text-error-400", children: R }),
282
- z.length > 0 && /* @__PURE__ */ n("ul", { className: "rst:mt-3 rst:flex rst:flex-col rst:gap-2", "aria-labelledby": F, children: z.map((r) => {
281
+ S && /* @__PURE__ */ n("p", { id: _, className: "rst:mt-1.5 rst:text-left rst:text-xs rst:text-gray-500 rst:dark:text-gray-400", children: S }),
282
+ R && /* @__PURE__ */ n("p", { id: J, className: "rst:mt-1.5 rst:text-left rst:text-xs rst:font-medium rst:text-error-600 rst:dark:text-error-400", children: R }),
283
+ F.length > 0 && /* @__PURE__ */ n("ul", { className: "rst:mt-3 rst:flex rst:flex-col rst:gap-2", "aria-labelledby": z, children: F.map((r) => {
283
284
  const e = r.status === "failed" || r.status === "rejected", t = r.status === "uploading" || r.status === "processing" || r.status === "queued";
284
- return /* @__PURE__ */ g(
285
+ return /* @__PURE__ */ p(
285
286
  "li",
286
287
  {
287
288
  "data-file-item": r.id,
288
289
  "data-status": r.status,
289
290
  className: "rst:flex rst:items-center rst:gap-3 rst:rounded-md rst:border rst:border-[var(--roster-card-border)] rst:p-2",
290
291
  children: [
291
- /* @__PURE__ */ n(wr, { file: r.file, status: r.status }),
292
- /* @__PURE__ */ g("div", { className: "rst:min-w-0 rst:flex-1 rst:text-left", children: [
292
+ /* @__PURE__ */ n($r, { file: r.file, status: r.status }),
293
+ /* @__PURE__ */ p("div", { className: "rst:min-w-0 rst:flex-1 rst:text-left", children: [
293
294
  /* @__PURE__ */ n("p", { className: "rst:truncate rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]", title: r.file.name, children: r.file.name }),
294
- /* @__PURE__ */ g(
295
+ /* @__PURE__ */ p(
295
296
  "p",
296
297
  {
297
- className: f(
298
+ className: g(
298
299
  "rst:mt-0.5 rst:flex rst:items-start rst:gap-1 rst:text-xs",
299
300
  e ? "rst:text-error-600 rst:dark:text-error-400" : "rst:text-gray-600 rst:dark:text-gray-400"
300
301
  ),
301
302
  "data-file-status": "",
302
303
  children: [
303
304
  r.status === "done" && /* @__PURE__ */ n("svg", { ...I, width: 14, height: 14, "aria-hidden": "true", className: "rst:mt-px rst:shrink-0 rst:text-success-600 rst:dark:text-success-400", children: /* @__PURE__ */ n("path", { d: "M20 6 9 17l-5-5" }) }),
304
- /* @__PURE__ */ g("span", { children: [
305
- /* @__PURE__ */ n("span", { className: "rst:tabular-nums", children: o.size(r.file.size) }),
305
+ /* @__PURE__ */ p("span", { children: [
306
+ /* @__PURE__ */ n("span", { className: "rst:tabular-nums", children: a.size(r.file.size) }),
306
307
  /* @__PURE__ */ n("span", { "aria-hidden": "true", children: " · " }),
307
308
  gr(r)
308
309
  ] })
309
310
  ]
310
311
  }
311
312
  ),
312
- t && /* @__PURE__ */ n(
313
- "div",
313
+ t && /* @__PURE__ */ n("div", { className: "rst:mt-1.5", "data-file-progress": "", children: /* @__PURE__ */ n(
314
+ yr,
314
315
  {
315
- role: "progressbar",
316
- "aria-label": r.file.name,
317
- "aria-valuemin": 0,
318
- "aria-valuemax": 100,
319
- "aria-valuenow": r.status === "uploading" && r.progress !== null ? Math.round(r.progress * 100) : void 0,
320
- className: f(
321
- "rst:mt-1.5 rst:h-1.5 rst:overflow-hidden rst:rounded-full rst:bg-gray-200 rst:dark:bg-gray-700",
322
- /* Under way with no figure yet: the track pulses and the
323
- fill waits at zero, so the first figure grows it
324
- rather than shrinking a full bar. */
325
- r.status === "uploading" && r.progress === null && "rst:animate-pulse rst:motion-reduce:animate-none"
326
- ),
327
- "data-file-progress": "",
328
- children: /* @__PURE__ */ n(
329
- "div",
330
- {
331
- className: f(
332
- "rst:h-full rst:origin-left rst:rounded-full rst:bg-primary-600 rst:transition-transform rst:motion-reduce:transition-none rst:dark:bg-primary-400",
333
- /* On the server: full, and pulsing, since there's no figure to give. */
334
- r.status === "processing" && "rst:animate-pulse rst:motion-reduce:animate-none"
335
- ),
336
- style: {
337
- transform: `scaleX(${r.status === "processing" ? 1 : r.status === "uploading" ? r.progress ?? 0 : 0})`
338
- }
339
- }
340
- )
316
+ size: "sm",
317
+ value: r.status === "processing" ? 100 : r.status === "uploading" ? (r.progress ?? 0) * 100 : 0,
318
+ busy: r.status === "processing" || r.status === "uploading" && r.progress === null,
319
+ announce: !1
341
320
  }
342
- )
321
+ ) })
343
322
  ] }),
344
323
  r.status === "failed" && /* @__PURE__ */ n(
345
324
  G,
@@ -348,12 +327,12 @@ function Dr({
348
327
  variant: "ghost",
349
328
  colorScheme: "neutral",
350
329
  size: "icon",
351
- className: f("rst:h-11 rst:w-11", c && V),
352
- "aria-disabled": c || void 0,
353
- "aria-label": o.retry(r.file.name),
354
- onClick: () => ur(r.id),
330
+ className: g("rst:h-11 rst:w-11", i && V),
331
+ "aria-disabled": i || void 0,
332
+ "aria-label": a.retry(r.file.name),
333
+ onClick: () => lr(r.id),
355
334
  "data-file-retry": r.id,
356
- children: /* @__PURE__ */ g("svg", { ...I, "aria-hidden": "true", children: [
335
+ children: /* @__PURE__ */ p("svg", { ...I, "aria-hidden": "true", children: [
357
336
  /* @__PURE__ */ n("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
358
337
  /* @__PURE__ */ n("path", { d: "M3 3v5h5" })
359
338
  ] })
@@ -366,10 +345,10 @@ function Dr({
366
345
  variant: "ghost",
367
346
  colorScheme: "neutral",
368
347
  size: "icon",
369
- className: f("rst:h-11 rst:w-11", c && V),
370
- "aria-disabled": c || void 0,
371
- "aria-label": o.remove(r.file.name),
372
- onClick: () => lr(r.id),
348
+ className: g("rst:h-11 rst:w-11", i && V),
349
+ "aria-disabled": i || void 0,
350
+ "aria-label": a.remove(r.file.name),
351
+ onClick: () => ur(r.id),
373
352
  "data-file-remove": r.id,
374
353
  children: /* @__PURE__ */ n("svg", { ...I, "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M18 6 6 18M6 6l12 12" }) })
375
354
  }
@@ -379,7 +358,7 @@ function Dr({
379
358
  r.id
380
359
  );
381
360
  }) }),
382
- /* @__PURE__ */ g(
361
+ /* @__PURE__ */ p(
383
362
  "div",
384
363
  {
385
364
  role: "status",
@@ -399,5 +378,5 @@ function Dr({
399
378
  );
400
379
  }
401
380
  export {
402
- Dr as FileUpload
381
+ Rr as FileUpload
403
382
  };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),f=require("../../../lib/utils.cjs"),j=require("../../atoms/Progress/Progress.cjs"),h=require("../../atoms/Progress/progress-values.cjs"),y=s=>`${s}%`,N=(s,r)=>`${s} of ${r}`;function w({label:s,valueText:r,detail:n,labels:e,className:c,...a}){const{value:u,max:d,variant:o="continuous",segments:l,announce:m=!0}=a,{known:g,percent:x,done:p,applicable:v}=h.progressValues({value:u,max:d,variant:o,segments:l}),i=r??(o==="segmented"?(e?.count??N)(p,v):g?(e?.percent??y)(x):void 0);return t.jsxs("div",{className:f.cn("rst:font-ui rst:w-full rst:min-w-0",c),"data-progress-field":"",children:[t.jsxs("div",{"aria-hidden":m?!0:void 0,className:"rst:mb-1.5 rst:flex rst:items-baseline rst:justify-between rst:gap-3 rst:text-sm",children:[t.jsx("span",{className:"rst:min-w-0 rst:truncate rst:font-medium rst:text-[var(--roster-control-text)]","data-progress-label":"",children:s}),i!==void 0&&t.jsx("span",{className:"rst:shrink-0 rst:tabular-nums rst:text-gray-600 rst:dark:text-gray-400","data-progress-value":"",children:i})]}),t.jsx(j.Progress,{...a,label:s,valueText:r,labels:e}),n!==void 0&&t.jsx("p",{className:"rst:mt-1.5 rst:text-xs rst:text-gray-600 rst:dark:text-gray-400","data-progress-detail":"",children:n})]})}exports.ProgressField=w;
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ import { ProgressLabels, ProgressProps } from '../../atoms/Progress/Progress';
3
+ export interface ProgressFieldProps extends Pick<ProgressProps, "value" | "max" | "variant" | "segments" | "status" | "size" | "rounded" | "busy" | "announce" | "announceEvery"> {
4
+ /** What's progressing: "Uploading photos". Shown, and said with the value. */
5
+ label: string;
6
+ /** The value as shown and said, in place of the percent or the count: "3 of 8 files". */
7
+ valueText?: string;
8
+ /** A line under the bar: bytes, a step counter, a time left. */
9
+ detail?: ReactNode;
10
+ labels?: Partial<ProgressLabels>;
11
+ className?: string;
12
+ }
13
+ /**
14
+ * A progress bar with its label and value above it and an optional detail
15
+ * line below: the form to reach for when showing progress. Label left and
16
+ * value right, on one baseline, so a column of them lines up down a page.
17
+ *
18
+ * A screen reader hears the label and value together, politely, as they
19
+ * change (no more than once every 1.5 seconds); the visible pair is hidden
20
+ * from it so it isn't read twice.
21
+ */
22
+ declare function ProgressField({ label, valueText, detail, labels, className, ...progress }: ProgressFieldProps): import("react/jsx-runtime").JSX.Element;
23
+ export { ProgressField };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsxs as c, jsx as s } from "react/jsx-runtime";
3
+ import { cn as h } from "../../../lib/utils.js";
4
+ import { Progress as N } from "../../atoms/Progress/Progress.js";
5
+ import { progressValues as w } from "../../atoms/Progress/progress-values.js";
6
+ const y = (t) => `${t}%`, k = (t, r) => `${t} of ${r}`;
7
+ function C({
8
+ label: t,
9
+ valueText: r,
10
+ detail: n,
11
+ labels: e,
12
+ className: m,
13
+ ...a
14
+ }) {
15
+ const { value: d, max: l, variant: o = "continuous", segments: u, announce: p = !0 } = a, { known: g, percent: x, done: f, applicable: v } = w({ value: d, max: l, variant: o, segments: u }), i = r ?? (o === "segmented" ? (e?.count ?? k)(f, v) : g ? (e?.percent ?? y)(x) : void 0);
16
+ return (
17
+ /* min-w-0: in a grid or flex column, a field otherwise refuses to be
18
+ narrower than its label on one line, and a long label pushes it out of
19
+ the column instead of truncating. */
20
+ /* @__PURE__ */ c("div", { className: h("rst:font-ui rst:w-full rst:min-w-0", m), "data-progress-field": "", children: [
21
+ /* @__PURE__ */ c("div", { "aria-hidden": p ? !0 : void 0, className: "rst:mb-1.5 rst:flex rst:items-baseline rst:justify-between rst:gap-3 rst:text-sm", children: [
22
+ /* @__PURE__ */ s("span", { className: "rst:min-w-0 rst:truncate rst:font-medium rst:text-[var(--roster-control-text)]", "data-progress-label": "", children: t }),
23
+ i !== void 0 && /* @__PURE__ */ s("span", { className: "rst:shrink-0 rst:tabular-nums rst:text-gray-600 rst:dark:text-gray-400", "data-progress-value": "", children: i })
24
+ ] }),
25
+ /* @__PURE__ */ s(N, { ...a, label: t, valueText: r, labels: e }),
26
+ n !== void 0 && /* @__PURE__ */ s("p", { className: "rst:mt-1.5 rst:text-xs rst:text-gray-600 rst:dark:text-gray-400", "data-progress-detail": "", children: n })
27
+ ] })
28
+ );
29
+ }
30
+ export {
31
+ C as ProgressField
32
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../lib/utils.cjs"),m=require("../../atoms/Card/Card.cjs"),j=require("../../atoms/Eyebrow/Eyebrow.cjs"),c=require("../../atoms/Stat/stat-variants.cjs"),h=require("../../organisms/Table/Table.cjs"),t=require("../../atoms/Skeleton/Skeleton.cjs");function k({media:r,lines:a=3,variant:s,padding:i,className:n}){return e.jsxs(m.Card,{variant:s,padding:i,className:n,"aria-hidden":"true","data-skeleton":"card",children:[r!==void 0&&e.jsx(t.Skeleton,{shape:"block",height:r,className:"rst:mb-4"}),e.jsx(t.Skeleton,{size:"lg",width:"45%"}),a>0&&e.jsx(t.Skeleton,{size:"md",lines:a,className:"rst:mt-2"})]})}function S({columns:r,className:a}){const s=["70%","50%","60%","40%"];return e.jsx(h.TableRow,{"aria-hidden":"true",className:a,"data-skeleton":"table-row",children:Array.from({length:Math.max(1,r)},(i,n)=>e.jsx(h.TableCell,{children:e.jsx(t.Skeleton,{size:"inherit",width:s[n%s.length]})},n))})}function w({size:r="md",withName:a=!1,className:s}){return a?e.jsxs("span",{"aria-hidden":"true",className:l.cn("rst:flex rst:items-center rst:gap-3",s),"data-skeleton":"avatar",children:[e.jsx(t.Skeleton,{shape:"circle",size:r}),e.jsx(t.Skeleton,{size:"md",width:"8rem"})]}):e.jsx(t.Skeleton,{shape:"circle",size:r,className:s})}function b({size:r="md",semantics:a="definition",source:s=!1,className:i}){const n=c.statValueVariants({size:r,colorScheme:"neutral"}),o=e.jsx(t.Skeleton,{size:"inherit",width:"2.5em"}),d=x=>e.jsx(j.Eyebrow,{size:"xs",children:e.jsx(t.Skeleton,{size:"inherit",width:"9em",className:x?"rst:inline-block rst:align-baseline":void 0})}),u=e.jsx("span",{className:c.statSourceClass,children:e.jsx(t.Skeleton,{size:"inherit",width:"12em"})});return a==="standalone"?e.jsxs("span",{"aria-hidden":"true",className:l.cn("rst:flex rst:flex-col rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("span",{className:n,children:o}),d(!1),s&&u]}):e.jsxs("div",{"aria-hidden":"true",className:l.cn("rst:grid rst:content-start rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("dt",{className:"rst:relative rst:col-start-1 rst:row-start-2",children:d(!0)}),s?e.jsxs("dd",{className:l.cn("rst:m-0",n,"rst:col-start-1 rst:row-span-3 rst:row-start-1 rst:grid rst:grid-rows-subgrid"),children:[e.jsx("span",{className:"rst:row-start-1",children:o}),e.jsx("span",{className:l.cn(c.statSourceClass,"rst:row-start-3"),children:e.jsx(t.Skeleton,{size:"inherit",width:"12em"})})]}):e.jsx("dd",{className:l.cn("rst:m-0 rst:col-start-1 rst:row-start-1",n),children:o})]})}exports.SkeletonAvatar=w;exports.SkeletonCard=k;exports.SkeletonStat=b;exports.SkeletonTableRow=S;
@@ -0,0 +1,55 @@
1
+ import { CSSProperties } from 'react';
2
+ import { CardProps } from '../../atoms/Card/Card';
3
+ export interface SkeletonCardProps extends Pick<CardProps, "variant" | "padding"> {
4
+ /** A media block above the text, at this height (an image, a chart). */
5
+ media?: CSSProperties["height"];
6
+ /** Body lines under the title. */
7
+ lines?: number;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * A Card loading. Stands in for a Card holding an optional media block (with
12
+ * 16px below it), a `text-base` title, and `text-sm` body lines 8px under it.
13
+ */
14
+ declare function SkeletonCard({ media, lines, variant, padding, className }: SkeletonCardProps): import("react/jsx-runtime").JSX.Element;
15
+ export interface SkeletonTableRowProps {
16
+ /** How many cells. */
17
+ columns: number;
18
+ className?: string;
19
+ }
20
+ /**
21
+ * A table row loading, inside Roster's Table: its own cells, at the table's
22
+ * size, each holding one line in the cell's text size. Stands in for a row of
23
+ * one-line cells.
24
+ */
25
+ declare function SkeletonTableRow({ columns, className }: SkeletonTableRowProps): import("react/jsx-runtime").JSX.Element;
26
+ export interface SkeletonAvatarProps {
27
+ /** Avatar's sizes. */
28
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
29
+ /** A name line beside it, in `text-sm`. */
30
+ withName?: boolean;
31
+ className?: string;
32
+ }
33
+ /** An Avatar loading, and optionally the name beside it. */
34
+ declare function SkeletonAvatar({ size, withName, className }: SkeletonAvatarProps): import("react/jsx-runtime").JSX.Element;
35
+ export interface SkeletonStatProps {
36
+ /** Stat's sizes. */
37
+ size?: "sm" | "md" | "lg";
38
+ /**
39
+ * Stat's two markups, mirrored. `definition` (Stat's default) is a `dt` and
40
+ * `dd` pair for a `<dl>`: put this preset in the same `<dl>`. `standalone`
41
+ * is spans.
42
+ */
43
+ semantics?: "definition" | "standalone";
44
+ /** A source line under the figure, as a Stat with `source` has. */
45
+ source?: boolean;
46
+ className?: string;
47
+ }
48
+ /**
49
+ * A Stat loading. Stat's own markup in each of its forms, with lines in place
50
+ * of its words, so the figure that arrives is the height of what held it:
51
+ * the label is the real Eyebrow, inline in a `dt` where Stat's is, so it
52
+ * takes the same line box.
53
+ */
54
+ declare function SkeletonStat({ size, semantics, source, className }: SkeletonStatProps): import("react/jsx-runtime").JSX.Element;
55
+ export { SkeletonCard, SkeletonTableRow, SkeletonAvatar, SkeletonStat };