Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "add react-combobox components",
"packageName": "@fluentui-contrib/react-cap-theme",
"email": "egianoglio@microsoft.com",
"dependentChangeType": "patch"
}
3 changes: 3 additions & 0 deletions packages/react-cap-theme/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const capTheme: Record<keyof Theme & keyof CAPTokens, string> = {
colorNeutralStroke4Hover: '#e0e0e0',
colorNeutralStroke4Pressed: '#d6d6d6',
colorNeutralStroke4Selected: '#ebebeb',
colorNeutralForeground5: '#616161',
Comment thread
GianoglioEnrico marked this conversation as resolved.
colorNeutralForeground5Hover: '#242424',
colorNeutralForeground5Pressed: '#242424',
};

const preview: Preview = {
Expand Down
11 changes: 11 additions & 0 deletions packages/react-cap-theme/src/capStyleHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ import type {
} from '@fluentui/react-carousel';
import { useCheckboxStyles } from './components/react-checkbox';
import type { CheckboxState } from './components/react-checkbox';
import {
useComboboxStyles,
useDropdownStyles,
} from './components/react-combobox';
import type { ComboboxState, DropdownState } from './components/react-combobox';
import {
useDialogActionsStyles,
useDialogBodyStyles,
Expand Down Expand Up @@ -213,6 +218,9 @@ export const CAP_STYLE_HOOKS: NonNullable<
useCompoundButtonStyles_unstable: (state) => {
return useCompoundButtonStyles(state as CompoundButtonState);
},
useComboboxStyles_unstable: (state) => {
return useComboboxStyles(state as ComboboxState);
},
useDialogActionsStyles_unstable: (state) => {
return useDialogActionsStyles(state as DialogActionsState);
},
Expand Down Expand Up @@ -242,6 +250,9 @@ export const CAP_STYLE_HOOKS: NonNullable<
useDrawerHeaderTitleStyles_unstable: (state) => {
return useDrawerHeaderTitleStyles(state as DrawerHeaderTitleState);
},
useDropdownStyles_unstable: (state) => {
return useDropdownStyles(state as DropdownState);
},
useImageStyles_unstable: (state) => {
return useImageStyles(state as ImageState);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import type {
ComboboxProps as BaseProps,
ComboboxSlots as BaseSlots,
ComboboxState as BaseState,
} from '@fluentui/react-combobox';
import type {
ComponentProps,
ComponentState,
Slot,
} from '@fluentui/react-utilities';

/**
* Slot configuration for the Combobox component.
* Adds the SP-specific contentBefore slot. The listbox slot is inherited
* from Fluent and restyled in `useComboboxStyles`.
* @alpha
*/
export type ComboboxSlots = BaseSlots & {
/**
* Element before the input text, e.g. an icon or avatar.
*/
contentBefore?: Slot<'span'>;
};

/**
* Properties for configuring the Combobox component.
* @alpha
*/
export type ComboboxProps = ComponentProps<
Pick<ComboboxSlots, 'contentBefore'>
> &
Omit<BaseProps, 'color'> & {
/**
* The color variant.
*
* - 'brand' (default): Primary emphasis using brand colors.
* - 'neutral': Secondary emphasis using neutral colors.
*
* @default 'brand'
*/
// FIXME: Must not graduate to beta. Style implementation references Fluent tokens directly.
// `color` and `NeutralThemeProvider` solve the same brand/neutral switching problem at different
// levels of the stack with no defined interaction. Graduating locks in an API contract that may
// need to change once a proper token-based theming approach is defined.
color?: 'neutral' | 'brand';
};

/**
* State used in rendering the Combobox component.
* @alpha
*/
export type ComboboxState = ComponentState<ComboboxSlots> &
Omit<BaseState, 'components'> &
Required<Pick<ComboboxProps, 'color'>>;
Loading
Loading