@brightlocal/ui-components 2.27.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/component-meta.json +568 -143
- package/deprecations.json +298 -1
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.d.ts +36 -0
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +74 -61
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.js +18 -18
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +11 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +31 -28
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +4 -4
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +15 -11
- package/dist/blocks/empty-state.cjs +1 -0
- package/dist/blocks/empty-state.d.ts +172 -0
- package/dist/blocks/empty-state.d.ts.map +1 -0
- package/dist/blocks/empty-state.js +147 -0
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +124 -108
- package/dist/blocks/progress-state.cjs +1 -0
- package/dist/blocks/{progress-screen.d.ts → progress-state.d.ts} +30 -18
- package/dist/blocks/progress-state.d.ts.map +1 -0
- package/dist/blocks/{progress-screen.js → progress-state.js} +100 -71
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +160 -161
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-group.cjs +1 -0
- package/dist/button-group.d.ts +36 -0
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +47 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +12 -12
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +37 -38
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +24 -2
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +57 -55
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +42 -3
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +102 -91
- package/dist/chart-empty.cjs +1 -0
- package/dist/chart-empty.d.ts +59 -0
- package/dist/chart-empty.d.ts.map +1 -0
- package/dist/chart-empty.js +29 -0
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +46 -13
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +172 -157
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +38 -4
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +100 -84
- package/dist/combobox.cjs +2 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +81 -79
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +248 -225
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +26 -29
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +75 -10
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +346 -334
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +13 -5
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +54 -53
- package/dist/description.cjs +1 -1
- package/dist/description.js +5 -5
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +20 -20
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +8 -11
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +17 -20
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +8 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +96 -65
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +130 -12
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +146 -127
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +56 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +32 -0
- package/dist/header.d.ts +13 -0
- package/dist/header.d.ts.map +1 -1
- package/dist/hooks/use-delayed-pending.cjs +1 -0
- package/dist/hooks/use-delayed-pending.d.ts +34 -0
- package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
- package/dist/hooks/use-delayed-pending.js +17 -0
- package/dist/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.js +8 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +554 -527
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +25 -25
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +9 -9
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +17 -9
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +73 -72
- package/dist/input.cjs +1 -1
- package/dist/input.js +9 -9
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +25 -28
- package/dist/lib/block-illustration.cjs +1 -0
- package/dist/lib/block-illustration.d.ts +28 -0
- package/dist/lib/block-illustration.d.ts.map +1 -0
- package/dist/lib/block-illustration.js +21 -0
- package/dist/lib/empty-canvas.cjs +1 -0
- package/dist/lib/empty-canvas.d.ts +27 -0
- package/dist/lib/empty-canvas.d.ts.map +1 -0
- package/dist/lib/empty-canvas.js +62 -0
- package/dist/lib/empty-chip.cjs +1 -0
- package/dist/lib/empty-chip.d.ts +4 -0
- package/dist/lib/empty-chip.d.ts.map +1 -0
- package/dist/lib/empty-chip.js +13 -0
- package/dist/lib/optical-center.cjs +1 -0
- package/dist/lib/optical-center.d.ts +12 -0
- package/dist/lib/optical-center.d.ts.map +1 -0
- package/dist/lib/optical-center.js +11 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +28 -5
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +62 -58
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +60 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +187 -164
- package/dist/media-empty.cjs +1 -0
- package/dist/media-empty.d.ts +72 -0
- package/dist/media-empty.d.ts.map +1 -0
- package/dist/media-empty.js +45 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +17 -20
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +7 -7
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +130 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +193 -102
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +2 -26
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +79 -118
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +15 -6
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +38 -36
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +13 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +92 -87
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +8 -8
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +2 -2
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +38 -3
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +43 -20
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.js +26 -26
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +40 -40
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +31 -28
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.d.ts +10 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +8 -8
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +8 -8
- package/dist/typography-heading.cjs +1 -0
- package/dist/typography-heading.d.ts +129 -0
- package/dist/typography-heading.d.ts.map +1 -0
- package/dist/typography-heading.js +95 -0
- package/dist/typography-text.cjs +1 -0
- package/dist/typography-text.d.ts +127 -0
- package/dist/typography-text.d.ts.map +1 -0
- package/dist/typography-text.js +92 -0
- package/dist/typography.d.ts +13 -0
- package/dist/typography.d.ts.map +1 -1
- package/package.json +35 -7
- package/src/blocks/empty-state.tsx +412 -0
- package/src/blocks/input-list.tsx +66 -36
- package/src/blocks/{progress-screen.tsx → progress-state.tsx} +154 -93
- package/src/blocks/sidebar.tsx +25 -26
- package/src/components/accordion.tsx +82 -27
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/alert.tsx +27 -13
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +8 -4
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/button-group.tsx +112 -0
- package/src/components/button.tsx +4 -4
- package/src/components/calendar.tsx +5 -6
- package/src/components/callout.tsx +48 -15
- package/src/components/card.tsx +89 -19
- package/src/components/chart-empty.tsx +116 -0
- package/src/components/chart.tsx +103 -32
- package/src/components/chip.tsx +88 -13
- package/src/components/combobox.tsx +12 -10
- package/src/components/command.tsx +64 -13
- package/src/components/context-menu.tsx +6 -9
- package/src/components/data-table.tsx +135 -20
- package/src/components/date-picker.tsx +18 -7
- package/src/components/description.tsx +1 -1
- package/src/components/dialog.tsx +2 -2
- package/src/components/drawer.tsx +2 -5
- package/src/components/dropdown-menu.tsx +8 -11
- package/src/components/field.tsx +89 -16
- package/src/components/global-layout.tsx +210 -39
- package/src/components/grid.tsx +130 -0
- package/src/components/header.tsx +13 -0
- package/src/components/hover-card.tsx +1 -1
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +24 -12
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +10 -13
- package/src/components/list.tsx +13 -9
- package/src/components/map.tsx +101 -5
- package/src/components/media-empty.tsx +156 -0
- package/src/components/menubar.tsx +7 -10
- package/src/components/navigation-menu.tsx +1 -1
- package/src/components/pagination.tsx +286 -1
- package/src/components/progress.tsx +35 -113
- package/src/components/scroll-area.tsx +23 -10
- package/src/components/select.tsx +35 -10
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +2 -2
- package/src/components/skeleton.tsx +78 -7
- package/src/components/sonner.tsx +2 -2
- package/src/components/stepper.tsx +3 -3
- package/src/components/table.tsx +6 -3
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +10 -0
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/components/tooltip.tsx +1 -1
- package/src/components/typography-heading.tsx +253 -0
- package/src/components/typography-text.tsx +250 -0
- package/src/components/typography.tsx +13 -0
- package/src/hooks/use-delayed-pending.ts +60 -0
- package/src/index.ts +11 -1
- package/src/lib/block-illustration.tsx +88 -0
- package/src/lib/empty-canvas.tsx +128 -0
- package/src/lib/empty-chip.ts +24 -0
- package/src/lib/optical-center.tsx +45 -0
- package/src/lib/utils.ts +26 -0
- package/dist/blocks/progress-screen.cjs +0 -1
- package/dist/blocks/progress-screen.d.ts.map +0 -1
package/dist/pagination.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { MoreHorizontal as
|
|
4
|
-
import { cva as
|
|
1
|
+
import { jsx as a, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import * as f from "react";
|
|
3
|
+
import { MoreHorizontal as H, ChevronRight as q, ChevronLeft as A } from "@brightlocal/icons";
|
|
4
|
+
import { cva as D } from "class-variance-authority";
|
|
5
5
|
import { cn as d } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
-
import { useIsBelowBreakpoint as
|
|
7
|
-
function
|
|
6
|
+
import { useIsBelowBreakpoint as k } from "@brightlocal/ui-components/hooks/use-breakpoint";
|
|
7
|
+
function J({
|
|
8
8
|
page: i,
|
|
9
|
-
totalPages:
|
|
9
|
+
totalPages: n
|
|
10
10
|
}) {
|
|
11
|
-
const
|
|
12
|
-
return
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
for (let u = 1; u <=
|
|
16
|
-
|
|
11
|
+
const o = k("sm") ? 5 : 7;
|
|
12
|
+
return f.useMemo(() => {
|
|
13
|
+
const r = Math.max(5, o), e = [];
|
|
14
|
+
if (e.push("previous"), n <= r)
|
|
15
|
+
for (let u = 1; u <= n; u++)
|
|
16
|
+
e.push(u);
|
|
17
17
|
else {
|
|
18
|
-
const u = Math.floor((
|
|
19
|
-
if (i <=
|
|
20
|
-
for (let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} else if (i >=
|
|
24
|
-
|
|
25
|
-
for (let
|
|
26
|
-
|
|
18
|
+
const u = Math.floor((r - 5) / 2), b = r - 3, g = n - b;
|
|
19
|
+
if (i <= b) {
|
|
20
|
+
for (let l = 1; l <= r - 2; l++)
|
|
21
|
+
e.push(l);
|
|
22
|
+
e.push("ellipsis", n);
|
|
23
|
+
} else if (i >= g) {
|
|
24
|
+
e.push(1, "ellipsis");
|
|
25
|
+
for (let l = n - (r - 3); l <= n; l++)
|
|
26
|
+
e.push(l);
|
|
27
27
|
} else {
|
|
28
|
-
|
|
29
|
-
for (let
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
e.push(1, "ellipsis");
|
|
29
|
+
for (let l = i - u; l <= i + u; l++)
|
|
30
|
+
e.push(l);
|
|
31
|
+
e.push("ellipsis", n);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
return
|
|
35
|
-
}, [i,
|
|
34
|
+
return e.push("next"), e;
|
|
35
|
+
}, [i, n, o]);
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const M = D(
|
|
38
38
|
[
|
|
39
39
|
// Base styles - circular button
|
|
40
40
|
"inline-flex items-center justify-center",
|
|
41
41
|
"h-9 w-9",
|
|
42
42
|
"rounded-full",
|
|
43
|
-
"text-
|
|
43
|
+
"text-label",
|
|
44
44
|
"transition-colors duration-fast ease-out",
|
|
45
45
|
"focus-visible:outline-none focus-visible:shadow-default"
|
|
46
46
|
],
|
|
@@ -83,131 +83,222 @@ const g = y(
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
|
-
function
|
|
86
|
+
function P({
|
|
87
87
|
className: i,
|
|
88
|
-
dataHook:
|
|
89
|
-
trackingEl:
|
|
90
|
-
trackingLabel:
|
|
91
|
-
ariaLabel:
|
|
92
|
-
...
|
|
88
|
+
dataHook: n,
|
|
89
|
+
trackingEl: t,
|
|
90
|
+
trackingLabel: o,
|
|
91
|
+
ariaLabel: s,
|
|
92
|
+
...r
|
|
93
93
|
}) {
|
|
94
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ a(
|
|
95
95
|
"nav",
|
|
96
96
|
{
|
|
97
|
-
"aria-label":
|
|
97
|
+
"aria-label": s ?? "Pagination",
|
|
98
98
|
className: d("mx-auto flex w-full justify-center", i),
|
|
99
|
-
"data-hook":
|
|
99
|
+
"data-hook": n,
|
|
100
100
|
"data-slot": "pagination",
|
|
101
|
-
"data-tracking-el":
|
|
102
|
-
"data-tracking-label":
|
|
101
|
+
"data-tracking-el": t || "pagination",
|
|
102
|
+
"data-tracking-label": o,
|
|
103
103
|
role: "navigation",
|
|
104
|
-
...
|
|
104
|
+
...r
|
|
105
105
|
}
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
function
|
|
108
|
+
P.displayName = "Pagination";
|
|
109
|
+
function K({
|
|
110
110
|
className: i,
|
|
111
|
-
...
|
|
111
|
+
...n
|
|
112
112
|
}) {
|
|
113
|
-
return /* @__PURE__ */
|
|
113
|
+
return /* @__PURE__ */ a(
|
|
114
114
|
"ul",
|
|
115
115
|
{
|
|
116
116
|
className: d("flex flex-row items-center gap-2", i),
|
|
117
117
|
"data-slot": "pagination-content",
|
|
118
|
-
...
|
|
118
|
+
...n
|
|
119
119
|
}
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
return /* @__PURE__ */
|
|
122
|
+
function m(i) {
|
|
123
|
+
return /* @__PURE__ */ a("li", { "data-slot": "pagination-item", ...i });
|
|
124
124
|
}
|
|
125
|
-
const
|
|
125
|
+
const v = f.forwardRef(({ className: i, variant: n, isActive: t, children: o, ...s }, r) => /* @__PURE__ */ a(
|
|
126
126
|
"button",
|
|
127
127
|
{
|
|
128
|
-
ref:
|
|
129
|
-
"aria-current":
|
|
130
|
-
className: d(
|
|
131
|
-
"data-active":
|
|
128
|
+
ref: r,
|
|
129
|
+
"aria-current": t ? "page" : void 0,
|
|
130
|
+
className: d(M({ variant: n }), i),
|
|
131
|
+
"data-active": t,
|
|
132
132
|
"data-slot": "pagination-button",
|
|
133
133
|
type: "button",
|
|
134
|
-
...
|
|
135
|
-
children:
|
|
134
|
+
...s,
|
|
135
|
+
children: o
|
|
136
136
|
}
|
|
137
137
|
));
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
138
|
+
v.displayName = "PaginationButton";
|
|
139
|
+
const j = f.forwardRef(({ className: i, disabled: n, ariaLabel: t, ...o }, s) => /* @__PURE__ */ a(
|
|
140
|
+
v,
|
|
141
141
|
{
|
|
142
|
-
ref:
|
|
143
|
-
"aria-disabled":
|
|
144
|
-
"aria-label":
|
|
142
|
+
ref: s,
|
|
143
|
+
"aria-disabled": n,
|
|
144
|
+
"aria-label": t ?? "Go to previous page",
|
|
145
145
|
className: i,
|
|
146
|
-
disabled:
|
|
146
|
+
disabled: n,
|
|
147
147
|
variant: "previous",
|
|
148
|
-
...
|
|
149
|
-
children: /* @__PURE__ */
|
|
148
|
+
...o,
|
|
149
|
+
children: /* @__PURE__ */ a(A, {})
|
|
150
150
|
}
|
|
151
151
|
));
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
({ className: i, disabled:
|
|
155
|
-
|
|
152
|
+
j.displayName = "PaginationPrevious";
|
|
153
|
+
const R = f.forwardRef(
|
|
154
|
+
({ className: i, disabled: n, ariaLabel: t, ...o }, s) => /* @__PURE__ */ a(
|
|
155
|
+
v,
|
|
156
156
|
{
|
|
157
|
-
ref:
|
|
158
|
-
"aria-disabled":
|
|
159
|
-
"aria-label":
|
|
157
|
+
ref: s,
|
|
158
|
+
"aria-disabled": n,
|
|
159
|
+
"aria-label": t ?? "Go to next page",
|
|
160
160
|
className: i,
|
|
161
|
-
disabled:
|
|
161
|
+
disabled: n,
|
|
162
162
|
variant: "next",
|
|
163
|
-
...
|
|
164
|
-
children: /* @__PURE__ */
|
|
163
|
+
...o,
|
|
164
|
+
children: /* @__PURE__ */ a(q, {})
|
|
165
165
|
}
|
|
166
166
|
)
|
|
167
167
|
);
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
({ className: i, page:
|
|
171
|
-
|
|
168
|
+
R.displayName = "PaginationNext";
|
|
169
|
+
const C = f.forwardRef(
|
|
170
|
+
({ className: i, page: n, isActive: t, ariaLabel: o, ...s }, r) => /* @__PURE__ */ a(
|
|
171
|
+
v,
|
|
172
172
|
{
|
|
173
|
-
ref:
|
|
174
|
-
"aria-label":
|
|
173
|
+
ref: r,
|
|
174
|
+
"aria-label": o ? o.replace("{page}", String(n)) : `Go to page ${n}`,
|
|
175
175
|
className: i,
|
|
176
|
-
isActive:
|
|
176
|
+
isActive: t,
|
|
177
177
|
variant: "link",
|
|
178
|
-
...
|
|
179
|
-
children:
|
|
178
|
+
...s,
|
|
179
|
+
children: n
|
|
180
180
|
}
|
|
181
181
|
)
|
|
182
182
|
);
|
|
183
|
-
|
|
184
|
-
function
|
|
183
|
+
C.displayName = "PaginationLink";
|
|
184
|
+
function O({
|
|
185
185
|
className: i,
|
|
186
|
-
srLabel:
|
|
187
|
-
...
|
|
186
|
+
srLabel: n = "More pages",
|
|
187
|
+
...t
|
|
188
188
|
}) {
|
|
189
|
-
return /* @__PURE__ */
|
|
189
|
+
return /* @__PURE__ */ y(
|
|
190
190
|
"span",
|
|
191
191
|
{
|
|
192
192
|
"aria-hidden": "true",
|
|
193
|
-
className: d(
|
|
193
|
+
className: d(M({ variant: "ellipsis" }), i),
|
|
194
194
|
"data-slot": "pagination-ellipsis",
|
|
195
|
-
...
|
|
195
|
+
...t,
|
|
196
196
|
children: [
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ a(H, {}),
|
|
198
|
+
/* @__PURE__ */ a("span", { className: "sr-only", children: n })
|
|
199
199
|
]
|
|
200
200
|
}
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
|
+
const Q = f.forwardRef(
|
|
204
|
+
({
|
|
205
|
+
className: i,
|
|
206
|
+
page: n,
|
|
207
|
+
totalPages: t,
|
|
208
|
+
onPageChange: o,
|
|
209
|
+
dataHook: s,
|
|
210
|
+
totalItems: r,
|
|
211
|
+
pageSize: e,
|
|
212
|
+
renderCaption: u,
|
|
213
|
+
ariaLabel: b,
|
|
214
|
+
prevAriaLabel: g,
|
|
215
|
+
nextAriaLabel: l,
|
|
216
|
+
pageAriaLabel: L,
|
|
217
|
+
ellipsisSrLabel: $,
|
|
218
|
+
trackingEl: B,
|
|
219
|
+
trackingLabel: G,
|
|
220
|
+
...V
|
|
221
|
+
}, F) => {
|
|
222
|
+
const T = J({ page: n, totalPages: t }), E = k("sm"), p = (() => {
|
|
223
|
+
if (E || u === null || r === void 0 || e === void 0 || !Number.isFinite(e) || e <= 0 || !Number.isFinite(r) || r < 0) return null;
|
|
224
|
+
const c = Math.max(1, Math.ceil(r / e)), h = Math.min(Math.max(1, Math.floor(n) || 1), c), w = r === 0 ? 0 : (h - 1) * e + 1, N = Math.min(h * e, r);
|
|
225
|
+
return u ? u({
|
|
226
|
+
page: h,
|
|
227
|
+
totalPages: t,
|
|
228
|
+
from: w,
|
|
229
|
+
to: N,
|
|
230
|
+
total: r
|
|
231
|
+
}) : r === 0 ? null : `Showing ${w} to ${N} of ${r} results`;
|
|
232
|
+
})(), x = t > 1;
|
|
233
|
+
return p == null && !x ? null : /* @__PURE__ */ y(
|
|
234
|
+
"div",
|
|
235
|
+
{
|
|
236
|
+
ref: F,
|
|
237
|
+
className: d(
|
|
238
|
+
"flex min-h-9 w-full flex-wrap items-center gap-x-4 gap-y-2",
|
|
239
|
+
p == null ? "justify-center" : "justify-between",
|
|
240
|
+
i
|
|
241
|
+
),
|
|
242
|
+
"data-hook": s,
|
|
243
|
+
"data-slot": "pagination-controls",
|
|
244
|
+
"data-tracking-el": B || "pagination-controls",
|
|
245
|
+
"data-tracking-label": G,
|
|
246
|
+
...V,
|
|
247
|
+
children: [
|
|
248
|
+
p != null && /* @__PURE__ */ a(
|
|
249
|
+
"span",
|
|
250
|
+
{
|
|
251
|
+
className: "text-body-sm text-muted-foreground whitespace-nowrap",
|
|
252
|
+
"data-slot": "pagination-caption",
|
|
253
|
+
children: p
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
x && /* @__PURE__ */ a(
|
|
257
|
+
P,
|
|
258
|
+
{
|
|
259
|
+
ariaLabel: b,
|
|
260
|
+
className: d(p != null && "mx-0 w-auto grow justify-end"),
|
|
261
|
+
dataHook: `${s}-nav`,
|
|
262
|
+
children: /* @__PURE__ */ a(K, { children: T.map((c, h) => c === "previous" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
|
|
263
|
+
j,
|
|
264
|
+
{
|
|
265
|
+
ariaLabel: g,
|
|
266
|
+
disabled: n <= 1,
|
|
267
|
+
onClick: () => o(n - 1)
|
|
268
|
+
}
|
|
269
|
+
) }, "previous") : c === "next" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
|
|
270
|
+
R,
|
|
271
|
+
{
|
|
272
|
+
ariaLabel: l,
|
|
273
|
+
disabled: n >= t,
|
|
274
|
+
onClick: () => o(n + 1)
|
|
275
|
+
}
|
|
276
|
+
) }, "next") : c === "ellipsis" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(O, { srLabel: $ }) }, `ellipsis-${h}`) : /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
|
|
277
|
+
C,
|
|
278
|
+
{
|
|
279
|
+
ariaLabel: L,
|
|
280
|
+
isActive: c === n,
|
|
281
|
+
page: c,
|
|
282
|
+
onClick: () => o(c)
|
|
283
|
+
}
|
|
284
|
+
) }, c)) })
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
Q.displayName = "PaginationControls";
|
|
203
293
|
export {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
294
|
+
P as Pagination,
|
|
295
|
+
v as PaginationButton,
|
|
296
|
+
K as PaginationContent,
|
|
297
|
+
Q as PaginationControls,
|
|
298
|
+
O as PaginationEllipsis,
|
|
299
|
+
m as PaginationItem,
|
|
300
|
+
C as PaginationLink,
|
|
301
|
+
R as PaginationNext,
|
|
302
|
+
j as PaginationPrevious,
|
|
303
|
+
J as usePagination
|
|
213
304
|
};
|
package/dist/progress.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),T=require("react"),I=require("@radix-ui/react-progress"),D=require("framer-motion"),n=require("@brightlocal/ui-components/lib/utils"),z=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion"),A=require("./lib/motion.cjs");function R(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,a.get?a:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const w=R(T),x=R(I),y={sm:{text:"text-body-sm",bar:"h-2"},md:{text:"text-body",bar:"h-3"}},P={green:{track:"bg-brand-primary-foreground/20",indicator:"bg-green-400"},red:{track:"bg-brand-red/20",indicator:"bg-brand-red"},orange:{track:"bg-brand-orange/20",indicator:"bg-brand-orange"},yellow:{track:"bg-brand-yellow/20",indicator:"bg-brand-yellow"}},B="40%";function j(r,t,e){if(r==null)return"–";if(e==="%")return`${t>0?Math.min(100,Math.max(0,Math.round(r/t*100))):0}%`;const a=e?` ${e}`:"";return t>0?`${r} / ${t}${a}`:`${r}${a}`}const k=w.forwardRef(({className:r,value:t,max:e=100,dataHook:a,trackingEl:d,trackingLabel:v,ariaLabel:S="Progress",label:g,labelWidth:u=B,color:M="green",size:N="sm",showValue:i=!1,unit:b="%",indicatorClassName:_,disabled:f,...L},O)=>{const m=w.useId(),o=!!g,$=z.usePrefersReducedMotion(),p=P[M]??P.green,c=y[N]??y.sm,l=u==="auto",q=o||i,E=e>0?Math.min(100,Math.max(0,(t??0)/e*100)):0,h=s.jsx(x.Root,{ref:O,"aria-label":o?void 0:S,"aria-labelledby":o?m:void 0,className:n.cn("relative w-full overflow-hidden rounded-full",q&&"min-w-0 flex-1",c.bar,p.track,!o&&!i&&f&&"opacity-50",r),"data-hook":a,"data-slot":"progress","data-tracking-el":d,"data-tracking-label":v,max:e,value:t??0,...L,children:s.jsx(x.Indicator,{asChild:!0,children:s.jsx(D.motion.div,{animate:{transform:`translateX(-${100-E}%)`},className:n.cn("h-full w-full flex-1",p.indicator,_),"data-slot":"progress-indicator",initial:!1,transition:$?{duration:0}:A.SPRING_GENTLE})})});return!o&&!i?h:s.jsxs("div",{className:n.cn("flex w-full items-center gap-2",f&&"opacity-50"),"data-slot":"progress-wrapper",children:[o&&s.jsx("span",{className:n.cn("text-foreground shrink-0 break-words",l&&"max-w-2/5",c.text),"data-label-width":l?"auto":void 0,"data-slot":"progress-label",id:m,style:l?void 0:{width:u},children:g}),h,i&&s.jsxs("span",{className:n.cn("text-muted-foreground grid min-w-10 shrink-0 text-right tabular-nums",c.text),"data-slot":"progress-value",children:[s.jsx("span",{"aria-hidden":"true",className:"invisible col-start-1 row-start-1","data-slot":"progress-value-sizer",children:j(e,e,b)}),s.jsx("span",{className:"col-start-1 row-start-1","data-slot":"progress-value-text",children:j(t,e,b)})]})]})});k.displayName="Progress";exports.Progress=k;
|
package/dist/progress.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
|
10
10
|
type ProgressColor = "green" | "red" | "orange" | "yellow";
|
|
11
11
|
/**
|
|
12
12
|
* Text size of the label and value.
|
|
13
|
-
* - `sm` — 14px (`text-sm`), the default for metric rows in cards
|
|
14
|
-
* - `md` — 16px (`text-
|
|
13
|
+
* - `sm` — 14px (`text-body-sm`), the default for metric rows in cards
|
|
14
|
+
* - `md` — 16px (`text-body`) for roomier layouts
|
|
15
15
|
*/
|
|
16
16
|
type ProgressSize = "sm" | "md";
|
|
17
17
|
/**
|
|
@@ -84,30 +84,6 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
|
|
|
84
84
|
* Use this to customize the color, e.g., "bg-chart-red"
|
|
85
85
|
*/
|
|
86
86
|
indicatorClassName?: string;
|
|
87
|
-
/**
|
|
88
|
-
* A line describing what the run is doing right now — the step, not the
|
|
89
|
-
* number. Renders on its own line above the bar's row, so `label` stays on
|
|
90
|
-
* the left and the value on the right. It takes the row's `size`, so it reads
|
|
91
|
-
* as a peer of the value rather than a second scale.
|
|
92
|
-
*
|
|
93
|
-
* It is a polite live region, and it never becomes the bar's accessible name
|
|
94
|
-
* (`ariaLabel` still owns that) — which is what makes it the right slot for a
|
|
95
|
-
* status that moves, where `label` is not.
|
|
96
|
-
* @example "Scanning search results across your area"
|
|
97
|
-
*/
|
|
98
|
-
statusDescription?: React.ReactNode;
|
|
99
|
-
/**
|
|
100
|
-
* Runs the bar as an indeterminate sweep: a short pill travelling the track
|
|
101
|
-
* for "running, and we cannot say how far". Use when work is genuinely
|
|
102
|
-
* underway but the backend reports no percentage — never as a stand-in for a
|
|
103
|
-
* number you could have fetched.
|
|
104
|
-
*
|
|
105
|
-
* `value` is ignored while this is set, the numeric readout is suppressed
|
|
106
|
-
* (there is nothing to report), and the bar drops `aria-valuenow` so assistive
|
|
107
|
-
* technology announces it as indeterminate rather than as 0%.
|
|
108
|
-
* @default false
|
|
109
|
-
*/
|
|
110
|
-
indeterminate?: boolean;
|
|
111
87
|
/**
|
|
112
88
|
* Whether the progress is in a disabled state
|
|
113
89
|
* When disabled, the component renders with 50% opacity
|
package/dist/progress.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAO9D;;;;;;GAMG;AACH,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D;;;;GAIG;AACH,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;AA6ChC;;;GAGG;AACH,KAAK,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAkCjE;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAClD,OAAO,iBAAiB,CAAC,IAAI,CAC9B;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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAO9D;;;;;;GAMG;AACH,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D;;;;GAIG;AACH,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;AA6ChC;;;GAGG;AACH,KAAK,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAkCjE;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAClD,OAAO,iBAAiB,CAAC,IAAI,CAC9B;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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,QAAQ,mGA2Jb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|