@central-design-system/components 4.0.0-alpha.4 → 4.0.0-alpha.5
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/CHANGELOG.md +5 -0
- package/MIGRATION.md +14 -42
- package/dist/browser/entry.js +4917 -2238
- package/dist/browser/iconsets/cdsLegacy.js +1 -1
- package/dist/cds.d.ts +119065 -0
- package/dist/cjs/entry.js +9 -9
- package/dist/es/entry.css +0 -18
- package/dist/es/entry.js +3 -2
- package/dist/es/entry.js.map +1 -1
- package/dist/es/src/cds.js +1 -1
- package/dist/es/src/components/CdsApp/CdsApp.css +0 -18
- package/dist/es/src/components/CdsApp/api/CdsApp.props.js +1 -0
- package/dist/es/src/components/CdsApp/api/CdsApp.props.js.map +1 -1
- package/dist/es/src/components/CdsAutocomplete/CdsAutocomplete.css +0 -18
- package/dist/es/src/components/CdsAutocomplete/CdsAutocomplete.vue_vue_type_script_setup_true_lang.js +20 -5
- package/dist/es/src/components/CdsAutocomplete/CdsAutocomplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsAutocomplete/api/CdsAutocomplete.props.js +9 -2
- package/dist/es/src/components/CdsAutocomplete/api/CdsAutocomplete.props.js.map +1 -1
- package/dist/es/src/components/CdsAvatar/CdsAvatar.css +0 -18
- package/dist/es/src/components/CdsAvatar/api/CdsAvatar.props.js +20 -5
- package/dist/es/src/components/CdsAvatar/api/CdsAvatar.props.js.map +1 -1
- package/dist/es/src/components/CdsBadge/CdsBadge.css +0 -18
- package/dist/es/src/components/CdsBadge/api/CdsBadge.props.js +37 -9
- package/dist/es/src/components/CdsBadge/api/CdsBadge.props.js.map +1 -1
- package/dist/es/src/components/CdsBreadcrumbs/CdsBreadcrumbs.css +0 -18
- package/dist/es/src/components/CdsBreadcrumbs/api/CdsBreadcrumbs.props.js +32 -8
- package/dist/es/src/components/CdsBreadcrumbs/api/CdsBreadcrumbs.props.js.map +1 -1
- package/dist/es/src/components/CdsButton/CdsButton.css +0 -18
- package/dist/es/src/components/CdsButton/CdsButton.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/src/components/CdsButton/CdsButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsButton/api/CdsButton.props.js +28 -7
- package/dist/es/src/components/CdsButton/api/CdsButton.props.js.map +1 -1
- package/dist/es/src/components/CdsButtonGroup/CdsButtonGroup.css +0 -18
- package/dist/es/src/components/CdsButtonGroup/api/CdsButtonGroup.props.js +4 -1
- package/dist/es/src/components/CdsButtonGroup/api/CdsButtonGroup.props.js.map +1 -1
- package/dist/es/src/components/CdsButtonToggle/CdsButtonToggle.css +0 -18
- package/dist/es/src/components/CdsButtonToggle/CdsButtonToggle.vue_vue_type_script_setup_true_lang.js +20 -5
- package/dist/es/src/components/CdsButtonToggle/CdsButtonToggle.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsCard/CdsCard.css +0 -18
- package/dist/es/src/components/CdsCard/CdsCardGroup.vue_vue_type_script_setup_true_lang.js +20 -5
- package/dist/es/src/components/CdsCard/CdsCardGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsCard/api/CdsCard.props.js +84 -20
- package/dist/es/src/components/CdsCard/api/CdsCard.props.js.map +1 -1
- package/dist/es/src/components/CdsCarousel/CdsCarousel.css +0 -18
- package/dist/es/src/components/CdsCarousel/api/CdsCarousel.props.js +36 -9
- package/dist/es/src/components/CdsCarousel/api/CdsCarousel.props.js.map +1 -1
- package/dist/es/src/components/CdsCheckbox/CdsCheckbox.css +0 -18
- package/dist/es/src/components/CdsCheckboxButton/CdsCheckboxButton.css +0 -18
- package/dist/es/src/components/CdsCheckboxButton/api/CdsCheckboxButton.props.js +8 -2
- package/dist/es/src/components/CdsCheckboxButton/api/CdsCheckboxButton.props.js.map +1 -1
- package/dist/es/src/components/CdsCombobox/CdsCombobox.css +0 -18
- package/dist/es/src/components/CdsCombobox/CdsCombobox.vue_vue_type_script_setup_true_lang.js +24 -6
- package/dist/es/src/components/CdsCombobox/CdsCombobox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsCombobox/api/CdsCombobox.props.js +13 -3
- package/dist/es/src/components/CdsCombobox/api/CdsCombobox.props.js.map +1 -1
- package/dist/es/src/components/CdsCounter/CdsCounter.css +0 -18
- package/dist/es/src/components/CdsCounter/api/CdsCounter.props.js +12 -3
- package/dist/es/src/components/CdsCounter/api/CdsCounter.props.js.map +1 -1
- package/dist/es/src/components/CdsDateInput/CdsDateInput.css +0 -18
- package/dist/es/src/components/CdsDateInput/CdsDateInput.vue_vue_type_script_setup_true_lang.js +8 -0
- package/dist/es/src/components/CdsDateInput/CdsDateInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsDateInput/api/CdsDateInput.props.js +31 -7
- package/dist/es/src/components/CdsDateInput/api/CdsDateInput.props.js.map +1 -1
- package/dist/es/src/components/CdsDatePicker/CdsDatePicker.css +0 -18
- package/dist/es/src/components/CdsDatePicker/CdsDatePicker.vue_vue_type_script_setup_true_lang.js +20 -0
- package/dist/es/src/components/CdsDatePicker/CdsDatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsDatePicker/api/CdsDatePicker.props.js +64 -15
- package/dist/es/src/components/CdsDatePicker/api/CdsDatePicker.props.js.map +1 -1
- package/dist/es/src/components/CdsDefaultsProvider/api/CdsDefaultsProvider.props.js +5 -0
- package/dist/es/src/components/CdsDefaultsProvider/api/CdsDefaultsProvider.props.js.map +1 -1
- package/dist/es/src/components/CdsDescription/CdsDescription.css +0 -18
- package/dist/es/src/components/CdsDivider/CdsDivider.css +0 -18
- package/dist/es/src/components/CdsDivider/CdsDivider.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsDivider/api/CdsDivider.props.js +33 -8
- package/dist/es/src/components/CdsDivider/api/CdsDivider.props.js.map +1 -1
- package/dist/es/src/components/CdsDrawer/CdsDrawer.css +0 -18
- package/dist/es/src/components/CdsDrawer/CdsDrawer.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/src/components/CdsDrawer/CdsDrawer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsDrawer/api/CdsDrawer.props.js +32 -8
- package/dist/es/src/components/CdsDrawer/api/CdsDrawer.props.js.map +1 -1
- package/dist/es/src/components/CdsEmptyState/CdsEmptyState.css +0 -18
- package/dist/es/src/components/CdsEmptyState/api/CdsEmptyState.props.js +33 -8
- package/dist/es/src/components/CdsEmptyState/api/CdsEmptyState.props.js.map +1 -1
- package/dist/es/src/components/CdsExpandablePanel/CdsExpandablePanel.vue_vue_type_script_setup_true_lang.js +16 -4
- package/dist/es/src/components/CdsExpandablePanel/CdsExpandablePanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsExpandablePanel/CdsExpandablePanelTitle.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/src/components/CdsExpandablePanel/CdsExpandablePanelTitle.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsExpandablePanel/CdsExpandablePanels.css +0 -18
- package/dist/es/src/components/CdsExpandablePanel/CdsExpandablePanels.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/src/components/CdsExpandablePanel/CdsExpandablePanels.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsExpandablePanel/api/CdsExpandablePanel.props.js +38 -9
- package/dist/es/src/components/CdsExpandablePanel/api/CdsExpandablePanel.props.js.map +1 -1
- package/dist/es/src/components/CdsField/CdsField.css +0 -18
- package/dist/es/src/components/CdsField/CdsField.vue_vue_type_script_setup_true_lang.js +13 -3
- package/dist/es/src/components/CdsField/CdsField.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsField/api/CdsField.props.js +56 -14
- package/dist/es/src/components/CdsField/api/CdsField.props.js.map +1 -1
- package/dist/es/src/components/CdsField/composables/useAutocomplete.js +1 -0
- package/dist/es/src/components/CdsField/composables/useAutocomplete.js.map +1 -1
- package/dist/es/src/components/CdsFileInput/CdsFileInput.css +0 -18
- package/dist/es/src/components/CdsFileInput/api/CdsFileInput.props.js +40 -10
- package/dist/es/src/components/CdsFileInput/api/CdsFileInput.props.js.map +1 -1
- package/dist/es/src/components/CdsFileInput/composables/useFileFilter.js +4 -1
- package/dist/es/src/components/CdsFileInput/composables/useFileFilter.js.map +1 -1
- package/dist/es/src/components/CdsFileUpload/CdsFileUpload.css +0 -18
- package/dist/es/src/components/CdsFileUpload/CdsFileUpload.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/src/components/CdsFileUpload/CdsFileUpload.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsFileUpload/api/CdsFileUpload.props.js +85 -21
- package/dist/es/src/components/CdsFileUpload/api/CdsFileUpload.props.js.map +1 -1
- package/dist/es/src/components/CdsFooter/CdsFooter.css +0 -18
- package/dist/es/src/components/CdsForm/CdsForm.css +0 -18
- package/dist/es/src/components/CdsForm/api/CdsForm.props.js +8 -2
- package/dist/es/src/components/CdsForm/api/CdsForm.props.js.map +1 -1
- package/dist/es/src/components/CdsFunctionalButton/CdsFunctionalButton.css +0 -18
- package/dist/es/src/components/CdsFunctionalButton/api/CdsFunctionalButton.props.js +4 -1
- package/dist/es/src/components/CdsFunctionalButton/api/CdsFunctionalButton.props.js.map +1 -1
- package/dist/es/src/components/CdsGrid/api/CdsGrid.props.js +40 -10
- package/dist/es/src/components/CdsGrid/api/CdsGrid.props.js.map +1 -1
- package/dist/es/src/components/CdsGrid/components/CSSGrid.css +0 -18
- package/dist/es/src/components/CdsGrid/components/FlexGrid.css +0 -18
- package/dist/es/src/components/CdsHeader/CdsHeader.css +0 -18
- package/dist/es/src/components/CdsHighlight/CdsHighlight.css +0 -18
- package/dist/es/src/components/CdsHighlight/api/CdsHighlight.props.js +32 -8
- package/dist/es/src/components/CdsHighlight/api/CdsHighlight.props.js.map +1 -1
- package/dist/es/src/components/CdsIcon/CdsIcon.css +0 -18
- package/dist/es/src/components/CdsIcon/api/CdsIcon.props.js +17 -4
- package/dist/es/src/components/CdsIcon/api/CdsIcon.props.js.map +1 -1
- package/dist/es/src/components/CdsImage/CdsImage.css +0 -18
- package/dist/es/src/components/CdsImage/CdsImage.vue_vue_type_script_setup_true_lang.js +20 -0
- package/dist/es/src/components/CdsImage/CdsImage.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsImage/api/CdsImage.props.js +64 -16
- package/dist/es/src/components/CdsImage/api/CdsImage.props.js.map +1 -1
- package/dist/es/src/components/CdsInput/CdsInput.css +0 -18
- package/dist/es/src/components/CdsInput/CdsInput.vue_vue_type_script_setup_true_lang.js +44 -11
- package/dist/es/src/components/CdsInput/CdsInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsInput/api/CdsInput.props.js +48 -12
- package/dist/es/src/components/CdsInput/api/CdsInput.props.js.map +1 -1
- package/dist/es/src/components/CdsLabel/CdsLabel.css +0 -18
- package/dist/es/src/components/CdsLabel/api/CdsLabel.props.js +4 -0
- package/dist/es/src/components/CdsLabel/api/CdsLabel.props.js.map +1 -1
- package/dist/es/src/components/CdsLayout/CdsLayout.css +0 -18
- package/dist/es/src/components/CdsLayout/api/CdsLayout.props.js +5 -1
- package/dist/es/src/components/CdsLayout/api/CdsLayout.props.js.map +1 -1
- package/dist/es/src/components/CdsLink/CdsLink.css +0 -18
- package/dist/es/src/components/CdsLink/api/CdsLink.props.js +4 -1
- package/dist/es/src/components/CdsLink/api/CdsLink.props.js.map +1 -1
- package/dist/es/src/components/CdsList/CdsList.css +0 -18
- package/dist/es/src/components/CdsList/CdsList.vue_vue_type_script_setup_true_lang.js +25 -7
- package/dist/es/src/components/CdsList/CdsList.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsList/CdsListGroup.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/src/components/CdsList/CdsListGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsList/CdsListItem.css +0 -18
- package/dist/es/src/components/CdsList/CdsListItem.vue_vue_type_script_setup_true_lang.js +29 -8
- package/dist/es/src/components/CdsList/CdsListItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsList/CdsListItemAction.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/src/components/CdsList/CdsListItemAction.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsList/CdsListItemDivider.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsList/CdsListItemMedia.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/src/components/CdsList/CdsListItemMedia.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsList/CdsListSubheader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/src/components/CdsList/CdsListSubheader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsList/api/CdsList.constants.js +4 -4
- package/dist/es/src/components/CdsList/api/CdsList.props.js +147 -39
- package/dist/es/src/components/CdsList/api/CdsList.props.js.map +1 -1
- package/dist/es/src/components/CdsList/components/ListChildren.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/src/components/CdsList/components/ListChildren.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsList/components/ListGroupActivator.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsList/index.js +5 -2
- package/dist/es/src/components/CdsList/index.js.map +1 -1
- package/dist/es/src/components/CdsLoader/CdsLoader.css +0 -18
- package/dist/es/src/components/CdsLoader/api/CdsLoader.props.js +12 -3
- package/dist/es/src/components/CdsLoader/api/CdsLoader.props.js.map +1 -1
- package/dist/es/src/components/CdsMain/CdsMain.css +0 -18
- package/dist/es/src/components/CdsMenu/CdsMenu.css +0 -18
- package/dist/es/src/components/CdsMenu/api/CdsMenu.props.js +8 -2
- package/dist/es/src/components/CdsMenu/api/CdsMenu.props.js.map +1 -1
- package/dist/es/src/components/CdsMessages/CdsMessages.css +0 -18
- package/dist/es/src/components/CdsMessages/api/CdsMessages.props.js +12 -3
- package/dist/es/src/components/CdsMessages/api/CdsMessages.props.js.map +1 -1
- package/dist/es/src/components/CdsModal/CdsModal.css +0 -18
- package/dist/es/src/components/CdsModal/api/CdsModal.props.js +8 -2
- package/dist/es/src/components/CdsModal/api/CdsModal.props.js.map +1 -1
- package/dist/es/src/components/CdsNotification/CdsNotification.css +0 -18
- package/dist/es/src/components/CdsNotification/api/CdsNotification.props.js +28 -7
- package/dist/es/src/components/CdsNotification/api/CdsNotification.props.js.map +1 -1
- package/dist/es/src/components/CdsNotificationAlert/CdsNotificationAlert.css +0 -18
- package/dist/es/src/components/CdsNotificationAlert/api/CdsNotificationAlert.props.js +28 -7
- package/dist/es/src/components/CdsNotificationAlert/api/CdsNotificationAlert.props.js.map +1 -1
- package/dist/es/src/components/CdsOtpInput/CdsOtpInput.css +0 -18
- package/dist/es/src/components/CdsOtpInput/CdsOtpInput.vue_vue_type_script_setup_true_lang.js +20 -5
- package/dist/es/src/components/CdsOtpInput/CdsOtpInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsOtpInput/api/CdsOtpInput.props.js +52 -13
- package/dist/es/src/components/CdsOtpInput/api/CdsOtpInput.props.js.map +1 -1
- package/dist/es/src/components/CdsOverlay/CdsOverlay.css +0 -18
- package/dist/es/src/components/CdsOverlay/CdsOverlay.vue_vue_type_script_setup_true_lang.js +44 -11
- package/dist/es/src/components/CdsOverlay/CdsOverlay.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsOverlay/api/CdsOverlay.props.js +36 -8
- package/dist/es/src/components/CdsOverlay/api/CdsOverlay.props.js.map +1 -1
- package/dist/es/src/components/CdsOverlay/composables/useActivator.js +25 -6
- package/dist/es/src/components/CdsOverlay/composables/useActivator.js.map +1 -1
- package/dist/es/src/components/CdsOverlay/composables/useLocationStrategies.js +18 -4
- package/dist/es/src/components/CdsOverlay/composables/useLocationStrategies.js.map +1 -1
- package/dist/es/src/components/CdsOverlay/composables/useScrollStrategies.js +4 -1
- package/dist/es/src/components/CdsOverlay/composables/useScrollStrategies.js.map +1 -1
- package/dist/es/src/components/CdsPage/CdsPage.css +0 -18
- package/dist/es/src/components/CdsPage/api/CdsPage.props.js +5 -1
- package/dist/es/src/components/CdsPage/api/CdsPage.props.js.map +1 -1
- package/dist/es/src/components/CdsPagination/CdsPagination.css +0 -18
- package/dist/es/src/components/CdsPagination/CdsPagination.vue_vue_type_script_setup_true_lang.js +16 -0
- package/dist/es/src/components/CdsPagination/CdsPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsPagination/api/CdsPagination.props.js +84 -21
- package/dist/es/src/components/CdsPagination/api/CdsPagination.props.js.map +1 -1
- package/dist/es/src/components/CdsProgressBar/CdsProgressBar.css +0 -18
- package/dist/es/src/components/CdsProgressBar/api/CdsProgressBar.props.js +64 -16
- package/dist/es/src/components/CdsProgressBar/api/CdsProgressBar.props.js.map +1 -1
- package/dist/es/src/components/CdsProgressBar/composables/useChunk.js +4 -0
- package/dist/es/src/components/CdsProgressBar/composables/useChunk.js.map +1 -1
- package/dist/es/src/components/CdsProgressCircle/CdsProgressCircle.css +0 -18
- package/dist/es/src/components/CdsProgressCircle/api/CdsProgressCircle.props.js +28 -7
- package/dist/es/src/components/CdsProgressCircle/api/CdsProgressCircle.props.js.map +1 -1
- package/dist/es/src/components/CdsRadio/CdsRadio.css +0 -18
- package/dist/es/src/components/CdsRadioGroup/CdsRadioGroup.css +0 -18
- package/dist/es/src/components/CdsRadioGroup/api/CdsRadioGroup.props.js +16 -4
- package/dist/es/src/components/CdsRadioGroup/api/CdsRadioGroup.props.js.map +1 -1
- package/dist/es/src/components/CdsResponsive/CdsResponsive.css +0 -18
- package/dist/es/src/components/CdsResponsive/api/CdsResponsive.props.js +12 -3
- package/dist/es/src/components/CdsResponsive/api/CdsResponsive.props.js.map +1 -1
- package/dist/es/src/components/CdsSelect/CdsSelect.css +0 -18
- package/dist/es/src/components/CdsSelect/CdsSelect.vue_vue_type_script_setup_true_lang.js +16 -4
- package/dist/es/src/components/CdsSelect/CdsSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsSelect/api/CdsSelect.props.js +4 -1
- package/dist/es/src/components/CdsSelect/api/CdsSelect.props.js.map +1 -1
- package/dist/es/src/components/CdsSelect/composables/useMenuActivator.js +8 -2
- package/dist/es/src/components/CdsSelect/composables/useMenuActivator.js.map +1 -1
- package/dist/es/src/components/CdsSelect/composables/useSelect.js +69 -17
- package/dist/es/src/components/CdsSelect/composables/useSelect.js.map +1 -1
- package/dist/es/src/components/CdsSelectionControl/CdsSelectionControl.css +0 -18
- package/dist/es/src/components/CdsSelectionControl/CdsSelectionControl.vue_vue_type_script_setup_true_lang.js +8 -0
- package/dist/es/src/components/CdsSelectionControl/CdsSelectionControl.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsSelectionControl/api/CdsSelectionControl.props.js +12 -3
- package/dist/es/src/components/CdsSelectionControl/api/CdsSelectionControl.props.js.map +1 -1
- package/dist/es/src/components/CdsSelectionControlGroup/CdsSelectionControlGroup.css +0 -18
- package/dist/es/src/components/CdsSelectionControlGroup/api/CdsSelectionControlGroup.props.js +44 -11
- package/dist/es/src/components/CdsSelectionControlGroup/api/CdsSelectionControlGroup.props.js.map +1 -1
- package/dist/es/src/components/CdsSkeletonLoader/CdsSkeletonLoader.css +0 -18
- package/dist/es/src/components/CdsSkeletonLoader/api/CdsSkeletonLoader.props.js +16 -4
- package/dist/es/src/components/CdsSkeletonLoader/api/CdsSkeletonLoader.props.js.map +1 -1
- package/dist/es/src/components/CdsSkeletonLoader/api/CdsSkeletonLoader.types.js.map +1 -1
- package/dist/es/src/components/CdsSlideGroup/CdsSlideGroup.css +0 -18
- package/dist/es/src/components/CdsSlideGroup/CdsSlideGroup.vue_vue_type_script_setup_true_lang.js +24 -6
- package/dist/es/src/components/CdsSlideGroup/CdsSlideGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsSlideGroup/api/CdsSlideGroup.props.js +25 -6
- package/dist/es/src/components/CdsSlideGroup/api/CdsSlideGroup.props.js.map +1 -1
- package/dist/es/src/components/CdsSlideView/CdsSlideView.css +0 -18
- package/dist/es/src/components/CdsSlideView/CdsSlideView.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/src/components/CdsSlideView/CdsSlideView.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsSlideView/CdsSlideViewItem.vue_vue_type_script_setup_true_lang.js +5 -1
- package/dist/es/src/components/CdsSlideView/CdsSlideViewItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsSlideView/api/CdsSlideView.props.js +44 -0
- package/dist/es/src/components/CdsSlideView/api/CdsSlideView.props.js.map +1 -1
- package/dist/es/src/components/CdsStages/CdsStages.css +0 -18
- package/dist/es/src/components/CdsStages/CdsStages.vue_vue_type_script_setup_true_lang.js +8 -0
- package/dist/es/src/components/CdsStages/CdsStages.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsStages/api/CdsStages.props.js +8 -2
- package/dist/es/src/components/CdsStages/api/CdsStages.props.js.map +1 -1
- package/dist/es/src/components/CdsStatus/CdsStatus.css +0 -18
- package/dist/es/src/components/CdsStatus/api/CdsStatus.props.js +4 -1
- package/dist/es/src/components/CdsStatus/api/CdsStatus.props.js.map +1 -1
- package/dist/es/src/components/CdsSteps/CdsSteps.css +0 -18
- package/dist/es/src/components/CdsSteps/CdsSteps.vue_vue_type_script_setup_true_lang.js +8 -0
- package/dist/es/src/components/CdsSteps/CdsSteps.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsSteps/api/CdsSteps.props.js +44 -11
- package/dist/es/src/components/CdsSteps/api/CdsSteps.props.js.map +1 -1
- package/dist/es/src/components/CdsSurface/CdsSurface.css +0 -18
- package/dist/es/src/components/CdsSurface/api/CdsSurface.props.js +4 -1
- package/dist/es/src/components/CdsSurface/api/CdsSurface.props.js.map +1 -1
- package/dist/es/src/components/CdsTable/CdsTable.css +0 -18
- package/dist/es/src/components/CdsTable/CdsTable.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/src/components/CdsTable/CdsTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsTable/composable/table.js +47 -0
- package/dist/es/src/components/CdsTable/composable/table.js.map +1 -1
- package/dist/es/src/components/CdsTabs/CdsTabs.css +0 -18
- package/dist/es/src/components/CdsTabs/api/CdsTabs.props.js +56 -0
- package/dist/es/src/components/CdsTabs/api/CdsTabs.props.js.map +1 -1
- package/dist/es/src/components/CdsTag/CdsTag.css +0 -18
- package/dist/es/src/components/CdsTag/api/CdsTag.props.js +72 -18
- package/dist/es/src/components/CdsTag/api/CdsTag.props.js.map +1 -1
- package/dist/es/src/components/CdsTagGroup/CdsTagGroup.css +0 -18
- package/dist/es/src/components/CdsTagGroup/CdsTagGroup.vue_vue_type_script_setup_true_lang.js +20 -5
- package/dist/es/src/components/CdsTagGroup/CdsTagGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsTagGroup/api/CdsTagGroup.props.js +11 -3
- package/dist/es/src/components/CdsTagGroup/api/CdsTagGroup.props.js.map +1 -1
- package/dist/es/src/components/CdsTextArea/CdsTextArea.css +0 -18
- package/dist/es/src/components/CdsTextArea/api/CdsTextArea.props.js +52 -13
- package/dist/es/src/components/CdsTextArea/api/CdsTextArea.props.js.map +1 -1
- package/dist/es/src/components/CdsTextInput/CdsTextInput.css +0 -18
- package/dist/es/src/components/CdsTextInput/api/CdsTextInput.props.js +40 -10
- package/dist/es/src/components/CdsTextInput/api/CdsTextInput.props.js.map +1 -1
- package/dist/es/src/components/CdsTimePicker/CdsTimePicker.css +0 -18
- package/dist/es/src/components/CdsTimePicker/CdsTimePicker.vue_vue_type_script_setup_true_lang.js +24 -0
- package/dist/es/src/components/CdsTimePicker/CdsTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsTimePicker/api/CdsTimePicker.props.js +32 -8
- package/dist/es/src/components/CdsTimePicker/api/CdsTimePicker.props.js.map +1 -1
- package/dist/es/src/components/CdsToast/CdsToast.css +0 -18
- package/dist/es/src/components/CdsToast/api/CdsToast.props.js +48 -12
- package/dist/es/src/components/CdsToast/api/CdsToast.props.js.map +1 -1
- package/dist/es/src/components/CdsToastQueue/CdsToastQueue.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/src/components/CdsToastQueue/CdsToastQueue.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsToastQueue/api/CdsToastQueue.props.js +28 -7
- package/dist/es/src/components/CdsToastQueue/api/CdsToastQueue.props.js.map +1 -1
- package/dist/es/src/components/CdsToggle/CdsToggle.css +0 -18
- package/dist/es/src/components/CdsToggle/api/CdsToggle.props.js +12 -3
- package/dist/es/src/components/CdsToggle/api/CdsToggle.props.js.map +1 -1
- package/dist/es/src/components/CdsToolbar/CdsToolbar.css +0 -18
- package/dist/es/src/components/CdsToolbar/api/CdsToolbar.props.js +20 -5
- package/dist/es/src/components/CdsToolbar/api/CdsToolbar.props.js.map +1 -1
- package/dist/es/src/components/CdsTooltip/CdsTooltip.css +0 -18
- package/dist/es/src/components/CdsTooltip/api/CdsTooltip.props.js +20 -5
- package/dist/es/src/components/CdsTooltip/api/CdsTooltip.props.js.map +1 -1
- package/dist/es/src/components/CdsTree/CdsTree.css +0 -18
- package/dist/es/src/components/CdsTree/CdsTree.vue_vue_type_script_setup_true_lang.js +16 -0
- package/dist/es/src/components/CdsTree/CdsTree.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsTree/composable/tree.js +28 -0
- package/dist/es/src/components/CdsTree/composable/tree.js.map +1 -1
- package/dist/es/src/components/CdsTree/composable/treeNode.js +68 -2
- package/dist/es/src/components/CdsTree/composable/treeNode.js.map +1 -1
- package/dist/es/src/components/CdsUploader/CdsUploader.css +0 -18
- package/dist/es/src/components/CdsUploader/CdsUploader.vue_vue_type_script_setup_true_lang.js +8 -0
- package/dist/es/src/components/CdsUploader/CdsUploader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsUploader/composables/useUpload.js +104 -26
- package/dist/es/src/components/CdsUploader/composables/useUpload.js.map +1 -1
- package/dist/es/src/components/CdsVirtualScroll/CdsVirtualScroll.css +0 -18
- package/dist/es/src/components/CdsVirtualScroll/CdsVirtualScroll.vue_vue_type_script_setup_true_lang.js +8 -0
- package/dist/es/src/components/CdsVirtualScroll/CdsVirtualScroll.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/es/src/components/CdsVirtualScroll/api/CdsVirtualScroll.props.js +12 -3
- package/dist/es/src/components/CdsVirtualScroll/api/CdsVirtualScroll.props.js.map +1 -1
- package/dist/es/src/components/index.js +2 -1
- package/dist/es/src/components/index.js.map +1 -1
- package/dist/es/src/composables/useAppearance/useAppearance.js +4 -1
- package/dist/es/src/composables/useAppearance/useAppearance.js.map +1 -1
- package/dist/es/src/composables/useColor/useColor.js +20 -5
- package/dist/es/src/composables/useColor/useColor.js.map +1 -1
- package/dist/es/src/composables/useDatetime/useDatetime.js +3 -0
- package/dist/es/src/composables/useDatetime/useDatetime.js.map +1 -1
- package/dist/es/src/composables/useDelay/useDelay.js +8 -2
- package/dist/es/src/composables/useDelay/useDelay.js.map +1 -1
- package/dist/es/src/composables/useDimensions/useDimensions.js +24 -6
- package/dist/es/src/composables/useDimensions/useDimensions.js.map +1 -1
- package/dist/es/src/composables/useDirection/useDirection.js +4 -1
- package/dist/es/src/composables/useDirection/useDirection.js.map +1 -1
- package/dist/es/src/composables/useDisabled/useDisabled.js +4 -1
- package/dist/es/src/composables/useDisabled/useDisabled.js.map +1 -1
- package/dist/es/src/composables/useDisplay/useDisplay.js +2 -0
- package/dist/es/src/composables/useDisplay/useDisplay.js.map +1 -1
- package/dist/es/src/composables/useFilter/useFilter.js +20 -0
- package/dist/es/src/composables/useFilter/useFilter.js.map +1 -1
- package/dist/es/src/composables/useFocus/useFocus.js +12 -3
- package/dist/es/src/composables/useFocus/useFocus.js.map +1 -1
- package/dist/es/src/composables/useFocus/useFocusTrap.js +8 -2
- package/dist/es/src/composables/useFocus/useFocusTrap.js.map +1 -1
- package/dist/es/src/composables/useForm/useForm.js +45 -0
- package/dist/es/src/composables/useForm/useForm.js.map +1 -1
- package/dist/es/src/composables/useGroup/useGroup.js +24 -6
- package/dist/es/src/composables/useGroup/useGroup.js.map +1 -1
- package/dist/es/src/composables/useGroup/useGroupItem.js +8 -2
- package/dist/es/src/composables/useGroup/useGroupItem.js.map +1 -1
- package/dist/es/src/composables/useItems/useItems.js +32 -8
- package/dist/es/src/composables/useItems/useItems.js.map +1 -1
- package/dist/es/src/composables/useLayout/context.js.map +1 -1
- package/dist/es/src/composables/useLayout/useLayout.js +24 -6
- package/dist/es/src/composables/useLayout/useLayout.js.map +1 -1
- package/dist/es/src/composables/useLazy/useLazy.js +1 -0
- package/dist/es/src/composables/useLazy/useLazy.js.map +1 -1
- package/dist/es/src/composables/useLoader/useLoader.js +4 -1
- package/dist/es/src/composables/useLoader/useLoader.js.map +1 -1
- package/dist/es/src/composables/useLocation/useLocation.js +4 -1
- package/dist/es/src/composables/useLocation/useLocation.js.map +1 -1
- package/dist/es/src/composables/useNested/useNested.js +44 -11
- package/dist/es/src/composables/useNested/useNested.js.map +1 -1
- package/dist/es/src/composables/usePosition/usePosition.js +4 -0
- package/dist/es/src/composables/usePosition/usePosition.js.map +1 -1
- package/dist/es/src/composables/useReadonly/useReadonly.js +4 -1
- package/dist/es/src/composables/useReadonly/useReadonly.js.map +1 -1
- package/dist/es/src/composables/useReveal/useReveal.js +4 -1
- package/dist/es/src/composables/useReveal/useReveal.js.map +1 -1
- package/dist/es/src/composables/useRouter/useRouter.js +16 -4
- package/dist/es/src/composables/useRouter/useRouter.js.map +1 -1
- package/dist/es/src/composables/useSize/useSize.js +4 -1
- package/dist/es/src/composables/useSize/useSize.js.map +1 -1
- package/dist/es/src/composables/useStatus/useStatus.js +4 -1
- package/dist/es/src/composables/useStatus/useStatus.js.map +1 -1
- package/dist/es/src/composables/useText/useText.js +8 -2
- package/dist/es/src/composables/useText/useText.js.map +1 -1
- package/dist/es/src/composables/useTheme/useTheme.js +4 -1
- package/dist/es/src/composables/useTheme/useTheme.js.map +1 -1
- package/dist/es/src/composables/useTransition/useTransition.js +4 -1
- package/dist/es/src/composables/useTransition/useTransition.js.map +1 -1
- package/dist/es/src/composables/useValidation/useValidation.js +26 -6
- package/dist/es/src/composables/useValidation/useValidation.js.map +1 -1
- package/dist/es/src/composables/useVirtual/useVirtual.js +12 -3
- package/dist/es/src/composables/useVirtual/useVirtual.js.map +1 -1
- package/dist/es/src/core/defineComponent.js +4 -1
- package/dist/es/src/core/defineComponent.js.map +1 -1
- package/dist/es/src/themes/lumaDark.js +8 -4
- package/dist/es/src/themes/lumaDark.js.map +1 -1
- package/dist/es/src/utils/date/date.js +4 -4
- package/dist/es/src/utils/date/date.js.map +1 -1
- package/dist/esm-node/entry.css +0 -18
- package/dist/esm-node/entry.mjs +3 -2
- package/dist/esm-node/src/cds.mjs +1 -1
- package/dist/esm-node/src/components/CdsApp/CdsApp.css +0 -18
- package/dist/esm-node/src/components/CdsApp/api/CdsApp.props.mjs +1 -0
- package/dist/esm-node/src/components/CdsAutocomplete/CdsAutocomplete.css +0 -18
- package/dist/esm-node/src/components/CdsAutocomplete/CdsAutocomplete.vue_vue_type_script_setup_true_lang.mjs +20 -5
- package/dist/esm-node/src/components/CdsAutocomplete/api/CdsAutocomplete.props.mjs +9 -2
- package/dist/esm-node/src/components/CdsAvatar/CdsAvatar.css +0 -18
- package/dist/esm-node/src/components/CdsAvatar/api/CdsAvatar.props.mjs +20 -5
- package/dist/esm-node/src/components/CdsBadge/CdsBadge.css +0 -18
- package/dist/esm-node/src/components/CdsBadge/api/CdsBadge.props.mjs +37 -9
- package/dist/esm-node/src/components/CdsBreadcrumbs/CdsBreadcrumbs.css +0 -18
- package/dist/esm-node/src/components/CdsBreadcrumbs/api/CdsBreadcrumbs.props.mjs +32 -8
- package/dist/esm-node/src/components/CdsButton/CdsButton.css +0 -18
- package/dist/esm-node/src/components/CdsButton/CdsButton.vue_vue_type_script_setup_true_lang.mjs +4 -1
- package/dist/esm-node/src/components/CdsButton/api/CdsButton.props.mjs +28 -7
- package/dist/esm-node/src/components/CdsButtonGroup/CdsButtonGroup.css +0 -18
- package/dist/esm-node/src/components/CdsButtonGroup/api/CdsButtonGroup.props.mjs +4 -1
- package/dist/esm-node/src/components/CdsButtonToggle/CdsButtonToggle.css +0 -18
- package/dist/esm-node/src/components/CdsButtonToggle/CdsButtonToggle.vue_vue_type_script_setup_true_lang.mjs +20 -5
- package/dist/esm-node/src/components/CdsCard/CdsCard.css +0 -18
- package/dist/esm-node/src/components/CdsCard/CdsCard.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/esm-node/src/components/CdsCard/CdsCardActions.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/esm-node/src/components/CdsCard/CdsCardDivider.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/esm-node/src/components/CdsCard/CdsCardGroup.vue_vue_type_script_setup_true_lang.mjs +21 -6
- package/dist/esm-node/src/components/CdsCard/CdsCardItem.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/esm-node/src/components/CdsCard/CdsCardSubtitle.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/esm-node/src/components/CdsCard/CdsCardText.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/esm-node/src/components/CdsCard/CdsCardTitle.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/esm-node/src/components/CdsCard/api/CdsCard.constants.mjs +9 -9
- package/dist/esm-node/src/components/CdsCard/api/CdsCard.props.mjs +85 -21
- package/dist/esm-node/src/components/CdsCard/index.mjs +1 -1
- package/dist/esm-node/src/components/CdsCarousel/CdsCarousel.css +0 -18
- package/dist/esm-node/src/components/CdsCarousel/api/CdsCarousel.props.mjs +36 -9
- package/dist/esm-node/src/components/CdsCheckbox/CdsCheckbox.css +0 -18
- package/dist/esm-node/src/components/CdsCheckboxButton/CdsCheckboxButton.css +0 -18
- package/dist/esm-node/src/components/CdsCheckboxButton/api/CdsCheckboxButton.props.mjs +8 -2
- package/dist/esm-node/src/components/CdsCombobox/CdsCombobox.css +0 -18
- package/dist/esm-node/src/components/CdsCombobox/CdsCombobox.vue_vue_type_script_setup_true_lang.mjs +24 -6
- package/dist/esm-node/src/components/CdsCombobox/api/CdsCombobox.props.mjs +13 -3
- package/dist/esm-node/src/components/CdsCounter/CdsCounter.css +0 -18
- package/dist/esm-node/src/components/CdsCounter/api/CdsCounter.props.mjs +12 -3
- package/dist/esm-node/src/components/CdsDateInput/CdsDateInput.css +0 -18
- package/dist/esm-node/src/components/CdsDateInput/CdsDateInput.vue_vue_type_script_setup_true_lang.mjs +8 -0
- package/dist/esm-node/src/components/CdsDateInput/api/CdsDateInput.props.mjs +31 -7
- package/dist/esm-node/src/components/CdsDatePicker/CdsDatePicker.css +0 -18
- package/dist/esm-node/src/components/CdsDatePicker/CdsDatePicker.vue_vue_type_script_setup_true_lang.mjs +20 -0
- package/dist/esm-node/src/components/CdsDatePicker/api/CdsDatePicker.props.mjs +64 -15
- package/dist/esm-node/src/components/CdsDefaultsProvider/api/CdsDefaultsProvider.props.mjs +5 -0
- package/dist/esm-node/src/components/CdsDescription/CdsDescription.css +0 -18
- package/dist/esm-node/src/components/CdsDivider/CdsDivider.css +0 -18
- package/dist/esm-node/src/components/CdsDivider/api/CdsDivider.props.mjs +33 -8
- package/dist/esm-node/src/components/CdsDrawer/CdsDrawer.css +0 -18
- package/dist/esm-node/src/components/CdsDrawer/CdsDrawer.vue_vue_type_script_setup_true_lang.mjs +4 -0
- package/dist/esm-node/src/components/CdsDrawer/api/CdsDrawer.props.mjs +32 -8
- package/dist/esm-node/src/components/CdsEmptyState/CdsEmptyState.css +0 -18
- package/dist/esm-node/src/components/CdsEmptyState/api/CdsEmptyState.props.mjs +33 -8
- package/dist/esm-node/src/components/CdsExpandablePanel/CdsExpandablePanel.vue_vue_type_script_setup_true_lang.mjs +16 -4
- package/dist/esm-node/src/components/CdsExpandablePanel/CdsExpandablePanelTitle.vue_vue_type_script_setup_true_lang.mjs +8 -2
- package/dist/esm-node/src/components/CdsExpandablePanel/CdsExpandablePanels.css +0 -18
- package/dist/esm-node/src/components/CdsExpandablePanel/CdsExpandablePanels.vue_vue_type_script_setup_true_lang.mjs +8 -2
- package/dist/esm-node/src/components/CdsExpandablePanel/api/CdsExpandablePanel.props.mjs +38 -9
- package/dist/esm-node/src/components/CdsField/CdsField.css +0 -18
- package/dist/esm-node/src/components/CdsField/CdsField.vue_vue_type_script_setup_true_lang.mjs +13 -3
- package/dist/esm-node/src/components/CdsField/api/CdsField.props.mjs +56 -14
- package/dist/esm-node/src/components/CdsField/composables/useAutocomplete.mjs +1 -0
- package/dist/esm-node/src/components/CdsFileInput/CdsFileInput.css +0 -18
- package/dist/esm-node/src/components/CdsFileInput/api/CdsFileInput.props.mjs +40 -10
- package/dist/esm-node/src/components/CdsFileInput/composables/useFileFilter.mjs +4 -1
- package/dist/esm-node/src/components/CdsFileUpload/CdsFileUpload.css +0 -18
- package/dist/esm-node/src/components/CdsFileUpload/CdsFileUpload.vue_vue_type_script_setup_true_lang.mjs +4 -0
- package/dist/esm-node/src/components/CdsFileUpload/api/CdsFileUpload.props.mjs +85 -21
- package/dist/esm-node/src/components/CdsFooter/CdsFooter.css +0 -18
- package/dist/esm-node/src/components/CdsForm/CdsForm.css +0 -18
- package/dist/esm-node/src/components/CdsForm/api/CdsForm.props.mjs +8 -2
- package/dist/esm-node/src/components/CdsFunctionalButton/CdsFunctionalButton.css +0 -18
- package/dist/esm-node/src/components/CdsFunctionalButton/api/CdsFunctionalButton.props.mjs +4 -1
- package/dist/esm-node/src/components/CdsGrid/api/CdsGrid.props.mjs +40 -10
- package/dist/esm-node/src/components/CdsGrid/components/CSSGrid.css +0 -18
- package/dist/esm-node/src/components/CdsGrid/components/FlexGrid.css +0 -18
- package/dist/esm-node/src/components/CdsHeader/CdsHeader.css +0 -18
- package/dist/esm-node/src/components/CdsHighlight/CdsHighlight.css +0 -18
- package/dist/esm-node/src/components/CdsHighlight/api/CdsHighlight.props.mjs +32 -8
- package/dist/esm-node/src/components/CdsIcon/CdsIcon.css +0 -18
- package/dist/esm-node/src/components/CdsIcon/api/CdsIcon.props.mjs +17 -4
- package/dist/esm-node/src/components/CdsImage/CdsImage.css +0 -18
- package/dist/esm-node/src/components/CdsImage/CdsImage.vue_vue_type_script_setup_true_lang.mjs +20 -0
- package/dist/esm-node/src/components/CdsImage/api/CdsImage.props.mjs +64 -16
- package/dist/esm-node/src/components/CdsInput/CdsInput.css +0 -18
- package/dist/esm-node/src/components/CdsInput/CdsInput.vue_vue_type_script_setup_true_lang.mjs +44 -11
- package/dist/esm-node/src/components/CdsInput/api/CdsInput.props.mjs +48 -12
- package/dist/esm-node/src/components/CdsLabel/CdsLabel.css +0 -18
- package/dist/esm-node/src/components/CdsLabel/api/CdsLabel.props.mjs +4 -0
- package/dist/esm-node/src/components/CdsLayout/CdsLayout.css +0 -18
- package/dist/esm-node/src/components/CdsLayout/api/CdsLayout.props.mjs +5 -1
- package/dist/esm-node/src/components/CdsLink/CdsLink.css +0 -18
- package/dist/esm-node/src/components/CdsLink/api/CdsLink.props.mjs +4 -1
- package/dist/esm-node/src/components/CdsList/CdsList.css +0 -18
- package/dist/esm-node/src/components/CdsList/CdsList.vue_vue_type_script_setup_true_lang.mjs +24 -6
- package/dist/esm-node/src/components/CdsList/CdsListGroup.vue_vue_type_script_setup_true_lang.mjs +4 -1
- package/dist/esm-node/src/components/CdsList/CdsListItem.css +0 -18
- package/dist/esm-node/src/components/CdsList/CdsListItem.vue_vue_type_script_setup_true_lang.mjs +28 -7
- package/dist/esm-node/src/components/CdsList/CdsListItemAction.vue_vue_type_script_setup_true_lang.mjs +8 -2
- package/dist/esm-node/src/components/CdsList/CdsListItemMedia.vue_vue_type_script_setup_true_lang.mjs +8 -2
- package/dist/esm-node/src/components/CdsList/api/CdsList.props.mjs +144 -36
- package/dist/esm-node/src/components/CdsList/components/ListChildren.vue_vue_type_script_setup_true_lang.mjs +8 -2
- package/dist/esm-node/src/components/CdsList/index.mjs +5 -2
- package/dist/esm-node/src/components/CdsLoader/CdsLoader.css +0 -18
- package/dist/esm-node/src/components/CdsLoader/api/CdsLoader.props.mjs +12 -3
- package/dist/esm-node/src/components/CdsMain/CdsMain.css +0 -18
- package/dist/esm-node/src/components/CdsMenu/CdsMenu.css +0 -18
- package/dist/esm-node/src/components/CdsMenu/api/CdsMenu.props.mjs +8 -2
- package/dist/esm-node/src/components/CdsMessages/CdsMessages.css +0 -18
- package/dist/esm-node/src/components/CdsMessages/api/CdsMessages.props.mjs +12 -3
- package/dist/esm-node/src/components/CdsModal/CdsModal.css +0 -18
- package/dist/esm-node/src/components/CdsModal/api/CdsModal.props.mjs +8 -2
- package/dist/esm-node/src/components/CdsNotification/CdsNotification.css +0 -18
- package/dist/esm-node/src/components/CdsNotification/api/CdsNotification.props.mjs +28 -7
- package/dist/esm-node/src/components/CdsNotificationAlert/CdsNotificationAlert.css +0 -18
- package/dist/esm-node/src/components/CdsNotificationAlert/api/CdsNotificationAlert.props.mjs +28 -7
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpInput.css +0 -18
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpInput.vue_vue_type_script_setup_true_lang.mjs +20 -5
- package/dist/esm-node/src/components/CdsOtpInput/api/CdsOtpInput.props.mjs +52 -13
- package/dist/esm-node/src/components/CdsOverlay/CdsOverlay.css +0 -18
- package/dist/esm-node/src/components/CdsOverlay/CdsOverlay.vue_vue_type_script_setup_true_lang.mjs +44 -11
- package/dist/esm-node/src/components/CdsOverlay/api/CdsOverlay.props.mjs +36 -8
- package/dist/esm-node/src/components/CdsOverlay/composables/useActivator.mjs +25 -6
- package/dist/esm-node/src/components/CdsOverlay/composables/useLocationStrategies.mjs +18 -4
- package/dist/esm-node/src/components/CdsOverlay/composables/useScrollStrategies.mjs +4 -1
- package/dist/esm-node/src/components/CdsPage/CdsPage.css +0 -18
- package/dist/esm-node/src/components/CdsPage/api/CdsPage.props.mjs +5 -1
- package/dist/esm-node/src/components/CdsPagination/CdsPagination.css +0 -18
- package/dist/esm-node/src/components/CdsPagination/CdsPagination.vue_vue_type_script_setup_true_lang.mjs +16 -0
- package/dist/esm-node/src/components/CdsPagination/api/CdsPagination.props.mjs +84 -21
- package/dist/esm-node/src/components/CdsProgressBar/CdsProgressBar.css +0 -18
- package/dist/esm-node/src/components/CdsProgressBar/api/CdsProgressBar.props.mjs +64 -16
- package/dist/esm-node/src/components/CdsProgressBar/composables/useChunk.mjs +4 -0
- package/dist/esm-node/src/components/CdsProgressCircle/CdsProgressCircle.css +0 -18
- package/dist/esm-node/src/components/CdsProgressCircle/api/CdsProgressCircle.props.mjs +28 -7
- package/dist/esm-node/src/components/CdsRadio/CdsRadio.css +0 -18
- package/dist/esm-node/src/components/CdsRadioGroup/CdsRadioGroup.css +0 -18
- package/dist/esm-node/src/components/CdsRadioGroup/api/CdsRadioGroup.props.mjs +16 -4
- package/dist/esm-node/src/components/CdsResponsive/CdsResponsive.css +0 -18
- package/dist/esm-node/src/components/CdsResponsive/api/CdsResponsive.props.mjs +12 -3
- package/dist/esm-node/src/components/CdsSelect/CdsSelect.css +0 -18
- package/dist/esm-node/src/components/CdsSelect/CdsSelect.vue_vue_type_script_setup_true_lang.mjs +16 -4
- package/dist/esm-node/src/components/CdsSelect/api/CdsSelect.props.mjs +4 -1
- package/dist/esm-node/src/components/CdsSelect/composables/useMenuActivator.mjs +8 -2
- package/dist/esm-node/src/components/CdsSelect/composables/useSelect.mjs +69 -17
- package/dist/esm-node/src/components/CdsSelectionControl/CdsSelectionControl.css +0 -18
- package/dist/esm-node/src/components/CdsSelectionControl/CdsSelectionControl.vue_vue_type_script_setup_true_lang.mjs +8 -0
- package/dist/esm-node/src/components/CdsSelectionControl/api/CdsSelectionControl.props.mjs +12 -3
- package/dist/esm-node/src/components/CdsSelectionControlGroup/CdsSelectionControlGroup.css +0 -18
- package/dist/esm-node/src/components/CdsSelectionControlGroup/api/CdsSelectionControlGroup.props.mjs +44 -11
- package/dist/esm-node/src/components/CdsSkeletonLoader/CdsSkeletonLoader.css +0 -18
- package/dist/esm-node/src/components/CdsSkeletonLoader/api/CdsSkeletonLoader.props.mjs +16 -4
- package/dist/esm-node/src/components/CdsSlideGroup/CdsSlideGroup.css +0 -18
- package/dist/esm-node/src/components/CdsSlideGroup/CdsSlideGroup.vue_vue_type_script_setup_true_lang.mjs +24 -6
- package/dist/esm-node/src/components/CdsSlideGroup/api/CdsSlideGroup.props.mjs +25 -6
- package/dist/esm-node/src/components/CdsSlideView/CdsSlideView.css +0 -18
- package/dist/esm-node/src/components/CdsSlideView/CdsSlideView.vue_vue_type_script_setup_true_lang.mjs +4 -0
- package/dist/esm-node/src/components/CdsSlideView/CdsSlideViewItem.vue_vue_type_script_setup_true_lang.mjs +5 -1
- package/dist/esm-node/src/components/CdsSlideView/api/CdsSlideView.props.mjs +44 -0
- package/dist/esm-node/src/components/CdsStages/CdsStages.css +0 -18
- package/dist/esm-node/src/components/CdsStages/CdsStages.vue_vue_type_script_setup_true_lang.mjs +8 -0
- package/dist/esm-node/src/components/CdsStages/api/CdsStages.props.mjs +8 -2
- package/dist/esm-node/src/components/CdsStatus/CdsStatus.css +0 -18
- package/dist/esm-node/src/components/CdsStatus/api/CdsStatus.props.mjs +4 -1
- package/dist/esm-node/src/components/CdsSteps/CdsSteps.css +0 -18
- package/dist/esm-node/src/components/CdsSteps/CdsSteps.vue_vue_type_script_setup_true_lang.mjs +8 -0
- package/dist/esm-node/src/components/CdsSteps/api/CdsSteps.props.mjs +44 -11
- package/dist/esm-node/src/components/CdsSurface/CdsSurface.css +0 -18
- package/dist/esm-node/src/components/CdsSurface/api/CdsSurface.props.mjs +4 -1
- package/dist/esm-node/src/components/CdsTable/CdsTable.css +0 -18
- package/dist/esm-node/src/components/CdsTable/CdsTable.vue_vue_type_script_setup_true_lang.mjs +4 -0
- package/dist/esm-node/src/components/CdsTable/composable/table.mjs +47 -0
- package/dist/esm-node/src/components/CdsTabs/CdsTabs.css +0 -18
- package/dist/esm-node/src/components/CdsTabs/api/CdsTabs.props.mjs +56 -0
- package/dist/esm-node/src/components/CdsTag/CdsTag.css +0 -18
- package/dist/esm-node/src/components/CdsTag/api/CdsTag.props.mjs +72 -18
- package/dist/esm-node/src/components/CdsTagGroup/CdsTagGroup.css +0 -18
- package/dist/esm-node/src/components/CdsTagGroup/CdsTagGroup.vue_vue_type_script_setup_true_lang.mjs +20 -5
- package/dist/esm-node/src/components/CdsTagGroup/api/CdsTagGroup.props.mjs +11 -3
- package/dist/esm-node/src/components/CdsTextArea/CdsTextArea.css +0 -18
- package/dist/esm-node/src/components/CdsTextArea/api/CdsTextArea.props.mjs +52 -13
- package/dist/esm-node/src/components/CdsTextInput/CdsTextInput.css +0 -18
- package/dist/esm-node/src/components/CdsTextInput/api/CdsTextInput.props.mjs +40 -10
- package/dist/esm-node/src/components/CdsTimePicker/CdsTimePicker.css +0 -18
- package/dist/esm-node/src/components/CdsTimePicker/CdsTimePicker.vue_vue_type_script_setup_true_lang.mjs +24 -0
- package/dist/esm-node/src/components/CdsTimePicker/api/CdsTimePicker.props.mjs +32 -8
- package/dist/esm-node/src/components/CdsToast/CdsToast.css +0 -18
- package/dist/esm-node/src/components/CdsToast/api/CdsToast.props.mjs +48 -12
- package/dist/esm-node/src/components/CdsToastQueue/CdsToastQueue.vue_vue_type_script_setup_true_lang.mjs +4 -1
- package/dist/esm-node/src/components/CdsToastQueue/api/CdsToastQueue.props.mjs +28 -7
- package/dist/esm-node/src/components/CdsToggle/CdsToggle.css +0 -18
- package/dist/esm-node/src/components/CdsToggle/api/CdsToggle.props.mjs +12 -3
- package/dist/esm-node/src/components/CdsToolbar/CdsToolbar.css +0 -18
- package/dist/esm-node/src/components/CdsToolbar/api/CdsToolbar.props.mjs +20 -5
- package/dist/esm-node/src/components/CdsTooltip/CdsTooltip.css +0 -18
- package/dist/esm-node/src/components/CdsTooltip/api/CdsTooltip.props.mjs +20 -5
- package/dist/esm-node/src/components/CdsTree/CdsTree.css +0 -18
- package/dist/esm-node/src/components/CdsTree/CdsTree.vue_vue_type_script_setup_true_lang.mjs +16 -0
- package/dist/esm-node/src/components/CdsTree/composable/tree.mjs +28 -0
- package/dist/esm-node/src/components/CdsTree/composable/treeNode.mjs +68 -2
- package/dist/esm-node/src/components/CdsUploader/CdsUploader.css +0 -18
- package/dist/esm-node/src/components/CdsUploader/CdsUploader.vue_vue_type_script_setup_true_lang.mjs +8 -0
- package/dist/esm-node/src/components/CdsUploader/composables/useUpload.mjs +104 -26
- package/dist/esm-node/src/components/CdsVirtualScroll/CdsVirtualScroll.css +0 -18
- package/dist/esm-node/src/components/CdsVirtualScroll/CdsVirtualScroll.vue_vue_type_script_setup_true_lang.mjs +8 -0
- package/dist/esm-node/src/components/CdsVirtualScroll/api/CdsVirtualScroll.props.mjs +12 -3
- package/dist/esm-node/src/components/index.mjs +2 -1
- package/dist/esm-node/src/composables/useAppearance/useAppearance.mjs +4 -1
- package/dist/esm-node/src/composables/useColor/useColor.mjs +20 -5
- package/dist/esm-node/src/composables/useDatetime/useDatetime.mjs +3 -0
- package/dist/esm-node/src/composables/useDelay/useDelay.mjs +8 -2
- package/dist/esm-node/src/composables/useDimensions/useDimensions.mjs +24 -6
- package/dist/esm-node/src/composables/useDirection/useDirection.mjs +4 -1
- package/dist/esm-node/src/composables/useDisabled/index.mjs +1 -1
- package/dist/esm-node/src/composables/useDisabled/useDisabled.mjs +4 -1
- package/dist/esm-node/src/composables/useDisplay/useDisplay.mjs +2 -0
- package/dist/esm-node/src/composables/useFilter/useFilter.mjs +20 -0
- package/dist/esm-node/src/composables/useFocus/useFocus.mjs +12 -3
- package/dist/esm-node/src/composables/useFocus/useFocusTrap.mjs +8 -2
- package/dist/esm-node/src/composables/useForm/useForm.mjs +45 -0
- package/dist/esm-node/src/composables/useGroup/useGroup.mjs +24 -6
- package/dist/esm-node/src/composables/useGroup/useGroupItem.mjs +8 -2
- package/dist/esm-node/src/composables/useItems/useItems.mjs +32 -8
- package/dist/esm-node/src/composables/useLayout/useLayout.mjs +24 -6
- package/dist/esm-node/src/composables/useLazy/useLazy.mjs +1 -0
- package/dist/esm-node/src/composables/useLoader/index.mjs +1 -1
- package/dist/esm-node/src/composables/useLoader/useLoader.mjs +4 -1
- package/dist/esm-node/src/composables/useLocation/index.mjs +1 -1
- package/dist/esm-node/src/composables/useLocation/useLocation.mjs +4 -1
- package/dist/esm-node/src/composables/useNested/useNested.mjs +44 -11
- package/dist/esm-node/src/composables/usePosition/usePosition.mjs +4 -0
- package/dist/esm-node/src/composables/useReadonly/useReadonly.mjs +4 -1
- package/dist/esm-node/src/composables/useReveal/useReveal.mjs +4 -1
- package/dist/esm-node/src/composables/useRouter/index.mjs +1 -1
- package/dist/esm-node/src/composables/useRouter/useRouter.mjs +16 -4
- package/dist/esm-node/src/composables/useSize/useSize.mjs +4 -1
- package/dist/esm-node/src/composables/useStatus/useStatus.mjs +4 -1
- package/dist/esm-node/src/composables/useText/useText.mjs +8 -2
- package/dist/esm-node/src/composables/useTheme/useTheme.mjs +4 -1
- package/dist/esm-node/src/composables/useTransition/useTransition.mjs +4 -1
- package/dist/esm-node/src/composables/useValidation/useValidation.mjs +26 -6
- package/dist/esm-node/src/composables/useVirtual/useVirtual.mjs +12 -3
- package/dist/esm-node/src/core/defineComponent.mjs +4 -1
- package/dist/esm-node/src/themes/lumaDark.mjs +8 -4
- package/dist/esm-node/src/utils/date/date.mjs +4 -4
- package/dist/iife/entry.js +9 -9
- package/dist/styles/common.css +1 -1
- package/dist/styles/core.css +1 -1
- package/dist/styles/tailwind.css +1 -1
- package/dist/styles.css +2 -2
- package/dist/types/components/CdsApp/api/CdsApp.types.d.ts +4 -1
- package/dist/types/components/CdsAutocomplete/CdsAutocomplete.vue.d.ts +59 -20
- package/dist/types/components/CdsAutocomplete/api/CdsAutocomplete.types.d.ts +60 -15
- package/dist/types/components/CdsAutocomplete/index.d.ts +57 -30
- package/dist/types/components/CdsAvatar/api/CdsAvatar.types.d.ts +8 -2
- package/dist/types/components/CdsBadge/api/CdsBadge.types.d.ts +8 -2
- package/dist/types/components/CdsBreadcrumbs/api/CdsBreadcrumbs.types.d.ts +28 -7
- package/dist/types/components/CdsButton/CdsButton.vue.d.ts +4 -1
- package/dist/types/components/CdsButton/api/CdsButton.types.d.ts +20 -5
- package/dist/types/components/CdsButtonGroup/api/CdsButtonGroup.types.d.ts +4 -1
- package/dist/types/components/CdsButtonToggle/CdsButtonToggle.vue.d.ts +20 -5
- package/dist/types/components/CdsButtonToggle/api/CdsButtonToggle.types.d.ts +8 -2
- package/dist/types/components/CdsCard/CdsCardGroup.vue.d.ts +20 -5
- package/dist/types/components/CdsCard/api/CdsCard.types.d.ts +68 -17
- package/dist/types/components/CdsCarousel/api/CdsCarousel.types.d.ts +12 -3
- package/dist/types/components/CdsCheckbox/api/CdsCheckbox.types.d.ts +8 -2
- package/dist/types/components/CdsCheckboxButton/api/CdsCheckboxButton.types.d.ts +8 -0
- package/dist/types/components/CdsCombobox/CdsCombobox.vue.d.ts +67 -22
- package/dist/types/components/CdsCombobox/api/CdsCombobox.types.d.ts +60 -15
- package/dist/types/components/CdsCombobox/index.d.ts +57 -30
- package/dist/types/components/CdsCounter/api/CdsCounter.types.d.ts +4 -0
- package/dist/types/components/CdsDateInput/CdsDateInput.vue.d.ts +35 -10
- package/dist/types/components/CdsDateInput/api/CdsDateInput.types.d.ts +44 -11
- package/dist/types/components/CdsDateInput/index.d.ts +57 -30
- package/dist/types/components/CdsDatePicker/CdsDatePicker.vue.d.ts +20 -0
- package/dist/types/components/CdsDatePicker/api/CdsDatePicker.types.d.ts +28 -7
- package/dist/types/components/CdsDefaultsProvider/api/CdsDefaultsProvider.types.d.ts +1 -0
- package/dist/types/components/CdsDescription/api/CdsDescription.types.d.ts +4 -0
- package/dist/types/components/CdsDivider/CdsDivider.vue.d.ts +4 -0
- package/dist/types/components/CdsDrawer/CdsDrawer.vue.d.ts +4 -0
- package/dist/types/components/CdsDrawer/api/CdsDrawer.types.d.ts +24 -6
- package/dist/types/components/CdsEmptyState/api/CdsEmptyState.types.d.ts +36 -9
- package/dist/types/components/CdsExpandablePanel/CdsExpandablePanel.vue.d.ts +16 -4
- package/dist/types/components/CdsExpandablePanel/CdsExpandablePanelTitle.vue.d.ts +8 -2
- package/dist/types/components/CdsExpandablePanel/CdsExpandablePanels.vue.d.ts +8 -2
- package/dist/types/components/CdsExpandablePanel/api/CdsExpandablePanel.types.d.ts +56 -14
- package/dist/types/components/CdsField/CdsField.vue.d.ts +18 -2
- package/dist/types/components/CdsField/api/CdsField.types.d.ts +33 -7
- package/dist/types/components/CdsField/index.d.ts +5 -0
- package/dist/types/components/CdsFileInput/CdsFileInput.vue.d.ts +5 -2
- package/dist/types/components/CdsFileInput/api/CdsFileInput.types.d.ts +28 -7
- package/dist/types/components/CdsFileInput/index.d.ts +15 -6
- package/dist/types/components/CdsFileUpload/CdsFileUpload.vue.d.ts +8 -0
- package/dist/types/components/CdsFileUpload/api/CdsFileUpload.types.d.ts +116 -29
- package/dist/types/components/CdsFooter/api/CdsFooter.types.d.ts +12 -3
- package/dist/types/components/CdsForm/api/CdsForm.types.d.ts +20 -5
- package/dist/types/components/CdsFunctionalButton/api/CdsFunctionalButton.types.d.ts +8 -2
- package/dist/types/components/CdsGrid/api/CdsGrid.types.d.ts +12 -0
- package/dist/types/components/CdsHeader/api/CdsHeader.types.d.ts +12 -3
- package/dist/types/components/CdsIcon/api/CdsIcon.types.d.ts +4 -1
- package/dist/types/components/CdsImage/CdsImage.vue.d.ts +20 -0
- package/dist/types/components/CdsImage/api/CdsImage.props.d.ts +4 -1
- package/dist/types/components/CdsImage/api/CdsImage.types.d.ts +28 -7
- package/dist/types/components/CdsInput/CdsInput.vue.d.ts +44 -11
- package/dist/types/components/CdsInput/api/CdsInput.types.d.ts +36 -9
- package/dist/types/components/CdsLabel/api/CdsLabel.types.d.ts +4 -0
- package/dist/types/components/CdsLayout/api/CdsLayout.types.d.ts +16 -4
- package/dist/types/components/CdsLink/api/CdsLink.types.d.ts +8 -2
- package/dist/types/components/CdsList/CdsList.vue.d.ts +24 -6
- package/dist/types/components/CdsList/CdsListGroup.vue.d.ts +4 -1
- package/dist/types/components/CdsList/CdsListItem.vue.d.ts +28 -7
- package/dist/types/components/CdsList/CdsListItemAction.vue.d.ts +20 -5
- package/dist/types/components/CdsList/CdsListItemDivider.vue.d.ts +4 -0
- package/dist/types/components/CdsList/CdsListItemMedia.vue.d.ts +20 -5
- package/dist/types/components/CdsList/CdsListSubheader.vue.d.ts +4 -1
- package/dist/types/components/CdsList/api/CdsList.types.d.ts +84 -21
- package/dist/types/components/CdsList/components/ListChildren.vue.d.ts +16 -4
- package/dist/types/components/CdsList/components/ListGroupActivator.vue.d.ts +4 -1
- package/dist/types/components/CdsList/index.d.ts +76 -0
- package/dist/types/components/CdsMain/api/CdsMain.types.d.ts +4 -1
- package/dist/types/components/CdsMenu/api/CdsMenu.types.d.ts +12 -0
- package/dist/types/components/CdsMessages/api/CdsMessages.types.d.ts +8 -0
- package/dist/types/components/CdsModal/api/CdsModal.types.d.ts +12 -3
- package/dist/types/components/CdsNotification/api/CdsNotification.types.d.ts +36 -9
- package/dist/types/components/CdsNotificationAlert/api/CdsNotificationAlert.types.d.ts +40 -10
- package/dist/types/components/CdsOtpInput/CdsOtpInput.vue.d.ts +20 -5
- package/dist/types/components/CdsOtpInput/api/CdsOtpInput.types.d.ts +36 -9
- package/dist/types/components/CdsOverlay/CdsOverlay.vue.d.ts +44 -11
- package/dist/types/components/CdsOverlay/api/CdsOverlay.types.d.ts +28 -3
- package/dist/types/components/CdsPage/api/CdsPage.types.d.ts +4 -1
- package/dist/types/components/CdsPagination/CdsPagination.vue.d.ts +16 -0
- package/dist/types/components/CdsPagination/api/CdsPagination.types.d.ts +44 -11
- package/dist/types/components/CdsProgressBar/api/CdsProgressBar.types.d.ts +8 -0
- package/dist/types/components/CdsProgressCircle/api/CdsProgressCircle.types.d.ts +4 -1
- package/dist/types/components/CdsRadioGroup/api/CdsRadioGroup.types.d.ts +8 -2
- package/dist/types/components/CdsResponsive/api/CdsResponsive.types.d.ts +8 -2
- package/dist/types/components/CdsSelect/CdsSelect.vue.d.ts +51 -18
- package/dist/types/components/CdsSelect/api/CdsSelect.types.d.ts +60 -15
- package/dist/types/components/CdsSelect/index.d.ts +57 -30
- package/dist/types/components/CdsSelectionControl/CdsSelectionControl.vue.d.ts +8 -0
- package/dist/types/components/CdsSelectionControl/api/CdsSelectionControl.types.d.ts +12 -3
- package/dist/types/components/CdsSelectionControlGroup/api/CdsSelectionControlGroup.types.d.ts +8 -0
- package/dist/types/components/CdsSkeletonLoader/api/CdsSkeletonLoader.types.d.ts +4 -1
- package/dist/types/components/CdsSlideGroup/CdsSlideGroup.vue.d.ts +24 -6
- package/dist/types/components/CdsSlideGroup/api/CdsSlideGroup.types.d.ts +20 -5
- package/dist/types/components/CdsSlideView/CdsSlideView.vue.d.ts +4 -0
- package/dist/types/components/CdsSlideView/CdsSlideViewItem.vue.d.ts +4 -0
- package/dist/types/components/CdsSlideView/api/CdsSlideView.types.d.ts +31 -0
- package/dist/types/components/CdsStages/CdsStages.vue.d.ts +8 -0
- package/dist/types/components/CdsStatus/api/CdsStatus.types.d.ts +4 -1
- package/dist/types/components/CdsSteps/CdsSteps.vue.d.ts +8 -0
- package/dist/types/components/CdsSteps/api/CdsSteps.types.d.ts +72 -18
- package/dist/types/components/CdsSurface/api/CdsSurface.types.d.ts +4 -1
- package/dist/types/components/CdsTable/CdsTable.vue.d.ts +4 -0
- package/dist/types/components/CdsTable/api/CdsTable.types.d.ts +96 -24
- package/dist/types/components/CdsTabs/api/CdsTabs.types.d.ts +32 -0
- package/dist/types/components/CdsTag/api/CdsTag.types.d.ts +64 -16
- package/dist/types/components/CdsTagGroup/CdsTagGroup.vue.d.ts +20 -5
- package/dist/types/components/CdsTagGroup/api/CdsTagGroup.types.d.ts +8 -2
- package/dist/types/components/CdsTextArea/CdsTextArea.vue.d.ts +5 -2
- package/dist/types/components/CdsTextArea/api/CdsTextArea.types.d.ts +24 -6
- package/dist/types/components/CdsTextArea/index.d.ts +15 -6
- package/dist/types/components/CdsTextInput/CdsTextInput.vue.d.ts +7 -4
- package/dist/types/components/CdsTextInput/api/CdsTextInput.types.d.ts +44 -11
- package/dist/types/components/CdsTextInput/index.d.ts +20 -11
- package/dist/types/components/CdsTimePicker/CdsTimePicker.vue.d.ts +24 -0
- package/dist/types/components/CdsTimePicker/api/CdsTimePicker.types.d.ts +4 -1
- package/dist/types/components/CdsToast/api/CdsToast.types.d.ts +40 -10
- package/dist/types/components/CdsToastQueue/CdsToastQueue.vue.d.ts +4 -1
- package/dist/types/components/CdsToastQueue/api/CdsToastQueue.types.d.ts +20 -5
- package/dist/types/components/CdsToggle/api/CdsToggle.types.d.ts +28 -7
- package/dist/types/components/CdsToolbar/api/CdsToolbar.types.d.ts +8 -2
- package/dist/types/components/CdsTooltip/api/CdsTooltip.types.d.ts +4 -0
- package/dist/types/components/CdsTree/CdsTree.vue.d.ts +16 -0
- package/dist/types/components/CdsTree/api/CdsTree.types.d.ts +84 -21
- package/dist/types/components/CdsUploader/CdsUploader.vue.d.ts +8 -0
- package/dist/types/components/CdsUploader/api/CdsUploader.types.d.ts +68 -17
- package/dist/types/components/CdsVirtualScroll/CdsVirtualScroll.vue.d.ts +8 -0
- package/dist/types/components/CdsVirtualScroll/api/CdsVirtualScroll.types.d.ts +20 -5
- package/dist/types/composables/useForm/useForm.d.ts +33 -0
- package/dist/types/composables/useLayout/context.d.ts +61 -0
- package/dist/types/composables/useNested/useNested.d.ts +8 -2
- package/dist/types/entry.d.ts +1 -0
- package/dist/types/themes/lumaDark.d.ts +4 -4
- package/dist/types/utils/date/date.d.ts +1 -1
- package/llms/llms-components.txt +8861 -10675
- package/llms/llms-full.txt +10309 -11489
- package/llms/llms-guides.txt +1400 -738
- package/llms/llms-migration.txt +18 -46
- package/llms/llms-tokens.txt +55 -55
- package/llms/llms.txt +110 -109
- package/package.json +24 -11
- package/src/components/CdsApp/CdsApp.scss +43 -0
- package/src/components/CdsApp/styles/_CdsApp.variables.scss +2 -0
- package/src/components/CdsAutocomplete/CdsAutocomplete.scss +158 -0
- package/src/components/CdsAutocomplete/styles/_CdsAutocomplete.variables.scss +9 -0
- package/src/components/CdsAvatar/CdsAvatar.scss +42 -0
- package/src/components/CdsAvatar/styles/_CdsAvatar.variables.scss +22 -0
- package/src/components/CdsBadge/CdsBadge.scss +69 -0
- package/src/components/CdsBadge/styles/_CdsBadge.variables.scss +22 -0
- package/src/components/CdsBreadcrumbs/CdsBreadcrumbs.scss +49 -0
- package/src/components/CdsBreadcrumbs/styles/_CdsBreadcrumbs.variables.scss +14 -0
- package/src/components/CdsButton/CdsButton.scss +138 -0
- package/src/components/CdsButton/styles/_CdsButton.mixins.scss +76 -0
- package/src/components/CdsButton/styles/_CdsButton.variables.scss +180 -0
- package/src/components/CdsButtonGroup/CdsButtonGroup.scss +62 -0
- package/src/components/CdsButtonGroup/styles/_CdsButtonGroup.variables.scss +7 -0
- package/src/components/CdsButtonToggle/CdsButtonToggle.scss +19 -0
- package/src/components/CdsButtonToggle/styles/_CdsButtonToggle.variables.scss +3 -0
- package/src/components/CdsCard/CdsCard.scss +194 -0
- package/src/components/CdsCard/styles/CdsCard.variables.scss +36 -0
- package/src/components/CdsCarousel/CdsCarousel.scss +76 -0
- package/src/components/CdsCarousel/styles/_CdsCarousel.variables.scss +7 -0
- package/src/components/CdsCheckbox/CdsCheckbox.scss +20 -0
- package/src/components/CdsCheckbox/styles/_CdsCheckbox.mixins.scss +24 -0
- package/src/components/CdsCheckbox/styles/_CdsCheckbox.variables.scss +8 -0
- package/src/components/CdsCheckboxButton/CdsCheckboxButton.scss +78 -0
- package/src/components/CdsCheckboxButton/styles/_CdsCheckboxButton.variables.scss +46 -0
- package/src/components/CdsCombobox/CdsCombobox.scss +158 -0
- package/src/components/CdsCombobox/styles/_CdsCombobox.variables.scss +9 -0
- package/src/components/CdsCounter/CdsCounter.scss +11 -0
- package/src/components/CdsCounter/styles/_CdsCounter.variables.scss +1 -0
- package/src/components/CdsDateInput/CdsDateInput.scss +28 -0
- package/src/components/CdsDateInput/styles/_CdsDateInput.variables.scss +6 -0
- package/src/components/CdsDatePicker/CdsDatePicker.scss +574 -0
- package/src/components/CdsDatePicker/styles/_CdsDatePicker.variables.scss +56 -0
- package/src/components/CdsDescription/CdsDescription.scss +12 -0
- package/src/components/CdsDescription/styles/_CdsDescription.variables.scss +1 -0
- package/src/components/CdsDivider/CdsDivider.scss +83 -0
- package/src/components/CdsDivider/styles/_CdsDivider.variables.scss +28 -0
- package/src/components/CdsDrawer/CdsDrawer.scss +144 -0
- package/src/components/CdsDrawer/styles/_CdsDrawer.variables.scss +17 -0
- package/src/components/CdsEmptyState/CdsEmptyState.scss +103 -0
- package/src/components/CdsEmptyState/styles/_CdsEmptyState.variables.scss +15 -0
- package/src/components/CdsExpandablePanel/CdsExpandablePanel.scss +221 -0
- package/src/components/CdsExpandablePanel/styles/_CdsExpandablePanel.variables.scss +24 -0
- package/src/components/CdsField/CdsField.scss +209 -0
- package/src/components/CdsField/styles/_CdsField.mixins.scss +39 -0
- package/src/components/CdsField/styles/_CdsField.variables.scss +84 -0
- package/src/components/CdsFileInput/CdsFileInput.scss +40 -0
- package/src/components/CdsFileInput/styles/_CdsFileInput.variables.scss +5 -0
- package/src/components/CdsFileUpload/CdsFileUpload.scss +173 -0
- package/src/components/CdsFileUpload/styles/_CdsFileUpload.variables.scss +40 -0
- package/src/components/CdsFooter/CdsFooter.scss +36 -0
- package/src/components/CdsFooter/styles/_CdsFooter.variables.scss +4 -0
- package/src/components/CdsForm/CdsForm.scss +24 -0
- package/src/components/CdsForm/styles/_CdsForm.variables.scss +5 -0
- package/src/components/CdsFunctionalButton/CdsFunctionalButton.scss +49 -0
- package/src/components/CdsFunctionalButton/styles/_CdsFunctionalButton.variables.scss +25 -0
- package/src/components/CdsGrid/components/CSSGrid.scss +3 -0
- package/src/components/CdsGrid/components/FlexGrid.scss +3 -0
- package/src/components/CdsHeader/CdsHeader.scss +36 -0
- package/src/components/CdsHeader/styles/_CdsHeader.variables.scss +3 -0
- package/src/components/CdsHighlight/CdsHighlight.scss +16 -0
- package/src/components/CdsHighlight/styles/_CdsHighlight.variables.scss +8 -0
- package/src/components/CdsIcon/CdsIcon.scss +54 -0
- package/src/components/CdsIcon/styles/_CdsIcon.variables.scss +20 -0
- package/src/components/CdsImage/CdsImage.scss +62 -0
- package/src/components/CdsImage/styles/_CdsImage.variables.scss +4 -0
- package/src/components/CdsInput/CdsInput.scss +108 -0
- package/src/components/CdsInput/styles/_CdsInput.mixins.scss +54 -0
- package/src/components/CdsInput/styles/_CdsInput.variables.scss +98 -0
- package/src/components/CdsLabel/CdsLabel.scss +23 -0
- package/src/components/CdsLabel/styles/_CdsLabel.variables.scss +2 -0
- package/src/components/CdsLayout/CdsLayout.scss +61 -0
- package/src/components/CdsLayout/styles/_CdsLayout.variables.scss +2 -0
- package/src/components/CdsLink/CdsLink.scss +33 -0
- package/src/components/CdsLink/styles/_CdsLink.variables.scss +6 -0
- package/src/components/CdsList/CdsList.scss +104 -0
- package/src/components/CdsList/CdsListItem.scss +330 -0
- package/src/components/CdsList/styles/_CdsList.variables.scss +115 -0
- package/src/components/CdsLoader/CdsLoader.scss +78 -0
- package/src/components/CdsLoader/styles/_CdsLoader.mixins.scss +9 -0
- package/src/components/CdsLoader/styles/_CdsLoader.variables.scss +40 -0
- package/src/components/CdsMain/CdsMain.scss +7 -0
- package/src/components/CdsMenu/CdsMenu.scss +33 -0
- package/src/components/CdsMenu/styles/_CdsMenu.variables.scss +11 -0
- package/src/components/CdsMessages/CdsMessages.scss +20 -0
- package/src/components/CdsMessages/styles/_CdsMessages.variables.scss +5 -0
- package/src/components/CdsModal/CdsModal.scss +106 -0
- package/src/components/CdsModal/styles/_CdsModal.variables.scss +12 -0
- package/src/components/CdsNotification/CdsNotification.scss +99 -0
- package/src/components/CdsNotification/styles/_CdsNotification.variables.scss +13 -0
- package/src/components/CdsNotificationAlert/CdsNotificationAlert.scss +48 -0
- package/src/components/CdsNotificationAlert/styles/_CdsNotificationAlert.variables.scss +5 -0
- package/src/components/CdsOtpInput/CdsOtpInput.scss +192 -0
- package/src/components/CdsOtpInput/styles/_CdsOtpInput.variables.scss +31 -0
- package/src/components/CdsOverlay/CdsOverlay.scss +74 -0
- package/src/components/CdsOverlay/styles/_CdsOverlay.variables.scss +2 -0
- package/src/components/CdsPage/CdsPage.scss +9 -0
- package/src/components/CdsPagination/CdsPagination.scss +69 -0
- package/src/components/CdsPagination/styles/_CdsPagination.variables.scss +10 -0
- package/src/components/CdsProgressBar/CdsProgressBar.scss +285 -0
- package/src/components/CdsProgressBar/styles/_CdsProgressBar.variables.scss +23 -0
- package/src/components/CdsProgressCircle/CdsProgressCircle.scss +116 -0
- package/src/components/CdsProgressCircle/styles/_CdsProgressCircle.variables.scss +21 -0
- package/src/components/CdsRadio/CdsRadio.scss +42 -0
- package/src/components/CdsRadio/styles/_CdsRadio.variables.scss +26 -0
- package/src/components/CdsRadioGroup/CdsRadioGroup.scss +24 -0
- package/src/components/CdsRadioGroup/styles/_CdsRadioGroup.variables.scss +4 -0
- package/src/components/CdsResponsive/CdsResponsive.scss +33 -0
- package/src/components/CdsResponsive/styles/_CdsResponsive.variables.scss +3 -0
- package/src/components/CdsSelect/CdsSelect.scss +149 -0
- package/src/components/CdsSelect/styles/_CdsSelect.variables.scss +7 -0
- package/src/components/CdsSelectionControl/CdsSelectionControl.scss +104 -0
- package/src/components/CdsSelectionControlGroup/CdsSelectionControlGroup.scss +17 -0
- package/src/components/CdsSkeletonLoader/CdsSkeletonLoader.scss +292 -0
- package/src/components/CdsSkeletonLoader/styles/_CdsSkeletonLoader.variables.scss +52 -0
- package/src/components/CdsSlideGroup/CdsSlideGroup.scss +63 -0
- package/src/components/CdsSlideGroup/styles/_CdsSlideGroup.variables.scss +1 -0
- package/src/components/CdsSlideView/CdsSlideView.scss +183 -0
- package/src/components/CdsSlideView/styles/_CdsSlideView.variables.scss +4 -0
- package/src/components/CdsStages/CdsStages.scss +109 -0
- package/src/components/CdsStages/styles/_CdsStages.variables.scss +17 -0
- package/src/components/CdsStatus/CdsStatus.scss +49 -0
- package/src/components/CdsStatus/styles/_CdsStatus.variables.scss +7 -0
- package/src/components/CdsSteps/CdsSteps.scss +216 -0
- package/src/components/CdsSteps/styles/_CdsSteps.variables.scss +42 -0
- package/src/components/CdsSurface/CdsSurface.scss +16 -0
- package/src/components/CdsTable/CdsTable.scss +1140 -0
- package/src/components/CdsTable/styles/_CdsTable.mixins.scss +86 -0
- package/src/components/CdsTable/styles/_CdsTable.variables.scss +82 -0
- package/src/components/CdsTabs/CdsTabs.scss +94 -0
- package/src/components/CdsTabs/styles/_CdsTabs.variables.scss +30 -0
- package/src/components/CdsTag/CdsTag.scss +141 -0
- package/src/components/CdsTag/styles/_CdsTag.variables.scss +57 -0
- package/src/components/CdsTagGroup/CdsTagGroup.scss +32 -0
- package/src/components/CdsTagGroup/styles/_CdsTagGroup.variables.scss +8 -0
- package/src/components/CdsTextArea/CdsTextArea.scss +129 -0
- package/src/components/CdsTextArea/styles/_CdsTextArea.variables.scss +6 -0
- package/src/components/CdsTextInput/CdsTextInput.scss +84 -0
- package/src/components/CdsTextInput/styles/_CdsTextInput.variables.scss +7 -0
- package/src/components/CdsTimePicker/CdsTimePicker.scss +93 -0
- package/src/components/CdsTimePicker/styles/_CdsTimePicker.variables.scss +13 -0
- package/src/components/CdsToast/CdsToast.scss +207 -0
- package/src/components/CdsToast/styles/_CdsToast.variables.scss +16 -0
- package/src/components/CdsToggle/CdsToggle.scss +192 -0
- package/src/components/CdsToggle/styles/_CdsToggle.variables.scss +81 -0
- package/src/components/CdsToolbar/CdsToolbar.scss +72 -0
- package/src/components/CdsToolbar/styles/_CdsToolbar.variables.scss +3 -0
- package/src/components/CdsTooltip/CdsTooltip.scss +111 -0
- package/src/components/CdsTooltip/styles/_CdsTooltip.variables.scss +15 -0
- package/src/components/CdsTree/CdsTree.scss +290 -0
- package/src/components/CdsTree/styles/_CdsTree.variables.scss +29 -0
- package/src/components/CdsUploader/CdsUploader.scss +109 -0
- package/src/components/CdsUploader/styles/_CdsUploader.variables.scss +16 -0
- package/src/components/CdsVirtualScroll/CdsVirtualScroll.scss +16 -0
- package/src/components/CdsVirtualScroll/styles/_CdsVirtualScroll.variables.scss +3 -0
- package/src/styles/component-settings.scss +75 -0
- package/src/styles/generic/_fonts.scss +2 -2
- package/src/styles/settings/_index.scss +6 -0
- package/src/styles/tools/_absolute.sass +9 -0
- package/src/styles/tools/_border.sass +10 -0
- package/src/styles/tools/_motion.scss +11 -17
- package/src/styles/utilities/grid/_config.scss +0 -1
- package/src/themes/lumaDark.ts +8 -4
- package/dist/styles/breakpoints.css +0 -1
- package/dist/styles/index.css +0 -1
package/llms/llms-guides.txt
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
# Central Design System (CDS 4) —
|
|
1
|
+
# Central Design System (CDS 4) — guides
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
>
|
|
5
|
-
>
|
|
3
|
+
> Version: 4.0.0-alpha.5
|
|
4
|
+
> Setup, conventions, forms, theming, Tailwind CSS, tree-shaking, and responsiveness.
|
|
5
|
+
> Generated automatically (`bun run generate:meta` → `bun run generate:llms`). Do not edit manually.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
#
|
|
9
|
+
# Setup and themes
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Installation
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
|
|
15
|
-
# или npm i / yarn add / pnpm add
|
|
14
|
+
npm install @central-design-system/components
|
|
16
15
|
```
|
|
17
16
|
|
|
18
|
-
##
|
|
17
|
+
## Wiring it into the app
|
|
19
18
|
|
|
20
19
|
```ts
|
|
21
20
|
import { createApp } from 'vue';
|
|
@@ -27,31 +26,32 @@ const cds = createCds({ components, directives });
|
|
|
27
26
|
createApp(App).use(cds).mount('#app');
|
|
28
27
|
```
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
After that every component is available globally: `<CdsButton appearance="primary">Click me</CdsButton>`.
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
This is the full registration — it pulls in the entire library. For production
|
|
32
|
+
apps register components individually, see the Tree-shaking guide.
|
|
34
33
|
|
|
35
|
-
##
|
|
34
|
+
## Style entry points
|
|
36
35
|
|
|
37
|
-
|
|
|
36
|
+
| Import | What it provides |
|
|
38
37
|
| --- | --- |
|
|
39
|
-
| `@central-design-system/components/styles` |
|
|
40
|
-
| `@central-design-system/components/styles/common.css` |
|
|
41
|
-
| `@central-design-system/components/styles/core` |
|
|
42
|
-
| `@central-design-system/components/styles/utilities` |
|
|
43
|
-
| `@central-design-system/components/styles/tailwind` |
|
|
44
|
-
| `@central-design-system/components/styles/legacy` | Legacy
|
|
38
|
+
| `@central-design-system/components/styles` | Aggregate: CSS of every component (~556 KB). Quick start, tree-shaking disabled |
|
|
39
|
+
| `@central-design-system/components/styles/common.css` | Base layer (~9 KB): layers, reset, fonts, typography, grid |
|
|
40
|
+
| `@central-design-system/components/styles/core` | Only layers, fonts and reset — no typography |
|
|
41
|
+
| `@central-design-system/components/styles/utilities` | Utility classes |
|
|
42
|
+
| `@central-design-system/components/styles/tailwind` | Tailwind CSS integration layer |
|
|
43
|
+
| `@central-design-system/components/styles/legacy` | Legacy utilities for migrating from CDS 3 |
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
With per-component registration you only include the base layer
|
|
46
|
+
`styles/common.css` — each component ships its own CSS alongside the
|
|
47
|
+
component itself.
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
Tailwind CSS v4 integration (installation, layers, utilities built on CDS
|
|
50
|
+
tokens) is covered in the Tailwind CSS + CDS guide.
|
|
51
51
|
|
|
52
|
-
##
|
|
52
|
+
## Themes
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
The theme is set at initialization via `createCds`:
|
|
55
55
|
|
|
56
56
|
```ts
|
|
57
57
|
const cds = createCds({
|
|
@@ -61,17 +61,17 @@ const cds = createCds({
|
|
|
61
61
|
});
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
`promoLight`, `promoDark`.
|
|
66
|
-
|
|
64
|
+
Built-in themes: `cdsLight` (default), `cdsDark`, `b2bLight`, `b2bDark`,
|
|
65
|
+
`promoLight`, `promoDark`. The values of every color token in each theme
|
|
66
|
+
are listed in ../tokens/themes.md.
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
Custom themes, runtime theme switching and disabling theming are covered in
|
|
69
|
+
the Theming guide.
|
|
70
70
|
|
|
71
|
-
##
|
|
71
|
+
## Icons
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
(`carbon`, `lucide`, `phosphor`, `remix`):
|
|
73
|
+
The built-in `cds` iconpack is active by default. Other packs are available
|
|
74
|
+
too (`carbon`, `lucide`, `phosphor`, `remix`):
|
|
75
75
|
|
|
76
76
|
```ts
|
|
77
77
|
import { createCds, iconsets } from '@central-design-system/components';
|
|
@@ -85,95 +85,96 @@ createCds({
|
|
|
85
85
|
});
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
The `@central-design-system/icons` package (CDS 3) is deprecated, see the
|
|
89
|
+
migration guide.
|
|
90
90
|
|
|
91
91
|
---
|
|
92
92
|
|
|
93
|
-
#
|
|
93
|
+
# CDS 4 conventions
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
(`references/components
|
|
97
|
-
|
|
95
|
+
The golden rule: **the source of truth is the component's `api.md`**
|
|
96
|
+
(`references/components/<name>/api.md`). Do not invent props, events or
|
|
97
|
+
slots — if they are not in api.md, they do not exist on the component.
|
|
98
98
|
|
|
99
|
-
##
|
|
99
|
+
## Shared props
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
The props below come from shared composable factories and behave identically
|
|
102
|
+
in every component that has them:
|
|
103
103
|
|
|
104
|
-
|
|
|
104
|
+
| Prop | Semantics |
|
|
105
105
|
| --- | --- |
|
|
106
|
-
| `size` |
|
|
107
|
-
| `appearance` |
|
|
108
|
-
| `color` / `bgColor` |
|
|
109
|
-
| `disabled` |
|
|
110
|
-
| `loading` |
|
|
111
|
-
| `width` / `height` |
|
|
106
|
+
| `size` | Size: `xs` / `sm` / `md` / `lg` / `xl` or a number |
|
|
107
|
+
| `appearance` | Appearance (visual variant); the set of values is component-specific — check the type in api.md |
|
|
108
|
+
| `color` / `bgColor` | Content / background color as a **theme token**, not a CSS value |
|
|
109
|
+
| `disabled` | Disabled state |
|
|
110
|
+
| `loading` | Loading state |
|
|
111
|
+
| `width` / `height` | Dimensions (number → px, or a CSS value as a string) |
|
|
112
112
|
|
|
113
|
-
##
|
|
113
|
+
## Tokens, not raw values
|
|
114
114
|
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
-
|
|
118
|
-
`--cds-*`
|
|
115
|
+
- Set colors via the `color` prop / theme tokens (`--cds-color-*`), never
|
|
116
|
+
arbitrary CSS (`#fff`, `red`). Theme tokens are listed in ../tokens/themes.md.
|
|
117
|
+
- Spacing, radii and other values in custom SCSS go through the global
|
|
118
|
+
`--cds-*` variables, never hardcoded.
|
|
119
119
|
|
|
120
120
|
## Atomic Design
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
`CdsTextInput`
|
|
124
|
-
`CdsMessages` + `CdsInput`,
|
|
125
|
-
|
|
122
|
+
Complex UI is composed from atoms. Example — a form: the ready-made
|
|
123
|
+
`CdsTextInput` "molecule" is internally built as `CdsField` + `CdsLabel` +
|
|
124
|
+
`CdsDescription` + `CdsMessages` + `CdsInput`, and the same atoms are
|
|
125
|
+
available for building your own fields. See the Forms guide
|
|
126
|
+
for details.
|
|
126
127
|
|
|
127
|
-
##
|
|
128
|
+
## Defaults
|
|
128
129
|
|
|
129
|
-
|
|
130
|
+
Prop defaults can be set centrally:
|
|
130
131
|
|
|
131
|
-
-
|
|
132
|
-
-
|
|
132
|
+
- globally — via the `defaults` option in `createCds({ defaults: { CdsButton: { size: 'lg' } } })`;
|
|
133
|
+
- for a subtree — with the `CdsDefaultsProvider` component
|
|
133
134
|
(api).
|
|
134
135
|
|
|
135
|
-
##
|
|
136
|
+
## Deprecated APIs
|
|
136
137
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
Props/components marked `_(deprecated)_` in api.md still work but will be
|
|
139
|
+
removed. In the dev console they emit a warning prefixed `[CDS UPGRADE]`.
|
|
140
|
+
When migrating legacy code, see the migration guide.
|
|
140
141
|
|
|
141
142
|
---
|
|
142
143
|
|
|
143
|
-
#
|
|
144
|
+
# Forms with CDS 4
|
|
144
145
|
|
|
145
|
-
##
|
|
146
|
+
## Ready-made controls
|
|
146
147
|
|
|
147
|
-
|
|
148
|
-
`examples.md`
|
|
148
|
+
For typical forms use the ready-made "molecules" (each has its own `api.md`
|
|
149
|
+
and `examples.md` in `references/components/`):
|
|
149
150
|
|
|
150
|
-
|
|
|
151
|
+
| Control | Purpose |
|
|
151
152
|
| --- | --- |
|
|
152
|
-
| CdsTextInput |
|
|
153
|
-
| CdsSelect |
|
|
154
|
-
| CdsAutocomplete |
|
|
155
|
-
| CdsCombobox |
|
|
156
|
-
| CdsCheckbox |
|
|
157
|
-
| CdsRadioGroup |
|
|
158
|
-
| CdsToggle |
|
|
159
|
-
| CdsDatePicker / CdsTimePicker |
|
|
153
|
+
| CdsTextInput | Text field with label / description / messages |
|
|
154
|
+
| CdsSelect | Dropdown (single / multiple) |
|
|
155
|
+
| CdsAutocomplete | Selection with search over the list |
|
|
156
|
+
| CdsCombobox | Selection that also accepts free-form input |
|
|
157
|
+
| CdsCheckbox | Checkbox |
|
|
158
|
+
| CdsRadioGroup | Radio button group |
|
|
159
|
+
| CdsToggle | Toggle |
|
|
160
|
+
| CdsDatePicker / CdsTimePicker | Date / time |
|
|
160
161
|
|
|
161
|
-
## CdsForm:
|
|
162
|
+
## CdsForm: aggregation and validation
|
|
162
163
|
|
|
163
|
-
`CdsForm`
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
(
|
|
164
|
+
`CdsForm` groups fields, aggregates their validation (`v-model` — form
|
|
165
|
+
validity) and exposes `validate` / `reset` / `resetValidation` methods via
|
|
166
|
+
slot props and the exposed API. Validation rules are set on the fields with
|
|
167
|
+
the `rules` prop (an array of functions `value → true | 'error text'`).
|
|
167
168
|
|
|
168
|
-
|
|
169
|
+
A verified example (from Storybook):
|
|
169
170
|
|
|
170
171
|
```html
|
|
171
172
|
<CdsForm v-model="valid" @submit.prevent>
|
|
172
173
|
<template #default="{ reset }">
|
|
173
|
-
<CdsTextInput v-model="name" :rules="rules.name" label="
|
|
174
|
-
<CdsTextInput v-model="email" :rules="rules.email" label="Email" placeholder="
|
|
175
|
-
<CdsButton appearance="secondary" @click="reset"
|
|
176
|
-
<CdsButton type="submit"
|
|
174
|
+
<CdsTextInput v-model="name" :rules="rules.name" label="Name" placeholder="Enter name" />
|
|
175
|
+
<CdsTextInput v-model="email" :rules="rules.email" label="Email" placeholder="Enter Email" />
|
|
176
|
+
<CdsButton appearance="secondary" @click="reset">Clear</CdsButton>
|
|
177
|
+
<CdsButton type="submit">Submit</CdsButton>
|
|
177
178
|
</template>
|
|
178
179
|
</CdsForm>
|
|
179
180
|
```
|
|
@@ -185,111 +186,116 @@ const email = ref('');
|
|
|
185
186
|
|
|
186
187
|
const rules = {
|
|
187
188
|
name: [
|
|
188
|
-
(value: string) => !!value || '
|
|
189
|
-
(value: string) => value.length <= 10 || '
|
|
189
|
+
(value: string) => !!value || 'Must not be empty',
|
|
190
|
+
(value: string) => value.length <= 10 || 'No more than 10 characters'
|
|
190
191
|
],
|
|
191
192
|
email: [
|
|
192
|
-
(value: string) => !!value || '
|
|
193
|
-
(value: string) => /.+@.+\..+/.test(value) || '
|
|
193
|
+
(value: string) => !!value || 'Must not be empty',
|
|
194
|
+
(value: string) => /.+@.+\..+/.test(value) || 'Invalid format'
|
|
194
195
|
]
|
|
195
196
|
};
|
|
196
197
|
```
|
|
197
198
|
|
|
198
|
-
|
|
199
|
+
Useful modes (full list in api.md):
|
|
199
200
|
|
|
200
|
-
- `first-fail` —
|
|
201
|
-
- `disabled` / `readonly`
|
|
201
|
+
- `first-fail` — validation stops at the first invalid field;
|
|
202
|
+
- `disabled` / `readonly` on the form propagate to every nested field.
|
|
202
203
|
|
|
203
|
-
CdsForm
|
|
204
|
+
CdsForm also works with external validators (vuelidate, vee-validate) — see
|
|
204
205
|
examples.md.
|
|
205
206
|
|
|
206
|
-
##
|
|
207
|
+
## Building your own field from atoms
|
|
207
208
|
|
|
208
|
-
|
|
209
|
+
When no ready-made molecule fits, assemble the field from atoms:
|
|
209
210
|
|
|
210
|
-
|
|
|
211
|
+
| Atom | Role |
|
|
211
212
|
| --- | --- |
|
|
212
|
-
| CdsField |
|
|
213
|
-
| CdsLabel |
|
|
214
|
-
| CdsDescription |
|
|
215
|
-
| CdsMessages |
|
|
216
|
-
| CdsInput |
|
|
213
|
+
| CdsField | Field wrapper: wires up label/control/messages, states |
|
|
214
|
+
| CdsLabel | Field label |
|
|
215
|
+
| CdsDescription | Supporting description |
|
|
216
|
+
| CdsMessages | Error messages / hints |
|
|
217
|
+
| CdsInput | Bare input control |
|
|
217
218
|
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
Before assembling, open the `api.md` of every atom — take the set of props
|
|
220
|
+
and slots only from there.
|
|
220
221
|
|
|
221
222
|
---
|
|
222
223
|
|
|
223
|
-
#
|
|
224
|
+
# CDS 3 → CDS 4 migration (digest)
|
|
224
225
|
|
|
225
|
-
|
|
226
|
-
`MIGRATION.md`
|
|
226
|
+
This is a short digest. **The full version with Before/After for every
|
|
227
|
+
change is `MIGRATION.md` at the root of the
|
|
228
|
+
`@central-design-system/components` npm package.**
|
|
227
229
|
|
|
228
|
-
##
|
|
230
|
+
## Severity legend
|
|
229
231
|
|
|
230
|
-
|
|
|
232
|
+
| Marker | Meaning |
|
|
231
233
|
| --- | --- |
|
|
232
|
-
| ⚠️ **BREAKING** |
|
|
233
|
-
| 🔁 **RENAMED** |
|
|
234
|
-
| 🟠 **DEPRECATED** |
|
|
235
|
-
| ✨ **NEW** |
|
|
234
|
+
| ⚠️ **BREAKING** | Breaks existing code — action required |
|
|
235
|
+
| 🔁 **RENAMED** | Rename — mechanical search & replace |
|
|
236
|
+
| 🟠 **DEPRECATED** | Works in 4.x, will be removed in 5.x |
|
|
237
|
+
| ✨ **NEW** | New capability, nothing breaks |
|
|
236
238
|
|
|
237
|
-
##
|
|
239
|
+
## Quick checklist
|
|
238
240
|
|
|
239
|
-
- [ ]
|
|
241
|
+
- [ ] Replace the CSS import: `@central-design-system/components/dist/cds.css` →
|
|
240
242
|
`@central-design-system/components/styles` (⚠️ breaking).
|
|
241
|
-
- [ ]
|
|
242
|
-
|
|
243
|
-
- [ ]
|
|
244
|
-
- [ ]
|
|
245
|
-
|
|
243
|
+
- [ ] If you use `@central-design-system/icons` — the package is 🟠 deprecated;
|
|
244
|
+
switch to iconpacks via `createCds({ icons })` (see setup.md).
|
|
245
|
+
- [ ] Go through the component rename index below.
|
|
246
|
+
- [ ] Run the build and check the dev console: `[CDS UPGRADE]` warnings
|
|
247
|
+
point at deprecated props.
|
|
246
248
|
|
|
247
|
-
##
|
|
249
|
+
## Key breaking changes
|
|
248
250
|
|
|
249
|
-
- ⚠️
|
|
250
|
-
|
|
251
|
-
- ⚠️ **Legacy reset
|
|
251
|
+
- ⚠️ **CSS import path** — `dist/cds.css` is no longer a public entry point;
|
|
252
|
+
import `@central-design-system/components/styles` instead.
|
|
253
|
+
- ⚠️ **Legacy reset is off by default** — the global reset from CDS 3 is now
|
|
252
254
|
opt-in: `@use '@central-design-system/components/styles' with ($legacy-reset: true);`.
|
|
253
|
-
- ⚠️ **CSS
|
|
254
|
-
`@layer`;
|
|
255
|
-
|
|
255
|
+
- ⚠️ **CSS architecture on ITCSS + CSS Layers** — the cascade is driven by
|
|
256
|
+
native `@layer`; global overrides of CDS styles without `!important` may
|
|
257
|
+
now resolve differently.
|
|
256
258
|
|
|
257
|
-
##
|
|
259
|
+
## Component rename and removal index
|
|
258
260
|
|
|
259
261
|
| CDS 3 | CDS 4 |
|
|
260
262
|
| --- | --- |
|
|
261
|
-
| `CdsDropdown` | 🔁 `CdsSelect` (
|
|
263
|
+
| `CdsDropdown` | 🔁 `CdsSelect` (the native `<select>` from CDS 3 — via the `native-select` prop) |
|
|
262
264
|
| `CdsRadioButton` | 🔁 `CdsRadioGroup` |
|
|
263
265
|
| `CdsProgress` | 🔁 `CdsProgressBar` |
|
|
264
266
|
| `CdsTabsV2` | 🔁 `CdsTabs` |
|
|
265
|
-
| `CdsCheckboxGroup` | ⚠️
|
|
266
|
-
| `CdsContainer` | ⚠️
|
|
267
|
-
| `CdsBadge` | 🔁
|
|
267
|
+
| `CdsCheckboxGroup` | ⚠️ removed (use `CdsCheckbox` on its own) |
|
|
268
|
+
| `CdsContainer` | ⚠️ removed |
|
|
269
|
+
| `CdsBadge` | 🔁 props: `count`→`content`, `limited`→`:max`; ⚠️ `invertColor` removed |
|
|
268
270
|
|
|
269
|
-
|
|
270
|
-
`../components/` —
|
|
271
|
+
After renaming, double-check the `api.md` of the new component in
|
|
272
|
+
`../components/` — prop contracts may have changed.
|
|
271
273
|
|
|
272
274
|
---
|
|
273
275
|
|
|
276
|
+
---
|
|
277
|
+
sourceHash: abc11a2cdeb9c401a04b865e6fd89a2c3f36d3a5
|
|
278
|
+
---
|
|
279
|
+
|
|
274
280
|
# Tailwind CSS v4 + CDS 4
|
|
275
281
|
|
|
276
|
-
|
|
277
|
-
[Installing Tailwind CSS with Vite](https://tailwindcss.com/docs/installation/using-vite).
|
|
282
|
+
For Vite projects, install Tailwind CSS v4 by following the official Tailwind
|
|
283
|
+
guide: [Installing Tailwind CSS with Vite](https://tailwindcss.com/docs/installation/using-vite).
|
|
278
284
|
|
|
279
|
-
|
|
285
|
+
Below is the recommended way to integrate CDS 4 with Tailwind CSS v4.
|
|
280
286
|
|
|
281
|
-
- Vite
|
|
282
|
-
- CSS
|
|
287
|
+
- The Vite plugin goes into `vite.config.ts`
|
|
288
|
+
- Tailwind's CSS layer goes into `main.ts`
|
|
283
289
|
|
|
284
|
-
## 1.
|
|
290
|
+
## 1. Install Tailwind CSS
|
|
285
291
|
|
|
286
292
|
```bash
|
|
287
293
|
npm install -D tailwindcss @tailwindcss/vite
|
|
288
294
|
```
|
|
289
295
|
|
|
290
|
-
## 2.
|
|
296
|
+
## 2. Add the Vite plugin
|
|
291
297
|
|
|
292
|
-
|
|
298
|
+
Add `@tailwindcss/vite` to `vite.config.ts`:
|
|
293
299
|
|
|
294
300
|
```ts
|
|
295
301
|
import { defineConfig } from 'vite';
|
|
@@ -300,9 +306,9 @@ export default defineConfig({
|
|
|
300
306
|
});
|
|
301
307
|
```
|
|
302
308
|
|
|
303
|
-
## 3.
|
|
309
|
+
## 3. Create a `tailwind.css` file
|
|
304
310
|
|
|
305
|
-
|
|
311
|
+
For example, `src/tailwind.css`:
|
|
306
312
|
|
|
307
313
|
```css
|
|
308
314
|
@import "@central-design-system/components/styles/tailwind";
|
|
@@ -310,9 +316,10 @@ export default defineConfig({
|
|
|
310
316
|
@import "tailwindcss/utilities" layer(cds-utilities.tailwind);
|
|
311
317
|
```
|
|
312
318
|
|
|
313
|
-
|
|
319
|
+
This wires CDS tokens into Tailwind. You don't need `preflight` separately —
|
|
320
|
+
the base reset styles already come from `@central-design-system/components/styles`.
|
|
314
321
|
|
|
315
|
-
## 4.
|
|
322
|
+
## 4. Import the styles in your app entry point
|
|
316
323
|
|
|
317
324
|
```ts
|
|
318
325
|
import { createApp } from 'vue';
|
|
@@ -332,45 +339,57 @@ const cds = createCds({
|
|
|
332
339
|
createApp(App).use(cds).mount('#app');
|
|
333
340
|
```
|
|
334
341
|
|
|
335
|
-
## 5.
|
|
342
|
+
## 5. Use Tailwind utilities and CDS tokens together
|
|
336
343
|
|
|
337
344
|
```html
|
|
338
345
|
<template>
|
|
339
|
-
<div class="flex flex-col gap-
|
|
346
|
+
<div class="flex flex-col gap-3 rounded-200 bg-surface-primary p-4 text-content-primary">
|
|
340
347
|
<h1 class="text-900 font-bold text-brand-primary">Hello CDS + Tailwind</h1>
|
|
341
|
-
<CdsButton
|
|
348
|
+
<CdsButton>Click me</CdsButton>
|
|
342
349
|
</div>
|
|
343
350
|
</template>
|
|
344
351
|
```
|
|
345
352
|
|
|
346
|
-
|
|
353
|
+
Once this is set up, you get both at the same time:
|
|
354
|
+
|
|
355
|
+
- standard Tailwind utilities: `flex`, `font-bold`, `gap-3`, `p-4`
|
|
356
|
+
- utility classes built from CDS tokens: `bg-surface-primary`, `text-content-primary`, `rounded-200`
|
|
347
357
|
|
|
348
|
-
|
|
349
|
-
-
|
|
358
|
+
Write spacing with the standard Tailwind numeric scale (`gap-2`, `p-4`,
|
|
359
|
+
`mt-2`): the CDS spacing scale matches it, so there is no need for
|
|
360
|
+
`gap-200`/`p-400`-style spacing classes. Token-based classes remain for
|
|
361
|
+
color, radius, and typography.
|
|
350
362
|
|
|
351
|
-
CDS
|
|
352
|
-
|
|
363
|
+
The CDS configuration stays in sync with the active CDS theme automatically, so
|
|
364
|
+
color utility classes switch along with the theme.
|
|
353
365
|
|
|
354
366
|
---
|
|
355
367
|
|
|
356
|
-
|
|
368
|
+
---
|
|
369
|
+
sourceHash: 41872192eda1479740145bb7f4bcb9dbb28f0462
|
|
370
|
+
---
|
|
357
371
|
|
|
358
|
-
|
|
372
|
+
# Theming
|
|
359
373
|
|
|
360
|
-
|
|
374
|
+
The design system lets you switch themes or configure your own theme
|
|
375
|
+
programmatically, including at runtime.
|
|
361
376
|
|
|
362
|
-
|
|
377
|
+
## How it works
|
|
378
|
+
|
|
379
|
+
A theme in CDS 4 is a set of **semantic tokens** that are turned into CSS
|
|
380
|
+
variables when the application starts:
|
|
363
381
|
|
|
364
382
|
```
|
|
365
|
-
ThemeDefinition (TS) → --cds-color-* / --cds-* (CSS
|
|
383
|
+
ThemeDefinition (TS) → --cds-color-* / --cds-* (CSS variables) → component styles
|
|
366
384
|
↓
|
|
367
|
-
@theme (Tailwind CSS v4) → bg-surface-primary,
|
|
385
|
+
@theme (Tailwind CSS v4) → bg-surface-primary, rounded-200, …
|
|
368
386
|
```
|
|
369
387
|
|
|
370
|
-
|
|
388
|
+
Colors are written into the variables as **RGB channels** rather than finished
|
|
389
|
+
colors — that's what makes opacity control possible:
|
|
371
390
|
|
|
372
391
|
```css
|
|
373
|
-
/*
|
|
392
|
+
/* generated by CDS */
|
|
374
393
|
:root {
|
|
375
394
|
--cds-color-brand-primary: 0,90,178;
|
|
376
395
|
--cds-color-surface-primary: 255,255,255;
|
|
@@ -378,7 +397,7 @@ ThemeDefinition (TS) → --cds-color-* / --cds-* (CSS-переменные)
|
|
|
378
397
|
--cds-border-radius-200: 0.25rem;
|
|
379
398
|
}
|
|
380
399
|
|
|
381
|
-
/*
|
|
400
|
+
/* usage */
|
|
382
401
|
.my-block {
|
|
383
402
|
background: rgb(var(--cds-color-surface-primary));
|
|
384
403
|
border: var(--cds-border-100) solid rgb(var(--cds-color-brand-primary) / 0.4);
|
|
@@ -386,26 +405,27 @@ ThemeDefinition (TS) → --cds-color-* / --cds-* (CSS-переменные)
|
|
|
386
405
|
}
|
|
387
406
|
```
|
|
388
407
|
|
|
389
|
-
|
|
408
|
+
Theme styles are injected into `<style id="cds-theme-stylesheet">` and are
|
|
409
|
+
recalculated reactively when the theme changes.
|
|
390
410
|
|
|
391
|
-
##
|
|
411
|
+
## Enabling a theme
|
|
392
412
|
|
|
393
|
-
CDS 4
|
|
413
|
+
CDS 4 ships eight ready-made themes:
|
|
394
414
|
|
|
395
|
-
|
|
|
415
|
+
| Theme | Description |
|
|
396
416
|
| ------------- |-----------------------------------------|
|
|
397
|
-
| `cdsLight` |
|
|
398
|
-
| `cdsDark` |
|
|
399
|
-
| `b2bLight` |
|
|
400
|
-
| `b2bDark` |
|
|
401
|
-
| `lumaLight` |
|
|
402
|
-
| `lumaDark` |
|
|
403
|
-
| `promoLight` |
|
|
404
|
-
| `promoDark` |
|
|
417
|
+
| `cdsLight` | light theme, used by default |
|
|
418
|
+
| `cdsDark` | dark theme |
|
|
419
|
+
| `b2bLight` | light theme for B2B-Center applications |
|
|
420
|
+
| `b2bDark` | dark theme for B2B-Center applications |
|
|
421
|
+
| `lumaLight` | light Luma theme |
|
|
422
|
+
| `lumaDark` | dark Luma theme |
|
|
423
|
+
| `promoLight` | light promo theme |
|
|
424
|
+
| `promoDark` | dark promo theme |
|
|
405
425
|
|
|
406
|
-
>
|
|
426
|
+
> `cdsLight` is used by default — you don't need to enable it.
|
|
407
427
|
|
|
408
|
-
|
|
428
|
+
To switch to another theme, pass its name in the `createCds` options:
|
|
409
429
|
|
|
410
430
|
```ts
|
|
411
431
|
import { createApp } from 'vue';
|
|
@@ -425,7 +445,7 @@ const cds = createCds({
|
|
|
425
445
|
createApp(App).use(cds);
|
|
426
446
|
```
|
|
427
447
|
|
|
428
|
-
##
|
|
448
|
+
## Theming options
|
|
429
449
|
|
|
430
450
|
```ts
|
|
431
451
|
createCds({
|
|
@@ -444,22 +464,24 @@ createCds({
|
|
|
444
464
|
});
|
|
445
465
|
```
|
|
446
466
|
|
|
447
|
-
|
|
|
467
|
+
| Option | Type | Default | Purpose |
|
|
448
468
|
| --------------- | ---------------------------------------------------------- | ----------------------- | -------------------------------------------------------------------------- |
|
|
449
|
-
| `defaultTheme` | `ThemeName \| string` | `'cdsLight'` |
|
|
450
|
-
| `prefix` | `string` | `'cds'` |
|
|
451
|
-
| `themes` | `Record<string, ThemeDefinition>` |
|
|
452
|
-
| `variations` | `false \| { colors: string[]; lighten: number; darken: number }` | `false` |
|
|
453
|
-
| `utilities` | `boolean` | `true` |
|
|
454
|
-
| `legacyClasses` | `boolean` | `false` |
|
|
455
|
-
| `scoped` | `boolean` | `false` |
|
|
456
|
-
| `scope` | `string` | — |
|
|
457
|
-
| `stylesheetId` | `string` | `'cds-theme-stylesheet'`| `id`
|
|
458
|
-
| `cspNonce` | `string` | — | `nonce`
|
|
459
|
-
|
|
460
|
-
##
|
|
461
|
-
|
|
462
|
-
|
|
469
|
+
| `defaultTheme` | `ThemeName \| string` | `'cdsLight'` | Theme active at startup |
|
|
470
|
+
| `prefix` | `string` | `'cds'` | Prefix of the generated CSS variables (`--cds-color-*`) |
|
|
471
|
+
| `themes` | `Record<string, ThemeDefinition>` | built-in themes | Your own themes; merged with the built-in ones |
|
|
472
|
+
| `variations` | `false \| { colors: string[]; lighten: number; darken: number }` | `false` | Auto-generation of lighter/darker color variations |
|
|
473
|
+
| `utilities` | `boolean` | `true` | Generation of background/text utility classes from theme tokens |
|
|
474
|
+
| `legacyClasses` | `boolean` | `false` | CDS 3 legacy classes (`cds-bg-*`, `cds-text-*`, `cds-border-*`) |
|
|
475
|
+
| `scoped` | `boolean` | `false` | Don't write the variables into `:root` |
|
|
476
|
+
| `scope` | `string` | — | Limit theme selectors to a subtree (`:where(<scope>)`) |
|
|
477
|
+
| `stylesheetId` | `string` | `'cds-theme-stylesheet'`| `id` of the `<style>` tag holding the theme |
|
|
478
|
+
| `cspNonce` | `string` | — | `nonce` for Content Security Policy |
|
|
479
|
+
|
|
480
|
+
## Creating your own theme
|
|
481
|
+
|
|
482
|
+
A custom theme is a `ThemeDefinition` object with the fields `dark`, `colors` and
|
|
483
|
+
`variables`. You only need to specify the **overrides**: missing tokens are
|
|
484
|
+
inherited from `cdsLight` / `cdsDark`.
|
|
463
485
|
|
|
464
486
|
```ts
|
|
465
487
|
import { createApp } from 'vue';
|
|
@@ -472,7 +494,7 @@ import App from './App.vue';
|
|
|
472
494
|
const myCustomGreenTheme: ThemeDefinition = {
|
|
473
495
|
dark: false,
|
|
474
496
|
colors: {
|
|
475
|
-
//
|
|
497
|
+
// Main brand colors of the new theme
|
|
476
498
|
'brand-primary': '#2C8926',
|
|
477
499
|
'brand-primary-hover': '#3C9C2C',
|
|
478
500
|
'brand-primary-active': '#50A946',
|
|
@@ -482,11 +504,11 @@ const myCustomGreenTheme: ThemeDefinition = {
|
|
|
482
504
|
'brand-secondary-hover': '#A5DD98',
|
|
483
505
|
'brand-secondary-active': '#97D283',
|
|
484
506
|
'brand-secondary-border': '#BCE8AB',
|
|
485
|
-
//
|
|
507
|
+
// Surfaces
|
|
486
508
|
'page-primary': '#F2F8F0',
|
|
487
509
|
'surface-secondary': '#E8F3E4'
|
|
488
510
|
},
|
|
489
|
-
//
|
|
511
|
+
// Variables: typography, spacing, radii, shadows
|
|
490
512
|
variables: {
|
|
491
513
|
'font-family': 'Roboto, sans-serif',
|
|
492
514
|
'border-radius-200': '0.625rem'
|
|
@@ -507,26 +529,30 @@ const cds = createCds({
|
|
|
507
529
|
createApp(App).use(cds);
|
|
508
530
|
```
|
|
509
531
|
|
|
510
|
-
|
|
532
|
+
Every registered theme also gets a `.cds-theme--<name>` class — use it to enable
|
|
533
|
+
the theme on an arbitrary part of the markup.
|
|
511
534
|
|
|
512
|
-
###
|
|
535
|
+
### Token groups
|
|
513
536
|
|
|
514
|
-
`colors` —
|
|
537
|
+
`colors` — semantic colors:
|
|
515
538
|
|
|
516
|
-
- `brand-*` —
|
|
517
|
-
- `surface-*`, `page-*`, `fill-*` —
|
|
518
|
-
- `content-*` —
|
|
519
|
-
- `line-*` —
|
|
520
|
-
- `status-{success,warning,progress,info,danger,indication}-*` —
|
|
521
|
-
- `other-*` —
|
|
539
|
+
- `brand-*` — brand (`primary`, `secondary` and their `hover` / `active` / `border` / `content`)
|
|
540
|
+
- `surface-*`, `page-*`, `fill-*` — surfaces and fills
|
|
541
|
+
- `content-*` — text, icons, links
|
|
542
|
+
- `line-*` — borders, dividers, focus and selection
|
|
543
|
+
- `status-{success,warning,progress,info,danger,indication}-*` — statuses
|
|
544
|
+
- `other-*` — additional accent palettes
|
|
522
545
|
|
|
523
|
-
`variables` —
|
|
546
|
+
`variables` — dimensions: `spacing-*`, `font-size-*`, `font-line-height-*`,
|
|
547
|
+
`font-weight-*`, `border-*`, `border-radius-*`, `shadow-{x,y,blur}-*`,
|
|
548
|
+
`font-family`, `base-unit`.
|
|
524
549
|
|
|
525
|
-
|
|
550
|
+
For the full token list of a specific theme, see the package sources:
|
|
551
|
+
`@central-design-system/components/src/themes/cdsLight.ts`.
|
|
526
552
|
|
|
527
|
-
##
|
|
553
|
+
## Switching the theme
|
|
528
554
|
|
|
529
|
-
|
|
555
|
+
You can change the theme at runtime through the `useTheme` composable:
|
|
530
556
|
|
|
531
557
|
```vue
|
|
532
558
|
<script setup lang="ts">
|
|
@@ -540,34 +566,39 @@ function toggleTheme(): void {
|
|
|
540
566
|
</script>
|
|
541
567
|
|
|
542
568
|
<template>
|
|
543
|
-
<cds-button @click="toggleTheme"
|
|
569
|
+
<cds-button @click="toggleTheme">Toggle theme</cds-button>
|
|
544
570
|
</template>
|
|
545
571
|
```
|
|
546
572
|
|
|
547
|
-
|
|
573
|
+
You can also change the theme of a single component by passing it the `theme`
|
|
574
|
+
prop. Keep in mind that the theme applies not only to the component itself but to
|
|
575
|
+
everything nested inside it:
|
|
548
576
|
|
|
549
577
|
```vue
|
|
550
578
|
<template>
|
|
551
579
|
<cds-notification theme="b2bLight">
|
|
552
|
-
<!--
|
|
580
|
+
<!-- the button will use the b2bLight theme -->
|
|
553
581
|
<cds-button>Button</cds-button>
|
|
554
582
|
</cds-notification>
|
|
555
583
|
</template>
|
|
556
584
|
```
|
|
557
585
|
|
|
558
|
-
|
|
586
|
+
The `theme` prop is supported by container components and most visual components:
|
|
587
|
+
`CdsApp`, `CdsLayout`, `CdsPage`, `CdsSurface`, `CdsCard`, `CdsDrawer`,
|
|
588
|
+
`CdsModal`, `CdsOverlay`, `CdsButton`, `CdsField`, `CdsTable` and others.
|
|
559
589
|
|
|
560
|
-
##
|
|
590
|
+
## Using theme tokens in your own code
|
|
561
591
|
|
|
562
592
|
### Tailwind CSS v4
|
|
563
593
|
|
|
564
|
-
|
|
594
|
+
Theme tokens are mapped into Tailwind's `@theme`, so utilities switch along with
|
|
595
|
+
the theme automatically:
|
|
565
596
|
|
|
566
597
|
```html
|
|
567
|
-
<div class="bg-surface-primary text-content-primary p-
|
|
598
|
+
<div class="bg-surface-primary text-content-primary p-4 rounded-200">…</div>
|
|
568
599
|
```
|
|
569
600
|
|
|
570
|
-
|
|
601
|
+
Setup is described in Tailwind CSS v4 + CDS 4.
|
|
571
602
|
|
|
572
603
|
### CSS / SCSS
|
|
573
604
|
|
|
@@ -580,7 +611,8 @@ function toggleTheme(): void {
|
|
|
580
611
|
}
|
|
581
612
|
```
|
|
582
613
|
|
|
583
|
-
|
|
614
|
+
When you override CDS component styles, put them into the `cds-overrides` layer —
|
|
615
|
+
that way they are guaranteed to win over the library's styles:
|
|
584
616
|
|
|
585
617
|
```scss
|
|
586
618
|
@layer cds-overrides {
|
|
@@ -590,9 +622,10 @@ function toggleTheme(): void {
|
|
|
590
622
|
}
|
|
591
623
|
```
|
|
592
624
|
|
|
593
|
-
###
|
|
625
|
+
### CDS 3 legacy classes
|
|
594
626
|
|
|
595
|
-
|
|
627
|
+
The CDS 3 utility classes (`cds-bg-*`, `cds-text-*`, `cds-border-*`) are **off by
|
|
628
|
+
default** in CDS 4. To bring them back for the duration of a migration:
|
|
596
629
|
|
|
597
630
|
```ts
|
|
598
631
|
import '@central-design-system/components/styles/legacy';
|
|
@@ -602,9 +635,11 @@ const cds = createCds({
|
|
|
602
635
|
});
|
|
603
636
|
```
|
|
604
637
|
|
|
605
|
-
##
|
|
638
|
+
## Disabling theming
|
|
606
639
|
|
|
607
|
-
|
|
640
|
+
Pass `false` to the `theme` option. This prevents the generation of CSS variables
|
|
641
|
+
and theme classes and disables runtime theme switching — the `<style>` tag is not
|
|
642
|
+
created at all.
|
|
608
643
|
|
|
609
644
|
```ts
|
|
610
645
|
import { createCds } from '@central-design-system/components';
|
|
@@ -614,56 +649,59 @@ const cds = createCds({
|
|
|
614
649
|
});
|
|
615
650
|
```
|
|
616
651
|
|
|
617
|
-
|
|
652
|
+
With theming disabled, `theme.isDisabled === true` and `themeClasses` returns
|
|
653
|
+
`undefined`.
|
|
618
654
|
|
|
619
|
-
##
|
|
655
|
+
## Theme instance interface
|
|
620
656
|
|
|
621
|
-
`useTheme()`
|
|
657
|
+
`useTheme()` returns a `ThemeInstance` — access to the current theme and its
|
|
658
|
+
settings.
|
|
622
659
|
|
|
623
660
|
```ts
|
|
624
661
|
interface ThemeInstance {
|
|
625
|
-
/**
|
|
662
|
+
/** Whether theming is enabled (`false` with `theme: false`) */
|
|
626
663
|
readonly isDisabled: boolean;
|
|
627
664
|
|
|
628
665
|
/**
|
|
629
|
-
* Raw
|
|
630
|
-
*
|
|
666
|
+
* Raw object of the installed themes
|
|
667
|
+
* Themes can be added and modified
|
|
631
668
|
*/
|
|
632
669
|
readonly themes: Ref<Record<string, InternalThemeDefinition>>;
|
|
633
670
|
|
|
634
671
|
/**
|
|
635
|
-
*
|
|
636
|
-
*
|
|
672
|
+
* Name of the current theme
|
|
673
|
+
* Inherited from the parent component
|
|
637
674
|
*/
|
|
638
675
|
readonly name: Readonly<Ref<string>>;
|
|
639
676
|
|
|
640
677
|
/**
|
|
641
|
-
*
|
|
642
|
-
*
|
|
678
|
+
* Processed object of the current theme
|
|
679
|
+
* Includes the automatically generated colors
|
|
643
680
|
*/
|
|
644
681
|
readonly current: DeepReadonly<Ref<InternalThemeDefinition>>;
|
|
645
682
|
readonly computedThemes: DeepReadonly<Ref<Record<string, InternalThemeDefinition>>>;
|
|
646
683
|
|
|
647
|
-
/**
|
|
684
|
+
/** Class of the current theme — `cds-theme--<name>` */
|
|
648
685
|
readonly themeClasses: Readonly<ComputedRef<string | undefined>>;
|
|
649
686
|
|
|
650
|
-
/**
|
|
687
|
+
/** Generated CSS of the current theme */
|
|
651
688
|
readonly styles: Readonly<ComputedRef<string>>;
|
|
652
689
|
|
|
653
690
|
readonly global: {
|
|
654
|
-
/**
|
|
691
|
+
/** Name of the current global theme in the application (writable) */
|
|
655
692
|
readonly name: Ref<string>;
|
|
656
693
|
|
|
657
694
|
/**
|
|
658
|
-
*
|
|
659
|
-
*
|
|
695
|
+
* Processed object of the current global theme in the application
|
|
696
|
+
* Also available from `theme.computedThemes.value[theme.global.name.value]`
|
|
660
697
|
*/
|
|
661
698
|
readonly current: DeepReadonly<Ref<InternalThemeDefinition>>;
|
|
662
699
|
};
|
|
663
700
|
}
|
|
664
701
|
```
|
|
665
702
|
|
|
666
|
-
|
|
703
|
+
The theme instance is also available on the object returned by `createCds()` —
|
|
704
|
+
handy outside of a component context:
|
|
667
705
|
|
|
668
706
|
```ts
|
|
669
707
|
const cds = createCds({ theme: { defaultTheme: 'cdsLight' } });
|
|
@@ -673,33 +711,39 @@ cds.theme.global.name.value = 'cdsDark';
|
|
|
673
711
|
|
|
674
712
|
---
|
|
675
713
|
|
|
714
|
+
---
|
|
715
|
+
sourceHash: b1ba0f5864509842881b42ebf6cfb46aadcba96f
|
|
716
|
+
---
|
|
717
|
+
|
|
676
718
|
# Tree-shaking
|
|
677
719
|
|
|
678
|
-
CDS 4
|
|
679
|
-
|
|
680
|
-
(Vite, webpack, Rollup)
|
|
720
|
+
CDS 4 is published as an ESM bundle with its module structure preserved: every
|
|
721
|
+
component is a separate chunk with its own CSS next to it. That lets the bundler
|
|
722
|
+
(Vite, webpack, Rollup) drop everything your application doesn't use.
|
|
681
723
|
|
|
682
|
-
|
|
724
|
+
For this to work, follow two rules:
|
|
683
725
|
|
|
684
|
-
1.
|
|
685
|
-
2.
|
|
726
|
+
1. **Register only the components you actually need in `createCds`.**
|
|
727
|
+
2. **Include the base styles selectively** rather than the whole `styles.css`.
|
|
686
728
|
|
|
687
|
-
|
|
729
|
+
Below is how to do that and how much it saves.
|
|
688
730
|
|
|
689
|
-
##
|
|
731
|
+
## How it works
|
|
690
732
|
|
|
691
|
-
- ESM
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
733
|
+
- The ESM bundle is built with `chunkSplitPlugin({ strategy: 'unbundle' })` — the
|
|
734
|
+
library's module structure is preserved and components are not glued into a
|
|
735
|
+
single file.
|
|
736
|
+
- `package.json` declares `sideEffects`, so the bundler knows the library's JS
|
|
737
|
+
modules are pure and safe to remove.
|
|
738
|
+
- During the build, each component's chunk gets an import of its own CSS
|
|
739
|
+
appended. That's why `import { CdsButton }` pulls in exactly `CdsButton.css`,
|
|
740
|
+
not the styles of the entire library.
|
|
697
741
|
|
|
698
|
-
|
|
742
|
+
No special build or plugin is required — ordinary named imports are enough.
|
|
699
743
|
|
|
700
|
-
##
|
|
744
|
+
## Selective component registration
|
|
701
745
|
|
|
702
|
-
|
|
746
|
+
Pass only the components you use to `createCds`:
|
|
703
747
|
|
|
704
748
|
```ts
|
|
705
749
|
import { createApp } from 'vue';
|
|
@@ -716,25 +760,25 @@ const cds = createCds({
|
|
|
716
760
|
createApp(App).use(cds).mount('#app');
|
|
717
761
|
```
|
|
718
762
|
|
|
719
|
-
|
|
720
|
-
|
|
763
|
+
Components registered this way are available in templates globally — just as with
|
|
764
|
+
full registration:
|
|
721
765
|
|
|
722
766
|
```html
|
|
723
767
|
<template>
|
|
724
768
|
<CdsCard>
|
|
725
|
-
<CdsButton
|
|
769
|
+
<CdsButton>Click me</CdsButton>
|
|
726
770
|
</CdsCard>
|
|
727
771
|
</template>
|
|
728
772
|
```
|
|
729
773
|
|
|
730
|
-
>
|
|
731
|
-
>
|
|
732
|
-
>
|
|
774
|
+
> **Important:** `createCds` does not register components on its own. The set is
|
|
775
|
+
> always defined by the caller. That's deliberate: if the factory referenced the
|
|
776
|
+
> full component list, the bundler could not remove a single one of them.
|
|
733
777
|
|
|
734
|
-
###
|
|
778
|
+
### Alternative: a local import in an SFC
|
|
735
779
|
|
|
736
|
-
|
|
737
|
-
|
|
780
|
+
If you need a component in one or two places, global registration is optional —
|
|
781
|
+
import it right inside the component:
|
|
738
782
|
|
|
739
783
|
```html
|
|
740
784
|
<script setup lang="ts">
|
|
@@ -742,17 +786,18 @@ import { CdsButton } from '@central-design-system/components';
|
|
|
742
786
|
</script>
|
|
743
787
|
|
|
744
788
|
<template>
|
|
745
|
-
<CdsButton
|
|
789
|
+
<CdsButton>Click me</CdsButton>
|
|
746
790
|
</template>
|
|
747
791
|
```
|
|
748
792
|
|
|
749
|
-
`createCds`
|
|
750
|
-
|
|
793
|
+
You still need `createCds` in the entry point — it supplies themes, locales,
|
|
794
|
+
icons and breakpoints through `provide`. But you don't have to pass `components`
|
|
795
|
+
to it at all.
|
|
751
796
|
|
|
752
|
-
##
|
|
797
|
+
## Full registration
|
|
753
798
|
|
|
754
|
-
|
|
755
|
-
|
|
799
|
+
When the set of components is not known in advance (internal admin panels,
|
|
800
|
+
sandboxes, documentation), it's easier to register everything:
|
|
756
801
|
|
|
757
802
|
```ts
|
|
758
803
|
import { createCds, components, directives } from '@central-design-system/components';
|
|
@@ -760,46 +805,47 @@ import { createCds, components, directives } from '@central-design-system/compon
|
|
|
760
805
|
const cds = createCds({ components, directives });
|
|
761
806
|
```
|
|
762
807
|
|
|
763
|
-
|
|
764
|
-
|
|
808
|
+
Such a call disables component tree-shaking: the `components` namespace import
|
|
809
|
+
keeps the whole library in the bundle.
|
|
765
810
|
|
|
766
|
-
##
|
|
811
|
+
## Styles
|
|
767
812
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
813
|
+
Component styles are included automatically along with the components themselves.
|
|
814
|
+
The only thing you have to include manually is the **base layer** — reset, fonts,
|
|
815
|
+
CSS layer order and global element styles:
|
|
771
816
|
|
|
772
817
|
```ts
|
|
773
818
|
import '@central-design-system/components/styles/common.css';
|
|
774
819
|
```
|
|
775
820
|
|
|
776
|
-
|
|
777
|
-
|
|
821
|
+
The base layer is mandatory: it's where the `@layer` order is declared, and the
|
|
822
|
+
correct cascade of component styles depends on it.
|
|
778
823
|
|
|
779
|
-
|
|
780
|
-
(`h1`–`h6`)
|
|
824
|
+
Take `common.css`, not `core.css`: `core.css` has no typography, so headings
|
|
825
|
+
(`h1`–`h6`) keep browser sizes instead of the CDS scale.
|
|
781
826
|
|
|
782
|
-
|
|
827
|
+
Available options:
|
|
783
828
|
|
|
784
|
-
|
|
|
829
|
+
| Import | Size | What's inside |
|
|
785
830
|
| --- | --- | --- |
|
|
786
|
-
| `styles/common.css` | ~9 KB |
|
|
787
|
-
| `styles/core.css` | ~2 KB |
|
|
788
|
-
| `styles/tailwind.css` | ~12 KB | CDS
|
|
789
|
-
| `styles/legacy.css` | ~253 KB |
|
|
831
|
+
| `styles/common.css` | ~9 KB | The recommended base: `core` + typography + grid utilities |
|
|
832
|
+
| `styles/core.css` | ~2 KB | Layers, fonts and reset only — **no typography** |
|
|
833
|
+
| `styles/tailwind.css` | ~12 KB | CDS tokens for Tailwind CSS v4 |
|
|
834
|
+
| `styles/legacy.css` | ~253 KB | Compatibility with legacy CDS 3 markup |
|
|
790
835
|
|
|
791
|
-
>
|
|
792
|
-
>
|
|
793
|
-
>
|
|
836
|
+
> **Don't use `@central-design-system/components/styles` in a tree-shaking
|
|
837
|
+
> scenario.** It's a ~556 KB aggregate containing the CSS of every component in
|
|
838
|
+
> the library. It's convenient for a quick start, but it completely defeats
|
|
839
|
+
> selective registration.
|
|
794
840
|
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
841
|
+
Color tokens (`--cds-color-*` and the rest) are not in the CSS files — they are
|
|
842
|
+
generated and injected into the document by `createCds` at runtime, based on the
|
|
843
|
+
active theme. There is nothing extra to include.
|
|
798
844
|
|
|
799
|
-
##
|
|
845
|
+
## Directives
|
|
800
846
|
|
|
801
|
-
|
|
802
|
-
|
|
847
|
+
Directives (`ClickOutside`, `Intersect`, `Touch`) are named exports and are
|
|
848
|
+
registered just as selectively:
|
|
803
849
|
|
|
804
850
|
```ts
|
|
805
851
|
import { createCds, ClickOutside } from '@central-design-system/components';
|
|
@@ -810,107 +856,355 @@ const cds = createCds({
|
|
|
810
856
|
});
|
|
811
857
|
```
|
|
812
858
|
|
|
813
|
-
|
|
814
|
-
`ClickOutside`, `Intersect`
|
|
815
|
-
`CdsSelect`, `CdsMenu`, `CdsTooltip`, `CdsSlideView`,
|
|
816
|
-
|
|
817
|
-
`createCds`
|
|
818
|
-
`v-touch`
|
|
859
|
+
The library's own components don't need you to register directives — the ones
|
|
860
|
+
that use `ClickOutside`, `Intersect` and `Touch` internally (`CdsOverlay` and
|
|
861
|
+
everything built on it: `CdsSelect`, `CdsMenu`, `CdsTooltip`, `CdsSlideView`,
|
|
862
|
+
input fields) import them themselves and register them locally. Pass `directives`
|
|
863
|
+
to `createCds` only for your own markup — `v-click-outside`, `v-intersect`,
|
|
864
|
+
`v-touch` in the application's templates.
|
|
819
865
|
|
|
820
|
-
>
|
|
821
|
-
>
|
|
822
|
-
>
|
|
823
|
-
>
|
|
866
|
+
> **In `4.0.0-alpha.0`:** local registration inside components didn't work, and
|
|
867
|
+
> the `CdsSelect` / `CdsMenu` menus wouldn't close on an outside click unless
|
|
868
|
+
> `directives` was passed to `createCds`. If you can't upgrade, add
|
|
869
|
+
> `directives: { ClickOutside, Touch }` to the registration.
|
|
824
870
|
|
|
825
|
-
##
|
|
871
|
+
## How much it saves
|
|
826
872
|
|
|
827
|
-
|
|
828
|
-
|
|
873
|
+
Measurements on Vite 5 (production, minified, styles in a separate file, Vue
|
|
874
|
+
included in the bundle, the base `common.css` not counted):
|
|
829
875
|
|
|
830
|
-
|
|
|
876
|
+
| Scenario | JS | JS (gzip) | CSS | CSS (gzip) |
|
|
831
877
|
| --- | --- | --- | --- | --- |
|
|
832
|
-
|
|
|
833
|
-
| `createCds` + 3
|
|
834
|
-
| `createCds` + 1
|
|
835
|
-
| 1
|
|
878
|
+
| Full registration (`components`, `directives`) | 625 KB | 203 KB | 208 KB | 24.6 KB |
|
|
879
|
+
| `createCds` + 3 components | 196 KB | 62.6 KB | 27.6 KB | 4.1 KB |
|
|
880
|
+
| `createCds` + 1 component | 162 KB | 51.4 KB | 12.6 KB | 1.9 KB |
|
|
881
|
+
| 1 component without `createCds` | 63 KB | 23.4 KB | 12.6 KB | 1.9 KB |
|
|
836
882
|
|
|
837
|
-
|
|
838
|
-
(`CdsTable`, `CdsAutocomplete`, `CdsDatePicker`)
|
|
883
|
+
The numbers depend on which components exactly you include: composite components
|
|
884
|
+
(`CdsTable`, `CdsAutocomplete`, `CdsDatePicker`) pull in more dependencies than
|
|
885
|
+
atoms do.
|
|
839
886
|
|
|
840
|
-
###
|
|
887
|
+
### What isn't tree-shaken
|
|
841
888
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
889
|
+
About 99 KB is the core that `createCds` always includes: themes, locales, icons,
|
|
890
|
+
breakpoints (`useDisplay`), `goTo` and the `defaults` system. That volume doesn't
|
|
891
|
+
depend on the number of components — it is exactly the difference between the
|
|
892
|
+
"1 component without `createCds`" (63 KB) and "`createCds` + 1 component"
|
|
893
|
+
(162 KB) rows.
|
|
846
894
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
895
|
+
If CDS is used in a couple of places and you don't need the global subsystems,
|
|
896
|
+
you can skip `createCds` entirely. But then there are no themes, no locales and
|
|
897
|
+
no defaults, so that mode only suits pinpoint embeds.
|
|
850
898
|
|
|
851
|
-
##
|
|
899
|
+
## How to verify the result
|
|
852
900
|
|
|
853
901
|
```bash
|
|
854
902
|
npx vite-bundle-visualizer
|
|
855
903
|
```
|
|
856
904
|
|
|
857
|
-
|
|
905
|
+
What to look for:
|
|
858
906
|
|
|
859
|
-
-
|
|
860
|
-
-
|
|
861
|
-
(
|
|
862
|
-
-
|
|
863
|
-
|
|
907
|
+
- the bundle should contain no chunks of components missing from your `createCds`;
|
|
908
|
+
- if an "extra" component shows up, it is most likely imported transitively
|
|
909
|
+
(`CdsSelect` pulls in `CdsMenu` and `CdsList`, for instance) — that's normal;
|
|
910
|
+
- if the whole library ended up in the bundle, look for `components` or
|
|
911
|
+
`import * as` among your imports.
|
|
864
912
|
|
|
865
|
-
##
|
|
913
|
+
## Common mistakes
|
|
866
914
|
|
|
867
|
-
**
|
|
868
|
-
|
|
915
|
+
**A namespace import instead of a named one.** Any `import * as` from the library
|
|
916
|
+
keeps all of it:
|
|
869
917
|
|
|
870
918
|
```ts
|
|
871
|
-
// ❌
|
|
919
|
+
// ❌ pulls in every component
|
|
872
920
|
import * as cdsComponents from '@central-design-system/components';
|
|
873
921
|
|
|
874
922
|
// ✅
|
|
875
923
|
import { CdsButton } from '@central-design-system/components';
|
|
876
924
|
```
|
|
877
925
|
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
926
|
+
**Importing icon packs through `iconsets`.** The `iconsets` object references all
|
|
927
|
+
packs at once, so it is not tree-shaken: the bundle gets the JS of every pack
|
|
928
|
+
(including `cds` — 46 KB) and, since UnoCSS scans them itself, the CSS of all five
|
|
929
|
+
packs (≈370 KB instead of ≈70 KB). Import the pack through its subpath:
|
|
882
930
|
|
|
883
931
|
```ts
|
|
884
|
-
// ❌
|
|
932
|
+
// ❌ pulls in every pack
|
|
885
933
|
import { iconsets } from '@central-design-system/components';
|
|
886
934
|
const aliases = iconsets.remix.aliases;
|
|
887
935
|
|
|
888
|
-
// ✅
|
|
936
|
+
// ✅ remix only
|
|
889
937
|
import { remix } from '@central-design-system/components/iconsets/remix';
|
|
890
938
|
const aliases = remix.aliases;
|
|
891
939
|
```
|
|
892
940
|
|
|
893
|
-
|
|
894
|
-
|
|
941
|
+
**Including the style aggregate.** `@central-design-system/components/styles`
|
|
942
|
+
contains the CSS of every component — use `styles/common.css`.
|
|
895
943
|
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
944
|
+
**Your own barrel re-export.** A `src/ui/index.ts` file that re-exports dozens of
|
|
945
|
+
CDS components kills tree-shaking if you import everything from it. Import
|
|
946
|
+
components directly from the library.
|
|
899
947
|
|
|
900
|
-
|
|
901
|
-
by design.
|
|
902
|
-
|
|
948
|
+
**A bundler without ESM support.** The CJS bundle (`dist/cjs`) and the IIFE build
|
|
949
|
+
are not tree-shakable by design. Make sure your bundler resolves the `import`
|
|
950
|
+
export condition — Vite, webpack 5 and Rollup do it by default.
|
|
903
951
|
|
|
904
952
|
---
|
|
905
953
|
|
|
906
|
-
|
|
954
|
+
---
|
|
955
|
+
sourceHash: 5d3ad246b66c58c6ecd39eb645d52dd6a026eaf2
|
|
956
|
+
---
|
|
957
|
+
|
|
958
|
+
# SASS variables
|
|
907
959
|
|
|
908
|
-
|
|
960
|
+
CDS 4 styles are written in SASS/SCSS, and part of the internal setup — the base
|
|
961
|
+
reset, global typography, font, grid and breakpoints — is extracted into SASS
|
|
962
|
+
variables flagged with `!default`. You can override them when building your
|
|
963
|
+
application through the standard
|
|
964
|
+
[module configuration](https://sass-lang.com/documentation/at-rules/use/#configuration)
|
|
965
|
+
mechanism: `@use '…' with (…)`.
|
|
909
966
|
|
|
910
|
-
|
|
967
|
+
> SASS variables are the **compile-time** configuration layer. Colors, spacing
|
|
968
|
+
> and the rest of the component design tokens live in CSS variables (`--cds-*`)
|
|
969
|
+
> and are configured by themes at runtime — see Theming. Start
|
|
970
|
+
> with the theme; drop down to SASS variables when you need to change the base
|
|
971
|
+
> layer itself: reset, typography, grid.
|
|
911
972
|
|
|
912
|
-
|
|
913
|
-
|
|
973
|
+
## Setup
|
|
974
|
+
|
|
975
|
+
Vite compiles SCSS out of the box — you only need the preprocessor itself:
|
|
976
|
+
|
|
977
|
+
```bash
|
|
978
|
+
npm install -D sass-embedded
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
The classic `sass` works too, but `sass-embedded` is noticeably faster. To speed
|
|
982
|
+
up large builds, opt into the modern compiler API:
|
|
983
|
+
|
|
984
|
+
```ts
|
|
985
|
+
// vite.config.ts
|
|
986
|
+
export default defineConfig({
|
|
987
|
+
css: {
|
|
988
|
+
preprocessorOptions: {
|
|
989
|
+
scss: { api: 'modern-compiler' }
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
## Plugging in with a configuration
|
|
996
|
+
|
|
997
|
+
Normally the base styles are plugged in as ready-made CSS —
|
|
998
|
+
`import '@central-design-system/components/styles'`. To override SASS variables,
|
|
999
|
+
replace that import with your own SCSS file: in SCSS the
|
|
1000
|
+
`@central-design-system/components/styles` entry point resolves to the **sources**
|
|
1001
|
+
of the base layer (the `sass` export condition in `package.json`), and your
|
|
1002
|
+
configuration is applied at compile time.
|
|
1003
|
+
|
|
1004
|
+
```diff
|
|
1005
|
+
// main.ts
|
|
1006
|
+
import { createApp } from 'vue';
|
|
1007
|
+
|
|
1008
|
+
- import '@central-design-system/components/styles';
|
|
1009
|
+
+ import './styles/main.scss';
|
|
1010
|
+
```
|
|
1011
|
+
|
|
1012
|
+
```scss
|
|
1013
|
+
// src/styles/main.scss
|
|
1014
|
+
@use '@central-design-system/components/styles' with (
|
|
1015
|
+
$reset: false,
|
|
1016
|
+
$body-font-family: ('Inter', sans-serif)
|
|
1017
|
+
);
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
The component styles themselves need nothing extra: they are precompiled and ship
|
|
1021
|
+
with the components' JS chunks — both with selective and with full registration
|
|
1022
|
+
(see Tree-shaking).
|
|
1023
|
+
|
|
1024
|
+
> Wrap a value containing commas — `$body-font-family` with several fonts, for
|
|
1025
|
+
> instance — in parentheses, otherwise SASS reads it as several arguments.
|
|
1026
|
+
|
|
1027
|
+
## A settings file
|
|
1028
|
+
|
|
1029
|
+
Module configuration is applied once, on the first load. If you need the values
|
|
1030
|
+
not only in the entry point but also in your application's component styles,
|
|
1031
|
+
extract them into a separate settings file and use that everywhere:
|
|
1032
|
+
|
|
1033
|
+
```scss
|
|
1034
|
+
// src/styles/settings.scss
|
|
1035
|
+
@forward '@central-design-system/components/styles/settings' with (
|
|
1036
|
+
$body-font-family: ('Inter', sans-serif),
|
|
1037
|
+
$grid-gutter: 24px
|
|
1038
|
+
);
|
|
1039
|
+
```
|
|
1040
|
+
|
|
1041
|
+
```scss
|
|
1042
|
+
// src/styles/main.scss
|
|
1043
|
+
@use './settings'; // configures the CDS variables
|
|
1044
|
+
@use '@central-design-system/components/styles'; // the base is built with them
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
```html
|
|
1048
|
+
<!-- Component.vue -->
|
|
1049
|
+
<style lang="scss">
|
|
1050
|
+
@use '@/styles/settings' as s;
|
|
1051
|
+
|
|
1052
|
+
.card {
|
|
1053
|
+
gap: s.$grid-gutter;
|
|
1054
|
+
font-family: s.$body-font-family;
|
|
1055
|
+
}
|
|
1056
|
+
</style>
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
Every `<style>` block is compiled separately, so "configure it in `main.scss` and
|
|
1060
|
+
read it straight from the package" won't work — a direct
|
|
1061
|
+
`@use '@central-design-system/components/styles/settings'` in a component would
|
|
1062
|
+
return the default values. A shared settings file guarantees identical values at
|
|
1063
|
+
every compilation point.
|
|
1064
|
+
|
|
1065
|
+
The `styles/settings` entry contains variables only and emits not a single byte
|
|
1066
|
+
of CSS — it's safe to include in any number of files.
|
|
1067
|
+
|
|
1068
|
+
## Global variables
|
|
1069
|
+
|
|
1070
|
+
| Variable | Default | What it does |
|
|
1071
|
+
| --- | --- | --- |
|
|
1072
|
+
| `$reset` | `true` | Emit the base layer's CSS reset |
|
|
1073
|
+
| `$legacy-reset` | `false` | Reset for compatibility with CDS 3 markup |
|
|
1074
|
+
| `$enable-typography` | `true` | Global typography (`h1`–`h6`, `.h1`–`.h6` and so on) |
|
|
1075
|
+
| `$body-font-family` | `var(--cds-font-family), 'PT Root UI VF', …` | `body` font |
|
|
1076
|
+
| `$font-size-root` | `var(--cds-base-unit)` (16px) | Root font size |
|
|
1077
|
+
| `$line-height-root` | `1.5` | Root line height |
|
|
1078
|
+
| `$border-color-root` | `transparent` | Default border color |
|
|
1079
|
+
| `$border-style-root` | `solid` | Default border style |
|
|
1080
|
+
| `$border-radius-root` | `var(--cds-border-radius-200)` | Base corner radius |
|
|
1081
|
+
| `$size-scale` | `4px` | Step of the size scale |
|
|
1082
|
+
| `$sizes` | `('xs', 'sm', 'md', 'lg', 'xl')` | Size names |
|
|
1083
|
+
| `$standard-easing` | `cubic-bezier(0.4, 0, 0.2, 1)` | Base animation curve |
|
|
1084
|
+
| `$decelerated-easing` | `cubic-bezier(0, 0, 0.2, 1)` | Enter curve |
|
|
1085
|
+
| `$accelerated-easing` | `cubic-bezier(0.4, 0, 1, 1)` | Leave curve |
|
|
1086
|
+
| `$rounded` | map | Radius scale (`sm`, `md`, `lg`, `xl`, `pill`, `circle`, …) |
|
|
1087
|
+
|
|
1088
|
+
## Grid and breakpoints
|
|
1089
|
+
|
|
1090
|
+
| Variable | Default | What it does |
|
|
1091
|
+
| --- | --- | --- |
|
|
1092
|
+
| `$prefix` | `'cds'` | Prefix of the grid CSS classes |
|
|
1093
|
+
| `$flex-grid-columns` | `16` | Number of flex grid columns (`12` is supported too) |
|
|
1094
|
+
| `$grid-gutter` | `32px` | Grid gutter |
|
|
1095
|
+
| `$grid-gutter-condensed` | `1px` | Gutter of the condensed grid |
|
|
1096
|
+
| `$grid-breakpoints` | map | Breakpoints: width, columns and spacing for `xs`–`xl` |
|
|
1097
|
+
|
|
1098
|
+
The grid variables belong to the same settings module, while the breakpoint and
|
|
1099
|
+
grid mixins live in a separate `styles/breakpoints` entry — which emits no CSS
|
|
1100
|
+
either:
|
|
1101
|
+
|
|
1102
|
+
```scss
|
|
1103
|
+
@use '@/styles/settings' as s;
|
|
1104
|
+
@use '@central-design-system/components/styles/breakpoints' as bp;
|
|
1105
|
+
|
|
1106
|
+
.sidebar {
|
|
1107
|
+
gap: s.$grid-gutter;
|
|
1108
|
+
|
|
1109
|
+
@include bp.cds-breakpoint-up('md') {
|
|
1110
|
+
width: 320px;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
```
|
|
1114
|
+
|
|
1115
|
+
> SASS breakpoints affect your styles and the grid mixins. The runtime
|
|
1116
|
+
> breakpoints of `useDisplay` are configured separately, through the `display`
|
|
1117
|
+
> option of `createCds` (see Display & Platform).
|
|
1118
|
+
> The two sets match by default; when you change one, don't forget the other.
|
|
1119
|
+
|
|
1120
|
+
## Component variables and vite-plugin
|
|
1121
|
+
|
|
1122
|
+
Without the plugin, `@use … with` configures the base layer only: component CSS
|
|
1123
|
+
is precompiled. The `@central-design-system/vite-plugin` plugin lifts that
|
|
1124
|
+
limitation — it recompiles the styles of every component you use with your
|
|
1125
|
+
settings file:
|
|
1126
|
+
|
|
1127
|
+
```ts
|
|
1128
|
+
// vite.config.ts
|
|
1129
|
+
import cds from '@central-design-system/vite-plugin';
|
|
1130
|
+
|
|
1131
|
+
export default defineConfig({
|
|
1132
|
+
plugins: [
|
|
1133
|
+
vue(),
|
|
1134
|
+
cds({ styles: { configFile: 'src/styles/settings.scss' } })
|
|
1135
|
+
]
|
|
1136
|
+
});
|
|
1137
|
+
```
|
|
1138
|
+
|
|
1139
|
+
The settings file is the same, but you have to forward
|
|
1140
|
+
`styles/component-settings` — the aggregate that includes both global and
|
|
1141
|
+
component variables:
|
|
1142
|
+
|
|
1143
|
+
```scss
|
|
1144
|
+
// src/styles/settings.scss
|
|
1145
|
+
@forward '@central-design-system/components/styles/component-settings' with (
|
|
1146
|
+
$border-radius-root: 0, // global
|
|
1147
|
+
$button-border-radius: 9999px // component-level
|
|
1148
|
+
);
|
|
1149
|
+
```
|
|
1150
|
+
|
|
1151
|
+
With the plugin you don't need to change the
|
|
1152
|
+
`@central-design-system/components/styles` import in `main.ts` — it starts
|
|
1153
|
+
meaning "the configured base layer" on its own, and component styles are rebuilt
|
|
1154
|
+
on the fly. The plugin can also auto-import components from templates
|
|
1155
|
+
(`autoImport: true` by default), which makes registration in
|
|
1156
|
+
`createCds({ components })` optional.
|
|
1157
|
+
|
|
1158
|
+
## What SASS can't configure
|
|
1159
|
+
|
|
1160
|
+
- **Component-local variables** (`$button-border-radius` and friends from
|
|
1161
|
+
`styles/_CdsX.variables.scss`). Unavailable without the plugin: component CSS
|
|
1162
|
+
is published precompiled, so its local variables are frozen at the moment the
|
|
1163
|
+
library was built. With `@central-design-system/vite-plugin` they are
|
|
1164
|
+
configured through `styles/component-settings` — the plugin recompiles the
|
|
1165
|
+
published SCSS sources of the components with your settings file (see above).
|
|
1166
|
+
- **Turning off individual utility classes.** Instead of a toggle map, pick an
|
|
1167
|
+
entry point by content: `styles/core` — layers, fonts and reset only;
|
|
1168
|
+
`styles/common` — plus typography and helpers.
|
|
1169
|
+
- **CSS layers.** `@layer cds-*` is always on: the layer order is declared in the
|
|
1170
|
+
base style layer, and ordinary application CSS (outside `@layer`) always beats
|
|
1171
|
+
the design system's styles — there is nothing to turn off here.
|
|
1172
|
+
|
|
1173
|
+
## Pitfalls
|
|
1174
|
+
|
|
1175
|
+
- **Variables only in the settings file.** Any styles or imports of regular style
|
|
1176
|
+
files inside `settings.scss` get duplicated into every file that includes it.
|
|
1177
|
+
Styles belong in `main.scss`; the settings file holds variables, mixins and
|
|
1178
|
+
functions.
|
|
1179
|
+
- **Configure before the module's first load.** `@use … with` fails with a
|
|
1180
|
+
`module was already loaded` error if the settings module has already been
|
|
1181
|
+
loaded without a configuration higher up the chain. Include the settings file
|
|
1182
|
+
first.
|
|
1183
|
+
- **Build speed.** With ready-made CSS there is nothing to compile; with a
|
|
1184
|
+
configuration the base layer is built together with the application. The volume
|
|
1185
|
+
is small, but the difference shows on cold builds — `sass-embedded` and
|
|
1186
|
+
`api: 'modern-compiler'` keep it to a minimum.
|
|
1187
|
+
- **Resolution assumes a bundler.** Bare imports such as
|
|
1188
|
+
`@use '@central-design-system/components/styles'` are resolved by Vite and
|
|
1189
|
+
webpack (`sass-loader`) through the `sass` export condition. In plain `sass`
|
|
1190
|
+
CLI without a bundler you'll have to point the paths at the files inside
|
|
1191
|
+
`node_modules` by hand.
|
|
1192
|
+
|
|
1193
|
+
---
|
|
1194
|
+
|
|
1195
|
+
---
|
|
1196
|
+
sourceHash: 5822739245a9c6095f09064c0b58dc326ac5c188
|
|
1197
|
+
---
|
|
1198
|
+
|
|
1199
|
+
# Icons
|
|
1200
|
+
|
|
1201
|
+
CDS v4 supports many popular icon packs out of the box.
|
|
1202
|
+
|
|
1203
|
+
## Usage
|
|
1204
|
+
|
|
1205
|
+
You can pick one of the ready-made icon packs or plug in your own.
|
|
1206
|
+
By default CDS uses the `cds` pack — it contains every icon the design system
|
|
1207
|
+
components need.
|
|
914
1208
|
|
|
915
1209
|
```ts
|
|
916
1210
|
import { createCds } from '@central-design-system/components';
|
|
@@ -924,7 +1218,7 @@ const cds = createCds({
|
|
|
924
1218
|
app.use(cds);
|
|
925
1219
|
```
|
|
926
1220
|
|
|
927
|
-
|
|
1221
|
+
After that, use the icon in templates:
|
|
928
1222
|
|
|
929
1223
|
```html
|
|
930
1224
|
<template>
|
|
@@ -932,19 +1226,25 @@ app.use(cds);
|
|
|
932
1226
|
</template>
|
|
933
1227
|
```
|
|
934
1228
|
|
|
935
|
-
##
|
|
1229
|
+
## Installing icon packs through UnoCSS
|
|
936
1230
|
|
|
937
|
-
|
|
1231
|
+
CDS integrates with [UnoCSS Preset Icons](https://unocss.dev/presets/icons), which
|
|
1232
|
+
supports every icon pack available on [Iconify](https://icon-sets.iconify.design/).
|
|
938
1233
|
|
|
939
|
-
|
|
1234
|
+
Icons are tree-shaken, so only the icons you actually use end up in the final CSS
|
|
1235
|
+
bundle. You can register several packs at once and freely mix icons from any of
|
|
1236
|
+
them in your components.
|
|
940
1237
|
|
|
941
|
-
###
|
|
1238
|
+
### Icon packs
|
|
942
1239
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1240
|
+
For the packs listed below, CDS ships iconsets with alias mappings — aliases for
|
|
1241
|
+
the icons CDS components use (checkboxes, dropdowns, radio buttons and so on).
|
|
1242
|
+
Pick one of them as the default pack (`defaultSet`); the alias mappings can be
|
|
1243
|
+
overridden if needed.
|
|
1244
|
+
Additional packs — without aliases — can be plugged in alongside and used freely
|
|
1245
|
+
in your own templates.
|
|
946
1246
|
|
|
947
|
-
|
|
|
1247
|
+
| Icon library | Iconify package | Iconset import | Set name |
|
|
948
1248
|
|------------------------------------------------------------------|------------------------|-----------------------------------------------------------|------------|
|
|
949
1249
|
| [Remix Icon](https://remixicon.com/) | `@iconify-json/ri` | `@central-design-system/components/iconsets/remix` | `ri` |
|
|
950
1250
|
| [Phosphor Icons](https://phosphoricons.com/) | `@iconify-json/ph` | `@central-design-system/components/iconsets/phosphor` | `phosphor` |
|
|
@@ -952,26 +1252,28 @@ app.use(cds);
|
|
|
952
1252
|
| [Carbon](https://carbondesignsystem.com/elements/icons/library/) | `@iconify-json/carbon` | `@central-design-system/components/iconsets/carbon` | `carbon` |
|
|
953
1253
|
| [Material Design Icons](https://pictogrammers.com/library/mdi/) | `@iconify-json/mdi` | `@central-design-system/components/iconsets/mdi` | `mdi` |
|
|
954
1254
|
|
|
955
|
-
|
|
1255
|
+
Each module exports an object named after the pack: `icons` (the pack itself, for
|
|
1256
|
+
`sets`) and `aliases` (the aliases, for `aliases`).
|
|
956
1257
|
|
|
957
|
-
|
|
1258
|
+
Install the pack you need from the table above:
|
|
958
1259
|
|
|
959
1260
|
```bash
|
|
960
1261
|
npm install @iconify-json/ri
|
|
961
1262
|
```
|
|
962
1263
|
|
|
963
|
-
>
|
|
964
|
-
>
|
|
1264
|
+
> Icons from the table run through UnoCSS, so you have to install and configure
|
|
1265
|
+
> UnoCSS first. See the [official documentation](https://unocss.dev/integrations/)
|
|
1266
|
+
> for details.
|
|
965
1267
|
|
|
966
|
-
|
|
1268
|
+
Here is an example integration in a Vite project.
|
|
967
1269
|
|
|
968
|
-
1.
|
|
1270
|
+
1. Install UnoCSS as a dev dependency (see the [Vite integration](https://unocss.dev/integrations/vite)):
|
|
969
1271
|
|
|
970
1272
|
```bash
|
|
971
1273
|
npm install -D unocss
|
|
972
1274
|
```
|
|
973
1275
|
|
|
974
|
-
2.
|
|
1276
|
+
2. Add the UnoCSS plugin to your Vite config:
|
|
975
1277
|
|
|
976
1278
|
```ts
|
|
977
1279
|
// vite.config.ts
|
|
@@ -985,7 +1287,7 @@ export default defineConfig({
|
|
|
985
1287
|
})
|
|
986
1288
|
```
|
|
987
1289
|
|
|
988
|
-
3.
|
|
1290
|
+
3. Create an **unocss.config.ts** file in the project root:
|
|
989
1291
|
|
|
990
1292
|
```ts
|
|
991
1293
|
// unocss.config.ts
|
|
@@ -1002,12 +1304,14 @@ export default defineConfig({
|
|
|
1002
1304
|
})
|
|
1003
1305
|
```
|
|
1004
1306
|
|
|
1005
|
-
>
|
|
1006
|
-
>
|
|
1007
|
-
>
|
|
1307
|
+
> Nothing else needs to go into `unocss.config.ts`: CDS iconsets carry the
|
|
1308
|
+
> `@unocss-include` marker, so UnoCSS scans them on its own — even though they
|
|
1309
|
+
> live in `node_modules` as `.js` files, which are not part of
|
|
1310
|
+
> `content.pipeline.include` by default.
|
|
1008
1311
|
|
|
1009
|
-
4.
|
|
1010
|
-
|
|
1312
|
+
4. Pass the icon pack to `createCds()`.
|
|
1313
|
+
The example uses the **[Remix](https://remixicon.com/)** pack, but you can swap it
|
|
1314
|
+
for any other pack from the table above:
|
|
1011
1315
|
|
|
1012
1316
|
```ts
|
|
1013
1317
|
import { createCds } from '@central-design-system/components';
|
|
@@ -1026,21 +1330,26 @@ const cds = createCds({
|
|
|
1026
1330
|
app.use(cds);
|
|
1027
1331
|
```
|
|
1028
1332
|
|
|
1029
|
-
>
|
|
1030
|
-
>
|
|
1031
|
-
>
|
|
1333
|
+
> Import the pack through the `@central-design-system/components/iconsets/<pack>`
|
|
1334
|
+
> subpath, not from the shared `iconsets` object. The shared object references all
|
|
1335
|
+
> packs at once and is not tree-shaken — you would ship the JS and CSS of all five
|
|
1336
|
+
> packs (≈370 KB instead of ≈70 KB for a single one).
|
|
1032
1337
|
|
|
1033
|
-
|
|
1338
|
+
After that, pick any icon from the pack — for example
|
|
1339
|
+
[ri:settings-3-line](https://icon-sets.iconify.design/ri/?icon-filter=settings-3-line) —
|
|
1340
|
+
and use it in templates:
|
|
1034
1341
|
|
|
1035
1342
|
```html
|
|
1036
1343
|
<CdsButton icon="i-ri:settings-3-line" />
|
|
1037
1344
|
```
|
|
1038
1345
|
|
|
1039
|
-
> UnoCSS
|
|
1346
|
+
> UnoCSS uses the `i-` prefix for icons. CDS uses the same prefix and already
|
|
1347
|
+
> configures its aliases with it — don't change it, or the CDS aliases will stop
|
|
1348
|
+
> working.
|
|
1040
1349
|
|
|
1041
|
-
## Legacy
|
|
1350
|
+
## Legacy icon pack from CDS v3
|
|
1042
1351
|
|
|
1043
|
-
|
|
1352
|
+
If you need the full icon pack from CDS v3, plug it in like this:
|
|
1044
1353
|
|
|
1045
1354
|
```bash
|
|
1046
1355
|
npm install @central-design-system/icons
|
|
@@ -1058,16 +1367,21 @@ app.use(cds);
|
|
|
1058
1367
|
|
|
1059
1368
|
---
|
|
1060
1369
|
|
|
1370
|
+
---
|
|
1371
|
+
sourceHash: 2d02d03da0e4d6f0fcb171775b7b88784a216ac0
|
|
1372
|
+
---
|
|
1373
|
+
|
|
1061
1374
|
# Display & Platform
|
|
1062
1375
|
|
|
1063
|
-
Central Design System
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
(
|
|
1376
|
+
Central Design System exposes reactive information about the **screen**
|
|
1377
|
+
(breakpoints, viewport size, mobile mode) and the **platform** (browser, OS,
|
|
1378
|
+
device type) through a single composable — `useDisplay`. Breakpoints are the same
|
|
1379
|
+
in JavaScript and in styles (the `cds-breakpoint-*` SCSS mixins), so responsive
|
|
1380
|
+
logic in script and CSS always agrees.
|
|
1067
1381
|
|
|
1068
|
-
##
|
|
1382
|
+
## Breakpoints
|
|
1069
1383
|
|
|
1070
|
-
|
|
|
1384
|
+
| Breakpoint | Width range (px) | Start width | Grid columns |
|
|
1071
1385
|
| --- | --- | --- | --- |
|
|
1072
1386
|
| `xs` | `0 … 671` | `0` | 4 |
|
|
1073
1387
|
| `sm` | `672 … 1055` | `672` | 8 |
|
|
@@ -1075,45 +1389,46 @@ Central Design System предоставляет реактивную инфор
|
|
|
1075
1389
|
| `lg` | `1312 … 1583` | `1312` | 16 |
|
|
1076
1390
|
| `xl` | `1584 … ∞` | `1584` | 16 |
|
|
1077
1391
|
|
|
1078
|
-
|
|
1392
|
+
The values have a single source:
|
|
1079
1393
|
|
|
1080
1394
|
- JS — `defaultDisplayOptions.thresholds` (`src/composables/useDisplay/internal/useDisplay.constants.ts`);
|
|
1081
1395
|
- SCSS — `$grid-breakpoints` (`src/styles/utilities/grid/_config.scss`).
|
|
1082
1396
|
|
|
1083
|
-
##
|
|
1397
|
+
## In JavaScript — `useDisplay`
|
|
1084
1398
|
|
|
1085
|
-
|
|
1086
|
-
|
|
1399
|
+
The `useDisplay` composable returns the reactive state of the screen and the
|
|
1400
|
+
platform. It works out of the box as long as the application is initialized
|
|
1401
|
+
through `createCds` (which provides `cds:display`).
|
|
1087
1402
|
|
|
1088
1403
|
```ts
|
|
1089
1404
|
import { useDisplay } from '@central-design-system/components';
|
|
1090
1405
|
|
|
1091
1406
|
const display = useDisplay();
|
|
1092
1407
|
|
|
1093
|
-
display.width.value; //
|
|
1408
|
+
display.width.value; // current viewport width, px
|
|
1094
1409
|
display.name.value; // 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
1095
|
-
display.mobile.value; // true
|
|
1410
|
+
display.mobile.value; // true when width < mobileBreakpoint ('sm' by default)
|
|
1096
1411
|
```
|
|
1097
1412
|
|
|
1098
|
-
###
|
|
1413
|
+
### Available flags
|
|
1099
1414
|
|
|
1100
|
-
|
|
|
1415
|
+
| Flag | Meaning |
|
|
1101
1416
|
| --- | --- |
|
|
1102
|
-
| `xs` / `sm` / `md` / `lg` / `xl` |
|
|
1103
|
-
| `smUp` / `mdUp` / `lgUp` / `xlUp` |
|
|
1104
|
-
| `smDown` / `mdDown` / `lgDown` / `xlDown` |
|
|
1105
|
-
| `name` |
|
|
1106
|
-
| `mobile` |
|
|
1107
|
-
| `mobileBreakpoint` |
|
|
1108
|
-
| `width` / `height` |
|
|
1109
|
-
| `thresholds` |
|
|
1110
|
-
| `platform` |
|
|
1111
|
-
| `update()` |
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
(
|
|
1115
|
-
|
|
1116
|
-
###
|
|
1417
|
+
| `xs` / `sm` / `md` / `lg` / `xl` | exactly one is active — the current breakpoint |
|
|
1418
|
+
| `smUp` / `mdUp` / `lgUp` / `xlUp` | width ≥ the breakpoint's start width ("and up") |
|
|
1419
|
+
| `smDown` / `mdDown` / `lgDown` / `xlDown` | the breakpoint and everything below it ("and down") |
|
|
1420
|
+
| `name` | name of the current breakpoint |
|
|
1421
|
+
| `mobile` | mobile mode (based on `mobileBreakpoint`) |
|
|
1422
|
+
| `mobileBreakpoint` | current mobile mode threshold |
|
|
1423
|
+
| `width` / `height` | viewport size, px |
|
|
1424
|
+
| `thresholds` | current threshold map |
|
|
1425
|
+
| `platform` | platform/browser flags (see [Platform](#platform)) |
|
|
1426
|
+
| `update()` | force a recalculation of size and platform |
|
|
1427
|
+
|
|
1428
|
+
For example, `mdUp` is true when `width ≥ 1056`, and `smDown` when `width < 1056`
|
|
1429
|
+
(that is, it covers the `xs` and `sm` ranges).
|
|
1430
|
+
|
|
1431
|
+
### Example in a component
|
|
1117
1432
|
|
|
1118
1433
|
```tsx
|
|
1119
1434
|
import { useDisplay } from '@central-design-system/components';
|
|
@@ -1127,19 +1442,20 @@ defineRender(() => (
|
|
|
1127
1442
|
));
|
|
1128
1443
|
```
|
|
1129
1444
|
|
|
1130
|
-
###
|
|
1445
|
+
### Mobile mode at the prop level
|
|
1131
1446
|
|
|
1132
|
-
|
|
1133
|
-
`mobileBreakpoint` —
|
|
1447
|
+
Components that mix in `defineDisplayProps()` accept the `mobile` and
|
|
1448
|
+
`mobileBreakpoint` props — use them to override the mobile mode threshold
|
|
1449
|
+
locally:
|
|
1134
1450
|
|
|
1135
1451
|
```html
|
|
1136
|
-
<!--
|
|
1452
|
+
<!-- Mobile mode kicks in below 1056px (md) instead of the global 'sm' -->
|
|
1137
1453
|
<CdsSlideGroup mobile-breakpoint="md" />
|
|
1138
1454
|
```
|
|
1139
1455
|
|
|
1140
|
-
###
|
|
1456
|
+
### Overriding the thresholds globally
|
|
1141
1457
|
|
|
1142
|
-
|
|
1458
|
+
Thresholds and `mobileBreakpoint` are configured at initialization:
|
|
1143
1459
|
|
|
1144
1460
|
```ts
|
|
1145
1461
|
import { createCds } from '@central-design-system/components';
|
|
@@ -1152,75 +1468,79 @@ app.use(createCds({
|
|
|
1152
1468
|
}));
|
|
1153
1469
|
```
|
|
1154
1470
|
|
|
1155
|
-
>
|
|
1156
|
-
>
|
|
1471
|
+
> If you change the thresholds in JS, keep them in sync in SCSS
|
|
1472
|
+
> (`$grid-breakpoints`) — otherwise responsiveness in script and styles will
|
|
1473
|
+
> drift apart.
|
|
1157
1474
|
|
|
1158
|
-
##
|
|
1475
|
+
## In SCSS — the `cds-breakpoint-*` mixins
|
|
1159
1476
|
|
|
1160
|
-
|
|
1477
|
+
The mixins come from a public entry point:
|
|
1161
1478
|
|
|
1162
1479
|
```scss
|
|
1163
1480
|
@use '@central-design-system/components/styles/breakpoints' as breakpoint;
|
|
1164
1481
|
```
|
|
1165
1482
|
|
|
1166
|
-
>
|
|
1483
|
+
> In plain Dart Sass (without a bundler), use the pkg scheme and the Node
|
|
1484
|
+
> importer:
|
|
1167
1485
|
> `@use 'pkg:@central-design-system/components/styles/breakpoints' as breakpoint;`.
|
|
1168
1486
|
|
|
1169
|
-
### `cds-breakpoint-up($name)` —
|
|
1487
|
+
### `cds-breakpoint-up($name)` — "and up"
|
|
1170
1488
|
|
|
1171
1489
|
```scss
|
|
1172
1490
|
.card {
|
|
1173
1491
|
display: none;
|
|
1174
1492
|
|
|
1175
|
-
//
|
|
1493
|
+
// applies at min-width: 1056px (md and up)
|
|
1176
1494
|
@include breakpoint.cds-breakpoint-up(md) {
|
|
1177
1495
|
display: block;
|
|
1178
1496
|
}
|
|
1179
1497
|
}
|
|
1180
1498
|
```
|
|
1181
1499
|
|
|
1182
|
-
### `cds-breakpoint-down($name)` —
|
|
1500
|
+
### `cds-breakpoint-down($name)` — "and down"
|
|
1183
1501
|
|
|
1184
1502
|
```scss
|
|
1185
1503
|
.sidebar {
|
|
1186
|
-
//
|
|
1504
|
+
// applies at max-width: 1055.98px — that is, on sm and xs
|
|
1187
1505
|
@include breakpoint.cds-breakpoint-down(sm) {
|
|
1188
1506
|
display: none;
|
|
1189
1507
|
}
|
|
1190
1508
|
}
|
|
1191
1509
|
```
|
|
1192
1510
|
|
|
1193
|
-
`cds-breakpoint-down('<name>')`
|
|
1194
|
-
(
|
|
1195
|
-
|
|
1511
|
+
`cds-breakpoint-down('<name>')` covers the breakpoint itself **and everything
|
|
1512
|
+
below it** (the upper bound is the start of the next breakpoint minus `0.02px`).
|
|
1513
|
+
No media query is generated for the largest breakpoint (`xl`) — "xl and down" is
|
|
1514
|
+
every width.
|
|
1196
1515
|
|
|
1197
|
-
### `cds-breakpoint-between($lower, $upper)` —
|
|
1516
|
+
### `cds-breakpoint-between($lower, $upper)` — a range
|
|
1198
1517
|
|
|
1199
1518
|
```scss
|
|
1200
1519
|
.banner {
|
|
1201
|
-
// min-width: 672px
|
|
1520
|
+
// min-width: 672px and max-width: 1056px
|
|
1202
1521
|
@include breakpoint.cds-breakpoint-between(sm, md) {
|
|
1203
1522
|
padding: 16px;
|
|
1204
1523
|
}
|
|
1205
1524
|
}
|
|
1206
1525
|
```
|
|
1207
1526
|
|
|
1208
|
-
|
|
1527
|
+
Both mixins also accept a number instead of a name: `cds-breakpoint-up(900px)`.
|
|
1209
1528
|
|
|
1210
|
-
###
|
|
1529
|
+
### Other mixins and functions
|
|
1211
1530
|
|
|
1212
|
-
- `cds-breakpoint($name)` —
|
|
1213
|
-
- `cds-largest-breakpoint` — media query
|
|
1214
|
-
- `breakpoint-next($name)` / `breakpoint-prev($name)` —
|
|
1215
|
-
- `is-smallest-breakpoint($name)` —
|
|
1216
|
-
- `largest-breakpoint-name()` —
|
|
1531
|
+
- `cds-breakpoint($name)` — an alias for `cds-breakpoint-up`.
|
|
1532
|
+
- `cds-largest-breakpoint` — media query for the largest breakpoint.
|
|
1533
|
+
- `breakpoint-next($name)` / `breakpoint-prev($name)` — the neighboring breakpoint.
|
|
1534
|
+
- `is-smallest-breakpoint($name)` — whether `$name` is the smallest one.
|
|
1535
|
+
- `largest-breakpoint-name()` — name of the largest breakpoint.
|
|
1217
1536
|
|
|
1218
|
-
##
|
|
1537
|
+
## JS ↔ CSS correspondence
|
|
1219
1538
|
|
|
1220
|
-
|
|
1221
|
-
|
|
1539
|
+
The `useDisplay` flags and the mixins' media queries cover identical width
|
|
1540
|
+
ranges — that's what lets you write consistent responsive logic in script and
|
|
1541
|
+
styles.
|
|
1222
1542
|
|
|
1223
|
-
| JS (`useDisplay`) | SCSS
|
|
1543
|
+
| JS (`useDisplay`) | SCSS mixin | Width range |
|
|
1224
1544
|
| --- | --- | --- |
|
|
1225
1545
|
| `smUp` | `cds-breakpoint-up(sm)` | `≥ 672` |
|
|
1226
1546
|
| `mdUp` | `cds-breakpoint-up(md)` | `≥ 1056` |
|
|
@@ -1229,19 +1549,20 @@ app.use(createCds({
|
|
|
1229
1549
|
| `smDown` | `cds-breakpoint-down(sm)` | `< 1056` |
|
|
1230
1550
|
| `mdDown` | `cds-breakpoint-down(md)` | `< 1312` |
|
|
1231
1551
|
| `lgDown` | `cds-breakpoint-down(lg)` | `< 1584` |
|
|
1232
|
-
| `xlDown` | `cds-breakpoint-down(xl)` |
|
|
1552
|
+
| `xlDown` | `cds-breakpoint-down(xl)` | every width |
|
|
1233
1553
|
|
|
1234
|
-
>
|
|
1235
|
-
>
|
|
1236
|
-
> `smDown`
|
|
1237
|
-
>
|
|
1238
|
-
>
|
|
1239
|
-
>
|
|
1554
|
+
> **Important (migrating from CDS 3).** In CDS 3 the semantics of
|
|
1555
|
+
> `cds-breakpoint-down` in SCSS differed from JS: `down('sm')` meant "strictly
|
|
1556
|
+
> below `sm`" (only `xs`), whereas `smDown` in JS means "`sm` and down". In CDS 4
|
|
1557
|
+
> the CSS is aligned with JS: `down('<name>')` now always means "`<name>` and
|
|
1558
|
+
> down". If you are porting styles from CDS 3, shift the `down()` argument one
|
|
1559
|
+
> step down (old `down('md')` ⇒ new `down('sm')`).
|
|
1560
|
+
> See the Migration Guide.
|
|
1240
1561
|
|
|
1241
|
-
##
|
|
1562
|
+
## Platform
|
|
1242
1563
|
|
|
1243
|
-
`useDisplay().platform`
|
|
1244
|
-
|
|
1564
|
+
`useDisplay().platform` is a reactive object with device, OS and browser flags.
|
|
1565
|
+
Detection is based on `navigator.userAgent` and touch support.
|
|
1245
1566
|
|
|
1246
1567
|
```ts
|
|
1247
1568
|
import { useDisplay } from '@central-design-system/components';
|
|
@@ -1249,33 +1570,33 @@ import { useDisplay } from '@central-design-system/components';
|
|
|
1249
1570
|
const { platform } = useDisplay();
|
|
1250
1571
|
|
|
1251
1572
|
if (platform.value.ios) {
|
|
1252
|
-
//
|
|
1573
|
+
// special behavior for iOS
|
|
1253
1574
|
}
|
|
1254
1575
|
|
|
1255
1576
|
const isTouchDevice = platform.value.touch;
|
|
1256
1577
|
```
|
|
1257
1578
|
|
|
1258
|
-
###
|
|
1579
|
+
### Fields of the `platform` object
|
|
1259
1580
|
|
|
1260
|
-
|
|
1581
|
+
Every field is a `boolean`.
|
|
1261
1582
|
|
|
1262
|
-
|
|
|
1583
|
+
| Field | Meaning |
|
|
1263
1584
|
| --- | --- |
|
|
1264
|
-
| `android` |
|
|
1265
|
-
| `ios` |
|
|
1266
|
-
| `cordova` |
|
|
1267
|
-
| `electron` |
|
|
1268
|
-
| `chrome` |
|
|
1269
|
-
| `edge` |
|
|
1270
|
-
| `firefox` |
|
|
1271
|
-
| `opera` |
|
|
1272
|
-
| `win` |
|
|
1273
|
-
| `mac` |
|
|
1274
|
-
| `linux` |
|
|
1275
|
-
| `touch` |
|
|
1276
|
-
| `ssr` |
|
|
1277
|
-
|
|
1278
|
-
###
|
|
1585
|
+
| `android` | an Android device |
|
|
1586
|
+
| `ios` | an iOS device (iPhone / iPad / iPod) |
|
|
1587
|
+
| `cordova` | the app runs in Cordova |
|
|
1588
|
+
| `electron` | the app runs in Electron |
|
|
1589
|
+
| `chrome` | Chrome browser |
|
|
1590
|
+
| `edge` | Edge browser |
|
|
1591
|
+
| `firefox` | Firefox browser |
|
|
1592
|
+
| `opera` | Opera browser |
|
|
1593
|
+
| `win` | Windows OS |
|
|
1594
|
+
| `mac` | macOS |
|
|
1595
|
+
| `linux` | Linux OS |
|
|
1596
|
+
| `touch` | the device supports touch |
|
|
1597
|
+
| `ssr` | the value was computed on the server (SSR) |
|
|
1598
|
+
|
|
1599
|
+
### Example: a class on the app root
|
|
1279
1600
|
|
|
1280
1601
|
```tsx
|
|
1281
1602
|
import { useDisplay } from '@central-design-system/components';
|
|
@@ -1295,31 +1616,37 @@ defineRender(() => (
|
|
|
1295
1616
|
));
|
|
1296
1617
|
```
|
|
1297
1618
|
|
|
1298
|
-
>
|
|
1299
|
-
>
|
|
1300
|
-
> `platform`
|
|
1301
|
-
>
|
|
1302
|
-
>
|
|
1619
|
+
> **Careful with user-agent sniffing.** Detecting the browser or OS from
|
|
1620
|
+
> `userAgent` is unreliable (the string can be spoofed, and new browsers may not
|
|
1621
|
+
> be recognized). Use `platform` for progressive enhancement — say, a fix
|
|
1622
|
+
> specific to iOS Safari — not as the only gate in front of a feature. For
|
|
1623
|
+
> feature detection, prefer capability checks (`'ontouchstart' in window` and the
|
|
1624
|
+
> like).
|
|
1303
1625
|
|
|
1304
1626
|
### SSR
|
|
1305
1627
|
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
`display.update()` (
|
|
1309
|
-
|
|
1628
|
+
During server-side rendering `userAgent` is unavailable, so `platform.ssr === true`
|
|
1629
|
+
and the rest of the flags are `false`. After hydration the values can be
|
|
1630
|
+
recalculated by calling `display.update()` (which recalculates both size and
|
|
1631
|
+
platform). Initial sizes for SSR are set through the second argument of
|
|
1632
|
+
`createDisplay(options, ssr)` or the `ssr` option in `createCds`.
|
|
1310
1633
|
|
|
1311
1634
|
---
|
|
1312
1635
|
|
|
1313
|
-
|
|
1636
|
+
---
|
|
1637
|
+
sourceHash: 49864e870f2f989420a5ebf7ffc7eb1a3458124a
|
|
1638
|
+
---
|
|
1314
1639
|
|
|
1315
|
-
|
|
1316
|
-
или только внутри определённого поддерева. Так вы один раз описываете «как выглядят кнопки
|
|
1317
|
-
в нашем продукте» и перестаёте дублировать одни и те же пропсы в каждом шаблоне.
|
|
1640
|
+
# Global configuration
|
|
1318
1641
|
|
|
1319
|
-
|
|
1642
|
+
CDS 4 lets you set default prop values — globally, for a specific component, or
|
|
1643
|
+
only inside a given subtree. You describe "what buttons look like in our product"
|
|
1644
|
+
once and stop repeating the same props in every template.
|
|
1320
1645
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1646
|
+
## Setup
|
|
1647
|
+
|
|
1648
|
+
Default values are set through the `defaults` option of `createCds`. The `global`
|
|
1649
|
+
key affects every component; a key named after a component affects only that one.
|
|
1323
1650
|
|
|
1324
1651
|
```ts
|
|
1325
1652
|
import { createApp } from 'vue';
|
|
@@ -1347,42 +1674,43 @@ const cds = createCds({
|
|
|
1347
1674
|
createApp(App).use(cds);
|
|
1348
1675
|
```
|
|
1349
1676
|
|
|
1350
|
-
|
|
1677
|
+
**Important.** Props in `defaults` are written in camelCase: `hideDetails`, not
|
|
1678
|
+
`hide-details`.
|
|
1351
1679
|
|
|
1352
|
-
|
|
1353
|
-
`CdsCardActions`
|
|
1354
|
-
|
|
1680
|
+
A component key is its name from `defineOptions({ name })` — `CdsButton`,
|
|
1681
|
+
`CdsTextInput`, `CdsCardActions` and so on. Subcomponent names (`CdsCardTitle`,
|
|
1682
|
+
`CdsListItem`) work exactly like root component names.
|
|
1355
1683
|
|
|
1356
|
-
###
|
|
1684
|
+
### Resolution order
|
|
1357
1685
|
|
|
1358
|
-
|
|
1686
|
+
For every prop, CDS takes the first value that applies:
|
|
1359
1687
|
|
|
1360
|
-
1.
|
|
1361
|
-
2. `defaults
|
|
1362
|
-
3. `defaults.global
|
|
1363
|
-
4.
|
|
1688
|
+
1. the prop explicitly passed in the template;
|
|
1689
|
+
2. `defaults.<ComponentName>.<prop>` from the nearest defaults context;
|
|
1690
|
+
3. `defaults.global.<prop>`;
|
|
1691
|
+
4. the default value declared in the component itself.
|
|
1364
1692
|
|
|
1365
|
-
|
|
1693
|
+
An explicitly passed prop always wins — defaults can never override the template.
|
|
1366
1694
|
|
|
1367
|
-
###
|
|
1695
|
+
### Changing defaults at runtime
|
|
1368
1696
|
|
|
1369
|
-
`createCds`
|
|
1370
|
-
|
|
1697
|
+
`createCds` returns an instance whose defaults live in a reactive ref. You can
|
|
1698
|
+
change them on the fly — every mounted component recalculates:
|
|
1371
1699
|
|
|
1372
1700
|
```ts
|
|
1373
1701
|
const cds = createCds({ components, directives });
|
|
1374
1702
|
|
|
1375
|
-
//
|
|
1703
|
+
// for example, turn on compact mode based on a user setting
|
|
1376
1704
|
cds.defaults.value = {
|
|
1377
1705
|
...cds.defaults.value,
|
|
1378
1706
|
global: { size: 'sm' }
|
|
1379
1707
|
};
|
|
1380
1708
|
```
|
|
1381
1709
|
|
|
1382
|
-
##
|
|
1710
|
+
## Contextual defaults
|
|
1383
1711
|
|
|
1384
|
-
|
|
1385
|
-
|
|
1712
|
+
Defaults can be set for components nested inside another component. For example,
|
|
1713
|
+
to make every button inside a card secondary by default:
|
|
1386
1714
|
|
|
1387
1715
|
```ts
|
|
1388
1716
|
createCds({
|
|
@@ -1394,8 +1722,9 @@ createCds({
|
|
|
1394
1722
|
});
|
|
1395
1723
|
```
|
|
1396
1724
|
|
|
1397
|
-
|
|
1398
|
-
|
|
1725
|
+
The rule is simple: a capitalized key is the name of a nested component, a
|
|
1726
|
+
lowercase key is a prop of the current component. Nesting is not limited to one
|
|
1727
|
+
level:
|
|
1399
1728
|
|
|
1400
1729
|
```ts
|
|
1401
1730
|
createCds({
|
|
@@ -1409,23 +1738,24 @@ createCds({
|
|
|
1409
1738
|
});
|
|
1410
1739
|
```
|
|
1411
1740
|
|
|
1412
|
-
|
|
1413
|
-
|
|
1741
|
+
The library uses the same mechanism internally so that grouping components can
|
|
1742
|
+
hand their settings down to their children:
|
|
1414
1743
|
|
|
1415
|
-
- `CdsButtonGroup`
|
|
1416
|
-
- `CdsTagGroup`
|
|
1417
|
-
- `CdsSelectionControlGroup`
|
|
1418
|
-
|
|
1419
|
-
-
|
|
1420
|
-
`CdsExpandablePanels`, `CdsOtpInput
|
|
1744
|
+
- `CdsButtonGroup` sets the `appearance`, `color`, `baseColor`, `size` props on nested `CdsButton`s;
|
|
1745
|
+
- `CdsTagGroup` sets the `color`, `activeColor`, `disabled`, `filter` props on `CdsTag`;
|
|
1746
|
+
- `CdsSelectionControlGroup` passes settings to the controls, with the target component name
|
|
1747
|
+
set by the `defaultsTarget` prop (`CdsCheckbox`, `CdsRadio` and so on);
|
|
1748
|
+
- `CdsTabs`, `CdsSteps`, `CdsList`, `CdsBreadcrumbs`, `CdsButtonToggle`,
|
|
1749
|
+
`CdsExpandablePanels`, `CdsOtpInput` work the same way.
|
|
1421
1750
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1751
|
+
That's why `<CdsButtonGroup size="sm">` makes every button inside small — you
|
|
1752
|
+
don't have to set `size` on each of them.
|
|
1424
1753
|
|
|
1425
|
-
##
|
|
1754
|
+
## Global class and style
|
|
1426
1755
|
|
|
1427
|
-
|
|
1428
|
-
|
|
1756
|
+
Besides props, a component's defaults can carry `class` and `style`. It's a
|
|
1757
|
+
convenient way to apply product-specific rules to every instance of a component
|
|
1758
|
+
without touching the templates:
|
|
1429
1759
|
|
|
1430
1760
|
```ts
|
|
1431
1761
|
createCds({
|
|
@@ -1437,7 +1767,7 @@ createCds({
|
|
|
1437
1767
|
});
|
|
1438
1768
|
```
|
|
1439
1769
|
|
|
1440
|
-
|
|
1770
|
+
Any value Vue accepts works — a string, an object, an array:
|
|
1441
1771
|
|
|
1442
1772
|
```ts
|
|
1443
1773
|
createCds({
|
|
@@ -1449,16 +1779,17 @@ createCds({
|
|
|
1449
1779
|
});
|
|
1450
1780
|
```
|
|
1451
1781
|
|
|
1452
|
-
|
|
1453
|
-
|
|
1782
|
+
Unlike ordinary props, `class` and `style` are not overwritten by the template
|
|
1783
|
+
but **merged** with it. So `<CdsButton class="mt-2">` gets both `my-button` and
|
|
1784
|
+
`mt-2`.
|
|
1454
1785
|
|
|
1455
|
-
|
|
1456
|
-
|
|
1786
|
+
**Important.** `class` and `style` only work under a specific component's key. In
|
|
1787
|
+
`global` they are ignored.
|
|
1457
1788
|
|
|
1458
|
-
##
|
|
1789
|
+
## Aliases
|
|
1459
1790
|
|
|
1460
|
-
|
|
1461
|
-
|
|
1791
|
+
An alias is the same component registered under a different name with its own
|
|
1792
|
+
defaults. Aliases are a handy way to assemble "product" variants of components.
|
|
1462
1793
|
|
|
1463
1794
|
```ts
|
|
1464
1795
|
import { createCds, components, directives, CdsButton } from '@central-design-system/components';
|
|
@@ -1484,24 +1815,26 @@ const cds = createCds({
|
|
|
1484
1815
|
});
|
|
1485
1816
|
```
|
|
1486
1817
|
|
|
1487
|
-
|
|
1818
|
+
Aliases are registered globally, so you can use them in templates right away:
|
|
1488
1819
|
|
|
1489
1820
|
```vue
|
|
1490
1821
|
<template>
|
|
1491
|
-
<CdsButtonPrimary
|
|
1492
|
-
<CdsButtonDanger class="ml-
|
|
1822
|
+
<CdsButtonPrimary>Save</CdsButtonPrimary>
|
|
1823
|
+
<CdsButtonDanger class="ml-2">Delete</CdsButtonDanger>
|
|
1493
1824
|
</template>
|
|
1494
1825
|
```
|
|
1495
1826
|
|
|
1496
|
-
|
|
1497
|
-
`defaults.CdsButton`,
|
|
1498
|
-
|
|
1827
|
+
**Important.** An alias does not inherit the base component's defaults. If the
|
|
1828
|
+
configuration has `defaults.CdsButton`, it will not apply to `<CdsButtonPrimary>`
|
|
1829
|
+
— defaults are looked up by the alias name. Move shared settings into `global` or
|
|
1830
|
+
duplicate them under the alias key.
|
|
1499
1831
|
|
|
1500
|
-
##
|
|
1832
|
+
## Defaults for part of the application
|
|
1501
1833
|
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1834
|
+
To set defaults for a subtree rather than globally, use the
|
|
1835
|
+
`CdsDefaultsProvider` component. The Controls panel in Storybook is built on it
|
|
1836
|
+
too: the values from the panel are applied to the example's components as
|
|
1837
|
+
defaults.
|
|
1505
1838
|
|
|
1506
1839
|
```vue
|
|
1507
1840
|
<script setup lang="ts">
|
|
@@ -1510,26 +1843,27 @@ import { CdsButton, CdsDefaultsProvider } from '@central-design-system/component
|
|
|
1510
1843
|
|
|
1511
1844
|
<template>
|
|
1512
1845
|
<CdsDefaultsProvider :defaults="{ CdsButton: { appearance: 'tertiary', size: 'sm' } }">
|
|
1513
|
-
<CdsButton
|
|
1846
|
+
<CdsButton>Small tertiary button</CdsButton>
|
|
1514
1847
|
</CdsDefaultsProvider>
|
|
1515
1848
|
</template>
|
|
1516
1849
|
```
|
|
1517
1850
|
|
|
1518
|
-
|
|
|
1851
|
+
| Prop | Type | Purpose |
|
|
1519
1852
|
| ---------- | ------------------- | -------------------------------------------------------------------------------------------- |
|
|
1520
|
-
| `defaults` | `DefaultsOptions` |
|
|
1521
|
-
| `scoped` | `boolean` |
|
|
1522
|
-
| `reset` | `number \| string` |
|
|
1523
|
-
| `root` | `boolean \| string` |
|
|
1524
|
-
| `disabled` | `boolean` |
|
|
1853
|
+
| `defaults` | `DefaultsOptions` | Defaults for the subtree; merged with the inherited ones by default |
|
|
1854
|
+
| `scoped` | `boolean` | Don't mix with the parent defaults — only the ones set here apply |
|
|
1855
|
+
| `reset` | `number \| string` | Go N levels up the defaults chain |
|
|
1856
|
+
| `root` | `boolean \| string` | Fall back to the root defaults from `createCds`; with a string — to a named group inside them |
|
|
1857
|
+
| `disabled` | `boolean` | Provide nothing — the subtree gets the parent defaults as they are |
|
|
1525
1858
|
|
|
1526
|
-
|
|
1527
|
-
`CdsButtonGroup
|
|
1859
|
+
The typical use for `scoped` is an "island" inside someone else's environment:
|
|
1860
|
+
enclosing groups (`CdsButtonGroup`, say) should not impose their settings on your
|
|
1861
|
+
block.
|
|
1528
1862
|
|
|
1529
|
-
##
|
|
1863
|
+
## Your own components
|
|
1530
1864
|
|
|
1531
|
-
|
|
1532
|
-
|
|
1865
|
+
Your application's own components can take part in the defaults system too. Pass
|
|
1866
|
+
their props through `useDefaults`:
|
|
1533
1867
|
|
|
1534
1868
|
```vue
|
|
1535
1869
|
<script setup lang="ts">
|
|
@@ -1540,39 +1874,40 @@ const props = useDefaults(_props, 'MyComponent');
|
|
|
1540
1874
|
</script>
|
|
1541
1875
|
|
|
1542
1876
|
<template>
|
|
1543
|
-
<div
|
|
1877
|
+
<div>I am {{ props.foo }}</div>
|
|
1544
1878
|
</template>
|
|
1545
1879
|
```
|
|
1546
1880
|
|
|
1547
|
-
|
|
1881
|
+
`useDefaults` takes two arguments, both optional:
|
|
1548
1882
|
|
|
1549
|
-
- `props` —
|
|
1550
|
-
- `name` —
|
|
1551
|
-
|
|
1883
|
+
- `props` — the props object returned by `defineProps`;
|
|
1884
|
+
- `name` — the component name used to look up the key in `defaults`. If omitted,
|
|
1885
|
+
the name from `defineOptions({ name })` is used, and failing that, the file name.
|
|
1552
1886
|
|
|
1553
|
-
|
|
1887
|
+
Now the component is configurable from the shared configuration:
|
|
1554
1888
|
|
|
1555
1889
|
```ts
|
|
1556
1890
|
createCds({
|
|
1557
1891
|
defaults: {
|
|
1558
|
-
MyComponent: { foo: '
|
|
1892
|
+
MyComponent: { foo: 'bar' }
|
|
1559
1893
|
}
|
|
1560
1894
|
});
|
|
1561
1895
|
```
|
|
1562
1896
|
|
|
1563
|
-
|
|
1564
|
-
|
|
1897
|
+
**Important.** In the template, refer to `props.foo`, not `foo`. `useDefaults`
|
|
1898
|
+
returns a proxy over the props, and destructured `defineProps` variables bypass
|
|
1899
|
+
it:
|
|
1565
1900
|
|
|
1566
1901
|
```diff
|
|
1567
|
-
-<div
|
|
1568
|
-
+<div
|
|
1902
|
+
-<div>I am {{ foo }}</div>
|
|
1903
|
+
+<div>I am {{ props.foo }}</div>
|
|
1569
1904
|
```
|
|
1570
1905
|
|
|
1571
|
-
###
|
|
1906
|
+
### Nested defaults in your own components
|
|
1572
1907
|
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1908
|
+
To make your component hand defaults down to its children (the way
|
|
1909
|
+
`CdsButtonGroup` does), just call `useDefaults()` with no arguments — the nested
|
|
1910
|
+
keys from its `defaults` section go into the child context:
|
|
1576
1911
|
|
|
1577
1912
|
```vue
|
|
1578
1913
|
<script setup lang="ts">
|
|
@@ -1598,7 +1933,8 @@ createCds({
|
|
|
1598
1933
|
});
|
|
1599
1934
|
```
|
|
1600
1935
|
|
|
1601
|
-
|
|
1936
|
+
If the children's defaults depend on the component's props, use `provideDefaults`
|
|
1937
|
+
directly:
|
|
1602
1938
|
|
|
1603
1939
|
```vue
|
|
1604
1940
|
<script setup lang="ts">
|
|
@@ -1621,10 +1957,11 @@ provideDefaults({
|
|
|
1621
1957
|
</template>
|
|
1622
1958
|
```
|
|
1623
1959
|
|
|
1624
|
-
## Blueprint —
|
|
1960
|
+
## Blueprint — a configuration preset
|
|
1625
1961
|
|
|
1626
|
-
|
|
1627
|
-
|
|
1962
|
+
If several applications need the same set of options, extract it into a
|
|
1963
|
+
`blueprint`: a plain `createCds` options object that the rest of the
|
|
1964
|
+
configuration is layered on top of.
|
|
1628
1965
|
|
|
1629
1966
|
```ts
|
|
1630
1967
|
import { createCds, components, directives } from '@central-design-system/components';
|
|
@@ -1641,32 +1978,37 @@ const cds = createCds({
|
|
|
1641
1978
|
blueprint: productBlueprint,
|
|
1642
1979
|
components,
|
|
1643
1980
|
directives,
|
|
1644
|
-
//
|
|
1981
|
+
// overrides the value from the blueprint
|
|
1645
1982
|
defaults: {
|
|
1646
1983
|
CdsButton: { size: 'sm' }
|
|
1647
1984
|
}
|
|
1648
1985
|
});
|
|
1649
1986
|
```
|
|
1650
1987
|
|
|
1651
|
-
|
|
1652
|
-
`appearance: 'secondary'`
|
|
1988
|
+
Options are merged deeply (`mergeDeep`), so in the example above the buttons keep
|
|
1989
|
+
`appearance: 'secondary'` from the preset and gain `size: 'sm'`.
|
|
1990
|
+
|
|
1991
|
+
---
|
|
1653
1992
|
|
|
1993
|
+
---
|
|
1994
|
+
sourceHash: 26c790bd53cd55729b9902cf5d1032b5c6457f6b
|
|
1654
1995
|
---
|
|
1655
1996
|
|
|
1656
|
-
#
|
|
1997
|
+
# Internationalization (i18n)
|
|
1657
1998
|
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1999
|
+
CDS components carry texts of their own: "No data available" in a select, the
|
|
2000
|
+
table filter labels, the `aria-label` of a close button, the file counter. They
|
|
2001
|
+
all go through the built-in localization layer, so you can translate them into
|
|
2002
|
+
another language, override a single string for your product, or switch languages
|
|
2003
|
+
on the fly — without rewriting components.
|
|
1662
2004
|
|
|
1663
|
-
|
|
1664
|
-
|
|
2005
|
+
The library ships two dictionaries — Russian and English. `ru` is active by
|
|
2006
|
+
default, so out of the box everything is in Russian.
|
|
1665
2007
|
|
|
1666
|
-
##
|
|
2008
|
+
## Setup
|
|
1667
2009
|
|
|
1668
|
-
|
|
1669
|
-
|
|
2010
|
+
The locale is configured through the `locale` option of `createCds`. Switching to
|
|
2011
|
+
the built-in English is a one-liner — you don't need to pass any dictionaries:
|
|
1670
2012
|
|
|
1671
2013
|
```ts
|
|
1672
2014
|
import { createApp } from 'vue';
|
|
@@ -1686,7 +2028,7 @@ const cds = createCds({
|
|
|
1686
2028
|
createApp(App).use(cds);
|
|
1687
2029
|
```
|
|
1688
2030
|
|
|
1689
|
-
|
|
2031
|
+
Languages the library doesn't have are added as a dictionary in `messages`:
|
|
1690
2032
|
|
|
1691
2033
|
```ts
|
|
1692
2034
|
import de from './locales/cds-de';
|
|
@@ -1702,43 +2044,46 @@ createCds({
|
|
|
1702
2044
|
});
|
|
1703
2045
|
```
|
|
1704
2046
|
|
|
1705
|
-
|
|
|
2047
|
+
| Option | Type | Purpose |
|
|
1706
2048
|
| ------------------ | ------------------------- | ----------------------------------------------------------------------------- |
|
|
1707
|
-
| `locale` | `string` |
|
|
1708
|
-
| `fallback` | `string` |
|
|
1709
|
-
| `messages` | `LocaleMessages` |
|
|
1710
|
-
| `decimalSeparator` | `string` |
|
|
1711
|
-
| `rtl` | `Record<string, boolean>` |
|
|
1712
|
-
| `adapter` | `LocaleInstance` |
|
|
2049
|
+
| `locale` | `string` | Active language; `ru` (default) and `en` are available out of the box |
|
|
2050
|
+
| `fallback` | `string` | Language a string is taken from when the active one lacks it; `ru` by default |
|
|
2051
|
+
| `messages` | `LocaleMessages` | Dictionaries of extra languages; a same-named built-in dictionary is replaced entirely |
|
|
2052
|
+
| `decimalSeparator` | `string` | Decimal separator; derived from the active locale by default |
|
|
2053
|
+
| `rtl` | `Record<string, boolean>` | Map of right-to-left languages (see [RTL](#rtl)) |
|
|
2054
|
+
| `adapter` | `LocaleInstance` | Your own translation engine instead of the built-in one (see [Custom adapter](#custom-adapter)) |
|
|
1713
2055
|
|
|
1714
|
-
|
|
1715
|
-
|
|
2056
|
+
The built-in dictionaries are available to you as well — they live in the
|
|
2057
|
+
`locales` export. Use them as a base for your own language or to fix a couple of
|
|
2058
|
+
strings:
|
|
1716
2059
|
|
|
1717
2060
|
```ts
|
|
1718
2061
|
import { locales } from '@central-design-system/components';
|
|
1719
2062
|
|
|
1720
|
-
locales.ru; //
|
|
1721
|
-
locales.en; //
|
|
2063
|
+
locales.ru; // Russian dictionary
|
|
2064
|
+
locales.en; // English dictionary
|
|
1722
2065
|
```
|
|
1723
2066
|
|
|
1724
|
-
|
|
2067
|
+
For the full set of keys, see [Message keys](#message-keys).
|
|
1725
2068
|
|
|
1726
|
-
##
|
|
2069
|
+
## How components get their text
|
|
1727
2070
|
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
`text`
|
|
1731
|
-
`
|
|
2071
|
+
Component strings are keys prefixed with `$cds.` that the library runs through a
|
|
2072
|
+
translation function. Some of the keys are declared as default prop values, so
|
|
2073
|
+
you can see them in the API: `text` on `CdsFileUpload` is `$cds.fileUpload.browse`,
|
|
2074
|
+
`closeLabel` on `CdsNotification` is `$cds.close`, `noDataText` on `CdsSelect` is
|
|
2075
|
+
`$cds.noDataText`.
|
|
1732
2076
|
|
|
1733
|
-
|
|
2077
|
+
That gives you three ways to change a text.
|
|
1734
2078
|
|
|
1735
|
-
|
|
2079
|
+
**Switch the whole language** — with the `locale` option:
|
|
1736
2080
|
|
|
1737
2081
|
```ts
|
|
1738
2082
|
createCds({ locale: { locale: 'en' } });
|
|
1739
2083
|
```
|
|
1740
2084
|
|
|
1741
|
-
|
|
2085
|
+
**Change wording across the product** — with a dictionary on top of the built-in
|
|
2086
|
+
one:
|
|
1742
2087
|
|
|
1743
2088
|
```ts
|
|
1744
2089
|
import { createCds, locales } from '@central-design-system/components';
|
|
@@ -1746,54 +2091,56 @@ import { createCds, locales } from '@central-design-system/components';
|
|
|
1746
2091
|
createCds({
|
|
1747
2092
|
locale: {
|
|
1748
2093
|
messages: {
|
|
1749
|
-
|
|
2094
|
+
en: { ...locales.en, noDataText: 'Nothing found' }
|
|
1750
2095
|
}
|
|
1751
2096
|
}
|
|
1752
2097
|
});
|
|
1753
2098
|
```
|
|
1754
2099
|
|
|
1755
|
-
|
|
1756
|
-
`...locales.
|
|
1757
|
-
|
|
1758
|
-
|
|
2100
|
+
**Important.** A language dictionary is replaced entirely, not merged key by key.
|
|
2101
|
+
Without the `...locales.en` spread, the English locale is left with a single key
|
|
2102
|
+
and the rest of the strings turn into their own keys (`$cds.close` instead of
|
|
2103
|
+
"Close"). Spread nested sections separately:
|
|
2104
|
+
`table: { ...locales.en.table, emptyText: '…' }`.
|
|
1759
2105
|
|
|
1760
|
-
|
|
2106
|
+
**Change one label in one place** — with a prop:
|
|
1761
2107
|
|
|
1762
2108
|
```vue
|
|
1763
|
-
<CdsSelect :items="items" no-data-text="
|
|
2109
|
+
<CdsSelect :items="items" no-data-text="No matching suppliers" />
|
|
1764
2110
|
```
|
|
1765
2111
|
|
|
1766
|
-
|
|
1767
|
-
|
|
2112
|
+
The same prop can be set as the default for every instance of the component — see
|
|
2113
|
+
global configuration:
|
|
1768
2114
|
|
|
1769
2115
|
```ts
|
|
1770
2116
|
createCds({
|
|
1771
2117
|
defaults: {
|
|
1772
|
-
CdsSelect: { noDataText: '
|
|
2118
|
+
CdsSelect: { noDataText: 'Nothing found' }
|
|
1773
2119
|
}
|
|
1774
2120
|
});
|
|
1775
2121
|
```
|
|
1776
2122
|
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
2123
|
+
The translation function also accepts plain text: a string without the `$cds.`
|
|
2124
|
+
prefix is returned as is, with the parameters substituted. That's how props with
|
|
2125
|
+
a localizable value work the same way with a key and with a ready-made phrase.
|
|
1780
2126
|
|
|
1781
|
-
|
|
1782
|
-
|
|
2127
|
+
If a key is missing from both the active locale and the `fallback`, the component
|
|
2128
|
+
shows the key itself, and in dev mode a
|
|
2129
|
+
`[CDS: useLocale] Translation key … not found` warning appears in the console.
|
|
1783
2130
|
|
|
1784
|
-
##
|
|
2131
|
+
## Switching the language at runtime
|
|
1785
2132
|
|
|
1786
|
-
`createCds`
|
|
1787
|
-
|
|
2133
|
+
`createCds` returns an instance whose locale lives in reactive refs — to switch
|
|
2134
|
+
languages, just write to `current`:
|
|
1788
2135
|
|
|
1789
2136
|
```ts
|
|
1790
2137
|
const cds = createCds({ components, directives });
|
|
1791
2138
|
|
|
1792
|
-
//
|
|
2139
|
+
// for example, following the user's choice in profile settings
|
|
1793
2140
|
cds.locale.current.value = 'en';
|
|
1794
2141
|
```
|
|
1795
2142
|
|
|
1796
|
-
|
|
2143
|
+
Inside components, the `useLocale` composable does the same:
|
|
1797
2144
|
|
|
1798
2145
|
```vue
|
|
1799
2146
|
<script setup lang="ts">
|
|
@@ -1810,13 +2157,15 @@ const { current } = useLocale();
|
|
|
1810
2157
|
</template>
|
|
1811
2158
|
```
|
|
1812
2159
|
|
|
1813
|
-
|
|
2160
|
+
Every mounted component recalculates its strings on its own — no page reload
|
|
2161
|
+
needed.
|
|
1814
2162
|
|
|
1815
|
-
##
|
|
2163
|
+
## A locale for part of the application
|
|
1816
2164
|
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
2165
|
+
A single subtree can get its own language — for example, an English-language
|
|
2166
|
+
widget inside a Russian interface. Call `provideLocale` in a wrapper component:
|
|
2167
|
+
it takes the locale from the context, applies the props you passed and provides
|
|
2168
|
+
the result to the children.
|
|
1820
2169
|
|
|
1821
2170
|
```vue
|
|
1822
2171
|
<script setup lang="ts">
|
|
@@ -1842,13 +2191,13 @@ provideLocale(props);
|
|
|
1842
2191
|
</template>
|
|
1843
2192
|
```
|
|
1844
2193
|
|
|
1845
|
-
|
|
1846
|
-
|
|
2194
|
+
Props you don't pass are inherited from the parent locale, so a wrapper with just
|
|
2195
|
+
a `locale` loses neither the `fallback` nor the dictionaries.
|
|
1847
2196
|
|
|
1848
2197
|
## useLocale
|
|
1849
2198
|
|
|
1850
|
-
|
|
1851
|
-
|
|
2199
|
+
The composable hands you the current locale and its functions — use it in your
|
|
2200
|
+
own components so their texts live in the same dictionaries as the CDS ones.
|
|
1852
2201
|
|
|
1853
2202
|
```vue
|
|
1854
2203
|
<script setup lang="ts">
|
|
@@ -1863,44 +2212,47 @@ const { t, n } = useLocale();
|
|
|
1863
2212
|
</template>
|
|
1864
2213
|
```
|
|
1865
2214
|
|
|
1866
|
-
|
|
|
2215
|
+
| Property | Type | Purpose |
|
|
1867
2216
|
| ------------------ | ---------------------------------------------- | ------------------------------------------------------------- |
|
|
1868
|
-
| `t` | `(key: string, ...params: unknown[]) => string` |
|
|
1869
|
-
| `n` | `(value: number) => string` |
|
|
1870
|
-
| `current` | `Ref<string>` |
|
|
1871
|
-
| `fallback` | `Ref<string>` |
|
|
1872
|
-
| `messages` | `Ref<LocaleMessages>` |
|
|
1873
|
-
| `decimalSeparator` | `ShallowRef<string>` |
|
|
2217
|
+
| `t` | `(key: string, ...params: unknown[]) => string` | Translation of a `$cds.…` key with parameter substitution |
|
|
2218
|
+
| `n` | `(value: number) => string` | Number formatting for the active locale |
|
|
2219
|
+
| `current` | `Ref<string>` | Active language; writing to it switches the language |
|
|
2220
|
+
| `fallback` | `Ref<string>` | Fallback language |
|
|
2221
|
+
| `messages` | `Ref<LocaleMessages>` | Dictionaries; can be extended at runtime |
|
|
2222
|
+
| `decimalSeparator` | `ShallowRef<string>` | Decimal separator of the active locale |
|
|
1874
2223
|
|
|
1875
|
-
|
|
2224
|
+
Parameters in strings are numbered — `{0}`, `{1}`:
|
|
1876
2225
|
|
|
1877
2226
|
```ts
|
|
1878
2227
|
const { t } = useLocale();
|
|
1879
2228
|
|
|
1880
|
-
t('$cds.carousel.delimiter', 3, 8); //
|
|
1881
|
-
t('
|
|
2229
|
+
t('$cds.carousel.delimiter', 3, 8); // "Slide 3 of 8"
|
|
2230
|
+
t('Days left: {0}', 5); // "Days left: 5"
|
|
1882
2231
|
```
|
|
1883
2232
|
|
|
1884
|
-
`n`
|
|
1885
|
-
|
|
1886
|
-
(`,`
|
|
2233
|
+
Under the hood `n` is `Intl.NumberFormat` with the active locale and the
|
|
2234
|
+
`fallback`, so group and decimal separators come from the browser. The library
|
|
2235
|
+
derives `decimalSeparator` from the same locale (`,` for `ru`, `.` for `en`); if
|
|
2236
|
+
your product uses a different one, set it explicitly in `createCds`.
|
|
1887
2237
|
|
|
1888
|
-
##
|
|
2238
|
+
## Dates
|
|
1889
2239
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
2240
|
+
Month and weekday names live in separate date locales, shipped by `ru` and `en`.
|
|
2241
|
+
Date and time components pick the date locale by the active language, so after
|
|
2242
|
+
`current.value = 'en'` the calendar switches by itself.
|
|
1893
2243
|
|
|
1894
|
-
|
|
1895
|
-
|
|
2244
|
+
A single component gets its language from the `locale` prop — `CdsDatePicker`,
|
|
2245
|
+
`CdsDateInput` and `CdsTimePicker` all have it:
|
|
1896
2246
|
|
|
1897
2247
|
```vue
|
|
1898
2248
|
<CdsDatePicker v-model="value" locale="en" :first-day-of-week="0" header />
|
|
1899
2249
|
```
|
|
1900
2250
|
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
2251
|
+
The prop accepts not only a language name but also your own date locale object
|
|
2252
|
+
(type `TDateLocale`) — that's how you plug in a language the library doesn't
|
|
2253
|
+
have. The built-in date locales, for reference and reuse, live in the same
|
|
2254
|
+
`locales` export: `locales.ruDate`, `locales.enDate` and the `locales.dateLocales`
|
|
2255
|
+
map.
|
|
1904
2256
|
|
|
1905
2257
|
```ts
|
|
1906
2258
|
const de = {
|
|
@@ -1921,18 +2273,20 @@ const de = {
|
|
|
1921
2273
|
<CdsDatePicker v-model="value" :locale="de" />
|
|
1922
2274
|
```
|
|
1923
2275
|
|
|
1924
|
-
##
|
|
2276
|
+
## Table
|
|
1925
2277
|
|
|
1926
|
-
`CdsTable`
|
|
1927
|
-
|
|
2278
|
+
`CdsTable` builds its labels from the `$cds.table.*` keys, but it also accepts a
|
|
2279
|
+
pinpoint override through the `locale` prop — which replaces only the strings you
|
|
2280
|
+
pass:
|
|
1928
2281
|
|
|
1929
2282
|
```vue
|
|
1930
|
-
<CdsTable :columns="columns" :data="data" :locale="{ emptyText: '
|
|
2283
|
+
<CdsTable :columns="columns" :data="data" :locale="{ emptyText: 'No requests yet' }" />
|
|
1931
2284
|
```
|
|
1932
2285
|
|
|
1933
2286
|
## RTL
|
|
1934
2287
|
|
|
1935
|
-
|
|
2288
|
+
Right-to-left languages are described by the `rtl` map: the key is the language,
|
|
2289
|
+
the value is the direction.
|
|
1936
2290
|
|
|
1937
2291
|
```ts
|
|
1938
2292
|
createCds({
|
|
@@ -1944,13 +2298,15 @@ createCds({
|
|
|
1944
2298
|
});
|
|
1945
2299
|
```
|
|
1946
2300
|
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
`
|
|
1950
|
-
(`margin-inline`, `inset-inline`)
|
|
1951
|
-
|
|
2301
|
+
Components read the direction through `useRtl` and flip whatever depends on the
|
|
2302
|
+
axis: the side menus and tooltips open to, the pagination arrows, the cell order
|
|
2303
|
+
in `CdsOtpInput`, the fill of `CdsProgressBar`. Spacing and borders in the styles
|
|
2304
|
+
are mostly written with logical properties (`margin-inline`, `inset-inline`) and
|
|
2305
|
+
are mirrored by the browser itself — but the design system does not claim full
|
|
2306
|
+
RTL support yet, and some places will need polishing on your side.
|
|
1952
2307
|
|
|
1953
|
-
|
|
2308
|
+
The library does not set the direction attribute for you — put it on the
|
|
2309
|
+
application root yourself:
|
|
1954
2310
|
|
|
1955
2311
|
```vue
|
|
1956
2312
|
<script setup lang="ts">
|
|
@@ -1966,15 +2322,16 @@ const { isRtl } = useRtl();
|
|
|
1966
2322
|
</template>
|
|
1967
2323
|
```
|
|
1968
2324
|
|
|
1969
|
-
`useRtl`
|
|
1970
|
-
|
|
2325
|
+
`useRtl` gives you `isRtl` and `rtlClasses` — a ready `cds-locale--is-rtl` /
|
|
2326
|
+
`cds-locale--is-ltr` class for your own styles.
|
|
1971
2327
|
|
|
1972
|
-
##
|
|
2328
|
+
## Custom adapter
|
|
1973
2329
|
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
2330
|
+
If your application already has an i18n library, hand the translations over to
|
|
2331
|
+
it: the `adapter` option accepts any object implementing the `LocaleInstance`
|
|
2332
|
+
interface. In that case `messages`, `locale` and `fallback` from `createCds` are
|
|
2333
|
+
unused — your engine becomes the source of truth, and the CDS strings live in the
|
|
2334
|
+
application's shared dictionaries under the `$cds` key.
|
|
1978
2335
|
|
|
1979
2336
|
```ts
|
|
1980
2337
|
import type { LocaleInstance, LocaleOptions } from '@central-design-system/components';
|
|
@@ -2002,11 +2359,11 @@ import { createI18n } from 'vue-i18n';
|
|
|
2002
2359
|
|
|
2003
2360
|
const i18n = createI18n({
|
|
2004
2361
|
legacy: false,
|
|
2005
|
-
locale: '
|
|
2362
|
+
locale: 'en',
|
|
2006
2363
|
messages: {
|
|
2007
|
-
|
|
2008
|
-
$cds: { noDataText: '
|
|
2009
|
-
profile: { title: '
|
|
2364
|
+
en: {
|
|
2365
|
+
$cds: { noDataText: 'No data available' },
|
|
2366
|
+
profile: { title: 'Profile' }
|
|
2010
2367
|
}
|
|
2011
2368
|
}
|
|
2012
2369
|
});
|
|
@@ -2020,85 +2377,390 @@ const cds = createCds({
|
|
|
2020
2377
|
});
|
|
2021
2378
|
```
|
|
2022
2379
|
|
|
2023
|
-
|
|
2024
|
-
`fallback`, `messages`, `decimalSeparator`, `t`, `n`
|
|
2025
|
-
|
|
2026
|
-
|
|
2380
|
+
Required members of `LocaleInstance`: `name` (that's how the adapter is
|
|
2381
|
+
recognized), `current`, `fallback`, `messages`, `decimalSeparator`, `t`, `n` and
|
|
2382
|
+
`provide` — a factory for a nested locale, used by `provideLocale`. If you don't
|
|
2383
|
+
need "a locale in a subtree", `provide` can return the same instance, as in the
|
|
2384
|
+
example above.
|
|
2027
2385
|
|
|
2028
|
-
##
|
|
2386
|
+
## Message keys
|
|
2029
2387
|
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
`locales.
|
|
2388
|
+
The built-in English dictionary is a template for translating into a new
|
|
2389
|
+
language. Copy it, translate the values and pass it to `messages` under your
|
|
2390
|
+
language's key; the Russian version is available as `locales.ru`.
|
|
2033
2391
|
|
|
2034
2392
|
```ts
|
|
2035
2393
|
export default {
|
|
2036
|
-
badge: '
|
|
2037
|
-
noDataText: '
|
|
2038
|
-
selectAll: '
|
|
2039
|
-
close: '
|
|
2040
|
-
open: '
|
|
2041
|
-
dismiss: '
|
|
2394
|
+
badge: 'Badge',
|
|
2395
|
+
noDataText: 'No data available',
|
|
2396
|
+
selectAll: 'Select all',
|
|
2397
|
+
close: 'Close',
|
|
2398
|
+
open: 'Open',
|
|
2399
|
+
dismiss: 'Dismiss',
|
|
2042
2400
|
confirmEdit: {
|
|
2043
|
-
ok: '
|
|
2044
|
-
cancel: '
|
|
2401
|
+
ok: 'OK',
|
|
2402
|
+
cancel: 'Cancel'
|
|
2045
2403
|
},
|
|
2046
2404
|
carousel: {
|
|
2047
|
-
prev: '
|
|
2048
|
-
next: '
|
|
2049
|
-
delimiter: '
|
|
2405
|
+
prev: 'Previous slide',
|
|
2406
|
+
next: 'Next slide',
|
|
2407
|
+
delimiter: 'Slide {0} of {1}'
|
|
2050
2408
|
},
|
|
2051
2409
|
input: {
|
|
2052
|
-
clear: '
|
|
2053
|
-
otp: '
|
|
2054
|
-
prependAction: '{0}
|
|
2055
|
-
appendAction: '{0}
|
|
2410
|
+
clear: 'Clear {0}',
|
|
2411
|
+
otp: 'Please enter OTP character',
|
|
2412
|
+
prependAction: '{0} prepended action',
|
|
2413
|
+
appendAction: '{0} appended action'
|
|
2056
2414
|
},
|
|
2057
2415
|
fileInput: {
|
|
2058
|
-
counter: '
|
|
2059
|
-
counterSize: '
|
|
2416
|
+
counter: '{0} files',
|
|
2417
|
+
counterSize: '{0} files ({1} in total)'
|
|
2060
2418
|
},
|
|
2061
2419
|
fileUpload: {
|
|
2062
|
-
title: '
|
|
2063
|
-
divider: '
|
|
2064
|
-
browse: '
|
|
2420
|
+
title: 'Drag and drop files here',
|
|
2421
|
+
divider: 'or',
|
|
2422
|
+
browse: 'Browse files'
|
|
2065
2423
|
},
|
|
2066
2424
|
steps: {
|
|
2067
|
-
prev: '
|
|
2068
|
-
next: '
|
|
2425
|
+
prev: 'Back',
|
|
2426
|
+
next: 'Next'
|
|
2069
2427
|
},
|
|
2070
2428
|
table: {
|
|
2071
|
-
filterTitle: '
|
|
2072
|
-
filterConfirm: '
|
|
2073
|
-
filterReset: '
|
|
2074
|
-
filterEmptyText: '
|
|
2075
|
-
filterCheckAll: '
|
|
2076
|
-
filterSearchPlaceholder: '
|
|
2077
|
-
emptyText: '
|
|
2078
|
-
selectAll: '
|
|
2079
|
-
selectInvert: '
|
|
2080
|
-
selectNone: '
|
|
2081
|
-
selectionAll: '
|
|
2082
|
-
sortTitle: '
|
|
2083
|
-
expand: '
|
|
2084
|
-
collapse: '
|
|
2085
|
-
triggerDesc: '
|
|
2086
|
-
triggerAsc: '
|
|
2087
|
-
cancelSort: '
|
|
2088
|
-
showed: '
|
|
2089
|
-
from: '
|
|
2090
|
-
rowOnPage: '
|
|
2429
|
+
filterTitle: 'Filter menu',
|
|
2430
|
+
filterConfirm: 'OK',
|
|
2431
|
+
filterReset: 'Reset',
|
|
2432
|
+
filterEmptyText: 'No filters',
|
|
2433
|
+
filterCheckAll: 'Select all items',
|
|
2434
|
+
filterSearchPlaceholder: 'Search in filters',
|
|
2435
|
+
emptyText: 'No data',
|
|
2436
|
+
selectAll: 'Select current page',
|
|
2437
|
+
selectInvert: 'Invert current page',
|
|
2438
|
+
selectNone: 'Clear all data',
|
|
2439
|
+
selectionAll: 'Select all data',
|
|
2440
|
+
sortTitle: 'Sort',
|
|
2441
|
+
expand: 'Expand row',
|
|
2442
|
+
collapse: 'Collapse row',
|
|
2443
|
+
triggerDesc: 'Click to sort descending',
|
|
2444
|
+
triggerAsc: 'Click to sort ascending',
|
|
2445
|
+
cancelSort: 'Click to cancel sorting',
|
|
2446
|
+
showed: 'Showed',
|
|
2447
|
+
from: 'from',
|
|
2448
|
+
rowOnPage: 'Row on page'
|
|
2091
2449
|
},
|
|
2092
2450
|
uploader: {
|
|
2093
|
-
uploading: '
|
|
2094
|
-
uploadFile: '
|
|
2095
|
-
downloadFile: '
|
|
2096
|
-
removeFile: '
|
|
2097
|
-
uploadError: '
|
|
2098
|
-
previewFile: '
|
|
2451
|
+
uploading: 'Uploading...',
|
|
2452
|
+
uploadFile: 'Upload file',
|
|
2453
|
+
downloadFile: 'Download file',
|
|
2454
|
+
removeFile: 'Remove file',
|
|
2455
|
+
uploadError: 'Upload error',
|
|
2456
|
+
previewFile: 'Preview file'
|
|
2099
2457
|
}
|
|
2100
2458
|
};
|
|
2101
2459
|
```
|
|
2102
2460
|
|
|
2103
|
-
|
|
2104
|
-
|
|
2461
|
+
The dictionary may stay incomplete: missing keys are taken from the `fallback` —
|
|
2462
|
+
that is, from Russian by default.
|
|
2463
|
+
|
|
2464
|
+
---
|
|
2465
|
+
|
|
2466
|
+
---
|
|
2467
|
+
sourceHash: 16f5caa5227fd7ac98a4d370070985a7094a8a2b
|
|
2468
|
+
---
|
|
2469
|
+
|
|
2470
|
+
# Date Utils
|
|
2471
|
+
|
|
2472
|
+
Central Design System includes a set of functions for working with the native JS
|
|
2473
|
+
`Date`: mask-based formatting, string parsing, arithmetic, comparison and
|
|
2474
|
+
calendar math. You don't need a separate date library (dayjs, date-fns) for
|
|
2475
|
+
everyday tasks. The date and time components use the very same functions —
|
|
2476
|
+
CdsDateInput, CdsDatePicker,
|
|
2477
|
+
CdsTimePicker — so format masks are identical in
|
|
2478
|
+
the utilities and in the components.
|
|
2479
|
+
|
|
2480
|
+
The functions accept a `Date`, a timestamp (milliseconds) or a date string,
|
|
2481
|
+
return a native `Date` and **never mutate** the arguments you pass — the result
|
|
2482
|
+
is always a new object.
|
|
2483
|
+
|
|
2484
|
+
## Setup
|
|
2485
|
+
|
|
2486
|
+
The utilities are exported from the package under the `utils` namespace:
|
|
2487
|
+
|
|
2488
|
+
```ts
|
|
2489
|
+
import { utils } from '@central-design-system/components';
|
|
2490
|
+
|
|
2491
|
+
const { formatDate, addToDate } = utils;
|
|
2492
|
+
|
|
2493
|
+
formatDate(new Date(2026, 7, 18), 'DD.MM.YYYY'); // '18.08.2026'
|
|
2494
|
+
```
|
|
2495
|
+
|
|
2496
|
+
## Formatting — `formatDate`
|
|
2497
|
+
|
|
2498
|
+
`formatDate(value, mask, dateLocale?)` turns a date into a string using a mask:
|
|
2499
|
+
|
|
2500
|
+
```ts
|
|
2501
|
+
const { formatDate } = utils;
|
|
2502
|
+
|
|
2503
|
+
formatDate(new Date(2026, 7, 18, 14, 30), 'DD.MM.YYYY HH:mm'); // '18.08.2026 14:30'
|
|
2504
|
+
formatDate(Date.now(), 'D MMM YYYY'); // '18 Авг 2026'
|
|
2505
|
+
formatDate(new Date(2026, 7, 18), 'dddd'); // 'Вторник'
|
|
2506
|
+
```
|
|
2507
|
+
|
|
2508
|
+
Without a mask, an ISO-like format is used: `YYYY-MM-DDTHH:mm:ss.SSSZ`.
|
|
2509
|
+
For an invalid value the function returns `undefined`.
|
|
2510
|
+
|
|
2511
|
+
Month and weekday names come from the Russian date locale by default. To print
|
|
2512
|
+
them in another language, pass a date locale as the third argument — the
|
|
2513
|
+
built-in ones live in the `locales` export:
|
|
2514
|
+
|
|
2515
|
+
```ts
|
|
2516
|
+
import { locales, utils } from '@central-design-system/components';
|
|
2517
|
+
|
|
2518
|
+
utils.formatDate(new Date(2026, 7, 18), 'dddd, D MMMM', locales.enDate);
|
|
2519
|
+
// 'Tuesday, 18 August'
|
|
2520
|
+
```
|
|
2521
|
+
|
|
2522
|
+
Your own language is plugged in as a `TDateLocale` object — the same fields as
|
|
2523
|
+
`locales.ruDate`. See the Internationalization
|
|
2524
|
+
guide for more on date locales.
|
|
2525
|
+
|
|
2526
|
+
### Format tokens
|
|
2527
|
+
|
|
2528
|
+
| Unit | Token | Result |
|
|
2529
|
+
| --- | --- | --- |
|
|
2530
|
+
| Year | `YY` / `YYYY` | `26` / `2026` |
|
|
2531
|
+
| Month | `M` / `MM` | `8` / `08` |
|
|
2532
|
+
| Month (name) | `MMM` / `MMMM` | `Авг` / `Август` |
|
|
2533
|
+
| Quarter | `Q` / `Qo` | `3` / `3rd` |
|
|
2534
|
+
| Day of month | `D` / `Do` / `DD` | `18` / `18th` / `18` |
|
|
2535
|
+
| Day of year | `DDD` / `DDDD` | `230` / `230` (zero-padded to 3 digits) |
|
|
2536
|
+
| Day of week | `d` | `2` (0 — Sunday) |
|
|
2537
|
+
| Day of week (name) | `dd` / `ddd` / `dddd` | `Вт` / `Вт` / `Вторник` |
|
|
2538
|
+
| Day of week (ISO) | `E` | `2` (1 — Monday, 7 — Sunday) |
|
|
2539
|
+
| Week of year | `w` / `ww` | `34` / `34` |
|
|
2540
|
+
| Hour (0–23) | `H` / `HH` | `14` / `14` |
|
|
2541
|
+
| Hour (1–12) | `h` / `hh` | `2` / `02` |
|
|
2542
|
+
| Minute | `m` / `mm` | `30` / `30` |
|
|
2543
|
+
| Second | `s` / `ss` | `5` / `05` |
|
|
2544
|
+
| Fractions of a second | `S` / `SS` / `SSS` | `1` / `12` / `123` |
|
|
2545
|
+
| Time zone | `Z` / `ZZ` | `+03:00` / `+0300` |
|
|
2546
|
+
| Meridiem | `A` / `a` / `aa` | `PM` / `pm` / `p.m.` |
|
|
2547
|
+
| Unix time | `X` / `x` | seconds / milliseconds |
|
|
2548
|
+
|
|
2549
|
+
Ordinal suffixes (`Do`, `Qo`) are English (`1st`, `2nd`…) regardless of the
|
|
2550
|
+
locale.
|
|
2551
|
+
|
|
2552
|
+
Arbitrary text inside a mask is escaped with square brackets:
|
|
2553
|
+
|
|
2554
|
+
```ts
|
|
2555
|
+
formatDate(new Date(2026, 7, 18), '[Сегодня] DD.MM'); // 'Сегодня 18.08'
|
|
2556
|
+
```
|
|
2557
|
+
|
|
2558
|
+
## Parsing — `extractDate` and `splitDate`
|
|
2559
|
+
|
|
2560
|
+
`extractDate(str, mask, dateLocale?)` parses a string with a mask and returns a
|
|
2561
|
+
`Date`:
|
|
2562
|
+
|
|
2563
|
+
```ts
|
|
2564
|
+
const { extractDate } = utils;
|
|
2565
|
+
|
|
2566
|
+
extractDate('21.03.1985', 'DD.MM.YYYY'); // Date: 21 March 1985
|
|
2567
|
+
extractDate('2019-10-29 23:12', 'YYYY-MM-DD HH:mm'); // Date: 29 October 2019, 23:12
|
|
2568
|
+
```
|
|
2569
|
+
|
|
2570
|
+
Month and day names inside the string are recognized through the date locale —
|
|
2571
|
+
Russian by default, just like in `formatDate`.
|
|
2572
|
+
|
|
2573
|
+
A non-existent day overflows following the rules of the native `Date`:
|
|
2574
|
+
`extractDate('30.02.2024', 'DD.MM.YYYY')` gives 1 March 2024. When you need
|
|
2575
|
+
strict input validation, format the result back and compare it with the string:
|
|
2576
|
+
|
|
2577
|
+
```ts
|
|
2578
|
+
const strict = (str: string, mask: string) => formatDate(extractDate(str, mask), mask) === str;
|
|
2579
|
+
|
|
2580
|
+
strict('18.08.2026', 'DD.MM.YYYY'); // true
|
|
2581
|
+
strict('30.02.2024', 'DD.MM.YYYY'); // false — overflowed into 01.03.2024
|
|
2582
|
+
```
|
|
2583
|
+
|
|
2584
|
+
If you don't need a `Date`, `splitDate(str, mask, dateLocale?)` splits the string
|
|
2585
|
+
into its parts — an `IRawDate` object with the fields `year`, `month`, `day`,
|
|
2586
|
+
`hour`, `minute`, `second`, `millisecond` (anything not found is `null`):
|
|
2587
|
+
|
|
2588
|
+
```ts
|
|
2589
|
+
const { splitDate } = utils;
|
|
2590
|
+
|
|
2591
|
+
splitDate('18.08.2026', 'DD.MM.YYYY');
|
|
2592
|
+
// { year: 2026, month: 8, day: 18, hour: null, … }
|
|
2593
|
+
```
|
|
2594
|
+
|
|
2595
|
+
## Creating and changing
|
|
2596
|
+
|
|
2597
|
+
### `buildDate`
|
|
2598
|
+
|
|
2599
|
+
`buildDate(modified, utc?)` — the current moment with individual parts replaced.
|
|
2600
|
+
Handy when you need "now, but at 15:00" or "today, but in 2010":
|
|
2601
|
+
|
|
2602
|
+
```ts
|
|
2603
|
+
const { buildDate } = utils;
|
|
2604
|
+
|
|
2605
|
+
buildDate({ year: 2010, day: 5, hour: 15 });
|
|
2606
|
+
// current month, minutes and seconds; year 2010, day 5, hour 15
|
|
2607
|
+
```
|
|
2608
|
+
|
|
2609
|
+
Supported object fields: `year`, `month` (1–12), `day` (or `date`), `hour`,
|
|
2610
|
+
`minute`, `second`, `millisecond`.
|
|
2611
|
+
|
|
2612
|
+
### `adjustDate`
|
|
2613
|
+
|
|
2614
|
+
`adjustDate(date, modified, utc?)` — the same thing, but for an arbitrary date:
|
|
2615
|
+
|
|
2616
|
+
```ts
|
|
2617
|
+
const { adjustDate } = utils;
|
|
2618
|
+
|
|
2619
|
+
adjustDate(new Date(2026, 10, 2), { year: 2010, month: 2 });
|
|
2620
|
+
// Date: 2 February 2010
|
|
2621
|
+
```
|
|
2622
|
+
|
|
2623
|
+
Note that `month` here is 1-based (February is `2`), unlike in the `Date`
|
|
2624
|
+
constructor.
|
|
2625
|
+
|
|
2626
|
+
### `addToDate` / `subtractFromDate`
|
|
2627
|
+
|
|
2628
|
+
Add and subtract intervals. The object fields are the same, but they mean "how
|
|
2629
|
+
much to add" rather than "what to set":
|
|
2630
|
+
|
|
2631
|
+
```ts
|
|
2632
|
+
const { addToDate, subtractFromDate } = utils;
|
|
2633
|
+
|
|
2634
|
+
addToDate(new Date(2026, 2, 7), { day: 7, month: 1 }); // Date: 14 April 2026
|
|
2635
|
+
subtractFromDate(new Date(2026, 2, 7), { hour: 24 }); // Date: 6 March 2026
|
|
2636
|
+
```
|
|
2637
|
+
|
|
2638
|
+
### `startOfDate` / `endOfDate`
|
|
2639
|
+
|
|
2640
|
+
The start and the end of a period — year, month, day, hour, minute or second:
|
|
2641
|
+
|
|
2642
|
+
```ts
|
|
2643
|
+
const { startOfDate, endOfDate } = utils;
|
|
2644
|
+
|
|
2645
|
+
startOfDate(new Date(2026, 7, 18, 14, 30), 'year'); // Date: 1 January 2026, 00:00:00.000
|
|
2646
|
+
endOfDate(new Date(2026, 7, 18, 14, 30), 'month'); // Date: 31 August 2026, 23:59:59.999
|
|
2647
|
+
```
|
|
2648
|
+
|
|
2649
|
+
Period unit: `'year'`, `'month'`, `'day'`, `'hour'`, `'minute'`, `'second'`
|
|
2650
|
+
(the plural form is accepted too).
|
|
2651
|
+
|
|
2652
|
+
## Comparison and ranges
|
|
2653
|
+
|
|
2654
|
+
### `isSameDate`
|
|
2655
|
+
|
|
2656
|
+
Compares dates down to a unit: `'year'` — the year only, `'month'` — month and
|
|
2657
|
+
year, `'day'` — the calendar day, and so on. Without a unit, the timestamps are
|
|
2658
|
+
compared in full.
|
|
2659
|
+
|
|
2660
|
+
```ts
|
|
2661
|
+
const { isSameDate } = utils;
|
|
2662
|
+
|
|
2663
|
+
isSameDate(new Date(2026, 7, 1), new Date(2026, 7, 30), 'month'); // true
|
|
2664
|
+
isSameDate(new Date(2026, 7, 1), new Date(2026, 7, 30), 'day'); // false
|
|
2665
|
+
```
|
|
2666
|
+
|
|
2667
|
+
### `getDateDiff`
|
|
2668
|
+
|
|
2669
|
+
The difference between two dates in the chosen unit (days by default):
|
|
2670
|
+
|
|
2671
|
+
```ts
|
|
2672
|
+
const { getDateDiff } = utils;
|
|
2673
|
+
|
|
2674
|
+
getDateDiff(new Date(2026, 4, 12), new Date(2026, 3, 8)); // 34 (days)
|
|
2675
|
+
getDateDiff(new Date(2026, 4, 12), new Date(2026, 3, 8), 'months'); // 1
|
|
2676
|
+
```
|
|
2677
|
+
|
|
2678
|
+
### `isBetweenDates` / `getDateBetween`
|
|
2679
|
+
|
|
2680
|
+
`isBetweenDates(date, from, to, opts?)` checks whether a date falls inside a
|
|
2681
|
+
range. The bounds are excluded by default; the `inclusiveFrom` and `inclusiveTo`
|
|
2682
|
+
options include them, and `onlyDate: true` compares calendar days only, ignoring
|
|
2683
|
+
the time:
|
|
2684
|
+
|
|
2685
|
+
```ts
|
|
2686
|
+
const { isBetweenDates } = utils;
|
|
2687
|
+
|
|
2688
|
+
isBetweenDates(date, from, to); // strict range
|
|
2689
|
+
isBetweenDates(date, from, to, { inclusiveFrom: true, inclusiveTo: true, onlyDate: true });
|
|
2690
|
+
```
|
|
2691
|
+
|
|
2692
|
+
`getDateBetween(date, min, max)` clamps a date to a range: it returns the date
|
|
2693
|
+
itself if it is inside, otherwise the nearest bound:
|
|
2694
|
+
|
|
2695
|
+
```ts
|
|
2696
|
+
const { getDateBetween } = utils;
|
|
2697
|
+
|
|
2698
|
+
getDateBetween(new Date(2025, 0, 1), new Date(2026, 0, 1), new Date(2026, 11, 31));
|
|
2699
|
+
// Date: 1 January 2026 — the date is below the minimum, so the min bound came back
|
|
2700
|
+
```
|
|
2701
|
+
|
|
2702
|
+
### `getMinDate` / `getMaxDate`
|
|
2703
|
+
|
|
2704
|
+
The smallest and the largest of a set of dates. They return a timestamp (number) —
|
|
2705
|
+
wrap it in `new Date()` if you need a date object:
|
|
2706
|
+
|
|
2707
|
+
```ts
|
|
2708
|
+
const { getMinDate, getMaxDate } = utils;
|
|
2709
|
+
|
|
2710
|
+
const min = getMinDate(new Date(2026, 6, 24), new Date(2026, 5, 20), new Date(2026, 6, 26));
|
|
2711
|
+
new Date(min); // Date: 20 June 2026
|
|
2712
|
+
|
|
2713
|
+
const dates = [/* Date[] */];
|
|
2714
|
+
const max = getMaxDate(dates[0], ...dates.slice(1));
|
|
2715
|
+
```
|
|
2716
|
+
|
|
2717
|
+
## Calendar
|
|
2718
|
+
|
|
2719
|
+
```ts
|
|
2720
|
+
const { getDayOfWeek, getWeekOfYear, getDayOfYear, daysInMonth } = utils;
|
|
2721
|
+
|
|
2722
|
+
getDayOfWeek(new Date(2026, 7, 16)); // 7 — Sunday (ISO: 1 — Monday)
|
|
2723
|
+
getWeekOfYear(new Date(2026, 0, 4)); // 1 — ISO week number in the year
|
|
2724
|
+
getDayOfYear(new Date(2026, 1, 4)); // 35 — ordinal day in the year
|
|
2725
|
+
daysInMonth(new Date(2024, 1, 15)); // 29 — February of a leap year
|
|
2726
|
+
```
|
|
2727
|
+
|
|
2728
|
+
## Other
|
|
2729
|
+
|
|
2730
|
+
### `isValidDate`
|
|
2731
|
+
|
|
2732
|
+
Checks whether a value parses into a date:
|
|
2733
|
+
|
|
2734
|
+
```ts
|
|
2735
|
+
const { isValidDate } = utils;
|
|
2736
|
+
|
|
2737
|
+
isValidDate('2026-08-18'); // true
|
|
2738
|
+
isValidDate('не дата'); // false
|
|
2739
|
+
```
|
|
2740
|
+
|
|
2741
|
+
The check is syntactic — it does not catch non-existent calendar days
|
|
2742
|
+
(see `splitDate` above).
|
|
2743
|
+
|
|
2744
|
+
### `cloneDate`
|
|
2745
|
+
|
|
2746
|
+
A copy of a date. Useful before handing it to third-party code that might mutate
|
|
2747
|
+
the object (CDS utilities themselves never modify their arguments):
|
|
2748
|
+
|
|
2749
|
+
```ts
|
|
2750
|
+
const { cloneDate } = utils;
|
|
2751
|
+
|
|
2752
|
+
const copy = cloneDate(original);
|
|
2753
|
+
```
|
|
2754
|
+
|
|
2755
|
+
### `inferDateFormat`
|
|
2756
|
+
|
|
2757
|
+
Detects the shape of a value — handy for returning the result in the same form
|
|
2758
|
+
the value came in:
|
|
2759
|
+
|
|
2760
|
+
```ts
|
|
2761
|
+
const { inferDateFormat } = utils;
|
|
2762
|
+
|
|
2763
|
+
inferDateFormat(new Date()); // 'date'
|
|
2764
|
+
inferDateFormat(1787059805000); // 'number'
|
|
2765
|
+
inferDateFormat('18.08.2026'); // 'string'
|
|
2766
|
+
```
|