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,339 @@
1
+ "use client";
2
+
3
+ // components/kit/variants/date-picker-aui-051.tsx
4
+ import { useEffect, useId, useLayoutEffect, useMemo, 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 CSS = `
9
+ @keyframes aui051-pop { from { opacity: 0; transform: translateY(var(--aui051-y, -6px)) scale(.97) } }
10
+ @keyframes aui051-char { from { opacity: 0; transform: translateY(80%) } }
11
+ @keyframes aui051-row { from { opacity: 0; transform: translateX(-6px) } }
12
+ @keyframes aui051-next { from { opacity: 0; transform: translateX(22px) } }
13
+ @keyframes aui051-prev { from { opacity: 0; transform: translateX(-22px) } }
14
+ @keyframes aui051-dot { 0% { opacity: 0; transform: scale(.5) } 60% { opacity: 1; transform: scale(1.1) } 100% { transform: none } }
15
+ @media (prefers-reduced-motion: reduce) { .aui051 *, .aui051 { animation: none !important; transition: none !important } }
16
+ `;
17
+ var day0 = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
18
+ var addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
19
+ var month0 = (d) => new Date(d.getFullYear(), d.getMonth(), 1);
20
+ var addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
21
+ var same = (a, b) => !!a && !!b && day0(a).getTime() === day0(b).getTime();
22
+ var key = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
23
+ var PRESETS = [
24
+ { label: "Today", get: (t) => t },
25
+ { label: "Tomorrow", get: (t) => addDays(t, 1) },
26
+ { label: "This weekend", get: (t) => addDays(t, (6 - t.getDay() + 7) % 7) },
27
+ { label: "Next week", get: (t) => addDays(t, (8 - t.getDay()) % 7 || 7) },
28
+ { label: "In two weeks", get: (t) => addDays(t, 14) },
29
+ { label: "End of month", get: (t) => new Date(t.getFullYear(), t.getMonth() + 1, 0) },
30
+ { label: "No date", get: () => null }
31
+ ];
32
+ function clipBox(el) {
33
+ for (let p = el.parentElement; p && p !== document.body; p = p.parentElement) {
34
+ const s = getComputedStyle(p);
35
+ if (/hidden|auto|scroll|clip/.test(s.overflowY + s.overflowX)) return p.getBoundingClientRect();
36
+ }
37
+ return { top: 0, bottom: window.innerHeight, left: 0, right: window.innerWidth };
38
+ }
39
+ function place(el, h) {
40
+ const r = el.getBoundingClientRect();
41
+ const c = clipBox(el);
42
+ const below = c.bottom - r.bottom;
43
+ const w = Math.min(440, c.right - c.left - 16);
44
+ const dx = Math.max(c.left + 8 - r.left, Math.min(0, c.right - 8 - (r.left + w)));
45
+ return { down: below >= h || below >= r.top - c.top, w, dx };
46
+ }
47
+ function Roll({ text }) {
48
+ return /* @__PURE__ */ jsx("span", { className: "inline-flex overflow-hidden whitespace-pre", "aria-hidden": true, children: [...text].map((ch, i) => /* @__PURE__ */ jsx("span", { className: "inline-block", style: { animation: `aui051-char .5s ${EASE} ${i * 18}ms both` }, children: ch }, i)) }, text);
49
+ }
50
+ function PresetDatePicker({ value, defaultValue, onChange, presets = PRESETS, label = "Due", locale = "en-US", weekStartsOn = 1, defaultOpen = false, name, disabled, className }) {
51
+ const [today] = useState(() => day0(/* @__PURE__ */ new Date()));
52
+ const [inner, setInner] = useState(() => defaultValue === void 0 ? addDays(today, (8 - today.getDay()) % 7 || 7) : defaultValue);
53
+ const current = value !== void 0 ? value : inner;
54
+ const sel = current ? day0(current) : null;
55
+ const [open, setOpen] = useState(defaultOpen);
56
+ const [down, setDown] = useState(true);
57
+ const [view, setView] = useState(() => month0(sel ?? today));
58
+ const [dir, setDir] = useState(0);
59
+ const [focus, setFocus] = useState(() => sel ?? today);
60
+ const root = useRef(null);
61
+ const btn = useRef(null);
62
+ const panel = useRef(null);
63
+ const grid = useRef(null);
64
+ const steer = useRef(false);
65
+ const wantFocus = useRef(false);
66
+ const closeT = useRef(void 0);
67
+ const uid = useId();
68
+ const fmt = useMemo(() => new Intl.DateTimeFormat(locale, { weekday: "short", month: "short", day: "numeric" }), [locale]);
69
+ const hintFmt = useMemo(() => new Intl.DateTimeFormat(locale, { weekday: "short", day: "numeric" }), [locale]);
70
+ const title = useMemo(() => new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }), [locale]);
71
+ const full = useMemo(() => new Intl.DateTimeFormat(locale, { weekday: "long", month: "long", day: "numeric", year: "numeric" }), [locale]);
72
+ const weekdays = useMemo(() => {
73
+ const f = new Intl.DateTimeFormat(locale, { weekday: "narrow" });
74
+ const l = new Intl.DateTimeFormat(locale, { weekday: "long" });
75
+ return Array.from({ length: 7 }, (_, i) => {
76
+ const d = new Date(2026, 10, 1 + (i + weekStartsOn) % 7);
77
+ return { s: f.format(d), l: l.format(d) };
78
+ });
79
+ }, [locale, weekStartsOn]);
80
+ const rel = useMemo(() => new Intl.RelativeTimeFormat(locale, { numeric: "auto" }), [locale]);
81
+ useEffect(() => () => clearTimeout(closeT.current), []);
82
+ useLayoutEffect(() => {
83
+ if (!open || !btn.current || !panel.current) return;
84
+ const { w, dx } = place(btn.current, 270);
85
+ panel.current.style.width = `${w}px`;
86
+ panel.current.style.left = `${dx}px`;
87
+ }, [open]);
88
+ useEffect(() => {
89
+ if (!open) return;
90
+ const onDown = (e) => {
91
+ if (!root.current?.contains(e.target)) setOpen(false);
92
+ };
93
+ document.addEventListener("pointerdown", onDown);
94
+ return () => document.removeEventListener("pointerdown", onDown);
95
+ }, [open]);
96
+ useEffect(() => {
97
+ if (!open || !wantFocus.current) return;
98
+ wantFocus.current = false;
99
+ const p = panel.current;
100
+ (p?.querySelector("[data-preset][aria-pressed=true]") ?? p?.querySelector("[data-preset]"))?.focus({ preventScroll: true });
101
+ }, [open]);
102
+ useEffect(() => {
103
+ if (open && steer.current) grid.current?.querySelector(`[data-day="${key(focus)}"]`)?.focus({ preventScroll: true });
104
+ }, [open, focus, view]);
105
+ const show = () => {
106
+ if (disabled || !btn.current) return;
107
+ clearTimeout(closeT.current);
108
+ setDown(place(btn.current, 270).down);
109
+ setView(month0(sel ?? today));
110
+ setFocus(sel ?? today);
111
+ setDir(0);
112
+ steer.current = false;
113
+ wantFocus.current = true;
114
+ setOpen(true);
115
+ };
116
+ const close = (refocus = true) => {
117
+ clearTimeout(closeT.current);
118
+ setOpen(false);
119
+ if (refocus) btn.current?.focus({ preventScroll: true });
120
+ };
121
+ const commit = (d, linger) => {
122
+ if (value === void 0) setInner(d);
123
+ onChange?.(d);
124
+ if (d) {
125
+ if (d.getMonth() !== view.getMonth() || d.getFullYear() !== view.getFullYear()) {
126
+ setDir(d > view ? 1 : -1);
127
+ setView(month0(d));
128
+ }
129
+ setFocus(d);
130
+ }
131
+ clearTimeout(closeT.current);
132
+ closeT.current = setTimeout(() => close(), linger ? 420 : 160);
133
+ };
134
+ const flip = (n) => {
135
+ setDir(n > 0 ? 1 : -1);
136
+ setView((v) => addMonths(v, n));
137
+ };
138
+ const moveTo = (d) => {
139
+ if (d.getMonth() !== view.getMonth() || d.getFullYear() !== view.getFullYear()) {
140
+ setDir(d > view ? 1 : -1);
141
+ setView(month0(d));
142
+ }
143
+ setFocus(d);
144
+ };
145
+ const onPanelKey = (e) => {
146
+ if (e.key === "Escape") {
147
+ e.preventDefault();
148
+ close();
149
+ return;
150
+ }
151
+ const n = Number(e.key);
152
+ if (n >= 1 && n <= presets.length && !e.metaKey && !e.ctrlKey) {
153
+ e.preventDefault();
154
+ commit(presets[n - 1].get(today), true);
155
+ }
156
+ };
157
+ const onPresetKey = (e) => {
158
+ const all = [...panel.current?.querySelectorAll("[data-preset]") ?? []];
159
+ const i = all.indexOf(e.currentTarget);
160
+ if (e.key === "ArrowDown") all[(i + 1) % all.length]?.focus();
161
+ else if (e.key === "ArrowUp") all[(i - 1 + all.length) % all.length]?.focus();
162
+ else if (e.key === "Home") all[0]?.focus();
163
+ else if (e.key === "End") all[all.length - 1]?.focus();
164
+ else return;
165
+ e.preventDefault();
166
+ };
167
+ const onGridKey = (e) => {
168
+ steer.current = true;
169
+ const dow = (focus.getDay() - weekStartsOn + 7) % 7;
170
+ if (e.key === "ArrowRight") moveTo(addDays(focus, 1));
171
+ else if (e.key === "ArrowLeft") moveTo(addDays(focus, -1));
172
+ else if (e.key === "ArrowDown") moveTo(addDays(focus, 7));
173
+ else if (e.key === "ArrowUp") moveTo(addDays(focus, -7));
174
+ else if (e.key === "Home") moveTo(addDays(focus, -dow));
175
+ else if (e.key === "End") moveTo(addDays(focus, 6 - dow));
176
+ else if (e.key === "PageDown") moveTo(new Date(focus.getFullYear(), focus.getMonth() + 1, Math.min(focus.getDate(), 28)));
177
+ else if (e.key === "PageUp") moveTo(new Date(focus.getFullYear(), focus.getMonth() - 1, Math.min(focus.getDate(), 28)));
178
+ else if (e.key === "Enter" || e.key === " ") commit(focus, false);
179
+ else return;
180
+ e.preventDefault();
181
+ };
182
+ const days = sel ? Math.round((sel.getTime() - today.getTime()) / 864e5) : null;
183
+ const relText = days === null ? "" : Math.abs(days) < 7 ? rel.format(days, "day") : rel.format(Math.round(days / 7), "week");
184
+ const text = sel ? fmt.format(sel) : "No date";
185
+ const lead = (view.getDay() - weekStartsOn + 7) % 7;
186
+ const cells = Array.from({ length: 42 }, (_, i) => addDays(view, i - lead));
187
+ const activePreset = presets.findIndex((p) => {
188
+ const d = p.get(today);
189
+ return d === null ? sel === null : same(d, sel);
190
+ });
191
+ return /* @__PURE__ */ jsxs("div", { ref: root, className: cx("aui051 relative inline-block", open && "z-40", className), children: [
192
+ /* @__PURE__ */ jsx("style", { href: "asta-aui051", precedence: "asta", children: CSS }),
193
+ /* @__PURE__ */ jsxs(
194
+ "button",
195
+ {
196
+ ref: btn,
197
+ type: "button",
198
+ disabled,
199
+ "aria-haspopup": "dialog",
200
+ "aria-expanded": open,
201
+ "aria-controls": open ? `${uid}-dlg` : void 0,
202
+ "aria-label": `${label}: ${sel ? full.format(sel) : "no date"}`,
203
+ onClick: () => open ? close(false) : show(),
204
+ onKeyDown: (e) => {
205
+ if (!open && e.key === "ArrowDown") {
206
+ e.preventDefault();
207
+ show();
208
+ }
209
+ },
210
+ className: cx(
211
+ "group flex h-10 items-center gap-2.5 rounded-[9px] bg-[color-mix(in_srgb,var(--paper)_8%,var(--ink))] pl-3 pr-2.5 text-left text-paper outline-none transition-[box-shadow,transform,background-color] duration-300 active:scale-[.98] disabled:cursor-not-allowed disabled:opacity-45",
212
+ "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--paper)_12%,transparent)] hover:bg-[color-mix(in_srgb,var(--paper)_12%,var(--ink))]",
213
+ "focus-visible:shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_30%,transparent)]",
214
+ open && "!shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_30%,transparent)]"
215
+ ),
216
+ children: [
217
+ /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: cx("h-4 w-4 shrink-0", sel ? "text-brand" : "text-[color-mix(in_srgb,var(--paper)_50%,transparent)]"), fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-hidden": true, children: [
218
+ /* @__PURE__ */ jsx("rect", { x: "2.5", y: "3.5", width: "11", height: "10", rx: "2" }),
219
+ /* @__PURE__ */ jsx("path", { d: "M2.5 6.5h11M5.5 2v3M10.5 2v3" })
220
+ ] }),
221
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-[10.5px] uppercase tracking-[0.08em] text-[color-mix(in_srgb,var(--paper)_50%,transparent)]", children: label }),
222
+ /* @__PURE__ */ jsxs("span", { className: "text-[13.5px] font-medium tabular-nums tracking-[-0.01em]", children: [
223
+ /* @__PURE__ */ jsx(Roll, { text }),
224
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: text })
225
+ ] }),
226
+ relText && /* @__PURE__ */ jsx("span", { className: "hidden text-[12px] text-[color-mix(in_srgb,var(--paper)_50%,transparent)] sm:inline", children: relText }),
227
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: cx("h-3.5 w-3.5 shrink-0 text-[color-mix(in_srgb,var(--paper)_50%,transparent)] transition-transform duration-300", open && "rotate-180"), fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m4 6 4 4 4-4" }) })
228
+ ]
229
+ }
230
+ ),
231
+ name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: sel ? key(sel) : "" }),
232
+ open && /* @__PURE__ */ jsx(
233
+ "div",
234
+ {
235
+ ref: panel,
236
+ id: `${uid}-dlg`,
237
+ role: "dialog",
238
+ "aria-label": `Choose ${label.toLowerCase()} date`,
239
+ onKeyDown: onPanelKey,
240
+ onBlur: (e) => !root.current?.contains(e.relatedTarget) && setOpen(false),
241
+ className: cx(
242
+ "@container absolute left-0 z-50 w-[440px] rounded-[14px] bg-ink p-2 text-paper",
243
+ "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--paper)_10%,transparent),0_24px_56px_-18px_rgb(0_0_0/0.55),0_4px_12px_-4px_rgb(0_0_0/0.3)]",
244
+ down ? "top-full mt-2 origin-top-left" : "bottom-full mb-2 origin-bottom-left [--aui051-y:6px]"
245
+ ),
246
+ style: { animation: `aui051-pop .32s ${EASE} both` },
247
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 @min-[400px]:flex-row", children: [
248
+ /* @__PURE__ */ jsx("ul", { className: "flex shrink-0 gap-1 overflow-x-auto [scrollbar-width:none] @min-[400px]:w-[164px] @min-[400px]:flex-col @min-[400px]:gap-0.5", "aria-label": "Presets", children: presets.map((p, i) => {
249
+ const d = p.get(today);
250
+ const on = i === activePreset;
251
+ return /* @__PURE__ */ jsx("li", { className: "shrink-0", style: { animation: `aui051-row .4s ${EASE} ${i * 30}ms both` }, children: /* @__PURE__ */ jsxs(
252
+ "button",
253
+ {
254
+ type: "button",
255
+ "data-preset": true,
256
+ "aria-pressed": on,
257
+ onKeyDown: onPresetKey,
258
+ onClick: () => commit(d, true),
259
+ className: cx(
260
+ "group/p flex h-[30px] w-full items-center gap-2.5 whitespace-nowrap rounded-[8px] px-2.5 text-left text-[13px] outline-none transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-brand/70",
261
+ on ? "bg-brand text-white" : "text-[color-mix(in_srgb,var(--paper)_82%,transparent)] hover:bg-[color-mix(in_srgb,var(--paper)_8%,transparent)] hover:text-paper focus-visible:bg-[color-mix(in_srgb,var(--paper)_8%,transparent)]"
262
+ ),
263
+ children: [
264
+ /* @__PURE__ */ jsx("span", { className: "flex-1", children: p.label }),
265
+ /* @__PURE__ */ jsx("span", { className: cx("hidden font-mono text-[10.5px] tabular-nums @min-[400px]:inline", on ? "text-white/75" : "text-[color-mix(in_srgb,var(--paper)_42%,transparent)]"), children: d ? hintFmt.format(d) : "\u2014" }),
266
+ /* @__PURE__ */ jsx("kbd", { className: cx("hidden h-4 min-w-4 items-center justify-center rounded-[4px] px-1 font-mono text-[9.5px] @min-[400px]:flex", on ? "bg-white/20 text-white" : "bg-[color-mix(in_srgb,var(--paper)_8%,transparent)] text-[color-mix(in_srgb,var(--paper)_50%,transparent)]"), children: i + 1 })
267
+ ]
268
+ }
269
+ ) }, p.label);
270
+ }) }),
271
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 rounded-[10px] bg-[color-mix(in_srgb,var(--paper)_5%,transparent)] p-2", children: [
272
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between pl-1.5", children: [
273
+ /* @__PURE__ */ jsx("p", { "aria-live": "polite", className: "text-[13px] font-medium tracking-[-0.01em]", children: title.format(view) }),
274
+ /* @__PURE__ */ jsx("div", { className: "flex", children: [-1, 1].map((d) => /* @__PURE__ */ jsx(
275
+ "button",
276
+ {
277
+ type: "button",
278
+ "aria-label": d === 1 ? "Next month" : "Previous month",
279
+ onClick: () => {
280
+ steer.current = false;
281
+ flip(d);
282
+ },
283
+ className: "flex h-7 w-7 items-center justify-center rounded-[7px] text-[color-mix(in_srgb,var(--paper)_70%,transparent)] outline-none transition-[background-color,transform] duration-150 hover:bg-[color-mix(in_srgb,var(--paper)_10%,transparent)] hover:text-paper focus-visible:ring-2 focus-visible:ring-brand/70 active:scale-90",
284
+ children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: d === 1 ? "m6 3.5 4.5 4.5L6 12.5" : "m10 3.5L5.5 8l4.5 4.5" }) })
285
+ },
286
+ d
287
+ )) })
288
+ ] }),
289
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7", "aria-hidden": true, children: weekdays.map((w) => /* @__PURE__ */ jsx("span", { className: "pb-1 text-center font-mono text-[10px] uppercase text-[color-mix(in_srgb,var(--paper)_40%,transparent)]", children: w.s }, w.l)) }),
290
+ /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx(
291
+ "div",
292
+ {
293
+ ref: grid,
294
+ role: "grid",
295
+ "aria-label": title.format(view),
296
+ onKeyDown: onGridKey,
297
+ className: cx("grid grid-cols-7", dir === 1 && "animate-[aui051-next_.36s_cubic-bezier(.16,1,.3,1)_both]", dir === -1 && "animate-[aui051-prev_.36s_cubic-bezier(.16,1,.3,1)_both]"),
298
+ children: cells.map((d) => {
299
+ const inMonth = d.getMonth() === view.getMonth();
300
+ const on = same(d, sel);
301
+ const isToday = same(d, today);
302
+ const isFocus = same(d, focus);
303
+ return /* @__PURE__ */ jsx("div", { role: "gridcell", "aria-selected": on || void 0, className: "flex justify-center", children: /* @__PURE__ */ jsxs(
304
+ "button",
305
+ {
306
+ type: "button",
307
+ "data-day": key(d),
308
+ tabIndex: isFocus ? 0 : -1,
309
+ "aria-label": full.format(d),
310
+ "aria-current": isToday ? "date" : void 0,
311
+ onClick: () => commit(d, false),
312
+ onFocus: () => !isFocus && setFocus(d),
313
+ className: cx(
314
+ "relative flex h-7 w-8 items-center justify-center rounded-[7px] text-[12.5px] tabular-nums outline-none transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-brand/70",
315
+ on ? "font-medium text-white" : inMonth ? "text-paper hover:bg-[color-mix(in_srgb,var(--paper)_10%,transparent)]" : "text-[color-mix(in_srgb,var(--paper)_32%,transparent)] hover:bg-[color-mix(in_srgb,var(--paper)_8%,transparent)]"
316
+ ),
317
+ children: [
318
+ on && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute inset-0 rounded-[7px] bg-brand shadow-[0_0_18px_-2px_color-mix(in_srgb,var(--brand)_75%,transparent)]", style: { animation: `aui051-dot .42s ${EASE} both` } }),
319
+ /* @__PURE__ */ jsx("span", { className: "relative", children: d.getDate() }),
320
+ isToday && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cx("absolute bottom-1 left-1/2 h-[3px] w-[3px] -translate-x-1/2 rounded-full", on ? "bg-white" : "bg-brand") })
321
+ ]
322
+ }
323
+ ) }, key(d));
324
+ })
325
+ },
326
+ key(view)
327
+ ) })
328
+ ] })
329
+ ] })
330
+ }
331
+ )
332
+ ] });
333
+ }
334
+ var date_picker_aui_051_default = PresetDatePicker;
335
+
336
+ export {
337
+ PresetDatePicker,
338
+ date_picker_aui_051_default
339
+ };
@@ -0,0 +1,156 @@
1
+ "use client";
2
+
3
+ // components/kit/variants/switch-aui-060.tsx
4
+ import { useId, 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 aui060-rise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
11
+ @keyframes aui060-bar { from { transform: scaleY(0) } to { transform: scaleY(1) } }
12
+ @media (prefers-reduced-motion: reduce) { .aui060 * { animation: none !important; transition: none !important } }
13
+ `;
14
+ var rise = (i) => ({ animation: `aui060-rise .6s ${EASE} ${80 + i * 55}ms both` });
15
+ var BARS = [0.42, 0.6, 0.5, 0.78, 0.66, 0.92, 0.7];
16
+ var DAYS = ["M", "T", "W", "T", "F", "S", "S"];
17
+ var CX = 48;
18
+ var CY = 35;
19
+ var R = 640;
20
+ function Face({ tone, person }) {
21
+ const dark = tone === "dark";
22
+ const mute = dark ? "text-paper/50" : "text-mute";
23
+ const fg = dark ? "text-paper" : "text-ink";
24
+ const surface = dark ? "bg-paper/[0.07]" : "bg-paper-2";
25
+ return /* @__PURE__ */ jsxs("div", { className: cx("p-5 sm:p-6", fg), children: [
26
+ /* @__PURE__ */ jsxs("div", { className: "pr-20", style: rise(0), children: [
27
+ /* @__PURE__ */ jsxs("p", { className: cx("font-mono text-[11px] uppercase tracking-[0.08em]", mute), children: [
28
+ "Astabyte \xB7 ",
29
+ dark ? "Dark" : "Light"
30
+ ] }),
31
+ /* @__PURE__ */ jsxs("p", { className: "mt-1.5 text-[20px] font-medium leading-tight tracking-[-0.02em]", children: [
32
+ "Good ",
33
+ dark ? "evening" : "morning",
34
+ ", ",
35
+ person
36
+ ] })
37
+ ] }),
38
+ /* @__PURE__ */ jsx("div", { className: cx("mt-5 rounded-[11px] p-4", surface), style: rise(1), children: /* @__PURE__ */ jsxs("div", { className: "flex items-end justify-between gap-4", children: [
39
+ /* @__PURE__ */ jsxs("div", { children: [
40
+ /* @__PURE__ */ jsx("p", { className: cx("text-[12px]", mute), children: "Paid this week" }),
41
+ /* @__PURE__ */ jsxs("p", { className: "mt-1 text-[28px] font-medium leading-none tracking-[-0.04em]", children: [
42
+ /* @__PURE__ */ jsx("span", { className: cx("mr-0.5 align-top text-[13px] tracking-normal", mute), children: "$" }),
43
+ "9,640"
44
+ ] })
45
+ ] }),
46
+ /* @__PURE__ */ jsx("div", { className: "flex h-12 items-end gap-1.5", "aria-hidden": true, children: BARS.map((b, i) => /* @__PURE__ */ jsxs("span", { className: "flex flex-col items-center gap-1", children: [
47
+ /* @__PURE__ */ jsx("span", { className: "flex h-9 w-2 items-end", children: /* @__PURE__ */ jsx("span", { className: cx("block w-full origin-bottom rounded-[3px]", i === 5 ? "bg-brand" : dark ? "bg-paper/25" : "bg-[color-mix(in_srgb,var(--ink)_16%,transparent)]"), style: { height: `${b * 100}%`, animation: `aui060-bar .7s ${EASE} ${200 + i * 40}ms both` } }) }),
48
+ /* @__PURE__ */ jsx("span", { className: cx("text-[9px] leading-none", mute), children: DAYS[i] })
49
+ ] }, i)) })
50
+ ] }) }),
51
+ /* @__PURE__ */ jsx("ul", { className: "mt-3 space-y-1", style: rise(2), children: [
52
+ ["Invoice 1042", "Design studio", "Paid"],
53
+ ["Invoice 1043", "Coffee roaster", "Due Fri"]
54
+ ].map(([a, b, c], i) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3 py-1.5", children: [
55
+ /* @__PURE__ */ jsx("span", { className: cx("grid h-7 w-7 place-items-center rounded-[7px] text-[10.5px] font-medium", surface), children: b[0] }),
56
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
57
+ /* @__PURE__ */ jsx("span", { className: "block text-[13.5px]", children: a }),
58
+ /* @__PURE__ */ jsx("span", { className: cx("block text-[12px]", mute), children: b })
59
+ ] }),
60
+ /* @__PURE__ */ jsx("span", { className: cx("text-[12px] font-medium", i === 0 ? dark ? "text-[color-mix(in_srgb,var(--brand)_55%,var(--paper))]" : "text-brand" : mute), children: c })
61
+ ] }, a)) })
62
+ ] });
63
+ }
64
+ function ThemeSwitch({ theme, defaultTheme = "light", onThemeChange, person = "Maya", className }) {
65
+ const uid = useId();
66
+ const [inner, setInner] = useState(defaultTheme);
67
+ const current = theme ?? inner;
68
+ const dark = current === "dark";
69
+ const flip = () => {
70
+ const next = dark ? "light" : "dark";
71
+ if (theme === void 0) setInner(next);
72
+ onThemeChange?.(next);
73
+ };
74
+ return /* @__PURE__ */ jsxs(
75
+ "div",
76
+ {
77
+ className: cx(
78
+ "aui060 relative isolate w-full max-w-[400px] overflow-hidden rounded-[14px] bg-paper",
79
+ "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.3)]",
80
+ className
81
+ ),
82
+ children: [
83
+ /* @__PURE__ */ jsx("style", { href: "asta-aui060", precedence: "asta", children: CSS }),
84
+ /* @__PURE__ */ jsx("div", { "aria-hidden": dark, children: /* @__PURE__ */ jsx(Face, { tone: "light", person }) }),
85
+ /* @__PURE__ */ jsxs("div", { "aria-hidden": !dark, className: "pointer-events-none absolute inset-0", children: [
86
+ /* @__PURE__ */ jsx(
87
+ "span",
88
+ {
89
+ className: "absolute rounded-full bg-ink transition-transform duration-700",
90
+ style: { width: R * 2, height: R * 2, right: CX - R, top: CY - R, transform: `scale(${dark ? 1 : 0})`, transitionTimingFunction: EASE }
91
+ }
92
+ ),
93
+ /* @__PURE__ */ jsx("div", { className: "relative transition-opacity", style: { opacity: dark ? 1 : 0, transitionDuration: dark ? "500ms" : "200ms", transitionDelay: dark ? "160ms" : "0ms" }, children: /* @__PURE__ */ jsx(Face, { tone: "dark", person }) })
94
+ ] }),
95
+ /* @__PURE__ */ jsxs(
96
+ "button",
97
+ {
98
+ type: "button",
99
+ role: "switch",
100
+ "aria-checked": dark,
101
+ "aria-label": "Dark mode",
102
+ "aria-describedby": `${uid}-s`,
103
+ onClick: flip,
104
+ className: cx(
105
+ "group/sw absolute right-5 top-5 z-10 h-[30px] w-[56px] rounded-full outline-none transition-transform duration-200 active:scale-[0.96] sm:right-6 sm:top-6",
106
+ "focus-visible:ring-2 focus-visible:ring-brand/60 focus-visible:ring-offset-2",
107
+ dark ? "focus-visible:ring-offset-ink" : "focus-visible:ring-offset-paper"
108
+ ),
109
+ style: { animation: `aui060-rise .6s ${EASE} 120ms both` },
110
+ children: [
111
+ /* @__PURE__ */ jsx("span", { id: `${uid}-s`, className: "sr-only", children: dark ? "Dark theme on" : "Light theme on" }),
112
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute inset-0 rounded-full bg-[color-mix(in_srgb,var(--ink)_8%,var(--paper))] shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent),inset_0_1px_2px_rgb(0_0_0/0.06)]" }),
113
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute inset-0 rounded-full bg-[color-mix(in_srgb,var(--paper)_14%,var(--ink))] shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--paper)_14%,transparent)] transition-opacity duration-500", style: { opacity: dark ? 1 : 0 } }),
114
+ [
115
+ [9, 9, 0],
116
+ [16, 17, 80],
117
+ [8, 20, 140]
118
+ ].map(([x, y, d], i) => /* @__PURE__ */ jsx(
119
+ "span",
120
+ {
121
+ "aria-hidden": true,
122
+ className: "absolute h-[3px] w-[3px] rounded-full bg-paper transition-[transform,opacity] duration-500",
123
+ style: { left: x, top: y, opacity: dark ? 0.9 : 0, transform: dark ? "scale(1)" : "scale(0)", transitionDelay: dark ? `${200 + d}ms` : "0ms", transitionTimingFunction: SPRING }
124
+ },
125
+ i
126
+ )),
127
+ /* @__PURE__ */ jsxs(
128
+ "span",
129
+ {
130
+ "aria-hidden": true,
131
+ className: "absolute left-[3px] top-[3px] grid h-6 w-6 place-items-center rounded-full shadow-[0_1px_2px_rgb(0_0_0/0.25),0_3px_8px_-2px_rgb(0_0_0/0.3)] transition-transform duration-500",
132
+ style: { transform: `translateX(${dark ? 26 : 0}px) rotate(${dark ? 360 : 0}deg)`, transitionTimingFunction: SPRING },
133
+ children: [
134
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 rounded-full bg-white" }),
135
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 rounded-full bg-[color-mix(in_srgb,var(--brand)_14%,white)] transition-opacity duration-500", style: { opacity: dark ? 1 : 0 } }),
136
+ /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "absolute h-3.5 w-3.5 text-ink transition-[transform,opacity] duration-500", style: { opacity: dark ? 0 : 1, transform: dark ? "scale(.4) rotate(-90deg)" : "none", transitionTimingFunction: EASE }, fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", children: [
137
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "2.8" }),
138
+ /* @__PURE__ */ jsx("path", { d: "M8 1.5v1.4M8 13.1v1.4M1.5 8h1.4M13.1 8h1.4M3.4 3.4l1 1M11.6 11.6l1 1M3.4 12.6l1-1M11.6 4.4l1-1" })
139
+ ] }),
140
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "absolute h-3.5 w-3.5 text-brand transition-[transform,opacity] duration-500", style: { opacity: dark ? 1 : 0, transform: dark ? "none" : "scale(.4) rotate(90deg)", transitionTimingFunction: EASE }, fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M13.3 10.1A5.6 5.6 0 015.9 2.7a5.6 5.6 0 107.4 7.4z" }) })
141
+ ]
142
+ }
143
+ )
144
+ ]
145
+ }
146
+ )
147
+ ]
148
+ }
149
+ );
150
+ }
151
+ var switch_aui_060_default = ThemeSwitch;
152
+
153
+ export {
154
+ ThemeSwitch,
155
+ switch_aui_060_default
156
+ };
@@ -0,0 +1,142 @@
1
+ "use client";
2
+
3
+ // components/kit/variants/checkbox-aui-053.tsx
4
+ import { useEffect, useId, useLayoutEffect, 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 aui053-rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
11
+ @media (prefers-reduced-motion: reduce) { .aui053 * { animation: none !important; transition: none !important } }
12
+ `;
13
+ var rise = (i) => ({ animation: `aui053-rise .6s ${EASE} ${80 + i * 50}ms both` });
14
+ var TASKS = [
15
+ { id: "copy", title: "Final pass on launch copy", meta: "Due 11:00", owner: "MS" },
16
+ { id: "og", title: "Export social cards", meta: "Due 13:30", owner: "RA" },
17
+ { id: "dns", title: "Point the domain to the new build", meta: "Due 15:00", owner: "DK" },
18
+ { id: "mail", title: "Schedule the announcement email", meta: "Due 16:00", owner: "MS" },
19
+ { id: "brief", title: "Write the kickoff brief", meta: "Done yesterday", owner: "RA" }
20
+ ];
21
+ var prefersReduced = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
22
+ function TaskCheckbox({ tasks = TASKS, done: doneProp, defaultDone = ["brief"], onChange, eyebrow = "Astabyte \xB7 Thu 19 Nov", title = "Launch day", className }) {
23
+ const uid = useId();
24
+ const [inner, setInner] = useState(defaultDone);
25
+ const done = doneProp ?? inner;
26
+ const doneKey = done.join("|");
27
+ const [order, setOrder] = useState(() => [...tasks.filter((t) => !done.includes(t.id)), ...tasks.filter((t) => done.includes(t.id))].map((t) => t.id));
28
+ const settled = useRef(done);
29
+ const rows = useRef(/* @__PURE__ */ new Map());
30
+ const last = useRef(/* @__PURE__ */ new Map());
31
+ useEffect(() => {
32
+ const now = doneKey ? doneKey.split("|") : [];
33
+ const t = setTimeout(() => {
34
+ const prev = settled.current;
35
+ settled.current = now;
36
+ setOrder((o) => {
37
+ const open = o.filter((x) => !now.includes(x));
38
+ const kept = o.filter((x) => now.includes(x) && prev.includes(x));
39
+ const fresh = o.filter((x) => now.includes(x) && !prev.includes(x));
40
+ return [...open, ...kept, ...fresh];
41
+ });
42
+ }, 480);
43
+ return () => clearTimeout(t);
44
+ }, [doneKey]);
45
+ useLayoutEffect(() => {
46
+ const reduce = prefersReduced();
47
+ rows.current.forEach((el, id) => {
48
+ const top = el.offsetTop;
49
+ const was = last.current.get(id);
50
+ if (was !== void 0 && was !== top && !reduce) {
51
+ el.animate([{ transform: `translateY(${was - top}px)` }, { transform: "none" }], { duration: 560, easing: EASE });
52
+ }
53
+ last.current.set(id, top);
54
+ });
55
+ }, [order]);
56
+ const toggle = (id) => {
57
+ const next = done.includes(id) ? done.filter((x) => x !== id) : [...done, id];
58
+ if (doneProp === void 0) setInner(next);
59
+ onChange?.(next);
60
+ };
61
+ const byId = new Map(tasks.map((t) => [t.id, t]));
62
+ const count = done.filter((d) => byId.has(d)).length;
63
+ return /* @__PURE__ */ jsxs(
64
+ "section",
65
+ {
66
+ "aria-labelledby": `${uid}-t`,
67
+ className: cx(
68
+ "aui053 w-full max-w-[420px] rounded-[14px] bg-paper p-5 sm:p-6",
69
+ "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)]",
70
+ className
71
+ ),
72
+ children: [
73
+ /* @__PURE__ */ jsx("style", { href: "asta-aui053", precedence: "asta", children: CSS }),
74
+ /* @__PURE__ */ jsxs("div", { style: rise(0), children: [
75
+ /* @__PURE__ */ jsxs("div", { className: "flex items-end justify-between gap-4", children: [
76
+ /* @__PURE__ */ jsxs("div", { children: [
77
+ /* @__PURE__ */ jsx("p", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-mute", children: eyebrow }),
78
+ /* @__PURE__ */ jsx("h3", { id: `${uid}-t`, className: "mt-1.5 text-[20px] font-medium leading-tight tracking-[-0.02em] text-ink", children: title })
79
+ ] }),
80
+ /* @__PURE__ */ jsxs("p", { className: "pb-0.5 text-[13px] tabular-nums text-mute", "aria-live": "polite", children: [
81
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-ink", children: count }),
82
+ " of ",
83
+ tasks.length,
84
+ " done"
85
+ ] })
86
+ ] }),
87
+ /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "mt-4 h-1 overflow-hidden rounded-full bg-[color-mix(in_srgb,var(--ink)_8%,transparent)]", children: /* @__PURE__ */ jsx("div", { className: "h-full origin-left rounded-full bg-brand transition-transform duration-700", style: { transform: `scaleX(${tasks.length ? count / tasks.length : 0})`, transitionTimingFunction: EASE } }) })
88
+ ] }),
89
+ /* @__PURE__ */ jsx("ul", { className: "relative mt-3 -mx-2", children: order.map((id) => {
90
+ const t = byId.get(id);
91
+ if (!t) return null;
92
+ const on = done.includes(id);
93
+ const cid = `${uid}-${id}`;
94
+ return /* @__PURE__ */ jsx(
95
+ "li",
96
+ {
97
+ ref: (el) => {
98
+ if (el) rows.current.set(id, el);
99
+ else rows.current.delete(id);
100
+ },
101
+ className: "relative",
102
+ children: /* @__PURE__ */ jsxs("label", { htmlFor: cid, style: rise(tasks.indexOf(t) + 1), className: "group/task relative flex cursor-pointer select-none items-center gap-3 rounded-[10px] px-2 py-2.5 has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-brand", children: [
103
+ /* @__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/task:opacity-70" }),
104
+ /* @__PURE__ */ jsx("input", { id: cid, type: "checkbox", checked: on, onChange: () => toggle(id), className: "sr-only" }),
105
+ /* @__PURE__ */ jsx(Circle, { on }),
106
+ /* @__PURE__ */ jsxs("span", { className: "relative min-w-0 flex-1", children: [
107
+ /* @__PURE__ */ jsxs("span", { className: "relative inline-block max-w-full align-top", children: [
108
+ /* @__PURE__ */ jsx("span", { className: "block truncate text-[14px] tracking-[-0.01em] text-ink transition-opacity duration-500", style: { opacity: on ? 0.42 : 1 }, children: t.title }),
109
+ /* @__PURE__ */ jsx(
110
+ "span",
111
+ {
112
+ "aria-hidden": true,
113
+ className: "absolute inset-x-0 top-1/2 h-[1.5px] origin-left rounded-full bg-ink transition-transform",
114
+ style: { transform: `scaleX(${on ? 1 : 0})`, opacity: 0.55, transitionDuration: on ? "420ms" : "220ms", transitionTimingFunction: EASE }
115
+ }
116
+ )
117
+ ] }),
118
+ t.meta && /* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-[12px] text-mute", children: t.meta })
119
+ ] }),
120
+ t.owner && /* @__PURE__ */ jsx("span", { "aria-label": `Owner ${t.owner}`, className: "relative grid h-6 w-6 shrink-0 place-items-center rounded-full bg-paper-2 text-[10px] font-medium tracking-[0.02em] text-ink shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_8%,transparent)] transition-opacity duration-500", style: { opacity: on ? 0.5 : 1 }, children: t.owner })
121
+ ] })
122
+ },
123
+ id
124
+ );
125
+ }) })
126
+ ]
127
+ }
128
+ );
129
+ }
130
+ function Circle({ on }) {
131
+ return /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "relative grid h-[18px] w-[18px] shrink-0 place-items-center", children: [
132
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 rounded-full shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--ink)_24%,transparent)] transition-opacity duration-200 group-hover/task:shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--ink)_42%,transparent)]", style: { opacity: on ? 0 : 1 } }),
133
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 rounded-full bg-brand transition-[transform,opacity] duration-500", style: { transform: on ? "scale(1)" : "scale(0.3)", opacity: on ? 1 : 0, transitionTimingFunction: SPRING } }),
134
+ /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "relative h-[11px] w-[11px] text-white", fill: "none", stroke: "currentColor", strokeWidth: "2.6", 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: on ? 0 : 1, transitionDuration: on ? "380ms" : "100ms", transitionDelay: on ? "100ms" : "0ms", transitionTimingFunction: EASE } }) })
135
+ ] });
136
+ }
137
+ var checkbox_aui_053_default = TaskCheckbox;
138
+
139
+ export {
140
+ TaskCheckbox,
141
+ checkbox_aui_053_default
142
+ };