mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-24 00:40:34 +01:00
feat(DropdownMenu/ContextMenu): handle color field in items (#2510)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -18,6 +18,10 @@ export default (options: Required<ModuleOptions>) => ({
|
||||
itemLabelExternalIcon: 'inline-block size-3 align-top text-[var(--ui-text-dimmed)]'
|
||||
},
|
||||
variants: {
|
||||
color: {
|
||||
...Object.fromEntries((options.theme.colors || []).map((color: string) => [color, ''])),
|
||||
neutral: ''
|
||||
},
|
||||
active: {
|
||||
true: {
|
||||
item: 'text-[var(--ui-text-highlighted)] before:bg-[var(--ui-bg-elevated)]',
|
||||
@@ -81,6 +85,21 @@ export default (options: Required<ModuleOptions>) => ({
|
||||
}
|
||||
}
|
||||
},
|
||||
compoundVariants: [...(options.theme.colors || []).map((color: string) => ({
|
||||
color,
|
||||
active: false,
|
||||
class: {
|
||||
item: `text-[var(--ui-${color})] data-highlighted:text-[var(--ui-${color})] data-highlighted:before:bg-[var(--ui-${color})]/10 data-[state=open]:before:bg-[var(--ui-${color})]/10`,
|
||||
itemLeadingIcon: `text-[var(--ui-${color})]/75 group-data-highlighted:text-[var(--ui-${color})] group-data-[state=open]:text-[var(--ui-${color})]`
|
||||
}
|
||||
})), ...(options.theme.colors || []).map((color: string) => ({
|
||||
color,
|
||||
active: true,
|
||||
class: {
|
||||
item: `text-[var(--ui-${color})] before:bg-[var(--ui-${color})]/10`,
|
||||
itemLeadingIcon: `text-[var(--ui-${color})]`
|
||||
}
|
||||
}))],
|
||||
defaultVariants: {
|
||||
size: 'md'
|
||||
}
|
||||
|
||||
@@ -19,6 +19,10 @@ export default (options: Required<ModuleOptions>) => ({
|
||||
itemLabelExternalIcon: 'inline-block size-3 align-top text-[var(--ui-text-dimmed)]'
|
||||
},
|
||||
variants: {
|
||||
color: {
|
||||
...Object.fromEntries((options.theme.colors || []).map((color: string) => [color, ''])),
|
||||
neutral: ''
|
||||
},
|
||||
active: {
|
||||
true: {
|
||||
item: 'text-[var(--ui-text-highlighted)] before:bg-[var(--ui-bg-elevated)]',
|
||||
@@ -82,6 +86,21 @@ export default (options: Required<ModuleOptions>) => ({
|
||||
}
|
||||
}
|
||||
},
|
||||
compoundVariants: [...(options.theme.colors || []).map((color: string) => ({
|
||||
color,
|
||||
active: false,
|
||||
class: {
|
||||
item: `text-[var(--ui-${color})] data-highlighted:text-[var(--ui-${color})] data-highlighted:before:bg-[var(--ui-${color})]/10 data-[state=open]:before:bg-[var(--ui-${color})]/10`,
|
||||
itemLeadingIcon: `text-[var(--ui-${color})]/75 group-data-highlighted:text-[var(--ui-${color})] group-data-[state=open]:text-[var(--ui-${color})]`
|
||||
}
|
||||
})), ...(options.theme.colors || []).map((color: string) => ({
|
||||
color,
|
||||
active: true,
|
||||
class: {
|
||||
item: `text-[var(--ui-${color})] before:bg-[var(--ui-${color})]/10`,
|
||||
itemLeadingIcon: `text-[var(--ui-${color})]`
|
||||
}
|
||||
}))],
|
||||
defaultVariants: {
|
||||
size: 'md'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user