@sqrzro/admin 1.0.0-beta.1
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 +4 -0
- package/.gitattributes +1 -0
- package/.prettierrc +9 -0
- package/.storybook/main.js +40 -0
- package/.storybook/manager.js +4 -0
- package/.storybook/postcss.config.js +3 -0
- package/.storybook/preview.js +11 -0
- package/.storybook/theme.js +7 -0
- package/.stylelintrc +9 -0
- package/LICENSE +5 -0
- package/README.md +9 -0
- package/__mocks__/squarezero-utility.ts +40 -0
- package/assets/logo-horizontal-dark.svg +21 -0
- package/assets/logo-horizontal-white.svg +21 -0
- package/assets/logo-vertical-dark.svg +21 -0
- package/assets/logo-vertical-white.svg +21 -0
- package/dist/index.css +3554 -0
- package/dist/index.js +5099 -0
- package/dist/index.js.map +1 -0
- package/dist/types/components/Alert/index.d.ts +10 -0
- package/dist/types/components/Allow/index.d.ts +13 -0
- package/dist/types/components/App/index.d.ts +19 -0
- package/dist/types/components/AutoSuggest/index.d.ts +60 -0
- package/dist/types/components/Button/index.d.ts +36 -0
- package/dist/types/components/CalendarInput/index.d.ts +10 -0
- package/dist/types/components/CheckboxList/index.d.ts +4 -0
- package/dist/types/components/ConnectedDropdown/index.d.ts +8 -0
- package/dist/types/components/ConnectedList/index.d.ts +4 -0
- package/dist/types/components/ConnectedScene/index.d.ts +11 -0
- package/dist/types/components/ConnectedTable/index.d.ts +4 -0
- package/dist/types/components/ContentBlock/index.d.ts +6 -0
- package/dist/types/components/DateInput/index.d.ts +7 -0
- package/dist/types/components/Document/index.d.ts +6 -0
- package/dist/types/components/Dropdown/index.d.ts +14 -0
- package/dist/types/components/Fieldset/index.d.ts +11 -0
- package/dist/types/components/FileInput/index.d.ts +4 -0
- package/dist/types/components/FilterLink/index.d.ts +7 -0
- package/dist/types/components/Form/index.d.ts +11 -0
- package/dist/types/components/FormActions/index.d.ts +9 -0
- package/dist/types/components/FormField/index.d.ts +27 -0
- package/dist/types/components/FormRepeater/index.d.ts +8 -0
- package/dist/types/components/ImageInput/index.d.ts +4 -0
- package/dist/types/components/InfoPanel/index.d.ts +8 -0
- package/dist/types/components/Link/__mocks__/index.d.ts +6 -0
- package/dist/types/components/Link/index.d.ts +13 -0
- package/dist/types/components/List/index.d.ts +23 -0
- package/dist/types/components/ListActions/index.d.ts +9 -0
- package/dist/types/components/LoginForm/index.d.ts +3 -0
- package/dist/types/components/Message/index.d.ts +7 -0
- package/dist/types/components/ModalActions/index.d.ts +11 -0
- package/dist/types/components/MoneyInput/index.d.ts +10 -0
- package/dist/types/components/PasswordForm/index.d.ts +3 -0
- package/dist/types/components/PasswordInput/index.d.ts +8 -0
- package/dist/types/components/RadioList/index.d.ts +4 -0
- package/dist/types/components/Scene/index.d.ts +10 -0
- package/dist/types/components/SummaryList/index.d.ts +8 -0
- package/dist/types/components/Switch/index.d.ts +9 -0
- package/dist/types/components/Table/index.d.ts +13 -0
- package/dist/types/components/Tag/index.d.ts +8 -0
- package/dist/types/components/TextArea/index.d.ts +4 -0
- package/dist/types/components/TextInput/index.d.ts +17 -0
- package/dist/types/components/WebsiteInput/index.d.ts +10 -0
- package/dist/types/components/WeekCalendar/index.d.ts +12 -0
- package/dist/types/core/AppHeader/index.d.ts +3 -0
- package/dist/types/core/AppLogo/index.d.ts +6 -0
- package/dist/types/core/AppLogoImage/index.d.ts +3 -0
- package/dist/types/core/AppLogoPlaceholder/index.d.ts +3 -0
- package/dist/types/core/Assistive/index.d.ts +6 -0
- package/dist/types/core/Banner/index.d.ts +3 -0
- package/dist/types/core/BuildModal/index.d.ts +3 -0
- package/dist/types/core/Calendar/index.d.ts +11 -0
- package/dist/types/core/CalendarDay/index.d.ts +16 -0
- package/dist/types/core/CalendarMonth/index.d.ts +12 -0
- package/dist/types/core/CalendarNavigation/index.d.ts +9 -0
- package/dist/types/core/CalendarWeek/index.d.ts +14 -0
- package/dist/types/core/ChkRad/index.d.ts +10 -0
- package/dist/types/core/ChkRadIcon/index.d.ts +7 -0
- package/dist/types/core/ChkRadList/index.d.ts +15 -0
- package/dist/types/core/CloseButton/index.d.ts +9 -0
- package/dist/types/core/ConfirmModal/index.d.ts +3 -0
- package/dist/types/core/ConnectedRepeater/index.d.ts +26 -0
- package/dist/types/core/ConnectedRepeaterComponent/index.d.ts +24 -0
- package/dist/types/core/Container/index.d.ts +7 -0
- package/dist/types/core/DropdownPanel/index.d.ts +18 -0
- package/dist/types/core/EmptyMessage/index.d.ts +12 -0
- package/dist/types/core/ErrorBoundary/index.d.ts +15 -0
- package/dist/types/core/ErrorMessage/index.d.ts +8 -0
- package/dist/types/core/FilterItem/index.d.ts +10 -0
- package/dist/types/core/Filters/index.d.ts +11 -0
- package/dist/types/core/FixedActions/index.d.ts +12 -0
- package/dist/types/core/FormError/index.d.ts +6 -0
- package/dist/types/core/FormLabel/index.d.ts +8 -0
- package/dist/types/core/FormLegend/index.d.ts +6 -0
- package/dist/types/core/Header/index.d.ts +8 -0
- package/dist/types/core/Icon/index.d.ts +7 -0
- package/dist/types/core/IconButton/Icon/index.d.ts +7 -0
- package/dist/types/core/IconButton/index.d.ts +11 -0
- package/dist/types/core/InputPanel/index.d.ts +8 -0
- package/dist/types/core/ListItem/index.d.ts +16 -0
- package/dist/types/core/ListItemAction/index.d.ts +4 -0
- package/dist/types/core/ListItemActions/index.d.ts +8 -0
- package/dist/types/core/ListItemMetaItem/index.d.ts +10 -0
- package/dist/types/core/ListItemTitle/index.d.ts +9 -0
- package/dist/types/core/Loader/index.d.ts +6 -0
- package/dist/types/core/MeActions/index.d.ts +3 -0
- package/dist/types/core/MePanel/index.d.ts +9 -0
- package/dist/types/core/Modal/index.d.ts +12 -0
- package/dist/types/core/Navigation/index.d.ts +3 -0
- package/dist/types/core/NavigationDivider/index.d.ts +3 -0
- package/dist/types/core/NavigationItem/index.d.ts +7 -0
- package/dist/types/core/Pagination/index.d.ts +7 -0
- package/dist/types/core/PaginationItem/index.d.ts +7 -0
- package/dist/types/core/Panel/index.d.ts +8 -0
- package/dist/types/core/RadialProgress/index.d.ts +8 -0
- package/dist/types/core/StaticTextInput/index.d.ts +12 -0
- package/dist/types/core/Styled/index.d.ts +6 -0
- package/dist/types/core/SummaryListItem/index.d.ts +15 -0
- package/dist/types/core/TableActionsCell/index.d.ts +8 -0
- package/dist/types/core/TableCell/index.d.ts +8 -0
- package/dist/types/core/TableHead/index.d.ts +8 -0
- package/dist/types/core/TableRow/index.d.ts +13 -0
- package/dist/types/core/Tabs/index.d.ts +11 -0
- package/dist/types/core/TextInputAncillary/index.d.ts +11 -0
- package/dist/types/core/Toast/index.d.ts +3 -0
- package/dist/types/core/WeekCalendarDay/index.d.ts +14 -0
- package/dist/types/filters/BooleanFilter/index.d.ts +5 -0
- package/dist/types/filters/DateFilter/index.d.ts +5 -0
- package/dist/types/filters/DropdownFilter/index.d.ts +5 -0
- package/dist/types/filters/QuickDateFilter/index.d.ts +5 -0
- package/dist/types/filters/interfaces.d.ts +36 -0
- package/dist/types/hooks/useAccessiblePanel.d.ts +13 -0
- package/dist/types/hooks/useAppContext.d.ts +37 -0
- package/dist/types/hooks/useClickOutside.d.ts +3 -0
- package/dist/types/hooks/useConnectedList.d.ts +7 -0
- package/dist/types/hooks/useFilters.d.ts +3 -0
- package/dist/types/hooks/useForm.d.ts +26 -0
- package/dist/types/hooks/useFormData.d.ts +9 -0
- package/dist/types/hooks/useLayout.d.ts +6 -0
- package/dist/types/hooks/useModal.d.ts +12 -0
- package/dist/types/hooks/useVariant.d.ts +6 -0
- package/dist/types/index.d.ts +187 -0
- package/dist/types/scenes/Error404Scene.d.ts +3 -0
- package/dist/types/services/BuildService.d.ts +5 -0
- package/dist/types/services/ConfirmService.d.ts +12 -0
- package/dist/types/services/DateService.d.ts +17 -0
- package/dist/types/services/DownloadService.d.ts +5 -0
- package/dist/types/services/FilterComponentService.d.ts +8 -0
- package/dist/types/services/FilterService.d.ts +13 -0
- package/dist/types/services/FormatService.d.ts +7 -0
- package/dist/types/services/ToastService.d.ts +5 -0
- package/dist/types/utility/MockRouter/index.d.ts +2 -0
- package/dist/types/utility/StorybookPanel/index.d.ts +7 -0
- package/dist/types/utility/TestChangeHandler/index.d.ts +8 -0
- package/dist/types/utility/create-app.d.ts +4 -0
- package/dist/types/utility/interfaces.d.ts +72 -0
- package/dist/types/utility/prop-types.d.ts +40 -0
- package/docs/guides/01-installation.story.mdx +33 -0
- package/docs/guides/02-configuration.story.mdx +80 -0
- package/docs/guides/03-pages.story.mdx +18 -0
- package/docs/guides/04-integration.story.mdx +33 -0
- package/docs/guides/a11y.story.mdx +7 -0
- package/docs/guides/theming.story.mdx +7 -0
- package/docs/introduction.story.mdx +17 -0
- package/jest.config.js +19 -0
- package/package.json +101 -0
- package/postcss.config.js +3 -0
- package/rollup.config.js +36 -0
- package/scripts/create-exports.js +74 -0
- package/scripts/update-license.js +8 -0
- package/squarezero.config.js +5 -0
- package/src/components/Alert/Alert.module.css +50 -0
- package/src/components/Alert/Alert.spec.tsx +63 -0
- package/src/components/Alert/Alert.story.tsx +23 -0
- package/src/components/Alert/index.tsx +67 -0
- package/src/components/Allow/Allow.spec.tsx +37 -0
- package/src/components/Allow/index.tsx +42 -0
- package/src/components/App/App.module.css +22 -0
- package/src/components/App/App.spec.tsx +128 -0
- package/src/components/App/index.tsx +108 -0
- package/src/components/AutoSuggest/AutoSuggest.module.css +8 -0
- package/src/components/AutoSuggest/AutoSuggest.spec.tsx +211 -0
- package/src/components/AutoSuggest/AutoSuggest.story.tsx +30 -0
- package/src/components/AutoSuggest/index.tsx +216 -0
- package/src/components/Button/Button.module.css +95 -0
- package/src/components/Button/Button.spec.tsx +69 -0
- package/src/components/Button/Button.story.tsx +39 -0
- package/src/components/Button/index.tsx +99 -0
- package/src/components/CalendarInput/CalendarInput.module.css +8 -0
- package/src/components/CalendarInput/CalendarInput.spec.tsx +206 -0
- package/src/components/CalendarInput/CalendarInput.story.tsx +62 -0
- package/src/components/CalendarInput/index.tsx +122 -0
- package/src/components/CheckboxList/CheckboxList.spec.tsx +83 -0
- package/src/components/CheckboxList/index.tsx +53 -0
- package/src/components/ConnectedDropdown/index.tsx +56 -0
- package/src/components/ConnectedList/index.tsx +15 -0
- package/src/components/ConnectedScene/index.tsx +95 -0
- package/src/components/ConnectedTable/index.tsx +17 -0
- package/src/components/ContentBlock/ContentBlock.module.css +8 -0
- package/src/components/ContentBlock/ContentBlock.spec.tsx +15 -0
- package/src/components/ContentBlock/index.tsx +16 -0
- package/src/components/DateInput/DateInput.module.css +15 -0
- package/src/components/DateInput/DateInput.spec.tsx +91 -0
- package/src/components/DateInput/index.tsx +149 -0
- package/src/components/Document/index.tsx +20 -0
- package/src/components/Dropdown/Dropdown.module.css +8 -0
- package/src/components/Dropdown/Dropdown.spec.tsx +286 -0
- package/src/components/Dropdown/Dropdown.story.tsx +53 -0
- package/src/components/Dropdown/index.tsx +224 -0
- package/src/components/Fieldset/Fieldset.spec.tsx +22 -0
- package/src/components/Fieldset/Fieldset.story.tsx +21 -0
- package/src/components/Fieldset/index.tsx +30 -0
- package/src/components/FileInput/FileInput.module.css +18 -0
- package/src/components/FileInput/FileInput.spec.tsx +42 -0
- package/src/components/FileInput/FileInput.story.tsx +6 -0
- package/src/components/FileInput/index.tsx +72 -0
- package/src/components/FilterLink/FilterLink.module.css +9 -0
- package/src/components/FilterLink/FilterLink.spec.tsx +20 -0
- package/src/components/FilterLink/index.tsx +31 -0
- package/src/components/Form/Form.spec.tsx +68 -0
- package/src/components/Form/index.tsx +87 -0
- package/src/components/FormActions/FormActions.spec.tsx +10 -0
- package/src/components/FormActions/FormActions.story.tsx +23 -0
- package/src/components/FormActions/index.tsx +31 -0
- package/src/components/FormField/FormField.module.css +71 -0
- package/src/components/FormField/FormField.spec.tsx +137 -0
- package/src/components/FormField/FormField.story.tsx +22 -0
- package/src/components/FormField/index.tsx +162 -0
- package/src/components/FormRepeater/FormRepeater.module.css +3 -0
- package/src/components/FormRepeater/FormRepeater.spec.tsx +127 -0
- package/src/components/FormRepeater/index.tsx +118 -0
- package/src/components/ImageInput/ImageInput.module.css +74 -0
- package/src/components/ImageInput/ImageInput.spec.tsx +45 -0
- package/src/components/ImageInput/ImageInput.story.tsx +6 -0
- package/src/components/ImageInput/index.tsx +91 -0
- package/src/components/InfoPanel/InfoPanel.module.css +18 -0
- package/src/components/InfoPanel/InfoPanel.spec.tsx +15 -0
- package/src/components/InfoPanel/InfoPanel.story.tsx +32 -0
- package/src/components/InfoPanel/index.tsx +25 -0
- package/src/components/Link/Link.spec.tsx +62 -0
- package/src/components/Link/__mocks__/index.tsx +24 -0
- package/src/components/Link/index.tsx +51 -0
- package/src/components/List/List.module.css +9 -0
- package/src/components/List/List.spec.tsx +311 -0
- package/src/components/List/List.story.tsx +92 -0
- package/src/components/List/index.tsx +79 -0
- package/src/components/ListActions/ListActions.spec.tsx +10 -0
- package/src/components/ListActions/ListActions.story.tsx +6 -0
- package/src/components/ListActions/index.tsx +31 -0
- package/src/components/LoginForm/LoginForm.module.css +21 -0
- package/src/components/LoginForm/LoginForm.spec.tsx +63 -0
- package/src/components/LoginForm/index.tsx +102 -0
- package/src/components/Message/Message.module.css +14 -0
- package/src/components/Message/Message.spec.tsx +20 -0
- package/src/components/Message/index.tsx +27 -0
- package/src/components/ModalActions/ModalActions.module.css +5 -0
- package/src/components/ModalActions/ModalActions.spec.tsx +53 -0
- package/src/components/ModalActions/ModalActions.story.tsx +6 -0
- package/src/components/ModalActions/index.tsx +47 -0
- package/src/components/MoneyInput/MoneyInput.spec.tsx +17 -0
- package/src/components/MoneyInput/MoneyInput.story.tsx +6 -0
- package/src/components/MoneyInput/index.tsx +16 -0
- package/src/components/PasswordForm/PasswordForm.module.css +21 -0
- package/src/components/PasswordForm/index.tsx +94 -0
- package/src/components/PasswordInput/PasswordInput.module.css +23 -0
- package/src/components/PasswordInput/PasswordInput.spec.tsx +31 -0
- package/src/components/PasswordInput/PasswordInput.story.tsx +16 -0
- package/src/components/PasswordInput/index.tsx +27 -0
- package/src/components/RadioList/RadioList.spec.tsx +45 -0
- package/src/components/RadioList/index.tsx +10 -0
- package/src/components/Scene/Scene.spec.tsx +123 -0
- package/src/components/Scene/Scene.story.tsx +6 -0
- package/src/components/Scene/index.tsx +58 -0
- package/src/components/SummaryList/SummaryList.module.css +16 -0
- package/src/components/SummaryList/SummaryList.spec.tsx +77 -0
- package/src/components/SummaryList/SummaryList.story.tsx +11 -0
- package/src/components/SummaryList/index.tsx +37 -0
- package/src/components/Switch/Switch.module.css +86 -0
- package/src/components/Switch/Switch.spec.tsx +64 -0
- package/src/components/Switch/index.tsx +85 -0
- package/src/components/Table/Table.module.css +14 -0
- package/src/components/Table/Table.spec.tsx +128 -0
- package/src/components/Table/Table.story.tsx +101 -0
- package/src/components/Table/index.tsx +114 -0
- package/src/components/Tag/Tag.module.css +37 -0
- package/src/components/Tag/Tag.spec.tsx +10 -0
- package/src/components/Tag/Tag.story.tsx +55 -0
- package/src/components/Tag/index.tsx +27 -0
- package/src/components/TextArea/TextArea.module.css +23 -0
- package/src/components/TextArea/TextArea.spec.tsx +77 -0
- package/src/components/TextArea/index.tsx +59 -0
- package/src/components/TextInput/TextInput.module.css +57 -0
- package/src/components/TextInput/TextInput.spec.tsx +134 -0
- package/src/components/TextInput/TextInput.story.tsx +24 -0
- package/src/components/TextInput/index.tsx +146 -0
- package/src/components/WebsiteInput/WebsiteInput.spec.tsx +17 -0
- package/src/components/WebsiteInput/index.tsx +16 -0
- package/src/components/WeekCalendar/WeekCalendar.module.css +19 -0
- package/src/components/WeekCalendar/index.tsx +80 -0
- package/src/core/AppHeader/index.tsx +23 -0
- package/src/core/AppLogo/AppLogo.module.css +19 -0
- package/src/core/AppLogo/index.tsx +33 -0
- package/src/core/AppLogoImage/index.tsx +19 -0
- package/src/core/AppLogoPlaceholder/index.tsx +26 -0
- package/src/core/Assistive/Assistive.module.css +10 -0
- package/src/core/Assistive/index.tsx +18 -0
- package/src/core/Banner/Banner.module.css +36 -0
- package/src/core/Banner/index.tsx +25 -0
- package/src/core/BuildModal/index.tsx +119 -0
- package/src/core/Calendar/index.tsx +116 -0
- package/src/core/CalendarDay/CalendarDay.module.css +61 -0
- package/src/core/CalendarDay/index.tsx +82 -0
- package/src/core/CalendarMonth/CalendarMonth.module.css +13 -0
- package/src/core/CalendarMonth/index.tsx +101 -0
- package/src/core/CalendarNavigation/CalendarNavigation.module.css +26 -0
- package/src/core/CalendarNavigation/index.tsx +56 -0
- package/src/core/CalendarWeek/index.tsx +95 -0
- package/src/core/ChkRad/ChkRad.module.css +31 -0
- package/src/core/ChkRad/ChkRad.spec.tsx +72 -0
- package/src/core/ChkRad/index.tsx +80 -0
- package/src/core/ChkRadIcon/ChkRadIcon.module.css +28 -0
- package/src/core/ChkRadIcon/index.tsx +33 -0
- package/src/core/ChkRadList/ChkRadList.module.css +10 -0
- package/src/core/ChkRadList/index.tsx +85 -0
- package/src/core/CloseButton/CloseButton.spec.tsx +36 -0
- package/src/core/CloseButton/index.tsx +31 -0
- package/src/core/ConfirmModal/ConfirmModal.spec.tsx +88 -0
- package/src/core/ConfirmModal/index.tsx +51 -0
- package/src/core/ConnectedRepeater/index.tsx +248 -0
- package/src/core/ConnectedRepeaterComponent/index.tsx +66 -0
- package/src/core/Container/Container.module.css +12 -0
- package/src/core/Container/index.tsx +35 -0
- package/src/core/DropdownPanel/DropdownPanel.module.css +68 -0
- package/src/core/DropdownPanel/index.tsx +92 -0
- package/src/core/EmptyMessage/EmptyMessage.module.css +18 -0
- package/src/core/EmptyMessage/index.tsx +31 -0
- package/src/core/ErrorBoundary/ErrorBoundary.spec.tsx +33 -0
- package/src/core/ErrorBoundary/index.tsx +42 -0
- package/src/core/ErrorMessage/ErrorMessage.module.css +25 -0
- package/src/core/ErrorMessage/ErrorMessage.spec.tsx +31 -0
- package/src/core/ErrorMessage/index.tsx +37 -0
- package/src/core/FilterItem/FilterItem.module.css +104 -0
- package/src/core/FilterItem/index.tsx +164 -0
- package/src/core/Filters/Filters.module.css +86 -0
- package/src/core/Filters/Filters.spec.tsx +533 -0
- package/src/core/Filters/index.tsx +158 -0
- package/src/core/FixedActions/FixedActions.module.css +24 -0
- package/src/core/FixedActions/index.tsx +52 -0
- package/src/core/FormError/FormError.module.css +7 -0
- package/src/core/FormError/index.tsx +18 -0
- package/src/core/FormLabel/FormLabel.module.css +15 -0
- package/src/core/FormLabel/index.tsx +25 -0
- package/src/core/FormLegend/FormLegend.module.css +13 -0
- package/src/core/FormLegend/index.tsx +18 -0
- package/src/core/Header/Header.module.css +35 -0
- package/src/core/Header/index.tsx +37 -0
- package/src/core/Icon/Icon.spec.tsx +31 -0
- package/src/core/Icon/index.tsx +64 -0
- package/src/core/IconButton/Icon/Icon.spec.tsx +31 -0
- package/src/core/IconButton/Icon/index.tsx +64 -0
- package/src/core/IconButton/IconButton.module.css +32 -0
- package/src/core/IconButton/index.tsx +55 -0
- package/src/core/InputPanel/InputPanel.module.css +70 -0
- package/src/core/InputPanel/index.tsx +28 -0
- package/src/core/ListItem/ListItem.module.css +28 -0
- package/src/core/ListItem/ListItem.story.tsx +28 -0
- package/src/core/ListItem/index.tsx +99 -0
- package/src/core/ListItemAction/ListItemAction.module.css +28 -0
- package/src/core/ListItemAction/index.tsx +30 -0
- package/src/core/ListItemActions/ListItemActions.module.css +94 -0
- package/src/core/ListItemActions/index.tsx +55 -0
- package/src/core/ListItemMetaItem/ListItemMetaItem.module.css +18 -0
- package/src/core/ListItemMetaItem/index.tsx +54 -0
- package/src/core/ListItemTitle/ListItemTitle.module.css +14 -0
- package/src/core/ListItemTitle/ListItemTitle.spec.tsx +33 -0
- package/src/core/ListItemTitle/index.tsx +72 -0
- package/src/core/Loader/Loader.module.css +57 -0
- package/src/core/Loader/Loader.story.tsx +8 -0
- package/src/core/Loader/index.tsx +27 -0
- package/src/core/MeActions/MeActions.module.css +45 -0
- package/src/core/MeActions/index.tsx +46 -0
- package/src/core/MePanel/MePanel.module.css +75 -0
- package/src/core/MePanel/index.tsx +45 -0
- package/src/core/Modal/Modal.module.css +84 -0
- package/src/core/Modal/Modal.spec.tsx +51 -0
- package/src/core/Modal/index.tsx +66 -0
- package/src/core/Navigation/Navigation.module.css +83 -0
- package/src/core/Navigation/Navigation.spec.tsx +101 -0
- package/src/core/Navigation/index.tsx +109 -0
- package/src/core/NavigationDivider/NavigationDivider.module.css +18 -0
- package/src/core/NavigationDivider/index.tsx +13 -0
- package/src/core/NavigationItem/NavigationItem.module.css +51 -0
- package/src/core/NavigationItem/index.tsx +59 -0
- package/src/core/Pagination/Pagination.module.css +15 -0
- package/src/core/Pagination/index.tsx +100 -0
- package/src/core/PaginationItem/PaginationItem.module.css +33 -0
- package/src/core/PaginationItem/index.tsx +46 -0
- package/src/core/Panel/Panel.module.css +15 -0
- package/src/core/Panel/index.tsx +31 -0
- package/src/core/RadialProgress/RadialProgress.module.css +78 -0
- package/src/core/RadialProgress/index.tsx +52 -0
- package/src/core/StaticTextInput/StaticTextInput.module.css +79 -0
- package/src/core/StaticTextInput/StaticTextInput.spec.tsx +133 -0
- package/src/core/StaticTextInput/index.tsx +114 -0
- package/src/core/Styled/Styled.spec.tsx +38 -0
- package/src/core/Styled/Styled.story.tsx +10 -0
- package/src/core/Styled/index.tsx +62 -0
- package/src/core/SummaryListItem/SummaryListItem.module.css +28 -0
- package/src/core/SummaryListItem/index.tsx +60 -0
- package/src/core/TableActionsCell/TableActionsCell.module.css +3 -0
- package/src/core/TableActionsCell/index.tsx +37 -0
- package/src/core/TableCell/TableCell.module.css +16 -0
- package/src/core/TableCell/index.tsx +39 -0
- package/src/core/TableHead/TableHead.module.css +12 -0
- package/src/core/TableHead/index.tsx +48 -0
- package/src/core/TableRow/index.tsx +64 -0
- package/src/core/Tabs/Tabs.module.css +50 -0
- package/src/core/Tabs/index.tsx +94 -0
- package/src/core/TextInputAncillary/TextInputAncillary.module.css +64 -0
- package/src/core/TextInputAncillary/index.tsx +72 -0
- package/src/core/Toast/Toast.module.css +55 -0
- package/src/core/Toast/Toast.spec.tsx +78 -0
- package/src/core/Toast/index.tsx +81 -0
- package/src/core/WeekCalendarDay/WeekCalendarDay.module.css +32 -0
- package/src/core/WeekCalendarDay/index.tsx +68 -0
- package/src/filters/BooleanFilter/index.tsx +46 -0
- package/src/filters/DateFilter/index.tsx +36 -0
- package/src/filters/DropdownFilter/index.tsx +53 -0
- package/src/filters/QuickDateFilter/index.tsx +74 -0
- package/src/filters/interfaces.ts +40 -0
- package/src/hooks/useAccessiblePanel.spec.tsx +88 -0
- package/src/hooks/useAccessiblePanel.ts +74 -0
- package/src/hooks/useAppContext.ts +77 -0
- package/src/hooks/useClickOutside.ts +49 -0
- package/src/hooks/useConnectedList.ts +26 -0
- package/src/hooks/useFilters.ts +26 -0
- package/src/hooks/useForm.spec.ts +126 -0
- package/src/hooks/useForm.ts +99 -0
- package/src/hooks/useFormData.spec.ts +40 -0
- package/src/hooks/useFormData.ts +27 -0
- package/src/hooks/useLayout.spec.ts +55 -0
- package/src/hooks/useLayout.ts +29 -0
- package/src/hooks/useModal.spec.tsx +63 -0
- package/src/hooks/useModal.ts +60 -0
- package/src/hooks/useVariant.spec.ts +14 -0
- package/src/hooks/useVariant.ts +34 -0
- package/src/index.ts +194 -0
- package/src/scenes/Error404Scene.tsx +5 -0
- package/src/services/BuildService.spec.ts +56 -0
- package/src/services/BuildService.ts +34 -0
- package/src/services/ConfirmService.ts +21 -0
- package/src/services/DateService.spec.ts +87 -0
- package/src/services/DateService.ts +137 -0
- package/src/services/DownloadService.spec.ts +29 -0
- package/src/services/DownloadService.ts +14 -0
- package/src/services/FilterComponentService.tsx +46 -0
- package/src/services/FilterService.spec.ts +87 -0
- package/src/services/FilterService.ts +58 -0
- package/src/services/FormatService.spec.ts +83 -0
- package/src/services/FormatService.ts +55 -0
- package/src/services/ToastService.spec.ts +44 -0
- package/src/services/ToastService.ts +19 -0
- package/src/styles/layout.css +64 -0
- package/src/styles/variables.css +85 -0
- package/src/typings.d.ts +4 -0
- package/src/utility/MockRouter/index.ts +45 -0
- package/src/utility/StorybookPanel/StorybookPanel.module.css +9 -0
- package/src/utility/StorybookPanel/index.tsx +25 -0
- package/src/utility/TestChangeHandler/TestChangeHandler.module.css +7 -0
- package/src/utility/TestChangeHandler/TestChangeHandler.spec.tsx +24 -0
- package/src/utility/TestChangeHandler/index.tsx +54 -0
- package/src/utility/create-app.tsx +29 -0
- package/src/utility/interfaces.ts +119 -0
- package/src/utility/prop-types.ts +67 -0
- package/tests/setupFilesAfterEnv.js +10 -0
- package/tsconfig.json +26 -0
- package/tsconfig.types.json +9 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.prefix,
|
|
2
|
+
.suffix,
|
|
3
|
+
.clear {
|
|
4
|
+
align-items: center;
|
|
5
|
+
background-color: var(--clr-white);
|
|
6
|
+
border: var(--clr-grey400) solid;
|
|
7
|
+
border-width: .1rem 0 .1rem .1rem;
|
|
8
|
+
border-radius: .3rem 0 0 .3rem;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
color: var(--clr-grey600);
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
font-size: var(--fs-sml);
|
|
14
|
+
font-weight: var(--fw-bold);
|
|
15
|
+
justify-content: center;
|
|
16
|
+
margin-right: -.1rem;
|
|
17
|
+
min-width: 4rem;
|
|
18
|
+
padding: 0 1.5rem;
|
|
19
|
+
position: relative;
|
|
20
|
+
text-align: center;
|
|
21
|
+
|
|
22
|
+
&.hasError {
|
|
23
|
+
border-color: var(--clr-error);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&::before {
|
|
27
|
+
border-left: .1rem var(--clr-grey400) solid;
|
|
28
|
+
bottom: .6rem;
|
|
29
|
+
content: '';
|
|
30
|
+
position: absolute;
|
|
31
|
+
right: 0;
|
|
32
|
+
top: .6rem;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
input:focus ~ .prefix,
|
|
37
|
+
input:focus ~ .suffix,
|
|
38
|
+
input:focus ~ .clear {
|
|
39
|
+
border-color: var(--clr-primary);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.suffix,
|
|
43
|
+
.clear {
|
|
44
|
+
border-radius: 0 .3rem .3rem 0;
|
|
45
|
+
border-width: .1rem .1rem .1rem 0;
|
|
46
|
+
margin-left: -.1rem;
|
|
47
|
+
margin-right: 0;
|
|
48
|
+
|
|
49
|
+
&::before {
|
|
50
|
+
left: 0;
|
|
51
|
+
right: auto;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.clear {
|
|
56
|
+
padding: 0 1rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.loader {
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
position: absolute;
|
|
62
|
+
right: 1.5rem;
|
|
63
|
+
top: calc(50% - .4rem);
|
|
64
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import IconButton from '@core/IconButton';
|
|
6
|
+
import Loader from '@core/Loader';
|
|
7
|
+
|
|
8
|
+
import type { InputProps } from '@utility/interfaces';
|
|
9
|
+
|
|
10
|
+
import styles from './TextInputAncillary.module.css';
|
|
11
|
+
|
|
12
|
+
interface TextInputAncillaryProps extends InputProps {
|
|
13
|
+
isClearable?: boolean;
|
|
14
|
+
isLoading?: boolean;
|
|
15
|
+
onClear: () => void;
|
|
16
|
+
prefix?: string | null;
|
|
17
|
+
suffix?: string | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const TextInputAncillary: React.FunctionComponent<TextInputAncillaryProps> = ({
|
|
21
|
+
hasError,
|
|
22
|
+
isClearable,
|
|
23
|
+
isLoading,
|
|
24
|
+
onClear,
|
|
25
|
+
prefix,
|
|
26
|
+
suffix,
|
|
27
|
+
value,
|
|
28
|
+
}) => (
|
|
29
|
+
<Fragment>
|
|
30
|
+
{prefix ? (
|
|
31
|
+
<span className={classNames(styles.prefix, hasError && styles.hasError)}>{prefix}</span>
|
|
32
|
+
) : null}
|
|
33
|
+
{!prefix && suffix ? (
|
|
34
|
+
<span className={classNames(styles.suffix, hasError && styles.hasError)}>{suffix}</span>
|
|
35
|
+
) : null}
|
|
36
|
+
{isClearable && value ? (
|
|
37
|
+
<span
|
|
38
|
+
className={classNames(styles.clear, hasError && styles.hasError)}
|
|
39
|
+
data-testid="text-input-ancillary-clear"
|
|
40
|
+
>
|
|
41
|
+
<IconButton icon="x" onClick={(): void => onClear()} size="sm">
|
|
42
|
+
Clear
|
|
43
|
+
</IconButton>
|
|
44
|
+
</span>
|
|
45
|
+
) : null}
|
|
46
|
+
{isLoading ? (
|
|
47
|
+
<span className={styles.loader}>
|
|
48
|
+
<Loader isMini />
|
|
49
|
+
</span>
|
|
50
|
+
) : null}
|
|
51
|
+
</Fragment>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
TextInputAncillary.propTypes = {
|
|
55
|
+
onClear: PropTypes.func.isRequired,
|
|
56
|
+
|
|
57
|
+
/** If set to trute, the `TextInput` will be styled to indicate this */
|
|
58
|
+
hasError: PropTypes.bool,
|
|
59
|
+
|
|
60
|
+
isClearable: PropTypes.bool,
|
|
61
|
+
isLoading: PropTypes.bool,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* For uses of `TextInput` that involve an asynchronous process, setting this to true will add a
|
|
65
|
+
* mini version of the `Loader` component, to indicate that a process is taking place
|
|
66
|
+
*/
|
|
67
|
+
prefix: PropTypes.string,
|
|
68
|
+
suffix: PropTypes.string,
|
|
69
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default TextInputAncillary;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
background-color: var(--clr-grey800);
|
|
3
|
+
border-radius: .5rem;
|
|
4
|
+
box-shadow: 0 .3rem .3rem rgb(0, 0, 0, .03), 0 1rem 1rem rgb(0, 0, 0, .03);
|
|
5
|
+
color: var(--clr-white);
|
|
6
|
+
left: 50%;
|
|
7
|
+
max-width: 60rem;
|
|
8
|
+
min-width: 28rem;
|
|
9
|
+
opacity: 0;
|
|
10
|
+
padding: .7rem;
|
|
11
|
+
padding-left: 1rem;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
position: fixed;
|
|
14
|
+
top: calc(var(--banner-height) + 2rem);
|
|
15
|
+
transform: translate3d(-50%, -5rem, 0);
|
|
16
|
+
transition: opacity .15s, transform .15s;
|
|
17
|
+
width: 40%;
|
|
18
|
+
z-index: 20;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rootIsOpen {
|
|
22
|
+
opacity: 1;
|
|
23
|
+
pointer-events: all;
|
|
24
|
+
transform: translate3d(-50%, 0, 0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.rootSuccess {
|
|
28
|
+
background-color: var(--clr-success);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.rootError {
|
|
32
|
+
background-color: var(--clr-error);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.inner {
|
|
36
|
+
align-items: center;
|
|
37
|
+
display: flex;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.progress {
|
|
42
|
+
min-width: 3.4rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.content {
|
|
46
|
+
flex-grow: 1;
|
|
47
|
+
font-size: var(--fs-sml);
|
|
48
|
+
font-weight: var(--fw-bold);
|
|
49
|
+
line-height: var(--lh-tight);
|
|
50
|
+
padding: 0 1.5rem .1rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.close {
|
|
54
|
+
min-width: 4rem;
|
|
55
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
|
|
5
|
+
import ToastService from '@services/ToastService';
|
|
6
|
+
|
|
7
|
+
import Toast from './index';
|
|
8
|
+
|
|
9
|
+
describe('Toast', () => {
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
jest.clearAllMocks();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should render', () => {
|
|
15
|
+
render(<Toast />);
|
|
16
|
+
expect(screen.getByTestId('toast-root')).not.toHaveClass('rootIsOpen');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should open success', async () => {
|
|
20
|
+
render(<Toast />);
|
|
21
|
+
|
|
22
|
+
await waitFor(() => {
|
|
23
|
+
ToastService.success('Lorem Ipsum');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
await waitFor(() => {
|
|
27
|
+
expect(screen.getByText('Lorem Ipsum')).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
expect(screen.getByTestId('toast-root')).toHaveClass('rootIsOpen rootSuccess');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should open error', async () => {
|
|
34
|
+
render(<Toast />);
|
|
35
|
+
|
|
36
|
+
await waitFor(() => {
|
|
37
|
+
ToastService.error('Lorem Ipsum');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
await waitFor(() => {
|
|
41
|
+
expect(screen.getByText('Lorem Ipsum')).toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
expect(screen.getByTestId('toast-root')).toHaveClass('rootIsOpen rootError');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should close success', async () => {
|
|
48
|
+
render(<Toast />);
|
|
49
|
+
|
|
50
|
+
await waitFor(() => {
|
|
51
|
+
ToastService.success('Lorem Ipsum');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
await waitFor(() => {
|
|
55
|
+
expect(screen.getByText('Lorem Ipsum')).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
userEvent.click(screen.getByText('Close'));
|
|
59
|
+
|
|
60
|
+
await waitFor(() => {
|
|
61
|
+
expect(screen.queryByText('Lorem Ipsum')).not.toBeInTheDocument();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should automatically close', async () => {
|
|
66
|
+
jest.useFakeTimers();
|
|
67
|
+
const mockFn = jest.spyOn(global, 'setTimeout');
|
|
68
|
+
|
|
69
|
+
render(<Toast />);
|
|
70
|
+
|
|
71
|
+
await waitFor(() => {
|
|
72
|
+
ToastService.success('Lorem Ipsum');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
76
|
+
expect(mockFn).toHaveBeenCalledWith(expect.any(Function), 6000);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { EventService, ucwords } from '@sqrzro/utility';
|
|
5
|
+
|
|
6
|
+
import IconButton from '@core/IconButton';
|
|
7
|
+
import RadialProgress from '@core/RadialProgress';
|
|
8
|
+
|
|
9
|
+
import styles from './Toast.module.css';
|
|
10
|
+
|
|
11
|
+
const TTL = 6000;
|
|
12
|
+
|
|
13
|
+
const iconMap: Record<string, string> = {
|
|
14
|
+
success: 'checkCircle',
|
|
15
|
+
error: 'exclamationCircle',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Toast: React.FunctionComponent = () => {
|
|
19
|
+
const timeout = useRef<number>();
|
|
20
|
+
|
|
21
|
+
const [type, setType] = useState('');
|
|
22
|
+
const [message, setMessage] = useState('');
|
|
23
|
+
|
|
24
|
+
const closeToast = (existingType: string): void => {
|
|
25
|
+
EventService.publish('@toast/send', { type: existingType });
|
|
26
|
+
window.clearTimeout(timeout.current);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const sub = EventService.subscribe<{ message: string; type: string }>(
|
|
31
|
+
'@toast/send',
|
|
32
|
+
(_key, data) => {
|
|
33
|
+
setType(data.type);
|
|
34
|
+
setMessage(data.message);
|
|
35
|
+
|
|
36
|
+
if (timeout.current) {
|
|
37
|
+
window.clearTimeout(timeout.current);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
* A test checks if setTimeout is called in this circumstance. However, due to the
|
|
42
|
+
* nature of asynchronous code in tests, coverage does not count this as covered. It
|
|
43
|
+
* can therefore be safely ignored.
|
|
44
|
+
*/
|
|
45
|
+
/* istanbul ignore next */
|
|
46
|
+
timeout.current = window.setTimeout(() => closeToast(data.type), TTL);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return (): void => {
|
|
51
|
+
EventService.unsubscribe(sub);
|
|
52
|
+
};
|
|
53
|
+
}, []);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<aside
|
|
57
|
+
className={classNames(
|
|
58
|
+
styles.root,
|
|
59
|
+
message && styles.rootIsOpen,
|
|
60
|
+
type && styles[`root${ucwords(type)}`]
|
|
61
|
+
)}
|
|
62
|
+
data-testid="toast-root"
|
|
63
|
+
>
|
|
64
|
+
<div className={styles.inner}>
|
|
65
|
+
{message ? (
|
|
66
|
+
<div className={styles.progress}>
|
|
67
|
+
<RadialProgress duration={TTL} icon={iconMap[type]} variant={type} />
|
|
68
|
+
</div>
|
|
69
|
+
) : null}
|
|
70
|
+
<p className={styles.content}>{message}</p>
|
|
71
|
+
<div className={styles.close}>
|
|
72
|
+
<IconButton icon="x" onClick={(): void => closeToast(type)} variant="white">
|
|
73
|
+
Close
|
|
74
|
+
</IconButton>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</aside>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default Toast;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
background: repeating-linear-gradient(var(--clr-grey300), white .3rem, white 6rem);
|
|
3
|
+
background-position: 0 4rem;
|
|
4
|
+
border-radius: .5rem;
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 13%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.title {
|
|
10
|
+
background-color: var(--clr-white);
|
|
11
|
+
border-radius: .5rem;
|
|
12
|
+
color: var(--clr-grey700);
|
|
13
|
+
font-size: var(--fs-sml);
|
|
14
|
+
font-weight: var(--fw-bold);
|
|
15
|
+
line-height: 4rem;
|
|
16
|
+
text-align: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.item {
|
|
20
|
+
background-color: var(--clr-link);
|
|
21
|
+
border-radius: .2rem;
|
|
22
|
+
color: var(--clr-white);
|
|
23
|
+
font-size: var(--fs-sml);
|
|
24
|
+
left: 1rem;
|
|
25
|
+
padding: .5rem .8rem;
|
|
26
|
+
position: absolute;
|
|
27
|
+
right: 1rem;
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
color: var(--clr-white);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import FormatService from '@services/FormatService';
|
|
5
|
+
|
|
6
|
+
import Link from '@components/Link';
|
|
7
|
+
|
|
8
|
+
import styles from './WeekCalendarDay.module.css';
|
|
9
|
+
|
|
10
|
+
interface DataItem {
|
|
11
|
+
id: number;
|
|
12
|
+
datetime: string;
|
|
13
|
+
patient: { name: string };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface TransformedItem extends DataItem {
|
|
17
|
+
offset: number;
|
|
18
|
+
to: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface WeekCalendarDayProps {
|
|
22
|
+
data?: DataItem[] | null;
|
|
23
|
+
date: Date;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const WeekCalendarDay: React.FunctionComponent<WeekCalendarDayProps> = ({ data, date }) => {
|
|
27
|
+
const filtered: TransformedItem[] = (data || [])
|
|
28
|
+
.map((item) => {
|
|
29
|
+
const [itemDate, itemTime] = item.datetime.split(' ');
|
|
30
|
+
|
|
31
|
+
if (itemDate !== FormatService.date(date, 'Y-MM-dd')) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const [hours, minutes] = itemTime.split(':');
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers, no-mixed-operators
|
|
37
|
+
const offset = (parseInt(hours, 10) - 8) * 60 + parseInt(minutes, 10) + 40;
|
|
38
|
+
|
|
39
|
+
return { ...item, offset, to: `/appointments/${item.id}` };
|
|
40
|
+
})
|
|
41
|
+
.filter((item): item is TransformedItem => Boolean(item));
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div className={styles.root}>
|
|
45
|
+
<div className={styles.div}>{FormatService.date(date, 'E dd/MM')}</div>
|
|
46
|
+
{filtered.map((item) => (
|
|
47
|
+
<Link key={item.to} to={item.to}>
|
|
48
|
+
{FormatService.date(item.datetime, 'HH:mm')} {item.patient.name}
|
|
49
|
+
</Link>
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
WeekCalendarDay.propTypes = {
|
|
56
|
+
date: PropTypes.instanceOf(Date).isRequired,
|
|
57
|
+
data: PropTypes.arrayOf(
|
|
58
|
+
PropTypes.shape({
|
|
59
|
+
id: PropTypes.number.isRequired,
|
|
60
|
+
datetime: PropTypes.string.isRequired,
|
|
61
|
+
patient: PropTypes.shape({
|
|
62
|
+
name: PropTypes.string.isRequired,
|
|
63
|
+
}).isRequired,
|
|
64
|
+
}).isRequired
|
|
65
|
+
),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default WeekCalendarDay;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import Dropdown from '@components/Dropdown';
|
|
5
|
+
|
|
6
|
+
import type { FilterFieldProps, RenderSummaryArgs } from '@filters/interfaces';
|
|
7
|
+
import { isStringArray } from '@utility/interfaces';
|
|
8
|
+
import type { SimpleObject } from '@utility/interfaces';
|
|
9
|
+
|
|
10
|
+
const getData = (data?: SimpleObject[] | string[]): SimpleObject[] => {
|
|
11
|
+
if (!data || !data.length || !isStringArray(data)) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
id: 1,
|
|
18
|
+
name: data[0],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 0,
|
|
22
|
+
name: data[1],
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const BooleanFilter: React.FunctionComponent<FilterFieldProps> = ({ data, ...props }) => (
|
|
28
|
+
<Dropdown isPanelOnly {...props} data={getData(data)} />
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
BooleanFilter.propTypes = {
|
|
32
|
+
data: PropTypes.oneOfType([
|
|
33
|
+
PropTypes.arrayOf(
|
|
34
|
+
PropTypes.shape({
|
|
35
|
+
id: PropTypes.string.isRequired,
|
|
36
|
+
name: PropTypes.string.isRequired,
|
|
37
|
+
}).isRequired
|
|
38
|
+
),
|
|
39
|
+
PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
40
|
+
]),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const renderSummary = ({ data, value }: RenderSummaryArgs): string =>
|
|
44
|
+
getData(data).find((item) => item.id.toString() === value?.toString())?.name || '';
|
|
45
|
+
|
|
46
|
+
export default BooleanFilter;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import CalendarInput from '@components/CalendarInput';
|
|
4
|
+
|
|
5
|
+
import type { FilterFieldProps, RenderSummaryArgs } from '@filters/interfaces';
|
|
6
|
+
import FormatService from '@services/FormatService';
|
|
7
|
+
|
|
8
|
+
const YEAR_LENGTH = 4;
|
|
9
|
+
|
|
10
|
+
const DateFilter: React.FunctionComponent<FilterFieldProps> = (props) => (
|
|
11
|
+
<CalendarInput isPanelOnly isRange {...props} />
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const renderSummary = ({ value }: RenderSummaryArgs): string => {
|
|
15
|
+
if (!value || typeof value !== 'string') {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const splitValues = value.split(',');
|
|
20
|
+
|
|
21
|
+
if (splitValues.length === 1) {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (splitValues[0] === splitValues[1]) {
|
|
26
|
+
return FormatService.date(splitValues[0]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const isSameYear = splitValues[0].startsWith(splitValues[1].substring(0, YEAR_LENGTH));
|
|
30
|
+
|
|
31
|
+
return splitValues
|
|
32
|
+
.map((item) => FormatService.date(item, isSameYear ? 'dd/MM' : 'dd/MM/Y'))
|
|
33
|
+
.join(' - ');
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default DateFilter;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import Dropdown, { renderLabel } from '@components/Dropdown';
|
|
5
|
+
|
|
6
|
+
import type { FilterFieldProps, RenderSummaryArgs } from '@filters/interfaces';
|
|
7
|
+
import { isSimpleObjectArray } from '@utility/interfaces';
|
|
8
|
+
import type { SimpleObject } from '@utility/interfaces';
|
|
9
|
+
|
|
10
|
+
const checkData = (data?: SimpleObject[] | string[]): SimpleObject[] => {
|
|
11
|
+
if (!isSimpleObjectArray(data)) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const DropdownFilter: React.FunctionComponent<FilterFieldProps> = ({
|
|
18
|
+
data,
|
|
19
|
+
extraProps,
|
|
20
|
+
...props
|
|
21
|
+
}) => (
|
|
22
|
+
<Dropdown
|
|
23
|
+
isPanelOnly
|
|
24
|
+
{...props}
|
|
25
|
+
data={checkData(data)}
|
|
26
|
+
isMultiple={Boolean(extraProps?.isMultiple)}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
DropdownFilter.propTypes = {
|
|
31
|
+
data: PropTypes.oneOfType([
|
|
32
|
+
PropTypes.arrayOf(
|
|
33
|
+
PropTypes.shape({
|
|
34
|
+
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
35
|
+
name: PropTypes.string.isRequired,
|
|
36
|
+
}).isRequired
|
|
37
|
+
),
|
|
38
|
+
PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
39
|
+
]),
|
|
40
|
+
extraProps: PropTypes.shape({
|
|
41
|
+
isMultiple: PropTypes.bool,
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const renderSummary = ({ data, value, props }: RenderSummaryArgs): string => {
|
|
46
|
+
if (!data || !isSimpleObjectArray(data)) {
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return renderLabel(data, value, props?.isMultiple as boolean) || '';
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default DropdownFilter;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { Fragment, useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import Dropdown from '@components/Dropdown';
|
|
5
|
+
import type { FilterFieldProps, RenderSummaryArgs } from '@filters/interfaces';
|
|
6
|
+
|
|
7
|
+
import DateFilter, { renderSummary as dateRenderSummary } from '@filters/DateFilter';
|
|
8
|
+
import type { SimpleEvent } from '@utility/interfaces';
|
|
9
|
+
import DateService from '@services/DateService';
|
|
10
|
+
|
|
11
|
+
const QuickDateFilter: React.FunctionComponent<FilterFieldProps> = ({
|
|
12
|
+
onChange,
|
|
13
|
+
panelIndex,
|
|
14
|
+
setPanelIndex,
|
|
15
|
+
...props
|
|
16
|
+
}) => {
|
|
17
|
+
const data = useMemo(
|
|
18
|
+
() => [...DateService.getQuickDates(), { id: '[internal]', name: 'Custom...' }],
|
|
19
|
+
[]
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const handleChange = (event: SimpleEvent): void => {
|
|
23
|
+
if (event.target.value === '[internal]') {
|
|
24
|
+
if (setPanelIndex) {
|
|
25
|
+
setPanelIndex(1);
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (onChange) {
|
|
30
|
+
onChange(event);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Fragment>
|
|
36
|
+
<div
|
|
37
|
+
data-testid="quick-date-filter-dropdown"
|
|
38
|
+
style={{ display: panelIndex === 0 ? 'block' : 'none' }}
|
|
39
|
+
>
|
|
40
|
+
<Dropdown isPanelOnly {...props} data={data} onChange={handleChange} />
|
|
41
|
+
</div>
|
|
42
|
+
<div
|
|
43
|
+
data-testid="quick-date-filter-date-filter"
|
|
44
|
+
style={{ display: panelIndex === 1 ? 'block' : 'none' }}
|
|
45
|
+
>
|
|
46
|
+
<DateFilter {...props} onChange={onChange} />
|
|
47
|
+
</div>
|
|
48
|
+
</Fragment>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
QuickDateFilter.propTypes = {
|
|
53
|
+
panelIndex: PropTypes.number,
|
|
54
|
+
setPanelIndex: PropTypes.func,
|
|
55
|
+
onChange: PropTypes.func,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const renderSummary = ({ value }: RenderSummaryArgs): string => {
|
|
59
|
+
if (!value || typeof value !== 'string') {
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const quickDate = DateService.getQuickDates().find(
|
|
64
|
+
(item) => item.id.toString() === value.toString()
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
if (quickDate) {
|
|
68
|
+
return quickDate.name;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return dateRenderSummary({ value });
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default QuickDateFilter;
|