dxd-style-code 0.1.7 → 0.1.8
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/dist/dxd-style-code.js +11974 -3725
- package/dist/dxd-style-code.umd.cjs +10 -1
- package/dist/style.css +1 -1
- package/package.json +13 -6
- package/src/components/atoms/DXAvatar/DXAvatar.stories.js +319 -0
- package/src/components/atoms/DXAvatar/DXAvatar.vue +167 -0
- package/src/components/atoms/DXAvatar/index.js +2 -0
- package/src/components/atoms/DXBackdrop/DXBackdrop.stories.js +341 -0
- package/src/components/atoms/DXBackdrop/DXBackdrop.vue +102 -0
- package/src/components/atoms/DXBackdrop/index.js +2 -0
- package/src/components/atoms/DXBadge/DXBadge.stories.js +239 -0
- package/src/components/atoms/DXBadge/DXBadge.vue +45 -0
- package/src/components/atoms/DXBadge/index.js +2 -0
- package/src/components/atoms/DXButton/DXButton.stories.js +178 -0
- package/src/components/atoms/DXButton/DXButton.vue +84 -0
- package/src/components/atoms/DXButton/index.js +2 -0
- package/src/components/atoms/DXCard/DXCard.stories.js +133 -0
- package/src/components/atoms/DXCard/DXCard.vue +46 -0
- package/src/components/atoms/DXCard/index.js +2 -0
- package/src/components/atoms/DXCheckbox/DXCheckbox.stories.js +294 -0
- package/src/components/atoms/DXCheckbox/DXCheckbox.vue +191 -0
- package/src/components/atoms/DXCheckbox/index.js +2 -0
- package/src/components/atoms/DXDivider/DXDivider.stories.js +135 -0
- package/src/components/atoms/DXDivider/DXDivider.vue +74 -0
- package/src/components/atoms/DXDivider/index.js +2 -0
- package/src/components/atoms/DXDropdownItem/DXDropdownItem.vue +116 -0
- package/src/components/atoms/DXDropdownItem/index.js +2 -0
- package/src/components/atoms/DXFormLabel/DXFormLabel.stories.js +194 -0
- package/src/components/atoms/DXFormLabel/DXFormLabel.vue +94 -0
- package/src/components/atoms/DXFormLabel/index.js +2 -0
- package/src/components/atoms/DXIcon/DXIcon.stories.js +156 -0
- package/src/components/atoms/DXIcon/DXIcon.vue +102 -0
- package/src/components/atoms/DXIcon/index.js +3 -0
- package/src/components/atoms/DXIconWrapper/DXIconWrapper.stories.js +237 -0
- package/src/components/atoms/DXIconWrapper/DXIconWrapper.vue +79 -0
- package/src/components/atoms/DXIconWrapper/index.js +2 -0
- package/src/components/atoms/DXInputAddon/DXInputAddon.stories.js +230 -0
- package/src/components/atoms/DXInputAddon/DXInputAddon.vue +64 -0
- package/src/components/atoms/DXInputAddon/index.js +2 -0
- package/src/components/atoms/DXLink/DXLink.stories.js +475 -0
- package/src/components/atoms/DXLink/DXLink.vue +229 -0
- package/src/components/atoms/DXLink/index.js +2 -0
- package/src/components/atoms/DXLoader/DXLoader.stories.js +280 -0
- package/src/components/atoms/DXLoader/DXLoader.vue +78 -0
- package/src/components/atoms/DXLoader/index.js +2 -0
- package/src/components/atoms/DXProgress/DXProgress.stories.js +312 -0
- package/src/components/atoms/DXProgress/DXProgress.vue +85 -0
- package/src/components/atoms/DXProgress/index.js +2 -0
- package/src/components/atoms/DXQuote/DXQuote.stories.js +255 -0
- package/src/components/atoms/DXQuote/DXQuote.vue +97 -0
- package/src/components/atoms/DXQuote/index.js +2 -0
- package/src/components/atoms/DXRadio/DXRadio.stories.js +277 -0
- package/src/components/atoms/DXRadio/DXRadio.vue +144 -0
- package/src/components/atoms/DXRadio/index.js +2 -0
- package/src/components/atoms/DXSkeleton/DXSkeleton.stories.js +50 -0
- package/src/components/atoms/DXSkeleton/DXSkeleton.vue +19 -0
- package/src/components/atoms/DXSkeleton/index.js +2 -0
- package/src/components/atoms/DXSlider/DXSlider.stories.js +522 -0
- package/src/components/atoms/DXSlider/DXSlider.vue +338 -0
- package/src/components/atoms/DXSlider/index.js +2 -0
- package/src/components/atoms/DXTags/DXTags.stories.js +206 -0
- package/src/components/atoms/DXTags/DXTags.vue +111 -0
- package/src/components/atoms/DXTags/index.js +2 -0
- package/src/components/atoms/DXToast/DXToast.stories.js +40 -0
- package/src/components/atoms/DXToast/DXToast.vue +32 -0
- package/src/components/atoms/DXToast/index.js +2 -0
- package/src/components/atoms/DXToggle/DXToggle.stories.js +143 -0
- package/src/components/atoms/DXToggle/DXToggle.vue +142 -0
- package/src/components/atoms/DXToggle/index.js +2 -0
- package/src/components/atoms/DXToggleButton/DXToggleButton.stories.js +513 -0
- package/src/components/atoms/DXToggleButton/DXToggleButton.vue +140 -0
- package/src/components/atoms/DXToggleButton/index.js +2 -0
- package/src/components/atoms/DXTooltip/DXTooltip.stories.js +243 -0
- package/src/components/atoms/DXTooltip/DXTooltip.vue +151 -0
- package/src/components/atoms/DXTooltip/index.js +2 -0
- package/src/components/atoms/index.js +24 -0
- package/src/components/layout/DXBox/DXBox.stories.js +238 -0
- package/src/components/layout/DXBox/DXBox.vue +198 -0
- package/src/components/layout/DXBox/index.js +2 -0
- package/src/components/layout/DXContainer/DXContainer.stories.js +147 -0
- package/src/components/layout/DXContainer/DXContainer.vue +83 -0
- package/src/components/layout/DXContainer/index.js +2 -0
- package/src/components/layout/DXFlex/DXFlex.stories.js +210 -0
- package/src/components/layout/DXFlex/DXFlex.vue +149 -0
- package/src/components/layout/DXFlex/index.js +2 -0
- package/src/components/layout/DXGrid/DXGrid.stories.js +238 -0
- package/src/components/layout/DXGrid/DXGrid.vue +167 -0
- package/src/components/layout/DXGrid/index.js +2 -0
- package/src/components/layout/DXSpacer/DXSpacer.stories.js +187 -0
- package/src/components/layout/DXSpacer/DXSpacer.vue +102 -0
- package/src/components/layout/DXSpacer/index.js +2 -0
- package/src/components/layout/DXStack/DXStack.stories.js +199 -0
- package/src/components/layout/DXStack/DXStack.vue +140 -0
- package/src/components/layout/DXStack/index.js +2 -0
- package/src/components/layout/index.js +8 -0
- package/src/components/molecules/DXActionButtons/DXActionButtons.stories.js +288 -0
- package/src/components/molecules/DXActionButtons/DXActionButtons.vue +106 -0
- package/src/components/molecules/DXActionButtons/index.js +2 -0
- package/src/components/molecules/DXAlert/DXAlert.stories.js +70 -0
- package/src/components/molecules/DXAlert/DXAlert.vue +116 -0
- package/src/components/molecules/DXAlert/index.js +2 -0
- package/src/components/molecules/DXBaseTable/DXBaseTable.stories.js +433 -0
- package/src/components/molecules/DXBaseTable/DXBaseTable.vue +459 -0
- package/src/components/molecules/DXBaseTable/index.js +4 -0
- package/src/components/molecules/DXBreadcrumb/DXBreadcrumb.stories.js +227 -0
- package/src/components/molecules/DXBreadcrumb/DXBreadcrumb.vue +96 -0
- package/src/components/molecules/DXBreadcrumb/index.js +2 -0
- package/src/components/molecules/DXButtonGroup/DXButtonGroup.stories.js +26 -0
- package/src/components/molecules/DXButtonGroup/DXButtonGroup.vue +78 -0
- package/src/components/molecules/DXButtonGroup/index.js +2 -0
- package/src/components/molecules/DXCloseButton/DXCloseButton.stories.js +53 -0
- package/src/components/molecules/DXCloseButton/DXCloseButton.vue +62 -0
- package/src/components/molecules/DXCloseButton/index.js +3 -0
- package/src/components/molecules/DXComboBox/DXComboBox.stories.js +62 -0
- package/src/components/molecules/DXComboBox/DXComboBox.vue +167 -0
- package/src/components/molecules/DXComboBox/index.js +2 -0
- package/src/components/molecules/DXCopyField/DXCopyField.stories.js +231 -0
- package/src/components/molecules/DXCopyField/DXCopyField.vue +75 -0
- package/src/components/molecules/DXCopyField/index.js +2 -0
- package/src/components/molecules/DXDataFilter/DXDataFilter.stories.js +275 -0
- package/src/components/molecules/DXDataFilter/DXDataFilter.vue +385 -0
- package/src/components/molecules/DXDataFilter/index.js +2 -0
- package/src/components/molecules/DXDatePicker/DXDatePicker.stories.js +42 -0
- package/src/components/molecules/DXDatePicker/DXDatePicker.vue +121 -0
- package/src/components/molecules/DXDatePicker/index.js +2 -0
- package/src/components/molecules/DXDropdownDivider/DXDropdownDivider.vue +30 -0
- package/src/components/molecules/DXDropdownDivider/index.js +2 -0
- package/src/components/molecules/DXFileUpload/DXFileUpload.stories.js +53 -0
- package/src/components/molecules/DXFileUpload/DXFileUpload.vue +199 -0
- package/src/components/molecules/DXFileUpload/index.js +2 -0
- package/src/components/molecules/DXFilterGroup/DXFilterGroup.stories.js +43 -0
- package/src/components/molecules/DXFilterGroup/DXFilterGroup.vue +43 -0
- package/src/components/molecules/DXFilterGroup/index.js +2 -0
- package/src/components/molecules/DXFormControl/DXFormControl.stories.js +69 -0
- package/src/components/molecules/DXFormControl/DXFormControl.vue +72 -0
- package/src/components/molecules/DXFormControl/index.js +2 -0
- package/src/components/molecules/DXInput/DXInput.stories.js +291 -0
- package/src/components/molecules/DXInput/DXInput.vue +156 -0
- package/src/components/molecules/DXInput/index.js +3 -0
- package/src/components/molecules/DXInputGroup/DXInputGroup.stories.js +228 -0
- package/src/components/molecules/DXInputGroup/DXInputGroup.vue +64 -0
- package/src/components/molecules/DXInputGroup/index.js +2 -0
- package/src/components/molecules/DXInputMask/DXInputMask.stories.js +53 -0
- package/src/components/molecules/DXInputMask/DXInputMask.vue +89 -0
- package/src/components/molecules/DXInputMask/index.js +2 -0
- package/src/components/molecules/DXMenu/DXMenu.stories.js +379 -0
- package/src/components/molecules/DXMenu/DXMenu.vue +331 -0
- package/src/components/molecules/DXMenu/README.md +479 -0
- package/src/components/molecules/DXMenu/index.js +2 -0
- package/src/components/molecules/DXPagination/DXPagination.stories.js +62 -0
- package/src/components/molecules/DXPagination/DXPagination.vue +123 -0
- package/src/components/molecules/DXPagination/index.js +2 -0
- package/src/components/molecules/DXPasswordInput/DXPasswordInput.stories.js +42 -0
- package/src/components/molecules/DXPasswordInput/DXPasswordInput.vue +74 -0
- package/src/components/molecules/DXPasswordInput/index.js +2 -0
- package/src/components/molecules/DXRadioCard/DXRadioCard.stories.js +60 -0
- package/src/components/molecules/DXRadioCard/DXRadioCard.vue +71 -0
- package/src/components/molecules/DXRadioCard/index.js +2 -0
- package/src/components/molecules/DXRadioGroup/DXRadioGroup.stories.js +297 -0
- package/src/components/molecules/DXRadioGroup/DXRadioGroup.vue +73 -0
- package/src/components/molecules/DXRadioGroup/index.js +2 -0
- package/src/components/molecules/DXRating/DXRating.stories.js +322 -0
- package/src/components/molecules/DXRating/DXRating.vue +402 -0
- package/src/components/molecules/DXRating/index.js +2 -0
- package/src/components/molecules/DXSearchBar/DXSearchBar.stories.js +357 -0
- package/src/components/molecules/DXSearchBar/DXSearchBar.vue +525 -0
- package/src/components/molecules/DXSearchBar/index.js +2 -0
- package/src/components/molecules/DXSearchSelect/DXSearchSelect.stories.js +50 -0
- package/src/components/molecules/DXSearchSelect/DXSearchSelect.vue +207 -0
- package/src/components/molecules/DXSearchSelect/index.js +2 -0
- package/src/components/molecules/DXSegmentedControl/DXSegmentedControl.stories.js +326 -0
- package/src/components/molecules/DXSegmentedControl/DXSegmentedControl.vue +116 -0
- package/src/components/molecules/DXSegmentedControl/index.js +2 -0
- package/src/components/molecules/DXSelect/DXSelect.stories.js +259 -0
- package/src/components/molecules/DXSelect/DXSelect.vue +149 -0
- package/src/components/molecules/DXSelect/index.js +3 -0
- package/src/components/molecules/DXStatCard/DXStatCard.stories.js +335 -0
- package/src/components/molecules/DXStatCard/DXStatCard.vue +309 -0
- package/src/components/molecules/DXStatCard/index.js +2 -0
- package/src/components/molecules/DXTableFiltersPanel/DXTableFiltersPanel.vue +72 -0
- package/src/components/molecules/DXTableFiltersPanel/index.js +7 -0
- package/src/components/molecules/DXTablePagination/DXTablePagination.stories.js +236 -0
- package/src/components/molecules/DXTablePagination/DXTablePagination.vue +93 -0
- package/src/components/molecules/DXTablePagination/index.js +2 -0
- package/src/components/molecules/DXTableToolbar/DXTableToolbar.stories.js +271 -0
- package/src/components/molecules/DXTableToolbar/DXTableToolbar.vue +102 -0
- package/src/components/molecules/DXTableToolbar/index.js +2 -0
- package/src/components/molecules/DXTextarea/DXTextarea.stories.js +239 -0
- package/src/components/molecules/DXTextarea/DXTextarea.vue +158 -0
- package/src/components/molecules/DXTextarea/index.js +3 -0
- package/src/components/molecules/DXTimePicker/DXTimePicker.stories.js +282 -0
- package/src/components/molecules/DXTimePicker/DXTimePicker.vue +640 -0
- package/src/components/molecules/DXTimePicker/index.js +2 -0
- package/src/components/molecules/DXValidationIcon/DXValidationIcon.stories.js +60 -0
- package/src/components/molecules/DXValidationIcon/DXValidationIcon.vue +53 -0
- package/src/components/molecules/DXValidationIcon/index.js +3 -0
- package/src/components/molecules/index.js +34 -0
- package/src/components/organisms/DXAccordion/DXAccordion.stories.js +33 -0
- package/src/components/organisms/DXAccordion/DXAccordion.vue +104 -0
- package/src/components/organisms/DXAccordion/index.js +2 -0
- package/src/components/organisms/DXAppLayout/DXAppLayout.stories.js +689 -0
- package/src/components/organisms/DXAppLayout/DXAppLayout.vue +460 -0
- package/src/components/organisms/DXAppLayout/index.js +2 -0
- package/src/components/organisms/DXAuthenticationForm/DXAuthenticationForm.stories.js +232 -0
- package/src/components/organisms/DXAuthenticationForm/DXAuthenticationForm.vue +458 -0
- package/src/components/organisms/DXAuthenticationForm/index.js +2 -0
- package/src/components/organisms/DXChartContainer/DXChartContainer.stories.js +286 -0
- package/src/components/organisms/DXChartContainer/DXChartContainer.vue +273 -0
- package/src/components/organisms/DXChartContainer/index.js +2 -0
- package/src/components/organisms/DXChatInterface/DXChatInterface.stories.js +164 -0
- package/src/components/organisms/DXChatInterface/DXChatInterface.vue +583 -0
- package/src/components/organisms/DXChatInterface/index.js +2 -0
- package/src/components/organisms/DXCommentSection/DXCommentSection.stories.js +173 -0
- package/src/components/organisms/DXCommentSection/DXCommentSection.vue +487 -0
- package/src/components/organisms/DXCommentSection/index.js +2 -0
- package/src/components/organisms/DXDashboardGrid/DXDashboardGrid.stories.js +331 -0
- package/src/components/organisms/DXDashboardGrid/DXDashboardGrid.vue +309 -0
- package/src/components/organisms/DXDashboardGrid/index.js +2 -0
- package/src/components/organisms/DXDashboardWidget/DXDashboardWidget.stories.js +271 -0
- package/src/components/organisms/DXDashboardWidget/DXDashboardWidget.vue +260 -0
- package/src/components/organisms/DXDashboardWidget/index.js +2 -0
- package/src/components/organisms/DXDataTable/DXDataTable.stories.js +247 -0
- package/src/components/organisms/DXDataTable/DXDataTable.vue +496 -0
- package/src/components/organisms/DXDataTable/index.js +2 -0
- package/src/components/organisms/DXDropdown/DXDropdown.stories.js +795 -0
- package/src/components/organisms/DXDropdown/DXDropdown.vue +238 -0
- package/src/components/organisms/DXDropdown/index.js +2 -0
- package/src/components/organisms/DXEmptyState/DXEmptyState.stories.js +37 -0
- package/src/components/organisms/DXEmptyState/DXEmptyState.vue +41 -0
- package/src/components/organisms/DXEmptyState/index.js +2 -0
- package/src/components/organisms/DXFormWizard/DXFormWizard.stories.js +378 -0
- package/src/components/organisms/DXFormWizard/DXFormWizard.vue +578 -0
- package/src/components/organisms/DXFormWizard/index.js +2 -0
- package/src/components/organisms/DXHeaderBar/DXHeaderBar.stories.js +448 -0
- package/src/components/organisms/DXHeaderBar/DXHeaderBar.vue +190 -0
- package/src/components/organisms/DXHeaderBar/index.js +2 -0
- package/src/components/organisms/DXMediaGallery/DXMediaGallery.stories.js +347 -0
- package/src/components/organisms/DXMediaGallery/DXMediaGallery.vue +422 -0
- package/src/components/organisms/DXMediaGallery/index.js +2 -0
- package/src/components/organisms/DXModal/DXModal.stories.js +138 -0
- package/src/components/organisms/DXModal/DXModal.vue +213 -0
- package/src/components/organisms/DXModal/index.js +2 -0
- package/src/components/organisms/DXNotificationCenter/DXNotificationCenter.stories.js +183 -0
- package/src/components/organisms/DXNotificationCenter/DXNotificationCenter.vue +566 -0
- package/src/components/organisms/DXNotificationCenter/index.js +2 -0
- package/src/components/organisms/DXReportGenerator/DXReportGenerator.stories.js +199 -0
- package/src/components/organisms/DXReportGenerator/DXReportGenerator.vue +344 -0
- package/src/components/organisms/DXReportGenerator/index.js +2 -0
- package/src/components/organisms/DXSettingsPanel/DXSettingsPanel.stories.js +245 -0
- package/src/components/organisms/DXSettingsPanel/DXSettingsPanel.vue +454 -0
- package/src/components/organisms/DXSettingsPanel/index.js +2 -0
- package/src/components/organisms/DXSidebar/DXSidebar.stories.js +316 -0
- package/src/components/organisms/DXSidebar/DXSidebar.vue +212 -0
- package/src/components/organisms/DXSidebar/index.js +2 -0
- package/src/components/organisms/DXSidebarMenu/DATA_STRUCTURE.md +299 -0
- package/src/components/organisms/DXSidebarMenu/DXSidebarMenu.stories.js +729 -0
- package/src/components/organisms/DXSidebarMenu/DXSidebarMenu.vue +257 -0
- package/src/components/organisms/DXSidebarMenu/DXSidebarMenuItem.vue +249 -0
- package/src/components/organisms/DXSidebarMenu/README.md +333 -0
- package/src/components/organisms/DXSidebarMenu/index.js +3 -0
- package/src/components/organisms/DXTable/DXTable.stories.js +550 -0
- package/src/components/organisms/DXTable/DXTable.vue +324 -0
- package/src/components/organisms/DXTable/index.js +2 -0
- package/src/components/organisms/DXTabs/DXTabs.stories.js +407 -0
- package/src/components/organisms/DXTabs/DXTabs.vue +301 -0
- package/src/components/organisms/DXTabs/index.js +2 -0
- package/src/components/organisms/DXUserProfileCard/DXUserProfileCard.stories.js +194 -0
- package/src/components/organisms/DXUserProfileCard/DXUserProfileCard.vue +403 -0
- package/src/components/organisms/DXUserProfileCard/index.js +2 -0
- package/src/components/organisms/DXWizard/DXWizard.stories.js +212 -0
- package/src/components/organisms/DXWizard/DXWizard.vue +615 -0
- package/src/components/organisms/DXWizard/index.js +2 -0
- package/src/components/organisms/index.js +25 -0
- package/src/components/typography/DXBlockquote/DXBlockquote.stories.js +33 -0
- package/src/components/typography/DXBlockquote/DXBlockquote.vue +44 -0
- package/src/components/typography/DXBlockquote/index.js +2 -0
- package/src/components/typography/DXCode/DXCode.stories.js +29 -0
- package/src/components/typography/DXCode/DXCode.vue +46 -0
- package/src/components/typography/DXCode/index.js +2 -0
- package/src/components/typography/DXHeading/DXHeading.stories.js +54 -0
- package/src/components/typography/DXHeading/DXHeading.vue +68 -0
- package/src/components/typography/DXHeading/index.js +2 -0
- package/src/components/typography/DXLabel/DXLabel.stories.js +40 -0
- package/src/components/typography/DXLabel/DXLabel.vue +49 -0
- package/src/components/typography/DXLabel/index.js +2 -0
- package/src/components/typography/DXList/DXList.stories.js +50 -0
- package/src/components/typography/DXList/DXList.vue +55 -0
- package/src/components/typography/DXList/index.js +2 -0
- package/src/components/typography/DXText/DXText.stories.js +47 -0
- package/src/components/typography/DXText/DXText.vue +67 -0
- package/src/components/typography/DXText/index.js +2 -0
- package/src/components/typography/index.js +8 -0
- package/src/components/utilities/DXAnimatePresence/DXAnimatePresence.stories.js +335 -0
- package/src/components/utilities/DXAnimatePresence/DXAnimatePresence.vue +207 -0
- package/src/components/utilities/DXAnimatePresence/index.js +2 -0
- package/src/components/utilities/DXBreakpointProvider/DXBreakpointProvider.stories.js +321 -0
- package/src/components/utilities/DXBreakpointProvider/DXBreakpointProvider.vue +158 -0
- package/src/components/utilities/DXBreakpointProvider/index.js +2 -0
- package/src/components/utilities/DXObserver/DXObserver.stories.js +324 -0
- package/src/components/utilities/DXObserver/DXObserver.vue +182 -0
- package/src/components/utilities/DXObserver/index.js +2 -0
- package/src/components/utilities/DXPortal/DXPortal.stories.js +267 -0
- package/src/components/utilities/DXPortal/DXPortal.vue +69 -0
- package/src/components/utilities/DXPortal/index.js +2 -0
- package/src/components/utilities/DXStaggeredAnimation/DXStaggeredAnimation.stories.js +339 -0
- package/src/components/utilities/DXStaggeredAnimation/DXStaggeredAnimation.vue +155 -0
- package/src/components/utilities/DXStaggeredAnimation/index.js +2 -0
- package/src/components/utilities/DXThemeProvider/DXThemeProvider.stories.js +327 -0
- package/src/components/utilities/DXThemeProvider/DXThemeProvider.vue +227 -0
- package/src/components/utilities/DXThemeProvider/index.js +2 -0
- package/src/components/utilities/DXTransitionGroup/DXTransitionGroup.stories.js +368 -0
- package/src/components/utilities/DXTransitionGroup/DXTransitionGroup.vue +212 -0
- package/src/components/utilities/DXTransitionGroup/index.js +2 -0
- package/src/components/utilities/index.js +9 -0
- package/src/composables/useAnimation.js +264 -0
- package/src/composables/useClassComposition.js +35 -0
- package/src/composables/useDataAttributes.js +83 -0
- package/src/composables/useMenu.js +88 -0
- package/src/composables/useSize.js +135 -0
- package/src/composables/useSpacing.js +37 -0
- package/src/composables/useTableColumns.js +88 -0
- package/src/composables/useTableData.js +82 -0
- package/src/composables/useTableFilter.js +158 -0
- package/src/composables/useTablePagination.js +89 -0
- package/src/composables/useTableSelection.js +77 -0
- package/src/composables/useTableSort.js +75 -0
- package/src/composables/useTabsScroll.js +88 -0
- package/src/composables/useVariant.js +700 -0
- package/src/index.js +86 -0
- package/src/styles/animations.css +171 -0
- package/src/styles/index.css +99 -0
- package/src/styles/tokens.js +123 -0
- package/src/utils/propTypes.js +77 -0
- package/src/utils/toggleButtonPresets.js +115 -0
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
import DXToggleButton from "./DXToggleButton.vue";
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
HeartIcon as HeartOutline,
|
|
5
|
+
BookmarkIcon as BookmarkOutline,
|
|
6
|
+
StarIcon as StarOutline,
|
|
7
|
+
BellIcon as BellOutline,
|
|
8
|
+
EyeIcon as EyeOutline,
|
|
9
|
+
LockOpenIcon,
|
|
10
|
+
SunIcon,
|
|
11
|
+
SpeakerWaveIcon,
|
|
12
|
+
PlayIcon,
|
|
13
|
+
LightBulbIcon,
|
|
14
|
+
} from "@heroicons/vue/24/outline";
|
|
15
|
+
import {
|
|
16
|
+
HeartIcon as HeartSolid,
|
|
17
|
+
BookmarkIcon as BookmarkSolid,
|
|
18
|
+
StarIcon as StarSolid,
|
|
19
|
+
BellIcon as BellSolid,
|
|
20
|
+
EyeSlashIcon,
|
|
21
|
+
LockClosedIcon,
|
|
22
|
+
MoonIcon,
|
|
23
|
+
SpeakerXMarkIcon,
|
|
24
|
+
PauseIcon,
|
|
25
|
+
} from "@heroicons/vue/24/solid";
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
title: "Atoms/DXToggleButton",
|
|
29
|
+
component: DXToggleButton,
|
|
30
|
+
tags: ["autodocs"],
|
|
31
|
+
argTypes: {
|
|
32
|
+
size: {
|
|
33
|
+
control: "select",
|
|
34
|
+
options: ["sm", "md", "lg"],
|
|
35
|
+
},
|
|
36
|
+
iconAnimation: {
|
|
37
|
+
control: "select",
|
|
38
|
+
options: ["none", "wiggle", "scale", "rotate"],
|
|
39
|
+
},
|
|
40
|
+
activeVariant: {
|
|
41
|
+
control: "select",
|
|
42
|
+
options: ["primary", "ghost", "danger", "success", "warning", "outline"],
|
|
43
|
+
},
|
|
44
|
+
inactiveVariant: {
|
|
45
|
+
control: "select",
|
|
46
|
+
options: ["primary", "ghost", "danger", "success", "warning", "outline"],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Избранное (Like)
|
|
52
|
+
export const Favorite = {
|
|
53
|
+
render: () => ({
|
|
54
|
+
components: { DXToggleButton },
|
|
55
|
+
setup() {
|
|
56
|
+
const isFavorite = ref(false);
|
|
57
|
+
return { isFavorite, HeartOutline, HeartSolid };
|
|
58
|
+
},
|
|
59
|
+
template: `
|
|
60
|
+
<div class="space-y-4">
|
|
61
|
+
<DXToggleButton
|
|
62
|
+
v-model="isFavorite"
|
|
63
|
+
:active-icon="HeartSolid"
|
|
64
|
+
:inactive-icon="HeartOutline"
|
|
65
|
+
active-variant="danger"
|
|
66
|
+
inactive-variant="ghost"
|
|
67
|
+
/>
|
|
68
|
+
<p class="text-sm text-slate-600">
|
|
69
|
+
Status: {{ isFavorite ? '❤️ Liked' : '🤍 Not liked' }}
|
|
70
|
+
</p>
|
|
71
|
+
</div>
|
|
72
|
+
`,
|
|
73
|
+
}),
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Закладка (Bookmark)
|
|
77
|
+
export const Bookmark = {
|
|
78
|
+
render: () => ({
|
|
79
|
+
components: { DXToggleButton },
|
|
80
|
+
setup() {
|
|
81
|
+
const isBookmarked = ref(false);
|
|
82
|
+
return { isBookmarked, BookmarkOutline, BookmarkSolid };
|
|
83
|
+
},
|
|
84
|
+
template: `
|
|
85
|
+
<DXToggleButton
|
|
86
|
+
v-model="isBookmarked"
|
|
87
|
+
:active-icon="BookmarkSolid"
|
|
88
|
+
:inactive-icon="BookmarkOutline"
|
|
89
|
+
active-variant="warning"
|
|
90
|
+
inactive-variant="ghost"
|
|
91
|
+
/>
|
|
92
|
+
`,
|
|
93
|
+
}),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Звезда (Star/Rating)
|
|
97
|
+
export const Star = {
|
|
98
|
+
render: () => ({
|
|
99
|
+
components: { DXToggleButton },
|
|
100
|
+
setup() {
|
|
101
|
+
const isStarred = ref(true);
|
|
102
|
+
return { isStarred, StarOutline, StarSolid };
|
|
103
|
+
},
|
|
104
|
+
template: `
|
|
105
|
+
<DXToggleButton
|
|
106
|
+
v-model="isStarred"
|
|
107
|
+
:active-icon="StarSolid"
|
|
108
|
+
:inactive-icon="StarOutline"
|
|
109
|
+
active-variant="warning"
|
|
110
|
+
inactive-variant="ghost"
|
|
111
|
+
icon-animation="scale"
|
|
112
|
+
/>
|
|
113
|
+
`,
|
|
114
|
+
}),
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// Уведомления (Notifications)
|
|
118
|
+
export const Notifications = {
|
|
119
|
+
render: () => ({
|
|
120
|
+
components: { DXToggleButton },
|
|
121
|
+
setup() {
|
|
122
|
+
const notificationsEnabled = ref(true);
|
|
123
|
+
return { notificationsEnabled, BellOutline, BellSolid };
|
|
124
|
+
},
|
|
125
|
+
template: `
|
|
126
|
+
<DXToggleButton
|
|
127
|
+
v-model="notificationsEnabled"
|
|
128
|
+
:active-icon="BellSolid"
|
|
129
|
+
:inactive-icon="BellOutline"
|
|
130
|
+
active-variant="primary"
|
|
131
|
+
inactive-variant="ghost"
|
|
132
|
+
/>
|
|
133
|
+
`,
|
|
134
|
+
}),
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Видимость (Show/Hide)
|
|
138
|
+
export const Visibility = {
|
|
139
|
+
render: () => ({
|
|
140
|
+
components: { DXToggleButton },
|
|
141
|
+
setup() {
|
|
142
|
+
const isVisible = ref(true);
|
|
143
|
+
return { isVisible, EyeOutline, EyeSlashIcon };
|
|
144
|
+
},
|
|
145
|
+
template: `
|
|
146
|
+
<div class="space-y-4">
|
|
147
|
+
<DXToggleButton
|
|
148
|
+
v-model="isVisible"
|
|
149
|
+
:active-icon="EyeOutline"
|
|
150
|
+
:inactive-icon="EyeSlashIcon"
|
|
151
|
+
active-label="Visible"
|
|
152
|
+
inactive-label="Hidden"
|
|
153
|
+
active-variant="success"
|
|
154
|
+
inactive-variant="ghost"
|
|
155
|
+
size="lg"
|
|
156
|
+
/>
|
|
157
|
+
<p class="text-sm text-slate-600">
|
|
158
|
+
Content is {{ isVisible ? 'visible 👁️' : 'hidden 🙈' }}
|
|
159
|
+
</p>
|
|
160
|
+
</div>
|
|
161
|
+
`,
|
|
162
|
+
}),
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Блокировка (Lock/Unlock)
|
|
166
|
+
export const Lock = {
|
|
167
|
+
render: () => ({
|
|
168
|
+
components: { DXToggleButton },
|
|
169
|
+
setup() {
|
|
170
|
+
const isLocked = ref(false);
|
|
171
|
+
return { isLocked, LockOpenIcon, LockClosedIcon };
|
|
172
|
+
},
|
|
173
|
+
template: `
|
|
174
|
+
<DXToggleButton
|
|
175
|
+
v-model="isLocked"
|
|
176
|
+
:active-icon="LockClosedIcon"
|
|
177
|
+
:inactive-icon="LockOpenIcon"
|
|
178
|
+
active-label="Locked"
|
|
179
|
+
inactive-label="Unlocked"
|
|
180
|
+
active-variant="danger"
|
|
181
|
+
inactive-variant="success"
|
|
182
|
+
/>
|
|
183
|
+
`,
|
|
184
|
+
}),
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// Тема (Light/Dark)
|
|
188
|
+
export const Theme = {
|
|
189
|
+
render: () => ({
|
|
190
|
+
components: { DXToggleButton },
|
|
191
|
+
setup() {
|
|
192
|
+
const isDark = ref(false);
|
|
193
|
+
return { isDark, SunIcon, MoonIcon };
|
|
194
|
+
},
|
|
195
|
+
template: `
|
|
196
|
+
<DXToggleButton
|
|
197
|
+
v-model="isDark"
|
|
198
|
+
:active-icon="MoonIcon"
|
|
199
|
+
:inactive-icon="SunIcon"
|
|
200
|
+
active-label="Dark"
|
|
201
|
+
inactive-label="Light"
|
|
202
|
+
active-variant="primary"
|
|
203
|
+
inactive-variant="warning"
|
|
204
|
+
icon-animation="rotate"
|
|
205
|
+
/>
|
|
206
|
+
`,
|
|
207
|
+
}),
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// Звук (Mute/Unmute)
|
|
211
|
+
export const Sound = {
|
|
212
|
+
render: () => ({
|
|
213
|
+
components: { DXToggleButton },
|
|
214
|
+
setup() {
|
|
215
|
+
const isMuted = ref(false);
|
|
216
|
+
return { isMuted, SpeakerWaveIcon, SpeakerXMarkIcon };
|
|
217
|
+
},
|
|
218
|
+
template: `
|
|
219
|
+
<DXToggleButton
|
|
220
|
+
v-model="isMuted"
|
|
221
|
+
:active-icon="SpeakerXMarkIcon"
|
|
222
|
+
:inactive-icon="SpeakerWaveIcon"
|
|
223
|
+
active-variant="danger"
|
|
224
|
+
inactive-variant="primary"
|
|
225
|
+
/>
|
|
226
|
+
`,
|
|
227
|
+
}),
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// Play/Pause
|
|
231
|
+
export const PlayPause = {
|
|
232
|
+
render: () => ({
|
|
233
|
+
components: { DXToggleButton },
|
|
234
|
+
setup() {
|
|
235
|
+
const isPlaying = ref(false);
|
|
236
|
+
return { isPlaying, PlayIcon, PauseIcon };
|
|
237
|
+
},
|
|
238
|
+
template: `
|
|
239
|
+
<DXToggleButton
|
|
240
|
+
v-model="isPlaying"
|
|
241
|
+
:active-icon="PauseIcon"
|
|
242
|
+
:inactive-icon="PlayIcon"
|
|
243
|
+
active-label="Pause"
|
|
244
|
+
inactive-label="Play"
|
|
245
|
+
active-variant="warning"
|
|
246
|
+
inactive-variant="success"
|
|
247
|
+
size="lg"
|
|
248
|
+
icon-animation="scale"
|
|
249
|
+
/>
|
|
250
|
+
`,
|
|
251
|
+
}),
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// Размеры
|
|
255
|
+
export const Sizes = {
|
|
256
|
+
render: () => ({
|
|
257
|
+
components: { DXToggleButton },
|
|
258
|
+
setup() {
|
|
259
|
+
const small = ref(false);
|
|
260
|
+
const medium = ref(true);
|
|
261
|
+
const large = ref(false);
|
|
262
|
+
return { small, medium, large, HeartOutline, HeartSolid };
|
|
263
|
+
},
|
|
264
|
+
template: `
|
|
265
|
+
<div class="flex items-center gap-4">
|
|
266
|
+
<DXToggleButton
|
|
267
|
+
v-model="small"
|
|
268
|
+
:active-icon="HeartSolid"
|
|
269
|
+
:inactive-icon="HeartOutline"
|
|
270
|
+
active-variant="danger"
|
|
271
|
+
inactive-variant="ghost"
|
|
272
|
+
size="sm"
|
|
273
|
+
/>
|
|
274
|
+
<DXToggleButton
|
|
275
|
+
v-model="medium"
|
|
276
|
+
:active-icon="HeartSolid"
|
|
277
|
+
:inactive-icon="HeartOutline"
|
|
278
|
+
active-variant="danger"
|
|
279
|
+
inactive-variant="ghost"
|
|
280
|
+
size="md"
|
|
281
|
+
/>
|
|
282
|
+
<DXToggleButton
|
|
283
|
+
v-model="large"
|
|
284
|
+
:active-icon="HeartSolid"
|
|
285
|
+
:inactive-icon="HeartOutline"
|
|
286
|
+
active-variant="danger"
|
|
287
|
+
inactive-variant="ghost"
|
|
288
|
+
size="lg"
|
|
289
|
+
/>
|
|
290
|
+
</div>
|
|
291
|
+
`,
|
|
292
|
+
}),
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// Анимации
|
|
296
|
+
export const Animations = {
|
|
297
|
+
render: () => ({
|
|
298
|
+
components: { DXToggleButton },
|
|
299
|
+
setup() {
|
|
300
|
+
const wiggle = ref(false);
|
|
301
|
+
const scale = ref(false);
|
|
302
|
+
const rotate = ref(false);
|
|
303
|
+
const none = ref(false);
|
|
304
|
+
return { wiggle, scale, rotate, none, LightBulbIcon };
|
|
305
|
+
},
|
|
306
|
+
template: `
|
|
307
|
+
<div class="space-y-4">
|
|
308
|
+
<div class="flex items-center gap-4">
|
|
309
|
+
<DXToggleButton
|
|
310
|
+
v-model="wiggle"
|
|
311
|
+
:active-icon="LightBulbIcon"
|
|
312
|
+
:inactive-icon="LightBulbIcon"
|
|
313
|
+
active-variant="warning"
|
|
314
|
+
inactive-variant="ghost"
|
|
315
|
+
icon-animation="wiggle"
|
|
316
|
+
/>
|
|
317
|
+
<span class="text-sm text-slate-600">Wiggle</span>
|
|
318
|
+
</div>
|
|
319
|
+
|
|
320
|
+
<div class="flex items-center gap-4">
|
|
321
|
+
<DXToggleButton
|
|
322
|
+
v-model="scale"
|
|
323
|
+
:active-icon="LightBulbIcon"
|
|
324
|
+
:inactive-icon="LightBulbIcon"
|
|
325
|
+
active-variant="warning"
|
|
326
|
+
inactive-variant="ghost"
|
|
327
|
+
icon-animation="scale"
|
|
328
|
+
/>
|
|
329
|
+
<span class="text-sm text-slate-600">Scale</span>
|
|
330
|
+
</div>
|
|
331
|
+
|
|
332
|
+
<div class="flex items-center gap-4">
|
|
333
|
+
<DXToggleButton
|
|
334
|
+
v-model="rotate"
|
|
335
|
+
:active-icon="LightBulbIcon"
|
|
336
|
+
:inactive-icon="LightBulbIcon"
|
|
337
|
+
active-variant="warning"
|
|
338
|
+
inactive-variant="ghost"
|
|
339
|
+
icon-animation="rotate"
|
|
340
|
+
/>
|
|
341
|
+
<span class="text-sm text-slate-600">Rotate</span>
|
|
342
|
+
</div>
|
|
343
|
+
|
|
344
|
+
<div class="flex items-center gap-4">
|
|
345
|
+
<DXToggleButton
|
|
346
|
+
v-model="none"
|
|
347
|
+
:active-icon="LightBulbIcon"
|
|
348
|
+
:inactive-icon="LightBulbIcon"
|
|
349
|
+
active-variant="warning"
|
|
350
|
+
inactive-variant="ghost"
|
|
351
|
+
icon-animation="none"
|
|
352
|
+
/>
|
|
353
|
+
<span class="text-sm text-slate-600">None</span>
|
|
354
|
+
</div>
|
|
355
|
+
</div>
|
|
356
|
+
`,
|
|
357
|
+
}),
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
// Полная ширина
|
|
361
|
+
export const FullWidth = {
|
|
362
|
+
render: () => ({
|
|
363
|
+
components: { DXToggleButton },
|
|
364
|
+
setup() {
|
|
365
|
+
const subscribed = ref(false);
|
|
366
|
+
return { subscribed, BellOutline, BellSolid };
|
|
367
|
+
},
|
|
368
|
+
template: `
|
|
369
|
+
<DXToggleButton
|
|
370
|
+
v-model="subscribed"
|
|
371
|
+
:active-icon="BellSolid"
|
|
372
|
+
:inactive-icon="BellOutline"
|
|
373
|
+
active-label="Subscribed"
|
|
374
|
+
inactive-label="Subscribe"
|
|
375
|
+
active-variant="success"
|
|
376
|
+
inactive-variant="primary"
|
|
377
|
+
block
|
|
378
|
+
/>
|
|
379
|
+
`,
|
|
380
|
+
}),
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// Интерактивная демонстрация
|
|
384
|
+
export const InteractiveDemo = {
|
|
385
|
+
render: () => ({
|
|
386
|
+
components: { DXToggleButton },
|
|
387
|
+
setup() {
|
|
388
|
+
const favorites = ref([false, false, false, false]);
|
|
389
|
+
const totalLikes = ref(42);
|
|
390
|
+
|
|
391
|
+
const toggleFavorite = (index) => {
|
|
392
|
+
const wasActive = favorites.value[index];
|
|
393
|
+
favorites.value[index] = !favorites.value[index];
|
|
394
|
+
totalLikes.value += wasActive ? -1 : 1;
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
return {
|
|
398
|
+
favorites,
|
|
399
|
+
totalLikes,
|
|
400
|
+
toggleFavorite,
|
|
401
|
+
HeartOutline,
|
|
402
|
+
HeartSolid,
|
|
403
|
+
};
|
|
404
|
+
},
|
|
405
|
+
template: `
|
|
406
|
+
<div class="p-6 bg-slate-50 rounded-xl space-y-4">
|
|
407
|
+
<h3 class="text-lg font-semibold text-slate-900">
|
|
408
|
+
Like Demo
|
|
409
|
+
</h3>
|
|
410
|
+
<div class="flex items-center gap-2">
|
|
411
|
+
<DXToggleButton
|
|
412
|
+
v-for="(fav, index) in favorites"
|
|
413
|
+
:key="index"
|
|
414
|
+
:model-value="fav"
|
|
415
|
+
@update:model-value="toggleFavorite(index)"
|
|
416
|
+
:active-icon="HeartSolid"
|
|
417
|
+
:inactive-icon="HeartOutline"
|
|
418
|
+
active-variant="danger"
|
|
419
|
+
inactive-variant="ghost"
|
|
420
|
+
size="lg"
|
|
421
|
+
/>
|
|
422
|
+
</div>
|
|
423
|
+
<p class="text-sm text-slate-600">
|
|
424
|
+
Total likes: <strong class="text-slate-900">{{ totalLikes }}</strong>
|
|
425
|
+
</p>
|
|
426
|
+
</div>
|
|
427
|
+
`,
|
|
428
|
+
}),
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// Все варианты
|
|
432
|
+
export const AllVariants = {
|
|
433
|
+
render: () => ({
|
|
434
|
+
components: { DXToggleButton },
|
|
435
|
+
setup() {
|
|
436
|
+
const like = ref(true);
|
|
437
|
+
const bookmark = ref(false);
|
|
438
|
+
const star = ref(true);
|
|
439
|
+
const bell = ref(true);
|
|
440
|
+
const visible = ref(true);
|
|
441
|
+
|
|
442
|
+
return {
|
|
443
|
+
like,
|
|
444
|
+
bookmark,
|
|
445
|
+
star,
|
|
446
|
+
bell,
|
|
447
|
+
visible,
|
|
448
|
+
HeartOutline,
|
|
449
|
+
HeartSolid,
|
|
450
|
+
BookmarkOutline,
|
|
451
|
+
BookmarkSolid,
|
|
452
|
+
StarOutline,
|
|
453
|
+
StarSolid,
|
|
454
|
+
BellOutline,
|
|
455
|
+
BellSolid,
|
|
456
|
+
EyeOutline,
|
|
457
|
+
EyeSlashIcon,
|
|
458
|
+
};
|
|
459
|
+
},
|
|
460
|
+
template: `
|
|
461
|
+
<div class="space-y-6">
|
|
462
|
+
<div>
|
|
463
|
+
<h3 class="text-sm font-semibold text-slate-900 mb-3">Только иконки</h3>
|
|
464
|
+
<div class="flex items-center gap-3">
|
|
465
|
+
<DXToggleButton
|
|
466
|
+
v-model="like"
|
|
467
|
+
:active-icon="HeartSolid"
|
|
468
|
+
:inactive-icon="HeartOutline"
|
|
469
|
+
active-variant="danger"
|
|
470
|
+
inactive-variant="ghost"
|
|
471
|
+
/>
|
|
472
|
+
<DXToggleButton
|
|
473
|
+
v-model="bookmark"
|
|
474
|
+
:active-icon="BookmarkSolid"
|
|
475
|
+
:inactive-icon="BookmarkOutline"
|
|
476
|
+
active-variant="warning"
|
|
477
|
+
inactive-variant="ghost"
|
|
478
|
+
/>
|
|
479
|
+
<DXToggleButton
|
|
480
|
+
v-model="star"
|
|
481
|
+
:active-icon="StarSolid"
|
|
482
|
+
:inactive-icon="StarOutline"
|
|
483
|
+
active-variant="warning"
|
|
484
|
+
inactive-variant="ghost"
|
|
485
|
+
/>
|
|
486
|
+
<DXToggleButton
|
|
487
|
+
v-model="bell"
|
|
488
|
+
:active-icon="BellSolid"
|
|
489
|
+
:inactive-icon="BellOutline"
|
|
490
|
+
active-variant="primary"
|
|
491
|
+
inactive-variant="ghost"
|
|
492
|
+
/>
|
|
493
|
+
</div>
|
|
494
|
+
</div>
|
|
495
|
+
|
|
496
|
+
<div>
|
|
497
|
+
<h3 class="text-sm font-semibold text-slate-900 mb-3">С текстом</h3>
|
|
498
|
+
<div class="flex items-center gap-3">
|
|
499
|
+
<DXToggleButton
|
|
500
|
+
v-model="visible"
|
|
501
|
+
:active-icon="EyeOutline"
|
|
502
|
+
:inactive-icon="EyeSlashIcon"
|
|
503
|
+
active-label="Show"
|
|
504
|
+
inactive-label="Hide"
|
|
505
|
+
active-variant="success"
|
|
506
|
+
inactive-variant="ghost"
|
|
507
|
+
/>
|
|
508
|
+
</div>
|
|
509
|
+
</div>
|
|
510
|
+
</div>
|
|
511
|
+
`,
|
|
512
|
+
}),
|
|
513
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
type="button"
|
|
4
|
+
:class="allClasses"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
@click="handleToggle"
|
|
7
|
+
:aria-pressed="modelValue"
|
|
8
|
+
:aria-label="ariaLabel"
|
|
9
|
+
data-component="DXToggleButton"
|
|
10
|
+
>
|
|
11
|
+
<!-- Иконка -->
|
|
12
|
+
<DXIcon
|
|
13
|
+
v-if="currentIcon"
|
|
14
|
+
:icon="currentIcon"
|
|
15
|
+
:size="iconSize"
|
|
16
|
+
:animation="iconAnimation"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<!-- Текст (опционально) -->
|
|
20
|
+
<span v-if="currentLabel">{{ currentLabel }}</span>
|
|
21
|
+
</button>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup>
|
|
25
|
+
import { computed } from "vue";
|
|
26
|
+
import { useSize } from "@/composables/useSize";
|
|
27
|
+
import { useVariantButton } from "@/composables/useVariant";
|
|
28
|
+
import { useClassComposition } from "@/composables/useClassComposition";
|
|
29
|
+
import DXIcon from "../DXIcon/DXIcon.vue";
|
|
30
|
+
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
/** Текущее состояние (v-model) */
|
|
33
|
+
modelValue: { type: Boolean, default: false },
|
|
34
|
+
|
|
35
|
+
/** Иконка для активного состояния */
|
|
36
|
+
activeIcon: { type: [Object, Function], required: true },
|
|
37
|
+
/** Иконка для неактивного состояния */
|
|
38
|
+
inactiveIcon: { type: [Object, Function], required: true },
|
|
39
|
+
|
|
40
|
+
/** Текст для активного состояния (опционально) */
|
|
41
|
+
activeLabel: { type: String, default: null },
|
|
42
|
+
/** Текст для неактивного состояния (опционально) */
|
|
43
|
+
inactiveLabel: { type: String, default: null },
|
|
44
|
+
|
|
45
|
+
/** Вариант оформления для активного состояния */
|
|
46
|
+
activeVariant: { type: String, default: "primary" },
|
|
47
|
+
/** Вариант оформления для неактивного состояния */
|
|
48
|
+
inactiveVariant: { type: String, default: "ghost" },
|
|
49
|
+
|
|
50
|
+
/** Размер: sm | md | lg */
|
|
51
|
+
size: { type: String, default: "md" },
|
|
52
|
+
|
|
53
|
+
/** Анимация иконки: none | wiggle | scale | rotate */
|
|
54
|
+
iconAnimation: { type: String, default: "wiggle" },
|
|
55
|
+
|
|
56
|
+
/** Растянуть на всю ширину */
|
|
57
|
+
block: { type: Boolean, default: false },
|
|
58
|
+
|
|
59
|
+
/** Отключенное состояние */
|
|
60
|
+
disabled: { type: Boolean, default: false },
|
|
61
|
+
|
|
62
|
+
/** Aria-label для доступности */
|
|
63
|
+
ariaLabel: { type: String, default: null },
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const emit = defineEmits(["update:modelValue", "change"]);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Обработчик переключения
|
|
70
|
+
*/
|
|
71
|
+
const handleToggle = () => {
|
|
72
|
+
const newValue = !props.modelValue;
|
|
73
|
+
emit("update:modelValue", newValue);
|
|
74
|
+
emit("change", newValue);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Текущая иконка в зависимости от состояния
|
|
79
|
+
*/
|
|
80
|
+
const currentIcon = computed(() => {
|
|
81
|
+
return props.modelValue ? props.activeIcon : props.inactiveIcon;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Текущий текст
|
|
86
|
+
*/
|
|
87
|
+
const currentLabel = computed(() => {
|
|
88
|
+
return props.modelValue ? props.activeLabel : props.inactiveLabel;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Размер иконки в зависимости от размера кнопки
|
|
93
|
+
*/
|
|
94
|
+
const iconSize = computed(() => {
|
|
95
|
+
if (props.size === "sm") return "xs";
|
|
96
|
+
if (props.size === "lg") return "md";
|
|
97
|
+
return "sm";
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Классы размера
|
|
102
|
+
*/
|
|
103
|
+
const sizeClass = computed(() => {
|
|
104
|
+
const hasLabel = Boolean(currentLabel.value);
|
|
105
|
+
return useSize(props.size, hasLabel ? 'button' : 'buttonIcon');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Текущий вариант в зависимости от состояния
|
|
110
|
+
*/
|
|
111
|
+
const currentVariantClass = computed(() => {
|
|
112
|
+
const variant = props.modelValue ? props.activeVariant : props.inactiveVariant;
|
|
113
|
+
return useVariantButton(variant);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Все классы для кнопки
|
|
118
|
+
*/
|
|
119
|
+
const allClasses = computed(() =>
|
|
120
|
+
useClassComposition(
|
|
121
|
+
"toggle-btn inline-flex items-center justify-center gap-2 rounded-xl font-semibold transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-60 disabled:cursor-not-allowed",
|
|
122
|
+
sizeClass.value,
|
|
123
|
+
currentVariantClass.value,
|
|
124
|
+
{
|
|
125
|
+
'w-full': props.block,
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<style scoped>
|
|
132
|
+
.toggle-btn {
|
|
133
|
+
user-select: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.toggle-btn:active:not(:disabled) {
|
|
137
|
+
transform: scale(0.97);
|
|
138
|
+
}
|
|
139
|
+
</style>
|
|
140
|
+
|