@fluentui/web-components 3.0.0-beta.11 → 3.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -2
- package/dist/dts/button/button.d.ts +173 -90
- package/dist/dts/button/button.definition.d.ts +3 -1
- package/dist/dts/button/button.options.d.ts +16 -1
- package/dist/dts/button/button.styles.d.ts +5 -0
- package/dist/dts/button/button.template.d.ts +7 -1
- package/dist/dts/form-associated/form-associated.d.ts +0 -74
- package/dist/dts/toggle-button/toggle-button.d.ts +29 -26
- package/dist/dts/toggle-button/toggle-button.styles.d.ts +7 -0
- package/dist/esm/anchor-button/anchor-button.styles.js +254 -3
- package/dist/esm/anchor-button/anchor-button.styles.js.map +1 -1
- package/dist/esm/button/button.definition.js +3 -4
- package/dist/esm/button/button.definition.js.map +1 -1
- package/dist/esm/button/button.js +233 -126
- package/dist/esm/button/button.js.map +1 -1
- package/dist/esm/button/button.options.js +10 -0
- package/dist/esm/button/button.options.js.map +1 -1
- package/dist/esm/button/button.styles.js +52 -54
- package/dist/esm/button/button.styles.js.map +1 -1
- package/dist/esm/button/button.template.js +13 -39
- package/dist/esm/button/button.template.js.map +1 -1
- package/dist/esm/compound-button/compound-button.definition.js +0 -3
- package/dist/esm/compound-button/compound-button.definition.js.map +1 -1
- package/dist/esm/compound-button/compound-button.styles.js +7 -7
- package/dist/esm/compound-button/compound-button.template.js +3 -39
- package/dist/esm/compound-button/compound-button.template.js.map +1 -1
- package/dist/esm/form-associated/form-associated.js.map +1 -1
- package/dist/esm/menu-button/menu-button.definition.js +0 -3
- package/dist/esm/menu-button/menu-button.definition.js.map +1 -1
- package/dist/esm/menu-button/menu-button.template.js +5 -1
- package/dist/esm/menu-button/menu-button.template.js.map +1 -1
- package/dist/esm/toggle-button/toggle-button.definition.js +0 -3
- package/dist/esm/toggle-button/toggle-button.definition.js.map +1 -1
- package/dist/esm/toggle-button/toggle-button.js +42 -85
- package/dist/esm/toggle-button/toggle-button.js.map +1 -1
- package/dist/esm/toggle-button/toggle-button.styles.js +31 -26
- package/dist/esm/toggle-button/toggle-button.styles.js.map +1 -1
- package/dist/fluent-web-components.api.json +342 -673
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/main.e73a6496.iframe.bundle.js +2 -0
- package/dist/storybook/project.json +1 -1
- package/dist/web-components.d.ts +250 -223
- package/dist/web-components.js +236 -229
- package/dist/web-components.min.js +51 -50
- package/docs/api-report.md +63 -79
- package/package.json +3 -2
- package/playwright.config.ts +2 -3
- package/dist/dts/button/button.form-associated.d.ts +0 -14
- package/dist/esm/button/button.form-associated.js +0 -14
- package/dist/esm/button/button.form-associated.js.map +0 -1
- package/dist/storybook/main.81e47c59.iframe.bundle.js +0 -2
- /package/dist/storybook/{main.81e47c59.iframe.bundle.js.LICENSE.txt → main.e73a6496.iframe.bundle.js.LICENSE.txt} +0 -0
|
@@ -4,104 +4,61 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { attr
|
|
7
|
+
import { attr } from '@microsoft/fast-element';
|
|
8
8
|
import { Button } from '../button/button.js';
|
|
9
9
|
/**
|
|
10
|
-
* The base class used for constructing a fluent-toggle-button custom element
|
|
10
|
+
* The base class used for constructing a `<fluent-toggle-button>` custom element.
|
|
11
|
+
*
|
|
11
12
|
* @public
|
|
12
13
|
*/
|
|
13
14
|
export class ToggleButton extends Button {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.dirtyChecked = false;
|
|
22
|
-
/**
|
|
23
|
-
* Provides the default checkedness of the input element
|
|
24
|
-
* Passed down to proxy
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
* @remarks
|
|
28
|
-
* HTML Attribute: checked
|
|
29
|
-
*/
|
|
30
|
-
this.checkedAttribute = false;
|
|
31
|
-
this.defaultChecked = false;
|
|
32
|
-
/**
|
|
33
|
-
* The checked state of the control.
|
|
34
|
-
*
|
|
35
|
-
* @public
|
|
36
|
-
*/
|
|
37
|
-
this.checked = false;
|
|
38
|
-
/**
|
|
39
|
-
* The current checkedness of the element. This property serves as a mechanism
|
|
40
|
-
* to set the `checked` property through both property assignment and the
|
|
41
|
-
* .setAttribute() method. This is useful for setting the field's checkedness
|
|
42
|
-
* in UI libraries that bind data through the .setAttribute() API
|
|
43
|
-
* and don't support IDL attribute binding.
|
|
44
|
-
*/
|
|
45
|
-
this.currentChecked = false;
|
|
46
|
-
/**
|
|
47
|
-
* @internal
|
|
48
|
-
*/
|
|
49
|
-
this.handleToggleButtonClick = (e) => {
|
|
50
|
-
if (!this.disabled && !this.disabledFocusable) {
|
|
51
|
-
this.checked = !this.checked;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
// Re-initialize dirtyChecked because initialization of other values
|
|
55
|
-
// causes it to become true
|
|
56
|
-
this.dirtyChecked = false;
|
|
15
|
+
/**
|
|
16
|
+
* Updates the pressed state when the `pressed` property changes.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
pressedChanged() {
|
|
21
|
+
this.setPressedState();
|
|
57
22
|
}
|
|
58
|
-
|
|
59
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Updates the pressed state when the `mixed` property changes.
|
|
25
|
+
*
|
|
26
|
+
* @param previous - the previous mixed state
|
|
27
|
+
* @param next - the current mixed state
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
mixedChanged() {
|
|
31
|
+
this.setPressedState();
|
|
60
32
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
checkedChanged(prev, next) {
|
|
71
|
-
if (!this.$fastController.isConnected) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (!this.dirtyChecked) {
|
|
75
|
-
this.dirtyChecked = true;
|
|
76
|
-
}
|
|
77
|
-
this.currentChecked = this.checked;
|
|
78
|
-
this.setAttribute('aria-pressed', `${this.currentChecked}`);
|
|
79
|
-
if (prev !== undefined) {
|
|
80
|
-
this.$emit('change');
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
currentCheckedChanged(prev, next) {
|
|
84
|
-
this.checked = this.currentChecked;
|
|
33
|
+
/**
|
|
34
|
+
* Toggles the pressed state of the button.
|
|
35
|
+
*
|
|
36
|
+
* @override
|
|
37
|
+
*/
|
|
38
|
+
press() {
|
|
39
|
+
this.pressed = !this.pressed;
|
|
85
40
|
}
|
|
86
41
|
connectedCallback() {
|
|
87
42
|
super.connectedCallback();
|
|
88
|
-
this.
|
|
43
|
+
this.setPressedState();
|
|
89
44
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Sets the `aria-pressed` attribute based on the `pressed` and `mixed` properties.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
setPressedState() {
|
|
51
|
+
if (this.$fastController.isConnected) {
|
|
52
|
+
const ariaPressed = `${this.mixed ? 'mixed' : !!this.pressed}`;
|
|
53
|
+
this.elementInternals.ariaPressed = ariaPressed;
|
|
54
|
+
this.setAttribute('aria-pressed', ariaPressed);
|
|
55
|
+
}
|
|
93
56
|
}
|
|
94
57
|
}
|
|
95
58
|
__decorate([
|
|
96
|
-
attr({
|
|
97
|
-
], ToggleButton.prototype, "
|
|
98
|
-
__decorate([
|
|
99
|
-
observable
|
|
100
|
-
], ToggleButton.prototype, "defaultChecked", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
observable
|
|
103
|
-
], ToggleButton.prototype, "checked", void 0);
|
|
59
|
+
attr({ mode: 'boolean' })
|
|
60
|
+
], ToggleButton.prototype, "pressed", void 0);
|
|
104
61
|
__decorate([
|
|
105
|
-
attr({
|
|
106
|
-
], ToggleButton.prototype, "
|
|
62
|
+
attr({ mode: 'boolean' })
|
|
63
|
+
], ToggleButton.prototype, "mixed", void 0);
|
|
107
64
|
//# sourceMappingURL=toggle-button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-button.js","sourceRoot":"","sources":["../../../src/toggle-button/toggle-button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"toggle-button.js","sourceRoot":"","sources":["../../../src/toggle-button/toggle-button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM;IAWtC;;;;OAIG;IACO,cAAc;QACtB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAYD;;;;;;OAMG;IACO,YAAY;QACpB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACO,KAAK;QACb,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IAC/B,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACK,eAAe;QACrB,IAAI,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE;YACpC,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAC/D,IAAI,CAAC,gBAAgB,CAAC,WAAW,GAAG,WAAW,CAAC;YAChD,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;SAChD;IACH,CAAC;CACF;AA1DC;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;6CACD;AAmBzB;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;2CACH"}
|
|
@@ -1,92 +1,97 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
|
-
import { forcedColorsStylesheetBehavior } from '../utils/index.js';
|
|
3
2
|
import { styles as ButtonStyles } from '../button/button.styles.js';
|
|
4
3
|
import { colorBrandBackgroundHover, colorBrandBackgroundPressed, colorBrandBackgroundSelected, colorNeutralBackground1Hover, colorNeutralBackground1Pressed, colorNeutralBackground1Selected, colorNeutralForeground1, colorNeutralForeground2BrandHover, colorNeutralForeground2BrandPressed, colorNeutralForeground2BrandSelected, colorNeutralForeground2Hover, colorNeutralForeground2Pressed, colorNeutralForeground2Selected, colorNeutralForegroundOnBrand, colorNeutralStroke1, colorNeutralStroke1Hover, colorNeutralStroke1Pressed, colorSubtleBackgroundHover, colorSubtleBackgroundPressed, colorSubtleBackgroundSelected, colorTransparentBackgroundHover, colorTransparentBackgroundPressed, colorTransparentBackgroundSelected, strokeWidthThin, } from '../theme/design-tokens.js';
|
|
5
|
-
|
|
4
|
+
import { forcedColorsStylesheetBehavior } from '../utils/behaviors/match-media-stylesheet-behavior.js';
|
|
5
|
+
/**
|
|
6
|
+
* The styles for the ToggleButton component.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
* @privateRemarks
|
|
10
|
+
* TODO: Need to support icon hover styles
|
|
11
|
+
*/
|
|
6
12
|
export const styles = css `
|
|
7
13
|
${ButtonStyles}
|
|
8
14
|
|
|
9
|
-
:host([aria-pressed=
|
|
15
|
+
:host([aria-pressed='true']) {
|
|
10
16
|
border-color: ${colorNeutralStroke1};
|
|
11
17
|
background-color: ${colorNeutralBackground1Selected};
|
|
12
18
|
color: ${colorNeutralForeground1};
|
|
13
19
|
border-width: ${strokeWidthThin};
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
:host([aria-pressed='true']:hover)
|
|
22
|
+
:host([aria-pressed='true']:hover) {
|
|
17
23
|
border-color: ${colorNeutralStroke1Hover};
|
|
18
24
|
background-color: ${colorNeutralBackground1Hover};
|
|
19
25
|
}
|
|
20
26
|
|
|
21
|
-
:host([aria-pressed='true']:active)
|
|
27
|
+
:host([aria-pressed='true']:active) {
|
|
22
28
|
border-color: ${colorNeutralStroke1Pressed};
|
|
23
29
|
background-color: ${colorNeutralBackground1Pressed};
|
|
24
30
|
}
|
|
25
31
|
|
|
26
|
-
:host([aria-pressed='true'][appearance='primary'])
|
|
32
|
+
:host([aria-pressed='true'][appearance='primary']) {
|
|
27
33
|
border-color: transparent;
|
|
28
34
|
background-color: ${colorBrandBackgroundSelected};
|
|
29
35
|
color: ${colorNeutralForegroundOnBrand};
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
:host([aria-pressed='true'][appearance='primary']:hover)
|
|
38
|
+
:host([aria-pressed='true'][appearance='primary']:hover) {
|
|
33
39
|
background-color: ${colorBrandBackgroundHover};
|
|
34
40
|
}
|
|
35
41
|
|
|
36
|
-
:host([aria-pressed='true'][appearance='primary']:active)
|
|
42
|
+
:host([aria-pressed='true'][appearance='primary']:active) {
|
|
37
43
|
background-color: ${colorBrandBackgroundPressed};
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
:host([aria-pressed='true'][appearance='subtle'])
|
|
46
|
+
:host([aria-pressed='true'][appearance='subtle']) {
|
|
41
47
|
border-color: transparent;
|
|
42
48
|
background-color: ${colorSubtleBackgroundSelected};
|
|
43
49
|
color: ${colorNeutralForeground2Selected};
|
|
44
50
|
}
|
|
45
51
|
|
|
46
|
-
:host([aria-pressed='true'][appearance='subtle']:hover)
|
|
52
|
+
:host([aria-pressed='true'][appearance='subtle']:hover) {
|
|
47
53
|
background-color: ${colorSubtleBackgroundHover};
|
|
48
54
|
color: ${colorNeutralForeground2Hover};
|
|
49
55
|
}
|
|
50
56
|
|
|
51
|
-
:host([aria-pressed='true'][appearance='subtle']:active)
|
|
57
|
+
:host([aria-pressed='true'][appearance='subtle']:active) {
|
|
52
58
|
background-color: ${colorSubtleBackgroundPressed};
|
|
53
59
|
color: ${colorNeutralForeground2Pressed};
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
:host([aria-pressed='true'][appearance='outline'])
|
|
57
|
-
:host([aria-pressed='true'][appearance='transparent'])
|
|
62
|
+
:host([aria-pressed='true'][appearance='outline']),
|
|
63
|
+
:host([aria-pressed='true'][appearance='transparent']) {
|
|
58
64
|
background-color: ${colorTransparentBackgroundSelected};
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
:host([aria-pressed='true'][appearance='outline']:hover)
|
|
62
|
-
:host([aria-pressed='true'][appearance='transparent']:hover)
|
|
67
|
+
:host([aria-pressed='true'][appearance='outline']:hover),
|
|
68
|
+
:host([aria-pressed='true'][appearance='transparent']:hover) {
|
|
63
69
|
background-color: ${colorTransparentBackgroundHover};
|
|
64
70
|
}
|
|
65
71
|
|
|
66
|
-
:host([aria-pressed='true'][appearance='outline']:active)
|
|
67
|
-
:host([aria-pressed='true'][appearance='transparent']:active)
|
|
72
|
+
:host([aria-pressed='true'][appearance='outline']:active),
|
|
73
|
+
:host([aria-pressed='true'][appearance='transparent']:active) {
|
|
68
74
|
background-color: ${colorTransparentBackgroundPressed};
|
|
69
75
|
}
|
|
70
76
|
|
|
71
|
-
:host([aria-pressed='true'][appearance='transparent'])
|
|
77
|
+
:host([aria-pressed='true'][appearance='transparent']) {
|
|
72
78
|
border-color: transparent;
|
|
73
79
|
color: ${colorNeutralForeground2BrandSelected};
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
:host([aria-pressed='true'][appearance='transparent']:hover)
|
|
82
|
+
:host([aria-pressed='true'][appearance='transparent']:hover) {
|
|
77
83
|
color: ${colorNeutralForeground2BrandHover};
|
|
78
84
|
}
|
|
79
85
|
|
|
80
|
-
:host([aria-pressed='true'][appearance='transparent']:active)
|
|
86
|
+
:host([aria-pressed='true'][appearance='transparent']:active) {
|
|
81
87
|
color: ${colorNeutralForeground2BrandPressed};
|
|
82
88
|
}
|
|
83
89
|
`.withBehaviors(forcedColorsStylesheetBehavior(css `
|
|
84
|
-
:host([aria-pressed='true'])
|
|
85
|
-
:host([aria-pressed='true'][appearance='primary'])
|
|
86
|
-
:host([aria-pressed='true'][appearance='subtle'])
|
|
87
|
-
:host([aria-pressed='true'][appearance='outline'])
|
|
88
|
-
:host([aria-pressed='true'][appearance='transparent'])
|
|
89
|
-
:host([aria-pressed='true'][appearance='transparent']) .control {
|
|
90
|
+
:host([aria-pressed='true']),
|
|
91
|
+
:host([aria-pressed='true'][appearance='primary']),
|
|
92
|
+
:host([aria-pressed='true'][appearance='subtle']),
|
|
93
|
+
:host([aria-pressed='true'][appearance='outline']),
|
|
94
|
+
:host([aria-pressed='true'][appearance='transparent']) {
|
|
90
95
|
background: SelectedItem;
|
|
91
96
|
color: SelectedItemText;
|
|
92
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-button.styles.js","sourceRoot":"","sources":["../../../src/toggle-button/toggle-button.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"toggle-button.styles.js","sourceRoot":"","sources":["../../../src/toggle-button/toggle-button.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,4BAA4B,EAC5B,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,uBAAuB,EACvB,iCAAiC,EACjC,mCAAmC,EACnC,oCAAoC,EACpC,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,6BAA6B,EAC7B,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EAClC,eAAe,GAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,8BAA8B,EAAE,MAAM,uDAAuD,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;IACrB,YAAY;;;oBAGI,mBAAmB;wBACf,+BAA+B;aAC1C,uBAAuB;oBAChB,eAAe;;;;oBAIf,wBAAwB;wBACpB,4BAA4B;;;;oBAIhC,0BAA0B;wBACtB,8BAA8B;;;;;wBAK9B,4BAA4B;aACvC,6BAA6B;;;;wBAIlB,yBAAyB;;;;wBAIzB,2BAA2B;;;;;wBAK3B,6BAA6B;aACxC,+BAA+B;;;;wBAIpB,0BAA0B;aACrC,4BAA4B;;;;wBAIjB,4BAA4B;aACvC,8BAA8B;;;;;wBAKnB,kCAAkC;;;;;wBAKlC,+BAA+B;;;;;wBAK/B,iCAAiC;;;;;aAK5C,oCAAoC;;;;aAIpC,iCAAiC;;;;aAIjC,mCAAmC;;CAE/C,CAAC,aAAa,CACb,8BAA8B,CAAC,GAAG,CAAA;;;;;;;;;GASjC,CAAC,CACH,CAAC"}
|