@fluentui/react-spinbutton 9.2.4 → 9.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +97 -1
  3. package/CHANGELOG.md +31 -2
  4. package/lib/SpinButton.js.map +1 -1
  5. package/lib/SpinButtonField.js.map +1 -1
  6. package/lib/components/SpinButton/SpinButton.js.map +1 -1
  7. package/lib/components/SpinButton/SpinButton.types.js +1 -1
  8. package/lib/components/SpinButton/SpinButton.types.js.map +1 -1
  9. package/lib/components/SpinButton/index.js.map +1 -1
  10. package/lib/components/SpinButton/renderSpinButton.js +1 -9
  11. package/lib/components/SpinButton/renderSpinButton.js.map +1 -1
  12. package/lib/components/SpinButton/useSpinButton.js +4 -3
  13. package/lib/components/SpinButton/useSpinButton.js.map +1 -1
  14. package/lib/components/SpinButton/useSpinButtonStyles.js.map +1 -1
  15. package/lib/components/SpinButtonField/SpinButtonField.js +1 -2
  16. package/lib/components/SpinButtonField/SpinButtonField.js.map +1 -1
  17. package/lib/components/SpinButtonField/index.js.map +1 -1
  18. package/lib/index.js.map +1 -1
  19. package/lib/utils/clamp.js.map +1 -1
  20. package/lib/utils/getBound.js.map +1 -1
  21. package/lib/utils/index.js.map +1 -1
  22. package/lib/utils/precision.js +6 -7
  23. package/lib/utils/precision.js.map +1 -1
  24. package/lib-commonjs/SpinButton.js +5 -4
  25. package/lib-commonjs/SpinButton.js.map +1 -1
  26. package/lib-commonjs/SpinButtonField.js +5 -4
  27. package/lib-commonjs/SpinButtonField.js.map +1 -1
  28. package/lib-commonjs/components/SpinButton/SpinButton.js +19 -20
  29. package/lib-commonjs/components/SpinButton/SpinButton.js.map +1 -1
  30. package/lib-commonjs/components/SpinButton/SpinButton.types.js +5 -2
  31. package/lib-commonjs/components/SpinButton/SpinButton.types.js.map +1 -1
  32. package/lib-commonjs/components/SpinButton/index.js +9 -8
  33. package/lib-commonjs/components/SpinButton/index.js.map +1 -1
  34. package/lib-commonjs/components/SpinButton/renderSpinButton.js +13 -24
  35. package/lib-commonjs/components/SpinButton/renderSpinButton.js.map +1 -1
  36. package/lib-commonjs/components/SpinButton/useSpinButton.js +248 -259
  37. package/lib-commonjs/components/SpinButton/useSpinButton.js.map +1 -1
  38. package/lib-commonjs/components/SpinButton/useSpinButtonStyles.js +506 -246
  39. package/lib-commonjs/components/SpinButton/useSpinButtonStyles.js.map +1 -1
  40. package/lib-commonjs/components/SpinButtonField/SpinButtonField.js +17 -11
  41. package/lib-commonjs/components/SpinButtonField/SpinButtonField.js.map +1 -1
  42. package/lib-commonjs/components/SpinButtonField/index.js +5 -4
  43. package/lib-commonjs/components/SpinButtonField/index.js.map +1 -1
  44. package/lib-commonjs/index.js +21 -49
  45. package/lib-commonjs/index.js.map +1 -1
  46. package/lib-commonjs/utils/clamp.js +28 -21
  47. package/lib-commonjs/utils/clamp.js.map +1 -1
  48. package/lib-commonjs/utils/getBound.js +16 -14
  49. package/lib-commonjs/utils/getBound.js.map +1 -1
  50. package/lib-commonjs/utils/index.js +7 -6
  51. package/lib-commonjs/utils/index.js.map +1 -1
  52. package/lib-commonjs/utils/precision.js +33 -33
  53. package/lib-commonjs/utils/precision.js.map +1 -1
  54. package/package.json +12 -11
  55. package/lib-amd/SpinButton.js +0 -6
  56. package/lib-amd/SpinButton.js.map +0 -1
  57. package/lib-amd/SpinButtonField.js +0 -6
  58. package/lib-amd/SpinButtonField.js.map +0 -1
  59. package/lib-amd/components/SpinButton/SpinButton.js +0 -17
  60. package/lib-amd/components/SpinButton/SpinButton.js.map +0 -1
  61. package/lib-amd/components/SpinButton/SpinButton.types.js +0 -5
  62. package/lib-amd/components/SpinButton/SpinButton.types.js.map +0 -1
  63. package/lib-amd/components/SpinButton/index.js +0 -10
  64. package/lib-amd/components/SpinButton/index.js.map +0 -1
  65. package/lib-amd/components/SpinButton/renderSpinButton.js +0 -17
  66. package/lib-amd/components/SpinButton/renderSpinButton.js.map +0 -1
  67. package/lib-amd/components/SpinButton/useSpinButton.js +0 -253
  68. package/lib-amd/components/SpinButton/useSpinButton.js.map +0 -1
  69. package/lib-amd/components/SpinButton/useSpinButtonStyles.js +0 -420
  70. package/lib-amd/components/SpinButton/useSpinButtonStyles.js.map +0 -1
  71. package/lib-amd/components/SpinButtonField/SpinButtonField.js +0 -10
  72. package/lib-amd/components/SpinButtonField/SpinButtonField.js.map +0 -1
  73. package/lib-amd/components/SpinButtonField/index.js +0 -6
  74. package/lib-amd/components/SpinButtonField/index.js.map +0 -1
  75. package/lib-amd/index.js +0 -13
  76. package/lib-amd/index.js.map +0 -1
  77. package/lib-amd/utils/clamp.js +0 -30
  78. package/lib-amd/utils/clamp.js.map +0 -1
  79. package/lib-amd/utils/getBound.js +0 -19
  80. package/lib-amd/utils/getBound.js.map +0 -1
  81. package/lib-amd/utils/index.js +0 -8
  82. package/lib-amd/utils/index.js.map +0 -1
  83. package/lib-amd/utils/precision.js +0 -44
  84. package/lib-amd/utils/precision.js.map +0 -1
@@ -1,44 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.precisionRound = exports.calculatePrecision = void 0;
5
- /**
6
- * Calculates a number's precision based on the number of trailing
7
- * zeros if the number does not have a decimal indicated by a negative
8
- * precision. Otherwise, it calculates the number of digits after
9
- * the decimal point indicated by a positive precision.
10
- * @param value - the value to determine the precision of
11
- */
12
- function calculatePrecision(value) {
13
- /**
14
- * Group 1:
15
- * [1-9]([0]+$) matches trailing zeros
16
- * Group 2:
17
- * \.([0-9]*) matches all digits after a decimal point.
18
- */
19
- var groups = /[1-9]([0]+$)|\.([0-9]*)/.exec(String(value));
20
- if (!groups) {
21
- return 0;
22
- }
23
- if (groups[1]) {
24
- return -groups[1].length;
25
- }
26
- if (groups[2]) {
27
- return groups[2].length;
28
- }
29
- return 0;
30
- }
31
- exports.calculatePrecision = calculatePrecision;
32
- /**
33
- * Rounds a number to a certain level of precision. Accepts negative precision.
34
- * @param value - The value that is being rounded.
35
- * @param precision - The number of decimal places to round the number to
36
- */
37
- function precisionRound(value, precision, base) {
38
- if (base === void 0) { base = 10; }
39
- var exp = Math.pow(base, precision);
40
- return Math.round(value * exp) / exp;
41
- }
42
- exports.precisionRound = precisionRound;
43
- });
44
- //# sourceMappingURL=precision.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"precision.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-spinbutton/src/utils/precision.ts"],"names":[],"mappings":";;;;IAAA;;;;;;OAMG;IACH,SAAgB,kBAAkB,CAAC,KAAsB;QACvD;;;;;WAKG;QACH,IAAM,MAAM,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7D,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,CAAC,CAAC;SACV;QACD,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;SAC1B;QACD,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YACb,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;SACzB;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAlBD,gDAkBC;IAED;;;;OAIG;IACH,SAAgB,cAAc,CAAC,KAAa,EAAE,SAAiB,EAAE,IAAiB;QAAjB,qBAAA,EAAA,SAAiB;QAChF,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IACvC,CAAC;IAHD,wCAGC","sourcesContent":["/**\n * Calculates a number's precision based on the number of trailing\n * zeros if the number does not have a decimal indicated by a negative\n * precision. Otherwise, it calculates the number of digits after\n * the decimal point indicated by a positive precision.\n * @param value - the value to determine the precision of\n */\nexport function calculatePrecision(value: number | string): number {\n /**\n * Group 1:\n * [1-9]([0]+$) matches trailing zeros\n * Group 2:\n * \\.([0-9]*) matches all digits after a decimal point.\n */\n const groups = /[1-9]([0]+$)|\\.([0-9]*)/.exec(String(value));\n if (!groups) {\n return 0;\n }\n if (groups[1]) {\n return -groups[1].length;\n }\n if (groups[2]) {\n return groups[2].length;\n }\n return 0;\n}\n\n/**\n * Rounds a number to a certain level of precision. Accepts negative precision.\n * @param value - The value that is being rounded.\n * @param precision - The number of decimal places to round the number to\n */\nexport function precisionRound(value: number, precision: number, base: number = 10): number {\n const exp = Math.pow(base, precision);\n return Math.round(value * exp) / exp;\n}\n"]}