@a4ui/core 0.9.0 → 0.10.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 +4 -2
- package/dist/Checkbox-DQcDOBLd.js +168 -0
- package/dist/charts/BarChart.d.ts +24 -0
- package/dist/charts/DonutChart.d.ts +34 -0
- package/dist/charts/Sparkline.d.ts +24 -0
- package/dist/charts/index.d.ts +3 -0
- package/dist/charts.js +194 -0
- package/dist/cn-B6yFEsav.js +8 -0
- package/dist/commerce.js +12 -11
- package/dist/elements.css +37 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2380 -2099
- package/dist/ui/FileUpload.d.ts +54 -0
- package/dist/ui/MultiSelect.d.ts +35 -0
- package/package.json +6 -1
- package/dist/Checkbox-CC3EGilW.js +0 -173
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ mode switch — a theme recolors underneath either mode.
|
|
|
111
111
|
|
|
112
112
|
## Components
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
90+ components across eight categories (this is a sample — see the
|
|
115
115
|
**[docs site](https://a4uikit.github.io/a4ui/)** or `src/index.ts` for the
|
|
116
116
|
full list):
|
|
117
117
|
|
|
@@ -124,12 +124,14 @@ full list):
|
|
|
124
124
|
| Feedback | `Alert`, `Toast`, `Progress`, `Skeleton`, `Empty`, `Result`, `NotificationCenter` |
|
|
125
125
|
| Layout | `AppShell`, `SpaceBackground`, `ThemedScenery`, `Card`, `Splitter`, `Affix`, `NavGroup` |
|
|
126
126
|
| Commerce | `ProductCard`, `ProductGrid`, `PriceTag`, `QuantityStepper`, `CartLine`, `CartSummary`, `FilterGroup` |
|
|
127
|
+
| Charts | `Sparkline`, `BarChart`, `DonutChart` (native SVG, theme-tinted) |
|
|
127
128
|
|
|
128
129
|
Domain-specific sets ship as **subpath entries** so the base package stays lean —
|
|
129
|
-
e.g. commerce components import from
|
|
130
|
+
e.g. commerce and chart components import from their own paths:
|
|
130
131
|
|
|
131
132
|
```tsx
|
|
132
133
|
import { ProductCard, CartSummary } from '@a4ui/core/commerce'
|
|
134
|
+
import { DonutChart, Sparkline } from '@a4ui/core/charts'
|
|
133
135
|
```
|
|
134
136
|
|
|
135
137
|
## Why A4ui
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { spread as g, mergeProps as m, insert as i, template as d, createComponent as v, effect as h, setAttribute as x, className as y, delegateEvents as E } from "solid-js/web";
|
|
2
|
+
import { splitProps as f, createSignal as S, Show as L, For as p } from "solid-js";
|
|
3
|
+
import { c } from "./cn-B6yFEsav.js";
|
|
4
|
+
import { Star as C } from "lucide-solid";
|
|
5
|
+
var B = /* @__PURE__ */ d("<span>");
|
|
6
|
+
const R = {
|
|
7
|
+
neutral: "bg-muted text-muted-foreground ring-border",
|
|
8
|
+
success: "bg-emerald-500/15 text-emerald-600 ring-emerald-500/30",
|
|
9
|
+
warning: "bg-amber-500/15 text-amber-600 ring-amber-500/30",
|
|
10
|
+
danger: "bg-rose-500/15 text-rose-600 ring-rose-500/30",
|
|
11
|
+
info: "bg-sky-500/15 text-sky-600 ring-sky-500/30"
|
|
12
|
+
}, T = "badge inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-semibold ring-1 ring-inset whitespace-nowrap";
|
|
13
|
+
function q(r) {
|
|
14
|
+
const [e, n] = f(r, ["tone", "class", "children"]);
|
|
15
|
+
return (() => {
|
|
16
|
+
var t = B();
|
|
17
|
+
return g(t, m({
|
|
18
|
+
get class() {
|
|
19
|
+
return c(T, R[e.tone ?? "neutral"], e.class);
|
|
20
|
+
}
|
|
21
|
+
}, n), !1, !0), i(t, () => e.children), t;
|
|
22
|
+
})();
|
|
23
|
+
}
|
|
24
|
+
var D = /* @__PURE__ */ d("<button>");
|
|
25
|
+
const N = {
|
|
26
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
27
|
+
secondary: "bg-muted text-foreground hover:bg-muted/70",
|
|
28
|
+
outline: "border border-border bg-transparent text-foreground hover:bg-muted",
|
|
29
|
+
ghost: "bg-transparent text-foreground hover:bg-muted"
|
|
30
|
+
}, G = "inline-flex items-center justify-center rounded-md px-3 py-2 text-sm font-medium transition-[color,background-color,transform] duration-150 active:scale-[0.97] focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none disabled:opacity-50";
|
|
31
|
+
function z(r) {
|
|
32
|
+
const [e, n] = f(r, ["variant", "class", "type", "children"]);
|
|
33
|
+
return (() => {
|
|
34
|
+
var t = D();
|
|
35
|
+
return g(t, m({
|
|
36
|
+
get type() {
|
|
37
|
+
return e.type ?? "button";
|
|
38
|
+
},
|
|
39
|
+
get class() {
|
|
40
|
+
return c(G, N[e.variant ?? "primary"], e.class);
|
|
41
|
+
}
|
|
42
|
+
}, n), !1, !0), i(t, () => e.children), t;
|
|
43
|
+
})();
|
|
44
|
+
}
|
|
45
|
+
var $ = /* @__PURE__ */ d("<div>"), H = /* @__PURE__ */ d("<h2>");
|
|
46
|
+
function J(r) {
|
|
47
|
+
const [e, n] = f(r, ["class", "children", "glass", "glow"]), t = () => (e.glow ?? e.glass) === !0;
|
|
48
|
+
return (() => {
|
|
49
|
+
var u = $();
|
|
50
|
+
return g(u, m({
|
|
51
|
+
get class() {
|
|
52
|
+
return c(e.glass ? "card rounded-xl text-card-foreground" : "rounded-xl border border-border bg-card text-card-foreground shadow-sm", t() && "glow-edge", e.class);
|
|
53
|
+
}
|
|
54
|
+
}, n), !1, !0), i(u, () => e.children), u;
|
|
55
|
+
})();
|
|
56
|
+
}
|
|
57
|
+
function K(r) {
|
|
58
|
+
const [e, n] = f(r, ["class", "children"]);
|
|
59
|
+
return (() => {
|
|
60
|
+
var t = $();
|
|
61
|
+
return g(t, m({
|
|
62
|
+
get class() {
|
|
63
|
+
return c("flex flex-col space-y-1.5 p-6", e.class);
|
|
64
|
+
}
|
|
65
|
+
}, n), !1, !0), i(t, () => e.children), t;
|
|
66
|
+
})();
|
|
67
|
+
}
|
|
68
|
+
function Q(r) {
|
|
69
|
+
const [e, n] = f(r, ["class", "children"]);
|
|
70
|
+
return (() => {
|
|
71
|
+
var t = H();
|
|
72
|
+
return g(t, m({
|
|
73
|
+
get class() {
|
|
74
|
+
return c("text-lg font-semibold leading-none tracking-tight", e.class);
|
|
75
|
+
}
|
|
76
|
+
}, n), !1, !0), i(t, () => e.children), t;
|
|
77
|
+
})();
|
|
78
|
+
}
|
|
79
|
+
function W(r) {
|
|
80
|
+
const [e, n] = f(r, ["class", "children"]);
|
|
81
|
+
return (() => {
|
|
82
|
+
var t = $();
|
|
83
|
+
return g(t, m({
|
|
84
|
+
get class() {
|
|
85
|
+
return c("p-6 pt-0", e.class);
|
|
86
|
+
}
|
|
87
|
+
}, n), !1, !0), i(t, () => e.children), t;
|
|
88
|
+
})();
|
|
89
|
+
}
|
|
90
|
+
var M = /* @__PURE__ */ d("<div role=radiogroup>"), O = /* @__PURE__ */ d("<div role=img>"), P = /* @__PURE__ */ d('<button type=button role=radio class="rounded outline-none focus-visible:ring-2 focus-visible:ring-ring/40">');
|
|
91
|
+
function X(r) {
|
|
92
|
+
const [e, n] = S(0), t = () => r.max ?? 5, u = () => Array.from({
|
|
93
|
+
length: t()
|
|
94
|
+
}, (s, a) => a + 1), A = () => e() > 0 ? e() : r.value, b = (s) => {
|
|
95
|
+
var a;
|
|
96
|
+
r.readonly || (a = r.onChange) == null || a.call(r, s);
|
|
97
|
+
}, k = (s) => c("h-5 w-5 transition-colors", s <= A() ? "fill-primary text-primary" : "fill-transparent text-muted-foreground");
|
|
98
|
+
return v(L, {
|
|
99
|
+
get when() {
|
|
100
|
+
return !r.readonly;
|
|
101
|
+
},
|
|
102
|
+
get fallback() {
|
|
103
|
+
return (() => {
|
|
104
|
+
var s = O();
|
|
105
|
+
return i(s, v(p, {
|
|
106
|
+
get each() {
|
|
107
|
+
return u();
|
|
108
|
+
},
|
|
109
|
+
children: (a) => v(C, {
|
|
110
|
+
get class() {
|
|
111
|
+
return k(a);
|
|
112
|
+
},
|
|
113
|
+
"aria-hidden": "true"
|
|
114
|
+
})
|
|
115
|
+
})), h((a) => {
|
|
116
|
+
var o = c("inline-flex items-center gap-1", r.class), l = `Rating ${r.value} of ${t()}`;
|
|
117
|
+
return o !== a.e && y(s, a.e = o), l !== a.t && x(s, "aria-label", a.t = l), a;
|
|
118
|
+
}, {
|
|
119
|
+
e: void 0,
|
|
120
|
+
t: void 0
|
|
121
|
+
}), s;
|
|
122
|
+
})();
|
|
123
|
+
},
|
|
124
|
+
get children() {
|
|
125
|
+
var s = M();
|
|
126
|
+
return s.addEventListener("mouseleave", () => n(0)), i(s, v(p, {
|
|
127
|
+
get each() {
|
|
128
|
+
return u();
|
|
129
|
+
},
|
|
130
|
+
children: (a) => (() => {
|
|
131
|
+
var o = P();
|
|
132
|
+
return o.$$keydown = (l) => {
|
|
133
|
+
l.key === "ArrowRight" || l.key === "ArrowUp" ? (l.preventDefault(), b(Math.min(r.value + 1, t()))) : (l.key === "ArrowLeft" || l.key === "ArrowDown") && (l.preventDefault(), b(Math.max(r.value - 1, 0)));
|
|
134
|
+
}, o.$$click = () => b(a), o.addEventListener("blur", () => n(0)), o.addEventListener("focus", () => n(a)), o.addEventListener("mouseenter", () => n(a)), i(o, v(C, {
|
|
135
|
+
get class() {
|
|
136
|
+
return k(a);
|
|
137
|
+
},
|
|
138
|
+
"aria-hidden": "true"
|
|
139
|
+
})), h((l) => {
|
|
140
|
+
var w = r.value === a, _ = `Rate ${a} of ${t()}`;
|
|
141
|
+
return w !== l.e && x(o, "aria-checked", l.e = w), _ !== l.t && x(o, "aria-label", l.t = _), l;
|
|
142
|
+
}, {
|
|
143
|
+
e: void 0,
|
|
144
|
+
t: void 0
|
|
145
|
+
}), o;
|
|
146
|
+
})()
|
|
147
|
+
})), h(() => y(s, c("inline-flex items-center gap-1", r.class))), s;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
E(["click", "keydown"]);
|
|
152
|
+
var U = /* @__PURE__ */ d('<label><input type=checkbox class="h-4 w-4 rounded border-input accent-primary">');
|
|
153
|
+
function Y(r) {
|
|
154
|
+
return (() => {
|
|
155
|
+
var e = U(), n = e.firstChild;
|
|
156
|
+
return n.addEventListener("change", (t) => r.onChange(t.currentTarget.checked)), i(e, () => r.label, null), h(() => y(e, c("inline-flex items-center gap-2 text-sm text-foreground", r.class))), h(() => n.checked = r.checked), e;
|
|
157
|
+
})();
|
|
158
|
+
}
|
|
159
|
+
export {
|
|
160
|
+
q as B,
|
|
161
|
+
J as C,
|
|
162
|
+
X as R,
|
|
163
|
+
z as a,
|
|
164
|
+
Y as b,
|
|
165
|
+
W as c,
|
|
166
|
+
K as d,
|
|
167
|
+
Q as e
|
|
168
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface BarDatum {
|
|
3
|
+
label: string;
|
|
4
|
+
value: number;
|
|
5
|
+
}
|
|
6
|
+
export interface BarChartProps {
|
|
7
|
+
data: BarDatum[];
|
|
8
|
+
/** Height of the plot area in px. Default 160. */
|
|
9
|
+
height?: number;
|
|
10
|
+
/** Fill color token. Default 'primary'. */
|
|
11
|
+
tone?: 'primary' | 'accent';
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Vertical bar chart rendered with flexbox: each bar's height is `value /
|
|
16
|
+
* max` of the plot area, filled with a theme token, with its label truncated
|
|
17
|
+
* beneath it and its raw value available via a native tooltip.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <BarChart data={[{ label: 'Mon', value: 12 }, { label: 'Tue', value: 30 }]} tone="accent" />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function BarChart(props: BarChartProps): JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export type DonutTone = 'primary' | 'accent' | 'destructive' | 'emit' | 'received' | 'net';
|
|
3
|
+
export interface DonutSegment {
|
|
4
|
+
label: string;
|
|
5
|
+
value: number;
|
|
6
|
+
tone?: DonutTone;
|
|
7
|
+
}
|
|
8
|
+
export interface DonutChartProps {
|
|
9
|
+
data: DonutSegment[];
|
|
10
|
+
/** Overall SVG width/height in px. Default 160. */
|
|
11
|
+
size?: number;
|
|
12
|
+
/** Ring stroke width in px. Default 20. */
|
|
13
|
+
thickness?: number;
|
|
14
|
+
/** Show the summed total in the center. Default true. */
|
|
15
|
+
showTotal?: boolean;
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* SVG donut chart: one arc per segment, sized by `value / total` of the
|
|
20
|
+
* circle's circumference, starting at 12 o'clock and running clockwise.
|
|
21
|
+
* Segment colors come from each datum's `tone`, or cycle through the
|
|
22
|
+
* `--data-*` series tokens by index when omitted.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <DonutChart
|
|
27
|
+
* data={[
|
|
28
|
+
* { label: 'Sent', value: 62, tone: 'emit' },
|
|
29
|
+
* { label: 'Received', value: 38, tone: 'received' },
|
|
30
|
+
* ]}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function DonutChart(props: DonutChartProps): JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface SparklineProps {
|
|
3
|
+
data: number[];
|
|
4
|
+
/** SVG viewBox width in px. Default 120. */
|
|
5
|
+
width?: number;
|
|
6
|
+
/** SVG viewBox height in px. Default 32. */
|
|
7
|
+
height?: number;
|
|
8
|
+
/** Stroke color token. Default 'primary'. */
|
|
9
|
+
tone?: 'primary' | 'accent' | 'destructive';
|
|
10
|
+
/** Fill the area under the line faintly. Default false. */
|
|
11
|
+
area?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Minimal inline trend line: an SVG polyline scaled to fit `width`×`height`,
|
|
16
|
+
* stroked with a theme token so it recolors with the active palette. Pass
|
|
17
|
+
* `area` for a faint fill under the line.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Sparkline data={[3, 5, 4, 8, 6, 9, 7]} tone="accent" area />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function Sparkline(props: SparklineProps): JSX.Element;
|
package/dist/charts.js
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { insert as w, createComponent as k, effect as $, setAttribute as a, template as x, className as A, setStyleProperty as E } from "solid-js/web";
|
|
2
|
+
import { Show as P, For as z } from "solid-js";
|
|
3
|
+
import { c as N } from "./cn-B6yFEsav.js";
|
|
4
|
+
var D = /* @__PURE__ */ x("<svg><path stroke=none></svg>", !1, !0, !1), K = /* @__PURE__ */ x("<svg><polyline fill=none stroke-width=2 stroke-linecap=round stroke-linejoin=round></svg>", !1, !0, !1), H = /* @__PURE__ */ x("<svg preserveAspectRatio=none role=img>"), I = /* @__PURE__ */ x("<svg><circle r=2></svg>", !1, !0, !1);
|
|
5
|
+
const F = 2;
|
|
6
|
+
function R(i, s, f) {
|
|
7
|
+
if (i.length === 0) return [];
|
|
8
|
+
if (i.length === 1)
|
|
9
|
+
return [{
|
|
10
|
+
x: s / 2,
|
|
11
|
+
y: f / 2
|
|
12
|
+
}];
|
|
13
|
+
const m = Math.min(...i), g = Math.max(...i) - m || 1, v = Math.max(f - F * 2, 0), o = s / (i.length - 1);
|
|
14
|
+
return i.map((r, e) => ({
|
|
15
|
+
x: e * o,
|
|
16
|
+
y: F + v - (r - m) / g * v
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
function _(i) {
|
|
20
|
+
const s = () => i.width ?? 120, f = () => i.height ?? 32, m = () => i.tone ?? "primary", h = () => R(i.data, s(), f()), g = () => h().map((o) => `${o.x},${o.y}`).join(" "), v = () => {
|
|
21
|
+
const o = h();
|
|
22
|
+
if (o.length === 0) return "";
|
|
23
|
+
const r = o.map((l) => `${l.x},${l.y}`).join(" L "), e = o[0], n = o[o.length - 1];
|
|
24
|
+
return `M ${e.x},${f()} L ${r} L ${n.x},${f()} Z`;
|
|
25
|
+
};
|
|
26
|
+
return (() => {
|
|
27
|
+
var o = H();
|
|
28
|
+
return w(o, k(P, {
|
|
29
|
+
get when() {
|
|
30
|
+
return h().length > 0;
|
|
31
|
+
},
|
|
32
|
+
get children() {
|
|
33
|
+
return [k(P, {
|
|
34
|
+
get when() {
|
|
35
|
+
return i.area;
|
|
36
|
+
},
|
|
37
|
+
get children() {
|
|
38
|
+
var r = D();
|
|
39
|
+
return $((e) => {
|
|
40
|
+
var n = v(), l = `hsl(var(--${m()}) / 0.15)`;
|
|
41
|
+
return n !== e.e && a(r, "d", e.e = n), l !== e.t && a(r, "fill", e.t = l), e;
|
|
42
|
+
}, {
|
|
43
|
+
e: void 0,
|
|
44
|
+
t: void 0
|
|
45
|
+
}), r;
|
|
46
|
+
}
|
|
47
|
+
}), k(P, {
|
|
48
|
+
get when() {
|
|
49
|
+
return h().length > 1;
|
|
50
|
+
},
|
|
51
|
+
get fallback() {
|
|
52
|
+
return (() => {
|
|
53
|
+
var r = I();
|
|
54
|
+
return $((e) => {
|
|
55
|
+
var t, c;
|
|
56
|
+
var n = (t = h()[0]) == null ? void 0 : t.x, l = (c = h()[0]) == null ? void 0 : c.y, u = `hsl(var(--${m()}))`;
|
|
57
|
+
return n !== e.e && a(r, "cx", e.e = n), l !== e.t && a(r, "cy", e.t = l), u !== e.a && a(r, "fill", e.a = u), e;
|
|
58
|
+
}, {
|
|
59
|
+
e: void 0,
|
|
60
|
+
t: void 0,
|
|
61
|
+
a: void 0
|
|
62
|
+
}), r;
|
|
63
|
+
})();
|
|
64
|
+
},
|
|
65
|
+
get children() {
|
|
66
|
+
var r = K();
|
|
67
|
+
return $((e) => {
|
|
68
|
+
var n = g(), l = `hsl(var(--${m()}))`;
|
|
69
|
+
return n !== e.e && a(r, "points", e.e = n), l !== e.t && a(r, "stroke", e.t = l), e;
|
|
70
|
+
}, {
|
|
71
|
+
e: void 0,
|
|
72
|
+
t: void 0
|
|
73
|
+
}), r;
|
|
74
|
+
}
|
|
75
|
+
})];
|
|
76
|
+
}
|
|
77
|
+
})), $((r) => {
|
|
78
|
+
var e = N("overflow-visible", i.class), n = s(), l = f(), u = `0 0 ${s()} ${f()}`;
|
|
79
|
+
return e !== r.e && a(o, "class", r.e = e), n !== r.t && a(o, "width", r.t = n), l !== r.a && a(o, "height", r.a = l), u !== r.o && a(o, "viewBox", r.o = u), r;
|
|
80
|
+
}, {
|
|
81
|
+
e: void 0,
|
|
82
|
+
t: void 0,
|
|
83
|
+
a: void 0,
|
|
84
|
+
o: void 0
|
|
85
|
+
}), o;
|
|
86
|
+
})();
|
|
87
|
+
}
|
|
88
|
+
var X = /* @__PURE__ */ x("<div>"), Y = /* @__PURE__ */ x('<div class="flex h-full min-w-0 flex-1 flex-col items-center justify-end gap-1"><div></div><span class="w-full truncate text-center text-xs text-muted-foreground">');
|
|
89
|
+
function p(i) {
|
|
90
|
+
const s = () => i.height ?? 160, f = () => i.tone ?? "primary", m = () => Math.max(...i.data.map((g) => g.value), 0) || 1, h = () => f() === "accent" ? "bg-accent" : "bg-primary";
|
|
91
|
+
return (() => {
|
|
92
|
+
var g = X();
|
|
93
|
+
return w(g, k(z, {
|
|
94
|
+
get each() {
|
|
95
|
+
return i.data;
|
|
96
|
+
},
|
|
97
|
+
children: (v) => (() => {
|
|
98
|
+
var o = Y(), r = o.firstChild, e = r.nextSibling;
|
|
99
|
+
return w(e, () => v.label), $((n) => {
|
|
100
|
+
var l = `${v.label}: ${v.value}`, u = N("w-full rounded-t transition-all", h()), t = `${Math.max(v.value / m() * 100, 0)}%`;
|
|
101
|
+
return l !== n.e && a(r, "title", n.e = l), u !== n.t && A(r, n.t = u), t !== n.a && E(r, "height", n.a = t), n;
|
|
102
|
+
}, {
|
|
103
|
+
e: void 0,
|
|
104
|
+
t: void 0,
|
|
105
|
+
a: void 0
|
|
106
|
+
}), o;
|
|
107
|
+
})()
|
|
108
|
+
})), $((v) => {
|
|
109
|
+
var o = N("flex w-full items-end gap-2", i.class), r = `${s()}px`;
|
|
110
|
+
return o !== v.e && A(g, v.e = o), r !== v.t && E(g, "height", v.t = r), v;
|
|
111
|
+
}, {
|
|
112
|
+
e: void 0,
|
|
113
|
+
t: void 0
|
|
114
|
+
}), g;
|
|
115
|
+
})();
|
|
116
|
+
}
|
|
117
|
+
var Z = /* @__PURE__ */ x('<div class="absolute inset-0 flex items-center justify-center text-lg font-semibold tabular-nums text-foreground">'), q = /* @__PURE__ */ x("<div><svg role=img><g><circle fill=none stroke=hsl(var(--muted))>"), G = /* @__PURE__ */ x("<svg><circle fill=none stroke-linecap=butt><title></svg>", !1, !0, !1);
|
|
118
|
+
const J = {
|
|
119
|
+
primary: "--primary",
|
|
120
|
+
accent: "--accent",
|
|
121
|
+
destructive: "--destructive",
|
|
122
|
+
emit: "--data-emit",
|
|
123
|
+
received: "--data-received",
|
|
124
|
+
net: "--data-net"
|
|
125
|
+
}, O = ["--data-emit", "--data-received", "--data-net"];
|
|
126
|
+
function Q(i, s) {
|
|
127
|
+
return i.tone ? J[i.tone] : O[s % O.length];
|
|
128
|
+
}
|
|
129
|
+
function tt(i) {
|
|
130
|
+
const s = () => i.size ?? 160, f = () => i.thickness ?? 20, m = () => i.showTotal ?? !0, h = () => s() / 2, g = () => Math.max(s() / 2 - f() / 2, 0), v = () => 2 * Math.PI * g(), o = () => i.data.reduce((e, n) => e + n.value, 0), r = () => {
|
|
131
|
+
const e = o() || 1;
|
|
132
|
+
let n = 0;
|
|
133
|
+
return i.data.map((l, u) => {
|
|
134
|
+
const c = l.value / e * v(), y = n;
|
|
135
|
+
return n += c, {
|
|
136
|
+
segment: l,
|
|
137
|
+
index: u,
|
|
138
|
+
arcLength: c,
|
|
139
|
+
offset: y
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
return (() => {
|
|
144
|
+
var e = q(), n = e.firstChild, l = n.firstChild, u = l.firstChild;
|
|
145
|
+
return w(l, k(z, {
|
|
146
|
+
get each() {
|
|
147
|
+
return r();
|
|
148
|
+
},
|
|
149
|
+
children: (t) => (() => {
|
|
150
|
+
var c = G(), y = c.firstChild;
|
|
151
|
+
return w(y, () => `${t.segment.label}: ${t.segment.value}`), $((d) => {
|
|
152
|
+
var b = h(), C = h(), M = g(), L = `hsl(var(${Q(t.segment, t.index)}))`, j = f(), S = `${t.arcLength} ${Math.max(v() - t.arcLength, 0)}`, T = -t.offset;
|
|
153
|
+
return b !== d.e && a(c, "cx", d.e = b), C !== d.t && a(c, "cy", d.t = C), M !== d.a && a(c, "r", d.a = M), L !== d.o && a(c, "stroke", d.o = L), j !== d.i && a(c, "stroke-width", d.i = j), S !== d.n && a(c, "stroke-dasharray", d.n = S), T !== d.s && a(c, "stroke-dashoffset", d.s = T), d;
|
|
154
|
+
}, {
|
|
155
|
+
e: void 0,
|
|
156
|
+
t: void 0,
|
|
157
|
+
a: void 0,
|
|
158
|
+
o: void 0,
|
|
159
|
+
i: void 0,
|
|
160
|
+
n: void 0,
|
|
161
|
+
s: void 0
|
|
162
|
+
}), c;
|
|
163
|
+
})()
|
|
164
|
+
}), null), w(e, k(P, {
|
|
165
|
+
get when() {
|
|
166
|
+
return m();
|
|
167
|
+
},
|
|
168
|
+
get children() {
|
|
169
|
+
var t = Z();
|
|
170
|
+
return w(t, o), t;
|
|
171
|
+
}
|
|
172
|
+
}), null), $((t) => {
|
|
173
|
+
var c = N("relative inline-flex items-center justify-center", i.class), y = `${s()}px`, d = `${s()}px`, b = s(), C = s(), M = `0 0 ${s()} ${s()}`, L = `rotate(-90 ${h()} ${h()})`, j = h(), S = h(), T = g(), B = f();
|
|
174
|
+
return c !== t.e && A(e, t.e = c), y !== t.t && E(e, "width", t.t = y), d !== t.a && E(e, "height", t.a = d), b !== t.o && a(n, "width", t.o = b), C !== t.i && a(n, "height", t.i = C), M !== t.n && a(n, "viewBox", t.n = M), L !== t.s && a(l, "transform", t.s = L), j !== t.h && a(u, "cx", t.h = j), S !== t.r && a(u, "cy", t.r = S), T !== t.d && a(u, "r", t.d = T), B !== t.l && a(u, "stroke-width", t.l = B), t;
|
|
175
|
+
}, {
|
|
176
|
+
e: void 0,
|
|
177
|
+
t: void 0,
|
|
178
|
+
a: void 0,
|
|
179
|
+
o: void 0,
|
|
180
|
+
i: void 0,
|
|
181
|
+
n: void 0,
|
|
182
|
+
s: void 0,
|
|
183
|
+
h: void 0,
|
|
184
|
+
r: void 0,
|
|
185
|
+
d: void 0,
|
|
186
|
+
l: void 0
|
|
187
|
+
}), e;
|
|
188
|
+
})();
|
|
189
|
+
}
|
|
190
|
+
export {
|
|
191
|
+
p as BarChart,
|
|
192
|
+
tt as DonutChart,
|
|
193
|
+
_ as Sparkline
|
|
194
|
+
};
|
package/dist/commerce.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { insert as n, createComponent as u, memo as T, effect as f, className as b, template as s, delegateEvents as C, setAttribute as $ } from "solid-js/web";
|
|
2
2
|
import { Show as v, For as w } from "solid-js";
|
|
3
|
-
import {
|
|
3
|
+
import { c as h } from "./cn-B6yFEsav.js";
|
|
4
|
+
import { B as S, C as E, R as F, a as k, b as I } from "./Checkbox-DQcDOBLd.js";
|
|
4
5
|
import { Minus as N, Plus as R, Trash2 as U } from "lucide-solid";
|
|
5
6
|
var j = /* @__PURE__ */ s('<span class="text-muted-foreground line-through">'), q = /* @__PURE__ */ s("<div><span>");
|
|
6
7
|
const M = {
|
|
@@ -60,7 +61,7 @@ function D(e) {
|
|
|
60
61
|
}
|
|
61
62
|
C(["click"]);
|
|
62
63
|
var z = /* @__PURE__ */ s('<div class="relative aspect-square overflow-hidden rounded-lg bg-muted"><img loading=lazy class="h-full w-full object-cover">', !0, !1, !1), B = /* @__PURE__ */ s('<div class="mt-3 space-y-2"><p class="line-clamp-1 font-medium text-foreground">');
|
|
63
|
-
function
|
|
64
|
+
function te(e) {
|
|
64
65
|
return u(E, {
|
|
65
66
|
get class() {
|
|
66
67
|
return h("overflow-hidden p-4", e.class);
|
|
@@ -135,14 +136,14 @@ function ee(e) {
|
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
var G = /* @__PURE__ */ s("<div>");
|
|
138
|
-
function
|
|
139
|
+
function ne(e) {
|
|
139
140
|
return (() => {
|
|
140
141
|
var r = G();
|
|
141
142
|
return n(r, () => e.children), f(() => b(r, h("grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4", e.class))), r;
|
|
142
143
|
})();
|
|
143
144
|
}
|
|
144
145
|
var L = /* @__PURE__ */ s('<img class="h-16 w-16 shrink-0 rounded-md bg-muted object-cover">'), Q = /* @__PURE__ */ s('<button type=button aria-label="Remove item"class="text-muted-foreground hover:text-foreground">'), O = /* @__PURE__ */ s('<div><div class="min-w-[8rem] flex-1"><p class="line-clamp-1 font-medium text-foreground"></p></div><span class="min-w-[4rem] text-right font-medium tabular-nums text-foreground">');
|
|
145
|
-
function
|
|
146
|
+
function le(e) {
|
|
146
147
|
const r = () => e.price * e.quantity, a = (t) => new Intl.NumberFormat(e.locale ?? "en-US", {
|
|
147
148
|
style: "currency",
|
|
148
149
|
currency: e.currency ?? "USD"
|
|
@@ -201,7 +202,7 @@ function ne(e) {
|
|
|
201
202
|
}
|
|
202
203
|
C(["click"]);
|
|
203
204
|
var X = /* @__PURE__ */ s('<div><div class="my-3 border-t border-border"></div><div class="flex items-center justify-between text-base font-bold text-foreground"><span>Total</span><span class=tabular-nums>'), Z = /* @__PURE__ */ s('<div class="flex items-center justify-between py-1 text-sm"><span class=text-muted-foreground></span><span class="tabular-nums text-foreground">');
|
|
204
|
-
function
|
|
205
|
+
function re(e) {
|
|
205
206
|
const r = (a) => new Intl.NumberFormat(e.locale ?? "en-US", {
|
|
206
207
|
style: "currency",
|
|
207
208
|
currency: e.currency ?? "USD"
|
|
@@ -236,7 +237,7 @@ function le(e) {
|
|
|
236
237
|
})();
|
|
237
238
|
}
|
|
238
239
|
var H = /* @__PURE__ */ s('<div><p class="text-sm font-semibold text-foreground"></p><div class=space-y-1.5>'), J = /* @__PURE__ */ s('<span class="text-xs text-muted-foreground">'), K = /* @__PURE__ */ s('<div class="flex items-center justify-between gap-2">');
|
|
239
|
-
function
|
|
240
|
+
function ae(e) {
|
|
240
241
|
const r = (a, t) => {
|
|
241
242
|
const c = e.selected.slice(), d = c.indexOf(a);
|
|
242
243
|
t ? d === -1 && c.push(a) : d !== -1 && c.splice(d, 1), e.onChange(c);
|
|
@@ -271,11 +272,11 @@ function re(e) {
|
|
|
271
272
|
})();
|
|
272
273
|
}
|
|
273
274
|
export {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
le as CartLine,
|
|
276
|
+
re as CartSummary,
|
|
277
|
+
ae as FilterGroup,
|
|
277
278
|
A as PriceTag,
|
|
278
|
-
|
|
279
|
-
|
|
279
|
+
te as ProductCard,
|
|
280
|
+
ne as ProductGrid,
|
|
280
281
|
D as QuantityStepper
|
|
281
282
|
};
|
package/dist/elements.css
CHANGED
|
@@ -1648,6 +1648,9 @@ html.calm .tile-glass {
|
|
|
1648
1648
|
.h-\[65vh\] {
|
|
1649
1649
|
height: 65vh;
|
|
1650
1650
|
}
|
|
1651
|
+
.h-auto {
|
|
1652
|
+
height: auto;
|
|
1653
|
+
}
|
|
1651
1654
|
.h-full {
|
|
1652
1655
|
height: 100%;
|
|
1653
1656
|
}
|
|
@@ -1678,6 +1681,9 @@ html.calm .tile-glass {
|
|
|
1678
1681
|
.min-h-4 {
|
|
1679
1682
|
min-height: 1rem;
|
|
1680
1683
|
}
|
|
1684
|
+
.min-h-9 {
|
|
1685
|
+
min-height: 2.25rem;
|
|
1686
|
+
}
|
|
1681
1687
|
.min-h-\[80px\] {
|
|
1682
1688
|
min-height: 80px;
|
|
1683
1689
|
}
|
|
@@ -1693,6 +1699,9 @@ html.calm .tile-glass {
|
|
|
1693
1699
|
.w-1\.5 {
|
|
1694
1700
|
width: 0.375rem;
|
|
1695
1701
|
}
|
|
1702
|
+
.w-10 {
|
|
1703
|
+
width: 2.5rem;
|
|
1704
|
+
}
|
|
1696
1705
|
.w-11 {
|
|
1697
1706
|
width: 2.75rem;
|
|
1698
1707
|
}
|
|
@@ -1777,6 +1786,9 @@ html.calm .tile-glass {
|
|
|
1777
1786
|
.min-w-40 {
|
|
1778
1787
|
min-width: 10rem;
|
|
1779
1788
|
}
|
|
1789
|
+
.min-w-56 {
|
|
1790
|
+
min-width: 14rem;
|
|
1791
|
+
}
|
|
1780
1792
|
.min-w-\[1\.5rem\] {
|
|
1781
1793
|
min-width: 1.5rem;
|
|
1782
1794
|
}
|
|
@@ -1925,6 +1937,9 @@ html.calm .tile-glass {
|
|
|
1925
1937
|
.items-start {
|
|
1926
1938
|
align-items: flex-start;
|
|
1927
1939
|
}
|
|
1940
|
+
.items-end {
|
|
1941
|
+
align-items: flex-end;
|
|
1942
|
+
}
|
|
1928
1943
|
.items-center {
|
|
1929
1944
|
align-items: center;
|
|
1930
1945
|
}
|
|
@@ -2010,6 +2025,9 @@ html.calm .tile-glass {
|
|
|
2010
2025
|
.overflow-hidden {
|
|
2011
2026
|
overflow: hidden;
|
|
2012
2027
|
}
|
|
2028
|
+
.overflow-visible {
|
|
2029
|
+
overflow: visible;
|
|
2030
|
+
}
|
|
2013
2031
|
.overflow-x-auto {
|
|
2014
2032
|
overflow-x: auto;
|
|
2015
2033
|
}
|
|
@@ -2053,6 +2071,10 @@ html.calm .tile-glass {
|
|
|
2053
2071
|
border-top-right-radius: 0.375rem;
|
|
2054
2072
|
border-bottom-right-radius: 0.375rem;
|
|
2055
2073
|
}
|
|
2074
|
+
.rounded-t {
|
|
2075
|
+
border-top-left-radius: 0.25rem;
|
|
2076
|
+
border-top-right-radius: 0.25rem;
|
|
2077
|
+
}
|
|
2056
2078
|
.border {
|
|
2057
2079
|
border-width: 1px;
|
|
2058
2080
|
}
|
|
@@ -2299,6 +2321,10 @@ html.calm .tile-glass {
|
|
|
2299
2321
|
padding-left: 1.5rem;
|
|
2300
2322
|
padding-right: 1.5rem;
|
|
2301
2323
|
}
|
|
2324
|
+
.py-0 {
|
|
2325
|
+
padding-top: 0px;
|
|
2326
|
+
padding-bottom: 0px;
|
|
2327
|
+
}
|
|
2302
2328
|
.py-0\.5 {
|
|
2303
2329
|
padding-top: 0.125rem;
|
|
2304
2330
|
padding-bottom: 0.125rem;
|
|
@@ -2772,6 +2798,10 @@ html.calm .tile-glass {
|
|
|
2772
2798
|
.focus-within\:ring-ring\/30:focus-within {
|
|
2773
2799
|
--tw-ring-color: hsl(var(--ring) / 0.3);
|
|
2774
2800
|
}
|
|
2801
|
+
.hover\:border-primary:hover {
|
|
2802
|
+
--tw-border-opacity: 1;
|
|
2803
|
+
border-color: hsl(var(--primary) / var(--tw-border-opacity, 1));
|
|
2804
|
+
}
|
|
2775
2805
|
.hover\:border-ring\/60:hover {
|
|
2776
2806
|
border-color: hsl(var(--ring) / 0.6);
|
|
2777
2807
|
}
|
|
@@ -2785,6 +2815,9 @@ html.calm .tile-glass {
|
|
|
2785
2815
|
.hover\:bg-muted\/70:hover {
|
|
2786
2816
|
background-color: hsl(var(--muted) / 0.7);
|
|
2787
2817
|
}
|
|
2818
|
+
.hover\:bg-primary\/5:hover {
|
|
2819
|
+
background-color: hsl(var(--primary) / 0.05);
|
|
2820
|
+
}
|
|
2788
2821
|
.hover\:bg-primary\/50:hover {
|
|
2789
2822
|
background-color: hsl(var(--primary) / 0.5);
|
|
2790
2823
|
}
|
|
@@ -2812,6 +2845,10 @@ html.calm .tile-glass {
|
|
|
2812
2845
|
--tw-border-opacity: 1;
|
|
2813
2846
|
border-color: hsl(var(--ring) / var(--tw-border-opacity, 1));
|
|
2814
2847
|
}
|
|
2848
|
+
.focus\:bg-muted:focus {
|
|
2849
|
+
--tw-bg-opacity: 1;
|
|
2850
|
+
background-color: hsl(var(--muted) / var(--tw-bg-opacity, 1));
|
|
2851
|
+
}
|
|
2815
2852
|
.focus\:outline-none:focus {
|
|
2816
2853
|
outline: 2px solid transparent;
|
|
2817
2854
|
outline-offset: 2px;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const A4UI_VERSION = "0.
|
|
1
|
+
export declare const A4UI_VERSION = "0.10.0";
|
|
2
2
|
export { cn } from './lib/cn';
|
|
3
3
|
export { useTheme, toggleTheme, setTheme, storedTheme, applyTheme, toggled, type Theme } from './lib/theme';
|
|
4
4
|
export { useEffects, isCalm, setEffects } from './lib/effects';
|
|
@@ -15,6 +15,8 @@ export { TimeField, type TimeFieldProps } from './ui/TimeField';
|
|
|
15
15
|
export { DateTimeField, type DateTimeFieldProps } from './ui/DateTimeField';
|
|
16
16
|
export { DateRangePicker, type DateRange, type DateRangePickerProps } from './ui/DateRangePicker';
|
|
17
17
|
export { FormField, FormLabel, FormControl, FormDescription, FormError, type FormFieldProps } from './ui/Form';
|
|
18
|
+
export { FileUpload, type UploadFile, type FileUploadProps } from './ui/FileUpload';
|
|
19
|
+
export { MultiSelect, type MultiSelectOption, type MultiSelectProps } from './ui/MultiSelect';
|
|
18
20
|
export { Drawer } from './ui/Drawer';
|
|
19
21
|
export { Dropdown, type DropdownItem } from './ui/Dropdown';
|
|
20
22
|
export { Dropzone } from './ui/Dropzone';
|