@brightlocal/ui-components 3.3.0 → 3.4.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 +1 -1
- package/component-meta.json +248 -13
- package/dist/blocks/input-list.cjs +1 -1
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +39 -39
- package/dist/description-list.cjs +1 -0
- package/dist/description-list.d.ts +142 -0
- package/dist/description-list.d.ts.map +1 -0
- package/dist/description-list.js +173 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +590 -568
- package/dist/lib/motion.cjs +1 -1
- package/dist/lib/motion.js +15 -10
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +217 -40
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +281 -67
- package/dist/route-progress.cjs +1 -1
- package/dist/route-progress.js +24 -23
- package/package.json +3 -3
- package/src/blocks/input-list.tsx +14 -9
- package/src/components/description-list.tsx +445 -0
- package/src/components/list.tsx +683 -72
- package/src/index.ts +1 -0
package/dist/list.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { ChevronRight as B } from "@brightlocal/icons";
|
|
4
|
+
import { cn as d } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
import { jsx as n, jsxs as M } from "react/jsx-runtime";
|
|
6
|
+
import { Slot as g } from "@radix-ui/react-slot";
|
|
7
|
+
import { cva as h } from "class-variance-authority";
|
|
8
|
+
import { Tooltip as P, TooltipContent as H, TooltipTrigger as _ } from "@brightlocal/ui-components/tooltip";
|
|
9
|
+
import { Skeleton as W } from "@brightlocal/ui-components/skeleton";
|
|
10
|
+
var I = h([
|
|
11
|
+
"group/item",
|
|
8
12
|
"flex",
|
|
9
13
|
"gap-4",
|
|
10
14
|
"rounded-lg",
|
|
@@ -13,7 +17,9 @@ var v = u([
|
|
|
13
17
|
"pl-4",
|
|
14
18
|
"transition-colors",
|
|
15
19
|
"duration-fast",
|
|
16
|
-
"ease-out"
|
|
20
|
+
"ease-out",
|
|
21
|
+
"has-[>[data-slot=item-button]]:p-0",
|
|
22
|
+
"has-[>[data-slot=item-link]]:p-0"
|
|
17
23
|
], {
|
|
18
24
|
variants: {
|
|
19
25
|
variant: {
|
|
@@ -35,81 +41,289 @@ var v = u([
|
|
|
35
41
|
variant: "filled",
|
|
36
42
|
align: "center"
|
|
37
43
|
}
|
|
38
|
-
}),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
}), K = h(["flex", "flex-col"], {
|
|
45
|
+
variants: {
|
|
46
|
+
inset: {
|
|
47
|
+
true: ["-mr-2", "-ml-4"],
|
|
48
|
+
false: []
|
|
49
|
+
},
|
|
50
|
+
divided: {
|
|
51
|
+
true: [
|
|
52
|
+
"gap-0",
|
|
53
|
+
"[&>[data-slot=item]]:rounded-none",
|
|
54
|
+
"[&>[data-slot=item]+[data-slot=item]]:border-t",
|
|
55
|
+
"[&>[data-slot=item]+[data-slot=item]]:border-border"
|
|
56
|
+
],
|
|
57
|
+
false: ["gap-2"]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
inset: !1,
|
|
62
|
+
divided: !1
|
|
63
|
+
}
|
|
64
|
+
}), $ = s.forwardRef(({ className: t, dataHook: e, trackingEl: a, trackingLabel: i, inset: r, divided: o, ...l }, m) => /* @__PURE__ */ n("ul", {
|
|
65
|
+
ref: m,
|
|
66
|
+
className: d(K({
|
|
67
|
+
inset: r,
|
|
68
|
+
divided: o
|
|
69
|
+
}), t),
|
|
70
|
+
"data-divided": o ? "" : void 0,
|
|
71
|
+
"data-hook": e,
|
|
42
72
|
"data-slot": "list",
|
|
43
|
-
"data-tracking-el":
|
|
44
|
-
"data-tracking-label":
|
|
45
|
-
...
|
|
73
|
+
"data-tracking-el": a,
|
|
74
|
+
"data-tracking-label": i,
|
|
75
|
+
...l
|
|
46
76
|
}));
|
|
47
|
-
|
|
48
|
-
var N =
|
|
49
|
-
ref:
|
|
50
|
-
className:
|
|
51
|
-
variant:
|
|
52
|
-
align:
|
|
53
|
-
}),
|
|
54
|
-
"data-
|
|
77
|
+
$.displayName = "List";
|
|
78
|
+
var N = s.forwardRef(({ asChild: t = !1, className: e, variant: a, align: i, dataHook: r, trackingEl: o, trackingLabel: l, children: m, ...c }, p) => /* @__PURE__ */ n(t ? g : "li", {
|
|
79
|
+
ref: p,
|
|
80
|
+
className: d(I({
|
|
81
|
+
variant: a,
|
|
82
|
+
align: i
|
|
83
|
+
}), e),
|
|
84
|
+
"data-align": i ?? "center",
|
|
85
|
+
"data-hook": r,
|
|
55
86
|
"data-slot": "item",
|
|
56
|
-
"data-tracking-el":
|
|
57
|
-
"data-tracking-label":
|
|
58
|
-
...
|
|
59
|
-
children:
|
|
87
|
+
"data-tracking-el": o,
|
|
88
|
+
"data-tracking-label": l,
|
|
89
|
+
...c,
|
|
90
|
+
children: a === "loading" ? /* @__PURE__ */ n(W, { className: "h-13 w-full rounded-lg" }) : m
|
|
60
91
|
}));
|
|
61
|
-
N.displayName = "
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
92
|
+
N.displayName = "ListItem";
|
|
93
|
+
var q = h(["shrink-0"], {
|
|
94
|
+
variants: { variant: {
|
|
95
|
+
default: [],
|
|
96
|
+
icon: [
|
|
97
|
+
"inline-flex",
|
|
98
|
+
"size-10",
|
|
99
|
+
"items-center",
|
|
100
|
+
"justify-center",
|
|
101
|
+
"rounded-lg",
|
|
102
|
+
"border",
|
|
103
|
+
"border-border",
|
|
104
|
+
"bg-background"
|
|
105
|
+
],
|
|
106
|
+
image: [
|
|
107
|
+
"size-10",
|
|
108
|
+
"overflow-hidden",
|
|
109
|
+
"rounded-lg",
|
|
110
|
+
"[&_img]:size-full",
|
|
111
|
+
"[&_img]:object-cover"
|
|
112
|
+
]
|
|
113
|
+
} },
|
|
114
|
+
defaultVariants: { variant: "default" }
|
|
115
|
+
}), x = s.forwardRef(({ className: t, variant: e, ...a }, i) => /* @__PURE__ */ n("div", {
|
|
116
|
+
ref: i,
|
|
117
|
+
className: d(q({ variant: e }), t),
|
|
65
118
|
"data-slot": "item-media",
|
|
119
|
+
"data-variant": e ?? "default",
|
|
66
120
|
...a
|
|
67
121
|
}));
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
ref:
|
|
71
|
-
className:
|
|
122
|
+
x.displayName = "ListItemMedia";
|
|
123
|
+
var y = s.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n("div", {
|
|
124
|
+
ref: a,
|
|
125
|
+
className: d("flex min-w-0 flex-1 flex-col gap-1", t),
|
|
72
126
|
"data-slot": "item-content",
|
|
73
|
-
...
|
|
127
|
+
...e
|
|
74
128
|
}));
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
129
|
+
y.displayName = "ListItemContent";
|
|
130
|
+
var G = '[data-slot="item-button"], [data-slot="item-link"]';
|
|
131
|
+
function J(t, e) {
|
|
132
|
+
const [a, i] = s.useState(!1);
|
|
133
|
+
return s.useEffect(() => {
|
|
134
|
+
if (!e || !t) return;
|
|
135
|
+
const r = () => i(t.scrollHeight > t.clientHeight + 1 || t.scrollWidth > t.clientWidth + 1), o = new ResizeObserver(r);
|
|
136
|
+
o.observe(t);
|
|
137
|
+
const l = new MutationObserver(r);
|
|
138
|
+
return l.observe(t, {
|
|
139
|
+
characterData: !0,
|
|
140
|
+
childList: !0,
|
|
141
|
+
subtree: !0
|
|
142
|
+
}), () => {
|
|
143
|
+
o.disconnect(), l.disconnect();
|
|
144
|
+
};
|
|
145
|
+
}, [e, t]), e && t !== null && a;
|
|
146
|
+
}
|
|
147
|
+
function Q(t, e) {
|
|
148
|
+
const [a, i] = s.useState(null), r = e ? t?.closest(G) ?? null : null;
|
|
149
|
+
return s.useEffect(() => {
|
|
150
|
+
if (!r) return;
|
|
151
|
+
const o = () => i(r === document.activeElement && r.matches(":focus-visible") ? r : null), l = () => i(null);
|
|
152
|
+
return o(), r.addEventListener("focus", o), r.addEventListener("blur", l), () => {
|
|
153
|
+
r.removeEventListener("focus", o), r.removeEventListener("blur", l);
|
|
154
|
+
};
|
|
155
|
+
}, [r]), r !== null && a === r;
|
|
156
|
+
}
|
|
157
|
+
var L = s.forwardRef(({ asChild: t = !1, truncate: e = !1, partSlot: a, tooltipSide: i, className: r, children: o, ...l }, m) => {
|
|
158
|
+
const [c, p] = s.useState(null), V = s.useCallback((u) => {
|
|
159
|
+
p(u), typeof m == "function" ? m(u) : m && (m.current = u);
|
|
160
|
+
}, [m]), v = J(c, e), f = Q(c, v), [O, A] = s.useState(!1), [F, b] = s.useState(!1), [j, z] = s.useState(f);
|
|
161
|
+
f !== j && (z(f), f && b(!1));
|
|
162
|
+
const w = /* @__PURE__ */ n(t ? g : "div", {
|
|
163
|
+
ref: V,
|
|
164
|
+
className: d(e && "line-clamp-2", r),
|
|
165
|
+
"data-slot": a,
|
|
166
|
+
"data-truncated": v ? "" : void 0,
|
|
167
|
+
...l,
|
|
168
|
+
children: o
|
|
169
|
+
});
|
|
170
|
+
return v ? /* @__PURE__ */ M(P, {
|
|
171
|
+
open: !F && (O || f),
|
|
172
|
+
onOpenChange: (u) => {
|
|
173
|
+
u && b(!1), A(u);
|
|
174
|
+
},
|
|
175
|
+
children: [/* @__PURE__ */ n(_, {
|
|
176
|
+
asChild: !0,
|
|
177
|
+
onPointerDown: (u) => {
|
|
178
|
+
const k = u.currentTarget;
|
|
179
|
+
u.pointerType === "touch" && (k.closest("button, a, label") || k.tagName === "LABEL") && u.preventDefault();
|
|
180
|
+
},
|
|
181
|
+
children: w
|
|
182
|
+
}), /* @__PURE__ */ n(H, {
|
|
183
|
+
dataHook: `list-${a}-tooltip`,
|
|
184
|
+
side: i,
|
|
185
|
+
sideOffset: 4,
|
|
186
|
+
onEscapeKeyDown: () => b(!0),
|
|
187
|
+
children: o
|
|
188
|
+
})]
|
|
189
|
+
}) : w;
|
|
190
|
+
});
|
|
191
|
+
L.displayName = "TruncatableText";
|
|
192
|
+
var R = s.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n(L, {
|
|
193
|
+
ref: a,
|
|
194
|
+
className: d("text-foreground text-body", t),
|
|
195
|
+
partSlot: "item-title",
|
|
196
|
+
tooltipSide: "top",
|
|
197
|
+
...e
|
|
81
198
|
}));
|
|
82
|
-
|
|
83
|
-
var
|
|
84
|
-
ref:
|
|
85
|
-
className:
|
|
86
|
-
|
|
87
|
-
|
|
199
|
+
R.displayName = "ListItemTitle";
|
|
200
|
+
var C = s.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n(L, {
|
|
201
|
+
ref: a,
|
|
202
|
+
className: d("text-body-sm text-muted-foreground", t),
|
|
203
|
+
partSlot: "item-description",
|
|
204
|
+
tooltipSide: "bottom",
|
|
205
|
+
...e
|
|
88
206
|
}));
|
|
89
|
-
|
|
90
|
-
var
|
|
91
|
-
ref:
|
|
92
|
-
className:
|
|
207
|
+
C.displayName = "ListItemDescription";
|
|
208
|
+
var S = s.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n("div", {
|
|
209
|
+
ref: a,
|
|
210
|
+
className: d("text-muted-foreground flex min-h-9 min-w-9 shrink-0 items-center justify-center gap-2", t),
|
|
93
211
|
"data-slot": "item-actions",
|
|
212
|
+
...e
|
|
213
|
+
}));
|
|
214
|
+
S.displayName = "ListItemActions";
|
|
215
|
+
var T = s.forwardRef(({ className: t, dataHook: e, ...a }, i) => /* @__PURE__ */ n("li", {
|
|
216
|
+
ref: i,
|
|
217
|
+
className: d("text-muted-foreground text-label-sm flex items-center pt-4 pr-2 pb-1 pl-4 first:pt-2", t),
|
|
218
|
+
"data-hook": e,
|
|
219
|
+
"data-slot": "item-subheader",
|
|
94
220
|
...a
|
|
95
221
|
}));
|
|
96
|
-
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
222
|
+
T.displayName = "ListSubheader";
|
|
223
|
+
var E = [
|
|
224
|
+
"flex",
|
|
225
|
+
"w-full",
|
|
226
|
+
"min-w-0",
|
|
227
|
+
"items-center",
|
|
228
|
+
"group-data-[align=start]/item:items-start",
|
|
229
|
+
"gap-4",
|
|
230
|
+
"rounded-[inherit]",
|
|
231
|
+
"py-2",
|
|
232
|
+
"pr-2",
|
|
233
|
+
"pl-4",
|
|
234
|
+
"text-left",
|
|
235
|
+
"cursor-pointer",
|
|
236
|
+
"outline-none",
|
|
237
|
+
"hover:bg-accent",
|
|
238
|
+
"focus-visible:shadow-default",
|
|
239
|
+
"transition-colors",
|
|
240
|
+
"duration-fast",
|
|
241
|
+
"ease-out",
|
|
242
|
+
"disabled:pointer-events-none",
|
|
243
|
+
"disabled:cursor-not-allowed",
|
|
244
|
+
"disabled:opacity-50",
|
|
245
|
+
"aria-disabled:pointer-events-none",
|
|
246
|
+
"aria-disabled:cursor-not-allowed",
|
|
247
|
+
"aria-disabled:opacity-50"
|
|
248
|
+
];
|
|
249
|
+
function D(t, e) {
|
|
250
|
+
const a = t.currentTarget.getAttribute("aria-disabled");
|
|
251
|
+
if (a === "true" || a === "") {
|
|
252
|
+
t.preventDefault(), t.stopPropagation();
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
e?.(t);
|
|
256
|
+
}
|
|
257
|
+
var U = s.forwardRef(({ className: t, type: e = "button", dataHook: a, trackingEl: i, trackingLabel: r, onClickCapture: o, ...l }, m) => /* @__PURE__ */ n("button", {
|
|
258
|
+
ref: m,
|
|
259
|
+
className: d(E, t),
|
|
100
260
|
"data-hook": a,
|
|
101
|
-
"data-slot": "item-
|
|
261
|
+
"data-slot": "item-button",
|
|
262
|
+
"data-tracking-el": i,
|
|
263
|
+
"data-tracking-label": r,
|
|
264
|
+
type: e,
|
|
265
|
+
onClickCapture: (c) => D(c, o),
|
|
266
|
+
...l
|
|
267
|
+
}));
|
|
268
|
+
U.displayName = "ListItemButton";
|
|
269
|
+
var X = s.forwardRef(({ className: t, asChild: e = !1, dataHook: a, trackingEl: i, trackingLabel: r, onClickCapture: o, ...l }, m) => /* @__PURE__ */ n(e ? g : "a", {
|
|
270
|
+
ref: m,
|
|
271
|
+
className: d(E, t),
|
|
272
|
+
"data-hook": a,
|
|
273
|
+
"data-slot": "item-link",
|
|
274
|
+
"data-tracking-el": i,
|
|
275
|
+
"data-tracking-label": r,
|
|
276
|
+
onClickCapture: (c) => D(c, o),
|
|
277
|
+
...l
|
|
278
|
+
}));
|
|
279
|
+
X.displayName = "ListItemLink";
|
|
280
|
+
var Y = s.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n("span", {
|
|
281
|
+
ref: a,
|
|
282
|
+
className: d("text-muted-foreground text-body-sm max-w-1/2 min-w-0 shrink truncate text-right", t),
|
|
283
|
+
"data-slot": "item-value",
|
|
284
|
+
...e
|
|
285
|
+
}));
|
|
286
|
+
Y.displayName = "ListItemValue";
|
|
287
|
+
var Z = s.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n(B, {
|
|
288
|
+
ref: a,
|
|
289
|
+
"aria-hidden": !0,
|
|
290
|
+
className: d("text-muted-foreground shrink-0", t),
|
|
291
|
+
"data-slot": "item-chevron",
|
|
292
|
+
...e
|
|
293
|
+
}));
|
|
294
|
+
Z.displayName = "ListItemChevron";
|
|
295
|
+
var tt = s.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ n("li", {
|
|
296
|
+
ref: a,
|
|
297
|
+
"aria-hidden": !0,
|
|
298
|
+
className: d("bg-border h-px w-full shrink-0", t),
|
|
299
|
+
"data-slot": "item-separator",
|
|
102
300
|
...e
|
|
103
301
|
}));
|
|
104
|
-
|
|
302
|
+
tt.displayName = "ListSeparator";
|
|
303
|
+
var lt = N, dt = x, mt = y, ut = R, ct = C, ft = S, pt = T, vt = I;
|
|
105
304
|
export {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
305
|
+
lt as Item,
|
|
306
|
+
ft as ItemActions,
|
|
307
|
+
mt as ItemContent,
|
|
308
|
+
ct as ItemDescription,
|
|
309
|
+
dt as ItemMedia,
|
|
310
|
+
pt as ItemSubheader,
|
|
311
|
+
ut as ItemTitle,
|
|
312
|
+
$ as List,
|
|
313
|
+
N as ListItem,
|
|
314
|
+
S as ListItemActions,
|
|
315
|
+
U as ListItemButton,
|
|
316
|
+
Z as ListItemChevron,
|
|
317
|
+
y as ListItemContent,
|
|
318
|
+
C as ListItemDescription,
|
|
319
|
+
X as ListItemLink,
|
|
320
|
+
x as ListItemMedia,
|
|
321
|
+
R as ListItemTitle,
|
|
322
|
+
Y as ListItemValue,
|
|
323
|
+
tt as ListSeparator,
|
|
324
|
+
T as ListSubheader,
|
|
325
|
+
vt as itemVariants,
|
|
326
|
+
q as listItemMediaVariants,
|
|
327
|
+
I as listItemVariants,
|
|
328
|
+
K as listVariants
|
|
115
329
|
};
|
package/dist/route-progress.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";const T=require("./_virtual/_rolldown/runtime.cjs");let r=require("react");r=T.__toESM(r,1);let b=require("@brightlocal/ui-components/lib/utils"),i=require("react/jsx-runtime"),
|
|
1
|
+
"use client";const T=require("./_virtual/_rolldown/runtime.cjs"),L=require("./lib/motion.cjs");let r=require("react");r=T.__toESM(r,1);let b=require("@brightlocal/ui-components/lib/utils"),i=require("react/jsx-runtime"),q=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion");var A=12,P=90,x=12e3,S="var(--ds-motion-ease-emphasized)",y=150,F=50,d=r.forwardRef(({className:m,active:l,dataHook:p,trackingEl:_,trackingLabel:f,navigatingLabel:g="Loading page",style:h,...v},E)=>{const a=(0,q.usePrefersReducedMotion)(),[e,o]=r.useState("idle");r.useEffect(()=>{if(l){o(t=>t==="start"||t==="creep"?t:"start");return}const s=setTimeout(()=>o(t=>t==="idle"?"idle":"complete"),y);return()=>clearTimeout(s)},[l]),r.useEffect(()=>{if(e!=="start"||a)return;let s=0;const t=requestAnimationFrame(()=>{s=requestAnimationFrame(()=>o(u=>u==="start"?"creep":u))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(s)}},[e,a]),r.useEffect(()=>{if(e!=="complete")return;const s=setTimeout(()=>o(t=>t==="complete"?"idle":t),a?0:350);return()=>clearTimeout(s)},[e,a]);const c=e==="start"||e==="creep",R=e==="complete"?100:e==="creep"?P:e==="start"&&a?F:A;let n="none";return a||(e==="creep"?n=`clip-path ${x}ms ${S}`:e==="complete"&&(n="clip-path var(--ds-motion-duration-base) ease-out, opacity var(--ds-motion-duration-fast) ease-out var(--ds-motion-duration-base)")),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{ref:E,"aria-hidden":"true",className:(0,b.cn)("pointer-events-none fixed inset-x-0 top-0 z-60 h-0.5 overflow-hidden",m),"data-hook":p,"data-slot":"route-progress","data-state":e,"data-tracking-el":_,"data-tracking-label":f,style:h,...v,children:(0,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-R}% 0 0)`,opacity:c?1:0,transition:n}})}),(0,i.jsx)("span",{"aria-atomic":"true","aria-live":"polite",className:"sr-only fixed","data-slot":"route-progress-status",children:c?g:""})]})});d.displayName="RouteProgress";exports.RouteProgress=d;
|
package/dist/route-progress.js
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
s.
|
|
2
|
+
import "./lib/motion.js";
|
|
3
|
+
import * as o from "react";
|
|
4
|
+
import { cn as R } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
import { Fragment as A, jsx as n, jsxs as _ } from "react/jsx-runtime";
|
|
6
|
+
import { usePrefersReducedMotion as S } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
|
|
7
|
+
var F = 12, M = 90, N = 12e3, P = "var(--ds-motion-ease-emphasized)", b = 150, y = 50, I = o.forwardRef(({ className: d, active: l, dataHook: p, trackingEl: u, trackingLabel: f, navigatingLabel: T = "Loading page", style: v, ...E }, g) => {
|
|
8
|
+
const a = S(), [e, s] = o.useState("idle");
|
|
9
|
+
o.useEffect(() => {
|
|
9
10
|
if (l) {
|
|
10
|
-
|
|
11
|
+
s((t) => t === "start" || t === "creep" ? t : "start");
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
|
-
const r = setTimeout(() =>
|
|
14
|
+
const r = setTimeout(() => s((t) => t === "idle" ? "idle" : "complete"), b);
|
|
14
15
|
return () => clearTimeout(r);
|
|
15
|
-
}, [l]),
|
|
16
|
+
}, [l]), o.useEffect(() => {
|
|
16
17
|
if (e !== "start" || a) return;
|
|
17
18
|
let r = 0;
|
|
18
19
|
const t = requestAnimationFrame(() => {
|
|
19
|
-
r = requestAnimationFrame(() =>
|
|
20
|
+
r = requestAnimationFrame(() => s((c) => c === "start" ? "creep" : c));
|
|
20
21
|
});
|
|
21
22
|
return () => {
|
|
22
23
|
cancelAnimationFrame(t), cancelAnimationFrame(r);
|
|
23
24
|
};
|
|
24
|
-
}, [e, a]),
|
|
25
|
+
}, [e, a]), o.useEffect(() => {
|
|
25
26
|
if (e !== "complete") return;
|
|
26
|
-
const r = setTimeout(() =>
|
|
27
|
+
const r = setTimeout(() => s((t) => t === "complete" ? "idle" : t), a ? 0 : 350);
|
|
27
28
|
return () => clearTimeout(r);
|
|
28
29
|
}, [e, a]);
|
|
29
|
-
const
|
|
30
|
+
const m = e === "start" || e === "creep", h = e === "complete" ? 100 : e === "creep" ? M : e === "start" && a ? y : F;
|
|
30
31
|
let i = "none";
|
|
31
|
-
return a || (e === "creep" ? i = `clip-path ${
|
|
32
|
-
ref:
|
|
32
|
+
return a || (e === "creep" ? i = `clip-path ${N}ms ${P}` : 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__ */ _(A, { children: [/* @__PURE__ */ n("div", {
|
|
33
|
+
ref: g,
|
|
33
34
|
"aria-hidden": "true",
|
|
34
|
-
className:
|
|
35
|
+
className: R("pointer-events-none fixed inset-x-0 top-0 z-60 h-0.5 overflow-hidden", d),
|
|
35
36
|
"data-hook": p,
|
|
36
37
|
"data-slot": "route-progress",
|
|
37
38
|
"data-state": e,
|
|
38
39
|
"data-tracking-el": u,
|
|
39
40
|
"data-tracking-label": f,
|
|
40
|
-
style:
|
|
41
|
+
style: v,
|
|
41
42
|
...E,
|
|
42
43
|
children: /* @__PURE__ */ n("span", {
|
|
43
44
|
className: "bg-primary absolute inset-0 dark:bg-[var(--ds-colors-primary-light)]",
|
|
44
45
|
"data-slot": "route-progress-bar",
|
|
45
46
|
style: {
|
|
46
|
-
clipPath: `inset(0 ${100 -
|
|
47
|
-
opacity:
|
|
47
|
+
clipPath: `inset(0 ${100 - h}% 0 0)`,
|
|
48
|
+
opacity: m ? 1 : 0,
|
|
48
49
|
transition: i
|
|
49
50
|
}
|
|
50
51
|
})
|
|
@@ -53,10 +54,10 @@ var y = 12, F = 90, S = 12e3, _ = "var(--ds-motion-ease-emphasized)", x = 150, L
|
|
|
53
54
|
"aria-live": "polite",
|
|
54
55
|
className: "sr-only fixed",
|
|
55
56
|
"data-slot": "route-progress-status",
|
|
56
|
-
children:
|
|
57
|
+
children: m ? T : ""
|
|
57
58
|
})] });
|
|
58
59
|
});
|
|
59
|
-
|
|
60
|
+
I.displayName = "RouteProgress";
|
|
60
61
|
export {
|
|
61
|
-
|
|
62
|
+
I as RouteProgress
|
|
62
63
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightlocal/ui-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "BrightLocal Design System UI Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -227,8 +227,8 @@
|
|
|
227
227
|
"sonner": "^2.0.8",
|
|
228
228
|
"tailwind-merge": "^3.7.0",
|
|
229
229
|
"vaul": "^1.1.2",
|
|
230
|
-
"@brightlocal/
|
|
231
|
-
"@brightlocal/
|
|
230
|
+
"@brightlocal/illustrations": "0.7.0",
|
|
231
|
+
"@brightlocal/icons": "2.5.0"
|
|
232
232
|
},
|
|
233
233
|
"size-limit": [
|
|
234
234
|
{
|
|
@@ -9,7 +9,12 @@ import { usePrefersReducedMotion } from "@brightlocal/ui-components/hooks/use-pr
|
|
|
9
9
|
import { SPRING_SNAPPY } from "../lib/motion";
|
|
10
10
|
import { Button, type ButtonProps } from "../components/button";
|
|
11
11
|
import { Input } from "../components/input";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
ListItem,
|
|
14
|
+
ListItemContent,
|
|
15
|
+
ListItemTitle,
|
|
16
|
+
ListItemActions,
|
|
17
|
+
} from "../components/list";
|
|
13
18
|
|
|
14
19
|
/* -------------------------------------------------------------------------------------------------
|
|
15
20
|
* InputList Context
|
|
@@ -295,7 +300,7 @@ function InputListItems({
|
|
|
295
300
|
data-slot="input-list-skeleton"
|
|
296
301
|
>
|
|
297
302
|
{Array.from({ length: skeletonCount }).map((_, i) => (
|
|
298
|
-
<
|
|
303
|
+
<ListItem key={i} variant="loading" />
|
|
299
304
|
))}
|
|
300
305
|
</ul>
|
|
301
306
|
);
|
|
@@ -329,12 +334,12 @@ function InputListItems({
|
|
|
329
334
|
layout: SPRING_SNAPPY,
|
|
330
335
|
}}
|
|
331
336
|
>
|
|
332
|
-
<
|
|
337
|
+
<ListItem asChild variant="filled">
|
|
333
338
|
<div>
|
|
334
|
-
<
|
|
335
|
-
<
|
|
336
|
-
</
|
|
337
|
-
<
|
|
339
|
+
<ListItemContent>
|
|
340
|
+
<ListItemTitle>{item}</ListItemTitle>
|
|
341
|
+
</ListItemContent>
|
|
342
|
+
<ListItemActions>
|
|
338
343
|
<button
|
|
339
344
|
aria-label={
|
|
340
345
|
removeAriaLabel
|
|
@@ -355,9 +360,9 @@ function InputListItems({
|
|
|
355
360
|
>
|
|
356
361
|
<X />
|
|
357
362
|
</button>
|
|
358
|
-
</
|
|
363
|
+
</ListItemActions>
|
|
359
364
|
</div>
|
|
360
|
-
</
|
|
365
|
+
</ListItem>
|
|
361
366
|
</motion.li>
|
|
362
367
|
))}
|
|
363
368
|
</AnimatePresence>
|