@brightlocal/ui-components 0.1.2 → 0.1.3

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 (236) hide show
  1. package/dist/accordion.cjs +1 -1
  2. package/dist/accordion.d.ts +74 -4
  3. package/dist/accordion.d.ts.map +1 -1
  4. package/dist/accordion.js +100 -105
  5. package/dist/alert-dialog.cjs +1 -1
  6. package/dist/alert-dialog.d.ts +30 -10
  7. package/dist/alert-dialog.d.ts.map +1 -1
  8. package/dist/alert-dialog.js +129 -132
  9. package/dist/alert.d.ts +22 -1
  10. package/dist/alert.d.ts.map +1 -1
  11. package/dist/aspect-ratio.cjs +1 -1
  12. package/dist/aspect-ratio.d.ts +11 -1
  13. package/dist/aspect-ratio.d.ts.map +1 -1
  14. package/dist/aspect-ratio.js +16 -20
  15. package/dist/avatar.cjs +1 -1
  16. package/dist/avatar.d.ts +43 -3
  17. package/dist/avatar.d.ts.map +1 -1
  18. package/dist/avatar.js +18 -16
  19. package/dist/badge.cjs +1 -1
  20. package/dist/badge.d.ts +24 -9
  21. package/dist/badge.d.ts.map +1 -1
  22. package/dist/badge.js +34 -32
  23. package/dist/blocks/data-table.cjs +1 -1
  24. package/dist/blocks/data-table.d.ts.map +1 -1
  25. package/dist/blocks/data-table.js +177 -170
  26. package/dist/blocks/sidebar.cjs +1 -1
  27. package/dist/blocks/sidebar.d.ts +1 -1
  28. package/dist/blocks/sidebar.d.ts.map +1 -1
  29. package/dist/blocks/sidebar.js +154 -154
  30. package/dist/breadcrumb.cjs +1 -1
  31. package/dist/breadcrumb.d.ts +63 -8
  32. package/dist/breadcrumb.d.ts.map +1 -1
  33. package/dist/breadcrumb.js +97 -93
  34. package/dist/button.cjs +1 -1
  35. package/dist/button.d.ts +17 -45
  36. package/dist/button.d.ts.map +1 -1
  37. package/dist/button.js +49 -50
  38. package/dist/calendar.cjs +1 -1
  39. package/dist/calendar.d.ts +12 -0
  40. package/dist/calendar.d.ts.map +1 -1
  41. package/dist/calendar.js +10 -8
  42. package/dist/card.cjs +1 -1
  43. package/dist/card.d.ts +58 -18
  44. package/dist/card.d.ts.map +1 -1
  45. package/dist/card.js +60 -51
  46. package/dist/carousel.cjs +1 -1
  47. package/dist/carousel.d.ts +99 -9
  48. package/dist/carousel.d.ts.map +1 -1
  49. package/dist/carousel.js +142 -128
  50. package/dist/centred-layout.cjs +1 -1
  51. package/dist/centred-layout.d.ts +18 -2
  52. package/dist/centred-layout.d.ts.map +1 -1
  53. package/dist/centred-layout.js +46 -33
  54. package/dist/chart.cjs +4 -4
  55. package/dist/chart.d.ts +70 -7
  56. package/dist/chart.d.ts.map +1 -1
  57. package/dist/chart.js +71 -66
  58. package/dist/checkbox.cjs +1 -1
  59. package/dist/checkbox.d.ts +9 -5
  60. package/dist/checkbox.d.ts.map +1 -1
  61. package/dist/checkbox.js +61 -82
  62. package/dist/collapsible.cjs +1 -1
  63. package/dist/collapsible.d.ts +65 -8
  64. package/dist/collapsible.d.ts.map +1 -1
  65. package/dist/collapsible.js +41 -55
  66. package/dist/combobox.cjs +1 -1
  67. package/dist/combobox.d.ts +29 -11
  68. package/dist/combobox.d.ts.map +1 -1
  69. package/dist/combobox.js +193 -159
  70. package/dist/command.cjs +1 -1
  71. package/dist/command.d.ts +115 -9
  72. package/dist/command.d.ts.map +1 -1
  73. package/dist/command.js +176 -152
  74. package/dist/context-menu.cjs +1 -1
  75. package/dist/context-menu.d.ts +188 -20
  76. package/dist/context-menu.d.ts.map +1 -1
  77. package/dist/context-menu.js +119 -121
  78. package/dist/date-picker.cjs +1 -1
  79. package/dist/date-picker.d.ts +75 -9
  80. package/dist/date-picker.d.ts.map +1 -1
  81. package/dist/date-picker.js +220 -81
  82. package/dist/description.cjs +1 -0
  83. package/dist/description.d.ts +37 -0
  84. package/dist/description.d.ts.map +1 -0
  85. package/dist/description.js +25 -0
  86. package/dist/dialog.cjs +1 -1
  87. package/dist/dialog.d.ts +73 -9
  88. package/dist/dialog.d.ts.map +1 -1
  89. package/dist/dialog.js +103 -112
  90. package/dist/drawer.cjs +1 -1
  91. package/dist/drawer.d.ts +92 -0
  92. package/dist/drawer.d.ts.map +1 -1
  93. package/dist/drawer.js +67 -52
  94. package/dist/dropdown-menu.cjs +1 -1
  95. package/dist/dropdown-menu.d.ts +95 -11
  96. package/dist/dropdown-menu.d.ts.map +1 -1
  97. package/dist/dropdown-menu.js +146 -106
  98. package/dist/field.cjs +1 -1
  99. package/dist/field.d.ts +23 -6
  100. package/dist/field.d.ts.map +1 -1
  101. package/dist/field.js +54 -53
  102. package/dist/global-layout.cjs +1 -1
  103. package/dist/global-layout.d.ts +27 -17
  104. package/dist/global-layout.d.ts.map +1 -1
  105. package/dist/global-layout.js +86 -79
  106. package/dist/hover-card.cjs +1 -1
  107. package/dist/hover-card.d.ts +36 -6
  108. package/dist/hover-card.d.ts.map +1 -1
  109. package/dist/hover-card.js +44 -42
  110. package/dist/index.cjs +1 -1
  111. package/dist/index.d.ts +1 -1
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +383 -387
  114. package/dist/input-group.cjs +1 -1
  115. package/dist/input-group.d.ts +21 -2
  116. package/dist/input-group.d.ts.map +1 -1
  117. package/dist/input-group.js +51 -41
  118. package/dist/input-password.cjs +1 -1
  119. package/dist/input-password.d.ts.map +1 -1
  120. package/dist/input-password.js +24 -25
  121. package/dist/input.cjs +1 -1
  122. package/dist/input.d.ts +38 -24
  123. package/dist/input.d.ts.map +1 -1
  124. package/dist/input.js +68 -136
  125. package/dist/label.cjs +1 -1
  126. package/dist/label.d.ts +20 -1
  127. package/dist/label.d.ts.map +1 -1
  128. package/dist/label.js +31 -18
  129. package/dist/logo.cjs +1 -1
  130. package/dist/logo.d.ts +3 -0
  131. package/dist/logo.d.ts.map +1 -1
  132. package/dist/logo.js +12 -10
  133. package/dist/menubar.cjs +1 -1
  134. package/dist/menubar.d.ts +40 -6
  135. package/dist/menubar.d.ts.map +1 -1
  136. package/dist/menubar.js +97 -76
  137. package/dist/popover.cjs +1 -1
  138. package/dist/popover.d.ts +59 -4
  139. package/dist/popover.d.ts.map +1 -1
  140. package/dist/popover.js +42 -34
  141. package/dist/progress.cjs +1 -1
  142. package/dist/progress.d.ts +9 -2
  143. package/dist/progress.d.ts.map +1 -1
  144. package/dist/progress.js +71 -59
  145. package/dist/radio-group.d.ts +40 -0
  146. package/dist/radio-group.d.ts.map +1 -1
  147. package/dist/rating.d.ts +4 -0
  148. package/dist/rating.d.ts.map +1 -1
  149. package/dist/resizable.cjs +1 -1
  150. package/dist/resizable.d.ts +65 -4
  151. package/dist/resizable.d.ts.map +1 -1
  152. package/dist/resizable.js +53 -36
  153. package/dist/scroll-area.cjs +1 -1
  154. package/dist/scroll-area.d.ts +46 -5
  155. package/dist/scroll-area.d.ts.map +1 -1
  156. package/dist/scroll-area.js +42 -38
  157. package/dist/select.cjs +1 -1
  158. package/dist/select.d.ts +30 -0
  159. package/dist/select.d.ts.map +1 -1
  160. package/dist/select.js +64 -54
  161. package/dist/separator.cjs +1 -1
  162. package/dist/separator.d.ts +49 -2
  163. package/dist/separator.d.ts.map +1 -1
  164. package/dist/separator.js +48 -36
  165. package/dist/sheet.cjs +1 -1
  166. package/dist/sheet.d.ts +80 -9
  167. package/dist/sheet.d.ts.map +1 -1
  168. package/dist/sheet.js +117 -113
  169. package/dist/skeleton.cjs +1 -1
  170. package/dist/skeleton.d.ts +24 -2
  171. package/dist/skeleton.d.ts.map +1 -1
  172. package/dist/skeleton.js +15 -9
  173. package/dist/slider.cjs +1 -1
  174. package/dist/slider.d.ts +18 -4
  175. package/dist/slider.d.ts.map +1 -1
  176. package/dist/slider.js +72 -66
  177. package/dist/sonner.cjs +1 -1
  178. package/dist/sonner.d.ts +4 -2
  179. package/dist/sonner.d.ts.map +1 -1
  180. package/dist/sonner.js +29 -28
  181. package/dist/split-layout.d.ts +4 -1
  182. package/dist/split-layout.d.ts.map +1 -1
  183. package/package.json +8 -2
  184. package/src/blocks/data-table.tsx +42 -32
  185. package/src/blocks/sidebar.tsx +4 -12
  186. package/src/components/accordion.tsx +163 -77
  187. package/src/components/alert-dialog.tsx +156 -111
  188. package/src/components/alert.tsx +26 -13
  189. package/src/components/aspect-ratio.tsx +25 -16
  190. package/src/components/avatar.tsx +56 -8
  191. package/src/components/badge.tsx +65 -42
  192. package/src/components/breadcrumb.tsx +158 -82
  193. package/src/components/button.tsx +41 -62
  194. package/src/components/calendar.tsx +16 -2
  195. package/src/components/card.tsx +92 -40
  196. package/src/components/carousel.tsx +240 -115
  197. package/src/components/centred-layout.tsx +67 -35
  198. package/src/components/chart.tsx +118 -47
  199. package/src/components/checkbox.tsx +42 -78
  200. package/src/components/collapsible.tsx +95 -26
  201. package/src/components/combobox.tsx +242 -144
  202. package/src/components/command.tsx +295 -121
  203. package/src/components/context-menu.tsx +278 -81
  204. package/src/components/date-picker.tsx +281 -30
  205. package/src/components/description.tsx +60 -0
  206. package/src/components/dialog.tsx +162 -86
  207. package/src/components/drawer.tsx +76 -2
  208. package/src/components/dropdown-menu.tsx +143 -37
  209. package/src/components/field.tsx +36 -11
  210. package/src/components/global-layout.tsx +116 -77
  211. package/src/components/hover-card.tsx +54 -14
  212. package/src/components/input-group.tsx +56 -18
  213. package/src/components/input-password.tsx +3 -4
  214. package/src/components/input.tsx +93 -186
  215. package/src/components/label.tsx +56 -15
  216. package/src/components/logo.tsx +3 -0
  217. package/src/components/menubar.tsx +58 -4
  218. package/src/components/popover.tsx +103 -20
  219. package/src/components/progress.tsx +82 -60
  220. package/src/components/radio-group.tsx +40 -0
  221. package/src/components/rating.tsx +4 -0
  222. package/src/components/resizable.tsx +119 -31
  223. package/src/components/scroll-area.tsx +123 -56
  224. package/src/components/select.tsx +21 -1
  225. package/src/components/separator.tsx +97 -20
  226. package/src/components/sheet.tsx +180 -79
  227. package/src/components/skeleton.tsx +40 -10
  228. package/src/components/slider.tsx +83 -57
  229. package/src/components/sonner.tsx +10 -7
  230. package/src/components/split-layout.tsx +4 -1
  231. package/src/index.ts +1 -1
  232. package/dist/input-base.cjs +0 -1
  233. package/dist/input-base.d.ts +0 -28
  234. package/dist/input-base.d.ts.map +0 -1
  235. package/dist/input-base.js +0 -56
  236. package/src/components/input-base.tsx +0 -86
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),g=require("react"),h=require("@radix-ui/react-slot"),a=require("class-variance-authority"),s=require("@brightlocal/ui-components/lib/utils"),G=require("@brightlocal/ui-components/input-base");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 i=I(g),u=a.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"}},defaultVariants:{size:"default"}}),l=i.forwardRef(({className:t,size:n,...e},r)=>o.jsx("div",{ref:r,className:s.cn(u({size:n}),t),...e}));l.displayName="InputGroup";const c=i.forwardRef(({className:t,...n},e)=>o.jsx(G.BaseInputElement,{ref:e,className:s.cn("border-0 focus-visible:border-0 focus-visible:shadow-[none]","h-full",t),...n}));c.displayName="InputGroupInput";const x=a.cva("flex shrink-0 items-center",{variants:{align:{"inline-start":"","inline-end":"ml-auto","block-start":"self-start","block-end":"self-end"}},defaultVariants:{align:"inline-start"}}),d=i.forwardRef(({className:t,align:n,...e},r)=>o.jsx("div",{ref:r,className:s.cn(x({align:n}),t),...e}));d.displayName="InputGroupAddon";const p=a.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]:size-4 [&_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"}}),f=i.forwardRef(({className:t,variant:n,size:e,asChild:r=!1,...b},v)=>{const m=r?h.Slot:"button";return o.jsx(m,{ref:v,className:s.cn(p({variant:n,size:e,className:t})),type:r?void 0:"button",...b})});f.displayName="InputGroupButton";exports.InputGroup=l;exports.InputGroupAddon=d;exports.InputGroupButton=f;exports.InputGroupInput=c;exports.inputGroupButtonVariants=p;exports.inputGroupVariants=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("react"),h=require("@radix-ui/react-slot"),c=require("class-variance-authority"),a=require("@brightlocal/ui-components/lib/utils"),G=require("./input.cjs");function x(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 i=x(m),d=c.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"}},defaultVariants:{size:"default"}}),p=i.forwardRef(({className:t,size:n,dataHook:e,trackingEl:o,trackingLabel:s,...u},l)=>r.jsx("div",{ref:l,className:a.cn(d({size:n}),t),"data-hook":e,"data-slot":"input-group","data-tracking-el":o,"data-tracking-label":s,...u}));p.displayName="InputGroup";const f=i.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 I=c.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"}}),g=i.forwardRef(({className:t,align:n,...e},o)=>r.jsx("div",{ref:o,className:a.cn(I({align:n}),t),"data-slot":"input-group-addon",...e}));g.displayName="InputGroupAddon";const b=c.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]:size-4 [&_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=i.forwardRef(({className:t,variant:n,size:e,asChild:o=!1,...s},u)=>{const l=o?h.Slot:"button";return r.jsx(l,{ref:u,className:a.cn(b({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=g;exports.InputGroupButton=v;exports.InputGroupInput=f;exports.inputGroupButtonVariants=b;exports.inputGroupVariants=d;
@@ -1,12 +1,26 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
+ import { InputProps } from './input';
2
3
  import * as React from "react";
3
4
  declare const inputGroupVariants: (props?: ({
4
5
  size?: "default" | "sm" | "lg" | null | undefined;
5
6
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
7
  interface InputGroupProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof inputGroupVariants> {
8
+ /**
9
+ * Data hook for automated testing (REQUIRED)
10
+ */
11
+ dataHook: string;
12
+ /**
13
+ * Tracking element identifier for analytics
14
+ */
15
+ trackingEl?: string;
16
+ /**
17
+ * Tracking label for analytics context
18
+ */
19
+ trackingLabel?: string;
7
20
  }
8
21
  declare const InputGroup: React.ForwardRefExoticComponent<InputGroupProps & React.RefAttributes<HTMLDivElement>>;
9
- declare const InputGroupInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
22
+ type InputGroupInputProps = Omit<InputProps, "hasIcon" | "hasSecondaryIcon" | "dataHook">;
23
+ declare const InputGroupInput: React.ForwardRefExoticComponent<InputGroupInputProps & React.RefAttributes<HTMLInputElement>>;
10
24
  declare const inputGroupAddonVariants: (props?: ({
11
25
  align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
12
26
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
@@ -19,8 +33,13 @@ declare const inputGroupButtonVariants: (props?: ({
19
33
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
20
34
  interface InputGroupButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof inputGroupButtonVariants> {
21
35
  asChild?: boolean;
36
+ /**
37
+ * Size variant for the button.
38
+ * Options: "default" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg"
39
+ */
40
+ size?: NonNullable<VariantProps<typeof inputGroupButtonVariants>["size"]>;
22
41
  }
23
42
  declare const InputGroupButton: React.ForwardRefExoticComponent<InputGroupButtonProps & React.RefAttributes<HTMLButtonElement>>;
24
43
  export { InputGroup, InputGroupInput, InputGroupAddon, InputGroupButton, inputGroupVariants, inputGroupButtonVariants, };
25
- export type { InputGroupProps, InputGroupAddonProps, InputGroupButtonProps };
44
+ export type { InputGroupProps, InputGroupInputProps, InputGroupAddonProps, InputGroupButtonProps, };
26
45
  //# sourceMappingURL=input-group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../src/components/input-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,QAAA,MAAM,kBAAkB;;8EAcvB,CAAC;AAEF,UAAU,eACR,SACE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,YAAY,CAAC,OAAO,kBAAkB,CAAC;CAAG;AAE9C,QAAA,MAAM,UAAU,wFAUf,CAAC;AAGF,QAAA,MAAM,eAAe,sHAgBnB,CAAC;AAGH,QAAA,MAAM,uBAAuB;;8EAY3B,CAAC;AAEH,UAAU,oBACR,SACE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,YAAY,CAAC,OAAO,uBAAuB,CAAC;CAAG;AAEnD,QAAA,MAAM,eAAe,6FAUpB,CAAC;AAGF,QAAA,MAAM,wBAAwB;;;8EA8B7B,CAAC;AAEF,UAAU,qBACR,SACE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,YAAY,CAAC,OAAO,wBAAwB,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,gBAAgB,iGAapB,CAAC;AAGH,OAAO,EACL,UAAU,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,GACzB,CAAC;AACF,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../src/components/input-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjD,QAAA,MAAM,kBAAkB;;8EAcvB,CAAC;AAEF,UAAU,eACR,SACE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,YAAY,CAAC,OAAO,kBAAkB,CAAC;IACzC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,UAAU,wFAcf,CAAC;AAGF,KAAK,oBAAoB,GAAG,IAAI,CAC9B,UAAU,EACV,SAAS,GAAG,kBAAkB,GAAG,UAAU,CAC5C,CAAC;AAEF,QAAA,MAAM,eAAe,+FAiBnB,CAAC;AAGH,QAAA,MAAM,uBAAuB;;8EAe5B,CAAC;AAEF,UAAU,oBACR,SACE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,YAAY,CAAC,OAAO,uBAAuB,CAAC;CAAG;AAEnD,QAAA,MAAM,eAAe,6FAWpB,CAAC;AAGF,QAAA,MAAM,wBAAwB;;;8EA8B7B,CAAC;AAEF,UAAU,qBACR,SACE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,YAAY,CAAC,OAAO,wBAAwB,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;CAC3E;AAED,QAAA,MAAM,gBAAgB,iGAcpB,CAAC;AAGH,OAAO,EACL,UAAU,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,GACzB,CAAC;AACF,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACtB,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import { Slot as d } from "@radix-ui/react-slot";
4
- import { cva as a } from "class-variance-authority";
2
+ import * as a from "react";
3
+ import { Slot as p } from "@radix-ui/react-slot";
4
+ import { cva as d } from "class-variance-authority";
5
5
  import { cn as i } from "@brightlocal/ui-components/lib/utils";
6
- import { BaseInputElement as p } from "@brightlocal/ui-components/input-base";
7
- const f = a(
6
+ import { Input as f } from "./input.js";
7
+ const c = d(
8
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",
9
9
  {
10
10
  variants: {
@@ -18,19 +18,23 @@ const f = a(
18
18
  size: "default"
19
19
  }
20
20
  }
21
- ), c = s.forwardRef(
22
- ({ className: t, size: e, ...n }, o) => /* @__PURE__ */ r(
21
+ ), m = a.forwardRef(
22
+ ({ className: t, size: o, dataHook: n, trackingEl: e, trackingLabel: s, ...u }, l) => /* @__PURE__ */ r(
23
23
  "div",
24
24
  {
25
- ref: o,
26
- className: i(f({ size: e }), t),
27
- ...n
25
+ ref: l,
26
+ className: i(c({ size: o }), t),
27
+ "data-hook": n,
28
+ "data-slot": "input-group",
29
+ "data-tracking-el": e,
30
+ "data-tracking-label": s,
31
+ ...u
28
32
  }
29
33
  )
30
34
  );
31
- c.displayName = "InputGroup";
32
- const m = s.forwardRef(({ className: t, ...e }, n) => /* @__PURE__ */ r(
33
- p,
35
+ m.displayName = "InputGroup";
36
+ const g = a.forwardRef(({ className: t, ...o }, n) => /* @__PURE__ */ r(
37
+ f,
34
38
  {
35
39
  ref: n,
36
40
  className: i(
@@ -39,34 +43,39 @@ const m = s.forwardRef(({ className: t, ...e }, n) => /* @__PURE__ */ r(
39
43
  "h-full",
40
44
  t
41
45
  ),
42
- ...e
46
+ dataHook: "input-group-input",
47
+ ...o
43
48
  }
44
49
  ));
45
- m.displayName = "InputGroupInput";
46
- const v = a("flex shrink-0 items-center", {
47
- variants: {
48
- align: {
49
- "inline-start": "",
50
- "inline-end": "ml-auto",
51
- "block-start": "self-start",
52
- "block-end": "self-end"
50
+ g.displayName = "InputGroupInput";
51
+ const v = d(
52
+ "flex shrink-0 items-center text-muted-foreground",
53
+ {
54
+ variants: {
55
+ align: {
56
+ "inline-start": "",
57
+ "inline-end": "ml-auto",
58
+ "block-start": "self-start",
59
+ "block-end": "self-end"
60
+ }
61
+ },
62
+ defaultVariants: {
63
+ align: "inline-start"
53
64
  }
54
- },
55
- defaultVariants: {
56
- align: "inline-start"
57
65
  }
58
- }), b = s.forwardRef(
59
- ({ className: t, align: e, ...n }, o) => /* @__PURE__ */ r(
66
+ ), b = a.forwardRef(
67
+ ({ className: t, align: o, ...n }, e) => /* @__PURE__ */ r(
60
68
  "div",
61
69
  {
62
- ref: o,
63
- className: i(v({ align: e }), t),
70
+ ref: e,
71
+ className: i(v({ align: o }), t),
72
+ "data-slot": "input-group-addon",
64
73
  ...n
65
74
  }
66
75
  )
67
76
  );
68
77
  b.displayName = "InputGroupAddon";
69
- const h = a(
78
+ const h = d(
70
79
  [
71
80
  "inline-flex items-center justify-center gap-2",
72
81
  "text-sm font-medium transition-colors",
@@ -96,21 +105,22 @@ const h = a(
96
105
  size: "default"
97
106
  }
98
107
  }
99
- ), g = s.forwardRef(({ className: t, variant: e, size: n, asChild: o = !1, ...u }, l) => /* @__PURE__ */ r(
100
- o ? d : "button",
108
+ ), x = a.forwardRef(({ className: t, variant: o, size: n, asChild: e = !1, ...s }, u) => /* @__PURE__ */ r(
109
+ e ? p : "button",
101
110
  {
102
- ref: l,
103
- className: i(h({ variant: e, size: n, className: t })),
104
- type: o ? void 0 : "button",
105
- ...u
111
+ ref: u,
112
+ className: i(h({ variant: o, size: n, className: t })),
113
+ "data-slot": "input-group-button",
114
+ type: e ? void 0 : "button",
115
+ ...s
106
116
  }
107
117
  ));
108
- g.displayName = "InputGroupButton";
118
+ x.displayName = "InputGroupButton";
109
119
  export {
110
- c as InputGroup,
120
+ m as InputGroup,
111
121
  b as InputGroupAddon,
112
- g as InputGroupButton,
113
- m as InputGroupInput,
122
+ x as InputGroupButton,
123
+ g as InputGroupInput,
114
124
  h as inputGroupButtonVariants,
115
- f as inputGroupVariants
125
+ c as inputGroupVariants
116
126
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),q=require("react"),h=require("lucide-react"),A=require("@brightlocal/ui-components/progress"),E=require("@brightlocal/ui-components/lib/utils"),l=require("@brightlocal/ui-components/input-group");function _(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const o=_(q),p={meter:{label:"Meter",value:0,color:"bg-muted"},weak:{label:"Weak",value:25,color:"bg-red-500"},ok:{label:"Ok",value:50,color:"bg-orange-500"},good:{label:"Good",value:75,color:"bg-green-500"},great:{label:"Great",value:100,color:"bg-green-600"}};function m(e){if(!e||e.length===0)return"meter";let t=0;return e.length>=8&&(t+=1),e.length>=12&&(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<=2?"weak":t<=3?"ok":t<=4?"good":"great"}const b=o.forwardRef(({className:e,showStrength:t=!0,onStrengthChange:n,dataHook:s,trackingEl:w,trackingLabel:S,onChange:x,value:i,id:j,...u},v)=>{const[c,P]=o.useState(!1),[I,y]=o.useState("meter"),[N,O]=o.useState(""),k=o.useId(),G=j||k,d=i!==void 0?String(i):N;o.useEffect(()=>{const a=setTimeout(()=>{const f=m(d);y(f),n?.(f)},180);return()=>clearTimeout(a)},[d,n]);const R=a=>{O(a.target.value),x?.(a)},T=()=>{P(a=>!a)},g=p[I];return r.jsxs("div",{className:"w-full",children:[r.jsxs(l.InputGroup,{className:e,children:[r.jsx(l.InputGroupInput,{ref:v,"data-hook":s,"data-tracking-el":w,"data-tracking-label":S,id:G,type:c?"text":"password",value:i,onChange:R,...u}),r.jsx(l.InputGroupAddon,{align:"inline-end",children:r.jsx(l.InputGroupButton,{"aria-label":c?"Hide password":"Show password","data-hook":s?`${s}-toggle`:void 0,disabled:u.disabled,size:"icon",variant:"ghost",onClick:T,children:c?r.jsx(h.EyeOff,{className:"h-4 w-4"}):r.jsx(h.Eye,{className:"h-4 w-4"})})})]}),t&&r.jsx("div",{className:"mt-1 space-y-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(A.Progress,{className:E.cn("h-2 flex-1"),dataHook:s?`${s}-strength-progress`:"password-strength-progress",value:g.value}),r.jsx("span",{className:"text-foreground w-10 shrink-0 text-right text-sm font-medium whitespace-nowrap","data-hook":s?`${s}-strength-label`:void 0,children:g.label})]})})]})});b.displayName="InputPassword";exports.InputPassword=b;exports.PASSWORD_STRENGTH=p;exports.calculatePasswordStrength=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),q=require("react"),h=require("lucide-react"),A=require("@brightlocal/ui-components/progress"),E=require("@brightlocal/ui-components/lib/utils"),l=require("@brightlocal/ui-components/input-group");function _(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const a=_(q),p={meter:{label:"Meter",value:0,color:"bg-muted"},weak:{label:"Weak",value:25,color:"bg-red-500"},ok:{label:"Ok",value:50,color:"bg-orange-500"},good:{label:"Good",value:75,color:"bg-green-500"},great:{label:"Great",value:100,color:"bg-green-600"}};function m(e){if(!e||e.length===0)return"meter";let t=0;return e.length>=8&&(t+=1),e.length>=12&&(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<=2?"weak":t<=3?"ok":t<=4?"good":"great"}const b=a.forwardRef(({className:e,showStrength:t=!0,onStrengthChange:n,dataHook:s,trackingEl:w,trackingLabel:S,onChange:x,value:i,id:j,...u},v)=>{const[c,P]=a.useState(!1),[I,y]=a.useState("meter"),[N,O]=a.useState(""),G=a.useId(),R=j||G,g=i!==void 0?String(i):N;a.useEffect(()=>{const o=setTimeout(()=>{const f=m(g);y(f),n?.(f)},180);return()=>clearTimeout(o)},[g,n]);const T=o=>{O(o.target.value),x?.(o)},k=()=>{P(o=>!o)},d=p[I];return r.jsxs("div",{className:"w-full",children:[r.jsxs(l.InputGroup,{className:e,dataHook:s,children:[r.jsx(l.InputGroupInput,{ref:v,id:R,trackingEl:w,trackingLabel:S,type:c?"text":"password",value:i,onChange:T,...u}),r.jsx(l.InputGroupAddon,{align:"inline-end",children:r.jsx(l.InputGroupButton,{"aria-label":c?"Hide password":"Show password","data-hook":s?`${s}-toggle`:void 0,disabled:u.disabled,size:"icon",variant:"ghost",onClick:k,children:c?r.jsx(h.EyeOff,{className:"h-4 w-4"}):r.jsx(h.Eye,{className:"h-4 w-4"})})})]}),t&&r.jsx("div",{className:"mt-1 space-y-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(A.Progress,{className:E.cn("h-2 flex-1"),dataHook:s?`${s}-strength-progress`:"password-strength-progress",value:d.value}),r.jsx("span",{className:"text-foreground w-10 shrink-0 text-right text-sm font-medium whitespace-nowrap","data-hook":s?`${s}-strength-label`:void 0,children:d.label})]})})]})});b.displayName="InputPassword";exports.InputPassword=b;exports.PASSWORD_STRENGTH=p;exports.calculatePasswordStrength=m;
@@ -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;AAY/B,KAAK,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnE,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,gBAAgB,EAAE,sBAAsB,CAMvE,CAAC;AAEF,UAAU,kBAAmB,SAAQ,IAAI,CACvC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAC7B,MAAM,CACP;IACC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACxD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,iBAAS,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAsBrE;AAED,QAAA,MAAM,aAAa,0GAsGlB,CAAC;AAIF,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,CAAC;AACvE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,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;AAY/B,KAAK,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnE,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,gBAAgB,EAAE,sBAAsB,CAMvE,CAAC;AAEF,UAAU,kBAAmB,SAAQ,IAAI,CACvC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAC7B,MAAM,CACP;IACC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACxD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,iBAAS,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAsBrE;AAED,QAAA,MAAM,aAAa,0GAqGlB,CAAC;AAIF,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,CAAC;AACvE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
- import * as s from "react";
2
+ import * as o from "react";
3
3
  import { EyeOff as A, Eye as E } from "lucide-react";
4
4
  import { Progress as R } from "@brightlocal/ui-components/progress";
5
5
  import { cn as T } from "@brightlocal/ui-components/lib/utils";
@@ -17,58 +17,57 @@ function j(t) {
17
17
  let e = 0;
18
18
  return t.length >= 8 && (e += 1), t.length >= 12 && (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 <= 2 ? "weak" : e <= 3 ? "ok" : e <= 4 ? "good" : "great";
19
19
  }
20
- const W = s.forwardRef(
20
+ const W = o.forwardRef(
21
21
  ({
22
22
  className: t,
23
23
  showStrength: e = !0,
24
24
  onStrengthChange: c,
25
25
  dataHook: n,
26
- trackingEl: m,
26
+ trackingEl: h,
27
27
  trackingLabel: f,
28
28
  onChange: p,
29
- value: o,
29
+ value: l,
30
30
  id: b,
31
31
  ...u
32
32
  }, w) => {
33
- const [l, v] = s.useState(!1), [I, S] = s.useState("meter"), [x, N] = s.useState(""), k = s.useId(), P = b || k, g = o !== void 0 ? String(o) : x;
34
- s.useEffect(() => {
35
- const a = setTimeout(() => {
36
- const h = j(g);
37
- S(h), c?.(h);
33
+ const [a, v] = o.useState(!1), [I, S] = o.useState("meter"), [x, N] = o.useState(""), P = o.useId(), G = b || P, g = l !== void 0 ? String(l) : x;
34
+ o.useEffect(() => {
35
+ const s = setTimeout(() => {
36
+ const m = j(g);
37
+ S(m), c?.(m);
38
38
  }, 180);
39
- return () => clearTimeout(a);
39
+ return () => clearTimeout(s);
40
40
  }, [g, c]);
41
- const G = (a) => {
42
- N(a.target.value), p?.(a);
43
- }, y = () => {
44
- v((a) => !a);
41
+ const y = (s) => {
42
+ N(s.target.value), p?.(s);
43
+ }, k = () => {
44
+ v((s) => !s);
45
45
  }, d = $[I];
46
46
  return /* @__PURE__ */ i("div", { className: "w-full", children: [
47
- /* @__PURE__ */ i(V, { className: t, children: [
47
+ /* @__PURE__ */ i(V, { className: t, dataHook: n, children: [
48
48
  /* @__PURE__ */ r(
49
49
  z,
50
50
  {
51
51
  ref: w,
52
- "data-hook": n,
53
- "data-tracking-el": m,
54
- "data-tracking-label": f,
55
- id: P,
56
- type: l ? "text" : "password",
57
- value: o,
58
- onChange: G,
52
+ id: G,
53
+ trackingEl: h,
54
+ trackingLabel: f,
55
+ type: a ? "text" : "password",
56
+ value: l,
57
+ onChange: y,
59
58
  ...u
60
59
  }
61
60
  ),
62
61
  /* @__PURE__ */ r(C, { align: "inline-end", children: /* @__PURE__ */ r(
63
62
  O,
64
63
  {
65
- "aria-label": l ? "Hide password" : "Show password",
64
+ "aria-label": a ? "Hide password" : "Show password",
66
65
  "data-hook": n ? `${n}-toggle` : void 0,
67
66
  disabled: u.disabled,
68
67
  size: "icon",
69
68
  variant: "ghost",
70
- onClick: y,
71
- children: l ? /* @__PURE__ */ r(A, { className: "h-4 w-4" }) : /* @__PURE__ */ r(E, { className: "h-4 w-4" })
69
+ onClick: k,
70
+ children: a ? /* @__PURE__ */ r(A, { className: "h-4 w-4" }) : /* @__PURE__ */ r(E, { className: "h-4 w-4" })
72
71
  }
73
72
  ) })
74
73
  ] }),
package/dist/input.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),T=require("react"),p=require("class-variance-authority"),o=require("@brightlocal/ui-components/lib/utils"),z=require("@brightlocal/ui-components/label"),V=require("@brightlocal/ui-components/input-base");function _(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(a,n,c.get?c:{enumerable:!0,get:()=>t[n]})}}return a.default=t,Object.freeze(a)}const b=_(T);var j=(t=>(t.VERTICAL="vertical",t.HORIZONTAL="horizontal",t))(j||{});const $=p.cva(["text-sm mt-2 text-left"],{variants:{state:{normal:"text-muted-foreground"}},defaultVariants:{state:"normal"}}),g=p.cva(["block text-sm font-normal leading-none text-muted-foreground font-sans mb-2","text-foreground hover:text-green-900","underline transition-colors cursor-pointer"]),N=b.forwardRef(({className:t,type:a,label:n,description:c,link:i,icon:d,secondaryIcon:u,optional:I,layout:m="vertical",dataHook:r,trackingEl:k,trackingLabel:y,id:O,...s},E)=>{const S=b.useId(),f=O||S,q=`${f}-description`,w=s["aria-invalid"]===!0||s["aria-invalid"]==="true",h=e.jsxs("div",{className:"relative flex items-center",children:[d&&e.jsx("div",{className:o.cn("text-muted-foreground pointer-events-none absolute left-3 flex items-center",s.disabled&&"opacity-50"),children:d}),e.jsx(V.BaseInputElement,{ref:E,"aria-label":n?void 0:s["aria-label"],className:o.cn(w&&"border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive",a==="time"&&"appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none",t),"data-hook":r,"data-tracking-el":k,"data-tracking-label":y,hasIcon:!!d,hasSecondaryIcon:!!u,id:f,type:a,...s}),u&&e.jsx("div",{className:o.cn("text-muted-foreground pointer-events-none absolute right-3 flex items-center",s.disabled&&"opacity-50"),children:u})]}),v=n&&e.jsx(z.Label,{className:o.cn(m==="vertical"&&"mb-2"),"data-hook":r?`${r}-label`:void 0,htmlFor:f,optional:I,children:n}),x=c&&e.jsx("div",{className:o.cn($({state:"normal"}),m==="horizontal"&&"mt-2"),"data-hook":r?`${r}-description`:void 0,id:q,children:c}),l=i?.text?.trim(),R=l&&e.jsx("div",{children:i?.href?e.jsx("a",{className:g(),"data-hook":r?`${r}-link`:void 0,href:i.href,target:i.target,...i.target==="_blank"&&{rel:"noopener noreferrer"},children:l}):l?e.jsx("button",{"aria-label":l,className:g(),"data-hook":r?`${r}-link`:void 0,type:"button",onClick:i?.onClick,children:l}):null});return m==="horizontal"?e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex h-9 flex-shrink-0 items-center",children:v}),e.jsxs("div",{className:"flex-1",children:[h,x]})]}):e.jsxs("div",{children:[i?e.jsxs("div",{className:"flex items-end justify-between",children:[v,R]}):v,h,x]})});N.displayName="Input";exports.Input=N;exports.InputLayout=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),f=require("react"),b=require("class-variance-authority"),p=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 g=v(f),i=b.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-all","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}}),o=g.forwardRef(({className:e,hasIcon:r=!1,hasSecondaryIcon:t=!1,dataHook:a,trackingEl:s,trackingLabel:l,...n},c)=>{const d=n["aria-invalid"]===!0||n["aria-invalid"]==="true";return u.jsx("input",{ref:c,className:p.cn(i({hasIcon:r,hasSecondaryIcon:t}),d&&"border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive",e),"data-hook":a,"data-slot":"input","data-tracking-el":s,"data-tracking-label":l,...n})});o.displayName="Input";exports.Input=o;exports.inputVariants=i;
package/dist/input.d.ts CHANGED
@@ -1,32 +1,46 @@
1
+ import { VariantProps } from 'class-variance-authority';
1
2
  import * as React from "react";
2
- declare enum InputLayout {
3
- VERTICAL = "vertical",
4
- HORIZONTAL = "horizontal"
5
- }
6
- interface InputProps extends Omit<React.ComponentProps<"input">, "size"> {
3
+ /**
4
+ * Shared input variant styles
5
+ * These can be reused across different input components
6
+ */
7
+ export declare const inputVariants: (props?: ({
8
+ hasIcon?: boolean | null | undefined;
9
+ hasSecondaryIcon?: boolean | null | undefined;
10
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
11
+ /**
12
+ * Simple styled input element
13
+ *
14
+ * For inputs with label/description, compose with Field, FieldLabel, FieldDescription:
15
+ * ```tsx
16
+ * <Field>
17
+ * <FieldLabel htmlFor="email">Email</FieldLabel>
18
+ * <Input id="email" placeholder="Enter email" dataHook="email-input" />
19
+ * <FieldDescription>We'll never share your email</FieldDescription>
20
+ * </Field>
21
+ * ```
22
+ *
23
+ * For decorative icons, use InputGroup:
24
+ * ```tsx
25
+ * <InputGroup>
26
+ * <InputGroupAddon><SearchIcon /></InputGroupAddon>
27
+ * <InputGroupInput placeholder="Search..." />
28
+ * </InputGroup>
29
+ * ```
30
+ */
31
+ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">, VariantProps<typeof inputVariants> {
7
32
  /**
8
- * Visible label for the input field.
9
- * If not provided, use aria-label for accessibility.
33
+ * Required data-hook attribute for automated testing
10
34
  */
11
- label?: string;
12
- description?: string;
13
- link?: {
14
- text: string & {
15
- length: 1;
16
- };
17
- href?: string;
18
- onClick?: () => void;
19
- target?: "_blank" | "_self" | "_parent" | "_top";
20
- };
21
35
  dataHook: string;
22
- optional?: boolean;
23
- layout?: InputLayout;
36
+ /**
37
+ * Optional tracking element identifier for analytics
38
+ */
24
39
  trackingEl?: string;
40
+ /**
41
+ * Optional tracking label for analytics context
42
+ */
25
43
  trackingLabel?: string;
26
- icon?: React.ReactNode;
27
- secondaryIcon?: React.ReactNode;
28
44
  }
29
- declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
30
- export { Input, InputLayout };
31
- export type { InputProps };
45
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
32
46
  //# sourceMappingURL=input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/components/input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,aAAK,WAAW;IACd,QAAQ,aAAa;IACrB,UAAU,eAAe;CAC1B;AAuBD,UAAU,UAAW,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IACtE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,GAAG;YAAE,MAAM,EAAE,CAAC,CAAA;SAAE,CAAC;QAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;QACrB,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;KAClD,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC;AAED,QAAA,MAAM,KAAK,kGA4JV,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAE9B,YAAY,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/components/input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE;;;GAGG;AACH,eAAO,MAAM,aAAa;;;8EAwCzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,UACf,SACE,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,EACzD,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,KAAK,qFAkCjB,CAAC"}
package/dist/input.js CHANGED
@@ -1,146 +1,78 @@
1
- import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import * as p from "react";
3
- import { cva as N } from "class-variance-authority";
4
- import { cn as s } from "@brightlocal/ui-components/lib/utils";
5
- import { Label as S } from "@brightlocal/ui-components/label";
6
- import { BaseInputElement as T } from "@brightlocal/ui-components/input-base";
7
- var V = /* @__PURE__ */ ((n) => (n.VERTICAL = "vertical", n.HORIZONTAL = "horizontal", n))(V || {});
8
- const A = N(["text-sm mt-2 text-left"], {
9
- variants: {
10
- state: {
11
- normal: "text-muted-foreground"
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import * as c from "react";
3
+ import { cva as u } from "class-variance-authority";
4
+ import { cn as f } from "@brightlocal/ui-components/lib/utils";
5
+ const b = u(
6
+ [
7
+ // Layout & Size
8
+ "flex w-full min-w-0 h-9",
9
+ // Appearance
10
+ "border border-input bg-background rounded-sm",
11
+ "outline-none transition-all",
12
+ // Typography
13
+ "text-sm font-sans",
14
+ "text-foreground",
15
+ "overflow-hidden text-ellipsis",
16
+ // States - Focus
17
+ "focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background",
18
+ "focus-visible:shadow-default",
19
+ // States - Disabled
20
+ "disabled:cursor-not-allowed disabled:opacity-50",
21
+ // Pseudo-elements
22
+ "placeholder:text-muted-foreground",
23
+ "placeholder:overflow-hidden placeholder:text-ellipsis",
24
+ // Text input alignment - uses design token for text/sm line-height (20px)
25
+ "items-center px-3 pb-[1px] leading-5",
26
+ // Hide default browser icons for date/time inputs
27
+ "[&::-webkit-calendar-picker-indicator]:hidden"
28
+ ],
29
+ {
30
+ variants: {
31
+ hasIcon: {
32
+ true: "pl-9",
33
+ false: ""
34
+ },
35
+ hasSecondaryIcon: {
36
+ true: "pr-9",
37
+ false: ""
38
+ }
39
+ },
40
+ defaultVariants: {
41
+ hasIcon: !1,
42
+ hasSecondaryIcon: !1
12
43
  }
13
- },
14
- defaultVariants: {
15
- state: "normal"
16
- /* NORMAL */
17
44
  }
18
- }), g = N([
19
- "block text-sm font-normal leading-none text-muted-foreground font-sans mb-2",
20
- "text-foreground hover:text-green-900",
21
- "underline transition-colors cursor-pointer"
22
- ]), L = p.forwardRef(
45
+ ), p = c.forwardRef(
23
46
  ({
24
- className: n,
25
- type: v,
26
- label: o,
27
- description: u,
28
- link: r,
29
- icon: d,
30
- secondaryIcon: c,
31
- optional: k,
32
- layout: m = "vertical",
33
- dataHook: e,
34
- trackingEl: I,
35
- trackingLabel: E,
36
- id: $,
37
- ...i
38
- }, w) => {
39
- const R = p.useId(), f = $ || R, j = `${f}-description`, z = i["aria-invalid"] === !0 || i["aria-invalid"] === "true", b = /* @__PURE__ */ l("div", { className: "relative flex items-center", children: [
40
- d && /* @__PURE__ */ t(
41
- "div",
42
- {
43
- className: s(
44
- "text-muted-foreground pointer-events-none absolute left-3 flex items-center",
45
- i.disabled && "opacity-50"
46
- ),
47
- children: d
48
- }
49
- ),
50
- /* @__PURE__ */ t(
51
- T,
52
- {
53
- ref: w,
54
- "aria-label": o ? void 0 : i["aria-label"],
55
- className: s(
56
- z && "border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive",
57
- v === "time" && "appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none",
58
- n
59
- ),
60
- "data-hook": e,
61
- "data-tracking-el": I,
62
- "data-tracking-label": E,
63
- hasIcon: !!d,
64
- hasSecondaryIcon: !!c,
65
- id: f,
66
- type: v,
67
- ...i
68
- }
69
- ),
70
- c && /* @__PURE__ */ t(
71
- "div",
72
- {
73
- className: s(
74
- "text-muted-foreground pointer-events-none absolute right-3 flex items-center",
75
- i.disabled && "opacity-50"
76
- ),
77
- children: c
78
- }
79
- )
80
- ] }), h = o && /* @__PURE__ */ t(
81
- S,
82
- {
83
- className: s(m === "vertical" && "mb-2"),
84
- "data-hook": e ? `${e}-label` : void 0,
85
- htmlFor: f,
86
- optional: k,
87
- children: o
88
- }
89
- ), x = u && /* @__PURE__ */ t(
90
- "div",
47
+ className: a,
48
+ hasIcon: r = !1,
49
+ hasSecondaryIcon: t = !1,
50
+ dataHook: o,
51
+ trackingEl: i,
52
+ trackingLabel: s,
53
+ ...e
54
+ }, d) => {
55
+ const n = e["aria-invalid"] === !0 || e["aria-invalid"] === "true";
56
+ return /* @__PURE__ */ l(
57
+ "input",
91
58
  {
92
- className: s(
93
- A({
94
- state: "normal"
95
- /* NORMAL */
96
- }),
97
- m === "horizontal" && "mt-2"
59
+ ref: d,
60
+ className: f(
61
+ b({ hasIcon: r, hasSecondaryIcon: t }),
62
+ n && "border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive",
63
+ a
98
64
  ),
99
- "data-hook": e ? `${e}-description` : void 0,
100
- id: j,
101
- children: u
102
- }
103
- ), a = r?.text?.trim(), C = a && /* @__PURE__ */ t("div", { children: r?.href ? /* @__PURE__ */ t(
104
- "a",
105
- {
106
- className: g(),
107
- "data-hook": e ? `${e}-link` : void 0,
108
- href: r.href,
109
- target: r.target,
110
- ...r.target === "_blank" && {
111
- rel: "noopener noreferrer"
112
- },
113
- children: a
114
- }
115
- ) : a ? /* @__PURE__ */ t(
116
- "button",
117
- {
118
- "aria-label": a,
119
- className: g(),
120
- "data-hook": e ? `${e}-link` : void 0,
121
- type: "button",
122
- onClick: r?.onClick,
123
- children: a
65
+ "data-hook": o,
66
+ "data-slot": "input",
67
+ "data-tracking-el": i,
68
+ "data-tracking-label": s,
69
+ ...e
124
70
  }
125
- ) : null });
126
- return m === "horizontal" ? /* @__PURE__ */ l("div", { className: "flex items-start gap-4", children: [
127
- /* @__PURE__ */ t("div", { className: "flex h-9 flex-shrink-0 items-center", children: h }),
128
- /* @__PURE__ */ l("div", { className: "flex-1", children: [
129
- b,
130
- x
131
- ] })
132
- ] }) : /* @__PURE__ */ l("div", { children: [
133
- r ? /* @__PURE__ */ l("div", { className: "flex items-end justify-between", children: [
134
- h,
135
- C
136
- ] }) : h,
137
- b,
138
- x
139
- ] });
71
+ );
140
72
  }
141
73
  );
142
- L.displayName = "Input";
74
+ p.displayName = "Input";
143
75
  export {
144
- L as Input,
145
- V as InputLayout
76
+ p as Input,
77
+ b as inputVariants
146
78
  };