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,322 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import DXRating from './DXRating.vue';
|
|
3
|
+
import DXFormControl from '../DXFormControl/DXFormControl.vue';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Molecules/DXRating',
|
|
7
|
+
component: DXRating,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: `
|
|
13
|
+
# DXRating
|
|
14
|
+
|
|
15
|
+
Компонент для отображения и выбора рейтинга с использованием звезд или других символов.
|
|
16
|
+
|
|
17
|
+
## Назначение
|
|
18
|
+
|
|
19
|
+
DXRating позволяет отображать и выбирать рейтинг в различных форматах:
|
|
20
|
+
звезды, сердца или числа. Поддерживает дробные значения и различные размеры.
|
|
21
|
+
|
|
22
|
+
## Архитектура
|
|
23
|
+
|
|
24
|
+
### Использует
|
|
25
|
+
- \`DXIcon\` - для отображения символов (звезды, сердца)
|
|
26
|
+
- \`useSize\` composable - для размеров
|
|
27
|
+
- \`useClassComposition\` composable - для стилей
|
|
28
|
+
|
|
29
|
+
### Используется в
|
|
30
|
+
- Формы отзывов
|
|
31
|
+
- Карточки товаров для отображения рейтинга
|
|
32
|
+
- Системы обратной связи
|
|
33
|
+
|
|
34
|
+
## Внутренняя логика
|
|
35
|
+
|
|
36
|
+
### Символы
|
|
37
|
+
- **star**: Звезды (по умолчанию)
|
|
38
|
+
- **heart**: Сердца
|
|
39
|
+
- **number**: Числа (будущая реализация)
|
|
40
|
+
|
|
41
|
+
### Дробные значения
|
|
42
|
+
При \`allowHalf={true}\` можно выбирать половину значения (например, 4.5).
|
|
43
|
+
|
|
44
|
+
### Hover эффект
|
|
45
|
+
При наведении курсора элементы подсвечиваются для визуальной обратной связи.
|
|
46
|
+
|
|
47
|
+
## Особенности
|
|
48
|
+
|
|
49
|
+
### Доступность
|
|
50
|
+
- ARIA атрибуты для screen readers
|
|
51
|
+
- Клавиатурная навигация (Enter, Space)
|
|
52
|
+
- Role="radiogroup" для семантики
|
|
53
|
+
|
|
54
|
+
### Readonly режим
|
|
55
|
+
В readonly режиме компонент только отображает рейтинг без возможности изменения.
|
|
56
|
+
`,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
argTypes: {
|
|
61
|
+
modelValue: {
|
|
62
|
+
control: 'number',
|
|
63
|
+
min: 0,
|
|
64
|
+
max: 5,
|
|
65
|
+
step: 0.5,
|
|
66
|
+
description: 'Значение рейтинга (v-model).',
|
|
67
|
+
table: {
|
|
68
|
+
type: { summary: 'number' },
|
|
69
|
+
defaultValue: { summary: '0' },
|
|
70
|
+
category: 'Content',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
max: {
|
|
74
|
+
control: 'number',
|
|
75
|
+
min: 1,
|
|
76
|
+
max: 10,
|
|
77
|
+
description: 'Максимальное значение рейтинга.',
|
|
78
|
+
table: {
|
|
79
|
+
type: { summary: 'number' },
|
|
80
|
+
defaultValue: { summary: '5' },
|
|
81
|
+
category: 'Content',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
readonly: {
|
|
85
|
+
control: 'boolean',
|
|
86
|
+
description: 'Только для чтения (не интерактивный).',
|
|
87
|
+
table: {
|
|
88
|
+
type: { summary: 'boolean' },
|
|
89
|
+
defaultValue: { summary: 'false' },
|
|
90
|
+
category: 'Behavior',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
allowHalf: {
|
|
94
|
+
control: 'boolean',
|
|
95
|
+
description: 'Разрешить половину значения (например, 4.5).',
|
|
96
|
+
table: {
|
|
97
|
+
type: { summary: 'boolean' },
|
|
98
|
+
defaultValue: { summary: 'false' },
|
|
99
|
+
category: 'Behavior',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
symbol: {
|
|
103
|
+
control: 'select',
|
|
104
|
+
options: ['star', 'heart', 'number'],
|
|
105
|
+
description: 'Символ для отображения: star | heart | number.',
|
|
106
|
+
table: {
|
|
107
|
+
type: { summary: 'string' },
|
|
108
|
+
defaultValue: { summary: 'star' },
|
|
109
|
+
category: 'Appearance',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
color: {
|
|
113
|
+
control: 'select',
|
|
114
|
+
options: ['yellow', 'red', 'blue', 'green', 'purple'],
|
|
115
|
+
description: 'Цвет символов.',
|
|
116
|
+
table: {
|
|
117
|
+
type: { summary: 'string' },
|
|
118
|
+
defaultValue: { summary: 'yellow' },
|
|
119
|
+
category: 'Appearance',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
size: {
|
|
123
|
+
control: 'select',
|
|
124
|
+
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
125
|
+
description: 'Размер компонента.',
|
|
126
|
+
table: {
|
|
127
|
+
type: { summary: 'string' },
|
|
128
|
+
defaultValue: { summary: 'md' },
|
|
129
|
+
category: 'Appearance',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
count: {
|
|
133
|
+
control: 'number',
|
|
134
|
+
description: 'Количество оценок для отображения.',
|
|
135
|
+
table: {
|
|
136
|
+
type: { summary: 'number' },
|
|
137
|
+
defaultValue: { summary: 'null' },
|
|
138
|
+
category: 'Content',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const Default = {
|
|
145
|
+
args: {
|
|
146
|
+
modelValue: 4.5,
|
|
147
|
+
readonly: true,
|
|
148
|
+
},
|
|
149
|
+
parameters: {
|
|
150
|
+
docs: {
|
|
151
|
+
description: {
|
|
152
|
+
story: 'Базовое использование для отображения рейтинга (readonly режим).',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
render: (args) => ({
|
|
157
|
+
components: { DXRating },
|
|
158
|
+
setup() {
|
|
159
|
+
return { args };
|
|
160
|
+
},
|
|
161
|
+
template: '<DXRating v-bind="args" />',
|
|
162
|
+
}),
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const Interactive = {
|
|
166
|
+
parameters: {
|
|
167
|
+
docs: {
|
|
168
|
+
description: {
|
|
169
|
+
story: 'Интерактивный выбор рейтинга. Пользователь может выбрать рейтинг кликом.',
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
render: () => ({
|
|
174
|
+
components: { DXRating, DXFormControl },
|
|
175
|
+
setup() {
|
|
176
|
+
const productRating = ref(0);
|
|
177
|
+
const handleRatingChange = (value) => {
|
|
178
|
+
console.log('Выбран рейтинг:', value);
|
|
179
|
+
};
|
|
180
|
+
return { productRating, handleRatingChange };
|
|
181
|
+
},
|
|
182
|
+
template: `
|
|
183
|
+
<DXFormControl label="Оцените товар">
|
|
184
|
+
<DXRating
|
|
185
|
+
v-model="productRating"
|
|
186
|
+
:max="5"
|
|
187
|
+
@change="handleRatingChange"
|
|
188
|
+
/>
|
|
189
|
+
</DXFormControl>
|
|
190
|
+
`,
|
|
191
|
+
}),
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export const WithHalf = {
|
|
195
|
+
args: {
|
|
196
|
+
modelValue: 3.5,
|
|
197
|
+
allowHalf: true,
|
|
198
|
+
readonly: true,
|
|
199
|
+
},
|
|
200
|
+
parameters: {
|
|
201
|
+
docs: {
|
|
202
|
+
description: {
|
|
203
|
+
story: 'Рейтинг с поддержкой дробных значений. Можно выбрать половину звезды.',
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
render: (args) => ({
|
|
208
|
+
components: { DXRating },
|
|
209
|
+
setup() {
|
|
210
|
+
return { args };
|
|
211
|
+
},
|
|
212
|
+
template: '<DXRating v-bind="args" />',
|
|
213
|
+
}),
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const WithCount = {
|
|
217
|
+
args: {
|
|
218
|
+
modelValue: 4.2,
|
|
219
|
+
count: 125,
|
|
220
|
+
readonly: true,
|
|
221
|
+
},
|
|
222
|
+
parameters: {
|
|
223
|
+
docs: {
|
|
224
|
+
description: {
|
|
225
|
+
story: 'Рейтинг с количеством оценок. Отображает количество оценок рядом с рейтингом.',
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
render: (args) => ({
|
|
230
|
+
components: { DXRating },
|
|
231
|
+
setup() {
|
|
232
|
+
return { args };
|
|
233
|
+
},
|
|
234
|
+
template: '<DXRating v-bind="args" />',
|
|
235
|
+
}),
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
export const HeartSymbol = {
|
|
239
|
+
args: {
|
|
240
|
+
modelValue: 4,
|
|
241
|
+
symbol: 'heart',
|
|
242
|
+
color: 'red',
|
|
243
|
+
readonly: true,
|
|
244
|
+
},
|
|
245
|
+
parameters: {
|
|
246
|
+
docs: {
|
|
247
|
+
description: {
|
|
248
|
+
story: 'Рейтинг с сердцами вместо звезд. Полезно для лайков и избранного.',
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
render: (args) => ({
|
|
253
|
+
components: { DXRating },
|
|
254
|
+
setup() {
|
|
255
|
+
const heartRating = ref(0);
|
|
256
|
+
return { args, heartRating };
|
|
257
|
+
},
|
|
258
|
+
template: `
|
|
259
|
+
<div class="space-y-4">
|
|
260
|
+
<DXRating v-bind="args" />
|
|
261
|
+
<DXRating
|
|
262
|
+
v-model="heartRating"
|
|
263
|
+
:max="5"
|
|
264
|
+
symbol="heart"
|
|
265
|
+
color="red"
|
|
266
|
+
/>
|
|
267
|
+
<p class="text-sm text-slate-600">Выбрано: {{ heartRating }}</p>
|
|
268
|
+
</div>
|
|
269
|
+
`,
|
|
270
|
+
}),
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
export const AllSizes = {
|
|
274
|
+
parameters: {
|
|
275
|
+
docs: {
|
|
276
|
+
description: {
|
|
277
|
+
story: 'Различные размеры компонента.',
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
render: () => ({
|
|
282
|
+
components: { DXRating },
|
|
283
|
+
setup() {
|
|
284
|
+
return {};
|
|
285
|
+
},
|
|
286
|
+
template: `
|
|
287
|
+
<div class="space-y-4">
|
|
288
|
+
<DXRating :model-value="4" size="xs" readonly />
|
|
289
|
+
<DXRating :model-value="4" size="sm" readonly />
|
|
290
|
+
<DXRating :model-value="4" size="md" readonly />
|
|
291
|
+
<DXRating :model-value="4" size="lg" readonly />
|
|
292
|
+
<DXRating :model-value="4" size="xl" readonly />
|
|
293
|
+
</div>
|
|
294
|
+
`,
|
|
295
|
+
}),
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
export const AllColors = {
|
|
299
|
+
parameters: {
|
|
300
|
+
docs: {
|
|
301
|
+
description: {
|
|
302
|
+
story: 'Различные цвета символов.',
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
render: () => ({
|
|
307
|
+
components: { DXRating },
|
|
308
|
+
setup() {
|
|
309
|
+
return {};
|
|
310
|
+
},
|
|
311
|
+
template: `
|
|
312
|
+
<div class="space-y-4">
|
|
313
|
+
<DXRating :model-value="4" color="yellow" readonly />
|
|
314
|
+
<DXRating :model-value="4" color="red" readonly />
|
|
315
|
+
<DXRating :model-value="4" color="blue" readonly />
|
|
316
|
+
<DXRating :model-value="4" color="green" readonly />
|
|
317
|
+
<DXRating :model-value="4" color="purple" readonly />
|
|
318
|
+
</div>
|
|
319
|
+
`,
|
|
320
|
+
}),
|
|
321
|
+
};
|
|
322
|
+
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="ratingClasses"
|
|
4
|
+
data-component="DXRating"
|
|
5
|
+
:data-size="size"
|
|
6
|
+
:data-readonly="readonly"
|
|
7
|
+
:data-symbol="symbol"
|
|
8
|
+
:data-color="color"
|
|
9
|
+
role="radiogroup"
|
|
10
|
+
:aria-label="ariaLabel || 'Рейтинг'"
|
|
11
|
+
>
|
|
12
|
+
<button
|
|
13
|
+
v-for="index in max"
|
|
14
|
+
:key="index"
|
|
15
|
+
type="button"
|
|
16
|
+
:class="itemClasses(index)"
|
|
17
|
+
:disabled="readonly"
|
|
18
|
+
:aria-label="`Оценка ${index} из ${max}`"
|
|
19
|
+
:aria-checked="isItemActive(index)"
|
|
20
|
+
role="radio"
|
|
21
|
+
tabindex="0"
|
|
22
|
+
@click="handleClick(index)"
|
|
23
|
+
@mouseenter="handleMouseEnter(index)"
|
|
24
|
+
@mouseleave="handleMouseLeave"
|
|
25
|
+
@keydown.enter="handleClick(index)"
|
|
26
|
+
@keydown.space.prevent="handleClick(index)"
|
|
27
|
+
>
|
|
28
|
+
<component
|
|
29
|
+
v-if="isItemFilled(index)"
|
|
30
|
+
:is="filledIconComponent"
|
|
31
|
+
:class="iconClasses(index)"
|
|
32
|
+
/>
|
|
33
|
+
<component
|
|
34
|
+
v-else
|
|
35
|
+
:is="iconComponent"
|
|
36
|
+
:class="iconClasses(index)"
|
|
37
|
+
/>
|
|
38
|
+
<!-- Половина иконки для allowHalf -->
|
|
39
|
+
<component
|
|
40
|
+
v-if="allowHalf && isHalfFilled(index)"
|
|
41
|
+
:is="filledIconComponent"
|
|
42
|
+
:class="halfIconClasses(index)"
|
|
43
|
+
/>
|
|
44
|
+
</button>
|
|
45
|
+
<!-- Количество оценок -->
|
|
46
|
+
<span v-if="count" :class="countClasses">
|
|
47
|
+
({{ count }})
|
|
48
|
+
</span>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup>
|
|
53
|
+
import { ref, computed } from "vue";
|
|
54
|
+
import { useSize } from "@/composables/useSize";
|
|
55
|
+
import { useClassComposition } from "@/composables/useClassComposition";
|
|
56
|
+
import {
|
|
57
|
+
StarIcon,
|
|
58
|
+
HeartIcon,
|
|
59
|
+
} from "@heroicons/vue/24/solid";
|
|
60
|
+
import {
|
|
61
|
+
StarIcon as StarIconOutline,
|
|
62
|
+
HeartIcon as HeartIconOutline,
|
|
63
|
+
} from "@heroicons/vue/24/outline";
|
|
64
|
+
|
|
65
|
+
const props = defineProps({
|
|
66
|
+
/**
|
|
67
|
+
* Значение рейтинга (v-model)
|
|
68
|
+
* Может быть целым числом или дробным (например, 4.5)
|
|
69
|
+
*/
|
|
70
|
+
modelValue: { type: Number, default: 0 },
|
|
71
|
+
/**
|
|
72
|
+
* Максимальное значение рейтинга
|
|
73
|
+
* @default 5
|
|
74
|
+
*/
|
|
75
|
+
max: { type: Number, default: 5 },
|
|
76
|
+
/**
|
|
77
|
+
* Только для чтения (не интерактивный)
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
readonly: { type: Boolean, default: false },
|
|
81
|
+
/**
|
|
82
|
+
* Разрешить половину значения (например, 4.5)
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
allowHalf: { type: Boolean, default: false },
|
|
86
|
+
/**
|
|
87
|
+
* Символ для отображения: star | heart | number
|
|
88
|
+
* @default 'star'
|
|
89
|
+
*/
|
|
90
|
+
symbol: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: "star",
|
|
93
|
+
validator: (v) => ["star", "heart", "number"].includes(v),
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* Цвет: yellow | red | blue | green | purple
|
|
97
|
+
* @default 'yellow'
|
|
98
|
+
*/
|
|
99
|
+
color: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: "yellow",
|
|
102
|
+
validator: (v) =>
|
|
103
|
+
["yellow", "red", "blue", "green", "purple"].includes(v),
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* Размер: xs | sm | md | lg | xl
|
|
107
|
+
* @default 'md'
|
|
108
|
+
*/
|
|
109
|
+
size: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: "md",
|
|
112
|
+
validator: (v) => ["xs", "sm", "md", "lg", "xl"].includes(v),
|
|
113
|
+
},
|
|
114
|
+
/**
|
|
115
|
+
* Количество оценок для отображения
|
|
116
|
+
*/
|
|
117
|
+
count: { type: Number, default: null },
|
|
118
|
+
/**
|
|
119
|
+
* Кастомный aria-label
|
|
120
|
+
*/
|
|
121
|
+
ariaLabel: { type: String, default: null },
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const emit = defineEmits(["update:modelValue", "change"]);
|
|
125
|
+
|
|
126
|
+
const hoverValue = ref(0);
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Иконка для отображения
|
|
130
|
+
*
|
|
131
|
+
* @description
|
|
132
|
+
* Определяет какую иконку использовать в зависимости от symbol:
|
|
133
|
+
* - star → StarIcon
|
|
134
|
+
* - heart → HeartIcon
|
|
135
|
+
* - number → не используется (отображаются числа)
|
|
136
|
+
*
|
|
137
|
+
* @returns {Object|Function} Компонент иконки
|
|
138
|
+
*/
|
|
139
|
+
const iconComponent = computed(() => {
|
|
140
|
+
if (props.symbol === "heart") {
|
|
141
|
+
return HeartIconOutline;
|
|
142
|
+
}
|
|
143
|
+
return StarIconOutline;
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Заполненная иконка
|
|
148
|
+
*
|
|
149
|
+
* @description
|
|
150
|
+
* Определяет заполненную версию иконки для активных элементов.
|
|
151
|
+
*
|
|
152
|
+
* @returns {Object|Function} Компонент заполненной иконки
|
|
153
|
+
*/
|
|
154
|
+
const filledIconComponent = computed(() => {
|
|
155
|
+
if (props.symbol === "heart") {
|
|
156
|
+
return HeartIcon;
|
|
157
|
+
}
|
|
158
|
+
return StarIcon;
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Классы для контейнера рейтинга
|
|
163
|
+
*
|
|
164
|
+
* @description
|
|
165
|
+
* Базовые классы для контейнера с выравниванием элементов.
|
|
166
|
+
*
|
|
167
|
+
* @returns {Array} Массив классов
|
|
168
|
+
*/
|
|
169
|
+
const ratingClasses = computed(() =>
|
|
170
|
+
useClassComposition("inline-flex items-center gap-1")
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Классы для элемента рейтинга
|
|
175
|
+
*
|
|
176
|
+
* @description
|
|
177
|
+
* Вычисляет классы для каждого элемента рейтинга на основе состояния.
|
|
178
|
+
*
|
|
179
|
+
* @param {number} index - Индекс элемента (1-based)
|
|
180
|
+
* @returns {Array} Массив классов
|
|
181
|
+
*/
|
|
182
|
+
function itemClasses(index) {
|
|
183
|
+
const isActive = isItemActive(index);
|
|
184
|
+
const isHovered = hoverValue.value >= index;
|
|
185
|
+
const currentValue = hoverValue.value || props.modelValue;
|
|
186
|
+
|
|
187
|
+
return useClassComposition(
|
|
188
|
+
"relative inline-flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 rounded",
|
|
189
|
+
{
|
|
190
|
+
"cursor-pointer": !props.readonly,
|
|
191
|
+
"cursor-default": props.readonly,
|
|
192
|
+
[colorClasses.value.active]: isActive || isHovered,
|
|
193
|
+
[colorClasses.value.inactive]: !isActive && !isHovered,
|
|
194
|
+
[sizeClasses.value]: true,
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Классы для иконки
|
|
201
|
+
*
|
|
202
|
+
* @description
|
|
203
|
+
* Вычисляет классы для иконки элемента.
|
|
204
|
+
*
|
|
205
|
+
* @param {number} index - Индекс элемента (1-based)
|
|
206
|
+
* @returns {Array} Массив классов
|
|
207
|
+
*/
|
|
208
|
+
function iconClasses(index) {
|
|
209
|
+
return useClassComposition(
|
|
210
|
+
sizeClasses.value,
|
|
211
|
+
{
|
|
212
|
+
[colorClasses.value.active]: isItemFilled(index),
|
|
213
|
+
[colorClasses.value.inactive]: !isItemFilled(index),
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Классы для половины иконки
|
|
220
|
+
*
|
|
221
|
+
* @description
|
|
222
|
+
* Вычисляет классы для половины заполненной иконки (для allowHalf).
|
|
223
|
+
*
|
|
224
|
+
* @param {number} index - Индекс элемента (1-based)
|
|
225
|
+
* @returns {Array} Массив классов
|
|
226
|
+
*/
|
|
227
|
+
function halfIconClasses(index) {
|
|
228
|
+
return useClassComposition(
|
|
229
|
+
sizeClasses.value,
|
|
230
|
+
colorClasses.value.active,
|
|
231
|
+
"absolute left-0 top-0 overflow-hidden"
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Классы для количества оценок
|
|
237
|
+
*
|
|
238
|
+
* @description
|
|
239
|
+
* Вычисляет классы для отображения количества оценок.
|
|
240
|
+
*
|
|
241
|
+
* @returns {Array} Массив классов
|
|
242
|
+
*/
|
|
243
|
+
const countClasses = computed(() => {
|
|
244
|
+
const sizeMap = {
|
|
245
|
+
xs: "text-xs",
|
|
246
|
+
sm: "text-sm",
|
|
247
|
+
md: "text-base",
|
|
248
|
+
lg: "text-lg",
|
|
249
|
+
xl: "text-xl",
|
|
250
|
+
};
|
|
251
|
+
return useClassComposition(
|
|
252
|
+
sizeMap[props.size] || sizeMap.md,
|
|
253
|
+
"text-slate-500 ml-1"
|
|
254
|
+
);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Классы размеров
|
|
259
|
+
*
|
|
260
|
+
* @description
|
|
261
|
+
* Вычисляет классы размеров для элементов рейтинга.
|
|
262
|
+
*
|
|
263
|
+
* @returns {Object} Объект с классами размеров
|
|
264
|
+
*/
|
|
265
|
+
const sizeClasses = computed(() => {
|
|
266
|
+
const sizeMap = {
|
|
267
|
+
xs: "w-3 h-3",
|
|
268
|
+
sm: "w-4 h-4",
|
|
269
|
+
md: "w-5 h-5",
|
|
270
|
+
lg: "w-6 h-6",
|
|
271
|
+
xl: "w-8 h-8",
|
|
272
|
+
};
|
|
273
|
+
return {
|
|
274
|
+
value: sizeMap[props.size] || sizeMap.md,
|
|
275
|
+
};
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Классы цветов
|
|
280
|
+
*
|
|
281
|
+
* @description
|
|
282
|
+
* Вычисляет классы цветов для активных и неактивных элементов.
|
|
283
|
+
*
|
|
284
|
+
* @returns {Object} Объект с классами цветов
|
|
285
|
+
*/
|
|
286
|
+
const colorClasses = computed(() => {
|
|
287
|
+
const colorMap = {
|
|
288
|
+
yellow: {
|
|
289
|
+
active: "text-yellow-400",
|
|
290
|
+
inactive: "text-slate-300",
|
|
291
|
+
},
|
|
292
|
+
red: {
|
|
293
|
+
active: "text-rose-500",
|
|
294
|
+
inactive: "text-slate-300",
|
|
295
|
+
},
|
|
296
|
+
blue: {
|
|
297
|
+
active: "text-blue-500",
|
|
298
|
+
inactive: "text-slate-300",
|
|
299
|
+
},
|
|
300
|
+
green: {
|
|
301
|
+
active: "text-green-500",
|
|
302
|
+
inactive: "text-slate-300",
|
|
303
|
+
},
|
|
304
|
+
purple: {
|
|
305
|
+
active: "text-purple-500",
|
|
306
|
+
inactive: "text-slate-300",
|
|
307
|
+
},
|
|
308
|
+
};
|
|
309
|
+
return colorMap[props.color] || colorMap.yellow;
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Проверяет, активен ли элемент
|
|
314
|
+
*
|
|
315
|
+
* @description
|
|
316
|
+
* Определяет, должен ли элемент быть активным (заполненным) на основе текущего значения.
|
|
317
|
+
*
|
|
318
|
+
* @param {number} index - Индекс элемента (1-based)
|
|
319
|
+
* @returns {boolean} true если элемент активен
|
|
320
|
+
*/
|
|
321
|
+
function isItemActive(index) {
|
|
322
|
+
const currentValue = hoverValue.value || props.modelValue;
|
|
323
|
+
return currentValue >= index;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Проверяет, заполнен ли элемент
|
|
328
|
+
*
|
|
329
|
+
* @description
|
|
330
|
+
* Определяет, должен ли элемент быть полностью заполненным.
|
|
331
|
+
*
|
|
332
|
+
* @param {number} index - Индекс элемента (1-based)
|
|
333
|
+
* @returns {boolean} true если элемент заполнен
|
|
334
|
+
*/
|
|
335
|
+
function isItemFilled(index) {
|
|
336
|
+
const currentValue = hoverValue.value || props.modelValue;
|
|
337
|
+
return Math.floor(currentValue) >= index;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Проверяет, заполнена ли половина элемента
|
|
342
|
+
*
|
|
343
|
+
* @description
|
|
344
|
+
* Определяет, должна ли быть заполнена половина элемента (для allowHalf).
|
|
345
|
+
*
|
|
346
|
+
* @param {number} index - Индекс элемента (1-based)
|
|
347
|
+
* @returns {boolean} true если половина заполнена
|
|
348
|
+
*/
|
|
349
|
+
function isHalfFilled(index) {
|
|
350
|
+
if (!props.allowHalf) return false;
|
|
351
|
+
const currentValue = hoverValue.value || props.modelValue;
|
|
352
|
+
const floorValue = Math.floor(currentValue);
|
|
353
|
+
return floorValue === index - 1 && currentValue % 1 >= 0.5;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Обработчик клика
|
|
358
|
+
*
|
|
359
|
+
* @description
|
|
360
|
+
* Обрабатывает клик по элементу рейтинга и обновляет значение.
|
|
361
|
+
*
|
|
362
|
+
* @param {number} index - Индекс элемента (1-based)
|
|
363
|
+
*/
|
|
364
|
+
function handleClick(index) {
|
|
365
|
+
if (props.readonly) return;
|
|
366
|
+
|
|
367
|
+
let newValue = index;
|
|
368
|
+
|
|
369
|
+
// Если allowHalf и клик по уже выбранному элементу, устанавливаем половину
|
|
370
|
+
if (props.allowHalf && props.modelValue === index) {
|
|
371
|
+
newValue = index - 0.5;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
emit("update:modelValue", newValue);
|
|
375
|
+
emit("change", newValue);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Обработчик mouseenter
|
|
380
|
+
*
|
|
381
|
+
* @description
|
|
382
|
+
* Устанавливает hover значение при наведении (для визуальной обратной связи).
|
|
383
|
+
*
|
|
384
|
+
* @param {number} index - Индекс элемента (1-based)
|
|
385
|
+
*/
|
|
386
|
+
function handleMouseEnter(index) {
|
|
387
|
+
if (props.readonly) return;
|
|
388
|
+
hoverValue.value = index;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Обработчик mouseleave
|
|
393
|
+
*
|
|
394
|
+
* @description
|
|
395
|
+
* Сбрасывает hover значение при уходе курсора.
|
|
396
|
+
*/
|
|
397
|
+
function handleMouseLeave() {
|
|
398
|
+
if (props.readonly) return;
|
|
399
|
+
hoverValue.value = 0;
|
|
400
|
+
}
|
|
401
|
+
</script>
|
|
402
|
+
|