@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
@@ -0,0 +1,379 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSpinButtonStyles_unstable = exports.spinButtonClassNames = void 0;
7
+
8
+ const react_1 = /*#__PURE__*/require("@griffel/react");
9
+
10
+ const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
11
+
12
+ const react_input_1 = /*#__PURE__*/require("@fluentui/react-input");
13
+
14
+ exports.spinButtonClassNames = {
15
+ root: 'fui-SpinButton',
16
+ input: 'fui-SpinButton__input',
17
+ incrementButton: 'fui-SpinButton__incrementButton',
18
+ decrementButton: 'fui-SpinButton__decrementButton'
19
+ };
20
+ const spinButtonExtraClassNames = {
21
+ buttonActive: 'fui-SpinButton__button_active'
22
+ }; // TODO(sharing) use theme values once available
23
+
24
+ const horizontalSpacing = {
25
+ xs: '4px'
26
+ };
27
+
28
+ const useRootStyles = /*#__PURE__*/react_1.__styles({
29
+ "base": {
30
+ "mc9l5x": "fwk3njj",
31
+ "Budl1dq": "f1sr6ibj",
32
+ "wkccdc": "fio9c21",
33
+ "i8kkvl": "f1q8lukm",
34
+ "Belr9w4": "f1sff6ri",
35
+ "z189sj": ["fhxju0i", "f1cnd47f"],
36
+ "qhf8xq": "f10pi13n",
37
+ "B4j52fo": "fre7gi1",
38
+ "Bekrc4i": ["f1358rze", "f1rvrf73"],
39
+ "Bn0qgzm": "fqdk4by",
40
+ "ibv6hh": ["f1rvrf73", "f1358rze"],
41
+ "gd4gdo": "f1ngn1p8",
42
+ "Ftih45": "f1wl9k8s",
43
+ "Bcvre1j": "fyl8oag",
44
+ "Brfgrao": "f1j7ml58",
45
+ "Bciustq": "ffi060y",
46
+ "mdwyqc": ["f1f351id", "f1fzr1x6"],
47
+ "lawp4y": "fchca7p",
48
+ "Fbdkly": ["f1fzr1x6", "f1f351id"],
49
+ "Budzafs": ["f1pl9g23", "f3orl67"],
50
+ "r59vdv": ["f3orl67", "f1pl9g23"],
51
+ "n07z76": ["f2gop1n", "f11nyhth"],
52
+ "ck0cow": ["f11nyhth", "f2gop1n"],
53
+ "Cgzuqd": "fxuihnu",
54
+ "Ehzi8l": "fzjygzn",
55
+ "cnmfks": ["f15lyva8", "f1cvlmu2"],
56
+ "Bj55yzk": "fw2wsqs",
57
+ "jc51t6": ["f1cvlmu2", "f15lyva8"],
58
+ "Bunff0j": "f17tkotb"
59
+ },
60
+ "outline": {
61
+ "B0qfbqy": "f1fjh9ub",
62
+ "B4f6apu": ["ff9c942", "f6rdg5o"],
63
+ "y0oebl": "fdw6hkg",
64
+ "uvfttm": ["f6rdg5o", "ff9c942"],
65
+ "Bdkvgpv": "f163fonl",
66
+ "m598lv": ["f1yq6w5o", "f1jpmc5p"],
67
+ "qa3bma": "f11yjt3y",
68
+ "Bbv0w2i": ["f1jpmc5p", "f1yq6w5o"],
69
+ "Bq4z7u6": "f10tv6oz",
70
+ "Bk5zm6e": ["f16xp3sf", "f1seuxxq"],
71
+ "Bqjgrrk": "fchs65t",
72
+ "Bm6vgfq": ["f1seuxxq", "f16xp3sf"]
73
+ },
74
+ "outlineInteractive": {
75
+ "Bo3r8zu": "f1w2y1rc",
76
+ "Hpvxnh": ["f1gofhvl", "f18htlvq"],
77
+ "Bx11ytk": "ffcnd28",
78
+ "B1rg0w0": ["f18htlvq", "f1gofhvl"],
79
+ "Bsg1tlv": "f6lmxco",
80
+ "Brjw370": ["fcoc0mf", "f15r4wkl"],
81
+ "xcfy85": "f1ipdth8",
82
+ "Bcc6kan": ["f15r4wkl", "fcoc0mf"]
83
+ },
84
+ "underline": {
85
+ "Budzafs": ["fw32bj", "fziivox"],
86
+ "r59vdv": ["fziivox", "fw32bj"],
87
+ "n07z76": ["feccbv4", "f1jqz70h"],
88
+ "ck0cow": ["f1jqz70h", "feccbv4"],
89
+ "y0oebl": "fdw6hkg",
90
+ "qa3bma": "f11yjt3y",
91
+ "Bqjgrrk": "fchs65t"
92
+ },
93
+ "underlineInteractive": {
94
+ "Bx11ytk": "ffcnd28",
95
+ "xcfy85": "f1ipdth8"
96
+ },
97
+ "filled": {
98
+ "B0qfbqy": "f1fjh9ub",
99
+ "B4f6apu": ["ff9c942", "f6rdg5o"],
100
+ "y0oebl": "fdw6hkg",
101
+ "uvfttm": ["f6rdg5o", "ff9c942"],
102
+ "Bdkvgpv": "f163fonl",
103
+ "m598lv": ["f1yq6w5o", "f1jpmc5p"],
104
+ "qa3bma": "f11yjt3y",
105
+ "Bbv0w2i": ["f1jpmc5p", "f1yq6w5o"],
106
+ "Bq4z7u6": "f7dgwnz",
107
+ "Bk5zm6e": ["f1edeodt", "fszsv3f"],
108
+ "Bqjgrrk": "f1172wan",
109
+ "Bm6vgfq": ["fszsv3f", "f1edeodt"]
110
+ },
111
+ "filledInteractive": {
112
+ "B05mzqr": "f1xqt08",
113
+ "tb9y6h": ["fzt5lgo", "f8tv3r9"],
114
+ "jcehpj": "fyhrops",
115
+ "B23o0hn": ["f8tv3r9", "fzt5lgo"]
116
+ },
117
+ "disabled": {
118
+ "Bjwas2f": "fg455y9",
119
+ "Bn1d65q": ["f1rvyvqg", "f14g86mu"],
120
+ "Bxeuatn": "f1cwzwz",
121
+ "n51gp8": ["f14g86mu", "f1rvyvqg"]
122
+ },
123
+ "outlineDisabled": {
124
+ "B0qfbqy": "f1fjh9ub",
125
+ "B4f6apu": ["ff9c942", "f6rdg5o"],
126
+ "y0oebl": "fdw6hkg",
127
+ "uvfttm": ["f6rdg5o", "ff9c942"],
128
+ "Bdkvgpv": "f163fonl",
129
+ "m598lv": ["f1yq6w5o", "f1jpmc5p"],
130
+ "qa3bma": "f11yjt3y",
131
+ "Bbv0w2i": ["f1jpmc5p", "f1yq6w5o"],
132
+ "Bq4z7u6": "f1a0lfh7",
133
+ "Bk5zm6e": ["f1p2ejm6", "fmzytvz"],
134
+ "Bqjgrrk": "fas2e61",
135
+ "Bm6vgfq": ["fmzytvz", "f1p2ejm6"],
136
+ "Budzafs": ["f1pl9g23", "f3orl67"],
137
+ "r59vdv": ["f3orl67", "f1pl9g23"],
138
+ "n07z76": ["f2gop1n", "f11nyhth"],
139
+ "ck0cow": ["f11nyhth", "f2gop1n"]
140
+ },
141
+ "underlineDisabled": {
142
+ "y0oebl": "fdw6hkg",
143
+ "qa3bma": "f11yjt3y",
144
+ "Bqjgrrk": "f1syzi09"
145
+ },
146
+ "filledDisabled": {
147
+ "B0qfbqy": "f1fjh9ub",
148
+ "B4f6apu": ["ff9c942", "f6rdg5o"],
149
+ "y0oebl": "fdw6hkg",
150
+ "uvfttm": ["f6rdg5o", "ff9c942"],
151
+ "Bdkvgpv": "f163fonl",
152
+ "m598lv": ["f1yq6w5o", "f1jpmc5p"],
153
+ "qa3bma": "f11yjt3y",
154
+ "Bbv0w2i": ["f1jpmc5p", "f1yq6w5o"],
155
+ "Bq4z7u6": "fd35vam",
156
+ "Bk5zm6e": ["f1n48vvu", "f7wchoe"],
157
+ "Bqjgrrk": "f1syzi09",
158
+ "Bm6vgfq": ["f7wchoe", "f1n48vvu"]
159
+ }
160
+ }, {
161
+ "d": [".fwk3njj{display:inline-grid;}", ".f1sr6ibj{grid-template-columns:1fr 24px;}", ".fio9c21{grid-template-rows:1fr 1fr;}", ".f1q8lukm{-webkit-column-gap:4px;column-gap:4px;}", ".f1sff6ri{row-gap:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f10pi13n{position:relative;}", ".fre7gi1{border-top-width:0;}", ".f1358rze{border-right-width:0;}", ".f1rvrf73{border-left-width:0;}", ".fqdk4by{border-bottom-width:0;}", ".f1ngn1p8{isolation:isolate;}", ".f1wl9k8s::before{content:\"\";}", ".fyl8oag::before{box-sizing:border-box;}", ".f1j7ml58::before{position:absolute;}", ".ffi060y::before{top:0;}", ".f1f351id::before{right:0;}", ".f1fzr1x6::before{left:0;}", ".fchca7p::before{bottom:0;}", ".f1pl9g23::before{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f3orl67::before{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f2gop1n::before{border-top-right-radius:var(--borderRadiusMedium);}", ".f11nyhth::before{border-top-left-radius:var(--borderRadiusMedium);}", ".fxuihnu::before{pointer-events:none;}", ".fzjygzn::before{z-index:10;}", ".f15lyva8:after{right:0;}", ".f1cvlmu2:after{left:0;}", ".fw2wsqs:after{bottom:0;}", ".f17tkotb:after{z-index:20;}", ".f1fjh9ub::before{border-top-width:1px;}", ".ff9c942::before{border-right-width:1px;}", ".f6rdg5o::before{border-left-width:1px;}", ".fdw6hkg::before{border-bottom-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;}", ".f10tv6oz::before{border-top-color:var(--colorNeutralStroke1);}", ".f16xp3sf::before{border-right-color:var(--colorNeutralStroke1);}", ".f1seuxxq::before{border-left-color:var(--colorNeutralStroke1);}", ".fchs65t::before{border-bottom-color:var(--colorNeutralStrokeAccessible);}", ".fw32bj::before{border-bottom-right-radius:0;}", ".fziivox::before{border-bottom-left-radius:0;}", ".feccbv4::before{border-top-right-radius:0;}", ".f1jqz70h::before{border-top-left-radius:0;}", ".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);}", ".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);}", ".f1syzi09::before{border-bottom-color:var(--colorTransparentStrokeDisabled);}", ".fd35vam::before{border-top-color:var(--colorTransparentStrokeDisabled);}", ".f1n48vvu::before{border-right-color:var(--colorTransparentStrokeDisabled);}", ".f7wchoe::before{border-left-color:var(--colorTransparentStrokeDisabled);}"],
162
+ "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,.f1xqt08:focus-within::before{border-top-color:var(--colorTransparentStrokeInteractive);}", ".fzt5lgo:hover,.fzt5lgo:focus-within::before{border-right-color:var(--colorTransparentStrokeInteractive);}", ".f8tv3r9:hover,:focus-within::before{border-left-color:var(--colorTransparentStrokeInteractive);}", ".fyhrops:hover,.fyhrops:focus-within::before{border-bottom-color:var(--colorTransparentStrokeInteractive);}", ".f8tv3r9:hover,.f8tv3r9:focus-within::before{border-left-color:var(--colorTransparentStrokeInteractive);}", ".fzt5lgo:hover,:focus-within::before{border-right-color:var(--colorTransparentStrokeInteractive);}"],
163
+ "a": [".f6lmxco:active,.f6lmxco:focus-within::before{border-top-color:var(--colorNeutralStroke1Pressed);}", ".fcoc0mf:active,.fcoc0mf:focus-within::before{border-right-color:var(--colorNeutralStroke1Pressed);}", ".f15r4wkl:active,:focus-within::before{border-left-color:var(--colorNeutralStroke1Pressed);}", ".f1ipdth8:active,.f1ipdth8:focus-within::before{border-bottom-color:var(--colorNeutralStrokeAccessiblePressed);}", ".f15r4wkl:active,.f15r4wkl:focus-within::before{border-left-color:var(--colorNeutralStroke1Pressed);}", ".fcoc0mf:active,:focus-within::before{border-right-color:var(--colorNeutralStroke1Pressed);}"],
164
+ "t": ["@media (forced-colors: active){.fg455y9{border-top-color:GrayText;}}", "@media (forced-colors: active){.f1rvyvqg{border-right-color:GrayText;}.f14g86mu{border-left-color:GrayText;}}", "@media (forced-colors: active){.f1cwzwz{border-bottom-color:GrayText;}}", "@media (forced-colors: active){.f14g86mu{border-left-color:GrayText;}.f1rvyvqg{border-right-color:GrayText;}}"]
165
+ });
166
+
167
+ const useInputStyles = /*#__PURE__*/react_1.__styles({
168
+ "base": {
169
+ "Br312pm": "fwpfdsa",
170
+ "Bw0ie65": "f1e2fz10",
171
+ "Ijaq50": "f16hsg94",
172
+ "nk6f5a": "fcu02xx",
173
+ "z8tnut": "f1g0x7ka",
174
+ "z189sj": ["fhxju0i", "f1cnd47f"],
175
+ "Byoj8tv": "f1qch9an",
176
+ "uwmqm3": ["f1cnd47f", "fhxju0i"]
177
+ }
178
+ }, {
179
+ "d": [".fwpfdsa{grid-column-start:1;}", ".f1e2fz10{grid-column-end:2;}", ".f16hsg94{grid-row-start:1;}", ".fcu02xx{grid-row-end:3;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}"]
180
+ });
181
+
182
+ const useButtonStyles = /*#__PURE__*/react_1.__styles({
183
+ "base": {
184
+ "mc9l5x": "ftuwxu6",
185
+ "a9b677": "fq4mcun",
186
+ "Bt984gj": "f122n59",
187
+ "Brf1p80": "f4d9j23",
188
+ "B4j52fo": "fre7gi1",
189
+ "Bekrc4i": ["f1358rze", "f1rvrf73"],
190
+ "Bn0qgzm": "fqdk4by",
191
+ "ibv6hh": ["f1rvrf73", "f1358rze"],
192
+ "qhf8xq": "f1euv43f",
193
+ "oeaueh": "f1s6fcnf",
194
+ "Bqenvij": "f1l02sjl",
195
+ "Bfnh471": "fe4wpbb",
196
+ "zwc60e": "fb0xa7e",
197
+ "ezr58z": "f9f7vaa"
198
+ },
199
+ "incrementButton": {
200
+ "Br312pm": "fd46tj4",
201
+ "Bw0ie65": "fz1yyy6",
202
+ "Ijaq50": "f16hsg94",
203
+ "nk6f5a": "f88nxoq",
204
+ "Bbmb7ep": ["f1krrbdw", "f1deotkl"],
205
+ "Beyfa6y": ["f1deotkl", "f1krrbdw"],
206
+ "B7oj6ja": ["f1jar5jt", "fyu767a"],
207
+ "Btl43ni": ["f1ozlkrg", "f10ostut"]
208
+ },
209
+ "incrementButtonSmall": {
210
+ "z8tnut": "f1khb0e9",
211
+ "z189sj": ["fwiuce9", "f15vdbe4"],
212
+ "Byoj8tv": "f1ov4xf1",
213
+ "uwmqm3": ["f15vdbe4", "fwiuce9"]
214
+ },
215
+ "incrementButtonMedium": {
216
+ "z8tnut": "f10ra9hq",
217
+ "z189sj": ["fwiuce9", "f15vdbe4"],
218
+ "Byoj8tv": "f1brlhvm",
219
+ "uwmqm3": ["f15vdbe4", "fwiuce9"]
220
+ },
221
+ "decrementButton": {
222
+ "Br312pm": "fd46tj4",
223
+ "Bw0ie65": "fz1yyy6",
224
+ "Ijaq50": "faunodf",
225
+ "nk6f5a": "fcu02xx",
226
+ "Bbmb7ep": ["f1aa9q02", "f16jpd5f"],
227
+ "Beyfa6y": ["f1deotkl", "f1krrbdw"],
228
+ "B7oj6ja": ["f10ostut", "f1ozlkrg"],
229
+ "Btl43ni": ["f1ozlkrg", "f10ostut"]
230
+ },
231
+ "decrementButtonSmall": {
232
+ "z8tnut": "f1nbblvp",
233
+ "z189sj": ["fwiuce9", "f15vdbe4"],
234
+ "Byoj8tv": "f1jnq6q7",
235
+ "uwmqm3": ["f15vdbe4", "fwiuce9"]
236
+ },
237
+ "decrementButtonMedium": {
238
+ "z8tnut": "f1sl3k7w",
239
+ "z189sj": ["fwiuce9", "f15vdbe4"],
240
+ "Byoj8tv": "f1y2xyjm",
241
+ "uwmqm3": ["f15vdbe4", "fwiuce9"]
242
+ },
243
+ "outline": {
244
+ "De3pzq": "f3rmtva",
245
+ "sj55zd": "f11d4kpn",
246
+ "r4wkhp": "f1no7wuu",
247
+ "B95qlz1": "f1bifk9c",
248
+ "p743kt": "fp1zg4s",
249
+ "B7xitij": "fo6hitd",
250
+ "B6siaa6": "f1wiab75",
251
+ "Ba9qmo4": "fj9zm5z",
252
+ "Dyrjrp": "f1cqwcg4"
253
+ },
254
+ "underline": {
255
+ "De3pzq": "f3rmtva",
256
+ "sj55zd": "f11d4kpn",
257
+ "r4wkhp": "f1no7wuu",
258
+ "B95qlz1": "f1bifk9c",
259
+ "p743kt": "fp1zg4s",
260
+ "B7xitij": "fo6hitd",
261
+ "B6siaa6": "f1wiab75",
262
+ "Ba9qmo4": "fj9zm5z",
263
+ "Dyrjrp": "f1cqwcg4"
264
+ },
265
+ "filledDarker": {
266
+ "De3pzq": "f3rmtva",
267
+ "sj55zd": "f11d4kpn",
268
+ "r4wkhp": "f1no7wuu",
269
+ "B95qlz1": "fwwxidx",
270
+ "p743kt": "fp1zg4s",
271
+ "B7xitij": "f14i52sd",
272
+ "B6siaa6": "f1wiab75",
273
+ "Ba9qmo4": "fwry2ka",
274
+ "Dyrjrp": "f1cqwcg4"
275
+ },
276
+ "filledLighter": {
277
+ "De3pzq": "f3rmtva",
278
+ "sj55zd": "f11d4kpn",
279
+ "r4wkhp": "f1no7wuu",
280
+ "B95qlz1": "f1yywxnv",
281
+ "drw0cw": "fzaa11h",
282
+ "idzz8t": "f4fpmm9",
283
+ "Dyrjrp": "f1cqwcg4"
284
+ }
285
+ }, {
286
+ "d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".fq4mcun{width:24px;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".fre7gi1{border-top-width:0;}", ".f1358rze{border-right-width:0;}", ".f1rvrf73{border-left-width:0;}", ".fqdk4by{border-bottom-width:0;}", ".f1euv43f{position:absolute;}", ".f1s6fcnf{outline-style:none;}", ".f1l02sjl{height:100%;}", ".fe4wpbb:enabled:hover{cursor:pointer;}", ".f9f7vaa:disabled{cursor:not-allowed;}", ".fd46tj4{grid-column-start:2;}", ".fz1yyy6{grid-column-end:3;}", ".f16hsg94{grid-row-start:1;}", ".f88nxoq{grid-row-end:2;}", ".f1krrbdw{border-bottom-right-radius:0;}", ".f1deotkl{border-bottom-left-radius:0;}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f1ozlkrg{border-top-left-radius:0;}", ".f10ostut{border-top-right-radius:0;}", ".f1khb0e9{padding-top:3px;}", ".fwiuce9{padding-right:5px;}", ".f15vdbe4{padding-left:5px;}", ".f1ov4xf1{padding-bottom:0px;}", ".f10ra9hq{padding-top:4px;}", ".f1brlhvm{padding-bottom:1px;}", ".faunodf{grid-row-start:2;}", ".fcu02xx{grid-row-end:3;}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1nbblvp{padding-top:0px;}", ".f1jnq6q7{padding-bottom:3px;}", ".f1sl3k7w{padding-top:1px;}", ".f1y2xyjm{padding-bottom:4px;}", ".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.fui-SpinButton__button_active{color:var(--colorNeutralForeground3Pressed);}", ".f4fpmm9:enabled:active,.f4fpmm9.fui-SpinButton__button_active{background-color:var(--colorNeutralBackground1Pressed);}"],
287
+ "a": [".fb0xa7e:active{outline-style:none;}"]
288
+ }); // Cannot just disable button as they need to remain
289
+ // exposed to ATs like screen readers.
290
+
291
+
292
+ const useButtonDisabledStyles = /*#__PURE__*/react_1.__styles({
293
+ "base": {
294
+ "Bceei9c": "fdrzuqr",
295
+ "eoavqd": "fphbwmw"
296
+ },
297
+ "outline": {
298
+ "sj55zd": "f1s2aq7o",
299
+ "r4wkhp": "few7wvn",
300
+ "B95qlz1": "f110wuh6",
301
+ "p743kt": "f9s4mys",
302
+ "B7xitij": "f10404rc",
303
+ "B6siaa6": "fwzu9cz",
304
+ "Ba9qmo4": "f1snwkb6"
305
+ },
306
+ "underline": {
307
+ "sj55zd": "f1s2aq7o",
308
+ "r4wkhp": "few7wvn",
309
+ "B95qlz1": "f110wuh6",
310
+ "p743kt": "f9s4mys",
311
+ "B7xitij": "f10404rc",
312
+ "B6siaa6": "fwzu9cz",
313
+ "Ba9qmo4": "f1snwkb6"
314
+ },
315
+ "filledDarker": {
316
+ "sj55zd": "f1s2aq7o",
317
+ "r4wkhp": "few7wvn",
318
+ "B95qlz1": "f110wuh6",
319
+ "p743kt": "f9s4mys",
320
+ "B7xitij": "f10404rc",
321
+ "B6siaa6": "fwzu9cz",
322
+ "Ba9qmo4": "f1snwkb6"
323
+ },
324
+ "filledLighter": {
325
+ "sj55zd": "f1s2aq7o",
326
+ "r4wkhp": "few7wvn",
327
+ "B95qlz1": "f110wuh6",
328
+ "p743kt": "f9s4mys",
329
+ "B7xitij": "f10404rc",
330
+ "B6siaa6": "fwzu9cz",
331
+ "Ba9qmo4": "f1snwkb6"
332
+ }
333
+ }, {
334
+ "d": [".fdrzuqr{cursor:not-allowed;}", ".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".few7wvn:enabled:hover{color:var(--colorNeutralForegroundDisabled);}", ".f110wuh6:enabled:hover{background-color:transparent;}", ".f9s4mys:enabled:active{color:var(--colorNeutralForegroundDisabled);}", ".f10404rc:enabled:active{background-color:transparent;}", ".fwzu9cz:enabled.fui-SpinButton__button_active{color:var(--colorNeutralForegroundDisabled);}", ".f1snwkb6:enabled.fui-SpinButton__button_active{background-color:transparent;}"],
335
+ "h": [".fphbwmw:hover{cursor:not-allowed;}"]
336
+ });
337
+ /**
338
+ * Apply styling to the SpinButton slots based on the state
339
+ */
340
+
341
+
342
+ const useSpinButtonStyles_unstable = state => {
343
+ const {
344
+ appearance,
345
+ atBound,
346
+ size
347
+ } = state;
348
+ const disabled = state.input.disabled;
349
+ const filled = appearance.startsWith('filled');
350
+ const rootStyles = useRootStyles();
351
+ const buttonStyles = useButtonStyles();
352
+ const buttonDisabledStyles = useButtonDisabledStyles();
353
+ const inputStyles = useInputStyles(); // Grab the root className here so we can be sure to merge is last
354
+
355
+ const rootClassName = state.root.className;
356
+ state.root.className = undefined; // Reuse react-input's styles without re-using the Input component.
357
+
358
+ react_input_1.useInputStyles_unstable({
359
+ size,
360
+ appearance,
361
+ input: state.input,
362
+ root: state.root,
363
+ components: {
364
+ root: 'span',
365
+ input: 'input',
366
+ contentBefore: 'span',
367
+ contentAfter: 'span'
368
+ }
369
+ });
370
+ state.root.className = react_1.mergeClasses(state.root.className, // Get the classes from useInputStyles_unstable
371
+ exports.spinButtonClassNames.root, rootStyles.base, 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 && rootStyles.disabled, disabled && appearance === 'outline' && rootStyles.outlineDisabled, disabled && appearance === 'underline' && rootStyles.underlineDisabled, disabled && filled && rootStyles.filledDisabled, rootClassName);
372
+ state.incrementButton.className = react_1.mergeClasses(exports.spinButtonClassNames.incrementButton, state.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);
373
+ state.decrementButton.className = react_1.mergeClasses(exports.spinButtonClassNames.decrementButton, state.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);
374
+ state.input.className = react_1.mergeClasses(exports.spinButtonClassNames.input, state.input.className, inputStyles.base);
375
+ return state;
376
+ };
377
+
378
+ exports.useSpinButtonStyles_unstable = useSpinButtonStyles_unstable;
379
+ //# sourceMappingURL=useSpinButtonStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/SpinButton/useSpinButtonStyles.ts"],"names":[],"mappings":"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","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\n// TODO(sharing) use theme values once available\nconst horizontalSpacing = {\n xs: '4px',\n};\n\nconst useRootStyles = makeStyles({\n base: {\n display: 'inline-grid',\n gridTemplateColumns: `1fr 24px`,\n gridTemplateRows: '1fr 1fr',\n columnGap: horizontalSpacing.xs,\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 // TODO: change this to `::after`. Needs to be changed at the same time as react-input.\n ':after': {\n right: 0,\n bottom: 0,\n left: 0,\n zIndex: 20,\n },\n },\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 disabled: {\n '@media (forced-colors: active)': {\n ...shorthands.borderColor('GrayText'),\n },\n },\n\n outlineDisabled: {\n '::before': {\n ...shorthands.border('1px', 'solid', tokens.colorNeutralStrokeDisabled),\n ...shorthands.borderRadius(tokens.borderRadiusMedium), // because underline doesn't usually have a radius\n },\n },\n\n underlineDisabled: {\n '::before': {\n ...shorthands.borderBottom('1px', 'solid', tokens.colorTransparentStrokeDisabled),\n },\n },\n\n filledDisabled: {\n '::before': {\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStrokeDisabled),\n },\n },\n});\n\nconst useInputStyles = makeStyles({\n base: {\n gridColumnStart: '1',\n gridColumnEnd: '2',\n gridRowStart: '1',\n gridRowEnd: '3',\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 // TODO: revisit these padding numbers for aligning the icon.\n // Padding values aren't perfect.\n // The icon doesn't align perfectly with the Figma designs.\n // It's set in a 16x16px square but the artwork is inset from that\n // so I've had to compute the numbers by handle.\n // Additionally the design uses fractional values so these are\n // rounded to the nearest integer.\n incrementButtonSmall: {\n ...shorthands.padding('3px', '5px', '0px', '5px'),\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', '5px', '3px', '5px'),\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 filledDarker: {\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 filledLighter: {\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 filledDarker: {\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 filledLighter: {\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, size } = state;\n const disabled = state.input.disabled;\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 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 && rootStyles.disabled,\n disabled && appearance === 'outline' && rootStyles.outlineDisabled,\n disabled && appearance === 'underline' && rootStyles.underlineDisabled,\n disabled && filled && rootStyles.filledDisabled,\n rootClassName, // Make sure any original class name is applied last\n );\n\n state.incrementButton.className = mergeClasses(\n spinButtonClassNames.incrementButton,\n state.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 state.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"],"sourceRoot":"../src/"}
@@ -0,0 +1,2 @@
1
+ export { SpinButton, renderSpinButton_unstable, spinButtonClassNames, useSpinButtonStyles_unstable, useSpinButton_unstable, } from './SpinButton';
2
+ export type { SpinButtonOnChangeData, SpinButtonChangeEvent, SpinButtonCommons, SpinButtonProps, SpinButtonSlots, SpinButtonState, SpinButtonSpinState, SpinButtonBounds, SpinButtonStrings, } from './SpinButton';
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSpinButton_unstable = exports.useSpinButtonStyles_unstable = exports.spinButtonClassNames = exports.renderSpinButton_unstable = exports.SpinButton = void 0;
7
+
8
+ var SpinButton_1 = /*#__PURE__*/require("./SpinButton");
9
+
10
+ Object.defineProperty(exports, "SpinButton", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return SpinButton_1.SpinButton;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "renderSpinButton_unstable", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return SpinButton_1.renderSpinButton_unstable;
20
+ }
21
+ });
22
+ Object.defineProperty(exports, "spinButtonClassNames", {
23
+ enumerable: true,
24
+ get: function () {
25
+ return SpinButton_1.spinButtonClassNames;
26
+ }
27
+ });
28
+ Object.defineProperty(exports, "useSpinButtonStyles_unstable", {
29
+ enumerable: true,
30
+ get: function () {
31
+ return SpinButton_1.useSpinButtonStyles_unstable;
32
+ }
33
+ });
34
+ Object.defineProperty(exports, "useSpinButton_unstable", {
35
+ enumerable: true,
36
+ get: function () {
37
+ return SpinButton_1.useSpinButton_unstable;
38
+ }
39
+ });
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,YAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,UAAA;AAAU;AAAV,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,2BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,yBAAA;AAAyB;AAAzB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,sBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,oBAAA;AAAoB;AAApB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,8BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,4BAAA;AAA4B;AAA5B,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,YAAA,CAAA,sBAAA;AAAsB;AAAtB,CAAA","sourcesContent":["export {\n SpinButton,\n renderSpinButton_unstable,\n spinButtonClassNames,\n useSpinButtonStyles_unstable,\n useSpinButton_unstable,\n} from './SpinButton';\nexport type {\n SpinButtonOnChangeData,\n SpinButtonChangeEvent,\n SpinButtonCommons,\n SpinButtonProps,\n SpinButtonSlots,\n SpinButtonState,\n SpinButtonSpinState,\n SpinButtonBounds,\n SpinButtonStrings,\n} from './SpinButton';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1 @@
1
+ export declare const clampWhenInRange: (oldValue: number, newValue: number, min?: number | undefined, max?: number | undefined) => number;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clampWhenInRange = void 0;
7
+
8
+ const clampWhenInRange = (oldValue, newValue, min, max) => {
9
+ // When oldValue is in the range of [min, max] clamp newValue.
10
+ // Don't clamp values outside this range so users get a
11
+ // more natural behavior. For example, if the range is [5, 15]
12
+ // and the user types 1 into the input we don't want to clamp
13
+ // the value when they next press the increment button because
14
+ // clamping would snap the value to 5 rather than increment to 2.
15
+ let nextValue = newValue;
16
+
17
+ if (min !== undefined && oldValue >= min) {
18
+ if (max !== undefined && min > max) {
19
+ const error = new Error();
20
+
21
+ if (process.env.NODE_ENV !== 'production') {
22
+ // eslint-disable-next-line no-console
23
+ console.error([`"min" value "${min}" is greater than "max" value "${max}".`, '"min" must be less than or equal to "max".', `Returning value "${newValue}".`, error.stack].join());
24
+ }
25
+
26
+ return newValue;
27
+ }
28
+
29
+ nextValue = Math.max(min, nextValue);
30
+ }
31
+
32
+ if (max !== undefined && oldValue <= max) {
33
+ nextValue = Math.min(max, nextValue);
34
+ }
35
+
36
+ return nextValue;
37
+ };
38
+
39
+ exports.clampWhenInRange = clampWhenInRange;
40
+ //# sourceMappingURL=clamp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/clamp.ts"],"names":[],"mappings":";;;;;;;AAAO,MAAM,gBAAgB,GAAG,CAAC,QAAD,EAAmB,QAAnB,EAAqC,GAArC,EAAmD,GAAnD,KAA2E;AACzG;AACA;AACA;AACA;AACA;AACA;AACA,MAAI,SAAS,GAAG,QAAhB;;AACA,MAAI,GAAG,KAAK,SAAR,IAAqB,QAAQ,IAAI,GAArC,EAA0C;AACxC,QAAI,GAAG,KAAK,SAAR,IAAqB,GAAG,GAAG,GAA/B,EAAoC;AAClC,YAAM,KAAK,GAAG,IAAI,KAAJ,EAAd;;AACA,UAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;AACzC;AACA,QAAA,OAAO,CAAC,KAAR,CACE,CACE,gBAAgB,GAAG,kCAAkC,GAAG,IAD1D,EAEE,4CAFF,EAGE,oBAAoB,QAAQ,IAH9B,EAIE,KAAK,CAAC,KAJR,EAKE,IALF,EADF;AAQD;;AACD,aAAO,QAAP;AACD;;AAED,IAAA,SAAS,GAAG,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,SAAd,CAAZ;AACD;;AAED,MAAI,GAAG,KAAK,SAAR,IAAqB,QAAQ,IAAI,GAArC,EAA0C;AACxC,IAAA,SAAS,GAAG,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,SAAd,CAAZ;AACD;;AAED,SAAO,SAAP;AACD,CAjCM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["export const clampWhenInRange = (oldValue: number, newValue: number, min?: number, max?: number): number => {\n // When oldValue is in the range of [min, max] clamp newValue.\n // Don't clamp values outside this range so users get a\n // more natural behavior. For example, if the range is [5, 15]\n // and the user types 1 into the input we don't want to clamp\n // the value when they next press the increment button because\n // clamping would snap the value to 5 rather than increment to 2.\n let nextValue = newValue;\n if (min !== undefined && oldValue >= min) {\n if (max !== undefined && min > max) {\n const error = new Error();\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(\n [\n `\"min\" value \"${min}\" is greater than \"max\" value \"${max}\".`,\n '\"min\" must be less than or equal to \"max\".',\n `Returning value \"${newValue}\".`,\n error.stack,\n ].join(),\n );\n }\n return newValue;\n }\n\n nextValue = Math.max(min, nextValue);\n }\n\n if (max !== undefined && oldValue <= max) {\n nextValue = Math.min(max, nextValue);\n }\n\n return nextValue;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,2 @@
1
+ import type { SpinButtonBounds } from '../SpinButton';
2
+ export declare const getBound: (value: number, min?: number | undefined, max?: number | undefined) => SpinButtonBounds;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getBound = void 0;
7
+
8
+ const getBound = (value, min, max) => {
9
+ if (min !== undefined && value === min) {
10
+ if (max === min) {
11
+ return 'both';
12
+ }
13
+
14
+ return 'min';
15
+ } else if (max !== undefined && value === max) {
16
+ return 'max';
17
+ }
18
+
19
+ return 'none';
20
+ };
21
+
22
+ exports.getBound = getBound;
23
+ //# sourceMappingURL=getBound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/getBound.ts"],"names":[],"mappings":";;;;;;;AAEO,MAAM,QAAQ,GAAG,CAAC,KAAD,EAAgB,GAAhB,EAA8B,GAA9B,KAAgE;AACtF,MAAI,GAAG,KAAK,SAAR,IAAqB,KAAK,KAAK,GAAnC,EAAwC;AACtC,QAAI,GAAG,KAAK,GAAZ,EAAiB;AACf,aAAO,MAAP;AACD;;AACD,WAAO,KAAP;AACD,GALD,MAKO,IAAI,GAAG,KAAK,SAAR,IAAqB,KAAK,KAAK,GAAnC,EAAwC;AAC7C,WAAO,KAAP;AACD;;AAED,SAAO,MAAP;AACD,CAXM;;AAAM,OAAA,CAAA,QAAA,GAAQ,QAAR","sourcesContent":["import type { SpinButtonBounds } from '../SpinButton';\n\nexport const getBound = (value: number, min?: number, max?: number): SpinButtonBounds => {\n if (min !== undefined && value === min) {\n if (max === min) {\n return 'both';\n }\n return 'min';\n } else if (max !== undefined && value === max) {\n return 'max';\n }\n\n return 'none';\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,3 @@
1
+ export * from './clamp';
2
+ export * from './getBound';
3
+ export * from './precision';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./clamp"), exports);
10
+
11
+ tslib_1.__exportStar(require("./getBound"), exports);
12
+
13
+ tslib_1.__exportStar(require("./precision"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './clamp';\nexport * from './getBound';\nexport * from './precision';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Calculates a number's precision based on the number of trailing
3
+ * zeros if the number does not have a decimal indicated by a negative
4
+ * precision. Otherwise, it calculates the number of digits after
5
+ * the decimal point indicated by a positive precision.
6
+ * @param value - the value to determine the precision of
7
+ */
8
+ export declare function calculatePrecision(value: number | string): number;
9
+ /**
10
+ * Rounds a number to a certain level of precision. Accepts negative precision.
11
+ * @param value - The value that is being rounded.
12
+ * @param precision - The number of decimal places to round the number to
13
+ */
14
+ export declare function precisionRound(value: number, precision: number, base?: number): number;