@almanaclabs/blaze-ui 0.3.1 → 0.4.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/README.md +23 -0
- package/dist/components/accordion/accordion.js +53 -0
- package/dist/components/alert/alert.js +43 -0
- package/dist/components/alert-dialog/alert-dialog.js +94 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +13 -0
- package/dist/components/attachment/attachment.js +104 -0
- package/dist/components/avatar/avatar.js +50 -0
- package/dist/components/badge/badge.js +29 -0
- package/dist/components/breadcrumb/breadcrumb.js +72 -0
- package/dist/components/bubble/bubble.js +73 -0
- package/dist/components/button/button.js +46 -0
- package/dist/components/button-group/button-group.js +41 -0
- package/dist/components/calendar/calendar.js +92 -0
- package/dist/components/card/card.js +56 -0
- package/dist/components/carousel/carousel.js +110 -0
- package/dist/components/chart/chart.js +131 -0
- package/dist/components/checkbox/checkbox.js +20 -0
- package/dist/components/collapsible/collapsible.js +23 -0
- package/dist/components/combobox/combobox.js +165 -0
- package/dist/components/data-table/data-table.js +30 -0
- package/dist/components/date-picker/date-picker.js +39 -0
- package/dist/components/dialog/dialog.js +92 -0
- package/dist/components/drawer/drawer.js +121 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +136 -0
- package/dist/components/empty/empty.js +59 -0
- package/dist/components/field/field.js +107 -0
- package/dist/components/hover-card/hover-card.js +36 -0
- package/dist/components/input/input.js +15 -0
- package/dist/components/input-group/input-group.js +77 -0
- package/dist/components/item/item.js +121 -0
- package/dist/components/label/label.js +13 -0
- package/dist/components/marker/marker.js +43 -0
- package/dist/components/message/message.js +49 -0
- package/dist/components/native-select/native-select.js +39 -0
- package/dist/components/pagination/pagination.js +80 -0
- package/dist/components/popover/popover.js +54 -0
- package/dist/components/progress/progress.js +45 -0
- package/dist/components/questionnaire/questionnaire-primitive.js +353 -0
- package/dist/components/questionnaire/questionnaire.js +169 -0
- package/dist/components/radio-group/radio-group.js +26 -0
- package/dist/components/scroll-area/scroll-area.js +37 -0
- package/dist/components/select/select.js +98 -0
- package/dist/components/separator/separator.js +15 -0
- package/dist/components/sheet/sheet.js +89 -0
- package/dist/components/sidebar/sidebar.js +358 -0
- package/dist/components/skeleton/skeleton.js +12 -0
- package/dist/components/slider/slider.js +37 -0
- package/dist/components/spinner/spinner.js +15 -0
- package/dist/components/switch/switch.js +19 -0
- package/dist/components/table/table.js +66 -0
- package/dist/components/tabs/tabs.js +46 -0
- package/dist/components/textarea/textarea.js +13 -0
- package/dist/components/toast/toast.js +116 -0
- package/dist/components/toggle/toggle.js +35 -0
- package/dist/components/toggle-group/toggle-group.js +52 -0
- package/dist/components/tooltip/tooltip.js +41 -0
- package/dist/hooks/use-mobile.js +14 -0
- package/dist/index.js +56 -3699
- package/dist/lib/utils.js +8 -0
- package/dist/recipes/recipe-runtime.d.ts +6 -0
- package/dist/recipes/recipe-runtime.d.ts.map +1 -0
- package/package.json +2 -1
- package/recipes/README.md +22 -0
- package/recipes/manifest.json +12 -0
- package/recipes/workspace-shell/README.md +41 -0
- package/recipes/workspace-shell/workspace-shell.tsx +386 -0
- package/src/styles/globals.css +5 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { mergeProps as n } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender as r } from "@base-ui/react/use-render";
|
|
5
|
+
//#region src/components/questionnaire/questionnaire-primitive.tsx
|
|
6
|
+
var i = t.createContext(null), a = t.createContext(null), o = t.createContext(null);
|
|
7
|
+
function s(e) {
|
|
8
|
+
let n = t.useContext(i);
|
|
9
|
+
if (!n) throw Error(`${e} must be used within Questionnaire`);
|
|
10
|
+
return n;
|
|
11
|
+
}
|
|
12
|
+
function c(e) {
|
|
13
|
+
let n = t.useContext(a);
|
|
14
|
+
if (!n) throw Error(`${e} must be used within QuestionnaireItem`);
|
|
15
|
+
return n;
|
|
16
|
+
}
|
|
17
|
+
function l(e) {
|
|
18
|
+
let n = t.useContext(o);
|
|
19
|
+
if (!n) throw Error(`${e} must be used within QuestionnaireChoice`);
|
|
20
|
+
return n;
|
|
21
|
+
}
|
|
22
|
+
function u({ defaultItem: n, item: r, items: a = [], onItemChange: o, shortcuts: s, onReset: c, onSubmit: l, onKeyDown: u, ...d }) {
|
|
23
|
+
let [f, p] = t.useState([]), m = t.useMemo(() => a.filter((e) => !e.disabled).map((e) => e.name), [a]), h = m.length ? m : f, [g, _] = t.useState(n ?? m[0] ?? null), v = r ?? g ?? h[0] ?? null, y = Math.max(0, h.indexOf(v ?? "")), [b, x] = t.useState({}), [S, C] = t.useState({}), w = t.useCallback((e) => {
|
|
24
|
+
!e || e === v || (r === void 0 && _(e), o?.(e));
|
|
25
|
+
}, [
|
|
26
|
+
v,
|
|
27
|
+
r,
|
|
28
|
+
o
|
|
29
|
+
]), T = t.useCallback((e) => (p((t) => t.includes(e) ? t : [...t, e]), () => p((t) => t.filter((t) => t !== e))), []), E = t.useCallback((e, t) => {
|
|
30
|
+
x((n) => ({
|
|
31
|
+
...n,
|
|
32
|
+
[e]: t ? "answered" : "unanswered"
|
|
33
|
+
}));
|
|
34
|
+
}, []), D = t.useCallback((e, t, n, r) => {
|
|
35
|
+
C((i) => {
|
|
36
|
+
let a = i[e] ?? [], o = r ? n ? [.../* @__PURE__ */ new Set([...a, t])] : [t] : a.filter((e) => e !== t);
|
|
37
|
+
return E(e, o.length > 0), {
|
|
38
|
+
...i,
|
|
39
|
+
[e]: o
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}, [E]), O = t.useCallback(() => {
|
|
43
|
+
w(h[y - 1]);
|
|
44
|
+
}, [
|
|
45
|
+
y,
|
|
46
|
+
h,
|
|
47
|
+
w
|
|
48
|
+
]), k = t.useCallback(() => {
|
|
49
|
+
if (v) {
|
|
50
|
+
if (a.find((e) => e.name === v)?.required && b[v] !== "answered") {
|
|
51
|
+
x((e) => ({
|
|
52
|
+
...e,
|
|
53
|
+
[v]: "unanswered"
|
|
54
|
+
}));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
w(h[y + 1]);
|
|
58
|
+
}
|
|
59
|
+
}, [
|
|
60
|
+
y,
|
|
61
|
+
v,
|
|
62
|
+
a,
|
|
63
|
+
h,
|
|
64
|
+
w,
|
|
65
|
+
b
|
|
66
|
+
]), A = t.useCallback(() => {
|
|
67
|
+
v && (x((e) => ({
|
|
68
|
+
...e,
|
|
69
|
+
[v]: "skipped"
|
|
70
|
+
})), w(h[y + 1]));
|
|
71
|
+
}, [
|
|
72
|
+
y,
|
|
73
|
+
v,
|
|
74
|
+
h,
|
|
75
|
+
w
|
|
76
|
+
]), j = t.useMemo(() => ({
|
|
77
|
+
activeName: v,
|
|
78
|
+
current: h.length ? y + 1 : 0,
|
|
79
|
+
first: y === 0,
|
|
80
|
+
last: y === h.length - 1,
|
|
81
|
+
total: h.length,
|
|
82
|
+
shortcuts: s ?? null,
|
|
83
|
+
itemDefinitions: a,
|
|
84
|
+
statuses: b,
|
|
85
|
+
selections: S,
|
|
86
|
+
registerItem: T,
|
|
87
|
+
setAnswered: E,
|
|
88
|
+
setSelection: D,
|
|
89
|
+
goPrevious: O,
|
|
90
|
+
goNext: k,
|
|
91
|
+
skip: A
|
|
92
|
+
}), [
|
|
93
|
+
y,
|
|
94
|
+
v,
|
|
95
|
+
k,
|
|
96
|
+
O,
|
|
97
|
+
a,
|
|
98
|
+
h.length,
|
|
99
|
+
T,
|
|
100
|
+
S,
|
|
101
|
+
E,
|
|
102
|
+
D,
|
|
103
|
+
s,
|
|
104
|
+
A,
|
|
105
|
+
b
|
|
106
|
+
]);
|
|
107
|
+
return /* @__PURE__ */ e(i.Provider, {
|
|
108
|
+
value: j,
|
|
109
|
+
children: /* @__PURE__ */ e("form", {
|
|
110
|
+
...d,
|
|
111
|
+
noValidate: !0,
|
|
112
|
+
onReset: (e) => {
|
|
113
|
+
c?.(e), !e.defaultPrevented && (x({}), C({}), w(n ?? h[0]));
|
|
114
|
+
},
|
|
115
|
+
onSubmit: l,
|
|
116
|
+
onKeyDown: (e) => {
|
|
117
|
+
u?.(e), !e.defaultPrevented && (e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), j.last ? e.currentTarget.requestSubmit() : j.goNext());
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function d({ children: e, render: t, ...i }) {
|
|
123
|
+
let { current: a, first: o, last: c, total: l } = s("QuestionnaireProgress"), u = l ? `Question ${a} of ${l}` : void 0;
|
|
124
|
+
return r({
|
|
125
|
+
defaultTagName: "div",
|
|
126
|
+
props: n({
|
|
127
|
+
children: e ?? u,
|
|
128
|
+
role: "progressbar",
|
|
129
|
+
"aria-label": "Questionnaire progress",
|
|
130
|
+
"aria-live": "polite",
|
|
131
|
+
"aria-valuemin": l ? 1 : void 0,
|
|
132
|
+
"aria-valuemax": l || void 0,
|
|
133
|
+
"aria-valuenow": l ? a : void 0,
|
|
134
|
+
"aria-valuetext": u
|
|
135
|
+
}, i),
|
|
136
|
+
render: t,
|
|
137
|
+
state: {
|
|
138
|
+
current: a,
|
|
139
|
+
first: o,
|
|
140
|
+
last: c,
|
|
141
|
+
total: l
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function f({ disabled: n = !1, invalid: r = !1, multiple: i = !1, name: o, onStatusChange: c, required: l = !1, ...u }) {
|
|
146
|
+
let d = s("QuestionnaireItem"), f = t.useRef(c);
|
|
147
|
+
t.useLayoutEffect(() => {
|
|
148
|
+
f.current = c;
|
|
149
|
+
}, [c]), t.useLayoutEffect(() => d.registerItem(o), [o, d.registerItem]);
|
|
150
|
+
let p = d.statuses[o] ?? "unanswered", m = d.statuses[o] !== void 0, h = d.activeName === o;
|
|
151
|
+
t.useEffect(() => f.current?.(p), [p]);
|
|
152
|
+
let g = t.useMemo(() => ({
|
|
153
|
+
disabled: n,
|
|
154
|
+
invalid: r || l && m && p === "unanswered",
|
|
155
|
+
multiple: i,
|
|
156
|
+
name: o,
|
|
157
|
+
required: l,
|
|
158
|
+
status: p
|
|
159
|
+
}), [
|
|
160
|
+
m,
|
|
161
|
+
n,
|
|
162
|
+
r,
|
|
163
|
+
i,
|
|
164
|
+
o,
|
|
165
|
+
l,
|
|
166
|
+
p
|
|
167
|
+
]);
|
|
168
|
+
return /* @__PURE__ */ e(a.Provider, {
|
|
169
|
+
value: g,
|
|
170
|
+
children: /* @__PURE__ */ e("fieldset", {
|
|
171
|
+
...u,
|
|
172
|
+
disabled: n,
|
|
173
|
+
hidden: !h,
|
|
174
|
+
inert: !h || void 0,
|
|
175
|
+
"aria-invalid": g.invalid || void 0,
|
|
176
|
+
"data-active": h ? "" : void 0,
|
|
177
|
+
"data-status": p
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function p({ render: e, ...t }) {
|
|
182
|
+
return c("QuestionnaireTitle"), r({
|
|
183
|
+
defaultTagName: "legend",
|
|
184
|
+
props: t,
|
|
185
|
+
render: e,
|
|
186
|
+
state: { slot: "questionnaire-title" }
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function m({ render: e, ...t }) {
|
|
190
|
+
return c("QuestionnaireDescription"), r({
|
|
191
|
+
defaultTagName: "p",
|
|
192
|
+
props: t,
|
|
193
|
+
render: e,
|
|
194
|
+
state: { slot: "questionnaire-description" }
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function h(t) {
|
|
198
|
+
return c("QuestionnaireChoices"), /* @__PURE__ */ e("div", { ...t });
|
|
199
|
+
}
|
|
200
|
+
function g({ checked: n, defaultChecked: r = !1, disabled: i = !1, onChange: a, value: l, ...u }) {
|
|
201
|
+
let d = s("QuestionnaireChoice"), f = d.setSelection, p = c("QuestionnaireChoice"), m = d.selections[p.name] ?? [], h = n ?? (m.includes(l) || r), g = p.multiple ? "checkbox" : "radio", _ = (d.itemDefinitions.find((e) => e.name === p.name)?.choices?.filter((e) => !e.disabled) ?? []).findIndex((e) => e.value === l), v = _ < 0 || !d.shortcuts ? null : d.shortcuts === "letters" ? String.fromCharCode(65 + _) : String(_ + 1), y = p.disabled || i;
|
|
202
|
+
t.useLayoutEffect(() => {
|
|
203
|
+
r && !m.includes(l) && f(p.name, l, p.multiple, !0);
|
|
204
|
+
}, [
|
|
205
|
+
r,
|
|
206
|
+
p.multiple,
|
|
207
|
+
p.name,
|
|
208
|
+
m,
|
|
209
|
+
f,
|
|
210
|
+
l
|
|
211
|
+
]);
|
|
212
|
+
let b = {
|
|
213
|
+
checked: h,
|
|
214
|
+
disabled: y,
|
|
215
|
+
name: p.name,
|
|
216
|
+
required: p.required && !p.multiple,
|
|
217
|
+
type: g,
|
|
218
|
+
value: l,
|
|
219
|
+
onChange: (e) => {
|
|
220
|
+
a?.(e), e.defaultPrevented || d.setSelection(p.name, l, p.multiple, e.target.checked);
|
|
221
|
+
}
|
|
222
|
+
}, x = t.useMemo(() => ({
|
|
223
|
+
checked: h,
|
|
224
|
+
disabled: y,
|
|
225
|
+
invalid: p.invalid,
|
|
226
|
+
inputProps: b,
|
|
227
|
+
shortcut: v,
|
|
228
|
+
type: g
|
|
229
|
+
}), [
|
|
230
|
+
h,
|
|
231
|
+
y,
|
|
232
|
+
b,
|
|
233
|
+
p.invalid,
|
|
234
|
+
v,
|
|
235
|
+
g
|
|
236
|
+
]);
|
|
237
|
+
return /* @__PURE__ */ e(o.Provider, {
|
|
238
|
+
value: x,
|
|
239
|
+
children: /* @__PURE__ */ e("label", {
|
|
240
|
+
...u,
|
|
241
|
+
"data-checked": h ? "" : void 0,
|
|
242
|
+
"data-disabled": y ? "" : void 0,
|
|
243
|
+
"data-invalid": p.invalid ? "" : void 0,
|
|
244
|
+
"data-shortcut": v ?? void 0,
|
|
245
|
+
"data-type": g
|
|
246
|
+
})
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
function _(t) {
|
|
250
|
+
let { inputProps: n } = l("QuestionnaireChoiceInput");
|
|
251
|
+
return /* @__PURE__ */ e("input", {
|
|
252
|
+
...n,
|
|
253
|
+
...t
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function v(t) {
|
|
257
|
+
return l("QuestionnaireChoiceLabel"), /* @__PURE__ */ e("span", { ...t });
|
|
258
|
+
}
|
|
259
|
+
function y({ children: t, ...n }) {
|
|
260
|
+
let { shortcut: r } = l("QuestionnaireChoiceShortcut");
|
|
261
|
+
return /* @__PURE__ */ e("span", {
|
|
262
|
+
...n,
|
|
263
|
+
"aria-hidden": !0,
|
|
264
|
+
hidden: !r,
|
|
265
|
+
children: t ?? r
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function b({ onChange: t, ...n }) {
|
|
269
|
+
let r = s("QuestionnaireInput"), i = c("QuestionnaireInput");
|
|
270
|
+
return /* @__PURE__ */ e("input", {
|
|
271
|
+
...n,
|
|
272
|
+
name: i.name,
|
|
273
|
+
disabled: i.disabled || n.disabled,
|
|
274
|
+
"aria-invalid": i.invalid || void 0,
|
|
275
|
+
onChange: (e) => {
|
|
276
|
+
t?.(e), e.defaultPrevented || r.setAnswered(i.name, e.target.value.trim().length > 0);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function x({ children: t, ...n }) {
|
|
281
|
+
let r = c("QuestionnaireError");
|
|
282
|
+
return /* @__PURE__ */ e("p", {
|
|
283
|
+
...n,
|
|
284
|
+
hidden: !r.invalid,
|
|
285
|
+
role: r.invalid ? "alert" : void 0,
|
|
286
|
+
children: t ?? (r.required ? "Choose an answer to continue." : "Choose an answer or skip this question.")
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function S(t) {
|
|
290
|
+
let n = s("QuestionnairePrevious");
|
|
291
|
+
return /* @__PURE__ */ e("button", {
|
|
292
|
+
...t,
|
|
293
|
+
type: t.type ?? "button",
|
|
294
|
+
hidden: n.first,
|
|
295
|
+
"aria-hidden": n.first || void 0,
|
|
296
|
+
onClick: (e) => {
|
|
297
|
+
t.onClick?.(e), e.defaultPrevented || n.goPrevious();
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function C(t) {
|
|
302
|
+
let n = s("QuestionnaireSkip");
|
|
303
|
+
return /* @__PURE__ */ e("button", {
|
|
304
|
+
...t,
|
|
305
|
+
type: t.type ?? "button",
|
|
306
|
+
hidden: n.last,
|
|
307
|
+
"aria-hidden": n.last || void 0,
|
|
308
|
+
onClick: (e) => {
|
|
309
|
+
t.onClick?.(e), e.defaultPrevented || n.skip();
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function w(t) {
|
|
314
|
+
let n = s("QuestionnaireNext");
|
|
315
|
+
return /* @__PURE__ */ e("button", {
|
|
316
|
+
...t,
|
|
317
|
+
type: t.type ?? "button",
|
|
318
|
+
hidden: n.last,
|
|
319
|
+
"aria-hidden": n.last || void 0,
|
|
320
|
+
onClick: (e) => {
|
|
321
|
+
t.onClick?.(e), e.defaultPrevented || n.goNext();
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
function T(t) {
|
|
326
|
+
let n = s("QuestionnaireSubmit");
|
|
327
|
+
return /* @__PURE__ */ e("button", {
|
|
328
|
+
...t,
|
|
329
|
+
type: t.type ?? "submit",
|
|
330
|
+
hidden: !n.last,
|
|
331
|
+
"aria-hidden": !n.last || void 0
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
var E = {
|
|
335
|
+
Root: u,
|
|
336
|
+
Progress: d,
|
|
337
|
+
Item: f,
|
|
338
|
+
Title: p,
|
|
339
|
+
Description: m,
|
|
340
|
+
Choices: h,
|
|
341
|
+
Choice: g,
|
|
342
|
+
ChoiceInput: _,
|
|
343
|
+
ChoiceLabel: v,
|
|
344
|
+
ChoiceShortcut: y,
|
|
345
|
+
Input: b,
|
|
346
|
+
Error: x,
|
|
347
|
+
Previous: S,
|
|
348
|
+
Skip: C,
|
|
349
|
+
Next: w,
|
|
350
|
+
Submit: T
|
|
351
|
+
};
|
|
352
|
+
//#endregion
|
|
353
|
+
export { E as QuestionnairePrimitive };
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { buttonVariants as t } from "../button/button.js";
|
|
3
|
+
import { QuestionnairePrimitive as n } from "./questionnaire-primitive.js";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import "react";
|
|
6
|
+
import { IconCheck as a } from "@tabler/icons-react";
|
|
7
|
+
//#region src/components/questionnaire/questionnaire.tsx
|
|
8
|
+
function o({ className: t, ...i }) {
|
|
9
|
+
return /* @__PURE__ */ r(n.Root, {
|
|
10
|
+
"data-slot": "questionnaire",
|
|
11
|
+
className: e("flex w-full min-w-0 flex-col gap-4", t),
|
|
12
|
+
...i
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function s({ className: t, ...i }) {
|
|
16
|
+
return /* @__PURE__ */ r(n.Progress, {
|
|
17
|
+
"data-slot": "questionnaire-progress",
|
|
18
|
+
className: e("min-h-[1lh] w-fit min-w-[14ch] text-xs font-medium text-muted-foreground tabular-nums", t),
|
|
19
|
+
...i
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function c({ className: t, ...i }) {
|
|
23
|
+
return /* @__PURE__ */ r(n.Item, {
|
|
24
|
+
"data-slot": "questionnaire-item",
|
|
25
|
+
className: e("flex min-w-0 flex-col gap-4 border-0 p-0 outline-none", t),
|
|
26
|
+
...i
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function l({ className: t, ...i }) {
|
|
30
|
+
return /* @__PURE__ */ r(n.Title, {
|
|
31
|
+
"data-slot": "questionnaire-title",
|
|
32
|
+
className: e("font-heading text-base leading-snug font-medium text-pretty [&:not(:has(~[data-slot=questionnaire-description]))]:mb-4", t),
|
|
33
|
+
...i
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function u({ className: t, ...i }) {
|
|
37
|
+
return /* @__PURE__ */ r(n.Description, {
|
|
38
|
+
"data-slot": "questionnaire-description",
|
|
39
|
+
className: e("text-sm text-pretty text-muted-foreground", t),
|
|
40
|
+
...i
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function d({ className: t, ...i }) {
|
|
44
|
+
return /* @__PURE__ */ r(n.Choices, {
|
|
45
|
+
"data-slot": "questionnaire-choices",
|
|
46
|
+
className: e("group/questionnaire-choices grid min-w-0 gap-2", t),
|
|
47
|
+
...i
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function f({ children: t, className: o, ...s }) {
|
|
51
|
+
return /* @__PURE__ */ i(n.Choice, {
|
|
52
|
+
"data-slot": "questionnaire-choice",
|
|
53
|
+
className: e("group/questionnaire-choice relative flex min-h-11 cursor-pointer items-start gap-2.5 rounded-lg border border-input bg-transparent px-3 py-2.5 text-start text-sm transition-colors outline-none select-none hover:bg-muted/50 has-[>input:focus-visible]:border-ring has-[>input:focus-visible]:ring-3 has-[>input:focus-visible]:ring-ring/50 data-invalid:border-destructive dark:bg-input/20 data-checked:border-primary/40 data-checked:bg-muted dark:data-checked:bg-muted", "data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50", o),
|
|
54
|
+
...s,
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ r(n.ChoiceInput, {
|
|
57
|
+
"data-slot": "questionnaire-choice-input",
|
|
58
|
+
className: "absolute inset-0 z-10 size-full cursor-pointer opacity-0"
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ i("span", {
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
"data-slot": "questionnaire-choice-indicator",
|
|
63
|
+
className: "pointer-events-none relative flex size-4 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-[4px] border border-input group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[type=radio]/questionnaire-choice:rounded-full group-data-checked/questionnaire-choice:border-primary group-data-checked/questionnaire-choice:bg-primary group-data-checked/questionnaire-choice:text-primary-foreground dark:bg-input/30 dark:group-data-checked/questionnaire-choice:bg-primary",
|
|
64
|
+
children: [/* @__PURE__ */ r("span", {
|
|
65
|
+
"data-slot": "questionnaire-choice-indicator-dot",
|
|
66
|
+
className: "hidden size-2 rounded-full bg-primary-foreground group-data-[type=checkbox]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block"
|
|
67
|
+
}), /* @__PURE__ */ r(a, {
|
|
68
|
+
"data-slot": "questionnaire-choice-indicator-check",
|
|
69
|
+
className: "hidden size-3.5 group-data-[type=radio]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block"
|
|
70
|
+
})]
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ r(n.ChoiceLabel, {
|
|
73
|
+
"data-slot": "questionnaire-choice-label",
|
|
74
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5 leading-snug",
|
|
75
|
+
children: t
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ r(n.ChoiceShortcut, {
|
|
78
|
+
"data-slot": "questionnaire-choice-shortcut",
|
|
79
|
+
className: "pointer-events-none ms-auto hidden size-5 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-md border border-input bg-background font-mono text-[0.625rem] leading-none font-medium text-muted-foreground group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[shortcut]/questionnaire-choice:inline-flex"
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function p({ className: t, ...n }) {
|
|
85
|
+
return /* @__PURE__ */ r("span", {
|
|
86
|
+
"data-slot": "questionnaire-choice-description",
|
|
87
|
+
className: e("text-muted-foreground", t),
|
|
88
|
+
...n
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function m({ className: t, ...i }) {
|
|
92
|
+
return /* @__PURE__ */ r("div", {
|
|
93
|
+
"data-slot": "questionnaire-input-wrapper",
|
|
94
|
+
className: "group/questionnaire-input relative w-full min-w-0",
|
|
95
|
+
children: /* @__PURE__ */ r(n.Input, {
|
|
96
|
+
"data-slot": "questionnaire-input",
|
|
97
|
+
className: e("h-8 min-h-11 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-[color,box-shadow,background-color] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 sm:min-h-0 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", "selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground", t),
|
|
98
|
+
...i
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function h({ className: t, ...i }) {
|
|
103
|
+
return /* @__PURE__ */ r(n.Error, {
|
|
104
|
+
"data-slot": "questionnaire-error",
|
|
105
|
+
className: e("mt-2 text-sm text-destructive", t),
|
|
106
|
+
...i
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function g({ className: t, ...n }) {
|
|
110
|
+
return /* @__PURE__ */ r("div", {
|
|
111
|
+
"data-slot": "questionnaire-actions",
|
|
112
|
+
className: e("grid min-h-11 w-full grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2 sm:min-h-8", t),
|
|
113
|
+
...n
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function _({ children: i, className: a, size: o = "default", variant: s = "outline", ...c }) {
|
|
117
|
+
return /* @__PURE__ */ r(n.Previous, {
|
|
118
|
+
"data-slot": "questionnaire-previous",
|
|
119
|
+
"data-size": o,
|
|
120
|
+
"data-variant": s,
|
|
121
|
+
className: e(t({
|
|
122
|
+
size: o,
|
|
123
|
+
variant: s
|
|
124
|
+
}), "col-start-1 row-start-1 min-h-11 justify-self-start sm:min-h-0", a),
|
|
125
|
+
...c,
|
|
126
|
+
children: i ?? "Previous"
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function v({ children: i, className: a, size: o = "default", variant: s = "outline", ...c }) {
|
|
130
|
+
return /* @__PURE__ */ r(n.Skip, {
|
|
131
|
+
"data-slot": "questionnaire-skip",
|
|
132
|
+
"data-size": o,
|
|
133
|
+
"data-variant": s,
|
|
134
|
+
className: e(t({
|
|
135
|
+
size: o,
|
|
136
|
+
variant: s
|
|
137
|
+
}), "col-start-2 row-start-1 min-h-11 justify-self-end sm:min-h-0", a),
|
|
138
|
+
...c,
|
|
139
|
+
children: i ?? "Skip"
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function y({ children: i, className: a, size: o = "default", variant: s = "default", ...c }) {
|
|
143
|
+
return /* @__PURE__ */ r(n.Next, {
|
|
144
|
+
"data-slot": "questionnaire-next",
|
|
145
|
+
"data-size": o,
|
|
146
|
+
"data-variant": s,
|
|
147
|
+
className: e(t({
|
|
148
|
+
size: o,
|
|
149
|
+
variant: s
|
|
150
|
+
}), "col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0", a),
|
|
151
|
+
...c,
|
|
152
|
+
children: i ?? "Next"
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function b({ children: i, className: a, size: o = "default", variant: s = "default", ...c }) {
|
|
156
|
+
return /* @__PURE__ */ r(n.Submit, {
|
|
157
|
+
"data-slot": "questionnaire-submit",
|
|
158
|
+
"data-size": o,
|
|
159
|
+
"data-variant": s,
|
|
160
|
+
className: e(t({
|
|
161
|
+
size: o,
|
|
162
|
+
variant: s
|
|
163
|
+
}), "col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0", a),
|
|
164
|
+
...c,
|
|
165
|
+
children: i ?? "Submit"
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
export { o as Questionnaire, g as QuestionnaireActions, f as QuestionnaireChoice, p as QuestionnaireChoiceDescription, d as QuestionnaireChoices, u as QuestionnaireDescription, h as QuestionnaireError, m as QuestionnaireInput, c as QuestionnaireItem, y as QuestionnaireNext, _ as QuestionnairePrevious, s as QuestionnaireProgress, v as QuestionnaireSkip, b as QuestionnaireSubmit, l as QuestionnaireTitle };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { Radio as n } from "@base-ui/react/radio";
|
|
4
|
+
import { RadioGroup as r } from "@base-ui/react/radio-group";
|
|
5
|
+
//#region src/components/radio-group/radio-group.tsx
|
|
6
|
+
function i({ className: n, ...i }) {
|
|
7
|
+
return /* @__PURE__ */ t(r, {
|
|
8
|
+
"data-slot": "radio-group",
|
|
9
|
+
className: e("grid w-full gap-2", n),
|
|
10
|
+
...i
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function a({ className: r, ...i }) {
|
|
14
|
+
return /* @__PURE__ */ t(n.Root, {
|
|
15
|
+
"data-slot": "radio-group-item",
|
|
16
|
+
className: e("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary", r),
|
|
17
|
+
...i,
|
|
18
|
+
children: /* @__PURE__ */ t(n.Indicator, {
|
|
19
|
+
"data-slot": "radio-group-indicator",
|
|
20
|
+
className: "flex size-4 items-center justify-center",
|
|
21
|
+
children: /* @__PURE__ */ t("span", { className: "absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground" })
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { i as RadioGroup, a as RadioGroupItem };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
import "react";
|
|
5
|
+
import { ScrollArea as r } from "@base-ui/react/scroll-area";
|
|
6
|
+
//#region src/components/scroll-area/scroll-area.tsx
|
|
7
|
+
function i({ className: i, children: o, ...s }) {
|
|
8
|
+
return /* @__PURE__ */ n(r.Root, {
|
|
9
|
+
"data-slot": "scroll-area",
|
|
10
|
+
className: e("relative", i),
|
|
11
|
+
...s,
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ t(r.Viewport, {
|
|
14
|
+
"data-slot": "scroll-area-viewport",
|
|
15
|
+
className: "size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",
|
|
16
|
+
children: o
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ t(a, {}),
|
|
19
|
+
/* @__PURE__ */ t(r.Corner, {})
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function a({ className: n, orientation: i = "vertical", ...a }) {
|
|
24
|
+
return /* @__PURE__ */ t(r.Scrollbar, {
|
|
25
|
+
"data-slot": "scroll-area-scrollbar",
|
|
26
|
+
"data-orientation": i,
|
|
27
|
+
orientation: i,
|
|
28
|
+
className: e("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent", n),
|
|
29
|
+
...a,
|
|
30
|
+
children: /* @__PURE__ */ t(r.Thumb, {
|
|
31
|
+
"data-slot": "scroll-area-thumb",
|
|
32
|
+
className: "relative flex-1 rounded-full bg-border"
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { i as ScrollArea, a as ScrollBar };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import { IconCheck as r, IconChevronDown as i, IconChevronUp as a } from "@tabler/icons-react";
|
|
5
|
+
import { Select as o } from "@base-ui/react/select";
|
|
6
|
+
//#region src/components/select/select.tsx
|
|
7
|
+
var s = o.Root;
|
|
8
|
+
function c({ className: n, ...r }) {
|
|
9
|
+
return /* @__PURE__ */ t(o.Group, {
|
|
10
|
+
"data-slot": "select-group",
|
|
11
|
+
className: e("scroll-my-1 p-1", n),
|
|
12
|
+
...r
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function l({ className: n, ...r }) {
|
|
16
|
+
return /* @__PURE__ */ t(o.Value, {
|
|
17
|
+
"data-slot": "select-value",
|
|
18
|
+
className: e("flex flex-1 text-left", n),
|
|
19
|
+
...r
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function u({ className: r, size: a = "default", children: s, "aria-label": c = "Select an option", ...l }) {
|
|
23
|
+
return /* @__PURE__ */ n(o.Trigger, {
|
|
24
|
+
"aria-label": c,
|
|
25
|
+
"data-slot": "select-trigger",
|
|
26
|
+
"data-size": a,
|
|
27
|
+
className: e("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", r),
|
|
28
|
+
...l,
|
|
29
|
+
children: [s, /* @__PURE__ */ t(o.Icon, { render: /* @__PURE__ */ t(i, { className: "pointer-events-none size-4 text-muted-foreground" }) })]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function d({ className: r, children: i, side: a = "bottom", sideOffset: s = 4, align: c = "center", alignOffset: l = 0, alignItemWithTrigger: u = !0, ...d }) {
|
|
33
|
+
return /* @__PURE__ */ t(o.Portal, { children: /* @__PURE__ */ t(o.Positioner, {
|
|
34
|
+
side: a,
|
|
35
|
+
sideOffset: s,
|
|
36
|
+
align: c,
|
|
37
|
+
alignOffset: l,
|
|
38
|
+
alignItemWithTrigger: u,
|
|
39
|
+
className: "isolate z-50",
|
|
40
|
+
children: /* @__PURE__ */ n(o.Popup, {
|
|
41
|
+
"data-slot": "select-content",
|
|
42
|
+
"data-align-trigger": u,
|
|
43
|
+
className: e("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", r),
|
|
44
|
+
...d,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ t(h, {}),
|
|
47
|
+
/* @__PURE__ */ t(o.List, { children: i }),
|
|
48
|
+
/* @__PURE__ */ t(g, {})
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
}) });
|
|
52
|
+
}
|
|
53
|
+
function f({ className: n, ...r }) {
|
|
54
|
+
return /* @__PURE__ */ t(o.GroupLabel, {
|
|
55
|
+
"data-slot": "select-label",
|
|
56
|
+
className: e("px-1.5 py-1 text-xs text-muted-foreground", n),
|
|
57
|
+
...r
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function p({ className: i, children: a, ...s }) {
|
|
61
|
+
return /* @__PURE__ */ n(o.Item, {
|
|
62
|
+
"data-slot": "select-item",
|
|
63
|
+
className: e("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", i),
|
|
64
|
+
...s,
|
|
65
|
+
children: [/* @__PURE__ */ t(o.ItemText, {
|
|
66
|
+
className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
|
|
67
|
+
children: a
|
|
68
|
+
}), /* @__PURE__ */ t(o.ItemIndicator, {
|
|
69
|
+
render: /* @__PURE__ */ t("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }),
|
|
70
|
+
children: /* @__PURE__ */ t(r, { className: "pointer-events-none" })
|
|
71
|
+
})]
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function m({ className: n, ...r }) {
|
|
75
|
+
return /* @__PURE__ */ t(o.Separator, {
|
|
76
|
+
"data-slot": "select-separator",
|
|
77
|
+
className: e("pointer-events-none -mx-1 my-1 h-px bg-border", n),
|
|
78
|
+
...r
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function h({ className: n, ...r }) {
|
|
82
|
+
return /* @__PURE__ */ t(o.ScrollUpArrow, {
|
|
83
|
+
"data-slot": "select-scroll-up-button",
|
|
84
|
+
className: e("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", n),
|
|
85
|
+
...r,
|
|
86
|
+
children: /* @__PURE__ */ t(a, {})
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function g({ className: n, ...r }) {
|
|
90
|
+
return /* @__PURE__ */ t(o.ScrollDownArrow, {
|
|
91
|
+
"data-slot": "select-scroll-down-button",
|
|
92
|
+
className: e("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", n),
|
|
93
|
+
...r,
|
|
94
|
+
children: /* @__PURE__ */ t(i, {})
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { s as Select, d as SelectContent, c as SelectGroup, p as SelectItem, f as SelectLabel, g as SelectScrollDownButton, h as SelectScrollUpButton, m as SelectSeparator, u as SelectTrigger, l as SelectValue };
|