@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,19 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren, useContext } from "react";
|
|
2
|
-
import { TabCardContext } from "./tab-card.context";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { Box, SxProps, Theme } from "@mui/material";
|
|
5
|
-
|
|
6
|
-
export type TabCardPanelProps = PropsWithChildren<{
|
|
7
|
-
index: number | number[];
|
|
8
|
-
sx?: SxProps<Theme>;
|
|
9
|
-
}>;
|
|
10
|
-
|
|
11
|
-
export const TabCardPanel = ({ index, children, sx }: TabCardPanelProps) => {
|
|
12
|
-
const [value] = useContext(TabCardContext);
|
|
13
|
-
let isTab = value === index;
|
|
14
|
-
if (Array.isArray(index)) {
|
|
15
|
-
isTab = index.includes(value);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return isTab ? <Box sx={sx}>{children}</Box> : null;
|
|
19
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { TabCard, TabData } from "./tab-card";
|
|
3
|
-
import { Typography } from "@mui/material";
|
|
4
|
-
import { TabCardPanel } from "./tab-card-panel";
|
|
5
|
-
import { Label } from "~/components/data-display";
|
|
6
|
-
|
|
7
|
-
export const DummyTabs = [
|
|
8
|
-
{ text: "tab 1" },
|
|
9
|
-
{ text: "tab 2.1", icon: <Label text="10" variant="success" sx={{ mr: 1 }} /> },
|
|
10
|
-
{ text: "tab 2.2" },
|
|
11
|
-
{ text: "tab 3", icon: <Label text="12" variant="error" sx={{ mr: 1 }} /> },
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
export interface TabCardDummyProps {
|
|
15
|
-
tabs: TabData[];
|
|
16
|
-
initialTab: number;
|
|
17
|
-
onChangeTab: (tab: TabData, index: number) => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function TabCardDummy({ tabs, initialTab, onChangeTab }: TabCardDummyProps) {
|
|
21
|
-
return (
|
|
22
|
-
<TabCard tabs={tabs} initialTab={initialTab} onChangeTab={onChangeTab}>
|
|
23
|
-
<TabCardPanel index={0} sx={{ p: 2 }}>
|
|
24
|
-
<Typography>Panel 1</Typography>
|
|
25
|
-
</TabCardPanel>
|
|
26
|
-
<TabCardPanel index={[1, 2]} sx={{ p: 2 }}>
|
|
27
|
-
<Typography>Panel 2</Typography>
|
|
28
|
-
</TabCardPanel>
|
|
29
|
-
<TabCardPanel index={3} sx={{ p: 2 }}>
|
|
30
|
-
<Typography>Panel 3</Typography>
|
|
31
|
-
</TabCardPanel>
|
|
32
|
-
</TabCard>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { DummyTabs, TabCardDummy, TabCardDummyProps } from "./tab-card.dummy";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: "Components/Navigation/TabCard",
|
|
7
|
-
component: TabCardDummy,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: "centered",
|
|
10
|
-
},
|
|
11
|
-
render: (props: TabCardDummyProps) => {
|
|
12
|
-
return <TabCardDummy {...props} />;
|
|
13
|
-
},
|
|
14
|
-
} satisfies Meta<typeof TabCardDummy>;
|
|
15
|
-
type Story = StoryObj<typeof TabCardDummy>;
|
|
16
|
-
|
|
17
|
-
export const Default: Story = {
|
|
18
|
-
args: {
|
|
19
|
-
tabs: DummyTabs,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { DummyTabs, TabCardDummy } from "./tab-card.dummy";
|
|
3
|
-
import { screen, render } from "~/tests/testing-library";
|
|
4
|
-
import userEvent from "@testing-library/user-event";
|
|
5
|
-
import { vi } from "vitest";
|
|
6
|
-
|
|
7
|
-
describe("TabCard", () => {
|
|
8
|
-
function renderComponent({ initialTab = 0 } = {}) {
|
|
9
|
-
const onChangeTab = vi.fn();
|
|
10
|
-
render(<TabCardDummy tabs={DummyTabs} initialTab={initialTab} onChangeTab={onChangeTab} />);
|
|
11
|
-
return { onChangeTab };
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
it('initialTab is not set the "panel 1" is displayed', () => {
|
|
15
|
-
renderComponent();
|
|
16
|
-
|
|
17
|
-
expect(screen.getByText(/panel 1/i)).toBeInTheDocument();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('initialTab is set to 3 the "panel 3" is displayed', () => {
|
|
21
|
-
renderComponent({ initialTab: 3 });
|
|
22
|
-
|
|
23
|
-
expect(screen.getByText(/panel 3/i)).toBeInTheDocument();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("should render the tab labels", () => {
|
|
27
|
-
renderComponent();
|
|
28
|
-
|
|
29
|
-
expect(screen.getByText(/10/i)).toBeVisible();
|
|
30
|
-
expect(screen.getByText(/12/i)).toBeVisible();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe("click tab", () => {
|
|
34
|
-
it.each([
|
|
35
|
-
[/tab 1/i, /panel 1/i],
|
|
36
|
-
[/tab 2.1/i, /panel 2/i],
|
|
37
|
-
[/tab 2.2/i, /panel 2/i],
|
|
38
|
-
[/tab 3/i, /panel 3/i],
|
|
39
|
-
])(
|
|
40
|
-
'click the tab "%s" the "%s" panel is displayed',
|
|
41
|
-
async (tabName: RegExp, expectedText: RegExp) => {
|
|
42
|
-
renderComponent();
|
|
43
|
-
|
|
44
|
-
const tab = screen.getByRole("tab", { name: tabName });
|
|
45
|
-
await userEvent.click(tab);
|
|
46
|
-
|
|
47
|
-
expect(screen.getByText(expectedText)).toBeInTheDocument();
|
|
48
|
-
expect(tab).toHaveAttribute("aria-selected", "true");
|
|
49
|
-
},
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
it('click the tab "tab 2" and click again the tab "tab 1" the "panel 1" is displayed', async () => {
|
|
53
|
-
renderComponent();
|
|
54
|
-
|
|
55
|
-
const tab1 = screen.getByRole("tab", { name: /tab 1/i });
|
|
56
|
-
const tab2 = screen.getByRole("tab", { name: /tab 2.1/i });
|
|
57
|
-
await userEvent.click(tab2);
|
|
58
|
-
await userEvent.click(tab1);
|
|
59
|
-
|
|
60
|
-
expect(screen.getByText(/panel 1/i)).toBeInTheDocument();
|
|
61
|
-
expect(screen.getByRole("tab", { name: /tab 1/i, selected: true })).toBeVisible();
|
|
62
|
-
expect(screen.getByRole("tab", { name: /tab 2.1/i, selected: false })).toBeVisible();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("should call onChangeTab", async () => {
|
|
66
|
-
const { onChangeTab } = renderComponent();
|
|
67
|
-
|
|
68
|
-
await userEvent.click(screen.getByRole("tab", { name: /tab 2.2/i }));
|
|
69
|
-
|
|
70
|
-
expect(onChangeTab).toHaveBeenCalledTimes(1);
|
|
71
|
-
expect(onChangeTab).toHaveBeenCalledWith({ text: "tab 2.2" }, 2);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Paper, Tabs, Tab, styled, Box } from "@mui/material";
|
|
2
|
-
import React, { PropsWithChildren, ReactElement, SyntheticEvent, useState } from "react";
|
|
3
|
-
import { TabCardContextProvider } from "./tab-card.context";
|
|
4
|
-
import { useGetDefaultThemeColor } from "~/utils";
|
|
5
|
-
|
|
6
|
-
export interface TabData {
|
|
7
|
-
text: string;
|
|
8
|
-
icon?: ReactElement;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface StyledTabsProps {
|
|
12
|
-
children?: React.ReactNode;
|
|
13
|
-
value: number;
|
|
14
|
-
onChange: (event: React.SyntheticEvent, newValue: number) => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const StyledTabs = styled((props: StyledTabsProps) => (
|
|
18
|
-
<Tabs {...props} TabIndicatorProps={{ children: <span className="MuiTabs-indicatorSpan" /> }} />
|
|
19
|
-
))(({ theme }) => ({
|
|
20
|
-
minHeight: theme.spacing(5),
|
|
21
|
-
"& .MuiTabs-indicator": {
|
|
22
|
-
display: "flex",
|
|
23
|
-
justifyContent: "center",
|
|
24
|
-
backgroundColor: "transparent",
|
|
25
|
-
},
|
|
26
|
-
"& .MuiTabs-indicatorSpan": {
|
|
27
|
-
maxWidth: 40,
|
|
28
|
-
width: "100%",
|
|
29
|
-
backgroundColor: theme.palette.primary.main,
|
|
30
|
-
},
|
|
31
|
-
}));
|
|
32
|
-
|
|
33
|
-
const StyledTab = styled(Tab)(({ theme }) => ({
|
|
34
|
-
textTransform: "none",
|
|
35
|
-
fontWeight: theme.typography.fontWeightRegular,
|
|
36
|
-
marginRight: theme.spacing(1),
|
|
37
|
-
color: theme.palette.text.secondary,
|
|
38
|
-
paddingTop: 0,
|
|
39
|
-
paddingBottom: 0,
|
|
40
|
-
minHeight: theme.spacing(5),
|
|
41
|
-
"&.Mui-selected": {
|
|
42
|
-
color: theme.palette.text.secondary,
|
|
43
|
-
fontWeight: theme.typography.fontWeightBold,
|
|
44
|
-
},
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
export type TabCardProps = PropsWithChildren<{
|
|
48
|
-
tabs: TabData[];
|
|
49
|
-
initialTab?: number;
|
|
50
|
-
onChangeTab?: (tab: TabData, index: number) => void;
|
|
51
|
-
}>;
|
|
52
|
-
|
|
53
|
-
export const TabCard = ({
|
|
54
|
-
children,
|
|
55
|
-
tabs,
|
|
56
|
-
initialTab = 0,
|
|
57
|
-
onChangeTab = () => null,
|
|
58
|
-
}: TabCardProps) => {
|
|
59
|
-
const bgColor = useGetDefaultThemeColor();
|
|
60
|
-
const [selectedTab, setSelectedTab] = useState(initialTab);
|
|
61
|
-
|
|
62
|
-
const handleChangeTab = (_: SyntheticEvent<Element, Event>, index: number) => {
|
|
63
|
-
setSelectedTab(index);
|
|
64
|
-
onChangeTab(tabs[index], index);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<TabCardContextProvider value={[selectedTab, setSelectedTab]}>
|
|
69
|
-
<Paper variant="outlined">
|
|
70
|
-
<Box bgcolor={bgColor}>
|
|
71
|
-
<StyledTabs value={selectedTab} onChange={handleChangeTab}>
|
|
72
|
-
{tabs.map(({ text, icon }) => (
|
|
73
|
-
<StyledTab iconPosition="start" disableRipple key={text} label={text} icon={icon} />
|
|
74
|
-
))}
|
|
75
|
-
</StyledTabs>
|
|
76
|
-
</Box>
|
|
77
|
-
{children}
|
|
78
|
-
</Paper>
|
|
79
|
-
</TabCardContextProvider>
|
|
80
|
-
);
|
|
81
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./tab-panel";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, screen } from "@testing-library/react";
|
|
3
|
-
import { TabPanel } from "./tab-panel";
|
|
4
|
-
import { TabProvider } from "../../../providers";
|
|
5
|
-
|
|
6
|
-
describe("TabPanel", () => {
|
|
7
|
-
function renderInstance(initialValue: number) {
|
|
8
|
-
render(
|
|
9
|
-
<TabProvider initialValue={initialValue}>
|
|
10
|
-
<TabPanel index={0}>Panel content</TabPanel>
|
|
11
|
-
</TabProvider>,
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
it("if the provider value is the index the content is displayed", () => {
|
|
16
|
-
renderInstance(0);
|
|
17
|
-
|
|
18
|
-
expect(screen.getByText(/panel content/i)).toBeInTheDocument();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("if the provider value is not the index the content is not displayed", () => {
|
|
22
|
-
renderInstance(1);
|
|
23
|
-
|
|
24
|
-
expect(screen.queryByText(/panel content/i)).not.toBeInTheDocument();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Box } from "@mui/material";
|
|
3
|
-
import { useTab } from "~/providers";
|
|
4
|
-
|
|
5
|
-
interface TabPanelProps {
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
index: number | number[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function TabPanel({ children, index }: TabPanelProps) {
|
|
11
|
-
const [value] = useTab();
|
|
12
|
-
let isTab = value === index;
|
|
13
|
-
if (Array.isArray(index)) {
|
|
14
|
-
isTab = index.includes(value);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div
|
|
19
|
-
role="tabpanel"
|
|
20
|
-
hidden={!isTab}
|
|
21
|
-
id={`simple-tabpanel-${index}`}
|
|
22
|
-
aria-labelledby={`simple-tab-${index}`}
|
|
23
|
-
>
|
|
24
|
-
{isTab && <Box sx={{ p: 3 }}>{children}</Box>}
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { ContentPlaceholder } from "./content-placeholder";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Placeholders/ContentPlaceholder",
|
|
6
|
-
component: ContentPlaceholder,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: "fullscreen",
|
|
9
|
-
},
|
|
10
|
-
} satisfies Meta<typeof ContentPlaceholder>;
|
|
11
|
-
type Story = StoryObj<typeof ContentPlaceholder>;
|
|
12
|
-
|
|
13
|
-
export const Default: Story = {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Container } from "@mui/material";
|
|
2
|
-
import React, { PropsWithChildren } from "react";
|
|
3
|
-
import { SkeletonGrid } from "../skeleton-grid";
|
|
4
|
-
|
|
5
|
-
export type ContentPlaceholderProps = PropsWithChildren<{
|
|
6
|
-
size?: number;
|
|
7
|
-
p?: number;
|
|
8
|
-
}>;
|
|
9
|
-
|
|
10
|
-
export const ContentPlaceholder = ({ size = 20, children, p }: ContentPlaceholderProps) => {
|
|
11
|
-
return (
|
|
12
|
-
<Container component="main" sx={{ p }} data-testid="content-placeholder-test">
|
|
13
|
-
{children}
|
|
14
|
-
<SkeletonGrid size={size} />
|
|
15
|
-
</Container>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./content-placeholder";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./lorem-ipsum-placeholder";
|
package/src/components/placeholders/lorem-ipsum-placeholder/lorem-ipsum-placeholder.stories.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { LoremIpsumPlaceholder } from "./lorem-ipsum-placeholder";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Placeholders/LoremIpsumPlaceholder",
|
|
6
|
-
component: LoremIpsumPlaceholder,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: "centered",
|
|
9
|
-
},
|
|
10
|
-
} satisfies Meta<typeof LoremIpsumPlaceholder>;
|
|
11
|
-
type Story = StoryObj<typeof LoremIpsumPlaceholder>;
|
|
12
|
-
|
|
13
|
-
export const Default: Story = {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Typography } from "@mui/material";
|
|
2
|
-
import { Variant } from "@mui/material/styles/createTypography";
|
|
3
|
-
import { loremIpsum } from "lorem-ipsum";
|
|
4
|
-
import { LoremUnit } from "lorem-ipsum/types/src/constants/units";
|
|
5
|
-
import React from "react";
|
|
6
|
-
|
|
7
|
-
export interface LoremIpsumPlaceholderProps {
|
|
8
|
-
count?: number;
|
|
9
|
-
units?: LoremUnit;
|
|
10
|
-
variant?: Variant;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const LoremIpsumPlaceholder = ({
|
|
14
|
-
count = 3,
|
|
15
|
-
units = "paragraph",
|
|
16
|
-
variant = "body1",
|
|
17
|
-
}: LoremIpsumPlaceholderProps) => {
|
|
18
|
-
return (
|
|
19
|
-
<Typography variant={variant}>
|
|
20
|
-
{loremIpsum({
|
|
21
|
-
count,
|
|
22
|
-
units,
|
|
23
|
-
})}
|
|
24
|
-
</Typography>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./placeholder";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PlaceholderAction } from "./placeholder";
|
|
2
|
-
import { action } from "@storybook/addon-actions";
|
|
3
|
-
|
|
4
|
-
export const actions: PlaceholderAction[] = [
|
|
5
|
-
{
|
|
6
|
-
id: "add",
|
|
7
|
-
text: "Add",
|
|
8
|
-
href: "/placeholders/add",
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
id: "edit",
|
|
12
|
-
text: "Edit",
|
|
13
|
-
onClick: action("on click edit action"),
|
|
14
|
-
},
|
|
15
|
-
];
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { Placeholder, PlaceholderIconArgs } from "./placeholder";
|
|
4
|
-
import SearchIcon from "@mui/icons-material/Search";
|
|
5
|
-
import { actions } from "./placeholder.mock";
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: "Components/Placeholders/Placeholder",
|
|
9
|
-
component: Placeholder,
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: "fullscreen",
|
|
12
|
-
},
|
|
13
|
-
} satisfies Meta<typeof Placeholder>;
|
|
14
|
-
type Story = StoryObj<typeof Placeholder>;
|
|
15
|
-
|
|
16
|
-
export const Default: Story = {
|
|
17
|
-
args: {
|
|
18
|
-
title: "Lorem ipsum dolor sit amet",
|
|
19
|
-
subtitle:
|
|
20
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eleifend at libero in tristique. Pellentesque bibendum arcu eget augue commodo, non convallis eros porttitor",
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const WithIcon: Story = {
|
|
25
|
-
args: {
|
|
26
|
-
icon: ({ size, color }: PlaceholderIconArgs) => (
|
|
27
|
-
<SearchIcon color={color} sx={{ fontSize: size }} />
|
|
28
|
-
),
|
|
29
|
-
title: "Lorem ipsum dolor sit amet",
|
|
30
|
-
subtitle:
|
|
31
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eleifend at libero in tristique. Pellentesque bibendum arcu eget augue commodo, non convallis eros porttitor",
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const WithActions: Story = {
|
|
36
|
-
args: {
|
|
37
|
-
icon: ({ size, color }: PlaceholderIconArgs) => (
|
|
38
|
-
<SearchIcon color={color} sx={{ fontSize: size }} />
|
|
39
|
-
),
|
|
40
|
-
title: "Lorem ipsum dolor sit amet",
|
|
41
|
-
subtitle:
|
|
42
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eleifend at libero in tristique. Pellentesque bibendum arcu eget augue commodo, non convallis eros porttitor",
|
|
43
|
-
actions,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from "react";
|
|
2
|
-
import { render, screen } from "~/tests/testing-library";
|
|
3
|
-
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import { Placeholder, PlaceholderAction } from "./placeholder";
|
|
5
|
-
import { actions as actionData } from "./placeholder.mock";
|
|
6
|
-
import SearchIcon from "@mui/icons-material/Search";
|
|
7
|
-
import { vi } from "vitest";
|
|
8
|
-
|
|
9
|
-
const actions = actionData.map((a) => ({ ...a, onClick: vi.fn() }));
|
|
10
|
-
|
|
11
|
-
describe("Placeholder", () => {
|
|
12
|
-
const renderComponent = ({
|
|
13
|
-
actions = undefined,
|
|
14
|
-
icon = undefined,
|
|
15
|
-
}: { actions?: PlaceholderAction[]; icon?: ReactElement } = {}) => {
|
|
16
|
-
const iconFn = icon ? () => icon : undefined;
|
|
17
|
-
return render(
|
|
18
|
-
<Placeholder
|
|
19
|
-
title="Lorem ipsum"
|
|
20
|
-
subtitle="Lorem ipsum sit amet"
|
|
21
|
-
actions={actions}
|
|
22
|
-
icon={iconFn}
|
|
23
|
-
/>,
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
it("would render the title", () => {
|
|
28
|
-
renderComponent();
|
|
29
|
-
|
|
30
|
-
expect(screen.getByRole("heading", { name: /lorem ipsum/i, level: 1 })).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("would render the subtitle", () => {
|
|
34
|
-
renderComponent();
|
|
35
|
-
|
|
36
|
-
expect(
|
|
37
|
-
screen.getByRole("heading", { name: /lorem ipsum sit amet/i, level: 2 }),
|
|
38
|
-
).toBeInTheDocument();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe("icon", () => {
|
|
42
|
-
it("wouldn't render an icon if it's not set", () => {
|
|
43
|
-
renderComponent({ icon: undefined });
|
|
44
|
-
|
|
45
|
-
expect(screen.queryByTestId("SearchIcon")).not.toBeInTheDocument();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("would render an icon if it's set", () => {
|
|
49
|
-
renderComponent({ icon: <SearchIcon /> });
|
|
50
|
-
|
|
51
|
-
expect(screen.queryByTestId("SearchIcon")).toBeInTheDocument();
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
describe("actions", () => {
|
|
56
|
-
it("wouldn't render an action if they are not set", () => {
|
|
57
|
-
renderComponent({ actions: undefined });
|
|
58
|
-
|
|
59
|
-
expect(screen.queryByRole("button")).not.toBeInTheDocument();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("would render a button for each action", () => {
|
|
63
|
-
renderComponent({ actions });
|
|
64
|
-
|
|
65
|
-
expect(screen.queryAllByRole("button")).toHaveLength(actions.length);
|
|
66
|
-
expect(screen.queryByRole("button", { name: /add/i })).toBeInTheDocument();
|
|
67
|
-
expect(screen.queryByRole("button", { name: /edit/i })).toBeInTheDocument();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it("would call onClick if a button is clicked", async () => {
|
|
71
|
-
renderComponent({ actions });
|
|
72
|
-
|
|
73
|
-
await userEvent.click(screen.getByRole("button", { name: /edit/i }));
|
|
74
|
-
|
|
75
|
-
expect(actions[1].onClick).toHaveBeenCalledTimes(1);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement } from "react";
|
|
2
|
-
import { Box, Typography, Button } from "@mui/material";
|
|
3
|
-
|
|
4
|
-
type IconColor =
|
|
5
|
-
| "inherit"
|
|
6
|
-
| "action"
|
|
7
|
-
| "disabled"
|
|
8
|
-
| "primary"
|
|
9
|
-
| "secondary"
|
|
10
|
-
| "error"
|
|
11
|
-
| "info"
|
|
12
|
-
| "success"
|
|
13
|
-
| "warning";
|
|
14
|
-
|
|
15
|
-
export interface PlaceholderAction {
|
|
16
|
-
id: string;
|
|
17
|
-
text: string;
|
|
18
|
-
href?: string;
|
|
19
|
-
onClick?: () => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface PlaceholderIconArgs {
|
|
23
|
-
size: number;
|
|
24
|
-
color: IconColor;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type PlaceholderIcon = ({ size, color }: PlaceholderIconArgs) => ReactElement;
|
|
28
|
-
|
|
29
|
-
export interface PlaceholderProps {
|
|
30
|
-
title: string;
|
|
31
|
-
subtitle: string;
|
|
32
|
-
iconSize?: number;
|
|
33
|
-
icon?: PlaceholderIcon;
|
|
34
|
-
actions?: PlaceholderAction[];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export const Placeholder = ({
|
|
38
|
-
title,
|
|
39
|
-
subtitle,
|
|
40
|
-
icon,
|
|
41
|
-
iconSize = 200,
|
|
42
|
-
actions,
|
|
43
|
-
}: PlaceholderProps) => {
|
|
44
|
-
return (
|
|
45
|
-
<Box
|
|
46
|
-
display="flex"
|
|
47
|
-
flexDirection="column"
|
|
48
|
-
justifyContent="center"
|
|
49
|
-
alignItems="center"
|
|
50
|
-
textAlign="center"
|
|
51
|
-
>
|
|
52
|
-
{icon && icon({ size: iconSize, color: "primary" })}
|
|
53
|
-
<Typography variant="h4" role="heading" aria-level={1}>
|
|
54
|
-
{title}
|
|
55
|
-
</Typography>
|
|
56
|
-
<Typography variant="subtitle1" role="heading" aria-level={2} sx={{ mt: 2 }}>
|
|
57
|
-
{subtitle}
|
|
58
|
-
</Typography>
|
|
59
|
-
{actions && (
|
|
60
|
-
<Box sx={{ pt: 2 }}>
|
|
61
|
-
{actions.map(({ id, text, href, onClick }, index) => (
|
|
62
|
-
<Button
|
|
63
|
-
key={id}
|
|
64
|
-
role="button"
|
|
65
|
-
variant="contained"
|
|
66
|
-
href={href}
|
|
67
|
-
onClick={onClick}
|
|
68
|
-
sx={{ mr: index < actions.length - 1 ? 2 : 0 }}
|
|
69
|
-
>
|
|
70
|
-
{text}
|
|
71
|
-
</Button>
|
|
72
|
-
))}
|
|
73
|
-
</Box>
|
|
74
|
-
)}
|
|
75
|
-
</Box>
|
|
76
|
-
);
|
|
77
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/addon-docs';
|
|
2
|
-
import LinkTo from '@storybook/addon-links/react';
|
|
3
|
-
|
|
4
|
-
<Meta title="Components/Placeholders/Introduction" />
|
|
5
|
-
|
|
6
|
-
# Placehoders
|
|
7
|
-
|
|
8
|
-
<ul>
|
|
9
|
-
<li><LinkTo kind="Components/Placeholders/Placeholder">Placeholder</LinkTo></li>
|
|
10
|
-
<li><LinkTo kind="Components/Placeholders/SkeletonCard">SkeletonCard</LinkTo></li>
|
|
11
|
-
<li><LinkTo kind="Components/Placeholders/SkeletonGrid">SkeletonGrid</LinkTo></li>
|
|
12
|
-
<li><LinkTo kind="Components/Placeholders/ContentPlaceholder">ContentPlaceholder</LinkTo></li>
|
|
13
|
-
<li><LinkTo kind="Components/Placeholders/LoremIpsumPlaceholder">LoremIpsumPlaceholder</LinkTo></li>
|
|
14
|
-
</ul>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./skeleton-card";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { SkeletonCard } from "./skeleton-card";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Placeholders/SkeletonCard",
|
|
6
|
-
component: SkeletonCard,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: "fullscreen",
|
|
9
|
-
},
|
|
10
|
-
} satisfies Meta<typeof SkeletonCard>;
|
|
11
|
-
type Story = StoryObj<typeof SkeletonCard>;
|
|
12
|
-
|
|
13
|
-
export const Default: Story = {
|
|
14
|
-
args: {
|
|
15
|
-
width: 250,
|
|
16
|
-
},
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Box, Skeleton } from "@mui/material";
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
|
-
export interface SkeletonCardProps {
|
|
5
|
-
width?: number | string;
|
|
6
|
-
animation?: "pulse" | "wave" | false;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const SkeletonCard = ({ width = "100%", animation = false }: SkeletonCardProps) => {
|
|
10
|
-
return (
|
|
11
|
-
<Box width={width}>
|
|
12
|
-
<Skeleton animation={animation} variant="rectangular" height={118} />
|
|
13
|
-
<Skeleton animation={animation} variant="rectangular" height={16} sx={{ my: 1 }} />
|
|
14
|
-
<Skeleton animation={animation} variant="rectangular" width="80%" height={16} />
|
|
15
|
-
</Box>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./skeleton-grid";
|