@livestorm/ui-vue 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/components-vite.js +2 -2
- package/dist/UiButton-uyW8EHRJ.mjs +602 -0
- package/dist/UiTimelineItem-EiOEi1yF.mjs +7293 -0
- package/dist/UiTooltip-DZcPD6_N.mjs +158 -0
- package/dist/a11y-CaZxRWzo.mjs +6 -0
- package/dist/breakpoints.mjs +4 -9
- package/dist/bus.mjs +5 -5
- package/dist/components.mjs +236 -231
- package/dist/i18n-B8QOMuFD.mjs +46 -0
- package/dist/index.mjs +4 -91
- package/dist/integrations.mjs +3 -14
- package/dist/layouts.mjs +228 -236
- package/dist/responsive.mjs +31 -36
- package/dist/slot.mjs +11 -17
- package/dist/toastDSV2-D3xDZPe5.mjs +105 -0
- package/dist/types/index.d.ts +19 -1
- package/dist/types/src/components/Toast/ToastMessage.vue.d.ts +17 -7
- package/dist/types/src/components/Toast/toastDSV2.d.ts +89 -64
- package/dist/types/src/components/UiActionBar/types.d.ts +2 -0
- package/dist/types/src/components/UiAvatar/UiAvatar.vue.d.ts +4 -2
- package/dist/types/src/components/UiAvatarList/UiAvatarList.vue.d.ts +3 -2
- package/dist/types/src/components/UiBanner/UiBanner.vue.d.ts +13 -1
- package/dist/types/src/components/UiButton/UiButton.vue.d.ts +95 -35
- package/dist/types/src/components/UiButtonGroup/UiButtonGroup.vue.d.ts +8 -2
- package/dist/types/src/components/UiButtonGroup/types.d.ts +4 -0
- package/dist/types/src/components/UiChoice/UiChoice.vue.d.ts +71 -0
- package/dist/types/src/components/UiChoice/index.d.ts +2 -0
- package/dist/types/src/components/UiChoice/types.d.ts +7 -0
- package/dist/types/src/components/UiColorField/UiColorField.vue.d.ts +1 -1
- package/dist/types/src/components/UiColorPicker/UiColorPicker.vue.d.ts +2 -2
- package/dist/types/src/components/UiCombobox/UiCombobox.types.d.ts +47 -0
- package/dist/types/src/components/UiCombobox/UiCombobox.vue.d.ts +40 -0
- package/dist/types/src/components/UiCombobox/index.d.ts +2 -0
- package/dist/types/src/components/UiDataTable/UiDataTable.types.d.ts +46 -0
- package/dist/types/src/components/UiDataTable/UiDataTable.vue.d.ts +136 -0
- package/dist/types/src/components/UiDataTable/index.d.ts +5 -0
- package/dist/types/src/components/UiDrawer/UiDrawer.vue.d.ts +28 -0
- package/dist/types/src/components/UiDrawer/UiDrawerContent.vue.d.ts +18 -0
- package/dist/types/src/components/UiDrawer/UiDrawerTrigger.vue.d.ts +14 -0
- package/dist/types/src/components/UiDropdown/DropdownItemCheckbox.vue.d.ts +3 -0
- package/dist/types/src/components/UiDropdown/UiDropdownContent.vue.d.ts +10 -0
- package/dist/types/src/components/UiDropdown/UiDropdownGroup.vue.d.ts +17 -0
- package/dist/types/src/components/UiDropdown/UiDropdownItem.vue.d.ts +8 -5
- package/dist/types/src/components/UiDropdown/UiDropdownTrigger.vue.d.ts +21 -5
- package/dist/types/src/components/UiDropdown/index.d.ts +1 -0
- package/dist/types/src/components/UiEmojiPickerList/UiEmojiPickerList.vue.d.ts +22 -0
- package/dist/types/src/components/UiEmptyState/UiEmptyState.vue.d.ts +8 -3
- package/dist/types/src/components/UiFieldWrapper/UiFieldWrapper.vue.d.ts +2 -2
- package/dist/types/src/components/UiInputCheckbox/CheckboxGlyph.vue.d.ts +17 -0
- package/dist/types/src/components/UiInputCheckbox/UiInputCheckbox.vue.d.ts +35 -4
- package/dist/types/src/components/UiInputRadio/RadioGlyph.vue.d.ts +19 -0
- package/dist/types/src/components/UiInputRadio/UiInputRadio.vue.d.ts +21 -8
- package/dist/types/src/components/UiInputRadio/UiInputRadioGroup.vue.d.ts +6 -1
- package/dist/types/src/components/UiInputRadio/types.d.ts +1 -1
- package/dist/types/src/components/UiInputSelect/UiInputSelect.vue.d.ts +5 -5
- package/dist/types/src/components/UiInputTextarea/UiInputTextarea.vue.d.ts +5 -5
- package/dist/types/src/components/UiListItem/UiListItem.vue.d.ts +18 -4
- package/dist/types/src/components/UiLoader/UiSpinnerIcon.vue.d.ts +3 -0
- package/dist/types/src/components/UiMenu/UiMenuContent.vue.d.ts +15 -2
- package/dist/types/src/components/UiMenu/UiMenuItem.vue.d.ts +9 -3
- package/dist/types/src/components/UiNestedOptions/UiNestedOptions.vue.d.ts +13 -0
- package/dist/types/src/components/UiPage/UiPage.vue.d.ts +79 -15
- package/dist/types/src/components/UiPagination/UiPagination.vue.d.ts +36 -0
- package/dist/types/src/components/UiPagination/index.d.ts +2 -0
- package/dist/types/src/components/UiPagination/types.d.ts +4 -0
- package/dist/types/src/components/UiPane/UiPane.vue.d.ts +22 -0
- package/dist/types/src/components/UiPane/UiPaneContent.vue.d.ts +75 -0
- package/dist/types/src/components/UiPane/UiPaneTrigger.vue.d.ts +14 -0
- package/dist/types/src/components/UiPane/index.d.ts +5 -0
- package/dist/types/src/components/UiRating/UiRating.vue.d.ts +62 -0
- package/dist/types/src/components/UiRating/types.d.ts +1 -0
- package/dist/types/src/components/UiRoomButton/UiRoomButton.vue.d.ts +5 -3
- package/dist/types/src/components/UiRoomCountdown/UiRoomCountdown.vue.d.ts +32 -0
- package/dist/types/src/components/UiShell/UiShell.vue.d.ts +3 -0
- package/dist/types/src/components/UiSideMenu/UiSideMenu.vue.d.ts +22 -1
- package/dist/types/src/components/UiSideMenu/UiSideMenuItemContent.vue.d.ts +2 -2
- package/dist/types/src/components/UiSwitch/UiSwitch.vue.d.ts +10 -5
- package/dist/types/src/components/UiTable/UiTable.vue.d.ts +13 -4
- package/dist/types/src/components/UiTable/UiTableActionsCell.vue.d.ts +49 -0
- package/dist/types/src/components/UiTable/UiTableActionsHeaderCell.vue.d.ts +3 -0
- package/dist/types/src/components/UiTable/UiTableBody.vue.d.ts +11 -1
- package/dist/types/src/components/UiTable/UiTableCell.vue.d.ts +16 -1
- package/dist/types/src/components/UiTable/UiTableHeaderCell.vue.d.ts +31 -2
- package/dist/types/src/components/UiTable/UiTableRow.vue.d.ts +32 -2
- package/dist/types/src/components/UiTable/context.d.ts +3 -0
- package/dist/types/src/components/UiTable/index.d.ts +4 -0
- package/dist/types/src/components/UiTabs/UiTabs.vue.d.ts +3 -0
- package/dist/types/src/components/UiTag/UiTag.types.d.ts +25 -0
- package/dist/types/src/components/UiTag/UiTag.vue.d.ts +5 -26
- package/dist/types/src/components/UiTag/index.d.ts +2 -1
- package/dist/types/src/components/UiTextField/UiTextField.vue.d.ts +10 -5
- package/dist/types/src/components/UiTooltip/UiTooltipProvider.vue.d.ts +1 -0
- package/dist/types/src/components/UiTooltip/UiTooltipTrigger.vue.d.ts +2 -2
- package/dist/types/src/composables/storedThemingApplies.d.ts +17 -0
- package/dist/types/src/composables/useButtonStyles.d.ts +1 -0
- package/dist/types/src/composables/useChoiceboxSurface.d.ts +11 -0
- package/dist/types/src/composables/useContentMode.d.ts +7 -9
- package/dist/types/src/composables/useControlModes.d.ts +7 -0
- package/dist/types/src/composables/useControlShape.d.ts +24 -0
- package/dist/types/src/composables/useFieldFocusEvents.d.ts +12 -0
- package/dist/types/src/composables/useIconSize.d.ts +2 -0
- package/dist/types/src/composables/usePullGesture.d.ts +42 -0
- package/dist/types/src/composables/useThemeAndModes.d.ts +4 -0
- package/dist/types/src/theming/colorScale.d.ts +165 -0
- package/dist/types/src/theming/legacyColorScale.d.ts +27 -0
- package/dist/types/src/theming/presetColors.d.ts +11 -0
- package/dist/types/src/theming/primitiveTokens.d.ts +2 -0
- package/dist/types/src/utils/effectiveOpacity.d.ts +2 -0
- package/dist/types/src/utils/numbers.d.ts +1 -2
- package/dist/types/src/utils/tokenColor.d.ts +2 -0
- package/dist/ui-vue.css +2 -1
- package/dist/utils.mjs +165 -194
- package/index.d.ts +18 -0
- package/index.js +36 -0
- package/package.json +26 -21
- package/src/components/Toast/LayoutToasts.vue +19 -11
- package/src/components/Toast/ToastMessage.vue +125 -68
- package/src/components/Toast/toastDSV2.ts +238 -67
- package/src/components/UiActionBar/UiActionBar.vue +4 -3
- package/src/components/UiActionBar/UiActionBarItem.vue +9 -6
- package/src/components/UiActionBar/types.ts +13 -0
- package/src/components/UiAvatar/UiAvatar.vue +8 -2
- package/src/components/UiAvatarList/UiAvatarList.vue +51 -20
- package/src/components/UiBadge/UiBadge.vue +1 -1
- package/src/components/UiBanner/UiBanner.vue +71 -21
- package/src/components/UiBreadcrumb/UiBreadcrumb.vue +1 -1
- package/src/components/UiButton/UiButton.vue +92 -25
- package/src/components/UiButtonGroup/UiButtonGroup.vue +21 -17
- package/src/components/UiButtonGroup/UiButtonGroupItem.vue +33 -15
- package/src/components/UiButtonGroup/types.ts +19 -0
- package/src/components/UiCard/UiCard.vue +20 -23
- package/src/components/UiChoice/UiChoice.vue +187 -0
- package/src/components/UiChoice/index.ts +2 -0
- package/src/components/UiChoice/types.ts +11 -0
- package/src/components/UiColorField/UiColorField.vue +2 -2
- package/src/components/UiColorPicker/UiColorPicker.vue +11 -8
- package/src/components/UiCombobox/UiCombobox.types.ts +52 -0
- package/src/components/UiCombobox/UiCombobox.vue +296 -0
- package/src/components/UiCombobox/index.ts +2 -0
- package/src/components/UiDataTable/UiDataTable.types.ts +47 -0
- package/src/components/UiDataTable/UiDataTable.vue +422 -0
- package/src/components/UiDataTable/index.ts +12 -0
- package/src/components/UiDialog/UiDialogContent.vue +22 -7
- package/src/components/UiDrawer/UiDrawer.vue +16 -0
- package/src/components/UiDrawer/UiDrawerContent.vue +42 -0
- package/src/components/UiDrawer/UiDrawerTrigger.vue +17 -0
- package/src/components/UiDropdown/DropdownItemCheckbox.vue +10 -0
- package/src/components/UiDropdown/UiDropdownContent.vue +32 -21
- package/src/components/UiDropdown/UiDropdownGroup.vue +23 -0
- package/src/components/UiDropdown/UiDropdownItem.vue +38 -18
- package/src/components/UiDropdown/UiDropdownSeparator.vue +1 -1
- package/src/components/UiDropdown/UiDropdownTrigger.vue +138 -43
- package/src/components/UiDropdown/index.ts +1 -0
- package/src/components/UiEmojiPickerList/UiEmojiPickerList.vue +122 -0
- package/src/components/UiEmptyState/UiEmptyState.vue +16 -4
- package/src/components/UiFieldWrapper/UiFieldWrapper.vue +9 -3
- package/src/components/UiHorizontalSeparator/UiHorizontalSeparator.vue +2 -2
- package/src/components/UiInputCheckbox/CheckboxGlyph.vue +78 -0
- package/src/components/UiInputCheckbox/UiInputCheckbox.vue +213 -177
- package/src/components/UiInputEmoji/UiInputEmoji.vue +18 -95
- package/src/components/UiInputRadio/RadioGlyph.vue +45 -0
- package/src/components/UiInputRadio/UiInputRadio.vue +177 -169
- package/src/components/UiInputRadio/UiInputRadioGroup.vue +15 -5
- package/src/components/UiInputRadio/types.ts +1 -2
- package/src/components/UiInputSelect/UiInputSelect.vue +9 -7
- package/src/components/UiInputTextarea/UiInputTextarea.vue +20 -35
- package/src/components/UiLabel/UiLabel.vue +1 -1
- package/src/components/UiListItem/UiListItem.vue +55 -9
- package/src/components/UiLoader/UiLoader.vue +4 -20
- package/src/components/UiLoader/UiSpinnerIcon.vue +21 -0
- package/src/components/UiMenu/UiMenuContent.vue +24 -3
- package/src/components/UiMenu/UiMenuGroup.vue +1 -1
- package/src/components/UiMenu/UiMenuItem.vue +14 -3
- package/src/components/UiMenu/UiMenuSubContent.vue +1 -1
- package/src/components/UiMenu/UiMenuSubTrigger.vue +1 -1
- package/src/components/UiNestedOptions/UiNestedOptions.vue +6 -0
- package/src/components/UiPage/UiPage.vue +190 -32
- package/src/components/UiPagination/UiPagination.vue +99 -0
- package/src/components/UiPagination/index.ts +2 -0
- package/src/components/UiPagination/types.ts +28 -0
- package/src/components/UiPane/UiPane.vue +20 -0
- package/src/components/UiPane/UiPaneContent.vue +232 -0
- package/src/components/UiPane/UiPaneTrigger.vue +14 -0
- package/src/components/UiPane/index.ts +12 -0
- package/src/components/UiPopover/UiPopoverContent.vue +21 -1
- package/src/components/UiProgress/UiProgress.vue +2 -2
- package/src/components/UiRating/UiRating.vue +258 -0
- package/src/components/UiRating/types.ts +1 -0
- package/src/components/UiRoomButton/UiRoomButton.vue +10 -41
- package/src/components/UiRoomCountdown/UiRoomCountdown.vue +376 -0
- package/src/components/UiShell/UiShell.vue +9 -3
- package/src/components/UiSideMenu/UiSideMenu.vue +155 -18
- package/src/components/UiSideMenu/UiSideMenuItemContent.vue +20 -16
- package/src/components/UiStepper/UiStepper.vue +3 -16
- package/src/components/UiStepper/UiStepperDescription.vue +1 -13
- package/src/components/UiStepper/UiStepperIndicator.vue +11 -48
- package/src/components/UiStepper/UiStepperItem.vue +1 -8
- package/src/components/UiStepper/UiStepperSeparator.vue +5 -16
- package/src/components/UiStepper/UiStepperTitle.vue +1 -10
- package/src/components/UiSwitch/UiSwitch.vue +44 -28
- package/src/components/UiTable/UiTable.vue +98 -8
- package/src/components/UiTable/UiTableActionsCell.vue +135 -0
- package/src/components/UiTable/UiTableActionsHeaderCell.vue +19 -0
- package/src/components/UiTable/UiTableBody.vue +16 -1
- package/src/components/UiTable/UiTableCell.vue +33 -16
- package/src/components/UiTable/UiTableHeader.vue +6 -5
- package/src/components/UiTable/UiTableHeaderCell.vue +61 -9
- package/src/components/UiTable/UiTableRow.vue +46 -10
- package/src/components/UiTable/context.ts +5 -0
- package/src/components/UiTable/index.ts +4 -0
- package/src/components/UiTabs/UiTabs.vue +56 -61
- package/src/components/UiTag/UiTag.types.ts +28 -0
- package/src/components/UiTag/UiTag.vue +24 -42
- package/src/components/UiTag/index.ts +2 -0
- package/src/components/UiTextField/UiTextField.vue +21 -36
- package/src/components/UiTooltip/UiTooltipContent.vue +1 -1
- package/src/components/UiTooltip/UiTooltipProvider.vue +3 -0
- package/src/components/UiTooltip/UiTooltipTrigger.vue +16 -1
- package/src/composables/storedThemingApplies.ts +19 -0
- package/src/composables/useButtonStyles.ts +9 -13
- package/src/composables/useChoiceboxSurface.ts +36 -0
- package/src/composables/useContentMode.ts +29 -16
- package/src/composables/useControlModes.ts +11 -0
- package/src/composables/useControlShape.ts +34 -0
- package/src/composables/useFieldFocusEvents.ts +30 -0
- package/src/composables/useIconSize.ts +15 -0
- package/src/composables/usePullGesture.ts +142 -0
- package/src/composables/useThemeAndModes.ts +28 -1
- package/src/css/body.css +16 -1
- package/src/css/fonts.css +39 -5
- package/src/global.d.ts +36 -0
- package/src/theming/colorScale.ts +173 -0
- package/src/theming/legacyColorScale.ts +58 -0
- package/src/theming/presetColors.ts +33 -0
- package/src/theming/primitiveTokens.ts +71 -0
- package/src/utils/effectiveOpacity.ts +8 -0
- package/src/utils/i18n.ts +6 -0
- package/src/utils/numbers.ts +1 -1
- package/src/utils/responsive.d.ts +14 -0
- package/src/utils/tokenColor.ts +9 -0
- package/dist/UiTimelineItem.vue_vue_type_style_index_0_lang-LpdvGf5X.mjs +0 -6093
- package/dist/a11y-BhF_nl7L.mjs +0 -159
- package/dist/i18n-Cktw9hIu.mjs +0 -49
- package/dist/toastDSV2-wMh-UMzW.mjs +0 -74
- package/dist/types/src/components/UiAvatar/index.d.ts +0 -1
- package/dist/types/src/components/UiAvatarList/index.d.ts +0 -1
- package/dist/types/src/components/UiBadge/index.d.ts +0 -1
- package/dist/types/src/components/UiBanner/index.d.ts +0 -2
- package/dist/types/src/components/UiButtonGroup/index.d.ts +0 -3
- package/dist/types/src/components/UiCarousel/index.d.ts +0 -2
- package/dist/types/src/components/UiColorField/index.d.ts +0 -2
- package/dist/types/src/components/UiDialog/MarketplaceHeaderExample.vue.d.ts +0 -28
- package/dist/types/src/components/UiDialog/index.d.ts +0 -7
- package/dist/types/src/components/UiFieldWrapper/index.d.ts +0 -1
- package/dist/types/src/components/UiInputCheckbox/index.d.ts +0 -2
- package/dist/types/src/components/UiInputEmoji/index.d.ts +0 -1
- package/dist/types/src/components/UiInputRadio/index.d.ts +0 -3
- package/dist/types/src/components/UiInputSelect/index.d.ts +0 -2
- package/dist/types/src/components/UiInputTextarea/index.d.ts +0 -2
- package/dist/types/src/components/UiMenu/index.d.ts +0 -10
- package/dist/types/src/components/UiProgress/index.d.ts +0 -2
- package/dist/types/src/components/UiSwitch/index.d.ts +0 -2
- package/dist/types/src/components/UiTabs/index.d.ts +0 -2
- package/dist/types/src/components/UiTimeline/index.d.ts +0 -2
- package/dist/types/src/components/UiTooltip/index.d.ts +0 -4
- package/dist/types/src/mixins/DynamicAction.d.ts +0 -30
- package/dist/useThemeAndModes-BzYwSOEv.mjs +0 -108
- package/src/components/UiAvatar/index.js +0 -1
- package/src/components/UiAvatarList/index.js +0 -1
- package/src/components/UiBadge/index.ts +0 -2
- package/src/components/UiBanner/index.ts +0 -2
- package/src/components/UiButtonGroup/index.ts +0 -3
- package/src/components/UiCarousel/index.ts +0 -2
- package/src/components/UiColorField/index.ts +0 -2
- package/src/components/UiDialog/MarketplaceHeaderExample.vue +0 -217
- package/src/components/UiDialog/index.ts +0 -18
- package/src/components/UiFieldWrapper/index.ts +0 -1
- package/src/components/UiInputCheckbox/index.ts +0 -2
- package/src/components/UiInputEmoji/index.ts +0 -1
- package/src/components/UiInputRadio/index.ts +0 -3
- package/src/components/UiInputSelect/index.ts +0 -2
- package/src/components/UiInputTextarea/index.ts +0 -2
- package/src/components/UiMenu/index.ts +0 -10
- package/src/components/UiProgress/index.ts +0 -2
- package/src/components/UiSwitch/index.ts +0 -2
- package/src/components/UiTabs/index.ts +0 -5
- package/src/components/UiTag/index.js +0 -1
- package/src/components/UiTimeline/index.ts +0 -2
- package/src/components/UiTooltip/index.js +0 -4
- package/src/mixins/DynamicAction.js +0 -61
|
@@ -23,35 +23,40 @@ const props = withDefaults(defineProps<UiCardProps>(), {
|
|
|
23
23
|
disabled: false,
|
|
24
24
|
})
|
|
25
25
|
|
|
26
|
-
const baseCardClasses = 'bg-surface-neutral-
|
|
26
|
+
const baseCardClasses = 'bg-surface-neutral-bg-main'
|
|
27
27
|
|
|
28
28
|
const variantClasses = computed(() => {
|
|
29
29
|
if (props.selected) {
|
|
30
|
-
return 'bg-surface-primary-alpha-100
|
|
30
|
+
return 'bg-surface-primary-alpha-100 ring-2 ring-actions-primary-idle'
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
switch (props.variant) {
|
|
34
34
|
case 'success':
|
|
35
|
-
return 'bg-surface-success-alpha-200
|
|
35
|
+
return 'bg-surface-success-alpha-200'
|
|
36
36
|
case 'warning':
|
|
37
|
-
return 'bg-surface-warning-alpha-100
|
|
37
|
+
return 'bg-surface-warning-alpha-100'
|
|
38
38
|
case 'danger':
|
|
39
|
-
return 'bg-surface-danger-alpha-100
|
|
39
|
+
return 'bg-surface-danger-alpha-100'
|
|
40
40
|
case 'primary':
|
|
41
|
-
return 'bg-surface-primary-alpha-100
|
|
41
|
+
return 'bg-surface-primary-alpha-100'
|
|
42
42
|
case 'primary-fill':
|
|
43
|
-
return 'bg-surface-primary-bg-alpha
|
|
43
|
+
return 'bg-surface-primary-bg-alpha'
|
|
44
44
|
case 'transparent':
|
|
45
|
-
return 'bg-transparent
|
|
45
|
+
return 'bg-transparent'
|
|
46
46
|
case 'neutral':
|
|
47
|
-
return 'bg-surface-neutral-alpha-100 border border-borders-neutral-light'
|
|
48
47
|
case 'white':
|
|
49
|
-
return
|
|
48
|
+
return baseCardClasses
|
|
50
49
|
default:
|
|
51
50
|
return baseCardClasses
|
|
52
51
|
}
|
|
53
52
|
})
|
|
54
53
|
|
|
54
|
+
// A selected card is always a choice; a disabled one cannot be acted on.
|
|
55
|
+
const borderClasses = computed(() => {
|
|
56
|
+
const isInteractive = props.selected || (props.interactive && !props.disabled)
|
|
57
|
+
return isInteractive ? 'border border-container-interactive-border' : 'border border-container-border'
|
|
58
|
+
})
|
|
59
|
+
|
|
55
60
|
const paddingClasses = computed(() => {
|
|
56
61
|
// Based on Figma: default padding is 32px (p-8)
|
|
57
62
|
switch (props.padding) {
|
|
@@ -70,11 +75,7 @@ const paddingClasses = computed(() => {
|
|
|
70
75
|
|
|
71
76
|
const interactiveClasses = computed(() => {
|
|
72
77
|
if (!props.interactive || props.disabled) return ''
|
|
73
|
-
|
|
74
|
-
if (props.selected) {
|
|
75
|
-
return 'cursor-pointer transition-all duration-150 hover:shadow-shadows-drop-shadow-lg'
|
|
76
|
-
}
|
|
77
|
-
return 'cursor-pointer transition-all duration-150 hover:ring-1 hover:ring-shadow-neutral-100 hover:shadow-shadows-drop-shadow-lg'
|
|
78
|
+
return 'cursor-pointer transition-all duration-150 hover:bg-surface-neutral-bg-main hover:shadow-container-hover'
|
|
78
79
|
})
|
|
79
80
|
|
|
80
81
|
const disabledClasses = computed(() => {
|
|
@@ -86,23 +87,19 @@ const disabledClasses = computed(() => {
|
|
|
86
87
|
<template>
|
|
87
88
|
<div
|
|
88
89
|
:class="[
|
|
89
|
-
'rounded-
|
|
90
|
+
'rounded-container relative overflow-hidden',
|
|
90
91
|
variantClasses,
|
|
92
|
+
borderClasses,
|
|
93
|
+
'shadow-container',
|
|
91
94
|
paddingClasses,
|
|
92
95
|
interactiveClasses,
|
|
93
96
|
disabledClasses,
|
|
94
97
|
]"
|
|
95
98
|
>
|
|
96
|
-
<!-- Hover overlay for interactive cards -->
|
|
97
|
-
<div
|
|
98
|
-
v-if="interactive && !disabled"
|
|
99
|
-
class="absolute inset-0 bg-actions-neutral-hover-overlay rounded-xl opacity-0 hover:opacity-100 transition-opacity duration-150 pointer-events-none"
|
|
100
|
-
/>
|
|
101
|
-
|
|
102
99
|
<!-- Selected overlay -->
|
|
103
100
|
<div
|
|
104
101
|
v-if="selected"
|
|
105
|
-
class="absolute inset-0 bg-actions-primary-idle-alpha-light rounded-
|
|
102
|
+
class="absolute inset-0 bg-actions-primary-idle-alpha-light rounded-[inherit] pointer-events-none"
|
|
106
103
|
/>
|
|
107
104
|
|
|
108
105
|
<div class="relative z-10 h-full">
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject, provide, ref } from 'vue'
|
|
3
|
+
import UiInputCheckbox from '../UiInputCheckbox/UiInputCheckbox.vue'
|
|
4
|
+
import UiInputRadio from '../UiInputRadio/UiInputRadio.vue'
|
|
5
|
+
import { RADIO_GROUP_KEY } from '../UiInputRadio/types'
|
|
6
|
+
import UiSwitch from '../UiSwitch/UiSwitch.vue'
|
|
7
|
+
import type { RadioValue } from '../UiInputRadio/types'
|
|
8
|
+
import type { ChoiceControl, ChoiceValue, ControlPosition } from './types'
|
|
9
|
+
import { CHOICE_ROW_KEY } from './types'
|
|
10
|
+
import { useChoiceboxSurface } from '../../composables/useChoiceboxSurface'
|
|
11
|
+
|
|
12
|
+
interface UiChoiceProps {
|
|
13
|
+
/**
|
|
14
|
+
* The control rendered in the row
|
|
15
|
+
*/
|
|
16
|
+
control: ChoiceControl
|
|
17
|
+
/**
|
|
18
|
+
* The label text
|
|
19
|
+
*/
|
|
20
|
+
label: string
|
|
21
|
+
/**
|
|
22
|
+
* Supporting text under the label, announced with the control
|
|
23
|
+
*/
|
|
24
|
+
description?: string
|
|
25
|
+
/**
|
|
26
|
+
* Info tooltip next to the label
|
|
27
|
+
*/
|
|
28
|
+
labelInfo?: string
|
|
29
|
+
/**
|
|
30
|
+
* The value this row selects. Required when `control` is `radio`; `null` is a valid value.
|
|
31
|
+
* A radio row goes inside a UiInputRadioGroup, which owns the selection.
|
|
32
|
+
*/
|
|
33
|
+
value?: RadioValue
|
|
34
|
+
/**
|
|
35
|
+
* Switch and checkbox: whether the row is on. A radio reads its group instead.
|
|
36
|
+
*/
|
|
37
|
+
modelValue?: ChoiceValue
|
|
38
|
+
/**
|
|
39
|
+
* Whether the row is disabled
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean
|
|
43
|
+
/**
|
|
44
|
+
* Whether the row uses the small height
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
compact?: boolean
|
|
48
|
+
/**
|
|
49
|
+
* Which side of the text the control sits on
|
|
50
|
+
* @default 'end'
|
|
51
|
+
*/
|
|
52
|
+
controlPosition?: ControlPosition
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const props = withDefaults(defineProps<UiChoiceProps>(), {
|
|
56
|
+
description: undefined,
|
|
57
|
+
labelInfo: undefined,
|
|
58
|
+
value: undefined,
|
|
59
|
+
modelValue: undefined,
|
|
60
|
+
disabled: false,
|
|
61
|
+
compact: false,
|
|
62
|
+
controlPosition: 'end',
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const emit = defineEmits<{
|
|
66
|
+
'update:modelValue': [value: ChoiceValue]
|
|
67
|
+
}>()
|
|
68
|
+
|
|
69
|
+
defineSlots<{
|
|
70
|
+
/** Radio only: extra content under the text, such as a field the option configures */
|
|
71
|
+
content?(): unknown
|
|
72
|
+
/** Radio only: an icon or a logo before the text */
|
|
73
|
+
icon?(): unknown
|
|
74
|
+
}>()
|
|
75
|
+
|
|
76
|
+
const enclosingGroup = inject(RADIO_GROUP_KEY, undefined)
|
|
77
|
+
|
|
78
|
+
if (props.control === 'radio' && props.value === undefined) {
|
|
79
|
+
console.warn(`UiChoice: the radio row "${props.label}" needs a \`value\`: without one it never shows as selected`)
|
|
80
|
+
}
|
|
81
|
+
provide(CHOICE_ROW_KEY, true)
|
|
82
|
+
|
|
83
|
+
// A radio is also disabled by its group, as UiInputRadio decides
|
|
84
|
+
const isDisabled = computed(() => props.disabled || (props.control === 'radio' && (enclosingGroup?.disabled.value ?? false)))
|
|
85
|
+
|
|
86
|
+
const controlRef = ref<HTMLElement | null>(null)
|
|
87
|
+
|
|
88
|
+
const inErroredGroup = computed(() => props.control === 'radio' && (enclosingGroup?.error.value ?? false))
|
|
89
|
+
|
|
90
|
+
const isSelected = computed(() => {
|
|
91
|
+
if (props.control !== 'radio') {
|
|
92
|
+
return props.modelValue === true
|
|
93
|
+
}
|
|
94
|
+
return props.value !== undefined && enclosingGroup?.modelValue.value === props.value
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
// `null` is a valid option value; a missing one falls back to an empty string
|
|
98
|
+
const radioValue = computed(() => props.value === undefined ? '' : props.value)
|
|
99
|
+
|
|
100
|
+
const isSwitch = computed(() => props.control === 'switch')
|
|
101
|
+
|
|
102
|
+
// A switch is a setting, not a choice: on, it keeps the idle surface
|
|
103
|
+
const surfaceClasses = useChoiceboxSurface(() => ({
|
|
104
|
+
control: props.control,
|
|
105
|
+
selected: isSelected.value && !isSwitch.value,
|
|
106
|
+
disabled: isDisabled.value,
|
|
107
|
+
error: inErroredGroup.value,
|
|
108
|
+
}))
|
|
109
|
+
|
|
110
|
+
const rowClasses = computed(() => [
|
|
111
|
+
'group/option flex items-center w-full text-content-text-md-regular',
|
|
112
|
+
props.compact ? 'min-h-field-sm px-3 py-1' : 'p-3',
|
|
113
|
+
surfaceClasses.value,
|
|
114
|
+
isDisabled.value ? 'cursor-not-allowed' : 'cursor-pointer',
|
|
115
|
+
])
|
|
116
|
+
|
|
117
|
+
const controlAtEnd = computed(() => props.controlPosition === 'end')
|
|
118
|
+
|
|
119
|
+
// The control handles clicks inside its own box; the row forwards the rest.
|
|
120
|
+
function onRowClick (event: MouseEvent) {
|
|
121
|
+
if (isDisabled.value || controlRef.value?.contains(event.target as Node)) {
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
controlRef.value
|
|
125
|
+
?.querySelector<HTMLElement>('[role="radio"], [role="switch"], input[type="checkbox"]')
|
|
126
|
+
?.click()
|
|
127
|
+
}
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<template>
|
|
131
|
+
<div
|
|
132
|
+
data-testid="ui-choice"
|
|
133
|
+
:data-state="isSelected ? 'checked' : 'unchecked'"
|
|
134
|
+
:class="rowClasses"
|
|
135
|
+
@click="onRowClick"
|
|
136
|
+
>
|
|
137
|
+
<div
|
|
138
|
+
ref="controlRef"
|
|
139
|
+
:class="controlAtEnd || (control === 'radio' && $slots.content) ? 'w-full' : 'w-fit'"
|
|
140
|
+
>
|
|
141
|
+
<UiInputRadio
|
|
142
|
+
v-if="control === 'radio'"
|
|
143
|
+
:value="radioValue"
|
|
144
|
+
:label="label"
|
|
145
|
+
:description="description"
|
|
146
|
+
:label-info="labelInfo"
|
|
147
|
+
:disabled="disabled"
|
|
148
|
+
:control-position="controlPosition"
|
|
149
|
+
>
|
|
150
|
+
<template
|
|
151
|
+
v-if="$slots.icon"
|
|
152
|
+
#icon
|
|
153
|
+
>
|
|
154
|
+
<slot name="icon" />
|
|
155
|
+
</template>
|
|
156
|
+
<template
|
|
157
|
+
v-if="$slots.content"
|
|
158
|
+
#content
|
|
159
|
+
>
|
|
160
|
+
<slot name="content" />
|
|
161
|
+
</template>
|
|
162
|
+
</UiInputRadio>
|
|
163
|
+
<UiSwitch
|
|
164
|
+
v-else-if="control === 'switch'"
|
|
165
|
+
:model-value="modelValue === true"
|
|
166
|
+
:label="label"
|
|
167
|
+
:description="description"
|
|
168
|
+
:label-info="labelInfo"
|
|
169
|
+
:disabled="disabled"
|
|
170
|
+
:switch-position="controlAtEnd ? 'right' : 'left'"
|
|
171
|
+
:full-width="controlAtEnd"
|
|
172
|
+
@update:model-value="emit('update:modelValue', $event)"
|
|
173
|
+
/>
|
|
174
|
+
<UiInputCheckbox
|
|
175
|
+
v-else
|
|
176
|
+
:model-value="modelValue === true"
|
|
177
|
+
:label="label"
|
|
178
|
+
:description="description"
|
|
179
|
+
:label-info="labelInfo"
|
|
180
|
+
:disabled="disabled"
|
|
181
|
+
:control-position="controlPosition"
|
|
182
|
+
:full-width="controlAtEnd"
|
|
183
|
+
@update:model-value="emit('update:modelValue', $event as boolean)"
|
|
184
|
+
/>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
</template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type ChoiceControl = 'radio' | 'switch' | 'checkbox'
|
|
4
|
+
|
|
5
|
+
export type ChoiceValue = boolean
|
|
6
|
+
|
|
7
|
+
/** Which side of the text a radio, checkbox or switch sits on */
|
|
8
|
+
export type ControlPosition = 'start' | 'end'
|
|
9
|
+
|
|
10
|
+
/** Provided by UiChoice, which draws the option row around the control it wraps */
|
|
11
|
+
export const CHOICE_ROW_KEY: InjectionKey<boolean> = Symbol('ui-choice-row')
|
|
@@ -129,7 +129,7 @@ function onPickerChange(value: string): void {
|
|
|
129
129
|
<span
|
|
130
130
|
data-testid="ui-color-field-swatch"
|
|
131
131
|
aria-hidden="true"
|
|
132
|
-
class="block size-full rounded border border-borders-neutral-light"
|
|
132
|
+
class="block size-full rounded-check border border-borders-neutral-light"
|
|
133
133
|
:style="{ backgroundColor: currentHex }"
|
|
134
134
|
/>
|
|
135
135
|
</template>
|
|
@@ -140,7 +140,7 @@ function onPickerChange(value: string): void {
|
|
|
140
140
|
align="start"
|
|
141
141
|
:side-offset="8"
|
|
142
142
|
data-colors-semantic="light"
|
|
143
|
-
class="border-none shadow-none
|
|
143
|
+
class="border-none shadow-none"
|
|
144
144
|
@open-auto-focus.prevent
|
|
145
145
|
>
|
|
146
146
|
<UiColorPicker
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
import type { Color } from 'reka-ui'
|
|
27
27
|
import { UiDropdown, UiDropdownTrigger, UiDropdownContent, UiDropdownItem } from '../UiDropdown'
|
|
28
28
|
import type { ColorFormat, UiColorPickerPreset, UiColorPickerProps, UiColorPickerSwatchSize } from './types'
|
|
29
|
+
import { useControlShape } from '../../composables/useControlShape'
|
|
29
30
|
|
|
30
31
|
const props = withDefaults(defineProps<UiColorPickerProps>(), {
|
|
31
32
|
modelValue: undefined,
|
|
@@ -124,10 +125,12 @@ const MODE_CHANNELS: Record<Exclude<ColorFormat, 'hex'>, ChannelDef[]> = {
|
|
|
124
125
|
],
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
const fieldShape = useControlShape('field', 'md')
|
|
129
|
+
|
|
127
130
|
// Shared styling for each bordered value box (the hex field and each channel field).
|
|
128
131
|
// The mode switcher is a separate bordered box (the dropdown trigger draws its own).
|
|
129
132
|
const FIELD_BOX_CLASS =
|
|
130
|
-
'flex h-full items-center
|
|
133
|
+
'flex h-full items-center border border-solid border-control-field-border bg-control-field-bg transition-all focus-within:bg-control-field-bg-focus has-[input:focus-visible]:focus-ring'
|
|
131
134
|
|
|
132
135
|
// Detect a value's mode. reka represents hex as space 'rgb', so hex must be
|
|
133
136
|
// matched on the '#' prefix; rgb/hsl/hsb (and hsv→hsb) come from normalizeColor.
|
|
@@ -268,14 +271,14 @@ watch(
|
|
|
268
271
|
color-space="hsb"
|
|
269
272
|
x-channel="saturation"
|
|
270
273
|
y-channel="brightness"
|
|
271
|
-
class="relative h-[189px] w-full rounded-
|
|
274
|
+
class="relative h-[189px] w-full rounded-row"
|
|
272
275
|
:class="{ 'cursor-not-allowed': disabled }"
|
|
273
276
|
@update:color="onColorUpdate"
|
|
274
277
|
@change-end="onCommit"
|
|
275
278
|
>
|
|
276
279
|
<ColorAreaArea
|
|
277
280
|
:style="style"
|
|
278
|
-
class="absolute inset-0 rounded-
|
|
281
|
+
class="absolute inset-0 rounded-row"
|
|
279
282
|
>
|
|
280
283
|
<ColorAreaThumb class="group size-6 rounded-full border-4 border-actions-neutral-invert-idle transition-shadow hover:cursor-pointer hover:shadow-md">
|
|
281
284
|
<span class="pointer-events-none absolute -inset-1 rounded-full bg-actions-primary-hover-overlay opacity-0 transition-opacity group-hover:opacity-100" />
|
|
@@ -322,8 +325,8 @@ watch(
|
|
|
322
325
|
<div
|
|
323
326
|
v-if="showCustomControls"
|
|
324
327
|
data-testid="ui-color-picker-field"
|
|
325
|
-
class="flex
|
|
326
|
-
:class="{ 'cursor-not-allowed opacity-50': disabled }"
|
|
328
|
+
class="flex w-full items-center gap-2"
|
|
329
|
+
:class="[fieldShape.height, { 'cursor-not-allowed opacity-50': disabled }]"
|
|
327
330
|
>
|
|
328
331
|
<!-- Mode switcher — its own bordered box; hidden when only one mode is available -->
|
|
329
332
|
<div
|
|
@@ -357,12 +360,12 @@ watch(
|
|
|
357
360
|
:model-value="internalColor"
|
|
358
361
|
:disabled="disabled"
|
|
359
362
|
color-space="hsb"
|
|
360
|
-
:class="[FIELD_BOX_CLASS, 'min-w-0 flex-1 gap-1.5 px-3']"
|
|
363
|
+
:class="[FIELD_BOX_CLASS, fieldShape.radius, 'min-w-0 flex-1 gap-1.5 px-3']"
|
|
361
364
|
@update:color="onColorUpdate"
|
|
362
365
|
>
|
|
363
366
|
<ColorSwatch
|
|
364
367
|
:color="internalColor"
|
|
365
|
-
class="size-4 shrink-0 rounded-
|
|
368
|
+
class="size-4 shrink-0 rounded-check border border-borders-neutral-light bg-(--reka-color-swatch-color)"
|
|
366
369
|
/>
|
|
367
370
|
<Label
|
|
368
371
|
:for="fieldId"
|
|
@@ -386,7 +389,7 @@ watch(
|
|
|
386
389
|
:disabled="disabled"
|
|
387
390
|
:color-space="colorMode"
|
|
388
391
|
:channel="ch.channel"
|
|
389
|
-
:class="[FIELD_BOX_CLASS, 'min-w-0 flex-1 justify-center px-2']"
|
|
392
|
+
:class="[FIELD_BOX_CLASS, fieldShape.radius, 'min-w-0 flex-1 justify-center px-2']"
|
|
390
393
|
@update:color="onColorUpdate"
|
|
391
394
|
>
|
|
392
395
|
<ColorFieldInput
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { FieldSize } from '../../composables/useControlShape'
|
|
2
|
+
|
|
3
|
+
export type UiComboboxSize = FieldSize
|
|
4
|
+
|
|
5
|
+
export interface UiComboboxOption {
|
|
6
|
+
value: string
|
|
7
|
+
label: string
|
|
8
|
+
description?: string
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
/** Shown instead of the description, typically why the option is disabled. */
|
|
11
|
+
hint?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface UiComboboxGroup<T extends UiComboboxOption = UiComboboxOption> {
|
|
15
|
+
label: string
|
|
16
|
+
options: T[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A selectable row after the options, picked like an option but emitted as `action`. `icon` is a complete icon class such as `i-ph-user-plus`. */
|
|
20
|
+
export interface UiComboboxAction {
|
|
21
|
+
id: string
|
|
22
|
+
label: string
|
|
23
|
+
icon?: string
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface UiComboboxProps<T extends UiComboboxOption = UiComboboxOption> {
|
|
28
|
+
modelValue?: string
|
|
29
|
+
items?: UiComboboxGroup<T>[]
|
|
30
|
+
/** Selectable rows after the options. */
|
|
31
|
+
actions?: UiComboboxAction[]
|
|
32
|
+
loading?: boolean
|
|
33
|
+
size?: UiComboboxSize
|
|
34
|
+
placeholder?: string
|
|
35
|
+
disabled?: boolean
|
|
36
|
+
label?: string
|
|
37
|
+
ariaLabel?: string
|
|
38
|
+
/** Translated result count, announced through a polite live region while the list is open. */
|
|
39
|
+
resultsLabel?: string
|
|
40
|
+
id?: string
|
|
41
|
+
/** Rows shown before the list scrolls, with a peek of the next one. All rows show when unset. */
|
|
42
|
+
maxVisibleOptions?: number
|
|
43
|
+
/** Options show a checkbox and the list stays open after a pick, so several can be picked in a row. */
|
|
44
|
+
multiple?: boolean
|
|
45
|
+
/** Values of the options shown checked when `multiple` is set. Picking one of them emits `deselect`. */
|
|
46
|
+
selected?: string[]
|
|
47
|
+
/**
|
|
48
|
+
* 'trigger' matches the list to the field. 'compact' caps it at 480px, so on a wide field part of the
|
|
49
|
+
* page behind stays visible, such as a list that updates while picking.
|
|
50
|
+
*/
|
|
51
|
+
width?: 'trigger' | 'compact'
|
|
52
|
+
}
|