@fluentui/react-button 9.0.0-nightly.f81b28ceb3.1 → 9.0.0-rc.11
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +914 -24
- package/CHANGELOG.md +388 -180
- package/README.md +80 -18
- package/dist/{react-button.d.ts → index.d.ts} +72 -59
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/Button.js.map +1 -1
- package/lib/CompoundButton.js.map +1 -1
- package/lib/MenuButton.js.map +1 -1
- package/lib/SplitButton.js.map +1 -1
- package/lib/ToggleButton.js.map +1 -1
- package/lib/components/Button/Button.js +7 -7
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.js +1 -2
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.js +13 -9
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js +20 -25
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.js +240 -165
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.js +7 -7
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib/components/CompoundButton/index.js +1 -1
- package/lib/components/CompoundButton/index.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js +15 -9
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js +13 -8
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +96 -75
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +9 -8
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/index.js +1 -1
- package/lib/components/MenuButton/index.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js +13 -9
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js +11 -11
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js +39 -17
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.js +8 -8
- package/lib/components/SplitButton/SplitButton.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib/components/SplitButton/index.js +1 -1
- package/lib/components/SplitButton/index.js.map +1 -1
- package/lib/components/SplitButton/renderSplitButton.js +9 -7
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js +54 -49
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.js +46 -39
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.js +7 -7
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib/components/ToggleButton/index.js +1 -1
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js +5 -41
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js +110 -86
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib/index.js +6 -5
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/useToggleState.js +37 -0
- package/lib/utils/useToggleState.js.map +1 -0
- package/lib-commonjs/Button.js +1 -1
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/CompoundButton.js +1 -1
- package/lib-commonjs/CompoundButton.js.map +1 -1
- package/lib-commonjs/MenuButton.js +1 -1
- package/lib-commonjs/MenuButton.js.map +1 -1
- package/lib-commonjs/SplitButton.js +1 -1
- package/lib-commonjs/SplitButton.js.map +1 -1
- package/lib-commonjs/ToggleButton.js +1 -1
- package/lib-commonjs/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/Button/Button.js +8 -8
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/Button.types.js.map +1 -1
- package/lib-commonjs/components/Button/index.js +10 -6
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.js +17 -14
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js +24 -29
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.js +243 -166
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.js +8 -8
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.js +10 -4
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +19 -14
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +16 -12
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +99 -77
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.js +10 -9
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib-commonjs/components/MenuButton/index.js +10 -4
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +17 -14
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +15 -16
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +43 -19
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.js +9 -9
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib-commonjs/components/SplitButton/index.js +10 -4
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +13 -12
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js +58 -54
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +50 -42
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.js +8 -8
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.js +10 -4
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js +3 -3
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +7 -45
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +114 -86
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/index.js +169 -6
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js +10 -0
- package/lib-commonjs/utils/index.js.map +1 -0
- package/lib-commonjs/utils/useToggleState.js +48 -0
- package/lib-commonjs/utils/useToggleState.js.map +1 -0
- package/package.json +22 -27
- package/dist/demo/index.html +0 -71
- package/dist/demo/react-dom.development.js +0 -21413
- package/dist/demo/react.development.js +0 -3155
- package/lib/Button.d.ts +0 -1
- package/lib/CompoundButton.d.ts +0 -1
- package/lib/MenuButton.d.ts +0 -1
- package/lib/SplitButton.d.ts +0 -1
- package/lib/ToggleButton.d.ts +0 -1
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -13
- package/lib/common/isConformant.js.map +0 -1
- package/lib/components/Button/Button.d.ts +0 -6
- package/lib/components/Button/Button.types.d.ts +0 -62
- package/lib/components/Button/index.d.ts +0 -5
- package/lib/components/Button/renderButton.d.ts +0 -5
- package/lib/components/Button/useButton.d.ts +0 -8
- package/lib/components/Button/useButtonStyles.d.ts +0 -10
- package/lib/components/CompoundButton/CompoundButton.d.ts +0 -6
- package/lib/components/CompoundButton/CompoundButton.types.d.ts +0 -14
- package/lib/components/CompoundButton/index.d.ts +0 -5
- package/lib/components/CompoundButton/renderCompoundButton.d.ts +0 -5
- package/lib/components/CompoundButton/useCompoundButton.d.ts +0 -8
- package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -2
- package/lib/components/MenuButton/MenuButton.d.ts +0 -6
- package/lib/components/MenuButton/MenuButton.types.d.ts +0 -11
- package/lib/components/MenuButton/index.d.ts +0 -5
- package/lib/components/MenuButton/renderMenuButton.d.ts +0 -5
- package/lib/components/MenuButton/useMenuButton.d.ts +0 -6
- package/lib/components/MenuButton/useMenuButtonStyles.d.ts +0 -2
- package/lib/components/SplitButton/SplitButton.d.ts +0 -7
- package/lib/components/SplitButton/SplitButton.types.d.ts +0 -19
- package/lib/components/SplitButton/index.d.ts +0 -5
- package/lib/components/SplitButton/renderSplitButton.d.ts +0 -5
- package/lib/components/SplitButton/useSplitButton.d.ts +0 -8
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +0 -2
- package/lib/components/ToggleButton/ToggleButton.d.ts +0 -6
- package/lib/components/ToggleButton/ToggleButton.types.d.ts +0 -19
- package/lib/components/ToggleButton/index.d.ts +0 -5
- package/lib/components/ToggleButton/renderToggleButton.d.ts +0 -1
- package/lib/components/ToggleButton/useToggleButton.d.ts +0 -9
- package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +0 -2
- package/lib/index.d.ts +0 -5
- package/lib-commonjs/Button.d.ts +0 -1
- package/lib-commonjs/CompoundButton.d.ts +0 -1
- package/lib-commonjs/MenuButton.d.ts +0 -1
- package/lib-commonjs/SplitButton.d.ts +0 -1
- package/lib-commonjs/ToggleButton.d.ts +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -24
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/components/Button/Button.d.ts +0 -6
- package/lib-commonjs/components/Button/Button.types.d.ts +0 -62
- package/lib-commonjs/components/Button/index.d.ts +0 -5
- package/lib-commonjs/components/Button/renderButton.d.ts +0 -5
- package/lib-commonjs/components/Button/useButton.d.ts +0 -8
- package/lib-commonjs/components/Button/useButtonStyles.d.ts +0 -10
- package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +0 -6
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +0 -14
- package/lib-commonjs/components/CompoundButton/index.d.ts +0 -5
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +0 -5
- package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +0 -8
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -2
- package/lib-commonjs/components/MenuButton/MenuButton.d.ts +0 -6
- package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +0 -11
- package/lib-commonjs/components/MenuButton/index.d.ts +0 -5
- package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +0 -5
- package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +0 -6
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +0 -2
- package/lib-commonjs/components/SplitButton/SplitButton.d.ts +0 -7
- package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +0 -19
- package/lib-commonjs/components/SplitButton/index.d.ts +0 -5
- package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +0 -5
- package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +0 -8
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +0 -2
- package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +0 -6
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +0 -19
- package/lib-commonjs/components/ToggleButton/index.d.ts +0 -5
- package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +0 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +0 -9
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +0 -2
- package/lib-commonjs/index.d.ts +0 -5
@@ -3,128 +3,149 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.useToggleButtonStyles_unstable = exports.useDisabledStyles = exports.useCheckedStyles = exports.toggleButtonClassNames = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
|
9
9
|
|
10
|
-
|
10
|
+
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
11
11
|
|
12
|
-
|
12
|
+
const react_1 = /*#__PURE__*/require("@griffel/react");
|
13
|
+
|
14
|
+
const useButtonStyles_1 = /*#__PURE__*/require("../Button/useButtonStyles");
|
15
|
+
|
16
|
+
exports.toggleButtonClassNames = {
|
17
|
+
root: 'fui-ToggleButton',
|
18
|
+
icon: 'fui-ToggleButton__icon'
|
19
|
+
};
|
20
|
+
exports.useCheckedStyles = /*#__PURE__*/react_1.__styles({
|
13
21
|
"base": {
|
14
|
-
"
|
22
|
+
"De3pzq": "f1nfm20t",
|
15
23
|
"g2u3we": "fj3muxo",
|
16
24
|
"h3c5rm": ["f1akhkt", "f1lxtadh"],
|
17
25
|
"B9xav0g": "f1aperda",
|
18
26
|
"zhjwy3": ["f1lxtadh", "f1akhkt"],
|
19
|
-
"sj55zd": "
|
27
|
+
"sj55zd": "f14nttnl",
|
20
28
|
"B4j52fo": "f192inf7",
|
21
29
|
"Bekrc4i": ["f5tn483", "f1ojsxk5"],
|
22
30
|
"Bn0qgzm": "f1vxd6vx",
|
23
31
|
"ibv6hh": ["f1ojsxk5", "f5tn483"],
|
24
|
-
"
|
32
|
+
"D0sxk3": "fxoiby5",
|
33
|
+
"t6yez3": "f15q0o9g",
|
34
|
+
"Jwef8y": "f1knas48",
|
25
35
|
"Bgoe8wy": "fvcxoqz",
|
26
36
|
"Bwzppfd": ["f1ub3y4t", "f1m52nbi"],
|
27
37
|
"oetu4i": "f1xlaoq0",
|
28
38
|
"gg5e9n": ["f1m52nbi", "f1ub3y4t"],
|
29
|
-
"Bi91k9c": "
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"
|
39
|
+
"Bi91k9c": "feu1g3u",
|
40
|
+
"iro3zm": "f141de4g",
|
41
|
+
"b661bw": "f11v6sdu",
|
42
|
+
"Bk6r4ia": ["f9yn8i4", "f1ajwf28"],
|
43
|
+
"B9zn80p": "f1uwu36w",
|
44
|
+
"Bpld233": ["f1ajwf28", "f9yn8i4"],
|
45
|
+
"B2d53fq": "f9olfzr"
|
46
|
+
},
|
47
|
+
"highContrast": {
|
48
|
+
"Bjwas2f": "f132fbg1",
|
49
|
+
"Bn1d65q": ["f1ene5x0", "fzbc999"],
|
50
|
+
"Bxeuatn": "f6jgcol",
|
51
|
+
"n51gp8": ["fzbc999", "f1ene5x0"],
|
52
|
+
"Bbusuzp": "f1isslxv",
|
53
|
+
"G867l3": "fr7nen4",
|
54
|
+
"gdbnj": ["f10aq6ld", "fq8rgo9"],
|
55
|
+
"mxns5l": "f1md2qq2",
|
56
|
+
"o3nasb": ["fq8rgo9", "f10aq6ld"]
|
36
57
|
},
|
37
58
|
"outline": {
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
59
|
+
"De3pzq": "f1q9pm1r",
|
60
|
+
"Jwef8y": "fjxutwb",
|
61
|
+
"iro3zm": "fwiml72"
|
41
62
|
},
|
42
63
|
"primary": {
|
43
|
-
"
|
64
|
+
"De3pzq": "f8w4g0q",
|
44
65
|
"g2u3we": "f1p3nwhy",
|
45
66
|
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
46
67
|
"B9xav0g": "f1q5o8ev",
|
47
68
|
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
48
69
|
"sj55zd": "f1phragk",
|
49
|
-
"
|
70
|
+
"Jwef8y": "f15wkkf3",
|
50
71
|
"Bgoe8wy": "f1s2uweq",
|
51
72
|
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
52
73
|
"oetu4i": "f1ukrpxl",
|
53
74
|
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
54
75
|
"Bi91k9c": "f1rq72xc",
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
76
|
+
"iro3zm": "fnp9lpt",
|
77
|
+
"b661bw": "f1h0usnq",
|
78
|
+
"Bk6r4ia": ["fs4ktlq", "fx2bmrt"],
|
79
|
+
"B9zn80p": "f16h9ulv",
|
80
|
+
"Bpld233": ["fx2bmrt", "fs4ktlq"],
|
81
|
+
"B2d53fq": "f1d6v5y2"
|
61
82
|
},
|
83
|
+
"secondary": {},
|
62
84
|
"subtle": {
|
63
|
-
"
|
85
|
+
"De3pzq": "fq5gl1p",
|
64
86
|
"g2u3we": "f1p3nwhy",
|
65
87
|
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
66
88
|
"B9xav0g": "f1q5o8ev",
|
67
89
|
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
68
90
|
"sj55zd": "f1qj7y59",
|
69
|
-
"
|
91
|
+
"Jwef8y": "f1t94bn6",
|
70
92
|
"Bgoe8wy": "f1s2uweq",
|
71
93
|
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
72
94
|
"oetu4i": "f1ukrpxl",
|
73
95
|
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
74
96
|
"Bi91k9c": "f139oj5f",
|
75
|
-
"
|
76
|
-
"
|
77
|
-
"
|
78
|
-
"
|
79
|
-
"
|
80
|
-
"
|
97
|
+
"iro3zm": "fsv2rcd",
|
98
|
+
"b661bw": "f1h0usnq",
|
99
|
+
"Bk6r4ia": ["fs4ktlq", "fx2bmrt"],
|
100
|
+
"B9zn80p": "f16h9ulv",
|
101
|
+
"Bpld233": ["fx2bmrt", "fs4ktlq"],
|
102
|
+
"B2d53fq": "f1fg1p5m"
|
81
103
|
},
|
82
104
|
"transparent": {
|
83
|
-
"
|
105
|
+
"De3pzq": "f1q9pm1r",
|
84
106
|
"g2u3we": "f1p3nwhy",
|
85
107
|
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
86
108
|
"B9xav0g": "f1q5o8ev",
|
87
109
|
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
88
110
|
"sj55zd": "f1qj7y59",
|
89
|
-
"
|
111
|
+
"Jwef8y": "fjxutwb",
|
90
112
|
"Bgoe8wy": "f1s2uweq",
|
91
113
|
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
92
114
|
"oetu4i": "f1ukrpxl",
|
93
115
|
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
94
116
|
"Bi91k9c": "f139oj5f",
|
95
|
-
"
|
96
|
-
"
|
97
|
-
"
|
98
|
-
"
|
99
|
-
"
|
100
|
-
"
|
117
|
+
"iro3zm": "fwiml72",
|
118
|
+
"b661bw": "f1h0usnq",
|
119
|
+
"Bk6r4ia": ["fs4ktlq", "fx2bmrt"],
|
120
|
+
"B9zn80p": "f16h9ulv",
|
121
|
+
"Bpld233": ["fx2bmrt", "fs4ktlq"],
|
122
|
+
"B2d53fq": "f1fg1p5m"
|
101
123
|
}
|
102
124
|
}, {
|
103
|
-
"d": [".
|
104
|
-
"h": [".
|
105
|
-
"
|
125
|
+
"d": [".f1nfm20t{background-color:var(--colorNeutralBackground1Selected);}", ".fj3muxo{border-top-color:var(--colorNeutralStroke1);}", ".f1akhkt{border-right-color:var(--colorNeutralStroke1);}", ".f1lxtadh{border-left-color:var(--colorNeutralStroke1);}", ".f1aperda{border-bottom-color:var(--colorNeutralStroke1);}", ".f14nttnl{color:var(--colorNeutralForeground1Selected);}", ".f192inf7{border-top-width:var(--strokeWidthThin);}", ".f5tn483{border-right-width:var(--strokeWidthThin);}", ".f1ojsxk5{border-left-width:var(--strokeWidthThin);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".fxoiby5 .fui-Icon-filled{display:inline;}", ".f15q0o9g .fui-Icon-regular{display:none;}", ".f1q9pm1r{background-color:var(--colorTransparentBackgroundSelected);}", ".f8w4g0q{background-color:var(--colorBrandBackgroundSelected);}", ".f1p3nwhy{border-top-color:transparent;}", ".f11589ue{border-right-color:transparent;}", ".f1pdflbu{border-left-color:transparent;}", ".f1q5o8ev{border-bottom-color:transparent;}", ".f1phragk{color:var(--colorNeutralForegroundOnBrand);}", ".fq5gl1p{background-color:var(--colorSubtleBackgroundSelected);}", ".f1qj7y59{color:var(--colorNeutralForeground2BrandSelected);}"],
|
126
|
+
"h": [".f1knas48:hover{background-color:var(--colorNeutralBackground1Hover);}", ".fvcxoqz:hover{border-top-color:var(--colorNeutralStroke1Hover);}", ".f1ub3y4t:hover{border-right-color:var(--colorNeutralStroke1Hover);}", ".f1m52nbi:hover{border-left-color:var(--colorNeutralStroke1Hover);}", ".f1xlaoq0:hover{border-bottom-color:var(--colorNeutralStroke1Hover);}", ".feu1g3u:hover{color:var(--colorNeutralForeground1Hover);}", ".f141de4g:hover:active{background-color:var(--colorNeutralBackground1Pressed);}", ".f11v6sdu:hover:active{border-top-color:var(--colorNeutralStroke1Pressed);}", ".f9yn8i4:hover:active{border-right-color:var(--colorNeutralStroke1Pressed);}", ".f1ajwf28:hover:active{border-left-color:var(--colorNeutralStroke1Pressed);}", ".f1uwu36w:hover:active{border-bottom-color:var(--colorNeutralStroke1Pressed);}", ".f9olfzr:hover:active{color:var(--colorNeutralForeground1Pressed);}", ".fjxutwb:hover{background-color:var(--colorTransparentBackgroundHover);}", ".fwiml72:hover:active{background-color:var(--colorTransparentBackgroundPressed);}", ".f15wkkf3:hover{background-color:var(--colorBrandBackgroundHover);}", ".f1s2uweq:hover{border-top-color:transparent;}", ".fr80ssc:hover{border-right-color:transparent;}", ".fecsdlb:hover{border-left-color:transparent;}", ".f1ukrpxl:hover{border-bottom-color:transparent;}", ".f1rq72xc:hover{color:var(--colorNeutralForegroundOnBrand);}", ".fnp9lpt:hover:active{background-color:var(--colorBrandBackgroundPressed);}", ".f1h0usnq:hover:active{border-top-color:transparent;}", ".fs4ktlq:hover:active{border-right-color:transparent;}", ".fx2bmrt:hover:active{border-left-color:transparent;}", ".f16h9ulv:hover:active{border-bottom-color:transparent;}", ".f1d6v5y2:hover:active{color:var(--colorNeutralForegroundOnBrand);}", ".f1t94bn6:hover{background-color:var(--colorSubtleBackgroundHover);}", ".f139oj5f:hover{color:var(--colorNeutralForeground2BrandHover);}", ".fsv2rcd:hover:active{background-color:var(--colorSubtleBackgroundPressed);}", ".f1fg1p5m:hover:active{color:var(--colorNeutralForeground2BrandPressed);}"],
|
127
|
+
"t": ["@media (forced-colors: active){.f132fbg1{border-top-color:Highlight;}}", "@media (forced-colors: active){.f1ene5x0{border-right-color:Highlight;}.fzbc999{border-left-color:Highlight;}}", "@media (forced-colors: active){.f6jgcol{border-bottom-color:Highlight;}}", "@media (forced-colors: active){.fzbc999{border-left-color:Highlight;}.f1ene5x0{border-right-color:Highlight;}}", "@media (forced-colors: active){.f1isslxv{color:Highlight;}}", "@media (forced-colors: active){.fr7nen4:focus{border-top-color:Highlight;}}", "@media (forced-colors: active){.f10aq6ld:focus{border-right-color:Highlight;}.fq8rgo9:focus{border-left-color:Highlight;}}", "@media (forced-colors: active){.f1md2qq2:focus{border-bottom-color:Highlight;}}", "@media (forced-colors: active){.fq8rgo9:focus{border-left-color:Highlight;}.f10aq6ld:focus{border-right-color:Highlight;}}"]
|
106
128
|
});
|
107
|
-
|
108
|
-
var useDisabledStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
129
|
+
exports.useDisabledStyles = /*#__PURE__*/react_1.__styles({
|
109
130
|
"base": {
|
110
|
-
"
|
131
|
+
"De3pzq": "f1bg9a2p",
|
111
132
|
"g2u3we": "f1jj8ep1",
|
112
133
|
"h3c5rm": ["f15xbau", "fy0fskl"],
|
113
134
|
"B9xav0g": "f4ikngz",
|
114
135
|
"zhjwy3": ["fy0fskl", "f15xbau"],
|
115
136
|
"sj55zd": "f1s2aq7o",
|
116
|
-
"
|
137
|
+
"Jwef8y": "f1falr9n",
|
117
138
|
"Bgoe8wy": "f12mpcsy",
|
118
139
|
"Bwzppfd": ["f1gwvigk", "f18rmfxp"],
|
119
140
|
"oetu4i": "f1jnshp0",
|
120
141
|
"gg5e9n": ["f18rmfxp", "f1gwvigk"],
|
121
142
|
"Bi91k9c": "fvgxktp",
|
122
|
-
"
|
123
|
-
"
|
124
|
-
"
|
125
|
-
"
|
126
|
-
"
|
127
|
-
"
|
143
|
+
"iro3zm": "f1t6o4dc",
|
144
|
+
"b661bw": "f10ztigi",
|
145
|
+
"Bk6r4ia": ["f1ft5sdu", "f1gzf82w"],
|
146
|
+
"B9zn80p": "f12zbtn2",
|
147
|
+
"Bpld233": ["f1gzf82w", "f1ft5sdu"],
|
148
|
+
"B2d53fq": "fcvwxyo"
|
128
149
|
},
|
129
150
|
"outline": {},
|
130
151
|
"primary": {
|
@@ -136,65 +157,72 @@ var useDisabledStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
|
136
157
|
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
137
158
|
"oetu4i": "f1ukrpxl",
|
138
159
|
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
139
|
-
"
|
140
|
-
"
|
141
|
-
"
|
142
|
-
"
|
160
|
+
"b661bw": "f1h0usnq",
|
161
|
+
"Bk6r4ia": ["fs4ktlq", "fx2bmrt"],
|
162
|
+
"B9zn80p": "f16h9ulv",
|
163
|
+
"Bpld233": ["fx2bmrt", "fs4ktlq"]
|
143
164
|
},
|
165
|
+
"secondary": {},
|
144
166
|
"subtle": {
|
145
|
-
"
|
167
|
+
"De3pzq": "f3rmtva",
|
146
168
|
"g2u3we": "f1p3nwhy",
|
147
169
|
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
148
170
|
"B9xav0g": "f1q5o8ev",
|
149
171
|
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
150
|
-
"
|
172
|
+
"Jwef8y": "f1cio4g9",
|
151
173
|
"Bgoe8wy": "f1s2uweq",
|
152
174
|
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
153
175
|
"oetu4i": "f1ukrpxl",
|
154
176
|
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
155
|
-
"
|
156
|
-
"
|
157
|
-
"
|
158
|
-
"
|
159
|
-
"
|
177
|
+
"iro3zm": "fvaszet",
|
178
|
+
"b661bw": "f1h0usnq",
|
179
|
+
"Bk6r4ia": ["fs4ktlq", "fx2bmrt"],
|
180
|
+
"B9zn80p": "f16h9ulv",
|
181
|
+
"Bpld233": ["fx2bmrt", "fs4ktlq"]
|
160
182
|
},
|
161
183
|
"transparent": {
|
162
|
-
"
|
184
|
+
"De3pzq": "f3rmtva",
|
163
185
|
"g2u3we": "f1p3nwhy",
|
164
186
|
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
165
187
|
"B9xav0g": "f1q5o8ev",
|
166
188
|
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
167
|
-
"
|
189
|
+
"Jwef8y": "f1cio4g9",
|
168
190
|
"Bgoe8wy": "f1s2uweq",
|
169
191
|
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
170
192
|
"oetu4i": "f1ukrpxl",
|
171
193
|
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
172
|
-
"
|
173
|
-
"
|
174
|
-
"
|
175
|
-
"
|
176
|
-
"
|
194
|
+
"iro3zm": "fvaszet",
|
195
|
+
"b661bw": "f1h0usnq",
|
196
|
+
"Bk6r4ia": ["fs4ktlq", "fx2bmrt"],
|
197
|
+
"B9zn80p": "f16h9ulv",
|
198
|
+
"Bpld233": ["fx2bmrt", "fs4ktlq"]
|
177
199
|
}
|
178
200
|
}, {
|
179
|
-
"d": [".
|
180
|
-
"h": [".
|
181
|
-
"a": [".fkqx3al:active{background:var(--colorNeutralBackgroundDisabled);}", ".fdi4vxw:active{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f4ryxzl:active{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fkdgpbx:active{border-left-color:var(--colorNeutralStrokeDisabled);}", ".fcmhn06:active{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".f19wldhg:active{color:var(--colorNeutralForegroundDisabled);}", ".ff472gp:active{border-top-color:transparent;}", ".f4yyc7m:active{border-right-color:transparent;}", ".ft2aflc:active{border-left-color:transparent;}", ".fggejwh:active{border-bottom-color:transparent;}", ".f17oliv9:active{background:none;}"]
|
201
|
+
"d": [".f1bg9a2p{background-color:var(--colorNeutralBackgroundDisabled);}", ".f1jj8ep1{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f15xbau{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fy0fskl{border-left-color:var(--colorNeutralStrokeDisabled);}", ".f4ikngz{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".f1p3nwhy{border-top-color:transparent;}", ".f11589ue{border-right-color:transparent;}", ".f1pdflbu{border-left-color:transparent;}", ".f1q5o8ev{border-bottom-color:transparent;}", ".f3rmtva{background-color:transparent;}"],
|
202
|
+
"h": [".f1falr9n:hover{background-color:var(--colorNeutralBackgroundDisabled);}", ".f12mpcsy:hover{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f1gwvigk:hover{border-right-color:var(--colorNeutralStrokeDisabled);}", ".f18rmfxp:hover{border-left-color:var(--colorNeutralStrokeDisabled);}", ".f1jnshp0:hover{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".fvgxktp:hover{color:var(--colorNeutralForegroundDisabled);}", ".f1t6o4dc:hover:active{background-color:var(--colorNeutralBackgroundDisabled);}", ".f10ztigi:hover:active{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f1ft5sdu:hover:active{border-right-color:var(--colorNeutralStrokeDisabled);}", ".f1gzf82w:hover:active{border-left-color:var(--colorNeutralStrokeDisabled);}", ".f12zbtn2:hover:active{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".fcvwxyo:hover:active{color:var(--colorNeutralForegroundDisabled);}", ".f1s2uweq:hover{border-top-color:transparent;}", ".fr80ssc:hover{border-right-color:transparent;}", ".fecsdlb:hover{border-left-color:transparent;}", ".f1ukrpxl:hover{border-bottom-color:transparent;}", ".f1h0usnq:hover:active{border-top-color:transparent;}", ".fs4ktlq:hover:active{border-right-color:transparent;}", ".fx2bmrt:hover:active{border-left-color:transparent;}", ".f16h9ulv:hover:active{border-bottom-color:transparent;}", ".f1cio4g9:hover{background-color:transparent;}", ".fvaszet:hover:active{background-color:transparent;}"]
|
182
203
|
});
|
183
204
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
205
|
+
const useToggleButtonStyles_unstable = state => {
|
206
|
+
const checkedStyles = exports.useCheckedStyles();
|
207
|
+
const disabledStyles = exports.useDisabledStyles();
|
208
|
+
const {
|
209
|
+
appearance,
|
210
|
+
checked,
|
211
|
+
disabled,
|
212
|
+
disabledFocusable
|
213
|
+
} = state;
|
214
|
+
state.root.className = react_1.mergeClasses(exports.toggleButtonClassNames.root, // Checked styles
|
215
|
+
checked && checkedStyles.base, checked && checkedStyles.highContrast, appearance && checked && checkedStyles[appearance], // Disabled styles
|
193
216
|
(disabled || disabledFocusable) && disabledStyles.base, appearance && (disabled || disabledFocusable) && disabledStyles[appearance], // User provided class name
|
194
217
|
state.root.className);
|
195
|
-
|
218
|
+
|
219
|
+
if (state.icon) {
|
220
|
+
state.icon.className = react_1.mergeClasses(exports.toggleButtonClassNames.icon, state.icon.className);
|
221
|
+
}
|
222
|
+
|
223
|
+
useButtonStyles_1.useButtonStyles_unstable(state);
|
196
224
|
return state;
|
197
225
|
};
|
198
226
|
|
199
|
-
exports.
|
227
|
+
exports.useToggleButtonStyles_unstable = useToggleButtonStyles_unstable;
|
200
228
|
//# sourceMappingURL=useToggleButtonStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/ToggleButton/useToggleButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAKa,OAAA,CAAA,sBAAA,GAAsD;AACjE,EAAA,IAAI,EAAE,kBAD2D;AAEjE,EAAA,IAAI,EAAE;AAF2D,CAAtD;AAKA,OAAA,CAAA,gBAAA,gBAAmB,OAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,sBAAA,CAAuB,IADF,EAGrB;AACA,EAAA,OAAO,IAAI,aAAa,CAAC,IAJJ,EAKrB,OAAO,IAAI,aAAa,CAAC,YALJ,EAMrB,UAAU,IAAI,OAAd,IAAyB,aAAa,CAAC,UAAD,CANjB,EAQrB;AACA,GAAC,QAAQ,IAAI,iBAAb,KAAmC,cAAc,CAAC,IAT7B,EAUrB,UAAU,KAAK,QAAQ,IAAI,iBAAjB,CAAV,IAAiD,cAAc,CAAC,UAAD,CAV1C,EAYrB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAbU,CAAvB;;AAgBA,MAAI,KAAK,CAAC,IAAV,EAAgB;AACd,IAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,sBAAA,CAAuB,IAApC,EAA0C,KAAK,CAAC,IAAN,CAAW,SAArD,CAAvB;AACD;;AAED,EAAA,iBAAA,CAAA,wBAAA,CAAyB,KAAzB;AAEA,SAAO,KAAP;AACD,CA7BM;;AAAM,OAAA,CAAA,8BAAA,GAA8B,8BAA9B","sourcesContent":["import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { tokens } from '@fluentui/react-theme';\nimport { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ButtonSlots } from '../Button/Button.types';\nimport type { ToggleButtonState } from './ToggleButton.types';\n\nexport const toggleButtonClassNames: SlotClassNames<ButtonSlots> = {\n root: 'fui-ToggleButton',\n icon: 'fui-ToggleButton__icon',\n};\n\nexport const useCheckedStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n color: tokens.colorNeutralForeground1Selected,\n\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n color: tokens.colorNeutralForeground1Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n color: tokens.colorNeutralForeground1Pressed,\n },\n },\n\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('Highlight'),\n color: 'Highlight',\n\n ':focus': {\n ...shorthands.borderColor('Highlight'),\n },\n },\n },\n\n // Appearance variations\n outline: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n },\n },\n primary: {\n backgroundColor: tokens.colorBrandBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n\n ':hover': {\n backgroundColor: tokens.colorBrandBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorBrandBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandSelected,\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandSelected,\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandHover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n ...shorthands.borderColor('transparent'),\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n});\n\nexport const useDisabledStyles = makeStyles({\n // Base styles\n base: {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackgroundDisabled,\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n ...shorthands.borderColor('transparent'),\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n backgroundColor: 'transparent',\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: 'transparent',\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: 'transparent',\n ...shorthands.borderColor('transparent'),\n },\n },\n transparent: {\n backgroundColor: 'transparent',\n ...shorthands.borderColor('transparent'),\n\n ':hover': {\n backgroundColor: 'transparent',\n ...shorthands.borderColor('transparent'),\n },\n\n ':hover:active': {\n backgroundColor: 'transparent',\n ...shorthands.borderColor('transparent'),\n },\n },\n});\n\nexport const useToggleButtonStyles_unstable = (state: ToggleButtonState): ToggleButtonState => {\n const checkedStyles = useCheckedStyles();\n const disabledStyles = useDisabledStyles();\n\n const { appearance, checked, disabled, disabledFocusable } = state;\n\n state.root.className = mergeClasses(\n toggleButtonClassNames.root,\n\n // Checked styles\n checked && checkedStyles.base,\n checked && checkedStyles.highContrast,\n appearance && checked && checkedStyles[appearance],\n\n // Disabled styles\n (disabled || disabledFocusable) && disabledStyles.base,\n appearance && (disabled || disabledFocusable) && disabledStyles[appearance],\n\n // User provided class name\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(toggleButtonClassNames.icon, state.icon.className);\n }\n\n useButtonStyles_unstable(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
package/lib-commonjs/index.js
CHANGED
@@ -3,16 +3,179 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.useToggleState = exports.useToggleButton_unstable = exports.useToggleButtonStyles_unstable = exports.toggleButtonClassNames = exports.renderToggleButton_unstable = exports.ToggleButton = exports.useSplitButton_unstable = exports.useSplitButtonStyles_unstable = exports.splitButtonClassNames = exports.renderSplitButton_unstable = exports.SplitButton = exports.useMenuButton_unstable = exports.useMenuButtonStyles_unstable = exports.renderMenuButton_unstable = exports.menuButtonClassNames = exports.MenuButton = exports.useCompoundButton_unstable = exports.useCompoundButtonStyles_unstable = exports.renderCompoundButton_unstable = exports.compoundButtonClassNames = exports.CompoundButton = exports.useButton_unstable = exports.useButtonStyles_unstable = exports.renderButton_unstable = exports.buttonClassNames = exports.Button = void 0;
|
6
7
|
|
7
|
-
var
|
8
|
+
var Button_1 = /*#__PURE__*/require("./Button");
|
8
9
|
|
9
|
-
|
10
|
+
Object.defineProperty(exports, "Button", {
|
11
|
+
enumerable: true,
|
12
|
+
get: function () {
|
13
|
+
return Button_1.Button;
|
14
|
+
}
|
15
|
+
});
|
16
|
+
Object.defineProperty(exports, "buttonClassNames", {
|
17
|
+
enumerable: true,
|
18
|
+
get: function () {
|
19
|
+
return Button_1.buttonClassNames;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
Object.defineProperty(exports, "renderButton_unstable", {
|
23
|
+
enumerable: true,
|
24
|
+
get: function () {
|
25
|
+
return Button_1.renderButton_unstable;
|
26
|
+
}
|
27
|
+
});
|
28
|
+
Object.defineProperty(exports, "useButtonStyles_unstable", {
|
29
|
+
enumerable: true,
|
30
|
+
get: function () {
|
31
|
+
return Button_1.useButtonStyles_unstable;
|
32
|
+
}
|
33
|
+
});
|
34
|
+
Object.defineProperty(exports, "useButton_unstable", {
|
35
|
+
enumerable: true,
|
36
|
+
get: function () {
|
37
|
+
return Button_1.useButton_unstable;
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
var CompoundButton_1 = /*#__PURE__*/require("./CompoundButton");
|
42
|
+
|
43
|
+
Object.defineProperty(exports, "CompoundButton", {
|
44
|
+
enumerable: true,
|
45
|
+
get: function () {
|
46
|
+
return CompoundButton_1.CompoundButton;
|
47
|
+
}
|
48
|
+
});
|
49
|
+
Object.defineProperty(exports, "compoundButtonClassNames", {
|
50
|
+
enumerable: true,
|
51
|
+
get: function () {
|
52
|
+
return CompoundButton_1.compoundButtonClassNames;
|
53
|
+
}
|
54
|
+
});
|
55
|
+
Object.defineProperty(exports, "renderCompoundButton_unstable", {
|
56
|
+
enumerable: true,
|
57
|
+
get: function () {
|
58
|
+
return CompoundButton_1.renderCompoundButton_unstable;
|
59
|
+
}
|
60
|
+
});
|
61
|
+
Object.defineProperty(exports, "useCompoundButtonStyles_unstable", {
|
62
|
+
enumerable: true,
|
63
|
+
get: function () {
|
64
|
+
return CompoundButton_1.useCompoundButtonStyles_unstable;
|
65
|
+
}
|
66
|
+
});
|
67
|
+
Object.defineProperty(exports, "useCompoundButton_unstable", {
|
68
|
+
enumerable: true,
|
69
|
+
get: function () {
|
70
|
+
return CompoundButton_1.useCompoundButton_unstable;
|
71
|
+
}
|
72
|
+
});
|
73
|
+
|
74
|
+
var MenuButton_1 = /*#__PURE__*/require("./MenuButton");
|
75
|
+
|
76
|
+
Object.defineProperty(exports, "MenuButton", {
|
77
|
+
enumerable: true,
|
78
|
+
get: function () {
|
79
|
+
return MenuButton_1.MenuButton;
|
80
|
+
}
|
81
|
+
});
|
82
|
+
Object.defineProperty(exports, "menuButtonClassNames", {
|
83
|
+
enumerable: true,
|
84
|
+
get: function () {
|
85
|
+
return MenuButton_1.menuButtonClassNames;
|
86
|
+
}
|
87
|
+
});
|
88
|
+
Object.defineProperty(exports, "renderMenuButton_unstable", {
|
89
|
+
enumerable: true,
|
90
|
+
get: function () {
|
91
|
+
return MenuButton_1.renderMenuButton_unstable;
|
92
|
+
}
|
93
|
+
});
|
94
|
+
Object.defineProperty(exports, "useMenuButtonStyles_unstable", {
|
95
|
+
enumerable: true,
|
96
|
+
get: function () {
|
97
|
+
return MenuButton_1.useMenuButtonStyles_unstable;
|
98
|
+
}
|
99
|
+
});
|
100
|
+
Object.defineProperty(exports, "useMenuButton_unstable", {
|
101
|
+
enumerable: true,
|
102
|
+
get: function () {
|
103
|
+
return MenuButton_1.useMenuButton_unstable;
|
104
|
+
}
|
105
|
+
});
|
106
|
+
|
107
|
+
var SplitButton_1 = /*#__PURE__*/require("./SplitButton");
|
108
|
+
|
109
|
+
Object.defineProperty(exports, "SplitButton", {
|
110
|
+
enumerable: true,
|
111
|
+
get: function () {
|
112
|
+
return SplitButton_1.SplitButton;
|
113
|
+
}
|
114
|
+
});
|
115
|
+
Object.defineProperty(exports, "renderSplitButton_unstable", {
|
116
|
+
enumerable: true,
|
117
|
+
get: function () {
|
118
|
+
return SplitButton_1.renderSplitButton_unstable;
|
119
|
+
}
|
120
|
+
});
|
121
|
+
Object.defineProperty(exports, "splitButtonClassNames", {
|
122
|
+
enumerable: true,
|
123
|
+
get: function () {
|
124
|
+
return SplitButton_1.splitButtonClassNames;
|
125
|
+
}
|
126
|
+
});
|
127
|
+
Object.defineProperty(exports, "useSplitButtonStyles_unstable", {
|
128
|
+
enumerable: true,
|
129
|
+
get: function () {
|
130
|
+
return SplitButton_1.useSplitButtonStyles_unstable;
|
131
|
+
}
|
132
|
+
});
|
133
|
+
Object.defineProperty(exports, "useSplitButton_unstable", {
|
134
|
+
enumerable: true,
|
135
|
+
get: function () {
|
136
|
+
return SplitButton_1.useSplitButton_unstable;
|
137
|
+
}
|
138
|
+
});
|
10
139
|
|
11
|
-
|
140
|
+
var ToggleButton_1 = /*#__PURE__*/require("./ToggleButton");
|
12
141
|
|
13
|
-
|
142
|
+
Object.defineProperty(exports, "ToggleButton", {
|
143
|
+
enumerable: true,
|
144
|
+
get: function () {
|
145
|
+
return ToggleButton_1.ToggleButton;
|
146
|
+
}
|
147
|
+
});
|
148
|
+
Object.defineProperty(exports, "renderToggleButton_unstable", {
|
149
|
+
enumerable: true,
|
150
|
+
get: function () {
|
151
|
+
return ToggleButton_1.renderToggleButton_unstable;
|
152
|
+
}
|
153
|
+
});
|
154
|
+
Object.defineProperty(exports, "toggleButtonClassNames", {
|
155
|
+
enumerable: true,
|
156
|
+
get: function () {
|
157
|
+
return ToggleButton_1.toggleButtonClassNames;
|
158
|
+
}
|
159
|
+
});
|
160
|
+
Object.defineProperty(exports, "useToggleButtonStyles_unstable", {
|
161
|
+
enumerable: true,
|
162
|
+
get: function () {
|
163
|
+
return ToggleButton_1.useToggleButtonStyles_unstable;
|
164
|
+
}
|
165
|
+
});
|
166
|
+
Object.defineProperty(exports, "useToggleButton_unstable", {
|
167
|
+
enumerable: true,
|
168
|
+
get: function () {
|
169
|
+
return ToggleButton_1.useToggleButton_unstable;
|
170
|
+
}
|
171
|
+
});
|
14
172
|
|
15
|
-
|
173
|
+
var index_1 = /*#__PURE__*/require("./utils/index");
|
16
174
|
|
17
|
-
|
175
|
+
Object.defineProperty(exports, "useToggleState", {
|
176
|
+
enumerable: true,
|
177
|
+
get: function () {
|
178
|
+
return index_1.useToggleState;
|
179
|
+
}
|
180
|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AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,cAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,cAAA,CAAA,YAAA;AAAY;AAAZ,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,6BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,cAAA,CAAA,2BAAA;AAA2B;AAA3B,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,cAAA,CAAA,sBAAA;AAAsB;AAAtB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,gCAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,cAAA,CAAA,8BAAA;AAA8B;AAA9B,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,0BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,cAAA,CAAA,wBAAA;AAAwB;AAAxB,CAAA;;AAIF,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,gBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,OAAA,CAAA,cAAA;AAAc;AAAd,CAAA","sourcesContent":["export {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './Button';\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './CompoundButton';\nexport type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './CompoundButton';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './MenuButton';\nexport type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './MenuButton';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './SplitButton';\nexport type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './SplitButton';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './ToggleButton';\nexport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton';\n\nexport { useToggleState } from './utils/index';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './useToggleState';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useToggleState = void 0;
|
7
|
+
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
|
+
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
|
+
|
12
|
+
function useToggleState(props, state) {
|
13
|
+
const {
|
14
|
+
checked,
|
15
|
+
defaultChecked,
|
16
|
+
disabled,
|
17
|
+
disabledFocusable
|
18
|
+
} = props;
|
19
|
+
const {
|
20
|
+
onClick,
|
21
|
+
role
|
22
|
+
} = state.root;
|
23
|
+
const [checkedValue, setCheckedValue] = react_utilities_1.useControllableState({
|
24
|
+
state: checked,
|
25
|
+
defaultState: defaultChecked,
|
26
|
+
initialState: false
|
27
|
+
});
|
28
|
+
const isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';
|
29
|
+
const onToggleClick = React.useCallback(ev => {
|
30
|
+
if (!disabled && !disabledFocusable) {
|
31
|
+
if (ev.defaultPrevented) {
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
|
35
|
+
setCheckedValue(!checkedValue);
|
36
|
+
}
|
37
|
+
}, [checkedValue, disabled, disabledFocusable, setCheckedValue]);
|
38
|
+
return { ...state,
|
39
|
+
checked: checkedValue,
|
40
|
+
root: { ...state.root,
|
41
|
+
[isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,
|
42
|
+
onClick: react_utilities_1.useMergedEventCallbacks(onClick, onToggleClick)
|
43
|
+
}
|
44
|
+
};
|
45
|
+
}
|
46
|
+
|
47
|
+
exports.useToggleState = useToggleState;
|
48
|
+
//# sourceMappingURL=useToggleState.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["utils/useToggleState.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAIA,SAAgB,cAAhB,CAIE,KAJF,EAI6B,KAJ7B,EAIgD;AAC9C,QAAM;AAAE,IAAA,OAAF;AAAW,IAAA,cAAX;AAA2B,IAAA,QAA3B;AAAqC,IAAA;AAArC,MAA2D,KAAjE;AACA,QAAM;AAAE,IAAA,OAAF;AAAW,IAAA;AAAX,MAAoB,KAAK,CAAC,IAAhC;AAEA,QAAM,CAAC,YAAD,EAAe,eAAf,IAAkC,iBAAA,CAAA,oBAAA,CAAqB;AAC3D,IAAA,KAAK,EAAE,OADoD;AAE3D,IAAA,YAAY,EAAE,cAF6C;AAG3D,IAAA,YAAY,EAAE;AAH6C,GAArB,CAAxC;AAMA,QAAM,kBAAkB,GAAG,IAAI,KAAK,kBAAT,IAA+B,IAAI,KAAK,UAAnE;AAEA,QAAM,aAAa,GAAG,KAAK,CAAC,WAAN,CACpB,EAAE,IAAG;AACH,QAAI,CAAC,QAAD,IAAa,CAAC,iBAAlB,EAAqC;AACnC,UAAI,EAAE,CAAC,gBAAP,EAAyB;AACvB;AACD;;AAED,MAAA,eAAe,CAAC,CAAC,YAAF,CAAf;AACD;AACF,GATmB,EAUpB,CAAC,YAAD,EAAe,QAAf,EAAyB,iBAAzB,EAA4C,eAA5C,CAVoB,CAAtB;AAaA,SAAO,EACL,GAAG,KADE;AAGL,IAAA,OAAO,EAAE,YAHJ;AAKL,IAAA,IAAI,EAAE,EACJ,GAAG,KAAK,CAAC,IADL;AAEJ,OAAC,kBAAkB,GAAG,cAAH,GAAoB,cAAvC,GAAwD,YAFpD;AAGJ,MAAA,OAAO,EAAE,iBAAA,CAAA,uBAAA,CACP,OADO,EAEP,aAFO;AAHL;AALD,GAAP;AAcD;;AA3CD,OAAA,CAAA,cAAA,GAAA,cAAA","sourcesContent":["import * as React from 'react';\nimport { useControllableState, useMergedEventCallbacks } from '@fluentui/react-utilities';\nimport type { ButtonState } from '../Button';\nimport type { ToggleButtonProps, ToggleButtonState } from '../ToggleButton';\n\nexport function useToggleState<\n TToggleButtonProps extends Pick<ToggleButtonProps, 'checked' | 'defaultChecked' | 'disabled' | 'disabledFocusable'>,\n TButtonState extends Pick<ButtonState, 'root'>,\n TToggleButtonState extends Pick<ToggleButtonState, 'checked' | 'root'>\n>(props: TToggleButtonProps, state: TButtonState): TToggleButtonState {\n const { checked, defaultChecked, disabled, disabledFocusable } = props;\n const { onClick, role } = state.root;\n\n const [checkedValue, setCheckedValue] = useControllableState({\n state: checked,\n defaultState: defaultChecked,\n initialState: false,\n });\n\n const isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';\n\n const onToggleClick = React.useCallback(\n ev => {\n if (!disabled && !disabledFocusable) {\n if (ev.defaultPrevented) {\n return;\n }\n\n setCheckedValue(!checkedValue);\n }\n },\n [checkedValue, disabled, disabledFocusable, setCheckedValue],\n );\n\n return {\n ...state,\n\n checked: checkedValue,\n\n root: {\n ...state.root,\n [isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed']: checkedValue,\n onClick: useMergedEventCallbacks(\n onClick as React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>,\n onToggleClick,\n ),\n },\n } as TToggleButtonState;\n}\n"],"sourceRoot":"../src/"}
|