@fluentui/react-spinbutton 9.74.7-experimental.cli-api.20261006-ccaa611d58.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -11
- package/README.md +6 -0
- package/lib/components/SpinButton/SpinButton.js.map +1 -1
- package/lib/components/SpinButton/SpinButton.module.css +373 -0
- package/lib/components/SpinButton/SpinButton.types.js.map +1 -1
- package/lib/components/SpinButton/index.js.map +1 -1
- package/lib/components/SpinButton/renderSpinButton.js +2 -2
- package/lib/components/SpinButton/renderSpinButton.js.map +1 -1
- package/lib/components/SpinButton/useSpinButton.js +6 -7
- package/lib/components/SpinButton/useSpinButton.js.map +1 -1
- package/lib/components/SpinButton/useSpinButtonStyles.styles.css.js +16 -0
- package/lib/components/SpinButton/useSpinButtonStyles.styles.css.js.map +1 -0
- package/lib/components/SpinButton/useSpinButtonStyles.styles.raw.css.js +16 -0
- package/lib/components/SpinButton/useSpinButtonStyles.styles.raw.css.js.map +1 -0
- package/lib/components/SpinButton/useSpinButtonStyles.styles.raw.js.map +1 -1
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getBound.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/precision.js.map +1 -1
- package/lib-commonjs/SpinButton.cjs +7 -7
- package/lib-commonjs/components/SpinButton/SpinButton.cjs.map +1 -1
- package/lib-commonjs/components/SpinButton/SpinButton.module.css +373 -0
- package/lib-commonjs/components/SpinButton/SpinButton.types.cjs.map +1 -1
- package/lib-commonjs/components/SpinButton/index.cjs +7 -7
- package/lib-commonjs/components/SpinButton/index.cjs.map +1 -1
- package/lib-commonjs/components/SpinButton/renderSpinButton.cjs.map +1 -1
- package/lib-commonjs/components/SpinButton/useSpinButton.cjs +9 -10
- package/lib-commonjs/components/SpinButton/useSpinButton.cjs.map +1 -1
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.cjs +3 -3
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.css.cjs +35 -0
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.raw.css.cjs +35 -0
- package/lib-commonjs/components/SpinButton/useSpinButtonStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/index.cjs +7 -7
- package/lib-commonjs/utils/clamp.cjs.map +1 -1
- package/lib-commonjs/utils/getBound.cjs.map +1 -1
- package/lib-commonjs/utils/index.cjs +5 -5
- package/lib-commonjs/utils/index.cjs.map +1 -1
- package/lib-commonjs/utils/precision.cjs +3 -3
- package/lib-commonjs/utils/precision.cjs.map +1 -1
- package/package.json +14 -14
- package/dist/metadata/api/api-root.json +0 -1
- package/dist/metadata/index.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,55 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-spinbutton
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Sat, 31 Oct 2026 11:08:55 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [9.
|
|
7
|
+
## [9.75.0-experimental.css-modules.20261031-810ab07afb.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.75.0-experimental.css-modules.20261031-810ab07afb.0)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.6.5..@fluentui/react-spinbutton_v9.74.7-experimental.cli-api.20261006-ccaa611d58.0)
|
|
9
|
+
Sat, 31 Oct 2026 11:08:55 GMT
|
|
11
10
|
|
|
12
11
|
### Changes
|
|
13
12
|
|
|
14
|
-
- Release 9.
|
|
15
|
-
- Bump @fluentui/keyboard-keys to v9.
|
|
16
|
-
- Bump @fluentui/react-field to v9.
|
|
17
|
-
- Bump @fluentui/react-jsx-runtime to v9.
|
|
18
|
-
- Bump @fluentui/react-shared-contexts to v9.
|
|
19
|
-
- Bump @fluentui/react-theme to v9.
|
|
20
|
-
- Bump @fluentui/react-utilities to v9.
|
|
13
|
+
- Release 9.75.0-experimental.css-modules.20261031-810ab07afb ([commit](https://github.com/microsoft/fluentui/commit/undefined) by 257645319+office-ogx-auth-helper[bot]@users.noreply.github.com)
|
|
14
|
+
- Bump @fluentui/keyboard-keys to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
15
|
+
- Bump @fluentui/react-field to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
17
|
+
- Bump @fluentui/react-shared-contexts to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
18
|
+
- Bump @fluentui/react-theme to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
19
|
+
- Bump @fluentui/react-utilities to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
20
|
+
|
|
21
|
+
## [9.6.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.6.8)
|
|
22
|
+
|
|
23
|
+
Mon, 19 Oct 2026 16:49:01 GMT
|
|
24
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.6.7..@fluentui/react-spinbutton_v9.6.8)
|
|
25
|
+
|
|
26
|
+
### Patches
|
|
27
|
+
|
|
28
|
+
- Bump @fluentui/react-field to v9.5.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
29
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
30
|
+
- Bump @fluentui/react-utilities to v9.27.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
31
|
+
|
|
32
|
+
## [9.6.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.6.7)
|
|
33
|
+
|
|
34
|
+
Wed, 23 Sep 2026 09:04:33 GMT
|
|
35
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.6.6..@fluentui/react-spinbutton_v9.6.7)
|
|
36
|
+
|
|
37
|
+
### Patches
|
|
38
|
+
|
|
39
|
+
- fix(react-spinbutton): prevent double-step on trackpad tap by raising initial spin repeat delay ([PR #36777](https://github.com/microsoft/fluentui/pull/36777) by bernardo.sunderhus@gmail.com)
|
|
40
|
+
|
|
41
|
+
## [9.6.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.6.6)
|
|
42
|
+
|
|
43
|
+
Tue, 22 Sep 2026 11:25:39 GMT
|
|
44
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.6.5..@fluentui/react-spinbutton_v9.6.6)
|
|
45
|
+
|
|
46
|
+
### Patches
|
|
47
|
+
|
|
48
|
+
- fix: remove unused react-dom and @types/react-dom peer dependencies, mark @types/react as optional ([PR #36559](https://github.com/microsoft/fluentui/pull/36559) by martinhochel@microsoft.com)
|
|
49
|
+
- Bump @fluentui/react-field to v9.5.5 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
50
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
51
|
+
- Bump @fluentui/react-shared-contexts to v9.26.4 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
52
|
+
- Bump @fluentui/react-utilities to v9.26.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
21
53
|
|
|
22
54
|
## [9.6.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.6.5)
|
|
23
55
|
|
package/README.md
CHANGED
|
@@ -33,3 +33,9 @@ See [Spec.md](./Spec.md).
|
|
|
33
33
|
### Migration Guide
|
|
34
34
|
|
|
35
35
|
When upgrading to Fluent UI v9 see the [upgrade guide](https://react.fluentui.dev/?path=/docs/concepts-migration-from-v8-components-spinbutton-migration--docs) for guidance on updating to the latest SpinButton implementation.
|
|
36
|
+
|
|
37
|
+
## Opt-in CSS Modules styles
|
|
38
|
+
|
|
39
|
+
CSS Modules alternatives are available for `SpinButton`. The default exports and component imports continue to use Griffel.
|
|
40
|
+
|
|
41
|
+
To opt in, configure your bundler to replace each `use<Component>Styles.styles.js` module with its adjacent `use<Component>Styles.styles.css.js` alternative (or `.styles.ts` with `.styles.css.ts` for source builds). Apply the replacement consistently to client and server bundles. The CSS loader must provide a default class-name map and retain the adjacent `.module.css` asset, including CSS from dependencies. All component rules are in `@layer fluentui` and use the theme custom properties supplied by `FluentProvider`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SpinButton/SpinButton.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useSpinButton_unstable } from './useSpinButton';\nimport { renderSpinButton_unstable } from './renderSpinButton';\nimport { useSpinButtonStyles_unstable } from './useSpinButtonStyles.styles';\nimport type { SpinButtonProps } from './SpinButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * A SpinButton allows someone to incrementally adjust a value in small steps.\n */\nexport const SpinButton: ForwardRefComponent<SpinButtonProps> = React.forwardRef((props, ref) => {\n const state = useSpinButton_unstable(props, ref);\n\n useSpinButtonStyles_unstable(state);\n\n useCustomStyleHook_unstable('useSpinButtonStyles_unstable')(state);\n\n return renderSpinButton_unstable(state);\n});\n\nSpinButton.displayName = 'SpinButton';\n"],"names":["React","useSpinButton_unstable","renderSpinButton_unstable","useSpinButtonStyles_unstable","useCustomStyleHook_unstable","SpinButton","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsB,QAAQ,qBAAkB;AACzD,SAASC,yBAAyB,QAAQ,wBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,kCAA+B;AAG5E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,2BAAmDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,QAAQR,uBAAuBM,OAAOC;IAE5CL,6BAA6BM;IAE7BL,4BAA4B,gCAAgCK;IAE5D,OAAOP,0BAA0BO;AACnC,GAAG;AAEHJ,WAAWK,WAAW,GAAG"}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.medium {
|
|
3
|
+
}
|
|
4
|
+
.root::before {
|
|
5
|
+
content: '';
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
position: absolute;
|
|
8
|
+
top: 0;
|
|
9
|
+
inset-inline-end: 0;
|
|
10
|
+
bottom: 0;
|
|
11
|
+
inset-inline-start: 0;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
z-index: 10;
|
|
14
|
+
border: var(--strokeWidthThin) solid var(--colorNeutralStroke1);
|
|
15
|
+
border-bottom-color: var(--colorNeutralStrokeAccessible);
|
|
16
|
+
border-radius: var(--borderRadiusMedium);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.root::after {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
content: '';
|
|
22
|
+
position: absolute;
|
|
23
|
+
inset-inline-end: 0;
|
|
24
|
+
bottom: 0;
|
|
25
|
+
inset-inline-start: 0;
|
|
26
|
+
z-index: 20;
|
|
27
|
+
height: max(var(--strokeWidthThick), var(--borderRadiusMedium));
|
|
28
|
+
border-end-start-radius: var(--borderRadiusMedium);
|
|
29
|
+
border-end-end-radius: var(--borderRadiusMedium);
|
|
30
|
+
border-bottom: var(--strokeWidthThick) solid var(--colorCompoundBrandStroke);
|
|
31
|
+
clip-path: inset(calc(100% - var(--strokeWidthThick)) 0 0 0);
|
|
32
|
+
transform: scaleX(0);
|
|
33
|
+
transition-property: transform;
|
|
34
|
+
transition-duration: var(--durationUltraFast);
|
|
35
|
+
transition-delay: var(--curveAccelerateMid);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.root:focus-within::after {
|
|
39
|
+
transform: scaleX(1);
|
|
40
|
+
transition-property: transform;
|
|
41
|
+
transition-duration: var(--durationNormal);
|
|
42
|
+
transition-delay: var(--curveDecelerateMid);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.root:focus-within:active::after {
|
|
46
|
+
border-bottom-color: var(--colorCompoundBrandStrokePressed);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.root:focus-within {
|
|
50
|
+
outline: var(--strokeWidthThick) solid transparent;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.root {
|
|
54
|
+
display: inline-grid;
|
|
55
|
+
grid-template-columns: 1fr var(--spacingHorizontalXXL);
|
|
56
|
+
grid-template-rows: 1fr 1fr;
|
|
57
|
+
column-gap: var(--spacingHorizontalXS);
|
|
58
|
+
row-gap: 0;
|
|
59
|
+
position: relative;
|
|
60
|
+
isolation: isolate;
|
|
61
|
+
vertical-align: middle;
|
|
62
|
+
background-color: var(--colorNeutralBackground1);
|
|
63
|
+
min-height: var(--spacingHorizontalXXXL);
|
|
64
|
+
padding: 0 0 0 var(--spacingHorizontalMNudge);
|
|
65
|
+
border-radius: var(--borderRadiusMedium);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.root:where(:dir(rtl)) {
|
|
69
|
+
padding: 0 var(--spacingHorizontalMNudge) 0 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.small {
|
|
73
|
+
min-height: var(--spacingHorizontalXXL);
|
|
74
|
+
font-family: var(--fontFamilyBase);
|
|
75
|
+
font-size: var(--fontSizeBase200);
|
|
76
|
+
font-weight: var(--fontWeightRegular);
|
|
77
|
+
line-height: var(--lineHeightBase200);
|
|
78
|
+
padding-inline-start: var(--spacingHorizontalS);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.underline::before {
|
|
82
|
+
border-top-width: 0;
|
|
83
|
+
border-inline-end-width: 0;
|
|
84
|
+
border-bottom-width: var(--strokeWidthThin);
|
|
85
|
+
border-inline-start-width: 0;
|
|
86
|
+
border-radius: var(--borderRadiusNone);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.filled::before {
|
|
90
|
+
border: var(--strokeWidthThin) solid var(--colorTransparentStroke);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.filled-darker {
|
|
94
|
+
background-color: var(--colorNeutralBackground3);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.filled-lighter {
|
|
98
|
+
background-color: var(--colorNeutralBackground1);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.root:where(.outline:not(.disabled)):hover::before {
|
|
102
|
+
border-top-color: var(--colorNeutralStroke1Hover);
|
|
103
|
+
border-inline-end-color: var(--colorNeutralStroke1Hover);
|
|
104
|
+
border-bottom-color: var(--colorNeutralStrokeAccessibleHover);
|
|
105
|
+
border-inline-start-color: var(--colorNeutralStroke1Hover);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.root:where(.outline:not(.disabled)):active::before,
|
|
109
|
+
.root:where(.outline:not(.disabled)):focus-within::before {
|
|
110
|
+
border-top-color: var(--colorNeutralStroke1Pressed);
|
|
111
|
+
border-inline-end-color: var(--colorNeutralStroke1Pressed);
|
|
112
|
+
border-bottom-color: var(--colorNeutralStrokeAccessiblePressed);
|
|
113
|
+
border-inline-start-color: var(--colorNeutralStroke1Pressed);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.root:where(.underline:not(.disabled)):hover::before {
|
|
117
|
+
border-bottom-color: var(--colorNeutralStrokeAccessibleHover);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.root:where(.underline:not(.disabled)):active::before,
|
|
121
|
+
.root:where(.underline:not(.disabled)):focus-within::before {
|
|
122
|
+
border-bottom-color: var(--colorNeutralStrokeAccessiblePressed);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.root:where(.underline:not(.disabled))::after {
|
|
126
|
+
border-radius: var(--borderRadiusNone);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.root:where(.filled:not(.disabled)):hover::before,
|
|
130
|
+
.root:where(.filled:not(.disabled)):focus-within::before {
|
|
131
|
+
border-top-color: var(--colorTransparentStrokeInteractive);
|
|
132
|
+
border-inline-end-color: var(--colorTransparentStrokeInteractive);
|
|
133
|
+
border-bottom-color: var(--colorTransparentStrokeInteractive);
|
|
134
|
+
border-inline-start-color: var(--colorTransparentStrokeInteractive);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.invalid:where(:not(.disabled)):not(:focus-within)::before,
|
|
138
|
+
.invalid:where(:not(.disabled)):hover:not(:focus-within)::before {
|
|
139
|
+
border-top-color: var(--colorPaletteRedBorder2);
|
|
140
|
+
border-inline-end-color: var(--colorPaletteRedBorder2);
|
|
141
|
+
border-bottom-color: var(--colorPaletteRedBorder2);
|
|
142
|
+
border-inline-start-color: var(--colorPaletteRedBorder2);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.disabled::before {
|
|
146
|
+
border-top-color: var(--colorNeutralStrokeDisabled);
|
|
147
|
+
border-inline-end-color: var(--colorNeutralStrokeDisabled);
|
|
148
|
+
border-bottom-color: var(--colorNeutralStrokeDisabled);
|
|
149
|
+
border-inline-start-color: var(--colorNeutralStrokeDisabled);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.disabled {
|
|
153
|
+
cursor: not-allowed;
|
|
154
|
+
background-color: var(--colorTransparentBackground);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.input::placeholder {
|
|
158
|
+
color: var(--colorNeutralForeground4);
|
|
159
|
+
opacity: 1;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.input {
|
|
163
|
+
grid-column-start: 1;
|
|
164
|
+
grid-column-end: 2;
|
|
165
|
+
grid-row-start: 1;
|
|
166
|
+
grid-row-end: 3;
|
|
167
|
+
outline-style: none;
|
|
168
|
+
border: 0;
|
|
169
|
+
padding: 0;
|
|
170
|
+
color: var(--colorNeutralForeground1);
|
|
171
|
+
background-color: transparent;
|
|
172
|
+
font-family: inherit;
|
|
173
|
+
font-size: inherit;
|
|
174
|
+
font-weight: inherit;
|
|
175
|
+
line-height: inherit;
|
|
176
|
+
width: 100%;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
:where(.disabled) > .input::placeholder {
|
|
180
|
+
color: var(--colorNeutralForegroundDisabled);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
:where(.disabled) > .input {
|
|
184
|
+
color: var(--colorNeutralForegroundDisabled);
|
|
185
|
+
cursor: not-allowed;
|
|
186
|
+
background-color: var(--colorTransparentBackground);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.incrementButton:active,
|
|
190
|
+
.decrementButton:active {
|
|
191
|
+
outline-style: none;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.incrementButton:enabled:hover,
|
|
195
|
+
.decrementButton:enabled:hover {
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
color: var(--colorNeutralForeground3Hover);
|
|
198
|
+
background-color: var(--colorSubtleBackgroundHover);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.incrementButton:enabled:active,
|
|
202
|
+
.decrementButton:enabled:active {
|
|
203
|
+
color: var(--colorNeutralForeground3Pressed);
|
|
204
|
+
background-color: var(--colorSubtleBackgroundPressed);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.incrementButton:enabled:global(.fui-SpinButton__button_active),
|
|
208
|
+
.decrementButton:enabled:global(.fui-SpinButton__button_active) {
|
|
209
|
+
color: var(--colorNeutralForeground3Pressed);
|
|
210
|
+
background-color: var(--colorSubtleBackgroundPressed);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.incrementButton:disabled,
|
|
214
|
+
.decrementButton:disabled {
|
|
215
|
+
cursor: not-allowed;
|
|
216
|
+
color: var(--colorNeutralForegroundDisabled);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.incrementButton,
|
|
220
|
+
.decrementButton {
|
|
221
|
+
display: inline-flex;
|
|
222
|
+
width: var(--spacingHorizontalXXL);
|
|
223
|
+
align-items: center;
|
|
224
|
+
justify-content: center;
|
|
225
|
+
border: 0;
|
|
226
|
+
position: absolute;
|
|
227
|
+
outline-style: none;
|
|
228
|
+
height: var(--spacingHorizontalL);
|
|
229
|
+
background-color: transparent;
|
|
230
|
+
color: var(--colorNeutralForeground3);
|
|
231
|
+
grid-column-start: 2;
|
|
232
|
+
border-radius: 0;
|
|
233
|
+
padding: 0 calc(var(--spacingHorizontalXS) * 1.25) 0 calc(var(--spacingHorizontalXS) * 1.25);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.incrementButton {
|
|
237
|
+
grid-row-start: 1;
|
|
238
|
+
border-start-end-radius: var(--borderRadiusMedium);
|
|
239
|
+
padding-top: var(--spacingHorizontalXS);
|
|
240
|
+
padding-bottom: var(--strokeWidthThin);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.decrementButton {
|
|
244
|
+
grid-row-start: 2;
|
|
245
|
+
border-end-end-radius: var(--borderRadiusMedium);
|
|
246
|
+
padding-top: var(--strokeWidthThin);
|
|
247
|
+
padding-bottom: var(--spacingHorizontalXS);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
:where(.small) > .incrementButton {
|
|
251
|
+
padding: var(--strokeWidthThicker) var(--spacingHorizontalSNudge) 0px var(--spacingHorizontalXS);
|
|
252
|
+
height: var(--spacingHorizontalM);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
:where(.small) > .incrementButton:where(:dir(rtl)) {
|
|
256
|
+
padding: var(--strokeWidthThicker) var(--spacingHorizontalXS) 0px var(--spacingHorizontalSNudge);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
:where(.small) > .decrementButton {
|
|
260
|
+
padding: 0px var(--spacingHorizontalSNudge) var(--strokeWidthThicker) var(--spacingHorizontalXS);
|
|
261
|
+
height: var(--spacingHorizontalM);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
:where(.small) > .decrementButton:where(:dir(rtl)) {
|
|
265
|
+
padding: 0px var(--spacingHorizontalXS) var(--strokeWidthThicker) var(--spacingHorizontalSNudge);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
:where(.underline) > .incrementButton:enabled:hover,
|
|
269
|
+
:where(.underline) > .decrementButton:enabled:hover {
|
|
270
|
+
color: var(--colorNeutralForeground3Hover);
|
|
271
|
+
background-color: var(--colorSubtleBackgroundHover);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
:where(.underline) > .incrementButton:enabled:active,
|
|
275
|
+
:where(.underline) > .decrementButton:enabled:active {
|
|
276
|
+
color: var(--colorNeutralForeground3Pressed);
|
|
277
|
+
background-color: var(--colorSubtleBackgroundPressed);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
:where(.underline) > .incrementButton:enabled:global(.fui-SpinButton__button_active),
|
|
281
|
+
:where(.underline) > .decrementButton:enabled:global(.fui-SpinButton__button_active) {
|
|
282
|
+
color: var(--colorNeutralForeground3Pressed);
|
|
283
|
+
background-color: var(--colorSubtleBackgroundPressed);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
:where(.underline) > .incrementButton:disabled,
|
|
287
|
+
:where(.underline) > .decrementButton:disabled {
|
|
288
|
+
color: var(--colorNeutralForegroundDisabled);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
:where(.underline) > .incrementButton,
|
|
292
|
+
:where(.underline) > .decrementButton {
|
|
293
|
+
background-color: transparent;
|
|
294
|
+
color: var(--colorNeutralForeground3);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
:where(.filled-darker) > .incrementButton:enabled:hover,
|
|
298
|
+
:where(.filled-darker) > .decrementButton:enabled:hover {
|
|
299
|
+
color: var(--colorNeutralForeground3Hover);
|
|
300
|
+
background-color: var(--colorNeutralBackground3Hover);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
:where(.filled-darker) > .incrementButton:enabled:active,
|
|
304
|
+
:where(.filled-darker) > .decrementButton:enabled:active {
|
|
305
|
+
color: var(--colorNeutralForeground3Pressed);
|
|
306
|
+
background-color: var(--colorNeutralBackground3Pressed);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
:where(.filled-darker) > .incrementButton:enabled:global(.fui-SpinButton__button_active),
|
|
310
|
+
:where(.filled-darker) > .decrementButton:enabled:global(.fui-SpinButton__button_active) {
|
|
311
|
+
color: var(--colorNeutralForeground3Pressed);
|
|
312
|
+
background-color: var(--colorNeutralBackground3Pressed);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
:where(.filled-darker) > .incrementButton:disabled,
|
|
316
|
+
:where(.filled-darker) > .decrementButton:disabled {
|
|
317
|
+
color: var(--colorNeutralForegroundDisabled);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
:where(.filled-darker) > .incrementButton,
|
|
321
|
+
:where(.filled-darker) > .decrementButton {
|
|
322
|
+
background-color: transparent;
|
|
323
|
+
color: var(--colorNeutralForeground3);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
:where(.filled-lighter) > .incrementButton:enabled:hover,
|
|
327
|
+
:where(.filled-lighter) > .decrementButton:enabled:hover {
|
|
328
|
+
color: var(--colorNeutralForeground3Hover);
|
|
329
|
+
background-color: var(--colorNeutralBackground1Hover);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
:where(.filled-lighter) > .incrementButton:enabled:active,
|
|
333
|
+
:where(.filled-lighter) > .incrementButton:enabled:global(.fui-SpinButton__button_active),
|
|
334
|
+
:where(.filled-lighter) > .decrementButton:enabled:active,
|
|
335
|
+
:where(.filled-lighter) > .decrementButton:enabled:global(.fui-SpinButton__button_active) {
|
|
336
|
+
color: var(--colorNeutralForeground3Pressed);
|
|
337
|
+
background-color: var(--colorNeutralBackground1Pressed);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
:where(.filled-lighter) > .incrementButton:disabled,
|
|
341
|
+
:where(.filled-lighter) > .decrementButton:disabled {
|
|
342
|
+
color: var(--colorNeutralForegroundDisabled);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
:where(.filled-lighter) > .incrementButton,
|
|
346
|
+
:where(.filled-lighter) > .decrementButton {
|
|
347
|
+
background-color: transparent;
|
|
348
|
+
color: var(--colorNeutralForeground3);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
@media screen and (prefers-reduced-motion: reduce) {
|
|
352
|
+
.root::after {
|
|
353
|
+
transition-duration: 0.01ms;
|
|
354
|
+
transition-delay: 0.01ms;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@media screen and (prefers-reduced-motion: reduce) {
|
|
359
|
+
.root:focus-within::after {
|
|
360
|
+
transition-duration: 0.01ms;
|
|
361
|
+
transition-delay: 0.01ms;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
@media (forced-colors: active) {
|
|
366
|
+
.disabled::before {
|
|
367
|
+
border-top-color: GrayText;
|
|
368
|
+
border-inline-end-color: GrayText;
|
|
369
|
+
border-bottom-color: GrayText;
|
|
370
|
+
border-inline-start-color: GrayText;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SpinButton/SpinButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, DistributiveOmit, Slot } from '@fluentui/react-utilities';\nimport type * as React from 'react';\n\nexport type SpinButtonSlots = {\n /**\n * The root element of SpinButton is a container `<div>`.\n * The root slot receives the `className` and `style` specified on the `<SpinButton>`.\n * All other native props are applied to the primary slot: `input`.\n */\n root: NonNullable<Slot<'span'>>;\n\n /**\n * Input that displays the current value and accepts direct input from the user.\n * Displayed value is formatted.\n *\n * This is the primary slot.\n */\n input: NonNullable<Slot<'input'>>;\n\n /**\n * Renders the increment control.\n */\n incrementButton: NonNullable<Slot<'button'>>;\n\n /**\n * Renders the decrement control.\n */\n decrementButton: NonNullable<Slot<'button'>>;\n};\n\n/**\n * SpinButton Props\n */\nexport type SpinButtonProps = Omit<\n ComponentProps<Partial<SpinButtonSlots>, 'input'>,\n 'defaultValue' | 'onChange' | 'size' | 'value'\n> & {\n /**\n * Controls the colors and borders of the input.\n * @default 'outline'\n */\n appearance?: 'outline' | 'underline' | 'filled-darker' | 'filled-lighter';\n\n /**\n * Initial value of the control (assumed to be valid). Updates to this prop will not be respected.\n *\n * Use this if you intend for the SpinButton to be an uncontrolled component which maintains its\n * own value. For a controlled component, use `value` instead. (Mutually exclusive with `value`.)\n *\n * Use `null` to indicate the control has no value.\n */\n defaultValue?: number | null;\n\n /**\n * String representation of `value`.\n *\n * Use this when displaying the value to users as something other than a plain number.\n * For example, when displaying currency values this might be \"$1.00\" when value is `1`.\n *\n * Only provide this if the SpinButton is a controlled component where you are maintaining its\n * current state and passing updates based on change events. When SpinButton is used as an\n * uncontrolled component this prop is ignored.\n */\n displayValue?: string;\n\n /**\n * Max value of the control. If not provided, the control has no maximum value.\n */\n max?: number;\n\n /**\n * Min value of the control. If not provided, the control has no minimum value.\n */\n min?: number;\n\n /**\n * Callback for when the committed value changes.\n * - User presses the up/down buttons (on single press or every spin)\n * - User presses the up/down arrow keys (on single press or every spin)\n * - User *commits* edits to the input text by focusing away (blurring) or pressing enter.\n * Note that this is NOT called for every key press while the user is editing.\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onChange?: (event: SpinButtonChangeEvent, data: SpinButtonOnChangeData) => void;\n\n /**\n * How many decimal places the value should be rounded to.\n *\n * The default is calculated based on the precision of `step`: i.e. if step = 1, precision = 0.\n * step = 0.0089, precision = 4. step = 300, precision = 2. step = 23.00, precision = 2.\n */\n precision?: number;\n\n /**\n * Size of the input.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n\n /**\n * Difference between two adjacent values of the control.\n * This value is used to calculate the precision of the input if no `precision` is given.\n * The precision calculated this way will always be greater than or equal 0.\n * @default 1\n */\n step?: number;\n\n /**\n * Large difference between two values. This should be greater than `step` and is used\n * when users hit the Page Up or Page Down keys.\n * @default 1\n */\n stepPage?: number;\n\n /**\n * Current value of the control (assumed to be valid).\n *\n * Only provide this if the SpinButton is a controlled component where you are maintaining its\n * current state and passing updates based on change events; otherwise, use the `defaultValue`\n * property.\n *\n * Use `null` to indicate the control has no value.\n *\n * Mutually exclusive with `defaultValue`.\n */\n value?: number | null;\n};\n\n/**\n * State used in rendering SpinButton\n */\nexport type SpinButtonState = ComponentState<SpinButtonSlots> &\n Required<Pick<SpinButtonProps, 'appearance' | 'size'>> & {\n /**\n * State used to track which direction, if any, SpinButton is currently spinning.\n * @default 'rest'\n */\n spinState: SpinButtonSpinState;\n\n /**\n * State used to track if the value is at the range bounds of [min-max].\n * @default 'none'\n */\n atBound: SpinButtonBounds;\n };\n\nexport type SpinButtonChangeEvent =\n | React.MouseEvent<HTMLButtonElement>\n | React.ChangeEvent<HTMLElement>\n | React.FocusEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLInputElement>;\n\nexport type SpinButtonOnChangeData = {\n value?: number | null;\n displayValue?: string;\n};\n\nexport type SpinButtonSpinState = 'rest' | 'up' | 'down';\nexport type SpinButtonBounds = 'none' | 'min' | 'max' | 'both';\n\nexport type SpinButtonBaseProps = DistributiveOmit<SpinButtonProps, 'appearance' | 'size'>;\nexport type SpinButtonBaseState = DistributiveOmit<SpinButtonState, 'appearance' | 'size'>;\n"],"names":[],"mappings":"AAiKA,WAA2F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SpinButton/index.ts"],"sourcesContent":["export { SpinButton } from './SpinButton';\nexport type {\n SpinButtonBaseProps,\n SpinButtonBaseState,\n SpinButtonBounds,\n SpinButtonChangeEvent,\n SpinButtonOnChangeData,\n SpinButtonProps,\n SpinButtonSlots,\n SpinButtonSpinState,\n SpinButtonState,\n} from './SpinButton.types';\nexport { renderSpinButton_unstable } from './renderSpinButton';\nexport { useSpinButtonBase_unstable, useSpinButton_unstable } from './useSpinButton';\nexport { spinButtonClassNames, useSpinButtonStyles_unstable } from './useSpinButtonStyles.styles';\n"],"names":["SpinButton","renderSpinButton_unstable","useSpinButtonBase_unstable","useSpinButton_unstable","spinButtonClassNames","useSpinButtonStyles_unstable"],"mappings":"AAAA,SAASA,UAAU,QAAQ,kBAAe;AAY1C,SAASC,yBAAyB,QAAQ,wBAAqB;AAC/D,SAASC,0BAA0B,EAAEC,sBAAsB,QAAQ,qBAAkB;AACrF,SAASC,oBAAoB,EAAEC,4BAA4B,QAAQ,kCAA+B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { assertSlots } from "@fluentui/react-utilities";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from "@fluentui/react-utilities";
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of SpinButton
|
|
5
5
|
*/ export const renderSpinButton_unstable = (state)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SpinButton/renderSpinButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { SpinButtonBaseState, SpinButtonSlots } from './SpinButton.types';\n\n/**\n * Render the final JSX of SpinButton\n */\nexport const renderSpinButton_unstable = (state: SpinButtonBaseState): JSXElement => {\n assertSlots<SpinButtonSlots>(state);\n\n return (\n <state.root>\n <state.input />\n <state.incrementButton />\n <state.decrementButton />\n </state.root>\n );\n};\n"],"names":["assertSlots","renderSpinButton_unstable","state","root","input","incrementButton","decrementButton"],"mappings":";AAAA,0BAA0B,GAC1B,iDAAiD,GAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxCF,YAA6BE;IAE7B,qBACE,MAACA,MAAMC,IAAI;;0BACT,KAACD,MAAME,KAAK;0BACZ,KAACF,MAAMG,eAAe;0BACtB,KAACH,MAAMI,eAAe;;;AAG5B,EAAE"}
|
|
@@ -6,7 +6,10 @@ import { ArrowUp, ArrowDown, End, Enter, Escape, Home, PageDown, PageUp } from "
|
|
|
6
6
|
import { calculatePrecision, precisionRound, getBound, clamp } from "../../utils/index.js";
|
|
7
7
|
import { ChevronUp16Regular, ChevronDown16Regular } from "@fluentui/react-icons";
|
|
8
8
|
import { useOverrides_unstable as useOverrides } from "@fluentui/react-shared-contexts";
|
|
9
|
-
|
|
9
|
+
// A single tap on a trackpad can take ~200-250ms before mouseup fires. Keep the initial
|
|
10
|
+
// repeat delay above that range so a tap is treated as one click while a true hold still
|
|
11
|
+
// triggers repeat behavior.
|
|
12
|
+
const DEFAULT_SPIN_DELAY_MS = 300;
|
|
10
13
|
const MIN_SPIN_DELAY_MS = 80;
|
|
11
14
|
const MAX_SPIN_TIME_MS = 1000;
|
|
12
15
|
// This is here to give an ease for the mouse held down case.
|
|
@@ -19,6 +22,7 @@ const lerp = (start, end, percent)=>start + (end - start) * percent;
|
|
|
19
22
|
* @param props - props from this instance of SpinButton (without appearance/size)
|
|
20
23
|
* @param ref - reference to root HTMLElement of SpinButton
|
|
21
24
|
*/ export const useSpinButtonBase_unstable = (props, ref)=>{
|
|
25
|
+
var _internalState_current_value, _state_input_ariavaluetext;
|
|
22
26
|
// Merge props from surrounding <Field>, if any
|
|
23
27
|
props = useFieldControlProps_unstable(props, {
|
|
24
28
|
supportsLabelFor: true,
|
|
@@ -264,10 +268,8 @@ const lerp = (start, end, percent)=>start + (end - start) * percent;
|
|
|
264
268
|
state.input['aria-valuemin'] = min;
|
|
265
269
|
// eslint-disable-next-line react-hooks/refs
|
|
266
270
|
state.input['aria-valuemax'] = max;
|
|
267
|
-
var _internalState_current_value;
|
|
268
271
|
// eslint-disable-next-line react-hooks/refs
|
|
269
272
|
state.input['aria-valuenow'] = (_internalState_current_value = internalState.current.value) !== null && _internalState_current_value !== void 0 ? _internalState_current_value : undefined;
|
|
270
|
-
var _state_input_ariavaluetext;
|
|
271
273
|
// eslint-disable-next-line react-hooks/refs
|
|
272
274
|
state.input['aria-valuetext'] = (_state_input_ariavaluetext = state.input['aria-valuetext']) !== null && _state_input_ariavaluetext !== void 0 ? _state_input_ariavaluetext : value !== undefined && displayValue || undefined;
|
|
273
275
|
// eslint-disable-next-line react-hooks/refs
|
|
@@ -304,14 +306,11 @@ const lerp = (start, end, percent)=>start + (end - start) * percent;
|
|
|
304
306
|
* @param props - props from this instance of SpinButton
|
|
305
307
|
* @param ref - reference to root HTMLElement of SpinButton
|
|
306
308
|
*/ export const useSpinButton_unstable = (props, ref)=>{
|
|
307
|
-
var _state_incrementButton, _state_decrementButton;
|
|
309
|
+
var _overrides_inputDefaultAppearance, _state_incrementButton, _children, _state_decrementButton, _children1;
|
|
308
310
|
const overrides = useOverrides();
|
|
309
|
-
var _overrides_inputDefaultAppearance;
|
|
310
311
|
const { appearance = (_overrides_inputDefaultAppearance = overrides.inputDefaultAppearance) !== null && _overrides_inputDefaultAppearance !== void 0 ? _overrides_inputDefaultAppearance : 'outline', size = 'medium', ...baseProps } = props;
|
|
311
312
|
const state = useSpinButtonBase_unstable(baseProps, ref);
|
|
312
|
-
var _children;
|
|
313
313
|
(_children = (_state_incrementButton = state.incrementButton).children) !== null && _children !== void 0 ? _children : _state_incrementButton.children = /*#__PURE__*/ React.createElement(ChevronUp16Regular, null);
|
|
314
|
-
var _children1;
|
|
315
314
|
(_children1 = (_state_decrementButton = state.decrementButton).children) !== null && _children1 !== void 0 ? _children1 : _state_decrementButton.children = /*#__PURE__*/ React.createElement(ChevronDown16Regular, null);
|
|
316
315
|
return {
|
|
317
316
|
...state,
|