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

[chore]: abstracts layout api from field class #32203

Merged
merged 2 commits into from
Aug 1, 2024
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": "prerelease",
"comment": "feat: abstracts layout api from field class",
"packageName": "@fluentui/web-components",
"email": "jes@microsoft.com",
"dependentChangeType": "patch"
}
66 changes: 35 additions & 31 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,40 @@ export class BaseDivider extends FASTElement {
roleChanged(previous: string | null, next: string | null): void;
}

// @public
export class BaseField extends FASTElement {
constructor();
// @internal
changeHandler(e: Event): boolean | void;
// @internal
clickHandler(e: MouseEvent): boolean | void;
// @internal
elementInternals: ElementInternals;
// @internal
focusinHandler(e: FocusEvent): boolean | void;
// @internal
focusoutHandler(e: FocusEvent): boolean | void;
input: SlottableInput;
inputChanged(prev: SlottableInput | undefined, next: SlottableInput | undefined): void;
// @internal
invalidHandler(e: Event): boolean | void;
// @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
slottedInputsChanged(prev: SlottableInput[] | undefined, next: SlottableInput[] | undefined): void;
}

// @public
export class BaseProgressBar extends FASTElement {
constructor();
Expand Down Expand Up @@ -2196,38 +2230,8 @@ export const durationUltraFast = "var(--durationUltraFast)";
export const durationUltraSlow = "var(--durationUltraSlow)";

// @public
export class Field extends FASTElement {
constructor();
// @internal
changeHandler(e: Event): boolean | void;
// @internal
clickHandler(e: MouseEvent): boolean | void;
// @internal
elementInternals: ElementInternals;
// @internal
focusinHandler(e: FocusEvent): boolean | void;
// @internal
focusoutHandler(e: FocusEvent): boolean | void;
input: SlottableInput;
inputChanged(prev: SlottableInput | undefined, next: SlottableInput | undefined): void;
// @internal
invalidHandler(e: Event): boolean | void;
export class Field extends BaseField {
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
slottedInputsChanged(prev: SlottableInput[] | undefined, next: SlottableInput[] | undefined): void;
}

// @public
Expand Down
30 changes: 19 additions & 11 deletions packages/web-components/src/field/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,7 @@ import { LabelPosition, SlottableInput, ValidationFlags } from './field.options.
*
* @public
*/
export class Field extends FASTElement {
/**
* The position of the label relative to the input.
*
* @public
* @remarks
* HTML Attribute: `label-position`
*/
@attr({ attribute: 'label-position' })
public labelPosition: LabelPosition = LabelPosition.above;

export class BaseField extends FASTElement {
/**
* The slotted label elements.
*
Expand Down Expand Up @@ -233,3 +223,21 @@ export class Field extends FASTElement {
}
}
}

/**
* A Field Custom HTML Element.
* Based on BaseField and includes style and layout specific attributes
*
* @public
*/
export class Field extends BaseField {
/**
* The position of the label relative to the input.
*
* @public
* @remarks
* HTML Attribute: `label-position`
*/
@attr({ attribute: 'label-position' })
public labelPosition: LabelPosition = LabelPosition.above;
}
2 changes: 1 addition & 1 deletion packages/web-components/src/field/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { Field } from './field.js';
export { BaseField, Field } from './field.js';
export { LabelPosition as FieldLabelPosition, ValidationFlags } from './field.options.js';
export type { SlottableInput } from './field.options.js';
export { definition as FieldDefinition } from './field.definition.js';
Expand Down
1 change: 1 addition & 0 deletions packages/web-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export {
} from './drawer/index.js';
export { DrawerBody, DrawerBodyDefinition, DrawerBodyTemplate, DrawerBodyStyles } from './drawer-body/index.js';
export {
BaseField,
Field,
FieldLabelPosition,
ValidationFlags,
Expand Down
Loading