@uisatin/ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +67 -2
- package/chunk-2HKBZFIK.js +339 -0
- package/chunk-2HKBZFIK.js.map +1 -0
- package/chunk-2YEWSJD7.js +95 -0
- package/chunk-2YEWSJD7.js.map +1 -0
- package/chunk-3DINAQLL.js +153 -0
- package/chunk-3DINAQLL.js.map +1 -0
- package/chunk-3ERGAHKA.js +179 -0
- package/chunk-3ERGAHKA.js.map +1 -0
- package/chunk-6C7CGJX2.js +86 -0
- package/chunk-6C7CGJX2.js.map +1 -0
- package/chunk-6YXUBP27.js +474 -0
- package/chunk-6YXUBP27.js.map +1 -0
- package/chunk-72OCFAPT.js +175 -0
- package/chunk-72OCFAPT.js.map +1 -0
- package/chunk-7TXHCRAG.js +51 -0
- package/chunk-7TXHCRAG.js.map +1 -0
- package/chunk-A5XEM3GF.js +260 -0
- package/chunk-A5XEM3GF.js.map +1 -0
- package/chunk-AN2RNJLR.js +79 -0
- package/chunk-AN2RNJLR.js.map +1 -0
- package/chunk-B2K45IUR.js +36 -0
- package/chunk-B2K45IUR.js.map +1 -0
- package/chunk-B6V4VSGH.js +82 -0
- package/chunk-B6V4VSGH.js.map +1 -0
- package/chunk-BKZBWPUH.js +59 -0
- package/chunk-BKZBWPUH.js.map +1 -0
- package/chunk-BNTPPZCK.js +220 -0
- package/chunk-BNTPPZCK.js.map +1 -0
- package/chunk-BNZVTLHV.js +98 -0
- package/chunk-BNZVTLHV.js.map +1 -0
- package/chunk-CL2II6BX.js +89 -0
- package/chunk-CL2II6BX.js.map +1 -0
- package/chunk-DETGJAIC.js +147 -0
- package/chunk-DETGJAIC.js.map +1 -0
- package/chunk-DO3TBNSC.js +130 -0
- package/chunk-DO3TBNSC.js.map +1 -0
- package/chunk-ESC5JCVQ.js +90 -0
- package/chunk-ESC5JCVQ.js.map +1 -0
- package/chunk-FDKIX4DC.js +55 -0
- package/chunk-FDKIX4DC.js.map +1 -0
- package/chunk-GICKPMJU.js +239 -0
- package/chunk-GICKPMJU.js.map +1 -0
- package/chunk-GQA24FYG.js +57 -0
- package/chunk-GQA24FYG.js.map +1 -0
- package/chunk-H4NU7NPO.js +264 -0
- package/chunk-H4NU7NPO.js.map +1 -0
- package/chunk-H63FYCMY.js +11 -0
- package/chunk-H63FYCMY.js.map +1 -0
- package/chunk-HL42K2NH.js +76 -0
- package/chunk-HL42K2NH.js.map +1 -0
- package/chunk-HNQUX43Z.js +109 -0
- package/chunk-HNQUX43Z.js.map +1 -0
- package/chunk-HRKPV66B.js +32 -0
- package/chunk-HRKPV66B.js.map +1 -0
- package/chunk-J3NSDRVH.js +83 -0
- package/chunk-J3NSDRVH.js.map +1 -0
- package/chunk-JPNWHWAQ.js +151 -0
- package/chunk-JPNWHWAQ.js.map +1 -0
- package/chunk-KNUWZNFV.js +240 -0
- package/chunk-KNUWZNFV.js.map +1 -0
- package/chunk-L6NCCSIP.js +213 -0
- package/chunk-L6NCCSIP.js.map +1 -0
- package/chunk-LLHTVIM3.js +50 -0
- package/chunk-LLHTVIM3.js.map +1 -0
- package/chunk-LW3TRU5W.js +131 -0
- package/chunk-LW3TRU5W.js.map +1 -0
- package/chunk-LZMKSFCF.js +79 -0
- package/chunk-LZMKSFCF.js.map +1 -0
- package/chunk-MR3JDI7E.js +122 -0
- package/chunk-MR3JDI7E.js.map +1 -0
- package/chunk-NN6PKJWS.js +44 -0
- package/chunk-NN6PKJWS.js.map +1 -0
- package/chunk-NSRTTYQ4.js +252 -0
- package/chunk-NSRTTYQ4.js.map +1 -0
- package/chunk-O7F3CIDV.js +45 -0
- package/chunk-O7F3CIDV.js.map +1 -0
- package/chunk-P4O6TGDR.js +166 -0
- package/chunk-P4O6TGDR.js.map +1 -0
- package/chunk-PF3YBUKT.js +81 -0
- package/chunk-PF3YBUKT.js.map +1 -0
- package/chunk-PVOLDO4G.js +47 -0
- package/chunk-PVOLDO4G.js.map +1 -0
- package/chunk-QS4N4MNP.js +215 -0
- package/chunk-QS4N4MNP.js.map +1 -0
- package/chunk-QUF2IPOZ.js +98 -0
- package/chunk-QUF2IPOZ.js.map +1 -0
- package/chunk-RTJ76X5U.js +126 -0
- package/chunk-RTJ76X5U.js.map +1 -0
- package/chunk-SH6NG6VN.js +40 -0
- package/chunk-SH6NG6VN.js.map +1 -0
- package/chunk-SHDFUXYV.js +195 -0
- package/chunk-SHDFUXYV.js.map +1 -0
- package/chunk-TKO44NDI.js +84 -0
- package/chunk-TKO44NDI.js.map +1 -0
- package/chunk-TOMSU4S4.js +149 -0
- package/chunk-TOMSU4S4.js.map +1 -0
- package/chunk-TVLGZGYN.js +59 -0
- package/chunk-TVLGZGYN.js.map +1 -0
- package/chunk-TX3H3QMA.js +520 -0
- package/chunk-TX3H3QMA.js.map +1 -0
- package/chunk-UBNHSZSE.js +88 -0
- package/chunk-UBNHSZSE.js.map +1 -0
- package/chunk-UC3ZJWOD.js +73 -0
- package/chunk-UC3ZJWOD.js.map +1 -0
- package/chunk-UGRSWP6U.js +69 -0
- package/chunk-UGRSWP6U.js.map +1 -0
- package/chunk-VAGIAREV.js +214 -0
- package/chunk-VAGIAREV.js.map +1 -0
- package/chunk-WTMZT3IT.js +105 -0
- package/chunk-WTMZT3IT.js.map +1 -0
- package/chunk-WX6BP5ZP.js +39 -0
- package/chunk-WX6BP5ZP.js.map +1 -0
- package/chunk-X3PQANZO.js +255 -0
- package/chunk-X3PQANZO.js.map +1 -0
- package/chunk-XILQ7GXE.js +66 -0
- package/chunk-XILQ7GXE.js.map +1 -0
- package/chunk-XL75JRUA.js +130 -0
- package/chunk-XL75JRUA.js.map +1 -0
- package/chunk-XZNHT6MO.js +348 -0
- package/chunk-XZNHT6MO.js.map +1 -0
- package/chunk-Y5AYU7PK.js +44 -0
- package/chunk-Y5AYU7PK.js.map +1 -0
- package/chunk-YG7JOOLJ.js +28 -0
- package/chunk-YG7JOOLJ.js.map +1 -0
- package/chunk-YPJYW624.js +195 -0
- package/chunk-YPJYW624.js.map +1 -0
- package/chunk-YPNKBE5X.js +104 -0
- package/chunk-YPNKBE5X.js.map +1 -0
- package/components/accordion.d.ts +27 -0
- package/components/accordion.js +4 -0
- package/components/accordion.js.map +1 -0
- package/components/agent-loading.d.ts +65 -0
- package/components/agent-loading.js +4 -0
- package/components/agent-loading.js.map +1 -0
- package/components/agent-picker.d.ts +82 -0
- package/components/agent-picker.js +5 -0
- package/components/agent-picker.js.map +1 -0
- package/components/agent-suggestion.d.ts +69 -0
- package/components/agent-suggestion.js +6 -0
- package/components/agent-suggestion.js.map +1 -0
- package/components/announcement-bar.d.ts +39 -0
- package/components/announcement-bar.js +6 -0
- package/components/announcement-bar.js.map +1 -0
- package/components/attachment.d.ts +73 -0
- package/components/attachment.js +5 -0
- package/components/attachment.js.map +1 -0
- package/components/avatar.d.ts +34 -0
- package/components/avatar.js +6 -0
- package/components/avatar.js.map +1 -0
- package/components/badge.d.ts +19 -0
- package/components/badge.js +4 -0
- package/components/badge.js.map +1 -0
- package/components/banner.d.ts +54 -0
- package/components/banner.js +5 -0
- package/components/banner.js.map +1 -0
- package/components/bar-chart.d.ts +32 -0
- package/components/bar-chart.js +11 -0
- package/components/bar-chart.js.map +1 -0
- package/components/breadcrumb.d.ts +32 -0
- package/components/breadcrumb.js +6 -0
- package/components/breadcrumb.js.map +1 -0
- package/components/button.d.ts +32 -0
- package/components/button.js +4 -0
- package/components/button.js.map +1 -0
- package/components/card.d.ts +28 -0
- package/components/card.js +5 -0
- package/components/card.js.map +1 -0
- package/components/channel-chart.d.ts +14 -0
- package/components/channel-chart.js +11 -0
- package/components/channel-chart.js.map +1 -0
- package/components/chart.d.ts +88 -0
- package/components/chart.js +10 -0
- package/components/chart.js.map +1 -0
- package/components/checkbox.d.ts +17 -0
- package/components/checkbox.js +4 -0
- package/components/checkbox.js.map +1 -0
- package/components/chip.d.ts +54 -0
- package/components/chip.js +4 -0
- package/components/chip.js.map +1 -0
- package/components/citations.d.ts +37 -0
- package/components/citations.js +5 -0
- package/components/citations.js.map +1 -0
- package/components/code-block.d.ts +13 -0
- package/components/code-block.js +5 -0
- package/components/code-block.js.map +1 -0
- package/components/combobox.d.ts +58 -0
- package/components/combobox.js +10 -0
- package/components/combobox.js.map +1 -0
- package/components/command-menu.d.ts +54 -0
- package/components/command-menu.js +6 -0
- package/components/command-menu.js.map +1 -0
- package/components/context-menu.d.ts +46 -0
- package/components/context-menu.js +6 -0
- package/components/context-menu.js.map +1 -0
- package/components/cookie-consent.d.ts +26 -0
- package/components/cookie-consent.js +5 -0
- package/components/cookie-consent.js.map +1 -0
- package/components/date-picker.d.ts +112 -0
- package/components/date-picker.js +9 -0
- package/components/date-picker.js.map +1 -0
- package/components/decision-card.d.ts +65 -0
- package/components/decision-card.js +7 -0
- package/components/decision-card.js.map +1 -0
- package/components/dialog.d.ts +68 -0
- package/components/dialog.js +5 -0
- package/components/dialog.js.map +1 -0
- package/components/donut-chart.d.ts +20 -0
- package/components/donut-chart.js +11 -0
- package/components/donut-chart.js.map +1 -0
- package/components/dot.d.ts +21 -0
- package/components/dot.js +4 -0
- package/components/dot.js.map +1 -0
- package/components/dropdown.d.ts +74 -0
- package/components/dropdown.js +5 -0
- package/components/dropdown.js.map +1 -0
- package/components/empty-state.d.ts +25 -0
- package/components/empty-state.js +4 -0
- package/components/empty-state.js.map +1 -0
- package/components/file-upload.d.ts +78 -0
- package/components/file-upload.js +7 -0
- package/components/file-upload.js.map +1 -0
- package/components/floating.d.ts +30 -0
- package/components/floating.js +3 -0
- package/components/floating.js.map +1 -0
- package/components/form-field.d.ts +35 -0
- package/components/form-field.js +4 -0
- package/components/form-field.js.map +1 -0
- package/components/hover-card.d.ts +30 -0
- package/components/hover-card.js +4 -0
- package/components/hover-card.js.map +1 -0
- package/components/input-otp.d.ts +49 -0
- package/components/input-otp.js +8 -0
- package/components/input-otp.js.map +1 -0
- package/components/input.d.ts +28 -0
- package/components/input.js +5 -0
- package/components/input.js.map +1 -0
- package/components/kbd.d.ts +37 -0
- package/components/kbd.js +4 -0
- package/components/kbd.js.map +1 -0
- package/components/line-chart.d.ts +29 -0
- package/components/line-chart.js +12 -0
- package/components/line-chart.js.map +1 -0
- package/components/message-actions.d.ts +24 -0
- package/components/message-actions.js +5 -0
- package/components/message-actions.js.map +1 -0
- package/components/message.d.ts +40 -0
- package/components/message.js +8 -0
- package/components/message.js.map +1 -0
- package/components/number-input.d.ts +33 -0
- package/components/number-input.js +8 -0
- package/components/number-input.js.map +1 -0
- package/components/pagination.d.ts +45 -0
- package/components/pagination.js +6 -0
- package/components/pagination.js.map +1 -0
- package/components/popover.d.ts +44 -0
- package/components/popover.js +4 -0
- package/components/popover.js.map +1 -0
- package/components/progress.d.ts +24 -0
- package/components/progress.js +4 -0
- package/components/progress.js.map +1 -0
- package/components/prompt-bar.d.ts +63 -0
- package/components/prompt-bar.js +6 -0
- package/components/prompt-bar.js.map +1 -0
- package/components/radio.d.ts +27 -0
- package/components/radio.js +4 -0
- package/components/radio.js.map +1 -0
- package/components/search-bar.d.ts +20 -0
- package/components/search-bar.js +5 -0
- package/components/search-bar.js.map +1 -0
- package/components/segmented-control.d.ts +32 -0
- package/components/segmented-control.js +5 -0
- package/components/segmented-control.js.map +1 -0
- package/components/select.d.ts +97 -0
- package/components/select.js +7 -0
- package/components/select.js.map +1 -0
- package/components/sheet.d.ts +37 -0
- package/components/sheet.js +6 -0
- package/components/sheet.js.map +1 -0
- package/components/sidebar.d.ts +52 -0
- package/components/sidebar.js +4 -0
- package/components/sidebar.js.map +1 -0
- package/components/skeleton.d.ts +18 -0
- package/components/skeleton.js +4 -0
- package/components/skeleton.js.map +1 -0
- package/components/slider.d.ts +57 -0
- package/components/slider.js +8 -0
- package/components/slider.js.map +1 -0
- package/components/sliding-indicator.d.ts +23 -0
- package/components/sliding-indicator.js +3 -0
- package/components/sliding-indicator.js.map +1 -0
- package/components/streaming-text.d.ts +33 -0
- package/components/streaming-text.js +4 -0
- package/components/streaming-text.js.map +1 -0
- package/components/switch.d.ts +15 -0
- package/components/switch.js +4 -0
- package/components/switch.js.map +1 -0
- package/components/table.d.ts +57 -0
- package/components/table.js +5 -0
- package/components/table.js.map +1 -0
- package/components/tabs.d.ts +45 -0
- package/components/tabs.js +5 -0
- package/components/tabs.js.map +1 -0
- package/components/textarea.d.ts +30 -0
- package/components/textarea.js +5 -0
- package/components/textarea.js.map +1 -0
- package/components/thinking.d.ts +64 -0
- package/components/thinking.js +5 -0
- package/components/thinking.js.map +1 -0
- package/components/toast.d.ts +71 -0
- package/components/toast.js +5 -0
- package/components/toast.js.map +1 -0
- package/components/toggle.d.ts +30 -0
- package/components/toggle.js +4 -0
- package/components/toggle.js.map +1 -0
- package/components/tooltip.d.ts +35 -0
- package/components/tooltip.js +5 -0
- package/components/tooltip.js.map +1 -0
- package/index.d.ts +64 -0
- package/index.js +230 -0
- package/index.js.map +1 -0
- package/lib/utils.d.ts +3 -0
- package/lib/utils.js +3 -0
- package/lib/utils.js.map +1 -0
- package/package.json +54 -4
- package/styles.css +2 -0
- package/theme/create-theme.d.ts +44 -0
- package/theme/index.d.ts +1 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { Floating } from './chunk-Y5AYU7PK.js';
|
|
2
|
+
import { Select } from './chunk-72OCFAPT.js';
|
|
3
|
+
import { Badge } from './chunk-O7F3CIDV.js';
|
|
4
|
+
import { cn } from './chunk-H63FYCMY.js';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var defaultFormat = (n) => n.toLocaleString("en-US");
|
|
9
|
+
function ChartCard({
|
|
10
|
+
title,
|
|
11
|
+
range,
|
|
12
|
+
total,
|
|
13
|
+
change,
|
|
14
|
+
periods,
|
|
15
|
+
value,
|
|
16
|
+
onPeriodChange,
|
|
17
|
+
className,
|
|
18
|
+
children,
|
|
19
|
+
...props
|
|
20
|
+
}) {
|
|
21
|
+
const titleId = React.useId();
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "chart-card",
|
|
26
|
+
role: "figure",
|
|
27
|
+
"aria-labelledby": titleId,
|
|
28
|
+
className: cn("@container flex flex-col gap-4 overflow-hidden rounded-2xl border border-border-default bg-bg-card p-4", className),
|
|
29
|
+
...props,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
32
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-7 items-center gap-3", children: [
|
|
33
|
+
/* @__PURE__ */ jsx("p", { id: titleId, className: "min-w-0 flex-1 truncate text-lg leading-6 font-medium text-text-default", children: title }),
|
|
34
|
+
periods && /* @__PURE__ */ jsx(PeriodSelect, { periods, value, onValueChange: onPeriodChange })
|
|
35
|
+
] }),
|
|
36
|
+
total == null && /* @__PURE__ */ jsx("p", { className: "text-sm leading-(--text-sm--line-height) text-text-muted", children: range })
|
|
37
|
+
] }),
|
|
38
|
+
total != null && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
39
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl leading-(--text-xl--line-height) font-semibold text-text-default tabular-nums", children: total }),
|
|
41
|
+
change && /* @__PURE__ */ jsx(
|
|
42
|
+
Badge,
|
|
43
|
+
{
|
|
44
|
+
tone: /^[−-]/.test(change) ? "red" : "green",
|
|
45
|
+
size: "sm",
|
|
46
|
+
className: "[box-shadow:inset_0_0_0_1px_var(--tone-border)]",
|
|
47
|
+
children: change
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }),
|
|
51
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm leading-(--text-sm--line-height) text-text-muted", children: range })
|
|
52
|
+
] }),
|
|
53
|
+
children
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function PeriodSelect({
|
|
59
|
+
periods,
|
|
60
|
+
value,
|
|
61
|
+
onValueChange
|
|
62
|
+
}) {
|
|
63
|
+
const groups = Array.isArray(periods[0]) ? periods : [periods];
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
Select,
|
|
66
|
+
{
|
|
67
|
+
size: "sm",
|
|
68
|
+
"aria-label": "Period",
|
|
69
|
+
options: groups.map((g) => ({ options: g.map((p) => ({ value: p, label: p })) })),
|
|
70
|
+
value,
|
|
71
|
+
onValueChange,
|
|
72
|
+
wrapperClassName: "w-[132px] shrink-0"
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
function ChartLegendPill({
|
|
77
|
+
color,
|
|
78
|
+
label,
|
|
79
|
+
value,
|
|
80
|
+
variant = "outline",
|
|
81
|
+
active,
|
|
82
|
+
dimmed,
|
|
83
|
+
className,
|
|
84
|
+
...props
|
|
85
|
+
}) {
|
|
86
|
+
const plain = variant === "plain";
|
|
87
|
+
return /* @__PURE__ */ jsxs(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
"data-slot": "chart-legend-pill",
|
|
91
|
+
"data-variant": variant,
|
|
92
|
+
className: cn(
|
|
93
|
+
"inline-flex h-8 items-center gap-1.5 rounded-pill text-sm leading-(--text-sm--line-height) whitespace-nowrap",
|
|
94
|
+
"transition-[border-color,background-color] duration-(--duration-fast) ease-(--ease-out)",
|
|
95
|
+
"*:transition-opacity *:duration-(--duration-fast) *:ease-(--ease-out)",
|
|
96
|
+
plain ? "px-2" : "border px-2.5",
|
|
97
|
+
!plain && (active ? "border-border-strong" : "border-border-default"),
|
|
98
|
+
plain && active && "bg-bg-hover",
|
|
99
|
+
dimmed && "*:opacity-45",
|
|
100
|
+
className
|
|
101
|
+
),
|
|
102
|
+
...props,
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "size-2 shrink-0 rounded-full", style: { background: color } }),
|
|
105
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-text-default", children: label }),
|
|
106
|
+
value != null && /* @__PURE__ */ jsx("span", { className: "font-medium text-text-default tabular-nums", children: value })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
var pointerPath = "M1.17721 0.5H13.1772L8.23721 5.62C7.65721 6.22 6.69721 6.22 6.11721 5.62L1.17721 0.5Z";
|
|
112
|
+
var tooltipShadow = "[filter:drop-shadow(0_2px_2px_var(--effect-shadow-sm))_drop-shadow(0_4px_3px_var(--effect-shadow-sm))]";
|
|
113
|
+
function TooltipPill({ label, value }) {
|
|
114
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 rounded-md bg-text-default px-2.5 py-1.5 text-sm leading-(--text-sm--line-height) whitespace-nowrap text-bg-canvas", children: [
|
|
115
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: label }),
|
|
116
|
+
/* @__PURE__ */ jsx("span", { className: "opacity-72", children: value })
|
|
117
|
+
] });
|
|
118
|
+
}
|
|
119
|
+
function ChartTooltip({
|
|
120
|
+
label,
|
|
121
|
+
value,
|
|
122
|
+
anchor,
|
|
123
|
+
sideOffset = 4,
|
|
124
|
+
className,
|
|
125
|
+
...props
|
|
126
|
+
}) {
|
|
127
|
+
if (anchor !== void 0) {
|
|
128
|
+
return /* @__PURE__ */ jsx(Floating, { anchor, side: "top", sideOffset: sideOffset + 5, className: "pointer-events-none", children: ({ side, arrowRef, arrowStyle }) => /* @__PURE__ */ jsxs("div", { "data-slot": "chart-tooltip", className: cn("relative", tooltipShadow, className), ...props, children: [
|
|
129
|
+
/* @__PURE__ */ jsx(TooltipPill, { label, value }),
|
|
130
|
+
/* @__PURE__ */ jsx(
|
|
131
|
+
"svg",
|
|
132
|
+
{
|
|
133
|
+
ref: arrowRef,
|
|
134
|
+
width: "12",
|
|
135
|
+
height: "6",
|
|
136
|
+
viewBox: "1.17 0.5 12 5.57",
|
|
137
|
+
"aria-hidden": true,
|
|
138
|
+
className: cn("absolute block text-text-default", side === "bottom" ? "bottom-full -mb-px rotate-180" : "top-full -mt-px"),
|
|
139
|
+
style: arrowStyle,
|
|
140
|
+
children: /* @__PURE__ */ jsx("path", { d: pointerPath, fill: "currentColor" })
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
] }) });
|
|
144
|
+
}
|
|
145
|
+
return /* @__PURE__ */ jsxs(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
"data-slot": "chart-tooltip",
|
|
149
|
+
className: cn("pointer-events-none flex flex-col items-center", tooltipShadow, className),
|
|
150
|
+
...props,
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ jsx(TooltipPill, { label, value }),
|
|
153
|
+
/* @__PURE__ */ jsx("svg", { width: "12", height: "6", viewBox: "1.17 0.5 12 5.57", "aria-hidden": true, className: "-mt-px block text-text-default", children: /* @__PURE__ */ jsx("path", { d: pointerPath, fill: "currentColor" }) })
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
function ChartLegendRow({
|
|
159
|
+
color,
|
|
160
|
+
label,
|
|
161
|
+
value,
|
|
162
|
+
note,
|
|
163
|
+
active,
|
|
164
|
+
dimmed,
|
|
165
|
+
className,
|
|
166
|
+
...props
|
|
167
|
+
}) {
|
|
168
|
+
return /* @__PURE__ */ jsxs(
|
|
169
|
+
"div",
|
|
170
|
+
{
|
|
171
|
+
"data-slot": "chart-legend-row",
|
|
172
|
+
className: cn(
|
|
173
|
+
"flex h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm leading-(--text-sm--line-height)",
|
|
174
|
+
// The dim fades the row's content, never its ground: on the row itself it would multiply
|
|
175
|
+
// the leaving highlight's fade-out and cut it short.
|
|
176
|
+
"transition-[background-color] duration-(--duration-fast) ease-(--ease-out)",
|
|
177
|
+
"*:transition-opacity *:duration-(--duration-fast) *:ease-(--ease-out)",
|
|
178
|
+
active && "bg-bg-muted",
|
|
179
|
+
dimmed && "*:opacity-45",
|
|
180
|
+
className
|
|
181
|
+
),
|
|
182
|
+
...props,
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "size-2 shrink-0 rounded-full", style: { background: color } }),
|
|
185
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 text-text-default", children: label }),
|
|
186
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 font-medium whitespace-nowrap text-text-default", children: value }),
|
|
187
|
+
note && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-right whitespace-nowrap text-text-muted", children: note })
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export { ChartCard, ChartLegendPill, ChartLegendRow, ChartTooltip, defaultFormat };
|
|
194
|
+
//# sourceMappingURL=chunk-YPJYW624.js.map
|
|
195
|
+
//# sourceMappingURL=chunk-YPJYW624.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chart.tsx"],"names":[],"mappings":";;;;;;;AAiDO,IAAM,aAAA,GAAgB,CAAC,CAAA,KAAc,CAAA,CAAE,eAAe,OAAO;AAY7D,SAAS,SAAA,CAAU;AAAA,EACxB,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,cAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAmE;AACjE,EAAA,MAAM,UAAgB,KAAA,CAAA,KAAA,EAAM;AAC5B,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,YAAA;AAAA,MACV,IAAA,EAAK,QAAA;AAAA,MACL,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,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,GAAG,WAAA,EAAa,IAAA,EAAK,gBAAe,CAAA,EAC5C;AAAA;AAAA;AAAA,GACF;AAEJ;AAGO,SAAS,cAAA,CAAe;AAAA,EAC7B,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAOiC;AAC/B,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,kBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,6FAAA;AAAA;AAAA;AAAA,QAGA,4EAAA;AAAA,QACA,uEAAA;AAAA,QACA,MAAA,IAAU,aAAA;AAAA,QACV,MAAA,IAAU,cAAA;AAAA,QACV;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,eAAW,IAAA,EAAC,SAAA,EAAU,gCAA+B,KAAA,EAAO,EAAE,UAAA,EAAY,KAAA,EAAM,EAAG,CAAA;AAAA,wBACzF,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,kCAAA,EAAoC,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,wBAC1D,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,0DAAA,EAA4D,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,QACjF,IAAA,oBAAQ,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,yDAAyD,QAAA,EAAA,IAAA,EAAK;AAAA;AAAA;AAAA,GACzF;AAEJ","file":"chunk-YPJYW624.js","sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../lib/utils'\nimport { Badge } from './badge'\nimport { Floating } from './floating'\nimport { Select } from './select'\n\n/**\n * The parts every chart card shares, 1:1 with the uiKit `chart/barCard` (3607:18253) and `chart/channelCard`\n * (3608:18797) frames and the parts `chart/legendRow`\n * (3602:17559) and `chart/tooltip` (3602:17522). Plain React and CSS, no chart library.\n *\n * Every card sits in ChartCard: the title and a period Select on one row, the KPI with its\n * change and the range under it, then the chart.\n *\n * The tooltip is a text/default pill with bg/canvas text, medium label + value at 72%, 10×6\n * padding, radius-md, a 12×6 pointer and a two-step sm shadow.\n */\n\nexport type ChartDatum = {\n label: string\n value: number\n /** Tooltip title; defaults to the label. */\n tooltipLabel?: string\n}\n\nexport type Periods = string[] | string[][]\n\nexport interface ChartCardBaseProps extends Omit<React.ComponentProps<'div'>, 'title'> {\n title: string\n /** The dates the card covers, under the KPI, e.g. \"Oct 26 – Nov 1, 2026 · vs previous 7 days\". */\n range: string\n data: ChartDatum[]\n /** The KPI under the title, e.g. \"€48,260\". Cards that have one default it to the formatted sum. */\n total?: string\n /** The change badge after the KPI, e.g. \"+5.2%\". A leading minus turns it red. */\n change?: string\n /** Periods for the Select in the header. Nested arrays become titled-less groups split by a rule. */\n periods?: Periods\n /** The selected period. */\n value?: string\n onPeriodChange?: (period: string) => void\n /** Formats values in the tooltip, the legend and the axis. */\n formatValue?: (value: number) => string\n /** Index of the datum shown as hovered (state sheets, docs). */\n highlight?: number\n}\n\nexport const defaultFormat = (n: number) => n.toLocaleString('en-US')\n\n/* ---------- shared parts ---------- */\n\n/**\n * The card every chart sits in (uiKit \"chart explorations\" A, 4084:3591): bg/card, 1px\n * border-default, radius-2xl, 16px in and 16 between rows. Row one: the title (16/24 medium,\n * text/default) and, when there are `periods`, a small Select for the period at the right. Row\n * two: the KPI (text/xl semibold) with its change badge, and the range under it in text/muted, 2px\n * apart; without a KPI the range sits 4px under the title. Then the chart. The card is a size\n * container, so a chart can lay itself out wider from 560px (`@min-[560px]:`).\n */\nexport function ChartCard({\n title,\n range,\n total,\n change,\n periods,\n value,\n onPeriodChange,\n className,\n children,\n ...props\n}: Omit<ChartCardBaseProps, 'data' | 'formatValue' | 'highlight'>) {\n const titleId = React.useId()\n return (\n <div\n data-slot=\"chart-card\"\n role=\"figure\"\n aria-labelledby={titleId}\n className={cn('@container flex flex-col gap-4 overflow-hidden rounded-2xl border border-border-default bg-bg-card p-4', className)}\n {...props}\n >\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex min-h-7 items-center gap-3\">\n <p id={titleId} className=\"min-w-0 flex-1 truncate text-lg leading-6 font-medium text-text-default\">\n {title}\n </p>\n {periods && <PeriodSelect periods={periods} value={value} onValueChange={onPeriodChange} />}\n </div>\n {/* Without a KPI the range sits right under the title. */}\n {total == null && <p className=\"text-sm leading-(--text-sm--line-height) text-text-muted\">{range}</p>}\n </div>\n {total != null && (\n <div className=\"flex flex-col gap-0.5\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xl leading-(--text-xl--line-height) font-semibold text-text-default tabular-nums\">{total}</span>\n {change && (\n <Badge\n tone={/^[−-]/.test(change) ? 'red' : 'green'}\n size=\"sm\"\n className=\"[box-shadow:inset_0_0_0_1px_var(--tone-border)]\"\n >\n {change}\n </Badge>\n )}\n </div>\n <p className=\"text-sm leading-(--text-sm--line-height) text-text-muted\">{range}</p>\n </div>\n )}\n {children}\n </div>\n )\n}\n\nfunction PeriodSelect({\n periods,\n value,\n onValueChange,\n}: {\n periods: Periods\n value?: string\n onValueChange?: (v: string) => void\n}) {\n const groups: string[][] = Array.isArray(periods[0]) ? (periods as string[][]) : [periods as string[]]\n return (\n <Select\n size=\"sm\"\n aria-label=\"Period\"\n options={groups.map((g) => ({ options: g.map((p) => ({ value: p, label: p })) }))}\n value={value}\n onValueChange={onValueChange}\n wrapperClassName=\"w-[132px] shrink-0\"\n />\n )\n}\n\n/**\n * chart/legendPill (4061:4182).\n * - `outline`: an outline pill with no fill — 8px swatch, label, value 6 apart, 6 / 10 in. Active\n * turns the ring border-strong.\n * - `plain` (the Donut legend): no ring and no value, 6 / 8 in; active fills bg/hover, as plain\n * controls do on hover.\n * Dimmed fades the content to 45%, never the ground.\n */\nexport function ChartLegendPill({\n color,\n label,\n value,\n variant = 'outline',\n active,\n dimmed,\n className,\n ...props\n}: {\n color: string\n label: React.ReactNode\n value?: React.ReactNode\n variant?: 'outline' | 'plain'\n active?: boolean\n dimmed?: boolean\n} & React.ComponentProps<'div'>) {\n const plain = variant === 'plain'\n return (\n <div\n data-slot=\"chart-legend-pill\"\n data-variant={variant}\n className={cn(\n 'inline-flex h-8 items-center gap-1.5 rounded-pill text-sm leading-(--text-sm--line-height) whitespace-nowrap',\n 'transition-[border-color,background-color] duration-(--duration-fast) ease-(--ease-out)',\n '*:transition-opacity *:duration-(--duration-fast) *:ease-(--ease-out)',\n plain ? 'px-2' : 'border px-2.5',\n !plain && (active ? 'border-border-strong' : 'border-border-default'),\n plain && active && 'bg-bg-hover',\n dimmed && '*:opacity-45',\n className,\n )}\n {...props}\n >\n <span aria-hidden className=\"size-2 shrink-0 rounded-full\" style={{ background: color }} />\n <span className=\"min-w-0 truncate text-text-default\">{label}</span>\n {value != null && <span className=\"font-medium text-text-default tabular-nums\">{value}</span>}\n </div>\n )\n}\n\nconst pointerPath = 'M1.17721 0.5H13.1772L8.23721 5.62C7.65721 6.22 6.69721 6.22 6.11721 5.62L1.17721 0.5Z'\nconst tooltipShadow = '[filter:drop-shadow(0_2px_2px_var(--effect-shadow-sm))_drop-shadow(0_4px_3px_var(--effect-shadow-sm))]'\n\nfunction TooltipPill({ label, value }: { label: React.ReactNode; value: React.ReactNode }) {\n return (\n <div className=\"flex items-center gap-1.5 rounded-md bg-text-default px-2.5 py-1.5 text-sm leading-(--text-sm--line-height) whitespace-nowrap text-bg-canvas\">\n <span className=\"font-medium\">{label}</span>\n <span className=\"opacity-72\">{value}</span>\n </div>\n )\n}\n\n/**\n * The chart tooltip pill with its pointer. Exported for custom charts.\n * With `anchor` it floats over the page (see Floating): it never gets cut off by the card,\n * flips below when there's no room above, slides in from the screen edge, and its pointer\n * keeps pointing at the anchor. Without it, it renders in place.\n */\nexport function ChartTooltip({\n label,\n value,\n anchor,\n sideOffset = 4,\n className,\n ...props\n}: {\n label: React.ReactNode\n value: React.ReactNode\n /** The element it points at. */\n anchor?: Element | null\n /** Gap between the anchor and the pointer's tip. */\n sideOffset?: number\n} & React.ComponentProps<'div'>) {\n if (anchor !== undefined) {\n // The pointer is 6 high and overlaps the pill by 1px.\n return (\n <Floating anchor={anchor} side=\"top\" sideOffset={sideOffset + 5} className=\"pointer-events-none\">\n {({ side, arrowRef, arrowStyle }) => (\n <div data-slot=\"chart-tooltip\" className={cn('relative', tooltipShadow, className)} {...props}>\n <TooltipPill label={label} value={value} />\n <svg\n ref={arrowRef as React.Ref<SVGSVGElement>}\n width=\"12\"\n height=\"6\"\n viewBox=\"1.17 0.5 12 5.57\"\n aria-hidden\n className={cn('absolute block text-text-default', side === 'bottom' ? 'bottom-full -mb-px rotate-180' : 'top-full -mt-px')}\n style={arrowStyle}\n >\n <path d={pointerPath} fill=\"currentColor\" />\n </svg>\n </div>\n )}\n </Floating>\n )\n }\n return (\n <div\n data-slot=\"chart-tooltip\"\n className={cn('pointer-events-none flex flex-col items-center', tooltipShadow, className)}\n {...props}\n >\n <TooltipPill label={label} value={value} />\n <svg width=\"12\" height=\"6\" viewBox=\"1.17 0.5 12 5.57\" aria-hidden className=\"-mt-px block text-text-default\">\n <path d={pointerPath} fill=\"currentColor\" />\n </svg>\n </div>\n )\n}\n\n/** One legend row: 8px swatch, label, value and an optional note. */\nexport function ChartLegendRow({\n color,\n label,\n value,\n note,\n active,\n dimmed,\n className,\n ...props\n}: {\n color: string\n label: React.ReactNode\n value: React.ReactNode\n note?: React.ReactNode\n active?: boolean\n dimmed?: boolean\n} & React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"chart-legend-row\"\n className={cn(\n 'flex h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm leading-(--text-sm--line-height)',\n // The dim fades the row's content, never its ground: on the row itself it would multiply\n // the leaving highlight's fade-out and cut it short.\n 'transition-[background-color] duration-(--duration-fast) ease-(--ease-out)',\n '*:transition-opacity *:duration-(--duration-fast) *:ease-(--ease-out)',\n active && 'bg-bg-muted',\n dimmed && '*:opacity-45',\n className,\n )}\n {...props}\n >\n <span aria-hidden className=\"size-2 shrink-0 rounded-full\" style={{ background: color }} />\n <span className=\"min-w-0 flex-1 text-text-default\">{label}</span>\n <span className=\"shrink-0 font-medium whitespace-nowrap text-text-default\">{value}</span>\n {note && <span className=\"shrink-0 text-right whitespace-nowrap text-text-muted\">{note}</span>}\n </div>\n )\n}\n\n/** Rounds the top of the axis up to a nice number that splits into four steps. */\n"]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useFormField } from './chunk-UBNHSZSE.js';
|
|
2
|
+
import { cn } from './chunk-H63FYCMY.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function Input({
|
|
7
|
+
label,
|
|
8
|
+
hint,
|
|
9
|
+
error,
|
|
10
|
+
size = "md",
|
|
11
|
+
leadingIcon,
|
|
12
|
+
trailingIcon,
|
|
13
|
+
className,
|
|
14
|
+
wrapperClassName,
|
|
15
|
+
id,
|
|
16
|
+
disabled,
|
|
17
|
+
required,
|
|
18
|
+
value,
|
|
19
|
+
defaultValue,
|
|
20
|
+
onChange,
|
|
21
|
+
"aria-describedby": ariaDescribedBy,
|
|
22
|
+
"data-force": force,
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
25
|
+
const field = useFormField();
|
|
26
|
+
const autoId = React.useId();
|
|
27
|
+
const inputId = id ?? field?.id ?? autoId;
|
|
28
|
+
const isDisabled = disabled ?? field?.disabled ?? false;
|
|
29
|
+
const invalid = Boolean(error) || (field?.invalid ?? false);
|
|
30
|
+
const message = typeof error === "string" || React.isValidElement(error) ? error : hint;
|
|
31
|
+
const messageId = message ? `${inputId}-hint` : void 0;
|
|
32
|
+
const describedBy = [ariaDescribedBy, field?.describedBy, messageId].filter(Boolean).join(" ") || void 0;
|
|
33
|
+
const [uncontrolledFilled, setUncontrolledFilled] = React.useState(
|
|
34
|
+
defaultValue != null && String(defaultValue).length > 0
|
|
35
|
+
);
|
|
36
|
+
const filled = value != null ? String(value).length > 0 : uncontrolledFilled;
|
|
37
|
+
const inputRef = React.useRef(null);
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "input-wrapper", className: cn("grid w-full gap-2", wrapperClassName), children: [
|
|
39
|
+
label && /* @__PURE__ */ jsx(
|
|
40
|
+
"label",
|
|
41
|
+
{
|
|
42
|
+
htmlFor: inputId,
|
|
43
|
+
className: "text-sm leading-[18px] font-medium text-text-default",
|
|
44
|
+
children: label
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ jsxs(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
"data-slot": "input-field",
|
|
51
|
+
"data-size": size,
|
|
52
|
+
"data-filled": filled || void 0,
|
|
53
|
+
"data-invalid": invalid || void 0,
|
|
54
|
+
"data-disabled": isDisabled || void 0,
|
|
55
|
+
"data-force": force,
|
|
56
|
+
className: cn("satin-field", className),
|
|
57
|
+
onMouseDown: (e) => {
|
|
58
|
+
const target = e.target;
|
|
59
|
+
if (target !== inputRef.current && !isDisabled && !target.closest('button, a, [role="button"]')) {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
inputRef.current?.focus();
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
children: [
|
|
65
|
+
leadingIcon && /* @__PURE__ */ jsx("span", { className: "satin-field-icon", "aria-hidden": true, children: leadingIcon }),
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
"input",
|
|
68
|
+
{
|
|
69
|
+
ref: inputRef,
|
|
70
|
+
id: inputId,
|
|
71
|
+
"data-slot": "input",
|
|
72
|
+
className: "satin-field-input",
|
|
73
|
+
disabled: isDisabled,
|
|
74
|
+
required: required ?? field?.required,
|
|
75
|
+
"aria-invalid": invalid || void 0,
|
|
76
|
+
"aria-describedby": describedBy,
|
|
77
|
+
value,
|
|
78
|
+
defaultValue,
|
|
79
|
+
onChange: (e) => {
|
|
80
|
+
if (value == null) setUncontrolledFilled(e.target.value.length > 0);
|
|
81
|
+
onChange?.(e);
|
|
82
|
+
},
|
|
83
|
+
...props
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
trailingIcon && // Not aria-hidden: the trailing slot may hold an action, such as a clear button.
|
|
87
|
+
/* @__PURE__ */ jsx("span", { className: "satin-field-icon", children: trailingIcon })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
message && /* @__PURE__ */ jsx(
|
|
92
|
+
"p",
|
|
93
|
+
{
|
|
94
|
+
id: messageId,
|
|
95
|
+
className: cn("text-sm", typeof error === "string" || React.isValidElement(error) ? "text-action-destructive-bg" : "text-text-muted"),
|
|
96
|
+
children: message
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { Input };
|
|
103
|
+
//# sourceMappingURL=chunk-YPNKBE5X.js.map
|
|
104
|
+
//# sourceMappingURL=chunk-YPNKBE5X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/input.tsx"],"names":[],"mappings":";;;;;AAiCO,SAAS,KAAA,CAAM;AAAA,EACpB,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA,GAAO,IAAA;AAAA,EACP,WAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA,gBAAA;AAAA,EACA,EAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,kBAAA,EAAoB,eAAA;AAAA,EACpB,YAAA,EAAc,KAAA;AAAA,EACd,GAAG;AACL,CAAA,EAAe;AACb,EAAA,MAAM,QAAQ,YAAA,EAAa;AAC3B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,CAAC,CAAA;AAClE,gBAAA,QAAA,GAAW,CAAC,CAAA;AAAA,cACd,CAAA;AAAA,cACC,GAAG;AAAA;AAAA,WACN;AAAA,UACC,YAAA;AAAA,0BAEC,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,kBAAA,EACb,QAAA,EAAA,YAAA,EACH;AAAA;AAAA;AAAA,KAEJ;AAAA,IACC,OAAA,oBACC,GAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACC,EAAA,EAAI,SAAA;AAAA,QACJ,SAAA,EAAW,EAAA,CAAG,SAAA,EAAW,OAAO,KAAA,KAAU,YAAkB,KAAA,CAAA,cAAA,CAAe,KAAK,CAAA,GAAI,4BAAA,GAA+B,iBAAiB,CAAA;AAAA,QAEnI,QAAA,EAAA;AAAA;AAAA;AACH,GAAA,EAEJ,CAAA;AAEJ","file":"chunk-YPNKBE5X.js","sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../lib/utils'\nimport { useFormField } from './form-field'\n\n/**\n * Input, 1:1 with the uiKit `Input` set (820:51657): a label (medium), the field, and a hint\n * (13/19.5, muted) 8px apart. The label is 13px at every size. Three sizes: sm 28 with a 13px\n * value, md 32 and lg 36 with 14px (lg at radius-xl), fixed whatever the theme's body size; 12px side padding,\n * optional 16px leading and trailing icons 8px from the text.\n *\n * Placeholder is text/muted; a value is text/default and turns the icons from muted to\n * default (Figma's `filled`). `error` swaps the hint for the message in action/destructive/bg\n * and sets `aria-invalid`. Hover, focus and the error ring are styles/components/input.css.\n *\n * Inside a FormField, leave out `label`, `hint` and `error`: the field supplies the id,\n * description and invalid state.\n */\nexport interface InputProps extends Omit<React.ComponentProps<'input'>, 'size'> {\n label?: React.ReactNode\n hint?: React.ReactNode\n /** An error message (replaces the hint), or `true` to mark the field invalid without one. */\n error?: React.ReactNode | boolean\n size?: 'sm' | 'md' | 'lg'\n leadingIcon?: React.ReactNode\n trailingIcon?: React.ReactNode\n /** Classes for the outer wrapper (label + field + hint). `className` styles the field. */\n wrapperClassName?: string\n /** Show a state without interacting, for state sheets. */\n 'data-force'?: 'hover' | 'focus'\n}\n\nexport function Input({\n label,\n hint,\n error,\n size = 'md',\n leadingIcon,\n trailingIcon,\n className,\n wrapperClassName,\n id,\n disabled,\n required,\n value,\n defaultValue,\n onChange,\n 'aria-describedby': ariaDescribedBy,\n 'data-force': force,\n ...props\n}: InputProps) {\n const field = useFormField()\n const autoId = React.useId()\n const inputId = id ?? field?.id ?? autoId\n const isDisabled = disabled ?? field?.disabled ?? false\n const invalid = Boolean(error) || (field?.invalid ?? false)\n const message = typeof error === 'string' || React.isValidElement(error) ? error : hint\n const messageId = message ? `${inputId}-hint` : undefined\n const describedBy = [ariaDescribedBy, field?.describedBy, messageId].filter(Boolean).join(' ') || undefined\n\n // Figma's `filled`: track whether there is a value, controlled or not.\n const [uncontrolledFilled, setUncontrolledFilled] = React.useState(\n defaultValue != null && String(defaultValue).length > 0,\n )\n const filled = value != null ? String(value).length > 0 : uncontrolledFilled\n\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n return (\n <div data-slot=\"input-wrapper\" className={cn('grid w-full gap-2', wrapperClassName)}>\n {label && (\n <label\n htmlFor={inputId}\n className=\"text-sm leading-[18px] font-medium text-text-default\"\n >\n {label}\n </label>\n )}\n <div\n data-slot=\"input-field\"\n data-size={size}\n data-filled={filled || undefined}\n data-invalid={invalid || undefined}\n data-disabled={isDisabled || undefined}\n data-force={force}\n className={cn('satin-field', className)}\n // Clicking the padding or an icon focuses the input; buttons in the icon slots keep their click.\n onMouseDown={(e) => {\n const target = e.target as HTMLElement\n if (target !== inputRef.current && !isDisabled && !target.closest('button, a, [role=\"button\"]')) {\n e.preventDefault()\n inputRef.current?.focus()\n }\n }}\n >\n {leadingIcon && (\n <span className=\"satin-field-icon\" aria-hidden>\n {leadingIcon}\n </span>\n )}\n <input\n ref={inputRef}\n id={inputId}\n data-slot=\"input\"\n className=\"satin-field-input\"\n disabled={isDisabled}\n required={required ?? field?.required}\n aria-invalid={invalid || undefined}\n aria-describedby={describedBy}\n value={value}\n defaultValue={defaultValue}\n onChange={(e) => {\n if (value == null) setUncontrolledFilled(e.target.value.length > 0)\n onChange?.(e)\n }}\n {...props}\n />\n {trailingIcon && (\n // Not aria-hidden: the trailing slot may hold an action, such as a clear button.\n <span className=\"satin-field-icon\">\n {trailingIcon}\n </span>\n )}\n </div>\n {message && (\n <p\n id={messageId}\n className={cn('text-sm', typeof error === 'string' || React.isValidElement(error) ? 'text-action-destructive-bg' : 'text-text-muted')}\n >\n {message}\n </p>\n )}\n </div>\n )\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Accordion as AccordionPrimitive } from 'radix-ui';
|
|
3
|
+
/**
|
|
4
|
+
* Accordion, 1:1 with the uiKit `Accordion / Item` set (4025:3554): sections under a
|
|
5
|
+
* border/subtle rule, 4px top and bottom. The header is a 40px row, 8px in, radius-lg, with an
|
|
6
|
+
* optional 16px lead icon (text/muted), the 14px medium title and a 16px chevron, 12px apart;
|
|
7
|
+
* hover fills it bg/hover, keyboard focus adds the 2px focus ring. Open, the chevron turns up
|
|
8
|
+
* and the content follows in 14px text/muted, 4 / 8 / 12 / 8 in, lined up with the title.
|
|
9
|
+
*
|
|
10
|
+
* Built on the Radix Accordion: the header is a button with aria-expanded, Enter or Space
|
|
11
|
+
* toggles it, arrow keys move between headers. `type="single"` keeps one section open
|
|
12
|
+
* (`collapsible` lets it close too); `type="multiple"` opens any number.
|
|
13
|
+
*
|
|
14
|
+
* Opening, the header stays put and the section grows downwards to its content's height over
|
|
15
|
+
* 250 ms on the kit's ease-out, while the content settles from 98% scale (from its top edge) and
|
|
16
|
+
* 92% opacity to full; closing runs the same way back in 200 ms.
|
|
17
|
+
*/
|
|
18
|
+
export type AccordionProps = React.ComponentProps<typeof AccordionPrimitive.Root>;
|
|
19
|
+
export declare function Accordion({ className, ...props }: AccordionProps): React.JSX.Element;
|
|
20
|
+
export interface AccordionItemProps extends Omit<React.ComponentProps<typeof AccordionPrimitive.Item>, 'title'> {
|
|
21
|
+
title: React.ReactNode;
|
|
22
|
+
/** A 16px icon before the title. */
|
|
23
|
+
icon?: React.ReactNode;
|
|
24
|
+
/** Show a state without interacting, for state sheets. */
|
|
25
|
+
'data-force'?: 'hover' | 'focus';
|
|
26
|
+
}
|
|
27
|
+
export declare function AccordionItem({ title, icon, children, className, 'data-force': force, ...props }: AccordionItemProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"accordion.js"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Loading: what shows while an agent works, before there is anything to read. The mark playing,
|
|
4
|
+
* the label shimmering and the elapsed time in text/subtle, 12px apart, 4px padding (28 high),
|
|
5
|
+
* announced politely to screen readers. Once the agent is done, Thinking takes its place.
|
|
6
|
+
*
|
|
7
|
+
* The agent's loading marks, from the uiKit: the tetris mark (uiKit "tetris", 3215:81593, beside
|
|
8
|
+
* its label in thinkingHeader, 3215:81620) and the flappy bird (flappyAgent, 1215:69019).
|
|
9
|
+
*
|
|
10
|
+
* Tetris: the kit's grid of 5 × 4 dots on a 16px mark, tetrominoes falling into it a row at a
|
|
11
|
+
* time. A full row fades back to the grid and what stood on it comes down; five rounds of five
|
|
12
|
+
* pieces, each ending on an empty board. As a row clears a band of light crosses the dots (and
|
|
13
|
+
* only the dots) and runs on through the label: `glimmer="color"` is glimm.dev's prism,
|
|
14
|
+
* `neutral` a band of text/default. Plain CSS animations on transform and opacity; the
|
|
15
|
+
* keyframes are written from the script below into one <style>, put back on mount if a
|
|
16
|
+
* router dropped it, the static rules are in
|
|
17
|
+
* styles/components/agent-loading.css.
|
|
18
|
+
*
|
|
19
|
+
* Flappy: the 17 × 12 pixel bird running in place. It has one frame, so it is stacked as clipped
|
|
20
|
+
* copies of itself — the body and the wing — and the wing and the whole bird step one sprite
|
|
21
|
+
* pixel on a four-beat cycle.
|
|
22
|
+
*/
|
|
23
|
+
export type Glimmer = 'color' | 'neutral';
|
|
24
|
+
/** The tetris mark. Memoised: its 125 animated elements never re-render with their parent. */
|
|
25
|
+
export declare const TetrisMark: React.MemoExoticComponent<({ glimmer, className }: {
|
|
26
|
+
glimmer?: Glimmer;
|
|
27
|
+
className?: string;
|
|
28
|
+
}) => React.JSX.Element>;
|
|
29
|
+
/** The tetris mark at rest, every dot filled: the finished header's mark. */
|
|
30
|
+
export declare function TetrisStill({ className }: {
|
|
31
|
+
className?: string;
|
|
32
|
+
}): React.JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* The label beside the mark: a shimmer, and on top a copy of the text the band crosses after the
|
|
35
|
+
* mark, on the same loop, so the light runs from the icon on through the word.
|
|
36
|
+
*/
|
|
37
|
+
export declare function TetrisLabel({ children, glimmer, className }: {
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
glimmer?: Glimmer;
|
|
40
|
+
className?: string;
|
|
41
|
+
}): React.JSX.Element;
|
|
42
|
+
/** The label shimmer alone (a band of ink passing through muted text), for the flappy header. */
|
|
43
|
+
export declare function ShimmerLabel({ children, className }: {
|
|
44
|
+
children: React.ReactNode;
|
|
45
|
+
className?: string;
|
|
46
|
+
}): React.JSX.Element;
|
|
47
|
+
/** The flappy bird fitted into a `size` square; `run` plays the run in place. */
|
|
48
|
+
export declare function FlappySprite({ size, run, className }: {
|
|
49
|
+
size?: number;
|
|
50
|
+
run?: boolean;
|
|
51
|
+
className?: string;
|
|
52
|
+
}): React.JSX.Element;
|
|
53
|
+
/** What runs beside the label: the tetris mark, or the flappy bird. */
|
|
54
|
+
export type AgentLoadingIndicator = 'tetris' | 'flappy';
|
|
55
|
+
export interface AgentLoadingProps extends React.ComponentProps<'div'> {
|
|
56
|
+
/** The live label. */
|
|
57
|
+
label?: React.ReactNode;
|
|
58
|
+
/** Elapsed time after the label, e.g. "1.2s". */
|
|
59
|
+
time?: React.ReactNode;
|
|
60
|
+
/** The mark beside the label. */
|
|
61
|
+
indicator?: AgentLoadingIndicator;
|
|
62
|
+
/** The light that crosses the tetris mark and its label as rows clear: glimm's prism, or neutral. */
|
|
63
|
+
glimmer?: Glimmer;
|
|
64
|
+
}
|
|
65
|
+
export declare function AgentLoading({ label, time, indicator, glimmer, className, ...props }: AgentLoadingProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-loading.js"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DropdownMenu } from 'radix-ui';
|
|
3
|
+
import type { BadgeTone } from './badge';
|
|
4
|
+
/**
|
|
5
|
+
* AgentPicker, from the uiKit Agent picker docs view (3890:47473): a rounded Button with the
|
|
6
|
+
* current agent's avatar, name and a chevron, opening a menu of agents. Menu rows are 1:1
|
|
7
|
+
* with `DropdownMenu/Item` (653:19165): 8px side padding, radius-lg, medium 13/13 label and a
|
|
8
|
+
* 13px text/muted description 4px under it (`layout=stacked`, 20px avatar), or the label alone
|
|
9
|
+
* (`layout=inline`, 16px avatar) when `showDescription` is off. Hover and the selected row
|
|
10
|
+
* fill bg/selected; the selected row also shows a check in status/green, so selection never
|
|
11
|
+
* relies on colour alone. The menu is bg/popover, a border/subtle hairline, radius-xl, 4px
|
|
12
|
+
* padding, 255 wide, with the shadcn sm shadow.
|
|
13
|
+
*
|
|
14
|
+
* Built on Radix DropdownMenu (radio group semantics, arrow keys, typeahead, Escape).
|
|
15
|
+
* The avatar is a small local one on the Badge hue pairs, so this file has no dependency
|
|
16
|
+
* on a separate Avatar component.
|
|
17
|
+
*/
|
|
18
|
+
export type Agent = {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
/** One line on what the agent does. */
|
|
22
|
+
description?: string;
|
|
23
|
+
/** Two letters for the avatar; taken from the name when left out. */
|
|
24
|
+
initials?: string;
|
|
25
|
+
/** Avatar hue, same pairs as Badge. */
|
|
26
|
+
tone?: BadgeTone;
|
|
27
|
+
/** Initials on the tone, or the flappy bird painted in it. */
|
|
28
|
+
avatar?: 'initials' | 'flappy';
|
|
29
|
+
};
|
|
30
|
+
export interface AgentPickerProps {
|
|
31
|
+
agents: Agent[];
|
|
32
|
+
/** The selected agent's id. */
|
|
33
|
+
value?: string;
|
|
34
|
+
defaultValue?: string;
|
|
35
|
+
onValueChange?: (id: string) => void;
|
|
36
|
+
/** Show the one-line description under each name. Turn it off once agents are familiar. */
|
|
37
|
+
showDescription?: boolean;
|
|
38
|
+
/** Secondary under the composer, Tertiary inside dense toolbars. */
|
|
39
|
+
variant?: 'secondary' | 'tertiary';
|
|
40
|
+
/** md is the 28px trigger, xs the 24px one. */
|
|
41
|
+
size?: 'md' | 'xs';
|
|
42
|
+
/** Adds a "New agent" action under the list. */
|
|
43
|
+
onCreate?: () => void;
|
|
44
|
+
/** Label for the create action. */
|
|
45
|
+
createLabel?: string;
|
|
46
|
+
/** Shown on the trigger when nothing is selected. */
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
/** Controlled open state, e.g. to show the menu open on a docs stage. */
|
|
49
|
+
open?: boolean;
|
|
50
|
+
defaultOpen?: boolean;
|
|
51
|
+
onOpenChange?: (open: boolean) => void;
|
|
52
|
+
/** Render the menu in place instead of in a portal. */
|
|
53
|
+
disablePortal?: boolean;
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
export declare function AgentPicker({ agents, value: valueProp, defaultValue, onValueChange, showDescription, variant, size, onCreate, createLabel, placeholder, open, defaultOpen, onOpenChange, disablePortal, className, }: AgentPickerProps): React.JSX.Element;
|
|
57
|
+
export interface AgentMenuItemProps extends Omit<React.ComponentProps<typeof DropdownMenu.RadioItem>, 'value' | 'children'> {
|
|
58
|
+
agent: Agent;
|
|
59
|
+
showDescription?: boolean;
|
|
60
|
+
'data-force'?: 'hover';
|
|
61
|
+
}
|
|
62
|
+
/** One row of the menu, `DropdownMenu/Item` (653:19165). Must sit inside the picker's radio group. */
|
|
63
|
+
export declare function AgentMenuItem({ agent, showDescription, className, ...props }: AgentMenuItemProps): React.JSX.Element;
|
|
64
|
+
/**
|
|
65
|
+
* A static menu row for state sheets and docs (no menu around it): the same look as a menu
|
|
66
|
+
* item, with `state` forced to default, hover or selected.
|
|
67
|
+
*/
|
|
68
|
+
export declare function AgentPickerRow({ agent, state, showDescription, className, }: {
|
|
69
|
+
agent: Agent;
|
|
70
|
+
state?: 'default' | 'hover' | 'selected';
|
|
71
|
+
showDescription?: boolean;
|
|
72
|
+
className?: string;
|
|
73
|
+
}): React.JSX.Element;
|
|
74
|
+
/**
|
|
75
|
+
* Initials on a Badge hue pair, round. 16px uses semibold 7/8, 20px semibold 9/10, as on
|
|
76
|
+
* the uiKit Avatar (992:20199). These sizes have no type token, so they stay raw.
|
|
77
|
+
* `avatar="flappy"` draws the flappy bird instead, in the agent's tone.
|
|
78
|
+
*/
|
|
79
|
+
export declare function AgentAvatar({ agent, size }: {
|
|
80
|
+
agent: Agent;
|
|
81
|
+
size?: 16 | 20;
|
|
82
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-picker.js"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* AgentSuggestion, 1:1 with the uiKit `AgentSuggestion` set (🆕 agent suggestions, 4126:3903):
|
|
4
|
+
* something the agent has prepared and the user only approves — an email, a reply, a meeting,
|
|
5
|
+
* tasks, an insight, an edit or a CRM update.
|
|
6
|
+
*
|
|
7
|
+
* A bg/card card, border/subtle, radius-xl, shadow-sm, 12px in and 12px between its parts:
|
|
8
|
+
*
|
|
9
|
+
* - the kind row: what it is, as a neutral Large Outline Badge (white, border/default) with a 14px icon
|
|
10
|
+
* or app logo (`kind`, `icon`), and on the right who or what it concerns (`meta`: avatars, a
|
|
11
|
+
* small Badge with the source);
|
|
12
|
+
* - `title` in Label/lg (14/14 medium) and `description` in Body/lg text/muted, 8px apart;
|
|
13
|
+
* - `children`: whatever the suggestion needs (time slots, tasks, a diff, changed fields);
|
|
14
|
+
* - `actions`, right-aligned 8px apart, 4px further down: a secondary or tertiary button and the
|
|
15
|
+
* primary one that carries it out.
|
|
16
|
+
*
|
|
17
|
+
* The parts below cover the usual bodies: `AgentSuggestionQuote` (the message being answered),
|
|
18
|
+
* `AgentSuggestionMetric` (a number against a limit), `AgentSuggestionDiff` (old text → new) and
|
|
19
|
+
* `AgentSuggestionChanges` (fields from → to).
|
|
20
|
+
*/
|
|
21
|
+
export interface AgentSuggestionProps extends Omit<React.ComponentProps<'section'>, 'title'> {
|
|
22
|
+
/** What kind of suggestion: "Email suggestion", "Next steps", "CRM update". */
|
|
23
|
+
kind: React.ReactNode;
|
|
24
|
+
/** A 14px icon or app logo before the kind. */
|
|
25
|
+
icon?: React.ReactNode;
|
|
26
|
+
/** Right of the kind: avatars of the people it concerns, or a small Badge with the source. */
|
|
27
|
+
meta?: React.ReactNode;
|
|
28
|
+
title?: React.ReactNode;
|
|
29
|
+
description?: React.ReactNode;
|
|
30
|
+
/** Buttons, right-aligned: the alternative first, the primary action last. */
|
|
31
|
+
actions?: React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
export declare function AgentSuggestion({ kind, icon, meta, title, description, actions, children, className, ...props }: AgentSuggestionProps): React.JSX.Element;
|
|
34
|
+
/** The message the suggestion answers: who sent it and what they wrote, on bg/muted. */
|
|
35
|
+
export declare function AgentSuggestionQuote({ from, avatar, children, className, }: {
|
|
36
|
+
/** The sender's name. */
|
|
37
|
+
from: React.ReactNode;
|
|
38
|
+
/** A 20px Avatar. */
|
|
39
|
+
avatar?: React.ReactNode;
|
|
40
|
+
children: React.ReactNode;
|
|
41
|
+
className?: string;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
/** A number against its limit: the value in Display/sm, its unit, and a 6px bar of how much is used. */
|
|
44
|
+
export declare function AgentSuggestionMetric({ value, unit, used, max, className, }: {
|
|
45
|
+
/** As shown: "47 / 50". */
|
|
46
|
+
value: React.ReactNode;
|
|
47
|
+
unit?: React.ReactNode;
|
|
48
|
+
/** With `max`, draws the bar. */
|
|
49
|
+
used?: number;
|
|
50
|
+
max?: number;
|
|
51
|
+
className?: string;
|
|
52
|
+
}): React.JSX.Element;
|
|
53
|
+
/** Old text struck through on bg/muted, the new text in status/green below it. */
|
|
54
|
+
export declare function AgentSuggestionDiff({ before, after, className }: {
|
|
55
|
+
before: React.ReactNode;
|
|
56
|
+
after: React.ReactNode;
|
|
57
|
+
className?: string;
|
|
58
|
+
}): React.JSX.Element;
|
|
59
|
+
export interface AgentSuggestionChange {
|
|
60
|
+
field: React.ReactNode;
|
|
61
|
+
from?: React.ReactNode;
|
|
62
|
+
/** A string reads as Body/md Strong; pass a Badge for a stage or status. */
|
|
63
|
+
to: React.ReactNode;
|
|
64
|
+
}
|
|
65
|
+
/** Fields the agent will change: name, the old value struck through, an arrow and the new one. */
|
|
66
|
+
export declare function AgentSuggestionChanges({ changes, className }: {
|
|
67
|
+
changes: AgentSuggestionChange[];
|
|
68
|
+
className?: string;
|
|
69
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
'use client';export { AgentSuggestion, AgentSuggestionChanges, AgentSuggestionDiff, AgentSuggestionMetric, AgentSuggestionQuote } from '../chunk-MR3JDI7E.js';
|
|
2
|
+
import '../chunk-7TXHCRAG.js';
|
|
3
|
+
import '../chunk-O7F3CIDV.js';
|
|
4
|
+
import '../chunk-H63FYCMY.js';
|
|
5
|
+
//# sourceMappingURL=agent-suggestion.js.map
|
|
6
|
+
//# sourceMappingURL=agent-suggestion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-suggestion.js"}
|