@brightlocal/ui-components 2.24.1 → 2.26.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 +3 -2
- package/component-meta.json +331 -91
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +2 -2
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.js +17 -17
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +23 -9
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +95 -87
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +9 -9
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +43 -46
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.js +14 -14
- package/dist/brand-illustration-motif.cjs +1 -1
- package/dist/brand-illustration-motif.js +11 -11
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +10 -10
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.js +12 -12
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +7 -7
- package/dist/chip.cjs +1 -1
- package/dist/chip.js +7 -7
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +46 -1
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +8 -1
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +61 -61
- package/dist/field.cjs +1 -1
- package/dist/field.js +1 -1
- package/dist/height-transition.cjs +1 -0
- package/dist/height-transition.d.ts +44 -0
- package/dist/height-transition.d.ts.map +1 -0
- package/dist/height-transition.js +63 -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 +326 -324
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +2 -2
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +15 -15
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/lib/motion.cjs +1 -0
- package/dist/lib/motion.d.ts +70 -0
- package/dist/lib/motion.d.ts.map +1 -0
- package/dist/lib/motion.js +25 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +12 -4
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +6 -5
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +69 -94
- package/dist/list.cjs +1 -1
- package/dist/list.js +10 -10
- package/dist/loading.cjs +1 -1
- package/dist/loading.d.ts.map +1 -1
- package/dist/loading.js +45 -47
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +2 -2
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.js +5 -5
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +13 -13
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.js +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +21 -25
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +12 -12
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.js +11 -11
- package/dist/select.cjs +1 -1
- package/dist/select.js +12 -12
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +54 -50
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +13 -13
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +4 -4
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +5 -5
- package/dist/table.cjs +1 -1
- package/dist/table.js +2 -2
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.cjs +1 -1
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/text-reveal-motion.js +77 -79
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +5 -5
- package/package.json +10 -4
- package/src/blocks/input-list.tsx +3 -6
- package/src/blocks/sidebar.tsx +14 -14
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/alert.tsx +68 -33
- package/src/components/badge.tsx +1 -1
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/button.tsx +2 -2
- package/src/components/card.tsx +1 -1
- package/src/components/carousel.tsx +1 -1
- package/src/components/checkbox.tsx +1 -1
- package/src/components/chip.tsx +2 -2
- package/src/components/combobox.tsx +1 -1
- package/src/components/data-table.tsx +54 -2
- package/src/components/dialog.tsx +3 -3
- package/src/components/field.tsx +1 -1
- package/src/components/height-transition.tsx +164 -0
- package/src/components/input-chip.tsx +2 -2
- package/src/components/input-group.tsx +2 -2
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input.tsx +1 -1
- package/src/components/link.tsx +59 -67
- package/src/components/list.tsx +1 -1
- package/src/components/loading.tsx +2 -15
- package/src/components/map.tsx +3 -2
- package/src/components/menubar.tsx +5 -5
- package/src/components/navigation-menu.tsx +6 -6
- package/src/components/pagination.tsx +1 -1
- package/src/components/progress.tsx +2 -10
- package/src/components/radio-group.tsx +1 -1
- package/src/components/scroll-area.tsx +2 -2
- package/src/components/select.tsx +1 -1
- package/src/components/sheet.tsx +9 -5
- package/src/components/slider.tsx +1 -1
- package/src/components/stepper.tsx +4 -4
- package/src/components/switch.tsx +2 -2
- package/src/components/table.tsx +2 -2
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +3 -8
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/lib/motion.ts +75 -0
- package/src/lib/utils.ts +14 -2
- package/dist/browser-entry.d.ts +0 -19
- package/dist/browser-entry.d.ts.map +0 -1
- package/src/browser-entry.ts +0 -99
- package/src/browser-tokens.css +0 -1
package/dist/input-chip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),$=require("react"),B=require("class-variance-authority"),j=require("@brightlocal/ui-components/lib/utils"),K=require("@brightlocal/ui-components/chip");function T(r){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(f,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}return f.default=r,Object.freeze(f)}const n=T($),F=n.createContext(null),O=n.createContext(null),P=n.createContext(null);function E(){const r=n.useContext(F);if(!r)throw new Error("InputChip components must be used within an <InputChip>");return r}function S(){const r=n.useContext(O);if(!r)throw new Error("InputChip components must be used within an <InputChip>");return r}function q(){const r=n.useContext(P);if(!r)throw new Error("InputChip components must be used within an <InputChip>");return r}function _(){const r=E(),{value:f,disabled:o}=S(),{inputValue:s,focusedChipIndex:l}=q();return{...r,value:f,disabled:o,inputValue:s,focusedChipIndex:l}}function L({value:r,defaultValue:f=[],onValueChange:o,disabled:s=!1,allowDuplicates:l=!1,children:c}){const[h,a]=n.useState(f),[g,i]=n.useState(""),[b,w]=n.useState(-1),y=n.useRef(null),t=n.useRef([]),e=r!==void 0,u=e?r:h,d=n.useRef(u),I=n.useRef(o),R=n.useRef(s);n.useLayoutEffect(()=>{d.current=u,I.current=o,R.current=s}),n.useEffect(()=>{t.current.length>u.length&&(t.current.length=u.length),b>=u.length&&w(-1)},[u.length,b]);const p=n.useCallback(x=>{e||a(x),I.current?.(x)},[e]),k=n.useCallback(x=>{if(R.current)return;const V=x.trim();V&&(l||!d.current.includes(V))&&(p([...d.current,V]),i(""))},[l,p]),D=n.useCallback(x=>{R.current||p(d.current.filter((V,N)=>N!==x))},[p]),C=n.useMemo(()=>({onValueChange:p,setInputValue:i,addItem:k,removeItem:D,inputRef:y,setFocusedChipIndex:w,chipRefs:t}),[p,k,D]),v=n.useMemo(()=>({value:u,disabled:s}),[u,s]),M=n.useMemo(()=>({inputValue:g,focusedChipIndex:b}),[g,b]);return m.jsx(F.Provider,{value:C,children:m.jsx(O.Provider,{value:v,children:m.jsx(P.Provider,{value:M,children:c})})})}const H=B.cva(["relative flex w-full flex-wrap items-center gap-1","min-h-9 rounded-sm border border-input bg-background","px-3 py-2","has-[:focus-visible]:border-ring has-[:focus-visible]:bg-background","has-[:focus-visible]:shadow-default","has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50","transition-[color,box-shadow,border-color]","duration-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),$=require("react"),B=require("class-variance-authority"),j=require("@brightlocal/ui-components/lib/utils"),K=require("@brightlocal/ui-components/chip");function T(r){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(f,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}return f.default=r,Object.freeze(f)}const n=T($),F=n.createContext(null),O=n.createContext(null),P=n.createContext(null);function E(){const r=n.useContext(F);if(!r)throw new Error("InputChip components must be used within an <InputChip>");return r}function S(){const r=n.useContext(O);if(!r)throw new Error("InputChip components must be used within an <InputChip>");return r}function q(){const r=n.useContext(P);if(!r)throw new Error("InputChip components must be used within an <InputChip>");return r}function _(){const r=E(),{value:f,disabled:o}=S(),{inputValue:s,focusedChipIndex:l}=q();return{...r,value:f,disabled:o,inputValue:s,focusedChipIndex:l}}function L({value:r,defaultValue:f=[],onValueChange:o,disabled:s=!1,allowDuplicates:l=!1,children:c}){const[h,a]=n.useState(f),[g,i]=n.useState(""),[b,w]=n.useState(-1),y=n.useRef(null),t=n.useRef([]),e=r!==void 0,u=e?r:h,d=n.useRef(u),I=n.useRef(o),R=n.useRef(s);n.useLayoutEffect(()=>{d.current=u,I.current=o,R.current=s}),n.useEffect(()=>{t.current.length>u.length&&(t.current.length=u.length),b>=u.length&&w(-1)},[u.length,b]);const p=n.useCallback(x=>{e||a(x),I.current?.(x)},[e]),k=n.useCallback(x=>{if(R.current)return;const V=x.trim();V&&(l||!d.current.includes(V))&&(p([...d.current,V]),i(""))},[l,p]),D=n.useCallback(x=>{R.current||p(d.current.filter((V,N)=>N!==x))},[p]),C=n.useMemo(()=>({onValueChange:p,setInputValue:i,addItem:k,removeItem:D,inputRef:y,setFocusedChipIndex:w,chipRefs:t}),[p,k,D]),v=n.useMemo(()=>({value:u,disabled:s}),[u,s]),M=n.useMemo(()=>({inputValue:g,focusedChipIndex:b}),[g,b]);return m.jsx(F.Provider,{value:C,children:m.jsx(O.Provider,{value:v,children:m.jsx(P.Provider,{value:M,children:c})})})}const H=B.cva(["relative flex w-full flex-wrap items-center gap-1","min-h-9 rounded-sm border border-input bg-background","px-3 py-2","has-[:focus-visible]:border-ring has-[:focus-visible]:bg-background","has-[:focus-visible]:shadow-default","has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50","transition-[color,box-shadow,border-color]","duration-fast","ease-out"],{variants:{error:{true:["border-destructive-40","has-[:focus-visible]:border-destructive-40 has-[:focus-visible]:shadow-destructive"],false:""}},defaultVariants:{error:!1}}),W=["flex-1 min-w-20","bg-transparent","border-0 outline-none","text-base font-sans","text-foreground","placeholder:text-muted-foreground","focus:outline-none focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"],A=n.forwardRef(({className:r,error:f=!1,dataHook:o,trackingEl:s,trackingLabel:l,placeholder:c,inputId:h,"aria-label":a,"aria-labelledby":g,children:i,...b},w)=>{const{setInputValue:y,addItem:t,inputRef:e,setFocusedChipIndex:u,chipRefs:d}=E(),{value:I,disabled:R}=S(),{inputValue:p}=q(),k=C=>{y(C.target.value)},D=C=>{if(C.key==="Enter"&&p.trim()&&(C.preventDefault(),t(p)),C.key==="ArrowLeft"&&!p&&I.length>0){C.preventDefault();const v=I.length-1;u(v),d.current[v]?.focus()}if(C.key==="Backspace"&&!p&&I.length>0){C.preventDefault();const v=I.length-1;u(v),d.current[v]?.focus()}};return m.jsxs("div",{ref:w,className:j.cn(H({error:f}),r),"data-hook":o,"data-slot":"input-chip","data-tracking-el":s,"data-tracking-label":l,...b,children:[i,m.jsx("input",{ref:e,"aria-label":a,"aria-labelledby":g,className:j.cn(W),"data-slot":"input-chip-input",disabled:R,id:h,placeholder:c,type:"text",value:p,onChange:k,onKeyDown:D})]})});A.displayName="InputChipInput";function z({className:r,dataHookPrefix:f="chip",itemAriaLabel:o}){const{removeItem:s,inputRef:l,setFocusedChipIndex:c,chipRefs:h}=E(),{value:a,disabled:g}=S(),i=n.useRef(null);n.useEffect(()=>{if(i.current!==null){if(i.current==="input")l.current?.focus();else{const t=i.current;t>=0&&t<a.length?h.current[t]?.focus():a.length>0?h.current[a.length-1]?.focus():l.current?.focus()}i.current=null}},[a.length,l,h]);const b=(t,e)=>{if(!g)switch(t.key){case"ArrowLeft":t.preventDefault(),e>0&&(c(e-1),h.current[e-1]?.focus());break;case"ArrowRight":t.preventDefault(),e<a.length-1?(c(e+1),h.current[e+1]?.focus()):(c(-1),l.current?.focus());break;case"Backspace":case"Delete":{t.preventDefault();const u=a.length-1;if(u===0)c(-1),i.current="input",s(e);else if(e>=u){const d=u-1;c(d),i.current=d,s(e)}else c(e),i.current=e,s(e);break}case"Home":t.preventDefault(),a.length>0&&(c(0),h.current[0]?.focus());break;case"End":t.preventDefault(),c(-1),l.current?.focus();break}},w=t=>{c(t)},y=t=>{const e=t.relatedTarget;e&&(e.closest('[data-slot="chip"]')!==null||e.dataset.slot==="input-chip-input")||c(-1)};return a.length===0?null:m.jsx("div",{className:j.cn("contents",r),"data-slot":"input-chip-items",children:a.map((t,e)=>m.jsx(K.Chip,{ref:u=>{h.current[e]=u},"aria-label":o?o.replace("{item}",t):`${t}, press Delete to remove`,dataHook:`${f}-${e}`,disabled:g,role:"group",tabIndex:-1,onBlur:y,onFocus:()=>w(e),onKeyDown:u=>b(u,e),onRemove:()=>s(e),children:t},`${t}-${e}`))})}exports.InputChip=L;exports.InputChipInput=A;exports.InputChipItems=z;exports.useInputChipContext=_;
|
package/dist/input-chip.js
CHANGED
package/dist/input-group.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 r=require("react/jsx-runtime"),h=require("react"),x=require("@radix-ui/react-slot"),l=require("class-variance-authority"),a=require("@brightlocal/ui-components/lib/utils"),G=require("./input.cjs");function I(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,o.get?o:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const u=I(h),c=l.cva("relative flex w-full items-center rounded-sm border border-input bg-background transition-[color,background-color,border-color,box-shadow] duration-fast ease-out has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-default has-[:disabled]:opacity-50",{variants:{size:{default:"h-9",sm:"h-8",lg:"h-10"},error:{true:["border-destructive-40","has-[input:focus-visible]:border-destructive-40 has-[input:focus-visible]:shadow-destructive"],false:""}},defaultVariants:{size:"default",error:!1}}),p=u.forwardRef(({className:t,size:n,error:e,dataHook:o,trackingEl:s,trackingLabel:i,...d},m)=>r.jsx("div",{ref:m,className:a.cn(c({size:n,error:e}),t),"data-hook":o,"data-slot":"input-group","data-tracking-el":s,"data-tracking-label":i,...d}));p.displayName="InputGroup";const f=u.forwardRef(({className:t,...n},e)=>r.jsx(G.Input,{ref:e,className:a.cn("border-0 focus-visible:border-0 focus-visible:shadow-[none]","h-full",t),dataHook:"input-group-input",...n}));f.displayName="InputGroupInput";const w=l.cva("flex shrink-0 items-center text-muted-foreground",{variants:{align:{"inline-start":"","inline-end":"ml-auto","block-start":"self-start","block-end":"self-end"}},defaultVariants:{align:"inline-start"}}),b=u.forwardRef(({className:t,align:n,...e},o)=>r.jsx("div",{ref:o,className:a.cn(w({align:n}),t),"data-slot":"input-group-addon",...e}));b.displayName="InputGroupAddon";const g=l.cva(["inline-flex items-center justify-center gap-2","text-sm font-medium transition-colors duration-fast ease-out","outline-none focus-visible:shadow-default rounded-sm","disabled:pointer-events-none disabled:opacity-50","text-muted-foreground hover:text-foreground","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{variant:{default:"hover:bg-accent",ghost:""},size:{default:"h-9 px-3",sm:"h-8 px-2",lg:"h-10 px-4",icon:"h-9 w-9","icon-xs":"h-6 w-6","icon-sm":"h-8 w-8","icon-lg":"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),v=u.forwardRef(({className:t,variant:n,size:e,asChild:o=!1,...s},i)=>{const d=o?x.Slot:"button";return r.jsx(d,{ref:i,className:a.cn(g({variant:n,size:e,className:t})),"data-slot":"input-group-button",type:o?void 0:"button",...s})});v.displayName="InputGroupButton";exports.InputGroup=p;exports.InputGroupAddon=b;exports.InputGroupButton=v;exports.InputGroupInput=f;exports.inputGroupButtonVariants=g;exports.inputGroupVariants=c;
|
package/dist/input-group.js
CHANGED
|
@@ -5,7 +5,7 @@ import { cva as d } from "class-variance-authority";
|
|
|
5
5
|
import { cn as s } from "@brightlocal/ui-components/lib/utils";
|
|
6
6
|
import { Input as c } from "./input.js";
|
|
7
7
|
const m = d(
|
|
8
|
-
"relative flex w-full items-center rounded-sm border border-input bg-background transition-
|
|
8
|
+
"relative flex w-full items-center rounded-sm border border-input bg-background transition-[color,background-color,border-color,box-shadow] duration-fast ease-out has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-default has-[:disabled]:opacity-50",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
@@ -27,11 +27,11 @@ const m = d(
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
), b = a.forwardRef(
|
|
30
|
-
({ className: t, size:
|
|
30
|
+
({ className: t, size: o, error: e, dataHook: r, trackingEl: i, trackingLabel: u, ...l }, p) => /* @__PURE__ */ n(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
33
33
|
ref: p,
|
|
34
|
-
className: s(m({ size:
|
|
34
|
+
className: s(m({ size: o, error: e }), t),
|
|
35
35
|
"data-hook": r,
|
|
36
36
|
"data-slot": "input-group",
|
|
37
37
|
"data-tracking-el": i,
|
|
@@ -41,10 +41,10 @@ const m = d(
|
|
|
41
41
|
)
|
|
42
42
|
);
|
|
43
43
|
b.displayName = "InputGroup";
|
|
44
|
-
const
|
|
44
|
+
const h = a.forwardRef(({ className: t, ...o }, e) => /* @__PURE__ */ n(
|
|
45
45
|
c,
|
|
46
46
|
{
|
|
47
|
-
ref:
|
|
47
|
+
ref: e,
|
|
48
48
|
className: s(
|
|
49
49
|
// Override border and focus styles since InputGroup handles them
|
|
50
50
|
"border-0 focus-visible:border-0 focus-visible:shadow-[none]",
|
|
@@ -52,11 +52,11 @@ const v = a.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ n(
|
|
|
52
52
|
t
|
|
53
53
|
),
|
|
54
54
|
dataHook: "input-group-input",
|
|
55
|
-
...
|
|
55
|
+
...o
|
|
56
56
|
}
|
|
57
57
|
));
|
|
58
|
-
|
|
59
|
-
const
|
|
58
|
+
h.displayName = "InputGroupInput";
|
|
59
|
+
const v = d(
|
|
60
60
|
"flex shrink-0 items-center text-muted-foreground",
|
|
61
61
|
{
|
|
62
62
|
variants: {
|
|
@@ -72,13 +72,13 @@ const h = d(
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
), g = a.forwardRef(
|
|
75
|
-
({ className: t, align:
|
|
75
|
+
({ className: t, align: o, ...e }, r) => /* @__PURE__ */ n(
|
|
76
76
|
"div",
|
|
77
77
|
{
|
|
78
78
|
ref: r,
|
|
79
|
-
className: s(
|
|
79
|
+
className: s(v({ align: o }), t),
|
|
80
80
|
"data-slot": "input-group-addon",
|
|
81
|
-
...
|
|
81
|
+
...e
|
|
82
82
|
}
|
|
83
83
|
)
|
|
84
84
|
);
|
|
@@ -86,7 +86,7 @@ g.displayName = "InputGroupAddon";
|
|
|
86
86
|
const w = d(
|
|
87
87
|
[
|
|
88
88
|
"inline-flex items-center justify-center gap-2",
|
|
89
|
-
"text-sm font-medium transition-colors",
|
|
89
|
+
"text-sm font-medium transition-colors duration-fast ease-out",
|
|
90
90
|
"outline-none focus-visible:shadow-default rounded-sm",
|
|
91
91
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
92
92
|
"text-muted-foreground hover:text-foreground",
|
|
@@ -113,11 +113,11 @@ const w = d(
|
|
|
113
113
|
size: "default"
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
), x = a.forwardRef(({ className: t, variant:
|
|
116
|
+
), x = a.forwardRef(({ className: t, variant: o, size: e, asChild: r = !1, ...i }, u) => /* @__PURE__ */ n(
|
|
117
117
|
r ? f : "button",
|
|
118
118
|
{
|
|
119
119
|
ref: u,
|
|
120
|
-
className: s(w({ variant:
|
|
120
|
+
className: s(w({ variant: o, size: e, className: t })),
|
|
121
121
|
"data-slot": "input-group-button",
|
|
122
122
|
type: r ? void 0 : "button",
|
|
123
123
|
...i
|
|
@@ -128,7 +128,7 @@ export {
|
|
|
128
128
|
b as InputGroup,
|
|
129
129
|
g as InputGroupAddon,
|
|
130
130
|
x as InputGroupButton,
|
|
131
|
-
|
|
131
|
+
h as InputGroupInput,
|
|
132
132
|
w as inputGroupButtonVariants,
|
|
133
133
|
m as inputGroupVariants
|
|
134
134
|
};
|
package/dist/input-otp.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),S=require("react"),l=require("input-otp"),_=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils");function y(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const i=y(S),g=i.createContext(null);function v(){const t=i.useContext(g);if(!t)throw new Error("InputOTP components must be used within an <InputOTP>");return t}const p=i.forwardRef(({dataHook:t,trackingEl:n,trackingLabel:o,containerClassName:r,error:a,disabled:u,children:s,...c},m)=>{const O=i.useMemo(()=>({error:a,disabled:u}),[a,u]);return e.jsx(g.Provider,{value:O,children:e.jsx(l.OTPInput,{ref:m,"aria-invalid":a?"true":void 0,className:"disabled:cursor-not-allowed",containerClassName:x.cn("group flex items-center gap-2 has-disabled:opacity-50 w-fit",r),"data-hook":t,"data-slot":"input-otp","data-tracking-el":n,"data-tracking-label":o,disabled:u,...c,children:s})})});p.displayName="InputOTP";function f({className:t,...n}){return e.jsx("div",{className:x.cn("flex items-center rounded-md shadow-xs",t),"data-slot":"input-otp-group",...n})}function d({index:t,className:n,...o}){const{error:r}=v(),a=i.useContext(l.OTPInputContext),{char:u,hasFakeCaret:s,isActive:c}=a?.slots[t]??{};return e.jsxs("div",{className:x.cn("relative flex h-9 w-9 items-center justify-center","border-input bg-background border-y border-r","text-foreground text-base font-normal transition-[border-color,box-shadow] outline-none","first:rounded-l-md first:border-l last:rounded-r-md","data-[active=true]:border-ring data-[active=true]:z-10","data-[active=true]:shadow-default",r&&"border-destructive-40",r&&"data-[active=true]:border-destructive-40 data-[active=true]:shadow-destructive","dark:bg-input/30",n),"data-active":c,"data-error":r,"data-slot":"input-otp-slot",...o,children:[u,s&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function P({...t}){return e.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:e.jsx(_.Minus,{})})}const h=i.forwardRef(({maxLength:t=6,...n},o)=>e.jsx(p,{ref:o,inputMode:"numeric",maxLength:t,pasteTransformer:r=>r.replace(/\D+/g,"").slice(0,t),pattern:l.REGEXP_ONLY_DIGITS,...n,children:e.jsx(f,{children:Array.from({length:t},(r,a)=>e.jsx(d,{index:a},a))})}));h.displayName="InputOTPDigitsOnly";const T=i.forwardRef(({maxLength:t=4,...n},o)=>e.jsx(p,{ref:o,containerClassName:"gap-2",maxLength:t,...n,children:Array.from({length:t},(r,a)=>e.jsx(d,{className:"rounded-md border-l shadow-xs",index:a},a))}));T.displayName="InputOTPWithSpacing";const j=i.forwardRef(({maxLength:t=6,...n},o)=>{const r=Math.ceil(t/2),a=t-r;return e.jsxs(p,{ref:o,maxLength:t,...n,children:[e.jsx(f,{children:Array.from({length:r},(u,s)=>e.jsx(d,{index:s},s))}),e.jsx(P,{}),e.jsx(f,{children:Array.from({length:a},(u,s)=>e.jsx(d,{index:s+r},s+r))})]})});j.displayName="InputOTPSimple";const b=i.forwardRef(({maxLength:t=6,...n},o)=>{const a=Math.ceil(t/2);return e.jsx(p,{ref:o,maxLength:t,...n,children:Array.from({length:a},(u,s)=>{const c=s*2,O=Math.min(c+2,t)-c;return e.jsxs(i.Fragment,{children:[s>0&&e.jsx(P,{}),e.jsx(f,{children:Array.from({length:O},(N,I)=>e.jsx(d,{index:c+I},c+I))})]},s)})})});b.displayName="InputOTPWithSeparator";Object.defineProperty(exports,"REGEXP_ONLY_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_CHARS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS_AND_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS_AND_CHARS});exports.InputOTP=p;exports.InputOTPDigitsOnly=h;exports.InputOTPGroup=f;exports.InputOTPSeparator=P;exports.InputOTPSimple=j;exports.InputOTPSlot=d;exports.InputOTPWithSeparator=b;exports.InputOTPWithSpacing=T;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),S=require("react"),l=require("input-otp"),_=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils");function y(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const i=y(S),g=i.createContext(null);function v(){const t=i.useContext(g);if(!t)throw new Error("InputOTP components must be used within an <InputOTP>");return t}const p=i.forwardRef(({dataHook:t,trackingEl:n,trackingLabel:o,containerClassName:r,error:a,disabled:u,children:s,...c},m)=>{const O=i.useMemo(()=>({error:a,disabled:u}),[a,u]);return e.jsx(g.Provider,{value:O,children:e.jsx(l.OTPInput,{ref:m,"aria-invalid":a?"true":void 0,className:"disabled:cursor-not-allowed",containerClassName:x.cn("group flex items-center gap-2 has-disabled:opacity-50 w-fit",r),"data-hook":t,"data-slot":"input-otp","data-tracking-el":n,"data-tracking-label":o,disabled:u,...c,children:s})})});p.displayName="InputOTP";function f({className:t,...n}){return e.jsx("div",{className:x.cn("flex items-center rounded-md shadow-xs",t),"data-slot":"input-otp-group",...n})}function d({index:t,className:n,...o}){const{error:r}=v(),a=i.useContext(l.OTPInputContext),{char:u,hasFakeCaret:s,isActive:c}=a?.slots[t]??{};return e.jsxs("div",{className:x.cn("relative flex h-9 w-9 items-center justify-center","border-input bg-background border-y border-r","text-foreground duration-fast text-base font-normal transition-[border-color,box-shadow] ease-out outline-none","first:rounded-l-md first:border-l last:rounded-r-md","data-[active=true]:border-ring data-[active=true]:z-10","data-[active=true]:shadow-default",r&&"border-destructive-40",r&&"data-[active=true]:border-destructive-40 data-[active=true]:shadow-destructive","dark:bg-input/30",n),"data-active":c,"data-error":r,"data-slot":"input-otp-slot",...o,children:[u,s&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function P({...t}){return e.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:e.jsx(_.Minus,{})})}const h=i.forwardRef(({maxLength:t=6,...n},o)=>e.jsx(p,{ref:o,inputMode:"numeric",maxLength:t,pasteTransformer:r=>r.replace(/\D+/g,"").slice(0,t),pattern:l.REGEXP_ONLY_DIGITS,...n,children:e.jsx(f,{children:Array.from({length:t},(r,a)=>e.jsx(d,{index:a},a))})}));h.displayName="InputOTPDigitsOnly";const T=i.forwardRef(({maxLength:t=4,...n},o)=>e.jsx(p,{ref:o,containerClassName:"gap-2",maxLength:t,...n,children:Array.from({length:t},(r,a)=>e.jsx(d,{className:"rounded-md border-l shadow-xs",index:a},a))}));T.displayName="InputOTPWithSpacing";const j=i.forwardRef(({maxLength:t=6,...n},o)=>{const r=Math.ceil(t/2),a=t-r;return e.jsxs(p,{ref:o,maxLength:t,...n,children:[e.jsx(f,{children:Array.from({length:r},(u,s)=>e.jsx(d,{index:s},s))}),e.jsx(P,{}),e.jsx(f,{children:Array.from({length:a},(u,s)=>e.jsx(d,{index:s+r},s+r))})]})});j.displayName="InputOTPSimple";const b=i.forwardRef(({maxLength:t=6,...n},o)=>{const a=Math.ceil(t/2);return e.jsx(p,{ref:o,maxLength:t,...n,children:Array.from({length:a},(u,s)=>{const c=s*2,O=Math.min(c+2,t)-c;return e.jsxs(i.Fragment,{children:[s>0&&e.jsx(P,{}),e.jsx(f,{children:Array.from({length:O},(N,I)=>e.jsx(d,{index:c+I},c+I))})]},s)})})});b.displayName="InputOTPWithSeparator";Object.defineProperty(exports,"REGEXP_ONLY_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_CHARS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS_AND_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS_AND_CHARS});exports.InputOTP=p;exports.InputOTPDigitsOnly=h;exports.InputOTPGroup=f;exports.InputOTPSeparator=P;exports.InputOTPSimple=j;exports.InputOTPSlot=d;exports.InputOTPWithSeparator=b;exports.InputOTPWithSpacing=T;
|
package/dist/input-otp.js
CHANGED
|
@@ -69,7 +69,7 @@ function c({ index: t, className: o, ...i }) {
|
|
|
69
69
|
// Base styles
|
|
70
70
|
"relative flex h-9 w-9 items-center justify-center",
|
|
71
71
|
"border-input bg-background border-y border-r",
|
|
72
|
-
"text-foreground text-base font-normal transition-[border-color,box-shadow] outline-none",
|
|
72
|
+
"text-foreground duration-fast text-base font-normal transition-[border-color,box-shadow] ease-out outline-none",
|
|
73
73
|
"first:rounded-l-md first:border-l last:rounded-r-md",
|
|
74
74
|
// Focus state
|
|
75
75
|
"data-[active=true]:border-ring data-[active=true]:z-10",
|
package/dist/input.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),b=require("react"),p=require("class-variance-authority"),v=require("@brightlocal/ui-components/lib/utils");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const h=g(b),n=p.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-[border-color,box-shadow,background-color]","text-base font-sans","text-foreground","overflow-hidden text-ellipsis","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground","placeholder:overflow-hidden placeholder:text-ellipsis","items-center px-3","[&::-webkit-calendar-picker-indicator]:hidden"],{variants:{hasIcon:{true:"pl-9",false:""},hasSecondaryIcon:{true:"pr-9",false:""}},defaultVariants:{hasIcon:!1,hasSecondaryIcon:!1}}),s=h.forwardRef(({className:e,hasIcon:r=!1,hasSecondaryIcon:t=!1,dataHook:a,error:l,trackingEl:c,trackingLabel:d,...o},u)=>{const i=l||o["aria-invalid"]===!0||o["aria-invalid"]==="true";return f.jsx("input",{ref:u,"aria-invalid":i?"true":void 0,className:v.cn(n({hasIcon:r,hasSecondaryIcon:t}),i&&"border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",e),"data-hook":a,"data-slot":"input","data-tracking-el":c,"data-tracking-label":d,...o})});s.displayName="Input";exports.Input=s;exports.inputVariants=n;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),b=require("react"),p=require("class-variance-authority"),v=require("@brightlocal/ui-components/lib/utils");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const h=g(b),n=p.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out","text-base font-sans","text-foreground","overflow-hidden text-ellipsis","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground","placeholder:overflow-hidden placeholder:text-ellipsis","items-center px-3","[&::-webkit-calendar-picker-indicator]:hidden"],{variants:{hasIcon:{true:"pl-9",false:""},hasSecondaryIcon:{true:"pr-9",false:""}},defaultVariants:{hasIcon:!1,hasSecondaryIcon:!1}}),s=h.forwardRef(({className:e,hasIcon:r=!1,hasSecondaryIcon:t=!1,dataHook:a,error:l,trackingEl:c,trackingLabel:d,...o},u)=>{const i=l||o["aria-invalid"]===!0||o["aria-invalid"]==="true";return f.jsx("input",{ref:u,"aria-invalid":i?"true":void 0,className:v.cn(n({hasIcon:r,hasSecondaryIcon:t}),i&&"border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",e),"data-hook":a,"data-slot":"input","data-tracking-el":c,"data-tracking-label":d,...o})});s.displayName="Input";exports.Input=s;exports.inputVariants=n;
|
package/dist/input.js
CHANGED
|
@@ -8,7 +8,7 @@ const p = f(
|
|
|
8
8
|
"flex w-full min-w-0 h-9",
|
|
9
9
|
// Appearance
|
|
10
10
|
"border border-input bg-background rounded-sm",
|
|
11
|
-
"outline-none transition-[border-color,box-shadow,background-color]",
|
|
11
|
+
"outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
|
|
12
12
|
// Typography
|
|
13
13
|
"text-base font-sans",
|
|
14
14
|
"text-foreground",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={type:"spring",stiffness:500,damping:45},n={stiffness:180,damping:24,mass:1},t={type:"spring",stiffness:80,damping:20,mass:1},S={type:"spring",stiffness:30,damping:9,mass:.5};exports.SPRING_GENTLE=t;exports.SPRING_SETTLE=S;exports.SPRING_SMOOTH=n;exports.SPRING_SNAPPY=s;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared motion values for JS-driven (framer-motion) animation — the JS-side
|
|
3
|
+
* counterpart of the CSS motion token scale (`--ds-motion-*` in
|
|
4
|
+
* `@brightlocal/tokens`).
|
|
5
|
+
*
|
|
6
|
+
* Engine policy (DS-806): CSS is the default for predetermined state
|
|
7
|
+
* transitions and preset keyframes. framer-motion is allowed when animation
|
|
8
|
+
* behaviour requires runtime orchestration — progress-driven or
|
|
9
|
+
* gesture-interruptible motion, spring physics, layout measurement, or
|
|
10
|
+
* sequencing tied to React state — and every framer component must consume
|
|
11
|
+
* `usePrefersReducedMotion()` (the global CSS kill-switch cannot see
|
|
12
|
+
* JS-driven values).
|
|
13
|
+
*
|
|
14
|
+
* New framer code must use one of these presets. Introducing a new spring
|
|
15
|
+
* config means adding it here, which keeps drift reviewable.
|
|
16
|
+
*/
|
|
17
|
+
export { SETTLE_REST_DELTA } from './spring-settle';
|
|
18
|
+
/**
|
|
19
|
+
* Duration scale in milliseconds — mirrors --ds-motion-duration-fast/base/slow.
|
|
20
|
+
* fast: state changes (hover/focus color, shadow, opacity) + exits;
|
|
21
|
+
* press feedback is faster still (instant or ≤100ms)
|
|
22
|
+
* base: standard reveals + on-screen movement
|
|
23
|
+
* slow: large surfaces; the productive-motion ceiling
|
|
24
|
+
*/
|
|
25
|
+
export declare const MOTION_DURATION_FAST_MS = 150;
|
|
26
|
+
export declare const MOTION_DURATION_BASE_MS = 200;
|
|
27
|
+
export declare const MOTION_DURATION_SLOW_MS = 300;
|
|
28
|
+
/**
|
|
29
|
+
* Quick and controlled, no overshoot — list reorders and other
|
|
30
|
+
* small-element layout moves.
|
|
31
|
+
*
|
|
32
|
+
* Damping 45 keeps it at/above critical damping (2 × √500 ≈ 44.7, mass 1),
|
|
33
|
+
* so the "no overshoot" description physically holds — at the previous 35
|
|
34
|
+
* the spring was underdamped (ζ ≈ 0.78) and could overshoot.
|
|
35
|
+
*/
|
|
36
|
+
export declare const SPRING_SNAPPY: {
|
|
37
|
+
readonly type: "spring";
|
|
38
|
+
readonly stiffness: 500;
|
|
39
|
+
readonly damping: 45;
|
|
40
|
+
};
|
|
41
|
+
/** Balanced — text and content reveals. */
|
|
42
|
+
export declare const SPRING_SMOOTH: {
|
|
43
|
+
readonly type: "spring";
|
|
44
|
+
readonly stiffness: 180;
|
|
45
|
+
readonly damping: 24;
|
|
46
|
+
readonly mass: 1;
|
|
47
|
+
};
|
|
48
|
+
/** Soft and value-tracking — progress bars and gauges. */
|
|
49
|
+
export declare const SPRING_GENTLE: {
|
|
50
|
+
readonly type: "spring";
|
|
51
|
+
readonly stiffness: 80;
|
|
52
|
+
readonly damping: 20;
|
|
53
|
+
readonly mass: 1;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Slow, non-overshooting morph driver for shape-progress springs (Loading,
|
|
57
|
+
* TextRevealMotion). Always pair with `SETTLE_REST_DELTA` (aim the spring at
|
|
58
|
+
* `1 + SETTLE_REST_DELTA` with `restDelta: SETTLE_REST_DELTA`) so the
|
|
59
|
+
* terminal snap lands off-screen.
|
|
60
|
+
*
|
|
61
|
+
* Precondition for the settle trick: damping ≥ 2 × √(stiffness × mass)
|
|
62
|
+
* (9 ≥ 2 × √(30 × 0.5) ≈ 7.75) — the spring must never overshoot.
|
|
63
|
+
*/
|
|
64
|
+
export declare const SPRING_SETTLE: {
|
|
65
|
+
readonly type: "spring";
|
|
66
|
+
readonly stiffness: 30;
|
|
67
|
+
readonly damping: 9;
|
|
68
|
+
readonly mass: 0.5;
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=motion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../../src/lib/motion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,2CAA2C;AAC3C,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,0DAA0D;AAC1D,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const s = {
|
|
2
|
+
type: "spring",
|
|
3
|
+
stiffness: 500,
|
|
4
|
+
damping: 45
|
|
5
|
+
}, n = {
|
|
6
|
+
stiffness: 180,
|
|
7
|
+
damping: 24,
|
|
8
|
+
mass: 1
|
|
9
|
+
}, t = {
|
|
10
|
+
type: "spring",
|
|
11
|
+
stiffness: 80,
|
|
12
|
+
damping: 20,
|
|
13
|
+
mass: 1
|
|
14
|
+
}, i = {
|
|
15
|
+
type: "spring",
|
|
16
|
+
stiffness: 30,
|
|
17
|
+
damping: 9,
|
|
18
|
+
mass: 0.5
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
t as SPRING_GENTLE,
|
|
22
|
+
i as SPRING_SETTLE,
|
|
23
|
+
n as SPRING_SMOOTH,
|
|
24
|
+
s as SPRING_SNAPPY
|
|
25
|
+
};
|
package/dist/lib/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("clsx"),a=require("tailwind-merge");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("clsx"),a=require("tailwind-merge"),o=a.extendTailwindMerge({extend:{classGroups:{duration:[{duration:["fast","base","slow"]}],ease:[{ease:["emphasized","overshoot"]}]}}});function s(...t){return o(e.clsx(t))}const d="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 duration-base ease-out data-[state=closed]:duration-fast data-[state=closed]:ease-in";exports.FLOATING_CONTENT_ANIMATION=d;exports.cn=s;
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
-
export declare const FLOATING_CONTENT_ANIMATION = "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";
|
|
3
|
+
export declare const FLOATING_CONTENT_ANIMATION = "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 duration-base ease-out data-[state=closed]:duration-fast data-[state=closed]:ease-in";
|
|
4
4
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAe7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,eAAO,MAAM,0BAA0B,0aACkY,CAAC"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { clsx as a } from "clsx";
|
|
2
|
-
import {
|
|
2
|
+
import { extendTailwindMerge as e } from "tailwind-merge";
|
|
3
|
+
const o = e({
|
|
4
|
+
extend: {
|
|
5
|
+
classGroups: {
|
|
6
|
+
duration: [{ duration: ["fast", "base", "slow"] }],
|
|
7
|
+
ease: [{ ease: ["emphasized", "overshoot"] }]
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
});
|
|
3
11
|
function i(...t) {
|
|
4
|
-
return
|
|
12
|
+
return o(a(t));
|
|
5
13
|
}
|
|
6
|
-
const
|
|
14
|
+
const n = "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 duration-base ease-out data-[state=closed]:duration-fast data-[state=closed]:ease-in";
|
|
7
15
|
export {
|
|
8
|
-
|
|
16
|
+
n as FLOATING_CONTENT_ANIMATION,
|
|
9
17
|
i as cn
|
|
10
18
|
};
|
package/dist/link.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"),h=require("react"),m=require("@brightlocal/icons"),u=require("@radix-ui/react-slot"),j=require("class-variance-authority"),S=require("@brightlocal/ui-components/button"),o=require("@brightlocal/ui-components/lib/utils");function q(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const O=q(h),L=new Set(["aria-disabled:opacity-50","aria-invalid:ring-destructive/20","dark:aria-invalid:ring-destructive/40","aria-invalid:border-destructive","data-[state=open]:bg-accent"]),i=t=>o.cn(S.ButtonVariants({variant:t,size:"default"}).split(/\s+/).filter(e=>e&&!L.has(e)).join(" "),"no-underline"),P=j.cva("",{variants:{variant:{inline:["inline-flex","items-center","gap-2","cursor-pointer","outline-none","rounded-sm","text-link","dark:text-link-dark","no-underline","hover:underline","hover:underline-offset-4","active:text-link/80","visited:text-link-visited","visited:dark:text-link-visited-dark","transition-[text-decoration,text-decoration-color,text-underline-offset,color]","duration-fast","ease-out","focus-visible:shadow-default"],primary:i("primary"),filled:i("secondary"),outline:o.cn(i("outline"),"text-foreground"),ghost:i("ghost"),icon:o.cn(i("ghost"),"size-9 p-0")}},defaultVariants:{variant:"inline"}}),f=O.forwardRef(({className:t,variant:e="inline",dataHook:n,trackingEl:r,trackingLabel:k,asChild:g=!1,external:s=!1,showExternalIcon:p=!0,children:l,...b},v)=>{const x=s?{target:"_blank",rel:"noopener noreferrer"}:{},y=e==="inline"?"link-default":`link-${e}`,c={ref:v,className:o.cn(P({variant:e}),t),"data-hook":n,"data-slot":"link","data-tracking-el":r||y,"data-tracking-label":k,...x,...b},d=s&&p&&a.jsx(m.ExternalLink,{"aria-hidden":"true","data-slot":"external-icon"});return g?a.jsxs(u.Slot,{...c,children:[a.jsx(u.Slottable,{children:l}),d]}):a.jsxs("a",{...c,children:[l,d]})});f.displayName="Link";exports.Link=f;
|
package/dist/link.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const linkVariants: (props?: ({
|
|
4
|
-
variant?: "inline" | "ghost" | "filled" | "icon" | "outline" | null | undefined;
|
|
4
|
+
variant?: "inline" | "ghost" | "filled" | "icon" | "outline" | "primary" | null | undefined;
|
|
5
5
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
6
|
/** Supported visual style variants for the Link component. */
|
|
7
7
|
export type LinkVariant = NonNullable<VariantProps<typeof linkVariants>["variant"]>;
|
|
@@ -11,10 +11,11 @@ export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>
|
|
|
11
11
|
*/
|
|
12
12
|
dataHook: string;
|
|
13
13
|
/**
|
|
14
|
-
* Visual style variant. `inline` renders a standard text link; `
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* Visual style variant. `inline` renders a standard text link; `primary`
|
|
15
|
+
* renders the brand CTA treatment (matches `Button variant="primary"`);
|
|
16
|
+
* `filled`, `outline` and `ghost` render button-styled treatments for
|
|
17
|
+
* inline actions and high-priority navigation; `icon` renders a circular
|
|
18
|
+
* icon-only link (provide an `aria-label` since there is no text content).
|
|
18
19
|
* @default "inline"
|
|
19
20
|
*/
|
|
20
21
|
variant?: LinkVariant;
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/components/link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/components/link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAmClE,QAAA,MAAM,YAAY;;8EAsDjB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,WAAW,GAAG,WAAW,CACnC,YAAY,CAAC,OAAO,YAAY,CAAC,CAAC,SAAS,CAAC,CAC7C,CAAC;AAEF,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAC9E;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,QAAA,MAAM,IAAI,qFAwDT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/link.js
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as s, jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import * as h from "react";
|
|
3
|
-
import { ExternalLink as
|
|
4
|
-
import { Slot as
|
|
5
|
-
import { cva as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"ease-in-out",
|
|
23
|
-
"focus-visible:shadow-default"
|
|
24
|
-
], L = y(
|
|
25
|
-
// `gap-2` (spacing/2) keeps the icon–text gap consistent across all variants.
|
|
26
|
-
["inline-flex", "items-center", "gap-2", "cursor-pointer", "outline-none"],
|
|
3
|
+
import { ExternalLink as b } from "@brightlocal/icons";
|
|
4
|
+
import { Slot as y, Slottable as S } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva as L } from "class-variance-authority";
|
|
6
|
+
import { ButtonVariants as j } from "@brightlocal/ui-components/button";
|
|
7
|
+
import { cn as i } from "@brightlocal/ui-components/lib/utils";
|
|
8
|
+
const w = /* @__PURE__ */ new Set([
|
|
9
|
+
"aria-disabled:opacity-50",
|
|
10
|
+
"aria-invalid:ring-destructive/20",
|
|
11
|
+
"dark:aria-invalid:ring-destructive/40",
|
|
12
|
+
"aria-invalid:border-destructive",
|
|
13
|
+
"data-[state=open]:bg-accent"
|
|
14
|
+
]), e = (n) => i(
|
|
15
|
+
j({ variant: n, size: "default" }).split(/\s+/).filter((t) => t && !w.has(t)).join(" "),
|
|
16
|
+
"no-underline"
|
|
17
|
+
), V = L(
|
|
18
|
+
// No shared base: the button-styled variants carry the Button base classes,
|
|
19
|
+
// and a base here would be silently overridden by them in tailwind-merge
|
|
20
|
+
// (last wins). Each variant is self-contained.
|
|
21
|
+
"",
|
|
27
22
|
{
|
|
28
23
|
variants: {
|
|
29
24
|
variant: {
|
|
30
25
|
// Inline text link (default) — the original Link styling.
|
|
26
|
+
// `gap-2` (spacing/2) matches the Button icon–text gap.
|
|
31
27
|
inline: [
|
|
28
|
+
"inline-flex",
|
|
29
|
+
"items-center",
|
|
30
|
+
"gap-2",
|
|
31
|
+
"cursor-pointer",
|
|
32
|
+
"outline-none",
|
|
32
33
|
"rounded-sm",
|
|
33
34
|
// Color tokens (light mode: #2563EB, dark mode: #3B82F6)
|
|
34
35
|
"text-link",
|
|
@@ -42,90 +43,64 @@ const e = [
|
|
|
42
43
|
"visited:dark:text-link-visited-dark",
|
|
43
44
|
// Transitions
|
|
44
45
|
"transition-[text-decoration,text-decoration-color,text-underline-offset,color]",
|
|
45
|
-
"duration-
|
|
46
|
+
"duration-fast",
|
|
47
|
+
"ease-out",
|
|
46
48
|
// Focus state
|
|
47
49
|
"focus-visible:shadow-default"
|
|
48
50
|
],
|
|
51
|
+
// Button-styled, brand CTA (matches Button `primary`).
|
|
52
|
+
primary: e("primary"),
|
|
49
53
|
// Button-styled, filled (maps to Button `secondary`).
|
|
50
|
-
filled:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// and keeps that border on focus (focus is the shared shadow ring only).
|
|
58
|
-
outline: [
|
|
59
|
-
...e,
|
|
60
|
-
"border",
|
|
61
|
-
"border-input",
|
|
62
|
-
"border-solid",
|
|
63
|
-
"bg-background",
|
|
64
|
-
"text-foreground",
|
|
65
|
-
"hover:bg-accent",
|
|
66
|
-
"hover:text-accent-foreground",
|
|
67
|
-
"dark:bg-input/30",
|
|
68
|
-
"dark:border-input",
|
|
69
|
-
"dark:hover:bg-input/50",
|
|
70
|
-
"dark:hover:border-input"
|
|
71
|
-
],
|
|
72
|
-
// Button-styled, transparent (maps to Button `ghost`).
|
|
73
|
-
ghost: [
|
|
74
|
-
...e,
|
|
75
|
-
"bg-transparent",
|
|
76
|
-
"text-foreground",
|
|
77
|
-
"hover:bg-accent"
|
|
78
|
-
],
|
|
54
|
+
filled: e("secondary"),
|
|
55
|
+
// Button-styled, bordered (matches Button `outline`). Button's outline
|
|
56
|
+
// declares no text color (buttons default sensibly; anchors inherit
|
|
57
|
+
// ambient/link colors), so links must pin `text-foreground` explicitly.
|
|
58
|
+
outline: i(e("outline"), "text-foreground"),
|
|
59
|
+
// Button-styled, transparent (matches Button `ghost`).
|
|
60
|
+
ghost: e("ghost"),
|
|
79
61
|
// Icon-only, circular. Mirrors `ghost` in a fixed 36px square
|
|
80
|
-
// footprint
|
|
81
|
-
// Requires an `aria-label` since there is no text content.
|
|
82
|
-
icon:
|
|
83
|
-
...e,
|
|
84
|
-
"w-9",
|
|
85
|
-
"px-0",
|
|
86
|
-
"bg-transparent",
|
|
87
|
-
"text-foreground",
|
|
88
|
-
"hover:bg-accent"
|
|
89
|
-
]
|
|
62
|
+
// footprint — the same `size-9 p-0` Button applies to icon-only
|
|
63
|
+
// buttons. Requires an `aria-label` since there is no text content.
|
|
64
|
+
icon: i(e("ghost"), "size-9 p-0")
|
|
90
65
|
}
|
|
91
66
|
},
|
|
92
67
|
defaultVariants: {
|
|
93
68
|
variant: "inline"
|
|
94
69
|
}
|
|
95
70
|
}
|
|
96
|
-
),
|
|
71
|
+
), z = h.forwardRef(
|
|
97
72
|
({
|
|
98
|
-
className:
|
|
99
|
-
variant:
|
|
100
|
-
dataHook:
|
|
101
|
-
trackingEl:
|
|
102
|
-
trackingLabel:
|
|
103
|
-
asChild:
|
|
104
|
-
external:
|
|
105
|
-
showExternalIcon:
|
|
106
|
-
children:
|
|
107
|
-
...
|
|
108
|
-
},
|
|
109
|
-
const
|
|
110
|
-
ref:
|
|
111
|
-
className:
|
|
112
|
-
"data-hook":
|
|
73
|
+
className: n,
|
|
74
|
+
variant: t = "inline",
|
|
75
|
+
dataHook: c,
|
|
76
|
+
trackingEl: u,
|
|
77
|
+
trackingLabel: f,
|
|
78
|
+
asChild: k = !1,
|
|
79
|
+
external: r = !1,
|
|
80
|
+
showExternalIcon: m = !0,
|
|
81
|
+
children: a,
|
|
82
|
+
...p
|
|
83
|
+
}, v) => {
|
|
84
|
+
const x = r ? { target: "_blank", rel: "noopener noreferrer" } : {}, g = t === "inline" ? "link-default" : `link-${t}`, o = {
|
|
85
|
+
ref: v,
|
|
86
|
+
className: i(V({ variant: t }), n),
|
|
87
|
+
"data-hook": c,
|
|
113
88
|
"data-slot": "link",
|
|
114
|
-
"data-tracking-el":
|
|
115
|
-
"data-tracking-label":
|
|
116
|
-
...
|
|
117
|
-
...
|
|
118
|
-
},
|
|
119
|
-
return
|
|
120
|
-
/* @__PURE__ */ d(
|
|
121
|
-
|
|
122
|
-
] }) : /* @__PURE__ */
|
|
123
|
-
|
|
124
|
-
|
|
89
|
+
"data-tracking-el": u || g,
|
|
90
|
+
"data-tracking-label": f,
|
|
91
|
+
...x,
|
|
92
|
+
...p
|
|
93
|
+
}, l = r && m && /* @__PURE__ */ d(b, { "aria-hidden": "true", "data-slot": "external-icon" });
|
|
94
|
+
return k ? /* @__PURE__ */ s(y, { ...o, children: [
|
|
95
|
+
/* @__PURE__ */ d(S, { children: a }),
|
|
96
|
+
l
|
|
97
|
+
] }) : /* @__PURE__ */ s("a", { ...o, children: [
|
|
98
|
+
a,
|
|
99
|
+
l
|
|
125
100
|
] });
|
|
126
101
|
}
|
|
127
102
|
);
|
|
128
|
-
|
|
103
|
+
z.displayName = "Link";
|
|
129
104
|
export {
|
|
130
|
-
|
|
105
|
+
z as Link
|
|
131
106
|
};
|