@bricks-toolkit/toolkit 0.1.1 → 0.1.2

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 (332) hide show
  1. package/README.md +9 -9
  2. package/dist/avatar/index.cjs +11 -1
  3. package/dist/avatar/index.mjs +2 -1
  4. package/dist/badge/index.cjs +11 -1
  5. package/dist/badge/index.mjs +2 -1
  6. package/dist/breadcrumbs/index.cjs +11 -1
  7. package/dist/breadcrumbs/index.mjs +2 -1
  8. package/dist/button/index.cjs +13 -2
  9. package/dist/button/index.mjs +4 -2
  10. package/dist/card/index.cjs +31 -1
  11. package/dist/card/index.mjs +2 -1
  12. package/dist/checkbox/index.cjs +11 -1
  13. package/dist/checkbox/index.mjs +2 -1
  14. package/dist/chunk-2POU3NX4.mjs +192 -0
  15. package/dist/chunk-32SKYPQW.mjs +156 -0
  16. package/dist/chunk-446OJWC6.mjs +285 -0
  17. package/dist/chunk-4DA7CRNV.mjs +376 -0
  18. package/dist/chunk-4DR57X7U.mjs +182 -0
  19. package/dist/chunk-4QSDPHPI.mjs +285 -0
  20. package/dist/chunk-56ILK7Y4.cjs +315 -0
  21. package/dist/chunk-5J3OMAO4.cjs +222 -0
  22. package/dist/chunk-5RKET2JO.cjs +287 -0
  23. package/dist/chunk-65UZC3FK.mjs +312 -0
  24. package/dist/chunk-6CC5KIA5.cjs +148 -0
  25. package/dist/chunk-6R3OYBQ6.cjs +209 -0
  26. package/dist/chunk-6UO72EJA.cjs +2 -0
  27. package/dist/chunk-6ZCY4O5M.mjs +63 -0
  28. package/dist/chunk-7364SUK6.mjs +359 -0
  29. package/dist/chunk-7DDDQ3RH.cjs +66 -0
  30. package/dist/chunk-7PDGAIC3.cjs +189 -0
  31. package/dist/chunk-7R5JRJ2W.cjs +255 -0
  32. package/dist/chunk-7WNJ7L4Z.mjs +335 -0
  33. package/dist/chunk-AJXVELXK.cjs +218 -0
  34. package/dist/chunk-ARTXRQO6.mjs +1 -0
  35. package/dist/chunk-B4OV5GRT.cjs +510 -0
  36. package/dist/chunk-B5MYGYJY.mjs +122 -0
  37. package/dist/chunk-BBVWG5GH.cjs +75 -0
  38. package/dist/chunk-BVBCAAES.mjs +35 -0
  39. package/dist/chunk-CBA54EY4.mjs +508 -0
  40. package/dist/chunk-CMER5LO3.mjs +330 -0
  41. package/dist/chunk-DHC5LI2P.cjs +338 -0
  42. package/dist/chunk-DMLPA65B.mjs +107 -0
  43. package/dist/chunk-DN2GFJF4.mjs +175 -0
  44. package/dist/chunk-ECLNLPOR.cjs +70 -0
  45. package/dist/chunk-EV463QT5.cjs +53 -0
  46. package/dist/chunk-FOVJHEWH.mjs +51 -0
  47. package/dist/chunk-G4HVY6FM.mjs +203 -0
  48. package/dist/chunk-H77YWN3L.mjs +220 -0
  49. package/dist/chunk-HIWJDLIS.cjs +124 -0
  50. package/dist/chunk-HQGDSOSN.mjs +274 -0
  51. package/dist/chunk-JKPNJ4PZ.mjs +313 -0
  52. package/dist/chunk-JV6AWBN5.mjs +113 -0
  53. package/dist/chunk-KA35BV7V.mjs +207 -0
  54. package/dist/chunk-KLBABQEJ.cjs +378 -0
  55. package/dist/chunk-L5VQZZVR.cjs +3197 -0
  56. package/dist/chunk-LTG6YP5I.cjs +69 -0
  57. package/dist/chunk-MVUNJPGH.cjs +184 -0
  58. package/dist/chunk-NMJ5CVZH.cjs +2 -0
  59. package/dist/chunk-NRCNRHXL.cjs +109 -0
  60. package/dist/chunk-NRZIXK35.cjs +276 -0
  61. package/dist/chunk-OCPFOFJ4.mjs +3195 -0
  62. package/dist/chunk-OEU5VG3D.cjs +362 -0
  63. package/dist/chunk-OPOCCRJG.cjs +193 -0
  64. package/dist/chunk-OQPCL5XX.mjs +187 -0
  65. package/dist/chunk-PCYGJNEQ.cjs +280 -0
  66. package/dist/chunk-PJH2KEWK.mjs +200 -0
  67. package/dist/chunk-PJWELBN2.cjs +115 -0
  68. package/dist/chunk-Q3IFXFFD.cjs +202 -0
  69. package/dist/chunk-R72GDCWE.cjs +314 -0
  70. package/dist/chunk-RAD5VJHR.mjs +146 -0
  71. package/dist/chunk-RYWDZHKG.mjs +274 -0
  72. package/dist/chunk-S7VEND5Z.cjs +162 -0
  73. package/dist/chunk-SBNNV6FE.mjs +1 -0
  74. package/dist/chunk-SFUOCZJY.mjs +187 -0
  75. package/dist/chunk-SHQ2MPBE.mjs +73 -0
  76. package/dist/chunk-TIVSMCXZ.mjs +253 -0
  77. package/dist/chunk-TNGW5YHA.cjs +37 -0
  78. package/dist/chunk-VC7MOPU6.cjs +287 -0
  79. package/dist/chunk-VHVFRWF5.mjs +64 -0
  80. package/dist/chunk-VKQDW7C2.mjs +336 -0
  81. package/dist/chunk-VRZFAKSV.cjs +177 -0
  82. package/dist/chunk-W2ZAPLQH.cjs +337 -0
  83. package/dist/chunk-XFNRKHHF.cjs +332 -0
  84. package/dist/chunk-Y3NTKFUE.mjs +66 -0
  85. package/dist/chunk-Y6AN7AWX.cjs +205 -0
  86. package/dist/chunk-YMMNWJT6.cjs +134 -0
  87. package/dist/chunk-YOTCXSXL.mjs +132 -0
  88. package/dist/combo-box/index.cjs +11 -1
  89. package/dist/combo-box/index.mjs +2 -1
  90. package/dist/date-picker/index.cjs +11 -2
  91. package/dist/date-picker/index.mjs +2 -2
  92. package/dist/dialog/index.cjs +27 -1
  93. package/dist/dialog/index.mjs +2 -1
  94. package/dist/dropdown-menu/index.cjs +27 -1
  95. package/dist/dropdown-menu/index.mjs +2 -1
  96. package/dist/email/index.cjs +11 -2
  97. package/dist/email/index.mjs +2 -2
  98. package/dist/file-upload/index.cjs +11 -1
  99. package/dist/file-upload/index.mjs +2 -1
  100. package/dist/header/index.cjs +14 -2
  101. package/dist/header/index.mjs +5 -2
  102. package/dist/icon-button/index.cjs +13 -2
  103. package/dist/icon-button/index.mjs +4 -2
  104. package/dist/image/index.cjs +12 -1
  105. package/dist/image/index.mjs +3 -1
  106. package/dist/index.cjs +839 -2
  107. package/dist/index.d.ts +141 -75
  108. package/dist/index.mjs +601 -2
  109. package/dist/link/index.cjs +11 -1
  110. package/dist/link/index.mjs +2 -1
  111. package/dist/loader/index.cjs +11 -2
  112. package/dist/loader/index.mjs +2 -2
  113. package/dist/modal/index.cjs +27 -1
  114. package/dist/modal/index.mjs +2 -1
  115. package/dist/multi-select/index.cjs +11 -2
  116. package/dist/multi-select/index.mjs +2 -2
  117. package/dist/otp-input/index.cjs +11 -1
  118. package/dist/otp-input/index.mjs +2 -1
  119. package/dist/password-input/index.cjs +11 -2
  120. package/dist/password-input/index.mjs +2 -2
  121. package/dist/phone/index.cjs +11 -2
  122. package/dist/phone/index.mjs +2 -2
  123. package/dist/radio-button/index.cjs +11 -1
  124. package/dist/radio-button/index.mjs +2 -1
  125. package/dist/search-input/index.cjs +12 -2
  126. package/dist/search-input/index.mjs +3 -2
  127. package/dist/select/index.cjs +11 -2
  128. package/dist/select/index.mjs +2 -2
  129. package/dist/sidebar/index.cjs +11 -1
  130. package/dist/sidebar/index.mjs +2 -1
  131. package/dist/skeleton/index.cjs +27 -1
  132. package/dist/skeleton/index.mjs +2 -1
  133. package/dist/styles.css +5074 -1
  134. package/dist/table/index.cjs +15 -1
  135. package/dist/table/index.mjs +2 -1
  136. package/dist/tabs/index.cjs +14 -2
  137. package/dist/tabs/index.mjs +5 -2
  138. package/dist/text-input/index.cjs +11 -2
  139. package/dist/text-input/index.mjs +2 -2
  140. package/dist/theme-provider/index.cjs +14 -1
  141. package/dist/theme-provider/index.mjs +1 -1
  142. package/dist/time-picker/index.cjs +11 -2
  143. package/dist/time-picker/index.mjs +2 -2
  144. package/dist/toaster/index.cjs +11 -1
  145. package/dist/toaster/index.mjs +2 -1
  146. package/dist/tooltip/index.cjs +12 -1
  147. package/dist/tooltip/index.mjs +3 -1
  148. package/package.json +122 -141
  149. package/dist/components/Accordion/Accordion.d.ts +0 -5
  150. package/dist/components/Accordion/Accordion.types.d.ts +0 -32
  151. package/dist/components/Accordion/index.d.ts +0 -2
  152. package/dist/components/Avatar/Avatar.d.ts +0 -2
  153. package/dist/components/Avatar/Avatar.stories.d.ts +0 -11
  154. package/dist/components/Avatar/Avatar.test.d.ts +0 -1
  155. package/dist/components/Avatar/Avatar.types.d.ts +0 -24
  156. package/dist/components/Avatar/index.d.ts +0 -2
  157. package/dist/components/Badge/Badge.d.ts +0 -11
  158. package/dist/components/Badge/Badge.stories.d.ts +0 -21
  159. package/dist/components/Badge/Badge.test.d.ts +0 -1
  160. package/dist/components/Badge/Badge.types.d.ts +0 -43
  161. package/dist/components/Badge/index.d.ts +0 -2
  162. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +0 -2
  163. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -13
  164. package/dist/components/Breadcrumbs/Breadcrumbs.test.d.ts +0 -1
  165. package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +0 -27
  166. package/dist/components/Breadcrumbs/index.d.ts +0 -2
  167. package/dist/components/Button/Button.d.ts +0 -2
  168. package/dist/components/Button/Button.stories.d.ts +0 -20
  169. package/dist/components/Button/Button.test.d.ts +0 -1
  170. package/dist/components/Button/Button.types.d.ts +0 -24
  171. package/dist/components/Button/index.d.ts +0 -2
  172. package/dist/components/Card/Card.d.ts +0 -25
  173. package/dist/components/Card/Card.stories.d.ts +0 -8
  174. package/dist/components/Card/Card.test.d.ts +0 -1
  175. package/dist/components/Card/Card.types.d.ts +0 -14
  176. package/dist/components/Card/index.d.ts +0 -2
  177. package/dist/components/Checkbox/Checkbox.d.ts +0 -2
  178. package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -16
  179. package/dist/components/Checkbox/Checkbox.test.d.ts +0 -1
  180. package/dist/components/Checkbox/Checkbox.types.d.ts +0 -31
  181. package/dist/components/Checkbox/index.d.ts +0 -2
  182. package/dist/components/ComboBox/ComboBox.d.ts +0 -2
  183. package/dist/components/ComboBox/ComboBox.stories.d.ts +0 -12
  184. package/dist/components/ComboBox/ComboBox.test.d.ts +0 -1
  185. package/dist/components/ComboBox/ComboBox.types.d.ts +0 -57
  186. package/dist/components/ComboBox/index.d.ts +0 -2
  187. package/dist/components/DatePicker/DatePicker.d.ts +0 -2
  188. package/dist/components/DatePicker/DatePicker.stories.d.ts +0 -25
  189. package/dist/components/DatePicker/DatePicker.test.d.ts +0 -1
  190. package/dist/components/DatePicker/DatePicker.types.d.ts +0 -27
  191. package/dist/components/DatePicker/index.d.ts +0 -2
  192. package/dist/components/Dialog/Dialog.d.ts +0 -6
  193. package/dist/components/Dialog/Dialog.stories.d.ts +0 -9
  194. package/dist/components/Dialog/Dialog.test.d.ts +0 -1
  195. package/dist/components/Dialog/Dialog.types.d.ts +0 -52
  196. package/dist/components/Dialog/index.d.ts +0 -2
  197. package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -7
  198. package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +0 -9
  199. package/dist/components/DropdownMenu/DropdownMenu.test.d.ts +0 -1
  200. package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +0 -24
  201. package/dist/components/DropdownMenu/index.d.ts +0 -2
  202. package/dist/components/Email/Email.d.ts +0 -2
  203. package/dist/components/Email/Email.stories.d.ts +0 -11
  204. package/dist/components/Email/Email.test.d.ts +0 -1
  205. package/dist/components/Email/Email.types.d.ts +0 -33
  206. package/dist/components/Email/index.d.ts +0 -2
  207. package/dist/components/FileUpload/FileUpload.d.ts +0 -2
  208. package/dist/components/FileUpload/FileUpload.stories.d.ts +0 -10
  209. package/dist/components/FileUpload/FileUpload.test.d.ts +0 -1
  210. package/dist/components/FileUpload/FileUpload.types.d.ts +0 -22
  211. package/dist/components/FileUpload/index.d.ts +0 -2
  212. package/dist/components/Header/Header.d.ts +0 -7
  213. package/dist/components/Header/Header.stories.d.ts +0 -8
  214. package/dist/components/Header/Header.test.d.ts +0 -1
  215. package/dist/components/Header/Header.types.d.ts +0 -19
  216. package/dist/components/Header/index.d.ts +0 -2
  217. package/dist/components/IconButton/IconButton.d.ts +0 -2
  218. package/dist/components/IconButton/IconButton.stories.d.ts +0 -17
  219. package/dist/components/IconButton/IconButton.types.d.ts +0 -10
  220. package/dist/components/IconButton/index.d.ts +0 -2
  221. package/dist/components/Image/Image.d.ts +0 -6
  222. package/dist/components/Image/Image.stories.d.ts +0 -13
  223. package/dist/components/Image/Image.test.d.ts +0 -1
  224. package/dist/components/Image/Image.types.d.ts +0 -40
  225. package/dist/components/Image/index.d.ts +0 -2
  226. package/dist/components/Link/Link.d.ts +0 -2
  227. package/dist/components/Link/Link.stories.d.ts +0 -15
  228. package/dist/components/Link/Link.test.d.ts +0 -1
  229. package/dist/components/Link/Link.types.d.ts +0 -20
  230. package/dist/components/Link/index.d.ts +0 -2
  231. package/dist/components/Loader/Loader.d.ts +0 -2
  232. package/dist/components/Loader/Loader.stories.d.ts +0 -12
  233. package/dist/components/Loader/Loader.test.d.ts +0 -1
  234. package/dist/components/Loader/Loader.types.d.ts +0 -17
  235. package/dist/components/Loader/index.d.ts +0 -2
  236. package/dist/components/Modal/Modal.d.ts +0 -14
  237. package/dist/components/Modal/Modal.stories.d.ts +0 -14
  238. package/dist/components/Modal/Modal.test.d.ts +0 -1
  239. package/dist/components/Modal/Modal.types.d.ts +0 -100
  240. package/dist/components/Modal/index.d.ts +0 -2
  241. package/dist/components/MultiSelect/MultiSelect.d.ts +0 -2
  242. package/dist/components/MultiSelect/MultiSelect.stories.d.ts +0 -15
  243. package/dist/components/MultiSelect/MultiSelect.test.d.ts +0 -1
  244. package/dist/components/MultiSelect/MultiSelect.types.d.ts +0 -55
  245. package/dist/components/MultiSelect/index.d.ts +0 -2
  246. package/dist/components/OtpInput/OtpInput.d.ts +0 -2
  247. package/dist/components/OtpInput/OtpInput.stories.d.ts +0 -10
  248. package/dist/components/OtpInput/OtpInput.test.d.ts +0 -1
  249. package/dist/components/OtpInput/OtpInput.types.d.ts +0 -53
  250. package/dist/components/OtpInput/index.d.ts +0 -2
  251. package/dist/components/PasswordInput/PasswordInput.d.ts +0 -2
  252. package/dist/components/PasswordInput/PasswordInput.stories.d.ts +0 -23
  253. package/dist/components/PasswordInput/PasswordInput.test.d.ts +0 -1
  254. package/dist/components/PasswordInput/PasswordInput.types.d.ts +0 -27
  255. package/dist/components/PasswordInput/index.d.ts +0 -2
  256. package/dist/components/Phone/Phone.d.ts +0 -2
  257. package/dist/components/Phone/Phone.stories.d.ts +0 -11
  258. package/dist/components/Phone/Phone.test.d.ts +0 -1
  259. package/dist/components/Phone/Phone.types.d.ts +0 -36
  260. package/dist/components/Phone/countries.d.ts +0 -8
  261. package/dist/components/Phone/index.d.ts +0 -2
  262. package/dist/components/RadioButton/RadioButton.d.ts +0 -2
  263. package/dist/components/RadioButton/RadioButton.stories.d.ts +0 -21
  264. package/dist/components/RadioButton/RadioButton.test.d.ts +0 -1
  265. package/dist/components/RadioButton/RadioButton.types.d.ts +0 -51
  266. package/dist/components/RadioButton/index.d.ts +0 -2
  267. package/dist/components/SearchInput/SearchInput.d.ts +0 -6
  268. package/dist/components/SearchInput/SearchInput.stories.d.ts +0 -8
  269. package/dist/components/SearchInput/SearchInput.test.d.ts +0 -1
  270. package/dist/components/SearchInput/SearchInput.types.d.ts +0 -12
  271. package/dist/components/SearchInput/index.d.ts +0 -2
  272. package/dist/components/Select/Select.d.ts +0 -2
  273. package/dist/components/Select/Select.stories.d.ts +0 -12
  274. package/dist/components/Select/Select.test.d.ts +0 -1
  275. package/dist/components/Select/Select.types.d.ts +0 -31
  276. package/dist/components/Select/index.d.ts +0 -2
  277. package/dist/components/Sidebar/Sidebar.d.ts +0 -7
  278. package/dist/components/Sidebar/Sidebar.stories.d.ts +0 -10
  279. package/dist/components/Sidebar/Sidebar.test.d.ts +0 -1
  280. package/dist/components/Sidebar/Sidebar.types.d.ts +0 -87
  281. package/dist/components/Sidebar/index.d.ts +0 -2
  282. package/dist/components/Skeleton/Skeleton.d.ts +0 -26
  283. package/dist/components/Skeleton/Skeleton.stories.d.ts +0 -13
  284. package/dist/components/Skeleton/Skeleton.types.d.ts +0 -47
  285. package/dist/components/Skeleton/index.d.ts +0 -2
  286. package/dist/components/Stepper/Stepper.d.ts +0 -2
  287. package/dist/components/Stepper/Stepper.stories.d.ts +0 -23
  288. package/dist/components/Stepper/Stepper.test.d.ts +0 -1
  289. package/dist/components/Stepper/Stepper.types.d.ts +0 -47
  290. package/dist/components/Stepper/index.d.ts +0 -2
  291. package/dist/components/Table/Pagination.d.ts +0 -3
  292. package/dist/components/Table/Table.d.ts +0 -3
  293. package/dist/components/Table/Table.stories.d.ts +0 -13
  294. package/dist/components/Table/Table.test.d.ts +0 -1
  295. package/dist/components/Table/Table.types.d.ts +0 -85
  296. package/dist/components/Table/index.d.ts +0 -3
  297. package/dist/components/Tabs/Tabs.d.ts +0 -2
  298. package/dist/components/Tabs/Tabs.stories.d.ts +0 -17
  299. package/dist/components/Tabs/Tabs.test.d.ts +0 -1
  300. package/dist/components/Tabs/Tabs.types.d.ts +0 -21
  301. package/dist/components/Tabs/index.d.ts +0 -2
  302. package/dist/components/TextInput/TextInput.d.ts +0 -2
  303. package/dist/components/TextInput/TextInput.stories.d.ts +0 -25
  304. package/dist/components/TextInput/TextInput.test.d.ts +0 -1
  305. package/dist/components/TextInput/TextInput.types.d.ts +0 -29
  306. package/dist/components/TextInput/index.d.ts +0 -2
  307. package/dist/components/ThemeProvider/ThemeProvider.d.ts +0 -8
  308. package/dist/components/ThemeProvider/ThemeProvider.stories.d.ts +0 -16
  309. package/dist/components/ThemeProvider/ThemeProvider.test.d.ts +0 -1
  310. package/dist/components/ThemeProvider/ThemeProvider.types.d.ts +0 -112
  311. package/dist/components/ThemeProvider/index.d.ts +0 -2
  312. package/dist/components/TimePicker/TimePicker.d.ts +0 -2
  313. package/dist/components/TimePicker/TimePicker.stories.d.ts +0 -23
  314. package/dist/components/TimePicker/TimePicker.test.d.ts +0 -1
  315. package/dist/components/TimePicker/TimePicker.types.d.ts +0 -27
  316. package/dist/components/TimePicker/index.d.ts +0 -2
  317. package/dist/components/Toaster/Toaster.d.ts +0 -2
  318. package/dist/components/Toaster/Toaster.stories.d.ts +0 -13
  319. package/dist/components/Toaster/Toaster.test.d.ts +0 -1
  320. package/dist/components/Toaster/Toaster.types.d.ts +0 -23
  321. package/dist/components/Toaster/index.d.ts +0 -2
  322. package/dist/components/Toggle/Toggle.d.ts +0 -2
  323. package/dist/components/Toggle/Toggle.stories.d.ts +0 -11
  324. package/dist/components/Toggle/Toggle.types.d.ts +0 -10
  325. package/dist/components/Toggle/index.d.ts +0 -2
  326. package/dist/components/Tooltip/Tooltip.d.ts +0 -2
  327. package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -13
  328. package/dist/components/Tooltip/Tooltip.test.d.ts +0 -1
  329. package/dist/components/Tooltip/Tooltip.types.d.ts +0 -33
  330. package/dist/components/Tooltip/index.d.ts +0 -2
  331. package/dist/utils/cn.d.ts +0 -2
  332. package/dist/utils/index.d.ts +0 -1
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ var chunkL5VQZZVR_cjs = require('./chunk-L5VQZZVR.cjs');
4
+ var react = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ var sizeClasses = {
8
+ xs: "text-xs",
9
+ sm: "text-sm",
10
+ md: "text-base",
11
+ lg: "text-lg",
12
+ xl: "text-xl"
13
+ };
14
+ var variantClasses = {
15
+ primary: "text-primary hover:text-primary-hover active:text-primary-active",
16
+ secondary: "text-text-secondary hover:text-text active:text-text",
17
+ danger: "text-error hover:text-error/80 active:text-error/90",
18
+ ghost: "text-text-muted hover:text-text active:text-text hover:bg-hover px-2 py-0.5 rounded-sm transition-all duration-normal"
19
+ };
20
+ var underlineClasses = {
21
+ always: "underline underline-offset-4",
22
+ hover: "hover:underline hover:underline-offset-4",
23
+ none: "no-underline"
24
+ };
25
+ var disabledClasses = "opacity-50 cursor-not-allowed pointer-events-none";
26
+ var Link = react.forwardRef(function Link2({
27
+ children,
28
+ className,
29
+ variant = "primary",
30
+ size = "md",
31
+ underline = "hover",
32
+ isExternal = false,
33
+ disabled = false,
34
+ leftIcon,
35
+ rightIcon,
36
+ href,
37
+ rel,
38
+ target,
39
+ ...rest
40
+ }, ref) {
41
+ const generatedTarget = isExternal ? "_blank" : target;
42
+ const generatedRel = isExternal ? chunkL5VQZZVR_cjs.cn("noopener noreferrer", rel) : rel;
43
+ const activeHref = disabled ? void 0 : href;
44
+ return /* @__PURE__ */ jsxRuntime.jsxs(
45
+ "a",
46
+ {
47
+ ref,
48
+ href: activeHref,
49
+ target: generatedTarget,
50
+ rel: generatedRel,
51
+ "aria-disabled": disabled ? "true" : void 0,
52
+ role: disabled && !activeHref ? "link" : void 0,
53
+ tabIndex: disabled ? -1 : void 0,
54
+ className: chunkL5VQZZVR_cjs.cn(
55
+ "inline-flex items-center gap-1.5 transition-colors duration-150",
56
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-surface",
57
+ sizeClasses[size],
58
+ variantClasses[variant],
59
+ // Ghost variant traditionally doesn't mix with text-based underline properties well visually
60
+ variant === "ghost" ? "no-underline" : underlineClasses[underline],
61
+ disabled ? disabledClasses : "",
62
+ className
63
+ ),
64
+ ...rest,
65
+ children: [
66
+ leftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex shrink-0", children: leftIcon }),
67
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children }),
68
+ rightIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex shrink-0", children: rightIcon })
69
+ ]
70
+ }
71
+ );
72
+ });
73
+ Link.displayName = "Link";
74
+
75
+ exports.Link = Link;
@@ -0,0 +1,35 @@
1
+ import { Button } from './chunk-RAD5VJHR.mjs';
2
+ import { cn } from './chunk-OCPFOFJ4.mjs';
3
+ import { forwardRef } from 'react';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ var sizeClasses = {
7
+ xs: "w-6 h-6",
8
+ sm: "w-8 h-8",
9
+ md: "w-10 h-10",
10
+ lg: "w-11 h-11",
11
+ xl: "w-12 h-12"
12
+ };
13
+ var IconButton = forwardRef(
14
+ ({ icon, "aria-label": ariaLabel, isRound, className, size = "md", ...props }, ref) => {
15
+ return /* @__PURE__ */ jsx(
16
+ Button,
17
+ {
18
+ ref,
19
+ size,
20
+ className: cn(
21
+ "p-0 flex-shrink-0 min-w-0",
22
+ sizeClasses[size],
23
+ isRound && "rounded-full",
24
+ className
25
+ ),
26
+ "aria-label": ariaLabel,
27
+ ...props,
28
+ children: icon
29
+ }
30
+ );
31
+ }
32
+ );
33
+ IconButton.displayName = "IconButton";
34
+
35
+ export { IconButton };
@@ -0,0 +1,508 @@
1
+ import { cn } from './chunk-OCPFOFJ4.mjs';
2
+ import { forwardRef, useId, useState, useRef, useEffect } from 'react';
3
+ import { ChevronDownIcon, XMarkIcon } from '@heroicons/react/20/solid';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ // src/components/Phone/countries.ts
7
+ var COUNTRIES = [
8
+ { name: "Afghanistan", id: "AF", dialCode: "+93", maxLength: 9, flag: "\u{1F1E6}\u{1F1EB}" },
9
+ { name: "Albania", id: "AL", dialCode: "+355", maxLength: 9, flag: "\u{1F1E6}\u{1F1F1}" },
10
+ { name: "Algeria", id: "DZ", dialCode: "+213", maxLength: 9, flag: "\u{1F1E9}\u{1F1FF}" },
11
+ { name: "Andorra", id: "AD", dialCode: "+376", maxLength: 6, flag: "\u{1F1E6}\u{1F1E9}" },
12
+ { name: "Angola", id: "AO", dialCode: "+244", maxLength: 9, flag: "\u{1F1E6}\u{1F1F4}" },
13
+ { name: "Argentina", id: "AR", dialCode: "+54", maxLength: 10, flag: "\u{1F1E6}\u{1F1F7}" },
14
+ { name: "Armenia", id: "AM", dialCode: "+374", maxLength: 8, flag: "\u{1F1E6}\u{1F1F2}" },
15
+ { name: "Australia", id: "AU", dialCode: "+61", maxLength: 9, flag: "\u{1F1E6}\u{1F1FA}" },
16
+ { name: "Austria", id: "AT", dialCode: "+43", maxLength: 13, flag: "\u{1F1E6}\u{1F1F9}" },
17
+ { name: "Azerbaijan", id: "AZ", dialCode: "+994", maxLength: 9, flag: "\u{1F1E6}\u{1F1FF}" },
18
+ { name: "Bahrain", id: "BH", dialCode: "+973", maxLength: 8, flag: "\u{1F1E7}\u{1F1ED}" },
19
+ { name: "Bangladesh", id: "BD", dialCode: "+880", maxLength: 10, flag: "\u{1F1E7}\u{1F1E9}" },
20
+ { name: "Belarus", id: "BY", dialCode: "+375", maxLength: 9, flag: "\u{1F1E7}\u{1F1FE}" },
21
+ { name: "Belgium", id: "BE", dialCode: "+32", maxLength: 9, flag: "\u{1F1E7}\u{1F1EA}" },
22
+ { name: "Bolivia", id: "BO", dialCode: "+591", maxLength: 8, flag: "\u{1F1E7}\u{1F1F4}" },
23
+ { name: "Bosnia and Herzegovina", id: "BA", dialCode: "+387", maxLength: 8, flag: "\u{1F1E7}\u{1F1E6}" },
24
+ { name: "Brazil", id: "BR", dialCode: "+55", maxLength: 11, flag: "\u{1F1E7}\u{1F1F7}" },
25
+ { name: "Bulgaria", id: "BG", dialCode: "+359", maxLength: 9, flag: "\u{1F1E7}\u{1F1EC}" },
26
+ { name: "Cambodia", id: "KH", dialCode: "+855", maxLength: 9, flag: "\u{1F1F0}\u{1F1ED}" },
27
+ { name: "Canada", id: "CA", dialCode: "+1", maxLength: 10, flag: "\u{1F1E8}\u{1F1E6}" },
28
+ { name: "Chile", id: "CL", dialCode: "+56", maxLength: 9, flag: "\u{1F1E8}\u{1F1F1}" },
29
+ { name: "China", id: "CN", dialCode: "+86", maxLength: 11, flag: "\u{1F1E8}\u{1F1F3}" },
30
+ { name: "Colombia", id: "CO", dialCode: "+57", maxLength: 10, flag: "\u{1F1E8}\u{1F1F4}" },
31
+ { name: "Costa Rica", id: "CR", dialCode: "+506", maxLength: 8, flag: "\u{1F1E8}\u{1F1F7}" },
32
+ { name: "Croatia", id: "HR", dialCode: "+385", maxLength: 9, flag: "\u{1F1ED}\u{1F1F7}" },
33
+ { name: "Cuba", id: "CU", dialCode: "+53", maxLength: 8, flag: "\u{1F1E8}\u{1F1FA}" },
34
+ { name: "Cyprus", id: "CY", dialCode: "+357", maxLength: 8, flag: "\u{1F1E8}\u{1F1FE}" },
35
+ { name: "Czech Republic", id: "CZ", dialCode: "+420", maxLength: 9, flag: "\u{1F1E8}\u{1F1FF}" },
36
+ { name: "Denmark", id: "DK", dialCode: "+45", maxLength: 8, flag: "\u{1F1E9}\u{1F1F0}" },
37
+ { name: "Ecuador", id: "EC", dialCode: "+593", maxLength: 9, flag: "\u{1F1EA}\u{1F1E8}" },
38
+ { name: "Egypt", id: "EG", dialCode: "+20", maxLength: 10, flag: "\u{1F1EA}\u{1F1EC}" },
39
+ { name: "Estonia", id: "EE", dialCode: "+372", maxLength: 8, flag: "\u{1F1EA}\u{1F1EA}" },
40
+ { name: "Ethiopia", id: "ET", dialCode: "+251", maxLength: 9, flag: "\u{1F1EA}\u{1F1F9}" },
41
+ { name: "Finland", id: "FI", dialCode: "+358", maxLength: 10, flag: "\u{1F1EB}\u{1F1EE}" },
42
+ { name: "France", id: "FR", dialCode: "+33", maxLength: 9, flag: "\u{1F1EB}\u{1F1F7}" },
43
+ { name: "Georgia", id: "GE", dialCode: "+995", maxLength: 9, flag: "\u{1F1EC}\u{1F1EA}" },
44
+ { name: "Germany", id: "DE", dialCode: "+49", maxLength: 11, flag: "\u{1F1E9}\u{1F1EA}" },
45
+ { name: "Ghana", id: "GH", dialCode: "+233", maxLength: 9, flag: "\u{1F1EC}\u{1F1ED}" },
46
+ { name: "Greece", id: "GR", dialCode: "+30", maxLength: 10, flag: "\u{1F1EC}\u{1F1F7}" },
47
+ { name: "Guatemala", id: "GT", dialCode: "+502", maxLength: 8, flag: "\u{1F1EC}\u{1F1F9}" },
48
+ { name: "Hong Kong", id: "HK", dialCode: "+852", maxLength: 8, flag: "\u{1F1ED}\u{1F1F0}" },
49
+ { name: "Hungary", id: "HU", dialCode: "+36", maxLength: 9, flag: "\u{1F1ED}\u{1F1FA}" },
50
+ { name: "Iceland", id: "IS", dialCode: "+354", maxLength: 7, flag: "\u{1F1EE}\u{1F1F8}" },
51
+ { name: "India", id: "IN", dialCode: "+91", maxLength: 10, flag: "\u{1F1EE}\u{1F1F3}" },
52
+ { name: "Indonesia", id: "ID", dialCode: "+62", maxLength: 12, flag: "\u{1F1EE}\u{1F1E9}" },
53
+ { name: "Iran", id: "IR", dialCode: "+98", maxLength: 10, flag: "\u{1F1EE}\u{1F1F7}" },
54
+ { name: "Iraq", id: "IQ", dialCode: "+964", maxLength: 10, flag: "\u{1F1EE}\u{1F1F6}" },
55
+ { name: "Ireland", id: "IE", dialCode: "+353", maxLength: 9, flag: "\u{1F1EE}\u{1F1EA}" },
56
+ { name: "Israel", id: "IL", dialCode: "+972", maxLength: 9, flag: "\u{1F1EE}\u{1F1F1}" },
57
+ { name: "Italy", id: "IT", dialCode: "+39", maxLength: 10, flag: "\u{1F1EE}\u{1F1F9}" },
58
+ { name: "Japan", id: "JP", dialCode: "+81", maxLength: 10, flag: "\u{1F1EF}\u{1F1F5}" },
59
+ { name: "Jordan", id: "JO", dialCode: "+962", maxLength: 9, flag: "\u{1F1EF}\u{1F1F4}" },
60
+ { name: "Kazakhstan", id: "KZ", dialCode: "+7", maxLength: 10, flag: "\u{1F1F0}\u{1F1FF}" },
61
+ { name: "Kenya", id: "KE", dialCode: "+254", maxLength: 9, flag: "\u{1F1F0}\u{1F1EA}" },
62
+ { name: "Kuwait", id: "KW", dialCode: "+965", maxLength: 8, flag: "\u{1F1F0}\u{1F1FC}" },
63
+ { name: "Latvia", id: "LV", dialCode: "+371", maxLength: 8, flag: "\u{1F1F1}\u{1F1FB}" },
64
+ { name: "Lebanon", id: "LB", dialCode: "+961", maxLength: 8, flag: "\u{1F1F1}\u{1F1E7}" },
65
+ { name: "Lithuania", id: "LT", dialCode: "+370", maxLength: 8, flag: "\u{1F1F1}\u{1F1F9}" },
66
+ { name: "Luxembourg", id: "LU", dialCode: "+352", maxLength: 9, flag: "\u{1F1F1}\u{1F1FA}" },
67
+ { name: "Macau", id: "MO", dialCode: "+853", maxLength: 8, flag: "\u{1F1F2}\u{1F1F4}" },
68
+ { name: "Malaysia", id: "MY", dialCode: "+60", maxLength: 10, flag: "\u{1F1F2}\u{1F1FE}" },
69
+ { name: "Mexico", id: "MX", dialCode: "+52", maxLength: 10, flag: "\u{1F1F2}\u{1F1FD}" },
70
+ { name: "Morocco", id: "MA", dialCode: "+212", maxLength: 9, flag: "\u{1F1F2}\u{1F1E6}" },
71
+ { name: "Myanmar", id: "MM", dialCode: "+95", maxLength: 9, flag: "\u{1F1F2}\u{1F1F2}" },
72
+ { name: "Nepal", id: "NP", dialCode: "+977", maxLength: 10, flag: "\u{1F1F3}\u{1F1F5}" },
73
+ { name: "Netherlands", id: "NL", dialCode: "+31", maxLength: 9, flag: "\u{1F1F3}\u{1F1F1}" },
74
+ { name: "New Zealand", id: "NZ", dialCode: "+64", maxLength: 9, flag: "\u{1F1F3}\u{1F1FF}" },
75
+ { name: "Nigeria", id: "NG", dialCode: "+234", maxLength: 10, flag: "\u{1F1F3}\u{1F1EC}" },
76
+ { name: "Norway", id: "NO", dialCode: "+47", maxLength: 8, flag: "\u{1F1F3}\u{1F1F4}" },
77
+ { name: "Oman", id: "OM", dialCode: "+968", maxLength: 8, flag: "\u{1F1F4}\u{1F1F2}" },
78
+ { name: "Pakistan", id: "PK", dialCode: "+92", maxLength: 10, flag: "\u{1F1F5}\u{1F1F0}" },
79
+ { name: "Panama", id: "PA", dialCode: "+507", maxLength: 8, flag: "\u{1F1F5}\u{1F1E6}" },
80
+ { name: "Paraguay", id: "PY", dialCode: "+595", maxLength: 9, flag: "\u{1F1F5}\u{1F1FE}" },
81
+ { name: "Peru", id: "PE", dialCode: "+51", maxLength: 9, flag: "\u{1F1F5}\u{1F1EA}" },
82
+ { name: "Philippines", id: "PH", dialCode: "+63", maxLength: 10, flag: "\u{1F1F5}\u{1F1ED}" },
83
+ { name: "Poland", id: "PL", dialCode: "+48", maxLength: 9, flag: "\u{1F1F5}\u{1F1F1}" },
84
+ { name: "Portugal", id: "PT", dialCode: "+351", maxLength: 9, flag: "\u{1F1F5}\u{1F1F9}" },
85
+ { name: "Qatar", id: "QA", dialCode: "+974", maxLength: 8, flag: "\u{1F1F6}\u{1F1E6}" },
86
+ { name: "Romania", id: "RO", dialCode: "+40", maxLength: 9, flag: "\u{1F1F7}\u{1F1F4}" },
87
+ { name: "Russia", id: "RU", dialCode: "+7", maxLength: 10, flag: "\u{1F1F7}\u{1F1FA}" },
88
+ { name: "Saudi Arabia", id: "SA", dialCode: "+966", maxLength: 9, flag: "\u{1F1F8}\u{1F1E6}" },
89
+ { name: "Serbia", id: "RS", dialCode: "+381", maxLength: 9, flag: "\u{1F1F7}\u{1F1F8}" },
90
+ { name: "Singapore", id: "SG", dialCode: "+65", maxLength: 8, flag: "\u{1F1F8}\u{1F1EC}" },
91
+ { name: "Slovakia", id: "SK", dialCode: "+421", maxLength: 9, flag: "\u{1F1F8}\u{1F1F0}" },
92
+ { name: "Slovenia", id: "SI", dialCode: "+386", maxLength: 8, flag: "\u{1F1F8}\u{1F1EE}" },
93
+ { name: "South Africa", id: "ZA", dialCode: "+27", maxLength: 9, flag: "\u{1F1FF}\u{1F1E6}" },
94
+ { name: "South Korea", id: "KR", dialCode: "+82", maxLength: 10, flag: "\u{1F1F0}\u{1F1F7}" },
95
+ { name: "Spain", id: "ES", dialCode: "+34", maxLength: 9, flag: "\u{1F1EA}\u{1F1F8}" },
96
+ { name: "Sri Lanka", id: "LK", dialCode: "+94", maxLength: 9, flag: "\u{1F1F1}\u{1F1F0}" },
97
+ { name: "Sweden", id: "SE", dialCode: "+46", maxLength: 9, flag: "\u{1F1F8}\u{1F1EA}" },
98
+ { name: "Switzerland", id: "CH", dialCode: "+41", maxLength: 9, flag: "\u{1F1E8}\u{1F1ED}" },
99
+ { name: "Syria", id: "SY", dialCode: "+963", maxLength: 9, flag: "\u{1F1F8}\u{1F1FE}" },
100
+ { name: "Taiwan", id: "TW", dialCode: "+886", maxLength: 9, flag: "\u{1F1F9}\u{1F1FC}" },
101
+ { name: "Thailand", id: "TH", dialCode: "+66", maxLength: 9, flag: "\u{1F1F9}\u{1F1ED}" },
102
+ { name: "Tunisia", id: "TN", dialCode: "+216", maxLength: 8, flag: "\u{1F1F9}\u{1F1F3}" },
103
+ { name: "Turkey", id: "TR", dialCode: "+90", maxLength: 10, flag: "\u{1F1F9}\u{1F1F7}" },
104
+ { name: "Ukraine", id: "UA", dialCode: "+380", maxLength: 9, flag: "\u{1F1FA}\u{1F1E6}" },
105
+ { name: "United Arab Emirates", id: "AE", dialCode: "+971", maxLength: 9, flag: "\u{1F1E6}\u{1F1EA}" },
106
+ { name: "United Kingdom", id: "GB", dialCode: "+44", maxLength: 10, flag: "\u{1F1EC}\u{1F1E7}" },
107
+ { name: "United States", id: "US", dialCode: "+1", maxLength: 10, flag: "\u{1F1FA}\u{1F1F8}" },
108
+ { name: "Uruguay", id: "UY", dialCode: "+598", maxLength: 8, flag: "\u{1F1FA}\u{1F1FE}" },
109
+ { name: "Uzbekistan", id: "UZ", dialCode: "+998", maxLength: 9, flag: "\u{1F1FA}\u{1F1FF}" },
110
+ { name: "Venezuela", id: "VE", dialCode: "+58", maxLength: 10, flag: "\u{1F1FB}\u{1F1EA}" },
111
+ { name: "Vietnam", id: "VN", dialCode: "+84", maxLength: 9, flag: "\u{1F1FB}\u{1F1F3}" },
112
+ { name: "Yemen", id: "YE", dialCode: "+967", maxLength: 9, flag: "\u{1F1FE}\u{1F1EA}" }
113
+ ];
114
+ var wrapperSizeClasses = {
115
+ xs: "h-6 text-xs",
116
+ sm: "h-8 text-sm",
117
+ md: "h-10 text-sm",
118
+ lg: "h-11 text-base",
119
+ xl: "h-12 text-lg"
120
+ };
121
+ var labelSizeClasses = {
122
+ xs: "text-xs",
123
+ sm: "text-xs",
124
+ md: "text-sm",
125
+ lg: "text-sm",
126
+ xl: "text-base"
127
+ };
128
+ var variantClasses = {
129
+ default: "rounded-md border border-border bg-surface shadow-sm focus-within:ring-2 focus-within:ring-primary/40 focus-within:border-primary transition-all duration-normal",
130
+ filled: "rounded-md border border-transparent bg-surface-secondary focus-within:bg-surface focus-within:ring-2 focus-within:ring-primary/40 focus-within:border-primary transition-all duration-normal",
131
+ flushed: "rounded-none border-0 border-b border-border bg-transparent focus-within:border-primary transition-all",
132
+ unstyled: "border-0 bg-transparent p-0"
133
+ };
134
+ var stateVariantClasses = {
135
+ default: {
136
+ default: "border-border focus-within:border-primary focus-within:ring-primary/40",
137
+ filled: "focus-within:border-primary focus-within:ring-primary/40",
138
+ flushed: "border-border focus-within:border-primary",
139
+ unstyled: ""
140
+ },
141
+ error: {
142
+ default: "border-error focus-within:border-error focus-within:ring-error/20",
143
+ filled: "bg-error/5 focus-within:border-error focus-within:ring-error/20",
144
+ flushed: "border-error focus-within:border-error",
145
+ unstyled: ""
146
+ },
147
+ success: {
148
+ default: "border-success focus-within:border-success focus-within:ring-success/20",
149
+ filled: "bg-success/5 focus-within:border-success focus-within:ring-success/20",
150
+ flushed: "border-success focus-within:border-success",
151
+ unstyled: ""
152
+ },
153
+ warning: {
154
+ default: "border-warning focus-within:border-warning focus-within:ring-warning/20",
155
+ filled: "bg-warning/5 border-warning focus-within:border-warning focus-within:ring-warning/20",
156
+ flushed: "border-warning focus-within:border-warning",
157
+ unstyled: ""
158
+ }
159
+ };
160
+ var stateMessageClasses = {
161
+ default: "text-text-muted",
162
+ error: "text-error",
163
+ success: "text-success",
164
+ warning: "text-warning"
165
+ };
166
+ var disabledClasses = "cursor-not-allowed opacity-50 bg-surface-secondary [&_*]:cursor-not-allowed";
167
+ function getStateMessage(state, errorMessage, successMessage, warningMessage) {
168
+ if (state === "error" && errorMessage) return errorMessage;
169
+ if (state === "success" && successMessage) return successMessage;
170
+ if (state === "warning" && warningMessage) return warningMessage;
171
+ return void 0;
172
+ }
173
+ var Phone = forwardRef(function Phone2({
174
+ label,
175
+ required = false,
176
+ helperText,
177
+ errorMessage,
178
+ successMessage,
179
+ warningMessage,
180
+ variant = "default",
181
+ size = "md",
182
+ state = "default",
183
+ fullWidth = true,
184
+ leftElement,
185
+ rightElement,
186
+ prefix,
187
+ suffix,
188
+ wrapperClassName,
189
+ inputGroupClassName,
190
+ inputClassName,
191
+ labelClassName,
192
+ helperClassName,
193
+ id: idProp,
194
+ disabled,
195
+ className,
196
+ clearable,
197
+ isLoading,
198
+ value,
199
+ defaultValue,
200
+ onChange,
201
+ showFlag = true,
202
+ defaultCountryCode = "+91",
203
+ autoComplete = "tel",
204
+ ...rest
205
+ }, ref) {
206
+ const generatedId = useId();
207
+ const inputId = idProp ?? generatedId;
208
+ const helperId = `${inputId}-helper`;
209
+ const stateMessageId = `${inputId}-state`;
210
+ const [internalError, setInternalError] = useState(null);
211
+ const [isOpen, setIsOpen] = useState(false);
212
+ const [searchTerm, setSearchTerm] = useState("");
213
+ const dropdownRef = useRef(null);
214
+ const [internalPhone, setInternalPhone] = useState(
215
+ defaultValue ?? { countryCode: defaultCountryCode, phoneNumber: "" }
216
+ );
217
+ const isControlled = value !== void 0;
218
+ const currentPhone = isControlled ? value : internalPhone;
219
+ const activeCountry = COUNTRIES.find((c) => c.dialCode === currentPhone.countryCode) ?? COUNTRIES[0];
220
+ const currentMaxLength = activeCountry?.maxLength ?? 15;
221
+ const showClear = clearable && currentPhone.phoneNumber.length > 0;
222
+ const hasLeftElement = leftElement !== void 0;
223
+ const hasRightElement = rightElement !== void 0 || Boolean(showClear) || Boolean(isLoading);
224
+ const mergedState = internalError ? "error" : state;
225
+ const mergedErrorMessage = internalError ?? errorMessage;
226
+ const stateMessage = getStateMessage(
227
+ mergedState,
228
+ mergedErrorMessage,
229
+ successMessage,
230
+ warningMessage
231
+ );
232
+ const describedBy = [helperText ? helperId : null, stateMessage ? stateMessageId : null].filter(Boolean).join(" ") || void 0;
233
+ const triggerChange = (newPhone) => {
234
+ if (!isControlled) {
235
+ setInternalPhone(newPhone);
236
+ }
237
+ if (onChange) {
238
+ onChange(newPhone);
239
+ }
240
+ };
241
+ const handleChange = (e) => {
242
+ const rawValue = e.target.value;
243
+ const numericValue = rawValue.replace(/\D/g, "");
244
+ if (numericValue !== rawValue) {
245
+ setInternalError("Only numbers are allowed");
246
+ } else {
247
+ setInternalError(null);
248
+ }
249
+ if (numericValue.length > currentMaxLength) {
250
+ return;
251
+ }
252
+ triggerChange({ ...currentPhone, phoneNumber: numericValue });
253
+ };
254
+ const handleClear = () => {
255
+ setInternalError(null);
256
+ triggerChange({ ...currentPhone, phoneNumber: "" });
257
+ };
258
+ useEffect(() => {
259
+ if (!isOpen) return;
260
+ const handleClickOutside = (e) => {
261
+ if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
262
+ setIsOpen(false);
263
+ }
264
+ };
265
+ document.addEventListener("mousedown", handleClickOutside);
266
+ return () => {
267
+ document.removeEventListener("mousedown", handleClickOutside);
268
+ };
269
+ }, [isOpen]);
270
+ const filteredCountries = COUNTRIES.filter(
271
+ (c) => c.name.toLowerCase().includes(searchTerm.toLowerCase()) || c.dialCode.includes(searchTerm)
272
+ );
273
+ const renderRightIcon = () => {
274
+ if (isLoading) {
275
+ return /* @__PURE__ */ jsxs(
276
+ "svg",
277
+ {
278
+ className: "animate-spin h-4 w-4 text-text-muted",
279
+ xmlns: "http://www.w3.org/2000/svg",
280
+ fill: "none",
281
+ viewBox: "0 0 24 24",
282
+ children: [
283
+ /* @__PURE__ */ jsx(
284
+ "circle",
285
+ {
286
+ className: "opacity-25",
287
+ cx: "12",
288
+ cy: "12",
289
+ r: "10",
290
+ stroke: "currentColor",
291
+ strokeWidth: "4"
292
+ }
293
+ ),
294
+ /* @__PURE__ */ jsx(
295
+ "path",
296
+ {
297
+ className: "opacity-75",
298
+ fill: "currentColor",
299
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
300
+ }
301
+ )
302
+ ]
303
+ }
304
+ );
305
+ }
306
+ if (showClear) {
307
+ return /* @__PURE__ */ jsx(
308
+ "button",
309
+ {
310
+ type: "button",
311
+ onClick: handleClear,
312
+ disabled,
313
+ className: "flex items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-hover p-0.5 transition-all duration-fast disabled:cursor-not-allowed",
314
+ "aria-label": "Clear input",
315
+ children: /* @__PURE__ */ jsx(XMarkIcon, { className: "w-4 h-4" })
316
+ }
317
+ );
318
+ }
319
+ return rightElement;
320
+ };
321
+ const leftRadiusClass = prefix !== void 0 || variant === "flushed" || variant === "unstyled" ? "" : "rounded-l-md";
322
+ return /* @__PURE__ */ jsxs(
323
+ "div",
324
+ {
325
+ className: cn(
326
+ "flex flex-col gap-1",
327
+ fullWidth ? "w-full" : "w-fit",
328
+ wrapperClassName,
329
+ className
330
+ ),
331
+ children: [
332
+ label !== void 0 && /* @__PURE__ */ jsxs(
333
+ "label",
334
+ {
335
+ htmlFor: inputId,
336
+ className: cn(
337
+ "font-black leading-none text-text mb-2 uppercase tracking-widest",
338
+ labelSizeClasses[size],
339
+ labelClassName
340
+ ),
341
+ children: [
342
+ label,
343
+ required && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "ml-1 text-error", children: "*" })
344
+ ]
345
+ }
346
+ ),
347
+ /* @__PURE__ */ jsxs(
348
+ "div",
349
+ {
350
+ className: cn("flex items-stretch", fullWidth ? "w-full" : "w-fit", inputGroupClassName),
351
+ children: [
352
+ prefix !== void 0 && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center rounded-l-md border border-r-0 border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none", children: prefix }),
353
+ /* @__PURE__ */ jsxs(
354
+ "div",
355
+ {
356
+ ref: dropdownRef,
357
+ className: cn(
358
+ "relative flex flex-1 items-stretch",
359
+ wrapperSizeClasses[size],
360
+ variantClasses[variant],
361
+ stateVariantClasses[mergedState][variant],
362
+ disabled ? disabledClasses : "",
363
+ prefix !== void 0 && suffix !== void 0 ? "rounded-none" : prefix !== void 0 ? "rounded-l-none" : suffix !== void 0 ? "rounded-r-none" : ""
364
+ ),
365
+ children: [
366
+ /* @__PURE__ */ jsxs(
367
+ "button",
368
+ {
369
+ type: "button",
370
+ onClick: () => {
371
+ setIsOpen(!isOpen);
372
+ },
373
+ disabled: Boolean(disabled) || Boolean(isLoading),
374
+ className: cn(
375
+ "relative flex items-center justify-center flex-shrink-0 px-2 sm:px-3 text-text bg-surface-secondary border-r border-border hover:bg-hover active:bg-active transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:z-10 disabled:cursor-not-allowed",
376
+ leftRadiusClass
377
+ ),
378
+ children: [
379
+ showFlag && activeCountry && /* @__PURE__ */ jsx("span", { className: "mr-1.5 text-base sm:text-lg opacity-90", children: activeCountry.flag }),
380
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: activeCountry?.dialCode ?? defaultCountryCode }),
381
+ /* @__PURE__ */ jsx(
382
+ ChevronDownIcon,
383
+ {
384
+ className: cn(
385
+ "w-3.5 h-3.5 ml-1.5 text-text-secondary transition-transform",
386
+ isOpen && "rotate-180"
387
+ )
388
+ }
389
+ )
390
+ ]
391
+ }
392
+ ),
393
+ isOpen && /* @__PURE__ */ jsxs("div", { className: "absolute top-full left-0 mt-1 w-64 rounded-md border border-border bg-surface p-1 shadow-lg z-dropdown flex flex-col animate-in fade-in zoom-in-95 duration-fast", children: [
394
+ /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 pb-2 sticky top-0 bg-surface z-10 border-b border-divider", children: /* @__PURE__ */ jsx(
395
+ "input",
396
+ {
397
+ type: "text",
398
+ placeholder: "Search country...",
399
+ className: "w-full text-sm bg-transparent px-1 focus:outline-none text-text placeholder:text-text-muted",
400
+ value: searchTerm,
401
+ onChange: (e) => {
402
+ setSearchTerm(e.target.value);
403
+ },
404
+ onKeyDown: (e) => {
405
+ e.stopPropagation();
406
+ }
407
+ }
408
+ ) }),
409
+ /* @__PURE__ */ jsx(
410
+ "ul",
411
+ {
412
+ role: "listbox",
413
+ className: "max-h-56 overflow-y-auto overflow-x-hidden p-1 scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent",
414
+ children: filteredCountries.length > 0 ? filteredCountries.map((c) => /* @__PURE__ */ jsxs(
415
+ "li",
416
+ {
417
+ role: "option",
418
+ tabIndex: 0,
419
+ "aria-selected": currentPhone.countryCode === c.dialCode,
420
+ className: cn(
421
+ "flex items-center px-2 py-1.5 text-sm rounded-sm cursor-pointer transition-colors outline-none focus:bg-hover active:bg-active",
422
+ currentPhone.countryCode === c.dialCode ? "bg-primary/10 text-primary font-medium" : "text-text"
423
+ ),
424
+ onKeyDown: (e) => {
425
+ if (e.key === "Enter" || e.key === " ") {
426
+ e.preventDefault();
427
+ triggerChange({ ...currentPhone, countryCode: c.dialCode });
428
+ setIsOpen(false);
429
+ setSearchTerm("");
430
+ }
431
+ },
432
+ onClick: () => {
433
+ triggerChange({ ...currentPhone, countryCode: c.dialCode });
434
+ setIsOpen(false);
435
+ setSearchTerm("");
436
+ },
437
+ children: [
438
+ /* @__PURE__ */ jsx("span", { className: "mr-2 text-base", children: c.flag }),
439
+ /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: c.name }),
440
+ /* @__PURE__ */ jsx(
441
+ "span",
442
+ {
443
+ className: cn(
444
+ "text-xs ml-2",
445
+ currentPhone.countryCode === c.dialCode ? "text-primary/70" : "text-text-muted"
446
+ ),
447
+ children: c.dialCode
448
+ }
449
+ )
450
+ ]
451
+ },
452
+ c.id
453
+ )) : /* @__PURE__ */ jsx("li", { className: "px-2 py-3 text-center text-sm text-text-muted", children: "No countries found" })
454
+ }
455
+ )
456
+ ] }),
457
+ hasLeftElement && /* @__PURE__ */ jsx("div", { className: "flex items-center pl-3", children: /* @__PURE__ */ jsx("span", { className: "text-text-secondary flex items-center justify-center", children: leftElement }) }),
458
+ /* @__PURE__ */ jsx(
459
+ "input",
460
+ {
461
+ ref,
462
+ ...rest,
463
+ id: inputId,
464
+ disabled: Boolean(disabled) || Boolean(isLoading),
465
+ type: "tel",
466
+ inputMode: "numeric",
467
+ value: currentPhone.phoneNumber,
468
+ onChange: handleChange,
469
+ autoComplete,
470
+ "aria-invalid": mergedState === "error" ? true : void 0,
471
+ "aria-describedby": describedBy,
472
+ "aria-required": required,
473
+ maxLength: currentMaxLength,
474
+ className: cn(
475
+ "flex-1 w-full bg-transparent border-none outline-none focus:ring-0 focus:outline-none focus:border-none focus-visible:ring-0 focus-visible:outline-none px-3 min-w-0 transition-colors duration-150 disabled:cursor-not-allowed",
476
+ inputClassName
477
+ )
478
+ }
479
+ ),
480
+ hasRightElement && /* @__PURE__ */ jsx("div", { className: "flex items-center pr-3", children: /* @__PURE__ */ jsx("span", { className: "text-text-secondary flex items-center justify-center", children: renderRightIcon() }) })
481
+ ]
482
+ }
483
+ ),
484
+ suffix !== void 0 && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center rounded-r-md border border-l-0 border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none", children: suffix })
485
+ ]
486
+ }
487
+ ),
488
+ helperText !== void 0 && /* @__PURE__ */ jsx("p", { id: helperId, className: cn("text-xs leading-tight text-text-muted", helperClassName), children: helperText }),
489
+ stateMessage !== void 0 && /* @__PURE__ */ jsx(
490
+ "p",
491
+ {
492
+ id: stateMessageId,
493
+ role: mergedState === "error" ? "alert" : void 0,
494
+ className: cn(
495
+ "text-xs leading-tight mt-1",
496
+ stateMessageClasses[mergedState],
497
+ helperClassName
498
+ ),
499
+ children: stateMessage
500
+ }
501
+ )
502
+ ]
503
+ }
504
+ );
505
+ });
506
+ Phone.displayName = "Phone";
507
+
508
+ export { Phone };