@sqrzro/admin 2.0.0 → 2.1.0-bz.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/.babelrc.json +16 -0
- package/.eslintignore +6 -0
- package/.eslintrc +1 -4
- package/.sqrzrorc +5 -0
- package/.storybook/main.js +10 -11
- package/.turbo/turbo-build.log +20 -0
- package/.turbo/turbo-prettier.log +41 -213
- package/COMPONENTS.md +45 -0
- package/dist/components/AppLayout/index.d.ts +2 -2
- package/dist/components/AppLayout/index.js +7 -15
- package/dist/components/AppNavigation/index.d.ts +3 -0
- package/dist/components/AppNavigation/index.js +15 -0
- package/dist/components/BooleanFilter/index.d.ts +5 -0
- package/dist/components/BooleanFilter/index.js +19 -0
- package/dist/components/Config/index.d.ts +6 -0
- package/dist/components/Config/index.js +9 -0
- package/dist/components/Dashboard/index.d.ts +7 -0
- package/dist/components/Dashboard/index.js +5 -0
- package/dist/components/DateFilter/index.d.ts +6 -0
- package/dist/components/DateFilter/index.js +32 -0
- package/dist/components/DropdownFilter/index.d.ts +6 -0
- package/dist/components/DropdownFilter/index.js +9 -0
- package/dist/components/FilterBar/index.d.ts +8 -0
- package/dist/components/FilterBar/index.js +12 -0
- package/dist/components/FilterBarItem/index.d.ts +14 -0
- package/dist/components/FilterBarItem/index.js +31 -0
- package/dist/components/GridList/index.d.ts +5 -0
- package/dist/components/GridList/index.js +7 -0
- package/dist/components/GridListItem/index.d.ts +4 -0
- package/dist/components/GridListItem/index.js +7 -0
- package/dist/components/Icon/index.d.ts +8 -0
- package/dist/components/Icon/index.js +22 -0
- package/dist/components/List/index.d.ts +19 -33
- package/dist/components/List/index.js +19 -43
- package/dist/components/ListAction/index.d.ts +7 -0
- package/dist/components/ListAction/index.js +9 -0
- package/dist/components/ListActions/index.d.ts +6 -16
- package/dist/components/ListActions/index.js +9 -11
- package/dist/components/ListItem/index.d.ts +14 -0
- package/dist/components/ListItem/index.js +12 -0
- package/dist/components/LoginForm/index.d.ts +5 -2
- package/dist/components/LoginForm/index.js +4 -44
- package/dist/components/MeActions/index.d.ts +3 -0
- package/dist/components/MeActions/index.js +13 -0
- package/dist/components/MePanel/index.d.ts +3 -0
- package/dist/components/MePanel/index.js +9 -0
- package/dist/components/Page/index.d.ts +12 -0
- package/dist/components/Page/index.js +8 -0
- package/dist/components/PageActions/index.d.ts +6 -0
- package/dist/components/PageActions/index.js +13 -0
- package/dist/components/Panel/index.d.ts +7 -0
- package/dist/components/Panel/index.js +5 -0
- package/dist/components/RootLayout/index.d.ts +5 -3
- package/dist/components/RootLayout/index.js +12 -5
- package/dist/components/Table/index.d.ts +7 -26
- package/dist/components/Table/index.js +14 -52
- package/dist/components/TableClientComponent/index.d.ts +16 -0
- package/dist/components/TableClientComponent/index.js +44 -0
- package/dist/components/Tabs/index.d.ts +8 -0
- package/dist/components/Tabs/index.js +6 -0
- package/dist/components/index.d.ts +24 -0
- package/dist/components/index.js +13 -0
- package/dist/icons/ErrorIcon/index.d.ts +3 -0
- package/dist/icons/ErrorIcon/index.js +5 -0
- package/dist/icons/InfoIcon/index.d.ts +3 -0
- package/dist/icons/InfoIcon/index.js +5 -0
- package/dist/icons/SuccessIcon/index.d.ts +3 -0
- package/dist/icons/SuccessIcon/index.js +5 -0
- package/dist/icons/WarningIcon/index.d.ts +3 -0
- package/dist/icons/WarningIcon/index.js +5 -0
- package/dist/index.d.ts +2 -208
- package/dist/index.js +2 -212
- package/dist/interfaces.d.ts +4 -0
- package/dist/services/ConfigService.d.ts +7 -40
- package/dist/services/ConfigService.js +10 -48
- package/dist/styles/config.d.ts +3 -0
- package/dist/styles/config.js +82 -0
- package/dist/styles.css +873 -134
- package/dist/utility/formatters.d.ts +1 -0
- package/dist/utility/formatters.js +8 -0
- package/next-env.d.ts +5 -0
- package/package.json +75 -64
- package/src/components/AppLayout/index.tsx +21 -11
- package/src/components/AppNavigation/index.tsx +39 -0
- package/src/components/BooleanFilter/index.tsx +28 -0
- package/src/components/Config/index.tsx +17 -0
- package/src/components/Dashboard/index.tsx +15 -0
- package/src/components/DateFilter/index.tsx +49 -0
- package/src/components/DropdownFilter/index.tsx +19 -0
- package/src/components/FilterBar/index.tsx +35 -0
- package/src/components/FilterBarItem/index.tsx +126 -0
- package/src/components/GridList/index.tsx +11 -0
- package/src/components/GridListItem/index.tsx +31 -0
- package/src/components/Icon/index.tsx +33 -0
- package/src/components/List/index.tsx +52 -72
- package/src/components/ListAction/index.tsx +25 -0
- package/src/components/ListActions/index.tsx +32 -19
- package/src/components/ListItem/index.tsx +56 -0
- package/src/components/LoginForm/index.tsx +25 -105
- package/src/components/MeActions/index.tsx +21 -0
- package/src/components/MePanel/index.tsx +21 -0
- package/src/components/Page/index.tsx +60 -0
- package/src/components/PageActions/index.tsx +22 -0
- package/src/components/Panel/Panel.spec.tsx +10 -0
- package/src/components/Panel/Panel.stories.tsx +9 -0
- package/src/components/Panel/index.tsx +15 -0
- package/src/components/RootLayout/index.tsx +23 -29
- package/src/components/Table/index.tsx +22 -111
- package/src/components/TableClientComponent/index.tsx +112 -0
- package/src/components/Tabs/index.tsx +25 -0
- package/src/components/index.ts +68 -0
- package/src/icons/ErrorIcon/index.tsx +19 -0
- package/src/icons/InfoIcon/index.tsx +19 -0
- package/src/icons/SuccessIcon/index.tsx +19 -0
- package/src/icons/WarningIcon/index.tsx +19 -0
- package/src/index.ts +2 -214
- package/src/interfaces.ts +3 -0
- package/src/react.d.ts +12 -0
- package/src/services/ConfigService.ts +15 -84
- package/src/styles/config.ts +95 -0
- package/src/styles/tailwind.css +25 -35
- package/src/utility/formatters.ts +9 -0
- package/tailwind.config.js +8 -3
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +3 -3
- package/.turbo/turbo-docs.log +0 -0
- package/.turbo/turbo-lint.log +0 -112
- package/.turbo/turbo-test.log +0 -6
- package/dist/components/Alert/index.d.ts +0 -4
- package/dist/components/Alert/index.js +0 -15
- package/dist/components/Allow/index.d.ts +0 -20
- package/dist/components/Allow/index.js +0 -29
- package/dist/components/AppLayout/AppLayout.stories.d.ts +0 -5
- package/dist/components/AppLayout/AppLayout.stories.js +0 -11
- package/dist/components/AutoSuggest/index.d.ts +0 -74
- package/dist/components/AutoSuggest/index.js +0 -143
- package/dist/components/Button/Button.stories.d.ts +0 -11
- package/dist/components/Button/Button.stories.js +0 -41
- package/dist/components/Button/index.d.ts +0 -49
- package/dist/components/Button/index.js +0 -50
- package/dist/components/CalendarInput/index.d.ts +0 -24
- package/dist/components/CalendarInput/index.js +0 -54
- package/dist/components/CheckboxList/index.d.ts +0 -17
- package/dist/components/CheckboxList/index.js +0 -25
- package/dist/components/CodeInput/index.d.ts +0 -9
- package/dist/components/CodeInput/index.js +0 -51
- package/dist/components/ConnectedDropdown/index.d.ts +0 -14
- package/dist/components/ConnectedDropdown/index.js +0 -36
- package/dist/components/ConnectedList/index.d.ts +0 -5
- package/dist/components/ConnectedList/index.js +0 -7
- package/dist/components/ConnectedTable/index.d.ts +0 -5
- package/dist/components/ConnectedTable/index.js +0 -7
- package/dist/components/ContentBlock/index.d.ts +0 -16
- package/dist/components/ContentBlock/index.js +0 -13
- package/dist/components/DataPanel/index.d.ts +0 -8
- package/dist/components/DataPanel/index.js +0 -8
- package/dist/components/DateInput/index.d.ts +0 -18
- package/dist/components/DateInput/index.js +0 -81
- package/dist/components/Dropdown/index.d.ts +0 -36
- package/dist/components/Dropdown/index.js +0 -122
- package/dist/components/ErrorMessage/index.d.ts +0 -16
- package/dist/components/ErrorMessage/index.js +0 -17
- package/dist/components/Fieldset/index.d.ts +0 -18
- package/dist/components/Fieldset/index.js +0 -19
- package/dist/components/FileInput/index.d.ts +0 -10
- package/dist/components/FileInput/index.js +0 -26
- package/dist/components/FilterLink/index.d.ts +0 -14
- package/dist/components/FilterLink/index.js +0 -15
- package/dist/components/Form/index.d.ts +0 -14
- package/dist/components/Form/index.js +0 -15
- package/dist/components/FormActions/index.d.ts +0 -18
- package/dist/components/FormActions/index.js +0 -14
- package/dist/components/FormField/index.d.ts +0 -14
- package/dist/components/FormField/index.js +0 -40
- package/dist/components/FormRepeater/index.d.ts +0 -18
- package/dist/components/FormRepeater/index.js +0 -65
- package/dist/components/ImageInput/index.d.ts +0 -13
- package/dist/components/ImageInput/index.js +0 -45
- package/dist/components/InfoPanel/index.d.ts +0 -14
- package/dist/components/InfoPanel/index.js +0 -11
- package/dist/components/Link/__mocks__/index.d.ts +0 -6
- package/dist/components/Link/__mocks__/index.js +0 -12
- package/dist/components/Link/index.d.ts +0 -23
- package/dist/components/Link/index.js +0 -21
- package/dist/components/Message/index.d.ts +0 -14
- package/dist/components/Message/index.js +0 -14
- package/dist/components/Modal/index.d.ts +0 -4
- package/dist/components/Modal/index.js +0 -18
- package/dist/components/ModalActions/index.d.ts +0 -21
- package/dist/components/ModalActions/index.js +0 -18
- package/dist/components/MoneyInput/index.d.ts +0 -10
- package/dist/components/MoneyInput/index.js +0 -13
- package/dist/components/PasswordForm/index.d.ts +0 -35
- package/dist/components/PasswordForm/index.js +0 -21
- package/dist/components/PasswordInput/index.d.ts +0 -4
- package/dist/components/PasswordInput/index.js +0 -12
- package/dist/components/RadioList/index.d.ts +0 -9
- package/dist/components/RadioList/index.js +0 -7
- package/dist/components/SummaryList/index.d.ts +0 -18
- package/dist/components/SummaryList/index.js +0 -15
- package/dist/components/Switch/index.d.ts +0 -21
- package/dist/components/Switch/index.js +0 -31
- package/dist/components/Tag/index.d.ts +0 -15
- package/dist/components/Tag/index.js +0 -13
- package/dist/components/TextArea/index.d.ts +0 -18
- package/dist/components/TextArea/index.js +0 -26
- package/dist/components/TextInput/index.d.ts +0 -14
- package/dist/components/TextInput/index.js +0 -27
- package/dist/components/WebsiteInput/index.d.ts +0 -10
- package/dist/components/WebsiteInput/index.js +0 -13
- package/dist/components/WeekCalendar/index.d.ts +0 -24
- package/dist/components/WeekCalendar/index.js +0 -48
- package/dist/core/AlertComponent/index.d.ts +0 -26
- package/dist/core/AlertComponent/index.js +0 -35
- package/dist/core/AppHeader/index.d.ts +0 -3
- package/dist/core/AppHeader/index.js +0 -17
- package/dist/core/AppLogo/index.d.ts +0 -12
- package/dist/core/AppLogo/index.js +0 -16
- package/dist/core/AppLogoImage/index.d.ts +0 -3
- package/dist/core/AppLogoImage/index.js +0 -11
- package/dist/core/AppLogoPlaceholder/index.d.ts +0 -3
- package/dist/core/AppLogoPlaceholder/index.js +0 -10
- package/dist/core/Assistive/index.d.ts +0 -12
- package/dist/core/Assistive/index.js +0 -9
- package/dist/core/AuthForm/index.d.ts +0 -10
- package/dist/core/AuthForm/index.js +0 -13
- package/dist/core/Banner/index.d.ts +0 -3
- package/dist/core/Banner/index.js +0 -14
- package/dist/core/Calendar/index.d.ts +0 -21
- package/dist/core/Calendar/index.js +0 -69
- package/dist/core/CalendarDay/index.d.ts +0 -30
- package/dist/core/CalendarDay/index.js +0 -30
- package/dist/core/CalendarMonth/index.d.ts +0 -23
- package/dist/core/CalendarMonth/index.js +0 -45
- package/dist/core/CalendarNavigation/index.d.ts +0 -17
- package/dist/core/CalendarNavigation/index.js +0 -24
- package/dist/core/CalendarWeek/index.d.ts +0 -28
- package/dist/core/CalendarWeek/index.js +0 -46
- package/dist/core/ChkRad/index.d.ts +0 -26
- package/dist/core/ChkRad/index.js +0 -33
- package/dist/core/ChkRadIcon/index.d.ts +0 -14
- package/dist/core/ChkRadIcon/index.js +0 -12
- package/dist/core/ChkRadList/index.d.ts +0 -32
- package/dist/core/ChkRadList/index.js +0 -37
- package/dist/core/CloseButton/index.d.ts +0 -17
- package/dist/core/CloseButton/index.js +0 -12
- package/dist/core/ConfirmModal/index.d.ts +0 -3
- package/dist/core/ConfirmModal/index.js +0 -38
- package/dist/core/ConnectedRepeater/index.d.ts +0 -50
- package/dist/core/ConnectedRepeater/index.js +0 -154
- package/dist/core/ConnectedRepeaterComponent/index.d.ts +0 -24
- package/dist/core/ConnectedRepeaterComponent/index.js +0 -25
- package/dist/core/Container/index.d.ts +0 -14
- package/dist/core/Container/index.js +0 -12
- package/dist/core/DataPanelItem/index.d.ts +0 -8
- package/dist/core/DataPanelItem/index.js +0 -7
- package/dist/core/DropdownPanel/index.d.ts +0 -31
- package/dist/core/DropdownPanel/index.js +0 -32
- package/dist/core/EmptyMessage/index.d.ts +0 -21
- package/dist/core/EmptyMessage/index.js +0 -21
- package/dist/core/FilterItem/index.d.ts +0 -25
- package/dist/core/FilterItem/index.js +0 -82
- package/dist/core/Filters/index.d.ts +0 -31
- package/dist/core/Filters/index.js +0 -85
- package/dist/core/FixedActions/index.d.ts +0 -24
- package/dist/core/FixedActions/index.js +0 -22
- package/dist/core/FormError/index.d.ts +0 -12
- package/dist/core/FormError/index.js +0 -9
- package/dist/core/FormLabel/index.d.ts +0 -16
- package/dist/core/FormLabel/index.js +0 -13
- package/dist/core/FormLegend/index.d.ts +0 -12
- package/dist/core/FormLegend/index.js +0 -9
- package/dist/core/Header/Header.stories.d.ts +0 -5
- package/dist/core/Header/Header.stories.js +0 -11
- package/dist/core/Header/index.d.ts +0 -14
- package/dist/core/Header/index.js +0 -12
- package/dist/core/Icon/index.d.ts +0 -14
- package/dist/core/Icon/index.js +0 -32
- package/dist/core/IconButton/index.d.ts +0 -22
- package/dist/core/IconButton/index.js +0 -20
- package/dist/core/InputPanel/index.d.ts +0 -16
- package/dist/core/InputPanel/index.js +0 -11
- package/dist/core/ListItem/index.d.ts +0 -39
- package/dist/core/ListItem/index.js +0 -44
- package/dist/core/ListItemAction/index.d.ts +0 -11
- package/dist/core/ListItemAction/index.js +0 -13
- package/dist/core/ListItemActions/index.d.ts +0 -8
- package/dist/core/ListItemActions/index.js +0 -16
- package/dist/core/ListItemMetaItem/index.d.ts +0 -19
- package/dist/core/ListItemMetaItem/index.js +0 -29
- package/dist/core/ListItemTitle/index.d.ts +0 -19
- package/dist/core/ListItemTitle/index.js +0 -44
- package/dist/core/Loader/index.d.ts +0 -15
- package/dist/core/Loader/index.js +0 -16
- package/dist/core/MeActions/index.d.ts +0 -3
- package/dist/core/MeActions/index.js +0 -48
- package/dist/core/MePanel/index.d.ts +0 -19
- package/dist/core/MePanel/index.js +0 -29
- package/dist/core/ModalComponent/index.d.ts +0 -22
- package/dist/core/ModalComponent/index.js +0 -29
- package/dist/core/Navigation/index.d.ts +0 -3
- package/dist/core/Navigation/index.js +0 -33
- package/dist/core/NavigationDivider/index.d.ts +0 -3
- package/dist/core/NavigationDivider/index.js +0 -8
- package/dist/core/NavigationItem/index.d.ts +0 -16
- package/dist/core/NavigationItem/index.js +0 -21
- package/dist/core/Pagination/index.d.ts +0 -15
- package/dist/core/Pagination/index.js +0 -64
- package/dist/core/PaginationItem/index.d.ts +0 -10
- package/dist/core/PaginationItem/index.js +0 -17
- package/dist/core/Panel/index.d.ts +0 -17
- package/dist/core/Panel/index.js +0 -13
- package/dist/core/PasswordForgotForm/index.d.ts +0 -7
- package/dist/core/PasswordForgotForm/index.js +0 -40
- package/dist/core/PasswordResetForm/index.d.ts +0 -7
- package/dist/core/PasswordResetForm/index.js +0 -34
- package/dist/core/RadialProgress/index.d.ts +0 -16
- package/dist/core/RadialProgress/index.js +0 -23
- package/dist/core/SettingsForm/index.d.ts +0 -3
- package/dist/core/SettingsForm/index.js +0 -14
- package/dist/core/StaticTextInput/index.d.ts +0 -29
- package/dist/core/StaticTextInput/index.js +0 -39
- package/dist/core/Styled/index.d.ts +0 -6
- package/dist/core/Styled/index.js +0 -39
- package/dist/core/SummaryListItem/index.d.ts +0 -23
- package/dist/core/SummaryListItem/index.js +0 -31
- package/dist/core/TabItem/index.d.ts +0 -4
- package/dist/core/TabItem/index.js +0 -13
- package/dist/core/TableActionsCell/index.d.ts +0 -8
- package/dist/core/TableActionsCell/index.js +0 -8
- package/dist/core/TableCell/index.d.ts +0 -15
- package/dist/core/TableCell/index.js +0 -20
- package/dist/core/TableHead/index.d.ts +0 -18
- package/dist/core/TableHead/index.js +0 -18
- package/dist/core/TableRow/index.d.ts +0 -13
- package/dist/core/TableRow/index.js +0 -18
- package/dist/core/Tabs/index.d.ts +0 -7
- package/dist/core/Tabs/index.js +0 -13
- package/dist/core/TextInputAncillary/index.d.ts +0 -29
- package/dist/core/TextInputAncillary/index.js +0 -31
- package/dist/core/Toast/index.d.ts +0 -3
- package/dist/core/Toast/index.js +0 -47
- package/dist/core/TwoFactor/index.d.ts +0 -13
- package/dist/core/TwoFactor/index.js +0 -49
- package/dist/core/TwoFactorAuthenticator/index.d.ts +0 -10
- package/dist/core/TwoFactorAuthenticator/index.js +0 -9
- package/dist/core/TwoFactorMethodList/index.d.ts +0 -10
- package/dist/core/TwoFactorMethodList/index.js +0 -22
- package/dist/core/TwoFactorSetup/index.d.ts +0 -12
- package/dist/core/TwoFactorSetup/index.js +0 -43
- package/dist/core/TwoFactorSetupAuthenticator/index.d.ts +0 -20
- package/dist/core/TwoFactorSetupAuthenticator/index.js +0 -42
- package/dist/core/TwoFactorSetupYubikey/index.d.ts +0 -16
- package/dist/core/TwoFactorSetupYubikey/index.js +0 -14
- package/dist/core/TwoFactorYubikey/index.d.ts +0 -9
- package/dist/core/TwoFactorYubikey/index.js +0 -14
- package/dist/core/WeekCalendarDay/index.d.ts +0 -27
- package/dist/core/WeekCalendarDay/index.js +0 -35
- package/dist/core/YubikeyInput/index.d.ts +0 -4
- package/dist/core/YubikeyInput/index.js +0 -14
- package/dist/filters/BooleanFilter/index.d.ts +0 -14
- package/dist/filters/BooleanFilter/index.js +0 -35
- package/dist/filters/DateFilter/index.d.ts +0 -5
- package/dist/filters/DateFilter/index.js +0 -24
- package/dist/filters/DropdownFilter/index.d.ts +0 -17
- package/dist/filters/DropdownFilter/index.js +0 -32
- package/dist/filters/QuickDateFilter/index.d.ts +0 -13
- package/dist/filters/QuickDateFilter/index.js +0 -40
- package/dist/filters/interfaces.d.ts +0 -35
- package/dist/hooks/useAlert.d.ts +0 -12
- package/dist/hooks/useAlert.js +0 -18
- package/dist/hooks/useAppConfig.d.ts +0 -3
- package/dist/hooks/useAppConfig.js +0 -5
- package/dist/hooks/useConnectedList.d.ts +0 -7
- package/dist/hooks/useConnectedList.js +0 -6
- package/dist/hooks/useConnectedRepeater.d.ts +0 -7
- package/dist/hooks/useConnectedRepeater.js +0 -14
- package/dist/hooks/useConnectedTable.d.ts +0 -7
- package/dist/hooks/useConnectedTable.js +0 -6
- package/dist/hooks/useFilters.d.ts +0 -9
- package/dist/hooks/useFilters.js +0 -24
- package/dist/hooks/useLayout.d.ts +0 -7
- package/dist/hooks/useLayout.js +0 -10
- package/dist/hooks/useLayout.spec.d.ts +0 -1
- package/dist/hooks/useLayout.spec.js +0 -24
- package/dist/hooks/useModal.d.ts +0 -12
- package/dist/hooks/useModal.js +0 -39
- package/dist/hooks/useModalOffset.d.ts +0 -2
- package/dist/hooks/useModalOffset.js +0 -16
- package/dist/hooks/useModalOffset.spec.d.ts +0 -1
- package/dist/hooks/useModalOffset.spec.js +0 -19
- package/dist/hooks/useNavigation.d.ts +0 -7
- package/dist/hooks/useNavigation.js +0 -113
- package/dist/hooks/useRemote.d.ts +0 -7
- package/dist/hooks/useRemote.js +0 -29
- package/dist/hooks/useVariant.d.ts +0 -9
- package/dist/hooks/useVariant.js +0 -14
- package/dist/scenes/Error404Scene.d.ts +0 -3
- package/dist/scenes/Error404Scene.js +0 -5
- package/dist/services/AppService.d.ts +0 -5
- package/dist/services/AppService.js +0 -11
- package/dist/services/ConfirmService.d.ts +0 -12
- package/dist/services/ConfirmService.js +0 -10
- package/dist/services/DateService.d.ts +0 -26
- package/dist/services/DateService.js +0 -132
- package/dist/services/DateService.spec.d.ts +0 -1
- package/dist/services/DateService.spec.js +0 -83
- package/dist/services/DownloadService.d.ts +0 -7
- package/dist/services/DownloadService.js +0 -16
- package/dist/services/DownloadService.spec.d.ts +0 -1
- package/dist/services/DownloadService.spec.js +0 -18
- package/dist/services/FilterComponentService.d.ts +0 -25
- package/dist/services/FilterComponentService.js +0 -54
- package/dist/services/FilterService.d.ts +0 -34
- package/dist/services/FilterService.js +0 -58
- package/dist/services/FilterService.spec.d.ts +0 -1
- package/dist/services/FilterService.spec.js +0 -67
- package/dist/services/FormatService.d.ts +0 -11
- package/dist/services/FormatService.js +0 -45
- package/dist/services/FormatService.spec.d.ts +0 -1
- package/dist/services/FormatService.spec.js +0 -66
- package/dist/services/ToastService.d.ts +0 -7
- package/dist/services/ToastService.js +0 -17
- package/dist/services/ToastService.spec.d.ts +0 -1
- package/dist/services/ToastService.spec.js +0 -34
- package/dist/utility/MockRouter/index.d.ts +0 -2
- package/dist/utility/MockRouter/index.js +0 -37
- package/dist/utility/StorybookPanel/index.d.ts +0 -14
- package/dist/utility/StorybookPanel/index.js +0 -12
- package/dist/utility/TestChangeHandler/index.d.ts +0 -15
- package/dist/utility/TestChangeHandler/index.js +0 -30
- package/dist/utility/icons.d.ts +0 -3
- package/dist/utility/icons.js +0 -12
- package/dist/utility/interfaces.d.ts +0 -79
- package/dist/utility/interfaces.js +0 -18
- package/dist/utility/middleware.d.ts +0 -4
- package/dist/utility/middleware.js +0 -9
- package/dist/utility/prop-types.d.ts +0 -57
- package/dist/utility/prop-types.js +0 -77
- package/dist/utility/register.d.ts +0 -3
- package/dist/utility/register.js +0 -9
- package/src/components/Alert/index.tsx +0 -111
- package/src/components/Allow/Allow.spec.tsx +0 -37
- package/src/components/Allow/index.tsx +0 -42
- package/src/components/AppLayout/AppLayout.stories.tsx +0 -20
- package/src/components/AutoSuggest/AutoSuggest.module.css +0 -8
- package/src/components/AutoSuggest/AutoSuggest.spec.tsx +0 -222
- package/src/components/AutoSuggest/AutoSuggest.story.tsx +0 -32
- package/src/components/AutoSuggest/index.tsx +0 -215
- package/src/components/Button/Button.spec.tsx +0 -61
- package/src/components/Button/Button.stories.tsx +0 -62
- package/src/components/Button/index.tsx +0 -15
- package/src/components/CalendarInput/CalendarInput.module.css +0 -8
- package/src/components/CalendarInput/CalendarInput.spec.tsx +0 -222
- package/src/components/CalendarInput/CalendarInput.story.tsx +0 -62
- package/src/components/CalendarInput/index.tsx +0 -126
- package/src/components/CheckboxList/CheckboxList.spec.tsx +0 -93
- package/src/components/CheckboxList/index.tsx +0 -51
- package/src/components/ConnectedDropdown/index.tsx +0 -53
- package/src/components/ConnectedList/index.tsx +0 -19
- package/src/components/ConnectedTable/index.tsx +0 -21
- package/src/components/ContentBlock/ContentBlock.module.css +0 -17
- package/src/components/ContentBlock/ContentBlock.spec.tsx +0 -25
- package/src/components/ContentBlock/index.tsx +0 -28
- package/src/components/DataPanel/index.tsx +0 -25
- package/src/components/DateInput/DateInput.module.css +0 -15
- package/src/components/DateInput/DateInput.spec.tsx +0 -87
- package/src/components/DateInput/index.tsx +0 -145
- package/src/components/ErrorMessage/ErrorMessage.module.css +0 -25
- package/src/components/ErrorMessage/ErrorMessage.spec.tsx +0 -31
- package/src/components/ErrorMessage/index.tsx +0 -36
- package/src/components/Fieldset/Fieldset.spec.tsx +0 -22
- package/src/components/Fieldset/Fieldset.story.tsx +0 -25
- package/src/components/Fieldset/index.tsx +0 -32
- package/src/components/FileInput/FileInput.module.css +0 -18
- package/src/components/FileInput/FileInput.spec.tsx +0 -52
- package/src/components/FileInput/FileInput.story.tsx +0 -8
- package/src/components/FileInput/index.tsx +0 -75
- package/src/components/FilterLink/FilterLink.module.css +0 -9
- package/src/components/FilterLink/FilterLink.spec.tsx +0 -34
- package/src/components/FilterLink/index.tsx +0 -36
- package/src/components/Form/Form.spec.tsx +0 -39
- package/src/components/Form/index.tsx +0 -25
- package/src/components/FormActions/FormActions.spec.tsx +0 -10
- package/src/components/FormActions/FormActions.story.tsx +0 -27
- package/src/components/FormActions/index.tsx +0 -35
- package/src/components/FormField/FormField.module.css +0 -71
- package/src/components/FormField/FormField.spec.tsx +0 -177
- package/src/components/FormField/FormField.stories.tsx +0 -44
- package/src/components/FormField/index.tsx +0 -14
- package/src/components/FormRepeater/FormRepeater.module.css +0 -7
- package/src/components/FormRepeater/FormRepeater.spec.tsx +0 -156
- package/src/components/FormRepeater/index.tsx +0 -121
- package/src/components/ImageInput/ImageInput.module.css +0 -74
- package/src/components/ImageInput/ImageInput.spec.tsx +0 -47
- package/src/components/ImageInput/ImageInput.story.tsx +0 -8
- package/src/components/ImageInput/index.tsx +0 -93
- package/src/components/InfoPanel/InfoPanel.module.css +0 -20
- package/src/components/InfoPanel/InfoPanel.spec.tsx +0 -15
- package/src/components/InfoPanel/InfoPanel.story.tsx +0 -32
- package/src/components/InfoPanel/index.tsx +0 -25
- package/src/components/Link/Link.spec.tsx +0 -64
- package/src/components/Link/__mocks__/index.tsx +0 -24
- package/src/components/Link/index.tsx +0 -60
- package/src/components/List/List.module.css +0 -9
- package/src/components/List/List.spec.tsx +0 -379
- package/src/components/List/List.story.tsx +0 -119
- package/src/components/ListActions/ListActions.spec.tsx +0 -10
- package/src/components/ListActions/ListActions.story.tsx +0 -8
- package/src/components/LoginForm/LoginForm.spec.tsx +0 -68
- package/src/components/LoginForm/LoginForm.story.tsx +0 -25
- package/src/components/Message/Message.module.css +0 -14
- package/src/components/Message/Message.spec.tsx +0 -20
- package/src/components/Message/index.tsx +0 -29
- package/src/components/Modal/index.tsx +0 -27
- package/src/components/ModalActions/ModalActions.module.css +0 -5
- package/src/components/ModalActions/ModalActions.spec.tsx +0 -49
- package/src/components/ModalActions/ModalActions.story.tsx +0 -8
- package/src/components/ModalActions/index.tsx +0 -51
- package/src/components/MoneyInput/MoneyInput.spec.tsx +0 -17
- package/src/components/MoneyInput/MoneyInput.story.tsx +0 -8
- package/src/components/MoneyInput/index.tsx +0 -18
- package/src/components/PasswordForm/index.tsx +0 -36
- package/src/components/RadioList/RadioList.spec.tsx +0 -47
- package/src/components/RadioList/index.tsx +0 -19
- package/src/components/SummaryList/SummaryList.module.css +0 -31
- package/src/components/SummaryList/SummaryList.spec.tsx +0 -89
- package/src/components/SummaryList/SummaryList.story.tsx +0 -13
- package/src/components/SummaryList/index.tsx +0 -39
- package/src/components/Switch/Switch.module.css +0 -86
- package/src/components/Switch/Switch.spec.tsx +0 -64
- package/src/components/Switch/index.tsx +0 -89
- package/src/components/Table/Table.module.css +0 -14
- package/src/components/Table/Table.spec.tsx +0 -136
- package/src/components/Table/Table.story.tsx +0 -108
- package/src/components/TextArea/TextArea.module.css +0 -23
- package/src/components/TextArea/TextArea.spec.tsx +0 -77
- package/src/components/TextArea/index.tsx +0 -61
- package/src/components/TextInput/TextInput.module.css +0 -62
- package/src/components/TextInput/TextInput.spec.tsx +0 -127
- package/src/components/TextInput/TextInput.stories.tsx +0 -46
- package/src/components/TextInput/index.tsx +0 -11
- package/src/components/WebsiteInput/WebsiteInput.spec.tsx +0 -17
- package/src/components/WebsiteInput/index.tsx +0 -18
- package/src/components/WeekCalendar/WeekCalendar.module.css +0 -19
- package/src/components/WeekCalendar/index.tsx +0 -80
- package/src/core/AlertComponent/AlertComponent.module.css +0 -110
- package/src/core/AlertComponent/AlertComponent.spec.tsx +0 -85
- package/src/core/AlertComponent/AlertComponent.story.tsx +0 -29
- package/src/core/AlertComponent/index.tsx +0 -109
- package/src/core/AppHeader/index.tsx +0 -25
- package/src/core/AppLogo/AppLogo.module.css +0 -18
- package/src/core/AppLogo/index.tsx +0 -35
- package/src/core/AppLogoImage/index.tsx +0 -19
- package/src/core/AppLogoPlaceholder/index.tsx +0 -32
- package/src/core/Assistive/index.tsx +0 -1
- package/src/core/AuthForm/AuthForm.module.css +0 -35
- package/src/core/AuthForm/AuthForm.spec.tsx +0 -72
- package/src/core/AuthForm/index.tsx +0 -63
- package/src/core/Banner/Banner.module.css +0 -34
- package/src/core/Banner/index.tsx +0 -25
- package/src/core/Calendar/index.tsx +0 -118
- package/src/core/CalendarDay/CalendarDay.module.css +0 -61
- package/src/core/CalendarDay/index.tsx +0 -82
- package/src/core/CalendarMonth/CalendarMonth.module.css +0 -13
- package/src/core/CalendarMonth/index.tsx +0 -103
- package/src/core/CalendarNavigation/CalendarNavigation.module.css +0 -26
- package/src/core/CalendarNavigation/index.tsx +0 -55
- package/src/core/CalendarWeek/index.tsx +0 -97
- package/src/core/ChkRadList/ChkRadList.module.css +0 -12
- package/src/core/ChkRadList/index.tsx +0 -88
- package/src/core/CloseButton/CloseButton.spec.tsx +0 -38
- package/src/core/CloseButton/index.tsx +0 -33
- package/src/core/ConfirmModal/ConfirmModal.spec.tsx +0 -94
- package/src/core/ConfirmModal/index.tsx +0 -59
- package/src/core/ConnectedRepeater/index.tsx +0 -284
- package/src/core/ConnectedRepeaterComponent/index.tsx +0 -71
- package/src/core/Container/Container.module.css +0 -13
- package/src/core/Container/index.tsx +0 -29
- package/src/core/DataPanelItem/index.tsx +0 -19
- package/src/core/EmptyMessage/EmptyMessage.module.css +0 -18
- package/src/core/EmptyMessage/EmptyMessage.stories.tsx +0 -33
- package/src/core/EmptyMessage/index.tsx +0 -15
- package/src/core/FilterItem/FilterItem.module.css +0 -104
- package/src/core/FilterItem/index.tsx +0 -172
- package/src/core/Filters/Filters.module.css +0 -86
- package/src/core/Filters/Filters.spec.tsx +0 -573
- package/src/core/Filters/index.tsx +0 -168
- package/src/core/FixedActions/FixedActions.module.css +0 -23
- package/src/core/FixedActions/FixedActions.spec.tsx +0 -53
- package/src/core/FixedActions/index.tsx +0 -54
- package/src/core/FormLegend/FormLegend.module.css +0 -13
- package/src/core/FormLegend/index.tsx +0 -18
- package/src/core/Header/Header.stories.tsx +0 -20
- package/src/core/Header/index.tsx +0 -32
- package/src/core/Icon/Icon.spec.tsx +0 -30
- package/src/core/Icon/index.tsx +0 -70
- package/src/core/IconButton/IconButton.module.css +0 -32
- package/src/core/IconButton/index.tsx +0 -53
- package/src/core/ListItem/ListItem.module.css +0 -28
- package/src/core/ListItem/ListItem.story.tsx +0 -32
- package/src/core/ListItem/index.tsx +0 -109
- package/src/core/ListItemAction/ListItemAction.module.css +0 -33
- package/src/core/ListItemAction/index.tsx +0 -30
- package/src/core/ListItemActions/ListItemActions.module.css +0 -94
- package/src/core/ListItemActions/index.tsx +0 -42
- package/src/core/ListItemMetaItem/ListItemMetaItem.module.css +0 -18
- package/src/core/ListItemMetaItem/index.tsx +0 -54
- package/src/core/ListItemTitle/ListItemTitle.module.css +0 -22
- package/src/core/ListItemTitle/ListItemTitle.spec.tsx +0 -53
- package/src/core/ListItemTitle/index.tsx +0 -82
- package/src/core/Loader/Loader.module.css +0 -57
- package/src/core/Loader/Loader.stories.tsx +0 -22
- package/src/core/Loader/index.tsx +0 -2
- package/src/core/MeActions/MeActions.module.css +0 -47
- package/src/core/MeActions/index.tsx +0 -74
- package/src/core/MePanel/MePanel.module.css +0 -79
- package/src/core/MePanel/index.tsx +0 -58
- package/src/core/ModalComponent/ModalComponent.module.css +0 -86
- package/src/core/ModalComponent/ModalComponent.spec.tsx +0 -55
- package/src/core/ModalComponent/index.tsx +0 -66
- package/src/core/Navigation/Navigation.module.css +0 -89
- package/src/core/Navigation/Navigation.spec.tsx +0 -121
- package/src/core/Navigation/index.tsx +0 -69
- package/src/core/NavigationDivider/NavigationDivider.module.css +0 -3
- package/src/core/NavigationDivider/index.tsx +0 -13
- package/src/core/NavigationItem/NavigationItem.module.css +0 -46
- package/src/core/NavigationItem/index.tsx +0 -50
- package/src/core/Panel/Panel.module.css +0 -26
- package/src/core/Panel/Panel.spec.tsx +0 -16
- package/src/core/Panel/index.tsx +0 -35
- package/src/core/PasswordForgotForm/index.tsx +0 -62
- package/src/core/PasswordResetForm/index.tsx +0 -65
- package/src/core/RadialProgress/RadialProgress.module.css +0 -78
- package/src/core/RadialProgress/index.tsx +0 -49
- package/src/core/SettingsForm/index.tsx +0 -26
- package/src/core/SummaryListItem/SummaryListItem.module.css +0 -20
- package/src/core/SummaryListItem/index.tsx +0 -65
- package/src/core/TabItem/TabItem.module.css +0 -28
- package/src/core/TabItem/index.tsx +0 -42
- package/src/core/Tabs/Tabs.module.css +0 -19
- package/src/core/Tabs/Tabs.spec.tsx +0 -30
- package/src/core/Tabs/index.tsx +0 -36
- package/src/core/Toast/Toast.module.css +0 -54
- package/src/core/Toast/Toast.spec.tsx +0 -80
- package/src/core/Toast/index.tsx +0 -79
- package/src/core/TwoFactor/TwoFactor.spec.tsx +0 -183
- package/src/core/TwoFactor/index.tsx +0 -102
- package/src/core/TwoFactorAuthenticator/index.tsx +0 -39
- package/src/core/TwoFactorMethodList/TwoFactorMethodList.module.css +0 -50
- package/src/core/TwoFactorMethodList/index.tsx +0 -49
- package/src/core/TwoFactorSetup/index.tsx +0 -91
- package/src/core/TwoFactorSetupAuthenticator/TwoFactorSetupAuthenticator.module.css +0 -6
- package/src/core/TwoFactorSetupAuthenticator/index.tsx +0 -100
- package/src/core/TwoFactorSetupYubikey/index.tsx +0 -49
- package/src/core/TwoFactorYubikey/index.tsx +0 -41
- package/src/core/WeekCalendarDay/WeekCalendarDay.module.css +0 -32
- package/src/core/WeekCalendarDay/index.tsx +0 -68
- package/src/core/YubikeyInput/YubikeyInput.module.css +0 -27
- package/src/core/YubikeyInput/YubikeyInput.spec.tsx +0 -77
- package/src/core/YubikeyInput/index.tsx +0 -76
- package/src/filters/BooleanFilter/index.tsx +0 -47
- package/src/filters/DateFilter/index.tsx +0 -36
- package/src/filters/DropdownFilter/index.tsx +0 -51
- package/src/filters/QuickDateFilter/index.tsx +0 -74
- package/src/filters/interfaces.ts +0 -39
- package/src/hooks/useAlert.spec.tsx +0 -72
- package/src/hooks/useAlert.ts +0 -37
- package/src/hooks/useConfig.ts +0 -31
- package/src/hooks/useConnectedList.ts +0 -15
- package/src/hooks/useConnectedRepeater.ts +0 -25
- package/src/hooks/useConnectedTable.ts +0 -15
- package/src/hooks/useFilters.ts +0 -34
- package/src/hooks/useLayout.spec.ts +0 -31
- package/src/hooks/useLayout.ts +0 -23
- package/src/hooks/useModal.spec.tsx +0 -72
- package/src/hooks/useModal.ts +0 -62
- package/src/hooks/useModalOffset.spec.ts +0 -27
- package/src/hooks/useModalOffset.ts +0 -26
- package/src/hooks/useNavigation.ts +0 -160
- package/src/hooks/useRemote.ts +0 -43
- package/src/scenes/Error404Scene.tsx +0 -7
- package/src/services/AppService.ts +0 -16
- package/src/services/ConfirmService.ts +0 -26
- package/src/services/DateService.spec.ts +0 -102
- package/src/services/DateService.ts +0 -182
- package/src/services/DownloadService.spec.ts +0 -23
- package/src/services/DownloadService.ts +0 -21
- package/src/services/FilterComponentService.tsx +0 -67
- package/src/services/FilterService.spec.ts +0 -105
- package/src/services/FilterService.ts +0 -80
- package/src/services/FormatService.spec.ts +0 -85
- package/src/services/FormatService.ts +0 -60
- package/src/services/ToastService.spec.ts +0 -44
- package/src/services/ToastService.ts +0 -24
- package/src/typings.d.ts +0 -4
- package/src/utility/MockRouter/index.ts +0 -46
- package/src/utility/icons.tsx +0 -51
- package/src/utility/interfaces.ts +0 -142
- package/src/utility/middleware.ts +0 -10
- package/src/utility/prop-types.ts +0 -89
- package/src/utility/register.tsx +0 -11
- package/tsconfig.eslint.json +0 -4
- /package/dist/{filters/interfaces.js → interfaces.js} +0 -0
package/dist/hooks/useFilters.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { useRouter } from 'next/router';
|
|
4
|
-
import { ifWindow } from '@sqrzro/utility';
|
|
5
|
-
import FilterService from '../services/FilterService';
|
|
6
|
-
/**
|
|
7
|
-
* This hook is essentially a wrapper around the FilterService. It returns the filters based on the
|
|
8
|
-
* current URL, and a function that pushes new filters to the URL
|
|
9
|
-
* @param options
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
function useFilters() {
|
|
13
|
-
const router = useRouter();
|
|
14
|
-
const [filters, setFilters] = useState(FilterService.getFiltersFromContext(null));
|
|
15
|
-
const search = ifWindow((win) => win.location.search, {});
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
setFilters(FilterService.getFiltersFromContext(null));
|
|
18
|
-
}, [search]);
|
|
19
|
-
function applyFilters(data) {
|
|
20
|
-
void router.push(FilterService.setFiltersUrlFromContext(null, data));
|
|
21
|
-
}
|
|
22
|
-
return [filters, applyFilters];
|
|
23
|
-
}
|
|
24
|
-
export default useFilters;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AppLayout } from '../services/ConfigService';
|
|
2
|
-
interface UseLayoutReturn {
|
|
3
|
-
layout: AppLayout;
|
|
4
|
-
applyLayoutClassName: (styles: Record<string, string>, prefix?: string) => string | null;
|
|
5
|
-
}
|
|
6
|
-
declare function useLayout(): UseLayoutReturn;
|
|
7
|
-
export default useLayout;
|
package/dist/hooks/useLayout.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ucwords } from '@sqrzro/utility';
|
|
2
|
-
import useAppConfig from '../hooks/useAppConfig';
|
|
3
|
-
function useLayout() {
|
|
4
|
-
const { style: { layout }, } = useAppConfig();
|
|
5
|
-
function applyLayoutClassName(styles, prefix = 'root') {
|
|
6
|
-
return styles[`${prefix}${ucwords(layout)}`];
|
|
7
|
-
}
|
|
8
|
-
return { layout, applyLayoutClassName };
|
|
9
|
-
}
|
|
10
|
-
export default useLayout;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import useLayout from './useLayout';
|
|
3
|
-
import { AppLayout } from '../services/ConfigService';
|
|
4
|
-
describe('useLayout', () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
jest.spyOn(React, 'useContext').mockImplementationOnce(() => ({
|
|
7
|
-
style: { layout: AppLayout.sidebar },
|
|
8
|
-
}));
|
|
9
|
-
});
|
|
10
|
-
it('should return the layout', () => {
|
|
11
|
-
const { layout } = useLayout();
|
|
12
|
-
expect(layout).toBe('sidebar');
|
|
13
|
-
});
|
|
14
|
-
it('should apply clsx', () => {
|
|
15
|
-
const styles = { rootSidebar: 'lorem' };
|
|
16
|
-
const { applyLayoutClassName } = useLayout();
|
|
17
|
-
expect(applyLayoutClassName(styles)).toEqual('lorem');
|
|
18
|
-
});
|
|
19
|
-
it('should not apply clsx if no styles', () => {
|
|
20
|
-
const styles = {};
|
|
21
|
-
const { applyLayoutClassName } = useLayout();
|
|
22
|
-
expect(applyLayoutClassName(styles)).toBeUndefined();
|
|
23
|
-
});
|
|
24
|
-
});
|
package/dist/hooks/useModal.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { ModalComponentProps } from '../core/ModalComponent';
|
|
3
|
-
interface UseModalOptions {
|
|
4
|
-
onClose?: React.MouseEventHandler<HTMLButtonElement>;
|
|
5
|
-
}
|
|
6
|
-
interface UseModalReturn {
|
|
7
|
-
closeModal: () => void;
|
|
8
|
-
modalProps: ModalComponentProps;
|
|
9
|
-
openModal: () => void;
|
|
10
|
-
}
|
|
11
|
-
declare function useModal(options?: UseModalOptions): UseModalReturn;
|
|
12
|
-
export default useModal;
|
package/dist/hooks/useModal.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { useBrowserLayoutEffect } from '@sqrzro/hooks';
|
|
4
|
-
import { EventService } from '@sqrzro/utility';
|
|
5
|
-
function useModal(options) {
|
|
6
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
7
|
-
const [offset, setOffset] = useState(0);
|
|
8
|
-
useBrowserLayoutEffect(() => {
|
|
9
|
-
/*
|
|
10
|
-
* Using document body in jest is complex. This can be ignored by test coverage for now.
|
|
11
|
-
*/
|
|
12
|
-
/* istanbul ignore next */
|
|
13
|
-
const wrap = document.body;
|
|
14
|
-
setOffset(window.innerWidth - wrap.offsetWidth);
|
|
15
|
-
}, []);
|
|
16
|
-
useBrowserLayoutEffect(() => {
|
|
17
|
-
EventService.publish('@modal/open', { isOpen, offset });
|
|
18
|
-
/*
|
|
19
|
-
* Using document body in jest is complex. This can be ignored by test coverage for now.
|
|
20
|
-
*/
|
|
21
|
-
/* istanbul ignore next */
|
|
22
|
-
document.body.style.overflowY = isOpen ? 'hidden' : 'scroll';
|
|
23
|
-
const wrap = document.body;
|
|
24
|
-
wrap.style.marginRight = isOpen ? `${offset}px` : '0';
|
|
25
|
-
}, [isOpen]);
|
|
26
|
-
function handleClose(event) {
|
|
27
|
-
setIsOpen(false);
|
|
28
|
-
if (options?.onClose) {
|
|
29
|
-
options.onClose(event);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
const modalProps = { children: false, isOpen, onClose: handleClose };
|
|
33
|
-
return {
|
|
34
|
-
closeModal: () => setIsOpen(false),
|
|
35
|
-
modalProps,
|
|
36
|
-
openModal: () => setIsOpen(true),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export default useModal;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { EventService } from '@sqrzro/utility';
|
|
4
|
-
function useModalOffset(property) {
|
|
5
|
-
const [style, setStyle] = useState({ [property]: '0px' });
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
const sub = EventService.subscribe('@modal/open', (key, data) => {
|
|
8
|
-
setStyle({ [property]: `${data.isOpen ? data.offset : 0}px` });
|
|
9
|
-
});
|
|
10
|
-
return () => {
|
|
11
|
-
EventService.unsubscribe(sub);
|
|
12
|
-
};
|
|
13
|
-
}, []);
|
|
14
|
-
return style;
|
|
15
|
-
}
|
|
16
|
-
export default useModalOffset;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { act, renderHook } from '@testing-library/react-hooks';
|
|
2
|
-
import { EventService } from '@sqrzro/utility';
|
|
3
|
-
import useModalOffset from './useModalOffset';
|
|
4
|
-
describe('useModalOffset', () => {
|
|
5
|
-
it('should apply offset if modal open', () => {
|
|
6
|
-
const { result } = renderHook(() => useModalOffset('marginTop'));
|
|
7
|
-
act(() => {
|
|
8
|
-
EventService.publish('@modal/open', { isOpen: true, offset: 100 });
|
|
9
|
-
});
|
|
10
|
-
expect(result.current).toEqual({ marginTop: '100px' });
|
|
11
|
-
});
|
|
12
|
-
it('should not apply offset if modal closed', () => {
|
|
13
|
-
const { result } = renderHook(() => useModalOffset('marginTop'));
|
|
14
|
-
act(() => {
|
|
15
|
-
EventService.publish('@modal/open', { isOpen: false, offset: 100 });
|
|
16
|
-
});
|
|
17
|
-
expect(result.current).toEqual({ marginTop: '0px' });
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { NavigationData, NavigationObject } from '../utility/interfaces';
|
|
2
|
-
interface ParsedNavigationObject extends Omit<NavigationObject, 'isDisabled'> {
|
|
3
|
-
isDisabled: boolean;
|
|
4
|
-
}
|
|
5
|
-
type UseNavigationReturn = ParsedNavigationObject[];
|
|
6
|
-
declare function useNavigation(data: NavigationData): UseNavigationReturn;
|
|
7
|
-
export default useNavigation;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { useRouter } from 'next/router';
|
|
4
|
-
import { EventService, UrlService } from '@sqrzro/utility';
|
|
5
|
-
/**
|
|
6
|
-
* Checks if a specific navigation item should be disabled. The item's `disabled` property is either
|
|
7
|
-
* a boolean or a function that returns a boolean. If it's the latter, we pass the item and
|
|
8
|
-
* sceneData (which is an object returned by the '@scene/data' event subscription) to the function,
|
|
9
|
-
* and expect a boolean to be returned.
|
|
10
|
-
*
|
|
11
|
-
* Passing the sceneData object is useful in case the item's `disabled` property is dependent on
|
|
12
|
-
* some property of data itself (e.g. disable a 'Transactions' tab if a user doesn't have any).
|
|
13
|
-
*
|
|
14
|
-
* @param item
|
|
15
|
-
* @param sceneData
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
function checkDisabled(item, sceneData) {
|
|
19
|
-
if (typeof item.to === 'undefined' && !item.onClick) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
if (!item.isDisabled) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
return typeof item.isDisabled === 'function'
|
|
26
|
-
? item.isDisabled(item, sceneData)
|
|
27
|
-
: item.isDisabled;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Parses the base path from the navigation data. This replaces some functionality that NextJS
|
|
31
|
-
* already does, but it seems unnavoidable. It takes a basePath, for example '/lorem/[id]', and
|
|
32
|
-
* returns a path with values from the router query inserted into it, e.g. '/lorem/1' (if the
|
|
33
|
-
* router query was `{ id: '1' }`).
|
|
34
|
-
*/
|
|
35
|
-
function parseBasePath(router, basePath) {
|
|
36
|
-
let parsedBasePath = basePath;
|
|
37
|
-
for (const key in router.query) {
|
|
38
|
-
if (Object.hasOwnProperty.call(router.query, key)) {
|
|
39
|
-
parsedBasePath = parsedBasePath.replace(`[${key}]`, router.query[key]?.toString() || '');
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return parsedBasePath;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Creates a URL for a navigation item, given a base path and a route. It builds a basePath (using
|
|
46
|
-
* `parseBasePath`) and then appends the route to it.
|
|
47
|
-
*/
|
|
48
|
-
function parseTo(router, basePath, to) {
|
|
49
|
-
if (typeof to === 'undefined') {
|
|
50
|
-
return to;
|
|
51
|
-
}
|
|
52
|
-
const parsedBasePath = parseBasePath(router, basePath);
|
|
53
|
-
return UrlService.join([parsedBasePath, to || '']);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Parses a navigation item, returning a processed `to`, as well as whether or not the item is
|
|
57
|
-
* disabled or active.
|
|
58
|
-
*/
|
|
59
|
-
function parseNavigationItem(router, basePath, activeRoute, sceneData, item) {
|
|
60
|
-
const parsedTo = parseTo(router, basePath, item.to);
|
|
61
|
-
return {
|
|
62
|
-
...item,
|
|
63
|
-
isActive: parsedTo === activeRoute,
|
|
64
|
-
isDisabled: checkDisabled(item, sceneData),
|
|
65
|
-
to: parsedTo,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function checkActive(router, route) {
|
|
69
|
-
if (!router || !route) {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
return parseTo(router, router.asPath, '')?.startsWith(route) || false;
|
|
73
|
-
}
|
|
74
|
-
function getActiveRoute(router, basePath, routes) {
|
|
75
|
-
const activeRoutes = routes
|
|
76
|
-
.map((item) => {
|
|
77
|
-
const parsedTo = parseTo(router, basePath, item.to);
|
|
78
|
-
if (!parsedTo) {
|
|
79
|
-
return '';
|
|
80
|
-
}
|
|
81
|
-
return parsedTo;
|
|
82
|
-
})
|
|
83
|
-
.filter((item) => checkActive(router, item))
|
|
84
|
-
/*
|
|
85
|
-
* Sorting by length descending ensures that we get the most 'specific' route. For example,
|
|
86
|
-
* if there were routes for `lorem` and `lorem/ipsum` in the navigation, we would only want
|
|
87
|
-
* to highlight `lorem/ipsum` if it was the active route.
|
|
88
|
-
*/
|
|
89
|
-
.sort((first, second) => second.length - first.length);
|
|
90
|
-
return activeRoutes[0];
|
|
91
|
-
}
|
|
92
|
-
function getBasePathAndRoutes(data) {
|
|
93
|
-
if (data.length === 2 && typeof data[0] === 'string' && Array.isArray(data[1])) {
|
|
94
|
-
return [data[0], data[1]];
|
|
95
|
-
}
|
|
96
|
-
return ['', data];
|
|
97
|
-
}
|
|
98
|
-
function useNavigation(data) {
|
|
99
|
-
const [sceneData, setSceneData] = useState({});
|
|
100
|
-
const router = useRouter();
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
const sub = EventService.subscribe('@scene/data', (_key, responseData) => {
|
|
103
|
-
setSceneData(responseData);
|
|
104
|
-
});
|
|
105
|
-
return () => {
|
|
106
|
-
EventService.unsubscribe(sub);
|
|
107
|
-
};
|
|
108
|
-
}, []);
|
|
109
|
-
const [basePath, routes] = getBasePathAndRoutes(data);
|
|
110
|
-
const activeRoute = getActiveRoute(router, basePath, routes);
|
|
111
|
-
return routes.map((item) => parseNavigationItem(router, basePath, activeRoute, sceneData, item));
|
|
112
|
-
}
|
|
113
|
-
export default useNavigation;
|
package/dist/hooks/useRemote.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { ApiService, EventService } from '@sqrzro/utility';
|
|
4
|
-
function useRemote(remote) {
|
|
5
|
-
const [data, setData] = useState();
|
|
6
|
-
const [error, setError] = useState('');
|
|
7
|
-
async function getData() {
|
|
8
|
-
try {
|
|
9
|
-
const response = await ApiService.get(remote);
|
|
10
|
-
EventService.publish('@scene/data', response.data);
|
|
11
|
-
}
|
|
12
|
-
catch (err) {
|
|
13
|
-
if (err instanceof Error) {
|
|
14
|
-
setError(err.toString());
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
const sub = EventService.subscribe('@scene/data', (_key, responseData) => {
|
|
20
|
-
setData(responseData);
|
|
21
|
-
});
|
|
22
|
-
void getData();
|
|
23
|
-
return () => {
|
|
24
|
-
EventService.unsubscribe(sub);
|
|
25
|
-
};
|
|
26
|
-
}, []);
|
|
27
|
-
return { data, error };
|
|
28
|
-
}
|
|
29
|
-
export default useRemote;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { StyleVariant } from '../utility/interfaces';
|
|
2
|
-
type VariantStyles<T extends string> = {
|
|
3
|
-
[key in T]?: string;
|
|
4
|
-
};
|
|
5
|
-
interface UseVariantReturn<T extends string> {
|
|
6
|
-
applyVariantClassName: (styles: VariantStyles<T>) => string[] | null;
|
|
7
|
-
}
|
|
8
|
-
declare function useVariant<T extends string = StyleVariant>(variant?: T | T[]): UseVariantReturn<T>;
|
|
9
|
-
export default useVariant;
|
package/dist/hooks/useVariant.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
function useVariant(variant) {
|
|
2
|
-
function applyVariantClassName(styles) {
|
|
3
|
-
if (!variant) {
|
|
4
|
-
return null;
|
|
5
|
-
}
|
|
6
|
-
const variantArray = Array.isArray(variant) ? variant : [variant];
|
|
7
|
-
const styleArray = variantArray
|
|
8
|
-
.map((item) => (item ? styles[item] || '' : ''))
|
|
9
|
-
.filter(Boolean);
|
|
10
|
-
return styleArray.length ? styleArray : null;
|
|
11
|
-
}
|
|
12
|
-
return { applyVariantClassName };
|
|
13
|
-
}
|
|
14
|
-
export default useVariant;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ApiService } from '@sqrzro/utility';
|
|
2
|
-
import ConfigService from '../services/ConfigService';
|
|
3
|
-
const register = (userConfig) => {
|
|
4
|
-
const config = ConfigService.registerConfig(userConfig);
|
|
5
|
-
ApiService.registerConfig({ path: config.paths.api });
|
|
6
|
-
};
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
|
-
const AppService = {
|
|
9
|
-
register,
|
|
10
|
-
};
|
|
11
|
-
export default AppService;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
export interface ConfirmModalData {
|
|
3
|
-
description: ReactNode;
|
|
4
|
-
label?: string;
|
|
5
|
-
onConfirm?: () => void;
|
|
6
|
-
}
|
|
7
|
-
export interface ConfirmObject {
|
|
8
|
-
ask: (data: ConfirmModalData) => boolean;
|
|
9
|
-
close: () => boolean;
|
|
10
|
-
}
|
|
11
|
-
declare const ConfirmService: ConfirmObject;
|
|
12
|
-
export default ConfirmService;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { EventService } from '@sqrzro/utility';
|
|
2
|
-
function ask(data) {
|
|
3
|
-
return EventService.publish('@confirm/send', data);
|
|
4
|
-
}
|
|
5
|
-
function close() {
|
|
6
|
-
return EventService.publish('@confirm/send', null);
|
|
7
|
-
}
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
|
-
const ConfirmService = { ask, close };
|
|
10
|
-
export default ConfirmService;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { StrictSimpleObject } from '../utility/interfaces';
|
|
2
|
-
interface DateItem {
|
|
3
|
-
id: number;
|
|
4
|
-
name: string | null;
|
|
5
|
-
}
|
|
6
|
-
declare function getDays(): DateItem[];
|
|
7
|
-
declare function getMonths(): DateItem[];
|
|
8
|
-
declare function getYears(startYear?: number, endYear?: number): DateItem[];
|
|
9
|
-
declare function isToday(date: string): boolean;
|
|
10
|
-
declare function getDayOfWeek(date: string): number;
|
|
11
|
-
declare function getDaysInMonth(date: string): number;
|
|
12
|
-
declare function addMonths(date: string, amount: number): string;
|
|
13
|
-
declare function subMonths(date: string, amount: number): string;
|
|
14
|
-
declare function getQuickDates(): StrictSimpleObject[];
|
|
15
|
-
declare const DateService: {
|
|
16
|
-
addMonths: typeof addMonths;
|
|
17
|
-
getDaysInMonth: typeof getDaysInMonth;
|
|
18
|
-
getDayOfWeek: typeof getDayOfWeek;
|
|
19
|
-
getDays: typeof getDays;
|
|
20
|
-
getMonths: typeof getMonths;
|
|
21
|
-
getQuickDates: typeof getQuickDates;
|
|
22
|
-
getYears: typeof getYears;
|
|
23
|
-
isToday: typeof isToday;
|
|
24
|
-
subMonths: typeof subMonths;
|
|
25
|
-
};
|
|
26
|
-
export default DateService;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { addMonths as fnsAddMonths, getDay as fnsGetDay, getDaysInMonth as fnsGetDaysInMonth, set as fnsSet, subDays as fnsSubDays, subMonths as fnsSubMonths, parseISO, } from 'date-fns';
|
|
2
|
-
import FormatService from './FormatService';
|
|
3
|
-
const DAYS_IN_WEEK = 7;
|
|
4
|
-
const MONTHS_IN_YEAR = 12;
|
|
5
|
-
const DAYS_IN_30_DAYS = 30;
|
|
6
|
-
const DAYS_IN_MONTH = 31;
|
|
7
|
-
const FIRST_YEAR = 1900;
|
|
8
|
-
const SUNDAY = 6;
|
|
9
|
-
function getDays() {
|
|
10
|
-
return Array(DAYS_IN_MONTH)
|
|
11
|
-
.fill(0)
|
|
12
|
-
.map((_item, index) => ({ id: index + 1, name: `${index + 1}` }));
|
|
13
|
-
}
|
|
14
|
-
function getMonths() {
|
|
15
|
-
return Array(MONTHS_IN_YEAR)
|
|
16
|
-
.fill(0)
|
|
17
|
-
.map((_item, index) => ({
|
|
18
|
-
id: index + 1,
|
|
19
|
-
name: FormatService.date(new Date(FIRST_YEAR, index, 1), 'MMMM'),
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
function getYears(startYear = FIRST_YEAR, endYear = new Date().getFullYear()) {
|
|
23
|
-
return Array(endYear - startYear + 1)
|
|
24
|
-
.fill(0)
|
|
25
|
-
.map((_item, index) => ({ id: endYear - index, name: `${endYear - index}` }));
|
|
26
|
-
}
|
|
27
|
-
function isToday(date) {
|
|
28
|
-
return FormatService.date(new Date(), 'y-MM-dd') === date;
|
|
29
|
-
}
|
|
30
|
-
// Most date libraries start the week on Sunday (US). We want to start on Monday (UK).
|
|
31
|
-
function adjustDayOfWeek(num) {
|
|
32
|
-
return num === 0 ? SUNDAY : num - 1;
|
|
33
|
-
}
|
|
34
|
-
function getDayOfWeek(date) {
|
|
35
|
-
const parsed = parseISO(date);
|
|
36
|
-
const num = adjustDayOfWeek(fnsGetDay(parsed));
|
|
37
|
-
return Number.isNaN(num) ? -1 : num;
|
|
38
|
-
}
|
|
39
|
-
function getDaysInMonth(date) {
|
|
40
|
-
const parsed = parseISO(date);
|
|
41
|
-
const num = fnsGetDaysInMonth(parsed);
|
|
42
|
-
return Number.isNaN(num) ? -1 : num;
|
|
43
|
-
}
|
|
44
|
-
function addMonths(date, amount) {
|
|
45
|
-
const parsed = parseISO(`${date}-01`);
|
|
46
|
-
return FormatService.date(fnsAddMonths(parsed, amount), 'y-MM');
|
|
47
|
-
}
|
|
48
|
-
function subMonths(date, amount) {
|
|
49
|
-
const parsed = parseISO(`${date}-01`);
|
|
50
|
-
return FormatService.date(fnsSubMonths(parsed, amount), 'y-MM');
|
|
51
|
-
}
|
|
52
|
-
// Quick Date
|
|
53
|
-
const QUICK_DATE_FORMAT = 'Y-MM-dd';
|
|
54
|
-
function getToday() {
|
|
55
|
-
return new Date();
|
|
56
|
-
}
|
|
57
|
-
function getYesterday() {
|
|
58
|
-
return fnsSubDays(new Date(), 1);
|
|
59
|
-
}
|
|
60
|
-
function getLast7Days() {
|
|
61
|
-
return [fnsSubDays(new Date(), DAYS_IN_WEEK), new Date()];
|
|
62
|
-
}
|
|
63
|
-
function getLast30Days() {
|
|
64
|
-
return [fnsSubDays(new Date(), DAYS_IN_30_DAYS), new Date()];
|
|
65
|
-
}
|
|
66
|
-
// Get the first day of this month, and today
|
|
67
|
-
function getThisMonth() {
|
|
68
|
-
return [fnsSet(new Date(), { date: 1 }), getToday()];
|
|
69
|
-
}
|
|
70
|
-
// Get the first day of last month, and the day before the first day of this month
|
|
71
|
-
function getLastMonth() {
|
|
72
|
-
return [fnsSet(fnsSubMonths(new Date(), 1), { date: 1 }), fnsSubDays(getThisMonth()[0], 1)];
|
|
73
|
-
}
|
|
74
|
-
function getQuickDateId(value) {
|
|
75
|
-
if (Array.isArray(value)) {
|
|
76
|
-
return value.map((item) => FormatService.date(item, QUICK_DATE_FORMAT)).join(',');
|
|
77
|
-
}
|
|
78
|
-
const formatted = FormatService.date(value, QUICK_DATE_FORMAT);
|
|
79
|
-
return `${formatted},${formatted}`;
|
|
80
|
-
}
|
|
81
|
-
function getQuickDates() {
|
|
82
|
-
const today = new Date();
|
|
83
|
-
const dates = [
|
|
84
|
-
{
|
|
85
|
-
id: getToday(),
|
|
86
|
-
name: 'Today',
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
id: getYesterday(),
|
|
90
|
-
name: 'Yesterday',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
id: getLast7Days(),
|
|
94
|
-
name: 'Last 7 Days',
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
id: getLast30Days(),
|
|
98
|
-
name: 'Last 30 Days',
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
/*
|
|
102
|
-
* If the date is the 8th or 31st of the month, it matches up with last 7 days or last 30 days,
|
|
103
|
-
* respectively, and causes duplicate key errors. So best just leave it out in these cases.
|
|
104
|
-
*/
|
|
105
|
-
if (today.getDate() !== DAYS_IN_WEEK + 1 && today.getDate() !== DAYS_IN_MONTH) {
|
|
106
|
-
dates.push({
|
|
107
|
-
id: getThisMonth(),
|
|
108
|
-
name: 'This Month',
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
dates.push({
|
|
112
|
-
id: getLastMonth(),
|
|
113
|
-
name: 'Last Month',
|
|
114
|
-
});
|
|
115
|
-
return dates.map((item) => ({
|
|
116
|
-
id: getQuickDateId(item.id),
|
|
117
|
-
name: item.name,
|
|
118
|
-
}));
|
|
119
|
-
}
|
|
120
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
121
|
-
const DateService = {
|
|
122
|
-
addMonths,
|
|
123
|
-
getDaysInMonth,
|
|
124
|
-
getDayOfWeek,
|
|
125
|
-
getDays,
|
|
126
|
-
getMonths,
|
|
127
|
-
getQuickDates,
|
|
128
|
-
getYears,
|
|
129
|
-
isToday,
|
|
130
|
-
subMonths,
|
|
131
|
-
};
|
|
132
|
-
export default DateService;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import MockDate from 'mockdate';
|
|
2
|
-
import DateService from './DateService';
|
|
3
|
-
describe('DateService', () => {
|
|
4
|
-
it('should addMonths', () => {
|
|
5
|
-
expect(DateService.addMonths('2020-01', 4)).toBe('2020-05');
|
|
6
|
-
expect(DateService.addMonths('1946-07', 12)).toBe('1947-07');
|
|
7
|
-
expect(DateService.addMonths('2050-02', 1)).toBe('2050-03');
|
|
8
|
-
expect(DateService.addMonths('2021-02', 0)).toBe('2021-02');
|
|
9
|
-
expect(DateService.addMonths('lorem', 5)).toBe('');
|
|
10
|
-
});
|
|
11
|
-
it('should getDaysInMonth', () => {
|
|
12
|
-
expect(DateService.getDaysInMonth('2020-01')).toBe(31);
|
|
13
|
-
expect(DateService.getDaysInMonth('2020-02')).toBe(29);
|
|
14
|
-
expect(DateService.getDaysInMonth('1950-09')).toBe(30);
|
|
15
|
-
expect(DateService.getDaysInMonth('lorem')).toBe(-1);
|
|
16
|
-
});
|
|
17
|
-
it('should getDayOfWeek', () => {
|
|
18
|
-
expect(DateService.getDayOfWeek('1987-04-18')).toBe(5);
|
|
19
|
-
expect(DateService.getDayOfWeek('2018-06-17')).toBe(6);
|
|
20
|
-
expect(DateService.getDayOfWeek('2028-05-18')).toBe(3);
|
|
21
|
-
expect(DateService.getDayOfWeek('2045-08-07')).toBe(0);
|
|
22
|
-
expect(DateService.getDayOfWeek('2046-01-02')).toBe(1);
|
|
23
|
-
expect(DateService.getDayOfWeek('lorem')).toBe(-1);
|
|
24
|
-
});
|
|
25
|
-
it('should getDays', () => {
|
|
26
|
-
const days = DateService.getDays();
|
|
27
|
-
expect(days[0]).toEqual({ id: 1, name: '1' });
|
|
28
|
-
expect(days[17]).toEqual({ id: 18, name: '18' });
|
|
29
|
-
expect(days[40]).toBeUndefined();
|
|
30
|
-
});
|
|
31
|
-
it('should getMonths', () => {
|
|
32
|
-
const months = DateService.getMonths();
|
|
33
|
-
expect(months[0]).toEqual({ id: 1, name: 'January' });
|
|
34
|
-
expect(months[7]).toEqual({ id: 8, name: 'August' });
|
|
35
|
-
expect(months[14]).toBeUndefined();
|
|
36
|
-
});
|
|
37
|
-
it('should getQuickDates', () => {
|
|
38
|
-
MockDate.set('2000-11-22');
|
|
39
|
-
const dates = DateService.getQuickDates();
|
|
40
|
-
expect(dates).toHaveLength(6);
|
|
41
|
-
expect(dates[0]).toEqual({ id: '2000-11-22,2000-11-22', name: 'Today' });
|
|
42
|
-
expect(dates[1]).toEqual({ id: '2000-11-21,2000-11-21', name: 'Yesterday' });
|
|
43
|
-
expect(dates[2]).toEqual({ id: '2000-11-15,2000-11-22', name: 'Last 7 Days' });
|
|
44
|
-
expect(dates[3]).toEqual({ id: '2000-10-23,2000-11-22', name: 'Last 30 Days' });
|
|
45
|
-
expect(dates[4]).toEqual({ id: '2000-11-01,2000-11-22', name: 'This Month' });
|
|
46
|
-
expect(dates[5]).toEqual({ id: '2000-10-01,2000-10-31', name: 'Last Month' });
|
|
47
|
-
});
|
|
48
|
-
it('should getQuickDates (8th of month)', () => {
|
|
49
|
-
MockDate.set('2000-11-08');
|
|
50
|
-
const dates = DateService.getQuickDates();
|
|
51
|
-
expect(dates).toHaveLength(5);
|
|
52
|
-
});
|
|
53
|
-
it('should getQuickDates (31st of month)', () => {
|
|
54
|
-
MockDate.set('2000-12-31');
|
|
55
|
-
const dates = DateService.getQuickDates();
|
|
56
|
-
expect(dates).toHaveLength(5);
|
|
57
|
-
});
|
|
58
|
-
describe('should getYears', () => {
|
|
59
|
-
it('should get default years', () => {
|
|
60
|
-
MockDate.set('2021-11-22');
|
|
61
|
-
const years = DateService.getYears();
|
|
62
|
-
expect(years[0]).toEqual({ id: 2021, name: '2021' });
|
|
63
|
-
expect(years[17]).toEqual({ id: 2004, name: '2004' });
|
|
64
|
-
expect(years[200]).toBeUndefined();
|
|
65
|
-
});
|
|
66
|
-
it('should get custom years', () => {
|
|
67
|
-
expect(DateService.getYears(2000, 2016)[3]).toEqual({ id: 2013, name: '2013' });
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
describe('should isToday', () => {
|
|
71
|
-
MockDate.set('2000-11-22');
|
|
72
|
-
expect(DateService.isToday('2000-11-22')).toBe(true);
|
|
73
|
-
expect(DateService.isToday('2001-11-22')).toBe(false);
|
|
74
|
-
expect(DateService.isToday('lorem')).toBe(false);
|
|
75
|
-
});
|
|
76
|
-
describe('should subMonths', () => {
|
|
77
|
-
expect(DateService.subMonths('2020-01', 4)).toBe('2019-09');
|
|
78
|
-
expect(DateService.subMonths('1946-07', 12)).toBe('1945-07');
|
|
79
|
-
expect(DateService.subMonths('2050-02', 1)).toBe('2050-01');
|
|
80
|
-
expect(DateService.subMonths('2021-02', 0)).toBe('2021-02');
|
|
81
|
-
expect(DateService.subMonths('lorem', 5)).toBe('');
|
|
82
|
-
});
|
|
83
|
-
});
|