@almanaclabs/blaze-ui 0.23.0 → 0.25.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 (40) hide show
  1. package/dist/components/app-shell/app-shell.d.ts +6 -2
  2. package/dist/components/app-shell/app-shell.d.ts.map +1 -1
  3. package/dist/components/app-shell/app-shell.js +35 -17
  4. package/dist/components/button/button.d.ts.map +1 -1
  5. package/dist/components/button/button.js +17 -16
  6. package/dist/components/chat-bar/chat-bar.d.ts +14 -2
  7. package/dist/components/chat-bar/chat-bar.d.ts.map +1 -1
  8. package/dist/components/chat-bar/chat-bar.js +64 -37
  9. package/dist/components/chat-list/chat-list.d.ts +48 -0
  10. package/dist/components/chat-list/chat-list.d.ts.map +1 -0
  11. package/dist/components/chat-list/chat-list.js +95 -0
  12. package/dist/components/chat-list/index.d.ts +2 -0
  13. package/dist/components/chat-list/index.d.ts.map +1 -0
  14. package/dist/components/chat-panel/chat-panel.d.ts +39 -0
  15. package/dist/components/chat-panel/chat-panel.d.ts.map +1 -0
  16. package/dist/components/chat-panel/chat-panel.js +153 -0
  17. package/dist/components/chat-panel/index.d.ts +2 -0
  18. package/dist/components/chat-panel/index.d.ts.map +1 -0
  19. package/dist/components/dropdown-menu/dropdown-menu.js +1 -1
  20. package/dist/components/post-card/post-card.d.ts +13 -1
  21. package/dist/components/post-card/post-card.d.ts.map +1 -1
  22. package/dist/components/post-card/post-card.js +151 -142
  23. package/dist/components/selectable-tile/index.d.ts +2 -0
  24. package/dist/components/selectable-tile/index.d.ts.map +1 -0
  25. package/dist/components/selectable-tile/selectable-tile.d.ts +40 -0
  26. package/dist/components/selectable-tile/selectable-tile.d.ts.map +1 -0
  27. package/dist/components/selectable-tile/selectable-tile.js +54 -0
  28. package/dist/components/sheet/sheet.d.ts +15 -2
  29. package/dist/components/sheet/sheet.d.ts.map +1 -1
  30. package/dist/components/sheet/sheet.js +25 -12
  31. package/dist/components/slide-deck/index.d.ts +2 -0
  32. package/dist/components/slide-deck/index.d.ts.map +1 -0
  33. package/dist/components/slide-deck/slide-deck.d.ts +50 -0
  34. package/dist/components/slide-deck/slide-deck.d.ts.map +1 -0
  35. package/dist/components/slide-deck/slide-deck.js +201 -0
  36. package/dist/index.d.ts +4 -0
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +81 -77
  39. package/package.json +1 -1
  40. package/src/styles/globals.css +8 -0
@@ -3,250 +3,259 @@ import { Button as t } from "../button/button.js";
3
3
  import { DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuSeparator as a, DropdownMenuTrigger as o } from "../dropdown-menu/dropdown-menu.js";
4
4
  import { Avatar as s, AvatarFallback as c, AvatarImage as ee } from "../avatar/avatar.js";
5
5
  import * as l from "react";
6
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
7
- import { IconDots as te, IconGripVertical as ne, IconPhoto as p, IconPlus as re, IconSparkles as ie } from "@tabler/icons-react";
6
+ import { Fragment as te, jsx as u, jsxs as d } from "react/jsx-runtime";
7
+ import { IconDots as ne, IconGripVertical as re, IconPhoto as f, IconPlus as ie, IconSparkles as ae } from "@tabler/icons-react";
8
8
  //#region src/components/post-card/post-card.tsx
9
- var m = l.createContext(null);
10
- function h({ onReorder: t, className: n, children: r, ...i }) {
9
+ var p = l.createContext(null);
10
+ function m({ onReorder: t, className: n, children: r, ...i }) {
11
11
  let [a, o] = l.useState(""), s = l.useRef(null), c = l.useMemo(() => ({
12
12
  reorder: t,
13
13
  announce: o,
14
14
  dragging: s
15
15
  }), [t]);
16
- return /* @__PURE__ */ f(m.Provider, {
16
+ return /* @__PURE__ */ d(p.Provider, {
17
17
  value: c,
18
- children: [/* @__PURE__ */ d("ol", {
18
+ children: [/* @__PURE__ */ u("ol", {
19
19
  "data-slot": "post-card-list",
20
20
  className: e("m-0 flex list-none flex-col rounded-2xl bg-card p-0 shadow-[0_0_0_1px_var(--border),0_2px_4px_rgb(0_0_0/0.04)]", n),
21
21
  ...i,
22
22
  children: r
23
- }), /* @__PURE__ */ d("span", {
23
+ }), /* @__PURE__ */ u("span", {
24
24
  role: "status",
25
25
  className: "sr-only",
26
26
  children: a
27
27
  })]
28
28
  });
29
29
  }
30
- var g = "opacity-0 transition-opacity group-hover/post:opacity-100 group-focus-within/post:opacity-100 group-has-[[data-popup-open]]/post:opacity-100 pointer-coarse:opacity-100";
31
- function _({ author: t, text: n = "", onSave: r, children: o, length: h, busy: _ = !1, limit: oe = 280, countFrom: b, media: x, position: S, onInsertBelow: C, onAddImage: w, imageMenu: T, assistMenu: E, moreMenu: D, connector: se = !1, textLabel: ce, className: le, ...ue }) {
32
- let O = l.useContext(m), k = ce ?? (S ? `Post ${S.index}` : "Post"), [A, j] = l.useState(!1), [M, N] = l.useState(n), [P, F] = l.useState("idle"), [I, L] = l.useState(null), R = l.useRef(null), z = l.useRef(null), B = l.useRef(null), V = l.useRef(!1), H = l.useRef(!1), U = l.useId(), W = l.useId();
30
+ var h = "opacity-0 transition-opacity group-hover/post:opacity-100 group-focus-within/post:opacity-100 group-has-[[data-popup-open]]/post:opacity-100 pointer-coarse:opacity-100";
31
+ function g({ author: t, text: n = "", onSave: r, children: o, length: m, busy: g = !1, limit: se = 280, countFrom: ce, media: le, position: y, onInsertBelow: b, onAddImage: x, imageMenu: S, assistMenu: C, moreMenu: w, connector: ue = !1, textLabel: de, actionTarget: T, assistLabel: E = "Ask Blaze", className: fe, ...pe }) {
32
+ let D = l.useContext(p), O = de ?? (y ? `Post ${y.index}` : "Post"), [k, A] = l.useState(!1), [j, M] = l.useState(n), [N, P] = l.useState("idle"), [F, I] = l.useState(null), L = l.useRef(null), R = l.useRef(null), z = l.useRef(null), B = l.useRef(!1), V = l.useRef(!1), H = l.useId(), U = l.useId();
33
33
  l.useEffect(() => {
34
- A || N(n);
35
- }, [n, A]), l.useEffect(() => {
36
- _ && j(!1);
37
- }, [_]), l.useEffect(() => {
38
- A || !H.current || (H.current = !1, B.current?.focus());
39
- }, [A]), l.useEffect(() => {
40
- if (P !== "armed") return;
41
- let e = () => F((e) => e === "armed" ? "idle" : e);
34
+ k || M(n);
35
+ }, [n, k]), l.useEffect(() => {
36
+ g && A(!1);
37
+ }, [g]), l.useEffect(() => {
38
+ k || !V.current || (V.current = !1, z.current?.focus());
39
+ }, [k]), l.useEffect(() => {
40
+ if (N !== "armed") return;
41
+ let e = () => P((e) => e === "armed" ? "idle" : e);
42
42
  return window.addEventListener("pointerup", e), window.addEventListener("pointercancel", e), () => {
43
43
  window.removeEventListener("pointerup", e), window.removeEventListener("pointercancel", e);
44
44
  };
45
- }, [P]), l.useLayoutEffect(() => {
46
- let e = R.current;
47
- !A || !e || (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
48
- }, [A, M]), l.useEffect(() => {
49
- V.current && (V.current = !1, z.current?.focus());
50
- }, [S?.index]);
51
- let G = h?.limit ?? oe, K = h?.count ?? (A ? M.length : n.length), q = A || K > G || K >= (b ?? G - 30), de = () => {
52
- j(!1);
53
- let e = M.trim();
54
- e === n ? N(n) : r?.(e);
55
- }, fe = t.name.trim().slice(0, 1).toUpperCase(), J = O?.reorder && S && !_ ? O.reorder : void 0, Y = (S?.index ?? 1) - 1, X = S?.total ?? 1, Z = (e, t) => {
56
- !J || e < 0 || e >= X || e === Y || (V.current = t, J(Y, e), O?.announce(`${k} moved to ${e + 1} of ${X}.`));
57
- }, pe = (e) => {
58
- let t = O?.dragging.current;
45
+ }, [N]), l.useLayoutEffect(() => {
46
+ let e = L.current;
47
+ !k || !e || (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
48
+ }, [k, j]), l.useEffect(() => {
49
+ B.current && (B.current = !1, R.current?.focus());
50
+ }, [y?.index]);
51
+ let W = m?.limit ?? se, G = m?.count ?? (k ? j.length : n.length), K = k || G > W || G >= (ce ?? W - 30), me = () => {
52
+ A(!1);
53
+ let e = j.trim();
54
+ e === n ? M(n) : r?.(e);
55
+ }, he = t.name.trim().slice(0, 1).toUpperCase(), q = D?.reorder && y && !g ? D.reorder : void 0, J = q && !T, Y = (y?.index ?? 1) - 1, X = y?.total ?? 1, Z = (e, t) => {
56
+ !q || e < 0 || e >= X || e === Y || (B.current = t, q(Y, e), D?.announce(`${O} moved to ${e + 1} of ${X}.`));
57
+ }, ge = (e) => {
58
+ let t = D?.dragging.current;
59
59
  if (t == null) return null;
60
60
  let n = e === "after" ? Y + 1 : Y;
61
61
  return n > t ? n - 1 : n;
62
- }, me = O ? "li" : "div", Q = !!(S && X > 1), $ = !!(C || w || T || E || D || J);
63
- return /* @__PURE__ */ f(me, {
62
+ }, _e = D ? "li" : "div", ve = T ? T.total > 1 : !!(y && X > 1), Q = T ? `${T.noun} ${T.index}` : O, $ = T ? {
63
+ noun: T.noun.charAt(0).toUpperCase() + T.noun.slice(1),
64
+ index: T.index,
65
+ total: T.total
66
+ } : {
67
+ noun: "Post",
68
+ index: y?.index ?? 1,
69
+ total: X
70
+ }, ye = !!(b || x || S || C || w || q);
71
+ return /* @__PURE__ */ d(_e, {
64
72
  "data-slot": "post-card",
65
- "aria-busy": _ || void 0,
66
- "data-dragging": P === "dragging" ? "" : void 0,
67
- "data-drop": I ?? void 0,
68
- draggable: P !== "idle",
73
+ "aria-busy": g || void 0,
74
+ "data-dragging": N === "dragging" ? "" : void 0,
75
+ "data-drop": F ?? void 0,
76
+ draggable: N !== "idle",
69
77
  onDragStart: (e) => {
70
- P === "idle" || !O || (O.dragging.current = Y, e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", k), F("dragging"));
78
+ N === "idle" || !D || (D.dragging.current = Y, e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", O), P("dragging"));
71
79
  },
72
80
  onDragEnd: () => {
73
- O && (O.dragging.current = null), F("idle");
81
+ D && (D.dragging.current = null), P("idle");
74
82
  },
75
83
  onDragOver: (e) => {
76
- if (O?.dragging.current == null || !J) return;
84
+ if (D?.dragging.current == null || !q) return;
77
85
  e.preventDefault();
78
86
  let t = e.currentTarget.getBoundingClientRect();
79
- L(e.clientY < t.top + t.height / 2 ? "before" : "after");
87
+ I(e.clientY < t.top + t.height / 2 ? "before" : "after");
80
88
  },
81
- onDragLeave: () => L(null),
89
+ onDragLeave: () => I(null),
82
90
  onDrop: (e) => {
83
- if (!I) return;
91
+ if (!F) return;
84
92
  e.preventDefault();
85
- let t = O?.dragging.current, n = pe(I);
86
- L(null), t != null && n != null && n !== t && (J?.(t, n), O?.announce(`Post ${t + 1} moved to ${n + 1} of ${X}.`));
93
+ let t = D?.dragging.current, n = ge(F);
94
+ I(null), t != null && n != null && n !== t && (q?.(t, n), D?.announce(`Post ${t + 1} moved to ${n + 1} of ${X}.`));
87
95
  },
88
- className: e("group/post relative flex gap-2.5 px-4 pt-3 pb-1 pl-6", "data-[drop=after]:after:absolute data-[drop=after]:after:inset-x-4 data-[drop=after]:after:-bottom-px data-[drop=after]:after:h-0.5 data-[drop=after]:after:rounded-full data-[drop=after]:after:bg-primary data-[drop=before]:before:absolute data-[drop=before]:before:inset-x-4 data-[drop=before]:before:-top-px data-[drop=before]:before:h-0.5 data-[drop=before]:before:rounded-full data-[drop=before]:before:bg-primary", "data-dragging:opacity-50", le),
89
- ...ue,
96
+ className: e("group/post relative flex gap-2.5 px-4 pt-3 pb-1 pl-6", "data-[drop=after]:after:absolute data-[drop=after]:after:inset-x-4 data-[drop=after]:after:-bottom-px data-[drop=after]:after:h-0.5 data-[drop=after]:after:rounded-full data-[drop=after]:after:bg-primary data-[drop=before]:before:absolute data-[drop=before]:before:inset-x-4 data-[drop=before]:before:-top-px data-[drop=before]:before:h-0.5 data-[drop=before]:before:rounded-full data-[drop=before]:before:bg-primary", "data-dragging:opacity-50", fe),
97
+ ...pe,
90
98
  children: [
91
- J ? /* @__PURE__ */ f("button", {
92
- ref: z,
99
+ q ? /* @__PURE__ */ d("button", {
100
+ ref: R,
93
101
  type: "button",
94
102
  "data-slot": "post-card-handle",
95
- "aria-label": `Reorder ${k}, ${S.index} of ${X}`,
96
- "aria-describedby": U,
97
- onPointerDown: () => F("armed"),
103
+ "aria-label": `Reorder ${O}, ${y.index} of ${X}`,
104
+ "aria-describedby": H,
105
+ onPointerDown: () => P("armed"),
98
106
  onKeyDown: (e) => {
99
107
  if (e.key === "ArrowUp") Z(Y - 1, !0);
100
108
  else if (e.key === "ArrowDown") Z(Y + 1, !0);
101
109
  else return;
102
110
  e.preventDefault();
103
111
  },
104
- className: e("absolute top-4 left-0.5 flex h-7 w-5 cursor-grab touch-none items-center justify-center rounded-sm text-foreground-tertiary outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:cursor-grabbing", g),
105
- children: [/* @__PURE__ */ d(ne, {
112
+ className: e("absolute top-4 left-0.5 flex h-7 w-5 cursor-grab touch-none items-center justify-center rounded-sm text-foreground-tertiary outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:cursor-grabbing", h),
113
+ children: [/* @__PURE__ */ u(re, {
106
114
  "aria-hidden": "true",
107
115
  className: "size-4"
108
- }), /* @__PURE__ */ d("span", {
109
- id: U,
116
+ }), /* @__PURE__ */ u("span", {
117
+ id: H,
110
118
  className: "sr-only",
111
119
  children: "Drag, or use the up and down arrow keys, to move it."
112
120
  })]
113
121
  }) : null,
114
- /* @__PURE__ */ f("span", {
122
+ /* @__PURE__ */ d("span", {
115
123
  className: "flex w-10 flex-none flex-col items-center",
116
- children: [t.avatar ?? /* @__PURE__ */ f(s, {
124
+ children: [t.avatar ?? /* @__PURE__ */ d(s, {
117
125
  size: "lg",
118
- children: [t.avatarSrc ? /* @__PURE__ */ d(ee, {
126
+ children: [t.avatarSrc ? /* @__PURE__ */ u(ee, {
119
127
  src: t.avatarSrc,
120
128
  alt: ""
121
- }) : null, /* @__PURE__ */ d(c, { children: fe })]
122
- }), se ? /* @__PURE__ */ d("span", {
129
+ }) : null, /* @__PURE__ */ u(c, { children: he })]
130
+ }), ue ? /* @__PURE__ */ u("span", {
123
131
  "aria-hidden": "true",
124
132
  className: "mt-1 w-0.5 flex-1 rounded-full bg-border"
125
133
  }) : null]
126
134
  }),
127
- /* @__PURE__ */ f("div", {
135
+ /* @__PURE__ */ d("div", {
128
136
  className: "flex min-w-0 flex-1 flex-col pb-2",
129
137
  children: [
130
- /* @__PURE__ */ f("div", {
138
+ /* @__PURE__ */ d("div", {
131
139
  className: "type-body flex items-center gap-1",
132
- children: [/* @__PURE__ */ d("span", {
140
+ children: [/* @__PURE__ */ u("span", {
133
141
  className: "truncate font-medium",
134
142
  children: t.name
135
- }), t.handle ? /* @__PURE__ */ d("span", {
143
+ }), t.handle ? /* @__PURE__ */ u("span", {
136
144
  className: "truncate text-muted-foreground",
137
145
  children: t.handle
138
146
  }) : null]
139
147
  }),
140
- o == null ? A ? /* @__PURE__ */ d("textarea", {
141
- ref: R,
142
- "aria-label": k,
148
+ o == null ? k ? /* @__PURE__ */ u("textarea", {
149
+ ref: L,
150
+ "aria-label": O,
143
151
  autoFocus: !0,
144
- value: M,
145
- onChange: (e) => N(e.target.value),
152
+ value: j,
153
+ onChange: (e) => M(e.target.value),
146
154
  onFocus: (e) => {
147
155
  let t = e.currentTarget.value.length;
148
156
  e.currentTarget.setSelectionRange(t, t);
149
157
  },
150
- onBlur: de,
158
+ onBlur: me,
151
159
  onKeyDown: (e) => {
152
- e.key === "Escape" && (H.current = !0, N(n), j(!1));
160
+ e.key === "Escape" && (V.current = !0, M(n), A(!1));
153
161
  },
154
162
  className: "type-content -mx-1 mt-0.5 block w-full resize-none rounded-md bg-muted p-1 text-foreground outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
155
- }) : r && !_ ? /* @__PURE__ */ f("button", {
156
- ref: B,
163
+ }) : r && !g ? /* @__PURE__ */ d("button", {
164
+ ref: z,
157
165
  type: "button",
158
166
  "data-slot": "post-card-text",
159
- "aria-describedby": W,
160
- onClick: () => j(!0),
167
+ "aria-label": n.trim() ? void 0 : `Edit ${O}`,
168
+ "aria-describedby": U,
169
+ onClick: () => A(!0),
161
170
  className: "type-content -mx-1 mt-0.5 block w-full cursor-text rounded-md p-1 text-left whitespace-pre-wrap text-foreground [overflow-wrap:anywhere] outline-none hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",
162
- children: [n, /* @__PURE__ */ f("span", {
163
- id: W,
171
+ children: [n, /* @__PURE__ */ d("span", {
172
+ id: U,
164
173
  "aria-hidden": "true",
165
174
  className: "sr-only",
166
- children: ["Edit ", k]
175
+ children: ["Edit ", O]
167
176
  })]
168
- }) : /* @__PURE__ */ d("p", {
177
+ }) : /* @__PURE__ */ u("p", {
169
178
  "data-slot": "post-card-text",
170
- className: e("type-content m-0 mt-0.5 p-1 -mx-1 whitespace-pre-wrap text-foreground transition-colors [overflow-wrap:anywhere]", _ && "text-muted-foreground"),
179
+ className: e("type-content m-0 mt-0.5 p-1 -mx-1 whitespace-pre-wrap text-foreground transition-colors [overflow-wrap:anywhere]", g && "text-muted-foreground"),
171
180
  children: n
172
- }) : /* @__PURE__ */ d("div", {
181
+ }) : /* @__PURE__ */ u("div", {
173
182
  "data-slot": "post-card-text",
174
- inert: _,
175
- className: e("type-content mt-0.5 text-foreground transition-colors", _ && "text-muted-foreground"),
183
+ inert: g,
184
+ className: e("type-content mt-0.5 text-foreground transition-colors", g && "text-muted-foreground"),
176
185
  children: o
177
186
  }),
178
- x ? /* @__PURE__ */ d("div", {
187
+ le ? /* @__PURE__ */ u("div", {
179
188
  className: "mt-2 flex flex-col gap-2",
180
- children: x
189
+ children: le
181
190
  }) : null,
182
- $ || q || Q ? /* @__PURE__ */ f("div", {
191
+ ye || K || ve ? /* @__PURE__ */ d("div", {
183
192
  className: "mt-1 flex min-h-8 items-center gap-1",
184
193
  children: [
185
- $ ? /* @__PURE__ */ f("div", {
194
+ ye ? /* @__PURE__ */ d("div", {
186
195
  role: "group",
187
- "aria-label": `${k} actions`,
196
+ "aria-label": `${T ? $.noun + " " + T.index : O} actions`,
188
197
  "data-slot": "post-card-actions",
189
- className: e("-ml-1.5 flex items-center gap-0.5", g),
198
+ className: e("-ml-1.5 flex items-center gap-0.5", h),
190
199
  children: [
191
- C ? /* @__PURE__ */ d(v, {
192
- label: "Add a post below",
193
- onClick: C,
194
- disabled: _,
195
- children: /* @__PURE__ */ d(re, { "aria-hidden": "true" })
200
+ b ? /* @__PURE__ */ u(_, {
201
+ label: T ? `Add a ${T.noun}` : "Add a post below",
202
+ onClick: b,
203
+ disabled: g,
204
+ children: /* @__PURE__ */ u(ie, { "aria-hidden": "true" })
196
205
  }) : null,
197
- T ? /* @__PURE__ */ d(y, {
198
- label: "Add an image",
199
- items: T,
200
- disabled: _,
201
- children: /* @__PURE__ */ d(p, { "aria-hidden": "true" })
202
- }) : w ? /* @__PURE__ */ d(v, {
203
- label: "Add an image",
204
- onClick: w,
205
- disabled: _,
206
- children: /* @__PURE__ */ d(p, { "aria-hidden": "true" })
206
+ S ? /* @__PURE__ */ u(v, {
207
+ label: T ? `Photo for ${Q}` : "Add an image",
208
+ items: S,
209
+ disabled: g,
210
+ children: /* @__PURE__ */ u(f, { "aria-hidden": "true" })
211
+ }) : x ? /* @__PURE__ */ u(_, {
212
+ label: T ? `Photo for ${Q}` : "Add an image",
213
+ onClick: x,
214
+ disabled: g,
215
+ children: /* @__PURE__ */ u(f, { "aria-hidden": "true" })
207
216
  }) : null,
208
- E ? /* @__PURE__ */ d(y, {
209
- label: "Ask Blaze",
210
- items: E,
211
- disabled: _,
212
- children: /* @__PURE__ */ d(ie, { "aria-hidden": "true" })
217
+ C ? /* @__PURE__ */ u(v, {
218
+ label: T ? `${E} for ${Q}` : E,
219
+ items: C,
220
+ disabled: g,
221
+ children: /* @__PURE__ */ u(ae, { "aria-hidden": "true" })
213
222
  }) : null,
214
- D || J ? /* @__PURE__ */ d(y, {
215
- label: `More for ${k}`,
216
- disabled: _,
217
- items: /* @__PURE__ */ f(u, { children: [
218
- D,
219
- D && J ? /* @__PURE__ */ d(a, {}) : null,
220
- J ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(i, {
223
+ w || J ? /* @__PURE__ */ u(v, {
224
+ label: `More for ${Q}`,
225
+ disabled: g,
226
+ items: /* @__PURE__ */ d(te, { children: [
227
+ w,
228
+ w && J ? /* @__PURE__ */ u(a, {}) : null,
229
+ J ? /* @__PURE__ */ d(te, { children: [/* @__PURE__ */ u(i, {
221
230
  disabled: Y === 0,
222
231
  onClick: () => Z(Y - 1, !1),
223
232
  children: "Move up"
224
- }), /* @__PURE__ */ d(i, {
233
+ }), /* @__PURE__ */ u(i, {
225
234
  disabled: Y === X - 1,
226
235
  onClick: () => Z(Y + 1, !1),
227
236
  children: "Move down"
228
237
  })] }) : null
229
238
  ] }),
230
- children: /* @__PURE__ */ d(te, { "aria-hidden": "true" })
239
+ children: /* @__PURE__ */ u(ne, { "aria-hidden": "true" })
231
240
  }) : null
232
241
  ]
233
242
  }) : null,
234
- Q ? /* @__PURE__ */ f("span", {
243
+ ve ? /* @__PURE__ */ d("span", {
235
244
  "data-slot": "post-card-position",
236
- className: e("type-meta flex-none text-foreground-tertiary tabular-nums", g),
245
+ className: e("type-meta flex-none text-foreground-tertiary tabular-nums", h),
237
246
  children: [
238
247
  /* @__PURE__ */ d("span", {
239
248
  className: "sr-only",
240
- children: "Post "
249
+ children: [$.noun, " "]
241
250
  }),
242
- S.index,
251
+ $.index,
243
252
  "/",
244
- X
253
+ $.total
245
254
  ]
246
255
  }) : null,
247
- q ? /* @__PURE__ */ d(ae, {
248
- count: K,
249
- limit: G
256
+ K ? /* @__PURE__ */ u(oe, {
257
+ count: G,
258
+ limit: W
250
259
  }) : null
251
260
  ]
252
261
  }) : null
@@ -255,8 +264,8 @@ function _({ author: t, text: n = "", onSave: r, children: o, length: h, busy: _
255
264
  ]
256
265
  });
257
266
  }
258
- function v({ label: e, children: n, ...r }) {
259
- return /* @__PURE__ */ d(t, {
267
+ function _({ label: e, children: n, ...r }) {
268
+ return /* @__PURE__ */ u(t, {
260
269
  type: "button",
261
270
  "aria-label": e,
262
271
  title: e,
@@ -266,9 +275,9 @@ function v({ label: e, children: n, ...r }) {
266
275
  children: n
267
276
  });
268
277
  }
269
- function y({ label: e, items: i, disabled: a, children: s }) {
270
- return /* @__PURE__ */ f(n, { children: [/* @__PURE__ */ d(o, {
271
- render: /* @__PURE__ */ d(t, {
278
+ function v({ label: e, items: i, disabled: a, children: s }) {
279
+ return /* @__PURE__ */ d(n, { children: [/* @__PURE__ */ u(o, {
280
+ render: /* @__PURE__ */ u(t, {
272
281
  type: "button",
273
282
  "aria-label": e,
274
283
  title: e,
@@ -277,19 +286,19 @@ function y({ label: e, items: i, disabled: a, children: s }) {
277
286
  disabled: a
278
287
  }),
279
288
  children: s
280
- }), /* @__PURE__ */ d(r, {
289
+ }), /* @__PURE__ */ u(r, {
281
290
  align: "start",
282
291
  children: i
283
292
  })] });
284
293
  }
285
- function ae({ count: t, limit: n }) {
294
+ function oe({ count: t, limit: n }) {
286
295
  let r = n - t, i = r < 0 ? "text-destructive" : r <= 20 ? "text-warning" : "text-foreground-tertiary", a = 2 * Math.PI * 8, o = Math.min(t / n, 1);
287
- return /* @__PURE__ */ f("span", {
296
+ return /* @__PURE__ */ d("span", {
288
297
  "data-slot": "post-card-count",
289
298
  "data-over": r < 0 ? "" : void 0,
290
299
  className: e("type-meta ml-auto flex items-center gap-1.5", i),
291
300
  children: [
292
- /* @__PURE__ */ f("span", {
301
+ /* @__PURE__ */ d("span", {
293
302
  className: "sr-only",
294
303
  children: [
295
304
  t,
@@ -298,25 +307,25 @@ function ae({ count: t, limit: n }) {
298
307
  " characters"
299
308
  ]
300
309
  }),
301
- r <= 20 ? /* @__PURE__ */ d("span", {
310
+ r <= 20 ? /* @__PURE__ */ u("span", {
302
311
  "aria-hidden": "true",
303
312
  className: "tabular-nums",
304
313
  children: r
305
314
  }) : null,
306
- /* @__PURE__ */ f("svg", {
315
+ /* @__PURE__ */ d("svg", {
307
316
  "aria-hidden": "true",
308
317
  viewBox: "0 0 20 20",
309
318
  width: "20",
310
319
  height: "20",
311
320
  className: "flex-none -rotate-90",
312
- children: [/* @__PURE__ */ d("circle", {
321
+ children: [/* @__PURE__ */ u("circle", {
313
322
  cx: "10",
314
323
  cy: "10",
315
324
  r: 8,
316
325
  fill: "none",
317
326
  strokeWidth: "2",
318
327
  className: "stroke-border"
319
- }), /* @__PURE__ */ d("circle", {
328
+ }), /* @__PURE__ */ u("circle", {
320
329
  cx: "10",
321
330
  cy: "10",
322
331
  r: 8,
@@ -332,4 +341,4 @@ function ae({ count: t, limit: n }) {
332
341
  });
333
342
  }
334
343
  //#endregion
335
- export { _ as PostCard, h as PostCardList };
344
+ export { g as PostCard, m as PostCardList };
@@ -0,0 +1,2 @@
1
+ export * from './selectable-tile';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/selectable-tile/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,40 @@
1
+ import * as React from 'react';
2
+ type SelectableTileProps = Omit<React.ComponentProps<'button'>, 'children'> & {
3
+ /**
4
+ * Chosen: a 2px ring and a check badge at the top right. Sets `aria-pressed`, unless you pass your own (when the
5
+ * tile's click does something else, such as "talk about this one").
6
+ */
7
+ pressed?: boolean;
8
+ /**
9
+ * The one being talked about: a primary ring. It's separate from `pressed`, so a tile can be both chosen and the
10
+ * one in focus.
11
+ */
12
+ accent?: boolean;
13
+ /** An image shortcut: a square, cropped to fill. Pass `children` for any other visual. */
14
+ src?: string;
15
+ /** The visual, such as a rendered post graphic. */
16
+ children?: React.ReactNode;
17
+ /** Under the tile: a number, a name, small actions such as Like, Not for me and Keep (`Button size="row"`). */
18
+ footer?: React.ReactNode;
19
+ /** Classes for the outer wrapper that holds the tile and its footer. */
20
+ wrapperClassName?: string;
21
+ };
22
+ /**
23
+ * A visual the owner picks: a button around an image or any rendered visual, with a check badge when chosen. Name it
24
+ * with `aria-label`. Lay several out in a `TileGrid`.
25
+ */
26
+ declare function SelectableTile({ pressed, accent, src, children, footer, className, wrapperClassName, type, ...props }: SelectableTileProps): React.JSX.Element;
27
+ declare const TILE_GRID_COLUMNS: {
28
+ readonly 2: "grid-cols-2";
29
+ readonly 3: "grid-cols-2 sm:grid-cols-3";
30
+ readonly 4: "grid-cols-2 sm:grid-cols-4";
31
+ readonly 5: "grid-cols-2 sm:grid-cols-5";
32
+ };
33
+ type TileGridProps = React.ComponentProps<'ul'> & {
34
+ /** Columns from 640px up; phones always show two. */
35
+ columns?: keyof typeof TILE_GRID_COLUMNS;
36
+ };
37
+ /** A grid of `SelectableTile`s, each in its own list item: two across on phones. */
38
+ declare function TileGrid({ columns, className, children, ...props }: TileGridProps): React.JSX.Element;
39
+ export { SelectableTile, TileGrid, type SelectableTileProps, type TileGridProps, };
40
+ //# sourceMappingURL=selectable-tile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectable-tile.d.ts","sourceRoot":"","sources":["../../../src/components/selectable-tile/selectable-tile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,KAAK,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC5E;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,0FAA0F;IAC1F,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,mDAAmD;IACnD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,+GAA+G;IAC/G,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED;;;GAGG;AACH,iBAAS,cAAc,CAAC,EACtB,OAAe,EACf,MAAc,EACd,GAAG,EACH,QAAQ,EACR,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,IAAe,EACf,GAAG,KAAK,EACT,EAAE,mBAAmB,qBAmDrB;AAED,QAAA,MAAM,iBAAiB;;;;;CAKb,CAAA;AAEV,KAAK,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG;IAChD,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,OAAO,iBAAiB,CAAA;CACzC,CAAA;AAED,oFAAoF;AACpF,iBAAS,QAAQ,CAAC,EAChB,OAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,qBAmBf;AAED,OAAO,EACL,cAAc,EACd,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,aAAa,GACnB,CAAA"}
@@ -0,0 +1,54 @@
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import * as t from "react";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { IconCheck as i } from "@tabler/icons-react";
5
+ //#region src/components/selectable-tile/selectable-tile.tsx
6
+ function a({ pressed: t = !1, accent: a = !1, src: o, children: s, footer: c, className: l, wrapperClassName: u, type: d = "button", ...f }) {
7
+ return /* @__PURE__ */ r("div", {
8
+ "data-slot": "selectable-tile",
9
+ "data-pressed": t || void 0,
10
+ "data-accent": a || void 0,
11
+ className: e("flex min-w-0 flex-col gap-2", u),
12
+ children: [/* @__PURE__ */ r("button", {
13
+ type: d,
14
+ "aria-pressed": t,
15
+ "data-slot": "selectable-tile-button",
16
+ className: e("relative block w-full overflow-hidden rounded-lg border border-border-subtle bg-card text-left outline-none transition-[border-color,box-shadow] duration-100", "hover:border-border focus-visible:ring-3 focus-visible:ring-ring/50", "disabled:pointer-events-none disabled:opacity-50", t && "border-foreground ring-2 ring-foreground hover:border-foreground", a && "border-primary ring-2 ring-primary hover:border-primary", l),
17
+ ...f,
18
+ children: [o ? /* @__PURE__ */ n("img", {
19
+ alt: "",
20
+ src: o,
21
+ className: "aspect-square w-full object-cover"
22
+ }) : s, t ? /* @__PURE__ */ n("span", {
23
+ "data-slot": "selectable-tile-check",
24
+ "aria-hidden": "true",
25
+ className: e("absolute top-1.5 right-1.5 flex size-5 items-center justify-center rounded-full text-background", a ? "bg-primary text-primary-foreground" : "bg-foreground"),
26
+ children: /* @__PURE__ */ n(i, { className: "size-3" })
27
+ }) : null]
28
+ }), c ? /* @__PURE__ */ n("div", {
29
+ "data-slot": "selectable-tile-footer",
30
+ className: "type-detail flex min-w-0 items-center gap-1 text-muted-foreground",
31
+ children: c
32
+ }) : null]
33
+ });
34
+ }
35
+ var o = {
36
+ 2: "grid-cols-2",
37
+ 3: "grid-cols-2 sm:grid-cols-3",
38
+ 4: "grid-cols-2 sm:grid-cols-4",
39
+ 5: "grid-cols-2 sm:grid-cols-5"
40
+ };
41
+ function s({ columns: r = 3, className: i, children: a, ...s }) {
42
+ return /* @__PURE__ */ n("ul", {
43
+ "data-slot": "tile-grid",
44
+ "data-columns": r,
45
+ className: e("m-0 grid list-none gap-3 p-0", o[r], i),
46
+ ...s,
47
+ children: t.Children.map(a, (e) => e == null || e === !1 ? null : /* @__PURE__ */ n("li", {
48
+ className: "min-w-0",
49
+ children: e
50
+ }))
51
+ });
52
+ }
53
+ //#endregion
54
+ export { a as SelectableTile, s as TileGrid };
@@ -3,13 +3,26 @@ import * as React from 'react';
3
3
  declare function Sheet({ ...props }: SheetPrimitive.Root.Props): React.JSX.Element;
4
4
  declare function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props): React.JSX.Element;
5
5
  declare function SheetClose({ ...props }: SheetPrimitive.Close.Props): React.JSX.Element;
6
- declare function SheetContent({ className, children, side, showCloseButton, ...props }: SheetPrimitive.Popup.Props & {
6
+ /**
7
+ * A side sheet's width from 640px up: 384, 480 or 640px, or the whole screen when it's narrower than that. Phones take
8
+ * three quarters of the screen.
9
+ */
10
+ declare const SHEET_SIZE: {
11
+ readonly sm: "data-[side=left]:sm:w-full data-[side=right]:sm:w-full data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm";
12
+ readonly md: "data-[side=left]:sm:w-full data-[side=right]:sm:w-full data-[side=left]:sm:max-w-[480px] data-[side=right]:sm:max-w-[480px]";
13
+ readonly lg: "data-[side=left]:sm:w-full data-[side=right]:sm:w-full data-[side=left]:sm:max-w-[640px] data-[side=right]:sm:max-w-[640px]";
14
+ };
15
+ declare function SheetContent({ className, children, side, size, showCloseButton, ...props }: SheetPrimitive.Popup.Props & {
7
16
  side?: 'top' | 'right' | 'bottom' | 'left';
17
+ /** How wide a left or right sheet opens: `sm` 384px, `md` 480px, `lg` 640px. */
18
+ size?: keyof typeof SHEET_SIZE;
8
19
  showCloseButton?: boolean;
9
20
  }): React.JSX.Element;
10
21
  declare function SheetHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
22
+ /** The sheet's scrolling middle, padded to line up with its header and footer: 16px on phones, 24px from 640px. */
23
+ declare function SheetBody({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
11
24
  declare function SheetFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
12
25
  declare function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props): React.JSX.Element;
13
26
  declare function SheetDescription({ className, ...props }: SheetPrimitive.Description.Props): React.JSX.Element;
14
- export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
27
+ export { Sheet, SheetBody, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
15
28
  //# sourceMappingURL=sheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../../src/components/sheet/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAMhE,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,qBAErD;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