@rolster/react-components 19.8.20 → 19.8.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolster/react-components",
3
- "version": "19.8.20",
3
+ "version": "19.8.21",
4
4
  "type": "module",
5
5
  "description": "Package containing UI components for React Project.",
6
6
  "license": "MIT",
@@ -33,24 +33,24 @@
33
33
  "lint:fix": "eslint . --fix",
34
34
  "clean": "rimraf ./dist",
35
35
  "dev": "vite",
36
- "build": "npm run clean && tsc -p tsconfig.app.json && rollup -c rollup.config.mjs",
36
+ "build": "npm run clean && tsc -p tsconfig.app.json && rolster-rollup",
37
37
  "test": "vitest run",
38
38
  "prepublishOnly": "npm run build"
39
39
  },
40
40
  "dependencies": {
41
- "@rolster/commons": "^4.2.3",
42
- "@rolster/components": "^2.1.5",
43
- "@rolster/dates": "^4.1.6",
44
- "@rolster/i18n": "^3.1.3",
45
- "@rolster/react": "^19.0.0",
46
- "@rolster/react-forms": "^19.5.10",
47
- "@rolster/strings": "^3.1.1",
41
+ "@rolster/commons": "^4.2.4",
42
+ "@rolster/components": "^2.1.6",
43
+ "@rolster/dates": "^4.1.7",
44
+ "@rolster/i18n": "^3.1.4",
45
+ "@rolster/react": "^19.0.1",
46
+ "@rolster/react-forms": "^19.5.11",
47
+ "@rolster/strings": "^3.1.2",
48
48
  "react-dom": "^19.2.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@eslint/js": "^10.0.1",
52
- "@rolster/rollup": "^2.1.1",
53
- "@rolster/styles-foundations": "^3.5.21",
52
+ "@rolster/rollup": "^2.2.0",
53
+ "@rolster/styles-foundations": "^3.5.22",
54
54
  "@rolster/types": "^1.1.1",
55
55
  "@types/react": "^19.0.0",
56
56
  "@types/react-dom": "^19.0.0",
@@ -1 +0,0 @@
1
- export {};
@@ -1,90 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { clampNumber, normalizeSliderValue, sliderRateToValue, sliderValueToRate } from './slider';
3
- describe('clampNumber', () => {
4
- it('should return the value when it is inside the range', () => {
5
- expect(clampNumber(42, 0, 100)).toBe(42);
6
- });
7
- it('should return the minimum when the value is below the range', () => {
8
- expect(clampNumber(-10, 0, 100)).toBe(0);
9
- });
10
- it('should return the maximum when the value is above the range', () => {
11
- expect(clampNumber(180, 0, 100)).toBe(100);
12
- });
13
- it('should return the minimum when the range is inverted', () => {
14
- expect(clampNumber(50, 100, 0)).toBe(100);
15
- });
16
- });
17
- describe('normalizeSliderValue', () => {
18
- it('should clamp the value into the range', () => {
19
- expect(normalizeSliderValue(120, 0, 100, 1)).toBe(100);
20
- expect(normalizeSliderValue(-5, 0, 100, 1)).toBe(0);
21
- });
22
- it('should snap the value to the nearest step', () => {
23
- expect(normalizeSliderValue(12, 0, 100, 5)).toBe(10);
24
- expect(normalizeSliderValue(13, 0, 100, 5)).toBe(15);
25
- });
26
- it('should snap relative to the minimum, not to zero', () => {
27
- expect(normalizeSliderValue(56, 50, 100, 5)).toBe(55);
28
- expect(normalizeSliderValue(58, 50, 100, 5)).toBe(60);
29
- });
30
- it('should never return a value outside the range when snapping', () => {
31
- expect(normalizeSliderValue(99, 0, 100, 7)).toBe(98);
32
- expect(normalizeSliderValue(100, 0, 100, 7)).toBe(100);
33
- });
34
- it('should keep both range ends reachable when the step misses them', () => {
35
- expect(normalizeSliderValue(100, 0, 100, 7)).toBe(100);
36
- expect(normalizeSliderValue(0, 0, 100, 7)).toBe(0);
37
- expect(normalizeSliderValue(101, 0, 100, 30)).toBe(100);
38
- });
39
- it('should return the clamped value when the step is not usable', () => {
40
- expect(normalizeSliderValue(12.5, 0, 100, 0)).toBe(12.5);
41
- expect(normalizeSliderValue(12.5, 0, 100, -1)).toBe(12.5);
42
- });
43
- it('should not leak floating point noise with fractional steps', () => {
44
- expect(normalizeSliderValue(0.3, 0, 1, 0.1)).toBe(0.3);
45
- expect(normalizeSliderValue(0.7, 0, 1, 0.1)).toBe(0.7);
46
- });
47
- });
48
- describe('sliderValueToRate', () => {
49
- it('should return zero at the minimum', () => {
50
- expect(sliderValueToRate(50, 50, 100)).toBe(0);
51
- });
52
- it('should return one hundred at the maximum', () => {
53
- expect(sliderValueToRate(100, 50, 100)).toBe(100);
54
- });
55
- it('should return the proportional rate inside the range', () => {
56
- expect(sliderValueToRate(60, 50, 100)).toBe(20);
57
- expect(sliderValueToRate(75, 50, 100)).toBe(50);
58
- });
59
- it('should clamp the rate when the value is outside the range', () => {
60
- expect(sliderValueToRate(20, 50, 100)).toBe(0);
61
- expect(sliderValueToRate(140, 50, 100)).toBe(100);
62
- });
63
- it('should return zero when the range has no width', () => {
64
- expect(sliderValueToRate(50, 50, 50)).toBe(0);
65
- });
66
- });
67
- describe('sliderRateToValue', () => {
68
- it('should return the minimum at rate zero', () => {
69
- expect(sliderRateToValue(0, 50, 100, 1)).toBe(50);
70
- });
71
- it('should return the maximum at rate one hundred', () => {
72
- expect(sliderRateToValue(100, 50, 100, 1)).toBe(100);
73
- });
74
- it('should map the rate to the real value of the range', () => {
75
- expect(sliderRateToValue(20, 50, 100, 1)).toBe(60);
76
- });
77
- it('should clamp rates outside the zero to one hundred range', () => {
78
- expect(sliderRateToValue(-30, 0, 100, 1)).toBe(0);
79
- expect(sliderRateToValue(130, 0, 100, 1)).toBe(100);
80
- });
81
- it('should snap to the nearest step instead of always rounding up', () => {
82
- expect(sliderRateToValue(3, 0, 10, 1)).toBe(0);
83
- expect(sliderRateToValue(7, 0, 10, 1)).toBe(1);
84
- });
85
- it('should keep the value stable across a rate round trip', () => {
86
- const value = sliderRateToValue(sliderValueToRate(72, 50, 100), 50, 100, 1);
87
- expect(value).toBe(72);
88
- });
89
- });
90
- //# sourceMappingURL=slider.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slider.spec.js","sourceRoot":"","sources":["../../../src/helpers/slider.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,M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