@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,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import Link from '@components/Link';
|
|
6
|
+
import useLayout from '@hooks/useLayout';
|
|
7
|
+
|
|
8
|
+
import type { NavigationObject } from '@utility/interfaces';
|
|
9
|
+
|
|
10
|
+
import styles from './NavigationItem.module.css';
|
|
11
|
+
|
|
12
|
+
interface NavigationItemProps extends NavigationObject {
|
|
13
|
+
isActive?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const NavigationItem: React.FunctionComponent<NavigationItemProps> = ({
|
|
17
|
+
isActive,
|
|
18
|
+
label,
|
|
19
|
+
to,
|
|
20
|
+
onClick,
|
|
21
|
+
}) => {
|
|
22
|
+
const { applyLayoutClassName } = useLayout();
|
|
23
|
+
const rootClass = classNames(styles.root, applyLayoutClassName(styles));
|
|
24
|
+
|
|
25
|
+
if (to) {
|
|
26
|
+
return (
|
|
27
|
+
<li className={rootClass}>
|
|
28
|
+
<Link
|
|
29
|
+
className={classNames(
|
|
30
|
+
styles.link,
|
|
31
|
+
applyLayoutClassName(styles, 'link'),
|
|
32
|
+
isActive && styles.linkIsActive
|
|
33
|
+
)}
|
|
34
|
+
onClick={onClick}
|
|
35
|
+
to={to}
|
|
36
|
+
>
|
|
37
|
+
{label}
|
|
38
|
+
</Link>
|
|
39
|
+
</li>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<li className={rootClass}>
|
|
45
|
+
<button className={styles.link} onClick={onClick} type="button">
|
|
46
|
+
{label}
|
|
47
|
+
</button>
|
|
48
|
+
</li>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
NavigationItem.propTypes = {
|
|
53
|
+
label: PropTypes.string.isRequired,
|
|
54
|
+
isActive: PropTypes.bool,
|
|
55
|
+
to: PropTypes.string,
|
|
56
|
+
onClick: PropTypes.func,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default NavigationItem;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import { filterDuplicates } from '@sqrzro/utility';
|
|
6
|
+
|
|
7
|
+
import PaginationItem from '@core/PaginationItem';
|
|
8
|
+
|
|
9
|
+
import type { PaginationObject } from '@utility/interfaces';
|
|
10
|
+
|
|
11
|
+
import styles from './Pagination.module.css';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Find an index. In many cases this is simply the active page. However, with the first and
|
|
15
|
+
* last pages, the index is moved 'in' one space (i.e. when the active page is 1, the index is
|
|
16
|
+
* 2). This ensures that the first 3 links are shown on the first page, and the last 3 on the
|
|
17
|
+
* last page.
|
|
18
|
+
*/
|
|
19
|
+
const getIndex = (activePage: number, pageCount: number): number => {
|
|
20
|
+
if (activePage === 1) {
|
|
21
|
+
return 2;
|
|
22
|
+
}
|
|
23
|
+
if (activePage === pageCount) {
|
|
24
|
+
return pageCount - 1;
|
|
25
|
+
}
|
|
26
|
+
return activePage;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Reduce the links to their final array. If it's the first value, or the previous value is the
|
|
31
|
+
* number before the current one (i.e. the current is 4 and the previous is 3), add it to the array.
|
|
32
|
+
* Otherwise (i.e. the current is 5 and the previous is 2), add a hyphen and then the value. This
|
|
33
|
+
* will then get interpreted as an ellipsis in the pagination when rendered.
|
|
34
|
+
*/
|
|
35
|
+
const reduceLinks = (
|
|
36
|
+
acc: (number | '-')[],
|
|
37
|
+
cur: number,
|
|
38
|
+
index: number,
|
|
39
|
+
arr: (number | '-')[]
|
|
40
|
+
): (number | '-')[] => {
|
|
41
|
+
if (index === 0 || arr[index - 1] === cur - 1) {
|
|
42
|
+
return [...acc, cur];
|
|
43
|
+
}
|
|
44
|
+
return [...acc, '-', cur];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The idea of the pagination is to always have the following links available:
|
|
49
|
+
* - The first page
|
|
50
|
+
* - The previous page (if applicable)
|
|
51
|
+
* - The current page
|
|
52
|
+
* - The next page (if applicable)
|
|
53
|
+
* - The last page
|
|
54
|
+
*
|
|
55
|
+
* There are situations where some of these will be the same page (i.e. on page 2, the previous page
|
|
56
|
+
* and the first page will both be page 1). When on the first page, links to the first 3 pages are
|
|
57
|
+
* displayed (rather than 2, which would be the default if the above rules are followed). The same
|
|
58
|
+
* is true with the last page
|
|
59
|
+
*/
|
|
60
|
+
const getLinks = (activePage: number, pageCount: number): (number | '-')[] => {
|
|
61
|
+
const index = getIndex(activePage, pageCount);
|
|
62
|
+
|
|
63
|
+
return filterDuplicates<number>([1, index - 1, index, index + 1, pageCount])
|
|
64
|
+
.filter((item) => item > 0 && item <= pageCount)
|
|
65
|
+
.reduce(reduceLinks, []);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
interface PaginationProps extends PaginationObject {
|
|
69
|
+
isDisabled?: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const Pagination: React.FunctionComponent<PaginationProps> = ({
|
|
73
|
+
activePage,
|
|
74
|
+
isDisabled,
|
|
75
|
+
pageCount,
|
|
76
|
+
}) => {
|
|
77
|
+
if (pageCount === 1) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<ul className={classNames(styles.root, isDisabled && styles.rootIsDisabled)}>
|
|
83
|
+
{/* eslint-disable react/no-array-index-key */}
|
|
84
|
+
{getLinks(activePage, pageCount).map((item, index) => (
|
|
85
|
+
<li key={index} className={styles.item}>
|
|
86
|
+
<PaginationItem activePage={activePage} pageNumber={item} />
|
|
87
|
+
</li>
|
|
88
|
+
))}
|
|
89
|
+
{/* eslint-enable react/no-array-index-key */}
|
|
90
|
+
</ul>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
Pagination.propTypes = {
|
|
95
|
+
activePage: PropTypes.number.isRequired,
|
|
96
|
+
pageCount: PropTypes.number.isRequired,
|
|
97
|
+
isDisabled: PropTypes.bool,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default Pagination;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.gap {
|
|
2
|
+
align-items: center;
|
|
3
|
+
color: var(--clr-grey400);
|
|
4
|
+
display: flex;
|
|
5
|
+
height: 4rem;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
letter-spacing: .3rem;
|
|
8
|
+
padding-left: .3rem;
|
|
9
|
+
width: 4rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.link {
|
|
13
|
+
align-items: center;
|
|
14
|
+
background-color: var(--clr-white);
|
|
15
|
+
border: .1rem var(--clr-grey400) solid;
|
|
16
|
+
border-radius: .2rem;
|
|
17
|
+
color: var(--clr-grey800);
|
|
18
|
+
display: flex;
|
|
19
|
+
height: 4rem;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
width: 4rem;
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
background-color: var(--clr-grey100);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.linkIsActive {
|
|
29
|
+
background-color: var(--clr-grey700);
|
|
30
|
+
border-color: var(--clr-grey700);
|
|
31
|
+
color: var(--clr-white);
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import Link from '@components/Link';
|
|
5
|
+
|
|
6
|
+
import styles from './PaginationItem.module.css';
|
|
7
|
+
|
|
8
|
+
interface PaginationItemProps {
|
|
9
|
+
activePage: number;
|
|
10
|
+
pageNumber: number | '-';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const getLinkUrl = (pageNumber: number | '-'): string => {
|
|
14
|
+
const windowLocation = `${window.location.pathname}${window.location.search}`;
|
|
15
|
+
const cleanUrl = windowLocation.replace(/(?:\?|&)page=[0-9]+/u, '');
|
|
16
|
+
const hasQuery = Boolean(/\?/u.exec(windowLocation) && !/\?page/u.exec(windowLocation));
|
|
17
|
+
|
|
18
|
+
return `${cleanUrl}${hasQuery ? '&' : '?'}page=${pageNumber}`;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const PaginationItem: React.FunctionComponent<PaginationItemProps> = ({
|
|
22
|
+
activePage,
|
|
23
|
+
pageNumber,
|
|
24
|
+
}) => {
|
|
25
|
+
if (pageNumber === '-') {
|
|
26
|
+
return (
|
|
27
|
+
<span className={styles.gap} data-testid="pagination-item-gap">
|
|
28
|
+
•••
|
|
29
|
+
</span>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Link
|
|
35
|
+
className={classNames(styles.link, activePage === pageNumber && styles.linkIsActive)}
|
|
36
|
+
data-testid="pagination-item-link"
|
|
37
|
+
to={getLinkUrl(pageNumber)}
|
|
38
|
+
>
|
|
39
|
+
{pageNumber}
|
|
40
|
+
</Link>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
PaginationItem.propTypes = {};
|
|
45
|
+
|
|
46
|
+
export default PaginationItem;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
background-color: var(--clr-white);
|
|
3
|
+
border-radius: .5rem;
|
|
4
|
+
margin-bottom: 1rem;
|
|
5
|
+
padding: 2rem clamp(1rem, 2.5vw, 2rem);
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.rootIsPadded {
|
|
10
|
+
padding: 3rem clamp(1.5rem, 3.75vw, 3rem);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.rootIsSpaced {
|
|
14
|
+
margin-bottom: 2rem;
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import styles from './Panel.module.css';
|
|
6
|
+
|
|
7
|
+
interface PanelProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
isPadded?: boolean;
|
|
10
|
+
isSpaced?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Panel: React.FunctionComponent<PanelProps> = ({ children, isPadded, isSpaced }) => (
|
|
14
|
+
<div
|
|
15
|
+
className={classNames(
|
|
16
|
+
styles.root,
|
|
17
|
+
isPadded && styles.rootIsPadded,
|
|
18
|
+
isSpaced && styles.rootIsSpaced
|
|
19
|
+
)}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
Panel.propTypes = {
|
|
26
|
+
children: PropTypes.node.isRequired,
|
|
27
|
+
isPadded: PropTypes.bool,
|
|
28
|
+
isSpaced: PropTypes.bool,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default Panel;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
@keyframes spin {
|
|
2
|
+
0% {
|
|
3
|
+
opacity: 1;
|
|
4
|
+
transform: rotate(0);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
100% {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
transform: rotate(180deg);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.root {
|
|
14
|
+
border-radius: 50%;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
padding: .2rem;
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.semi1 {
|
|
21
|
+
animation: spin 5s linear;
|
|
22
|
+
animation-fill-mode: forwards;
|
|
23
|
+
background-color: var(--clr-white);
|
|
24
|
+
height: 100%;
|
|
25
|
+
left: -50%;
|
|
26
|
+
position: absolute;
|
|
27
|
+
transform-origin: 100% 50%;
|
|
28
|
+
top: 0;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.semi2 {
|
|
33
|
+
animation: spin 5s linear;
|
|
34
|
+
animation-delay: 5s;
|
|
35
|
+
animation-fill-mode: forwards;
|
|
36
|
+
background-color: var(--clr-white);
|
|
37
|
+
height: 100%;
|
|
38
|
+
opacity: 0;
|
|
39
|
+
position: absolute;
|
|
40
|
+
right: -50%;
|
|
41
|
+
top: 0;
|
|
42
|
+
transform-origin: 0 50%;
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.mask {
|
|
47
|
+
background-color: var(--clr-grey800);
|
|
48
|
+
height: 100%;
|
|
49
|
+
left: -50%;
|
|
50
|
+
position: absolute;
|
|
51
|
+
transform-origin: 100% 50%;
|
|
52
|
+
top: 0;
|
|
53
|
+
width: 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.maskError {
|
|
57
|
+
background-color: var(--clr-error);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.maskSuccess {
|
|
61
|
+
background-color: var(--clr-success);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.icon {
|
|
65
|
+
background-color: var(--clr-grey800);
|
|
66
|
+
border-radius: 50%;
|
|
67
|
+
display: block;
|
|
68
|
+
fill: white;
|
|
69
|
+
position: relative;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.iconError {
|
|
73
|
+
background-color: var(--clr-error);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.iconSuccess {
|
|
77
|
+
background-color: var(--clr-success);
|
|
78
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import { ucwords } from '@sqrzro/utility';
|
|
6
|
+
|
|
7
|
+
import Icon from '@core/Icon';
|
|
8
|
+
|
|
9
|
+
import styles from './RadialProgress.module.css';
|
|
10
|
+
|
|
11
|
+
const DURATION_FACTOR = 2000;
|
|
12
|
+
|
|
13
|
+
interface RadialProgressProps {
|
|
14
|
+
duration: number;
|
|
15
|
+
icon: string;
|
|
16
|
+
variant?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const RadialProgress: React.FunctionComponent<RadialProgressProps> = ({
|
|
20
|
+
duration,
|
|
21
|
+
icon,
|
|
22
|
+
variant,
|
|
23
|
+
}) => {
|
|
24
|
+
const adjustedDuration = duration / DURATION_FACTOR;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className={styles.root}>
|
|
28
|
+
<div className={styles.semi1} style={{ animationDuration: `${adjustedDuration}s` }} />
|
|
29
|
+
<div
|
|
30
|
+
className={classNames(styles.mask, variant && styles[`mask${ucwords(variant)}`])}
|
|
31
|
+
/>
|
|
32
|
+
<div
|
|
33
|
+
className={styles.semi2}
|
|
34
|
+
style={{
|
|
35
|
+
animationDuration: `${adjustedDuration}s`,
|
|
36
|
+
animationDelay: `${adjustedDuration}s`,
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
<div className={classNames(styles.icon, variant && styles[`icon${ucwords(variant)}`])}>
|
|
40
|
+
<Icon icon={icon} size={30} />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
RadialProgress.propTypes = {
|
|
47
|
+
duration: PropTypes.number.isRequired,
|
|
48
|
+
icon: PropTypes.string.isRequired,
|
|
49
|
+
variant: PropTypes.string,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default RadialProgress;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
background-color: var(--clr-white);
|
|
3
|
+
border: .1rem var(--clr-grey400) solid;
|
|
4
|
+
border-radius: .3rem;
|
|
5
|
+
color: var(--clr-grey600);
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
font-family: inherit;
|
|
9
|
+
font-size: var(--fs-med);
|
|
10
|
+
height: var(--input-height);
|
|
11
|
+
justify-content: center;
|
|
12
|
+
padding: 0 1.2rem;
|
|
13
|
+
position: relative;
|
|
14
|
+
transition: border-color .2s;
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.rootIsDisabled {
|
|
19
|
+
opacity: .3;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.rootHasError {
|
|
24
|
+
border-color: var(--clr-error);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.rootIsPlaceholder {
|
|
28
|
+
color: var(--clr-grey500);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.icon {
|
|
32
|
+
align-items: center;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
fill: var(--clr-grey600);
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
height: 100%;
|
|
39
|
+
pointer-events: none;
|
|
40
|
+
position: absolute;
|
|
41
|
+
right: 0;
|
|
42
|
+
top: 0;
|
|
43
|
+
width: 4rem;
|
|
44
|
+
z-index: 2;
|
|
45
|
+
|
|
46
|
+
&::before {
|
|
47
|
+
border-left: .1rem var(--clr-grey400) solid;
|
|
48
|
+
bottom: .6rem;
|
|
49
|
+
content: '';
|
|
50
|
+
left: 0;
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: .6rem;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.iconClear {
|
|
57
|
+
pointer-events: all;
|
|
58
|
+
right: 4rem;
|
|
59
|
+
z-index: 3;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.control {
|
|
63
|
+
background-color: transparent;
|
|
64
|
+
border: .1rem transparent solid;
|
|
65
|
+
border-radius: .3rem;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
height: calc(100% + .2rem);
|
|
68
|
+
left: -.1rem;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
position: absolute;
|
|
71
|
+
top: -.1rem;
|
|
72
|
+
text-indent: -999em;
|
|
73
|
+
width: calc(100% + .2rem);
|
|
74
|
+
|
|
75
|
+
&:focus {
|
|
76
|
+
border-color: var(--clr-primary);
|
|
77
|
+
outline: none;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
|
|
5
|
+
import StaticTextInput from './index';
|
|
6
|
+
|
|
7
|
+
describe('StaticTextInput', () => {
|
|
8
|
+
it('should render', () => {
|
|
9
|
+
render(<StaticTextInput name="lorem" />);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should handle defaults', () => {
|
|
13
|
+
render(<StaticTextInput name="lorem" />);
|
|
14
|
+
|
|
15
|
+
const root = screen.getByTestId('static-text-input-root');
|
|
16
|
+
|
|
17
|
+
expect(root).toHaveClass('root rootIsPlaceholder');
|
|
18
|
+
expect(root).toHaveTextContent(/^Select...$/u);
|
|
19
|
+
expect(screen.queryByRole('img', { hidden: true })).toBeNull();
|
|
20
|
+
expect(screen.getByDisplayValue('')).toHaveAttribute('type', 'hidden');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should handle defaults (with onclick)', () => {
|
|
24
|
+
const mockFn = jest.fn();
|
|
25
|
+
render(<StaticTextInput name="lorem" onClick={mockFn} />);
|
|
26
|
+
expect(screen.getByText('Open')).not.toBeDisabled();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should not include clear if empty string', () => {
|
|
30
|
+
render(<StaticTextInput name="lorem" value={['']} isOptional />);
|
|
31
|
+
expect(screen.queryByText('Clear')).toBeNull();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should have error', () => {
|
|
35
|
+
render(<StaticTextInput name="lorem" hasError />);
|
|
36
|
+
expect(screen.getByTestId('static-text-input-root')).toHaveClass(
|
|
37
|
+
'root rootHasError rootIsPlaceholder'
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should have icon', () => {
|
|
42
|
+
render(<StaticTextInput icon="arrowLeft" name="lorem" />);
|
|
43
|
+
expect(screen.getByRole('img', { hidden: true })).toBeInTheDocument();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should be disabled', () => {
|
|
47
|
+
const mockFn = jest.fn();
|
|
48
|
+
render(<StaticTextInput icon="arrowLeft" name="lorem" onClick={mockFn} isDisabled />);
|
|
49
|
+
|
|
50
|
+
expect(screen.getByTestId('static-text-input-root')).toHaveClass(
|
|
51
|
+
'root rootIsDisabled rootIsPlaceholder'
|
|
52
|
+
);
|
|
53
|
+
expect(screen.getByText('Open')).toBeDisabled();
|
|
54
|
+
expect(screen.queryByRole('img', { hidden: true })).toBeNull();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should be open', () => {
|
|
58
|
+
const mockFn = jest.fn();
|
|
59
|
+
render(<StaticTextInput name="lorem" onClick={mockFn} isOpen />);
|
|
60
|
+
|
|
61
|
+
expect(screen.queryByText('Open')).not.toBeInTheDocument();
|
|
62
|
+
expect(screen.getByText('Close')).toBeInTheDocument();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should be optional', () => {
|
|
66
|
+
render(<StaticTextInput name="lorem" isOptional />);
|
|
67
|
+
expect(screen.queryByText('Clear')).toBeNull();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should be optional with value', () => {
|
|
71
|
+
render(<StaticTextInput name="lorem" value="lorem" isOptional />);
|
|
72
|
+
|
|
73
|
+
const button = screen.getByText('Clear');
|
|
74
|
+
expect(button).toBeInTheDocument();
|
|
75
|
+
|
|
76
|
+
userEvent.click(button);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('should be optional with onchange', () => {
|
|
80
|
+
const mockFn = jest.fn();
|
|
81
|
+
render(<StaticTextInput name="lorem" onChange={mockFn} value="lorem" isOptional />);
|
|
82
|
+
|
|
83
|
+
const button = screen.getByText('Clear');
|
|
84
|
+
expect(button).toBeInTheDocument();
|
|
85
|
+
|
|
86
|
+
expect(mockFn).toHaveBeenCalledTimes(0);
|
|
87
|
+
userEvent.click(button);
|
|
88
|
+
expect(mockFn).toHaveBeenCalledTimes(1);
|
|
89
|
+
expect(mockFn).toHaveBeenLastCalledWith({ target: { name: 'lorem', value: null } });
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should have label', () => {
|
|
93
|
+
render(<StaticTextInput label="Lorem" name="lorem" />);
|
|
94
|
+
expect(screen.getByTestId('static-text-input-root')).toHaveTextContent(/^Lorem$/u);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should have custom placeholder', () => {
|
|
98
|
+
render(<StaticTextInput name="lorem" placeholder="Lorem" />);
|
|
99
|
+
expect(screen.getByTestId('static-text-input-root')).toHaveTextContent(/^Lorem$/u);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should have value', () => {
|
|
103
|
+
render(<StaticTextInput name="lorem" value="lorem" />);
|
|
104
|
+
|
|
105
|
+
expect(screen.getByTestId('static-text-input-root')).toHaveClass('root');
|
|
106
|
+
expect(screen.getByDisplayValue('lorem')).toHaveAttribute('type', 'hidden');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should have value (array)', () => {
|
|
110
|
+
render(<StaticTextInput name="lorem" value={['lorem', 'ipsum']} />);
|
|
111
|
+
|
|
112
|
+
expect(screen.getByTestId('static-text-input-root')).toHaveClass('root');
|
|
113
|
+
expect(screen.getByDisplayValue('lorem,ipsum')).toHaveAttribute('type', 'hidden');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should have value (empty array)', () => {
|
|
117
|
+
render(<StaticTextInput name="lorem" value={[]} />);
|
|
118
|
+
|
|
119
|
+
expect(screen.getByTestId('static-text-input-root')).toHaveClass('root rootIsPlaceholder');
|
|
120
|
+
expect(screen.getByDisplayValue('')).toHaveAttribute('type', 'hidden');
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should handle onclick', () => {
|
|
124
|
+
const mockFn = jest.fn();
|
|
125
|
+
render(<StaticTextInput name="lorem" onClick={mockFn} />);
|
|
126
|
+
|
|
127
|
+
const button = screen.getByText('Open');
|
|
128
|
+
|
|
129
|
+
expect(mockFn).toHaveBeenCalledTimes(0);
|
|
130
|
+
userEvent.click(button);
|
|
131
|
+
expect(mockFn).toHaveBeenCalledTimes(1);
|
|
132
|
+
});
|
|
133
|
+
});
|