@brightlocal/ui-components 1.1.0 → 1.2.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.
Files changed (116) hide show
  1. package/AI_USAGE.md +390 -0
  2. package/README.md +67 -10
  3. package/component-meta.json +1488 -0
  4. package/dist/blocks/input-list.cjs +2 -0
  5. package/dist/blocks/input-list.d.ts +93 -0
  6. package/dist/blocks/input-list.d.ts.map +1 -0
  7. package/dist/blocks/input-list.js +215 -0
  8. package/dist/blocks/sidebar.d.ts.map +1 -1
  9. package/dist/breadcrumb.cjs +1 -1
  10. package/dist/breadcrumb.d.ts.map +1 -1
  11. package/dist/breadcrumb.js +17 -14
  12. package/dist/button.cjs +1 -1
  13. package/dist/button.d.ts.map +1 -1
  14. package/dist/button.js +9 -8
  15. package/dist/calendar.cjs +1 -1
  16. package/dist/calendar.js +1 -1
  17. package/dist/checkbox.cjs +1 -1
  18. package/dist/checkbox.d.ts.map +1 -1
  19. package/dist/checkbox.js +8 -10
  20. package/dist/combobox.cjs +1 -1
  21. package/dist/combobox.d.ts +12 -1
  22. package/dist/combobox.d.ts.map +1 -1
  23. package/dist/combobox.js +87 -79
  24. package/dist/command.cjs +1 -1
  25. package/dist/command.d.ts.map +1 -1
  26. package/dist/command.js +60 -50
  27. package/dist/date-picker.cjs +1 -1
  28. package/dist/date-picker.d.ts.map +1 -1
  29. package/dist/date-picker.js +66 -57
  30. package/dist/field.cjs +1 -1
  31. package/dist/field.d.ts.map +1 -1
  32. package/dist/field.js +2 -2
  33. package/dist/header.cjs +1 -1
  34. package/dist/header.d.ts +4 -0
  35. package/dist/header.d.ts.map +1 -1
  36. package/dist/header.js +33 -13
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +281 -268
  41. package/dist/input-chip.cjs +1 -1
  42. package/dist/input-chip.js +2 -2
  43. package/dist/input-group.cjs +1 -1
  44. package/dist/input-group.js +17 -17
  45. package/dist/input-otp.cjs +1 -1
  46. package/dist/input-otp.d.ts.map +1 -1
  47. package/dist/input-otp.js +20 -20
  48. package/dist/input-password.cjs +1 -1
  49. package/dist/input-password.d.ts.map +1 -1
  50. package/dist/input-password.js +33 -25
  51. package/dist/input.cjs +1 -1
  52. package/dist/input.js +15 -15
  53. package/dist/label.d.ts.map +1 -1
  54. package/dist/link.cjs +1 -1
  55. package/dist/link.d.ts.map +1 -1
  56. package/dist/link.js +24 -25
  57. package/dist/list.cjs +1 -0
  58. package/dist/list.d.ts +104 -0
  59. package/dist/list.d.ts.map +1 -0
  60. package/dist/list.js +145 -0
  61. package/dist/navigation-menu.cjs +1 -1
  62. package/dist/navigation-menu.d.ts.map +1 -1
  63. package/dist/navigation-menu.js +6 -5
  64. package/dist/radio-group.cjs +1 -1
  65. package/dist/radio-group.js +20 -20
  66. package/dist/select.cjs +1 -1
  67. package/dist/select.js +1 -1
  68. package/dist/sheet.d.ts.map +1 -1
  69. package/dist/sonner.cjs +1 -1
  70. package/dist/sonner.d.ts +10 -4
  71. package/dist/sonner.d.ts.map +1 -1
  72. package/dist/sonner.js +48 -41
  73. package/dist/split-layout.cjs +1 -1
  74. package/dist/split-layout.d.ts +66 -15
  75. package/dist/split-layout.d.ts.map +1 -1
  76. package/dist/split-layout.js +100 -96
  77. package/dist/switch.cjs +1 -1
  78. package/dist/switch.d.ts.map +1 -1
  79. package/dist/switch.js +2 -2
  80. package/dist/textarea.cjs +1 -1
  81. package/dist/textarea.js +1 -1
  82. package/dist/tooltip.cjs +1 -1
  83. package/dist/tooltip.d.ts.map +1 -1
  84. package/dist/tooltip.js +40 -38
  85. package/package.json +10 -1
  86. package/src/blocks/input-list.tsx +366 -0
  87. package/src/blocks/sidebar.tsx +7 -7
  88. package/src/components/breadcrumb.tsx +4 -1
  89. package/src/components/button.tsx +1 -0
  90. package/src/components/calendar.tsx +1 -1
  91. package/src/components/checkbox.tsx +2 -4
  92. package/src/components/combobox.tsx +21 -2
  93. package/src/components/command.tsx +25 -9
  94. package/src/components/date-picker.tsx +15 -5
  95. package/src/components/dropdown-menu.tsx +3 -3
  96. package/src/components/field.tsx +5 -3
  97. package/src/components/header.tsx +28 -2
  98. package/src/components/input-chip.tsx +2 -2
  99. package/src/components/input-group.tsx +4 -4
  100. package/src/components/input-otp.tsx +7 -3
  101. package/src/components/input-password.tsx +8 -2
  102. package/src/components/input.tsx +1 -1
  103. package/src/components/label.tsx +1 -4
  104. package/src/components/link.tsx +3 -4
  105. package/src/components/list.tsx +290 -0
  106. package/src/components/navigation-menu.tsx +1 -0
  107. package/src/components/radio-group.tsx +2 -2
  108. package/src/components/select.tsx +3 -3
  109. package/src/components/sheet.tsx +2 -2
  110. package/src/components/sonner.tsx +30 -12
  111. package/src/components/split-layout.tsx +200 -79
  112. package/src/components/switch.tsx +6 -4
  113. package/src/components/textarea.tsx +1 -1
  114. package/src/components/tooltip.tsx +4 -2
  115. package/src/index.ts +2 -0
  116. package/tailwind.css +1 -0
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react/jsx-runtime"),F=require("react"),q=require("class-variance-authority"),D=require("@brightlocal/ui-components/lib/utils"),E=require("@brightlocal/ui-components/chip");function N(s){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(f,n,a.get?a:{enumerable:!0,get:()=>s[n]})}}return f.default=s,Object.freeze(f)}const u=N(F),S=u.createContext(null);function V(){const s=u.useContext(S);if(!s)throw new Error("InputChip components must be used within an <InputChip>");return s}function O({value:s,defaultValue:f=[],onValueChange:n,disabled:a=!1,allowDuplicates:h=!1,children:d}){const[o,i]=u.useState(f),[l,v]=u.useState(""),[b,m]=u.useState(-1),t=u.useRef(null),e=u.useRef([]),c=s!==void 0,r=c?s:o;u.useEffect(()=>{e.current.length>r.length&&(e.current.length=r.length),b>=r.length&&m(-1)},[r.length,b]);const g=u.useCallback(C=>{c||i(C),n?.(C)},[c,n]),R=u.useCallback(C=>{if(a)return;const I=C.trim();I&&(h||!r.includes(I))&&(g([...r,I]),v(""))},[r,g,h,a]),k=u.useCallback(C=>{a||g(r.filter((I,p)=>p!==C))},[r,g,a]),x=u.useMemo(()=>({value:r,onValueChange:g,inputValue:l,setInputValue:v,disabled:a,addItem:R,removeItem:k,inputRef:t,focusedChipIndex:b,setFocusedChipIndex:m,chipRefs:e}),[r,g,l,v,a,R,k,t,b,m,e]);return w.jsx(S.Provider,{value:x,children:d})}const j=q.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-150","ease-in-out"],{variants:{error:{true:["border-red-600/40 dark:border-red-400/60","has-[:focus-visible]:border-destructive has-[:focus-visible]:shadow-destructive"],false:""}},defaultVariants:{error:!1}}),$=["flex-1 min-w-20","bg-transparent","border-0 outline-none","text-sm font-sans","text-foreground","placeholder:text-muted-foreground","focus:outline-none focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"],A=u.forwardRef(({className:s,error:f=!1,dataHook:n,trackingEl:a,trackingLabel:h,placeholder:d,inputId:o,"aria-label":i,"aria-labelledby":l,children:v,...b},m)=>{const{value:t,inputValue:e,setInputValue:c,disabled:r,addItem:g,inputRef:R,setFocusedChipIndex:k,chipRefs:x}=V(),C=p=>{c(p.target.value)},I=p=>{if(p.key==="Enter"&&e.trim()&&(p.preventDefault(),g(e)),p.key==="ArrowLeft"&&!e&&t.length>0){p.preventDefault();const y=t.length-1;k(y),x.current[y]?.focus()}if(p.key==="Backspace"&&!e&&t.length>0){p.preventDefault();const y=t.length-1;k(y),x.current[y]?.focus()}};return w.jsxs("div",{ref:m,className:D.cn(j({error:f}),s),"data-hook":n,"data-slot":"input-chip","data-tracking-el":a,"data-tracking-label":h,...b,children:[v,w.jsx("input",{ref:R,"aria-label":i,"aria-labelledby":l,className:D.cn($),"data-slot":"input-chip-input",disabled:r,id:o,placeholder:d,type:"text",value:e,onChange:C,onKeyDown:I})]})});A.displayName="InputChipInput";function B({className:s,dataHookPrefix:f="chip"}){const{value:n,disabled:a,removeItem:h,inputRef:d,setFocusedChipIndex:o,chipRefs:i}=V(),l=u.useRef(null);u.useEffect(()=>{if(l.current!==null){if(l.current==="input")d.current?.focus();else{const t=l.current;t>=0&&t<n.length?i.current[t]?.focus():n.length>0?i.current[n.length-1]?.focus():d.current?.focus()}l.current=null}},[n.length,d,i]);const v=(t,e)=>{if(!a)switch(t.key){case"ArrowLeft":t.preventDefault(),e>0&&(o(e-1),i.current[e-1]?.focus());break;case"ArrowRight":t.preventDefault(),e<n.length-1?(o(e+1),i.current[e+1]?.focus()):(o(-1),d.current?.focus());break;case"Backspace":case"Delete":{t.preventDefault();const c=n.length-1;if(c===0)o(-1),l.current="input",h(e);else if(e>=c){const r=c-1;o(r),l.current=r,h(e)}else o(e),l.current=e,h(e);break}case"Home":t.preventDefault(),n.length>0&&(o(0),i.current[0]?.focus());break;case"End":t.preventDefault(),o(-1),d.current?.focus();break}},b=t=>{o(t)},m=t=>{const e=t.relatedTarget;e&&(e.closest('[data-slot="chip"]')!==null||e.dataset.slot==="input-chip-input")||o(-1)};return n.length===0?null:w.jsx("div",{className:D.cn("contents",s),"data-slot":"input-chip-items",children:n.map((t,e)=>w.jsx(E.Chip,{ref:c=>{i.current[e]=c},"aria-label":`${t}, press Delete to remove`,dataHook:`${f}-${e}`,disabled:a,role:"group",tabIndex:-1,onBlur:m,onFocus:()=>b(e),onKeyDown:c=>v(c,e),onRemove:()=>h(e),children:t},`${t}-${e}`))})}const K=j;exports.InputChip=O;exports.InputChipInput=A;exports.InputChipItems=B;exports.inputChipInputVariants=j;exports.inputChipVariants=K;exports.useInputChipContext=V;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react/jsx-runtime"),F=require("react"),q=require("class-variance-authority"),D=require("@brightlocal/ui-components/lib/utils"),E=require("@brightlocal/ui-components/chip");function N(s){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(f,n,a.get?a:{enumerable:!0,get:()=>s[n]})}}return f.default=s,Object.freeze(f)}const u=N(F),S=u.createContext(null);function V(){const s=u.useContext(S);if(!s)throw new Error("InputChip components must be used within an <InputChip>");return s}function O({value:s,defaultValue:f=[],onValueChange:n,disabled:a=!1,allowDuplicates:h=!1,children:d}){const[o,i]=u.useState(f),[l,v]=u.useState(""),[g,m]=u.useState(-1),t=u.useRef(null),e=u.useRef([]),c=s!==void 0,r=c?s:o;u.useEffect(()=>{e.current.length>r.length&&(e.current.length=r.length),g>=r.length&&m(-1)},[r.length,g]);const b=u.useCallback(C=>{c||i(C),n?.(C)},[c,n]),R=u.useCallback(C=>{if(a)return;const I=C.trim();I&&(h||!r.includes(I))&&(b([...r,I]),v(""))},[r,b,h,a]),y=u.useCallback(C=>{a||b(r.filter((I,p)=>p!==C))},[r,b,a]),x=u.useMemo(()=>({value:r,onValueChange:b,inputValue:l,setInputValue:v,disabled:a,addItem:R,removeItem:y,inputRef:t,focusedChipIndex:g,setFocusedChipIndex:m,chipRefs:e}),[r,b,l,v,a,R,y,t,g,m,e]);return w.jsx(S.Provider,{value:x,children:d})}const j=q.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-150","ease-in-out"],{variants:{error:{true:["border-destructive-40","has-[:focus-visible]:border-destructive-40 has-[:focus-visible]:shadow-destructive"],false:""}},defaultVariants:{error:!1}}),$=["flex-1 min-w-20","bg-transparent","border-0 outline-none","text-sm font-sans","text-foreground","placeholder:text-muted-foreground","focus:outline-none focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"],A=u.forwardRef(({className:s,error:f=!1,dataHook:n,trackingEl:a,trackingLabel:h,placeholder:d,inputId:o,"aria-label":i,"aria-labelledby":l,children:v,...g},m)=>{const{value:t,inputValue:e,setInputValue:c,disabled:r,addItem:b,inputRef:R,setFocusedChipIndex:y,chipRefs:x}=V(),C=p=>{c(p.target.value)},I=p=>{if(p.key==="Enter"&&e.trim()&&(p.preventDefault(),b(e)),p.key==="ArrowLeft"&&!e&&t.length>0){p.preventDefault();const k=t.length-1;y(k),x.current[k]?.focus()}if(p.key==="Backspace"&&!e&&t.length>0){p.preventDefault();const k=t.length-1;y(k),x.current[k]?.focus()}};return w.jsxs("div",{ref:m,className:D.cn(j({error:f}),s),"data-hook":n,"data-slot":"input-chip","data-tracking-el":a,"data-tracking-label":h,...g,children:[v,w.jsx("input",{ref:R,"aria-label":i,"aria-labelledby":l,className:D.cn($),"data-slot":"input-chip-input",disabled:r,id:o,placeholder:d,type:"text",value:e,onChange:C,onKeyDown:I})]})});A.displayName="InputChipInput";function B({className:s,dataHookPrefix:f="chip"}){const{value:n,disabled:a,removeItem:h,inputRef:d,setFocusedChipIndex:o,chipRefs:i}=V(),l=u.useRef(null);u.useEffect(()=>{if(l.current!==null){if(l.current==="input")d.current?.focus();else{const t=l.current;t>=0&&t<n.length?i.current[t]?.focus():n.length>0?i.current[n.length-1]?.focus():d.current?.focus()}l.current=null}},[n.length,d,i]);const v=(t,e)=>{if(!a)switch(t.key){case"ArrowLeft":t.preventDefault(),e>0&&(o(e-1),i.current[e-1]?.focus());break;case"ArrowRight":t.preventDefault(),e<n.length-1?(o(e+1),i.current[e+1]?.focus()):(o(-1),d.current?.focus());break;case"Backspace":case"Delete":{t.preventDefault();const c=n.length-1;if(c===0)o(-1),l.current="input",h(e);else if(e>=c){const r=c-1;o(r),l.current=r,h(e)}else o(e),l.current=e,h(e);break}case"Home":t.preventDefault(),n.length>0&&(o(0),i.current[0]?.focus());break;case"End":t.preventDefault(),o(-1),d.current?.focus();break}},g=t=>{o(t)},m=t=>{const e=t.relatedTarget;e&&(e.closest('[data-slot="chip"]')!==null||e.dataset.slot==="input-chip-input")||o(-1)};return n.length===0?null:w.jsx("div",{className:D.cn("contents",s),"data-slot":"input-chip-items",children:n.map((t,e)=>w.jsx(E.Chip,{ref:c=>{i.current[e]=c},"aria-label":`${t}, press Delete to remove`,dataHook:`${f}-${e}`,disabled:a,role:"group",tabIndex:-1,onBlur:m,onFocus:()=>g(e),onKeyDown:c=>v(c,e),onRemove:()=>h(e),children:t},`${t}-${e}`))})}const K=j;exports.InputChip=O;exports.InputChipInput=A;exports.InputChipItems=B;exports.inputChipInputVariants=j;exports.inputChipVariants=K;exports.useInputChipContext=V;
@@ -92,8 +92,8 @@ const A = $(
92
92
  variants: {
93
93
  error: {
94
94
  true: [
95
- "border-red-600/40 dark:border-red-400/60",
96
- "has-[:focus-visible]:border-destructive has-[:focus-visible]:shadow-destructive"
95
+ "border-destructive-40",
96
+ "has-[:focus-visible]:border-destructive-40 has-[:focus-visible]:shadow-destructive"
97
97
  ],
98
98
  false: ""
99
99
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),h=require("react"),G=require("@radix-ui/react-slot"),l=require("class-variance-authority"),a=require("@brightlocal/ui-components/lib/utils"),x=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 r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const s=I(h),c=l.cva("relative flex w-full items-center overflow-hidden rounded-md border border-input bg-background transition-colors has-[:focus-visible]:border-ring has-[:focus-visible]:shadow-default has-[:disabled]:opacity-50",{variants:{size:{default:"h-9",sm:"h-8",lg:"h-10"},error:{true:["border-red-600/40 dark:border-red-400/60","has-[:focus-visible]:border-destructive has-[:focus-visible]:shadow-destructive"],false:""}},defaultVariants:{size:"default",error:!1}}),p=s.forwardRef(({className:t,size:n,error:e,dataHook:r,trackingEl:i,trackingLabel:u,...d},m)=>o.jsx("div",{ref:m,className:a.cn(c({size:n,error:e}),t),"data-hook":r,"data-slot":"input-group","data-tracking-el":i,"data-tracking-label":u,...d}));p.displayName="InputGroup";const f=s.forwardRef(({className:t,...n},e)=>o.jsx(x.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=s.forwardRef(({className:t,align:n,...e},r)=>o.jsx("div",{ref:r,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","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","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=s.forwardRef(({className:t,variant:n,size:e,asChild:r=!1,...i},u)=>{const d=r?G.Slot:"button";return o.jsx(d,{ref:u,className:a.cn(g({variant:n,size:e,className:t})),"data-slot":"input-group-button",type:r?void 0:"button",...i})});v.displayName="InputGroupButton";exports.InputGroup=p;exports.InputGroupAddon=b;exports.InputGroupButton=v;exports.InputGroupInput=f;exports.inputGroupButtonVariants=g;exports.inputGroupVariants=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),h=require("react"),G=require("@radix-ui/react-slot"),l=require("class-variance-authority"),a=require("@brightlocal/ui-components/lib/utils"),x=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 r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{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-md border border-input bg-background transition-colors 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:r,trackingEl:s,trackingLabel:i,...d},m)=>o.jsx("div",{ref:m,className:a.cn(c({size:n,error:e}),t),"data-hook":r,"data-slot":"input-group","data-tracking-el":s,"data-tracking-label":i,...d}));p.displayName="InputGroup";const f=u.forwardRef(({className:t,...n},e)=>o.jsx(x.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},r)=>o.jsx("div",{ref:r,className:a.cn(w({align:n}),t),"data-slot":"input-group-addon",...e}));b.displayName="InputGroupAddon";const v=l.cva(["inline-flex items-center justify-center gap-2","text-sm font-medium transition-colors","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"}}),g=u.forwardRef(({className:t,variant:n,size:e,asChild:r=!1,...s},i)=>{const d=r?G.Slot:"button";return o.jsx(d,{ref:i,className:a.cn(v({variant:n,size:e,className:t})),"data-slot":"input-group-button",type:r?void 0:"button",...s})});g.displayName="InputGroupButton";exports.InputGroup=p;exports.InputGroupAddon=b;exports.InputGroupButton=g;exports.InputGroupInput=f;exports.inputGroupButtonVariants=v;exports.inputGroupVariants=c;
@@ -2,10 +2,10 @@ import { jsx as n } from "react/jsx-runtime";
2
2
  import * as a from "react";
3
3
  import { Slot as f } from "@radix-ui/react-slot";
4
4
  import { cva as d } from "class-variance-authority";
5
- import { cn as i } from "@brightlocal/ui-components/lib/utils";
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 overflow-hidden rounded-md border border-input bg-background transition-colors has-[:focus-visible]:border-ring has-[:focus-visible]:shadow-default has-[:disabled]:opacity-50",
8
+ "relative flex w-full items-center rounded-md border border-input bg-background transition-colors has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-default has-[:disabled]:opacity-50",
9
9
  {
10
10
  variants: {
11
11
  size: {
@@ -15,8 +15,8 @@ const m = d(
15
15
  },
16
16
  error: {
17
17
  true: [
18
- "border-red-600/40 dark:border-red-400/60",
19
- "has-[:focus-visible]:border-destructive has-[:focus-visible]:shadow-destructive"
18
+ "border-destructive-40",
19
+ "has-[input:focus-visible]:border-destructive-40 has-[input:focus-visible]:shadow-destructive"
20
20
  ],
21
21
  false: ""
22
22
  }
@@ -27,14 +27,14 @@ const m = d(
27
27
  }
28
28
  }
29
29
  ), b = a.forwardRef(
30
- ({ className: t, size: e, error: o, dataHook: r, trackingEl: s, trackingLabel: u, ...l }, p) => /* @__PURE__ */ n(
30
+ ({ className: t, size: e, error: o, dataHook: r, trackingEl: i, trackingLabel: u, ...l }, p) => /* @__PURE__ */ n(
31
31
  "div",
32
32
  {
33
33
  ref: p,
34
- className: i(m({ size: e, error: o }), t),
34
+ className: s(m({ size: e, error: o }), t),
35
35
  "data-hook": r,
36
36
  "data-slot": "input-group",
37
- "data-tracking-el": s,
37
+ "data-tracking-el": i,
38
38
  "data-tracking-label": u,
39
39
  ...l
40
40
  }
@@ -45,7 +45,7 @@ const v = a.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ n(
45
45
  c,
46
46
  {
47
47
  ref: o,
48
- className: i(
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]",
51
51
  "h-full",
@@ -56,7 +56,7 @@ const v = a.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ n(
56
56
  }
57
57
  ));
58
58
  v.displayName = "InputGroupInput";
59
- const g = d(
59
+ const h = d(
60
60
  "flex shrink-0 items-center text-muted-foreground",
61
61
  {
62
62
  variants: {
@@ -71,23 +71,23 @@ const g = d(
71
71
  align: "inline-start"
72
72
  }
73
73
  }
74
- ), h = a.forwardRef(
74
+ ), g = a.forwardRef(
75
75
  ({ className: t, align: e, ...o }, r) => /* @__PURE__ */ n(
76
76
  "div",
77
77
  {
78
78
  ref: r,
79
- className: i(g({ align: e }), t),
79
+ className: s(h({ align: e }), t),
80
80
  "data-slot": "input-group-addon",
81
81
  ...o
82
82
  }
83
83
  )
84
84
  );
85
- h.displayName = "InputGroupAddon";
85
+ g.displayName = "InputGroupAddon";
86
86
  const w = d(
87
87
  [
88
88
  "inline-flex items-center justify-center gap-2",
89
89
  "text-sm font-medium transition-colors",
90
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
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",
93
93
  "[&_svg]:pointer-events-none [&_svg]:shrink-0"
@@ -113,20 +113,20 @@ const w = d(
113
113
  size: "default"
114
114
  }
115
115
  }
116
- ), x = a.forwardRef(({ className: t, variant: e, size: o, asChild: r = !1, ...s }, u) => /* @__PURE__ */ n(
116
+ ), x = a.forwardRef(({ className: t, variant: e, size: o, asChild: r = !1, ...i }, u) => /* @__PURE__ */ n(
117
117
  r ? f : "button",
118
118
  {
119
119
  ref: u,
120
- className: i(w({ variant: e, size: o, className: t })),
120
+ className: s(w({ variant: e, size: o, className: t })),
121
121
  "data-slot": "input-group-button",
122
122
  type: r ? void 0 : "button",
123
- ...s
123
+ ...i
124
124
  }
125
125
  ));
126
126
  x.displayName = "InputGroupButton";
127
127
  export {
128
128
  b as InputGroup,
129
- h as InputGroupAddon,
129
+ g as InputGroupAddon,
130
130
  x as InputGroupButton,
131
131
  v as InputGroupInput,
132
132
  w as inputGroupButtonVariants,
@@ -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 N(){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:c,children:s,...u},P)=>{const O=i.useMemo(()=>({error:a,disabled:c}),[a,c]);return e.jsx(g.Provider,{value:O,children:e.jsx(l.OTPInput,{ref:P,"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:c,...u,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}=N(),a=i.useContext(l.OTPInputContext),{char:c,hasFakeCaret:s,isActive:u}=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-sm 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",r&&u&&"shadow-destructive","dark:bg-input/30",n),"data-active":u,"data-error":r,"data-slot":"input-otp-slot",...o,children:[c,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 m({...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},(c,s)=>e.jsx(d,{index:s},s))}),e.jsx(m,{}),e.jsx(f,{children:Array.from({length:a},(c,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},(c,s)=>{const u=s*2,O=Math.min(u+2,t)-u;return e.jsxs(i.Fragment,{children:[s>0&&e.jsx(m,{}),e.jsx(f,{children:Array.from({length:O},(v,I)=>e.jsx(d,{index:u+I},u+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=m;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},P)=>{const O=i.useMemo(()=>({error:a,disabled:u}),[a,u]);return e.jsx(g.Provider,{value:O,children:e.jsx(l.OTPInput,{ref:P,"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-sm 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 m({...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(m,{}),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(m,{}),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=m;exports.InputOTPSimple=j;exports.InputOTPSlot=d;exports.InputOTPWithSeparator=b;exports.InputOTPWithSpacing=T;
@@ -1 +1 @@
1
- {"version":3,"file":"input-otp.d.ts","sourceRoot":"","sources":["../../src/components/input-otp.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EAGR,kBAAkB,EAClB,iBAAiB,EACjB,4BAA4B,EAC7B,MAAM,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AAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC7D,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,iBAAS,YAAY,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CAuCtE;AAMD,KAAK,sBAAsB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAE1D,iBAAS,iBAAiB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,2CAM9D;AAMD,UAAU,oBAAqB,SAAQ,IAAI,CACzC,aAAa,EACb,UAAU,GAAG,WAAW,CACzB;IACC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,8CAA8C;AAC9C,QAAA,MAAM,kBAAkB,4GAsBtB,CAAC;AAIH,2CAA2C;AAC3C,QAAA,MAAM,mBAAmB,4GAoBvB,CAAC;AAIH,gDAAgD;AAChD,QAAA,MAAM,cAAc,4GAwBnB,CAAC;AAIF,4DAA4D;AAC5D,QAAA,MAAM,qBAAqB,4GA2BzB,CAAC;AAQH,OAAO,EAEL,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,iBAAiB,EAEjB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EAErB,kBAAkB,EAClB,iBAAiB,EACjB,4BAA4B,GAC7B,CAAC;AAEF,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,GACrB,CAAC"}
package/dist/input-otp.js CHANGED
@@ -2,10 +2,10 @@ import { jsx as e, jsxs as f } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
3
  import { OTPInput as T, REGEXP_ONLY_DIGITS as x, OTPInputContext as v } from "input-otp";
4
4
  import { REGEXP_ONLY_CHARS as M, REGEXP_ONLY_DIGITS as z, REGEXP_ONLY_DIGITS_AND_CHARS as j } from "input-otp";
5
- import { Minus as N } from "@brightlocal/icons";
5
+ import { Minus as b } from "@brightlocal/icons";
6
6
  import { cn as h } from "@brightlocal/ui-components/lib/utils";
7
7
  const g = s.createContext(null);
8
- function b() {
8
+ function N() {
9
9
  const t = s.useContext(g);
10
10
  if (!t)
11
11
  throw new Error("InputOTP components must be used within an <InputOTP>");
@@ -18,13 +18,13 @@ const l = s.forwardRef(
18
18
  trackingLabel: i,
19
19
  containerClassName: r,
20
20
  error: n,
21
- disabled: u,
21
+ disabled: d,
22
22
  children: a,
23
- ...d
23
+ ...u
24
24
  }, I) => {
25
25
  const m = s.useMemo(
26
- () => ({ error: n, disabled: u }),
27
- [n, u]
26
+ () => ({ error: n, disabled: d }),
27
+ [n, d]
28
28
  );
29
29
  return /* @__PURE__ */ e(g.Provider, { value: m, children: /* @__PURE__ */ e(
30
30
  T,
@@ -40,8 +40,8 @@ const l = s.forwardRef(
40
40
  "data-slot": "input-otp",
41
41
  "data-tracking-el": o,
42
42
  "data-tracking-label": i,
43
- disabled: u,
44
- ...d,
43
+ disabled: d,
44
+ ...u,
45
45
  children: a
46
46
  }
47
47
  ) });
@@ -59,9 +59,9 @@ function p({ className: t, ...o }) {
59
59
  );
60
60
  }
61
61
  function c({ index: t, className: o, ...i }) {
62
- const { error: r } = b(), n = s.useContext(
62
+ const { error: r } = N(), n = s.useContext(
63
63
  v
64
- ), { char: u, hasFakeCaret: a, isActive: d } = n?.slots[t] ?? {};
64
+ ), { char: d, hasFakeCaret: a, isActive: u } = n?.slots[t] ?? {};
65
65
  return /* @__PURE__ */ f(
66
66
  "div",
67
67
  {
@@ -75,25 +75,25 @@ function c({ index: t, className: o, ...i }) {
75
75
  "data-[active=true]:border-ring data-[active=true]:z-10",
76
76
  "data-[active=true]:shadow-default",
77
77
  // Error state
78
- r && "border-destructive",
79
- r && d && "shadow-destructive",
78
+ r && "border-destructive-40",
79
+ r && "data-[active=true]:border-destructive-40 data-[active=true]:shadow-destructive",
80
80
  // Dark mode
81
81
  "dark:bg-input/30",
82
82
  o
83
83
  ),
84
- "data-active": d,
84
+ "data-active": u,
85
85
  "data-error": r,
86
86
  "data-slot": "input-otp-slot",
87
87
  ...i,
88
88
  children: [
89
- u,
89
+ d,
90
90
  a && /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
91
91
  ]
92
92
  }
93
93
  );
94
94
  }
95
95
  function P({ ...t }) {
96
- return /* @__PURE__ */ e("div", { "data-slot": "input-otp-separator", role: "separator", ...t, children: /* @__PURE__ */ e(N, {}) });
96
+ return /* @__PURE__ */ e("div", { "data-slot": "input-otp-separator", role: "separator", ...t, children: /* @__PURE__ */ e(b, {}) });
97
97
  }
98
98
  const w = s.forwardRef(({ maxLength: t = 6, ...o }, i) => /* @__PURE__ */ e(
99
99
  l,
@@ -130,9 +130,9 @@ const S = s.forwardRef(
130
130
  ({ maxLength: t = 6, ...o }, i) => {
131
131
  const r = Math.ceil(t / 2), n = t - r;
132
132
  return /* @__PURE__ */ f(l, { ref: i, maxLength: t, ...o, children: [
133
- /* @__PURE__ */ e(p, { children: Array.from({ length: r }, (u, a) => /* @__PURE__ */ e(c, { index: a }, a)) }),
133
+ /* @__PURE__ */ e(p, { children: Array.from({ length: r }, (d, a) => /* @__PURE__ */ e(c, { index: a }, a)) }),
134
134
  /* @__PURE__ */ e(P, {}),
135
- /* @__PURE__ */ e(p, { children: Array.from({ length: n }, (u, a) => /* @__PURE__ */ e(
135
+ /* @__PURE__ */ e(p, { children: Array.from({ length: n }, (d, a) => /* @__PURE__ */ e(
136
136
  c,
137
137
  {
138
138
  index: a + r
@@ -145,11 +145,11 @@ const S = s.forwardRef(
145
145
  S.displayName = "InputOTPSimple";
146
146
  const _ = s.forwardRef(({ maxLength: t = 6, ...o }, i) => {
147
147
  const n = Math.ceil(t / 2);
148
- return /* @__PURE__ */ e(l, { ref: i, maxLength: t, ...o, children: Array.from({ length: n }, (u, a) => {
149
- const d = a * 2, m = Math.min(d + 2, t) - d;
148
+ return /* @__PURE__ */ e(l, { ref: i, maxLength: t, ...o, children: Array.from({ length: n }, (d, a) => {
149
+ const u = a * 2, m = Math.min(u + 2, t) - u;
150
150
  return /* @__PURE__ */ f(s.Fragment, { children: [
151
151
  a > 0 && /* @__PURE__ */ e(P, {}),
152
- /* @__PURE__ */ e(p, { children: Array.from({ length: m }, (C, O) => /* @__PURE__ */ e(c, { index: d + O }, d + O)) })
152
+ /* @__PURE__ */ e(p, { children: Array.from({ length: m }, (C, O) => /* @__PURE__ */ e(c, { index: u + O }, u + O)) })
153
153
  ] }, a);
154
154
  }) });
155
155
  });
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),D=require("react"),P=require("@brightlocal/icons"),M=require("@brightlocal/ui-components/progress"),S=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 a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const r=$(D),C={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 O(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 L=r.createContext(null);function v(){const e=r.useContext(L);if(!e)throw new Error("InputPassword compound components must be used within InputPasswordRoot");return e}function H({children:e,dataHook:t,trackingEl:o,trackingLabel:a,disabled:u,value:n,onChange:l,onStrengthChange:i,strengthLevels:p,calculateStrength:d,error:c,id:x,className:I}){const[f,h]=r.useState(!1),[j,m]=r.useState(""),[y,A]=r.useState("meter"),F=r.useId(),k=x||F,b=n!==void 0?n:j,E=p??C,N=d??O,T=r.useCallback(g=>{n===void 0&&m(g),l?.(g)},[n,l]),R=r.useCallback(()=>{h(g=>!g)},[]);r.useEffect(()=>{const g=setTimeout(()=>{const G=N(b);A(G),i?.(G)},180);return()=>clearTimeout(g)},[b,N,i]);const z=r.useMemo(()=>({showPassword:f,setShowPassword:h,toggleVisibility:R,password:b,setPassword:T,strength:y,strengthLevels:E,disabled:u,dataHook:t,trackingEl:o,trackingLabel:a,inputId:k,error:c}),[f,R,b,T,y,E,u,t,o,a,k,c]);return s.jsx(L.Provider,{value:z,children:s.jsx("div",{className:S.cn("w-full",I),children:e})})}H.displayName="InputPasswordRoot";const _=r.forwardRef(({className:e,groupClassName:t,onChange:o,...a},u)=>{const{showPassword:n,toggleVisibility:l,password:i,setPassword:p,disabled:d,dataHook:c,trackingEl:x,trackingLabel:I,inputId:f,error:h}=v(),j=m=>{p(m.target.value),o?.(m)};return s.jsxs(w.InputGroup,{className:t,dataHook:c,error:h,children:[s.jsx(w.InputGroupInput,{ref:u,className:e,disabled:d,id:f,trackingEl:x,trackingLabel:I,type:n?"text":"password",value:i,onChange:j,...a}),s.jsx(w.InputGroupAddon,{align:"inline-end",children:s.jsx(w.InputGroupButton,{"aria-label":n?"Hide password":"Show password","data-hook":`${c}-toggle`,disabled:d,size:"icon",variant:"ghost",onClick:l,children:n?s.jsx(P.EyeOff,{}):s.jsx(P.Eye,{})})})]})});_.displayName="InputPasswordField";const q=r.forwardRef(({className:e,showLabel:t="Show password",hideLabel:o="Hide password",size:a="icon",variant:u="ghost",...n},l)=>{const{showPassword:i,toggleVisibility:p,disabled:d,dataHook:c}=v();return s.jsx(w.InputGroupButton,{ref:l,"aria-label":i?o:t,className:e,"data-hook":`${c}-toggle`,disabled:d,size:a,variant:u,onClick:p,...n,children:i?s.jsx(P.EyeOff,{}):s.jsx(P.Eye,{})})});q.displayName="InputPasswordToggle";function V({className:e,showLabel:t=!0}){const{strength:o,strengthLevels:a,dataHook:u,disabled:n}=v(),l=a[o]??{label:o,value:0,color:"bg-muted"};return s.jsx("div",{className:S.cn("mt-1 space-y-2",e),children:s.jsxs("div",{className:S.cn("flex items-center gap-2",n&&"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 w-10 shrink-0 text-right text-sm font-medium whitespace-nowrap","data-hook":`${u}-strength-label`,children:l.label})]})})}V.displayName="InputPasswordStrength";exports.DEFAULT_STRENGTH_LEVELS=C;exports.InputPasswordField=_;exports.InputPasswordRoot=H;exports.InputPasswordStrength=V;exports.InputPasswordToggle=q;exports.calculatePasswordStrength=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),D=require("react"),P=require("@brightlocal/icons"),M=require("@brightlocal/ui-components/progress"),S=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 a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const r=$(D),C={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 O(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 L=r.createContext(null);function v(){const e=r.useContext(L);if(!e)throw new Error("InputPassword compound components must be used within InputPasswordRoot");return e}function _({children:e,dataHook:t,trackingEl:o,trackingLabel:a,disabled:u,value:n,onChange:l,onStrengthChange:i,strengthLevels:p,calculateStrength:d,error:c,id:x,className:I}){const[h,f]=r.useState(!1),[j,m]=r.useState(""),[y,A]=r.useState("meter"),F=r.useId(),k=x||F,b=n!==void 0?n:j,E=p??C,N=d??O,T=r.useCallback(g=>{n===void 0&&m(g),l?.(g)},[n,l]),R=r.useCallback(()=>{f(g=>!g)},[]);r.useEffect(()=>{const g=setTimeout(()=>{const G=N(b);A(G),i?.(G)},180);return()=>clearTimeout(g)},[b,N,i]);const z=r.useMemo(()=>({showPassword:h,setShowPassword:f,toggleVisibility:R,password:b,setPassword:T,strength:y,strengthLevels:E,disabled:u,dataHook:t,trackingEl:o,trackingLabel:a,inputId:k,error:c}),[h,R,b,T,y,E,u,t,o,a,k,c]);return s.jsx(L.Provider,{value:z,children:s.jsx("div",{className:S.cn("w-full",I),"data-hook":t,"data-slot":"input-password",children:e})})}_.displayName="InputPasswordRoot";const q=r.forwardRef(({className:e,groupClassName:t,onChange:o,...a},u)=>{const{showPassword:n,toggleVisibility:l,password:i,setPassword:p,disabled:d,dataHook:c,trackingEl:x,trackingLabel:I,inputId:h,error:f}=v(),j=m=>{p(m.target.value),o?.(m)};return s.jsxs(w.InputGroup,{className:t,dataHook:c,error:f,children:[s.jsx(w.InputGroupInput,{ref:u,className:e,disabled:d,id:h,trackingEl:x,trackingLabel:I,type:n?"text":"password",value:i,onChange:j,...a}),s.jsx(w.InputGroupAddon,{align:"inline-end",children:s.jsx(w.InputGroupButton,{"aria-label":n?"Hide password":"Show password","data-hook":`${c}-toggle`,disabled:d,size:"icon-sm",variant:"ghost",onClick:l,children:n?s.jsx(P.EyeOff,{}):s.jsx(P.Eye,{})})})]})});q.displayName="InputPasswordField";const H=r.forwardRef(({className:e,showLabel:t="Show password",hideLabel:o="Hide password",size:a="icon",variant:u="ghost",...n},l)=>{const{showPassword:i,toggleVisibility:p,disabled:d,dataHook:c}=v();return s.jsx(w.InputGroupButton,{ref:l,"aria-label":i?o:t,className:e,"data-hook":`${c}-toggle`,disabled:d,size:a,variant:u,onClick:p,...n,children:i?s.jsx(P.EyeOff,{}):s.jsx(P.Eye,{})})});H.displayName="InputPasswordToggle";function V({className:e,showLabel:t=!0}){const{strength:o,strengthLevels:a,dataHook:u,disabled:n}=v(),l=a[o]??{label:o,value:0,color:"bg-muted"};return s.jsx("div",{className:S.cn("mt-1 space-y-2",e),children:s.jsxs("div",{className:S.cn("flex items-center gap-2",n&&"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 w-10 shrink-0 text-right text-sm font-medium whitespace-nowrap","data-hook":`${u}-strength-label`,children:l.label})]})})}V.displayName="InputPasswordStrength";exports.DEFAULT_STRENGTH_LEVELS=C;exports.InputPasswordField=q;exports.InputPasswordRoot=_;exports.InputPasswordStrength=V;exports.InputPasswordToggle=H;exports.calculatePasswordStrength=O;
@@ -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;AAK/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,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BAAsB,CAAC,CAAC,CAAC,2CAkF3B;kBAhGQ,iBAAiB;;;AAwG1B,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACnD,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,EAC5C,MAAM,CACP;IACC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,QAAA,MAAM,kBAAkB,+GAkDtB,CAAC;AAQH,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CACpD,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,EAC7C,SAAS,GAAG,YAAY,CACzB;IACC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,mBAAmB,iHAkCxB,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,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,GACxB,CAAC;AAEF,YAAY,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"input-password.d.ts","sourceRoot":"","sources":["../../src/components/input-password.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAEL,eAAe,EAEf,gBAAgB,EACjB,MAAM,wCAAwC,CAAC;AAMhD;;GAEG;AACH,KAAK,uBAAuB,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAA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
12
12
  great: { label: "Great", value: 100, color: "bg-green-500" }
13
13
  };
14
- function _(e) {
15
- if (!e || e.length === 0)
14
+ function _(t) {
15
+ if (!t || t.length === 0)
16
16
  return "meter";
17
- if (e.length < 12)
17
+ if (t.length < 12)
18
18
  return "weak";
19
- let t = 0;
20
- 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";
19
+ let e = 0;
20
+ return t.length >= 16 && (e += 1), /[a-z]/.test(t) && (e += 1), /[A-Z]/.test(t) && (e += 1), /[0-9]/.test(t) && (e += 1), /[^a-zA-Z0-9]/.test(t) && (e += 1), e <= 1 ? "ok" : e <= 3 ? "good" : "great";
21
21
  }
22
22
  const V = r.createContext(null);
23
23
  function v() {
24
- const e = r.useContext(V);
25
- if (!e)
24
+ const t = r.useContext(V);
25
+ if (!t)
26
26
  throw new Error(
27
27
  "InputPassword compound components must be used within InputPasswordRoot"
28
28
  );
29
- return e;
29
+ return t;
30
30
  }
31
31
  function B({
32
- children: e,
33
- dataHook: t,
32
+ children: t,
33
+ dataHook: e,
34
34
  trackingEl: a,
35
35
  trackingLabel: i,
36
36
  disabled: l,
@@ -68,7 +68,7 @@ function B({
68
68
  strength: x,
69
69
  strengthLevels: y,
70
70
  disabled: l,
71
- dataHook: t,
71
+ dataHook: e,
72
72
  trackingEl: a,
73
73
  trackingLabel: i,
74
74
  inputId: S,
@@ -82,17 +82,25 @@ function B({
82
82
  x,
83
83
  y,
84
84
  l,
85
- t,
85
+ e,
86
86
  a,
87
87
  i,
88
88
  S,
89
89
  c
90
90
  ]
91
91
  );
92
- return /* @__PURE__ */ o(V.Provider, { value: z, children: /* @__PURE__ */ o("div", { className: P("w-full", I), children: e }) });
92
+ return /* @__PURE__ */ o(V.Provider, { value: z, children: /* @__PURE__ */ o(
93
+ "div",
94
+ {
95
+ className: P("w-full", I),
96
+ "data-hook": e,
97
+ "data-slot": "input-password",
98
+ children: t
99
+ }
100
+ ) });
93
101
  }
94
102
  B.displayName = "InputPasswordRoot";
95
- const D = r.forwardRef(({ className: e, groupClassName: t, onChange: a, ...i }, l) => {
103
+ const D = r.forwardRef(({ className: t, groupClassName: e, onChange: a, ...i }, l) => {
96
104
  const {
97
105
  showPassword: s,
98
106
  toggleVisibility: n,
@@ -105,12 +113,12 @@ const D = r.forwardRef(({ className: e, groupClassName: t, onChange: a, ...i },
105
113
  inputId: h,
106
114
  error: m
107
115
  } = v();
108
- return /* @__PURE__ */ R(j, { className: t, dataHook: c, error: m, children: [
116
+ return /* @__PURE__ */ R(j, { className: e, dataHook: c, error: m, children: [
109
117
  /* @__PURE__ */ o(
110
118
  M,
111
119
  {
112
120
  ref: l,
113
- className: e,
121
+ className: t,
114
122
  disabled: u,
115
123
  id: h,
116
124
  trackingEl: b,
@@ -129,7 +137,7 @@ const D = r.forwardRef(({ className: e, groupClassName: t, onChange: a, ...i },
129
137
  "aria-label": s ? "Hide password" : "Show password",
130
138
  "data-hook": `${c}-toggle`,
131
139
  disabled: u,
132
- size: "icon",
140
+ size: "icon-sm",
133
141
  variant: "ghost",
134
142
  onClick: n,
135
143
  children: s ? /* @__PURE__ */ o(T, {}) : /* @__PURE__ */ o(H, {})
@@ -140,8 +148,8 @@ const D = r.forwardRef(({ className: e, groupClassName: t, onChange: a, ...i },
140
148
  D.displayName = "InputPasswordField";
141
149
  const U = r.forwardRef(
142
150
  ({
143
- className: e,
144
- showLabel: t = "Show password",
151
+ className: t,
152
+ showLabel: e = "Show password",
145
153
  hideLabel: a = "Hide password",
146
154
  size: i = "icon",
147
155
  variant: l = "ghost",
@@ -152,8 +160,8 @@ const U = r.forwardRef(
152
160
  L,
153
161
  {
154
162
  ref: n,
155
- "aria-label": d ? a : t,
156
- className: e,
163
+ "aria-label": d ? a : e,
164
+ className: t,
157
165
  "data-hook": `${c}-toggle`,
158
166
  disabled: u,
159
167
  size: i,
@@ -167,15 +175,15 @@ const U = r.forwardRef(
167
175
  );
168
176
  U.displayName = "InputPasswordToggle";
169
177
  function W({
170
- className: e,
171
- showLabel: t = !0
178
+ className: t,
179
+ showLabel: e = !0
172
180
  }) {
173
181
  const { strength: a, strengthLevels: i, dataHook: l, disabled: s } = v(), n = i[a] ?? {
174
182
  label: a,
175
183
  value: 0,
176
184
  color: "bg-muted"
177
185
  };
178
- return /* @__PURE__ */ o("div", { className: P("mt-1 space-y-2", e), children: /* @__PURE__ */ R("div", { className: P("flex items-center gap-2", s && "opacity-50"), children: [
186
+ return /* @__PURE__ */ o("div", { className: P("mt-1 space-y-2", t), children: /* @__PURE__ */ R("div", { className: P("flex items-center gap-2", s && "opacity-50"), children: [
179
187
  /* @__PURE__ */ o(
180
188
  F,
181
189
  {
@@ -185,7 +193,7 @@ function W({
185
193
  value: n.value
186
194
  }
187
195
  ),
188
- t && /* @__PURE__ */ o(
196
+ e && /* @__PURE__ */ o(
189
197
  "span",
190
198
  {
191
199
  className: "text-foreground w-10 shrink-0 text-right text-sm font-medium whitespace-nowrap",
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"),g=require("@brightlocal/ui-components/lib/utils");function v(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=v(b),i=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-sm 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 pb-[1px] leading-5","[&::-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:d,trackingLabel:c,...o},u)=>{const n=l||o["aria-invalid"]===!0||o["aria-invalid"]==="true";return f.jsx("input",{ref:u,"aria-invalid":n?"true":void 0,className:g.cn(i({hasIcon:r,hasSecondaryIcon:t}),n&&"focus-visible:border-destructive focus-visible:shadow-destructive border-red-600/40 dark:border-red-400/60",e),"data-hook":a,"data-slot":"input","data-tracking-el":d,"data-tracking-label":c,...o})});s.displayName="Input";exports.Input=s;exports.inputVariants=i;
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-sm 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 pb-[1px] leading-5","[&::-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
@@ -42,39 +42,39 @@ const p = f(
42
42
  hasSecondaryIcon: !1
43
43
  }
44
44
  }
45
- ), h = u.forwardRef(
45
+ ), v = u.forwardRef(
46
46
  ({
47
- className: a,
48
- hasIcon: o = !1,
47
+ className: o,
48
+ hasIcon: r = !1,
49
49
  hasSecondaryIcon: i = !1,
50
50
  dataHook: t,
51
- error: d,
52
- trackingEl: n,
53
- trackingLabel: s,
51
+ error: s,
52
+ trackingEl: d,
53
+ trackingLabel: n,
54
54
  ...e
55
55
  }, l) => {
56
- const r = d || e["aria-invalid"] === !0 || e["aria-invalid"] === "true";
56
+ const a = s || e["aria-invalid"] === !0 || e["aria-invalid"] === "true";
57
57
  return /* @__PURE__ */ c(
58
58
  "input",
59
59
  {
60
60
  ref: l,
61
- "aria-invalid": r ? "true" : void 0,
61
+ "aria-invalid": a ? "true" : void 0,
62
62
  className: b(
63
- p({ hasIcon: o, hasSecondaryIcon: i }),
64
- r && "focus-visible:border-destructive focus-visible:shadow-destructive border-red-600/40 dark:border-red-400/60",
65
- a
63
+ p({ hasIcon: r, hasSecondaryIcon: i }),
64
+ a && "border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",
65
+ o
66
66
  ),
67
67
  "data-hook": t,
68
68
  "data-slot": "input",
69
- "data-tracking-el": n,
70
- "data-tracking-label": s,
69
+ "data-tracking-el": d,
70
+ "data-tracking-label": n,
71
71
  ...e
72
72
  }
73
73
  );
74
74
  }
75
75
  );
76
- h.displayName = "Input";
76
+ v.displayName = "Input";
77
77
  export {
78
- h as Input,
78
+ v as Input,
79
79
  p as inputVariants
80
80
  };
@@ -1 +1 @@
1
- {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/components/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,aAAa;;8EAUlB,CAAC;AAEF,UAAU,UAAW,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC;IAClE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,KAAK,qFAkCV,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAEhC,YAAY,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/components/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,aAAa;;8EAUlB,CAAC;AAEF,UAAU,UAAW,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC;IAClE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,KAAK,qFA+BV,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAEhC,YAAY,EAAE,UAAU,EAAE,CAAC"}
package/dist/link.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),b=require("react"),g=require("@brightlocal/icons"),v=require("@radix-ui/react-slot"),x=require("class-variance-authority"),p=require("@brightlocal/ui-components/lib/utils");function m(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const j=m(b),y=x.cva(["inline-flex","items-center","gap-1","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-300","cursor-pointer","focus-visible:outline-none","focus-visible:ring-2","focus-visible:ring-outline","focus-visible:ring-offset-2"]),a=j.forwardRef(({className:e,dataHook:n,trackingEl:t,trackingLabel:r,asChild:s=!1,external:i=!1,showExternalIcon:l=!0,children:c,...u},d)=>{const f=s?v.Slot:"a",k=i?{target:"_blank",rel:"noopener noreferrer"}:{};return o.jsxs(f,{ref:d,className:p.cn(y(),e),"data-hook":n,"data-slot":"link","data-tracking-el":t||"link-default","data-tracking-label":r,...k,...u,children:[c,i&&l&&o.jsx(g.ExternalLink,{"aria-hidden":"true","data-slot":"external-icon"})]})});a.displayName="Link";exports.Link=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),x=require("react"),p=require("@brightlocal/icons"),b=require("@radix-ui/react-slot"),g=require("class-variance-authority"),m=require("@brightlocal/ui-components/lib/utils");function v(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const j=v(x),h=g.cva(["inline-flex","items-center","gap-1","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-300","cursor-pointer","rounded-sm","outline-none","focus-visible:shadow-default"]),a=j.forwardRef(({className:e,dataHook:n,trackingEl:t,trackingLabel:r,asChild:l=!1,external:i=!1,showExternalIcon:s=!0,children:c,...d},u)=>{const f=l?b.Slot:"a",k=i?{target:"_blank",rel:"noopener noreferrer"}:{};return o.jsxs(f,{ref:u,className:m.cn(h(),e),"data-hook":n,"data-slot":"link","data-tracking-el":t||"link-default","data-tracking-label":r,...k,...d,children:[c,i&&s&&o.jsx(p.ExternalLink,{"aria-hidden":"true","data-slot":"external-icon"})]})});a.displayName="Link";exports.Link=a;
@@ -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;AAIlE,QAAA,MAAM,YAAY,oFAuBhB,CAAC;AAEH,MAAM,WAAW,SACf,SACE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,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,qFAsCT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"link.d.ts","s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