asta-ui 0.4.0 → 0.5.1

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 (285) hide show
  1. package/dist/base/checkbox-aui-052.d.ts +2 -0
  2. package/dist/base/checkbox-aui-052.js +9 -0
  3. package/dist/base/checkbox-aui-053.d.ts +2 -0
  4. package/dist/base/checkbox-aui-053.js +9 -0
  5. package/dist/base/checkbox-aui-054.d.ts +2 -0
  6. package/dist/base/checkbox-aui-054.js +9 -0
  7. package/dist/base/combobox-aui-046.d.ts +2 -0
  8. package/dist/base/combobox-aui-046.js +9 -0
  9. package/dist/base/combobox-aui-047.d.ts +2 -0
  10. package/dist/base/combobox-aui-047.js +9 -0
  11. package/dist/base/date-picker-aui-050.d.ts +2 -0
  12. package/dist/base/date-picker-aui-050.js +9 -0
  13. package/dist/base/date-picker-aui-051.d.ts +2 -0
  14. package/dist/base/date-picker-aui-051.js +9 -0
  15. package/dist/base/input-aui-029.d.ts +2 -0
  16. package/dist/base/input-aui-029.js +9 -0
  17. package/dist/base/input-aui-030.d.ts +2 -0
  18. package/dist/base/input-aui-030.js +9 -0
  19. package/dist/base/input-aui-031.d.ts +2 -0
  20. package/dist/base/input-aui-031.js +9 -0
  21. package/dist/base/input-aui-032.d.ts +2 -0
  22. package/dist/base/input-aui-032.js +11 -0
  23. package/dist/base/input-aui-033.d.ts +2 -0
  24. package/dist/base/input-aui-033.js +11 -0
  25. package/dist/base/input-aui-034.d.ts +2 -0
  26. package/dist/base/input-aui-034.js +9 -0
  27. package/dist/base/otp-input-aui-041.d.ts +2 -0
  28. package/dist/base/otp-input-aui-041.js +9 -0
  29. package/dist/base/otp-input-aui-042.d.ts +2 -0
  30. package/dist/base/otp-input-aui-042.js +9 -0
  31. package/dist/base/password-input-aui-039.d.ts +2 -0
  32. package/dist/base/password-input-aui-039.js +9 -0
  33. package/dist/base/password-input-aui-040.d.ts +2 -0
  34. package/dist/base/password-input-aui-040.js +11 -0
  35. package/dist/base/radio-group-aui-055.d.ts +2 -0
  36. package/dist/base/radio-group-aui-055.js +9 -0
  37. package/dist/base/radio-group-aui-056.d.ts +2 -0
  38. package/dist/base/radio-group-aui-056.js +9 -0
  39. package/dist/base/radio-group-aui-057.d.ts +2 -0
  40. package/dist/base/radio-group-aui-057.js +9 -0
  41. package/dist/base/select-aui-043.d.ts +2 -0
  42. package/dist/base/select-aui-043.js +9 -0
  43. package/dist/base/select-aui-044.d.ts +2 -0
  44. package/dist/base/select-aui-044.js +9 -0
  45. package/dist/base/select-aui-045.d.ts +2 -0
  46. package/dist/base/select-aui-045.js +9 -0
  47. package/dist/base/slider-aui-061.d.ts +2 -0
  48. package/dist/base/slider-aui-061.js +9 -0
  49. package/dist/base/slider-aui-062.d.ts +2 -0
  50. package/dist/base/slider-aui-062.js +9 -0
  51. package/dist/base/slider-aui-063.d.ts +2 -0
  52. package/dist/base/slider-aui-063.js +9 -0
  53. package/dist/base/switch-aui-058.d.ts +2 -0
  54. package/dist/base/switch-aui-058.js +9 -0
  55. package/dist/base/switch-aui-059.d.ts +2 -0
  56. package/dist/base/switch-aui-059.js +9 -0
  57. package/dist/base/switch-aui-060.d.ts +2 -0
  58. package/dist/base/switch-aui-060.js +9 -0
  59. package/dist/base/tag-input-aui-048.d.ts +2 -0
  60. package/dist/base/tag-input-aui-048.js +9 -0
  61. package/dist/base/tag-input-aui-049.d.ts +2 -0
  62. package/dist/base/tag-input-aui-049.js +9 -0
  63. package/dist/base/textarea-aui-035.d.ts +2 -0
  64. package/dist/base/textarea-aui-035.js +9 -0
  65. package/dist/base/textarea-aui-036.d.ts +2 -0
  66. package/dist/base/textarea-aui-036.js +9 -0
  67. package/dist/base/textarea-aui-037.d.ts +2 -0
  68. package/dist/base/textarea-aui-037.js +9 -0
  69. package/dist/base/textarea-aui-038.d.ts +2 -0
  70. package/dist/base/textarea-aui-038.js +11 -0
  71. package/dist/base.js +239 -21
  72. package/dist/checkbox-aui-052.d.ts +2 -0
  73. package/dist/checkbox-aui-052.js +9 -0
  74. package/dist/checkbox-aui-053.d.ts +2 -0
  75. package/dist/checkbox-aui-053.js +9 -0
  76. package/dist/checkbox-aui-054.d.ts +2 -0
  77. package/dist/checkbox-aui-054.js +9 -0
  78. package/dist/chunk-2LSUWI2Z.js +180 -0
  79. package/dist/chunk-3XMVXIOF.js +267 -0
  80. package/dist/chunk-4YNUJFTL.js +165 -0
  81. package/dist/chunk-5OHHGQV6.js +175 -0
  82. package/dist/chunk-5TMFFW3Y.js +149 -0
  83. package/dist/chunk-ANZANDQM.js +107 -0
  84. package/dist/chunk-BIYNJDPD.js +158 -0
  85. package/dist/chunk-BV5HEXB5.js +339 -0
  86. package/dist/chunk-CDQNLDO6.js +156 -0
  87. package/dist/chunk-CZCZB5YP.js +142 -0
  88. package/dist/chunk-D6LGKFZH.js +140 -0
  89. package/dist/chunk-EKPTPTKK.js +93 -0
  90. package/dist/chunk-EVCUN45S.js +167 -0
  91. package/dist/chunk-FGQPCDXI.js +136 -0
  92. package/dist/chunk-GERWW3CA.js +311 -0
  93. package/dist/chunk-GJ3R6IZL.js +232 -0
  94. package/dist/chunk-HVFB44HO.js +219 -0
  95. package/dist/chunk-I2WXKWTQ.js +151 -0
  96. package/dist/chunk-J6GK2V2C.js +252 -0
  97. package/dist/chunk-JVTDNOHQ.js +173 -0
  98. package/dist/chunk-K5PWBSVO.js +200 -0
  99. package/dist/chunk-KQCXQY5K.js +155 -0
  100. package/dist/chunk-KXWC2UHE.js +308 -0
  101. package/dist/chunk-NICNFGHT.js +138 -0
  102. package/dist/chunk-P3USWDWR.js +331 -0
  103. package/dist/chunk-QYI7LQBQ.js +208 -0
  104. package/dist/chunk-U6N7CZYN.js +305 -0
  105. package/dist/chunk-UMDVPRJW.js +117 -0
  106. package/dist/chunk-VPZP6TCT.js +155 -0
  107. package/dist/chunk-VVAL2JZJ.js +332 -0
  108. package/dist/chunk-VWYHP4SB.js +154 -0
  109. package/dist/chunk-W7RITVDV.js +182 -0
  110. package/dist/chunk-WSTQ6WZO.js +193 -0
  111. package/dist/chunk-Z5GNX2S3.js +171 -0
  112. package/dist/chunk-ZBF2UYXP.js +225 -0
  113. package/dist/combobox-aui-046.d.ts +2 -0
  114. package/dist/combobox-aui-046.js +9 -0
  115. package/dist/combobox-aui-047.d.ts +2 -0
  116. package/dist/combobox-aui-047.js +9 -0
  117. package/dist/date-picker-aui-050.d.ts +2 -0
  118. package/dist/date-picker-aui-050.js +9 -0
  119. package/dist/date-picker-aui-051.d.ts +2 -0
  120. package/dist/date-picker-aui-051.js +9 -0
  121. package/dist/index.js +239 -21
  122. package/dist/input-aui-029.d.ts +2 -0
  123. package/dist/input-aui-029.js +9 -0
  124. package/dist/input-aui-030.d.ts +2 -0
  125. package/dist/input-aui-030.js +9 -0
  126. package/dist/input-aui-031.d.ts +2 -0
  127. package/dist/input-aui-031.js +9 -0
  128. package/dist/input-aui-032.d.ts +2 -0
  129. package/dist/input-aui-032.js +11 -0
  130. package/dist/input-aui-033.d.ts +2 -0
  131. package/dist/input-aui-033.js +11 -0
  132. package/dist/input-aui-034.d.ts +2 -0
  133. package/dist/input-aui-034.js +9 -0
  134. package/dist/otp-input-aui-041.d.ts +2 -0
  135. package/dist/otp-input-aui-041.js +9 -0
  136. package/dist/otp-input-aui-042.d.ts +2 -0
  137. package/dist/otp-input-aui-042.js +9 -0
  138. package/dist/password-input-aui-039.d.ts +2 -0
  139. package/dist/password-input-aui-039.js +9 -0
  140. package/dist/password-input-aui-040.d.ts +2 -0
  141. package/dist/password-input-aui-040.js +11 -0
  142. package/dist/radio-group-aui-055.d.ts +2 -0
  143. package/dist/radio-group-aui-055.js +9 -0
  144. package/dist/radio-group-aui-056.d.ts +2 -0
  145. package/dist/radio-group-aui-056.js +9 -0
  146. package/dist/radio-group-aui-057.d.ts +2 -0
  147. package/dist/radio-group-aui-057.js +9 -0
  148. package/dist/select-aui-043.d.ts +2 -0
  149. package/dist/select-aui-043.js +9 -0
  150. package/dist/select-aui-044.d.ts +2 -0
  151. package/dist/select-aui-044.js +9 -0
  152. package/dist/select-aui-045.d.ts +2 -0
  153. package/dist/select-aui-045.js +9 -0
  154. package/dist/slider-aui-061.d.ts +2 -0
  155. package/dist/slider-aui-061.js +9 -0
  156. package/dist/slider-aui-062.d.ts +2 -0
  157. package/dist/slider-aui-062.js +9 -0
  158. package/dist/slider-aui-063.d.ts +2 -0
  159. package/dist/slider-aui-063.js +9 -0
  160. package/dist/switch-aui-058.d.ts +2 -0
  161. package/dist/switch-aui-058.js +9 -0
  162. package/dist/switch-aui-059.d.ts +2 -0
  163. package/dist/switch-aui-059.js +9 -0
  164. package/dist/switch-aui-060.d.ts +2 -0
  165. package/dist/switch-aui-060.js +9 -0
  166. package/dist/tag-input-aui-048.d.ts +2 -0
  167. package/dist/tag-input-aui-048.js +9 -0
  168. package/dist/tag-input-aui-049.d.ts +2 -0
  169. package/dist/tag-input-aui-049.js +9 -0
  170. package/dist/textarea-aui-035.d.ts +2 -0
  171. package/dist/textarea-aui-035.js +9 -0
  172. package/dist/textarea-aui-036.d.ts +2 -0
  173. package/dist/textarea-aui-036.js +9 -0
  174. package/dist/textarea-aui-037.d.ts +2 -0
  175. package/dist/textarea-aui-037.js +9 -0
  176. package/dist/textarea-aui-038.d.ts +2 -0
  177. package/dist/textarea-aui-038.js +11 -0
  178. package/dist/types/components/kit/variants/checkbox-aui-052.d.ts +29 -0
  179. package/dist/types/components/kit/variants/checkbox-aui-053.d.ts +24 -0
  180. package/dist/types/components/kit/variants/checkbox-aui-054.d.ts +33 -0
  181. package/dist/types/components/kit/variants/combobox-aui-046.d.ts +23 -0
  182. package/dist/types/components/kit/variants/combobox-aui-047.d.ts +24 -0
  183. package/dist/types/components/kit/variants/date-picker-aui-050.d.ts +26 -0
  184. package/dist/types/components/kit/variants/date-picker-aui-051.d.ts +23 -0
  185. package/dist/types/components/kit/variants/input-aui-029.d.ts +21 -0
  186. package/dist/types/components/kit/variants/input-aui-030.d.ts +29 -0
  187. package/dist/types/components/kit/variants/input-aui-031.d.ts +24 -0
  188. package/dist/types/components/kit/variants/input-aui-032.d.ts +36 -0
  189. package/dist/types/components/kit/variants/input-aui-033.d.ts +23 -0
  190. package/dist/types/components/kit/variants/input-aui-034.d.ts +29 -0
  191. package/dist/types/components/kit/variants/otp-input-aui-041.d.ts +20 -0
  192. package/dist/types/components/kit/variants/otp-input-aui-042.d.ts +23 -0
  193. package/dist/types/components/kit/variants/password-input-aui-039.d.ts +16 -0
  194. package/dist/types/components/kit/variants/password-input-aui-040.d.ts +24 -0
  195. package/dist/types/components/kit/variants/radio-group-aui-055.d.ts +27 -0
  196. package/dist/types/components/kit/variants/radio-group-aui-056.d.ts +28 -0
  197. package/dist/types/components/kit/variants/radio-group-aui-057.d.ts +26 -0
  198. package/dist/types/components/kit/variants/select-aui-043.d.ts +29 -0
  199. package/dist/types/components/kit/variants/select-aui-044.d.ts +24 -0
  200. package/dist/types/components/kit/variants/select-aui-045.d.ts +29 -0
  201. package/dist/types/components/kit/variants/slider-aui-061.d.ts +20 -0
  202. package/dist/types/components/kit/variants/slider-aui-062.d.ts +24 -0
  203. package/dist/types/components/kit/variants/slider-aui-063.d.ts +17 -0
  204. package/dist/types/components/kit/variants/switch-aui-058.d.ts +24 -0
  205. package/dist/types/components/kit/variants/switch-aui-059.d.ts +20 -0
  206. package/dist/types/components/kit/variants/switch-aui-060.d.ts +15 -0
  207. package/dist/types/components/kit/variants/tag-input-aui-048.d.ts +16 -0
  208. package/dist/types/components/kit/variants/tag-input-aui-049.d.ts +15 -0
  209. package/dist/types/components/kit/variants/textarea-aui-035.d.ts +19 -0
  210. package/dist/types/components/kit/variants/textarea-aui-036.d.ts +23 -0
  211. package/dist/types/components/kit/variants/textarea-aui-037.d.ts +30 -0
  212. package/dist/types/components/kit/variants/textarea-aui-038.d.ts +28 -0
  213. package/dist/types/packages/asta-ui/src/base/checkbox-aui-052.d.ts +2 -0
  214. package/dist/types/packages/asta-ui/src/base/checkbox-aui-053.d.ts +2 -0
  215. package/dist/types/packages/asta-ui/src/base/checkbox-aui-054.d.ts +2 -0
  216. package/dist/types/packages/asta-ui/src/base/combobox-aui-046.d.ts +2 -0
  217. package/dist/types/packages/asta-ui/src/base/combobox-aui-047.d.ts +2 -0
  218. package/dist/types/packages/asta-ui/src/base/date-picker-aui-050.d.ts +2 -0
  219. package/dist/types/packages/asta-ui/src/base/date-picker-aui-051.d.ts +2 -0
  220. package/dist/types/packages/asta-ui/src/base/input-aui-029.d.ts +2 -0
  221. package/dist/types/packages/asta-ui/src/base/input-aui-030.d.ts +2 -0
  222. package/dist/types/packages/asta-ui/src/base/input-aui-031.d.ts +2 -0
  223. package/dist/types/packages/asta-ui/src/base/input-aui-032.d.ts +2 -0
  224. package/dist/types/packages/asta-ui/src/base/input-aui-033.d.ts +2 -0
  225. package/dist/types/packages/asta-ui/src/base/input-aui-034.d.ts +2 -0
  226. package/dist/types/packages/asta-ui/src/base/otp-input-aui-041.d.ts +2 -0
  227. package/dist/types/packages/asta-ui/src/base/otp-input-aui-042.d.ts +2 -0
  228. package/dist/types/packages/asta-ui/src/base/password-input-aui-039.d.ts +2 -0
  229. package/dist/types/packages/asta-ui/src/base/password-input-aui-040.d.ts +2 -0
  230. package/dist/types/packages/asta-ui/src/base/radio-group-aui-055.d.ts +2 -0
  231. package/dist/types/packages/asta-ui/src/base/radio-group-aui-056.d.ts +2 -0
  232. package/dist/types/packages/asta-ui/src/base/radio-group-aui-057.d.ts +2 -0
  233. package/dist/types/packages/asta-ui/src/base/select-aui-043.d.ts +2 -0
  234. package/dist/types/packages/asta-ui/src/base/select-aui-044.d.ts +2 -0
  235. package/dist/types/packages/asta-ui/src/base/select-aui-045.d.ts +2 -0
  236. package/dist/types/packages/asta-ui/src/base/slider-aui-061.d.ts +2 -0
  237. package/dist/types/packages/asta-ui/src/base/slider-aui-062.d.ts +2 -0
  238. package/dist/types/packages/asta-ui/src/base/slider-aui-063.d.ts +2 -0
  239. package/dist/types/packages/asta-ui/src/base/switch-aui-058.d.ts +2 -0
  240. package/dist/types/packages/asta-ui/src/base/switch-aui-059.d.ts +2 -0
  241. package/dist/types/packages/asta-ui/src/base/switch-aui-060.d.ts +2 -0
  242. package/dist/types/packages/asta-ui/src/base/tag-input-aui-048.d.ts +2 -0
  243. package/dist/types/packages/asta-ui/src/base/tag-input-aui-049.d.ts +2 -0
  244. package/dist/types/packages/asta-ui/src/base/textarea-aui-035.d.ts +2 -0
  245. package/dist/types/packages/asta-ui/src/base/textarea-aui-036.d.ts +2 -0
  246. package/dist/types/packages/asta-ui/src/base/textarea-aui-037.d.ts +2 -0
  247. package/dist/types/packages/asta-ui/src/base/textarea-aui-038.d.ts +2 -0
  248. package/dist/types/packages/asta-ui/src/base.d.ts +70 -0
  249. package/dist/types/packages/asta-ui/src/checkbox-aui-052.d.ts +2 -0
  250. package/dist/types/packages/asta-ui/src/checkbox-aui-053.d.ts +2 -0
  251. package/dist/types/packages/asta-ui/src/checkbox-aui-054.d.ts +2 -0
  252. package/dist/types/packages/asta-ui/src/combobox-aui-046.d.ts +2 -0
  253. package/dist/types/packages/asta-ui/src/combobox-aui-047.d.ts +2 -0
  254. package/dist/types/packages/asta-ui/src/date-picker-aui-050.d.ts +2 -0
  255. package/dist/types/packages/asta-ui/src/date-picker-aui-051.d.ts +2 -0
  256. package/dist/types/packages/asta-ui/src/index.d.ts +70 -0
  257. package/dist/types/packages/asta-ui/src/input-aui-029.d.ts +2 -0
  258. package/dist/types/packages/asta-ui/src/input-aui-030.d.ts +2 -0
  259. package/dist/types/packages/asta-ui/src/input-aui-031.d.ts +2 -0
  260. package/dist/types/packages/asta-ui/src/input-aui-032.d.ts +2 -0
  261. package/dist/types/packages/asta-ui/src/input-aui-033.d.ts +2 -0
  262. package/dist/types/packages/asta-ui/src/input-aui-034.d.ts +2 -0
  263. package/dist/types/packages/asta-ui/src/otp-input-aui-041.d.ts +2 -0
  264. package/dist/types/packages/asta-ui/src/otp-input-aui-042.d.ts +2 -0
  265. package/dist/types/packages/asta-ui/src/password-input-aui-039.d.ts +2 -0
  266. package/dist/types/packages/asta-ui/src/password-input-aui-040.d.ts +2 -0
  267. package/dist/types/packages/asta-ui/src/radio-group-aui-055.d.ts +2 -0
  268. package/dist/types/packages/asta-ui/src/radio-group-aui-056.d.ts +2 -0
  269. package/dist/types/packages/asta-ui/src/radio-group-aui-057.d.ts +2 -0
  270. package/dist/types/packages/asta-ui/src/select-aui-043.d.ts +2 -0
  271. package/dist/types/packages/asta-ui/src/select-aui-044.d.ts +2 -0
  272. package/dist/types/packages/asta-ui/src/select-aui-045.d.ts +2 -0
  273. package/dist/types/packages/asta-ui/src/slider-aui-061.d.ts +2 -0
  274. package/dist/types/packages/asta-ui/src/slider-aui-062.d.ts +2 -0
  275. package/dist/types/packages/asta-ui/src/slider-aui-063.d.ts +2 -0
  276. package/dist/types/packages/asta-ui/src/switch-aui-058.d.ts +2 -0
  277. package/dist/types/packages/asta-ui/src/switch-aui-059.d.ts +2 -0
  278. package/dist/types/packages/asta-ui/src/switch-aui-060.d.ts +2 -0
  279. package/dist/types/packages/asta-ui/src/tag-input-aui-048.d.ts +2 -0
  280. package/dist/types/packages/asta-ui/src/tag-input-aui-049.d.ts +2 -0
  281. package/dist/types/packages/asta-ui/src/textarea-aui-035.d.ts +2 -0
  282. package/dist/types/packages/asta-ui/src/textarea-aui-036.d.ts +2 -0
  283. package/dist/types/packages/asta-ui/src/textarea-aui-037.d.ts +2 -0
  284. package/dist/types/packages/asta-ui/src/textarea-aui-038.d.ts +2 -0
  285. package/package.json +1 -1
@@ -0,0 +1,219 @@
1
+ "use client";
2
+
3
+ // components/kit/variants/select-aui-043.tsx
4
+ import { useEffect, useId, useRef, useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ var cx = (...c) => c.filter(Boolean).join(" ");
7
+ var EASE = "cubic-bezier(.16,1,.3,1)";
8
+ var ROW = 48;
9
+ var CSS = `
10
+ @keyframes aui043-pop { from { opacity: 0; transform: translateY(var(--aui043-y, -6px)) scale(.97) } }
11
+ @keyframes aui043-row { from { opacity: 0; transform: translateY(6px) } }
12
+ @keyframes aui043-draw { from { stroke-dashoffset: 16 } }
13
+ @media (prefers-reduced-motion: reduce) { .aui043 *, .aui043 { animation: none !important; transition: none !important } }
14
+ `;
15
+ var icon = (d) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d }) });
16
+ var ROLES = [
17
+ { value: "owner", label: "Owner", description: "Billing, members and every project", icon: icon("M2.5 11.5 4 5l3 3 1-4 1 4 3-3 1.5 6.5ZM3 13.5h10"), meta: "1 seat" },
18
+ { value: "admin", label: "Admin", description: "Manage members and settings", icon: icon("M8 1.8 13 4v4c0 3-2.2 5.2-5 6.2C5.2 13.2 3 11 3 8V4Z M5.8 8l1.6 1.6L10.5 6.5") },
19
+ { value: "editor", label: "Editor", description: "Create and publish in any project", icon: icon("m10.5 2.5 3 3L6 13H3v-3Z M9 4l3 3") },
20
+ { value: "viewer", label: "Viewer", description: "Read and comment, no edits", icon: icon("M1.8 8S4 3.5 8 3.5 14.2 8 14.2 8 12 12.5 8 12.5 1.8 8 1.8 8Z M8 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z") }
21
+ ];
22
+ function roomBelow(el, need) {
23
+ const r = el.getBoundingClientRect();
24
+ let top = 0;
25
+ let bottom = window.innerHeight;
26
+ for (let p = el.parentElement; p && p !== document.body; p = p.parentElement) {
27
+ if (/hidden|auto|scroll|clip/.test(getComputedStyle(p).overflowY)) {
28
+ const c = p.getBoundingClientRect();
29
+ top = c.top;
30
+ bottom = c.bottom;
31
+ break;
32
+ }
33
+ }
34
+ const below = bottom - r.bottom;
35
+ return below >= need || below >= r.top - top;
36
+ }
37
+ function Tile({ o, on, big }) {
38
+ return /* @__PURE__ */ jsx(
39
+ "span",
40
+ {
41
+ "aria-hidden": true,
42
+ className: cx(
43
+ "flex shrink-0 items-center justify-center rounded-[9px] text-[12px] font-semibold tracking-[-0.01em] transition-colors duration-300 [&_svg]:h-[17px] [&_svg]:w-[17px]",
44
+ big ? "h-9 w-9" : "h-8 w-8",
45
+ on ? "bg-brand text-white shadow-[0_6px_14px_-6px_color-mix(in_srgb,var(--brand)_80%,transparent)]" : "bg-paper-2 text-ink shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_7%,transparent)]"
46
+ ),
47
+ children: o?.icon ?? o?.initials ?? o?.label.slice(0, 1)
48
+ }
49
+ );
50
+ }
51
+ function RichSelect({ options = ROLES, value, defaultValue, onChange, label = "Role", defaultOpen = false, name, disabled, className }) {
52
+ const [inner, setInner] = useState(defaultValue ?? options[2]?.value ?? options[0]?.value);
53
+ const current = value ?? inner;
54
+ const picked = Math.max(0, options.findIndex((o) => o.value === current));
55
+ const sel = options[picked];
56
+ const [open, setOpen] = useState(defaultOpen);
57
+ const [down, setDown] = useState(true);
58
+ const [active, setActive] = useState(picked);
59
+ const root = useRef(null);
60
+ const btn = useRef(null);
61
+ const list = useRef(null);
62
+ const wantFocus = useRef(false);
63
+ const buf = useRef("");
64
+ const bufT = useRef(void 0);
65
+ const uid = useId();
66
+ useEffect(() => () => clearTimeout(bufT.current), []);
67
+ useEffect(() => {
68
+ if (open && wantFocus.current) list.current?.focus({ preventScroll: true });
69
+ }, [open]);
70
+ useEffect(() => {
71
+ if (!open) return;
72
+ const onDown = (e) => {
73
+ if (!root.current?.contains(e.target)) setOpen(false);
74
+ };
75
+ document.addEventListener("pointerdown", onDown);
76
+ return () => document.removeEventListener("pointerdown", onDown);
77
+ }, [open]);
78
+ const show = () => {
79
+ if (disabled || !btn.current) return;
80
+ setDown(roomBelow(btn.current, options.length * ROW + 20));
81
+ setActive(picked);
82
+ wantFocus.current = true;
83
+ setOpen(true);
84
+ };
85
+ const close = (refocus = true) => {
86
+ setOpen(false);
87
+ if (refocus) btn.current?.focus({ preventScroll: true });
88
+ };
89
+ const pick = (i) => {
90
+ const o = options[i];
91
+ if (!o || o.disabled) return;
92
+ if (value === void 0) setInner(o.value);
93
+ onChange?.(o.value);
94
+ close();
95
+ };
96
+ const step = (from, d) => {
97
+ let n = from;
98
+ for (let k = 0; k < options.length; k++) {
99
+ n = (n + d + options.length) % options.length;
100
+ if (!options[n].disabled) return n;
101
+ }
102
+ return from;
103
+ };
104
+ const onListKey = (e) => {
105
+ if (e.key === "ArrowDown") setActive((a) => step(a, 1));
106
+ else if (e.key === "ArrowUp") setActive((a) => step(a, -1));
107
+ else if (e.key === "Home") setActive(step(-1, 1));
108
+ else if (e.key === "End") setActive(step(options.length, -1));
109
+ else if (e.key === "Enter" || e.key === " ") pick(active);
110
+ else if (e.key === "Escape") close();
111
+ else if (e.key === "Tab") return setOpen(false);
112
+ else if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {
113
+ buf.current += e.key.toLowerCase();
114
+ clearTimeout(bufT.current);
115
+ bufT.current = setTimeout(() => buf.current = "", 500);
116
+ const s = buf.current;
117
+ const start = s.length === 1 ? active + 1 : active;
118
+ for (let k = 0; k < options.length; k++) {
119
+ const i = (start + k) % options.length;
120
+ if (!options[i].disabled && options[i].label.toLowerCase().startsWith(s)) {
121
+ setActive(i);
122
+ break;
123
+ }
124
+ }
125
+ } else return;
126
+ e.preventDefault();
127
+ };
128
+ const glide = (i) => ({ height: ROW, transform: `translateY(${i * ROW}px)`, transition: `transform .42s ${EASE}` });
129
+ return /* @__PURE__ */ jsxs("div", { ref: root, className: cx("aui043 relative w-full", open && "z-40", className), children: [
130
+ /* @__PURE__ */ jsx("style", { href: "asta-aui043", precedence: "asta", children: CSS }),
131
+ /* @__PURE__ */ jsxs(
132
+ "button",
133
+ {
134
+ ref: btn,
135
+ type: "button",
136
+ disabled,
137
+ "aria-haspopup": "listbox",
138
+ "aria-expanded": open,
139
+ "aria-controls": open ? `${uid}-list` : void 0,
140
+ "aria-label": `${label}: ${sel?.label ?? ""}`,
141
+ onClick: () => open ? close(false) : show(),
142
+ onKeyDown: (e) => {
143
+ if (!open && ["ArrowDown", "ArrowUp", "Enter", " "].includes(e.key)) {
144
+ e.preventDefault();
145
+ show();
146
+ }
147
+ },
148
+ className: cx(
149
+ "group flex h-[60px] w-full items-center gap-3 rounded-[11px] bg-paper pl-3 pr-3.5 text-left outline-none transition-[box-shadow,transform] duration-300 active:scale-[.995] disabled:cursor-not-allowed disabled:opacity-45",
150
+ "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_12%,transparent),0_1px_2px_rgb(0_0_0/0.04)] hover:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_22%,transparent),0_1px_2px_rgb(0_0_0/0.04)]",
151
+ "focus-visible:shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_14%,transparent)]",
152
+ open && "!shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_14%,transparent)]"
153
+ ),
154
+ children: [
155
+ /* @__PURE__ */ jsx(Tile, { o: sel, big: true }),
156
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", style: { animation: `aui043-row .45s ${EASE} both` }, children: [
157
+ /* @__PURE__ */ jsx("span", { className: "block truncate text-[14px] font-medium tracking-[-0.01em] text-ink", children: sel?.label }),
158
+ /* @__PURE__ */ jsx("span", { className: "block truncate text-[12.5px] text-mute", children: sel?.description })
159
+ ] }, sel?.value),
160
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-4 w-4 shrink-0 text-mute transition-colors group-hover:text-ink", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m5 6.2 3-3 3 3M5 9.8l3 3 3-3" }) })
161
+ ]
162
+ }
163
+ ),
164
+ name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: current ?? "" }),
165
+ open && /* @__PURE__ */ jsxs(
166
+ "ul",
167
+ {
168
+ ref: list,
169
+ id: `${uid}-list`,
170
+ role: "listbox",
171
+ tabIndex: -1,
172
+ "aria-label": label,
173
+ "aria-activedescendant": `${uid}-o-${active}`,
174
+ onKeyDown: onListKey,
175
+ onBlur: (e) => !root.current?.contains(e.relatedTarget) && setOpen(false),
176
+ className: cx(
177
+ "absolute inset-x-0 z-50 rounded-[13px] bg-paper p-1.5 outline-none",
178
+ "shadow-[0_0_0_1px_color-mix(in_srgb,var(--ink)_9%,transparent),0_22px_48px_-16px_rgb(0_0_0/0.3),0_4px_10px_-4px_rgb(0_0_0/0.08)]",
179
+ down ? "top-full mt-2 origin-top" : "bottom-full mb-2 origin-bottom [--aui043-y:6px]"
180
+ ),
181
+ style: { animation: `aui043-pop .32s ${EASE} both` },
182
+ children: [
183
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-1.5 top-1.5 rounded-[9px] bg-paper-2", style: glide(active) }),
184
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute right-4 top-1.5 z-10 flex items-center", style: glide(picked), children: /* @__PURE__ */ jsx("span", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-brand text-white shadow-[0_4px_10px_-4px_color-mix(in_srgb,var(--brand)_80%,transparent)]", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: "16", style: { animation: `aui043-draw .5s ${EASE} .15s both` }, children: /* @__PURE__ */ jsx("path", { d: "m4 8.5 2.6 2.5L12 5.5" }) }, current) }) }),
185
+ options.map((o, i) => /* @__PURE__ */ jsxs(
186
+ "li",
187
+ {
188
+ id: `${uid}-o-${i}`,
189
+ role: "option",
190
+ "aria-selected": i === picked,
191
+ "aria-disabled": o.disabled || void 0,
192
+ onPointerMove: () => !o.disabled && active !== i && setActive(i),
193
+ onClick: () => pick(i),
194
+ className: cx("relative flex cursor-pointer select-none items-center gap-3 rounded-[9px] pl-2.5 pr-12", o.disabled && "cursor-not-allowed opacity-40"),
195
+ style: { height: ROW, animation: `aui043-row .45s ${EASE} ${60 + i * 40}ms both` },
196
+ children: [
197
+ /* @__PURE__ */ jsx(Tile, { o, on: i === picked }),
198
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
199
+ /* @__PURE__ */ jsxs("span", { className: "flex items-baseline gap-2", children: [
200
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[13.5px] font-medium tracking-[-0.01em] text-ink", children: o.label }),
201
+ o.meta && /* @__PURE__ */ jsx("span", { className: "shrink-0 font-mono text-[10.5px] uppercase tracking-[0.06em] text-mute", children: o.meta })
202
+ ] }),
203
+ o.description && /* @__PURE__ */ jsx("span", { className: "block truncate text-[12px] text-mute", children: o.description })
204
+ ] })
205
+ ]
206
+ },
207
+ o.value
208
+ ))
209
+ ]
210
+ }
211
+ )
212
+ ] });
213
+ }
214
+ var select_aui_043_default = RichSelect;
215
+
216
+ export {
217
+ RichSelect,
218
+ select_aui_043_default
219
+ };
@@ -0,0 +1,151 @@
1
+ "use client";
2
+
3
+ // components/kit/variants/password-input-aui-040.tsx
4
+ import { useId, useState } from "react";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ var cx = (...c) => c.filter(Boolean).join(" ");
7
+ var EASE = "cubic-bezier(.16,1,.3,1)";
8
+ var CSS = `
9
+ @keyframes aui040-rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
10
+ @keyframes aui040-tick { 0% { opacity: 0; transform: scale(.3) } 60% { opacity: 1; transform: scale(1.15) } 100% { opacity: 1; transform: none } }
11
+ @keyframes aui040-num { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
12
+ @media (prefers-reduced-motion: reduce) { .aui040 * { animation: none !important; transition: none !important } }
13
+ `;
14
+ var rise = (i) => ({ animation: `aui040-rise .6s ${EASE} ${i * 55}ms both` });
15
+ var CHECKLIST_RULES = [
16
+ { glyph: "8+", label: "characters", test: (v) => v.length >= 8 },
17
+ { glyph: "Aa", label: "both cases", test: (v) => /[a-z]/.test(v) && /[A-Z]/.test(v) },
18
+ { glyph: "123", label: "a number", test: (v) => /\d/.test(v) },
19
+ { glyph: "#!", label: "a symbol", test: (v) => /[^A-Za-z0-9]/.test(v) }
20
+ ];
21
+ function Eye({ open }) {
22
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 20 20", className: "h-[18px] w-[18px]", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
23
+ /* @__PURE__ */ jsx("path", { d: "M2.5 10s2.7-5 7.5-5 7.5 5 7.5 5-2.7 5-7.5 5-7.5-5-7.5-5Z" }),
24
+ /* @__PURE__ */ jsx("circle", { cx: "10", cy: "10", r: "2.2", className: "origin-center transition-transform duration-300 [transform-box:fill-box]", style: { transform: open ? "none" : "scale(0)", transitionTimingFunction: EASE } }),
25
+ /* @__PURE__ */ jsx("path", { d: "M4 16 16 4", className: "origin-center transition-[opacity,transform] duration-300 [transform-box:fill-box]", style: { opacity: open ? 0 : 1, transform: open ? "scale(.4)" : "none", transitionTimingFunction: EASE } })
26
+ ] });
27
+ }
28
+ function ChecklistPassword({
29
+ value,
30
+ defaultValue = "",
31
+ onChange,
32
+ rules = CHECKLIST_RULES,
33
+ confirm = true,
34
+ label = "New password",
35
+ name,
36
+ className
37
+ }) {
38
+ const id = useId();
39
+ const [inner, setInner] = useState(defaultValue);
40
+ const [again, setAgain] = useState("");
41
+ const [shown, setShown] = useState(false);
42
+ const v = value ?? inner;
43
+ const passed = rules.map((r) => r.test(v));
44
+ const count = passed.filter(Boolean).length;
45
+ const all = count === rules.length;
46
+ const match = !!again && again === v;
47
+ const field = "flex h-11 items-center gap-2 rounded-[10px] bg-paper pl-3.5 pr-1.5 transition-shadow duration-200 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent)] hover:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_24%,transparent)] focus-within:!shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_14%,transparent)]";
48
+ const input = "h-full min-w-0 flex-1 bg-transparent text-[14.5px] tracking-[0.02em] text-ink outline-none placeholder:tracking-normal placeholder:text-mute";
49
+ return /* @__PURE__ */ jsxs("div", { className: cx("aui040 w-full max-w-[420px]", className), children: [
50
+ /* @__PURE__ */ jsx("style", { href: "asta-password-input-aui-040", precedence: "asta", children: CSS }),
51
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-baseline justify-between", style: rise(0), children: [
52
+ /* @__PURE__ */ jsx("label", { htmlFor: `${id}-pw`, className: "text-[13px] font-medium text-ink", children: label }),
53
+ /* @__PURE__ */ jsxs("span", { className: "flex items-baseline gap-1 text-[12px] text-mute", "aria-live": "polite", children: [
54
+ /* @__PURE__ */ jsx("span", { className: "relative inline-block h-4 overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: cx("block font-medium tabular-nums", all ? "text-brand" : "text-ink"), style: { animation: `aui040-num .3s ${EASE} both` }, children: count }, count) }),
55
+ "of ",
56
+ rules.length,
57
+ " rules"
58
+ ] })
59
+ ] }),
60
+ /* @__PURE__ */ jsxs("div", { className: field, style: rise(1), children: [
61
+ /* @__PURE__ */ jsx(
62
+ "input",
63
+ {
64
+ id: `${id}-pw`,
65
+ name,
66
+ type: shown ? "text" : "password",
67
+ value: v,
68
+ placeholder: "Choose a password",
69
+ autoComplete: "new-password",
70
+ spellCheck: false,
71
+ autoCapitalize: "off",
72
+ "aria-describedby": `${id}-rules`,
73
+ onChange: (e) => {
74
+ const next = e.target.value;
75
+ if (value === void 0) setInner(next);
76
+ onChange?.(next, rules.every((r) => r.test(next)));
77
+ },
78
+ className: input
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsx(
82
+ "button",
83
+ {
84
+ type: "button",
85
+ onPointerDown: (e) => e.preventDefault(),
86
+ onClick: () => setShown((s) => !s),
87
+ "aria-label": shown ? "Hide passwords" : "Show passwords",
88
+ "aria-pressed": shown,
89
+ className: "grid h-8 w-8 place-items-center rounded-[7px] text-mute outline-none transition-[background-color,color,transform] duration-200 hover:bg-paper-2 hover:text-ink active:scale-90 focus-visible:ring-2 focus-visible:ring-brand/50",
90
+ children: /* @__PURE__ */ jsx(Eye, { open: shown })
91
+ }
92
+ )
93
+ ] }),
94
+ /* @__PURE__ */ jsx("ul", { id: `${id}-rules`, className: "mt-2.5 grid grid-cols-2 gap-1.5 min-[400px]:grid-cols-4", style: rise(2), children: rules.map((r, i) => /* @__PURE__ */ jsxs(
95
+ "li",
96
+ {
97
+ className: cx(
98
+ "relative flex flex-col gap-0.5 rounded-[9px] px-2.5 pb-2 pt-2.5 transition-[background-color,box-shadow] duration-300",
99
+ passed[i] ? "bg-[color-mix(in_srgb,var(--brand)_8%,transparent)] shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--brand)_30%,transparent)]" : "bg-paper-2"
100
+ ),
101
+ children: [
102
+ /* @__PURE__ */ jsx("span", { className: cx("text-[17px] font-semibold leading-none tracking-[-0.03em] transition-colors duration-300", passed[i] ? "text-brand" : "text-ink"), children: r.glyph }),
103
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[11.5px] text-mute", children: r.label }),
104
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: passed[i] ? ", done" : ", not yet" }),
105
+ passed[i] && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute right-1.5 top-1.5 grid h-4 w-4 place-items-center rounded-full bg-brand text-white", style: { animation: `aui040-tick .4s ${EASE} both` }, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-2.5 w-2.5", fill: "none", stroke: "currentColor", strokeWidth: "2.6", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "m3.5 8.5 3 3 6-7" }) }) })
106
+ ]
107
+ },
108
+ r.label
109
+ )) }),
110
+ confirm && /* @__PURE__ */ jsxs(Fragment, { children: [
111
+ /* @__PURE__ */ jsx("label", { htmlFor: `${id}-again`, className: "mb-2 mt-4 block text-[13px] font-medium text-ink", style: rise(3), children: "Confirm password" }),
112
+ /* @__PURE__ */ jsxs("div", { className: field, style: rise(3), children: [
113
+ /* @__PURE__ */ jsx(
114
+ "input",
115
+ {
116
+ id: `${id}-again`,
117
+ type: shown ? "text" : "password",
118
+ value: again,
119
+ placeholder: "Type it again",
120
+ autoComplete: "new-password",
121
+ spellCheck: false,
122
+ autoCapitalize: "off",
123
+ "aria-invalid": !!again && !match && again.length >= v.length ? true : void 0,
124
+ onChange: (e) => setAgain(e.target.value),
125
+ className: input
126
+ }
127
+ ),
128
+ /* @__PURE__ */ jsx(
129
+ "span",
130
+ {
131
+ "aria-live": "polite",
132
+ className: cx(
133
+ "mr-1 flex h-6 items-center gap-1 rounded-full px-2 text-[11.5px] font-medium transition-[opacity,transform] duration-300",
134
+ again ? "opacity-100" : "translate-x-1 opacity-0",
135
+ match ? "bg-[color-mix(in_srgb,var(--brand)_10%,transparent)] text-brand" : "bg-paper-2 text-mute"
136
+ ),
137
+ style: { transitionTimingFunction: EASE },
138
+ children: match ? "Matches" : again ? "No match yet" : ""
139
+ }
140
+ )
141
+ ] })
142
+ ] })
143
+ ] });
144
+ }
145
+ var password_input_aui_040_default = ChecklistPassword;
146
+
147
+ export {
148
+ CHECKLIST_RULES,
149
+ ChecklistPassword,
150
+ password_input_aui_040_default
151
+ };
@@ -0,0 +1,252 @@
1
+ "use client";
2
+
3
+ // components/kit/variants/otp-input-aui-042.tsx
4
+ import { useEffect, useId, useRef, useState } from "react";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ var cx = (...c) => c.filter(Boolean).join(" ");
7
+ var EASE = "cubic-bezier(.16,1,.3,1)";
8
+ var CSS = `
9
+ @keyframes aui042-rise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
10
+ @keyframes aui042-drop { from { opacity: 0; transform: translateY(-8px) scale(.85) } to { opacity: 1; transform: none } }
11
+ @keyframes aui042-caret { 0%, 100% { opacity: 1 } 50% { opacity: 0 } }
12
+ @keyframes aui042-wait { 0%, 100% { opacity: 1; transform: none } 50% { opacity: .45; transform: translateY(-3px) } }
13
+ @keyframes aui042-shake { 0%, 100% { transform: none } 20% { transform: translateX(-8px) } 40% { transform: translateX(7px) } 60% { transform: translateX(-4px) } 80% { transform: translateX(2px) } }
14
+ @keyframes aui042-badge { 0% { opacity: 0; transform: scale(.3) } 60% { opacity: 1; transform: scale(1.08) } 100% { opacity: 1; transform: none } }
15
+ @keyframes aui042-ring { from { opacity: .7; transform: scale(1) } to { opacity: 0; transform: scale(1.9) } }
16
+ @keyframes aui042-sec { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: none } }
17
+ @media (prefers-reduced-motion: reduce) { .aui042 * { animation: none !important; transition: none !important } }
18
+ `;
19
+ var rise = (i) => ({ animation: `aui042-rise .65s ${EASE} ${120 + i * 60}ms both` });
20
+ function useCountdown(deadline, root) {
21
+ const [now, setNow] = useState(() => deadline);
22
+ useEffect(() => {
23
+ const el = root.current;
24
+ if (!el) return;
25
+ let seen = false;
26
+ let iv;
27
+ const sync = () => {
28
+ clearInterval(iv);
29
+ iv = void 0;
30
+ if (seen && !document.hidden && Date.now() < deadline) {
31
+ setNow(Date.now());
32
+ iv = setInterval(() => {
33
+ const t = Date.now();
34
+ setNow(t);
35
+ if (t >= deadline) clearInterval(iv);
36
+ }, 1e3);
37
+ }
38
+ };
39
+ const io = new IntersectionObserver(([e]) => {
40
+ seen = e.isIntersecting;
41
+ sync();
42
+ });
43
+ io.observe(el);
44
+ document.addEventListener("visibilitychange", sync);
45
+ return () => {
46
+ io.disconnect();
47
+ document.removeEventListener("visibilitychange", sync);
48
+ clearInterval(iv);
49
+ };
50
+ }, [deadline, root]);
51
+ return Math.max(0, Math.ceil((deadline - now) / 1e3));
52
+ }
53
+ function VerifyOtp({
54
+ length = 6,
55
+ destination = "rani@astabyte.com",
56
+ title = "Two-step verification",
57
+ onVerify,
58
+ demoCode = "424242",
59
+ resendAfter = 30,
60
+ onResend,
61
+ onContinue,
62
+ defaultValue = "",
63
+ className
64
+ }) {
65
+ const id = useId();
66
+ const root = useRef(null);
67
+ const input = useRef(null);
68
+ const alive = useRef(true);
69
+ const [code, setCode] = useState(defaultValue.replace(/\D/g, "").slice(0, length));
70
+ const [state, setState] = useState("idle");
71
+ const [msg, setMsg] = useState("");
72
+ const [shake, setShake] = useState(0);
73
+ const [focused, setFocused] = useState(false);
74
+ const [deadline, setDeadline] = useState(() => resendAfter > 0 ? Date.now() + resendAfter * 1e3 : 0);
75
+ const left = useCountdown(deadline, root);
76
+ useEffect(() => {
77
+ alive.current = true;
78
+ return () => {
79
+ alive.current = false;
80
+ };
81
+ }, []);
82
+ const verify = async (c) => {
83
+ setState("checking");
84
+ setMsg("");
85
+ try {
86
+ await (onVerify ? onVerify(c) : new Promise((res, rej) => setTimeout(() => c === demoCode ? res() : rej(new Error("That code didn't work. Check it and try again.")), 900)));
87
+ if (alive.current) setState("done");
88
+ } catch (err) {
89
+ if (!alive.current) return;
90
+ setState("error");
91
+ setMsg(err instanceof Error && err.message ? err.message : "That code didn't work.");
92
+ setShake((s) => s + 1);
93
+ setCode("");
94
+ input.current?.focus();
95
+ }
96
+ };
97
+ const started = useRef(false);
98
+ useEffect(() => {
99
+ if (started.current || code.length !== length) return;
100
+ started.current = true;
101
+ void verify(code);
102
+ }, []);
103
+ const update = (raw) => {
104
+ if (state === "checking" || state === "done") return;
105
+ const next = raw.replace(/\D/g, "").slice(0, length);
106
+ if (next === code) return;
107
+ setCode(next);
108
+ if (state === "error") setState("idle");
109
+ if (next.length === length) void verify(next);
110
+ };
111
+ const toEnd = (e) => {
112
+ const el = e.currentTarget;
113
+ const n = el.value.length;
114
+ if (el.selectionStart !== n || el.selectionEnd !== n) el.setSelectionRange(n, n);
115
+ };
116
+ const resend = () => {
117
+ setDeadline(Date.now() + resendAfter * 1e3);
118
+ setCode("");
119
+ setState("idle");
120
+ setMsg("");
121
+ onResend?.();
122
+ input.current?.focus();
123
+ };
124
+ const done = state === "done";
125
+ const mid = (length - 1) / 2;
126
+ const active = focused ? Math.min(code.length, length - 1) : -1;
127
+ return /* @__PURE__ */ jsxs(
128
+ "div",
129
+ {
130
+ ref: root,
131
+ className: cx(
132
+ "aui042 relative w-full max-w-[400px] overflow-hidden rounded-[16px] bg-ink px-6 pb-6 pt-7 text-paper shadow-[0_2px_4px_rgb(0_0_0/0.08),0_30px_60px_-28px_rgb(0_0_0/0.6)]",
133
+ className
134
+ ),
135
+ children: [
136
+ /* @__PURE__ */ jsx("style", { href: "asta-otp-input-aui-042", precedence: "asta", children: CSS }),
137
+ /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute -top-24 left-1/2 h-48 w-72 -translate-x-1/2 rounded-full bg-[radial-gradient(closest-side,color-mix(in_srgb,var(--brand)_45%,transparent),transparent)]" }),
138
+ /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-center text-center", children: [
139
+ /* @__PURE__ */ jsx("span", { className: "grid h-9 w-9 place-items-center rounded-[9px] bg-paper text-[15px] font-semibold text-ink", style: rise(0), children: "A" }),
140
+ /* @__PURE__ */ jsx("h3", { className: "relative mt-4 h-7 w-full overflow-hidden text-[20px] font-medium tracking-[-0.02em]", style: rise(1), children: /* @__PURE__ */ jsx("span", { className: "block", style: { animation: `aui042-sec .4s ${EASE} both` }, children: done ? "You're verified" : title }, done ? "done" : "t") }),
141
+ /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-[13.5px] text-paper/60", style: rise(2), children: done ? "Signing you in to Astabyte." : /* @__PURE__ */ jsxs(Fragment, { children: [
142
+ "Enter the ",
143
+ length,
144
+ "-digit code sent to ",
145
+ /* @__PURE__ */ jsx("span", { className: "text-paper", children: destination })
146
+ ] }) }),
147
+ /* @__PURE__ */ jsxs("div", { className: "relative mt-6 h-14", style: rise(3), children: [
148
+ /* @__PURE__ */ jsx(
149
+ "div",
150
+ {
151
+ "aria-hidden": true,
152
+ className: "flex h-14 items-center gap-2",
153
+ style: shake ? { animation: `aui042-shake .42s ${EASE} both` } : void 0,
154
+ children: Array.from({ length }, (_, i) => {
155
+ const d = code[i];
156
+ const fold = done ? `translateX(${(mid - i) * 50}px) scale(.4)` : "none";
157
+ return /* @__PURE__ */ jsxs(
158
+ "div",
159
+ {
160
+ className: cx(
161
+ "relative grid h-14 w-11 place-items-center rounded-[10px] transition-[transform,opacity,background-color,box-shadow] duration-500",
162
+ i === active && state !== "checking" ? "bg-paper/[0.1] shadow-[inset_0_0_0_1.5px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_25%,transparent)]" : state === "error" ? "bg-paper/[0.06] shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--paper)_70%,transparent)]" : "bg-paper/[0.06] shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--paper)_12%,transparent)]"
163
+ ),
164
+ style: {
165
+ transform: fold,
166
+ opacity: done ? 0 : 1,
167
+ transitionTimingFunction: EASE,
168
+ transitionDelay: done ? `${Math.abs(i - mid) * 30}ms` : "0ms",
169
+ animation: state === "checking" ? `aui042-wait .9s ease-in-out ${i * 70}ms infinite` : void 0
170
+ },
171
+ children: [
172
+ d && /* @__PURE__ */ jsx("span", { className: "text-[22px] font-medium tabular-nums", style: { animation: `aui042-drop .3s ${EASE} both` }, children: d }, `${i}-${d}`),
173
+ i === active && !d && state !== "checking" && /* @__PURE__ */ jsx("span", { className: "absolute h-5 w-[1.5px] rounded-full bg-paper", style: { animation: "aui042-caret 1.05s steps(1) infinite" } })
174
+ ]
175
+ },
176
+ i
177
+ );
178
+ })
179
+ },
180
+ shake
181
+ ),
182
+ done && /* @__PURE__ */ jsxs("span", { className: "absolute inset-0 grid place-items-center", "aria-hidden": true, children: [
183
+ /* @__PURE__ */ jsx("span", { className: "absolute h-14 w-14 rounded-full bg-brand", style: { animation: `aui042-ring 1s ${EASE} .35s both` } }),
184
+ /* @__PURE__ */ jsx("span", { className: "relative grid h-14 w-14 place-items-center rounded-full bg-brand text-white", style: { animation: `aui042-badge .55s ${EASE} .2s both` }, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-6 w-6", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M5 12.5l4.5 4.5L19 7.5" }) }) })
185
+ ] }),
186
+ /* @__PURE__ */ jsx(
187
+ "input",
188
+ {
189
+ ref: input,
190
+ id,
191
+ "aria-label": `${length}-digit verification code`,
192
+ value: code,
193
+ inputMode: "numeric",
194
+ autoComplete: "one-time-code",
195
+ maxLength: length,
196
+ disabled: done,
197
+ "aria-invalid": state === "error" || void 0,
198
+ "aria-describedby": `${id}-msg`,
199
+ onChange: (e) => update(e.target.value),
200
+ onPaste: (e) => {
201
+ e.preventDefault();
202
+ update(e.clipboardData.getData("text"));
203
+ },
204
+ onFocus: (e) => {
205
+ setFocused(true);
206
+ toEnd(e);
207
+ },
208
+ onBlur: () => setFocused(false),
209
+ onSelect: toEnd,
210
+ className: "absolute inset-0 h-full w-full cursor-text bg-transparent text-transparent caret-transparent outline-none selection:bg-transparent disabled:cursor-default"
211
+ }
212
+ )
213
+ ] }),
214
+ /* @__PURE__ */ jsx("p", { id: `${id}-msg`, role: "status", "aria-live": "polite", className: "mt-3 min-h-[20px] text-[13px] text-paper/80", children: state === "checking" ? "Checking\u2026" : msg }),
215
+ /* @__PURE__ */ jsx("div", { className: "mt-1 flex h-10 w-full items-center justify-center", style: rise(4), children: done ? /* @__PURE__ */ jsxs(
216
+ "button",
217
+ {
218
+ type: "button",
219
+ onClick: onContinue,
220
+ className: "group inline-flex h-10 items-center gap-2 rounded-[9px] bg-paper px-5 text-[13.5px] font-medium text-ink outline-none transition-transform duration-200 active:scale-[.97] focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 focus-visible:ring-offset-ink",
221
+ style: { animation: `aui042-rise .5s ${EASE} .45s both` },
222
+ children: [
223
+ "Continue",
224
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5 transition-transform duration-300 group-hover:translate-x-0.5", style: { transitionTimingFunction: EASE }, fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M3 8h10M9 4l4 4-4 4" }) })
225
+ ]
226
+ }
227
+ ) : left > 0 ? /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-1 text-[13px] text-paper/50", children: [
228
+ "Resend code in",
229
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex h-5 overflow-hidden font-medium tabular-nums text-paper", children: [
230
+ "0:",
231
+ /* @__PURE__ */ jsx("span", { className: "block", style: { animation: `aui042-sec .3s ${EASE} both` }, children: String(left).padStart(2, "0") }, left)
232
+ ] })
233
+ ] }) : /* @__PURE__ */ jsx(
234
+ "button",
235
+ {
236
+ type: "button",
237
+ onClick: resend,
238
+ className: "h-9 rounded-[8px] px-3 text-[13px] font-medium text-paper outline-none transition-[background-color,transform] duration-200 hover:bg-paper/10 active:scale-95 focus-visible:ring-2 focus-visible:ring-brand",
239
+ children: "Resend code"
240
+ }
241
+ ) })
242
+ ] })
243
+ ]
244
+ }
245
+ );
246
+ }
247
+ var otp_input_aui_042_default = VerifyOtp;
248
+
249
+ export {
250
+ VerifyOtp,
251
+ otp_input_aui_042_default
252
+ };