@brightlocal/ui-components 3.0.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 +2 -1
- package/component-meta.json +90 -19
- package/deprecations.json +113 -3
- 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/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +41 -49
- package/dist/button-group.cjs +1 -0
- package/dist/button-group.d.ts +36 -0
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +47 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +20 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +83 -75
- package/dist/chart.cjs +2 -2
- package/dist/chart.d.ts +40 -12
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +86 -71
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +38 -4
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +95 -81
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +250 -224
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +32 -1
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +340 -330
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +13 -5
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +54 -53
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +8 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +79 -52
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +105 -13
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +146 -129
- package/dist/grid.d.ts +2 -2
- package/dist/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.js +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +547 -538
- 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 +26 -25
- 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/pagination.cjs +1 -1
- package/dist/pagination.d.ts +3 -0
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +57 -57
- package/dist/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 +87 -83
- package/dist/typography-heading.cjs +1 -1
- package/dist/typography-heading.d.ts +13 -0
- package/dist/typography-heading.d.ts.map +1 -1
- package/dist/typography-heading.js +32 -21
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +14 -0
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +35 -24
- package/package.json +1 -1
- package/src/blocks/empty-state.tsx +9 -21
- package/src/components/accordion.tsx +82 -27
- package/src/components/button-group.tsx +112 -0
- package/src/components/button.tsx +1 -1
- package/src/components/card.tsx +38 -3
- package/src/components/chart.tsx +63 -18
- package/src/components/chip.tsx +83 -10
- package/src/components/command.tsx +55 -3
- package/src/components/data-table.tsx +67 -7
- package/src/components/date-picker.tsx +18 -7
- package/src/components/field.tsx +81 -12
- package/src/components/global-layout.tsx +176 -38
- package/src/components/grid.tsx +2 -2
- package/src/components/input-password.tsx +23 -11
- package/src/components/pagination.tsx +10 -3
- package/src/components/scroll-area.tsx +23 -10
- package/src/components/select.tsx +30 -6
- package/src/components/typography-heading.tsx +24 -0
- package/src/components/typography-text.tsx +26 -1
- package/src/index.ts +1 -0
- package/src/lib/empty-chip.ts +24 -0
package/dist/input-password.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),D=require("react"),j=require("@brightlocal/icons"),M=require("@brightlocal/ui-components/progress"),y=require("@brightlocal/ui-components/lib/utils"),w=require("@brightlocal/ui-components/input-group");function $(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const n=$(D),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),D=require("react"),j=require("@brightlocal/icons"),M=require("@brightlocal/ui-components/progress"),y=require("@brightlocal/ui-components/lib/utils"),w=require("@brightlocal/ui-components/input-group");function $(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const n=$(D),L={meter:{label:"Meter",value:0,color:"bg-green-500"},weak:{label:"Weak",value:25,color:"bg-green-500"},ok:{label:"Ok",value:50,color:"bg-green-500"},good:{label:"Good",value:75,color:"bg-green-500"},great:{label:"Great",value:100,color:"bg-green-500"}};function _(e){if(!e||e.length===0)return"meter";if(e.length<12)return"weak";let t=0;return e.length>=16&&(t+=1),/[a-z]/.test(e)&&(t+=1),/[A-Z]/.test(e)&&(t+=1),/[0-9]/.test(e)&&(t+=1),/[^a-zA-Z0-9]/.test(e)&&(t+=1),t<=1?"ok":t<=3?"good":"great"}const q=n.createContext(null);function k(){const e=n.useContext(q);if(!e)throw new Error("InputPassword compound components must be used within InputPassword");return e}function E({children:e,dataHook:t,trackingEl:o,trackingLabel:r,disabled:u,value:a,onChange:l,onStrengthChange:c,strengthLevels:g,calculateStrength:p,error:i,id:h,className:f}){const[b,P]=n.useState(!1),[S,v]=n.useState(""),[m,I]=n.useState("meter"),F=n.useId(),N=h||F,x=a!==void 0?a:S,T=g??L,G=p??_,C=n.useCallback(d=>{a===void 0&&v(d),l?.(d)},[a,l]),O=n.useCallback(()=>{P(d=>!d)},[]);n.useEffect(()=>{const d=setTimeout(()=>{const R=G(x);I(R),c?.(R)},180);return()=>clearTimeout(d)},[x,G,c]);const z=n.useMemo(()=>({showPassword:b,setShowPassword:P,toggleVisibility:O,password:x,setPassword:C,strength:m,strengthLevels:T,disabled:u,dataHook:t,trackingEl:o,trackingLabel:r,inputId:N,error:i}),[b,O,x,C,m,T,u,t,o,r,N,i]);return s.jsx(q.Provider,{value:z,children:s.jsx("div",{className:y.cn("w-full",f),"data-hook":t,"data-slot":"input-password",children:e})})}E.displayName="InputPassword";const B=E,H=n.forwardRef(({className:e,groupClassName:t,onChange:o,showLabel:r,hideLabel:u,...a},l)=>{const{showPassword:c,toggleVisibility:g,password:p,setPassword:i,disabled:h,dataHook:f,trackingEl:b,trackingLabel:P,inputId:S,error:v}=k(),m=I=>{i(I.target.value),o?.(I)};return s.jsxs(w.InputGroup,{className:t,dataHook:f,error:v,children:[s.jsx(w.InputGroupInput,{ref:l,className:e,disabled:h,id:S,trackingEl:b,trackingLabel:P,type:c?"text":"password",value:p,onChange:m,...a}),s.jsx(w.InputGroupAddon,{align:"inline-end",children:s.jsx(w.InputGroupButton,{"aria-label":c?u??"Hide password":r??"Show password","data-hook":`${f}-toggle`,disabled:h,size:"icon-sm",variant:"ghost",onClick:g,children:c?s.jsx(j.EyeOff,{}):s.jsx(j.Eye,{})})})]})});H.displayName="InputPasswordField";const V=n.forwardRef(({className:e,showLabel:t,hideLabel:o,size:r="icon",variant:u="ghost",...a},l)=>{const{showPassword:c,toggleVisibility:g,disabled:p,dataHook:i}=k();return s.jsx(w.InputGroupButton,{ref:l,"aria-label":c?o??"Hide password":t??"Show password",className:e,"data-hook":`${i}-toggle`,disabled:p,size:r,variant:u,onClick:g,...a,children:c?s.jsx(j.EyeOff,{}):s.jsx(j.Eye,{})})});V.displayName="InputPasswordToggle";function A({className:e,showLabel:t=!0}){const{strength:o,strengthLevels:r,dataHook:u,disabled:a}=k(),l=r[o]??{label:o,value:0,color:"bg-muted"};return s.jsx("div",{className:y.cn("mt-1 space-y-2",e),children:s.jsxs("div",{className:y.cn("flex items-center gap-2",a&&"opacity-50"),children:[s.jsx(M.Progress,{className:"h-2 flex-1",dataHook:`${u}-strength-progress`,indicatorClassName:l.color,value:l.value}),t&&s.jsx("span",{className:"text-foreground text-label w-10 shrink-0 text-right whitespace-nowrap","data-hook":`${u}-strength-label`,children:l.label})]})})}A.displayName="InputPasswordStrength";exports.DEFAULT_STRENGTH_LEVELS=L;exports.InputPassword=E;exports.InputPasswordField=H;exports.InputPasswordRoot=B;exports.InputPasswordStrength=A;exports.InputPasswordToggle=V;exports.calculatePasswordStrength=_;
|
package/dist/input-password.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ declare const DEFAULT_STRENGTH_LEVELS: Record<DefaultPasswordStrength, StrengthL
|
|
|
21
21
|
* - Minimum 12 characters required for "ok" or better
|
|
22
22
|
*/
|
|
23
23
|
declare function calculatePasswordStrength(password: string): DefaultPasswordStrength;
|
|
24
|
-
export interface
|
|
24
|
+
export interface InputPasswordProps<T extends string = DefaultPasswordStrength> {
|
|
25
25
|
/**
|
|
26
26
|
* Data hook for automated testing (REQUIRED)
|
|
27
27
|
*/
|
|
@@ -86,16 +86,16 @@ export interface InputPasswordRootProps<T extends string = DefaultPasswordStreng
|
|
|
86
86
|
className?: string;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* InputPassword - Root component that provides context for all InputPassword parts
|
|
90
90
|
*
|
|
91
91
|
* Generic type parameter T allows custom strength levels:
|
|
92
92
|
* @example
|
|
93
93
|
* // Using default levels
|
|
94
|
-
* <
|
|
94
|
+
* <InputPassword dataHook="password">...</InputPassword>
|
|
95
95
|
*
|
|
96
96
|
* // Using custom levels
|
|
97
97
|
* type MyStrength = "empty" | "slow" | "medium" | "fast";
|
|
98
|
-
* <
|
|
98
|
+
* <InputPassword<MyStrength>
|
|
99
99
|
* dataHook="password"
|
|
100
100
|
* strengthLevels={{
|
|
101
101
|
* empty: { label: "Enter password", value: 0, color: "bg-muted" },
|
|
@@ -111,12 +111,20 @@ export interface InputPasswordRootProps<T extends string = DefaultPasswordStreng
|
|
|
111
111
|
* }}
|
|
112
112
|
* >
|
|
113
113
|
* ...
|
|
114
|
-
* </
|
|
114
|
+
* </InputPassword>
|
|
115
115
|
*/
|
|
116
|
-
declare function
|
|
117
|
-
declare namespace
|
|
116
|
+
declare function InputPassword<T extends string = DefaultPasswordStrength>({ children, dataHook, trackingEl, trackingLabel, disabled, value, onChange, onStrengthChange, strengthLevels, calculateStrength, error, id, className, }: InputPasswordProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
117
|
+
declare namespace InputPassword {
|
|
118
118
|
var displayName: string;
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* @deprecated Use `InputPassword` instead — family roots are bare names (DS-853).
|
|
122
|
+
*/
|
|
123
|
+
declare const InputPasswordRoot: typeof InputPassword;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Use `InputPasswordProps` instead — family roots are bare names (DS-853).
|
|
126
|
+
*/
|
|
127
|
+
export type InputPasswordRootProps<T extends string = DefaultPasswordStrength> = InputPasswordProps<T>;
|
|
120
128
|
export interface InputPasswordFieldProps extends Omit<React.ComponentProps<typeof InputGroupInput>, "type"> {
|
|
121
129
|
/**
|
|
122
130
|
* Additional class name for the InputGroup wrapper
|
|
@@ -169,12 +177,12 @@ export interface InputPasswordStrengthProps {
|
|
|
169
177
|
/**
|
|
170
178
|
* InputPasswordStrength - Password strength indicator
|
|
171
179
|
* Displays a progress bar and optional label showing password strength.
|
|
172
|
-
* Automatically uses the strength levels configured on
|
|
180
|
+
* Automatically uses the strength levels configured on InputPassword.
|
|
173
181
|
*/
|
|
174
182
|
declare function InputPasswordStrength({ className, showLabel, }: InputPasswordStrengthProps): import("react/jsx-runtime").JSX.Element;
|
|
175
183
|
declare namespace InputPasswordStrength {
|
|
176
184
|
var displayName: string;
|
|
177
185
|
}
|
|
178
|
-
export { InputPasswordRoot, InputPasswordField, InputPasswordToggle, InputPasswordStrength, calculatePasswordStrength, DEFAULT_STRENGTH_LEVELS, };
|
|
186
|
+
export { InputPassword, InputPasswordRoot, InputPasswordField, InputPasswordToggle, InputPasswordStrength, calculatePasswordStrength, DEFAULT_STRENGTH_LEVELS, };
|
|
179
187
|
export type { DefaultPasswordStrength, StrengthLevelConfig };
|
|
180
188
|
//# sourceMappingURL=input-password.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-password.d.ts","sourceRoot":"","sources":["../../src/components/input-password.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAEL,eAAe,EAEf,gBAAgB,EACjB,MAAM,wCAAwC,CAAC;AAMhD;;GAEG;AACH,KAAK,uBAAuB,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1E;;GAEG;AACH,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,QAAA,MAAM,uBAAuB,EAAE,MAAM,CACnC,uBAAuB,EACvB,mBAAmB,CAOpB,CAAC;AAEF;;;GAGG;AACH,iBAAS,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,uBAAuB,CAyB5E;AAkDD,MAAM,WAAW,
|
|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CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,mBAAmB,iHAsCxB,CAAC;AAQF,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,iBAAS,qBAAqB,CAAC,EAC7B,SAAS,EACT,SAAgB,GACjB,EAAE,0BAA0B,2CA+B5B;kBAlCQ,qBAAqB;;;AA0C9B,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,GACxB,CAAC;AAEF,YAAY,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,CAAC"}
|
package/dist/input-password.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as o, jsxs as H } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import { EyeOff as
|
|
4
|
-
import { Progress as
|
|
3
|
+
import { EyeOff as L, Eye as R } from "@brightlocal/icons";
|
|
4
|
+
import { Progress as j } from "@brightlocal/ui-components/progress";
|
|
5
5
|
import { cn as x } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
-
import { InputGroup as
|
|
7
|
-
const
|
|
6
|
+
import { InputGroup as M, InputGroupInput as O, InputGroupAddon as Z, InputGroupButton as V } from "@brightlocal/ui-components/input-group";
|
|
7
|
+
const _ = {
|
|
8
8
|
meter: { label: "Meter", value: 0, color: "bg-green-500" },
|
|
9
9
|
weak: { label: "Weak", value: 25, color: "bg-green-500" },
|
|
10
10
|
ok: { label: "Ok", value: 50, color: "bg-green-500" },
|
|
11
11
|
good: { label: "Good", value: 75, color: "bg-green-500" },
|
|
12
12
|
great: { label: "Great", value: 100, color: "bg-green-500" }
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function B(e) {
|
|
15
15
|
if (!e || e.length === 0)
|
|
16
16
|
return "meter";
|
|
17
17
|
if (e.length < 12)
|
|
@@ -24,11 +24,11 @@ function S() {
|
|
|
24
24
|
const e = s.useContext(A);
|
|
25
25
|
if (!e)
|
|
26
26
|
throw new Error(
|
|
27
|
-
"InputPassword compound components must be used within
|
|
27
|
+
"InputPassword compound components must be used within InputPassword"
|
|
28
28
|
);
|
|
29
29
|
return e;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function $({
|
|
32
32
|
children: e,
|
|
33
33
|
dataHook: t,
|
|
34
34
|
trackingEl: n,
|
|
@@ -43,7 +43,7 @@ function B({
|
|
|
43
43
|
id: h,
|
|
44
44
|
className: w
|
|
45
45
|
}) {
|
|
46
|
-
const [m, f] = s.useState(!1), [P, v] = s.useState(""), [k, b] = s.useState("meter"),
|
|
46
|
+
const [m, f] = s.useState(!1), [P, v] = s.useState(""), [k, b] = s.useState("meter"), z = s.useId(), y = h || z, I = r !== void 0 ? r : P, N = g ?? _, C = p ?? B, E = s.useCallback(
|
|
47
47
|
(u) => {
|
|
48
48
|
r === void 0 && v(u), a?.(u);
|
|
49
49
|
},
|
|
@@ -53,12 +53,12 @@ function B({
|
|
|
53
53
|
}, []);
|
|
54
54
|
s.useEffect(() => {
|
|
55
55
|
const u = setTimeout(() => {
|
|
56
|
-
const
|
|
57
|
-
b(
|
|
56
|
+
const T = C(I);
|
|
57
|
+
b(T), i?.(T);
|
|
58
58
|
}, 180);
|
|
59
59
|
return () => clearTimeout(u);
|
|
60
60
|
}, [I, C, i]);
|
|
61
|
-
const
|
|
61
|
+
const F = s.useMemo(
|
|
62
62
|
() => ({
|
|
63
63
|
showPassword: m,
|
|
64
64
|
setShowPassword: f,
|
|
@@ -89,7 +89,7 @@ function B({
|
|
|
89
89
|
c
|
|
90
90
|
]
|
|
91
91
|
);
|
|
92
|
-
return /* @__PURE__ */ o(A.Provider, { value:
|
|
92
|
+
return /* @__PURE__ */ o(A.Provider, { value: F, children: /* @__PURE__ */ o(
|
|
93
93
|
"div",
|
|
94
94
|
{
|
|
95
95
|
className: x("w-full", w),
|
|
@@ -99,8 +99,8 @@ function B({
|
|
|
99
99
|
}
|
|
100
100
|
) });
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
const D = s.forwardRef(
|
|
102
|
+
$.displayName = "InputPassword";
|
|
103
|
+
const Y = $, D = s.forwardRef(
|
|
104
104
|
({ className: e, groupClassName: t, onChange: n, showLabel: d, hideLabel: l, ...r }, a) => {
|
|
105
105
|
const {
|
|
106
106
|
showPassword: i,
|
|
@@ -114,9 +114,9 @@ const D = s.forwardRef(
|
|
|
114
114
|
inputId: P,
|
|
115
115
|
error: v
|
|
116
116
|
} = S();
|
|
117
|
-
return /* @__PURE__ */
|
|
117
|
+
return /* @__PURE__ */ H(M, { className: t, dataHook: w, error: v, children: [
|
|
118
118
|
/* @__PURE__ */ o(
|
|
119
|
-
|
|
119
|
+
O,
|
|
120
120
|
{
|
|
121
121
|
ref: a,
|
|
122
122
|
className: e,
|
|
@@ -132,7 +132,7 @@ const D = s.forwardRef(
|
|
|
132
132
|
...r
|
|
133
133
|
}
|
|
134
134
|
),
|
|
135
|
-
/* @__PURE__ */ o(
|
|
135
|
+
/* @__PURE__ */ o(Z, { align: "inline-end", children: /* @__PURE__ */ o(
|
|
136
136
|
V,
|
|
137
137
|
{
|
|
138
138
|
"aria-label": i ? l ?? "Hide password" : d ?? "Show password",
|
|
@@ -141,7 +141,7 @@ const D = s.forwardRef(
|
|
|
141
141
|
size: "icon-sm",
|
|
142
142
|
variant: "ghost",
|
|
143
143
|
onClick: g,
|
|
144
|
-
children: i ? /* @__PURE__ */ o(
|
|
144
|
+
children: i ? /* @__PURE__ */ o(L, {}) : /* @__PURE__ */ o(R, {})
|
|
145
145
|
}
|
|
146
146
|
) })
|
|
147
147
|
] });
|
|
@@ -170,7 +170,7 @@ const U = s.forwardRef(
|
|
|
170
170
|
variant: l,
|
|
171
171
|
onClick: g,
|
|
172
172
|
...r,
|
|
173
|
-
children: i ? /* @__PURE__ */ o(
|
|
173
|
+
children: i ? /* @__PURE__ */ o(L, {}) : /* @__PURE__ */ o(R, {})
|
|
174
174
|
}
|
|
175
175
|
);
|
|
176
176
|
}
|
|
@@ -185,9 +185,9 @@ function W({
|
|
|
185
185
|
value: 0,
|
|
186
186
|
color: "bg-muted"
|
|
187
187
|
};
|
|
188
|
-
return /* @__PURE__ */ o("div", { className: x("mt-1 space-y-2", e), children: /* @__PURE__ */
|
|
188
|
+
return /* @__PURE__ */ o("div", { className: x("mt-1 space-y-2", e), children: /* @__PURE__ */ H("div", { className: x("flex items-center gap-2", r && "opacity-50"), children: [
|
|
189
189
|
/* @__PURE__ */ o(
|
|
190
|
-
|
|
190
|
+
j,
|
|
191
191
|
{
|
|
192
192
|
className: "h-2 flex-1",
|
|
193
193
|
dataHook: `${l}-strength-progress`,
|
|
@@ -207,10 +207,11 @@ function W({
|
|
|
207
207
|
}
|
|
208
208
|
W.displayName = "InputPasswordStrength";
|
|
209
209
|
export {
|
|
210
|
-
|
|
210
|
+
_ as DEFAULT_STRENGTH_LEVELS,
|
|
211
|
+
$ as InputPassword,
|
|
211
212
|
D as InputPasswordField,
|
|
212
|
-
|
|
213
|
+
Y as InputPasswordRoot,
|
|
213
214
|
W as InputPasswordStrength,
|
|
214
215
|
U as InputPasswordToggle,
|
|
215
|
-
|
|
216
|
+
B as calculatePasswordStrength
|
|
216
217
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("class-variance-authority"),t=e.cva("bg-muted text-muted-foreground flex size-10 items-center justify-center rounded-full",{variants:{align:{center:"",left:"shrink-0"}},defaultVariants:{align:"center"}});exports.emptyChipStyles=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-chip.d.ts","sourceRoot":"","sources":["../../src/lib/empty-chip.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,eAAe;;8EAQ3B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cva as e } from "class-variance-authority";
|
|
2
|
+
const r = e(
|
|
3
|
+
"bg-muted text-muted-foreground flex size-10 items-center justify-center rounded-full",
|
|
4
|
+
{
|
|
5
|
+
variants: {
|
|
6
|
+
align: { center: "", left: "shrink-0" }
|
|
7
|
+
},
|
|
8
|
+
defaultVariants: { align: "center" }
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
export {
|
|
12
|
+
r as emptyChipStyles
|
|
13
|
+
};
|
package/dist/pagination.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),A=require("react"),m=require("@brightlocal/icons"),H=require("class-variance-authority"),d=require("@brightlocal/ui-components/lib/utils"),R=require("@brightlocal/ui-components/hooks/use-breakpoint");function S(i){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:()=>i[e]})}}return n.default=i,Object.freeze(n)}const f=S(A);function B({page:i,totalPages:n}){const r=R.useIsBelowBreakpoint("sm")?5:7;return f.useMemo(()=>{const t=Math.max(5,r),o=[];if(o.push("previous"),n<=t)for(let u=1;u<=n;u++)o.push(u);else{const u=Math.floor((t-5)/2),h=t-3,v=n-h;if(i<=h){for(let l=1;l<=t-2;l++)o.push(l);o.push("ellipsis",n)}else if(i>=v){o.push(1,"ellipsis");for(let l=n-(t-3);l<=n;l++)o.push(l)}else{o.push(1,"ellipsis");for(let l=i-u;l<=i+u;l++)o.push(l);o.push("ellipsis",n)}}return o.push("next"),o},[i,n,r])}const C=H.cva(["inline-flex items-center justify-center","h-9 w-9","rounded-full","text-label","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:shadow-default"],{variants:{variant:{previous:["text-foreground","hover:bg-accent","aria-disabled:opacity-50 aria-disabled:cursor-default aria-disabled:pointer-events-none"],next:["text-foreground","hover:bg-accent","aria-disabled:opacity-50 aria-disabled:cursor-default aria-disabled:pointer-events-none"],link:["text-foreground","hover:bg-accent hover:text-accent-foreground","aria-[current=page]:bg-background aria-[current=page]:border aria-[current=page]:border-input","dark:aria-[current=page]:bg-input/30","aria-[current=page]:hover:bg-accent","aria-[current=page]:focus-visible:border-ring","aria-disabled:opacity-50 aria-disabled:cursor-default aria-disabled:pointer-events-none"],ellipsis:["relative","cursor-default","text-foreground","pointer-events-none"]}},defaultVariants:{variant:"link"}});function j({className:i,dataHook:n,trackingEl:e,trackingLabel:r,ariaLabel:s,...t}){return a.jsx("nav",{"aria-label":s??"Pagination",className:d.cn("mx-auto flex w-full justify-center",i),"data-hook":n,"data-slot":"pagination","data-tracking-el":e||"pagination","data-tracking-label":r,role:"navigation",...t})}j.displayName="Pagination";function L({className:i,...n}){return a.jsx("ul",{className:d.cn("flex flex-row items-center gap-2",i),"data-slot":"pagination-content",...n})}function x(i){return a.jsx("li",{"data-slot":"pagination-item",...i})}const b=f.forwardRef(({className:i,variant:n,isActive:e,children:r,...s},t)=>a.jsx("button",{ref:t,"aria-current":e?"page":void 0,className:d.cn(C({variant:n}),i),"data-active":e,"data-slot":"pagination-button",type:"button",...s,children:r}));b.displayName="PaginationButton";const y=f.forwardRef(({className:i,disabled:n,ariaLabel:e,...r},s)=>a.jsx(b,{ref:s,"aria-disabled":n,"aria-label":e??"Go to previous page",className:i,disabled:n,variant:"previous",...r,children:a.jsx(m.ChevronLeft,{})}));y.displayName="PaginationPrevious";const P=f.forwardRef(({className:i,disabled:n,ariaLabel:e,...r},s)=>a.jsx(b,{ref:s,"aria-disabled":n,"aria-label":e??"Go to next page",className:i,disabled:n,variant:"next",...r,children:a.jsx(m.ChevronRight,{})}));P.displayName="PaginationNext";const k=f.forwardRef(({className:i,page:n,isActive:e,ariaLabel:r,...s},t)=>a.jsx(b,{ref:t,"aria-label":r?r.replace("{page}",String(n)):`Go to page ${n}`,className:i,isActive:e,variant:"link",...s,children:n}));k.displayName="PaginationLink";function q({className:i,srLabel:n="More pages",...e}){return a.jsxs("span",{"aria-hidden":"true",className:d.cn(C({variant:"ellipsis"}),i),"data-slot":"pagination-ellipsis",...e,children:[a.jsx(m.MoreHorizontal,{}),a.jsx("span",{className:"sr-only",children:n})]})}const O=f.forwardRef(({className:i,page:n,totalPages:e,onPageChange:r,dataHook:s,totalItems:t,pageSize:o,renderCaption:u,ariaLabel:h,prevAriaLabel:v,nextAriaLabel:l,pageAriaLabel:$,ellipsisSrLabel:T,trackingEl:V,trackingLabel:G,..._},D)=>{const E=B({page:n,totalPages:e}),F=R.useIsBelowBreakpoint("sm"),p=(()=>{if(F||u===null||t===void 0||o===void 0||!Number.isFinite(o)||o<=0||!Number.isFinite(t)||t<0)return null;const c=Math.max(1,Math.ceil(t/o)),g=Math.min(Math.max(1,Math.floor(n)||1),c),N=t===0?0:(g-1)*o+1,M=Math.min(g*o,t);return u?u({page:g,totalPages:e,from:N,to:M,total:t}):t===0?null:`Showing ${N} to ${M} of ${t} results`})(),w=e>1;return p==null&&!w?null:a.jsxs("div",{ref:D,className:d.cn("flex min-h-9 w-full flex-wrap items-center gap-x-4 gap-y-2",p==null?"justify-center":"justify-between",i),"data-hook":s,"data-slot":"pagination-controls","data-tracking-el":V||"pagination-controls","data-tracking-label":G,..._,children:[p!=null&&a.jsx("span",{className:"text-body-sm text-muted-foreground whitespace-nowrap","data-slot":"pagination-caption",children:p}),w&&a.jsx(j,{ariaLabel:h,className:d.cn(p!=null&&"mx-0 w-auto grow justify-end"),dataHook:`${s}-nav`,children:a.jsx(L,{children:E.map((c,g)=>c==="previous"?a.jsx(x,{children:a.jsx(y,{ariaLabel:v,disabled:n<=1,onClick:()=>r(n-1)})},"previous"):c==="next"?a.jsx(x,{children:a.jsx(P,{ariaLabel:l,disabled:n>=e,onClick:()=>r(n+1)})},"next"):c==="ellipsis"?a.jsx(x,{children:a.jsx(q,{srLabel:T})},`ellipsis-${g}`):a.jsx(x,{children:a.jsx(k,{ariaLabel:$,isActive:c===n,page:c,onClick:()=>r(c)})},c))})})]})});O.displayName="PaginationControls";exports.Pagination=j;exports.PaginationButton=b;exports.PaginationContent=L;exports.PaginationControls=O;exports.PaginationEllipsis=q;exports.PaginationItem=x;exports.PaginationLink=k;exports.PaginationNext=P;exports.PaginationPrevious=y;exports.usePagination=B;
|
package/dist/pagination.d.ts
CHANGED
|
@@ -190,6 +190,9 @@ interface PaginationControlsProps extends Omit<React.ComponentProps<"div">, "chi
|
|
|
190
190
|
* Controlled: the consumer holds `page` and updates it from `onPageChange`.
|
|
191
191
|
* Pass `totalItems` + `pageSize` to get the results caption; the caption sits
|
|
192
192
|
* on the left with the nav pushed right, and without one the nav centres.
|
|
193
|
+
* Below the `sm` viewport breakpoint the caption is removed and the nav
|
|
194
|
+
* centres, and from `sm` up the bar wraps inside narrow containers instead of
|
|
195
|
+
* overflowing — the same responsive rules as `DataTablePagination` (DS-998).
|
|
193
196
|
*
|
|
194
197
|
* There is nothing to navigate on a single page, so the nav hides itself at
|
|
195
198
|
* `totalPages <= 1` and the component renders nothing at all when the caption
|
package/dist/pagination.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/components/pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,UA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;IACH,aAAa,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,qBAAqB,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC1E;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,QAAA,MAAM,kBAAkB,6GAiJvB,CAAC;AAIF,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,GAC7B,CAAC"}
|
package/dist/pagination.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as a, jsxs as y } from "react/jsx-runtime";
|
|
2
2
|
import * as f from "react";
|
|
3
|
-
import { MoreHorizontal as
|
|
4
|
-
import { cva as
|
|
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
9
|
totalPages: n
|
|
10
10
|
}) {
|
|
11
|
-
const o =
|
|
11
|
+
const o = k("sm") ? 5 : 7;
|
|
12
12
|
return f.useMemo(() => {
|
|
13
13
|
const r = Math.max(5, o), e = [];
|
|
14
14
|
if (e.push("previous"), n <= r)
|
|
@@ -34,7 +34,7 @@ function D({
|
|
|
34
34
|
return e.push("next"), e;
|
|
35
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",
|
|
@@ -83,7 +83,7 @@ const w = q(
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
|
-
function
|
|
86
|
+
function P({
|
|
87
87
|
className: i,
|
|
88
88
|
dataHook: n,
|
|
89
89
|
trackingEl: t,
|
|
@@ -105,8 +105,8 @@ function M({
|
|
|
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
|
}) {
|
|
@@ -127,7 +127,7 @@ const v = f.forwardRef(({ className: i, variant: n, isActive: t, children: o, ..
|
|
|
127
127
|
{
|
|
128
128
|
ref: r,
|
|
129
129
|
"aria-current": t ? "page" : void 0,
|
|
130
|
-
className: d(
|
|
130
|
+
className: d(M({ variant: n }), i),
|
|
131
131
|
"data-active": t,
|
|
132
132
|
"data-slot": "pagination-button",
|
|
133
133
|
type: "button",
|
|
@@ -136,7 +136,7 @@ const v = f.forwardRef(({ className: i, variant: n, isActive: t, children: o, ..
|
|
|
136
136
|
}
|
|
137
137
|
));
|
|
138
138
|
v.displayName = "PaginationButton";
|
|
139
|
-
const
|
|
139
|
+
const j = f.forwardRef(({ className: i, disabled: n, ariaLabel: t, ...o }, s) => /* @__PURE__ */ a(
|
|
140
140
|
v,
|
|
141
141
|
{
|
|
142
142
|
ref: s,
|
|
@@ -146,11 +146,11 @@ const P = f.forwardRef(({ className: i, disabled: n, ariaLabel: t, ...o }, s) =>
|
|
|
146
146
|
disabled: n,
|
|
147
147
|
variant: "previous",
|
|
148
148
|
...o,
|
|
149
|
-
children: /* @__PURE__ */ a(
|
|
149
|
+
children: /* @__PURE__ */ a(A, {})
|
|
150
150
|
}
|
|
151
151
|
));
|
|
152
|
-
|
|
153
|
-
const
|
|
152
|
+
j.displayName = "PaginationPrevious";
|
|
153
|
+
const R = f.forwardRef(
|
|
154
154
|
({ className: i, disabled: n, ariaLabel: t, ...o }, s) => /* @__PURE__ */ a(
|
|
155
155
|
v,
|
|
156
156
|
{
|
|
@@ -161,12 +161,12 @@ const j = f.forwardRef(
|
|
|
161
161
|
disabled: n,
|
|
162
162
|
variant: "next",
|
|
163
163
|
...o,
|
|
164
|
-
children: /* @__PURE__ */ a(
|
|
164
|
+
children: /* @__PURE__ */ a(q, {})
|
|
165
165
|
}
|
|
166
166
|
)
|
|
167
167
|
);
|
|
168
|
-
|
|
169
|
-
const
|
|
168
|
+
R.displayName = "PaginationNext";
|
|
169
|
+
const C = f.forwardRef(
|
|
170
170
|
({ className: i, page: n, isActive: t, ariaLabel: o, ...s }, r) => /* @__PURE__ */ a(
|
|
171
171
|
v,
|
|
172
172
|
{
|
|
@@ -180,8 +180,8 @@ const R = f.forwardRef(
|
|
|
180
180
|
}
|
|
181
181
|
)
|
|
182
182
|
);
|
|
183
|
-
|
|
184
|
-
function
|
|
183
|
+
C.displayName = "PaginationLink";
|
|
184
|
+
function O({
|
|
185
185
|
className: i,
|
|
186
186
|
srLabel: n = "More pages",
|
|
187
187
|
...t
|
|
@@ -190,17 +190,17 @@ function K({
|
|
|
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__ */ a(
|
|
197
|
+
/* @__PURE__ */ a(H, {}),
|
|
198
198
|
/* @__PURE__ */ a("span", { className: "sr-only", children: n })
|
|
199
199
|
]
|
|
200
200
|
}
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
|
-
const
|
|
203
|
+
const Q = f.forwardRef(
|
|
204
204
|
({
|
|
205
205
|
className: i,
|
|
206
206
|
page: n,
|
|
@@ -213,70 +213,70 @@ const O = f.forwardRef(
|
|
|
213
213
|
ariaLabel: b,
|
|
214
214
|
prevAriaLabel: g,
|
|
215
215
|
nextAriaLabel: l,
|
|
216
|
-
pageAriaLabel:
|
|
217
|
-
ellipsisSrLabel:
|
|
218
|
-
trackingEl:
|
|
219
|
-
trackingLabel:
|
|
220
|
-
...
|
|
221
|
-
},
|
|
222
|
-
const
|
|
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),
|
|
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
225
|
return u ? u({
|
|
226
226
|
page: h,
|
|
227
227
|
totalPages: t,
|
|
228
|
-
from:
|
|
229
|
-
to:
|
|
228
|
+
from: w,
|
|
229
|
+
to: N,
|
|
230
230
|
total: r
|
|
231
|
-
}) : r === 0 ? null : `Showing ${
|
|
231
|
+
}) : r === 0 ? null : `Showing ${w} to ${N} of ${r} results`;
|
|
232
232
|
})(), x = t > 1;
|
|
233
233
|
return p == null && !x ? null : /* @__PURE__ */ y(
|
|
234
234
|
"div",
|
|
235
235
|
{
|
|
236
|
-
ref:
|
|
236
|
+
ref: F,
|
|
237
237
|
className: d(
|
|
238
|
-
"flex min-h-9 w-full items-center gap-4",
|
|
238
|
+
"flex min-h-9 w-full flex-wrap items-center gap-x-4 gap-y-2",
|
|
239
239
|
p == null ? "justify-center" : "justify-between",
|
|
240
240
|
i
|
|
241
241
|
),
|
|
242
242
|
"data-hook": s,
|
|
243
243
|
"data-slot": "pagination-controls",
|
|
244
|
-
"data-tracking-el":
|
|
245
|
-
"data-tracking-label":
|
|
246
|
-
...
|
|
244
|
+
"data-tracking-el": B || "pagination-controls",
|
|
245
|
+
"data-tracking-label": G,
|
|
246
|
+
...V,
|
|
247
247
|
children: [
|
|
248
248
|
p != null && /* @__PURE__ */ a(
|
|
249
249
|
"span",
|
|
250
250
|
{
|
|
251
|
-
className: "text-body-sm text-muted-foreground",
|
|
251
|
+
className: "text-body-sm text-muted-foreground whitespace-nowrap",
|
|
252
252
|
"data-slot": "pagination-caption",
|
|
253
253
|
children: p
|
|
254
254
|
}
|
|
255
255
|
),
|
|
256
256
|
x && /* @__PURE__ */ a(
|
|
257
|
-
|
|
257
|
+
P,
|
|
258
258
|
{
|
|
259
259
|
ariaLabel: b,
|
|
260
|
-
className: d(p != null && "mx-0 w-auto justify-end"),
|
|
260
|
+
className: d(p != null && "mx-0 w-auto grow justify-end"),
|
|
261
261
|
dataHook: `${s}-nav`,
|
|
262
|
-
children: /* @__PURE__ */ a(
|
|
263
|
-
|
|
262
|
+
children: /* @__PURE__ */ a(K, { children: T.map((c, h) => c === "previous" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
|
|
263
|
+
j,
|
|
264
264
|
{
|
|
265
265
|
ariaLabel: g,
|
|
266
266
|
disabled: n <= 1,
|
|
267
267
|
onClick: () => o(n - 1)
|
|
268
268
|
}
|
|
269
269
|
) }, "previous") : c === "next" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
|
|
270
|
-
|
|
270
|
+
R,
|
|
271
271
|
{
|
|
272
272
|
ariaLabel: l,
|
|
273
273
|
disabled: n >= t,
|
|
274
274
|
onClick: () => o(n + 1)
|
|
275
275
|
}
|
|
276
|
-
) }, "next") : c === "ellipsis" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
|
|
277
|
-
|
|
276
|
+
) }, "next") : c === "ellipsis" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(O, { srLabel: $ }) }, `ellipsis-${h}`) : /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
|
|
277
|
+
C,
|
|
278
278
|
{
|
|
279
|
-
ariaLabel:
|
|
279
|
+
ariaLabel: L,
|
|
280
280
|
isActive: c === n,
|
|
281
281
|
page: c,
|
|
282
282
|
onClick: () => o(c)
|
|
@@ -289,16 +289,16 @@ const O = f.forwardRef(
|
|
|
289
289
|
);
|
|
290
290
|
}
|
|
291
291
|
);
|
|
292
|
-
|
|
292
|
+
Q.displayName = "PaginationControls";
|
|
293
293
|
export {
|
|
294
|
-
|
|
294
|
+
P as Pagination,
|
|
295
295
|
v as PaginationButton,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
K as PaginationContent,
|
|
297
|
+
Q as PaginationControls,
|
|
298
|
+
O as PaginationEllipsis,
|
|
299
299
|
m as PaginationItem,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
300
|
+
C as PaginationLink,
|
|
301
|
+
R as PaginationNext,
|
|
302
|
+
j as PaginationPrevious,
|
|
303
|
+
J as usePagination
|
|
304
304
|
};
|
package/dist/scroll-area.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),m=require("react"),p=require("@radix-ui/react-scroll-area"),d=require("@brightlocal/ui-components/lib/utils");function u(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(e,a,t.get?t:{enumerable:!0,get:()=>r[a]})}}return e.default=r,Object.freeze(e)}const b=u(m),o=u(p),f=b.forwardRef(({className:r,children:e,dataHook:a,trackingEl:t,trackingLabel:s,scrollOrientation:n="vertical",...i},S)=>l.jsxs(o.Root,{ref:S,className:d.cn("relative",r),"data-hook":a,"data-slot":"scroll-area","data-tracking-el":t,"data-tracking-label":s,...i,children:[l.jsx(o.Viewport,{className:"focus-visible:shadow-default duration-fast size-full rounded-[inherit] p-1 transition-[color,box-shadow] ease-out outline-none","data-slot":"scroll-area-viewport",tabIndex:0,children:e}),l.jsx(c,{}),n==="both"&&l.jsx(c,{orientation:"horizontal"}),l.jsx(o.Corner,{})]}));f.displayName="ScrollArea";const c=b.forwardRef(({className:r,orientation:e="vertical",dataHook:a,trackingEl:t,trackingLabel:s,...n},i)=>l.jsx(o.ScrollAreaScrollbar,{ref:i,className:d.cn("duration-fast flex touch-none p-px transition-colors ease-out select-none",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",r),"data-hook":a,"data-slot":"scroll-area-scrollbar","data-tracking-el":t,"data-tracking-label":s,orientation:e,...n,children:l.jsx(o.ScrollAreaThumb,{className:"bg-border relative flex-1 rounded-full","data-slot":"scroll-area-thumb"})}));c.displayName="ScrollAreaScrollbar";const h=c;exports.ScrollArea=f;exports.ScrollAreaScrollbar=c;exports.ScrollBar=h;
|