@carbon/vue 2.45.0 → 3.0.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -264
- package/dist/carbon-vue-3.common.js +27392 -0
- package/dist/carbon-vue-3.common.js.map +1 -0
- package/dist/carbon-vue-3.umd.js +27403 -0
- package/dist/carbon-vue-3.umd.js.map +1 -0
- package/dist/carbon-vue-3.umd.min.js +17 -0
- package/dist/carbon-vue-3.umd.min.js.map +1 -0
- package/dist/demo.html +1 -34
- package/package.json +185 -62
- package/src/components/CvAccordion/CvAccordion.stories.js +54 -0
- package/src/components/CvAccordion/CvAccordion.vue +95 -0
- package/src/components/CvAccordion/CvAccordionItem.vue +101 -0
- package/src/components/{cv-accordion/cv-accordion-skeleton.vue → CvAccordion/CvAccordionSkeleton.vue} +14 -18
- package/src/components/CvAccordion/_CvAccordionItemSkeleton.vue +30 -0
- package/src/components/CvAccordion/consts.js +17 -0
- package/src/components/CvAccordion/index.js +6 -0
- package/src/components/CvAspectRatio/CvAspectRatio.stories.js +56 -0
- package/src/components/CvAspectRatio/CvAspectRatio.stories.scss +4 -0
- package/src/components/CvAspectRatio/CvAspectRatio.vue +33 -0
- package/src/components/CvAspectRatio/consts.js +2 -0
- package/src/components/CvAspectRatio/index.js +4 -0
- package/src/components/CvBreadcrumb/CvBreadcrumb.stories.js +75 -0
- package/src/components/CvBreadcrumb/CvBreadcrumb.vue +37 -0
- package/src/components/CvBreadcrumb/CvBreadcrumbItem.vue +28 -0
- package/src/components/CvBreadcrumb/CvBreadcrumbSkeleton.vue +29 -0
- package/src/components/CvBreadcrumb/CvBreadcrumbSkeletonItem.vue +14 -0
- package/src/components/CvBreadcrumb/index.js +11 -0
- package/src/components/CvButton/CvButton.stories.js +119 -0
- package/src/components/CvButton/CvButton.vue +68 -0
- package/src/components/CvButton/CvButtonCommon.js +75 -0
- package/src/components/CvButton/CvButtonSet.stories.js +36 -0
- package/src/components/CvButton/CvButtonSet.vue +30 -0
- package/src/components/CvButton/CvIconButton.stories.js +139 -0
- package/src/components/CvButton/CvIconButton.vue +88 -0
- package/src/components/CvButton/index.js +7 -0
- package/src/components/CvButton/sbBtnPrefix.js +2 -0
- package/src/components/CvCheckbox/CvCheckbox.stories.js +111 -0
- package/src/components/CvCheckbox/CvCheckbox.vue +73 -0
- package/src/components/CvCheckbox/index.js +3 -0
- package/src/components/CvCodeSnippet/CvCodeSnippet.stories.js +181 -0
- package/src/components/CvCodeSnippet/CvCodeSnippet.stories.scss +4 -0
- package/src/components/CvCodeSnippet/CvCodeSnippet.vue +125 -0
- package/src/components/CvCodeSnippet/CvCodeSnippetSkeleton.vue +43 -0
- package/src/components/CvCodeSnippet/_CviCodeSnippetInline.vue +72 -0
- package/src/components/CvCodeSnippet/_CviCodeSnippetMultiline.vue +199 -0
- package/src/components/CvCodeSnippet/_CviCodeSnippetOneline.vue +106 -0
- package/src/components/CvCodeSnippet/consts.js +2 -0
- package/src/components/CvCodeSnippet/index.js +4 -0
- package/src/components/CvComboBox/CvComboBox.stories.js +174 -0
- package/src/components/CvComboBox/CvComboBox.vue +460 -0
- package/src/components/CvComboBox/index.js +3 -0
- package/src/components/CvContentSwitcher/CvContentSwitcher.stories.mdx +196 -0
- package/src/components/CvContentSwitcher/CvContentSwitcher.vue +64 -0
- package/src/components/CvContentSwitcher/CvContentSwitcherButton.vue +117 -0
- package/src/components/CvContentSwitcher/CvContentSwitcherContent.vue +21 -0
- package/src/components/CvContentSwitcher/cvContentSwitcherStore.js +30 -0
- package/src/components/CvContentSwitcher/index.js +3 -0
- package/src/components/CvCopyButton/CvCopyButton.stories.js +28 -0
- package/src/components/CvCopyButton/CvCopyButton.vue +45 -0
- package/src/components/CvCopyButton/_CviCopyButton.vue +71 -0
- package/src/components/CvCopyButton/index.js +3 -0
- package/src/components/CvDataTable/CvDataTable.stories.mdx +304 -0
- package/src/components/CvDataTable/CvDataTable.vue +648 -0
- package/src/components/CvDataTable/CvDataTableAction.vue +22 -0
- package/src/components/CvDataTable/CvDataTableCell.vue +11 -0
- package/src/components/CvDataTable/CvDataTableHeading.vue +143 -0
- package/src/components/CvDataTable/CvDataTableRow.vue +139 -0
- package/src/components/CvDataTable/CvDataTableSkeleton.vue +48 -0
- package/src/components/CvDataTable/_CvDataTableRowInner.vue +169 -0
- package/src/components/CvDataTable/cvDataTableStore.js +340 -0
- package/src/components/CvDataTable/index.js +3 -0
- package/src/components/CvEmpty/_CvEmpty.vue +22 -0
- package/src/components/CvGrid/CvColumn.vue +85 -0
- package/src/components/CvGrid/CvGrid.vue +42 -0
- package/src/components/{cv-grid/cv-row.vue → CvGrid/CvRow.vue} +8 -12
- package/src/components/CvGrid/GvGrid.stories.mdx +217 -0
- package/src/components/CvGrid/_SbContainer.vue +22 -0
- package/src/components/CvGrid/_cvColumnValidation.js +48 -0
- package/src/components/CvLink/CvLink.stories.js +169 -0
- package/src/components/CvLink/CvLink.vue +38 -0
- package/src/components/CvLink/index.js +4 -0
- package/src/components/CvList/CvList.stories.js +88 -0
- package/src/components/CvList/CvList.vue +50 -0
- package/src/components/CvList/CvListItem.vue +12 -0
- package/src/components/CvList/index.js +4 -0
- package/src/components/CvLoading/CvLoading.stories.js +78 -0
- package/src/components/CvLoading/CvLoading.stories.scss +4 -0
- package/src/components/CvLoading/CvLoading.vue +106 -0
- package/src/components/CvLoading/index.js +4 -0
- package/src/components/CvNotification/CvInlineNotification.stories.js +109 -0
- package/src/components/CvNotification/CvInlineNotification.vue +102 -0
- package/src/components/CvNotification/CvToastNotification.stories.js +108 -0
- package/src/components/CvNotification/CvToastNotification.vue +88 -0
- package/src/components/CvNotification/consts.js +31 -0
- package/src/components/CvNotification/index.js +5 -0
- package/src/components/CvOverflowMenu/CvOverflowMenu.stories.mdx +119 -0
- package/src/components/CvOverflowMenu/CvOverflowMenu.vue +283 -0
- package/src/components/{cv-overflow-menu/cv-overflow-menu-item.vue → CvOverflowMenu/CvOverflowMenuItem.vue} +26 -20
- package/src/components/CvOverflowMenu/index.js +3 -0
- package/src/components/CvPagination/CvPagination.stories.mdx +160 -0
- package/src/components/CvPagination/CvPagination.vue +246 -0
- package/src/components/CvPagination/index.js +3 -0
- package/src/components/CvSelect/CvSelect.stories.mdx +227 -0
- package/src/components/CvSelect/CvSelect.vue +224 -0
- package/src/components/CvSelect/CvSelectOptgroup.vue +9 -0
- package/src/components/CvSelect/CvSelectOption.vue +22 -0
- package/src/components/CvSelect/index.js +3 -0
- package/src/components/CvSkeletonText/CvSkeletonText.stories.js +56 -0
- package/src/components/CvSkeletonText/CvSkeletonText.vue +63 -0
- package/src/components/CvSkeletonText/index.js +3 -0
- package/src/components/CvSvg/_CvSvg.vue +48 -0
- package/src/components/CvSvg/__tests__/_TestIcon.vue +19 -0
- package/src/components/CvSvg/__tests__/test-svg.svg +5 -0
- package/src/components/CvTag/CvTag.stories.js +64 -0
- package/src/components/CvTag/CvTag.vue +105 -0
- package/src/components/CvTag/consts.js +15 -0
- package/src/components/CvTag/index.js +5 -0
- package/src/components/CvUIShell/CvHeader.vue +203 -0
- package/src/components/CvUIShell/CvHeaderGlobalAction.vue +105 -0
- package/src/components/{cv-ui-shell/cv-header-menu.vue → CvUIShell/CvHeaderMenu.vue} +41 -37
- package/src/components/CvUIShell/CvHeaderMenuButton.vue +103 -0
- package/src/components/CvUIShell/CvHeaderMenuItem.vue +38 -0
- package/src/components/CvUIShell/CvHeaderName.vue +25 -0
- package/src/components/CvUIShell/CvHeaderNav.vue +18 -0
- package/src/components/CvUIShell/CvHeaderPanel.vue +106 -0
- package/src/components/CvUIShell/CvSideNav.vue +131 -0
- package/src/components/CvUIShell/CvSideNavIcon.vue +17 -0
- package/src/components/CvUIShell/CvSideNavItems.vue +22 -0
- package/src/components/CvUIShell/CvSideNavLink.vue +47 -0
- package/src/components/CvUIShell/CvSideNavMenu.vue +85 -0
- package/src/components/CvUIShell/CvSideNavMenuDivider.vue +7 -0
- package/src/components/CvUIShell/CvSideNavMenuItem.vue +31 -0
- package/src/components/CvUIShell/CvSkipToContent.vue +20 -0
- package/src/components/CvUIShell/CvSwitcher.vue +9 -0
- package/src/components/CvUIShell/CvSwitcherItem.vue +9 -0
- package/src/components/CvUIShell/CvSwitcherItemLink.vue +26 -0
- package/src/components/CvUIShell/CvUIShell.stories.mdx +454 -0
- package/src/components/{cv-ui-shell/_cv-side-nav-footer.vue → CvUIShell/_CvSideNavFooter.vue} +11 -15
- package/src/components/CvUIShell/_CvSideNavLinkText.vue +9 -0
- package/src/components/CvWrapper/CvWrapper.js +23 -0
- package/src/global/component-utils/event-bus.js +23 -0
- package/src/global/component-utils/validators.js +14 -0
- package/src/global/settings.js +5 -0
- package/src/global/storybook-utils/__tests__/story-source-code.js +162 -0
- package/src/global/storybook-utils/controls-from-props.js +72 -0
- package/src/global/storybook-utils/index.js +5 -0
- package/src/global/storybook-utils/sbCompPrefix.js +1 -0
- package/src/global/storybook-utils/split-slot-args.js +14 -0
- package/src/global/storybook-utils/story-source-code.js +52 -0
- package/src/index.js +13 -83
- package/src/use/components.js +24 -0
- package/src/use/cvCheck.js +94 -0
- package/src/use/cvId.js +57 -0
- package/src/use/cvLink.js +42 -0
- package/src/use/cvTheme.js +30 -0
- package/src/use/index.js +1 -0
- package/src/use/overflow.js +37 -0
- package/dist/carbon-vue.common.js +0 -23411
- package/dist/carbon-vue.common.js.map +0 -1
- package/dist/carbon-vue.umd.js +0 -23421
- package/dist/carbon-vue.umd.js.map +0 -1
- package/dist/carbon-vue.umd.min.js +0 -30
- package/dist/carbon-vue.umd.min.js.map +0 -1
- package/src/assets/images/component-icons.svg +0 -57
- package/src/assets/images/example-icon-svg.js +0 -10
- package/src/assets/images/example-icon.svg +0 -6
- package/src/assets/images/example-icons.svg +0 -6
- package/src/carbon.yml +0 -442
- package/src/components/cv-accordion/_cv-accordion-item-skeleton.vue +0 -29
- package/src/components/cv-accordion/cv-accordion-item.vue +0 -87
- package/src/components/cv-accordion/cv-accordion.vue +0 -59
- package/src/components/cv-accordion/index.js +0 -5
- package/src/components/cv-aspect-ratio/cv-aspect-ratio.vue +0 -28
- package/src/components/cv-aspect-ratio/index.js +0 -2
- package/src/components/cv-breadcrumb/_cv-breadcrumb-item-skeleton.vue +0 -13
- package/src/components/cv-breadcrumb/cv-breadcrumb-item.vue +0 -28
- package/src/components/cv-breadcrumb/cv-breadcrumb-skeleton.vue +0 -30
- package/src/components/cv-breadcrumb/cv-breadcrumb.vue +0 -21
- package/src/components/cv-breadcrumb/index.js +0 -5
- package/src/components/cv-button/button-mixin.js +0 -91
- package/src/components/cv-button/cv-button-set.vue +0 -17
- package/src/components/cv-button/cv-button-skeleton.vue +0 -12
- package/src/components/cv-button/cv-button.vue +0 -19
- package/src/components/cv-button/cv-icon-button.vue +0 -42
- package/src/components/cv-button/index.js +0 -6
- package/src/components/cv-checkbox/cv-checkbox-skeleton.vue +0 -15
- package/src/components/cv-checkbox/cv-checkbox.vue +0 -70
- package/src/components/cv-checkbox/index.js +0 -3
- package/src/components/cv-code-snippet/_cv-code-snippet-inline.vue +0 -39
- package/src/components/cv-code-snippet/_cv-code-snippet-multiline.vue +0 -79
- package/src/components/cv-code-snippet/_cv-code-snippet-oneline.vue +0 -47
- package/src/components/cv-code-snippet/cv-code-snippet-skeleton.vue +0 -30
- package/src/components/cv-code-snippet/cv-code-snippet.vue +0 -83
- package/src/components/cv-code-snippet/index.js +0 -3
- package/src/components/cv-combo-box/cv-combo-box.vue +0 -386
- package/src/components/cv-combo-box/index.js +0 -3
- package/src/components/cv-content-switcher/cv-content-switcher-button.vue +0 -104
- package/src/components/cv-content-switcher/cv-content-switcher-content.vue +0 -26
- package/src/components/cv-content-switcher/cv-content-switcher-store.js +0 -22
- package/src/components/cv-content-switcher/cv-content-switcher.vue +0 -117
- package/src/components/cv-content-switcher/index.js +0 -4
- package/src/components/cv-data-table/_cv-data-table-row-inner.vue +0 -139
- package/src/components/cv-data-table/cv-data-table-action.vue +0 -25
- package/src/components/cv-data-table/cv-data-table-cell.vue +0 -14
- package/src/components/cv-data-table/cv-data-table-heading.vue +0 -109
- package/src/components/cv-data-table/cv-data-table-row.vue +0 -113
- package/src/components/cv-data-table/cv-data-table-skeleton.vue +0 -64
- package/src/components/cv-data-table/cv-data-table.vue +0 -525
- package/src/components/cv-data-table/index.js +0 -8
- package/src/components/cv-date-picker/cv-date-picker.vue +0 -362
- package/src/components/cv-date-picker/index.js +0 -3
- package/src/components/cv-date-picker/plugins/appendToPlugin.js +0 -52
- package/src/components/cv-date-picker/plugins/fixEventsPlugin.js +0 -75
- package/src/components/cv-date-picker/plugins/monthSelectPlugin.js +0 -66
- package/src/components/cv-date-picker/plugins/rangePlugin.js +0 -45
- package/src/components/cv-dropdown/cv-dropdown-item.vue +0 -84
- package/src/components/cv-dropdown/cv-dropdown-skeleton.vue +0 -20
- package/src/components/cv-dropdown/cv-dropdown.vue +0 -373
- package/src/components/cv-dropdown/index.js +0 -5
- package/src/components/cv-feedback-button/_cv-feedback-button.vue +0 -74
- package/src/components/cv-file-uploader/consts.js +0 -12
- package/src/components/cv-file-uploader/cv-file-uploader-skeleton.vue +0 -22
- package/src/components/cv-file-uploader/cv-file-uploader.vue +0 -348
- package/src/components/cv-file-uploader/index.js +0 -5
- package/src/components/cv-form/cv-form-group.vue +0 -32
- package/src/components/cv-form/cv-form-item.vue +0 -13
- package/src/components/cv-form/cv-form.vue +0 -13
- package/src/components/cv-form/index.js +0 -5
- package/src/components/cv-grid/cv-column.vue +0 -77
- package/src/components/cv-grid/cv-grid.vue +0 -32
- package/src/components/cv-grid/index.js +0 -5
- package/src/components/cv-icon/_cv-icon.vue +0 -30
- package/src/components/cv-inline-loading/consts.js +0 -8
- package/src/components/cv-inline-loading/cv-inline-loading.vue +0 -91
- package/src/components/cv-inline-loading/index.js +0 -4
- package/src/components/cv-inline-notification/cv-inline-notification.vue +0 -89
- package/src/components/cv-inline-notification/index.js +0 -3
- package/src/components/cv-link/cv-link.vue +0 -30
- package/src/components/cv-link/index.js +0 -3
- package/src/components/cv-list/cv-list-item.vue +0 -13
- package/src/components/cv-list/cv-list.vue +0 -42
- package/src/components/cv-list/index.js +0 -4
- package/src/components/cv-loading/cv-loading.vue +0 -86
- package/src/components/cv-loading/index.js +0 -3
- package/src/components/cv-modal/cv-modal.vue +0 -295
- package/src/components/cv-modal/index.js +0 -2
- package/src/components/cv-multi-select/cv-multi-select.vue +0 -484
- package/src/components/cv-multi-select/index.js +0 -3
- package/src/components/cv-number-input/cv-number-input-skeleton.vue +0 -14
- package/src/components/cv-number-input/cv-number-input.vue +0 -215
- package/src/components/cv-number-input/index.js +0 -3
- package/src/components/cv-overflow-menu/cv-overflow-menu.vue +0 -253
- package/src/components/cv-overflow-menu/index.js +0 -4
- package/src/components/cv-pagination/cv-pagination.vue +0 -268
- package/src/components/cv-pagination/index.js +0 -2
- package/src/components/cv-progress/cv-progress-step.vue +0 -135
- package/src/components/cv-progress/cv-progress.vue +0 -82
- package/src/components/cv-progress/index.js +0 -4
- package/src/components/cv-radio-button/cv-radio-button.vue +0 -40
- package/src/components/cv-radio-button/cv-radio-group.vue +0 -24
- package/src/components/cv-radio-button/index.js +0 -4
- package/src/components/cv-search/cv-search.vue +0 -194
- package/src/components/cv-search/index.js +0 -2
- package/src/components/cv-select/cv-select-optgroup.vue +0 -14
- package/src/components/cv-select/cv-select-option.vue +0 -14
- package/src/components/cv-select/cv-select.vue +0 -158
- package/src/components/cv-select/index.js +0 -4
- package/src/components/cv-skeleton-text/cv-skeleton-text.vue +0 -64
- package/src/components/cv-skeleton-text/index.js +0 -2
- package/src/components/cv-slider/cv-slider-skeleton.vue +0 -22
- package/src/components/cv-slider/cv-slider.vue +0 -247
- package/src/components/cv-slider/index.js +0 -4
- package/src/components/cv-structured-list/_cv-structured-list-item-selectable.vue +0 -37
- package/src/components/cv-structured-list/_cv-structured-list-item-standard.vue +0 -13
- package/src/components/cv-structured-list/cv-structured-list-data.vue +0 -23
- package/src/components/cv-structured-list/cv-structured-list-heading.vue +0 -13
- package/src/components/cv-structured-list/cv-structured-list-item.vue +0 -46
- package/src/components/cv-structured-list/cv-structured-list.vue +0 -38
- package/src/components/cv-structured-list/index.js +0 -5
- package/src/components/cv-svg/_cv-svg.vue +0 -38
- package/src/components/cv-tabs/cv-tab.vue +0 -68
- package/src/components/cv-tabs/cv-tabs-skeleton.vue +0 -20
- package/src/components/cv-tabs/cv-tabs.vue +0 -410
- package/src/components/cv-tabs/index.js +0 -5
- package/src/components/cv-tag/cv-tag-skeleton.vue +0 -19
- package/src/components/cv-tag/cv-tag.vue +0 -121
- package/src/components/cv-tag/index.js +0 -4
- package/src/components/cv-text-area/cv-text-area.vue +0 -98
- package/src/components/cv-text-area/index.js +0 -2
- package/src/components/cv-text-input/cv-text-input.vue +0 -173
- package/src/components/cv-text-input/index.js +0 -2
- package/src/components/cv-tile/_cv-tile-clickable.vue +0 -22
- package/src/components/cv-tile/_cv-tile-expandable.vue +0 -92
- package/src/components/cv-tile/_cv-tile-selectable.vue +0 -48
- package/src/components/cv-tile/_cv-tile-standard.vue +0 -11
- package/src/components/cv-tile/cv-tile.vue +0 -83
- package/src/components/cv-tile/index.js +0 -2
- package/src/components/cv-time-picker/cv-time-picker.vue +0 -138
- package/src/components/cv-time-picker/index.js +0 -2
- package/src/components/cv-toast-notification/cv-toast-notification.vue +0 -72
- package/src/components/cv-toast-notification/index.js +0 -2
- package/src/components/cv-toggle/cv-toggle-skeleton.vue +0 -25
- package/src/components/cv-toggle/cv-toggle.vue +0 -52
- package/src/components/cv-toggle/index.js +0 -3
- package/src/components/cv-toolbar/cv-toolbar-divider.vue +0 -11
- package/src/components/cv-toolbar/cv-toolbar-option.vue +0 -16
- package/src/components/cv-toolbar/cv-toolbar-search.vue +0 -40
- package/src/components/cv-toolbar/cv-toolbar-title.vue +0 -14
- package/src/components/cv-toolbar/cv-toolbar.vue +0 -13
- package/src/components/cv-toolbar/index.js +0 -6
- package/src/components/cv-tooltip/consts.js +0 -2
- package/src/components/cv-tooltip/cv-definition-tooltip.vue +0 -44
- package/src/components/cv-tooltip/cv-interactive-tooltip.vue +0 -241
- package/src/components/cv-tooltip/cv-tooltip.vue +0 -44
- package/src/components/cv-tooltip/index.js +0 -6
- package/src/components/cv-ui-shell/_cv-side-nav-link-text.vue +0 -13
- package/src/components/cv-ui-shell/cv-content.vue +0 -16
- package/src/components/cv-ui-shell/cv-header-global-action.vue +0 -84
- package/src/components/cv-ui-shell/cv-header-menu-button.vue +0 -80
- package/src/components/cv-ui-shell/cv-header-menu-item.vue +0 -36
- package/src/components/cv-ui-shell/cv-header-name.vue +0 -18
- package/src/components/cv-ui-shell/cv-header-nav.vue +0 -18
- package/src/components/cv-ui-shell/cv-header-panel.vue +0 -72
- package/src/components/cv-ui-shell/cv-header-side-nav-items.vue +0 -21
- package/src/components/cv-ui-shell/cv-header.vue +0 -119
- package/src/components/cv-ui-shell/cv-side-nav-divider.vue +0 -12
- package/src/components/cv-ui-shell/cv-side-nav-icon.vue +0 -16
- package/src/components/cv-ui-shell/cv-side-nav-items.vue +0 -21
- package/src/components/cv-ui-shell/cv-side-nav-link.vue +0 -54
- package/src/components/cv-ui-shell/cv-side-nav-menu-item.vue +0 -30
- package/src/components/cv-ui-shell/cv-side-nav-menu.vue +0 -84
- package/src/components/cv-ui-shell/cv-side-nav.vue +0 -97
- package/src/components/cv-ui-shell/cv-skip-to-content.vue +0 -19
- package/src/components/cv-ui-shell/cv-switcher-item-link.vue +0 -26
- package/src/components/cv-ui-shell/cv-switcher-item.vue +0 -13
- package/src/components/cv-ui-shell/cv-switcher.vue +0 -13
- package/src/components/cv-ui-shell/index.js +0 -45
- package/src/components/cv-wrapper/_cv-wrapper.js +0 -33
- package/src/directives/clickout.js +0 -29
- package/src/index-components-vue.js +0 -5
- package/src/internal/feature-flags.js +0 -22
- package/src/mixins/carbon-prefix-mixin.js +0 -7
- package/src/mixins/check-mixin.js +0 -106
- package/src/mixins/index.js +0 -12
- package/src/mixins/link-mixin.js +0 -23
- package/src/mixins/methods-mixin.js +0 -18
- package/src/mixins/notification-mixin.js +0 -18
- package/src/mixins/radio-mixin.js +0 -36
- package/src/mixins/theme-mixin.js +0 -23
- package/src/mixins/uid-mixin.js +0 -23
- package/src/thumbnails/inline-notification.svg +0 -23
- package/src/thumbnails/skeleton-text.svg +0 -15
- package/src/thumbnails/toast-notification.svg +0 -34
- /package/src/components/{cv-button → CvButton}/consts.js +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import CvLoading from '.';
|
|
2
|
+
|
|
3
|
+
import { ref, computed } from 'vue';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
import {
|
|
6
|
+
sbCompPrefix,
|
|
7
|
+
storyParametersObject,
|
|
8
|
+
} from '../../global/storybook-utils';
|
|
9
|
+
import './CvLoading.stories.scss';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: `${sbCompPrefix}/CvLoading`,
|
|
13
|
+
component: CvLoading,
|
|
14
|
+
argTypes: {
|
|
15
|
+
'loading-end': {
|
|
16
|
+
control: { type: 'none' },
|
|
17
|
+
description:
|
|
18
|
+
'Raised after the exit animation has concluded, when loading or end are used to deactivate the loader. This is to allow parents to discard the component if needed.',
|
|
19
|
+
},
|
|
20
|
+
active: {
|
|
21
|
+
control: { type: 'none' },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const template = `<div>
|
|
27
|
+
<div class="loading-story">
|
|
28
|
+
<cv-loading @loading-end="onLoadingEnd" v-bind="args" :active="isActive"/>
|
|
29
|
+
</divclass>
|
|
30
|
+
<button @click="makeActive" :disabled="isActive" style="margin-top: 2rem;">{{buttonLabel}}</button>
|
|
31
|
+
</div>`;
|
|
32
|
+
let hidden = ref(true);
|
|
33
|
+
let isActive = ref(false);
|
|
34
|
+
let countDown = ref(0);
|
|
35
|
+
const buttonLabel = computed(() => {
|
|
36
|
+
if (isActive.value) {
|
|
37
|
+
return `Active: ${countDown.value}s`;
|
|
38
|
+
} else {
|
|
39
|
+
return 'Make active';
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
function runCountDown() {
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
countDown.value--;
|
|
45
|
+
if (countDown.value <= 0) {
|
|
46
|
+
isActive.value = false;
|
|
47
|
+
} else {
|
|
48
|
+
runCountDown();
|
|
49
|
+
}
|
|
50
|
+
}, 1000);
|
|
51
|
+
}
|
|
52
|
+
function makeActive() {
|
|
53
|
+
hidden.value = false;
|
|
54
|
+
isActive.value = true;
|
|
55
|
+
countDown.value = 5;
|
|
56
|
+
runCountDown();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const Template = args => ({
|
|
60
|
+
components: { CvLoading },
|
|
61
|
+
setup: () => ({
|
|
62
|
+
args,
|
|
63
|
+
onLoadingEnd: action('loading-end'),
|
|
64
|
+
isActive,
|
|
65
|
+
makeActive,
|
|
66
|
+
countDown,
|
|
67
|
+
buttonLabel,
|
|
68
|
+
}),
|
|
69
|
+
template,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const Default = Template.bind({});
|
|
73
|
+
Default.args = {};
|
|
74
|
+
Default.parameters = storyParametersObject(
|
|
75
|
+
Default.parameters,
|
|
76
|
+
template,
|
|
77
|
+
Default.args
|
|
78
|
+
);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<cv-wrapper
|
|
3
|
+
:tag-type="overlay ? 'div' : ''"
|
|
4
|
+
class="cv-loading"
|
|
5
|
+
:class="overlayClasses"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
data-loading
|
|
10
|
+
:class="{
|
|
11
|
+
'cv-loading': !overlay,
|
|
12
|
+
[`${carbonPrefix}--loading`]: active || stopping,
|
|
13
|
+
[`${carbonPrefix}--loading--stop`]: (!active && stopping) || stopped,
|
|
14
|
+
[`${carbonPrefix}--loading--small`]: small,
|
|
15
|
+
}"
|
|
16
|
+
ref="loading"
|
|
17
|
+
aria-atomic="true"
|
|
18
|
+
:aria-labelledby="cvId"
|
|
19
|
+
aria-live="assertive"
|
|
20
|
+
role="progressbar"
|
|
21
|
+
:aria-busy="active || stopping"
|
|
22
|
+
>
|
|
23
|
+
<label :id="cvId" :class="`${carbonPrefix}--visually-hidden`">
|
|
24
|
+
{{ description }}
|
|
25
|
+
</label>
|
|
26
|
+
<svg :class="`${carbonPrefix}--loading__svg`" viewBox="0 0 100 100">
|
|
27
|
+
<title>{{ description }}</title>
|
|
28
|
+
<circle
|
|
29
|
+
v-if="small"
|
|
30
|
+
:class="`${carbonPrefix}--loading__background`"
|
|
31
|
+
cx="50%"
|
|
32
|
+
cy="50%"
|
|
33
|
+
:r="loadingRadius"
|
|
34
|
+
/>
|
|
35
|
+
<circle
|
|
36
|
+
:class="`${carbonPrefix}--loading__stroke`"
|
|
37
|
+
cx="50%"
|
|
38
|
+
cy="50%"
|
|
39
|
+
:r="loadingRadius"
|
|
40
|
+
/>
|
|
41
|
+
</svg>
|
|
42
|
+
</div>
|
|
43
|
+
</cv-wrapper>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup>
|
|
47
|
+
import { ref, computed, watch } from 'vue';
|
|
48
|
+
import CvWrapper from '../CvWrapper/CvWrapper';
|
|
49
|
+
import { carbonPrefix } from '../../global/settings';
|
|
50
|
+
import { useCvId, props as propsCvId } from '../../use/cvId';
|
|
51
|
+
|
|
52
|
+
const props = defineProps({
|
|
53
|
+
active: { type: Boolean, default: true },
|
|
54
|
+
description: { type: String, default: 'Loading' },
|
|
55
|
+
overlay: { type: Boolean },
|
|
56
|
+
small: { type: Boolean },
|
|
57
|
+
...propsCvId,
|
|
58
|
+
});
|
|
59
|
+
const cvId = useCvId(props);
|
|
60
|
+
|
|
61
|
+
let stopping = ref(false);
|
|
62
|
+
let stopped = ref(false);
|
|
63
|
+
const overlayClasses = computed(() => {
|
|
64
|
+
const classes = [];
|
|
65
|
+
if (props.overlay) {
|
|
66
|
+
if (props.active || stopping.value) {
|
|
67
|
+
classes.push(`${carbonPrefix}--loading-overlay`);
|
|
68
|
+
} else {
|
|
69
|
+
classes.push(`${carbonPrefix}--loading-overlay--stop`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return classes;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const loadingRadius = computed(() => {
|
|
77
|
+
return props.small ? '42' : '44';
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Maintain the active state
|
|
81
|
+
const loading = ref(null);
|
|
82
|
+
const emit = defineEmits(['loading-end']);
|
|
83
|
+
function onEnd(ev) {
|
|
84
|
+
if (ev.animationName === 'rotate-end-p2') {
|
|
85
|
+
loading.value.removeEventListener('animationend', onEnd);
|
|
86
|
+
|
|
87
|
+
stopping.value = false;
|
|
88
|
+
stopped.value = true;
|
|
89
|
+
|
|
90
|
+
emit('loading-end');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function onActiveUpdate(newValue) {
|
|
94
|
+
stopped.value = false;
|
|
95
|
+
stopping.value = !newValue;
|
|
96
|
+
if (!newValue) {
|
|
97
|
+
loading.value.addEventListener('animationend', onEnd);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
watch(
|
|
101
|
+
() => props.active,
|
|
102
|
+
val => {
|
|
103
|
+
onActiveUpdate(val);
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
</script>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { sbCompPrefix } from '../../global/storybook-utils';
|
|
3
|
+
|
|
4
|
+
import { CvInlineNotification, CvNotificationConsts } from '.';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: `${sbCompPrefix}/CvInlineNotification`,
|
|
8
|
+
component: CvInlineNotification,
|
|
9
|
+
argTypes: {
|
|
10
|
+
kind: {
|
|
11
|
+
control: {
|
|
12
|
+
type: 'select',
|
|
13
|
+
options: CvNotificationConsts.notificationKinds,
|
|
14
|
+
},
|
|
15
|
+
defaultValue: CvNotificationConsts.notificationKinds[0],
|
|
16
|
+
table: {
|
|
17
|
+
defaultValue: {
|
|
18
|
+
summary: `"${CvNotificationConsts.notificationKinds[0]}"`,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
title: {
|
|
23
|
+
control: { type: 'text' },
|
|
24
|
+
defaultValue: 'Notification title',
|
|
25
|
+
table: {
|
|
26
|
+
defaultValue: {
|
|
27
|
+
summary: `"${CvInlineNotification.props.title.default}"`,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
subTitle: {
|
|
32
|
+
control: { type: 'text' },
|
|
33
|
+
defaultValue: 'Subtitle text goes here.',
|
|
34
|
+
table: {
|
|
35
|
+
defaultValue: {
|
|
36
|
+
summary: `"${CvInlineNotification.props.subTitle.default}"`,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
actionLabel: {
|
|
41
|
+
control: { type: 'text' },
|
|
42
|
+
defaultValue: 'Action',
|
|
43
|
+
table: {
|
|
44
|
+
defaultValue: {
|
|
45
|
+
summary: `"${CvInlineNotification.props.actionLabel.default}"`,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
closeAriaLabel: {
|
|
50
|
+
control: { type: 'text' },
|
|
51
|
+
defaultValue: CvInlineNotification.props.closeAriaLabel.default,
|
|
52
|
+
table: {
|
|
53
|
+
defaultValue: {
|
|
54
|
+
summary: `"${CvInlineNotification.props.closeAriaLabel.default}"`,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
lowContrast: {
|
|
59
|
+
control: { type: 'boolean' },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const template = `<cv-inline-notification v-bind="args" @action="onAction" @close="onClose" />`;
|
|
65
|
+
const Template = args => {
|
|
66
|
+
return {
|
|
67
|
+
components: { CvInlineNotification },
|
|
68
|
+
template,
|
|
69
|
+
setup() {
|
|
70
|
+
return {
|
|
71
|
+
args,
|
|
72
|
+
onAction: action('action'),
|
|
73
|
+
onClose: action('close'),
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const Info = Template.bind({});
|
|
80
|
+
Info.args = {
|
|
81
|
+
kind: CvNotificationConsts.notificationKinds[0],
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const InfoSquare = Template.bind({});
|
|
85
|
+
InfoSquare.storyName = 'Info square';
|
|
86
|
+
InfoSquare.args = {
|
|
87
|
+
kind: CvNotificationConsts.notificationKinds[1],
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const Success = Template.bind({});
|
|
91
|
+
Success.args = {
|
|
92
|
+
kind: CvNotificationConsts.notificationKinds[2],
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Warning = Template.bind({});
|
|
96
|
+
Warning.args = {
|
|
97
|
+
kind: CvNotificationConsts.notificationKinds[3],
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const WarningAlt = Template.bind({});
|
|
101
|
+
WarningAlt.storyName = 'Warning (alt)';
|
|
102
|
+
WarningAlt.args = {
|
|
103
|
+
kind: CvNotificationConsts.notificationKinds[4],
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const Error = Template.bind({});
|
|
107
|
+
Error.args = {
|
|
108
|
+
kind: CvNotificationConsts.notificationKinds[5],
|
|
109
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
role="alert"
|
|
4
|
+
:kind="kind"
|
|
5
|
+
:class="[
|
|
6
|
+
`${carbonPrefix}--inline-notification`,
|
|
7
|
+
`${carbonPrefix}--inline-notification--${kind}`,
|
|
8
|
+
{ [`${carbonPrefix}--inline-notification--low-contrast`]: lowContrast },
|
|
9
|
+
]"
|
|
10
|
+
>
|
|
11
|
+
<div :class="`${carbonPrefix}--inline-notification__details`">
|
|
12
|
+
<component
|
|
13
|
+
:is="icon"
|
|
14
|
+
:class="`${carbonPrefix}--inline-notification__icon`"
|
|
15
|
+
/>
|
|
16
|
+
<div :class="`${carbonPrefix}--inline-notification__text-wrapper`">
|
|
17
|
+
<p :class="`${carbonPrefix}--inline-notification__title`">
|
|
18
|
+
{{ title }}
|
|
19
|
+
</p>
|
|
20
|
+
<div :class="`${carbonPrefix}--inline-notification__subtitle`">
|
|
21
|
+
{{ subTitle }}
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<button
|
|
26
|
+
v-if="actionLabel.length > 0"
|
|
27
|
+
:class="[
|
|
28
|
+
`${carbonPrefix}--inline-notification__action-button`,
|
|
29
|
+
`${carbonPrefix}--btn`,
|
|
30
|
+
`${carbonPrefix}--btn--sm`,
|
|
31
|
+
`${carbonPrefix}--btn--ghost`,
|
|
32
|
+
]"
|
|
33
|
+
@click="$emit('action')"
|
|
34
|
+
>
|
|
35
|
+
{{ actionLabel }}
|
|
36
|
+
</button>
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
:aria-label="closeAriaLabel"
|
|
40
|
+
:class="`${carbonPrefix}--inline-notification__close-button`"
|
|
41
|
+
@click="$emit('close')"
|
|
42
|
+
>
|
|
43
|
+
<close20 :class="`${carbonPrefix}--inline-notification__close-icon`" />
|
|
44
|
+
</button>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
import { computed } from 'vue';
|
|
50
|
+
import { Close20 } from '@carbon/icons-vue';
|
|
51
|
+
import { carbonPrefix } from '../../global/settings';
|
|
52
|
+
import { notificationKinds, notificationIcons } from './consts';
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
name: 'CvInlineNotification',
|
|
56
|
+
components: { Close20 },
|
|
57
|
+
props: {
|
|
58
|
+
/** Type of status */
|
|
59
|
+
kind: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: notificationKinds[0],
|
|
62
|
+
validator: value => notificationKinds.includes(value),
|
|
63
|
+
},
|
|
64
|
+
/** Notification title */
|
|
65
|
+
title: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: '',
|
|
68
|
+
},
|
|
69
|
+
/** Notification sub title (supports HTML) */
|
|
70
|
+
subTitle: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '',
|
|
73
|
+
},
|
|
74
|
+
/** Optional action button label - if empty no action button is displayed! */
|
|
75
|
+
actionLabel: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: '',
|
|
78
|
+
},
|
|
79
|
+
/** Close button A11y label */
|
|
80
|
+
closeAriaLabel: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: 'Close notification',
|
|
83
|
+
},
|
|
84
|
+
/** Use lower contrast version of the notification */
|
|
85
|
+
lowContrast: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
emits: [
|
|
91
|
+
/** Emitted on clicking the action button */
|
|
92
|
+
'action',
|
|
93
|
+
/** Emitted on clicking the close button */
|
|
94
|
+
'close',
|
|
95
|
+
],
|
|
96
|
+
setup(props) {
|
|
97
|
+
const icon = computed(() => notificationIcons[props.kind]);
|
|
98
|
+
|
|
99
|
+
return { carbonPrefix, icon };
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
</script>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { sbCompPrefix } from '../../global/storybook-utils';
|
|
3
|
+
|
|
4
|
+
import { CvToastNotification, CvNotificationConsts } from '.';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: `${sbCompPrefix}/CvToastNotification`,
|
|
8
|
+
component: CvToastNotification,
|
|
9
|
+
argTypes: {
|
|
10
|
+
kind: {
|
|
11
|
+
control: {
|
|
12
|
+
type: 'select',
|
|
13
|
+
options: CvNotificationConsts.notificationKinds,
|
|
14
|
+
},
|
|
15
|
+
defaultValue: CvNotificationConsts.notificationKinds[0],
|
|
16
|
+
table: {
|
|
17
|
+
defaultValue: {
|
|
18
|
+
summary: `"${CvNotificationConsts.notificationKinds[0]}"`,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
title: {
|
|
23
|
+
control: { type: 'text' },
|
|
24
|
+
defaultValue: 'Notification title',
|
|
25
|
+
table: {
|
|
26
|
+
defaultValue: {
|
|
27
|
+
summary: `"${CvToastNotification.props.title.default}"`,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
subTitle: {
|
|
32
|
+
control: { type: 'text' },
|
|
33
|
+
defaultValue: 'Subtitle text goes here.',
|
|
34
|
+
table: {
|
|
35
|
+
defaultValue: {
|
|
36
|
+
summary: `"${CvToastNotification.props.subTitle.default}"`,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
caption: {
|
|
41
|
+
control: { type: 'text' },
|
|
42
|
+
defaultValue: '00:00:00 AM',
|
|
43
|
+
table: {
|
|
44
|
+
defaultValue: {
|
|
45
|
+
summary: `"${CvToastNotification.props.caption.default}"`,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
closeAriaLabel: {
|
|
50
|
+
control: { type: 'text' },
|
|
51
|
+
defaultValue: CvToastNotification.props.closeAriaLabel.default,
|
|
52
|
+
table: {
|
|
53
|
+
defaultValue: {
|
|
54
|
+
summary: `"${CvToastNotification.props.closeAriaLabel.default}"`,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
lowContrast: {
|
|
59
|
+
control: { type: 'boolean' },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const template = `<cv-toast-notification v-bind="args" @close="onClose" />`;
|
|
65
|
+
const Template = args => {
|
|
66
|
+
return {
|
|
67
|
+
components: { CvToastNotification },
|
|
68
|
+
template,
|
|
69
|
+
setup() {
|
|
70
|
+
return {
|
|
71
|
+
args,
|
|
72
|
+
onClose: action('close'),
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const Info = Template.bind({});
|
|
79
|
+
Info.args = {
|
|
80
|
+
kind: CvNotificationConsts.notificationKinds[0],
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const InfoSquare = Template.bind({});
|
|
84
|
+
InfoSquare.storyName = 'Info square';
|
|
85
|
+
InfoSquare.args = {
|
|
86
|
+
kind: CvNotificationConsts.notificationKinds[1],
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const Success = Template.bind({});
|
|
90
|
+
Success.args = {
|
|
91
|
+
kind: CvNotificationConsts.notificationKinds[2],
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const Warning = Template.bind({});
|
|
95
|
+
Warning.args = {
|
|
96
|
+
kind: CvNotificationConsts.notificationKinds[3],
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const WarningAlt = Template.bind({});
|
|
100
|
+
WarningAlt.storyName = 'Warning (alt)';
|
|
101
|
+
WarningAlt.args = {
|
|
102
|
+
kind: CvNotificationConsts.notificationKinds[4],
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const Error = Template.bind({});
|
|
106
|
+
Error.args = {
|
|
107
|
+
kind: CvNotificationConsts.notificationKinds[5],
|
|
108
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
role="alert"
|
|
4
|
+
:kind="kind"
|
|
5
|
+
:class="[
|
|
6
|
+
`${carbonPrefix}--toast-notification`,
|
|
7
|
+
`${carbonPrefix}--toast-notification--${kind}`,
|
|
8
|
+
{ [`${carbonPrefix}--toast-notification--low-contrast`]: lowContrast },
|
|
9
|
+
]"
|
|
10
|
+
>
|
|
11
|
+
<component
|
|
12
|
+
:is="icon"
|
|
13
|
+
:class="`${carbonPrefix}--toast-notification__icon`"
|
|
14
|
+
/>
|
|
15
|
+
<div :class="`${carbonPrefix}--toast-notification__details`">
|
|
16
|
+
<h3 :class="`${carbonPrefix}--toast-notification__title`">{{ title }}</h3>
|
|
17
|
+
<div :class="`${carbonPrefix}--toast-notification__subtitle`">
|
|
18
|
+
{{ subTitle }}
|
|
19
|
+
</div>
|
|
20
|
+
<div :class="`${carbonPrefix}--toast-notification__caption`">
|
|
21
|
+
{{ caption }}
|
|
22
|
+
</div>
|
|
23
|
+
<slot />
|
|
24
|
+
</div>
|
|
25
|
+
<button
|
|
26
|
+
type="button"
|
|
27
|
+
:aria-label="closeAriaLabel"
|
|
28
|
+
:class="`${carbonPrefix}--toast-notification__close-button`"
|
|
29
|
+
@click="$emit('close')"
|
|
30
|
+
>
|
|
31
|
+
<close20 :class="`${carbonPrefix}--inline-notification__close-icon`" />
|
|
32
|
+
</button>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import { computed } from 'vue';
|
|
38
|
+
import { Close20 } from '@carbon/icons-vue';
|
|
39
|
+
import { carbonPrefix } from '../../global/settings';
|
|
40
|
+
import { notificationKinds, notificationIcons } from './consts';
|
|
41
|
+
|
|
42
|
+
export default {
|
|
43
|
+
name: 'CvToastNotification',
|
|
44
|
+
components: { Close20 },
|
|
45
|
+
props: {
|
|
46
|
+
/** Type of status */
|
|
47
|
+
kind: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: notificationKinds[0],
|
|
50
|
+
validator: value => notificationKinds.includes(value),
|
|
51
|
+
},
|
|
52
|
+
/** Notification title */
|
|
53
|
+
title: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: '',
|
|
56
|
+
},
|
|
57
|
+
/** Notification sub title (supports HTML) */
|
|
58
|
+
subTitle: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: '',
|
|
61
|
+
},
|
|
62
|
+
/** Notification caption (supports HTML) */
|
|
63
|
+
caption: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: '',
|
|
66
|
+
},
|
|
67
|
+
/** Close button A11y label */
|
|
68
|
+
closeAriaLabel: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: 'Close notification',
|
|
71
|
+
},
|
|
72
|
+
/** Use lower contrast version of the notification */
|
|
73
|
+
lowContrast: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
emits: [
|
|
79
|
+
/** Emitted on clicking the close button */
|
|
80
|
+
'close',
|
|
81
|
+
],
|
|
82
|
+
setup(props) {
|
|
83
|
+
const icon = computed(() => notificationIcons[props.kind]);
|
|
84
|
+
|
|
85
|
+
return { carbonPrefix, icon };
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ErrorFilled20,
|
|
3
|
+
CheckmarkFilled20,
|
|
4
|
+
WarningFilled20,
|
|
5
|
+
WarningAltFilled20,
|
|
6
|
+
InformationFilled20,
|
|
7
|
+
InformationSquareFilled20,
|
|
8
|
+
} from '@carbon/icons-vue';
|
|
9
|
+
|
|
10
|
+
export const notificationKinds = [
|
|
11
|
+
'info',
|
|
12
|
+
'info-square',
|
|
13
|
+
'success',
|
|
14
|
+
'warning',
|
|
15
|
+
'warning-alt',
|
|
16
|
+
'error',
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export const notificationIcons = {
|
|
20
|
+
info: InformationFilled20,
|
|
21
|
+
'info-square': InformationSquareFilled20,
|
|
22
|
+
success: CheckmarkFilled20,
|
|
23
|
+
warning: WarningFilled20,
|
|
24
|
+
'warning-alt': WarningAltFilled20,
|
|
25
|
+
error: ErrorFilled20,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
notificationKinds,
|
|
30
|
+
notificationIcons,
|
|
31
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import CvInlineNotification from './CvInlineNotification';
|
|
2
|
+
import CvToastNotification from './CvToastNotification';
|
|
3
|
+
import CvNotificationConsts from './consts';
|
|
4
|
+
export { CvInlineNotification, CvToastNotification, CvNotificationConsts };
|
|
5
|
+
export default CvInlineNotification;
|