@brightlocal/ui-components 3.0.0 → 3.2.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 +749 -53
- package/deprecations.json +114 -4
- 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.d.ts +32 -3
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +61 -58
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +58 -57
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +9 -0
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +50 -30
- package/dist/banner.cjs +1 -0
- package/dist/banner.d.ts +81 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +176 -0
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +4 -3
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +50 -57
- package/dist/blocks/progress-state.d.ts +2 -2
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +17 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +8 -2
- package/dist/brand-illustration-motif.d.ts +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 +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +105 -7
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +198 -101
- package/dist/chart.cjs +3 -3
- package/dist/chart.d.ts +270 -24
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +497 -322
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +2 -1
- 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 +95 -81
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +2 -2
- 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 +251 -225
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +201 -23
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +712 -568
- 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/field.cjs +1 -1
- package/dist/field.d.ts +8 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +79 -52
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +105 -13
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +146 -129
- package/dist/grid.d.ts +26 -3
- package/dist/grid.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +1 -0
- package/dist/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.js +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +594 -553
- package/dist/info-tooltip.cjs +1 -0
- package/dist/info-tooltip.d.ts +39 -0
- package/dist/info-tooltip.d.ts.map +1 -0
- package/dist/info-tooltip.js +41 -0
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +1 -1
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +33 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +167 -54
- 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 +45 -15
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +31 -30
- package/dist/input.cjs +1 -1
- package/dist/input.js +10 -10
- package/dist/lib/block-illustration.cjs +1 -1
- package/dist/lib/block-illustration.d.ts +4 -1
- package/dist/lib/block-illustration.d.ts.map +1 -1
- package/dist/lib/block-illustration.js +12 -11
- 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/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +4 -3
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/multi-select-filter.cjs +1 -0
- package/dist/multi-select-filter.d.ts +178 -0
- package/dist/multi-select-filter.d.ts.map +1 -0
- package/dist/multi-select-filter.js +463 -0
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +3 -0
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +57 -57
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +123 -16
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +89 -75
- package/dist/rating.cjs +1 -1
- package/dist/rating.js +18 -18
- package/dist/relative-date.cjs +1 -0
- package/dist/relative-date.d.ts +65 -0
- package/dist/relative-date.d.ts.map +1 -0
- package/dist/relative-date.js +128 -0
- 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 +24 -3
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +130 -110
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +78 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +192 -85
- package/dist/single-select-filter.cjs +1 -0
- package/dist/single-select-filter.d.ts +81 -0
- package/dist/single-select-filter.d.ts.map +1 -0
- package/dist/single-select-filter.js +226 -0
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +22 -22
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +13 -13
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +45 -4
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +90 -73
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +12 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +148 -126
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts +38 -36
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +262 -73
- package/dist/typography-heading.cjs +1 -1
- package/dist/typography-heading.d.ts +13 -0
- package/dist/typography-heading.d.ts.map +1 -1
- package/dist/typography-heading.js +32 -21
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +15 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +35 -24
- package/dist/typography.d.ts +1 -1
- package/package.json +5 -6
- package/src/blocks/empty-state.tsx +17 -24
- package/src/blocks/progress-state.tsx +2 -2
- package/src/blocks/sidebar.tsx +26 -2
- package/src/components/accordion.tsx +82 -27
- package/src/components/alert-dialog.tsx +50 -5
- package/src/components/alert.tsx +16 -8
- package/src/components/badge.tsx +40 -3
- package/src/components/banner.tsx +288 -0
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/button-group.tsx +112 -0
- package/src/components/button.tsx +1 -1
- package/src/components/card.tsx +249 -27
- package/src/components/chart.tsx +586 -53
- package/src/components/checkbox.tsx +1 -1
- package/src/components/chip.tsx +83 -10
- package/src/components/combobox.tsx +2 -2
- package/src/components/command.tsx +56 -4
- package/src/components/data-table.tsx +842 -199
- package/src/components/date-picker.tsx +18 -7
- package/src/components/field.tsx +81 -12
- package/src/components/global-layout.tsx +176 -38
- package/src/components/grid.tsx +34 -3
- package/src/components/info-tooltip.tsx +94 -0
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +246 -11
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +56 -22
- package/src/components/input.tsx +1 -1
- package/src/components/list.tsx +1 -1
- package/src/components/multi-select-filter.tsx +912 -0
- package/src/components/pagination.tsx +10 -3
- package/src/components/progress.tsx +190 -31
- package/src/components/rating.tsx +1 -1
- package/src/components/relative-date.tsx +230 -0
- package/src/components/scroll-area.tsx +23 -10
- package/src/components/select.tsx +65 -11
- package/src/components/sheet.tsx +240 -4
- package/src/components/single-select-filter.tsx +443 -0
- package/src/components/sonner.tsx +16 -5
- package/src/components/split-layout.tsx +2 -2
- package/src/components/table.tsx +71 -11
- package/src/components/tabs.tsx +93 -46
- package/src/components/textarea.tsx +1 -1
- package/src/components/tooltip.tsx +440 -68
- package/src/components/typography-heading.tsx +24 -0
- package/src/components/typography-text.tsx +27 -3
- package/src/components/typography.tsx +1 -1
- package/src/hooks/use-breakpoint.ts +2 -1
- package/src/index.ts +6 -0
- package/src/lib/block-illustration.tsx +5 -1
- package/src/lib/empty-chip.ts +24 -0
- package/src/lib/utils.ts +1 -0
package/dist/progress.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx 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 a, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import * as N from "react";
|
|
3
|
+
import * as R from "@radix-ui/react-progress";
|
|
4
|
+
import { motion as H } from "framer-motion";
|
|
5
|
+
import { cn as n } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { usePrefersReducedMotion as O } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
|
|
7
|
+
import { SPRING_GENTLE as V } from "./lib/motion.js";
|
|
8
|
+
const L = {
|
|
9
9
|
sm: { text: "text-body-sm", bar: "h-2" },
|
|
10
10
|
md: { text: "text-body", bar: "h-3" }
|
|
11
|
-
},
|
|
11
|
+
}, P = {
|
|
12
12
|
green: {
|
|
13
13
|
track: "bg-brand-primary-foreground/20",
|
|
14
14
|
indicator: "bg-green-400"
|
|
@@ -25,126 +25,140 @@ const k = {
|
|
|
25
25
|
track: "bg-brand-yellow/20",
|
|
26
26
|
indicator: "bg-brand-yellow"
|
|
27
27
|
}
|
|
28
|
-
},
|
|
29
|
-
function
|
|
30
|
-
if (
|
|
28
|
+
}, Y = "40%";
|
|
29
|
+
function F(t, e, r) {
|
|
30
|
+
if (t == null)
|
|
31
31
|
return "–";
|
|
32
32
|
if (r === "%")
|
|
33
|
-
return `${
|
|
34
|
-
const
|
|
35
|
-
return
|
|
33
|
+
return `${e > 0 ? Math.min(100, Math.max(0, Math.round(t / e * 100))) : 0}%`;
|
|
34
|
+
const i = r ? ` ${r}` : "";
|
|
35
|
+
return e > 0 ? `${t} / ${e}${i}` : `${t}${i}`;
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const U = N.forwardRef(
|
|
38
38
|
({
|
|
39
|
-
className:
|
|
40
|
-
value:
|
|
39
|
+
className: t,
|
|
40
|
+
value: e,
|
|
41
41
|
max: r = 100,
|
|
42
|
-
dataHook:
|
|
43
|
-
trackingEl:
|
|
44
|
-
trackingLabel:
|
|
45
|
-
ariaLabel:
|
|
46
|
-
label:
|
|
47
|
-
labelWidth:
|
|
48
|
-
color:
|
|
49
|
-
size:
|
|
50
|
-
showValue:
|
|
51
|
-
unit:
|
|
52
|
-
|
|
42
|
+
dataHook: i,
|
|
43
|
+
trackingEl: m,
|
|
44
|
+
trackingLabel: S,
|
|
45
|
+
ariaLabel: T = "Progress",
|
|
46
|
+
label: o,
|
|
47
|
+
labelWidth: f = Y,
|
|
48
|
+
color: $ = "green",
|
|
49
|
+
size: E = "sm",
|
|
50
|
+
showValue: l = !1,
|
|
51
|
+
unit: I = "%",
|
|
52
|
+
valueFormatter: M,
|
|
53
|
+
indicatorClassName: _,
|
|
53
54
|
disabled: p,
|
|
54
|
-
...
|
|
55
|
-
},
|
|
56
|
-
const
|
|
57
|
-
|
|
55
|
+
...z
|
|
56
|
+
}, B) => {
|
|
57
|
+
const u = N.useId(), s = o != null && o !== "", b = typeof o == "string" || typeof o == "number", h = s && b, d = M ?? ((D, G) => F(D, G, I)), w = d(e, r), j = O(), y = P[$] ?? P.green, c = L[E] ?? L.sm, g = f === "auto", A = s || l, v = Math.min(r, Math.max(0, e ?? 0)), C = r > 0 ? v / r * 100 : 0, x = /* @__PURE__ */ a(
|
|
58
|
+
R.Root,
|
|
58
59
|
{
|
|
59
|
-
ref:
|
|
60
|
-
"aria-label":
|
|
61
|
-
"aria-labelledby":
|
|
62
|
-
className:
|
|
60
|
+
ref: B,
|
|
61
|
+
"aria-label": h ? void 0 : T,
|
|
62
|
+
"aria-labelledby": h ? u : void 0,
|
|
63
|
+
className: n(
|
|
63
64
|
"relative w-full overflow-hidden rounded-full",
|
|
64
65
|
// Inside the row wrapper the bar fills whatever the fixed label and
|
|
65
66
|
// value columns leave over; standalone it must not flex at all.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
!
|
|
70
|
-
|
|
67
|
+
A && "min-w-0 flex-1",
|
|
68
|
+
c.bar,
|
|
69
|
+
y.track,
|
|
70
|
+
!s && !l && p && "opacity-50",
|
|
71
|
+
t
|
|
71
72
|
),
|
|
72
|
-
"data-hook":
|
|
73
|
+
"data-hook": i,
|
|
73
74
|
"data-slot": "progress",
|
|
74
|
-
"data-tracking-el":
|
|
75
|
-
"data-tracking-label":
|
|
75
|
+
"data-tracking-el": m,
|
|
76
|
+
"data-tracking-label": S,
|
|
77
|
+
getValueLabel: () => w,
|
|
76
78
|
max: r,
|
|
77
|
-
value:
|
|
78
|
-
...
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
|
|
79
|
+
value: v,
|
|
80
|
+
...z,
|
|
81
|
+
children: /* @__PURE__ */ a(R.Indicator, { asChild: !0, children: /* @__PURE__ */ a(
|
|
82
|
+
H.div,
|
|
81
83
|
{
|
|
82
84
|
animate: {
|
|
83
|
-
transform: `translateX(-${100 -
|
|
85
|
+
transform: `translateX(-${100 - C}%)`
|
|
84
86
|
},
|
|
85
|
-
className:
|
|
87
|
+
className: n(
|
|
86
88
|
"h-full w-full flex-1",
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
y.indicator,
|
|
90
|
+
_
|
|
89
91
|
),
|
|
90
92
|
"data-slot": "progress-indicator",
|
|
91
93
|
initial: !1,
|
|
92
|
-
transition:
|
|
94
|
+
transition: j ? { duration: 0 } : V
|
|
93
95
|
}
|
|
94
96
|
) })
|
|
95
97
|
}
|
|
96
98
|
);
|
|
97
|
-
return !
|
|
99
|
+
return !s && !l ? x : /* @__PURE__ */ k(
|
|
98
100
|
"div",
|
|
99
101
|
{
|
|
100
|
-
className:
|
|
102
|
+
className: n(
|
|
101
103
|
"flex w-full items-center gap-2",
|
|
102
104
|
p && "opacity-50"
|
|
103
105
|
),
|
|
104
106
|
"data-slot": "progress-wrapper",
|
|
105
107
|
children: [
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
+
s && /* @__PURE__ */ a(
|
|
109
|
+
"div",
|
|
108
110
|
{
|
|
109
|
-
className:
|
|
111
|
+
className: n(
|
|
110
112
|
"text-foreground shrink-0 break-words",
|
|
111
113
|
// `auto`: hug the text but never take more than 40% of the row,
|
|
112
114
|
// so an overlong label still wraps instead of squeezing the bar.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
g && "max-w-2/5",
|
|
116
|
+
// A node label (Rating, icon) sits on the row's centre line like
|
|
117
|
+
// text would; text keeps inline flow so it can wrap.
|
|
118
|
+
!b && "flex items-center",
|
|
119
|
+
c.text
|
|
115
120
|
),
|
|
116
|
-
"data-label-width":
|
|
121
|
+
"data-label-width": g ? "auto" : void 0,
|
|
117
122
|
"data-slot": "progress-label",
|
|
118
|
-
id:
|
|
119
|
-
style:
|
|
120
|
-
children:
|
|
123
|
+
id: u,
|
|
124
|
+
style: g ? void 0 : { width: f },
|
|
125
|
+
children: o
|
|
121
126
|
}
|
|
122
127
|
),
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
x,
|
|
129
|
+
l && /* @__PURE__ */ k(
|
|
125
130
|
"span",
|
|
126
131
|
{
|
|
127
|
-
className:
|
|
132
|
+
className: n(
|
|
128
133
|
"text-muted-foreground grid min-w-10 shrink-0 text-right tabular-nums",
|
|
129
|
-
|
|
134
|
+
c.text
|
|
130
135
|
),
|
|
131
136
|
"data-slot": "progress-value",
|
|
132
137
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ a(
|
|
134
139
|
"span",
|
|
135
140
|
{
|
|
136
141
|
"aria-hidden": "true",
|
|
137
142
|
className: "invisible col-start-1 row-start-1",
|
|
138
143
|
"data-slot": "progress-value-sizer",
|
|
139
|
-
children:
|
|
144
|
+
children: d(r, r)
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ a(
|
|
148
|
+
"span",
|
|
149
|
+
{
|
|
150
|
+
"aria-hidden": "true",
|
|
151
|
+
className: "invisible col-start-1 row-start-1",
|
|
152
|
+
"data-slot": "progress-value-sizer-min",
|
|
153
|
+
children: d(0, r)
|
|
140
154
|
}
|
|
141
155
|
),
|
|
142
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ a(
|
|
143
157
|
"span",
|
|
144
158
|
{
|
|
145
159
|
className: "col-start-1 row-start-1",
|
|
146
160
|
"data-slot": "progress-value-text",
|
|
147
|
-
children:
|
|
161
|
+
children: w
|
|
148
162
|
}
|
|
149
163
|
)
|
|
150
164
|
]
|
|
@@ -155,7 +169,7 @@ const C = y.forwardRef(
|
|
|
155
169
|
);
|
|
156
170
|
}
|
|
157
171
|
);
|
|
158
|
-
|
|
172
|
+
U.displayName = "Progress";
|
|
159
173
|
export {
|
|
160
|
-
|
|
174
|
+
U as Progress
|
|
161
175
|
};
|
package/dist/rating.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 i=require("react/jsx-runtime"),h=require("react"),d=require("@brightlocal/icons"),y=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 v=S(h),N={sm:16,md:24},u=v.forwardRef(({value:t,dataHook:a,size:e="sm",ariaLabel:r,trackingEl:g,trackingLabel:m,className:f,...p},b)=>{const s=Math.max(0,Math.min(5,t)),o=N[e];return i.jsx("div",{ref:b,"aria-label":r?r.replace("{value}",String(s)):`Rating: ${s} out of 5 stars`,className:y.cn("flex items-center gap-0.5",f),"data-hook":a,"data-slot":"rating","data-tracking-el":g,"data-tracking-label":m,role:"img",...p,children:[...Array(5)].map((k,n)=>{const j=n+1,l=s>=j,c=!l&&s>n,R=c?((s-n)*100).toFixed(0):l?"100":"0";return i.jsxs("div",{className:"relative","data-slot":"rating-star",children:[i.jsx(d.StarRating,{className:"fill-muted stroke-muted","data-slot":"rating-star-base",size:o}),(l||c)&&i.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 overflow-hidden","data-slot":"rating-star-fill",style:{width:`${R}%`},children:i.jsx(d.StarRating,{className:"fill-rating stroke-rating",size:o})})]},n)})})});u.displayName="Rating";exports.Rating=u;
|
package/dist/rating.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as e, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import * as R from "react";
|
|
3
3
|
import { StarRating as o } from "@brightlocal/icons";
|
|
4
|
-
import { cn as
|
|
5
|
-
const
|
|
4
|
+
import { cn as k } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
const y = {
|
|
6
6
|
sm: 16,
|
|
7
7
|
md: 24
|
|
8
|
-
},
|
|
8
|
+
}, z = R.forwardRef(
|
|
9
9
|
({
|
|
10
10
|
value: n,
|
|
11
11
|
dataHook: m,
|
|
12
12
|
size: c = "sm",
|
|
13
|
-
ariaLabel:
|
|
13
|
+
ariaLabel: s,
|
|
14
14
|
trackingEl: d,
|
|
15
15
|
trackingLabel: g,
|
|
16
16
|
className: f,
|
|
17
17
|
...p
|
|
18
18
|
}, u) => {
|
|
19
|
-
const a = Math.max(0, Math.min(5, n)),
|
|
19
|
+
const a = Math.max(0, Math.min(5, n)), i = y[c];
|
|
20
20
|
return /* @__PURE__ */ e(
|
|
21
21
|
"div",
|
|
22
22
|
{
|
|
23
23
|
ref: u,
|
|
24
|
-
"aria-label":
|
|
25
|
-
className:
|
|
24
|
+
"aria-label": s ? s.replace("{value}", String(a)) : `Rating: ${a} out of 5 stars`,
|
|
25
|
+
className: k("flex items-center gap-0.5", f),
|
|
26
26
|
"data-hook": m,
|
|
27
27
|
"data-slot": "rating",
|
|
28
28
|
"data-tracking-el": d,
|
|
29
29
|
"data-tracking-label": g,
|
|
30
30
|
role: "img",
|
|
31
31
|
...p,
|
|
32
|
-
children: [...Array(5)].map((
|
|
33
|
-
const h = t + 1,
|
|
34
|
-
return /* @__PURE__ */
|
|
32
|
+
children: [...Array(5)].map((S, t) => {
|
|
33
|
+
const h = t + 1, r = a >= h, l = !r && a > t, v = l ? ((a - t) * 100).toFixed(0) : r ? "100" : "0";
|
|
34
|
+
return /* @__PURE__ */ N("div", { className: "relative", "data-slot": "rating-star", children: [
|
|
35
35
|
/* @__PURE__ */ e(
|
|
36
36
|
o,
|
|
37
37
|
{
|
|
38
38
|
className: "fill-muted stroke-muted",
|
|
39
39
|
"data-slot": "rating-star-base",
|
|
40
|
-
size:
|
|
40
|
+
size: i
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
|
-
(
|
|
43
|
+
(r || l) && /* @__PURE__ */ e(
|
|
44
44
|
"div",
|
|
45
45
|
{
|
|
46
46
|
"aria-hidden": "true",
|
|
@@ -52,8 +52,8 @@ const k = {
|
|
|
52
52
|
children: /* @__PURE__ */ e(
|
|
53
53
|
o,
|
|
54
54
|
{
|
|
55
|
-
className: "fill-
|
|
56
|
-
size:
|
|
55
|
+
className: "fill-rating stroke-rating",
|
|
56
|
+
size: i
|
|
57
57
|
}
|
|
58
58
|
)
|
|
59
59
|
}
|
|
@@ -64,7 +64,7 @@ const k = {
|
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
|
-
|
|
67
|
+
z.displayName = "Rating";
|
|
68
68
|
export {
|
|
69
|
-
|
|
69
|
+
z as Rating
|
|
70
70
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),h=require("react"),w=require("@brightlocal/ui-components/lib/utils"),l=require("@brightlocal/ui-components/tooltip"),D={justNow:"just now",minuteAgo:"1 minute ago",minutesAgo:"{n} minutes ago",hourAgo:"1 hour ago",hoursAgo:"{n} hours ago",today:"today",yesterday:"yesterday",daysAgo:"{n} days ago",unknown:"unknown"},T=1e3,M=60*T,$=60*M,E=24*$,v=/^\d{4}-\d{2}-\d{2}$/;function m(t){return typeof t=="string"&&v.test(t)}function x(t){return t instanceof Date?t:new Date(m(t)?`${t}T00:00:00`:t)}const L=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),f=(t,n)=>t.replace("{n}",String(n));function y(t,n=new Date){return t.toLocaleDateString("en-US",{month:"long",day:"numeric",...t.getFullYear()===n.getFullYear()?{}:{year:"numeric"}})}function j(t,n){const e=t.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"});if(n)return e;const i=t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}),o=-t.getTimezoneOffset(),r=o>=0?"+":"-",c=Math.floor(Math.abs(o)/60),a=Math.abs(o)%60,u=`${r}${c}${a?`:${String(a).padStart(2,"0")}`:""}`;return`${e} at ${i} UTC${u}`}function p(t,n,e=D){const i=x(t);if(m(t)){const d=Math.max(0,Math.round((L(n)-L(i))/E));return d===0?e.today:d===1?e.yesterday:d<7?f(e.daysAgo,d):y(i,n)}const o=Math.max(0,n.getTime()-i.getTime()),r=o/T,c=o/M,a=o/$,u=o/E;return r<45?e.justNow:r<90?e.minuteAgo:c<45?f(e.minutesAgo,Math.round(c)):c<90?e.hourAgo:a<22?f(e.hoursAgo,Math.round(a)):a<36?e.yesterday:u<7?f(e.daysAgo,Math.round(u)):y(i,n)}function N(t=30*T){const[n,e]=h.useState(()=>new Date);return h.useEffect(()=>{const i=()=>e(new Date),o=window.setInterval(i,t),r=()=>{document.visibilityState==="visible"&&i()};return document.addEventListener("visibilitychange",r),()=>{window.clearInterval(o),document.removeEventListener("visibilitychange",r)}},[t]),n}const R=h.forwardRef(function({value:n,label:e,labels:i,className:o,dataHook:r,trackingEl:c,trackingLabel:a},u){const d=N(),S={...D,...i};if(n==null)return s.jsxs("span",{ref:u,className:w.cn("text-body-xs text-muted-foreground",o),"data-hook":r,"data-slot":"relative-date","data-tracking-el":c,"data-tracking-label":a,children:[e&&s.jsxs(s.Fragment,{children:[e," "]}),S.unknown]});const A=m(n),g=x(n),O=A?`${g.getFullYear()}-${String(g.getMonth()+1).padStart(2,"0")}-${String(g.getDate()).padStart(2,"0")}`:g.toISOString();return s.jsxs("span",{ref:u,className:w.cn("text-body-xs text-muted-foreground",o),"data-hook":r,"data-slot":"relative-date","data-tracking-el":c,"data-tracking-label":a,children:[e&&s.jsxs(s.Fragment,{children:[e," "]}),s.jsxs(l.Tooltip,{children:[s.jsx(l.TooltipTrigger,{className:"focus-visible:shadow-default cursor-default rounded-xs underline decoration-dotted decoration-1 underline-offset-4 focus-visible:outline-none",dataHook:`${r}-trigger`,children:s.jsx("time",{dateTime:O,children:p(n,d,S)})}),s.jsx(l.TooltipContent,{dataHook:`${r}-tooltip`,side:"bottom",children:j(g,A)})]})]})});exports.DEFAULT_RELATIVE_DATE_LABELS=D;exports.RelativeDate=R;exports.dateLabel=y;exports.exactText=j;exports.isDateOnly=m;exports.relativeWords=p;exports.toDate=x;exports.useNow=N;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface RelativeDateLabels {
|
|
2
|
+
/** @default "just now" */
|
|
3
|
+
justNow: string;
|
|
4
|
+
/** @default "1 minute ago" */
|
|
5
|
+
minuteAgo: string;
|
|
6
|
+
/**
|
|
7
|
+
* `{n}` is replaced with the count.
|
|
8
|
+
* @default "{n} minutes ago"
|
|
9
|
+
*/
|
|
10
|
+
minutesAgo: string;
|
|
11
|
+
/** @default "1 hour ago" */
|
|
12
|
+
hourAgo: string;
|
|
13
|
+
/**
|
|
14
|
+
* `{n}` is replaced with the count.
|
|
15
|
+
* @default "{n} hours ago"
|
|
16
|
+
*/
|
|
17
|
+
hoursAgo: string;
|
|
18
|
+
/** @default "today" */
|
|
19
|
+
today: string;
|
|
20
|
+
/** @default "yesterday" */
|
|
21
|
+
yesterday: string;
|
|
22
|
+
/**
|
|
23
|
+
* `{n}` is replaced with the count.
|
|
24
|
+
* @default "{n} days ago"
|
|
25
|
+
*/
|
|
26
|
+
daysAgo: string;
|
|
27
|
+
/** @default "unknown" */
|
|
28
|
+
unknown: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const DEFAULT_RELATIVE_DATE_LABELS: RelativeDateLabels;
|
|
31
|
+
export interface RelativeDateProps {
|
|
32
|
+
/**
|
|
33
|
+
* When it happened. An ISO 8601 timestamp (UTC from the API) or a Date for
|
|
34
|
+
* a value with a time of day; a plain `YYYY-MM-DD` string for a calendar
|
|
35
|
+
* date with no time of day. `null` or `undefined` renders the `unknown`
|
|
36
|
+
* label, plain.
|
|
37
|
+
*/
|
|
38
|
+
value: string | Date | null | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Contextual label rendered before the value (e.g. "Last updated").
|
|
41
|
+
* The component owns its styling — consumers never need to style it.
|
|
42
|
+
*/
|
|
43
|
+
label?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Translatable words. Each key defaults to its English value.
|
|
46
|
+
* @default DEFAULT_RELATIVE_DATE_LABELS
|
|
47
|
+
*/
|
|
48
|
+
labels?: Partial<RelativeDateLabels>;
|
|
49
|
+
/** Outer layout only (margin, placement). The look is the component's. */
|
|
50
|
+
className?: string;
|
|
51
|
+
/** Required test hook identifier */
|
|
52
|
+
dataHook: string;
|
|
53
|
+
/** Analytics element identifier */
|
|
54
|
+
trackingEl?: string;
|
|
55
|
+
/** Analytics label */
|
|
56
|
+
trackingLabel?: string;
|
|
57
|
+
}
|
|
58
|
+
export declare function isDateOnly(value: string | Date): boolean;
|
|
59
|
+
export declare function toDate(value: string | Date): Date;
|
|
60
|
+
export declare function dateLabel(date: Date, now?: Date): string;
|
|
61
|
+
export declare function exactText(date: Date, dateOnly: boolean): string;
|
|
62
|
+
export declare function relativeWords(value: string | Date, now: Date, labels?: RelativeDateLabels): string;
|
|
63
|
+
export declare function useNow(every?: number): Date;
|
|
64
|
+
export declare const RelativeDate: import('react').ForwardRefExoticComponent<RelativeDateProps & import('react').RefAttributes<HTMLElement>>;
|
|
65
|
+
//# sourceMappingURL=relative-date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relative-date.d.ts","sourceRoot":"","sources":["../../src/components/relative-date.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,4BAA4B,EAAE,kBAU1C,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACrC,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAQD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAExD;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAGjD;AAOD,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,OAAa,GAAG,MAAM,CAM9D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAiB/D;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,GAAG,EAAE,IAAI,EACT,MAAM,GAAE,kBAAiD,GACxD,MAAM,CAyBR;AAED,wBAAgB,MAAM,CAAC,KAAK,SAAc,GAAG,IAAI,CAehD;AAED,eAAO,MAAM,YAAY,2GAsDxB,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsxs as g, Fragment as w, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as N, useState as O, useEffect as k } from "react";
|
|
3
|
+
import { cn as S } from "@brightlocal/ui-components/lib/utils";
|
|
4
|
+
import { Tooltip as U, TooltipTrigger as v, TooltipContent as F } from "@brightlocal/ui-components/tooltip";
|
|
5
|
+
const x = {
|
|
6
|
+
justNow: "just now",
|
|
7
|
+
minuteAgo: "1 minute ago",
|
|
8
|
+
minutesAgo: "{n} minutes ago",
|
|
9
|
+
hourAgo: "1 hour ago",
|
|
10
|
+
hoursAgo: "{n} hours ago",
|
|
11
|
+
today: "today",
|
|
12
|
+
yesterday: "yesterday",
|
|
13
|
+
daysAgo: "{n} days ago",
|
|
14
|
+
unknown: "unknown"
|
|
15
|
+
}, h = 1e3, $ = 60 * h, M = 60 * $, T = 24 * M, Y = /^\d{4}-\d{2}-\d{2}$/;
|
|
16
|
+
function y(t) {
|
|
17
|
+
return typeof t == "string" && Y.test(t);
|
|
18
|
+
}
|
|
19
|
+
function E(t) {
|
|
20
|
+
return t instanceof Date ? t : new Date(y(t) ? `${t}T00:00:00` : t);
|
|
21
|
+
}
|
|
22
|
+
const A = (t) => new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime(), f = (t, e) => t.replace("{n}", String(e));
|
|
23
|
+
function p(t, e = /* @__PURE__ */ new Date()) {
|
|
24
|
+
return t.toLocaleDateString("en-US", {
|
|
25
|
+
month: "long",
|
|
26
|
+
day: "numeric",
|
|
27
|
+
...t.getFullYear() === e.getFullYear() ? {} : { year: "numeric" }
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function j(t, e) {
|
|
31
|
+
const n = t.toLocaleDateString("en-US", {
|
|
32
|
+
month: "long",
|
|
33
|
+
day: "numeric",
|
|
34
|
+
year: "numeric"
|
|
35
|
+
});
|
|
36
|
+
if (e) return n;
|
|
37
|
+
const i = t.toLocaleTimeString("en-US", {
|
|
38
|
+
hour: "numeric",
|
|
39
|
+
minute: "2-digit"
|
|
40
|
+
}), o = -t.getTimezoneOffset(), r = o >= 0 ? "+" : "-", s = Math.floor(Math.abs(o) / 60), a = Math.abs(o) % 60, c = `${r}${s}${a ? `:${String(a).padStart(2, "0")}` : ""}`;
|
|
41
|
+
return `${n} at ${i} UTC${c}`;
|
|
42
|
+
}
|
|
43
|
+
function I(t, e, n = x) {
|
|
44
|
+
const i = E(t);
|
|
45
|
+
if (y(t)) {
|
|
46
|
+
const d = Math.max(
|
|
47
|
+
0,
|
|
48
|
+
Math.round((A(e) - A(i)) / T)
|
|
49
|
+
);
|
|
50
|
+
return d === 0 ? n.today : d === 1 ? n.yesterday : d < 7 ? f(n.daysAgo, d) : p(i, e);
|
|
51
|
+
}
|
|
52
|
+
const o = Math.max(0, e.getTime() - i.getTime()), r = o / h, s = o / $, a = o / M, c = o / T;
|
|
53
|
+
return r < 45 ? n.justNow : r < 90 ? n.minuteAgo : s < 45 ? f(n.minutesAgo, Math.round(s)) : s < 90 ? n.hourAgo : a < 22 ? f(n.hoursAgo, Math.round(a)) : a < 36 ? n.yesterday : c < 7 ? f(n.daysAgo, Math.round(c)) : p(i, e);
|
|
54
|
+
}
|
|
55
|
+
function R(t = 30 * h) {
|
|
56
|
+
const [e, n] = O(() => /* @__PURE__ */ new Date());
|
|
57
|
+
return k(() => {
|
|
58
|
+
const i = () => n(/* @__PURE__ */ new Date()), o = window.setInterval(i, t), r = () => {
|
|
59
|
+
document.visibilityState === "visible" && i();
|
|
60
|
+
};
|
|
61
|
+
return document.addEventListener("visibilitychange", r), () => {
|
|
62
|
+
window.clearInterval(o), document.removeEventListener("visibilitychange", r);
|
|
63
|
+
};
|
|
64
|
+
}, [t]), e;
|
|
65
|
+
}
|
|
66
|
+
const z = N(
|
|
67
|
+
function({ value: e, label: n, labels: i, className: o, dataHook: r, trackingEl: s, trackingLabel: a }, c) {
|
|
68
|
+
const d = R(), l = { ...x, ...i };
|
|
69
|
+
if (e == null)
|
|
70
|
+
return /* @__PURE__ */ g(
|
|
71
|
+
"span",
|
|
72
|
+
{
|
|
73
|
+
ref: c,
|
|
74
|
+
className: S("text-body-xs text-muted-foreground", o),
|
|
75
|
+
"data-hook": r,
|
|
76
|
+
"data-slot": "relative-date",
|
|
77
|
+
"data-tracking-el": s,
|
|
78
|
+
"data-tracking-label": a,
|
|
79
|
+
children: [
|
|
80
|
+
n && /* @__PURE__ */ g(w, { children: [
|
|
81
|
+
n,
|
|
82
|
+
" "
|
|
83
|
+
] }),
|
|
84
|
+
l.unknown
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
const D = y(e), u = E(e), L = D ? `${u.getFullYear()}-${String(u.getMonth() + 1).padStart(2, "0")}-${String(u.getDate()).padStart(2, "0")}` : u.toISOString();
|
|
89
|
+
return /* @__PURE__ */ g(
|
|
90
|
+
"span",
|
|
91
|
+
{
|
|
92
|
+
ref: c,
|
|
93
|
+
className: S("text-body-xs text-muted-foreground", o),
|
|
94
|
+
"data-hook": r,
|
|
95
|
+
"data-slot": "relative-date",
|
|
96
|
+
"data-tracking-el": s,
|
|
97
|
+
"data-tracking-label": a,
|
|
98
|
+
children: [
|
|
99
|
+
n && /* @__PURE__ */ g(w, { children: [
|
|
100
|
+
n,
|
|
101
|
+
" "
|
|
102
|
+
] }),
|
|
103
|
+
/* @__PURE__ */ g(U, { children: [
|
|
104
|
+
/* @__PURE__ */ m(
|
|
105
|
+
v,
|
|
106
|
+
{
|
|
107
|
+
className: "focus-visible:shadow-default cursor-default rounded-xs underline decoration-dotted decoration-1 underline-offset-4 focus-visible:outline-none",
|
|
108
|
+
dataHook: `${r}-trigger`,
|
|
109
|
+
children: /* @__PURE__ */ m("time", { dateTime: L, children: I(e, d, l) })
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ m(F, { dataHook: `${r}-tooltip`, side: "bottom", children: j(u, D) })
|
|
113
|
+
] })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
export {
|
|
120
|
+
x as DEFAULT_RELATIVE_DATE_LABELS,
|
|
121
|
+
z as RelativeDate,
|
|
122
|
+
p as dateLabel,
|
|
123
|
+
j as exactText,
|
|
124
|
+
y as isDateOnly,
|
|
125
|
+
I as relativeWords,
|
|
126
|
+
E as toDate,
|
|
127
|
+
R as useNow
|
|
128
|
+
};
|
package/dist/scroll-area.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 l=require("react/jsx-runtime"),m=require("react"),p=require("@radix-ui/react-scroll-area"),d=require("@brightlocal/ui-components/lib/utils");function u(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(e,a,t.get?t:{enumerable:!0,get:()=>r[a]})}}return e.default=r,Object.freeze(e)}const b=u(m),o=u(p),f=b.forwardRef(({className:r,children:e,dataHook:a,trackingEl:t,trackingLabel:s,scrollOrientation:n="vertical",...i},S)=>l.jsxs(o.Root,{ref:S,className:d.cn("relative",r),"data-hook":a,"data-slot":"scroll-area","data-tracking-el":t,"data-tracking-label":s,...i,children:[l.jsx(o.Viewport,{className:"focus-visible:shadow-default duration-fast size-full rounded-[inherit] p-1 transition-[color,box-shadow] ease-out outline-none","data-slot":"scroll-area-viewport",tabIndex:0,children:e}),l.jsx(c,{}),n==="both"&&l.jsx(c,{orientation:"horizontal"}),l.jsx(o.Corner,{})]}));f.displayName="ScrollArea";const c=b.forwardRef(({className:r,orientation:e="vertical",dataHook:a,trackingEl:t,trackingLabel:s,...n},i)=>l.jsx(o.ScrollAreaScrollbar,{ref:i,className:d.cn("duration-fast flex touch-none p-px transition-colors ease-out select-none",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",r),"data-hook":a,"data-slot":"scroll-area-scrollbar","data-tracking-el":t,"data-tracking-label":s,orientation:e,...n,children:l.jsx(o.ScrollAreaThumb,{className:"bg-border relative flex-1 rounded-full","data-slot":"scroll-area-thumb"})}));c.displayName="ScrollAreaScrollbar";const h=c;exports.ScrollArea=f;exports.ScrollAreaScrollbar=c;exports.ScrollBar=h;
|
package/dist/scroll-area.d.ts
CHANGED
|
@@ -28,9 +28,9 @@ interface ScrollAreaProps extends React.ComponentProps<typeof ScrollAreaPrimitiv
|
|
|
28
28
|
*/
|
|
29
29
|
declare const ScrollArea: React.ForwardRefExoticComponent<Omit<ScrollAreaProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
30
30
|
/**
|
|
31
|
-
* Props for the
|
|
31
|
+
* Props for the ScrollAreaScrollbar component.
|
|
32
32
|
*/
|
|
33
|
-
interface
|
|
33
|
+
interface ScrollAreaScrollbarProps extends React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar> {
|
|
34
34
|
/**
|
|
35
35
|
* Data hook for automated testing
|
|
36
36
|
*/
|
|
@@ -50,9 +50,18 @@ interface ScrollBarProps extends React.ComponentProps<typeof ScrollAreaPrimitive
|
|
|
50
50
|
orientation?: "vertical" | "horizontal";
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* ScrollAreaScrollbar provides a styled scrollbar for ScrollArea.
|
|
54
54
|
*/
|
|
55
|
-
declare const
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
declare const ScrollAreaScrollbar: React.ForwardRefExoticComponent<Omit<ScrollAreaScrollbarProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Use `ScrollAreaScrollbar` instead — family parts carry the
|
|
58
|
+
* `ScrollArea` family prefix (DS-853).
|
|
59
|
+
*/
|
|
60
|
+
declare const ScrollBar: React.ForwardRefExoticComponent<Omit<ScrollAreaScrollbarProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated Use `ScrollAreaScrollbarProps` instead (DS-853).
|
|
63
|
+
*/
|
|
64
|
+
type ScrollBarProps = ScrollAreaScrollbarProps;
|
|
65
|
+
export { ScrollArea, ScrollAreaScrollbar, ScrollBar };
|
|
66
|
+
export type { ScrollAreaProps, ScrollAreaScrollbarProps, ScrollBarProps };
|
|
58
67
|
//# sourceMappingURL=scroll-area.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../src/components/scroll-area.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAGnE;;GAEG;AACH,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CACpD,OAAO,mBAAmB,CAAC,IAAI,CAChC;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CACzC;AAED;;;GAGG;AACH,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../src/components/scroll-area.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAGnE;;GAEG;AACH,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CACpD,OAAO,mBAAmB,CAAC,IAAI,CAChC;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CACzC;AAED;;;GAGG;AACH,QAAA,MAAM,UAAU,qGAyCf,CAAC;AAIF;;GAEG;AACH,UAAU,wBAAyB,SAAQ,KAAK,CAAC,cAAc,CAC7D,OAAO,mBAAmB,CAAC,mBAAmB,CAC/C;IACC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;CACzC;AAED;;GAEG;AACH,QAAA,MAAM,mBAAmB,8GAwCxB,CAAC;AAIF;;;GAGG;AACH,QAAA,MAAM,SAAS,8GAAsB,CAAC;AAEtC;;GAEG;AACH,KAAK,cAAc,GAAG,wBAAwB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAC;AAEtD,YAAY,EAAE,eAAe,EAAE,wBAAwB,EAAE,cAAc,EAAE,CAAC"}
|