@availity/mui-textfield 0.7.1 → 1.0.0-alpha.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.0.0-alpha.0](https://github.com/Availity/element/compare/@availity/mui-textfield@0.7.1...@availity/mui-textfield@1.0.0-alpha.0) (2025-02-24)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * upgraded to @mui/material v6
11
+ * **element:** upgraded to @mui/material v6
12
+
13
+ ### Features
14
+
15
+ * **element:** upgrade to @mui/material v6 ([cb958bb](https://github.com/Availity/element/commit/cb958bba99a4f1ee6dab323f0ff54b69e6fd3493))
16
+ * upgrade @mui/material ([571453a](https://github.com/Availity/element/commit/571453a34b21c344594ab4c03bc497d19aba942b))
17
+ * upgrade to MUI v6 ([7febd6f](https://github.com/Availity/element/commit/7febd6fd4fd58e87e1c97a832cea3b4595a35d58))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **mui-textfield:** remove slotProps and use custom props to ease prop merging ([4543505](https://github.com/Availity/element/commit/45435056abcca6de9538f0f6fd29f58a5b5f26d3))
23
+
5
24
  ## [0.7.1](https://github.com/Availity/element/compare/@availity/mui-textfield@0.7.0...@availity/mui-textfield@0.7.1) (2025-02-18)
6
25
 
7
26
  ### Dependency Updates
package/dist/index.d.mts CHANGED
@@ -9,7 +9,7 @@ type TextFieldProps = {
9
9
  SelectProps?: SelectProps;
10
10
  /** If `true`, the input will take up the full width of its container. @default true */
11
11
  fullWidth?: boolean;
12
- } & Pick<FormLabelProps, 'helpTopicId'> & Omit<TextFieldProps$1, 'fullWidth' | 'variant'>;
12
+ } & Pick<FormLabelProps, 'helpTopicId'> & Omit<TextFieldProps$1, 'fullWidth' | 'variant' | 'slotProps'>;
13
13
  declare const TextField: react.ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & react.RefAttributes<HTMLDivElement | HTMLInputElement>>;
14
14
 
15
15
  export { TextField, type TextFieldProps };
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ type TextFieldProps = {
9
9
  SelectProps?: SelectProps;
10
10
  /** If `true`, the input will take up the full width of its container. @default true */
11
11
  fullWidth?: boolean;
12
- } & Pick<FormLabelProps, 'helpTopicId'> & Omit<TextFieldProps$1, 'fullWidth' | 'variant'>;
12
+ } & Pick<FormLabelProps, 'helpTopicId'> & Omit<TextFieldProps$1, 'fullWidth' | 'variant' | 'slotProps'>;
13
13
  declare const TextField: react.ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & react.RefAttributes<HTMLDivElement | HTMLInputElement>>;
14
14
 
15
15
  export { TextField, type TextFieldProps };
package/dist/index.js CHANGED
@@ -57,11 +57,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
57
57
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
58
 
59
59
  // src/index.ts
60
- var src_exports = {};
61
- __export(src_exports, {
60
+ var index_exports = {};
61
+ __export(index_exports, {
62
62
  TextField: () => TextField
63
63
  });
64
- module.exports = __toCommonJS(src_exports);
64
+ module.exports = __toCommonJS(index_exports);
65
65
 
66
66
  // src/lib/TextField.tsx
67
67
  var import_react = require("react");
@@ -74,11 +74,18 @@ var TextField = (0, import_react.forwardRef)((props, ref) => {
74
74
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
75
  import_TextField.default,
76
76
  __spreadProps(__spreadValues({}, rest), {
77
- inputProps: __spreadValues({ "aria-required": required }, inputProps),
78
- InputProps: __spreadValues(__spreadValues({}, InputProps2), import_mui_form_utils.InputPropOverrides),
79
- InputLabelProps: __spreadValues({ component: import_mui_form_utils.FormLabel, helpTopicId, required, shrink: true }, InputLabelProps),
80
- FormHelperTextProps: __spreadValues({ component: import_mui_form_utils.FormHelperText }, FormHelperTextProps2),
81
- SelectProps: __spreadValues(__spreadValues(__spreadValues({}, SelectProps2), import_mui_form_utils.SelectPropOverrides), (0, import_mui_form_utils.SelectAccessibilityOverrides)(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)),
77
+ slotProps: {
78
+ input: __spreadValues(__spreadValues({}, InputProps2), import_mui_form_utils.InputPropOverrides),
79
+ htmlInput: __spreadValues({ "aria-required": required }, inputProps),
80
+ select: __spreadValues(__spreadValues(__spreadValues({}, SelectProps2), import_mui_form_utils.SelectPropOverrides), (0, import_mui_form_utils.SelectAccessibilityOverrides)(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)),
81
+ inputLabel: __spreadValues({
82
+ component: import_mui_form_utils.FormLabel,
83
+ helpTopicId,
84
+ required,
85
+ shrink: true
86
+ }, InputLabelProps),
87
+ formHelperText: __spreadValues({ component: import_mui_form_utils.FormHelperText }, FormHelperTextProps2)
88
+ },
82
89
  ref
83
90
  })
84
91
  );
package/dist/index.mjs CHANGED
@@ -47,11 +47,18 @@ var TextField = forwardRef((props, ref) => {
47
47
  return /* @__PURE__ */ jsx(
48
48
  MuiTextField,
49
49
  __spreadProps(__spreadValues({}, rest), {
50
- inputProps: __spreadValues({ "aria-required": required }, inputProps),
51
- InputProps: __spreadValues(__spreadValues({}, InputProps2), InputPropOverrides),
52
- InputLabelProps: __spreadValues({ component: FormLabel, helpTopicId, required, shrink: true }, InputLabelProps),
53
- FormHelperTextProps: __spreadValues({ component: FormHelperText }, FormHelperTextProps2),
54
- SelectProps: __spreadValues(__spreadValues(__spreadValues({}, SelectProps2), SelectPropOverrides), SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)),
50
+ slotProps: {
51
+ input: __spreadValues(__spreadValues({}, InputProps2), InputPropOverrides),
52
+ htmlInput: __spreadValues({ "aria-required": required }, inputProps),
53
+ select: __spreadValues(__spreadValues(__spreadValues({}, SelectProps2), SelectPropOverrides), SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)),
54
+ inputLabel: __spreadValues({
55
+ component: FormLabel,
56
+ helpTopicId,
57
+ required,
58
+ shrink: true
59
+ }, InputLabelProps),
60
+ formHelperText: __spreadValues({ component: FormHelperText }, FormHelperTextProps2)
61
+ },
55
62
  ref
56
63
  })
57
64
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-textfield",
3
- "version": "0.7.1",
3
+ "version": "1.0.0-alpha.0",
4
4
  "description": "Availity MUI Textfield Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -40,18 +40,18 @@
40
40
  "publish:canary": "yarn npm publish --access public --tag canary"
41
41
  },
42
42
  "dependencies": {
43
- "@availity/mui-form-utils": "0.17.1",
44
- "@availity/mui-icon": "0.14.0"
43
+ "@availity/mui-form-utils": "1.0.0-alpha.0",
44
+ "@availity/mui-icon": "1.0.0-alpha.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@mui/material": "^5.15.15",
47
+ "@mui/material": "^6.4.5",
48
48
  "react": "18.2.0",
49
49
  "react-dom": "18.2.0",
50
- "tsup": "^8.0.2",
50
+ "tsup": "^8.3.6",
51
51
  "typescript": "^5.4.5"
52
52
  },
53
53
  "peerDependencies": {
54
- "@mui/material": "^5.11.9",
54
+ "@mui/material": "^6.4.5",
55
55
  "react": ">=16.3.0"
56
56
  },
57
57
  "publishConfig": {
@@ -41,7 +41,7 @@ export const _TextField: StoryObj<typeof TextField> = {
41
41
 
42
42
  export const _States: StoryObj<typeof TextField> = {
43
43
  render: (args: TextFieldProps) => (
44
- <Stack direction="row" spacing={1} flexWrap="wrap">
44
+ <Stack direction="row" spacing={1} sx={{ flexWrap: 'wrap' }}>
45
45
  <TextField label="Default" id="default" {...args} />
46
46
  <TextField label="Focused" id="Focused" focused {...args} />
47
47
  <TextField label="Error" id="error" error {...args} />
@@ -109,7 +109,7 @@ export const _PasswordField: StoryObj<typeof TextField> = {
109
109
  /** Formatted value using `libphonenumber-js`. _Formatting occurs `onBlur` for accessibility._ */
110
110
  export const _PhoneWithExt: StoryObj<typeof TextField> = {
111
111
  render: () => {
112
- const [phone, setPhone] = useState('')
112
+ const [phone, setPhone] = useState('');
113
113
 
114
114
  const asYouFormat = (phoneString: string) => {
115
115
  // partial parsePhoneNumber always return country code :(
@@ -127,10 +127,10 @@ export const _PhoneWithExt: StoryObj<typeof TextField> = {
127
127
  };
128
128
 
129
129
  return (
130
- <Grid container rowSpacing={3} columnSpacing={2} maxWidth='360px'>
131
- <Grid xs>
130
+ <Grid container rowSpacing={3} columnSpacing={2} sx={{ maxWidth: '360px' }}>
131
+ <Grid size="grow">
132
132
  <TextField
133
- type='tel'
133
+ type="tel"
134
134
  label="Phone"
135
135
  id="phone"
136
136
  value={phone}
@@ -139,13 +139,8 @@ export const _PhoneWithExt: StoryObj<typeof TextField> = {
139
139
  fullWidth={true}
140
140
  />
141
141
  </Grid>
142
- <Grid xs={2} minWidth='5rem'>
143
- <TextField
144
- type='tel'
145
- label="Ext"
146
- id="phoneextension"
147
- fullWidth={true}
148
- />
142
+ <Grid size={{ xs: 2 }} sx={{ minWidth: '5rem' }}>
143
+ <TextField type="tel" label="Ext" id="phoneextension" fullWidth={true} />
149
144
  </Grid>
150
145
  </Grid>
151
146
  );
@@ -157,47 +152,43 @@ interface CustomProps {
157
152
  name: string;
158
153
  }
159
154
 
160
- const TextMaskCustom = forwardRef<HTMLInputElement, CustomProps>(
161
- function TextMaskCustom(props, ref) {
162
- const { onChange, ...other } = props;
163
- return (
164
- <IMaskInput
165
- {...other}
166
- mask="(#00) 000-0000"
167
- definitions={{
168
- '#': /[1-9]/,
169
- }}
170
- inputRef={ref}
171
- onAccept={(value: any) => onChange({ target: { name: props.name, value } })}
172
- overwrite
173
- />
174
- );
175
- },
176
- );
177
-
178
- const NumericFormatCustom = forwardRef<NumericFormatProps, CustomProps>(
179
- function NumericFormatCustom(props, ref) {
180
- const { onChange, ...other } = props;
181
-
182
- return (
183
- <NumericFormat
184
- {...other}
185
- getInputRef={ref}
186
- onValueChange={(values) => {
187
- onChange({
188
- target: {
189
- name: props.name,
190
- value: values.value,
191
- },
192
- });
193
- }}
194
- thousandSeparator
195
- valueIsNumericString
196
- prefix="$"
197
- />
198
- );
199
- },
200
- );
155
+ const TextMaskCustom = forwardRef<HTMLInputElement, CustomProps>(function TextMaskCustom(props, ref) {
156
+ const { onChange, ...other } = props;
157
+ return (
158
+ <IMaskInput
159
+ {...other}
160
+ mask="(#00) 000-0000"
161
+ definitions={{
162
+ '#': /[1-9]/,
163
+ }}
164
+ inputRef={ref}
165
+ onAccept={(value: any) => onChange({ target: { name: props.name, value } })}
166
+ overwrite
167
+ />
168
+ );
169
+ });
170
+
171
+ const NumericFormatCustom = forwardRef<NumericFormatProps, CustomProps>(function NumericFormatCustom(props, ref) {
172
+ const { onChange, ...other } = props;
173
+
174
+ return (
175
+ <NumericFormat
176
+ {...other}
177
+ getInputRef={ref}
178
+ onValueChange={(values) => {
179
+ onChange({
180
+ target: {
181
+ name: props.name,
182
+ value: values.value,
183
+ },
184
+ });
185
+ }}
186
+ thousandSeparator
187
+ valueIsNumericString
188
+ prefix="$"
189
+ />
190
+ );
191
+ });
201
192
 
202
193
  /** _There are accessibility concerns with masking to consider as it is making live changes to values that may not be communicated via assistive technologies._
203
194
  *
@@ -206,7 +197,7 @@ const NumericFormatCustom = forwardRef<NumericFormatProps, CustomProps>(
206
197
  * > The following demo uses the `react-imask` and `react-number-format` libraries. The same concept could be applied to, for example `react-stripe-element`.
207
198
  * >
208
199
  * > -- <cite>[Integration with 3rd party input libraries](https://mui.com/material-ui/react-text-field/#integration-with-3rd-party-input-libraries)</cite>
209
- */
200
+ */
210
201
  export const _InputMasking: StoryObj<typeof TextField> = {
211
202
  render: () => {
212
203
  // COMMENTED CODE IS OUTSIDE OF FUNCTION
@@ -290,15 +281,13 @@ export const _InputMasking: StoryObj<typeof TextField> = {
290
281
  onChange={handleChange}
291
282
  name="numberformat"
292
283
  id="formatted-numberformat-input"
293
- InputProps={{
294
- inputComponent: NumericFormatCustom as any,
295
- }}
284
+ InputProps={{ inputComponent: NumericFormatCustom as any }}
296
285
  fullWidth={false}
297
286
  margin="normal"
298
287
  />
299
288
  </>
300
289
  );
301
- }
290
+ },
302
291
  };
303
292
 
304
293
  export const _Select: StoryObj<typeof TextField> = {
@@ -20,21 +20,33 @@ export type TextFieldProps = {
20
20
  /** If `true`, the input will take up the full width of its container. @default true */
21
21
  fullWidth?: boolean;
22
22
  } & Pick<FormLabelProps, 'helpTopicId'> &
23
- Omit<MuiTextFieldProps, 'fullWidth' | 'variant'>;
23
+ Omit<MuiTextFieldProps, 'fullWidth' | 'variant' | 'slotProps'>;
24
24
 
25
25
  export const TextField = forwardRef<HTMLDivElement | HTMLInputElement, TextFieldProps>((props, ref) => {
26
26
  const { InputProps, helpTopicId, InputLabelProps, FormHelperTextProps, required, SelectProps, inputProps, ...rest } =
27
27
  props;
28
- const [ openDetected, setOpenDetected ] = useState(false);
28
+ const [openDetected, setOpenDetected] = useState(false);
29
29
 
30
30
  return (
31
31
  <MuiTextField
32
32
  {...rest}
33
- inputProps={{ 'aria-required': required, ...inputProps }}
34
- InputProps={{ ...InputProps, ...InputPropOverrides }}
35
- InputLabelProps={{ component: FormLabel, helpTopicId: helpTopicId, required, shrink: true, ...InputLabelProps }}
36
- FormHelperTextProps={{ component: FormHelperText, ...FormHelperTextProps }}
37
- SelectProps={{ ...SelectProps, ...SelectPropOverrides, ...SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps?.open) }}
33
+ slotProps={{
34
+ input: { ...InputProps, ...InputPropOverrides },
35
+ htmlInput: { 'aria-required': required, ...inputProps },
36
+ select: {
37
+ ...SelectProps,
38
+ ...SelectPropOverrides,
39
+ ...SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps?.open),
40
+ },
41
+ inputLabel: {
42
+ component: FormLabel,
43
+ helpTopicId: helpTopicId,
44
+ required,
45
+ shrink: true,
46
+ ...InputLabelProps,
47
+ },
48
+ formHelperText: { component: FormHelperText, ...FormHelperTextProps },
49
+ }}
38
50
  ref={ref}
39
51
  />
40
52
  );
File without changes