|
| 1 | +import type { |
| 2 | + ComboboxProps as BaseProps, |
| 3 | + ComboboxSlots as BaseSlots, |
| 4 | + ComboboxState as BaseState, |
| 5 | +} from '@fluentui/react-combobox'; |
| 6 | +import type { |
| 7 | + ComponentProps, |
| 8 | + ComponentState, |
| 9 | + Slot, |
| 10 | +} from '@fluentui/react-utilities'; |
| 11 | + |
| 12 | +/** |
| 13 | + * Slot configuration for the Combobox component. |
| 14 | + * Adds the SP-specific contentBefore slot. The listbox slot is inherited |
| 15 | + * from Fluent and restyled in `useComboboxStyles`. |
| 16 | + * @alpha |
| 17 | + */ |
| 18 | +export type ComboboxSlots = BaseSlots & { |
| 19 | + /** |
| 20 | + * Element before the input text, e.g. an icon or avatar. |
| 21 | + */ |
| 22 | + contentBefore?: Slot<'span'>; |
| 23 | +}; |
| 24 | + |
| 25 | +/** |
| 26 | + * Properties for configuring the Combobox component. |
| 27 | + * @alpha |
| 28 | + */ |
| 29 | +export type ComboboxProps = ComponentProps< |
| 30 | + Pick<ComboboxSlots, 'contentBefore'> |
| 31 | +> & |
| 32 | + Omit<BaseProps, 'color'> & { |
| 33 | + /** |
| 34 | + * The color variant. |
| 35 | + * |
| 36 | + * - 'brand' (default): Primary emphasis using brand colors. |
| 37 | + * - 'neutral': Secondary emphasis using neutral colors. |
| 38 | + * |
| 39 | + * @default 'brand' |
| 40 | + */ |
| 41 | + // FIXME: Must not graduate to beta. Style implementation references Fluent tokens directly. |
| 42 | + // `color` and `NeutralThemeProvider` solve the same brand/neutral switching problem at different |
| 43 | + // levels of the stack with no defined interaction. Graduating locks in an API contract that may |
| 44 | + // need to change once a proper token-based theming approach is defined. |
| 45 | + color?: 'neutral' | 'brand'; |
| 46 | + }; |
| 47 | + |
| 48 | +/** |
| 49 | + * State used in rendering the Combobox component. |
| 50 | + * @alpha |
| 51 | + */ |
| 52 | +export type ComboboxState = ComponentState<ComboboxSlots> & |
| 53 | + Omit<BaseState, 'components'> & |
| 54 | + Required<Pick<ComboboxProps, 'color'>>; |
0 commit comments