@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/progress.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import { motion as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { usePrefersReducedMotion as
|
|
7
|
-
import { SPRING_GENTLE as
|
|
8
|
-
const
|
|
1
|
+
import { jsx as o, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import * as y from "react";
|
|
3
|
+
import * as x from "@radix-ui/react-progress";
|
|
4
|
+
import { motion as j } from "framer-motion";
|
|
5
|
+
import { cn as s } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { usePrefersReducedMotion as z } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
|
|
7
|
+
import { SPRING_GENTLE as A } from "./lib/motion.js";
|
|
8
|
+
const k = {
|
|
9
|
+
sm: { text: "text-body-sm", bar: "h-2" },
|
|
10
|
+
md: { text: "text-body", bar: "h-3" }
|
|
11
|
+
}, N = {
|
|
9
12
|
green: {
|
|
10
13
|
track: "bg-brand-primary-foreground/20",
|
|
11
14
|
indicator: "bg-green-400"
|
|
@@ -22,94 +25,129 @@ const u = {
|
|
|
22
25
|
track: "bg-brand-yellow/20",
|
|
23
26
|
indicator: "bg-brand-yellow"
|
|
24
27
|
}
|
|
25
|
-
};
|
|
26
|
-
function
|
|
27
|
-
if (
|
|
28
|
+
}, B = "40%";
|
|
29
|
+
function R(e, t, r) {
|
|
30
|
+
if (e == null)
|
|
28
31
|
return "–";
|
|
29
|
-
if (
|
|
30
|
-
return `${
|
|
31
|
-
const n =
|
|
32
|
-
return
|
|
32
|
+
if (r === "%")
|
|
33
|
+
return `${t > 0 ? Math.min(100, Math.max(0, Math.round(e / t * 100))) : 0}%`;
|
|
34
|
+
const n = r ? ` ${r}` : "";
|
|
35
|
+
return t > 0 ? `${e} / ${t}${n}` : `${e}${n}`;
|
|
33
36
|
}
|
|
34
|
-
const
|
|
37
|
+
const C = y.forwardRef(
|
|
35
38
|
({
|
|
36
|
-
className:
|
|
37
|
-
value:
|
|
38
|
-
max:
|
|
39
|
+
className: e,
|
|
40
|
+
value: t,
|
|
41
|
+
max: r = 100,
|
|
39
42
|
dataHook: n,
|
|
40
|
-
trackingEl:
|
|
41
|
-
trackingLabel:
|
|
42
|
-
ariaLabel:
|
|
43
|
-
label:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
trackingEl: c,
|
|
44
|
+
trackingLabel: v,
|
|
45
|
+
ariaLabel: L = "Progress",
|
|
46
|
+
label: g,
|
|
47
|
+
labelWidth: m = B,
|
|
48
|
+
color: P = "green",
|
|
49
|
+
size: S = "sm",
|
|
50
|
+
showValue: i = !1,
|
|
51
|
+
unit: f = "%",
|
|
52
|
+
indicatorClassName: $,
|
|
53
|
+
disabled: p,
|
|
54
|
+
...E
|
|
55
|
+
}, M) => {
|
|
56
|
+
const b = y.useId(), a = !!g, I = z(), u = N[P] ?? N.green, d = k[S] ?? k.sm, l = m === "auto", T = a || i, _ = r > 0 ? Math.min(100, Math.max(0, (t ?? 0) / r * 100)) : 0, h = /* @__PURE__ */ o(
|
|
57
|
+
x.Root,
|
|
53
58
|
{
|
|
54
|
-
ref:
|
|
55
|
-
"aria-label": a ? void 0 :
|
|
56
|
-
"aria-labelledby": a ?
|
|
57
|
-
className:
|
|
58
|
-
"relative
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
ref: M,
|
|
60
|
+
"aria-label": a ? void 0 : L,
|
|
61
|
+
"aria-labelledby": a ? b : void 0,
|
|
62
|
+
className: s(
|
|
63
|
+
"relative w-full overflow-hidden rounded-full",
|
|
64
|
+
// Inside the row wrapper the bar fills whatever the fixed label and
|
|
65
|
+
// value columns leave over; standalone it must not flex at all.
|
|
66
|
+
T && "min-w-0 flex-1",
|
|
67
|
+
d.bar,
|
|
68
|
+
u.track,
|
|
69
|
+
!a && !i && p && "opacity-50",
|
|
70
|
+
e
|
|
62
71
|
),
|
|
63
72
|
"data-hook": n,
|
|
64
73
|
"data-slot": "progress",
|
|
65
|
-
"data-tracking-el":
|
|
66
|
-
"data-tracking-label":
|
|
67
|
-
max:
|
|
68
|
-
value:
|
|
69
|
-
...
|
|
70
|
-
children: /* @__PURE__ */ o(
|
|
71
|
-
|
|
74
|
+
"data-tracking-el": c,
|
|
75
|
+
"data-tracking-label": v,
|
|
76
|
+
max: r,
|
|
77
|
+
value: t ?? 0,
|
|
78
|
+
...E,
|
|
79
|
+
children: /* @__PURE__ */ o(x.Indicator, { asChild: !0, children: /* @__PURE__ */ o(
|
|
80
|
+
j.div,
|
|
72
81
|
{
|
|
73
82
|
animate: {
|
|
74
|
-
transform: `translateX(-${100 -
|
|
83
|
+
transform: `translateX(-${100 - _}%)`
|
|
75
84
|
},
|
|
76
|
-
className:
|
|
85
|
+
className: s(
|
|
77
86
|
"h-full w-full flex-1",
|
|
78
|
-
|
|
79
|
-
|
|
87
|
+
u.indicator,
|
|
88
|
+
$
|
|
80
89
|
),
|
|
81
90
|
"data-slot": "progress-indicator",
|
|
82
91
|
initial: !1,
|
|
83
|
-
transition:
|
|
92
|
+
transition: I ? { duration: 0 } : A
|
|
84
93
|
}
|
|
85
94
|
) })
|
|
86
95
|
}
|
|
87
96
|
);
|
|
88
|
-
return !a && !
|
|
97
|
+
return !a && !i ? h : /* @__PURE__ */ w(
|
|
89
98
|
"div",
|
|
90
99
|
{
|
|
91
|
-
className:
|
|
100
|
+
className: s(
|
|
92
101
|
"flex w-full items-center gap-2",
|
|
93
|
-
|
|
102
|
+
p && "opacity-50"
|
|
94
103
|
),
|
|
95
104
|
"data-slot": "progress-wrapper",
|
|
96
105
|
children: [
|
|
97
106
|
a && /* @__PURE__ */ o(
|
|
98
107
|
"span",
|
|
99
108
|
{
|
|
100
|
-
className:
|
|
109
|
+
className: s(
|
|
110
|
+
"text-foreground shrink-0 break-words",
|
|
111
|
+
// `auto`: hug the text but never take more than 40% of the row,
|
|
112
|
+
// so an overlong label still wraps instead of squeezing the bar.
|
|
113
|
+
l && "max-w-2/5",
|
|
114
|
+
d.text
|
|
115
|
+
),
|
|
116
|
+
"data-label-width": l ? "auto" : void 0,
|
|
101
117
|
"data-slot": "progress-label",
|
|
102
|
-
id:
|
|
103
|
-
|
|
118
|
+
id: b,
|
|
119
|
+
style: l ? void 0 : { width: m },
|
|
120
|
+
children: g
|
|
104
121
|
}
|
|
105
122
|
),
|
|
106
|
-
|
|
107
|
-
|
|
123
|
+
h,
|
|
124
|
+
i && /* @__PURE__ */ w(
|
|
108
125
|
"span",
|
|
109
126
|
{
|
|
110
|
-
className:
|
|
127
|
+
className: s(
|
|
128
|
+
"text-muted-foreground grid min-w-10 shrink-0 text-right tabular-nums",
|
|
129
|
+
d.text
|
|
130
|
+
),
|
|
111
131
|
"data-slot": "progress-value",
|
|
112
|
-
children:
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ o(
|
|
134
|
+
"span",
|
|
135
|
+
{
|
|
136
|
+
"aria-hidden": "true",
|
|
137
|
+
className: "invisible col-start-1 row-start-1",
|
|
138
|
+
"data-slot": "progress-value-sizer",
|
|
139
|
+
children: R(r, r, f)
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ o(
|
|
143
|
+
"span",
|
|
144
|
+
{
|
|
145
|
+
className: "col-start-1 row-start-1",
|
|
146
|
+
"data-slot": "progress-value-text",
|
|
147
|
+
children: R(t, r, f)
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
]
|
|
113
151
|
}
|
|
114
152
|
)
|
|
115
153
|
]
|
|
@@ -117,7 +155,7 @@ const E = p.forwardRef(
|
|
|
117
155
|
);
|
|
118
156
|
}
|
|
119
157
|
);
|
|
120
|
-
|
|
158
|
+
C.displayName = "Progress";
|
|
121
159
|
export {
|
|
122
|
-
|
|
160
|
+
C as Progress
|
|
123
161
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),A=require("react"),O=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion"),h=require("@brightlocal/ui-components/lib/utils"),m=require("./lib/motion.cjs");function M(r){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(s,o,l.get?l:{enumerable:!0,get:()=>r[o]})}}return s.default=r,Object.freeze(s)}const c=M(A),P=12,y=90,v=12e3,N="var(--ds-motion-ease-emphasized)",j=m.MOTION_DURATION_FAST_MS,F=50,g=c.forwardRef(({className:r,active:s,dataHook:o,trackingEl:l,trackingLabel:T,navigatingLabel:R="Loading page",style:_,...S},E)=>{const a=O.usePrefersReducedMotion(),[e,u]=c.useState("idle");c.useEffect(()=>{if(s){u(t=>t==="start"||t==="creep"?t:"start");return}const n=setTimeout(()=>u(t=>t==="idle"?"idle":"complete"),j);return()=>clearTimeout(n)},[s]),c.useEffect(()=>{if(e!=="start"||a)return;let n=0;const t=requestAnimationFrame(()=>{n=requestAnimationFrame(()=>u(f=>f==="start"?"creep":f))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(n)}},[e,a]),c.useEffect(()=>{if(e!=="complete")return;const n=setTimeout(()=>u(t=>t==="complete"?"idle":t),a?0:m.MOTION_DURATION_BASE_MS+m.MOTION_DURATION_FAST_MS);return()=>clearTimeout(n)},[e,a]);const p=e==="start"||e==="creep",b=e==="complete"?100:e==="creep"?y:e==="start"&&a?F:P;let d="none";return a||(e==="creep"?d=`clip-path ${v}ms ${N}`:e==="complete"&&(d="clip-path var(--ds-motion-duration-base) ease-out, opacity var(--ds-motion-duration-fast) ease-out var(--ds-motion-duration-base)")),i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:E,"aria-hidden":"true",className:h.cn("pointer-events-none fixed inset-x-0 top-0 z-60 h-0.5 overflow-hidden",r),"data-hook":o,"data-slot":"route-progress","data-state":e,"data-tracking-el":l,"data-tracking-label":T,style:_,...S,children:i.jsx("span",{className:"bg-primary absolute inset-0 dark:bg-[var(--ds-colors-primary-light)]","data-slot":"route-progress-bar",style:{clipPath:`inset(0 ${100-b}% 0 0)`,opacity:p?1:0,transition:d}})}),i.jsx("span",{"aria-atomic":"true","aria-live":"polite",className:"sr-only fixed","data-slot":"route-progress-status",children:p?R:""})]})});g.displayName="RouteProgress";exports.RouteProgress=g;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Props for the RouteProgress component.
|
|
4
|
+
*/
|
|
5
|
+
interface RouteProgressProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> {
|
|
6
|
+
/**
|
|
7
|
+
* Required data-hook attribute for testing and component identification
|
|
8
|
+
*/
|
|
9
|
+
dataHook: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a full route navigation is in flight.
|
|
12
|
+
*
|
|
13
|
+
* Derive it from the router rather than from a click handler — that is what
|
|
14
|
+
* gives the remaining pattern guarantees for free: browser back and forward
|
|
15
|
+
* run the bar too, and in-page changes (tabs, filter changes, pagination
|
|
16
|
+
* refetches, modals) never touch it, because none of them are route
|
|
17
|
+
* navigations.
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const navigating = useRouterState({
|
|
21
|
+
* select: (state) => state.status === "pending",
|
|
22
|
+
* });
|
|
23
|
+
* <RouteProgress active={navigating} dataHook="route-progress" />
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Prefer `status === "pending"` over `isLoading`: `isLoading` clears as soon
|
|
27
|
+
* as the route's loaders resolve, whereas `status` returns to `"idle"` only
|
|
28
|
+
* once `isLoading`, `isTransitioning` and `hasPendingMatches` are all false
|
|
29
|
+
* — so it also covers the React transition that commits the new route. And
|
|
30
|
+
* always pass `select`; `useRouterState()` with no selector re-renders the
|
|
31
|
+
* whole subtree on any router state change.
|
|
32
|
+
*
|
|
33
|
+
* **Router pending alone only means "the page is here", not "the page is
|
|
34
|
+
* ready."** It is the whole answer when the route declares its
|
|
35
|
+
* route-critical data in a loader — with TanStack Router,
|
|
36
|
+
* `loader: () => queryClient.ensureQueryData(...)` keeps `status` pending
|
|
37
|
+
* until that data has landed, which is exactly the signal this bar wants.
|
|
38
|
+
*
|
|
39
|
+
* Where components instead fetch on mount, the router goes idle as soon as
|
|
40
|
+
* the route commits and the bar finishes while skeletons are still
|
|
41
|
+
* rendering. Add the destination's own queries — **scoped to the route**,
|
|
42
|
+
* never a global `useIsFetching()`, which a polling or failing section would
|
|
43
|
+
* hold open forever:
|
|
44
|
+
*
|
|
45
|
+
* ```tsx
|
|
46
|
+
* const navigating = useRouterState({ select: (s) => s.status === "pending" });
|
|
47
|
+
* const loadingPage = useIsFetching({ queryKey: ["location", locationId] }) > 0;
|
|
48
|
+
* <RouteProgress active={navigating || loadingPage} dataHook="route-progress" />
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* Handing off between two such signals is safe: the bar debounces the
|
|
52
|
+
* falling edge, so it stays continuous through the gap instead of sweeping
|
|
53
|
+
* and restarting. The rising edge is never debounced.
|
|
54
|
+
*
|
|
55
|
+
* Aim at *route-critical* content, not every query on the page. A
|
|
56
|
+
* below-the-fold widget that is slow, failing, or polling must keep its own
|
|
57
|
+
* skeleton and let the bar finish — a bar still running on a usable page
|
|
58
|
+
* reads as a hang.
|
|
59
|
+
*/
|
|
60
|
+
active: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Optional tracking element identifier for analytics
|
|
63
|
+
*/
|
|
64
|
+
trackingEl?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Optional tracking label for analytics
|
|
67
|
+
*/
|
|
68
|
+
trackingLabel?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Announced politely to screen readers while `active` is true. The bar
|
|
71
|
+
* itself is decorative — its fill is a trickle, not measured progress, so
|
|
72
|
+
* it exposes no `progressbar` role or `aria-valuenow`.
|
|
73
|
+
* @default "Loading page"
|
|
74
|
+
*/
|
|
75
|
+
navigatingLabel?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A slim bar pinned to the top edge of the viewport that reports a full route
|
|
79
|
+
* navigation: it starts the moment the navigation begins and completes when
|
|
80
|
+
* the destination's route-critical content has settled.
|
|
81
|
+
*
|
|
82
|
+
* Its appearance answers *did my click work?*; its completion answers *is the
|
|
83
|
+
* page here yet?* It runs alongside the destination's own skeletons rather
|
|
84
|
+
* than instead of them — the two work at different scopes, and
|
|
85
|
+
* `RouteProgress (the navigation) over destination skeletons (each section) →
|
|
86
|
+
* content` is the normal lifecycle.
|
|
87
|
+
*
|
|
88
|
+
* Position is `fixed` at the viewport's top edge, so the bar blocks nothing
|
|
89
|
+
* and shifts nothing. Per the className policy the outer box is the
|
|
90
|
+
* consumer's: pass `className` to re-anchor it (for example `absolute` inside
|
|
91
|
+
* a positioned container), and the bar's own identity stays ours.
|
|
92
|
+
*
|
|
93
|
+
* Keeping the current page mounted until the destination commits is the
|
|
94
|
+
* router's job, not the bar's — tearing down a working screen costs people
|
|
95
|
+
* their context.
|
|
96
|
+
*
|
|
97
|
+
* See `Patterns/Loading → Page loading → Route transitions` in Storybook for
|
|
98
|
+
* the full guidance and the end-to-end demo.
|
|
99
|
+
*/
|
|
100
|
+
declare const RouteProgress: React.ForwardRefExoticComponent<RouteProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
101
|
+
export { RouteProgress };
|
|
102
|
+
export type { RouteProgressProps };
|
|
103
|
+
//# sourceMappingURL=route-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-progress.d.ts","sourceRoot":"","sources":["../../src/components/route-progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAuF/B;;GAEG;AACH,UAAU,kBAAmB,SAAQ,IAAI,CACvC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EACrC,UAAU,CACX;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,aAAa,2FA6JlB,CAAC;AAIF,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsxs as _, Fragment as S, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { usePrefersReducedMotion as v } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
|
|
4
|
+
import { cn as F } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
import { MOTION_DURATION_FAST_MS as d, MOTION_DURATION_BASE_MS as M } from "./lib/motion.js";
|
|
6
|
+
const N = 12, P = 90, b = 12e3, y = "var(--ds-motion-ease-emphasized)", I = d, x = 50, L = o.forwardRef(
|
|
7
|
+
({
|
|
8
|
+
className: p,
|
|
9
|
+
active: c,
|
|
10
|
+
dataHook: u,
|
|
11
|
+
trackingEl: f,
|
|
12
|
+
trackingLabel: T,
|
|
13
|
+
navigatingLabel: E = "Loading page",
|
|
14
|
+
style: g,
|
|
15
|
+
...h
|
|
16
|
+
}, R) => {
|
|
17
|
+
const a = v(), [e, s] = o.useState("idle");
|
|
18
|
+
o.useEffect(() => {
|
|
19
|
+
if (c) {
|
|
20
|
+
s(
|
|
21
|
+
(t) => t === "start" || t === "creep" ? t : "start"
|
|
22
|
+
);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const r = setTimeout(
|
|
26
|
+
() => s((t) => t === "idle" ? "idle" : "complete"),
|
|
27
|
+
I
|
|
28
|
+
);
|
|
29
|
+
return () => clearTimeout(r);
|
|
30
|
+
}, [c]), o.useEffect(() => {
|
|
31
|
+
if (e !== "start" || a)
|
|
32
|
+
return;
|
|
33
|
+
let r = 0;
|
|
34
|
+
const t = requestAnimationFrame(() => {
|
|
35
|
+
r = requestAnimationFrame(
|
|
36
|
+
() => s((l) => l === "start" ? "creep" : l)
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
return () => {
|
|
40
|
+
cancelAnimationFrame(t), cancelAnimationFrame(r);
|
|
41
|
+
};
|
|
42
|
+
}, [e, a]), o.useEffect(() => {
|
|
43
|
+
if (e !== "complete")
|
|
44
|
+
return;
|
|
45
|
+
const r = setTimeout(
|
|
46
|
+
() => s((t) => t === "complete" ? "idle" : t),
|
|
47
|
+
a ? 0 : M + d
|
|
48
|
+
);
|
|
49
|
+
return () => clearTimeout(r);
|
|
50
|
+
}, [e, a]);
|
|
51
|
+
const m = e === "start" || e === "creep", A = e === "complete" ? 100 : e === "creep" ? P : e === "start" && a ? x : N;
|
|
52
|
+
let i = "none";
|
|
53
|
+
return a || (e === "creep" ? i = `clip-path ${b}ms ${y}` : e === "complete" && (i = "clip-path var(--ds-motion-duration-base) ease-out, opacity var(--ds-motion-duration-fast) ease-out var(--ds-motion-duration-base)")), /* @__PURE__ */ _(S, { children: [
|
|
54
|
+
/* @__PURE__ */ n(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
ref: R,
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
className: F(
|
|
60
|
+
// z-60, not z-50: every DS overlay (Dialog, Sheet, Drawer,
|
|
61
|
+
// AlertDialog) is `fixed inset-0 z-50` and portals to <body>, so at
|
|
62
|
+
// an equal z-index it would paint over the bar by DOM order. A
|
|
63
|
+
// navigation started from inside a modal must still be reported.
|
|
64
|
+
"pointer-events-none fixed inset-x-0 top-0 z-60 h-0.5 overflow-hidden",
|
|
65
|
+
p
|
|
66
|
+
),
|
|
67
|
+
"data-hook": u,
|
|
68
|
+
"data-slot": "route-progress",
|
|
69
|
+
"data-state": e,
|
|
70
|
+
"data-tracking-el": f,
|
|
71
|
+
"data-tracking-label": T,
|
|
72
|
+
style: g,
|
|
73
|
+
...h,
|
|
74
|
+
children: /* @__PURE__ */ n(
|
|
75
|
+
"span",
|
|
76
|
+
{
|
|
77
|
+
className: "bg-primary absolute inset-0 dark:bg-[var(--ds-colors-primary-light)]",
|
|
78
|
+
"data-slot": "route-progress-bar",
|
|
79
|
+
style: {
|
|
80
|
+
/* Painted across the full track and revealed by clip-path, so
|
|
81
|
+
the fill's colour is identical at every width. */
|
|
82
|
+
clipPath: `inset(0 ${100 - A}% 0 0)`,
|
|
83
|
+
opacity: m ? 1 : 0,
|
|
84
|
+
transition: i
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ n(
|
|
91
|
+
"span",
|
|
92
|
+
{
|
|
93
|
+
"aria-atomic": "true",
|
|
94
|
+
"aria-live": "polite",
|
|
95
|
+
className: "sr-only fixed",
|
|
96
|
+
"data-slot": "route-progress-status",
|
|
97
|
+
children: m ? E : ""
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
L.displayName = "RouteProgress";
|
|
104
|
+
export {
|
|
105
|
+
L as RouteProgress
|
|
106
|
+
};
|
package/dist/select.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),T=require("react"),R=require("@radix-ui/react-select"),b=require("@brightlocal/icons"),_=require("class-variance-authority"),l=require("@brightlocal/ui-components/lib/utils"),D=require("./lib/use-dev-warning.cjs"),B=require("@brightlocal/ui-components/hooks/use-overlay-pointer-lock");function y(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const
|
|
2
|
-
Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,[t]);const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),T=require("react"),R=require("@radix-ui/react-select"),b=require("@brightlocal/icons"),_=require("class-variance-authority"),l=require("@brightlocal/ui-components/lib/utils"),D=require("./lib/use-dev-warning.cjs"),B=require("@brightlocal/ui-components/hooks/use-overlay-pointer-lock");function y(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const i=y(T),n=y(R);function j({children:e,onClose:t,onOpenChange:o,open:a,defaultOpen:u,...f}){const[s,p]=i.useState(u??!1),d=a!==void 0,c=d?a:s,m=i.useCallback(h=>{d||p(h),o?.(h)},[d,o]),g=i.useRef(t);i.useEffect(()=>{g.current=t},[t]);const v=i.useRef(c);return i.useEffect(()=>{v.current&&!c&&g.current?.(),v.current=c},[c]),i.useEffect(()=>()=>{v.current&&g.current?.()},[]),r.jsx(n.Root,{"data-slot":"select",defaultOpen:u,open:a,onOpenChange:m,...f,children:e})}j.displayName="Select";function w(e){return r.jsx(n.Group,{"data-slot":"select-group",...e})}w.displayName="SelectGroup";function N(e){return r.jsx(n.Value,{"data-slot":"select-value",...e})}N.displayName="SelectValue";const L=_.cva(["relative flex w-full h-9 items-center justify-between gap-2","px-3 py-2","border border-border rounded-sm outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out","bg-neutral-50 border-neutral-300","dark:bg-white/5 dark:border-white/15","text-body text-foreground","[&>span]:block [&>span]:truncate","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"]);function k({className:e,children:t,placeholder:o,dataHook:a,error:u,selectLabel:f,...s}){const p=u||s["aria-invalid"]===!0||s["aria-invalid"]==="true",d=s["aria-required"]===!0||s["aria-required"]==="true",c=s["aria-label"]||f||o||"Select an option",m=p?"border-destructive-40 dark:border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive":"";return r.jsxs(n.Trigger,{...s,"aria-invalid":p?"true":void 0,"aria-label":c,"aria-required":d?"true":void 0,className:l.cn(L(),m,e),"data-hook":a,"data-slot":"select-trigger",children:[t,r.jsx(n.Icon,{asChild:!0,children:r.jsx(b.ChevronDown,{className:"text-muted-foreground"})})]})}k.displayName="SelectTrigger";function C({className:e,children:t,position:o="popper",maxHeight:a,style:u,...f}){B.useOverlayPointerLock();const s=i.useRef(null);D.useDevWarning(()=>s.current?s.current.querySelectorAll('[data-slot="select-item"]').length>=100:!1,`Select contains many items. For large lists (100+), consider using <Combobox> which supports search and filtering.
|
|
2
|
+
Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,[t]);const p=l.cn("relative z-50 overflow-hidden","min-w-[8rem]","rounded-md border border-border bg-popover shadow-md","text-popover-foreground","max-h-[var(--radix-select-content-available-height)]","origin-[var(--radix-select-content-transform-origin)]",l.FLOATING_CONTENT_ANIMATION),d=o==="popper"&&l.cn("data-[side=bottom]:translate-y-1","data-[side=left]:-translate-x-1","data-[side=right]:translate-x-1","data-[side=top]:-translate-y-1"),c=a!==void 0?{...u,maxHeight:`min(${a}px, var(--radix-select-content-available-height))`}:u;return r.jsx(n.Portal,{children:r.jsxs(n.Content,{className:l.cn(p,d,e),"data-slot":"select-content",position:o,style:c,...f,children:[r.jsx(S,{}),r.jsx(n.Viewport,{ref:s,className:l.cn("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),r.jsx(x,{})]})})}C.displayName="SelectContent";function O({className:e,...t}){return r.jsx(n.Label,{className:l.cn("text-muted-foreground text-label-sm px-2 py-1.5",e),"data-slot":"select-label",...t})}O.displayName="SelectLabel";function q({className:e,children:t,...o}){const a=l.cn("relative flex w-full cursor-default select-none items-center gap-2","rounded py-1.5 pl-2 pr-8","text-label text-popover-foreground","focus:bg-accent focus:text-accent-foreground","hover:bg-accent/50 hover:text-accent-foreground","outline-none focus:outline-none","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0");return r.jsxs(n.Item,{className:l.cn(a,e),"data-slot":"select-item",...o,children:[r.jsx("span",{className:"absolute right-2 flex size-4 items-center justify-center",children:r.jsx(n.ItemIndicator,{children:r.jsx(b.Check,{})})}),r.jsx(n.ItemText,{children:t})]})}q.displayName="SelectItem";function I({className:e,...t}){return r.jsx(n.Separator,{className:l.cn("bg-border pointer-events-none -mx-1 my-1 h-px",e),"data-slot":"select-separator",...t})}I.displayName="SelectSeparator";function S({className:e,...t}){return r.jsx(n.ScrollUpButton,{className:l.cn("flex cursor-default items-center justify-center py-1",e),"data-slot":"select-scroll-up-button",...t,children:r.jsx(b.ChevronUp,{})})}S.displayName="SelectScrollUpButton";function x({className:e,...t}){return r.jsx(n.ScrollDownButton,{className:l.cn("flex cursor-default items-center justify-center py-1",e),"data-slot":"select-scroll-down-button",...t,children:r.jsx(b.ChevronDown,{})})}x.displayName="SelectScrollDownButton";exports.Select=j;exports.SelectContent=C;exports.SelectGroup=w;exports.SelectItem=q;exports.SelectLabel=O;exports.SelectScrollDownButton=x;exports.SelectScrollUpButton=S;exports.SelectSeparator=I;exports.SelectTrigger=k;exports.SelectValue=N;
|
package/dist/select.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAe1D,UAAU,WAAY,SAAQ,KAAK,CAAC,cAAc,CAChD,OAAO,eAAe,CAAC,IAAI,CAC5B;IACC,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CACvD,OAAO,eAAe,CAAC,OAAO,CAC/B;IACC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,MAAM,CAAC,EACd,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,IAAI,EAAE,QAAQ,EACd,WAAW,EACX,GAAG,KAAK,EACT,EAAE,WAAW,2CAgEb;kBAvEQ,MAAM;;;AA2Ef;;GAEG;AACH,iBAAS,WAAW,CAClB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAG1D;kBAJQ,WAAW;;;AAQpB;;GAEG;AACH,iBAAS,WAAW,CAClB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAG1D;kBAJQ,WAAW;;;
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.tsx"],"names":[],"mappings":"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"}
|
package/dist/select.js
CHANGED
|
@@ -12,13 +12,13 @@ function T({
|
|
|
12
12
|
onOpenChange: l,
|
|
13
13
|
open: s,
|
|
14
14
|
defaultOpen: d,
|
|
15
|
-
...
|
|
15
|
+
...f
|
|
16
16
|
}) {
|
|
17
|
-
const [a,
|
|
17
|
+
const [a, p] = c.useState(
|
|
18
18
|
d ?? !1
|
|
19
|
-
), u = s !== void 0, i = u ? s : a,
|
|
19
|
+
), u = s !== void 0, i = u ? s : a, m = c.useCallback(
|
|
20
20
|
(h) => {
|
|
21
|
-
u ||
|
|
21
|
+
u || p(h), l?.(h);
|
|
22
22
|
},
|
|
23
23
|
[u, l]
|
|
24
24
|
), b = c.useRef(r);
|
|
@@ -36,8 +36,8 @@ function T({
|
|
|
36
36
|
"data-slot": "select",
|
|
37
37
|
defaultOpen: d,
|
|
38
38
|
open: s,
|
|
39
|
-
onOpenChange:
|
|
40
|
-
...
|
|
39
|
+
onOpenChange: m,
|
|
40
|
+
...f,
|
|
41
41
|
children: e
|
|
42
42
|
}
|
|
43
43
|
);
|
|
@@ -59,8 +59,9 @@ const B = k([
|
|
|
59
59
|
"border border-border rounded-sm outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
|
|
60
60
|
"bg-neutral-50 border-neutral-300",
|
|
61
61
|
"dark:bg-white/5 dark:border-white/15",
|
|
62
|
-
// Typography
|
|
63
|
-
|
|
62
|
+
// Typography — text-body (16px) per the Figma form-field example: the select
|
|
63
|
+
// sits beside inputs and both are values, so both are body (DS-921).
|
|
64
|
+
"text-body text-foreground",
|
|
64
65
|
// Text truncation for long content (shadcn default behavior)
|
|
65
66
|
"[&>span]:block [&>span]:truncate",
|
|
66
67
|
// Placeholder state
|
|
@@ -81,18 +82,18 @@ function L({
|
|
|
81
82
|
placeholder: l,
|
|
82
83
|
dataHook: s,
|
|
83
84
|
error: d,
|
|
84
|
-
selectLabel:
|
|
85
|
+
selectLabel: f,
|
|
85
86
|
...a
|
|
86
87
|
}) {
|
|
87
|
-
const
|
|
88
|
+
const p = d || a["aria-invalid"] === !0 || a["aria-invalid"] === "true", u = a["aria-required"] === !0 || a["aria-required"] === "true", i = a["aria-label"] || f || l || "Select an option", m = p ? "border-destructive-40 dark:border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive" : "";
|
|
88
89
|
return /* @__PURE__ */ g(
|
|
89
90
|
o.Trigger,
|
|
90
91
|
{
|
|
91
92
|
...a,
|
|
92
|
-
"aria-invalid":
|
|
93
|
+
"aria-invalid": p ? "true" : void 0,
|
|
93
94
|
"aria-label": i,
|
|
94
95
|
"aria-required": u ? "true" : void 0,
|
|
95
|
-
className: n(B(),
|
|
96
|
+
className: n(B(), m, e),
|
|
96
97
|
"data-hook": s,
|
|
97
98
|
"data-slot": "select-trigger",
|
|
98
99
|
children: [
|
|
@@ -109,7 +110,7 @@ function _({
|
|
|
109
110
|
position: l = "popper",
|
|
110
111
|
maxHeight: s,
|
|
111
112
|
style: d,
|
|
112
|
-
...
|
|
113
|
+
...f
|
|
113
114
|
}) {
|
|
114
115
|
R();
|
|
115
116
|
const a = c.useRef(null);
|
|
@@ -119,7 +120,7 @@ function _({
|
|
|
119
120
|
Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
120
121
|
[r]
|
|
121
122
|
);
|
|
122
|
-
const
|
|
123
|
+
const p = n(
|
|
123
124
|
// Base appearance
|
|
124
125
|
"relative z-50 overflow-hidden",
|
|
125
126
|
"min-w-[8rem]",
|
|
@@ -142,11 +143,11 @@ Import: import { Combobox } from "@brightlocal/ui-components/combobox"`,
|
|
|
142
143
|
return /* @__PURE__ */ t(o.Portal, { children: /* @__PURE__ */ g(
|
|
143
144
|
o.Content,
|
|
144
145
|
{
|
|
145
|
-
className: n(
|
|
146
|
+
className: n(p, u, e),
|
|
146
147
|
"data-slot": "select-content",
|
|
147
148
|
position: l,
|
|
148
149
|
style: i,
|
|
149
|
-
...
|
|
150
|
+
...f,
|
|
150
151
|
children: [
|
|
151
152
|
/* @__PURE__ */ t(x, {}),
|
|
152
153
|
/* @__PURE__ */ t(
|
|
@@ -174,7 +175,7 @@ function q({
|
|
|
174
175
|
o.Label,
|
|
175
176
|
{
|
|
176
177
|
className: n(
|
|
177
|
-
"text-muted-foreground px-2 py-1.5
|
|
178
|
+
"text-muted-foreground text-label-sm px-2 py-1.5",
|
|
178
179
|
e
|
|
179
180
|
),
|
|
180
181
|
"data-slot": "select-label",
|
|
@@ -193,7 +194,7 @@ function D({
|
|
|
193
194
|
"relative flex w-full cursor-default select-none items-center gap-2",
|
|
194
195
|
"rounded py-1.5 pl-2 pr-8",
|
|
195
196
|
// Typography
|
|
196
|
-
"text-
|
|
197
|
+
"text-label text-popover-foreground",
|
|
197
198
|
// Interactive states
|
|
198
199
|
"focus:bg-accent focus:text-accent-foreground",
|
|
199
200
|
"hover:bg-accent/50 hover:text-accent-foreground",
|
package/dist/separator.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),h=require("react"),p=require("class-variance-authority"),d=require("@brightlocal/ui-components/lib/utils");function x(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 c=x(h),N=p.cva("bg-border shrink-0",{variants:{orientation:{horizontal:"h-px border-0",vertical:"w-px"},spacing:{default:"",sm:"",md:"",lg:""}},compoundVariants:[{orientation:"horizontal",spacing:"default",className:"w-full"},{orientation:"horizontal",spacing:"sm",className:"my-2 mx-6 w-auto"},{orientation:"horizontal",spacing:"md",className:"my-4 mx-6 w-auto"},{orientation:"horizontal",spacing:"lg",className:"m-6 w-auto"},{orientation:"vertical",spacing:"default",className:"h-full"},{orientation:"vertical",spacing:"sm",className:"self-stretch mx-2"},{orientation:"vertical",spacing:"md",className:"self-stretch mx-4"},{orientation:"vertical",spacing:"lg",className:"self-stretch mx-6"}],defaultVariants:{orientation:"horizontal",spacing:"default"}}),v=p.cva("flex items-center gap-2",{variants:{spacing:{default:"",sm:"py-2 px-6",md:"py-4 px-6",lg:"p-6"}},defaultVariants:{spacing:"default"}}),o=c.forwardRef(({className:t,orientation:a="horizontal",spacing:e="default",decorative:r=!0,dataHook:n,trackingEl:i,trackingLabel:l,...u},f)=>{const g=r?{role:"none"}:a==="vertical"?{"aria-orientation":"vertical",role:"separator"}:{};return c.createElement(a==="horizontal"?"hr":"div",{ref:f,className:d.cn(N({orientation:a,spacing:e}),t),"data-hook":n,"data-orientation":a,"data-slot":"separator","data-tracking-el":i,"data-tracking-label":l,...g,...u})});o.displayName="Separator";const m=c.forwardRef(({className:t,children:a,spacing:e="default",dataHook:r,trackingEl:n,trackingLabel:i},l)=>s.jsxs("div",{ref:l,className:d.cn(v({spacing:e}),t),"data-hook":r,"data-slot":"separator-with-text","data-tracking-el":n,"data-tracking-label":i,children:[s.jsx(o,{className:"flex-1"}),s.jsx("span",{className:"text-muted-foreground shrink-0
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),h=require("react"),p=require("class-variance-authority"),d=require("@brightlocal/ui-components/lib/utils");function x(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 c=x(h),N=p.cva("bg-border shrink-0",{variants:{orientation:{horizontal:"h-px border-0",vertical:"w-px"},spacing:{default:"",sm:"",md:"",lg:""}},compoundVariants:[{orientation:"horizontal",spacing:"default",className:"w-full"},{orientation:"horizontal",spacing:"sm",className:"my-2 mx-6 w-auto"},{orientation:"horizontal",spacing:"md",className:"my-4 mx-6 w-auto"},{orientation:"horizontal",spacing:"lg",className:"m-6 w-auto"},{orientation:"vertical",spacing:"default",className:"h-full"},{orientation:"vertical",spacing:"sm",className:"self-stretch mx-2"},{orientation:"vertical",spacing:"md",className:"self-stretch mx-4"},{orientation:"vertical",spacing:"lg",className:"self-stretch mx-6"}],defaultVariants:{orientation:"horizontal",spacing:"default"}}),v=p.cva("flex items-center gap-2",{variants:{spacing:{default:"",sm:"py-2 px-6",md:"py-4 px-6",lg:"p-6"}},defaultVariants:{spacing:"default"}}),o=c.forwardRef(({className:t,orientation:a="horizontal",spacing:e="default",decorative:r=!0,dataHook:n,trackingEl:i,trackingLabel:l,...u},f)=>{const g=r?{role:"none"}:a==="vertical"?{"aria-orientation":"vertical",role:"separator"}:{};return c.createElement(a==="horizontal"?"hr":"div",{ref:f,className:d.cn(N({orientation:a,spacing:e}),t),"data-hook":n,"data-orientation":a,"data-slot":"separator","data-tracking-el":i,"data-tracking-label":l,...g,...u})});o.displayName="Separator";const m=c.forwardRef(({className:t,children:a,spacing:e="default",dataHook:r,trackingEl:n,trackingLabel:i},l)=>s.jsxs("div",{ref:l,className:d.cn(v({spacing:e}),t),"data-hook":r,"data-slot":"separator-with-text","data-tracking-el":n,"data-tracking-label":i,children:[s.jsx(o,{className:"flex-1"}),s.jsx("span",{className:"text-body-sm text-muted-foreground shrink-0 leading-none whitespace-nowrap",children:a}),s.jsx(o,{className:"flex-1"})]}));m.displayName="SeparatorWithText";exports.Separator=o;exports.SeparatorWithText=m;
|