@variocube/app-ui 1.14.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.
- package/README.md +65 -0
- package/esm/AppShell/AppShell.d.ts +12 -0
- package/esm/AppShell/AppShell.js +92 -0
- package/esm/AppShell/AppShell.js.map +1 -0
- package/esm/AppShell/index.d.ts +1 -0
- package/esm/AppShell/index.js +2 -0
- package/esm/AppShell/index.js.map +1 -0
- package/esm/ErrorAlert.d.ts +12 -0
- package/esm/ErrorAlert.js +61 -0
- package/esm/ErrorAlert.js.map +1 -0
- package/esm/Input/ActionsMenu.d.ts +9 -0
- package/esm/Input/ActionsMenu.js +29 -0
- package/esm/Input/ActionsMenu.js.map +1 -0
- package/esm/Input/Checkbox.d.ts +9 -0
- package/esm/Input/Checkbox.js +23 -0
- package/esm/Input/Checkbox.js.map +1 -0
- package/esm/Input/EmailSenderField.d.ts +8 -0
- package/esm/Input/EmailSenderField.js +71 -0
- package/esm/Input/EmailSenderField.js.map +1 -0
- package/esm/Input/NumberField.d.ts +10 -0
- package/esm/Input/NumberField.js +94 -0
- package/esm/Input/NumberField.js.map +1 -0
- package/esm/Input/RadioGroup.d.ts +12 -0
- package/esm/Input/RadioGroup.js +20 -0
- package/esm/Input/RadioGroup.js.map +1 -0
- package/esm/Input/Select.d.ts +11 -0
- package/esm/Input/Select.js +19 -0
- package/esm/Input/Select.js.map +1 -0
- package/esm/Input/Selector.d.ts +10 -0
- package/esm/Input/Selector.js +19 -0
- package/esm/Input/Selector.js.map +1 -0
- package/esm/Input/Switch.d.ts +9 -0
- package/esm/Input/Switch.js +23 -0
- package/esm/Input/Switch.js.map +1 -0
- package/esm/Input/TextField.d.ts +7 -0
- package/esm/Input/TextField.js +58 -0
- package/esm/Input/TextField.js.map +1 -0
- package/esm/Input/UrlUploadField.d.ts +9 -0
- package/esm/Input/UrlUploadField.js +43 -0
- package/esm/Input/UrlUploadField.js.map +1 -0
- package/esm/Input/index.d.ts +9 -0
- package/esm/Input/index.js +10 -0
- package/esm/Input/index.js.map +1 -0
- package/esm/LanguageSwitcher/LanguageSwitcher.d.ts +14 -0
- package/esm/LanguageSwitcher/LanguageSwitcher.js +20 -0
- package/esm/LanguageSwitcher/LanguageSwitcher.js.map +1 -0
- package/esm/LanguageSwitcher/index.d.ts +1 -0
- package/esm/LanguageSwitcher/index.js +2 -0
- package/esm/LanguageSwitcher/index.js.map +1 -0
- package/esm/Paging/Paging.d.ts +40 -0
- package/esm/Paging/Paging.js +43 -0
- package/esm/Paging/Paging.js.map +1 -0
- package/esm/Paging/index.d.ts +1 -0
- package/esm/Paging/index.js +2 -0
- package/esm/Paging/index.js.map +1 -0
- package/esm/VCThemeProvider/JetbrainsMonoFont.d.ts +5 -0
- package/esm/VCThemeProvider/JetbrainsMonoFont.js +52 -0
- package/esm/VCThemeProvider/JetbrainsMonoFont.js.map +1 -0
- package/esm/VCThemeProvider/RobotoFont.d.ts +7 -0
- package/esm/VCThemeProvider/RobotoFont.js +49 -0
- package/esm/VCThemeProvider/RobotoFont.js.map +1 -0
- package/esm/VCThemeProvider/ThemeModeSwitcher.d.ts +2 -0
- package/esm/VCThemeProvider/ThemeModeSwitcher.js +14 -0
- package/esm/VCThemeProvider/ThemeModeSwitcher.js.map +1 -0
- package/esm/VCThemeProvider/VCThemeProvider.d.ts +25 -0
- package/esm/VCThemeProvider/VCThemeProvider.js +173 -0
- package/esm/VCThemeProvider/VCThemeProvider.js.map +1 -0
- package/esm/VCThemeProvider/code-colors.d.ts +108 -0
- package/esm/VCThemeProvider/code-colors.js +26 -0
- package/esm/VCThemeProvider/code-colors.js.map +1 -0
- package/esm/VCThemeProvider/index.d.ts +5 -0
- package/esm/VCThemeProvider/index.js +6 -0
- package/esm/VCThemeProvider/index.js.map +1 -0
- package/esm/audit/AuditChanges.d.ts +9 -0
- package/esm/audit/AuditChanges.js +43 -0
- package/esm/audit/AuditChanges.js.map +1 -0
- package/esm/audit/AuditTimeline.d.ts +6 -0
- package/esm/audit/AuditTimeline.js +13 -0
- package/esm/audit/AuditTimeline.js.map +1 -0
- package/esm/audit/AuditTimelineItem.d.ts +10 -0
- package/esm/audit/AuditTimelineItem.js +27 -0
- package/esm/audit/AuditTimelineItem.js.map +1 -0
- package/esm/audit/index.d.ts +4 -0
- package/esm/audit/index.js +5 -0
- package/esm/audit/index.js.map +1 -0
- package/esm/audit/types.d.ts +42 -0
- package/esm/audit/types.js +2 -0
- package/esm/audit/types.js.map +1 -0
- package/esm/breadcrumbs.d.ts +6 -0
- package/esm/breadcrumbs.js +13 -0
- package/esm/breadcrumbs.js.map +1 -0
- package/esm/code/Code.d.ts +10 -0
- package/esm/code/Code.js +19 -0
- package/esm/code/Code.js.map +1 -0
- package/esm/code/CodeBlock.d.ts +4 -0
- package/esm/code/CodeBlock.js +6 -0
- package/esm/code/CodeBlock.js.map +1 -0
- package/esm/code/Json.d.ts +4 -0
- package/esm/code/Json.js +60 -0
- package/esm/code/Json.js.map +1 -0
- package/esm/code/index.d.ts +3 -0
- package/esm/code/index.js +4 -0
- package/esm/code/index.js.map +1 -0
- package/esm/confirm/ConfirmButton.d.ts +16 -0
- package/esm/confirm/ConfirmButton.js +29 -0
- package/esm/confirm/ConfirmButton.js.map +1 -0
- package/esm/confirm/ConfirmDialog.d.ts +16 -0
- package/esm/confirm/ConfirmDialog.js +35 -0
- package/esm/confirm/ConfirmDialog.js.map +1 -0
- package/esm/confirm/ConfirmIconButton.d.ts +14 -0
- package/esm/confirm/ConfirmIconButton.js +29 -0
- package/esm/confirm/ConfirmIconButton.js.map +1 -0
- package/esm/confirm/ConfirmMenuItem.d.ts +15 -0
- package/esm/confirm/ConfirmMenuItem.js +31 -0
- package/esm/confirm/ConfirmMenuItem.js.map +1 -0
- package/esm/confirm/index.d.ts +4 -0
- package/esm/confirm/index.js +5 -0
- package/esm/confirm/index.js.map +1 -0
- package/esm/container/ContainerLayout.d.ts +8 -0
- package/esm/container/ContainerLayout.js +20 -0
- package/esm/container/ContainerLayout.js.map +1 -0
- package/esm/container/ContainerSettingsContext.d.ts +12 -0
- package/esm/container/ContainerSettingsContext.js +46 -0
- package/esm/container/ContainerSettingsContext.js.map +1 -0
- package/esm/container/ContainerWidthControl.d.ts +6 -0
- package/esm/container/ContainerWidthControl.js +12 -0
- package/esm/container/ContainerWidthControl.js.map +1 -0
- package/esm/container/index.d.ts +3 -0
- package/esm/container/index.js +4 -0
- package/esm/container/index.js.map +1 -0
- package/esm/content-table/ContentTable.d.ts +25 -0
- package/esm/content-table/ContentTable.js +87 -0
- package/esm/content-table/ContentTable.js.map +1 -0
- package/esm/content-table/UndrawEmpty.d.ts +2 -0
- package/esm/content-table/UndrawEmpty.js +71 -0
- package/esm/content-table/UndrawEmpty.js.map +1 -0
- package/esm/content-table/index.d.ts +1 -0
- package/esm/content-table/index.js +2 -0
- package/esm/content-table/index.js.map +1 -0
- package/esm/country/countries.d.ts +34 -0
- package/esm/country/countries.js +266 -0
- package/esm/country/countries.js.map +1 -0
- package/esm/country/country-select.d.ts +8 -0
- package/esm/country/country-select.js +18 -0
- package/esm/country/country-select.js.map +1 -0
- package/esm/country/index.d.ts +5 -0
- package/esm/country/index.js +6 -0
- package/esm/country/index.js.map +1 -0
- package/esm/country/locale-select.d.ts +9 -0
- package/esm/country/locale-select.js +15 -0
- package/esm/country/locale-select.js.map +1 -0
- package/esm/country/locales.d.ts +10 -0
- package/esm/country/locales.js +190 -0
- package/esm/country/locales.js.map +1 -0
- package/esm/country/phone-prefix-select.d.ts +9 -0
- package/esm/country/phone-prefix-select.js +18 -0
- package/esm/country/phone-prefix-select.js.map +1 -0
- package/esm/cube/BoxFeatures.d.ts +11 -0
- package/esm/cube/BoxFeatures.js +40 -0
- package/esm/cube/BoxFeatures.js.map +1 -0
- package/esm/cube/BoxMaintenanceChip.d.ts +9 -0
- package/esm/cube/BoxMaintenanceChip.js +15 -0
- package/esm/cube/BoxMaintenanceChip.js.map +1 -0
- package/esm/cube/BoxNumber.d.ts +6 -0
- package/esm/cube/BoxNumber.js +6 -0
- package/esm/cube/BoxNumber.js.map +1 -0
- package/esm/cube/BoxType.d.ts +7 -0
- package/esm/cube/BoxType.js +21 -0
- package/esm/cube/BoxType.js.map +1 -0
- package/esm/cube/CubeConnectedChip.d.ts +9 -0
- package/esm/cube/CubeConnectedChip.js +22 -0
- package/esm/cube/CubeConnectedChip.js.map +1 -0
- package/esm/cube/LockStatusChip.d.ts +11 -0
- package/esm/cube/LockStatusChip.js +40 -0
- package/esm/cube/LockStatusChip.js.map +1 -0
- package/esm/cube/UtilizationBar.d.ts +11 -0
- package/esm/cube/UtilizationBar.js +38 -0
- package/esm/cube/UtilizationBar.js.map +1 -0
- package/esm/cube/accessibility.d.ts +48 -0
- package/esm/cube/accessibility.js +242 -0
- package/esm/cube/accessibility.js.map +1 -0
- package/esm/cube/index.d.ts +8 -0
- package/esm/cube/index.js +9 -0
- package/esm/cube/index.js.map +1 -0
- package/esm/data-table/DataTable.d.ts +63 -0
- package/esm/data-table/DataTable.js +124 -0
- package/esm/data-table/DataTable.js.map +1 -0
- package/esm/data-table/DataTableColumnSettings.d.ts +10 -0
- package/esm/data-table/DataTableColumnSettings.js +98 -0
- package/esm/data-table/DataTableColumnSettings.js.map +1 -0
- package/esm/data-table/DataTableHeader.d.ts +2 -0
- package/esm/data-table/DataTableHeader.js +6 -0
- package/esm/data-table/DataTableHeader.js.map +1 -0
- package/esm/data-table/DataTableToolbar.d.ts +2 -0
- package/esm/data-table/DataTableToolbar.js +6 -0
- package/esm/data-table/DataTableToolbar.js.map +1 -0
- package/esm/data-table/index.d.ts +8 -0
- package/esm/data-table/index.js +9 -0
- package/esm/data-table/index.js.map +1 -0
- package/esm/data-table/useDataTableColumnStorage.d.ts +5 -0
- package/esm/data-table/useDataTableColumnStorage.js +20 -0
- package/esm/data-table/useDataTableColumnStorage.js.map +1 -0
- package/esm/data-table/useDataTableStorage.d.ts +16 -0
- package/esm/data-table/useDataTableStorage.js +19 -0
- package/esm/data-table/useDataTableStorage.js.map +1 -0
- package/esm/data-table/useSpringPage.d.ts +6 -0
- package/esm/data-table/useSpringPage.js +18 -0
- package/esm/data-table/useSpringPage.js.map +1 -0
- package/esm/data-table/useSpringPageable.d.ts +9 -0
- package/esm/data-table/useSpringPageable.js +10 -0
- package/esm/data-table/useSpringPageable.js.map +1 -0
- package/esm/date-pickers/PlainAdapterCommon.d.ts +31 -0
- package/esm/date-pickers/PlainAdapterCommon.js +97 -0
- package/esm/date-pickers/PlainAdapterCommon.js.map +1 -0
- package/esm/date-pickers/PlainDateAdapter.d.ts +30 -0
- package/esm/date-pickers/PlainDateAdapter.js +114 -0
- package/esm/date-pickers/PlainDateAdapter.js.map +1 -0
- package/esm/date-pickers/PlainDatePicker.d.ts +21 -0
- package/esm/date-pickers/PlainDatePicker.js +26 -0
- package/esm/date-pickers/PlainDatePicker.js.map +1 -0
- package/esm/date-pickers/PlainDatePicker.spec.d.ts +1 -0
- package/esm/date-pickers/PlainDatePicker.spec.js +15 -0
- package/esm/date-pickers/PlainDatePicker.spec.js.map +1 -0
- package/esm/date-pickers/PlainDateTimeAdapter.d.ts +30 -0
- package/esm/date-pickers/PlainDateTimeAdapter.js +114 -0
- package/esm/date-pickers/PlainDateTimeAdapter.js.map +1 -0
- package/esm/date-pickers/PlainDateTimePicker.d.ts +20 -0
- package/esm/date-pickers/PlainDateTimePicker.js +26 -0
- package/esm/date-pickers/PlainDateTimePicker.js.map +1 -0
- package/esm/date-pickers/PlainDateTimePicker.spec.d.ts +1 -0
- package/esm/date-pickers/PlainDateTimePicker.spec.js +15 -0
- package/esm/date-pickers/PlainDateTimePicker.spec.js.map +1 -0
- package/esm/date-pickers/PlainTimeAdapter.d.ts +58 -0
- package/esm/date-pickers/PlainTimeAdapter.js +194 -0
- package/esm/date-pickers/PlainTimeAdapter.js.map +1 -0
- package/esm/date-pickers/PlainTimePicker.d.ts +16 -0
- package/esm/date-pickers/PlainTimePicker.js +24 -0
- package/esm/date-pickers/PlainTimePicker.js.map +1 -0
- package/esm/date-pickers/PlainTimePicker.spec.d.ts +1 -0
- package/esm/date-pickers/PlainTimePicker.spec.js +15 -0
- package/esm/date-pickers/PlainTimePicker.spec.js.map +1 -0
- package/esm/date-pickers/TemporalAdapter.d.ts +18 -0
- package/esm/date-pickers/TemporalAdapter.js +109 -0
- package/esm/date-pickers/TemporalAdapter.js.map +1 -0
- package/esm/date-pickers/TimezoneSelect.d.ts +9 -0
- package/esm/date-pickers/TimezoneSelect.js +357 -0
- package/esm/date-pickers/TimezoneSelect.js.map +1 -0
- package/esm/date-pickers/getFormatString.d.ts +11 -0
- package/esm/date-pickers/getFormatString.js +26 -0
- package/esm/date-pickers/getFormatString.js.map +1 -0
- package/esm/date-pickers/index.d.ts +5 -0
- package/esm/date-pickers/index.js +6 -0
- package/esm/date-pickers/index.js.map +1 -0
- package/esm/date-pickers/parse.d.ts +4 -0
- package/esm/date-pickers/parse.js +66 -0
- package/esm/date-pickers/parse.js.map +1 -0
- package/esm/date-pickers/timeframe-picker.d.ts +46 -0
- package/esm/date-pickers/timeframe-picker.js +120 -0
- package/esm/date-pickers/timeframe-picker.js.map +1 -0
- package/esm/date-pickers/useLocale.d.ts +1 -0
- package/esm/date-pickers/useLocale.js +6 -0
- package/esm/date-pickers/useLocale.js.map +1 -0
- package/esm/date-pickers/useRenderInput.d.ts +4 -0
- package/esm/date-pickers/useRenderInput.js +8 -0
- package/esm/date-pickers/useRenderInput.js.map +1 -0
- package/esm/fetch.d.ts +51 -0
- package/esm/fetch.js +138 -0
- package/esm/fetch.js.map +1 -0
- package/esm/filter/Filter.d.ts +38 -0
- package/esm/filter/Filter.js +72 -0
- package/esm/filter/Filter.js.map +1 -0
- package/esm/filter/index.d.ts +1 -0
- package/esm/filter/index.js +2 -0
- package/esm/filter/index.js.map +1 -0
- package/esm/formats/CompactFormat.d.ts +22 -0
- package/esm/formats/CompactFormat.js +21 -0
- package/esm/formats/CompactFormat.js.map +1 -0
- package/esm/formats/CompactFormat.spec.d.ts +1 -0
- package/esm/formats/CompactFormat.spec.js +22 -0
- package/esm/formats/CompactFormat.spec.js.map +1 -0
- package/esm/formats/CurrencyFormat.d.ts +39 -0
- package/esm/formats/CurrencyFormat.js +25 -0
- package/esm/formats/CurrencyFormat.js.map +1 -0
- package/esm/formats/CurrencyFormat.spec.d.ts +1 -0
- package/esm/formats/CurrencyFormat.spec.js +22 -0
- package/esm/formats/CurrencyFormat.spec.js.map +1 -0
- package/esm/formats/DecimalFormat.d.ts +29 -0
- package/esm/formats/DecimalFormat.js +22 -0
- package/esm/formats/DecimalFormat.js.map +1 -0
- package/esm/formats/DecimalFormat.spec.d.ts +1 -0
- package/esm/formats/DecimalFormat.spec.js +22 -0
- package/esm/formats/DecimalFormat.spec.js.map +1 -0
- package/esm/formats/DurationFormat.d.ts +23 -0
- package/esm/formats/DurationFormat.js +35 -0
- package/esm/formats/DurationFormat.js.map +1 -0
- package/esm/formats/DurationFormat.spec.d.ts +1 -0
- package/esm/formats/DurationFormat.spec.js +52 -0
- package/esm/formats/DurationFormat.spec.js.map +1 -0
- package/esm/formats/RelativeTemporalFormat.d.ts +22 -0
- package/esm/formats/RelativeTemporalFormat.js +57 -0
- package/esm/formats/RelativeTemporalFormat.js.map +1 -0
- package/esm/formats/RelativeTemporalFormat.spec.d.ts +1 -0
- package/esm/formats/RelativeTemporalFormat.spec.js +77 -0
- package/esm/formats/RelativeTemporalFormat.spec.js.map +1 -0
- package/esm/formats/SwitchableTemporalFormat.d.ts +5 -0
- package/esm/formats/SwitchableTemporalFormat.js +11 -0
- package/esm/formats/SwitchableTemporalFormat.js.map +1 -0
- package/esm/formats/TemporalFormat.d.ts +27 -0
- package/esm/formats/TemporalFormat.js +19 -0
- package/esm/formats/TemporalFormat.js.map +1 -0
- package/esm/formats/TemporalFormat.spec.d.ts +1 -0
- package/esm/formats/TemporalFormat.spec.js +87 -0
- package/esm/formats/TemporalFormat.spec.js.map +1 -0
- package/esm/formats/TemporalRangeFormat.d.ts +30 -0
- package/esm/formats/TemporalRangeFormat.js +17 -0
- package/esm/formats/TemporalRangeFormat.js.map +1 -0
- package/esm/formats/TemporalRangeFormat.spec.d.ts +1 -0
- package/esm/formats/TemporalRangeFormat.spec.js +87 -0
- package/esm/formats/TemporalRangeFormat.spec.js.map +1 -0
- package/esm/formats/index.d.ts +8 -0
- package/esm/formats/index.js +9 -0
- package/esm/formats/index.js.map +1 -0
- package/esm/formats/types.d.ts +2 -0
- package/esm/formats/types.js +2 -0
- package/esm/formats/types.js.map +1 -0
- package/esm/formats/useDateTimeFormat.d.ts +2 -0
- package/esm/formats/useDateTimeFormat.js +7 -0
- package/esm/formats/useDateTimeFormat.js.map +1 -0
- package/esm/formats/useNumberFormat.d.ts +1 -0
- package/esm/formats/useNumberFormat.js +6 -0
- package/esm/formats/useNumberFormat.js.map +1 -0
- package/esm/formats/useRelativeTimeFormat.d.ts +1 -0
- package/esm/formats/useRelativeTimeFormat.js +6 -0
- package/esm/formats/useRelativeTimeFormat.js.map +1 -0
- package/esm/forms/EditForm.d.ts +13 -0
- package/esm/forms/EditForm.js +22 -0
- package/esm/forms/EditForm.js.map +1 -0
- package/esm/forms/SearchForm.d.ts +7 -0
- package/esm/forms/SearchForm.js +36 -0
- package/esm/forms/SearchForm.js.map +1 -0
- package/esm/forms/SubmitButton.d.ts +9 -0
- package/esm/forms/SubmitButton.js +28 -0
- package/esm/forms/SubmitButton.js.map +1 -0
- package/esm/forms/index.d.ts +4 -0
- package/esm/forms/index.js +5 -0
- package/esm/forms/index.js.map +1 -0
- package/esm/forms/useFormSubmit.d.ts +12 -0
- package/esm/forms/useFormSubmit.js +28 -0
- package/esm/forms/useFormSubmit.js.map +1 -0
- package/esm/getNavigatorLanguages.d.ts +5 -0
- package/esm/getNavigatorLanguages.js +11 -0
- package/esm/getNavigatorLanguages.js.map +1 -0
- package/esm/getSupportedFormatLocale.d.ts +19 -0
- package/esm/getSupportedFormatLocale.js +21 -0
- package/esm/getSupportedFormatLocale.js.map +1 -0
- package/esm/help/HelpButton.d.ts +12 -0
- package/esm/help/HelpButton.js +74 -0
- package/esm/help/HelpButton.js.map +1 -0
- package/esm/help/HelpDrawer.d.ts +3 -0
- package/esm/help/HelpDrawer.js +48 -0
- package/esm/help/HelpDrawer.js.map +1 -0
- package/esm/help/HelpSettingsContext.d.ts +26 -0
- package/esm/help/HelpSettingsContext.js +94 -0
- package/esm/help/HelpSettingsContext.js.map +1 -0
- package/esm/help/index.d.ts +3 -0
- package/esm/help/index.js +4 -0
- package/esm/help/index.js.map +1 -0
- package/esm/icons.d.ts +21 -0
- package/esm/icons.js +22 -0
- package/esm/icons.js.map +1 -0
- package/esm/index.d.ts +34 -0
- package/esm/index.js +35 -0
- package/esm/index.js.map +1 -0
- package/esm/layout/ErrorBoundary.d.ts +46 -0
- package/esm/layout/ErrorBoundary.js +186 -0
- package/esm/layout/ErrorBoundary.js.map +1 -0
- package/esm/layout/NotFound.d.ts +9 -0
- package/esm/layout/NotFound.js +26 -0
- package/esm/layout/NotFound.js.map +1 -0
- package/esm/layout/NotFoundSvg.d.ts +2 -0
- package/esm/layout/NotFoundSvg.js +37 -0
- package/esm/layout/NotFoundSvg.js.map +1 -0
- package/esm/layout/UserNav.d.ts +15 -0
- package/esm/layout/UserNav.js +50 -0
- package/esm/layout/UserNav.js.map +1 -0
- package/esm/layout/index.d.ts +5 -0
- package/esm/layout/index.js +6 -0
- package/esm/layout/index.js.map +1 -0
- package/esm/layout/layout-context.d.ts +9 -0
- package/esm/layout/layout-context.js +23 -0
- package/esm/layout/layout-context.js.map +1 -0
- package/esm/layout/page-title.d.ts +7 -0
- package/esm/layout/page-title.js +41 -0
- package/esm/layout/page-title.js.map +1 -0
- package/esm/list/List.d.ts +14 -0
- package/esm/list/List.js +25 -0
- package/esm/list/List.js.map +1 -0
- package/esm/list/SkeletonListItem.d.ts +14 -0
- package/esm/list/SkeletonListItem.js +11 -0
- package/esm/list/SkeletonListItem.js.map +1 -0
- package/esm/list/index.d.ts +1 -0
- package/esm/list/index.js +2 -0
- package/esm/list/index.js.map +1 -0
- package/esm/localization.d.ts +140 -0
- package/esm/localization.js +200 -0
- package/esm/localization.js.map +1 -0
- package/esm/logo/Logo.d.ts +7 -0
- package/esm/logo/Logo.js +29 -0
- package/esm/logo/Logo.js.map +1 -0
- package/esm/logo/VCAppLogo.d.ts +7 -0
- package/esm/logo/VCAppLogo.js +28 -0
- package/esm/logo/VCAppLogo.js.map +1 -0
- package/esm/logo/VCLogo.d.ts +4 -0
- package/esm/logo/VCLogo.js +33 -0
- package/esm/logo/VCLogo.js.map +1 -0
- package/esm/logo/VCLogoIcon.d.ts +4 -0
- package/esm/logo/VCLogoIcon.js +36 -0
- package/esm/logo/VCLogoIcon.js.map +1 -0
- package/esm/logo/index.d.ts +4 -0
- package/esm/logo/index.js +5 -0
- package/esm/logo/index.js.map +1 -0
- package/esm/splash/index.d.ts +3 -0
- package/esm/splash/index.js +37 -0
- package/esm/splash/index.js.map +1 -0
- package/esm/spring.d.ts +14 -0
- package/esm/spring.js +2 -0
- package/esm/spring.js.map +1 -0
- package/esm/storage/MemoryStorage.d.ts +7 -0
- package/esm/storage/MemoryStorage.js +18 -0
- package/esm/storage/MemoryStorage.js.map +1 -0
- package/esm/storage/index.d.ts +2 -0
- package/esm/storage/index.js +3 -0
- package/esm/storage/index.js.map +1 -0
- package/esm/storage/storage.d.ts +16 -0
- package/esm/storage/storage.js +87 -0
- package/esm/storage/storage.js.map +1 -0
- package/esm/storage/useStorage.d.ts +1 -0
- package/esm/storage/useStorage.js +29 -0
- package/esm/storage/useStorage.js.map +1 -0
- package/esm/tabs/Tabs.d.ts +10 -0
- package/esm/tabs/Tabs.js +95 -0
- package/esm/tabs/Tabs.js.map +1 -0
- package/esm/tabs/index.d.ts +1 -0
- package/esm/tabs/index.js +2 -0
- package/esm/tabs/index.js.map +1 -0
- package/esm/temporal/index.d.ts +2 -0
- package/esm/temporal/index.js +3 -0
- package/esm/temporal/index.js.map +1 -0
- package/esm/temporal/parse.d.ts +4 -0
- package/esm/temporal/parse.js +25 -0
- package/esm/temporal/parse.js.map +1 -0
- package/esm/temporal/polyfill.d.ts +34 -0
- package/esm/temporal/polyfill.js +10 -0
- package/esm/temporal/polyfill.js.map +1 -0
- package/esm/utils/defined.d.ts +1 -0
- package/esm/utils/defined.js +4 -0
- package/esm/utils/defined.js.map +1 -0
- package/esm/utils/index.d.ts +3 -0
- package/esm/utils/index.js +4 -0
- package/esm/utils/index.js.map +1 -0
- package/esm/utils/useFlag.d.ts +1 -0
- package/esm/utils/useFlag.js +9 -0
- package/esm/utils/useFlag.js.map +1 -0
- package/esm/utils/useIsMounted.d.ts +1 -0
- package/esm/utils/useIsMounted.js +12 -0
- package/esm/utils/useIsMounted.js.map +1 -0
- package/esm/view/View.d.ts +9 -0
- package/esm/view/View.js +22 -0
- package/esm/view/View.js.map +1 -0
- package/esm/view/ViewHeader.d.ts +10 -0
- package/esm/view/ViewHeader.js +15 -0
- package/esm/view/ViewHeader.js.map +1 -0
- package/esm/view/index.d.ts +2 -0
- package/esm/view/index.js +3 -0
- package/esm/view/index.js.map +1 -0
- package/package.json +72 -0
- package/src/AppShell/AppShell.tsx +165 -0
- package/src/AppShell/index.tsx +1 -0
- package/src/ErrorAlert.tsx +71 -0
- package/src/Input/ActionsMenu.tsx +102 -0
- package/src/Input/Checkbox.tsx +33 -0
- package/src/Input/EmailSenderField.tsx +64 -0
- package/src/Input/NumberField.tsx +127 -0
- package/src/Input/RadioGroup.tsx +37 -0
- package/src/Input/Select.tsx +33 -0
- package/src/Input/Selector.tsx +21 -0
- package/src/Input/Switch.tsx +33 -0
- package/src/Input/TextField.tsx +69 -0
- package/src/Input/UrlUploadField.tsx +84 -0
- package/src/Input/index.ts +9 -0
- package/src/LanguageSwitcher/LanguageSwitcher.tsx +63 -0
- package/src/LanguageSwitcher/index.ts +1 -0
- package/src/Paging/Paging.ts +77 -0
- package/src/Paging/index.ts +1 -0
- package/src/VCThemeProvider/JetbrainsMonoFont.tsx +55 -0
- package/src/VCThemeProvider/RobotoFont.tsx +52 -0
- package/src/VCThemeProvider/ThemeModeSwitcher.tsx +23 -0
- package/src/VCThemeProvider/VCThemeProvider.tsx +232 -0
- package/src/VCThemeProvider/code-colors.ts +34 -0
- package/src/VCThemeProvider/files.d.ts +2 -0
- package/src/VCThemeProvider/index.ts +5 -0
- package/src/audit/AuditChanges.tsx +82 -0
- package/src/audit/AuditTimeline.tsx +25 -0
- package/src/audit/AuditTimelineItem.tsx +75 -0
- package/src/audit/index.ts +4 -0
- package/src/audit/types.ts +46 -0
- package/src/breadcrumbs.tsx +27 -0
- package/src/code/Code.tsx +53 -0
- package/src/code/CodeBlock.tsx +15 -0
- package/src/code/Json.tsx +73 -0
- package/src/code/index.ts +3 -0
- package/src/confirm/ConfirmButton.tsx +69 -0
- package/src/confirm/ConfirmDialog.tsx +68 -0
- package/src/confirm/ConfirmIconButton.tsx +62 -0
- package/src/confirm/ConfirmMenuItem.tsx +66 -0
- package/src/confirm/index.ts +4 -0
- package/src/container/ContainerLayout.tsx +40 -0
- package/src/container/ContainerSettingsContext.tsx +77 -0
- package/src/container/ContainerWidthControl.tsx +20 -0
- package/src/container/index.ts +3 -0
- package/src/content-table/ContentTable.tsx +214 -0
- package/src/content-table/UndrawEmpty.tsx +285 -0
- package/src/content-table/index.ts +1 -0
- package/src/country/countries.ts +268 -0
- package/src/country/country-select.tsx +48 -0
- package/src/country/index.ts +5 -0
- package/src/country/locale-select.tsx +43 -0
- package/src/country/locales.ts +192 -0
- package/src/country/phone-prefix-select.tsx +50 -0
- package/src/cube/BoxFeatures.tsx +91 -0
- package/src/cube/BoxMaintenanceChip.tsx +33 -0
- package/src/cube/BoxNumber.tsx +10 -0
- package/src/cube/BoxType.tsx +22 -0
- package/src/cube/CubeConnectedChip.tsx +16 -0
- package/src/cube/LockStatusChip.tsx +54 -0
- package/src/cube/UtilizationBar.tsx +94 -0
- package/src/cube/accessibility.tsx +422 -0
- package/src/cube/index.tsx +8 -0
- package/src/data-table/DataTable.tsx +338 -0
- package/src/data-table/DataTableColumnSettings.tsx +204 -0
- package/src/data-table/DataTableHeader.tsx +10 -0
- package/src/data-table/DataTableToolbar.tsx +10 -0
- package/src/data-table/index.tsx +8 -0
- package/src/data-table/useDataTableColumnStorage.ts +26 -0
- package/src/data-table/useDataTableStorage.ts +43 -0
- package/src/data-table/useSpringPage.ts +21 -0
- package/src/data-table/useSpringPageable.ts +25 -0
- package/src/date-pickers/PlainAdapterCommon.ts +125 -0
- package/src/date-pickers/PlainDateAdapter.spec.ts +50 -0
- package/src/date-pickers/PlainDateAdapter.ts +139 -0
- package/src/date-pickers/PlainDatePicker.spec.tsx +22 -0
- package/src/date-pickers/PlainDatePicker.tsx +73 -0
- package/src/date-pickers/PlainDateTimeAdapter.spec.ts +50 -0
- package/src/date-pickers/PlainDateTimeAdapter.ts +140 -0
- package/src/date-pickers/PlainDateTimePicker.spec.tsx +22 -0
- package/src/date-pickers/PlainDateTimePicker.tsx +65 -0
- package/src/date-pickers/PlainTimeAdapter.ts +247 -0
- package/src/date-pickers/PlainTimePicker.spec.tsx +22 -0
- package/src/date-pickers/PlainTimePicker.tsx +45 -0
- package/src/date-pickers/TemporalAdapter.ts +150 -0
- package/src/date-pickers/TimezoneSelect.tsx +387 -0
- package/src/date-pickers/getFormatString.ts +38 -0
- package/src/date-pickers/index.ts +5 -0
- package/src/date-pickers/parse.spec.ts +43 -0
- package/src/date-pickers/parse.ts +72 -0
- package/src/date-pickers/timeframe-picker.tsx +202 -0
- package/src/date-pickers/useLocale.ts +6 -0
- package/src/date-pickers/useRenderInput.tsx +20 -0
- package/src/fetch.spec.ts +85 -0
- package/src/fetch.ts +165 -0
- package/src/filter/Filter.tsx +194 -0
- package/src/filter/index.ts +1 -0
- package/src/formats/CompactFormat.spec.tsx +25 -0
- package/src/formats/CompactFormat.tsx +48 -0
- package/src/formats/CurrencyFormat.spec.tsx +25 -0
- package/src/formats/CurrencyFormat.tsx +77 -0
- package/src/formats/DecimalFormat.spec.tsx +25 -0
- package/src/formats/DecimalFormat.tsx +59 -0
- package/src/formats/DurationFormat.spec.tsx +57 -0
- package/src/formats/DurationFormat.tsx +72 -0
- package/src/formats/RelativeTemporalFormat.spec.tsx +84 -0
- package/src/formats/RelativeTemporalFormat.tsx +86 -0
- package/src/formats/SwitchableTemporalFormat.tsx +17 -0
- package/src/formats/TemporalFormat.spec.tsx +110 -0
- package/src/formats/TemporalFormat.tsx +58 -0
- package/src/formats/TemporalRangeFormat.spec.tsx +159 -0
- package/src/formats/TemporalRangeFormat.tsx +62 -0
- package/src/formats/index.ts +8 -0
- package/src/formats/types.ts +4 -0
- package/src/formats/useDateTimeFormat.ts +7 -0
- package/src/formats/useNumberFormat.ts +6 -0
- package/src/formats/useRelativeTimeFormat.ts +6 -0
- package/src/forms/EditForm.tsx +69 -0
- package/src/forms/SearchForm.tsx +51 -0
- package/src/forms/SubmitButton.tsx +34 -0
- package/src/forms/index.ts +4 -0
- package/src/forms/useFormSubmit.tsx +28 -0
- package/src/getNavigatorLanguages.ts +11 -0
- package/src/getSupportedFormatLocale.ts +24 -0
- package/src/help/HelpButton.tsx +134 -0
- package/src/help/HelpDrawer.tsx +65 -0
- package/src/help/HelpSettingsContext.tsx +178 -0
- package/src/help/index.ts +3 -0
- package/src/icons.ts +23 -0
- package/src/index.ts +34 -0
- package/src/layout/ErrorBoundary.tsx +232 -0
- package/src/layout/NotFound.tsx +51 -0
- package/src/layout/NotFoundSvg.tsx +172 -0
- package/src/layout/UserNav.tsx +107 -0
- package/src/layout/index.ts +5 -0
- package/src/layout/layout-context.tsx +40 -0
- package/src/layout/page-title.tsx +33 -0
- package/src/list/List.tsx +40 -0
- package/src/list/SkeletonListItem.tsx +50 -0
- package/src/list/index.tsx +1 -0
- package/src/localization.tsx +404 -0
- package/src/logo/Logo.tsx +35 -0
- package/src/logo/VCAppLogo.tsx +28 -0
- package/src/logo/VCLogo.tsx +56 -0
- package/src/logo/VCLogoIcon.tsx +55 -0
- package/src/logo/V_C_LOGO.svg +1 -0
- package/src/logo/V_C_LOGO_ICON.svg +1 -0
- package/src/logo/V_C_LOGO_ICON_WHITE.svg +1 -0
- package/src/logo/V_C_LOGO_WHITE.svg +1 -0
- package/src/logo/index.tsx +4 -0
- package/src/splash/index.tsx +34 -0
- package/src/splash/template.html +86 -0
- package/src/spring.ts +15 -0
- package/src/storage/MemoryStorage.ts +21 -0
- package/src/storage/index.ts +2 -0
- package/src/storage/storage.ts +97 -0
- package/src/storage/useStorage.ts +35 -0
- package/src/tabs/Tabs.tsx +187 -0
- package/src/tabs/index.ts +1 -0
- package/src/temporal/index.ts +2 -0
- package/src/temporal/parse.ts +29 -0
- package/src/temporal/polyfill.ts +36 -0
- package/src/utils/defined.ts +4 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/useFlag.ts +9 -0
- package/src/utils/useIsMounted.ts +12 -0
- package/src/view/View.tsx +22 -0
- package/src/view/ViewHeader.tsx +35 -0
- package/src/view/index.ts +2 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import {Now, PlainDate, tryParsePlainDate} from "../temporal";
|
|
2
|
+
import React, {ChangeEvent, useEffect} from "react";
|
|
3
|
+
import {Box, Grid, MenuItem, TextField} from "@mui/material";
|
|
4
|
+
import {PlainDatePicker} from "./PlainDatePicker";
|
|
5
|
+
|
|
6
|
+
export enum TimeFrameType {
|
|
7
|
+
All = "All",
|
|
8
|
+
Today = "Today",
|
|
9
|
+
Yesterday = "Yesterday",
|
|
10
|
+
Last7Days = "Last7Days",
|
|
11
|
+
LastWeek = "LastWeek",
|
|
12
|
+
ThisMonth = "ThisMonth",
|
|
13
|
+
LastMonth = "LastMonth",
|
|
14
|
+
Last3Months = "Last3Months",
|
|
15
|
+
LastYear = "LastYear",
|
|
16
|
+
Custom = "Custom",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface FilterTimeFrame {
|
|
20
|
+
type: TimeFrameType;
|
|
21
|
+
from?: string | null;
|
|
22
|
+
until?: string | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface TimeFrameSelectProps {
|
|
26
|
+
value: FilterTimeFrame;
|
|
27
|
+
onChange: (value: FilterTimeFrame) => void;
|
|
28
|
+
i18n?: {
|
|
29
|
+
timeframeTitle?: string;
|
|
30
|
+
from?: string;
|
|
31
|
+
until?: string;
|
|
32
|
+
types?: {
|
|
33
|
+
All?: string;
|
|
34
|
+
Today?: string;
|
|
35
|
+
Yesterday?: string;
|
|
36
|
+
Last7Days?: string;
|
|
37
|
+
LastWeek?: string;
|
|
38
|
+
ThisMonth?: string;
|
|
39
|
+
LastMonth?: string;
|
|
40
|
+
Last3Months?: string;
|
|
41
|
+
LastYear?: string;
|
|
42
|
+
Custom?: string;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function TimeframePicker({value, onChange, i18n}: TimeFrameSelectProps) {
|
|
48
|
+
const {
|
|
49
|
+
type,
|
|
50
|
+
from,
|
|
51
|
+
until
|
|
52
|
+
} = value;
|
|
53
|
+
|
|
54
|
+
const fromPlainDate = tryParsePlainDate(from) ?? null;
|
|
55
|
+
const untilPlainDate = tryParsePlainDate(until) ?? null;
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const {from, until} = computeFromUntil(type, fromPlainDate, untilPlainDate);
|
|
59
|
+
onChange({
|
|
60
|
+
type,
|
|
61
|
+
from: from?.toString(),
|
|
62
|
+
until: until?.toString(),
|
|
63
|
+
});
|
|
64
|
+
}, [type, from, until]);
|
|
65
|
+
|
|
66
|
+
function handleTypeChange(event: ChangeEvent<HTMLInputElement>) {
|
|
67
|
+
const type = event.target.value as TimeFrameType;
|
|
68
|
+
const {from, until} = computeFromUntil(type, fromPlainDate, untilPlainDate);
|
|
69
|
+
onChange({
|
|
70
|
+
type,
|
|
71
|
+
from: from?.toString(),
|
|
72
|
+
until: until?.toString(),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function handleFromChange(value: PlainDate | null) {
|
|
77
|
+
onChange({
|
|
78
|
+
type,
|
|
79
|
+
from: value?.toString(),
|
|
80
|
+
until,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function handleUntilChange(value: PlainDate | null) {
|
|
85
|
+
onChange({
|
|
86
|
+
type,
|
|
87
|
+
from,
|
|
88
|
+
until: value?.toString(),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const {
|
|
93
|
+
timeframeTitle: tTimeframeTitle,
|
|
94
|
+
from: tFrom,
|
|
95
|
+
until: tUntil,
|
|
96
|
+
types: tTypes = {}
|
|
97
|
+
} = i18n ?? {};
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Box>
|
|
101
|
+
<Grid container spacing={2}>
|
|
102
|
+
<Grid item md={4} xs={12}>
|
|
103
|
+
<TextField
|
|
104
|
+
fullWidth
|
|
105
|
+
select
|
|
106
|
+
variant="outlined"
|
|
107
|
+
label={tTimeframeTitle ?? 'Timeframe'}
|
|
108
|
+
value={type}
|
|
109
|
+
onChange={handleTypeChange}
|
|
110
|
+
>
|
|
111
|
+
{Object.values(TimeFrameType).map(tf => (
|
|
112
|
+
<MenuItem key={tf} value={tf}>{tTypes[tf] ?? tf}</MenuItem>
|
|
113
|
+
))}
|
|
114
|
+
</TextField>
|
|
115
|
+
</Grid>
|
|
116
|
+
<Grid item md={4} xs={12}>
|
|
117
|
+
<PlainDatePicker
|
|
118
|
+
label={tFrom ?? 'From'}
|
|
119
|
+
value={fromPlainDate}
|
|
120
|
+
onChange={handleFromChange}
|
|
121
|
+
disabled={type != TimeFrameType.Custom}
|
|
122
|
+
fullWidth
|
|
123
|
+
/>
|
|
124
|
+
</Grid>
|
|
125
|
+
<Grid item md={4} xs={12}>
|
|
126
|
+
<PlainDatePicker
|
|
127
|
+
label={tUntil ?? 'Until'}
|
|
128
|
+
value={untilPlainDate}
|
|
129
|
+
onChange={handleUntilChange}
|
|
130
|
+
disabled={type != TimeFrameType.Custom}
|
|
131
|
+
fullWidth
|
|
132
|
+
/>
|
|
133
|
+
</Grid>
|
|
134
|
+
</Grid>
|
|
135
|
+
</Box>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function computeFromUntil(type: TimeFrameType, from?: PlainDate | null, until?: PlainDate | null) {
|
|
140
|
+
const today = Now.plainDateISO();
|
|
141
|
+
const yesterday = today.subtract({days: 1});
|
|
142
|
+
const lastMonth = today.subtract({months: 1});
|
|
143
|
+
const lastWeek = today.subtract({weeks: 1});
|
|
144
|
+
const lastYear = today.subtract({years: 1});
|
|
145
|
+
|
|
146
|
+
switch (type) {
|
|
147
|
+
case TimeFrameType.All:
|
|
148
|
+
return {from: undefined, until: undefined};
|
|
149
|
+
|
|
150
|
+
case TimeFrameType.Custom:
|
|
151
|
+
return {from, until};
|
|
152
|
+
|
|
153
|
+
case TimeFrameType.Today:
|
|
154
|
+
return {
|
|
155
|
+
from: today,
|
|
156
|
+
until: today,
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
case TimeFrameType.Yesterday:
|
|
160
|
+
return {
|
|
161
|
+
from: yesterday,
|
|
162
|
+
until: yesterday,
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
case TimeFrameType.Last7Days:
|
|
166
|
+
return {
|
|
167
|
+
from: yesterday.subtract({days: 7}),
|
|
168
|
+
until: yesterday,
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
case TimeFrameType.LastWeek:
|
|
172
|
+
return {
|
|
173
|
+
from: lastWeek.subtract({days: lastWeek.dayOfWeek - 1}),
|
|
174
|
+
until: lastWeek.add({days: 7 - lastWeek.dayOfWeek}),
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
case TimeFrameType.ThisMonth:
|
|
178
|
+
return {
|
|
179
|
+
from: today.with({day: 1}),
|
|
180
|
+
until: today.with({day: lastMonth.daysInMonth}),
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
case TimeFrameType.LastMonth:
|
|
184
|
+
return {
|
|
185
|
+
from: lastMonth.with({day: 1}),
|
|
186
|
+
until: lastMonth.with({day: lastMonth.daysInMonth}),
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
case TimeFrameType.Last3Months:
|
|
190
|
+
return {
|
|
191
|
+
from: lastMonth.subtract({months: 3}).with({day: 1}),
|
|
192
|
+
until: lastMonth.with({day: lastMonth.daysInMonth}),
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
case TimeFrameType.LastYear:
|
|
196
|
+
return {
|
|
197
|
+
from: lastYear.with({day: 1, month: 1}),
|
|
198
|
+
until: lastYear.with({day: 31, month: 12}),
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import {useMemo} from "react";
|
|
2
|
+
import {getSupportedFormatLocale} from "../getSupportedFormatLocale";
|
|
3
|
+
|
|
4
|
+
export function useLocale(suppliedLocale: string | undefined) {
|
|
5
|
+
return useMemo(() => suppliedLocale || getSupportedFormatLocale("dateTime"), [suppliedLocale]);
|
|
6
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {useCallback} from "react";
|
|
3
|
+
import {TextFieldProps} from "@mui/material/TextField/TextField";
|
|
4
|
+
import {TextField} from "@mui/material";
|
|
5
|
+
|
|
6
|
+
export type UseRenderInputProps = Pick<TextFieldProps, "fullWidth" | "helperText" | "size" | "required">;
|
|
7
|
+
|
|
8
|
+
export function useRenderInput(props: UseRenderInputProps) {
|
|
9
|
+
const {fullWidth, helperText, size, required} = props;
|
|
10
|
+
return useCallback((props: TextFieldProps) => (
|
|
11
|
+
<TextField
|
|
12
|
+
variant="outlined"
|
|
13
|
+
fullWidth={fullWidth}
|
|
14
|
+
helperText={helperText}
|
|
15
|
+
size={size}
|
|
16
|
+
required={required}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
), [fullWidth, helperText, size]);
|
|
20
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {createApiError, createQueryString} from "./fetch";
|
|
2
|
+
|
|
3
|
+
describe("createQueryString", () => {
|
|
4
|
+
test("simple", () => {
|
|
5
|
+
expect(createQueryString({foo: "bar"})).toEqual("foo=bar");
|
|
6
|
+
});
|
|
7
|
+
test("number", () => {
|
|
8
|
+
expect(createQueryString({foo: 5})).toEqual("foo=5");
|
|
9
|
+
expect(createQueryString({foo: 42.01})).toEqual("foo=42.01");
|
|
10
|
+
});
|
|
11
|
+
test("multi", () => {
|
|
12
|
+
expect(createQueryString({foo: "bar"}, {foo: "baz"})).toEqual("foo=bar&foo=baz");
|
|
13
|
+
expect(createQueryString({one: 1}, {two: 2})).toEqual("one=1&two=2");
|
|
14
|
+
});
|
|
15
|
+
test("array", () => {
|
|
16
|
+
expect(createQueryString({foo: ["bar", "baz"]})).toEqual("foo=bar&foo=baz");
|
|
17
|
+
expect(createQueryString({foo: ["bar", "baz"]}, {foo: ["bar2", "baz2"]})).toEqual(
|
|
18
|
+
"foo=bar&foo=baz&foo=bar2&foo=baz2",
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe("createApiError", () => {
|
|
24
|
+
test("problem+json with custom properties", async () => {
|
|
25
|
+
const response = new Response(
|
|
26
|
+
JSON.stringify({
|
|
27
|
+
title: "You do not have enough credit",
|
|
28
|
+
status: 400,
|
|
29
|
+
type: "https://example.com/probs/out-of-credit",
|
|
30
|
+
detail: "Your current balance is 30, but that costs 50.",
|
|
31
|
+
instance: "/account/12345/msgs/abc",
|
|
32
|
+
balance: 30,
|
|
33
|
+
}),
|
|
34
|
+
{status: 400, headers: {"Content-Type": "application/problem+json"}},
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const result = await createApiError(response);
|
|
38
|
+
expect(result.title).toBe("You do not have enough credit");
|
|
39
|
+
expect(result.status).toBe(400);
|
|
40
|
+
expect(result.detail).toBe("Your current balance is 30, but that costs 50.");
|
|
41
|
+
expect(result.instance).toBe("/account/12345/msgs/abc");
|
|
42
|
+
expect(result.balance).toBe(30);
|
|
43
|
+
});
|
|
44
|
+
test("problem+json without custom properties", async () => {
|
|
45
|
+
const response = new Response(
|
|
46
|
+
JSON.stringify({
|
|
47
|
+
title: "You do not have enough credit",
|
|
48
|
+
status: 400,
|
|
49
|
+
type: "https://example.com/probs/out-of-credit",
|
|
50
|
+
detail: "Your current balance is 30, but that costs 50.",
|
|
51
|
+
}),
|
|
52
|
+
{status: 400, headers: {"Content-Type": "application/problem+json"}},
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const result = await createApiError(response);
|
|
56
|
+
expect(result.title).toBe("You do not have enough credit");
|
|
57
|
+
expect(result.status).toBe(400);
|
|
58
|
+
expect(result.detail).toBe("Your current balance is 30, but that costs 50.");
|
|
59
|
+
});
|
|
60
|
+
test("non-json body", async () => {
|
|
61
|
+
const response = new Response("Page not found.", {status: 404, statusText: "Not found"});
|
|
62
|
+
const result = await createApiError(response);
|
|
63
|
+
expect(result.title).toBe("Not found");
|
|
64
|
+
expect(result.status).toBe(404);
|
|
65
|
+
});
|
|
66
|
+
test("no content", async () => {
|
|
67
|
+
const response = new Response(null, {status: 204, statusText: "No content"});
|
|
68
|
+
const result = await createApiError(response);
|
|
69
|
+
expect(result.title).toBe("No content");
|
|
70
|
+
expect(result.status).toBe(204);
|
|
71
|
+
});
|
|
72
|
+
test("older format", async () => {
|
|
73
|
+
const response = new Response(
|
|
74
|
+
JSON.stringify({
|
|
75
|
+
error: "Failed to query data.",
|
|
76
|
+
message: "There was a problem with your request.",
|
|
77
|
+
}),
|
|
78
|
+
{status: 400},
|
|
79
|
+
);
|
|
80
|
+
const result = await createApiError(response);
|
|
81
|
+
expect(result.title).toBe("Failed to query data.");
|
|
82
|
+
expect(result.detail).toBe("There was a problem with your request.");
|
|
83
|
+
expect(result.status).toBe(400);
|
|
84
|
+
});
|
|
85
|
+
});
|
package/src/fetch.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
export interface ProblemJson {
|
|
2
|
+
title: string;
|
|
3
|
+
status: number;
|
|
4
|
+
type?: string;
|
|
5
|
+
instance?: string;
|
|
6
|
+
detail?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** An error from the REST API. */
|
|
11
|
+
export class ApiError extends Error implements ProblemJson {
|
|
12
|
+
constructor(problemJson: ProblemJson) {
|
|
13
|
+
super(problemJson.title);
|
|
14
|
+
this.title = problemJson.title;
|
|
15
|
+
this.status = problemJson.status;
|
|
16
|
+
Object.assign(this, problemJson);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
title: string;
|
|
20
|
+
status: number;
|
|
21
|
+
type?: string;
|
|
22
|
+
instance?: string;
|
|
23
|
+
detail?: string;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates a wrapper around window.fetch for most common REST API requests.
|
|
29
|
+
* @param baseUrl The base URL of the API, i.e. https://api.cubeadmin.center
|
|
30
|
+
* @param baseHeaders The base headers of each request, i.e. {Authorization: "Bearer XXXX"}
|
|
31
|
+
*/
|
|
32
|
+
export function createApiFetcher(baseUrl: string, baseHeaders?: HeadersInit) {
|
|
33
|
+
async function fetch(path: string, options?: RequestInit) {
|
|
34
|
+
options = options || {};
|
|
35
|
+
options.headers = {
|
|
36
|
+
...baseHeaders,
|
|
37
|
+
...options.headers,
|
|
38
|
+
};
|
|
39
|
+
const response = await window.fetch(`${baseUrl}${path}`, options);
|
|
40
|
+
await checkOkay(response);
|
|
41
|
+
return response;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function fetchJson<T>(path: string, options?: RequestInit) {
|
|
45
|
+
const response = await fetch(path, options);
|
|
46
|
+
return await response.json() as T;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
fetch,
|
|
51
|
+
fetchJson,
|
|
52
|
+
get: fetchJson,
|
|
53
|
+
del: (path: string, body?: any) => fetch(path, createJsonRequest("delete", body)),
|
|
54
|
+
put: (path: string, body?: any) => fetch(path, createJsonRequest("put", body)),
|
|
55
|
+
post: (path: string, body?: any) => fetch(path, createJsonRequest("post", body)),
|
|
56
|
+
patch: (path: string, body?: any) => fetch(path, createJsonRequest("PATCH", body)),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type ApiFetcher = ReturnType<typeof createApiFetcher>;
|
|
61
|
+
|
|
62
|
+
async function checkOkay(response: Response) {
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
throw await createApiError(response);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function isProblemJson(error: any): error is ProblemJson {
|
|
69
|
+
return typeof error.title == "string" && typeof error.status == "number";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function isLegacySpringError(error: any): error is { error: string; message: string } {
|
|
73
|
+
return typeof error.error == "string" && typeof error.message == "string";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function createApiError(response: Response) {
|
|
77
|
+
const statusText = response.statusText || "Error";
|
|
78
|
+
try {
|
|
79
|
+
const error = await response.json();
|
|
80
|
+
if (isProblemJson(error)) {
|
|
81
|
+
return new ApiError(error);
|
|
82
|
+
}
|
|
83
|
+
if (isLegacySpringError(error)) {
|
|
84
|
+
return new ApiError({
|
|
85
|
+
title: error.error,
|
|
86
|
+
status: response.status,
|
|
87
|
+
detail: error.message,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// As a fallback, just copy the response body to the error and use title and status
|
|
91
|
+
// from the response
|
|
92
|
+
return new ApiError({
|
|
93
|
+
...error,
|
|
94
|
+
title: statusText,
|
|
95
|
+
status: response.status,
|
|
96
|
+
});
|
|
97
|
+
} catch (parseError) {
|
|
98
|
+
// If parsing fails, fallback to generic error based on HTTP status
|
|
99
|
+
return new ApiError({
|
|
100
|
+
title: statusText,
|
|
101
|
+
status: response.status,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Creates a query string from one or more objects containing key value pairs.
|
|
108
|
+
* @param args
|
|
109
|
+
*/
|
|
110
|
+
export function createQueryString(...args: Record<string, any>[]) {
|
|
111
|
+
const allArgs = args.reduce((acc, curr) => {
|
|
112
|
+
const currArgs = Object.entries(curr)
|
|
113
|
+
.filter(([_, value]) => typeof value != "undefined" && value !== null)
|
|
114
|
+
.flatMap(([key, value]) =>
|
|
115
|
+
(Array.isArray(value) ? value : [value])
|
|
116
|
+
.map(value => [key, `${value}`])
|
|
117
|
+
);
|
|
118
|
+
return acc.concat(currArgs);
|
|
119
|
+
}, []);
|
|
120
|
+
return new URLSearchParams(allArgs).toString();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function createJsonRequest(method: string, body?: any): RequestInit {
|
|
124
|
+
return {
|
|
125
|
+
method: method,
|
|
126
|
+
...getBodyRequestInit(body),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function getBodyRequestInit(body?: any) {
|
|
131
|
+
if (typeof body !== "undefined") {
|
|
132
|
+
return {
|
|
133
|
+
body: JSON.stringify(body),
|
|
134
|
+
headers: {
|
|
135
|
+
"content-type": "application/json",
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
} else {
|
|
139
|
+
return {
|
|
140
|
+
body: null,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface UploadFileRequest {
|
|
146
|
+
uploadUrl: string;
|
|
147
|
+
uploadHeaders: Record<string, string>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Uploads a file to the specified upload URL that is compatible with an Amazon S3 pre-signed PUT URL.
|
|
152
|
+
* @param file The file to upload
|
|
153
|
+
* @param request The upload file request
|
|
154
|
+
*/
|
|
155
|
+
export async function uploadFile(file: File, request: UploadFileRequest) {
|
|
156
|
+
const response = await fetch(request.uploadUrl, {
|
|
157
|
+
method: "put",
|
|
158
|
+
headers: {
|
|
159
|
+
"content-type": file.type,
|
|
160
|
+
...request.uploadHeaders,
|
|
161
|
+
},
|
|
162
|
+
body: file,
|
|
163
|
+
});
|
|
164
|
+
await checkOkay(response);
|
|
165
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import {Clear, ExpandLess, ExpandMore, FilterList} from "@mui/icons-material";
|
|
2
|
+
import {Box, Chip, Collapse, FormControl, IconButton, InputLabel, Paper, Stack, styled} from "@mui/material";
|
|
3
|
+
import React, {KeyboardEvent, PropsWithChildren, ReactNode, useEffect, useState} from "react";
|
|
4
|
+
import {TextField, TextFieldProps} from "../Input";
|
|
5
|
+
import {Labels} from "../localization";
|
|
6
|
+
import {useFlag} from "../utils";
|
|
7
|
+
|
|
8
|
+
export interface FilterProps {
|
|
9
|
+
label?: string;
|
|
10
|
+
active?: ReactNode[];
|
|
11
|
+
enableSearch?: boolean;
|
|
12
|
+
onSearch?: (search: string) => any;
|
|
13
|
+
onClear?: () => any;
|
|
14
|
+
|
|
15
|
+
variant?: TextFieldProps["variant"];
|
|
16
|
+
labels: Labels<"none" | "search" | "reset">;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Whether the filter input takes up the full width of the container. This is now always true.
|
|
20
|
+
* If you need a smaller width, place this control in a smaller container.
|
|
21
|
+
*
|
|
22
|
+
* @deprecated This is now ignored and always true. Remove this property.
|
|
23
|
+
*/
|
|
24
|
+
fullWidth?: boolean;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Whether the `children` are placed in a paper (default: true).
|
|
28
|
+
*/
|
|
29
|
+
paper?: boolean;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Called when the filter is opened.
|
|
33
|
+
*
|
|
34
|
+
* @deprecated use `onChangeOpen` instead.
|
|
35
|
+
*/
|
|
36
|
+
onFilterClick?: () => void;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Called when the open state of the filter changes.
|
|
40
|
+
* @param open Whether the filter is opened.
|
|
41
|
+
*/
|
|
42
|
+
onChangeOpen?: (open: boolean) => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const OutlinedContainer = styled(Box)(({theme}) => ({
|
|
46
|
+
display: "flex",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
padding: theme.spacing(1),
|
|
49
|
+
borderRadius: theme.shape.borderRadius,
|
|
50
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
export function Filter(props: PropsWithChildren<FilterProps>) {
|
|
54
|
+
const {
|
|
55
|
+
label,
|
|
56
|
+
active,
|
|
57
|
+
enableSearch,
|
|
58
|
+
onSearch,
|
|
59
|
+
onClear,
|
|
60
|
+
variant,
|
|
61
|
+
labels,
|
|
62
|
+
paper = true,
|
|
63
|
+
onFilterClick,
|
|
64
|
+
onChangeOpen,
|
|
65
|
+
children,
|
|
66
|
+
} = props;
|
|
67
|
+
|
|
68
|
+
const [open, setOpen, , toggleOpen] = useFlag(false);
|
|
69
|
+
|
|
70
|
+
const [value, setValue] = useState("");
|
|
71
|
+
|
|
72
|
+
function handleKeyDown(e: KeyboardEvent<HTMLInputElement>) {
|
|
73
|
+
if (onSearch) {
|
|
74
|
+
if (e.key == "Enter") {
|
|
75
|
+
onSearch(value);
|
|
76
|
+
setValue("");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (open && onFilterClick) {
|
|
83
|
+
onFilterClick();
|
|
84
|
+
}
|
|
85
|
+
}, [onFilterClick, open]);
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (onChangeOpen) {
|
|
89
|
+
onChangeOpen(open);
|
|
90
|
+
}
|
|
91
|
+
}, [onChangeOpen, open]);
|
|
92
|
+
|
|
93
|
+
const hasActiveFilter = Boolean(active?.filter(node => Boolean(node)).length);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Box>
|
|
97
|
+
<FormControl variant={variant} fullWidth onClick={enableSearch ? undefined : toggleOpen}>
|
|
98
|
+
{label && (
|
|
99
|
+
<InputLabel shrink>
|
|
100
|
+
{label}
|
|
101
|
+
</InputLabel>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
<OutlinedContainer>
|
|
105
|
+
<Stack
|
|
106
|
+
sx={{
|
|
107
|
+
flexDirection: {
|
|
108
|
+
xs: "column",
|
|
109
|
+
sm: "row",
|
|
110
|
+
},
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
width: "100%",
|
|
113
|
+
}}
|
|
114
|
+
spacing={1}
|
|
115
|
+
useFlexGap
|
|
116
|
+
>
|
|
117
|
+
{children && (
|
|
118
|
+
<IconButton
|
|
119
|
+
onClick={enableSearch ? toggleOpen : undefined}
|
|
120
|
+
sx={{
|
|
121
|
+
display: {
|
|
122
|
+
xs: "none",
|
|
123
|
+
sm: "inline-flex",
|
|
124
|
+
},
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
<FilterList />
|
|
128
|
+
</IconButton>
|
|
129
|
+
)}
|
|
130
|
+
|
|
131
|
+
<Stack
|
|
132
|
+
direction="row"
|
|
133
|
+
alignItems="center"
|
|
134
|
+
sx={{
|
|
135
|
+
justifyContent: {
|
|
136
|
+
xs: "center",
|
|
137
|
+
sm: "flex-start",
|
|
138
|
+
},
|
|
139
|
+
}}
|
|
140
|
+
flexWrap="wrap"
|
|
141
|
+
spacing={1}
|
|
142
|
+
useFlexGap
|
|
143
|
+
flex={1}
|
|
144
|
+
>
|
|
145
|
+
{active}
|
|
146
|
+
{enableSearch && (
|
|
147
|
+
<TextField
|
|
148
|
+
value={value}
|
|
149
|
+
onChange={setValue}
|
|
150
|
+
onKeyDown={handleKeyDown}
|
|
151
|
+
variant={"standard"}
|
|
152
|
+
placeholder={enableSearch ? labels("search") : undefined}
|
|
153
|
+
/>
|
|
154
|
+
)}
|
|
155
|
+
</Stack>
|
|
156
|
+
|
|
157
|
+
<Stack direction="row" spacing={1} alignItems="center">
|
|
158
|
+
{!hasActiveFilter && (
|
|
159
|
+
<Chip
|
|
160
|
+
variant="outlined"
|
|
161
|
+
label={labels("none")}
|
|
162
|
+
clickable
|
|
163
|
+
onClick={enableSearch ? setOpen : undefined}
|
|
164
|
+
/>
|
|
165
|
+
)}
|
|
166
|
+
{hasActiveFilter && onClear && (
|
|
167
|
+
<IconButton onClick={onClear} title={labels("reset")}>
|
|
168
|
+
<Clear />
|
|
169
|
+
</IconButton>
|
|
170
|
+
)}
|
|
171
|
+
{children && (
|
|
172
|
+
<IconButton onClick={enableSearch ? toggleOpen : undefined} edge="end">
|
|
173
|
+
{open ? <ExpandLess /> : <ExpandMore />}
|
|
174
|
+
</IconButton>
|
|
175
|
+
)}
|
|
176
|
+
</Stack>
|
|
177
|
+
</Stack>
|
|
178
|
+
</OutlinedContainer>
|
|
179
|
+
</FormControl>
|
|
180
|
+
|
|
181
|
+
{children && (
|
|
182
|
+
<Collapse in={open} mountOnEnter unmountOnExit>
|
|
183
|
+
{paper
|
|
184
|
+
? (
|
|
185
|
+
<Paper elevation={2}>
|
|
186
|
+
{children}
|
|
187
|
+
</Paper>
|
|
188
|
+
)
|
|
189
|
+
: children}
|
|
190
|
+
</Collapse>
|
|
191
|
+
)}
|
|
192
|
+
</Box>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Filter";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {act, create, ReactTestRenderer} from "react-test-renderer";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import {CompactFormat} from "./CompactFormat";
|
|
4
|
+
|
|
5
|
+
describe("CompactFormat", () => {
|
|
6
|
+
|
|
7
|
+
test("render de-AT", () => {
|
|
8
|
+
let element: ReactTestRenderer;
|
|
9
|
+
act(() => {
|
|
10
|
+
element = create(<CompactFormat value={99000000} locale="de-AT" />);
|
|
11
|
+
})
|
|
12
|
+
const value = element!.root.children[0];
|
|
13
|
+
expect(value).toBe("99\u00a0Mio.");
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test("render en-US", () => {
|
|
17
|
+
let element: ReactTestRenderer;
|
|
18
|
+
act(() => {
|
|
19
|
+
element = create(<CompactFormat value={99000000} locale="en-US" />);
|
|
20
|
+
})
|
|
21
|
+
const value = element!.root.children[0];
|
|
22
|
+
expect(value).toBe("99M");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
});
|