@brightlocal/ui-components 2.26.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/component-meta.json +4010 -255
- package/deprecations.json +189 -2
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +2 -2
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.js +18 -18
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +11 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +31 -28
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +4 -4
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +15 -11
- package/dist/blocks/empty-state.cjs +1 -0
- package/dist/blocks/empty-state.d.ts +172 -0
- package/dist/blocks/empty-state.d.ts.map +1 -0
- package/dist/blocks/empty-state.js +155 -0
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +124 -108
- package/dist/blocks/progress-state.cjs +1 -0
- package/dist/blocks/progress-state.d.ts +121 -0
- package/dist/blocks/progress-state.d.ts.map +1 -0
- package/dist/blocks/progress-state.js +368 -0
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +297 -296
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +44 -40
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +23 -23
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +37 -38
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +24 -2
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +57 -55
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +23 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +94 -91
- package/dist/chart-empty.cjs +1 -0
- package/dist/chart-empty.d.ts +59 -0
- package/dist/chart-empty.d.ts.map +1 -0
- package/dist/chart-empty.js +29 -0
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +6 -1
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +183 -183
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +47 -44
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +4 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +143 -141
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +74 -77
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +26 -29
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +182 -13
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +462 -314
- package/dist/description.cjs +1 -1
- package/dist/description.js +5 -5
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +20 -20
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +8 -11
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +17 -20
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +29 -25
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +58 -6
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +278 -194
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +56 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +32 -0
- package/dist/header.d.ts +13 -0
- package/dist/header.d.ts.map +1 -1
- package/dist/hooks/use-delayed-pending.cjs +1 -0
- package/dist/hooks/use-delayed-pending.d.ts +34 -0
- package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
- package/dist/hooks/use-delayed-pending.js +17 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +523 -494
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +25 -25
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +9 -9
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.js +51 -51
- package/dist/input.cjs +1 -1
- package/dist/input.js +9 -9
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +25 -28
- package/dist/lib/block-illustration.cjs +1 -0
- package/dist/lib/block-illustration.d.ts +28 -0
- package/dist/lib/block-illustration.d.ts.map +1 -0
- package/dist/lib/block-illustration.js +21 -0
- package/dist/lib/empty-canvas.cjs +1 -0
- package/dist/lib/empty-canvas.d.ts +27 -0
- package/dist/lib/empty-canvas.d.ts.map +1 -0
- package/dist/lib/empty-canvas.js +62 -0
- package/dist/lib/motion.cjs +1 -1
- package/dist/lib/motion.js +10 -8
- package/dist/lib/optical-center.cjs +1 -0
- package/dist/lib/optical-center.d.ts +12 -0
- package/dist/lib/optical-center.d.ts.map +1 -0
- package/dist/lib/optical-center.js +11 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +28 -5
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +8 -6
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +52 -20
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +87 -81
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +60 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +187 -164
- package/dist/media-empty.cjs +1 -0
- package/dist/media-empty.d.ts +72 -0
- package/dist/media-empty.d.ts.map +1 -0
- package/dist/media-empty.js +45 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +17 -20
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +7 -7
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +127 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +189 -98
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +37 -3
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +102 -64
- package/dist/route-progress.cjs +1 -0
- package/dist/route-progress.d.ts +103 -0
- package/dist/route-progress.d.ts.map +1 -0
- package/dist/route-progress.js +106 -0
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +19 -18
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +8 -8
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +35 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +103 -66
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +38 -3
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +43 -20
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +32 -36
- package/dist/spinner.cjs +1 -0
- package/dist/spinner.d.ts +57 -0
- package/dist/spinner.d.ts.map +1 -0
- package/dist/spinner.js +35 -0
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.d.ts.map +1 -1
- package/dist/stepper.js +23 -22
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +36 -29
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.d.ts +10 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +8 -8
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +8 -8
- package/dist/typography-heading.cjs +1 -0
- package/dist/typography-heading.d.ts +116 -0
- package/dist/typography-heading.d.ts.map +1 -0
- package/dist/typography-heading.js +84 -0
- package/dist/typography-text.cjs +1 -0
- package/dist/typography-text.d.ts +113 -0
- package/dist/typography-text.d.ts.map +1 -0
- package/dist/typography-text.js +81 -0
- package/dist/typography.d.ts +13 -0
- package/dist/typography.d.ts.map +1 -1
- package/package.json +42 -2
- package/src/blocks/empty-state.tsx +424 -0
- package/src/blocks/input-list.tsx +66 -36
- package/src/blocks/progress-state.tsx +542 -0
- package/src/blocks/sidebar.tsx +46 -40
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/alert.tsx +27 -13
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +8 -4
- package/src/components/breadcrumb.tsx +9 -4
- package/src/components/button.tsx +5 -8
- package/src/components/calendar.tsx +5 -6
- package/src/components/callout.tsx +48 -15
- package/src/components/card.tsx +52 -17
- package/src/components/chart-empty.tsx +116 -0
- package/src/components/chart.tsx +43 -17
- package/src/components/chip.tsx +9 -6
- package/src/components/combobox.tsx +21 -12
- package/src/components/command.tsx +9 -10
- package/src/components/context-menu.tsx +6 -9
- package/src/components/data-table.tsx +405 -31
- package/src/components/description.tsx +1 -1
- package/src/components/dialog.tsx +2 -2
- package/src/components/drawer.tsx +2 -5
- package/src/components/dropdown-menu.tsx +8 -11
- package/src/components/field.tsx +8 -4
- package/src/components/global-layout.tsx +264 -65
- package/src/components/grid.tsx +130 -0
- package/src/components/header.tsx +13 -0
- package/src/components/hover-card.tsx +1 -1
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +1 -1
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +10 -13
- package/src/components/link.tsx +39 -5
- package/src/components/list.tsx +18 -14
- package/src/components/map.tsx +101 -5
- package/src/components/media-empty.tsx +156 -0
- package/src/components/menubar.tsx +7 -10
- package/src/components/navigation-menu.tsx +1 -1
- package/src/components/pagination.tsx +279 -1
- package/src/components/progress.tsx +120 -11
- package/src/components/route-progress.tsx +354 -0
- package/src/components/select.tsx +5 -4
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +89 -7
- package/src/components/skeleton.tsx +78 -7
- package/src/components/sonner.tsx +5 -14
- package/src/components/spinner.tsx +94 -0
- package/src/components/stepper.tsx +6 -7
- package/src/components/table.tsx +11 -4
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +10 -0
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/components/tooltip.tsx +1 -1
- package/src/components/typography-heading.tsx +229 -0
- package/src/components/typography-text.tsx +225 -0
- package/src/components/typography.tsx +13 -0
- package/src/hooks/use-delayed-pending.ts +60 -0
- package/src/index.ts +12 -0
- package/src/lib/block-illustration.tsx +88 -0
- package/src/lib/empty-canvas.tsx +128 -0
- package/src/lib/optical-center.tsx +45 -0
- package/src/lib/utils.ts +26 -0
package/dist/callout.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { jsx as e, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { Slot as x } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva as f } from "class-variance-authority";
|
|
5
|
+
import { cn as p } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
const y = f("relative rounded-2xl p-12 shadow-lg", {
|
|
6
7
|
variants: {
|
|
7
8
|
variant: {
|
|
8
9
|
primary: "bg-primary text-primary-foreground",
|
|
@@ -14,56 +15,56 @@ const f = x("relative rounded-2xl p-12 shadow-lg", {
|
|
|
14
15
|
defaultVariants: {
|
|
15
16
|
variant: "primary"
|
|
16
17
|
}
|
|
17
|
-
}),
|
|
18
|
+
}), b = {
|
|
18
19
|
primary: "text-primary-foreground/80",
|
|
19
20
|
purple: "text-violet-800",
|
|
20
21
|
blue: "text-sky-900",
|
|
21
22
|
green: "text-green-900"
|
|
22
|
-
},
|
|
23
|
+
}, C = {
|
|
23
24
|
primary: "bg-primary",
|
|
24
25
|
purple: "bg-violet-300",
|
|
25
26
|
blue: "bg-sky-300",
|
|
26
27
|
green: "bg-green-200"
|
|
27
|
-
},
|
|
28
|
+
}, h = {
|
|
28
29
|
bottom: "left-1/2 -bottom-2 -translate-x-1/2",
|
|
29
30
|
top: "left-1/2 -top-2 -translate-x-1/2",
|
|
30
31
|
left: "top-1/2 -left-2 -translate-y-1/2",
|
|
31
32
|
right: "top-1/2 -right-2 -translate-y-1/2"
|
|
32
|
-
},
|
|
33
|
+
}, c = o.createContext({
|
|
33
34
|
variant: "primary"
|
|
34
|
-
}),
|
|
35
|
+
}), v = o.forwardRef(
|
|
35
36
|
({
|
|
36
|
-
className:
|
|
37
|
+
className: r,
|
|
37
38
|
variant: t = "primary",
|
|
38
39
|
pointer: a = "bottom",
|
|
39
|
-
children:
|
|
40
|
-
dataHook:
|
|
41
|
-
trackingEl:
|
|
42
|
-
trackingLabel:
|
|
43
|
-
...
|
|
44
|
-
},
|
|
45
|
-
const
|
|
46
|
-
return /* @__PURE__ */
|
|
40
|
+
children: l,
|
|
41
|
+
dataHook: n,
|
|
42
|
+
trackingEl: i,
|
|
43
|
+
trackingLabel: s,
|
|
44
|
+
...d
|
|
45
|
+
}, u) => {
|
|
46
|
+
const m = o.useMemo(() => ({ variant: t }), [t]);
|
|
47
|
+
return /* @__PURE__ */ e(c.Provider, { value: m, children: /* @__PURE__ */ g(
|
|
47
48
|
"aside",
|
|
48
49
|
{
|
|
49
|
-
ref:
|
|
50
|
-
className:
|
|
51
|
-
"data-hook":
|
|
50
|
+
ref: u,
|
|
51
|
+
className: p(y({ variant: t }), r),
|
|
52
|
+
"data-hook": n,
|
|
52
53
|
"data-slot": "callout",
|
|
53
|
-
"data-tracking-el":
|
|
54
|
-
"data-tracking-label":
|
|
54
|
+
"data-tracking-el": i || `callout-${t}`,
|
|
55
|
+
"data-tracking-label": s,
|
|
55
56
|
role: "note",
|
|
56
|
-
...
|
|
57
|
+
...d,
|
|
57
58
|
children: [
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
a !== "none" && /* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col gap-8", children: l }),
|
|
60
|
+
a !== "none" && /* @__PURE__ */ e(
|
|
60
61
|
"span",
|
|
61
62
|
{
|
|
62
63
|
"aria-hidden": "true",
|
|
63
|
-
className:
|
|
64
|
+
className: p(
|
|
64
65
|
"pointer-events-none absolute size-4 rotate-45",
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
h[a],
|
|
67
|
+
C[t]
|
|
67
68
|
),
|
|
68
69
|
"data-slot": "callout-pointer"
|
|
69
70
|
}
|
|
@@ -73,32 +74,33 @@ const f = x("relative rounded-2xl p-12 shadow-lg", {
|
|
|
73
74
|
) });
|
|
74
75
|
}
|
|
75
76
|
);
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
({ className:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
ref: r,
|
|
82
|
-
className: n("font-display text-4xl font-semibold", o),
|
|
77
|
+
v.displayName = "Callout";
|
|
78
|
+
const k = o.forwardRef(
|
|
79
|
+
({ className: r, dataHook: t, level: a, asChild: l = !1, ...n }, i) => {
|
|
80
|
+
const s = {
|
|
81
|
+
className: p("text-display", r),
|
|
83
82
|
"data-hook": t,
|
|
84
83
|
"data-slot": "callout-heading",
|
|
85
|
-
...
|
|
84
|
+
...n
|
|
85
|
+
};
|
|
86
|
+
if (l)
|
|
87
|
+
return /* @__PURE__ */ e(x, { ref: i, ...s });
|
|
88
|
+
if (a) {
|
|
89
|
+
const d = `h${a}`;
|
|
90
|
+
return /* @__PURE__ */ e(d, { ref: i, ...s });
|
|
86
91
|
}
|
|
87
|
-
|
|
92
|
+
return /* @__PURE__ */ e("div", { ref: i, ...s });
|
|
93
|
+
}
|
|
88
94
|
);
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
({ className:
|
|
92
|
-
const { variant:
|
|
93
|
-
return /* @__PURE__ */
|
|
95
|
+
k.displayName = "CalloutHeading";
|
|
96
|
+
const N = o.forwardRef(
|
|
97
|
+
({ className: r, dataHook: t, ...a }, l) => {
|
|
98
|
+
const { variant: n } = o.useContext(c);
|
|
99
|
+
return /* @__PURE__ */ e(
|
|
94
100
|
"div",
|
|
95
101
|
{
|
|
96
|
-
ref:
|
|
97
|
-
className: n
|
|
98
|
-
"text-xs font-medium",
|
|
99
|
-
y[i],
|
|
100
|
-
o
|
|
101
|
-
),
|
|
102
|
+
ref: l,
|
|
103
|
+
className: p("text-label-sm", b[n], r),
|
|
102
104
|
"data-hook": t,
|
|
103
105
|
"data-slot": "callout-citation",
|
|
104
106
|
...a
|
|
@@ -106,10 +108,10 @@ const k = e.forwardRef(
|
|
|
106
108
|
);
|
|
107
109
|
}
|
|
108
110
|
);
|
|
109
|
-
|
|
111
|
+
N.displayName = "CalloutCitation";
|
|
110
112
|
export {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
v as Callout,
|
|
114
|
+
N as CalloutCitation,
|
|
115
|
+
k as CalloutHeading,
|
|
116
|
+
y as calloutVariants
|
|
115
117
|
};
|
package/dist/card.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),V=require("react"),O=require("@radix-ui/react-slot"),m=require("class-variance-authority"),c=require("@brightlocal/ui-components/lib/utils");function S(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const s=S(V),u=s.createContext({flush:!1,density:"default"});function f(t,a){return!t&&(a==="condensed"?"px-3":"px-section-md")}const T=m.cva(["flex","flex-col","rounded-xl","transition-colors duration-fast ease-out","w-full","max-w-[400px]"],{variants:{variant:{filled:["bg-card","text-card-foreground","border","border-card-border"],transparent:["bg-transparent","text-foreground"],border:["bg-transparent","text-foreground","border","border-border"],"transparent-flush":["bg-transparent","text-foreground"]},density:{default:["gap-8","py-section-md"],condensed:["gap-3","py-3"]}},defaultVariants:{variant:"filled",density:"default"}}),x=s.forwardRef(({className:t,variant:a="filled",density:e="default",dataHook:r,trackingEl:n,trackingLabel:i,maxWidth:d,children:l,style:p,...j},w)=>{const k=a==="transparent-flush";s.useEffect(()=>{process.env.NODE_ENV!=="production"&&d!==void 0&&console.warn('Card: the "maxWidth" prop is deprecated. Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").')},[d]);const R=d!==void 0?{maxWidth:typeof d=="number"?`${d}px`:d}:void 0;return o.jsx(u.Provider,{value:{flush:k,density:e},children:o.jsx("div",{ref:w,className:c.cn(T({variant:a,density:e}),t),"data-density":e,"data-hook":r,"data-slot":"card","data-tracking-el":n||`card-${a}`,"data-tracking-label":i,style:{...R,...p},...j,children:l})})});x.displayName="Card";const D=m.cva("@container/card-header grid auto-rows-min grid-rows-[auto_auto] gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",{variants:{align:{left:"items-start",center:"justify-items-center text-center",right:"items-start text-right"}},defaultVariants:{align:"left"}}),C=s.forwardRef(({className:t,align:a="left",dataHook:e,...r},n)=>{const{flush:i,density:d}=s.useContext(u);return o.jsx("div",{ref:n,className:c.cn(D({align:a}),f(i,d),t),"data-hook":e,"data-slot":"card-header",...r})});C.displayName="CardHeader";const P=m.cva("",{variants:{size:{small:"text-heading-subsection",default:"text-heading-section"}},defaultVariants:{size:"default"}}),g=s.forwardRef(({className:t,size:a="default",level:e,asChild:r=!1,dataHook:n,...i},d)=>{const l={className:c.cn(P({size:a}),t),"data-hook":n,"data-slot":"card-title",...i};if(r)return o.jsx(O.Slot,{ref:d,...l});if(e){const p=`h${e}`;return o.jsx(p,{ref:d,...l})}return o.jsx("div",{ref:d,...l})});g.displayName="CardTitle";const h=s.forwardRef(({className:t,dataHook:a,...e},r)=>o.jsx("div",{ref:r,className:c.cn("text-body-sm text-muted-foreground",t),"data-hook":a,"data-slot":"card-description",...e}));h.displayName="CardDescription";const y=s.forwardRef(({className:t,dataHook:a,...e},r)=>o.jsx("div",{ref:r,className:c.cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),"data-hook":a,"data-slot":"card-action",...e}));y.displayName="CardAction";const b=s.forwardRef(({className:t,children:a,dataHook:e,...r},n)=>{const{flush:i,density:d}=s.useContext(u);return o.jsx("div",{ref:n,className:c.cn(f(i,d),t),"data-hook":e,"data-slot":"card-media",...r,children:o.jsx("div",{className:"overflow-hidden rounded-md","data-slot":"card-media-clip",children:a})})});b.displayName="CardMedia";const v=s.forwardRef(({className:t,dataHook:a,...e},r)=>{const{flush:n,density:i}=s.useContext(u);return o.jsx("div",{ref:r,className:c.cn(f(n,i),t),"data-hook":a,"data-slot":"card-content",...e})});v.displayName="CardContent";const N=s.forwardRef(({className:t,dataHook:a,...e},r)=>{const{flush:n,density:i}=s.useContext(u);return o.jsx("div",{ref:r,className:c.cn("flex items-center",f(n,i),t),"data-hook":a,"data-slot":"card-footer",...e})});N.displayName="CardFooter";exports.Card=x;exports.CardAction=y;exports.CardContent=v;exports.CardDescription=h;exports.CardFooter=N;exports.CardHeader=C;exports.CardMedia=b;exports.CardTitle=g;
|
package/dist/card.d.ts
CHANGED
|
@@ -87,6 +87,11 @@ declare const CardHeader: React.ForwardRefExoticComponent<Omit<CardHeaderProps,
|
|
|
87
87
|
* Size variant for the CardTitle.
|
|
88
88
|
*/
|
|
89
89
|
type CardTitleSize = "small" | "default";
|
|
90
|
+
/**
|
|
91
|
+
* Document outline level for the CardTitle — renders the corresponding
|
|
92
|
+
* h2–h6 tag. There is no level 1: a card title is never the page title.
|
|
93
|
+
*/
|
|
94
|
+
type CardTitleLevel = 2 | 3 | 4 | 5 | 6;
|
|
90
95
|
/**
|
|
91
96
|
* Props for the CardTitle component.
|
|
92
97
|
*/
|
|
@@ -96,11 +101,27 @@ type CardTitleProps = CardSubComponentProps & {
|
|
|
96
101
|
* @default "default"
|
|
97
102
|
*/
|
|
98
103
|
size?: CardTitleSize;
|
|
104
|
+
/**
|
|
105
|
+
* Document outline level — renders the title as the corresponding
|
|
106
|
+
* heading element (`h2`–`h6`). The DS never guesses a level: when
|
|
107
|
+
* omitted, the title renders as a `div` and stays out of the outline.
|
|
108
|
+
* Ignored when `asChild` is set.
|
|
109
|
+
* @example <CardTitle level={2}>Card Title</CardTitle>
|
|
110
|
+
*/
|
|
111
|
+
level?: CardTitleLevel;
|
|
112
|
+
/**
|
|
113
|
+
* Render as a different element using Radix Slot pattern.
|
|
114
|
+
* When true, merges props onto the child element so consumers can opt the
|
|
115
|
+
* title into the document outline (e.g. `<CardTitle asChild><h2>…</h2></CardTitle>`).
|
|
116
|
+
* Takes precedence over `level`.
|
|
117
|
+
* @default false
|
|
118
|
+
*/
|
|
119
|
+
asChild?: boolean;
|
|
99
120
|
};
|
|
100
121
|
/**
|
|
101
122
|
* Title element within the Card header.
|
|
102
123
|
*/
|
|
103
|
-
declare const CardTitle: React.ForwardRefExoticComponent<Omit<CardTitleProps, "ref"> & React.RefAttributes<
|
|
124
|
+
declare const CardTitle: React.ForwardRefExoticComponent<Omit<CardTitleProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
104
125
|
/**
|
|
105
126
|
* Description text within the Card header.
|
|
106
127
|
*/
|
|
@@ -122,5 +143,5 @@ declare const CardContent: React.ForwardRefExoticComponent<Omit<CardSubComponent
|
|
|
122
143
|
*/
|
|
123
144
|
declare const CardFooter: React.ForwardRefExoticComponent<Omit<CardSubComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
124
145
|
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardMedia, CardContent, };
|
|
125
|
-
export type { CardProps, CardSubComponentProps, CardHeaderProps, CardHeaderAlign, CardTitleProps, CardTitleSize, CardVariant, CardDensity, };
|
|
146
|
+
export type { CardProps, CardSubComponentProps, CardHeaderProps, CardHeaderAlign, CardTitleProps, CardTitleSize, CardTitleLevel, CardVariant, CardDensity, };
|
|
126
147
|
//# sourceMappingURL=card.d.ts.map
|
package/dist/card.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;GAEG;AACH,KAAK,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AAE7E;;GAEG;AACH,KAAK,WAAW,GAAG,SAAS,GAAG,WAAW,CAAC;AAqD3C;;GAEG;AACH,KAAK,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,IAAI,+FAmDT,CAAC;AAIF;;GAEG;AACH,KAAK,qBAAqB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,KAAK,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAkBnD;;GAEG;AACH,KAAK,eAAe,GAAG,qBAAqB,GAAG;IAC7C;;;;OAIG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,UAAU,qGAiBf,CAAC;AAGF;;GAEG;AACH,KAAK,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAEzC;;;GAGG;AACH,KAAK,cAAc,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAcxC;;GAEG;AACH,KAAK,cAAc,GAAG,qBAAqB,GAAG;IAC5C;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;GAEG;AAGH,QAAA,MAAM,SAAS,iGAsBd,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,eAAe,2GAUpB,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAaf,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,SAAS,2GAiBd,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,WAAW,2GAahB,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAiBf,CAAC;AAGF,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,SAAS,EACT,WAAW,GACZ,CAAC;AAEF,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,WAAW,GACZ,CAAC"}
|
package/dist/card.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { Slot as y } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva as p } from "class-variance-authority";
|
|
4
5
|
import { cn as l } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
return !
|
|
6
|
+
const f = o.createContext({ flush: !1, density: "default" });
|
|
7
|
+
function u(e, a) {
|
|
8
|
+
return !e && (a === "condensed" ? "px-3" : "px-section-md");
|
|
8
9
|
}
|
|
9
|
-
const
|
|
10
|
+
const N = p(
|
|
10
11
|
[
|
|
11
12
|
"flex",
|
|
12
13
|
"flex-col",
|
|
@@ -43,47 +44,47 @@ const y = u(
|
|
|
43
44
|
density: "default"
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
), v =
|
|
47
|
+
), v = o.forwardRef(
|
|
47
48
|
({
|
|
48
|
-
className:
|
|
49
|
+
className: e,
|
|
49
50
|
variant: a = "filled",
|
|
50
|
-
density:
|
|
51
|
+
density: t = "default",
|
|
51
52
|
dataHook: r,
|
|
52
|
-
trackingEl:
|
|
53
|
+
trackingEl: n,
|
|
53
54
|
trackingLabel: i,
|
|
54
|
-
maxWidth:
|
|
55
|
-
children:
|
|
56
|
-
style:
|
|
57
|
-
...
|
|
58
|
-
},
|
|
55
|
+
maxWidth: d,
|
|
56
|
+
children: c,
|
|
57
|
+
style: m,
|
|
58
|
+
...h
|
|
59
|
+
}, x) => {
|
|
59
60
|
const g = a === "transparent-flush";
|
|
60
|
-
|
|
61
|
-
process.env.NODE_ENV !== "production" &&
|
|
61
|
+
o.useEffect(() => {
|
|
62
|
+
process.env.NODE_ENV !== "production" && d !== void 0 && console.warn(
|
|
62
63
|
'Card: the "maxWidth" prop is deprecated. Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").'
|
|
63
64
|
);
|
|
64
|
-
}, [
|
|
65
|
-
const
|
|
66
|
-
maxWidth: typeof
|
|
65
|
+
}, [d]);
|
|
66
|
+
const C = d !== void 0 ? {
|
|
67
|
+
maxWidth: typeof d == "number" ? `${d}px` : d
|
|
67
68
|
} : void 0;
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ s(f.Provider, { value: { flush: g, density: t }, children: /* @__PURE__ */ s(
|
|
69
70
|
"div",
|
|
70
71
|
{
|
|
71
|
-
ref:
|
|
72
|
-
className: l(
|
|
73
|
-
"data-density":
|
|
72
|
+
ref: x,
|
|
73
|
+
className: l(N({ variant: a, density: t }), e),
|
|
74
|
+
"data-density": t,
|
|
74
75
|
"data-hook": r,
|
|
75
76
|
"data-slot": "card",
|
|
76
|
-
"data-tracking-el":
|
|
77
|
+
"data-tracking-el": n || `card-${a}`,
|
|
77
78
|
"data-tracking-label": i,
|
|
78
|
-
style: { ...
|
|
79
|
-
...
|
|
80
|
-
children:
|
|
79
|
+
style: { ...C, ...m },
|
|
80
|
+
...h,
|
|
81
|
+
children: c
|
|
81
82
|
}
|
|
82
83
|
) });
|
|
83
84
|
}
|
|
84
85
|
);
|
|
85
86
|
v.displayName = "Card";
|
|
86
|
-
const
|
|
87
|
+
const w = p(
|
|
87
88
|
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
|
|
88
89
|
{
|
|
89
90
|
variants: {
|
|
@@ -97,129 +98,131 @@ const N = u(
|
|
|
97
98
|
align: "left"
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
),
|
|
101
|
-
({ className:
|
|
102
|
-
const { flush: i, density:
|
|
103
|
-
return /* @__PURE__ */
|
|
101
|
+
), b = o.forwardRef(
|
|
102
|
+
({ className: e, align: a = "left", dataHook: t, ...r }, n) => {
|
|
103
|
+
const { flush: i, density: d } = o.useContext(f);
|
|
104
|
+
return /* @__PURE__ */ s(
|
|
104
105
|
"div",
|
|
105
106
|
{
|
|
106
|
-
ref:
|
|
107
|
+
ref: n,
|
|
107
108
|
className: l(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
w({ align: a }),
|
|
110
|
+
u(i, d),
|
|
111
|
+
e
|
|
111
112
|
),
|
|
112
|
-
"data-hook":
|
|
113
|
+
"data-hook": t,
|
|
113
114
|
"data-slot": "card-header",
|
|
114
115
|
...r
|
|
115
116
|
}
|
|
116
117
|
);
|
|
117
118
|
}
|
|
118
119
|
);
|
|
119
|
-
|
|
120
|
-
const
|
|
120
|
+
b.displayName = "CardHeader";
|
|
121
|
+
const k = p("", {
|
|
121
122
|
variants: {
|
|
122
123
|
size: {
|
|
123
|
-
small: "text-
|
|
124
|
-
default: "text-
|
|
124
|
+
small: "text-heading-subsection",
|
|
125
|
+
default: "text-heading-section"
|
|
125
126
|
}
|
|
126
127
|
},
|
|
127
128
|
defaultVariants: {
|
|
128
129
|
size: "default"
|
|
129
130
|
}
|
|
130
|
-
}),
|
|
131
|
-
({ className:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
className: l(b({ size: a }), t),
|
|
136
|
-
"data-hook": e,
|
|
131
|
+
}), R = o.forwardRef(
|
|
132
|
+
({ className: e, size: a = "default", level: t, asChild: r = !1, dataHook: n, ...i }, d) => {
|
|
133
|
+
const c = {
|
|
134
|
+
className: l(k({ size: a }), e),
|
|
135
|
+
"data-hook": n,
|
|
137
136
|
"data-slot": "card-title",
|
|
138
|
-
...
|
|
137
|
+
...i
|
|
138
|
+
};
|
|
139
|
+
if (r)
|
|
140
|
+
return /* @__PURE__ */ s(y, { ref: d, ...c });
|
|
141
|
+
if (t) {
|
|
142
|
+
const m = `h${t}`;
|
|
143
|
+
return /* @__PURE__ */ s(m, { ref: d, ...c });
|
|
139
144
|
}
|
|
140
|
-
|
|
145
|
+
return /* @__PURE__ */ s("div", { ref: d, ...c });
|
|
146
|
+
}
|
|
141
147
|
);
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
({ className:
|
|
148
|
+
R.displayName = "CardTitle";
|
|
149
|
+
const V = o.forwardRef(
|
|
150
|
+
({ className: e, dataHook: a, ...t }, r) => /* @__PURE__ */ s(
|
|
145
151
|
"div",
|
|
146
152
|
{
|
|
147
153
|
ref: r,
|
|
148
|
-
className: l(
|
|
149
|
-
"text-muted-foreground text-sm leading-normal font-normal",
|
|
150
|
-
t
|
|
151
|
-
),
|
|
154
|
+
className: l("text-body-sm text-muted-foreground", e),
|
|
152
155
|
"data-hook": a,
|
|
153
156
|
"data-slot": "card-description",
|
|
154
|
-
...
|
|
157
|
+
...t
|
|
155
158
|
}
|
|
156
159
|
)
|
|
157
160
|
);
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
({ className:
|
|
161
|
+
V.displayName = "CardDescription";
|
|
162
|
+
const H = o.forwardRef(
|
|
163
|
+
({ className: e, dataHook: a, ...t }, r) => /* @__PURE__ */ s(
|
|
161
164
|
"div",
|
|
162
165
|
{
|
|
163
166
|
ref: r,
|
|
164
167
|
className: l(
|
|
165
168
|
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
166
|
-
|
|
169
|
+
e
|
|
167
170
|
),
|
|
168
171
|
"data-hook": a,
|
|
169
172
|
"data-slot": "card-action",
|
|
170
|
-
...
|
|
173
|
+
...t
|
|
171
174
|
}
|
|
172
175
|
)
|
|
173
176
|
);
|
|
174
|
-
|
|
175
|
-
const T =
|
|
176
|
-
({ className:
|
|
177
|
-
const { flush: i, density:
|
|
178
|
-
return /* @__PURE__ */
|
|
177
|
+
H.displayName = "CardAction";
|
|
178
|
+
const T = o.forwardRef(
|
|
179
|
+
({ className: e, children: a, dataHook: t, ...r }, n) => {
|
|
180
|
+
const { flush: i, density: d } = o.useContext(f);
|
|
181
|
+
return /* @__PURE__ */ s(
|
|
179
182
|
"div",
|
|
180
183
|
{
|
|
181
|
-
ref:
|
|
182
|
-
className: l(
|
|
183
|
-
"data-hook":
|
|
184
|
+
ref: n,
|
|
185
|
+
className: l(u(i, d), e),
|
|
186
|
+
"data-hook": t,
|
|
184
187
|
"data-slot": "card-media",
|
|
185
188
|
...r,
|
|
186
|
-
children: /* @__PURE__ */
|
|
189
|
+
children: /* @__PURE__ */ s("div", { className: "overflow-hidden rounded-md", "data-slot": "card-media-clip", children: a })
|
|
187
190
|
}
|
|
188
191
|
);
|
|
189
192
|
}
|
|
190
193
|
);
|
|
191
194
|
T.displayName = "CardMedia";
|
|
192
|
-
const j =
|
|
193
|
-
({ className:
|
|
194
|
-
const { flush:
|
|
195
|
-
return /* @__PURE__ */
|
|
195
|
+
const j = o.forwardRef(
|
|
196
|
+
({ className: e, dataHook: a, ...t }, r) => {
|
|
197
|
+
const { flush: n, density: i } = o.useContext(f);
|
|
198
|
+
return /* @__PURE__ */ s(
|
|
196
199
|
"div",
|
|
197
200
|
{
|
|
198
201
|
ref: r,
|
|
199
|
-
className: l(
|
|
202
|
+
className: l(u(n, i), e),
|
|
200
203
|
"data-hook": a,
|
|
201
204
|
"data-slot": "card-content",
|
|
202
|
-
...
|
|
205
|
+
...t
|
|
203
206
|
}
|
|
204
207
|
);
|
|
205
208
|
}
|
|
206
209
|
);
|
|
207
210
|
j.displayName = "CardContent";
|
|
208
|
-
const D =
|
|
209
|
-
({ className:
|
|
210
|
-
const { flush:
|
|
211
|
-
return /* @__PURE__ */
|
|
211
|
+
const D = o.forwardRef(
|
|
212
|
+
({ className: e, dataHook: a, ...t }, r) => {
|
|
213
|
+
const { flush: n, density: i } = o.useContext(f);
|
|
214
|
+
return /* @__PURE__ */ s(
|
|
212
215
|
"div",
|
|
213
216
|
{
|
|
214
217
|
ref: r,
|
|
215
218
|
className: l(
|
|
216
219
|
"flex items-center",
|
|
217
|
-
|
|
218
|
-
|
|
220
|
+
u(n, i),
|
|
221
|
+
e
|
|
219
222
|
),
|
|
220
223
|
"data-hook": a,
|
|
221
224
|
"data-slot": "card-footer",
|
|
222
|
-
...
|
|
225
|
+
...t
|
|
223
226
|
}
|
|
224
227
|
);
|
|
225
228
|
}
|
|
@@ -227,11 +230,11 @@ const D = d.forwardRef(
|
|
|
227
230
|
D.displayName = "CardFooter";
|
|
228
231
|
export {
|
|
229
232
|
v as Card,
|
|
230
|
-
|
|
233
|
+
H as CardAction,
|
|
231
234
|
j as CardContent,
|
|
232
|
-
|
|
235
|
+
V as CardDescription,
|
|
233
236
|
D as CardFooter,
|
|
234
|
-
|
|
237
|
+
b as CardHeader,
|
|
235
238
|
T as CardMedia,
|
|
236
|
-
|
|
239
|
+
R as CardTitle
|
|
237
240
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),l=require("react"),m=require("@brightlocal/icons"),p=require("@brightlocal/ui-components/lib/utils"),d=require("./lib/empty-canvas.cjs");function f(e){const r=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(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const y=f(l),o=y.forwardRef(({className:e,dataHook:r,icon:t,message:a,trackingEl:s,trackingLabel:c,...u},i)=>n.jsx(d.EmptyCanvas,{ref:i,className:p.cn("w-full rounded-lg",e),dataHook:r,icon:t??n.jsx(m.ChartColumn,{strokeWidth:2}),message:a??"No data yet",slot:"chart-empty",trackingEl:s,trackingLabel:c,...u}));o.displayName="ChartEmpty";exports.ChartEmpty=o;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Props for the ChartEmpty component.
|
|
4
|
+
*/
|
|
5
|
+
export interface ChartEmptyProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children" | "title"> {
|
|
6
|
+
/**
|
|
7
|
+
* Required data-hook attribute for automated testing. The parts derive
|
|
8
|
+
* theirs from it: `-icon`, `-message`.
|
|
9
|
+
* @example "visibility-score-chart-empty"
|
|
10
|
+
*/
|
|
11
|
+
dataHook: string;
|
|
12
|
+
/**
|
|
13
|
+
* The glyph on the surface. Pass one that names the missing chart where a
|
|
14
|
+
* generic bar chart would be vague. The component sizes it.
|
|
15
|
+
* @default <ChartColumn strokeWidth={2} />
|
|
16
|
+
*/
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* The one line on the canvas. Domain copy in the reader's terms — "No
|
|
20
|
+
* ranking data yet" beats "No data yet" — with no trailing period.
|
|
21
|
+
* @default "No data yet"
|
|
22
|
+
*/
|
|
23
|
+
message?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The height the chart had reserved. The consumer owns the box: this
|
|
26
|
+
* component only fills it, so the layout never shifts when data arrives.
|
|
27
|
+
* @example "h-36"
|
|
28
|
+
*/
|
|
29
|
+
className?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Tracking element identifier for analytics.
|
|
32
|
+
*/
|
|
33
|
+
trackingEl?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Tracking label for analytics context.
|
|
36
|
+
*/
|
|
37
|
+
trackingLabel?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A chart's plot area with nothing to plot — a muted surface at the chart's
|
|
41
|
+
* reserved height, a bare icon, and one quiet line.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* // The card's headline agrees: an em-dash, and no trend badge.
|
|
46
|
+
* <CardContent className="flex flex-col gap-2">
|
|
47
|
+
* <TypographySmall dataHook="metric-label">Visibility score</TypographySmall>
|
|
48
|
+
* <p className="text-metric">{hasData ? score : "—"}</p>
|
|
49
|
+
* {hasData ? (
|
|
50
|
+
* <MetricBarChart data={byPlatform} />
|
|
51
|
+
* ) : (
|
|
52
|
+
* <ChartEmpty className="h-36" dataHook="metric-chart-empty" />
|
|
53
|
+
* )}
|
|
54
|
+
* </CardContent>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare const ChartEmpty: React.ForwardRefExoticComponent<ChartEmptyProps & React.RefAttributes<HTMLDivElement>>;
|
|
58
|
+
export { ChartEmpty };
|
|
59
|
+
//# sourceMappingURL=chart-empty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-empty.d.ts","sourceRoot":"","sources":["../../src/components/chart-empty.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiC/B;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EACrC,UAAU,GAAG,OAAO,CACrB;IACC;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,UAAU,wFAmBf,CAAC;AAIF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { ChartColumn as l } from "@brightlocal/icons";
|
|
4
|
+
import { cn as c } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
import { EmptyCanvas as d } from "./lib/empty-canvas.js";
|
|
6
|
+
const n = i.forwardRef(
|
|
7
|
+
({ className: o, dataHook: r, icon: m, message: a, trackingEl: e, trackingLabel: p, ...s }, f) => (
|
|
8
|
+
/* `w-full` and no height: the height is the consumer's, because only the
|
|
9
|
+
chart knows what it had reserved. */
|
|
10
|
+
/* @__PURE__ */ t(
|
|
11
|
+
d,
|
|
12
|
+
{
|
|
13
|
+
ref: f,
|
|
14
|
+
className: c("w-full rounded-lg", o),
|
|
15
|
+
dataHook: r,
|
|
16
|
+
icon: m ?? /* @__PURE__ */ t(l, { strokeWidth: 2 }),
|
|
17
|
+
message: a ?? "No data yet",
|
|
18
|
+
slot: "chart-empty",
|
|
19
|
+
trackingEl: e,
|
|
20
|
+
trackingLabel: p,
|
|
21
|
+
...s
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
n.displayName = "ChartEmpty";
|
|
27
|
+
export {
|
|
28
|
+
n as ChartEmpty
|
|
29
|
+
};
|