@mui/utils 7.0.2 → 7.1.1
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 +169 -0
- package/deprecatedPropType/deprecatedPropType.d.ts +2 -1
- package/esm/deprecatedPropType/deprecatedPropType.d.ts +2 -1
- package/esm/index.js +1 -1
- package/esm/integerPropType/integerPropType.d.ts +1 -0
- package/esm/integerPropType/integerPropType.js +4 -3
- package/esm/requirePropFactory/requirePropFactory.d.ts +2 -1
- package/esm/requirePropFactory/requirePropFactory.js +1 -1
- package/esm/useControlled/index.js +2 -1
- package/esm/useControlled/useControlled.d.ts +2 -1
- package/esm/useControlled/useControlled.js +12 -6
- package/index.js +1 -1
- package/integerPropType/integerPropType.d.ts +1 -0
- package/integerPropType/integerPropType.js +4 -3
- package/package.json +4 -4
- package/requirePropFactory/requirePropFactory.d.ts +2 -1
- package/requirePropFactory/requirePropFactory.js +1 -1
- package/useControlled/index.js +14 -2
- package/useControlled/useControlled.d.ts +2 -1
- package/useControlled/useControlled.js +12 -6
- package/modern/ClassNameGenerator/ClassNameGenerator.d.ts +0 -6
- package/modern/ClassNameGenerator/index.d.ts +0 -1
- package/modern/HTMLElementType/HTMLElementType.d.ts +0 -3
- package/modern/HTMLElementType/index.d.ts +0 -1
- package/modern/appendOwnerState/appendOwnerState.d.ts +0 -20
- package/modern/appendOwnerState/index.d.ts +0 -2
- package/modern/capitalize/capitalize.d.ts +0 -1
- package/modern/capitalize/index.d.ts +0 -1
- package/modern/chainPropTypes/chainPropTypes.d.ts +0 -2
- package/modern/chainPropTypes/index.d.ts +0 -1
- package/modern/clamp/clamp.d.ts +0 -2
- package/modern/clamp/index.d.ts +0 -1
- package/modern/composeClasses/composeClasses.d.ts +0 -29
- package/modern/composeClasses/index.d.ts +0 -1
- package/modern/createChainedFunction/createChainedFunction.d.ts +0 -7
- package/modern/createChainedFunction/index.d.ts +0 -1
- package/modern/debounce/debounce.d.ts +0 -4
- package/modern/debounce/index.d.ts +0 -2
- package/modern/deepmerge/deepmerge.d.ts +0 -23
- package/modern/deepmerge/index.d.ts +0 -2
- package/modern/deprecatedPropType/deprecatedPropType.d.ts +0 -1
- package/modern/deprecatedPropType/index.d.ts +0 -1
- package/modern/elementAcceptingRef/elementAcceptingRef.d.ts +0 -3
- package/modern/elementAcceptingRef/index.d.ts +0 -1
- package/modern/elementTypeAcceptingRef/elementTypeAcceptingRef.d.ts +0 -3
- package/modern/elementTypeAcceptingRef/index.d.ts +0 -1
- package/modern/exactProp/exactProp.d.ts +0 -2
- package/modern/exactProp/index.d.ts +0 -1
- package/modern/extractEventHandlers/extractEventHandlers.d.ts +0 -10
- package/modern/extractEventHandlers/index.d.ts +0 -1
- package/modern/formatMuiErrorMessage/formatMuiErrorMessage.d.ts +0 -11
- package/modern/formatMuiErrorMessage/index.d.ts +0 -1
- package/modern/generateUtilityClass/generateUtilityClass.d.ts +0 -17
- package/modern/generateUtilityClass/index.d.ts +0 -2
- package/modern/generateUtilityClasses/generateUtilityClasses.d.ts +0 -1
- package/modern/generateUtilityClasses/index.d.ts +0 -1
- package/modern/getDisplayName/getDisplayName.d.ts +0 -7
- package/modern/getDisplayName/index.d.ts +0 -1
- package/modern/getReactElementRef/getReactElementRef.d.ts +0 -9
- package/modern/getReactElementRef/index.d.ts +0 -1
- package/modern/getReactNodeRef/getReactNodeRef.d.ts +0 -11
- package/modern/getReactNodeRef/index.d.ts +0 -1
- package/modern/getScrollbarSize/getScrollbarSize.d.ts +0 -1
- package/modern/getScrollbarSize/index.d.ts +0 -1
- package/modern/getValidReactChildren/getValidReactChildren.d.ts +0 -8
- package/modern/getValidReactChildren/index.d.ts +0 -1
- package/modern/index.d.ts +0 -51
- package/modern/integerPropType/index.d.ts +0 -2
- package/modern/integerPropType/integerPropType.d.ts +0 -3
- package/modern/isFocusVisible/index.d.ts +0 -1
- package/modern/isFocusVisible/isFocusVisible.d.ts +0 -4
- package/modern/isHostComponent/index.d.ts +0 -1
- package/modern/isHostComponent/isHostComponent.d.ts +0 -6
- package/modern/isMuiElement/index.d.ts +0 -1
- package/modern/isMuiElement/isMuiElement.d.ts +0 -1
- package/modern/mergeSlotProps/index.d.ts +0 -2
- package/modern/mergeSlotProps/mergeSlotProps.d.ts +0 -56
- package/modern/omitEventHandlers/index.d.ts +0 -1
- package/modern/omitEventHandlers/omitEventHandlers.d.ts +0 -9
- package/modern/ownerDocument/index.d.ts +0 -1
- package/modern/ownerDocument/ownerDocument.d.ts +0 -1
- package/modern/ownerWindow/index.d.ts +0 -1
- package/modern/ownerWindow/ownerWindow.d.ts +0 -1
- package/modern/ponyfillGlobal/index.d.ts +0 -1
- package/modern/ponyfillGlobal/ponyfillGlobal.d.ts +0 -6
- package/modern/refType/index.d.ts +0 -1
- package/modern/refType/refType.d.ts +0 -3
- package/modern/requirePropFactory/index.d.ts +0 -1
- package/modern/requirePropFactory/requirePropFactory.d.ts +0 -2
- package/modern/resolveComponentProps/index.d.ts +0 -1
- package/modern/resolveComponentProps/resolveComponentProps.d.ts +0 -6
- package/modern/resolveProps/index.d.ts +0 -1
- package/modern/resolveProps/resolveProps.d.ts +0 -12
- package/modern/setRef/index.d.ts +0 -1
- package/modern/setRef/setRef.d.ts +0 -15
- package/modern/types/index.d.ts +0 -7
- package/modern/unsupportedProp/index.d.ts +0 -1
- package/modern/unsupportedProp/unsupportedProp.d.ts +0 -3
- package/modern/useControlled/index.d.ts +0 -2
- package/modern/useControlled/useControlled.d.ts +0 -19
- package/modern/useEnhancedEffect/index.d.ts +0 -1
- package/modern/useEnhancedEffect/useEnhancedEffect.d.ts +0 -10
- package/modern/useEventCallback/index.d.ts +0 -1
- package/modern/useEventCallback/useEventCallback.d.ts +0 -7
- package/modern/useForkRef/index.d.ts +0 -1
- package/modern/useForkRef/useForkRef.d.ts +0 -17
- package/modern/useId/index.d.ts +0 -1
- package/modern/useId/useId.d.ts +0 -7
- package/modern/useIsFocusVisible/index.d.ts +0 -2
- package/modern/useIsFocusVisible/useIsFocusVisible.d.ts +0 -9
- package/modern/useLazyRef/index.d.ts +0 -1
- package/modern/useLazyRef/useLazyRef.d.ts +0 -9
- package/modern/useLocalStorageState/index.d.ts +0 -1
- package/modern/useLocalStorageState/useLocalStorageState.d.ts +0 -14
- package/modern/useOnMount/index.d.ts +0 -1
- package/modern/useOnMount/useOnMount.d.ts +0 -5
- package/modern/usePreviousProps/index.d.ts +0 -1
- package/modern/usePreviousProps/usePreviousProps.d.ts +0 -2
- package/modern/useSlotProps/index.d.ts +0 -2
- package/modern/useSlotProps/useSlotProps.d.ts +0 -41
- package/modern/useTimeout/index.d.ts +0 -2
- package/modern/useTimeout/useTimeout.d.ts +0 -11
- package/modern/visuallyHidden/index.d.ts +0 -1
- package/modern/visuallyHidden/visuallyHidden.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,174 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 7.1.1
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v7.1.0..master -->
|
|
6
|
+
|
|
7
|
+
_May 30, 2025_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 15 contributors who made this release possible.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@7.1.1`
|
|
12
|
+
|
|
13
|
+
- [Autocomplete] Fix label shrink issue when `renderValue` is used with empty array in multiple mode (#46047) @ZeeshanTamboli
|
|
14
|
+
- [Autocomplete] Prevent `renderValue` from being skipped when value is 0 (#46145) @LakshitAgarwal
|
|
15
|
+
- [Autocomplete] Add note in JSDoc for non-TextField components in `renderInput` (#46141) @khllbnomrn
|
|
16
|
+
- [Chip] Add slots and slotProps (#46098) @sai6855
|
|
17
|
+
- [Menu] Remove depreacted `MenuListProps` from demos (#46144) @sai6855
|
|
18
|
+
- [TablePaginationActions] Export TablePaginationActions as new component (#46149) @sai6855
|
|
19
|
+
- [SnackbarContent] Fix `square` prop not working (#46196) @0210shivam
|
|
20
|
+
- [SnackbarContent] Fix error when theme value is CSS variable (#46198) @0210shivam
|
|
21
|
+
|
|
22
|
+
### `@mui/codemod@7.1.1`
|
|
23
|
+
|
|
24
|
+
- Add package name option (#45977) @siriwatknp
|
|
25
|
+
|
|
26
|
+
### `@mui/system@7.1.1`
|
|
27
|
+
|
|
28
|
+
- Skip styled component from being transformed (#46129) @siriwatknp
|
|
29
|
+
- Update the type for borderRadius (#46154) @codiini
|
|
30
|
+
|
|
31
|
+
### `@mui/styled-engine@7.1.1`
|
|
32
|
+
|
|
33
|
+
- Fix variant props callback type to spread `ownerState` (#46187) @siriwatknp
|
|
34
|
+
|
|
35
|
+
### `@mui/stylis-plugin-rtl@7.1.1`
|
|
36
|
+
|
|
37
|
+
- Fix RTL does not work with CSS layer with a new package (#46230) @siriwatknp
|
|
38
|
+
|
|
39
|
+
### Docs
|
|
40
|
+
|
|
41
|
+
- [Dialog] Remove deprecated TransitionComponent from demo (#46185) @sai6855
|
|
42
|
+
- [Grid] Remove direction `column` and `column-reverse` from the demo (#46127) @0210shivam
|
|
43
|
+
- [Grid] Update grid migration guide (#46057) @sai6855
|
|
44
|
+
- [templates] Fix rendering of logos in dark mode (#46221) @sai6855
|
|
45
|
+
- [ToggleButtonGroup] Add spacing demo (#46058) @sai6855
|
|
46
|
+
- Fix typo in dark mode docs (#46229) @ZeeshanTamboli
|
|
47
|
+
- Clarify Next.js + Tailwind CSS v3 integration requirements (#46176) @chaitanyasharma1011
|
|
48
|
+
- Fix GridLegacy docs order (#46135) @oliviertassinari
|
|
49
|
+
- Update upgrade guide for resolution of `react-is` (#46002) @siriwatknp
|
|
50
|
+
- Remove oudated scaffoldhub ad (#46090) @oliviertassinari
|
|
51
|
+
- Show how to target global state classes with CSS Modules (#45992) @RubemMazzetto
|
|
52
|
+
|
|
53
|
+
### Core
|
|
54
|
+
|
|
55
|
+
- [code-infra] Add plugin to check for index file access (#46178) @Janpot
|
|
56
|
+
- [code-infra] Bump eslint to v9 (#46222) @brijeshb42
|
|
57
|
+
- [code-infra] Move packages to mui/mui-public (#46155) @Janpot
|
|
58
|
+
- [code-infra] Move `chai` to peerDep (#46227) @JCQuintas
|
|
59
|
+
- [code-infra] Avoid loading barrel file during type checking (#46177) @Janpot
|
|
60
|
+
- [code-infra] Remove unnecessary ref from `HighlightedCode` component (#46151) @ZeeshanTamboli
|
|
61
|
+
- [code-infra] Import mocha type instead of global (#46108) @JCQuintas
|
|
62
|
+
- [code-infra] Dependabot also create branches (795a481) @oliviertassinari
|
|
63
|
+
- [code-infra] Avoid running continuous release on forks (#46103) @Janpot
|
|
64
|
+
- [code-infra] Remove checkout job altogether (#46100) @Janpot
|
|
65
|
+
- [code-infra] Remove required checkout workflows in circleci (#46099) @Janpot
|
|
66
|
+
- Run pnpm docs:sync-team (c8f1da5) @oliviertassinari
|
|
67
|
+
- Upgrade MUI X packages to v8 (#45990) @KenanYusuf
|
|
68
|
+
- Minor detail to reduce confusion (4c64b72) @oliviertassinari
|
|
69
|
+
- Update security.md (#45839) @DiegoAndai
|
|
70
|
+
- Apply yml convention, blank line only at top level (f273220) @oliviertassinari
|
|
71
|
+
- Add comment that lab should be in alpha (#45999) @oliviertassinari
|
|
72
|
+
|
|
73
|
+
All contributors of this release in alphabetical order: @0210shivam, @brijeshb42, @chaitanyasharma1011, @codiini, @DiegoAndai, @Janpot, @JCQuintas, @KenanYusuf, @khllbnomrn, @LakshitAgarwal, @oliviertassinari, @RubemMazzetto, @sai6855, @siriwatknp, @ZeeshanTamboli
|
|
74
|
+
|
|
75
|
+
## 7.1.0
|
|
76
|
+
|
|
77
|
+
<!-- generated comparing v7.0.2..master -->
|
|
78
|
+
|
|
79
|
+
_May 6, 2025_
|
|
80
|
+
|
|
81
|
+
A big thanks to the 21 contributors who made this release possible. Here are some highlights ✨:
|
|
82
|
+
|
|
83
|
+
- 🎉 Material UI now works with **Tailwind CSS v4**! Check out the [setup guide](https://mui.com/material-ui/integrations/tailwindcss/tailwindcss-v4/).
|
|
84
|
+
|
|
85
|
+
### `@mui/material@7.1.0`
|
|
86
|
+
|
|
87
|
+
- [InputBase] Text cursor jumps several lines up when inserting text fragment with new line at the end (#45246) @yermartee
|
|
88
|
+
- [OutlinedInput] Add missing `notchedOutline` slot (#45917) @siriwatknp
|
|
89
|
+
- [Snackbar] Skip default `onClickAway` behavior when `defaultMuiPrevented` is provided (#45629) @sai6855
|
|
90
|
+
- [Avatar] Fix img slot types and add missing slots (#45483) @siriwatknp
|
|
91
|
+
- [Badge] Replace useSlotProps with useSlot hook (#45871) @sai6855
|
|
92
|
+
- [BottomNavigationAction] Add slots and slotProps (#45776) @sai6855
|
|
93
|
+
- [CardActionArea] Add slots and slotProps (#45866) @sai6855
|
|
94
|
+
- [useMediaQuery] Add warning and docs for using `useMediaQuery('print')` (#44790) @good-jinu
|
|
95
|
+
- Remove unnecessary clsx usages (#46084) @sai6855
|
|
96
|
+
- Corrected generic type definition in `SelectChangeEvent` (#45941) @SuyashShukla0007
|
|
97
|
+
- Fix theme object changes between renders (#45863) @siriwatknp
|
|
98
|
+
|
|
99
|
+
### `@mui/material-nextjs@7.1.0`
|
|
100
|
+
|
|
101
|
+
- Add option to enable CSS layers for pages router (#45596) @siriwatknp
|
|
102
|
+
- Do not wrap `@layer` order rules in App Router (#45864) @Nayeem-XTREME
|
|
103
|
+
|
|
104
|
+
### `@mui/system@7.1.0`
|
|
105
|
+
|
|
106
|
+
- Fix `@mui/system` types organization (#45860) @Janpot
|
|
107
|
+
|
|
108
|
+
### `@mui/styled-engine@7.1.0`
|
|
109
|
+
|
|
110
|
+
- Infer `ownerState` from props in `styled` (#46083) @siriwatknp
|
|
111
|
+
- Fix style overrides variants type (#45478) @siriwatknp
|
|
112
|
+
|
|
113
|
+
### Docs
|
|
114
|
+
|
|
115
|
+
- [Avatar] Add avatar upload demo (#45986) @Demianeen
|
|
116
|
+
- [Dialog] Remove deprecated props usage in demos (#45923) @sai6855
|
|
117
|
+
- [Menu] Update `paper` slot JSDoc default from `Paper` to `PopoverPaper` (#45722) @andreachiera
|
|
118
|
+
- [examples] Remove create-react-app usages (#45426) @CodeLeom
|
|
119
|
+
- Add `AccordionSummary` to the v5 breaking change migration (#45947) @siriwatknp
|
|
120
|
+
- Update CSS variable usage in migration guide for Pigment CSS (#46033) @sai6855
|
|
121
|
+
- Fix docs API dark mode color (#46086) @alexfauquette
|
|
122
|
+
- Add a guide for extending Material UI classes in Tailwind CSS (#46039) @siriwatknp
|
|
123
|
+
- Add `InitColorSchemeScript` docs and API (#45927) @siriwatknp
|
|
124
|
+
- Add Tailwind CSS v4 integration guide (#45906) @siriwatknp
|
|
125
|
+
- Fix 301 links to the system v6 (#45931) @oliviertassinari
|
|
126
|
+
- Add notification for MUI X v8 announcement (#45942) @joserodolfofreitas
|
|
127
|
+
- Fix som 301 redirections (ae84b35) @oliviertassinari
|
|
128
|
+
- Fix some 301 redirections (057384e) @oliviertassinari
|
|
129
|
+
- Fix logo is not centered on small screens (#45920) @crabsim
|
|
130
|
+
- Fix line break typo (a2a62d5) @oliviertassinari
|
|
131
|
+
- Fix markdown typo in templates.md (#45914) @scyzoryck
|
|
132
|
+
- Add Next.js App Router guide for custom classnames (#45852) @siriwatknp
|
|
133
|
+
|
|
134
|
+
### Core
|
|
135
|
+
|
|
136
|
+
- [code-infra] Give a stable name to dev tool app (3889ded) @oliviertassinari
|
|
137
|
+
- [code-infra] Normalize author package in org (8135638) @oliviertassinari
|
|
138
|
+
- [code-infra] Correct some manually curated .d.ts files (#46054) @Janpot
|
|
139
|
+
- [code-infra] Align deps versions (#46048) @Janpot
|
|
140
|
+
- [code-infra] Fix dynamic import in imports resolver (#46046) @Janpot
|
|
141
|
+
- [code-infra] Eliminate `@mui/utils` deep imports (#46004) @Janpot
|
|
142
|
+
- [code-infra] Expand renovate.json for react types (#45935) @Janpot
|
|
143
|
+
- [code-infra] Make Argos upload script reusable (#45883) @Janpot
|
|
144
|
+
- [code-infra] Disallow redundant window prefixes for globals (#45880) @Janpot
|
|
145
|
+
- [code-infra] Remove type generation of modern build (#45912) @Janpot
|
|
146
|
+
- [code-infra] Clean up bundle size checker (#45622) @Janpot
|
|
147
|
+
- [code-infra] Fix `StrictMode` effects not being called twice in React 19 tests (#45812) @bernardobelchior
|
|
148
|
+
- [code-infra] Convert `@mui/utils` to typescript (#45671) @Janpot
|
|
149
|
+
- [docs-infra] Improve export into sandbox package.json (#46044) @oliviertassinari
|
|
150
|
+
- [docs-infra] Update feedback Node.js to v22 (#46064) @oliviertassinari
|
|
151
|
+
- [docs-infra] Normalize netlify.toml in org (b101d5c) @oliviertassinari
|
|
152
|
+
- [docs-infra] Uniformize Vale between repositories (0f79796) @oliviertassinari
|
|
153
|
+
- [docs-infra] Fix Vale no longer working (#46029) @oliviertassinari
|
|
154
|
+
- [docs-infra] Remove demo styling switch (#45926) @Janpot
|
|
155
|
+
- [docs-infra] StackBlitz WebContainer demos (#45924) @Janpot
|
|
156
|
+
- [docs-infra] Fix feedback management (#45872) @alexfauquette
|
|
157
|
+
- [test] Replace `playwright` with `@playwright/test` (#45998) @ZeeshanTamboli
|
|
158
|
+
- Fix internal version duplication (#46051) @oliviertassinari
|
|
159
|
+
- Avoid the need for `@mui/material/themeCssVarsAugmentation` (#46053) @Janpot
|
|
160
|
+
- Add security label to dependabot PRs (0a5c027) @oliviertassinari
|
|
161
|
+
- Remove unecessary versions (#46034) @oliviertassinari
|
|
162
|
+
- Remove redundant overrides resolver (#45970) @romgrk
|
|
163
|
+
- Fix duplicate branch reference (#45915) @oliviertassinari
|
|
164
|
+
- Fix outdated <link rel="shortcut icon" (#45916) @oliviertassinari
|
|
165
|
+
- Fix redirection chains (#45930) @oliviertassinari
|
|
166
|
+
- Run pnpm docs:sync-team (beee09f) @oliviertassinari
|
|
167
|
+
- Add `pkg.pr.new` publishing (#42984) @Aslemammad
|
|
168
|
+
- Remove @mui/base from the master branch (#45857) @mnajdova
|
|
169
|
+
|
|
170
|
+
All contributors of this release in alphabetical order: @alexfauquette, @andreachiera, @Aslemammad, @bernardobelchior, @CodeLeom, @crabsim, @Demianeen, @good-jinu, @Janpot, @joserodolfofreitas, @mnajdova, @Nayeem-XTREME, @oliviertassinari, @renovate[bot], @romgrk, @sai6855, @scyzoryck, @siriwatknp, @SuyashShukla0007, @yermartee, @ZeeshanTamboli
|
|
171
|
+
|
|
3
172
|
## 7.0.2
|
|
4
173
|
|
|
5
174
|
_Apr 9, 2025_
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Validator } from 'prop-types';
|
|
2
|
+
export default function deprecatedPropType<T>(validator: Validator<T>, reason: string): Validator<T>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Validator } from 'prop-types';
|
|
2
|
+
export default function deprecatedPropType<T>(validator: Validator<T>, reason: string): Validator<T>;
|
package/esm/index.js
CHANGED
|
@@ -29,16 +29,17 @@ function requiredInteger(props, propName, componentName, location) {
|
|
|
29
29
|
}
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
|
-
function validator(props, propName,
|
|
32
|
+
function validator(props, propName, componentName, location) {
|
|
33
33
|
const propValue = props[propName];
|
|
34
34
|
if (propValue === undefined) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
return requiredInteger(props, propName,
|
|
37
|
+
return requiredInteger(props, propName, componentName, location);
|
|
38
38
|
}
|
|
39
39
|
function validatorNoop() {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
42
|
validator.isRequired = requiredInteger;
|
|
43
43
|
validatorNoop.isRequired = validatorNoop;
|
|
44
|
-
|
|
44
|
+
const integerPropType = process.env.NODE_ENV === 'production' ? validatorNoop : validator;
|
|
45
|
+
export default integerPropType;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
export default function requirePropFactory(componentNameInError: string, Component?: React.ComponentType<unknown>): (requiredProp: string) => PropTypes.Validator<any>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./useControlled.js";
|
|
1
|
+
export { default } from "./useControlled.js";
|
|
2
|
+
export * from "./useControlled.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
export interface UseControlledProps<T = unknown> {
|
|
2
3
|
/**
|
|
3
4
|
* Holds the component value when it's controlled.
|
|
@@ -16,4 +17,4 @@ export interface UseControlledProps<T = unknown> {
|
|
|
16
17
|
*/
|
|
17
18
|
state?: string;
|
|
18
19
|
}
|
|
19
|
-
export default function useControlled<T = unknown>(props: UseControlledProps<T>): [T,
|
|
20
|
+
export default function useControlled<T = unknown>(props: UseControlledProps<T>): [T, React.Dispatch<React.SetStateAction<T | undefined>>];
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes, dependency arrays are intentionally ignored
|
|
4
4
|
/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
export default function useControlled({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export default function useControlled(props) {
|
|
7
|
+
const {
|
|
8
|
+
controlled,
|
|
9
|
+
default: defaultProp,
|
|
10
|
+
name,
|
|
11
|
+
state = 'value'
|
|
12
|
+
} = props;
|
|
12
13
|
// isControlled is ignored in the hook dependency lists as it should never change.
|
|
13
14
|
const {
|
|
14
15
|
current: isControlled
|
|
@@ -37,5 +38,10 @@ export default function useControlled({
|
|
|
37
38
|
setValue(newValue);
|
|
38
39
|
}
|
|
39
40
|
}, []);
|
|
41
|
+
|
|
42
|
+
// TODO: provide overloads for the useControlled function to account for the case where either
|
|
43
|
+
// controlled or default is not undefiend.
|
|
44
|
+
// In that case the return type should be [T, React.Dispatch<React.SetStateAction<T>>]
|
|
45
|
+
// otherwise it should be [T | undefined, React.Dispatch<React.SetStateAction<T | undefined>>]
|
|
40
46
|
return [value, setValueIfUncontrolled];
|
|
41
47
|
}
|
package/index.js
CHANGED
|
@@ -36,16 +36,17 @@ function requiredInteger(props, propName, componentName, location) {
|
|
|
36
36
|
}
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
|
-
function validator(props, propName,
|
|
39
|
+
function validator(props, propName, componentName, location) {
|
|
40
40
|
const propValue = props[propName];
|
|
41
41
|
if (propValue === undefined) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
-
return requiredInteger(props, propName,
|
|
44
|
+
return requiredInteger(props, propName, componentName, location);
|
|
45
45
|
}
|
|
46
46
|
function validatorNoop() {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
validator.isRequired = requiredInteger;
|
|
50
50
|
validatorNoop.isRequired = validatorNoop;
|
|
51
|
-
|
|
51
|
+
const integerPropType = process.env.NODE_ENV === 'production' ? validatorNoop : validator;
|
|
52
|
+
var _default = exports.default = integerPropType;
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/utils",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"private": false,
|
|
3
|
+
"version": "7.1.1",
|
|
5
4
|
"author": "MUI Team",
|
|
6
5
|
"description": "Utility functions for React components.",
|
|
7
6
|
"main": "./index.js",
|
|
@@ -26,12 +25,12 @@
|
|
|
26
25
|
"url": "https://opencollective.com/mui-org"
|
|
27
26
|
},
|
|
28
27
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "^7.27.
|
|
28
|
+
"@babel/runtime": "^7.27.1",
|
|
30
29
|
"@types/prop-types": "^15.7.14",
|
|
31
30
|
"clsx": "^2.1.1",
|
|
32
31
|
"prop-types": "^15.8.1",
|
|
33
32
|
"react-is": "^19.1.0",
|
|
34
|
-
"@mui/types": "^7.4.
|
|
33
|
+
"@mui/types": "^7.4.3"
|
|
35
34
|
},
|
|
36
35
|
"peerDependencies": {
|
|
37
36
|
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
@@ -50,6 +49,7 @@
|
|
|
50
49
|
"engines": {
|
|
51
50
|
"node": ">=14.0.0"
|
|
52
51
|
},
|
|
52
|
+
"private": false,
|
|
53
53
|
"module": "./esm/index.js",
|
|
54
54
|
"exports": {
|
|
55
55
|
"./package.json": "./package.json",
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
export default function requirePropFactory(componentNameInError: string, Component?: React.ComponentType<unknown>): (requiredProp: string) => PropTypes.Validator<any>;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = requirePropFactory;
|
|
7
7
|
function requirePropFactory(componentNameInError, Component) {
|
|
8
8
|
if (process.env.NODE_ENV === 'production') {
|
|
9
|
-
return () => null;
|
|
9
|
+
return () => () => null;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line react/forbid-foreign-prop-types
|
package/useControlled/index.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
var _exportNames = {};
|
|
7
8
|
Object.defineProperty(exports, "default", {
|
|
8
9
|
enumerable: true,
|
|
9
10
|
get: function () {
|
|
10
11
|
return _useControlled.default;
|
|
11
12
|
}
|
|
12
13
|
});
|
|
13
|
-
var _useControlled =
|
|
14
|
+
var _useControlled = _interopRequireWildcard(require("./useControlled"));
|
|
15
|
+
Object.keys(_useControlled).forEach(function (key) {
|
|
16
|
+
if (key === "default" || key === "__esModule") return;
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
18
|
+
if (key in exports && exports[key] === _useControlled[key]) return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _useControlled[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
export interface UseControlledProps<T = unknown> {
|
|
2
3
|
/**
|
|
3
4
|
* Holds the component value when it's controlled.
|
|
@@ -16,4 +17,4 @@ export interface UseControlledProps<T = unknown> {
|
|
|
16
17
|
*/
|
|
17
18
|
state?: string;
|
|
18
19
|
}
|
|
19
|
-
export default function useControlled<T = unknown>(props: UseControlledProps<T>): [T,
|
|
20
|
+
export default function useControlled<T = unknown>(props: UseControlledProps<T>): [T, React.Dispatch<React.SetStateAction<T | undefined>>];
|
|
@@ -9,12 +9,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = useControlled;
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
|
-
function useControlled({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
function useControlled(props) {
|
|
13
|
+
const {
|
|
14
|
+
controlled,
|
|
15
|
+
default: defaultProp,
|
|
16
|
+
name,
|
|
17
|
+
state = 'value'
|
|
18
|
+
} = props;
|
|
18
19
|
// isControlled is ignored in the hook dependency lists as it should never change.
|
|
19
20
|
const {
|
|
20
21
|
current: isControlled
|
|
@@ -43,5 +44,10 @@ function useControlled({
|
|
|
43
44
|
setValue(newValue);
|
|
44
45
|
}
|
|
45
46
|
}, []);
|
|
47
|
+
|
|
48
|
+
// TODO: provide overloads for the useControlled function to account for the case where either
|
|
49
|
+
// controlled or default is not undefiend.
|
|
50
|
+
// In that case the return type should be [T, React.Dispatch<React.SetStateAction<T>>]
|
|
51
|
+
// otherwise it should be [T | undefined, React.Dispatch<React.SetStateAction<T | undefined>>]
|
|
46
52
|
return [value, setValueIfUncontrolled];
|
|
47
53
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./ClassNameGenerator.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./HTMLElementType.js";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Simplify } from '@mui/types';
|
|
3
|
-
/**
|
|
4
|
-
* Type of the ownerState based on the type of an element it applies to.
|
|
5
|
-
* This resolves to the provided OwnerState for React components and `undefined` for host components.
|
|
6
|
-
* Falls back to `OwnerState | undefined` when the exact type can't be determined in development time.
|
|
7
|
-
*/
|
|
8
|
-
type OwnerStateWhenApplicable<ElementType extends React.ElementType, OwnerState> = ElementType extends React.ComponentType<any> ? OwnerState : ElementType extends keyof React.JSX.IntrinsicElements ? undefined : OwnerState | undefined;
|
|
9
|
-
export type AppendOwnerStateReturnType<ElementType extends React.ElementType, OtherProps, OwnerState> = Simplify<OtherProps & {
|
|
10
|
-
ownerState: OwnerStateWhenApplicable<ElementType, OwnerState>;
|
|
11
|
-
}>;
|
|
12
|
-
/**
|
|
13
|
-
* Appends the ownerState object to the props, merging with the existing one if necessary.
|
|
14
|
-
*
|
|
15
|
-
* @param elementType Type of the element that owns the `existingProps`. If the element is a DOM node or undefined, `ownerState` is not applied.
|
|
16
|
-
* @param otherProps Props of the element.
|
|
17
|
-
* @param ownerState
|
|
18
|
-
*/
|
|
19
|
-
declare function appendOwnerState<ElementType extends React.ElementType, OtherProps extends Record<string, any>, OwnerState>(elementType: ElementType | undefined, otherProps: OtherProps, ownerState: OwnerState): AppendOwnerStateReturnType<ElementType, OtherProps, OwnerState>;
|
|
20
|
-
export default appendOwnerState;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function capitalize(string: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./capitalize.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./chainPropTypes.js";
|
package/modern/clamp/clamp.d.ts
DELETED
package/modern/clamp/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./clamp.js";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compose classes from multiple sources.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```tsx
|
|
6
|
-
* const slots = {
|
|
7
|
-
* root: ['root', 'primary'],
|
|
8
|
-
* label: ['label'],
|
|
9
|
-
* };
|
|
10
|
-
*
|
|
11
|
-
* const getUtilityClass = (slot) => `MuiButton-${slot}`;
|
|
12
|
-
*
|
|
13
|
-
* const classes = {
|
|
14
|
-
* root: 'my-root-class',
|
|
15
|
-
* };
|
|
16
|
-
*
|
|
17
|
-
* const output = composeClasses(slots, getUtilityClass, classes);
|
|
18
|
-
* // {
|
|
19
|
-
* // root: 'MuiButton-root MuiButton-primary my-root-class',
|
|
20
|
-
* // label: 'MuiButton-label',
|
|
21
|
-
* // }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @param slots a list of classes for each possible slot
|
|
25
|
-
* @param getUtilityClass a function to resolve the class based on the slot name
|
|
26
|
-
* @param classes the input classes from props
|
|
27
|
-
* @returns the resolved classes for all slots
|
|
28
|
-
*/
|
|
29
|
-
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>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./composeClasses.js";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Safe chained function.
|
|
3
|
-
*
|
|
4
|
-
* Will only create a new function if needed,
|
|
5
|
-
* otherwise will pass back existing functions or null.
|
|
6
|
-
*/
|
|
7
|
-
export default function createChainedFunction<Args extends any[], This>(...funcs: Array<(this: This, ...args: Args) => any>): (this: This, ...args: Args) => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./createChainedFunction.js";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare function isPlainObject(item: unknown): item is Record<keyof any, unknown>;
|
|
2
|
-
export interface DeepmergeOptions {
|
|
3
|
-
clone?: boolean;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Merge objects deeply.
|
|
7
|
-
* It will shallow copy React elements.
|
|
8
|
-
*
|
|
9
|
-
* If `options.clone` is set to `false` the source object will be merged directly into the target object.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* deepmerge({ a: { b: 1 }, d: 2 }, { a: { c: 2 }, d: 4 });
|
|
14
|
-
* // => { a: { b: 1, c: 2 }, d: 4 }
|
|
15
|
-
* ````
|
|
16
|
-
*
|
|
17
|
-
* @param target The target object.
|
|
18
|
-
* @param source The source object.
|
|
19
|
-
* @param options The merge options.
|
|
20
|
-
* @param options.clone Set to `false` to merge the source object directly into the target object.
|
|
21
|
-
* @returns The merged object.
|
|
22
|
-
*/
|
|
23
|
-
export default function deepmerge<T>(target: T, source: unknown, options?: DeepmergeOptions): T;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function deprecatedPropType<T>(validator: T, reason: string): T;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./deprecatedPropType.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./elementAcceptingRef.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./elementTypeAcceptingRef.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./exactProp.js";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { EventHandlers } from "../types/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Extracts event handlers from a given object.
|
|
4
|
-
* A prop is considered an event handler if it is a function and its name starts with `on`.
|
|
5
|
-
*
|
|
6
|
-
* @param object An object to extract event handlers from.
|
|
7
|
-
* @param excludeKeys An array of keys to exclude from the returned object.
|
|
8
|
-
*/
|
|
9
|
-
declare function extractEventHandlers(object: Record<string, any> | undefined, excludeKeys?: string[]): EventHandlers;
|
|
10
|
-
export default extractEventHandlers;
|