@agent-factory-platform/ui-kit 0.7.1 → 0.9.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 +22 -0
- package/dist/charts/adapter.js +111 -0
- package/dist/charts/basic.d.ts +2 -0
- package/dist/charts/basic.js +115 -0
- package/dist/charts/chart-tooltip.js +21 -0
- package/dist/charts/event-markers-primitive.d.ts +10 -1
- package/dist/charts/event-markers-primitive.js +116 -0
- package/dist/charts/index.d.ts +1 -0
- package/dist/charts/ohlc-annotations.d.ts +56 -0
- package/dist/charts/ohlc-annotations.js +84 -0
- package/dist/charts/ohlc.d.ts +5 -1
- package/dist/charts/ohlc.js +240 -0
- package/dist/charts/series.js +584 -0
- package/dist/charts/theme.js +35 -0
- package/dist/charts/time-combo.js +17 -0
- package/dist/component-api.js +3 -5
- package/dist/component-api.json.js +9 -0
- package/dist/component-manifest.json.js +9 -0
- package/dist/components/alert.js +35 -0
- package/dist/components/avatar.js +101 -0
- package/dist/components/badge.js +111 -0
- package/dist/components/button-group.js +22 -0
- package/dist/components/button.js +64 -0
- package/dist/components/calendar-period-navigator.js +34 -0
- package/dist/components/card.js +35 -0
- package/dist/components/chart-frame.js +53 -0
- package/dist/components/color-picker.js +155 -0
- package/dist/components/combobox.js +129 -0
- package/dist/components/command-dialog.js +89 -0
- package/dist/components/confirm-dialog.js +57 -0
- package/dist/components/data-table.js +135 -0
- package/dist/components/date-time.js +203 -0
- package/dist/components/disclosure.js +29 -0
- package/dist/components/drawer.js +150 -0
- package/dist/components/dropdown-select.js +191 -0
- package/dist/components/field.js +21 -0
- package/dist/components/floating-window.js +159 -0
- package/dist/components/heading.js +21 -0
- package/dist/components/hover-tip.js +90 -0
- package/dist/components/icon-tip.js +12 -0
- package/dist/components/input-group.js +16 -0
- package/dist/components/input-otp.js +56 -0
- package/dist/components/input.js +44 -0
- package/dist/components/item.js +47 -0
- package/dist/components/kbd.js +18 -0
- package/dist/components/line-chart.js +79 -0
- package/dist/components/listbox.js +33 -0
- package/dist/components/live-value.js +26 -0
- package/dist/components/modal.js +140 -0
- package/dist/components/multi-select.js +54 -0
- package/dist/components/native-select.js +17 -0
- package/dist/components/navigation.js +42 -0
- package/dist/components/page.js +24 -0
- package/dist/components/popover-menu.js +164 -0
- package/dist/components/progress.js +23 -0
- package/dist/components/resizable-pane.js +73 -0
- package/dist/components/scroll-load-more.js +61 -0
- package/dist/components/seg-slider.js +42 -0
- package/dist/components/segmented-control.js +46 -0
- package/dist/components/selection-controls.js +119 -0
- package/dist/components/sidebar.js +23 -0
- package/dist/components/skeleton.js +9 -0
- package/dist/components/slider.js +162 -0
- package/dist/components/sliding-tabs.js +118 -0
- package/dist/components/spinner.js +9 -0
- package/dist/components/spotlight-tour.js +122 -0
- package/dist/components/stat-card.js +23 -0
- package/dist/components/state-view.js +75 -0
- package/dist/components/stats-table.js +17 -0
- package/dist/components/table.js +24 -0
- package/dist/components/tag-pill.d.ts +4 -1
- package/dist/components/tag-pill.js +69 -0
- package/dist/components/theme-editor.js +159 -0
- package/dist/components/toast.js +66 -0
- package/dist/components/toolbar.js +46 -0
- package/dist/components/utility.js +19 -0
- package/dist/components/widget-frame.js +41 -0
- package/dist/components/widget-picker.js +87 -0
- package/dist/components/workspace-grid.js +468 -0
- package/dist/focus-modality.js +3 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js +228 -5564
- package/dist/lib/cn.js +6 -0
- package/dist/lib/focus-modality.js +16 -0
- package/dist/lib/motion.js +27 -0
- package/dist/lib/viewport.js +13 -0
- package/dist/manifest.js +5 -7
- package/dist/styles.js +1 -1
- package/dist/theme.js +158 -0
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m } from "react";
|
|
3
|
+
import { cn as c } from "../lib/cn.js";
|
|
4
|
+
const p = {
|
|
5
|
+
compact: "size-control-compact text-data",
|
|
6
|
+
default: "size-control-default text-caption",
|
|
7
|
+
touch: "size-control-touch text-body-sm"
|
|
8
|
+
}, g = {
|
|
9
|
+
online: "bg-success",
|
|
10
|
+
away: "bg-warning",
|
|
11
|
+
offline: "bg-graphite"
|
|
12
|
+
};
|
|
13
|
+
function w({ src: e, fallback: r, label: o, status: a, statusLabel: t, size: l = "default", className: u }) {
|
|
14
|
+
const [n, s] = m(!1);
|
|
15
|
+
return /* @__PURE__ */ f(
|
|
16
|
+
"span",
|
|
17
|
+
{
|
|
18
|
+
role: "img",
|
|
19
|
+
"aria-label": o,
|
|
20
|
+
"data-size": l,
|
|
21
|
+
className: c("relative inline-grid shrink-0 place-items-center overflow-visible rounded-full bg-surface-muted font-data font-[600] text-ink ring-1 ring-border", p[l], u),
|
|
22
|
+
children: [
|
|
23
|
+
e && !n ? /* @__PURE__ */ i(
|
|
24
|
+
"img",
|
|
25
|
+
{
|
|
26
|
+
src: e,
|
|
27
|
+
alt: "",
|
|
28
|
+
className: "size-full rounded-full object-cover",
|
|
29
|
+
onError: () => s(!0)
|
|
30
|
+
}
|
|
31
|
+
) : /* @__PURE__ */ i("span", { className: "truncate px-1", "data-slot": "avatar-fallback", children: r }),
|
|
32
|
+
a && /* @__PURE__ */ i(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
"aria-label": t,
|
|
36
|
+
"aria-hidden": t ? void 0 : !0,
|
|
37
|
+
"data-status": a,
|
|
38
|
+
className: c("absolute bottom-0 right-0 z-10 size-2.5 rounded-full ring-2 ring-surface-canvas", g[a])
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
const v = {
|
|
46
|
+
compact: "-space-x-1.5",
|
|
47
|
+
default: "-space-x-2"
|
|
48
|
+
};
|
|
49
|
+
function z({
|
|
50
|
+
label: e,
|
|
51
|
+
children: r,
|
|
52
|
+
overlap: o = "default",
|
|
53
|
+
className: a,
|
|
54
|
+
...t
|
|
55
|
+
}) {
|
|
56
|
+
return /* @__PURE__ */ i(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
role: "group",
|
|
60
|
+
"aria-label": e,
|
|
61
|
+
className: c(
|
|
62
|
+
"isolate inline-flex items-center overflow-visible [&>*]:relative [&>*]:ring-2 [&>*]:ring-surface-raised [&>*]:transition-transform [&>*:hover]:z-10 [&>*:hover]:-translate-y-px",
|
|
63
|
+
v[o],
|
|
64
|
+
a
|
|
65
|
+
),
|
|
66
|
+
...t,
|
|
67
|
+
children: r
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function N({
|
|
72
|
+
count: e,
|
|
73
|
+
label: r,
|
|
74
|
+
size: o = 20,
|
|
75
|
+
showPlus: a = !0,
|
|
76
|
+
className: t,
|
|
77
|
+
style: l,
|
|
78
|
+
...u
|
|
79
|
+
}) {
|
|
80
|
+
const n = Math.max(0, Math.floor(e)), s = `${a && n > 0 ? "+" : ""}${n}`, d = Math.max(o, 18 + Math.max(0, s.length - 2) * 4);
|
|
81
|
+
return /* @__PURE__ */ i(
|
|
82
|
+
"span",
|
|
83
|
+
{
|
|
84
|
+
role: "img",
|
|
85
|
+
"aria-label": r,
|
|
86
|
+
"data-avatar-overflow-count": n,
|
|
87
|
+
className: c(
|
|
88
|
+
"inline-grid shrink-0 place-items-center overflow-visible whitespace-nowrap rounded-full bg-surface-muted font-data text-[9px] font-[600] leading-none text-ink",
|
|
89
|
+
t
|
|
90
|
+
),
|
|
91
|
+
style: { width: d, height: d, ...l },
|
|
92
|
+
...u,
|
|
93
|
+
children: s
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
w as Avatar,
|
|
99
|
+
z as AvatarGroup,
|
|
100
|
+
N as AvatarGroupOverflow
|
|
101
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as i, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useEffect as w } from "react";
|
|
3
|
+
import { cn as l } from "../lib/cn.js";
|
|
4
|
+
const g = [
|
|
5
|
+
"var(--color-surface-warm)",
|
|
6
|
+
"var(--color-surface-cool)",
|
|
7
|
+
"var(--color-surface-muted)",
|
|
8
|
+
"var(--color-surface-raised)"
|
|
9
|
+
];
|
|
10
|
+
function m(t) {
|
|
11
|
+
let n = 0;
|
|
12
|
+
for (let e = 0; e < t.length; e++) n = n * 31 + t.charCodeAt(e) >>> 0;
|
|
13
|
+
return g[n % g.length];
|
|
14
|
+
}
|
|
15
|
+
function v({
|
|
16
|
+
initials: t,
|
|
17
|
+
tint: n,
|
|
18
|
+
size: e = 36,
|
|
19
|
+
className: r,
|
|
20
|
+
src: o,
|
|
21
|
+
alt: a
|
|
22
|
+
}) {
|
|
23
|
+
return o ? /* @__PURE__ */ i(
|
|
24
|
+
"img",
|
|
25
|
+
{
|
|
26
|
+
src: o,
|
|
27
|
+
alt: a ?? t,
|
|
28
|
+
className: l("inline-block shrink-0 rounded-full object-cover", r),
|
|
29
|
+
style: { width: e, height: e }
|
|
30
|
+
}
|
|
31
|
+
) : /* @__PURE__ */ i(
|
|
32
|
+
"span",
|
|
33
|
+
{
|
|
34
|
+
className: l(
|
|
35
|
+
"inline-flex items-center justify-center rounded-full font-sohne font-[500] text-ink",
|
|
36
|
+
r
|
|
37
|
+
),
|
|
38
|
+
style: {
|
|
39
|
+
backgroundColor: n ?? m(t),
|
|
40
|
+
width: e,
|
|
41
|
+
height: e,
|
|
42
|
+
fontSize: Math.round(e * 0.36)
|
|
43
|
+
},
|
|
44
|
+
children: t.slice(0, 2).toUpperCase()
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
function j({ label: t, fallback: n, sources: e = [], tint: r, size: o = 20, className: a }) {
|
|
49
|
+
const [c, f] = h(0), [s, u] = h(!1), d = e[c];
|
|
50
|
+
return w(() => {
|
|
51
|
+
f(0), u(!1);
|
|
52
|
+
}, [t, e.join("|")]), /* @__PURE__ */ x(
|
|
53
|
+
"span",
|
|
54
|
+
{
|
|
55
|
+
role: "img",
|
|
56
|
+
"aria-label": t,
|
|
57
|
+
"data-image-state": s ? "loaded" : d ? "loading" : "fallback",
|
|
58
|
+
className: l("relative inline-grid shrink-0 place-items-center overflow-hidden rounded-full font-sohne font-[600] text-ink", a),
|
|
59
|
+
style: { width: o, height: o, backgroundColor: s ? "transparent" : r ?? m(t) },
|
|
60
|
+
children: [
|
|
61
|
+
!s && /* @__PURE__ */ i("span", { "aria-hidden": !0, style: { fontSize: Math.max(7, Math.round(o * 0.42)), lineHeight: 1 }, children: n.slice(0, 2).toUpperCase() }),
|
|
62
|
+
d && /* @__PURE__ */ i(
|
|
63
|
+
"img",
|
|
64
|
+
{
|
|
65
|
+
src: d,
|
|
66
|
+
alt: "",
|
|
67
|
+
"aria-hidden": !0,
|
|
68
|
+
onLoad: () => u(!0),
|
|
69
|
+
onError: () => {
|
|
70
|
+
c + 1 < e.length ? f((p) => p + 1) : u(!1);
|
|
71
|
+
},
|
|
72
|
+
className: l("absolute inset-0 size-full rounded-full object-contain", s ? "opacity-100" : "opacity-0")
|
|
73
|
+
},
|
|
74
|
+
d
|
|
75
|
+
)
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
function C({ children: t, tone: n = "neutral", size: e = "default", className: r, ...o }) {
|
|
81
|
+
const a = {
|
|
82
|
+
neutral: "bg-fog text-graphite",
|
|
83
|
+
warm: "bg-surface-warm text-rust",
|
|
84
|
+
cool: "bg-surface-cool text-ink",
|
|
85
|
+
success: "bg-up/15 text-ink",
|
|
86
|
+
danger: "bg-down/15 text-down",
|
|
87
|
+
warning: "bg-warning/15 text-warning"
|
|
88
|
+
}, c = {
|
|
89
|
+
micro: "h-4 rounded-indicator px-1.5 text-micro font-[500]",
|
|
90
|
+
compact: "h-5 rounded-control px-2 text-data font-[500]",
|
|
91
|
+
default: "min-h-7 rounded-full px-3 py-1 text-[13px] font-[450]"
|
|
92
|
+
};
|
|
93
|
+
return /* @__PURE__ */ i(
|
|
94
|
+
"span",
|
|
95
|
+
{
|
|
96
|
+
...o,
|
|
97
|
+
className: l(
|
|
98
|
+
"inline-flex shrink-0 items-center justify-center whitespace-nowrap font-sohne",
|
|
99
|
+
a[n],
|
|
100
|
+
c[e],
|
|
101
|
+
r
|
|
102
|
+
),
|
|
103
|
+
children: t
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
v as AvatarBadge,
|
|
109
|
+
j as ResourceIcon,
|
|
110
|
+
C as Tag
|
|
111
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { cn as l } from "../lib/cn.js";
|
|
3
|
+
function d({ label: o, children: n, orientation: t = "horizontal", className: r }) {
|
|
4
|
+
return /* @__PURE__ */ i(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
role: "group",
|
|
8
|
+
"aria-label": o,
|
|
9
|
+
"aria-orientation": t,
|
|
10
|
+
"data-orientation": t,
|
|
11
|
+
className: l(
|
|
12
|
+
"inline-flex min-w-0 [&>button]:relative [&>button]:focus-visible:z-10",
|
|
13
|
+
t === "horizontal" ? "flex-row [&>button:not(:first-child)]:-ml-px [&>button:not(:first-child)]:rounded-l-none [&>button:not(:last-child)]:rounded-r-none" : "flex-col [&>button:not(:first-child)]:-mt-px [&>button:not(:first-child)]:rounded-t-none [&>button:not(:last-child)]:rounded-b-none",
|
|
14
|
+
r
|
|
15
|
+
),
|
|
16
|
+
children: n
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
d as ButtonGroup
|
|
22
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Slot as u } from "radix-ui";
|
|
3
|
+
import { forwardRef as p } from "react";
|
|
4
|
+
import { cn as f } from "../lib/cn.js";
|
|
5
|
+
function h({
|
|
6
|
+
asChild: o = !1,
|
|
7
|
+
variant: t = "primary",
|
|
8
|
+
size: e = "default",
|
|
9
|
+
className: n,
|
|
10
|
+
children: r,
|
|
11
|
+
type: s = "button",
|
|
12
|
+
...i
|
|
13
|
+
}) {
|
|
14
|
+
const c = o ? u.Root : "button", l = "inline-flex shrink-0 items-center justify-center gap-2 rounded-control font-sohne font-[500] tracking-[0] outline-none transition-[background-color,color,border-color,opacity,transform] duration-150 active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-rust/35 focus-visible:ring-offset-2 focus-visible:ring-offset-surface-canvas disabled:pointer-events-none disabled:opacity-45", d = {
|
|
15
|
+
primary: "bg-solid text-on-solid hover:opacity-90",
|
|
16
|
+
accent: "bg-rust text-on-accent hover:opacity-90",
|
|
17
|
+
secondary: "border border-border bg-surface-muted text-ink hover:bg-surface-hover",
|
|
18
|
+
ghost: "text-ink hover:bg-surface-hover",
|
|
19
|
+
success: "bg-up text-on-status hover:opacity-90",
|
|
20
|
+
danger: "bg-danger text-on-status hover:opacity-90",
|
|
21
|
+
text: "h-auto rounded-none p-0 text-ink underline-offset-4 hover:underline"
|
|
22
|
+
}, b = {
|
|
23
|
+
compact: "h-control-compact px-2.5 text-caption",
|
|
24
|
+
default: "h-control-default px-3.5 text-body-sm",
|
|
25
|
+
touch: "h-control-touch px-4 text-body",
|
|
26
|
+
icon: "size-control-default p-0"
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ a(
|
|
29
|
+
c,
|
|
30
|
+
{
|
|
31
|
+
type: o ? void 0 : s,
|
|
32
|
+
"data-variant": t,
|
|
33
|
+
"data-size": e,
|
|
34
|
+
className: f(l, d[t], b[e], n),
|
|
35
|
+
...i,
|
|
36
|
+
children: r
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function y({ children: o }) {
|
|
41
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center justify-end gap-2", children: o });
|
|
42
|
+
}
|
|
43
|
+
const k = p(function({ asChild: t = !1, active: e = !1, className: n, children: r, ...s }, i) {
|
|
44
|
+
const c = t ? u.Root : "button";
|
|
45
|
+
return /* @__PURE__ */ a(
|
|
46
|
+
c,
|
|
47
|
+
{
|
|
48
|
+
ref: i,
|
|
49
|
+
type: t ? void 0 : "button",
|
|
50
|
+
"data-active": e || void 0,
|
|
51
|
+
className: f(
|
|
52
|
+
"outline-none transition-[background-color,color,border-color,box-shadow,transform] focus-visible:ring-2 focus-visible:ring-rust/35 focus-visible:ring-offset-2 focus-visible:ring-offset-surface-canvas active:scale-[0.99]",
|
|
53
|
+
n
|
|
54
|
+
),
|
|
55
|
+
...s,
|
|
56
|
+
children: r
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
y as ActionGroup,
|
|
62
|
+
h as Button,
|
|
63
|
+
k as Pressable
|
|
64
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsxs as a, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft as v, ChevronRight as g } from "lucide-react";
|
|
3
|
+
import { cn as u } from "../lib/cn.js";
|
|
4
|
+
import { Button as r } from "./button.js";
|
|
5
|
+
import { DatePicker as x } from "./date-time.js";
|
|
6
|
+
import { SlidingTabs as C } from "./sliding-tabs.js";
|
|
7
|
+
function j({
|
|
8
|
+
value: o,
|
|
9
|
+
onValueChange: n,
|
|
10
|
+
onPrevious: t,
|
|
11
|
+
onNext: c,
|
|
12
|
+
onToday: s,
|
|
13
|
+
period: d,
|
|
14
|
+
onPeriodChange: m,
|
|
15
|
+
periods: l,
|
|
16
|
+
labels: e,
|
|
17
|
+
datePicker: h,
|
|
18
|
+
className: p,
|
|
19
|
+
trailing: f
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ a("div", { className: u("flex min-w-0 flex-wrap items-center gap-2", p), children: [
|
|
22
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
|
|
23
|
+
/* @__PURE__ */ i(r, { size: "icon", variant: "ghost", "aria-label": e.previousPeriod, onClick: t, children: /* @__PURE__ */ i(v, { size: 14, "aria-hidden": !0 }) }),
|
|
24
|
+
/* @__PURE__ */ i(r, { size: "compact", variant: "secondary", onClick: s, children: e.today }),
|
|
25
|
+
/* @__PURE__ */ i(r, { size: "icon", variant: "ghost", "aria-label": e.nextPeriod, onClick: c, children: /* @__PURE__ */ i(g, { size: 14, "aria-hidden": !0 }) })
|
|
26
|
+
] }),
|
|
27
|
+
/* @__PURE__ */ i("div", { className: "w-36", children: /* @__PURE__ */ i(x, { ...h, value: o, onValueChange: n }) }),
|
|
28
|
+
/* @__PURE__ */ i(C, { size: "sm", value: d, onChange: m, tabs: l }),
|
|
29
|
+
f
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
j as CalendarPeriodNavigator
|
|
34
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Slot as f } from "radix-ui";
|
|
3
|
+
import { cn as n } from "../lib/cn.js";
|
|
4
|
+
function u({ asChild: r = !1, as: o = "div", tone: a = "plain", density: e = "default", className: c, children: d, ...s }) {
|
|
5
|
+
const b = r ? f.Root : o;
|
|
6
|
+
return /* @__PURE__ */ t(
|
|
7
|
+
b,
|
|
8
|
+
{
|
|
9
|
+
"data-density": e,
|
|
10
|
+
className: n(
|
|
11
|
+
"rounded-panel",
|
|
12
|
+
e === "none" ? "" : e === "compact" ? "p-3" : "p-4",
|
|
13
|
+
{
|
|
14
|
+
plain: "border border-border bg-surface-card",
|
|
15
|
+
warm: "border border-border bg-surface-warm",
|
|
16
|
+
cool: "border border-border bg-surface-cool"
|
|
17
|
+
}[a],
|
|
18
|
+
c
|
|
19
|
+
),
|
|
20
|
+
...s,
|
|
21
|
+
children: d
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function x({ children: r, className: o }) {
|
|
26
|
+
return /* @__PURE__ */ t("h3", { className: n("font-sohne text-body font-[500] tracking-[0] text-ink", o), children: r });
|
|
27
|
+
}
|
|
28
|
+
function g({ children: r, className: o }) {
|
|
29
|
+
return /* @__PURE__ */ t("span", { className: n("font-sohne text-caption text-graphite", o), children: r });
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
u as Card,
|
|
33
|
+
g as CardLabel,
|
|
34
|
+
x as CardTitle
|
|
35
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useId as c } from "react";
|
|
3
|
+
import { cn as l } from "../lib/cn.js";
|
|
4
|
+
const b = {
|
|
5
|
+
live: "bg-up",
|
|
6
|
+
stale: "bg-warning",
|
|
7
|
+
loading: "bg-info",
|
|
8
|
+
error: "bg-danger"
|
|
9
|
+
};
|
|
10
|
+
function N({
|
|
11
|
+
title: o,
|
|
12
|
+
summary: m,
|
|
13
|
+
status: i,
|
|
14
|
+
statusLabel: n,
|
|
15
|
+
toolbar: a,
|
|
16
|
+
legend: s,
|
|
17
|
+
className: h,
|
|
18
|
+
children: f,
|
|
19
|
+
...p
|
|
20
|
+
}) {
|
|
21
|
+
const d = c(), t = c();
|
|
22
|
+
return /* @__PURE__ */ r(
|
|
23
|
+
"figure",
|
|
24
|
+
{
|
|
25
|
+
"aria-labelledby": d,
|
|
26
|
+
"aria-describedby": t,
|
|
27
|
+
"data-chart-status": i,
|
|
28
|
+
className: l(
|
|
29
|
+
"flex min-h-chart-frame-min min-w-0 flex-col overflow-hidden rounded-panel border border-border bg-surface-card",
|
|
30
|
+
h
|
|
31
|
+
),
|
|
32
|
+
...p,
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ r("header", { className: "flex min-h-row-compact shrink-0 items-center justify-between gap-3 border-b border-divider px-3", children: [
|
|
35
|
+
/* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
36
|
+
/* @__PURE__ */ e("span", { id: d, className: "truncate font-sohne text-caption font-[500] text-ink", children: o }),
|
|
37
|
+
i && n && /* @__PURE__ */ r("span", { className: "inline-flex shrink-0 items-center gap-1.5 font-sohne text-micro text-graphite", children: [
|
|
38
|
+
/* @__PURE__ */ e("span", { className: l("size-1.5 rounded-full", b[i]), "aria-hidden": !0 }),
|
|
39
|
+
n
|
|
40
|
+
] })
|
|
41
|
+
] }),
|
|
42
|
+
a && /* @__PURE__ */ e("div", { className: "flex shrink-0 items-center gap-1", children: a })
|
|
43
|
+
] }),
|
|
44
|
+
s && /* @__PURE__ */ e("div", { className: "shrink-0 border-b border-divider px-3 py-1.5", children: s }),
|
|
45
|
+
/* @__PURE__ */ e("div", { className: "min-h-0 min-w-0 flex-1 p-3", children: f }),
|
|
46
|
+
/* @__PURE__ */ e("figcaption", { id: t, className: "sr-only", children: m })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
N as ChartFrame
|
|
53
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx as s, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { Pipette as w, Check as x } from "lucide-react";
|
|
3
|
+
import { useMemo as N, useState as k, useRef as C, useEffect as y } from "react";
|
|
4
|
+
import { Button as $ } from "./button.js";
|
|
5
|
+
import { Input as M } from "./input.js";
|
|
6
|
+
import { Popover as z } from "./popover-menu.js";
|
|
7
|
+
function b(d, p = 0, t = 1) {
|
|
8
|
+
return Math.min(t, Math.max(p, d));
|
|
9
|
+
}
|
|
10
|
+
function D(d) {
|
|
11
|
+
const p = /^#[0-9a-f]{6}$/i.test(d) ? d : "#000000", [t, i, o] = [1, 3, 5].map((h) => Number.parseInt(p.slice(h, h + 2), 16) / 255), r = Math.max(t, i, o), a = Math.min(t, i, o), l = r - a;
|
|
12
|
+
let n = 0;
|
|
13
|
+
return l > 0 && (r === t ? n = 60 * ((i - o) / l % 6) : r === i ? n = 60 * ((o - t) / l + 2) : n = 60 * ((t - i) / l + 4)), {
|
|
14
|
+
h: n < 0 ? n + 360 : n,
|
|
15
|
+
s: r === 0 ? 0 : l / r,
|
|
16
|
+
v: r
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function L({ h: d, s: p, v: t }) {
|
|
20
|
+
const i = t * p, o = d / 60, r = i * (1 - Math.abs(o % 2 - 1)), [a, l, n] = o < 1 ? [i, r, 0] : o < 2 ? [r, i, 0] : o < 3 ? [0, i, r] : o < 4 ? [0, r, i] : o < 5 ? [r, 0, i] : [i, 0, r], h = t - i, c = (m) => Math.round((m + h) * 255).toString(16).padStart(2, "0");
|
|
21
|
+
return `#${c(a)}${c(l)}${c(n)}`;
|
|
22
|
+
}
|
|
23
|
+
function S({ value: d, onChange: p, labels: t, presets: i = [], disabled: o = !1 }) {
|
|
24
|
+
const r = /^#[0-9a-f]{6}$/i.test(d) ? d.toLowerCase() : "#000000", a = N(() => D(r), [r]), [l, n] = k(r.toUpperCase()), h = C(null);
|
|
25
|
+
y(() => n(r.toUpperCase()), [r]);
|
|
26
|
+
const c = (e) => p(L({ h: (e.h + 360) % 360, s: b(e.s), v: b(e.v) })), m = (e) => {
|
|
27
|
+
const u = h.current;
|
|
28
|
+
if (!u) return;
|
|
29
|
+
const g = u.getBoundingClientRect();
|
|
30
|
+
c({ h: a.h, s: b((e.clientX - g.left) / g.width), v: 1 - b((e.clientY - g.top) / g.height) });
|
|
31
|
+
}, v = () => {
|
|
32
|
+
/^#[0-9a-f]{6}$/i.test(l) ? p(l.toLowerCase()) : n(r.toUpperCase());
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ s(
|
|
35
|
+
z,
|
|
36
|
+
{
|
|
37
|
+
title: t.dialog,
|
|
38
|
+
closeLabel: t.close,
|
|
39
|
+
trigger: /* @__PURE__ */ f(
|
|
40
|
+
$,
|
|
41
|
+
{
|
|
42
|
+
"data-color-picker-trigger": "true",
|
|
43
|
+
variant: "secondary",
|
|
44
|
+
disabled: o,
|
|
45
|
+
"aria-label": t.trigger,
|
|
46
|
+
className: "w-full min-w-0 justify-between px-2.5",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ f("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
49
|
+
/* @__PURE__ */ s("span", { className: "size-5 shrink-0 rounded-full border border-border shadow-subtle", style: { backgroundColor: r }, "aria-hidden": !0 }),
|
|
50
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 text-left text-caption text-graphite", children: t.trigger })
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ s("span", { className: "shrink-0 font-data text-data tabular-nums text-ink", children: r.toUpperCase() })
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
children: /* @__PURE__ */ f("div", { className: "grid min-w-0 gap-3 pt-5", children: [
|
|
57
|
+
/* @__PURE__ */ s(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
ref: h,
|
|
61
|
+
role: "slider",
|
|
62
|
+
tabIndex: 0,
|
|
63
|
+
"aria-label": t.saturation,
|
|
64
|
+
"aria-valuemin": 0,
|
|
65
|
+
"aria-valuemax": 100,
|
|
66
|
+
"aria-valuenow": Math.round(a.s * a.v * 100),
|
|
67
|
+
className: "relative h-40 touch-none cursor-crosshair overflow-hidden rounded-control border border-border outline-none focus-visible:ring-2 focus-visible:ring-rust/35",
|
|
68
|
+
style: { backgroundImage: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${a.h} 100% 50%))` },
|
|
69
|
+
onPointerDown: (e) => {
|
|
70
|
+
e.currentTarget.setPointerCapture(e.pointerId), m(e);
|
|
71
|
+
},
|
|
72
|
+
onPointerMove: (e) => {
|
|
73
|
+
e.currentTarget.hasPointerCapture(e.pointerId) && m(e);
|
|
74
|
+
},
|
|
75
|
+
onKeyDown: (e) => {
|
|
76
|
+
const u = e.shiftKey ? 0.1 : 0.02;
|
|
77
|
+
if (e.key === "ArrowLeft") c({ ...a, s: a.s - u });
|
|
78
|
+
else if (e.key === "ArrowRight") c({ ...a, s: a.s + u });
|
|
79
|
+
else if (e.key === "ArrowUp") c({ ...a, v: a.v + u });
|
|
80
|
+
else if (e.key === "ArrowDown") c({ ...a, v: a.v - u });
|
|
81
|
+
else return;
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ s(
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
className: "pointer-events-none absolute size-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-pure-white shadow-pop",
|
|
88
|
+
style: { left: `${a.s * 100}%`, top: `${(1 - a.v) * 100}%`, backgroundColor: r },
|
|
89
|
+
"aria-hidden": !0
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ f("label", { className: "grid gap-1.5", children: [
|
|
95
|
+
/* @__PURE__ */ s("span", { className: "font-product text-micro font-[600] text-graphite", children: t.hue }),
|
|
96
|
+
/* @__PURE__ */ s(
|
|
97
|
+
"input",
|
|
98
|
+
{
|
|
99
|
+
type: "range",
|
|
100
|
+
min: 0,
|
|
101
|
+
max: 359,
|
|
102
|
+
value: Math.round(a.h),
|
|
103
|
+
"aria-label": t.hue,
|
|
104
|
+
onChange: (e) => c({ ...a, h: Number(e.target.value) }),
|
|
105
|
+
className: "af-color-picker-hue h-3 w-full cursor-pointer appearance-none rounded-full outline-none focus-visible:ring-2 focus-visible:ring-rust/35"
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ f("label", { className: "grid gap-1.5", children: [
|
|
110
|
+
/* @__PURE__ */ s("span", { className: "font-product text-micro font-[600] text-graphite", children: t.hex }),
|
|
111
|
+
/* @__PURE__ */ f("span", { className: "grid grid-cols-[auto_minmax(0,1fr)] items-center overflow-hidden rounded-control border border-border bg-pure-white has-[input:focus-visible]:border-rust has-[input:focus-visible]:ring-2 has-[input:focus-visible]:ring-rust/20", children: [
|
|
112
|
+
/* @__PURE__ */ s("span", { className: "grid size-control-default place-items-center border-r border-divider text-graphite", "aria-hidden": !0, children: /* @__PURE__ */ s(w, { size: 15 }) }),
|
|
113
|
+
/* @__PURE__ */ s(
|
|
114
|
+
M,
|
|
115
|
+
{
|
|
116
|
+
value: l,
|
|
117
|
+
"aria-label": t.hex,
|
|
118
|
+
maxLength: 7,
|
|
119
|
+
spellCheck: !1,
|
|
120
|
+
onChange: (e) => n(e.target.value.startsWith("#") ? e.target.value : `#${e.target.value}`),
|
|
121
|
+
onBlur: v,
|
|
122
|
+
onKeyDown: (e) => {
|
|
123
|
+
e.key === "Enter" && (v(), e.currentTarget.blur());
|
|
124
|
+
},
|
|
125
|
+
className: "border-0 bg-transparent font-data uppercase focus-visible:ring-0"
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] })
|
|
129
|
+
] }),
|
|
130
|
+
i.length > 0 ? /* @__PURE__ */ f("div", { className: "grid gap-1.5", children: [
|
|
131
|
+
/* @__PURE__ */ s("span", { className: "font-product text-micro font-[600] text-graphite", children: t.presets }),
|
|
132
|
+
/* @__PURE__ */ s("div", { className: "flex flex-wrap gap-2", role: "group", "aria-label": t.presets, children: i.map((e) => {
|
|
133
|
+
const u = e.toLowerCase() === r;
|
|
134
|
+
return /* @__PURE__ */ s(
|
|
135
|
+
"button",
|
|
136
|
+
{
|
|
137
|
+
type: "button",
|
|
138
|
+
"aria-label": `${t.presets}: ${e}`,
|
|
139
|
+
"aria-pressed": u,
|
|
140
|
+
onClick: () => p(e.toLowerCase()),
|
|
141
|
+
className: "grid size-8 place-items-center rounded-full border-2 border-surface-raised outline-none ring-1 ring-border transition-transform hover:scale-110 focus-visible:ring-2 focus-visible:ring-rust aria-pressed:ring-2 aria-pressed:ring-ink",
|
|
142
|
+
style: { backgroundColor: e },
|
|
143
|
+
children: u ? /* @__PURE__ */ s(x, { size: 14, className: "text-pure-white drop-shadow-sm", strokeWidth: 3, "aria-hidden": !0 }) : null
|
|
144
|
+
},
|
|
145
|
+
e
|
|
146
|
+
);
|
|
147
|
+
}) })
|
|
148
|
+
] }) : null
|
|
149
|
+
] })
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
export {
|
|
154
|
+
S as ColorPicker
|
|
155
|
+
};
|