@blakesteve/roster 5.5.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 (47) hide show
  1. package/README.md +183 -2
  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/Pagination/Pagination.cjs +1 -0
  22. package/dist/components/molecules/Pagination/Pagination.d.ts +116 -0
  23. package/dist/components/molecules/Pagination/Pagination.js +247 -0
  24. package/dist/components/molecules/Pagination/page-items.cjs +1 -0
  25. package/dist/components/molecules/Pagination/page-items.d.ts +13 -0
  26. package/dist/components/molecules/Pagination/page-items.js +11 -0
  27. package/dist/components/molecules/ProgressField/ProgressField.cjs +1 -0
  28. package/dist/components/molecules/ProgressField/ProgressField.d.ts +23 -0
  29. package/dist/components/molecules/ProgressField/ProgressField.js +32 -0
  30. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -0
  31. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +55 -0
  32. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +45 -0
  33. package/dist/components/molecules/StepProgress/StepProgress.cjs +1 -0
  34. package/dist/components/molecules/StepProgress/StepProgress.d.ts +36 -0
  35. package/dist/components/molecules/StepProgress/StepProgress.js +89 -0
  36. package/dist/components/organisms/DataTable/DataTable.cjs +1 -1
  37. package/dist/components/organisms/DataTable/DataTable.d.ts +8 -1
  38. package/dist/components/organisms/DataTable/DataTable.js +61 -98
  39. package/dist/components/organisms/Dialog/Dialog.d.ts +1 -1
  40. package/dist/index.d.ts +7 -0
  41. package/dist/meta.json +3 -3
  42. package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.cjs +1 -1
  43. package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.js +30 -50
  44. package/dist/roster.cjs +1 -1
  45. package/dist/roster.css +1 -1
  46. package/dist/roster.js +178 -159
  47. package/package.json +1 -1
@@ -0,0 +1,247 @@
1
+ "use client";
2
+ import { jsxs as u, Fragment as I, jsx as e } from "react/jsx-runtime";
3
+ import { useId as et, useState as X, useRef as rt, useMemo as st } from "react";
4
+ import { cn as x } from "../../../lib/utils.js";
5
+ import { Button as at } from "../../atoms/Button/Button.js";
6
+ import { buttonVariants as nt } from "../../atoms/Button/button-variants.js";
7
+ import { selectTriggerVariants as it } from "../../atoms/Select/select-variants.js";
8
+ import { clampPage as lt, pageItems as ot } from "./page-items.js";
9
+ const ct = {
10
+ nav: "Pagination",
11
+ page: (t) => `Page ${t}`,
12
+ number: (t) => String(t),
13
+ previous: "Previous",
14
+ next: "Next",
15
+ previousPage: (t) => t === null ? "Previous page" : `Previous page (${t})`,
16
+ nextPage: (t) => t === null ? "Next page" : `Next page (${t})`,
17
+ firstPage: (t) => t === null ? "First page" : `First page (${t})`,
18
+ lastPage: (t) => t === null ? "Last page" : `Last page (${t})`,
19
+ gap: "…",
20
+ picker: "Page",
21
+ of: (t) => `of ${t}`,
22
+ status: (t, i) => `Page ${t} of ${i}`
23
+ };
24
+ function dt({ href: t, className: i, children: c, onClick: o, ...p }) {
25
+ return /* @__PURE__ */ e(
26
+ "a",
27
+ {
28
+ href: t,
29
+ className: i,
30
+ onClick: o,
31
+ "aria-label": p["aria-label"],
32
+ "aria-current": p["aria-current"],
33
+ "aria-disabled": p["aria-disabled"],
34
+ children: c
35
+ }
36
+ );
37
+ }
38
+ const ut = "rst:h-11 rst:min-w-11 rst:px-2", pt = "rst:cursor-not-allowed rst:opacity-50", ft = "rst:forced-colors:border-2 rst:forced-colors:underline rst:forced-colors:decoration-2 rst:forced-colors:underline-offset-4", Y = { width: 18, height: 18, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0 }, j = ({ dir: t, double: i = !1 }) => /* @__PURE__ */ e("svg", { ...Y, className: "rst:shrink-0", children: t === "left" ? i ? /* @__PURE__ */ e("path", { d: "m11 17-5-5 5-5M18 17l-5-5 5-5" }) : /* @__PURE__ */ e("path", { d: "m15 18-6-6 6-6" }) : i ? /* @__PURE__ */ e("path", { d: "m13 17 5-5-5-5M6 17l5-5-5-5" }) : /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" }) });
39
+ function mt({
40
+ id: t,
41
+ describedBy: i,
42
+ page: c,
43
+ pageCount: o,
44
+ number: p,
45
+ onCommit: P
46
+ }) {
47
+ const [d, N] = X(null), f = rt(!1), v = d && d.page === c ? d.value : null, y = (l) => {
48
+ N(null), l !== c && P(l);
49
+ }, $ = st(
50
+ () => Array.from({ length: o }, (l, m) => /* @__PURE__ */ e("option", { value: m + 1, children: p(m + 1) }, m + 1)),
51
+ [o, p]
52
+ );
53
+ return /* @__PURE__ */ e(
54
+ "select",
55
+ {
56
+ id: t,
57
+ value: v ?? c,
58
+ "aria-describedby": i,
59
+ disabled: o < 1,
60
+ onKeyDown: (l) => {
61
+ if (l.key === "Enter") {
62
+ v !== null && (l.preventDefault(), y(v));
63
+ return;
64
+ }
65
+ if (l.key === "Escape") {
66
+ N(null);
67
+ return;
68
+ }
69
+ f.current = !0, setTimeout(() => {
70
+ f.current = !1;
71
+ }, 0);
72
+ },
73
+ onChange: (l) => {
74
+ const m = Number(l.currentTarget.value);
75
+ f.current ? N({ page: c, value: m }) : y(m);
76
+ },
77
+ onBlur: () => {
78
+ v !== null && y(v);
79
+ },
80
+ className: x(
81
+ it({ variant: "outline" }),
82
+ /* 16px: iOS zooms the page into a select whose text is smaller. */
83
+ "rst:h-11 rst:w-auto rst:min-w-16 rst:appearance-none rst:pl-3 rst:pr-8 rst:text-base rst:tabular-nums"
84
+ ),
85
+ "data-pagination-picker": "",
86
+ children: $
87
+ }
88
+ );
89
+ }
90
+ function kt({
91
+ page: t,
92
+ pageCount: i,
93
+ onPageChange: c,
94
+ getPageHref: o,
95
+ linkComponent: p,
96
+ navigate: P,
97
+ layout: d = "auto",
98
+ siblings: N = 1,
99
+ edges: f = !0,
100
+ align: v = "center",
101
+ variant: y = "ghost",
102
+ announce: $ = !0,
103
+ labels: l,
104
+ className: m
105
+ }) {
106
+ const a = { ...ct, ...l }, h = Number.isFinite(i) ? Math.max(0, Math.floor(i)) : 0, n = lt(t, h), S = et(), Z = p ?? dt, [T, H] = X({ page: n, text: "" });
107
+ T.page !== n && H({ page: n, text: $ ? a.status(n, h) : "" });
108
+ const D = (r) => {
109
+ r !== Math.floor(t) && c?.(r);
110
+ }, w = (r, s, k, F) => {
111
+ const g = r === "page" && s === n, L = s === null, q = x(ut, L && pt, g && ft, F.className), J = r === "page" ? `page-${s}` : r;
112
+ if (o) {
113
+ const Q = o(s ?? n);
114
+ return /* @__PURE__ */ e(
115
+ Z,
116
+ {
117
+ href: Q,
118
+ to: Q,
119
+ className: x(nt({ variant: g ? "solid" : y, colorScheme: g ? "primary" : "neutral" }), q),
120
+ "aria-label": F.label,
121
+ "aria-current": g ? "page" : void 0,
122
+ "aria-disabled": L ? !0 : void 0,
123
+ onClick: (b) => {
124
+ if (L) {
125
+ b.preventDefault();
126
+ return;
127
+ }
128
+ !b.defaultPrevented && b.button === 0 && !b.metaKey && !b.ctrlKey && !b.shiftKey && !b.altKey && s !== null && D(s);
129
+ },
130
+ children: k
131
+ },
132
+ J
133
+ );
134
+ }
135
+ return /* @__PURE__ */ e(
136
+ at,
137
+ {
138
+ type: "button",
139
+ variant: g ? "solid" : y,
140
+ colorScheme: g ? "primary" : "neutral",
141
+ className: q,
142
+ "aria-label": F.label,
143
+ "aria-current": g ? "page" : void 0,
144
+ "aria-disabled": L || void 0,
145
+ onClick: () => {
146
+ s !== null && D(s);
147
+ },
148
+ children: k
149
+ },
150
+ J
151
+ );
152
+ }, B = n > 1 ? n - 1 : null, K = n < h ? n + 1 : null, R = n > 1 ? 1 : null, O = n < h ? h : null, M = (r) => w(
153
+ "previous",
154
+ B,
155
+ /* @__PURE__ */ u(I, { children: [
156
+ /* @__PURE__ */ e(j, { dir: "left" }),
157
+ r && /* @__PURE__ */ e("span", { className: "rst:hidden rst:pr-1 rst:@[36rem]:inline", children: a.previous })
158
+ ] }),
159
+ { label: a.previousPage(B) }
160
+ ), A = (r) => w(
161
+ "next",
162
+ K,
163
+ /* @__PURE__ */ u(I, { children: [
164
+ r && /* @__PURE__ */ e("span", { className: "rst:hidden rst:pl-1 rst:@[36rem]:inline", children: a.next }),
165
+ /* @__PURE__ */ e(j, { dir: "right" })
166
+ ] }),
167
+ { label: a.nextPage(K) }
168
+ ), V = (r) => w("first", R, /* @__PURE__ */ e(j, { dir: "left", double: !0 }), {
169
+ label: a.firstPage(R),
170
+ className: r ? "rst:hidden rst:@[24rem]:inline-flex" : void 0
171
+ }), _ = (r) => w("last", O, /* @__PURE__ */ e(j, { dir: "right", double: !0 }), {
172
+ label: a.lastPage(O),
173
+ className: r ? "rst:hidden rst:@[24rem]:inline-flex" : void 0
174
+ }), C = "rst:flex rst:flex-wrap rst:items-center rst:gap-1", E = { start: "rst:justify-start", center: "rst:justify-center", end: "rst:justify-end" }[v], z = (r) => /* @__PURE__ */ u("div", { className: x(C, E, r), "data-pagination-layout": "pages", children: [
175
+ M(!0),
176
+ ot(n, h, N).map(
177
+ (s) => typeof s == "number" ? w("page", s, a.number(s), { label: a.page(s) }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "rst:inline-flex rst:h-11 rst:w-11 rst:items-center rst:justify-center rst:text-sm rst:text-gray-500 rst:dark:text-gray-400", children: a.gap }, s)
178
+ ),
179
+ A(!0)
180
+ ] }), G = `${S}-picker`, U = `${S}-of`, W = (r) => /* @__PURE__ */ u("div", { className: x(C, E, r), "data-pagination-layout": "compact", children: [
181
+ f && V(!0),
182
+ M(!1),
183
+ /* @__PURE__ */ u("div", { className: "rst:flex rst:items-center rst:gap-2 rst:px-1 rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]", children: [
184
+ /* @__PURE__ */ e("label", { htmlFor: G, children: a.picker }),
185
+ /* @__PURE__ */ u("span", { className: "rst:relative rst:inline-flex", children: [
186
+ /* @__PURE__ */ e(
187
+ mt,
188
+ {
189
+ id: G,
190
+ describedBy: U,
191
+ page: n,
192
+ pageCount: h,
193
+ number: a.number,
194
+ onCommit: (s) => {
195
+ if (o) {
196
+ c?.(s);
197
+ const k = o(s);
198
+ P ? P(k) : window.location.assign(k);
199
+ } else D(s);
200
+ }
201
+ }
202
+ ),
203
+ /* @__PURE__ */ e("svg", { ...Y, width: 16, height: 16, className: "rst:pointer-events-none rst:absolute rst:right-2.5 rst:top-1/2 rst:-translate-y-1/2 rst:text-gray-500 rst:dark:text-gray-400", children: /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" }) })
204
+ ] }),
205
+ /* @__PURE__ */ e("span", { id: U, className: "rst:tabular-nums", children: a.of(h) })
206
+ ] }),
207
+ A(!1),
208
+ f && _(!0)
209
+ ] }), tt = /* @__PURE__ */ u("div", { className: x(C, E), "data-pagination-layout": "arrows", children: [
210
+ f && V(!1),
211
+ M(!1),
212
+ A(!1),
213
+ f && _(!1)
214
+ ] });
215
+ return (
216
+ /* A query container sizes itself as if it were empty across, so it takes
217
+ the full width it's given; in a slot that sizes to its content (an
218
+ `ml-auto` box, an `auto` grid column) it would be 0 wide. There it
219
+ falls back to 18rem, which is the compact form. The arrows need no
220
+ queries, and size to fit, to sit in a row beside something else. */
221
+ /* @__PURE__ */ u(
222
+ "nav",
223
+ {
224
+ "aria-label": a.nav,
225
+ className: x(
226
+ "rst:font-ui",
227
+ d === "arrows" ? "rst:w-fit" : "rst:@container rst:w-full rst:[contain-intrinsic-inline-size:18rem]",
228
+ m
229
+ ),
230
+ "data-pagination": "",
231
+ children: [
232
+ d === "pages" && z(),
233
+ d === "compact" && W(),
234
+ d === "arrows" && tt,
235
+ d === "auto" && /* @__PURE__ */ u(I, { children: [
236
+ z("rst:hidden rst:@[28rem]:flex"),
237
+ W("rst:@[28rem]:hidden")
238
+ ] }),
239
+ $ && /* @__PURE__ */ e("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", className: "rst:sr-only", "data-pagination-live": "", children: T.text })
240
+ ]
241
+ }
242
+ )
243
+ );
244
+ }
245
+ export {
246
+ kt as Pagination
247
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(e,a,s=1){const t=Number.isFinite(a)?Math.max(0,Math.floor(a)):0,n=Number.isFinite(s)?Math.max(0,Math.floor(s)):1,c=g(e,t),o=2*n+5,r=(h,u)=>Array.from({length:u-h+1},(d,f)=>h+f);if(t<=o)return r(1,t);const i=Math.max(c-n,1),m=Math.min(c+n,t),M=i>3,l=m<t-2;return M?l?[1,"gap-start",...r(i,m),"gap-end",t]:[1,"gap-start",...r(t-(o-3),t)]:[...r(1,o-2),"gap-end",t]}const g=(e,a)=>Math.min(Math.max(1,Math.floor(e)||1),Math.max(1,Number.isFinite(a)?Math.floor(a):1));exports.clampPage=g;exports.pageItems=p;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Which page numbers a numbered pager shows, and where it skips.
3
+ *
4
+ * Always the same number of slots once there are more pages than fit: the
5
+ * first page, the last, the current one with `siblings` on each side, and a
6
+ * gap marker on each side, which becomes a page number itself near either
7
+ * end. A pager whose width doesn't change as you page through is one whose
8
+ * buttons don't move out from under the pointer.
9
+ */
10
+ export type PageItem = number | "gap-start" | "gap-end";
11
+ export declare function pageItems(page: number, pageCount: number, siblings?: number): PageItem[];
12
+ /** `page` brought into 1 to `pageCount`. */
13
+ export declare const clampPage: (page: number, pageCount: number) => number;
@@ -0,0 +1,11 @@
1
+ function x(r, a, s = 1) {
2
+ const t = Number.isFinite(a) ? Math.max(0, Math.floor(a)) : 0, o = Number.isFinite(s) ? Math.max(0, Math.floor(s)) : 1, c = l(r, t), e = 2 * o + 5, n = (m, g) => Array.from({ length: g - m + 1 }, (p, u) => m + u);
3
+ if (t <= e) return n(1, t);
4
+ const i = Math.max(c - o, 1), h = Math.min(c + o, t), M = i > 3, f = h < t - 2;
5
+ return M ? f ? [1, "gap-start", ...n(i, h), "gap-end", t] : [1, "gap-start", ...n(t - (e - 3), t)] : [...n(1, e - 2), "gap-end", t];
6
+ }
7
+ const l = (r, a) => Math.min(Math.max(1, Math.floor(r) || 1), Math.max(1, Number.isFinite(a) ? Math.floor(a) : 1));
8
+ export {
9
+ l as clampPage,
10
+ x as pageItems
11
+ };
@@ -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 };
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { jsx as t, jsxs as o } from "react/jsx-runtime";
3
+ import { cn as n } from "../../../lib/utils.js";
4
+ import { Card as u } from "../../atoms/Card/Card.js";
5
+ import { Eyebrow as f } from "../../atoms/Eyebrow/Eyebrow.js";
6
+ import { statValueVariants as w, statSourceClass as h } from "../../atoms/Stat/stat-variants.js";
7
+ import { TableRow as g, TableCell as k } from "../../organisms/Table/Table.js";
8
+ import { Skeleton as r } from "../../atoms/Skeleton/Skeleton.js";
9
+ function T({ media: s, lines: a = 3, variant: e, padding: l, className: i }) {
10
+ return /* @__PURE__ */ o(u, { variant: e, padding: l, className: i, "aria-hidden": "true", "data-skeleton": "card", children: [
11
+ s !== void 0 && /* @__PURE__ */ t(r, { shape: "block", height: s, className: "rst:mb-4" }),
12
+ /* @__PURE__ */ t(r, { size: "lg", width: "45%" }),
13
+ a > 0 && /* @__PURE__ */ t(r, { size: "md", lines: a, className: "rst:mt-2" })
14
+ ] });
15
+ }
16
+ function j({ columns: s, className: a }) {
17
+ const e = ["70%", "50%", "60%", "40%"];
18
+ return /* @__PURE__ */ t(g, { "aria-hidden": "true", className: a, "data-skeleton": "table-row", children: Array.from({ length: Math.max(1, s) }, (l, i) => /* @__PURE__ */ t(k, { children: /* @__PURE__ */ t(r, { size: "inherit", width: e[i % e.length] }) }, i)) });
19
+ }
20
+ function y({ size: s = "md", withName: a = !1, className: e }) {
21
+ return a ? /* @__PURE__ */ o("span", { "aria-hidden": "true", className: n("rst:flex rst:items-center rst:gap-3", e), "data-skeleton": "avatar", children: [
22
+ /* @__PURE__ */ t(r, { shape: "circle", size: s }),
23
+ /* @__PURE__ */ t(r, { size: "md", width: "8rem" })
24
+ ] }) : /* @__PURE__ */ t(r, { shape: "circle", size: s, className: e });
25
+ }
26
+ function A({ size: s = "md", semantics: a = "definition", source: e = !1, className: l }) {
27
+ const i = w({ size: s, colorScheme: "neutral" }), d = /* @__PURE__ */ t(r, { size: "inherit", width: "2.5em" }), c = (p) => /* @__PURE__ */ t(f, { size: "xs", children: /* @__PURE__ */ t(r, { size: "inherit", width: "9em", className: p ? "rst:inline-block rst:align-baseline" : void 0 }) }), m = /* @__PURE__ */ t("span", { className: h, children: /* @__PURE__ */ t(r, { size: "inherit", width: "12em" }) });
28
+ return a === "standalone" ? /* @__PURE__ */ o("span", { "aria-hidden": "true", className: n("rst:flex rst:flex-col rst:gap-[3px]", l), "data-skeleton": "stat", children: [
29
+ /* @__PURE__ */ t("span", { className: i, children: d }),
30
+ c(!1),
31
+ e && m
32
+ ] }) : /* @__PURE__ */ o("div", { "aria-hidden": "true", className: n("rst:grid rst:content-start rst:gap-[3px]", l), "data-skeleton": "stat", children: [
33
+ /* @__PURE__ */ t("dt", { className: "rst:relative rst:col-start-1 rst:row-start-2", children: c(!0) }),
34
+ e ? /* @__PURE__ */ o("dd", { className: n("rst:m-0", i, "rst:col-start-1 rst:row-span-3 rst:row-start-1 rst:grid rst:grid-rows-subgrid"), children: [
35
+ /* @__PURE__ */ t("span", { className: "rst:row-start-1", children: d }),
36
+ /* @__PURE__ */ t("span", { className: n(h, "rst:row-start-3"), children: /* @__PURE__ */ t(r, { size: "inherit", width: "12em" }) })
37
+ ] }) : /* @__PURE__ */ t("dd", { className: n("rst:m-0 rst:col-start-1 rst:row-start-1", i), children: d })
38
+ ] });
39
+ }
40
+ export {
41
+ y as SkeletonAvatar,
42
+ T as SkeletonCard,
43
+ A as SkeletonStat,
44
+ j as SkeletonTableRow
45
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),l=require("../../../lib/utils.cjs"),h=require("../../atoms/Progress/Progress.cjs"),b={nav:"Progress",position:(s,c)=>`Step ${s} of ${c}`,done:"done",number:s=>String(s)},y=()=>r.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M20 6 9 17l-5-5"})});function j({steps:s,current:c,variant:g="stepper",labels:f,className:p}){const o={...b,...f},n=s.length;if(n===0)return null;const t=Math.min(Math.max(1,Math.floor(Number.isFinite(c)?c:1)),n+1),d=t>n,u=d?o.position(n,n):o.position(t,n),x=d?u:`${u}: ${s[t-1]}`;return g==="segmented"?r.jsxs("div",{className:l.cn("rst:font-ui rst:w-full rst:min-w-0",p),"data-step-progress":"segmented",children:[r.jsxs("div",{className:"rst:mb-1.5 rst:flex rst:items-baseline rst:justify-between rst:gap-3 rst:text-sm","aria-hidden":"true",children:[r.jsx("span",{className:"rst:font-medium rst:text-[var(--roster-control-text)]","data-step-position":"",children:u}),!d&&r.jsx("span",{className:"rst:min-w-0 rst:truncate rst:text-gray-600 rst:dark:text-gray-400","data-step-name":"",children:s[t-1]})]}),r.jsx(h.Progress,{variant:"segmented",segments:s.map((m,i)=>i+1<t?"done":i+1===t?"current":"remaining"),announce:!1}),r.jsx("span",{role:"status",className:"rst:sr-only","data-step-status":"",children:x})]}):r.jsxs("div",{className:l.cn("rst:font-ui rst:w-full",p),"data-step-progress":"stepper",children:[r.jsx("ol",{"aria-label":o.nav,className:"rst:m-0 rst:flex rst:w-full rst:list-none rst:p-0",children:s.map((m,i)=>{const a=i+1,e=a<t?"done":a===t?"current":"upcoming";return r.jsxs("li",{"aria-current":e==="current"?"step":void 0,className:"rst:relative rst:flex rst:min-w-0 rst:flex-1 rst:flex-col rst:items-center rst:gap-1.5 rst:text-center","data-step":e,children:[i>0&&r.jsx("span",{"aria-hidden":"true",className:l.cn("rst:absolute rst:right-1/2 rst:top-4 rst:h-0.5 rst:w-full rst:-translate-y-1/2",a<=t?"rst:bg-primary-600 rst:dark:bg-primary-400 rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight]":"rst:bg-[var(--roster-skeleton)] rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[GrayText]"),"data-step-connector":a<=t?"filled":"empty"}),r.jsx("span",{"aria-hidden":"true",className:l.cn("rst:relative rst:z-10 rst:flex rst:h-8 rst:w-8 rst:items-center rst:justify-center rst:rounded-full rst:text-sm rst:font-semibold rst:tabular-nums",e==="done"&&"rst:bg-primary-600 rst:text-primary-600-ink rst:dark:bg-primary-400 rst:dark:text-gray-950 rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight] rst:forced-colors:text-[HighlightText]",e==="current"&&"rst:border-2 rst:border-primary-600 rst:bg-[var(--roster-card-bg)] rst:text-primary-600 rst:dark:border-primary-400 rst:dark:text-primary-400",e==="upcoming"&&"rst:bg-[var(--roster-skeleton)] rst:text-gray-600 rst:dark:text-gray-300 rst:forced-colors:border"),"data-step-marker":"",children:e==="done"?r.jsx(y,{}):o.number(a)}),r.jsxs("span",{className:l.cn("rst:w-full rst:px-1 rst:text-xs rst:leading-4 rst:break-words",e==="current"?"rst:font-semibold rst:text-[var(--roster-control-text)]":"rst:text-gray-600 rst:dark:text-gray-400"),children:[m,e==="done"&&r.jsx("span",{className:"rst:sr-only",children:`, ${o.done}`})]})]},`${a}-${m}`)})}),r.jsx("span",{role:"status",className:"rst:sr-only","data-step-status":"",children:x})]})}exports.StepProgress=j;
@@ -0,0 +1,36 @@
1
+ /** Every word StepProgress shows or says. Pass any of them in `labels` to replace it. */
2
+ export interface StepProgressLabels {
3
+ /** The list's name. */
4
+ nav: string;
5
+ /** Where you are: "Step 2 of 5". */
6
+ position: (current: number, total: number) => string;
7
+ /** Said after a finished step's name. */
8
+ done: string;
9
+ /** A step's number as shown. */
10
+ number: (step: number) => string;
11
+ }
12
+ export interface StepProgressProps {
13
+ /** Each step's name, in order. */
14
+ steps: string[];
15
+ /** The step you're on, from 1. Past the last means every step is done. */
16
+ current: number;
17
+ /**
18
+ * - `"stepper"`: every step named, with a numbered marker and connectors
19
+ * that fill behind the current one. For a flow with room to show its map.
20
+ * - `"segmented"`: a segmented bar and "Step 2 of 5", for a card or a side
21
+ * panel. The segments alone don't say where you are, so the words always
22
+ * come with them.
23
+ */
24
+ variant?: "stepper" | "segmented";
25
+ labels?: Partial<StepProgressLabels>;
26
+ className?: string;
27
+ }
28
+ /**
29
+ * Discrete progress through named steps: a join flow, a setup, a checkout.
30
+ *
31
+ * The current step is `aria-current="step"`, each finished one says so, and
32
+ * a polite status says the new position ("Step 3 of 5: Shelf") when it
33
+ * changes.
34
+ */
35
+ declare function StepProgress({ steps, current: rawCurrent, variant, labels: overrides, className }: StepProgressProps): import("react/jsx-runtime").JSX.Element | null;
36
+ export { StepProgress };
@@ -0,0 +1,89 @@
1
+ "use client";
2
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
3
+ import { cn as d } from "../../../lib/utils.js";
4
+ import { Progress as b } from "../../atoms/Progress/Progress.js";
5
+ const y = {
6
+ nav: "Progress",
7
+ position: (s, c) => `Step ${s} of ${c}`,
8
+ done: "done",
9
+ number: (s) => String(s)
10
+ }, k = () => /* @__PURE__ */ r("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M20 6 9 17l-5-5" }) });
11
+ function j({ steps: s, current: c, variant: h = "stepper", labels: x, className: g }) {
12
+ const n = { ...y, ...x }, a = s.length;
13
+ if (a === 0) return null;
14
+ const t = Math.min(Math.max(1, Math.floor(Number.isFinite(c) ? c : 1)), a + 1), m = t > a, p = m ? n.position(a, a) : n.position(t, a), f = m ? p : `${p}: ${s[t - 1]}`;
15
+ return h === "segmented" ? /* @__PURE__ */ l("div", { className: d("rst:font-ui rst:w-full rst:min-w-0", g), "data-step-progress": "segmented", children: [
16
+ /* @__PURE__ */ l("div", { className: "rst:mb-1.5 rst:flex rst:items-baseline rst:justify-between rst:gap-3 rst:text-sm", "aria-hidden": "true", children: [
17
+ /* @__PURE__ */ r("span", { className: "rst:font-medium rst:text-[var(--roster-control-text)]", "data-step-position": "", children: p }),
18
+ !m && /* @__PURE__ */ r("span", { className: "rst:min-w-0 rst:truncate rst:text-gray-600 rst:dark:text-gray-400", "data-step-name": "", children: s[t - 1] })
19
+ ] }),
20
+ /* @__PURE__ */ r(
21
+ b,
22
+ {
23
+ variant: "segmented",
24
+ segments: s.map((u, i) => i + 1 < t ? "done" : i + 1 === t ? "current" : "remaining"),
25
+ announce: !1
26
+ }
27
+ ),
28
+ /* @__PURE__ */ r("span", { role: "status", className: "rst:sr-only", "data-step-status": "", children: f })
29
+ ] }) : /* @__PURE__ */ l("div", { className: d("rst:font-ui rst:w-full", g), "data-step-progress": "stepper", children: [
30
+ /* @__PURE__ */ r("ol", { "aria-label": n.nav, className: "rst:m-0 rst:flex rst:w-full rst:list-none rst:p-0", children: s.map((u, i) => {
31
+ const o = i + 1, e = o < t ? "done" : o === t ? "current" : "upcoming";
32
+ return /* @__PURE__ */ l(
33
+ "li",
34
+ {
35
+ "aria-current": e === "current" ? "step" : void 0,
36
+ className: "rst:relative rst:flex rst:min-w-0 rst:flex-1 rst:flex-col rst:items-center rst:gap-1.5 rst:text-center",
37
+ "data-step": e,
38
+ children: [
39
+ i > 0 && /* @__PURE__ */ r(
40
+ "span",
41
+ {
42
+ "aria-hidden": "true",
43
+ className: d(
44
+ "rst:absolute rst:right-1/2 rst:top-4 rst:h-0.5 rst:w-full rst:-translate-y-1/2",
45
+ o <= t ? "rst:bg-primary-600 rst:dark:bg-primary-400 rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight]" : "rst:bg-[var(--roster-skeleton)] rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[GrayText]"
46
+ ),
47
+ "data-step-connector": o <= t ? "filled" : "empty"
48
+ }
49
+ ),
50
+ /* @__PURE__ */ r(
51
+ "span",
52
+ {
53
+ "aria-hidden": "true",
54
+ className: d(
55
+ "rst:relative rst:z-10 rst:flex rst:h-8 rst:w-8 rst:items-center rst:justify-center rst:rounded-full rst:text-sm rst:font-semibold rst:tabular-nums",
56
+ e === "done" && "rst:bg-primary-600 rst:text-primary-600-ink rst:dark:bg-primary-400 rst:dark:text-gray-950 rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight] rst:forced-colors:text-[HighlightText]",
57
+ /* A border, not a ring: forced colors keep a border and drop
58
+ the shadow a ring is drawn with. */
59
+ e === "current" && "rst:border-2 rst:border-primary-600 rst:bg-[var(--roster-card-bg)] rst:text-primary-600 rst:dark:border-primary-400 rst:dark:text-primary-400",
60
+ e === "upcoming" && "rst:bg-[var(--roster-skeleton)] rst:text-gray-600 rst:dark:text-gray-300 rst:forced-colors:border"
61
+ ),
62
+ "data-step-marker": "",
63
+ children: e === "done" ? /* @__PURE__ */ r(k, {}) : n.number(o)
64
+ }
65
+ ),
66
+ /* @__PURE__ */ l(
67
+ "span",
68
+ {
69
+ className: d(
70
+ "rst:w-full rst:px-1 rst:text-xs rst:leading-4 rst:break-words",
71
+ e === "current" ? "rst:font-semibold rst:text-[var(--roster-control-text)]" : "rst:text-gray-600 rst:dark:text-gray-400"
72
+ ),
73
+ children: [
74
+ u,
75
+ e === "done" && /* @__PURE__ */ r("span", { className: "rst:sr-only", children: `, ${n.done}` })
76
+ ]
77
+ }
78
+ )
79
+ ]
80
+ },
81
+ `${o}-${u}`
82
+ );
83
+ }) }),
84
+ /* @__PURE__ */ r("span", { role: "status", className: "rst:sr-only", "data-step-status": "", children: f })
85
+ ] });
86
+ }
87
+ export {
88
+ j as StepProgress
89
+ };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("react"),r=require("@tanstack/react-table"),n=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),o=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),c=require("../../../lib/utils.cjs"),i=require("../../atoms/Button/Button.cjs"),a=require("../Table/Table.cjs"),C=r.tableFeatures({rowSortingFeature:r.rowSortingFeature,rowPaginationFeature:r.rowPaginationFeature,sortedRowModel:r.createSortedRowModel(),paginatedRowModel:r.createPaginatedRowModel(),sortFns:r.sortFns});function S({columns:g,data:d,className:u,tableClassName:x,paginationClassName:m,variant:f="default",size:j="md",hoverable:p=!1}){const[b,h]=w.useState([]),t=r.useTable({features:C,data:d,columns:g,onSortingChange:h,state:{sorting:b},initialState:{pagination:{pageIndex:0,pageSize:10}}});return e.jsxs("div",{className:c.cn("rst:font-ui rst:flex rst:flex-col rst:gap-4",u),children:[e.jsxs(a.Table,{variant:f,size:j,hoverable:p,className:x,children:[e.jsx(a.TableHeader,{children:t.getHeaderGroups().map(l=>e.jsx(a.TableRow,{children:l.headers.map(s=>e.jsx(a.TableHead,{children:s.isPlaceholder?null:e.jsxs("div",{className:c.cn("rst:flex rst:items-center rst:gap-2 rst:transition-opacity",s.column.getCanSort()&&"rst:cursor-pointer rst:select-none rst:opacity-80 rst:hover:opacity-100"),onClick:s.column.getToggleSortingHandler(),children:[r.flexRender(s.column.columnDef.header,s.getContext()),s.column.getCanSort()&&e.jsx("span",{className:"rst:w-4 rst:flex rst:justify-center rst:text-primary-500",children:s.column.getIsSorted()==="asc"?e.jsx(n.FontAwesomeIcon,{icon:o.faCaretUp}):s.column.getIsSorted()==="desc"?e.jsx(n.FontAwesomeIcon,{icon:o.faCaretDown}):null})]})},s.id))},l.id))}),e.jsx(a.TableBody,{children:t.getRowModel().rows?.length?t.getRowModel().rows.map(l=>e.jsx(a.TableRow,{children:l.getAllCells().map(s=>e.jsx(a.TableCell,{children:r.flexRender(s.column.columnDef.cell,s.getContext())},s.id))},l.id)):e.jsx(a.TableRow,{children:e.jsx(a.TableCell,{colSpan:g.length,className:"rst:h-24 rst:text-center rst:text-gray-500 rst:dark:text-gray-400 rst:italic",children:"No results found."})})})]}),e.jsxs("div",{className:c.cn("rst:flex rst:flex-col rst:sm:flex-row rst:items-center rst:justify-between rst:gap-4 rst:px-2",m),children:[e.jsxs("div",{className:"rst:text-sm rst:font-medium rst:text-gray-500 rst:dark:text-gray-400",children:["Page"," ",e.jsx("strong",{className:"rst:text-gray-900 rst:dark:text-gray-100",children:t.state.pagination.pageIndex+1})," ","of"," ",e.jsx("strong",{className:"rst:text-gray-900 rst:dark:text-gray-100",children:t.getPageCount()})]}),e.jsxs("div",{className:"rst:flex rst:items-center rst:space-x-2",children:[e.jsx(i.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.setPageIndex(0),disabled:!t.getCanPreviousPage(),"aria-label":"Go to first page",children:e.jsx(n.FontAwesomeIcon,{icon:o.faAnglesLeft})}),e.jsx(i.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),"aria-label":"Go to previous page",children:e.jsx(n.FontAwesomeIcon,{icon:o.faAngleLeft})}),e.jsx(i.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),"aria-label":"Go to next page",children:e.jsx(n.FontAwesomeIcon,{icon:o.faAngleRight})}),e.jsx(i.Button,{variant:"outline",colorScheme:"neutral",size:"sm",onClick:()=>t.setPageIndex(t.getPageCount()-1),disabled:!t.getCanNextPage(),"aria-label":"Go to last page",children:e.jsx(n.FontAwesomeIcon,{icon:o.faAnglesRight})})]})]})]})}exports.DataTable=S;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("react"),a=require("@tanstack/react-table"),c=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),g=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),l=require("../../../lib/utils.cjs"),h=require("../../molecules/Pagination/Pagination.cjs"),r=require("../Table/Table.cjs"),T=a.tableFeatures({rowSortingFeature:a.rowSortingFeature,rowPaginationFeature:a.rowPaginationFeature,sortedRowModel:a.createSortedRowModel(),paginatedRowModel:a.createPaginatedRowModel(),sortFns:a.sortFns});function C({columns:i,data:d,className:u,tableClassName:x,paginationClassName:m,variant:p="default",size:f="md",hoverable:j=!1,paginationLabels:o}){const[w,b]=y.useState([]),s=a.useTable({features:T,data:d,columns:i,onSortingChange:b,state:{sorting:w},initialState:{pagination:{pageIndex:0,pageSize:10}}});return e.jsxs("div",{className:l.cn("rst:font-ui rst:flex rst:flex-col rst:gap-4",u),children:[e.jsxs(r.Table,{variant:p,size:f,hoverable:j,className:x,children:[e.jsx(r.TableHeader,{children:s.getHeaderGroups().map(n=>e.jsx(r.TableRow,{children:n.headers.map(t=>e.jsx(r.TableHead,{children:t.isPlaceholder?null:e.jsxs("div",{className:l.cn("rst:flex rst:items-center rst:gap-2 rst:transition-opacity",t.column.getCanSort()&&"rst:cursor-pointer rst:select-none rst:opacity-80 rst:hover:opacity-100"),onClick:t.column.getToggleSortingHandler(),children:[a.flexRender(t.column.columnDef.header,t.getContext()),t.column.getCanSort()&&e.jsx("span",{className:"rst:w-4 rst:flex rst:justify-center rst:text-primary-500",children:t.column.getIsSorted()==="asc"?e.jsx(c.FontAwesomeIcon,{icon:g.faCaretUp}):t.column.getIsSorted()==="desc"?e.jsx(c.FontAwesomeIcon,{icon:g.faCaretDown}):null})]})},t.id))},n.id))}),e.jsx(r.TableBody,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map(n=>e.jsx(r.TableRow,{children:n.getAllCells().map(t=>e.jsx(r.TableCell,{children:a.flexRender(t.column.columnDef.cell,t.getContext())},t.id))},n.id)):e.jsx(r.TableRow,{children:e.jsx(r.TableCell,{colSpan:i.length,className:"rst:h-24 rst:text-center rst:text-gray-500 rst:dark:text-gray-400 rst:italic",children:"No results found."})})})]}),e.jsxs("div",{className:l.cn("rst:flex rst:flex-col rst:sm:flex-row rst:items-center rst:justify-between rst:gap-4 rst:px-2",m),children:[e.jsx("div",{className:"rst:text-sm rst:font-medium rst:text-gray-500 rst:dark:text-gray-400",children:o?.status?o.status(s.state.pagination.pageIndex+1,s.getPageCount()):e.jsxs(e.Fragment,{children:["Page"," ",e.jsx("strong",{className:"rst:text-gray-900 rst:dark:text-gray-100",children:s.state.pagination.pageIndex+1})," ","of"," ",e.jsx("strong",{className:"rst:text-gray-900 rst:dark:text-gray-100",children:s.getPageCount()})]})}),e.jsx(h.Pagination,{layout:"arrows",align:"end",variant:"outline",page:s.state.pagination.pageIndex+1,pageCount:s.getPageCount(),onPageChange:n=>s.setPageIndex(n-1),labels:o})]})]})}exports.DataTable=C;
@@ -1,4 +1,5 @@
1
1
  import { ColumnDef, RowData } from '@tanstack/react-table';
2
+ import { PaginationLabels } from '../../molecules/Pagination/Pagination';
2
3
  import { TableProps } from '../Table/Table';
3
4
  /**
4
5
  * The feature set DataTable registers: sorting and pagination, plus the row
@@ -43,6 +44,12 @@ export interface DataTableProps<TData extends RowData> {
43
44
  variant?: TableProps["variant"];
44
45
  size?: TableProps["size"];
45
46
  hoverable?: boolean;
47
+ /**
48
+ * Replaces the pager's words; see Pagination's `labels`. `status` also
49
+ * replaces the "Page N of M" line beside it. ("No results found." is
50
+ * DataTable's own and isn't covered.)
51
+ */
52
+ paginationLabels?: Partial<PaginationLabels>;
46
53
  }
47
- export declare function DataTable<TData extends RowData>({ columns, data, className, tableClassName, paginationClassName, variant, size, hoverable, }: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
54
+ export declare function DataTable<TData extends RowData>({ columns, data, className, tableClassName, paginationClassName, variant, size, hoverable, paginationLabels, }: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
48
55
  export {};