@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.
- package/dist/components/app-shell/app-shell.d.ts +6 -2
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/app-shell.js +35 -17
- 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 +48 -0
- package/dist/components/chat-list/chat-list.d.ts.map +1 -0
- package/dist/components/chat-list/chat-list.js +95 -0
- package/dist/components/chat-list/index.d.ts +2 -0
- package/dist/components/chat-list/index.d.ts.map +1 -0
- package/dist/components/chat-panel/chat-panel.d.ts +39 -0
- package/dist/components/chat-panel/chat-panel.d.ts.map +1 -0
- package/dist/components/chat-panel/chat-panel.js +153 -0
- package/dist/components/chat-panel/index.d.ts +2 -0
- package/dist/components/chat-panel/index.d.ts.map +1 -0
- 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 -142
- 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/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -77
- package/package.json +1 -1
- 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
|
|
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-
|
|
160
|
-
|
|
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__ */
|
|
163
|
-
id:
|
|
171
|
+
children: [n, /* @__PURE__ */ d("span", {
|
|
172
|
+
id: U,
|
|
164
173
|
"aria-hidden": "true",
|
|
165
174
|
className: "sr-only",
|
|
166
|
-
children: ["Edit ",
|
|
175
|
+
children: ["Edit ", O]
|
|
167
176
|
})]
|
|
168
|
-
}) : /* @__PURE__ */
|
|
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]",
|
|
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__ */
|
|
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",
|
|
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
|
-
|
|
187
|
+
le ? /* @__PURE__ */ u("div", {
|
|
179
188
|
className: "mt-2 flex flex-col gap-2",
|
|
180
|
-
children:
|
|
189
|
+
children: le
|
|
181
190
|
}) : null,
|
|
182
|
-
|
|
191
|
+
ye || K || ve ? /* @__PURE__ */ d("div", {
|
|
183
192
|
className: "mt-1 flex min-h-8 items-center gap-1",
|
|
184
193
|
children: [
|
|
185
|
-
|
|
194
|
+
ye ? /* @__PURE__ */ d("div", {
|
|
186
195
|
role: "group",
|
|
187
|
-
"aria-label": `${
|
|
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",
|
|
198
|
+
className: e("-ml-1.5 flex items-center gap-0.5", h),
|
|
190
199
|
children: [
|
|
191
|
-
|
|
192
|
-
label: "Add a post below",
|
|
193
|
-
onClick:
|
|
194
|
-
disabled:
|
|
195
|
-
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" })
|
|
196
205
|
}) : null,
|
|
197
|
-
|
|
198
|
-
label: "Add an image",
|
|
199
|
-
items:
|
|
200
|
-
disabled:
|
|
201
|
-
children: /* @__PURE__ */
|
|
202
|
-
}) :
|
|
203
|
-
label: "Add an image",
|
|
204
|
-
onClick:
|
|
205
|
-
disabled:
|
|
206
|
-
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" })
|
|
207
216
|
}) : null,
|
|
208
|
-
|
|
209
|
-
label:
|
|
210
|
-
items:
|
|
211
|
-
disabled:
|
|
212
|
-
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" })
|
|
213
222
|
}) : null,
|
|
214
|
-
|
|
215
|
-
label: `More for ${
|
|
216
|
-
disabled:
|
|
217
|
-
items: /* @__PURE__ */
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
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, {
|
|
221
230
|
disabled: Y === 0,
|
|
222
231
|
onClick: () => Z(Y - 1, !1),
|
|
223
232
|
children: "Move up"
|
|
224
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
239
|
+
children: /* @__PURE__ */ u(ne, { "aria-hidden": "true" })
|
|
231
240
|
}) : null
|
|
232
241
|
]
|
|
233
242
|
}) : null,
|
|
234
|
-
|
|
243
|
+
ve ? /* @__PURE__ */ d("span", {
|
|
235
244
|
"data-slot": "post-card-position",
|
|
236
|
-
className: e("type-meta flex-none text-foreground-tertiary tabular-nums",
|
|
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: "
|
|
249
|
+
children: [$.noun, " "]
|
|
241
250
|
}),
|
|
242
|
-
|
|
251
|
+
$.index,
|
|
243
252
|
"/",
|
|
244
|
-
|
|
253
|
+
$.total
|
|
245
254
|
]
|
|
246
255
|
}) : null,
|
|
247
|
-
|
|
248
|
-
count:
|
|
249
|
-
limit:
|
|
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
|
|
259
|
-
return /* @__PURE__ */
|
|
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
|
|
270
|
-
return /* @__PURE__ */
|
|
271
|
-
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, {
|
|
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__ */
|
|
289
|
+
}), /* @__PURE__ */ u(r, {
|
|
281
290
|
align: "start",
|
|
282
291
|
children: i
|
|
283
292
|
})] });
|
|
284
293
|
}
|
|
285
|
-
function
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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 {
|
|
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"}
|