@mantine/core 5.6.3 → 5.6.4

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.
@@ -12,11 +12,12 @@ function getChangeValue({
12
12
  }) {
13
13
  const left = !containerWidth ? value : Math.min(Math.max(value, 0), containerWidth) / containerWidth;
14
14
  const dx = left * (max - min);
15
- const minIsNegative = min <= 0;
16
- const nextValue = dx !== 0 ? Math.round(dx / step) * step + (minIsNegative ? min : 0) : Math.min(min, 0);
17
- const nextValueWithPrecision = precision ? Number(nextValue.toFixed(precision)) : nextValue;
18
- const finalValue = Math.min(nextValueWithPrecision, max);
19
- return finalValue <= min ? min : finalValue;
15
+ const nextValue = (dx !== 0 ? Math.round(dx / step) * step : 0) + min;
16
+ const nextValueWithinStep = Math.max(nextValue - nextValue % step, min);
17
+ if (precision !== void 0) {
18
+ return Number(nextValueWithinStep.toFixed(precision));
19
+ }
20
+ return nextValueWithinStep;
20
21
  }
21
22
 
22
23
  exports.getChangeValue = getChangeValue;
@@ -1 +1 @@
1
- {"version":3,"file":"get-change-value.js","sources":["../../../../src/Slider/utils/get-change-value/get-change-value.ts"],"sourcesContent":["interface GetChangeValue {\n value: number;\n containerWidth?: number;\n min: number;\n max: number;\n step: number;\n precision?: number;\n}\n\nexport function getChangeValue({\n value,\n containerWidth,\n min,\n max,\n step,\n precision,\n}: GetChangeValue) {\n const left = !containerWidth\n ? value\n : Math.min(Math.max(value, 0), containerWidth) / containerWidth;\n const dx = left * (max - min);\n const minIsNegative = min <= 0;\n const nextValue =\n dx !== 0 ? Math.round(dx / step) * step + (minIsNegative ? min : 0) : Math.min(min, 0);\n const nextValueWithPrecision = precision ? Number(nextValue.toFixed(precision)) : nextValue;\n const finalValue = Math.min(nextValueWithPrecision, max);\n\n return finalValue <= min ? min : finalValue;\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,cAAc,CAAC;AAC/B,EAAE,KAAK;AACP,EAAE,cAAc;AAChB,EAAE,GAAG;AACL,EAAE,GAAG;AACL,EAAE,IAAI;AACN,EAAE,SAAS;AACX,CAAC,EAAE;AACH,EAAE,MAAM,IAAI,GAAG,CAAC,cAAc,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,cAAc,CAAC;AACvG,EAAE,MAAM,EAAE,GAAG,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;AAChC,EAAE,MAAM,aAAa,GAAG,GAAG,IAAI,CAAC,CAAC;AACjC,EAAE,MAAM,SAAS,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,aAAa,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAC3G,EAAE,MAAM,sBAAsB,GAAG,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC;AAC9F,EAAE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;AAC3D,EAAE,OAAO,UAAU,IAAI,GAAG,GAAG,GAAG,GAAG,UAAU,CAAC;AAC9C;;;;"}
1
+ {"version":3,"file":"get-change-value.js","sources":["../../../../src/Slider/utils/get-change-value/get-change-value.ts"],"sourcesContent":["interface GetChangeValue {\n value: number;\n containerWidth?: number;\n min: number;\n max: number;\n step: number;\n precision?: number;\n}\n\nexport function getChangeValue({\n value,\n containerWidth,\n min,\n max,\n step,\n precision,\n}: GetChangeValue) {\n const left = !containerWidth\n ? value\n : Math.min(Math.max(value, 0), containerWidth) / containerWidth;\n const dx = left * (max - min);\n const nextValue = (dx !== 0 ? Math.round(dx / step) * step : 0) + min;\n const nextValueWithinStep = Math.max(nextValue - (nextValue % step), min);\n\n if (precision !== undefined) {\n return Number(nextValueWithinStep.toFixed(precision));\n }\n\n return nextValueWithinStep;\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,cAAc,CAAC;AAC/B,EAAE,KAAK;AACP,EAAE,cAAc;AAChB,EAAE,GAAG;AACL,EAAE,GAAG;AACL,EAAE,IAAI;AACN,EAAE,SAAS;AACX,CAAC,EAAE;AACH,EAAE,MAAM,IAAI,GAAG,CAAC,cAAc,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,cAAc,CAAC;AACvG,EAAE,MAAM,EAAE,GAAG,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;AAChC,EAAE,MAAM,SAAS,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC;AACxE,EAAE,MAAM,mBAAmB,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;AAC1E,EAAE,IAAI,SAAS,KAAK,KAAK,CAAC,EAAE;AAC5B,IAAI,OAAO,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1D,GAAG;AACH,EAAE,OAAO,mBAAmB,CAAC;AAC7B;;;;"}
@@ -8,11 +8,12 @@ function getChangeValue({
8
8
  }) {
9
9
  const left = !containerWidth ? value : Math.min(Math.max(value, 0), containerWidth) / containerWidth;
10
10
  const dx = left * (max - min);
11
- const minIsNegative = min <= 0;
12
- const nextValue = dx !== 0 ? Math.round(dx / step) * step + (minIsNegative ? min : 0) : Math.min(min, 0);
13
- const nextValueWithPrecision = precision ? Number(nextValue.toFixed(precision)) : nextValue;
14
- const finalValue = Math.min(nextValueWithPrecision, max);
15
- return finalValue <= min ? min : finalValue;
11
+ const nextValue = (dx !== 0 ? Math.round(dx / step) * step : 0) + min;
12
+ const nextValueWithinStep = Math.max(nextValue - nextValue % step, min);
13
+ if (precision !== void 0) {
14
+ return Number(nextValueWithinStep.toFixed(precision));
15
+ }
16
+ return nextValueWithinStep;
16
17
  }
17
18
 
18
19
  export { getChangeValue };
@@ -1 +1 @@
1
- {"version":3,"file":"get-change-value.js","sources":["../../../../src/Slider/utils/get-change-value/get-change-value.ts"],"sourcesContent":["interface GetChangeValue {\n value: number;\n containerWidth?: number;\n min: number;\n max: number;\n step: number;\n precision?: number;\n}\n\nexport function getChangeValue({\n value,\n containerWidth,\n min,\n max,\n step,\n precision,\n}: GetChangeValue) {\n const left = !containerWidth\n ? value\n : Math.min(Math.max(value, 0), containerWidth) / containerWidth;\n const dx = left * (max - min);\n const minIsNegative = min <= 0;\n const nextValue =\n dx !== 0 ? Math.round(dx / step) * step + (minIsNegative ? min : 0) : Math.min(min, 0);\n const nextValueWithPrecision = precision ? Number(nextValue.toFixed(precision)) : nextValue;\n const finalValue = Math.min(nextValueWithPrecision, max);\n\n return finalValue <= min ? min : finalValue;\n}\n"],"names":[],"mappings":"AAAO,SAAS,cAAc,CAAC;AAC/B,EAAE,KAAK;AACP,EAAE,cAAc;AAChB,EAAE,GAAG;AACL,EAAE,GAAG;AACL,EAAE,IAAI;AACN,EAAE,SAAS;AACX,CAAC,EAAE;AACH,EAAE,MAAM,IAAI,GAAG,CAAC,cAAc,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,cAAc,CAAC;AACvG,EAAE,MAAM,EAAE,GAAG,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;AAChC,EAAE,MAAM,aAAa,GAAG,GAAG,IAAI,CAAC,CAAC;AACjC,EAAE,MAAM,SAAS,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,aAAa,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAC3G,EAAE,MAAM,sBAAsB,GAAG,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC;AAC9F,EAAE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;AAC3D,EAAE,OAAO,UAAU,IAAI,GAAG,GAAG,GAAG,GAAG,UAAU,CAAC;AAC9C;;;;"}
1
+ {"version":3,"file":"get-change-value.js","sources":["../../../../src/Slider/utils/get-change-value/get-change-value.ts"],"sourcesContent":["interface GetChangeValue {\n value: number;\n containerWidth?: number;\n min: number;\n max: number;\n step: number;\n precision?: number;\n}\n\nexport function getChangeValue({\n value,\n containerWidth,\n min,\n max,\n step,\n precision,\n}: GetChangeValue) {\n const left = !containerWidth\n ? value\n : Math.min(Math.max(value, 0), containerWidth) / containerWidth;\n const dx = left * (max - min);\n const nextValue = (dx !== 0 ? Math.round(dx / step) * step : 0) + min;\n const nextValueWithinStep = Math.max(nextValue - (nextValue % step), min);\n\n if (precision !== undefined) {\n return Number(nextValueWithinStep.toFixed(precision));\n }\n\n return nextValueWithinStep;\n}\n"],"names":[],"mappings":"AAAO,SAAS,cAAc,CAAC;AAC/B,EAAE,KAAK;AACP,EAAE,cAAc;AAChB,EAAE,GAAG;AACL,EAAE,GAAG;AACL,EAAE,IAAI;AACN,EAAE,SAAS;AACX,CAAC,EAAE;AACH,EAAE,MAAM,IAAI,GAAG,CAAC,cAAc,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,cAAc,CAAC;AACvG,EAAE,MAAM,EAAE,GAAG,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;AAChC,EAAE,MAAM,SAAS,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC;AACxE,EAAE,MAAM,mBAAmB,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;AAC1E,EAAE,IAAI,SAAS,KAAK,KAAK,CAAC,EAAE;AAC5B,IAAI,OAAO,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1D,GAAG;AACH,EAAE,OAAO,mBAAmB,CAAC;AAC7B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-change-value.d.ts","sourceRoot":"","sources":["../../../../src/Slider/utils/get-change-value/get-change-value.ts"],"names":[],"mappings":"AAAA,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,cAAc,EACd,GAAG,EACH,GAAG,EACH,IAAI,EACJ,SAAS,GACV,EAAE,cAAc,UAYhB"}
1
+ {"version":3,"file":"get-change-value.d.ts","sourceRoot":"","sources":["../../../../src/Slider/utils/get-change-value/get-change-value.ts"],"names":[],"mappings":"AAAA,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,cAAc,EACd,GAAG,EACH,GAAG,EACH,IAAI,EACJ,SAAS,GACV,EAAE,cAAc,UAahB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mantine/core",
3
3
  "description": "React components library focused on usability, accessibility and developer experience",
4
- "version": "5.6.3",
4
+ "version": "5.6.4",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -27,13 +27,13 @@
27
27
  "emotion"
28
28
  ],
29
29
  "peerDependencies": {
30
- "@mantine/hooks": "5.6.3",
30
+ "@mantine/hooks": "5.6.4",
31
31
  "react": ">=16.8.0",
32
32
  "react-dom": ">=16.8.0"
33
33
  },
34
34
  "dependencies": {
35
- "@mantine/utils": "5.6.3",
36
- "@mantine/styles": "5.6.3",
35
+ "@mantine/utils": "5.6.4",
36
+ "@mantine/styles": "5.6.4",
37
37
  "@radix-ui/react-scroll-area": "1.0.0",
38
38
  "react-textarea-autosize": "8.3.4",
39
39
  "@floating-ui/react-dom-interactions": "^0.10.1"