@mui/utils 5.15.4 → 5.15.6
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/CHANGELOG.md +398 -242
- package/clamp/clamp.d.ts +2 -0
- package/clamp/clamp.js +10 -0
- package/clamp/index.d.ts +1 -0
- package/clamp/index.js +13 -0
- package/clamp/package.json +6 -0
- package/esm/clamp/clamp.js +4 -0
- package/esm/clamp/index.js +1 -0
- package/esm/generateUtilityClass/generateUtilityClass.js +5 -6
- package/esm/index.js +3 -1
- package/generateUtilityClass/generateUtilityClass.d.ts +16 -1
- package/generateUtilityClass/generateUtilityClass.js +7 -5
- package/index.d.ts +2 -0
- package/index.js +17 -2
- package/legacy/clamp/clamp.js +6 -0
- package/legacy/clamp/index.js +1 -0
- package/legacy/generateUtilityClass/generateUtilityClass.js +5 -6
- package/legacy/index.js +4 -2
- package/modern/clamp/clamp.js +4 -0
- package/modern/clamp/index.js +1 -0
- package/modern/generateUtilityClass/generateUtilityClass.js +5 -6
- package/modern/index.js +4 -2
- package/package.json +2 -2
package/clamp/clamp.d.ts
ADDED
package/clamp/clamp.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
|
|
8
|
+
return Math.max(min, Math.min(val, max));
|
|
9
|
+
}
|
|
10
|
+
var _default = exports.default = clamp;
|
package/clamp/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './clamp';
|
package/clamp/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _clamp.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _clamp = _interopRequireDefault(require("./clamp"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './clamp';
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import ClassNameGenerator from '../ClassNameGenerator';
|
|
2
|
-
|
|
3
|
-
// If GlobalStateSlot is changed, GLOBAL_STATE_CLASSES in
|
|
4
|
-
// \packages\api-docs-builder\utils\parseSlotsAndClasses.ts must be updated accordingly.
|
|
5
|
-
|
|
6
|
-
const globalStateClassesMapping = {
|
|
2
|
+
export const globalStateClasses = {
|
|
7
3
|
active: 'active',
|
|
8
4
|
checked: 'checked',
|
|
9
5
|
completed: 'completed',
|
|
@@ -18,6 +14,9 @@ const globalStateClassesMapping = {
|
|
|
18
14
|
selected: 'selected'
|
|
19
15
|
};
|
|
20
16
|
export default function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {
|
|
21
|
-
const globalStateClass =
|
|
17
|
+
const globalStateClass = globalStateClasses[slot];
|
|
22
18
|
return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;
|
|
19
|
+
}
|
|
20
|
+
export function isGlobalState(slot) {
|
|
21
|
+
return globalStateClasses[slot] !== undefined;
|
|
23
22
|
}
|
package/esm/index.js
CHANGED
|
@@ -36,6 +36,8 @@ export { default as integerPropType } from './integerPropType';
|
|
|
36
36
|
export { default as internal_resolveProps } from './resolveProps';
|
|
37
37
|
export { default as unstable_composeClasses } from './composeClasses';
|
|
38
38
|
export { default as unstable_generateUtilityClass } from './generateUtilityClass';
|
|
39
|
+
export { isGlobalState as unstable_isGlobalState } from './generateUtilityClass';
|
|
39
40
|
export * from './generateUtilityClass';
|
|
40
41
|
export { default as unstable_generateUtilityClasses } from './generateUtilityClasses';
|
|
41
|
-
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator';
|
|
42
|
+
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator';
|
|
43
|
+
export { default as clamp } from './clamp';
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
export type GlobalStateSlot =
|
|
1
|
+
export type GlobalStateSlot = keyof typeof globalStateClasses;
|
|
2
|
+
export declare const globalStateClasses: {
|
|
3
|
+
active: string;
|
|
4
|
+
checked: string;
|
|
5
|
+
completed: string;
|
|
6
|
+
disabled: string;
|
|
7
|
+
error: string;
|
|
8
|
+
expanded: string;
|
|
9
|
+
focused: string;
|
|
10
|
+
focusVisible: string;
|
|
11
|
+
open: string;
|
|
12
|
+
readOnly: string;
|
|
13
|
+
required: string;
|
|
14
|
+
selected: string;
|
|
15
|
+
};
|
|
2
16
|
export default function generateUtilityClass(componentName: string, slot: string, globalStatePrefix?: string): string;
|
|
17
|
+
export declare function isGlobalState(slot: string): boolean;
|
|
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = generateUtilityClass;
|
|
8
|
+
exports.globalStateClasses = void 0;
|
|
9
|
+
exports.isGlobalState = isGlobalState;
|
|
8
10
|
var _ClassNameGenerator = _interopRequireDefault(require("../ClassNameGenerator"));
|
|
9
|
-
|
|
10
|
-
// \packages\api-docs-builder\utils\parseSlotsAndClasses.ts must be updated accordingly.
|
|
11
|
-
|
|
12
|
-
const globalStateClassesMapping = {
|
|
11
|
+
const globalStateClasses = exports.globalStateClasses = {
|
|
13
12
|
active: 'active',
|
|
14
13
|
checked: 'checked',
|
|
15
14
|
completed: 'completed',
|
|
@@ -24,6 +23,9 @@ const globalStateClassesMapping = {
|
|
|
24
23
|
selected: 'selected'
|
|
25
24
|
};
|
|
26
25
|
function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {
|
|
27
|
-
const globalStateClass =
|
|
26
|
+
const globalStateClass = globalStateClasses[slot];
|
|
28
27
|
return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${_ClassNameGenerator.default.generate(componentName)}-${slot}`;
|
|
28
|
+
}
|
|
29
|
+
function isGlobalState(slot) {
|
|
30
|
+
return globalStateClasses[slot] !== undefined;
|
|
29
31
|
}
|
package/index.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export { default as integerPropType } from './integerPropType';
|
|
|
34
34
|
export { default as internal_resolveProps } from './resolveProps';
|
|
35
35
|
export { default as unstable_composeClasses } from './composeClasses';
|
|
36
36
|
export { default as unstable_generateUtilityClass } from './generateUtilityClass';
|
|
37
|
+
export { isGlobalState as unstable_isGlobalState } from './generateUtilityClass';
|
|
37
38
|
export * from './generateUtilityClass';
|
|
38
39
|
export { default as unstable_generateUtilityClasses } from './generateUtilityClasses';
|
|
39
40
|
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator';
|
|
41
|
+
export { default as clamp } from './clamp';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v5.15.
|
|
2
|
+
* @mui/utils v5.15.6
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -50,8 +50,10 @@ var _exportNames = {
|
|
|
50
50
|
internal_resolveProps: true,
|
|
51
51
|
unstable_composeClasses: true,
|
|
52
52
|
unstable_generateUtilityClass: true,
|
|
53
|
+
unstable_isGlobalState: true,
|
|
53
54
|
unstable_generateUtilityClasses: true,
|
|
54
|
-
unstable_ClassNameGenerator: true
|
|
55
|
+
unstable_ClassNameGenerator: true,
|
|
56
|
+
clamp: true
|
|
55
57
|
};
|
|
56
58
|
Object.defineProperty(exports, "HTMLElementType", {
|
|
57
59
|
enumerable: true,
|
|
@@ -65,6 +67,12 @@ Object.defineProperty(exports, "chainPropTypes", {
|
|
|
65
67
|
return _chainPropTypes.default;
|
|
66
68
|
}
|
|
67
69
|
});
|
|
70
|
+
Object.defineProperty(exports, "clamp", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () {
|
|
73
|
+
return _clamp.default;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
68
76
|
Object.defineProperty(exports, "deepmerge", {
|
|
69
77
|
enumerable: true,
|
|
70
78
|
get: function () {
|
|
@@ -203,6 +211,12 @@ Object.defineProperty(exports, "unstable_getScrollbarSize", {
|
|
|
203
211
|
return _getScrollbarSize.default;
|
|
204
212
|
}
|
|
205
213
|
});
|
|
214
|
+
Object.defineProperty(exports, "unstable_isGlobalState", {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
get: function () {
|
|
217
|
+
return _generateUtilityClass.isGlobalState;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
206
220
|
Object.defineProperty(exports, "unstable_isMuiElement", {
|
|
207
221
|
enumerable: true,
|
|
208
222
|
get: function () {
|
|
@@ -335,5 +349,6 @@ Object.keys(_generateUtilityClass).forEach(function (key) {
|
|
|
335
349
|
});
|
|
336
350
|
var _generateUtilityClasses = _interopRequireDefault(require("./generateUtilityClasses"));
|
|
337
351
|
var _ClassNameGenerator = _interopRequireDefault(require("./ClassNameGenerator"));
|
|
352
|
+
var _clamp = _interopRequireDefault(require("./clamp"));
|
|
338
353
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
339
354
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function clamp(val) {
|
|
2
|
+
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MIN_SAFE_INTEGER;
|
|
3
|
+
var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Number.MAX_SAFE_INTEGER;
|
|
4
|
+
return Math.max(min, Math.min(val, max));
|
|
5
|
+
}
|
|
6
|
+
export default clamp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './clamp';
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import ClassNameGenerator from '../ClassNameGenerator';
|
|
2
|
-
|
|
3
|
-
// If GlobalStateSlot is changed, GLOBAL_STATE_CLASSES in
|
|
4
|
-
// \packages\api-docs-builder\utils\parseSlotsAndClasses.ts must be updated accordingly.
|
|
5
|
-
|
|
6
|
-
var globalStateClassesMapping = {
|
|
2
|
+
export var globalStateClasses = {
|
|
7
3
|
active: 'active',
|
|
8
4
|
checked: 'checked',
|
|
9
5
|
completed: 'completed',
|
|
@@ -19,6 +15,9 @@ var globalStateClassesMapping = {
|
|
|
19
15
|
};
|
|
20
16
|
export default function generateUtilityClass(componentName, slot) {
|
|
21
17
|
var globalStatePrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Mui';
|
|
22
|
-
var globalStateClass =
|
|
18
|
+
var globalStateClass = globalStateClasses[slot];
|
|
23
19
|
return globalStateClass ? "".concat(globalStatePrefix, "-").concat(globalStateClass) : "".concat(ClassNameGenerator.generate(componentName), "-").concat(slot);
|
|
20
|
+
}
|
|
21
|
+
export function isGlobalState(slot) {
|
|
22
|
+
return globalStateClasses[slot] !== undefined;
|
|
24
23
|
}
|
package/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v5.15.
|
|
2
|
+
* @mui/utils v5.15.6
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -43,6 +43,8 @@ export { default as integerPropType } from './integerPropType';
|
|
|
43
43
|
export { default as internal_resolveProps } from './resolveProps';
|
|
44
44
|
export { default as unstable_composeClasses } from './composeClasses';
|
|
45
45
|
export { default as unstable_generateUtilityClass } from './generateUtilityClass';
|
|
46
|
+
export { isGlobalState as unstable_isGlobalState } from './generateUtilityClass';
|
|
46
47
|
export * from './generateUtilityClass';
|
|
47
48
|
export { default as unstable_generateUtilityClasses } from './generateUtilityClasses';
|
|
48
|
-
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator';
|
|
49
|
+
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator';
|
|
50
|
+
export { default as clamp } from './clamp';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './clamp';
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import ClassNameGenerator from '../ClassNameGenerator';
|
|
2
|
-
|
|
3
|
-
// If GlobalStateSlot is changed, GLOBAL_STATE_CLASSES in
|
|
4
|
-
// \packages\api-docs-builder\utils\parseSlotsAndClasses.ts must be updated accordingly.
|
|
5
|
-
|
|
6
|
-
const globalStateClassesMapping = {
|
|
2
|
+
export const globalStateClasses = {
|
|
7
3
|
active: 'active',
|
|
8
4
|
checked: 'checked',
|
|
9
5
|
completed: 'completed',
|
|
@@ -18,6 +14,9 @@ const globalStateClassesMapping = {
|
|
|
18
14
|
selected: 'selected'
|
|
19
15
|
};
|
|
20
16
|
export default function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {
|
|
21
|
-
const globalStateClass =
|
|
17
|
+
const globalStateClass = globalStateClasses[slot];
|
|
22
18
|
return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;
|
|
19
|
+
}
|
|
20
|
+
export function isGlobalState(slot) {
|
|
21
|
+
return globalStateClasses[slot] !== undefined;
|
|
23
22
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v5.15.
|
|
2
|
+
* @mui/utils v5.15.6
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -43,6 +43,8 @@ export { default as integerPropType } from './integerPropType';
|
|
|
43
43
|
export { default as internal_resolveProps } from './resolveProps';
|
|
44
44
|
export { default as unstable_composeClasses } from './composeClasses';
|
|
45
45
|
export { default as unstable_generateUtilityClass } from './generateUtilityClass';
|
|
46
|
+
export { isGlobalState as unstable_isGlobalState } from './generateUtilityClass';
|
|
46
47
|
export * from './generateUtilityClass';
|
|
47
48
|
export { default as unstable_generateUtilityClasses } from './generateUtilityClasses';
|
|
48
|
-
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator';
|
|
49
|
+
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator';
|
|
50
|
+
export { default as clamp } from './clamp';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/utils",
|
|
3
|
-
"version": "5.15.
|
|
3
|
+
"version": "5.15.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Utility functions for React components.",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"url": "https://opencollective.com/mui-org"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "^7.23.
|
|
29
|
+
"@babel/runtime": "^7.23.8",
|
|
30
30
|
"@types/prop-types": "^15.7.11",
|
|
31
31
|
"prop-types": "^15.8.1",
|
|
32
32
|
"react-is": "^18.2.0"
|