@fluentui/react-spinbutton 9.1.5 → 9.1.7
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +37 -1
- package/CHANGELOG.md +21 -2
- package/lib/components/SpinButton/useSpinButtonStyles.js +61 -149
- package/lib/components/SpinButton/useSpinButtonStyles.js.map +1 -1
- package/lib-amd/components/SpinButton/useSpinButtonStyles.js +195 -87
- package/lib-amd/components/SpinButton/useSpinButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.js +59 -147
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.js.map +1 -1
- package/package.json +1 -2
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,43 @@
|
|
2
2
|
"name": "@fluentui/react-spinbutton",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "Wed,
|
5
|
+
"date": "Wed, 22 Feb 2023 23:04:48 GMT",
|
6
|
+
"tag": "@fluentui/react-spinbutton_v9.1.7",
|
7
|
+
"version": "9.1.7",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "seanmonahan@microsoft.com",
|
12
|
+
"package": "@fluentui/react-spinbutton",
|
13
|
+
"commit": "db5fb4be3ed35b18b4874750fe6ad286fb5e41fc",
|
14
|
+
"comment": "chore: update SpinButton to use makeResetStyles"
|
15
|
+
}
|
16
|
+
]
|
17
|
+
}
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"date": "Thu, 16 Feb 2023 19:18:48 GMT",
|
21
|
+
"tag": "@fluentui/react-spinbutton_v9.1.6",
|
22
|
+
"version": "9.1.6",
|
23
|
+
"comments": {
|
24
|
+
"patch": [
|
25
|
+
{
|
26
|
+
"author": "mgodbolt@microsoft.com",
|
27
|
+
"package": "@fluentui/react-spinbutton",
|
28
|
+
"commit": "c6f47613e95f8e43ef00792ea673d673881e14fb",
|
29
|
+
"comment": "fixing build issues"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"author": "beachball",
|
33
|
+
"package": "@fluentui/react-spinbutton",
|
34
|
+
"comment": "Bump @fluentui/react-input to v9.3.6",
|
35
|
+
"commit": "ca757212da6f77eb0bfe18cf7bfcc8bbab2a5da5"
|
36
|
+
}
|
37
|
+
]
|
38
|
+
}
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"date": "Thu, 16 Feb 2023 16:18:01 GMT",
|
6
42
|
"tag": "@fluentui/react-spinbutton_v9.1.5",
|
7
43
|
"version": "9.1.5",
|
8
44
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,31 @@
|
|
1
1
|
# Change Log - @fluentui/react-spinbutton
|
2
2
|
|
3
|
-
This log was last generated on Wed,
|
3
|
+
This log was last generated on Wed, 22 Feb 2023 23:04:48 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.1.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.1.7)
|
8
|
+
|
9
|
+
Wed, 22 Feb 2023 23:04:48 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.1.6..@fluentui/react-spinbutton_v9.1.7)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- chore: update SpinButton to use makeResetStyles ([PR #26867](https://github.com/microsoft/fluentui/pull/26867) by seanmonahan@microsoft.com)
|
15
|
+
|
16
|
+
## [9.1.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.1.6)
|
17
|
+
|
18
|
+
Thu, 16 Feb 2023 19:18:48 GMT
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.1.5..@fluentui/react-spinbutton_v9.1.6)
|
20
|
+
|
21
|
+
### Patches
|
22
|
+
|
23
|
+
- fixing build issues ([PR #26877](https://github.com/microsoft/fluentui/pull/26877) by mgodbolt@microsoft.com)
|
24
|
+
- Bump @fluentui/react-input to v9.3.6 ([PR #26842](https://github.com/microsoft/fluentui/pull/26842) by beachball)
|
25
|
+
|
7
26
|
## [9.1.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.1.5)
|
8
27
|
|
9
|
-
|
28
|
+
Thu, 16 Feb 2023 16:18:01 GMT
|
10
29
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.1.4..@fluentui/react-spinbutton_v9.1.5)
|
11
30
|
|
12
31
|
### Patches
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { __styles, mergeClasses, shorthands } from '@griffel/react';
|
2
|
-
import { tokens } from '@fluentui/react-theme';
|
3
|
-
import { useInputStyles_unstable } from '@fluentui/react-input';
|
1
|
+
import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';
|
2
|
+
import { tokens, typographyStyles } from '@fluentui/react-theme';
|
4
3
|
export const spinButtonClassNames = {
|
5
4
|
root: 'fui-SpinButton',
|
6
5
|
input: 'fui-SpinButton__input',
|
@@ -10,56 +9,22 @@ export const spinButtonClassNames = {
|
|
10
9
|
const spinButtonExtraClassNames = {
|
11
10
|
buttonActive: 'fui-SpinButton__button_active'
|
12
11
|
};
|
12
|
+
const fieldHeights = {
|
13
|
+
small: '24px',
|
14
|
+
medium: '32px'
|
15
|
+
};
|
16
|
+
const useRootClassName = /*#__PURE__*/__resetStyles("rkqmps4", "r1trw52p", [".rkqmps4{display:inline-grid;grid-template-columns:1fr 24px;grid-template-rows:1fr 1fr;-webkit-column-gap:var(--spacingHorizontalXS);column-gap:var(--spacingHorizontalXS);row-gap:0;position:relative;isolation:isolate;background-color:var(--colorNeutralBackground1);min-height:32px;padding:0 0 0 var(--spacingHorizontalMNudge);border-radius:var(--borderRadiusMedium);}", ".rkqmps4::before{content:\"\";box-sizing:border-box;position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;z-index:10;border:1px solid var(--colorNeutralStroke1);border-bottom-color:var(--colorNeutralStrokeAccessible);border-radius:var(--borderRadiusMedium);}", ".rkqmps4::after{box-sizing:border-box;content:\"\";position:absolute;right:0;bottom:0;left:0;z-index:20;height:max(2px, var(--borderRadiusMedium));border-bottom-left-radius:var(--borderRadiusMedium);border-bottom-right-radius:var(--borderRadiusMedium);border-bottom:2px solid var(--colorCompoundBrandStroke);-webkit-clip-path:inset(calc(100% - 2px) 0 0 0);clip-path:inset(calc(100% - 2px) 0 0 0);-webkit-transform:scaleX(0);-moz-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);transition-property:transform;transition-duration:var(--durationUltraFast);transition-delay:var(--curveAccelerateMid);}", "@media screen and (prefers-reduced-motion: reduce){.rkqmps4::after{transition-duration:0.01ms;transition-delay:0.01ms;}}", ".rkqmps4:focus-within::after{-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);transition-property:transform;transition-duration:var(--durationNormal);transition-delay:var(--curveDecelerateMid);}", "@media screen and (prefers-reduced-motion: reduce){.rkqmps4:focus-within::after{transition-duration:0.01ms;transition-delay:0.01ms;}}", ".rkqmps4:focus-within:active::after{border-bottom-color:var(--colorCompoundBrandStrokePressed);}", ".rkqmps4:focus-within{outline:2px solid transparent;}", ".r1trw52p{display:inline-grid;grid-template-columns:1fr 24px;grid-template-rows:1fr 1fr;-webkit-column-gap:var(--spacingHorizontalXS);column-gap:var(--spacingHorizontalXS);row-gap:0;position:relative;isolation:isolate;background-color:var(--colorNeutralBackground1);min-height:32px;padding:0 var(--spacingHorizontalMNudge) 0 0;border-radius:var(--borderRadiusMedium);}", ".r1trw52p::before{content:\"\";box-sizing:border-box;position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none;z-index:10;border:1px solid var(--colorNeutralStroke1);border-bottom-color:var(--colorNeutralStrokeAccessible);border-radius:var(--borderRadiusMedium);}", ".r1trw52p::after{box-sizing:border-box;content:\"\";position:absolute;left:0;bottom:0;right:0;z-index:20;height:max(2px, var(--borderRadiusMedium));border-bottom-right-radius:var(--borderRadiusMedium);border-bottom-left-radius:var(--borderRadiusMedium);border-bottom:2px solid var(--colorCompoundBrandStroke);-webkit-clip-path:inset(calc(100% - 2px) 0 0 0);clip-path:inset(calc(100% - 2px) 0 0 0);-webkit-transform:scaleX(0);-moz-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);transition-property:transform;transition-duration:var(--durationUltraFast);transition-delay:var(--curveAccelerateMid);}", "@media screen and (prefers-reduced-motion: reduce){.r1trw52p::after{transition-duration:0.01ms;transition-delay:0.01ms;}}", ".r1trw52p:focus-within::after{-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1);transition-property:transform;transition-duration:var(--durationNormal);transition-delay:var(--curveDecelerateMid);}", "@media screen and (prefers-reduced-motion: reduce){.r1trw52p:focus-within::after{transition-duration:0.01ms;transition-delay:0.01ms;}}", ".r1trw52p:focus-within:active::after{border-bottom-color:var(--colorCompoundBrandStrokePressed);}", ".r1trw52p:focus-within{outline:2px solid transparent;}"]);
|
13
17
|
const useRootStyles = /*#__PURE__*/__styles({
|
14
|
-
base: {
|
15
|
-
mc9l5x: "fwk3njj",
|
16
|
-
Budl1dq: "f1sr6ibj",
|
17
|
-
wkccdc: "fio9c21",
|
18
|
-
i8kkvl: "f1ufnopg",
|
19
|
-
Belr9w4: "f1sff6ri",
|
20
|
-
z189sj: ["fhxju0i", "f1cnd47f"],
|
21
|
-
qhf8xq: "f10pi13n",
|
22
|
-
B4j52fo: "fre7gi1",
|
23
|
-
Bekrc4i: ["f1358rze", "f1rvrf73"],
|
24
|
-
Bn0qgzm: "fqdk4by",
|
25
|
-
ibv6hh: ["f1rvrf73", "f1358rze"],
|
26
|
-
gd4gdo: "f1ngn1p8",
|
27
|
-
Ftih45: "f1wl9k8s",
|
28
|
-
Bcvre1j: "fyl8oag",
|
29
|
-
Brfgrao: "f1j7ml58",
|
30
|
-
Bciustq: "ffi060y",
|
31
|
-
mdwyqc: ["f1f351id", "f1fzr1x6"],
|
32
|
-
lawp4y: "fchca7p",
|
33
|
-
Fbdkly: ["f1fzr1x6", "f1f351id"],
|
34
|
-
Budzafs: ["f1pl9g23", "f3orl67"],
|
35
|
-
r59vdv: ["f3orl67", "f1pl9g23"],
|
36
|
-
n07z76: ["f2gop1n", "f11nyhth"],
|
37
|
-
ck0cow: ["f11nyhth", "f2gop1n"],
|
38
|
-
Cgzuqd: "fxuihnu",
|
39
|
-
Ehzi8l: "fzjygzn",
|
40
|
-
B1piin3: ["f15yvnhg", "f1n6gb5g"],
|
41
|
-
By385i5: "fo72kxq",
|
42
|
-
Eqx8gd: ["f1n6gb5g", "f15yvnhg"],
|
43
|
-
t2ki1e: "f5yjgw6"
|
44
|
-
},
|
45
18
|
small: {
|
19
|
+
sshi5w: "f1pha7fy",
|
20
|
+
Bahqtrf: "fk6fouc",
|
21
|
+
Be2twd7: "fy9rknc",
|
22
|
+
Bhrd7zp: "figsok6",
|
23
|
+
Bg96gwp: "fwrc4pm",
|
46
24
|
uwmqm3: ["f1f5gg8d", "f1vdfbxk"]
|
47
25
|
},
|
48
26
|
medium: {},
|
49
|
-
outline: {
|
50
|
-
B0qfbqy: "f1fjh9ub",
|
51
|
-
B4f6apu: ["ff9c942", "f6rdg5o"],
|
52
|
-
y0oebl: "fdw6hkg",
|
53
|
-
uvfttm: ["f6rdg5o", "ff9c942"],
|
54
|
-
Bdkvgpv: "f163fonl",
|
55
|
-
m598lv: ["f1yq6w5o", "f1jpmc5p"],
|
56
|
-
qa3bma: "f11yjt3y",
|
57
|
-
Bbv0w2i: ["f1jpmc5p", "f1yq6w5o"],
|
58
|
-
Bq4z7u6: "f10tv6oz",
|
59
|
-
Bk5zm6e: ["f16xp3sf", "f1seuxxq"],
|
60
|
-
Bqjgrrk: "fchs65t",
|
61
|
-
Bm6vgfq: ["f1seuxxq", "f16xp3sf"]
|
62
|
-
},
|
27
|
+
outline: {},
|
63
28
|
outlineInteractive: {
|
64
29
|
Bo3r8zu: "f1w2y1rc",
|
65
30
|
Hpvxnh: ["f1gofhvl", "f18htlvq"],
|
@@ -71,17 +36,22 @@ const useRootStyles = /*#__PURE__*/__styles({
|
|
71
36
|
Bcc6kan: ["f15r4wkl", "fcoc0mf"]
|
72
37
|
},
|
73
38
|
underline: {
|
74
|
-
|
75
|
-
|
76
|
-
n07z76: ["feccbv4", "f1jqz70h"],
|
77
|
-
ck0cow: ["f1jqz70h", "feccbv4"],
|
39
|
+
B0qfbqy: "f1o236ok",
|
40
|
+
B4f6apu: ["faeg28l", "f64aojp"],
|
78
41
|
y0oebl: "fdw6hkg",
|
79
|
-
|
80
|
-
|
42
|
+
uvfttm: ["f64aojp", "faeg28l"],
|
43
|
+
Budzafs: ["f1vk4jnx", "f1v3v894"],
|
44
|
+
r59vdv: ["f1v3v894", "f1vk4jnx"],
|
45
|
+
n07z76: ["fzi2j54", "f1un0uoc"],
|
46
|
+
ck0cow: ["f1un0uoc", "fzi2j54"]
|
81
47
|
},
|
82
48
|
underlineInteractive: {
|
83
49
|
Bx11ytk: "ffcnd28",
|
84
|
-
xcfy85: "f1ipdth8"
|
50
|
+
xcfy85: "f1ipdth8",
|
51
|
+
B3778ie: ["f9pmbr4", "ffh3ws5"],
|
52
|
+
d9w3h3: ["ffh3ws5", "f9pmbr4"],
|
53
|
+
Bl18szs: ["f19438ov", "f1i9y5j"],
|
54
|
+
B4j8arr: ["f1i9y5j", "f19438ov"]
|
85
55
|
},
|
86
56
|
filled: {
|
87
57
|
B0qfbqy: "f1fjh9ub",
|
@@ -97,6 +67,12 @@ const useRootStyles = /*#__PURE__*/__styles({
|
|
97
67
|
Bqjgrrk: "f1172wan",
|
98
68
|
Bm6vgfq: ["fszsv3f", "f1edeodt"]
|
99
69
|
},
|
70
|
+
"filled-darker": {
|
71
|
+
De3pzq: "f16xq7d1"
|
72
|
+
},
|
73
|
+
"filled-lighter": {
|
74
|
+
De3pzq: "fxugw4r"
|
75
|
+
},
|
100
76
|
filledInteractive: {
|
101
77
|
B05mzqr: "f1xqt08",
|
102
78
|
tb9y6h: ["fzt5lgo", "f8tv3r9"],
|
@@ -110,6 +86,8 @@ const useRootStyles = /*#__PURE__*/__styles({
|
|
110
86
|
Ba322q7: ["f1pvdymy", "f1a168p3"]
|
111
87
|
},
|
112
88
|
disabled: {
|
89
|
+
Bceei9c: "fdrzuqr",
|
90
|
+
De3pzq: "f1c21dwh",
|
113
91
|
Bq4z7u6: "f1a0lfh7",
|
114
92
|
Bk5zm6e: ["f1p2ejm6", "fmzytvz"],
|
115
93
|
Bqjgrrk: "fas2e61",
|
@@ -120,7 +98,7 @@ const useRootStyles = /*#__PURE__*/__styles({
|
|
120
98
|
Imo2if: ["frjp63v", "f1lclws"]
|
121
99
|
}
|
122
100
|
}, {
|
123
|
-
d: [".
|
101
|
+
d: [".f1pha7fy{min-height:24px;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1o236ok::before{border-top-width:0;}", ".faeg28l::before{border-right-width:0;}", ".f64aojp::before{border-left-width:0;}", ".fdw6hkg::before{border-bottom-width:1px;}", ".f1vk4jnx::before{border-bottom-right-radius:var(--borderRadiusNone);}", ".f1v3v894::before{border-bottom-left-radius:var(--borderRadiusNone);}", ".fzi2j54::before{border-top-right-radius:var(--borderRadiusNone);}", ".f1un0uoc::before{border-top-left-radius:var(--borderRadiusNone);}", ".f9pmbr4::after{border-bottom-right-radius:var(--borderRadiusNone);}", ".ffh3ws5::after{border-bottom-left-radius:var(--borderRadiusNone);}", ".f19438ov::after{border-top-right-radius:var(--borderRadiusNone);}", ".f1i9y5j::after{border-top-left-radius:var(--borderRadiusNone);}", ".f1fjh9ub::before{border-top-width:1px;}", ".ff9c942::before{border-right-width:1px;}", ".f6rdg5o::before{border-left-width:1px;}", ".f163fonl::before{border-top-style:solid;}", ".f1yq6w5o::before{border-right-style:solid;}", ".f1jpmc5p::before{border-left-style:solid;}", ".f11yjt3y::before{border-bottom-style:solid;}", ".f7dgwnz::before{border-top-color:var(--colorTransparentStroke);}", ".f1edeodt::before{border-right-color:var(--colorTransparentStroke);}", ".fszsv3f::before{border-left-color:var(--colorTransparentStroke);}", ".f1172wan::before{border-bottom-color:var(--colorTransparentStroke);}", ".f16xq7d1{background-color:var(--colorNeutralBackground3);}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".fl48pg9:not(:focus-within)::before,.fl48pg9:hover:not(:focus-within)::before{border-top-color:var(--colorPaletteRedBorder2);}", ".f1a168p3:not(:focus-within)::before,.f1a168p3:hover:not(:focus-within)::before{border-right-color:var(--colorPaletteRedBorder2);}", ".f1pvdymy:not(:focus-within)::before,.f1pvdymy:hover:not(:focus-within)::before{border-left-color:var(--colorPaletteRedBorder2);}", ".f11knvgl:not(:focus-within)::before,.f11knvgl:hover:not(:focus-within)::before{border-bottom-color:var(--colorPaletteRedBorder2);}", ".fdrzuqr{cursor:not-allowed;}", ".f1c21dwh{background-color:var(--colorTransparentBackground);}", ".f1a0lfh7::before{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f1p2ejm6::before{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fmzytvz::before{border-left-color:var(--colorNeutralStrokeDisabled);}", ".fas2e61::before{border-bottom-color:var(--colorNeutralStrokeDisabled);}"],
|
124
102
|
h: [".f1w2y1rc:hover::before{border-top-color:var(--colorNeutralStroke1Hover);}", ".f1gofhvl:hover::before{border-right-color:var(--colorNeutralStroke1Hover);}", ".f18htlvq:hover::before{border-left-color:var(--colorNeutralStroke1Hover);}", ".ffcnd28:hover::before{border-bottom-color:var(--colorNeutralStrokeAccessibleHover);}", ".f1xqt08:hover::before,.f1xqt08:focus-within::before{border-top-color:var(--colorTransparentStrokeInteractive);}", ".fzt5lgo:hover::before,.fzt5lgo:focus-within::before{border-right-color:var(--colorTransparentStrokeInteractive);}", ".f8tv3r9:hover::before,.f8tv3r9:focus-within::before{border-left-color:var(--colorTransparentStrokeInteractive);}", ".fyhrops:hover::before,.fyhrops:focus-within::before{border-bottom-color:var(--colorTransparentStrokeInteractive);}"],
|
125
103
|
a: [".f6lmxco:active::before,.f6lmxco:focus-within::before{border-top-color:var(--colorNeutralStroke1Pressed);}", ".fcoc0mf:active::before,.fcoc0mf:focus-within::before{border-right-color:var(--colorNeutralStroke1Pressed);}", ".f15r4wkl:active::before,.f15r4wkl:focus-within::before{border-left-color:var(--colorNeutralStroke1Pressed);}", ".f1ipdth8:active::before,.f1ipdth8:focus-within::before{border-bottom-color:var(--colorNeutralStrokeAccessiblePressed);}"],
|
126
104
|
m: [["@media (forced-colors: active){.flb8es4::before{border-top-color:GrayText;}}", {
|
@@ -133,93 +111,46 @@ const useRootStyles = /*#__PURE__*/__styles({
|
|
133
111
|
m: "(forced-colors: active)"
|
134
112
|
}]]
|
135
113
|
});
|
114
|
+
const useInputClassName = /*#__PURE__*/__resetStyles("rekhnij", null, [".rekhnij{grid-column-start:1;grid-column-end:2;grid-row-start:1;grid-row-end:3;outline-style:none;border:0;padding:0;color:var(--colorNeutralForeground1);background-color:transparent;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;}", ".rekhnij::-webkit-input-placeholder{color:var(--colorNeutralForeground4);opacity:1;}", ".rekhnij::-moz-placeholder{color:var(--colorNeutralForeground4);opacity:1;}", ".rekhnij:-ms-input-placeholder{color:var(--colorNeutralForeground4);opacity:1;}", ".rekhnij::placeholder{color:var(--colorNeutralForeground4);opacity:1;}"]);
|
136
115
|
const useInputStyles = /*#__PURE__*/__styles({
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
oeaueh: "f1s6fcnf",
|
143
|
-
z8tnut: "f1g0x7ka",
|
144
|
-
z189sj: ["fhxju0i", "f1cnd47f"],
|
145
|
-
Byoj8tv: "f1qch9an",
|
146
|
-
uwmqm3: ["f1cnd47f", "fhxju0i"]
|
116
|
+
disabled: {
|
117
|
+
sj55zd: "f1s2aq7o",
|
118
|
+
Bceei9c: "fdrzuqr",
|
119
|
+
De3pzq: "f1c21dwh",
|
120
|
+
yvdlaj: "fahhnxm"
|
147
121
|
}
|
148
122
|
}, {
|
149
|
-
d: [".
|
123
|
+
d: [".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".fdrzuqr{cursor:not-allowed;}", ".f1c21dwh{background-color:var(--colorTransparentBackground);}", ".fahhnxm::-webkit-input-placeholder{color:var(--colorNeutralForegroundDisabled);}", ".fahhnxm::-moz-placeholder{color:var(--colorNeutralForegroundDisabled);}"]
|
150
124
|
});
|
125
|
+
const useBaseButtonClassName = /*#__PURE__*/__resetStyles("r1g4chgs", null, [".r1g4chgs{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:24px;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;border:0;position:absolute;outline-style:none;height:16px;background-color:transparent;color:var(--colorNeutralForeground3);grid-column-start:2;border-radius:0;padding:0 5px 0 5px;}", ".r1g4chgs:active{outline-style:none;}", ".r1g4chgs:enabled:hover{cursor:pointer;color:var(--colorNeutralForeground3Hover);background-color:var(--colorSubtleBackgroundHover);}", ".r1g4chgs:enabled:active{color:var(--colorNeutralForeground3Pressed);background-color:var(--colorSubtleBackgroundPressed);}", ".r1g4chgs:enabled.fui-SpinButton__button_active{color:var(--colorNeutralForeground3Pressed);background-color:var(--colorSubtleBackgroundPressed);}", ".r1g4chgs:disabled{cursor:not-allowed;color:var(--colorNeutralForegroundDisabled);}"]);
|
151
126
|
const useButtonStyles = /*#__PURE__*/__styles({
|
152
|
-
|
153
|
-
mc9l5x: "ftuwxu6",
|
154
|
-
a9b677: "fq4mcun",
|
155
|
-
Bt984gj: "f122n59",
|
156
|
-
Brf1p80: "f4d9j23",
|
157
|
-
B4j52fo: "fre7gi1",
|
158
|
-
Bekrc4i: ["f1358rze", "f1rvrf73"],
|
159
|
-
Bn0qgzm: "fqdk4by",
|
160
|
-
ibv6hh: ["f1rvrf73", "f1358rze"],
|
161
|
-
qhf8xq: "f1euv43f",
|
162
|
-
oeaueh: "f1s6fcnf",
|
163
|
-
Bqenvij: "f1l02sjl",
|
164
|
-
Bfnh471: "fe4wpbb",
|
165
|
-
zwc60e: "fb0xa7e",
|
166
|
-
ezr58z: "f9f7vaa"
|
167
|
-
},
|
168
|
-
incrementButton: {
|
169
|
-
Br312pm: "fd46tj4",
|
170
|
-
Bw0ie65: "fz1yyy6",
|
127
|
+
increment: {
|
171
128
|
Ijaq50: "f16hsg94",
|
172
|
-
nk6f5a: "f88nxoq",
|
173
|
-
Bbmb7ep: ["f1krrbdw", "f1deotkl"],
|
174
|
-
Beyfa6y: ["f1deotkl", "f1krrbdw"],
|
175
129
|
B7oj6ja: ["f1jar5jt", "fyu767a"],
|
176
|
-
|
130
|
+
z8tnut: "f10ra9hq",
|
131
|
+
Byoj8tv: "f1brlhvm"
|
132
|
+
},
|
133
|
+
decrement: {
|
134
|
+
Ijaq50: "faunodf",
|
135
|
+
Bbmb7ep: ["f1aa9q02", "f16jpd5f"],
|
136
|
+
z8tnut: "f1sl3k7w",
|
137
|
+
Byoj8tv: "f1y2xyjm"
|
177
138
|
},
|
178
139
|
incrementButtonSmall: {
|
179
140
|
z8tnut: "f1khb0e9",
|
180
141
|
z189sj: ["f1sgzk6v", "f1bg5zqg"],
|
181
142
|
Byoj8tv: "f1ov4xf1",
|
182
|
-
uwmqm3: ["fycuoez", "f8wuabp"]
|
183
|
-
|
184
|
-
incrementButtonMedium: {
|
185
|
-
z8tnut: "f10ra9hq",
|
186
|
-
z189sj: ["fwiuce9", "f15vdbe4"],
|
187
|
-
Byoj8tv: "f1brlhvm",
|
188
|
-
uwmqm3: ["f15vdbe4", "fwiuce9"]
|
189
|
-
},
|
190
|
-
decrementButton: {
|
191
|
-
Br312pm: "fd46tj4",
|
192
|
-
Bw0ie65: "fz1yyy6",
|
193
|
-
Ijaq50: "faunodf",
|
194
|
-
nk6f5a: "fcu02xx",
|
195
|
-
Bbmb7ep: ["f1aa9q02", "f16jpd5f"],
|
196
|
-
Beyfa6y: ["f1deotkl", "f1krrbdw"],
|
197
|
-
B7oj6ja: ["f10ostut", "f1ozlkrg"],
|
198
|
-
Btl43ni: ["f1ozlkrg", "f10ostut"]
|
143
|
+
uwmqm3: ["fycuoez", "f8wuabp"],
|
144
|
+
Bqenvij: "fvblgha"
|
199
145
|
},
|
200
146
|
decrementButtonSmall: {
|
201
147
|
z8tnut: "f1nbblvp",
|
202
148
|
z189sj: ["f1sgzk6v", "f1bg5zqg"],
|
203
149
|
Byoj8tv: "f1jnq6q7",
|
204
|
-
uwmqm3: ["fycuoez", "f8wuabp"]
|
205
|
-
|
206
|
-
decrementButtonMedium: {
|
207
|
-
z8tnut: "f1sl3k7w",
|
208
|
-
z189sj: ["fwiuce9", "f15vdbe4"],
|
209
|
-
Byoj8tv: "f1y2xyjm",
|
210
|
-
uwmqm3: ["f15vdbe4", "fwiuce9"]
|
211
|
-
},
|
212
|
-
outline: {
|
213
|
-
De3pzq: "f3rmtva",
|
214
|
-
sj55zd: "f11d4kpn",
|
215
|
-
r4wkhp: "f1no7wuu",
|
216
|
-
B95qlz1: "f1bifk9c",
|
217
|
-
p743kt: "fp1zg4s",
|
218
|
-
B7xitij: "fo6hitd",
|
219
|
-
B6siaa6: "f1wiab75",
|
220
|
-
Ba9qmo4: "fj9zm5z",
|
221
|
-
Dyrjrp: "f1cqwcg4"
|
150
|
+
uwmqm3: ["fycuoez", "f8wuabp"],
|
151
|
+
Bqenvij: "fvblgha"
|
222
152
|
},
|
153
|
+
outline: {},
|
223
154
|
underline: {
|
224
155
|
De3pzq: "f3rmtva",
|
225
156
|
sj55zd: "f11d4kpn",
|
@@ -252,8 +183,7 @@ const useButtonStyles = /*#__PURE__*/__styles({
|
|
252
183
|
Dyrjrp: "f1cqwcg4"
|
253
184
|
}
|
254
185
|
}, {
|
255
|
-
d: [".
|
256
|
-
a: [".fb0xa7e:active{outline-style:none;}"]
|
186
|
+
d: [".f16hsg94{grid-row-start:1;}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f10ra9hq{padding-top:4px;}", ".f1brlhvm{padding-bottom:1px;}", ".faunodf{grid-row-start:2;}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1sl3k7w{padding-top:1px;}", ".f1y2xyjm{padding-bottom:4px;}", ".f1khb0e9{padding-top:3px;}", ".f1sgzk6v{padding-right:6px;}", ".f1bg5zqg{padding-left:6px;}", ".f1ov4xf1{padding-bottom:0px;}", ".fycuoez{padding-left:4px;}", ".f8wuabp{padding-right:4px;}", ".fvblgha{height:12px;}", ".f1nbblvp{padding-top:0px;}", ".f1jnq6q7{padding-bottom:3px;}", ".f3rmtva{background-color:transparent;}", ".f11d4kpn{color:var(--colorNeutralForeground3);}", ".f1no7wuu:enabled:hover{color:var(--colorNeutralForeground3Hover);}", ".f1bifk9c:enabled:hover{background-color:var(--colorSubtleBackgroundHover);}", ".fp1zg4s:enabled:active{color:var(--colorNeutralForeground3Pressed);}", ".fo6hitd:enabled:active{background-color:var(--colorSubtleBackgroundPressed);}", ".f1wiab75:enabled.fui-SpinButton__button_active{color:var(--colorNeutralForeground3Pressed);}", ".fj9zm5z:enabled.fui-SpinButton__button_active{background-color:var(--colorSubtleBackgroundPressed);}", ".f1cqwcg4:disabled{color:var(--colorNeutralForegroundDisabled);}", ".fwwxidx:enabled:hover{background-color:var(--colorNeutralBackground3Hover);}", ".f14i52sd:enabled:active{background-color:var(--colorNeutralBackground3Pressed);}", ".fwry2ka:enabled.fui-SpinButton__button_active{background-color:var(--colorNeutralBackground3Pressed);}", ".f1yywxnv:enabled:hover{background-color:var(--colorNeutralBackground1Hover);}", ".fzaa11h:enabled:active,.fzaa11h:enabled.fui-SpinButton__button_active{color:var(--colorNeutralForeground3Pressed);}", ".f4fpmm9:enabled:active,.f4fpmm9:enabled.fui-SpinButton__button_active{background-color:var(--colorNeutralBackground1Pressed);}"]
|
257
187
|
});
|
258
188
|
// Cannot just disable button as they need to remain
|
259
189
|
// exposed to ATs like screen readers.
|
@@ -319,28 +249,10 @@ export const useSpinButtonStyles_unstable = state => {
|
|
319
249
|
const buttonStyles = useButtonStyles();
|
320
250
|
const buttonDisabledStyles = useButtonDisabledStyles();
|
321
251
|
const inputStyles = useInputStyles();
|
322
|
-
|
323
|
-
|
324
|
-
state.
|
325
|
-
|
326
|
-
useInputStyles_unstable({
|
327
|
-
size,
|
328
|
-
appearance,
|
329
|
-
input: state.input,
|
330
|
-
root: state.root,
|
331
|
-
components: {
|
332
|
-
root: 'span',
|
333
|
-
input: 'input',
|
334
|
-
contentBefore: 'span',
|
335
|
-
contentAfter: 'span'
|
336
|
-
}
|
337
|
-
});
|
338
|
-
state.root.className = mergeClasses(state.root.className,
|
339
|
-
// Get the classes from useInputStyles_unstable
|
340
|
-
spinButtonClassNames.root, rootStyles.base, rootStyles[size], appearance === 'outline' && rootStyles.outline, appearance === 'underline' && rootStyles.underline, filled && rootStyles.filled, !disabled && appearance === 'outline' && rootStyles.outlineInteractive, !disabled && appearance === 'underline' && rootStyles.underlineInteractive, !disabled && filled && rootStyles.filledInteractive, !disabled && invalid && rootStyles.invalid, disabled && rootStyles.disabled, rootClassName);
|
341
|
-
state.incrementButton.className = mergeClasses(spinButtonClassNames.incrementButton, spinState === 'up' && `${spinButtonExtraClassNames.buttonActive}`, buttonStyles.base, buttonStyles.incrementButton, buttonStyles[appearance], size === 'small' ? buttonStyles.incrementButtonSmall : buttonStyles.incrementButtonMedium, (atBound === 'max' || atBound === 'both') && buttonDisabledStyles.base, (atBound === 'max' || atBound === 'both') && buttonDisabledStyles[appearance], state.incrementButton.className);
|
342
|
-
state.decrementButton.className = mergeClasses(spinButtonClassNames.decrementButton, spinState === 'down' && `${spinButtonExtraClassNames.buttonActive}`, buttonStyles.base, buttonStyles.decrementButton, buttonStyles[appearance], size === 'small' ? buttonStyles.decrementButtonSmall : buttonStyles.decrementButtonMedium, (atBound === 'min' || atBound === 'both') && buttonDisabledStyles.base, (atBound === 'min' || atBound === 'both') && buttonDisabledStyles[appearance], state.decrementButton.className);
|
343
|
-
state.input.className = mergeClasses(spinButtonClassNames.input, state.input.className, inputStyles.base);
|
252
|
+
state.root.className = mergeClasses(spinButtonClassNames.root, useRootClassName(), rootStyles[size], rootStyles[appearance], filled && rootStyles.filled, !disabled && appearance === 'outline' && rootStyles.outlineInteractive, !disabled && appearance === 'underline' && rootStyles.underlineInteractive, !disabled && filled && rootStyles.filledInteractive, !disabled && invalid && rootStyles.invalid, disabled && rootStyles.disabled, state.root.className);
|
253
|
+
state.incrementButton.className = mergeClasses(spinButtonClassNames.incrementButton, spinState === 'up' && `${spinButtonExtraClassNames.buttonActive}`, useBaseButtonClassName(), buttonStyles.increment, buttonStyles[appearance], size === 'small' && buttonStyles.incrementButtonSmall, (atBound === 'max' || atBound === 'both') && buttonDisabledStyles.base, (atBound === 'max' || atBound === 'both') && buttonDisabledStyles[appearance], state.incrementButton.className);
|
254
|
+
state.decrementButton.className = mergeClasses(spinButtonClassNames.decrementButton, spinState === 'down' && `${spinButtonExtraClassNames.buttonActive}`, useBaseButtonClassName(), buttonStyles.decrement, buttonStyles[appearance], size === 'small' && buttonStyles.decrementButtonSmall, (atBound === 'min' || atBound === 'both') && buttonDisabledStyles.base, (atBound === 'min' || atBound === 'both') && buttonDisabledStyles[appearance], state.decrementButton.className);
|
255
|
+
state.input.className = mergeClasses(spinButtonClassNames.input, useInputClassName(), disabled && inputStyles.disabled, state.input.className);
|
344
256
|
return state;
|
345
257
|
};
|
346
258
|
//# sourceMappingURL=useSpinButtonStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"mappings":"AACA,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AAS,EAAEF,WAAW,CAACO,IAAI,CAAC;EAEzG,OAAOnB,KAAK;AACd,CAAC","names":["mergeClasses","shorthands","tokens","useInputStyles_unstable","spinButtonClassNames","root","input","incrementButton","decrementButton","spinButtonExtraClassNames","buttonActive","useRootStyles","useInputStyles","useButtonStyles","useButtonDisabledStyles","useSpinButtonStyles_unstable","state","appearance","atBound","spinState","size","disabled","invalid","filled","startsWith","rootStyles","buttonStyles","buttonDisabledStyles","inputStyles","rootClassName","className","undefined","components","contentBefore","contentAfter","base","outline","underline","outlineInteractive","underlineInteractive","filledInteractive","incrementButtonSmall","incrementButtonMedium","decrementButtonSmall","decrementButtonMedium"],"sourceRoot":"../src/","sources":["packages/react-components/react-spinbutton/src/components/SpinButton/useSpinButtonStyles.ts"],"sourcesContent":["import { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SpinButtonSlots, SpinButtonState } from './SpinButton.types';\nimport { tokens } from '@fluentui/react-theme';\nimport { useInputStyles_unstable } from '@fluentui/react-input';\n\nexport const spinButtonClassNames: SlotClassNames<SpinButtonSlots> = {\n root: 'fui-SpinButton',\n input: 'fui-SpinButton__input',\n incrementButton: 'fui-SpinButton__incrementButton',\n decrementButton: 'fui-SpinButton__decrementButton',\n};\n\nconst spinButtonExtraClassNames = {\n buttonActive: 'fui-SpinButton__button_active',\n};\n\nconst useRootStyles = makeStyles({\n base: {\n display: 'inline-grid',\n gridTemplateColumns: `1fr 24px`,\n gridTemplateRows: '1fr 1fr',\n columnGap: tokens.spacingHorizontalXS,\n rowGap: 0,\n paddingRight: 0,\n position: 'relative',\n // Remove the border styles from react-input\n ...shorthands.border('0'),\n isolation: 'isolate',\n\n // Apply border styles on the ::before pseudo element.\n // We cannot use ::after since react-input uses that\n // for the selector styles.\n // Using the pseudo element allows us to place the border\n // above content in the component which ensures the buttons\n // line up visually with the border as expected. Without this\n // there is a bit of a gap which can become very noticeable\n // at high zoom or when OS zoom levels are not divisible by 2\n // (e.g., 150% on Windows in Firefox)\n // This is most noticeable on the \"outline\" appearance which is\n // also the default so it feels worth the extra ceremony to get right.\n '::before': {\n content: '\"\"',\n boxSizing: 'border-box',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n pointerEvents: 'none',\n zIndex: 10,\n },\n\n '::after': {\n right: 0,\n bottom: 0,\n left: 0,\n zIndex: 20,\n },\n },\n\n small: {\n paddingLeft: tokens.spacingHorizontalS,\n },\n\n // intentionally empty\n medium: {},\n\n outline: {\n '::before': {\n ...shorthands.border('1px', 'solid', tokens.colorNeutralStroke1),\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n },\n },\n\n outlineInteractive: {\n ':hover': {\n '::before': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':active,:focus-within': {\n '::before': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n underline: {\n '::before': {\n ...shorthands.borderRadius(0), // corners look strange if rounded\n ...shorthands.borderBottom('1px', 'solid', tokens.colorNeutralStrokeAccessible),\n },\n },\n\n underlineInteractive: {\n ':hover': {\n '::before': {\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n },\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':active,:focus-within': {\n '::before': {\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n filled: {\n '::before': {\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n },\n },\n\n filledInteractive: {\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':hover,:focus-within': {\n '::before': {\n // also handles pressed border color (:active)\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n },\n\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n '::before': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2),\n },\n },\n },\n\n disabled: {\n '::before': {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n base: {\n gridColumnStart: '1',\n gridColumnEnd: '2',\n gridRowStart: '1',\n gridRowEnd: '3',\n outlineStyle: 'none',\n ...shorthands.padding(0),\n },\n});\n\nconst useButtonStyles = makeStyles({\n base: {\n display: 'inline-flex',\n width: '24px',\n alignItems: 'center',\n justifyContent: 'center',\n ...shorthands.border(0),\n position: 'absolute',\n\n outlineStyle: 'none',\n height: '100%',\n\n ':enabled:hover': {\n cursor: 'pointer',\n },\n\n ':active': {\n outlineStyle: 'none',\n },\n\n ':disabled': {\n cursor: 'not-allowed',\n },\n },\n\n incrementButton: {\n gridColumnStart: '2',\n gridColumnEnd: '3',\n gridRowStart: '1',\n gridRowEnd: '2',\n ...shorthands.borderRadius(0, tokens.borderRadiusMedium, 0, 0),\n },\n\n // Padding values numbers don't align with design specs\n // but visually the padding aligns.\n // The icons are set in a 16x16px square but the artwork is inset from that\n // so these padding values are computed by hand.\n // Additionally the design uses fractional values so these are\n // rounded to the nearest integer.\n incrementButtonSmall: {\n ...shorthands.padding('3px', '6px', '0px', '4px'),\n },\n\n incrementButtonMedium: {\n ...shorthands.padding('4px', '5px', '1px', '5px'),\n },\n\n decrementButton: {\n gridColumnStart: '2',\n gridColumnEnd: '3',\n gridRowStart: '2',\n gridRowEnd: '3',\n ...shorthands.borderRadius(0, 0, tokens.borderRadiusMedium, 0),\n },\n\n decrementButtonSmall: {\n ...shorthands.padding('0px', '6px', '3px', '4px'),\n },\n\n decrementButtonMedium: {\n ...shorthands.padding('1px', '5px', '4px', '5px'),\n },\n\n outline: {\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n ':disabled': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n underline: {\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n ':disabled': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n 'filled-darker': {\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorNeutralBackground3Hover,\n },\n ':active': {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n },\n },\n ':disabled': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n 'filled-lighter': {\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorNeutralBackground1Hover,\n },\n [`:active,&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n },\n },\n ':disabled': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\n// Cannot just disable button as they need to remain\n// exposed to ATs like screen readers.\nconst useButtonDisabledStyles = makeStyles({\n base: {\n cursor: 'not-allowed',\n\n ':hover': {\n cursor: 'not-allowed',\n },\n },\n\n outline: {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n\n underline: {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n\n 'filled-darker': {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n\n 'filled-lighter': {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n});\n\n/**\n * Apply styling to the SpinButton slots based on the state\n */\nexport const useSpinButtonStyles_unstable = (state: SpinButtonState): SpinButtonState => {\n const { appearance, atBound, spinState, size } = state;\n const disabled = state.input.disabled;\n const invalid = `${state.input['aria-invalid']}` === 'true';\n const filled = appearance.startsWith('filled');\n\n const rootStyles = useRootStyles();\n const buttonStyles = useButtonStyles();\n const buttonDisabledStyles = useButtonDisabledStyles();\n const inputStyles = useInputStyles();\n\n // Grab the root className here so we can be sure to merge is last\n const rootClassName = state.root.className;\n state.root.className = undefined;\n // Reuse react-input's styles without re-using the Input component.\n useInputStyles_unstable({\n size,\n appearance,\n input: state.input,\n root: state.root,\n components: {\n root: 'span',\n input: 'input',\n contentBefore: 'span',\n contentAfter: 'span',\n },\n });\n\n state.root.className = mergeClasses(\n state.root.className, // Get the classes from useInputStyles_unstable\n spinButtonClassNames.root,\n rootStyles.base,\n rootStyles[size],\n appearance === 'outline' && rootStyles.outline,\n appearance === 'underline' && rootStyles.underline,\n filled && rootStyles.filled,\n !disabled && appearance === 'outline' && rootStyles.outlineInteractive,\n !disabled && appearance === 'underline' && rootStyles.underlineInteractive,\n !disabled && filled && rootStyles.filledInteractive,\n !disabled && invalid && rootStyles.invalid,\n disabled && rootStyles.disabled,\n rootClassName, // Make sure any original class name is applied last\n );\n\n state.incrementButton.className = mergeClasses(\n spinButtonClassNames.incrementButton,\n spinState === 'up' && `${spinButtonExtraClassNames.buttonActive}`,\n buttonStyles.base,\n buttonStyles.incrementButton,\n buttonStyles[appearance],\n size === 'small' ? buttonStyles.incrementButtonSmall : buttonStyles.incrementButtonMedium,\n (atBound === 'max' || atBound === 'both') && buttonDisabledStyles.base,\n (atBound === 'max' || atBound === 'both') && buttonDisabledStyles[appearance],\n state.incrementButton.className,\n );\n state.decrementButton.className = mergeClasses(\n spinButtonClassNames.decrementButton,\n spinState === 'down' && `${spinButtonExtraClassNames.buttonActive}`,\n buttonStyles.base,\n buttonStyles.decrementButton,\n buttonStyles[appearance],\n size === 'small' ? buttonStyles.decrementButtonSmall : buttonStyles.decrementButtonMedium,\n (atBound === 'min' || atBound === 'both') && buttonDisabledStyles.base,\n (atBound === 'min' || atBound === 'both') && buttonDisabledStyles[appearance],\n state.decrementButton.className,\n );\n\n state.input.className = mergeClasses(spinButtonClassNames.input, state.input.className, inputStyles.base);\n\n return state;\n};\n"]}
|
1
|
+
{"version":3,"mappings":"AACA,kCAAsCA,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AAEtF,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAEhE,OAAO,MAAMC,oBAAoB,GAAoC;EACnEC,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,uBAAuB;EAC9BC,eAAe,EAAE,iCAAiC;EAClDC,eAAe,EAAE;CAClB;AAED,MAAMC,yBAAyB,GAAG;EAChCC,YAAY,EAAE;CACf;AAED,MAAMC,YAAY,GAAG;EACnBC,KAAK,EAAE,MAAM;EACbC,MAAM,EAAE;CACT;AAED,MAAMC,gBAAgB,gBAAG,4zHA8FvB;AAEF,MAAMC,aAAa,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;EAAA;EA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AM,KAAKS,oBAAoB,CAACV,UAAU,CAAC,EAC7ED,KAAK,CAACf,eAAe,CAAC4B,SAAS,CAChC;EACDb,KAAK,CAACd,eAAe,CAAC2B,SAAS,GAAGnC,YAAY,CAC5CI,oBAAoB,CAACI,eAAe,EACpCiB,SAAS,KAAK,MAAM,IAAI,GAAGhB,yBAAyB,CAACC,YAAY,EAAE,EACnEQ,sBAAsB,EAAE,EACxBc,YAAY,CAACU,SAAS,EACtBV,YAAY,CAACT,UAAU,CAAC,EACxBG,IAAI,KAAK,OAAO,IAAIM,YAAY,CAACW,oBAAoB,EACrD,CAACnB,OAAO,KAAK,KAAK,IAAIA,OAAO,KAAK,MAAM,KAAKS,oBAAoB,CAACQ,IAAI,EACtE,CAACjB,OAAO,KAAK,KAAK,IAAIA,OAAO,KAAK,MAAM,KAAKS,oBAAoB,CAACV,UAAU,CAAC,EAC7ED,KAAK,CAACd,eAAe,CAAC2B,SAAS,CAChC;EAEDb,KAAK,CAAChB,KAAK,CAAC6B,SAAS,GAAGnC,YAAY,CAClCI,oBAAoB,CAACE,KAAK,EAC1BU,iBAAiB,EAAE,EACnBW,QAAQ,IAAIO,WAAW,CAACP,QAAQ,EAChCL,KAAK,CAAChB,KAAK,CAAC6B,SAAS,CACtB;EAED,OAAOb,KAAK;AACd,CAAC","names":["mergeClasses","shorthands","tokens","typographyStyles","spinButtonClassNames","root","input","incrementButton","decrementButton","spinButtonExtraClassNames","buttonActive","fieldHeights","small","medium","useRootClassName","useRootStyles","useInputClassName","useInputStyles","useBaseButtonClassName","useButtonStyles","useButtonDisabledStyles","useSpinButtonStyles_unstable","state","appearance","atBound","spinState","size","disabled","invalid","filled","startsWith","rootStyles","buttonStyles","buttonDisabledStyles","inputStyles","className","outlineInteractive","underlineInteractive","filledInteractive","increment","incrementButtonSmall","base","decrement","decrementButtonSmall"],"sourceRoot":"../src/","sources":["packages/react-components/react-spinbutton/src/components/SpinButton/useSpinButtonStyles.ts"],"sourcesContent":["import { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SpinButtonSlots, SpinButtonState } from './SpinButton.types';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\nexport const spinButtonClassNames: SlotClassNames<SpinButtonSlots> = {\n root: 'fui-SpinButton',\n input: 'fui-SpinButton__input',\n incrementButton: 'fui-SpinButton__incrementButton',\n decrementButton: 'fui-SpinButton__decrementButton',\n};\n\nconst spinButtonExtraClassNames = {\n buttonActive: 'fui-SpinButton__button_active',\n};\n\nconst fieldHeights = {\n small: '24px',\n medium: '32px',\n};\n\nconst useRootClassName = makeResetStyles({\n display: 'inline-grid',\n gridTemplateColumns: `1fr 24px`,\n gridTemplateRows: '1fr 1fr',\n columnGap: tokens.spacingHorizontalXS,\n rowGap: 0,\n position: 'relative',\n isolation: 'isolate',\n\n backgroundColor: tokens.colorNeutralBackground1,\n minHeight: fieldHeights.medium,\n padding: `0 0 0 ${tokens.spacingHorizontalMNudge}`,\n borderRadius: tokens.borderRadiusMedium,\n\n // Apply border styles on the ::before pseudo element.\n // We cannot use ::after since that is used for selection.\n // Using the pseudo element allows us to place the border\n // above content in the component which ensures the buttons\n // line up visually with the border as expected. Without this\n // there is a bit of a gap which can become very noticeable\n // at high zoom or when OS zoom levels are not divisible by 2\n // (e.g., 150% on Windows in Firefox)\n // This is most noticeable on the \"outline\" appearance which is\n // also the default so it feels worth the extra ceremony to get right.\n '::before': {\n content: '\"\"',\n boxSizing: 'border-box',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n pointerEvents: 'none',\n zIndex: 10,\n border: `1px solid ${tokens.colorNeutralStroke1}`,\n borderBottomColor: tokens.colorNeutralStrokeAccessible,\n borderRadius: tokens.borderRadiusMedium,\n },\n\n '::after': {\n boxSizing: 'border-box',\n content: '\"\"',\n position: 'absolute',\n right: 0,\n bottom: 0,\n left: 0,\n zIndex: 20,\n\n // Maintaining the correct corner radius:\n // Use the whole border-radius as the height and only put radii on the bottom corners.\n // (Otherwise the radius would be automatically reduced to fit available space.)\n // max() ensures the focus border still shows up even if someone sets tokens.borderRadiusMedium to 0.\n height: `max(2px, ${tokens.borderRadiusMedium})`,\n borderBottomLeftRadius: tokens.borderRadiusMedium,\n borderBottomRightRadius: tokens.borderRadiusMedium,\n\n // Flat 2px border:\n // By default borderBottom will cause little \"horns\" on the ends. The clipPath trims them off.\n // (This could be done without trimming using `background: linear-gradient(...)`, but using\n // borderBottom makes it easier for people to override the color if needed.)\n borderBottom: `2px solid ${tokens.colorCompoundBrandStroke}`,\n clipPath: 'inset(calc(100% - 2px) 0 0 0)',\n\n // Animation for focus OUT\n transform: 'scaleX(0)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationUltraFast,\n transitionDelay: tokens.curveAccelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n\n ':focus-within::after': {\n // Animation for focus IN\n transform: 'scaleX(1)',\n transitionProperty: 'transform',\n transitionDuration: tokens.durationNormal,\n transitionDelay: tokens.curveDecelerateMid,\n\n '@media screen and (prefers-reduced-motion: reduce)': {\n transitionDuration: '0.01ms',\n transitionDelay: '0.01ms',\n },\n },\n ':focus-within:active::after': {\n // This is if the user clicks the field again while it's already focused\n borderBottomColor: tokens.colorCompoundBrandStrokePressed,\n },\n ':focus-within': {\n outline: '2px solid transparent',\n },\n});\n\nconst useRootStyles = makeStyles({\n small: {\n minHeight: fieldHeights.small,\n ...typographyStyles.caption1,\n paddingLeft: tokens.spacingHorizontalS,\n },\n\n medium: {\n // set by useRootClassName\n },\n\n outline: {\n // set by useRootClassName\n },\n\n outlineInteractive: {\n ':hover::before': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':active,:focus-within': {\n '::before': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n },\n\n underline: {\n '::before': {\n ...shorthands.borderWidth(0, 0, '1px', 0),\n ...shorthands.borderRadius(tokens.borderRadiusNone), // corners look strange if rounded\n },\n },\n\n underlineInteractive: {\n ':hover::before': {\n borderBottomColor: tokens.colorNeutralStrokeAccessibleHover,\n },\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':active,:focus-within': {\n '::before': {\n borderBottomColor: tokens.colorNeutralStrokeAccessiblePressed,\n },\n },\n '::after': shorthands.borderRadius(tokens.borderRadiusNone), // remove rounded corners from focus underline\n },\n\n filled: {\n '::before': {\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n },\n },\n\n 'filled-darker': {\n backgroundColor: tokens.colorNeutralBackground3,\n },\n 'filled-lighter': {\n backgroundColor: tokens.colorNeutralBackground1,\n },\n\n filledInteractive: {\n // DO NOT add a space between the selectors! It changes the behavior of make-styles.\n ':hover,:focus-within': {\n '::before': {\n // also handles pressed border color (:active)\n ...shorthands.borderColor(tokens.colorTransparentStrokeInteractive),\n },\n },\n },\n\n invalid: {\n ':not(:focus-within),:hover:not(:focus-within)': {\n '::before': {\n ...shorthands.borderColor(tokens.colorPaletteRedBorder2),\n },\n },\n },\n\n disabled: {\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n '::before': {\n ...shorthands.borderColor(tokens.colorNeutralStrokeDisabled),\n\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n },\n});\n\nconst useInputClassName = makeResetStyles({\n gridColumnStart: '1',\n gridColumnEnd: '2',\n gridRowStart: '1',\n gridRowEnd: '3',\n outlineStyle: 'none',\n border: '0',\n padding: '0',\n color: tokens.colorNeutralForeground1,\n // Use literal \"transparent\" (not from the theme) to always let the color from the root show through\n backgroundColor: 'transparent',\n fontFamily: 'inherit',\n fontSize: 'inherit',\n fontWeight: 'inherit',\n lineHeight: 'inherit',\n\n '::placeholder': {\n color: tokens.colorNeutralForeground4,\n opacity: 1, // browser style override\n },\n});\n\nconst useInputStyles = makeStyles({\n disabled: {\n color: tokens.colorNeutralForegroundDisabled,\n cursor: 'not-allowed',\n backgroundColor: tokens.colorTransparentBackground,\n '::placeholder': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\nconst useBaseButtonClassName = makeResetStyles({\n display: 'inline-flex',\n width: '24px',\n alignItems: 'center',\n justifyContent: 'center',\n border: '0',\n position: 'absolute',\n\n outlineStyle: 'none',\n height: '16px',\n\n // Use literal \"transparent\" (not from the theme) to always let the color from the root show through\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n\n // common button layout\n gridColumnStart: '2',\n borderRadius: '0',\n padding: '0 5px 0 5px',\n\n ':active': {\n outlineStyle: 'none',\n },\n\n ':enabled': {\n ':hover': {\n cursor: 'pointer',\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n\n ':disabled': {\n cursor: 'not-allowed',\n color: tokens.colorNeutralForegroundDisabled,\n },\n});\n\nconst useButtonStyles = makeStyles({\n increment: {\n gridRowStart: '1',\n borderTopRightRadius: tokens.borderRadiusMedium,\n paddingTop: '4px',\n paddingBottom: '1px',\n },\n decrement: {\n gridRowStart: '2',\n borderBottomRightRadius: tokens.borderRadiusMedium,\n paddingTop: '1px',\n paddingBottom: '4px',\n },\n // Padding values numbers don't align with design specs\n // but visually the padding aligns.\n // The icons are set in a 16x16px square but the artwork is inset from that\n // so these padding values are computed by hand.\n // Additionally the design uses fractional values so these are\n // rounded to the nearest integer.\n incrementButtonSmall: {\n ...shorthands.padding('3px', '6px', '0px', '4px'),\n height: '12px',\n },\n\n decrementButtonSmall: {\n ...shorthands.padding('0px', '6px', '3px', '4px'),\n height: '12px',\n },\n\n outline: {\n // set by useButtonClassName\n },\n\n underline: {\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n ':disabled': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n 'filled-darker': {\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorNeutralBackground3Hover,\n },\n ':active': {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n },\n },\n ':disabled': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n 'filled-lighter': {\n backgroundColor: 'transparent',\n color: tokens.colorNeutralForeground3,\n\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForeground3Hover,\n backgroundColor: tokens.colorNeutralBackground1Hover,\n },\n [`:active,&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForeground3Pressed,\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n },\n },\n ':disabled': {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n});\n\n// Cannot just disable button as they need to remain\n// exposed to ATs like screen readers.\nconst useButtonDisabledStyles = makeStyles({\n base: {\n cursor: 'not-allowed',\n\n ':hover': {\n cursor: 'not-allowed',\n },\n },\n\n outline: {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n\n underline: {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n\n 'filled-darker': {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n\n 'filled-lighter': {\n color: tokens.colorNeutralForegroundDisabled,\n ':enabled': {\n ':hover': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n ':active': {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n [`&.${spinButtonExtraClassNames.buttonActive}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n backgroundColor: 'transparent',\n },\n },\n },\n});\n\n/**\n * Apply styling to the SpinButton slots based on the state\n */\nexport const useSpinButtonStyles_unstable = (state: SpinButtonState): SpinButtonState => {\n const { appearance, atBound, spinState, size } = state;\n const disabled = state.input.disabled;\n const invalid = `${state.input['aria-invalid']}` === 'true';\n const filled = appearance.startsWith('filled');\n\n const rootStyles = useRootStyles();\n const buttonStyles = useButtonStyles();\n const buttonDisabledStyles = useButtonDisabledStyles();\n const inputStyles = useInputStyles();\n\n state.root.className = mergeClasses(\n spinButtonClassNames.root,\n useRootClassName(),\n rootStyles[size],\n rootStyles[appearance],\n filled && rootStyles.filled,\n !disabled && appearance === 'outline' && rootStyles.outlineInteractive,\n !disabled && appearance === 'underline' && rootStyles.underlineInteractive,\n !disabled && filled && rootStyles.filledInteractive,\n !disabled && invalid && rootStyles.invalid,\n disabled && rootStyles.disabled,\n state.root.className,\n );\n\n state.incrementButton.className = mergeClasses(\n spinButtonClassNames.incrementButton,\n spinState === 'up' && `${spinButtonExtraClassNames.buttonActive}`,\n useBaseButtonClassName(),\n buttonStyles.increment,\n buttonStyles[appearance],\n size === 'small' && buttonStyles.incrementButtonSmall,\n (atBound === 'max' || atBound === 'both') && buttonDisabledStyles.base,\n (atBound === 'max' || atBound === 'both') && buttonDisabledStyles[appearance],\n state.incrementButton.className,\n );\n state.decrementButton.className = mergeClasses(\n spinButtonClassNames.decrementButton,\n spinState === 'down' && `${spinButtonExtraClassNames.buttonActive}`,\n useBaseButtonClassName(),\n buttonStyles.decrement,\n buttonStyles[appearance],\n size === 'small' && buttonStyles.decrementButtonSmall,\n (atBound === 'min' || atBound === 'both') && buttonDisabledStyles.base,\n (atBound === 'min' || atBound === 'both') && buttonDisabledStyles[appearance],\n state.decrementButton.className,\n );\n\n state.input.className = mergeClasses(\n spinButtonClassNames.input,\n useInputClassName(),\n disabled && inputStyles.disabled,\n state.input.className,\n );\n\n return state;\n};\n"]}
|