@variocube/app-ui 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/esm/AppShell/AppShell.js +12 -12
  2. package/esm/AppShell/AppShell.js.map +1 -1
  3. package/esm/AppShell/index.js.map +1 -1
  4. package/esm/Input/ActionsMenu.js +1 -1
  5. package/esm/Input/ActionsMenu.js.map +1 -1
  6. package/esm/Input/EmailSenderField.js +3 -3
  7. package/esm/Input/EmailSenderField.js.map +1 -1
  8. package/esm/Input/Selector.js +2 -2
  9. package/esm/Input/Selector.js.map +1 -1
  10. package/esm/Paging/Paging.d.ts +1 -1
  11. package/esm/Paging/Paging.js +5 -5
  12. package/esm/Paging/Paging.js.map +1 -1
  13. package/esm/Paging/index.d.ts +2 -1
  14. package/esm/Paging/index.js.map +1 -1
  15. package/esm/VCThemeProvider/JetbrainsMonoFont.js +8 -8
  16. package/esm/VCThemeProvider/JetbrainsMonoFont.js.map +1 -1
  17. package/esm/VCThemeProvider/RobotoFont.js +8 -8
  18. package/esm/VCThemeProvider/RobotoFont.js.map +1 -1
  19. package/esm/VCThemeProvider/ThemeModeSwitcher.js +5 -5
  20. package/esm/VCThemeProvider/ThemeModeSwitcher.js.map +1 -1
  21. package/esm/VCThemeProvider/VCThemeProvider.d.ts +1 -1
  22. package/esm/VCThemeProvider/VCThemeProvider.js +21 -21
  23. package/esm/VCThemeProvider/VCThemeProvider.js.map +1 -1
  24. package/esm/audit/AuditChanges.js +9 -5
  25. package/esm/audit/AuditChanges.js.map +1 -1
  26. package/esm/audit/AuditTimeline.js +1 -1
  27. package/esm/audit/AuditTimeline.js.map +1 -1
  28. package/esm/audit/AuditTimelineItem.js +3 -3
  29. package/esm/audit/AuditTimelineItem.js.map +1 -1
  30. package/esm/audit/index.d.ts +1 -1
  31. package/esm/audit/index.js +1 -1
  32. package/esm/audit/index.js.map +1 -1
  33. package/esm/breadcrumbs.d.ts +2 -2
  34. package/esm/breadcrumbs.js +3 -3
  35. package/esm/breadcrumbs.js.map +1 -1
  36. package/esm/code/CodeBlock.d.ts +1 -1
  37. package/esm/code/CodeBlock.js +1 -1
  38. package/esm/code/CodeBlock.js.map +1 -1
  39. package/esm/confirm/ConfirmButton.js.map +1 -1
  40. package/esm/confirm/ConfirmDialog.js +1 -1
  41. package/esm/confirm/ConfirmDialog.js.map +1 -1
  42. package/esm/confirm/ConfirmMenuItem.js +1 -1
  43. package/esm/confirm/ConfirmMenuItem.js.map +1 -1
  44. package/esm/container/ContainerLayout.d.ts +1 -1
  45. package/esm/container/ContainerLayout.js +5 -5
  46. package/esm/container/ContainerLayout.js.map +1 -1
  47. package/esm/container/ContainerSettingsContext.d.ts +2 -2
  48. package/esm/container/ContainerSettingsContext.js +6 -6
  49. package/esm/container/ContainerSettingsContext.js.map +1 -1
  50. package/esm/container/ContainerWidthControl.js +2 -2
  51. package/esm/container/ContainerWidthControl.js.map +1 -1
  52. package/esm/container/index.d.ts +1 -1
  53. package/esm/container/index.js +1 -1
  54. package/esm/container/index.js.map +1 -1
  55. package/esm/content-table/ContentTable.d.ts +1 -1
  56. package/esm/content-table/ContentTable.js +26 -19
  57. package/esm/content-table/ContentTable.js.map +1 -1
  58. package/esm/content-table/UndrawEmpty.js.map +1 -1
  59. package/esm/content-table/index.js.map +1 -1
  60. package/esm/country/country-select.js.map +1 -1
  61. package/esm/country/index.d.ts +3 -3
  62. package/esm/country/index.js +3 -3
  63. package/esm/country/index.js.map +1 -1
  64. package/esm/country/locale-select.js +1 -1
  65. package/esm/country/locale-select.js.map +1 -1
  66. package/esm/country/locales.js +1 -1
  67. package/esm/country/locales.js.map +1 -1
  68. package/esm/country/phone-prefix-select.js +1 -1
  69. package/esm/country/phone-prefix-select.js.map +1 -1
  70. package/esm/cube/accessibility.js +2 -1
  71. package/esm/cube/accessibility.js.map +1 -1
  72. package/esm/data-table/DataTableColumnSettings.d.ts +1 -1
  73. package/esm/data-table/DataTableColumnSettings.js +2 -2
  74. package/esm/data-table/DataTableColumnSettings.js.map +1 -1
  75. package/esm/data-table/DataTableHeader.js +1 -1
  76. package/esm/data-table/DataTableHeader.js.map +1 -1
  77. package/esm/data-table/DataTableToolbar.js +1 -1
  78. package/esm/data-table/DataTableToolbar.js.map +1 -1
  79. package/esm/data-table/index.d.ts +4 -4
  80. package/esm/data-table/index.js +4 -4
  81. package/esm/data-table/index.js.map +1 -1
  82. package/esm/data-table/useDataTableColumnStorage.d.ts +9 -1
  83. package/esm/data-table/useDataTableColumnStorage.js +12 -5
  84. package/esm/data-table/useDataTableColumnStorage.js.map +1 -1
  85. package/esm/data-table/useDataTableStorage.d.ts +31 -6
  86. package/esm/data-table/useDataTableStorage.js +25 -5
  87. package/esm/data-table/useDataTableStorage.js.map +1 -1
  88. package/esm/date-pickers/PlainAdapterCommon.d.ts +1 -1
  89. package/esm/date-pickers/PlainAdapterCommon.js.map +1 -1
  90. package/esm/date-pickers/PlainDateAdapter.js.map +1 -1
  91. package/esm/date-pickers/PlainDatePicker.js +1 -1
  92. package/esm/date-pickers/PlainDatePicker.js.map +1 -1
  93. package/esm/date-pickers/PlainDatePicker.spec.js +2 -2
  94. package/esm/date-pickers/PlainDatePicker.spec.js.map +1 -1
  95. package/esm/date-pickers/PlainDateTimeAdapter.js.map +1 -1
  96. package/esm/date-pickers/PlainDateTimePicker.js +2 -2
  97. package/esm/date-pickers/PlainDateTimePicker.js.map +1 -1
  98. package/esm/date-pickers/PlainDateTimePicker.spec.js +2 -2
  99. package/esm/date-pickers/PlainDateTimePicker.spec.js.map +1 -1
  100. package/esm/date-pickers/PlainTimeAdapter.js.map +1 -1
  101. package/esm/date-pickers/PlainTimePicker.js +2 -2
  102. package/esm/date-pickers/PlainTimePicker.js.map +1 -1
  103. package/esm/date-pickers/PlainTimePicker.spec.js +2 -2
  104. package/esm/date-pickers/PlainTimePicker.spec.js.map +1 -1
  105. package/esm/date-pickers/TemporalAdapter.d.ts +1 -1
  106. package/esm/date-pickers/TemporalAdapter.js +1 -1
  107. package/esm/date-pickers/TemporalAdapter.js.map +1 -1
  108. package/esm/date-pickers/TimezoneSelect.js +348 -348
  109. package/esm/date-pickers/TimezoneSelect.js.map +1 -1
  110. package/esm/date-pickers/getFormatString.js.map +1 -1
  111. package/esm/date-pickers/index.d.ts +2 -1
  112. package/esm/date-pickers/index.js +1 -1
  113. package/esm/date-pickers/index.js.map +1 -1
  114. package/esm/date-pickers/parse.js.map +1 -1
  115. package/esm/date-pickers/timeframe-picker.js +7 -7
  116. package/esm/date-pickers/timeframe-picker.js.map +1 -1
  117. package/esm/date-pickers/useLocale.js.map +1 -1
  118. package/esm/date-pickers/useRenderInput.js +5 -3
  119. package/esm/date-pickers/useRenderInput.js.map +1 -1
  120. package/esm/formats/CompactFormat.js +1 -1
  121. package/esm/formats/CompactFormat.js.map +1 -1
  122. package/esm/formats/CompactFormat.spec.js +1 -1
  123. package/esm/formats/CompactFormat.spec.js.map +1 -1
  124. package/esm/formats/CurrencyFormat.js +1 -1
  125. package/esm/formats/CurrencyFormat.js.map +1 -1
  126. package/esm/formats/CurrencyFormat.spec.js +1 -1
  127. package/esm/formats/CurrencyFormat.spec.js.map +1 -1
  128. package/esm/formats/DecimalFormat.js +1 -1
  129. package/esm/formats/DecimalFormat.js.map +1 -1
  130. package/esm/formats/DecimalFormat.spec.js +1 -1
  131. package/esm/formats/DecimalFormat.spec.js.map +1 -1
  132. package/esm/formats/DurationFormat.js +2 -2
  133. package/esm/formats/DurationFormat.js.map +1 -1
  134. package/esm/formats/DurationFormat.spec.js +2 -2
  135. package/esm/formats/DurationFormat.spec.js.map +1 -1
  136. package/esm/formats/TemporalFormat.spec.js +2 -2
  137. package/esm/formats/TemporalFormat.spec.js.map +1 -1
  138. package/esm/formats/TemporalRangeFormat.js +1 -1
  139. package/esm/formats/TemporalRangeFormat.js.map +1 -1
  140. package/esm/formats/TemporalRangeFormat.spec.js +2 -2
  141. package/esm/formats/TemporalRangeFormat.spec.js.map +1 -1
  142. package/esm/formats/useDateTimeFormat.js +5 -2
  143. package/esm/formats/useDateTimeFormat.js.map +1 -1
  144. package/esm/formats/useNumberFormat.js +1 -1
  145. package/esm/formats/useNumberFormat.js.map +1 -1
  146. package/esm/formats/useRelativeTimeFormat.js +4 -2
  147. package/esm/formats/useRelativeTimeFormat.js.map +1 -1
  148. package/esm/forms/SearchForm.js +1 -1
  149. package/esm/forms/SearchForm.js.map +1 -1
  150. package/esm/getNavigatorLanguages.js.map +1 -1
  151. package/esm/getSupportedFormatLocale.js.map +1 -1
  152. package/esm/help/HelpDrawer.js +12 -8
  153. package/esm/help/HelpDrawer.js.map +1 -1
  154. package/esm/help/index.d.ts +1 -1
  155. package/esm/help/index.js +1 -1
  156. package/esm/help/index.js.map +1 -1
  157. package/esm/icons.d.ts +13 -13
  158. package/esm/icons.js +13 -13
  159. package/esm/icons.js.map +1 -1
  160. package/esm/layout/ErrorBoundary.js +36 -36
  161. package/esm/layout/ErrorBoundary.js.map +1 -1
  162. package/esm/layout/NotFound.js +6 -6
  163. package/esm/layout/NotFound.js.map +1 -1
  164. package/esm/layout/NotFoundSvg.js.map +1 -1
  165. package/esm/layout/UserNav.js +18 -18
  166. package/esm/layout/UserNav.js.map +1 -1
  167. package/esm/layout/index.d.ts +2 -2
  168. package/esm/layout/index.js +2 -2
  169. package/esm/layout/index.js.map +1 -1
  170. package/esm/logo/Logo.js +2 -2
  171. package/esm/logo/Logo.js.map +1 -1
  172. package/esm/logo/VCAppLogo.js +1 -1
  173. package/esm/logo/VCAppLogo.js.map +1 -1
  174. package/esm/logo/index.d.ts +3 -3
  175. package/esm/logo/index.js +3 -3
  176. package/esm/logo/index.js.map +1 -1
  177. package/esm/splash/index.js +2 -2
  178. package/esm/splash/index.js.map +1 -1
  179. package/esm/storage/MemoryStorage.d.ts +6 -4
  180. package/esm/storage/MemoryStorage.js +13 -4
  181. package/esm/storage/MemoryStorage.js.map +1 -1
  182. package/esm/storage/index.d.ts +2 -1
  183. package/esm/storage/index.js +1 -1
  184. package/esm/storage/index.js.map +1 -1
  185. package/esm/storage/storage.d.ts +6 -4
  186. package/esm/storage/storage.js +35 -15
  187. package/esm/storage/storage.js.map +1 -1
  188. package/esm/storage/types.d.ts +6 -0
  189. package/esm/storage/types.js +2 -0
  190. package/esm/storage/types.js.map +1 -0
  191. package/esm/storage/useStorage.d.ts +10 -1
  192. package/esm/storage/useStorage.js +18 -6
  193. package/esm/storage/useStorage.js.map +1 -1
  194. package/esm/tabs/Tabs.d.ts +2 -2
  195. package/esm/tabs/Tabs.js +15 -15
  196. package/esm/tabs/Tabs.js.map +1 -1
  197. package/esm/tabs/index.js.map +1 -1
  198. package/esm/temporal/index.d.ts +1 -1
  199. package/esm/temporal/index.js +1 -1
  200. package/esm/temporal/index.js.map +1 -1
  201. package/esm/temporal/parse.js.map +1 -1
  202. package/esm/temporal/polyfill.d.ts +1 -1
  203. package/esm/temporal/polyfill.js +3 -3
  204. package/esm/temporal/polyfill.js.map +1 -1
  205. package/esm/utils/defined.js.map +1 -1
  206. package/esm/utils/index.d.ts +1 -1
  207. package/esm/utils/index.js +1 -1
  208. package/esm/utils/index.js.map +1 -1
  209. package/esm/utils/useFlag.js.map +1 -1
  210. package/esm/utils/useIsMounted.js.map +1 -1
  211. package/package.json +8 -9
  212. package/src/AppShell/AppShell.tsx +147 -140
  213. package/src/AppShell/index.tsx +1 -1
  214. package/src/Input/ActionsMenu.tsx +70 -73
  215. package/src/Input/EmailSenderField.tsx +59 -52
  216. package/src/Input/Selector.tsx +15 -15
  217. package/src/LanguageSwitcher/index.ts +1 -1
  218. package/src/Paging/Paging.ts +56 -57
  219. package/src/Paging/index.ts +2 -1
  220. package/src/VCThemeProvider/JetbrainsMonoFont.tsx +52 -42
  221. package/src/VCThemeProvider/RobotoFont.tsx +47 -39
  222. package/src/VCThemeProvider/ThemeModeSwitcher.tsx +17 -17
  223. package/src/VCThemeProvider/VCThemeProvider.tsx +149 -145
  224. package/src/audit/AuditChanges.tsx +18 -12
  225. package/src/audit/AuditTimeline.tsx +16 -17
  226. package/src/audit/AuditTimelineItem.tsx +58 -61
  227. package/src/audit/index.ts +2 -2
  228. package/src/audit/types.ts +27 -28
  229. package/src/breadcrumbs.tsx +11 -15
  230. package/src/code/CodeBlock.tsx +10 -10
  231. package/src/confirm/ConfirmButton.tsx +56 -56
  232. package/src/confirm/ConfirmDialog.tsx +54 -54
  233. package/src/confirm/ConfirmMenuItem.tsx +51 -53
  234. package/src/container/ContainerLayout.tsx +7 -8
  235. package/src/container/ContainerSettingsContext.tsx +49 -46
  236. package/src/container/ContainerWidthControl.tsx +11 -9
  237. package/src/container/index.ts +8 -3
  238. package/src/content-table/ContentTable.tsx +235 -197
  239. package/src/content-table/UndrawEmpty.tsx +281 -281
  240. package/src/content-table/index.ts +1 -1
  241. package/src/country/country-select.tsx +0 -1
  242. package/src/country/index.ts +3 -3
  243. package/src/country/locale-select.tsx +36 -36
  244. package/src/country/locales.ts +185 -187
  245. package/src/country/phone-prefix-select.tsx +4 -5
  246. package/src/cube/accessibility.tsx +2 -1
  247. package/src/data-table/DataTableColumnSettings.tsx +181 -181
  248. package/src/data-table/DataTableHeader.tsx +6 -6
  249. package/src/data-table/DataTableToolbar.tsx +6 -6
  250. package/src/data-table/index.tsx +4 -4
  251. package/src/data-table/useDataTableColumnStorage.ts +30 -19
  252. package/src/data-table/useDataTableStorage.spec.ts +108 -0
  253. package/src/data-table/useDataTableStorage.ts +91 -36
  254. package/src/date-pickers/PlainAdapterCommon.ts +118 -120
  255. package/src/date-pickers/PlainDateAdapter.spec.ts +44 -46
  256. package/src/date-pickers/PlainDateAdapter.ts +130 -132
  257. package/src/date-pickers/PlainDatePicker.spec.tsx +17 -18
  258. package/src/date-pickers/PlainDatePicker.tsx +33 -36
  259. package/src/date-pickers/PlainDateTimeAdapter.spec.ts +44 -46
  260. package/src/date-pickers/PlainDateTimeAdapter.ts +141 -134
  261. package/src/date-pickers/PlainDateTimePicker.spec.tsx +17 -18
  262. package/src/date-pickers/PlainDateTimePicker.tsx +35 -36
  263. package/src/date-pickers/PlainTimeAdapter.ts +219 -221
  264. package/src/date-pickers/PlainTimePicker.spec.tsx +17 -18
  265. package/src/date-pickers/PlainTimePicker.tsx +35 -34
  266. package/src/date-pickers/TemporalAdapter.ts +110 -111
  267. package/src/date-pickers/TimezoneSelect.tsx +375 -375
  268. package/src/date-pickers/getFormatString.ts +29 -29
  269. package/src/date-pickers/index.ts +6 -5
  270. package/src/date-pickers/parse.spec.ts +37 -40
  271. package/src/date-pickers/parse.ts +44 -47
  272. package/src/date-pickers/timeframe-picker.tsx +16 -17
  273. package/src/date-pickers/useLocale.ts +1 -1
  274. package/src/date-pickers/useRenderInput.tsx +24 -15
  275. package/src/formats/CompactFormat.spec.tsx +18 -20
  276. package/src/formats/CompactFormat.tsx +30 -30
  277. package/src/formats/CurrencyFormat.spec.tsx +18 -20
  278. package/src/formats/CurrencyFormat.tsx +52 -52
  279. package/src/formats/DecimalFormat.spec.tsx +18 -20
  280. package/src/formats/DecimalFormat.tsx +47 -47
  281. package/src/formats/DurationFormat.spec.tsx +48 -49
  282. package/src/formats/DurationFormat.tsx +51 -51
  283. package/src/formats/TemporalFormat.spec.tsx +93 -95
  284. package/src/formats/TemporalRangeFormat.spec.tsx +143 -144
  285. package/src/formats/TemporalRangeFormat.tsx +54 -54
  286. package/src/formats/types.ts +1 -3
  287. package/src/formats/useDateTimeFormat.ts +5 -2
  288. package/src/formats/useNumberFormat.ts +3 -3
  289. package/src/formats/useRelativeTimeFormat.ts +5 -3
  290. package/src/forms/SearchForm.tsx +37 -38
  291. package/src/getNavigatorLanguages.ts +4 -5
  292. package/src/getSupportedFormatLocale.ts +10 -10
  293. package/src/help/HelpDrawer.tsx +76 -55
  294. package/src/help/index.ts +3 -3
  295. package/src/icons.ts +21 -21
  296. package/src/layout/ErrorBoundary.tsx +226 -215
  297. package/src/layout/NotFound.tsx +36 -39
  298. package/src/layout/NotFoundSvg.tsx +193 -169
  299. package/src/layout/UserNav.tsx +98 -98
  300. package/src/layout/index.ts +3 -3
  301. package/src/logo/Logo.tsx +6 -7
  302. package/src/logo/VCAppLogo.tsx +22 -20
  303. package/src/logo/index.tsx +3 -3
  304. package/src/splash/index.tsx +25 -25
  305. package/src/storage/MemoryStorage.ts +22 -15
  306. package/src/storage/index.ts +2 -1
  307. package/src/storage/storage.spec.ts +184 -0
  308. package/src/storage/storage.ts +37 -15
  309. package/src/storage/types.ts +6 -0
  310. package/src/storage/useStorage.ts +21 -6
  311. package/src/tabs/Tabs.tsx +172 -170
  312. package/src/tabs/index.ts +1 -1
  313. package/src/temporal/index.ts +1 -1
  314. package/src/temporal/parse.ts +1 -2
  315. package/src/temporal/polyfill.ts +11 -11
  316. package/src/utils/defined.ts +2 -3
  317. package/src/utils/index.ts +1 -1
  318. package/src/utils/useFlag.ts +5 -5
  319. package/src/utils/useIsMounted.ts +9 -9
@@ -1,110 +1,108 @@
1
- import {act, create, ReactTestRenderer} from "react-test-renderer";
2
1
  import * as React from "react";
2
+ import {act, create, ReactTestRenderer} from "react-test-renderer";
3
3
  import {Instant, PlainDate, PlainDateTime, PlainTime, ZonedDateTime} from "../temporal";
4
4
  import {TemporalFormat} from "./TemporalFormat";
5
5
 
6
6
  describe("TemporalFormat", () => {
7
+ test("PlainDate de-AT", () => {
8
+ let element: ReactTestRenderer;
9
+ act(() => {
10
+ element = create(<TemporalFormat value={PlainDate.from("2022-06-22")} locale="de-AT" />);
11
+ });
12
+ const value = element!.root.children[0];
13
+ expect(value).toBe("22.6.2022");
14
+ });
7
15
 
8
- test("PlainDate de-AT", () => {
9
- let element: ReactTestRenderer;
10
- act(() => {
11
- element = create(<TemporalFormat value={PlainDate.from("2022-06-22")} locale="de-AT"/>);
12
- });
13
- const value = element!.root.children[0];
14
- expect(value).toBe("22.6.2022");
15
- });
16
-
17
- test("PlainDate en-US", () => {
18
- let element: ReactTestRenderer;
19
- act(() => {
20
- element = create(<TemporalFormat value={PlainDate.from("2022-06-22")} locale="en-US"/>);
21
- });
22
- const value = element!.root.children[0];
23
- expect(value).toBe("6/22/2022");
24
- });
25
-
26
- test("PlainDateTime de-AT", () => {
27
- let element: ReactTestRenderer;
28
- act(() => {
29
- element = create(<TemporalFormat value={PlainDateTime.from("2022-06-22T14:22")} locale="de-AT"/>);
30
- });
31
- const value = element!.root.children[0];
32
- expect(value).toBe("22.6.2022, 14:22:00");
33
- });
16
+ test("PlainDate en-US", () => {
17
+ let element: ReactTestRenderer;
18
+ act(() => {
19
+ element = create(<TemporalFormat value={PlainDate.from("2022-06-22")} locale="en-US" />);
20
+ });
21
+ const value = element!.root.children[0];
22
+ expect(value).toBe("6/22/2022");
23
+ });
34
24
 
35
- test("PlainDateTime en-US", () => {
36
- let element: ReactTestRenderer;
37
- act(() => {
38
- element = create(<TemporalFormat value={PlainDateTime.from("2022-06-22T14:22")} locale="en-US"/>);
39
- });
40
- const value = element!.root.children[0];
41
- expect(value).toBe("6/22/2022, 2:22:00 PM");
42
- });
25
+ test("PlainDateTime de-AT", () => {
26
+ let element: ReactTestRenderer;
27
+ act(() => {
28
+ element = create(<TemporalFormat value={PlainDateTime.from("2022-06-22T14:22")} locale="de-AT" />);
29
+ });
30
+ const value = element!.root.children[0];
31
+ expect(value).toBe("22.6.2022, 14:22:00");
32
+ });
43
33
 
44
- test("PlainTime de-AT", () => {
45
- let element: ReactTestRenderer;
46
- act(() => {
47
- element = create(<TemporalFormat value={PlainTime.from({hour: 14, minute: 22})} locale="de-AT"/>);
48
- });
49
- const value = element!.root.children[0];
50
- expect(value).toBe("14:22:00");
51
- });
34
+ test("PlainDateTime en-US", () => {
35
+ let element: ReactTestRenderer;
36
+ act(() => {
37
+ element = create(<TemporalFormat value={PlainDateTime.from("2022-06-22T14:22")} locale="en-US" />);
38
+ });
39
+ const value = element!.root.children[0];
40
+ expect(value).toBe("6/22/2022, 2:22:00 PM");
41
+ });
52
42
 
53
- test("PlainTime en-US", () => {
54
- let element: ReactTestRenderer;
55
- act(() => {
56
- element = create(<TemporalFormat value={PlainTime.from({hour: 14, minute: 22})} locale="en-US"/>);
57
- });
58
- const value = element!.root.children[0];
59
- expect(value).toBe("2:22:00 PM");
60
- });
43
+ test("PlainTime de-AT", () => {
44
+ let element: ReactTestRenderer;
45
+ act(() => {
46
+ element = create(<TemporalFormat value={PlainTime.from({hour: 14, minute: 22})} locale="de-AT" />);
47
+ });
48
+ const value = element!.root.children[0];
49
+ expect(value).toBe("14:22:00");
50
+ });
61
51
 
62
- test("ZonedDateTime de-AT", () => {
63
- let element: ReactTestRenderer;
64
- act(() => {
65
- element = create(<TemporalFormat value={ZonedDateTime.from("2022-06-22T14:22[MET]")} locale="de-AT"/>);
66
- });
67
- const value = element!.root.children[0];
68
- expect(value).toBe("22.6.2022, 14:22:00 GMT+2");
69
- });
52
+ test("PlainTime en-US", () => {
53
+ let element: ReactTestRenderer;
54
+ act(() => {
55
+ element = create(<TemporalFormat value={PlainTime.from({hour: 14, minute: 22})} locale="en-US" />);
56
+ });
57
+ const value = element!.root.children[0];
58
+ expect(value).toBe("2:22:00 PM");
59
+ });
70
60
 
71
- test("ZonedDateTime en-US", () => {
72
- let element: ReactTestRenderer;
73
- act(() => {
74
- element = create(<TemporalFormat value={ZonedDateTime.from("2022-06-22T14:22[MET]")} locale="en-US"/>);
75
- });
76
- const value = element!.root.children[0];
77
- expect(value).toBe("6/22/2022, 2:22:00 PM GMT+2");
78
- });
61
+ test("ZonedDateTime de-AT", () => {
62
+ let element: ReactTestRenderer;
63
+ act(() => {
64
+ element = create(<TemporalFormat value={ZonedDateTime.from("2022-06-22T14:22[MET]")} locale="de-AT" />);
65
+ });
66
+ const value = element!.root.children[0];
67
+ expect(value).toBe("22.6.2022, 14:22:00 MESZ");
68
+ });
79
69
 
80
- test("Instant de-AT", () => {
81
- let element: ReactTestRenderer;
82
- act(() => {
83
- element = create(
84
- <TemporalFormat
85
- value={Instant.from("2022-06-22T14:22:11Z")}
86
- timeZone="Europe/Vienna"
87
- locale="de-AT"
88
- />
89
- );
90
- });
91
- const value = element!.root.children[0];
92
- expect(value).toBe("22.6.2022, 16:22:11");
93
- });
70
+ test("ZonedDateTime en-US", () => {
71
+ let element: ReactTestRenderer;
72
+ act(() => {
73
+ element = create(<TemporalFormat value={ZonedDateTime.from("2022-06-22T14:22[MET]")} locale="en-US" />);
74
+ });
75
+ const value = element!.root.children[0];
76
+ expect(value).toBe("6/22/2022, 2:22:00 PM GMT+2");
77
+ });
94
78
 
95
- test("Instant en-US", () => {
96
- let element: ReactTestRenderer;
97
- act(() => {
98
- element = create(
99
- <TemporalFormat
100
- value={Instant.from("2022-06-22T14:22:11Z")}
101
- locale="en-US"
102
- timeZone="UTC"
103
- />
104
- );
105
- });
106
- const value = element!.root.children[0];
107
- expect(value).toBe("6/22/2022, 2:22:11 PM");
108
- });
79
+ test("Instant de-AT", () => {
80
+ let element: ReactTestRenderer;
81
+ act(() => {
82
+ element = create(
83
+ <TemporalFormat
84
+ value={Instant.from("2022-06-22T14:22:11Z")}
85
+ timeZone="Europe/Vienna"
86
+ locale="de-AT"
87
+ />,
88
+ );
89
+ });
90
+ const value = element!.root.children[0];
91
+ expect(value).toBe("22.6.2022, 16:22:11");
92
+ });
109
93
 
94
+ test("Instant en-US", () => {
95
+ let element: ReactTestRenderer;
96
+ act(() => {
97
+ element = create(
98
+ <TemporalFormat
99
+ value={Instant.from("2022-06-22T14:22:11Z")}
100
+ locale="en-US"
101
+ timeZone="UTC"
102
+ />,
103
+ );
104
+ });
105
+ const value = element!.root.children[0];
106
+ expect(value).toBe("6/22/2022, 2:22:11 PM");
107
+ });
110
108
  });
@@ -1,159 +1,158 @@
1
- import {act, create, ReactTestRenderer} from "react-test-renderer";
2
1
  import * as React from "react";
2
+ import {act, create, ReactTestRenderer} from "react-test-renderer";
3
3
  import {Instant, PlainDate, PlainDateTime, PlainTime, ZonedDateTime} from "../temporal";
4
4
  import {TemporalRangeFormat} from "./TemporalRangeFormat";
5
5
 
6
6
  describe("TemporalRangeFormat", () => {
7
+ test("PlainDate de-AT", () => {
8
+ let element: ReactTestRenderer;
9
+ act(() => {
10
+ element = create(
11
+ <TemporalRangeFormat
12
+ from={PlainDate.from("2022-06-22")}
13
+ until={PlainDate.from("2022-06-30")}
14
+ locale="de-AT"
15
+ />,
16
+ );
17
+ });
18
+ const value = element!.root.children[0];
19
+ expect(value).toBe("22.–30.06.2022");
20
+ });
7
21
 
8
- test("PlainDate de-AT", () => {
9
- let element: ReactTestRenderer;
10
- act(() => {
11
- element = create(
12
- <TemporalRangeFormat
13
- from={PlainDate.from("2022-06-22")}
14
- until={PlainDate.from("2022-06-30")}
15
- locale="de-AT"
16
- />
17
- );
18
- });
19
- const value = element!.root.children[0];
20
- expect(value).toBe("22.–30.06.2022");
21
- });
22
-
23
- test("PlainDate en-US", () => {
24
- let element: ReactTestRenderer;
25
- act(() => {
26
- element = create(
27
- <TemporalRangeFormat
28
- from={PlainDate.from("2022-06-22")}
29
- until={PlainDate.from("2022-06-30")}
30
- locale="en-US"
31
- />
32
- );
33
- });
34
- const value = element!.root.children[0];
35
- expect(value).toBe("6/22/2022 – 6/30/2022");
36
- });
37
-
38
- test("PlainDateTime de-AT", () => {
39
- let element: ReactTestRenderer;
40
- act(() => {
41
- element = create(
42
- <TemporalRangeFormat
43
- from={PlainDateTime.from("2022-06-22T14:22")}
44
- until={PlainDateTime.from("2022-06-22T17:55")}
45
- locale="de-AT"
46
- />
47
- );
48
- });
49
- const value = element!.root.children[0];
50
- expect(value).toBe("22.6.2022, 14:22:00 – 17:55:00");
51
- });
22
+ test("PlainDate en-US", () => {
23
+ let element: ReactTestRenderer;
24
+ act(() => {
25
+ element = create(
26
+ <TemporalRangeFormat
27
+ from={PlainDate.from("2022-06-22")}
28
+ until={PlainDate.from("2022-06-30")}
29
+ locale="en-US"
30
+ />,
31
+ );
32
+ });
33
+ const value = element!.root.children[0];
34
+ expect(value).toBe("6/22/2022 – 6/30/2022");
35
+ });
52
36
 
53
- test("PlainDateTime en-US", () => {
54
- let element: ReactTestRenderer;
55
- act(() => {
56
- element = create(
57
- <TemporalRangeFormat
58
- from={PlainDateTime.from("2022-06-22T14:22")}
59
- until={PlainDateTime.from("2022-06-22T17:55")}
60
- locale="en-US"
61
- />
62
- );
63
- });
64
- const value = element!.root.children[0];
65
- expect(value).toBe("6/22/2022, 2:22:00 PM – 5:55:00 PM");
66
- });
37
+ test("PlainDateTime de-AT", () => {
38
+ let element: ReactTestRenderer;
39
+ act(() => {
40
+ element = create(
41
+ <TemporalRangeFormat
42
+ from={PlainDateTime.from("2022-06-22T14:22")}
43
+ until={PlainDateTime.from("2022-06-22T17:55")}
44
+ locale="de-AT"
45
+ />,
46
+ );
47
+ });
48
+ const value = element!.root.children[0];
49
+ expect(value).toBe("22.6.2022, 14:22:00 – 17:55:00");
50
+ });
67
51
 
68
- test("PlainTime de-AT", () => {
69
- let element: ReactTestRenderer;
70
- act(() => {
71
- element = create(
72
- <TemporalRangeFormat
73
- from={PlainTime.from({hour: 14, minute: 22})}
74
- until={PlainTime.from({hour: 18, minute: 0, second: 3})}
75
- locale="de-AT"
76
- />
77
- );
78
- });
79
- const value = element!.root.children[0];
80
- expect(value).toBe("14:22:00 – 18:00:03");
81
- });
52
+ test("PlainDateTime en-US", () => {
53
+ let element: ReactTestRenderer;
54
+ act(() => {
55
+ element = create(
56
+ <TemporalRangeFormat
57
+ from={PlainDateTime.from("2022-06-22T14:22")}
58
+ until={PlainDateTime.from("2022-06-22T17:55")}
59
+ locale="en-US"
60
+ />,
61
+ );
62
+ });
63
+ const value = element!.root.children[0];
64
+ expect(value).toBe("6/22/2022, 2:22:00 PM – 5:55:00 PM");
65
+ });
82
66
 
83
- test("PlainTime en-US", () => {
84
- let element: ReactTestRenderer;
85
- act(() => {
86
- element = create(
87
- <TemporalRangeFormat
88
- from={PlainTime.from({hour: 14, minute: 22})}
89
- until={PlainTime.from({hour: 18, minute: 0, second: 3})}
90
- locale="en-US"
91
- />);
92
- });
93
- const value = element!.root.children[0];
94
- expect(value).toBe("2:22:00 PM – 6:00:03 PM");
95
- });
67
+ test("PlainTime de-AT", () => {
68
+ let element: ReactTestRenderer;
69
+ act(() => {
70
+ element = create(
71
+ <TemporalRangeFormat
72
+ from={PlainTime.from({hour: 14, minute: 22})}
73
+ until={PlainTime.from({hour: 18, minute: 0, second: 3})}
74
+ locale="de-AT"
75
+ />,
76
+ );
77
+ });
78
+ const value = element!.root.children[0];
79
+ expect(value).toBe("14:22:00 – 18:00:03");
80
+ });
96
81
 
97
- test("ZonedDateTime de-AT", () => {
98
- let element: ReactTestRenderer;
99
- act(() => {
100
- element = create(
101
- <TemporalRangeFormat
102
- from={ZonedDateTime.from("2022-06-22T14:22[MET]")}
103
- until={ZonedDateTime.from("2022-06-22T19:22[MET]")}
104
- locale="de-AT"
105
- />
106
- );
107
- });
108
- const value = element!.root.children[0];
109
- expect(value).toBe("22.6.2022, 14:22:00 GMT+2 – 19:22:00 GMT+2");
110
- });
82
+ test("PlainTime en-US", () => {
83
+ let element: ReactTestRenderer;
84
+ act(() => {
85
+ element = create(
86
+ <TemporalRangeFormat
87
+ from={PlainTime.from({hour: 14, minute: 22})}
88
+ until={PlainTime.from({hour: 18, minute: 0, second: 3})}
89
+ locale="en-US"
90
+ />,
91
+ );
92
+ });
93
+ const value = element!.root.children[0];
94
+ expect(value).toBe("2:22:00 PM – 6:00:03 PM");
95
+ });
111
96
 
112
- test("ZonedDateTime en-US", () => {
113
- let element: ReactTestRenderer;
114
- act(() => {
115
- element = create(
116
- <TemporalRangeFormat
117
- from={ZonedDateTime.from("2022-06-22T14:22[MET]")}
118
- until={ZonedDateTime.from("2022-06-22T19:22[MET]")}
119
- locale="en-US"
120
- />
121
- );
122
- });
123
- const value = element!.root.children[0];
124
- expect(value).toBe("6/22/2022, 2:22:00 PM GMT+2 – 7:22:00 PM GMT+2");
125
- });
97
+ test("ZonedDateTime de-AT", () => {
98
+ let element: ReactTestRenderer;
99
+ act(() => {
100
+ element = create(
101
+ <TemporalRangeFormat
102
+ from={ZonedDateTime.from("2022-06-22T14:22[MET]")}
103
+ until={ZonedDateTime.from("2022-06-22T19:22[MET]")}
104
+ locale="de-AT"
105
+ />,
106
+ );
107
+ });
108
+ const value = element!.root.children[0];
109
+ expect(value).toBe("22.6.2022, 14:22:00 MESZ – 19:22:00 MESZ");
110
+ });
126
111
 
127
- test("Instant de-AT", () => {
128
- let element: ReactTestRenderer;
129
- act(() => {
130
- element = create(
131
- <TemporalRangeFormat
132
- from={Instant.from("2022-06-22T14:22:11Z")}
133
- until={Instant.from("2024-01-30T08:14:32Z")}
134
- timeZone="Europe/Vienna"
135
- locale="de-AT"
136
- />
137
- );
138
- });
139
- const value = element!.root.children[0];
140
- expect(value).toBe("22.6.2022, 16:22:11 – 30.1.2024, 09:14:32");
141
- });
112
+ test("ZonedDateTime en-US", () => {
113
+ let element: ReactTestRenderer;
114
+ act(() => {
115
+ element = create(
116
+ <TemporalRangeFormat
117
+ from={ZonedDateTime.from("2022-06-22T14:22[MET]")}
118
+ until={ZonedDateTime.from("2022-06-22T19:22[MET]")}
119
+ locale="en-US"
120
+ />,
121
+ );
122
+ });
123
+ const value = element!.root.children[0];
124
+ expect(value).toBe("6/22/2022, 2:22:00 PM GMT+2 – 7:22:00 PM GMT+2");
125
+ });
142
126
 
143
- test("Instant en-US", () => {
144
- let element: ReactTestRenderer;
145
- act(() => {
146
- element = create(
147
- <TemporalRangeFormat
148
- from={Instant.from("2022-06-22T14:22:11Z")}
149
- until={Instant.from("2024-01-30T08:14:32Z")}
150
- locale="en-US"
151
- timeZone="UTC"
152
- />
153
- );
154
- });
155
- const value = element!.root.children[0];
156
- expect(value).toBe("6/22/2022, 2:22:11 PM – 1/30/2024, 8:14:32 AM");
157
- });
127
+ test("Instant de-AT", () => {
128
+ let element: ReactTestRenderer;
129
+ act(() => {
130
+ element = create(
131
+ <TemporalRangeFormat
132
+ from={Instant.from("2022-06-22T14:22:11Z")}
133
+ until={Instant.from("2024-01-30T08:14:32Z")}
134
+ timeZone="Europe/Vienna"
135
+ locale="de-AT"
136
+ />,
137
+ );
138
+ });
139
+ const value = element!.root.children[0];
140
+ expect(value).toBe("22.6.2022, 16:22:11 – 30.1.2024, 09:14:32");
141
+ });
158
142
 
143
+ test("Instant en-US", () => {
144
+ let element: ReactTestRenderer;
145
+ act(() => {
146
+ element = create(
147
+ <TemporalRangeFormat
148
+ from={Instant.from("2022-06-22T14:22:11Z")}
149
+ until={Instant.from("2024-01-30T08:14:32Z")}
150
+ locale="en-US"
151
+ timeZone="UTC"
152
+ />,
153
+ );
154
+ });
155
+ const value = element!.root.children[0];
156
+ expect(value).toBe("6/22/2022, 2:22:11 PM – 1/30/2024, 8:14:32 AM");
157
+ });
159
158
  });
@@ -1,62 +1,62 @@
1
- import {Formattable} from "../temporal";
2
- import {useDateTimeFormat} from "./useDateTimeFormat";
3
1
  import {Fragment, useMemo} from "react";
4
2
  import * as React from "react";
3
+ import {Formattable} from "../temporal";
5
4
  import {DateStyle, TimeStyle} from "./types";
5
+ import {useDateTimeFormat} from "./useDateTimeFormat";
6
6
 
7
7
  export interface TemporalRangeFormatProps {
8
- /**
9
- * The beginning of the temporal range.
10
- */
11
- from: Formattable;
12
-
13
- /**
14
- * The end of the temporal range.
15
- */
16
- until: Formattable;
17
-
18
- /**
19
- * The style of the date format.
20
- */
21
- dateStyle?: DateStyle | undefined;
22
-
23
- /**
24
- * The style of the time format.
25
- */
26
- timeStyle?: TimeStyle | undefined;
27
-
28
- /**
29
- * Overrides the user's locale. Use for testing only.
30
- */
31
- locale?: string;
32
-
33
- /**
34
- * Overrides the user's time zone. Use for testing only.
35
- */
36
- timeZone?: string;
8
+ /**
9
+ * The beginning of the temporal range.
10
+ */
11
+ from: Formattable;
12
+
13
+ /**
14
+ * The end of the temporal range.
15
+ */
16
+ until: Formattable;
17
+
18
+ /**
19
+ * The style of the date format.
20
+ */
21
+ dateStyle?: DateStyle | undefined;
22
+
23
+ /**
24
+ * The style of the time format.
25
+ */
26
+ timeStyle?: TimeStyle | undefined;
27
+
28
+ /**
29
+ * Overrides the user's locale. Use for testing only.
30
+ */
31
+ locale?: string;
32
+
33
+ /**
34
+ * Overrides the user's time zone. Use for testing only.
35
+ */
36
+ timeZone?: string;
37
37
  }
38
38
 
39
39
  export function TemporalRangeFormat(props: TemporalRangeFormatProps) {
40
- const {
41
- from,
42
- until,
43
- dateStyle,
44
- timeStyle,
45
- locale,
46
- timeZone,
47
- } = props;
48
-
49
- const options = useMemo(() => ({
50
- dateStyle,
51
- timeStyle,
52
- timeZone,
53
- }), [dateStyle, timeStyle]);
54
-
55
- const dateTimeFormat = useDateTimeFormat(options, locale);
56
-
57
- const str = useMemo(() => {
58
- return dateTimeFormat.formatRange(from, until);
59
- }, [dateTimeFormat, from, until]);
60
-
61
- return <Fragment>{str}</Fragment>;
62
- }
40
+ const {
41
+ from,
42
+ until,
43
+ dateStyle,
44
+ timeStyle,
45
+ locale,
46
+ timeZone,
47
+ } = props;
48
+
49
+ const options = useMemo(() => ({
50
+ dateStyle,
51
+ timeStyle,
52
+ timeZone,
53
+ }), [dateStyle, timeStyle]);
54
+
55
+ const dateTimeFormat = useDateTimeFormat(options, locale);
56
+
57
+ const str = useMemo(() => {
58
+ return dateTimeFormat.formatRange(from, until);
59
+ }, [dateTimeFormat, from, until]);
60
+
61
+ return <Fragment>{str}</Fragment>;
62
+ }
@@ -1,4 +1,2 @@
1
-
2
-
3
1
  export type DateStyle = "full" | "long" | "medium" | "short";
4
- export type TimeStyle = "full" | "long" | "medium" | "short";
2
+ export type TimeStyle = "full" | "long" | "medium" | "short";
@@ -1,7 +1,10 @@
1
- import {getSupportedFormatLocale} from "../getSupportedFormatLocale";
2
1
  import {useMemo} from "react";
2
+ import {getSupportedFormatLocale} from "../getSupportedFormatLocale";
3
3
  import {DateTimeFormat, DateTimeFormatOptions} from "../temporal";
4
4
 
5
5
  export function useDateTimeFormat(options?: DateTimeFormatOptions, locale?: string) {
6
- return useMemo(() => new DateTimeFormat(locale ?? getSupportedFormatLocale("dateTime"), options), [options, locale]);
6
+ return useMemo(() => new DateTimeFormat(locale ?? getSupportedFormatLocale("dateTime"), options), [
7
+ options,
8
+ locale,
9
+ ]);
7
10
  }
@@ -1,6 +1,6 @@
1
- import {getSupportedFormatLocale} from "../getSupportedFormatLocale";
2
1
  import {useMemo} from "react";
2
+ import {getSupportedFormatLocale} from "../getSupportedFormatLocale";
3
3
 
4
4
  export function useNumberFormat(options?: Intl.NumberFormatOptions, locale?: string) {
5
- return useMemo(() => new Intl.NumberFormat(locale ?? getSupportedFormatLocale("number"), options), [options]);
6
- }
5
+ return useMemo(() => new Intl.NumberFormat(locale ?? getSupportedFormatLocale("number"), options), [options]);
6
+ }