@sqrzro/admin 1.0.0-beta.7 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +5 -1
- package/.storybook/main.js +6 -34
- package/.storybook/preview-head.html +3 -0
- package/.storybook/preview.js +1 -11
- package/LICENSE +1 -1
- package/dist/components/Alert/index.d.ts +26 -0
- package/dist/components/Alert/index.js +54 -0
- package/dist/components/Allow/index.d.ts +20 -0
- package/dist/components/Allow/index.js +29 -0
- package/dist/components/AppLayout/AppLayout.stories.d.ts +5 -0
- package/dist/components/AppLayout/AppLayout.stories.js +11 -0
- package/dist/components/AppLayout/index.d.ts +6 -0
- package/dist/components/AppLayout/index.js +11 -0
- package/dist/{types/components → components}/AutoSuggest/index.d.ts +16 -2
- package/dist/components/AutoSuggest/index.js +143 -0
- package/dist/components/Button/Button.stories.d.ts +11 -0
- package/{src/components/Button/Button.story.tsx → dist/components/Button/Button.stories.js} +41 -39
- package/dist/{types/components → components}/Button/index.d.ts +15 -1
- package/dist/components/Button/index.js +50 -0
- package/dist/components/CalendarInput/index.d.ts +24 -0
- package/dist/components/CalendarInput/index.js +56 -0
- package/dist/{types/components → components}/CheckboxList/index.d.ts +4 -4
- package/dist/components/CheckboxList/index.js +25 -0
- package/dist/components/CodeInput/index.d.ts +9 -0
- package/dist/components/CodeInput/index.js +57 -0
- package/dist/{types/components → components}/ConnectedDropdown/index.d.ts +4 -4
- package/dist/components/ConnectedDropdown/index.js +36 -0
- package/dist/{types/components → components}/ConnectedList/index.d.ts +1 -1
- package/dist/components/ConnectedList/index.js +7 -0
- package/dist/{types/components → components}/ConnectedTable/index.d.ts +1 -1
- package/dist/components/ConnectedTable/index.js +7 -0
- package/dist/{types/components → components}/ContentBlock/index.d.ts +5 -5
- package/dist/components/ContentBlock/index.js +13 -0
- package/dist/components/DataPanel/index.d.ts +8 -0
- package/dist/components/DataPanel/index.js +8 -0
- package/dist/components/DateInput/index.d.ts +18 -0
- package/dist/components/DateInput/index.js +81 -0
- package/dist/{types/components → components}/Dropdown/index.d.ts +8 -8
- package/dist/components/Dropdown/index.js +122 -0
- package/dist/components/ErrorMessage/index.d.ts +16 -0
- package/dist/components/ErrorMessage/index.js +17 -0
- package/dist/components/Fieldset/index.d.ts +18 -0
- package/dist/components/Fieldset/index.js +19 -0
- package/dist/{types/components → components}/FileInput/index.d.ts +4 -4
- package/dist/components/FileInput/index.js +26 -0
- package/dist/components/FilterLink/index.d.ts +14 -0
- package/dist/components/FilterLink/index.js +15 -0
- package/dist/components/Form/index.d.ts +14 -0
- package/dist/components/Form/index.js +15 -0
- package/dist/components/FormActions/index.d.ts +18 -0
- package/dist/components/FormActions/index.js +14 -0
- package/dist/components/FormField/index.d.ts +14 -0
- package/dist/components/FormField/index.js +40 -0
- package/dist/components/FormRepeater/index.d.ts +18 -0
- package/dist/components/FormRepeater/index.js +65 -0
- package/dist/{types/components → components}/ImageInput/index.d.ts +4 -4
- package/dist/components/ImageInput/index.js +45 -0
- package/dist/components/InfoPanel/index.d.ts +14 -0
- package/dist/components/InfoPanel/index.js +11 -0
- package/dist/{types/components → components}/Link/__mocks__/index.d.ts +1 -1
- package/dist/components/Link/__mocks__/index.js +12 -0
- package/dist/components/Link/index.d.ts +23 -0
- package/dist/components/Link/index.js +21 -0
- package/dist/{types/components → components}/List/index.d.ts +5 -5
- package/dist/components/List/index.js +46 -0
- package/dist/components/ListActions/index.d.ts +18 -0
- package/dist/components/ListActions/index.js +14 -0
- package/dist/components/LoginForm/index.d.ts +3 -0
- package/dist/components/LoginForm/index.js +47 -0
- package/dist/components/Message/index.d.ts +14 -0
- package/dist/components/Message/index.js +14 -0
- package/dist/{types/components → components}/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.js +18 -0
- package/dist/components/ModalActions/index.d.ts +21 -0
- package/dist/components/ModalActions/index.js +18 -0
- package/dist/{types/components → components}/MoneyInput/index.d.ts +1 -1
- package/dist/components/MoneyInput/index.js +13 -0
- package/dist/components/PasswordForm/index.d.ts +35 -0
- package/dist/components/PasswordForm/index.js +21 -0
- package/dist/{types/components → components}/PasswordInput/index.d.ts +1 -1
- package/dist/components/PasswordInput/index.js +12 -0
- package/dist/{types/components → components}/RadioList/index.d.ts +1 -1
- package/dist/components/RadioList/index.js +7 -0
- package/dist/components/RootLayout/index.d.ts +8 -0
- package/dist/components/RootLayout/index.js +21 -0
- package/dist/components/SummaryList/index.d.ts +18 -0
- package/dist/components/SummaryList/index.js +15 -0
- package/dist/components/Switch/index.d.ts +21 -0
- package/dist/components/Switch/index.js +31 -0
- package/dist/{types/components → components}/Table/index.d.ts +6 -6
- package/dist/components/Table/index.js +55 -0
- package/dist/components/Tag/index.d.ts +15 -0
- package/dist/components/Tag/index.js +13 -0
- package/dist/components/TextArea/index.d.ts +18 -0
- package/dist/components/TextArea/index.js +26 -0
- package/dist/components/TextInput/index.d.ts +14 -0
- package/dist/components/TextInput/index.js +27 -0
- package/dist/{types/components → components}/WebsiteInput/index.d.ts +1 -1
- package/dist/components/WebsiteInput/index.js +13 -0
- package/dist/components/WeekCalendar/index.d.ts +24 -0
- package/dist/components/WeekCalendar/index.js +48 -0
- package/dist/{types/core → core}/AlertComponent/index.d.ts +7 -7
- package/dist/core/AlertComponent/index.js +45 -0
- package/dist/{types/core → core}/AppHeader/index.d.ts +1 -1
- package/dist/core/AppHeader/index.js +17 -0
- package/dist/core/AppLogo/index.d.ts +12 -0
- package/dist/core/AppLogo/index.js +17 -0
- package/dist/{types/core → core}/AppLogoImage/index.d.ts +1 -1
- package/dist/core/AppLogoImage/index.js +11 -0
- package/dist/{types/core → core}/AppLogoPlaceholder/index.d.ts +1 -1
- package/dist/core/AppLogoPlaceholder/index.js +10 -0
- package/dist/core/Assistive/index.d.ts +12 -0
- package/dist/core/Assistive/index.js +9 -0
- package/dist/core/AuthForm/index.d.ts +10 -0
- package/dist/core/AuthForm/index.js +26 -0
- package/dist/{types/core → core}/Banner/index.d.ts +1 -1
- package/dist/core/Banner/index.js +14 -0
- package/dist/core/Calendar/index.d.ts +21 -0
- package/dist/core/Calendar/index.js +69 -0
- package/dist/core/CalendarDay/index.d.ts +30 -0
- package/dist/core/CalendarDay/index.js +30 -0
- package/dist/core/CalendarMonth/index.d.ts +23 -0
- package/dist/core/CalendarMonth/index.js +45 -0
- package/dist/core/CalendarNavigation/index.d.ts +17 -0
- package/dist/core/CalendarNavigation/index.js +24 -0
- package/dist/core/CalendarWeek/index.d.ts +28 -0
- package/dist/core/CalendarWeek/index.js +46 -0
- package/dist/core/ChkRad/index.d.ts +26 -0
- package/dist/core/ChkRad/index.js +33 -0
- package/dist/core/ChkRadIcon/index.d.ts +14 -0
- package/dist/core/ChkRadIcon/index.js +12 -0
- package/dist/{types/core → core}/ChkRadList/index.d.ts +8 -8
- package/dist/core/ChkRadList/index.js +37 -0
- package/dist/core/CloseButton/index.d.ts +17 -0
- package/dist/core/CloseButton/index.js +12 -0
- package/dist/{types/core → core}/ConfirmModal/index.d.ts +1 -1
- package/dist/core/ConfirmModal/index.js +38 -0
- package/dist/{types/core → core}/ConnectedRepeater/index.d.ts +11 -11
- package/dist/core/ConnectedRepeater/index.js +154 -0
- package/dist/{types/core → core}/ConnectedRepeaterComponent/index.d.ts +1 -1
- package/dist/core/ConnectedRepeaterComponent/index.js +25 -0
- package/dist/core/Container/index.d.ts +14 -0
- package/dist/core/Container/index.js +12 -0
- package/dist/core/DataPanelItem/index.d.ts +8 -0
- package/dist/core/DataPanelItem/index.js +7 -0
- package/dist/core/DropdownPanel/index.d.ts +31 -0
- package/dist/core/DropdownPanel/index.js +32 -0
- package/dist/{types/core → core}/EmptyMessage/index.d.ts +8 -1
- package/dist/core/EmptyMessage/index.js +21 -0
- package/dist/core/FilterItem/index.d.ts +25 -0
- package/dist/core/FilterItem/index.js +84 -0
- package/dist/core/Filters/index.d.ts +31 -0
- package/dist/core/Filters/index.js +85 -0
- package/dist/{types/core → core}/FixedActions/index.d.ts +4 -4
- package/dist/core/FixedActions/index.js +22 -0
- package/dist/core/FormError/index.d.ts +12 -0
- package/dist/core/FormError/index.js +9 -0
- package/dist/core/FormLabel/index.d.ts +16 -0
- package/dist/core/FormLabel/index.js +13 -0
- package/dist/core/FormLegend/index.d.ts +12 -0
- package/dist/core/FormLegend/index.js +9 -0
- package/dist/core/Header/Header.stories.d.ts +5 -0
- package/dist/core/Header/Header.stories.js +11 -0
- package/dist/core/Header/index.d.ts +14 -0
- package/dist/core/Header/index.js +12 -0
- package/dist/core/Icon/index.d.ts +14 -0
- package/dist/core/Icon/index.js +32 -0
- package/dist/core/IconButton/index.d.ts +22 -0
- package/dist/core/IconButton/index.js +20 -0
- package/dist/core/InputPanel/index.d.ts +16 -0
- package/dist/core/InputPanel/index.js +11 -0
- package/dist/{types/core → core}/ListItem/index.d.ts +10 -9
- package/dist/core/ListItem/index.js +44 -0
- package/dist/core/ListItemAction/index.d.ts +11 -0
- package/dist/core/ListItemAction/index.js +13 -0
- package/dist/{types/core → core}/ListItemActions/index.d.ts +1 -1
- package/dist/core/ListItemActions/index.js +16 -0
- package/dist/core/ListItemMetaItem/index.d.ts +19 -0
- package/dist/core/ListItemMetaItem/index.js +29 -0
- package/dist/core/ListItemTitle/index.d.ts +19 -0
- package/dist/core/ListItemTitle/index.js +44 -0
- package/dist/core/Loader/index.d.ts +15 -0
- package/dist/core/Loader/index.js +16 -0
- package/dist/core/MeActions/index.d.ts +3 -0
- package/dist/core/MeActions/index.js +48 -0
- package/dist/{types/core → core}/MePanel/index.d.ts +6 -6
- package/dist/core/MePanel/index.js +29 -0
- package/dist/core/ModalComponent/index.d.ts +22 -0
- package/dist/core/ModalComponent/index.js +29 -0
- package/dist/{types/core → core}/Navigation/index.d.ts +1 -1
- package/dist/core/Navigation/index.js +33 -0
- package/dist/{types/core → core}/NavigationDivider/index.d.ts +1 -1
- package/dist/core/NavigationDivider/index.js +8 -0
- package/dist/core/NavigationItem/index.d.ts +16 -0
- package/dist/core/NavigationItem/index.js +21 -0
- package/dist/core/Pagination/index.d.ts +15 -0
- package/{src/core/Pagination/index.tsx → dist/core/Pagination/index.js} +64 -100
- package/dist/core/PaginationItem/index.d.ts +10 -0
- package/dist/core/PaginationItem/index.js +17 -0
- package/dist/core/Panel/index.d.ts +17 -0
- package/dist/core/Panel/index.js +16 -0
- package/dist/{types/core → core}/PasswordForgotForm/index.d.ts +1 -1
- package/dist/core/PasswordForgotForm/index.js +40 -0
- package/dist/{types/core → core}/PasswordResetForm/index.d.ts +1 -1
- package/dist/core/PasswordResetForm/index.js +34 -0
- package/dist/core/RadialProgress/index.d.ts +16 -0
- package/dist/core/RadialProgress/index.js +23 -0
- package/dist/core/SettingsForm/index.d.ts +3 -0
- package/dist/core/SettingsForm/index.js +14 -0
- package/dist/core/StaticTextInput/index.d.ts +29 -0
- package/dist/core/StaticTextInput/index.js +39 -0
- package/{src/core/Styled/index.tsx → dist/core/Styled/index.js} +39 -62
- package/dist/core/SummaryListItem/index.d.ts +23 -0
- package/dist/core/SummaryListItem/index.js +31 -0
- package/dist/core/TabItem/index.d.ts +4 -0
- package/dist/core/TabItem/index.js +13 -0
- package/dist/{types/core → core}/TableActionsCell/index.d.ts +1 -1
- package/dist/core/TableActionsCell/index.js +8 -0
- package/dist/core/TableCell/index.d.ts +15 -0
- package/dist/core/TableCell/index.js +20 -0
- package/dist/core/TableHead/index.d.ts +18 -0
- package/dist/core/TableHead/index.js +18 -0
- package/dist/{types/core → core}/TableRow/index.d.ts +1 -1
- package/dist/core/TableRow/index.js +18 -0
- package/dist/core/Tabs/index.d.ts +7 -0
- package/dist/core/Tabs/index.js +13 -0
- package/dist/core/TextInputAncillary/index.d.ts +29 -0
- package/dist/core/TextInputAncillary/index.js +31 -0
- package/dist/{types/core → core}/Toast/index.d.ts +1 -1
- package/dist/core/Toast/index.js +47 -0
- package/dist/core/TwoFactor/index.d.ts +13 -0
- package/dist/core/TwoFactor/index.js +49 -0
- package/dist/core/TwoFactorAuthenticator/index.d.ts +10 -0
- package/dist/core/TwoFactorAuthenticator/index.js +9 -0
- package/dist/core/TwoFactorMethodList/index.d.ts +10 -0
- package/dist/core/TwoFactorMethodList/index.js +22 -0
- package/dist/core/TwoFactorSetup/index.d.ts +12 -0
- package/dist/core/TwoFactorSetup/index.js +43 -0
- package/dist/core/TwoFactorSetupAuthenticator/index.d.ts +20 -0
- package/dist/core/TwoFactorSetupAuthenticator/index.js +42 -0
- package/dist/core/TwoFactorSetupYubikey/index.d.ts +16 -0
- package/dist/core/TwoFactorSetupYubikey/index.js +14 -0
- package/dist/core/TwoFactorYubikey/index.d.ts +9 -0
- package/dist/core/TwoFactorYubikey/index.js +14 -0
- package/dist/core/WeekCalendarDay/index.d.ts +27 -0
- package/dist/core/WeekCalendarDay/index.js +35 -0
- package/dist/core/YubikeyInput/index.d.ts +4 -0
- package/dist/core/YubikeyInput/index.js +39 -0
- package/dist/filters/BooleanFilter/index.d.ts +14 -0
- package/dist/filters/BooleanFilter/index.js +35 -0
- package/dist/filters/DateFilter/index.d.ts +5 -0
- package/dist/filters/DateFilter/index.js +24 -0
- package/dist/filters/DropdownFilter/index.d.ts +17 -0
- package/dist/filters/DropdownFilter/index.js +32 -0
- package/dist/filters/QuickDateFilter/index.d.ts +13 -0
- package/dist/filters/QuickDateFilter/index.js +40 -0
- package/dist/filters/interfaces.js +1 -0
- package/dist/{types/hooks → hooks}/useAlert.d.ts +1 -1
- package/dist/hooks/useAlert.js +18 -0
- package/dist/hooks/useConfig.d.ts +9 -0
- package/dist/hooks/useConfig.js +13 -0
- package/dist/{types/hooks → hooks}/useConnectedList.d.ts +1 -1
- package/dist/hooks/useConnectedList.js +6 -0
- package/dist/{types/hooks → hooks}/useConnectedRepeater.d.ts +1 -1
- package/dist/hooks/useConnectedRepeater.js +14 -0
- package/dist/{types/hooks → hooks}/useConnectedTable.d.ts +1 -1
- package/dist/hooks/useConnectedTable.js +6 -0
- package/dist/hooks/useFilters.d.ts +9 -0
- package/dist/hooks/useFilters.js +24 -0
- package/dist/{types/hooks → hooks}/useLayout.d.ts +2 -2
- package/dist/hooks/useLayout.js +10 -0
- package/dist/hooks/useLayout.spec.d.ts +1 -0
- package/dist/hooks/useLayout.spec.js +24 -0
- package/dist/{types/hooks → hooks}/useModal.d.ts +1 -1
- package/dist/hooks/useModal.js +39 -0
- package/dist/hooks/useModalOffset.d.ts +2 -0
- package/dist/hooks/useModalOffset.js +16 -0
- package/dist/hooks/useModalOffset.spec.d.ts +1 -0
- package/dist/hooks/useModalOffset.spec.js +19 -0
- package/dist/hooks/useNavigation.d.ts +7 -0
- package/dist/hooks/useNavigation.js +113 -0
- package/dist/hooks/useRemote.d.ts +7 -0
- package/dist/hooks/useRemote.js +29 -0
- package/dist/hooks/useVariant.d.ts +9 -0
- package/dist/hooks/useVariant.js +14 -0
- package/dist/{types/index.d.ts → index.d.ts} +29 -24
- package/dist/index.js +212 -5459
- package/dist/{types/scenes → scenes}/Error404Scene.d.ts +1 -1
- package/dist/scenes/Error404Scene.js +5 -0
- package/dist/services/AppService.d.ts +5 -0
- package/dist/services/AppService.js +11 -0
- package/dist/services/ConfigService.d.ts +42 -0
- package/dist/services/ConfigService.js +55 -0
- package/dist/services/ConfirmService.js +10 -0
- package/dist/services/DateService.d.ts +26 -0
- package/dist/services/DateService.js +132 -0
- package/dist/services/DateService.spec.d.ts +1 -0
- package/dist/services/DateService.spec.js +83 -0
- package/dist/services/DownloadService.d.ts +7 -0
- package/dist/services/DownloadService.js +16 -0
- package/dist/services/DownloadService.spec.d.ts +1 -0
- package/dist/services/DownloadService.spec.js +18 -0
- package/dist/services/FilterComponentService.js +54 -0
- package/dist/services/FilterService.d.ts +34 -0
- package/dist/services/FilterService.js +58 -0
- package/dist/services/FilterService.spec.d.ts +1 -0
- package/dist/services/FilterService.spec.js +67 -0
- package/dist/services/FormatService.d.ts +11 -0
- package/dist/services/FormatService.js +45 -0
- package/dist/services/FormatService.spec.d.ts +1 -0
- package/dist/services/FormatService.spec.js +66 -0
- package/dist/services/ToastService.d.ts +7 -0
- package/dist/services/ToastService.js +17 -0
- package/dist/services/ToastService.spec.d.ts +1 -0
- package/dist/services/ToastService.spec.js +34 -0
- package/dist/styles.css +926 -0
- package/dist/utility/MockRouter/index.d.ts +2 -0
- package/dist/utility/MockRouter/index.js +37 -0
- package/dist/utility/StorybookPanel/index.d.ts +14 -0
- package/dist/utility/StorybookPanel/index.js +12 -0
- package/dist/utility/TestChangeHandler/index.d.ts +15 -0
- package/dist/utility/TestChangeHandler/index.js +30 -0
- package/dist/utility/icons.d.ts +3 -0
- package/dist/utility/icons.js +12 -0
- package/dist/utility/interfaces.d.ts +80 -0
- package/dist/utility/interfaces.js +18 -0
- package/dist/utility/middleware.d.ts +4 -0
- package/dist/utility/middleware.js +4 -0
- package/dist/{types/utility → utility}/prop-types.d.ts +17 -15
- package/dist/utility/prop-types.js +77 -0
- package/dist/utility/register.d.ts +3 -0
- package/dist/utility/register.js +7 -0
- package/package.json +53 -88
- package/postcss.config.js +1 -1
- package/prettier.config.js +1 -0
- package/src/components/Alert/index.tsx +103 -13
- package/src/components/Allow/Allow.spec.tsx +2 -2
- package/src/components/Allow/index.tsx +8 -8
- package/src/components/AppLayout/AppLayout.stories.tsx +20 -0
- package/src/components/AppLayout/index.tsx +22 -0
- package/src/components/AutoSuggest/AutoSuggest.spec.tsx +38 -18
- package/src/components/AutoSuggest/AutoSuggest.story.tsx +8 -6
- package/src/components/AutoSuggest/index.tsx +30 -30
- package/src/components/Button/Button.spec.tsx +8 -0
- package/src/components/Button/Button.stories.tsx +62 -0
- package/src/components/Button/index.tsx +9 -93
- package/src/components/CalendarInput/CalendarInput.spec.tsx +38 -22
- package/src/components/CalendarInput/CalendarInput.story.tsx +2 -2
- package/src/components/CalendarInput/index.tsx +23 -19
- package/src/components/CheckboxList/CheckboxList.spec.tsx +20 -10
- package/src/components/CheckboxList/index.tsx +9 -12
- package/src/components/ConnectedDropdown/index.tsx +7 -5
- package/src/components/ConnectedList/index.tsx +13 -11
- package/src/components/ConnectedTable/index.tsx +15 -13
- package/src/components/ContentBlock/index.tsx +10 -8
- package/src/components/DataPanel/index.tsx +25 -0
- package/src/components/DateInput/DateInput.spec.tsx +10 -6
- package/src/components/DateInput/index.tsx +11 -12
- package/src/components/ErrorMessage/index.tsx +18 -20
- package/src/components/Fieldset/Fieldset.story.tsx +17 -13
- package/src/components/Fieldset/index.tsx +12 -10
- package/src/components/FileInput/FileInput.spec.tsx +9 -5
- package/src/components/FileInput/FileInput.story.tsx +3 -1
- package/src/components/FileInput/index.tsx +12 -10
- package/src/components/FilterLink/FilterLink.spec.tsx +18 -4
- package/src/components/FilterLink/index.tsx +19 -14
- package/src/components/Form/Form.spec.tsx +7 -5
- package/src/components/Form/index.tsx +5 -3
- package/src/components/FormActions/FormActions.story.tsx +19 -15
- package/src/components/FormActions/index.tsx +11 -7
- package/src/components/FormField/FormField.spec.tsx +28 -39
- package/src/components/FormField/FormField.stories.tsx +44 -0
- package/src/components/FormField/index.tsx +8 -103
- package/src/components/FormRepeater/FormRepeater.spec.tsx +26 -14
- package/src/components/FormRepeater/index.tsx +9 -7
- package/src/components/ImageInput/ImageInput.spec.tsx +3 -1
- package/src/components/ImageInput/ImageInput.story.tsx +3 -1
- package/src/components/ImageInput/index.tsx +16 -14
- package/src/components/InfoPanel/index.tsx +7 -7
- package/src/components/Link/Link.spec.tsx +4 -2
- package/src/components/Link/__mocks__/index.tsx +3 -3
- package/src/components/Link/index.tsx +6 -6
- package/src/components/List/List.spec.tsx +57 -20
- package/src/components/List/List.story.tsx +21 -2
- package/src/components/List/index.tsx +13 -13
- package/src/components/ListActions/ListActions.story.tsx +3 -1
- package/src/components/ListActions/index.tsx +10 -11
- package/src/components/LoginForm/LoginForm.spec.tsx +19 -7
- package/src/components/LoginForm/LoginForm.story.tsx +25 -0
- package/src/components/LoginForm/index.tsx +71 -170
- package/src/components/Message/index.tsx +12 -10
- package/src/components/Modal/index.tsx +18 -12
- package/src/components/ModalActions/ModalActions.spec.tsx +4 -2
- package/src/components/ModalActions/ModalActions.story.tsx +3 -1
- package/src/components/ModalActions/index.tsx +22 -18
- package/src/components/MoneyInput/MoneyInput.story.tsx +3 -1
- package/src/components/MoneyInput/index.tsx +7 -5
- package/src/components/PasswordForm/index.tsx +12 -24
- package/src/components/RadioList/RadioList.spec.tsx +4 -2
- package/src/components/RadioList/index.tsx +8 -6
- package/src/components/RootLayout/index.tsx +45 -0
- package/src/components/SummaryList/SummaryList.module.css +19 -4
- package/src/components/SummaryList/SummaryList.spec.tsx +14 -2
- package/src/components/SummaryList/SummaryList.story.tsx +3 -1
- package/src/components/SummaryList/index.tsx +16 -14
- package/src/components/Switch/Switch.spec.tsx +8 -4
- package/src/components/Switch/index.tsx +16 -14
- package/src/components/Table/Table.spec.tsx +11 -7
- package/src/components/Table/Table.story.tsx +3 -3
- package/src/components/Table/index.tsx +20 -22
- package/src/components/TextArea/TextArea.spec.tsx +12 -6
- package/src/components/TextArea/index.tsx +10 -8
- package/src/components/TextInput/TextInput.module.css +1 -0
- package/src/components/TextInput/TextInput.spec.tsx +12 -6
- package/src/components/TextInput/TextInput.stories.tsx +46 -0
- package/src/components/TextInput/index.tsx +6 -99
- package/src/components/WebsiteInput/index.tsx +7 -5
- package/src/components/WeekCalendar/index.tsx +8 -8
- package/src/core/AlertComponent/AlertComponent.spec.tsx +17 -4
- package/src/core/AlertComponent/AlertComponent.story.tsx +19 -15
- package/src/core/AlertComponent/index.tsx +30 -25
- package/src/core/AppHeader/index.tsx +5 -3
- package/src/core/AppLogo/index.tsx +9 -7
- package/src/core/AppLogoImage/index.tsx +6 -6
- package/src/core/AppLogoPlaceholder/index.tsx +28 -22
- package/src/core/Assistive/index.tsx +1 -18
- package/src/{components/LoginForm/LoginForm.module.css → core/AuthForm/AuthForm.module.css} +4 -0
- package/src/core/AuthForm/AuthForm.spec.tsx +72 -0
- package/src/core/AuthForm/index.tsx +63 -0
- package/src/core/Banner/index.tsx +11 -11
- package/src/core/Calendar/index.tsx +9 -7
- package/src/core/CalendarDay/index.tsx +12 -12
- package/src/core/CalendarMonth/index.tsx +14 -12
- package/src/core/CalendarNavigation/index.tsx +14 -14
- package/src/core/CalendarWeek/index.tsx +21 -19
- package/src/core/ChkRadList/index.tsx +25 -23
- package/src/core/CloseButton/CloseButton.spec.tsx +4 -2
- package/src/core/CloseButton/index.tsx +10 -8
- package/src/core/ConfirmModal/ConfirmModal.spec.tsx +10 -4
- package/src/core/ConfirmModal/index.tsx +9 -7
- package/src/core/ConnectedRepeater/index.tsx +46 -19
- package/src/core/ConnectedRepeaterComponent/index.tsx +13 -9
- package/src/core/Container/index.tsx +6 -12
- package/src/core/DataPanelItem/index.tsx +19 -0
- package/src/core/EmptyMessage/EmptyMessage.stories.tsx +33 -0
- package/src/core/EmptyMessage/index.tsx +9 -42
- package/src/core/FilterItem/index.tsx +41 -33
- package/src/core/Filters/Filters.spec.tsx +103 -69
- package/src/core/Filters/index.tsx +39 -31
- package/src/core/FixedActions/FixedActions.module.css +6 -0
- package/src/core/FixedActions/FixedActions.spec.tsx +8 -3
- package/src/core/FixedActions/index.tsx +9 -9
- package/src/core/FormLegend/index.tsx +4 -4
- package/src/core/Header/Header.stories.tsx +20 -0
- package/src/core/Header/index.tsx +8 -13
- package/src/core/Icon/Icon.spec.tsx +1 -3
- package/src/core/Icon/index.tsx +14 -10
- package/src/core/IconButton/index.tsx +18 -20
- package/src/core/ListItem/ListItem.story.tsx +23 -19
- package/src/core/ListItem/index.tsx +46 -37
- package/src/core/ListItemAction/index.tsx +7 -14
- package/src/core/ListItemActions/index.tsx +13 -12
- package/src/core/ListItemMetaItem/index.tsx +8 -8
- package/src/core/ListItemTitle/ListItemTitle.module.css +9 -1
- package/src/core/ListItemTitle/ListItemTitle.spec.tsx +24 -2
- package/src/core/ListItemTitle/index.tsx +20 -10
- package/src/core/Loader/Loader.module.css +3 -3
- package/src/core/Loader/Loader.stories.tsx +22 -0
- package/src/core/Loader/index.tsx +2 -27
- package/src/core/MeActions/index.tsx +28 -18
- package/src/core/MePanel/index.tsx +10 -10
- package/src/core/ModalComponent/ModalComponent.spec.tsx +8 -4
- package/src/core/ModalComponent/index.tsx +13 -13
- package/src/core/Navigation/Navigation.spec.tsx +47 -36
- package/src/core/Navigation/index.tsx +18 -58
- package/src/core/NavigationDivider/index.tsx +6 -6
- package/src/core/NavigationItem/index.tsx +12 -21
- package/src/core/Panel/Panel.module.css +11 -0
- package/src/core/Panel/Panel.spec.tsx +16 -0
- package/src/core/Panel/index.tsx +17 -13
- package/src/core/PasswordForgotForm/index.tsx +15 -12
- package/src/core/PasswordResetForm/index.tsx +15 -12
- package/src/core/RadialProgress/index.tsx +11 -14
- package/src/core/SettingsForm/index.tsx +9 -8
- package/src/core/SummaryListItem/SummaryListItem.module.css +3 -11
- package/src/core/SummaryListItem/index.tsx +19 -14
- package/src/core/TabItem/TabItem.module.css +28 -0
- package/src/core/TabItem/index.tsx +42 -0
- package/src/core/Tabs/Tabs.module.css +0 -24
- package/src/core/Tabs/Tabs.spec.tsx +30 -0
- package/src/core/Tabs/index.tsx +18 -76
- package/src/core/Toast/Toast.spec.tsx +4 -2
- package/src/core/Toast/index.tsx +16 -18
- package/src/core/TwoFactor/TwoFactor.spec.tsx +183 -0
- package/src/core/TwoFactor/index.tsx +102 -0
- package/src/core/TwoFactorAuthenticator/index.tsx +39 -0
- package/src/core/{LoginFormTwoFactor/LoginFormTwoFactor.module.css → TwoFactorMethodList/TwoFactorMethodList.module.css} +1 -1
- package/src/core/TwoFactorMethodList/index.tsx +49 -0
- package/src/core/TwoFactorSetup/index.tsx +91 -0
- package/src/core/TwoFactorSetupAuthenticator/TwoFactorSetupAuthenticator.module.css +6 -0
- package/src/core/TwoFactorSetupAuthenticator/index.tsx +100 -0
- package/src/core/TwoFactorSetupYubikey/index.tsx +49 -0
- package/src/core/TwoFactorYubikey/index.tsx +41 -0
- package/src/core/WeekCalendarDay/index.tsx +7 -7
- package/src/core/{LoginFormYubikey/LoginFormYubikey.module.css → YubikeyInput/YubikeyInput.module.css} +5 -0
- package/src/core/YubikeyInput/YubikeyInput.spec.tsx +77 -0
- package/src/core/YubikeyInput/index.tsx +76 -0
- package/src/filters/BooleanFilter/index.tsx +13 -12
- package/src/filters/DateFilter/index.tsx +8 -8
- package/src/filters/DropdownFilter/index.tsx +19 -17
- package/src/filters/QuickDateFilter/index.tsx +12 -12
- package/src/filters/interfaces.ts +2 -2
- package/src/hooks/useAlert.spec.tsx +72 -0
- package/src/hooks/useAlert.ts +7 -5
- package/src/hooks/useConfig.ts +31 -0
- package/src/hooks/useConnectedList.ts +4 -4
- package/src/hooks/useConnectedRepeater.ts +8 -6
- package/src/hooks/useConnectedTable.ts +4 -4
- package/src/hooks/useFilters.ts +21 -13
- package/src/hooks/useLayout.spec.ts +3 -11
- package/src/hooks/useLayout.ts +8 -7
- package/src/hooks/useModal.spec.tsx +23 -15
- package/src/hooks/useModal.ts +17 -17
- package/src/hooks/useModalOffset.ts +4 -2
- package/src/hooks/useNavigation.ts +160 -0
- package/src/hooks/useRemote.ts +43 -0
- package/src/index.ts +31 -26
- package/src/scenes/Error404Scene.tsx +3 -1
- package/src/services/AppService.ts +16 -0
- package/src/services/ConfigService.ts +93 -0
- package/src/services/ConfirmService.ts +7 -2
- package/src/services/DateService.ts +48 -32
- package/src/services/DownloadService.spec.ts +4 -10
- package/src/services/DownloadService.ts +16 -9
- package/src/services/FilterComponentService.tsx +9 -5
- package/src/services/FilterService.spec.ts +57 -39
- package/src/services/FilterService.ts +62 -40
- package/src/services/FormatService.spec.ts +2 -0
- package/src/services/FormatService.ts +13 -8
- package/src/services/ToastService.ts +9 -4
- package/src/styles/tailwind.css +57 -0
- package/src/typings.d.ts +2 -2
- package/src/utility/MockRouter/index.ts +1 -0
- package/src/utility/icons.tsx +46 -30
- package/src/utility/interfaces.ts +39 -21
- package/src/utility/middleware.ts +10 -0
- package/src/utility/prop-types.ts +6 -2
- package/src/utility/register.tsx +11 -0
- package/tailwind.config.js +11 -0
- package/tsconfig.eslint.json +4 -0
- package/tsconfig.json +7 -15
- package/.gitattributes +0 -1
- package/.github/workflows/development.yml +0 -47
- package/.prettierrc +0 -9
- package/.storybook/manager.js +0 -4
- package/.storybook/postcss.config.js +0 -3
- package/.storybook/theme.js +0 -7
- package/.stylelintrc +0 -9
- package/__mocks__/@sqrzro/utility.ts +0 -43
- package/assets/logo-horizontal-dark.svg +0 -21
- package/assets/logo-horizontal-white.svg +0 -21
- package/assets/logo-vertical-dark.svg +0 -21
- package/assets/logo-vertical-white.svg +0 -21
- package/dist/index.css +0 -3812
- package/dist/index.js.map +0 -1
- package/dist/types/components/Alert/index.d.ts +0 -4
- package/dist/types/components/Allow/index.d.ts +0 -13
- package/dist/types/components/App/index.d.ts +0 -18
- package/dist/types/components/CalendarInput/index.d.ts +0 -10
- package/dist/types/components/CodeInput/index.d.ts +0 -9
- package/dist/types/components/ConnectedListScene/index.d.ts +0 -7
- package/dist/types/components/ConnectedScene/index.d.ts +0 -11
- package/dist/types/components/DateInput/index.d.ts +0 -7
- package/dist/types/components/Document/index.d.ts +0 -3
- package/dist/types/components/ErrorMessage/index.d.ts +0 -8
- package/dist/types/components/Fieldset/index.d.ts +0 -11
- package/dist/types/components/FilterLink/index.d.ts +0 -7
- package/dist/types/components/Form/index.d.ts +0 -14
- package/dist/types/components/FormActions/index.d.ts +0 -9
- package/dist/types/components/FormField/index.d.ts +0 -14
- package/dist/types/components/FormRepeater/index.d.ts +0 -9
- package/dist/types/components/InfoPanel/index.d.ts +0 -8
- package/dist/types/components/Link/index.d.ts +0 -13
- package/dist/types/components/ListActions/index.d.ts +0 -9
- package/dist/types/components/LoginForm/index.d.ts +0 -3
- package/dist/types/components/Message/index.d.ts +0 -7
- package/dist/types/components/ModalActions/index.d.ts +0 -11
- package/dist/types/components/PasswordForm/index.d.ts +0 -3
- package/dist/types/components/Scene/index.d.ts +0 -10
- package/dist/types/components/SummaryList/index.d.ts +0 -8
- package/dist/types/components/Switch/index.d.ts +0 -9
- package/dist/types/components/Tag/index.d.ts +0 -8
- package/dist/types/components/TextArea/index.d.ts +0 -4
- package/dist/types/components/TextInput/index.d.ts +0 -14
- package/dist/types/components/WeekCalendar/index.d.ts +0 -12
- package/dist/types/core/App/index.d.ts +0 -19
- package/dist/types/core/AppLogo/index.d.ts +0 -6
- package/dist/types/core/Assistive/index.d.ts +0 -6
- package/dist/types/core/BuildModal/index.d.ts +0 -3
- package/dist/types/core/Calendar/index.d.ts +0 -11
- package/dist/types/core/CalendarDay/index.d.ts +0 -16
- package/dist/types/core/CalendarMonth/index.d.ts +0 -12
- package/dist/types/core/CalendarNavigation/index.d.ts +0 -9
- package/dist/types/core/CalendarWeek/index.d.ts +0 -14
- package/dist/types/core/ChkRad/index.d.ts +0 -13
- package/dist/types/core/ChkRadIcon/index.d.ts +0 -7
- package/dist/types/core/CloseButton/index.d.ts +0 -9
- package/dist/types/core/ConnectedList/index.d.ts +0 -4
- package/dist/types/core/ConnectedTable/index.d.ts +0 -4
- package/dist/types/core/Container/index.d.ts +0 -7
- package/dist/types/core/DropdownPanel/index.d.ts +0 -18
- package/dist/types/core/ErrorBoundary/index.d.ts +0 -15
- package/dist/types/core/ErrorMessage/index.d.ts +0 -8
- package/dist/types/core/FilterItem/index.d.ts +0 -10
- package/dist/types/core/Filters/index.d.ts +0 -15
- package/dist/types/core/Form/index.d.ts +0 -12
- package/dist/types/core/FormError/index.d.ts +0 -6
- package/dist/types/core/FormLabel/index.d.ts +0 -8
- package/dist/types/core/FormLegend/index.d.ts +0 -6
- package/dist/types/core/Header/index.d.ts +0 -8
- package/dist/types/core/Icon/index.d.ts +0 -7
- package/dist/types/core/IconButton/Icon/index.d.ts +0 -7
- package/dist/types/core/IconButton/index.d.ts +0 -11
- package/dist/types/core/InputPanel/index.d.ts +0 -8
- package/dist/types/core/ListItemAction/index.d.ts +0 -4
- package/dist/types/core/ListItemMetaItem/index.d.ts +0 -10
- package/dist/types/core/ListItemTitle/index.d.ts +0 -9
- package/dist/types/core/Loader/index.d.ts +0 -6
- package/dist/types/core/LoginFormAuthenticator/index.d.ts +0 -10
- package/dist/types/core/LoginFormTwoFactor/index.d.ts +0 -13
- package/dist/types/core/LoginFormYubikey/index.d.ts +0 -9
- package/dist/types/core/MeActions/index.d.ts +0 -3
- package/dist/types/core/Modal/index.d.ts +0 -12
- package/dist/types/core/ModalComponent/index.d.ts +0 -12
- package/dist/types/core/NavigationItem/index.d.ts +0 -7
- package/dist/types/core/Pagination/index.d.ts +0 -7
- package/dist/types/core/PaginationItem/index.d.ts +0 -7
- package/dist/types/core/Panel/index.d.ts +0 -8
- package/dist/types/core/RadialProgress/index.d.ts +0 -8
- package/dist/types/core/SettingsForm/index.d.ts +0 -3
- package/dist/types/core/StaticTextInput/index.d.ts +0 -13
- package/dist/types/core/SummaryListItem/index.d.ts +0 -15
- package/dist/types/core/TableCell/index.d.ts +0 -8
- package/dist/types/core/TableHead/index.d.ts +0 -8
- package/dist/types/core/Tabs/index.d.ts +0 -11
- package/dist/types/core/TextInputAncillary/index.d.ts +0 -12
- package/dist/types/core/WeekCalendarDay/index.d.ts +0 -14
- package/dist/types/filters/BooleanFilter/index.d.ts +0 -5
- package/dist/types/filters/DateFilter/index.d.ts +0 -5
- package/dist/types/filters/DropdownFilter/index.d.ts +0 -17
- package/dist/types/filters/QuickDateFilter/index.d.ts +0 -5
- package/dist/types/hooks/useAccessiblePanel.d.ts +0 -13
- package/dist/types/hooks/useAppContext.d.ts +0 -55
- package/dist/types/hooks/useClickOutside.d.ts +0 -3
- package/dist/types/hooks/useComponentId.d.ts +0 -2
- package/dist/types/hooks/useFilters.d.ts +0 -3
- package/dist/types/hooks/useForm.d.ts +0 -41
- package/dist/types/hooks/useFormData.d.ts +0 -12
- package/dist/types/hooks/useModalOffset.d.ts +0 -2
- package/dist/types/hooks/useVariant.d.ts +0 -6
- package/dist/types/services/BuildService.d.ts +0 -5
- package/dist/types/services/DateService.d.ts +0 -17
- package/dist/types/services/DownloadService.d.ts +0 -5
- package/dist/types/services/FilterService.d.ts +0 -13
- package/dist/types/services/FormatService.d.ts +0 -7
- package/dist/types/services/OLD_ApiService.d.ts +0 -19
- package/dist/types/services/ToastService.d.ts +0 -5
- package/dist/types/utility/MockRouter/index.d.ts +0 -2
- package/dist/types/utility/StorybookPanel/index.d.ts +0 -7
- package/dist/types/utility/TestChangeHandler/index.d.ts +0 -15
- package/dist/types/utility/create-app.d.ts +0 -4
- package/dist/types/utility/icons.d.ts +0 -3
- package/dist/types/utility/interfaces.d.ts +0 -69
- package/docs/guides/01-installation.story.mdx +0 -33
- package/docs/guides/02-configuration.story.mdx +0 -80
- package/docs/guides/03-pages.story.mdx +0 -18
- package/docs/guides/04-integration.story.mdx +0 -33
- package/docs/guides/a11y.story.mdx +0 -7
- package/docs/guides/theming.story.mdx +0 -7
- package/docs/introduction.story.mdx +0 -17
- package/jest.config.js +0 -19
- package/rollup.config.js +0 -36
- package/scripts/create-exports.js +0 -74
- package/scripts/update-license.js +0 -8
- package/squarezero.config.js +0 -5
- package/src/components/Button/Button.module.css +0 -100
- package/src/components/CodeInput/CodeInput.module.css +0 -33
- package/src/components/CodeInput/CodeInput.spec.tsx +0 -180
- package/src/components/CodeInput/index.tsx +0 -138
- package/src/components/ConnectedScene/index.tsx +0 -96
- package/src/components/Document/index.tsx +0 -14
- package/src/components/Dropdown/Dropdown.module.css +0 -8
- package/src/components/Dropdown/Dropdown.spec.tsx +0 -304
- package/src/components/Dropdown/Dropdown.story.tsx +0 -53
- package/src/components/Dropdown/index.tsx +0 -228
- package/src/components/FormField/FormField.story.tsx +0 -29
- package/src/components/PasswordForm/PasswordForm.module.css +0 -21
- package/src/components/PasswordInput/PasswordInput.module.css +0 -23
- package/src/components/PasswordInput/PasswordInput.spec.tsx +0 -28
- package/src/components/PasswordInput/PasswordInput.story.tsx +0 -16
- package/src/components/PasswordInput/index.tsx +0 -23
- package/src/components/Scene/Scene.spec.tsx +0 -123
- package/src/components/Scene/Scene.story.tsx +0 -6
- package/src/components/Scene/index.tsx +0 -58
- package/src/components/Tag/Tag.module.css +0 -37
- package/src/components/Tag/Tag.spec.tsx +0 -10
- package/src/components/Tag/Tag.story.tsx +0 -55
- package/src/components/Tag/index.tsx +0 -27
- package/src/components/TextInput/TextInput.story.tsx +0 -24
- package/src/core/App/App.module.css +0 -24
- package/src/core/App/App.spec.tsx +0 -265
- package/src/core/App/index.tsx +0 -115
- package/src/core/Assistive/Assistive.module.css +0 -10
- package/src/core/ChkRad/ChkRad.module.css +0 -31
- package/src/core/ChkRad/ChkRad.spec.tsx +0 -79
- package/src/core/ChkRad/index.tsx +0 -75
- package/src/core/ChkRadIcon/ChkRadIcon.module.css +0 -29
- package/src/core/ChkRadIcon/index.tsx +0 -33
- package/src/core/DropdownPanel/DropdownPanel.module.css +0 -68
- package/src/core/DropdownPanel/index.tsx +0 -93
- package/src/core/ErrorBoundary/ErrorBoundary.spec.tsx +0 -33
- package/src/core/ErrorBoundary/index.tsx +0 -42
- package/src/core/FormError/FormError.module.css +0 -7
- package/src/core/FormError/index.tsx +0 -18
- package/src/core/FormLabel/FormLabel.module.css +0 -15
- package/src/core/FormLabel/index.tsx +0 -25
- package/src/core/Header/Header.module.css +0 -28
- package/src/core/InputPanel/InputPanel.module.css +0 -70
- package/src/core/InputPanel/index.tsx +0 -28
- package/src/core/Loader/Loader.story.tsx +0 -8
- package/src/core/LoginFormAuthenticator/index.tsx +0 -36
- package/src/core/LoginFormTwoFactor/index.tsx +0 -133
- package/src/core/LoginFormYubikey/index.tsx +0 -59
- package/src/core/Pagination/Pagination.module.css +0 -15
- package/src/core/PaginationItem/PaginationItem.module.css +0 -33
- package/src/core/PaginationItem/index.tsx +0 -46
- package/src/core/StaticTextInput/StaticTextInput.module.css +0 -79
- package/src/core/StaticTextInput/StaticTextInput.spec.tsx +0 -126
- package/src/core/StaticTextInput/index.tsx +0 -112
- package/src/core/Styled/Styled.spec.tsx +0 -32
- package/src/core/Styled/Styled.story.tsx +0 -10
- package/src/core/TableActionsCell/TableActionsCell.module.css +0 -3
- package/src/core/TableActionsCell/index.tsx +0 -26
- package/src/core/TableCell/TableCell.module.css +0 -16
- package/src/core/TableCell/index.tsx +0 -39
- package/src/core/TableHead/TableHead.module.css +0 -12
- package/src/core/TableHead/index.tsx +0 -48
- package/src/core/TableRow/index.tsx +0 -49
- package/src/core/TextInputAncillary/TextInputAncillary.module.css +0 -69
- package/src/core/TextInputAncillary/index.tsx +0 -84
- package/src/hooks/useAccessiblePanel.spec.tsx +0 -88
- package/src/hooks/useAccessiblePanel.ts +0 -74
- package/src/hooks/useAppContext.spec.ts +0 -38
- package/src/hooks/useAppContext.ts +0 -110
- package/src/hooks/useClickOutside.ts +0 -49
- package/src/hooks/useComponentId.spec.ts +0 -19
- package/src/hooks/useComponentId.ts +0 -16
- package/src/hooks/useForm.spec.ts +0 -251
- package/src/hooks/useForm.ts +0 -179
- package/src/hooks/useVariant.spec.ts +0 -14
- package/src/hooks/useVariant.ts +0 -34
- package/src/styles/layout.css +0 -64
- package/src/styles/variables.css +0 -85
- package/src/utility/StorybookPanel/StorybookPanel.module.css +0 -9
- package/src/utility/StorybookPanel/index.tsx +0 -25
- package/src/utility/TestChangeHandler/TestChangeHandler.module.css +0 -7
- package/src/utility/TestChangeHandler/TestChangeHandler.spec.tsx +0 -24
- package/src/utility/TestChangeHandler/index.tsx +0 -51
- package/src/utility/create-app.tsx +0 -28
- package/tests/setupFilesAfterEnv.js +0 -16
- package/tsconfig.types.json +0 -9
- /package/dist/{types/core → core}/Styled/index.d.ts +0 -0
- /package/dist/{types/filters → filters}/interfaces.d.ts +0 -0
- /package/dist/{types/services → services}/ConfirmService.d.ts +0 -0
- /package/dist/{types/services → services}/FilterComponentService.d.ts +0 -0
package/.eslintrc
CHANGED
package/.storybook/main.js
CHANGED
|
@@ -1,40 +1,12 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
1
|
module.exports = {
|
|
4
2
|
addons: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
cssLoaderOptions: {
|
|
9
|
-
modules: true,
|
|
10
|
-
},
|
|
11
|
-
postcssLoaderOptions: {
|
|
12
|
-
implementation: require('postcss'),
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
'@storybook/addon-docs',
|
|
3
|
+
'@storybook/addon-links',
|
|
4
|
+
'@storybook/addon-essentials',
|
|
5
|
+
'@storybook/addon-interactions',
|
|
17
6
|
],
|
|
18
7
|
core: {
|
|
19
|
-
builder: 'webpack5',
|
|
20
|
-
},
|
|
21
|
-
stories: [
|
|
22
|
-
'../docs/introduction.story.mdx',
|
|
23
|
-
'../docs/guides/*.story.mdx',
|
|
24
|
-
'../src/**/*.story.tsx',
|
|
25
|
-
],
|
|
26
|
-
webpackFinal: async (config) => {
|
|
27
|
-
config.resolve.extensions = ['.ts', '.tsx', '.js'];
|
|
28
|
-
|
|
29
|
-
config.resolve.alias = {
|
|
30
|
-
'@components': path.resolve(__dirname, '../src', 'components'),
|
|
31
|
-
'@core': path.resolve(__dirname, '../src', 'core'),
|
|
32
|
-
'@filters': path.resolve(__dirname, '../src', 'filters'),
|
|
33
|
-
'@hooks': path.resolve(__dirname, '../src', 'hooks'),
|
|
34
|
-
'@services': path.resolve(__dirname, '../src', 'services'),
|
|
35
|
-
'@utility': path.resolve(__dirname, '../src', 'utility'),
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return config;
|
|
8
|
+
builder: '@storybook/builder-webpack5',
|
|
39
9
|
},
|
|
10
|
+
framework: '@storybook/react',
|
|
11
|
+
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
|
40
12
|
};
|
package/.storybook/preview.js
CHANGED
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2023 Richard Carter
|
|
2
2
|
|
|
3
3
|
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
4
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import type { Action, StyleVariant } from '../../utility/interfaces';
|
|
4
|
+
export interface AlertProps {
|
|
5
|
+
actions?: Action[];
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
icon?: string;
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
onClose?: React.MouseEventHandler<HTMLButtonElement>;
|
|
10
|
+
title?: string;
|
|
11
|
+
variant?: StyleVariant;
|
|
12
|
+
width?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function Alert({ actions, children, icon, isOpen, onClose, title, variant, width, }: AlertProps): React.ReactElement | null;
|
|
15
|
+
declare namespace Alert {
|
|
16
|
+
var propTypes: {
|
|
17
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
18
|
+
actions: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{
|
|
19
|
+
label: PropTypes.Validator<string>;
|
|
20
|
+
onClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
+
}>>[]>;
|
|
22
|
+
title: PropTypes.Requireable<string>;
|
|
23
|
+
variant: PropTypes.Requireable<string>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export default Alert;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import Button from '../Button';
|
|
6
|
+
import Icon from '../../core/Icon';
|
|
7
|
+
import Panel from '../../core/Panel';
|
|
8
|
+
import useVariant from '../../hooks/useVariant';
|
|
9
|
+
/*
|
|
10
|
+
.root {
|
|
11
|
+
bottom: 0;
|
|
12
|
+
left: 0;
|
|
13
|
+
position: fixed;
|
|
14
|
+
right: 0;
|
|
15
|
+
top: 0;
|
|
16
|
+
z-index: 10;
|
|
17
|
+
}
|
|
18
|
+
*/
|
|
19
|
+
function Alert({ actions, children, icon, isOpen, onClose, title, variant, width, }) {
|
|
20
|
+
const ref = useRef(null);
|
|
21
|
+
const { applyVariantClassName } = useVariant(variant);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (isOpen) {
|
|
24
|
+
ref.current?.showModal();
|
|
25
|
+
}
|
|
26
|
+
}, [isOpen]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
ref.current?.addEventListener('close', (event) => {
|
|
29
|
+
if (onClose) {
|
|
30
|
+
onClose(event);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}, []);
|
|
34
|
+
return (React.createElement("dialog", { ref: ref, className: "alert" },
|
|
35
|
+
React.createElement("aside", { className: "max-w-sm", role: "alert" },
|
|
36
|
+
React.createElement(Panel, { isPadded: true },
|
|
37
|
+
React.createElement("div", { className: clsx('bg-green-400 rounded-b-md flex flex-col h-24 justify-center w-16 mx-auto -mt-8', applyVariantClassName({ warning: 'bg-amber-400' })), "data-testid": "alert-component-logo" }, icon ? React.createElement(Icon, { icon: icon, size: 40 }) : null),
|
|
38
|
+
title ? (React.createElement("h3", { className: "/*styles.title*/", role: "heading" }, title)) : null,
|
|
39
|
+
React.createElement("div", { key: String(isOpen) }, children),
|
|
40
|
+
React.createElement("footer", { className: "/*styles.actions*/" },
|
|
41
|
+
actions?.map((action) => (React.createElement(Button, { key: action.label, isDisabled: action.isDisabled, onClick: action.onClick, variant: action.variant }, action.label))),
|
|
42
|
+
React.createElement("form", { method: "dialog" },
|
|
43
|
+
React.createElement(Button, { type: "submit", variant: "link" }, "Close")))))));
|
|
44
|
+
}
|
|
45
|
+
Alert.propTypes = {
|
|
46
|
+
children: PropTypes.node.isRequired,
|
|
47
|
+
actions: PropTypes.arrayOf(PropTypes.shape({
|
|
48
|
+
label: PropTypes.string.isRequired,
|
|
49
|
+
onClick: PropTypes.func.isRequired,
|
|
50
|
+
}).isRequired),
|
|
51
|
+
title: PropTypes.string,
|
|
52
|
+
variant: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'warning', 'danger']),
|
|
53
|
+
};
|
|
54
|
+
export default Alert;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
interface AllowProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
permission?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The `Allow` component is essentially a wrappy that lets a developer display or hide child content
|
|
9
|
+
* based on the permissions a particular user has.
|
|
10
|
+
*
|
|
11
|
+
* By default, the
|
|
12
|
+
*/
|
|
13
|
+
declare function Allow({ children, permission }: AllowProps): React.ReactElement | null;
|
|
14
|
+
declare namespace Allow {
|
|
15
|
+
var propTypes: {
|
|
16
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
17
|
+
permission: PropTypes.Requireable<string>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export default Allow;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import useConfig from '../../hooks/useConfig';
|
|
4
|
+
function hasPermission(me, permission) {
|
|
5
|
+
if (!me.permissions || !permission) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
return me.permissions.includes(permission);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The `Allow` component is essentially a wrappy that lets a developer display or hide child content
|
|
12
|
+
* based on the permissions a particular user has.
|
|
13
|
+
*
|
|
14
|
+
* By default, the
|
|
15
|
+
*/
|
|
16
|
+
function Allow({ children, permission }) {
|
|
17
|
+
const { me } = useConfig();
|
|
18
|
+
if (me && !hasPermission(me, permission)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
// Use the `Fragment` here to get around TS complaining about FunctionComponent
|
|
22
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
23
|
+
return React.createElement(Fragment, null, children);
|
|
24
|
+
}
|
|
25
|
+
Allow.propTypes = {
|
|
26
|
+
children: PropTypes.node.isRequired,
|
|
27
|
+
permission: PropTypes.string,
|
|
28
|
+
};
|
|
29
|
+
export default Allow;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import AppLayout from './index';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/AppLayout',
|
|
5
|
+
component: AppLayout,
|
|
6
|
+
};
|
|
7
|
+
const Template = (args) => (React.createElement(AppLayout, { ...args }));
|
|
8
|
+
export const Basic = Template.bind({});
|
|
9
|
+
Basic.args = {
|
|
10
|
+
children: 'Lorem Ipsum',
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import AppHeader from '../../core/AppHeader';
|
|
3
|
+
import Banner from '../../core/Banner';
|
|
4
|
+
function AppLayout({ children }) {
|
|
5
|
+
return (React.createElement("div", { className: "flex flex-col min-h-full md:grid md:grid-cols-[22rem_1fr]" },
|
|
6
|
+
React.createElement(Banner, null),
|
|
7
|
+
React.createElement("main", { className: "block" },
|
|
8
|
+
React.createElement(AppHeader, null),
|
|
9
|
+
children)));
|
|
10
|
+
}
|
|
11
|
+
export default AppLayout;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import type { DropdownItem } from '../../core/DropdownPanel';
|
|
3
4
|
import type { InputProps } from '../../utility/interfaces';
|
|
4
|
-
interface AutoSuggestProps extends InputProps<string> {
|
|
5
|
+
export interface AutoSuggestProps extends InputProps<string> {
|
|
5
6
|
/**
|
|
6
7
|
* An array of strings to filter for the suggestions. If a `remote` prop is specified, this is
|
|
7
8
|
* ignored.
|
|
@@ -56,5 +57,18 @@ interface AutoSuggestProps extends InputProps<string> {
|
|
|
56
57
|
* [{ id: 1, name: 'apple' }, { id: 2, name: 'banana' }, { id: 3, name: 'carrot' }]
|
|
57
58
|
* ```
|
|
58
59
|
*/
|
|
59
|
-
declare
|
|
60
|
+
declare function AutoSuggest({ data, name, remote, value, hasError, onChange, }: AutoSuggestProps): React.ReactElement;
|
|
61
|
+
declare namespace AutoSuggest {
|
|
62
|
+
var propTypes: {
|
|
63
|
+
name: PropTypes.Validator<string>;
|
|
64
|
+
data: PropTypes.Requireable<NonNullable<NonNullable<string | NonNullable<PropTypes.InferProps<{
|
|
65
|
+
id: PropTypes.Validator<string>;
|
|
66
|
+
name: PropTypes.Validator<string>;
|
|
67
|
+
}>>>>[]>;
|
|
68
|
+
hasError: PropTypes.Requireable<boolean>;
|
|
69
|
+
remote: PropTypes.Requireable<string>;
|
|
70
|
+
value: PropTypes.Requireable<string>;
|
|
71
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
60
74
|
export default AutoSuggest;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { useAccessiblePanel, useClickOutside } from '@sqrzro/hooks';
|
|
5
|
+
import { ApiService } from '@sqrzro/utility';
|
|
6
|
+
import ErrorMessage from '../ErrorMessage';
|
|
7
|
+
import TextInput from '../TextInput';
|
|
8
|
+
import DropdownPanel from '../../core/DropdownPanel';
|
|
9
|
+
import InputPanel from '../../core/InputPanel';
|
|
10
|
+
// Import styles from './AutoSuggest.module.css';
|
|
11
|
+
function transformSuggestions(data) {
|
|
12
|
+
if (!data) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return data.map((item) => (typeof item === 'object' ? item : { id: item, name: item }));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* As a user types, suggestions based on they've typed are displayed in a panel below. When a user
|
|
19
|
+
* clicks a suggestion, the value is updated. Under the hood, it is more or less a combination of a
|
|
20
|
+
* `TextInput` and a `DropdownPanel`.
|
|
21
|
+
*
|
|
22
|
+
* ## Request Methods
|
|
23
|
+
*
|
|
24
|
+
* At its most basic, the suggestions are a predefined array of `data`. However,
|
|
25
|
+
* if the `remote` prop is specified, the AutoSuggest will `GET` that endpoint as the user types.
|
|
26
|
+
* The following will be appended onto the query:
|
|
27
|
+
*
|
|
28
|
+
* ````
|
|
29
|
+
* ?search={value}
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* The endpoint should then handle filtering the data, and returning an array of the results. If the
|
|
33
|
+
* value of the input changes before the previous `GET` request has completed, that one is
|
|
34
|
+
* cancelled and a new one started, with the updated search query.
|
|
35
|
+
*
|
|
36
|
+
* ## Data Formats
|
|
37
|
+
*
|
|
38
|
+
* The data returned should be one of two formats. The choice of format has an impact on how the
|
|
39
|
+
* value is stored, and the label that is displayed.
|
|
40
|
+
*
|
|
41
|
+
* The most basic format is an array of strings. The value is stored as the string itself, and the
|
|
42
|
+
* label displays the same string. This is most useful for situations where no relationships are
|
|
43
|
+
* required on the backend, and the `AutoSuggest` is purely being used to assist the user in
|
|
44
|
+
* defining a value.
|
|
45
|
+
*
|
|
46
|
+
* An example of this data would be:
|
|
47
|
+
*
|
|
48
|
+
* ```
|
|
49
|
+
* ['apple', 'banana', 'carrot']
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* The second format is an array of objects. The value is stored as the `id` of the object, and the
|
|
53
|
+
* label displays the `name` of the object. This is most useful for situations where a relationship
|
|
54
|
+
* is required on the backend, and the `AutoSuggest` is being used to assist the user in defining
|
|
55
|
+
* a value. With this format, the `AutoSuggest` works more like a `Dropdown`.
|
|
56
|
+
*
|
|
57
|
+
* For example:
|
|
58
|
+
*
|
|
59
|
+
* ```
|
|
60
|
+
* [{ id: 1, name: 'apple' }, { id: 2, name: 'banana' }, { id: 3, name: 'carrot' }]
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
function AutoSuggest({ data, name, remote, value, hasError, onChange, }) {
|
|
64
|
+
const [suggestions, setSuggestions] = useState(null);
|
|
65
|
+
const [isOpen, setIsOpen, node] = useClickOutside({ shouldHandleEnterKey: true });
|
|
66
|
+
const [isError, setIsError] = useState(false);
|
|
67
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
68
|
+
function getLocalData(search) {
|
|
69
|
+
if (!data?.length) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const rgx = new RegExp(`^${search}.*`, 'iu');
|
|
73
|
+
const response = data.filter((item) => rgx.exec(typeof item === 'string' ? item : item.name));
|
|
74
|
+
setIsOpen(Boolean(response.length));
|
|
75
|
+
setSuggestions(response);
|
|
76
|
+
}
|
|
77
|
+
async function getData(search) {
|
|
78
|
+
if (!remote) {
|
|
79
|
+
getLocalData(search);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
setIsLoading(true);
|
|
83
|
+
try {
|
|
84
|
+
const response = await ApiService.get([remote, { search }], {
|
|
85
|
+
isCancellable: true,
|
|
86
|
+
});
|
|
87
|
+
setSuggestions(response.data);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
setIsError(true);
|
|
91
|
+
}
|
|
92
|
+
setIsLoading(false);
|
|
93
|
+
setIsOpen(true);
|
|
94
|
+
}
|
|
95
|
+
function handleChange(event) {
|
|
96
|
+
if (onChange) {
|
|
97
|
+
onChange(event);
|
|
98
|
+
}
|
|
99
|
+
if (!event.target.value) {
|
|
100
|
+
setIsOpen(false);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
void getData(event.target.value);
|
|
104
|
+
}
|
|
105
|
+
function handleSuggest(item) {
|
|
106
|
+
const simpleEvent = {
|
|
107
|
+
target: { name, value: item.id },
|
|
108
|
+
};
|
|
109
|
+
if (onChange) {
|
|
110
|
+
onChange(simpleEvent);
|
|
111
|
+
}
|
|
112
|
+
setIsOpen(false);
|
|
113
|
+
}
|
|
114
|
+
if (isError) {
|
|
115
|
+
return React.createElement(ErrorMessage, { isMini: true });
|
|
116
|
+
}
|
|
117
|
+
const transformed = transformSuggestions(suggestions);
|
|
118
|
+
const { handleKeyboard } = useAccessiblePanel({
|
|
119
|
+
data: transformed,
|
|
120
|
+
name,
|
|
121
|
+
onChange,
|
|
122
|
+
value,
|
|
123
|
+
});
|
|
124
|
+
return (React.createElement("div", { ref: node, className: "/*clsx(styles.root, isOpen && styles.rootOpen)*/" },
|
|
125
|
+
React.createElement(TextInput, { hasError: hasError, isAutocomplete: false, isLoading: isLoading, name: name, onChange: handleChange, onKeyDown: handleKeyboard, value: value }),
|
|
126
|
+
isOpen && suggestions && suggestions.length ? (React.createElement(InputPanel, { isScrollable: true },
|
|
127
|
+
React.createElement(DropdownPanel, { data: transformed, name: name, onChange: ({ item }) => handleSuggest(item), value: value }))) : null));
|
|
128
|
+
}
|
|
129
|
+
AutoSuggest.propTypes = {
|
|
130
|
+
name: PropTypes.string.isRequired,
|
|
131
|
+
data: PropTypes.arrayOf(PropTypes.oneOfType([
|
|
132
|
+
PropTypes.string.isRequired,
|
|
133
|
+
PropTypes.shape({
|
|
134
|
+
id: PropTypes.string.isRequired,
|
|
135
|
+
name: PropTypes.string.isRequired,
|
|
136
|
+
}).isRequired,
|
|
137
|
+
]).isRequired),
|
|
138
|
+
hasError: PropTypes.bool,
|
|
139
|
+
remote: PropTypes.string,
|
|
140
|
+
value: PropTypes.string,
|
|
141
|
+
onChange: PropTypes.func,
|
|
142
|
+
};
|
|
143
|
+
export default AutoSuggest;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentMeta } from '@storybook/react';
|
|
2
|
+
import Button from './index';
|
|
3
|
+
declare const _default: ComponentMeta<typeof Button>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Basic: any;
|
|
6
|
+
export declare const Danger: any;
|
|
7
|
+
export declare const Bordered: any;
|
|
8
|
+
export declare const BorderedDanger: any;
|
|
9
|
+
export declare const FullWidth: any;
|
|
10
|
+
export declare const Disabled: any;
|
|
11
|
+
export declare const Loading: any;
|
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from './index';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/Button',
|
|
5
|
+
component: Button,
|
|
6
|
+
};
|
|
7
|
+
const Template = (args) => (React.createElement(Button, { ...args }));
|
|
8
|
+
export const Basic = Template.bind({});
|
|
9
|
+
Basic.args = {
|
|
10
|
+
children: 'Lorem Ipsum',
|
|
11
|
+
};
|
|
12
|
+
export const Danger = Template.bind({});
|
|
13
|
+
Danger.args = {
|
|
14
|
+
children: 'Lorem Ipsum',
|
|
15
|
+
variant: 'danger',
|
|
16
|
+
};
|
|
17
|
+
export const Bordered = Template.bind({});
|
|
18
|
+
Bordered.args = {
|
|
19
|
+
children: 'Lorem Ipsum',
|
|
20
|
+
variant: 'bordered',
|
|
21
|
+
};
|
|
22
|
+
export const BorderedDanger = Template.bind({});
|
|
23
|
+
BorderedDanger.args = {
|
|
24
|
+
children: 'Lorem Ipsum',
|
|
25
|
+
variant: ['bordered', 'danger'],
|
|
26
|
+
};
|
|
27
|
+
export const FullWidth = Template.bind({});
|
|
28
|
+
FullWidth.args = {
|
|
29
|
+
children: 'Lorem Ipsum',
|
|
30
|
+
isFullWidth: true,
|
|
31
|
+
};
|
|
32
|
+
export const Disabled = Template.bind({});
|
|
33
|
+
Disabled.args = {
|
|
34
|
+
children: 'Lorem Ipsum',
|
|
35
|
+
isDisabled: true,
|
|
36
|
+
};
|
|
37
|
+
export const Loading = Template.bind({});
|
|
38
|
+
Loading.args = {
|
|
39
|
+
children: 'Lorem Ipsum',
|
|
40
|
+
isLoading: true,
|
|
41
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import type { ButtonVariant } from '../../utility/interfaces';
|
|
3
4
|
export interface ButtonProps {
|
|
4
5
|
/** Probably the button text, but could be any HTML element or React component */
|
|
@@ -6,11 +7,13 @@ export interface ButtonProps {
|
|
|
6
7
|
/** If set to true, the Button will be greyed out and non-interactive */
|
|
7
8
|
isDisabled?: boolean | null;
|
|
8
9
|
isFullWidth?: boolean | null;
|
|
10
|
+
isLoading?: boolean | null;
|
|
9
11
|
onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>;
|
|
10
12
|
/** If specified, the Button will be created as a Link element. */
|
|
11
13
|
to?: string;
|
|
12
14
|
/** The type of button. Button's with a type of `submit` will submit a parent form */
|
|
13
15
|
type?: 'button' | 'submit';
|
|
16
|
+
value?: string;
|
|
14
17
|
/** With the exception of `bordered` these variants correspond to the theme colours */
|
|
15
18
|
variant?: ButtonVariant | ButtonVariant[];
|
|
16
19
|
}
|
|
@@ -32,5 +35,16 @@ export interface ButtonProps {
|
|
|
32
35
|
* width, you can wrap it in a `div`, and then wrap that `div` in a component with a flex property.
|
|
33
36
|
* Components like `ListActions` and `ModalActions` do this for you.
|
|
34
37
|
*/
|
|
35
|
-
declare
|
|
38
|
+
declare function Button({ to, children, type, variant, isDisabled, isFullWidth, isLoading, onClick, value, }: ButtonProps): React.ReactElement;
|
|
39
|
+
declare namespace Button {
|
|
40
|
+
var propTypes: {
|
|
41
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
42
|
+
isDisabled: PropTypes.Requireable<boolean>;
|
|
43
|
+
isFullWidth: PropTypes.Requireable<boolean>;
|
|
44
|
+
to: PropTypes.Requireable<string>;
|
|
45
|
+
type: PropTypes.Requireable<string>;
|
|
46
|
+
variant: PropTypes.Requireable<NonNullable<NonNullable<ButtonVariant> | NonNullable<ButtonVariant>[] | null | undefined>>;
|
|
47
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
36
50
|
export default Button;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import Link from '../Link';
|
|
6
|
+
import Loader from '../../core/Loader';
|
|
7
|
+
import useVariant from '../../hooks/useVariant';
|
|
8
|
+
import { ButtonVariantPropType } from '../../utility/prop-types';
|
|
9
|
+
/**
|
|
10
|
+
* Either a `Link` component or a `button` element, depending on whether a `to` prop is specified.
|
|
11
|
+
*
|
|
12
|
+
* As a `Link`, it provides navigation between pages, and as a `button` it will handle the
|
|
13
|
+
* `onClick` function when clicked (if one is specified).
|
|
14
|
+
*
|
|
15
|
+
* ## to & onClick
|
|
16
|
+
*
|
|
17
|
+
* Although it is possible to omit both the `to` and `onClick` props, there will
|
|
18
|
+
* be nearly zero situations where this would be useful. It is also possible to include both props.
|
|
19
|
+
* This will create a `Link` component, and handle the `onClick` function before navigation.
|
|
20
|
+
*
|
|
21
|
+
* ## Styles
|
|
22
|
+
*
|
|
23
|
+
* The `Button` will stretch to the full width of its parent element. If you wish to have a smaller
|
|
24
|
+
* width, you can wrap it in a `div`, and then wrap that `div` in a component with a flex property.
|
|
25
|
+
* Components like `ListActions` and `ModalActions` do this for you.
|
|
26
|
+
*/
|
|
27
|
+
function Button({ to, children, type, variant, isDisabled, isFullWidth, isLoading, onClick, value, }) {
|
|
28
|
+
const { applyVariantClassName } = useVariant(variant);
|
|
29
|
+
const className = clsx('text-white bg-blue-500 focus:ring-4 focus:outline-none focus:ring-cyan-300 dark:focus:ring-cyan-800 font-medium rounded-md text-sm px-5 py-2.5 text-center mr-2 mb-2', {
|
|
30
|
+
'opacity-30 pointer-events-none': isDisabled || isLoading,
|
|
31
|
+
'w-full': isFullWidth,
|
|
32
|
+
}, applyVariantClassName({ danger: 'bg-red-900' }));
|
|
33
|
+
if (to) {
|
|
34
|
+
return (React.createElement(Link, { className: className, onClick: onClick, to: to }, children));
|
|
35
|
+
}
|
|
36
|
+
return (React.createElement("button", { className: className, disabled: isDisabled || isLoading || false, onClick: onClick, type: type === 'submit' ? 'submit' : 'button', value: value },
|
|
37
|
+
isLoading ? (React.createElement("div", { className: "absolute left-1/2 top-1/2 -translate-x-2/4 -translate-y-2/4" },
|
|
38
|
+
React.createElement(Loader, { isMini: true }))) : null,
|
|
39
|
+
children));
|
|
40
|
+
}
|
|
41
|
+
Button.propTypes = {
|
|
42
|
+
children: PropTypes.node.isRequired,
|
|
43
|
+
isDisabled: PropTypes.bool,
|
|
44
|
+
isFullWidth: PropTypes.bool,
|
|
45
|
+
to: PropTypes.string,
|
|
46
|
+
type: PropTypes.oneOf(['button', 'submit']),
|
|
47
|
+
variant: ButtonVariantPropType,
|
|
48
|
+
onClick: PropTypes.func,
|
|
49
|
+
};
|
|
50
|
+
export default Button;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import type { InputProps } from '../../utility/interfaces';
|
|
4
|
+
export interface CalendarInputProps extends InputProps<string> {
|
|
5
|
+
disabledDates?: string[] | ((date: string) => boolean);
|
|
6
|
+
isOptional?: boolean;
|
|
7
|
+
isPanelOnly?: boolean;
|
|
8
|
+
isRange?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function CalendarInput({ disabledDates, hasError, isDisabled, isOptional, isPanelOnly, isRange, name, value, onChange, }: CalendarInputProps): React.ReactElement;
|
|
11
|
+
declare namespace CalendarInput {
|
|
12
|
+
var propTypes: {
|
|
13
|
+
name: PropTypes.Validator<string>;
|
|
14
|
+
disabledDates: PropTypes.Requireable<NonNullable<string[] | ((...args: any[]) => any) | null | undefined>>;
|
|
15
|
+
hasError: PropTypes.Requireable<boolean>;
|
|
16
|
+
isDisabled: PropTypes.Requireable<boolean>;
|
|
17
|
+
isOptional: PropTypes.Requireable<boolean>;
|
|
18
|
+
isPanelOnly: PropTypes.Requireable<boolean>;
|
|
19
|
+
isRange: PropTypes.Requireable<boolean>;
|
|
20
|
+
value: PropTypes.Requireable<string>;
|
|
21
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default CalendarInput;
|