ivt 0.5.4 → 0.5.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 (258) hide show
  1. package/dist/accordion/index.mjs +15 -15
  2. package/dist/accordion-table/index.d.ts +13 -0
  3. package/dist/accordion-table/index.mjs +120 -0
  4. package/dist/accordion-table/index.mjs.map +1 -0
  5. package/dist/alert/index.mjs +2 -2
  6. package/dist/alert/index.mjs.map +1 -1
  7. package/dist/alert-dialog/index.mjs +17 -17
  8. package/dist/aspect-ratio/index.mjs +1 -1
  9. package/dist/avatar/index.mjs +7 -7
  10. package/dist/badge/index.mjs +3 -3
  11. package/dist/base/index.d.ts +42 -42
  12. package/dist/base/index.mjs +153 -188
  13. package/dist/base/index.mjs.map +1 -1
  14. package/dist/breadcrumb/index.mjs +5 -5
  15. package/dist/button/index.d.ts +1 -1
  16. package/dist/button/index.mjs +3 -3
  17. package/dist/button-group/index.mjs +8 -7
  18. package/dist/button-group/index.mjs.map +1 -1
  19. package/dist/calendar/index.mjs +9 -9
  20. package/dist/card/index.mjs +3 -3
  21. package/dist/carousel/index.mjs +7 -6
  22. package/dist/carousel/index.mjs.map +1 -1
  23. package/dist/chart/index.mjs +8 -8
  24. package/dist/chart/index.mjs.map +1 -1
  25. package/dist/checkbox/index.mjs +14 -14
  26. package/dist/chunks/{CalendarRange-B0vBSe1u.mjs → CalendarRange-Bag_yGEQ.mjs} +8 -8
  27. package/dist/chunks/CalendarRange-Bag_yGEQ.mjs.map +1 -0
  28. package/dist/chunks/{ComboboxField-CKWceOtP.mjs → ComboboxField-BLTT982W.mjs} +9 -9
  29. package/dist/chunks/{ComboboxField-CKWceOtP.mjs.map → ComboboxField-BLTT982W.mjs.map} +1 -1
  30. package/dist/chunks/{Container-uWXsY1MM.mjs → Container-CDOK_e_b.mjs} +2 -2
  31. package/dist/chunks/{Container-uWXsY1MM.mjs.map → Container-CDOK_e_b.mjs.map} +1 -1
  32. package/dist/chunks/DeleteConfirmationModal-BUcMwZqw.mjs +43 -0
  33. package/dist/chunks/DeleteConfirmationModal-BUcMwZqw.mjs.map +1 -0
  34. package/dist/chunks/{TooltipIndicator-BWl3fjQ1.mjs → TooltipIndicator-B23VyuOv.mjs} +4 -4
  35. package/dist/chunks/{TooltipIndicator-BWl3fjQ1.mjs.map → TooltipIndicator-B23VyuOv.mjs.map} +1 -1
  36. package/dist/chunks/{_commonjsHelpers-B0eMPDMg.mjs → _commonjsHelpers-4KUcxYfY.mjs} +1 -1
  37. package/dist/chunks/_commonjsHelpers-4KUcxYfY.mjs.map +1 -0
  38. package/dist/chunks/{accordion-C3d17V52.mjs → accordion-Cz5ayAWy.mjs} +11 -11
  39. package/dist/chunks/{accordion-C3d17V52.mjs.map → accordion-Cz5ayAWy.mjs.map} +1 -1
  40. package/dist/chunks/{badge-DWYbCUyP.mjs → badge-DcTK-GBP.mjs} +2 -2
  41. package/dist/chunks/{badge-DWYbCUyP.mjs.map → badge-DcTK-GBP.mjs.map} +1 -1
  42. package/dist/chunks/{bundle-mjs-CoKIHeQ0.mjs → bundle-mjs-CGLhO34T.mjs} +1 -1
  43. package/dist/chunks/{bundle-mjs-CoKIHeQ0.mjs.map → bundle-mjs-CGLhO34T.mjs.map} +1 -1
  44. package/dist/chunks/{button-DjpHcHp9.mjs → button-D_MnAjQl.mjs} +2 -2
  45. package/dist/chunks/{button-DjpHcHp9.mjs.map → button-D_MnAjQl.mjs.map} +1 -1
  46. package/dist/chunks/{calendar-BMfsKJ1l.mjs → calendar-DGNoWQgo.mjs} +476 -476
  47. package/dist/chunks/{calendar-BMfsKJ1l.mjs.map → calendar-DGNoWQgo.mjs.map} +1 -1
  48. package/dist/chunks/{calendar-days-DHMYK4Tw.mjs → calendar-days-CGnc9ko6.mjs} +2 -2
  49. package/dist/chunks/{calendar-days-DHMYK4Tw.mjs.map → calendar-days-CGnc9ko6.mjs.map} +1 -1
  50. package/dist/chunks/{card-BSProxXx.mjs → card-DZ3filVx.mjs} +2 -2
  51. package/dist/chunks/{card-BSProxXx.mjs.map → card-DZ3filVx.mjs.map} +1 -1
  52. package/dist/chunks/{check-B7kxFwPv.mjs → check-DEf9V4Nh.mjs} +2 -2
  53. package/dist/chunks/{check-B7kxFwPv.mjs.map → check-DEf9V4Nh.mjs.map} +1 -1
  54. package/dist/chunks/{checkbox-Bu-YSWv-.mjs → checkbox-DjzhCYqW.mjs} +11 -11
  55. package/dist/chunks/{checkbox-Bu-YSWv-.mjs.map → checkbox-DjzhCYqW.mjs.map} +1 -1
  56. package/dist/chunks/{chevron-down-BgxaTVhM.mjs → chevron-down-CNWi6KOF.mjs} +2 -2
  57. package/dist/chunks/{chevron-down-BgxaTVhM.mjs.map → chevron-down-CNWi6KOF.mjs.map} +1 -1
  58. package/dist/chunks/{chevron-left-uXOOSe-Y.mjs → chevron-left-Cla2-kGr.mjs} +2 -2
  59. package/dist/chunks/{chevron-left-uXOOSe-Y.mjs.map → chevron-left-Cla2-kGr.mjs.map} +1 -1
  60. package/dist/chunks/{chevron-right-4COrIxgm.mjs → chevron-right-C3X2iYjh.mjs} +2 -2
  61. package/dist/chunks/{chevron-right-4COrIxgm.mjs.map → chevron-right-C3X2iYjh.mjs.map} +1 -1
  62. package/dist/chunks/{chevrons-up-down-RbRxw-hy.mjs → chevrons-up-down-Dcziczc9.mjs} +2 -2
  63. package/dist/chunks/{chevrons-up-down-RbRxw-hy.mjs.map → chevrons-up-down-Dcziczc9.mjs.map} +1 -1
  64. package/dist/chunks/{command-lo6019zL.mjs → command-c98KtQLr.mjs} +8 -8
  65. package/dist/chunks/{command-lo6019zL.mjs.map → command-c98KtQLr.mjs.map} +1 -1
  66. package/dist/chunks/{createLucideIcon-C9WZwMpD.mjs → createLucideIcon-BQUZb4BK.mjs} +1 -1
  67. package/dist/chunks/{createLucideIcon-C9WZwMpD.mjs.map → createLucideIcon-BQUZb4BK.mjs.map} +1 -1
  68. package/dist/chunks/{date-BElRaOeu.mjs → date-BX6jqpaN.mjs} +2 -2
  69. package/dist/chunks/{date-BElRaOeu.mjs.map → date-BX6jqpaN.mjs.map} +1 -1
  70. package/dist/chunks/{dialog-L5zjDv2Y.mjs → dialog-Bzks3Ko4.mjs} +4 -4
  71. package/dist/chunks/{dialog-L5zjDv2Y.mjs.map → dialog-Bzks3Ko4.mjs.map} +1 -1
  72. package/dist/chunks/{ellipsis-DCgrnXbv.mjs → ellipsis-S2vrEUTX.mjs} +2 -2
  73. package/dist/chunks/{ellipsis-DCgrnXbv.mjs.map → ellipsis-S2vrEUTX.mjs.map} +1 -1
  74. package/dist/chunks/{form-ByCrgzBl.mjs → form-CwxoZkN0.mjs} +3 -3
  75. package/dist/chunks/{form-ByCrgzBl.mjs.map → form-CwxoZkN0.mjs.map} +1 -1
  76. package/dist/chunks/{format-Bs2dFpMr.mjs → format-6LfcNksm.mjs} +1 -1
  77. package/dist/chunks/{format-Bs2dFpMr.mjs.map → format-6LfcNksm.mjs.map} +1 -1
  78. package/dist/chunks/{format-numbers-BdN4Rqeh.mjs → format-numbers-NnQQahT8.mjs} +2 -2
  79. package/dist/chunks/{format-numbers-BdN4Rqeh.mjs.map → format-numbers-NnQQahT8.mjs.map} +1 -1
  80. package/dist/chunks/{hover-card-Bbe5z9j5.mjs → hover-card-5rT-1QMh.mjs} +11 -11
  81. package/dist/chunks/{hover-card-Bbe5z9j5.mjs.map → hover-card-5rT-1QMh.mjs.map} +1 -1
  82. package/dist/chunks/{index-Bq9EFhxl.mjs → index-4TCt3gOI.mjs} +3 -3
  83. package/dist/chunks/{index-Bq9EFhxl.mjs.map → index-4TCt3gOI.mjs.map} +1 -1
  84. package/dist/chunks/{index-DrUrHRZs.mjs → index-6boixHzs.mjs} +2 -2
  85. package/dist/chunks/{index-DrUrHRZs.mjs.map → index-6boixHzs.mjs.map} +1 -1
  86. package/dist/chunks/{index-fRaHexiK.mjs → index-AKiXR0pZ.mjs} +1 -1
  87. package/dist/chunks/{index-fRaHexiK.mjs.map → index-AKiXR0pZ.mjs.map} +1 -1
  88. package/dist/chunks/{index-Dl81wvXL.mjs → index-B2gDNmb8.mjs} +5 -5
  89. package/dist/chunks/{index-Dl81wvXL.mjs.map → index-B2gDNmb8.mjs.map} +1 -1
  90. package/dist/chunks/{index-CQpTi7qI.mjs → index-BCbVqu_3.mjs} +2 -2
  91. package/dist/chunks/{index-CQpTi7qI.mjs.map → index-BCbVqu_3.mjs.map} +1 -1
  92. package/dist/chunks/{index-CwEcu8pU.mjs → index-BQ-TEa5d.mjs} +1 -1
  93. package/dist/chunks/{index-CwEcu8pU.mjs.map → index-BQ-TEa5d.mjs.map} +1 -1
  94. package/dist/chunks/{index-BjsM1T5G.mjs → index-BUvLOcM1.mjs} +1 -1
  95. package/dist/chunks/{index-BjsM1T5G.mjs.map → index-BUvLOcM1.mjs.map} +1 -1
  96. package/dist/chunks/{index-DzlFODVj.mjs → index-BWnbRXP-.mjs} +7 -7
  97. package/dist/chunks/{index-DzlFODVj.mjs.map → index-BWnbRXP-.mjs.map} +1 -1
  98. package/dist/chunks/{index-Bc-FW7nZ.mjs → index-BjgE_yhl.mjs} +3 -3
  99. package/dist/chunks/{index-Bc-FW7nZ.mjs.map → index-BjgE_yhl.mjs.map} +1 -1
  100. package/dist/chunks/{index-CvfYTVGA.mjs → index-BmDvd1mU.mjs} +11 -11
  101. package/dist/chunks/{index-CvfYTVGA.mjs.map → index-BmDvd1mU.mjs.map} +1 -1
  102. package/dist/chunks/{index-DN0JnhbV.mjs → index-BmW-kojJ.mjs} +1 -1
  103. package/dist/chunks/{index-DN0JnhbV.mjs.map → index-BmW-kojJ.mjs.map} +1 -1
  104. package/dist/chunks/{index-Bfrnl72r.mjs → index-CGiXQ4Pe.mjs} +9 -9
  105. package/dist/chunks/{index-Bfrnl72r.mjs.map → index-CGiXQ4Pe.mjs.map} +1 -1
  106. package/dist/chunks/{index-MaWketU2.mjs → index-CY5xJaha.mjs} +1 -1
  107. package/dist/chunks/{index-MaWketU2.mjs.map → index-CY5xJaha.mjs.map} +1 -1
  108. package/dist/chunks/{index-B1XP410K.mjs → index-C_z2VNWo.mjs} +1 -1
  109. package/dist/chunks/{index-B1XP410K.mjs.map → index-C_z2VNWo.mjs.map} +1 -1
  110. package/dist/chunks/{index-CtKpqYOz.mjs → index-Cq-A6c3g.mjs} +1 -1
  111. package/dist/chunks/{index-CtKpqYOz.mjs.map → index-Cq-A6c3g.mjs.map} +1 -1
  112. package/dist/chunks/{index-DLRElLW_.mjs → index-Cs_8Iu2P.mjs} +1 -1
  113. package/dist/chunks/{index-DLRElLW_.mjs.map → index-Cs_8Iu2P.mjs.map} +1 -1
  114. package/dist/chunks/{index-DhKLdikH.mjs → index-DLownQDQ.mjs} +2 -2
  115. package/dist/chunks/{index-DhKLdikH.mjs.map → index-DLownQDQ.mjs.map} +1 -1
  116. package/dist/chunks/{index-CZgR4Irq.mjs → index-DSLICNwF.mjs} +1 -1
  117. package/dist/chunks/{index-CZgR4Irq.mjs.map → index-DSLICNwF.mjs.map} +1 -1
  118. package/dist/chunks/{index-Xa5WcG48.mjs → index-DkGvxlDJ.mjs} +2 -2
  119. package/dist/chunks/{index-Xa5WcG48.mjs.map → index-DkGvxlDJ.mjs.map} +1 -1
  120. package/dist/chunks/{index-DKu_lrG6.mjs → index-M3WHAYcQ.mjs} +5 -5
  121. package/dist/chunks/{index-DKu_lrG6.mjs.map → index-M3WHAYcQ.mjs.map} +1 -1
  122. package/dist/chunks/{index--AWuc67S.mjs → index-T-_ESk_G.mjs} +1 -1
  123. package/dist/chunks/{index--AWuc67S.mjs.map → index-T-_ESk_G.mjs.map} +1 -1
  124. package/dist/chunks/{index-BRVK36i6.mjs → index-UxueW3GO.mjs} +15 -15
  125. package/dist/chunks/{index-BRVK36i6.mjs.map → index-UxueW3GO.mjs.map} +1 -1
  126. package/dist/chunks/{index-S03iE7cB.mjs → index-wAh1wx6m.mjs} +9 -9
  127. package/dist/chunks/{index-S03iE7cB.mjs.map → index-wAh1wx6m.mjs.map} +1 -1
  128. package/dist/chunks/{input-8lHYxogf.mjs → input-DKrW5tuu.mjs} +2 -2
  129. package/dist/chunks/{input-8lHYxogf.mjs.map → input-DKrW5tuu.mjs.map} +1 -1
  130. package/dist/chunks/{label-Coz7vbrD.mjs → label-BuC6aAG0.mjs} +3 -3
  131. package/dist/chunks/{label-Coz7vbrD.mjs.map → label-BuC6aAG0.mjs.map} +1 -1
  132. package/dist/chunks/{loader-circle-C79itZUV.mjs → loader-circle-Df9_-0g-.mjs} +2 -2
  133. package/dist/chunks/{loader-circle-C79itZUV.mjs.map → loader-circle-Df9_-0g-.mjs.map} +1 -1
  134. package/dist/chunks/{multi-select-DbkX5eJh.mjs → multi-select--jT_ewJI.mjs} +12 -12
  135. package/dist/chunks/{multi-select-DbkX5eJh.mjs.map → multi-select--jT_ewJI.mjs.map} +1 -1
  136. package/dist/chunks/{pagination-D1_ls69P.mjs → pagination-m1KTCwr8.mjs} +6 -6
  137. package/dist/chunks/{pagination-D1_ls69P.mjs.map → pagination-m1KTCwr8.mjs.map} +1 -1
  138. package/dist/chunks/{popover-CwZj8e8_.mjs → popover-n__dGmWJ.mjs} +13 -13
  139. package/dist/chunks/{popover-CwZj8e8_.mjs.map → popover-n__dGmWJ.mjs.map} +1 -1
  140. package/dist/chunks/{progress-CHeMS6C5.mjs → progress-DzHu9qd2.mjs} +4 -4
  141. package/dist/chunks/{progress-CHeMS6C5.mjs.map → progress-DzHu9qd2.mjs.map} +1 -1
  142. package/dist/chunks/react-number-format.es-CmBAGhhQ.mjs +1542 -0
  143. package/dist/chunks/react-number-format.es-CmBAGhhQ.mjs.map +1 -0
  144. package/dist/chunks/{scroll-area-DD_iSFs6.mjs → scroll-area-DDlmn7ag.mjs} +11 -11
  145. package/dist/chunks/{scroll-area-DD_iSFs6.mjs.map → scroll-area-DDlmn7ag.mjs.map} +1 -1
  146. package/dist/chunks/{select-CJd-Zy4C.mjs → select-BdW90s0k.mjs} +5 -5
  147. package/dist/chunks/{select-CJd-Zy4C.mjs.map → select-BdW90s0k.mjs.map} +1 -1
  148. package/dist/chunks/{separator-B-gxoRcb.mjs → separator-CkJ0LBlz.mjs} +3 -3
  149. package/dist/chunks/{separator-B-gxoRcb.mjs.map → separator-CkJ0LBlz.mjs.map} +1 -1
  150. package/dist/chunks/{sheet-D90WmOXg.mjs → sheet-BLsRYTsa.mjs} +4 -4
  151. package/dist/chunks/{sheet-D90WmOXg.mjs.map → sheet-BLsRYTsa.mjs.map} +1 -1
  152. package/dist/chunks/{skeleton-CJEOoSbM.mjs → skeleton-CGj35I4b.mjs} +2 -2
  153. package/dist/chunks/skeleton-CGj35I4b.mjs.map +1 -0
  154. package/dist/chunks/{sortable-DoZCl2bh.mjs → sortable-CxR7dghC.mjs} +3 -3
  155. package/dist/chunks/{sortable-DoZCl2bh.mjs.map → sortable-CxR7dghC.mjs.map} +1 -1
  156. package/dist/chunks/{table-D6yKv2LD.mjs → table-YJw4-dig.mjs} +2 -2
  157. package/dist/chunks/{table-D6yKv2LD.mjs.map → table-YJw4-dig.mjs.map} +1 -1
  158. package/dist/chunks/{textarea-BtDGDi6_.mjs → textarea-uqJyF5jY.mjs} +2 -2
  159. package/dist/chunks/{textarea-BtDGDi6_.mjs.map → textarea-uqJyF5jY.mjs.map} +1 -1
  160. package/dist/chunks/{toggle-gSLS96EJ.mjs → toggle-DnllXBCB.mjs} +5 -5
  161. package/dist/chunks/{toggle-gSLS96EJ.mjs.map → toggle-DnllXBCB.mjs.map} +1 -1
  162. package/dist/chunks/{tooltip-ikD2NXuw.mjs → tooltip-kXkkJZem.mjs} +13 -13
  163. package/dist/chunks/{tooltip-ikD2NXuw.mjs.map → tooltip-kXkkJZem.mjs.map} +1 -1
  164. package/dist/chunks/{trash-2-Dmk0bwIZ.mjs → trash-2-CJs96X7u.mjs} +2 -2
  165. package/dist/chunks/{trash-2-Dmk0bwIZ.mjs.map → trash-2-CJs96X7u.mjs.map} +1 -1
  166. package/dist/chunks/{triangle-alert-CdjPlo2e.mjs → triangle-alert-CW5j-i5O.mjs} +2 -2
  167. package/dist/chunks/{triangle-alert-CdjPlo2e.mjs.map → triangle-alert-CW5j-i5O.mjs.map} +1 -1
  168. package/dist/chunks/{tslib.es6-BG2RIc9b.mjs → tslib.es6-dqPUMt5Y.mjs} +1 -1
  169. package/dist/chunks/{tslib.es6-BG2RIc9b.mjs.map → tslib.es6-dqPUMt5Y.mjs.map} +1 -1
  170. package/dist/chunks/{utils-htJ3fJDn.mjs → utils-D8c5tyzG.mjs} +2 -2
  171. package/dist/chunks/{utils-htJ3fJDn.mjs.map → utils-D8c5tyzG.mjs.map} +1 -1
  172. package/dist/chunks/{x-DqJAQ42C.mjs → x-DYQCuAK0.mjs} +2 -2
  173. package/dist/chunks/{x-DqJAQ42C.mjs.map → x-DYQCuAK0.mjs.map} +1 -1
  174. package/dist/collapsible/index.mjs +9 -9
  175. package/dist/combobox/index.mjs +26 -26
  176. package/dist/command/index.d.ts +7 -7
  177. package/dist/command/index.mjs +20 -20
  178. package/dist/context-menu/index.mjs +23 -23
  179. package/dist/dash/index.d.ts +6 -6
  180. package/dist/dash/index.mjs +34 -34
  181. package/dist/dash/index.mjs.map +1 -1
  182. package/dist/data-table/index.d.ts +40 -40
  183. package/dist/data-table/index.mjs +208 -208
  184. package/dist/data-table/index.mjs.map +1 -1
  185. package/dist/date-picker/index.d.ts +1 -1
  186. package/dist/date-picker/index.mjs +27 -27
  187. package/dist/date-picker/index.mjs.map +1 -1
  188. package/dist/dialog/index.mjs +19 -19
  189. package/dist/drawer/index.mjs +16 -16
  190. package/dist/dropdown-menu/index.mjs +23 -23
  191. package/dist/dropdown-menu/index.mjs.map +1 -1
  192. package/dist/dropzone/index.mjs +193 -193
  193. package/dist/dropzone/index.mjs.map +1 -1
  194. package/dist/editable-table/index.d.ts +28 -0
  195. package/dist/editable-table/index.mjs +151 -0
  196. package/dist/editable-table/index.mjs.map +1 -0
  197. package/dist/empty/index.mjs +2 -2
  198. package/dist/empty/index.mjs.map +1 -1
  199. package/dist/field/index.mjs +8 -7
  200. package/dist/field/index.mjs.map +1 -1
  201. package/dist/form/index.mjs +5 -5
  202. package/dist/form-fields/index.mjs +28 -28
  203. package/dist/hover-card/index.mjs +15 -15
  204. package/dist/icon/index.mjs +1 -1
  205. package/dist/index.css +1 -1
  206. package/dist/input/index.mjs +3 -3
  207. package/dist/input-group/index.mjs +12 -9
  208. package/dist/input-group/index.mjs.map +1 -1
  209. package/dist/input-otp/index.mjs +3 -3
  210. package/dist/item/index.mjs +7 -6
  211. package/dist/item/index.mjs.map +1 -1
  212. package/dist/ivt.css +1 -1
  213. package/dist/kbd/index.mjs +2 -2
  214. package/dist/kbd/index.mjs.map +1 -1
  215. package/dist/label/index.mjs +4 -4
  216. package/dist/layout/index.mjs +6 -6
  217. package/dist/layout/index.mjs.map +1 -1
  218. package/dist/menubar/index.mjs +23 -23
  219. package/dist/multi-select/index.mjs +31 -31
  220. package/dist/navigation-menu/index.mjs +17 -17
  221. package/dist/pagination/index.d.ts +1 -1
  222. package/dist/pagination/index.mjs +8 -8
  223. package/dist/popover/index.mjs +18 -18
  224. package/dist/progress/index.mjs +5 -5
  225. package/dist/radio-group/index.mjs +17 -17
  226. package/dist/resizable/index.mjs +3 -3
  227. package/dist/scroll-area/index.mjs +12 -12
  228. package/dist/select/index.mjs +6 -6
  229. package/dist/separator/index.mjs +4 -4
  230. package/dist/shared/index.d.ts +1 -1
  231. package/dist/shared/index.mjs +6 -6
  232. package/dist/shared/index.mjs.map +1 -1
  233. package/dist/sheet/index.mjs +19 -19
  234. package/dist/sidebar/index.mjs +28 -28
  235. package/dist/sidebar/index.mjs.map +1 -1
  236. package/dist/skeleton/index.mjs +3 -3
  237. package/dist/skeleton-component/index.mjs +4 -4
  238. package/dist/skeleton-component/index.mjs.map +1 -1
  239. package/dist/slider/index.mjs +12 -12
  240. package/dist/sortable/index.mjs +4 -4
  241. package/dist/spinner/index.mjs +4 -4
  242. package/dist/switch/index.mjs +10 -10
  243. package/dist/table/index.mjs +3 -3
  244. package/dist/table-filter/index.d.ts +1 -1
  245. package/dist/table-filter/index.mjs +54 -1591
  246. package/dist/table-filter/index.mjs.map +1 -1
  247. package/dist/tabs/index.mjs +13 -13
  248. package/dist/tabs/index.mjs.map +1 -1
  249. package/dist/textarea/index.mjs +3 -3
  250. package/dist/toast/index.mjs +15 -15
  251. package/dist/toast/index.mjs.map +1 -1
  252. package/dist/toggle/index.mjs +7 -7
  253. package/dist/toggle-group/index.mjs +13 -13
  254. package/dist/tooltip/index.mjs +17 -17
  255. package/package.json +462 -454
  256. package/dist/chunks/CalendarRange-B0vBSe1u.mjs.map +0 -1
  257. package/dist/chunks/_commonjsHelpers-B0eMPDMg.mjs.map +0 -1
  258. package/dist/chunks/skeleton-CJEOoSbM.mjs.map +0 -1
@@ -1,523 +1,183 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { createContext, useContext, useCallback, useRef, useLayoutEffect, useState, useEffect, useMemo } from 'react';
3
- import { c as cn } from './utils-htJ3fJDn.mjs';
4
- import { t as toDate, c as constructFrom, j as addDays, y as normalizeDates, z as startOfDay, g as getDefaultOptions, A as differenceInCalendarDays, f as format, i as getISOWeek, h as getWeek, B as isDate, e as startOfISOWeek, s as startOfWeek, C as startOfYear, l as enUS } from './format-Bs2dFpMr.mjs';
5
- import { C as ChevronLeft } from './chevron-left-uXOOSe-Y.mjs';
6
- import { C as ChevronRight } from './chevron-right-4COrIxgm.mjs';
7
- import { C as ChevronDown } from './chevron-down-BgxaTVhM.mjs';
8
- import { b as buttonVariants, B as Button$1 } from './button-DjpHcHp9.mjs';
3
+ import { c as cn } from './utils-D8c5tyzG.mjs';
4
+ import { t as toDate, c as constructFrom, j as addDays, y as normalizeDates, z as startOfDay, g as getDefaultOptions, A as differenceInCalendarDays, f as format, i as getISOWeek, h as getWeek, B as isDate, e as startOfISOWeek, s as startOfWeek, C as startOfYear, l as enUS } from './format-6LfcNksm.mjs';
5
+ import { C as ChevronLeft } from './chevron-left-Cla2-kGr.mjs';
6
+ import { C as ChevronRight } from './chevron-right-C3X2iYjh.mjs';
7
+ import { C as ChevronDown } from './chevron-down-CNWi6KOF.mjs';
8
+ import { b as buttonVariants, B as Button$1 } from './button-D_MnAjQl.mjs';
9
9
 
10
10
  /**
11
- * Time zone name format.
11
+ * The {@link addMonths} function options.
12
12
  */ /**
13
- * The function returns the time zone name for the given date in the specified
14
- * time zone.
13
+ * @name addMonths
14
+ * @category Month Helpers
15
+ * @summary Add the specified number of months to the given date.
15
16
  *
16
- * It uses the `Intl.DateTimeFormat` API and by default outputs the time zone
17
- * name in a long format, e.g. "Pacific Standard Time" or
18
- * "Singapore Standard Time".
17
+ * @description
18
+ * Add the specified number of months to the given date.
19
19
  *
20
- * It is possible to specify the format as the third argument using one of the following options
20
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
21
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
21
22
  *
22
- * - "short": e.g. "EDT" or "GMT+8".
23
- * - "long": e.g. "Eastern Daylight Time".
24
- * - "shortGeneric": e.g. "ET" or "Singapore Time".
25
- * - "longGeneric": e.g. "Eastern Time" or "Singapore Standard Time".
23
+ * @param date - The date to be changed
24
+ * @param amount - The amount of months to be added.
25
+ * @param options - The options object
26
26
  *
27
- * These options correspond to TR35 tokens `z..zzz`, `zzzz`, `v`, and `vvvv` respectively: https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone
27
+ * @returns The new date with the months added
28
28
  *
29
- * @param timeZone - Time zone name (IANA or UTC offset)
30
- * @param date - Date object to get the time zone name for
31
- * @param format - Optional format of the time zone name. Defaults to "long". Can be "short", "long", "shortGeneric", or "longGeneric".
29
+ * @example
30
+ * // Add 5 months to 1 September 2014:
31
+ * const result = addMonths(new Date(2014, 8, 1), 5)
32
+ * //=> Sun Feb 01 2015 00:00:00
32
33
  *
33
- * @returns Time zone name (e.g. "Singapore Standard Time")
34
- */ function tzName(timeZone, date, format = "long") {
35
- return new Intl.DateTimeFormat("en-US", {
36
- // Enforces engine to render the time. Without the option JavaScriptCore omits it.
37
- hour: "numeric",
38
- timeZone: timeZone,
39
- timeZoneName: format
40
- }).format(date).split(/\s/g) // Format.JS uses non-breaking spaces
41
- .slice(2) // Skip the hour and AM/PM parts
42
- .join(" ");
34
+ * // Add one month to 30 January 2023:
35
+ * const result = addMonths(new Date(2023, 0, 30), 1)
36
+ * //=> Tue Feb 28 2023 00:00:00
37
+ */ function addMonths(date, amount, options) {
38
+ const _date = toDate(date, options?.in);
39
+ if (isNaN(amount)) return constructFrom(date, NaN);
40
+ if (!amount) {
41
+ // If 0 months, no-op to avoid changing times in the hour before end of DST
42
+ return _date;
43
+ }
44
+ const dayOfMonth = _date.getDate();
45
+ // The JS Date object supports date math by accepting out-of-bounds values for
46
+ // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
47
+ // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
48
+ // want except that dates will wrap around the end of a month, meaning that
49
+ // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
50
+ // we'll default to the end of the desired month by adding 1 to the desired
51
+ // month and using a date of 0 to back up one day to the end of the desired
52
+ // month.
53
+ const endOfDesiredMonth = constructFrom(date, _date.getTime());
54
+ endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
55
+ const daysInMonth = endOfDesiredMonth.getDate();
56
+ if (dayOfMonth >= daysInMonth) {
57
+ // If we're already at the end of the month, then this is the correct date
58
+ // and we're done.
59
+ return endOfDesiredMonth;
60
+ } else {
61
+ // Otherwise, we now know that setting the original day-of-month value won't
62
+ // cause an overflow, so set the desired day-of-month. Note that we can't
63
+ // just set the date of `endOfDesiredMonth` because that object may have had
64
+ // its time changed in the unusual case where where a DST transition was on
65
+ // the last day of the month and its local time was in the hour skipped or
66
+ // repeated next to a DST transition. So we use `date` instead which is
67
+ // guaranteed to still have the original time.
68
+ _date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
69
+ return _date;
70
+ }
43
71
  }
44
72
 
45
- const offsetFormatCache = {};
46
- const offsetCache = {};
47
73
  /**
48
- * The function extracts UTC offset in minutes from the given date in specified
49
- * time zone.
74
+ * The {@link addWeeks} function options.
75
+ */ /**
76
+ * @name addWeeks
77
+ * @category Week Helpers
78
+ * @summary Add the specified number of weeks to the given date.
50
79
  *
51
- * Unlike `Date.prototype.getTimezoneOffset`, this function returns the value
52
- * mirrored to the sign of the offset in the time zone. For Asia/Singapore
53
- * (UTC+8), `tzOffset` returns 480, while `getTimezoneOffset` returns -480.
80
+ * @description
81
+ * Add the specified number of weeks to the given date.
54
82
  *
55
- * @param timeZone - Time zone name (IANA or UTC offset)
56
- * @param date - Date to check the offset for
83
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
84
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
57
85
  *
58
- * @returns UTC offset in minutes
59
- */ function tzOffset(timeZone, date) {
60
- try {
61
- var _offsetFormatCache, _timeZone;
62
- const format = (_offsetFormatCache = offsetFormatCache)[_timeZone = timeZone] || (_offsetFormatCache[_timeZone] = new Intl.DateTimeFormat("en-US", {
63
- timeZone,
64
- timeZoneName: "longOffset"
65
- }).format);
66
- const offsetStr = format(date).split("GMT")[1];
67
- if (offsetStr in offsetCache) return offsetCache[offsetStr];
68
- return calcOffset(offsetStr, offsetStr.split(":"));
69
- } catch {
70
- // Fallback to manual parsing if the runtime doesn't support ±HH:MM/±HHMM/±HH
71
- // See: https://github.com/nodejs/node/issues/53419
72
- if (timeZone in offsetCache) return offsetCache[timeZone];
73
- const captures = timeZone?.match(offsetRe);
74
- if (captures) return calcOffset(timeZone, captures.slice(1));
75
- return NaN;
76
- }
77
- }
78
- const offsetRe = /([+-]\d\d):?(\d\d)?/;
79
- function calcOffset(cacheStr, values) {
80
- const hours = +(values[0] || 0);
81
- const minutes = +(values[1] || 0);
82
- // Convert seconds to minutes by dividing by 60 to keep the function return in minutes.
83
- const seconds = +(values[2] || 0) / 60;
84
- return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
86
+ * @param date - The date to be changed
87
+ * @param amount - The amount of weeks to be added.
88
+ * @param options - An object with options
89
+ *
90
+ * @returns The new date with the weeks added
91
+ *
92
+ * @example
93
+ * // Add 4 weeks to 1 September 2014:
94
+ * const result = addWeeks(new Date(2014, 8, 1), 4)
95
+ * //=> Mon Sep 29 2014 00:00:00
96
+ */ function addWeeks(date, amount, options) {
97
+ return addDays(date, amount * 7, options);
85
98
  }
86
99
 
87
- class TZDateMini extends Date {
88
- static tz(tz, ...args) {
89
- return args.length ? new TZDateMini(...args, tz) : new TZDateMini(Date.now(), tz);
90
- }
91
- //#endregion
92
- //#region time zone
93
- withTimeZone(timeZone) {
94
- return new TZDateMini(+this, timeZone);
95
- }
96
- getTimezoneOffset() {
97
- const offset = -tzOffset(this.timeZone, this);
98
- // Remove the seconds offset
99
- // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
100
- return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
101
- }
102
- //#endregion
103
- //#region time
104
- setTime(time) {
105
- Date.prototype.setTime.apply(this, arguments);
106
- syncToInternal(this);
107
- return +this;
108
- }
109
- //#endregion
110
- //#region date-fns integration
111
- [Symbol.for("constructDateFrom")](date) {
112
- return new TZDateMini(+new Date(date), this.timeZone);
113
- }
114
- //#region static
115
- constructor(...args){
116
- super();
117
- if (args.length > 1 && typeof args[args.length - 1] === "string") {
118
- this.timeZone = args.pop();
119
- }
120
- this.internal = new Date();
121
- if (isNaN(tzOffset(this.timeZone, this))) {
122
- this.setTime(NaN);
123
- } else {
124
- if (!args.length) {
125
- this.setTime(Date.now());
126
- } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
127
- this.setTime(args[0]);
128
- } else if (typeof args[0] === "string") {
129
- this.setTime(+new Date(args[0]));
130
- } else if (args[0] instanceof Date) {
131
- this.setTime(+args[0]);
132
- } else {
133
- this.setTime(+new Date(...args));
134
- adjustToSystemTZ(this);
135
- syncToInternal(this);
136
- }
137
- }
138
- }
139
- }
140
- // Assign getters and setters
141
- const re = /^(get|set)(?!UTC)/;
142
- Object.getOwnPropertyNames(Date.prototype).forEach((method)=>{
143
- if (!re.test(method)) return;
144
- const utcMethod = method.replace(re, "$1UTC");
145
- // Filter out methods without UTC counterparts
146
- if (!TZDateMini.prototype[utcMethod]) return;
147
- if (method.startsWith("get")) {
148
- // Delegate to internal date's UTC method
149
- TZDateMini.prototype[method] = function() {
150
- return this.internal[utcMethod]();
151
- };
152
- } else {
153
- // Assign regular setter
154
- TZDateMini.prototype[method] = function() {
155
- Date.prototype[utcMethod].apply(this.internal, arguments);
156
- syncFromInternal(this);
157
- return +this;
158
- };
159
- // Assign UTC setter
160
- TZDateMini.prototype[utcMethod] = function() {
161
- Date.prototype[utcMethod].apply(this, arguments);
162
- syncToInternal(this);
163
- return +this;
164
- };
165
- }
166
- });
167
100
  /**
168
- * Function syncs time to internal date, applying the time zone offset.
101
+ * The {@link addYears} function options.
102
+ */ /**
103
+ * @name addYears
104
+ * @category Year Helpers
105
+ * @summary Add the specified number of years to the given date.
169
106
  *
170
- * @param {Date} date - Date to sync
171
- */ function syncToInternal(date) {
172
- date.internal.setTime(+date);
173
- date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
174
- }
175
- /**
176
- * Function syncs the internal date UTC values to the date. It allows to get
177
- * accurate timestamp value.
107
+ * @description
108
+ * Add the specified number of years to the given date.
178
109
  *
179
- * @param {Date} date - The date to sync
180
- */ function syncFromInternal(date) {
181
- // First we transpose the internal values
182
- Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
183
- Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
184
- // Now we have to adjust the date to the system time zone
185
- adjustToSystemTZ(date);
110
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
111
+ * @typeParam ResultDate - The result `Date` type.
112
+ *
113
+ * @param date - The date to be changed
114
+ * @param amount - The amount of years to be added.
115
+ * @param options - The options
116
+ *
117
+ * @returns The new date with the years added
118
+ *
119
+ * @example
120
+ * // Add 5 years to 1 September 2014:
121
+ * const result = addYears(new Date(2014, 8, 1), 5)
122
+ * //=> Sun Sep 01 2019 00:00:00
123
+ */ function addYears(date, amount, options) {
124
+ return addMonths(date, amount * 12, options);
186
125
  }
126
+
187
127
  /**
188
- * Function adjusts the date to the system time zone. It uses the time zone
189
- * differences to calculate the offset and adjust the date.
190
- *
191
- * @param {Date} date - Date to adjust
192
- */ function adjustToSystemTZ(date) {
193
- // Save the time zone offset before all the adjustments
194
- const baseOffset = tzOffset(date.timeZone, date);
195
- // Remove the seconds offset
196
- // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
197
- const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);
198
- //#region System DST adjustment
199
- // The biggest problem with using the system time zone is that when we create
200
- // a date from internal values stored in UTC, the system time zone might end
201
- // up on the DST hour:
202
- //
203
- // $ TZ=America/New_York node
204
- // > new Date(2020, 2, 8, 1).toString()
205
- // 'Sun Mar 08 2020 01:00:00 GMT-0500 (Eastern Standard Time)'
206
- // > new Date(2020, 2, 8, 2).toString()
207
- // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
208
- // > new Date(2020, 2, 8, 3).toString()
209
- // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
210
- // > new Date(2020, 2, 8, 4).toString()
211
- // 'Sun Mar 08 2020 04:00:00 GMT-0400 (Eastern Daylight Time)'
212
- //
213
- // Here we get the same hour for both 2 and 3, because the system time zone
214
- // has DST beginning at 8 March 2020, 2 a.m. and jumps to 3 a.m. So we have
215
- // to adjust the internal date to reflect that.
216
- //
217
- // However we want to adjust only if that's the DST hour the change happenes,
218
- // not the hour where DST moves to.
219
- // We calculate the previous hour to see if the time zone offset has changed
220
- // and we have landed on the DST hour.
221
- const prevHour = new Date(+date);
222
- // We use UTC methods here as we don't want to land on the same hour again
223
- // in case of DST.
224
- prevHour.setUTCHours(prevHour.getUTCHours() - 1);
225
- // Calculate if we are on the system DST hour.
226
- const systemOffset = -new Date(+date).getTimezoneOffset();
227
- const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();
228
- const systemDSTChange = systemOffset - prevHourSystemOffset;
229
- // Detect the DST shift. System DST change will occur both on
230
- const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
231
- // Move the internal date when we are on the system DST hour.
232
- if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
233
- //#endregion
234
- //#region System diff adjustment
235
- // Now we need to adjust the date, since we just applied internal values.
236
- // We need to calculate the difference between the system and date time zones
237
- // and apply it to the date.
238
- const offsetDiff = systemOffset - offset;
239
- if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
240
- //#endregion
241
- //#region Seconds System diff adjustment
242
- const systemDate = new Date(+date);
243
- // Set the UTC seconds to 0 to isolate the timezone offset in seconds.
244
- systemDate.setUTCSeconds(0);
245
- // For negative systemOffset, invert the seconds.
246
- const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
247
- // Calculate the seconds offset based on the timezone offset.
248
- const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
249
- if (secondsOffset || systemSecondsOffset) {
250
- date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
251
- Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
252
- }
253
- //#endregion
254
- //#region Post-adjustment DST fix
255
- const postBaseOffset = tzOffset(date.timeZone, date);
256
- // Remove the seconds offset
257
- // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
258
- const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
259
- const postSystemOffset = -new Date(+date).getTimezoneOffset();
260
- const postOffsetDiff = postSystemOffset - postOffset;
261
- const offsetChanged = postOffset !== offset;
262
- const postDiff = postOffsetDiff - offsetDiff;
263
- if (offsetChanged && postDiff) {
264
- Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
265
- // Now we need to check if got offset change during the post-adjustment.
266
- // If so, we also need both dates to reflect that.
267
- const newBaseOffset = tzOffset(date.timeZone, date);
268
- // Remove the seconds offset
269
- // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
270
- const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
271
- const offsetChange = postOffset - newOffset;
272
- if (offsetChange) {
273
- date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
274
- Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
275
- }
276
- }
277
- //#endregion
278
- }
279
-
280
- class TZDate extends TZDateMini {
281
- //#region static
282
- static tz(tz, ...args) {
283
- return args.length ? new TZDate(...args, tz) : new TZDate(Date.now(), tz);
284
- }
285
- //#endregion
286
- //#region representation
287
- toISOString() {
288
- const [sign, hours, minutes] = this.tzComponents();
289
- const tz = `${sign}${hours}:${minutes}`;
290
- return this.internal.toISOString().slice(0, -1) + tz;
291
- }
292
- toString() {
293
- // "Tue Aug 13 2024 07:50:19 GMT+0800 (Singapore Standard Time)";
294
- return `${this.toDateString()} ${this.toTimeString()}`;
295
- }
296
- toDateString() {
297
- // toUTCString returns RFC 7231 ("Mon, 12 Aug 2024 23:36:08 GMT")
298
- const [day, date, month, year] = this.internal.toUTCString().split(" ");
299
- // "Tue Aug 13 2024"
300
- return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
301
- }
302
- toTimeString() {
303
- // toUTCString returns RFC 7231 ("Mon, 12 Aug 2024 23:36:08 GMT")
304
- const time = this.internal.toUTCString().split(" ")[4];
305
- const [sign, hours, minutes] = this.tzComponents();
306
- // "07:42:23 GMT+0800 (Singapore Standard Time)"
307
- return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
308
- }
309
- toLocaleString(locales, options) {
310
- return Date.prototype.toLocaleString.call(this, locales, {
311
- ...options,
312
- timeZone: options?.timeZone || this.timeZone
313
- });
314
- }
315
- toLocaleDateString(locales, options) {
316
- return Date.prototype.toLocaleDateString.call(this, locales, {
317
- ...options,
318
- timeZone: options?.timeZone || this.timeZone
319
- });
320
- }
321
- toLocaleTimeString(locales, options) {
322
- return Date.prototype.toLocaleTimeString.call(this, locales, {
323
- ...options,
324
- timeZone: options?.timeZone || this.timeZone
325
- });
326
- }
327
- //#endregion
328
- //#region private
329
- tzComponents() {
330
- const offset = this.getTimezoneOffset();
331
- const sign = offset > 0 ? "-" : "+";
332
- const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
333
- const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
334
- return [
335
- sign,
336
- hours,
337
- minutes
338
- ];
339
- }
340
- //#endregion
341
- withTimeZone(timeZone) {
342
- return new TZDate(+this, timeZone);
343
- }
344
- //#region date-fns integration
345
- [Symbol.for("constructDateFrom")](date) {
346
- return new TZDate(+new Date(date), this.timeZone);
347
- }
348
- }
349
-
350
- /**
351
- * The {@link addMonths} function options.
128
+ * The {@link max} function options.
352
129
  */ /**
353
- * @name addMonths
354
- * @category Month Helpers
355
- * @summary Add the specified number of months to the given date.
130
+ * @name max
131
+ * @category Common Helpers
132
+ * @summary Return the latest of the given dates.
356
133
  *
357
134
  * @description
358
- * Add the specified number of months to the given date.
135
+ * Return the latest of the given dates.
359
136
  *
360
137
  * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
361
138
  * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
362
139
  *
363
- * @param date - The date to be changed
364
- * @param amount - The amount of months to be added.
365
- * @param options - The options object
140
+ * @param dates - The dates to compare
366
141
  *
367
- * @returns The new date with the months added
142
+ * @returns The latest of the dates
368
143
  *
369
144
  * @example
370
- * // Add 5 months to 1 September 2014:
371
- * const result = addMonths(new Date(2014, 8, 1), 5)
372
- * //=> Sun Feb 01 2015 00:00:00
373
- *
374
- * // Add one month to 30 January 2023:
375
- * const result = addMonths(new Date(2023, 0, 30), 1)
376
- * //=> Tue Feb 28 2023 00:00:00
377
- */ function addMonths(date, amount, options) {
378
- const _date = toDate(date, options?.in);
379
- if (isNaN(amount)) return constructFrom(date, NaN);
380
- if (!amount) {
381
- // If 0 months, no-op to avoid changing times in the hour before end of DST
382
- return _date;
383
- }
384
- const dayOfMonth = _date.getDate();
385
- // The JS Date object supports date math by accepting out-of-bounds values for
386
- // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
387
- // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
388
- // want except that dates will wrap around the end of a month, meaning that
389
- // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
390
- // we'll default to the end of the desired month by adding 1 to the desired
391
- // month and using a date of 0 to back up one day to the end of the desired
392
- // month.
393
- const endOfDesiredMonth = constructFrom(date, _date.getTime());
394
- endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
395
- const daysInMonth = endOfDesiredMonth.getDate();
396
- if (dayOfMonth >= daysInMonth) {
397
- // If we're already at the end of the month, then this is the correct date
398
- // and we're done.
399
- return endOfDesiredMonth;
400
- } else {
401
- // Otherwise, we now know that setting the original day-of-month value won't
402
- // cause an overflow, so set the desired day-of-month. Note that we can't
403
- // just set the date of `endOfDesiredMonth` because that object may have had
404
- // its time changed in the unusual case where where a DST transition was on
405
- // the last day of the month and its local time was in the hour skipped or
406
- // repeated next to a DST transition. So we use `date` instead which is
407
- // guaranteed to still have the original time.
408
- _date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
409
- return _date;
410
- }
145
+ * // Which of these dates is the latest?
146
+ * const result = max([
147
+ * new Date(1989, 6, 10),
148
+ * new Date(1987, 1, 11),
149
+ * new Date(1995, 6, 2),
150
+ * new Date(1990, 0, 1)
151
+ * ])
152
+ * //=> Sun Jul 02 1995 00:00:00
153
+ */ function max(dates, options) {
154
+ let result;
155
+ let context = options?.in;
156
+ dates.forEach((date)=>{
157
+ // Use the first date object as the context function
158
+ if (!context && typeof date === "object") context = constructFrom.bind(null, date);
159
+ const date_ = toDate(date, context);
160
+ if (!result || result < date_ || isNaN(+date_)) result = date_;
161
+ });
162
+ return constructFrom(context, result || NaN);
411
163
  }
412
164
 
413
165
  /**
414
- * The {@link addWeeks} function options.
166
+ * The {@link min} function options.
415
167
  */ /**
416
- * @name addWeeks
417
- * @category Week Helpers
418
- * @summary Add the specified number of weeks to the given date.
168
+ * @name min
169
+ * @category Common Helpers
170
+ * @summary Returns the earliest of the given dates.
419
171
  *
420
172
  * @description
421
- * Add the specified number of weeks to the given date.
173
+ * Returns the earliest of the given dates.
422
174
  *
423
175
  * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
424
176
  * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
425
177
  *
426
- * @param date - The date to be changed
427
- * @param amount - The amount of weeks to be added.
428
- * @param options - An object with options
178
+ * @param dates - The dates to compare
429
179
  *
430
- * @returns The new date with the weeks added
431
- *
432
- * @example
433
- * // Add 4 weeks to 1 September 2014:
434
- * const result = addWeeks(new Date(2014, 8, 1), 4)
435
- * //=> Mon Sep 29 2014 00:00:00
436
- */ function addWeeks(date, amount, options) {
437
- return addDays(date, amount * 7, options);
438
- }
439
-
440
- /**
441
- * The {@link addYears} function options.
442
- */ /**
443
- * @name addYears
444
- * @category Year Helpers
445
- * @summary Add the specified number of years to the given date.
446
- *
447
- * @description
448
- * Add the specified number of years to the given date.
449
- *
450
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
451
- * @typeParam ResultDate - The result `Date` type.
452
- *
453
- * @param date - The date to be changed
454
- * @param amount - The amount of years to be added.
455
- * @param options - The options
456
- *
457
- * @returns The new date with the years added
458
- *
459
- * @example
460
- * // Add 5 years to 1 September 2014:
461
- * const result = addYears(new Date(2014, 8, 1), 5)
462
- * //=> Sun Sep 01 2019 00:00:00
463
- */ function addYears(date, amount, options) {
464
- return addMonths(date, amount * 12, options);
465
- }
466
-
467
- /**
468
- * The {@link max} function options.
469
- */ /**
470
- * @name max
471
- * @category Common Helpers
472
- * @summary Return the latest of the given dates.
473
- *
474
- * @description
475
- * Return the latest of the given dates.
476
- *
477
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
478
- * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
479
- *
480
- * @param dates - The dates to compare
481
- *
482
- * @returns The latest of the dates
483
- *
484
- * @example
485
- * // Which of these dates is the latest?
486
- * const result = max([
487
- * new Date(1989, 6, 10),
488
- * new Date(1987, 1, 11),
489
- * new Date(1995, 6, 2),
490
- * new Date(1990, 0, 1)
491
- * ])
492
- * //=> Sun Jul 02 1995 00:00:00
493
- */ function max(dates, options) {
494
- let result;
495
- let context = options?.in;
496
- dates.forEach((date)=>{
497
- // Use the first date object as the context function
498
- if (!context && typeof date === "object") context = constructFrom.bind(null, date);
499
- const date_ = toDate(date, context);
500
- if (!result || result < date_ || isNaN(+date_)) result = date_;
501
- });
502
- return constructFrom(context, result || NaN);
503
- }
504
-
505
- /**
506
- * The {@link min} function options.
507
- */ /**
508
- * @name min
509
- * @category Common Helpers
510
- * @summary Returns the earliest of the given dates.
511
- *
512
- * @description
513
- * Returns the earliest of the given dates.
514
- *
515
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
516
- * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
517
- *
518
- * @param dates - The dates to compare
519
- *
520
- * @returns The earliest of the dates
180
+ * @returns The earliest of the dates
521
181
  *
522
182
  * @example
523
183
  * // Which of these dates is the earliest?
@@ -1118,6 +778,346 @@ function normalizeInterval(context, interval) {
1118
778
  return date_;
1119
779
  }
1120
780
 
781
+ /**
782
+ * Time zone name format.
783
+ */ /**
784
+ * The function returns the time zone name for the given date in the specified
785
+ * time zone.
786
+ *
787
+ * It uses the `Intl.DateTimeFormat` API and by default outputs the time zone
788
+ * name in a long format, e.g. "Pacific Standard Time" or
789
+ * "Singapore Standard Time".
790
+ *
791
+ * It is possible to specify the format as the third argument using one of the following options
792
+ *
793
+ * - "short": e.g. "EDT" or "GMT+8".
794
+ * - "long": e.g. "Eastern Daylight Time".
795
+ * - "shortGeneric": e.g. "ET" or "Singapore Time".
796
+ * - "longGeneric": e.g. "Eastern Time" or "Singapore Standard Time".
797
+ *
798
+ * These options correspond to TR35 tokens `z..zzz`, `zzzz`, `v`, and `vvvv` respectively: https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone
799
+ *
800
+ * @param timeZone - Time zone name (IANA or UTC offset)
801
+ * @param date - Date object to get the time zone name for
802
+ * @param format - Optional format of the time zone name. Defaults to "long". Can be "short", "long", "shortGeneric", or "longGeneric".
803
+ *
804
+ * @returns Time zone name (e.g. "Singapore Standard Time")
805
+ */ function tzName(timeZone, date, format = "long") {
806
+ return new Intl.DateTimeFormat("en-US", {
807
+ // Enforces engine to render the time. Without the option JavaScriptCore omits it.
808
+ hour: "numeric",
809
+ timeZone: timeZone,
810
+ timeZoneName: format
811
+ }).format(date).split(/\s/g) // Format.JS uses non-breaking spaces
812
+ .slice(2) // Skip the hour and AM/PM parts
813
+ .join(" ");
814
+ }
815
+
816
+ const offsetFormatCache = {};
817
+ const offsetCache = {};
818
+ /**
819
+ * The function extracts UTC offset in minutes from the given date in specified
820
+ * time zone.
821
+ *
822
+ * Unlike `Date.prototype.getTimezoneOffset`, this function returns the value
823
+ * mirrored to the sign of the offset in the time zone. For Asia/Singapore
824
+ * (UTC+8), `tzOffset` returns 480, while `getTimezoneOffset` returns -480.
825
+ *
826
+ * @param timeZone - Time zone name (IANA or UTC offset)
827
+ * @param date - Date to check the offset for
828
+ *
829
+ * @returns UTC offset in minutes
830
+ */ function tzOffset(timeZone, date) {
831
+ try {
832
+ var _offsetFormatCache, _timeZone;
833
+ const format = (_offsetFormatCache = offsetFormatCache)[_timeZone = timeZone] || (_offsetFormatCache[_timeZone] = new Intl.DateTimeFormat("en-US", {
834
+ timeZone,
835
+ timeZoneName: "longOffset"
836
+ }).format);
837
+ const offsetStr = format(date).split("GMT")[1];
838
+ if (offsetStr in offsetCache) return offsetCache[offsetStr];
839
+ return calcOffset(offsetStr, offsetStr.split(":"));
840
+ } catch {
841
+ // Fallback to manual parsing if the runtime doesn't support ±HH:MM/±HHMM/±HH
842
+ // See: https://github.com/nodejs/node/issues/53419
843
+ if (timeZone in offsetCache) return offsetCache[timeZone];
844
+ const captures = timeZone?.match(offsetRe);
845
+ if (captures) return calcOffset(timeZone, captures.slice(1));
846
+ return NaN;
847
+ }
848
+ }
849
+ const offsetRe = /([+-]\d\d):?(\d\d)?/;
850
+ function calcOffset(cacheStr, values) {
851
+ const hours = +(values[0] || 0);
852
+ const minutes = +(values[1] || 0);
853
+ // Convert seconds to minutes by dividing by 60 to keep the function return in minutes.
854
+ const seconds = +(values[2] || 0) / 60;
855
+ return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
856
+ }
857
+
858
+ class TZDateMini extends Date {
859
+ static tz(tz, ...args) {
860
+ return args.length ? new TZDateMini(...args, tz) : new TZDateMini(Date.now(), tz);
861
+ }
862
+ //#endregion
863
+ //#region time zone
864
+ withTimeZone(timeZone) {
865
+ return new TZDateMini(+this, timeZone);
866
+ }
867
+ getTimezoneOffset() {
868
+ const offset = -tzOffset(this.timeZone, this);
869
+ // Remove the seconds offset
870
+ // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
871
+ return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
872
+ }
873
+ //#endregion
874
+ //#region time
875
+ setTime(time) {
876
+ Date.prototype.setTime.apply(this, arguments);
877
+ syncToInternal(this);
878
+ return +this;
879
+ }
880
+ //#endregion
881
+ //#region date-fns integration
882
+ [Symbol.for("constructDateFrom")](date) {
883
+ return new TZDateMini(+new Date(date), this.timeZone);
884
+ }
885
+ //#region static
886
+ constructor(...args){
887
+ super();
888
+ if (args.length > 1 && typeof args[args.length - 1] === "string") {
889
+ this.timeZone = args.pop();
890
+ }
891
+ this.internal = new Date();
892
+ if (isNaN(tzOffset(this.timeZone, this))) {
893
+ this.setTime(NaN);
894
+ } else {
895
+ if (!args.length) {
896
+ this.setTime(Date.now());
897
+ } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
898
+ this.setTime(args[0]);
899
+ } else if (typeof args[0] === "string") {
900
+ this.setTime(+new Date(args[0]));
901
+ } else if (args[0] instanceof Date) {
902
+ this.setTime(+args[0]);
903
+ } else {
904
+ this.setTime(+new Date(...args));
905
+ adjustToSystemTZ(this);
906
+ syncToInternal(this);
907
+ }
908
+ }
909
+ }
910
+ }
911
+ // Assign getters and setters
912
+ const re = /^(get|set)(?!UTC)/;
913
+ Object.getOwnPropertyNames(Date.prototype).forEach((method)=>{
914
+ if (!re.test(method)) return;
915
+ const utcMethod = method.replace(re, "$1UTC");
916
+ // Filter out methods without UTC counterparts
917
+ if (!TZDateMini.prototype[utcMethod]) return;
918
+ if (method.startsWith("get")) {
919
+ // Delegate to internal date's UTC method
920
+ TZDateMini.prototype[method] = function() {
921
+ return this.internal[utcMethod]();
922
+ };
923
+ } else {
924
+ // Assign regular setter
925
+ TZDateMini.prototype[method] = function() {
926
+ Date.prototype[utcMethod].apply(this.internal, arguments);
927
+ syncFromInternal(this);
928
+ return +this;
929
+ };
930
+ // Assign UTC setter
931
+ TZDateMini.prototype[utcMethod] = function() {
932
+ Date.prototype[utcMethod].apply(this, arguments);
933
+ syncToInternal(this);
934
+ return +this;
935
+ };
936
+ }
937
+ });
938
+ /**
939
+ * Function syncs time to internal date, applying the time zone offset.
940
+ *
941
+ * @param {Date} date - Date to sync
942
+ */ function syncToInternal(date) {
943
+ date.internal.setTime(+date);
944
+ date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
945
+ }
946
+ /**
947
+ * Function syncs the internal date UTC values to the date. It allows to get
948
+ * accurate timestamp value.
949
+ *
950
+ * @param {Date} date - The date to sync
951
+ */ function syncFromInternal(date) {
952
+ // First we transpose the internal values
953
+ Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
954
+ Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
955
+ // Now we have to adjust the date to the system time zone
956
+ adjustToSystemTZ(date);
957
+ }
958
+ /**
959
+ * Function adjusts the date to the system time zone. It uses the time zone
960
+ * differences to calculate the offset and adjust the date.
961
+ *
962
+ * @param {Date} date - Date to adjust
963
+ */ function adjustToSystemTZ(date) {
964
+ // Save the time zone offset before all the adjustments
965
+ const baseOffset = tzOffset(date.timeZone, date);
966
+ // Remove the seconds offset
967
+ // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
968
+ const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);
969
+ //#region System DST adjustment
970
+ // The biggest problem with using the system time zone is that when we create
971
+ // a date from internal values stored in UTC, the system time zone might end
972
+ // up on the DST hour:
973
+ //
974
+ // $ TZ=America/New_York node
975
+ // > new Date(2020, 2, 8, 1).toString()
976
+ // 'Sun Mar 08 2020 01:00:00 GMT-0500 (Eastern Standard Time)'
977
+ // > new Date(2020, 2, 8, 2).toString()
978
+ // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
979
+ // > new Date(2020, 2, 8, 3).toString()
980
+ // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
981
+ // > new Date(2020, 2, 8, 4).toString()
982
+ // 'Sun Mar 08 2020 04:00:00 GMT-0400 (Eastern Daylight Time)'
983
+ //
984
+ // Here we get the same hour for both 2 and 3, because the system time zone
985
+ // has DST beginning at 8 March 2020, 2 a.m. and jumps to 3 a.m. So we have
986
+ // to adjust the internal date to reflect that.
987
+ //
988
+ // However we want to adjust only if that's the DST hour the change happenes,
989
+ // not the hour where DST moves to.
990
+ // We calculate the previous hour to see if the time zone offset has changed
991
+ // and we have landed on the DST hour.
992
+ const prevHour = new Date(+date);
993
+ // We use UTC methods here as we don't want to land on the same hour again
994
+ // in case of DST.
995
+ prevHour.setUTCHours(prevHour.getUTCHours() - 1);
996
+ // Calculate if we are on the system DST hour.
997
+ const systemOffset = -new Date(+date).getTimezoneOffset();
998
+ const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();
999
+ const systemDSTChange = systemOffset - prevHourSystemOffset;
1000
+ // Detect the DST shift. System DST change will occur both on
1001
+ const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
1002
+ // Move the internal date when we are on the system DST hour.
1003
+ if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
1004
+ //#endregion
1005
+ //#region System diff adjustment
1006
+ // Now we need to adjust the date, since we just applied internal values.
1007
+ // We need to calculate the difference between the system and date time zones
1008
+ // and apply it to the date.
1009
+ const offsetDiff = systemOffset - offset;
1010
+ if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
1011
+ //#endregion
1012
+ //#region Seconds System diff adjustment
1013
+ const systemDate = new Date(+date);
1014
+ // Set the UTC seconds to 0 to isolate the timezone offset in seconds.
1015
+ systemDate.setUTCSeconds(0);
1016
+ // For negative systemOffset, invert the seconds.
1017
+ const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
1018
+ // Calculate the seconds offset based on the timezone offset.
1019
+ const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
1020
+ if (secondsOffset || systemSecondsOffset) {
1021
+ date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
1022
+ Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
1023
+ }
1024
+ //#endregion
1025
+ //#region Post-adjustment DST fix
1026
+ const postBaseOffset = tzOffset(date.timeZone, date);
1027
+ // Remove the seconds offset
1028
+ // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
1029
+ const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
1030
+ const postSystemOffset = -new Date(+date).getTimezoneOffset();
1031
+ const postOffsetDiff = postSystemOffset - postOffset;
1032
+ const offsetChanged = postOffset !== offset;
1033
+ const postDiff = postOffsetDiff - offsetDiff;
1034
+ if (offsetChanged && postDiff) {
1035
+ Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
1036
+ // Now we need to check if got offset change during the post-adjustment.
1037
+ // If so, we also need both dates to reflect that.
1038
+ const newBaseOffset = tzOffset(date.timeZone, date);
1039
+ // Remove the seconds offset
1040
+ // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
1041
+ const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
1042
+ const offsetChange = postOffset - newOffset;
1043
+ if (offsetChange) {
1044
+ date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
1045
+ Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
1046
+ }
1047
+ }
1048
+ //#endregion
1049
+ }
1050
+
1051
+ class TZDate extends TZDateMini {
1052
+ //#region static
1053
+ static tz(tz, ...args) {
1054
+ return args.length ? new TZDate(...args, tz) : new TZDate(Date.now(), tz);
1055
+ }
1056
+ //#endregion
1057
+ //#region representation
1058
+ toISOString() {
1059
+ const [sign, hours, minutes] = this.tzComponents();
1060
+ const tz = `${sign}${hours}:${minutes}`;
1061
+ return this.internal.toISOString().slice(0, -1) + tz;
1062
+ }
1063
+ toString() {
1064
+ // "Tue Aug 13 2024 07:50:19 GMT+0800 (Singapore Standard Time)";
1065
+ return `${this.toDateString()} ${this.toTimeString()}`;
1066
+ }
1067
+ toDateString() {
1068
+ // toUTCString returns RFC 7231 ("Mon, 12 Aug 2024 23:36:08 GMT")
1069
+ const [day, date, month, year] = this.internal.toUTCString().split(" ");
1070
+ // "Tue Aug 13 2024"
1071
+ return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
1072
+ }
1073
+ toTimeString() {
1074
+ // toUTCString returns RFC 7231 ("Mon, 12 Aug 2024 23:36:08 GMT")
1075
+ const time = this.internal.toUTCString().split(" ")[4];
1076
+ const [sign, hours, minutes] = this.tzComponents();
1077
+ // "07:42:23 GMT+0800 (Singapore Standard Time)"
1078
+ return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
1079
+ }
1080
+ toLocaleString(locales, options) {
1081
+ return Date.prototype.toLocaleString.call(this, locales, {
1082
+ ...options,
1083
+ timeZone: options?.timeZone || this.timeZone
1084
+ });
1085
+ }
1086
+ toLocaleDateString(locales, options) {
1087
+ return Date.prototype.toLocaleDateString.call(this, locales, {
1088
+ ...options,
1089
+ timeZone: options?.timeZone || this.timeZone
1090
+ });
1091
+ }
1092
+ toLocaleTimeString(locales, options) {
1093
+ return Date.prototype.toLocaleTimeString.call(this, locales, {
1094
+ ...options,
1095
+ timeZone: options?.timeZone || this.timeZone
1096
+ });
1097
+ }
1098
+ //#endregion
1099
+ //#region private
1100
+ tzComponents() {
1101
+ const offset = this.getTimezoneOffset();
1102
+ const sign = offset > 0 ? "-" : "+";
1103
+ const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
1104
+ const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
1105
+ return [
1106
+ sign,
1107
+ hours,
1108
+ minutes
1109
+ ];
1110
+ }
1111
+ //#endregion
1112
+ withTimeZone(timeZone) {
1113
+ return new TZDate(+this, timeZone);
1114
+ }
1115
+ //#region date-fns integration
1116
+ [Symbol.for("constructDateFrom")](date) {
1117
+ return new TZDate(+new Date(date), this.timeZone);
1118
+ }
1119
+ }
1120
+
1121
1121
  const FIVE_WEEKS = 5;
1122
1122
  const FOUR_WEEKS = 4;
1123
1123
  /**
@@ -4635,4 +4635,4 @@ function CalendarDayButton({ className, day, modifiers, ...props }) {
4635
4635
  }
4636
4636
 
4637
4637
  export { Calendar as C, CalendarDayButton as a, addMonths as b };
4638
- //# sourceMappingURL=calendar-BMfsKJ1l.mjs.map
4638
+ //# sourceMappingURL=calendar-DGNoWQgo.mjs.map