@vritti/quantum-ui 0.3.11 → 0.3.13

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 (484) hide show
  1. package/dist/Alert.js +1 -1
  2. package/dist/Alert.js.map +1 -1
  3. package/dist/Avatar.js +1 -1
  4. package/dist/Avatar.js.map +1 -1
  5. package/dist/Badge2.js +2 -2
  6. package/dist/BillingCycleSelector.js +37 -0
  7. package/dist/BillingCycleSelector.js.map +1 -0
  8. package/dist/Breadcrumb.js +1 -1
  9. package/dist/Breadcrumb.js.map +1 -1
  10. package/dist/Button.js +1 -1
  11. package/dist/Button.js.map +1 -1
  12. package/dist/Button2.js +2 -2
  13. package/dist/CardSkeleton.js.map +1 -1
  14. package/dist/CategoryFilter.js +6 -4
  15. package/dist/CategoryFilter.js.map +1 -1
  16. package/dist/Checkbox.js.map +1 -1
  17. package/dist/Checkbox2.js +4 -4
  18. package/dist/CheckboxGroup.js.map +1 -1
  19. package/dist/Collapsible.js.map +1 -1
  20. package/dist/Combination.js +1129 -0
  21. package/dist/Combination.js.map +1 -0
  22. package/dist/CompanySelector.js +20 -0
  23. package/dist/CompanySelector.js.map +1 -0
  24. package/dist/ConfirmHost.js.map +1 -1
  25. package/dist/CountrySelector.js +37 -0
  26. package/dist/CountrySelector.js.map +1 -0
  27. package/dist/CurrencyField.js +1 -0
  28. package/dist/CurrencyField.js.map +1 -1
  29. package/dist/CustomerSelector.js +2 -2
  30. package/dist/CustomerSelector.js.map +1 -1
  31. package/dist/DangerZoneSkeleton.js +21 -3
  32. package/dist/DangerZoneSkeleton.js.map +1 -1
  33. package/dist/DatePicker.js +3 -3
  34. package/dist/DatePicker.js.map +1 -1
  35. package/dist/DateTimePicker.js +2 -2
  36. package/dist/DetailSectionSkeleton.js.map +1 -1
  37. package/dist/Dialog.js.map +1 -1
  38. package/dist/DropdownMenu.js.map +1 -1
  39. package/dist/FeaturePermissionSelector.js +37 -0
  40. package/dist/FeaturePermissionSelector.js.map +1 -0
  41. package/dist/Form.js.map +1 -1
  42. package/dist/FormSection.js +4 -4
  43. package/dist/FormSection.js.map +1 -1
  44. package/dist/HierarchyGraph.js +5 -10621
  45. package/dist/HierarchyGraph.js.map +1 -1
  46. package/dist/ISOCountrySelect.js +283 -0
  47. package/dist/ISOCountrySelect.js.map +1 -0
  48. package/dist/IconSelect.js +1 -1
  49. package/dist/IconSelect.js.map +1 -1
  50. package/dist/InventoryItemSelector.js +2 -2
  51. package/dist/InventoryItemSelector.js.map +1 -1
  52. package/dist/Kbd.js +1 -1
  53. package/dist/Kbd.js.map +1 -1
  54. package/dist/Label.js +1 -1
  55. package/dist/LayoutModeContext.js.map +1 -1
  56. package/dist/LegalEntitySelector.js +37 -0
  57. package/dist/LegalEntitySelector.js.map +1 -0
  58. package/dist/LocationSelector.js +2 -2
  59. package/dist/LocationSelector.js.map +1 -1
  60. package/dist/LotSelector.js +2 -2
  61. package/dist/LotSelector.js.map +1 -1
  62. package/dist/OTPField.js.map +1 -1
  63. package/dist/PageContent.js.map +1 -1
  64. package/dist/PageHeaderSkeleton.js +21 -10
  65. package/dist/PageHeaderSkeleton.js.map +1 -1
  66. package/dist/PasswordField.js.map +1 -1
  67. package/dist/PermissionGate.js +49 -5
  68. package/dist/PermissionGate.js.map +1 -1
  69. package/dist/PersonSelector.js +20 -0
  70. package/dist/PersonSelector.js.map +1 -0
  71. package/dist/PhoneField.js.map +1 -1
  72. package/dist/PurchaseOrderSelector.js +2 -2
  73. package/dist/PurchaseOrderSelector.js.map +1 -1
  74. package/dist/QuantSelector.js +2 -2
  75. package/dist/QuantSelector.js.map +1 -1
  76. package/dist/RadioGroup.js +6 -6
  77. package/dist/RadioGroup.js.map +1 -1
  78. package/dist/RoleSelector.js +20 -0
  79. package/dist/RoleSelector.js.map +1 -0
  80. package/dist/Select.js +4 -1
  81. package/dist/Select.js.map +1 -1
  82. package/dist/SelectFilter.js.map +1 -1
  83. package/dist/Separator.js.map +1 -1
  84. package/dist/SerialSelector.js +2 -2
  85. package/dist/SerialSelector.js.map +1 -1
  86. package/dist/Sidebar.js +2 -2
  87. package/dist/Sidebar.js.map +1 -1
  88. package/dist/SingleSelect.js +2 -2
  89. package/dist/SingleSelect.js.map +1 -1
  90. package/dist/SiteGroupSelector.js +37 -0
  91. package/dist/SiteGroupSelector.js.map +1 -0
  92. package/dist/SiteSelector.js +37 -0
  93. package/dist/SiteSelector.js.map +1 -0
  94. package/dist/Sonner.js +1 -1
  95. package/dist/Sonner.js.map +1 -1
  96. package/dist/Sortable.js +4 -4417
  97. package/dist/Sortable.js.map +1 -1
  98. package/dist/StepProgressIndicator.js.map +1 -1
  99. package/dist/SupplierItemSelector.js +2 -2
  100. package/dist/SupplierItemSelector.js.map +1 -1
  101. package/dist/SupplierSelector.js +2 -2
  102. package/dist/SupplierSelector.js.map +1 -1
  103. package/dist/Switch.js +3 -3
  104. package/dist/Switch.js.map +1 -1
  105. package/dist/TabsSkeleton.js +101 -49
  106. package/dist/TabsSkeleton.js.map +1 -1
  107. package/dist/TaxClassSelector.js +20 -0
  108. package/dist/TaxClassSelector.js.map +1 -0
  109. package/dist/TextField.js.map +1 -1
  110. package/dist/ThemeContext.js.map +1 -1
  111. package/dist/ThemeToggle.js.map +1 -1
  112. package/dist/Toggle.js +1 -1
  113. package/dist/Toggle.js.map +1 -1
  114. package/dist/Tooltip.js.map +1 -1
  115. package/dist/Typography.js.map +1 -1
  116. package/dist/UomSelector.js +2 -2
  117. package/dist/UomSelector.js.map +1 -1
  118. package/dist/UploadFile.js.map +1 -1
  119. package/dist/assets/quantum-ui.css +25 -13
  120. package/dist/calendar2.js +1 -1
  121. package/dist/collapsible2.js +1 -1
  122. package/dist/components/CompanySelector.js +2 -0
  123. package/dist/components/CompanySelector.js.map +1 -0
  124. package/dist/components/FormattedDate.js +2 -2
  125. package/dist/components/HierarchyGraph.js +2 -1
  126. package/dist/components/HierarchyGraph.js.map +1 -1
  127. package/dist/components/PermissionGate.js +1 -1
  128. package/dist/components/PersonSelector.js +2 -0
  129. package/dist/components/PersonSelector.js.map +1 -0
  130. package/dist/components/ScanBarcodeButton.js.map +1 -1
  131. package/dist/components/TreeView.js +7 -7
  132. package/dist/components/TreeView.js.map +1 -1
  133. package/dist/core.esm.js +4025 -0
  134. package/dist/core.esm.js.map +1 -0
  135. package/dist/dropdown-menu.js +10 -10
  136. package/dist/field.js +1 -1
  137. package/dist/image-component.js.map +1 -1
  138. package/dist/index.js +15 -3
  139. package/dist/index.js.map +1 -1
  140. package/dist/index10.js +102 -1499
  141. package/dist/index10.js.map +1 -1
  142. package/dist/index11.js +1499 -37
  143. package/dist/index11.js.map +1 -1
  144. package/dist/index12.js +29 -477
  145. package/dist/index12.js.map +1 -1
  146. package/dist/index13.js +427 -231
  147. package/dist/index13.js.map +1 -1
  148. package/dist/index14.js +215 -1074
  149. package/dist/index14.js.map +1 -1
  150. package/dist/index15.js +1140 -14
  151. package/dist/index15.js.map +1 -1
  152. package/dist/index16.js +13 -19
  153. package/dist/index16.js.map +1 -1
  154. package/dist/index17.js +24 -172
  155. package/dist/index17.js.map +1 -1
  156. package/dist/index18.js +168 -175
  157. package/dist/index18.js.map +1 -1
  158. package/dist/index19.js +173 -201
  159. package/dist/index19.js.map +1 -1
  160. package/dist/index20.js +203 -69
  161. package/dist/index20.js.map +1 -1
  162. package/dist/index21.js +70 -211
  163. package/dist/index21.js.map +1 -1
  164. package/dist/index22.js +207 -117
  165. package/dist/index22.js.map +1 -1
  166. package/dist/index23.js +123 -71
  167. package/dist/index23.js.map +1 -1
  168. package/dist/index24.js +74 -11
  169. package/dist/index24.js.map +1 -1
  170. package/dist/index25.js +13 -1134
  171. package/dist/index25.js.map +1 -1
  172. package/dist/index26.js +1120 -219
  173. package/dist/index26.js.map +1 -1
  174. package/dist/index27.js +202 -2506
  175. package/dist/index27.js.map +1 -1
  176. package/dist/index28.js +2527 -23
  177. package/dist/index28.js.map +1 -1
  178. package/dist/index29.js +32 -4
  179. package/dist/index29.js.map +1 -1
  180. package/dist/index3.js +11543 -267
  181. package/dist/index3.js.map +1 -1
  182. package/dist/index30.js +3 -1124
  183. package/dist/index30.js.map +1 -1
  184. package/dist/index31.js +1 -1
  185. package/dist/index32.js +7 -7
  186. package/dist/index34.js +1 -1
  187. package/dist/index37.js +1 -1
  188. package/dist/index38.js +21 -42
  189. package/dist/index38.js.map +1 -1
  190. package/dist/index4.js +272 -132
  191. package/dist/index4.js.map +1 -1
  192. package/dist/index5.js +138 -388
  193. package/dist/index5.js.map +1 -1
  194. package/dist/index6.js +386 -7
  195. package/dist/index6.js.map +1 -1
  196. package/dist/index7.js +13 -92
  197. package/dist/index7.js.map +1 -1
  198. package/dist/index8.js +92 -43
  199. package/dist/index8.js.map +1 -1
  200. package/dist/index9.js +42 -102
  201. package/dist/index9.js.map +1 -1
  202. package/dist/lib/components/Alert/Alert.d.ts.map +1 -1
  203. package/dist/lib/components/Avatar/Avatar.d.ts.map +1 -1
  204. package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  205. package/dist/lib/components/Button/Button.d.ts.map +1 -1
  206. package/dist/lib/components/Card/CardSkeleton.d.ts.map +1 -1
  207. package/dist/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  208. package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
  209. package/dist/lib/components/Collapsible/Collapsible.d.ts.map +1 -1
  210. package/dist/lib/components/CompanySelector/CompanySelector.d.ts +4 -0
  211. package/dist/lib/components/CompanySelector/CompanySelector.d.ts.map +1 -0
  212. package/dist/lib/components/CompanySelector/index.d.ts +2 -0
  213. package/dist/lib/components/CompanySelector/index.d.ts.map +1 -0
  214. package/dist/lib/components/ConfirmHost/ConfirmHost.d.ts.map +1 -1
  215. package/dist/lib/components/CurrencyField/CurrencyField.d.ts.map +1 -1
  216. package/dist/lib/components/DangerZone/DangerZone.d.ts +3 -1
  217. package/dist/lib/components/DangerZone/DangerZone.d.ts.map +1 -1
  218. package/dist/lib/components/DataTable/CompactTableSkeleton.d.ts.map +1 -1
  219. package/dist/lib/components/DataTable/DataTable.d.ts +1 -1
  220. package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
  221. package/dist/lib/components/DataTable/cells/cells.d.ts.map +1 -1
  222. package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts +3 -1
  223. package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts.map +1 -1
  224. package/dist/lib/components/DataTable/components/RowActions.d.ts.map +1 -1
  225. package/dist/lib/components/DataTable/hooks/useDataTable.d.ts.map +1 -1
  226. package/dist/lib/components/DataTable/store/store.d.ts.map +1 -1
  227. package/dist/lib/components/DataTable/types.d.ts +3 -0
  228. package/dist/lib/components/DataTable/types.d.ts.map +1 -1
  229. package/dist/lib/components/DatePicker/DatePicker.d.ts +2 -2
  230. package/dist/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
  231. package/dist/lib/components/DetailField/DetailField.d.ts.map +1 -1
  232. package/dist/lib/components/DetailField/DetailHeader.d.ts.map +1 -1
  233. package/dist/lib/components/DetailField/DetailSectionSkeleton.d.ts.map +1 -1
  234. package/dist/lib/components/Dialog/Dialog.d.ts.map +1 -1
  235. package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  236. package/dist/lib/components/DropdownMenu/types.d.ts.map +1 -1
  237. package/dist/lib/components/Editor/editor-ui/color-picker.d.ts.map +1 -1
  238. package/dist/lib/components/Editor/editor-ui/image-component.d.ts.map +1 -1
  239. package/dist/lib/components/Editor/nodes/autocomplete-node.d.ts.map +1 -1
  240. package/dist/lib/components/Editor/plugins/actions/max-length-plugin.d.ts.map +1 -1
  241. package/dist/lib/components/Editor/plugins/embeds/auto-embed-plugin.d.ts.map +1 -1
  242. package/dist/lib/components/Editor/plugins/embeds/youtube-plugin.d.ts.map +1 -1
  243. package/dist/lib/components/Editor/plugins/emojis-plugin.d.ts.map +1 -1
  244. package/dist/lib/components/Editor/plugins/floating-link-editor-plugin.d.ts.map +1 -1
  245. package/dist/lib/components/Editor/plugins/floating-text-format-plugin.d.ts.map +1 -1
  246. package/dist/lib/components/Editor/plugins/images-plugin.d.ts.map +1 -1
  247. package/dist/lib/components/Editor/plugins/keywords-plugin.d.ts.map +1 -1
  248. package/dist/lib/components/Editor/plugins/layout-plugin.d.ts.map +1 -1
  249. package/dist/lib/components/Editor/plugins/list-max-indent-level-plugin.d.ts.map +1 -1
  250. package/dist/lib/components/Editor/plugins/mentions-plugin.d.ts.map +1 -1
  251. package/dist/lib/components/Editor/plugins/picker/component-picker-option.d.ts.map +1 -1
  252. package/dist/lib/components/Editor/plugins/tab-focus-plugin.d.ts.map +1 -1
  253. package/dist/lib/components/Editor/plugins/table-plugin.d.ts.map +1 -1
  254. package/dist/lib/components/Editor/plugins/toolbar/clear-formatting-toolbar-plugin.d.ts.map +1 -1
  255. package/dist/lib/components/Editor/plugins/typing-pref-plugin.d.ts.map +1 -1
  256. package/dist/lib/components/Editor/shared/invariant.d.ts.map +1 -1
  257. package/dist/lib/components/Editor/shared/react-patches.d.ts.map +1 -1
  258. package/dist/lib/components/Editor/shared/react-test-utils.d.ts.map +1 -1
  259. package/dist/lib/components/Editor/shared/simple-diff-with-cursor.d.ts.map +1 -1
  260. package/dist/lib/components/Editor/shared/use-layout-effect.d.ts.map +1 -1
  261. package/dist/lib/components/Editor/transformers/markdown-table-transformer.d.ts.map +1 -1
  262. package/dist/lib/components/Editor/utils/collapsible.d.ts.map +1 -1
  263. package/dist/lib/components/Editor/utils/doc-serialization.d.ts.map +1 -1
  264. package/dist/lib/components/Editor/utils/emoji-list.d.ts.map +1 -1
  265. package/dist/lib/components/Editor/utils/get-dom-range-rect.d.ts.map +1 -1
  266. package/dist/lib/components/Editor/utils/get-selected-node.d.ts.map +1 -1
  267. package/dist/lib/components/Editor/utils/guard.d.ts.map +1 -1
  268. package/dist/lib/components/Editor/utils/set-floating-elem-position-for-link-editor.d.ts.map +1 -1
  269. package/dist/lib/components/Editor/utils/set-floating-elem-position.d.ts.map +1 -1
  270. package/dist/lib/components/Editor/utils/swipe.d.ts.map +1 -1
  271. package/dist/lib/components/Editor/utils/url.d.ts.map +1 -1
  272. package/dist/lib/components/Form/Form.d.ts.map +1 -1
  273. package/dist/lib/components/OTPField/OTPField.d.ts.map +1 -1
  274. package/dist/lib/components/PageContent/PageContent.d.ts.map +1 -1
  275. package/dist/lib/components/PageHeader/PageHeader.d.ts.map +1 -1
  276. package/dist/lib/components/PasswordField/PasswordField.d.ts.map +1 -1
  277. package/dist/lib/components/PermissionGate/PermissionGate.d.ts +15 -4
  278. package/dist/lib/components/PermissionGate/PermissionGate.d.ts.map +1 -1
  279. package/dist/lib/components/PermissionGate/index.d.ts +1 -1
  280. package/dist/lib/components/PermissionGate/index.d.ts.map +1 -1
  281. package/dist/lib/components/PersonSelector/PersonSelector.d.ts +4 -0
  282. package/dist/lib/components/PersonSelector/PersonSelector.d.ts.map +1 -0
  283. package/dist/lib/components/PersonSelector/index.d.ts +2 -0
  284. package/dist/lib/components/PersonSelector/index.d.ts.map +1 -0
  285. package/dist/lib/components/PhoneField/PhoneField.d.ts.map +1 -1
  286. package/dist/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  287. package/dist/lib/components/ScanBarcodeButton/ScanBarcodeButton.d.ts.map +1 -1
  288. package/dist/lib/components/Select/SelectFilter.d.ts.map +1 -1
  289. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  290. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -1
  291. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -1
  292. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
  293. package/dist/lib/components/Select/hooks/useSelect.d.ts.map +1 -1
  294. package/dist/lib/components/Select/hooks/useSingleSelect.d.ts.map +1 -1
  295. package/dist/lib/components/Select/types.d.ts +1 -1
  296. package/dist/lib/components/Select/types.d.ts.map +1 -1
  297. package/dist/lib/components/Separator/Separator.d.ts.map +1 -1
  298. package/dist/lib/components/Sidebar/Sidebar.d.ts.map +1 -1
  299. package/dist/lib/components/Sonner/Sonner.d.ts.map +1 -1
  300. package/dist/lib/components/Sonner/toast.d.ts.map +1 -1
  301. package/dist/lib/components/StepProgressIndicator/StepProgressIndicator.d.ts.map +1 -1
  302. package/dist/lib/components/Switch/Switch.d.ts.map +1 -1
  303. package/dist/lib/components/Tabs/Tabs.d.ts +2 -0
  304. package/dist/lib/components/Tabs/Tabs.d.ts.map +1 -1
  305. package/dist/lib/components/Tabs/TabsSkeleton.d.ts.map +1 -1
  306. package/dist/lib/components/TextField/TextField.d.ts.map +1 -1
  307. package/dist/lib/components/ThemeToggle/ThemeToggle.d.ts.map +1 -1
  308. package/dist/lib/components/Toggle/Toggle.d.ts.map +1 -1
  309. package/dist/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  310. package/dist/lib/components/TreeView/TreeView.d.ts.map +1 -1
  311. package/dist/lib/components/Typography/Typography.d.ts.map +1 -1
  312. package/dist/lib/components/UploadFile/UploadFile.d.ts.map +1 -1
  313. package/dist/lib/components/index.d.ts +2 -0
  314. package/dist/lib/components/index.d.ts.map +1 -1
  315. package/dist/lib/config/index.d.ts.map +1 -1
  316. package/dist/lib/context/LayoutModeContext.d.ts.map +1 -1
  317. package/dist/lib/context/ThemeContext.d.ts.map +1 -1
  318. package/dist/lib/hooks/useBUCurrency.d.ts.map +1 -1
  319. package/dist/lib/hooks/useBUTimezone.d.ts.map +1 -1
  320. package/dist/lib/hooks/useBarcodeScanner.d.ts.map +1 -1
  321. package/dist/lib/hooks/useFormatters.d.ts.map +1 -1
  322. package/dist/lib/hooks/useSSE.d.ts.map +1 -1
  323. package/dist/lib/hooks/useTheme.d.ts.map +1 -1
  324. package/dist/lib/index.d.ts.map +1 -1
  325. package/dist/lib/selects/billing-cycle/BillingCycleFilter.d.ts +12 -0
  326. package/dist/lib/selects/billing-cycle/BillingCycleFilter.d.ts.map +1 -0
  327. package/dist/lib/selects/billing-cycle/BillingCycleSelector.d.ts +4 -0
  328. package/dist/lib/selects/billing-cycle/BillingCycleSelector.d.ts.map +1 -0
  329. package/dist/lib/selects/billing-cycle/index.d.ts +3 -0
  330. package/dist/lib/selects/billing-cycle/index.d.ts.map +1 -0
  331. package/dist/lib/selects/category/CategoryFilter.d.ts.map +1 -1
  332. package/dist/lib/selects/category/CategorySelector.d.ts.map +1 -1
  333. package/dist/lib/selects/cost-category/CostCategorySelector.d.ts.map +1 -1
  334. package/dist/lib/selects/country/CountryFilter.d.ts +12 -0
  335. package/dist/lib/selects/country/CountryFilter.d.ts.map +1 -0
  336. package/dist/lib/selects/country/CountrySelector.d.ts +4 -0
  337. package/dist/lib/selects/country/CountrySelector.d.ts.map +1 -0
  338. package/dist/lib/selects/country/index.d.ts +3 -0
  339. package/dist/lib/selects/country/index.d.ts.map +1 -0
  340. package/dist/lib/selects/feature-permission/FeaturePermissionFilter.d.ts +12 -0
  341. package/dist/lib/selects/feature-permission/FeaturePermissionFilter.d.ts.map +1 -0
  342. package/dist/lib/selects/feature-permission/FeaturePermissionSelector.d.ts +4 -0
  343. package/dist/lib/selects/feature-permission/FeaturePermissionSelector.d.ts.map +1 -0
  344. package/dist/lib/selects/feature-permission/index.d.ts +3 -0
  345. package/dist/lib/selects/feature-permission/index.d.ts.map +1 -0
  346. package/dist/lib/selects/icon/IconSelect.d.ts.map +1 -1
  347. package/dist/lib/selects/index.d.ts +9 -0
  348. package/dist/lib/selects/index.d.ts.map +1 -1
  349. package/dist/lib/selects/inventory-item/InventoryItemSelector.d.ts +2 -2
  350. package/dist/lib/selects/inventory-item/InventoryItemSelector.d.ts.map +1 -1
  351. package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts +15 -0
  352. package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts.map +1 -0
  353. package/dist/lib/selects/iso-country/index.d.ts +3 -0
  354. package/dist/lib/selects/iso-country/index.d.ts.map +1 -0
  355. package/dist/lib/selects/iso-country/iso-countries.d.ts +7 -0
  356. package/dist/lib/selects/iso-country/iso-countries.d.ts.map +1 -0
  357. package/dist/lib/selects/legal-entity/LegalEntityFilter.d.ts +12 -0
  358. package/dist/lib/selects/legal-entity/LegalEntityFilter.d.ts.map +1 -0
  359. package/dist/lib/selects/legal-entity/LegalEntitySelector.d.ts +4 -0
  360. package/dist/lib/selects/legal-entity/LegalEntitySelector.d.ts.map +1 -0
  361. package/dist/lib/selects/legal-entity/index.d.ts +3 -0
  362. package/dist/lib/selects/legal-entity/index.d.ts.map +1 -0
  363. package/dist/lib/selects/location/LocationSelector.d.ts.map +1 -1
  364. package/dist/lib/selects/purchase-order/PurchaseOrderSelector.d.ts.map +1 -1
  365. package/dist/lib/selects/purchase-order-item/PurchaseOrderItemSelector.d.ts.map +1 -1
  366. package/dist/lib/selects/role/RoleSelector.d.ts +4 -0
  367. package/dist/lib/selects/role/RoleSelector.d.ts.map +1 -0
  368. package/dist/lib/selects/role/index.d.ts +2 -0
  369. package/dist/lib/selects/role/index.d.ts.map +1 -0
  370. package/dist/lib/selects/serial/SerialSelector.d.ts.map +1 -1
  371. package/dist/lib/selects/site/SiteFilter.d.ts +12 -0
  372. package/dist/lib/selects/site/SiteFilter.d.ts.map +1 -0
  373. package/dist/lib/selects/site/SiteSelector.d.ts +4 -0
  374. package/dist/lib/selects/site/SiteSelector.d.ts.map +1 -0
  375. package/dist/lib/selects/site/index.d.ts +3 -0
  376. package/dist/lib/selects/site/index.d.ts.map +1 -0
  377. package/dist/lib/selects/site-group/SiteGroupFilter.d.ts +12 -0
  378. package/dist/lib/selects/site-group/SiteGroupFilter.d.ts.map +1 -0
  379. package/dist/lib/selects/site-group/SiteGroupSelector.d.ts +4 -0
  380. package/dist/lib/selects/site-group/SiteGroupSelector.d.ts.map +1 -0
  381. package/dist/lib/selects/site-group/index.d.ts +3 -0
  382. package/dist/lib/selects/site-group/index.d.ts.map +1 -0
  383. package/dist/lib/selects/supplier/SupplierSelector.d.ts.map +1 -1
  384. package/dist/lib/selects/supplier-item/SupplierItemFilter.d.ts.map +1 -1
  385. package/dist/lib/selects/supplier-item/SupplierItemSelector.d.ts.map +1 -1
  386. package/dist/lib/selects/tax-class/TaxClassSelector.d.ts +4 -0
  387. package/dist/lib/selects/tax-class/TaxClassSelector.d.ts.map +1 -0
  388. package/dist/lib/selects/tax-class/index.d.ts +2 -0
  389. package/dist/lib/selects/tax-class/index.d.ts.map +1 -0
  390. package/dist/lib/theme/index.d.ts.map +1 -1
  391. package/dist/lib/types/catalog-resolver.d.ts +222 -0
  392. package/dist/lib/types/catalog-resolver.d.ts.map +1 -0
  393. package/dist/lib/utils/axios.d.ts.map +1 -1
  394. package/dist/lib/utils/cn.d.ts +3 -0
  395. package/dist/lib/utils/cn.d.ts.map +1 -0
  396. package/dist/lib/utils/dagre.d.ts +2 -0
  397. package/dist/lib/utils/dagre.d.ts.map +1 -0
  398. package/dist/lib/utils/dnd-kit/core.d.ts +2 -0
  399. package/dist/lib/utils/dnd-kit/core.d.ts.map +1 -0
  400. package/dist/lib/utils/dnd-kit/sortable.d.ts +2 -0
  401. package/dist/lib/utils/dnd-kit/sortable.d.ts.map +1 -0
  402. package/dist/lib/utils/dnd-kit/utilities.d.ts +2 -0
  403. package/dist/lib/utils/dnd-kit/utilities.d.ts.map +1 -0
  404. package/dist/lib/utils/formHelpers.d.ts.map +1 -1
  405. package/dist/lib/utils/format.d.ts.map +1 -1
  406. package/dist/lib/utils/permission-deps.d.ts +9 -0
  407. package/dist/lib/utils/permission-deps.d.ts.map +1 -0
  408. package/dist/lib/utils/react-flow.d.ts +2 -0
  409. package/dist/lib/utils/react-flow.d.ts.map +1 -0
  410. package/dist/lib/utils/zod.d.ts +9 -0
  411. package/dist/lib/utils/zod.d.ts.map +1 -1
  412. package/dist/popover.js +1 -1
  413. package/dist/select2.js +1 -1
  414. package/dist/selects/billing-cycle.js +2 -0
  415. package/dist/selects/billing-cycle.js.map +1 -0
  416. package/dist/selects/cost-category.js +2 -2
  417. package/dist/selects/cost-category.js.map +1 -1
  418. package/dist/selects/country.js +2 -0
  419. package/dist/selects/country.js.map +1 -0
  420. package/dist/selects/feature-permission.js +2 -0
  421. package/dist/selects/feature-permission.js.map +1 -0
  422. package/dist/selects/iso-country.js +2 -0
  423. package/dist/selects/iso-country.js.map +1 -0
  424. package/dist/selects/legal-entity.js +2 -0
  425. package/dist/selects/legal-entity.js.map +1 -0
  426. package/dist/selects/purchase-order-item.js +1 -1
  427. package/dist/selects/purchase-order-item.js.map +1 -1
  428. package/dist/selects/role.js +2 -0
  429. package/dist/selects/role.js.map +1 -0
  430. package/dist/selects/site-group.js +2 -0
  431. package/dist/selects/site-group.js.map +1 -0
  432. package/dist/selects/site.js +2 -0
  433. package/dist/selects/site.js.map +1 -0
  434. package/dist/selects/tax-class.js +2 -0
  435. package/dist/selects/tax-class.js.map +1 -0
  436. package/dist/selects/tax-group.js +2 -2
  437. package/dist/selects/tax-group.js.map +1 -1
  438. package/dist/separator2.js +1 -1
  439. package/dist/sortable.esm.js +780 -0
  440. package/dist/sortable.esm.js.map +1 -0
  441. package/dist/theme/index.js.map +1 -1
  442. package/dist/toast.js +2 -26
  443. package/dist/toast.js.map +1 -1
  444. package/dist/tooltip2.js +1 -1
  445. package/dist/types/api-response.js +2 -0
  446. package/dist/types/api-response.js.map +1 -0
  447. package/dist/types/catalog-resolver.js +8 -0
  448. package/dist/types/catalog-resolver.js.map +1 -0
  449. package/dist/types/table-filter.js +17 -0
  450. package/dist/types/table-filter.js.map +1 -0
  451. package/dist/useBUTimezone.js.map +1 -1
  452. package/dist/useDataTable.js +152 -119
  453. package/dist/useDataTable.js.map +1 -1
  454. package/dist/useFormatters.js.map +1 -1
  455. package/dist/useTheme.js.map +1 -1
  456. package/dist/useTimer.js +2 -2
  457. package/dist/useTimer.js.map +1 -1
  458. package/dist/utilities.esm.js +333 -0
  459. package/dist/utilities.esm.js.map +1 -0
  460. package/dist/utils/axios.js +1 -1
  461. package/dist/utils/axios.js.map +1 -1
  462. package/dist/utils/cn.js +6 -0
  463. package/dist/utils/cn.js.map +1 -0
  464. package/dist/utils/currency.js +2 -2
  465. package/dist/utils/dagre.js +4 -0
  466. package/dist/utils/dagre.js.map +1 -0
  467. package/dist/utils/dnd-kit/core.js +2 -0
  468. package/dist/utils/dnd-kit/core.js.map +1 -0
  469. package/dist/utils/dnd-kit/sortable.js +2 -0
  470. package/dist/utils/dnd-kit/sortable.js.map +1 -0
  471. package/dist/utils/dnd-kit/utilities.js +2 -0
  472. package/dist/utils/dnd-kit/utilities.js.map +1 -0
  473. package/dist/utils/format.js +2 -2
  474. package/dist/utils/format.js.map +1 -1
  475. package/dist/utils/hotkeys.js +1 -1
  476. package/dist/utils/money.js +1 -1
  477. package/dist/utils/permission-deps.js +64 -0
  478. package/dist/utils/permission-deps.js.map +1 -0
  479. package/dist/utils/react-flow.js +2 -0
  480. package/dist/utils/react-flow.js.map +1 -0
  481. package/dist/utils/timezone.js +1 -1
  482. package/dist/utils/zod.js +11 -1
  483. package/dist/utils/zod.js.map +1 -1
  484. package/package.json +79 -3
package/dist/index6.js CHANGED
@@ -1,15 +1,394 @@
1
- import { T as TZDate } from './index5.js';
1
+ /**
2
+ * Time zone name format.
3
+ */
4
+
5
+ /**
6
+ * The function returns the time zone name for the given date in the specified
7
+ * time zone.
8
+ *
9
+ * It uses the `Intl.DateTimeFormat` API and by default outputs the time zone
10
+ * name in a long format, e.g. "Pacific Standard Time" or
11
+ * "Singapore Standard Time".
12
+ *
13
+ * It is possible to specify the format as the third argument using one of the following options
14
+ *
15
+ * - "short": e.g. "EDT" or "GMT+8".
16
+ * - "long": e.g. "Eastern Daylight Time".
17
+ * - "shortGeneric": e.g. "ET" or "Singapore Time".
18
+ * - "longGeneric": e.g. "Eastern Time" or "Singapore Standard Time".
19
+ *
20
+ * These options correspond to TR35 tokens `z..zzz`, `zzzz`, `v`, and `vvvv` respectively: https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone
21
+ *
22
+ * @param timeZone - Time zone name (IANA or UTC offset)
23
+ * @param date - Date object to get the time zone name for
24
+ * @param format - Optional format of the time zone name. Defaults to "long". Can be "short", "long", "shortGeneric", or "longGeneric".
25
+ *
26
+ * @returns Time zone name (e.g. "Singapore Standard Time")
27
+ */
28
+ function tzName(timeZone, date, format = "long") {
29
+ return new Intl.DateTimeFormat("en-US", {
30
+ // Enforces engine to render the time. Without the option JavaScriptCore omits it.
31
+ hour: "numeric",
32
+ timeZone: timeZone,
33
+ timeZoneName: format
34
+ }).format(date).split(/\s/g) // Format.JS uses non-breaking spaces
35
+ .slice(2) // Skip the hour and AM/PM parts
36
+ .join(" ");
37
+ }
38
+
39
+ const offsetFormatCache = {};
40
+ const offsetCache = {};
2
41
 
3
42
  /**
4
- * The function creates accepts a time zone and returns a function that creates
5
- * a new `TZDate` instance in the time zone from the provided value. Use it to
6
- * provide the context for the date-fns functions, via the `in` option.
43
+ * The function extracts UTC offset in minutes from the given date in specified
44
+ * time zone.
45
+ *
46
+ * Unlike `Date.prototype.getTimezoneOffset`, this function returns the value
47
+ * mirrored to the sign of the offset in the time zone. For Asia/Singapore
48
+ * (UTC+8), `tzOffset` returns 480, while `getTimezoneOffset` returns -480.
7
49
  *
8
50
  * @param timeZone - Time zone name (IANA or UTC offset)
51
+ * @param date - Date to check the offset for
52
+ *
53
+ * @returns UTC offset in minutes
54
+ */
55
+ function tzOffset(timeZone, date) {
56
+ try {
57
+ const format = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
58
+ timeZone,
59
+ timeZoneName: "longOffset"
60
+ }).format;
61
+ const offsetStr = format(date).split("GMT")[1];
62
+ if (offsetStr in offsetCache) return offsetCache[offsetStr];
63
+ return calcOffset(offsetStr, offsetStr.split(":"));
64
+ } catch {
65
+ // Fallback to manual parsing if the runtime doesn't support ±HH:MM/±HHMM/±HH
66
+ // See: https://github.com/nodejs/node/issues/53419
67
+ if (timeZone in offsetCache) return offsetCache[timeZone];
68
+ const captures = timeZone?.match(offsetRe);
69
+ if (captures) return calcOffset(timeZone, captures.slice(1));
70
+ return NaN;
71
+ }
72
+ }
73
+ const offsetRe = /([+-]\d\d):?(\d\d)?/;
74
+ function calcOffset(cacheStr, values) {
75
+ const hours = +(values[0] || 0);
76
+ const minutes = +(values[1] || 0);
77
+ // Convert seconds to minutes by dividing by 60 to keep the function return in minutes.
78
+ const seconds = +(values[2] || 0) / 60;
79
+ return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
80
+ }
81
+
82
+ class TZDateMini extends Date {
83
+ //#region static
84
+
85
+ constructor(...args) {
86
+ super();
87
+ if (args.length > 1 && typeof args[args.length - 1] === "string") {
88
+ this.timeZone = args.pop();
89
+ }
90
+ this.internal = new Date();
91
+ if (isNaN(tzOffset(this.timeZone, this))) {
92
+ this.setTime(NaN);
93
+ } else {
94
+ if (!args.length) {
95
+ this.setTime(Date.now());
96
+ } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
97
+ this.setTime(args[0]);
98
+ } else if (typeof args[0] === "string") {
99
+ this.setTime(+new Date(args[0]));
100
+ } else if (args[0] instanceof Date) {
101
+ this.setTime(+args[0]);
102
+ } else {
103
+ this.setTime(+new Date(...args));
104
+ adjustToSystemTZ(this);
105
+ syncToInternal(this);
106
+ }
107
+ }
108
+ }
109
+ static tz(tz, ...args) {
110
+ return args.length ? new TZDateMini(...args, tz) : new TZDateMini(Date.now(), tz);
111
+ }
112
+
113
+ //#endregion
114
+
115
+ //#region time zone
116
+
117
+ withTimeZone(timeZone) {
118
+ return new TZDateMini(+this, timeZone);
119
+ }
120
+ getTimezoneOffset() {
121
+ const offset = -tzOffset(this.timeZone, this);
122
+ // Remove the seconds offset
123
+ // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
124
+ return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
125
+ }
126
+
127
+ //#endregion
128
+
129
+ //#region time
130
+
131
+ setTime(time) {
132
+ Date.prototype.setTime.apply(this, arguments);
133
+ syncToInternal(this);
134
+ return +this;
135
+ }
136
+
137
+ //#endregion
138
+
139
+ //#region date-fns integration
140
+
141
+ [Symbol.for("constructDateFrom")](date) {
142
+ return new TZDateMini(+new Date(date), this.timeZone);
143
+ }
144
+
145
+ //#endregion
146
+ }
147
+
148
+ // Assign getters and setters
149
+ const re = /^(get|set)(?!UTC)/;
150
+ Object.getOwnPropertyNames(Date.prototype).forEach(method => {
151
+ if (!re.test(method)) return;
152
+ const utcMethod = method.replace(re, "$1UTC");
153
+ // Filter out methods without UTC counterparts
154
+ if (!TZDateMini.prototype[utcMethod]) return;
155
+ if (method.startsWith("get")) {
156
+ // Delegate to internal date's UTC method
157
+ TZDateMini.prototype[method] = function () {
158
+ return this.internal[utcMethod]();
159
+ };
160
+ } else {
161
+ // Assign regular setter
162
+ TZDateMini.prototype[method] = function () {
163
+ Date.prototype[utcMethod].apply(this.internal, arguments);
164
+ syncFromInternal(this);
165
+ return +this;
166
+ };
167
+
168
+ // Assign UTC setter
169
+ TZDateMini.prototype[utcMethod] = function () {
170
+ Date.prototype[utcMethod].apply(this, arguments);
171
+ syncToInternal(this);
172
+ return +this;
173
+ };
174
+ }
175
+ });
176
+
177
+ /**
178
+ * Function syncs time to internal date, applying the time zone offset.
179
+ *
180
+ * @param {Date} date - Date to sync
181
+ */
182
+ function syncToInternal(date) {
183
+ date.internal.setTime(+date);
184
+ date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
185
+ }
186
+
187
+ /**
188
+ * Function syncs the internal date UTC values to the date. It allows to get
189
+ * accurate timestamp value.
9
190
  *
10
- * @returns Function that creates a new `TZDate` instance in the time zone
191
+ * @param {Date} date - The date to sync
11
192
  */
12
- const tz = timeZone => value => TZDate.tz(timeZone, +new Date(value));
193
+ function syncFromInternal(date) {
194
+ // First we transpose the internal values
195
+ Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
196
+ Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
197
+
198
+ // Now we have to adjust the date to the system time zone
199
+ adjustToSystemTZ(date);
200
+ }
201
+
202
+ /**
203
+ * Function adjusts the date to the system time zone. It uses the time zone
204
+ * differences to calculate the offset and adjust the date.
205
+ *
206
+ * @param {Date} date - Date to adjust
207
+ */
208
+ function adjustToSystemTZ(date) {
209
+ // Save the time zone offset before all the adjustments
210
+ const baseOffset = tzOffset(date.timeZone, date);
211
+ // Remove the seconds offset
212
+ // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
213
+ const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);
214
+ //#region System DST adjustment
215
+
216
+ // The biggest problem with using the system time zone is that when we create
217
+ // a date from internal values stored in UTC, the system time zone might end
218
+ // up on the DST hour:
219
+ //
220
+ // $ TZ=America/New_York node
221
+ // > new Date(2020, 2, 8, 1).toString()
222
+ // 'Sun Mar 08 2020 01:00:00 GMT-0500 (Eastern Standard Time)'
223
+ // > new Date(2020, 2, 8, 2).toString()
224
+ // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
225
+ // > new Date(2020, 2, 8, 3).toString()
226
+ // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
227
+ // > new Date(2020, 2, 8, 4).toString()
228
+ // 'Sun Mar 08 2020 04:00:00 GMT-0400 (Eastern Daylight Time)'
229
+ //
230
+ // Here we get the same hour for both 2 and 3, because the system time zone
231
+ // has DST beginning at 8 March 2020, 2 a.m. and jumps to 3 a.m. So we have
232
+ // to adjust the internal date to reflect that.
233
+ //
234
+ // However we want to adjust only if that's the DST hour the change happenes,
235
+ // not the hour where DST moves to.
236
+
237
+ // We calculate the previous hour to see if the time zone offset has changed
238
+ // and we have landed on the DST hour.
239
+ const prevHour = new Date(+date);
240
+ // We use UTC methods here as we don't want to land on the same hour again
241
+ // in case of DST.
242
+ prevHour.setUTCHours(prevHour.getUTCHours() - 1);
243
+
244
+ // Calculate if we are on the system DST hour.
245
+ const systemOffset = -new Date(+date).getTimezoneOffset();
246
+ const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();
247
+ const systemDSTChange = systemOffset - prevHourSystemOffset;
248
+ // Detect the DST shift. System DST change will occur both on
249
+ const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
250
+
251
+ // Move the internal date when we are on the system DST hour.
252
+ if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
253
+
254
+ //#endregion
255
+
256
+ //#region System diff adjustment
257
+
258
+ // Now we need to adjust the date, since we just applied internal values.
259
+ // We need to calculate the difference between the system and date time zones
260
+ // and apply it to the date.
261
+
262
+ const offsetDiff = systemOffset - offset;
263
+ if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
264
+
265
+ //#endregion
266
+
267
+ //#region Seconds System diff adjustment
268
+
269
+ const systemDate = new Date(+date);
270
+ // Set the UTC seconds to 0 to isolate the timezone offset in seconds.
271
+ systemDate.setUTCSeconds(0);
272
+ // For negative systemOffset, invert the seconds.
273
+ const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
274
+
275
+ // Calculate the seconds offset based on the timezone offset.
276
+ const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
277
+ if (secondsOffset || systemSecondsOffset) {
278
+ date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
279
+ Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
280
+ }
281
+
282
+ //#endregion
283
+
284
+ //#region Post-adjustment DST fix
285
+
286
+ const postBaseOffset = tzOffset(date.timeZone, date);
287
+ // Remove the seconds offset
288
+ // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
289
+ const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
290
+ const postSystemOffset = -new Date(+date).getTimezoneOffset();
291
+ const postOffsetDiff = postSystemOffset - postOffset;
292
+ const offsetChanged = postOffset !== offset;
293
+ const postDiff = postOffsetDiff - offsetDiff;
294
+ if (offsetChanged && postDiff) {
295
+ Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
296
+
297
+ // Now we need to check if got offset change during the post-adjustment.
298
+ // If so, we also need both dates to reflect that.
299
+
300
+ const newBaseOffset = tzOffset(date.timeZone, date);
301
+ // Remove the seconds offset
302
+ // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
303
+ const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
304
+ const offsetChange = postOffset - newOffset;
305
+ if (offsetChange) {
306
+ date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
307
+ Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
308
+ }
309
+ }
310
+
311
+ //#endregion
312
+ }
313
+
314
+ class TZDate extends TZDateMini {
315
+ //#region static
316
+
317
+ static tz(tz, ...args) {
318
+ return args.length ? new TZDate(...args, tz) : new TZDate(Date.now(), tz);
319
+ }
320
+
321
+ //#endregion
322
+
323
+ //#region representation
324
+
325
+ toISOString() {
326
+ const [sign, hours, minutes] = this.tzComponents();
327
+ const tz = `${sign}${hours}:${minutes}`;
328
+ return this.internal.toISOString().slice(0, -1) + tz;
329
+ }
330
+ toString() {
331
+ // "Tue Aug 13 2024 07:50:19 GMT+0800 (Singapore Standard Time)";
332
+ return `${this.toDateString()} ${this.toTimeString()}`;
333
+ }
334
+ toDateString() {
335
+ // toUTCString returns RFC 7231 ("Mon, 12 Aug 2024 23:36:08 GMT")
336
+ const [day, date, month, year] = this.internal.toUTCString().split(" ");
337
+ // "Tue Aug 13 2024"
338
+ return `${day?.slice(0, -1) /* Remove "," */} ${month} ${date} ${year}`;
339
+ }
340
+ toTimeString() {
341
+ // toUTCString returns RFC 7231 ("Mon, 12 Aug 2024 23:36:08 GMT")
342
+ const time = this.internal.toUTCString().split(" ")[4];
343
+ const [sign, hours, minutes] = this.tzComponents();
344
+ // "07:42:23 GMT+0800 (Singapore Standard Time)"
345
+ return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
346
+ }
347
+ toLocaleString(locales, options) {
348
+ return Date.prototype.toLocaleString.call(this, locales, {
349
+ ...options,
350
+ timeZone: options?.timeZone || this.timeZone
351
+ });
352
+ }
353
+ toLocaleDateString(locales, options) {
354
+ return Date.prototype.toLocaleDateString.call(this, locales, {
355
+ ...options,
356
+ timeZone: options?.timeZone || this.timeZone
357
+ });
358
+ }
359
+ toLocaleTimeString(locales, options) {
360
+ return Date.prototype.toLocaleTimeString.call(this, locales, {
361
+ ...options,
362
+ timeZone: options?.timeZone || this.timeZone
363
+ });
364
+ }
365
+
366
+ //#endregion
367
+
368
+ //#region private
369
+
370
+ tzComponents() {
371
+ const offset = this.getTimezoneOffset();
372
+ const sign = offset > 0 ? "-" : "+";
373
+ const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
374
+ const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
375
+ return [sign, hours, minutes];
376
+ }
377
+
378
+ //#endregion
379
+
380
+ withTimeZone(timeZone) {
381
+ return new TZDate(+this, timeZone);
382
+ }
383
+
384
+ //#region date-fns integration
385
+
386
+ [Symbol.for("constructDateFrom")](date) {
387
+ return new TZDate(+new Date(date), this.timeZone);
388
+ }
389
+
390
+ //#endregion
391
+ }
13
392
 
14
- export { tz as t };
393
+ export { TZDate as T };
15
394
  //# sourceMappingURL=index6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index6.js","sources":["../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tz/index.js"],"sourcesContent":["import { TZDate } from \"../date/index.js\";\n\n/**\n * The function creates accepts a time zone and returns a function that creates\n * a new `TZDate` instance in the time zone from the provided value. Use it to\n * provide the context for the date-fns functions, via the `in` option.\n *\n * @param timeZone - Time zone name (IANA or UTC offset)\n *\n * @returns Function that creates a new `TZDate` instance in the time zone\n */\nexport const tz = timeZone => value => TZDate.tz(timeZone, +new Date(value));"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,EAAE,GAAG,QAAQ,IAAI,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index6.js","sources":["../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzName/index.js","../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzOffset/index.js","../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/mini.js","../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/index.js"],"sourcesContent":["/**\n * Time zone name format.\n */\n\n/**\n * The function returns the time zone name for the given date in the specified\n * time zone.\n *\n * It uses the `Intl.DateTimeFormat` API and by default outputs the time zone\n * name in a long format, e.g. \"Pacific Standard Time\" or\n * \"Singapore Standard Time\".\n *\n * It is possible to specify the format as the third argument using one of the following options\n *\n * - \"short\": e.g. \"EDT\" or \"GMT+8\".\n * - \"long\": e.g. \"Eastern Daylight Time\".\n * - \"shortGeneric\": e.g. \"ET\" or \"Singapore Time\".\n * - \"longGeneric\": e.g. \"Eastern Time\" or \"Singapore Standard Time\".\n *\n * These options correspond to TR35 tokens `z..zzz`, `zzzz`, `v`, and `vvvv` respectively: https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone\n *\n * @param timeZone - Time zone name (IANA or UTC offset)\n * @param date - Date object to get the time zone name for\n * @param format - Optional format of the time zone name. Defaults to \"long\". Can be \"short\", \"long\", \"shortGeneric\", or \"longGeneric\".\n *\n * @returns Time zone name (e.g. \"Singapore Standard Time\")\n */\nexport function tzName(timeZone, date, format = \"long\") {\n return new Intl.DateTimeFormat(\"en-US\", {\n // Enforces engine to render the time. Without the option JavaScriptCore omits it.\n hour: \"numeric\",\n timeZone: timeZone,\n timeZoneName: format\n }).format(date).split(/\\s/g) // Format.JS uses non-breaking spaces\n .slice(2) // Skip the hour and AM/PM parts\n .join(\" \");\n}","const offsetFormatCache = {};\nconst offsetCache = {};\n\n/**\n * The function extracts UTC offset in minutes from the given date in specified\n * time zone.\n *\n * Unlike `Date.prototype.getTimezoneOffset`, this function returns the value\n * mirrored to the sign of the offset in the time zone. For Asia/Singapore\n * (UTC+8), `tzOffset` returns 480, while `getTimezoneOffset` returns -480.\n *\n * @param timeZone - Time zone name (IANA or UTC offset)\n * @param date - Date to check the offset for\n *\n * @returns UTC offset in minutes\n */\nexport function tzOffset(timeZone, date) {\n try {\n const format = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat(\"en-US\", {\n timeZone,\n timeZoneName: \"longOffset\"\n }).format;\n const offsetStr = format(date).split(\"GMT\")[1];\n if (offsetStr in offsetCache) return offsetCache[offsetStr];\n return calcOffset(offsetStr, offsetStr.split(\":\"));\n } catch {\n // Fallback to manual parsing if the runtime doesn't support ±HH:MM/±HHMM/±HH\n // See: https://github.com/nodejs/node/issues/53419\n if (timeZone in offsetCache) return offsetCache[timeZone];\n const captures = timeZone?.match(offsetRe);\n if (captures) return calcOffset(timeZone, captures.slice(1));\n return NaN;\n }\n}\nconst offsetRe = /([+-]\\d\\d):?(\\d\\d)?/;\nfunction calcOffset(cacheStr, values) {\n const hours = +(values[0] || 0);\n const minutes = +(values[1] || 0);\n // Convert seconds to minutes by dividing by 60 to keep the function return in minutes.\n const seconds = +(values[2] || 0) / 60;\n return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;\n}","import { tzOffset } from \"../tzOffset/index.js\";\nexport class TZDateMini extends Date {\n //#region static\n\n constructor(...args) {\n super();\n if (args.length > 1 && typeof args[args.length - 1] === \"string\") {\n this.timeZone = args.pop();\n }\n this.internal = new Date();\n if (isNaN(tzOffset(this.timeZone, this))) {\n this.setTime(NaN);\n } else {\n if (!args.length) {\n this.setTime(Date.now());\n } else if (typeof args[0] === \"number\" && (args.length === 1 || args.length === 2 && typeof args[1] !== \"number\")) {\n this.setTime(args[0]);\n } else if (typeof args[0] === \"string\") {\n this.setTime(+new Date(args[0]));\n } else if (args[0] instanceof Date) {\n this.setTime(+args[0]);\n } else {\n this.setTime(+new Date(...args));\n adjustToSystemTZ(this, NaN);\n syncToInternal(this);\n }\n }\n }\n static tz(tz, ...args) {\n return args.length ? new TZDateMini(...args, tz) : new TZDateMini(Date.now(), tz);\n }\n\n //#endregion\n\n //#region time zone\n\n withTimeZone(timeZone) {\n return new TZDateMini(+this, timeZone);\n }\n getTimezoneOffset() {\n const offset = -tzOffset(this.timeZone, this);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n return offset > 0 ? Math.floor(offset) : Math.ceil(offset);\n }\n\n //#endregion\n\n //#region time\n\n setTime(time) {\n Date.prototype.setTime.apply(this, arguments);\n syncToInternal(this);\n return +this;\n }\n\n //#endregion\n\n //#region date-fns integration\n\n [Symbol.for(\"constructDateFrom\")](date) {\n return new TZDateMini(+new Date(date), this.timeZone);\n }\n\n //#endregion\n}\n\n// Assign getters and setters\nconst re = /^(get|set)(?!UTC)/;\nObject.getOwnPropertyNames(Date.prototype).forEach(method => {\n if (!re.test(method)) return;\n const utcMethod = method.replace(re, \"$1UTC\");\n // Filter out methods without UTC counterparts\n if (!TZDateMini.prototype[utcMethod]) return;\n if (method.startsWith(\"get\")) {\n // Delegate to internal date's UTC method\n TZDateMini.prototype[method] = function () {\n return this.internal[utcMethod]();\n };\n } else {\n // Assign regular setter\n TZDateMini.prototype[method] = function () {\n Date.prototype[utcMethod].apply(this.internal, arguments);\n syncFromInternal(this);\n return +this;\n };\n\n // Assign UTC setter\n TZDateMini.prototype[utcMethod] = function () {\n Date.prototype[utcMethod].apply(this, arguments);\n syncToInternal(this);\n return +this;\n };\n }\n});\n\n/**\n * Function syncs time to internal date, applying the time zone offset.\n *\n * @param {Date} date - Date to sync\n */\nfunction syncToInternal(date) {\n date.internal.setTime(+date);\n date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));\n}\n\n/**\n * Function syncs the internal date UTC values to the date. It allows to get\n * accurate timestamp value.\n *\n * @param {Date} date - The date to sync\n */\nfunction syncFromInternal(date) {\n // First we transpose the internal values\n Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());\n Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());\n\n // Now we have to adjust the date to the system time zone\n adjustToSystemTZ(date);\n}\n\n/**\n * Function adjusts the date to the system time zone. It uses the time zone\n * differences to calculate the offset and adjust the date.\n *\n * @param {Date} date - Date to adjust\n */\nfunction adjustToSystemTZ(date) {\n // Save the time zone offset before all the adjustments\n const baseOffset = tzOffset(date.timeZone, date);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);\n //#region System DST adjustment\n\n // The biggest problem with using the system time zone is that when we create\n // a date from internal values stored in UTC, the system time zone might end\n // up on the DST hour:\n //\n // $ TZ=America/New_York node\n // > new Date(2020, 2, 8, 1).toString()\n // 'Sun Mar 08 2020 01:00:00 GMT-0500 (Eastern Standard Time)'\n // > new Date(2020, 2, 8, 2).toString()\n // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'\n // > new Date(2020, 2, 8, 3).toString()\n // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'\n // > new Date(2020, 2, 8, 4).toString()\n // 'Sun Mar 08 2020 04:00:00 GMT-0400 (Eastern Daylight Time)'\n //\n // Here we get the same hour for both 2 and 3, because the system time zone\n // has DST beginning at 8 March 2020, 2 a.m. and jumps to 3 a.m. So we have\n // to adjust the internal date to reflect that.\n //\n // However we want to adjust only if that's the DST hour the change happenes,\n // not the hour where DST moves to.\n\n // We calculate the previous hour to see if the time zone offset has changed\n // and we have landed on the DST hour.\n const prevHour = new Date(+date);\n // We use UTC methods here as we don't want to land on the same hour again\n // in case of DST.\n prevHour.setUTCHours(prevHour.getUTCHours() - 1);\n\n // Calculate if we are on the system DST hour.\n const systemOffset = -new Date(+date).getTimezoneOffset();\n const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();\n const systemDSTChange = systemOffset - prevHourSystemOffset;\n // Detect the DST shift. System DST change will occur both on\n const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();\n\n // Move the internal date when we are on the system DST hour.\n if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);\n\n //#endregion\n\n //#region System diff adjustment\n\n // Now we need to adjust the date, since we just applied internal values.\n // We need to calculate the difference between the system and date time zones\n // and apply it to the date.\n\n const offsetDiff = systemOffset - offset;\n if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);\n\n //#endregion\n\n //#region Seconds System diff adjustment\n\n const systemDate = new Date(+date);\n // Set the UTC seconds to 0 to isolate the timezone offset in seconds.\n systemDate.setUTCSeconds(0);\n // For negative systemOffset, invert the seconds.\n const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;\n\n // Calculate the seconds offset based on the timezone offset.\n const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;\n if (secondsOffset || systemSecondsOffset) {\n date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);\n Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);\n }\n\n //#endregion\n\n //#region Post-adjustment DST fix\n\n const postBaseOffset = tzOffset(date.timeZone, date);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);\n const postSystemOffset = -new Date(+date).getTimezoneOffset();\n const postOffsetDiff = postSystemOffset - postOffset;\n const offsetChanged = postOffset !== offset;\n const postDiff = postOffsetDiff - offsetDiff;\n if (offsetChanged && postDiff) {\n Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);\n\n // Now we need to check if got offset change during the post-adjustment.\n // If so, we also need both dates to reflect that.\n\n const newBaseOffset = tzOffset(date.timeZone, date);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);\n const offsetChange = postOffset - newOffset;\n if (offsetChange) {\n date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);\n Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);\n }\n }\n\n //#endregion\n}","import { tzName } from \"../tzName/index.js\";\nimport { TZDateMini } from \"./mini.js\";\nexport class TZDate extends TZDateMini {\n //#region static\n\n static tz(tz, ...args) {\n return args.length ? new TZDate(...args, tz) : new TZDate(Date.now(), tz);\n }\n\n //#endregion\n\n //#region representation\n\n toISOString() {\n const [sign, hours, minutes] = this.tzComponents();\n const tz = `${sign}${hours}:${minutes}`;\n return this.internal.toISOString().slice(0, -1) + tz;\n }\n toString() {\n // \"Tue Aug 13 2024 07:50:19 GMT+0800 (Singapore Standard Time)\";\n return `${this.toDateString()} ${this.toTimeString()}`;\n }\n toDateString() {\n // toUTCString returns RFC 7231 (\"Mon, 12 Aug 2024 23:36:08 GMT\")\n const [day, date, month, year] = this.internal.toUTCString().split(\" \");\n // \"Tue Aug 13 2024\"\n return `${day?.slice(0, -1) /* Remove \",\" */} ${month} ${date} ${year}`;\n }\n toTimeString() {\n // toUTCString returns RFC 7231 (\"Mon, 12 Aug 2024 23:36:08 GMT\")\n const time = this.internal.toUTCString().split(\" \")[4];\n const [sign, hours, minutes] = this.tzComponents();\n // \"07:42:23 GMT+0800 (Singapore Standard Time)\"\n return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;\n }\n toLocaleString(locales, options) {\n return Date.prototype.toLocaleString.call(this, locales, {\n ...options,\n timeZone: options?.timeZone || this.timeZone\n });\n }\n toLocaleDateString(locales, options) {\n return Date.prototype.toLocaleDateString.call(this, locales, {\n ...options,\n timeZone: options?.timeZone || this.timeZone\n });\n }\n toLocaleTimeString(locales, options) {\n return Date.prototype.toLocaleTimeString.call(this, locales, {\n ...options,\n timeZone: options?.timeZone || this.timeZone\n });\n }\n\n //#endregion\n\n //#region private\n\n tzComponents() {\n const offset = this.getTimezoneOffset();\n const sign = offset > 0 ? \"-\" : \"+\";\n const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, \"0\");\n const minutes = String(Math.abs(offset) % 60).padStart(2, \"0\");\n return [sign, hours, minutes];\n }\n\n //#endregion\n\n withTimeZone(timeZone) {\n return new TZDate(+this, timeZone);\n }\n\n //#region date-fns integration\n\n [Symbol.for(\"constructDateFrom\")](date) {\n return new TZDate(+new Date(date), this.timeZone);\n }\n\n //#endregion\n}"],"names":[],"mappings":"AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;AACxD,EAAE,OAAO,IA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,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAC5E,IAAI,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAClE,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC;AACjC,EAAE;;AAEF;;AAEA,EAAE,YAAY,CAAC,QAAQ,EAAE;AACzB,IAAI,OAAO,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC;AACtC,EAAE;;AAEF;;AAEA,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,EAAE;AAC1C,IAAI,OAAO,IAAI,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;AACrD,EAAE;;AAEF;AACA;;;;","x_google_ignoreList":[0,1,2,3]}
package/dist/index7.js CHANGED
@@ -1,94 +1,15 @@
1
- const defaultConfig = {
2
- csrf: {
3
- endpoint: "csrf/token",
4
- enabled: true,
5
- headerName: "x-csrf-token"
6
- },
7
- axios: {
8
- baseURL: "/api",
9
- timeout: 3e4,
10
- withCredentials: true,
11
- headers: {
12
- "Content-Type": "application/json",
13
- Accept: "application/json"
14
- }
15
- },
16
- auth: {
17
- tokenHeaderName: "Authorization",
18
- tokenPrefix: "Bearer",
19
- tokenEndpoint: "auth/access-token",
20
- refreshEndpoint: "auth/refresh-tokens",
21
- sessionRecoveryEnabled: true
22
- },
23
- timeZone: {
24
- resolveTimeZone: void 0
25
- },
26
- currency: {
27
- resolveCurrency: void 0
28
- },
29
- views: {
30
- viewsEndpoint: "table-views",
31
- statesEndpoint: "table-states"
32
- }
33
- };
34
- const GLOBAL_CONFIG_KEY = "__QUANTUM_UI_CONFIG__";
35
- function getGlobalConfig() {
36
- if (typeof window !== "undefined") {
37
- const globalWindow = window;
38
- if (!globalWindow[GLOBAL_CONFIG_KEY]) {
39
- globalWindow[GLOBAL_CONFIG_KEY] = { ...defaultConfig };
40
- }
41
- return globalWindow[GLOBAL_CONFIG_KEY] ?? { ...defaultConfig };
42
- }
43
- return { ...defaultConfig };
44
- }
45
- function setGlobalConfig(config) {
46
- if (typeof window !== "undefined") {
47
- window[GLOBAL_CONFIG_KEY] = config;
48
- }
49
- }
50
- function defineConfig(config) {
51
- return config;
52
- }
53
- function configureQuantumUI(userConfig) {
54
- const newConfig = {
55
- csrf: {
56
- ...defaultConfig.csrf,
57
- ...userConfig.csrf || {}
58
- },
59
- axios: {
60
- ...defaultConfig.axios,
61
- ...userConfig.axios || {},
62
- headers: {
63
- ...defaultConfig.axios.headers,
64
- ...userConfig.axios?.headers || {}
65
- }
66
- },
67
- auth: {
68
- ...defaultConfig.auth,
69
- ...userConfig.auth || {}
70
- },
71
- timeZone: {
72
- ...defaultConfig.timeZone,
73
- ...userConfig.timeZone || {}
74
- },
75
- currency: {
76
- ...defaultConfig.currency,
77
- ...userConfig.currency || {}
78
- },
79
- views: {
80
- ...defaultConfig.views,
81
- ...userConfig.views || {}
82
- }
83
- };
84
- setGlobalConfig(newConfig);
85
- }
86
- function getConfig() {
87
- return getGlobalConfig();
88
- }
89
- function resetConfig() {
90
- setGlobalConfig({ ...defaultConfig });
91
- }
1
+ import { T as TZDate } from './index6.js';
92
2
 
93
- export { configureQuantumUI as c, defineConfig as d, getConfig as g, resetConfig as r };
3
+ /**
4
+ * The function creates accepts a time zone and returns a function that creates
5
+ * a new `TZDate` instance in the time zone from the provided value. Use it to
6
+ * provide the context for the date-fns functions, via the `in` option.
7
+ *
8
+ * @param timeZone - Time zone name (IANA or UTC offset)
9
+ *
10
+ * @returns Function that creates a new `TZDate` instance in the time zone
11
+ */
12
+ const tz = timeZone => value => TZDate.tz(timeZone, +new Date(value));
13
+
14
+ export { tz as t };
94
15
  //# sourceMappingURL=index7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index7.js","sources":["../lib/config/index.ts"],"sourcesContent":["/**\n * quantum-ui Configuration System\n *\n * This module provides a type-safe configuration system for quantum-ui,\n * similar to how Tailwind CSS uses tailwind.config.js\n *\n * @example\n * ```typescript\n * // In your project root: quantum-ui.config.ts\n * import { defineConfig } from '@vritti/quantum-ui'\n *\n * export default defineConfig({\n * csrf: {\n * endpoint: '/csrf/token',\n * enabled: true,\n * },\n * axios: {\n * baseURL: '/api',\n * timeout: 30000,\n * }\n * })\n * ```\n */\n\n/**\n * CSRF configuration options\n */\nexport interface CsrfConfig {\n /**\n * The endpoint to fetch CSRF tokens from\n * @default '/csrf/token'\n */\n endpoint: string;\n\n /**\n * Whether CSRF protection is enabled\n * @default true\n */\n enabled: boolean;\n\n /**\n * The header name to send the CSRF token in\n * @default 'x-csrf-token'\n */\n headerName: string;\n}\n\n/**\n * Axios configuration options\n */\nexport interface AxiosConfig {\n /**\n * Base URL for all API requests\n * @default '/api'\n */\n baseURL: string;\n\n /**\n * Request timeout in milliseconds\n * @default 30000\n */\n timeout: number;\n\n /**\n * Whether to send cookies with requests\n * @default true\n */\n withCredentials: boolean;\n\n /**\n * Default headers to include in all requests\n */\n headers?: Record<string, string>;\n\n /**\n * Custom request interceptor — called before every request to add dynamic headers or modify config\n */\n onRequest?: (config: import('axios').InternalAxiosRequestConfig) => void | Promise<void>;\n}\n\n/**\n * Authentication configuration options\n */\nexport interface AuthConfig {\n /**\n * The header name for the authorization token\n * @default 'Authorization'\n */\n tokenHeaderName: string;\n\n /**\n * The prefix for the authorization token\n * @default 'Bearer'\n */\n tokenPrefix: string;\n\n /**\n * Endpoint for session recovery from httpOnly cookie\n * @default 'auth/access-token'\n */\n tokenEndpoint: string;\n\n /**\n * Endpoint for token refresh\n * @default 'auth/refresh-tokens'\n */\n refreshEndpoint: string;\n\n /**\n * Whether automatic session recovery is enabled\n * @default true\n */\n sessionRecoveryEnabled: boolean;\n}\n\n/**\n * Views management configuration\n */\nexport interface ViewsConfig {\n /**\n * Endpoint for named view CRUD operations\n */\n viewsEndpoint: string;\n\n /**\n * Endpoint for live state upsert\n */\n statesEndpoint: string;\n}\n\n/**\n * Time zone resolution configuration\n */\nexport interface TimeZoneConfig {\n /**\n * Custom resolver for the active application time zone\n */\n resolveTimeZone?: () => string | null | undefined;\n}\n\n/**\n * Currency resolution configuration\n */\nexport interface CurrencyConfig {\n /**\n * Custom resolver for the active application currency (ISO 4217)\n */\n resolveCurrency?: () => string | null | undefined;\n}\n\n/**\n * Complete quantum-ui configuration interface\n */\nexport interface QuantumUIConfig {\n /**\n * CSRF token configuration\n */\n csrf?: Partial<CsrfConfig>;\n\n /**\n * Axios HTTP client configuration\n */\n axios?: Partial<AxiosConfig>;\n\n /**\n * Authentication configuration\n */\n auth?: Partial<AuthConfig>;\n\n /**\n * Time zone resolution configuration\n */\n timeZone?: TimeZoneConfig;\n\n /**\n * Currency resolution configuration\n */\n currency?: CurrencyConfig;\n\n /**\n * Table views management configuration\n */\n views: ViewsConfig;\n}\n\n/**\n * Default configuration values\n */\nconst defaultConfig: {\n csrf: CsrfConfig;\n axios: AxiosConfig;\n auth: AuthConfig;\n views: Required<ViewsConfig>;\n timeZone: TimeZoneConfig;\n currency: CurrencyConfig;\n} = {\n csrf: {\n endpoint: 'csrf/token',\n enabled: true,\n headerName: 'x-csrf-token',\n },\n axios: {\n baseURL: '/api',\n timeout: 30000,\n withCredentials: true,\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n },\n },\n auth: {\n tokenHeaderName: 'Authorization',\n tokenPrefix: 'Bearer',\n tokenEndpoint: 'auth/access-token',\n refreshEndpoint: 'auth/refresh-tokens',\n sessionRecoveryEnabled: true,\n },\n timeZone: {\n resolveTimeZone: undefined,\n },\n currency: {\n resolveCurrency: undefined,\n },\n views: {\n viewsEndpoint: 'table-views',\n statesEndpoint: 'table-states',\n },\n};\n\n/**\n * Global key for storing config in window object\n * This ensures config is shared across Module Federation boundaries\n */\nconst GLOBAL_CONFIG_KEY = '__QUANTUM_UI_CONFIG__';\n\n// Type-safe global window access\ntype GlobalWindow = Window & typeof globalThis & { [GLOBAL_CONFIG_KEY]?: typeof defaultConfig };\n\n/**\n * Get the current config from global storage or initialize with defaults\n */\nfunction getGlobalConfig(): typeof defaultConfig {\n if (typeof window !== 'undefined') {\n const globalWindow = window as GlobalWindow;\n if (!globalWindow[GLOBAL_CONFIG_KEY]) {\n globalWindow[GLOBAL_CONFIG_KEY] = { ...defaultConfig };\n }\n return globalWindow[GLOBAL_CONFIG_KEY] ?? { ...defaultConfig };\n }\n return { ...defaultConfig };\n}\n\n/**\n * Set the global config\n */\nfunction setGlobalConfig(config: typeof defaultConfig): void {\n if (typeof window !== 'undefined') {\n (window as GlobalWindow)[GLOBAL_CONFIG_KEY] = config;\n }\n}\n\n/**\n * Helper function to define configuration with type safety\n * Similar to Tailwind's defineConfig()\n *\n * @param config - User configuration object\n * @returns The same configuration object (for type inference)\n *\n * @example\n * ```typescript\n * export default defineConfig({\n * csrf: { endpoint: '/api/csrf' }\n * })\n * ```\n */\nexport function defineConfig(config: QuantumUIConfig): QuantumUIConfig {\n return config;\n}\n\n/**\n * Configure quantum-ui with user settings\n * This should be called once in your application's entry point\n *\n * @param userConfig - User configuration object\n *\n * @example\n * ```typescript\n * import config from './quantum-ui.config'\n * import { configureQuantumUI } from '@vritti/quantum-ui'\n *\n * configureQuantumUI(config)\n * ```\n */\nexport function configureQuantumUI(userConfig: QuantumUIConfig): void {\n const newConfig = {\n csrf: {\n ...defaultConfig.csrf,\n ...(userConfig.csrf || {}),\n },\n axios: {\n ...defaultConfig.axios,\n ...(userConfig.axios || {}),\n headers: {\n ...defaultConfig.axios.headers,\n ...(userConfig.axios?.headers || {}),\n },\n },\n auth: {\n ...defaultConfig.auth,\n ...(userConfig.auth || {}),\n },\n timeZone: {\n ...defaultConfig.timeZone,\n ...(userConfig.timeZone || {}),\n },\n currency: {\n ...defaultConfig.currency,\n ...(userConfig.currency || {}),\n },\n views: {\n ...defaultConfig.views,\n ...(userConfig.views || {}),\n },\n };\n setGlobalConfig(newConfig);\n}\n\n/**\n * Get the current configuration\n * @returns Current merged configuration\n */\nexport function getConfig(): typeof defaultConfig {\n return getGlobalConfig();\n}\n\n/**\n * Reset configuration to defaults\n * Mainly useful for testing\n */\nexport function resetConfig(): void {\n setGlobalConfig({ ...defaultConfig });\n}\n"],"names":[],"mappings":"AA4LA,MAAM,aAAA,GAOF;AAAA,EACF,IAAA,EAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,OAAA,EAAS,IAAA;AAAA,IACT,UAAA,EAAY;AAAA,GACd;AAAA,EACA,KAAA,EAAO;AAAA,IACL,OAAA,EAAS,MAAA;AAAA,IACT,OAAA,EAAS,GAAA;AAAA,IACT,eAAA,EAAiB,IAAA;AAAA,IACjB,OAAA,EAAS;AAAA,MACP,cAAA,EAAgB,kBAAA;AAAA,MAChB,MAAA,EAAQ;AAAA;AACV,GACF;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,eAAA,EAAiB,eAAA;AAAA,IACjB,WAAA,EAAa,QAAA;AAAA,IACb,aAAA,EAAe,mBAAA;AAAA,IACf,eAAA,EAAiB,qBAAA;AAAA,IACjB,sBAAA,EAAwB;AAAA,GAC1B;AAAA,EACA,QAAA,EAAU;AAAA,IACR,eAAA,EAAiB;AAAA,GACnB;AAAA,EACA,QAAA,EAAU;AAAA,IACR,eAAA,EAAiB;AAAA,GACnB;AAAA,EACA,KAAA,EAAO;AAAA,IACL,aAAA,EAAe,aAAA;AAAA,IACf,cAAA,EAAgB;AAAA;AAEpB,CAAA;AAMA,MAAM,iBAAA,GAAoB,uBAAA;AAQ1B,SAAS,eAAA,GAAwC;AAC/C,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,IAAA,MAAM,YAAA,GAAe,MAAA;AACrB,IAAA,IAAI,CAAC,YAAA,CAAa,iBAAiB,CAAA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G,aAAA,CAAc,KAAA;AAAA,MACjB,GAAI,UAAA,CAAW,KAAA,IAAS;AAAC;AAC3B,GACF;AACA,EAAA,eAAA,CAAgB,SAAS,CAAA;AAC3B;AAMO,SAAS,SAAA,GAAkC;AAChD,EAAA,OAAO,eAAA,EAAgB;AACzB;AAMO,SAAS,WAAA,GAAoB;AAClC,EAAA,eAAA,CAAgB,EAAE,GAAG,aAAA,EAAe,CAAA;AACtC;;;;"}
1
+ {"version":3,"file":"index7.js","sources":["../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tz/index.js"],"sourcesContent":["import { TZDate } from \"../date/index.js\";\n\n/**\n * The function creates accepts a time zone and returns a function that creates\n * a new `TZDate` instance in the time zone from the provided value. Use it to\n * provide the context for the date-fns functions, via the `in` option.\n *\n * @param timeZone - Time zone name (IANA or UTC offset)\n *\n * @returns Function that creates a new `TZDate` instance in the time zone\n */\nexport const tz = timeZone => value => TZDate.tz(timeZone, +new Date(value));"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,EAAE,GAAG,QAAQ,IAAI,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC;;;;","x_google_ignoreList":[0]}