@brightlocal/ui-components 2.26.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/component-meta.json +4010 -255
- package/deprecations.json +189 -2
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +2 -2
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.js +18 -18
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +11 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +31 -28
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +4 -4
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +15 -11
- package/dist/blocks/empty-state.cjs +1 -0
- package/dist/blocks/empty-state.d.ts +172 -0
- package/dist/blocks/empty-state.d.ts.map +1 -0
- package/dist/blocks/empty-state.js +155 -0
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +124 -108
- package/dist/blocks/progress-state.cjs +1 -0
- package/dist/blocks/progress-state.d.ts +121 -0
- package/dist/blocks/progress-state.d.ts.map +1 -0
- package/dist/blocks/progress-state.js +368 -0
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +297 -296
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +44 -40
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +23 -23
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +37 -38
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +24 -2
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +57 -55
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +23 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +94 -91
- package/dist/chart-empty.cjs +1 -0
- package/dist/chart-empty.d.ts +59 -0
- package/dist/chart-empty.d.ts.map +1 -0
- package/dist/chart-empty.js +29 -0
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +6 -1
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +183 -183
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +47 -44
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +4 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +143 -141
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +74 -77
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +26 -29
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +182 -13
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +462 -314
- package/dist/description.cjs +1 -1
- package/dist/description.js +5 -5
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +20 -20
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +8 -11
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +17 -20
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +29 -25
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +58 -6
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +278 -194
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +56 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +32 -0
- package/dist/header.d.ts +13 -0
- package/dist/header.d.ts.map +1 -1
- package/dist/hooks/use-delayed-pending.cjs +1 -0
- package/dist/hooks/use-delayed-pending.d.ts +34 -0
- package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
- package/dist/hooks/use-delayed-pending.js +17 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +523 -494
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +25 -25
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +9 -9
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.js +51 -51
- package/dist/input.cjs +1 -1
- package/dist/input.js +9 -9
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +25 -28
- package/dist/lib/block-illustration.cjs +1 -0
- package/dist/lib/block-illustration.d.ts +28 -0
- package/dist/lib/block-illustration.d.ts.map +1 -0
- package/dist/lib/block-illustration.js +21 -0
- package/dist/lib/empty-canvas.cjs +1 -0
- package/dist/lib/empty-canvas.d.ts +27 -0
- package/dist/lib/empty-canvas.d.ts.map +1 -0
- package/dist/lib/empty-canvas.js +62 -0
- package/dist/lib/motion.cjs +1 -1
- package/dist/lib/motion.js +10 -8
- package/dist/lib/optical-center.cjs +1 -0
- package/dist/lib/optical-center.d.ts +12 -0
- package/dist/lib/optical-center.d.ts.map +1 -0
- package/dist/lib/optical-center.js +11 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +28 -5
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +8 -6
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +52 -20
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +87 -81
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +60 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +187 -164
- package/dist/media-empty.cjs +1 -0
- package/dist/media-empty.d.ts +72 -0
- package/dist/media-empty.d.ts.map +1 -0
- package/dist/media-empty.js +45 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +17 -20
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +7 -7
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +127 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +189 -98
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +37 -3
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +102 -64
- package/dist/route-progress.cjs +1 -0
- package/dist/route-progress.d.ts +103 -0
- package/dist/route-progress.d.ts.map +1 -0
- package/dist/route-progress.js +106 -0
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +19 -18
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +8 -8
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +35 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +103 -66
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +38 -3
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +43 -20
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +32 -36
- package/dist/spinner.cjs +1 -0
- package/dist/spinner.d.ts +57 -0
- package/dist/spinner.d.ts.map +1 -0
- package/dist/spinner.js +35 -0
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.d.ts.map +1 -1
- package/dist/stepper.js +23 -22
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +36 -29
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.d.ts +10 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +8 -8
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +8 -8
- package/dist/typography-heading.cjs +1 -0
- package/dist/typography-heading.d.ts +116 -0
- package/dist/typography-heading.d.ts.map +1 -0
- package/dist/typography-heading.js +84 -0
- package/dist/typography-text.cjs +1 -0
- package/dist/typography-text.d.ts +113 -0
- package/dist/typography-text.d.ts.map +1 -0
- package/dist/typography-text.js +81 -0
- package/dist/typography.d.ts +13 -0
- package/dist/typography.d.ts.map +1 -1
- package/package.json +42 -2
- package/src/blocks/empty-state.tsx +424 -0
- package/src/blocks/input-list.tsx +66 -36
- package/src/blocks/progress-state.tsx +542 -0
- package/src/blocks/sidebar.tsx +46 -40
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/alert.tsx +27 -13
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +8 -4
- package/src/components/breadcrumb.tsx +9 -4
- package/src/components/button.tsx +5 -8
- package/src/components/calendar.tsx +5 -6
- package/src/components/callout.tsx +48 -15
- package/src/components/card.tsx +52 -17
- package/src/components/chart-empty.tsx +116 -0
- package/src/components/chart.tsx +43 -17
- package/src/components/chip.tsx +9 -6
- package/src/components/combobox.tsx +21 -12
- package/src/components/command.tsx +9 -10
- package/src/components/context-menu.tsx +6 -9
- package/src/components/data-table.tsx +405 -31
- package/src/components/description.tsx +1 -1
- package/src/components/dialog.tsx +2 -2
- package/src/components/drawer.tsx +2 -5
- package/src/components/dropdown-menu.tsx +8 -11
- package/src/components/field.tsx +8 -4
- package/src/components/global-layout.tsx +264 -65
- package/src/components/grid.tsx +130 -0
- package/src/components/header.tsx +13 -0
- package/src/components/hover-card.tsx +1 -1
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +1 -1
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +10 -13
- package/src/components/link.tsx +39 -5
- package/src/components/list.tsx +18 -14
- package/src/components/map.tsx +101 -5
- package/src/components/media-empty.tsx +156 -0
- package/src/components/menubar.tsx +7 -10
- package/src/components/navigation-menu.tsx +1 -1
- package/src/components/pagination.tsx +279 -1
- package/src/components/progress.tsx +120 -11
- package/src/components/route-progress.tsx +354 -0
- package/src/components/select.tsx +5 -4
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +89 -7
- package/src/components/skeleton.tsx +78 -7
- package/src/components/sonner.tsx +5 -14
- package/src/components/spinner.tsx +94 -0
- package/src/components/stepper.tsx +6 -7
- package/src/components/table.tsx +11 -4
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +10 -0
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/components/tooltip.tsx +1 -1
- package/src/components/typography-heading.tsx +229 -0
- package/src/components/typography-text.tsx +225 -0
- package/src/components/typography.tsx +13 -0
- package/src/hooks/use-delayed-pending.ts +60 -0
- package/src/index.ts +12 -0
- package/src/lib/block-illustration.tsx +88 -0
- package/src/lib/empty-canvas.tsx +128 -0
- package/src/lib/optical-center.tsx +45 -0
- package/src/lib/utils.ts +26 -0
package/dist/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 T, ChevronRight as E, ChevronLeft as H } from "@brightlocal/icons";
|
|
4
|
+
import { cva as q } 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 A } from "@brightlocal/ui-components/hooks/use-breakpoint";
|
|
7
|
+
function D({
|
|
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 = A("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 w = q(
|
|
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 M({
|
|
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
|
+
M.displayName = "Pagination";
|
|
109
|
+
function J({
|
|
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(w({ 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 P =
|
|
140
|
-
|
|
138
|
+
v.displayName = "PaginationButton";
|
|
139
|
+
const P = 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(H, {})
|
|
150
150
|
}
|
|
151
151
|
));
|
|
152
152
|
P.displayName = "PaginationPrevious";
|
|
153
|
-
const
|
|
154
|
-
({ className: i, disabled:
|
|
155
|
-
|
|
153
|
+
const j = 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(E, {})
|
|
165
165
|
}
|
|
166
166
|
)
|
|
167
167
|
);
|
|
168
|
-
|
|
169
|
-
const R =
|
|
170
|
-
({ className: i, page:
|
|
171
|
-
|
|
168
|
+
j.displayName = "PaginationNext";
|
|
169
|
+
const R = 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
183
|
R.displayName = "PaginationLink";
|
|
184
|
-
function
|
|
184
|
+
function K({
|
|
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(w({ variant: "ellipsis" }), i),
|
|
194
194
|
"data-slot": "pagination-ellipsis",
|
|
195
|
-
...
|
|
195
|
+
...t,
|
|
196
196
|
children: [
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ a(T, {}),
|
|
198
|
+
/* @__PURE__ */ a("span", { className: "sr-only", children: n })
|
|
199
199
|
]
|
|
200
200
|
}
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
|
+
const O = 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: C,
|
|
217
|
+
ellipsisSrLabel: L,
|
|
218
|
+
trackingEl: $,
|
|
219
|
+
trackingLabel: B,
|
|
220
|
+
...G
|
|
221
|
+
}, V) => {
|
|
222
|
+
const F = D({ page: n, totalPages: t }), p = (() => {
|
|
223
|
+
if (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), N = r === 0 ? 0 : (h - 1) * e + 1, k = Math.min(h * e, r);
|
|
225
|
+
return u ? u({
|
|
226
|
+
page: h,
|
|
227
|
+
totalPages: t,
|
|
228
|
+
from: N,
|
|
229
|
+
to: k,
|
|
230
|
+
total: r
|
|
231
|
+
}) : r === 0 ? null : `Showing ${N} to ${k} of ${r} results`;
|
|
232
|
+
})(), x = t > 1;
|
|
233
|
+
return p == null && !x ? null : /* @__PURE__ */ y(
|
|
234
|
+
"div",
|
|
235
|
+
{
|
|
236
|
+
ref: V,
|
|
237
|
+
className: d(
|
|
238
|
+
"flex min-h-9 w-full items-center gap-4",
|
|
239
|
+
p == null ? "justify-center" : "justify-between",
|
|
240
|
+
i
|
|
241
|
+
),
|
|
242
|
+
"data-hook": s,
|
|
243
|
+
"data-slot": "pagination-controls",
|
|
244
|
+
"data-tracking-el": $ || "pagination-controls",
|
|
245
|
+
"data-tracking-label": B,
|
|
246
|
+
...G,
|
|
247
|
+
children: [
|
|
248
|
+
p != null && /* @__PURE__ */ a(
|
|
249
|
+
"span",
|
|
250
|
+
{
|
|
251
|
+
className: "text-body-sm text-muted-foreground",
|
|
252
|
+
"data-slot": "pagination-caption",
|
|
253
|
+
children: p
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
x && /* @__PURE__ */ a(
|
|
257
|
+
M,
|
|
258
|
+
{
|
|
259
|
+
ariaLabel: b,
|
|
260
|
+
className: d(p != null && "mx-0 w-auto justify-end"),
|
|
261
|
+
dataHook: `${s}-nav`,
|
|
262
|
+
children: /* @__PURE__ */ a(J, { children: F.map((c, h) => c === "previous" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
|
|
263
|
+
P,
|
|
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
|
+
j,
|
|
271
|
+
{
|
|
272
|
+
ariaLabel: l,
|
|
273
|
+
disabled: n >= t,
|
|
274
|
+
onClick: () => o(n + 1)
|
|
275
|
+
}
|
|
276
|
+
) }, "next") : c === "ellipsis" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(K, { srLabel: L }) }, `ellipsis-${h}`) : /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
|
|
277
|
+
R,
|
|
278
|
+
{
|
|
279
|
+
ariaLabel: C,
|
|
280
|
+
isActive: c === n,
|
|
281
|
+
page: c,
|
|
282
|
+
onClick: () => o(c)
|
|
283
|
+
}
|
|
284
|
+
) }, c)) })
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
O.displayName = "PaginationControls";
|
|
203
293
|
export {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
294
|
+
M as Pagination,
|
|
295
|
+
v as PaginationButton,
|
|
296
|
+
J as PaginationContent,
|
|
297
|
+
O as PaginationControls,
|
|
298
|
+
K as PaginationEllipsis,
|
|
299
|
+
m as PaginationItem,
|
|
209
300
|
R as PaginationLink,
|
|
210
|
-
|
|
301
|
+
j as PaginationNext,
|
|
211
302
|
P as PaginationPrevious,
|
|
212
|
-
|
|
303
|
+
D as usePagination
|
|
213
304
|
};
|
package/dist/progress.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 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
|
@@ -8,6 +8,17 @@ import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
|
8
8
|
* - `red` — critical / urgent
|
|
9
9
|
*/
|
|
10
10
|
type ProgressColor = "green" | "red" | "orange" | "yellow";
|
|
11
|
+
/**
|
|
12
|
+
* Text size of the label and value.
|
|
13
|
+
* - `sm` — 14px (`text-body-sm`), the default for metric rows in cards
|
|
14
|
+
* - `md` — 16px (`text-body`) for roomier layouts
|
|
15
|
+
*/
|
|
16
|
+
type ProgressSize = "sm" | "md";
|
|
17
|
+
/**
|
|
18
|
+
* Width of the label column as a share of the row, or `auto` to hug the text.
|
|
19
|
+
* Mirrors the Figma `Progress / Label` Width options.
|
|
20
|
+
*/
|
|
21
|
+
type ProgressLabelWidth = "auto" | "20%" | "30%" | "40%" | "50%";
|
|
11
22
|
/**
|
|
12
23
|
* Props for the Progress component.
|
|
13
24
|
*/
|
|
@@ -30,14 +41,31 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
|
|
|
30
41
|
*/
|
|
31
42
|
ariaLabel?: string;
|
|
32
43
|
/**
|
|
33
|
-
* Optional visible label text displayed to the left of the progress bar
|
|
44
|
+
* Optional visible label text displayed to the left of the progress bar.
|
|
45
|
+
* Rendered inside a fixed-width column (see `labelWidth`); longer labels
|
|
46
|
+
* wrap onto further lines while the bar and value stay in their columns.
|
|
34
47
|
*/
|
|
35
48
|
label?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Width of the label column: `"20%"` … `"50%"` of the row in 10% steps, or
|
|
51
|
+
* `"auto"`. Every row that uses the same percentage starts its bar at the
|
|
52
|
+
* same x-position, so stacked rows inside a card line up — pick the step that
|
|
53
|
+
* keeps the labels in that card to one or two lines. Use `"auto"` for a
|
|
54
|
+
* single row that isn't aligned with others: the label hugs its text (capped
|
|
55
|
+
* at 40% of the row) and the bar starts right after it.
|
|
56
|
+
* @default "40%"
|
|
57
|
+
*/
|
|
58
|
+
labelWidth?: ProgressLabelWidth;
|
|
36
59
|
/**
|
|
37
60
|
* Brand color for the indicator.
|
|
38
61
|
* @default "green"
|
|
39
62
|
*/
|
|
40
63
|
color?: ProgressColor;
|
|
64
|
+
/**
|
|
65
|
+
* Row size: `sm` = 14px text with an 8px bar, `md` = 16px text with a 12px bar.
|
|
66
|
+
* @default "sm"
|
|
67
|
+
*/
|
|
68
|
+
size?: ProgressSize;
|
|
41
69
|
/**
|
|
42
70
|
* Whether to render the numeric value to the right of the progress bar.
|
|
43
71
|
* Falls back to `–` when no value is provided so the layout stays consistent.
|
|
@@ -53,7 +81,7 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
|
|
|
53
81
|
unit?: string;
|
|
54
82
|
/**
|
|
55
83
|
* Custom class name for the indicator (progress fill)
|
|
56
|
-
* Use this to customize the color, e.g., "bg-red
|
|
84
|
+
* Use this to customize the color, e.g., "bg-chart-red"
|
|
57
85
|
*/
|
|
58
86
|
indicatorClassName?: string;
|
|
59
87
|
/**
|
|
@@ -65,8 +93,14 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
|
|
|
65
93
|
/**
|
|
66
94
|
* Progress component for displaying loading states and task completion.
|
|
67
95
|
* Built on Radix UI Progress primitive with Framer Motion animation.
|
|
96
|
+
*
|
|
97
|
+
* With a `label` and/or `showValue` the bar renders as a three-column row:
|
|
98
|
+
* a fixed-width label column, the bar filling the remaining space, and a
|
|
99
|
+
* right-aligned value column sized to the widest value it can show — so rows
|
|
100
|
+
* stacked in a card share the same bar start position and width, even when
|
|
101
|
+
* a label wraps onto two lines.
|
|
68
102
|
*/
|
|
69
103
|
declare const Progress: React.ForwardRefExoticComponent<Omit<ProgressProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
70
104
|
export { Progress };
|
|
71
|
-
export type { ProgressProps, ProgressColor };
|
|
105
|
+
export type { ProgressProps, ProgressColor, ProgressSize, ProgressLabelWidth };
|
|
72
106
|
//# sourceMappingURL=progress.d.ts.map
|
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;
|
|
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"}
|