asta-ui 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,140 @@
1
+ "use client";
2
+
3
+ // components/kit/variants/switch-aui-058.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 SPRING = "cubic-bezier(.34,1.56,.64,1)";
9
+ var CSS = `
10
+ @keyframes aui058-rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
11
+ @keyframes aui058-spin { to { transform: rotate(360deg) } }
12
+ @media (prefers-reduced-motion: reduce) { .aui058 * { animation: none !important; transition: none !important } }
13
+ `;
14
+ var rise = (i) => ({ animation: `aui058-rise .6s ${EASE} ${80 + i * 55}ms both` });
15
+ var SETTINGS = [
16
+ { id: "mentions", label: "Mentions and replies", description: "When someone tags you or answers a thread" },
17
+ { id: "digest", label: "Weekly digest", description: "A Monday summary of what moved" },
18
+ { id: "product", label: "Product news", description: "New features, about once a month" },
19
+ { id: "security", label: "Security alerts", description: "New sign-ins and password changes", locked: "Always on" }
20
+ ];
21
+ var fakeSave = () => new Promise((r) => setTimeout(r, 650));
22
+ function SettingSwitch({
23
+ settings = SETTINGS,
24
+ value,
25
+ defaultValue = { mentions: true, digest: false, product: false, security: true },
26
+ onChange,
27
+ onSave = fakeSave,
28
+ eyebrow = "Astabyte \xB7 Settings",
29
+ title = "Email notifications",
30
+ className
31
+ }) {
32
+ const uid = useId();
33
+ const [inner, setInner] = useState(defaultValue);
34
+ const state = value ?? inner;
35
+ const [status, setStatus] = useState({});
36
+ const [announce, setAnnounce] = useState("");
37
+ const alive = useRef(true);
38
+ const timers = useRef(/* @__PURE__ */ new Map());
39
+ const runs = useRef(/* @__PURE__ */ new Map());
40
+ useEffect(() => {
41
+ alive.current = true;
42
+ const t = timers.current;
43
+ return () => {
44
+ alive.current = false;
45
+ t.forEach(clearTimeout);
46
+ };
47
+ }, []);
48
+ const flip = async (s) => {
49
+ if (s.locked) return;
50
+ const on = !state[s.id];
51
+ const next = { ...state, [s.id]: on };
52
+ if (value === void 0) setInner(next);
53
+ onChange?.(next);
54
+ const run = (runs.current.get(s.id) ?? 0) + 1;
55
+ runs.current.set(s.id, run);
56
+ clearTimeout(timers.current.get(s.id));
57
+ setStatus((st) => ({ ...st, [s.id]: "saving" }));
58
+ try {
59
+ await onSave(s.id, on);
60
+ } catch {
61
+ }
62
+ if (!alive.current || runs.current.get(s.id) !== run) return;
63
+ setStatus((st) => ({ ...st, [s.id]: "saved" }));
64
+ setAnnounce(`${s.label} ${on ? "on" : "off"}. Saved.`);
65
+ timers.current.set(
66
+ s.id,
67
+ setTimeout(() => alive.current && setStatus((st) => ({ ...st, [s.id]: "idle" })), 1800)
68
+ );
69
+ };
70
+ return /* @__PURE__ */ jsxs(
71
+ "section",
72
+ {
73
+ "aria-labelledby": `${uid}-t`,
74
+ className: cx(
75
+ "aui058 w-full max-w-[460px] rounded-[14px] bg-paper p-5 sm:p-6",
76
+ "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent),0_1px_2px_rgb(0_0_0/0.04),0_18px_40px_-20px_rgb(0_0_0/0.25)]",
77
+ className
78
+ ),
79
+ children: [
80
+ /* @__PURE__ */ jsx("style", { href: "asta-aui058", precedence: "asta", children: CSS }),
81
+ /* @__PURE__ */ jsxs("div", { style: rise(0), children: [
82
+ /* @__PURE__ */ jsx("p", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-mute", children: eyebrow }),
83
+ /* @__PURE__ */ jsx("h3", { id: `${uid}-t`, className: "mt-1.5 text-[20px] font-medium leading-tight tracking-[-0.02em] text-ink", children: title }),
84
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-[13px] text-mute", children: "Changes save as you go." })
85
+ ] }),
86
+ /* @__PURE__ */ jsx("p", { className: "sr-only", "aria-live": "polite", children: announce }),
87
+ /* @__PURE__ */ jsx("ul", { className: "mt-4 -mx-2", children: settings.map((s, i) => {
88
+ const on = !!state[s.id];
89
+ const st = status[s.id] ?? "idle";
90
+ const id = `${uid}-${s.id}`;
91
+ return /* @__PURE__ */ jsxs("li", { style: rise(i + 1), className: "group/set relative flex items-center gap-4 rounded-[10px] px-2 py-3", children: [
92
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 rounded-[10px] bg-paper-2 opacity-0 transition-opacity duration-300 group-hover/set:opacity-60" }),
93
+ /* @__PURE__ */ jsxs("span", { className: "relative min-w-0 flex-1", children: [
94
+ /* @__PURE__ */ jsx("label", { htmlFor: id, className: cx("block text-[14px] font-medium tracking-[-0.01em] text-ink", !s.locked && "cursor-pointer"), children: s.label }),
95
+ s.description && /* @__PURE__ */ jsx("span", { id: `${id}-d`, className: "mt-0.5 block text-[12.5px] leading-snug text-mute", children: s.description })
96
+ ] }),
97
+ /* @__PURE__ */ jsxs("span", { className: "relative flex shrink-0 items-center gap-3", children: [
98
+ s.locked ? /* @__PURE__ */ jsx("span", { className: "text-[11.5px] text-mute", children: s.locked }) : /* @__PURE__ */ jsx(SaveState, { status: st }),
99
+ /* @__PURE__ */ jsxs(
100
+ "button",
101
+ {
102
+ id,
103
+ type: "button",
104
+ role: "switch",
105
+ "aria-checked": on,
106
+ "aria-describedby": s.description ? `${id}-d` : void 0,
107
+ disabled: !!s.locked,
108
+ onClick: () => flip(s),
109
+ className: "group/sw relative h-[22px] w-[38px] shrink-0 rounded-full outline-none focus-visible:ring-2 focus-visible:ring-brand/50 focus-visible:ring-offset-2 focus-visible:ring-offset-paper disabled:cursor-not-allowed disabled:opacity-50",
110
+ children: [
111
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute inset-0 rounded-full bg-[color-mix(in_srgb,var(--ink)_14%,var(--paper))] shadow-[inset_0_1px_2px_rgb(0_0_0/0.08)]" }),
112
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute inset-0 rounded-full bg-brand shadow-[inset_0_1px_2px_rgb(0_0_0/0.15)] transition-opacity duration-300", style: { opacity: on ? 1 : 0 } }),
113
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute left-[2px] top-[2px] block h-[18px] w-[18px] transition-transform duration-[450ms]", style: { transform: `translateX(${on ? 16 : 0}px)`, transitionTimingFunction: SPRING }, children: /* @__PURE__ */ jsx("span", { className: cx("block h-full w-full rounded-full bg-white shadow-[0_1px_2px_rgb(0_0_0/0.2),0_2px_6px_-1px_rgb(0_0_0/0.18)] transition-transform duration-200 group-active/sw:scale-x-[1.18]", on ? "origin-right" : "origin-left") }) })
114
+ ]
115
+ }
116
+ )
117
+ ] })
118
+ ] }, s.id);
119
+ }) })
120
+ ]
121
+ }
122
+ );
123
+ }
124
+ function SaveState({ status }) {
125
+ const saving = status === "saving";
126
+ const saved = status === "saved";
127
+ return /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "relative block h-5 w-[58px]", children: [
128
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-end transition-[transform,opacity] duration-300", style: { opacity: saving ? 1 : 0, transform: saving ? "none" : "translateY(-4px)", transitionTimingFunction: EASE }, children: /* @__PURE__ */ jsx("span", { className: "h-3 w-3 rounded-full border-[1.5px] border-[color-mix(in_srgb,var(--ink)_25%,transparent)] border-t-ink", style: { animation: saving ? "aui058-spin .7s linear infinite" : "none" } }) }),
129
+ /* @__PURE__ */ jsxs("span", { className: "absolute inset-0 flex items-center justify-end gap-1 text-[12px] font-medium text-brand transition-[transform,opacity] duration-500", style: { opacity: saved ? 1 : 0, transform: saved ? "none" : "translateY(4px)", transitionTimingFunction: EASE }, children: [
130
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M3.5 8.5l3 3 6-7", pathLength: 1, strokeDasharray: "1", className: "transition-[stroke-dashoffset]", style: { strokeDashoffset: saved ? 0 : 1, transitionDuration: saved ? "420ms" : "0ms", transitionDelay: saved ? "80ms" : "0ms", transitionTimingFunction: EASE } }) }),
131
+ "Saved"
132
+ ] })
133
+ ] });
134
+ }
135
+ var switch_aui_058_default = SettingSwitch;
136
+
137
+ export {
138
+ SettingSwitch,
139
+ switch_aui_058_default
140
+ };
@@ -0,0 +1,93 @@
1
+ "use client";
2
+
3
+ // components/kit/variants/radio-group-aui-057.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 SPRING = "cubic-bezier(.34,1.56,.64,1)";
9
+ var CSS = `
10
+ @keyframes aui057-rise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
11
+ @keyframes aui057-pop { from { opacity: 0; transform: scale(.6) } to { opacity: 1; transform: none } }
12
+ @media (prefers-reduced-motion: reduce) { .aui057 * { animation: none !important; transition: none !important } }
13
+ `;
14
+ var rise = (i) => ({ animation: `aui057-rise .6s ${EASE} ${80 + i * 50}ms both` });
15
+ var mix = (a, p, b) => `color-mix(in srgb, var(--color-${a}) ${p}%, var(--color-${b}))`;
16
+ var SWATCHES = [
17
+ { value: "ink", name: "Ink", color: "var(--ink)", on: "var(--paper)" },
18
+ { value: "graphite", name: "Graphite", color: mix("ink", 62, "paper"), on: "var(--paper)" },
19
+ { value: "fog", name: "Fog", color: mix("ink", 9, "paper"), on: "var(--ink)" },
20
+ { value: "cobalt", name: "Cobalt", color: "var(--brand)", on: "#fff" },
21
+ { value: "midnight", name: "Midnight", color: mix("brand", 45, "ink"), on: "#fff" },
22
+ { value: "ice", name: "Ice", color: mix("brand", 16, "paper"), on: "var(--brand)" }
23
+ ];
24
+ function SwatchRadio({ swatches = SWATCHES, value, defaultValue = "cobalt", onChange, title = "App icon", description = "How Astabyte looks on your dock and home screen.", mark = "A", name, className }) {
25
+ const uid = useId();
26
+ const [inner, setInner] = useState(defaultValue);
27
+ const current = value ?? inner;
28
+ const index = Math.max(0, swatches.findIndex((s) => s.value === current));
29
+ const icon = useRef(null);
30
+ const first = useRef(true);
31
+ useEffect(() => {
32
+ if (first.current) {
33
+ first.current = false;
34
+ return;
35
+ }
36
+ if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
37
+ icon.current?.animate([{ transform: "scale(1)" }, { transform: "scale(.92)", offset: 0.3 }, { transform: "scale(1)" }], { duration: 520, easing: SPRING });
38
+ }, [index]);
39
+ const pick = (v) => {
40
+ if (value === void 0) setInner(v);
41
+ onChange?.(v);
42
+ };
43
+ return /* @__PURE__ */ jsxs(
44
+ "div",
45
+ {
46
+ className: cx(
47
+ "aui057 w-full max-w-[440px] rounded-[14px] bg-paper p-5 sm:p-6",
48
+ "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent),0_1px_2px_rgb(0_0_0/0.04),0_18px_40px_-20px_rgb(0_0_0/0.25)]",
49
+ className
50
+ ),
51
+ children: [
52
+ /* @__PURE__ */ jsx("style", { href: "asta-aui057", precedence: "asta", children: CSS }),
53
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-5", children: [
54
+ /* @__PURE__ */ jsxs("div", { ref: icon, "aria-hidden": true, className: "relative h-[84px] w-[84px] shrink-0 overflow-hidden rounded-[22px] shadow-[0_1px_2px_rgb(0_0_0/0.08),0_12px_28px_-14px_rgb(0_0_0/0.45)]", style: { animation: `aui057-pop .7s ${SPRING} 80ms both` }, children: [
55
+ swatches.map((s, i) => /* @__PURE__ */ jsx("span", { className: "absolute inset-0 grid place-items-center transition-opacity duration-500", style: { background: s.color, opacity: i === index ? 1 : 0, transitionTimingFunction: EASE }, children: /* @__PURE__ */ jsx("span", { className: "text-[38px] font-semibold leading-none tracking-[-0.06em]", style: { color: s.on }, children: mark }) }, s.value)),
56
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 rounded-[22px] bg-[linear-gradient(180deg,rgb(255_255_255/0.22),transparent_45%)] shadow-[inset_0_0_0_1px_rgb(0_0_0/0.06)]" })
57
+ ] }),
58
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", style: rise(1), children: [
59
+ /* @__PURE__ */ jsx("h3", { id: `${uid}-t`, className: "text-[20px] font-medium leading-tight tracking-[-0.02em] text-ink", children: title }),
60
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-[13px] leading-snug text-mute", children: description })
61
+ ] })
62
+ ] }),
63
+ /* @__PURE__ */ jsxs("div", { className: "mt-6 flex items-center justify-between gap-3", style: rise(2), children: [
64
+ /* @__PURE__ */ jsx("p", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-mute", children: "Colour" }),
65
+ /* @__PURE__ */ jsx("span", { className: "relative block h-5 w-24 overflow-hidden text-right text-[14px] font-medium tracking-[-0.01em] text-ink", "aria-live": "polite", children: /* @__PURE__ */ jsx("span", { className: "absolute inset-x-0 top-0 flex flex-col transition-transform duration-500", style: { transform: `translateY(${-index * 20}px)`, transitionTimingFunction: EASE }, children: swatches.map((s, i) => /* @__PURE__ */ jsx("span", { "aria-hidden": i !== index, className: "block h-5 leading-5", children: s.name }, s.value)) }) })
66
+ ] }),
67
+ /* @__PURE__ */ jsx("div", { role: "radiogroup", "aria-labelledby": `${uid}-t`, className: "-mx-1 mt-3 grid justify-items-center gap-1", style: { gridTemplateColumns: `repeat(${swatches.length}, minmax(0, 1fr))` }, children: swatches.map((s, i) => {
68
+ const on = i === index;
69
+ const id = `${uid}-${s.value}`;
70
+ return /* @__PURE__ */ jsxs("label", { htmlFor: id, title: s.name, className: "group/sw relative grid h-10 w-10 cursor-pointer sm:h-11 sm:w-11 place-items-center rounded-full", style: { animation: `aui057-pop .5s ${SPRING} ${220 + i * 45}ms both` }, children: [
71
+ /* @__PURE__ */ jsx("input", { id, type: "radio", name: name ?? uid, value: s.value, checked: on, onChange: () => pick(s.value), "aria-label": s.name, className: "peer sr-only" }),
72
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute inset-0 rounded-full shadow-[inset_0_0_0_2px_var(--ink)] transition-[transform,opacity] duration-500", style: { opacity: on ? 1 : 0, transform: on ? "scale(1)" : "scale(.7)", transitionTimingFunction: SPRING } }),
73
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute inset-[-3px] rounded-full opacity-0 shadow-[0_0_0_2px_var(--brand)] peer-focus-visible:opacity-100" }),
74
+ /* @__PURE__ */ jsx(
75
+ "span",
76
+ {
77
+ "aria-hidden": true,
78
+ className: "relative h-7 w-7 rounded-full sm:h-8 sm:w-8 shadow-[inset_0_0_0_1px_rgb(0_0_0/0.08),inset_0_1px_0_rgb(255_255_255/0.2)] transition-transform duration-300 group-hover/sw:scale-110 group-active/sw:scale-95",
79
+ style: { background: s.color, transform: on ? "scale(.82)" : void 0, transitionTimingFunction: SPRING }
80
+ }
81
+ )
82
+ ] }, s.value);
83
+ }) })
84
+ ]
85
+ }
86
+ );
87
+ }
88
+ var radio_group_aui_057_default = SwatchRadio;
89
+
90
+ export {
91
+ SwatchRadio,
92
+ radio_group_aui_057_default
93
+ };
@@ -0,0 +1,167 @@
1
+ "use client";
2
+
3
+ // components/kit/variants/password-input-aui-039.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 aui039-rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
10
+ @keyframes aui039-word { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
11
+ @keyframes aui039-glow { 0% { opacity: 0; transform: scale(.7) } 40% { opacity: 1 } 100% { opacity: 0; transform: scale(1.35) } }
12
+ @media (prefers-reduced-motion: reduce) { .aui039 * { animation: none !important; transition: none !important } }
13
+ `;
14
+ var rise = (i) => ({ animation: `aui039-rise .6s ${EASE} ${i * 55}ms both` });
15
+ var CHECKS = [(v) => v.length >= 8, (v) => /[A-Z]/.test(v) && /[a-z]/.test(v), (v) => /\d/.test(v), (v) => /[^A-Za-z0-9]/.test(v) || v.length >= 14];
16
+ var WORDS = ["Empty", "Weak", "Fair", "Good", "Strong"];
17
+ function crackTime(v) {
18
+ if (!v) return "";
19
+ const pool = (/[a-z]/.test(v) ? 26 : 0) + (/[A-Z]/.test(v) ? 26 : 0) + (/\d/.test(v) ? 10 : 0) + (/[^A-Za-z0-9]/.test(v) ? 33 : 0);
20
+ const secs = Math.pow(pool || 1, v.length) / 2 / 1e10;
21
+ const units = [
22
+ [315e7, "century"],
23
+ [315e5, "year"],
24
+ [86400, "day"],
25
+ [3600, "hour"],
26
+ [60, "minute"]
27
+ ];
28
+ if (secs < 1) return "instantly";
29
+ if (secs > 315e9) return "centuries";
30
+ for (const [s, name] of units) if (secs >= s) {
31
+ const n = Math.round(secs / s);
32
+ return `${n} ${name === "century" ? n > 1 ? "centuries" : "century" : name + (n > 1 ? "s" : "")}`;
33
+ }
34
+ return "seconds";
35
+ }
36
+ function arc(i, r) {
37
+ const a0 = (i * 90 + 6 - 90) * Math.PI / 180;
38
+ const a1 = ((i + 1) * 90 - 6 - 90) * Math.PI / 180;
39
+ const p = (a) => `${(32 + r * Math.cos(a)).toFixed(2)} ${(32 + r * Math.sin(a)).toFixed(2)}`;
40
+ return `M${p(a0)} A${r} ${r} 0 0 1 ${p(a1)}`;
41
+ }
42
+ function StrengthPassword({
43
+ value,
44
+ defaultValue = "",
45
+ onChange,
46
+ label = "Password",
47
+ estimate = true,
48
+ placeholder = "At least 8 characters",
49
+ autoComplete = "new-password",
50
+ className,
51
+ id,
52
+ ...rest
53
+ }) {
54
+ const uid = useId();
55
+ const inputId = id ?? uid;
56
+ const [inner, setInner] = useState(defaultValue);
57
+ const [shown, setShown] = useState(false);
58
+ const v = value ?? inner;
59
+ const score = v ? CHECKS.filter((c) => c(v)).length : 0;
60
+ const strong = score === 4;
61
+ const time = crackTime(v);
62
+ return /* @__PURE__ */ jsxs("div", { className: cx("aui039 w-full max-w-[400px]", className), children: [
63
+ /* @__PURE__ */ jsx("style", { href: "asta-password-input-aui-039", precedence: "asta", children: CSS }),
64
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", style: rise(0), children: [
65
+ /* @__PURE__ */ jsxs("div", { className: "relative h-16 w-16 shrink-0", "aria-hidden": true, children: [
66
+ strong && /* @__PURE__ */ jsx("span", { className: "absolute inset-0 rounded-full bg-[color-mix(in_srgb,var(--brand)_22%,transparent)]", style: { animation: `aui039-glow .9s ${EASE} both` } }, "glow"),
67
+ /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 64 64", className: "relative h-16 w-16", children: [
68
+ [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsxs("g", { children: [
69
+ /* @__PURE__ */ jsx("path", { d: arc(i, 27), fill: "none", strokeWidth: "5", strokeLinecap: "round", className: "stroke-[color-mix(in_srgb,var(--ink)_9%,transparent)]" }),
70
+ /* @__PURE__ */ jsx(
71
+ "path",
72
+ {
73
+ d: arc(i, 27),
74
+ fill: "none",
75
+ strokeWidth: "5",
76
+ strokeLinecap: "round",
77
+ className: cx("origin-center transition-[opacity,transform] duration-500", strong ? "stroke-brand" : "stroke-ink"),
78
+ style: {
79
+ opacity: i < score ? 1 : 0,
80
+ transform: i < score ? "scale(1)" : "scale(.86)",
81
+ transitionDelay: `${i * 50}ms`,
82
+ transitionTimingFunction: EASE,
83
+ transformBox: "view-box"
84
+ }
85
+ }
86
+ )
87
+ ] }, i)),
88
+ /* @__PURE__ */ jsxs("g", { className: cx("transition-colors duration-300", strong ? "text-brand" : "text-ink"), children: [
89
+ /* @__PURE__ */ jsx(
90
+ "path",
91
+ {
92
+ d: "M27 31v-4a5 5 0 0 1 10 0v4",
93
+ fill: "none",
94
+ stroke: "currentColor",
95
+ strokeWidth: "2.2",
96
+ strokeLinecap: "round",
97
+ className: "transition-transform duration-500",
98
+ style: { transform: strong ? "none" : "translateY(-3px)", transitionTimingFunction: EASE }
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsx("rect", { x: "24.5", y: "30", width: "15", height: "11.5", rx: "2.6", fill: "currentColor" })
102
+ ] })
103
+ ] })
104
+ ] }),
105
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
106
+ /* @__PURE__ */ jsx("p", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-mute", children: "Strength" }),
107
+ /* @__PURE__ */ jsx("p", { className: "relative h-7 overflow-hidden", "aria-live": "polite", children: /* @__PURE__ */ jsx("span", { className: cx("block text-[20px] font-medium leading-7 tracking-[-0.02em]", strong ? "text-brand" : v ? "text-ink" : "text-mute"), style: { animation: `aui039-word .35s ${EASE} both` }, children: WORDS[score] }, score) }),
108
+ estimate && /* @__PURE__ */ jsx("p", { className: "truncate text-[12.5px] text-mute", children: v ? /* @__PURE__ */ jsxs(Fragment, { children: [
109
+ "Cracked ",
110
+ /* @__PURE__ */ jsx("span", { className: "text-ink", children: time }),
111
+ time === "instantly" ? "" : " by a fast rig"
112
+ ] }) : "Mix cases, numbers and a symbol" })
113
+ ] })
114
+ ] }),
115
+ /* @__PURE__ */ jsx("label", { htmlFor: inputId, className: "mb-2 mt-5 block text-[13px] font-medium text-ink", style: rise(1), children: label }),
116
+ /* @__PURE__ */ jsxs(
117
+ "div",
118
+ {
119
+ className: cx(
120
+ "flex h-11 items-center gap-2 rounded-[10px] bg-paper pl-3.5 pr-1.5 transition-shadow duration-200",
121
+ "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)]",
122
+ "focus-within:!shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_14%,transparent)]"
123
+ ),
124
+ style: rise(2),
125
+ children: [
126
+ /* @__PURE__ */ jsx(
127
+ "input",
128
+ {
129
+ ...rest,
130
+ id: inputId,
131
+ type: shown ? "text" : "password",
132
+ value: v,
133
+ placeholder,
134
+ autoComplete,
135
+ spellCheck: false,
136
+ autoCapitalize: "off",
137
+ onChange: (e) => {
138
+ const next = e.target.value;
139
+ if (value === void 0) setInner(next);
140
+ onChange?.(next, next ? CHECKS.filter((c) => c(next)).length : 0);
141
+ },
142
+ className: "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"
143
+ }
144
+ ),
145
+ /* @__PURE__ */ jsx(
146
+ "button",
147
+ {
148
+ type: "button",
149
+ onPointerDown: (e) => e.preventDefault(),
150
+ onClick: () => setShown((s) => !s),
151
+ "aria-pressed": shown,
152
+ "aria-controls": inputId,
153
+ className: "h-8 rounded-[7px] px-2.5 text-[12.5px] font-medium text-mute outline-none transition-[background-color,color,transform] duration-200 hover:bg-paper-2 hover:text-ink active:scale-95 focus-visible:ring-2 focus-visible:ring-brand/50",
154
+ children: shown ? "Hide" : "Show"
155
+ }
156
+ )
157
+ ]
158
+ }
159
+ )
160
+ ] });
161
+ }
162
+ var password_input_aui_039_default = StrengthPassword;
163
+
164
+ export {
165
+ StrengthPassword,
166
+ password_input_aui_039_default
167
+ };
@@ -0,0 +1,136 @@
1
+ "use client";
2
+
3
+ // components/kit/variants/input-aui-031.tsx
4
+ import { useEffect, 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 ADDON = "flex h-full shrink-0 items-center rounded-[7px] bg-paper-2 px-2.5 text-[13.5px] tracking-[-0.01em] text-mute transition-colors duration-300 group-focus-within/a:text-ink-2";
9
+ var text = (n) => typeof n === "string" || typeof n === "number" ? String(n) : "";
10
+ function AffixInput({
11
+ label = "Site address",
12
+ prefix = "https://",
13
+ suffix = ".astabyte.com",
14
+ ride = true,
15
+ units,
16
+ unit: unitProp,
17
+ onUnitChange,
18
+ copy,
19
+ className,
20
+ placeholder = "studio",
21
+ id,
22
+ ...rest
23
+ }) {
24
+ const ref = useRef(null);
25
+ const controlled = rest.value !== void 0;
26
+ const [inner, setInner] = useState(String(rest.defaultValue ?? ""));
27
+ const value = controlled ? String(rest.value ?? "") : inner;
28
+ const [unitInner, setUnitInner] = useState(units?.[0] ?? "");
29
+ const unit = unitProp ?? unitInner;
30
+ const ui = Math.max(0, units?.indexOf(unit) ?? 0);
31
+ const [copied, setCopied] = useState(false);
32
+ const timer = useRef(void 0);
33
+ useEffect(() => () => clearTimeout(timer.current), []);
34
+ const nextUnit = () => {
35
+ if (!units?.length) return;
36
+ const u = units[(ui + 1) % units.length];
37
+ if (unitProp === void 0) setUnitInner(u);
38
+ onUnitChange?.(u);
39
+ };
40
+ const doCopy = async () => {
41
+ const s = typeof copy === "string" ? copy : `${text(prefix)}${value || placeholder}${units ? ` ${unit}` : text(suffix)}`;
42
+ try {
43
+ await navigator.clipboard.writeText(s);
44
+ } catch {
45
+ }
46
+ setCopied(true);
47
+ clearTimeout(timer.current);
48
+ timer.current = setTimeout(() => setCopied(false), 1600);
49
+ };
50
+ const input = /* @__PURE__ */ jsx(
51
+ "input",
52
+ {
53
+ ref,
54
+ id,
55
+ "aria-label": id ? void 0 : label,
56
+ size: 1,
57
+ ...rest,
58
+ placeholder,
59
+ onChange: (e) => {
60
+ if (!controlled) setInner(e.target.value);
61
+ rest.onChange?.(e);
62
+ },
63
+ className: cx(
64
+ "h-full min-w-0 bg-transparent text-[14.5px] tracking-[-0.01em] text-ink outline-none placeholder:text-mute",
65
+ ride && suffix && !units ? "col-start-1 row-start-1 w-full" : "w-full flex-1"
66
+ )
67
+ }
68
+ );
69
+ return /* @__PURE__ */ jsxs(
70
+ "div",
71
+ {
72
+ onPointerDown: (e) => {
73
+ if (e.target === e.currentTarget || e.target.dataset.fill !== void 0) {
74
+ e.preventDefault();
75
+ ref.current?.focus();
76
+ }
77
+ },
78
+ className: cx(
79
+ "group/a flex h-11 w-full cursor-text items-center gap-1 rounded-[10px] bg-paper p-1 text-ink transition-shadow duration-300",
80
+ "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)_26%,transparent)]",
81
+ "focus-within:!shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_12%,transparent)]",
82
+ rest.disabled && "pointer-events-none opacity-50",
83
+ className
84
+ ),
85
+ children: [
86
+ prefix && /* @__PURE__ */ jsx("span", { className: ADDON, children: prefix }),
87
+ ride && suffix && !units ? /* @__PURE__ */ jsxs("span", { "data-fill": true, className: "flex h-full min-w-0 flex-1 items-center overflow-hidden px-2", children: [
88
+ /* @__PURE__ */ jsxs("span", { className: "inline-grid h-full min-w-[1ch] max-w-[calc(100%-1rem)] items-center", children: [
89
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "invisible col-start-1 row-start-1 overflow-hidden whitespace-pre text-[14.5px] tracking-[-0.01em]", children: value || placeholder }),
90
+ input
91
+ ] }),
92
+ /* @__PURE__ */ jsx("span", { "data-fill": true, className: cx("shrink-0 whitespace-pre text-[14.5px] tracking-[-0.01em] transition-colors duration-300", value ? "text-ink-2" : "text-mute"), children: suffix })
93
+ ] }) : /* @__PURE__ */ jsx("span", { "data-fill": true, className: "flex h-full min-w-0 flex-1 items-center px-2", children: input }),
94
+ units?.length ? /* @__PURE__ */ jsxs(
95
+ "button",
96
+ {
97
+ type: "button",
98
+ onClick: nextUnit,
99
+ "aria-label": `Unit: ${unit}. Change unit`,
100
+ className: cx(ADDON, "group/u relative gap-1.5 overflow-hidden outline-none hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50"),
101
+ children: [
102
+ /* @__PURE__ */ jsxs("span", { className: "relative h-5 overflow-hidden", children: [
103
+ /* @__PURE__ */ jsx("span", { className: "flex flex-col transition-transform duration-500", style: { transform: `translateY(${-ui * 1.25}rem)`, transitionTimingFunction: EASE }, children: units.map((u) => /* @__PURE__ */ jsx("span", { className: "block h-5 leading-5", children: u }, u)) }),
104
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "invisible block h-0 overflow-hidden", children: units.reduce((a, b) => b.length > a.length ? b : a, "") })
105
+ ] }),
106
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 12 12", className: "h-3 w-3 transition-transform duration-300 group-hover/u:translate-y-px", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M3.5 4.5 6 2l2.5 2.5M3.5 7.5 6 10l2.5-2.5" }) })
107
+ ]
108
+ }
109
+ ) : suffix && !ride && /* @__PURE__ */ jsx("span", { className: ADDON, children: suffix }),
110
+ copy && /* @__PURE__ */ jsxs(
111
+ "button",
112
+ {
113
+ type: "button",
114
+ onClick: doCopy,
115
+ "aria-label": copied ? "Copied" : "Copy",
116
+ className: "relative grid h-full w-9 shrink-0 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-95 focus-visible:ring-2 focus-visible:ring-brand/50",
117
+ children: [
118
+ /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: cx("absolute h-4 w-4 transition-[transform,opacity] duration-300", copied ? "scale-50 opacity-0" : "opacity-100"), style: { transitionTimingFunction: EASE }, fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinejoin: "round", "aria-hidden": true, children: [
119
+ /* @__PURE__ */ jsx("rect", { x: "5.25", y: "5.25", width: "8", height: "8", rx: "2" }),
120
+ /* @__PURE__ */ jsx("path", { d: "M10.75 5.25V4.5a1.75 1.75 0 0 0-1.75-1.75H4.5A1.75 1.75 0 0 0 2.75 4.5V9a1.75 1.75 0 0 0 1.75 1.75h.75" })
121
+ ] }),
122
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: cx("absolute h-4 w-4 text-brand transition-opacity duration-200", copied ? "opacity-100" : "opacity-0"), fill: "none", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M3.5 8.5l3 3 6-7", pathLength: 1, strokeDasharray: "1", className: "transition-[stroke-dashoffset] duration-500", style: { strokeDashoffset: copied ? 0 : 1, transitionTimingFunction: EASE } }) }),
123
+ /* @__PURE__ */ jsx("span", { role: "status", className: "sr-only", children: copied ? "Copied" : "" })
124
+ ]
125
+ }
126
+ )
127
+ ]
128
+ }
129
+ );
130
+ }
131
+ var input_aui_031_default = AffixInput;
132
+
133
+ export {
134
+ AffixInput,
135
+ input_aui_031_default
136
+ };