@lifesg/react-design-system 4.0.0-alpha.5 → 4.0.0-alpha.6

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 (445) hide show
  1. package/accordion/types.d.ts +1 -1
  2. package/breadcrumb/breadcrumb.d.ts +7 -0
  3. package/breadcrumb/breadcrumb.js.map +1 -1
  4. package/breadcrumb/types.d.ts +31 -0
  5. package/button/button.d.ts +1 -0
  6. package/button/button.js.map +1 -1
  7. package/button/types.d.ts +42 -9
  8. package/calendar/calendar.d.ts +3 -0
  9. package/calendar/calendar.js.map +1 -1
  10. package/calendar/types.d.ts +43 -7
  11. package/card/card.d.ts +1 -0
  12. package/card/card.js.map +1 -1
  13. package/card/types.d.ts +1 -0
  14. package/checkbox/checkbox.d.ts +3 -0
  15. package/checkbox/checkbox.js.map +1 -1
  16. package/checkbox/types.d.ts +19 -3
  17. package/cjs/breadcrumb/breadcrumb.js.map +1 -1
  18. package/cjs/button/button.js.map +1 -1
  19. package/cjs/calendar/calendar.js.map +1 -1
  20. package/cjs/card/card.js.map +1 -1
  21. package/cjs/checkbox/checkbox.js.map +1 -1
  22. package/cjs/data-table/data-table.js +1 -1
  23. package/cjs/data-table/data-table.js.map +1 -1
  24. package/cjs/data-table/data-table.styles.js +1 -1
  25. package/cjs/data-table/data-table.styles.js.map +1 -1
  26. package/cjs/data-table/data-table.styles_rxganh.css +27 -0
  27. package/cjs/external/dompurify/dist/purify.es.js +2 -2
  28. package/cjs/external/dompurify/dist/purify.es.js.map +1 -1
  29. package/cjs/external/lodash/_setCacheHas.js.map +1 -1
  30. package/cjs/external/lodash/lodash.js +1 -1
  31. package/cjs/external/lodash/lodash.js.map +1 -1
  32. package/cjs/form/form-label-addon.js +1 -1
  33. package/cjs/form/form-label-addon.js.map +1 -1
  34. package/cjs/form/index.js +1 -1
  35. package/cjs/form/index.js.map +1 -1
  36. package/cjs/fullscreen-image-carousel/fullscreen-image-carousel.js +1 -1
  37. package/cjs/fullscreen-image-carousel/fullscreen-image-carousel.js.map +1 -1
  38. package/cjs/histogram-slider/histogram-slider.js.map +1 -1
  39. package/cjs/image-button/image-button.js.map +1 -1
  40. package/cjs/index.js +1 -1
  41. package/cjs/input/input.js.map +1 -1
  42. package/cjs/input-group/input-group.js.map +1 -1
  43. package/cjs/input-multi-select/input-multi-select.js.map +1 -1
  44. package/cjs/input-nested-multi-select/input-nested-multi-select.js.map +1 -1
  45. package/cjs/input-nested-select/input-nested-select.js.map +1 -1
  46. package/cjs/input-range-select/input-range-select.js.map +1 -1
  47. package/cjs/input-range-slider/input-range-slider.js.map +1 -1
  48. package/cjs/input-select/input-select.js.map +1 -1
  49. package/cjs/input-slider/input-slider.js.map +1 -1
  50. package/cjs/input-textarea/textarea.js.map +1 -1
  51. package/cjs/language-switcher/language-switcher.js.map +1 -1
  52. package/cjs/layout/index.js +1 -1
  53. package/cjs/layout/index.js.map +1 -1
  54. package/cjs/link-list/link-list.js.map +1 -1
  55. package/cjs/local-nav/local-nav-dropdown/local-nav-dropdown.js.map +1 -1
  56. package/cjs/local-nav/local-nav-menu/local-nav-menu.js.map +1 -1
  57. package/cjs/markup/markup.js.map +1 -1
  58. package/cjs/masked-input/masked-input.js.map +1 -1
  59. package/cjs/masthead/masthead.js.map +1 -1
  60. package/cjs/menu/menu.js +1 -1
  61. package/cjs/menu/menu.js.map +1 -1
  62. package/cjs/modal/index.js.map +1 -1
  63. package/cjs/modal/modal-box.js +1 -1
  64. package/cjs/modal/modal-box.js.map +1 -1
  65. package/cjs/modal-v2/index.js +1 -1
  66. package/cjs/modal-v2/index.js.map +1 -1
  67. package/cjs/modal-v2/modal-v2.js +1 -1
  68. package/cjs/modal-v2/modal-v2.js.map +1 -1
  69. package/cjs/modal-v2/slots/card.js +1 -1
  70. package/cjs/modal-v2/slots/card.js.map +1 -1
  71. package/cjs/navbar/navbar.js.map +1 -1
  72. package/cjs/notification-banner/notification-banner-hoc.js.map +1 -1
  73. package/cjs/notification-banner/notification-banner.js.map +1 -1
  74. package/cjs/otp-input/otp-input.js.map +1 -1
  75. package/cjs/otp-verification/otp-verification.js.map +1 -1
  76. package/cjs/overlay/overlay.js.map +1 -1
  77. package/cjs/pagination/pagination.js.map +1 -1
  78. package/cjs/phone-number-input/phone-number-input.js.map +1 -1
  79. package/cjs/pill/pill.js.map +1 -1
  80. package/cjs/popover/popover-inline/popover-inline.js.map +1 -1
  81. package/cjs/popover/popover-trigger.js.map +1 -1
  82. package/cjs/popover/popover.js +1 -1
  83. package/cjs/popover/popover.js.map +1 -1
  84. package/cjs/predictive-text-input/predictive-text-input.js.map +1 -1
  85. package/cjs/progress-indicator/progress-indicator.js.map +1 -1
  86. package/cjs/radio-button/radio-button.js.map +1 -1
  87. package/cjs/schedule/schedule.js.map +1 -1
  88. package/cjs/schedule/shared/with-optional-popover.js +1 -1
  89. package/cjs/schedule/shared/with-optional-popover.js.map +1 -1
  90. package/cjs/select-histogram/select-histogram.js.map +1 -1
  91. package/cjs/sidenav/sidenav.js.map +1 -1
  92. package/cjs/singpass-button/singpass-button.js.map +1 -1
  93. package/cjs/smart-app-banner/smart-app-banner.js.map +1 -1
  94. package/cjs/tab/tab.js.map +1 -1
  95. package/cjs/table/table.js.map +1 -1
  96. package/cjs/table/table.styles.js +1 -1
  97. package/cjs/table/table.styles.js.map +1 -1
  98. package/{table/table.styles_1af5ipv.css → cjs/table/table.styles_1vjx31g.css} +1 -1
  99. package/cjs/tag/tag.js.map +1 -1
  100. package/cjs/text-list/index.js.map +1 -1
  101. package/cjs/theme/theme-provider/breakpoint.js +1 -1
  102. package/cjs/theme/theme-provider/breakpoint.js.map +1 -1
  103. package/cjs/theme/theme-provider/hooks.js.map +1 -1
  104. package/cjs/theme/theme-provider/index.js.map +1 -1
  105. package/cjs/theme/tokens/border.js.map +1 -1
  106. package/cjs/theme/tokens/breakpoint.js.map +1 -1
  107. package/cjs/theme/tokens/colour.js.map +1 -1
  108. package/cjs/theme/tokens/component.js.map +1 -1
  109. package/cjs/theme/tokens/font.js.map +1 -1
  110. package/cjs/theme/tokens/media-query.js.map +1 -1
  111. package/cjs/theme/tokens/motion.js.map +1 -1
  112. package/cjs/theme/tokens/radius.js.map +1 -1
  113. package/cjs/theme/tokens/shadow.js.map +1 -1
  114. package/cjs/theme/tokens/spacing.js.map +1 -1
  115. package/cjs/theme/types.js.map +1 -1
  116. package/cjs/theme/utils/css-variable.js.map +1 -1
  117. package/cjs/theme/utils/font.js.map +1 -1
  118. package/cjs/theme/utils/use-apply-styles.js +1 -1
  119. package/cjs/theme/utils/use-apply-styles.js.map +1 -1
  120. package/cjs/theme/utils/use-design-token-override.js.map +1 -1
  121. package/cjs/theme/utils/use-design-token.js.map +1 -1
  122. package/cjs/theme/utils/use-media-query.js.map +1 -1
  123. package/cjs/time-range-picker/combobox-picker/combobox-picker.js +1 -1
  124. package/cjs/time-range-picker/combobox-picker/combobox-picker.js.map +1 -1
  125. package/cjs/time-range-picker/common.styles.js +1 -1
  126. package/cjs/time-range-picker/common.styles.js.map +1 -1
  127. package/{time-range-picker/common.styles_1qwp4xa.css → cjs/time-range-picker/common.styles_cnkkax.css} +2 -1
  128. package/cjs/time-range-picker/dial-picker/dial-picker.js +1 -1
  129. package/cjs/time-range-picker/dial-picker/dial-picker.js.map +1 -1
  130. package/cjs/time-range-picker/time-range-picker.js.map +1 -1
  131. package/cjs/time-slot-bar/time-slot-bar.js.map +1 -1
  132. package/cjs/time-slot-bar-week/time-slot-bar-week.js.map +1 -1
  133. package/cjs/time-slot-week-view/time-slot-week-view.js.map +1 -1
  134. package/cjs/timeline/timeline.js.map +1 -1
  135. package/cjs/timepicker/timepicker.js +1 -1
  136. package/cjs/timepicker/timepicker.js.map +1 -1
  137. package/cjs/timepicker/timepicker.styles.js +1 -1
  138. package/cjs/timepicker/timepicker.styles.js.map +1 -1
  139. package/cjs/timepicker/timepicker.styles_lyizvq.css +2 -0
  140. package/cjs/timetable/timetable-row/with-optional-popover.js +1 -1
  141. package/cjs/timetable/timetable-row/with-optional-popover.js.map +1 -1
  142. package/cjs/timetable/timetable.js +1 -1
  143. package/cjs/timetable/timetable.js.map +1 -1
  144. package/cjs/toast/toast.js.map +1 -1
  145. package/cjs/toggle/toggle.js.map +1 -1
  146. package/cjs/typography/index.js.map +1 -1
  147. package/cjs/uneditable-section/index.js.map +1 -1
  148. package/cjs/unit-number/unit-number-input.js.map +1 -1
  149. package/cjs/util/merge-refs.js.map +1 -1
  150. package/cjs/util/use-throttle.js +2 -0
  151. package/cjs/util/use-throttle.js.map +1 -0
  152. package/countdown-timer/types.d.ts +3 -3
  153. package/data-table/data-table.js +1 -1
  154. package/data-table/data-table.js.map +1 -1
  155. package/data-table/data-table.styles.d.ts +2 -1
  156. package/data-table/data-table.styles.js +1 -1
  157. package/data-table/data-table.styles.js.map +1 -1
  158. package/data-table/data-table.styles_rxganh.css +27 -0
  159. package/date-range-input/types.d.ts +1 -1
  160. package/drawer/types.d.ts +1 -1
  161. package/e-signature/types.d.ts +1 -1
  162. package/external/dompurify/dist/purify.es.js +2 -2
  163. package/external/dompurify/dist/purify.es.js.map +1 -1
  164. package/external/lodash/_setCacheHas.js.map +1 -1
  165. package/external/lodash/lodash.js +1 -1
  166. package/external/lodash/lodash.js.map +1 -1
  167. package/file-upload/types.d.ts +0 -1
  168. package/filter/types.d.ts +6 -10
  169. package/form/form-label-addon.js +1 -1
  170. package/form/form-label-addon.js.map +1 -1
  171. package/form/index.d.ts +65 -8
  172. package/form/index.js +1 -1
  173. package/form/index.js.map +1 -1
  174. package/form/types.d.ts +155 -6
  175. package/fullscreen-image-carousel/fullscreen-image-carousel.d.ts +7 -0
  176. package/fullscreen-image-carousel/fullscreen-image-carousel.js +1 -1
  177. package/fullscreen-image-carousel/fullscreen-image-carousel.js.map +1 -1
  178. package/fullscreen-image-carousel/types.d.ts +91 -3
  179. package/histogram-slider/histogram-slider.d.ts +6 -0
  180. package/histogram-slider/histogram-slider.js.map +1 -1
  181. package/histogram-slider/types.d.ts +63 -3
  182. package/image-button/image-button.d.ts +6 -0
  183. package/image-button/image-button.js.map +1 -1
  184. package/image-button/types.d.ts +11 -1
  185. package/index.js +1 -1
  186. package/input/input.d.ts +6 -0
  187. package/input/input.js.map +1 -1
  188. package/input/types.d.ts +38 -2
  189. package/input-group/input-group.d.ts +7 -0
  190. package/input-group/input-group.js.map +1 -1
  191. package/input-group/types.d.ts +84 -8
  192. package/input-multi-select/input-multi-select.d.ts +6 -0
  193. package/input-multi-select/input-multi-select.js.map +1 -1
  194. package/input-multi-select/types.d.ts +46 -5
  195. package/input-nested-multi-select/input-nested-multi-select.d.ts +8 -0
  196. package/input-nested-multi-select/input-nested-multi-select.js.map +1 -1
  197. package/input-nested-multi-select/types.d.ts +35 -5
  198. package/input-nested-select/input-nested-select.d.ts +9 -2
  199. package/input-nested-select/input-nested-select.js.map +1 -1
  200. package/input-nested-select/types.d.ts +77 -8
  201. package/input-range-select/input-range-select.d.ts +6 -0
  202. package/input-range-select/input-range-select.js.map +1 -1
  203. package/input-range-select/types.d.ts +68 -1
  204. package/input-range-slider/input-range-slider.d.ts +7 -0
  205. package/input-range-slider/input-range-slider.js.map +1 -1
  206. package/input-range-slider/types.d.ts +91 -6
  207. package/input-select/input-select.d.ts +5 -0
  208. package/input-select/input-select.js.map +1 -1
  209. package/input-select/types.d.ts +70 -14
  210. package/input-slider/input-slider.d.ts +6 -0
  211. package/input-slider/input-slider.js.map +1 -1
  212. package/input-slider/types.d.ts +21 -2
  213. package/input-textarea/textarea.d.ts +3 -0
  214. package/input-textarea/textarea.js.map +1 -1
  215. package/input-textarea/types.d.ts +24 -1
  216. package/language-switcher/language-switcher.d.ts +6 -0
  217. package/language-switcher/language-switcher.js.map +1 -1
  218. package/language-switcher/types.d.ts +23 -0
  219. package/layout/index.d.ts +16 -2
  220. package/layout/index.js +1 -1
  221. package/layout/index.js.map +1 -1
  222. package/layout/types.d.ts +61 -3
  223. package/link-list/internal-types.d.ts +57 -3
  224. package/link-list/link-list.d.ts +6 -0
  225. package/link-list/link-list.js.map +1 -1
  226. package/link-list/types.d.ts +3 -0
  227. package/local-nav/local-nav-dropdown/local-nav-dropdown.d.ts +11 -0
  228. package/local-nav/local-nav-dropdown/local-nav-dropdown.js.map +1 -1
  229. package/local-nav/local-nav-menu/local-nav-menu.d.ts +6 -0
  230. package/local-nav/local-nav-menu/local-nav-menu.js.map +1 -1
  231. package/local-nav/types.d.ts +51 -0
  232. package/markup/markup.d.ts +6 -0
  233. package/markup/markup.js.map +1 -1
  234. package/markup/types.d.ts +6 -2
  235. package/masked-input/masked-input.d.ts +6 -0
  236. package/masked-input/masked-input.js.map +1 -1
  237. package/masked-input/types.d.ts +83 -8
  238. package/masthead/masthead.d.ts +6 -0
  239. package/masthead/masthead.js.map +1 -1
  240. package/masthead/types.d.ts +9 -0
  241. package/menu/menu.d.ts +27 -4
  242. package/menu/menu.js +1 -1
  243. package/menu/menu.js.map +1 -1
  244. package/menu/types.d.ts +32 -0
  245. package/modal/index.d.ts +13 -0
  246. package/modal/index.js.map +1 -1
  247. package/modal/modal-box.js +1 -1
  248. package/modal/modal-box.js.map +1 -1
  249. package/modal/types.d.ts +54 -7
  250. package/modal-v2/index.d.ts +1 -15
  251. package/modal-v2/index.js +1 -1
  252. package/modal-v2/index.js.map +1 -1
  253. package/modal-v2/modal-v2.d.ts +32 -1
  254. package/modal-v2/modal-v2.js +1 -1
  255. package/modal-v2/modal-v2.js.map +1 -1
  256. package/modal-v2/slots/card.js +1 -1
  257. package/modal-v2/slots/card.js.map +1 -1
  258. package/modal-v2/types.d.ts +75 -8
  259. package/navbar/navbar.d.ts +7 -0
  260. package/navbar/navbar.js.map +1 -1
  261. package/navbar/types.d.ts +200 -13
  262. package/notification-banner/notification-banner-hoc.d.ts +6 -0
  263. package/notification-banner/notification-banner-hoc.js.map +1 -1
  264. package/notification-banner/notification-banner.d.ts +7 -0
  265. package/notification-banner/notification-banner.js.map +1 -1
  266. package/notification-banner/types.d.ts +57 -2
  267. package/otp-input/otp-input.d.ts +7 -0
  268. package/otp-input/otp-input.js.map +1 -1
  269. package/otp-input/types.d.ts +54 -11
  270. package/otp-verification/internal-types.d.ts +22 -5
  271. package/otp-verification/otp-verification.d.ts +6 -0
  272. package/otp-verification/otp-verification.js.map +1 -1
  273. package/otp-verification/types.d.ts +125 -6
  274. package/overlay/overlay.d.ts +7 -0
  275. package/overlay/overlay.js.map +1 -1
  276. package/overlay/types.d.ts +57 -2
  277. package/package.json +1 -1
  278. package/pagination/pagination.d.ts +5 -0
  279. package/pagination/pagination.js.map +1 -1
  280. package/pagination/types.d.ts +48 -0
  281. package/phone-number-input/phone-number-input.d.ts +7 -0
  282. package/phone-number-input/phone-number-input.js.map +1 -1
  283. package/phone-number-input/types.d.ts +78 -13
  284. package/pill/pill.d.ts +6 -0
  285. package/pill/pill.js.map +1 -1
  286. package/pill/types.d.ts +19 -0
  287. package/popover/popover-inline/popover-inline.d.ts +5 -0
  288. package/popover/popover-inline/popover-inline.js.map +1 -1
  289. package/popover/popover-trigger.d.ts +6 -0
  290. package/popover/popover-trigger.js.map +1 -1
  291. package/popover/popover.d.ts +6 -0
  292. package/popover/popover.js +1 -1
  293. package/popover/popover.js.map +1 -1
  294. package/popover/types.d.ts +150 -3
  295. package/predictive-text-input/predictive-text-input.d.ts +6 -0
  296. package/predictive-text-input/predictive-text-input.js.map +1 -1
  297. package/predictive-text-input/types.d.ts +65 -11
  298. package/progress-indicator/progress-indicator.d.ts +7 -0
  299. package/progress-indicator/progress-indicator.js.map +1 -1
  300. package/progress-indicator/types.d.ts +18 -0
  301. package/radio-button/radio-button.d.ts +5 -0
  302. package/radio-button/radio-button.js.map +1 -1
  303. package/radio-button/types.d.ts +11 -0
  304. package/schedule/internal-types.d.ts +18 -0
  305. package/schedule/schedule-day-view/types.d.ts +2 -1
  306. package/schedule/schedule-week-view/types.d.ts +2 -1
  307. package/schedule/schedule.d.ts +3 -0
  308. package/schedule/schedule.js.map +1 -1
  309. package/schedule/shared/with-optional-popover.js +1 -1
  310. package/schedule/shared/with-optional-popover.js.map +1 -1
  311. package/schedule/types.d.ts +129 -10
  312. package/select-histogram/select-histogram.d.ts +5 -0
  313. package/select-histogram/select-histogram.js.map +1 -1
  314. package/select-histogram/types.d.ts +57 -4
  315. package/shared/dropdown-list/types.d.ts +52 -19
  316. package/shared/dropdown-wrapper/types.d.ts +6 -0
  317. package/sidenav/sidenav.d.ts +10 -0
  318. package/sidenav/sidenav.js.map +1 -1
  319. package/sidenav/types.d.ts +70 -21
  320. package/singpass-button/singpass-button.d.ts +6 -0
  321. package/singpass-button/singpass-button.js.map +1 -1
  322. package/singpass-button/types.d.ts +29 -2
  323. package/smart-app-banner/smart-app-banner.d.ts +5 -0
  324. package/smart-app-banner/smart-app-banner.js.map +1 -1
  325. package/smart-app-banner/types.d.ts +54 -0
  326. package/tab/tab.d.ts +7 -0
  327. package/tab/tab.js.map +1 -1
  328. package/tab/types.d.ts +55 -6
  329. package/table/table.d.ts +21 -0
  330. package/table/table.js.map +1 -1
  331. package/table/table.styles.js +1 -1
  332. package/table/table.styles.js.map +1 -1
  333. package/{cjs/table/table.styles_1af5ipv.css → table/table.styles_1vjx31g.css} +1 -1
  334. package/tag/tag.d.ts +5 -0
  335. package/tag/tag.js.map +1 -1
  336. package/tag/types.d.ts +24 -0
  337. package/text-list/index.d.ts +17 -0
  338. package/text-list/index.js.map +1 -1
  339. package/text-list/types.d.ts +33 -4
  340. package/theme/theme-provider/breakpoint.d.ts +0 -1
  341. package/theme/theme-provider/breakpoint.js +1 -1
  342. package/theme/theme-provider/breakpoint.js.map +1 -1
  343. package/theme/theme-provider/hooks.d.ts +16 -0
  344. package/theme/theme-provider/hooks.js.map +1 -1
  345. package/theme/theme-provider/index.d.ts +7 -0
  346. package/theme/theme-provider/index.js.map +1 -1
  347. package/theme/theme-provider/types.d.ts +14 -0
  348. package/theme/tokens/border.d.ts +3 -0
  349. package/theme/tokens/border.js.map +1 -1
  350. package/theme/tokens/breakpoint.d.ts +3 -0
  351. package/theme/tokens/breakpoint.js.map +1 -1
  352. package/theme/tokens/colour.d.ts +3 -0
  353. package/theme/tokens/colour.js.map +1 -1
  354. package/theme/tokens/component.d.ts +1 -0
  355. package/theme/tokens/component.js.map +1 -1
  356. package/theme/tokens/font.d.ts +2 -0
  357. package/theme/tokens/font.js.map +1 -1
  358. package/theme/tokens/media-query.d.ts +1 -0
  359. package/theme/tokens/media-query.js.map +1 -1
  360. package/theme/tokens/motion.d.ts +1 -0
  361. package/theme/tokens/motion.js.map +1 -1
  362. package/theme/tokens/radius.d.ts +1 -0
  363. package/theme/tokens/radius.js.map +1 -1
  364. package/theme/tokens/shadow.d.ts +1 -0
  365. package/theme/tokens/shadow.js.map +1 -1
  366. package/theme/tokens/spacing.d.ts +1 -0
  367. package/theme/tokens/spacing.js.map +1 -1
  368. package/theme/types.d.ts +23 -3
  369. package/theme/types.js.map +1 -1
  370. package/theme/utils/css-variable.d.ts +10 -2
  371. package/theme/utils/css-variable.js.map +1 -1
  372. package/theme/utils/font.d.ts +2 -1
  373. package/theme/utils/font.js.map +1 -1
  374. package/theme/utils/use-apply-styles.d.ts +8 -2
  375. package/theme/utils/use-apply-styles.js +1 -1
  376. package/theme/utils/use-apply-styles.js.map +1 -1
  377. package/theme/utils/use-design-token-override.d.ts +9 -1
  378. package/theme/utils/use-design-token-override.js.map +1 -1
  379. package/theme/utils/use-design-token.d.ts +9 -0
  380. package/theme/utils/use-design-token.js.map +1 -1
  381. package/theme/utils/use-media-query.d.ts +41 -3
  382. package/theme/utils/use-media-query.js.map +1 -1
  383. package/time-range-picker/combobox-picker/combobox-picker.js +1 -1
  384. package/time-range-picker/combobox-picker/combobox-picker.js.map +1 -1
  385. package/time-range-picker/common.styles.d.ts +1 -0
  386. package/time-range-picker/common.styles.js +1 -1
  387. package/time-range-picker/common.styles.js.map +1 -1
  388. package/{cjs/time-range-picker/common.styles_1qwp4xa.css → time-range-picker/common.styles_cnkkax.css} +2 -1
  389. package/time-range-picker/dial-picker/dial-picker.js +1 -1
  390. package/time-range-picker/dial-picker/dial-picker.js.map +1 -1
  391. package/time-range-picker/time-range-picker.d.ts +5 -0
  392. package/time-range-picker/time-range-picker.js.map +1 -1
  393. package/time-range-picker/types.d.ts +85 -25
  394. package/time-slot-bar/internal-types.d.ts +1 -0
  395. package/time-slot-bar/time-slot-bar.d.ts +7 -0
  396. package/time-slot-bar/time-slot-bar.js.map +1 -1
  397. package/time-slot-bar/types.d.ts +112 -20
  398. package/time-slot-bar-week/time-slot-bar-week.d.ts +8 -0
  399. package/time-slot-bar-week/time-slot-bar-week.js.map +1 -1
  400. package/time-slot-bar-week/types.d.ts +74 -13
  401. package/time-slot-week-view/time-slot-week-view.d.ts +7 -0
  402. package/time-slot-week-view/time-slot-week-view.js.map +1 -1
  403. package/time-slot-week-view/types.d.ts +53 -10
  404. package/timeline/timeline.d.ts +6 -0
  405. package/timeline/timeline.js.map +1 -1
  406. package/timeline/types.d.ts +58 -4
  407. package/timepicker/timepicker.d.ts +5 -0
  408. package/timepicker/timepicker.js +1 -1
  409. package/timepicker/timepicker.js.map +1 -1
  410. package/timepicker/timepicker.styles.d.ts +1 -0
  411. package/timepicker/timepicker.styles.js +1 -1
  412. package/timepicker/timepicker.styles.js.map +1 -1
  413. package/timepicker/timepicker.styles_lyizvq.css +2 -0
  414. package/timepicker/types.d.ts +49 -14
  415. package/timetable/timetable-row/with-optional-popover.js +1 -1
  416. package/timetable/timetable-row/with-optional-popover.js.map +1 -1
  417. package/timetable/timetable.d.ts +6 -0
  418. package/timetable/timetable.js +1 -1
  419. package/timetable/timetable.js.map +1 -1
  420. package/timetable/types.d.ts +175 -50
  421. package/toast/toast.d.ts +6 -0
  422. package/toast/toast.js.map +1 -1
  423. package/toast/types.d.ts +42 -8
  424. package/toggle/toggle.d.ts +6 -0
  425. package/toggle/toggle.js.map +1 -1
  426. package/toggle/types.d.ts +95 -17
  427. package/typography/index.d.ts +29 -0
  428. package/typography/index.js.map +1 -1
  429. package/typography/types.d.ts +51 -8
  430. package/uneditable-section/index.d.ts +15 -0
  431. package/uneditable-section/index.js.map +1 -1
  432. package/uneditable-section/types.d.ts +66 -23
  433. package/unit-number/types.d.ts +30 -4
  434. package/unit-number/unit-number-input.d.ts +6 -0
  435. package/unit-number/unit-number-input.js.map +1 -1
  436. package/util/index.d.ts +1 -0
  437. package/util/merge-refs.d.ts +1 -1
  438. package/util/merge-refs.js.map +1 -1
  439. package/util/use-throttle.d.ts +1 -0
  440. package/util/use-throttle.js +2 -0
  441. package/util/use-throttle.js.map +1 -0
  442. package/cjs/data-table/data-table.styles_1iqq1g7.css +0 -26
  443. package/cjs/timepicker/timepicker.styles_1jm33yw.css +0 -1
  444. package/data-table/data-table.styles_1iqq1g7.css +0 -26
  445. package/timepicker/timepicker.styles_1jm33yw.css +0 -1
@@ -1,45 +1,106 @@
1
1
  import type { CommonCalendarProps } from "../shared/internal-calendar/types";
2
2
  import type { TimeSlot } from "../time-slot-bar/types";
3
+ /**
4
+ * Controls how time slot cells are sized within a day column.
5
+ *
6
+ * - `"flexible"` — cells expand proportionally to fill available height.
7
+ * - `"fixed"` — all cells have equal, fixed height regardless of content.
8
+ */
3
9
  export type TimeSlotCellsVariant = "flexible" | "fixed";
10
+ /**
11
+ * Props for the `TimeSlotBarWeek` component.
12
+ */
4
13
  export interface TimeSlotBarWeekProps extends CommonCalendarProps {
5
14
  className?: string | undefined;
6
15
  "data-testid"?: string | undefined;
7
16
  id?: string | undefined;
8
- /** Time slots to render */
17
+ /**
18
+ * Map of date strings (YYYY-MM-DD) to the time slot arrays to render for
19
+ * that date.
20
+ */
9
21
  slots: {
10
22
  [date: string]: TimeSlot[];
11
23
  };
12
- /** The start time of the time slot cells in HH:mm format */
24
+ /**
25
+ * The start boundary of the visible time range, in HH:mm format.
26
+ */
13
27
  startTime?: string | undefined;
14
- /** The end time of the time slot cells in HH:mm format */
28
+ /**
29
+ * The end boundary of the visible time range, in HH:mm format.
30
+ */
15
31
  endTime?: string | undefined;
16
- /** The value of the selected date in YYYY-MM-DD format */
32
+ /**
33
+ * The currently selected date in YYYY-MM-DD format. Controls the
34
+ * highlighted day column.
35
+ */
17
36
  value?: string | undefined;
18
- /** Number of minutes each cell should represent */
37
+ /**
38
+ * Duration in minutes that each time slot cell represents.
39
+ */
19
40
  interval?: number | undefined;
20
- /** Variant for the timeslot cells that will be rendered */
41
+ /**
42
+ * Controls how time slot cells are sized within each day column.
43
+ */
21
44
  variant?: TimeSlotCellsVariant | undefined;
22
- /** Maximum height (px) of the entire timeslot component before it becomes truncated */
45
+ /**
46
+ * Maximum height in pixels for the time slot area before it becomes
47
+ * truncated.
48
+ */
23
49
  maxVisibleCellHeight?: number | undefined;
24
- /** Specifies if the month/year dropdown and navigation arrows should be displayed. */
50
+ /**
51
+ * Whether to show the month/year pickers and the prev/next week navigation
52
+ * arrows above the week grid.
53
+ *
54
+ * @default true
55
+ */
25
56
  showNavigationHeader?: boolean | undefined;
26
- /** Specifies if date can be selected */
57
+ /**
58
+ * When `true`, the user can click a day column to select that date,
59
+ * triggering `onChange`.
60
+ */
27
61
  enableSelection?: boolean | undefined;
28
- /** The initial date to be visible in the week view in YYYY-DD-MM format */
62
+ /**
63
+ * The date used to determine which week is shown on first render, in
64
+ * YYYY-MM-DD format.
65
+ *
66
+ * @remarks Ignored when `value` is set.
67
+ */
29
68
  currentCalendarDate?: string | undefined;
30
- /** Called when user clicks on a time slot */
69
+ /**
70
+ * Called when the user clicks a time slot cell.
71
+ *
72
+ * @param date The date of the clicked slot, in YYYY-MM-DD format.
73
+ * @param timeSlot The slot that was clicked.
74
+ */
31
75
  onSlotClick?: ((date: string, timeSlot: TimeSlot) => void) | undefined;
32
- /** Called when user clicks on a date */
76
+ /**
77
+ * Called when the user selects a date. Requires `enableSelection` to be
78
+ * `true`.
79
+ *
80
+ * @param value The selected date in YYYY-MM-DD format.
81
+ */
33
82
  onChange?: ((value: string) => void) | undefined;
34
- /** Called when the current visible week changes */
83
+ /**
84
+ * Called when the visible week changes due to navigation.
85
+ *
86
+ * @param value An object describing the newly displayed week
87
+ */
35
88
  onWeekDisplayChange?: ((value: YearMonthWeekDisplay) => void) | undefined;
36
89
  }
90
+ /**
91
+ * Payload passed to `onWeekDisplayChange` describing the newly visible week.
92
+ *
93
+ */
37
94
  interface YearMonthWeekDisplay {
95
+ /**
96
+ * The first and last days of the newly displayed week in YYYY-MM-DD format.
97
+ */
38
98
  week: {
39
99
  firstDayOfWeek: string;
40
100
  lastDayOfWeek: string;
41
101
  };
42
102
  year: number;
103
+ /** `month` is 1-indexed */
43
104
  month: number;
44
105
  }
45
106
  export {};
@@ -1,2 +1,9 @@
1
1
  import type { TimeSlotWeekViewProps } from "./types";
2
+ /**
3
+ * A week calendar grid that displays slot availability within each day column.
4
+ *
5
+ * Use `TimeSlotWeekView` for a day-level overview of slot availability across
6
+ * a week. For detailed time-of-day scheduling with a time axis, use
7
+ * `TimeSlotBarWeek` instead.
8
+ */
2
9
  export declare const TimeSlotWeekView: ({ disabledDates, onWeekDisplayChange, onChange, value, minDate, maxDate, slots, showNavigationHeader, enableSelection, onSlotClick, currentCalendarDate, ...otherProps }: TimeSlotWeekViewProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"time-slot-week-view.js","sources":["../../src/time-slot-week-view/time-slot-week-view.tsx"],"sourcesContent":["import type { Dayjs } from \"dayjs\";\nimport dayjs from \"dayjs\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type { CalendarManagerRef } from \"../shared/internal-calendar\";\nimport { CalendarManager } from \"../shared/internal-calendar/calendar-manager\";\nimport type { TimeSlot } from \"../time-slot-bar\";\nimport { DateHelper } from \"../util\";\nimport { TimeSlotWeekDays } from \"./time-slot-week-days\";\nimport * as styles from \"./time-slot-week-view.styles\";\nimport type { TimeSlotWeekViewProps } from \"./types\";\n\nconst DATE_FORMAT = \"YYYY-MM-DD\";\n\nexport const TimeSlotWeekView = ({\n disabledDates,\n onWeekDisplayChange,\n onChange,\n value,\n minDate,\n maxDate,\n slots,\n showNavigationHeader = true,\n enableSelection,\n onSlotClick,\n currentCalendarDate,\n ...otherProps\n}: TimeSlotWeekViewProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const [selectedDate, setSelectedDate] = useState<string | undefined>(value); // YYYY-MM-DD\n const calendarManagerRef = useRef<CalendarManagerRef>(null);\n const previousCalendarDate = useRef<Dayjs | undefined>(undefined);\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n useEffect(() => {\n setSelectedDate(value);\n }, [value]);\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n\n const handleDateSelect = (value: Dayjs) => {\n const stringValue = value.format(DATE_FORMAT);\n setSelectedDate(stringValue);\n onChange?.(stringValue);\n };\n\n const handleOnSlotClick = (date: string, slot: TimeSlot) => {\n if (onSlotClick) {\n onSlotClick(date, slot);\n }\n };\n\n const handleOnCalendarDateChange = (value: Dayjs) => {\n if (\n !previousCalendarDate.current ||\n !previousCalendarDate.current.isSame(value, \"week\")\n ) {\n performDisplayChangeHandler(value);\n }\n previousCalendarDate.current = value;\n };\n\n // =============================================================================\n // HELPERS\n // =============================================================================\n\n const performDisplayChangeHandler = (value: Dayjs) => {\n if (onWeekDisplayChange) {\n const returnValue = {\n week: {\n firstDayOfWeek: value.startOf(\"week\").format(DATE_FORMAT),\n lastDayOfWeek: value.endOf(\"week\").format(DATE_FORMAT),\n },\n month: value.month() + 1,\n year: value.year(),\n };\n\n onWeekDisplayChange(returnValue);\n }\n };\n\n const getInitialCalendarDate = () => {\n return DateHelper.toDayjs(selectedDate || currentCalendarDate)\n .endOf(\"week\")\n .format(DATE_FORMAT);\n };\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n\n return (\n <div className={styles.wrapper} {...otherProps}>\n <CalendarManager\n ref={calendarManagerRef}\n dynamicHeight\n initialCalendarDate={getInitialCalendarDate()}\n selectedStartDate={selectedDate}\n getLeftArrowDate={(day) => day.subtract(1, \"week\")}\n getRightArrowDate={(day) => day.add(1, \"week\")}\n isLeftArrowDisabled={(calendarDate) =>\n !!minDate &&\n dayjs(calendarDate)\n .subtract(1, \"week\")\n .isBefore(minDate, \"week\")\n }\n isRightArrowDisabled={(calendarDate) =>\n !!maxDate &&\n dayjs(calendarDate).add(1, \"week\").isAfter(maxDate, \"week\")\n }\n onCalendarDateChange={handleOnCalendarDateChange}\n showNavigationHeader={showNavigationHeader}\n minDate={minDate}\n maxDate={maxDate}\n getMonthHeaderLabel={(calendarDate) =>\n dayjs(calendarDate).endOf(\"week\").format(\"MMM\")\n }\n getYearHeaderLabel={(calendarDate) =>\n dayjs(calendarDate).endOf(\"week\").format(\"YYYY\")\n }\n isFocusable={true}\n >\n {({ calendarDate }) => {\n return (\n <TimeSlotWeekDays\n calendarDate={calendarDate}\n disabledDates={disabledDates}\n selectedDate={selectedDate}\n minDate={minDate}\n maxDate={maxDate}\n onSelect={handleDateSelect}\n slots={slots}\n enableSelection={enableSelection}\n onSlotClick={handleOnSlotClick}\n />\n );\n }}\n </CalendarManager>\n </div>\n );\n};\n"],"names":["DATE_FORMAT","TimeSlotWeekView","_a","disabledDates","onWeekDisplayChange","onChange","value","minDate","maxDate","slots","showNavigationHeader","enableSelection","onSlotClick","currentCalendarDate","otherProps","__rest","selectedDate","setSelectedDate","useState","calendarManagerRef","useRef","previousCalendarDate","undefined","useEffect","handleDateSelect","stringValue","format","handleOnSlotClick","date","slot","performDisplayChangeHandler","returnValue","week","firstDayOfWeek","startOf","lastDayOfWeek","endOf","month","year","_jsx","Object","assign","className","styles.wrapper","children","CalendarManager","ref","dynamicHeight","initialCalendarDate","DateHelper","toDayjs","selectedStartDate","getLeftArrowDate","day","subtract","getRightArrowDate","add","isLeftArrowDisabled","calendarDate","dayjs","isBefore","isRightArrowDisabled","isAfter","onCalendarDateChange","current","isSame","getMonthHeaderLabel","getYearHeaderLabel","isFocusable","TimeSlotWeekDays","onSelect"],"mappings":"2kBAYA,MAAMA,EAAc,aAEPC,EAA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E3BsD,qBAAuBH,KACjBlD,GACFmD,EAAMD,GAAcF,IAAI,EAAG,QAAQM,QAAQtD,EAAS,QAExDuD,qBA1DwBzD,IAE3Be,EAAqB2C,SACrB3C,EAAqB2C,QAAQC,OAAO3D,EAAO,SAE5CwB,EAA4BxB,GAEhCe,EAAqB2C,QAAU1D,CAAK,EAoD5BI,qBAAsBA,EACtBH,QAASA,EACTC,QAASA,EACT0D,oBAAsBR,GAClBC,EAAMD,GAActB,MAAM,QAAQV,OAAO,OAE7CyC,mBAAqBT,GACjBC,EAAMD,GAActB,MAAM,QAAQV,OAAO,QAE7C0C,aAAa,EAAIxB,SAEhB,EAAGc,kBAEInB,EAAC8B,GACGX,aAAcA,EACdvD,cAAeA,EACfa,aAAcA,EACdT,QAASA,EACTC,QAASA,EACT8D,SAAU9C,EACVf,MAAOA,EACPE,gBAAiBA,EACjBC,YAAae,QAK3B"}
1
+ {"version":3,"file":"time-slot-week-view.js","sources":["../../src/time-slot-week-view/time-slot-week-view.tsx"],"sourcesContent":["import type { Dayjs } from \"dayjs\";\nimport dayjs from \"dayjs\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type { CalendarManagerRef } from \"../shared/internal-calendar\";\nimport { CalendarManager } from \"../shared/internal-calendar/calendar-manager\";\nimport type { TimeSlot } from \"../time-slot-bar\";\nimport { DateHelper } from \"../util\";\nimport { TimeSlotWeekDays } from \"./time-slot-week-days\";\nimport * as styles from \"./time-slot-week-view.styles\";\nimport type { TimeSlotWeekViewProps } from \"./types\";\n\nconst DATE_FORMAT = \"YYYY-MM-DD\";\n\n/**\n * A week calendar grid that displays slot availability within each day column.\n *\n * Use `TimeSlotWeekView` for a day-level overview of slot availability across\n * a week. For detailed time-of-day scheduling with a time axis, use\n * `TimeSlotBarWeek` instead.\n */\nexport const TimeSlotWeekView = ({\n disabledDates,\n onWeekDisplayChange,\n onChange,\n value,\n minDate,\n maxDate,\n slots,\n showNavigationHeader = true,\n enableSelection,\n onSlotClick,\n currentCalendarDate,\n ...otherProps\n}: TimeSlotWeekViewProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const [selectedDate, setSelectedDate] = useState<string | undefined>(value); // YYYY-MM-DD\n const calendarManagerRef = useRef<CalendarManagerRef>(null);\n const previousCalendarDate = useRef<Dayjs | undefined>(undefined);\n\n // =============================================================================\n // EFFECTS\n // =============================================================================\n useEffect(() => {\n setSelectedDate(value);\n }, [value]);\n\n // =============================================================================\n // EVENT HANDLERS\n // =============================================================================\n\n const handleDateSelect = (value: Dayjs) => {\n const stringValue = value.format(DATE_FORMAT);\n setSelectedDate(stringValue);\n onChange?.(stringValue);\n };\n\n const handleOnSlotClick = (date: string, slot: TimeSlot) => {\n if (onSlotClick) {\n onSlotClick(date, slot);\n }\n };\n\n const handleOnCalendarDateChange = (value: Dayjs) => {\n if (\n !previousCalendarDate.current ||\n !previousCalendarDate.current.isSame(value, \"week\")\n ) {\n performDisplayChangeHandler(value);\n }\n previousCalendarDate.current = value;\n };\n\n // =============================================================================\n // HELPERS\n // =============================================================================\n\n const performDisplayChangeHandler = (value: Dayjs) => {\n if (onWeekDisplayChange) {\n const returnValue = {\n week: {\n firstDayOfWeek: value.startOf(\"week\").format(DATE_FORMAT),\n lastDayOfWeek: value.endOf(\"week\").format(DATE_FORMAT),\n },\n month: value.month() + 1,\n year: value.year(),\n };\n\n onWeekDisplayChange(returnValue);\n }\n };\n\n const getInitialCalendarDate = () => {\n return DateHelper.toDayjs(selectedDate || currentCalendarDate)\n .endOf(\"week\")\n .format(DATE_FORMAT);\n };\n\n // =============================================================================\n // RENDER FUNCTIONS\n // =============================================================================\n\n return (\n <div className={styles.wrapper} {...otherProps}>\n <CalendarManager\n ref={calendarManagerRef}\n dynamicHeight\n initialCalendarDate={getInitialCalendarDate()}\n selectedStartDate={selectedDate}\n getLeftArrowDate={(day) => day.subtract(1, \"week\")}\n getRightArrowDate={(day) => day.add(1, \"week\")}\n isLeftArrowDisabled={(calendarDate) =>\n !!minDate &&\n dayjs(calendarDate)\n .subtract(1, \"week\")\n .isBefore(minDate, \"week\")\n }\n isRightArrowDisabled={(calendarDate) =>\n !!maxDate &&\n dayjs(calendarDate).add(1, \"week\").isAfter(maxDate, \"week\")\n }\n onCalendarDateChange={handleOnCalendarDateChange}\n showNavigationHeader={showNavigationHeader}\n minDate={minDate}\n maxDate={maxDate}\n getMonthHeaderLabel={(calendarDate) =>\n dayjs(calendarDate).endOf(\"week\").format(\"MMM\")\n }\n getYearHeaderLabel={(calendarDate) =>\n dayjs(calendarDate).endOf(\"week\").format(\"YYYY\")\n }\n isFocusable={true}\n >\n {({ calendarDate }) => {\n return (\n <TimeSlotWeekDays\n calendarDate={calendarDate}\n disabledDates={disabledDates}\n selectedDate={selectedDate}\n minDate={minDate}\n maxDate={maxDate}\n onSelect={handleDateSelect}\n slots={slots}\n enableSelection={enableSelection}\n onSlotClick={handleOnSlotClick}\n />\n );\n }}\n </CalendarManager>\n </div>\n );\n};\n"],"names":["DATE_FORMAT","TimeSlotWeekView","_a","disabledDates","onWeekDisplayChange","onChange","value","minDate","maxDate","slots","showNavigationHeader","enableSelection","onSlotClick","currentCalendarDate","otherProps","__rest","selectedDate","setSelectedDate","useState","calendarManagerRef","useRef","previousCalendarDate","undefined","useEffect","handleDateSelect","stringValue","format","handleOnSlotClick","date","slot","performDisplayChangeHandler","returnValue","week","firstDayOfWeek","startOf","lastDayOfWeek","endOf","month","year","_jsx","Object","assign","className","styles.wrapper","children","CalendarManager","ref","dynamicHeight","initialCalendarDate","DateHelper","toDayjs","selectedStartDate","getLeftArrowDate","day","subtract","getRightArrowDate","add","isLeftArrowDisabled","calendarDate","dayjs","isBefore","isRightArrowDisabled","isAfter","onCalendarDateChange","current","isSame","getMonthHeaderLabel","getYearHeaderLabel","isFocusable","TimeSlotWeekDays","onSelect"],"mappings":"2kBAYA,MAAMA,EAAc,aASPC,EAAoBC,IAAA,IAAAC,cAC7BA,EAAaC,oBACbA,EAAmBC,SACnBA,EAAQC,MACR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AAQtD,EAAS,QAExDuD,qBA1DwBzD,IAE3Be,EAAqB2C,SACrB3C,EAAqB2C,QAAQC,OAAO3D,EAAO,SAE5CwB,EAA4BxB,GAEhCe,EAAqB2C,QAAU1D,CAAK,EAoD5BI,qBAAsBA,EACtBH,QAASA,EACTC,QAASA,EACT0D,oBAAsBR,GAClBC,EAAMD,GAActB,MAAM,QAAQV,OAAO,OAE7CyC,mBAAqBT,GACjBC,EAAMD,GAActB,MAAM,QAAQV,OAAO,QAE7C0C,aAAa,EAAIxB,SAEhB,EAAGc,kBAEInB,EAAC8B,GACGX,aAAcA,EACdvD,cAAeA,EACfa,aAAcA,EACdT,QAASA,EACTC,QAASA,EACT8D,SAAU9C,EACVf,MAAOA,EACPE,gBAAiBA,EACjBC,YAAae,QAK3B"}
@@ -1,34 +1,77 @@
1
1
  import type { CommonCalendarProps } from "../shared/internal-calendar/types";
2
2
  import type { TimeSlot } from "../time-slot-bar/types";
3
+ /**
4
+ * Props for the `TimeSlotWeekView` component.
5
+ */
3
6
  export interface TimeSlotWeekViewProps extends CommonCalendarProps {
4
7
  className?: string | undefined;
5
8
  "data-testid"?: string | undefined;
6
9
  id?: string | undefined;
7
- /** The value of the selected date in YYYY-MM-DD format */
10
+ /**
11
+ * The currently selected date in `YYYY-MM-DD` format.
12
+ * Controls the highlighted day in the week view.
13
+ */
8
14
  value?: string | undefined;
9
- /** Time slots to render */
15
+ /**
16
+ * Map of date strings (YYYY-MM-DD) to an array of `TimeSlot`
17
+ * entries displayed in that day's column.
18
+ */
10
19
  slots?: {
11
20
  [date: string]: TimeSlot[];
12
21
  } | undefined;
13
- /** Specifies if the month/year dropdown and navigation arrows should be displayed. */
22
+ /**
23
+ * Whether to show the month/year picker and the prev/next week navigation
24
+ * arrows above the week grid.
25
+ *
26
+ * @default true
27
+ */
14
28
  showNavigationHeader?: boolean | undefined;
15
- /** Specifies if date can be selected */
29
+ /**
30
+ * When `true`, the user can click a day column to select that date,
31
+ * triggering `onChange`
32
+ */
16
33
  enableSelection?: boolean | undefined;
17
- /** The initial date to be visible in the week view in YYYY-DD-MM format */
34
+ /**
35
+ * The date used to determine which week is shown on first render, in
36
+ * YYYY-MM-DD format.
37
+ *
38
+ * @remarks Ignored when `value` is set.
39
+ */
18
40
  currentCalendarDate?: string | undefined;
19
- /** Called when user clicks on a time slot */
41
+ /**
42
+ * Called when the user clicks a time slot cell.
43
+ *
44
+ * @param date The date of the clicked slot, in YYYY-MM-DD format.
45
+ * @param timeSlot The slot that was clicked.
46
+ */
20
47
  onSlotClick?: ((date: string, timeSlot: TimeSlot) => void) | undefined;
21
- /** Called when user clicks on a date */
48
+ /**
49
+ * Called when the user selects a date. Requires `enableSelection` to be
50
+ * `true`.
51
+ *
52
+ * @param value The selected date in YYYY-MM-DD format.
53
+ */
22
54
  onChange?: ((value: string) => void) | undefined;
23
- /** Called when the current visible week changes */
55
+ /**
56
+ * Called when the visible week changes due to navigation.
57
+ *
58
+ * @param value An object describing the newly displayed week
59
+ */
24
60
  onWeekDisplayChange?: ((value: YearMonthWeekDisplay) => void) | undefined;
25
61
  }
26
- interface YearMonthWeekDisplay {
62
+ /**
63
+ * Payload passed to `onWeekDisplayChange` describing the newly visible week.
64
+ *
65
+ */
66
+ export interface YearMonthWeekDisplay {
67
+ /**
68
+ * The first and last days of the newly displayed week in YYYY-MM-DD format.
69
+ */
27
70
  week: {
28
71
  firstDayOfWeek: string;
29
72
  lastDayOfWeek: string;
30
73
  };
31
74
  year: number;
75
+ /** `month` is 1-indexed */
32
76
  month: number;
33
77
  }
34
- export {};
@@ -1,2 +1,8 @@
1
1
  import type { TimelineProps } from "./types";
2
+ /**
3
+ * A vertically ordered list of steps with visual state indicators.
4
+ *
5
+ * Use `Timeline` to communicate multi-step progress such as application stages
6
+ * or process flows.
7
+ */
2
8
  export declare const Timeline: ({ items, className, id, title, startCol, colSpan, "data-base-indicator-testid": baseIndicatorTestId, "data-testid": testId, headingLevel, counterOffset, }: TimelineProps) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.js","sources":["../../src/timeline/timeline.tsx"],"sourcesContent":["import { ExclamationCircleFillIcon, TickIcon } from \"@lifesg/react-icons\";\nimport clsx from \"clsx\";\nimport { useRef } from \"react\";\n\nimport type { PillProps } from \"../pill\";\nimport { Pill } from \"../pill\";\nimport { VisuallyHidden } from \"../shared/accessibility\";\nimport { useApplyStyle } from \"../theme\";\nimport { Typography } from \"../typography\";\nimport * as styles from \"./timeline.styles\";\nimport type { TimelineItemProps, TimelineProps, Variant } from \"./types\";\n\nexport const Timeline = ({\n items,\n className,\n id,\n title,\n startCol,\n colSpan,\n \"data-base-indicator-testid\": baseIndicatorTestId,\n \"data-testid\": testId = \"timeline\",\n headingLevel = 2,\n counterOffset = 0,\n}: TimelineProps): JSX.Element => {\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useApplyStyle(wrapperRef, {\n [styles.tokens.wrapper.startCol]: startCol,\n [styles.tokens.wrapper.colSpan]: colSpan,\n });\n\n // ===========================================================================\n // RENDER\n // ===========================================================================\n const renderContent = (content: string | JSX.Element): JSX.Element => {\n if (typeof content === \"string\") {\n return (\n <Typography.BodyMD className=\"timeline-item-content-text\">\n {content}\n </Typography.BodyMD>\n );\n }\n\n return <>{content}</>;\n };\n\n const renderTitle = (\n title: string | JSX.Element,\n level: number\n ): JSX.Element => {\n if (typeof title === \"string\") {\n return (\n <Typography.HeadingXS\n as=\"h3\"\n aria-level={level}\n weight=\"semibold\"\n className={clsx(\n styles.timelineItemTitle,\n \"timeline-item-title\"\n )}\n >\n {title}\n </Typography.HeadingXS>\n );\n }\n\n return <>{title}</>;\n };\n\n const renderStatusPills = (statuses: PillProps[]): JSX.Element[] => {\n // maximum 2 pills allowed\n const renderableStatuses = statuses.slice(0, 2);\n return renderableStatuses.map((status: PillProps, index) => {\n return (\n <Pill\n {...status}\n type={status.type}\n key={`status-pill-${index}`}\n data-testid=\"status-pill\"\n className=\"timeline-status-pill\"\n >\n {status.children}\n </Pill>\n );\n });\n };\n\n const renderIcon = (variant: Variant, index: number) => {\n switch (variant) {\n case \"completed\":\n return <TickIcon aria-hidden />;\n case \"error\":\n return <ExclamationCircleFillIcon aria-hidden />;\n case \"numeric\":\n return <span aria-hidden>{index + 1 + counterOffset}</span>;\n default:\n return null;\n }\n };\n\n const getStatus = (variant: Variant, index: number) => {\n switch (variant) {\n case \"current\":\n return \"Current step\";\n case \"completed\":\n return \"Completed step\";\n case \"upcoming-active\":\n return \"Upcoming active step\";\n case \"upcoming-inactive\":\n return \"Upcoming inactive step\";\n case \"disabled\":\n return \"Inactive step\";\n case \"error\":\n return \"Current step, action required\";\n case \"numeric\":\n return `Step number ${index + 1 + counterOffset}`;\n default:\n return \"\";\n }\n };\n\n const renderItems = () =>\n items.map((item: TimelineItemProps, index) => {\n const { title, content, statuses, variant: _variant } = item;\n const circleIndicatorTestId = baseIndicatorTestId\n ? `circleindicator${index + 1}_div_${baseIndicatorTestId}`\n : \"circleindicator\";\n const variant =\n _variant || (index === 0 ? \"current\" : \"upcoming-active\");\n\n return (\n <div\n key={`timeline-item-${index}`}\n role=\"listitem\"\n className={styles.timelineItem}\n >\n <div className={styles.timelineIndicators}>\n <div\n data-testid={circleIndicatorTestId}\n className={styles.circleIndicator}\n data-variant={variant}\n >\n <VisuallyHidden>\n {getStatus(variant, index)}\n </VisuallyHidden>\n {renderIcon(variant, index)}\n </div>\n <div\n className={styles.lineIndicator}\n data-variant={variant}\n />\n </div>\n <div\n className={clsx(\n styles.timelineItemContent,\n \"timeline-item-content\"\n )}\n >\n {renderTitle(title, headingLevel + 1)}\n {statuses && (\n <div className={styles.timelinePills}>\n {renderStatusPills(statuses)}\n </div>\n )}\n {renderContent(content)}\n </div>\n </div>\n );\n });\n\n return (\n <div\n ref={wrapperRef}\n className={clsx(styles.timelineWrapper, className)}\n id={id}\n data-testid={testId}\n >\n <Typography.HeadingSM\n as=\"h2\"\n aria-level={headingLevel}\n data-testid=\"timeline-title\"\n weight=\"bold\"\n className={styles.timelineTitle}\n >\n {title}\n </Typography.HeadingSM>\n <div role=\"list\">{renderItems()}</div>\n </div>\n );\n};\n"],"names":["Timeline","items","className","id","title","startCol","colSpan","baseIndicatorTestId","testId","headingLevel","counterOffset","wrapperRef","useRef","useApplyStyle","styles.tokens","wrapper","renderContent","content","_jsx","Typography","BodyMD","children","_Fragment","renderTitle","level","HeadingXS","as","weight","clsx","styles.timelineItemTitle","renderStatusPills","statuses","slice","map","status","index","_createElement","Pill","Object","assign","type","key","renderIcon","variant","TickIcon","ExclamationCircleFillIcon","getStatus","_jsxs","ref","styles.timelineWrapper","HeadingSM","styles.timelineTitle","role","item","_variant","styles.timelineItem","styles.timelineIndicators","styles.circleIndicator","VisuallyHidden","styles.lineIndicator","styles.timelineItemContent","styles.timelinePills"],"mappings":"w6BAYO,MAAMA,EAAW,EACpBC,QACAC,YACAC,KACAC,QACAC,WACAC,UACA,6BAA8BC,EAC9B,cAAeC,EAAS,WACxBC,eAAe,EACfC,gBAAgB,MAEhB,MAAMC,EAAaC,EAAuB,MAE1CC,EAAcF,EAAY,CACtB,CAACG,EAAcC,QAAQV,UAAWA,EAClC,CAACS,EAAcC,QAAQT,SAAUA,IAMrC,MAAMU,EAAiBC,GACI,iBAAZA,EAEHC,EAACC,EAAWC,OAAM,CAAClB,UAAU,6BAA4BmB,SACpDJ,IAKNC,EAAAI,EAAA,CAAAD,SAAGJ,IAGRM,EAAc,CAChBnB,EACAoB,IAEqB,iBAAVpB,EAEHc,EAACC,EAAWM,UAAS,CACjBC,GAAG,KAAI,aACKF,EACZG,OAAO,WACPzB,UAAW0B,EACPC,EACA,uBACHR,SAEAjB,IAKNc,EAAAI,EAAA,CAAAD,SAAGjB,IAGR0B,EAAqBC,GAEIA,EAASC,MAAM,EAAG,GACnBC,KAAI,CAACC,EAAmBC,IAE1CC,EAACC,EAAIC,OAAAC,OAAA,GACGL,EAAM,CACVM,KAAMN,EAAOM,KACbC,IAAK,eAAeN,IAAO,cACf,cACZjC,UAAU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EAAoB,eACjBhB,OAGtBI,EAAA,MAAA,CACI7C,UAAW0B,EACPgC,EACA,yBACHvC,SAAA,CAEAE,EAAYnB,EAAOK,EAAe,GAClCsB,GACGb,EAAA,MAAA,CAAKhB,UAAW2D,EAAoBxC,SAC/BS,EAAkBC,KAG1Bf,EAAcC,QAhCd,iBAAiBkB,IAkCpB,QAqBR"}
1
+ {"version":3,"file":"timeline.js","sources":["../../src/timeline/timeline.tsx"],"sourcesContent":["import { ExclamationCircleFillIcon, TickIcon } from \"@lifesg/react-icons\";\nimport clsx from \"clsx\";\nimport { useRef } from \"react\";\n\nimport type { PillProps } from \"../pill\";\nimport { Pill } from \"../pill\";\nimport { VisuallyHidden } from \"../shared/accessibility\";\nimport { useApplyStyle } from \"../theme\";\nimport { Typography } from \"../typography\";\nimport * as styles from \"./timeline.styles\";\nimport type { TimelineItemProps, TimelineProps, Variant } from \"./types\";\n\n/**\n * A vertically ordered list of steps with visual state indicators.\n *\n * Use `Timeline` to communicate multi-step progress such as application stages\n * or process flows.\n */\nexport const Timeline = ({\n items,\n className,\n id,\n title,\n startCol,\n colSpan,\n \"data-base-indicator-testid\": baseIndicatorTestId,\n \"data-testid\": testId = \"timeline\",\n headingLevel = 2,\n counterOffset = 0,\n}: TimelineProps): JSX.Element => {\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useApplyStyle(wrapperRef, {\n [styles.tokens.wrapper.startCol]: startCol,\n [styles.tokens.wrapper.colSpan]: colSpan,\n });\n\n // ===========================================================================\n // RENDER\n // ===========================================================================\n const renderContent = (content: string | JSX.Element): JSX.Element => {\n if (typeof content === \"string\") {\n return (\n <Typography.BodyMD className=\"timeline-item-content-text\">\n {content}\n </Typography.BodyMD>\n );\n }\n\n return <>{content}</>;\n };\n\n const renderTitle = (\n title: string | JSX.Element,\n level: number\n ): JSX.Element => {\n if (typeof title === \"string\") {\n return (\n <Typography.HeadingXS\n as=\"h3\"\n aria-level={level}\n weight=\"semibold\"\n className={clsx(\n styles.timelineItemTitle,\n \"timeline-item-title\"\n )}\n >\n {title}\n </Typography.HeadingXS>\n );\n }\n\n return <>{title}</>;\n };\n\n const renderStatusPills = (statuses: PillProps[]): JSX.Element[] => {\n // maximum 2 pills allowed\n const renderableStatuses = statuses.slice(0, 2);\n return renderableStatuses.map((status: PillProps, index) => {\n return (\n <Pill\n {...status}\n type={status.type}\n key={`status-pill-${index}`}\n data-testid=\"status-pill\"\n className=\"timeline-status-pill\"\n >\n {status.children}\n </Pill>\n );\n });\n };\n\n const renderIcon = (variant: Variant, index: number) => {\n switch (variant) {\n case \"completed\":\n return <TickIcon aria-hidden />;\n case \"error\":\n return <ExclamationCircleFillIcon aria-hidden />;\n case \"numeric\":\n return <span aria-hidden>{index + 1 + counterOffset}</span>;\n default:\n return null;\n }\n };\n\n const getStatus = (variant: Variant, index: number) => {\n switch (variant) {\n case \"current\":\n return \"Current step\";\n case \"completed\":\n return \"Completed step\";\n case \"upcoming-active\":\n return \"Upcoming active step\";\n case \"upcoming-inactive\":\n return \"Upcoming inactive step\";\n case \"disabled\":\n return \"Inactive step\";\n case \"error\":\n return \"Current step, action required\";\n case \"numeric\":\n return `Step number ${index + 1 + counterOffset}`;\n default:\n return \"\";\n }\n };\n\n const renderItems = () =>\n items.map((item: TimelineItemProps, index) => {\n const { title, content, statuses, variant: _variant } = item;\n const circleIndicatorTestId = baseIndicatorTestId\n ? `circleindicator${index + 1}_div_${baseIndicatorTestId}`\n : \"circleindicator\";\n const variant =\n _variant || (index === 0 ? \"current\" : \"upcoming-active\");\n\n return (\n <div\n key={`timeline-item-${index}`}\n role=\"listitem\"\n className={styles.timelineItem}\n >\n <div className={styles.timelineIndicators}>\n <div\n data-testid={circleIndicatorTestId}\n className={styles.circleIndicator}\n data-variant={variant}\n >\n <VisuallyHidden>\n {getStatus(variant, index)}\n </VisuallyHidden>\n {renderIcon(variant, index)}\n </div>\n <div\n className={styles.lineIndicator}\n data-variant={variant}\n />\n </div>\n <div\n className={clsx(\n styles.timelineItemContent,\n \"timeline-item-content\"\n )}\n >\n {renderTitle(title, headingLevel + 1)}\n {statuses && (\n <div className={styles.timelinePills}>\n {renderStatusPills(statuses)}\n </div>\n )}\n {renderContent(content)}\n </div>\n </div>\n );\n });\n\n return (\n <div\n ref={wrapperRef}\n className={clsx(styles.timelineWrapper, className)}\n id={id}\n data-testid={testId}\n >\n <Typography.HeadingSM\n as=\"h2\"\n aria-level={headingLevel}\n data-testid=\"timeline-title\"\n weight=\"bold\"\n className={styles.timelineTitle}\n >\n {title}\n </Typography.HeadingSM>\n <div role=\"list\">{renderItems()}</div>\n </div>\n );\n};\n"],"names":["Timeline","items","className","id","title","startCol","colSpan","baseIndicatorTestId","testId","headingLevel","counterOffset","wrapperRef","useRef","useApplyStyle","styles.tokens","wrapper","renderContent","content","_jsx","Typography","BodyMD","children","_Fragment","renderTitle","level","HeadingXS","as","weight","clsx","styles.timelineItemTitle","renderStatusPills","statuses","slice","map","status","index","_createElement","Pill","Object","assign","type","key","renderIcon","variant","TickIcon","ExclamationCircleFillIcon","getStatus","_jsxs","ref","styles.timelineWrapper","HeadingSM","styles.timelineTitle","role","item","_variant","styles.timelineItem","styles.timelineIndicators","styles.circleIndicator","VisuallyHidden","styles.lineIndicator","styles.timelineItemContent","styles.timelinePills"],"mappings":"w6BAkBO,MAAMA,EAAW,EACpBC,QACAC,YACAC,KACAC,QACAC,WACAC,UACA,6BAA8BC,EAC9B,cAAeC,EAAS,WACxBC,eAAe,EACfC,gBAAgB,MAEhB,MAAMC,EAAaC,EAAuB,MAE1CC,EAAcF,EAAY,CACtB,CAACG,EAAcC,QAAQV,UAAWA,EAClC,CAACS,EAAcC,QAAQT,SAAUA,IAMrC,MAAMU,EAAiBC,GACI,iBAAZA,EAEHC,EAACC,EAAWC,OAAM,CAAClB,UAAU,6BAA4BmB,SACpDJ,IAKNC,EAAAI,EAAA,CAAAD,SAAGJ,IAGRM,EAAc,CAChBnB,EACAoB,IAEqB,iBAAVpB,EAEHc,EAACC,EAAW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MAAA,CAEIK,KAAK,WACLlD,UAAWqD,EAAmBlC,SAAA,CAE9B0B,SAAK7C,UAAWsD,EAAyBnC,SAAA,CACrC0B,uBAbkBxC,EACxB,kBAAkB4B,EAAQ,SAAS5B,IACnC,kBAaUL,UAAWuD,EAAsB,eACnBd,EAAOtB,SAAA,CAErBH,EAACwC,EAAc,CAAArC,SACVyB,EAAUH,EAASR,KAEvBO,EAAWC,EAASR,MAEzBjB,EAAA,MAAA,CACIhB,UAAWyD,EAAoB,eACjBhB,OAGtBI,EAAA,MAAA,CACI7C,UAAW0B,EACPgC,EACA,yBACHvC,SAAA,CAEAE,EAAYnB,EAAOK,EAAe,GAClCsB,GACGb,EAAA,MAAA,CAAKhB,UAAW2D,EAAoBxC,SAC/BS,EAAkBC,KAG1Bf,EAAcC,QAhCd,iBAAiBkB,IAkCpB,QAqBR"}
@@ -1,20 +1,74 @@
1
1
  import type { PillProps } from "../pill";
2
+ /**
3
+ * Visual state of a timeline step.
4
+ *
5
+ * - `"current"` — the active step in progress.
6
+ * - `"completed"` — a finished step; renders a tick icon.
7
+ * - `"upcoming-active"` — a future step that is reachable.
8
+ * - `"upcoming-inactive"` — a future step that cannot yet be started.
9
+ * - `"error"` — the current step requires action; renders an exclamation icon.
10
+ * - `"disabled"` — an inactive step that is not reachable.
11
+ * - `"numeric"` — renders the step's 1-based position number instead of an icon.
12
+ */
2
13
  export type Variant = "completed" | "current" | "upcoming-active" | "upcoming-inactive" | "error" | "disabled" | "numeric";
14
+ /**
15
+ * Configuration for a single step within a `Timeline`.
16
+ */
3
17
  export interface TimelineItemProps {
18
+ /** Title of the step. */
4
19
  title: string | JSX.Element;
20
+ /** Body content of the step. */
5
21
  content: string | JSX.Element;
22
+ /**
23
+ * Up to two status `Pill` descriptors rendered below the title.
24
+ * Only the first two entries are displayed when more are provided.
25
+ */
6
26
  statuses?: PillProps[] | undefined;
27
+ /**
28
+ * Visual state of this step.
29
+ *
30
+ * @default `"current"` for the first item and `"upcoming-active"` for all subsequent items.
31
+ */
7
32
  variant?: Variant | undefined;
8
33
  }
34
+ /**
35
+ * Props for the `Timeline` component.
36
+ */
9
37
  export interface TimelineProps {
38
+ /** Ordered list of steps to render. */
10
39
  items: TimelineItemProps[];
40
+ /** Heading text displayed above the step list. */
11
41
  title?: string | undefined;
12
- className?: string | undefined;
13
- id?: string | undefined;
42
+ /**
43
+ * CSS grid column the timeline wrapper starts on.
44
+ * Useful if component is wrapped in a css grid div.
45
+ */
14
46
  startCol?: number | undefined;
47
+ /**
48
+ * Number of grid columns the timeline wrapper spans.
49
+ * Useful if component is wrapped in a css grid div
50
+ */
15
51
  colSpan?: number | undefined;
16
- "data-testid"?: string | undefined;
17
- "data-base-indicator-testid"?: string | undefined;
52
+ /**
53
+ * Heading level assigned to the `title` element.
54
+ * Item titles are rendered at `headingLevel + 1`.
55
+ *
56
+ * @default 2
57
+ */
18
58
  headingLevel?: number | undefined;
59
+ /**
60
+ * Value added to each step's displayed counter when `variant` is
61
+ * `"numeric"`.
62
+ *
63
+ * @remarks
64
+ * Use this when the timeline numbering should not restart from 1.
65
+ * If offset = `2`, the start of the timeline will be `index + 1 + offset = 3`
66
+ *
67
+ * @default 0
68
+ */
19
69
  counterOffset?: number | undefined;
70
+ className?: string | undefined;
71
+ id?: string | undefined;
72
+ "data-testid"?: string | undefined;
73
+ "data-base-indicator-testid"?: string | undefined;
20
74
  }
@@ -1,2 +1,7 @@
1
1
  import type { TimepickerProps } from "./types";
2
+ /**
3
+ * A form input for selecting a time value through a dropdown interface.
4
+ *
5
+ * Use `Timepicker` when a user needs to choose a specific time.
6
+ */
2
7
  export declare const Timepicker: ({ id, disabled, readOnly, error, value, placeholder, format, onChange, onFocus, onBlur, alignment, dropdownZIndex, dropdownRootNode, className, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...otherProps }: TimepickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- import{__rest as e}from"../_virtual/_tslib.js";import{jsx as r}from"react/jsx-runtime";import{useState as o,useRef as a,useCallback as l}from"react";import{ElementWithDropdown as n}from"../shared/dropdown-wrapper/element-with-dropdown.js";import{InputWrapper as i,BasicInput as d}from"../shared/input-wrapper/input-wrapper.js";import{TimepickerDropdown as t}from"../shared/timepicker-dropdown/timepicker-dropdown.js";import{TimeHelper as s}from"../util/time-helper.js";import{inputSelectorElement as p}from"./timepicker.styles.js";const m=m=>{var{id:c,disabled:u=!1,readOnly:b=!1,error:f,value:y,placeholder:v,format:w="24hr",onChange:h,onFocus:g,onBlur:k,alignment:j,dropdownZIndex:O,dropdownRootNode:x,className:N,"aria-labelledby":C,"aria-describedby":D}=m,F=e(m,["id","disabled","readOnly","error","value","placeholder","format","onChange","onFocus","onBlur","alignment","dropdownZIndex","dropdownRootNode","className","aria-labelledby","aria-describedby"]);const[H,M]=o(!1),B=a(null),I=a(null),R=l((()=>"12hr"===w?"HH:MMam":"HH:MM"),[w]),Z=()=>{var e;null===(e=I.current)||void 0===e||e.focus({preventScroll:!0})},E=()=>{u||b||M(!0)},T=()=>{M(!1),Z()},_=e=>{null==h||h(e),M(!1),Z()},A=()=>{u||null==g||g()},K=e=>{var r;if(H||u)return;const o=e.relatedTarget;o&&(null===(r=B.current)||void 0===r?void 0:r.contains(o))||null==k||k()},P=e=>{u||b||"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||(e.preventDefault(),E())};return r(n,{enabled:!b&&!u,isOpen:H,renderElement:()=>r(i,Object.assign({ref:B,role:"group",readOnly:b,disabled:u,focused:H,error:f,className:N},F,{children:r(d,{ref:I,readOnly:!0,placeholder:v||R(),value:s.formatDisplayValue(y,w),role:"combobox","aria-invalid":f||void 0,"aria-disabled":u||void 0,"aria-readonly":b||void 0,"aria-labelledby":C,"aria-describedby":D,"aria-expanded":!u&&!b&&H,"data-testid":c?`${c}-timepicker-selector`:"timepicker-selector",className:p,onFocus:A,onClick:E,onKeyDown:P,onBlur:K})})),renderDropdown:({styles:e,setFloatingRef:o,getFloatingProps:a})=>r("div",Object.assign({ref:o,style:e,role:"dialog","aria-label":"Time picker"},a(),{children:r(t,{id:c,show:H,value:y,format:w,onCancel:T,onChange:_})})),onOpen:E,onClose:()=>{M(!1),null==k||k()},onDismiss:T,offset:8,alignment:j,customZIndex:O,rootNode:x})};export{m as Timepicker};
1
+ import{__rest as e}from"../_virtual/_tslib.js";import{jsx as r}from"react/jsx-runtime";import o from"clsx";import{useState as a,useRef as l,useCallback as n}from"react";import{ElementWithDropdown as i}from"../shared/dropdown-wrapper/element-with-dropdown.js";import{InputWrapper as d,BasicInput as t}from"../shared/input-wrapper/input-wrapper.js";import{TimepickerDropdown as s}from"../shared/timepicker-dropdown/timepicker-dropdown.js";import{TimeHelper as p}from"../util/time-helper.js";import{inputSelectorElement as m,inputSelectorElementDisabled as c}from"./timepicker.styles.js";const u=u=>{var{id:b,disabled:f=!1,readOnly:y=!1,error:v,value:w,placeholder:h,format:g="24hr",onChange:k,onFocus:j,onBlur:x,alignment:O,dropdownZIndex:N,dropdownRootNode:C,className:D,"aria-labelledby":F,"aria-describedby":H}=u,M=e(u,["id","disabled","readOnly","error","value","placeholder","format","onChange","onFocus","onBlur","alignment","dropdownZIndex","dropdownRootNode","className","aria-labelledby","aria-describedby"]);const[B,I]=a(!1),R=l(null),Z=l(null),E=n((()=>"12hr"===g?"HH:MMam":"HH:MM"),[g]),T=()=>{var e;null===(e=Z.current)||void 0===e||e.focus({preventScroll:!0})},_=()=>{f||y||I(!0)},A=()=>{I(!1),T()},K=e=>{null==k||k(e),I(!1),T()},P=()=>{f||null==j||j()},S=e=>{var r;if(B||f)return;const o=e.relatedTarget;o&&(null===(r=R.current)||void 0===r?void 0:r.contains(o))||null==x||x()},V=e=>{f||y||"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key||(e.preventDefault(),_())};return r(i,{enabled:!y&&!f,isOpen:B,renderElement:()=>r(d,Object.assign({ref:R,role:"group",readOnly:y,disabled:f,focused:B,error:v,className:D},M,{children:r(t,{ref:Z,readOnly:!0,placeholder:h||E(),value:p.formatDisplayValue(w,g),role:"combobox","aria-invalid":v||void 0,"aria-disabled":f||void 0,"aria-readonly":y||void 0,"aria-labelledby":F,"aria-describedby":H,"aria-expanded":!f&&!y&&B,"data-testid":b?`${b}-timepicker-selector`:"timepicker-selector",className:o(m,f&&c),onFocus:P,onClick:_,onKeyDown:V,onBlur:S})})),renderDropdown:({styles:e,setFloatingRef:o,getFloatingProps:a})=>r("div",Object.assign({ref:o,style:e,role:"dialog","aria-label":"Time picker"},a(),{children:r(s,{id:b,show:B,value:w,format:g,onCancel:A,onChange:K})})),onOpen:_,onClose:()=>{I(!1),null==x||x()},onDismiss:A,offset:8,alignment:O,customZIndex:N,rootNode:C})};export{u as Timepicker};
2
2
  //# sourceMappingURL=timepicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"timepicker.js","sources":["../../src/timepicker/timepicker.tsx"],"sourcesContent":["import { useCallback, useRef, useState } from \"react\";\n\nimport type { DropdownRenderProps } from \"../shared/dropdown-wrapper\";\nimport { ElementWithDropdown } from \"../shared/dropdown-wrapper\";\nimport { BasicInput, InputWrapper } from \"../shared/input-wrapper\";\nimport { TimepickerDropdown } from \"../shared/timepicker-dropdown/timepicker-dropdown\";\nimport { TimeHelper } from \"../util/time-helper\";\nimport * as styles from \"./timepicker.styles\";\nimport type { TimepickerProps } from \"./types\";\n\nexport const Timepicker = ({\n id,\n disabled = false,\n readOnly = false,\n error,\n value,\n placeholder,\n format = \"24hr\",\n onChange,\n onFocus,\n onBlur,\n alignment,\n dropdownZIndex,\n dropdownRootNode,\n className,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...otherProps\n}: TimepickerProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const [isOpen, setIsOpen] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const selectorRef = useRef<HTMLInputElement>(null);\n\n // =============================================================================\n // HELPER FUNCTIONS\n // =============================================================================\n const getPlaceholderValue = useCallback(() => {\n switch (format) {\n case \"12hr\":\n return \"HH:MMam\";\n case \"24hr\":\n default:\n return \"HH:MM\";\n }\n }, [format]);\n\n const restoreFocusToSelector = () => {\n selectorRef.current?.focus({ preventScroll: true });\n };\n\n // =============================================================================\n // EVENT LISTENERS\n // =============================================================================\n const handleOpen = () => {\n if (disabled || readOnly) return;\n setIsOpen(true);\n };\n\n const handleClose = () => {\n setIsOpen(false);\n onBlur?.();\n };\n\n const handleDismiss = () => {\n setIsOpen(false);\n restoreFocusToSelector();\n };\n\n const handleChange = (v: string) => {\n onChange?.(v);\n setIsOpen(false);\n restoreFocusToSelector();\n };\n\n const handleFocus = () => {\n if (disabled) return;\n onFocus?.();\n };\n\n const handleSelectorBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n if (isOpen || disabled) return;\n\n const next = e.relatedTarget as Node | null;\n if (next && wrapperRef.current?.contains(next)) return;\n\n onBlur?.();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (disabled || readOnly) {\n return;\n }\n\n if (e.key === \"Enter\" || e.key === \" \" || e.key === \"ArrowDown\") {\n e.preventDefault();\n handleOpen();\n }\n };\n\n // =============================================================================\n // RENDER\n // =============================================================================\n const renderElement = () => (\n <InputWrapper\n ref={wrapperRef}\n role=\"group\"\n readOnly={readOnly}\n disabled={disabled}\n focused={isOpen}\n error={error}\n className={className}\n {...otherProps}\n >\n <BasicInput\n ref={selectorRef}\n readOnly\n placeholder={placeholder || getPlaceholderValue()}\n value={TimeHelper.formatDisplayValue(value, format)}\n role=\"combobox\"\n aria-invalid={error || undefined}\n aria-disabled={disabled || undefined}\n aria-readonly={readOnly || undefined}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-expanded={!disabled && !readOnly ? isOpen : false}\n data-testid={\n id ? `${id}-timepicker-selector` : \"timepicker-selector\"\n }\n className={styles.inputSelectorElement}\n onFocus={handleFocus}\n onClick={handleOpen}\n onKeyDown={handleKeyDown}\n onBlur={handleSelectorBlur}\n />\n </InputWrapper>\n );\n\n const renderDropdown = ({\n styles,\n setFloatingRef,\n getFloatingProps,\n }: DropdownRenderProps) => (\n <div\n ref={setFloatingRef}\n style={styles}\n role=\"dialog\"\n aria-label=\"Time picker\"\n {...getFloatingProps()}\n >\n <TimepickerDropdown\n id={id}\n show={isOpen}\n value={value}\n format={format}\n onCancel={handleDismiss}\n onChange={handleChange}\n />\n </div>\n );\n\n return (\n <ElementWithDropdown\n enabled={!readOnly && !disabled}\n isOpen={isOpen}\n renderElement={renderElement}\n renderDropdown={renderDropdown}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n offset={8}\n alignment={alignment}\n customZIndex={dropdownZIndex}\n rootNode={dropdownRootNode}\n />\n );\n};\n"],"names":["Timepicker","_a","id","disabled","readOnly","error","value","placeholder","format","onChange","onFocus","onBlur","alignment","dropdownZIndex","dropdownRootNode","className","ariaLabelledBy","ariaDescribedBy","otherProps","__rest","isOpen","setIsOpen","useState","wrapperRef","useRef","selectorRef","getPlaceholderValue","useCallback","restoreFocusToSelector","current","focus","preventScroll","handleOpen","handleDismiss","handleChange","v","handleFocus","handleSelectorBlur","e","next","relatedTarget","contains","handleKeyDown","key","preventDefault","_jsx","ElementWithDropdown","enabled","renderElement","InputWrapper","Object","assign","ref","role","focused","children","BasicInput","TimeHelper","formatDisplayValue","undefined","styles.inputSelectorElement","onClick","onKeyDown","renderDropdown","styles","setFloatingRef","getFloatingProps","style","TimepickerDropdown","show","onCancel","onOpen","onClose","onDismiss","offset","customZIndex","rootNode"],"mappings":"mhBAUO,MAAMA,EAAcC,QAAAC,GACvBA,EAAEC,SACFA,GAAW,EAAKC,SAChBA,GAAW,EAAKC,MAChBA,EAAKC,MACLA,EAAKC,YACLA,EAAWC,OACXA,EAAS,OAAMC,SACfA,EAAQC,QACRA,EAAOC,OACPA,EAAMC,UACNA,EAASC,eACTA,EAAcC,iBAC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B,MAAOmD,EAAWC,mBAAmBpD,EAAOE,GAC5C6C,KAAK,WAAU,eACDhD,QAASsD,EAAS,gBACjBxD,QAAYwD,EAAS,gBACrBvD,QAAYuD,EAAS,kBACnB3C,EAAc,mBACbC,EAAe,iBACjBd,IAAaC,GAAWgB,EAAc,cAElDlB,EAAK,GAAGA,wBAA2B,sBAEvCa,UAAW6C,EACXlD,QAAS0B,EACTyB,QAAS7B,EACT8B,UAAWpB,EACX/B,OAAQ0B,OAiCZ0B,eA5Be,EACnBC,SACAC,iBACAC,sBAEArB,EAAA,MAAAK,OAAAC,OAAA,CACIC,IAAKa,EACLE,MAAOH,EACPX,KAAK,SAAQ,aACF,eACPa,IAAkB,CAAAX,SAEtBV,EAACuB,EAAkB,CACflE,GAAIA,EACJmE,KAAMjD,EACNd,MAAOA,EACPE,OAAQA,EACR8D,SAAUrC,EACVxB,SAAUyB,OAWdqC,OAAQvC,EACRwC,QA7GY,KAChBnD,GAAU,GACVV,SAAAA,GAAU,EA4GN8D,UAAWxC,EACXyC,OAAQ,EACR9D,UAAWA,EACX+D,aAAc9D,EACd+D,SAAU9D,GACZ"}
1
+ {"version":3,"file":"timepicker.js","sources":["../../src/timepicker/timepicker.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useCallback, useRef, useState } from \"react\";\n\nimport type { DropdownRenderProps } from \"../shared/dropdown-wrapper\";\nimport { ElementWithDropdown } from \"../shared/dropdown-wrapper\";\nimport { BasicInput, InputWrapper } from \"../shared/input-wrapper\";\nimport { TimepickerDropdown } from \"../shared/timepicker-dropdown/timepicker-dropdown\";\nimport { TimeHelper } from \"../util/time-helper\";\nimport * as styles from \"./timepicker.styles\";\nimport type { TimepickerProps } from \"./types\";\n\n/**\n * A form input for selecting a time value through a dropdown interface.\n *\n * Use `Timepicker` when a user needs to choose a specific time.\n */\nexport const Timepicker = ({\n id,\n disabled = false,\n readOnly = false,\n error,\n value,\n placeholder,\n format = \"24hr\",\n onChange,\n onFocus,\n onBlur,\n alignment,\n dropdownZIndex,\n dropdownRootNode,\n className,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...otherProps\n}: TimepickerProps) => {\n // =============================================================================\n // CONST, STATE, REF\n // =============================================================================\n const [isOpen, setIsOpen] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const selectorRef = useRef<HTMLInputElement>(null);\n\n // =============================================================================\n // HELPER FUNCTIONS\n // =============================================================================\n const getPlaceholderValue = useCallback(() => {\n switch (format) {\n case \"12hr\":\n return \"HH:MMam\";\n case \"24hr\":\n default:\n return \"HH:MM\";\n }\n }, [format]);\n\n const restoreFocusToSelector = () => {\n selectorRef.current?.focus({ preventScroll: true });\n };\n\n // =============================================================================\n // EVENT LISTENERS\n // =============================================================================\n const handleOpen = () => {\n if (disabled || readOnly) return;\n setIsOpen(true);\n };\n\n const handleClose = () => {\n setIsOpen(false);\n onBlur?.();\n };\n\n const handleDismiss = () => {\n setIsOpen(false);\n restoreFocusToSelector();\n };\n\n const handleChange = (v: string) => {\n onChange?.(v);\n setIsOpen(false);\n restoreFocusToSelector();\n };\n\n const handleFocus = () => {\n if (disabled) return;\n onFocus?.();\n };\n\n const handleSelectorBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n if (isOpen || disabled) return;\n\n const next = e.relatedTarget as Node | null;\n if (next && wrapperRef.current?.contains(next)) return;\n\n onBlur?.();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (disabled || readOnly) {\n return;\n }\n\n if (e.key === \"Enter\" || e.key === \" \" || e.key === \"ArrowDown\") {\n e.preventDefault();\n handleOpen();\n }\n };\n\n // =============================================================================\n // RENDER\n // =============================================================================\n const renderElement = () => (\n <InputWrapper\n ref={wrapperRef}\n role=\"group\"\n readOnly={readOnly}\n disabled={disabled}\n focused={isOpen}\n error={error}\n className={className}\n {...otherProps}\n >\n <BasicInput\n ref={selectorRef}\n readOnly\n placeholder={placeholder || getPlaceholderValue()}\n value={TimeHelper.formatDisplayValue(value, format)}\n role=\"combobox\"\n aria-invalid={error || undefined}\n aria-disabled={disabled || undefined}\n aria-readonly={readOnly || undefined}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-expanded={!disabled && !readOnly ? isOpen : false}\n data-testid={\n id ? `${id}-timepicker-selector` : \"timepicker-selector\"\n }\n className={clsx(\n styles.inputSelectorElement,\n disabled && styles.inputSelectorElementDisabled\n )}\n onFocus={handleFocus}\n onClick={handleOpen}\n onKeyDown={handleKeyDown}\n onBlur={handleSelectorBlur}\n />\n </InputWrapper>\n );\n\n const renderDropdown = ({\n styles,\n setFloatingRef,\n getFloatingProps,\n }: DropdownRenderProps) => (\n <div\n ref={setFloatingRef}\n style={styles}\n role=\"dialog\"\n aria-label=\"Time picker\"\n {...getFloatingProps()}\n >\n <TimepickerDropdown\n id={id}\n show={isOpen}\n value={value}\n format={format}\n onCancel={handleDismiss}\n onChange={handleChange}\n />\n </div>\n );\n\n return (\n <ElementWithDropdown\n enabled={!readOnly && !disabled}\n isOpen={isOpen}\n renderElement={renderElement}\n renderDropdown={renderDropdown}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n offset={8}\n alignment={alignment}\n customZIndex={dropdownZIndex}\n rootNode={dropdownRootNode}\n />\n );\n};\n"],"names":["Timepicker","_a","id","disabled","readOnly","error","value","placeholder","format","onChange","onFocus","onBlur","alignment","dropdownZIndex","dropdownRootNode","className","ariaLabelledBy","ariaDescribedBy","otherProps","__rest","isOpen","setIsOpen","useState","wrapperRef","useRef","selectorRef","getPlaceholderValue","useCallback","restoreFocusToSelector","current","focus","preventScroll","handleOpen","handleDismiss","handleChange","v","handleFocus","handleSelectorBlur","e","next","relatedTarget","contains","handleKeyDown","key","preventDefault","_jsx","ElementWithDropdown","enabled","renderElement","InputWrapper","Object","assign","ref","role","focused","children","BasicInput","TimeHelper","formatDisplayValue","undefined","clsx","styles.inputSelectorElement","styles.inputSelectorElementDisabled","onClick","onKeyDown","renderDropdown","styles","setFloatingRef","getFloatingProps","style","TimepickerDropdown","show","onCancel","onOpen","onClose","onDismiss","offset","customZIndex","rootNode"],"mappings":"ykBAgBO,MAAMA,EAAcC,QAAAC,GACvBA,EAAEC,SACFA,GAAW,EAAKC,SAChBA,GAAW,EAAKC,MAChBA,EAAKC,MACLA,EAAKC,YACLA,EAAWC,OACXA,EAAS,OAAMC,SACfA,EAAQC,QACRA,EAAOC,OACPA,EAAMC,UACNA,EAASC,eACTA,EAAcC,iBACdA,EAAgBC,UAChBA,EACA,kBAAmBC,EACnB,mBAAoBC,KACjBC,EAAUC,EAAAlB,EAjBU,CAAA,KAAA,WAAA,WAAA,QAAA,QAAA,cAAA,SAAA,WAAA,UAAA,SAAA,YAAA,iBAAA,mBAAA,YAAA,kBAAA,qBAsBvB,MAAOmB,EAAQC,GAAaC,GAAS,GAC/BC,EAAaC,EAAuB,MACpCC,EAAcD,EAAyB,MAKvCE,EAAsBC,GAAY,IAE3B,SADDnB,EAEO,UAGA,SAEhB,CAACA,IAEEoB,EAAyB,WACR,QAAnB3B,EAAAwB,EAAYI,eAAO,IAAA5B,GAAAA,EAAE6B,MAAM,CAAEC,eAAe,GAAO,EAMjDC,EAAa,KACX7B,GAAYC,GAChBiB,GAAU,EAAK,EAQbY,EAAgB,KAClBZ,GAAU,GACVO,GAAwB,EAGtBM,EAAgBC,IAClB1B,SAAAA,EAAW0B,GACXd,GAAU,GACVO,GAAwB,EAGtBQ,EAAc,KACZjC,GACJO,SAAAA,GAAW,EAGT2B,EAAsBC,UACxB,GAAIlB,GAAUjB,EAAU,OAExB,MAAMoC,EAAOD,EAAEE,cACXD,IAA0B,QAAlBtC,EAAAsB,EAAWM,eAAO,IAAA5B,OAAA,EAAAA,EAAEwC,SAASF,KAEzC5B,SAAAA,GAAU,EAGR+B,EAAiBJ,IACfnC,GAAYC,GAIF,UAAVkC,EAAEK,KAA6B,MAAVL,EAAEK,KAAyB,cAAVL,EAAEK,MACxCL,EAAEM,iBACFZ,IACJ,EAmEJ,OACIa,EAACC,EAAmB,CAChBC,SAAU3C,IAAaD,EACvBiB,OAAQA,EACR4B,cAjEc,IAClBH,EAACI,EAAYC,OAAAC,OAAA,CACTC,IAAK7B,EACL8B,KAAK,QACLjD,SAAUA,EACVD,SAAUA,EACVmD,QAASlC,EACTf,MAAOA,EACPU,UAAWA,GACPG,EAAU,CAAAqC,SAEdV,EAACW,GACGJ,IAAK3B,EACLrB,UAAQ,EACRG,YAAaA,GAAemB,IAC5BpB,MAAOmD,EAAWC,mBAAmBpD,EAAOE,GAC5C6C,KAAK,0BACShD,QAASsD,EAAS,gBACjBxD,QAAYwD,EAAS,gBACrBvD,QAAYuD,EAAS,kBACnB3C,EAAc,mBACbC,EAAe,iBACjBd,IAAaC,GAAWgB,EAAc,cAElDlB,EAAK,GAAGA,wBAA2B,sBAEvCa,UAAW6C,EACPC,EACA1D,GAAY2D,GAEhBpD,QAAS0B,EACT2B,QAAS/B,EACTgC,UAAWtB,EACX/B,OAAQ0B,OAiCZ4B,eA5Be,EACnBC,SACAC,iBACAC,sBAEAvB,EAAA,MAAAK,OAAAC,OAAA,CACIC,IAAKe,EACLE,MAAOH,EACPb,KAAK,SAAQ,aACF,eACPe,IAAkB,CAAAb,SAEtBV,EAACyB,EAAkB,CACfpE,GAAIA,EACJqE,KAAMnD,EACNd,MAAOA,EACPE,OAAQA,EACRgE,SAAUvC,EACVxB,SAAUyB,OAWduC,OAAQzC,EACR0C,QAhHY,KAChBrD,GAAU,GACVV,SAAAA,GAAU,EA+GNgE,UAAW1C,EACX2C,OAAQ,EACRhE,UAAWA,EACXiE,aAAchE,EACdiE,SAAUhE,GACZ"}
@@ -1 +1,2 @@
1
1
  export declare const inputSelectorElement: import("@linaria/core").LinariaClassName;
2
+ export declare const inputSelectorElementDisabled: import("@linaria/core").LinariaClassName;
@@ -1,2 +1,2 @@
1
- import"./timepicker.styles_1jm33yw.css";const e="ixpxnsh";export{e as inputSelectorElement};
1
+ import"./timepicker.styles_lyizvq.css";const i="ixpxnsh",e="isljmoe";export{i as inputSelectorElement,e as inputSelectorElementDisabled};
2
2
  //# sourceMappingURL=timepicker.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"timepicker.styles.js","sources":["../../src/timepicker/timepicker.styles.ts"],"sourcesContent":["import { css } from \"@linaria/core\";\n\n// =============================================================================\n// STYLING\n// =============================================================================\nexport const inputSelectorElement = css`\n height: calc(3rem - 2px); /* exclude top and bottom borders */\n cursor: inherit;\n`;\n"],"names":["inputSelectorElement"],"mappings":"kEAKO,MAAMA,EAAoB"}
1
+ {"version":3,"file":"timepicker.styles.js","sources":["../../src/timepicker/timepicker.styles.ts"],"sourcesContent":["import { css } from \"@linaria/core\";\n\nimport { Colour } from \"../theme\";\n\n// =============================================================================\n// STYLING\n// =============================================================================\nexport const inputSelectorElement = css`\n height: calc(3rem - 2px); /* exclude top and bottom borders */\n cursor: inherit;\n`;\n\nexport const inputSelectorElementDisabled = css`\n color: ${Colour[\"text-subtler\"]};\n cursor: not-allowed;\n`;\n"],"names":["inputSelectorElement","inputSelectorElementDisabled"],"mappings":"iEAOO,MAAMA,EAAoB,UAKpBC,EAA4B"}
@@ -0,0 +1,2 @@
1
+ @layer fds{.ixpxnsh{height:calc(3rem - 2px);cursor:inherit;}
2
+ .isljmoe{color:var(--fds-colour-text-subtler);cursor:not-allowed;}}
@@ -1,47 +1,82 @@
1
1
  import type { RefObject } from "react";
2
2
  import type { DropdownAlignmentType } from "../shared/dropdown-wrapper/types";
3
+ /**
4
+ * Time display and value format used by `Timepicker`.
5
+ *
6
+ * - 24 hour uses "hh:mm" e.g. `{ start: "13:00", end: "14:00" }`
7
+ * - 12 hour uses "hh:mmA" e.g. `{ start: "01:00PM", end: "02:00PM" }`
8
+ */
3
9
  export type TimepickerFormat = "12hr" | "24hr";
10
+ /**
11
+ * Props for the `Timepicker` component.
12
+ */
4
13
  export interface TimepickerProps {
5
14
  className?: string | undefined;
6
15
  id?: string | undefined;
7
16
  style?: React.CSSProperties | undefined;
17
+ /**
18
+ * ID of an element that labels the timepicker input.
19
+ */
8
20
  "aria-labelledby"?: string | undefined;
21
+ /**
22
+ * ID of an element that describes the timepicker input.
23
+ */
9
24
  "aria-describedby"?: string | undefined;
10
25
  "data-testid"?: string | undefined;
11
26
  /**
12
- * The value of the time input in a string based format
13
- *
14
- * 24 hour uses "hh:mm" e.g. `"13:00"`
27
+ * The controlled time value as a string.
15
28
  *
16
- * 12 hour uses "hh:mmA" e.g. `"01:00PM"`
29
+ * - 24 hour uses "hh:mm" e.g. `{ start: "13:00", end: "14:00" }`
30
+ * - 12 hour uses "hh:mmA" e.g. `{ start: "01:00PM", end: "02:00PM" }`
17
31
  */
18
32
  value?: string | undefined;
33
+ /**
34
+ * Placeholder text shown when no value is selected.
35
+ *
36
+ * @default `"hh:mm"` for 24-hour format or `"hh:mmA"` for 12-hour format.
37
+ */
19
38
  placeholder?: string | undefined;
20
39
  /**
21
- * The time input format in `12hr` or `24hr`. Defaults to `24hr`
40
+ * The time display and input format.
41
+ *
42
+ * @default "24hr"
22
43
  */
23
44
  format?: TimepickerFormat | undefined;
24
45
  disabled?: boolean | undefined;
25
46
  readOnly?: boolean | undefined;
47
+ /**
48
+ * Renders the input in an error state when `true`.
49
+ */
26
50
  error?: boolean | undefined;
51
+ /** Aligns the dropdown relative to the trigger element. */
27
52
  alignment?: DropdownAlignmentType | undefined;
53
+ /** CSS `z-index` applied to the dropdown overlay. */
28
54
  dropdownZIndex?: number | undefined;
29
- dropdownRootNode?: RefObject<HTMLElement> | undefined;
30
55
  /**
31
- * Called when the user makes a selection and clicks on the "Confirm" button
32
- * in the time selection box. Returns a string based format.
56
+ * The root element that contains the dropdown element.
57
+ *
58
+ * @remarks Specify this if you need to change the parent of the
59
+ * dropdown in the HTML DOM.
60
+ * Possible use case: sharing a stacking context.
33
61
  *
34
- * 24 hour returns "hh:mm" e.g. `"13:00"`
62
+ * Note: if a parent of the trigger has a higher `z-index` than the dropdown,
63
+ * the dropdown may be obscured.
35
64
  *
36
- * 12 hour returns "hh:mmA" e.g. `"01:00PM"`
65
+ * @default `document.body`
37
66
  */
38
- onChange?: ((value: string) => void) | undefined;
67
+ dropdownRootNode?: RefObject<HTMLElement> | undefined;
39
68
  /**
40
- * Called when the field is focused
69
+ * Called when the user confirms a selection.
70
+ *
71
+ * @param value The selected time value as a string.
72
+ * - 24 hour uses "hh:mm" e.g. `{ start: "13:00", end: "14:00" }`
73
+ * - 12 hour uses "hh:mmA" e.g. `{ start: "01:00PM", end: "02:00PM" }`
41
74
  */
42
- onFocus?: (() => void) | undefined;
75
+ onChange?: ((value: string) => void) | undefined;
43
76
  /**
44
- * Called when a defocus is made on the field
77
+ * Called when the timepicker input receives focus.
45
78
  */
79
+ onFocus?: (() => void) | undefined;
80
+ /** Called when focus leaves both the input and the dropdown. */
46
81
  onBlur?: (() => void) | undefined;
47
82
  }
@@ -1,2 +1,2 @@
1
- import{jsx as t}from"react/jsx-runtime";import"../../_virtual/_tslib.js";import"clsx";import"react";import"../../theme/theme-provider/context.js";import"../../typography/typography.js";import"../../card/card.styles_1gh9gs3.css";import"../../markup/markup.js";import"../../modal-v2/index.js";import"../../theme/theme-provider/index.js";import"../../theme/tokens/border.js";import"../../theme/tokens/colour.js";import"../../theme/tokens/font.js";import"../../theme/tokens/media-query.js";import"../../util/calendar-helper.js";import"../../external/dayjs/dayjs.min.js";import"../../util/simple-id-generator.js";import"../../util/string-helper.js";import"@react-aria/live-announcer";import"../../theme/utils/use-media-query.js";import"../../popover/popover.styles_ujnf0h.css";import{PopoverTrigger as e}from"../../popover/popover-trigger.js";import"../../popover/popover-inline/popover-inline.styles_bkopnt.css";const r=({children:r,customPopover:o})=>{if(!o)return r;const i={position:"bottom-start",customOffset:o.offset,children:r,trigger:o.trigger,delay:o.delay,popoverContent:o.content};return t(e,Object.assign({},i))};export{r as WithOptionalPopover};
1
+ import{jsx as t}from"react/jsx-runtime";import"../../_virtual/_tslib.js";import"clsx";import"react";import"../../theme/theme-provider/context.js";import"../../typography/typography.js";import"../../card/card.styles_1gh9gs3.css";import"../../markup/markup.js";import"../../modal-v2/modal-v2.js";import"../../theme/theme-provider/index.js";import"../../theme/tokens/border.js";import"../../theme/tokens/colour.js";import"../../theme/tokens/font.js";import"../../theme/tokens/media-query.js";import"../../util/calendar-helper.js";import"../../external/dayjs/dayjs.min.js";import"../../util/simple-id-generator.js";import"../../util/string-helper.js";import"@react-aria/live-announcer";import"../../theme/utils/use-media-query.js";import"../../popover/popover.styles_ujnf0h.css";import{PopoverTrigger as e}from"../../popover/popover-trigger.js";import"../../popover/popover-inline/popover-inline.styles_bkopnt.css";const r=({children:r,customPopover:o})=>{if(!o)return r;const i={position:"bottom-start",customOffset:o.offset,children:r,trigger:o.trigger,delay:o.delay,popoverContent:o.content};return t(e,Object.assign({},i))};export{r as WithOptionalPopover};
2
2
  //# sourceMappingURL=with-optional-popover.js.map