@pagopa/selfcare-common-frontend 1.35.0 → 1.36.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/CHANGELOG.md +883 -1
- package/README.md +34 -8
- package/examples/locale/en.d.ts +20 -0
- package/examples/locale/en.js +18 -0
- package/examples/locale/index.js +4 -0
- package/examples/locale/it.d.ts +20 -0
- package/examples/locale/it.js +19 -0
- package/{common-polyfill.d.ts → lib/common-polyfill.d.ts} +0 -1
- package/lib/common-polyfill.js +9 -0
- package/lib/components/BackComponent.d.ts +7 -0
- package/lib/components/BackComponent.js +8 -0
- package/lib/components/CustomAlert.d.ts +12 -0
- package/lib/components/CustomAlert.js +7 -0
- package/{components → lib/components}/CustomAvatar.d.ts +2 -3
- package/lib/components/CustomAvatar.js +13 -0
- package/{components → lib/components}/CustomPagination.d.ts +7 -3
- package/lib/components/CustomPagination.js +25 -0
- package/{components → lib/components}/EndingPage.d.ts +15 -3
- package/lib/components/EndingPage.js +4 -0
- package/lib/components/ErrorBoundary/ErrorBoundary.d.ts +11 -0
- package/lib/components/ErrorBoundary/ErrorBoundary.js +93 -0
- package/{components → lib/components}/ErrorBoundary/components/BlockingErrorPage.d.ts +2 -3
- package/lib/components/ErrorBoundary/components/BlockingErrorPage.js +11 -0
- package/{components → lib/components}/FilterModal.d.ts +3 -3
- package/lib/components/FilterModal.js +29 -0
- package/{components → lib/components}/Footer/Footer.d.ts +2 -3
- package/lib/components/Footer/Footer.js +179 -0
- package/{components → lib/components}/Footer/FooterConfig.js +5 -9
- package/{components → lib/components}/Header/Header.d.ts +11 -6
- package/lib/components/Header/Header.js +45 -0
- package/{components → lib/components}/Loading/LoadingOverlay.d.ts +1 -2
- package/lib/components/Loading/LoadingOverlay.js +13 -0
- package/lib/components/LoadingOverlayComponent.d.ts +7 -0
- package/lib/components/LoadingOverlayComponent.js +25 -0
- package/{components → lib/components}/NavigationBar.d.ts +5 -4
- package/lib/components/NavigationBar.js +17 -0
- package/{components → lib/components}/SessionModal.d.ts +3 -3
- package/lib/components/SessionModal.js +17 -0
- package/{components → lib/components}/TitleBox.d.ts +7 -7
- package/lib/components/TitleBox.js +9 -0
- package/{components → lib/components}/Toast.d.ts +3 -3
- package/lib/components/Toast.js +25 -0
- package/{components → lib/components}/ToastWrapper.d.ts +2 -2
- package/lib/components/ToastWrapper.js +12 -0
- package/{components → lib/components}/UnloadEventHandler.d.ts +1 -2
- package/lib/components/UnloadEventHandler.js +29 -0
- package/{components → lib/components}/UserNotifyHandle.d.ts +1 -2
- package/lib/components/UserNotifyHandle.js +62 -0
- package/{components → lib/components}/icons/CheckIllustrationIcon.d.ts +1 -2
- package/lib/components/icons/CheckIllustrationIcon.js +3 -0
- package/lib/components/icons/ConfirmIcon.js +4 -0
- package/{components → lib/components}/icons/ErrorIcon.d.ts +1 -2
- package/lib/components/icons/ErrorIcon.js +3 -0
- package/lib/components/icons/ErrorIconExclamation.js +4 -0
- package/lib/components/icons/FaultIcon.js +4 -0
- package/{components → lib/components}/icons/PagoPaIcon.d.ts +1 -2
- package/lib/components/icons/PagoPaIcon.js +3 -0
- package/{components → lib/components}/icons/PagoPaIconColored.d.ts +1 -2
- package/lib/components/icons/PagoPaIconColored.js +3 -0
- package/{components → lib/components}/icons/PagoPaMiniIcon.d.ts +1 -2
- package/lib/components/icons/PagoPaMiniIcon.js +3 -0
- package/lib/components/tests/FilterModal.test.d.ts +1 -0
- package/lib/components/tests/FilterModal.test.js +37 -0
- package/{config → lib/config}/env.d.ts +4 -1
- package/{config → lib/config}/env.js +13 -17
- package/lib/consentManagementConfigure.d.ts +1 -0
- package/{consentManagementConfigure.js → lib/consentManagementConfigure.js} +5 -8
- package/{decorators → lib/decorators}/__mocks__/withLogin.d.ts +1 -2
- package/lib/decorators/__mocks__/withLogin.js +18 -0
- package/{decorators → lib/decorators}/withLogin.d.ts +1 -2
- package/{decorators → lib/decorators}/withLogin.js +13 -18
- package/{decorators → lib/decorators}/withRetrievedValue.d.ts +1 -1
- package/{decorators → lib/decorators}/withRetrievedValue.js +9 -14
- package/lib/hooks/useErrorDispatcher.js +7 -0
- package/{hooks → lib/hooks}/useFakePagination.d.ts +3 -3
- package/{hooks → lib/hooks}/useFakePagination.js +9 -15
- package/lib/hooks/useFocus.d.ts +1 -0
- package/lib/hooks/useFocus.js +8 -0
- package/lib/hooks/useLiveAnnouncerWithRegion.d.ts +4 -0
- package/lib/hooks/useLiveAnnouncerWithRegion.js +19 -0
- package/lib/hooks/useLoading.js +10 -0
- package/lib/hooks/useLogin.js +40 -0
- package/lib/hooks/usePermissions.d.ts +7 -0
- package/lib/hooks/usePermissions.js +25 -0
- package/lib/hooks/useReduxCachedValue.d.ts +22 -0
- package/{hooks → lib/hooks}/useReduxCachedValue.js +10 -17
- package/{hooks → lib/hooks}/useUnloadEventInterceptor.d.ts +3 -3
- package/{hooks → lib/hooks}/useUnloadEventInterceptor.js +24 -32
- package/lib/hooks/useUserNotify.js +7 -0
- package/{index.d.ts → lib/index.d.ts} +11 -8
- package/lib/index.js +36 -0
- package/{locale/it.d.ts → lib/locale/de.d.ts} +4 -1
- package/{locale → lib/locale}/de.js +31 -31
- package/{locale → lib/locale}/en.d.ts +4 -1
- package/{locale → lib/locale}/en.js +30 -30
- package/{locale → lib/locale}/fr.d.ts +5 -2
- package/{locale → lib/locale}/fr.js +26 -26
- package/{locale/de.d.ts → lib/locale/it.d.ts} +8 -2
- package/{locale → lib/locale}/it.js +11 -8
- package/lib/locale/locale-utils.js +45 -0
- package/{locale → lib/locale}/sl.d.ts +5 -2
- package/{locale → lib/locale}/sl.js +31 -31
- package/{model → lib/model}/AppError.d.ts +1 -1
- package/lib/model/AppError.js +1 -0
- package/lib/model/JwtUser.d.ts +9 -0
- package/lib/model/JwtUser.js +1 -0
- package/{model → lib/model}/Page.d.ts +1 -1
- package/lib/model/Page.js +1 -0
- package/{model → lib/model}/PageRequest.d.ts +1 -1
- package/lib/model/PageRequest.js +1 -0
- package/{model → lib/model}/PageResource.d.ts +1 -1
- package/lib/model/PageResource.js +1 -0
- package/lib/model/User.d.ts +8 -0
- package/lib/model/User.js +1 -0
- package/{model → lib/model}/UserNotify.d.ts +1 -2
- package/lib/model/UserNotify.js +1 -0
- package/lib/redux/slices/appStateSlice.d.ts +58 -0
- package/{redux → lib/redux}/slices/appStateSlice.js +15 -9
- package/lib/redux/slices/permissionsSlice.d.ts +12 -0
- package/lib/redux/slices/permissionsSlice.js +23 -0
- package/lib/redux/slices/productsSlice.d.ts +204 -0
- package/lib/redux/slices/productsSlice.js +26 -0
- package/lib/redux/slices/userSlice.d.ts +36 -0
- package/lib/redux/slices/userSlice.js +17 -0
- package/{services → lib/services}/analyticsService.d.ts +2 -1
- package/{services → lib/services}/analyticsService.js +31 -28
- package/{services → lib/services}/assistanceService.d.ts +1 -1
- package/lib/services/assistanceService.js +14 -0
- package/lib/services/errorService.js +8 -0
- package/{utils → lib/utils}/api-utils.d.ts +3 -3
- package/{utils → lib/utils}/api-utils.js +28 -23
- package/lib/utils/constants.d.ts +69 -0
- package/lib/utils/constants.js +83 -0
- package/lib/utils/productId2ProductTitle.d.ts +1 -0
- package/lib/utils/productId2ProductTitle.js +13 -0
- package/lib/utils/routes-utils.js +2 -0
- package/{utils → lib/utils}/storage-utils.d.ts +3 -3
- package/{utils → lib/utils}/storage-utils.js +4 -12
- package/{utils → lib/utils}/storage.d.ts +6 -0
- package/lib/utils/storage.js +31 -0
- package/lib/utils/utils.d.ts +11 -0
- package/lib/utils/utils.js +148 -0
- package/{utils → lib/utils}/verifyChecksumMatchWithTaxCode.js +1 -6
- package/{utils → lib/utils}/verifyNameMatchWithTaxCode.d.ts +1 -1
- package/lib/utils/verifyNameMatchWithTaxCode.js +27 -0
- package/{utils → lib/utils}/verifySurnameMatchWithTaxCode.d.ts +1 -1
- package/lib/utils/verifySurnameMatchWithTaxCode.js +17 -0
- package/package.json +54 -79
- package/build.info +0 -2
- package/common-polyfill.js +0 -13
- package/common-polyfill.js.map +0 -1
- package/components/BackComponent.d.ts +0 -6
- package/components/BackComponent.js +0 -12
- package/components/BackComponent.js.map +0 -1
- package/components/CustomAvatar.js +0 -18
- package/components/CustomAvatar.js.map +0 -1
- package/components/CustomPagination.js +0 -31
- package/components/CustomPagination.js.map +0 -1
- package/components/EndingPage.js +0 -7
- package/components/EndingPage.js.map +0 -1
- package/components/ErrorBoundary/ErrorBoundary.d.ts +0 -11
- package/components/ErrorBoundary/ErrorBoundary.js +0 -98
- package/components/ErrorBoundary/ErrorBoundary.js.map +0 -1
- package/components/ErrorBoundary/components/BlockingErrorPage.js +0 -15
- package/components/ErrorBoundary/components/BlockingErrorPage.js.map +0 -1
- package/components/FilterModal.js +0 -37
- package/components/FilterModal.js.map +0 -1
- package/components/Footer/Footer.js +0 -213
- package/components/Footer/Footer.js.map +0 -1
- package/components/Footer/FooterConfig.js.map +0 -1
- package/components/Header/Header.js +0 -24
- package/components/Header/Header.js.map +0 -1
- package/components/Loading/LoadingOverlay.js +0 -18
- package/components/Loading/LoadingOverlay.js.map +0 -1
- package/components/LoadingOverlayComponent.d.ts +0 -7
- package/components/LoadingOverlayComponent.js +0 -20
- package/components/LoadingOverlayComponent.js.map +0 -1
- package/components/NavigationBar.js +0 -21
- package/components/NavigationBar.js.map +0 -1
- package/components/SessionModal.js +0 -21
- package/components/SessionModal.js.map +0 -1
- package/components/TitleBox.js +0 -13
- package/components/TitleBox.js.map +0 -1
- package/components/Toast.js +0 -29
- package/components/Toast.js.map +0 -1
- package/components/ToastWrapper.js +0 -16
- package/components/ToastWrapper.js.map +0 -1
- package/components/UnloadEventHandler.js +0 -35
- package/components/UnloadEventHandler.js.map +0 -1
- package/components/UserNotifyHandle.js +0 -67
- package/components/UserNotifyHandle.js.map +0 -1
- package/components/icons/CheckIllustrationIcon.js +0 -7
- package/components/icons/CheckIllustrationIcon.js.map +0 -1
- package/components/icons/ConfirmIcon.js +0 -7
- package/components/icons/ConfirmIcon.js.map +0 -1
- package/components/icons/ErrorIcon.js +0 -7
- package/components/icons/ErrorIcon.js.map +0 -1
- package/components/icons/ErrorIconExclamation.js +0 -7
- package/components/icons/ErrorIconExclamation.js.map +0 -1
- package/components/icons/FaultIcon.js +0 -7
- package/components/icons/FaultIcon.js.map +0 -1
- package/components/icons/PagoPaIcon.js +0 -7
- package/components/icons/PagoPaIcon.js.map +0 -1
- package/components/icons/PagoPaIconColored.js +0 -7
- package/components/icons/PagoPaIconColored.js.map +0 -1
- package/components/icons/PagoPaMiniIcon.js +0 -7
- package/components/icons/PagoPaMiniIcon.js.map +0 -1
- package/config/env.js.map +0 -1
- package/consentManagementConfigure.js.map +0 -1
- package/decorators/__mocks__/withLogin.js +0 -27
- package/decorators/__mocks__/withLogin.js.map +0 -1
- package/decorators/withLogin.js.map +0 -1
- package/decorators/withRetrievedValue.js.map +0 -1
- package/hooks/useErrorDispatcher.js +0 -11
- package/hooks/useErrorDispatcher.js.map +0 -1
- package/hooks/useFakePagination.js.map +0 -1
- package/hooks/useLoading.js +0 -14
- package/hooks/useLoading.js.map +0 -1
- package/hooks/useLogin.js +0 -44
- package/hooks/useLogin.js.map +0 -1
- package/hooks/useReduxCachedValue.d.ts +0 -14
- package/hooks/useReduxCachedValue.js.map +0 -1
- package/hooks/useUnloadEventInterceptor.js.map +0 -1
- package/hooks/useUserNotify.js +0 -11
- package/hooks/useUserNotify.js.map +0 -1
- package/index.js +0 -76
- package/index.js.map +0 -1
- package/locale/de.js.map +0 -1
- package/locale/en.js.map +0 -1
- package/locale/fr.js.map +0 -1
- package/locale/it.js.map +0 -1
- package/locale/locale-utils.js +0 -36
- package/locale/locale-utils.js.map +0 -1
- package/locale/sl.js.map +0 -1
- package/model/AppError.js +0 -3
- package/model/AppError.js.map +0 -1
- package/model/Page.js +0 -3
- package/model/Page.js.map +0 -1
- package/model/PageRequest.js +0 -3
- package/model/PageRequest.js.map +0 -1
- package/model/PageResource.js +0 -3
- package/model/PageResource.js.map +0 -1
- package/model/User.d.ts +0 -7
- package/model/User.js +0 -3
- package/model/User.js.map +0 -1
- package/model/UserNotify.js +0 -3
- package/model/UserNotify.js.map +0 -1
- package/redux/slices/appStateSlice.d.ts +0 -76
- package/redux/slices/appStateSlice.js.map +0 -1
- package/redux/slices/userSlice.d.ts +0 -18
- package/redux/slices/userSlice.js +0 -21
- package/redux/slices/userSlice.js.map +0 -1
- package/services/analyticsService.js.map +0 -1
- package/services/assistanceService.js +0 -20
- package/services/assistanceService.js.map +0 -1
- package/services/errorService.js +0 -13
- package/services/errorService.js.map +0 -1
- package/utils/api-utils.js.map +0 -1
- package/utils/constants.d.ts +0 -19
- package/utils/constants.js +0 -32
- package/utils/constants.js.map +0 -1
- package/utils/routes-utils.js +0 -7
- package/utils/routes-utils.js.map +0 -1
- package/utils/storage-utils.js.map +0 -1
- package/utils/storage.js +0 -9
- package/utils/storage.js.map +0 -1
- package/utils/utils.d.ts +0 -3
- package/utils/utils.js +0 -13
- package/utils/utils.js.map +0 -1
- package/utils/verifyChecksumMatchWithTaxCode.js.map +0 -1
- package/utils/verifyNameMatchWithTaxCode.js +0 -26
- package/utils/verifyNameMatchWithTaxCode.js.map +0 -1
- package/utils/verifySurnameMatchWithTaxCode.js +0 -23
- package/utils/verifySurnameMatchWithTaxCode.js.map +0 -1
- /package/{consentManagementConfigure.d.ts → examples/locale/index.d.ts} +0 -0
- /package/{components → lib/components}/Footer/FooterConfig.d.ts +0 -0
- /package/{components → lib/components}/icons/ConfirmIcon.d.ts +0 -0
- /package/{components → lib/components}/icons/ErrorIconExclamation.d.ts +0 -0
- /package/{components → lib/components}/icons/FaultIcon.d.ts +0 -0
- /package/{hooks → lib/hooks}/useErrorDispatcher.d.ts +0 -0
- /package/{hooks → lib/hooks}/useLoading.d.ts +0 -0
- /package/{hooks → lib/hooks}/useLogin.d.ts +0 -0
- /package/{hooks → lib/hooks}/useUserNotify.d.ts +0 -0
- /package/{locale → lib/locale}/locale-utils.d.ts +0 -0
- /package/{services → lib/services}/errorService.d.ts +0 -0
- /package/{utils → lib/utils}/routes-utils.d.ts +0 -0
- /package/{utils → lib/utils}/verifyChecksumMatchWithTaxCode.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# SelfCare's common components & features
|
|
1
|
+
# SelfCare's common components & features
|
|
2
2
|
This library contains [utilities](#utilities), [components](#components), [decorators](#decorators), [custom hooks](#custom-hooks) and [features](#features) built for the selfcare project.
|
|
3
3
|
|
|
4
4
|
# Localization
|
|
@@ -156,13 +156,21 @@ Selfcare's ending page
|
|
|
156
156
|
|
|
157
157
|
| Prop | Type | Mandatory | Description |
|
|
158
158
|
|------|------|-----------|-------------|
|
|
159
|
-
|
|
|
160
|
-
|
|
|
159
|
+
| minHeight | '52vh' \| '100vh' | N | The minHeight of the component, can be 52vh for the pages and 100vh for the blocking page |
|
|
160
|
+
| icon | React.ReactElement<SvgIconProps> \| FunctionComponent<SVGProps<SVGSVGElement>> \| string | N | The ending page icon |
|
|
161
|
+
| title | React.ReactNode | Y | The ending page title |
|
|
161
162
|
| description | React.ReactNode | Y | The ending page description |
|
|
162
|
-
| buttonLabel |
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
|
|
|
163
|
+
| buttonLabel | React.ReactNode | N | The ending page button label if any |
|
|
164
|
+
| secondButtonLabel | React.ReactNode | N | The ending page second button label if any |
|
|
165
|
+
| onButtonClick | () => void | N | if defined performe this action on click of the first button |
|
|
166
|
+
| onSecondButtonClick | () => void | N | if defined performe this action on click of the second button |
|
|
167
|
+
| variantTitle | 'button' \| 'caption' \| 'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'inherit' \| 'subtitle1' \| 'subtitle2' \| 'body1' \| 'body2' \| 'overline' \| undefined | N | Set the variant of the title |
|
|
168
|
+
| variantDescription | 'button' \| 'caption' \| 'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'inherit' \| 'subtitle1' \| 'subtitle2' \| 'body1' \| 'body2' \| 'overline' \| undefined | N | Set the variant of the description |
|
|
169
|
+
| variantFirstButton | 'contained' \| 'outlined' \| 'text' | N | Set the variant of the first button |
|
|
170
|
+
| variantSecondButton | 'contained' \| 'outlined' \| 'text' | N | Set the variant of the second button |
|
|
171
|
+
| paragraph | React.ReactNode | N | Set the text of paragraph |
|
|
172
|
+
| isParagraphPresent | boolean | N | Show the paragraph |
|
|
173
|
+
| haveTwoButtons | boolean | N | Show the second button and the "secondButtonLabel" as text of this one |
|
|
166
174
|
|
|
167
175
|
## NavigationBar
|
|
168
176
|
Selfcare's navigation bar
|
|
@@ -243,6 +251,12 @@ An object containing a complete set of operation on the storage regarding the ke
|
|
|
243
251
|
### storageUserOps
|
|
244
252
|
An object containing a complete set of operation on the storage regarding the key used to store in the storage the loggedUser in selfcare projects.
|
|
245
253
|
|
|
254
|
+
## parseJwt
|
|
255
|
+
Decode and then convert the jwt into a JWTUser object
|
|
256
|
+
|
|
257
|
+
## isExpiredToken
|
|
258
|
+
Determines whether the token has expired
|
|
259
|
+
|
|
246
260
|
# Decorators
|
|
247
261
|
## withLogin
|
|
248
262
|
This feature is based on react-redux library and require to register the reducer build in userSlice into the application's redux store.
|
|
@@ -420,4 +434,16 @@ The tool used is [OneTrust](#https://www.onetrust.it/), and in order to be able
|
|
|
420
434
|
|
|
421
435
|
| Key | Type | Description | DefaultValue |
|
|
422
436
|
|-----|------|-------------|--------------|
|
|
423
|
-
| COOKIE_GROUP_ANALYTICS | string | The cookie group configured for the analytics tool. MixPanel's cookies are configured as default by OneTrust with C0004 group, or as Targeting Cookies | C0004 |
|
|
437
|
+
| COOKIE_GROUP_ANALYTICS | string | The cookie group configured for the analytics tool. MixPanel's cookies are configured as default by OneTrust with C0004 group, or as Targeting Cookies | C0004 |
|
|
438
|
+
|
|
439
|
+
## CustomAlert
|
|
440
|
+
Reusable component to display information messages using MUI's Alert.
|
|
441
|
+
|
|
442
|
+
| Prop | Type | Mandatory | Description |
|
|
443
|
+
|-----------|-------|-----------|-------------|
|
|
444
|
+
| text | string | N | The message text to display in the alert |
|
|
445
|
+
| severity | 'error' \| 'info' \| 'success' \| 'warning'| N | The severity level of the alert |
|
|
446
|
+
| variant | 'filled' \| 'outlined' \| 'standard' | N | The visual style of the alert |
|
|
447
|
+
| sx | object | N | Additional custom styles for the alert |
|
|
448
|
+
| ...rest | any | N | Any additional props passed to MUI's Alert component |
|
|
449
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'session modal button': string;
|
|
3
|
+
labelTitle: string;
|
|
4
|
+
boldDescriptionText: string;
|
|
5
|
+
boldDescriptionTwo: string;
|
|
6
|
+
description: {
|
|
7
|
+
part1: string;
|
|
8
|
+
part2: string;
|
|
9
|
+
};
|
|
10
|
+
key: string;
|
|
11
|
+
key2: string;
|
|
12
|
+
nesting1: string;
|
|
13
|
+
nesting2: string;
|
|
14
|
+
nesting3: string;
|
|
15
|
+
arrayJoinWithInterpolation: string[];
|
|
16
|
+
arrayOfObjects: {
|
|
17
|
+
name: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const descriptionEn = 'bold description';
|
|
2
|
+
export default {
|
|
3
|
+
'session modal button': 'Translate Example Session Modal',
|
|
4
|
+
labelTitle: 'name Title',
|
|
5
|
+
boldDescriptionText: ' Test Description with bold text',
|
|
6
|
+
boldDescriptionTwo: `view ${descriptionEn}`,
|
|
7
|
+
description: {
|
|
8
|
+
part1: 'eng: description test-part1',
|
|
9
|
+
part2: 'eng: description test-part2',
|
|
10
|
+
},
|
|
11
|
+
key: '{{what}} {{and}} {{how}}!!',
|
|
12
|
+
key2: 'I am <1>{{author}}</1> not bold',
|
|
13
|
+
nesting1: '1 $t(nesting2)',
|
|
14
|
+
nesting2: '2 $t(nesting3)',
|
|
15
|
+
nesting3: '3',
|
|
16
|
+
arrayJoinWithInterpolation: ['you', 'can', '{{myVar}}'],
|
|
17
|
+
arrayOfObjects: [{ name: 'tom' }, { name: 'steve' }],
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'session modal button': string;
|
|
3
|
+
labelTitle: string;
|
|
4
|
+
boldDescriptionText: string;
|
|
5
|
+
boldDescriptionTwo: string;
|
|
6
|
+
description: {
|
|
7
|
+
part1: string;
|
|
8
|
+
part2: string;
|
|
9
|
+
};
|
|
10
|
+
key: string;
|
|
11
|
+
key2: string;
|
|
12
|
+
nesting1: string;
|
|
13
|
+
nesting2: string;
|
|
14
|
+
nesting3: string;
|
|
15
|
+
arrayJoinWithInterpolation: string[];
|
|
16
|
+
arrayOfObjects: {
|
|
17
|
+
name: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const labelTitle = 'nome Titolo';
|
|
2
|
+
const descriptionIt = 'descrizione in grassetto';
|
|
3
|
+
export default {
|
|
4
|
+
'session modal button': 'Esempio Traduzione SessionModal',
|
|
5
|
+
labelTitle: `${labelTitle}`,
|
|
6
|
+
boldDescriptionText: ' testo in grassetto',
|
|
7
|
+
boldDescriptionTwo: `visualizza la ${descriptionIt}`,
|
|
8
|
+
description: {
|
|
9
|
+
part1: 'ita: descrizione test-parte1',
|
|
10
|
+
part2: 'ita: descrizione test-parte2',
|
|
11
|
+
},
|
|
12
|
+
key: '{{what}} {{e}} {{how}}!!',
|
|
13
|
+
key2: 'sono <1>{{author}}</1> non in grassetto',
|
|
14
|
+
nesting1: '1 $t(nesting2)',
|
|
15
|
+
nesting2: '2 $t(nesting3)',
|
|
16
|
+
nesting3: '3',
|
|
17
|
+
arrayJoinWithInterpolation: ['tu', 'puoi', '{{myVar}}'],
|
|
18
|
+
arrayOfObjects: [{ name: 'tom' }, { name: ' steve' }],
|
|
19
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import 'core-js/es/object/entries';
|
|
2
|
+
import 'core-js/es/object/from-entries';
|
|
3
|
+
import 'core-js/es/object/values';
|
|
4
|
+
import 'core-js/es/map';
|
|
5
|
+
import 'core-js/es/promise';
|
|
6
|
+
import 'core-js/es/array';
|
|
7
|
+
import 'core-js/stable/string';
|
|
8
|
+
import 'core-js/stable/number';
|
|
9
|
+
import 'core-js/stable/url-search-params';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowBack } from '@mui/icons-material';
|
|
3
|
+
import { ButtonNaked } from '@pagopa/mui-italia';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
export default function BackComponent({ goBack, backLabel, color }) {
|
|
6
|
+
const { t } = useTranslation();
|
|
7
|
+
return (_jsx(ButtonNaked, { size: "small", component: "button", onClick: goBack, startIcon: _jsx(ArrowBack, {}), sx: { color: color ?? 'primary.main' }, weight: "default", children: backLabel ?? t('common.backComponent.label') }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type AlertProps = {
|
|
2
|
+
/** The text to display in the alert */
|
|
3
|
+
text?: string;
|
|
4
|
+
/** The severity level of the alert */
|
|
5
|
+
severity?: 'error' | 'info' | 'success' | 'warning';
|
|
6
|
+
/** The visual style of the alert */
|
|
7
|
+
variant?: 'filled' | 'outlined' | 'standard';
|
|
8
|
+
/** Additional custom styles */
|
|
9
|
+
sx?: object;
|
|
10
|
+
};
|
|
11
|
+
export default function CustomAlert({ text, severity, variant, sx, ...rest }: AlertProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Alert } from '@mui/material';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
export default function CustomAlert({ text, severity = 'info', variant = 'standard', sx, ...rest }) {
|
|
5
|
+
const { t } = useTranslation();
|
|
6
|
+
return (_jsx(Alert, { role: "alert", severity: severity, variant: variant, sx: sx, ...rest, children: text || t('common.customAlert.message') }));
|
|
7
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare type Props = {
|
|
1
|
+
type Props = {
|
|
3
2
|
/** The id attribute added to the element */
|
|
4
3
|
id?: string;
|
|
5
4
|
/** The logo src */
|
|
@@ -14,5 +13,5 @@ declare type Props = {
|
|
|
14
13
|
loading?: boolean;
|
|
15
14
|
};
|
|
16
15
|
/** Avatar to use to load Organization logo */
|
|
17
|
-
export default function CustomAvatar({ customAlt, customSrc, customWidth, customHeight, id, loading, }: Props): JSX.Element;
|
|
16
|
+
export default function CustomAvatar({ customAlt, customSrc, customWidth, customHeight, id, loading, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Avatar } from '@mui/material';
|
|
4
|
+
/** Avatar to use to load Organization logo */
|
|
5
|
+
export default function CustomAvatar({ customAlt, customSrc, customWidth, customHeight, id, loading, }) {
|
|
6
|
+
return (_jsx(React.Fragment, { children: _jsx(Avatar, { id: id, alt: customAlt, src: customSrc, sx: {
|
|
7
|
+
width: customWidth,
|
|
8
|
+
height: customHeight,
|
|
9
|
+
display: !loading ? undefined : 'none',
|
|
10
|
+
color: 'palette.background.default',
|
|
11
|
+
backgroundColor: '#CCD4DC',
|
|
12
|
+
} }) }));
|
|
13
|
+
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Page } from '../model/Page';
|
|
3
3
|
import { PageRequest } from '../model/PageRequest';
|
|
4
|
-
|
|
4
|
+
type Props = {
|
|
5
5
|
/** The actual page */
|
|
6
6
|
page: Page;
|
|
7
7
|
/** The actual sort applied */
|
|
8
8
|
sort?: string;
|
|
9
9
|
/** The function to be invoked if the user change page */
|
|
10
10
|
onPageRequest: (r: PageRequest) => void;
|
|
11
|
+
/** The variant of the pagination component */
|
|
12
|
+
variant?: 'outlined' | 'text';
|
|
13
|
+
/** The component to control the page size */
|
|
14
|
+
pageSizeControl?: React.ReactNode;
|
|
11
15
|
};
|
|
12
16
|
/** Selfcare custom table available pages component */
|
|
13
|
-
export default function CustomPagination({ page, onPageRequest, sort }: Props): JSX.Element;
|
|
17
|
+
export default function CustomPagination({ page, onPageRequest, sort, variant, pageSizeControl, }: Readonly<Props>): import("react/jsx-runtime").JSX.Element;
|
|
14
18
|
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Grid, Pagination } from '@mui/material';
|
|
3
|
+
import PaginationItem from '@mui/material/PaginationItem';
|
|
4
|
+
function defaultLabelDisplayedRows(from, to, count) {
|
|
5
|
+
// eslint-disable-next-line sonarjs/no-nested-template-literals
|
|
6
|
+
return `${from}-${to} di ${count !== -1 ? count : `più di ${to}`}`;
|
|
7
|
+
}
|
|
8
|
+
const getLabelDisplayedRowsTo = (count, page, size) => {
|
|
9
|
+
if (count === -1) {
|
|
10
|
+
return (page + 1) * size;
|
|
11
|
+
}
|
|
12
|
+
return size === -1 ? count : Math.min(count, (page + 1) * size);
|
|
13
|
+
};
|
|
14
|
+
/** Selfcare custom table available pages component */
|
|
15
|
+
export default function CustomPagination({ page, onPageRequest, sort, variant, pageSizeControl, }) {
|
|
16
|
+
const count = page.totalElements;
|
|
17
|
+
const from = count === 0 ? 0 : page.number * page.size + 1;
|
|
18
|
+
const to = getLabelDisplayedRowsTo(count, page.number, page.size);
|
|
19
|
+
return (_jsxs(Grid, { container: true, sx: { padding: '0 10px' }, children: [_jsx(Grid, { item: true, xs: 6, display: "flex", justifyContent: "start", alignItems: 'center', children: pageSizeControl ?? defaultLabelDisplayedRows(from, to, count) }), _jsx(Grid, { item: true, xs: 6, display: "flex", justifyContent: "end", alignItems: 'center', children: page.totalElements > page.size && (_jsx(Pagination, { sx: { display: 'flex' }, color: "primary", shape: "rounded", page: page.number + 1, count: page.totalPages, renderItem: (props2) => (_jsx(PaginationItem, { ...props2, sx: { border: 'none' }, variant: variant ?? 'outlined' })), onChange: (_event, value) => (onPageRequest({
|
|
20
|
+
page: value - 1,
|
|
21
|
+
size: page.size,
|
|
22
|
+
sort,
|
|
23
|
+
}),
|
|
24
|
+
window.scrollTo(0, 0)) })) })] }));
|
|
25
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvgIconProps } from '@mui/material';
|
|
2
2
|
import { FunctionComponent, SVGProps } from 'react';
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
/** The minHeight of the component, can be 52vh for the pages and 100vh for the blocking page */
|
|
5
5
|
minHeight?: '52vh' | '100vh';
|
|
6
6
|
/** The ending page icon */
|
|
@@ -11,15 +11,27 @@ declare type Props = {
|
|
|
11
11
|
description: React.ReactNode;
|
|
12
12
|
/** The ending page button label if any */
|
|
13
13
|
buttonLabel?: React.ReactNode;
|
|
14
|
-
/**
|
|
14
|
+
/** The ending page second button label if any */
|
|
15
|
+
secondButtonLabel?: React.ReactNode;
|
|
16
|
+
/** if defined performe this action on click of the first button */
|
|
15
17
|
onButtonClick?: () => void;
|
|
18
|
+
/** if defined performe this action on click of the second button */
|
|
19
|
+
onSecondButtonClick?: () => void;
|
|
16
20
|
/** Set the variant of the title */
|
|
17
21
|
variantTitle?: 'button' | 'caption' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'inherit' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'overline' | undefined;
|
|
18
22
|
/** Set the variant of the description */
|
|
19
23
|
variantDescription?: 'button' | 'caption' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'inherit' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'overline' | undefined;
|
|
24
|
+
/** Set the variant of the first button */
|
|
25
|
+
variantFirstButton?: 'contained' | 'outlined' | 'text';
|
|
26
|
+
/** Set the variant of the second button */
|
|
27
|
+
variantSecondButton?: 'contained' | 'outlined' | 'text';
|
|
28
|
+
/** Set the text of paragraph */
|
|
20
29
|
paragraph?: React.ReactNode;
|
|
30
|
+
/** Show the paragraph */
|
|
21
31
|
isParagraphPresent?: boolean;
|
|
32
|
+
/** Show the second button and the "secondButtonLabel" as text of this one */
|
|
33
|
+
haveTwoButtons?: boolean;
|
|
22
34
|
};
|
|
23
|
-
declare const _default: ({ minHeight, description, onButtonClick, icon, title, buttonLabel, variantTitle, variantDescription, paragraph, isParagraphPresent, }: Props) => JSX.Element;
|
|
24
35
|
/** Selfcare's Ending Page */
|
|
36
|
+
declare const _default: ({ minHeight, description, onButtonClick, onSecondButtonClick, icon, title, buttonLabel, variantTitle, variantDescription, paragraph, isParagraphPresent, haveTwoButtons, secondButtonLabel, variantFirstButton, variantSecondButton, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
25
37
|
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Grid, Typography, Box } from '@mui/material';
|
|
3
|
+
/** Selfcare's Ending Page */
|
|
4
|
+
export default ({ minHeight, description, onButtonClick, onSecondButtonClick, icon, title, buttonLabel, variantTitle, variantDescription, paragraph, isParagraphPresent, haveTwoButtons = false, secondButtonLabel, variantFirstButton = 'contained', variantSecondButton = 'contained', }) => (_jsx(Box, { sx: { minHeight, position: 'static' }, display: "flex", flexGrow: 1, children: _jsxs(Grid, { container: true, direction: "column", style: { textAlign: 'center' }, margin: 'auto', children: [_jsx(Grid, { container: true, item: true, justifyContent: "center", mb: 3, children: _jsx(Grid, { item: true, xs: 6, children: icon }) }), _jsx(Grid, { container: true, item: true, justifyContent: "center", children: _jsx(Grid, { item: true, xs: 6, children: _jsx(Typography, { variant: variantTitle, children: title }) }) }), _jsx(Grid, { container: true, item: true, justifyContent: "center", mb: 4, mt: 1, children: _jsx(Grid, { item: true, xs: 6, children: _jsx(Typography, { variant: variantDescription, children: description }) }) }), buttonLabel && (_jsx(Grid, { container: true, item: true, justifyContent: "center", children: _jsxs(Grid, { item: true, xs: haveTwoButtons ? 12 : 4, children: [_jsx(Button, { variant: variantFirstButton, sx: { alignSelf: 'center', marginRight: haveTwoButtons ? 3 : 0 }, onClick: onButtonClick, children: buttonLabel }), haveTwoButtons && (_jsx(Button, { variant: variantSecondButton, sx: { alignSelf: 'center' }, onClick: onSecondButtonClick, children: secondButtonLabel }))] }) })), isParagraphPresent && (_jsx(Grid, { container: true, item: true, justifyContent: "center", my: 4, children: _jsx(Grid, { item: true, xs: 6, children: _jsx(Typography, { variant: variantDescription, children: paragraph }) }) }))] }, "0") }));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TFunction } from 'i18next';
|
|
2
|
+
import { ComponentType, ReactNode } from 'react';
|
|
3
|
+
interface Props {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
assistanceEmail?: string;
|
|
6
|
+
minHeight?: '52vh' | '100vh';
|
|
7
|
+
t: TFunction<'translation', undefined>;
|
|
8
|
+
showCloseIcon?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: ComponentType<Omit<Props, "t">>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import ErrorOutlineOutlinedIcon from '@mui/icons-material/ErrorOutlineOutlined';
|
|
3
|
+
import { uniqueId } from 'lodash';
|
|
4
|
+
import { Component, Fragment } from 'react';
|
|
5
|
+
import { withTranslation } from 'react-i18next';
|
|
6
|
+
import { connect } from 'react-redux';
|
|
7
|
+
import { appStateActions, appStateSelectors } from '../../redux/slices/appStateSlice';
|
|
8
|
+
import { handleErrors } from '../../services/errorService';
|
|
9
|
+
import SessionModal from '../SessionModal';
|
|
10
|
+
import Toast from '../Toast';
|
|
11
|
+
import BlockingErrorPage from './components/BlockingErrorPage';
|
|
12
|
+
/** This feature is based on react-redux library and require to register the reducer build in appStateSlice into the application's redux store.
|
|
13
|
+
It allows to dispatch errors in order to display a warning or the error page to the user.
|
|
14
|
+
Errors dispatched will be notified using errorService
|
|
15
|
+
|
|
16
|
+
To use this feature you have to put ErrorBoundary in your App as a child of a redux Provider component.
|
|
17
|
+
In order to dispatch an error you have to use the custom hook useErrorDispatcher which will return a fuction to be used to dispatch the error. */
|
|
18
|
+
class ErrorBoundary extends Component {
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super(props);
|
|
21
|
+
this.buildNotBlockingError.bind(this);
|
|
22
|
+
this.buildErrorModal.bind(this);
|
|
23
|
+
this.buildErrorToast.bind(this);
|
|
24
|
+
this.handleClose.bind(this);
|
|
25
|
+
this.popError.bind(this);
|
|
26
|
+
this.retryError.bind(this);
|
|
27
|
+
}
|
|
28
|
+
componentDidCatch(error, errorInfo) {
|
|
29
|
+
this.props.addError({
|
|
30
|
+
id: uniqueId('uncaught-'),
|
|
31
|
+
techDescription: 'Uncaught error',
|
|
32
|
+
error,
|
|
33
|
+
errorInfo,
|
|
34
|
+
blocking: true,
|
|
35
|
+
toNotify: true,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
const hasError = this.props.errors.length > 0;
|
|
40
|
+
const blockingErrors = this.props.errors.filter((e) => e.blocking);
|
|
41
|
+
const hasBlockingError = blockingErrors.length > 0;
|
|
42
|
+
if (hasError) {
|
|
43
|
+
handleErrors(this.props.errors);
|
|
44
|
+
}
|
|
45
|
+
if (!hasBlockingError) {
|
|
46
|
+
return (_jsxs(Fragment, { children: [this.props.children, hasError && this.buildNotBlockingError(this.props.errors)] }));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return (_jsx(BlockingErrorPage, { description: blockingErrors[0].displayableDescription, assistanceEmail: this.props.assistanceEmail, minHeight: this.props.minHeight }));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
buildNotBlockingError(errors) {
|
|
53
|
+
const errorModal = errors.find((e) => e.component === 'SessionModal');
|
|
54
|
+
const errorToast = errors.find((e) => e.component === 'Toast');
|
|
55
|
+
return (_jsxs(_Fragment, { children: [errorModal && this.buildErrorModal(errorModal), errorToast && this.buildErrorToast(errorToast)] }));
|
|
56
|
+
}
|
|
57
|
+
buildErrorToast(error) {
|
|
58
|
+
if (error.autoclosable === 'timer') {
|
|
59
|
+
setTimeout(() => this.handleClose(error), error.autocloseMilliseconds);
|
|
60
|
+
}
|
|
61
|
+
return (_jsx(Toast, { open: true, title: error.displayableTitle ?? this.props.t('common.errorBoundary.toastError'), message: error.displayableDescription ?? this.props.t('common.errorBoundary.toastMessage'), logo: ErrorOutlineOutlinedIcon, toastColorIcon: "#FE6666", leftBorderColor: "#FE6666", onCloseToast: () => this.handleClose(error), width: error.width, showToastCloseIcon: error.showCloseIcon }));
|
|
62
|
+
}
|
|
63
|
+
buildErrorModal(error) {
|
|
64
|
+
return (_jsx(SessionModal, { open: true, title: error.displayableTitle ?? this.props.t('common.errorBoundary.sessionModalTitle'), message: error.displayableDescription ?? this.props.t('common.errorBoundary.sessionModalMessage'), onConfirm: error.onRetry ? () => this.retryError(error) : undefined, handleClose: () => this.handleClose(error), width: error.width, showCloseIcon: error.showCloseIcon }));
|
|
65
|
+
}
|
|
66
|
+
retryError(error) {
|
|
67
|
+
this.popError(error);
|
|
68
|
+
if (error.onRetry) {
|
|
69
|
+
error.onRetry();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
popError(error) {
|
|
73
|
+
this.props.removeError(error);
|
|
74
|
+
}
|
|
75
|
+
handleClose(error) {
|
|
76
|
+
this.popError(error);
|
|
77
|
+
if (error.onClose) {
|
|
78
|
+
error.onClose();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function mapStateToProps(state) {
|
|
83
|
+
return {
|
|
84
|
+
errors: appStateSelectors.selectErrors(state)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const mapDispatchToProps = (dispatch) => ({
|
|
88
|
+
addError: (error) => dispatch(appStateActions.addError(error)),
|
|
89
|
+
removeError: (error) => dispatch(appStateActions.removeError(error)),
|
|
90
|
+
});
|
|
91
|
+
const ErrorBoundaryConnected = connect(mapStateToProps, mapDispatchToProps)(ErrorBoundary);
|
|
92
|
+
const ErrorBoundaryWithTranslation = withTranslation()(ErrorBoundaryConnected);
|
|
93
|
+
export default ErrorBoundaryWithTranslation;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
declare type Props = {
|
|
1
|
+
type Props = {
|
|
3
2
|
description?: React.ReactNode;
|
|
4
3
|
assistanceEmail?: string;
|
|
5
4
|
minHeight?: '52vh' | '100vh';
|
|
6
5
|
};
|
|
7
|
-
declare const _default: ({ description, assistanceEmail, minHeight }: Props) => JSX.Element;
|
|
6
|
+
declare const _default: ({ description, assistanceEmail, minHeight }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { buildAssistanceURI } from '../../../services/assistanceService';
|
|
4
|
+
import EndingPage from '../../EndingPage';
|
|
5
|
+
import ErrorIcon from '../../icons/ErrorIcon';
|
|
6
|
+
export default ({ description, assistanceEmail, minHeight = '100vh' }) => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
return (_jsx(EndingPage, { minHeight: minHeight, icon: _jsx(ErrorIcon, {}), title: t('common.blockingErrorPage.title'), description: description ?? t('common.blockingErrorPage.description'), onButtonClick: assistanceEmail
|
|
9
|
+
? () => window.location.assign(buildAssistanceURI(assistanceEmail))
|
|
10
|
+
: undefined, buttonLabel: t('common.blockingErrorPage.buttonLabel') }));
|
|
11
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
/** If the popup is to be displayed */
|
|
4
4
|
open: boolean;
|
|
5
5
|
/** The function to be invoked when clicking on exit button or selecting a value */
|
|
@@ -13,7 +13,7 @@ declare type Props = {
|
|
|
13
13
|
/** The popup minHeight */
|
|
14
14
|
minHeight?: string;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type FilterModalConfig<T, V> = {
|
|
17
17
|
/** The list of values between to which choose */
|
|
18
18
|
data: Array<T>;
|
|
19
19
|
/** A function that will select the label to show */
|
|
@@ -24,5 +24,5 @@ export declare type FilterModalConfig<T, V> = {
|
|
|
24
24
|
onFilterChange: (v: V) => void;
|
|
25
25
|
};
|
|
26
26
|
/** Modal used to show a list of values from which to choose a single value */
|
|
27
|
-
export default function FilterModal({ open, handleClose, title, filterModalConfig, height, minHeight, }: Props): JSX.Element;
|
|
27
|
+
export default function FilterModal({ open, handleClose, title, filterModalConfig, height, minHeight, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Typography, Box, Button, FormControlLabel, Grid, IconButton, Radio, RadioGroup, } from '@mui/material';
|
|
4
|
+
import Dialog from '@mui/material/Dialog';
|
|
5
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
6
|
+
import { useTheme } from '@mui/material/styles';
|
|
7
|
+
import ClearOutlinedIcon from '@mui/icons-material/ClearOutlined';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
/** Modal used to show a list of values from which to choose a single value */
|
|
10
|
+
export default function FilterModal({ open, handleClose, title, filterModalConfig, height = '16em', minHeight = '16em', }) {
|
|
11
|
+
const theme = useTheme();
|
|
12
|
+
const fullScreen = useMediaQuery(theme.breakpoints.down('xs'));
|
|
13
|
+
React.useEffect(() => setValueRadio(''), [open]);
|
|
14
|
+
const [valueRadio, setValueRadio] = React.useState('');
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const handleChange = (_, value) => {
|
|
17
|
+
setValueRadio(value);
|
|
18
|
+
};
|
|
19
|
+
const submitFilter = (event) => {
|
|
20
|
+
const i = data.filter((value) => value.id === valueRadio).map((x) => x)[0];
|
|
21
|
+
filterModalConfig?.onFilterChange(i === undefined ? valueRadio : i);
|
|
22
|
+
handleClose(event);
|
|
23
|
+
};
|
|
24
|
+
const data = filterModalConfig?.data !== undefined ? filterModalConfig?.data : [];
|
|
25
|
+
return (_jsx(Dialog, { fullScreen: fullScreen, open: open, "aria-labelledby": "responsive-dialog-title", children: _jsx(Grid, { container: true, direction: "column", sx: { height, minHeight, width: '21.9em' }, children: _jsxs(Box, { mx: 3, sx: { height: '100%' }, children: [_jsx(Grid, { container: true, item: true, mt: 4, children: _jsxs(Grid, { item: true, xs: 10, children: [_jsx(IconButton, { onClick: (e) => {
|
|
26
|
+
setValueRadio('');
|
|
27
|
+
handleClose(e);
|
|
28
|
+
}, style: { position: 'absolute', top: '20px', right: '16px', zIndex: 100 }, children: _jsx(ClearOutlinedIcon, {}) }), _jsx(Typography, { variant: "h5", sx: { fontSize: '18px', fontWeight: '600' }, children: `${t('common.filterModal.title')} ${title}` })] }) }), _jsx(Grid, { container: true, item: true, children: _jsx(Grid, { item: true, xs: 12, my: 3, children: _jsx(RadioGroup, { "aria-label": "gender", name: "controlled-radio-buttons-group", value: valueRadio, onChange: handleChange, children: data.map((value, index) => (_jsx(FormControlLabel, { value: filterModalConfig?.getValue(value), control: _jsx(Radio, {}), label: filterModalConfig?.getLabel(value) ?? '' }, index))) }) }) }), _jsx(Grid, { item: true, xs: 12, mb: 2, children: _jsx(Button, { sx: { width: '100%', marginBottom: '20px' }, color: "primary", variant: "contained", onClick: submitFilter, children: t('common.filterModal.button') }) })] }) }) }));
|
|
29
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
declare type FooterProps = {
|
|
1
|
+
type FooterProps = {
|
|
3
2
|
loggedUser: boolean;
|
|
4
3
|
productsJsonUrl?: string;
|
|
5
4
|
onExit?: (exitAction: () => void) => void;
|
|
6
5
|
};
|
|
7
|
-
export default function Footer({ loggedUser, productsJsonUrl, onExit, }: FooterProps): JSX.Element;
|
|
6
|
+
export default function Footer({ loggedUser, productsJsonUrl, onExit, }: FooterProps): import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export {};
|