diff --git a/docs/content/3.components/accordion.md b/docs/content/3.components/accordion.md index cc83f157..e825bd3e 100644 --- a/docs/content/3.components/accordion.md +++ b/docs/content/3.components/accordion.md @@ -23,6 +23,8 @@ Use the `items` prop as an array of objects with the following properties: - `value?: string`{lang="ts-type"} - `disabled?: boolean`{lang="ts-type"} - [`slot?: string`{lang="ts-type"}](#with-custom-slot) +- `class?: any`{lang="ts-type"} +- `ui?: { item?: ClassNameValue, header?: ClassNameValue, trigger?: ClassNameValue, leadingIcon?: ClassNameValue, label?: ClassNameValue, trailingIcon?: ClassNameValue, content?: ClassNameValue, body?: ClassNameValue }`{lang="ts-type"} ::component-code --- diff --git a/docs/content/3.components/breadcrumb.md b/docs/content/3.components/breadcrumb.md index 6e5540e5..d7aa63aa 100644 --- a/docs/content/3.components/breadcrumb.md +++ b/docs/content/3.components/breadcrumb.md @@ -16,8 +16,9 @@ Use the `items` prop as an array of objects with the following properties: - `label?: string`{lang="ts-type"} - `icon?: string`{lang="ts-type"} - `avatar?: AvatarProps`{lang="ts-type"} -- `class?: any`{lang="ts-type"} - [`slot?: string`{lang="ts-type"}](#with-custom-slot) +- `class?: any`{lang="ts-type"} +- `ui?: { item?: ClassNameValue, link?: ClassNameValue, linkLeadingIcon?: ClassNameValue, linkLeadingAvatar?: ClassNameValue, linkLabel?: ClassNameValue, separator?: ClassNameValue, separatorIcon?: ClassNameValue }`{lang="ts-type"} You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc. diff --git a/docs/content/3.components/carousel.md b/docs/content/3.components/carousel.md index afb0f78e..862c2a04 100644 --- a/docs/content/3.components/carousel.md +++ b/docs/content/3.components/carousel.md @@ -27,6 +27,11 @@ class: 'p-8' --- :: +You can also pass an array of objects with the following properties: + +- `class?: any`{lang="ts-type"} +- `ui?: { item?: ClassNameValue }`{lang="ts-type"} + You can control how many items are visible by using the [`basis`](https://tailwindcss.com/docs/flex-basis) / [`width`](https://tailwindcss.com/docs/width) utility classes on the `item`: ::component-example diff --git a/docs/content/3.components/checkbox-group.md b/docs/content/3.components/checkbox-group.md index 396df699..e9daadba 100644 --- a/docs/content/3.components/checkbox-group.md +++ b/docs/content/3.components/checkbox-group.md @@ -49,6 +49,8 @@ You can also pass an array of objects with the following properties: - `description?: string`{lang="ts-type"} - [`value?: string`{lang="ts-type"}](#value-key) - `disabled?: boolean`{lang="ts-type"} +- `class?: any`{lang="ts-type"} +- `ui?: { item?: ClassNameValue, container?: ClassNameValue, base?: ClassNameValue, 'indicator'?: ClassNameValue, icon?: ClassNameValue, wrapper?: ClassNameValue, label?: ClassNameValue, description?: ClassNameValue }`{lang="ts-type"} ::component-code --- diff --git a/docs/content/3.components/command-palette.md b/docs/content/3.components/command-palette.md index c25c4274..30b3e72e 100644 --- a/docs/content/3.components/command-palette.md +++ b/docs/content/3.components/command-palette.md @@ -53,6 +53,8 @@ Each group contains an `items` array of objects that define the commands. Each i - `disabled?: boolean`{lang="ts-type"} - [`slot?: string`{lang="ts-type"}](#with-custom-slot) - `onSelect?(e?: Event): void`{lang="ts-type"} +- `class?: any`{lang="ts-type"} +- `ui?: { item?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLeadingChipSize?: ClassNameValue, itemLeadingChip?: ClassNameValue, itemLabel?: ClassNameValue, itemLabelPrefix?: ClassNameValue, itemLabelBase?: ClassNameValue, itemLabelSuffix?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingKbds?: ClassNameValue, itemTrailingKbdsSize?: ClassNameValue, itemTrailingHighlightedIcon?: ClassNameValue, itemTrailingIcon?: ClassNameValue,}`{lang="ts-type"} You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc. diff --git a/docs/content/3.components/context-menu.md b/docs/content/3.components/context-menu.md index 9b14fce5..3d007e83 100644 --- a/docs/content/3.components/context-menu.md +++ b/docs/content/3.components/context-menu.md @@ -28,11 +28,12 @@ Use the `items` prop as an array of objects with the following properties: - [`color?: "error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"`{lang="ts-type"}](#with-color-items) - [`checked?: boolean`{lang="ts-type"}](#with-checkbox-items) - `disabled?: boolean`{lang="ts-type"} -- `class?: any`{lang="ts-type"} - [`slot?: string`{lang="ts-type"}](#with-custom-slot) - `onSelect?(e: Event): void`{lang="ts-type"} - [`onUpdateChecked?(checked: boolean): void`{lang="ts-type"}](#with-checkbox-items) - `children?: ContextMenuItem[] | ContextMenuItem[][]`{lang="ts-type"} +- `class?: any`{lang="ts-type"} +- `ui?: { item?: ClassNameValue, label?: ClassNameValue, separator?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLabel?: ClassNameValue, itemLabelExternalIcon?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingIcon?: ClassNameValue, itemTrailingKbds?: ClassNameValue, itemTrailingKbdsSize?: ClassNameValue }`{lang="ts-type"} You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc. diff --git a/docs/content/3.components/dropdown-menu.md b/docs/content/3.components/dropdown-menu.md index 7d7c3f54..34ed4a78 100644 --- a/docs/content/3.components/dropdown-menu.md +++ b/docs/content/3.components/dropdown-menu.md @@ -28,11 +28,12 @@ Use the `items` prop as an array of objects with the following properties: - [`color?: "error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"`{lang="ts-type"}](#with-color-items) - [`checked?: boolean`{lang="ts-type"}](#with-checkbox-items) - `disabled?: boolean`{lang="ts-type"} -- `class?: any`{lang="ts-type"} - [`slot?: string`{lang="ts-type"}](#with-custom-slot) - `onSelect?(e: Event): void`{lang="ts-type"} - [`onUpdateChecked?(checked: boolean): void`{lang="ts-type"}](#with-checkbox-items) - `children?: DropdownMenuItem[] | DropdownMenuItem[][]`{lang="ts-type"} +- `class?: any`{lang="ts-type"} +- `ui?: { item?: ClassNameValue, label?: ClassNameValue, separator?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLabel?: ClassNameValue, itemLabelExternalIcon?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingIcon?: ClassNameValue, itemTrailingKbds?: ClassNameValue, itemTrailingKbdsSize?: ClassNameValue }`{lang="ts-type"} You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc. diff --git a/docs/content/3.components/input-menu.md b/docs/content/3.components/input-menu.md index fbd8d411..c8e69624 100644 --- a/docs/content/3.components/input-menu.md +++ b/docs/content/3.components/input-menu.md @@ -55,6 +55,8 @@ You can also pass an array of objects with the following properties: - [`chip?: ChipProps`{lang="ts-type"}](#with-chip-in-items) - `disabled?: boolean`{lang="ts-type"} - `onSelect?(e: Event): void`{lang="ts-type"} +- `class?: any`{lang="ts-type"} +- `ui?: { tagsItem?: ClassNameValue, tagsItemText?: ClassNameValue, tagsItemDelete?: ClassNameValue, tagsItemDeleteIcon?: ClassNameValue, label?: ClassNameValue, separator?: ClassNameValue, item?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLeadingChip?: ClassNameValue, itemLeadingChipSize?: ClassNameValue, itemLabel?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingIcon?: ClassNameValue }`{lang="ts-type"} ::component-code --- diff --git a/docs/content/3.components/navigation-menu.md b/docs/content/3.components/navigation-menu.md index b1c98c9b..f7b286bd 100644 --- a/docs/content/3.components/navigation-menu.md +++ b/docs/content/3.components/navigation-menu.md @@ -29,10 +29,11 @@ Use the `items` prop as an array of objects with the following properties: - `open?: boolean`{lang="ts-type"} - `value?: string`{lang="ts-type"} - `disabled?: boolean`{lang="ts-type"} -- `class?: any`{lang="ts-type"} - [`slot?: string`{lang="ts-type"}](#with-custom-slot) - `onSelect?(e: Event): void`{lang="ts-type"} - `children?: NavigationMenuChildItem[]`{lang="ts-type"} +- `class?: any`{lang="ts-type"} +- `ui?: { linkLeadingAvatarSize?: ClassNameValue, linkLeadingAvatar?: ClassNameValue, linkLeadingIcon?: ClassNameValue, linkLabel?: ClassNameValue, linkLabelExternalIcon?: ClassNameValue, linkTrailing?: ClassNameValue, linkTrailingBadgeSize?: ClassNameValue, linkTrailingBadge?: ClassNameValue, linkTrailingIcon?: ClassNameValue, label?: ClassNameValue, link?: ClassNameValue, content?: ClassNameValue, childList?: ClassNameValue, childItem?: ClassNameValue, childLink?: ClassNameValue, childLinkIcon?: ClassNameValue, childLinkWrapper?: ClassNameValue, childLinkLabel?: ClassNameValue, childLinkLabelExternalIcon?: ClassNameValue, childLinkDescription?: ClassNameValue }`{lang="ts-type"} You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc. @@ -134,8 +135,8 @@ Each item can take a `children` array of objects with the following properties t - `label: string` - `description?: string` - `icon?: string` -- `class?: any` - `onSelect?(e: Event): void` +- `class?: any` :: diff --git a/docs/content/3.components/radio-group.md b/docs/content/3.components/radio-group.md index f4b50ec5..c7d5f13d 100644 --- a/docs/content/3.components/radio-group.md +++ b/docs/content/3.components/radio-group.md @@ -46,6 +46,8 @@ You can also pass an array of objects with the following properties: - `description?: string`{lang="ts-type"} - [`value?: string`{lang="ts-type"}](#value-key) - `disabled?: boolean`{lang="ts-type"} +- `class?: any`{lang="ts-type"} +- `ui?: { item?: ClassNameValue, container?: ClassNameValue, base?: ClassNameValue, 'indicator'?: ClassNameValue, wrapper?: ClassNameValue, label?: ClassNameValue, description?: ClassNameValue }`{lang="ts-type"} ::component-code --- diff --git a/docs/content/3.components/select-menu.md b/docs/content/3.components/select-menu.md index 82f711f5..fbdbcc5a 100644 --- a/docs/content/3.components/select-menu.md +++ b/docs/content/3.components/select-menu.md @@ -57,6 +57,8 @@ You can also pass an array of objects with the following properties: - [`chip?: ChipProps`{lang="ts-type"}](#with-chip-in-items) - `disabled?: boolean`{lang="ts-type"} - `onSelect?(e: Event): void`{lang="ts-type"} +- `class?: any`{lang="ts-type"} +- `ui?: { label?: ClassNameValue, separator?: ClassNameValue, item?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLeadingChipSize?: ClassNameValue, itemLeadingChip?: ClassNameValue, itemLabel?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingIcon?: ClassNameValue }`{lang="ts-type"} ::component-code --- diff --git a/docs/content/3.components/select.md b/docs/content/3.components/select.md index 2f32b0df..5a642c15 100644 --- a/docs/content/3.components/select.md +++ b/docs/content/3.components/select.md @@ -48,6 +48,8 @@ You can also pass an array of objects with the following properties: - [`avatar?: AvatarProps`{lang="ts-type"}](#with-avatar-in-items) - [`chip?: ChipProps`{lang="ts-type"}](#with-chip-in-items) - `disabled?: boolean`{lang="ts-type"} +- `class?: any`{lang="ts-type"} +- `ui?: { label?: ClassNameValue, separator?: ClassNameValue, item?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLeadingChipSize?: ClassNameValue, itemLeadingChip?: ClassNameValue, itemLabel?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingIcon?: ClassNameValue }`{lang="ts-type"} ::component-code --- diff --git a/docs/content/3.components/stepper.md b/docs/content/3.components/stepper.md index ca5d2145..5622d123 100644 --- a/docs/content/3.components/stepper.md +++ b/docs/content/3.components/stepper.md @@ -23,6 +23,8 @@ Use the `items` prop as an array of objects with the following properties: - `value?: string | number`{lang="ts-type"} - `disabled?: boolean`{lang="ts-type"} - [`slot?: string`{lang="ts-type"}](#with-custom-slot) +- `class?: any`{lang="ts-type"} +- `ui?: { item?: ClassNameValue, container?: ClassNameValue, trigger?: ClassNameValue, indicator?: ClassNameValue, icon?: ClassNameValue, separator?: ClassNameValue, wrapper?: ClassNameValue, title?: ClassNameValue, description?: ClassNameValue }`{lang="ts-type"} ::component-code --- diff --git a/docs/content/3.components/tabs.md b/docs/content/3.components/tabs.md index 6c08d410..3dc8a564 100644 --- a/docs/content/3.components/tabs.md +++ b/docs/content/3.components/tabs.md @@ -23,6 +23,8 @@ Use the `items` prop as an array of objects with the following properties: - `value?: string | number`{lang="ts-type"} - `disabled?: boolean`{lang="ts-type"} - [`slot?: string`{lang="ts-type"}](#with-custom-slot) +- `class?: any`{lang="ts-type"} +- `ui?: { trigger?: ClassNameValue, leadingIcon?: ClassNameValue, leadingAvatar?: ClassNameValue, label?: ClassNameValue, content?: ClassNameValue }`{lang="ts-type"} ::component-code --- diff --git a/docs/content/3.components/tree.md b/docs/content/3.components/tree.md index 95f96001..35fe5aca 100644 --- a/docs/content/3.components/tree.md +++ b/docs/content/3.components/tree.md @@ -26,6 +26,8 @@ Use the `items` prop as an array of objects with the following properties: - `children?: TreeItem[]`{lang="ts-type"} - `onToggle?(e: Event): void`{lang="ts-type"} - `onSelect?(e?: Event): void`{lang="ts-type"} +- `class?: any`{lang="ts-type"} +- `ui?: { item?: ClassNameValue, itemWithChildren?: ClassNameValue, link?: ClassNameValue, linkLeadingIcon?: ClassNameValue, linkLabel?: ClassNameValue, linkTrailing?: ClassNameValue, linkTrailingIcon?: ClassNameValue, listWithChildren?: ClassNameValue }`{lang="ts-type"} ::note A unique identifier is required for each item. The component will use the `value` prop as identifier, falling back to `label` if `value` is not provided. One of these must be provided for the component to work properly. diff --git a/src/runtime/components/Accordion.vue b/src/runtime/components/Accordion.vue index 45bb5d2c..f0900d90 100644 --- a/src/runtime/components/Accordion.vue +++ b/src/runtime/components/Accordion.vue @@ -22,6 +22,8 @@ export interface AccordionItem { /** A unique value for the accordion item. Defaults to the index. */ value?: string disabled?: boolean + class?: any + ui?: Pick [key: string]: any } @@ -96,27 +98,27 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.accordion || :key="index" :value="item.value || String(index)" :disabled="item.disabled" - :class="ui.item({ class: props.ui?.item })" + :class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })" > - - + + - + - + {{ get(item, props.labelKey as string) }} - + - + -
+
{{ item.content }} diff --git a/src/runtime/components/Breadcrumb.vue b/src/runtime/components/Breadcrumb.vue index f2a309ba..3e4f7335 100644 --- a/src/runtime/components/Breadcrumb.vue +++ b/src/runtime/components/Breadcrumb.vue @@ -15,6 +15,8 @@ export interface BreadcrumbItem extends Omit { icon?: string avatar?: AvatarProps slot?: string + class?: any + ui?: Pick [key: string]: any } @@ -84,16 +86,16 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.breadcrumb |
    diff --git a/src/runtime/components/Carousel.vue b/src/runtime/components/Carousel.vue index 37a01e1a..15e64f7f 100644 --- a/src/runtime/components/Carousel.vue +++ b/src/runtime/components/Carousel.vue @@ -15,7 +15,13 @@ import type { ComponentConfig } from '../types/utils' type Carousel = ComponentConfig -export type CarouselItem = AcceptableValue +interface _CarouselItem { + class?: any + ui?: Pick + [key: string]: any +} + +export type CarouselItem = _CarouselItem | AcceptableValue export interface CarouselProps extends Omit { /** @@ -254,6 +260,10 @@ function onSelect(api: EmblaCarouselType) { emits('select', selectedIndex.value) } +function isCarouselItem(item: CarouselItem): item is _CarouselItem { + return typeof item === 'object' && item !== null +} + onMounted(() => { if (!emblaApi.value) { return @@ -288,7 +298,7 @@ defineExpose({ :key="index" role="group" aria-roledescription="slide" - :class="ui.item({ class: props.ui?.item })" + :class="ui.item({ class: [props.ui?.item, isCarouselItem(item) && item.ui?.item, isCarouselItem(item) && item.class] })" >
diff --git a/src/runtime/components/CheckboxGroup.vue b/src/runtime/components/CheckboxGroup.vue index f9a166e1..dd997c24 100644 --- a/src/runtime/components/CheckboxGroup.vue +++ b/src/runtime/components/CheckboxGroup.vue @@ -14,6 +14,8 @@ export type CheckboxGroupItem = { description?: string disabled?: boolean value?: string + class?: any + ui?: Pick & Omit['ui'], 'root'> [key: string]: any } | CheckboxGroupValue @@ -177,8 +179,8 @@ function onUpdate(value: any) { :size="size" :name="name" :disabled="item.disabled || disabled" - :ui="props.ui ? omit(props.ui, ['root']) : undefined" - :class="ui.item({ class: props.ui?.item })" + :ui="{ ...(props.ui ? omit(props.ui, ['root']) : undefined), ...(item.ui || {}) }" + :class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })" >