@blakesteve/roster 5.7.0 → 5.9.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 (106) hide show
  1. package/README.md +169 -5
  2. package/dist/components/atoms/Avatar/Avatar.cjs +1 -1
  3. package/dist/components/atoms/Avatar/Avatar.d.ts +4 -0
  4. package/dist/components/atoms/Avatar/Avatar.js +1 -1
  5. package/dist/components/atoms/AvatarStrip/AvatarStrip.cjs +1 -1
  6. package/dist/components/atoms/AvatarStrip/AvatarStrip.d.ts +10 -1
  7. package/dist/components/atoms/AvatarStrip/AvatarStrip.js +34 -30
  8. package/dist/components/atoms/Button/button-variants.cjs +1 -1
  9. package/dist/components/atoms/Button/button-variants.js +5 -3
  10. package/dist/components/atoms/Eyebrow/eyebrow-variants.cjs +1 -1
  11. package/dist/components/atoms/Eyebrow/eyebrow-variants.js +8 -4
  12. package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
  13. package/dist/components/atoms/MultiSelect/MultiSelect.d.ts +3 -1
  14. package/dist/components/atoms/MultiSelect/MultiSelect.js +87 -89
  15. package/dist/components/atoms/Progress/Progress.cjs +1 -1
  16. package/dist/components/atoms/Progress/Progress.d.ts +1 -0
  17. package/dist/components/atoms/Progress/Progress.js +28 -27
  18. package/dist/components/atoms/Stat/Stat.cjs +1 -1
  19. package/dist/components/atoms/Stat/Stat.js +5 -5
  20. package/dist/components/atoms/Stat/stat-variants.cjs +1 -1
  21. package/dist/components/atoms/Stat/stat-variants.js +10 -8
  22. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.cjs +1 -1
  23. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.ts +10 -1
  24. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js +31 -29
  25. package/dist/components/molecules/CallToAction/CallToAction.cjs +1 -1
  26. package/dist/components/molecules/CallToAction/CallToAction.d.ts +8 -1
  27. package/dist/components/molecules/CallToAction/CallToAction.js +34 -29
  28. package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
  29. package/dist/components/molecules/Carousel/Carousel.d.ts +7 -0
  30. package/dist/components/molecules/Carousel/Carousel.js +155 -155
  31. package/dist/components/molecules/ErrorState/ErrorState.cjs +1 -1
  32. package/dist/components/molecules/ErrorState/ErrorState.d.ts +8 -1
  33. package/dist/components/molecules/ErrorState/ErrorState.js +44 -39
  34. package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
  35. package/dist/components/molecules/FileUpload/FileUpload.js +23 -22
  36. package/dist/components/molecules/MediaPreview/MediaPreview.cjs +1 -1
  37. package/dist/components/molecules/MediaPreview/MediaPreview.d.ts +3 -1
  38. package/dist/components/molecules/MediaPreview/MediaPreview.js +13 -12
  39. package/dist/components/molecules/Menu/Menu.cjs +1 -0
  40. package/dist/components/molecules/Menu/Menu.d.ts +169 -0
  41. package/dist/components/molecules/Menu/Menu.js +577 -0
  42. package/dist/components/molecules/Menu/menu-typeahead.cjs +1 -0
  43. package/dist/components/molecules/Menu/menu-typeahead.d.ts +7 -0
  44. package/dist/components/molecules/Menu/menu-typeahead.js +13 -0
  45. package/dist/components/molecules/Pagination/Pagination.cjs +1 -1
  46. package/dist/components/molecules/Pagination/Pagination.d.ts +1 -0
  47. package/dist/components/molecules/Pagination/Pagination.js +47 -46
  48. package/dist/components/molecules/ProgressField/ProgressField.d.ts +1 -0
  49. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -1
  50. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +2 -2
  51. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +17 -17
  52. package/dist/components/molecules/StepProgress/StepProgress.cjs +1 -1
  53. package/dist/components/molecules/StepProgress/StepProgress.d.ts +1 -0
  54. package/dist/components/molecules/StepProgress/StepProgress.js +9 -8
  55. package/dist/components/organisms/Countdown/Countdown.cjs +1 -1
  56. package/dist/components/organisms/Countdown/Countdown.d.ts +13 -0
  57. package/dist/components/organisms/Countdown/Countdown.js +54 -47
  58. package/dist/components/organisms/DataTable/DataTable.cjs +1 -1
  59. package/dist/components/organisms/DataTable/DataTable.d.ts +5 -3
  60. package/dist/components/organisms/DataTable/DataTable.js +27 -26
  61. package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
  62. package/dist/components/organisms/Dialog/Dialog.d.ts +8 -1
  63. package/dist/components/organisms/Dialog/Dialog.js +25 -23
  64. package/dist/components/organisms/Footer/Footer.cjs +1 -1
  65. package/dist/components/organisms/Footer/Footer.d.ts +9 -0
  66. package/dist/components/organisms/Footer/Footer.js +21 -23
  67. package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
  68. package/dist/components/organisms/ModerationQueue/ModerationQueue.d.ts +40 -1
  69. package/dist/components/organisms/ModerationQueue/ModerationQueue.js +262 -237
  70. package/dist/components/organisms/ModerationQueue/QueueEditDialog.cjs +1 -1
  71. package/dist/components/organisms/ModerationQueue/QueueEditDialog.d.ts +1 -1
  72. package/dist/components/organisms/ModerationQueue/QueueEditDialog.js +23 -21
  73. package/dist/components/organisms/ModerationQueue/QueueEditSheet.cjs +1 -1
  74. package/dist/components/organisms/ModerationQueue/QueueEditSheet.d.ts +1 -1
  75. package/dist/components/organisms/ModerationQueue/QueueEditSheet.js +22 -20
  76. package/dist/components/organisms/ModerationQueue/queue-actions.d.ts +29 -10
  77. package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
  78. package/dist/components/organisms/Navbar/Navbar.d.ts +39 -4
  79. package/dist/components/organisms/Navbar/Navbar.js +297 -301
  80. package/dist/components/organisms/Navbar/navbar-variants.cjs +1 -1
  81. package/dist/components/organisms/Navbar/navbar-variants.js +4 -2
  82. package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
  83. package/dist/components/organisms/Sheet/Sheet.d.ts +8 -1
  84. package/dist/components/organisms/Sheet/Sheet.js +65 -63
  85. package/dist/index.d.ts +1 -0
  86. package/dist/lib/labels.cjs +1 -0
  87. package/dist/lib/labels.d.ts +7 -0
  88. package/dist/lib/labels.js +12 -0
  89. package/dist/meta.json +3 -3
  90. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +7 -7
  91. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +2 -2
  92. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +5 -5
  93. package/dist/node_modules/@headlessui/react/dist/components/portal/portal.js +6 -6
  94. package/dist/node_modules/@headlessui/react/dist/utils/focus-management.cjs +1 -1
  95. package/dist/node_modules/@headlessui/react/dist/utils/focus-management.js +52 -61
  96. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +6 -6
  97. package/dist/roster.cjs +1 -1
  98. package/dist/roster.css +1 -1
  99. package/dist/roster.js +127 -116
  100. package/package.json +2 -1
  101. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine-glue.cjs +0 -1
  102. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine-glue.js +0 -21
  103. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine.cjs +0 -1
  104. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine.js +0 -120
  105. package/dist/node_modules/@headlessui/react/dist/components/menu/menu.cjs +0 -1
  106. package/dist/node_modules/@headlessui/react/dist/components/menu/menu.js +0 -197
@@ -1,18 +1,19 @@
1
1
  "use client";
2
- import { jsxs as y, jsx as c, Fragment as $t } from "react/jsx-runtime";
2
+ import { jsx as c, jsxs as C, Fragment as Ht } from "react/jsx-runtime";
3
3
  import * as n from "react";
4
- import { Button as Bt } from "../../atoms/Button/Button.js";
5
- import { cn as w } from "../../../lib/utils.js";
6
- import { prefersReducedMotion as Ht } from "../../../internal/motion.js";
7
- import { currentIndex as jt, canScrollNext as zt, canScrollPrev as Ut, overflows as Vt, pageTarget as Wt, snapPosition as U, nearestIndex as qt, CAROUSEL_DRAG_THRESHOLD as Xt } from "./carousel-math.js";
8
- import { perViewVars as Gt, FLUID_ITEM_WIDTH as Jt, FLUID_CLASSES as Kt } from "./carousel-layout.js";
9
- const Qt = (a) => Math.min(3e3, 500 + a * 0.35), Yt = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"])', V = (a) => typeof a == "number" ? `${a}px` : a;
10
- function nt(a) {
11
- const d = parseFloat(a);
12
- return Number.isFinite(d) ? d : 0;
4
+ import { Button as jt } from "../../atoms/Button/Button.js";
5
+ import { cn as y } from "../../../lib/utils.js";
6
+ import { withLabels as zt } from "../../../lib/labels.js";
7
+ import { prefersReducedMotion as Ut } from "../../../internal/motion.js";
8
+ import { currentIndex as Vt, canScrollNext as Wt, canScrollPrev as qt, overflows as Xt, pageTarget as Gt, snapPosition as U, nearestIndex as Jt, CAROUSEL_DRAG_THRESHOLD as Kt } from "./carousel-math.js";
9
+ import { perViewVars as Qt, FLUID_ITEM_WIDTH as Yt, FLUID_CLASSES as Zt } from "./carousel-layout.js";
10
+ const te = { position: (i, u) => `${i} of ${u}` }, ee = (i) => Math.min(3e3, 500 + i * 0.35), re = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"])', V = (i) => typeof i == "number" ? `${i}px` : i;
11
+ function st(i) {
12
+ const u = parseFloat(i);
13
+ return Number.isFinite(u) ? u : 0;
13
14
  }
14
- const Zt = "rst:hidden rst:[@media(any-hover:hover)]:inline-flex", te = "rst:hidden rst:[@media(any-hover:hover)]:flex";
15
- function st({ direction: a }) {
15
+ const ne = "rst:hidden rst:[@media(any-hover:hover)]:inline-flex", se = "rst:hidden rst:[@media(any-hover:hover)]:flex";
16
+ function ot({ direction: i }) {
16
17
  return /* @__PURE__ */ c(
17
18
  "svg",
18
19
  {
@@ -25,82 +26,83 @@ function st({ direction: a }) {
25
26
  strokeWidth: "2",
26
27
  strokeLinecap: "round",
27
28
  strokeLinejoin: "round",
28
- children: /* @__PURE__ */ c("path", { d: a === "prev" ? "M12.5 4.5 7 10l5.5 5.5" : "M7.5 4.5 13 10l-5.5 5.5" })
29
+ children: /* @__PURE__ */ c("path", { d: i === "prev" ? "M12.5 4.5 7 10l5.5 5.5" : "M7.5 4.5 13 10l-5.5 5.5" })
29
30
  }
30
31
  );
31
32
  }
32
- const ot = {
33
+ const lt = {
33
34
  overflowing: null,
34
35
  canScrollPrev: !1,
35
36
  canScrollNext: !1,
36
37
  index: 0
37
- }, ce = n.forwardRef(function({
38
- "aria-label": d,
39
- "aria-labelledby": N,
38
+ }, fe = n.forwardRef(function({
39
+ "aria-label": u,
40
+ "aria-labelledby": w,
40
41
  children: W,
41
- itemWidth: I,
42
- perView: R,
42
+ itemWidth: N,
43
+ perView: k,
43
44
  gap: q = 12,
44
45
  gutter: X = 16,
45
- bleed: lt = !1,
46
- snap: L = "start",
47
- snapStrictness: ct = "mandatory",
46
+ bleed: ct = !1,
47
+ snap: R = "start",
48
+ snapStrictness: it = "mandatory",
48
49
  oneAtATime: at = !1,
49
50
  arrows: P = "hover",
50
51
  arrowPlacement: M = "controls",
51
- renderArrows: T,
52
- prevLabel: it,
53
- nextLabel: ut,
54
- prevIcon: dt,
55
- nextIcon: ft,
56
- arrowButtonProps: gt,
52
+ renderArrows: I,
53
+ prevLabel: ut,
54
+ nextLabel: dt,
55
+ prevIcon: ft,
56
+ nextIcon: gt,
57
+ arrowButtonProps: pt,
57
58
  fade: vt = !1,
58
- scrollbar: pt = !1,
59
+ scrollbar: mt = !1,
59
60
  showPosition: G = !1,
61
+ labels: bt,
60
62
  onIndexChange: J,
61
63
  onScrollStateChange: K,
62
- itemClassName: mt,
63
- listClassName: bt,
64
- className: xt,
65
- style: ht,
66
- ...St
67
- }, yt) {
68
- const f = n.useRef(null), Q = `${n.useId()}-list`, Y = n.Children.toArray(W), E = Y.length, [o, wt] = n.useState(ot), Z = n.useRef(ot), [Nt, It] = n.useState(""), [Tt, Et] = n.useState(!1), D = n.useRef({ onIndexChange: J, onScrollStateChange: K });
64
+ itemClassName: xt,
65
+ listClassName: ht,
66
+ className: St,
67
+ style: yt,
68
+ ...wt
69
+ }, Nt) {
70
+ const Q = zt(te, bt), g = n.useRef(null), Y = `${n.useId()}-list`, Z = n.Children.toArray(W), T = Z.length, [o, It] = n.useState(lt), tt = n.useRef(lt), [Tt, Et] = n.useState(""), [Lt, Ct] = n.useState(!1), A = n.useRef({ onIndexChange: J, onScrollStateChange: K });
69
71
  n.useEffect(() => {
70
- D.current = { onIndexChange: J, onScrollStateChange: K };
72
+ A.current = { onIndexChange: J, onScrollStateChange: K };
71
73
  });
72
- const i = n.useCallback(() => {
73
- const t = f.current;
74
+ const d = n.useCallback(() => {
75
+ const t = g.current;
74
76
  if (!t) return null;
75
77
  const e = t.getBoundingClientRect(), r = getComputedStyle(t), s = e.left + t.clientLeft - t.scrollLeft;
76
78
  return {
77
- items: Array.from(t.children).map((u) => {
78
- const p = u.getBoundingClientRect();
79
- return { start: p.left - s, end: p.right - s };
79
+ items: Array.from(t.children).map((a) => {
80
+ const v = a.getBoundingClientRect();
81
+ return { start: v.left - s, end: v.right - s };
80
82
  }),
81
83
  scrollLeft: t.scrollLeft,
82
84
  clientWidth: t.clientWidth,
83
85
  scrollWidth: t.scrollWidth,
84
- paddingStart: nt(r.scrollPaddingInlineStart || r.scrollPaddingLeft),
85
- paddingEnd: nt(r.scrollPaddingInlineEnd || r.scrollPaddingRight),
86
- align: L
86
+ paddingStart: st(r.scrollPaddingInlineStart || r.scrollPaddingLeft),
87
+ paddingEnd: st(r.scrollPaddingInlineEnd || r.scrollPaddingRight),
88
+ align: R
87
89
  };
88
- }, [L]), m = n.useCallback(() => {
89
- const t = i();
90
+ }, [R]), m = n.useCallback(() => {
91
+ const t = d();
90
92
  if (!t) return;
91
93
  const e = {
92
- overflowing: Vt(t),
93
- canScrollPrev: Ut(t),
94
- canScrollNext: zt(t),
95
- index: t.items.length ? jt(t) : 0
96
- }, r = Z.current;
97
- r.overflowing === e.overflowing && r.canScrollPrev === e.canScrollPrev && r.canScrollNext === e.canScrollNext && r.index === e.index || (Z.current = e, wt(e), r.index !== e.index && D.current.onIndexChange?.(e.index), (r.canScrollPrev !== e.canScrollPrev || r.canScrollNext !== e.canScrollNext) && D.current.onScrollStateChange?.({
94
+ overflowing: Xt(t),
95
+ canScrollPrev: qt(t),
96
+ canScrollNext: Wt(t),
97
+ index: t.items.length ? Vt(t) : 0
98
+ }, r = tt.current;
99
+ r.overflowing === e.overflowing && r.canScrollPrev === e.canScrollPrev && r.canScrollNext === e.canScrollNext && r.index === e.index || (tt.current = e, It(e), r.index !== e.index && A.current.onIndexChange?.(e.index), (r.canScrollPrev !== e.canScrollPrev || r.canScrollNext !== e.canScrollNext) && A.current.onScrollStateChange?.({
98
100
  canScrollPrev: e.canScrollPrev,
99
101
  canScrollNext: e.canScrollNext
100
102
  }));
101
- }, [i]), Ct = JSON.stringify([q, X, I, R]);
103
+ }, [d]), kt = JSON.stringify([q, X, N, k]);
102
104
  n.useLayoutEffect(() => {
103
- const t = f.current;
105
+ const t = g.current;
104
106
  if (!t) return;
105
107
  m();
106
108
  let e = 0;
@@ -111,85 +113,87 @@ const ot = {
111
113
  };
112
114
  t.addEventListener("scroll", r, { passive: !0 });
113
115
  const s = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => m()), l = () => {
114
- s?.observe(t), Array.from(t.children).forEach((p) => s?.observe(p));
116
+ s?.observe(t), Array.from(t.children).forEach((v) => s?.observe(v));
115
117
  };
116
118
  l();
117
- const u = typeof MutationObserver > "u" ? null : new MutationObserver(() => {
119
+ const a = typeof MutationObserver > "u" ? null : new MutationObserver(() => {
118
120
  l(), m();
119
121
  });
120
- return u?.observe(t, { childList: !0 }), () => {
121
- t.removeEventListener("scroll", r), s?.disconnect(), u?.disconnect(), e && cancelAnimationFrame(e);
122
+ return a?.observe(t, { childList: !0 }), () => {
123
+ t.removeEventListener("scroll", r), s?.disconnect(), a?.disconnect(), e && cancelAnimationFrame(e);
122
124
  };
123
- }, [m, E, Ct]), n.useLayoutEffect(() => {
124
- const t = f.current;
125
- if (t && (Et(!t.querySelector(Yt)), N)) {
126
- const e = N.split(/\s+/).map((r) => document.getElementById(r)?.textContent?.trim() ?? "").filter(Boolean).join(" ");
127
- It(e);
125
+ }, [m, T, kt]), n.useLayoutEffect(() => {
126
+ const t = g.current;
127
+ if (t && (Ct(!t.querySelector(re)), w)) {
128
+ const e = w.split(/\s+/).map((r) => document.getElementById(r)?.textContent?.trim() ?? "").filter(Boolean).join(" ");
129
+ Et(e);
128
130
  }
129
- }, [W, N]);
130
- const b = n.useRef(null), g = n.useCallback(() => {
131
- const t = f.current, e = b.current;
131
+ }, [W, w]);
132
+ const b = n.useRef(null), f = n.useCallback(() => {
133
+ const t = g.current, e = b.current;
132
134
  e && (b.current = null, window.clearTimeout(e.timer), t?.removeEventListener("scrollend", e.done), t && (t.style.scrollSnapType = "", delete t.dataset.settling));
133
- }, []), v = n.useCallback(
135
+ }, []), p = n.useCallback(
134
136
  (t, e) => {
135
- const r = f.current;
137
+ const r = g.current;
136
138
  if (!r) return;
137
- if (g(), e !== "smooth" || Ht() || Math.abs(r.scrollLeft - t) < 1) {
139
+ if (f(), e !== "smooth" || Ut() || Math.abs(r.scrollLeft - t) < 1) {
138
140
  r.style.scrollSnapType = "none", r.scrollTo({ left: t, behavior: "instant" }), r.style.scrollSnapType = "";
139
141
  return;
140
142
  }
141
143
  r.style.scrollSnapType = "none", r.dataset.settling = "";
142
- const l = () => g();
144
+ const l = r.scrollLeft, a = () => {
145
+ Math.abs(r.scrollLeft - l) < 0.5 || f();
146
+ };
143
147
  b.current = {
144
- timer: window.setTimeout(l, Qt(Math.abs(r.scrollLeft - t))),
145
- done: l,
148
+ timer: window.setTimeout(f, ee(Math.abs(r.scrollLeft - t))),
149
+ done: a,
146
150
  target: t
147
- }, r.addEventListener("scrollend", l, { once: !0 }), r.scrollTo({ left: t, behavior: "smooth" });
151
+ }, r.addEventListener("scrollend", a), r.scrollTo({ left: t, behavior: "smooth" });
148
152
  },
149
- [g]
150
- ), C = n.useCallback(
153
+ [f]
154
+ ), E = n.useCallback(
151
155
  (t) => {
152
- const e = i();
156
+ const e = d();
153
157
  if (!e) return;
154
158
  const r = b.current ? { ...e, scrollLeft: b.current.target } : e;
155
- v(Wt(r, t), "smooth");
159
+ p(Gt(r, t), "smooth");
156
160
  },
157
- [i, v]
161
+ [d, p]
158
162
  );
159
163
  n.useImperativeHandle(
160
- yt,
164
+ Nt,
161
165
  () => ({
162
166
  scrollToIndex: (t, e) => {
163
- const r = i();
167
+ const r = d();
164
168
  if (!r || !r.items.length) return;
165
169
  const s = Math.min(Math.max(0, Math.round(t)), r.items.length - 1);
166
- v(U(r, s), e?.behavior ?? "smooth");
170
+ p(U(r, s), e?.behavior ?? "smooth");
167
171
  },
168
- scrollPrev: () => C(-1),
169
- scrollNext: () => C(1)
172
+ scrollPrev: () => E(-1),
173
+ scrollNext: () => E(1)
170
174
  }),
171
- [i, C, v]
172
- ), n.useEffect(() => g, [g]);
173
- const O = n.useRef(null), A = n.useRef(null), F = n.useRef(null);
175
+ [d, E, p]
176
+ ), n.useEffect(() => f, [f]);
177
+ const D = n.useRef(null), O = n.useRef(null), F = n.useRef(null);
174
178
  n.useLayoutEffect(() => {
175
179
  const t = F.current;
176
180
  if (!t) return;
177
- const e = t === "prev" ? O.current : A.current, r = t === "prev" ? A.current : O.current, s = t === "prev" ? !o.canScrollPrev : !o.canScrollNext, l = document.activeElement;
181
+ const e = t === "prev" ? D.current : O.current, r = t === "prev" ? O.current : D.current, s = t === "prev" ? !o.canScrollPrev : !o.canScrollNext, l = document.activeElement;
178
182
  s && (l !== e && l !== document.body && l !== null || r && !r.disabled && r.focus());
179
183
  }, [o.canScrollPrev, o.canScrollNext]);
180
- const x = n.useRef(null), h = n.useRef(!1), kt = (t) => {
181
- t.pointerType !== "mouse" || t.button !== 0 || o.overflowing && (g(), h.current = !1, x.current = {
184
+ const x = n.useRef(null), h = n.useRef(!1), Rt = (t) => {
185
+ t.pointerType !== "mouse" || t.button !== 0 || o.overflowing && (f(), h.current = !1, x.current = {
182
186
  pointerId: t.pointerId,
183
187
  x0: t.clientX,
184
188
  scroll0: t.currentTarget.scrollLeft,
185
189
  dragging: !1
186
190
  });
187
- }, Rt = (t) => {
191
+ }, Pt = (t) => {
188
192
  const e = x.current;
189
193
  if (!e || t.pointerId !== e.pointerId) return;
190
194
  const r = t.currentTarget, s = t.clientX - e.x0;
191
195
  if (!e.dragging) {
192
- if (Math.abs(s) <= Xt) return;
196
+ if (Math.abs(s) <= Kt) return;
193
197
  e.dragging = !0, r.dataset.dragging = "", r.style.scrollSnapType = "none", window.getSelection?.()?.removeAllRanges();
194
198
  try {
195
199
  r.setPointerCapture(t.pointerId);
@@ -204,13 +208,13 @@ const ot = {
204
208
  delete r.dataset.dragging, h.current = t.type === "pointerup", window.setTimeout(() => {
205
209
  h.current = !1;
206
210
  }, 0);
207
- const s = i();
208
- s ? v(U(s, qt(s)), "smooth") : r.style.scrollSnapType = "";
209
- }, Lt = (t) => {
211
+ const s = d();
212
+ s ? p(U(s, Jt(s)), "smooth") : r.style.scrollSnapType = "";
213
+ }, Mt = (t) => {
210
214
  !h.current || t.detail === 0 || (h.current = !1, t.preventDefault(), t.stopPropagation());
211
- }, Pt = (t) => {
215
+ }, At = (t) => {
212
216
  o.overflowing && t.preventDefault();
213
- }, Mt = (t) => {
217
+ }, Dt = (t) => {
214
218
  const e = t.currentTarget, r = t.target;
215
219
  if (r === e || x.current?.dragging) return;
216
220
  let s = !1;
@@ -222,30 +226,30 @@ const ot = {
222
226
  if (!s) return;
223
227
  const l = r.closest("[data-carousel-item]");
224
228
  if (!l || l.parentElement !== e) return;
225
- const u = i();
226
- if (!u) return;
227
- const p = Array.prototype.indexOf.call(e.children, l);
228
- v(U(u, p), "instant");
229
- }, [Dt, Ot] = n.useState(0);
229
+ const a = d();
230
+ if (!a) return;
231
+ const v = Array.prototype.indexOf.call(e.children, l);
232
+ p(U(a, v), "instant");
233
+ }, [Ot, Ft] = n.useState(0);
230
234
  n.useEffect(() => {
231
- const t = window.setTimeout(() => Ot(o.index), 150);
235
+ const t = window.setTimeout(() => Ft(o.index), 150);
232
236
  return () => window.clearTimeout(t);
233
237
  }, [o.index]);
234
- const tt = d ?? Nt, et = (t) => tt ? `${t} ${tt}` : t, $ = P !== "none" && o.overflowing !== !1, At = P === "hover" ? Zt : "rst:inline-flex", rt = (t) => {
235
- const e = t === "prev", { className: r, ...s } = gt ?? {};
238
+ const et = u ?? Tt, rt = (t) => et ? `${t} ${et}` : t, $ = P !== "none" && o.overflowing !== !1, _t = P === "hover" ? ne : "rst:inline-flex", nt = (t) => {
239
+ const e = t === "prev", { className: r, ...s } = pt ?? {};
236
240
  return /* @__PURE__ */ c(
237
- Bt,
241
+ jt,
238
242
  {
239
243
  type: "button",
240
244
  variant: "outline",
241
245
  colorScheme: "neutral",
242
246
  size: "icon",
243
247
  ...s,
244
- "aria-label": e ? it ?? et("Previous") : ut ?? et("Next"),
245
- "aria-controls": Q,
248
+ "aria-label": e ? ut ?? rt("Previous") : dt ?? rt("Next"),
249
+ "aria-controls": Y,
246
250
  disabled: e ? !o.canScrollPrev : !o.canScrollNext,
247
- onClick: () => C(e ? -1 : 1),
248
- ref: e ? O : A,
251
+ onClick: () => E(e ? -1 : 1),
252
+ ref: e ? D : O,
249
253
  onFocus: () => {
250
254
  F.current = t;
251
255
  },
@@ -253,97 +257,93 @@ const ot = {
253
257
  l.relatedTarget && (F.current = null);
254
258
  },
255
259
  "data-carousel-arrow": t,
256
- className: w(
260
+ className: y(
257
261
  /* 44px, the target size, whatever the Button's own icon size is. */
258
262
  "rst:size-11 rst:shrink-0 rst:rounded-full",
259
263
  /* Over the row, a disabled arrow would sit on top of the first or
260
264
  last item for nothing, so it hides. Hidden is also out of the tab
261
265
  order and the accessibility tree, as disabled already was. */
262
- M === "overlay" && !T && "rst:bg-[var(--roster-popover-bg)] rst:elevation-raised rst:hover:bg-[var(--roster-popover-bg)] rst:disabled:invisible",
263
- At,
266
+ M === "overlay" && !I && "rst:bg-[var(--roster-popover-bg)] rst:elevation-raised rst:hover:bg-[var(--roster-popover-bg)] rst:disabled:invisible",
267
+ _t,
264
268
  r
265
269
  ),
266
- children: e ? dt ?? /* @__PURE__ */ c(st, { direction: "prev" }) : ft ?? /* @__PURE__ */ c(st, { direction: "next" })
270
+ children: e ? ft ?? /* @__PURE__ */ c(ot, { direction: "prev" }) : gt ?? /* @__PURE__ */ c(ot, { direction: "next" })
267
271
  }
268
272
  );
269
- }, k = $ ? rt("prev") : null, B = $ ? rt("next") : null, S = G && E ? (
273
+ }, L = $ ? nt("prev") : null, B = $ ? nt("next") : null, S = G && T ? (
270
274
  /* `font-ui` here and not on the root: the readout is the only text the
271
275
  carousel owns. The items are the host's content, and not Roster's to
272
276
  restyle. */
273
- /* @__PURE__ */ y("p", { "aria-live": "polite", className: "rst:font-ui rst:m-0 rst:text-sm rst:tabular-nums rst:opacity-75", "data-carousel-position": "", children: [
274
- Dt + 1,
275
- " of ",
276
- E
277
- ] })
277
+ /* @__PURE__ */ c("p", { "aria-live": "polite", className: "rst:font-ui rst:m-0 rst:text-sm rst:tabular-nums rst:opacity-75", "data-carousel-position": "", children: Q.position(Ot + 1, T) })
278
278
  ) : null;
279
279
  let H = null;
280
- T ? H = T({ prev: k, next: B, position: S }) : M === "controls" && (k || S) && (H = /* @__PURE__ */ y(
280
+ I ? H = I({ prev: L, next: B, position: S }) : M === "controls" && (L || S) && (H = /* @__PURE__ */ C(
281
281
  "div",
282
282
  {
283
- className: w(
283
+ className: y(
284
284
  "rst:mb-2 rst:items-center rst:justify-end rst:gap-2",
285
285
  /* A line with only arrows in it takes no room where they can't show. */
286
- !S && P === "hover" ? te : "rst:flex"
286
+ !S && P === "hover" ? se : "rst:flex"
287
287
  ),
288
288
  "data-carousel-controls": "",
289
289
  children: [
290
290
  S && /* @__PURE__ */ c("div", { className: "rst:mr-auto", children: S }),
291
- k,
291
+ L,
292
292
  B
293
293
  ]
294
294
  }
295
295
  ));
296
- const j = vt && o.overflowing && (o.canScrollPrev || o.canScrollNext) ? `linear-gradient(to right, ${o.canScrollPrev ? "transparent, black 48px" : "black"}, ${o.canScrollNext ? "black calc(100% - 48px), transparent" : "black"})` : void 0, z = I === void 0 && R !== void 0, Ft = {
296
+ const j = vt && o.overflowing && (o.canScrollPrev || o.canScrollNext) ? `linear-gradient(to right, ${o.canScrollPrev ? "transparent, black 48px" : "black"}, ${o.canScrollNext ? "black calc(100% - 48px), transparent" : "black"})` : void 0, z = N === void 0 && k !== void 0, $t = {
297
297
  "--rst-cv-gap": V(q),
298
298
  "--rst-cv-gutter": V(X),
299
- ...z ? Gt(R) : {},
299
+ ...z ? Qt(k) : {},
300
300
  ...j ? { maskImage: j, WebkitMaskImage: j } : {}
301
- }, _t = I !== void 0 ? { width: V(I) } : z ? { width: Jt } : void 0;
302
- return /* @__PURE__ */ y("div", { className: w("rst:min-w-0", xt), style: ht, ...St, children: [
301
+ }, Bt = N !== void 0 ? { width: V(N) } : z ? { width: Yt } : void 0;
302
+ return /* @__PURE__ */ C("div", { className: y("rst:min-w-0", St), style: yt, ...wt, children: [
303
303
  H,
304
- /* @__PURE__ */ y("div", { className: "rst:relative", children: [
304
+ /* @__PURE__ */ C("div", { className: "rst:relative", children: [
305
305
  /* @__PURE__ */ c(
306
306
  "ul",
307
307
  {
308
- ref: f,
309
- id: Q,
308
+ ref: g,
309
+ id: Y,
310
310
  role: "list",
311
- "aria-label": d,
312
- "aria-labelledby": d ? void 0 : N,
313
- tabIndex: Tt && o.overflowing ? 0 : void 0,
311
+ "aria-label": u,
312
+ "aria-labelledby": u ? void 0 : w,
313
+ tabIndex: Lt && o.overflowing ? 0 : void 0,
314
314
  "data-overflowing": o.overflowing ? "" : void 0,
315
- onPointerDown: kt,
316
- onPointerMove: Rt,
315
+ onPointerDown: Rt,
316
+ onPointerMove: Pt,
317
317
  onPointerUp: _,
318
318
  onPointerCancel: _,
319
319
  onLostPointerCapture: _,
320
- onClickCapture: Lt,
321
- onDragStart: Pt,
322
- onFocus: Mt,
323
- style: Ft,
324
- className: w(
320
+ onClickCapture: Mt,
321
+ onDragStart: At,
322
+ onFocus: Dt,
323
+ style: $t,
324
+ className: y(
325
325
  "rst:m-0 rst:flex rst:list-none rst:overflow-x-auto rst:overflow-y-hidden",
326
326
  "rst:gap-(--rst-cv-gap) rst:px-(--rst-cv-gutter) rst:py-1 rst:scroll-px-(--rst-cv-gutter)",
327
327
  "rst:overscroll-x-contain",
328
- ct === "mandatory" ? "rst:snap-x rst:snap-mandatory" : "rst:snap-x rst:snap-proximity",
329
- lt && "rst:-mx-(--rst-cv-gutter)",
330
- !pt && "rst:[scrollbar-width:none] rst:[&::-webkit-scrollbar]:hidden",
331
- z && Kt,
328
+ it === "mandatory" ? "rst:snap-x rst:snap-mandatory" : "rst:snap-x rst:snap-proximity",
329
+ ct && "rst:-mx-(--rst-cv-gutter)",
330
+ !mt && "rst:[scrollbar-width:none] rst:[&::-webkit-scrollbar]:hidden",
331
+ z && Zt,
332
332
  "rst:data-overflowing:cursor-grab rst:data-dragging:cursor-grabbing rst:data-dragging:select-none",
333
333
  "rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-inset",
334
- bt
334
+ ht
335
335
  ),
336
- children: Y.map((t, e) => /* @__PURE__ */ c(
336
+ children: Z.map((t, e) => /* @__PURE__ */ c(
337
337
  "li",
338
338
  {
339
339
  "data-carousel-item": "",
340
- "aria-label": G ? `${e + 1} of ${E}` : void 0,
341
- style: _t,
342
- className: w(
340
+ "aria-label": G ? Q.position(e + 1, T) : void 0,
341
+ style: Bt,
342
+ className: y(
343
343
  "rst:shrink-0",
344
- L === "start" ? "rst:snap-start" : "rst:snap-center",
344
+ R === "start" ? "rst:snap-start" : "rst:snap-center",
345
345
  at && "rst:snap-always",
346
- mt
346
+ xt
347
347
  ),
348
348
  children: t
349
349
  },
@@ -351,13 +351,13 @@ const ot = {
351
351
  ))
352
352
  }
353
353
  ),
354
- !T && M === "overlay" && $ && /* @__PURE__ */ y($t, { children: [
355
- /* @__PURE__ */ c("div", { className: "rst:pointer-events-none rst:absolute rst:inset-y-0 rst:start-1 rst:flex rst:items-center", children: /* @__PURE__ */ c("div", { className: "rst:pointer-events-auto", children: k }) }),
354
+ !I && M === "overlay" && $ && /* @__PURE__ */ C(Ht, { children: [
355
+ /* @__PURE__ */ c("div", { className: "rst:pointer-events-none rst:absolute rst:inset-y-0 rst:start-1 rst:flex rst:items-center", children: /* @__PURE__ */ c("div", { className: "rst:pointer-events-auto", children: L }) }),
356
356
  /* @__PURE__ */ c("div", { className: "rst:pointer-events-none rst:absolute rst:inset-y-0 rst:end-1 rst:flex rst:items-center", children: /* @__PURE__ */ c("div", { className: "rst:pointer-events-auto", children: B }) })
357
357
  ] })
358
358
  ] })
359
359
  ] });
360
360
  });
361
361
  export {
362
- ce as Carousel
362
+ fe as Carousel
363
363
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime");require("react");const d=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),u=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),n=require("../../../lib/utils.cjs"),x=require("./error-state-variants.cjs"),m=require("../../atoms/Button/Button.cjs"),h=({title:c="An Error Occurred",description:i,onRetry:e,action:s,icon:l,variant:t,className:a,...o})=>r.jsxs("div",{className:n.cn(x.errorStateVariants({variant:t}),a),...o,children:[r.jsx("div",{className:"rst:mb-4 rst:flex rst:h-12 rst:w-12 rst:items-center rst:justify-center rst:rounded-full rst:bg-error-100 rst:text-error-600 rst:dark:bg-error-500/15 rst:dark:text-error-400",children:r.jsx("div",{className:"rst:h-6 rst:w-6 rst:flex rst:items-center rst:justify-center",children:l||r.jsx(d.FontAwesomeIcon,{icon:u.faTriangleExclamation,className:"rst:h-full rst:w-full"})})}),r.jsx("h3",{className:"rst:text-lg rst:font-bold rst:tracking-tight",children:c}),r.jsx("p",{className:n.cn("rst:mt-2 rst:text-sm rst:leading-relaxed",t==="card"?"rst:text-error-800/80 rst:dark:text-error-200/80":"rst:text-gray-500 rst:dark:text-gray-400"),children:i}),r.jsx("div",{className:"rst:mt-6",children:s||(e?r.jsx(m.Button,{onClick:e,colorScheme:"error",variant:t==="card"?"outline":"solid",children:"Try Again"}):null)})]});exports.ErrorState=h;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime");require("react");const x=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),m=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),l=require("../../../lib/utils.cjs"),h=require("../../../lib/labels.cjs"),g=require("./error-state-variants.cjs"),j=require("../../atoms/Button/Button.cjs"),f={retry:"Try Again"},b=({title:n="An Error Occurred",description:c,onRetry:e,action:s,icon:i,labels:a,variant:t,className:o,...d})=>{const u=h.withLabels(f,a);return r.jsxs("div",{className:l.cn(g.errorStateVariants({variant:t}),o),...d,children:[r.jsx("div",{className:"rst:mb-4 rst:flex rst:h-12 rst:w-12 rst:items-center rst:justify-center rst:rounded-full rst:bg-error-100 rst:text-error-600 rst:dark:bg-error-500/15 rst:dark:text-error-400",children:r.jsx("div",{className:"rst:h-6 rst:w-6 rst:flex rst:items-center rst:justify-center",children:i||r.jsx(x.FontAwesomeIcon,{icon:m.faTriangleExclamation,className:"rst:h-full rst:w-full"})})}),r.jsx("h3",{className:"rst:text-lg rst:font-bold rst:tracking-tight",children:n}),r.jsx("p",{className:l.cn("rst:mt-2 rst:text-sm rst:leading-relaxed",t==="card"?"rst:text-error-800/80 rst:dark:text-error-200/80":"rst:text-gray-500 rst:dark:text-gray-400"),children:c}),r.jsx("div",{className:"rst:mt-6",children:s||(e?r.jsx(j.Button,{onClick:e,colorScheme:"error",variant:t==="card"?"outline":"solid",children:u.retry}):null)})]})};exports.ErrorState=b;
@@ -1,12 +1,19 @@
1
1
  import { default as React } from 'react';
2
2
  import { VariantProps } from 'class-variance-authority';
3
3
  import { errorStateVariants } from './error-state-variants';
4
+ /** Every word ErrorState shows of its own, past its `title`. Pass any of them in `labels` to replace it. */
5
+ export interface ErrorStateLabels {
6
+ /** The retry button, with `onRetry`. */
7
+ retry: string;
8
+ }
4
9
  export interface ErrorStateProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof errorStateVariants> {
5
10
  title?: string;
6
11
  description: string;
7
12
  onRetry?: () => void;
8
13
  action?: React.ReactNode;
9
14
  icon?: React.ReactNode;
15
+ /** The component's own words, replaced; any left out stay English. */
16
+ labels?: Partial<ErrorStateLabels>;
10
17
  }
11
- declare const ErrorState: ({ title, description, onRetry, action, icon, variant, className, ...props }: ErrorStateProps) => import("react/jsx-runtime").JSX.Element;
18
+ declare const ErrorState: ({ title, description, onRetry, action, icon, labels, variant, className, ...props }: ErrorStateProps) => import("react/jsx-runtime").JSX.Element;
12
19
  export { ErrorState };
@@ -1,49 +1,54 @@
1
1
  "use client";
2
- import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
+ import { jsxs as f, jsx as r } from "react/jsx-runtime";
3
3
  import "react";
4
- import { FontAwesomeIcon as d } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
5
- import { faTriangleExclamation as f } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
4
+ import { FontAwesomeIcon as x } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
5
+ import { faTriangleExclamation as h } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
6
6
  import { cn as o } from "../../../lib/utils.js";
7
- import { errorStateVariants as x } from "./error-state-variants.js";
8
- import { Button as h } from "../../atoms/Button/Button.js";
9
- const w = ({
7
+ import { withLabels as u } from "../../../lib/labels.js";
8
+ import { errorStateVariants as g } from "./error-state-variants.js";
9
+ import { Button as p } from "../../atoms/Button/Button.js";
10
+ const N = { retry: "Try Again" }, v = ({
10
11
  title: l = "An Error Occurred",
11
12
  description: i,
12
13
  onRetry: e,
13
14
  action: s,
14
- icon: a,
15
+ icon: c,
16
+ labels: a,
15
17
  variant: t,
16
- className: c,
17
- ...m
18
- }) => /* @__PURE__ */ n("div", { className: o(x({ variant: t }), c), ...m, children: [
19
- /* @__PURE__ */ r("div", { className: "rst:mb-4 rst:flex rst:h-12 rst:w-12 rst:items-center rst:justify-center rst:rounded-full rst:bg-error-100 rst:text-error-600 rst:dark:bg-error-500/15 rst:dark:text-error-400", children: /* @__PURE__ */ r("div", { className: "rst:h-6 rst:w-6 rst:flex rst:items-center rst:justify-center", children: a || /* @__PURE__ */ r(
20
- d,
21
- {
22
- icon: f,
23
- className: "rst:h-full rst:w-full"
24
- }
25
- ) }) }),
26
- /* @__PURE__ */ r("h3", { className: "rst:text-lg rst:font-bold rst:tracking-tight", children: l }),
27
- /* @__PURE__ */ r(
28
- "p",
29
- {
30
- className: o(
31
- "rst:mt-2 rst:text-sm rst:leading-relaxed",
32
- t === "card" ? "rst:text-error-800/80 rst:dark:text-error-200/80" : "rst:text-gray-500 rst:dark:text-gray-400"
33
- ),
34
- children: i
35
- }
36
- ),
37
- /* @__PURE__ */ r("div", { className: "rst:mt-6", children: s || (e ? /* @__PURE__ */ r(
38
- h,
39
- {
40
- onClick: e,
41
- colorScheme: "error",
42
- variant: t === "card" ? "outline" : "solid",
43
- children: "Try Again"
44
- }
45
- ) : null) })
46
- ] });
18
+ className: m,
19
+ ...n
20
+ }) => {
21
+ const d = u(N, a);
22
+ return /* @__PURE__ */ f("div", { className: o(g({ variant: t }), m), ...n, children: [
23
+ /* @__PURE__ */ r("div", { className: "rst:mb-4 rst:flex rst:h-12 rst:w-12 rst:items-center rst:justify-center rst:rounded-full rst:bg-error-100 rst:text-error-600 rst:dark:bg-error-500/15 rst:dark:text-error-400", children: /* @__PURE__ */ r("div", { className: "rst:h-6 rst:w-6 rst:flex rst:items-center rst:justify-center", children: c || /* @__PURE__ */ r(
24
+ x,
25
+ {
26
+ icon: h,
27
+ className: "rst:h-full rst:w-full"
28
+ }
29
+ ) }) }),
30
+ /* @__PURE__ */ r("h3", { className: "rst:text-lg rst:font-bold rst:tracking-tight", children: l }),
31
+ /* @__PURE__ */ r(
32
+ "p",
33
+ {
34
+ className: o(
35
+ "rst:mt-2 rst:text-sm rst:leading-relaxed",
36
+ t === "card" ? "rst:text-error-800/80 rst:dark:text-error-200/80" : "rst:text-gray-500 rst:dark:text-gray-400"
37
+ ),
38
+ children: i
39
+ }
40
+ ),
41
+ /* @__PURE__ */ r("div", { className: "rst:mt-6", children: s || (e ? /* @__PURE__ */ r(
42
+ p,
43
+ {
44
+ onClick: e,
45
+ colorScheme: "error",
46
+ variant: t === "card" ? "outline" : "solid",
47
+ children: d.retry
48
+ }
49
+ ) : null) })
50
+ ] });
51
+ };
47
52
  export {
48
- w as ErrorState
53
+ v as ErrorState
49
54
  };