@pautena/react-design-system 0.12.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +40 -0
- package/.prettierrc.cjs +5 -0
- package/package.json +1 -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 -37
- 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 -88
- 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,117 +0,0 @@
|
|
|
1
|
-
import { Box } from "@mui/material";
|
|
2
|
-
import { ListPanelItem } from "./list-panel";
|
|
3
|
-
import { useListPanel } from "./list-panel.context";
|
|
4
|
-
import React from "react";
|
|
5
|
-
|
|
6
|
-
export const ListPanelDemoContent = () => {
|
|
7
|
-
const selectedId = useListPanel();
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<Box width={1} display="flex" justifyContent="center" alignItems="center" pt={2}>
|
|
11
|
-
Panel content. Selected id: {selectedId}
|
|
12
|
-
</Box>
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const mockItemsShort: ListPanelItem[] = [
|
|
17
|
-
{
|
|
18
|
-
id: "all",
|
|
19
|
-
text: "all",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: "inbox",
|
|
23
|
-
text: "Inbox",
|
|
24
|
-
tooltip: "this is the inbox tooltip",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: "sent",
|
|
28
|
-
text: "Sent",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: "drafts",
|
|
32
|
-
text: "Drafts",
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
export const mockItemsLong: ListPanelItem[] = [
|
|
37
|
-
{
|
|
38
|
-
id: "item1",
|
|
39
|
-
text: "Item 1",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: "item2",
|
|
43
|
-
text: "Item 2",
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
id: "item3",
|
|
47
|
-
text: "Item 3",
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: "item4",
|
|
51
|
-
text: "Item 4",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
id: "item5",
|
|
55
|
-
text: "Item 5",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: "item6",
|
|
59
|
-
text: "Item 6",
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: "item7",
|
|
63
|
-
text: "Item 7",
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: "item8",
|
|
67
|
-
text: "Item 8",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
id: "item9",
|
|
71
|
-
text: "Item 9",
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: "item10",
|
|
75
|
-
text: "Item 10",
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
id: "item11",
|
|
79
|
-
text: "Item 11",
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: "item12",
|
|
83
|
-
text: "Item 12",
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
id: "item13",
|
|
87
|
-
text: "Item 13",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: "item14",
|
|
91
|
-
text: "Item 14",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
id: "item15",
|
|
95
|
-
text: "Item 15",
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
id: "item16",
|
|
99
|
-
text: "Item 16",
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: "item17",
|
|
103
|
-
text: "Item 17",
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
id: "item18",
|
|
107
|
-
text: "Item 18",
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
id: "item19",
|
|
111
|
-
text: "Item 19",
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
id: "item20",
|
|
115
|
-
text: "Item 20",
|
|
116
|
-
},
|
|
117
|
-
];
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { withContainer } from "../../../storybook";
|
|
3
|
-
import { ListPanel } from "./list-panel";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { Box } from "@mui/material";
|
|
6
|
-
import { ListPanelPanel } from "./list-panel-panel";
|
|
7
|
-
import { ListPanelDemoContent, mockItemsLong, mockItemsShort } from "./list-panel.mocks";
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: "Components/Containers/ListPanel",
|
|
11
|
-
component: ListPanel,
|
|
12
|
-
decorators: [withContainer({ width: 800, height: 600 })],
|
|
13
|
-
render: (args) => (
|
|
14
|
-
<ListPanel {...args}>
|
|
15
|
-
<ListPanelDemoContent />
|
|
16
|
-
<ListPanelPanel ids={["drafts"]}>
|
|
17
|
-
<Box>Drafts panel</Box>
|
|
18
|
-
</ListPanelPanel>
|
|
19
|
-
</ListPanel>
|
|
20
|
-
),
|
|
21
|
-
parameters: {
|
|
22
|
-
layout: "centered",
|
|
23
|
-
},
|
|
24
|
-
} satisfies Meta<typeof ListPanel>;
|
|
25
|
-
type Story = StoryObj<typeof ListPanel>;
|
|
26
|
-
|
|
27
|
-
export const Short: Story = {
|
|
28
|
-
args: {
|
|
29
|
-
items: mockItemsShort,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Long: Story = {
|
|
34
|
-
args: {
|
|
35
|
-
items: mockItemsLong,
|
|
36
|
-
defaultSelectedItem: "item3",
|
|
37
|
-
},
|
|
38
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { fireEvent, render, screen } from "~/tests/testing-library";
|
|
2
|
-
import { ListPanel, ListPanelItem } from "./list-panel";
|
|
3
|
-
import { ListPanelDemoContent, mockItemsShort } from "./list-panel.mocks";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { ListPanelPanel } from "./list-panel-panel";
|
|
6
|
-
import { Box } from "@mui/material";
|
|
7
|
-
import { vi } from "vitest";
|
|
8
|
-
|
|
9
|
-
describe("ListPanel", () => {
|
|
10
|
-
const renderComponent = ({
|
|
11
|
-
items,
|
|
12
|
-
defaultSelectedItem,
|
|
13
|
-
}: {
|
|
14
|
-
items: ListPanelItem[];
|
|
15
|
-
defaultSelectedItem?: string;
|
|
16
|
-
}) => {
|
|
17
|
-
const onSelectedItemChange = vi.fn();
|
|
18
|
-
render(
|
|
19
|
-
<ListPanel
|
|
20
|
-
items={items}
|
|
21
|
-
defaultSelectedItem={defaultSelectedItem}
|
|
22
|
-
onSelectedItemChange={onSelectedItemChange}
|
|
23
|
-
>
|
|
24
|
-
<ListPanelDemoContent />
|
|
25
|
-
<ListPanelPanel ids={["drafts"]}>
|
|
26
|
-
<Box>Drafts panel</Box>
|
|
27
|
-
</ListPanelPanel>
|
|
28
|
-
</ListPanel>,
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
return { onSelectedItemChange };
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
it("should render a list item for each item", () => {
|
|
35
|
-
renderComponent({ items: mockItemsShort });
|
|
36
|
-
|
|
37
|
-
mockItemsShort.forEach(({ text }) => {
|
|
38
|
-
expect(screen.getByRole("button", { name: text })).toBeVisible();
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("should mark as selected the default item", () => {
|
|
43
|
-
renderComponent({ items: mockItemsShort, defaultSelectedItem: "inbox" });
|
|
44
|
-
|
|
45
|
-
expect(screen.getByText(/selected id: inbox/i)).toBeVisible();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("should change the selected item if one is clicked", () => {
|
|
49
|
-
const { onSelectedItemChange } = renderComponent({ items: mockItemsShort });
|
|
50
|
-
|
|
51
|
-
fireEvent.click(screen.getByRole("button", { name: /drafts/i }));
|
|
52
|
-
|
|
53
|
-
expect(screen.getByText(/selected id: drafts/i)).toBeVisible();
|
|
54
|
-
expect(onSelectedItemChange).toHaveBeenCalledTimes(1);
|
|
55
|
-
expect(onSelectedItemChange).toHaveBeenCalledWith("drafts");
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("should render the panel if the draft is selected", () => {
|
|
59
|
-
renderComponent({ items: mockItemsShort });
|
|
60
|
-
|
|
61
|
-
fireEvent.click(screen.getByRole("button", { name: /drafts/i }));
|
|
62
|
-
|
|
63
|
-
expect(screen.getByText(/drafts panel/i)).toBeVisible();
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { Grid, List, ListItemButton, ListItemText, Paper, Tooltip, useTheme } from "@mui/material";
|
|
2
|
-
import React, { PropsWithChildren, useState } from "react";
|
|
3
|
-
import { useGetDefaultThemeColor } from "~/utils";
|
|
4
|
-
import { ListPanelContextProvider } from "./list-panel.context";
|
|
5
|
-
import { grey } from "@mui/material/colors";
|
|
6
|
-
|
|
7
|
-
export interface ListPanelItem {
|
|
8
|
-
id: string;
|
|
9
|
-
text: string;
|
|
10
|
-
tooltip?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type ListPanelProps = PropsWithChildren<{
|
|
14
|
-
defaultSelectedItem?: string;
|
|
15
|
-
items: ListPanelItem[];
|
|
16
|
-
colBreakpoint?: number;
|
|
17
|
-
onSelectedItemChange?: (id: string) => void;
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
|
-
export const ListPanel = ({
|
|
21
|
-
items,
|
|
22
|
-
defaultSelectedItem,
|
|
23
|
-
colBreakpoint = 3,
|
|
24
|
-
children,
|
|
25
|
-
onSelectedItemChange = () => null,
|
|
26
|
-
}: ListPanelProps) => {
|
|
27
|
-
const bgColor = useGetDefaultThemeColor();
|
|
28
|
-
const { palette, typography } = useTheme();
|
|
29
|
-
const [selectedItem, setSelectedItem] = useState(defaultSelectedItem);
|
|
30
|
-
|
|
31
|
-
const handleSelectItem = (id: string) => {
|
|
32
|
-
setSelectedItem(id);
|
|
33
|
-
onSelectedItemChange(id);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<ListPanelContextProvider value={selectedItem}>
|
|
38
|
-
<Grid container bgcolor={bgColor} height={1}>
|
|
39
|
-
<Grid item xs={colBreakpoint} pl={1} height={1}>
|
|
40
|
-
<List sx={{ height: 1, overflowY: "auto" }}>
|
|
41
|
-
{items.map(({ id, text, tooltip }) => {
|
|
42
|
-
const selected = id === selectedItem;
|
|
43
|
-
|
|
44
|
-
const contentEl = (
|
|
45
|
-
<ListItemButton
|
|
46
|
-
key={id}
|
|
47
|
-
dense
|
|
48
|
-
selected={selected}
|
|
49
|
-
onClick={() => handleSelectItem(id)}
|
|
50
|
-
aria-label={text}
|
|
51
|
-
sx={{ backgroundColor: selected ? `${palette.grey[300]} !important` : undefined }}
|
|
52
|
-
>
|
|
53
|
-
<ListItemText
|
|
54
|
-
primary={text}
|
|
55
|
-
primaryTypographyProps={{
|
|
56
|
-
fontWeight: selected ? typography.fontWeightMedium : undefined,
|
|
57
|
-
color: selected ? typography.body1.color : grey[600],
|
|
58
|
-
}}
|
|
59
|
-
/>
|
|
60
|
-
</ListItemButton>
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
return tooltip ? (
|
|
64
|
-
<Tooltip key={id} title={tooltip} enterDelay={1500} placement="right">
|
|
65
|
-
{contentEl}
|
|
66
|
-
</Tooltip>
|
|
67
|
-
) : (
|
|
68
|
-
contentEl
|
|
69
|
-
);
|
|
70
|
-
})}
|
|
71
|
-
</List>
|
|
72
|
-
</Grid>
|
|
73
|
-
<Grid item xs={12 - colBreakpoint} pl={1} py={1} pr={1}>
|
|
74
|
-
<Paper
|
|
75
|
-
elevation={0}
|
|
76
|
-
sx={{
|
|
77
|
-
width: 1,
|
|
78
|
-
height: 1,
|
|
79
|
-
backgroundColor: palette.background.paper,
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
{children}
|
|
83
|
-
</Paper>
|
|
84
|
-
</Grid>
|
|
85
|
-
</Grid>
|
|
86
|
-
</ListPanelContextProvider>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { withContainer } from "../../../storybook";
|
|
3
|
-
import { Board } from "./board";
|
|
4
|
-
import demoMarkdownContent from "~/tests/mocks/markdown.mock.md";
|
|
5
|
-
import { Typography } from "@mui/material";
|
|
6
|
-
import React from "react";
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: "Components/Data Display/Board",
|
|
10
|
-
component: Board,
|
|
11
|
-
decorators: [withContainer({ width: 500 })],
|
|
12
|
-
parameters: {
|
|
13
|
-
layout: "centered",
|
|
14
|
-
},
|
|
15
|
-
} satisfies Meta<typeof Board>;
|
|
16
|
-
type Story = StoryObj<typeof Board>;
|
|
17
|
-
|
|
18
|
-
export const Text: Story = {
|
|
19
|
-
args: {
|
|
20
|
-
content:
|
|
21
|
-
"Of recommend residence education be on difficult repulsive offending. Judge views had mirth table seems great him for her. Alone all happy asked begin fully stand own get. Excuse ye seeing result of we. See scale dried songs old may not. Promotion did disposing you household any instantly. Hills we do under times at first short an.",
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const ArrayParagraph: Story = {
|
|
26
|
-
args: {
|
|
27
|
-
content: [
|
|
28
|
-
"Of recommend residence education be on difficult repulsive offending. Judge views had mirth table seems great him for her. Alone all happy asked begin fully stand own get. Excuse ye seeing result of we. See scale dried songs old may not. Promotion did disposing you household any instantly. Hills we do under times at first short an.",
|
|
29
|
-
"His having within saw become ask passed misery giving. Recommend questions get too fulfilled. He fact in we case miss sake. Entrance be throwing he do blessing up. Hearts warmth in genius do garden advice mr it garret. Collected preserved are middleton dependent residence but him how. Handsome weddings yet mrs you has carriage packages. Preferred joy agreement put continual elsewhere delivered now. Mrs exercise felicity had men speaking met. Rich deal mrs part led pure will but.",
|
|
30
|
-
"Boy desirous families prepared gay reserved add ecstatic say. Replied joy age visitor nothing cottage. Mrs door paid led loud sure easy read. Hastily at perhaps as neither or ye fertile tedious visitor. Use fine bed none call busy dull when. Quiet ought match my right by table means. Principles up do in me favourable affronting. Twenty mother denied effect we to do on.",
|
|
31
|
-
],
|
|
32
|
-
spacing: 1,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const ArrayList: Story = {
|
|
37
|
-
args: {
|
|
38
|
-
content: ["lorem: ipsum", "foo: bar", "header: this", "host: localhost"],
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const Markdown: Story = {
|
|
43
|
-
args: {
|
|
44
|
-
markdown: demoMarkdownContent,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Children: Story = {
|
|
49
|
-
args: {
|
|
50
|
-
children: (
|
|
51
|
-
<>
|
|
52
|
-
<Typography variant="h2">First line</Typography>
|
|
53
|
-
<Typography variant="subtitle1">Second line</Typography>
|
|
54
|
-
<Typography variant="h6">Third line</Typography>
|
|
55
|
-
</>
|
|
56
|
-
),
|
|
57
|
-
},
|
|
58
|
-
};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, screen } from "~/tests/testing-library";
|
|
3
|
-
import { Board } from "./board";
|
|
4
|
-
import { mockMarkdownContent } from "~/tests/mocks/markdown.mock";
|
|
5
|
-
import userEvent from "@testing-library/user-event";
|
|
6
|
-
import { vi } from "vitest";
|
|
7
|
-
import { Typography } from "@mui/material";
|
|
8
|
-
|
|
9
|
-
const content = "This is the content";
|
|
10
|
-
|
|
11
|
-
const content1 = "This is the content 1";
|
|
12
|
-
const content2 = "This is the content 2";
|
|
13
|
-
const content3 = "This is the content 3";
|
|
14
|
-
const arrayContent = [content1, content2, content3];
|
|
15
|
-
|
|
16
|
-
const mockCopy = () => {
|
|
17
|
-
const copy = vi.fn();
|
|
18
|
-
Object.assign(navigator, {
|
|
19
|
-
clipboard: {
|
|
20
|
-
writeText: copy,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
return { copy };
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
describe("Board", () => {
|
|
27
|
-
const renderComponent = ({
|
|
28
|
-
markdown,
|
|
29
|
-
content,
|
|
30
|
-
}: {
|
|
31
|
-
markdown?: string;
|
|
32
|
-
content?: string | string[];
|
|
33
|
-
}) => {
|
|
34
|
-
const { copy } = mockCopy();
|
|
35
|
-
render(<Board markdown={markdown} content={content} />);
|
|
36
|
-
|
|
37
|
-
return { copy };
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
it("should render a string content", () => {
|
|
41
|
-
renderComponent({ content });
|
|
42
|
-
|
|
43
|
-
expect(screen.getByText(content)).toBeVisible();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("should render a array of string content", () => {
|
|
47
|
-
renderComponent({ content: arrayContent });
|
|
48
|
-
|
|
49
|
-
expect(screen.getByText(content1)).toBeVisible();
|
|
50
|
-
expect(screen.getByText(content2)).toBeVisible();
|
|
51
|
-
expect(screen.getByText(content3)).toBeVisible();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it.skip("should render a markdown content", () => {
|
|
55
|
-
renderComponent({ markdown: mockMarkdownContent });
|
|
56
|
-
|
|
57
|
-
expect(
|
|
58
|
-
screen.getByRole("heading", { name: "Diu in illa Lavini atque de quoque", level: 5 }),
|
|
59
|
-
).toBeVisible();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
describe("copy", () => {
|
|
63
|
-
it("should copy the string content to the clipboard if the copy button is clicked", async () => {
|
|
64
|
-
const { copy } = renderComponent({ content });
|
|
65
|
-
|
|
66
|
-
await userEvent.click(screen.getByRole("button"));
|
|
67
|
-
|
|
68
|
-
expect(copy).toHaveBeenCalledTimes(1);
|
|
69
|
-
expect(copy).toHaveBeenCalledWith(content);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it("should copy the string array content to the clipboard if the copy button is clicked", async () => {
|
|
73
|
-
const expectedCopy = arrayContent.join("\n");
|
|
74
|
-
const { copy } = renderComponent({ content: arrayContent });
|
|
75
|
-
|
|
76
|
-
await userEvent.click(screen.getByRole("button"));
|
|
77
|
-
|
|
78
|
-
expect(copy).toHaveBeenCalledTimes(1);
|
|
79
|
-
expect(copy).toHaveBeenCalledWith(expectedCopy);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it.skip("should copy the markdown content to the clipboard if the copy button is clicked", async () => {
|
|
83
|
-
const { copy } = renderComponent({ markdown: mockMarkdownContent });
|
|
84
|
-
|
|
85
|
-
await userEvent.click(screen.getByRole("button"));
|
|
86
|
-
|
|
87
|
-
expect(copy).toHaveBeenCalledTimes(1);
|
|
88
|
-
expect(copy).toHaveBeenCalledWith(mockMarkdownContent);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it("should render the children and copy the string content if it has a custom children", async () => {
|
|
92
|
-
const content = "lorem: ipsum";
|
|
93
|
-
const { copy } = mockCopy();
|
|
94
|
-
render(
|
|
95
|
-
<Board content={content}>
|
|
96
|
-
<Typography variant="h6">row 1</Typography>
|
|
97
|
-
<Typography variant="caption"> row 2</Typography>
|
|
98
|
-
<Typography variant="body2" sx={{ textDecoration: "line-through" }}>
|
|
99
|
-
row 3
|
|
100
|
-
</Typography>
|
|
101
|
-
<Typography variant="body2" fontWeight={700}>
|
|
102
|
-
row 4
|
|
103
|
-
</Typography>
|
|
104
|
-
</Board>,
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
expect(screen.getByText(/row 1/i)).toBeVisible();
|
|
108
|
-
expect(screen.getByText(/row 2/i)).toBeVisible();
|
|
109
|
-
expect(screen.getByText(/row 3/i)).toBeVisible();
|
|
110
|
-
expect(screen.getByText(/row 4/i)).toBeVisible();
|
|
111
|
-
|
|
112
|
-
await userEvent.click(screen.getByRole("button"));
|
|
113
|
-
|
|
114
|
-
expect(copy).toHaveBeenCalledTimes(1);
|
|
115
|
-
expect(copy).toHaveBeenCalledWith(content);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Box,
|
|
3
|
-
IconButton,
|
|
4
|
-
Paper,
|
|
5
|
-
SxProps,
|
|
6
|
-
Theme,
|
|
7
|
-
Tooltip,
|
|
8
|
-
Typography,
|
|
9
|
-
useTheme,
|
|
10
|
-
} from "@mui/material";
|
|
11
|
-
import { blueGrey } from "@mui/material/colors";
|
|
12
|
-
import React, { PropsWithChildren, ReactNode } from "react";
|
|
13
|
-
import { Markdown } from "../markdown";
|
|
14
|
-
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
|
|
15
|
-
|
|
16
|
-
export type BoardProps = PropsWithChildren<{
|
|
17
|
-
markdown?: string;
|
|
18
|
-
content?: string | string[];
|
|
19
|
-
spacing?: 0 | 1 | 2 | 3 | 4 | 5;
|
|
20
|
-
sx?: SxProps<Theme>;
|
|
21
|
-
}>;
|
|
22
|
-
|
|
23
|
-
export const Board = ({
|
|
24
|
-
markdown: markdownProps,
|
|
25
|
-
content: contentProp,
|
|
26
|
-
spacing = 0,
|
|
27
|
-
children,
|
|
28
|
-
sx,
|
|
29
|
-
}: BoardProps) => {
|
|
30
|
-
const { spacing: themeSpacing, typography } = useTheme();
|
|
31
|
-
let copyContent: string;
|
|
32
|
-
let content: ReactNode;
|
|
33
|
-
|
|
34
|
-
if (markdownProps) {
|
|
35
|
-
copyContent = markdownProps || "";
|
|
36
|
-
} else if (Array.isArray(contentProp)) {
|
|
37
|
-
content = contentProp.map((line, i) => (
|
|
38
|
-
<Typography key={i} sx={{ pb: spacing }}>
|
|
39
|
-
{line}
|
|
40
|
-
</Typography>
|
|
41
|
-
));
|
|
42
|
-
copyContent = contentProp.join("\n");
|
|
43
|
-
} else {
|
|
44
|
-
content = <Typography>{contentProp}</Typography>;
|
|
45
|
-
copyContent = contentProp || "";
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const markdown = markdownProps && <Markdown content={markdownProps} />;
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Paper
|
|
52
|
-
sx={{
|
|
53
|
-
position: "relative",
|
|
54
|
-
pl: 2,
|
|
55
|
-
pr: 4,
|
|
56
|
-
py: 1,
|
|
57
|
-
backgroundColor: blueGrey[800],
|
|
58
|
-
color: "white",
|
|
59
|
-
...sx,
|
|
60
|
-
}}
|
|
61
|
-
>
|
|
62
|
-
<Box display="flex" flexDirection="row">
|
|
63
|
-
<Box width={1}>{children || markdown || content}</Box>
|
|
64
|
-
<Box sx={{ position: "absolute", top: themeSpacing(0.5), right: themeSpacing(0.5) }}>
|
|
65
|
-
{copyContent && (
|
|
66
|
-
<IconButton
|
|
67
|
-
aria-label="copy board content"
|
|
68
|
-
color="inherit"
|
|
69
|
-
onClick={() => navigator.clipboard.writeText(copyContent)}
|
|
70
|
-
>
|
|
71
|
-
<Tooltip title="Copy">
|
|
72
|
-
<ContentCopyIcon sx={{ fontSize: typography.pxToRem(18) }} />
|
|
73
|
-
</Tooltip>
|
|
74
|
-
</IconButton>
|
|
75
|
-
)}
|
|
76
|
-
</Box>
|
|
77
|
-
</Box>
|
|
78
|
-
</Paper>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./board";
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Bullet } from "./bullet";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Data Display/Bullet",
|
|
6
|
-
component: Bullet,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: "centered",
|
|
9
|
-
},
|
|
10
|
-
} satisfies Meta<typeof Bullet>;
|
|
11
|
-
type Story = StoryObj<typeof Bullet>;
|
|
12
|
-
|
|
13
|
-
export const Primary: Story = {
|
|
14
|
-
args: {
|
|
15
|
-
variant: "primary",
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const Secondary: Story = {
|
|
20
|
-
args: {
|
|
21
|
-
variant: "secondary",
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Default: Story = {
|
|
26
|
-
args: {
|
|
27
|
-
variant: "default",
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const Info: Story = {
|
|
32
|
-
args: {
|
|
33
|
-
variant: "info",
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const Warning: Story = {
|
|
38
|
-
args: {
|
|
39
|
-
variant: "warning",
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const Error: Story = {
|
|
44
|
-
args: {
|
|
45
|
-
variant: "error",
|
|
46
|
-
},
|
|
47
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Bullet, BulletVariant } from "./bullet";
|
|
3
|
-
import { render, screen } from "~/tests/testing-library";
|
|
4
|
-
|
|
5
|
-
describe("Bullet", () => {
|
|
6
|
-
const renderComponent = (variant: BulletVariant | undefined = undefined) => {
|
|
7
|
-
return render(<Bullet variant={variant} />);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
it("renders as primary without a variant", () => {
|
|
11
|
-
renderComponent(undefined);
|
|
12
|
-
|
|
13
|
-
expect(screen.getByRole("bullet")).toHaveAttribute("aria-describedby", "primary");
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it.each([["primary"], ["secondary"], ["default"], ["info"], ["warning"], ["error"]])(
|
|
17
|
-
"renders correctly with variant %s",
|
|
18
|
-
(variant: string) => {
|
|
19
|
-
renderComponent(variant as BulletVariant);
|
|
20
|
-
|
|
21
|
-
expect(screen.getByRole("bullet")).toHaveAttribute("aria-describedby", variant);
|
|
22
|
-
},
|
|
23
|
-
);
|
|
24
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Badge, SxProps, Theme } from "@mui/material";
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
|
-
export type BulletVariant = "primary" | "secondary" | "default" | "info" | "warning" | "error";
|
|
5
|
-
|
|
6
|
-
export const bulletClasses = {
|
|
7
|
-
root: "RdsBullet-root",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export interface BulletProps {
|
|
11
|
-
/**
|
|
12
|
-
* Color palette used to draw the component
|
|
13
|
-
*/
|
|
14
|
-
variant?: BulletVariant;
|
|
15
|
-
/**
|
|
16
|
-
* Custom styles
|
|
17
|
-
*/
|
|
18
|
-
sx?: SxProps<Theme>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Dot to attract the user attention
|
|
23
|
-
*/
|
|
24
|
-
export const Bullet = ({ variant = "primary", sx }: BulletProps) => {
|
|
25
|
-
return (
|
|
26
|
-
<Badge
|
|
27
|
-
color={variant}
|
|
28
|
-
variant="dot"
|
|
29
|
-
className={bulletClasses.root}
|
|
30
|
-
role="bullet"
|
|
31
|
-
aria-describedby={variant}
|
|
32
|
-
sx={sx}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./bullet";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/addon-docs';
|
|
2
|
-
import LinkTo from '@storybook/addon-links/react';
|
|
3
|
-
|
|
4
|
-
<Meta title="Components/Data Display/Introduction" />
|
|
5
|
-
|
|
6
|
-
# App Bars
|
|
7
|
-
|
|
8
|
-
<ul>
|
|
9
|
-
<li><LinkTo kind="Components/Data Display/Bullet">Bullet</LinkTo></li>
|
|
10
|
-
<li><LinkTo kind="Components/Data Display/Label">Label</LinkTo></li>
|
|
11
|
-
<li><LinkTo kind="Components/Data Display/Header">Header</LinkTo></li>
|
|
12
|
-
<li><LinkTo kind="Components/Data Display/Board">Board</LinkTo></li>
|
|
13
|
-
<li><LinkTo kind="Components/Data Display/Markdown">Markdown</LinkTo></li>
|
|
14
|
-
<li><LinkTo kind="Components/Data Display/LinkCard">LinkCard</LinkTo></li>
|
|
15
|
-
</ul>
|