@ksojecki/purpose-ui 0.0.0-stage → 0.2.1
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/LICENSE +21 -0
- package/README.md +79 -2
- package/assets/fonts/Karla[wght].ttf +0 -0
- package/assets/fonts/OFL.txt +93 -0
- package/dist/Alert-D-5k0maf.js +23 -0
- package/dist/Button-T8UI5igR.js +112 -0
- package/dist/Dropdown-BZKzAbKB.js +56 -0
- package/dist/Heading-CWDWXU_n.js +27 -0
- package/dist/IconButton-P7nSooA3.js +18 -0
- package/dist/Link-9mNYgEzY.js +36 -0
- package/dist/Paragraph-DFwfb2Yt.js +14 -0
- package/dist/Switch-CI8vMkGz.js +84 -0
- package/dist/actions/Button.d.ts +69 -0
- package/dist/actions/ButtonGroup.d.ts +20 -0
- package/dist/actions/IconActionButtons.d.ts +34 -0
- package/dist/actions/IconButton.d.ts +21 -0
- package/dist/actions/index.d.ts +10 -0
- package/dist/actions/index.js +41 -0
- package/dist/classNames-x6JVYA2t.js +5 -0
- package/dist/data/DataTable.d.ts +47 -0
- package/dist/data/Metric.d.ts +46 -0
- package/dist/data/Table.d.ts +33 -0
- package/dist/data/index.d.ts +8 -0
- package/dist/data/index.js +85 -0
- package/dist/feedback/Alert.d.ts +23 -0
- package/dist/feedback/Badge.d.ts +23 -0
- package/dist/feedback/ConfirmDeletePanel.d.ts +32 -0
- package/dist/feedback/EmptyState.d.ts +22 -0
- package/dist/feedback/Progress.d.ts +24 -0
- package/dist/feedback/Skeleton.d.ts +10 -0
- package/dist/feedback/Spinner.d.ts +16 -0
- package/dist/feedback/Toast.d.ts +48 -0
- package/dist/feedback/Tooltip.d.ts +21 -0
- package/dist/feedback/index.d.ts +15 -0
- package/dist/feedback/index.js +138 -0
- package/dist/forms/Checkbox.d.ts +16 -0
- package/dist/forms/DatePicker.d.ts +51 -0
- package/dist/forms/Field.d.ts +65 -0
- package/dist/forms/FileInput.d.ts +20 -0
- package/dist/forms/FilterBar.d.ts +21 -0
- package/dist/forms/FilterRow.d.ts +20 -0
- package/dist/forms/FormActions.d.ts +28 -0
- package/dist/forms/FormField.d.ts +39 -0
- package/dist/forms/Input.d.ts +20 -0
- package/dist/forms/Radio.d.ts +52 -0
- package/dist/forms/Range.d.ts +24 -0
- package/dist/forms/SegmentedControl.d.ts +33 -0
- package/dist/forms/Select.d.ts +23 -0
- package/dist/forms/Switch.d.ts +15 -0
- package/dist/forms/Textarea.d.ts +20 -0
- package/dist/forms/TimePicker.d.ts +29 -0
- package/dist/forms/index.d.ts +21 -0
- package/dist/forms/index.js +429 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +2 -0
- package/dist/icons-CMOARHwx.js +18 -0
- package/dist/internal/classNames.d.ts +1 -0
- package/dist/internal/purpose.d.ts +7 -0
- package/dist/layout/BottomSheet.d.ts +25 -0
- package/dist/layout/Card.d.ts +22 -0
- package/dist/layout/Disclosure.d.ts +18 -0
- package/dist/layout/Divider.d.ts +16 -0
- package/dist/layout/Page/Content.d.ts +11 -0
- package/dist/layout/Page/Page.d.ts +6 -0
- package/dist/layout/Page/index.d.ts +19 -0
- package/dist/layout/PageContainer.d.ts +18 -0
- package/dist/layout/PageHeader.d.ts +25 -0
- package/dist/layout/Section.d.ts +22 -0
- package/dist/layout/index.d.ts +13 -0
- package/dist/layout/index.js +173 -0
- package/dist/navigation/Dropdown.d.ts +47 -0
- package/dist/navigation/Link.d.ts +32 -0
- package/dist/navigation/Menu.d.ts +89 -0
- package/dist/navigation/NavMenu.d.ts +56 -0
- package/dist/navigation/index.d.ts +9 -0
- package/dist/navigation/index.js +128 -0
- package/dist/navigation/popoverFade.d.ts +5 -0
- package/dist/overlays/ConsentBanner/ConsentBanner.d.ts +35 -0
- package/dist/overlays/ConsentBanner/index.d.ts +1 -0
- package/dist/overlays/ConsentSettings/ConsentSettings.d.ts +48 -0
- package/dist/overlays/ConsentSettings/index.d.ts +1 -0
- package/dist/overlays/ModalWindow/ModalWindow.d.ts +60 -0
- package/dist/overlays/ModalWindow/index.d.ts +3 -0
- package/dist/overlays/index.d.ts +8 -0
- package/dist/overlays/index.js +195 -0
- package/dist/typography/Heading/Heading.d.ts +24 -0
- package/dist/typography/Heading/index.d.ts +1 -0
- package/dist/typography/Paragraph.d.ts +16 -0
- package/dist/typography/Prose.d.ts +17 -0
- package/dist/typography/index.d.ts +8 -0
- package/dist/typography/index.js +12 -0
- package/package.json +121 -4
- package/styles/budget.css +9 -0
- package/styles/generic.css +9 -0
- package/styles/roadsign.css +9 -0
- package/styles/traffic.css +9 -0
- package/theme.css +341 -0
- package/themes/budget.css +103 -0
- package/themes/generic.css +103 -0
- package/themes/roadsign.css +103 -0
- package/themes/traffic.css +103 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "../Switch-CI8vMkGz.js";
|
|
2
|
+
import { t as o } from "../classNames-x6JVYA2t.js";
|
|
3
|
+
import { t as s } from "../Button-T8UI5igR.js";
|
|
4
|
+
import { t as c } from "../IconButton-P7nSooA3.js";
|
|
5
|
+
import { t as l } from "../icons-CMOARHwx.js";
|
|
6
|
+
import { t as u } from "../Alert-D-5k0maf.js";
|
|
7
|
+
import { t as d } from "../Dropdown-BZKzAbKB.js";
|
|
8
|
+
import { useEffect as f, useId as p, useState as m } from "react";
|
|
9
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
10
|
+
// src/forms/FormField.tsx
|
|
11
|
+
var v = "input w-full";
|
|
12
|
+
function y({ label: n, type: r, registration: i, errorMessage: a, hint: o }) {
|
|
13
|
+
let s = p();
|
|
14
|
+
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("label", {
|
|
15
|
+
className: v,
|
|
16
|
+
children: /* @__PURE__ */ g("input", {
|
|
17
|
+
"aria-describedby": e(s, o, a),
|
|
18
|
+
"aria-invalid": a ? !0 : void 0,
|
|
19
|
+
placeholder: n,
|
|
20
|
+
type: r,
|
|
21
|
+
...i
|
|
22
|
+
})
|
|
23
|
+
}), /* @__PURE__ */ g(t, {
|
|
24
|
+
controlId: s,
|
|
25
|
+
error: a,
|
|
26
|
+
hint: o
|
|
27
|
+
})] });
|
|
28
|
+
}
|
|
29
|
+
// src/forms/Input.tsx
|
|
30
|
+
var b = {
|
|
31
|
+
xs: "input-xs",
|
|
32
|
+
sm: "input-sm",
|
|
33
|
+
md: "",
|
|
34
|
+
lg: "input-lg"
|
|
35
|
+
};
|
|
36
|
+
function x({ label: r, hint: i, error: a, controlSize: s = "md", fullWidth: c = !0, className: l, id: u, "aria-describedby": d, ...f }) {
|
|
37
|
+
let m = p(), v = u ?? m, y = /* @__PURE__ */ g("input", {
|
|
38
|
+
...f,
|
|
39
|
+
"aria-describedby": e(v, i, a, d),
|
|
40
|
+
"aria-invalid": a ? !0 : f["aria-invalid"],
|
|
41
|
+
className: o("input", b[s], a ? "input-error" : void 0, c ? "w-full" : void 0, l),
|
|
42
|
+
id: v
|
|
43
|
+
});
|
|
44
|
+
return r ? /* @__PURE__ */ g(n, {
|
|
45
|
+
controlId: v,
|
|
46
|
+
error: a,
|
|
47
|
+
hint: i,
|
|
48
|
+
label: r,
|
|
49
|
+
children: y
|
|
50
|
+
}) : /* @__PURE__ */ _(h, { children: [y, /* @__PURE__ */ g(t, {
|
|
51
|
+
controlId: v,
|
|
52
|
+
error: a,
|
|
53
|
+
hint: i
|
|
54
|
+
})] });
|
|
55
|
+
}
|
|
56
|
+
// src/forms/Select.tsx
|
|
57
|
+
var S = {
|
|
58
|
+
xs: "select-xs",
|
|
59
|
+
sm: "select-sm",
|
|
60
|
+
md: "",
|
|
61
|
+
lg: "select-lg"
|
|
62
|
+
};
|
|
63
|
+
function C({ label: r, hint: i, error: a, controlSize: s = "md", fullWidth: c = !0, className: l, id: u, "aria-describedby": d, ...f }) {
|
|
64
|
+
let m = p(), v = u ?? m, y = /* @__PURE__ */ g("select", {
|
|
65
|
+
...f,
|
|
66
|
+
"aria-describedby": e(v, i, a, d),
|
|
67
|
+
"aria-invalid": a ? !0 : f["aria-invalid"],
|
|
68
|
+
className: o("select", S[s], a ? "select-error" : void 0, c ? "w-full" : void 0, l),
|
|
69
|
+
id: v
|
|
70
|
+
});
|
|
71
|
+
return r ? /* @__PURE__ */ g(n, {
|
|
72
|
+
controlId: v,
|
|
73
|
+
error: a,
|
|
74
|
+
hint: i,
|
|
75
|
+
label: r,
|
|
76
|
+
children: y
|
|
77
|
+
}) : /* @__PURE__ */ _(h, { children: [y, /* @__PURE__ */ g(t, {
|
|
78
|
+
controlId: v,
|
|
79
|
+
error: a,
|
|
80
|
+
hint: i
|
|
81
|
+
})] });
|
|
82
|
+
}
|
|
83
|
+
// src/forms/Textarea.tsx
|
|
84
|
+
var w = {
|
|
85
|
+
xs: "textarea-xs",
|
|
86
|
+
sm: "textarea-sm",
|
|
87
|
+
md: "",
|
|
88
|
+
lg: "textarea-lg"
|
|
89
|
+
};
|
|
90
|
+
function T({ label: r, hint: i, error: a, controlSize: s = "md", fullWidth: c = !0, className: l, id: u, "aria-describedby": d, ...f }) {
|
|
91
|
+
let m = p(), v = u ?? m, y = /* @__PURE__ */ g("textarea", {
|
|
92
|
+
...f,
|
|
93
|
+
"aria-describedby": e(v, i, a, d),
|
|
94
|
+
"aria-invalid": a ? !0 : f["aria-invalid"],
|
|
95
|
+
className: o("textarea", w[s], a ? "textarea-error" : void 0, c ? "w-full" : void 0, l),
|
|
96
|
+
id: v
|
|
97
|
+
});
|
|
98
|
+
return r ? /* @__PURE__ */ g(n, {
|
|
99
|
+
controlId: v,
|
|
100
|
+
error: a,
|
|
101
|
+
hint: i,
|
|
102
|
+
label: r,
|
|
103
|
+
children: y
|
|
104
|
+
}) : /* @__PURE__ */ _(h, { children: [y, /* @__PURE__ */ g(t, {
|
|
105
|
+
controlId: v,
|
|
106
|
+
error: a,
|
|
107
|
+
hint: i
|
|
108
|
+
})] });
|
|
109
|
+
}
|
|
110
|
+
// src/forms/Checkbox.tsx
|
|
111
|
+
var E = {
|
|
112
|
+
xs: "checkbox-xs",
|
|
113
|
+
sm: "checkbox-sm",
|
|
114
|
+
md: "",
|
|
115
|
+
lg: "checkbox-lg"
|
|
116
|
+
};
|
|
117
|
+
function D({ label: n, error: r, controlSize: i = "md", className: a, id: s, "aria-describedby": c, ...l }) {
|
|
118
|
+
let u = p(), d = s ?? u;
|
|
119
|
+
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("label", {
|
|
120
|
+
className: "label cursor-pointer gap-2",
|
|
121
|
+
children: [/* @__PURE__ */ g("input", {
|
|
122
|
+
...l,
|
|
123
|
+
"aria-describedby": e(d, void 0, r, c),
|
|
124
|
+
"aria-invalid": r ? !0 : void 0,
|
|
125
|
+
className: o("checkbox", E[i], r ? "checkbox-error" : void 0, a),
|
|
126
|
+
id: d,
|
|
127
|
+
type: "checkbox"
|
|
128
|
+
}), /* @__PURE__ */ g("span", {
|
|
129
|
+
className: "text-sm text-base-content",
|
|
130
|
+
children: n
|
|
131
|
+
})]
|
|
132
|
+
}), /* @__PURE__ */ g(t, {
|
|
133
|
+
controlId: d,
|
|
134
|
+
error: r
|
|
135
|
+
})] });
|
|
136
|
+
}
|
|
137
|
+
// src/forms/Radio.tsx
|
|
138
|
+
var O = {
|
|
139
|
+
xs: "radio-xs",
|
|
140
|
+
sm: "radio-sm",
|
|
141
|
+
md: "",
|
|
142
|
+
lg: "radio-lg"
|
|
143
|
+
}, k = {
|
|
144
|
+
vertical: "flex flex-col gap-2",
|
|
145
|
+
horizontal: "flex flex-row flex-wrap gap-4"
|
|
146
|
+
};
|
|
147
|
+
function A({ className: n, controlSize: r = "md", error: i, hint: a, id: s, label: c, "aria-describedby": l, ...u }) {
|
|
148
|
+
let d = p(), f = s ?? d;
|
|
149
|
+
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("label", {
|
|
150
|
+
className: "label cursor-pointer gap-2",
|
|
151
|
+
children: [/* @__PURE__ */ g("input", {
|
|
152
|
+
...u,
|
|
153
|
+
"aria-describedby": e(f, a, i, l),
|
|
154
|
+
className: o("radio", O[r], n),
|
|
155
|
+
id: f,
|
|
156
|
+
type: "radio"
|
|
157
|
+
}), /* @__PURE__ */ g("span", { children: c })]
|
|
158
|
+
}), /* @__PURE__ */ g(t, {
|
|
159
|
+
controlId: f,
|
|
160
|
+
error: i,
|
|
161
|
+
hint: a
|
|
162
|
+
})] });
|
|
163
|
+
}
|
|
164
|
+
function j({ error: t, hint: r, legend: i, name: a, onChange: o, options: s, orientation: c = "vertical", value: l }) {
|
|
165
|
+
let u = p(), d = e(u, r, t);
|
|
166
|
+
return /* @__PURE__ */ g(n, {
|
|
167
|
+
error: t,
|
|
168
|
+
hint: r,
|
|
169
|
+
id: u,
|
|
170
|
+
label: i,
|
|
171
|
+
children: /* @__PURE__ */ g("div", {
|
|
172
|
+
"aria-invalid": t ? !0 : void 0,
|
|
173
|
+
className: k[c],
|
|
174
|
+
role: "radiogroup",
|
|
175
|
+
children: s.map((e) => /* @__PURE__ */ g(A, {
|
|
176
|
+
"aria-describedby": d,
|
|
177
|
+
checked: e.value === l,
|
|
178
|
+
disabled: e.disabled,
|
|
179
|
+
label: e.label,
|
|
180
|
+
name: a,
|
|
181
|
+
onChange: (e) => o(e.currentTarget.value),
|
|
182
|
+
value: e.value
|
|
183
|
+
}, e.value))
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
// src/forms/Range.tsx
|
|
188
|
+
var M = {
|
|
189
|
+
primary: "range-primary",
|
|
190
|
+
info: "range-info",
|
|
191
|
+
success: "range-success",
|
|
192
|
+
warning: "range-warning",
|
|
193
|
+
error: "range-error"
|
|
194
|
+
}, N = {
|
|
195
|
+
xs: "range-xs",
|
|
196
|
+
sm: "range-sm",
|
|
197
|
+
md: "",
|
|
198
|
+
lg: "range-lg"
|
|
199
|
+
}, P = ({ label: e, max: t, min: n, onChange: r, purpose: i = "primary", size: a = "md", step: s, value: c, ...l }) => /* @__PURE__ */ g("input", {
|
|
200
|
+
"aria-label": e,
|
|
201
|
+
className: o("range", M[i], N[a]),
|
|
202
|
+
max: t,
|
|
203
|
+
min: n,
|
|
204
|
+
onChange: (e) => r(Number(e.currentTarget.value)),
|
|
205
|
+
step: s,
|
|
206
|
+
type: "range",
|
|
207
|
+
value: c,
|
|
208
|
+
...l
|
|
209
|
+
}), F = {
|
|
210
|
+
xs: "file-input-xs",
|
|
211
|
+
sm: "file-input-sm",
|
|
212
|
+
md: "",
|
|
213
|
+
lg: "file-input-lg"
|
|
214
|
+
};
|
|
215
|
+
function I({ label: r, hint: i, error: a, controlSize: s = "md", fullWidth: c = !0, className: l, id: u, "aria-describedby": d, ...f }) {
|
|
216
|
+
let m = p(), v = u ?? m, y = /* @__PURE__ */ g("input", {
|
|
217
|
+
...f,
|
|
218
|
+
"aria-describedby": e(v, i, a, d),
|
|
219
|
+
"aria-invalid": a ? !0 : f["aria-invalid"],
|
|
220
|
+
className: o("file-input", F[s], a ? "file-input-error" : void 0, c ? "w-full" : void 0, l),
|
|
221
|
+
id: v,
|
|
222
|
+
type: "file"
|
|
223
|
+
});
|
|
224
|
+
return r ? /* @__PURE__ */ g(n, {
|
|
225
|
+
controlId: v,
|
|
226
|
+
error: a,
|
|
227
|
+
hint: i,
|
|
228
|
+
label: r,
|
|
229
|
+
children: y
|
|
230
|
+
}) : /* @__PURE__ */ _(h, { children: [y, /* @__PURE__ */ g(t, {
|
|
231
|
+
controlId: v,
|
|
232
|
+
error: a,
|
|
233
|
+
hint: i
|
|
234
|
+
})] });
|
|
235
|
+
}
|
|
236
|
+
// src/forms/SegmentedControl.tsx
|
|
237
|
+
var L = "gap-1 rounded-field border border-(--control-border) bg-base-200 p-1", R = ({ fullWidth: e = !1, label: t, onChange: n, options: r, size: i, value: a }) => /* @__PURE__ */ g("fieldset", {
|
|
238
|
+
"aria-label": t,
|
|
239
|
+
className: e ? `flex w-full ${L}` : `inline-flex ${L}`,
|
|
240
|
+
children: r.map((t) => {
|
|
241
|
+
let r = t.value === a;
|
|
242
|
+
return /* @__PURE__ */ g(s, {
|
|
243
|
+
"aria-pressed": r,
|
|
244
|
+
className: e ? "flex-1 px-1 whitespace-nowrap" : void 0,
|
|
245
|
+
disabled: t.disabled,
|
|
246
|
+
onClick: () => n(t.value),
|
|
247
|
+
size: i,
|
|
248
|
+
tone: r ? "default" : "ghost",
|
|
249
|
+
children: t.label
|
|
250
|
+
}, t.value);
|
|
251
|
+
})
|
|
252
|
+
});
|
|
253
|
+
// src/forms/FilterBar.tsx
|
|
254
|
+
function z({ children: e, actions: t, className: n, ...r }) {
|
|
255
|
+
return /* @__PURE__ */ _("div", {
|
|
256
|
+
...r,
|
|
257
|
+
className: o("flex flex-wrap items-end gap-3 [&_.input]:input-sm [&_.select]:select-sm [&_.btn]:btn-sm", n),
|
|
258
|
+
children: [e, t ? /* @__PURE__ */ g("div", {
|
|
259
|
+
className: "ml-auto self-end",
|
|
260
|
+
children: t
|
|
261
|
+
}) : null]
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
// src/forms/FilterRow.tsx
|
|
265
|
+
function B({ children: e, className: t, onRemove: n, removeLabel: r = "Remove", ...i }) {
|
|
266
|
+
return /* @__PURE__ */ _("div", {
|
|
267
|
+
...i,
|
|
268
|
+
className: o("flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto", t),
|
|
269
|
+
children: [e, n ? /* @__PURE__ */ g(c, {
|
|
270
|
+
className: "shrink-0",
|
|
271
|
+
icon: /* @__PURE__ */ g(l.TbX, { "aria-hidden": "true" }),
|
|
272
|
+
label: r,
|
|
273
|
+
onClick: n,
|
|
274
|
+
size: "sm"
|
|
275
|
+
}) : null]
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
// src/forms/FormActions.tsx
|
|
279
|
+
var V = ({ cancelLabel: e, className: t, error: n, onCancel: r, saveLabel: i, saving: a = !1, savingLabel: o }) => /* @__PURE__ */ _("div", {
|
|
280
|
+
className: t,
|
|
281
|
+
children: [n ? /* @__PURE__ */ g(u, {
|
|
282
|
+
"aria-live": "assertive",
|
|
283
|
+
className: "mb-3",
|
|
284
|
+
purpose: "error",
|
|
285
|
+
children: n
|
|
286
|
+
}) : null, /* @__PURE__ */ _("div", {
|
|
287
|
+
className: "flex gap-2",
|
|
288
|
+
children: [/* @__PURE__ */ g(s, {
|
|
289
|
+
disabled: a,
|
|
290
|
+
purpose: "save",
|
|
291
|
+
size: "sm",
|
|
292
|
+
type: "submit",
|
|
293
|
+
children: a && o ? o : i
|
|
294
|
+
}), /* @__PURE__ */ g(s, {
|
|
295
|
+
disabled: a,
|
|
296
|
+
onClick: r,
|
|
297
|
+
purpose: "cancel",
|
|
298
|
+
size: "sm",
|
|
299
|
+
children: e
|
|
300
|
+
})]
|
|
301
|
+
})]
|
|
302
|
+
});
|
|
303
|
+
// src/forms/DatePicker.tsx
|
|
304
|
+
function H(e, t) {
|
|
305
|
+
let [n, r, i] = e.split("-").map(Number);
|
|
306
|
+
return !n || !r || !i ? "—" : new Date(n, r - 1, i).toLocaleDateString(t);
|
|
307
|
+
}
|
|
308
|
+
function U({ id: e, min: t, max: n, onChange: r, value: i, disabled: a, locale: o, previousLabel: s, nextLabel: c }) {
|
|
309
|
+
let [l, u] = m(!1);
|
|
310
|
+
f(() => {
|
|
311
|
+
import("cally");
|
|
312
|
+
}, []);
|
|
313
|
+
let [p, h] = m(a);
|
|
314
|
+
return a !== p && (h(a), a && u(!1)), /* @__PURE__ */ g(d, {
|
|
315
|
+
disabled: a,
|
|
316
|
+
onOpenChange: u,
|
|
317
|
+
open: l,
|
|
318
|
+
trigger: H(i, o),
|
|
319
|
+
triggerClassName: "w-full justify-start",
|
|
320
|
+
triggerId: e,
|
|
321
|
+
triggerSize: "sm",
|
|
322
|
+
children: /* @__PURE__ */ _("calendar-date", {
|
|
323
|
+
class: "cally",
|
|
324
|
+
locale: o,
|
|
325
|
+
ref: (e) => {
|
|
326
|
+
t && e?.setAttribute("min", t), n && e?.setAttribute("max", n);
|
|
327
|
+
},
|
|
328
|
+
onchange: (e) => {
|
|
329
|
+
r(e.target.value), u(!1);
|
|
330
|
+
},
|
|
331
|
+
value: i,
|
|
332
|
+
children: [
|
|
333
|
+
/* @__PURE__ */ g("svg", {
|
|
334
|
+
"aria-label": s,
|
|
335
|
+
className: "size-4 fill-current",
|
|
336
|
+
slot: "previous",
|
|
337
|
+
viewBox: "0 0 24 24",
|
|
338
|
+
children: /* @__PURE__ */ g("path", { d: "M15.75 19.5 8.25 12l7.5-7.5" })
|
|
339
|
+
}),
|
|
340
|
+
/* @__PURE__ */ g("svg", {
|
|
341
|
+
"aria-label": c,
|
|
342
|
+
className: "size-4 fill-current",
|
|
343
|
+
slot: "next",
|
|
344
|
+
viewBox: "0 0 24 24",
|
|
345
|
+
children: /* @__PURE__ */ g("path", { d: "m8.25 4.5 7.5 7.5-7.5 7.5" })
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ g("calendar-month", {})
|
|
348
|
+
]
|
|
349
|
+
})
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
// src/forms/TimePicker.tsx
|
|
353
|
+
function W({ maxHour: e, label: t, onSelect: n }) {
|
|
354
|
+
return /* @__PURE__ */ _("fieldset", {
|
|
355
|
+
"aria-label": t,
|
|
356
|
+
className: "grid max-h-48 min-w-0 grid-cols-4 gap-1 overflow-y-auto border-0 p-0",
|
|
357
|
+
children: [/* @__PURE__ */ g("legend", {
|
|
358
|
+
className: "col-span-4 mb-1 text-sm font-medium",
|
|
359
|
+
children: t
|
|
360
|
+
}), Array.from({ length: e + 1 }, (e, t) => /* @__PURE__ */ g(s, {
|
|
361
|
+
onClick: () => n(t),
|
|
362
|
+
purpose: "neutral",
|
|
363
|
+
size: "sm",
|
|
364
|
+
children: String(t).padStart(2, "0")
|
|
365
|
+
}, t))]
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
function G({ hour: e, maxHour: t, maxMinute: n, label: r, changeHourLabel: i, onChangeHour: a, onSelect: o }) {
|
|
369
|
+
return /* @__PURE__ */ _("fieldset", {
|
|
370
|
+
"aria-label": r,
|
|
371
|
+
className: "grid min-w-0 grid-cols-4 gap-1 border-0 p-0",
|
|
372
|
+
children: [
|
|
373
|
+
/* @__PURE__ */ g("legend", {
|
|
374
|
+
className: "sr-only",
|
|
375
|
+
children: r
|
|
376
|
+
}),
|
|
377
|
+
/* @__PURE__ */ _("div", {
|
|
378
|
+
className: "col-span-4 mb-1 flex items-center justify-between text-sm font-medium",
|
|
379
|
+
children: [/* @__PURE__ */ g("span", {
|
|
380
|
+
"aria-hidden": "true",
|
|
381
|
+
children: r
|
|
382
|
+
}), /* @__PURE__ */ g(s, {
|
|
383
|
+
onClick: a,
|
|
384
|
+
purpose: "cancel",
|
|
385
|
+
size: "xs",
|
|
386
|
+
children: i
|
|
387
|
+
})]
|
|
388
|
+
}),
|
|
389
|
+
Array.from({ length: 12 }, (e, t) => t * 5).filter((r) => e < t || r <= n).map((t) => /* @__PURE__ */ g(s, {
|
|
390
|
+
onClick: () => o(`${String(e).padStart(2, "0")}:${String(t).padStart(2, "0")}`),
|
|
391
|
+
purpose: "neutral",
|
|
392
|
+
size: "sm",
|
|
393
|
+
children: String(t).padStart(2, "0")
|
|
394
|
+
}, t))
|
|
395
|
+
]
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
function K({ id: e, value: t, max: n = "23:59", disabled: r, label: i, selectHourLabel: a, selectMinuteLabel: o, changeHourLabel: s, onChange: c }) {
|
|
399
|
+
let [l, u] = m(!1), [f, p] = m(null), [h, _] = n.split(":").map(Number), [v, y] = m(r);
|
|
400
|
+
return r !== v && (y(r), r && u(!1)), /* @__PURE__ */ g(d, {
|
|
401
|
+
contentClassName: "w-64",
|
|
402
|
+
disabled: r,
|
|
403
|
+
onOpenChange: (e) => {
|
|
404
|
+
u(e), p(null);
|
|
405
|
+
},
|
|
406
|
+
open: l,
|
|
407
|
+
trigger: t,
|
|
408
|
+
triggerClassName: "w-full justify-start",
|
|
409
|
+
triggerId: e,
|
|
410
|
+
triggerLabel: t ? `${i}, ${t}` : i,
|
|
411
|
+
triggerSize: "sm",
|
|
412
|
+
children: f === null ? /* @__PURE__ */ g(W, {
|
|
413
|
+
label: a,
|
|
414
|
+
maxHour: h,
|
|
415
|
+
onSelect: p
|
|
416
|
+
}) : /* @__PURE__ */ g(G, {
|
|
417
|
+
changeHourLabel: s,
|
|
418
|
+
hour: f,
|
|
419
|
+
label: o,
|
|
420
|
+
maxHour: h,
|
|
421
|
+
maxMinute: _,
|
|
422
|
+
onChangeHour: () => p(null),
|
|
423
|
+
onSelect: (e) => {
|
|
424
|
+
c(e), p(null), u(!1);
|
|
425
|
+
}
|
|
426
|
+
})
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
export { D as Checkbox, U as DatePicker, n as Field, i as FieldMessage, t as FieldMessages, I as FileInput, z as FilterBar, B as FilterRow, V as FormActions, y as FormField, x as Input, A as Radio, j as RadioGroup, P as Range, R as SegmentedControl, C as Select, a as Switch, T as Textarea, K as TimePicker, e as fieldDescribedBy, r as fieldIds };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
|
+
var e = Object.defineProperty, t = Object.getOwnPropertyDescriptor, n = Object.getOwnPropertyNames, r = Object.prototype.hasOwnProperty, i = (t, n) => {
|
|
3
|
+
let r = {};
|
|
4
|
+
for (var i in t) e(r, i, {
|
|
5
|
+
get: t[i],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
+
}, a = (i, a, o, s) => {
|
|
10
|
+
if (a && typeof a == "object" || typeof a == "function") for (var c = n(a), l = 0, u = c.length, d; l < u; l++) d = c[l], !r.call(i, d) && d !== o && e(i, d, {
|
|
11
|
+
get: ((e) => a[e]).bind(null, d),
|
|
12
|
+
enumerable: !(s = t(a, d)) || s.enumerable
|
|
13
|
+
});
|
|
14
|
+
return i;
|
|
15
|
+
}, o = (e, t, n) => (a(e, t, "default"), n && a(n, t, "default")), s = /* @__PURE__ */ i({});
|
|
16
|
+
import * as c from "react-icons/tb";
|
|
17
|
+
o(s, c);
|
|
18
|
+
export { s as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function joinClassNames(...classNames: Array<string | undefined>): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ButtonTone, ButtonVariant } from '../actions/Button';
|
|
2
|
+
export type ActionPurpose = 'save' | 'cancel' | 'delete' | 'create' | 'edit' | 'confirm' | 'neutral';
|
|
3
|
+
export type StatusPurpose = 'info' | 'success' | 'warning' | 'error';
|
|
4
|
+
export declare const ACTION_PURPOSES: Record<ActionPurpose, {
|
|
5
|
+
tone: ButtonTone;
|
|
6
|
+
variant: ButtonVariant;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export interface BottomSheetProps extends Omit<ComponentPropsWithoutRef<'section'>, 'title'> {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/** Uncontrolled initial state. Ignored when `open` is set. */
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Controlled open state. */
|
|
8
|
+
open?: boolean;
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
/** Shown under the title, so a result stays visible while the sheet is collapsed. */
|
|
11
|
+
summary?: ReactNode;
|
|
12
|
+
title: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Panel docked at the bottom of a flex column. The body stays mounted when collapsed,
|
|
16
|
+
* so form state inside it is kept.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <BottomSheet defaultOpen summary="3 stops, 25 min" title="Route">
|
|
21
|
+
* <StopList />
|
|
22
|
+
* </BottomSheet>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function BottomSheet({ children, className, defaultOpen, onOpenChange, open, summary, title, ...rest }: BottomSheetProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
export type CardSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export interface CardProps extends Omit<ComponentPropsWithoutRef<'section'>, 'title'> {
|
|
4
|
+
actions?: ReactNode;
|
|
5
|
+
/** Use `article` for a self-contained item in a list, such as an account. */
|
|
6
|
+
as?: 'section' | 'article';
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
size?: CardSize;
|
|
10
|
+
title?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Reusable content container for grouping related UI sections.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Card actions={<Button purpose="edit">Change</Button>} title="Plan">
|
|
18
|
+
* <Paragraph>Pro, billed yearly.</Paragraph>
|
|
19
|
+
* </Card>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function Card({ actions, as: Element, children, className, size, title, ...rest }: CardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
export interface DisclosureProps extends ComponentPropsWithoutRef<'details'> {
|
|
3
|
+
bordered?: boolean;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
summary: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Native disclosure: Enter and Space toggle it through the `summary` element.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Disclosure bordered summary="Shipping details">
|
|
14
|
+
* <Paragraph>Ships within two working days.</Paragraph>
|
|
15
|
+
* </Disclosure>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const Disclosure: ({ bordered, children, className, open, summary, ...rest }: DisclosureProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
export interface DividerProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
vertical?: boolean;
|
|
5
|
+
/** For a flex-row parent: draws a vertical separator between items. */
|
|
6
|
+
row?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Separates content. Pass `children` to label the divider.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Divider>or</Divider>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const Divider: ({ children, className, row, vertical, ...rest }: DividerProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export type ContentProps = {
|
|
3
|
+
children: ReactNode | ReactNode[];
|
|
4
|
+
};
|
|
5
|
+
export type TitleProps = {
|
|
6
|
+
children: string;
|
|
7
|
+
};
|
|
8
|
+
export type TitleType = ReactElement<TitleProps>;
|
|
9
|
+
export type ContentType = ReactElement<ContentProps>;
|
|
10
|
+
export declare const Title: ({ children }: TitleProps) => TitleType;
|
|
11
|
+
export declare const Content: ({ children }: ContentProps) => ContentType;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Page as PageComponent } from './Page';
|
|
2
|
+
import { Content, Title } from './Content';
|
|
3
|
+
/**
|
|
4
|
+
* Page shell: a `main` element with a `Page.Title` heading and a `Page.Content` body, in that order.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Page>
|
|
9
|
+
* <Page.Title>Invoices</Page.Title>
|
|
10
|
+
* <Page.Content>
|
|
11
|
+
* <InvoiceList />
|
|
12
|
+
* </Page.Content>
|
|
13
|
+
* </Page>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const Page: typeof PageComponent & {
|
|
17
|
+
Title: typeof Title;
|
|
18
|
+
Content: typeof Content;
|
|
19
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
export type PageContainerWidth = 'standard' | 'wide' | 'full';
|
|
3
|
+
export interface PageContainerProps extends ComponentPropsWithoutRef<'div'> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
width?: PageContainerWidth;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Centres page content and caps its width: `standard` (default), `wide` or `full`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <PageContainer width="wide">
|
|
14
|
+
* <PageHeader title="Reports" />
|
|
15
|
+
* </PageContainer>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function PageContainer({ children, className, width, ...rest }: PageContainerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
export interface PageHeaderProps extends Omit<ComponentPropsWithoutRef<'header'>, 'title'> {
|
|
3
|
+
actions?: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Use a compact, unboxed presentation when the header sits directly on the page. */
|
|
6
|
+
appearance?: 'default' | 'plain';
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
eyebrow?: ReactNode;
|
|
9
|
+
meta?: ReactNode;
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Page title block with an optional eyebrow, description, meta line and actions.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <PageHeader
|
|
18
|
+
* actions={<NewButton label="New invoice" />}
|
|
19
|
+
* description="All invoices issued this year."
|
|
20
|
+
* eyebrow="Billing"
|
|
21
|
+
* title="Invoices"
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function PageHeader({ actions, className, appearance, description, eyebrow, meta, title, ...rest }: PageHeaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
export interface SectionProps extends Omit<ComponentPropsWithoutRef<'section'>, 'title'> {
|
|
3
|
+
actions?: ReactNode;
|
|
4
|
+
/** Use a compact, unboxed presentation when the section is part of the page flow. */
|
|
5
|
+
appearance?: 'default' | 'plain';
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
contentClassName?: string;
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Titled block of a page with an optional description and actions. Framed by default; `appearance="plain"` drops the frame.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Section actions={<EditButton label="Edit address" />} title="Address">
|
|
18
|
+
* <Paragraph>ul. Długa 1, Gdańsk</Paragraph>
|
|
19
|
+
* </Section>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function Section({ actions, appearance, children, className, contentClassName, description, title, ...rest }: SectionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page shells, headers, sections, cards and other containers.
|
|
3
|
+
*
|
|
4
|
+
* @module @ksojecki/purpose-ui/layout
|
|
5
|
+
*/
|
|
6
|
+
export * from './BottomSheet';
|
|
7
|
+
export * from './Card';
|
|
8
|
+
export * from './Disclosure';
|
|
9
|
+
export * from './Divider';
|
|
10
|
+
export * from './PageContainer';
|
|
11
|
+
export * from './PageHeader';
|
|
12
|
+
export * from './Section';
|
|
13
|
+
export { Page } from './Page';
|