@carbon/vue 2.45.1 → 3.0.5-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 +28359 -0
- package/dist/carbon-vue-3.common.js.map +1 -0
- package/dist/carbon-vue-3.umd.js +28370 -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 +71 -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/CvTextArea/CvTextArea.stories.js +174 -0
- package/src/components/CvTextArea/CvTextArea.vue +107 -0
- package/src/components/CvTextArea/index.js +4 -0
- package/src/components/CvTextInput/CvTextInput.stories.js +245 -0
- package/src/components/CvTextInput/CvTextInput.vue +217 -0
- package/src/components/CvTextInput/const.js +2 -0
- package/src/components/CvTextInput/index.js +4 -0
- package/src/components/CvTile/CvTile.stories.mdx +156 -0
- package/src/components/CvTile/CvTile.vue +67 -0
- package/src/components/CvTile/CvTileClickable.vue +23 -0
- package/src/components/CvTile/CvTileExpandable.vue +103 -0
- package/src/components/{cv-tile/_cv-tile-selectable.vue → CvTile/CvTileSelectable.vue} +18 -14
- package/src/components/{cv-tile/_cv-tile-standard.vue → CvTile/CvTileStandard.vue} +1 -5
- package/src/components/CvTile/index.js +4 -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.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,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`cv-text-area ${carbonPrefix}--form-item`">
|
|
3
|
+
<label
|
|
4
|
+
:for="cvId"
|
|
5
|
+
:class="[
|
|
6
|
+
`${carbonPrefix}--label`,
|
|
7
|
+
{
|
|
8
|
+
[`${carbonPrefix}--label--disabled`]: $attrs.disabled,
|
|
9
|
+
[`${carbonPrefix}--visually-hidden`]: hideLabel,
|
|
10
|
+
},
|
|
11
|
+
]"
|
|
12
|
+
>
|
|
13
|
+
{{ label }}
|
|
14
|
+
</label>
|
|
15
|
+
<div
|
|
16
|
+
:class="`${carbonPrefix}--text-area__wrapper`"
|
|
17
|
+
:data-invalid="isInvalid"
|
|
18
|
+
>
|
|
19
|
+
<WarningFilled16
|
|
20
|
+
v-if="isInvalid"
|
|
21
|
+
:class="`${carbonPrefix}--text-area__invalid-icon`"
|
|
22
|
+
/>
|
|
23
|
+
<textarea
|
|
24
|
+
:aria-invalid="isInvalid"
|
|
25
|
+
:aria-describedby="isInvalid ? errorId : undefined"
|
|
26
|
+
:id="cvId"
|
|
27
|
+
:class="[
|
|
28
|
+
`${carbonPrefix}--text-area`,
|
|
29
|
+
{
|
|
30
|
+
[`${carbonPrefix}--text-area--invalid`]: isInvalid,
|
|
31
|
+
[`${carbonPrefix}--text-area--light`]: isLight,
|
|
32
|
+
},
|
|
33
|
+
]"
|
|
34
|
+
v-bind="$attrs"
|
|
35
|
+
:value="modelValue"
|
|
36
|
+
@input="$event => $emit('update:modelValue', $event.target.value)"
|
|
37
|
+
></textarea>
|
|
38
|
+
</div>
|
|
39
|
+
<div
|
|
40
|
+
v-if="isInvalid"
|
|
41
|
+
:id="errorId"
|
|
42
|
+
:class="`${carbonPrefix}--form-requirement`"
|
|
43
|
+
>
|
|
44
|
+
<slot name="invalid-message">{{ invalidMessage }}</slot>
|
|
45
|
+
</div>
|
|
46
|
+
<div
|
|
47
|
+
v-if="isHelper"
|
|
48
|
+
:class="[
|
|
49
|
+
`${carbonPrefix}--form__helper-text`,
|
|
50
|
+
{ [`${carbonPrefix}--form__helper-text--disabled`]: $attrs.disabled },
|
|
51
|
+
]"
|
|
52
|
+
>
|
|
53
|
+
<slot name="helper-text">{{ helperText }}</slot>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script setup>
|
|
59
|
+
import { computed, ref, useSlots, onBeforeMount, onBeforeUpdate } from 'vue';
|
|
60
|
+
import { WarningFilled16 } from '@carbon/icons-vue';
|
|
61
|
+
import { carbonPrefix } from '../../global/settings';
|
|
62
|
+
import { useCvId, props as propsCvId } from '../../use/cvId';
|
|
63
|
+
import { useIsLight, props as propsTheme } from '../../use/cvTheme';
|
|
64
|
+
|
|
65
|
+
const props = defineProps({
|
|
66
|
+
helperText: { type: String, default: undefined },
|
|
67
|
+
hideLabel: { type: Boolean, default: false },
|
|
68
|
+
invalidMessage: { type: String, default: undefined },
|
|
69
|
+
label: String,
|
|
70
|
+
modelValue: String,
|
|
71
|
+
...propsCvId,
|
|
72
|
+
...propsTheme,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const cvId = useCvId(props);
|
|
76
|
+
|
|
77
|
+
// DOM
|
|
78
|
+
const slots = useSlots();
|
|
79
|
+
|
|
80
|
+
// Data
|
|
81
|
+
const isHelper = ref(false);
|
|
82
|
+
const isInvalid = ref(false);
|
|
83
|
+
const isLight = useIsLight(props);
|
|
84
|
+
|
|
85
|
+
// Computed
|
|
86
|
+
const errorId = computed(() => `error-${cvId.value}`);
|
|
87
|
+
|
|
88
|
+
// Methods
|
|
89
|
+
function checkSlots() {
|
|
90
|
+
// NOTE: this.$slots is not reactive so needs to be managed on updated
|
|
91
|
+
isInvalid.value = !!(
|
|
92
|
+
props.invalidMessage?.length || slots['invalid-message']
|
|
93
|
+
);
|
|
94
|
+
isHelper.value =
|
|
95
|
+
!isInvalid.value && !!(props.helperText?.length || slots['helper-text']);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Life Hooks
|
|
99
|
+
onBeforeMount(checkSlots);
|
|
100
|
+
onBeforeUpdate(checkSlots);
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<script>
|
|
104
|
+
export default {
|
|
105
|
+
inheritAttrs: false,
|
|
106
|
+
};
|
|
107
|
+
</script>
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sbCompPrefix,
|
|
3
|
+
storyParametersObject,
|
|
4
|
+
} from '../../global/storybook-utils';
|
|
5
|
+
|
|
6
|
+
import CvTextInput from '.';
|
|
7
|
+
import { ref } from 'vue';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: `${sbCompPrefix}/CvTextInput`,
|
|
11
|
+
component: CvTextInput,
|
|
12
|
+
argTypes: {
|
|
13
|
+
// attrs
|
|
14
|
+
disabled: {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
table: {
|
|
17
|
+
type: { summary: 'boolean' },
|
|
18
|
+
category: 'attributes',
|
|
19
|
+
},
|
|
20
|
+
description: 'Specify whether the `<input>` should be disabled',
|
|
21
|
+
},
|
|
22
|
+
placeholder: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
table: {
|
|
25
|
+
type: { summary: 'string' },
|
|
26
|
+
category: 'attributes',
|
|
27
|
+
},
|
|
28
|
+
description: 'Specify the placeholder attribute for the `<input>`',
|
|
29
|
+
},
|
|
30
|
+
// props
|
|
31
|
+
helperText: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: 'string' },
|
|
35
|
+
category: 'props',
|
|
36
|
+
},
|
|
37
|
+
description:
|
|
38
|
+
'Provide text that is used alongside the control label for additional help',
|
|
39
|
+
},
|
|
40
|
+
hideLabel: {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
table: {
|
|
43
|
+
type: { summary: 'boolean' },
|
|
44
|
+
category: 'props',
|
|
45
|
+
defaultValue: false,
|
|
46
|
+
},
|
|
47
|
+
description:
|
|
48
|
+
'Specify whether you want the underlying label to be visually hidden',
|
|
49
|
+
},
|
|
50
|
+
invalidMessage: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
table: {
|
|
53
|
+
type: { summary: 'string' },
|
|
54
|
+
category: 'props',
|
|
55
|
+
},
|
|
56
|
+
description:
|
|
57
|
+
'Provide the text that is displayed when the control is in an invalid state',
|
|
58
|
+
},
|
|
59
|
+
label: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
table: {
|
|
62
|
+
type: { summary: 'string' },
|
|
63
|
+
category: 'props',
|
|
64
|
+
},
|
|
65
|
+
description: "Input's label",
|
|
66
|
+
},
|
|
67
|
+
light: {
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
table: {
|
|
70
|
+
type: { summary: 'boolean' },
|
|
71
|
+
category: 'props',
|
|
72
|
+
defaultValue: false,
|
|
73
|
+
},
|
|
74
|
+
description:
|
|
75
|
+
"Toggles light version. For use on `$ui-01` backgrounds only. Don't use this to make tile background color same as container background color.",
|
|
76
|
+
},
|
|
77
|
+
modelValue: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
table: {
|
|
80
|
+
type: { summary: 'string' },
|
|
81
|
+
category: 'props',
|
|
82
|
+
},
|
|
83
|
+
description:
|
|
84
|
+
"Input's value, modelValue is the vue3 default 'prop' for two-way data binding with v-model",
|
|
85
|
+
},
|
|
86
|
+
passwordHideLabel: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
table: {
|
|
89
|
+
type: { summary: 'string' },
|
|
90
|
+
category: 'props',
|
|
91
|
+
},
|
|
92
|
+
description: '"Hide password" tooltip text on password visibility toggle',
|
|
93
|
+
},
|
|
94
|
+
passwordShowLabel: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
table: {
|
|
97
|
+
type: { summary: 'string' },
|
|
98
|
+
category: 'props',
|
|
99
|
+
},
|
|
100
|
+
description: '"Show password" tooltip text on password visibility toggle',
|
|
101
|
+
},
|
|
102
|
+
passwordVisible: {
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
table: {
|
|
105
|
+
type: { summary: 'boolean' },
|
|
106
|
+
category: 'props',
|
|
107
|
+
},
|
|
108
|
+
description: 'Toggle password visibility.',
|
|
109
|
+
},
|
|
110
|
+
type: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
table: {
|
|
113
|
+
type: { summary: 'string' },
|
|
114
|
+
category: 'props',
|
|
115
|
+
defaultValue: { summary: 'text' },
|
|
116
|
+
},
|
|
117
|
+
options: ['text', 'password'],
|
|
118
|
+
control: {
|
|
119
|
+
type: 'select',
|
|
120
|
+
},
|
|
121
|
+
description: 'Input type, only `text` and `password` are available',
|
|
122
|
+
},
|
|
123
|
+
warnText: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
table: {
|
|
126
|
+
type: { summary: 'string' },
|
|
127
|
+
category: 'props',
|
|
128
|
+
},
|
|
129
|
+
description:
|
|
130
|
+
'Provide the text that is displayed when the control is in warning state',
|
|
131
|
+
},
|
|
132
|
+
// slots
|
|
133
|
+
'helper-text': {
|
|
134
|
+
type: 'string',
|
|
135
|
+
table: {
|
|
136
|
+
type: { summary: 'string | html | Component' },
|
|
137
|
+
category: 'slots',
|
|
138
|
+
},
|
|
139
|
+
description:
|
|
140
|
+
"Helper text slot. It isn't shown if invalid message or warn text, either props or slots, are available",
|
|
141
|
+
},
|
|
142
|
+
'invalid-message': {
|
|
143
|
+
type: 'string',
|
|
144
|
+
table: {
|
|
145
|
+
type: { summary: 'string | html | Component' },
|
|
146
|
+
category: 'slots',
|
|
147
|
+
},
|
|
148
|
+
description: 'Invalid message slot.',
|
|
149
|
+
},
|
|
150
|
+
'warn-text': {
|
|
151
|
+
type: 'string',
|
|
152
|
+
table: {
|
|
153
|
+
type: { summary: 'string | html | Component' },
|
|
154
|
+
category: 'slots',
|
|
155
|
+
},
|
|
156
|
+
description:
|
|
157
|
+
"Warn text slot. It isn't shown if invalid message, either prop or slot, is available",
|
|
158
|
+
},
|
|
159
|
+
// events
|
|
160
|
+
'update:modelValue': {
|
|
161
|
+
type: 'event',
|
|
162
|
+
table: {
|
|
163
|
+
type: { summary: 'event' },
|
|
164
|
+
category: 'events',
|
|
165
|
+
},
|
|
166
|
+
control: { type: null },
|
|
167
|
+
description:
|
|
168
|
+
"Triggered on textarea update. `update:modelValue` is the vue3 default 'event' for two-way data binding with v-model",
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const template = `
|
|
174
|
+
<cv-text-input v-bind="args">
|
|
175
|
+
<template v-if="args['helper-text']" v-slot:helper-text />
|
|
176
|
+
<template v-if="args['warn-text']" v-slot:warn-text />
|
|
177
|
+
<template v-if="args['invalid-message']" v-slot:invalid-message />
|
|
178
|
+
</cv-text-input>
|
|
179
|
+
`;
|
|
180
|
+
const Template = args => {
|
|
181
|
+
return {
|
|
182
|
+
components: { CvTextInput },
|
|
183
|
+
setup: () => ({ args }),
|
|
184
|
+
template,
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const Default = Template.bind({});
|
|
189
|
+
Default.args = {
|
|
190
|
+
helperText: 'Same helper text',
|
|
191
|
+
label: 'Text input label',
|
|
192
|
+
placeholder: 'Sample placeholder',
|
|
193
|
+
};
|
|
194
|
+
Default.parameters = storyParametersObject(
|
|
195
|
+
Default.parameters,
|
|
196
|
+
template,
|
|
197
|
+
Default.args
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
export const Slots = Template.bind({});
|
|
201
|
+
Slots.args = {
|
|
202
|
+
'invalid-message': 'Same invalid message',
|
|
203
|
+
'warn-text': 'Same warn message',
|
|
204
|
+
'helper-text': 'Same help message',
|
|
205
|
+
label: 'Text input label',
|
|
206
|
+
placeholder: 'Sample placeholder',
|
|
207
|
+
};
|
|
208
|
+
Slots.parameters = storyParametersObject(
|
|
209
|
+
Slots.parameters,
|
|
210
|
+
template,
|
|
211
|
+
Slots.args
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
const vModelTemplate = `
|
|
215
|
+
<cv-text-input v-bind="args" v-model="value" />
|
|
216
|
+
<p style="margin-top: 1rem;">Value passed to v-model: {{ value }}</p>
|
|
217
|
+
`;
|
|
218
|
+
const VModelTemplate = args => {
|
|
219
|
+
return {
|
|
220
|
+
components: { CvTextInput },
|
|
221
|
+
setup: () => ({ args, value: ref('') }),
|
|
222
|
+
template: vModelTemplate,
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
export const vModel = VModelTemplate.bind({});
|
|
226
|
+
vModel.args = {
|
|
227
|
+
label: 'Text input label',
|
|
228
|
+
placeholder: 'Sample placeholder',
|
|
229
|
+
};
|
|
230
|
+
vModel.parameters = storyParametersObject(
|
|
231
|
+
vModel.parameters,
|
|
232
|
+
vModelTemplate,
|
|
233
|
+
vModel.args
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
export const Password = Template.bind({});
|
|
237
|
+
Password.args = {
|
|
238
|
+
label: 'Password input label',
|
|
239
|
+
type: 'password',
|
|
240
|
+
};
|
|
241
|
+
Password.parameters = storyParametersObject(
|
|
242
|
+
Password.parameters,
|
|
243
|
+
template,
|
|
244
|
+
Password.args
|
|
245
|
+
);
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="[
|
|
4
|
+
'cv-text-input',
|
|
5
|
+
`${carbonPrefix}--form-item`,
|
|
6
|
+
`${carbonPrefix}--text-input-wrapper`,
|
|
7
|
+
{ [`${carbonPrefix}--password-input-wrapper`]: isPassword },
|
|
8
|
+
]"
|
|
9
|
+
>
|
|
10
|
+
<label
|
|
11
|
+
:for="cvId"
|
|
12
|
+
:class="[
|
|
13
|
+
`${carbonPrefix}--label`,
|
|
14
|
+
{
|
|
15
|
+
[`${carbonPrefix}--label--disabled`]: $attrs.disabled,
|
|
16
|
+
[`${carbonPrefix}--visually-hidden`]: hideLabel,
|
|
17
|
+
},
|
|
18
|
+
]"
|
|
19
|
+
>
|
|
20
|
+
{{ label }}
|
|
21
|
+
</label>
|
|
22
|
+
<div
|
|
23
|
+
:class="[
|
|
24
|
+
`${carbonPrefix}--text-input__field-wrapper`,
|
|
25
|
+
{ [`${carbonPrefix}--text-input__field-wrapper--warning`]: isWarn },
|
|
26
|
+
]"
|
|
27
|
+
:data-invalid="isInvalid"
|
|
28
|
+
>
|
|
29
|
+
<WarningFilled16
|
|
30
|
+
v-if="isInvalid"
|
|
31
|
+
:class="`${carbonPrefix}--text-input__invalid-icon`"
|
|
32
|
+
/>
|
|
33
|
+
<WarningAltFilled16
|
|
34
|
+
v-if="isWarn"
|
|
35
|
+
:class="`${carbonPrefix}--text-input__invalid-icon ${carbonPrefix}--text-input__invalid-icon--warning`"
|
|
36
|
+
/>
|
|
37
|
+
<input
|
|
38
|
+
ref="input"
|
|
39
|
+
:id="cvId"
|
|
40
|
+
:class="[
|
|
41
|
+
`${carbonPrefix}--text-input`,
|
|
42
|
+
{
|
|
43
|
+
[`${carbonPrefix}--text-input--invalid`]: isInvalid,
|
|
44
|
+
[`${carbonPrefix}--text-input--light`]: isLight,
|
|
45
|
+
[`${carbonPrefix}--text-input--warning`]: isWarn,
|
|
46
|
+
[`${carbonPrefix}--password-input`]: isPassword,
|
|
47
|
+
},
|
|
48
|
+
]"
|
|
49
|
+
v-bind="$attrs"
|
|
50
|
+
:type="dataType"
|
|
51
|
+
:value="modelValue"
|
|
52
|
+
:data-toggle-password-visibility="isPassword"
|
|
53
|
+
@input="$event => $emit('update:modelValue', $event.target.value)"
|
|
54
|
+
/>
|
|
55
|
+
<button
|
|
56
|
+
v-if="isPassword"
|
|
57
|
+
:class="[
|
|
58
|
+
`${carbonPrefix}--btn`,
|
|
59
|
+
`${carbonPrefix}--btn--icon-only`,
|
|
60
|
+
`${carbonPrefix}--text-input--password__visibility__toggle`,
|
|
61
|
+
`${carbonPrefix}--tooltip__trigger`,
|
|
62
|
+
`${carbonPrefix}--tooltip--a11y`,
|
|
63
|
+
`${carbonPrefix}--tooltip--bottom`,
|
|
64
|
+
`${carbonPrefix}--tooltip--align-center`,
|
|
65
|
+
{ [`${carbonPrefix}--btn--disabled`]: $attrs.disabled },
|
|
66
|
+
]"
|
|
67
|
+
@click="togglePasswordVisibility"
|
|
68
|
+
type="button"
|
|
69
|
+
:disabled="$attrs.disabled"
|
|
70
|
+
>
|
|
71
|
+
<span :class="`${carbonPrefix}--assistive-text`">
|
|
72
|
+
{{ passwordHideShowLabel }}
|
|
73
|
+
</span>
|
|
74
|
+
<ViewOff16
|
|
75
|
+
v-if="isPasswordVisible"
|
|
76
|
+
:class="`${carbonPrefix}--icon-visibility-off`"
|
|
77
|
+
/>
|
|
78
|
+
<View16 v-else :class="`${carbonPrefix}--icon-visibility-on`" />
|
|
79
|
+
</button>
|
|
80
|
+
</div>
|
|
81
|
+
<div v-if="isInvalid" :class="`${carbonPrefix}--form-requirement`">
|
|
82
|
+
<slot name="invalid-message">{{ invalidMessage }}</slot>
|
|
83
|
+
</div>
|
|
84
|
+
<div v-if="isWarn" :class="`${carbonPrefix}--form__requirement`">
|
|
85
|
+
<slot name="warn-text">{{ warnText }}</slot>
|
|
86
|
+
</div>
|
|
87
|
+
<div
|
|
88
|
+
v-if="isHelper"
|
|
89
|
+
:class="[
|
|
90
|
+
`${carbonPrefix}--form__helper-text`,
|
|
91
|
+
{ [`${carbonPrefix}--form__helper-text--disabled`]: $attrs.disabled },
|
|
92
|
+
]"
|
|
93
|
+
>
|
|
94
|
+
<slot name="helper-text">{{ helperText }}</slot>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<script setup>
|
|
100
|
+
import {
|
|
101
|
+
onBeforeMount,
|
|
102
|
+
onBeforeUpdate,
|
|
103
|
+
ref,
|
|
104
|
+
useSlots,
|
|
105
|
+
computed,
|
|
106
|
+
watch,
|
|
107
|
+
nextTick,
|
|
108
|
+
} from 'vue';
|
|
109
|
+
import {
|
|
110
|
+
WarningFilled16,
|
|
111
|
+
WarningAltFilled16,
|
|
112
|
+
ViewOff16,
|
|
113
|
+
View16,
|
|
114
|
+
} from '@carbon/icons-vue';
|
|
115
|
+
import { carbonPrefix } from '../../global/settings';
|
|
116
|
+
import { useCvId, props as propsCvId } from '../../use/cvId';
|
|
117
|
+
import { useIsLight, props as propsTheme } from '../../use/cvTheme';
|
|
118
|
+
import { inputTypes } from './const';
|
|
119
|
+
|
|
120
|
+
const props = defineProps({
|
|
121
|
+
helperText: { type: String, default: undefined },
|
|
122
|
+
hideLabel: { type: Boolean, default: false },
|
|
123
|
+
invalidMessage: { type: String, default: undefined },
|
|
124
|
+
label: String,
|
|
125
|
+
modelValue: String,
|
|
126
|
+
passwordHideLabel: { type: String, default: 'Hide password' },
|
|
127
|
+
passwordShowLabel: { type: String, default: 'Show password' },
|
|
128
|
+
passwordVisible: { type: Boolean, default: undefined },
|
|
129
|
+
type: {
|
|
130
|
+
type: String,
|
|
131
|
+
default: 'text',
|
|
132
|
+
validator: value => inputTypes.has(value),
|
|
133
|
+
},
|
|
134
|
+
warnText: { type: String, default: undefined },
|
|
135
|
+
...propsCvId,
|
|
136
|
+
...propsTheme,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const cvId = useCvId(props);
|
|
140
|
+
|
|
141
|
+
// DOM Elements
|
|
142
|
+
const input = ref();
|
|
143
|
+
const slots = useSlots();
|
|
144
|
+
|
|
145
|
+
// Data
|
|
146
|
+
const isInvalid = ref(false);
|
|
147
|
+
const isWarn = ref(false);
|
|
148
|
+
const isHelper = ref(false);
|
|
149
|
+
const isLight = useIsLight(props);
|
|
150
|
+
const dataType = ref(props.type);
|
|
151
|
+
const dataPasswordVisible = ref(false);
|
|
152
|
+
|
|
153
|
+
// Computed Values
|
|
154
|
+
const isPassword = computed(() => props.type === 'password');
|
|
155
|
+
const isPasswordVisible = computed(
|
|
156
|
+
() => isPassword.value && dataPasswordVisible.value
|
|
157
|
+
);
|
|
158
|
+
const passwordHideShowLabel = computed(() =>
|
|
159
|
+
isPasswordVisible.value ? props.passwordHideLabel : props.passwordShowLabel
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
// Watchers
|
|
163
|
+
watch(
|
|
164
|
+
() => props.passwordVisible,
|
|
165
|
+
newValue => {
|
|
166
|
+
if (newValue !== dataPasswordVisible.value) {
|
|
167
|
+
togglePasswordVisibility();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
watch(
|
|
172
|
+
() => props.type,
|
|
173
|
+
newValue => {
|
|
174
|
+
dataType.value = newValue;
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
// Methods
|
|
179
|
+
function togglePasswordVisibility() {
|
|
180
|
+
const currentValue = input.value.value;
|
|
181
|
+
dataPasswordVisible.value = !dataPasswordVisible.value;
|
|
182
|
+
dataType.value = dataPasswordVisible.value ? 'text' : 'password';
|
|
183
|
+
nextTick(() => {
|
|
184
|
+
input.value.value = currentValue;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function checkSlots() {
|
|
189
|
+
// NOTE: slots is not reactive so needs to be managed on updated
|
|
190
|
+
isInvalid.value = !!(
|
|
191
|
+
props.invalidMessage?.length || slots['invalid-message']
|
|
192
|
+
);
|
|
193
|
+
isWarn.value =
|
|
194
|
+
!isInvalid.value && !!(props.warnText?.length || slots['warn-text']);
|
|
195
|
+
isHelper.value =
|
|
196
|
+
!isInvalid.value &&
|
|
197
|
+
!isWarn.value &&
|
|
198
|
+
!!(props.helperText?.length || slots['helper-text']);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Lifecycle Hooks
|
|
202
|
+
onBeforeMount(() => {
|
|
203
|
+
checkSlots();
|
|
204
|
+
// update initial state for dataPasswordVisible & dataType
|
|
205
|
+
if (isPassword.value && props.passwordVisible) {
|
|
206
|
+
dataPasswordVisible.value = true;
|
|
207
|
+
dataType.value = 'text';
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
onBeforeUpdate(checkSlots);
|
|
211
|
+
</script>
|
|
212
|
+
|
|
213
|
+
<script>
|
|
214
|
+
export default {
|
|
215
|
+
inheritAttrs: false,
|
|
216
|
+
};
|
|
217
|
+
</script>
|