@brightlocal/ui-components 2.27.0 → 3.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/README.md +7 -1
- package/component-meta.json +568 -143
- package/deprecations.json +298 -1
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.d.ts +36 -0
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +74 -61
- 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 +147 -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-screen.d.ts → progress-state.d.ts} +30 -18
- package/dist/blocks/progress-state.d.ts.map +1 -0
- package/dist/blocks/{progress-screen.js → progress-state.js} +100 -71
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +160 -161
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-group.cjs +1 -0
- package/dist/button-group.d.ts +36 -0
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +47 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +12 -12
- 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 +42 -3
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +102 -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 +46 -13
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +172 -157
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +38 -4
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +100 -84
- package/dist/combobox.cjs +2 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +81 -79
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +248 -225
- 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 +75 -10
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +346 -334
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +13 -5
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +54 -53
- 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 +8 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +96 -65
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +130 -12
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +146 -127
- 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/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.js +8 -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 +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +554 -527
- 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.d.ts +17 -9
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +73 -72
- 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/empty-chip.cjs +1 -0
- package/dist/lib/empty-chip.d.ts +4 -0
- package/dist/lib/empty-chip.d.ts.map +1 -0
- package/dist/lib/empty-chip.js +13 -0
- 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/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +62 -58
- 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 +130 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +193 -102
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +2 -26
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +79 -118
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +15 -6
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +38 -36
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +13 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +92 -87
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +8 -8
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +2 -2
- 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.js +26 -26
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +40 -40
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +31 -28
- 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 +129 -0
- package/dist/typography-heading.d.ts.map +1 -0
- package/dist/typography-heading.js +95 -0
- package/dist/typography-text.cjs +1 -0
- package/dist/typography-text.d.ts +127 -0
- package/dist/typography-text.d.ts.map +1 -0
- package/dist/typography-text.js +92 -0
- package/dist/typography.d.ts +13 -0
- package/dist/typography.d.ts.map +1 -1
- package/package.json +35 -7
- package/src/blocks/empty-state.tsx +412 -0
- package/src/blocks/input-list.tsx +66 -36
- package/src/blocks/{progress-screen.tsx → progress-state.tsx} +154 -93
- package/src/blocks/sidebar.tsx +25 -26
- package/src/components/accordion.tsx +82 -27
- 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 +1 -1
- package/src/components/button-group.tsx +112 -0
- package/src/components/button.tsx +4 -4
- package/src/components/calendar.tsx +5 -6
- package/src/components/callout.tsx +48 -15
- package/src/components/card.tsx +89 -19
- package/src/components/chart-empty.tsx +116 -0
- package/src/components/chart.tsx +103 -32
- package/src/components/chip.tsx +88 -13
- package/src/components/combobox.tsx +12 -10
- package/src/components/command.tsx +64 -13
- package/src/components/context-menu.tsx +6 -9
- package/src/components/data-table.tsx +135 -20
- package/src/components/date-picker.tsx +18 -7
- 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 +89 -16
- package/src/components/global-layout.tsx +210 -39
- 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 +24 -12
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +10 -13
- package/src/components/list.tsx +13 -9
- 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 +286 -1
- package/src/components/progress.tsx +35 -113
- package/src/components/scroll-area.tsx +23 -10
- package/src/components/select.tsx +35 -10
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +2 -2
- package/src/components/skeleton.tsx +78 -7
- package/src/components/sonner.tsx +2 -2
- package/src/components/stepper.tsx +3 -3
- package/src/components/table.tsx +6 -3
- 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 +253 -0
- package/src/components/typography-text.tsx +250 -0
- package/src/components/typography.tsx +13 -0
- package/src/hooks/use-delayed-pending.ts +60 -0
- package/src/index.ts +11 -1
- package/src/lib/block-illustration.tsx +88 -0
- package/src/lib/empty-canvas.tsx +128 -0
- package/src/lib/empty-chip.ts +24 -0
- package/src/lib/optical-center.tsx +45 -0
- package/src/lib/utils.ts +26 -0
- package/dist/blocks/progress-screen.cjs +0 -1
- package/dist/blocks/progress-screen.d.ts.map +0 -1
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"),D=require("@radix-ui/react-slot"),f=require("class-variance-authority"),c=require("@brightlocal/ui-components/lib/utils");function O(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 d=O(V),u=d.createContext({flush:!1,density:"default"});function p(t,a){return!t&&(a==="condensed"?"px-3":"px-section-md")}const S=f.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=d.forwardRef(({className:t,variant:a="filled",density:e="default",dataHook:r,trackingEl:n,trackingLabel:i,maxWidth:s,children:l,style:m,...j},w)=>{const k=a==="transparent-flush";d.useEffect(()=>{process.env.NODE_ENV!=="production"&&s!==void 0&&console.warn('Card: the "maxWidth" prop is deprecated. Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").')},[s]);const R=s!==void 0?{maxWidth:typeof s=="number"?`${s}px`:s}:void 0;return o.jsx(u.Provider,{value:{flush:k,density:e},children:o.jsx("div",{ref:w,className:c.cn(S({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,...m},...j,children:l})})});x.displayName="Card";const T=f.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"}}),g=d.forwardRef(({className:t,align:a="left",dataHook:e,...r},n)=>{const{flush:i,density:s}=d.useContext(u);return o.jsx("div",{ref:n,className:c.cn(T({align:a}),p(i,s),t),"data-hook":e,"data-slot":"card-header",...r})});g.displayName="CardHeader";const P=f.cva("",{variants:{size:{small:"text-heading-subsection",default:"text-heading-section"}},defaultVariants:{size:"default"}}),C=d.forwardRef(({className:t,size:a="default",level:e,asChild:r=!1,dataHook:n,...i},s)=>{const l={className:c.cn(P({size:a}),t),"data-hook":n,"data-slot":"card-title",...i};if(r)return o.jsx(D.Slot,{ref:s,...l});if(e){const m=`h${e}`;return o.jsx(m,{ref:s,...l})}return o.jsx("div",{ref:s,...l})});C.displayName="CardTitle";const _=f.cva("text-body-sm text-muted-foreground",{variants:{align:{left:"text-left",center:"text-center",right:"text-right"}}}),h=d.forwardRef(({className:t,align:a,dataHook:e,...r},n)=>o.jsx("div",{ref:n,className:c.cn(_({align:a}),t),"data-hook":e,"data-slot":"card-description",...r}));h.displayName="CardDescription";const y=d.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 v=d.forwardRef(({className:t,children:a,dataHook:e,...r},n)=>{const{flush:i,density:s}=d.useContext(u);return o.jsx("div",{ref:n,className:c.cn(p(i,s),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})})});v.displayName="CardMedia";const b=d.forwardRef(({className:t,dataHook:a,...e},r)=>{const{flush:n,density:i}=d.useContext(u);return o.jsx("div",{ref:r,className:c.cn(p(n,i),t),"data-hook":a,"data-slot":"card-content",...e})});b.displayName="CardContent";const N=d.forwardRef(({className:t,dataHook:a,...e},r)=>{const{flush:n,density:i}=d.useContext(u);return o.jsx("div",{ref:r,className:c.cn("flex items-center",p(n,i),t),"data-hook":a,"data-slot":"card-footer",...e})});N.displayName="CardFooter";exports.Card=x;exports.CardAction=y;exports.CardContent=b;exports.CardDescription=h;exports.CardFooter=N;exports.CardHeader=g;exports.CardMedia=v;exports.CardTitle=C;
|
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,15 +101,49 @@ 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>>;
|
|
125
|
+
/**
|
|
126
|
+
* Text alignment for the CardDescription.
|
|
127
|
+
*/
|
|
128
|
+
type CardDescriptionAlign = "left" | "center" | "right";
|
|
129
|
+
/**
|
|
130
|
+
* Props for the CardDescription component.
|
|
131
|
+
*/
|
|
132
|
+
type CardDescriptionProps = CardSubComponentProps & {
|
|
133
|
+
/**
|
|
134
|
+
* Text alignment of the description itself. When omitted, the description
|
|
135
|
+
* inherits alignment from its parent — e.g. `CardHeader align`, or the
|
|
136
|
+
* centring a browser applies inside a `button`. Set it to pin the
|
|
137
|
+
* description's alignment regardless of context (matches `CardHeader`
|
|
138
|
+
* and Typography alignment values).
|
|
139
|
+
* @example <CardDescription align="left">…</CardDescription>
|
|
140
|
+
*/
|
|
141
|
+
align?: CardDescriptionAlign;
|
|
142
|
+
};
|
|
104
143
|
/**
|
|
105
144
|
* Description text within the Card header.
|
|
106
145
|
*/
|
|
107
|
-
declare const CardDescription: React.ForwardRefExoticComponent<Omit<
|
|
146
|
+
declare const CardDescription: React.ForwardRefExoticComponent<Omit<CardDescriptionProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
108
147
|
/**
|
|
109
148
|
* Action area within the Card header for buttons or controls.
|
|
110
149
|
*/
|
|
@@ -122,5 +161,5 @@ declare const CardContent: React.ForwardRefExoticComponent<Omit<CardSubComponent
|
|
|
122
161
|
*/
|
|
123
162
|
declare const CardFooter: React.ForwardRefExoticComponent<Omit<CardSubComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
124
163
|
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardMedia, CardContent, };
|
|
125
|
-
export type { CardProps, CardSubComponentProps, CardHeaderProps, CardHeaderAlign, CardTitleProps, CardTitleSize, CardVariant, CardDensity, };
|
|
164
|
+
export type { CardProps, CardSubComponentProps, CardHeaderProps, CardHeaderAlign, CardDescriptionProps, CardDescriptionAlign, CardTitleProps, CardTitleSize, CardTitleLevel, CardVariant, CardDensity, };
|
|
126
165
|
//# 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,KAAK,oBAAoB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAexD;;GAEG;AACH,KAAK,oBAAoB,GAAG,qBAAqB,GAAG;IAClD;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,eAAe,0GAUpB,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,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,WAAW,GACZ,CAAC"}
|
package/dist/card.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { Slot as y } from "@radix-ui/react-slot";
|
|
3
4
|
import { cva as u } 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 = s.createContext({ flush: !1, density: "default" });
|
|
7
|
+
function m(e, t) {
|
|
8
|
+
return !e && (t === "condensed" ? "px-3" : "px-section-md");
|
|
8
9
|
}
|
|
9
|
-
const
|
|
10
|
+
const v = u(
|
|
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
|
-
),
|
|
47
|
+
), N = s.forwardRef(
|
|
47
48
|
({
|
|
48
|
-
className:
|
|
49
|
-
variant:
|
|
50
|
-
density:
|
|
49
|
+
className: e,
|
|
50
|
+
variant: t = "filled",
|
|
51
|
+
density: a = "default",
|
|
51
52
|
dataHook: r,
|
|
52
53
|
trackingEl: o,
|
|
53
54
|
trackingLabel: i,
|
|
54
|
-
maxWidth:
|
|
55
|
-
children:
|
|
55
|
+
maxWidth: d,
|
|
56
|
+
children: c,
|
|
56
57
|
style: p,
|
|
57
|
-
...
|
|
58
|
-
},
|
|
59
|
-
const g =
|
|
60
|
-
|
|
61
|
-
process.env.NODE_ENV !== "production" &&
|
|
58
|
+
...h
|
|
59
|
+
}, x) => {
|
|
60
|
+
const g = t === "transparent-flush";
|
|
61
|
+
s.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__ */ n(
|
|
69
|
+
return /* @__PURE__ */ n(f.Provider, { value: { flush: g, density: a }, children: /* @__PURE__ */ n(
|
|
69
70
|
"div",
|
|
70
71
|
{
|
|
71
|
-
ref:
|
|
72
|
-
className: l(
|
|
73
|
-
"data-density":
|
|
72
|
+
ref: x,
|
|
73
|
+
className: l(v({ variant: t, density: a }), e),
|
|
74
|
+
"data-density": a,
|
|
74
75
|
"data-hook": r,
|
|
75
76
|
"data-slot": "card",
|
|
76
|
-
"data-tracking-el": o || `card-${
|
|
77
|
+
"data-tracking-el": o || `card-${t}`,
|
|
77
78
|
"data-tracking-label": i,
|
|
78
|
-
style: { ...
|
|
79
|
-
...
|
|
80
|
-
children:
|
|
79
|
+
style: { ...C, ...p },
|
|
80
|
+
...h,
|
|
81
|
+
children: c
|
|
81
82
|
}
|
|
82
83
|
) });
|
|
83
84
|
}
|
|
84
85
|
);
|
|
85
|
-
|
|
86
|
-
const
|
|
86
|
+
N.displayName = "Card";
|
|
87
|
+
const w = u(
|
|
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,141 +98,151 @@ const N = u(
|
|
|
97
98
|
align: "left"
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
),
|
|
101
|
-
({ className:
|
|
102
|
-
const { flush: i, density:
|
|
101
|
+
), b = s.forwardRef(
|
|
102
|
+
({ className: e, align: t = "left", dataHook: a, ...r }, o) => {
|
|
103
|
+
const { flush: i, density: d } = s.useContext(f);
|
|
103
104
|
return /* @__PURE__ */ n(
|
|
104
105
|
"div",
|
|
105
106
|
{
|
|
106
107
|
ref: o,
|
|
107
108
|
className: l(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
w({ align: t }),
|
|
110
|
+
m(i, d),
|
|
111
|
+
e
|
|
111
112
|
),
|
|
112
|
-
"data-hook":
|
|
113
|
+
"data-hook": a,
|
|
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 = u("", {
|
|
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 = s.forwardRef(
|
|
132
|
+
({ className: e, size: t = "default", level: a, asChild: r = !1, dataHook: o, ...i }, d) => {
|
|
133
|
+
const c = {
|
|
134
|
+
className: l(k({ size: t }), e),
|
|
135
|
+
"data-hook": o,
|
|
137
136
|
"data-slot": "card-title",
|
|
138
|
-
...
|
|
137
|
+
...i
|
|
138
|
+
};
|
|
139
|
+
if (r)
|
|
140
|
+
return /* @__PURE__ */ n(y, { ref: d, ...c });
|
|
141
|
+
if (a) {
|
|
142
|
+
const p = `h${a}`;
|
|
143
|
+
return /* @__PURE__ */ n(p, { ref: d, ...c });
|
|
139
144
|
}
|
|
140
|
-
|
|
145
|
+
return /* @__PURE__ */ n("div", { ref: d, ...c });
|
|
146
|
+
}
|
|
141
147
|
);
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
148
|
+
R.displayName = "CardTitle";
|
|
149
|
+
const V = u("text-body-sm text-muted-foreground", {
|
|
150
|
+
variants: {
|
|
151
|
+
align: {
|
|
152
|
+
left: "text-left",
|
|
153
|
+
center: "text-center",
|
|
154
|
+
right: "text-right"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}), D = s.forwardRef(
|
|
158
|
+
({ className: e, align: t, dataHook: a, ...r }, o) => /* @__PURE__ */ n(
|
|
145
159
|
"div",
|
|
146
160
|
{
|
|
147
|
-
ref:
|
|
148
|
-
className: l(
|
|
149
|
-
"text-muted-foreground text-sm leading-normal font-normal",
|
|
150
|
-
t
|
|
151
|
-
),
|
|
161
|
+
ref: o,
|
|
162
|
+
className: l(V({ align: t }), e),
|
|
152
163
|
"data-hook": a,
|
|
153
164
|
"data-slot": "card-description",
|
|
154
|
-
...
|
|
165
|
+
...r
|
|
155
166
|
}
|
|
156
167
|
)
|
|
157
168
|
);
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
({ className:
|
|
169
|
+
D.displayName = "CardDescription";
|
|
170
|
+
const H = s.forwardRef(
|
|
171
|
+
({ className: e, dataHook: t, ...a }, r) => /* @__PURE__ */ n(
|
|
161
172
|
"div",
|
|
162
173
|
{
|
|
163
174
|
ref: r,
|
|
164
175
|
className: l(
|
|
165
176
|
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
166
|
-
|
|
177
|
+
e
|
|
167
178
|
),
|
|
168
|
-
"data-hook":
|
|
179
|
+
"data-hook": t,
|
|
169
180
|
"data-slot": "card-action",
|
|
170
|
-
...
|
|
181
|
+
...a
|
|
171
182
|
}
|
|
172
183
|
)
|
|
173
184
|
);
|
|
174
|
-
|
|
175
|
-
const T =
|
|
176
|
-
({ className:
|
|
177
|
-
const { flush: i, density:
|
|
185
|
+
H.displayName = "CardAction";
|
|
186
|
+
const T = s.forwardRef(
|
|
187
|
+
({ className: e, children: t, dataHook: a, ...r }, o) => {
|
|
188
|
+
const { flush: i, density: d } = s.useContext(f);
|
|
178
189
|
return /* @__PURE__ */ n(
|
|
179
190
|
"div",
|
|
180
191
|
{
|
|
181
192
|
ref: o,
|
|
182
|
-
className: l(
|
|
183
|
-
"data-hook":
|
|
193
|
+
className: l(m(i, d), e),
|
|
194
|
+
"data-hook": a,
|
|
184
195
|
"data-slot": "card-media",
|
|
185
196
|
...r,
|
|
186
|
-
children: /* @__PURE__ */ n("div", { className: "overflow-hidden rounded-md", "data-slot": "card-media-clip", children:
|
|
197
|
+
children: /* @__PURE__ */ n("div", { className: "overflow-hidden rounded-md", "data-slot": "card-media-clip", children: t })
|
|
187
198
|
}
|
|
188
199
|
);
|
|
189
200
|
}
|
|
190
201
|
);
|
|
191
202
|
T.displayName = "CardMedia";
|
|
192
|
-
const j =
|
|
193
|
-
({ className:
|
|
194
|
-
const { flush: o, density: i } =
|
|
203
|
+
const j = s.forwardRef(
|
|
204
|
+
({ className: e, dataHook: t, ...a }, r) => {
|
|
205
|
+
const { flush: o, density: i } = s.useContext(f);
|
|
195
206
|
return /* @__PURE__ */ n(
|
|
196
207
|
"div",
|
|
197
208
|
{
|
|
198
209
|
ref: r,
|
|
199
|
-
className: l(
|
|
200
|
-
"data-hook":
|
|
210
|
+
className: l(m(o, i), e),
|
|
211
|
+
"data-hook": t,
|
|
201
212
|
"data-slot": "card-content",
|
|
202
|
-
...
|
|
213
|
+
...a
|
|
203
214
|
}
|
|
204
215
|
);
|
|
205
216
|
}
|
|
206
217
|
);
|
|
207
218
|
j.displayName = "CardContent";
|
|
208
|
-
const
|
|
209
|
-
({ className:
|
|
210
|
-
const { flush: o, density: i } =
|
|
219
|
+
const E = s.forwardRef(
|
|
220
|
+
({ className: e, dataHook: t, ...a }, r) => {
|
|
221
|
+
const { flush: o, density: i } = s.useContext(f);
|
|
211
222
|
return /* @__PURE__ */ n(
|
|
212
223
|
"div",
|
|
213
224
|
{
|
|
214
225
|
ref: r,
|
|
215
226
|
className: l(
|
|
216
227
|
"flex items-center",
|
|
217
|
-
|
|
218
|
-
|
|
228
|
+
m(o, i),
|
|
229
|
+
e
|
|
219
230
|
),
|
|
220
|
-
"data-hook":
|
|
231
|
+
"data-hook": t,
|
|
221
232
|
"data-slot": "card-footer",
|
|
222
|
-
...
|
|
233
|
+
...a
|
|
223
234
|
}
|
|
224
235
|
);
|
|
225
236
|
}
|
|
226
237
|
);
|
|
227
|
-
|
|
238
|
+
E.displayName = "CardFooter";
|
|
228
239
|
export {
|
|
229
|
-
|
|
230
|
-
|
|
240
|
+
N as Card,
|
|
241
|
+
H as CardAction,
|
|
231
242
|
j as CardContent,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
243
|
+
D as CardDescription,
|
|
244
|
+
E as CardFooter,
|
|
245
|
+
b as CardHeader,
|
|
235
246
|
T as CardMedia,
|
|
236
|
-
|
|
247
|
+
R as CardTitle
|
|
237
248
|
};
|
|
@@ -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"}
|