Skip to content

Commit

Permalink
feat(web-components): Use ElementInternals for Radio and RadioGroup c…
Browse files Browse the repository at this point in the history
…omponents (#31783)
  • Loading branch information
radium-v authored Jul 3, 2024
1 parent 174e2f3 commit f02ae0b
Show file tree
Hide file tree
Showing 29 changed files with 2,114 additions and 1,462 deletions.
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": "863023+radium-v@users.noreply.github.com",
"dependentChangeType": "patch"
}
197 changes: 153 additions & 44 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,14 +588,20 @@ 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();
indeterminate?: boolean;
// @internal
protected indeterminateChanged(prev: boolean | undefined, next: boolean | undefined): void;
// @override
protected setAriaChecked(value?: boolean): void;
shape?: CheckboxShape;
shapeChanged(prev: CheckboxShape | undefined, next: CheckboxShape | undefined): void;
protected shapeChanged(prev: CheckboxShape | undefined, next: CheckboxShape | undefined): void;
size?: CheckboxSize;
sizeChanged(prev: CheckboxSize | undefined, next: CheckboxSize | undefined): void;
protected sizeChanged(prev: CheckboxSize | undefined, next: CheckboxSize | undefined): void;
toggleChecked(force?: boolean): void;
}

// @public
Expand Down Expand Up @@ -1967,6 +1973,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 +2065,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 +2077,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 +2614,21 @@ 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)
// (undocumented)
connectedCallback(): void;
// @internal (undocumented)
defaultCheckedChanged(): void;
// @internal (undocumented)
defaultSlottedNodes: Node[];
// @internal
initialValue: string;
// @beta
keypressHandler(e: KeyboardEvent): boolean | void;
name: string;
// @internal @override
protected disabledChanged(prev: boolean | undefined, next: boolean | undefined): void;
// @internal @override
protected requiredChanged(): void;
// @internal @override
setFormValue(): void;
// @internal @override
setValidity(): void;
// @override
toggleChecked(force?: boolean): void;
}

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

// @public
export class RadioGroup extends FASTElement {
// (undocumented)
childItems: HTMLElement[];
// @internal (undocumented)
clickHandler: (e: MouseEvent) => void | boolean;
// @internal (undocumented)
connectedCallback(): void;
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;
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
slotchangeHandler(e: Event): void;
// @internal
get validationMessage(): string;
get validity(): ValidityState;
get value(): string | null;
set value(next: string | null);
}

// @public
Expand Down Expand Up @@ -2622,15 +2728,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 +2746,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 +2961,8 @@ export type SlottableInput = HTMLElement & ElementInternals & {
required: boolean;
disabled: boolean;
readOnly: boolean;
checked?: boolean;
value?: string;
};

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

// @public
Expand Down
Loading

0 comments on commit f02ae0b

Please sign in to comment.