@carbon/vue 2.45.1 → 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 -299
- 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,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<option
|
|
3
|
+
:data-initial-selected="isSelected"
|
|
4
|
+
:class="`cv-select-option ${carbonPrefix}--select-option`"
|
|
5
|
+
>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</option>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
import { carbonPrefix } from '../../global/settings';
|
|
12
|
+
import { computed, useAttrs } from 'vue';
|
|
13
|
+
const attrs = useAttrs();
|
|
14
|
+
const isSelected = computed(() => {
|
|
15
|
+
const selected = attrs['selected'];
|
|
16
|
+
if (typeof selected === 'string')
|
|
17
|
+
return selected !== 'false' ? true : undefined;
|
|
18
|
+
if (typeof selected === 'boolean') return selected ? true : undefined;
|
|
19
|
+
|
|
20
|
+
return selected ? true : undefined;
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sbCompPrefix,
|
|
3
|
+
storyParametersObject,
|
|
4
|
+
} from '../../global/storybook-utils';
|
|
5
|
+
|
|
6
|
+
import { CvSkeletonText } from '.';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: `${sbCompPrefix}/CvSkeletonText`,
|
|
10
|
+
component: CvSkeletonText,
|
|
11
|
+
argTypes: {
|
|
12
|
+
heading: { control: { type: 'boolean' } },
|
|
13
|
+
lineCount: { control: { type: 'number', min: 1 } },
|
|
14
|
+
width: {
|
|
15
|
+
control: { type: 'text' },
|
|
16
|
+
defaultValue: CvSkeletonText.props.width.default,
|
|
17
|
+
table: {
|
|
18
|
+
defaultValue: { summary: `"${CvSkeletonText.props.width.default}"` },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const template = `<cv-skeleton-text v-bind="args" />`;
|
|
25
|
+
const Template = args => {
|
|
26
|
+
return {
|
|
27
|
+
components: { CvSkeletonText },
|
|
28
|
+
setup: () => ({ args }),
|
|
29
|
+
template,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Default = Template.bind({});
|
|
34
|
+
Default.args = {
|
|
35
|
+
width: '100%',
|
|
36
|
+
};
|
|
37
|
+
Default.parameters = storyParametersObject(
|
|
38
|
+
Default.parameters,
|
|
39
|
+
template,
|
|
40
|
+
Default.args
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export const Minimal = Template.bind({});
|
|
44
|
+
Minimal.args = {
|
|
45
|
+
width: '100%',
|
|
46
|
+
};
|
|
47
|
+
Minimal.argTypes = {
|
|
48
|
+
heading: { table: { disable: true } },
|
|
49
|
+
lineCount: { table: { disable: true } },
|
|
50
|
+
width: { table: { disable: true } },
|
|
51
|
+
};
|
|
52
|
+
Minimal.parameters = storyParametersObject(
|
|
53
|
+
Minimal.parameters,
|
|
54
|
+
template,
|
|
55
|
+
Minimal.args
|
|
56
|
+
);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<p
|
|
3
|
+
v-if="lineCount === 1"
|
|
4
|
+
:class="[
|
|
5
|
+
`${carbonPrefix}--skeleton__text`,
|
|
6
|
+
{ [`${carbonPrefix}--skeleton__heading`]: heading },
|
|
7
|
+
]"
|
|
8
|
+
:style="{ width }"
|
|
9
|
+
/>
|
|
10
|
+
<div v-else>
|
|
11
|
+
<p
|
|
12
|
+
v-for="i in lineCount"
|
|
13
|
+
:key="i"
|
|
14
|
+
:class="[
|
|
15
|
+
`${carbonPrefix}--skeleton__text`,
|
|
16
|
+
{ [`${carbonPrefix}--skeleton__heading`]: heading },
|
|
17
|
+
]"
|
|
18
|
+
:style="{ width: widths[i - 1] }"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { computed } from 'vue';
|
|
25
|
+
import { carbonPrefix } from '../../global/settings';
|
|
26
|
+
|
|
27
|
+
const LENGTH_MODIFIERS = [`64px`, `2px`, `32px`];
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
name: 'CvSkeletonText',
|
|
31
|
+
props: {
|
|
32
|
+
/** Make skeleton text larger (like heading) */
|
|
33
|
+
heading: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
/** Number of skeleton text lines shown */
|
|
38
|
+
lineCount: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 1,
|
|
41
|
+
validator: value => value > 0,
|
|
42
|
+
},
|
|
43
|
+
/** Width (with CSS unit, e.g. px or %) of single line of text, or max-width of paragraph lines */
|
|
44
|
+
width: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: '100%',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
setup(props) {
|
|
50
|
+
const widths = computed(() =>
|
|
51
|
+
Array.from(
|
|
52
|
+
{ length: props.lineCount },
|
|
53
|
+
(_, i) =>
|
|
54
|
+
`calc(${props.width} - ${
|
|
55
|
+
LENGTH_MODIFIERS[i % LENGTH_MODIFIERS.length]
|
|
56
|
+
})`
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return { carbonPrefix, widths };
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { computed, h } from 'vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: 'CvSvg',
|
|
6
|
+
props: {
|
|
7
|
+
svg: {
|
|
8
|
+
type: [String, Object],
|
|
9
|
+
default: undefined,
|
|
10
|
+
validator(val) {
|
|
11
|
+
if (!val || typeof val === 'string') {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
const result = !!(val.render || val.setup);
|
|
15
|
+
if (!result) {
|
|
16
|
+
console.error(
|
|
17
|
+
'Expected a Vue icon component, SVG, SVG Symbol or SVG file'
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
setup(props) {
|
|
25
|
+
const isSvg = computed(() => props.svg && props.svg.indexOf('<svg') >= 0);
|
|
26
|
+
const isSymbol = computed(
|
|
27
|
+
() => props.svg && !props.isSvg && props.svg.indexOf('#') >= 0
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
if (typeof props.svg === 'object') {
|
|
32
|
+
// assume an @carbon/icons-vue icon
|
|
33
|
+
return h(props.svg);
|
|
34
|
+
} else if (isSvg.value) {
|
|
35
|
+
// an SVG document
|
|
36
|
+
return h('svg', { domProps: { innerHTML: props.svg } });
|
|
37
|
+
} else {
|
|
38
|
+
if (isSymbol.value) {
|
|
39
|
+
return h('svg', {}, [h('use', { attrs: { href: props.svg } })]);
|
|
40
|
+
} else {
|
|
41
|
+
// an image of some description.
|
|
42
|
+
return h('img', { attrs: { src: props.svg } });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="root">
|
|
3
|
+
<g fill-rule="evenodd" id="g">
|
|
4
|
+
<path
|
|
5
|
+
id="path"
|
|
6
|
+
d="M7 7H4v2h3v3h2V9h3V7H9V4H7v3zm1 9A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"
|
|
7
|
+
/>
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: 'TestIcon',
|
|
15
|
+
// setup() {
|
|
16
|
+
// // empty setup
|
|
17
|
+
// },
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import CvTag from './CvTag.vue';
|
|
2
|
+
import { tagKinds } from './consts.js';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
import {
|
|
5
|
+
sbCompPrefix,
|
|
6
|
+
storyParametersObject,
|
|
7
|
+
} from '../../global/storybook-utils';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: `${sbCompPrefix}/CvTag`,
|
|
11
|
+
component: CvTag,
|
|
12
|
+
argTypes: {
|
|
13
|
+
kind: { control: { type: 'select', options: tagKinds } },
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const template = `<CvTag @remove="onRemove" v-bind="args" />`;
|
|
18
|
+
const Template = (args, { argTypes }) => {
|
|
19
|
+
return {
|
|
20
|
+
props: Object.keys(argTypes),
|
|
21
|
+
components: { CvTag },
|
|
22
|
+
template,
|
|
23
|
+
setup() {
|
|
24
|
+
return {
|
|
25
|
+
args,
|
|
26
|
+
onRemove: action('remove'),
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Default = Template.bind({});
|
|
33
|
+
Default.args = {
|
|
34
|
+
kind: 'red',
|
|
35
|
+
label: 'This is a tag',
|
|
36
|
+
filter: false,
|
|
37
|
+
};
|
|
38
|
+
Default.parameters = storyParametersObject(
|
|
39
|
+
Default.parameters,
|
|
40
|
+
template,
|
|
41
|
+
Default.args
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export const Filter = Template.bind({});
|
|
45
|
+
Filter.args = {
|
|
46
|
+
kind: 'teal',
|
|
47
|
+
label: 'This is a tag',
|
|
48
|
+
filter: true,
|
|
49
|
+
};
|
|
50
|
+
Filter.parameters = storyParametersObject(
|
|
51
|
+
Filter.parameters,
|
|
52
|
+
template,
|
|
53
|
+
Filter.args
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
export const Skeleton = Template.bind({});
|
|
57
|
+
Skeleton.args = {
|
|
58
|
+
skeleton: true,
|
|
59
|
+
};
|
|
60
|
+
Skeleton.parameters = storyParametersObject(
|
|
61
|
+
Skeleton.parameters,
|
|
62
|
+
template,
|
|
63
|
+
Skeleton.args
|
|
64
|
+
);
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="skeleton" :class="tagClasses" />
|
|
3
|
+
<div v-else :class="tagClasses" role="listitem" :title="title">
|
|
4
|
+
<span :class="`${carbonPrefix}--tag__label`">
|
|
5
|
+
{{ label }}
|
|
6
|
+
</span>
|
|
7
|
+
<button
|
|
8
|
+
v-if="filter"
|
|
9
|
+
:class="`${carbonPrefix}--tag__close-icon`"
|
|
10
|
+
:aria-label="clearAriaLabel"
|
|
11
|
+
@click.stop.prevent="onRemove"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
>
|
|
14
|
+
<Close16 />
|
|
15
|
+
</button>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import { computed } from 'vue';
|
|
21
|
+
import { carbonPrefix } from '../../global/settings';
|
|
22
|
+
import { tagKinds } from './consts';
|
|
23
|
+
import Close16 from '@carbon/icons-vue/es/close/16';
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
name: 'CvTag',
|
|
27
|
+
components: { Close16 },
|
|
28
|
+
props: {
|
|
29
|
+
clearAriaLabel: { type: String, default: 'Clear filter' },
|
|
30
|
+
/**
|
|
31
|
+
* disabled by property or if skeleton
|
|
32
|
+
*/
|
|
33
|
+
disabled: Boolean,
|
|
34
|
+
/**
|
|
35
|
+
* label to be used in the CvTag component
|
|
36
|
+
*/
|
|
37
|
+
label: { type: String, required: true },
|
|
38
|
+
/**
|
|
39
|
+
* kind of the CvTag
|
|
40
|
+
*/
|
|
41
|
+
kind: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'red',
|
|
44
|
+
validator(val) {
|
|
45
|
+
return tagKinds.includes(val);
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* If filter is true, the CvTag will include a remove button on the right side, which on a click, will emit the 'remove' event.
|
|
50
|
+
*/
|
|
51
|
+
filter: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* skeleton used when loading
|
|
57
|
+
*/
|
|
58
|
+
skeleton: Boolean,
|
|
59
|
+
},
|
|
60
|
+
emits: [
|
|
61
|
+
/**
|
|
62
|
+
* Triggers when the clear button is pressed on a filter CvTag
|
|
63
|
+
*/
|
|
64
|
+
'remove',
|
|
65
|
+
],
|
|
66
|
+
setup(props, { emit }) {
|
|
67
|
+
const title = computed(() => {
|
|
68
|
+
return props.filter ? props.clearAriaLabel : null;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const tagClasses = computed(() => {
|
|
72
|
+
const classes = [
|
|
73
|
+
`${carbonPrefix}--tag`,
|
|
74
|
+
`${carbonPrefix}--tag--${props.kind}`,
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
if (props.skeleton) {
|
|
78
|
+
classes.push(`${carbonPrefix}--skeleton`);
|
|
79
|
+
} else {
|
|
80
|
+
if (props.filter) {
|
|
81
|
+
classes.push(`${carbonPrefix}--tag--filter`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (props.disabled) {
|
|
85
|
+
classes.push(`${carbonPrefix}--tag--disabled`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return classes;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const onRemove = () => {
|
|
92
|
+
if (!props.disabled) {
|
|
93
|
+
emit('remove');
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
carbonPrefix,
|
|
99
|
+
title,
|
|
100
|
+
tagClasses,
|
|
101
|
+
onRemove,
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<header :class="`cv-header ${carbonPrefix}--header`" data-header :id="uid">
|
|
3
|
+
<slot />
|
|
4
|
+
<div v-if="hasGlobalHeader" :class="`${carbonPrefix}--header__global`">
|
|
5
|
+
<slot name="header-global" />
|
|
6
|
+
</div>
|
|
7
|
+
<slot name="left-panels" />
|
|
8
|
+
<slot name="right-panels" />
|
|
9
|
+
</header>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
import { carbonPrefix } from '../../global/settings';
|
|
14
|
+
import {
|
|
15
|
+
onBeforeMount,
|
|
16
|
+
onMounted,
|
|
17
|
+
onUnmounted,
|
|
18
|
+
onUpdated,
|
|
19
|
+
provide,
|
|
20
|
+
reactive,
|
|
21
|
+
readonly,
|
|
22
|
+
ref,
|
|
23
|
+
useAttrs,
|
|
24
|
+
useSlots,
|
|
25
|
+
} from 'vue';
|
|
26
|
+
import { getBus, removeBus } from '../../global/component-utils/event-bus';
|
|
27
|
+
import { useCvId } from '../../use/cvId';
|
|
28
|
+
|
|
29
|
+
const attrs = useAttrs();
|
|
30
|
+
const uid = useCvId(attrs, true);
|
|
31
|
+
provide('cv-header-id', readonly(uid));
|
|
32
|
+
let bus = undefined;
|
|
33
|
+
onBeforeMount(() => {
|
|
34
|
+
bus = getBus(uid.value);
|
|
35
|
+
bus.on('cv:panel-control-mounted', onCvPanelControlMounted);
|
|
36
|
+
bus.on('cv:panel-control-beforeDestroy', onCvPanelControlBeforeDestroy);
|
|
37
|
+
|
|
38
|
+
bus.on('cv:panel-control-toggle', onCvPanelControlToggle);
|
|
39
|
+
bus.on('cv:panel-control-focusout', onCvPanelControlFocusout);
|
|
40
|
+
bus.on('cv:panel-mounted', onCvPanelMounted);
|
|
41
|
+
bus.on('cv:panel-beforeDestroy', onCvPanelBeforeDestroy);
|
|
42
|
+
bus.on('cv:panel-focusout', onCvPanelFocusout);
|
|
43
|
+
});
|
|
44
|
+
onUnmounted(() => {
|
|
45
|
+
removeBus(uid.value);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const hasGlobalHeader = ref(false);
|
|
49
|
+
const slots = useSlots();
|
|
50
|
+
onMounted(() => {
|
|
51
|
+
// NOTE: slots is not reactive so needs to be managed on updated
|
|
52
|
+
hasGlobalHeader.value = !!slots['header-global'];
|
|
53
|
+
});
|
|
54
|
+
onUpdated(() => {
|
|
55
|
+
// NOTE: slots is not reactive so needs to be managed on updated
|
|
56
|
+
hasGlobalHeader.value = !!slots['header-global'];
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Panel Data
|
|
61
|
+
* @typedef {Object} CvHeaderPanel
|
|
62
|
+
* @property {string} id - panel id
|
|
63
|
+
* @property {boolean?} rail - is this panel a rail
|
|
64
|
+
* @property {boolean?} headerEmbedded - true when the panel is added to a list
|
|
65
|
+
* @property {HTMLElement} el
|
|
66
|
+
* @property {WritableComputedRef<boolean>} panelExpanded
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Controller Data
|
|
71
|
+
* @typedef {Object} CvHeaderController
|
|
72
|
+
* @property {string} id - controller id
|
|
73
|
+
* @property {string} ariaControls - what is controlled
|
|
74
|
+
* @property {boolean} hasRail - controls a rail?
|
|
75
|
+
* @property {HTMLElement} el
|
|
76
|
+
* @property {WritableComputedRef<boolean>} panelExpanded
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @type {UnwrapNestedRefs<{panels: Array<CvHeaderPanel>, panelControllers:Array<CvHeaderController>}>}
|
|
81
|
+
*/
|
|
82
|
+
const data = reactive({
|
|
83
|
+
panels: [],
|
|
84
|
+
panelControllers: [],
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Associate a rail controller with a panel
|
|
89
|
+
* @param {CvHeaderController} _ctrl
|
|
90
|
+
* @param {CvHeaderPanel?} _panel
|
|
91
|
+
*/
|
|
92
|
+
function hasRail(_ctrl, _panel) {
|
|
93
|
+
let panel = _panel;
|
|
94
|
+
let ctrl = _ctrl;
|
|
95
|
+
if (ctrl) {
|
|
96
|
+
panel = data.panels?.find(item => item.id === ctrl.ariaControls);
|
|
97
|
+
} else {
|
|
98
|
+
if (panel) {
|
|
99
|
+
ctrl = data.panelControllers?.find(
|
|
100
|
+
item => item.ariaControls === panel.id
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (ctrl) {
|
|
105
|
+
ctrl.hasRail = !!(panel && ctrl) && panel.rail;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Add controller to list
|
|
111
|
+
* @param {CvHeaderController} srcComponent
|
|
112
|
+
*/
|
|
113
|
+
function onCvPanelControlMounted(srcComponent) {
|
|
114
|
+
data.panelControllers.push(srcComponent);
|
|
115
|
+
hasRail(srcComponent);
|
|
116
|
+
}
|
|
117
|
+
function onCvPanelControlBeforeDestroy(srcComponent) {
|
|
118
|
+
const index = data.panelControllers.findIndex(
|
|
119
|
+
item => item.id === srcComponent.id
|
|
120
|
+
);
|
|
121
|
+
if (index > -1) {
|
|
122
|
+
data.panelControllers.splice(index, 1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Toggle a panel
|
|
128
|
+
* @param {CvHeaderController} srcComponent
|
|
129
|
+
* @param force
|
|
130
|
+
*/
|
|
131
|
+
function onCvPanelControlToggle(srcComponent, force) {
|
|
132
|
+
const foundIndex = data.panels.findIndex(
|
|
133
|
+
item => item.id === srcComponent.ariaControls
|
|
134
|
+
);
|
|
135
|
+
if (foundIndex > -1) {
|
|
136
|
+
const newValue = force !== undefined ? force : !srcComponent.panelExpanded;
|
|
137
|
+
// close all panels
|
|
138
|
+
for (let index in data.panels) {
|
|
139
|
+
data.panels[index].panelExpanded = false;
|
|
140
|
+
}
|
|
141
|
+
for (let index in data.panelControllers) {
|
|
142
|
+
data.panelControllers[index].panelExpanded = false;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// open just this one panel
|
|
146
|
+
srcComponent.panelExpanded = newValue;
|
|
147
|
+
data.panels[foundIndex].panelExpanded = newValue;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function onCvPanelControlFocusout(payload) {
|
|
152
|
+
const srcComponent = payload.ctrl;
|
|
153
|
+
const srcEvent = payload.ev;
|
|
154
|
+
/**
|
|
155
|
+
* @type {CvHeaderPanel}
|
|
156
|
+
*/
|
|
157
|
+
const found = data.panels.find(item => item.id === srcComponent.ariaControls);
|
|
158
|
+
if (
|
|
159
|
+
found &&
|
|
160
|
+
!found.rail &&
|
|
161
|
+
found.el !== srcEvent.relatedTarget &&
|
|
162
|
+
!found.el.contains(srcEvent.relatedTarget)
|
|
163
|
+
) {
|
|
164
|
+
// close when not a rail
|
|
165
|
+
onCvPanelControlToggle(srcComponent, false);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Add panel to list
|
|
171
|
+
* @param {CvHeaderPanel} srcComponent
|
|
172
|
+
*/
|
|
173
|
+
function onCvPanelMounted(srcComponent) {
|
|
174
|
+
data.panels.push(srcComponent);
|
|
175
|
+
srcComponent.headerEmbedded = true;
|
|
176
|
+
hasRail(undefined, srcComponent);
|
|
177
|
+
}
|
|
178
|
+
function onCvPanelBeforeDestroy(srcComponent) {
|
|
179
|
+
const index = data.panels.findIndex(item => item.id === srcComponent.id);
|
|
180
|
+
if (index > -1) {
|
|
181
|
+
data.panels.splice(index, 1);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function onCvPanelFocusout(payload) {
|
|
186
|
+
const srcComponent = payload.panel;
|
|
187
|
+
const srcEvent = payload.ev;
|
|
188
|
+
/**
|
|
189
|
+
* @type {CvHeaderController}
|
|
190
|
+
*/
|
|
191
|
+
const found = data.panelControllers.find(
|
|
192
|
+
item => item.ariaControls === srcComponent.id
|
|
193
|
+
);
|
|
194
|
+
if (
|
|
195
|
+
srcComponent.el !== srcEvent.relatedTarget &&
|
|
196
|
+
!srcComponent.el.contains(srcEvent.relatedTarget) &&
|
|
197
|
+
found &&
|
|
198
|
+
found.el !== srcEvent.relatedTarget
|
|
199
|
+
) {
|
|
200
|
+
onCvPanelControlToggle(found, false);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
</script>
|