@almanaclabs/blaze-ui 0.24.0 → 0.26.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.
- package/dist/components/app-shell/app-shell.d.ts +1 -1
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/app-shell.js +5 -5
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +17 -16
- package/dist/components/chat-bar/chat-bar.d.ts +14 -2
- package/dist/components/chat-bar/chat-bar.d.ts.map +1 -1
- package/dist/components/chat-bar/chat-bar.js +64 -37
- package/dist/components/chat-list/chat-list.d.ts +17 -4
- package/dist/components/chat-list/chat-list.d.ts.map +1 -1
- package/dist/components/chat-list/chat-list.js +52 -30
- package/dist/components/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/components/post-card/post-card.d.ts +13 -1
- package/dist/components/post-card/post-card.d.ts.map +1 -1
- package/dist/components/post-card/post-card.js +151 -143
- package/dist/components/selectable-tile/index.d.ts +2 -0
- package/dist/components/selectable-tile/index.d.ts.map +1 -0
- package/dist/components/selectable-tile/selectable-tile.d.ts +40 -0
- package/dist/components/selectable-tile/selectable-tile.d.ts.map +1 -0
- package/dist/components/selectable-tile/selectable-tile.js +54 -0
- package/dist/components/sheet/sheet.d.ts +15 -2
- package/dist/components/sheet/sheet.d.ts.map +1 -1
- package/dist/components/sheet/sheet.js +25 -12
- package/dist/components/slide-deck/index.d.ts +2 -0
- package/dist/components/slide-deck/index.d.ts.map +1 -0
- package/dist/components/slide-deck/slide-deck.d.ts +50 -0
- package/dist/components/slide-deck/slide-deck.d.ts.map +1 -0
- package/dist/components/slide-deck/slide-deck.js +201 -0
- package/dist/components/toggle-group/toggle-group.d.ts.map +1 -1
- package/dist/components/toggle-group/toggle-group.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -79
- package/package.json +1 -1
|
@@ -3,251 +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
|
|
7
|
-
import { IconDots as
|
|
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
|
|
10
|
-
function
|
|
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__ */
|
|
16
|
+
return /* @__PURE__ */ d(p.Provider, {
|
|
17
17
|
value: c,
|
|
18
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
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
|
|
31
|
-
function
|
|
32
|
-
let
|
|
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
|
-
|
|
35
|
-
}, [n,
|
|
36
|
-
|
|
37
|
-
}, [
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
if (
|
|
41
|
-
let 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
|
-
}, [
|
|
46
|
-
let e =
|
|
47
|
-
!
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
let e =
|
|
54
|
-
e === n ?
|
|
55
|
-
},
|
|
56
|
-
!
|
|
57
|
-
},
|
|
58
|
-
let t =
|
|
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
|
-
},
|
|
63
|
-
|
|
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":
|
|
66
|
-
"data-dragging":
|
|
67
|
-
"data-drop":
|
|
68
|
-
draggable:
|
|
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
|
-
|
|
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
|
-
|
|
81
|
+
D && (D.dragging.current = null), P("idle");
|
|
74
82
|
},
|
|
75
83
|
onDragOver: (e) => {
|
|
76
|
-
if (
|
|
84
|
+
if (D?.dragging.current == null || !q) return;
|
|
77
85
|
e.preventDefault();
|
|
78
86
|
let t = e.currentTarget.getBoundingClientRect();
|
|
79
|
-
|
|
87
|
+
I(e.clientY < t.top + t.height / 2 ? "before" : "after");
|
|
80
88
|
},
|
|
81
|
-
onDragLeave: () =>
|
|
89
|
+
onDragLeave: () => I(null),
|
|
82
90
|
onDrop: (e) => {
|
|
83
|
-
if (!
|
|
91
|
+
if (!F) return;
|
|
84
92
|
e.preventDefault();
|
|
85
|
-
let t =
|
|
86
|
-
|
|
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",
|
|
89
|
-
...
|
|
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
|
-
|
|
92
|
-
ref:
|
|
99
|
+
q ? /* @__PURE__ */ d("button", {
|
|
100
|
+
ref: R,
|
|
93
101
|
type: "button",
|
|
94
102
|
"data-slot": "post-card-handle",
|
|
95
|
-
"aria-label": `Reorder ${
|
|
96
|
-
"aria-describedby":
|
|
97
|
-
onPointerDown: () =>
|
|
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",
|
|
105
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
109
|
-
id:
|
|
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__ */
|
|
122
|
+
/* @__PURE__ */ d("span", {
|
|
115
123
|
className: "flex w-10 flex-none flex-col items-center",
|
|
116
|
-
children: [t.avatar ?? /* @__PURE__ */
|
|
124
|
+
children: [t.avatar ?? /* @__PURE__ */ d(s, {
|
|
117
125
|
size: "lg",
|
|
118
|
-
children: [t.avatarSrc ? /* @__PURE__ */
|
|
126
|
+
children: [t.avatarSrc ? /* @__PURE__ */ u(ee, {
|
|
119
127
|
src: t.avatarSrc,
|
|
120
128
|
alt: ""
|
|
121
|
-
}) : null, /* @__PURE__ */
|
|
122
|
-
}),
|
|
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__ */
|
|
135
|
+
/* @__PURE__ */ d("div", {
|
|
128
136
|
className: "flex min-w-0 flex-1 flex-col pb-2",
|
|
129
137
|
children: [
|
|
130
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ d("div", {
|
|
131
139
|
className: "type-body flex items-center gap-1",
|
|
132
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ u("span", {
|
|
133
141
|
className: "truncate font-medium",
|
|
134
142
|
children: t.name
|
|
135
|
-
}), t.handle ? /* @__PURE__ */
|
|
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 ?
|
|
141
|
-
ref:
|
|
142
|
-
"aria-label":
|
|
148
|
+
o == null ? k ? /* @__PURE__ */ u("textarea", {
|
|
149
|
+
ref: L,
|
|
150
|
+
"aria-label": O,
|
|
143
151
|
autoFocus: !0,
|
|
144
|
-
value:
|
|
145
|
-
onChange: (e) =>
|
|
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:
|
|
158
|
+
onBlur: me,
|
|
151
159
|
onKeyDown: (e) => {
|
|
152
|
-
e.key === "Escape" && (
|
|
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 && !
|
|
156
|
-
ref:
|
|
163
|
+
}) : r && !g ? /* @__PURE__ */ d("button", {
|
|
164
|
+
ref: z,
|
|
157
165
|
type: "button",
|
|
158
166
|
"data-slot": "post-card-text",
|
|
159
|
-
"aria-label": n.trim() ? void 0 : `Edit ${
|
|
160
|
-
"aria-describedby":
|
|
161
|
-
onClick: () =>
|
|
167
|
+
"aria-label": n.trim() ? void 0 : `Edit ${O}`,
|
|
168
|
+
"aria-describedby": U,
|
|
169
|
+
onClick: () => A(!0),
|
|
162
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",
|
|
163
|
-
children: [n, /* @__PURE__ */
|
|
164
|
-
id:
|
|
171
|
+
children: [n, /* @__PURE__ */ d("span", {
|
|
172
|
+
id: U,
|
|
165
173
|
"aria-hidden": "true",
|
|
166
174
|
className: "sr-only",
|
|
167
|
-
children: ["Edit ",
|
|
175
|
+
children: ["Edit ", O]
|
|
168
176
|
})]
|
|
169
|
-
}) : /* @__PURE__ */
|
|
177
|
+
}) : /* @__PURE__ */ u("p", {
|
|
170
178
|
"data-slot": "post-card-text",
|
|
171
|
-
className: e("type-content m-0 mt-0.5 p-1 -mx-1 whitespace-pre-wrap text-foreground transition-colors [overflow-wrap:anywhere]",
|
|
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"),
|
|
172
180
|
children: n
|
|
173
|
-
}) : /* @__PURE__ */
|
|
181
|
+
}) : /* @__PURE__ */ u("div", {
|
|
174
182
|
"data-slot": "post-card-text",
|
|
175
|
-
inert:
|
|
176
|
-
className: e("type-content mt-0.5 text-foreground transition-colors",
|
|
183
|
+
inert: g,
|
|
184
|
+
className: e("type-content mt-0.5 text-foreground transition-colors", g && "text-muted-foreground"),
|
|
177
185
|
children: o
|
|
178
186
|
}),
|
|
179
|
-
|
|
187
|
+
le ? /* @__PURE__ */ u("div", {
|
|
180
188
|
className: "mt-2 flex flex-col gap-2",
|
|
181
|
-
children:
|
|
189
|
+
children: le
|
|
182
190
|
}) : null,
|
|
183
|
-
|
|
191
|
+
ye || K || ve ? /* @__PURE__ */ d("div", {
|
|
184
192
|
className: "mt-1 flex min-h-8 items-center gap-1",
|
|
185
193
|
children: [
|
|
186
|
-
|
|
194
|
+
ye ? /* @__PURE__ */ d("div", {
|
|
187
195
|
role: "group",
|
|
188
|
-
"aria-label": `${
|
|
196
|
+
"aria-label": `${T ? $.noun + " " + T.index : O} actions`,
|
|
189
197
|
"data-slot": "post-card-actions",
|
|
190
|
-
className: e("-ml-1.5 flex items-center gap-0.5",
|
|
198
|
+
className: e("-ml-1.5 flex items-center gap-0.5", h),
|
|
191
199
|
children: [
|
|
192
|
-
|
|
193
|
-
label: "Add a post below",
|
|
194
|
-
onClick:
|
|
195
|
-
disabled:
|
|
196
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
197
205
|
}) : null,
|
|
198
|
-
|
|
199
|
-
label: "Add an image",
|
|
200
|
-
items:
|
|
201
|
-
disabled:
|
|
202
|
-
children: /* @__PURE__ */
|
|
203
|
-
}) :
|
|
204
|
-
label: "Add an image",
|
|
205
|
-
onClick:
|
|
206
|
-
disabled:
|
|
207
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
208
216
|
}) : null,
|
|
209
|
-
|
|
210
|
-
label:
|
|
211
|
-
items:
|
|
212
|
-
disabled:
|
|
213
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
214
222
|
}) : null,
|
|
215
|
-
|
|
216
|
-
label: `More for ${
|
|
217
|
-
disabled:
|
|
218
|
-
items: /* @__PURE__ */
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
J ? /* @__PURE__ */
|
|
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, {
|
|
222
230
|
disabled: Y === 0,
|
|
223
231
|
onClick: () => Z(Y - 1, !1),
|
|
224
232
|
children: "Move up"
|
|
225
|
-
}), /* @__PURE__ */
|
|
233
|
+
}), /* @__PURE__ */ u(i, {
|
|
226
234
|
disabled: Y === X - 1,
|
|
227
235
|
onClick: () => Z(Y + 1, !1),
|
|
228
236
|
children: "Move down"
|
|
229
237
|
})] }) : null
|
|
230
238
|
] }),
|
|
231
|
-
children: /* @__PURE__ */
|
|
239
|
+
children: /* @__PURE__ */ u(ne, { "aria-hidden": "true" })
|
|
232
240
|
}) : null
|
|
233
241
|
]
|
|
234
242
|
}) : null,
|
|
235
|
-
|
|
243
|
+
ve ? /* @__PURE__ */ d("span", {
|
|
236
244
|
"data-slot": "post-card-position",
|
|
237
|
-
className: e("type-meta flex-none text-foreground-tertiary tabular-nums",
|
|
245
|
+
className: e("type-meta flex-none text-foreground-tertiary tabular-nums", h),
|
|
238
246
|
children: [
|
|
239
247
|
/* @__PURE__ */ d("span", {
|
|
240
248
|
className: "sr-only",
|
|
241
|
-
children: "
|
|
249
|
+
children: [$.noun, " "]
|
|
242
250
|
}),
|
|
243
|
-
|
|
251
|
+
$.index,
|
|
244
252
|
"/",
|
|
245
|
-
|
|
253
|
+
$.total
|
|
246
254
|
]
|
|
247
255
|
}) : null,
|
|
248
|
-
|
|
249
|
-
count:
|
|
250
|
-
limit:
|
|
256
|
+
K ? /* @__PURE__ */ u(oe, {
|
|
257
|
+
count: G,
|
|
258
|
+
limit: W
|
|
251
259
|
}) : null
|
|
252
260
|
]
|
|
253
261
|
}) : null
|
|
@@ -256,8 +264,8 @@ function _({ author: t, text: n = "", onSave: r, children: o, length: h, busy: _
|
|
|
256
264
|
]
|
|
257
265
|
});
|
|
258
266
|
}
|
|
259
|
-
function
|
|
260
|
-
return /* @__PURE__ */
|
|
267
|
+
function _({ label: e, children: n, ...r }) {
|
|
268
|
+
return /* @__PURE__ */ u(t, {
|
|
261
269
|
type: "button",
|
|
262
270
|
"aria-label": e,
|
|
263
271
|
title: e,
|
|
@@ -267,9 +275,9 @@ function v({ label: e, children: n, ...r }) {
|
|
|
267
275
|
children: n
|
|
268
276
|
});
|
|
269
277
|
}
|
|
270
|
-
function
|
|
271
|
-
return /* @__PURE__ */
|
|
272
|
-
render: /* @__PURE__ */
|
|
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, {
|
|
273
281
|
type: "button",
|
|
274
282
|
"aria-label": e,
|
|
275
283
|
title: e,
|
|
@@ -278,19 +286,19 @@ function y({ label: e, items: i, disabled: a, children: s }) {
|
|
|
278
286
|
disabled: a
|
|
279
287
|
}),
|
|
280
288
|
children: s
|
|
281
|
-
}), /* @__PURE__ */
|
|
289
|
+
}), /* @__PURE__ */ u(r, {
|
|
282
290
|
align: "start",
|
|
283
291
|
children: i
|
|
284
292
|
})] });
|
|
285
293
|
}
|
|
286
|
-
function
|
|
294
|
+
function oe({ count: t, limit: n }) {
|
|
287
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);
|
|
288
|
-
return /* @__PURE__ */
|
|
296
|
+
return /* @__PURE__ */ d("span", {
|
|
289
297
|
"data-slot": "post-card-count",
|
|
290
298
|
"data-over": r < 0 ? "" : void 0,
|
|
291
299
|
className: e("type-meta ml-auto flex items-center gap-1.5", i),
|
|
292
300
|
children: [
|
|
293
|
-
/* @__PURE__ */
|
|
301
|
+
/* @__PURE__ */ d("span", {
|
|
294
302
|
className: "sr-only",
|
|
295
303
|
children: [
|
|
296
304
|
t,
|
|
@@ -299,25 +307,25 @@ function ae({ count: t, limit: n }) {
|
|
|
299
307
|
" characters"
|
|
300
308
|
]
|
|
301
309
|
}),
|
|
302
|
-
r <= 20 ? /* @__PURE__ */
|
|
310
|
+
r <= 20 ? /* @__PURE__ */ u("span", {
|
|
303
311
|
"aria-hidden": "true",
|
|
304
312
|
className: "tabular-nums",
|
|
305
313
|
children: r
|
|
306
314
|
}) : null,
|
|
307
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ d("svg", {
|
|
308
316
|
"aria-hidden": "true",
|
|
309
317
|
viewBox: "0 0 20 20",
|
|
310
318
|
width: "20",
|
|
311
319
|
height: "20",
|
|
312
320
|
className: "flex-none -rotate-90",
|
|
313
|
-
children: [/* @__PURE__ */
|
|
321
|
+
children: [/* @__PURE__ */ u("circle", {
|
|
314
322
|
cx: "10",
|
|
315
323
|
cy: "10",
|
|
316
324
|
r: 8,
|
|
317
325
|
fill: "none",
|
|
318
326
|
strokeWidth: "2",
|
|
319
327
|
className: "stroke-border"
|
|
320
|
-
}), /* @__PURE__ */
|
|
328
|
+
}), /* @__PURE__ */ u("circle", {
|
|
321
329
|
cx: "10",
|
|
322
330
|
cy: "10",
|
|
323
331
|
r: 8,
|
|
@@ -333,4 +341,4 @@ function ae({ count: t, limit: n }) {
|
|
|
333
341
|
});
|
|
334
342
|
}
|
|
335
343
|
//#endregion
|
|
336
|
-
export {
|
|
344
|
+
export { g as PostCard, m as PostCardList };
|
|
@@ -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
|
-
|
|
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;AAED,iBAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,qBAE/D;AAED,iBAAS,UAAU,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,qBAE3D;AAmBD,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,IAAc,EACd,eAAsB,EACtB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,GAAG;IAC9B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,
|
|
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;AAED,iBAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,qBAE/D;AAED,iBAAS,UAAU,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,qBAE3D;AAmBD;;;GAGG;AACH,QAAA,MAAM,UAAU;;;;CAIN,CAAA;AAEV,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,QAAQ,EACR,IAAc,EACd,IAAW,EACX,eAAsB,EACtB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,GAAG;IAC9B,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC1C,gFAAgF;IAChF,IAAI,CAAC,EAAE,MAAM,OAAO,UAAU,CAAA;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,qBAkCA;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQxE;AAED,mHAAmH;AACnH,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQtE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQxE;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,qBAWtE;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,KAAK,qBAQlC;AAED,OAAO,EACL,KAAK,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,GACjB,CAAA"}
|