Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web-components): add Dropdown, Listbox, and Option components #32116

Open
wants to merge 76 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
bdada99
add changefile
radium-v Nov 27, 2024
ae0bf9b
allow checkbox to use checked or selected mode
radium-v Nov 27, 2024
64b5669
allow elementinternals to be empty in toggleState function
radium-v Nov 27, 2024
f10aebb
add uniqueId function
radium-v Nov 27, 2024
76264d3
add option component
radium-v Nov 27, 2024
629ca4b
add listbox component
radium-v Nov 27, 2024
b35d9e3
add dropdown component
radium-v Nov 27, 2024
9c33ea1
add combobox stories
radium-v Nov 27, 2024
957eb54
update api report
radium-v Nov 27, 2024
df318ab
fix dropdown story format
radium-v Dec 3, 2024
1038d37
add size options to dropdown component and update stories
radium-v Dec 3, 2024
fb11201
add appearance options to dropdown component
radium-v Dec 7, 2024
4e24862
update api-report
radium-v Dec 7, 2024
d4008ba
remove console log
radium-v Dec 7, 2024
1e15c2c
move support checks to a new support module
radium-v Dec 7, 2024
6f9b404
refactor dropdown component to use listbox for popover management and…
radium-v Dec 7, 2024
f4bfc86
update dropdown stories to support dynamic slot assignment and add in…
radium-v Dec 7, 2024
81e4360
refactor dropdown stories to use consistent story argument syntax
radium-v Dec 7, 2024
541d5c4
add disabled state support to dropdown component and stories
radium-v Dec 7, 2024
363e764
scroll selected option into view
radium-v Dec 12, 2024
0e97ce7
add story for dropdown with disabled options
radium-v Dec 12, 2024
750de38
enhance option component with start and description slots support
radium-v Dec 13, 2024
f377320
update activeDescendant getter to return null when dropdown is closed
radium-v Dec 13, 2024
7cd2356
use regular binding for auto-assigned dropdown id
radium-v Dec 13, 2024
deaad9e
change dropdown open property from attribute to observable
radium-v Dec 13, 2024
524353b
move anchor positioning fallbacks to dropdown
radium-v Dec 14, 2024
70887c9
patch flipBlockState
radium-v Dec 14, 2024
f58b6b2
patch idleCallback
radium-v Dec 14, 2024
01b286b
update api-report
radium-v Dec 14, 2024
6d8fe6a
sort class members
radium-v Dec 14, 2024
5e04d00
fix: invert CSS anchor polyfill condition in dropdown
radium-v Dec 16, 2024
82d8bbf
remove checkedOptions property
radium-v Dec 17, 2024
fca52ca
allow isListbox function to accept custom tag name
radium-v Dec 17, 2024
c8c5e79
sort option members
radium-v Dec 17, 2024
bcd881a
add freeform attribute to option and slot for freeform content in lis…
radium-v Dec 17, 2024
b2fa208
add active property
radium-v Dec 18, 2024
74b2d1b
add doc blocks
radium-v Dec 18, 2024
797389f
update value handling and add freeform support
radium-v Dec 19, 2024
45354c9
remove console log
radium-v Dec 19, 2024
8ef16bb
update documentation and class member order
radium-v Dec 19, 2024
f91573c
move listbox connection pairing logic to dropdown
radium-v Dec 19, 2024
41f7527
update dropdown and combobox stories
radium-v Dec 19, 2024
80ec082
fix cursor for disabled comboboxes
radium-v Dec 19, 2024
8612e6d
update api report
radium-v Dec 19, 2024
d308a0d
revert commented focus call
radium-v Dec 19, 2024
cd5fc7d
revert basecheckbox modifications
radium-v Dec 19, 2024
0144a59
decouple option class from BaseCheckbox
radium-v Dec 19, 2024
cebe180
remove unused freeform slot from listbox template
radium-v Dec 19, 2024
b156500
sync the name attribute on the dropdown with its options
radium-v Dec 19, 2024
ac34751
update dropdown documentation
radium-v Dec 19, 2024
65fdcc6
simplify disabled state handling in dropdown and option components
radium-v Dec 19, 2024
9b463ba
remove unnecessary xmlns attribute from dropdown indicator template
radium-v Dec 19, 2024
d776ba0
remove unnecessary xmlns attributes from option SVGs
radium-v Dec 19, 2024
64ddd39
update TypeScript target to ES2022 and adjust class field definition …
radium-v Dec 20, 2024
502f8eb
update api-report
radium-v Dec 20, 2024
6712925
sort dropdown members
radium-v Dec 20, 2024
d1e51f4
streamline active option handling
radium-v Dec 20, 2024
47e044e
improve anchor position handling
radium-v Dec 21, 2024
294358d
return undefined when dropdown is closed
radium-v Jan 11, 2025
59ff2ee
revert option currentValue
radium-v Jan 12, 2025
2671824
remove anchor positioning fallback in favor of intersection observer
radium-v Jan 13, 2025
5b25f35
remove idle callback utility functions
radium-v Jan 13, 2025
5c0688c
use manual mode for popover handling
radium-v Jan 13, 2025
32599db
normalize dropdown stories
radium-v Jan 13, 2025
5fc2a44
convert dropdown indicator to statically composed template
radium-v Jan 14, 2025
3dbce93
remove unused anchor positioning fallback code
radium-v Jan 14, 2025
e15eb2b
add documentation for dropdown methods and properties
radium-v Jan 14, 2025
1ad2e19
update documentation for option methods and properties
radium-v Jan 14, 2025
3a031cf
remove unused option properties
radium-v Jan 14, 2025
e6fc584
update listbox documentation
radium-v Jan 14, 2025
e40f586
patch option doc
radium-v Jan 14, 2025
c5c529a
update documentation for dropdown and option elements
radium-v Jan 14, 2025
a94a538
rename Option to DropdownOption to avoid conflicts with the built-in …
radium-v Jan 14, 2025
d0255d6
fix text selection via mouse interaction for combobox mode
radium-v Jan 14, 2025
6bdbb92
update api-report
radium-v Jan 14, 2025
1559704
remove redundant properties from TypeScript configurations
radium-v Jan 14, 2025
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
1 change: 0 additions & 1 deletion apps/vr-tests-web-components/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
radium-v marked this conversation as resolved.
Show resolved Hide resolved
"extends": "../../tsconfig.base.wc.json",
"compilerOptions": {
"target": "ES2019",
"module": "NodeNext",
"noEmit": true,
"experimentalDecorators": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
radium-v marked this conversation as resolved.
Show resolved Hide resolved
radium-v marked this conversation as resolved.
Show resolved Hide resolved
"type": "prerelease",
"comment": "add Dropdown, Listbox, and Option components",
"packageName": "@fluentui/web-components",
"email": "[email protected]",
"dependentChangeType": "patch"
}
271 changes: 269 additions & 2 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,82 @@ export class BaseDivider extends FASTElement {
roleChanged(previous: string | null, next: string | null): void;
}

// @public
export class BaseDropdown extends FASTElement {
constructor();
get activeDescendant(): string | undefined;
// @internal
activeIndex: number;
// @internal
activeIndexChanged(prev: number | undefined, next: number | undefined): void;
ariaLabelledBy: string;
changeHandler(e: Event): boolean | void;
clickHandler(e: PointerEvent): boolean | void;
// @internal
control: HTMLInputElement;
// @internal
controlChanged(prev: HTMLInputElement | undefined, next: HTMLInputElement | undefined): void;
// @internal
controlSlot: HTMLSlotElement;
disabled?: boolean;
get displayValue(): string;
// @internal
elementInternals: ElementInternals;
get enabledOptions(): DropdownOption[];
// @internal
filterOptions(value: string, collection?: DropdownOption[]): DropdownOption[];
// @internal
focus(options?: FocusOptions): void;
// @internal
focusoutHandler(e: FocusEvent): boolean | void;
static formAssociated: boolean;
// @override
id: string;
// @internal
indicator: HTMLDivElement;
// @internal
indicatorSlot?: HTMLSlotElement;
initialValue?: string;
inputHandler(e: InputEvent): boolean | void;
protected insertControl(): void;
keydownHandler(e: KeyboardEvent): boolean | void;
// @internal
listbox: Listbox;
// @internal
listboxChanged(prev: Listbox | undefined, next: Listbox | undefined): void;
// @internal
listboxSlot: HTMLSlotElement;
// @internal
mousedownHandler(e: MouseEvent): boolean | void;
multiple?: boolean;
// @internal
protected multipleChanged(prev: boolean | undefined, next: boolean | undefined): void;
name: string;
nameChanged(prev: string, next: string): void;
open: boolean;
// @internal
openChanged(prev: boolean | undefined, next: boolean | undefined): void;
get options(): DropdownOption[];
placeholder: string;
required: boolean;
// @internal
get selectedIndex(): number;
get selectedOptions(): DropdownOption[];
selectOption(index?: number): void;
// @internal
setValidity(flags?: Partial<ValidityState>, message?: string, anchor?: HTMLElement): void;
type: DropdownType;
// @internal
typeChanged(prev: DropdownType | undefined, next: DropdownType | undefined): void;
// @internal
protected updateFreeformOption(value?: string): void;
// @internal
get validationMessage(): string;
get value(): string | null;
set value(next: string | null);
valueAttribute: string;
}

// @public
export class BaseField extends FASTElement {
constructor();
Expand Down Expand Up @@ -2403,6 +2479,145 @@ export const DrawerType: {
// @public
export type DrawerType = ValuesOf<typeof DrawerType>;

// @public
export class Dropdown extends BaseDropdown {
constructor();
appearance: DropdownAppearance;
// @internal
appearanceChanged(prev: DropdownAppearance | undefined, next: DropdownAppearance | undefined): void;
// (undocumented)
connectedCallback(): void;
// (undocumented)
disconnectedCallback(): void;
// @internal
openChanged(prev: boolean | undefined, next: boolean | undefined): void;
size?: DropdownSize;
// @internal
sizeChanged(prev: DropdownSize | undefined, next: DropdownSize | undefined): void;
}

// @public
export const DropdownAppearance: {
filledDarker: string;
filledLighter: string;
outline: string;
transparent: string;
};

// @public (undocumented)
export type DropdownAppearance = ValuesOf<typeof DropdownAppearance>;

// @public
export const dropdownButtonTemplate: ViewTemplate<BaseDropdown, any>;

// @public
export const DropdownDefinition: FASTElementDefinition<typeof Dropdown>;

// @public
export const dropdownInputTemplate: ViewTemplate<BaseDropdown, any>;

// Warning: (ae-forgotten-export) The symbol "Start" needs to be exported by the entry point index.d.ts
//
// @public
export class DropdownOption extends FASTElement implements Start {
constructor();
active: boolean;
// @internal
protected activeChanged(prev: boolean, next: boolean): void;
// (undocumented)
connectedCallback(): void;
// @internal
currentSelected?: boolean;
// @internal
currentSelectedChanged(prev: boolean | undefined, next: boolean | undefined): void;
defaultSelected?: boolean;
// @internal
protected defaultSelectedChanged(prev: boolean | undefined, next: boolean | undefined): void;
// @internal
descriptionSlot: Node[];
// @internal
descriptionSlotChanged(prev: Node[] | undefined, next: Node[] | undefined): void;
disabled?: boolean;
disabledAttribute?: boolean;
// @internal
protected disabledAttributeChanged(prev: boolean | undefined, next: boolean | undefined): void;
// @internal
elementInternals: ElementInternals;
get form(): HTMLFormElement | null;
static formAssociated: boolean;
formAttribute?: string;
// @internal
formResetCallback(): void;
freeform?: boolean;
// @internal
freeformOutputs?: HTMLOutputElement[];
// @override
id: string;
initialValue: string;
// @internal
protected initialValueChanged(prev: string, next: string): void;
get labels(): ReadonlyArray<HTMLLabelElement>;
multiple: boolean;
multipleChanged(prev: boolean, next: boolean): void;
name: string;
get selected(): boolean;
set selected(next: boolean);
// @internal
setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void;
// @internal
start: HTMLSlotElement;
get text(): string;
textAttribute?: string;
toggleSelected(force?: boolean): void;
get value(): string;
set value(value: string);
}

// @public
export const DropdownOptionDefinition: FASTElementDefinition<typeof DropdownOption>;

// @public
export type DropdownOptionOptions = StartOptions<DropdownOption> & {
checkedIndicator?: StaticallyComposableHTML<DropdownOption>;
};

// @public
export type DropdownOptions = {
indicator?: StaticallyComposableHTML<BaseDropdown>;
};

// @public
export const DropdownOptionStyles: ElementStyles;

// @public
export const DropdownOptionTemplate: ElementViewTemplate<DropdownOption>;

// @public
export const DropdownSize: {
readonly small: "small";
readonly medium: "medium";
readonly large: "large";
};

// @public (undocumented)
export type DropdownSize = ValuesOf<typeof DropdownSize>;

// @public
export const DropdownStyles: ElementStyles;

// @public
export const DropdownTemplate: ElementViewTemplate<BaseDropdown>;

// @public
export const DropdownType: {
readonly combobox: "combobox";
readonly dropdown: "dropdown";
readonly select: "select";
};

// @public (undocumented)
export type DropdownType = ValuesOf<typeof DropdownType>;

// @public
export const durationFast = "var(--durationFast)";

Expand Down Expand Up @@ -2574,6 +2789,15 @@ export const ImageStyles: ElementStyles;
// @public
export const ImageTemplate: ElementViewTemplate<Image_2>;

// @public
export function isDropdown(element?: Node | null, tagName?: string): element is BaseDropdown;

// @public
export function isDropdownOption(value: Node | null, tagName?: string): value is DropdownOption;

// @public
export function isListbox(element?: Node | null, tagName?: string): element is Listbox;

// @public
export class Label extends FASTElement {
disabled: boolean;
Expand Down Expand Up @@ -2692,6 +2916,47 @@ export type LinkTarget = ValuesOf<typeof AnchorTarget>;
// @public
export const LinkTemplate: ElementViewTemplate<Link>;

// @public
export class Listbox extends FASTElement {
constructor();
// @internal
beforetoggleHandler(e: ToggleEvent): boolean | undefined;
clickHandler(e: PointerEvent): boolean | void;
// (undocumented)
connectedCallback(): void;
// @internal
dropdown?: BaseDropdown;
// @internal
elementInternals: ElementInternals;
// @internal
get enabledOptions(): DropdownOption[];
// @internal
handleChange(source: any, propertyName?: string): void;
// @override
id: string;
multiple?: boolean;
multipleChanged(prev: boolean | undefined, next: boolean | undefined): void;
options: DropdownOption[];
// @internal
optionsChanged(prev: DropdownOption[] | undefined, next: DropdownOption[] | undefined): void;
// @internal
selectedIndex: number;
get selectedOptions(): DropdownOption[];
selectOption(index?: number): void;
}

// @public
export const ListboxDefinition: FASTElementDefinition<typeof Listbox>;

// @public
export const ListboxStyles: ElementStyles;

// @public
export const ListboxTemplate: ElementViewTemplate<Listbox>;

// @public
export function listboxTemplate<T extends Listbox>(): ElementViewTemplate<T>;

// @public
export abstract class MatchMediaBehavior implements HostBehavior {
constructor(query: MediaQueryList);
Expand Down Expand Up @@ -3490,8 +3755,10 @@ export const SpinnerStyles: ElementStyles;
// @public (undocumented)
export const SpinnerTemplate: ViewTemplate<Spinner, any>;

// Warning: (ae-forgotten-export) The symbol "End" needs to be exported by the entry point index.d.ts
//
// @public
export class StartEnd {
export class StartEnd implements Start, End {
// (undocumented)
end: HTMLSlotElement;
// (undocumented)
Expand All @@ -3507,7 +3774,7 @@ export type StartOptions<TSource = any, TParent = any> = {
};

// @public
export function startSlotTemplate<TSource extends StartEnd = StartEnd, TParent = any>(options: StartOptions<TSource, TParent>): CaptureType<TSource, TParent>;
export function startSlotTemplate<TSource extends Pick<StartEnd, 'start'> = StartEnd, TParent = any>(options: StartOptions<TSource, TParent>): CaptureType<TSource, TParent>;

// @public
export const strokeWidthThick = "var(--strokeWidthThick)";
Expand Down
Loading
Loading