@alea-design/ui 0.2.0 → 0.3.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/README.md +2 -2
- package/dist/components/accordion/Accordion.js +29 -0
- package/dist/components/ai/AI.d.ts +5 -1
- package/dist/components/ai/AI.js +187 -0
- package/dist/components/app/AppParts.d.ts +16 -4
- package/dist/components/app/AppParts.js +134 -0
- package/dist/components/button/Button.d.ts +1 -1
- package/dist/components/button/Button.js +137 -0
- package/dist/components/button/Groups.d.ts +1 -1
- package/dist/components/button/Groups.js +112 -0
- package/dist/components/card/Card.d.ts +3 -2
- package/dist/components/card/Card.js +47 -0
- package/dist/components/chat/Chat.d.ts +4 -2
- package/dist/components/chat/Chat.js +275 -0
- package/dist/components/choice/Choice.js +69 -0
- package/dist/components/color/Color.d.ts +3 -3
- package/dist/components/color/Color.js +98 -0
- package/dist/components/combobox/Autocomplete.d.ts +5 -5
- package/dist/components/combobox/Autocomplete.js +126 -0
- package/dist/components/combobox/ComboBox.d.ts +4 -4
- package/dist/components/combobox/ComboBox.js +112 -0
- package/dist/components/combobox/Highlight.js +50 -0
- package/dist/components/command/CommandPalette.d.ts +10 -3
- package/dist/components/command/CommandPalette.js +56 -0
- package/dist/components/content/Content.d.ts +1 -1
- package/dist/components/content/Content.js +125 -0
- package/dist/components/data/Data.js +79 -0
- package/dist/components/date/Date.js +109 -0
- package/dist/components/display/Display.d.ts +5 -3
- package/dist/components/display/Display.js +89 -0
- package/dist/components/display/Display2.d.ts +3 -1
- package/dist/components/display/Display2.js +75 -0
- package/dist/components/emoji/EmojiPicker.js +52 -0
- package/dist/components/emoji/emoji-data.js +27 -0
- package/dist/components/extras/CodeSteps.d.ts +1 -0
- package/dist/components/extras/CodeSteps.js +19 -0
- package/dist/components/extras/Extras.d.ts +1 -1
- package/dist/components/extras/Extras.js +116 -0
- package/dist/components/feedback/Feedback.d.ts +11 -8
- package/dist/components/feedback/Feedback.js +185 -0
- package/dist/components/feedback/Spinner.js +18 -0
- package/dist/components/feedback/Status.d.ts +6 -2
- package/dist/components/feedback/Status.js +48 -0
- package/dist/components/field/Field.d.ts +1 -1
- package/dist/components/field/Field.js +187 -0
- package/dist/components/field/FieldLoading.d.ts +1 -1
- package/dist/components/field/FieldLoading.js +18 -0
- package/dist/components/filter/FilterBar.js +96 -0
- package/dist/components/form/Form.d.ts +5 -5
- package/dist/components/form/Form.js +53 -0
- package/dist/components/icon/Icon.d.ts +2 -2
- package/dist/components/icon/Icon.js +66 -0
- package/dist/components/icon/icon-cells.js +39 -0
- package/dist/components/icon/icon-contexts.d.ts +1 -1
- package/dist/components/icon/icon-contexts.js +38 -0
- package/dist/components/icon/icon-names.d.ts +1 -1
- package/dist/components/icon/icon-names.js +376 -0
- package/dist/components/layout/Bento.d.ts +1 -1
- package/dist/components/layout/Bento.js +38 -0
- package/dist/components/layout/Layout.d.ts +1 -1
- package/dist/components/layout/Layout.js +54 -0
- package/dist/components/layout/Layout2.d.ts +36 -6
- package/dist/components/layout/Layout2.js +105 -0
- package/dist/components/layout/Layout3.js +35 -0
- package/dist/components/layout/Responsive.d.ts +1 -1
- package/dist/components/layout/Responsive.js +32 -0
- package/dist/components/list/List.d.ts +3 -2
- package/dist/components/list/List.js +82 -0
- package/dist/components/list/Lists2.d.ts +6 -4
- package/dist/components/list/Lists2.js +60 -0
- package/dist/components/media/Media.d.ts +8 -4
- package/dist/components/media/Media.js +188 -0
- package/dist/components/menu/Menu.d.ts +23 -12
- package/dist/components/menu/Menu.js +68 -0
- package/dist/components/more/More.d.ts +7 -7
- package/dist/components/more/More.js +182 -0
- package/dist/components/navigation/Navbar.d.ts +1 -1
- package/dist/components/navigation/Navbar.js +27 -0
- package/dist/components/navigation/Navigation.js +121 -0
- package/dist/components/navigation/Navigation2.d.ts +6 -2
- package/dist/components/navigation/Navigation2.js +355 -0
- package/dist/components/overlay/Drawer.d.ts +11 -6
- package/dist/components/overlay/Drawer.js +39 -0
- package/dist/components/overlay/Modal.d.ts +6 -3
- package/dist/components/overlay/Modal.js +27 -0
- package/dist/components/overlay/Overlay.d.ts +14 -9
- package/dist/components/overlay/Overlay.js +76 -0
- package/dist/components/overlay/Sheet.d.ts +11 -5
- package/dist/components/overlay/Sheet.js +52 -0
- package/dist/components/page/Page.d.ts +5 -5
- package/dist/components/page/Page.js +132 -0
- package/dist/components/page/PageParts.d.ts +5 -5
- package/dist/components/page/PageParts.js +109 -0
- package/dist/components/picker/Picker.d.ts +11 -11
- package/dist/components/picker/Picker.js +294 -0
- package/dist/components/picker/Wheel.js +132 -0
- package/dist/components/rating/Rating.d.ts +2 -1
- package/dist/components/rating/Rating.js +66 -0
- package/dist/components/select/Select.d.ts +8 -6
- package/dist/components/select/Select.js +146 -0
- package/dist/components/shell/AppShell.d.ts +3 -3
- package/dist/components/shell/AppShell.js +56 -0
- package/dist/components/shell/AppSidebar.d.ts +5 -5
- package/dist/components/shell/AppSidebar.js +62 -0
- package/dist/components/slider/Slider.d.ts +2 -1
- package/dist/components/slider/Slider.js +36 -0
- package/dist/components/surface/Surface.d.ts +16 -0
- package/dist/components/surface/Surface.js +7 -0
- package/dist/components/table/Table.d.ts +4 -3
- package/dist/components/table/Table.js +58 -0
- package/dist/components/tabs/Tabs.d.ts +1 -0
- package/dist/components/tabs/Tabs.js +120 -0
- package/dist/components/theme/Theme.d.ts +11 -6
- package/dist/components/theme/Theme.js +186 -0
- package/dist/components/theme/lens.js +104 -0
- package/dist/components/tree/Tree.js +303 -0
- package/dist/components/typography/Typography.js +43 -0
- package/dist/components/upload/Upload.js +71 -0
- package/dist/components/work/Ops.js +24 -0
- package/dist/components/work/Work.d.ts +4 -2
- package/dist/components/work/Work.js +241 -0
- package/dist/css/accordion.css +1 -0
- package/dist/css/ai.css +1 -0
- package/dist/css/app.css +1 -0
- package/dist/css/base.css +1 -0
- package/dist/css/button.css +1 -0
- package/dist/css/card.css +1 -0
- package/dist/css/chat.css +1 -0
- package/dist/css/choice.css +1 -0
- package/dist/css/color.css +1 -0
- package/dist/css/combobox.css +1 -0
- package/dist/css/command.css +1 -0
- package/dist/css/content.css +1 -0
- package/dist/css/data.css +1 -0
- package/dist/css/date.css +1 -0
- package/dist/css/display.css +1 -0
- package/dist/css/emoji.css +1 -0
- package/dist/css/extras.css +1 -0
- package/dist/css/feedback.css +1 -0
- package/dist/css/field.css +1 -0
- package/dist/css/filter.css +1 -0
- package/dist/css/form.css +1 -0
- package/dist/css/groups.json +346 -0
- package/dist/css/icon.css +1 -0
- package/dist/css/layout.css +1 -0
- package/dist/css/list.css +1 -0
- package/dist/css/media.css +1 -0
- package/dist/css/menu.css +1 -0
- package/dist/css/more.css +1 -0
- package/dist/css/navigation.css +1 -0
- package/dist/css/overlay.css +1 -0
- package/dist/css/page.css +1 -0
- package/dist/css/picker.css +1 -0
- package/dist/css/rating.css +1 -0
- package/dist/css/select.css +1 -0
- package/dist/css/shell.css +1 -0
- package/dist/css/slider.css +1 -0
- package/dist/css/surface.css +1 -0
- package/dist/css/table.css +1 -0
- package/dist/css/tabs.css +1 -0
- package/dist/css/tree.css +1 -0
- package/dist/css/typography.css +1 -0
- package/dist/css/upload.css +1 -0
- package/dist/css/work.css +1 -0
- package/dist/i18n/strings.js +842 -0
- package/dist/index.d.ts +71 -70
- package/dist/index.js +398 -7436
- package/dist/styles.css +1 -1
- package/dist/utils/Blueprint.js +131 -0
- package/dist/utils/DotField.js +32 -0
- package/dist/utils/attr.d.ts +1 -1
- package/dist/utils/attr.js +18 -0
- package/dist/utils/blueprintScene.js +161 -0
- package/dist/utils/controlled.js +11 -0
- package/dist/utils/cx.js +11 -0
- package/dist/utils/inert.js +9 -0
- package/dist/utils/refs.d.ts +3 -0
- package/dist/utils/refs.js +11 -0
- package/dist/utils/responsive.js +12 -0
- package/dist/utils/scrollEdges.js +31 -0
- package/dist/utils/space.js +10 -0
- package/dist/utils/vocabulary.d.ts +6 -0
- package/dist/utils/vocabulary.js +17 -0
- package/package.json +12 -8
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e, jsxs as r, Fragment as P } from "react/jsx-runtime";
|
|
3
|
+
import { useState as j, useRef as O } from "react";
|
|
4
|
+
import { Text as U, FieldError as X, Group as Z, Label as H, NumberField as J, Button as g, Input as C, SearchField as K, TextField as G, TextArea as Q } from "react-aria-components";
|
|
5
|
+
import { Minus as W, Plus as Y, ChevronUp as _, ChevronDown as M, EyeOff as ee, Eye as ae, Search as le, X as L } from "lucide-react";
|
|
6
|
+
import { cx as S, withBase as $ } from "../../utils/cx.js";
|
|
7
|
+
import { useStrings as y } from "../../i18n/strings.js";
|
|
8
|
+
import { useControlled as k } from "../../utils/controlled.js";
|
|
9
|
+
import { responsiveAttrs as ie } from "../../utils/responsive.js";
|
|
10
|
+
import { Spinner as se } from "../feedback/Spinner.js";
|
|
11
|
+
import { FieldSpinner as B, loadingAttrs as te } from "./FieldLoading.js";
|
|
12
|
+
function re({ className: a, ...l }) {
|
|
13
|
+
return /* @__PURE__ */ e(H, { ...l, className: S("alea-label", a) });
|
|
14
|
+
}
|
|
15
|
+
function ne({ className: a, ...l }) {
|
|
16
|
+
return /* @__PURE__ */ e(U, { ...l, slot: "description", className: S("alea-description", a) });
|
|
17
|
+
}
|
|
18
|
+
function ce({ className: a, ...l }) {
|
|
19
|
+
return /* @__PURE__ */ e(X, { ...l, className: S("alea-field-error", a) });
|
|
20
|
+
}
|
|
21
|
+
const A = (a, l, s, i, d) => ({
|
|
22
|
+
...ie("size", a, "md"),
|
|
23
|
+
"data-variant": l !== "outline" ? l : void 0,
|
|
24
|
+
"data-label-position": s !== "top" ? s : void 0,
|
|
25
|
+
"data-warning": i ? !0 : void 0,
|
|
26
|
+
...te(d)
|
|
27
|
+
});
|
|
28
|
+
function R({ label: a, showOptional: l, isRequired: s }) {
|
|
29
|
+
const i = y();
|
|
30
|
+
return a ? /* @__PURE__ */ r(re, { children: [
|
|
31
|
+
a,
|
|
32
|
+
s && /* @__PURE__ */ e("span", { className: "alea-label-required", "aria-hidden": "true", children: " *" }),
|
|
33
|
+
l && !s && /* @__PURE__ */ r("span", { className: "alea-label-optional", children: [
|
|
34
|
+
" (",
|
|
35
|
+
i.optional,
|
|
36
|
+
")"
|
|
37
|
+
] })
|
|
38
|
+
] }) : null;
|
|
39
|
+
}
|
|
40
|
+
function q({ description: a, errorMessage: l, warningMessage: s, count: i }) {
|
|
41
|
+
const d = y(), n = (i == null ? void 0 : i.max) != null ? i.max - i.n : void 0;
|
|
42
|
+
return /* @__PURE__ */ r(P, { children: [
|
|
43
|
+
(a || s) && /* @__PURE__ */ r(ne, { children: [
|
|
44
|
+
a,
|
|
45
|
+
s && /* @__PURE__ */ e("span", { className: "alea-field-warning", children: s })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ e(ce, { children: l }),
|
|
48
|
+
i && /* @__PURE__ */ r("span", { className: "alea-field-count", "data-over": n != null && n < 0 ? !0 : void 0, children: [
|
|
49
|
+
/* @__PURE__ */ e("span", { "aria-hidden": "true", children: i.max != null ? `${i.n} / ${i.max}` : i.n }),
|
|
50
|
+
/* @__PURE__ */ e("span", { className: "alea-visually-hidden", "aria-live": "polite", children: n != null && n <= 10 ? n < 0 ? d.overLimit(-n) : d.charactersLeft(n) : "" })
|
|
51
|
+
] })
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
function de({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, prefix: t, suffix: c, addonStart: m, addonEnd: p, isClearable: o, showCount: h, isLoading: f, className: b, value: w, defaultValue: z, onChange: N, ...F }) {
|
|
55
|
+
const E = y(), [T, D] = k(w, z ?? "", N), V = O(null);
|
|
56
|
+
return /* @__PURE__ */ r(G, { ...F, value: T, onChange: D, className: $("alea-field", b), ...A(n, v, x, i, f), children: [
|
|
57
|
+
/* @__PURE__ */ e(R, { label: a, showOptional: d, isRequired: F.isRequired }),
|
|
58
|
+
/* @__PURE__ */ r("div", { className: "alea-input-wrap", children: [
|
|
59
|
+
m && /* @__PURE__ */ e("span", { className: "alea-input-addon", "data-side": "start", children: m }),
|
|
60
|
+
t && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", children: t }),
|
|
61
|
+
/* @__PURE__ */ e(C, { ref: V, className: "alea-input", placeholder: u, "aria-busy": f || void 0 }),
|
|
62
|
+
f && /* @__PURE__ */ e(B, {}),
|
|
63
|
+
o && T && !F.isDisabled && !F.isReadOnly && /* @__PURE__ */ e(g, { className: "alea-input-clear alea-focus-ring", "aria-label": E.clear, onPress: () => {
|
|
64
|
+
var I;
|
|
65
|
+
D(""), (I = V.current) == null || I.focus();
|
|
66
|
+
}, children: /* @__PURE__ */ e(L, { size: 14 }) }),
|
|
67
|
+
c && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "end", children: c }),
|
|
68
|
+
p && /* @__PURE__ */ e("span", { className: "alea-input-addon", "data-side": "end", children: p })
|
|
69
|
+
] }),
|
|
70
|
+
/* @__PURE__ */ e(q, { description: l, errorMessage: s, warningMessage: i, count: h ? { n: T.length, max: F.maxLength } : void 0 })
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
function Fe({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, rows: t = 4, autoGrow: c, maxRows: m = 12, resize: p = "vertical", showCount: o, isLoading: h, className: f, value: b, defaultValue: w, onChange: z, ...N }) {
|
|
74
|
+
const [F, E] = k(b, w ?? "", z);
|
|
75
|
+
return /* @__PURE__ */ r(G, { ...N, value: F, onChange: E, className: $("alea-field", f), ...A(n, v, x, i, h), children: [
|
|
76
|
+
/* @__PURE__ */ e(R, { label: a, showOptional: d, isRequired: N.isRequired }),
|
|
77
|
+
/* @__PURE__ */ r("div", { className: "alea-input-wrap alea-textarea-wrap", children: [
|
|
78
|
+
/* @__PURE__ */ e(
|
|
79
|
+
Q,
|
|
80
|
+
{
|
|
81
|
+
className: "alea-input alea-textarea",
|
|
82
|
+
placeholder: u,
|
|
83
|
+
rows: t,
|
|
84
|
+
"aria-busy": h || void 0,
|
|
85
|
+
"data-autogrow": c || void 0,
|
|
86
|
+
style: { resize: c ? "none" : p, ...c ? { fieldSizing: "content", minBlockSize: `calc(${t} * 1.5em + var(--alea-space-6))`, maxBlockSize: `calc(${m} * 1.5em + var(--alea-space-6))` } : {} }
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
h && /* @__PURE__ */ e(B, {})
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ e(q, { description: l, errorMessage: s, warningMessage: i, count: o ? { n: F.length, max: N.maxLength } : void 0 })
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
function ge({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, isLoading: t, shortcut: c, className: m, onClear: p, ...o }) {
|
|
95
|
+
const h = y();
|
|
96
|
+
u ?? (u = h.search);
|
|
97
|
+
const f = O(""), [b, w] = j(null);
|
|
98
|
+
return /* @__PURE__ */ r(K, { ...o, onClear: () => {
|
|
99
|
+
f.current.trim() && w({ id: Date.now(), words: f.current.split(/(\s+)/) }), f.current = "", p == null || p();
|
|
100
|
+
}, className: $("alea-field alea-search-field", m), ...A(n, v, x, i, t), children: [
|
|
101
|
+
/* @__PURE__ */ e(R, { label: a, showOptional: d, isRequired: o.isRequired }),
|
|
102
|
+
/* @__PURE__ */ r("div", { className: "alea-input-wrap", children: [
|
|
103
|
+
/* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", "aria-hidden": t ? void 0 : !0, children: t ? /* @__PURE__ */ e(se, { size: "sm", "aria-label": h.searching }) : /* @__PURE__ */ e(le, { size: 16 }) }),
|
|
104
|
+
/* @__PURE__ */ e(C, { className: "alea-input", placeholder: u, "aria-busy": t || void 0, onInput: (z) => {
|
|
105
|
+
f.current = z.target.value;
|
|
106
|
+
} }),
|
|
107
|
+
b && /* @__PURE__ */ e("span", { className: "alea-input-ghost", "aria-hidden": "true", onAnimationEnd: (z) => {
|
|
108
|
+
var N;
|
|
109
|
+
((N = z.target.parentElement) == null ? void 0 : N.lastElementChild) === z.target && w(null);
|
|
110
|
+
}, children: b.words.map((z, N) => /* @__PURE__ */ e("span", { style: { "--alea-i": N }, children: z }, N)) }, b.id),
|
|
111
|
+
c && /* @__PURE__ */ e("kbd", { className: "alea-input-kbd", "aria-hidden": "true", children: c }),
|
|
112
|
+
/* @__PURE__ */ e(g, { className: "alea-input-clear alea-focus-ring", "aria-label": h.clearSearch, children: /* @__PURE__ */ e(L, { size: 14 }) })
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ e(q, { description: l, errorMessage: s, warningMessage: i })
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
function ue(a) {
|
|
118
|
+
let l = 0;
|
|
119
|
+
return a.length >= 8 && l++, a.length >= 12 && l++, /[a-z]/.test(a) && /[A-Z]/.test(a) && l++, /\d/.test(a) && l++, /[^A-Za-z0-9]/.test(a) && l++, l <= 1 ? 0 : l === 2 ? 1 : l === 3 ? 2 : 3;
|
|
120
|
+
}
|
|
121
|
+
function we({ label: a, showStrength: l, strength: s = ue, value: i, defaultValue: d, onChange: n, description: v, ...x }) {
|
|
122
|
+
const u = y();
|
|
123
|
+
a ?? (a = u.password);
|
|
124
|
+
const [t, c] = j(!1), [m, p] = k(i, d ?? "", n), o = m ? s(m) : -1;
|
|
125
|
+
return /* @__PURE__ */ e(
|
|
126
|
+
de,
|
|
127
|
+
{
|
|
128
|
+
...x,
|
|
129
|
+
label: a,
|
|
130
|
+
value: m,
|
|
131
|
+
onChange: p,
|
|
132
|
+
type: t ? "text" : "password",
|
|
133
|
+
autoComplete: x.autoComplete || "current-password",
|
|
134
|
+
description: l && o >= 0 ? /* @__PURE__ */ r(P, { children: [
|
|
135
|
+
v,
|
|
136
|
+
/* @__PURE__ */ r("span", { className: "alea-strength", "data-score": o, children: [
|
|
137
|
+
/* @__PURE__ */ r("span", { className: "alea-strength-bars", "aria-hidden": "true", children: [
|
|
138
|
+
/* @__PURE__ */ e("i", {}),
|
|
139
|
+
/* @__PURE__ */ e("i", {}),
|
|
140
|
+
/* @__PURE__ */ e("i", {}),
|
|
141
|
+
/* @__PURE__ */ e("i", {})
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ r("span", { "aria-live": "polite", children: [
|
|
144
|
+
u.passwordStrength,
|
|
145
|
+
": ",
|
|
146
|
+
u.strengthLevels[o]
|
|
147
|
+
] })
|
|
148
|
+
] })
|
|
149
|
+
] }) : v,
|
|
150
|
+
suffix: /* @__PURE__ */ e(g, { className: "alea-input-clear alea-focus-ring", "aria-label": t ? u.hidePassword : u.showPassword, "aria-pressed": t, onPress: () => c((h) => !h), children: t ? /* @__PURE__ */ e(ee, { size: 16 }) : /* @__PURE__ */ e(ae, { size: 16 }) })
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function ye({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, showStepper: t = !0, stepperPosition: c = "sides", prefix: m, suffix: p, isLoading: o, className: h, ...f }) {
|
|
155
|
+
const b = t && c === "sides";
|
|
156
|
+
return /* @__PURE__ */ r(J, { ...f, className: $("alea-field", h), ...A(n, v, x, i, o), children: [
|
|
157
|
+
/* @__PURE__ */ e(R, { label: a, showOptional: d, isRequired: f.isRequired }),
|
|
158
|
+
/* @__PURE__ */ r(Z, { className: "alea-input-wrap alea-number", "data-stepper": t ? c : void 0, children: [
|
|
159
|
+
b && /* @__PURE__ */ e(g, { slot: "decrement", className: "alea-stepper alea-focus-ring", children: /* @__PURE__ */ e(W, { size: 14 }) }),
|
|
160
|
+
m && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", children: m }),
|
|
161
|
+
/* @__PURE__ */ e(C, { className: "alea-input", placeholder: u, "aria-busy": o || void 0 }),
|
|
162
|
+
o && /* @__PURE__ */ e(B, {}),
|
|
163
|
+
p && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "end", children: p }),
|
|
164
|
+
b && /* @__PURE__ */ e(g, { slot: "increment", className: "alea-stepper alea-focus-ring", children: /* @__PURE__ */ e(Y, { size: 14 }) }),
|
|
165
|
+
t && c === "end" && /* @__PURE__ */ r("span", { className: "alea-stepper-col", children: [
|
|
166
|
+
/* @__PURE__ */ e(g, { slot: "increment", className: "alea-stepper-mini alea-focus-ring", children: /* @__PURE__ */ e(_, { size: 14 }) }),
|
|
167
|
+
/* @__PURE__ */ e(g, { slot: "decrement", className: "alea-stepper-mini alea-focus-ring", children: /* @__PURE__ */ e(M, { size: 14 }) })
|
|
168
|
+
] })
|
|
169
|
+
] }),
|
|
170
|
+
/* @__PURE__ */ e(q, { description: l, errorMessage: s, warningMessage: i })
|
|
171
|
+
] });
|
|
172
|
+
}
|
|
173
|
+
function Se({ children: a, className: l, ...s }) {
|
|
174
|
+
return /* @__PURE__ */ e(Z, { ...s, className: S("alea-input-group", l), children: a });
|
|
175
|
+
}
|
|
176
|
+
export {
|
|
177
|
+
ne as Description,
|
|
178
|
+
ce as FieldError,
|
|
179
|
+
Se as InputGroup,
|
|
180
|
+
re as Label,
|
|
181
|
+
ye as NumberField,
|
|
182
|
+
we as PasswordField,
|
|
183
|
+
ge as SearchField,
|
|
184
|
+
Fe as TextArea,
|
|
185
|
+
de as TextField,
|
|
186
|
+
ue as passwordScore
|
|
187
|
+
};
|
|
@@ -3,5 +3,5 @@ export declare function FieldSpinner(): import("react").JSX.Element;
|
|
|
3
3
|
export declare const loadingAttrs: (isLoading?: boolean) => {
|
|
4
4
|
'data-loading': true | undefined;
|
|
5
5
|
};
|
|
6
|
-
/** Marks the element busy for screen readers.
|
|
6
|
+
/** Marks the element busy for screen readers. Some components do not pass aria-busy through on some of its components (Select's button, Tree, Switch), so it is set on the element itself; `pick` finds the real control inside the element the ref points at. */
|
|
7
7
|
export declare function useBusy<T extends HTMLElement>(isBusy?: boolean, pick?: (root: T) => HTMLElement | null): (node: T | null) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { Spinner as t } from "../feedback/Spinner.js";
|
|
4
|
+
import { useStrings as o } from "../../i18n/strings.js";
|
|
5
|
+
import { useAttrRef as e } from "../../utils/attr.js";
|
|
6
|
+
function m() {
|
|
7
|
+
const i = o();
|
|
8
|
+
return /* @__PURE__ */ r("span", { className: "alea-input-loading", children: /* @__PURE__ */ r(t, { size: "sm", "aria-label": i.loading }) });
|
|
9
|
+
}
|
|
10
|
+
const d = (i) => ({ "data-loading": i || void 0 });
|
|
11
|
+
function p(i, n) {
|
|
12
|
+
return e("aria-busy", i ? "true" : void 0, n);
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
m as FieldSpinner,
|
|
16
|
+
d as loadingAttrs,
|
|
17
|
+
p as useBusy
|
|
18
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as s, jsx as i, Fragment as I } from "react/jsx-runtime";
|
|
3
|
+
import { useState as M } from "react";
|
|
4
|
+
import { DialogTrigger as K, Button as f } from "react-aria-components";
|
|
5
|
+
import { ChevronDown as L, X as O, Plus as k } from "lucide-react";
|
|
6
|
+
import { cx as E } from "../../utils/cx.js";
|
|
7
|
+
import { useControlled as H } from "../../utils/controlled.js";
|
|
8
|
+
import { Button as B } from "../button/Button.js";
|
|
9
|
+
import { SearchField as X, TextField as q } from "../field/Field.js";
|
|
10
|
+
import { Switch as G } from "../choice/Choice.js";
|
|
11
|
+
import { DropdownMenu as J, MenuItem as Q } from "../menu/Menu.js";
|
|
12
|
+
import { Popover as R, PopoverDialog as U } from "../overlay/Overlay.js";
|
|
13
|
+
import { ListBox as W, SelectItem as Y } from "../select/Select.js";
|
|
14
|
+
import { Tabs as Z, TabList as _, Tab as w } from "../tabs/Tabs.js";
|
|
15
|
+
import { useStrings as V } from "../../i18n/strings.js";
|
|
16
|
+
const u = (r) => Array.isArray(r) ? r.length > 0 : r !== void 0 && r !== "";
|
|
17
|
+
function P(r, o) {
|
|
18
|
+
if (r.type === "boolean") return o ? "✓" : "✕";
|
|
19
|
+
if (r.type === "text") return `“${o}”`;
|
|
20
|
+
const d = (Array.isArray(o) ? o : [o]).map((b) => {
|
|
21
|
+
var c, m;
|
|
22
|
+
return ((m = (c = r.options) == null ? void 0 : c.find((p) => p.id === b)) == null ? void 0 : m.label) ?? b;
|
|
23
|
+
});
|
|
24
|
+
return d.length > 2 ? `${d.slice(0, 2).join(", ")} +${d.length - 2}` : d.join(", ");
|
|
25
|
+
}
|
|
26
|
+
function ue({ filters: r, value: o, defaultValue: x = {}, onChange: d, search: b, onSearchChange: c, searchPlaceholder: m, views: p, view: T, onViewChange: y, end: S, className: j, "aria-label": C }) {
|
|
27
|
+
const a = V(), [n, A] = H(o, x, d), [v, h] = M(null), N = r.filter((e) => u(n[e.id]) || v === e.id), F = r.filter((e) => !N.includes(e)), g = (e, t) => {
|
|
28
|
+
const l = { ...n, [e]: t };
|
|
29
|
+
u(t) || delete l[e], A(l);
|
|
30
|
+
}, D = (e) => {
|
|
31
|
+
const t = n[e.id];
|
|
32
|
+
return e.type === "boolean" ? /* @__PURE__ */ i(G, { isSelected: !!t, onChange: (l) => g(e.id, l), children: e.label }) : e.type === "text" ? /* @__PURE__ */ i(q, { "aria-label": e.label, autoFocus: !0, defaultValue: t ?? "", onChange: (l) => g(e.id, l), isClearable: !0, size: "sm" }) : /* @__PURE__ */ i(
|
|
33
|
+
W,
|
|
34
|
+
{
|
|
35
|
+
"aria-label": e.label,
|
|
36
|
+
variant: "plain",
|
|
37
|
+
maxHeight: 260,
|
|
38
|
+
selectionMode: e.type === "multi" ? "multiple" : "single",
|
|
39
|
+
autoFocus: !0,
|
|
40
|
+
selectedKeys: Array.isArray(t) ? t : t ? [t] : [],
|
|
41
|
+
onSelectionChange: (l) => {
|
|
42
|
+
const z = l === "all" ? (e.options || []).map(($) => $.id) : [...l].map(String);
|
|
43
|
+
g(e.id, e.type === "multi" ? z : z[0]), e.type === "select" && h(null);
|
|
44
|
+
},
|
|
45
|
+
items: e.options,
|
|
46
|
+
children: (l) => /* @__PURE__ */ i(Y, { id: l.id, children: l.label })
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ s("div", { className: E("alea-filterbar", j), role: "group", "aria-label": C ?? a.filters, children: [
|
|
51
|
+
p && p.length > 0 && /* @__PURE__ */ i(Z, { size: "sm", selectedKey: T, onSelectionChange: (e) => y == null ? void 0 : y(String(e)), children: /* @__PURE__ */ i(_, { "aria-label": a.views, children: p.map((e) => /* @__PURE__ */ i(w, { id: e.id, badge: e.count, children: e.label }, e.id)) }) }),
|
|
52
|
+
/* @__PURE__ */ s("div", { className: "alea-filterbar-row", children: [
|
|
53
|
+
c && /* @__PURE__ */ i(X, { "aria-label": m ?? a.search, placeholder: m, size: "sm", value: b, onChange: c, className: "alea-filterbar-search" }),
|
|
54
|
+
/* @__PURE__ */ i("ul", { className: "alea-filterbar-chips", "aria-label": a.activeFilters, children: N.map((e) => /* @__PURE__ */ s("li", { className: "alea-filter-chip", "data-empty": !u(n[e.id]) || void 0, children: [
|
|
55
|
+
/* @__PURE__ */ s(K, { isOpen: v === e.id, onOpenChange: (t) => h(t ? e.id : null), children: [
|
|
56
|
+
/* @__PURE__ */ s(f, { className: "alea-filter-chip-main alea-focus-ring", children: [
|
|
57
|
+
e.icon && /* @__PURE__ */ i("span", { className: "alea-filter-chip-icon", "aria-hidden": "true", children: e.icon }),
|
|
58
|
+
/* @__PURE__ */ s("span", { className: "alea-filter-chip-label", children: [
|
|
59
|
+
e.label,
|
|
60
|
+
/* @__PURE__ */ i("span", { className: "alea-visually-hidden", children: ": " })
|
|
61
|
+
] }),
|
|
62
|
+
u(n[e.id]) ? /* @__PURE__ */ i("span", { className: "alea-filter-chip-value", children: e.type === "boolean" ? /* @__PURE__ */ s(I, { children: [
|
|
63
|
+
/* @__PURE__ */ i("span", { "aria-hidden": "true", children: P(e, n[e.id]) }),
|
|
64
|
+
/* @__PURE__ */ i("span", { className: "alea-visually-hidden", children: n[e.id] ? a.on : a.off })
|
|
65
|
+
] }) : P(e, n[e.id]) }) : /* @__PURE__ */ i("span", { className: "alea-visually-hidden", children: a.noValue }),
|
|
66
|
+
/* @__PURE__ */ s("span", { className: "alea-visually-hidden", children: [
|
|
67
|
+
". ",
|
|
68
|
+
a.edit
|
|
69
|
+
] }),
|
|
70
|
+
/* @__PURE__ */ i(L, { size: 14, "aria-hidden": "true" })
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ i(R, { placement: "bottom start", className: "alea-popover alea-filter-popover", children: /* @__PURE__ */ i(U, { title: e.label, children: D(e) }) })
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ i(f, { className: "alea-filter-chip-remove alea-focus-ring", "aria-label": a.removeItem(e.label), onPress: () => {
|
|
75
|
+
g(e.id, void 0), v === e.id && h(null);
|
|
76
|
+
}, children: /* @__PURE__ */ i(O, { size: 12, "aria-hidden": "true" }) })
|
|
77
|
+
] }, e.id)) }),
|
|
78
|
+
F.length > 0 && /* @__PURE__ */ i(
|
|
79
|
+
J,
|
|
80
|
+
{
|
|
81
|
+
"aria-label": a.addFilter,
|
|
82
|
+
trigger: /* @__PURE__ */ i(B, { size: "sm", variant: "dashed", iconStart: /* @__PURE__ */ i(k, {}), children: a.addFilter }),
|
|
83
|
+
menuProps: { onAction: (e) => h(String(e)) },
|
|
84
|
+
children: F.map((e) => /* @__PURE__ */ i(Q, { id: e.id, icon: e.icon, children: e.label }, e.id))
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
N.some((e) => u(n[e.id])) && /* @__PURE__ */ i(B, { size: "sm", variant: "text", onPress: () => {
|
|
88
|
+
A({}), h(null);
|
|
89
|
+
}, children: a.clearAll }),
|
|
90
|
+
S && /* @__PURE__ */ i("div", { className: "alea-filterbar-end", children: S })
|
|
91
|
+
] })
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
ue as FilterBar
|
|
96
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FormEvent, type ReactNode } from 'react';
|
|
1
|
+
import { type FormEvent, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
import { type FormProps as RACFormProps } from 'react-aria-components';
|
|
3
3
|
export interface FormProps extends Omit<RACFormProps, 'onSubmit'> {
|
|
4
4
|
/** Called with the form values when every field is valid. Return server errors by field name to show them on the fields; a promise shows the loading state. */
|
|
@@ -9,7 +9,7 @@ export interface FormProps extends Omit<RACFormProps, 'onSubmit'> {
|
|
|
9
9
|
}
|
|
10
10
|
/** A form that validates on submit, moves focus to the first problem, and shows server errors on their fields. */
|
|
11
11
|
export declare function Form({ onSubmit, gap, children, className, validationBehavior, style, ...props }: FormProps): import("react").JSX.Element;
|
|
12
|
-
export interface FormActionsProps {
|
|
12
|
+
export interface FormActionsProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
13
|
/** The submit button text. Default "Save". */
|
|
14
14
|
submitLabel?: ReactNode;
|
|
15
15
|
/** A cancel or secondary button. */
|
|
@@ -20,13 +20,13 @@ export interface FormActionsProps {
|
|
|
20
20
|
align?: 'start' | 'end' | 'stretch';
|
|
21
21
|
}
|
|
22
22
|
/** The buttons at the end of a form. */
|
|
23
|
-
export declare
|
|
23
|
+
export declare const FormActions: import("react").ForwardRefExoticComponent<FormActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
24
|
/** A summary of what to fix, at the top of a long form, with links to the fields. */
|
|
25
|
-
export interface ErrorSummaryProps {
|
|
25
|
+
export interface ErrorSummaryProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
26
26
|
/** The errors by field id: { email: 'Use a valid email.' }. Each links to its field. */
|
|
27
27
|
errors: Record<string, string>;
|
|
28
28
|
/** The heading. Default "Fix these to continue". */
|
|
29
29
|
title?: ReactNode;
|
|
30
30
|
}
|
|
31
31
|
/** A list of the errors in a form, each a link that moves focus to its field. */
|
|
32
|
-
export declare
|
|
32
|
+
export declare const ErrorSummary: import("react").ForwardRefExoticComponent<ErrorSummaryProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n, jsxs as F } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as p, useState as d } from "react";
|
|
4
|
+
import { Form as x } from "react-aria-components";
|
|
5
|
+
import { cx as v } from "../../utils/cx.js";
|
|
6
|
+
import { spaceFromPx as g } from "../../utils/space.js";
|
|
7
|
+
import { Alert as S } from "../feedback/Feedback.js";
|
|
8
|
+
import { Button as b } from "../button/Button.js";
|
|
9
|
+
import { useStrings as y } from "../../i18n/strings.js";
|
|
10
|
+
function $({ onSubmit: c, gap: t = 20, children: e, className: a, validationBehavior: o = "native", style: i, ...r }) {
|
|
11
|
+
const [s, m] = d({}), [u, f] = d(!1);
|
|
12
|
+
return /* @__PURE__ */ n(
|
|
13
|
+
x,
|
|
14
|
+
{
|
|
15
|
+
...r,
|
|
16
|
+
validationBehavior: o,
|
|
17
|
+
validationErrors: { ...s, ...r.validationErrors || {} },
|
|
18
|
+
className: v("alea-form", a),
|
|
19
|
+
style: { gap: g(t), ...i },
|
|
20
|
+
"data-busy": u || void 0,
|
|
21
|
+
"aria-busy": u || void 0,
|
|
22
|
+
onSubmit: async (l) => {
|
|
23
|
+
if (l.preventDefault(), !c) return;
|
|
24
|
+
const h = Object.fromEntries(new FormData(l.currentTarget));
|
|
25
|
+
f(!0);
|
|
26
|
+
try {
|
|
27
|
+
const E = await c(h, l);
|
|
28
|
+
m(E || {});
|
|
29
|
+
} finally {
|
|
30
|
+
f(!1);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
children: e
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
const C = p(function({ submitLabel: t, secondary: e, isLoading: a, align: o = "start", className: i, ...r }, s) {
|
|
38
|
+
const m = y();
|
|
39
|
+
return t ?? (t = m.save), /* @__PURE__ */ F("div", { ref: s, ...r, className: v("alea-form-actions", i), "data-align": o, children: [
|
|
40
|
+
e,
|
|
41
|
+
/* @__PURE__ */ n(b, { type: "submit", isLoading: a, fullWidth: o === "stretch", children: t })
|
|
42
|
+
] });
|
|
43
|
+
}), P = p(function({ errors: t, title: e, ...a }, o) {
|
|
44
|
+
const i = y();
|
|
45
|
+
e ?? (e = i.fixToContinue);
|
|
46
|
+
const r = Object.entries(t);
|
|
47
|
+
return r.length ? /* @__PURE__ */ n(S, { ref: o, ...a, tone: "danger", title: e, live: !0, children: /* @__PURE__ */ n("ul", { className: "alea-error-summary", children: r.map(([s, m]) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n("a", { href: `#${s}`, children: m }) }, s)) }) }) : null;
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
P as ErrorSummary,
|
|
51
|
+
$ as Form,
|
|
52
|
+
C as FormActions
|
|
53
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentType, type ReactElement, type SVGProps } from 'react';
|
|
2
|
-
import { type IconName } from './icon-names';
|
|
3
|
-
import { type IconSurface, type IconTone } from './icon-cells';
|
|
2
|
+
import { type IconName } from './icon-names.js';
|
|
3
|
+
import { type IconSurface, type IconTone } from './icon-cells.js';
|
|
4
4
|
export type IconSize = 'sm' | 'md' | 'lg' | number;
|
|
5
5
|
export declare const ICON_SIZE_PX: {
|
|
6
6
|
readonly sm: 16;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as N } from "react/jsx-runtime";
|
|
3
|
+
import { isValidElement as O, cloneElement as _, useState as P, useEffect as S } from "react";
|
|
4
|
+
import { cx as m } from "../../utils/cx.js";
|
|
5
|
+
import { ICON_LOADERS as v } from "./icon-names.js";
|
|
6
|
+
import { ICON_TONE_ALIASES as b } from "./icon-cells.js";
|
|
7
|
+
const x = { sm: 16, md: 20, lg: 24 }, c = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), p = (t) => Object.prototype.hasOwnProperty.call(v, t);
|
|
8
|
+
function y(t) {
|
|
9
|
+
if (!p(t)) return Promise.resolve(null);
|
|
10
|
+
const o = c.get(t);
|
|
11
|
+
if (o) return Promise.resolve(o);
|
|
12
|
+
let e = d.get(t);
|
|
13
|
+
return e || (e = v[t]().then((n) => (c.set(t, n.default), n.default), () => (d.delete(t), null)), d.set(t, e)), e;
|
|
14
|
+
}
|
|
15
|
+
async function T(t) {
|
|
16
|
+
await Promise.all(t.map(y));
|
|
17
|
+
}
|
|
18
|
+
const g = /* @__PURE__ */ new Set();
|
|
19
|
+
function C(t) {
|
|
20
|
+
const [o, e] = P(() => t && p(t) ? c.get(t) ?? null : null);
|
|
21
|
+
return S(() => {
|
|
22
|
+
var l, s;
|
|
23
|
+
if (!t) return;
|
|
24
|
+
let n = !0;
|
|
25
|
+
if (!p(t)) {
|
|
26
|
+
((s = (l = globalThis.process) == null ? void 0 : l.env) == null ? void 0 : s.NODE_ENV) !== "production" && (g.has(t) || (g.add(t), console.warn(`Icon: there is no glyph named "${t}" in the kit.`))), e(null);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const r = c.get(t);
|
|
30
|
+
if (r) {
|
|
31
|
+
e(r);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
return e(null), y(t).then((u) => {
|
|
35
|
+
n && e(u);
|
|
36
|
+
}), () => {
|
|
37
|
+
n = !1;
|
|
38
|
+
};
|
|
39
|
+
}, [t]), o;
|
|
40
|
+
}
|
|
41
|
+
function k(t) {
|
|
42
|
+
const { size: o = 24, strokeWidth: e, ...n } = t;
|
|
43
|
+
return /* @__PURE__ */ N("svg", { ...n, width: o, height: o, viewBox: "0 0 24 24", fill: "none" });
|
|
44
|
+
}
|
|
45
|
+
function V({ icon: t, name: o, size: e, strokeWidth: n = 2, label: r, tone: l, surface: s, className: u, ...w }) {
|
|
46
|
+
const E = C(o), i = o ? E ?? k : t, I = typeof e == "number" ? e : x[e ?? "md"], a = l === void 0 && s ? "default" : l, h = a && a in b ? void 0 : a, f = {
|
|
47
|
+
...w,
|
|
48
|
+
size: I,
|
|
49
|
+
strokeWidth: n,
|
|
50
|
+
className: m("alea-icon", u),
|
|
51
|
+
"data-size": typeof e == "number" ? "custom" : e,
|
|
52
|
+
"data-tone": h,
|
|
53
|
+
"data-surface": h ? s ?? "normal" : void 0,
|
|
54
|
+
role: r ? "img" : void 0,
|
|
55
|
+
"aria-label": r,
|
|
56
|
+
"aria-hidden": r ? void 0 : !0,
|
|
57
|
+
focusable: "false"
|
|
58
|
+
};
|
|
59
|
+
return O(i) ? _(i, { ...f, className: m(i.props.className, f.className) }) : /* @__PURE__ */ N(i, { ...f });
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
x as ICON_SIZE_PX,
|
|
63
|
+
V as Icon,
|
|
64
|
+
y as loadIcon,
|
|
65
|
+
T as preloadIcons
|
|
66
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const c = ["default", "muted", "soft", "faint", "accent", "danger", "success", "warning", "info", "status"], s = ["normal", "solid", "button"], t = ["brand", "rating", "control", "like"], r = { current: void 0 }, a = {
|
|
3
|
+
"default/normal": "default",
|
|
4
|
+
"muted/normal": "muted",
|
|
5
|
+
"soft/normal": "soft",
|
|
6
|
+
"faint/normal": "faint",
|
|
7
|
+
"accent/normal": "accent",
|
|
8
|
+
"danger/normal": "danger",
|
|
9
|
+
"success/normal": "success",
|
|
10
|
+
"warning/normal": "warning",
|
|
11
|
+
"info/normal": "info",
|
|
12
|
+
"accent/solid": "on-accent",
|
|
13
|
+
"danger/solid": "on-danger",
|
|
14
|
+
"success/solid": "on-success",
|
|
15
|
+
"warning/solid": "on-warning",
|
|
16
|
+
"info/solid": "on-info",
|
|
17
|
+
"status/solid": "on-status",
|
|
18
|
+
"default/solid": "chip",
|
|
19
|
+
"default/button": "button"
|
|
20
|
+
};
|
|
21
|
+
function i(n, o = "normal") {
|
|
22
|
+
return t.includes(n) ? n : a[n + "/" + o] ?? a[n + "/normal"] ?? "default";
|
|
23
|
+
}
|
|
24
|
+
function e(n) {
|
|
25
|
+
return n === "default" ? "--alea-icon" : "--alea-icon-" + n;
|
|
26
|
+
}
|
|
27
|
+
function l(n, o = "normal") {
|
|
28
|
+
return { "data-icon-tone": n, "data-icon-surface": o };
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
a as ICON_CELLS,
|
|
32
|
+
t as ICON_OVERRIDES,
|
|
33
|
+
s as ICON_SURFACES,
|
|
34
|
+
c as ICON_TONES,
|
|
35
|
+
r as ICON_TONE_ALIASES,
|
|
36
|
+
i as iconContext,
|
|
37
|
+
l as iconCtx,
|
|
38
|
+
e as iconVar
|
|
39
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { iconCtx } from './icon-cells';
|
|
1
|
+
import { iconCtx } from './icon-cells.js';
|
|
2
2
|
type Ctx = ReturnType<typeof iconCtx>;
|
|
3
3
|
/** Button and IconButton. A solid look (primary, danger, a toned primary) sits on its tone, the secondary on the chip, the others on the page in their tone. */
|
|
4
4
|
export declare function buttonIcon(variant?: string, tone?: string): Ctx;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { iconCtx as r } from "./icon-cells.js";
|
|
3
|
+
const i = ["success", "warning", "danger", "info"];
|
|
4
|
+
function a(n = "primary", t) {
|
|
5
|
+
const u = !t || t === "neutral" ? void 0 : t;
|
|
6
|
+
return n === "danger" ? r("danger", "solid") : n === "primary" ? u ? u === "accent" || u === "danger" ? r(u, "solid") : r("status", "solid") : r("default", "button") : n === "secondary" ? r("default", "solid") : r(u ?? (n === "link" ? "accent" : "default"));
|
|
7
|
+
}
|
|
8
|
+
function c(n, t, u = "neutral", e) {
|
|
9
|
+
return e ? r("default", "solid") : t === "solid" ? u === "neutral" ? r("default", "solid") : r(u, "solid") : u === "neutral" ? r(n === "badge" ? "muted" : "default") : r(u);
|
|
10
|
+
}
|
|
11
|
+
function f(n, t) {
|
|
12
|
+
return n ? t === "pills" ? r("default", "solid") : r("default") : r("muted");
|
|
13
|
+
}
|
|
14
|
+
function l(n, t) {
|
|
15
|
+
return n === "danger" ? r("danger") : t === "muted" || n === "neutral" ? r("default") : r("accent");
|
|
16
|
+
}
|
|
17
|
+
function o(n = "info", t) {
|
|
18
|
+
return t ? n === "danger" || n === "accent" ? r(n, "solid") : r("status", "solid") : r(n === "neutral" ? "muted" : i.includes(n) || n === "accent" ? n : "info");
|
|
19
|
+
}
|
|
20
|
+
function s(n) {
|
|
21
|
+
return r(n === "danger" ? "danger" : "muted");
|
|
22
|
+
}
|
|
23
|
+
function g(n) {
|
|
24
|
+
return r(n ? "brand" : "muted");
|
|
25
|
+
}
|
|
26
|
+
function m(n, t) {
|
|
27
|
+
return n === "empty" ? r("control") : !t || t === "warning" ? r("rating") : r(t === "accent" ? "brand" : t === "neutral" ? "muted" : t);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
o as alertIcon,
|
|
31
|
+
a as buttonIcon,
|
|
32
|
+
c as chipIcon,
|
|
33
|
+
l as linkIcon,
|
|
34
|
+
s as menuIcon,
|
|
35
|
+
g as navIcon,
|
|
36
|
+
m as ratingIcon,
|
|
37
|
+
f as tabIcon
|
|
38
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IconComponent } from './Icon';
|
|
1
|
+
import type { IconComponent } from './Icon.js';
|
|
2
2
|
/** The 184 glyphs of the kit, by the kebab-case name of Icon/<name> in Figma (lucide's own name). */
|
|
3
3
|
export declare const ICON_NAMES: readonly ["search", "x", "check", "chevron-down", "chevron-up", "chevron-left", "chevron-right", "chevrons-left", "chevrons-right", "arrow-left", "arrow-right", "arrow-up", "arrow-down", "arrow-up-right", "plus", "minus", "ellipsis", "ellipsis-vertical", "menu", "grip-vertical", "more-horizontal", "house", "settings", "user", "users", "bell", "mail", "message-square", "calendar", "clock", "star", "heart", "bookmark", "share-2", "link-2", "external-link", "eye", "eye-off", "lock", "lock-open", "key", "shield", "shield-check", "log-in", "log-out", "info", "circle-alert", "circle-check", "circle-x", "triangle-alert", "circle-help", "ban", "trash-2", "pencil", "copy", "clipboard", "download", "upload", "file", "file-text", "folder", "image", "paperclip", "save", "printer", "filter", "sliders-horizontal", "list", "list-ordered", "layout-grid", "table-2", "columns-3", "kanban", "sun", "moon", "monitor", "smartphone", "tablet", "laptop", "bold", "italic", "underline", "strikethrough", "code", "heading-2", "quote", "align-left", "align-center", "align-right", "link", "play", "pause", "skip-forward", "volume-2", "mic", "camera", "video", "refresh-cw", "rotate-ccw", "loader-circle", "zoom-in", "zoom-out", "maximize-2", "minimize-2", "move", "map-pin", "globe", "compass", "navigation", "shopping-cart", "shopping-bag", "credit-card", "wallet", "tag", "gift", "package", "truck", "chart-line", "chart-bar", "chart-pie", "trending-up", "trending-down", "activity", "gauge", "palette", "paintbrush", "type", "contrast", "swatch-book", "pipette", "layers", "component", "frame", "figma", "github", "sparkles", "zap", "rocket", "flag", "award", "trophy", "target", "lightbulb", "thumbs-up", "thumbs-down", "smile", "frown", "inbox", "send", "archive", "reply", "circle", "square", "triangle", "hexagon", "dot", "cloud", "wifi", "battery", "cpu", "database", "server", "hard-drive", "terminal", "book-open", "graduation-cap", "briefcase", "building-2", "phone", "qr-code", "scan-line", "toggle-left", "toggle-right", "ruler", "snowflake", "arrow-down-left", "store", "cloud-upload", "handshake", "layout-list", "leaf", "life-buoy", "newspaper", "piggy-bank"];
|
|
4
4
|
export type IconName = typeof ICON_NAMES[number];
|