@mui/codemod 9.0.0-alpha.1 → 9.0.0-beta.0

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +288 -2
  2. package/README.md +393 -8
  3. package/deprecations/all/deprecations-all.js +6 -0
  4. package/deprecations/autocomplete-props/autocomplete-props.js +195 -0
  5. package/deprecations/autocomplete-props/test-cases/actual.js +31 -0
  6. package/deprecations/autocomplete-props/test-cases/expected.js +31 -0
  7. package/deprecations/autocomplete-props/test-cases/package.actual.js +11 -0
  8. package/deprecations/autocomplete-props/test-cases/package.expected.js +11 -0
  9. package/deprecations/autocomplete-props/test-cases/render-input-package.actual.js +34 -0
  10. package/deprecations/autocomplete-props/test-cases/render-input-package.expected.js +40 -0
  11. package/deprecations/autocomplete-props/test-cases/render-input.actual.js +81 -0
  12. package/deprecations/autocomplete-props/test-cases/render-input.expected.js +92 -0
  13. package/deprecations/autocomplete-props/test-cases/theme.actual.js +15 -0
  14. package/deprecations/autocomplete-props/test-cases/theme.expected.js +15 -0
  15. package/deprecations/checkbox-props/checkbox-props.js +33 -0
  16. package/deprecations/checkbox-props/index.js +13 -0
  17. package/deprecations/checkbox-props/test-cases/actual.js +45 -0
  18. package/deprecations/checkbox-props/test-cases/expected.js +61 -0
  19. package/deprecations/checkbox-props/test-cases/package.actual.js +34 -0
  20. package/deprecations/checkbox-props/test-cases/package.expected.js +50 -0
  21. package/deprecations/checkbox-props/test-cases/theme.actual.js +28 -0
  22. package/deprecations/checkbox-props/test-cases/theme.expected.js +36 -0
  23. package/deprecations/circular-progress-classes/circular-progress-classes.js +16 -1
  24. package/deprecations/circular-progress-classes/postcss-plugin.js +2 -2
  25. package/deprecations/circular-progress-classes/test-cases/expected.js +4 -4
  26. package/deprecations/circular-progress-classes/test-cases/package.expected.js +4 -4
  27. package/deprecations/dialog-props/dialog-props.js +14 -0
  28. package/deprecations/dialog-props/test-cases/actual.js +4 -0
  29. package/deprecations/dialog-props/test-cases/expected.js +4 -0
  30. package/deprecations/drawer-props/drawer-props.js +14 -0
  31. package/deprecations/drawer-props/test-cases/actual.js +10 -2
  32. package/deprecations/drawer-props/test-cases/expected.js +14 -2
  33. package/deprecations/radio-props/index.js +13 -0
  34. package/deprecations/radio-props/radio-props.js +33 -0
  35. package/deprecations/radio-props/test-cases/actual.js +45 -0
  36. package/deprecations/radio-props/test-cases/expected.js +61 -0
  37. package/deprecations/radio-props/test-cases/package.actual.js +34 -0
  38. package/deprecations/radio-props/test-cases/package.expected.js +50 -0
  39. package/deprecations/radio-props/test-cases/theme.actual.js +28 -0
  40. package/deprecations/radio-props/test-cases/theme.expected.js +36 -0
  41. package/deprecations/switch-props/index.js +13 -0
  42. package/deprecations/switch-props/switch-props.js +33 -0
  43. package/deprecations/switch-props/test-cases/actual.js +45 -0
  44. package/deprecations/switch-props/test-cases/expected.js +61 -0
  45. package/deprecations/switch-props/test-cases/package.actual.js +34 -0
  46. package/deprecations/switch-props/test-cases/package.expected.js +50 -0
  47. package/deprecations/switch-props/test-cases/theme.actual.js +28 -0
  48. package/deprecations/switch-props/test-cases/theme.expected.js +36 -0
  49. package/deprecations/tabs-props/tabs-props.js +44 -0
  50. package/deprecations/tabs-props/test-cases/actual.js +11 -0
  51. package/deprecations/tabs-props/test-cases/expected.js +11 -0
  52. package/deprecations/tabs-props/test-cases/package.actual.js +6 -0
  53. package/deprecations/tabs-props/test-cases/package.expected.js +6 -0
  54. package/deprecations/tabs-props/test-cases/theme.actual.js +10 -0
  55. package/deprecations/tabs-props/test-cases/theme.expected.js +10 -0
  56. package/package.json +3 -3
  57. package/v9.0.0/system-props/index.js +13 -0
  58. package/v9.0.0/system-props/removeSystemProps.js +243 -0
  59. package/v9.0.0/system-props/test-cases/system-props.actual.js +144 -0
  60. package/v9.0.0/system-props/test-cases/system-props.expected.js +175 -0
@@ -12,6 +12,183 @@ var _findComponentJSX = _interopRequireDefault(require("../../util/findComponent
12
12
  var _findComponentDefaultProps = _interopRequireDefault(require("../../util/findComponentDefaultProps"));
13
13
  var _assignObject = _interopRequireDefault(require("../../util/assignObject"));
14
14
  var _appendAttribute = _interopRequireDefault(require("../../util/appendAttribute"));
15
+ function getImportedNames(j, root, packageName, componentName) {
16
+ const importNames = new Set();
17
+ root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(new RegExp(`^${packageName}(/${componentName})?$`))).forEach(path => {
18
+ path.node.specifiers.forEach(specifier => {
19
+ if (specifier.type === 'ImportDefaultSpecifier') {
20
+ importNames.add(specifier.local.name);
21
+ }
22
+ if (specifier.type === 'ImportSpecifier' && specifier.imported.name === componentName) {
23
+ importNames.add(specifier.local.name);
24
+ }
25
+ });
26
+ });
27
+ return importNames;
28
+ }
29
+ function getAttributeIndex(element, attributeName) {
30
+ return element.openingElement.attributes.findIndex(attr => attr.type === 'JSXAttribute' && attr.name.name === attributeName);
31
+ }
32
+ function upsertSlotPropsAttribute(j, element, callback) {
33
+ const slotPropsIndex = getAttributeIndex(element, 'slotProps');
34
+ if (slotPropsIndex === -1) {
35
+ const slotPropsExpression = j.objectExpression([]);
36
+ callback(slotPropsExpression);
37
+ (0, _appendAttribute.default)(j, {
38
+ target: element,
39
+ attributeName: 'slotProps',
40
+ expression: slotPropsExpression
41
+ });
42
+ return;
43
+ }
44
+ const slotPropsAttribute = element.openingElement.attributes[slotPropsIndex];
45
+ const slotPropsExpression = slotPropsAttribute.value.expression;
46
+ if (slotPropsExpression.type === 'ObjectExpression') {
47
+ callback(slotPropsExpression);
48
+ return;
49
+ }
50
+ const nextSlotPropsExpression = j.objectExpression([j.spreadElement(slotPropsExpression)]);
51
+ callback(nextSlotPropsExpression);
52
+ slotPropsAttribute.value.expression = nextSlotPropsExpression;
53
+ }
54
+ function moveJsxPropIntoSlotProps(j, element, propName, slotName) {
55
+ const propIndex = getAttributeIndex(element, propName);
56
+ if (propIndex === -1) {
57
+ return;
58
+ }
59
+ const removedAttribute = element.openingElement.attributes.splice(propIndex, 1)[0];
60
+ const removedValue = removedAttribute.value.type === 'StringLiteral' ? j.literal(removedAttribute.value.value) : removedAttribute.value.expression;
61
+ upsertSlotPropsAttribute(j, element, slotPropsExpression => {
62
+ const existingSlotIndex = slotPropsExpression.properties.findIndex(property => property.type !== 'SpreadElement' && property.key?.name === slotName);
63
+ if (existingSlotIndex === -1) {
64
+ slotPropsExpression.properties.push(j.objectProperty(j.identifier(slotName), removedValue));
65
+ return;
66
+ }
67
+ const existingSlot = slotPropsExpression.properties[existingSlotIndex].value;
68
+ slotPropsExpression.properties[existingSlotIndex].value = j.objectExpression([j.spreadElement(removedValue), j.spreadElement(existingSlot)]);
69
+ });
70
+ }
71
+ function ensureParamsSlotPropsSpread(j, element, paramsName) {
72
+ const hasParamsSpread = element.openingElement.attributes.some(attribute => attribute.type === 'JSXSpreadAttribute' && attribute.argument.type === 'Identifier' && attribute.argument.name === paramsName);
73
+ if (!hasParamsSpread) {
74
+ return;
75
+ }
76
+ upsertSlotPropsAttribute(j, element, slotPropsExpression => {
77
+ const hasSlotPropsSpread = slotPropsExpression.properties.some(property => property.type === 'SpreadElement' && property.argument.type === 'MemberExpression' && property.argument.object.type === 'Identifier' && property.argument.object.name === paramsName && property.argument.property.type === 'Identifier' && property.argument.property.name === 'slotProps');
78
+ if (!hasSlotPropsSpread) {
79
+ slotPropsExpression.properties.unshift(j.spreadElement(j.memberExpression(j.identifier(paramsName), j.identifier('slotProps'))));
80
+ }
81
+ });
82
+ }
83
+ function replaceRenderInputParamsMembers(j, callbackRoot, paramsName) {
84
+ const slotPropByDeprecatedName = {
85
+ InputProps: 'input',
86
+ inputProps: 'htmlInput',
87
+ InputLabelProps: 'inputLabel'
88
+ };
89
+ callbackRoot.find(j.MemberExpression).filter(path => path.node.object.type === 'Identifier' && path.node.object.name === paramsName && path.node.property.type === 'Identifier' && slotPropByDeprecatedName[path.node.property.name]).replaceWith(path => j.memberExpression(j.memberExpression(j.identifier(paramsName), j.identifier('slotProps')), j.identifier(slotPropByDeprecatedName[path.node.property.name])));
90
+ }
91
+ function transformRenderInput(j, root, options) {
92
+ const packageName = options.packageName || '@mui/material';
93
+ const textFieldNames = getImportedNames(j, root, packageName, 'TextField');
94
+ (0, _findComponentJSX.default)(j, {
95
+ root,
96
+ packageName: options.packageName,
97
+ componentName: 'Autocomplete'
98
+ }, elementPath => {
99
+ const renderInputIndex = getAttributeIndex(elementPath.node, 'renderInput');
100
+ if (renderInputIndex === -1) {
101
+ return;
102
+ }
103
+ const renderInputAttribute = elementPath.node.openingElement.attributes[renderInputIndex];
104
+ const renderInputExpression = renderInputAttribute.value?.expression;
105
+ if (!renderInputExpression || !['ArrowFunctionExpression', 'FunctionExpression'].includes(renderInputExpression.type) || renderInputExpression.params.length === 0 || renderInputExpression.params[0].type !== 'Identifier') {
106
+ return;
107
+ }
108
+ const paramsName = renderInputExpression.params[0].name;
109
+ const callbackRoot = j(renderInputExpression.body);
110
+ replaceRenderInputParamsMembers(j, callbackRoot, paramsName);
111
+ textFieldNames.forEach(textFieldName => {
112
+ const textFieldElements = [];
113
+ if (renderInputExpression.body.type === 'JSXElement' && renderInputExpression.body.openingElement.name.type === 'JSXIdentifier' && renderInputExpression.body.openingElement.name.name === textFieldName) {
114
+ textFieldElements.push(renderInputExpression.body);
115
+ }
116
+ callbackRoot.find(j.JSXElement).filter(textFieldPath => textFieldPath.node.openingElement.name.type === 'JSXIdentifier' && textFieldPath.node.openingElement.name.name === textFieldName).forEach(textFieldPath => {
117
+ textFieldElements.push(textFieldPath.node);
118
+ });
119
+ textFieldElements.forEach(element => {
120
+ moveJsxPropIntoSlotProps(j, element, 'InputProps', 'input');
121
+ moveJsxPropIntoSlotProps(j, element, 'inputProps', 'htmlInput');
122
+ moveJsxPropIntoSlotProps(j, element, 'InputLabelProps', 'inputLabel');
123
+ moveJsxPropIntoSlotProps(j, element, 'SelectProps', 'select');
124
+ moveJsxPropIntoSlotProps(j, element, 'FormHelperTextProps', 'formHelperText');
125
+ if (getAttributeIndex(element, 'slotProps') !== -1) {
126
+ ensureParamsSlotPropsSpread(j, element, paramsName);
127
+ }
128
+ });
129
+ });
130
+ });
131
+ }
132
+ function isNonComputedKey(j, path) {
133
+ const parent = path.parent.node;
134
+ return (j.ObjectProperty.check(parent) || j.Property.check(parent)) && parent.key === path.node && !parent.computed;
135
+ }
136
+ function renameIdentifiersInScope(j, scopePath, oldName, newName) {
137
+ const bindingScope = scopePath.scope.lookup(oldName);
138
+ if (!bindingScope) {
139
+ return;
140
+ }
141
+ j(bindingScope.path).find(j.Identifier, {
142
+ name: oldName
143
+ }).filter(path => {
144
+ if (isNonComputedKey(j, path)) {
145
+ return false;
146
+ }
147
+ return path.scope.lookup(oldName) === bindingScope;
148
+ }).replaceWith(() => j.identifier(newName));
149
+ }
150
+ function renameRenderTagsCallback(j, callbackPath) {
151
+ const getTagPropsParam = callbackPath.node.params[1];
152
+ if (getTagPropsParam?.type === 'Identifier' && getTagPropsParam.name === 'getTagProps') {
153
+ renameIdentifiersInScope(j, callbackPath, 'getTagProps', 'getItemProps');
154
+ }
155
+ }
156
+ function renameRenderTagsProp(j, propertyPath) {
157
+ if (propertyPath.node.key.type === 'Identifier') {
158
+ propertyPath.node.key.name = 'renderValue';
159
+ }
160
+ if (propertyPath.node.value.type === 'ArrowFunctionExpression' || propertyPath.node.value.type === 'FunctionExpression') {
161
+ renameRenderTagsCallback(j, propertyPath.get('value'));
162
+ }
163
+ }
164
+ function renameUseAutocompleteReturnMembers(j, root) {
165
+ const renamedMembers = new Map([['getTagProps', 'getItemProps'], ['focusedTag', 'focusedItem']]);
166
+ root.find(j.VariableDeclarator).filter(path => {
167
+ const {
168
+ id,
169
+ init
170
+ } = path.node;
171
+ return id.type === 'ObjectPattern' && init?.type === 'CallExpression' && init.callee.type === 'Identifier' && init.callee.name === 'useAutocomplete';
172
+ }).forEach(path => {
173
+ path.node.id.properties.forEach(property => {
174
+ if (property.type !== 'ObjectProperty' || property.key.type !== 'Identifier') {
175
+ return;
176
+ }
177
+ const nextName = renamedMembers.get(property.key.name);
178
+ if (!nextName) {
179
+ return;
180
+ }
181
+ const isShorthand = property.shorthand === true;
182
+ const localName = property.value.type === 'Identifier' ? property.value.name : null;
183
+ property.key.name = nextName;
184
+ if (isShorthand && localName) {
185
+ renameIdentifiersInScope(j, path, localName, nextName);
186
+ property.shorthand = true;
187
+ }
188
+ });
189
+ });
190
+ }
191
+
15
192
  /**
16
193
  * @param {import('jscodeshift').FileInfo} file
17
194
  * @param {import('jscodeshift').API} api
@@ -53,6 +230,7 @@ function transformer(file, api, options) {
53
230
  packageName: options.packageName,
54
231
  componentName: 'Autocomplete'
55
232
  });
233
+ transformRenderInput(j, root, options);
56
234
 
57
235
  // Move ListboxComponent JSX prop into slotProps.listbox.component
58
236
  (0, _findComponentJSX.default)(j, {
@@ -61,6 +239,15 @@ function transformer(file, api, options) {
61
239
  componentName: 'Autocomplete'
62
240
  }, elementPath => {
63
241
  const element = elementPath.node;
242
+ element.openingElement.attributes.forEach((attribute, index) => {
243
+ if (attribute.type !== 'JSXAttribute' || attribute.name.name !== 'renderTags') {
244
+ return;
245
+ }
246
+ attribute.name.name = 'renderValue';
247
+ if (attribute.value?.type === 'JSXExpressionContainer' && (attribute.value.expression.type === 'ArrowFunctionExpression' || attribute.value.expression.type === 'FunctionExpression')) {
248
+ renameRenderTagsCallback(j, elementPath.get('openingElement', 'attributes', index, 'value', 'expression'));
249
+ }
250
+ });
64
251
  const propIndex = element.openingElement.attributes.findIndex(attr => attr.type === 'JSXAttribute' && attr.name.name === 'ListboxComponent');
65
252
  if (propIndex !== -1) {
66
253
  const removedValue = element.openingElement.attributes.splice(propIndex, 1)[0].value.expression;
@@ -127,5 +314,13 @@ function transformer(file, api, options) {
127
314
  }
128
315
  path.prune();
129
316
  });
317
+ defaultPropsPathCollection.find(j.ObjectProperty, {
318
+ key: {
319
+ name: 'renderTags'
320
+ }
321
+ }).forEach(path => {
322
+ renameRenderTagsProp(j, path);
323
+ });
324
+ renameUseAutocompleteReturnMembers(j, root);
130
325
  return root.toSource(printOptions);
131
326
  }
@@ -3,6 +3,8 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  var _Autocomplete = _interopRequireDefault(require("@mui/material/Autocomplete"));
5
5
  var _material = require("@mui/material");
6
+ var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
7
+ var _useAutocomplete = _interopRequireDefault(require("@mui/material/useAutocomplete"));
6
8
  var _jsxRuntime = require("react/jsx-runtime");
7
9
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
8
10
  ChipProps: {
@@ -110,4 +112,33 @@ var _jsxRuntime = require("react/jsx-runtime");
110
112
  ListboxProps: {
111
113
  height: 12
112
114
  }
115
+ });
116
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
117
+ multiple: true,
118
+ options: options,
119
+ renderTags: (value, getTagProps, ownerState) => value.map((option, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
120
+ label: option.label,
121
+ "data-focused": ownerState.focused,
122
+ ...getTagProps({
123
+ index
124
+ })
125
+ }))
126
+ });
127
+ const {
128
+ getTagProps,
129
+ focusedTag
130
+ } = (0, _useAutocomplete.default)(props);
131
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
132
+ ...getTagProps({
133
+ index: focusedTag
134
+ })
135
+ });
136
+ const {
137
+ getTagProps: getAutocompleteTagProps,
138
+ focusedTag: focusedAutocompleteTag
139
+ } = (0, _useAutocomplete.default)(props);
140
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
141
+ ...getAutocompleteTagProps({
142
+ index: focusedAutocompleteTag
143
+ })
113
144
  });
@@ -3,6 +3,8 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  var _Autocomplete = _interopRequireDefault(require("@mui/material/Autocomplete"));
5
5
  var _material = require("@mui/material");
6
+ var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
7
+ var _useAutocomplete = _interopRequireDefault(require("@mui/material/useAutocomplete"));
6
8
  var _jsxRuntime = require("react/jsx-runtime");
7
9
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
8
10
  slots: {
@@ -122,4 +124,33 @@ var _jsxRuntime = require("react/jsx-runtime");
122
124
  ListboxProps: {
123
125
  height: 12
124
126
  }
127
+ });
128
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
129
+ multiple: true,
130
+ options: options,
131
+ renderValue: (value, getItemProps, ownerState) => value.map((option, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
132
+ label: option.label,
133
+ "data-focused": ownerState.focused,
134
+ ...getItemProps({
135
+ index
136
+ })
137
+ }))
138
+ });
139
+ const {
140
+ getItemProps,
141
+ focusedItem
142
+ } = (0, _useAutocomplete.default)(props);
143
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
144
+ ...getItemProps({
145
+ index: focusedItem
146
+ })
147
+ });
148
+ const {
149
+ getItemProps: getAutocompleteTagProps,
150
+ focusedItem: focusedAutocompleteTag
151
+ } = (0, _useAutocomplete.default)(props);
152
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
153
+ ...getAutocompleteTagProps({
154
+ index: focusedAutocompleteTag
155
+ })
125
156
  });
@@ -3,6 +3,7 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  var _Autocomplete = _interopRequireDefault(require("@org/ui/material/Autocomplete"));
5
5
  var _material = require("@org/ui/material");
6
+ var _Chip = _interopRequireDefault(require("@org/ui/material/Chip"));
6
7
  var _jsxRuntime = require("react/jsx-runtime");
7
8
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
8
9
  ChipProps: {
@@ -110,4 +111,14 @@ var _jsxRuntime = require("react/jsx-runtime");
110
111
  ListboxProps: {
111
112
  height: 12
112
113
  }
114
+ });
115
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
116
+ multiple: true,
117
+ options: options,
118
+ renderTags: (value, getTagProps) => value.map((option, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
119
+ label: option.label,
120
+ ...getTagProps({
121
+ index
122
+ })
123
+ }))
113
124
  });
@@ -3,6 +3,7 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  var _Autocomplete = _interopRequireDefault(require("@org/ui/material/Autocomplete"));
5
5
  var _material = require("@org/ui/material");
6
+ var _Chip = _interopRequireDefault(require("@org/ui/material/Chip"));
6
7
  var _jsxRuntime = require("react/jsx-runtime");
7
8
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
8
9
  slots: {
@@ -122,4 +123,14 @@ var _jsxRuntime = require("react/jsx-runtime");
122
123
  ListboxProps: {
123
124
  height: 12
124
125
  }
126
+ });
127
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
128
+ multiple: true,
129
+ options: options,
130
+ renderValue: (value, getItemProps) => value.map((option, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
131
+ label: option.label,
132
+ ...getItemProps({
133
+ index
134
+ })
135
+ }))
125
136
  });
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _TextField = _interopRequireDefault(require("@org/ui/material/TextField"));
5
+ var _Autocomplete = _interopRequireDefault(require("@org/ui/material/Autocomplete"));
6
+ var _material = require("@org/ui/material");
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
9
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
10
+ ...params,
11
+ inputProps: {
12
+ ...params.inputProps,
13
+ autoComplete: 'new-password'
14
+ }
15
+ })
16
+ });
17
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
18
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
19
+ ...params,
20
+ inputProps: {
21
+ ...params.inputProps,
22
+ autoComplete: 'new-password'
23
+ }
24
+ })
25
+ });
26
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomAutocomplete, {
27
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
28
+ ...params,
29
+ inputProps: {
30
+ ...params.inputProps,
31
+ autoComplete: 'new-password'
32
+ }
33
+ })
34
+ });
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _TextField = _interopRequireDefault(require("@org/ui/material/TextField"));
5
+ var _Autocomplete = _interopRequireDefault(require("@org/ui/material/Autocomplete"));
6
+ var _material = require("@org/ui/material");
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
9
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
10
+ ...params,
11
+ slotProps: {
12
+ ...params.slotProps,
13
+ htmlInput: {
14
+ ...params.slotProps.htmlInput,
15
+ autoComplete: 'new-password'
16
+ }
17
+ }
18
+ })
19
+ });
20
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
21
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
22
+ ...params,
23
+ slotProps: {
24
+ ...params.slotProps,
25
+ htmlInput: {
26
+ ...params.slotProps.htmlInput,
27
+ autoComplete: 'new-password'
28
+ }
29
+ }
30
+ })
31
+ });
32
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomAutocomplete, {
33
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
34
+ ...params,
35
+ inputProps: {
36
+ ...params.inputProps,
37
+ autoComplete: 'new-password'
38
+ }
39
+ })
40
+ });
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ var React = _interopRequireWildcard(require("react"));
6
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
7
+ var _Autocomplete = _interopRequireDefault(require("@mui/material/Autocomplete"));
8
+ var _material = require("@mui/material");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
11
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
12
+ ...params,
13
+ InputProps: {
14
+ ...params.InputProps,
15
+ endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
16
+ children: params.InputProps.endAdornment
17
+ })
18
+ }
19
+ })
20
+ });
21
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
22
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
23
+ ...params,
24
+ inputProps: {
25
+ ...params.inputProps,
26
+ autoComplete: 'new-password'
27
+ }
28
+ })
29
+ });
30
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
31
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
32
+ ...params,
33
+ slotProps: {
34
+ input: {
35
+ ...params.InputProps,
36
+ type: 'search'
37
+ }
38
+ }
39
+ })
40
+ });
41
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
42
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
43
+ ...params,
44
+ slotProps: {
45
+ inputLabel: {
46
+ ...params.InputLabelProps,
47
+ shrink: true
48
+ }
49
+ }
50
+ })
51
+ });
52
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
53
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
54
+ ref: params.InputProps.ref,
55
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
56
+ ...params.inputProps
57
+ })
58
+ })
59
+ });
60
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
61
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
62
+ ...params,
63
+ InputProps: {
64
+ ...params.InputProps,
65
+ endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
66
+ children: params.InputProps.endAdornment
67
+ })
68
+ }
69
+ })
70
+ });
71
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomAutocomplete, {
72
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
73
+ ...params,
74
+ InputProps: {
75
+ ...params.InputProps,
76
+ endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
77
+ children: params.InputProps.endAdornment
78
+ })
79
+ }
80
+ })
81
+ });
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ var React = _interopRequireWildcard(require("react"));
6
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
7
+ var _Autocomplete = _interopRequireDefault(require("@mui/material/Autocomplete"));
8
+ var _material = require("@mui/material");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
11
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
12
+ ...params,
13
+ slotProps: {
14
+ ...params.slotProps,
15
+ input: {
16
+ ...params.slotProps.input,
17
+ endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
18
+ children: params.slotProps.input.endAdornment
19
+ })
20
+ }
21
+ }
22
+ })
23
+ });
24
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
25
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
26
+ ...params,
27
+ slotProps: {
28
+ ...params.slotProps,
29
+ htmlInput: {
30
+ ...params.slotProps.htmlInput,
31
+ autoComplete: 'new-password'
32
+ }
33
+ }
34
+ })
35
+ });
36
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
37
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
38
+ ...params,
39
+ slotProps: {
40
+ ...params.slotProps,
41
+ input: {
42
+ ...params.slotProps.input,
43
+ type: 'search'
44
+ }
45
+ }
46
+ })
47
+ });
48
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
49
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
50
+ ...params,
51
+ slotProps: {
52
+ ...params.slotProps,
53
+ inputLabel: {
54
+ ...params.slotProps.inputLabel,
55
+ shrink: true
56
+ }
57
+ }
58
+ })
59
+ });
60
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
61
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
62
+ ref: params.slotProps.input.ref,
63
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
64
+ ...params.slotProps.htmlInput
65
+ })
66
+ })
67
+ });
68
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
69
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
70
+ ...params,
71
+ slotProps: {
72
+ ...params.slotProps,
73
+ input: {
74
+ ...params.slotProps.input,
75
+ endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
76
+ children: params.slotProps.input.endAdornment
77
+ })
78
+ }
79
+ }
80
+ })
81
+ });
82
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomAutocomplete, {
83
+ renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
84
+ ...params,
85
+ InputProps: {
86
+ ...params.InputProps,
87
+ endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
88
+ children: params.InputProps.endAdornment
89
+ })
90
+ }
91
+ })
92
+ });
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _jsxRuntime = require("react/jsx-runtime");
3
4
  fn({
4
5
  MuiAutocomplete: {
5
6
  defaultProps: {
@@ -12,6 +13,13 @@ fn({
12
13
  ListboxProps: {
13
14
  height: 12
14
15
  },
16
+ renderTags: (value, getTagProps, ownerState) => value.map((option, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Chip, {
17
+ label: option.label,
18
+ "data-focused": ownerState.focused,
19
+ ...getTagProps({
20
+ index
21
+ })
22
+ })),
15
23
  componentsProps: {
16
24
  clearIndicator: {
17
25
  width: 10
@@ -41,6 +49,13 @@ fn({
41
49
  ListboxProps: {
42
50
  height: 12
43
51
  },
52
+ renderTags: (value, getTagProps, ownerState) => value.map((option, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Chip, {
53
+ label: option.label,
54
+ "data-focused": ownerState.focused,
55
+ ...getTagProps({
56
+ index
57
+ })
58
+ })),
44
59
  slotProps: {
45
60
  popupIndicator: {
46
61
  width: 20
@@ -1,8 +1,16 @@
1
1
  "use strict";
2
2
 
3
+ var _jsxRuntime = require("react/jsx-runtime");
3
4
  fn({
4
5
  MuiAutocomplete: {
5
6
  defaultProps: {
7
+ renderValue: (value, getItemProps, ownerState) => value.map((option, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Chip, {
8
+ label: option.label,
9
+ "data-focused": ownerState.focused,
10
+ ...getItemProps({
11
+ index
12
+ })
13
+ })),
6
14
  slots: {
7
15
  paper: CustomPaper,
8
16
  popper: CustomPopper
@@ -36,6 +44,13 @@ fn({
36
44
  fn({
37
45
  MuiAutocomplete: {
38
46
  defaultProps: {
47
+ renderValue: (value, getItemProps, ownerState) => value.map((option, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Chip, {
48
+ label: option.label,
49
+ "data-focused": ownerState.focused,
50
+ ...getItemProps({
51
+ index
52
+ })
53
+ })),
39
54
  slotProps: {
40
55
  clearIndicator: {
41
56
  width: 10