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): Use ElementInternals for Radio and RadioGroup components #31783

Merged
merged 14 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 12 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": "prerelease",
"comment": "feat: update radio and radio-group to use ElementInternals for form association",
"packageName": "@fluentui/web-components",
"email": "[email protected]",
"dependentChangeType": "patch"
}
195 changes: 155 additions & 40 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,14 +588,22 @@ export const ButtonType: {
export type ButtonType = ValuesOf<typeof ButtonType>;

// Warning: (ae-forgotten-export) The symbol "BaseCheckbox" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "Checkbox" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export class Checkbox extends BaseCheckbox {
constructor();
// @internal
formResetCallback(): void;
indeterminate?: boolean;
// @internal
indeterminateChanged(prev: boolean | undefined, next: boolean | undefined): void;
// (undocumented)
setAriaChecked(value?: boolean): void;
shape?: CheckboxShape;
shapeChanged(prev: CheckboxShape | undefined, next: CheckboxShape | undefined): void;
size?: CheckboxSize;
sizeChanged(prev: CheckboxSize | undefined, next: CheckboxSize | undefined): void;
toggleChecked(force?: boolean): void;
}

// @public
Expand Down Expand Up @@ -1967,6 +1975,72 @@ export const DividerStyles: ElementStyles;
// @public
export const DividerTemplate: ElementViewTemplate<Divider>;

// Warning: (ae-missing-release-tag) "Drawer" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export class Drawer extends FASTElement {
ariaDescribedby?: string;
ariaLabelledby?: string;
// (undocumented)
clickHandler(event: Event): boolean;
dialog: HTMLDialogElement;
emitBeforeToggle: () => void;
emitToggle: () => void;
hide(): void;
position: DrawerPosition;
show(): void;
// (undocumented)
size: DrawerSize;
type: DrawerType;
}

// @public (undocumented)
export const DrawerDefinition: FASTElementDefinition<typeof Drawer>;

// Warning: (ae-missing-release-tag) "DrawerPosition" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const DrawerPosition: {
readonly start: "start";
readonly end: "end";
};

// @public
export type DrawerPosition = ValuesOf<typeof DrawerPosition>;

// Warning: (ae-missing-release-tag) "DrawerSize" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const DrawerSize: {
readonly small: "small";
readonly medium: "medium";
readonly large: "large";
readonly full: "full";
};

// @public
export type DrawerSize = ValuesOf<typeof DrawerSize>;

// @public
export const DrawerStyles: ElementStyles;

// Warning: (ae-missing-release-tag) "template" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const DrawerTemplate: ElementViewTemplate<Drawer>;

// Warning: (ae-missing-release-tag) "DrawerType" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const DrawerType: {
readonly nonModal: "non-modal";
readonly modal: "modal";
readonly inline: "inline";
};

// @public
export type DrawerType = ValuesOf<typeof DrawerType>;

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

Expand All @@ -1993,8 +2067,9 @@ export const durationUltraSlow = "var(--durationUltraSlow)";

// @public
export class Field extends FASTElement {
constructor();
// @internal
changeHandler(e: Event): void;
changeHandler(e: Event): boolean | void;
// @internal
clickHandler(e: MouseEvent): boolean | void;
// @internal
Expand All @@ -2004,15 +2079,21 @@ export class Field extends FASTElement {
// @internal
focusoutHandler(e: FocusEvent): boolean | void;
input: SlottableInput;
inputChanged(prev: SlottableInput | undefined, next: SlottableInput | undefined): void;
// @internal
invalidHandler(e: Event): boolean | void;
labelPosition: FieldLabelPosition;
// @internal
labelSlot: Node[];
protected labelSlotChanged(prev: Node[], next: Node[]): void;
// @internal
messageSlot: Element[];
// @internal
messageSlotChanged(prev: Element[], next: Element[]): void;
// @internal
setStates(): void;
// (undocumented)
setValidationStates(): void;
// @internal
slottedInputs: SlottableInput[];
// @internal
Expand Down Expand Up @@ -2535,22 +2616,25 @@ export const ProgressBarValidationState: {
// @public
export type ProgressBarValidationState = ValuesOf<typeof ProgressBarValidationState>;

// Warning: (ae-forgotten-export) The symbol "FormAssociatedRadio" needs to be exported by the entry point index.d.ts
//
// @public
export class Radio extends FormAssociatedRadio implements RadioControl {
export class Radio extends BaseCheckbox {
constructor();
// @internal (undocumented)
get ariaPosInSet(): string | null;
set ariaPosInSet(value: string | null);
get ariaSetSize(): string | null;
set ariaSetSize(value: string | null);
// (undocumented)
connectedCallback(): void;
// @internal (undocumented)
defaultCheckedChanged(): void;
// @internal (undocumented)
defaultSlottedNodes: Node[];
// @internal
initialValue: string;
// @beta
keypressHandler(e: KeyboardEvent): boolean | void;
name: string;
// (undocumented)
protected disabledChanged(prev: boolean | undefined, next: boolean | undefined): void;
// (undocumented)
requiredChanged(): void;
// (undocumented)
setFormValue(): void;
// (undocumented)
setValidity(): void;
// (undocumented)
toggleChecked(state?: boolean): void;
}

// @public (undocumented)
Expand All @@ -2561,34 +2645,62 @@ export const RadioDefinition: FASTElementDefinition<typeof Radio>;

// @public
export class RadioGroup extends FASTElement {
constructor();
changeHandler(e: Event): boolean | void;
// @internal
protected checkedIndex: number;
// @internal
protected checkedIndexChanged(prev: number | undefined, next: number): void;
// @internal
checkRadio(index?: number): void;
checkValidity(): boolean;
// @internal
clickHandler(e: MouseEvent): boolean | void;
// (undocumented)
childItems: HTMLElement[];
// @internal (undocumented)
clickHandler: (e: MouseEvent) => void | boolean;
// @internal (undocumented)
connectedCallback(): void;
disabled: boolean;
// (undocumented)
disconnectedCallback(): void;
// @internal (undocumented)
focusOutHandler: (e: FocusEvent) => boolean | void;
// @internal (undocumented)
handleDisabledClick: (e: MouseEvent) => void | boolean;
// @internal
keydownHandler: (e: KeyboardEvent) => boolean | void;
name: string;
protected disabledChanged(prev?: boolean, next?: boolean): void;
// (undocumented)
protected nameChanged(): void;
orientation: RadioGroupOrientation;
readOnly: boolean;
// @internal (undocumented)
slottedRadioButtons: HTMLElement[];
disabledRadioHandler(e: CustomEvent): void;
// @internal
elementInternals: ElementInternals;
// @internal
get enabledRadios(): Radio[];
// @internal
focus(): void;
// @internal
focusinHandler(e: FocusEvent): boolean | void;
// @internal
focusoutHandler(e: FocusEvent): boolean | void;
static formAssociated: boolean;
// (undocumented)
protected slottedRadioButtonsChanged(oldValue: unknown, newValue: HTMLElement[]): void;
stacked: boolean;
value: string;
formResetCallback(): void;
initialValue?: string;
initialValueChanged(prev: string | undefined, next: string | undefined): void;
// @internal
keydownHandler(e: KeyboardEvent): boolean | void;
name: string;
// @internal
protected nameChanged(prev: string | undefined, next: string | undefined): void;
orientation?: RadioGroupOrientation;
// @internal
orientationChanged(prev: RadioGroupOrientation | undefined, next: RadioGroupOrientation | undefined): void;
radios?: Radio[];
radiosChanged(prev: Radio[] | undefined, next: Radio[] | undefined): void;
reportValidity(): boolean;
required: boolean;
// (undocumented)
protected valueChanged(): void;
requiredChanged(prev: boolean, next: boolean): void;
// @internal
setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void;
// @internal
setValidity(flags?: Partial<ValidityState>, message?: string, anchor?: HTMLElement): void;
// @internal
get validationMessage(): string;
get validity(): ValidityState;
get value(): string | null;
set value(next: string | null);
}

// @public
Expand Down Expand Up @@ -2622,15 +2734,14 @@ export type RadioOptions = {
// @public
export const RadioStyles: ElementStyles;

// Warning: (ae-missing-release-tag) "template" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const RadioTemplate: ElementViewTemplate<Radio>;

// @public
export class RatingDisplay extends FASTElement {
constructor();
color?: RatingDisplayColor;
colorChanged(prev: RatingDisplayColor | undefined, next: RatingDisplayColor | undefined): void;
compact: boolean;
count?: number;
// @internal
Expand All @@ -2641,6 +2752,7 @@ export class RatingDisplay extends FASTElement {
generateIcons(): string;
max?: number;
size?: RatingDisplaySize;
sizeChanged(prev: RatingDisplaySize | undefined, next: RatingDisplaySize | undefined): void;
value?: number;
}

Expand Down Expand Up @@ -2855,6 +2967,8 @@ export type SlottableInput = HTMLElement & ElementInternals & {
required: boolean;
disabled: boolean;
readOnly: boolean;
checked?: boolean;
value?: string;
};

// @public
Expand Down Expand Up @@ -2991,6 +3105,7 @@ export { styles as MenuButtonStyles }
//
// @public (undocumented)
export class Switch extends BaseCheckbox {
constructor();
}

// @public
Expand Down
Loading
Loading