chore(components): add @IconifyIcon tag on icon properties (#3445)

This commit is contained in:
Romain Hamel
2025-03-04 10:40:13 +01:00
committed by GitHub
parent ccbd89c908
commit fb4e05c65f
24 changed files with 106 additions and 6 deletions

View File

@@ -12,7 +12,13 @@ const accordion = tv({ extend: tv(theme), ...(appConfigAccordion.ui?.accordion |
export interface AccordionItem { export interface AccordionItem {
label?: string label?: string
/**
* @IconifyIcon
*/
icon?: string icon?: string
/**
* @IconifyIcon
*/
trailingIcon?: string trailingIcon?: string
slot?: string slot?: string
content?: string content?: string
@@ -31,6 +37,7 @@ export interface AccordionProps<T> extends Pick<AccordionRootProps, 'collapsible
/** /**
* The icon displayed on the right side of the trigger. * The icon displayed on the right side of the trigger.
* @defaultValue appConfig.ui.icons.chevronDown * @defaultValue appConfig.ui.icons.chevronDown
* @IconifyIcon
*/ */
trailingIcon?: string trailingIcon?: string
/** /**

View File

@@ -20,6 +20,9 @@ export interface AlertProps {
as?: any as?: any
title?: string title?: string
description?: string description?: string
/**
* @IconifyIcon
*/
icon?: string icon?: string
avatar?: AvatarProps avatar?: AvatarProps
color?: AlertVariants['color'] color?: AlertVariants['color']
@@ -42,6 +45,7 @@ export interface AlertProps {
/** /**
* The icon displayed in the close button. * The icon displayed in the close button.
* @defaultValue appConfig.ui.icons.close * @defaultValue appConfig.ui.icons.close
* @IconifyIcon
*/ */
closeIcon?: string closeIcon?: string
class?: any class?: any

View File

@@ -19,6 +19,9 @@ export interface AvatarProps {
as?: any as?: any
src?: string src?: string
alt?: string alt?: string
/**
* @IconifyIcon
*/
icon?: string icon?: string
text?: string text?: string
size?: AvatarVariants['size'] size?: AvatarVariants['size']

View File

@@ -27,6 +27,7 @@ export interface BreadcrumbProps<T> {
/** /**
* The icon to use as a separator. * The icon to use as a separator.
* @defaultValue appConfig.ui.icons.chevronRight * @defaultValue appConfig.ui.icons.chevronRight
* @IconifyIcon
*/ */
separatorIcon?: string separatorIcon?: string
/** /**

View File

@@ -29,21 +29,25 @@ export interface CalendarProps<R extends boolean, M extends boolean> extends Omi
/** /**
* The icon to use for the next year control. * The icon to use for the next year control.
* @defaultValue appConfig.ui.icons.chevronDoubleRight * @defaultValue appConfig.ui.icons.chevronDoubleRight
* @IconifyIcon
*/ */
nextYearIcon?: string nextYearIcon?: string
/** /**
* The icon to use for the next month control. * The icon to use for the next month control.
* @defaultValue appConfig.ui.icons.chevronRight * @defaultValue appConfig.ui.icons.chevronRight
* @IconifyIcon
*/ */
nextMonthIcon?: string nextMonthIcon?: string
/** /**
* The icon to use for the previous year control. * The icon to use for the previous year control.
* @defaultValue appConfig.ui.icons.chevronDoubleLeft * @defaultValue appConfig.ui.icons.chevronDoubleLeft
* @IconifyIcon
*/ */
prevYearIcon?: string prevYearIcon?: string
/** /**
* The icon to use for the previous month control. * The icon to use for the previous month control.
* @defaultValue appConfig.ui.icons.chevronLeft * @defaultValue appConfig.ui.icons.chevronLeft
* @IconifyIcon
*/ */
prevMonthIcon?: string prevMonthIcon?: string
color?: CalendarVariants['color'] color?: CalendarVariants['color']

View File

@@ -35,6 +35,7 @@ export interface CarouselProps<T> extends Omit<EmblaOptionsType, 'axis' | 'conta
/** /**
* The icon displayed in the prev button. * The icon displayed in the prev button.
* @defaultValue appConfig.ui.icons.arrowLeft * @defaultValue appConfig.ui.icons.arrowLeft
* @IconifyIcon
*/ */
prevIcon?: string prevIcon?: string
/** /**
@@ -45,6 +46,7 @@ export interface CarouselProps<T> extends Omit<EmblaOptionsType, 'axis' | 'conta
/** /**
* The icon displayed in the next button. * The icon displayed in the next button.
* @defaultValue appConfig.ui.icons.arrowRight * @defaultValue appConfig.ui.icons.arrowRight
* @IconifyIcon
*/ */
nextIcon?: string nextIcon?: string
/** /**

View File

@@ -30,6 +30,7 @@ export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'req
/** /**
* The icon displayed when the checkbox is indeterminate. * The icon displayed when the checkbox is indeterminate.
* @defaultValue appConfig.ui.icons.minus * @defaultValue appConfig.ui.icons.minus
* @IconifyIcon
*/ */
indeterminateIcon?: string indeterminateIcon?: string
class?: any class?: any

View File

@@ -42,7 +42,10 @@ export interface CommandPaletteGroup<T> {
ignoreFilter?: boolean ignoreFilter?: boolean
/** Filter group items after the search happened. */ /** Filter group items after the search happened. */
postFilter?: (searchTerm: string, items: T[]) => T[] postFilter?: (searchTerm: string, items: T[]) => T[]
/** The icon displayed when an item is highlighted. */ /**
* The icon displayed when an item is highlighted.
* @IconifyIcon
*/
highlightedIcon?: string highlightedIcon?: string
} }
@@ -60,6 +63,7 @@ export interface CommandPaletteProps<G, T> extends Pick<ListboxRootProps, 'multi
/** /**
* The icon displayed when an item is selected. * The icon displayed when an item is selected.
* @defaultValue appConfig.ui.icons.check * @defaultValue appConfig.ui.icons.check
* @IconifyIcon
*/ */
selectedIcon?: string selectedIcon?: string
/** /**
@@ -82,6 +86,7 @@ export interface CommandPaletteProps<G, T> extends Pick<ListboxRootProps, 'multi
/** /**
* The icon displayed in the close button. * The icon displayed in the close button.
* @defaultValue appConfig.ui.icons.close * @defaultValue appConfig.ui.icons.close
* @IconifyIcon
*/ */
closeIcon?: string closeIcon?: string
groups?: G[] groups?: G[]

View File

@@ -43,17 +43,20 @@ export interface ContextMenuProps<T> extends Omit<ContextMenuRootProps, 'dir'> {
/** /**
* The icon displayed when an item is checked. * The icon displayed when an item is checked.
* @defaultValue appConfig.ui.icons.check * @defaultValue appConfig.ui.icons.check
* @IconifyIcon
*/ */
checkedIcon?: string checkedIcon?: string
/** /**
* The icon displayed when an item is loading. * The icon displayed when an item is loading.
* @defaultValue appConfig.ui.icons.loading * @defaultValue appConfig.ui.icons.loading
* @IconifyIcon
*/ */
loadingIcon?: string loadingIcon?: string
/** /**
* The icon displayed when the item is an external link. * The icon displayed when the item is an external link.
* Set to `false` to hide the external icon. * Set to `false` to hide the external icon.
* @defaultValue appConfig.ui.icons.external * @defaultValue appConfig.ui.icons.external
* @IconifyIcon
*/ */
externalIcon?: boolean | string externalIcon?: boolean | string
/** The content of the menu. */ /** The content of the menu. */

View File

@@ -11,8 +11,17 @@ interface ContextMenuContentProps<T> extends Omit<RekaContextMenuContentProps, '
portal?: boolean portal?: boolean
sub?: boolean sub?: boolean
labelKey: string labelKey: string
/**
* @IconifyIcon
*/
checkedIcon?: string checkedIcon?: string
/**
* @IconifyIcon
*/
loadingIcon?: string loadingIcon?: string
/**
* @IconifyIcon
*/
externalIcon?: boolean | string externalIcon?: boolean | string
class?: any class?: any
ui: typeof _contextMenu ui: typeof _contextMenu

View File

@@ -43,17 +43,20 @@ export interface DropdownMenuProps<T> extends Omit<DropdownMenuRootProps, 'dir'>
/** /**
* The icon displayed when an item is checked. * The icon displayed when an item is checked.
* @defaultValue appConfig.ui.icons.check * @defaultValue appConfig.ui.icons.check
* @IconifyIcon
*/ */
checkedIcon?: string checkedIcon?: string
/** /**
* The icon displayed when an item is loading. * The icon displayed when an item is loading.
* @defaultValue appConfig.ui.icons.loading * @defaultValue appConfig.ui.icons.loading
* @IconifyIcon
*/ */
loadingIcon?: string loadingIcon?: string
/** /**
* The icon displayed when the item is an external link. * The icon displayed when the item is an external link.
* Set to `false` to hide the external icon. * Set to `false` to hide the external icon.
* @defaultValue appConfig.ui.icons.external * @defaultValue appConfig.ui.icons.external
* @IconifyIcon
*/ */
externalIcon?: boolean | string externalIcon?: boolean | string
/** /**

View File

@@ -12,8 +12,17 @@ interface DropdownMenuContentProps<T> extends Omit<RekaDropdownMenuContentProps,
portal?: boolean portal?: boolean
sub?: boolean sub?: boolean
labelKey: string labelKey: string
/**
* @IconifyIcon
*/
checkedIcon?: string checkedIcon?: string
/**
* @IconifyIcon
*/
loadingIcon?: string loadingIcon?: string
/**
* @IconifyIcon
*/
externalIcon?: boolean | string externalIcon?: boolean | string
class?: any class?: any
ui: typeof _dropdownMenu ui: typeof _dropdownMenu

View File

@@ -49,17 +49,20 @@ export interface InputMenuProps<T extends MaybeArrayOfArrayItem<I>, I extends Ma
/** /**
* The icon displayed to open the menu. * The icon displayed to open the menu.
* @defaultValue appConfig.ui.icons.chevronDown * @defaultValue appConfig.ui.icons.chevronDown
* @IconifyIcon
*/ */
trailingIcon?: string trailingIcon?: string
/** /**
* The icon displayed when an item is selected. * The icon displayed when an item is selected.
* @defaultValue appConfig.ui.icons.check * @defaultValue appConfig.ui.icons.check
* @IconifyIcon
*/ */
selectedIcon?: string selectedIcon?: string
/** /**
* The icon displayed to delete a tag. * The icon displayed to delete a tag.
* Works only when `multiple` is `true`. * Works only when `multiple` is `true`.
* @defaultValue appConfig.ui.icons.close * @defaultValue appConfig.ui.icons.close
* @IconifyIcon
*/ */
deleteIcon?: string deleteIcon?: string
/** /**

View File

@@ -40,6 +40,7 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
/** /**
* The icon displayed to increment the value. * The icon displayed to increment the value.
* @defaultValue appConfig.ui.icons.plus * @defaultValue appConfig.ui.icons.plus
* @IconifyIcon
*/ */
incrementIcon?: string incrementIcon?: string
/** /**
@@ -50,6 +51,7 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
/** /**
* The icon displayed to decrement the value. * The icon displayed to decrement the value.
* @defaultValue appConfig.ui.icons.minus * @defaultValue appConfig.ui.icons.minus
* @IconifyIcon
*/ */
decrementIcon?: string decrementIcon?: string
autofocus?: boolean autofocus?: boolean

View File

@@ -44,6 +44,7 @@ export interface ModalProps extends DialogRootProps {
/** /**
* The icon displayed in the close button. * The icon displayed in the close button.
* @defaultValue appConfig.ui.icons.close * @defaultValue appConfig.ui.icons.close
* @IconifyIcon
*/ */
closeIcon?: string closeIcon?: string
/** /**

View File

@@ -26,6 +26,9 @@ export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
* `{ size: 'sm', color: 'neutral', variant: 'outline' }`{lang="ts-type"} * `{ size: 'sm', color: 'neutral', variant: 'outline' }`{lang="ts-type"}
*/ */
badge?: string | number | BadgeProps badge?: string | number | BadgeProps
/**
* @IconifyIcon
*/
trailingIcon?: string trailingIcon?: string
/** /**
* The type of the item. * The type of the item.
@@ -50,12 +53,14 @@ export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'm
/** /**
* The icon displayed to open the menu. * The icon displayed to open the menu.
* @defaultValue appConfig.ui.icons.chevronDown * @defaultValue appConfig.ui.icons.chevronDown
* @IconifyIcon
*/ */
trailingIcon?: string trailingIcon?: string
/** /**
* The icon displayed when the item is an external link. * The icon displayed when the item is an external link.
* Set to `false` to hide the external icon. * Set to `false` to hide the external icon.
* @defaultValue appConfig.ui.icons.external * @defaultValue appConfig.ui.icons.external
* @IconifyIcon
*/ */
externalIcon?: boolean | string externalIcon?: boolean | string
items?: T items?: T

View File

@@ -20,21 +20,25 @@ export interface PaginationProps extends Partial<Pick<PaginationRootProps, 'defa
/** /**
* The icon to use for the first page control. * The icon to use for the first page control.
* @defaultValue appConfig.ui.icons.chevronDoubleLeft * @defaultValue appConfig.ui.icons.chevronDoubleLeft
* @IconifyIcon
*/ */
firstIcon?: string firstIcon?: string
/** /**
* The icon to use for the previous page control. * The icon to use for the previous page control.
* @defaultValue appConfig.ui.icons.chevronLeft * @defaultValue appConfig.ui.icons.chevronLeft
* @IconifyIcon
*/ */
prevIcon?: string prevIcon?: string
/** /**
* The icon to use for the next page control. * The icon to use for the next page control.
* @defaultValue appConfig.ui.icons.chevronRight * @defaultValue appConfig.ui.icons.chevronRight
* @IconifyIcon
*/ */
nextIcon?: string nextIcon?: string
/** /**
* The icon to use for the last page control. * The icon to use for the last page control.
* @defaultValue appConfig.ui.icons.chevronDoubleRight * @defaultValue appConfig.ui.icons.chevronDoubleRight
* @IconifyIcon
*/ */
lastIcon?: string lastIcon?: string
/** /**
@@ -45,6 +49,7 @@ export interface PaginationProps extends Partial<Pick<PaginationRootProps, 'defa
/** /**
* The color of the pagination controls. * The color of the pagination controls.
* @defaultValue 'neutral' * @defaultValue 'neutral'
* @IconifyIcon
*/ */
color?: ButtonProps['color'] color?: ButtonProps['color']
/** /**

View File

@@ -39,11 +39,13 @@ export interface SelectProps<T extends MaybeArrayOfArrayItem<I>, I extends Maybe
/** /**
* The icon displayed to open the menu. * The icon displayed to open the menu.
* @defaultValue appConfig.ui.icons.chevronDown * @defaultValue appConfig.ui.icons.chevronDown
* @IconifyIcon
*/ */
trailingIcon?: string trailingIcon?: string
/** /**
* The icon displayed when an item is selected. * The icon displayed when an item is selected.
* @defaultValue appConfig.ui.icons.check * @defaultValue appConfig.ui.icons.check
* @IconifyIcon
*/ */
selectedIcon?: string selectedIcon?: string
/** /**

View File

@@ -47,11 +47,13 @@ export interface SelectMenuProps<T extends MaybeArrayOfArrayItem<I>, I extends M
/** /**
* The icon displayed to open the menu. * The icon displayed to open the menu.
* @defaultValue appConfig.ui.icons.chevronDown * @defaultValue appConfig.ui.icons.chevronDown
* @IconifyIcon
*/ */
trailingIcon?: string trailingIcon?: string
/** /**
* The icon displayed when an item is selected. * The icon displayed when an item is selected.
* @defaultValue appConfig.ui.icons.check * @defaultValue appConfig.ui.icons.check
* @IconifyIcon
*/ */
selectedIcon?: string selectedIcon?: string
/** /**
@@ -62,6 +64,7 @@ export interface SelectMenuProps<T extends MaybeArrayOfArrayItem<I>, I extends M
/** /**
* Display an arrow alongside the menu. * Display an arrow alongside the menu.
* @defaultValue false * @defaultValue false
* @IconifyIcon
*/ */
arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'> arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'>
/** /**

View File

@@ -43,6 +43,7 @@ export interface SlideoverProps extends DialogRootProps {
/** /**
* The icon displayed in the close button. * The icon displayed in the close button.
* @defaultValue appConfig.ui.icons.close * @defaultValue appConfig.ui.icons.close
* @IconifyIcon
*/ */
closeIcon?: string closeIcon?: string
/** /**

View File

@@ -26,11 +26,18 @@ export interface SwitchProps extends Pick<SwitchRootProps, 'disabled' | 'id' | '
/** /**
* The icon when the `loading` prop is `true`. * The icon when the `loading` prop is `true`.
* @defaultValue appConfig.ui.icons.loading * @defaultValue appConfig.ui.icons.loading
* @IconifyIcon
*/ */
loadingIcon?: string loadingIcon?: string
/** Display an icon when the switch is checked. */ /**
* Display an icon when the switch is checked.
* @IconifyIcon
*/
checkedIcon?: string checkedIcon?: string
/** Display an icon when the switch is unchecked. */ /**
* Display an icon when the switch is unchecked.
* @IconifyIcon
*/
uncheckedIcon?: string uncheckedIcon?: string
label?: string label?: string
description?: string description?: string

View File

@@ -42,6 +42,7 @@ export interface ToastProps extends Pick<ToastRootProps, 'defaultOpen' | 'open'
/** /**
* The icon displayed in the close button. * The icon displayed in the close button.
* @defaultValue appConfig.ui.icons.close * @defaultValue appConfig.ui.icons.close
* @IconifyIcon
*/ */
closeIcon?: string closeIcon?: string
class?: any class?: any

View File

@@ -14,8 +14,14 @@ const tree = tv({ extend: tv(theme), ...(appConfig.ui?.tree || {}) })
type TreeVariants = VariantProps<typeof tree> type TreeVariants = VariantProps<typeof tree>
export type TreeItem = { export type TreeItem = {
/**
* @IconifyIcon
*/
icon?: string icon?: string
label?: string label?: string
/**
* @IconifyIcon
*/
trailingIcon?: string trailingIcon?: string
defaultExpanded?: boolean defaultExpanded?: boolean
disabled?: boolean disabled?: boolean
@@ -47,16 +53,19 @@ export interface TreeProps<T extends TreeItem, M extends boolean = false, K exte
/** /**
* The icon displayed on the right side of a parent node. * The icon displayed on the right side of a parent node.
* @defaultValue appConfig.ui.icons.chevronDown * @defaultValue appConfig.ui.icons.chevronDown
* @IconifyIcon
*/ */
trailingIcon?: string trailingIcon?: string
/** /**
* The icon displayed when a parent node is expanded. * The icon displayed when a parent node is expanded.
* @defaultValue appConfig.ui.icons.folderOpen * @defaultValue appConfig.ui.icons.folderOpen
* @IconifyIcon
*/ */
expandedIcon?: string expandedIcon?: string
/** /**
* The icon displayed when a parent node is collapsed. * The icon displayed when a parent node is collapsed.
* @defaultValue appConfig.ui.icons.folder * @defaultValue appConfig.ui.icons.folder
* @IconifyIcon
*/ */
collapsedIcon?: string collapsedIcon?: string
items?: T[] items?: T[]

View File

@@ -3,23 +3,33 @@ import { useAppConfig } from '#imports'
import type { AvatarProps } from '../types' import type { AvatarProps } from '../types'
export interface UseComponentIconsProps { export interface UseComponentIconsProps {
/** Display an icon based on the `leading` and `trailing` props. */ /**
* Display an icon based on the `leading` and `trailing` props.
* @IconifyIcon
*/
icon?: string icon?: string
/** Display an avatar on the left side. */ /** Display an avatar on the left side. */
avatar?: AvatarProps avatar?: AvatarProps
/** When `true`, the icon will be displayed on the left side. */ /** When `true`, the icon will be displayed on the left side. */
leading?: boolean leading?: boolean
/** Display an icon on the left side. */ /**
* Display an icon on the left side.
* @IconifyIcon
*/
leadingIcon?: string leadingIcon?: string
/** When `true`, the icon will be displayed on the right side. */ /** When `true`, the icon will be displayed on the right side. */
trailing?: boolean trailing?: boolean
/** Display an icon on the right side. */ /**
* Display an icon on the right side.
* @IconifyIcon
*/
trailingIcon?: string trailingIcon?: string
/** When `true`, the loading icon will be displayed. */ /** When `true`, the loading icon will be displayed. */
loading?: boolean loading?: boolean
/** /**
* The icon when the `loading` prop is `true`. * The icon when the `loading` prop is `true`.
* @defaultValue appConfig.ui.icons.loading * @defaultValue appConfig.ui.icons.loading
* @IconifyIcon
*/ */
loadingIcon?: string loadingIcon?: string
} }