@pautena/react-design-system 0.11.2 → 0.12.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/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/inputs/action/action-header.d.ts +5 -3
- package/dist/cjs/types/components/inputs/action/action.d.ts +2 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/inputs/action/action-header.d.ts +5 -3
- package/dist/esm/types/components/inputs/action/action.d.ts +2 -1
- package/dist/index.d.ts +13 -11
- package/package.json +2 -1
- package/src/components/alerts/alerts.stories.mdx +0 -10
- package/src/components/alerts/expandable-alert/expandable-alert.stories.tsx +0 -96
- package/src/components/alerts/expandable-alert/expandable-alert.test.tsx +0 -137
- package/src/components/alerts/expandable-alert/expandable-alert.tsx +0 -78
- package/src/components/alerts/expandable-alert/index.ts +0 -1
- package/src/components/alerts/index.ts +0 -1
- package/src/components/components.stories.mdx +0 -20
- package/src/components/containers/center-container/center-container.stories.tsx +0 -52
- package/src/components/containers/center-container/center-container.test.tsx +0 -16
- package/src/components/containers/center-container/center-container.tsx +0 -32
- package/src/components/containers/center-container/index.ts +0 -1
- package/src/components/containers/containers.stories.mdx +0 -12
- package/src/components/containers/content/content.stories.tsx +0 -20
- package/src/components/containers/content/content.test.tsx +0 -26
- package/src/components/containers/content/content.tsx +0 -11
- package/src/components/containers/content/content.types.ts +0 -5
- package/src/components/containers/content/index.ts +0 -2
- package/src/components/containers/index.ts +0 -3
- package/src/components/containers/list-panel/index.ts +0 -2
- package/src/components/containers/list-panel/list-panel-panel.tsx +0 -17
- package/src/components/containers/list-panel/list-panel.context.tsx +0 -5
- package/src/components/containers/list-panel/list-panel.mocks.tsx +0 -117
- package/src/components/containers/list-panel/list-panel.stories.tsx +0 -38
- package/src/components/containers/list-panel/list-panel.test.tsx +0 -65
- package/src/components/containers/list-panel/list-panel.tsx +0 -88
- package/src/components/data-display/board/board.stories.tsx +0 -58
- package/src/components/data-display/board/board.test.tsx +0 -118
- package/src/components/data-display/board/board.tsx +0 -80
- package/src/components/data-display/board/index.ts +0 -1
- package/src/components/data-display/bullet/bullet.stories.tsx +0 -47
- package/src/components/data-display/bullet/bullet.test.tsx +0 -24
- package/src/components/data-display/bullet/bullet.tsx +0 -35
- package/src/components/data-display/bullet/index.ts +0 -1
- package/src/components/data-display/data-display.stories.mdx +0 -15
- package/src/components/data-display/header/header-title.tsx +0 -51
- package/src/components/data-display/header/header.dummy.ts +0 -56
- package/src/components/data-display/header/header.stories.tsx +0 -212
- package/src/components/data-display/header/header.test.tsx +0 -299
- package/src/components/data-display/header/header.tsx +0 -144
- package/src/components/data-display/header/header.types.ts +0 -96
- package/src/components/data-display/header/index.ts +0 -3
- package/src/components/data-display/index.ts +0 -5
- package/src/components/data-display/label/index.ts +0 -1
- package/src/components/data-display/label/label.stories.tsx +0 -53
- package/src/components/data-display/label/label.test.tsx +0 -30
- package/src/components/data-display/label/label.tsx +0 -93
- package/src/components/data-display/link-card/index.ts +0 -0
- package/src/components/data-display/link-card/link-card.stories.tsx +0 -59
- package/src/components/data-display/link-card/link-card.test.tsx +0 -43
- package/src/components/data-display/link-card/link-card.tsx +0 -52
- package/src/components/data-display/markdown/index.ts +0 -1
- package/src/components/data-display/markdown/markdown.stories.tsx +0 -25
- package/src/components/data-display/markdown/markdown.test.tsx +0 -64
- package/src/components/data-display/markdown/markdown.tsx +0 -38
- package/src/components/dialogs/bootstrap-dialog/bootstrap-dialog.stories.tsx +0 -86
- package/src/components/dialogs/bootstrap-dialog/bootstrap-dialog.test.tsx +0 -268
- package/src/components/dialogs/bootstrap-dialog/bootstrap-dialog.tsx +0 -97
- package/src/components/dialogs/bootstrap-dialog/index.ts +0 -1
- package/src/components/dialogs/confirm-dialog/confirm-dialog.stories.tsx +0 -58
- package/src/components/dialogs/confirm-dialog/confirm-dialog.test.tsx +0 -186
- package/src/components/dialogs/confirm-dialog/confirm-dialog.tsx +0 -67
- package/src/components/dialogs/confirm-dialog/index.ts +0 -1
- package/src/components/dialogs/dialog-hooks/index.ts +0 -1
- package/src/components/dialogs/dialog-hooks/use-dialog.ts +0 -10
- package/src/components/dialogs/dialog.types.ts +0 -29
- package/src/components/dialogs/dialogs.stories.mdx +0 -12
- package/src/components/dialogs/form-dialog/form-dialog.stories.tsx +0 -54
- package/src/components/dialogs/form-dialog/form-dialog.test.tsx +0 -165
- package/src/components/dialogs/form-dialog/form-dialog.tsx +0 -63
- package/src/components/dialogs/form-dialog/index.ts +0 -1
- package/src/components/dialogs/index.ts +0 -5
- package/src/components/drawers/drawer/drawer.stories.tsx +0 -35
- package/src/components/drawers/drawer/drawer.test.tsx +0 -83
- package/src/components/drawers/drawer/drawer.tsx +0 -94
- package/src/components/drawers/drawer/index.ts +0 -1
- package/src/components/drawers/drawer-app-bar/drawer-app-bar.stories.tsx +0 -26
- package/src/components/drawers/drawer-app-bar/drawer-app-bar.test.tsx +0 -83
- package/src/components/drawers/drawer-app-bar/drawer-app-bar.tsx +0 -87
- package/src/components/drawers/drawer-app-bar/index.ts +0 -1
- package/src/components/drawers/drawer-content/drawer-content.stories.tsx +0 -48
- package/src/components/drawers/drawer-content/drawer-content.test.tsx +0 -64
- package/src/components/drawers/drawer-content/drawer-content.tsx +0 -19
- package/src/components/drawers/drawer-content/index.ts +0 -1
- package/src/components/drawers/drawer-demo.stories.tsx +0 -94
- package/src/components/drawers/drawer-item/drawer-item-link.tsx +0 -149
- package/src/components/drawers/drawer-item/drawer-item.stories.tsx +0 -148
- package/src/components/drawers/drawer-item/drawer-item.test.tsx +0 -270
- package/src/components/drawers/drawer-item/drawer-item.tsx +0 -53
- package/src/components/drawers/drawer-item/drawer-menu-item.tsx +0 -137
- package/src/components/drawers/drawer-item/index.ts +0 -3
- package/src/components/drawers/drawer-main/drawer-main.tsx +0 -42
- package/src/components/drawers/drawer-main/index.ts +0 -1
- package/src/components/drawers/drawer-provider/drawer-context.test.tsx +0 -24
- package/src/components/drawers/drawer-provider/drawer-context.ts +0 -28
- package/src/components/drawers/drawer-provider/drawer-mixins.test.tsx +0 -25
- package/src/components/drawers/drawer-provider/drawer-mixins.ts +0 -24
- package/src/components/drawers/drawer-provider/drawer-provider.test.tsx +0 -165
- package/src/components/drawers/drawer-provider/drawer.provider.tsx +0 -64
- package/src/components/drawers/drawer-provider/index.ts +0 -3
- package/src/components/drawers/drawer-section/drawer-section.stories.tsx +0 -55
- package/src/components/drawers/drawer-section/drawer-section.test.tsx +0 -88
- package/src/components/drawers/drawer-section/drawer-section.tsx +0 -49
- package/src/components/drawers/drawer-section/index.ts +0 -1
- package/src/components/drawers/drawer-subheader/drawer-subheader.stories.tsx +0 -27
- package/src/components/drawers/drawer-subheader/drawer-subheader.tsx +0 -15
- package/src/components/drawers/drawer-subheader/index.ts +0 -1
- package/src/components/drawers/drawer.mock.tsx +0 -195
- package/src/components/drawers/drawer.types.ts +0 -78
- package/src/components/drawers/drawers.stories.mdx +0 -15
- package/src/components/drawers/index.ts +0 -8
- package/src/components/feedback/feedback.stories.mdx +0 -13
- package/src/components/feedback/index.ts +0 -2
- package/src/components/feedback/loading-area/index.ts +0 -1
- package/src/components/feedback/loading-area/loading-area.stories.tsx +0 -15
- package/src/components/feedback/loading-area/loading-area.test.tsx +0 -12
- package/src/components/feedback/loading-area/loading-area.tsx +0 -13
- package/src/components/feedback/query-container/index.ts +0 -1
- package/src/components/feedback/query-container/query-container.stories.tsx +0 -87
- package/src/components/feedback/query-container/query-container.test.tsx +0 -144
- package/src/components/feedback/query-container/query-container.tsx +0 -86
- package/src/components/index.ts +0 -11
- package/src/components/inputs/action/action-header.test.tsx +0 -11
- package/src/components/inputs/action/action-header.tsx +0 -30
- package/src/components/inputs/action/action.stories.tsx +0 -77
- package/src/components/inputs/action/action.test.tsx +0 -97
- package/src/components/inputs/action/action.tsx +0 -86
- package/src/components/inputs/action/index.ts +0 -2
- package/src/components/inputs/autocomplete/autocomplete.stories.tsx +0 -123
- package/src/components/inputs/autocomplete/autocomplete.test.tsx +0 -75
- package/src/components/inputs/autocomplete/autocomplete.tsx +0 -68
- package/src/components/inputs/autocomplete/index.ts +0 -1
- package/src/components/inputs/date-range-calendar/date-range-calendar.stories.tsx +0 -19
- package/src/components/inputs/date-range-calendar/date-range-calendar.test.tsx +0 -150
- package/src/components/inputs/date-range-calendar/date-range-calendar.tsx +0 -118
- package/src/components/inputs/date-range-calendar/index.ts +0 -1
- package/src/components/inputs/date-range-picker/date-range-picker.stories.tsx +0 -32
- package/src/components/inputs/date-range-picker/date-range-picker.test.tsx +0 -165
- package/src/components/inputs/date-range-picker/date-range-picker.tsx +0 -67
- package/src/components/inputs/date-range-picker/index.ts +0 -1
- package/src/components/inputs/index.ts +0 -7
- package/src/components/inputs/inputs.stories.mdx +0 -17
- package/src/components/inputs/search-input/index.ts +0 -1
- package/src/components/inputs/search-input/search-input.stories.tsx +0 -60
- package/src/components/inputs/search-input/search-input.test.tsx +0 -166
- package/src/components/inputs/search-input/search-input.tsx +0 -218
- package/src/components/inputs/select/index.ts +0 -1
- package/src/components/inputs/select/select.stories.tsx +0 -107
- package/src/components/inputs/select/select.test.tsx +0 -96
- package/src/components/inputs/select/select.tsx +0 -108
- package/src/components/inputs/sign-in/index.ts +0 -1
- package/src/components/inputs/sign-in/sign-in.stories.tsx +0 -37
- package/src/components/inputs/sign-in/sign-in.test.tsx +0 -97
- package/src/components/inputs/sign-in/sign-in.tsx +0 -97
- package/src/components/inputs/text-field/index.ts +0 -1
- package/src/components/inputs/text-field/text-field.stories.tsx +0 -136
- package/src/components/inputs/text-field/text-field.test.tsx +0 -64
- package/src/components/inputs/text-field/text-field.tsx +0 -101
- package/src/components/navigation/index.ts +0 -2
- package/src/components/navigation/link/index.ts +0 -1
- package/src/components/navigation/link/link.tsx +0 -17
- package/src/components/navigation/navigation.stories.mdx +0 -10
- package/src/components/navigation/tab-card/index.ts +0 -2
- package/src/components/navigation/tab-card/tab-card-panel.tsx +0 -19
- package/src/components/navigation/tab-card/tab-card.context.tsx +0 -7
- package/src/components/navigation/tab-card/tab-card.dummy.tsx +0 -34
- package/src/components/navigation/tab-card/tab-card.stories.tsx +0 -21
- package/src/components/navigation/tab-card/tab-card.test.tsx +0 -74
- package/src/components/navigation/tab-card/tab-card.tsx +0 -81
- package/src/components/navigation/tab-panel/index.ts +0 -1
- package/src/components/navigation/tab-panel/tab-panel.test.tsx +0 -26
- package/src/components/navigation/tab-panel/tab-panel.tsx +0 -27
- package/src/components/placeholders/content-placeholder/content-placeholder.stories.tsx +0 -13
- package/src/components/placeholders/content-placeholder/content-placeholder.tsx +0 -17
- package/src/components/placeholders/content-placeholder/index.ts +0 -1
- package/src/components/placeholders/index.ts +0 -5
- package/src/components/placeholders/lorem-ipsum-placeholder/index.ts +0 -1
- package/src/components/placeholders/lorem-ipsum-placeholder/lorem-ipsum-placeholder.stories.tsx +0 -13
- package/src/components/placeholders/lorem-ipsum-placeholder/lorem-ipsum-placeholder.tsx +0 -26
- package/src/components/placeholders/placeholder/index.ts +0 -1
- package/src/components/placeholders/placeholder/placeholder.mock.ts +0 -15
- package/src/components/placeholders/placeholder/placeholder.stories.tsx +0 -45
- package/src/components/placeholders/placeholder/placeholder.test.tsx +0 -78
- package/src/components/placeholders/placeholder/placeholder.tsx +0 -77
- package/src/components/placeholders/placeholders.stories.mdx +0 -14
- package/src/components/placeholders/skeleton-card/index.ts +0 -1
- package/src/components/placeholders/skeleton-card/skeleton-card.stories.tsx +0 -17
- package/src/components/placeholders/skeleton-card/skeleton-card.tsx +0 -17
- package/src/components/placeholders/skeleton-grid/index.ts +0 -1
- package/src/components/placeholders/skeleton-grid/skeleton-grid.stories.tsx +0 -13
- package/src/components/placeholders/skeleton-grid/skeleton-grid.tsx +0 -20
- package/src/components/tables/enhanced-remote-table/enhanced-remote-table.mock.tsx +0 -28
- package/src/components/tables/enhanced-remote-table/enhanced-remote-table.stories.tsx +0 -22
- package/src/components/tables/enhanced-remote-table/enhanced-remote-table.test.tsx +0 -78
- package/src/components/tables/enhanced-remote-table/enhanced-remote-table.tsx +0 -74
- package/src/components/tables/enhanced-remote-table/index.ts +0 -1
- package/src/components/tables/enhanced-table/enhanced-table-head.tsx +0 -63
- package/src/components/tables/enhanced-table/enhanced-table.mock.tsx +0 -99
- package/src/components/tables/enhanced-table/enhanced-table.stories.tsx +0 -20
- package/src/components/tables/enhanced-table/enhanced-table.test.tsx +0 -108
- package/src/components/tables/enhanced-table/enhanced-table.tsx +0 -136
- package/src/components/tables/enhanced-table/index.ts +0 -2
- package/src/components/tables/index.ts +0 -2
- package/src/components/tables/table.stories.mdx +0 -11
- package/src/components/value-displays/group-value-card/group-value-card.mock.tsx +0 -61
- package/src/components/value-displays/group-value-card/group-value-card.stories.tsx +0 -76
- package/src/components/value-displays/group-value-card/group-value-card.test.tsx +0 -61
- package/src/components/value-displays/group-value-card/group-value-card.tsx +0 -60
- package/src/components/value-displays/group-value-card/index.ts +0 -1
- package/src/components/value-displays/index.ts +0 -10
- package/src/components/value-displays/value-base/index.ts +0 -2
- package/src/components/value-displays/value-base/value-displays.types.ts +0 -36
- package/src/components/value-displays/value-base/value-edit.test.tsx +0 -88
- package/src/components/value-displays/value-base/value-edit.tsx +0 -81
- package/src/components/value-displays/value-boolean/index.ts +0 -1
- package/src/components/value-displays/value-boolean/value-boolean.stories.tsx +0 -49
- package/src/components/value-displays/value-boolean/value-boolean.test.tsx +0 -133
- package/src/components/value-displays/value-boolean/value-boolean.tsx +0 -66
- package/src/components/value-displays/value-card/index.ts +0 -1
- package/src/components/value-displays/value-card/value-card.stories.tsx +0 -22
- package/src/components/value-displays/value-card/value-card.test.tsx +0 -18
- package/src/components/value-displays/value-card/value-card.tsx +0 -12
- package/src/components/value-displays/value-content/index.ts +0 -1
- package/src/components/value-displays/value-content/value-content.stories.tsx +0 -27
- package/src/components/value-displays/value-content/value-content.test.tsx +0 -64
- package/src/components/value-displays/value-content/value-content.tsx +0 -81
- package/src/components/value-displays/value-datetime/index.ts +0 -1
- package/src/components/value-displays/value-datetime/value-datetime.stories.tsx +0 -86
- package/src/components/value-displays/value-datetime/value-datetime.test.tsx +0 -141
- package/src/components/value-displays/value-datetime/value-datetime.tsx +0 -99
- package/src/components/value-displays/value-displays.stories.mdx +0 -39
- package/src/components/value-displays/value-image/index.ts +0 -1
- package/src/components/value-displays/value-image/value-image.stories.tsx +0 -37
- package/src/components/value-displays/value-image/value-image.test.tsx +0 -22
- package/src/components/value-displays/value-image/value-image.tsx +0 -26
- package/src/components/value-displays/value-item/index.ts +0 -1
- package/src/components/value-displays/value-item/value-item.stories.tsx +0 -45
- package/src/components/value-displays/value-item/value-item.test.tsx +0 -20
- package/src/components/value-displays/value-item/value-item.tsx +0 -54
- package/src/components/value-displays/value-label/index.ts +0 -1
- package/src/components/value-displays/value-label/value-label.stories.tsx +0 -78
- package/src/components/value-displays/value-label/value-label.test.tsx +0 -72
- package/src/components/value-displays/value-label/value-label.tsx +0 -45
- package/src/components/value-displays/value-rating/index.ts +0 -1
- package/src/components/value-displays/value-rating/value-rating.stories.tsx +0 -55
- package/src/components/value-displays/value-rating/value-rating.test.tsx +0 -105
- package/src/components/value-displays/value-rating/value-rating.tsx +0 -48
- package/src/components/value-displays/value-text/index.ts +0 -1
- package/src/components/value-displays/value-text/value-text.stories.tsx +0 -72
- package/src/components/value-displays/value-text/value-text.test.tsx +0 -129
- package/src/components/value-displays/value-text/value-text.tsx +0 -67
- package/src/generators/generators.mock.ts +0 -298
- package/src/generators/generators.model.test.ts +0 -79
- package/src/generators/generators.model.ts +0 -180
- package/src/generators/generators.stories.mdx +0 -13
- package/src/generators/index.ts +0 -5
- package/src/generators/model-form/index.ts +0 -1
- package/src/generators/model-form/model-form-field.tsx +0 -269
- package/src/generators/model-form/model-form.stories.tsx +0 -40
- package/src/generators/model-form/model-form.test.tsx +0 -133
- package/src/generators/model-form/model-form.tsx +0 -62
- package/src/generators/model-router/index.ts +0 -2
- package/src/generators/model-router/model-router.test.tsx +0 -1104
- package/src/generators/model-router/model-router.tsx +0 -30
- package/src/generators/model-router/model-router.types.ts +0 -18
- package/src/generators/model-router/screens/add-screen.tsx +0 -67
- package/src/generators/model-router/screens/details-screen.tsx +0 -64
- package/src/generators/model-router/screens/index.ts +0 -4
- package/src/generators/model-router/screens/list-screen.tsx +0 -143
- package/src/generators/model-router/screens/screens.types.ts +0 -38
- package/src/generators/model-router/screens/update-screen.tsx +0 -105
- package/src/generators/model-router/stories/details-screen.stories.tsx +0 -39
- package/src/generators/model-router/stories/list-screen.stories.tsx +0 -102
- package/src/generators/model-router/stories/model-router.stories.tsx +0 -229
- package/src/generators/model-router/stories/templates.tsx +0 -33
- package/src/generators/object-details/index.ts +0 -1
- package/src/generators/object-details/object-details.stories.tsx +0 -30
- package/src/generators/object-details/object-details.test.tsx +0 -22
- package/src/generators/object-details/object-details.tsx +0 -169
- package/src/generators/table-list/index.ts +0 -1
- package/src/generators/table-list/table-list.stories.tsx +0 -91
- package/src/generators/table-list/table-list.test.tsx +0 -297
- package/src/generators/table-list/table-list.tsx +0 -138
- package/src/hooks/index.ts +0 -1
- package/src/hooks/routing/index.ts +0 -1
- package/src/hooks/routing/routing.hooks.ts +0 -23
- package/src/hooks/routing/routing.test.tsx +0 -83
- package/src/index.ts +0 -5
- package/src/layouts/drawer-layout/drawer-layout.stories.tsx +0 -57
- package/src/layouts/drawer-layout/drawer-layout.test.tsx +0 -41
- package/src/layouts/drawer-layout/drawer-layout.tsx +0 -26
- package/src/layouts/drawer-layout/index.ts +0 -1
- package/src/layouts/header-layout/header-layout.stories.tsx +0 -245
- package/src/layouts/header-layout/header-layout.test.tsx +0 -102
- package/src/layouts/header-layout/header-layout.tsx +0 -49
- package/src/layouts/header-layout/index.ts +0 -1
- package/src/layouts/index.ts +0 -2
- package/src/layouts/layouts.stories.mdx +0 -11
- package/src/providers/index.ts +0 -2
- package/src/providers/notification-center/index.ts +0 -3
- package/src/providers/notification-center/notification-center.context.ts +0 -31
- package/src/providers/notification-center/notification-center.hooks.ts +0 -23
- package/src/providers/notification-center/notification-center.provider.tsx +0 -51
- package/src/providers/notification-center/notification-center.stories.tsx +0 -52
- package/src/providers/notification-center/notification-center.test.tsx +0 -198
- package/src/providers/tab-provider/index.ts +0 -2
- package/src/providers/tab-provider/tab-provider.context.ts +0 -8
- package/src/providers/tab-provider/tab-provider.provider.tsx +0 -13
- package/src/stories/Introduction.stories.mdx +0 -33
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/stories/assets/work-in-progress.jpg +0 -0
- package/src/stories/getting-started.stories.mdx +0 -23
- package/src/storybook.tsx +0 -139
- package/src/tests/actions.ts +0 -48
- package/src/tests/assertions.ts +0 -206
- package/src/tests/datatable-placeholder/datatable-placeholder.stories.tsx +0 -13
- package/src/tests/datatable-placeholder/datatable-placeholder.tsx +0 -38
- package/src/tests/datatable-placeholder/index.ts +0 -1
- package/src/tests/file-mock.ts +0 -1
- package/src/tests/mocks/markdown.mock.ts +0 -25
- package/src/tests/mocks.ts +0 -23
- package/src/tests/testing-library.tsx +0 -79
- package/src/types/index.d.ts +0 -10
- package/src/types.d.ts +0 -4
- package/src/utils/arrays.test.ts +0 -9
- package/src/utils/arrays.ts +0 -7
- package/src/utils/breakpoints.test.ts +0 -42
- package/src/utils/breakpoints.ts +0 -62
- package/src/utils/forms.ts +0 -11
- package/src/utils/index.ts +0 -4
- package/src/utils/theme.ts +0 -11
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
Breadcrumbs,
|
|
4
|
-
Typography,
|
|
5
|
-
Container,
|
|
6
|
-
useTheme,
|
|
7
|
-
Box,
|
|
8
|
-
Tabs,
|
|
9
|
-
Tab,
|
|
10
|
-
Button,
|
|
11
|
-
} from "@mui/material";
|
|
12
|
-
import { Link } from "../../navigation/link";
|
|
13
|
-
import { useGetDefaultThemeColor } from "../../../utils";
|
|
14
|
-
import { HeaderComponent, HeaderPreset, HeaderProps } from "./header.types";
|
|
15
|
-
import { useTab } from "~/providers";
|
|
16
|
-
import { useLocation } from "react-router-dom";
|
|
17
|
-
import { HeaderSubtitle, HeaderTitle } from "./header-title";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Section used to explain give basic information about the page
|
|
21
|
-
* and put the main actions
|
|
22
|
-
*/
|
|
23
|
-
export const Header: HeaderComponent = ({
|
|
24
|
-
title = "",
|
|
25
|
-
loadingTitle,
|
|
26
|
-
subtitle,
|
|
27
|
-
loadingSubtitle,
|
|
28
|
-
preset = "default",
|
|
29
|
-
actionsVariant = "outlined",
|
|
30
|
-
breadcrumbs,
|
|
31
|
-
actions,
|
|
32
|
-
tabs,
|
|
33
|
-
tabsMode = "panel",
|
|
34
|
-
navigationButton,
|
|
35
|
-
}: HeaderProps) => {
|
|
36
|
-
const location = useLocation();
|
|
37
|
-
const { palette } = useTheme();
|
|
38
|
-
const defaultColor = useGetDefaultThemeColor();
|
|
39
|
-
const [selectedTab, setSelectedTab] = useTab();
|
|
40
|
-
|
|
41
|
-
const bgColorPresets: Record<HeaderPreset, string> = {
|
|
42
|
-
default: defaultColor,
|
|
43
|
-
primary: palette.primary.main,
|
|
44
|
-
secondary: palette.secondary.main,
|
|
45
|
-
inherit: "inherit",
|
|
46
|
-
transparent: "transparent",
|
|
47
|
-
};
|
|
48
|
-
const bgColor = bgColorPresets[preset];
|
|
49
|
-
const textColorPresets: Record<HeaderPreset, string> = {
|
|
50
|
-
default: palette.getContrastText(bgColorPresets.default),
|
|
51
|
-
primary: palette.primary.contrastText,
|
|
52
|
-
secondary: palette.secondary.contrastText,
|
|
53
|
-
inherit: "inherit",
|
|
54
|
-
transparent: palette.text.primary,
|
|
55
|
-
};
|
|
56
|
-
const textColor = textColorPresets[preset];
|
|
57
|
-
|
|
58
|
-
const modedSelectedTab =
|
|
59
|
-
tabsMode === "panel" ? selectedTab : tabs?.findIndex((tab) => tab.href === location.pathname);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<Box bgcolor={bgColor} color={textColor}>
|
|
63
|
-
<Container>
|
|
64
|
-
<Box sx={{ py: 3, display: "flex", flexDirection: "row", justifyContent: "space-between" }}>
|
|
65
|
-
<Box>
|
|
66
|
-
{navigationButton && (
|
|
67
|
-
<Button
|
|
68
|
-
href={navigationButton.href}
|
|
69
|
-
size="small"
|
|
70
|
-
color="inherit"
|
|
71
|
-
LinkComponent={Link}
|
|
72
|
-
startIcon={navigationButton.icon}
|
|
73
|
-
sx={{ mb: 1 }}
|
|
74
|
-
>
|
|
75
|
-
{navigationButton.text}
|
|
76
|
-
</Button>
|
|
77
|
-
)}
|
|
78
|
-
{breadcrumbs?.length && (
|
|
79
|
-
<Breadcrumbs
|
|
80
|
-
color="inherit"
|
|
81
|
-
separator="›"
|
|
82
|
-
aria-label="breadcrumb"
|
|
83
|
-
sx={{ marginTop: 1 }}
|
|
84
|
-
>
|
|
85
|
-
{breadcrumbs.map(({ id, link, text }) => (
|
|
86
|
-
<Link
|
|
87
|
-
key={id}
|
|
88
|
-
underline="hover"
|
|
89
|
-
color="inherit"
|
|
90
|
-
href={link}
|
|
91
|
-
variant="body2"
|
|
92
|
-
role="link"
|
|
93
|
-
>
|
|
94
|
-
{text}
|
|
95
|
-
</Link>
|
|
96
|
-
))}
|
|
97
|
-
</Breadcrumbs>
|
|
98
|
-
)}
|
|
99
|
-
<HeaderTitle loading={loadingTitle}>{title}</HeaderTitle>
|
|
100
|
-
{(subtitle || loadingSubtitle) && (
|
|
101
|
-
<HeaderSubtitle loading={loadingSubtitle}>{subtitle}</HeaderSubtitle>
|
|
102
|
-
)}
|
|
103
|
-
</Box>
|
|
104
|
-
{actions && (
|
|
105
|
-
<Box>
|
|
106
|
-
{actions.map(({ disabled, id, href, onClick, text }, i) => (
|
|
107
|
-
<Button
|
|
108
|
-
component={href ? Link : "button"}
|
|
109
|
-
role="button"
|
|
110
|
-
color="inherit"
|
|
111
|
-
disabled={disabled}
|
|
112
|
-
key={id}
|
|
113
|
-
variant={actionsVariant}
|
|
114
|
-
size="small"
|
|
115
|
-
href={href}
|
|
116
|
-
onClick={onClick}
|
|
117
|
-
sx={{ mr: i != actions.length - 1 ? 1 : 0 }}
|
|
118
|
-
>
|
|
119
|
-
{text}
|
|
120
|
-
</Button>
|
|
121
|
-
))}
|
|
122
|
-
</Box>
|
|
123
|
-
)}
|
|
124
|
-
</Box>
|
|
125
|
-
{tabs && (
|
|
126
|
-
<Tabs
|
|
127
|
-
value={modedSelectedTab}
|
|
128
|
-
textColor="inherit"
|
|
129
|
-
onChange={tabsMode === "panel" ? (_, index) => setSelectedTab(index) : undefined}
|
|
130
|
-
>
|
|
131
|
-
{tabs.map(({ id, label, disabled, href }) => {
|
|
132
|
-
const tabProps = { label, disabled };
|
|
133
|
-
if (tabsMode === "panel") {
|
|
134
|
-
return <Tab key={id} {...tabProps} />;
|
|
135
|
-
} else {
|
|
136
|
-
return <Tab key={id} {...tabProps} component={Link} href={href} />;
|
|
137
|
-
}
|
|
138
|
-
})}
|
|
139
|
-
</Tabs>
|
|
140
|
-
)}
|
|
141
|
-
</Container>
|
|
142
|
-
</Box>
|
|
143
|
-
);
|
|
144
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { PropTypes } from "@mui/material";
|
|
2
|
-
import { FunctionComponent, ReactElement } from "react";
|
|
3
|
-
|
|
4
|
-
export type HeaderPreset = PropTypes.Color | "transparent";
|
|
5
|
-
export type HeaderActionVariant = "text" | "outlined" | "contained";
|
|
6
|
-
|
|
7
|
-
export type HeaderAction = {
|
|
8
|
-
id: string;
|
|
9
|
-
text: string;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
href?: string;
|
|
12
|
-
onClick?: () => void;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export interface HeaderBreadcrumb {
|
|
16
|
-
id: string;
|
|
17
|
-
text: string;
|
|
18
|
-
link: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface HeaderTab {
|
|
22
|
-
id: string;
|
|
23
|
-
label: string;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
href?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface HeaderNavigationButton {
|
|
29
|
-
/**
|
|
30
|
-
* Button text
|
|
31
|
-
*/
|
|
32
|
-
text: string;
|
|
33
|
-
/**
|
|
34
|
-
* Url where the user has to be redirected
|
|
35
|
-
*/
|
|
36
|
-
href: string;
|
|
37
|
-
/**
|
|
38
|
-
* Icon to be shown before the button
|
|
39
|
-
*/
|
|
40
|
-
icon?: ReactElement;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type HeaderProps = {
|
|
44
|
-
/**
|
|
45
|
-
* Title of the header
|
|
46
|
-
*/
|
|
47
|
-
title?: string | ReactElement;
|
|
48
|
-
/**
|
|
49
|
-
* Show a loading indicator in the title position
|
|
50
|
-
*/
|
|
51
|
-
loadingTitle?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Subtitle of the header
|
|
54
|
-
*/
|
|
55
|
-
subtitle?: string | ReactElement;
|
|
56
|
-
/**
|
|
57
|
-
* Show a loading indicator in the subtitle position
|
|
58
|
-
*/
|
|
59
|
-
loadingSubtitle?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Color palete used to render the component
|
|
62
|
-
*/
|
|
63
|
-
preset?: HeaderPreset;
|
|
64
|
-
/**
|
|
65
|
-
* List of breadcumbs to represent the path to reach
|
|
66
|
-
* the page that we are
|
|
67
|
-
*/
|
|
68
|
-
breadcrumbs?: HeaderBreadcrumb[];
|
|
69
|
-
/**
|
|
70
|
-
* List of actions that can be performed by the user.
|
|
71
|
-
* Each action will be a button in the header.
|
|
72
|
-
*/
|
|
73
|
-
actions?: HeaderAction[];
|
|
74
|
-
/**
|
|
75
|
-
* Variant used to render the actions
|
|
76
|
-
*/
|
|
77
|
-
actionsVariant?: HeaderActionVariant;
|
|
78
|
-
/**
|
|
79
|
-
* If is set, a list of tabs is dispayed at the bottom
|
|
80
|
-
*/
|
|
81
|
-
tabs?: HeaderTab[];
|
|
82
|
-
/**
|
|
83
|
-
* The tabs will work using
|
|
84
|
-
* - a panel container (panel)
|
|
85
|
-
* - using a the navigation system (navigation).
|
|
86
|
-
*/
|
|
87
|
-
tabsMode?: "panel" | "navigation";
|
|
88
|
-
/**
|
|
89
|
-
* A single button that helps the user to navigate to
|
|
90
|
-
* a screen related to the current screen
|
|
91
|
-
*/
|
|
92
|
-
navigationButton?: HeaderNavigationButton;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export type HeaderComponent = FunctionComponent<HeaderProps>;
|
|
96
|
-
export type HeaderElement = ReactElement<HeaderProps, HeaderComponent>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./label";
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Label } from "./label";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Data Display/Label",
|
|
6
|
-
component: Label,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: "centered",
|
|
9
|
-
},
|
|
10
|
-
} satisfies Meta<typeof Label>;
|
|
11
|
-
type Story = StoryObj<typeof Label>;
|
|
12
|
-
|
|
13
|
-
export const Default: Story = {
|
|
14
|
-
args: {
|
|
15
|
-
text: "lorem",
|
|
16
|
-
variant: "default",
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const Primary: Story = {
|
|
21
|
-
args: {
|
|
22
|
-
text: "lorem",
|
|
23
|
-
variant: "primary",
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Secondary: Story = {
|
|
28
|
-
args: {
|
|
29
|
-
text: "lorem",
|
|
30
|
-
variant: "secondary",
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const Info: Story = {
|
|
35
|
-
args: {
|
|
36
|
-
text: "lorem",
|
|
37
|
-
variant: "info",
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const Warning: Story = {
|
|
42
|
-
args: {
|
|
43
|
-
text: "lorem",
|
|
44
|
-
variant: "warning",
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Error: Story = {
|
|
49
|
-
args: {
|
|
50
|
-
text: "lorem",
|
|
51
|
-
variant: "error",
|
|
52
|
-
},
|
|
53
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Label, LabelVariant } from "./label";
|
|
3
|
-
import { render, screen } from "~/tests/testing-library";
|
|
4
|
-
|
|
5
|
-
describe("Label", () => {
|
|
6
|
-
const renderComponent = (variant: LabelVariant | undefined = undefined) => {
|
|
7
|
-
return render(<Label variant={variant} text="lorem ipsum" />);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
it("renders the label text", () => {
|
|
11
|
-
renderComponent();
|
|
12
|
-
|
|
13
|
-
expect(screen.getByText("lorem ipsum")).toBeInTheDocument();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("renders as default without a variant", () => {
|
|
17
|
-
renderComponent(undefined);
|
|
18
|
-
|
|
19
|
-
expect(screen.getByRole("label", { name: /default/i })).toBeVisible();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it.each([["primary"], ["secondary"], ["default"], ["info"], ["warning"], ["error"]])(
|
|
23
|
-
"renders correctly with variant %s",
|
|
24
|
-
(variant: string) => {
|
|
25
|
-
renderComponent(variant as LabelVariant);
|
|
26
|
-
|
|
27
|
-
expect(screen.getByRole("label", { name: `lorem ipsum ${variant} label` })).toBeVisible();
|
|
28
|
-
},
|
|
29
|
-
);
|
|
30
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { Box, SxProps, Theme, useTheme } from "@mui/material";
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
|
-
export type LabelVariant =
|
|
5
|
-
| "primary"
|
|
6
|
-
| "secondary"
|
|
7
|
-
| "default"
|
|
8
|
-
| "info"
|
|
9
|
-
| "warning"
|
|
10
|
-
| "error"
|
|
11
|
-
| "success";
|
|
12
|
-
|
|
13
|
-
export const labelClasses = {
|
|
14
|
-
root: "RdsLabel-root",
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export interface LabelProps {
|
|
18
|
-
/**
|
|
19
|
-
* Content of the component
|
|
20
|
-
*/
|
|
21
|
-
text: string;
|
|
22
|
-
/**
|
|
23
|
-
* Color palette used to draw the component
|
|
24
|
-
*/
|
|
25
|
-
variant?: LabelVariant;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Custom styles
|
|
29
|
-
*/
|
|
30
|
-
sx?: SxProps<Theme>;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Show the text as uppercase
|
|
34
|
-
*/
|
|
35
|
-
textTransform?: "none" | "capitalize" | "uppercase";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Compact element to represent a text
|
|
40
|
-
*/
|
|
41
|
-
export const Label = ({
|
|
42
|
-
text,
|
|
43
|
-
variant = "default",
|
|
44
|
-
textTransform = "capitalize",
|
|
45
|
-
sx,
|
|
46
|
-
}: LabelProps) => {
|
|
47
|
-
const { palette, typography } = useTheme();
|
|
48
|
-
|
|
49
|
-
const backgroundColor: Record<LabelVariant, string> = {
|
|
50
|
-
default: palette.mode === "light" ? palette.grey[100] : palette.grey[900],
|
|
51
|
-
primary: palette.primary.light,
|
|
52
|
-
secondary: palette.secondary.light,
|
|
53
|
-
info: palette.info.light,
|
|
54
|
-
warning: palette.warning.light,
|
|
55
|
-
error: palette.error.light,
|
|
56
|
-
success: palette.success.light,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const textColor: Record<LabelVariant, string> = {
|
|
60
|
-
default: palette.getContrastText(backgroundColor.default),
|
|
61
|
-
primary: palette.primary.contrastText,
|
|
62
|
-
secondary: palette.secondary.contrastText,
|
|
63
|
-
info: palette.info.contrastText,
|
|
64
|
-
warning: palette.warning.contrastText,
|
|
65
|
-
error: palette.error.contrastText,
|
|
66
|
-
success: palette.success.contrastText,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<Box
|
|
71
|
-
height={24}
|
|
72
|
-
minWidth={22}
|
|
73
|
-
display="inline-flex"
|
|
74
|
-
justifyContent="center"
|
|
75
|
-
alignItems="center"
|
|
76
|
-
bgcolor={backgroundColor[variant]}
|
|
77
|
-
color={textColor[variant]}
|
|
78
|
-
fontSize={typography.caption.fontSize}
|
|
79
|
-
fontWeight={typography.fontWeightBold}
|
|
80
|
-
lineHeight={0}
|
|
81
|
-
textTransform={textTransform}
|
|
82
|
-
whiteSpace="nowrap"
|
|
83
|
-
borderRadius={2}
|
|
84
|
-
role="label"
|
|
85
|
-
aria-label={`${text} ${variant} label`}
|
|
86
|
-
py={0}
|
|
87
|
-
px={1}
|
|
88
|
-
sx={{ cursor: "default", ...sx }}
|
|
89
|
-
>
|
|
90
|
-
{text}
|
|
91
|
-
</Box>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
File without changes
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { withContainer, withMemoryRouter } from "../../../storybook";
|
|
3
|
-
import { LinkCard } from "./link-card";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: "Components/Data Display/LinkCard",
|
|
7
|
-
component: LinkCard,
|
|
8
|
-
decorators: [withContainer({ width: 400 }), withMemoryRouter()],
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
} satisfies Meta<typeof LinkCard>;
|
|
13
|
-
type Story = StoryObj<typeof LinkCard>;
|
|
14
|
-
|
|
15
|
-
export const Primary: Story = {
|
|
16
|
-
args: {
|
|
17
|
-
title: "Lorem ipsum",
|
|
18
|
-
message:
|
|
19
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
|
20
|
-
linkText: "Learn more",
|
|
21
|
-
variant: "primary",
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Secondary: Story = {
|
|
26
|
-
args: {
|
|
27
|
-
...Primary.args,
|
|
28
|
-
variant: "secondary",
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const Info: Story = {
|
|
33
|
-
args: {
|
|
34
|
-
...Primary.args,
|
|
35
|
-
variant: "info",
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Warning: Story = {
|
|
40
|
-
args: {
|
|
41
|
-
...Primary.args,
|
|
42
|
-
variant: "warning",
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const Error: Story = {
|
|
47
|
-
args: {
|
|
48
|
-
...Primary.args,
|
|
49
|
-
variant: "error",
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const WithoutLinkButton: Story = {
|
|
54
|
-
args: {
|
|
55
|
-
title: "Lorem ipsum",
|
|
56
|
-
message:
|
|
57
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
|
58
|
-
},
|
|
59
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { render, screen } from "~/tests/testing-library";
|
|
2
|
-
import { LinkCard } from "./link-card";
|
|
3
|
-
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import React from "react";
|
|
5
|
-
|
|
6
|
-
describe("LinkCard", () => {
|
|
7
|
-
const renderComponent = ({ linkText }: { linkText?: string } = {}) => {
|
|
8
|
-
return render(
|
|
9
|
-
<LinkCard
|
|
10
|
-
title="Lorem ipsum"
|
|
11
|
-
message="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
|
|
12
|
-
href="/test"
|
|
13
|
-
linkText={linkText}
|
|
14
|
-
/>,
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
it("should render a title", () => {
|
|
19
|
-
renderComponent();
|
|
20
|
-
|
|
21
|
-
expect(screen.getByRole("heading", { level: 6, name: /lorem ipsum/i })).toBeVisible();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("should render a message", () => {
|
|
25
|
-
renderComponent();
|
|
26
|
-
|
|
27
|
-
expect(screen.getByText(/lorem ipsum dolor sit amet/i)).toBeVisible();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("should render a extra text if linkText is defined", () => {
|
|
31
|
-
renderComponent({ linkText: "check more" });
|
|
32
|
-
|
|
33
|
-
expect(screen.getByText(/check more/i)).toBeVisible();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("should navigate to the href if the card is clicked", async () => {
|
|
37
|
-
const { history } = renderComponent();
|
|
38
|
-
|
|
39
|
-
await userEvent.click(screen.getByText(/Lorem ipsum dolor sit amet/i));
|
|
40
|
-
|
|
41
|
-
expect(history.location.pathname).toBe("/test");
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Paper, SxProps, Theme, Typography, useTheme } from "@mui/material";
|
|
2
|
-
import { grey } from "@mui/material/colors";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Link } from "~/components/navigation/link";
|
|
5
|
-
|
|
6
|
-
export type LinkCardVariant = "primary" | "secondary" | "info" | "warning" | "error";
|
|
7
|
-
export interface LinkCardProps {
|
|
8
|
-
variant?: LinkCardVariant;
|
|
9
|
-
href: string;
|
|
10
|
-
title: string;
|
|
11
|
-
message: string;
|
|
12
|
-
linkText?: string;
|
|
13
|
-
sx?: SxProps<Theme>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const LinkCard = ({
|
|
17
|
-
variant = "primary",
|
|
18
|
-
title,
|
|
19
|
-
message,
|
|
20
|
-
href,
|
|
21
|
-
linkText,
|
|
22
|
-
sx,
|
|
23
|
-
}: LinkCardProps) => {
|
|
24
|
-
const { palette } = useTheme();
|
|
25
|
-
|
|
26
|
-
const rootSx: SxProps<Theme> = {
|
|
27
|
-
p: 3,
|
|
28
|
-
display: "flex",
|
|
29
|
-
flexDirection: "column",
|
|
30
|
-
textDecoration: "none",
|
|
31
|
-
backgroundColor: palette.mode === "light" ? grey[50] : grey[900],
|
|
32
|
-
borderColor: grey[400],
|
|
33
|
-
":hover": {
|
|
34
|
-
borderColor: palette[variant].main,
|
|
35
|
-
backgroundColor: palette.mode === "light" ? palette.common.white : grey[800],
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<Paper component={Link} href={href} variant="outlined" sx={{ ...rootSx, ...sx }}>
|
|
41
|
-
<Typography variant="h6">{title}</Typography>
|
|
42
|
-
<Typography variant="caption" sx={{ mt: 2 }}>
|
|
43
|
-
{message}
|
|
44
|
-
</Typography>
|
|
45
|
-
{linkText && (
|
|
46
|
-
<Typography color={variant} variant="button" sx={{ mt: 2 }}>
|
|
47
|
-
{linkText}
|
|
48
|
-
</Typography>
|
|
49
|
-
)}
|
|
50
|
-
</Paper>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./markdown";
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Markdown } from "./markdown";
|
|
3
|
-
import mockMarkdownContentFile from "~/tests/mocks/markdown.mock.md";
|
|
4
|
-
import { mockMarkdownContent } from "~/tests/mocks/markdown.mock";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: "Components/Data Display/Markdown",
|
|
8
|
-
component: Markdown,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
} satisfies Meta<typeof Markdown>;
|
|
13
|
-
type Story = StoryObj<typeof Markdown>;
|
|
14
|
-
|
|
15
|
-
export const File: Story = {
|
|
16
|
-
args: {
|
|
17
|
-
content: mockMarkdownContentFile,
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const StringVariable: Story = {
|
|
22
|
-
args: {
|
|
23
|
-
content: mockMarkdownContent,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Markdown } from "./markdown";
|
|
2
|
-
import { render, screen } from "~/tests/testing-library";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { mockMarkdownContent } from "~/tests/mocks/markdown.mock";
|
|
5
|
-
|
|
6
|
-
describe.skip("Markdown", () => {
|
|
7
|
-
const renderComponent = () => {
|
|
8
|
-
render(<Markdown content={mockMarkdownContent} />);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
it.each(["Diu in illa Lavini atque de quoque"])(
|
|
12
|
-
"should render the title '%s'",
|
|
13
|
-
(title: string) => {
|
|
14
|
-
renderComponent();
|
|
15
|
-
|
|
16
|
-
expect(screen.getByRole("heading", { name: title, level: 5 })).toBeVisible();
|
|
17
|
-
},
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
it.each([
|
|
21
|
-
["Secretaque nepos mentitis cupidine ponti dextramque nata"],
|
|
22
|
-
["Mota dixit"],
|
|
23
|
-
["Link section"],
|
|
24
|
-
["List section"],
|
|
25
|
-
])("should render the subtitle '%s'", (subtitle: string) => {
|
|
26
|
-
renderComponent();
|
|
27
|
-
|
|
28
|
-
expect(
|
|
29
|
-
screen.getByRole("heading", {
|
|
30
|
-
name: subtitle,
|
|
31
|
-
level: 6,
|
|
32
|
-
}),
|
|
33
|
-
).toBeVisible();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it.each([
|
|
37
|
-
"funesta opposuitque deus adloquitur reminiscitur manibus ales? Spumisque fulva, veneni, vicit dum? Ipse responsa equo!",
|
|
38
|
-
"Deos debebat, in tenuit postquam candida errorem vires undis limina ignis pectora capere dant, in curvo",
|
|
39
|
-
"Dum tot tum nunc, atque deae telum rustica tuebere tacti dat. Nunc quasi Tritonidos fluminis. Ulli regnat clamant luminis moenia; hoc numen accipe, indefletaeque artesque fores ales in concumbere. Boves humi regimen, vulnus ore adspicias, sit mutua nega, illud; quam fruges meritis.",
|
|
40
|
-
])("should render the content '%s'", (content: string) => {
|
|
41
|
-
renderComponent();
|
|
42
|
-
|
|
43
|
-
expect(screen.getByText(content)).toBeVisible();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it.each([["toto link"]])("should render the link '%s'", (link: string) => {
|
|
47
|
-
renderComponent();
|
|
48
|
-
|
|
49
|
-
expect(screen.getByRole("link", { name: link })).toBeVisible();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it.each([
|
|
53
|
-
["Cum bella cantato"],
|
|
54
|
-
["Sinistra maternos tamen Gorgonis sim aquis"],
|
|
55
|
-
["Quo orat dabitur Dianae ira timendi templi"],
|
|
56
|
-
["Cum oro Lycabas ultima"],
|
|
57
|
-
["Haut ad dedit reducit crimina adhaeret pectore"],
|
|
58
|
-
["Vulnere latebramque minima"],
|
|
59
|
-
])("should render the list item '%s'", (listItem: string) => {
|
|
60
|
-
renderComponent();
|
|
61
|
-
|
|
62
|
-
expect(screen.getByText(listItem)).toBeVisible();
|
|
63
|
-
});
|
|
64
|
-
});
|