@a4ui/core 0.8.1 → 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 +19 -9
- 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/CartLine.d.ts +32 -0
- package/dist/commerce/CartSummary.d.ts +32 -0
- package/dist/commerce/FilterGroup.d.ts +28 -0
- package/dist/commerce/PriceTag.d.ts +25 -0
- package/dist/commerce/ProductCard.d.ts +33 -0
- package/dist/commerce/ProductGrid.d.ts +16 -0
- package/dist/commerce/QuantityStepper.d.ts +21 -0
- package/dist/commerce/index.d.ts +7 -0
- package/dist/commerce.js +282 -0
- package/dist/elements.css +79 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2549 -2234
- package/dist/ui/DateRangePicker.d.ts +29 -0
- package/dist/ui/FileUpload.d.ts +54 -0
- package/dist/ui/Form.d.ts +57 -0
- package/dist/ui/MultiSelect.d.ts +35 -0
- package/dist/ui/internal/CalendarCore.d.ts +4 -0
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -111,18 +111,28 @@ 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
|
|
|
118
|
-
| Category | Representative components
|
|
119
|
-
| -------------- |
|
|
120
|
-
| Forms | `Input`, `Select`, `Checkbox`, `DateField`, `Combobox`, `TagInput`, `Slider`, `NumberInput`
|
|
121
|
-
| Overlays | `Modal`, `Drawer`, `Popover`, `Tooltip`, `AlertDialog`, `ContextMenu`, `HoverCard`
|
|
122
|
-
| Data & display | `Table`, `DataGrid`, `Tree`, `Calendar`, `Timeline`, `Stat`, `Descriptions`, `CalendarHeatmap`
|
|
123
|
-
| Navigation | `Tabs`, `Breadcrumb`, `Pagination`, `Command`, `Anchor`, `Stepper`, `BottomNavigation`
|
|
124
|
-
| Feedback | `Alert`, `Toast`, `Progress`, `Skeleton`, `Empty`, `Result`, `NotificationCenter`
|
|
125
|
-
| Layout | `AppShell`, `SpaceBackground`, `ThemedScenery`, `Card`, `Splitter`, `Affix`, `NavGroup`
|
|
118
|
+
| Category | Representative components |
|
|
119
|
+
| -------------- | ----------------------------------------------------------------------------------------------------- |
|
|
120
|
+
| Forms | `Input`, `Select`, `Checkbox`, `DateField`, `Combobox`, `TagInput`, `Slider`, `NumberInput` |
|
|
121
|
+
| Overlays | `Modal`, `Drawer`, `Popover`, `Tooltip`, `AlertDialog`, `ContextMenu`, `HoverCard` |
|
|
122
|
+
| Data & display | `Table`, `DataGrid`, `Tree`, `Calendar`, `Timeline`, `Stat`, `Descriptions`, `CalendarHeatmap` |
|
|
123
|
+
| Navigation | `Tabs`, `Breadcrumb`, `Pagination`, `Command`, `Anchor`, `Stepper`, `BottomNavigation` |
|
|
124
|
+
| Feedback | `Alert`, `Toast`, `Progress`, `Skeleton`, `Empty`, `Result`, `NotificationCenter` |
|
|
125
|
+
| Layout | `AppShell`, `SpaceBackground`, `ThemedScenery`, `Card`, `Splitter`, `Affix`, `NavGroup` |
|
|
126
|
+
| Commerce | `ProductCard`, `ProductGrid`, `PriceTag`, `QuantityStepper`, `CartLine`, `CartSummary`, `FilterGroup` |
|
|
127
|
+
| Charts | `Sparkline`, `BarChart`, `DonutChart` (native SVG, theme-tinted) |
|
|
128
|
+
|
|
129
|
+
Domain-specific sets ship as **subpath entries** so the base package stays lean —
|
|
130
|
+
e.g. commerce and chart components import from their own paths:
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import { ProductCard, CartSummary } from '@a4ui/core/commerce'
|
|
134
|
+
import { DonutChart, Sparkline } from '@a4ui/core/charts'
|
|
135
|
+
```
|
|
126
136
|
|
|
127
137
|
## Why A4ui
|
|
128
138
|
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface CartLineProps {
|
|
3
|
+
title: string;
|
|
4
|
+
/** Unit price. */
|
|
5
|
+
price: number;
|
|
6
|
+
quantity: number;
|
|
7
|
+
image?: string;
|
|
8
|
+
/** ISO 4217 currency code. Defaults to `'USD'`. */
|
|
9
|
+
currency?: string;
|
|
10
|
+
/** BCP 47 locale used for formatting. Defaults to `'en-US'`. */
|
|
11
|
+
locale?: string;
|
|
12
|
+
onQuantityChange?: (quantity: number) => void;
|
|
13
|
+
onRemove?: () => void;
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* One line item in a shopping cart: thumbnail, title with unit price, a
|
|
18
|
+
* {@link QuantityStepper}, the line total, and an optional remove action.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <CartLine
|
|
23
|
+
* title="Wireless Mouse"
|
|
24
|
+
* price={29.99}
|
|
25
|
+
* quantity={2}
|
|
26
|
+
* image="/mouse.jpg"
|
|
27
|
+
* onQuantityChange={setQty}
|
|
28
|
+
* onRemove={() => removeLine(id)}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function CartLine(props: CartLineProps): JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface CartSummaryItem {
|
|
3
|
+
label: string;
|
|
4
|
+
amount: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CartSummaryProps {
|
|
7
|
+
/** Itemized rows, e.g. Subtotal, Shipping, Tax. */
|
|
8
|
+
lines: CartSummaryItem[];
|
|
9
|
+
total: number;
|
|
10
|
+
/** ISO 4217 currency code. Defaults to `'USD'`. */
|
|
11
|
+
currency?: string;
|
|
12
|
+
/** BCP 47 locale used for formatting. Defaults to `'en-US'`. */
|
|
13
|
+
locale?: string;
|
|
14
|
+
/** Label for the checkout button. Defaults to `'Checkout'`. */
|
|
15
|
+
checkoutLabel?: string;
|
|
16
|
+
onCheckout?: () => void;
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Order summary panel listing itemized amounts (subtotal, shipping, tax,
|
|
21
|
+
* ...), a bold total, and an optional full-width checkout button.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <CartSummary
|
|
26
|
+
* lines={[{ label: 'Subtotal', amount: 59.98 }, { label: 'Shipping', amount: 4.99 }]}
|
|
27
|
+
* total={64.97}
|
|
28
|
+
* onCheckout={() => goToCheckout()}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function CartSummary(props: CartSummaryProps): JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface FacetOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
count?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FilterGroupProps {
|
|
8
|
+
title: string;
|
|
9
|
+
options: FacetOption[];
|
|
10
|
+
selected: string[];
|
|
11
|
+
onChange: (selected: string[]) => void;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Titled group of checkbox facet options (e.g. size, color, brand), each with
|
|
16
|
+
* an optional result count, for faceted search/filter sidebars.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <FilterGroup
|
|
21
|
+
* title="Size"
|
|
22
|
+
* options={[{ value: 'sm', label: 'Small', count: 12 }, { value: 'md', label: 'Medium', count: 8 }]}
|
|
23
|
+
* selected={selected()}
|
|
24
|
+
* onChange={setSelected}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function FilterGroup(props: FilterGroupProps): JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
/** Text size of a {@link PriceTag}'s main amount. Defaults to `'md'`. */
|
|
3
|
+
export type PriceTagSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface PriceTagProps {
|
|
5
|
+
amount: number;
|
|
6
|
+
/** Original price; shown struck-through when greater than `amount`. */
|
|
7
|
+
compareAt?: number;
|
|
8
|
+
/** ISO 4217 currency code. Defaults to `'USD'`. */
|
|
9
|
+
currency?: string;
|
|
10
|
+
/** BCP 47 locale used for formatting. Defaults to `'en-US'`. */
|
|
11
|
+
locale?: string;
|
|
12
|
+
/** Text size of the main price. Defaults to `'md'`. */
|
|
13
|
+
size?: PriceTagSize;
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Formatted price display with an optional struck-through compare-at price
|
|
18
|
+
* and a discount-percent badge when the item is on sale.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <PriceTag amount={29.99} compareAt={39.99} currency="USD" />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function PriceTag(props: PriceTagProps): JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { JSX } from 'solid-js';
|
|
2
|
+
export interface ProductCardProps {
|
|
3
|
+
title: string;
|
|
4
|
+
price: number;
|
|
5
|
+
compareAt?: number;
|
|
6
|
+
image: string;
|
|
7
|
+
/** Rating from 0-5; renders a readonly {@link Rating} when present. */
|
|
8
|
+
rating?: number;
|
|
9
|
+
/** Small overlay label shown over the image top-left, e.g. `'New'`. */
|
|
10
|
+
badge?: string;
|
|
11
|
+
currency?: string;
|
|
12
|
+
locale?: string;
|
|
13
|
+
onAddToCart?: () => void;
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Card summarizing a single product: image, title, optional rating, price
|
|
18
|
+
* (with compare-at/discount), and an optional "Add to cart" button.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <ProductCard
|
|
23
|
+
* title="Wireless Headphones"
|
|
24
|
+
* price={79.99}
|
|
25
|
+
* compareAt={99.99}
|
|
26
|
+
* image="/headphones.jpg"
|
|
27
|
+
* rating={4}
|
|
28
|
+
* badge="New"
|
|
29
|
+
* onAddToCart={() => addToCart(sku)}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function ProductCard(props: ProductCardProps): JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSX, ParentProps } from 'solid-js';
|
|
2
|
+
export interface ProductGridProps extends ParentProps {
|
|
3
|
+
class?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Responsive grid wrapper: 2 columns by default, 3 at `sm`, 4 at `lg`.
|
|
7
|
+
* Typically used to lay out a list of {@link ProductCard}s.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <ProductGrid>
|
|
12
|
+
* <For each={products()}>{(p) => <ProductCard {...p} />}</For>
|
|
13
|
+
* </ProductGrid>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function ProductGrid(props: ProductGridProps): JSX.Element;
|