@epilot/spark-ui 0.31.1 → 0.32.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 (384) hide show
  1. package/dist/button-B_RNHEc7.d.ts +52 -0
  2. package/dist/button-DBcEcIMk.d.cts +52 -0
  3. package/dist/cn-DzRH6EW_.d.cts +4 -0
  4. package/dist/cn-DzRH6EW_.d.ts +4 -0
  5. package/dist/components/accordion.cjs +1 -1
  6. package/dist/components/accordion.js +1 -1
  7. package/dist/components/alert-dialog.cjs +1 -1
  8. package/dist/components/alert-dialog.d.cts +1 -1
  9. package/dist/components/alert-dialog.d.ts +1 -1
  10. package/dist/components/alert-dialog.js +1 -1
  11. package/dist/components/attachment.cjs +2 -2
  12. package/dist/components/attachment.d.cts +3 -3
  13. package/dist/components/attachment.d.ts +3 -3
  14. package/dist/components/attachment.js +2 -2
  15. package/dist/components/autocomplete.cjs +9 -7
  16. package/dist/components/autocomplete.cjs.map +1 -1
  17. package/dist/components/autocomplete.d.cts +4 -10
  18. package/dist/components/autocomplete.d.ts +4 -10
  19. package/dist/components/autocomplete.js +9 -7
  20. package/dist/components/autocomplete.js.map +1 -1
  21. package/dist/components/avatar.js +1 -1
  22. package/dist/components/badge.cjs +1 -1
  23. package/dist/components/badge.js +2 -2
  24. package/dist/components/banner.cjs +1 -1
  25. package/dist/components/banner.js +1 -1
  26. package/dist/components/bar-chart.cjs +1 -1
  27. package/dist/components/bar-chart.js +2 -2
  28. package/dist/components/box.cjs +2 -2
  29. package/dist/components/box.cjs.map +1 -1
  30. package/dist/components/box.js +3 -3
  31. package/dist/components/box.js.map +1 -1
  32. package/dist/components/breadcrumbs.cjs +1 -1
  33. package/dist/components/breadcrumbs.js +1 -1
  34. package/dist/components/bubble.cjs +2 -2
  35. package/dist/components/bubble.d.cts +2 -2
  36. package/dist/components/bubble.d.ts +2 -2
  37. package/dist/components/bubble.js +2 -2
  38. package/dist/components/button-group.cjs +1 -1
  39. package/dist/components/button-group.js +2 -2
  40. package/dist/components/button.cjs +13 -30
  41. package/dist/components/button.cjs.map +1 -1
  42. package/dist/components/button.d.cts +3 -36
  43. package/dist/components/button.d.ts +3 -36
  44. package/dist/components/button.js +14 -31
  45. package/dist/components/button.js.map +1 -1
  46. package/dist/components/calendar.cjs +32 -4
  47. package/dist/components/calendar.cjs.map +1 -1
  48. package/dist/components/calendar.d.cts +2 -2
  49. package/dist/components/calendar.d.ts +2 -2
  50. package/dist/components/calendar.js +34 -6
  51. package/dist/components/calendar.js.map +1 -1
  52. package/dist/components/callout.cjs +1 -1
  53. package/dist/components/callout.d.cts +1 -1
  54. package/dist/components/callout.d.ts +1 -1
  55. package/dist/components/callout.js +1 -1
  56. package/dist/components/card.cjs +6 -5
  57. package/dist/components/card.cjs.map +1 -1
  58. package/dist/components/card.d.cts +9 -8
  59. package/dist/components/card.d.ts +9 -8
  60. package/dist/components/card.js +7 -6
  61. package/dist/components/card.js.map +1 -1
  62. package/dist/components/checkbox-card.cjs +157 -65
  63. package/dist/components/checkbox-card.cjs.map +1 -1
  64. package/dist/components/checkbox-card.d.cts +38 -18
  65. package/dist/components/checkbox-card.d.ts +38 -18
  66. package/dist/components/checkbox-card.js +155 -66
  67. package/dist/components/checkbox-card.js.map +1 -1
  68. package/dist/components/checkbox-group.cjs +1 -1
  69. package/dist/components/checkbox-group.js +2 -2
  70. package/dist/components/checkbox.cjs +5 -18
  71. package/dist/components/checkbox.cjs.map +1 -1
  72. package/dist/components/checkbox.js +7 -20
  73. package/dist/components/checkbox.js.map +1 -1
  74. package/dist/components/combobox.cjs +2 -1
  75. package/dist/components/combobox.cjs.map +1 -1
  76. package/dist/components/combobox.js +2 -1
  77. package/dist/components/combobox.js.map +1 -1
  78. package/dist/components/dialog.cjs +1 -1
  79. package/dist/components/dialog.js +1 -1
  80. package/dist/components/drawer.cjs +1 -1
  81. package/dist/components/drawer.js +1 -1
  82. package/dist/components/dropdown-menu.cjs +1 -1
  83. package/dist/components/dropdown-menu.js +1 -1
  84. package/dist/components/dropzone.cjs +224 -0
  85. package/dist/components/dropzone.cjs.map +1 -0
  86. package/dist/components/dropzone.d.cts +66 -0
  87. package/dist/components/dropzone.d.ts +66 -0
  88. package/dist/components/dropzone.js +215 -0
  89. package/dist/components/dropzone.js.map +1 -0
  90. package/dist/components/empty-state.cjs +1 -1
  91. package/dist/components/empty-state.d.cts +1 -1
  92. package/dist/components/empty-state.d.ts +1 -1
  93. package/dist/components/empty-state.js +1 -1
  94. package/dist/components/entity-card.cjs +1 -1
  95. package/dist/components/entity-card.js +1 -1
  96. package/dist/components/field.cjs +69 -11
  97. package/dist/components/field.cjs.map +1 -1
  98. package/dist/components/field.d.cts +16 -3
  99. package/dist/components/field.d.ts +16 -3
  100. package/dist/components/field.js +68 -11
  101. package/dist/components/field.js.map +1 -1
  102. package/dist/components/hero-metric.cjs +1 -1
  103. package/dist/components/hero-metric.js +1 -1
  104. package/dist/components/icon.js +1 -1
  105. package/dist/components/image-carousel.cjs +183 -0
  106. package/dist/components/image-carousel.cjs.map +1 -0
  107. package/dist/components/image-carousel.d.cts +54 -0
  108. package/dist/components/image-carousel.d.ts +54 -0
  109. package/dist/components/image-carousel.js +174 -0
  110. package/dist/components/image-carousel.js.map +1 -0
  111. package/dist/components/info-block.cjs +1 -1
  112. package/dist/components/info-block.d.cts +1 -1
  113. package/dist/components/info-block.d.ts +1 -1
  114. package/dist/components/info-block.js +1 -1
  115. package/dist/components/input-date-time.cjs +16 -202
  116. package/dist/components/input-date-time.cjs.map +1 -1
  117. package/dist/components/input-date-time.d.cts +14 -31
  118. package/dist/components/input-date-time.d.ts +14 -31
  119. package/dist/components/input-date-time.js +15 -202
  120. package/dist/components/input-date-time.js.map +1 -1
  121. package/dist/components/input-date.cjs +14 -146
  122. package/dist/components/input-date.cjs.map +1 -1
  123. package/dist/components/input-date.d.cts +11 -19
  124. package/dist/components/input-date.d.ts +11 -19
  125. package/dist/components/input-date.js +13 -146
  126. package/dist/components/input-date.js.map +1 -1
  127. package/dist/components/input-group.cjs +4 -3
  128. package/dist/components/input-group.cjs.map +1 -1
  129. package/dist/components/input-group.d.cts +2 -30
  130. package/dist/components/input-group.d.ts +2 -30
  131. package/dist/components/input-group.js +3 -2
  132. package/dist/components/input-group.js.map +1 -1
  133. package/dist/components/input-otp.cjs +3 -3
  134. package/dist/components/input-otp.cjs.map +1 -1
  135. package/dist/components/input-otp.js +3 -3
  136. package/dist/components/input-otp.js.map +1 -1
  137. package/dist/components/input.cjs +4 -2
  138. package/dist/components/input.cjs.map +1 -1
  139. package/dist/components/input.d.cts +2 -12
  140. package/dist/components/input.d.ts +2 -12
  141. package/dist/components/input.js +4 -2
  142. package/dist/components/input.js.map +1 -1
  143. package/dist/components/line-chart.cjs +2 -2
  144. package/dist/components/line-chart.js +3 -3
  145. package/dist/components/list.cjs +2 -2
  146. package/dist/components/list.js +2 -2
  147. package/dist/components/marker.cjs +2 -2
  148. package/dist/components/marker.d.cts +1 -1
  149. package/dist/components/marker.d.ts +1 -1
  150. package/dist/components/marker.js +2 -2
  151. package/dist/components/message-scroller.cjs +1 -1
  152. package/dist/components/message-scroller.d.cts +1 -1
  153. package/dist/components/message-scroller.d.ts +1 -1
  154. package/dist/components/message-scroller.js +2 -2
  155. package/dist/components/page-header.cjs +1 -1
  156. package/dist/components/page-header.d.cts +2 -2
  157. package/dist/components/page-header.d.ts +2 -2
  158. package/dist/components/page-header.js +1 -1
  159. package/dist/components/pagination.cjs +124 -0
  160. package/dist/components/pagination.cjs.map +1 -0
  161. package/dist/components/pagination.d.cts +42 -0
  162. package/dist/components/pagination.d.ts +42 -0
  163. package/dist/components/pagination.js +115 -0
  164. package/dist/components/pagination.js.map +1 -0
  165. package/dist/components/period-tabs.cjs +1 -1
  166. package/dist/components/period-tabs.d.cts +1 -1
  167. package/dist/components/period-tabs.d.ts +1 -1
  168. package/dist/components/period-tabs.js +1 -1
  169. package/dist/components/pill.cjs +43 -24
  170. package/dist/components/pill.cjs.map +1 -1
  171. package/dist/components/pill.d.cts +13 -3
  172. package/dist/components/pill.d.ts +13 -3
  173. package/dist/components/pill.js +44 -26
  174. package/dist/components/pill.js.map +1 -1
  175. package/dist/components/popover.cjs +1 -1
  176. package/dist/components/popover.d.cts +2 -29
  177. package/dist/components/popover.d.ts +2 -29
  178. package/dist/components/popover.js +1 -1
  179. package/dist/components/power-history-chart.cjs +2 -2
  180. package/dist/components/power-history-chart.js +3 -3
  181. package/dist/components/power-network.cjs +1 -1
  182. package/dist/components/power-network.js +2 -2
  183. package/dist/components/progress.cjs +126 -13
  184. package/dist/components/progress.cjs.map +1 -1
  185. package/dist/components/progress.d.cts +19 -10
  186. package/dist/components/progress.d.ts +19 -10
  187. package/dist/components/progress.js +126 -15
  188. package/dist/components/progress.js.map +1 -1
  189. package/dist/components/radio-card-group.cjs +137 -70
  190. package/dist/components/radio-card-group.cjs.map +1 -1
  191. package/dist/components/radio-card-group.d.cts +37 -15
  192. package/dist/components/radio-card-group.d.ts +37 -15
  193. package/dist/components/radio-card-group.js +135 -71
  194. package/dist/components/radio-card-group.js.map +1 -1
  195. package/dist/components/radio.cjs +1 -1
  196. package/dist/components/radio.js +2 -2
  197. package/dist/components/schedule-list.cjs +1 -1
  198. package/dist/components/schedule-list.js +1 -1
  199. package/dist/components/select.cjs +11 -4
  200. package/dist/components/select.cjs.map +1 -1
  201. package/dist/components/select.d.cts +1 -0
  202. package/dist/components/select.d.ts +1 -0
  203. package/dist/components/select.js +11 -4
  204. package/dist/components/select.js.map +1 -1
  205. package/dist/components/separator.cjs +1 -1
  206. package/dist/components/separator.js +1 -1
  207. package/dist/components/sheet.cjs +1 -1
  208. package/dist/components/sheet.js +1 -1
  209. package/dist/components/skeleton.cjs +1 -1
  210. package/dist/components/skeleton.js +1 -1
  211. package/dist/components/solar-forecast-chart.js +1 -1
  212. package/dist/components/spark-home.js +1 -1
  213. package/dist/components/step-indicator.cjs +128 -0
  214. package/dist/components/step-indicator.cjs.map +1 -0
  215. package/dist/components/step-indicator.d.cts +25 -0
  216. package/dist/components/step-indicator.d.ts +25 -0
  217. package/dist/components/step-indicator.js +124 -0
  218. package/dist/components/step-indicator.js.map +1 -0
  219. package/dist/components/stepper.cjs +3 -2
  220. package/dist/components/stepper.cjs.map +1 -1
  221. package/dist/components/stepper.d.cts +1 -2
  222. package/dist/components/stepper.d.ts +1 -2
  223. package/dist/components/stepper.js +3 -2
  224. package/dist/components/stepper.js.map +1 -1
  225. package/dist/components/switch-group.cjs +1 -1
  226. package/dist/components/switch-group.js +2 -2
  227. package/dist/components/switch.js +1 -1
  228. package/dist/components/table.cjs +1 -1
  229. package/dist/components/table.js +1 -1
  230. package/dist/components/tabs.cjs +3 -3
  231. package/dist/components/tabs.cjs.map +1 -1
  232. package/dist/components/tabs.js +2 -2
  233. package/dist/components/tabs.js.map +1 -1
  234. package/dist/components/textarea.cjs +8 -2
  235. package/dist/components/textarea.cjs.map +1 -1
  236. package/dist/components/textarea.js +8 -2
  237. package/dist/components/textarea.js.map +1 -1
  238. package/dist/components/theme.cjs +1 -1
  239. package/dist/components/theme.js +2 -2
  240. package/dist/components/time-picker.cjs +3 -38
  241. package/dist/components/time-picker.cjs.map +1 -1
  242. package/dist/components/time-picker.js +1 -36
  243. package/dist/components/time-picker.js.map +1 -1
  244. package/dist/components/toast.cjs +1 -1
  245. package/dist/components/toast.js +1 -1
  246. package/dist/components/toggle-group.js +1 -1
  247. package/dist/components/toggle.d.cts +1 -1
  248. package/dist/components/toggle.d.ts +1 -1
  249. package/dist/components/toggle.js +1 -1
  250. package/dist/components/tooltip.cjs +3 -2
  251. package/dist/components/tooltip.cjs.map +1 -1
  252. package/dist/components/tooltip.d.cts +3 -2
  253. package/dist/components/tooltip.d.ts +3 -2
  254. package/dist/components/tooltip.js +3 -2
  255. package/dist/components/tooltip.js.map +1 -1
  256. package/dist/components/trace.cjs +1 -1
  257. package/dist/components/trace.js +1 -1
  258. package/dist/hooks/use-isomorphic-layout-effect.cjs +9 -0
  259. package/dist/hooks/use-isomorphic-layout-effect.cjs.map +1 -0
  260. package/dist/hooks/use-isomorphic-layout-effect.d.cts +9 -0
  261. package/dist/hooks/use-isomorphic-layout-effect.d.ts +9 -0
  262. package/dist/hooks/use-isomorphic-layout-effect.js +8 -0
  263. package/dist/hooks/use-isomorphic-layout-effect.js.map +1 -0
  264. package/dist/input-BZFPU-j4.d.cts +14 -0
  265. package/dist/input-group-5lh67qyY.d.cts +32 -0
  266. package/dist/input-group-Bc9_sPPN.d.ts +32 -0
  267. package/dist/input-zB3zmz9J.d.ts +14 -0
  268. package/dist/lib/accent-theme.cjs +46 -22
  269. package/dist/lib/accent-theme.cjs.map +1 -1
  270. package/dist/lib/accent-theme.js +26 -1
  271. package/dist/lib/accent-theme.js.map +1 -1
  272. package/dist/lib/calendar-field.cjs +11 -0
  273. package/dist/lib/calendar-field.cjs.map +1 -0
  274. package/dist/lib/calendar-field.d.cts +18 -0
  275. package/dist/lib/calendar-field.d.ts +18 -0
  276. package/dist/lib/calendar-field.js +8 -0
  277. package/dist/lib/calendar-field.js.map +1 -0
  278. package/dist/lib/calendar-lists.cjs +86 -97
  279. package/dist/lib/calendar-lists.cjs.map +1 -1
  280. package/dist/lib/calendar-lists.d.cts +30 -2
  281. package/dist/lib/calendar-lists.d.ts +30 -2
  282. package/dist/lib/calendar-lists.js +85 -97
  283. package/dist/lib/calendar-lists.js.map +1 -1
  284. package/dist/lib/card-control.cjs +18 -0
  285. package/dist/lib/card-control.cjs.map +1 -0
  286. package/dist/lib/card-control.d.cts +10 -0
  287. package/dist/lib/card-control.d.ts +10 -0
  288. package/dist/lib/card-control.js +17 -0
  289. package/dist/lib/card-control.js.map +1 -0
  290. package/dist/lib/checkbox-box.cjs +30 -0
  291. package/dist/lib/checkbox-box.cjs.map +1 -0
  292. package/dist/lib/checkbox-box.d.cts +13 -0
  293. package/dist/lib/checkbox-box.d.ts +13 -0
  294. package/dist/lib/checkbox-box.js +27 -0
  295. package/dist/lib/checkbox-box.js.map +1 -0
  296. package/dist/lib/container-chrome.cjs +8 -1
  297. package/dist/lib/container-chrome.cjs.map +1 -1
  298. package/dist/lib/container-chrome.d.cts +4 -2
  299. package/dist/lib/container-chrome.d.ts +4 -2
  300. package/dist/lib/container-chrome.js +8 -2
  301. package/dist/lib/container-chrome.js.map +1 -1
  302. package/dist/lib/date-field-input.cjs +121 -0
  303. package/dist/lib/date-field-input.cjs.map +1 -0
  304. package/dist/lib/date-field-input.d.cts +14 -0
  305. package/dist/lib/date-field-input.d.ts +14 -0
  306. package/dist/lib/date-field-input.js +118 -0
  307. package/dist/lib/date-field-input.js.map +1 -0
  308. package/dist/lib/date-field-time-list.cjs +81 -0
  309. package/dist/lib/date-field-time-list.cjs.map +1 -0
  310. package/dist/lib/date-field-time-list.d.cts +18 -0
  311. package/dist/lib/date-field-time-list.d.ts +18 -0
  312. package/dist/lib/date-field-time-list.js +77 -0
  313. package/dist/lib/date-field-time-list.js.map +1 -0
  314. package/dist/lib/date-field.cjs +183 -0
  315. package/dist/lib/date-field.cjs.map +1 -0
  316. package/dist/lib/date-field.d.cts +76 -0
  317. package/dist/lib/date-field.d.ts +76 -0
  318. package/dist/lib/date-field.js +177 -0
  319. package/dist/lib/date-field.js.map +1 -0
  320. package/dist/lib/date-time-mask.cjs +148 -102
  321. package/dist/lib/date-time-mask.cjs.map +1 -1
  322. package/dist/lib/date-time-mask.d.cts +21 -3
  323. package/dist/lib/date-time-mask.d.ts +21 -3
  324. package/dist/lib/date-time-mask.js +142 -103
  325. package/dist/lib/date-time-mask.js.map +1 -1
  326. package/dist/lib/generate-radix-colors.cjs +64 -5
  327. package/dist/lib/generate-radix-colors.cjs.map +1 -1
  328. package/dist/lib/generate-radix-colors.js +61 -1
  329. package/dist/lib/generate-radix-colors.js.map +1 -1
  330. package/dist/lib/input-box-variants.cjs +3 -3
  331. package/dist/lib/input-box-variants.cjs.map +1 -1
  332. package/dist/lib/input-box-variants.d.cts +1 -1
  333. package/dist/lib/input-box-variants.d.ts +1 -1
  334. package/dist/lib/input-box-variants.js +3 -3
  335. package/dist/lib/input-box-variants.js.map +1 -1
  336. package/dist/lib/mask-hint.cjs +15 -0
  337. package/dist/lib/mask-hint.cjs.map +1 -0
  338. package/dist/lib/mask-hint.d.cts +10 -0
  339. package/dist/lib/mask-hint.d.ts +10 -0
  340. package/dist/lib/mask-hint.js +14 -0
  341. package/dist/lib/mask-hint.js.map +1 -0
  342. package/dist/lib/option-list.cjs +71 -0
  343. package/dist/lib/option-list.cjs.map +1 -0
  344. package/dist/lib/option-list.d.cts +4 -0
  345. package/dist/lib/option-list.d.ts +4 -0
  346. package/dist/lib/option-list.js +67 -0
  347. package/dist/lib/option-list.js.map +1 -0
  348. package/dist/lib/time-grid.cjs +34 -0
  349. package/dist/lib/time-grid.cjs.map +1 -0
  350. package/dist/lib/time-grid.d.cts +9 -0
  351. package/dist/lib/time-grid.d.ts +9 -0
  352. package/dist/lib/time-grid.js +31 -0
  353. package/dist/lib/time-grid.js.map +1 -0
  354. package/dist/lib/toggle-group-context.d.cts +1 -1
  355. package/dist/lib/toggle-group-context.d.ts +1 -1
  356. package/dist/option-list-CxhR_DGq.d.cts +34 -0
  357. package/dist/option-list-CxhR_DGq.d.ts +34 -0
  358. package/dist/popover-DmcqNOkO.d.cts +31 -0
  359. package/dist/popover-DmcqNOkO.d.ts +31 -0
  360. package/dist/styles/spark-default.css +21 -0
  361. package/dist/styles/theme.css +2 -1
  362. package/dist/utils/cn.d.cts +1 -1
  363. package/dist/utils/cn.d.ts +1 -1
  364. package/package.json +3 -3
  365. package/dist/calendar-lists-CTby2kR5.d.cts +0 -27
  366. package/dist/calendar-lists-DoloqsCN.d.ts +0 -27
  367. package/dist/lib/calendar-day-button.cjs +0 -23
  368. package/dist/lib/calendar-day-button.cjs.map +0 -1
  369. package/dist/lib/calendar-day-button.d.cts +0 -14
  370. package/dist/lib/calendar-day-button.d.ts +0 -14
  371. package/dist/lib/calendar-day-button.js +0 -20
  372. package/dist/lib/calendar-day-button.js.map +0 -1
  373. package/dist/lib/input-date-parts.cjs +0 -155
  374. package/dist/lib/input-date-parts.cjs.map +0 -1
  375. package/dist/lib/input-date-parts.d.cts +0 -53
  376. package/dist/lib/input-date-parts.d.ts +0 -53
  377. package/dist/lib/input-date-parts.js +0 -148
  378. package/dist/lib/input-date-parts.js.map +0 -1
  379. package/dist/lib/scroll-within.cjs +0 -27
  380. package/dist/lib/scroll-within.cjs.map +0 -1
  381. package/dist/lib/scroll-within.d.cts +0 -14
  382. package/dist/lib/scroll-within.d.ts +0 -14
  383. package/dist/lib/scroll-within.js +0 -25
  384. package/dist/lib/scroll-within.js.map +0 -1
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ //#region src/lib/time-grid.ts
4
+ const MINUTES_PER_DAY = 1440;
5
+ const toMinutes = (value) => {
6
+ const match = /^(\d{1,2}):(\d{2})/.exec(value);
7
+ return match ? Number(match[1]) * 60 + Number(match[2]) : void 0;
8
+ };
9
+ const toTime = (minutes) => `${String(Math.floor(minutes / 60)).padStart(2, "0")}:${String(minutes % 60).padStart(2, "0")}`;
10
+ const lastOnGrid = (stepMinutes) => Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes;
11
+ function stepGridValue(value, step, direction) {
12
+ const stepMinutes = Math.floor(step / 60);
13
+ if (stepMinutes <= 1) return value;
14
+ const base = toMinutes(value) ?? 0;
15
+ const next = direction === 1 ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes;
16
+ return toTime(Math.max(0, Math.min(next, lastOnGrid(stepMinutes))));
17
+ }
18
+ function snapToNearestStep(value, step) {
19
+ const stepMinutes = Math.floor(step / 60);
20
+ if (stepMinutes <= 1) return value;
21
+ const total = toMinutes(value);
22
+ if (total === void 0 || total % stepMinutes === 0) return value;
23
+ return toTime(Math.min(Math.round(total / stepMinutes) * stepMinutes, lastOnGrid(stepMinutes)));
24
+ }
25
+ function timesOnGrid(step) {
26
+ const stepMinutes = Math.max(1, Math.floor(step / 60));
27
+ return Array.from({ length: Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) + 1 }, (_, index) => toTime(index * stepMinutes));
28
+ }
29
+ //#endregion
30
+ exports.snapToNearestStep = snapToNearestStep;
31
+ exports.stepGridValue = stepGridValue;
32
+ exports.timesOnGrid = timesOnGrid;
33
+
34
+ //# sourceMappingURL=time-grid.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-grid.cjs","names":[],"sources":["../../src/lib/time-grid.ts"],"sourcesContent":["const MINUTES_PER_DAY = 24 * 60\n\nconst toMinutes = (value: string) => {\n const match = /^(\\d{1,2}):(\\d{2})/.exec(value)\n return match ? Number(match[1]) * 60 + Number(match[2]) : undefined\n}\n\nconst toTime = (minutes: number) =>\n `${String(Math.floor(minutes / 60)).padStart(2, '0')}:${String(minutes % 60).padStart(2, '0')}`\n\nconst lastOnGrid = (stepMinutes: number) =>\n Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes\n\nexport function stepGridValue(\n value: string,\n step: number,\n direction: 1 | -1,\n): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const base = toMinutes(value) ?? 0\n const next =\n direction === 1\n ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes\n : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes\n return toTime(Math.max(0, Math.min(next, lastOnGrid(stepMinutes))))\n}\n\nexport function snapToNearestStep(value: string, step: number): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const total = toMinutes(value)\n if (total === undefined || total % stepMinutes === 0) return value\n return toTime(\n Math.min(\n Math.round(total / stepMinutes) * stepMinutes,\n lastOnGrid(stepMinutes),\n ),\n )\n}\n\nexport function timesOnGrid(step: number): string[] {\n const stepMinutes = Math.max(1, Math.floor(step / 60))\n return Array.from(\n { length: Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) + 1 },\n (_, index) => toTime(index * stepMinutes),\n )\n}\n"],"mappings":";;;AAAA,MAAM,kBAAkB;AAExB,MAAM,aAAa,UAAkB;CACnC,MAAM,QAAQ,qBAAqB,KAAK,KAAK;CAC7C,OAAO,QAAQ,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE,IAAI,KAAA;AAC5D;AAEA,MAAM,UAAU,YACd,GAAG,OAAO,KAAK,MAAM,UAAU,EAAE,CAAC,EAAE,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,UAAU,EAAE,EAAE,SAAS,GAAG,GAAG;AAE9F,MAAM,cAAc,gBAClB,KAAK,OAAO,kBAAkB,KAAK,WAAW,IAAI;AAEpD,SAAgB,cACd,OACA,MACA,WACQ;CACR,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,OAAO,UAAU,KAAK,KAAK;CACjC,MAAM,OACJ,cAAc,IACV,KAAK,MAAM,OAAO,WAAW,IAAI,cAAc,cAC/C,KAAK,KAAK,OAAO,WAAW,IAAI,cAAc;CACpD,OAAO,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,WAAW,WAAW,CAAC,CAAC,CAAC;AACpE;AAEA,SAAgB,kBAAkB,OAAe,MAAsB;CACrE,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,QAAQ,UAAU,KAAK;CAC7B,IAAI,UAAU,KAAA,KAAa,QAAQ,gBAAgB,GAAG,OAAO;CAC7D,OAAO,OACL,KAAK,IACH,KAAK,MAAM,QAAQ,WAAW,IAAI,aAClC,WAAW,WAAW,CACxB,CACF;AACF;AAEA,SAAgB,YAAY,MAAwB;CAClD,MAAM,cAAc,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,EAAE,CAAC;CACrD,OAAO,MAAM,KACX,EAAE,QAAQ,KAAK,OAAO,kBAAkB,KAAK,WAAW,IAAI,EAAE,IAC7D,GAAG,UAAU,OAAO,QAAQ,WAAW,CAC1C;AACF"}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+
3
+ //#region src/lib/time-grid.d.ts
4
+ declare function stepGridValue(value: string, step: number, direction: 1 | -1): string;
5
+ declare function snapToNearestStep(value: string, step: number): string;
6
+ declare function timesOnGrid(step: number): string[];
7
+ //#endregion
8
+ export { snapToNearestStep, stepGridValue, timesOnGrid };
9
+ //# sourceMappingURL=time-grid.d.cts.map
@@ -0,0 +1,9 @@
1
+ "use client";
2
+
3
+ //#region src/lib/time-grid.d.ts
4
+ declare function stepGridValue(value: string, step: number, direction: 1 | -1): string;
5
+ declare function snapToNearestStep(value: string, step: number): string;
6
+ declare function timesOnGrid(step: number): string[];
7
+ //#endregion
8
+ export { snapToNearestStep, stepGridValue, timesOnGrid };
9
+ //# sourceMappingURL=time-grid.d.ts.map
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ //#region src/lib/time-grid.ts
3
+ const MINUTES_PER_DAY = 1440;
4
+ const toMinutes = (value) => {
5
+ const match = /^(\d{1,2}):(\d{2})/.exec(value);
6
+ return match ? Number(match[1]) * 60 + Number(match[2]) : void 0;
7
+ };
8
+ const toTime = (minutes) => `${String(Math.floor(minutes / 60)).padStart(2, "0")}:${String(minutes % 60).padStart(2, "0")}`;
9
+ const lastOnGrid = (stepMinutes) => Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes;
10
+ function stepGridValue(value, step, direction) {
11
+ const stepMinutes = Math.floor(step / 60);
12
+ if (stepMinutes <= 1) return value;
13
+ const base = toMinutes(value) ?? 0;
14
+ const next = direction === 1 ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes;
15
+ return toTime(Math.max(0, Math.min(next, lastOnGrid(stepMinutes))));
16
+ }
17
+ function snapToNearestStep(value, step) {
18
+ const stepMinutes = Math.floor(step / 60);
19
+ if (stepMinutes <= 1) return value;
20
+ const total = toMinutes(value);
21
+ if (total === void 0 || total % stepMinutes === 0) return value;
22
+ return toTime(Math.min(Math.round(total / stepMinutes) * stepMinutes, lastOnGrid(stepMinutes)));
23
+ }
24
+ function timesOnGrid(step) {
25
+ const stepMinutes = Math.max(1, Math.floor(step / 60));
26
+ return Array.from({ length: Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) + 1 }, (_, index) => toTime(index * stepMinutes));
27
+ }
28
+ //#endregion
29
+ export { snapToNearestStep, stepGridValue, timesOnGrid };
30
+
31
+ //# sourceMappingURL=time-grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-grid.js","names":[],"sources":["../../src/lib/time-grid.ts"],"sourcesContent":["const MINUTES_PER_DAY = 24 * 60\n\nconst toMinutes = (value: string) => {\n const match = /^(\\d{1,2}):(\\d{2})/.exec(value)\n return match ? Number(match[1]) * 60 + Number(match[2]) : undefined\n}\n\nconst toTime = (minutes: number) =>\n `${String(Math.floor(minutes / 60)).padStart(2, '0')}:${String(minutes % 60).padStart(2, '0')}`\n\nconst lastOnGrid = (stepMinutes: number) =>\n Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes\n\nexport function stepGridValue(\n value: string,\n step: number,\n direction: 1 | -1,\n): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const base = toMinutes(value) ?? 0\n const next =\n direction === 1\n ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes\n : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes\n return toTime(Math.max(0, Math.min(next, lastOnGrid(stepMinutes))))\n}\n\nexport function snapToNearestStep(value: string, step: number): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const total = toMinutes(value)\n if (total === undefined || total % stepMinutes === 0) return value\n return toTime(\n Math.min(\n Math.round(total / stepMinutes) * stepMinutes,\n lastOnGrid(stepMinutes),\n ),\n )\n}\n\nexport function timesOnGrid(step: number): string[] {\n const stepMinutes = Math.max(1, Math.floor(step / 60))\n return Array.from(\n { length: Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) + 1 },\n (_, index) => toTime(index * stepMinutes),\n )\n}\n"],"mappings":";;AAAA,MAAM,kBAAkB;AAExB,MAAM,aAAa,UAAkB;CACnC,MAAM,QAAQ,qBAAqB,KAAK,KAAK;CAC7C,OAAO,QAAQ,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE,IAAI,KAAA;AAC5D;AAEA,MAAM,UAAU,YACd,GAAG,OAAO,KAAK,MAAM,UAAU,EAAE,CAAC,EAAE,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,UAAU,EAAE,EAAE,SAAS,GAAG,GAAG;AAE9F,MAAM,cAAc,gBAClB,KAAK,OAAO,kBAAkB,KAAK,WAAW,IAAI;AAEpD,SAAgB,cACd,OACA,MACA,WACQ;CACR,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,OAAO,UAAU,KAAK,KAAK;CACjC,MAAM,OACJ,cAAc,IACV,KAAK,MAAM,OAAO,WAAW,IAAI,cAAc,cAC/C,KAAK,KAAK,OAAO,WAAW,IAAI,cAAc;CACpD,OAAO,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,WAAW,WAAW,CAAC,CAAC,CAAC;AACpE;AAEA,SAAgB,kBAAkB,OAAe,MAAsB;CACrE,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,QAAQ,UAAU,KAAK;CAC7B,IAAI,UAAU,KAAA,KAAa,QAAQ,gBAAgB,GAAG,OAAO;CAC7D,OAAO,OACL,KAAK,IACH,KAAK,MAAM,QAAQ,WAAW,IAAI,aAClC,WAAW,WAAW,CACxB,CACF;AACF;AAEA,SAAgB,YAAY,MAAwB;CAClD,MAAM,cAAc,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,EAAE,CAAC;CACrD,OAAO,MAAM,KACX,EAAE,QAAQ,KAAK,OAAO,kBAAkB,KAAK,WAAW,IAAI,EAAE,IAC7D,GAAG,UAAU,OAAO,QAAQ,WAAW,CAC1C;AACF"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { n as SparkButtonColor } from "../theme-types-CHl-L2F-.cjs";
4
- import { ButtonProps } from "../components/button.cjs";
4
+ import { r as ButtonProps } from "../button-DBcEcIMk.cjs";
5
5
  import { ToggleStyle } from "../components/toggle.cjs";
6
6
  import * as React$1 from "react";
7
7
 
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { n as SparkButtonColor } from "../theme-types-CHl-L2F-.js";
4
- import { ButtonProps } from "../components/button.js";
4
+ import { r as ButtonProps } from "../button-B_RNHEc7.js";
5
5
  import { ToggleStyle } from "../components/toggle.js";
6
6
  import * as React$1 from "react";
7
7
 
@@ -0,0 +1,34 @@
1
+ "use client";
2
+
3
+ import * as React$1 from "react";
4
+ import { Toggle } from "@base-ui/react/toggle";
5
+
6
+ //#region src/lib/option-list.d.ts
7
+ type OptionListProps = Omit<React$1.ComponentProps<'div'>, 'defaultValue' | 'onChange'> & {
8
+ autoFocus?: boolean;
9
+ 'data-slot'?: string;
10
+ fallbackValue?: string;
11
+ onPick: (value: string) => void;
12
+ value: string | undefined;
13
+ };
14
+ declare function OptionList({
15
+ autoFocus,
16
+ children,
17
+ className,
18
+ 'data-slot': slot,
19
+ fallbackValue,
20
+ onPick,
21
+ value,
22
+ ...props
23
+ }: OptionListProps): import("react/jsx-runtime").JSX.Element;
24
+ declare function Option({
25
+ className,
26
+ children,
27
+ value,
28
+ ...props
29
+ }: Omit<React$1.ComponentProps<typeof Toggle>, 'value'> & {
30
+ value: string;
31
+ }): import("react/jsx-runtime").JSX.Element;
32
+ //#endregion
33
+ export { OptionList as n, OptionListProps as r, Option as t };
34
+ //# sourceMappingURL=option-list-CxhR_DGq.d.cts.map
@@ -0,0 +1,34 @@
1
+ "use client";
2
+
3
+ import * as React$1 from "react";
4
+ import { Toggle } from "@base-ui/react/toggle";
5
+
6
+ //#region src/lib/option-list.d.ts
7
+ type OptionListProps = Omit<React$1.ComponentProps<'div'>, 'defaultValue' | 'onChange'> & {
8
+ autoFocus?: boolean;
9
+ 'data-slot'?: string;
10
+ fallbackValue?: string;
11
+ onPick: (value: string) => void;
12
+ value: string | undefined;
13
+ };
14
+ declare function OptionList({
15
+ autoFocus,
16
+ children,
17
+ className,
18
+ 'data-slot': slot,
19
+ fallbackValue,
20
+ onPick,
21
+ value,
22
+ ...props
23
+ }: OptionListProps): import("react/jsx-runtime").JSX.Element;
24
+ declare function Option({
25
+ className,
26
+ children,
27
+ value,
28
+ ...props
29
+ }: Omit<React$1.ComponentProps<typeof Toggle>, 'value'> & {
30
+ value: string;
31
+ }): import("react/jsx-runtime").JSX.Element;
32
+ //#endregion
33
+ export { OptionList as n, OptionListProps as r, Option as t };
34
+ //# sourceMappingURL=option-list-CxhR_DGq.d.ts.map
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ import * as React$1 from "react";
4
+ import { useRender } from "@base-ui/react/use-render";
5
+ import { Popover } from "@base-ui/react/popover";
6
+
7
+ //#region src/components/popover.d.ts
8
+ declare function Popover$1(props: React$1.ComponentProps<typeof Popover.Root>): import("react/jsx-runtime").JSX.Element;
9
+ declare function PopoverTrigger(props: React$1.ComponentProps<typeof Popover.Trigger>): import("react/jsx-runtime").JSX.Element;
10
+ declare function PopoverClose(props: React$1.ComponentProps<typeof Popover.Close>): import("react/jsx-runtime").JSX.Element;
11
+ /** Anchors the popover to this element instead of the trigger. Pass `render` to
12
+ * wrap an existing element (was radix `asChild`). */
13
+ declare function PopoverAnchor({
14
+ render,
15
+ ...props
16
+ }: useRender.ComponentProps<'div'>): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
17
+ type PopoverContentProps = React$1.ComponentProps<typeof Popover.Popup> & Pick<Popover.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'anchor' | 'collisionAvoidance'> & Pick<Popover.Portal.Props, 'container'>;
18
+ declare function PopoverContent({
19
+ className,
20
+ align,
21
+ sideOffset,
22
+ side,
23
+ alignOffset,
24
+ anchor,
25
+ collisionAvoidance,
26
+ container,
27
+ ...props
28
+ }: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
29
+ //#endregion
30
+ export { PopoverTrigger as a, PopoverContent as i, PopoverAnchor as n, PopoverClose as r, Popover$1 as t };
31
+ //# sourceMappingURL=popover-DmcqNOkO.d.cts.map
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ import * as React$1 from "react";
4
+ import { useRender } from "@base-ui/react/use-render";
5
+ import { Popover } from "@base-ui/react/popover";
6
+
7
+ //#region src/components/popover.d.ts
8
+ declare function Popover$1(props: React$1.ComponentProps<typeof Popover.Root>): import("react/jsx-runtime").JSX.Element;
9
+ declare function PopoverTrigger(props: React$1.ComponentProps<typeof Popover.Trigger>): import("react/jsx-runtime").JSX.Element;
10
+ declare function PopoverClose(props: React$1.ComponentProps<typeof Popover.Close>): import("react/jsx-runtime").JSX.Element;
11
+ /** Anchors the popover to this element instead of the trigger. Pass `render` to
12
+ * wrap an existing element (was radix `asChild`). */
13
+ declare function PopoverAnchor({
14
+ render,
15
+ ...props
16
+ }: useRender.ComponentProps<'div'>): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
17
+ type PopoverContentProps = React$1.ComponentProps<typeof Popover.Popup> & Pick<Popover.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'anchor' | 'collisionAvoidance'> & Pick<Popover.Portal.Props, 'container'>;
18
+ declare function PopoverContent({
19
+ className,
20
+ align,
21
+ sideOffset,
22
+ side,
23
+ alignOffset,
24
+ anchor,
25
+ collisionAvoidance,
26
+ container,
27
+ ...props
28
+ }: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
29
+ //#endregion
30
+ export { PopoverTrigger as a, PopoverContent as i, PopoverAnchor as n, PopoverClose as r, Popover$1 as t };
31
+ //# sourceMappingURL=popover-DmcqNOkO.d.ts.map
@@ -1319,6 +1319,27 @@
1319
1319
  --spark-card-c-contrast: var(--spark-contrast);
1320
1320
  }
1321
1321
 
1322
+ /* Feedback card colours (Card `color` only, not a Theme knob): the same six slots on the green and orange scales. */
1323
+ [data-card-color='success'],
1324
+ :where([data-card-color='success'] .spark-theme) {
1325
+ --spark-card-c-soft: var(--green-a3);
1326
+ --spark-card-c-soft-hover: var(--green-a4);
1327
+ --spark-card-c-surface: var(--green-2);
1328
+ --spark-card-c-border: var(--green-a6);
1329
+ --spark-card-c-solid: var(--green-9);
1330
+ --spark-card-c-contrast: var(--green-contrast, #fff);
1331
+ }
1332
+
1333
+ [data-card-color='warning'],
1334
+ :where([data-card-color='warning'] .spark-theme) {
1335
+ --spark-card-c-soft: var(--orange-a3);
1336
+ --spark-card-c-soft-hover: var(--orange-a4);
1337
+ --spark-card-c-surface: var(--orange-2);
1338
+ --spark-card-c-border: var(--orange-a6);
1339
+ --spark-card-c-solid: var(--orange-9);
1340
+ --spark-card-c-contrast: var(--orange-contrast, #fff);
1341
+ }
1342
+
1322
1343
  /* An explicit neutral card opts out of an inherited accent card colour: initial drops each slot to its neutral fallback. */
1323
1344
  [data-card-color='neutral'],
1324
1345
  :where([data-card-color='neutral'] .spark-theme) {
@@ -543,6 +543,7 @@
543
543
  --color-input-active: var(--spark-a8);
544
544
  --color-input-valid: var(--green-a7);
545
545
  --color-input-invalid: var(--red-a7);
546
+ --color-input-warning: var(--orange-a8);
546
547
  --color-input-disabled: var(--neutral-a8);
547
548
  }
548
549
 
@@ -762,5 +763,5 @@
762
763
  'bg-{input-base,input-base-hover,dropdown-base,dropdown-item-hover}'
763
764
  );
764
765
  @source inline(
765
- 'border-{input,input-active,input-valid,input-invalid,input-disabled}'
766
+ 'border-{input,input-active,input-valid,input-invalid,input-warning,input-disabled}'
766
767
  );
@@ -1,4 +1,4 @@
1
1
  "use client";
2
2
 
3
- import { cn } from "cn";
3
+ import { t as cn } from "../cn-DzRH6EW_.cjs";
4
4
  export { cn };
@@ -1,4 +1,4 @@
1
1
  "use client";
2
2
 
3
- import { cn } from "cn";
3
+ import { t as cn } from "../cn-DzRH6EW_.js";
4
4
  export { cn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/spark-ui",
3
- "version": "0.31.1",
3
+ "version": "0.32.0",
4
4
  "description": "React UI component library from Spark SDK",
5
5
  "homepage": "https://spark-ui.epilot.io/docs/ui",
6
6
  "license": "Apache-2.0",
@@ -81,9 +81,9 @@
81
81
  "class-variance-authority": "^0.7.1",
82
82
  "cn": "^0.4.0",
83
83
  "colorjs.io": "^0.5.2",
84
- "ictus": "^1.1.0",
84
+ "ictus": "^1.2.0",
85
85
  "vaul": "^1.1.2",
86
- "@epilot/spark-icons": "^0.0.3"
86
+ "@epilot/spark-icons": "^0.1.0"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@stryker-mutator/core": "^10.0.0",
@@ -1,27 +0,0 @@
1
- "use client";
2
-
3
- import * as React$1 from "react";
4
- import { MonthCaptionProps, MonthGridProps } from "@daypicker/react";
5
-
6
- //#region src/lib/calendar-lists.d.ts
7
- type CalendarListLabels = {
8
- nextYear: string;
9
- previousYear: string;
10
- };
11
- declare function MonthCaption({
12
- calendarMonth,
13
- className,
14
- displayIndex: _,
15
- ...props
16
- }: MonthCaptionProps): import("react/jsx-runtime").JSX.Element;
17
- declare function MonthGrid(props: MonthGridProps): import("react/jsx-runtime").JSX.Element;
18
- declare function CalendarListsProvider({
19
- children,
20
- labels
21
- }: {
22
- children: React$1.ReactNode;
23
- labels: CalendarListLabels;
24
- }): import("react/jsx-runtime").JSX.Element;
25
- //#endregion
26
- export { MonthGrid as i, CalendarListsProvider as n, MonthCaption as r, CalendarListLabels as t };
27
- //# sourceMappingURL=calendar-lists-CTby2kR5.d.cts.map
@@ -1,27 +0,0 @@
1
- "use client";
2
-
3
- import * as React$1 from "react";
4
- import { MonthCaptionProps, MonthGridProps } from "@daypicker/react";
5
-
6
- //#region src/lib/calendar-lists.d.ts
7
- type CalendarListLabels = {
8
- nextYear: string;
9
- previousYear: string;
10
- };
11
- declare function MonthCaption({
12
- calendarMonth,
13
- className,
14
- displayIndex: _,
15
- ...props
16
- }: MonthCaptionProps): import("react/jsx-runtime").JSX.Element;
17
- declare function MonthGrid$1(props: MonthGridProps): import("react/jsx-runtime").JSX.Element;
18
- declare function CalendarListsProvider({
19
- children,
20
- labels
21
- }: {
22
- children: React$1.ReactNode;
23
- labels: CalendarListLabels;
24
- }): import("react/jsx-runtime").JSX.Element;
25
- //#endregion
26
- export { MonthGrid$1 as i, CalendarListsProvider as n, MonthCaption as r, CalendarListLabels as t };
27
- //# sourceMappingURL=calendar-lists-DoloqsCN.d.ts.map
@@ -1,23 +0,0 @@
1
- "use client";
2
- "use client";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_chunk = require("../chunk-DY84GLCh.cjs");
5
- let react = require("react");
6
- react = require_chunk.__toESM(react);
7
- let react_jsx_runtime = require("react/jsx-runtime");
8
- //#region src/lib/calendar-day-button.tsx
9
- /** DayPicker's day button, minus the page scroll when it takes focus. */
10
- function ScrollFreeDayButton({ day: _day, modifiers, ...props }) {
11
- const ref = react.useRef(null);
12
- react.useEffect(() => {
13
- if (modifiers.focused) ref.current?.focus({ preventScroll: true });
14
- }, [modifiers.focused]);
15
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
16
- ref,
17
- ...props
18
- });
19
- }
20
- //#endregion
21
- exports.ScrollFreeDayButton = ScrollFreeDayButton;
22
-
23
- //# sourceMappingURL=calendar-day-button.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"calendar-day-button.cjs","names":["React"],"sources":["../../src/lib/calendar-day-button.tsx"],"sourcesContent":["'use client'\n\nimport type { DayButtonProps } from '@daypicker/react'\nimport * as React from 'react'\n\n/** DayPicker's day button, minus the page scroll when it takes focus. */\nexport function ScrollFreeDayButton({\n day: _day,\n modifiers,\n ...props\n}: DayButtonProps) {\n const ref = React.useRef<HTMLButtonElement>(null)\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus({ preventScroll: true })\n }, [modifiers.focused])\n return <button ref={ref} {...props} />\n}\n"],"mappings":";;;;;;;;;AAMA,SAAgB,oBAAoB,EAClC,KAAK,MACL,WACA,GAAG,SACc;CACjB,MAAM,MAAMA,MAAM,OAA0B,IAAI;CAChD,MAAM,gBAAgB;EACpB,IAAI,UAAU,SAAS,IAAI,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;CACnE,GAAG,CAAC,UAAU,OAAO,CAAC;CACtB,OAAO,iBAAA,GAAA,kBAAA,KAAC,UAAD;EAAa;EAAK,GAAI;CAAQ,CAAA;AACvC"}
@@ -1,14 +0,0 @@
1
- "use client";
2
-
3
- import { DayButtonProps } from "@daypicker/react";
4
-
5
- //#region src/lib/calendar-day-button.d.ts
6
- /** DayPicker's day button, minus the page scroll when it takes focus. */
7
- declare function ScrollFreeDayButton({
8
- day: _day,
9
- modifiers,
10
- ...props
11
- }: DayButtonProps): import("react/jsx-runtime").JSX.Element;
12
- //#endregion
13
- export { ScrollFreeDayButton };
14
- //# sourceMappingURL=calendar-day-button.d.cts.map
@@ -1,14 +0,0 @@
1
- "use client";
2
-
3
- import { DayButtonProps } from "@daypicker/react";
4
-
5
- //#region src/lib/calendar-day-button.d.ts
6
- /** DayPicker's day button, minus the page scroll when it takes focus. */
7
- declare function ScrollFreeDayButton({
8
- day: _day,
9
- modifiers,
10
- ...props
11
- }: DayButtonProps): import("react/jsx-runtime").JSX.Element;
12
- //#endregion
13
- export { ScrollFreeDayButton };
14
- //# sourceMappingURL=calendar-day-button.d.ts.map
@@ -1,20 +0,0 @@
1
- "use client";
2
- "use client";
3
- import * as React$1 from "react";
4
- import { jsx } from "react/jsx-runtime";
5
- //#region src/lib/calendar-day-button.tsx
6
- /** DayPicker's day button, minus the page scroll when it takes focus. */
7
- function ScrollFreeDayButton({ day: _day, modifiers, ...props }) {
8
- const ref = React$1.useRef(null);
9
- React$1.useEffect(() => {
10
- if (modifiers.focused) ref.current?.focus({ preventScroll: true });
11
- }, [modifiers.focused]);
12
- return /* @__PURE__ */ jsx("button", {
13
- ref,
14
- ...props
15
- });
16
- }
17
- //#endregion
18
- export { ScrollFreeDayButton };
19
-
20
- //# sourceMappingURL=calendar-day-button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"calendar-day-button.js","names":["React"],"sources":["../../src/lib/calendar-day-button.tsx"],"sourcesContent":["'use client'\n\nimport type { DayButtonProps } from '@daypicker/react'\nimport * as React from 'react'\n\n/** DayPicker's day button, minus the page scroll when it takes focus. */\nexport function ScrollFreeDayButton({\n day: _day,\n modifiers,\n ...props\n}: DayButtonProps) {\n const ref = React.useRef<HTMLButtonElement>(null)\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus({ preventScroll: true })\n }, [modifiers.focused])\n return <button ref={ref} {...props} />\n}\n"],"mappings":";;;;;;AAMA,SAAgB,oBAAoB,EAClC,KAAK,MACL,WACA,GAAG,SACc;CACjB,MAAM,MAAMA,QAAM,OAA0B,IAAI;CAChD,QAAM,gBAAgB;EACpB,IAAI,UAAU,SAAS,IAAI,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;CACnE,GAAG,CAAC,UAAU,OAAO,CAAC;CACtB,OAAO,oBAAC,UAAD;EAAa;EAAK,GAAI;CAAQ,CAAA;AACvC"}
@@ -1,155 +0,0 @@
1
- "use client";
2
- "use client";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_chunk = require("../chunk-DY84GLCh.cjs");
5
- const require_lib_scroll_within = require("./scroll-within.cjs");
6
- const require_lib_date_time_mask = require("./date-time-mask.cjs");
7
- let react = require("react");
8
- react = require_chunk.__toESM(react);
9
- let react_jsx_runtime = require("react/jsx-runtime");
10
- let ictus_time = require("ictus/time");
11
- let cn = require("cn");
12
- //#region src/lib/input-date-parts.tsx
13
- const MINUTES_PER_DAY = 1440;
14
- const MIN_STEP = 5;
15
- /** `HH:MM` every `step` minutes (5 at least), plus `extra` when it is off that grid. */
16
- function timesOf(step, extra) {
17
- const times = [];
18
- for (let minutes = 0; minutes < MINUTES_PER_DAY; minutes += Math.max(MIN_STEP, step)) times.push((0, ictus_time.formatTime)({
19
- hours: Math.floor(minutes / 60),
20
- minutes: minutes % 60,
21
- seconds: 0
22
- }));
23
- if (extra && !times.includes(extra)) {
24
- const after = times.findIndex((time) => time > extra);
25
- times.splice(after === -1 ? times.length : after, 0, extra);
26
- }
27
- return times;
28
- }
29
- function TimeList({ defaultTime, label, onPick, open, selectedTime, times }) {
30
- const listRef = react.useRef(null);
31
- react.useEffect(() => {
32
- if (!open) return;
33
- const frame = requestAnimationFrame(() => {
34
- require_lib_scroll_within.scrollWithin(listRef.current, listRef.current?.querySelector("[aria-selected=\"true\"]") ?? null, "center");
35
- });
36
- return () => cancelAnimationFrame(frame);
37
- }, [open]);
38
- const moveFocus = (event) => {
39
- const options = Array.from(listRef.current?.querySelectorAll("[role=\"option\"]") ?? []);
40
- const index = options.indexOf(document.activeElement);
41
- const target = {
42
- ArrowDown: index + 1,
43
- ArrowUp: index - 1,
44
- End: options.length - 1,
45
- Home: 0
46
- }[event.key];
47
- if (target === void 0) return;
48
- event.preventDefault();
49
- require_lib_scroll_within.focusWithin(listRef.current, options[Math.max(0, Math.min(options.length - 1, target))] ?? null);
50
- };
51
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
52
- className: "relative border-gray-a4 max-sm:h-40 max-sm:border-t sm:w-24 sm:border-l",
53
- "data-slot": "input-date-times",
54
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
55
- "aria-label": label,
56
- className: "absolute inset-0 flex flex-col gap-0.5 overflow-y-auto p-2",
57
- onKeyDown: moveFocus,
58
- ref: listRef,
59
- role: "listbox",
60
- tabIndex: -1,
61
- children: times.map((time) => {
62
- const isSelected = time === selectedTime;
63
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
64
- "aria-selected": isSelected,
65
- className: (0, cn.cn)("shrink-0 cursor-pointer rounded-md px-3 py-1.5 text-center text-sm text-gray hover:bg-gray-a3 focus-visible:focus-outline", isSelected && "bg-(--spark-style-bg,var(--color-primary)) text-(--spark-style-fg,var(--color-primary-foreground)) hover:bg-(--spark-style-bg-hover,var(--color-primary-hover))"),
66
- onClick: () => onPick(time),
67
- role: "option",
68
- tabIndex: isSelected || !selectedTime && time === defaultTime ? 0 : -1,
69
- type: "button",
70
- children: time
71
- }, time);
72
- })
73
- })
74
- });
75
- }
76
- /** Keystrokes and pastes through the date (and time) mask. */
77
- function useMaskHandlers({ commit, inputRef, onKeyDown, onOpen, onPaste, onRejectedKey, pickerOnly, separator, withTime }) {
78
- const placeCaret = (caret) => {
79
- const input = inputRef.current;
80
- requestAnimationFrame(() => {
81
- input?.setSelectionRange(caret, caret);
82
- });
83
- };
84
- const handleKeyDown = (event) => {
85
- onKeyDown?.(event);
86
- if (event.defaultPrevented) return;
87
- if (event.key === "ArrowDown") {
88
- event.preventDefault();
89
- onOpen();
90
- return;
91
- }
92
- if (pickerOnly || event.ctrlKey || event.metaKey || event.altKey) return;
93
- if (!require_lib_date_time_mask.isDateTimeMaskKey(event.key, withTime)) {
94
- if (event.key.length === 1) {
95
- event.preventDefault();
96
- onRejectedKey();
97
- }
98
- return;
99
- }
100
- event.preventDefault();
101
- const next = require_lib_date_time_mask.applyDateTimeMask({
102
- caret: event.currentTarget.selectionStart ?? 0,
103
- key: event.key,
104
- selectionEnd: event.currentTarget.selectionEnd ?? void 0,
105
- separator,
106
- value: event.currentTarget.value,
107
- withTime
108
- });
109
- commit(next.value);
110
- placeCaret(next.caret);
111
- };
112
- const handlePaste = (event) => {
113
- onPaste?.(event);
114
- if (event.defaultPrevented || pickerOnly) return;
115
- event.preventDefault();
116
- const next = require_lib_date_time_mask.applyDateTimePaste({
117
- caret: event.currentTarget.selectionStart ?? 0,
118
- pasted: event.clipboardData.getData("text"),
119
- selectionEnd: event.currentTarget.selectionEnd ?? void 0,
120
- separator,
121
- value: event.currentTarget.value,
122
- withTime
123
- });
124
- commit(next.value);
125
- placeCaret(next.caret);
126
- };
127
- return {
128
- onKeyDown: handleKeyDown,
129
- onPaste: handlePaste
130
- };
131
- }
132
- /** A polite message that is read again when it repeats. */
133
- function useAnnouncement() {
134
- const [message, setMessage] = react.useState({
135
- text: "",
136
- count: 0
137
- });
138
- const announce = react.useCallback((text) => setMessage((current) => ({
139
- text,
140
- count: current.count + 1
141
- })), []);
142
- return [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
143
- "aria-live": "polite",
144
- className: "sr-only",
145
- "data-slot": "input-date-status",
146
- children: [message.text, message.count % 2 ? "\xA0" : ""]
147
- }), announce];
148
- }
149
- //#endregion
150
- exports.TimeList = TimeList;
151
- exports.timesOf = timesOf;
152
- exports.useAnnouncement = useAnnouncement;
153
- exports.useMaskHandlers = useMaskHandlers;
154
-
155
- //# sourceMappingURL=input-date-parts.cjs.map