@sqrzro/admin 2.0.0 → 2.1.0-bz.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/.babelrc.json +16 -0
- package/.eslintignore +6 -0
- package/.eslintrc +1 -4
- package/.sqrzrorc +5 -0
- package/.storybook/main.js +10 -11
- package/.turbo/turbo-build.log +20 -0
- package/.turbo/turbo-prettier.log +41 -213
- package/COMPONENTS.md +45 -0
- package/dist/components/AppLayout/index.d.ts +2 -2
- package/dist/components/AppLayout/index.js +7 -15
- package/dist/components/AppNavigation/index.d.ts +3 -0
- package/dist/components/AppNavigation/index.js +15 -0
- package/dist/components/BooleanFilter/index.d.ts +5 -0
- package/dist/components/BooleanFilter/index.js +19 -0
- package/dist/components/Config/index.d.ts +6 -0
- package/dist/components/Config/index.js +9 -0
- package/dist/components/Dashboard/index.d.ts +7 -0
- package/dist/components/Dashboard/index.js +5 -0
- package/dist/components/DateFilter/index.d.ts +6 -0
- package/dist/components/DateFilter/index.js +32 -0
- package/dist/components/DropdownFilter/index.d.ts +6 -0
- package/dist/components/DropdownFilter/index.js +9 -0
- package/dist/components/FilterBar/index.d.ts +8 -0
- package/dist/components/FilterBar/index.js +12 -0
- package/dist/components/FilterBarItem/index.d.ts +14 -0
- package/dist/components/FilterBarItem/index.js +31 -0
- package/dist/components/GridList/index.d.ts +5 -0
- package/dist/components/GridList/index.js +7 -0
- package/dist/components/GridListItem/index.d.ts +4 -0
- package/dist/components/GridListItem/index.js +7 -0
- package/dist/components/Icon/index.d.ts +8 -0
- package/dist/components/Icon/index.js +22 -0
- package/dist/components/List/index.d.ts +19 -33
- package/dist/components/List/index.js +19 -43
- package/dist/components/ListAction/index.d.ts +7 -0
- package/dist/components/ListAction/index.js +9 -0
- package/dist/components/ListActions/index.d.ts +6 -16
- package/dist/components/ListActions/index.js +9 -11
- package/dist/components/ListItem/index.d.ts +14 -0
- package/dist/components/ListItem/index.js +12 -0
- package/dist/components/LoginForm/index.d.ts +5 -2
- package/dist/components/LoginForm/index.js +4 -44
- package/dist/components/MeActions/index.d.ts +3 -0
- package/dist/components/MeActions/index.js +13 -0
- package/dist/components/MePanel/index.d.ts +3 -0
- package/dist/components/MePanel/index.js +9 -0
- package/dist/components/Page/index.d.ts +12 -0
- package/dist/components/Page/index.js +8 -0
- package/dist/components/PageActions/index.d.ts +6 -0
- package/dist/components/PageActions/index.js +13 -0
- package/dist/components/Panel/index.d.ts +7 -0
- package/dist/components/Panel/index.js +5 -0
- package/dist/components/RootLayout/index.d.ts +5 -3
- package/dist/components/RootLayout/index.js +12 -5
- package/dist/components/Table/index.d.ts +7 -26
- package/dist/components/Table/index.js +14 -52
- package/dist/components/TableClientComponent/index.d.ts +16 -0
- package/dist/components/TableClientComponent/index.js +44 -0
- package/dist/components/Tabs/index.d.ts +8 -0
- package/dist/components/Tabs/index.js +6 -0
- package/dist/components/index.d.ts +24 -0
- package/dist/components/index.js +13 -0
- package/dist/icons/ErrorIcon/index.d.ts +3 -0
- package/dist/icons/ErrorIcon/index.js +5 -0
- package/dist/icons/InfoIcon/index.d.ts +3 -0
- package/dist/icons/InfoIcon/index.js +5 -0
- package/dist/icons/SuccessIcon/index.d.ts +3 -0
- package/dist/icons/SuccessIcon/index.js +5 -0
- package/dist/icons/WarningIcon/index.d.ts +3 -0
- package/dist/icons/WarningIcon/index.js +5 -0
- package/dist/index.d.ts +2 -208
- package/dist/index.js +2 -212
- package/dist/interfaces.d.ts +4 -0
- package/dist/services/ConfigService.d.ts +7 -40
- package/dist/services/ConfigService.js +10 -48
- package/dist/styles/config.d.ts +3 -0
- package/dist/styles/config.js +82 -0
- package/dist/styles.css +873 -134
- package/dist/utility/formatters.d.ts +1 -0
- package/dist/utility/formatters.js +8 -0
- package/next-env.d.ts +5 -0
- package/package.json +39 -29
- package/src/components/AppLayout/index.tsx +21 -11
- package/src/components/AppNavigation/index.tsx +39 -0
- package/src/components/BooleanFilter/index.tsx +28 -0
- package/src/components/Config/index.tsx +17 -0
- package/src/components/Dashboard/index.tsx +15 -0
- package/src/components/DateFilter/index.tsx +49 -0
- package/src/components/DropdownFilter/index.tsx +19 -0
- package/src/components/FilterBar/index.tsx +35 -0
- package/src/components/FilterBarItem/index.tsx +126 -0
- package/src/components/GridList/index.tsx +11 -0
- package/src/components/GridListItem/index.tsx +31 -0
- package/src/components/Icon/index.tsx +33 -0
- package/src/components/List/index.tsx +52 -72
- package/src/components/ListAction/index.tsx +25 -0
- package/src/components/ListActions/index.tsx +32 -19
- package/src/components/ListItem/index.tsx +56 -0
- package/src/components/LoginForm/index.tsx +25 -105
- package/src/components/MeActions/index.tsx +21 -0
- package/src/components/MePanel/index.tsx +21 -0
- package/src/components/Page/index.tsx +60 -0
- package/src/components/PageActions/index.tsx +22 -0
- package/src/components/Panel/Panel.spec.tsx +10 -0
- package/src/components/Panel/Panel.stories.tsx +9 -0
- package/src/components/Panel/index.tsx +15 -0
- package/src/components/RootLayout/index.tsx +23 -29
- package/src/components/Table/index.tsx +22 -111
- package/src/components/TableClientComponent/index.tsx +112 -0
- package/src/components/Tabs/index.tsx +25 -0
- package/src/components/index.ts +68 -0
- package/src/icons/ErrorIcon/index.tsx +19 -0
- package/src/icons/InfoIcon/index.tsx +19 -0
- package/src/icons/SuccessIcon/index.tsx +19 -0
- package/src/icons/WarningIcon/index.tsx +19 -0
- package/src/index.ts +2 -214
- package/src/interfaces.ts +3 -0
- package/src/react.d.ts +12 -0
- package/src/services/ConfigService.ts +15 -84
- package/src/styles/config.ts +95 -0
- package/src/styles/tailwind.css +25 -35
- package/src/utility/formatters.ts +9 -0
- package/tailwind.config.js +8 -3
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +3 -3
- package/.turbo/turbo-docs.log +0 -0
- package/.turbo/turbo-lint.log +0 -112
- package/.turbo/turbo-test.log +0 -6
- package/dist/components/Alert/index.d.ts +0 -4
- package/dist/components/Alert/index.js +0 -15
- package/dist/components/Allow/index.d.ts +0 -20
- package/dist/components/Allow/index.js +0 -29
- package/dist/components/AppLayout/AppLayout.stories.d.ts +0 -5
- package/dist/components/AppLayout/AppLayout.stories.js +0 -11
- package/dist/components/AutoSuggest/index.d.ts +0 -74
- package/dist/components/AutoSuggest/index.js +0 -143
- package/dist/components/Button/Button.stories.d.ts +0 -11
- package/dist/components/Button/Button.stories.js +0 -41
- package/dist/components/Button/index.d.ts +0 -49
- package/dist/components/Button/index.js +0 -50
- package/dist/components/CalendarInput/index.d.ts +0 -24
- package/dist/components/CalendarInput/index.js +0 -54
- package/dist/components/CheckboxList/index.d.ts +0 -17
- package/dist/components/CheckboxList/index.js +0 -25
- package/dist/components/CodeInput/index.d.ts +0 -9
- package/dist/components/CodeInput/index.js +0 -51
- package/dist/components/ConnectedDropdown/index.d.ts +0 -14
- package/dist/components/ConnectedDropdown/index.js +0 -36
- package/dist/components/ConnectedList/index.d.ts +0 -5
- package/dist/components/ConnectedList/index.js +0 -7
- package/dist/components/ConnectedTable/index.d.ts +0 -5
- package/dist/components/ConnectedTable/index.js +0 -7
- package/dist/components/ContentBlock/index.d.ts +0 -16
- package/dist/components/ContentBlock/index.js +0 -13
- package/dist/components/DataPanel/index.d.ts +0 -8
- package/dist/components/DataPanel/index.js +0 -8
- package/dist/components/DateInput/index.d.ts +0 -18
- package/dist/components/DateInput/index.js +0 -81
- package/dist/components/Dropdown/index.d.ts +0 -36
- package/dist/components/Dropdown/index.js +0 -122
- package/dist/components/ErrorMessage/index.d.ts +0 -16
- package/dist/components/ErrorMessage/index.js +0 -17
- package/dist/components/Fieldset/index.d.ts +0 -18
- package/dist/components/Fieldset/index.js +0 -19
- package/dist/components/FileInput/index.d.ts +0 -10
- package/dist/components/FileInput/index.js +0 -26
- package/dist/components/FilterLink/index.d.ts +0 -14
- package/dist/components/FilterLink/index.js +0 -15
- package/dist/components/Form/index.d.ts +0 -14
- package/dist/components/Form/index.js +0 -15
- package/dist/components/FormActions/index.d.ts +0 -18
- package/dist/components/FormActions/index.js +0 -14
- package/dist/components/FormField/index.d.ts +0 -14
- package/dist/components/FormField/index.js +0 -40
- package/dist/components/FormRepeater/index.d.ts +0 -18
- package/dist/components/FormRepeater/index.js +0 -65
- package/dist/components/ImageInput/index.d.ts +0 -13
- package/dist/components/ImageInput/index.js +0 -45
- package/dist/components/InfoPanel/index.d.ts +0 -14
- package/dist/components/InfoPanel/index.js +0 -11
- package/dist/components/Link/__mocks__/index.d.ts +0 -6
- package/dist/components/Link/__mocks__/index.js +0 -12
- package/dist/components/Link/index.d.ts +0 -23
- package/dist/components/Link/index.js +0 -21
- package/dist/components/Message/index.d.ts +0 -14
- package/dist/components/Message/index.js +0 -14
- package/dist/components/Modal/index.d.ts +0 -4
- package/dist/components/Modal/index.js +0 -18
- package/dist/components/ModalActions/index.d.ts +0 -21
- package/dist/components/ModalActions/index.js +0 -18
- package/dist/components/MoneyInput/index.d.ts +0 -10
- package/dist/components/MoneyInput/index.js +0 -13
- package/dist/components/PasswordForm/index.d.ts +0 -35
- package/dist/components/PasswordForm/index.js +0 -21
- package/dist/components/PasswordInput/index.d.ts +0 -4
- package/dist/components/PasswordInput/index.js +0 -12
- package/dist/components/RadioList/index.d.ts +0 -9
- package/dist/components/RadioList/index.js +0 -7
- package/dist/components/SummaryList/index.d.ts +0 -18
- package/dist/components/SummaryList/index.js +0 -15
- package/dist/components/Switch/index.d.ts +0 -21
- package/dist/components/Switch/index.js +0 -31
- package/dist/components/Tag/index.d.ts +0 -15
- package/dist/components/Tag/index.js +0 -13
- package/dist/components/TextArea/index.d.ts +0 -18
- package/dist/components/TextArea/index.js +0 -26
- package/dist/components/TextInput/index.d.ts +0 -14
- package/dist/components/TextInput/index.js +0 -27
- package/dist/components/WebsiteInput/index.d.ts +0 -10
- package/dist/components/WebsiteInput/index.js +0 -13
- package/dist/components/WeekCalendar/index.d.ts +0 -24
- package/dist/components/WeekCalendar/index.js +0 -48
- package/dist/core/AlertComponent/index.d.ts +0 -26
- package/dist/core/AlertComponent/index.js +0 -35
- package/dist/core/AppHeader/index.d.ts +0 -3
- package/dist/core/AppHeader/index.js +0 -17
- package/dist/core/AppLogo/index.d.ts +0 -12
- package/dist/core/AppLogo/index.js +0 -16
- package/dist/core/AppLogoImage/index.d.ts +0 -3
- package/dist/core/AppLogoImage/index.js +0 -11
- package/dist/core/AppLogoPlaceholder/index.d.ts +0 -3
- package/dist/core/AppLogoPlaceholder/index.js +0 -10
- package/dist/core/Assistive/index.d.ts +0 -12
- package/dist/core/Assistive/index.js +0 -9
- package/dist/core/AuthForm/index.d.ts +0 -10
- package/dist/core/AuthForm/index.js +0 -13
- package/dist/core/Banner/index.d.ts +0 -3
- package/dist/core/Banner/index.js +0 -14
- package/dist/core/Calendar/index.d.ts +0 -21
- package/dist/core/Calendar/index.js +0 -69
- package/dist/core/CalendarDay/index.d.ts +0 -30
- package/dist/core/CalendarDay/index.js +0 -30
- package/dist/core/CalendarMonth/index.d.ts +0 -23
- package/dist/core/CalendarMonth/index.js +0 -45
- package/dist/core/CalendarNavigation/index.d.ts +0 -17
- package/dist/core/CalendarNavigation/index.js +0 -24
- package/dist/core/CalendarWeek/index.d.ts +0 -28
- package/dist/core/CalendarWeek/index.js +0 -46
- package/dist/core/ChkRad/index.d.ts +0 -26
- package/dist/core/ChkRad/index.js +0 -33
- package/dist/core/ChkRadIcon/index.d.ts +0 -14
- package/dist/core/ChkRadIcon/index.js +0 -12
- package/dist/core/ChkRadList/index.d.ts +0 -32
- package/dist/core/ChkRadList/index.js +0 -37
- package/dist/core/CloseButton/index.d.ts +0 -17
- package/dist/core/CloseButton/index.js +0 -12
- package/dist/core/ConfirmModal/index.d.ts +0 -3
- package/dist/core/ConfirmModal/index.js +0 -38
- package/dist/core/ConnectedRepeater/index.d.ts +0 -50
- package/dist/core/ConnectedRepeater/index.js +0 -154
- package/dist/core/ConnectedRepeaterComponent/index.d.ts +0 -24
- package/dist/core/ConnectedRepeaterComponent/index.js +0 -25
- package/dist/core/Container/index.d.ts +0 -14
- package/dist/core/Container/index.js +0 -12
- package/dist/core/DataPanelItem/index.d.ts +0 -8
- package/dist/core/DataPanelItem/index.js +0 -7
- package/dist/core/DropdownPanel/index.d.ts +0 -31
- package/dist/core/DropdownPanel/index.js +0 -32
- package/dist/core/EmptyMessage/index.d.ts +0 -21
- package/dist/core/EmptyMessage/index.js +0 -21
- package/dist/core/FilterItem/index.d.ts +0 -25
- package/dist/core/FilterItem/index.js +0 -82
- package/dist/core/Filters/index.d.ts +0 -31
- package/dist/core/Filters/index.js +0 -85
- package/dist/core/FixedActions/index.d.ts +0 -24
- package/dist/core/FixedActions/index.js +0 -22
- package/dist/core/FormError/index.d.ts +0 -12
- package/dist/core/FormError/index.js +0 -9
- package/dist/core/FormLabel/index.d.ts +0 -16
- package/dist/core/FormLabel/index.js +0 -13
- package/dist/core/FormLegend/index.d.ts +0 -12
- package/dist/core/FormLegend/index.js +0 -9
- package/dist/core/Header/Header.stories.d.ts +0 -5
- package/dist/core/Header/Header.stories.js +0 -11
- package/dist/core/Header/index.d.ts +0 -14
- package/dist/core/Header/index.js +0 -12
- package/dist/core/Icon/index.d.ts +0 -14
- package/dist/core/Icon/index.js +0 -32
- package/dist/core/IconButton/index.d.ts +0 -22
- package/dist/core/IconButton/index.js +0 -20
- package/dist/core/InputPanel/index.d.ts +0 -16
- package/dist/core/InputPanel/index.js +0 -11
- package/dist/core/ListItem/index.d.ts +0 -39
- package/dist/core/ListItem/index.js +0 -44
- package/dist/core/ListItemAction/index.d.ts +0 -11
- package/dist/core/ListItemAction/index.js +0 -13
- package/dist/core/ListItemActions/index.d.ts +0 -8
- package/dist/core/ListItemActions/index.js +0 -16
- package/dist/core/ListItemMetaItem/index.d.ts +0 -19
- package/dist/core/ListItemMetaItem/index.js +0 -29
- package/dist/core/ListItemTitle/index.d.ts +0 -19
- package/dist/core/ListItemTitle/index.js +0 -44
- package/dist/core/Loader/index.d.ts +0 -15
- package/dist/core/Loader/index.js +0 -16
- package/dist/core/MeActions/index.d.ts +0 -3
- package/dist/core/MeActions/index.js +0 -48
- package/dist/core/MePanel/index.d.ts +0 -19
- package/dist/core/MePanel/index.js +0 -29
- package/dist/core/ModalComponent/index.d.ts +0 -22
- package/dist/core/ModalComponent/index.js +0 -29
- package/dist/core/Navigation/index.d.ts +0 -3
- package/dist/core/Navigation/index.js +0 -33
- package/dist/core/NavigationDivider/index.d.ts +0 -3
- package/dist/core/NavigationDivider/index.js +0 -8
- package/dist/core/NavigationItem/index.d.ts +0 -16
- package/dist/core/NavigationItem/index.js +0 -21
- package/dist/core/Pagination/index.d.ts +0 -15
- package/dist/core/Pagination/index.js +0 -64
- package/dist/core/PaginationItem/index.d.ts +0 -10
- package/dist/core/PaginationItem/index.js +0 -17
- package/dist/core/Panel/index.d.ts +0 -17
- package/dist/core/Panel/index.js +0 -13
- package/dist/core/PasswordForgotForm/index.d.ts +0 -7
- package/dist/core/PasswordForgotForm/index.js +0 -40
- package/dist/core/PasswordResetForm/index.d.ts +0 -7
- package/dist/core/PasswordResetForm/index.js +0 -34
- package/dist/core/RadialProgress/index.d.ts +0 -16
- package/dist/core/RadialProgress/index.js +0 -23
- package/dist/core/SettingsForm/index.d.ts +0 -3
- package/dist/core/SettingsForm/index.js +0 -14
- package/dist/core/StaticTextInput/index.d.ts +0 -29
- package/dist/core/StaticTextInput/index.js +0 -39
- package/dist/core/Styled/index.d.ts +0 -6
- package/dist/core/Styled/index.js +0 -39
- package/dist/core/SummaryListItem/index.d.ts +0 -23
- package/dist/core/SummaryListItem/index.js +0 -31
- package/dist/core/TabItem/index.d.ts +0 -4
- package/dist/core/TabItem/index.js +0 -13
- package/dist/core/TableActionsCell/index.d.ts +0 -8
- package/dist/core/TableActionsCell/index.js +0 -8
- package/dist/core/TableCell/index.d.ts +0 -15
- package/dist/core/TableCell/index.js +0 -20
- package/dist/core/TableHead/index.d.ts +0 -18
- package/dist/core/TableHead/index.js +0 -18
- package/dist/core/TableRow/index.d.ts +0 -13
- package/dist/core/TableRow/index.js +0 -18
- package/dist/core/Tabs/index.d.ts +0 -7
- package/dist/core/Tabs/index.js +0 -13
- package/dist/core/TextInputAncillary/index.d.ts +0 -29
- package/dist/core/TextInputAncillary/index.js +0 -31
- package/dist/core/Toast/index.d.ts +0 -3
- package/dist/core/Toast/index.js +0 -47
- package/dist/core/TwoFactor/index.d.ts +0 -13
- package/dist/core/TwoFactor/index.js +0 -49
- package/dist/core/TwoFactorAuthenticator/index.d.ts +0 -10
- package/dist/core/TwoFactorAuthenticator/index.js +0 -9
- package/dist/core/TwoFactorMethodList/index.d.ts +0 -10
- package/dist/core/TwoFactorMethodList/index.js +0 -22
- package/dist/core/TwoFactorSetup/index.d.ts +0 -12
- package/dist/core/TwoFactorSetup/index.js +0 -43
- package/dist/core/TwoFactorSetupAuthenticator/index.d.ts +0 -20
- package/dist/core/TwoFactorSetupAuthenticator/index.js +0 -42
- package/dist/core/TwoFactorSetupYubikey/index.d.ts +0 -16
- package/dist/core/TwoFactorSetupYubikey/index.js +0 -14
- package/dist/core/TwoFactorYubikey/index.d.ts +0 -9
- package/dist/core/TwoFactorYubikey/index.js +0 -14
- package/dist/core/WeekCalendarDay/index.d.ts +0 -27
- package/dist/core/WeekCalendarDay/index.js +0 -35
- package/dist/core/YubikeyInput/index.d.ts +0 -4
- package/dist/core/YubikeyInput/index.js +0 -14
- package/dist/filters/BooleanFilter/index.d.ts +0 -14
- package/dist/filters/BooleanFilter/index.js +0 -35
- package/dist/filters/DateFilter/index.d.ts +0 -5
- package/dist/filters/DateFilter/index.js +0 -24
- package/dist/filters/DropdownFilter/index.d.ts +0 -17
- package/dist/filters/DropdownFilter/index.js +0 -32
- package/dist/filters/QuickDateFilter/index.d.ts +0 -13
- package/dist/filters/QuickDateFilter/index.js +0 -40
- package/dist/filters/interfaces.d.ts +0 -35
- package/dist/hooks/useAlert.d.ts +0 -12
- package/dist/hooks/useAlert.js +0 -18
- package/dist/hooks/useAppConfig.d.ts +0 -3
- package/dist/hooks/useAppConfig.js +0 -5
- package/dist/hooks/useConnectedList.d.ts +0 -7
- package/dist/hooks/useConnectedList.js +0 -6
- package/dist/hooks/useConnectedRepeater.d.ts +0 -7
- package/dist/hooks/useConnectedRepeater.js +0 -14
- package/dist/hooks/useConnectedTable.d.ts +0 -7
- package/dist/hooks/useConnectedTable.js +0 -6
- package/dist/hooks/useFilters.d.ts +0 -9
- package/dist/hooks/useFilters.js +0 -24
- package/dist/hooks/useLayout.d.ts +0 -7
- package/dist/hooks/useLayout.js +0 -10
- package/dist/hooks/useLayout.spec.d.ts +0 -1
- package/dist/hooks/useLayout.spec.js +0 -24
- package/dist/hooks/useModal.d.ts +0 -12
- package/dist/hooks/useModal.js +0 -39
- package/dist/hooks/useModalOffset.d.ts +0 -2
- package/dist/hooks/useModalOffset.js +0 -16
- package/dist/hooks/useModalOffset.spec.d.ts +0 -1
- package/dist/hooks/useModalOffset.spec.js +0 -19
- package/dist/hooks/useNavigation.d.ts +0 -7
- package/dist/hooks/useNavigation.js +0 -113
- package/dist/hooks/useRemote.d.ts +0 -7
- package/dist/hooks/useRemote.js +0 -29
- package/dist/hooks/useVariant.d.ts +0 -9
- package/dist/hooks/useVariant.js +0 -14
- package/dist/scenes/Error404Scene.d.ts +0 -3
- package/dist/scenes/Error404Scene.js +0 -5
- package/dist/services/AppService.d.ts +0 -5
- package/dist/services/AppService.js +0 -11
- package/dist/services/ConfirmService.d.ts +0 -12
- package/dist/services/ConfirmService.js +0 -10
- package/dist/services/DateService.d.ts +0 -26
- package/dist/services/DateService.js +0 -132
- package/dist/services/DateService.spec.d.ts +0 -1
- package/dist/services/DateService.spec.js +0 -83
- package/dist/services/DownloadService.d.ts +0 -7
- package/dist/services/DownloadService.js +0 -16
- package/dist/services/DownloadService.spec.d.ts +0 -1
- package/dist/services/DownloadService.spec.js +0 -18
- package/dist/services/FilterComponentService.d.ts +0 -25
- package/dist/services/FilterComponentService.js +0 -54
- package/dist/services/FilterService.d.ts +0 -34
- package/dist/services/FilterService.js +0 -58
- package/dist/services/FilterService.spec.d.ts +0 -1
- package/dist/services/FilterService.spec.js +0 -67
- package/dist/services/FormatService.d.ts +0 -11
- package/dist/services/FormatService.js +0 -45
- package/dist/services/FormatService.spec.d.ts +0 -1
- package/dist/services/FormatService.spec.js +0 -66
- package/dist/services/ToastService.d.ts +0 -7
- package/dist/services/ToastService.js +0 -17
- package/dist/services/ToastService.spec.d.ts +0 -1
- package/dist/services/ToastService.spec.js +0 -34
- package/dist/utility/MockRouter/index.d.ts +0 -2
- package/dist/utility/MockRouter/index.js +0 -37
- package/dist/utility/StorybookPanel/index.d.ts +0 -14
- package/dist/utility/StorybookPanel/index.js +0 -12
- package/dist/utility/TestChangeHandler/index.d.ts +0 -15
- package/dist/utility/TestChangeHandler/index.js +0 -30
- package/dist/utility/icons.d.ts +0 -3
- package/dist/utility/icons.js +0 -12
- package/dist/utility/interfaces.d.ts +0 -79
- package/dist/utility/interfaces.js +0 -18
- package/dist/utility/middleware.d.ts +0 -4
- package/dist/utility/middleware.js +0 -9
- package/dist/utility/prop-types.d.ts +0 -57
- package/dist/utility/prop-types.js +0 -77
- package/dist/utility/register.d.ts +0 -3
- package/dist/utility/register.js +0 -9
- package/src/components/Alert/index.tsx +0 -111
- package/src/components/Allow/Allow.spec.tsx +0 -37
- package/src/components/Allow/index.tsx +0 -42
- package/src/components/AppLayout/AppLayout.stories.tsx +0 -20
- package/src/components/AutoSuggest/AutoSuggest.module.css +0 -8
- package/src/components/AutoSuggest/AutoSuggest.spec.tsx +0 -222
- package/src/components/AutoSuggest/AutoSuggest.story.tsx +0 -32
- package/src/components/AutoSuggest/index.tsx +0 -215
- package/src/components/Button/Button.spec.tsx +0 -61
- package/src/components/Button/Button.stories.tsx +0 -62
- package/src/components/Button/index.tsx +0 -15
- package/src/components/CalendarInput/CalendarInput.module.css +0 -8
- package/src/components/CalendarInput/CalendarInput.spec.tsx +0 -222
- package/src/components/CalendarInput/CalendarInput.story.tsx +0 -62
- package/src/components/CalendarInput/index.tsx +0 -126
- package/src/components/CheckboxList/CheckboxList.spec.tsx +0 -93
- package/src/components/CheckboxList/index.tsx +0 -51
- package/src/components/ConnectedDropdown/index.tsx +0 -53
- package/src/components/ConnectedList/index.tsx +0 -19
- package/src/components/ConnectedTable/index.tsx +0 -21
- package/src/components/ContentBlock/ContentBlock.module.css +0 -17
- package/src/components/ContentBlock/ContentBlock.spec.tsx +0 -25
- package/src/components/ContentBlock/index.tsx +0 -28
- package/src/components/DataPanel/index.tsx +0 -25
- package/src/components/DateInput/DateInput.module.css +0 -15
- package/src/components/DateInput/DateInput.spec.tsx +0 -87
- package/src/components/DateInput/index.tsx +0 -145
- package/src/components/ErrorMessage/ErrorMessage.module.css +0 -25
- package/src/components/ErrorMessage/ErrorMessage.spec.tsx +0 -31
- package/src/components/ErrorMessage/index.tsx +0 -36
- package/src/components/Fieldset/Fieldset.spec.tsx +0 -22
- package/src/components/Fieldset/Fieldset.story.tsx +0 -25
- package/src/components/Fieldset/index.tsx +0 -32
- package/src/components/FileInput/FileInput.module.css +0 -18
- package/src/components/FileInput/FileInput.spec.tsx +0 -52
- package/src/components/FileInput/FileInput.story.tsx +0 -8
- package/src/components/FileInput/index.tsx +0 -75
- package/src/components/FilterLink/FilterLink.module.css +0 -9
- package/src/components/FilterLink/FilterLink.spec.tsx +0 -34
- package/src/components/FilterLink/index.tsx +0 -36
- package/src/components/Form/Form.spec.tsx +0 -39
- package/src/components/Form/index.tsx +0 -25
- package/src/components/FormActions/FormActions.spec.tsx +0 -10
- package/src/components/FormActions/FormActions.story.tsx +0 -27
- package/src/components/FormActions/index.tsx +0 -35
- package/src/components/FormField/FormField.module.css +0 -71
- package/src/components/FormField/FormField.spec.tsx +0 -177
- package/src/components/FormField/FormField.stories.tsx +0 -44
- package/src/components/FormField/index.tsx +0 -14
- package/src/components/FormRepeater/FormRepeater.module.css +0 -7
- package/src/components/FormRepeater/FormRepeater.spec.tsx +0 -156
- package/src/components/FormRepeater/index.tsx +0 -121
- package/src/components/ImageInput/ImageInput.module.css +0 -74
- package/src/components/ImageInput/ImageInput.spec.tsx +0 -47
- package/src/components/ImageInput/ImageInput.story.tsx +0 -8
- package/src/components/ImageInput/index.tsx +0 -93
- package/src/components/InfoPanel/InfoPanel.module.css +0 -20
- package/src/components/InfoPanel/InfoPanel.spec.tsx +0 -15
- package/src/components/InfoPanel/InfoPanel.story.tsx +0 -32
- package/src/components/InfoPanel/index.tsx +0 -25
- package/src/components/Link/Link.spec.tsx +0 -64
- package/src/components/Link/__mocks__/index.tsx +0 -24
- package/src/components/Link/index.tsx +0 -60
- package/src/components/List/List.module.css +0 -9
- package/src/components/List/List.spec.tsx +0 -379
- package/src/components/List/List.story.tsx +0 -119
- package/src/components/ListActions/ListActions.spec.tsx +0 -10
- package/src/components/ListActions/ListActions.story.tsx +0 -8
- package/src/components/LoginForm/LoginForm.spec.tsx +0 -68
- package/src/components/LoginForm/LoginForm.story.tsx +0 -25
- package/src/components/Message/Message.module.css +0 -14
- package/src/components/Message/Message.spec.tsx +0 -20
- package/src/components/Message/index.tsx +0 -29
- package/src/components/Modal/index.tsx +0 -27
- package/src/components/ModalActions/ModalActions.module.css +0 -5
- package/src/components/ModalActions/ModalActions.spec.tsx +0 -49
- package/src/components/ModalActions/ModalActions.story.tsx +0 -8
- package/src/components/ModalActions/index.tsx +0 -51
- package/src/components/MoneyInput/MoneyInput.spec.tsx +0 -17
- package/src/components/MoneyInput/MoneyInput.story.tsx +0 -8
- package/src/components/MoneyInput/index.tsx +0 -18
- package/src/components/PasswordForm/index.tsx +0 -36
- package/src/components/RadioList/RadioList.spec.tsx +0 -47
- package/src/components/RadioList/index.tsx +0 -19
- package/src/components/SummaryList/SummaryList.module.css +0 -31
- package/src/components/SummaryList/SummaryList.spec.tsx +0 -89
- package/src/components/SummaryList/SummaryList.story.tsx +0 -13
- package/src/components/SummaryList/index.tsx +0 -39
- package/src/components/Switch/Switch.module.css +0 -86
- package/src/components/Switch/Switch.spec.tsx +0 -64
- package/src/components/Switch/index.tsx +0 -89
- package/src/components/Table/Table.module.css +0 -14
- package/src/components/Table/Table.spec.tsx +0 -136
- package/src/components/Table/Table.story.tsx +0 -108
- package/src/components/TextArea/TextArea.module.css +0 -23
- package/src/components/TextArea/TextArea.spec.tsx +0 -77
- package/src/components/TextArea/index.tsx +0 -61
- package/src/components/TextInput/TextInput.module.css +0 -62
- package/src/components/TextInput/TextInput.spec.tsx +0 -127
- package/src/components/TextInput/TextInput.stories.tsx +0 -46
- package/src/components/TextInput/index.tsx +0 -11
- package/src/components/WebsiteInput/WebsiteInput.spec.tsx +0 -17
- package/src/components/WebsiteInput/index.tsx +0 -18
- package/src/components/WeekCalendar/WeekCalendar.module.css +0 -19
- package/src/components/WeekCalendar/index.tsx +0 -80
- package/src/core/AlertComponent/AlertComponent.module.css +0 -110
- package/src/core/AlertComponent/AlertComponent.spec.tsx +0 -85
- package/src/core/AlertComponent/AlertComponent.story.tsx +0 -29
- package/src/core/AlertComponent/index.tsx +0 -109
- package/src/core/AppHeader/index.tsx +0 -25
- package/src/core/AppLogo/AppLogo.module.css +0 -18
- package/src/core/AppLogo/index.tsx +0 -35
- package/src/core/AppLogoImage/index.tsx +0 -19
- package/src/core/AppLogoPlaceholder/index.tsx +0 -32
- package/src/core/Assistive/index.tsx +0 -1
- package/src/core/AuthForm/AuthForm.module.css +0 -35
- package/src/core/AuthForm/AuthForm.spec.tsx +0 -72
- package/src/core/AuthForm/index.tsx +0 -63
- package/src/core/Banner/Banner.module.css +0 -34
- package/src/core/Banner/index.tsx +0 -25
- package/src/core/Calendar/index.tsx +0 -118
- package/src/core/CalendarDay/CalendarDay.module.css +0 -61
- package/src/core/CalendarDay/index.tsx +0 -82
- package/src/core/CalendarMonth/CalendarMonth.module.css +0 -13
- package/src/core/CalendarMonth/index.tsx +0 -103
- package/src/core/CalendarNavigation/CalendarNavigation.module.css +0 -26
- package/src/core/CalendarNavigation/index.tsx +0 -55
- package/src/core/CalendarWeek/index.tsx +0 -97
- package/src/core/ChkRadList/ChkRadList.module.css +0 -12
- package/src/core/ChkRadList/index.tsx +0 -88
- package/src/core/CloseButton/CloseButton.spec.tsx +0 -38
- package/src/core/CloseButton/index.tsx +0 -33
- package/src/core/ConfirmModal/ConfirmModal.spec.tsx +0 -94
- package/src/core/ConfirmModal/index.tsx +0 -59
- package/src/core/ConnectedRepeater/index.tsx +0 -284
- package/src/core/ConnectedRepeaterComponent/index.tsx +0 -71
- package/src/core/Container/Container.module.css +0 -13
- package/src/core/Container/index.tsx +0 -29
- package/src/core/DataPanelItem/index.tsx +0 -19
- package/src/core/EmptyMessage/EmptyMessage.module.css +0 -18
- package/src/core/EmptyMessage/EmptyMessage.stories.tsx +0 -33
- package/src/core/EmptyMessage/index.tsx +0 -15
- package/src/core/FilterItem/FilterItem.module.css +0 -104
- package/src/core/FilterItem/index.tsx +0 -172
- package/src/core/Filters/Filters.module.css +0 -86
- package/src/core/Filters/Filters.spec.tsx +0 -573
- package/src/core/Filters/index.tsx +0 -168
- package/src/core/FixedActions/FixedActions.module.css +0 -23
- package/src/core/FixedActions/FixedActions.spec.tsx +0 -53
- package/src/core/FixedActions/index.tsx +0 -54
- package/src/core/FormLegend/FormLegend.module.css +0 -13
- package/src/core/FormLegend/index.tsx +0 -18
- package/src/core/Header/Header.stories.tsx +0 -20
- package/src/core/Header/index.tsx +0 -32
- package/src/core/Icon/Icon.spec.tsx +0 -30
- package/src/core/Icon/index.tsx +0 -70
- package/src/core/IconButton/IconButton.module.css +0 -32
- package/src/core/IconButton/index.tsx +0 -53
- package/src/core/ListItem/ListItem.module.css +0 -28
- package/src/core/ListItem/ListItem.story.tsx +0 -32
- package/src/core/ListItem/index.tsx +0 -109
- package/src/core/ListItemAction/ListItemAction.module.css +0 -33
- package/src/core/ListItemAction/index.tsx +0 -30
- package/src/core/ListItemActions/ListItemActions.module.css +0 -94
- package/src/core/ListItemActions/index.tsx +0 -42
- package/src/core/ListItemMetaItem/ListItemMetaItem.module.css +0 -18
- package/src/core/ListItemMetaItem/index.tsx +0 -54
- package/src/core/ListItemTitle/ListItemTitle.module.css +0 -22
- package/src/core/ListItemTitle/ListItemTitle.spec.tsx +0 -53
- package/src/core/ListItemTitle/index.tsx +0 -82
- package/src/core/Loader/Loader.module.css +0 -57
- package/src/core/Loader/Loader.stories.tsx +0 -22
- package/src/core/Loader/index.tsx +0 -2
- package/src/core/MeActions/MeActions.module.css +0 -47
- package/src/core/MeActions/index.tsx +0 -74
- package/src/core/MePanel/MePanel.module.css +0 -79
- package/src/core/MePanel/index.tsx +0 -58
- package/src/core/ModalComponent/ModalComponent.module.css +0 -86
- package/src/core/ModalComponent/ModalComponent.spec.tsx +0 -55
- package/src/core/ModalComponent/index.tsx +0 -66
- package/src/core/Navigation/Navigation.module.css +0 -89
- package/src/core/Navigation/Navigation.spec.tsx +0 -121
- package/src/core/Navigation/index.tsx +0 -69
- package/src/core/NavigationDivider/NavigationDivider.module.css +0 -3
- package/src/core/NavigationDivider/index.tsx +0 -13
- package/src/core/NavigationItem/NavigationItem.module.css +0 -46
- package/src/core/NavigationItem/index.tsx +0 -50
- package/src/core/Panel/Panel.module.css +0 -26
- package/src/core/Panel/Panel.spec.tsx +0 -16
- package/src/core/Panel/index.tsx +0 -35
- package/src/core/PasswordForgotForm/index.tsx +0 -62
- package/src/core/PasswordResetForm/index.tsx +0 -65
- package/src/core/RadialProgress/RadialProgress.module.css +0 -78
- package/src/core/RadialProgress/index.tsx +0 -49
- package/src/core/SettingsForm/index.tsx +0 -26
- package/src/core/SummaryListItem/SummaryListItem.module.css +0 -20
- package/src/core/SummaryListItem/index.tsx +0 -65
- package/src/core/TabItem/TabItem.module.css +0 -28
- package/src/core/TabItem/index.tsx +0 -42
- package/src/core/Tabs/Tabs.module.css +0 -19
- package/src/core/Tabs/Tabs.spec.tsx +0 -30
- package/src/core/Tabs/index.tsx +0 -36
- package/src/core/Toast/Toast.module.css +0 -54
- package/src/core/Toast/Toast.spec.tsx +0 -80
- package/src/core/Toast/index.tsx +0 -79
- package/src/core/TwoFactor/TwoFactor.spec.tsx +0 -183
- package/src/core/TwoFactor/index.tsx +0 -102
- package/src/core/TwoFactorAuthenticator/index.tsx +0 -39
- package/src/core/TwoFactorMethodList/TwoFactorMethodList.module.css +0 -50
- package/src/core/TwoFactorMethodList/index.tsx +0 -49
- package/src/core/TwoFactorSetup/index.tsx +0 -91
- package/src/core/TwoFactorSetupAuthenticator/TwoFactorSetupAuthenticator.module.css +0 -6
- package/src/core/TwoFactorSetupAuthenticator/index.tsx +0 -100
- package/src/core/TwoFactorSetupYubikey/index.tsx +0 -49
- package/src/core/TwoFactorYubikey/index.tsx +0 -41
- package/src/core/WeekCalendarDay/WeekCalendarDay.module.css +0 -32
- package/src/core/WeekCalendarDay/index.tsx +0 -68
- package/src/core/YubikeyInput/YubikeyInput.module.css +0 -27
- package/src/core/YubikeyInput/YubikeyInput.spec.tsx +0 -77
- package/src/core/YubikeyInput/index.tsx +0 -76
- package/src/filters/BooleanFilter/index.tsx +0 -47
- package/src/filters/DateFilter/index.tsx +0 -36
- package/src/filters/DropdownFilter/index.tsx +0 -51
- package/src/filters/QuickDateFilter/index.tsx +0 -74
- package/src/filters/interfaces.ts +0 -39
- package/src/hooks/useAlert.spec.tsx +0 -72
- package/src/hooks/useAlert.ts +0 -37
- package/src/hooks/useConfig.ts +0 -31
- package/src/hooks/useConnectedList.ts +0 -15
- package/src/hooks/useConnectedRepeater.ts +0 -25
- package/src/hooks/useConnectedTable.ts +0 -15
- package/src/hooks/useFilters.ts +0 -34
- package/src/hooks/useLayout.spec.ts +0 -31
- package/src/hooks/useLayout.ts +0 -23
- package/src/hooks/useModal.spec.tsx +0 -72
- package/src/hooks/useModal.ts +0 -62
- package/src/hooks/useModalOffset.spec.ts +0 -27
- package/src/hooks/useModalOffset.ts +0 -26
- package/src/hooks/useNavigation.ts +0 -160
- package/src/hooks/useRemote.ts +0 -43
- package/src/scenes/Error404Scene.tsx +0 -7
- package/src/services/AppService.ts +0 -16
- package/src/services/ConfirmService.ts +0 -26
- package/src/services/DateService.spec.ts +0 -102
- package/src/services/DateService.ts +0 -182
- package/src/services/DownloadService.spec.ts +0 -23
- package/src/services/DownloadService.ts +0 -21
- package/src/services/FilterComponentService.tsx +0 -67
- package/src/services/FilterService.spec.ts +0 -105
- package/src/services/FilterService.ts +0 -80
- package/src/services/FormatService.spec.ts +0 -85
- package/src/services/FormatService.ts +0 -60
- package/src/services/ToastService.spec.ts +0 -44
- package/src/services/ToastService.ts +0 -24
- package/src/typings.d.ts +0 -4
- package/src/utility/MockRouter/index.ts +0 -46
- package/src/utility/icons.tsx +0 -51
- package/src/utility/interfaces.ts +0 -142
- package/src/utility/middleware.ts +0 -10
- package/src/utility/prop-types.ts +0 -89
- package/src/utility/register.tsx +0 -11
- package/tsconfig.eslint.json +0 -4
- /package/dist/{filters/interfaces.js → interfaces.js} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import GridListItem from '../GridListItem';
|
|
3
|
+
import List from '../List';
|
|
4
|
+
function GridList(props) {
|
|
5
|
+
return _jsx(List, { ...props, className: "grid grid-cols-3 gap-6", renderItem: GridListItem });
|
|
6
|
+
}
|
|
7
|
+
export default GridList;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Link } from '@sqrzro/components';
|
|
3
|
+
import { renderMeta } from '../ListItem';
|
|
4
|
+
function GridListItem({ actions: Actions, href, id, image, meta, title, }) {
|
|
5
|
+
return (_jsx("li", { children: _jsxs("article", { className: "overflow-hidden rounded-md bg-white p-4 shadow", children: [image ? _jsx("img", { alt: "", className: "mb-4 border border-gray-200", src: image }) : null, _jsx("h2", { className: "text-base font-semibold", children: href ? _jsx(Link, { href: href, children: title }) : title }), meta || Actions ? _jsx("hr", { className: "my-4" }) : null, _jsxs("div", { className: "flex items-center justify-between", children: [meta ? renderMeta(meta) : null, Actions ? _jsx(Actions, { id: id }) : null] })] }) }));
|
|
6
|
+
}
|
|
7
|
+
export default GridListItem;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type IconType = 'error' | 'info' | 'success' | 'warning';
|
|
3
|
+
declare const icons: Record<IconType, () => React.ReactElement>;
|
|
4
|
+
export interface IconProps {
|
|
5
|
+
type?: keyof typeof icons;
|
|
6
|
+
}
|
|
7
|
+
declare function Icon({ type }: Readonly<IconProps>): React.ReactElement | null;
|
|
8
|
+
export default Icon;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ErrorIcon from '../../icons/ErrorIcon';
|
|
3
|
+
import InfoIcon from '../../icons/InfoIcon';
|
|
4
|
+
import SuccessIcon from '../../icons/SuccessIcon';
|
|
5
|
+
import WarningIcon from '../../icons/WarningIcon';
|
|
6
|
+
const icons = {
|
|
7
|
+
error: ErrorIcon,
|
|
8
|
+
info: InfoIcon,
|
|
9
|
+
success: SuccessIcon,
|
|
10
|
+
warning: WarningIcon,
|
|
11
|
+
};
|
|
12
|
+
function Icon({ type }) {
|
|
13
|
+
if (!type) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const IconComponent = icons[type];
|
|
17
|
+
if (!IconComponent) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return _jsx(IconComponent, {});
|
|
21
|
+
}
|
|
22
|
+
export default Icon;
|
|
@@ -1,36 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
isDisabled?: boolean;
|
|
9
|
-
pagination?: {
|
|
10
|
-
activePage: number;
|
|
11
|
-
pageCount: number;
|
|
12
|
-
} | null;
|
|
13
|
-
transformer?: TransformerWithActions<T>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ErrorablePromise } from '@sqrzro/server';
|
|
3
|
+
import type { FilterMap } from '../FilterBar';
|
|
4
|
+
import type { ListObject } from '../ListItem';
|
|
5
|
+
export interface ListComponentProps {
|
|
6
|
+
params?: Record<string, string>;
|
|
7
|
+
searchParams?: Record<string, string>;
|
|
14
8
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
declare namespace List {
|
|
27
|
-
var propTypes: {
|
|
28
|
-
data: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{}>>[]>;
|
|
29
|
-
isDisabled: PropTypes.Requireable<boolean>;
|
|
30
|
-
pagination: PropTypes.Requireable<PropTypes.InferProps<{
|
|
31
|
-
activePage: PropTypes.Validator<number>;
|
|
32
|
-
pageCount: PropTypes.Validator<number>;
|
|
33
|
-
}>>;
|
|
34
|
-
};
|
|
9
|
+
export interface ListProps<T> {
|
|
10
|
+
actions?: ({ id }: {
|
|
11
|
+
readonly id: number;
|
|
12
|
+
}) => React.ReactElement;
|
|
13
|
+
className?: string;
|
|
14
|
+
filters?: FilterMap;
|
|
15
|
+
fn: (params?: Record<string, string>, searchParams?: Record<string, string>) => ErrorablePromise<T[]>;
|
|
16
|
+
renderItem?: (props: ListObject) => React.ReactElement;
|
|
17
|
+
params?: Record<string, string>;
|
|
18
|
+
searchParams?: Record<string, string>;
|
|
19
|
+
transformer?: (item: T) => ListObject;
|
|
35
20
|
}
|
|
21
|
+
declare function List<T extends object>({ actions, className, filters, fn, params, renderItem, searchParams, transformer, }: Readonly<ListProps<T>>): Promise<React.ReactElement>;
|
|
36
22
|
export default List;
|
|
@@ -1,46 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Displays a list of items. Each item in the `data` prop is passed through the `transformer`
|
|
20
|
-
* function and then displayed. For more information about what `transformer` options are
|
|
21
|
-
* available, take a look at the `ListItem` documentation.
|
|
22
|
-
*
|
|
23
|
-
* The only value that is required for each transformed item is an `$id` as this is used for the
|
|
24
|
-
* `key` prop.
|
|
25
|
-
*
|
|
26
|
-
* If there is no data, an `EmptyMessage` is displayed.
|
|
27
|
-
*/
|
|
28
|
-
function List({ data, empty, pagination, transformer, isDisabled, }) {
|
|
29
|
-
if (!data?.length) {
|
|
30
|
-
return React.createElement(EmptyMessage, { ...empty });
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { EmptyMessage } from '@sqrzro/components';
|
|
5
|
+
import FilterBar from '../FilterBar';
|
|
6
|
+
import ListItem from '../ListItem';
|
|
7
|
+
function defaultTransformer() {
|
|
8
|
+
return {
|
|
9
|
+
id: 0,
|
|
10
|
+
title: '',
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
async function List({ actions, className, filters, fn, params, renderItem = ListItem, searchParams, transformer, }) {
|
|
14
|
+
const [response, error] = await fn(params, searchParams);
|
|
15
|
+
if (error) {
|
|
16
|
+
return _jsx("div", { children: "ERRORROROR" });
|
|
31
17
|
}
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
React.createElement(ListItem, { ...item }))))),
|
|
36
|
-
pagination ? React.createElement(Pagination, { isDisabled: isDisabled, ...pagination }) : null));
|
|
18
|
+
const data = response.map(transformer || defaultTransformer);
|
|
19
|
+
const hasFilters = Boolean(Object.keys(searchParams || []).length);
|
|
20
|
+
return (_jsxs(Fragment, { children: [filters && (data.length || hasFilters) ? _jsx(FilterBar, { map: filters }) : null, data.length ? (_jsx("ul", { className: clsx(className), children: data.map((item) => renderItem({ actions, ...item })) })) : (_jsx(EmptyMessage, {}))] }));
|
|
37
21
|
}
|
|
38
|
-
List.propTypes = {
|
|
39
|
-
data: PropTypes.arrayOf(PropTypes.shape({}).isRequired),
|
|
40
|
-
isDisabled: PropTypes.bool,
|
|
41
|
-
pagination: PropTypes.shape({
|
|
42
|
-
activePage: PropTypes.number.isRequired,
|
|
43
|
-
pageCount: PropTypes.number.isRequired,
|
|
44
|
-
}),
|
|
45
|
-
};
|
|
46
22
|
export default List;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ConfirmableAction } from '@sqrzro/interfaces';
|
|
3
|
+
interface ListActionProps extends ConfirmableAction<number> {
|
|
4
|
+
id: number;
|
|
5
|
+
}
|
|
6
|
+
declare function ListAction({ id, onClick, label, variant, }: Readonly<ListActionProps>): React.ReactElement;
|
|
7
|
+
export default ListAction;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ConfirmableButton } from '@sqrzro/components';
|
|
3
|
+
function ListAction({ id, onClick, label, variant, }) {
|
|
4
|
+
function handleClick() {
|
|
5
|
+
onClick(id);
|
|
6
|
+
}
|
|
7
|
+
return (_jsx(ConfirmableButton, { onClick: handleClick, variant: variant, isText: true, children: label }));
|
|
8
|
+
}
|
|
9
|
+
export default ListAction;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
interface ListActionsProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
7
|
-
to?: string;
|
|
8
|
-
}
|
|
9
|
-
declare function ListActions({ children, label, to, onClick }: ListActionsProps): React.ReactElement;
|
|
10
|
-
declare namespace ListActions {
|
|
11
|
-
var propTypes: {
|
|
12
|
-
label: PropTypes.Validator<string>;
|
|
13
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
14
|
-
to: PropTypes.Requireable<string>;
|
|
15
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
-
};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ConfirmableAction } from '@sqrzro/interfaces';
|
|
3
|
+
export interface ListActionsProps {
|
|
4
|
+
actions: ConfirmableAction<number>[];
|
|
5
|
+
id: number;
|
|
17
6
|
}
|
|
7
|
+
declare function ListActions({ actions, id }: Readonly<ListActionsProps>): React.ReactElement;
|
|
18
8
|
export default ListActions;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
function ListActions({
|
|
6
|
-
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useClickOutside } from '@sqrzro/hooks';
|
|
4
|
+
import ListAction from '../ListAction';
|
|
5
|
+
function ListActions({ actions, id }) {
|
|
6
|
+
const [isOpen, setIsOpen, ref] = useClickOutside();
|
|
7
|
+
function toggleIsOpen() {
|
|
8
|
+
setIsOpen(!isOpen);
|
|
9
|
+
}
|
|
10
|
+
return (_jsxs("div", { ref: ref, className: "flex flex-row-reverse items-center gap-4", children: [_jsxs("button", { className: "h-4 rotate-90 text-xs leading-[1em] tracking-tighter text-slate-500", onClick: toggleIsOpen, type: "button", children: ["\u2022\u2022\u2022", _jsxs("span", { className: "sr-only", children: [isOpen ? 'Close' : 'Open', " Actions"] })] }), isOpen ? (_jsx("ul", { className: "showpanel relative flex origin-right gap-4 bg-white before:absolute before:left-[-999em] before:right-full before:h-full before:bg-white/80", children: actions.map(({ label, onClick, variant }) => (_jsx("li", { children: _jsx(ListAction, { id: id, label: label, onClick: onClick, variant: variant }) }, label))) })) : null] }));
|
|
7
11
|
}
|
|
8
|
-
ListActions.propTypes = {
|
|
9
|
-
label: PropTypes.string.isRequired,
|
|
10
|
-
children: PropTypes.node,
|
|
11
|
-
to: PropTypes.string,
|
|
12
|
-
onClick: PropTypes.func,
|
|
13
|
-
};
|
|
14
12
|
export default ListActions;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ListObject {
|
|
3
|
+
actions?: ({ id }: {
|
|
4
|
+
id: number;
|
|
5
|
+
}) => React.ReactElement;
|
|
6
|
+
href?: string;
|
|
7
|
+
id: number;
|
|
8
|
+
image?: string;
|
|
9
|
+
meta?: string[];
|
|
10
|
+
title: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function renderMeta(meta: Record<string, string> | string[]): React.ReactElement;
|
|
13
|
+
declare function ListItem({ actions: Actions, href, id, meta, title, }: Readonly<ListObject>): React.ReactElement;
|
|
14
|
+
export default ListItem;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Link } from '@sqrzro/components';
|
|
3
|
+
export function renderMeta(meta) {
|
|
4
|
+
if (Array.isArray(meta)) {
|
|
5
|
+
return (_jsx("ul", { className: "flex gap-4 text-xs", children: meta.map((item) => (_jsx("li", { children: item }, item))) }));
|
|
6
|
+
}
|
|
7
|
+
return (_jsx("dl", { className: "w-full text-xs", children: Object.entries(meta).map(([key, value]) => (_jsxs("div", { className: "flex justify-between p-2 odd:bg-gray-100", children: [_jsx("dt", { children: key }), _jsx("dd", { children: value })] }, key))) }));
|
|
8
|
+
}
|
|
9
|
+
function ListItem({ actions: Actions, href, id, meta, title, }) {
|
|
10
|
+
return (_jsx("li", { className: "mb-4", children: _jsxs("article", { className: "overflow-hidden rounded-md bg-white p-4 shadow", children: [_jsx("h2", { className: "font-semibold", children: href ? _jsx(Link, { href: href, children: title }) : title }), _jsxs("div", { className: "mt-2 flex items-center justify-between", children: [meta ? renderMeta(meta) : null, Actions ? _jsx(Actions, { id: id }) : null] })] }) }));
|
|
11
|
+
}
|
|
12
|
+
export default ListItem;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { UseFormReturn } from '@sqrzro/hooks';
|
|
3
|
+
import type { UserObject } from '@sqrzro/server';
|
|
4
|
+
export type LoginFormProps = UseFormReturn<UserObject>;
|
|
5
|
+
declare function LoginForm({ fieldProps, formProps }: Readonly<LoginFormProps>): React.ReactElement;
|
|
3
6
|
export default LoginForm;
|
|
@@ -1,47 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import Button from '../../components/Button';
|
|
7
|
-
import FormField from '../../components/FormField';
|
|
8
|
-
import Link from '../../components/Link';
|
|
9
|
-
import PasswordInput from '../../components/PasswordInput';
|
|
10
|
-
import TextInput from '../../components/TextInput';
|
|
11
|
-
import AuthForm from '../../core/AuthForm';
|
|
12
|
-
import TwoFactor from '../../core/TwoFactor';
|
|
13
|
-
import TwoFactorSetup from '../../core/TwoFactorSetup';
|
|
14
|
-
import useAlert from '../../hooks/useAlert';
|
|
15
|
-
import useAppConfig from '../../hooks/useAppConfig';
|
|
16
|
-
function LoginForm() {
|
|
17
|
-
const { alertProps, openAlert, closeAlert } = useAlert();
|
|
18
|
-
const { alertProps: setupAlertProps, openAlert: openSetupAlert, closeAlert: closeSetupAlert, } = useAlert();
|
|
19
|
-
const { auth, name } = useAppConfig();
|
|
20
|
-
const { fieldProps, formData, formProps, handleSubmit, isLoading, setFormData } = useLoginForm(auth, openAlert, openSetupAlert);
|
|
21
|
-
function handleKeyDown(event) {
|
|
22
|
-
if (event.key === 'Enter') {
|
|
23
|
-
handleSubmit();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function handleAlertClose() {
|
|
27
|
-
setFormData('provider', '');
|
|
28
|
-
setFormData('twofactor_code', '');
|
|
29
|
-
closeAlert();
|
|
30
|
-
closeSetupAlert();
|
|
31
|
-
}
|
|
32
|
-
return (React.createElement(Fragment, null,
|
|
33
|
-
React.createElement(Head, null,
|
|
34
|
-
React.createElement("title", null,
|
|
35
|
-
"Login | ",
|
|
36
|
-
name)),
|
|
37
|
-
React.createElement(AuthForm, { ...formProps, footer: React.createElement(Link, { to: `/auth/password${formData.identifier ? `?${auth.identifier}=${formData.identifier}` : ''}` }, "Forgot Password?") },
|
|
38
|
-
React.createElement(FormField, { ...fieldProps('identifier'), label: auth.identifierLabel, onKeyDown: handleKeyDown, render: TextInput, isAutoFocus: true }),
|
|
39
|
-
React.createElement(FormField, { ...fieldProps('password'), label: "Password", onKeyDown: handleKeyDown, render: PasswordInput }),
|
|
40
|
-
React.createElement("hr", null),
|
|
41
|
-
React.createElement(Button, { isDisabled: isLoading, type: "submit", isFullWidth: true }, isLoading ? 'Loading...' : 'Log In')),
|
|
42
|
-
React.createElement(Alert, { ...alertProps, icon: "lockClosed", onClose: handleAlertClose, title: "2-Step Authentication", variant: "warning", width: "sm" },
|
|
43
|
-
React.createElement(TwoFactor, { formData: formData, isLoading: isLoading, onSubmit: handleSubmit, setFormData: setFormData })),
|
|
44
|
-
React.createElement(Alert, { ...setupAlertProps, icon: "lockClosed", onClose: handleAlertClose, title: "Setup 2-Step Authentication", variant: "warning", width: "sm" },
|
|
45
|
-
React.createElement(TwoFactorSetup, { data: formData }))));
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Form, FormField, FormSubmit, PasswordInput, TextInput } from '@sqrzro/components';
|
|
4
|
+
function LoginForm({ fieldProps, formProps }) {
|
|
5
|
+
return (_jsxs("div", { className: "flex h-screen flex-col items-center justify-center bg-slate-800 pb-[10vh]", children: [_jsx("div", { className: "mx-auto mb-8 h-12 w-12 rounded-full border-4 border-primary" }), _jsxs("div", { className: "w-full max-w-sm rounded-lg bg-white p-8 shadow-lg", children: [_jsx("h1", { className: "mb-8 text-center text-xl font-semibold", children: "Sign in to continue" }), _jsxs(Form, { ...formProps, children: [_jsx(FormField, { label: "Email", ...fieldProps('email'), render: TextInput }), _jsx(FormField, { label: "Password", ...fieldProps('password'), render: PasswordInput }), _jsxs("div", { className: "mt-8 text-center", children: [_jsx("a", { className: "mb-6 block text-primary", href: "/#", children: "Forgot Password?" }), _jsx(FormSubmit, { isFullWidth: true, children: "Sign In" })] })] })] })] }));
|
|
46
6
|
}
|
|
47
7
|
export default LoginForm;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { removeSession } from '@sqrzro/server';
|
|
4
|
+
import { useRouter } from 'next/navigation';
|
|
5
|
+
function MeActions() {
|
|
6
|
+
const router = useRouter();
|
|
7
|
+
async function handleLogout() {
|
|
8
|
+
await removeSession();
|
|
9
|
+
router.refresh();
|
|
10
|
+
}
|
|
11
|
+
return (_jsx("button", { className: "text-xs text-gray-300", onClick: handleLogout, type: "button", children: "Log Out" }));
|
|
12
|
+
}
|
|
13
|
+
export default MeActions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { getIdFromSession } from '@sqrzro/server';
|
|
4
|
+
import MeActions from '../MeActions';
|
|
5
|
+
async function MePanel() {
|
|
6
|
+
const id = await getIdFromSession();
|
|
7
|
+
return (_jsxs("div", { className: "ml-auto flex items-center gap-3", children: [_jsxs("div", { className: "flex flex-col items-end text-white", children: [_jsx("strong", { children: id }), _jsx(MeActions, {})] }), _jsx("div", { className: "h-9 w-9 rounded-full border-4 border-gray-500" })] }));
|
|
8
|
+
}
|
|
9
|
+
export default MePanel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { LinkableAction } from '@sqrzro/interfaces';
|
|
3
|
+
export interface PageProps {
|
|
4
|
+
actions?: LinkableAction[];
|
|
5
|
+
basePath?: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
isFullWidth?: boolean;
|
|
8
|
+
tabs?: LinkableAction[];
|
|
9
|
+
title: string;
|
|
10
|
+
}
|
|
11
|
+
declare function Page({ actions, basePath, children, isFullWidth, tabs, title, }: Readonly<PageProps>): React.ReactElement;
|
|
12
|
+
export default Page;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { Container } from '@sqrzro/components';
|
|
4
|
+
import Tabs from '../Tabs';
|
|
5
|
+
function Page({ actions, basePath, children, isFullWidth, tabs, title, }) {
|
|
6
|
+
return (_jsxs(Fragment, { children: [_jsx("header", { className: "bg-gray-800 pb-32 text-white", children: _jsxs(Container, { isFullWidth: isFullWidth, children: [_jsxs("div", { className: "flex items-center justify-between py-10", children: [_jsx("h1", { className: "min-h-10 text-3xl font-semibold", children: title }), _jsx("div", { id: "page-actions" })] }), tabs ? (_jsx("div", { className: "-mt-4 mb-8", children: _jsx(Tabs, { basePath: basePath, data: tabs }) })) : null] }) }), _jsx(Container, { isFullWidth: isFullWidth, children: _jsx("div", { className: "-mt-32 flex flex-col gap-8", children: children }) })] }));
|
|
7
|
+
}
|
|
8
|
+
export default Page;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
function PageActions({ children }) {
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
const [mounted, setMounted] = useState(false);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
ref.current = document.getElementById('page-actions');
|
|
9
|
+
setMounted(true);
|
|
10
|
+
}, []);
|
|
11
|
+
return mounted && ref.current ? createPortal(children, ref.current) : null;
|
|
12
|
+
}
|
|
13
|
+
export default PageActions;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Config as ConfigObject } from '../../services/ConfigService';
|
|
3
|
+
export interface RootLayoutProps {
|
|
3
4
|
children: React.ReactNode;
|
|
5
|
+
config?: ConfigObject;
|
|
4
6
|
}
|
|
5
|
-
declare function RootLayout({ children }: RootLayoutProps): React.ReactElement;
|
|
7
|
+
declare function RootLayout({ children, config }: Readonly<RootLayoutProps>): React.ReactElement;
|
|
6
8
|
export default RootLayout;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense } from 'react';
|
|
3
|
+
import { ClassNames, Toaster, registerClassNames } from '@sqrzro/components';
|
|
4
|
+
import { setConfig } from '../../services/ConfigService';
|
|
5
|
+
import classNames from '../../styles/config';
|
|
6
|
+
import Config from '../Config';
|
|
7
|
+
function RootLayout({ children, config }) {
|
|
8
|
+
registerClassNames(classNames);
|
|
9
|
+
if (config) {
|
|
10
|
+
setConfig(config);
|
|
11
|
+
}
|
|
12
|
+
return (_jsxs("html", { lang: "en", children: [_jsx("head", {}), _jsxs("body", { children: [_jsx(Config, { data: config }), _jsx(ClassNames, { data: classNames }), children, _jsx(Suspense, { fallback: null, children: _jsx(Toaster, {}) })] })] }));
|
|
6
13
|
}
|
|
7
14
|
export default RootLayout;
|
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
columns: Columns;
|
|
8
|
-
data?: T[];
|
|
9
|
-
empty?: EmptyMessageProps;
|
|
10
|
-
isDisabled?: boolean;
|
|
11
|
-
pagination?: PaginationObject;
|
|
12
|
-
totals?: Record<string, number> | null;
|
|
13
|
-
transformer?: TransformerWithActions<T>;
|
|
14
|
-
}
|
|
15
|
-
declare function Table<T extends SimpleObject>({ columns, data, empty, isDisabled, pagination, totals, transformer, }: TableProps<T>): React.ReactElement;
|
|
16
|
-
declare namespace Table {
|
|
17
|
-
var propTypes: {
|
|
18
|
-
columns: PropTypes.Validator<NonNullable<PropTypes.InferProps<{}>>>;
|
|
19
|
-
data: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{}>>[]>;
|
|
20
|
-
isDisabled: PropTypes.Requireable<boolean>;
|
|
21
|
-
pagination: PropTypes.Requireable<PropTypes.InferProps<{
|
|
22
|
-
activePage: PropTypes.Validator<number>;
|
|
23
|
-
pageCount: PropTypes.Validator<number>;
|
|
24
|
-
}>>;
|
|
25
|
-
totals: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
26
|
-
};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ErrorablePromise } from '@sqrzro/server';
|
|
3
|
+
import type { TableClientComponentProps } from '../TableClientComponent';
|
|
4
|
+
export interface TableProps<T> extends Omit<TableClientComponentProps, 'data'> {
|
|
5
|
+
fn: (filters?: Record<string, string>) => ErrorablePromise<T[]>;
|
|
6
|
+
searchParams?: Record<string, string>;
|
|
27
7
|
}
|
|
8
|
+
declare function Table<T>({ columns, fn, searchParams, }: Readonly<TableProps<T>>): Promise<React.ReactElement>;
|
|
28
9
|
export default Table;
|
|
@@ -1,55 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
$id: String(item.id),
|
|
14
|
-
$original: item,
|
|
15
|
-
});
|
|
16
|
-
const transformData = (data, transformer) => {
|
|
17
|
-
const [transformFn, actions] = Array.isArray(transformer)
|
|
18
|
-
? transformer
|
|
19
|
-
: [transformer || defaultTransformer];
|
|
20
|
-
return data.map((item) => ({ ...transformFn(item), $actions: actions, $original: item }));
|
|
21
|
-
};
|
|
22
|
-
const transformColumns = (columns) => Object.entries(columns).map(([key, item]) => ({
|
|
23
|
-
key,
|
|
24
|
-
title: Array.isArray(item) ? item[0] : item,
|
|
25
|
-
isRightAligned: Array.isArray(item) ? item[1] : false,
|
|
26
|
-
}));
|
|
27
|
-
function Table({ columns, data, empty, isDisabled, pagination, totals, transformer, }) {
|
|
28
|
-
if (!data?.length) {
|
|
29
|
-
return React.createElement(EmptyMessage, { ...empty });
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import TableClientComponent from '../TableClientComponent';
|
|
3
|
+
function defaultTransformer(item) {
|
|
4
|
+
return {
|
|
5
|
+
id: item.id,
|
|
6
|
+
...item,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
async function Table({ columns, fn, searchParams, }) {
|
|
10
|
+
const [response, error] = await fn(searchParams);
|
|
11
|
+
if (error) {
|
|
12
|
+
return _jsx("div", { children: "Error" });
|
|
30
13
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
return (React.createElement(Fragment, null,
|
|
34
|
-
React.createElement(Panel, null,
|
|
35
|
-
React.createElement("div", { className: "/*styles.root*/" },
|
|
36
|
-
React.createElement("table", { className: "/*clsx(styles.table, isDisabled && styles.tableIsDisabled)*/" },
|
|
37
|
-
React.createElement(TableHead, { columns: transformedColumns, hasActions: Boolean(transformedData[0].$actions?.length) }),
|
|
38
|
-
React.createElement("tbody", null, transformedData.map((item) => (React.createElement(TableRow, { key: item.$id, columns: transformedColumns, data: item })))),
|
|
39
|
-
totals ? (React.createElement("tfoot", null,
|
|
40
|
-
React.createElement("tr", null,
|
|
41
|
-
React.createElement(TableCell, { value: "Totals:" }),
|
|
42
|
-
spliceArray(transformedColumns, 0, 1).map((item) => (React.createElement(TableCell, { key: item.key, isRightAligned: item.isRightAligned, value: totals[item.key].toString() })))))) : null))),
|
|
43
|
-
pagination ? React.createElement(Pagination, { isDisabled: isDisabled, ...pagination }) : null));
|
|
14
|
+
const data = response.map(defaultTransformer);
|
|
15
|
+
return _jsx(TableClientComponent, { columns: columns, data: data });
|
|
44
16
|
}
|
|
45
|
-
Table.propTypes = {
|
|
46
|
-
columns: PropTypes.shape({}).isRequired,
|
|
47
|
-
data: PropTypes.arrayOf(PropTypes.shape({}).isRequired),
|
|
48
|
-
isDisabled: PropTypes.bool,
|
|
49
|
-
pagination: PropTypes.shape({
|
|
50
|
-
activePage: PropTypes.number.isRequired,
|
|
51
|
-
pageCount: PropTypes.number.isRequired,
|
|
52
|
-
}),
|
|
53
|
-
totals: PropTypes.shape({}),
|
|
54
|
-
};
|
|
55
17
|
export default Table;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface TableItemObject {
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
interface TableColumnObject {
|
|
7
|
+
key: string;
|
|
8
|
+
title: string;
|
|
9
|
+
type?: 'string';
|
|
10
|
+
}
|
|
11
|
+
export interface TableClientComponentProps {
|
|
12
|
+
columns: TableColumnObject[];
|
|
13
|
+
data: TableItemObject[];
|
|
14
|
+
}
|
|
15
|
+
declare function TableClientComponent({ columns, data, }: Readonly<TableClientComponentProps>): React.ReactElement;
|
|
16
|
+
export default TableClientComponent;
|