@brightlocal/ui-components 2.19.0 → 2.21.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/AI_USAGE.md +2 -0
- package/README.md +27 -14
- package/component-meta.json +27 -11
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +34 -33
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +14 -16
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +20 -2
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +99 -89
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +9 -6
- package/dist/browser-entry.d.ts +2 -0
- package/dist/browser-entry.d.ts.map +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +12 -12
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +47 -46
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +35 -34
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +48 -47
- package/dist/hooks/use-overlay-pointer-lock.cjs +1 -0
- package/dist/hooks/use-overlay-pointer-lock.d.ts +20 -0
- package/dist/hooks/use-overlay-pointer-lock.d.ts.map +1 -0
- package/dist/hooks/use-overlay-pointer-lock.js +39 -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 +88 -86
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +1 -1
- package/dist/logo.js +2 -2
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts +19 -0
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +134 -96
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +12 -8
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +117 -113
- package/dist/popover.cjs +1 -1
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +21 -20
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +28 -2
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +90 -49
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +25 -23
- package/dist/separator.cjs +1 -1
- package/dist/separator.d.ts +14 -0
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +90 -44
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +29 -28
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/sonner.d.ts +1 -1
- package/package.json +5 -1
- package/src/blocks/data-table.tsx +0 -2
- package/src/blocks/sidebar.tsx +40 -13
- package/src/browser-entry.ts +10 -0
- package/src/components/alert-dialog.tsx +20 -14
- package/src/components/breadcrumb.tsx +6 -3
- package/src/components/button.tsx +7 -1
- package/src/components/context-menu.tsx +19 -13
- package/src/components/dialog.tsx +4 -0
- package/src/components/dropdown-menu.tsx +4 -0
- package/src/components/logo.tsx +3 -3
- package/src/components/navigation-menu.tsx +134 -32
- package/src/components/pagination.tsx +47 -67
- package/src/components/popover.tsx +22 -16
- package/src/components/progress.tsx +118 -14
- package/src/components/select.tsx +4 -0
- package/src/components/separator.tsx +91 -23
- package/src/components/sheet.tsx +4 -0
- package/src/components/skeleton.tsx +1 -1
- package/src/components/sonner.tsx +1 -1
- package/src/hooks/use-overlay-pointer-lock.ts +128 -0
- package/src/index.ts +1 -0
package/dist/pagination.js
CHANGED
|
@@ -1,48 +1,47 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { MoreHorizontal as v, ChevronRight as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { cn as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
boundaryCount: a = 1
|
|
1
|
+
import { jsx as s, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import { MoreHorizontal as v, ChevronRight as b, ChevronLeft as x } from "@brightlocal/icons";
|
|
4
|
+
import { cva as y } from "class-variance-authority";
|
|
5
|
+
import { cn as d } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { useIsBelowBreakpoint as N } from "@brightlocal/ui-components/hooks/use-breakpoint";
|
|
7
|
+
function I({
|
|
8
|
+
page: i,
|
|
9
|
+
totalPages: a
|
|
11
10
|
}) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
r.push(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
r.push(
|
|
33
|
-
|
|
34
|
-
|
|
11
|
+
const n = N("sm") ? 5 : 7;
|
|
12
|
+
return c.useMemo(() => {
|
|
13
|
+
const t = Math.max(5, n), r = [];
|
|
14
|
+
if (r.push("previous"), a <= t)
|
|
15
|
+
for (let u = 1; u <= a; u++)
|
|
16
|
+
r.push(u);
|
|
17
|
+
else {
|
|
18
|
+
const u = Math.floor((t - 5) / 2), f = t - 3, m = a - f;
|
|
19
|
+
if (i <= f) {
|
|
20
|
+
for (let o = 1; o <= t - 2; o++)
|
|
21
|
+
r.push(o);
|
|
22
|
+
r.push("ellipsis", a);
|
|
23
|
+
} else if (i >= m) {
|
|
24
|
+
r.push(1, "ellipsis");
|
|
25
|
+
for (let o = a - (t - 3); o <= a; o++)
|
|
26
|
+
r.push(o);
|
|
27
|
+
} else {
|
|
28
|
+
r.push(1, "ellipsis");
|
|
29
|
+
for (let o = i - u; o <= i + u; o++)
|
|
30
|
+
r.push(o);
|
|
31
|
+
r.push("ellipsis", a);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
35
34
|
return r.push("next"), r;
|
|
36
|
-
}, [
|
|
35
|
+
}, [i, a, n]);
|
|
37
36
|
}
|
|
38
|
-
const
|
|
37
|
+
const g = y(
|
|
39
38
|
[
|
|
40
39
|
// Base styles - circular button
|
|
41
40
|
"inline-flex items-center justify-center",
|
|
42
41
|
"h-9 w-9",
|
|
43
42
|
"rounded-full",
|
|
44
43
|
"text-sm font-medium",
|
|
45
|
-
"transition-colors",
|
|
44
|
+
"transition-colors duration-200 ease-out",
|
|
46
45
|
"focus-visible:outline-none focus-visible:shadow-default"
|
|
47
46
|
],
|
|
48
47
|
{
|
|
@@ -71,7 +70,12 @@ const u = N(
|
|
|
71
70
|
// Disabled state
|
|
72
71
|
"aria-disabled:opacity-50 aria-disabled:cursor-default aria-disabled:pointer-events-none"
|
|
73
72
|
],
|
|
74
|
-
ellipsis: [
|
|
73
|
+
ellipsis: [
|
|
74
|
+
"relative",
|
|
75
|
+
"cursor-default",
|
|
76
|
+
"text-foreground",
|
|
77
|
+
"pointer-events-none"
|
|
78
|
+
]
|
|
75
79
|
}
|
|
76
80
|
},
|
|
77
81
|
defaultVariants: {
|
|
@@ -80,130 +84,130 @@ const u = N(
|
|
|
80
84
|
}
|
|
81
85
|
);
|
|
82
86
|
function k({
|
|
83
|
-
className:
|
|
84
|
-
dataHook:
|
|
85
|
-
trackingEl:
|
|
86
|
-
trackingLabel:
|
|
87
|
-
ariaLabel:
|
|
88
|
-
...
|
|
87
|
+
className: i,
|
|
88
|
+
dataHook: a,
|
|
89
|
+
trackingEl: e,
|
|
90
|
+
trackingLabel: n,
|
|
91
|
+
ariaLabel: l,
|
|
92
|
+
...t
|
|
89
93
|
}) {
|
|
90
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ s(
|
|
91
95
|
"nav",
|
|
92
96
|
{
|
|
93
|
-
"aria-label":
|
|
94
|
-
className:
|
|
95
|
-
"data-hook":
|
|
97
|
+
"aria-label": l ?? "Pagination",
|
|
98
|
+
className: d("mx-auto flex w-full justify-center", i),
|
|
99
|
+
"data-hook": a,
|
|
96
100
|
"data-slot": "pagination",
|
|
97
|
-
"data-tracking-el":
|
|
98
|
-
"data-tracking-label":
|
|
101
|
+
"data-tracking-el": e || "pagination",
|
|
102
|
+
"data-tracking-label": n,
|
|
99
103
|
role: "navigation",
|
|
100
|
-
...
|
|
104
|
+
...t
|
|
101
105
|
}
|
|
102
106
|
);
|
|
103
107
|
}
|
|
104
108
|
k.displayName = "Pagination";
|
|
105
|
-
function
|
|
106
|
-
className:
|
|
107
|
-
...
|
|
109
|
+
function V({
|
|
110
|
+
className: i,
|
|
111
|
+
...a
|
|
108
112
|
}) {
|
|
109
|
-
return /* @__PURE__ */
|
|
113
|
+
return /* @__PURE__ */ s(
|
|
110
114
|
"ul",
|
|
111
115
|
{
|
|
112
|
-
className:
|
|
116
|
+
className: d("flex flex-row items-center gap-2", i),
|
|
113
117
|
"data-slot": "pagination-content",
|
|
114
|
-
...
|
|
118
|
+
...a
|
|
115
119
|
}
|
|
116
120
|
);
|
|
117
121
|
}
|
|
118
|
-
function
|
|
119
|
-
return /* @__PURE__ */
|
|
122
|
+
function L(i) {
|
|
123
|
+
return /* @__PURE__ */ s("li", { "data-slot": "pagination-item", ...i });
|
|
120
124
|
}
|
|
121
|
-
const
|
|
125
|
+
const p = c.forwardRef(({ className: i, variant: a, isActive: e, children: n, ...l }, t) => /* @__PURE__ */ s(
|
|
122
126
|
"button",
|
|
123
127
|
{
|
|
124
|
-
ref:
|
|
125
|
-
"aria-current":
|
|
126
|
-
className:
|
|
127
|
-
"data-active":
|
|
128
|
+
ref: t,
|
|
129
|
+
"aria-current": e ? "page" : void 0,
|
|
130
|
+
className: d(g({ variant: a }), i),
|
|
131
|
+
"data-active": e,
|
|
128
132
|
"data-slot": "pagination-button",
|
|
129
133
|
type: "button",
|
|
130
|
-
...
|
|
131
|
-
children:
|
|
134
|
+
...l,
|
|
135
|
+
children: n
|
|
132
136
|
}
|
|
133
137
|
));
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
138
|
+
p.displayName = "PaginationButton";
|
|
139
|
+
const P = c.forwardRef(({ className: i, disabled: a, ariaLabel: e, ...n }, l) => /* @__PURE__ */ s(
|
|
140
|
+
p,
|
|
137
141
|
{
|
|
138
|
-
ref:
|
|
139
|
-
"aria-disabled":
|
|
140
|
-
"aria-label":
|
|
141
|
-
className:
|
|
142
|
-
disabled:
|
|
142
|
+
ref: l,
|
|
143
|
+
"aria-disabled": a,
|
|
144
|
+
"aria-label": e ?? "Go to previous page",
|
|
145
|
+
className: i,
|
|
146
|
+
disabled: a,
|
|
143
147
|
variant: "previous",
|
|
144
|
-
...
|
|
145
|
-
children: /* @__PURE__ */
|
|
148
|
+
...n,
|
|
149
|
+
children: /* @__PURE__ */ s(x, {})
|
|
146
150
|
}
|
|
147
151
|
));
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
({ className:
|
|
151
|
-
|
|
152
|
+
P.displayName = "PaginationPrevious";
|
|
153
|
+
const w = c.forwardRef(
|
|
154
|
+
({ className: i, disabled: a, ariaLabel: e, ...n }, l) => /* @__PURE__ */ s(
|
|
155
|
+
p,
|
|
152
156
|
{
|
|
153
|
-
ref:
|
|
154
|
-
"aria-disabled":
|
|
155
|
-
"aria-label":
|
|
156
|
-
className:
|
|
157
|
-
disabled:
|
|
157
|
+
ref: l,
|
|
158
|
+
"aria-disabled": a,
|
|
159
|
+
"aria-label": e ?? "Go to next page",
|
|
160
|
+
className: i,
|
|
161
|
+
disabled: a,
|
|
158
162
|
variant: "next",
|
|
159
|
-
...
|
|
160
|
-
children: /* @__PURE__ */
|
|
163
|
+
...n,
|
|
164
|
+
children: /* @__PURE__ */ s(b, {})
|
|
161
165
|
}
|
|
162
166
|
)
|
|
163
167
|
);
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
({ className:
|
|
167
|
-
|
|
168
|
+
w.displayName = "PaginationNext";
|
|
169
|
+
const R = c.forwardRef(
|
|
170
|
+
({ className: i, page: a, isActive: e, ariaLabel: n, ...l }, t) => /* @__PURE__ */ s(
|
|
171
|
+
p,
|
|
168
172
|
{
|
|
169
|
-
ref:
|
|
170
|
-
"aria-label":
|
|
171
|
-
className:
|
|
172
|
-
isActive:
|
|
173
|
+
ref: t,
|
|
174
|
+
"aria-label": n ? n.replace("{page}", String(a)) : `Go to page ${a}`,
|
|
175
|
+
className: i,
|
|
176
|
+
isActive: e,
|
|
173
177
|
variant: "link",
|
|
174
|
-
...
|
|
175
|
-
children:
|
|
178
|
+
...l,
|
|
179
|
+
children: a
|
|
176
180
|
}
|
|
177
181
|
)
|
|
178
182
|
);
|
|
179
|
-
|
|
180
|
-
function
|
|
181
|
-
className:
|
|
182
|
-
srLabel:
|
|
183
|
-
...
|
|
183
|
+
R.displayName = "PaginationLink";
|
|
184
|
+
function T({
|
|
185
|
+
className: i,
|
|
186
|
+
srLabel: a = "More pages",
|
|
187
|
+
...e
|
|
184
188
|
}) {
|
|
185
189
|
return /* @__PURE__ */ h(
|
|
186
190
|
"span",
|
|
187
191
|
{
|
|
188
192
|
"aria-hidden": "true",
|
|
189
|
-
className:
|
|
193
|
+
className: d(g({ variant: "ellipsis" }), i),
|
|
190
194
|
"data-slot": "pagination-ellipsis",
|
|
191
|
-
...
|
|
195
|
+
...e,
|
|
192
196
|
children: [
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ s(v, {}),
|
|
198
|
+
/* @__PURE__ */ s("span", { className: "sr-only", children: a })
|
|
195
199
|
]
|
|
196
200
|
}
|
|
197
201
|
);
|
|
198
202
|
}
|
|
199
203
|
export {
|
|
200
204
|
k as Pagination,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
p as PaginationButton,
|
|
206
|
+
V as PaginationContent,
|
|
207
|
+
T as PaginationEllipsis,
|
|
208
|
+
L as PaginationItem,
|
|
209
|
+
R as PaginationLink,
|
|
210
|
+
w as PaginationNext,
|
|
211
|
+
P as PaginationPrevious,
|
|
212
|
+
I as usePagination
|
|
209
213
|
};
|
package/dist/popover.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("react"),v=require("@radix-ui/react-popover"),g=require("@brightlocal/ui-components/lib/utils");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("react"),v=require("@radix-ui/react-popover"),g=require("@brightlocal/ui-components/lib/utils"),P=require("@brightlocal/ui-components/hooks/use-overlay-pointer-lock");function s(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const i=s(m),a=s(v);function d({...e}){return r.jsx(a.Root,{"data-slot":"popover",...e})}d.displayName="Popover";const p=i.forwardRef(({dataHook:e,...t},o)=>r.jsx(a.Trigger,{ref:o,"data-slot":"popover-trigger",...e!=null&&{"data-hook":e},...t}));p.displayName="PopoverTrigger";const c=i.forwardRef(({className:e,align:t="center",sideOffset:o=4,dataHook:n,...u},f)=>(P.useOverlayPointerLock(),r.jsx(a.Portal,{children:r.jsx(a.Content,{ref:f,align:t,className:g.cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),"data-hook":n,"data-slot":"popover-content",sideOffset:o,...u})})));c.displayName="PopoverContent";const l=i.forwardRef(({dataHook:e,...t},o)=>r.jsx(a.Anchor,{ref:o,"data-hook":e,"data-slot":"popover-anchor",...t}));l.displayName="PopoverAnchor";exports.Popover=d;exports.PopoverAnchor=l;exports.PopoverContent=c;exports.PopoverTrigger=p;
|
package/dist/popover.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/components/popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/components/popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAK5D,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CACxD,OAAO,gBAAgB,CAAC,IAAI,CAC7B;IACC,kGAAkG;IAClG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gDAAgD;IAChD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,sHAAsH;IACtH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,iBAAS,OAAO,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,2CAE1C;kBAFQ,OAAO;;;AAKhB,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAC/D,OAAO,gBAAgB,CAAC,OAAO,CAChC;IACC,2GAA2G;IAC3G,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,QAAA,MAAM,cAAc,4GAUlB,CAAC;AAGH,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAC/D,OAAO,gBAAgB,CAAC,OAAO,CAChC;IACC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kGAAkG;IAClG,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uIAAuI;IACvI,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC9B,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,QAAA,MAAM,cAAc,yGA4BnB,CAAC;AAGF,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAC9D,OAAO,gBAAgB,CAAC,MAAM,CAC/B;IACC,2GAA2G;IAC3G,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,QAAA,MAAM,aAAa,wGAUjB,CAAC;AAGH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/popover.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import * as d from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as a from "@radix-ui/react-popover";
|
|
4
4
|
import { cn as s } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { useOverlayPointerLock as m } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
|
|
6
|
+
function l({ ...o }) {
|
|
7
|
+
return /* @__PURE__ */ r(a.Root, { "data-slot": "popover", ...o });
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
l.displayName = "Popover";
|
|
10
|
+
const f = d.forwardRef(({ dataHook: o, ...t }, e) => /* @__PURE__ */ r(
|
|
11
|
+
a.Trigger,
|
|
11
12
|
{
|
|
12
13
|
ref: e,
|
|
13
14
|
"data-slot": "popover-trigger",
|
|
@@ -15,10 +16,10 @@ const l = d.forwardRef(({ dataHook: o, ...t }, e) => /* @__PURE__ */ a(
|
|
|
15
16
|
...t
|
|
16
17
|
}
|
|
17
18
|
));
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
({ className: o, align: t = "center", sideOffset: e = 4, dataHook: i, ...n }, p) => /* @__PURE__ */ a
|
|
21
|
-
|
|
19
|
+
f.displayName = "PopoverTrigger";
|
|
20
|
+
const c = d.forwardRef(
|
|
21
|
+
({ className: o, align: t = "center", sideOffset: e = 4, dataHook: i, ...n }, p) => (m(), /* @__PURE__ */ r(a.Portal, { children: /* @__PURE__ */ r(
|
|
22
|
+
a.Content,
|
|
22
23
|
{
|
|
23
24
|
ref: p,
|
|
24
25
|
align: t,
|
|
@@ -31,11 +32,11 @@ const f = d.forwardRef(
|
|
|
31
32
|
sideOffset: e,
|
|
32
33
|
...n
|
|
33
34
|
}
|
|
34
|
-
) })
|
|
35
|
+
) }))
|
|
35
36
|
);
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
c.displayName = "PopoverContent";
|
|
38
|
+
const v = d.forwardRef(({ dataHook: o, ...t }, e) => /* @__PURE__ */ r(
|
|
39
|
+
a.Anchor,
|
|
39
40
|
{
|
|
40
41
|
ref: e,
|
|
41
42
|
"data-hook": o,
|
|
@@ -43,10 +44,10 @@ const c = d.forwardRef(({ dataHook: o, ...t }, e) => /* @__PURE__ */ a(
|
|
|
43
44
|
...t
|
|
44
45
|
}
|
|
45
46
|
));
|
|
46
|
-
|
|
47
|
+
v.displayName = "PopoverAnchor";
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
l as Popover,
|
|
50
|
+
v as PopoverAnchor,
|
|
51
|
+
c as PopoverContent,
|
|
52
|
+
f as PopoverTrigger
|
|
52
53
|
};
|
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 a=require("react/jsx-runtime"),N=require("react"),S=require("@radix-ui/react-progress"),q=require("framer-motion"),i=require("@brightlocal/ui-components/lib/utils"),v=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion");function h(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const b=h(N),p=h(S),m={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"}};function _(e,t,r){if(e==null)return"–";if(r==="%")return`${t>0?Math.min(100,Math.max(0,Math.round(e/t*100))):0}%`;const n=r?` ${r}`:"";return t>0?`${e} / ${t}${n}`:`${e}${n}`}const y=b.forwardRef(({className:e,value:t,max:r=100,dataHook:n,trackingEl:c,trackingLabel:P,ariaLabel:j="Progress",label:d,color:x="green",showValue:o=!1,unit:M="%",indicatorClassName:k,disabled:l,...R},w)=>{const g=b.useId(),s=!!d,O=v.usePrefersReducedMotion(),u=m[x]??m.green,$=r>0?Math.min(100,Math.max(0,(t??0)/r*100)):0,f=a.jsx(p.Root,{ref:w,"aria-label":s?void 0:j,"aria-labelledby":s?g:void 0,className:i.cn("relative h-2 w-full overflow-hidden rounded-full",u.track,!s&&!o&&l&&"opacity-50",e),"data-hook":n,"data-slot":"progress","data-tracking-el":c,"data-tracking-label":P,max:r,value:t,...R,children:a.jsx(p.Indicator,{asChild:!0,children:a.jsx(q.motion.div,{animate:{transform:`translateX(-${100-$}%)`},className:i.cn("h-full w-full flex-1",u.indicator,k),"data-slot":"progress-indicator",initial:!1,transition:O?{duration:0}:{type:"spring",stiffness:80,damping:20,mass:1}})})});return!s&&!o?f:a.jsxs("div",{className:i.cn("flex w-full items-center gap-2",l&&"opacity-50"),"data-slot":"progress-wrapper",children:[s&&a.jsx("span",{className:"text-foreground text-xs leading-none font-medium","data-slot":"progress-label",id:g,children:d}),f,o&&a.jsx("span",{className:"text-muted-foreground shrink-0 text-xs leading-none tabular-nums","data-slot":"progress-value",children:_(t,r,M)})]})});y.displayName="Progress";exports.Progress=y;
|
package/dist/progress.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3
|
+
/**
|
|
4
|
+
* Brand color for the progress indicator, drawn from the shared brand palette.
|
|
5
|
+
* - `green` — strong / healthy / complete
|
|
6
|
+
* - `yellow` — moderate / acceptable
|
|
7
|
+
* - `orange` — weak / needs attention
|
|
8
|
+
* - `red` — critical / urgent
|
|
9
|
+
*/
|
|
10
|
+
type ProgressColor = "green" | "red" | "orange" | "yellow";
|
|
3
11
|
/**
|
|
4
12
|
* Props for the Progress component.
|
|
5
13
|
*/
|
|
@@ -22,9 +30,27 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
|
|
|
22
30
|
*/
|
|
23
31
|
ariaLabel?: string;
|
|
24
32
|
/**
|
|
25
|
-
* Optional visible label text displayed
|
|
33
|
+
* Optional visible label text displayed to the left of the progress bar
|
|
26
34
|
*/
|
|
27
35
|
label?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Brand color for the indicator.
|
|
38
|
+
* @default "green"
|
|
39
|
+
*/
|
|
40
|
+
color?: ProgressColor;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to render the numeric value to the right of the progress bar.
|
|
43
|
+
* Falls back to `–` when no value is provided so the layout stays consistent.
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
showValue?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Unit/suffix appended to the displayed value. Use `"%"` for percentage form
|
|
49
|
+
* (value as a percentage of `max`, e.g. `90%`); any other unit renders
|
|
50
|
+
* fraction form (`3 / 5 steps`).
|
|
51
|
+
* @default "%"
|
|
52
|
+
*/
|
|
53
|
+
unit?: string;
|
|
28
54
|
/**
|
|
29
55
|
* Custom class name for the indicator (progress fill)
|
|
30
56
|
* Use this to customize the color, e.g., "bg-red-500"
|
|
@@ -42,5 +68,5 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
|
|
|
42
68
|
*/
|
|
43
69
|
declare const Progress: React.ForwardRefExoticComponent<Omit<ProgressProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
44
70
|
export { Progress };
|
|
45
|
-
export type { ProgressProps };
|
|
71
|
+
export type { ProgressProps, ProgressColor };
|
|
46
72
|
//# 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;AAM9D;;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;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,QAAQ,
|
|
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;AAM9D;;;;;;GAMG;AACH,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AA0D3D;;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;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;;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;;;GAGG;AACH,QAAA,MAAM,QAAQ,mGA8Gb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/progress.js
CHANGED
|
@@ -1,52 +1,85 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import { motion as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { usePrefersReducedMotion as
|
|
7
|
-
const
|
|
1
|
+
import { jsx as o, jsxs as R } from "react/jsx-runtime";
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import * as b from "@radix-ui/react-progress";
|
|
4
|
+
import { motion as v } from "framer-motion";
|
|
5
|
+
import { cn as i } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { usePrefersReducedMotion as I } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
|
|
7
|
+
const u = {
|
|
8
|
+
green: {
|
|
9
|
+
track: "bg-brand-primary-foreground/20",
|
|
10
|
+
indicator: "bg-green-400"
|
|
11
|
+
},
|
|
12
|
+
red: {
|
|
13
|
+
track: "bg-brand-red/20",
|
|
14
|
+
indicator: "bg-brand-red"
|
|
15
|
+
},
|
|
16
|
+
orange: {
|
|
17
|
+
track: "bg-brand-orange/20",
|
|
18
|
+
indicator: "bg-brand-orange"
|
|
19
|
+
},
|
|
20
|
+
yellow: {
|
|
21
|
+
track: "bg-brand-yellow/20",
|
|
22
|
+
indicator: "bg-brand-yellow"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function L(t, r, e) {
|
|
26
|
+
if (t == null)
|
|
27
|
+
return "–";
|
|
28
|
+
if (e === "%")
|
|
29
|
+
return `${r > 0 ? Math.min(100, Math.max(0, Math.round(t / r * 100))) : 0}%`;
|
|
30
|
+
const n = e ? ` ${e}` : "";
|
|
31
|
+
return r > 0 ? `${t} / ${r}${n}` : `${t}${n}`;
|
|
32
|
+
}
|
|
33
|
+
const S = p.forwardRef(
|
|
8
34
|
({
|
|
9
|
-
className:
|
|
10
|
-
value:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
className: t,
|
|
36
|
+
value: r,
|
|
37
|
+
max: e = 100,
|
|
38
|
+
dataHook: n,
|
|
39
|
+
trackingEl: d,
|
|
40
|
+
trackingLabel: h,
|
|
41
|
+
ariaLabel: y = "Progress",
|
|
42
|
+
label: l,
|
|
43
|
+
color: k = "green",
|
|
44
|
+
showValue: s = !1,
|
|
45
|
+
unit: x = "%",
|
|
46
|
+
indicatorClassName: $,
|
|
47
|
+
disabled: c,
|
|
48
|
+
...w
|
|
49
|
+
}, M) => {
|
|
50
|
+
const g = p.useId(), a = !!l, P = I(), f = u[k] ?? u.green, N = e > 0 ? Math.min(100, Math.max(0, (r ?? 0) / e * 100)) : 0, m = /* @__PURE__ */ o(
|
|
51
|
+
b.Root,
|
|
22
52
|
{
|
|
23
|
-
ref:
|
|
24
|
-
"aria-label": a ? void 0 :
|
|
25
|
-
"aria-labelledby": a ?
|
|
26
|
-
className:
|
|
53
|
+
ref: M,
|
|
54
|
+
"aria-label": a ? void 0 : y,
|
|
55
|
+
"aria-labelledby": a ? g : void 0,
|
|
56
|
+
className: i(
|
|
27
57
|
"relative h-2 w-full overflow-hidden rounded-full",
|
|
28
|
-
|
|
29
|
-
!a &&
|
|
30
|
-
|
|
58
|
+
f.track,
|
|
59
|
+
!a && !s && c && "opacity-50",
|
|
60
|
+
t
|
|
31
61
|
),
|
|
32
|
-
"data-hook":
|
|
62
|
+
"data-hook": n,
|
|
33
63
|
"data-slot": "progress",
|
|
34
|
-
"data-tracking-el":
|
|
35
|
-
"data-tracking-label":
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
64
|
+
"data-tracking-el": d,
|
|
65
|
+
"data-tracking-label": h,
|
|
66
|
+
max: e,
|
|
67
|
+
value: r,
|
|
68
|
+
...w,
|
|
69
|
+
children: /* @__PURE__ */ o(b.Indicator, { asChild: !0, children: /* @__PURE__ */ o(
|
|
70
|
+
v.div,
|
|
39
71
|
{
|
|
40
72
|
animate: {
|
|
41
|
-
transform: `translateX(-${100 -
|
|
73
|
+
transform: `translateX(-${100 - N}%)`
|
|
42
74
|
},
|
|
43
|
-
className:
|
|
44
|
-
"h-full w-full flex-1
|
|
45
|
-
|
|
75
|
+
className: i(
|
|
76
|
+
"h-full w-full flex-1",
|
|
77
|
+
f.indicator,
|
|
78
|
+
$
|
|
46
79
|
),
|
|
47
80
|
"data-slot": "progress-indicator",
|
|
48
81
|
initial: !1,
|
|
49
|
-
transition:
|
|
82
|
+
transition: P ? { duration: 0 } : {
|
|
50
83
|
type: "spring",
|
|
51
84
|
stiffness: 80,
|
|
52
85
|
damping: 20,
|
|
@@ -56,31 +89,39 @@ const P = l.forwardRef(
|
|
|
56
89
|
) })
|
|
57
90
|
}
|
|
58
91
|
);
|
|
59
|
-
return
|
|
92
|
+
return !a && !s ? m : /* @__PURE__ */ R(
|
|
60
93
|
"div",
|
|
61
94
|
{
|
|
62
|
-
className:
|
|
95
|
+
className: i(
|
|
63
96
|
"flex w-full items-center gap-2",
|
|
64
|
-
|
|
97
|
+
c && "opacity-50"
|
|
65
98
|
),
|
|
66
99
|
"data-slot": "progress-wrapper",
|
|
67
100
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
101
|
+
a && /* @__PURE__ */ o(
|
|
69
102
|
"span",
|
|
70
103
|
{
|
|
71
|
-
className: "text-foreground text-
|
|
104
|
+
className: "text-foreground text-xs leading-none font-medium",
|
|
72
105
|
"data-slot": "progress-label",
|
|
73
|
-
id:
|
|
74
|
-
children:
|
|
106
|
+
id: g,
|
|
107
|
+
children: l
|
|
75
108
|
}
|
|
76
109
|
),
|
|
77
|
-
|
|
110
|
+
m,
|
|
111
|
+
s && /* @__PURE__ */ o(
|
|
112
|
+
"span",
|
|
113
|
+
{
|
|
114
|
+
className: "text-muted-foreground shrink-0 text-xs leading-none tabular-nums",
|
|
115
|
+
"data-slot": "progress-value",
|
|
116
|
+
children: L(r, e, x)
|
|
117
|
+
}
|
|
118
|
+
)
|
|
78
119
|
]
|
|
79
120
|
}
|
|
80
|
-
)
|
|
121
|
+
);
|
|
81
122
|
}
|
|
82
123
|
);
|
|
83
|
-
|
|
124
|
+
S.displayName = "Progress";
|
|
84
125
|
export {
|
|
85
|
-
|
|
126
|
+
S as Progress
|
|
86
127
|
};
|