@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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { SideMenuItemProps } from './types'
|
|
3
3
|
import { computed, useSlots } from 'vue'
|
|
4
4
|
import { useForwardExpose } from 'reka-ui'
|
|
5
|
+
import UiBadge from '../UiBadge/UiBadge.vue'
|
|
5
6
|
|
|
6
7
|
// Visual body of a side menu item (icon, label, badge, interactive overlay).
|
|
7
8
|
// Extracted from UiSideMenuItem so the latter can optionally wrap this in a
|
|
@@ -41,12 +42,17 @@ const props = withDefaults(defineProps<SideMenuItemProps & {
|
|
|
41
42
|
alwaysShowLabel: false,
|
|
42
43
|
})
|
|
43
44
|
|
|
44
|
-
// Normalise the badge into either a display string (count pill) or null (dot)
|
|
45
|
-
// when shown. `showBadge` gates rendering so 0/false stay hidden.
|
|
46
45
|
const showBadge = computed(() => props.badge === true || (typeof props.badge === 'number' && props.badge > 0))
|
|
47
|
-
const badgeCount = computed(() =>
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
const badgeCount = computed(() => typeof props.badge === 'number' ? props.badge : undefined)
|
|
47
|
+
|
|
48
|
+
// An icon sits inside the item's 10px padding, whereas a 40px avatar fills the
|
|
49
|
+
// box on its own: the avatar variant needs offsets 10px smaller to land the
|
|
50
|
+
// badge on the same corner of the item.
|
|
51
|
+
const badgePositionClass = computed(() => {
|
|
52
|
+
if (badgeCount.value !== undefined) {
|
|
53
|
+
return hasAvatarSlot.value ? '-top-1 -right-1' : '-top-3.5 -right-3.5'
|
|
54
|
+
}
|
|
55
|
+
return hasAvatarSlot.value ? 'top-0 right-0' : '-top-2.5 -right-2.5'
|
|
50
56
|
})
|
|
51
57
|
|
|
52
58
|
const textAlignClass = computed(() => {
|
|
@@ -88,7 +94,7 @@ const textAlignClass = computed(() => {
|
|
|
88
94
|
<button
|
|
89
95
|
v-else
|
|
90
96
|
type="button"
|
|
91
|
-
class="block w-full h-full absolute inset-0 z-20 transition-all duration-150 cursor-pointer focus:outline-none focus-visible:
|
|
97
|
+
class="block w-full h-full absolute inset-0 z-20 transition-all duration-150 cursor-pointer focus:outline-none focus-visible:focus-ring rounded-xl"
|
|
92
98
|
:class="{ 'pointer-events-none': insideInteractive }"
|
|
93
99
|
:tabindex="insideInteractive ? -1 : undefined"
|
|
94
100
|
:aria-hidden="insideInteractive ? 'true' : undefined"
|
|
@@ -124,18 +130,16 @@ const textAlignClass = computed(() => {
|
|
|
124
130
|
]"
|
|
125
131
|
aria-hidden="true"
|
|
126
132
|
/>
|
|
127
|
-
<!-- Notification badge, pushed out toward the
|
|
128
|
-
|
|
129
|
-
<div
|
|
133
|
+
<!-- Notification badge, pushed out toward the item's top-right corner. -->
|
|
134
|
+
<UiBadge
|
|
130
135
|
v-if="showBadge"
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
:count="badgeCount"
|
|
137
|
+
color="danger"
|
|
138
|
+
variant="strong"
|
|
139
|
+
class="absolute z-30 pointer-events-none"
|
|
140
|
+
:class="badgePositionClass"
|
|
135
141
|
aria-hidden="true"
|
|
136
|
-
|
|
137
|
-
<span v-if="badgeCount">{{ badgeCount }}</span>
|
|
138
|
-
</div>
|
|
142
|
+
/>
|
|
139
143
|
</div>
|
|
140
144
|
<div
|
|
141
145
|
class="pl-4 flex md:hidden text-content-text-md-regular font-bold truncate w-full items-center md:justify-center md:text-center"
|
|
@@ -18,23 +18,10 @@ provide('stepperOrientation', toRef(props, 'orientation'))
|
|
|
18
18
|
<StepperRoot
|
|
19
19
|
v-bind="{ ...forwarded, ...$attrs }"
|
|
20
20
|
class="ui-stepper"
|
|
21
|
-
:class="
|
|
22
|
-
'ui-stepper--horizontal'
|
|
23
|
-
'ui-stepper--vertical'
|
|
24
|
-
}"
|
|
21
|
+
:class="isHorizontal
|
|
22
|
+
? 'ui-stepper--horizontal flex items-start gap-8'
|
|
23
|
+
: 'ui-stepper--vertical [&>*:not(:last-child)]:mb-2'"
|
|
25
24
|
>
|
|
26
25
|
<slot />
|
|
27
26
|
</StepperRoot>
|
|
28
27
|
</template>
|
|
29
|
-
|
|
30
|
-
<style>
|
|
31
|
-
@reference '@livestorm/ui-tokens/output/supernova/index.css';
|
|
32
|
-
|
|
33
|
-
.ui-stepper--horizontal {
|
|
34
|
-
@apply flex items-start gap-8;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.ui-stepper--vertical > *:not(:last-child) {
|
|
38
|
-
@apply mb-2;
|
|
39
|
-
}
|
|
40
|
-
</style>
|
|
@@ -8,20 +8,8 @@ defineProps<StepperDescriptionProps>()
|
|
|
8
8
|
<template>
|
|
9
9
|
<StepperDescription
|
|
10
10
|
v-bind="$attrs"
|
|
11
|
-
|
|
12
|
-
'ui-stepper-description',
|
|
13
|
-
'transition-all duration-200',
|
|
14
|
-
]"
|
|
11
|
+
class="ui-stepper-description block max-w-60 truncate text-content-text-md-regular text-text-neutral-tertiary transition-all duration-200"
|
|
15
12
|
>
|
|
16
13
|
<slot />
|
|
17
14
|
</StepperDescription>
|
|
18
15
|
</template>
|
|
19
|
-
|
|
20
|
-
<style scoped>
|
|
21
|
-
@reference '@livestorm/ui-tokens/output/supernova/index.css';
|
|
22
|
-
|
|
23
|
-
.ui-stepper-description {
|
|
24
|
-
@apply max-w-60 truncate;
|
|
25
|
-
@apply text-content-text-md-regular text-text-neutral-tertiary block;
|
|
26
|
-
}
|
|
27
|
-
</style>
|
|
@@ -25,66 +25,29 @@ const iconSizeClass = useIconSize(() => size)
|
|
|
25
25
|
<template>
|
|
26
26
|
<StepperIndicator
|
|
27
27
|
v-bind="$attrs"
|
|
28
|
-
class="stepper-indicator"
|
|
28
|
+
class="stepper-indicator flex items-center justify-center shrink-0 rounded-full font-semibold transition-all duration-200 bg-surface-neutral-alpha-200 text-text-neutral-base group-data-[state=active]/step:bg-surface-primary-bg-alpha group-data-[state=active]/step:text-text-neutral-invert-base"
|
|
29
29
|
:class="sizeClasses[size]"
|
|
30
30
|
>
|
|
31
31
|
<span
|
|
32
32
|
v-if="icon"
|
|
33
|
-
class="stepper-custom-icon"
|
|
34
|
-
:class="[iconSizeClass, icon]"
|
|
33
|
+
class="stepper-custom-icon block"
|
|
34
|
+
:class="[iconSizeClass, icon, { 'group-data-[state=completed]/step:hidden': showCheckmark }]"
|
|
35
|
+
data-testid="ui-stepper-indicator-icon"
|
|
35
36
|
/>
|
|
36
37
|
|
|
37
38
|
<span
|
|
38
39
|
v-if="showCheckmark"
|
|
39
|
-
class="stepper-checkmark i-ph-check"
|
|
40
|
+
class="stepper-checkmark i-ph-check hidden group-data-[state=completed]/step:block"
|
|
40
41
|
:class="iconSizeClass"
|
|
42
|
+
data-testid="ui-stepper-indicator-checkmark"
|
|
41
43
|
/>
|
|
42
44
|
|
|
43
|
-
<span
|
|
45
|
+
<span
|
|
46
|
+
class="stepper-number"
|
|
47
|
+
:class="{ hidden: icon, 'group-data-[state=completed]/step:hidden': showCheckmark }"
|
|
48
|
+
data-testid="ui-stepper-indicator-number"
|
|
49
|
+
>
|
|
44
50
|
<slot />
|
|
45
51
|
</span>
|
|
46
52
|
</StepperIndicator>
|
|
47
53
|
</template>
|
|
48
|
-
|
|
49
|
-
<style>
|
|
50
|
-
@reference '@livestorm/ui-tokens/output/supernova/index.css';
|
|
51
|
-
|
|
52
|
-
.stepper-indicator {
|
|
53
|
-
@apply flex items-center justify-center shrink-0;
|
|
54
|
-
@apply rounded-full;
|
|
55
|
-
@apply transition-all duration-200 font-semibold;
|
|
56
|
-
@apply bg-surface-neutral-alpha-200 text-text-neutral-base;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
[data-state="active"] .stepper-indicator {
|
|
60
|
-
@apply bg-surface-primary-bg-alpha text-text-neutral-invert-base;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.stepper-custom-icon {
|
|
64
|
-
@apply block;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
[data-state="completed"] .stepper-custom-icon {
|
|
68
|
-
@apply hidden;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.stepper-custom-icon ~ .stepper-number {
|
|
72
|
-
@apply hidden;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
[data-state="completed"] .stepper-custom-icon ~ .stepper-number {
|
|
76
|
-
@apply block;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.stepper-checkmark {
|
|
80
|
-
@apply hidden;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
[data-state="completed"] .stepper-checkmark {
|
|
84
|
-
@apply block;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
[data-state="completed"] .stepper-number {
|
|
88
|
-
@apply hidden;
|
|
89
|
-
}
|
|
90
|
-
</style>
|
|
@@ -16,15 +16,8 @@ withDefaults(defineProps<UiStepperItemProps>(), {
|
|
|
16
16
|
v-bind="$attrs"
|
|
17
17
|
:step="step"
|
|
18
18
|
:disabled="disabled"
|
|
19
|
-
class="ui-stepper-item"
|
|
19
|
+
class="ui-stepper-item group/step relative"
|
|
20
20
|
>
|
|
21
21
|
<slot />
|
|
22
22
|
</StepperItem>
|
|
23
23
|
</template>
|
|
24
|
-
|
|
25
|
-
<style>
|
|
26
|
-
@reference '@livestorm/ui-tokens/output/supernova/index.css';
|
|
27
|
-
.ui-stepper-item {
|
|
28
|
-
@apply relative;
|
|
29
|
-
}
|
|
30
|
-
</style>
|
|
@@ -28,22 +28,11 @@ const orientation = computed(() => props.orientation || unref(injectedOrientatio
|
|
|
28
28
|
>
|
|
29
29
|
<StepperSeparator
|
|
30
30
|
v-bind="$attrs"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'w-px min-h-8': orientation === 'vertical',
|
|
37
|
-
}
|
|
38
|
-
]"
|
|
31
|
+
class="ui-stepper-separator bg-surface-neutral-alpha-400 transition-colors duration-200"
|
|
32
|
+
:class="{
|
|
33
|
+
'h-px w-full min-w-8': orientation === 'horizontal',
|
|
34
|
+
'w-px min-h-8': orientation === 'vertical',
|
|
35
|
+
}"
|
|
39
36
|
/>
|
|
40
37
|
</div>
|
|
41
38
|
</template>
|
|
42
|
-
|
|
43
|
-
<style scoped>
|
|
44
|
-
@reference '@livestorm/ui-tokens/output/supernova/index.css';
|
|
45
|
-
|
|
46
|
-
.ui-stepper-separator {
|
|
47
|
-
@apply bg-surface-neutral-alpha-400;
|
|
48
|
-
}
|
|
49
|
-
</style>
|
|
@@ -8,17 +8,8 @@ defineProps<StepperTitleProps>()
|
|
|
8
8
|
<template>
|
|
9
9
|
<StepperTitle
|
|
10
10
|
v-bind="$attrs"
|
|
11
|
-
|
|
12
|
-
'ui-stepper-title',
|
|
13
|
-
]"
|
|
11
|
+
class="ui-stepper-title text-content-text-lg-bold text-text-neutral-secondary"
|
|
14
12
|
>
|
|
15
13
|
<slot />
|
|
16
14
|
</StepperTitle>
|
|
17
15
|
</template>
|
|
18
|
-
|
|
19
|
-
<style scoped>
|
|
20
|
-
@reference '@livestorm/ui-tokens/output/supernova/index.css';
|
|
21
|
-
.ui-stepper-title {
|
|
22
|
-
@apply text-content-text-lg-bold text-content-text-lg-bold text-text-neutral-secondary;
|
|
23
|
-
}
|
|
24
|
-
</style>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, ref } from 'vue'
|
|
2
|
+
import { computed, inject, ref } from 'vue'
|
|
3
3
|
import type { ComponentPublicInstance } from 'vue'
|
|
4
4
|
import { Label, SwitchRoot, SwitchThumb, useId } from 'reka-ui'
|
|
5
5
|
import type { SwitchColor, SwitchPosition, SwitchSize } from './types'
|
|
6
6
|
import UiTooltip from '../UiTooltip/UiTooltip.vue'
|
|
7
|
+
import { CHOICE_ROW_KEY } from '../UiChoice/types'
|
|
7
8
|
|
|
8
9
|
interface UiSwitchProps {
|
|
9
10
|
/**
|
|
@@ -71,6 +72,10 @@ interface UiSwitchProps {
|
|
|
71
72
|
* Switch id attribute
|
|
72
73
|
*/
|
|
73
74
|
id?: string
|
|
75
|
+
/**
|
|
76
|
+
* Accessible name for the switch, for switches rendered without a label
|
|
77
|
+
*/
|
|
78
|
+
ariaLabel?: string
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
const props = withDefaults(defineProps<UiSwitchProps>(), {
|
|
@@ -88,6 +93,7 @@ const props = withDefaults(defineProps<UiSwitchProps>(), {
|
|
|
88
93
|
fullWidth: false,
|
|
89
94
|
name: undefined,
|
|
90
95
|
id: undefined,
|
|
96
|
+
ariaLabel: undefined,
|
|
91
97
|
})
|
|
92
98
|
|
|
93
99
|
const emit = defineEmits<{
|
|
@@ -100,12 +106,16 @@ const generatedId = useId()
|
|
|
100
106
|
const inputId = computed(() => props.id ?? generatedId)
|
|
101
107
|
|
|
102
108
|
const isChecked = computed(() => props.modelValue)
|
|
109
|
+
const inChoiceRow = inject(CHOICE_ROW_KEY, false)
|
|
103
110
|
|
|
104
111
|
// Design palette: primary | warning, with error mapping onto the danger tokens
|
|
105
112
|
const palette = computed(() => props.error ? 'danger' : props.color === 'warning' ? 'warning' : 'primary')
|
|
106
113
|
|
|
107
114
|
const descriptionId = computed(() => props.description ? `${inputId.value}-description` : undefined)
|
|
108
115
|
|
|
116
|
+
// Inside UiChoice a disabled switch greys out instead of fading with the row
|
|
117
|
+
const greyedOut = computed(() => inChoiceRow && props.disabled && !props.error)
|
|
118
|
+
|
|
109
119
|
const trackClasses = computed(() => {
|
|
110
120
|
const baseClasses = [
|
|
111
121
|
'relative shrink-0 inline-flex items-center rounded-full',
|
|
@@ -117,9 +127,11 @@ const trackClasses = computed(() => {
|
|
|
117
127
|
// sm: 40x24 track / 16px thumb, xs: 32x20 track / 12px thumb
|
|
118
128
|
baseClasses.push(props.size === 'xs' ? 'h-5 w-8' : 'h-6 w-10')
|
|
119
129
|
|
|
120
|
-
if (
|
|
130
|
+
if (greyedOut.value) {
|
|
131
|
+
baseClasses.push('border-transparent', isChecked.value ? 'bg-surface-neutral-alpha-400' : 'bg-surface-neutral-alpha-200')
|
|
132
|
+
} else if (isChecked.value) {
|
|
121
133
|
const checkedClasses = {
|
|
122
|
-
primary: 'bg-
|
|
134
|
+
primary: 'bg-control-switch-on border-transparent',
|
|
123
135
|
warning: 'bg-actions-warning-idle-alpha-strong border-actions-warning-idle-alpha-strong',
|
|
124
136
|
danger: 'bg-actions-danger-idle-alpha-strong border-actions-danger-idle-alpha-strong',
|
|
125
137
|
}
|
|
@@ -135,11 +147,11 @@ const trackClasses = computed(() => {
|
|
|
135
147
|
}
|
|
136
148
|
} else {
|
|
137
149
|
const uncheckedBorderClasses = {
|
|
138
|
-
primary: 'border-
|
|
150
|
+
primary: 'border-control-off-border',
|
|
139
151
|
warning: 'border-borders-warning-strong',
|
|
140
|
-
danger: 'border-
|
|
152
|
+
danger: 'border-control-error-border',
|
|
141
153
|
}
|
|
142
|
-
baseClasses.push('bg-
|
|
154
|
+
baseClasses.push('bg-control-off', uncheckedBorderClasses[palette.value])
|
|
143
155
|
if (!props.disabled) {
|
|
144
156
|
// Border thickens on hover; padding shrinks in step so the thumb
|
|
145
157
|
// keeps its exact position and travel distance
|
|
@@ -147,16 +159,8 @@ const trackClasses = computed(() => {
|
|
|
147
159
|
}
|
|
148
160
|
}
|
|
149
161
|
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
baseClasses.push('focus-visible:ring focus-visible:ring-borders-danger-strong')
|
|
153
|
-
} else if (isChecked.value) {
|
|
154
|
-
baseClasses.push(props.color === 'warning'
|
|
155
|
-
? 'focus-visible:ring focus-visible:ring-borders-warning-strong'
|
|
156
|
-
: 'focus-visible:ring focus-visible:ring-borders-primary-strong')
|
|
157
|
-
} else {
|
|
158
|
-
baseClasses.push('focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-ring')
|
|
159
|
-
}
|
|
162
|
+
// The row draws the focus ring, or the choicebox around it
|
|
163
|
+
baseClasses.push('focus-indicator-none')
|
|
160
164
|
|
|
161
165
|
return baseClasses
|
|
162
166
|
})
|
|
@@ -181,35 +185,45 @@ const thumbClasses = computed(() => {
|
|
|
181
185
|
|
|
182
186
|
baseClasses.push(isChecked.value
|
|
183
187
|
? 'bg-actions-neutral-invert-idle'
|
|
184
|
-
: 'bg-
|
|
188
|
+
: 'bg-control-off-knob')
|
|
185
189
|
|
|
186
190
|
return baseClasses
|
|
187
191
|
})
|
|
188
192
|
|
|
189
193
|
const innerWrapperClasses = computed(() => {
|
|
190
|
-
const classes = ['group relative flex items-center gap-
|
|
194
|
+
const classes = ['group relative flex items-center rounded-field-md', inChoiceRow && props.switchPosition === 'right' ? 'gap-6' : 'gap-2']
|
|
191
195
|
|
|
192
196
|
if (props.switchPosition === 'right') {
|
|
193
197
|
classes.push('flex-row-reverse')
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
if (props.disabled) {
|
|
197
|
-
classes.push('opacity-50 cursor-not-allowed')
|
|
201
|
+
classes.push(inChoiceRow ? 'cursor-not-allowed' : 'opacity-50 cursor-not-allowed')
|
|
198
202
|
} else {
|
|
199
203
|
classes.push('cursor-pointer')
|
|
200
204
|
}
|
|
201
205
|
|
|
202
|
-
if (
|
|
203
|
-
classes
|
|
204
|
-
classes.push(props.error ? 'bg-actions-danger-idle-alpha-light' : 'bg-actions-neutral-idle-alpha-light')
|
|
206
|
+
if (inChoiceRow) {
|
|
207
|
+
return classes
|
|
205
208
|
}
|
|
206
209
|
|
|
210
|
+
if (!props.showBg) {
|
|
211
|
+
classes.push('isolate before:absolute before:-inset-x-3 before:-inset-y-1.5 before:-z-10 before:rounded-field-md before:pointer-events-none has-[[role=switch]:focus-visible]:before:focus-ring')
|
|
212
|
+
return classes
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
classes.push('p-2 shadow-[0px_1px_2px_0px_var(--color-shadow-neutral-100)] has-[[role=switch]:focus-visible]:focus-ring')
|
|
216
|
+
classes.push(props.error ? 'bg-actions-danger-idle-alpha-light' : 'bg-actions-neutral-idle-alpha-light')
|
|
217
|
+
|
|
207
218
|
return classes
|
|
208
219
|
})
|
|
209
220
|
|
|
210
221
|
const labelClasses = computed(() => ({
|
|
222
|
+
'text-content-text-md-medium': inChoiceRow,
|
|
223
|
+
'text-content-text-md-regular': !inChoiceRow,
|
|
211
224
|
'text-text-danger-base': props.error,
|
|
212
|
-
'text-text-neutral-base': !props.error,
|
|
225
|
+
'text-text-neutral-base': !props.error && !greyedOut.value,
|
|
226
|
+
'text-text-neutral-tertiary': greyedOut.value,
|
|
213
227
|
'cursor-not-allowed': props.disabled,
|
|
214
228
|
'cursor-pointer': !props.disabled,
|
|
215
229
|
}))
|
|
@@ -221,7 +235,8 @@ const textAlignsToSwitch = computed(() => props.switchPosition === 'right' && !p
|
|
|
221
235
|
const descriptionClasses = computed(() => ({
|
|
222
236
|
'text-right': textAlignsToSwitch.value,
|
|
223
237
|
'text-text-danger-tertiary': props.error,
|
|
224
|
-
'text-text-neutral-
|
|
238
|
+
'text-text-neutral-secondary': !props.error && !greyedOut.value,
|
|
239
|
+
'text-text-neutral-tertiary': greyedOut.value,
|
|
225
240
|
'cursor-not-allowed': props.disabled,
|
|
226
241
|
'cursor-pointer': !props.disabled,
|
|
227
242
|
}))
|
|
@@ -276,6 +291,7 @@ defineExpose({
|
|
|
276
291
|
:disabled="disabled"
|
|
277
292
|
:name="name"
|
|
278
293
|
:class="trackClasses"
|
|
294
|
+
:aria-label="ariaLabel"
|
|
279
295
|
:aria-invalid="error || undefined"
|
|
280
296
|
:aria-describedby="descriptionId"
|
|
281
297
|
@update:model-value="emit('update:modelValue', $event)"
|
|
@@ -303,7 +319,7 @@ defineExpose({
|
|
|
303
319
|
<div
|
|
304
320
|
v-if="label || description || $slots.label"
|
|
305
321
|
class="flex flex-col min-w-0 flex-1"
|
|
306
|
-
:class="{ 'items-end': textAlignsToSwitch }"
|
|
322
|
+
:class="{ 'items-end': textAlignsToSwitch, 'gap-1': inChoiceRow }"
|
|
307
323
|
>
|
|
308
324
|
<div
|
|
309
325
|
class="flex items-center gap-2"
|
|
@@ -311,7 +327,6 @@ defineExpose({
|
|
|
311
327
|
>
|
|
312
328
|
<Label
|
|
313
329
|
:for="inputId"
|
|
314
|
-
class="text-content-text-md-medium"
|
|
315
330
|
:class="labelClasses"
|
|
316
331
|
>
|
|
317
332
|
<slot name="label">
|
|
@@ -327,6 +342,7 @@ defineExpose({
|
|
|
327
342
|
<!-- stays neutral even in error state, per design -->
|
|
328
343
|
<div
|
|
329
344
|
class="flex items-center justify-center size-4 cursor-help shrink-0 text-text-neutral-tertiary"
|
|
345
|
+
data-testid="ui-switch-label-info"
|
|
330
346
|
@click.stop
|
|
331
347
|
>
|
|
332
348
|
<span class="i-ph-info-fill size-4" />
|
|
@@ -337,7 +353,7 @@ defineExpose({
|
|
|
337
353
|
<span
|
|
338
354
|
v-if="description"
|
|
339
355
|
:id="descriptionId"
|
|
340
|
-
class="text-content-text-md-
|
|
356
|
+
class="text-content-text-md-regular"
|
|
341
357
|
:class="descriptionClasses"
|
|
342
358
|
>
|
|
343
359
|
{{ description }}
|
|
@@ -347,7 +363,7 @@ defineExpose({
|
|
|
347
363
|
<!-- Background hover overlay -->
|
|
348
364
|
<div
|
|
349
365
|
v-if="showBg && !disabled"
|
|
350
|
-
class="absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none rounded-
|
|
366
|
+
class="absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none rounded-[inherit]"
|
|
351
367
|
:class="{
|
|
352
368
|
'bg-actions-danger-hover-overlay': error,
|
|
353
369
|
'bg-actions-primary-hover-overlay': isChecked && !error,
|
|
@@ -1,24 +1,114 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { provide, toRef } from 'vue'
|
|
3
|
+
import { UI_TABLE_SIZE_KEY, type UiTableSize } from './context'
|
|
3
4
|
|
|
4
5
|
export interface UiTableProps {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Row heights: `md` = 40px header / 48px rows, `lg` = 48px header / 64px rows.
|
|
8
|
+
* @default 'md'
|
|
9
|
+
*/
|
|
10
|
+
size?: UiTableSize
|
|
11
|
+
/**
|
|
12
|
+
* Alternating row backgrounds. Preferred over row dividers for readability.
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
zebra?: boolean
|
|
7
16
|
}
|
|
8
17
|
|
|
9
18
|
const props = withDefaults(defineProps<UiTableProps>(), {
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
size: 'md',
|
|
20
|
+
zebra: true,
|
|
12
21
|
})
|
|
13
22
|
|
|
14
|
-
provide(
|
|
15
|
-
provide('hoverEffect', toRef(props, 'hoverEffect'))
|
|
23
|
+
provide(UI_TABLE_SIZE_KEY, toRef(props, 'size'))
|
|
16
24
|
</script>
|
|
17
25
|
|
|
18
26
|
<template>
|
|
19
|
-
<div
|
|
20
|
-
|
|
27
|
+
<div
|
|
28
|
+
class="ui-table relative flow-root w-fit min-w-full overflow-y-clip"
|
|
29
|
+
:class="{ 'ui-table--zebra': zebra }"
|
|
30
|
+
>
|
|
31
|
+
<table class="-my-0.5 w-full border-separate border-spacing-x-0 border-spacing-y-0.5">
|
|
21
32
|
<slot />
|
|
22
33
|
</table>
|
|
23
34
|
</div>
|
|
24
35
|
</template>
|
|
36
|
+
|
|
37
|
+
<style scoped>
|
|
38
|
+
/*
|
|
39
|
+
* Row backgrounds live here rather than on the cells so the zebra stripe,
|
|
40
|
+
* hover and selected overlays stack the way the Figma spec layers them:
|
|
41
|
+
* zebra is a background-color, state overlays are background-image
|
|
42
|
+
* gradients painted on top of it.
|
|
43
|
+
*/
|
|
44
|
+
.ui-table--zebra :deep(tbody:not([data-zebra-offset]) > tr:nth-child(even of :not([data-zebra-skip])) > td),
|
|
45
|
+
.ui-table--zebra :deep(tbody[data-zebra-offset] > tr:nth-child(odd of :not([data-zebra-skip])) > td) {
|
|
46
|
+
background-color: var(--color-surface-neutral-alpha-100);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ui-table :deep(tbody > tr[data-clickable]:hover > td),
|
|
50
|
+
.ui-table :deep(tbody > tr[data-clickable]:focus-visible > td),
|
|
51
|
+
.ui-table :deep(tbody > tr[data-linked]:hover > td),
|
|
52
|
+
.ui-table :deep(tbody > tr[data-linked]:focus-within > td),
|
|
53
|
+
.ui-table :deep(tbody > tr:has(> .ui-table__actions-cell):hover > td) {
|
|
54
|
+
background-image: linear-gradient(var(--color-actions-primary-hover-overlay), var(--color-actions-primary-hover-overlay));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ui-table :deep(tbody > tr[data-selected] > td),
|
|
58
|
+
.ui-table :deep(tbody > tr[data-selected]:hover > td) {
|
|
59
|
+
background-image: linear-gradient(var(--color-actions-primary-active-overlay), var(--color-actions-primary-active-overlay));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ui-table :deep(tbody > tr > td:first-child) {
|
|
63
|
+
border-top-left-radius: var(--radius-table-row);
|
|
64
|
+
border-bottom-left-radius: var(--radius-table-row);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
* A zero-width trailing cell cannot show the row end, so the cell before it
|
|
69
|
+
* rounds it. A menu column is zero-width when no row has a menu.
|
|
70
|
+
*/
|
|
71
|
+
.ui-table :deep(tbody > tr > td:last-child),
|
|
72
|
+
.ui-table :deep(tbody > tr > td:has(+ .ui-table__zero-width-cell)),
|
|
73
|
+
.ui-table :deep(table:not(:has(.ui-table__menu-cell)) > tbody > tr > td:has(+ .ui-table__empty-menu-cell)) {
|
|
74
|
+
border-top-right-radius: var(--radius-table-row);
|
|
75
|
+
border-bottom-right-radius: var(--radius-table-row);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
* The trailing actions backdrop (default variant only) masks the cells it
|
|
80
|
+
* overlays, so it mirrors the effective row background: opaque base plus
|
|
81
|
+
* the same stacked overlays. The floating variant carries no backdrop —
|
|
82
|
+
* its content (e.g. a UiActionBar) brings its own surface.
|
|
83
|
+
*/
|
|
84
|
+
.ui-table :deep(.ui-table__actions--backdrop) {
|
|
85
|
+
background-color: var(--color-surface-neutral-bg-main);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.ui-table--zebra :deep(tbody:not([data-zebra-offset]) > tr:nth-child(even of :not([data-zebra-skip])) .ui-table__actions--backdrop),
|
|
89
|
+
.ui-table--zebra :deep(tbody[data-zebra-offset] > tr:nth-child(odd of :not([data-zebra-skip])) .ui-table__actions--backdrop) {
|
|
90
|
+
background-image: linear-gradient(var(--color-surface-neutral-alpha-100), var(--color-surface-neutral-alpha-100));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ui-table :deep(tbody > tr:hover .ui-table__actions--backdrop) {
|
|
94
|
+
background-image: linear-gradient(var(--color-actions-primary-hover-overlay), var(--color-actions-primary-hover-overlay));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ui-table--zebra :deep(tbody:not([data-zebra-offset]) > tr:nth-child(even of :not([data-zebra-skip])):hover .ui-table__actions--backdrop),
|
|
98
|
+
.ui-table--zebra :deep(tbody[data-zebra-offset] > tr:nth-child(odd of :not([data-zebra-skip])):hover .ui-table__actions--backdrop) {
|
|
99
|
+
background-image:
|
|
100
|
+
linear-gradient(var(--color-actions-primary-hover-overlay), var(--color-actions-primary-hover-overlay)),
|
|
101
|
+
linear-gradient(var(--color-surface-neutral-alpha-100), var(--color-surface-neutral-alpha-100));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.ui-table :deep(tbody > tr[data-selected]:hover .ui-table__actions--backdrop) {
|
|
105
|
+
background-image: linear-gradient(var(--color-actions-primary-active-overlay), var(--color-actions-primary-active-overlay));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.ui-table--zebra :deep(tbody:not([data-zebra-offset]) > tr[data-selected]:nth-child(even of :not([data-zebra-skip])):hover .ui-table__actions--backdrop),
|
|
109
|
+
.ui-table--zebra :deep(tbody[data-zebra-offset] > tr[data-selected]:nth-child(odd of :not([data-zebra-skip])):hover .ui-table__actions--backdrop) {
|
|
110
|
+
background-image:
|
|
111
|
+
linear-gradient(var(--color-actions-primary-active-overlay), var(--color-actions-primary-active-overlay)),
|
|
112
|
+
linear-gradient(var(--color-surface-neutral-alpha-100), var(--color-surface-neutral-alpha-100));
|
|
113
|
+
}
|
|
114
|
+
</style>
|