@brightlocal/ui-components 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 +349 -0
- package/dist/accordion.cjs +1 -0
- package/dist/accordion.d.ts +32 -0
- package/dist/accordion.d.ts.map +1 -0
- package/dist/accordion.js +107 -0
- package/dist/alert-dialog.cjs +1 -0
- package/dist/alert-dialog.d.ts +15 -0
- package/dist/alert-dialog.d.ts.map +1 -0
- package/dist/alert-dialog.js +146 -0
- package/dist/alert.cjs +1 -0
- package/dist/alert.d.ts +16 -0
- package/dist/alert.d.ts.map +1 -0
- package/dist/alert.js +174 -0
- package/dist/aspect-ratio.cjs +1 -0
- package/dist/aspect-ratio.d.ts +10 -0
- package/dist/aspect-ratio.d.ts.map +1 -0
- package/dist/aspect-ratio.js +22 -0
- package/dist/avatar.cjs +1 -0
- package/dist/avatar.d.ts +11 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +46 -0
- package/dist/badge.cjs +1 -0
- package/dist/badge.d.ts +19 -0
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +50 -0
- package/dist/blocks/data-table.cjs +1 -0
- package/dist/blocks/data-table.d.ts +303 -0
- package/dist/blocks/data-table.d.ts.map +1 -0
- package/dist/blocks/data-table.js +555 -0
- package/dist/blocks/sidebar.cjs +1 -0
- package/dist/blocks/sidebar.d.ts +744 -0
- package/dist/blocks/sidebar.d.ts.map +1 -0
- package/dist/blocks/sidebar.js +839 -0
- package/dist/breadcrumb.cjs +1 -0
- package/dist/breadcrumb.d.ts +12 -0
- package/dist/breadcrumb.d.ts.map +1 -0
- package/dist/breadcrumb.js +102 -0
- package/dist/button.cjs +1 -0
- package/dist/button.d.ts +73 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +195 -0
- package/dist/calendar.cjs +1 -0
- package/dist/calendar.d.ts +28 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +191 -0
- package/dist/card.cjs +1 -0
- package/dist/card.d.ts +28 -0
- package/dist/card.d.ts.map +1 -0
- package/dist/card.js +131 -0
- package/dist/carousel.cjs +1 -0
- package/dist/carousel.d.ts +21 -0
- package/dist/carousel.d.ts.map +1 -0
- package/dist/carousel.js +185 -0
- package/dist/centred-layout.cjs +1 -0
- package/dist/centred-layout.d.ts +49 -0
- package/dist/centred-layout.d.ts.map +1 -0
- package/dist/centred-layout.js +35 -0
- package/dist/chart.cjs +10 -0
- package/dist/chart.d.ts +83 -0
- package/dist/chart.d.ts.map +1 -0
- package/dist/chart.js +254 -0
- package/dist/checkbox.cjs +1 -0
- package/dist/checkbox.d.ts +15 -0
- package/dist/checkbox.d.ts.map +1 -0
- package/dist/checkbox.js +96 -0
- package/dist/collapsible.cjs +1 -0
- package/dist/collapsible.d.ts +18 -0
- package/dist/collapsible.d.ts.map +1 -0
- package/dist/collapsible.js +58 -0
- package/dist/combobox.cjs +1 -0
- package/dist/combobox.d.ts +65 -0
- package/dist/combobox.d.ts.map +1 -0
- package/dist/combobox.js +203 -0
- package/dist/command.cjs +1 -0
- package/dist/command.d.ts +44 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/command.js +166 -0
- package/dist/context-menu.cjs +1 -0
- package/dist/context-menu.d.ts +42 -0
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/context-menu.js +226 -0
- package/dist/date-picker.cjs +1 -0
- package/dist/date-picker.d.ts +54 -0
- package/dist/date-picker.d.ts.map +1 -0
- package/dist/date-picker.js +95 -0
- package/dist/dialog.cjs +1 -0
- package/dist/dialog.d.ts +20 -0
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +130 -0
- package/dist/drawer.cjs +1 -0
- package/dist/drawer.d.ts +22 -0
- package/dist/drawer.d.ts.map +1 -0
- package/dist/drawer.js +149 -0
- package/dist/dropdown-menu.cjs +1 -0
- package/dist/dropdown-menu.d.ts +253 -0
- package/dist/dropdown-menu.d.ts.map +1 -0
- package/dist/dropdown-menu.js +325 -0
- package/dist/field.cjs +1 -0
- package/dist/field.d.ts +21 -0
- package/dist/field.d.ts.map +1 -0
- package/dist/field.js +148 -0
- package/dist/global-layout.cjs +1 -0
- package/dist/global-layout.d.ts +60 -0
- package/dist/global-layout.d.ts.map +1 -0
- package/dist/global-layout.js +87 -0
- package/dist/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +16 -0
- package/dist/hover-card.cjs +1 -0
- package/dist/hover-card.d.ts +43 -0
- package/dist/hover-card.d.ts.map +1 -0
- package/dist/hover-card.js +71 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +412 -0
- package/dist/input-base.cjs +1 -0
- package/dist/input-base.d.ts +28 -0
- package/dist/input-base.d.ts.map +1 -0
- package/dist/input-base.js +56 -0
- package/dist/input-group.cjs +1 -0
- package/dist/input-group.d.ts +26 -0
- package/dist/input-group.d.ts.map +1 -0
- package/dist/input-group.js +116 -0
- package/dist/input-otp.cjs +1 -0
- package/dist/input-otp.d.ts +45 -0
- package/dist/input-otp.d.ts.map +1 -0
- package/dist/input-otp.js +186 -0
- package/dist/input-password.cjs +1 -0
- package/dist/input-password.d.ts +38 -0
- package/dist/input-password.d.ts.map +1 -0
- package/dist/input-password.js +101 -0
- package/dist/input.cjs +1 -0
- package/dist/input.d.ts +32 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +146 -0
- package/dist/label.cjs +1 -0
- package/dist/label.d.ts +12 -0
- package/dist/label.d.ts.map +1 -0
- package/dist/label.js +34 -0
- package/dist/lib/utils.cjs +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +8 -0
- package/dist/link.cjs +1 -0
- package/dist/link.d.ts +29 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.figma.d.ts +2 -0
- package/dist/link.figma.d.ts.map +1 -0
- package/dist/link.js +71 -0
- package/dist/logo.cjs +1 -0
- package/dist/logo.d.ts +25 -0
- package/dist/logo.d.ts.map +1 -0
- package/dist/logo.js +71 -0
- package/dist/menubar.cjs +1 -0
- package/dist/menubar.d.ts +106 -0
- package/dist/menubar.d.ts.map +1 -0
- package/dist/menubar.js +270 -0
- package/dist/navigation-menu.cjs +1 -0
- package/dist/navigation-menu.d.ts +108 -0
- package/dist/navigation-menu.d.ts.map +1 -0
- package/dist/navigation-menu.js +175 -0
- package/dist/pagination.cjs +1 -0
- package/dist/pagination.d.ts +81 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +216 -0
- package/dist/popover.cjs +1 -0
- package/dist/popover.d.ts +8 -0
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +44 -0
- package/dist/progress.cjs +1 -0
- package/dist/progress.d.ts +29 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +64 -0
- package/dist/radio-group.cjs +1 -0
- package/dist/radio-group.d.ts +33 -0
- package/dist/radio-group.d.ts.map +1 -0
- package/dist/radio-group.js +193 -0
- package/dist/rating.cjs +1 -0
- package/dist/rating.d.ts +22 -0
- package/dist/rating.d.ts.map +1 -0
- package/dist/rating.js +51 -0
- package/dist/resizable.cjs +1 -0
- package/dist/resizable.d.ts +14 -0
- package/dist/resizable.d.ts.map +1 -0
- package/dist/resizable.js +46 -0
- package/dist/scroll-area.cjs +1 -0
- package/dist/scroll-area.d.ts +12 -0
- package/dist/scroll-area.d.ts.map +1 -0
- package/dist/scroll-area.js +67 -0
- package/dist/select.cjs +1 -0
- package/dist/select.d.ts +77 -0
- package/dist/select.d.ts.map +1 -0
- package/dist/select.js +259 -0
- package/dist/separator.cjs +1 -0
- package/dist/separator.d.ts +14 -0
- package/dist/separator.d.ts.map +1 -0
- package/dist/separator.js +43 -0
- package/dist/sheet.cjs +1 -0
- package/dist/sheet.d.ts +38 -0
- package/dist/sheet.d.ts.map +1 -0
- package/dist/sheet.js +190 -0
- package/dist/skeleton.cjs +1 -0
- package/dist/skeleton.d.ts +5 -0
- package/dist/skeleton.d.ts.map +1 -0
- package/dist/skeleton.js +15 -0
- package/dist/slider.cjs +1 -0
- package/dist/slider.d.ts +19 -0
- package/dist/slider.d.ts.map +1 -0
- package/dist/slider.js +69 -0
- package/dist/sonner.cjs +1 -0
- package/dist/sonner.d.ts +188 -0
- package/dist/sonner.d.ts.map +1 -0
- package/dist/sonner.js +150 -0
- package/dist/split-layout.cjs +1 -0
- package/dist/split-layout.d.ts +42 -0
- package/dist/split-layout.d.ts.map +1 -0
- package/dist/split-layout.js +108 -0
- package/dist/switch.cjs +1 -0
- package/dist/switch.d.ts +43 -0
- package/dist/switch.d.ts.map +1 -0
- package/dist/switch.figma.d.ts +2 -0
- package/dist/switch.figma.d.ts.map +1 -0
- package/dist/switch.js +110 -0
- package/dist/table.cjs +1 -0
- package/dist/table.d.ts +95 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.js +164 -0
- package/dist/tabs.cjs +1 -0
- package/dist/tabs.d.ts +29 -0
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +96 -0
- package/dist/textarea.cjs +1 -0
- package/dist/textarea.d.ts +23 -0
- package/dist/textarea.d.ts.map +1 -0
- package/dist/textarea.js +47 -0
- package/dist/toggle-group.cjs +1 -0
- package/dist/toggle-group.d.ts +25 -0
- package/dist/toggle-group.d.ts.map +1 -0
- package/dist/toggle-group.js +74 -0
- package/dist/toggle.cjs +1 -0
- package/dist/toggle.d.ts +44 -0
- package/dist/toggle.d.ts.map +1 -0
- package/dist/toggle.figma.d.ts +2 -0
- package/dist/toggle.figma.d.ts.map +1 -0
- package/dist/toggle.js +57 -0
- package/dist/tooltip.cjs +1 -0
- package/dist/tooltip.d.ts +66 -0
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +78 -0
- package/package.json +184 -0
- package/src/blocks/data-table.tsx +1166 -0
- package/src/blocks/sidebar.tsx +1830 -0
- package/src/components/.gitkeep +0 -0
- package/src/components/accordion.tsx +142 -0
- package/src/components/alert-dialog.tsx +157 -0
- package/src/components/alert.tsx +199 -0
- package/src/components/aspect-ratio.tsx +30 -0
- package/src/components/avatar.tsx +56 -0
- package/src/components/badge.tsx +72 -0
- package/src/components/breadcrumb.tsx +109 -0
- package/src/components/button.tsx +296 -0
- package/src/components/calendar.tsx +234 -0
- package/src/components/card.tsx +158 -0
- package/src/components/carousel.tsx +256 -0
- package/src/components/centred-layout.tsx +91 -0
- package/src/components/chart.tsx +456 -0
- package/src/components/checkbox.tsx +132 -0
- package/src/components/collapsible.tsx +68 -0
- package/src/components/combobox.tsx +321 -0
- package/src/components/command.tsx +220 -0
- package/src/components/context-menu.tsx +305 -0
- package/src/components/date-picker.tsx +155 -0
- package/src/components/dialog.tsx +152 -0
- package/src/components/drawer.tsx +168 -0
- package/src/components/dropdown-menu.tsx +575 -0
- package/src/components/field.tsx +155 -0
- package/src/components/global-layout.tsx +153 -0
- package/src/components/hover-card.tsx +121 -0
- package/src/components/input-base.tsx +86 -0
- package/src/components/input-group.tsx +158 -0
- package/src/components/input-otp.tsx +327 -0
- package/src/components/input-password.tsx +191 -0
- package/src/components/input.tsx +220 -0
- package/src/components/label.tsx +42 -0
- package/src/components/link.figma.tsx +71 -0
- package/src/components/link.tsx +105 -0
- package/src/components/logo.tsx +97 -0
- package/src/components/menubar.tsx +379 -0
- package/src/components/navigation-menu.tsx +324 -0
- package/src/components/pagination.tsx +368 -0
- package/src/components/popover.tsx +46 -0
- package/src/components/progress.tsx +100 -0
- package/src/components/radio-group.tsx +281 -0
- package/src/components/rating.tsx +87 -0
- package/src/components/resizable.tsx +66 -0
- package/src/components/scroll-area.tsx +72 -0
- package/src/components/select.tsx +442 -0
- package/src/components/separator.tsx +53 -0
- package/src/components/sheet.tsx +220 -0
- package/src/components/skeleton.tsx +17 -0
- package/src/components/slider.tsx +86 -0
- package/src/components/sonner.tsx +396 -0
- package/src/components/split-layout.tsx +155 -0
- package/src/components/switch.figma.tsx +115 -0
- package/src/components/switch.tsx +173 -0
- package/src/components/table.tsx +277 -0
- package/src/components/tabs.tsx +142 -0
- package/src/components/textarea.tsx +77 -0
- package/src/components/toggle-group.tsx +109 -0
- package/src/components/toggle.figma.tsx +81 -0
- package/src/components/toggle.tsx +103 -0
- package/src/components/tooltip.tsx +156 -0
- package/src/hooks/.gitkeep +0 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/index.ts +67 -0
- package/src/lib/utils.ts +6 -0
- package/src/types/external-modules.d.ts +16 -0
package/dist/chart.js
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { jsx as t, jsxs as g, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import * as C from "react";
|
|
3
|
+
import * as k from "recharts";
|
|
4
|
+
import { Area as O, AreaChart as q, Bar as z, BarChart as E, CartesianGrid as H, Cell as X, Label as Y, Legend as D, Tooltip as J, Customized as Q, LabelList as U, Line as V, LineChart as W, Pie as Z, PieChart as F, PolarAngleAxis as ee, PolarGrid as re, PolarRadiusAxis as te, Radar as ne, RadarChart as ae, RadialBar as oe, RadialBarChart as se, Rectangle as le, ReferenceLine as ce, ResponsiveContainer as ie, Sector as de, XAxis as ue, YAxis as he } from "recharts";
|
|
5
|
+
import { cn as u } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
const $ = C.createContext(null);
|
|
7
|
+
function N() {
|
|
8
|
+
const n = C.useContext($);
|
|
9
|
+
if (!n)
|
|
10
|
+
throw new Error("useChart must be used within a <ChartContainer />");
|
|
11
|
+
return n;
|
|
12
|
+
}
|
|
13
|
+
function j({
|
|
14
|
+
id: n,
|
|
15
|
+
className: a,
|
|
16
|
+
children: l,
|
|
17
|
+
config: r,
|
|
18
|
+
dataHook: s,
|
|
19
|
+
trackingEl: c,
|
|
20
|
+
trackingLabel: o,
|
|
21
|
+
...i
|
|
22
|
+
}) {
|
|
23
|
+
const d = C.useId(), f = `chart-${n || d.replace(/:/g, "")}`;
|
|
24
|
+
return /* @__PURE__ */ t($.Provider, { value: { config: r }, children: /* @__PURE__ */ g(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: u(
|
|
28
|
+
"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",
|
|
29
|
+
a
|
|
30
|
+
),
|
|
31
|
+
"data-chart": f,
|
|
32
|
+
"data-hook": s,
|
|
33
|
+
"data-slot": "chart-container",
|
|
34
|
+
"data-tracking-el": c,
|
|
35
|
+
"data-tracking-label": o,
|
|
36
|
+
...i,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ t(A, { config: r, id: f }),
|
|
39
|
+
/* @__PURE__ */ t(k.ResponsiveContainer, { children: l })
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
) });
|
|
43
|
+
}
|
|
44
|
+
j.displayName = "ChartContainer";
|
|
45
|
+
function A({ id: n, config: a }) {
|
|
46
|
+
const l = Object.entries(a).filter(
|
|
47
|
+
([, r]) => r.theme || r.color
|
|
48
|
+
);
|
|
49
|
+
return l.length ? /* @__PURE__ */ t(
|
|
50
|
+
"style",
|
|
51
|
+
{
|
|
52
|
+
dangerouslySetInnerHTML: {
|
|
53
|
+
__html: l.map(([r, s]) => {
|
|
54
|
+
const c = typeof s.color == "string" ? s.color.replace(/^hsl\((.*)\)$/, "$1") : null;
|
|
55
|
+
return c ? `
|
|
56
|
+
[data-chart=${n}] {
|
|
57
|
+
--color-${r}: ${c};
|
|
58
|
+
}
|
|
59
|
+
` : s.theme ? Object.entries(s.theme).map(
|
|
60
|
+
([o, i]) => `
|
|
61
|
+
.${o} [data-chart=${n}] {
|
|
62
|
+
--color-${r}: ${i.replace(/^hsl\((.*)\)$/, "$1")};
|
|
63
|
+
}
|
|
64
|
+
`
|
|
65
|
+
).join("") : "";
|
|
66
|
+
}).join(`
|
|
67
|
+
`)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
) : null;
|
|
71
|
+
}
|
|
72
|
+
function I({ ...n }) {
|
|
73
|
+
return /* @__PURE__ */ t(k.Tooltip, { ...n });
|
|
74
|
+
}
|
|
75
|
+
function P({
|
|
76
|
+
active: n,
|
|
77
|
+
payload: a,
|
|
78
|
+
className: l,
|
|
79
|
+
indicator: r = "dot",
|
|
80
|
+
hideLabel: s = !1,
|
|
81
|
+
hideIndicator: c = !1,
|
|
82
|
+
label: o,
|
|
83
|
+
labelFormatter: i,
|
|
84
|
+
labelClassName: d,
|
|
85
|
+
formatter: f,
|
|
86
|
+
color: w,
|
|
87
|
+
nameKey: y,
|
|
88
|
+
labelKey: x
|
|
89
|
+
}) {
|
|
90
|
+
const { config: m } = N(), _ = C.useMemo(() => {
|
|
91
|
+
if (s || !a?.length)
|
|
92
|
+
return null;
|
|
93
|
+
const [e] = a;
|
|
94
|
+
if (!e)
|
|
95
|
+
return null;
|
|
96
|
+
const b = `${x || e.dataKey || e.name || "value"}`, v = m[b], h = !x && typeof o == "string" ? m[o]?.label || o : v?.label;
|
|
97
|
+
return i ? /* @__PURE__ */ t("div", { className: u("font-medium", d), children: i(h, a) }) : h ? /* @__PURE__ */ t("div", { className: u("font-medium", d), children: h }) : null;
|
|
98
|
+
}, [
|
|
99
|
+
o,
|
|
100
|
+
i,
|
|
101
|
+
a,
|
|
102
|
+
s,
|
|
103
|
+
d,
|
|
104
|
+
m,
|
|
105
|
+
x
|
|
106
|
+
]);
|
|
107
|
+
if (!n || !a?.length)
|
|
108
|
+
return null;
|
|
109
|
+
const p = a.length === 1 && r !== "dot";
|
|
110
|
+
return /* @__PURE__ */ g(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
className: u(
|
|
114
|
+
"border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
|
|
115
|
+
l
|
|
116
|
+
),
|
|
117
|
+
"data-slot": "chart-tooltip-content",
|
|
118
|
+
children: [
|
|
119
|
+
p ? null : _,
|
|
120
|
+
/* @__PURE__ */ t("div", { className: "grid gap-1.5", children: a.map((e, b) => {
|
|
121
|
+
const v = `${y || e.name || e.dataKey || "value"}`, h = m[v], L = w || e.color || e.payload.fill || `var(--color-${v})`;
|
|
122
|
+
return /* @__PURE__ */ t(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: u(
|
|
126
|
+
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
|
|
127
|
+
r === "dot" && "items-center"
|
|
128
|
+
),
|
|
129
|
+
children: f && e?.value !== void 0 && e.name ? f(e.value, e.name, e, b, a) : /* @__PURE__ */ g(R, { children: [
|
|
130
|
+
h?.icon && !c ? /* @__PURE__ */ t(h.icon, {}) : !c && /* @__PURE__ */ t(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
className: u("shrink-0 rounded-[2px]", {
|
|
134
|
+
"h-2.5 w-2.5": r === "dot",
|
|
135
|
+
"w-1": r === "line",
|
|
136
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": r === "dashed",
|
|
137
|
+
"my-0.5": p && r === "dashed"
|
|
138
|
+
}),
|
|
139
|
+
style: {
|
|
140
|
+
backgroundColor: r === "dashed" ? "transparent" : L,
|
|
141
|
+
borderColor: L
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ g(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
className: u(
|
|
149
|
+
"flex flex-1 justify-between leading-none",
|
|
150
|
+
p ? "items-end" : "items-center"
|
|
151
|
+
),
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ g("div", { className: "grid gap-1.5", children: [
|
|
154
|
+
p ? _ : null,
|
|
155
|
+
/* @__PURE__ */ t("span", { className: "text-muted-foreground", children: h?.label || e.name })
|
|
156
|
+
] }),
|
|
157
|
+
e.value && /* @__PURE__ */ t("span", { className: "text-foreground font-mono font-medium tabular-nums", children: typeof e.value == "number" ? e.value.toLocaleString() : e.value })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
] })
|
|
162
|
+
},
|
|
163
|
+
e.dataKey
|
|
164
|
+
);
|
|
165
|
+
}) })
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
P.displayName = "ChartTooltipContent";
|
|
171
|
+
function G({ ...n }) {
|
|
172
|
+
return /* @__PURE__ */ t(k.Legend, { ...n });
|
|
173
|
+
}
|
|
174
|
+
function T({
|
|
175
|
+
className: n,
|
|
176
|
+
hideIcon: a = !1,
|
|
177
|
+
payload: l,
|
|
178
|
+
verticalAlign: r = "bottom",
|
|
179
|
+
nameKey: s
|
|
180
|
+
}) {
|
|
181
|
+
const { config: c } = N();
|
|
182
|
+
return l?.length ? /* @__PURE__ */ t(
|
|
183
|
+
"div",
|
|
184
|
+
{
|
|
185
|
+
className: u(
|
|
186
|
+
"flex items-center justify-center gap-4",
|
|
187
|
+
r === "top" ? "pb-4" : "pt-4",
|
|
188
|
+
n
|
|
189
|
+
),
|
|
190
|
+
"data-slot": "chart-legend-content",
|
|
191
|
+
children: l.map((o) => {
|
|
192
|
+
const i = `${s || o.dataKey || "value"}`, d = c[i];
|
|
193
|
+
return /* @__PURE__ */ g(
|
|
194
|
+
"div",
|
|
195
|
+
{
|
|
196
|
+
className: u(
|
|
197
|
+
"[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
|
|
198
|
+
),
|
|
199
|
+
children: [
|
|
200
|
+
d?.icon && !a ? /* @__PURE__ */ t(d.icon, {}) : /* @__PURE__ */ t(
|
|
201
|
+
"div",
|
|
202
|
+
{
|
|
203
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
204
|
+
style: {
|
|
205
|
+
backgroundColor: o.color
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
d?.label || o.value
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
o.value
|
|
213
|
+
);
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
) : null;
|
|
217
|
+
}
|
|
218
|
+
T.displayName = "ChartLegendContent";
|
|
219
|
+
export {
|
|
220
|
+
O as Area,
|
|
221
|
+
q as AreaChart,
|
|
222
|
+
z as Bar,
|
|
223
|
+
E as BarChart,
|
|
224
|
+
H as CartesianGrid,
|
|
225
|
+
X as Cell,
|
|
226
|
+
j as ChartContainer,
|
|
227
|
+
Y as ChartLabel,
|
|
228
|
+
G as ChartLegend,
|
|
229
|
+
T as ChartLegendContent,
|
|
230
|
+
A as ChartStyle,
|
|
231
|
+
I as ChartTooltip,
|
|
232
|
+
P as ChartTooltipContent,
|
|
233
|
+
D as ChartsLegend,
|
|
234
|
+
J as ChartsTooltip,
|
|
235
|
+
Q as Customized,
|
|
236
|
+
U as LabelList,
|
|
237
|
+
V as Line,
|
|
238
|
+
W as LineChart,
|
|
239
|
+
Z as Pie,
|
|
240
|
+
F as PieChart,
|
|
241
|
+
ee as PolarAngleAxis,
|
|
242
|
+
re as PolarGrid,
|
|
243
|
+
te as PolarRadiusAxis,
|
|
244
|
+
ne as Radar,
|
|
245
|
+
ae as RadarChart,
|
|
246
|
+
oe as RadialBar,
|
|
247
|
+
se as RadialBarChart,
|
|
248
|
+
le as Rectangle,
|
|
249
|
+
ce as ReferenceLine,
|
|
250
|
+
ie as ResponsiveContainer,
|
|
251
|
+
de as Sector,
|
|
252
|
+
ue as XAxis,
|
|
253
|
+
he as YAxis
|
|
254
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),w=require("react"),C=require("@radix-ui/react-checkbox"),I=require("lucide-react"),O=require("class-variance-authority"),i=require("@brightlocal/ui-components/lib/utils"),R=require("@brightlocal/ui-components/label");function m(r){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(c,e,a.get?a:{enumerable:!0,get:()=>r[e]})}}return c.default=r,Object.freeze(c)}const u=m(w),b=m(C),P=O.cva(["size-4 shrink-0 self-start","bg-background peer border border-ring dark:bg-input/30 rounded-xs transition-colors outline-none","data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary","focus-visible:border-ring focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50"]),h=u.forwardRef(({className:r,disabled:c=!1,label:e,description:a,dataHook:s,trackingEl:x,trackingLabel:f,required:n,id:p,ariaLabel:g,...k},y)=>{const j=u.useId(),o=p||j,d=`${o}-description`,v=a?d:void 0,l=t.jsx(b.Root,{ref:y,"aria-describedby":v,"aria-label":e?void 0:g,"aria-required":n?"true":void 0,className:i.cn(P(),r),"data-hook":s,"data-slot":"checkbox","data-tracking-el":x,"data-tracking-label":f,disabled:c,id:o,...k,children:t.jsx(b.Indicator,{className:"flex items-center justify-center text-current transition-none","data-slot":"checkbox-indicator",children:t.jsx(I.CheckIcon,{className:"size-3.5"})})}),N=e&&t.jsxs(R.Label,{className:i.cn("cursor-pointer self-start",c&&"cursor-not-allowed opacity-70 peer-disabled:opacity-70","mt-[1px]"),"data-hook":s?`${s}-label`:void 0,htmlFor:o,children:[e,n&&t.jsx("span",{className:"sr-only",children:" (required)"})]}),q=a&&t.jsx("div",{className:i.cn("text-muted-foreground text-sm",c&&"cursor-not-allowed"),"data-hook":s?`${s}-description`:void 0,id:d,children:a});return!a&&!e?l:t.jsxs("div",{className:"flex items-start gap-2",children:[l,t.jsxs("div",{className:"flex flex-col gap-1.5",children:[N,q]})]})});h.displayName="Checkbox";exports.Checkbox=h;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
3
|
+
export interface CheckboxProps extends Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, "disabled"> {
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
label?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
dataHook: string;
|
|
9
|
+
trackingEl?: string;
|
|
10
|
+
trackingLabel?: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
export { Checkbox };
|
|
15
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAoB9D,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,EACnD,UAAU,CACX;IACC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,QAAQ,sGA2Fb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/checkbox.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx as r, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import * as m from "react";
|
|
3
|
+
import * as h from "@radix-ui/react-checkbox";
|
|
4
|
+
import { CheckIcon as w } from "lucide-react";
|
|
5
|
+
import { cva as C } from "class-variance-authority";
|
|
6
|
+
import { cn as i } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
import { Label as j } from "@brightlocal/ui-components/label";
|
|
8
|
+
const E = C([
|
|
9
|
+
// Layout & Size
|
|
10
|
+
"size-4 shrink-0 self-start",
|
|
11
|
+
// Appearance
|
|
12
|
+
"bg-background peer border border-ring dark:bg-input/30 rounded-xs transition-colors outline-none",
|
|
13
|
+
// Checked State
|
|
14
|
+
"data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary",
|
|
15
|
+
// Focus States
|
|
16
|
+
"focus-visible:border-ring focus-visible:shadow-default",
|
|
17
|
+
// Disabled States
|
|
18
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
19
|
+
]), R = m.forwardRef(
|
|
20
|
+
({
|
|
21
|
+
className: b,
|
|
22
|
+
disabled: o = !1,
|
|
23
|
+
label: t,
|
|
24
|
+
description: a,
|
|
25
|
+
dataHook: e,
|
|
26
|
+
trackingEl: p,
|
|
27
|
+
trackingLabel: f,
|
|
28
|
+
required: d,
|
|
29
|
+
id: u,
|
|
30
|
+
ariaLabel: x,
|
|
31
|
+
...k
|
|
32
|
+
}, g) => {
|
|
33
|
+
const v = m.useId(), c = u || v, n = `${c}-description`, y = a ? n : void 0, l = /* @__PURE__ */ r(
|
|
34
|
+
h.Root,
|
|
35
|
+
{
|
|
36
|
+
ref: g,
|
|
37
|
+
"aria-describedby": y,
|
|
38
|
+
"aria-label": t ? void 0 : x,
|
|
39
|
+
"aria-required": d ? "true" : void 0,
|
|
40
|
+
className: i(E(), b),
|
|
41
|
+
"data-hook": e,
|
|
42
|
+
"data-slot": "checkbox",
|
|
43
|
+
"data-tracking-el": p,
|
|
44
|
+
"data-tracking-label": f,
|
|
45
|
+
disabled: o,
|
|
46
|
+
id: c,
|
|
47
|
+
...k,
|
|
48
|
+
children: /* @__PURE__ */ r(
|
|
49
|
+
h.Indicator,
|
|
50
|
+
{
|
|
51
|
+
className: "flex items-center justify-center text-current transition-none",
|
|
52
|
+
"data-slot": "checkbox-indicator",
|
|
53
|
+
children: /* @__PURE__ */ r(w, { className: "size-3.5" })
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
), N = t && /* @__PURE__ */ s(
|
|
58
|
+
j,
|
|
59
|
+
{
|
|
60
|
+
className: i(
|
|
61
|
+
"cursor-pointer self-start",
|
|
62
|
+
o && "cursor-not-allowed opacity-70 peer-disabled:opacity-70",
|
|
63
|
+
"mt-[1px]"
|
|
64
|
+
),
|
|
65
|
+
"data-hook": e ? `${e}-label` : void 0,
|
|
66
|
+
htmlFor: c,
|
|
67
|
+
children: [
|
|
68
|
+
t,
|
|
69
|
+
d && /* @__PURE__ */ r("span", { className: "sr-only", children: " (required)" })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
), I = a && /* @__PURE__ */ r(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
className: i(
|
|
76
|
+
"text-muted-foreground text-sm",
|
|
77
|
+
o && "cursor-not-allowed"
|
|
78
|
+
),
|
|
79
|
+
"data-hook": e ? `${e}-description` : void 0,
|
|
80
|
+
id: n,
|
|
81
|
+
children: a
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
return !a && !t ? l : /* @__PURE__ */ s("div", { className: "flex items-start gap-2", children: [
|
|
85
|
+
l,
|
|
86
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col gap-1.5", children: [
|
|
87
|
+
N,
|
|
88
|
+
I
|
|
89
|
+
] })
|
|
90
|
+
] });
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
R.displayName = "Checkbox";
|
|
94
|
+
export {
|
|
95
|
+
R as Checkbox
|
|
96
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),r=require("@radix-ui/react-collapsible");function n(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const i=n(r);function s({dataHook:e,trackingEl:l,trackingLabel:t,...a}){return o.jsx(i.Root,{"data-hook":e,"data-slot":"collapsible","data-tracking-el":l,"data-tracking-label":t,...a})}function c({dataHook:e,trackingEl:l,trackingLabel:t,...a}){return o.jsx(i.CollapsibleTrigger,{"data-hook":e,"data-slot":"collapsible-trigger","data-tracking-el":l,"data-tracking-label":t,...a})}function b({dataHook:e,trackingEl:l,trackingLabel:t,...a}){return o.jsx(i.CollapsibleContent,{"data-hook":e,"data-slot":"collapsible-content","data-tracking-el":l,"data-tracking-label":t,...a})}exports.Collapsible=s;exports.CollapsibleContent=b;exports.CollapsibleTrigger=c;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
2
|
+
declare function Collapsible({ dataHook, trackingEl, trackingLabel, ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root> & {
|
|
3
|
+
dataHook: string;
|
|
4
|
+
trackingEl?: string;
|
|
5
|
+
trackingLabel?: string;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function CollapsibleTrigger({ dataHook, trackingEl, trackingLabel, ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger> & {
|
|
8
|
+
dataHook: `${string}-collapsibleTrigger`;
|
|
9
|
+
trackingEl?: string;
|
|
10
|
+
trackingLabel?: string;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function CollapsibleContent({ dataHook, trackingEl, trackingLabel, ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent> & {
|
|
13
|
+
dataHook: `${string}-collapsibleContent`;
|
|
14
|
+
trackingEl?: string;
|
|
15
|
+
trackingLabel?: string;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
18
|
+
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../src/components/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AAEpE,iBAAS,WAAW,CAAC,EACnB,QAAQ,EACR,UAAU,EACV,aAAa,EACb,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,2CAUA;AAED,iBAAS,kBAAkB,CAAC,EAC1B,QAAQ,EACR,UAAU,EACV,aAAa,EACb,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,GAAG;IACxE,QAAQ,EAAE,GAAG,MAAM,qBAAqB,CAAC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,2CAUA;AAED,iBAAS,kBAAkB,CAAC,EAC1B,QAAQ,EACR,UAAU,EACV,aAAa,EACb,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,GAAG;IACxE,QAAQ,EAAE,GAAG,MAAM,qBAAqB,CAAC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,2CAUA;AAED,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "@radix-ui/react-collapsible";
|
|
3
|
+
function n({
|
|
4
|
+
dataHook: a,
|
|
5
|
+
trackingEl: l,
|
|
6
|
+
trackingLabel: t,
|
|
7
|
+
...o
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ e(
|
|
10
|
+
i.Root,
|
|
11
|
+
{
|
|
12
|
+
"data-hook": a,
|
|
13
|
+
"data-slot": "collapsible",
|
|
14
|
+
"data-tracking-el": l,
|
|
15
|
+
"data-tracking-label": t,
|
|
16
|
+
...o
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function s({
|
|
21
|
+
dataHook: a,
|
|
22
|
+
trackingEl: l,
|
|
23
|
+
trackingLabel: t,
|
|
24
|
+
...o
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */ e(
|
|
27
|
+
i.CollapsibleTrigger,
|
|
28
|
+
{
|
|
29
|
+
"data-hook": a,
|
|
30
|
+
"data-slot": "collapsible-trigger",
|
|
31
|
+
"data-tracking-el": l,
|
|
32
|
+
"data-tracking-label": t,
|
|
33
|
+
...o
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function c({
|
|
38
|
+
dataHook: a,
|
|
39
|
+
trackingEl: l,
|
|
40
|
+
trackingLabel: t,
|
|
41
|
+
...o
|
|
42
|
+
}) {
|
|
43
|
+
return /* @__PURE__ */ e(
|
|
44
|
+
i.CollapsibleContent,
|
|
45
|
+
{
|
|
46
|
+
"data-hook": a,
|
|
47
|
+
"data-slot": "collapsible-content",
|
|
48
|
+
"data-tracking-el": l,
|
|
49
|
+
"data-tracking-label": t,
|
|
50
|
+
...o
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
n as Collapsible,
|
|
56
|
+
c as CollapsibleContent,
|
|
57
|
+
s as CollapsibleTrigger
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),P=require("react"),m=require("lucide-react"),T=require("class-variance-authority"),b=require("@brightlocal/ui-components/lib/utils"),x=require("@brightlocal/ui-components/popover"),r=require("@brightlocal/ui-components/command");function D(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,c.get?c:{enumerable:!0,get:()=>t[n]})}}return s.default=t,Object.freeze(s)}const f=D(P);var N=(t=>(t.DEFAULT="default",t.WITH_GROUP_LABEL="withGroupLabel",t))(N||{}),k=(t=>(t.DEFAULT="default",t.LG="lg",t))(k||{});const R=T.cva(["relative flex w-full items-center justify-between gap-2","px-3 py-2","border border-border rounded-lg outline-none transition-all","bg-neutral-50 border-neutral-300","dark:bg-white/5 dark:border-white/15","text-sm font-normal font-sans text-foreground","data-[placeholder]:text-muted-foreground","focus-visible:outline-none focus-visible:border-ring dark:focus-visible:border-neutral-500 focus-visible:bg-background","focus-visible:shadow-default","data-[state=open]:border-ring","disabled:cursor-not-allowed disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0","[&_svg:not([class*='size-'])]:size-4","[&_svg:not([class*='text-'])]:text-muted-foreground"],{variants:{variant:{default:["h-9","py-2"],withGroupLabel:["h-12","py-2","flex-col","items-start"]},size:{default:[],lg:[]}},compoundVariants:[{variant:"withGroupLabel",size:"lg",className:"h-12"}],defaultVariants:{variant:"default",size:"default"}}),L=f.forwardRef(({variant:t="default",size:s="default",dataHook:n,trackingEl:c,trackingLabel:G,items:l,value:u,onValueChange:O,placeholder:h="Select an option...",groupLabel:g,label:p,description:j,disabled:z,emptyMessage:I="No results found.",searchPlaceholder:S="Search...",className:_},q)=>{const[v,w]=f.useState(!1),i=l.find(o=>o.value===u),y=f.useMemo(()=>t!=="withGroupLabel"?{"":l}:l.reduce((o,d)=>{const a=d.group||"";return o[a]||(o[a]=[]),o[a].push(d),o},{}),[l,t]),C=o=>{O?.(o===u?"":o),w(!1)};return e.jsxs("div",{className:"flex w-full flex-col gap-2","data-slot":"combobox-container",children:[p&&e.jsx("label",{className:"text-foreground text-sm leading-none font-medium","data-slot":"combobox-label",children:p}),e.jsxs(x.Popover,{open:v,onOpenChange:w,children:[e.jsx(x.PopoverTrigger,{asChild:!0,children:e.jsx("button",{ref:q,"aria-expanded":v,"aria-haspopup":"listbox","aria-label":p||h,className:b.cn(R({variant:i&&t==="withGroupLabel"?"withGroupLabel":"default",size:s}),_),"data-hook":n,"data-slot":"combobox-trigger","data-tracking-el":c||`combobox-${t}`,"data-tracking-label":G,disabled:z,type:"button",children:t==="withGroupLabel"&&i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex w-full flex-col items-start gap-0.5",children:[g&&e.jsx("span",{className:"text-muted-foreground text-xs leading-none font-normal",children:g}),e.jsx("span",{className:"text-foreground overflow-hidden text-sm leading-5 font-medium text-ellipsis whitespace-nowrap",children:i.label})]}),e.jsx(m.ChevronDownIcon,{className:"size-4 shrink-0 opacity-50"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-foreground overflow-hidden text-ellipsis whitespace-nowrap",children:i?i.label:h}),e.jsx(m.ChevronsUpDownIcon,{className:"size-4 shrink-0 opacity-50"})]})})}),e.jsx(x.PopoverContent,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:e.jsxs(r.Command,{"data-slot":"combobox-command",children:[e.jsx(r.CommandInput,{placeholder:S}),e.jsxs(r.CommandList,{children:[e.jsx(r.CommandEmpty,{children:I}),t==="withGroupLabel"&&Object.keys(y).length>1?Object.entries(y).map(([o,d])=>e.jsx(r.CommandGroup,{heading:o,children:d.map(a=>e.jsxs(r.CommandItem,{value:a.value,onSelect:C,children:[e.jsx(m.CheckIcon,{className:b.cn("mr-2 size-4",u===a.value?"opacity-100":"opacity-0")}),a.label]},a.value))},o)):e.jsx(r.CommandGroup,{children:l.map(o=>e.jsxs(r.CommandItem,{value:o.value,onSelect:C,children:[e.jsx(m.CheckIcon,{className:b.cn("mr-2 size-4",u===o.value?"opacity-100":"opacity-0")}),o.label]},o.value))})]})]})})]}),j&&e.jsx("p",{className:"text-muted-foreground text-sm leading-5 font-normal","data-slot":"combobox-description",children:j})]})});L.displayName="Combobox";exports.Combobox=L;exports.ComboboxSize=k;exports.ComboboxVariant=N;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Visual style variants for Combobox
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ComboboxVariant {
|
|
7
|
+
/** Default variant with standard combobox styling */
|
|
8
|
+
DEFAULT = "default",
|
|
9
|
+
/** Variant with group label showing category above selection */
|
|
10
|
+
WITH_GROUP_LABEL = "withGroupLabel"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Size variants for Combobox
|
|
14
|
+
*/
|
|
15
|
+
export declare enum ComboboxSize {
|
|
16
|
+
/** Standard size (36px height) */
|
|
17
|
+
DEFAULT = "default",
|
|
18
|
+
/** Large size (48px height) */
|
|
19
|
+
LG = "lg"
|
|
20
|
+
}
|
|
21
|
+
export interface ComboboxItem {
|
|
22
|
+
/** Unique value for the item */
|
|
23
|
+
value: string;
|
|
24
|
+
/** Display label for the item */
|
|
25
|
+
label: string;
|
|
26
|
+
/** Optional group/category for the item */
|
|
27
|
+
group?: string;
|
|
28
|
+
}
|
|
29
|
+
declare const comboboxTriggerVariants: (props?: ({
|
|
30
|
+
variant?: "default" | "withGroupLabel" | null | undefined;
|
|
31
|
+
size?: "default" | "lg" | null | undefined;
|
|
32
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
33
|
+
interface ComboboxProps extends VariantProps<typeof comboboxTriggerVariants> {
|
|
34
|
+
/** Data hook for automated testing (REQUIRED) */
|
|
35
|
+
dataHook: string;
|
|
36
|
+
/** Tracking element identifier for analytics */
|
|
37
|
+
trackingEl?: string;
|
|
38
|
+
/** Tracking label for analytics context */
|
|
39
|
+
trackingLabel?: string;
|
|
40
|
+
/** Array of items to display in the combobox */
|
|
41
|
+
items: ComboboxItem[];
|
|
42
|
+
/** Currently selected value */
|
|
43
|
+
value?: string;
|
|
44
|
+
/** Callback when selection changes */
|
|
45
|
+
onValueChange?: (value: string) => void;
|
|
46
|
+
/** Placeholder text when no value is selected */
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
/** Group label text (only for withGroupLabel variant) */
|
|
49
|
+
groupLabel?: string;
|
|
50
|
+
/** Label text displayed above the combobox */
|
|
51
|
+
label?: string;
|
|
52
|
+
/** Description text displayed below the combobox */
|
|
53
|
+
description?: string;
|
|
54
|
+
/** Disabled state */
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
/** Empty state message when no results found */
|
|
57
|
+
emptyMessage?: string;
|
|
58
|
+
/** Search placeholder text */
|
|
59
|
+
searchPlaceholder?: string;
|
|
60
|
+
/** Custom className for the trigger button */
|
|
61
|
+
className?: string;
|
|
62
|
+
}
|
|
63
|
+
declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLButtonElement>>;
|
|
64
|
+
export { Combobox, type ComboboxProps };
|
|
65
|
+
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAiBlE;;GAEG;AACH,oBAAY,eAAe;IACzB,qDAAqD;IACrD,OAAO,YAAY;IACnB,gEAAgE;IAChE,gBAAgB,mBAAmB;CACpC;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,kCAAkC;IAClC,OAAO,YAAY;IACnB,+BAA+B;IAC/B,EAAE,OAAO;CACV;AAED,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,uBAAuB;;;8EAuD5B,CAAC;AAEF,UAAU,aAAc,SAAQ,YAAY,CAAC,OAAO,uBAAuB,CAAC;IAC1E,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,QAAQ,yFAkLb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,CAAC"}
|