@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,217 @@
|
|
|
1
|
+
import { Canvas, Meta, Story } from '@storybook/addon-docs';
|
|
2
|
+
import { sbCompPrefix } from '../../global/storybook-utils';
|
|
3
|
+
import CvGrid from "./CvGrid.vue";
|
|
4
|
+
import CvRow from "./CvRow.vue";
|
|
5
|
+
import CvColumn from "./CvColumn.vue";
|
|
6
|
+
import SbContainer from "./_SbContainer.vue";
|
|
7
|
+
|
|
8
|
+
<Meta title={`${sbCompPrefix}/CvGrid`}
|
|
9
|
+
component={CvGrid}
|
|
10
|
+
decorators={[() => ({
|
|
11
|
+
components: { SbContainer, Story },
|
|
12
|
+
template: `<SbContainer><story/></SbContainer>`,
|
|
13
|
+
})]}
|
|
14
|
+
/>
|
|
15
|
+
|
|
16
|
+
export const Template = args => ({
|
|
17
|
+
// Components used in your story `template` are defined in the `components` object
|
|
18
|
+
components: {
|
|
19
|
+
CvGrid,CvRow,CvColumn,SbContainer
|
|
20
|
+
},
|
|
21
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
22
|
+
setup() {
|
|
23
|
+
return {
|
|
24
|
+
...args,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
// And then the `args` are bound to your component with `v-bind="args"`
|
|
28
|
+
template: args.template,
|
|
29
|
+
});
|
|
30
|
+
const defaultTemplate = `
|
|
31
|
+
<cv-grid :full-width="fullWidth" :kind="kind">
|
|
32
|
+
<cv-row>
|
|
33
|
+
<cv-column><div>span 25%</div></cv-column>
|
|
34
|
+
<cv-column><div>span 25%</div></cv-column>
|
|
35
|
+
<cv-column><div>span 25%</div></cv-column>
|
|
36
|
+
<cv-column><div>span 25%</div></cv-column>
|
|
37
|
+
</cv-row>
|
|
38
|
+
</cv-grid>
|
|
39
|
+
`;
|
|
40
|
+
const rowOptionsTemplate = `
|
|
41
|
+
<cv-grid>
|
|
42
|
+
<cv-row :kind="rowKind1">
|
|
43
|
+
<cv-column><div><h3>{{rowKind1}}</h3></div></cv-column>
|
|
44
|
+
<cv-column><div>Elora Danan</div></cv-column>
|
|
45
|
+
<cv-column><div>Queen Bavmorda</div></cv-column>
|
|
46
|
+
<cv-column><div>Willow Ufgood</div></cv-column>
|
|
47
|
+
</cv-row>
|
|
48
|
+
<cv-row :kind="rowKind2">
|
|
49
|
+
<cv-column><div><h3>{{rowKind2}}</h3></div></cv-column>
|
|
50
|
+
<cv-column><div>Jade Claymore</div></cv-column>
|
|
51
|
+
<cv-column><div>Graydon Hastur</div></cv-column>
|
|
52
|
+
<cv-column><div>Thraxus Boorman</div></cv-column>
|
|
53
|
+
</cv-row>
|
|
54
|
+
<cv-row :kind="rowKind3">
|
|
55
|
+
<cv-column><div><h3>{{rowKind3}}</h3></div></cv-column>
|
|
56
|
+
<cv-column><div>Madmartigan</div></cv-column>
|
|
57
|
+
<cv-column><div>Princess Kit</div></cv-column>
|
|
58
|
+
<cv-column><div>Airk Tanthalos</div></cv-column>
|
|
59
|
+
</cv-row>
|
|
60
|
+
</cv-grid>
|
|
61
|
+
`
|
|
62
|
+
const responsiveTemplate = `
|
|
63
|
+
<cv-grid>
|
|
64
|
+
<cv-row>
|
|
65
|
+
<cv-column :sm="2" :md="4" :lg="6"><div>
|
|
66
|
+
<p>small: span 2 of 4</p>
|
|
67
|
+
<p>medium: span 4 of 8</p>
|
|
68
|
+
<p>large: span 6 of 12</p>
|
|
69
|
+
</div></cv-column>
|
|
70
|
+
<cv-column :sm="2" :md="2" :lg="3"><div>
|
|
71
|
+
<p>small: span 2 of 4</p>
|
|
72
|
+
<p>medium: span 2 of 8</p>
|
|
73
|
+
<p>large: span 3 of 12</p>
|
|
74
|
+
</div></cv-column>
|
|
75
|
+
<cv-column :sm="0" :md="2" :lg="3"><div>
|
|
76
|
+
<p>small: span 0 (hidden at this break point) of 4</p>
|
|
77
|
+
<p>medium: span 2 of 8</p>
|
|
78
|
+
<p>large: span 3 of 12</p>
|
|
79
|
+
</div></cv-column>
|
|
80
|
+
</cv-row>
|
|
81
|
+
</cv-grid>
|
|
82
|
+
`
|
|
83
|
+
const offsetTemplate = `
|
|
84
|
+
<cv-grid>
|
|
85
|
+
<cv-row>
|
|
86
|
+
<cv-column :sm="{ span: 1, offset: 3 }"><div>span 1, offset 3</div></cv-column>
|
|
87
|
+
<cv-column :sm="{ span: 2, offset: 2 }"><div>span 2, offset 2</div></cv-column>
|
|
88
|
+
<cv-column :sm="{ span: 3, offset: 1 }"><div>span 3, offset 1</div></cv-column>
|
|
89
|
+
<cv-column :sm="{ span: 4, offset: 0 }"><div>span 4, offset 0</div></cv-column>
|
|
90
|
+
</cv-row>
|
|
91
|
+
</cv-grid>
|
|
92
|
+
`
|
|
93
|
+
const startEndTemplate = `
|
|
94
|
+
<cv-grid>
|
|
95
|
+
<cv-row>
|
|
96
|
+
<cv-column :sm="{ span: 1, start: 4 }"><div>span 1, start 4</div></cv-column>
|
|
97
|
+
<cv-column :sm="{ span: 2, end: 5 }"><div>span 2, end 5</div></cv-column>
|
|
98
|
+
<cv-column :sm="{ start: 1, end: 4 }"><div>start 1, end 5</div></cv-column>
|
|
99
|
+
</cv-row>
|
|
100
|
+
</cv-grid>
|
|
101
|
+
`
|
|
102
|
+
|
|
103
|
+
# CvGrid
|
|
104
|
+
|
|
105
|
+
A Vue utility component for the Carbon Grid
|
|
106
|
+
|
|
107
|
+
<Canvas isColumn>
|
|
108
|
+
<h4>Size columns automatically</h4>
|
|
109
|
+
<h5>Properties:</h5>
|
|
110
|
+
<ul>
|
|
111
|
+
<li>fullWidth - Remove the default max width that the grid has set</li>
|
|
112
|
+
<li>kind - "wide", "narrow", or "condensed"</li>
|
|
113
|
+
</ul>
|
|
114
|
+
<Story
|
|
115
|
+
name="Default"
|
|
116
|
+
parameters={{
|
|
117
|
+
controls: {
|
|
118
|
+
exclude: [
|
|
119
|
+
'default',
|
|
120
|
+
'template',
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
docs: { source: { code: defaultTemplate } },
|
|
124
|
+
}}
|
|
125
|
+
args={{
|
|
126
|
+
fullWidth: false,
|
|
127
|
+
kind: 'wide',
|
|
128
|
+
template: defaultTemplate,
|
|
129
|
+
}}
|
|
130
|
+
argTypes={{
|
|
131
|
+
kind: { control: 'select', default: 'wide', options: ['wide', 'condensed', 'narrow'] },
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
{Template.bind({})}
|
|
135
|
+
</Story>
|
|
136
|
+
<hr/>
|
|
137
|
+
<h4>Row options</h4>
|
|
138
|
+
<h5>Properties:</h5>
|
|
139
|
+
<ul>
|
|
140
|
+
<li>kind - "wide", "narrow", or "condensed". Override the gid setting for a row.</li>
|
|
141
|
+
</ul>
|
|
142
|
+
<Story
|
|
143
|
+
name="Rows"
|
|
144
|
+
parameters={{
|
|
145
|
+
controls: {
|
|
146
|
+
exclude: [
|
|
147
|
+
'default',
|
|
148
|
+
'template',
|
|
149
|
+
'kind',
|
|
150
|
+
'fullWidth',
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
docs: { source: { code: rowOptionsTemplate } },
|
|
154
|
+
}}
|
|
155
|
+
args={{
|
|
156
|
+
rowKind1: 'wide',
|
|
157
|
+
rowKind2: 'condensed',
|
|
158
|
+
rowKind3: 'narrow',
|
|
159
|
+
template: rowOptionsTemplate,
|
|
160
|
+
}}
|
|
161
|
+
argTypes={{
|
|
162
|
+
rowKind1: { control: 'select', default: 'wide', options: ['wide', 'condensed', 'narrow'] },
|
|
163
|
+
rowKind2: { control: 'select', default: 'condensed', options: ['wide', 'condensed', 'narrow'] },
|
|
164
|
+
rowKind3: { control: 'select', default: 'narrow', options: ['wide', 'condensed', 'narrow'] },
|
|
165
|
+
}}
|
|
166
|
+
>
|
|
167
|
+
{Template.bind({})}
|
|
168
|
+
</Story>
|
|
169
|
+
<hr/>
|
|
170
|
+
<h4>Responsive</h4>
|
|
171
|
+
<Story
|
|
172
|
+
name="Responsive"
|
|
173
|
+
parameters={{
|
|
174
|
+
controls: {
|
|
175
|
+
exclude: [
|
|
176
|
+
'default',
|
|
177
|
+
'template',
|
|
178
|
+
'kind',
|
|
179
|
+
'fullWidth',
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
docs: { source: { code: responsiveTemplate } },
|
|
183
|
+
}}
|
|
184
|
+
args={{
|
|
185
|
+
template: responsiveTemplate,
|
|
186
|
+
}}
|
|
187
|
+
argTypes={{
|
|
188
|
+
}}
|
|
189
|
+
>
|
|
190
|
+
{Template.bind({})}
|
|
191
|
+
</Story>
|
|
192
|
+
<hr/>
|
|
193
|
+
<h4>Offset - Fun! But useful?</h4>
|
|
194
|
+
<Story
|
|
195
|
+
name="Offset"
|
|
196
|
+
parameters={{
|
|
197
|
+
controls: {
|
|
198
|
+
exclude: [
|
|
199
|
+
'default',
|
|
200
|
+
'template',
|
|
201
|
+
'kind',
|
|
202
|
+
'fullWidth',
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
docs: { source: { code: offsetTemplate } },
|
|
206
|
+
}}
|
|
207
|
+
args={{
|
|
208
|
+
template: offsetTemplate,
|
|
209
|
+
}}
|
|
210
|
+
argTypes={{
|
|
211
|
+
}}
|
|
212
|
+
>
|
|
213
|
+
{Template.bind({})}
|
|
214
|
+
</Story>
|
|
215
|
+
</Canvas>
|
|
216
|
+
|
|
217
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sb-grid-container">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup></script>
|
|
8
|
+
|
|
9
|
+
<style>
|
|
10
|
+
.sb-grid-container {
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
.sb-grid-container .cv-column {
|
|
14
|
+
background-color: #d0e2ff; /* blue-20 */
|
|
15
|
+
outline: 1px dashed #78a9ff; /* blue-40 */
|
|
16
|
+
}
|
|
17
|
+
.sb-grid-container .cv-column div {
|
|
18
|
+
background-color: #edf5ff; /* blue-10 */
|
|
19
|
+
min-height: 100px;
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const validSmall = Array(5)
|
|
2
|
+
.fill(0)
|
|
3
|
+
.map((val, index) => index);
|
|
4
|
+
const validMedium = Array(9)
|
|
5
|
+
.fill(0)
|
|
6
|
+
.map((val, index) => index);
|
|
7
|
+
const validLarge = Array(17)
|
|
8
|
+
.fill(0)
|
|
9
|
+
.map((val, index) => index);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Check the breakpoint property
|
|
13
|
+
* @param {string} breakPoint - valid breakpoint
|
|
14
|
+
* @param value - property value
|
|
15
|
+
* @returns {boolean}
|
|
16
|
+
*/
|
|
17
|
+
function columnValidator(breakPoint, value) {
|
|
18
|
+
if (typeof value === 'number') {
|
|
19
|
+
switch (breakPoint) {
|
|
20
|
+
case 'sm':
|
|
21
|
+
return validSmall.includes(value);
|
|
22
|
+
case 'md':
|
|
23
|
+
return validMedium.includes(value);
|
|
24
|
+
case 'lg':
|
|
25
|
+
case 'xlg':
|
|
26
|
+
case 'max':
|
|
27
|
+
return validLarge.includes(value);
|
|
28
|
+
default:
|
|
29
|
+
console.warn(`breakpoint "${breakPoint}" not recognized`);
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
} else if (typeof value === 'boolean') {
|
|
33
|
+
return true;
|
|
34
|
+
} else if (typeof value === 'object') {
|
|
35
|
+
return (
|
|
36
|
+
'span' in value &&
|
|
37
|
+
typeof value.span === 'number' &&
|
|
38
|
+
validLarge.includes(value.span) &&
|
|
39
|
+
'offset' in value &&
|
|
40
|
+
typeof value.offset === 'number' &&
|
|
41
|
+
validLarge.includes(value.offset)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { columnValidator };
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sbCompPrefix,
|
|
3
|
+
storybookControlsFromProps,
|
|
4
|
+
storyParametersObject,
|
|
5
|
+
} from '../../global/storybook-utils';
|
|
6
|
+
|
|
7
|
+
import { CvLink } from '.';
|
|
8
|
+
import { Download16 } from '@carbon/icons-vue';
|
|
9
|
+
import { props as propsCvLink, linkSizes } from '../../use/cvLink';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: `${sbCompPrefix}/CvLink`,
|
|
13
|
+
component: CvLink,
|
|
14
|
+
argTypes: {
|
|
15
|
+
...storybookControlsFromProps(propsCvLink),
|
|
16
|
+
disabled: {
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: 'boolean' },
|
|
20
|
+
category: 'props',
|
|
21
|
+
},
|
|
22
|
+
defaultValue: false,
|
|
23
|
+
description: 'Toogle anchor / router-link disable state.',
|
|
24
|
+
},
|
|
25
|
+
inline: {
|
|
26
|
+
type: 'boolean',
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: 'boolean' },
|
|
29
|
+
category: 'props',
|
|
30
|
+
},
|
|
31
|
+
defaultValue: false,
|
|
32
|
+
description:
|
|
33
|
+
'Specify whether you want the inline version of this control.',
|
|
34
|
+
},
|
|
35
|
+
href: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
table: {
|
|
38
|
+
type: { summary: 'string' },
|
|
39
|
+
category: 'props',
|
|
40
|
+
},
|
|
41
|
+
description: 'Provide the href attribute for the `<a>` node.',
|
|
42
|
+
},
|
|
43
|
+
to: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
table: {
|
|
46
|
+
type: {
|
|
47
|
+
summary:
|
|
48
|
+
'string, object (see vue-router documentation for router-link)',
|
|
49
|
+
},
|
|
50
|
+
category: 'props',
|
|
51
|
+
},
|
|
52
|
+
description:
|
|
53
|
+
"Replace `<a>` node for vue-router's `router-link`, providing `to` property to it. Cannot be used with href.",
|
|
54
|
+
},
|
|
55
|
+
visited: {
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
table: {
|
|
58
|
+
type: { summary: 'boolean' },
|
|
59
|
+
category: 'props',
|
|
60
|
+
},
|
|
61
|
+
defaultValue: false,
|
|
62
|
+
description:
|
|
63
|
+
'Specify whether you want the link to receive visited styles after the link has been clicked.',
|
|
64
|
+
},
|
|
65
|
+
size: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
table: {
|
|
68
|
+
type: { summary: linkSizes.join(' | ') },
|
|
69
|
+
defaultValue: { summary: 'medium (md)' },
|
|
70
|
+
category: 'props',
|
|
71
|
+
},
|
|
72
|
+
options: linkSizes,
|
|
73
|
+
control: {
|
|
74
|
+
type: 'select',
|
|
75
|
+
labels: {
|
|
76
|
+
sm: 'small (sm)',
|
|
77
|
+
md: 'medium (md)',
|
|
78
|
+
lg: 'large (lg)',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
defaultValue: 'md',
|
|
82
|
+
description:
|
|
83
|
+
'Specify the size of the Link. Currently supports either `sm`, `md` (default) or `lg` as an option.',
|
|
84
|
+
},
|
|
85
|
+
icon: {
|
|
86
|
+
table: {
|
|
87
|
+
type: { summary: 'string | object' },
|
|
88
|
+
category: 'props',
|
|
89
|
+
},
|
|
90
|
+
control: { type: null },
|
|
91
|
+
description:
|
|
92
|
+
'Render an icon next to the link. Can be a component object or a svg string',
|
|
93
|
+
},
|
|
94
|
+
default: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
table: {
|
|
97
|
+
type: { summary: 'html' },
|
|
98
|
+
category: 'slots',
|
|
99
|
+
},
|
|
100
|
+
description: 'Inner `<a>` node / router-link content.',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const template = `<cv-link href='#' v-bind='args'>{{ args.default }}</cv-link>`;
|
|
106
|
+
const Template = args => {
|
|
107
|
+
return {
|
|
108
|
+
components: { CvLink },
|
|
109
|
+
setup: () => ({ args }),
|
|
110
|
+
template,
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const Default = Template.bind({});
|
|
115
|
+
Default.args = { default: 'Link' };
|
|
116
|
+
Default.parameters = storyParametersObject(
|
|
117
|
+
Default.parameters,
|
|
118
|
+
template,
|
|
119
|
+
Default.args
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
export const Disabled = Template.bind({});
|
|
123
|
+
Disabled.args = { default: 'Disabled link', disabled: true };
|
|
124
|
+
Disabled.parameters = storyParametersObject(
|
|
125
|
+
Disabled.parameters,
|
|
126
|
+
template,
|
|
127
|
+
Disabled.args
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
const inlineTemplate = `
|
|
131
|
+
<p>
|
|
132
|
+
Ut facilisis semper lorem in aliquet. Aliquam accumsan ante justo, vitae
|
|
133
|
+
fringilla eros vehicula id. Ut at enim quis libero pharetra ullamcorper.
|
|
134
|
+
Maecenas feugiat sodales arcu ut porttitor. In blandit ultricies est.
|
|
135
|
+
Vivamus risus massa, cursus eu tellus sed, sagittis commodo nunc.
|
|
136
|
+
<cv-link href="#" v-bind='args'>{{ args.default }}</cv-link>,
|
|
137
|
+
finibus suscipit nunc. Phasellus ex quam, placerat quis tempus sit amet,
|
|
138
|
+
pretium nec sem. Etiam dictum scelerisque mauris, blandit ultrices erat
|
|
139
|
+
pellentesque id. Quisque venenatis purus sit amet sodales condimentum.
|
|
140
|
+
Duis at tincidunt orci. Ut velit ipsum, lacinia at ex quis, aliquet
|
|
141
|
+
rhoncus purus. Praesent et scelerisque ligula.
|
|
142
|
+
</p>
|
|
143
|
+
`;
|
|
144
|
+
const InlineTemplate = args => {
|
|
145
|
+
return {
|
|
146
|
+
components: { CvLink },
|
|
147
|
+
setup: () => ({ args }),
|
|
148
|
+
template: inlineTemplate,
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const Inline = InlineTemplate.bind({});
|
|
153
|
+
Inline.args = {
|
|
154
|
+
default: 'Maecenas nunc mauris, consequat quis mauris sit amet',
|
|
155
|
+
inline: true,
|
|
156
|
+
};
|
|
157
|
+
Inline.parameters = storyParametersObject(
|
|
158
|
+
Inline.parameters,
|
|
159
|
+
inlineTemplate,
|
|
160
|
+
Inline.args
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
export const PariedWithIcon = Template.bind({});
|
|
164
|
+
PariedWithIcon.args = { default: 'Download', icon: Download16 };
|
|
165
|
+
PariedWithIcon.parameters = storyParametersObject(
|
|
166
|
+
PariedWithIcon.parameters,
|
|
167
|
+
template,
|
|
168
|
+
PariedWithIcon.args
|
|
169
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="tagType"
|
|
4
|
+
v-bind="linkProps"
|
|
5
|
+
class="cv-link"
|
|
6
|
+
:class="[
|
|
7
|
+
`${carbonPrefix}--link`,
|
|
8
|
+
{
|
|
9
|
+
[`${carbonPrefix}--link--disabled`]: disabled,
|
|
10
|
+
[`${carbonPrefix}--link--inline`]: inline,
|
|
11
|
+
[`${carbonPrefix}--link--visited`]: visited,
|
|
12
|
+
[`${carbonPrefix}--link--${size}`]: size,
|
|
13
|
+
},
|
|
14
|
+
]"
|
|
15
|
+
>
|
|
16
|
+
<slot></slot>
|
|
17
|
+
<CvSvg v-if="icon" :class="`${carbonPrefix}--link__icon`" :svg="icon" />
|
|
18
|
+
</component>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
import CvSvg from '../CvSvg/_CvSvg.vue';
|
|
23
|
+
import { carbonPrefix } from '../../global/settings';
|
|
24
|
+
import {
|
|
25
|
+
props as linkPropsDefinition,
|
|
26
|
+
useLinkProps,
|
|
27
|
+
useTagType,
|
|
28
|
+
} from '../../use/cvLink';
|
|
29
|
+
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
icon: { type: [String, Object] },
|
|
32
|
+
inline: Boolean,
|
|
33
|
+
visited: Boolean,
|
|
34
|
+
...linkPropsDefinition,
|
|
35
|
+
});
|
|
36
|
+
const linkProps = useLinkProps(props);
|
|
37
|
+
const tagType = useTagType(props);
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CvList, CvListItem } from '.';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
sbCompPrefix,
|
|
5
|
+
storyParametersObject,
|
|
6
|
+
} from '../../global/storybook-utils';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: `${sbCompPrefix}/CvList`,
|
|
10
|
+
component: CvList,
|
|
11
|
+
argTypes: {
|
|
12
|
+
ordered: {
|
|
13
|
+
control: { type: 'boolean' },
|
|
14
|
+
},
|
|
15
|
+
nested: {
|
|
16
|
+
control: { type: 'boolean' },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const template = `<cv-list v-bind="args">
|
|
22
|
+
<cv-list-item>List item 1</cv-list-item>
|
|
23
|
+
<cv-list-item>List item 2</cv-list-item>
|
|
24
|
+
<cv-list-item>List item 3</cv-list-item>
|
|
25
|
+
</cv-list>`;
|
|
26
|
+
const Template = args => ({
|
|
27
|
+
components: { CvList, CvListItem },
|
|
28
|
+
setup: () => ({ args }),
|
|
29
|
+
template,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const Unordered = Template.bind({});
|
|
33
|
+
Unordered.args = {};
|
|
34
|
+
Unordered.parameters = storyParametersObject(
|
|
35
|
+
Unordered.parameters,
|
|
36
|
+
template,
|
|
37
|
+
Unordered.args
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export const Ordered = Template.bind({});
|
|
41
|
+
Ordered.args = {
|
|
42
|
+
ordered: true,
|
|
43
|
+
};
|
|
44
|
+
Ordered.parameters = storyParametersObject(
|
|
45
|
+
Ordered.parameters,
|
|
46
|
+
template,
|
|
47
|
+
Ordered.args
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const nestedTemplate = `<cv-list v-bind="args">
|
|
51
|
+
<cv-list-item>
|
|
52
|
+
List with no internal order
|
|
53
|
+
<cv-list nested>
|
|
54
|
+
<cv-list-item>Nested item 1</cv-list-item>
|
|
55
|
+
<cv-list-item>Nested item 2</cv-list-item>
|
|
56
|
+
<cv-list-item>Nested item 3</cv-list-item>
|
|
57
|
+
</cv-list>
|
|
58
|
+
</cv-list-item>
|
|
59
|
+
<cv-list-item>
|
|
60
|
+
List with ordered = false
|
|
61
|
+
<cv-list nested :ordered="false">
|
|
62
|
+
<cv-list-item>Nested item 1</cv-list-item>
|
|
63
|
+
<cv-list-item>Nested item 2</cv-list-item>
|
|
64
|
+
<cv-list-item>Nested item 3</cv-list-item>
|
|
65
|
+
</cv-list>
|
|
66
|
+
</cv-list-item>
|
|
67
|
+
<cv-list-item>
|
|
68
|
+
List with opposite ordering
|
|
69
|
+
<cv-list nested :ordered="!args.ordered">
|
|
70
|
+
<cv-list-item>Nested item 1</cv-list-item>
|
|
71
|
+
<cv-list-item>Nested item 2</cv-list-item>
|
|
72
|
+
<cv-list-item>Nested item 3</cv-list-item>
|
|
73
|
+
</cv-list>
|
|
74
|
+
</cv-list-item>
|
|
75
|
+
</cv-list>`;
|
|
76
|
+
const NestedTemplate = args => ({
|
|
77
|
+
components: { CvList, CvListItem },
|
|
78
|
+
setup: () => ({ args }),
|
|
79
|
+
template: nestedTemplate,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const Nested = NestedTemplate.bind({});
|
|
83
|
+
Nested.args = {};
|
|
84
|
+
Nested.parameters = storyParametersObject(
|
|
85
|
+
Nested.parameters,
|
|
86
|
+
nestedTemplate,
|
|
87
|
+
Nested.args
|
|
88
|
+
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="listType"
|
|
4
|
+
:class="{
|
|
5
|
+
[`${carbonPrefix}--list--nested`]: nested,
|
|
6
|
+
[`${carbonPrefix}--list--ordered`]: isActuallyOrdered,
|
|
7
|
+
[`${carbonPrefix}--list--unordered`]: !isActuallyOrdered,
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<slot />
|
|
11
|
+
</component>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import { getCurrentInstance, computed } from 'vue';
|
|
16
|
+
import { carbonPrefix } from '../../global/settings';
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: 'CvList',
|
|
20
|
+
props: {
|
|
21
|
+
/** Is the list ordered? */
|
|
22
|
+
ordered: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: undefined,
|
|
25
|
+
},
|
|
26
|
+
/** Is this list nested in another list? */
|
|
27
|
+
nested: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
setup(props) {
|
|
33
|
+
const instance = getCurrentInstance();
|
|
34
|
+
|
|
35
|
+
const isActuallyOrdered = computed(() => {
|
|
36
|
+
if (props.nested && props.ordered === undefined) {
|
|
37
|
+
if (instance.parent?.parent?.type.name === instance.type.name) {
|
|
38
|
+
return instance.parent?.parent?.setupState.isActuallyOrdered;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return props.ordered || false;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const listType = computed(() => (isActuallyOrdered.value ? 'ol' : 'ul'));
|
|
46
|
+
|
|
47
|
+
return { carbonPrefix, isActuallyOrdered, listType };
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
</script>
|