@aleph-alpha/ui-library 1.25.2 → 2.2.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/config.d.ts +11 -23
- package/config.js +161 -105
- package/dist/system/components/UiFileUploadBox/index.d.ts +1 -1
- package/dist/system/components/UiSnackbar/UiSnackbar.vue.d.ts +5 -0
- package/dist/system/components/UiSnackbar/index.d.ts +3 -0
- package/dist/system/components/UiSnackbar/types.d.ts +96 -0
- package/dist/system/components/core/sonner/Sonner.vue.d.ts +3 -0
- package/dist/system/components/core/sonner/index.d.ts +1 -0
- package/dist/system/components/index.d.ts +1 -1
- package/dist/system/index.d.ts +3 -4
- package/dist/system/lib.js +20826 -19243
- package/dist/system/patterns/UiSidebar/UiSidebarGroupLabel.vue.d.ts +6 -6
- package/dist/system/patterns/UiSidebar/activeIndicator.d.ts +1 -2
- package/dist/system/patterns/UiSidebar/index.d.ts +1 -3
- package/dist/system/patterns/UiSidebar/types.d.ts +1 -92
- package/docs/public-docs/component-directory.md +8 -4
- package/docs/public-docs/contributing.md +3 -3
- package/docs/public-docs/external-links.md +1 -9
- package/docs/public-docs/foundations.md +101 -6
- package/docs/public-docs/getting-started-designers.md +2 -2
- package/hover-mix.d.ts +18 -14
- package/hover-mix.js +24 -20
- package/package.json +9 -7
- package/src/components/UiAccordion/UiAccordion.stories.ts +48 -10
- package/src/components/UiAccordion/UiAccordion.vue +10 -10
- package/src/components/UiAccordion/UiAccordionContent.vue +6 -6
- package/src/components/UiAccordion/UiAccordionItem.vue +6 -6
- package/src/components/UiAccordion/UiAccordionTrigger.vue +14 -10
- package/src/components/UiAccordion/__tests__/UiAccordion.test.ts +72 -14
- package/src/components/UiAccordion/types.ts +3 -1
- package/src/components/UiAlert/UiAlert.stories.ts +9 -4
- package/src/components/UiAlert/UiAlert.vue +15 -15
- package/src/components/UiAlert/UiAlertDescription.vue +4 -4
- package/src/components/UiAlert/UiAlertTitle.vue +4 -4
- package/src/components/UiAlertDialog/UiAlertDialog.vue +9 -9
- package/src/components/UiAlertDialog/UiAlertDialogAction.vue +6 -6
- package/src/components/UiAlertDialog/UiAlertDialogCancel.vue +6 -6
- package/src/components/UiAlertDialog/UiAlertDialogContent.vue +7 -7
- package/src/components/UiAlertDialog/UiAlertDialogDescription.vue +6 -6
- package/src/components/UiAlertDialog/UiAlertDialogFooter.vue +4 -4
- package/src/components/UiAlertDialog/UiAlertDialogHeader.vue +6 -6
- package/src/components/UiAlertDialog/UiAlertDialogTitle.vue +6 -6
- package/src/components/UiAlertDialog/UiAlertDialogTrigger.vue +6 -6
- package/src/components/UiAvatar/UiAvatar.stories.ts +6 -2
- package/src/components/UiAvatar/UiAvatar.vue +4 -4
- package/src/components/UiAvatar/UiAvatarFallback.vue +4 -4
- package/src/components/UiAvatar/UiAvatarImage.vue +6 -6
- package/src/components/UiAvatar/__tests__/UiAvatar.test.ts +3 -1
- package/src/components/UiBadge/UiBadge.stories.ts +11 -1
- package/src/components/UiBadge/UiBadge.vue +13 -13
- package/src/components/UiBadge/__tests__/UiBadge.test.ts +7 -2
- package/src/components/UiButton/UiButton.stories.ts +20 -2
- package/src/components/UiButton/UiButton.vue +54 -51
- package/src/components/UiButton/__tests__/UiButton.test.ts +8 -1
- package/src/components/UiCalendar/UiCalendar.stories.ts +12 -27
- package/src/components/UiCalendar/UiCalendar.vue +37 -21
- package/src/components/UiCard/UiCard.stories.ts +8 -4
- package/src/components/UiCard/UiCard.vue +4 -4
- package/src/components/UiCard/UiCardAction.vue +4 -4
- package/src/components/UiCard/UiCardContent.vue +4 -4
- package/src/components/UiCard/UiCardDescription.vue +4 -4
- package/src/components/UiCard/UiCardFooter.vue +4 -4
- package/src/components/UiCard/UiCardHeader.vue +4 -4
- package/src/components/UiCard/UiCardTitle.vue +4 -4
- package/src/components/UiCard/__tests__/UiCardDescription.test.ts +3 -1
- package/src/components/UiCheckbox/UiCheckbox.stories.ts +4 -0
- package/src/components/UiCheckbox/UiCheckbox.vue +10 -10
- package/src/components/UiChip/UiChip.stories.ts +12 -1
- package/src/components/UiChip/UiChip.vue +94 -75
- package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +19 -3
- package/src/components/UiCodeBlock/UiCodeBlock.vue +122 -109
- package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +22 -6
- package/src/components/UiDialog/UiDialog.stories.ts +2 -1
- package/src/components/UiDialog/UiDialog.vue +9 -9
- package/src/components/UiDialog/UiDialogClose.vue +6 -6
- package/src/components/UiDialog/UiDialogContent.vue +61 -52
- package/src/components/UiDialog/UiDialogDescription.vue +6 -6
- package/src/components/UiDialog/UiDialogFooter.vue +6 -6
- package/src/components/UiDialog/UiDialogHeader.vue +6 -6
- package/src/components/UiDialog/UiDialogTitle.vue +6 -6
- package/src/components/UiDialog/UiDialogTrigger.vue +6 -6
- package/src/components/UiDialog/__tests__/UiDialog.test.ts +6 -2
- package/src/components/UiDrawer/UiDrawer.stories.ts +10 -8
- package/src/components/UiDrawer/UiDrawer.vue +9 -9
- package/src/components/UiDrawer/UiDrawerClose.vue +6 -6
- package/src/components/UiDrawer/UiDrawerContent.vue +10 -10
- package/src/components/UiDrawer/UiDrawerDescription.vue +6 -6
- package/src/components/UiDrawer/UiDrawerFooter.vue +6 -6
- package/src/components/UiDrawer/UiDrawerHeader.vue +6 -6
- package/src/components/UiDrawer/UiDrawerTitle.vue +6 -6
- package/src/components/UiDrawer/UiDrawerTrigger.vue +6 -6
- package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +18 -6
- package/src/components/UiDropdownMenu/UiDropdownMenu.vue +10 -10
- package/src/components/UiDropdownMenu/UiDropdownMenuCheckboxItem.vue +11 -11
- package/src/components/UiDropdownMenu/UiDropdownMenuContent.vue +14 -11
- package/src/components/UiDropdownMenu/UiDropdownMenuGroup.vue +4 -4
- package/src/components/UiDropdownMenu/UiDropdownMenuItem.vue +11 -11
- package/src/components/UiDropdownMenu/UiDropdownMenuLabel.vue +8 -8
- package/src/components/UiDropdownMenu/UiDropdownMenuRadioGroup.vue +10 -7
- package/src/components/UiDropdownMenu/UiDropdownMenuRadioItem.vue +9 -9
- package/src/components/UiDropdownMenu/UiDropdownMenuSeparator.vue +4 -4
- package/src/components/UiDropdownMenu/UiDropdownMenuShortcut.vue +4 -4
- package/src/components/UiDropdownMenu/UiDropdownMenuSub.vue +10 -10
- package/src/components/UiDropdownMenu/UiDropdownMenuSubContent.vue +12 -9
- package/src/components/UiDropdownMenu/UiDropdownMenuSubTrigger.vue +10 -10
- package/src/components/UiDropdownMenu/UiDropdownMenuTrigger.vue +10 -10
- package/src/components/UiDropdownMenu/__tests__/UiDropdownMenu.test.ts +105 -15
- package/src/components/UiEmpty/UiEmpty.stories.ts +5 -0
- package/src/components/UiEmpty/UiEmpty.vue +14 -11
- package/src/components/UiField/UiField.stories.ts +48 -8
- package/src/components/UiField/UiField.vue +78 -72
- package/src/components/UiField/UiFieldContent.vue +4 -4
- package/src/components/UiField/UiFieldDescription.vue +23 -17
- package/src/components/UiField/UiFieldError.vue +11 -9
- package/src/components/UiField/UiFieldGroup.vue +4 -4
- package/src/components/UiField/UiFieldLabel.vue +12 -8
- package/src/components/UiField/UiFieldLabelInfo.vue +15 -11
- package/src/components/UiField/UiFieldLegend.vue +4 -4
- package/src/components/UiField/UiFieldSeparator.vue +4 -4
- package/src/components/UiField/UiFieldSet.vue +4 -4
- package/src/components/UiField/UiFieldTitle.vue +4 -4
- package/src/components/UiField/__tests__/UiFieldError.test.ts +5 -1
- package/src/components/UiField/keys.ts +3 -3
- package/src/components/UiFileItem/UiFileItem.stories.ts +20 -8
- package/src/components/UiFileItem/UiFileItem.vue +51 -47
- package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +4 -1
- package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +8 -3
- package/src/components/UiFileUploadBox/UiFileUploadBox.vue +140 -126
- package/src/components/UiFileUploadBox/__tests__/file-validation.test.ts +6 -1
- package/src/components/UiFileUploadBox/file-validation.ts +17 -4
- package/src/components/UiFileUploadBox/index.ts +6 -1
- package/src/components/UiIcon/UiIcon.stories.ts +94 -20
- package/src/components/UiIcon/UiIcon.vue +59 -59
- package/src/components/UiInput/UiInput.stories.ts +6 -2
- package/src/components/UiInput/UiInput.vue +40 -38
- package/src/components/UiInput/__tests__/UiInput.test.ts +3 -1
- package/src/components/UiItem/UiItem.stories.ts +4 -0
- package/src/components/UiItem/UiItem.vue +11 -11
- package/src/components/UiItem/UiItemMedia.vue +8 -8
- package/src/components/UiItem/__tests__/UiItem.test.ts +15 -5
- package/src/components/UiItem/constants.ts +4 -1
- package/src/components/UiKbd/UiKbd.stories.ts +20 -11
- package/src/components/UiKbd/UiKbd.vue +46 -46
- package/src/components/UiKbd/UiKbdGroup.vue +4 -4
- package/src/components/UiLabel/UiLabel.stories.ts +2 -2
- package/src/components/UiLabel/UiLabel.vue +6 -6
- package/src/components/UiListbox/UiListbox.stories.ts +19 -14
- package/src/components/UiListbox/UiListbox.vue +28 -12
- package/src/components/UiListbox/UiListboxContent.vue +4 -4
- package/src/components/UiListbox/UiListboxFilter.vue +7 -7
- package/src/components/UiListbox/UiListboxGroup.vue +4 -4
- package/src/components/UiListbox/UiListboxGroupLabel.vue +4 -4
- package/src/components/UiListbox/UiListboxItem.vue +10 -10
- package/src/components/UiListbox/UiListboxItemIndicator.vue +4 -4
- package/src/components/UiListbox/__tests__/UiListbox.test.ts +6 -2
- package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +34 -16
- package/src/components/UiNavigationMenu/UiNavigationMenu.vue +17 -17
- package/src/components/UiNavigationMenu/UiNavigationMenuContent.vue +10 -7
- package/src/components/UiNavigationMenu/UiNavigationMenuIndicator.vue +9 -7
- package/src/components/UiNavigationMenu/UiNavigationMenuItem.vue +6 -6
- package/src/components/UiNavigationMenu/UiNavigationMenuLink.vue +13 -10
- package/src/components/UiNavigationMenu/UiNavigationMenuList.vue +6 -6
- package/src/components/UiNavigationMenu/UiNavigationMenuTrigger.vue +10 -7
- package/src/components/UiPopover/UiPopover.stories.ts +10 -6
- package/src/components/UiPopover/UiPopover.vue +7 -7
- package/src/components/UiPopover/UiPopoverContent.vue +11 -11
- package/src/components/UiPopover/UiPopoverTrigger.vue +10 -7
- package/src/components/UiProgress/UiProgress.stories.ts +8 -2
- package/src/components/UiProgress/UiProgress.vue +15 -15
- package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +26 -22
- package/src/components/UiRadioGroup/UiRadioGroup.vue +23 -21
- package/src/components/UiRadioGroup/UiRadioGroupItem.vue +10 -10
- package/src/components/UiRadioGroup/__tests__/UiRadioGroup.test.ts +11 -3
- package/src/components/UiRangeCalendar/UiRangeCalendar.stories.ts +21 -25
- package/src/components/UiRangeCalendar/UiRangeCalendar.vue +36 -19
- package/src/components/UiSelect/UiSelect.stories.ts +53 -7
- package/src/components/UiSelect/UiSelect.vue +136 -130
- package/src/components/UiSelect/UiSelectContent.vue +16 -16
- package/src/components/UiSelect/UiSelectGroup.vue +4 -4
- package/src/components/UiSelect/UiSelectItem.vue +60 -60
- package/src/components/UiSelect/UiSelectLabel.vue +4 -4
- package/src/components/UiSelect/UiSelectSeparator.vue +4 -4
- package/src/components/UiSelect/UiSelectTrigger.vue +50 -48
- package/src/components/UiSelect/UiSelectValue.vue +34 -24
- package/src/components/UiSelect/__tests__/UiSelect.test.ts +142 -23
- package/src/components/UiSelect/__tests__/UiSelectContent.test.ts +14 -2
- package/src/components/UiSelect/__tests__/UiSelectItem.test.ts +32 -5
- package/src/components/UiSelect/__tests__/UiSelectSeparator.test.ts +6 -2
- package/src/components/UiSelect/__tests__/UiSelectTrigger.test.ts +11 -2
- package/src/components/UiSelect/__tests__/UiSelectValue.test.ts +6 -1
- package/src/components/UiSelect/context.ts +2 -1
- package/src/components/UiSeparator/UiSeparator.stories.ts +14 -9
- package/src/components/UiSeparator/UiSeparator.vue +13 -10
- package/src/components/UiSheet/UiSheet.stories.ts +16 -14
- package/src/components/UiSkeleton/UiSkeleton.stories.ts +24 -20
- package/src/components/UiSkeleton/UiSkeleton.vue +14 -14
- package/src/components/UiSlider/UiSlider.stories.ts +11 -8
- package/src/components/UiSlider/UiSlider.vue +18 -18
- package/src/components/UiSnackbar/UiSnackbar.stories.ts +508 -0
- package/src/components/UiSnackbar/UiSnackbar.vue +286 -0
- package/src/components/UiSnackbar/__tests__/UiSnackbar.test.ts +17 -0
- package/src/components/UiSnackbar/index.ts +4 -0
- package/src/components/UiSnackbar/types.ts +97 -0
- package/src/components/UiSpinner/UiSpinner.stories.ts +6 -1
- package/src/components/UiSpinner/UiSpinner.vue +8 -8
- package/src/components/UiSpinner/__tests__/UiSpinner.test.ts +4 -1
- package/src/components/UiStepper/UiStepper.stories.ts +32 -5
- package/src/components/UiStepper/UiStepper.vue +7 -7
- package/src/components/UiStepper/UiStepperDescription.vue +4 -4
- package/src/components/UiStepper/UiStepperIndicator.vue +4 -4
- package/src/components/UiStepper/UiStepperItem.vue +6 -6
- package/src/components/UiStepper/UiStepperSeparator.vue +4 -4
- package/src/components/UiStepper/UiStepperTitle.vue +4 -4
- package/src/components/UiStepper/UiStepperTrigger.vue +8 -8
- package/src/components/UiStepper/__tests__/UiStepper.test.ts +4 -1
- package/src/components/UiSwitch/UiSwitch.stories.ts +8 -4
- package/src/components/UiSwitch/UiSwitch.vue +12 -12
- package/src/components/UiSwitch/__tests__/UiSwitch.test.ts +9 -2
- package/src/components/UiTable/UiTable.stories.ts +8 -1
- package/src/components/UiTable/UiTable.vue +4 -4
- package/src/components/UiTable/UiTableBody.vue +4 -4
- package/src/components/UiTable/UiTableCaption.vue +4 -4
- package/src/components/UiTable/UiTableCell.vue +6 -6
- package/src/components/UiTable/UiTableEmpty.vue +8 -8
- package/src/components/UiTable/UiTableFooter.vue +4 -4
- package/src/components/UiTable/UiTableHead.vue +13 -9
- package/src/components/UiTable/UiTableHeader.vue +4 -4
- package/src/components/UiTable/UiTableRow.vue +8 -8
- package/src/components/UiTable/__tests__/UiTableRow.test.ts +10 -0
- package/src/components/UiTabs/UiTabs.stories.ts +6 -2
- package/src/components/UiTabs/UiTabs.vue +12 -12
- package/src/components/UiTabs/UiTabsContent.vue +6 -6
- package/src/components/UiTabs/UiTabsList.vue +6 -6
- package/src/components/UiTabs/UiTabsTrigger.vue +6 -6
- package/src/components/UiTabs/__tests__/UiTabs.test.ts +33 -2
- package/src/components/UiTagsInput/UiTagsInput.stories.ts +22 -3
- package/src/components/UiTagsInput/UiTagsInput.vue +9 -9
- package/src/components/UiTagsInput/UiTagsInputInput.vue +6 -6
- package/src/components/UiTagsInput/UiTagsInputItem.vue +6 -6
- package/src/components/UiTagsInput/UiTagsInputItemDelete.vue +4 -4
- package/src/components/UiTagsInput/UiTagsInputItemText.vue +4 -4
- package/src/components/UiTagsInput/__tests__/UiTagsInput.test.ts +6 -2
- package/src/components/UiTagsInput/types.ts +4 -1
- package/src/components/UiTextarea/UiTextarea.stories.ts +4 -0
- package/src/components/UiTextarea/UiTextarea.vue +10 -10
- package/src/components/UiTextarea/__tests__/UiTextarea.test.ts +3 -1
- package/src/components/UiToggle/UiToggle.stories.ts +4 -0
- package/src/components/UiToggle/UiToggle.vue +11 -11
- package/src/components/UiToggle/__tests__/UiToggle.test.ts +9 -0
- package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +9 -2
- package/src/components/UiToggleGroup/UiToggleGroup.vue +31 -31
- package/src/components/UiToggleGroup/UiToggleGroupItem.vue +6 -6
- package/src/components/UiToggleGroup/__tests__/UiToggleGroup.test.ts +23 -2
- package/src/components/UiToggleGroup/types.ts +5 -4
- package/src/components/UiTooltip/UiTooltip.stories.ts +13 -8
- package/src/components/UiTooltip/UiTooltip.vue +19 -19
- package/src/components/core/accordion/Accordion.vue +5 -5
- package/src/components/core/accordion/AccordionContent.vue +9 -7
- package/src/components/core/accordion/AccordionItem.vue +10 -8
- package/src/components/core/accordion/AccordionTrigger.vue +10 -8
- package/src/components/core/alert/Alert.vue +13 -9
- package/src/components/core/alert/AlertDescription.vue +5 -5
- package/src/components/core/alert/AlertTitle.vue +11 -6
- package/src/components/core/alert/index.ts +3 -2
- package/src/components/core/alert-dialog/AlertDialog.vue +10 -6
- package/src/components/core/alert-dialog/AlertDialogAction.vue +5 -5
- package/src/components/core/alert-dialog/AlertDialogCancel.vue +5 -5
- package/src/components/core/alert-dialog/AlertDialogContent.vue +25 -25
- package/src/components/core/alert-dialog/AlertDialogDescription.vue +4 -4
- package/src/components/core/alert-dialog/AlertDialogFooter.vue +1 -1
- package/src/components/core/alert-dialog/AlertDialogHeader.vue +5 -2
- package/src/components/core/alert-dialog/AlertDialogTitle.vue +4 -4
- package/src/components/core/alert-dialog/AlertDialogTrigger.vue +3 -3
- package/src/components/core/avatar/Avatar.vue +12 -7
- package/src/components/core/avatar/AvatarFallback.vue +15 -8
- package/src/components/core/avatar/AvatarImage.vue +8 -4
- package/src/components/core/badge/Badge.vue +31 -31
- package/src/components/core/badge/index.ts +6 -3
- package/src/components/core/button/Button.vue +32 -20
- package/src/components/core/button/index.ts +5 -6
- package/src/components/core/calendar/Calendar.vue +88 -69
- package/src/components/core/calendar/CalendarCell.vue +10 -8
- package/src/components/core/calendar/CalendarCellTrigger.vue +14 -14
- package/src/components/core/calendar/CalendarGrid.vue +11 -9
- package/src/components/core/calendar/CalendarGridBody.vue +3 -3
- package/src/components/core/calendar/CalendarGridHead.vue +6 -4
- package/src/components/core/calendar/CalendarGridRow.vue +10 -8
- package/src/components/core/calendar/CalendarHeadCell.vue +16 -9
- package/src/components/core/calendar/CalendarHeader.vue +16 -9
- package/src/components/core/calendar/CalendarHeading.vue +13 -11
- package/src/components/core/calendar/CalendarNextButton.vue +12 -10
- package/src/components/core/calendar/CalendarPrevButton.vue +12 -10
- package/src/components/core/calendar/index.ts +5 -1
- package/src/components/core/card/Card.vue +6 -6
- package/src/components/core/card/CardAction.vue +11 -6
- package/src/components/core/card/CardContent.vue +5 -5
- package/src/components/core/card/CardDescription.vue +9 -6
- package/src/components/core/card/CardFooter.vue +9 -6
- package/src/components/core/card/CardHeader.vue +5 -5
- package/src/components/core/card/CardTitle.vue +9 -6
- package/src/components/core/checkbox/Checkbox.vue +12 -10
- package/src/components/core/dialog/Dialog.vue +5 -5
- package/src/components/core/dialog/DialogClose.vue +3 -3
- package/src/components/core/dialog/DialogContent.vue +24 -24
- package/src/components/core/dialog/DialogDescription.vue +4 -4
- package/src/components/core/dialog/DialogFooter.vue +1 -1
- package/src/components/core/dialog/DialogHeader.vue +1 -1
- package/src/components/core/dialog/DialogOverlay.vue +5 -5
- package/src/components/core/dialog/DialogTitle.vue +4 -4
- package/src/components/core/dialog/DialogTrigger.vue +3 -3
- package/src/components/core/drawer/Drawer.vue +5 -5
- package/src/components/core/drawer/DrawerClose.vue +3 -3
- package/src/components/core/drawer/DrawerContent.vue +26 -21
- package/src/components/core/drawer/DrawerDescription.vue +9 -7
- package/src/components/core/drawer/DrawerFooter.vue +11 -6
- package/src/components/core/drawer/DrawerHeader.vue +5 -5
- package/src/components/core/drawer/DrawerTitle.vue +9 -7
- package/src/components/core/drawer/DrawerTrigger.vue +3 -3
- package/src/components/core/dropdown-menu/DropdownMenu.vue +10 -6
- package/src/components/core/dropdown-menu/DropdownMenuCheckboxItem.vue +29 -21
- package/src/components/core/dropdown-menu/DropdownMenuContent.vue +24 -17
- package/src/components/core/dropdown-menu/DropdownMenuGroup.vue +3 -3
- package/src/components/core/dropdown-menu/DropdownMenuItem.vue +20 -20
- package/src/components/core/dropdown-menu/DropdownMenuLabel.vue +16 -11
- package/src/components/core/dropdown-menu/DropdownMenuRadioGroup.vue +12 -6
- package/src/components/core/dropdown-menu/DropdownMenuRadioItem.vue +38 -17
- package/src/components/core/dropdown-menu/DropdownMenuSeparator.vue +11 -11
- package/src/components/core/dropdown-menu/DropdownMenuShortcut.vue +8 -6
- package/src/components/core/dropdown-menu/DropdownMenuSub.vue +10 -6
- package/src/components/core/dropdown-menu/DropdownMenuSubContent.vue +14 -9
- package/src/components/core/dropdown-menu/DropdownMenuSubTrigger.vue +15 -12
- package/src/components/core/dropdown-menu/DropdownMenuTrigger.vue +8 -5
- package/src/components/core/field/Field.vue +8 -8
- package/src/components/core/field/FieldContent.vue +11 -6
- package/src/components/core/field/FieldDescription.vue +5 -5
- package/src/components/core/field/FieldError.vue +48 -38
- package/src/components/core/field/FieldGroup.vue +5 -5
- package/src/components/core/field/FieldLabel.vue +7 -7
- package/src/components/core/field/FieldLegend.vue +6 -6
- package/src/components/core/field/FieldSeparator.vue +10 -7
- package/src/components/core/field/FieldSet.vue +5 -5
- package/src/components/core/field/FieldTitle.vue +5 -5
- package/src/components/core/icon/Icon.vue +21 -21
- package/src/components/core/input/Input.vue +15 -15
- package/src/components/core/item/Item.vue +27 -22
- package/src/components/core/item/ItemActions.vue +9 -6
- package/src/components/core/item/ItemContent.vue +11 -6
- package/src/components/core/item/ItemDescription.vue +5 -5
- package/src/components/core/item/ItemFooter.vue +8 -6
- package/src/components/core/item/ItemGroup.vue +5 -5
- package/src/components/core/item/ItemHeader.vue +8 -6
- package/src/components/core/item/ItemMedia.vue +8 -8
- package/src/components/core/item/ItemSeparator.vue +12 -6
- package/src/components/core/item/ItemTitle.vue +11 -6
- package/src/components/core/item/index.ts +2 -1
- package/src/components/core/kbd/Kbd.vue +3 -3
- package/src/components/core/kbd/KbdGroup.vue +7 -4
- package/src/components/core/label/Label.vue +7 -7
- package/src/components/core/listbox/Listbox.vue +19 -13
- package/src/components/core/listbox/ListboxContent.vue +19 -12
- package/src/components/core/listbox/ListboxFilter.vue +14 -12
- package/src/components/core/listbox/ListboxGroup.vue +13 -11
- package/src/components/core/listbox/ListboxGroupLabel.vue +16 -12
- package/src/components/core/listbox/ListboxItem.vue +15 -13
- package/src/components/core/listbox/ListboxItemIndicator.vue +13 -11
- package/src/components/core/native-select/NativeSelect.vue +20 -20
- package/src/components/core/native-select/NativeSelectOptGroup.vue +9 -4
- package/src/components/core/native-select/NativeSelectOption.vue +9 -4
- package/src/components/core/navigation-menu/NavigationMenu.vue +17 -17
- package/src/components/core/navigation-menu/NavigationMenuContent.vue +10 -7
- package/src/components/core/navigation-menu/NavigationMenuIndicator.vue +9 -7
- package/src/components/core/navigation-menu/NavigationMenuItem.vue +5 -5
- package/src/components/core/navigation-menu/NavigationMenuLink.vue +7 -7
- package/src/components/core/navigation-menu/NavigationMenuList.vue +12 -7
- package/src/components/core/navigation-menu/NavigationMenuTrigger.vue +8 -8
- package/src/components/core/navigation-menu/NavigationMenuViewport.vue +6 -6
- package/src/components/core/popover/Popover.vue +9 -9
- package/src/components/core/popover/PopoverContent.vue +19 -19
- package/src/components/core/popover/PopoverTrigger.vue +2 -2
- package/src/components/core/progress/Progress.vue +12 -12
- package/src/components/core/radio-group/RadioGroup.vue +11 -9
- package/src/components/core/radio-group/RadioGroupItem.vue +10 -8
- package/src/components/core/range-calendar/RangeCalendar.vue +24 -22
- package/src/components/core/range-calendar/RangeCalendarCell.vue +10 -8
- package/src/components/core/range-calendar/RangeCalendarCellTrigger.vue +16 -14
- package/src/components/core/range-calendar/RangeCalendarGrid.vue +11 -9
- package/src/components/core/range-calendar/RangeCalendarGridBody.vue +3 -3
- package/src/components/core/range-calendar/RangeCalendarGridHead.vue +3 -3
- package/src/components/core/range-calendar/RangeCalendarGridRow.vue +10 -8
- package/src/components/core/range-calendar/RangeCalendarHeadCell.vue +16 -9
- package/src/components/core/range-calendar/RangeCalendarHeader.vue +13 -9
- package/src/components/core/range-calendar/RangeCalendarHeading.vue +13 -11
- package/src/components/core/range-calendar/RangeCalendarNextButton.vue +12 -10
- package/src/components/core/range-calendar/RangeCalendarPrevButton.vue +12 -10
- package/src/components/core/select/Select.vue +5 -5
- package/src/components/core/select/SelectContent.vue +23 -18
- package/src/components/core/select/SelectGroup.vue +3 -3
- package/src/components/core/select/SelectItem.vue +17 -10
- package/src/components/core/select/SelectItemText.vue +3 -3
- package/src/components/core/select/SelectLabel.vue +7 -5
- package/src/components/core/select/SelectScrollDownButton.vue +14 -10
- package/src/components/core/select/SelectScrollUpButton.vue +14 -10
- package/src/components/core/select/SelectSeparator.vue +9 -7
- package/src/components/core/select/SelectTrigger.vue +17 -14
- package/src/components/core/select/SelectValue.vue +3 -3
- package/src/components/core/separator/Separator.vue +11 -8
- package/src/components/core/sheet/Sheet.vue +5 -5
- package/src/components/core/sheet/SheetClose.vue +3 -3
- package/src/components/core/sheet/SheetContent.vue +24 -19
- package/src/components/core/sheet/SheetDescription.vue +5 -5
- package/src/components/core/sheet/SheetFooter.vue +5 -2
- package/src/components/core/sheet/SheetHeader.vue +5 -2
- package/src/components/core/sheet/SheetOverlay.vue +5 -5
- package/src/components/core/sheet/SheetTitle.vue +5 -5
- package/src/components/core/sheet/SheetTrigger.vue +3 -3
- package/src/components/core/sidebar/Sidebar.vue +22 -17
- package/src/components/core/sidebar/SidebarContent.vue +9 -9
- package/src/components/core/sidebar/SidebarFooter.vue +9 -9
- package/src/components/core/sidebar/SidebarGroup.vue +9 -9
- package/src/components/core/sidebar/SidebarGroupAction.vue +4 -4
- package/src/components/core/sidebar/SidebarGroupContent.vue +2 -2
- package/src/components/core/sidebar/SidebarGroupLabel.vue +3 -3
- package/src/components/core/sidebar/SidebarHeader.vue +9 -9
- package/src/components/core/sidebar/SidebarInput.vue +3 -3
- package/src/components/core/sidebar/SidebarInset.vue +2 -2
- package/src/components/core/sidebar/SidebarMenu.vue +13 -10
- package/src/components/core/sidebar/SidebarMenuAction.vue +7 -7
- package/src/components/core/sidebar/SidebarMenuBadge.vue +2 -2
- package/src/components/core/sidebar/SidebarMenuButton.vue +31 -24
- package/src/components/core/sidebar/SidebarMenuButtonChild.vue +19 -17
- package/src/components/core/sidebar/SidebarMenuItem.vue +2 -2
- package/src/components/core/sidebar/SidebarMenuSkeleton.vue +18 -12
- package/src/components/core/sidebar/SidebarMenuSub.vue +2 -2
- package/src/components/core/sidebar/SidebarMenuSubButton.vue +14 -14
- package/src/components/core/sidebar/SidebarMenuSubItem.vue +2 -2
- package/src/components/core/sidebar/SidebarProvider.vue +78 -66
- package/src/components/core/sidebar/SidebarRail.vue +4 -4
- package/src/components/core/sidebar/SidebarSeparator.vue +16 -11
- package/src/components/core/sidebar/SidebarTrigger.vue +9 -9
- package/src/components/core/sidebar/index.ts +7 -4
- package/src/components/core/sidebar/utils.ts +2 -1
- package/src/components/core/skeleton/Skeleton.vue +7 -4
- package/src/components/core/slider/Slider.vue +17 -9
- package/src/components/core/sonner/Sonner.vue +43 -0
- package/src/components/core/sonner/index.ts +1 -0
- package/src/components/core/spinner/Spinner.vue +6 -6
- package/src/components/core/stepper/Stepper.vue +16 -10
- package/src/components/core/stepper/StepperDescription.vue +10 -8
- package/src/components/core/stepper/StepperIndicator.vue +10 -8
- package/src/components/core/stepper/StepperItem.vue +16 -9
- package/src/components/core/stepper/StepperSeparator.vue +10 -8
- package/src/components/core/stepper/StepperTitle.vue +16 -9
- package/src/components/core/stepper/StepperTrigger.vue +16 -9
- package/src/components/core/switch/Switch.vue +13 -11
- package/src/components/core/table/Table.vue +9 -6
- package/src/components/core/table/TableBody.vue +9 -6
- package/src/components/core/table/TableCaption.vue +5 -5
- package/src/components/core/table/TableCell.vue +7 -7
- package/src/components/core/table/TableEmpty.vue +19 -14
- package/src/components/core/table/TableFooter.vue +8 -6
- package/src/components/core/table/TableHead.vue +8 -8
- package/src/components/core/table/TableHeader.vue +5 -5
- package/src/components/core/table/TableRow.vue +7 -7
- package/src/components/core/table/utils.ts +3 -1
- package/src/components/core/tabs/Tabs.vue +11 -9
- package/src/components/core/tabs/TabsContent.vue +9 -7
- package/src/components/core/tabs/TabsList.vue +10 -8
- package/src/components/core/tabs/TabsTrigger.vue +11 -9
- package/src/components/core/tags-input/TagsInput.vue +14 -12
- package/src/components/core/tags-input/TagsInputInput.vue +19 -12
- package/src/components/core/tags-input/TagsInputItem.vue +13 -11
- package/src/components/core/tags-input/TagsInputItemDelete.vue +13 -11
- package/src/components/core/tags-input/TagsInputItemText.vue +13 -11
- package/src/components/core/textarea/Textarea.vue +15 -15
- package/src/components/core/toggle/Toggle.vue +25 -20
- package/src/components/core/toggle/index.ts +1 -1
- package/src/components/core/toggle-group/ToggleGroup.vue +22 -22
- package/src/components/core/toggle-group/ToggleGroupItem.vue +14 -14
- package/src/components/core/toggle-group/index.ts +1 -1
- package/src/components/core/tooltip/Tooltip.vue +5 -5
- package/src/components/core/tooltip/TooltipContent.vue +17 -17
- package/src/components/core/tooltip/TooltipProvider.vue +3 -3
- package/src/components/core/tooltip/TooltipTrigger.vue +3 -3
- package/src/components/index.ts +1 -1
- package/src/directives/vHover.stories.ts +1 -1
- package/src/directives/vHover.ts +11 -4
- package/src/directives/vOverlay.ts +9 -2
- package/src/index.ts +3 -0
- package/src/patterns/UiDataTable/UiDataTable.mock.ts +13 -2
- package/src/patterns/UiDataTable/UiDataTable.stories.ts +89 -44
- package/src/patterns/UiDataTable/UiDataTable.vue +96 -78
- package/src/patterns/UiDataTable/UiDataTableColumnHeader.vue +57 -38
- package/src/patterns/UiDataTable/UiDataTablePagination.vue +46 -35
- package/src/patterns/UiDataTable/UiDataTableToolbar.vue +46 -38
- package/src/patterns/UiDataTable/__tests__/UiDataTable.test.ts +46 -13
- package/src/patterns/UiDataTable/__tests__/UiDataTableColumnHeader.test.ts +39 -13
- package/src/patterns/UiDataTable/__tests__/UiDataTablePagination.test.ts +15 -4
- package/src/patterns/UiDataTable/__tests__/UiDataTableToolbar.test.ts +34 -10
- package/src/patterns/UiDataTable/constants.ts +2 -1
- package/src/patterns/UiDataTable/types.ts +5 -1
- package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +10 -7
- package/src/patterns/UiDatePicker/UiDatePicker.vue +146 -123
- package/src/patterns/UiDatePicker/__tests__/UiDatePicker.test.ts +15 -7
- package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +2 -1
- package/src/patterns/UiFileUpload/UiFileUpload.vue +18 -18
- package/src/patterns/UiFileUpload/__tests__/UiFileUpload.test.ts +16 -5
- package/src/patterns/UiPlaceholder/UiPlaceholder.vue +3 -3
- package/src/patterns/UiSidebar/UiSidebar.stories.ts +27 -239
- package/src/patterns/UiSidebar/UiSidebar.vue +11 -11
- package/src/patterns/UiSidebar/UiSidebarContent.vue +4 -4
- package/src/patterns/UiSidebar/UiSidebarFooter.vue +4 -4
- package/src/patterns/UiSidebar/UiSidebarGroup.stories.ts +6 -8
- package/src/patterns/UiSidebar/UiSidebarGroup.vue +36 -34
- package/src/patterns/UiSidebar/UiSidebarGroupContent.vue +40 -40
- package/src/patterns/UiSidebar/UiSidebarGroupLabel.stories.ts +25 -15
- package/src/patterns/UiSidebar/UiSidebarGroupLabel.vue +103 -72
- package/src/patterns/UiSidebar/UiSidebarHeader.vue +22 -21
- package/src/patterns/UiSidebar/UiSidebarInset.vue +4 -4
- package/src/patterns/UiSidebar/UiSidebarMenu.vue +4 -4
- package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +35 -35
- package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +82 -71
- package/src/patterns/UiSidebar/UiSidebarMenuItem.stories.ts +11 -13
- package/src/patterns/UiSidebar/UiSidebarMenuItem.vue +4 -4
- package/src/patterns/UiSidebar/UiSidebarMenuSub.vue +27 -25
- package/src/patterns/UiSidebar/UiSidebarMenuSubItem.stories.ts +2 -1
- package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +46 -43
- package/src/patterns/UiSidebar/UiSidebarPopover.vue +16 -12
- package/src/patterns/UiSidebar/UiSidebarPopoverMenu.stories.ts +8 -9
- package/src/patterns/UiSidebar/UiSidebarPopoverMenu.vue +36 -29
- package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.stories.ts +8 -8
- package/src/patterns/UiSidebar/UiSidebarPopoverMenuItem.vue +56 -46
- package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.stories.ts +5 -4
- package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +45 -44
- package/src/patterns/UiSidebar/UiSidebarProvider.vue +4 -4
- package/src/patterns/UiSidebar/UiSidebarRail.vue +4 -4
- package/src/patterns/UiSidebar/UiSidebarSub.vue +42 -42
- package/src/patterns/UiSidebar/UiSidebarTrigger.vue +28 -23
- package/src/patterns/UiSidebar/__tests__/UiSidebar.test.ts +7 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarContent.test.ts +11 -3
- package/src/patterns/UiSidebar/__tests__/UiSidebarFooter.test.ts +14 -5
- package/src/patterns/UiSidebar/__tests__/UiSidebarGroup.test.ts +4 -1
- package/src/patterns/UiSidebar/__tests__/UiSidebarGroupContent.test.ts +4 -1
- package/src/patterns/UiSidebar/__tests__/UiSidebarHeader.test.ts +10 -4
- package/src/patterns/UiSidebar/__tests__/UiSidebarInset.test.ts +10 -4
- package/src/patterns/UiSidebar/__tests__/UiSidebarMenu.test.ts +7 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarMenuItem.test.ts +4 -1
- package/src/patterns/UiSidebar/__tests__/UiSidebarMenuSub.test.ts +4 -1
- package/src/patterns/UiSidebar/__tests__/UiSidebarMenuSubItem.test.ts +7 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarPopover.test.ts +4 -1
- package/src/patterns/UiSidebar/__tests__/UiSidebarPopoverMenu.test.ts +7 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarPopoverMenuItem.test.ts +10 -4
- package/src/patterns/UiSidebar/__tests__/UiSidebarPopoverTrigger.test.ts +9 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarProvider.test.ts +10 -3
- package/src/patterns/UiSidebar/__tests__/UiSidebarRail.test.ts +4 -1
- package/src/patterns/UiSidebar/__tests__/UiSidebarSub.test.ts +7 -2
- package/src/patterns/UiSidebar/__tests__/UiSidebarTrigger.test.ts +7 -2
- package/src/patterns/UiSidebar/activeIndicator.ts +1 -2
- package/src/patterns/UiSidebar/index.ts +0 -5
- package/src/patterns/UiSidebar/types.ts +1 -108
- package/src/templates/UiTemplatePlaceholder/UiTemplatePlaceholder.vue +3 -3
- package/src/theme/Background.stories.ts +5 -5
- package/src/theme/Border.stories.ts +3 -3
- package/src/theme/Extended.stories.ts +6 -6
- package/src/theme/Flex.stories.ts +10 -10
- package/src/theme/Grid.stories.ts +10 -10
- package/src/theme/HoverLayer.stories.ts +215 -0
- package/src/theme/Overlay.stories.ts +2 -2
- package/src/theme/Shadow.stories.ts +1 -1
- package/src/theme/Theme.stories.ts +4 -4
- package/src/theme/Typography.stories.ts +21 -21
- package/tokens.json +788 -90
- package/dist/system/components/UiIconButton/UiIconButton.vue.d.ts +0 -25
- package/dist/system/components/UiIconButton/index.d.ts +0 -7
- package/dist/system/components/UiIconButton/types.d.ts +0 -67
- package/dist/system/patterns/UiSidebar/UiSidebarChatHistory.vue.d.ts +0 -20
- package/dist/system/patterns/UiSidebar/UiSidebarChatHistoryItem.vue.d.ts +0 -34
- package/docs/public-docs/index.md +0 -5
- package/docs/public-docs/standards-guidelines.md +0 -15
- package/src/components/UiIconButton/UiIconButton.stories.ts +0 -462
- package/src/components/UiIconButton/UiIconButton.vue +0 -72
- package/src/components/UiIconButton/__tests__/UiIconButton.test.ts +0 -95
- package/src/components/UiIconButton/index.ts +0 -13
- package/src/components/UiIconButton/types.ts +0 -83
- package/src/patterns/UiSidebar/UiSidebarChatHistory.stories.ts +0 -92
- package/src/patterns/UiSidebar/UiSidebarChatHistory.vue +0 -35
- package/src/patterns/UiSidebar/UiSidebarChatHistoryItem.stories.ts +0 -201
- package/src/patterns/UiSidebar/UiSidebarChatHistoryItem.vue +0 -245
- package/src/patterns/UiSidebar/__tests__/UiSidebarChatHistory.test.ts +0 -29
- package/src/patterns/UiSidebar/__tests__/UiSidebarChatHistoryItem.test.ts +0 -49
- package/src/theme/BackgroundHover.stories.ts +0 -174
- package/src/theme/ContentHover.stories.ts +0 -165
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, ref, useAttrs, useSlots, watch } from 'vue';
|
|
3
|
-
import { MoreVertical } from 'lucide-vue-next';
|
|
4
|
-
import { Primitive } from 'reka-ui';
|
|
5
|
-
import { Popover, PopoverContent, PopoverTrigger } from '@/components/core/popover';
|
|
6
|
-
import { UiTooltip } from '@/components/UiTooltip';
|
|
7
|
-
import { cn } from '@/lib/utils';
|
|
8
|
-
import { SIDEBAR_ACTIVE_INDICATOR_CLASS } from './activeIndicator';
|
|
9
|
-
import type { UiSidebarChatHistoryItemEmits, UiSidebarChatHistoryItemProps } from './types';
|
|
10
|
-
|
|
11
|
-
defineOptions({
|
|
12
|
-
name: 'UiSidebarChatHistoryItem',
|
|
13
|
-
inheritAttrs: false,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const emit = defineEmits<UiSidebarChatHistoryItemEmits>();
|
|
17
|
-
|
|
18
|
-
const props = withDefaults(defineProps<UiSidebarChatHistoryItemProps>(), {
|
|
19
|
-
as: 'button',
|
|
20
|
-
isActive: false,
|
|
21
|
-
showAction: true,
|
|
22
|
-
showActionOnHover: true,
|
|
23
|
-
actionTooltip: '',
|
|
24
|
-
actionAriaLabel: 'History item action',
|
|
25
|
-
actionPopover: false,
|
|
26
|
-
actionPopoverSide: 'right',
|
|
27
|
-
actionPopoverAlign: 'start',
|
|
28
|
-
actionPopoverSideOffset: 8,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const attrs = useAttrs();
|
|
32
|
-
const slots = useSlots();
|
|
33
|
-
|
|
34
|
-
const resolvedActionIcon = computed(() => props.actionIcon ?? MoreVertical);
|
|
35
|
-
const hasMeta = computed(() => Boolean(props.metaStart || props.metaEnd || slots.meta));
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* When true, pointer/focus is in the action column. The row-level hover
|
|
39
|
-
* tint is suppressed so the icon's own hover-mix tint + outlined border
|
|
40
|
-
* don't stack on top of it.
|
|
41
|
-
*/
|
|
42
|
-
const pointerOnAction = ref(false);
|
|
43
|
-
|
|
44
|
-
function onActionPointerEnter() {
|
|
45
|
-
pointerOnAction.value = true;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function onActionPointerLeave() {
|
|
49
|
-
pointerOnAction.value = false;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function onActionFocusIn() {
|
|
53
|
-
pointerOnAction.value = true;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function onActionFocusOut() {
|
|
57
|
-
pointerOnAction.value = false;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
watch(
|
|
61
|
-
() => props.showAction,
|
|
62
|
-
(show) => {
|
|
63
|
-
if (!show) {
|
|
64
|
-
pointerOnAction.value = false;
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const containerClass = computed(() =>
|
|
70
|
-
cn(
|
|
71
|
-
'group/sidebar-chat-history-item relative flex w-full min-w-0 items-stretch gap-2 rounded-md border border-transparent px-2 py-1.5 transition-colors group-data-[collapsible=icon]:hidden',
|
|
72
|
-
hasMeta.value ? 'h-12' : 'h-10',
|
|
73
|
-
// Whole-row focus ring: first tab lands on the main row control; second tab on the action button — both are inside this container.
|
|
74
|
-
// `:has(:focus-visible)` instead of `:focus-within` so mouse clicks on the row don't flash a keyboard focus ring.
|
|
75
|
-
'has-[:focus-visible]:border-border-surface-focus-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50',
|
|
76
|
-
// Row hover/active tint — flat `default` hover-mix color. Hover is suppressed while the
|
|
77
|
-
// pointer/focus is on the action column so the icon's own tint does not stack on top.
|
|
78
|
-
props.isActive && 'bg-background-surface-primary-hover-default',
|
|
79
|
-
!pointerOnAction.value && 'hover:bg-background-surface-primary-hover-default',
|
|
80
|
-
SIDEBAR_ACTIVE_INDICATOR_CLASS,
|
|
81
|
-
),
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
const itemClass = computed(() =>
|
|
85
|
-
cn(
|
|
86
|
-
'text-left outline-hidden transition-colors',
|
|
87
|
-
'body-14-regular text-content-on-surface-primary',
|
|
88
|
-
'!hover:bg-transparent !active:bg-transparent',
|
|
89
|
-
// Suppress a second ring on the primary control; the row ring is on the outer container.
|
|
90
|
-
'focus-visible:ring-0 focus-visible:outline-none',
|
|
91
|
-
'data-[active=true]:text-content-on-surface-primary',
|
|
92
|
-
// Stretched-link: extend the primary control's hit area to cover the full row
|
|
93
|
-
// container (including its `px-2 py-1.5` padding and the gap before the action
|
|
94
|
-
// column) so clicks anywhere on the row activate the item. The action button
|
|
95
|
-
// stays interactive because it comes later in the DOM and is `relative`.
|
|
96
|
-
'before:content-[""] before:absolute before:inset-0 before:z-0',
|
|
97
|
-
attrs.class as string | undefined,
|
|
98
|
-
),
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Wrapper column that owns the action button and the `pointerenter` /
|
|
103
|
-
* `pointerleave` hit area driving `pointerOnAction`. Uses `self-stretch` so
|
|
104
|
-
* the full row height reports pointer-enter on the column (not just the
|
|
105
|
-
* 32×32 button), and — when `showActionOnHover` is true — hides the inner
|
|
106
|
-
* button with `opacity-0` until the row is hovered or keyboard focus lands
|
|
107
|
-
* anywhere inside it.
|
|
108
|
-
*/
|
|
109
|
-
const actionColumnClass = computed(() =>
|
|
110
|
-
cn(
|
|
111
|
-
'ml-auto flex shrink-0 items-center self-stretch ',
|
|
112
|
-
props.showActionOnHover &&
|
|
113
|
-
'[&_button]:opacity-0 [&_button]:transition-opacity group-hover/sidebar-chat-history-item:[&_button]:opacity-100 group-focus-within/sidebar-chat-history-item:[&_button]:opacity-100',
|
|
114
|
-
),
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Action control: same `default` hover-mix tint as the row, plus the
|
|
119
|
-
* `border/button/outlined` token so the icon picks up a visible outline on
|
|
120
|
-
* hover/focus (mirrors the outline button variant). Applied only while
|
|
121
|
-
* pointer/focus is on the action column so the row tint does not stack
|
|
122
|
-
* underneath the icon.
|
|
123
|
-
*/
|
|
124
|
-
const actionButtonClass = computed(() =>
|
|
125
|
-
cn(
|
|
126
|
-
'relative z-10 inline-flex size-8 shrink-0 items-center justify-center rounded-sm border border-transparent text-content-on-surface-primary outline-hidden transition-colors',
|
|
127
|
-
'[&_svg]:size-4 [&_svg]:shrink-0',
|
|
128
|
-
'focus-visible:ring-0 focus-visible:outline-none',
|
|
129
|
-
pointerOnAction.value &&
|
|
130
|
-
'bg-background-surface-primary-hover-default border-border-button-outlined',
|
|
131
|
-
),
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
const actionPopoverPanelClass = computed(() =>
|
|
135
|
-
// Sidebar popover surface is `background/surface/secondary`; override the
|
|
136
|
-
// core popover's default `floating` background so the outer frame matches
|
|
137
|
-
// the `UiSidebarPopoverMenu` it hosts.
|
|
138
|
-
cn(
|
|
139
|
-
'w-auto min-w-48 max-w-sm p-0 bg-background-surface-secondary',
|
|
140
|
-
props.actionPopoverContentClass,
|
|
141
|
-
),
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
const passthroughAttrs = computed(() => {
|
|
145
|
-
const { class: _class, ...rest } = attrs as Record<string, unknown>;
|
|
146
|
-
return rest;
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
function onActionClick(event: MouseEvent) {
|
|
150
|
-
event.stopPropagation();
|
|
151
|
-
const el = event.currentTarget;
|
|
152
|
-
if (el instanceof HTMLElement && el.focus) {
|
|
153
|
-
queueMicrotask(() => el.focus({ preventScroll: true }));
|
|
154
|
-
}
|
|
155
|
-
if (!props.actionPopover) {
|
|
156
|
-
// Public kebab-case event preserved for backwards compatibility.
|
|
157
|
-
// eslint-disable-next-line vue/custom-event-name-casing
|
|
158
|
-
emit('action-click', event);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
</script>
|
|
162
|
-
|
|
163
|
-
<template>
|
|
164
|
-
<div :data-active="props.isActive" :class="containerClass">
|
|
165
|
-
<Primitive
|
|
166
|
-
v-bind="passthroughAttrs"
|
|
167
|
-
:as="props.as"
|
|
168
|
-
:as-child="props.asChild"
|
|
169
|
-
:data-active="props.isActive"
|
|
170
|
-
:class="cn(itemClass, 'flex min-w-0 flex-1 items-center')"
|
|
171
|
-
>
|
|
172
|
-
<div class="min-w-0 flex-1">
|
|
173
|
-
<div class="truncate body-14-regular text-content-on-surface-primary">
|
|
174
|
-
{{ props.title }}
|
|
175
|
-
</div>
|
|
176
|
-
|
|
177
|
-
<div
|
|
178
|
-
v-if="props.metaStart || props.metaEnd || $slots.meta"
|
|
179
|
-
class="mt-0.5 flex min-w-0 items-center gap-1 label-12-medium text-content-on-surface-muted"
|
|
180
|
-
>
|
|
181
|
-
<slot name="meta">
|
|
182
|
-
<span v-if="props.metaStart" class="truncate">{{ props.metaStart }}</span>
|
|
183
|
-
<span v-if="props.metaStart && props.metaEnd" aria-hidden="true">|</span>
|
|
184
|
-
<span v-if="props.metaEnd" class="truncate">{{ props.metaEnd }}</span>
|
|
185
|
-
</slot>
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
</Primitive>
|
|
189
|
-
|
|
190
|
-
<div
|
|
191
|
-
v-if="props.showAction"
|
|
192
|
-
:class="actionColumnClass"
|
|
193
|
-
@pointerenter="onActionPointerEnter"
|
|
194
|
-
@pointerleave="onActionPointerLeave"
|
|
195
|
-
>
|
|
196
|
-
<Popover v-if="props.actionPopover">
|
|
197
|
-
<PopoverTrigger as-child>
|
|
198
|
-
<button
|
|
199
|
-
type="button"
|
|
200
|
-
:aria-label="props.actionAriaLabel"
|
|
201
|
-
:aria-haspopup="'dialog'"
|
|
202
|
-
:class="actionButtonClass"
|
|
203
|
-
@focusin="onActionFocusIn"
|
|
204
|
-
@focusout="onActionFocusOut"
|
|
205
|
-
@click.stop="onActionClick"
|
|
206
|
-
>
|
|
207
|
-
<component :is="resolvedActionIcon" :size="16" />
|
|
208
|
-
</button>
|
|
209
|
-
</PopoverTrigger>
|
|
210
|
-
<PopoverContent
|
|
211
|
-
:side="props.actionPopoverSide"
|
|
212
|
-
:align="props.actionPopoverAlign"
|
|
213
|
-
:side-offset="props.actionPopoverSideOffset"
|
|
214
|
-
:class="actionPopoverPanelClass"
|
|
215
|
-
>
|
|
216
|
-
<slot name="action-popover" />
|
|
217
|
-
</PopoverContent>
|
|
218
|
-
</Popover>
|
|
219
|
-
|
|
220
|
-
<UiTooltip v-else-if="props.actionTooltip" :content="props.actionTooltip" side="right">
|
|
221
|
-
<button
|
|
222
|
-
type="button"
|
|
223
|
-
:aria-label="props.actionAriaLabel"
|
|
224
|
-
:class="actionButtonClass"
|
|
225
|
-
@focusin="onActionFocusIn"
|
|
226
|
-
@focusout="onActionFocusOut"
|
|
227
|
-
@click.stop="onActionClick"
|
|
228
|
-
>
|
|
229
|
-
<component :is="resolvedActionIcon" :size="16" />
|
|
230
|
-
</button>
|
|
231
|
-
</UiTooltip>
|
|
232
|
-
<button
|
|
233
|
-
v-else
|
|
234
|
-
type="button"
|
|
235
|
-
:aria-label="props.actionAriaLabel"
|
|
236
|
-
:class="actionButtonClass"
|
|
237
|
-
@focusin="onActionFocusIn"
|
|
238
|
-
@focusout="onActionFocusOut"
|
|
239
|
-
@click.stop="onActionClick"
|
|
240
|
-
>
|
|
241
|
-
<component :is="resolvedActionIcon" :size="16" />
|
|
242
|
-
</button>
|
|
243
|
-
</div>
|
|
244
|
-
</div>
|
|
245
|
-
</template>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/vue';
|
|
2
|
-
import { describe, expect, test, beforeEach, afterEach, vi } from 'vitest';
|
|
3
|
-
import UiSidebarChatHistory from '../UiSidebarChatHistory.vue';
|
|
4
|
-
import { createSidebarShell, mockMatchMediaDesktop } from './sidebar-test-helpers';
|
|
5
|
-
|
|
6
|
-
beforeEach(() => mockMatchMediaDesktop());
|
|
7
|
-
afterEach(() => vi.restoreAllMocks());
|
|
8
|
-
|
|
9
|
-
describe('UiSidebarChatHistory', () => {
|
|
10
|
-
test('sets data-slot and optional gap class', () => {
|
|
11
|
-
const { container: withGap } = render(
|
|
12
|
-
createSidebarShell('<UiSidebarChatHistory><span>x</span></UiSidebarChatHistory>', {
|
|
13
|
-
UiSidebarChatHistory,
|
|
14
|
-
}),
|
|
15
|
-
);
|
|
16
|
-
const root = withGap.querySelector('[data-slot="sidebar-chat-history"]');
|
|
17
|
-
expect(root).toBeTruthy();
|
|
18
|
-
expect(root?.className).toMatch(/gap-1/);
|
|
19
|
-
|
|
20
|
-
const { container: noGap } = render(
|
|
21
|
-
createSidebarShell(
|
|
22
|
-
'<UiSidebarChatHistory :with-gap="false"><span>y</span></UiSidebarChatHistory>',
|
|
23
|
-
{ UiSidebarChatHistory },
|
|
24
|
-
),
|
|
25
|
-
);
|
|
26
|
-
const root2 = noGap.querySelector('[data-slot="sidebar-chat-history"]');
|
|
27
|
-
expect(root2?.className).not.toMatch(/gap-1/);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/vue';
|
|
2
|
-
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import { defineComponent } from 'vue';
|
|
4
|
-
import { describe, expect, test, beforeEach, afterEach, vi } from 'vitest';
|
|
5
|
-
import UiSidebar from '../UiSidebar.vue';
|
|
6
|
-
import UiSidebarChatHistoryItem from '../UiSidebarChatHistoryItem.vue';
|
|
7
|
-
import UiSidebarContent from '../UiSidebarContent.vue';
|
|
8
|
-
import UiSidebarProvider from '../UiSidebarProvider.vue';
|
|
9
|
-
import { mockMatchMediaDesktop } from './sidebar-test-helpers';
|
|
10
|
-
|
|
11
|
-
beforeEach(() => mockMatchMediaDesktop());
|
|
12
|
-
afterEach(() => vi.restoreAllMocks());
|
|
13
|
-
|
|
14
|
-
describe('UiSidebarChatHistoryItem', () => {
|
|
15
|
-
test('renders title and emits action-click', async () => {
|
|
16
|
-
const user = userEvent.setup();
|
|
17
|
-
const onAction = vi.fn();
|
|
18
|
-
const Harness = defineComponent({
|
|
19
|
-
components: {
|
|
20
|
-
UiSidebarProvider,
|
|
21
|
-
UiSidebar,
|
|
22
|
-
UiSidebarContent,
|
|
23
|
-
UiSidebarChatHistoryItem,
|
|
24
|
-
},
|
|
25
|
-
setup() {
|
|
26
|
-
return { onAction };
|
|
27
|
-
},
|
|
28
|
-
template: `
|
|
29
|
-
<UiSidebarProvider :default-open="true">
|
|
30
|
-
<UiSidebar collapsible="none" class="min-h-32">
|
|
31
|
-
<UiSidebarContent>
|
|
32
|
-
<UiSidebarChatHistoryItem
|
|
33
|
-
title="Thread A"
|
|
34
|
-
meta-start="Mon"
|
|
35
|
-
:show-action-on-hover="false"
|
|
36
|
-
action-aria-label="More"
|
|
37
|
-
@action-click="onAction"
|
|
38
|
-
/>
|
|
39
|
-
</UiSidebarContent>
|
|
40
|
-
</UiSidebar>
|
|
41
|
-
</UiSidebarProvider>
|
|
42
|
-
`,
|
|
43
|
-
});
|
|
44
|
-
const { getByText, getByRole } = render(Harness);
|
|
45
|
-
expect(getByText('Thread A')).toBeInTheDocument();
|
|
46
|
-
await user.click(getByRole('button', { name: 'More' }));
|
|
47
|
-
expect(onAction).toHaveBeenCalledTimes(1);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
-
import { defineComponent, h } from 'vue';
|
|
3
|
-
|
|
4
|
-
const ThemePlaceholder = defineComponent({
|
|
5
|
-
name: 'ThemePlaceholder',
|
|
6
|
-
render() {
|
|
7
|
-
return h('div');
|
|
8
|
-
},
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const meta: Meta<typeof ThemePlaceholder> = {
|
|
12
|
-
title: 'CSS utility/Background Hover',
|
|
13
|
-
component: ThemePlaceholder,
|
|
14
|
-
tags: ['autodocs'],
|
|
15
|
-
parameters: {
|
|
16
|
-
layout: 'fullscreen',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default meta;
|
|
21
|
-
type Story = StoryObj<typeof ThemePlaceholder>;
|
|
22
|
-
|
|
23
|
-
const HOVER_VARIANTS = ['subtle', 'default', 'strong'] as const;
|
|
24
|
-
type HoverVariant = (typeof HOVER_VARIANTS)[number];
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Given a base background utility class (e.g. `bg-background-surface-primary`)
|
|
28
|
-
* return the utility class that renders the solid color for a given hover
|
|
29
|
-
* variant. Classes are generated by `hover-mix.js` + `config.js` and backed by
|
|
30
|
-
* the CSS variable `--<bg>-hover-<variant>`.
|
|
31
|
-
* @param bgClass
|
|
32
|
-
* @param variant
|
|
33
|
-
*/
|
|
34
|
-
const getHoverMixClass = (bgClass: string, variant: HoverVariant): string =>
|
|
35
|
-
`${bgClass}-hover-${variant}`;
|
|
36
|
-
|
|
37
|
-
/** Background tokens to preview, mirroring the Background.stories.ts layout. */
|
|
38
|
-
const BG_GROUPS: Array<{ title: string; description: string; tokens: string[] }> = [
|
|
39
|
-
{
|
|
40
|
-
title: 'Surface',
|
|
41
|
-
description: 'Base and sheet-level surfaces composited with the three hover overlay tiers.',
|
|
42
|
-
tokens: [
|
|
43
|
-
'bg-background-surface-primary',
|
|
44
|
-
'bg-background-surface-secondary',
|
|
45
|
-
'bg-background-surface-muted',
|
|
46
|
-
'bg-background-surface-selected',
|
|
47
|
-
'bg-background-surface-inverse',
|
|
48
|
-
'bg-background-surface-modal',
|
|
49
|
-
'bg-background-surface-floating',
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
title: 'Button',
|
|
54
|
-
description: 'Button backgrounds composited with the three hover overlay tiers.',
|
|
55
|
-
tokens: [
|
|
56
|
-
'bg-background-button-primary-button',
|
|
57
|
-
'bg-background-button-secondary-button',
|
|
58
|
-
'bg-background-button-danger-button',
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
title: 'Accent',
|
|
63
|
-
description: 'Accent backgrounds composited with the three hover overlay tiers.',
|
|
64
|
-
tokens: ['bg-background-accent-default', 'bg-background-accent-soft'],
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
title: 'Input',
|
|
68
|
-
description: 'Input backgrounds composited with the three hover overlay tiers.',
|
|
69
|
-
tokens: ['bg-background-input-default'],
|
|
70
|
-
},
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
const copyScript = `
|
|
74
|
-
function copyToClipboard(text, el) {
|
|
75
|
-
navigator.clipboard.writeText(text).then(() => {
|
|
76
|
-
el.classList.add('copied');
|
|
77
|
-
setTimeout(() => el.classList.remove('copied'), 1500);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
|
-
const renderSwatch = (className: string): string => `
|
|
83
|
-
<div class="w-12 h-12 rounded-md border border-border-surface-default ${className}"></div>
|
|
84
|
-
`;
|
|
85
|
-
|
|
86
|
-
const renderCopyCode = (text: string): string => `
|
|
87
|
-
<code
|
|
88
|
-
class="copy-btn label-12-regular text-content-on-surface-muted inline-block px-1 py-0.5 rounded"
|
|
89
|
-
onclick="copyToClipboard('${text}', this)"
|
|
90
|
-
>${text}</code>
|
|
91
|
-
`;
|
|
92
|
-
|
|
93
|
-
const renderTokenRow = (bgClass: string): string => {
|
|
94
|
-
const variantCells = HOVER_VARIANTS.map((variant) => {
|
|
95
|
-
const mixedClass = getHoverMixClass(bgClass, variant);
|
|
96
|
-
return `
|
|
97
|
-
<td class="p-3 align-middle">
|
|
98
|
-
<div class="flex items-center gap-3">
|
|
99
|
-
${renderSwatch(mixedClass)}
|
|
100
|
-
${renderCopyCode(mixedClass)}
|
|
101
|
-
</div>
|
|
102
|
-
</td>
|
|
103
|
-
`;
|
|
104
|
-
}).join('');
|
|
105
|
-
|
|
106
|
-
return `
|
|
107
|
-
<tr class="border-b border-border-surface-default last:border-b-0">
|
|
108
|
-
<td class="p-3 align-middle">${renderSwatch(bgClass)}</td>
|
|
109
|
-
<td class="p-3 align-middle">${renderCopyCode(bgClass)}</td>
|
|
110
|
-
${variantCells}
|
|
111
|
-
</tr>
|
|
112
|
-
`;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const renderGroup = (group: (typeof BG_GROUPS)[number]): string => `
|
|
116
|
-
<div class="mb-10">
|
|
117
|
-
<h3 class="body-14-bold text-content-on-surface-primary mb-1">${group.title}</h3>
|
|
118
|
-
<p class="label-12-regular text-content-on-surface-muted mb-3">${group.description}</p>
|
|
119
|
-
<div class="overflow-x-auto">
|
|
120
|
-
<table class="w-full border-collapse text-left">
|
|
121
|
-
<thead>
|
|
122
|
-
<tr class="border-b border-border-surface-default">
|
|
123
|
-
<th class="p-3 label-12-medium text-content-on-surface-muted font-medium w-20">Base</th>
|
|
124
|
-
<th class="p-3 label-12-medium text-content-on-surface-muted font-medium">Token</th>
|
|
125
|
-
<th class="p-3 label-12-medium text-content-on-surface-muted font-medium">Subtle</th>
|
|
126
|
-
<th class="p-3 label-12-medium text-content-on-surface-muted font-medium">Default</th>
|
|
127
|
-
<th class="p-3 label-12-medium text-content-on-surface-muted font-medium">Strong</th>
|
|
128
|
-
</tr>
|
|
129
|
-
</thead>
|
|
130
|
-
<tbody>
|
|
131
|
-
${group.tokens.map(renderTokenRow).join('')}
|
|
132
|
-
</tbody>
|
|
133
|
-
</table>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
`;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Preview of every background token composited with each hover overlay tier
|
|
140
|
-
* (`subtle`, `default`, `strong`). Each swatch is a genuine, flat color
|
|
141
|
-
* generated at build time by the hover-mix utility in
|
|
142
|
-
* `@aleph-alpha/ui-library/hover-mix`, and rendered via the corresponding
|
|
143
|
-
* utility class (e.g. `bg-background-surface-primary-hover-subtle`).
|
|
144
|
-
*/
|
|
145
|
-
export const All: Story = {
|
|
146
|
-
render: () => ({
|
|
147
|
-
template: `
|
|
148
|
-
<div class="p-8 bg-white dark:bg-background min-h-screen">
|
|
149
|
-
<style>
|
|
150
|
-
.copy-btn { cursor: pointer; transition: all 0.15s; }
|
|
151
|
-
.copy-btn:hover { background: rgba(0,0,0,0.05); }
|
|
152
|
-
.copy-btn.copied { background: #22c55e22; }
|
|
153
|
-
.copy-btn.copied::after { content: ' ✓'; color: #22c55e; }
|
|
154
|
-
</style>
|
|
155
|
-
<script>${copyScript}</script>
|
|
156
|
-
|
|
157
|
-
<div class="mb-6">
|
|
158
|
-
<h2 class="heading-s text-content-on-surface-primary mb-1">Background Hover</h2>
|
|
159
|
-
<p class="body-14-regular text-content-on-surface-muted">
|
|
160
|
-
For each background token, the three swatches show the flat color produced by the
|
|
161
|
-
hover-mix formula (alpha compositing) combining the base with
|
|
162
|
-
<code class="label-12-medium">overlay-hover-subtle</code>,
|
|
163
|
-
<code class="label-12-medium">overlay-hover-default</code> and
|
|
164
|
-
<code class="label-12-medium">overlay-hover-strong</code>.
|
|
165
|
-
Class names take the form <code class="label-12-medium">bg-<token>-hover-<variant></code>.
|
|
166
|
-
Click a label to copy.
|
|
167
|
-
</p>
|
|
168
|
-
</div>
|
|
169
|
-
|
|
170
|
-
${BG_GROUPS.map(renderGroup).join('')}
|
|
171
|
-
</div>
|
|
172
|
-
`,
|
|
173
|
-
}),
|
|
174
|
-
};
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
2
|
-
import { defineComponent, h } from 'vue';
|
|
3
|
-
|
|
4
|
-
const ThemePlaceholder = defineComponent({
|
|
5
|
-
name: 'ThemePlaceholder',
|
|
6
|
-
render() {
|
|
7
|
-
return h('div');
|
|
8
|
-
},
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const meta: Meta<typeof ThemePlaceholder> = {
|
|
12
|
-
title: 'CSS utility/Content Hover',
|
|
13
|
-
component: ThemePlaceholder,
|
|
14
|
-
tags: ['autodocs'],
|
|
15
|
-
parameters: {
|
|
16
|
-
layout: 'fullscreen',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default meta;
|
|
21
|
-
type Story = StoryObj<typeof ThemePlaceholder>;
|
|
22
|
-
|
|
23
|
-
const HOVER_VARIANTS = ['subtle', 'default', 'strong'] as const;
|
|
24
|
-
type HoverVariant = (typeof HOVER_VARIANTS)[number];
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Given a base text utility class (e.g. `text-content-on-surface-primary`),
|
|
28
|
-
* return the utility class that renders the text color for a given hover
|
|
29
|
-
* variant. Classes are generated by `hover-mix.js` + `config.js` and backed by
|
|
30
|
-
* the CSS variable `--<token>-hover-<variant>`.
|
|
31
|
-
* @param textClass
|
|
32
|
-
* @param variant
|
|
33
|
-
*/
|
|
34
|
-
const getHoverMixClass = (textClass: string, variant: HoverVariant): string =>
|
|
35
|
-
`${textClass}-hover-${variant}`;
|
|
36
|
-
|
|
37
|
-
/** Content/text tokens to preview, mirroring the `Content` story layout. */
|
|
38
|
-
const CONTENT_GROUPS: Array<{ title: string; description: string; tokens: string[] }> = [
|
|
39
|
-
{
|
|
40
|
-
title: 'On Surface',
|
|
41
|
-
description: 'Text colors on surface backgrounds composited with the three hover tiers.',
|
|
42
|
-
tokens: [
|
|
43
|
-
'text-content-on-surface-primary',
|
|
44
|
-
'text-content-on-surface-secondary',
|
|
45
|
-
'text-content-on-surface-muted',
|
|
46
|
-
'text-content-on-surface-inverse',
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
title: 'On Button',
|
|
51
|
-
description: 'Text colors used inside buttons, composited with the three hover tiers.',
|
|
52
|
-
tokens: [
|
|
53
|
-
'text-content-on-button-primary-button',
|
|
54
|
-
'text-content-on-button-secondary-button',
|
|
55
|
-
'text-content-on-button-danger-button',
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
title: 'On Accent',
|
|
60
|
-
description: 'Text colors paired with accent backgrounds.',
|
|
61
|
-
tokens: ['text-content-on-accent-default', 'text-content-on-accent-soft'],
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
const copyScript = `
|
|
66
|
-
function copyToClipboard(text, el) {
|
|
67
|
-
navigator.clipboard.writeText(text).then(() => {
|
|
68
|
-
el.classList.add('copied');
|
|
69
|
-
setTimeout(() => el.classList.remove('copied'), 1500);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
|
-
const renderSample = (className: string): string => `
|
|
75
|
-
<span class="body-14-medium ${className}">Aa</span>
|
|
76
|
-
`;
|
|
77
|
-
|
|
78
|
-
const renderCopyCode = (text: string): string => `
|
|
79
|
-
<code
|
|
80
|
-
class="copy-btn label-12-regular text-content-on-surface-muted inline-block px-1 py-0.5 rounded"
|
|
81
|
-
onclick="copyToClipboard('${text}', this)"
|
|
82
|
-
>${text}</code>
|
|
83
|
-
`;
|
|
84
|
-
|
|
85
|
-
const renderTokenRow = (textClass: string): string => {
|
|
86
|
-
const variantCells = HOVER_VARIANTS.map((variant) => {
|
|
87
|
-
const mixedClass = getHoverMixClass(textClass, variant);
|
|
88
|
-
return `
|
|
89
|
-
<td class="p-3 align-middle">
|
|
90
|
-
<div class="flex items-center gap-3">
|
|
91
|
-
${renderSample(mixedClass)}
|
|
92
|
-
${renderCopyCode(mixedClass)}
|
|
93
|
-
</div>
|
|
94
|
-
</td>
|
|
95
|
-
`;
|
|
96
|
-
}).join('');
|
|
97
|
-
|
|
98
|
-
return `
|
|
99
|
-
<tr class="border-b border-border-surface-default last:border-b-0">
|
|
100
|
-
<td class="p-3 align-middle">${renderSample(textClass)}</td>
|
|
101
|
-
<td class="p-3 align-middle">${renderCopyCode(textClass)}</td>
|
|
102
|
-
${variantCells}
|
|
103
|
-
</tr>
|
|
104
|
-
`;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const renderGroup = (group: (typeof CONTENT_GROUPS)[number]): string => `
|
|
108
|
-
<div class="mb-10">
|
|
109
|
-
<h3 class="body-14-bold text-content-on-surface-primary mb-1">${group.title}</h3>
|
|
110
|
-
<p class="label-12-regular text-content-on-surface-muted mb-3">${group.description}</p>
|
|
111
|
-
<div class="overflow-x-auto">
|
|
112
|
-
<table class="w-full border-collapse text-left">
|
|
113
|
-
<thead>
|
|
114
|
-
<tr class="border-b border-border-surface-default">
|
|
115
|
-
<th class="p-3 label-12-medium text-content-on-surface-muted font-medium w-20">Base</th>
|
|
116
|
-
<th class="p-3 label-12-medium text-content-on-surface-muted font-medium">Token</th>
|
|
117
|
-
<th class="p-3 label-12-medium text-content-on-surface-muted font-medium">Subtle</th>
|
|
118
|
-
<th class="p-3 label-12-medium text-content-on-surface-muted font-medium">Default</th>
|
|
119
|
-
<th class="p-3 label-12-medium text-content-on-surface-muted font-medium">Strong</th>
|
|
120
|
-
</tr>
|
|
121
|
-
</thead>
|
|
122
|
-
<tbody>
|
|
123
|
-
${group.tokens.map(renderTokenRow).join('')}
|
|
124
|
-
</tbody>
|
|
125
|
-
</table>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
`;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Preview of every content (text) token composited with each hover overlay
|
|
132
|
-
* tier (`subtle`, `default`, `strong`). Classes are produced by the same
|
|
133
|
-
* hover-mix utility that backs the background variants, and are the
|
|
134
|
-
* recommended replacement for the deprecated `v-hover` directive on text.
|
|
135
|
-
*/
|
|
136
|
-
export const All: Story = {
|
|
137
|
-
render: () => ({
|
|
138
|
-
template: `
|
|
139
|
-
<div class="p-8 bg-white dark:bg-background min-h-screen">
|
|
140
|
-
<style>
|
|
141
|
-
.copy-btn { cursor: pointer; transition: all 0.15s; }
|
|
142
|
-
.copy-btn:hover { background: rgba(0,0,0,0.05); }
|
|
143
|
-
.copy-btn.copied { background: #22c55e22; }
|
|
144
|
-
.copy-btn.copied::after { content: ' ✓'; color: #22c55e; }
|
|
145
|
-
</style>
|
|
146
|
-
<script>${copyScript}</script>
|
|
147
|
-
|
|
148
|
-
<div class="mb-6">
|
|
149
|
-
<h2 class="heading-s text-content-on-surface-primary mb-1">Content Hover</h2>
|
|
150
|
-
<p class="body-14-regular text-content-on-surface-muted">
|
|
151
|
-
For each content/text token, the three samples show the flat color produced by the
|
|
152
|
-
hover-mix formula combining the base with
|
|
153
|
-
<code class="label-12-medium">overlay-hover-subtle</code>,
|
|
154
|
-
<code class="label-12-medium">overlay-hover-default</code> and
|
|
155
|
-
<code class="label-12-medium">overlay-hover-strong</code>.
|
|
156
|
-
Class names take the form <code class="label-12-medium">text-<token>-hover-<variant></code>.
|
|
157
|
-
Click a label to copy.
|
|
158
|
-
</p>
|
|
159
|
-
</div>
|
|
160
|
-
|
|
161
|
-
${CONTENT_GROUPS.map(renderGroup).join('')}
|
|
162
|
-
</div>
|
|
163
|
-
`,
|
|
164
|
-
}),
|
|
165
|
-
};
|