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): change slider to use Element Internals #31933

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
a5da47d
add changes from @chrisdholt
marchbox Jun 25, 2024
2ea431a
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jun 25, 2024
3569740
move aria attrs to element internals
marchbox Jun 25, 2024
aba1937
add back readonly
marchbox Jun 25, 2024
58244b3
only import types
marchbox Jun 25, 2024
6c7b1c4
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jun 26, 2024
d103ae2
fix initial value
marchbox Jun 26, 2024
d0ba74f
avoid thumb overhanging over track ends
marchbox Jun 26, 2024
3e0609a
fix vertical track size
marchbox Jun 26, 2024
2e5e103
Revert "fix vertical track size"
marchbox Jun 26, 2024
bd1e651
Revert "avoid thumb overhanging over track ends"
marchbox Jun 26, 2024
198ca0d
use custom states and add temp small size styles
marchbox Jun 26, 2024
4798a87
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jun 26, 2024
93e0582
match comp for small size and fix step markers
marchbox Jun 27, 2024
bb35117
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jun 27, 2024
790138a
clean up stories
marchbox Jun 27, 2024
b99e13f
add readonly back to story
marchbox Jun 27, 2024
732ded8
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jun 27, 2024
05090b9
Merge branch 'users/machi/slider-element-internals' of github.com:mar…
marchbox Jun 27, 2024
e057797
remove readonly to align with built-in range input
marchbox Jun 28, 2024
086fa69
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jun 28, 2024
e08817f
rename e to event for consistency
marchbox Jun 28, 2024
2bd933c
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jun 28, 2024
d5ae134
fix drag interaction bug related to orientation
marchbox Jun 28, 2024
82280cd
add jsdoc for slots, parts, and events
marchbox Jun 28, 2024
63f00a4
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jun 28, 2024
65620eb
change min and max to be strings to align with html
marchbox Jun 28, 2024
ed1abaa
set default ariaOrientation on element internals
marchbox Jun 28, 2024
6309277
rename _(min|max)Value to (min|max)AsNumber
marchbox Jun 28, 2024
e59f43f
fix default min max
marchbox Jun 28, 2024
ea7a98d
make step property as string
marchbox Jun 28, 2024
bbe0ede
fix test batch 1
marchbox Jun 28, 2024
f803da3
fix test batch 2
marchbox Jul 1, 2024
b93e93c
fix initial value
marchbox Jul 1, 2024
deb3df6
add story with labels
marchbox Jul 1, 2024
ca9231f
remove label story
marchbox Jul 1, 2024
2275511
add missing built-in form associated element methods
marchbox Jul 1, 2024
1b89907
set default ariaValueNow on element internals
marchbox Jul 1, 2024
b0ea5b1
fix steps
marchbox Jul 1, 2024
2652c66
add formDisabledCallback()
marchbox Jul 2, 2024
229d7e4
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jul 2, 2024
95267be
fix dom exception
marchbox Jul 3, 2024
de24c64
move pointerdown handler to container for bigger touch target
marchbox Jul 3, 2024
46401ae
add change file
marchbox Jul 3, 2024
84c68b4
change events in template to pointer events
marchbox Jul 3, 2024
f34ec89
remove fieldset story
marchbox Jul 3, 2024
99fe437
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jul 3, 2024
f4136ca
fix vertical track size in firefox
marchbox Jul 3, 2024
87f6737
disable touch action while interacting with the component
marchbox Jul 3, 2024
abdf042
convert min, max, and step values properly
marchbox Jul 3, 2024
e875a4b
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jul 3, 2024
d4ff247
change props back to public
marchbox Jul 3, 2024
03937b1
add todo tests
marchbox Jul 3, 2024
47f8518
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jul 5, 2024
4b0bb22
Merge branch 'users/machi/slider-element-internals' of github.com:mar…
marchbox Jul 5, 2024
7f14286
change value when min, max, and step changed
marchbox Jul 5, 2024
d92bd59
add type casting tests
marchbox Jul 5, 2024
2224eaa
fix lint
marchbox Jul 5, 2024
99e092b
fix formatting
marchbox Jul 5, 2024
2d9f4bb
update api report
marchbox Jul 5, 2024
1e70e59
Merge branch 'master' into users/machi/slider-element-internals
marchbox Jul 8, 2024
94dee9f
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jul 8, 2024
2fc0de0
fix hover and active styles
marchbox Jul 8, 2024
78bdeef
only display focus style when not inside a field
marchbox Jul 8, 2024
35a5f62
add setCustomValidity and setValidity methods
marchbox Jul 8, 2024
ec9489f
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jul 8, 2024
e0c455c
fix formatting
marchbox Jul 8, 2024
423cefd
Merge branch 'users/machi/slider-element-internals' of github.com:mar…
marchbox Jul 8, 2024
6d97b5a
Merge branch 'master' into users/machi/slider-element-internals
marchbox Jul 9, 2024
0ee179c
add tsdoc for converter
marchbox Jul 9, 2024
0906fc0
fix forced colors track styles
marchbox Jul 9, 2024
3899519
remove unused arguments
marchbox Jul 9, 2024
623fe66
remove unnecessary tag
marchbox Jul 9, 2024
0ec9ee3
reorg keyboard event handling code
marchbox Jul 9, 2024
206ec2b
fix story
marchbox Jul 9, 2024
2fc3ce8
remove unused arguments
marchbox Jul 9, 2024
adc71e2
remove inline styles
marchbox Jul 9, 2024
d6df248
fix formatting
marchbox Jul 9, 2024
e0f2800
update api report
marchbox Jul 9, 2024
3815da1
update api report
marchbox Jul 9, 2024
75e3c03
Merge branch 'users/machi/slider-element-internals' of github.com:mar…
marchbox Jul 9, 2024
629d0c2
revert position style changes
marchbox Jul 9, 2024
363589b
set default disabled state
marchbox Jul 10, 2024
354e358
Merge branch 'microsoft:master' into users/machi/slider-element-inter…
marchbox Jul 10, 2024
6c8c85a
move numberLikeStringConverter to utils
marchbox Jul 10, 2024
fa5feee
remove private properties from public api
marchbox Jul 10, 2024
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 @@
{
marchbox marked this conversation as resolved.
Show resolved Hide resolved
"type": "prerelease",
"comment": "feat: update slider to use ElementInternals for form association",
"packageName": "@fluentui/web-components",
"email": "[email protected]",
"dependentChangeType": "patch"
}
82 changes: 60 additions & 22 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

/// <reference types="web" />

import type { Constructable } from '@microsoft/fast-element';
import { CSSDirective } from '@microsoft/fast-element';
import { Direction } from '@microsoft/fast-web-utilities';
import { ElementStyles } from '@microsoft/fast-element';
Expand Down Expand Up @@ -1999,6 +1998,23 @@ export class Drawer extends FASTElement {
type: DrawerType;
}

// Warning: (ae-missing-release-tag) "DrawerBody" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class DrawerBody extends FASTElement {
}

// @public (undocumented)
export const DrawerBodyDefinition: FASTElementDefinition<typeof DrawerBody>;

// @public
export const DrawerBodyStyles: 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 DrawerBodyTemplate: ElementViewTemplate<DrawerBody>;

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

Expand Down Expand Up @@ -2847,48 +2863,65 @@ export const shadow8 = "var(--shadow8)";
// @public
export const shadow8Brand = "var(--shadow8Brand)";

// Warning: (ae-forgotten-export) The symbol "FormAssociatedSlider" needs to be exported by the entry point index.d.ts
//
// @public
export class Slider extends FormAssociatedSlider implements SliderConfiguration {
export class Slider extends FASTElement implements SliderConfiguration {
constructor();
// @internal
calculateNewValue(rawValue: number): number;
checkValidity(): boolean;
// @internal (undocumented)
connectedCallback(): void;
decrement(): void;
// @internal (undocumented)
direction: Direction;
disabled: boolean;
// (undocumented)
protected disabledChanged(): void;
// @internal (undocumented)
disconnectedCallback(): void;
// @internal
elementInternals: ElementInternals;
static formAssociated: boolean;
// @internal
formDisabledCallback(disabled: boolean): void;
// @internal
formResetCallback(): void;
// (undocumented)
handleChange(source: any, propertyName: string): void;
handleChange(_: any, propertyName: string): void;
// (undocumented)
handleMouseDown: (e: MouseEvent | null) => void;
handleThumbMouseDown: (event: MouseEvent | null) => void;
handlePointerDown: (event: PointerEvent | null) => void;
handleThumbPointerDown: (event: PointerEvent | null) => void;
increment(): void;
// @internal (undocumented)
initialValue: string;
// @internal
protected initialValueChanged(_: string, next: string): void;
// @internal (undocumented)
isDragging: boolean;
// (undocumented)
keypressHandler: (e: KeyboardEvent) => void;
max: number;
keypressHandler: (event: KeyboardEvent) => void;
get labels(): ReadonlyArray<Node>;
max: string;
// (undocumented)
protected maxChanged(): void;
min: number;
min: string;
// (undocumented)
protected minChanged(): void;
mode: SliderMode;
orientation: Orientation;
orientation?: Orientation;
// (undocumented)
protected orientationChanged(): void;
protected orientationChanged(prev: string | undefined, next: string | undefined): void;
// @internal (undocumented)
position: string;
readOnly: boolean;
// (undocumented)
protected readOnlyChanged(): void;
reportValidity(): boolean;
setCustomValidity(message: string): void;
// @internal
setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void;
// @internal
setValidity(flags?: Partial<ValidityState>, message?: string, anchor?: HTMLElement): void;
size?: SliderSize;
step: number | undefined;
// (undocumented)
protected sizeChanged(prev: string, next: string): void;
step: string;
// (undocumented)
protected stepChanged(): void;
// @internal (undocumented)
Expand All @@ -2907,11 +2940,16 @@ export class Slider extends FormAssociatedSlider implements SliderConfiguration
trackMinWidth: number;
// @internal (undocumented)
trackWidth: number;
get validationMessage(): string;
get validity(): ValidityState;
get value(): string;
set value(value: string);
get valueAsNumber(): number;
set valueAsNumber(next: number);
// @internal (undocumented)
valueChanged(previous: string, next: string): void;
valueTextFormatter: (value: string) => string | null;
valueTextFormatter: (value: string) => string;
// (undocumented)
protected valueTextFormatterChanged(): void;
get willValidate(): boolean;
}

// @public (undocumented)
Expand All @@ -2921,9 +2959,9 @@ export interface SliderConfiguration {
// (undocumented)
disabled?: boolean;
// (undocumented)
max: number;
max?: string;
// (undocumented)
min: number;
min?: string;
// (undocumented)
orientation?: SliderOrientation;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/web-components/src/slider/slider.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export type SliderMode = ValuesOf<typeof SliderMode>;
* @public
*/
export interface SliderConfiguration {
max: number;
min: number;
max?: string;
min?: string;
orientation?: SliderOrientation;
direction?: Direction;
disabled?: boolean;
Expand Down
Loading
Loading