@sqrzro/admin 1.0.0-beta.7 → 2.0.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/.eslintrc +5 -1
- package/.storybook/main.js +6 -34
- package/.storybook/preview-head.html +3 -0
- package/.storybook/preview.js +1 -11
- package/.turbo/turbo-docs.log +0 -0
- package/.turbo/turbo-lint.log +112 -0
- package/.turbo/turbo-prettier.log +215 -0
- package/.turbo/turbo-test.log +6 -0
- package/LICENSE +1 -1
- package/dist/{types/components → components}/Alert/index.d.ts +4 -4
- package/dist/components/Alert/index.js +15 -0
- package/dist/{types/components → components}/Allow/index.d.ts +20 -13
- package/dist/components/Allow/index.js +29 -0
- package/dist/components/AppLayout/AppLayout.stories.d.ts +5 -0
- package/dist/components/AppLayout/AppLayout.stories.js +11 -0
- package/dist/components/AppLayout/index.d.ts +6 -0
- package/dist/components/AppLayout/index.js +18 -0
- package/dist/{types/components → components}/AutoSuggest/index.d.ts +74 -60
- package/dist/components/AutoSuggest/index.js +143 -0
- package/dist/components/Button/Button.stories.d.ts +11 -0
- package/{src/components/Button/Button.story.tsx → dist/components/Button/Button.stories.js} +16 -14
- package/dist/{types/components → components}/Button/index.d.ts +49 -36
- package/dist/components/Button/index.js +50 -0
- package/dist/components/CalendarInput/index.d.ts +24 -0
- package/dist/components/CalendarInput/index.js +54 -0
- package/dist/{types/components → components}/CheckboxList/index.d.ts +17 -17
- package/dist/components/CheckboxList/index.js +25 -0
- package/dist/components/CodeInput/index.d.ts +9 -0
- package/dist/components/CodeInput/index.js +51 -0
- package/dist/{types/components → components}/ConnectedDropdown/index.d.ts +14 -14
- package/dist/components/ConnectedDropdown/index.js +36 -0
- package/dist/{types/components → components}/ConnectedList/index.d.ts +5 -5
- package/dist/components/ConnectedList/index.js +7 -0
- package/dist/{types/components → components}/ConnectedTable/index.d.ts +5 -5
- package/dist/components/ConnectedTable/index.js +7 -0
- package/dist/{types/components → components}/ContentBlock/index.d.ts +16 -16
- package/dist/components/ContentBlock/index.js +13 -0
- package/dist/components/DataPanel/index.d.ts +8 -0
- package/dist/components/DataPanel/index.js +8 -0
- package/dist/components/DateInput/index.d.ts +18 -0
- package/dist/components/DateInput/index.js +81 -0
- package/dist/{types/components → components}/Dropdown/index.d.ts +36 -36
- package/dist/components/Dropdown/index.js +122 -0
- package/dist/components/ErrorMessage/index.d.ts +16 -0
- package/dist/components/ErrorMessage/index.js +17 -0
- package/dist/components/Fieldset/index.d.ts +18 -0
- package/dist/components/Fieldset/index.js +19 -0
- package/dist/{types/components → components}/FileInput/index.d.ts +10 -10
- package/dist/components/FileInput/index.js +26 -0
- package/dist/components/FilterLink/index.d.ts +14 -0
- package/dist/components/FilterLink/index.js +15 -0
- package/dist/components/Form/index.d.ts +14 -0
- package/dist/components/Form/index.js +15 -0
- package/dist/components/FormActions/index.d.ts +18 -0
- package/dist/components/FormActions/index.js +14 -0
- package/dist/{types/components → components}/FormField/index.d.ts +14 -14
- package/dist/components/FormField/index.js +40 -0
- package/dist/components/FormRepeater/index.d.ts +18 -0
- package/dist/components/FormRepeater/index.js +65 -0
- package/dist/{types/components → components}/ImageInput/index.d.ts +13 -13
- package/dist/components/ImageInput/index.js +45 -0
- package/dist/components/InfoPanel/index.d.ts +14 -0
- package/dist/components/InfoPanel/index.js +11 -0
- package/dist/{types/components → components}/Link/__mocks__/index.d.ts +6 -6
- package/dist/components/Link/__mocks__/index.js +12 -0
- package/dist/components/Link/index.d.ts +23 -0
- package/dist/components/Link/index.js +21 -0
- package/dist/{types/components → components}/List/index.d.ts +36 -36
- package/dist/components/List/index.js +46 -0
- package/dist/components/ListActions/index.d.ts +18 -0
- package/dist/components/ListActions/index.js +14 -0
- package/dist/components/LoginForm/index.d.ts +3 -0
- package/dist/components/LoginForm/index.js +47 -0
- package/dist/components/Message/index.d.ts +14 -0
- package/dist/components/Message/index.js +14 -0
- package/dist/{types/components → components}/Modal/index.d.ts +4 -4
- package/dist/components/Modal/index.js +18 -0
- package/dist/components/ModalActions/index.d.ts +21 -0
- package/dist/components/ModalActions/index.js +18 -0
- package/dist/{types/components → components}/MoneyInput/index.d.ts +10 -10
- package/dist/components/MoneyInput/index.js +13 -0
- package/dist/components/PasswordForm/index.d.ts +35 -0
- package/dist/components/PasswordForm/index.js +21 -0
- package/dist/components/PasswordInput/index.d.ts +4 -0
- package/dist/components/PasswordInput/index.js +12 -0
- package/dist/{types/components → components}/RadioList/index.d.ts +9 -9
- package/dist/components/RadioList/index.js +7 -0
- package/dist/components/RootLayout/index.d.ts +6 -0
- package/dist/components/RootLayout/index.js +7 -0
- package/dist/components/SummaryList/index.d.ts +18 -0
- package/dist/components/SummaryList/index.js +15 -0
- package/dist/components/Switch/index.d.ts +21 -0
- package/dist/components/Switch/index.js +31 -0
- package/dist/{types/components → components}/Table/index.d.ts +28 -28
- package/dist/components/Table/index.js +55 -0
- package/dist/components/Tag/index.d.ts +15 -0
- package/dist/components/Tag/index.js +13 -0
- package/dist/components/TextArea/index.d.ts +18 -0
- package/dist/components/TextArea/index.js +26 -0
- package/dist/{types/components → components}/TextInput/index.d.ts +14 -14
- package/dist/components/TextInput/index.js +27 -0
- package/dist/{types/components → components}/WebsiteInput/index.d.ts +10 -10
- package/dist/components/WebsiteInput/index.js +13 -0
- package/dist/components/WeekCalendar/index.d.ts +24 -0
- package/dist/components/WeekCalendar/index.js +48 -0
- package/dist/{types/core → core}/AlertComponent/index.d.ts +26 -26
- package/dist/core/AlertComponent/index.js +35 -0
- package/dist/{types/core → core}/AppHeader/index.d.ts +3 -3
- package/dist/core/AppHeader/index.js +17 -0
- package/dist/core/AppLogo/index.d.ts +12 -0
- package/dist/core/AppLogo/index.js +16 -0
- package/dist/{types/core → core}/AppLogoImage/index.d.ts +3 -3
- package/dist/core/AppLogoImage/index.js +11 -0
- package/dist/{types/core → core}/AppLogoPlaceholder/index.d.ts +3 -3
- package/dist/core/AppLogoPlaceholder/index.js +10 -0
- package/dist/core/Assistive/index.d.ts +12 -0
- package/dist/core/Assistive/index.js +9 -0
- package/dist/core/AuthForm/index.d.ts +10 -0
- package/dist/core/AuthForm/index.js +13 -0
- package/dist/{types/core → core}/Banner/index.d.ts +3 -3
- package/dist/core/Banner/index.js +14 -0
- package/dist/core/Calendar/index.d.ts +21 -0
- package/dist/core/Calendar/index.js +69 -0
- package/dist/core/CalendarDay/index.d.ts +30 -0
- package/dist/core/CalendarDay/index.js +30 -0
- package/dist/core/CalendarMonth/index.d.ts +23 -0
- package/dist/core/CalendarMonth/index.js +45 -0
- package/dist/core/CalendarNavigation/index.d.ts +17 -0
- package/dist/core/CalendarNavigation/index.js +24 -0
- package/dist/core/CalendarWeek/index.d.ts +28 -0
- package/dist/core/CalendarWeek/index.js +46 -0
- package/dist/core/ChkRad/index.d.ts +26 -0
- package/dist/core/ChkRad/index.js +33 -0
- package/dist/core/ChkRadIcon/index.d.ts +14 -0
- package/dist/core/ChkRadIcon/index.js +12 -0
- package/dist/{types/core → core}/ChkRadList/index.d.ts +32 -32
- package/dist/core/ChkRadList/index.js +37 -0
- package/dist/core/CloseButton/index.d.ts +17 -0
- package/dist/core/CloseButton/index.js +12 -0
- package/dist/{types/core → core}/ConfirmModal/index.d.ts +3 -3
- package/dist/core/ConfirmModal/index.js +38 -0
- package/dist/{types/core → core}/ConnectedRepeater/index.d.ts +50 -50
- package/dist/core/ConnectedRepeater/index.js +154 -0
- package/dist/{types/core → core}/ConnectedRepeaterComponent/index.d.ts +24 -24
- package/dist/core/ConnectedRepeaterComponent/index.js +25 -0
- package/dist/core/Container/index.d.ts +14 -0
- package/dist/core/Container/index.js +12 -0
- package/dist/core/DataPanelItem/index.d.ts +8 -0
- package/dist/core/DataPanelItem/index.js +7 -0
- package/dist/core/DropdownPanel/index.d.ts +31 -0
- package/dist/core/DropdownPanel/index.js +32 -0
- package/dist/{types/core → core}/EmptyMessage/index.d.ts +21 -14
- package/dist/core/EmptyMessage/index.js +21 -0
- package/dist/core/FilterItem/index.d.ts +25 -0
- package/dist/core/FilterItem/index.js +82 -0
- package/dist/core/Filters/index.d.ts +31 -0
- package/dist/core/Filters/index.js +85 -0
- package/dist/{types/core → core}/FixedActions/index.d.ts +24 -24
- package/dist/core/FixedActions/index.js +22 -0
- package/dist/core/FormError/index.d.ts +12 -0
- package/dist/core/FormError/index.js +9 -0
- package/dist/core/FormLabel/index.d.ts +16 -0
- package/dist/core/FormLabel/index.js +13 -0
- package/dist/core/FormLegend/index.d.ts +12 -0
- package/dist/core/FormLegend/index.js +9 -0
- package/dist/core/Header/Header.stories.d.ts +5 -0
- package/dist/core/Header/Header.stories.js +11 -0
- package/dist/core/Header/index.d.ts +14 -0
- package/dist/core/Header/index.js +12 -0
- package/dist/core/Icon/index.d.ts +14 -0
- package/dist/core/Icon/index.js +32 -0
- package/dist/core/IconButton/index.d.ts +22 -0
- package/dist/core/IconButton/index.js +20 -0
- package/dist/core/InputPanel/index.d.ts +16 -0
- package/dist/core/InputPanel/index.js +11 -0
- package/dist/{types/core → core}/ListItem/index.d.ts +39 -38
- package/dist/core/ListItem/index.js +44 -0
- package/dist/core/ListItemAction/index.d.ts +11 -0
- package/dist/core/ListItemAction/index.js +13 -0
- package/dist/{types/core → core}/ListItemActions/index.d.ts +8 -8
- package/dist/core/ListItemActions/index.js +16 -0
- package/dist/core/ListItemMetaItem/index.d.ts +19 -0
- package/dist/core/ListItemMetaItem/index.js +29 -0
- package/dist/core/ListItemTitle/index.d.ts +19 -0
- package/dist/core/ListItemTitle/index.js +44 -0
- package/dist/core/Loader/index.d.ts +15 -0
- package/dist/core/Loader/index.js +16 -0
- package/dist/core/MeActions/index.d.ts +3 -0
- package/dist/core/MeActions/index.js +48 -0
- package/dist/{types/core → core}/MePanel/index.d.ts +19 -19
- package/dist/core/MePanel/index.js +29 -0
- package/dist/core/ModalComponent/index.d.ts +22 -0
- package/dist/core/ModalComponent/index.js +29 -0
- package/dist/{types/core → core}/Navigation/index.d.ts +3 -3
- package/dist/core/Navigation/index.js +33 -0
- package/dist/{types/core → core}/NavigationDivider/index.d.ts +3 -3
- package/dist/core/NavigationDivider/index.js +8 -0
- package/dist/core/NavigationItem/index.d.ts +16 -0
- package/dist/core/NavigationItem/index.js +21 -0
- package/dist/core/Pagination/index.d.ts +15 -0
- package/{src/core/Pagination/index.tsx → dist/core/Pagination/index.js} +10 -46
- package/dist/core/PaginationItem/index.d.ts +10 -0
- package/dist/core/PaginationItem/index.js +17 -0
- package/dist/core/Panel/index.d.ts +17 -0
- package/dist/core/Panel/index.js +13 -0
- package/dist/{types/core → core}/PasswordForgotForm/index.d.ts +7 -7
- package/dist/core/PasswordForgotForm/index.js +40 -0
- package/dist/{types/core → core}/PasswordResetForm/index.d.ts +7 -7
- package/dist/core/PasswordResetForm/index.js +34 -0
- package/dist/core/RadialProgress/index.d.ts +16 -0
- package/dist/core/RadialProgress/index.js +23 -0
- package/dist/core/SettingsForm/index.d.ts +3 -0
- package/dist/core/SettingsForm/index.js +14 -0
- package/dist/core/StaticTextInput/index.d.ts +29 -0
- package/dist/core/StaticTextInput/index.js +39 -0
- package/dist/{types/core → core}/Styled/index.d.ts +6 -6
- package/{src/core/Styled/index.tsx → dist/core/Styled/index.js} +7 -30
- package/dist/core/SummaryListItem/index.d.ts +23 -0
- package/dist/core/SummaryListItem/index.js +31 -0
- package/dist/core/TabItem/index.d.ts +4 -0
- package/dist/core/TabItem/index.js +13 -0
- package/dist/{types/core → core}/TableActionsCell/index.d.ts +8 -8
- package/dist/core/TableActionsCell/index.js +8 -0
- package/dist/core/TableCell/index.d.ts +15 -0
- package/dist/core/TableCell/index.js +20 -0
- package/dist/core/TableHead/index.d.ts +18 -0
- package/dist/core/TableHead/index.js +18 -0
- package/dist/{types/core → core}/TableRow/index.d.ts +13 -13
- package/dist/core/TableRow/index.js +18 -0
- package/dist/core/Tabs/index.d.ts +7 -0
- package/dist/core/Tabs/index.js +13 -0
- package/dist/core/TextInputAncillary/index.d.ts +29 -0
- package/dist/core/TextInputAncillary/index.js +31 -0
- package/dist/{types/core → core}/Toast/index.d.ts +3 -3
- package/dist/core/Toast/index.js +47 -0
- package/dist/core/TwoFactor/index.d.ts +13 -0
- package/dist/core/TwoFactor/index.js +49 -0
- package/dist/{types/core/LoginFormAuthenticator → core/TwoFactorAuthenticator}/index.d.ts +10 -10
- package/dist/core/TwoFactorAuthenticator/index.js +9 -0
- package/dist/core/TwoFactorMethodList/index.d.ts +10 -0
- package/dist/core/TwoFactorMethodList/index.js +22 -0
- package/dist/core/TwoFactorSetup/index.d.ts +12 -0
- package/dist/core/TwoFactorSetup/index.js +43 -0
- package/dist/core/TwoFactorSetupAuthenticator/index.d.ts +20 -0
- package/dist/core/TwoFactorSetupAuthenticator/index.js +42 -0
- package/dist/core/TwoFactorSetupYubikey/index.d.ts +16 -0
- package/dist/core/TwoFactorSetupYubikey/index.js +14 -0
- package/dist/{types/core/LoginFormYubikey → core/TwoFactorYubikey}/index.d.ts +9 -9
- package/dist/core/TwoFactorYubikey/index.js +14 -0
- package/dist/core/WeekCalendarDay/index.d.ts +27 -0
- package/dist/core/WeekCalendarDay/index.js +35 -0
- package/dist/core/YubikeyInput/index.d.ts +4 -0
- package/dist/core/YubikeyInput/index.js +14 -0
- package/dist/filters/BooleanFilter/index.d.ts +14 -0
- package/dist/filters/BooleanFilter/index.js +35 -0
- package/dist/filters/DateFilter/index.d.ts +5 -0
- package/dist/filters/DateFilter/index.js +24 -0
- package/dist/filters/DropdownFilter/index.d.ts +17 -0
- package/dist/filters/DropdownFilter/index.js +32 -0
- package/dist/filters/QuickDateFilter/index.d.ts +13 -0
- package/dist/filters/QuickDateFilter/index.js +40 -0
- package/dist/{types/filters → filters}/interfaces.d.ts +35 -35
- package/dist/filters/interfaces.js +1 -0
- package/dist/{types/hooks → hooks}/useAlert.d.ts +12 -12
- package/dist/hooks/useAlert.js +18 -0
- package/dist/hooks/useAppConfig.d.ts +3 -0
- package/dist/hooks/useAppConfig.js +5 -0
- package/dist/{types/hooks → hooks}/useConnectedList.d.ts +7 -7
- package/dist/hooks/useConnectedList.js +6 -0
- package/dist/{types/hooks → hooks}/useConnectedRepeater.d.ts +7 -7
- package/dist/hooks/useConnectedRepeater.js +14 -0
- package/dist/{types/hooks → hooks}/useConnectedTable.d.ts +7 -7
- package/dist/hooks/useConnectedTable.js +6 -0
- package/dist/hooks/useFilters.d.ts +9 -0
- package/dist/hooks/useFilters.js +24 -0
- package/dist/{types/hooks → hooks}/useLayout.d.ts +7 -7
- package/dist/hooks/useLayout.js +10 -0
- package/dist/hooks/useLayout.spec.d.ts +1 -0
- package/dist/hooks/useLayout.spec.js +24 -0
- package/dist/{types/hooks → hooks}/useModal.d.ts +12 -12
- package/dist/hooks/useModal.js +39 -0
- package/dist/hooks/useModalOffset.d.ts +2 -0
- package/dist/hooks/useModalOffset.js +16 -0
- package/dist/hooks/useModalOffset.spec.d.ts +1 -0
- package/dist/hooks/useModalOffset.spec.js +19 -0
- package/dist/hooks/useNavigation.d.ts +7 -0
- package/dist/hooks/useNavigation.js +113 -0
- package/dist/hooks/useRemote.d.ts +7 -0
- package/dist/hooks/useRemote.js +29 -0
- package/dist/hooks/useVariant.d.ts +9 -0
- package/dist/hooks/useVariant.js +14 -0
- package/dist/{types/index.d.ts → index.d.ts} +209 -203
- package/dist/index.js +213 -5459
- package/dist/{types/scenes → scenes}/Error404Scene.d.ts +3 -3
- package/dist/scenes/Error404Scene.js +5 -0
- package/dist/services/AppService.d.ts +5 -0
- package/dist/services/AppService.js +11 -0
- package/dist/services/ConfigService.d.ts +42 -0
- package/dist/services/ConfigService.js +52 -0
- package/dist/{types/services → services}/ConfirmService.d.ts +12 -12
- package/dist/services/ConfirmService.js +10 -0
- package/dist/services/DateService.d.ts +26 -0
- package/dist/services/DateService.js +132 -0
- package/dist/services/DateService.spec.d.ts +1 -0
- package/dist/services/DateService.spec.js +83 -0
- package/dist/services/DownloadService.d.ts +7 -0
- package/dist/services/DownloadService.js +16 -0
- package/dist/services/DownloadService.spec.d.ts +1 -0
- package/dist/services/DownloadService.spec.js +18 -0
- package/dist/{types/services → services}/FilterComponentService.d.ts +25 -25
- package/dist/services/FilterComponentService.js +54 -0
- package/dist/services/FilterService.d.ts +34 -0
- package/dist/services/FilterService.js +58 -0
- package/dist/services/FilterService.spec.d.ts +1 -0
- package/dist/services/FilterService.spec.js +67 -0
- package/dist/services/FormatService.d.ts +11 -0
- package/dist/services/FormatService.js +45 -0
- package/dist/services/FormatService.spec.d.ts +1 -0
- package/dist/services/FormatService.spec.js +66 -0
- package/dist/services/ToastService.d.ts +7 -0
- package/dist/services/ToastService.js +17 -0
- package/dist/services/ToastService.spec.d.ts +1 -0
- package/dist/services/ToastService.spec.js +34 -0
- package/dist/styles.css +984 -0
- package/dist/utility/MockRouter/index.d.ts +2 -0
- package/dist/utility/MockRouter/index.js +37 -0
- package/dist/utility/StorybookPanel/index.d.ts +14 -0
- package/dist/utility/StorybookPanel/index.js +12 -0
- package/dist/utility/TestChangeHandler/index.d.ts +15 -0
- package/dist/utility/TestChangeHandler/index.js +30 -0
- package/dist/utility/icons.d.ts +3 -0
- package/dist/utility/icons.js +12 -0
- package/dist/{types/utility → utility}/interfaces.d.ts +79 -69
- package/dist/utility/interfaces.js +18 -0
- package/dist/utility/middleware.d.ts +4 -0
- package/dist/utility/middleware.js +9 -0
- package/dist/{types/utility → utility}/prop-types.d.ts +57 -55
- package/dist/utility/prop-types.js +77 -0
- package/dist/utility/register.d.ts +3 -0
- package/dist/utility/register.js +9 -0
- package/package.json +53 -88
- package/postcss.config.js +1 -1
- package/prettier.config.js +1 -0
- package/src/components/Alert/index.tsx +103 -13
- package/src/components/Allow/Allow.spec.tsx +2 -2
- package/src/components/Allow/index.tsx +8 -8
- package/src/components/AppLayout/AppLayout.stories.tsx +20 -0
- package/src/components/AppLayout/index.tsx +22 -0
- package/src/components/AutoSuggest/AutoSuggest.spec.tsx +38 -18
- package/src/components/AutoSuggest/AutoSuggest.story.tsx +8 -6
- package/src/components/AutoSuggest/index.tsx +30 -30
- package/src/components/Button/Button.spec.tsx +8 -0
- package/src/components/Button/Button.stories.tsx +62 -0
- package/src/components/Button/index.tsx +9 -93
- package/src/components/CalendarInput/CalendarInput.spec.tsx +38 -22
- package/src/components/CalendarInput/CalendarInput.story.tsx +2 -2
- package/src/components/CalendarInput/index.tsx +23 -19
- package/src/components/CheckboxList/CheckboxList.spec.tsx +20 -10
- package/src/components/CheckboxList/index.tsx +9 -12
- package/src/components/ConnectedDropdown/index.tsx +7 -5
- package/src/components/ConnectedList/index.tsx +13 -11
- package/src/components/ConnectedTable/index.tsx +15 -13
- package/src/components/ContentBlock/index.tsx +10 -8
- package/src/components/DataPanel/index.tsx +25 -0
- package/src/components/DateInput/DateInput.spec.tsx +10 -6
- package/src/components/DateInput/index.tsx +11 -12
- package/src/components/ErrorMessage/index.tsx +18 -20
- package/src/components/Fieldset/Fieldset.story.tsx +17 -13
- package/src/components/Fieldset/index.tsx +12 -10
- package/src/components/FileInput/FileInput.spec.tsx +9 -5
- package/src/components/FileInput/FileInput.story.tsx +3 -1
- package/src/components/FileInput/index.tsx +12 -10
- package/src/components/FilterLink/FilterLink.spec.tsx +18 -4
- package/src/components/FilterLink/index.tsx +19 -14
- package/src/components/Form/Form.spec.tsx +7 -5
- package/src/components/Form/index.tsx +5 -3
- package/src/components/FormActions/FormActions.story.tsx +19 -15
- package/src/components/FormActions/index.tsx +11 -7
- package/src/components/FormField/FormField.spec.tsx +28 -39
- package/src/components/FormField/FormField.stories.tsx +44 -0
- package/src/components/FormField/index.tsx +8 -103
- package/src/components/FormRepeater/FormRepeater.spec.tsx +26 -14
- package/src/components/FormRepeater/index.tsx +9 -7
- package/src/components/ImageInput/ImageInput.spec.tsx +3 -1
- package/src/components/ImageInput/ImageInput.story.tsx +3 -1
- package/src/components/ImageInput/index.tsx +16 -14
- package/src/components/InfoPanel/index.tsx +7 -7
- package/src/components/Link/Link.spec.tsx +4 -2
- package/src/components/Link/__mocks__/index.tsx +3 -3
- package/src/components/Link/index.tsx +6 -6
- package/src/components/List/List.spec.tsx +57 -20
- package/src/components/List/List.story.tsx +21 -2
- package/src/components/List/index.tsx +13 -13
- package/src/components/ListActions/ListActions.story.tsx +3 -1
- package/src/components/ListActions/index.tsx +10 -11
- package/src/components/LoginForm/LoginForm.spec.tsx +19 -7
- package/src/components/LoginForm/LoginForm.story.tsx +25 -0
- package/src/components/LoginForm/index.tsx +72 -171
- package/src/components/Message/index.tsx +12 -10
- package/src/components/Modal/index.tsx +18 -12
- package/src/components/ModalActions/ModalActions.spec.tsx +4 -2
- package/src/components/ModalActions/ModalActions.story.tsx +3 -1
- package/src/components/ModalActions/index.tsx +22 -18
- package/src/components/MoneyInput/MoneyInput.story.tsx +3 -1
- package/src/components/MoneyInput/index.tsx +7 -5
- package/src/components/PasswordForm/index.tsx +12 -24
- package/src/components/RadioList/RadioList.spec.tsx +4 -2
- package/src/components/RadioList/index.tsx +8 -6
- package/src/components/RootLayout/index.tsx +45 -0
- package/src/components/SummaryList/SummaryList.module.css +19 -4
- package/src/components/SummaryList/SummaryList.spec.tsx +14 -2
- package/src/components/SummaryList/SummaryList.story.tsx +3 -1
- package/src/components/SummaryList/index.tsx +16 -14
- package/src/components/Switch/Switch.spec.tsx +8 -4
- package/src/components/Switch/index.tsx +16 -14
- package/src/components/Table/Table.spec.tsx +11 -7
- package/src/components/Table/Table.story.tsx +3 -3
- package/src/components/Table/index.tsx +20 -22
- package/src/components/TextArea/TextArea.spec.tsx +12 -6
- package/src/components/TextArea/index.tsx +10 -8
- package/src/components/TextInput/TextInput.module.css +1 -0
- package/src/components/TextInput/TextInput.spec.tsx +12 -6
- package/src/components/TextInput/TextInput.stories.tsx +46 -0
- package/src/components/TextInput/index.tsx +6 -99
- package/src/components/WebsiteInput/index.tsx +7 -5
- package/src/components/WeekCalendar/index.tsx +8 -8
- package/src/core/AlertComponent/AlertComponent.spec.tsx +17 -4
- package/src/core/AlertComponent/AlertComponent.story.tsx +19 -15
- package/src/core/AlertComponent/index.tsx +30 -25
- package/src/core/AppHeader/index.tsx +5 -3
- package/src/core/AppLogo/index.tsx +9 -7
- package/src/core/AppLogoImage/index.tsx +6 -6
- package/src/core/AppLogoPlaceholder/index.tsx +28 -22
- package/src/core/Assistive/index.tsx +1 -18
- package/src/{components/LoginForm/LoginForm.module.css → core/AuthForm/AuthForm.module.css} +4 -0
- package/src/core/AuthForm/AuthForm.spec.tsx +72 -0
- package/src/core/AuthForm/index.tsx +63 -0
- package/src/core/Banner/index.tsx +11 -11
- package/src/core/Calendar/index.tsx +9 -7
- package/src/core/CalendarDay/index.tsx +12 -12
- package/src/core/CalendarMonth/index.tsx +14 -12
- package/src/core/CalendarNavigation/index.tsx +14 -14
- package/src/core/CalendarWeek/index.tsx +21 -19
- package/src/core/ChkRadList/index.tsx +25 -23
- package/src/core/CloseButton/CloseButton.spec.tsx +4 -2
- package/src/core/CloseButton/index.tsx +10 -8
- package/src/core/ConfirmModal/ConfirmModal.spec.tsx +10 -4
- package/src/core/ConfirmModal/index.tsx +9 -7
- package/src/core/ConnectedRepeater/index.tsx +46 -19
- package/src/core/ConnectedRepeaterComponent/index.tsx +13 -9
- package/src/core/Container/index.tsx +6 -12
- package/src/core/DataPanelItem/index.tsx +19 -0
- package/src/core/EmptyMessage/EmptyMessage.stories.tsx +33 -0
- package/src/core/EmptyMessage/index.tsx +9 -42
- package/src/core/FilterItem/index.tsx +41 -33
- package/src/core/Filters/Filters.spec.tsx +103 -69
- package/src/core/Filters/index.tsx +39 -31
- package/src/core/FixedActions/FixedActions.module.css +6 -0
- package/src/core/FixedActions/FixedActions.spec.tsx +8 -3
- package/src/core/FixedActions/index.tsx +9 -9
- package/src/core/FormLegend/index.tsx +4 -4
- package/src/core/Header/Header.stories.tsx +20 -0
- package/src/core/Header/index.tsx +8 -13
- package/src/core/Icon/Icon.spec.tsx +1 -3
- package/src/core/Icon/index.tsx +14 -10
- package/src/core/IconButton/index.tsx +18 -20
- package/src/core/ListItem/ListItem.story.tsx +23 -19
- package/src/core/ListItem/index.tsx +46 -37
- package/src/core/ListItemAction/index.tsx +7 -14
- package/src/core/ListItemActions/index.tsx +13 -12
- package/src/core/ListItemMetaItem/index.tsx +8 -8
- package/src/core/ListItemTitle/ListItemTitle.module.css +9 -1
- package/src/core/ListItemTitle/ListItemTitle.spec.tsx +24 -2
- package/src/core/ListItemTitle/index.tsx +20 -10
- package/src/core/Loader/Loader.module.css +3 -3
- package/src/core/Loader/Loader.stories.tsx +22 -0
- package/src/core/Loader/index.tsx +2 -27
- package/src/core/MeActions/index.tsx +28 -18
- package/src/core/MePanel/index.tsx +10 -10
- package/src/core/ModalComponent/ModalComponent.spec.tsx +8 -4
- package/src/core/ModalComponent/index.tsx +13 -13
- package/src/core/Navigation/Navigation.spec.tsx +47 -36
- package/src/core/Navigation/index.tsx +18 -58
- package/src/core/NavigationDivider/index.tsx +6 -6
- package/src/core/NavigationItem/index.tsx +12 -21
- package/src/core/Panel/Panel.module.css +11 -0
- package/src/core/Panel/Panel.spec.tsx +16 -0
- package/src/core/Panel/index.tsx +17 -13
- package/src/core/PasswordForgotForm/index.tsx +15 -12
- package/src/core/PasswordResetForm/index.tsx +15 -12
- package/src/core/RadialProgress/index.tsx +11 -14
- package/src/core/SettingsForm/index.tsx +9 -8
- package/src/core/SummaryListItem/SummaryListItem.module.css +3 -11
- package/src/core/SummaryListItem/index.tsx +19 -14
- package/src/core/TabItem/TabItem.module.css +28 -0
- package/src/core/TabItem/index.tsx +42 -0
- package/src/core/Tabs/Tabs.module.css +0 -24
- package/src/core/Tabs/Tabs.spec.tsx +30 -0
- package/src/core/Tabs/index.tsx +18 -76
- package/src/core/Toast/Toast.spec.tsx +4 -2
- package/src/core/Toast/index.tsx +16 -18
- package/src/core/TwoFactor/TwoFactor.spec.tsx +183 -0
- package/src/core/TwoFactor/index.tsx +102 -0
- package/src/core/TwoFactorAuthenticator/index.tsx +39 -0
- package/src/core/{LoginFormTwoFactor/LoginFormTwoFactor.module.css → TwoFactorMethodList/TwoFactorMethodList.module.css} +1 -1
- package/src/core/TwoFactorMethodList/index.tsx +49 -0
- package/src/core/TwoFactorSetup/index.tsx +91 -0
- package/src/core/TwoFactorSetupAuthenticator/TwoFactorSetupAuthenticator.module.css +6 -0
- package/src/core/TwoFactorSetupAuthenticator/index.tsx +100 -0
- package/src/core/TwoFactorSetupYubikey/index.tsx +49 -0
- package/src/core/TwoFactorYubikey/index.tsx +41 -0
- package/src/core/WeekCalendarDay/index.tsx +7 -7
- package/src/core/{LoginFormYubikey/LoginFormYubikey.module.css → YubikeyInput/YubikeyInput.module.css} +5 -0
- package/src/core/YubikeyInput/YubikeyInput.spec.tsx +77 -0
- package/src/core/YubikeyInput/index.tsx +76 -0
- package/src/filters/BooleanFilter/index.tsx +13 -12
- package/src/filters/DateFilter/index.tsx +8 -8
- package/src/filters/DropdownFilter/index.tsx +19 -17
- package/src/filters/QuickDateFilter/index.tsx +12 -12
- package/src/filters/interfaces.ts +2 -2
- package/src/hooks/useAlert.spec.tsx +72 -0
- package/src/hooks/useAlert.ts +7 -5
- package/src/hooks/useConfig.ts +31 -0
- package/src/hooks/useConnectedList.ts +4 -4
- package/src/hooks/useConnectedRepeater.ts +8 -6
- package/src/hooks/useConnectedTable.ts +4 -4
- package/src/hooks/useFilters.ts +21 -13
- package/src/hooks/useLayout.spec.ts +3 -11
- package/src/hooks/useLayout.ts +8 -7
- package/src/hooks/useModal.spec.tsx +23 -15
- package/src/hooks/useModal.ts +17 -17
- package/src/hooks/useModalOffset.ts +4 -2
- package/src/hooks/useNavigation.ts +160 -0
- package/src/hooks/useRemote.ts +43 -0
- package/src/index.ts +31 -26
- package/src/scenes/Error404Scene.tsx +3 -1
- package/src/services/AppService.ts +16 -0
- package/src/services/ConfigService.ts +93 -0
- package/src/services/ConfirmService.ts +7 -2
- package/src/services/DateService.ts +48 -32
- package/src/services/DownloadService.spec.ts +4 -10
- package/src/services/DownloadService.ts +16 -9
- package/src/services/FilterComponentService.tsx +9 -5
- package/src/services/FilterService.spec.ts +57 -39
- package/src/services/FilterService.ts +62 -40
- package/src/services/FormatService.spec.ts +2 -0
- package/src/services/FormatService.ts +13 -8
- package/src/services/ToastService.ts +9 -4
- package/src/styles/tailwind.css +57 -0
- package/src/typings.d.ts +2 -2
- package/src/utility/MockRouter/index.ts +1 -0
- package/src/utility/icons.tsx +46 -30
- package/src/utility/interfaces.ts +39 -21
- package/src/utility/middleware.ts +10 -0
- package/src/utility/prop-types.ts +6 -2
- package/src/utility/register.tsx +11 -0
- package/tailwind.config.js +11 -0
- package/tsconfig.eslint.json +4 -0
- package/tsconfig.json +7 -15
- package/.gitattributes +0 -1
- package/.github/workflows/development.yml +0 -47
- package/.prettierrc +0 -9
- package/.storybook/manager.js +0 -4
- package/.storybook/postcss.config.js +0 -3
- package/.storybook/theme.js +0 -7
- package/.stylelintrc +0 -9
- package/__mocks__/@sqrzro/utility.ts +0 -43
- package/assets/logo-horizontal-dark.svg +0 -21
- package/assets/logo-horizontal-white.svg +0 -21
- package/assets/logo-vertical-dark.svg +0 -21
- package/assets/logo-vertical-white.svg +0 -21
- package/dist/index.css +0 -3812
- package/dist/index.js.map +0 -1
- package/dist/types/components/App/index.d.ts +0 -18
- package/dist/types/components/CalendarInput/index.d.ts +0 -10
- package/dist/types/components/CodeInput/index.d.ts +0 -9
- package/dist/types/components/ConnectedListScene/index.d.ts +0 -7
- package/dist/types/components/ConnectedScene/index.d.ts +0 -11
- package/dist/types/components/DateInput/index.d.ts +0 -7
- package/dist/types/components/Document/index.d.ts +0 -3
- package/dist/types/components/ErrorMessage/index.d.ts +0 -8
- package/dist/types/components/Fieldset/index.d.ts +0 -11
- package/dist/types/components/FilterLink/index.d.ts +0 -7
- package/dist/types/components/Form/index.d.ts +0 -14
- package/dist/types/components/FormActions/index.d.ts +0 -9
- package/dist/types/components/FormRepeater/index.d.ts +0 -9
- package/dist/types/components/InfoPanel/index.d.ts +0 -8
- package/dist/types/components/Link/index.d.ts +0 -13
- package/dist/types/components/ListActions/index.d.ts +0 -9
- package/dist/types/components/LoginForm/index.d.ts +0 -3
- package/dist/types/components/Message/index.d.ts +0 -7
- package/dist/types/components/ModalActions/index.d.ts +0 -11
- package/dist/types/components/PasswordForm/index.d.ts +0 -3
- package/dist/types/components/PasswordInput/index.d.ts +0 -4
- package/dist/types/components/Scene/index.d.ts +0 -10
- package/dist/types/components/SummaryList/index.d.ts +0 -8
- package/dist/types/components/Switch/index.d.ts +0 -9
- package/dist/types/components/Tag/index.d.ts +0 -8
- package/dist/types/components/TextArea/index.d.ts +0 -4
- package/dist/types/components/WeekCalendar/index.d.ts +0 -12
- package/dist/types/core/App/index.d.ts +0 -19
- package/dist/types/core/AppLogo/index.d.ts +0 -6
- package/dist/types/core/Assistive/index.d.ts +0 -6
- package/dist/types/core/BuildModal/index.d.ts +0 -3
- package/dist/types/core/Calendar/index.d.ts +0 -11
- package/dist/types/core/CalendarDay/index.d.ts +0 -16
- package/dist/types/core/CalendarMonth/index.d.ts +0 -12
- package/dist/types/core/CalendarNavigation/index.d.ts +0 -9
- package/dist/types/core/CalendarWeek/index.d.ts +0 -14
- package/dist/types/core/ChkRad/index.d.ts +0 -13
- package/dist/types/core/ChkRadIcon/index.d.ts +0 -7
- package/dist/types/core/CloseButton/index.d.ts +0 -9
- package/dist/types/core/ConnectedList/index.d.ts +0 -4
- package/dist/types/core/ConnectedTable/index.d.ts +0 -4
- package/dist/types/core/Container/index.d.ts +0 -7
- package/dist/types/core/DropdownPanel/index.d.ts +0 -18
- package/dist/types/core/ErrorBoundary/index.d.ts +0 -15
- package/dist/types/core/ErrorMessage/index.d.ts +0 -8
- package/dist/types/core/FilterItem/index.d.ts +0 -10
- package/dist/types/core/Filters/index.d.ts +0 -15
- package/dist/types/core/Form/index.d.ts +0 -12
- package/dist/types/core/FormError/index.d.ts +0 -6
- package/dist/types/core/FormLabel/index.d.ts +0 -8
- package/dist/types/core/FormLegend/index.d.ts +0 -6
- package/dist/types/core/Header/index.d.ts +0 -8
- package/dist/types/core/Icon/index.d.ts +0 -7
- package/dist/types/core/IconButton/Icon/index.d.ts +0 -7
- package/dist/types/core/IconButton/index.d.ts +0 -11
- package/dist/types/core/InputPanel/index.d.ts +0 -8
- package/dist/types/core/ListItemAction/index.d.ts +0 -4
- package/dist/types/core/ListItemMetaItem/index.d.ts +0 -10
- package/dist/types/core/ListItemTitle/index.d.ts +0 -9
- package/dist/types/core/Loader/index.d.ts +0 -6
- package/dist/types/core/LoginFormTwoFactor/index.d.ts +0 -13
- package/dist/types/core/MeActions/index.d.ts +0 -3
- package/dist/types/core/Modal/index.d.ts +0 -12
- package/dist/types/core/ModalComponent/index.d.ts +0 -12
- package/dist/types/core/NavigationItem/index.d.ts +0 -7
- package/dist/types/core/Pagination/index.d.ts +0 -7
- package/dist/types/core/PaginationItem/index.d.ts +0 -7
- package/dist/types/core/Panel/index.d.ts +0 -8
- package/dist/types/core/RadialProgress/index.d.ts +0 -8
- package/dist/types/core/SettingsForm/index.d.ts +0 -3
- package/dist/types/core/StaticTextInput/index.d.ts +0 -13
- package/dist/types/core/SummaryListItem/index.d.ts +0 -15
- package/dist/types/core/TableCell/index.d.ts +0 -8
- package/dist/types/core/TableHead/index.d.ts +0 -8
- package/dist/types/core/Tabs/index.d.ts +0 -11
- package/dist/types/core/TextInputAncillary/index.d.ts +0 -12
- package/dist/types/core/WeekCalendarDay/index.d.ts +0 -14
- package/dist/types/filters/BooleanFilter/index.d.ts +0 -5
- package/dist/types/filters/DateFilter/index.d.ts +0 -5
- package/dist/types/filters/DropdownFilter/index.d.ts +0 -17
- package/dist/types/filters/QuickDateFilter/index.d.ts +0 -5
- package/dist/types/hooks/useAccessiblePanel.d.ts +0 -13
- package/dist/types/hooks/useAppContext.d.ts +0 -55
- package/dist/types/hooks/useClickOutside.d.ts +0 -3
- package/dist/types/hooks/useComponentId.d.ts +0 -2
- package/dist/types/hooks/useFilters.d.ts +0 -3
- package/dist/types/hooks/useForm.d.ts +0 -41
- package/dist/types/hooks/useFormData.d.ts +0 -12
- package/dist/types/hooks/useModalOffset.d.ts +0 -2
- package/dist/types/hooks/useVariant.d.ts +0 -6
- package/dist/types/services/BuildService.d.ts +0 -5
- package/dist/types/services/DateService.d.ts +0 -17
- package/dist/types/services/DownloadService.d.ts +0 -5
- package/dist/types/services/FilterService.d.ts +0 -13
- package/dist/types/services/FormatService.d.ts +0 -7
- package/dist/types/services/OLD_ApiService.d.ts +0 -19
- package/dist/types/services/ToastService.d.ts +0 -5
- package/dist/types/utility/MockRouter/index.d.ts +0 -2
- package/dist/types/utility/StorybookPanel/index.d.ts +0 -7
- package/dist/types/utility/TestChangeHandler/index.d.ts +0 -15
- package/dist/types/utility/create-app.d.ts +0 -4
- package/dist/types/utility/icons.d.ts +0 -3
- package/docs/guides/01-installation.story.mdx +0 -33
- package/docs/guides/02-configuration.story.mdx +0 -80
- package/docs/guides/03-pages.story.mdx +0 -18
- package/docs/guides/04-integration.story.mdx +0 -33
- package/docs/guides/a11y.story.mdx +0 -7
- package/docs/guides/theming.story.mdx +0 -7
- package/docs/introduction.story.mdx +0 -17
- package/jest.config.js +0 -19
- package/rollup.config.js +0 -36
- package/scripts/create-exports.js +0 -74
- package/scripts/update-license.js +0 -8
- package/squarezero.config.js +0 -5
- package/src/components/Button/Button.module.css +0 -100
- package/src/components/CodeInput/CodeInput.module.css +0 -33
- package/src/components/CodeInput/CodeInput.spec.tsx +0 -180
- package/src/components/CodeInput/index.tsx +0 -138
- package/src/components/ConnectedScene/index.tsx +0 -96
- package/src/components/Document/index.tsx +0 -14
- package/src/components/Dropdown/Dropdown.module.css +0 -8
- package/src/components/Dropdown/Dropdown.spec.tsx +0 -304
- package/src/components/Dropdown/Dropdown.story.tsx +0 -53
- package/src/components/Dropdown/index.tsx +0 -228
- package/src/components/FormField/FormField.story.tsx +0 -29
- package/src/components/PasswordForm/PasswordForm.module.css +0 -21
- package/src/components/PasswordInput/PasswordInput.module.css +0 -23
- package/src/components/PasswordInput/PasswordInput.spec.tsx +0 -28
- package/src/components/PasswordInput/PasswordInput.story.tsx +0 -16
- package/src/components/PasswordInput/index.tsx +0 -23
- package/src/components/Scene/Scene.spec.tsx +0 -123
- package/src/components/Scene/Scene.story.tsx +0 -6
- package/src/components/Scene/index.tsx +0 -58
- package/src/components/Tag/Tag.module.css +0 -37
- package/src/components/Tag/Tag.spec.tsx +0 -10
- package/src/components/Tag/Tag.story.tsx +0 -55
- package/src/components/Tag/index.tsx +0 -27
- package/src/components/TextInput/TextInput.story.tsx +0 -24
- package/src/core/App/App.module.css +0 -24
- package/src/core/App/App.spec.tsx +0 -265
- package/src/core/App/index.tsx +0 -115
- package/src/core/Assistive/Assistive.module.css +0 -10
- package/src/core/ChkRad/ChkRad.module.css +0 -31
- package/src/core/ChkRad/ChkRad.spec.tsx +0 -79
- package/src/core/ChkRad/index.tsx +0 -75
- package/src/core/ChkRadIcon/ChkRadIcon.module.css +0 -29
- package/src/core/ChkRadIcon/index.tsx +0 -33
- package/src/core/DropdownPanel/DropdownPanel.module.css +0 -68
- package/src/core/DropdownPanel/index.tsx +0 -93
- package/src/core/ErrorBoundary/ErrorBoundary.spec.tsx +0 -33
- package/src/core/ErrorBoundary/index.tsx +0 -42
- package/src/core/FormError/FormError.module.css +0 -7
- package/src/core/FormError/index.tsx +0 -18
- package/src/core/FormLabel/FormLabel.module.css +0 -15
- package/src/core/FormLabel/index.tsx +0 -25
- package/src/core/Header/Header.module.css +0 -28
- package/src/core/InputPanel/InputPanel.module.css +0 -70
- package/src/core/InputPanel/index.tsx +0 -28
- package/src/core/Loader/Loader.story.tsx +0 -8
- package/src/core/LoginFormAuthenticator/index.tsx +0 -36
- package/src/core/LoginFormTwoFactor/index.tsx +0 -133
- package/src/core/LoginFormYubikey/index.tsx +0 -59
- package/src/core/Pagination/Pagination.module.css +0 -15
- package/src/core/PaginationItem/PaginationItem.module.css +0 -33
- package/src/core/PaginationItem/index.tsx +0 -46
- package/src/core/StaticTextInput/StaticTextInput.module.css +0 -79
- package/src/core/StaticTextInput/StaticTextInput.spec.tsx +0 -126
- package/src/core/StaticTextInput/index.tsx +0 -112
- package/src/core/Styled/Styled.spec.tsx +0 -32
- package/src/core/Styled/Styled.story.tsx +0 -10
- package/src/core/TableActionsCell/TableActionsCell.module.css +0 -3
- package/src/core/TableActionsCell/index.tsx +0 -26
- package/src/core/TableCell/TableCell.module.css +0 -16
- package/src/core/TableCell/index.tsx +0 -39
- package/src/core/TableHead/TableHead.module.css +0 -12
- package/src/core/TableHead/index.tsx +0 -48
- package/src/core/TableRow/index.tsx +0 -49
- package/src/core/TextInputAncillary/TextInputAncillary.module.css +0 -69
- package/src/core/TextInputAncillary/index.tsx +0 -84
- package/src/hooks/useAccessiblePanel.spec.tsx +0 -88
- package/src/hooks/useAccessiblePanel.ts +0 -74
- package/src/hooks/useAppContext.spec.ts +0 -38
- package/src/hooks/useAppContext.ts +0 -110
- package/src/hooks/useClickOutside.ts +0 -49
- package/src/hooks/useComponentId.spec.ts +0 -19
- package/src/hooks/useComponentId.ts +0 -16
- package/src/hooks/useForm.spec.ts +0 -251
- package/src/hooks/useForm.ts +0 -179
- package/src/hooks/useVariant.spec.ts +0 -14
- package/src/hooks/useVariant.ts +0 -34
- package/src/styles/layout.css +0 -64
- package/src/styles/variables.css +0 -85
- package/src/utility/StorybookPanel/StorybookPanel.module.css +0 -9
- package/src/utility/StorybookPanel/index.tsx +0 -25
- package/src/utility/TestChangeHandler/TestChangeHandler.module.css +0 -7
- package/src/utility/TestChangeHandler/TestChangeHandler.spec.tsx +0 -24
- package/src/utility/TestChangeHandler/index.tsx +0 -51
- package/src/utility/create-app.tsx +0 -28
- package/tests/setupFilesAfterEnv.js +0 -16
- package/tsconfig.types.json +0 -9
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import TextInput from '../../components/TextInput';
|
|
4
|
+
/**
|
|
5
|
+
* A `TextInput` component with a pre-defined `prefix` prop set to a 'http://'. All other props are
|
|
6
|
+
* simply passed through to the TextInput. Technically, the order of the props is such that the
|
|
7
|
+
* prefix can be overridden or removed all together. If this is the case, the component is no
|
|
8
|
+
* different to a `TextInput`.
|
|
9
|
+
*/
|
|
10
|
+
function WebsiteInput(props) {
|
|
11
|
+
return React.createElement(TextInput, { prefix: "http://", ...props });
|
|
12
|
+
}
|
|
13
|
+
export default WebsiteInput;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
interface WeekCalendarProps {
|
|
4
|
+
data: {
|
|
5
|
+
id: number;
|
|
6
|
+
datetime: string;
|
|
7
|
+
patient: {
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
declare function WeekCalendar({ data }: WeekCalendarProps): React.ReactElement;
|
|
13
|
+
declare namespace WeekCalendar {
|
|
14
|
+
var propTypes: {
|
|
15
|
+
data: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
16
|
+
id: PropTypes.Validator<number>;
|
|
17
|
+
datetime: PropTypes.Validator<string>;
|
|
18
|
+
patient: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
19
|
+
name: PropTypes.Validator<string>;
|
|
20
|
+
}>>>;
|
|
21
|
+
}>>[]>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default WeekCalendar;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { addDays, getWeek } from 'date-fns';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import FormatService from '../../services/FormatService';
|
|
5
|
+
import WeekCalendarDay from '../../core/WeekCalendarDay';
|
|
6
|
+
// Import styles from './WeekCalendar.module.css';
|
|
7
|
+
/*
|
|
8
|
+
* This function gets the first date of a week number. It 'Just Works', but it uses a lot of magic
|
|
9
|
+
* numbers, so it's easiest to just disable the eslint rule.
|
|
10
|
+
*/
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
12
|
+
const getFirstDayOfWeek = (week, year) => {
|
|
13
|
+
const weekInDays = 7 * week;
|
|
14
|
+
const firstDayOfWeek = new Date(year, 0, weekInDays - 6);
|
|
15
|
+
const dow = firstDayOfWeek.getDay();
|
|
16
|
+
const ISOweekStart = firstDayOfWeek;
|
|
17
|
+
if (dow <= 4) {
|
|
18
|
+
ISOweekStart.setDate(firstDayOfWeek.getDate() - firstDayOfWeek.getDay() + 1);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
ISOweekStart.setDate(firstDayOfWeek.getDate() + 8 - firstDayOfWeek.getDay());
|
|
22
|
+
}
|
|
23
|
+
return ISOweekStart;
|
|
24
|
+
};
|
|
25
|
+
/* eslint-enable */
|
|
26
|
+
const formatHour = (hour) => `${FormatService.twoDigits(hour)}00`;
|
|
27
|
+
const DAYS_IN_WEEK = 7;
|
|
28
|
+
const FIRST_HOUR = 8;
|
|
29
|
+
function WeekCalendar({ data }) {
|
|
30
|
+
const week = useMemo(() => getWeek(new Date()), []);
|
|
31
|
+
let days = [getFirstDayOfWeek(week, new Date().getFullYear())];
|
|
32
|
+
for (let index = 1; index < DAYS_IN_WEEK; index += 1) {
|
|
33
|
+
days = [...days, addDays(days[0], index)];
|
|
34
|
+
}
|
|
35
|
+
return (React.createElement("div", { className: "/*styles.root*/" },
|
|
36
|
+
React.createElement("div", { className: "/*styles.scale*/" }, Array.from({ length: 12 }).map((_item, index) => (React.createElement("div", { key: index, className: "/*styles.hour*/" }, formatHour(index + FIRST_HOUR))))),
|
|
37
|
+
days.map((item) => (React.createElement(WeekCalendarDay, { key: item.toString(), data: data, date: item })))));
|
|
38
|
+
}
|
|
39
|
+
WeekCalendar.propTypes = {
|
|
40
|
+
data: PropTypes.arrayOf(PropTypes.shape({
|
|
41
|
+
id: PropTypes.number.isRequired,
|
|
42
|
+
datetime: PropTypes.string.isRequired,
|
|
43
|
+
patient: PropTypes.shape({
|
|
44
|
+
name: PropTypes.string.isRequired,
|
|
45
|
+
}).isRequired,
|
|
46
|
+
}).isRequired).isRequired,
|
|
47
|
+
};
|
|
48
|
+
export default WeekCalendar;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import type { Action, StyleVariant } from '../../utility/interfaces';
|
|
4
|
-
export interface AlertComponentProps {
|
|
5
|
-
actions?: Action[];
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
icon?: string;
|
|
8
|
-
isOpen?: boolean;
|
|
9
|
-
onClose?: React.MouseEventHandler<HTMLButtonElement>;
|
|
10
|
-
title?: string;
|
|
11
|
-
variant?: StyleVariant;
|
|
12
|
-
width?: string;
|
|
13
|
-
}
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
propTypes: {
|
|
17
|
-
children: PropTypes.Validator<
|
|
18
|
-
actions: PropTypes.Requireable<PropTypes.InferProps<{
|
|
19
|
-
label: PropTypes.Validator<string>;
|
|
20
|
-
onClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
}
|
|
22
|
-
title: PropTypes.Requireable<string>;
|
|
23
|
-
variant: PropTypes.Requireable<string>;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export default AlertComponent;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import type { Action, StyleVariant } from '../../utility/interfaces';
|
|
4
|
+
export interface AlertComponentProps {
|
|
5
|
+
actions?: Action[];
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
icon?: string;
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
onClose?: React.MouseEventHandler<HTMLButtonElement>;
|
|
10
|
+
title?: string;
|
|
11
|
+
variant?: StyleVariant;
|
|
12
|
+
width?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function AlertComponent({ actions, children, icon, isOpen, onClose, title, variant, width, }: AlertComponentProps): React.ReactElement | null;
|
|
15
|
+
declare namespace AlertComponent {
|
|
16
|
+
var propTypes: {
|
|
17
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
18
|
+
actions: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{
|
|
19
|
+
label: PropTypes.Validator<string>;
|
|
20
|
+
onClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
+
}>>[]>;
|
|
22
|
+
title: PropTypes.Requireable<string>;
|
|
23
|
+
variant: PropTypes.Requireable<string>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export default AlertComponent;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Button from '../../components/Button';
|
|
4
|
+
import Icon from '../../core/Icon';
|
|
5
|
+
import Panel from '../../core/Panel';
|
|
6
|
+
function AlertComponent({ actions, children, icon, isOpen, onClose, title, variant, width, }) {
|
|
7
|
+
if (!isOpen) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const handleClose = (event) => {
|
|
11
|
+
if (onClose) {
|
|
12
|
+
onClose(event);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
return (React.createElement("div", { className: "/*styles.root*/" },
|
|
16
|
+
React.createElement("div", { className: "/*styles.overlay*/" }),
|
|
17
|
+
React.createElement("aside", { className: "/*clsx(styles.panel, styles[`panel${ucwords(width || 'md')`])*/", role: "alert" },
|
|
18
|
+
React.createElement(Panel, { isPadded: true },
|
|
19
|
+
React.createElement("div", { className: "/*clsx(styles.logo, variant && styles[`logo${ucwords(variant)}`])*/", "data-testid": "alert-component-logo" }, icon ? React.createElement(Icon, { icon: icon, size: 40 }) : null),
|
|
20
|
+
title ? (React.createElement("h3", { className: "/*styles.title*/", role: "heading" }, title)) : null,
|
|
21
|
+
children,
|
|
22
|
+
React.createElement("footer", { className: "/*styles.actions*/" },
|
|
23
|
+
actions?.map((action) => (React.createElement(Button, { key: action.label, isDisabled: action.isDisabled, onClick: action.onClick, variant: action.variant }, action.label))),
|
|
24
|
+
React.createElement(Button, { onClick: handleClose, variant: "link" }, "Close"))))));
|
|
25
|
+
}
|
|
26
|
+
AlertComponent.propTypes = {
|
|
27
|
+
children: PropTypes.node.isRequired,
|
|
28
|
+
actions: PropTypes.arrayOf(PropTypes.shape({
|
|
29
|
+
label: PropTypes.string.isRequired,
|
|
30
|
+
onClick: PropTypes.func.isRequired,
|
|
31
|
+
}).isRequired),
|
|
32
|
+
title: PropTypes.string,
|
|
33
|
+
variant: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'warning', 'danger']),
|
|
34
|
+
};
|
|
35
|
+
export default AlertComponent;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare
|
|
3
|
-
export default AppHeader;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function AppHeader(): React.ReactElement;
|
|
3
|
+
export default AppHeader;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { EventService } from '@sqrzro/utility';
|
|
4
|
+
import Header from '../../core/Header';
|
|
5
|
+
function AppHeader() {
|
|
6
|
+
const [title, setTitle] = useState();
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const sub = EventService.subscribe('@app/title', (_key, data) => {
|
|
9
|
+
setTitle(data);
|
|
10
|
+
});
|
|
11
|
+
return () => {
|
|
12
|
+
EventService.unsubscribe(sub);
|
|
13
|
+
};
|
|
14
|
+
}, []);
|
|
15
|
+
return React.createElement(Header, { title: title });
|
|
16
|
+
}
|
|
17
|
+
export default AppHeader;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
interface AppLogoProps {
|
|
4
|
+
isLink?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare function AppLogo({ isLink }: AppLogoProps): React.ReactElement;
|
|
7
|
+
declare namespace AppLogo {
|
|
8
|
+
var propTypes: {
|
|
9
|
+
isLink: PropTypes.Requireable<boolean>;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export default AppLogo;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Link from '../../components/Link';
|
|
4
|
+
import AppLogoImage from '../../core/AppLogoImage';
|
|
5
|
+
function AppLogo({ isLink }) {
|
|
6
|
+
if (isLink) {
|
|
7
|
+
return (React.createElement(Link, { className: "/*styles.root*/", to: "/" },
|
|
8
|
+
React.createElement(AppLogoImage, null)));
|
|
9
|
+
}
|
|
10
|
+
return (React.createElement("div", { className: "/*styles.root*/" },
|
|
11
|
+
React.createElement(AppLogoImage, null)));
|
|
12
|
+
}
|
|
13
|
+
AppLogo.propTypes = {
|
|
14
|
+
isLink: PropTypes.bool,
|
|
15
|
+
};
|
|
16
|
+
export default AppLogo;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare
|
|
3
|
-
export default AppLogoImage;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function AppLogoImage(): React.ReactElement;
|
|
3
|
+
export default AppLogoImage;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import useAppConfig from '../../hooks/useAppConfig';
|
|
3
|
+
import Assistive from '../../core/Assistive';
|
|
4
|
+
import AppLogoPlaceholder from '../../core/AppLogoPlaceholder';
|
|
5
|
+
function AppLogoImage() {
|
|
6
|
+
const { Logo, name } = useAppConfig();
|
|
7
|
+
return (React.createElement(Fragment, null,
|
|
8
|
+
React.createElement(Assistive, null, name),
|
|
9
|
+
Logo ? React.createElement(Logo, null) : React.createElement(AppLogoPlaceholder, null)));
|
|
10
|
+
}
|
|
11
|
+
export default AppLogoImage;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare
|
|
3
|
-
export default AppLogoPlaceholder;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function AppLogoPlaceholder(): React.ReactElement;
|
|
3
|
+
export default AppLogoPlaceholder;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
function AppLogoPlaceholder() {
|
|
4
|
+
return (React.createElement("svg", { height: "58", role: "img", viewBox: "0 0 58 58", width: "58", xmlns: "http://www.w3.org/2000/svg" },
|
|
5
|
+
React.createElement("path", { d: "M11.2738 41.615C8.73625 38.0625 7.25 33.7125 7.25 29C7.25 17.0375 17.0375 7.25 29 7.25C33.7125 7.25 38.0625 8.73625 41.615 11.2738L49.8075 3.08125C50.9312 1.9575 50.1338 0 48.5387 0H7.25C3.2625 0 0 3.2625 0 7.25V48.5025C0 50.1338 1.9575 50.9313 3.08125 49.7713L11.2738 41.615Z", fill: "white" }),
|
|
6
|
+
React.createElement("path", { d: "M43.4637 30.0512C43.6812 26.97 42.92 24.07 41.47 21.6412L21.6412 41.47C24.07 42.92 26.97 43.6812 30.0512 43.4637C37.1925 42.9562 42.9562 37.1925 43.4637 30.0512Z", fill: "white" }),
|
|
7
|
+
React.createElement("path", { d: "M46.7263 16.385C49.2638 19.9375 50.75 24.2875 50.75 29C50.75 40.9625 40.9625 50.75 29 50.75C24.2875 50.75 19.9375 49.2638 16.385 46.7263L8.19251 54.9188C7.06876 56.0425 7.86626 58 9.46126 58H50.75C54.7375 58 58 54.7375 58 50.75V9.49751C58 7.86626 56.0425 7.06876 54.9188 8.22876L46.7263 16.385Z", fill: "white" }),
|
|
8
|
+
React.createElement("path", { d: "M14.5362 27.9488C14.3187 31.03 15.08 33.93 16.53 36.3588L36.3587 16.53C33.93 15.08 31.03 14.3188 27.9487 14.5363C20.8075 15.0438 15.0437 20.8075 14.5362 27.9488Z", fill: "white" })));
|
|
9
|
+
}
|
|
10
|
+
export default AppLogoPlaceholder;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
interface AssistiveProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
declare function Assistive({ children }: AssistiveProps): React.ReactElement;
|
|
7
|
+
declare namespace Assistive {
|
|
8
|
+
var propTypes: {
|
|
9
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export default Assistive;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
function Assistive({ children }) {
|
|
4
|
+
return React.createElement("span", { className: "/*styles.root*/" }, children);
|
|
5
|
+
}
|
|
6
|
+
Assistive.propTypes = {
|
|
7
|
+
children: PropTypes.node.isRequired,
|
|
8
|
+
};
|
|
9
|
+
export default Assistive;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FormProps } from '../../components/Form';
|
|
3
|
+
import type { StyleVariant } from '../../utility/interfaces';
|
|
4
|
+
interface AuthFormProps extends FormProps {
|
|
5
|
+
footer?: React.ReactNode;
|
|
6
|
+
icon?: string;
|
|
7
|
+
variant?: StyleVariant;
|
|
8
|
+
}
|
|
9
|
+
declare function AuthForm({ children, footer, icon, variant, ...formProps }: AuthFormProps): React.ReactElement;
|
|
10
|
+
export default AuthForm;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Form from '../../components/Form';
|
|
3
|
+
import AppLogo from '../../core/AppLogo';
|
|
4
|
+
import Icon from '../../core/Icon';
|
|
5
|
+
import Panel from '../../core/Panel';
|
|
6
|
+
function AuthForm({ children, footer, icon, variant, ...formProps }) {
|
|
7
|
+
return (React.createElement("div", { className: "/*styles.root*/" },
|
|
8
|
+
React.createElement(Panel, { isPadded: true },
|
|
9
|
+
React.createElement("div", { className: "/*clsx(styles.logo,variant && styles[`logo${ucwords(variant)}`])*/", "data-testid": "auth-form-logo" }, icon ? React.createElement(Icon, { icon: icon, size: 40 }) : React.createElement(AppLogo, null)),
|
|
10
|
+
React.createElement(Form, { ...formProps }, children),
|
|
11
|
+
footer ? React.createElement("div", { className: "/*styles.footer*/" }, footer) : null)));
|
|
12
|
+
}
|
|
13
|
+
export default AuthForm;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare
|
|
3
|
-
export default Banner;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function Banner(): React.ReactElement;
|
|
3
|
+
export default Banner;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import AppLogo from '../../core/AppLogo';
|
|
3
|
+
// Import Navigation from '../../core/Navigation';
|
|
4
|
+
import MeActions from '../../core/MeActions';
|
|
5
|
+
import useLayout from '../../hooks/useLayout';
|
|
6
|
+
// Import styles from './Banner.module.css';
|
|
7
|
+
function Banner() {
|
|
8
|
+
const { applyLayoutClassName } = useLayout();
|
|
9
|
+
return (React.createElement("header", { className: "bg-slate-800 h-screen sticky top-0" },
|
|
10
|
+
React.createElement("div", { className: "/*clsx(styles.logo, applyLayoutClassName(styles, 'logo'))*/" },
|
|
11
|
+
React.createElement(AppLogo, { isLink: true })),
|
|
12
|
+
React.createElement(MeActions, null)));
|
|
13
|
+
}
|
|
14
|
+
export default Banner;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import type { InputEvent } from '../../utility/interfaces';
|
|
4
|
+
interface CalendarProps {
|
|
5
|
+
disabledDates?: string[] | ((date: string) => boolean);
|
|
6
|
+
isRange?: boolean;
|
|
7
|
+
name: string;
|
|
8
|
+
onChange: (event: InputEvent<string>) => void;
|
|
9
|
+
value?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function Calendar({ disabledDates, isRange, name, value, onChange, }: CalendarProps): React.ReactElement;
|
|
12
|
+
declare namespace Calendar {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
name: PropTypes.Validator<string>;
|
|
15
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
16
|
+
disabledDates: PropTypes.Requireable<NonNullable<string[] | ((...args: any[]) => any) | null | undefined>>;
|
|
17
|
+
isRange: PropTypes.Requireable<boolean>;
|
|
18
|
+
value: PropTypes.Requireable<string>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export default Calendar;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { Fragment, useEffect, useState } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import CalendarMonth from '../../core/CalendarMonth';
|
|
5
|
+
import CalendarNavigation from '../../core/CalendarNavigation';
|
|
6
|
+
import FormatService from '../../services/FormatService';
|
|
7
|
+
const getMonthFromDate = (date) => {
|
|
8
|
+
const dt = new Date();
|
|
9
|
+
const currentMonth = `${dt.getFullYear()}-${FormatService.twoDigits(dt.getMonth() + 1)}`;
|
|
10
|
+
if (!date) {
|
|
11
|
+
return currentMonth;
|
|
12
|
+
}
|
|
13
|
+
// If the date is a range, just use the first date in the range
|
|
14
|
+
if (/,/u.exec(date)) {
|
|
15
|
+
return getMonthFromDate(date.split(',')[0]);
|
|
16
|
+
}
|
|
17
|
+
const match = /^(?<month>[0-9]{4}-[0-9]{2})-[0-9]{2}$/u.exec(date);
|
|
18
|
+
if (!match) {
|
|
19
|
+
return currentMonth;
|
|
20
|
+
}
|
|
21
|
+
/* istanbul ignore next: No way to test that there is a match, but without any groups */
|
|
22
|
+
return match.groups?.month || currentMonth;
|
|
23
|
+
};
|
|
24
|
+
const transformValue = (pendingValue, targetValue) => [pendingValue, targetValue].sort((first, second) => first.localeCompare(second)).join(',');
|
|
25
|
+
const getPendingValue = (pendingValue, targetValue) => {
|
|
26
|
+
if (!pendingValue) {
|
|
27
|
+
return targetValue;
|
|
28
|
+
}
|
|
29
|
+
if (!/,/u.exec(pendingValue)) {
|
|
30
|
+
return transformValue(pendingValue, targetValue);
|
|
31
|
+
}
|
|
32
|
+
return targetValue;
|
|
33
|
+
};
|
|
34
|
+
function Calendar({ disabledDates, isRange, name, value, onChange, }) {
|
|
35
|
+
const [activeMonth, setActiveMonth] = useState(getMonthFromDate(value));
|
|
36
|
+
const [pendingValue, setPendingValue] = useState('');
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
setActiveMonth(getMonthFromDate(value));
|
|
39
|
+
}, [value]);
|
|
40
|
+
const handleNavigation = (event) => {
|
|
41
|
+
setActiveMonth(event.target.value);
|
|
42
|
+
};
|
|
43
|
+
const handleChange = (event) => {
|
|
44
|
+
if (!isRange) {
|
|
45
|
+
onChange(event);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const pValue = getPendingValue(pendingValue, event.target.value);
|
|
49
|
+
setPendingValue(pValue);
|
|
50
|
+
if (!/,/u.exec(pValue)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
onChange({ target: { name, value: pValue } });
|
|
54
|
+
};
|
|
55
|
+
return (React.createElement(Fragment, null,
|
|
56
|
+
React.createElement(CalendarNavigation, { month: activeMonth, name: name, onChange: handleNavigation }),
|
|
57
|
+
React.createElement(CalendarMonth, { disabledDates: disabledDates, month: activeMonth, name: name, onClick: handleChange, pendingValue: pendingValue, value: value })));
|
|
58
|
+
}
|
|
59
|
+
Calendar.propTypes = {
|
|
60
|
+
name: PropTypes.string.isRequired,
|
|
61
|
+
onChange: PropTypes.func.isRequired,
|
|
62
|
+
disabledDates: PropTypes.oneOfType([
|
|
63
|
+
PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
64
|
+
PropTypes.func,
|
|
65
|
+
]),
|
|
66
|
+
isRange: PropTypes.bool,
|
|
67
|
+
value: PropTypes.string,
|
|
68
|
+
};
|
|
69
|
+
export default Calendar;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import type { InputEvent } from '../../utility/interfaces';
|
|
4
|
+
export interface DayObject {
|
|
5
|
+
label: number;
|
|
6
|
+
date: string;
|
|
7
|
+
}
|
|
8
|
+
interface CalendarDayProps {
|
|
9
|
+
data: DayObject | number;
|
|
10
|
+
name: string;
|
|
11
|
+
onClick?: (event: InputEvent<string>) => void;
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
isHighlighted?: boolean;
|
|
14
|
+
isSelected?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare function CalendarDay({ data, isDisabled, isHighlighted, isSelected, name, onClick, }: CalendarDayProps): React.ReactElement;
|
|
17
|
+
declare namespace CalendarDay {
|
|
18
|
+
var propTypes: {
|
|
19
|
+
data: PropTypes.Validator<NonNullable<NonNullable<number | NonNullable<PropTypes.InferProps<{
|
|
20
|
+
date: PropTypes.Validator<string>;
|
|
21
|
+
label: PropTypes.Validator<number>;
|
|
22
|
+
}>>>>>;
|
|
23
|
+
name: PropTypes.Validator<string>;
|
|
24
|
+
isDisabled: PropTypes.Requireable<boolean>;
|
|
25
|
+
isHighlighted: PropTypes.Requireable<boolean>;
|
|
26
|
+
isSelected: PropTypes.Requireable<boolean>;
|
|
27
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export default CalendarDay;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
function CalendarDay({ data, isDisabled, isHighlighted, isSelected, name, onClick, }) {
|
|
4
|
+
if (typeof data === 'number') {
|
|
5
|
+
return React.createElement("td", { className: "/*styles.root*/" });
|
|
6
|
+
}
|
|
7
|
+
const handleClick = () => {
|
|
8
|
+
if (onClick) {
|
|
9
|
+
const simpleEvent = { target: { name, value: data.date } };
|
|
10
|
+
onClick(simpleEvent);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
return (React.createElement("td", { className: "/*clsx(\n styles.root,\n isHighlighted && styles.rootIsHighlighted,\n isSelected && styles.rootIsSelected,\n DateService.isToday(data.date) && styles.rootIsToday,\n isDisabled && styles.rootIsDisabled\n )*/", "data-testid": `calendar-day-root-${data.label}` },
|
|
14
|
+
React.createElement("button", { className: "/*styles.control*/", disabled: isDisabled, onClick: handleClick, type: "button" }, data.label)));
|
|
15
|
+
}
|
|
16
|
+
CalendarDay.propTypes = {
|
|
17
|
+
data: PropTypes.oneOfType([
|
|
18
|
+
PropTypes.number.isRequired,
|
|
19
|
+
PropTypes.shape({
|
|
20
|
+
date: PropTypes.string.isRequired,
|
|
21
|
+
label: PropTypes.number.isRequired,
|
|
22
|
+
}).isRequired,
|
|
23
|
+
]).isRequired,
|
|
24
|
+
name: PropTypes.string.isRequired,
|
|
25
|
+
isDisabled: PropTypes.bool,
|
|
26
|
+
isHighlighted: PropTypes.bool,
|
|
27
|
+
isSelected: PropTypes.bool,
|
|
28
|
+
onClick: PropTypes.func,
|
|
29
|
+
};
|
|
30
|
+
export default CalendarDay;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import type { InputEvent } from '../../utility/interfaces';
|
|
4
|
+
interface CalendarMonthProps {
|
|
5
|
+
disabledDates?: string[] | ((date: string) => boolean);
|
|
6
|
+
name: string;
|
|
7
|
+
month: string;
|
|
8
|
+
onClick?: (event: InputEvent<string>) => void;
|
|
9
|
+
pendingValue: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function CalendarMonth({ disabledDates, name, month, onClick, pendingValue, value, }: CalendarMonthProps): React.ReactElement;
|
|
13
|
+
declare namespace CalendarMonth {
|
|
14
|
+
var propTypes: {
|
|
15
|
+
month: PropTypes.Validator<string>;
|
|
16
|
+
name: PropTypes.Validator<string>;
|
|
17
|
+
pendingValue: PropTypes.Validator<string>;
|
|
18
|
+
disabledDates: PropTypes.Requireable<NonNullable<string[] | ((...args: any[]) => any) | null | undefined>>;
|
|
19
|
+
value: PropTypes.Requireable<string>;
|
|
20
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export default CalendarMonth;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import DateService from '../../services/DateService';
|
|
4
|
+
import CalendarWeek from '../../core/CalendarWeek';
|
|
5
|
+
// Import styles from './CalendarMonth.module.css';
|
|
6
|
+
const DECIMAL = 10;
|
|
7
|
+
const DAYS_IN_WEEK = 7;
|
|
8
|
+
const DAYS = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
9
|
+
const getWeeks = (month) => {
|
|
10
|
+
const firstDay = `${month}-01`;
|
|
11
|
+
const firstDayofMonth = DateService.getDayOfWeek(firstDay);
|
|
12
|
+
const daysInMonth = DateService.getDaysInMonth(firstDay);
|
|
13
|
+
const lastDayofMonth = DateService.getDayOfWeek(`${month}-${daysInMonth}`);
|
|
14
|
+
const beforeDays = Array(firstDayofMonth).fill(0);
|
|
15
|
+
const afterDays = Array(DAYS_IN_WEEK - 1 - lastDayofMonth).fill(0);
|
|
16
|
+
const monthDays = Array.from({ length: daysInMonth }).map((_item, index) => ({
|
|
17
|
+
label: index + 1,
|
|
18
|
+
date: `${month}-${index + 1 < DECIMAL ? '0' : ''}${index + 1}`,
|
|
19
|
+
}));
|
|
20
|
+
const days = [...beforeDays, ...monthDays, ...afterDays];
|
|
21
|
+
const weeks = [];
|
|
22
|
+
for (let index = 0; index < days.length; index += DAYS_IN_WEEK) {
|
|
23
|
+
weeks.push(days.slice(index, index + DAYS_IN_WEEK));
|
|
24
|
+
}
|
|
25
|
+
return weeks.filter((week) => JSON.stringify(week) !== '[0,0,0,0,0,0,0]');
|
|
26
|
+
};
|
|
27
|
+
function CalendarMonth({ disabledDates, name, month, onClick, pendingValue, value, }) {
|
|
28
|
+
const weeks = getWeeks(month);
|
|
29
|
+
return (React.createElement("table", { className: "/*styles.root*/" },
|
|
30
|
+
React.createElement("thead", null,
|
|
31
|
+
React.createElement("tr", null, DAYS.map((item) => (React.createElement("th", { key: item, className: "/*styles.head*/" }, item))))),
|
|
32
|
+
React.createElement("tbody", null, weeks.map((item) => (React.createElement(CalendarWeek, { key: typeof item[0] === 'number' ? item[0] : item[0].date, data: item, disabledDates: disabledDates, name: name, onClick: onClick, pendingValue: pendingValue, value: value }))))));
|
|
33
|
+
}
|
|
34
|
+
CalendarMonth.propTypes = {
|
|
35
|
+
month: PropTypes.string.isRequired,
|
|
36
|
+
name: PropTypes.string.isRequired,
|
|
37
|
+
pendingValue: PropTypes.string.isRequired,
|
|
38
|
+
disabledDates: PropTypes.oneOfType([
|
|
39
|
+
PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
40
|
+
PropTypes.func,
|
|
41
|
+
]),
|
|
42
|
+
value: PropTypes.string,
|
|
43
|
+
onClick: PropTypes.func,
|
|
44
|
+
};
|
|
45
|
+
export default CalendarMonth;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import type { InputEvent } from '../../utility/interfaces';
|
|
4
|
+
interface CalendarNavigationProps {
|
|
5
|
+
month: string;
|
|
6
|
+
name: string;
|
|
7
|
+
onChange: (event: InputEvent<string>) => void;
|
|
8
|
+
}
|
|
9
|
+
declare function CalendarNavigation({ month, name, onChange, }: CalendarNavigationProps): React.ReactElement;
|
|
10
|
+
declare namespace CalendarNavigation {
|
|
11
|
+
var propTypes: {
|
|
12
|
+
month: PropTypes.Validator<string>;
|
|
13
|
+
name: PropTypes.Validator<string>;
|
|
14
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export default CalendarNavigation;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import DateService from '../../services/DateService';
|
|
4
|
+
import FormatService from '../../services/FormatService';
|
|
5
|
+
import IconButton from '../../core/IconButton';
|
|
6
|
+
function CalendarNavigation({ month, name, onChange, }) {
|
|
7
|
+
const handleChange = (value) => {
|
|
8
|
+
onChange({ target: { name, value } });
|
|
9
|
+
};
|
|
10
|
+
const handlePrevious = () => handleChange(DateService.subMonths(month, 1));
|
|
11
|
+
const handleNext = () => handleChange(DateService.addMonths(month, 1));
|
|
12
|
+
return (React.createElement("div", { className: "/*styles.root*/" },
|
|
13
|
+
React.createElement("p", { className: "/*styles.title*/" }, FormatService.date(`${month}-01`, 'MMMM y')),
|
|
14
|
+
React.createElement("i", { className: "/*clsx(styles.control, styles.controlPrevious)*/" },
|
|
15
|
+
React.createElement(IconButton, { icon: "arrowLeft", onClick: handlePrevious, size: "sm" }, "Previous")),
|
|
16
|
+
React.createElement("i", { className: "/*clsx(styles.control, styles.controlNext)*/" },
|
|
17
|
+
React.createElement(IconButton, { icon: "arrowRight", onClick: handleNext, size: "sm" }, "Next"))));
|
|
18
|
+
}
|
|
19
|
+
CalendarNavigation.propTypes = {
|
|
20
|
+
month: PropTypes.string.isRequired,
|
|
21
|
+
name: PropTypes.string.isRequired,
|
|
22
|
+
onChange: PropTypes.func.isRequired,
|
|
23
|
+
};
|
|
24
|
+
export default CalendarNavigation;
|