@mui/utils
Advanced tools
Comparing version 6.2.0 to 6.2.1
@@ -0,1 +1,29 @@ | ||
/** | ||
* Compose classes from multiple sources. | ||
* | ||
* @example | ||
* ```tsx | ||
* const slots = { | ||
* root: ['root', 'primary'], | ||
* label: ['label'], | ||
* }; | ||
* | ||
* const getUtilityClass = (slot) => `MuiButton-${slot}`; | ||
* | ||
* const classes = { | ||
* root: 'my-root-class', | ||
* }; | ||
* | ||
* const output = composeClasses(slots, getUtilityClass, classes); | ||
* // { | ||
* // root: 'MuiButton-root MuiButton-primary my-root-class', | ||
* // label: 'MuiButton-label', | ||
* // } | ||
* ``` | ||
* | ||
* @param slots a list of classes for each possible slot | ||
* @param getUtilityClass a function to resolve the class based on the slot name | ||
* @param classes the input classes from props | ||
* @returns the resolved classes for all slots | ||
*/ | ||
export default function composeClasses<ClassKey extends string>(slots: Record<ClassKey, ReadonlyArray<string | false | undefined | null>>, getUtilityClass: (slot: string) => string, classes?: Record<string, string> | undefined): Record<ClassKey, string>; |
@@ -12,2 +12,30 @@ "use strict"; | ||
/** | ||
* Compose classes from multiple sources. | ||
* | ||
* @example | ||
* ```tsx | ||
* const slots = { | ||
* root: ['root', 'primary'], | ||
* label: ['label'], | ||
* }; | ||
* | ||
* const getUtilityClass = (slot) => `MuiButton-${slot}`; | ||
* | ||
* const classes = { | ||
* root: 'my-root-class', | ||
* }; | ||
* | ||
* const output = composeClasses(slots, getUtilityClass, classes); | ||
* // { | ||
* // root: 'MuiButton-root MuiButton-primary my-root-class', | ||
* // label: 'MuiButton-label', | ||
* // } | ||
* ``` | ||
* | ||
* @param slots a list of classes for each possible slot | ||
* @param getUtilityClass a function to resolve the class based on the slot name | ||
* @param classes the input classes from props | ||
* @returns the resolved classes for all slots | ||
*/ | ||
function composeClasses(slots, getUtilityClass, classes = undefined) { | ||
@@ -14,0 +42,0 @@ const output = {}; |
@@ -5,2 +5,20 @@ export declare function isPlainObject(item: unknown): item is Record<keyof any, unknown>; | ||
} | ||
/** | ||
* Merge objects deeply. | ||
* It will shallow copy React elements. | ||
* | ||
* If `options.clone` is set to `false` the source object will be merged directly into the target object. | ||
* | ||
* @example | ||
* ```ts | ||
* deepmerge({ a: { b: 1 }, d: 2 }, { a: { c: 2 }, d: 4 }); | ||
* // => { a: { b: 1, c: 2 }, d: 4 } | ||
* ```` | ||
* | ||
* @param target The target object. | ||
* @param source The source object. | ||
* @param options The merge options. | ||
* @param options.clone Set to `false` to merge the source object directly into the target object. | ||
* @returns The merged object. | ||
*/ | ||
export default function deepmerge<T>(target: T, source: unknown, options?: DeepmergeOptions): T; |
@@ -28,2 +28,21 @@ "use strict"; | ||
} | ||
/** | ||
* Merge objects deeply. | ||
* It will shallow copy React elements. | ||
* | ||
* If `options.clone` is set to `false` the source object will be merged directly into the target object. | ||
* | ||
* @example | ||
* ```ts | ||
* deepmerge({ a: { b: 1 }, d: 2 }, { a: { c: 2 }, d: 4 }); | ||
* // => { a: { b: 1, c: 2 }, d: 4 } | ||
* ```` | ||
* | ||
* @param target The target object. | ||
* @param source The source object. | ||
* @param options The merge options. | ||
* @param options.clone Set to `false` to merge the source object directly into the target object. | ||
* @returns The merged object. | ||
*/ | ||
function deepmerge(target, source, options = { | ||
@@ -30,0 +49,0 @@ clone: true |
@@ -6,2 +6,30 @@ /* eslint no-restricted-syntax: 0, prefer-template: 0, guard-for-in: 0 | ||
/** | ||
* Compose classes from multiple sources. | ||
* | ||
* @example | ||
* ```tsx | ||
* const slots = { | ||
* root: ['root', 'primary'], | ||
* label: ['label'], | ||
* }; | ||
* | ||
* const getUtilityClass = (slot) => `MuiButton-${slot}`; | ||
* | ||
* const classes = { | ||
* root: 'my-root-class', | ||
* }; | ||
* | ||
* const output = composeClasses(slots, getUtilityClass, classes); | ||
* // { | ||
* // root: 'MuiButton-root MuiButton-primary my-root-class', | ||
* // label: 'MuiButton-label', | ||
* // } | ||
* ``` | ||
* | ||
* @param slots a list of classes for each possible slot | ||
* @param getUtilityClass a function to resolve the class based on the slot name | ||
* @param classes the input classes from props | ||
* @returns the resolved classes for all slots | ||
*/ | ||
export default function composeClasses(slots, getUtilityClass, classes = undefined) { | ||
@@ -8,0 +36,0 @@ const output = {}; |
@@ -21,2 +21,21 @@ import * as React from 'react'; | ||
} | ||
/** | ||
* Merge objects deeply. | ||
* It will shallow copy React elements. | ||
* | ||
* If `options.clone` is set to `false` the source object will be merged directly into the target object. | ||
* | ||
* @example | ||
* ```ts | ||
* deepmerge({ a: { b: 1 }, d: 2 }, { a: { c: 2 }, d: 4 }); | ||
* // => { a: { b: 1, c: 2 }, d: 4 } | ||
* ```` | ||
* | ||
* @param target The target object. | ||
* @param source The source object. | ||
* @param options The merge options. | ||
* @param options.clone Set to `false` to merge the source object directly into the target object. | ||
* @returns The merged object. | ||
*/ | ||
export default function deepmerge(target, source, options = { | ||
@@ -23,0 +42,0 @@ clone: true |
/** | ||
* @mui/utils v6.2.0 | ||
* @mui/utils v6.2.1 | ||
* | ||
@@ -4,0 +4,0 @@ * @license MIT |
@@ -6,2 +6,30 @@ /* eslint no-restricted-syntax: 0, prefer-template: 0, guard-for-in: 0 | ||
/** | ||
* Compose classes from multiple sources. | ||
* | ||
* @example | ||
* ```tsx | ||
* const slots = { | ||
* root: ['root', 'primary'], | ||
* label: ['label'], | ||
* }; | ||
* | ||
* const getUtilityClass = (slot) => `MuiButton-${slot}`; | ||
* | ||
* const classes = { | ||
* root: 'my-root-class', | ||
* }; | ||
* | ||
* const output = composeClasses(slots, getUtilityClass, classes); | ||
* // { | ||
* // root: 'MuiButton-root MuiButton-primary my-root-class', | ||
* // label: 'MuiButton-label', | ||
* // } | ||
* ``` | ||
* | ||
* @param slots a list of classes for each possible slot | ||
* @param getUtilityClass a function to resolve the class based on the slot name | ||
* @param classes the input classes from props | ||
* @returns the resolved classes for all slots | ||
*/ | ||
export default function composeClasses(slots, getUtilityClass, classes = undefined) { | ||
@@ -8,0 +36,0 @@ const output = {}; |
@@ -21,2 +21,21 @@ import * as React from 'react'; | ||
} | ||
/** | ||
* Merge objects deeply. | ||
* It will shallow copy React elements. | ||
* | ||
* If `options.clone` is set to `false` the source object will be merged directly into the target object. | ||
* | ||
* @example | ||
* ```ts | ||
* deepmerge({ a: { b: 1 }, d: 2 }, { a: { c: 2 }, d: 4 }); | ||
* // => { a: { b: 1, c: 2 }, d: 4 } | ||
* ```` | ||
* | ||
* @param target The target object. | ||
* @param source The source object. | ||
* @param options The merge options. | ||
* @param options.clone Set to `false` to merge the source object directly into the target object. | ||
* @returns The merged object. | ||
*/ | ||
export default function deepmerge(target, source, options = { | ||
@@ -23,0 +42,0 @@ clone: true |
/** | ||
* @mui/utils v6.2.0 | ||
* @mui/utils v6.2.1 | ||
* | ||
@@ -4,0 +4,0 @@ * @license MIT |
{ | ||
"name": "@mui/utils", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"private": false, | ||
@@ -34,3 +34,3 @@ "author": "MUI Team", | ||
"react-is": "^19.0.0", | ||
"@mui/types": "^7.2.19" | ||
"@mui/types": "^7.2.20" | ||
}, | ||
@@ -37,0 +37,0 @@ "peerDependencies": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
333978
5880
Updated@mui/types@^7.2.20