@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,99 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import ListItemActions from '@core/ListItemActions';
|
|
5
|
+
import ListItemMetaItem from '@core/ListItemMetaItem';
|
|
6
|
+
import type { ValueObject } from '@core/ListItemMetaItem';
|
|
7
|
+
import ListItemTitle from '@core/ListItemTitle';
|
|
8
|
+
|
|
9
|
+
import Panel from '@core/Panel';
|
|
10
|
+
|
|
11
|
+
import type { TransformedObject } from '@utility/interfaces';
|
|
12
|
+
|
|
13
|
+
import styles from './ListItem.module.css';
|
|
14
|
+
|
|
15
|
+
interface ListItemProps extends TransformedObject {
|
|
16
|
+
$shouldPreloadTitle?: boolean;
|
|
17
|
+
content?: string;
|
|
18
|
+
meta?: (React.ReactElement | ValueObject | string | null | undefined)[];
|
|
19
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLHeadingElement>;
|
|
20
|
+
secondary?: { title: string };
|
|
21
|
+
title?: string;
|
|
22
|
+
to?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ListItem: React.FunctionComponent<ListItemProps> = ({
|
|
26
|
+
$actions,
|
|
27
|
+
$original,
|
|
28
|
+
$shouldPreloadTitle,
|
|
29
|
+
content,
|
|
30
|
+
meta,
|
|
31
|
+
onClick,
|
|
32
|
+
secondary,
|
|
33
|
+
title,
|
|
34
|
+
to,
|
|
35
|
+
}) => (
|
|
36
|
+
<Panel>
|
|
37
|
+
<article>
|
|
38
|
+
{title ? (
|
|
39
|
+
<div className={styles.inner}>
|
|
40
|
+
<ListItemTitle isPreload={$shouldPreloadTitle} onClick={onClick} to={to}>
|
|
41
|
+
{title}
|
|
42
|
+
</ListItemTitle>
|
|
43
|
+
{secondary && <p className={styles.title}>{secondary.title}</p>}
|
|
44
|
+
</div>
|
|
45
|
+
) : null}
|
|
46
|
+
|
|
47
|
+
{content ? <div className={styles.content}>{content}</div> : null}
|
|
48
|
+
|
|
49
|
+
{(meta || $actions) && (
|
|
50
|
+
<footer className={styles.footer}>
|
|
51
|
+
{meta && (
|
|
52
|
+
<ul className={styles.meta}>
|
|
53
|
+
{/* eslint-disable react/no-array-index-key */}
|
|
54
|
+
{meta.map((item, index) => (
|
|
55
|
+
<ListItemMetaItem key={index} value={item} />
|
|
56
|
+
))}
|
|
57
|
+
{/* eslint-enable react/no-array-index-key */}
|
|
58
|
+
</ul>
|
|
59
|
+
)}
|
|
60
|
+
|
|
61
|
+
{$actions && <ListItemActions actions={$actions} data={$original} />}
|
|
62
|
+
</footer>
|
|
63
|
+
)}
|
|
64
|
+
</article>
|
|
65
|
+
</Panel>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
ListItem.propTypes = {
|
|
69
|
+
$original: PropTypes.shape({}).isRequired,
|
|
70
|
+
$actions: PropTypes.oneOfType([
|
|
71
|
+
PropTypes.arrayOf(
|
|
72
|
+
PropTypes.shape({
|
|
73
|
+
label: PropTypes.string.isRequired,
|
|
74
|
+
onClick: PropTypes.func.isRequired,
|
|
75
|
+
}).isRequired
|
|
76
|
+
),
|
|
77
|
+
PropTypes.func,
|
|
78
|
+
]),
|
|
79
|
+
$shouldPreloadTitle: PropTypes.bool,
|
|
80
|
+
content: PropTypes.string,
|
|
81
|
+
meta: PropTypes.arrayOf(
|
|
82
|
+
PropTypes.oneOfType([
|
|
83
|
+
PropTypes.string,
|
|
84
|
+
PropTypes.shape({
|
|
85
|
+
to: PropTypes.string.isRequired,
|
|
86
|
+
label: PropTypes.string.isRequired,
|
|
87
|
+
}),
|
|
88
|
+
PropTypes.element,
|
|
89
|
+
])
|
|
90
|
+
),
|
|
91
|
+
secondary: PropTypes.shape({
|
|
92
|
+
title: PropTypes.string.isRequired,
|
|
93
|
+
}),
|
|
94
|
+
title: PropTypes.string,
|
|
95
|
+
to: PropTypes.string,
|
|
96
|
+
onClick: PropTypes.func,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default ListItem;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
background: transparent;
|
|
3
|
+
border: 0;
|
|
4
|
+
color: var(--clr-link);
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
font-family: inherit;
|
|
7
|
+
font-size: var(--fs-sml);
|
|
8
|
+
font-weight: var(--fw-bold);
|
|
9
|
+
line-height: 3rem;
|
|
10
|
+
margin-left: 2rem;
|
|
11
|
+
padding: 0;
|
|
12
|
+
|
|
13
|
+
&:focus {
|
|
14
|
+
outline: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
color: var(--clr-link-hover);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.rootDanger {
|
|
23
|
+
color: var(--clr-danger);
|
|
24
|
+
|
|
25
|
+
&:hover {
|
|
26
|
+
color: var(--clr-danger-dark);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import useVariant from '@hooks/useVariant';
|
|
6
|
+
|
|
7
|
+
import type { ButtonVariant, SimpleAction } from '@utility/interfaces';
|
|
8
|
+
|
|
9
|
+
import styles from './ListItemAction.module.css';
|
|
10
|
+
|
|
11
|
+
const ListItemAction: React.FunctionComponent<SimpleAction> = ({ label, onClick, variant }) => {
|
|
12
|
+
const { applyVariantClassName } = useVariant<ButtonVariant>(variant);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<button
|
|
16
|
+
className={classNames(styles.root, applyVariantClassName(styles))}
|
|
17
|
+
onClick={onClick}
|
|
18
|
+
type="button"
|
|
19
|
+
>
|
|
20
|
+
{label}
|
|
21
|
+
</button>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
ListItemAction.propTypes = {
|
|
26
|
+
label: PropTypes.string.isRequired,
|
|
27
|
+
onClick: PropTypes.func.isRequired,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default ListItemAction;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
align-items: center;
|
|
3
|
+
bottom: -.5rem;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row-reverse;
|
|
6
|
+
height: 3rem;
|
|
7
|
+
left: -2rem;
|
|
8
|
+
position: absolute;
|
|
9
|
+
right: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
td .root {
|
|
13
|
+
bottom: auto;
|
|
14
|
+
left: auto;
|
|
15
|
+
top: calc(50% - 15px);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.control {
|
|
19
|
+
background: var(--clr-white);
|
|
20
|
+
border: .1rem var(--clr-grey400) solid;
|
|
21
|
+
border-radius: .3rem;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
height: 3rem;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
position: relative;
|
|
26
|
+
text-indent: 5rem;
|
|
27
|
+
width: 3rem;
|
|
28
|
+
|
|
29
|
+
&:focus {
|
|
30
|
+
border: .1rem var(--clr-grey400) dashed;
|
|
31
|
+
outline: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
& i,
|
|
35
|
+
& i::before,
|
|
36
|
+
& i::after {
|
|
37
|
+
background-color: var(--clr-link);
|
|
38
|
+
border-radius: 50%;
|
|
39
|
+
left: calc(50% - .2rem);
|
|
40
|
+
position: absolute;
|
|
41
|
+
height: .4rem;
|
|
42
|
+
top: calc(50% - .2rem);
|
|
43
|
+
width: .4rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
& i::before {
|
|
47
|
+
content: '';
|
|
48
|
+
left: -.6rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
& i::after {
|
|
52
|
+
content: '';
|
|
53
|
+
left: auto;
|
|
54
|
+
right: -.6rem;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.list {
|
|
59
|
+
background: var(--clr-white80);
|
|
60
|
+
display: flex;
|
|
61
|
+
flex: 1;
|
|
62
|
+
justify-content: flex-end;
|
|
63
|
+
margin-right: 2rem;
|
|
64
|
+
opacity: 0;
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
transform: translate3d(1rem, 0, 0);
|
|
67
|
+
transition: opacity .2s, transform .2s;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
tr:nth-child(2n - 1) .list {
|
|
71
|
+
background-color: var(--clr-grey10080);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.listIsOpen {
|
|
75
|
+
opacity: 1;
|
|
76
|
+
pointer-events: all;
|
|
77
|
+
transform: translate3d(0, 0, 0);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.item {
|
|
81
|
+
background-color: var(--clr-white);
|
|
82
|
+
|
|
83
|
+
&:first-child {
|
|
84
|
+
background: linear-gradient(90deg, var(--clr-white0), var(--clr-white) 1rem);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
tr:nth-child(2n - 1) .item {
|
|
89
|
+
background-color: var(--clr-grey100);
|
|
90
|
+
|
|
91
|
+
&:first-child {
|
|
92
|
+
background: linear-gradient(90deg, var(--clr-grey1000), var(--clr-grey100) 1rem);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import ListItemAction from '@core/ListItemAction';
|
|
6
|
+
|
|
7
|
+
import useClickOutside from '@hooks/useClickOutside';
|
|
8
|
+
|
|
9
|
+
import type { SimpleAction } from '@utility/interfaces';
|
|
10
|
+
|
|
11
|
+
import styles from './ListItemActions.module.css';
|
|
12
|
+
|
|
13
|
+
interface ListItemActionsProps {
|
|
14
|
+
actions: SimpleAction[] | ((data?: Record<string, unknown>) => SimpleAction[]);
|
|
15
|
+
data?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const ListItemActions: React.FunctionComponent<ListItemActionsProps> = ({ actions, data }) => {
|
|
19
|
+
const [isOpen, setIsOpen, node] = useClickOutside();
|
|
20
|
+
|
|
21
|
+
const toggleOpen = (): void => setIsOpen(!isOpen);
|
|
22
|
+
|
|
23
|
+
const transformed = typeof actions === 'function' ? actions(data) : actions;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div ref={node} className={styles.root}>
|
|
27
|
+
<button className={styles.control} onClick={toggleOpen} type="button">
|
|
28
|
+
{isOpen ? 'Close' : 'Open'}
|
|
29
|
+
<i />
|
|
30
|
+
</button>
|
|
31
|
+
<ul className={classNames(styles.list, isOpen && styles.listIsOpen)}>
|
|
32
|
+
{transformed.filter(Boolean).map((item) => (
|
|
33
|
+
<li key={item.label} className={styles.item}>
|
|
34
|
+
<ListItemAction {...item} />
|
|
35
|
+
</li>
|
|
36
|
+
))}
|
|
37
|
+
</ul>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
ListItemActions.propTypes = {
|
|
43
|
+
actions: PropTypes.oneOfType([
|
|
44
|
+
PropTypes.arrayOf(
|
|
45
|
+
PropTypes.shape({
|
|
46
|
+
label: PropTypes.string.isRequired,
|
|
47
|
+
onClick: PropTypes.func.isRequired,
|
|
48
|
+
}).isRequired
|
|
49
|
+
),
|
|
50
|
+
PropTypes.func,
|
|
51
|
+
]).isRequired,
|
|
52
|
+
data: PropTypes.shape({}).isRequired,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default ListItemActions;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
&:not(:last-child) {
|
|
3
|
+
align-items: center;
|
|
4
|
+
display: flex;
|
|
5
|
+
margin-right: 1.5rem;
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
&::after {
|
|
9
|
+
background-color: var(--clr-grey400);
|
|
10
|
+
border-radius: 50%;
|
|
11
|
+
content: '';
|
|
12
|
+
height: .4rem;
|
|
13
|
+
margin-left: 1.5rem;
|
|
14
|
+
top: .5em;
|
|
15
|
+
width: .4rem;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { isValidElement } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import Link from '@components/Link';
|
|
5
|
+
|
|
6
|
+
import Styled from '@core/Styled';
|
|
7
|
+
|
|
8
|
+
import styles from './ListItemMetaItem.module.css';
|
|
9
|
+
|
|
10
|
+
export interface ValueObject {
|
|
11
|
+
to: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ListItemMetaItemProps {
|
|
16
|
+
value?: React.ReactElement | ValueObject | string | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const ListItemMetaItem: React.FunctionComponent<ListItemMetaItemProps> = ({ value }) => {
|
|
20
|
+
if (isValidElement(value)) {
|
|
21
|
+
return <li className={styles.root}>{value}</li>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (typeof value !== 'object') {
|
|
25
|
+
return (
|
|
26
|
+
<li className={styles.root}>
|
|
27
|
+
<Styled>{value}</Styled>
|
|
28
|
+
</li>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (value?.to) {
|
|
33
|
+
return (
|
|
34
|
+
<li className={styles.root}>
|
|
35
|
+
<Link to={value.to}>{value.label}</Link>
|
|
36
|
+
</li>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
ListItemMetaItem.propTypes = {
|
|
44
|
+
value: PropTypes.oneOfType([
|
|
45
|
+
PropTypes.string,
|
|
46
|
+
PropTypes.shape({
|
|
47
|
+
to: PropTypes.string.isRequired,
|
|
48
|
+
label: PropTypes.string.isRequired,
|
|
49
|
+
}),
|
|
50
|
+
PropTypes.element,
|
|
51
|
+
]),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default ListItemMetaItem;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
|
|
5
|
+
import ListItemTitle from './index';
|
|
6
|
+
|
|
7
|
+
describe('ListItemTitle', () => {
|
|
8
|
+
it('should render', () => {
|
|
9
|
+
render(<ListItemTitle>Lorem</ListItemTitle>);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should render defaults', () => {
|
|
13
|
+
render(<ListItemTitle>Lorem</ListItemTitle>);
|
|
14
|
+
|
|
15
|
+
const title = screen.getByText('Lorem');
|
|
16
|
+
expect(title).toHaveTextContent(/^Lorem$/u);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should handle to', () => {
|
|
20
|
+
render(<ListItemTitle to="lorem">Lorem</ListItemTitle>);
|
|
21
|
+
expect(screen.getByRole('link')).toHaveAttribute('href', '/lorem');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should handle onclick without to', () => {
|
|
25
|
+
const mockFn = jest.fn();
|
|
26
|
+
render(<ListItemTitle onClick={mockFn}>Lorem</ListItemTitle>);
|
|
27
|
+
expect(screen.getByRole('button')).toBeInTheDocument();
|
|
28
|
+
|
|
29
|
+
expect(mockFn).toHaveBeenCalledTimes(0);
|
|
30
|
+
userEvent.click(screen.getByRole('button'));
|
|
31
|
+
expect(mockFn).toHaveBeenCalledTimes(1);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
import { EventService } from '@sqrzro/utility';
|
|
6
|
+
|
|
7
|
+
import Link from '@components/Link';
|
|
8
|
+
import Styled from '@core/Styled';
|
|
9
|
+
|
|
10
|
+
import styles from './ListItemTitle.module.css';
|
|
11
|
+
|
|
12
|
+
interface ListItemTitleProps {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
isPreload?: boolean;
|
|
15
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLHeadingElement>;
|
|
16
|
+
to?: string | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const ListItemTitle: React.FunctionComponent<ListItemTitleProps> = ({
|
|
20
|
+
children,
|
|
21
|
+
isPreload,
|
|
22
|
+
onClick,
|
|
23
|
+
to,
|
|
24
|
+
}) => {
|
|
25
|
+
const handlePreloadTitle = (
|
|
26
|
+
event: React.MouseEvent<HTMLAnchorElement | HTMLHeadingElement>
|
|
27
|
+
): void => {
|
|
28
|
+
if (onClick) {
|
|
29
|
+
onClick(event);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!isPreload) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
EventService.publish('@app/title', children);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
if (to) {
|
|
40
|
+
return (
|
|
41
|
+
<h2 className={styles.root}>
|
|
42
|
+
<Link onClick={handlePreloadTitle} to={to}>
|
|
43
|
+
<Styled>{children}</Styled>
|
|
44
|
+
</Link>
|
|
45
|
+
</h2>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const clickProps = {
|
|
50
|
+
className: classNames(styles.root, styles.rootIsLink),
|
|
51
|
+
onClick,
|
|
52
|
+
role: 'button',
|
|
53
|
+
tabIndex: 0,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const props = onClick ? clickProps : { className: styles.root };
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<h2 {...props}>
|
|
60
|
+
<Styled>{children}</Styled>
|
|
61
|
+
</h2>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
ListItemTitle.propTypes = {
|
|
66
|
+
children: PropTypes.node.isRequired,
|
|
67
|
+
isPreload: PropTypes.bool,
|
|
68
|
+
to: PropTypes.string,
|
|
69
|
+
onClick: PropTypes.func,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default ListItemTitle;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
@keyframes anim {
|
|
2
|
+
0% {
|
|
3
|
+
opacity: 1;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
40% {
|
|
7
|
+
opacity: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
100% {
|
|
11
|
+
opacity: 1;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.root {
|
|
16
|
+
display: flex;
|
|
17
|
+
height: 1rem;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
margin: 8rem auto;
|
|
20
|
+
width: 4rem;
|
|
21
|
+
|
|
22
|
+
& span {
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
position: absolute;
|
|
25
|
+
text-indent: 5rem;
|
|
26
|
+
width: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
& i {
|
|
30
|
+
animation: anim 1s;
|
|
31
|
+
animation-fill-mode: both;
|
|
32
|
+
animation-iteration-count: infinite;
|
|
33
|
+
background-color: var(--clr-grey400);
|
|
34
|
+
border-radius: 50%;
|
|
35
|
+
height: 1rem;
|
|
36
|
+
width: 1rem;
|
|
37
|
+
|
|
38
|
+
&:nth-child(2) {
|
|
39
|
+
animation-delay: .2s;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:nth-child(3) {
|
|
43
|
+
animation-delay: .4s;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.rootIsMini {
|
|
49
|
+
height: .8rem;
|
|
50
|
+
margin: 0;
|
|
51
|
+
width: 3.2rem;
|
|
52
|
+
|
|
53
|
+
& i {
|
|
54
|
+
height: .8rem;
|
|
55
|
+
width: .8rem;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import styles from './Loader.module.css';
|
|
6
|
+
|
|
7
|
+
interface LoaderProps {
|
|
8
|
+
isMini?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const Loader: React.FunctionComponent<LoaderProps> = ({ isMini }) => (
|
|
12
|
+
<p className={classNames(styles.root, isMini && styles.rootIsMini)}>
|
|
13
|
+
<span>Loading...</span>
|
|
14
|
+
<i />
|
|
15
|
+
<i />
|
|
16
|
+
<i />
|
|
17
|
+
</p>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
Loader.propTypes = {
|
|
21
|
+
/**
|
|
22
|
+
* If true, displays the `Loader` at a smaller size, for use in components like `AutoSuggest`
|
|
23
|
+
*/
|
|
24
|
+
isMini: PropTypes.bool,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default Loader;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
font-size: var(--fs-sml);
|
|
3
|
+
margin: auto auto 0;
|
|
4
|
+
position: relative;
|
|
5
|
+
width: 4rem;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.rootTopbar {
|
|
9
|
+
margin: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.name {
|
|
13
|
+
background-color: transparent;
|
|
14
|
+
border: .2rem var(--clr-white) solid;
|
|
15
|
+
border-radius: 50%;
|
|
16
|
+
color: var(--clr-white);
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
display: block;
|
|
19
|
+
font-family: inherit;
|
|
20
|
+
font-weight: var(--fw-bold);
|
|
21
|
+
height: 4rem;
|
|
22
|
+
padding: 0;
|
|
23
|
+
position: relative;
|
|
24
|
+
text-align: center;
|
|
25
|
+
width: 100%;
|
|
26
|
+
|
|
27
|
+
&:focus {
|
|
28
|
+
outline: none;
|
|
29
|
+
|
|
30
|
+
&::before {
|
|
31
|
+
border: .1rem var(--clr-grey500) dashed;
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
bottom: -.5rem;
|
|
34
|
+
content: '';
|
|
35
|
+
left: -.5rem;
|
|
36
|
+
position: absolute;
|
|
37
|
+
right: -.5rem;
|
|
38
|
+
top: -.5rem;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
& abbr[title] {
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import useAppContext from '@hooks/useAppContext';
|
|
5
|
+
import useLayout from '@hooks/useLayout';
|
|
6
|
+
import useClickOutside from '@hooks/useClickOutside';
|
|
7
|
+
|
|
8
|
+
import MePanel from '@core/MePanel';
|
|
9
|
+
|
|
10
|
+
import styles from './MeActions.module.css';
|
|
11
|
+
|
|
12
|
+
const getInitials = (name: string): string =>
|
|
13
|
+
name
|
|
14
|
+
.split(' ')
|
|
15
|
+
.map((item: string) => item[0])
|
|
16
|
+
.join('');
|
|
17
|
+
|
|
18
|
+
const MeActions: React.FunctionComponent = () => {
|
|
19
|
+
const { me } = useAppContext();
|
|
20
|
+
const { applyLayoutClassName } = useLayout();
|
|
21
|
+
const [isOpen, setIsOpen, node] = useClickOutside();
|
|
22
|
+
|
|
23
|
+
const toggleIsOpen = (): void => setIsOpen(!isOpen);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* This component will never render if there is no `me` (as it is never called from the `App`
|
|
27
|
+
* component). However, because `me` needs to possibly be null in the AppContext, we need to
|
|
28
|
+
* check for it here. This code is purely for typescript checking, will never be run, and
|
|
29
|
+
* can be ignored by coverage.
|
|
30
|
+
*/
|
|
31
|
+
/* istanbul ignore next */
|
|
32
|
+
if (!me) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div ref={node} className={classNames(styles.root, applyLayoutClassName(styles))}>
|
|
38
|
+
<button className={styles.name} onClick={toggleIsOpen} tabIndex={999} type="button">
|
|
39
|
+
<abbr title={me.name}>{getInitials(me.name)}</abbr>
|
|
40
|
+
</button>
|
|
41
|
+
<MePanel data={me} isOpen={isOpen} />
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default MeActions;
|