@fluentui/react-spinbutton 0.0.0-nightly-20220421-0418.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/CHANGELOG.json +173 -0
  2. package/CHANGELOG.md +71 -0
  3. package/LICENSE +15 -0
  4. package/MIGRATION.md +67 -0
  5. package/README.md +37 -0
  6. package/Spec.md +370 -0
  7. package/dist/react-spinbutton.d.ts +192 -0
  8. package/lib/SpinButton.d.ts +1 -0
  9. package/lib/SpinButton.js +2 -0
  10. package/lib/SpinButton.js.map +1 -0
  11. package/lib/components/SpinButton/SpinButton.d.ts +6 -0
  12. package/lib/components/SpinButton/SpinButton.js +15 -0
  13. package/lib/components/SpinButton/SpinButton.js.map +1 -0
  14. package/lib/components/SpinButton/SpinButton.strings.d.ts +2 -0
  15. package/lib/components/SpinButton/SpinButton.strings.js +5 -0
  16. package/lib/components/SpinButton/SpinButton.strings.js.map +1 -0
  17. package/lib/components/SpinButton/SpinButton.types.d.ts +149 -0
  18. package/lib/components/SpinButton/SpinButton.types.js +2 -0
  19. package/lib/components/SpinButton/SpinButton.types.js.map +1 -0
  20. package/lib/components/SpinButton/index.d.ts +5 -0
  21. package/lib/components/SpinButton/index.js +6 -0
  22. package/lib/components/SpinButton/index.js.map +1 -0
  23. package/lib/components/SpinButton/renderSpinButton.d.ts +5 -0
  24. package/lib/components/SpinButton/renderSpinButton.js +37 -0
  25. package/lib/components/SpinButton/renderSpinButton.js.map +1 -0
  26. package/lib/components/SpinButton/useSpinButton.d.ts +12 -0
  27. package/lib/components/SpinButton/useSpinButton.js +263 -0
  28. package/lib/components/SpinButton/useSpinButton.js.map +1 -0
  29. package/lib/components/SpinButton/useSpinButtonStyles.d.ts +7 -0
  30. package/lib/components/SpinButton/useSpinButtonStyles.js +367 -0
  31. package/lib/components/SpinButton/useSpinButtonStyles.js.map +1 -0
  32. package/lib/index.d.ts +2 -0
  33. package/lib/index.js +2 -0
  34. package/lib/index.js.map +1 -0
  35. package/lib/tsdoc-metadata.json +11 -0
  36. package/lib/utils/clamp.d.ts +1 -0
  37. package/lib/utils/clamp.js +31 -0
  38. package/lib/utils/clamp.js.map +1 -0
  39. package/lib/utils/getBound.d.ts +2 -0
  40. package/lib/utils/getBound.js +14 -0
  41. package/lib/utils/getBound.js.map +1 -0
  42. package/lib/utils/index.d.ts +3 -0
  43. package/lib/utils/index.js +4 -0
  44. package/lib/utils/index.js.map +1 -0
  45. package/lib/utils/precision.d.ts +14 -0
  46. package/lib/utils/precision.js +41 -0
  47. package/lib/utils/precision.js.map +1 -0
  48. package/lib-commonjs/SpinButton.d.ts +1 -0
  49. package/lib-commonjs/SpinButton.js +10 -0
  50. package/lib-commonjs/SpinButton.js.map +1 -0
  51. package/lib-commonjs/components/SpinButton/SpinButton.d.ts +6 -0
  52. package/lib-commonjs/components/SpinButton/SpinButton.js +26 -0
  53. package/lib-commonjs/components/SpinButton/SpinButton.js.map +1 -0
  54. package/lib-commonjs/components/SpinButton/SpinButton.strings.d.ts +2 -0
  55. package/lib-commonjs/components/SpinButton/SpinButton.strings.js +11 -0
  56. package/lib-commonjs/components/SpinButton/SpinButton.strings.js.map +1 -0
  57. package/lib-commonjs/components/SpinButton/SpinButton.types.d.ts +149 -0
  58. package/lib-commonjs/components/SpinButton/SpinButton.types.js +6 -0
  59. package/lib-commonjs/components/SpinButton/SpinButton.types.js.map +1 -0
  60. package/lib-commonjs/components/SpinButton/index.d.ts +5 -0
  61. package/lib-commonjs/components/SpinButton/index.js +18 -0
  62. package/lib-commonjs/components/SpinButton/index.js.map +1 -0
  63. package/lib-commonjs/components/SpinButton/renderSpinButton.d.ts +5 -0
  64. package/lib-commonjs/components/SpinButton/renderSpinButton.js +48 -0
  65. package/lib-commonjs/components/SpinButton/renderSpinButton.js.map +1 -0
  66. package/lib-commonjs/components/SpinButton/useSpinButton.d.ts +12 -0
  67. package/lib-commonjs/components/SpinButton/useSpinButton.js +278 -0
  68. package/lib-commonjs/components/SpinButton/useSpinButton.js.map +1 -0
  69. package/lib-commonjs/components/SpinButton/useSpinButtonStyles.d.ts +7 -0
  70. package/lib-commonjs/components/SpinButton/useSpinButtonStyles.js +379 -0
  71. package/lib-commonjs/components/SpinButton/useSpinButtonStyles.js.map +1 -0
  72. package/lib-commonjs/index.d.ts +2 -0
  73. package/lib-commonjs/index.js +40 -0
  74. package/lib-commonjs/index.js.map +1 -0
  75. package/lib-commonjs/utils/clamp.d.ts +1 -0
  76. package/lib-commonjs/utils/clamp.js +40 -0
  77. package/lib-commonjs/utils/clamp.js.map +1 -0
  78. package/lib-commonjs/utils/getBound.d.ts +2 -0
  79. package/lib-commonjs/utils/getBound.js +23 -0
  80. package/lib-commonjs/utils/getBound.js.map +1 -0
  81. package/lib-commonjs/utils/index.d.ts +3 -0
  82. package/lib-commonjs/utils/index.js +14 -0
  83. package/lib-commonjs/utils/index.js.map +1 -0
  84. package/lib-commonjs/utils/precision.d.ts +14 -0
  85. package/lib-commonjs/utils/precision.js +52 -0
  86. package/lib-commonjs/utils/precision.js.map +1 -0
  87. package/package.json +64 -0
  88. package/spec-assets/spec-spinbutton-anatomy-alt-optional.png +0 -0
  89. package/spec-assets/spec-spinbutton-anatomy.png +0 -0
  90. package/spec-assets/spec-spinbutton-rtl.png +0 -0
package/CHANGELOG.json ADDED
@@ -0,0 +1,173 @@
1
+ {
2
+ "name": "@fluentui/react-spinbutton",
3
+ "entries": [
4
+ {
5
+ "date": "Thu, 21 Apr 2022 04:29:31 GMT",
6
+ "tag": "@fluentui/react-spinbutton_v0.0.0-nightly-20220421-0418.1",
7
+ "version": "0.0.0-nightly-20220421-0418.1",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "email not defined",
12
+ "package": "@fluentui/react-spinbutton",
13
+ "commit": "not available",
14
+ "comment": "Release nightly v9"
15
+ },
16
+ {
17
+ "author": "seanmonahan@microsoft.com",
18
+ "package": "@fluentui/react-spinbutton",
19
+ "commit": "af7befccb9b4897cf99c8a4283ab2cbd80018f69",
20
+ "comment": "react-spinbutton: remove private from package.json"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-spinbutton",
25
+ "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20220421-0418.1",
26
+ "commit": "f5724906c71b58258b0a18025f82f1c1103d97f0"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-spinbutton",
31
+ "comment": "Bump @fluentui/react-input to v0.0.0-nightly-20220421-0418.1",
32
+ "commit": "f5724906c71b58258b0a18025f82f1c1103d97f0"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-spinbutton",
37
+ "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20220421-0418.1",
38
+ "commit": "f5724906c71b58258b0a18025f82f1c1103d97f0"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-spinbutton",
43
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20220421-0418.1",
44
+ "commit": "f5724906c71b58258b0a18025f82f1c1103d97f0"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-spinbutton",
49
+ "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220421-0418.1",
50
+ "commit": "f5724906c71b58258b0a18025f82f1c1103d97f0"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-spinbutton",
55
+ "comment": "Bump @fluentui/react-label to v0.0.0-nightly-20220421-0418.1",
56
+ "commit": "f5724906c71b58258b0a18025f82f1c1103d97f0"
57
+ }
58
+ ]
59
+ }
60
+ },
61
+ {
62
+ "date": "Tue, 19 Apr 2022 19:17:29 GMT",
63
+ "tag": "@fluentui/react-spinbutton_v9.0.0-beta.6",
64
+ "version": "9.0.0-beta.6",
65
+ "comments": {
66
+ "prerelease": [
67
+ {
68
+ "author": "beachball",
69
+ "package": "@fluentui/react-spinbutton",
70
+ "comment": "Bump @fluentui/react-input to v9.0.0-beta.6",
71
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
72
+ },
73
+ {
74
+ "author": "beachball",
75
+ "package": "@fluentui/react-spinbutton",
76
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.5",
77
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
78
+ },
79
+ {
80
+ "author": "beachball",
81
+ "package": "@fluentui/react-spinbutton",
82
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.6",
83
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
84
+ },
85
+ {
86
+ "author": "beachball",
87
+ "package": "@fluentui/react-spinbutton",
88
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.4",
89
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
90
+ },
91
+ {
92
+ "author": "beachball",
93
+ "package": "@fluentui/react-spinbutton",
94
+ "comment": "Bump @fluentui/react-label to v9.0.0-beta.10",
95
+ "commit": "f94b48c825ca8c8b2e3b6755bdd29fe15c7d435d"
96
+ }
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ "date": "Fri, 04 Mar 2022 05:17:40 GMT",
102
+ "tag": "@fluentui/react-spinbutton_v9.0.0-beta.6",
103
+ "version": "9.0.0-beta.6",
104
+ "comments": {
105
+ "prerelease": [
106
+ {
107
+ "author": "beachball",
108
+ "package": "@fluentui/react-spinbutton",
109
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.5",
110
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
111
+ }
112
+ ]
113
+ }
114
+ },
115
+ {
116
+ "date": "Tue, 01 Mar 2022 02:17:40 GMT",
117
+ "tag": "@fluentui/react-spinbutton_v9.0.0-beta.6",
118
+ "version": "9.0.0-beta.6",
119
+ "comments": {
120
+ "prerelease": [
121
+ {
122
+ "author": "beachball",
123
+ "package": "@fluentui/react-spinbutton",
124
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.4",
125
+ "commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
126
+ }
127
+ ]
128
+ }
129
+ },
130
+ {
131
+ "date": "Fri, 18 Feb 2022 13:35:38 GMT",
132
+ "tag": "@fluentui/react-spinbutton_v9.0.0-beta.6",
133
+ "version": "9.0.0-beta.6",
134
+ "comments": {
135
+ "prerelease": [
136
+ {
137
+ "author": "beachball",
138
+ "package": "@fluentui/react-spinbutton",
139
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.3",
140
+ "commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
141
+ },
142
+ {
143
+ "author": "beachball",
144
+ "package": "@fluentui/react-spinbutton",
145
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.3",
146
+ "commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
147
+ }
148
+ ]
149
+ }
150
+ },
151
+ {
152
+ "date": "Thu, 10 Feb 2022 08:52:26 GMT",
153
+ "tag": "@fluentui/react-spinbutton_v9.0.0-beta.5",
154
+ "version": "9.0.0-beta.5",
155
+ "comments": {
156
+ "prerelease": [
157
+ {
158
+ "author": "beachball",
159
+ "package": "@fluentui/react-spinbutton",
160
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.1",
161
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
162
+ },
163
+ {
164
+ "author": "beachball",
165
+ "package": "@fluentui/react-spinbutton",
166
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.1",
167
+ "commit": "e6c855f6d9019d6c73668d15fc9bc3a13291a6c8"
168
+ }
169
+ ]
170
+ }
171
+ }
172
+ ]
173
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ # Change Log - @fluentui/react-spinbutton
2
+
3
+ This log was last generated on Thu, 21 Apr 2022 04:29:31 GMT and should not be manually modified.
4
+
5
+ <!-- Start content -->
6
+
7
+ ## [0.0.0-nightly-20220421-0418.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v0.0.0-nightly-20220421-0418.1)
8
+
9
+ Thu, 21 Apr 2022 04:29:31 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.0.0-beta.6..@fluentui/react-spinbutton_v0.0.0-nightly-20220421-0418.1)
11
+
12
+ ### Changes
13
+
14
+ - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by email not defined)
15
+ - react-spinbutton: remove private from package.json ([PR #22568](https://github.com/microsoft/fluentui/pull/22568) by seanmonahan@microsoft.com)
16
+ - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20220421-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/f5724906c71b58258b0a18025f82f1c1103d97f0) by beachball)
17
+ - Bump @fluentui/react-input to v0.0.0-nightly-20220421-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/f5724906c71b58258b0a18025f82f1c1103d97f0) by beachball)
18
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20220421-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/f5724906c71b58258b0a18025f82f1c1103d97f0) by beachball)
19
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20220421-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/f5724906c71b58258b0a18025f82f1c1103d97f0) by beachball)
20
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220421-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/f5724906c71b58258b0a18025f82f1c1103d97f0) by beachball)
21
+ - Bump @fluentui/react-label to v0.0.0-nightly-20220421-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/f5724906c71b58258b0a18025f82f1c1103d97f0) by beachball)
22
+
23
+ ## [9.0.0-beta.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.0.0-beta.6)
24
+
25
+ Tue, 19 Apr 2022 19:17:29 GMT
26
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.0.0-beta.6..@fluentui/react-spinbutton_v9.0.0-beta.6)
27
+
28
+ ### Changes
29
+
30
+ - Bump @fluentui/react-input to v9.0.0-beta.6 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
31
+ - Bump @fluentui/react-theme to v9.0.0-rc.5 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
32
+ - Bump @fluentui/react-utilities to v9.0.0-rc.6 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
33
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.4 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
34
+ - Bump @fluentui/react-label to v9.0.0-beta.10 ([PR #21995](https://github.com/microsoft/fluentui/pull/21995) by beachball)
35
+
36
+ ## [9.0.0-beta.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.0.0-beta.6)
37
+
38
+ Fri, 04 Mar 2022 05:17:40 GMT
39
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.0.0-beta.6..@fluentui/react-spinbutton_v9.0.0-beta.6)
40
+
41
+ ### Changes
42
+
43
+ - Bump @fluentui/react-utilities to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
44
+
45
+ ## [9.0.0-beta.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.0.0-beta.6)
46
+
47
+ Tue, 01 Mar 2022 02:17:40 GMT
48
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.0.0-beta.6..@fluentui/react-spinbutton_v9.0.0-beta.6)
49
+
50
+ ### Changes
51
+
52
+ - Bump @fluentui/react-utilities to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
53
+
54
+ ## [9.0.0-beta.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.0.0-beta.6)
55
+
56
+ Fri, 18 Feb 2022 13:35:38 GMT
57
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-spinbutton_v9.0.0-beta.5..@fluentui/react-spinbutton_v9.0.0-beta.6)
58
+
59
+ ### Changes
60
+
61
+ - Bump @fluentui/react-utilities to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
62
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
63
+
64
+ ## [9.0.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-spinbutton_v9.0.0-beta.5)
65
+
66
+ Thu, 10 Feb 2022 08:52:26 GMT
67
+
68
+ ### Changes
69
+
70
+ - Bump @fluentui/react-utilities to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
71
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ @fluentui/react-spinbutton
2
+
3
+ Copyright (c) Microsoft Corporation
4
+
5
+ All rights reserved.
6
+
7
+ MIT License
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+
15
+ Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
package/MIGRATION.md ADDED
@@ -0,0 +1,67 @@
1
+ # SpinButton Migration
2
+
3
+ ## Migration from v8
4
+
5
+ - `value: string` => `value: number`. `value` is now a number rather than a string.
6
+ - `defaultValue: string` => `defaultValue: number`. `defaultValue` is now a number.
7
+ - `min` => `min`
8
+ - `max` => `max`
9
+ - `step` => `step`
10
+ - `precision` => `precision`
11
+ - `onChange(event: React.SyntheticEvent<HTMLElement>, newValue? string)` => `onChange(event: SpinButtonChangeEvent, value: SpinButtonOnChangeData)`
12
+ - `onValidate` => Not supported.
13
+ - `onIncrement` => use `onChange`.
14
+ - `onDecrement` => use `onChange`.
15
+ - `label` => use `Label` control with `htmlFor` and `id`.
16
+ - `labelPosition` => use `Label` control
17
+ - `ariaLabel` => use `aria-label` instead.
18
+ - `ariaDescribedBy` => use `aria-describedby` instead.
19
+ - `ariaPositionInSet` => use `aria-posinset` instead.
20
+ - `ariaSetSize` => use `aria-setsize` instead.
21
+ - `ariaValueNow` => remove, set internally by SpinButton
22
+ - `ariaValueText` => remove, set internally by SpinButton
23
+ - `iconProps` => use `Icon` control
24
+
25
+ ### Migrating Custom Suffixes
26
+
27
+ `SpinButton` v9 introduces a new prop called `displayValue` that may be used in conjunction with `value` to display a formatted value in `SpinButton`. To display a value with a custom suffix (or prefix or an entirely different name) just provide the `displayValue` prop to your `SpinButton`:
28
+
29
+ ```jsx
30
+ const [value, setValue] = React.useState(0);
31
+ const [displayValue, setDisplayValue] = React.useState('0 cm');
32
+
33
+ const onChange = (e: SpinButtonChangeEvent, data: SpinButtonOnChangeData): void => {
34
+ if (data.value) {
35
+ setValue(data.value);
36
+ setDisplayValue(`${data.value} cm`);
37
+ }
38
+ };
39
+
40
+ <SpinButton value={value} displayValue={displayValue} onChange={onChange} />;
41
+ ```
42
+
43
+ ### Migrating onIncrement/onDecrement
44
+
45
+ `SpinButton` v9 simply provides a change handler rather than handlers for change, increment and decrement. To handle increment and decrement cases compare the incoming value with the current value:
46
+
47
+ ```jsx
48
+ const [value, setValue] = React.useState(0);
49
+
50
+ const onChange = (e: SpinButtonChangeEvent, data: SpinButtonOnChangeData): void => {
51
+ if (data.value) {
52
+ if (data.value > value) {
53
+ // onIncrement(e, data);
54
+ } else {
55
+ // Don't need an if clause here as onChange only fires when the value changes
56
+ // so it must be different.
57
+ // onDecrement(e, data);
58
+ }
59
+ }
60
+ };
61
+
62
+ <SpinButton value={value} onChange={onChange} />;
63
+ ```
64
+
65
+ ## Migration from v0
66
+
67
+ v0/Northstar does not have a `SpinButton` equivalent so there are no migration steps.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @fluentui/react-spinbutton
2
+
3
+ **SpinButton component for [Fluent UI React](https://aka.ms/fluentui-storybook)**
4
+
5
+ These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
6
+
7
+ SpinButtons are used to allow numeric input bounded between minimum and maximum values with button controls to increment and decrement the input value by some step amount. Values can also be manipulated via the keyboard.
8
+
9
+ ### Usage
10
+
11
+ Import SpinButton:
12
+
13
+ ```js
14
+ import { SpinButton } from '@fluentui/react-spinbutton';
15
+ ```
16
+
17
+ #### Examples
18
+
19
+ ```jsx
20
+ <SpinButton defaultValue={5}/>
21
+ <SpinButton value={value} onChange={onSpinButtonChange}/>
22
+ ```
23
+
24
+ See [Fluent UI Storybook](https://aka.ms/fluentui-storybook) for more detailed usage examples.
25
+
26
+ Alternatively, run Storybook locally with:
27
+
28
+ 1. `yarn start`
29
+ 2. Select `react-spinbutton` from the list.
30
+
31
+ ### Specification
32
+
33
+ See [Spec.md](./Spec.md).
34
+
35
+ ### Migration Guide
36
+
37
+ If you're upgrading to Fluent UI v9 see [MIGRATION.md](./MIGRATION.md) for guidance on updating to the latest SpinButton implementation.