@availity/mui-textfield 0.7.1 → 1.0.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 +38 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -8
- package/dist/index.mjs +12 -5
- package/{introduction.stories.mdx → introduction.mdx} +3 -0
- package/package.json +6 -6
- package/src/lib/TextField.stories.tsx +47 -58
- package/src/lib/TextField.tsx +19 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.0.0](https://github.com/Availity/element/compare/@availity/mui-textfield@1.0.0-alpha.0...@availity/mui-textfield@1.0.0) (2025-02-25)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `mui-form-utils` updated to version `0.7.1`
|
|
10
|
+
* `mui-icon` updated to version `0.7.1`
|
|
11
|
+
* `mui-button` updated to version `0.7.1`
|
|
12
|
+
* `mui-chip` updated to version `0.7.1`
|
|
13
|
+
* `mui-layout` updated to version `0.7.1`
|
|
14
|
+
* `mui-menu` updated to version `0.7.1`
|
|
15
|
+
|
|
16
|
+
### ⚠ BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
* upgrade to @mui/material v6
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* element v1 release ([a6e3567](https://github.com/Availity/element/commit/a6e35671185b9f13d25c7a39c4488ecb8774633e))
|
|
23
|
+
|
|
24
|
+
## [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)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### ⚠ BREAKING CHANGES
|
|
28
|
+
|
|
29
|
+
* upgraded to @mui/material v6
|
|
30
|
+
* **element:** upgraded to @mui/material v6
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* **element:** upgrade to @mui/material v6 ([cb958bb](https://github.com/Availity/element/commit/cb958bba99a4f1ee6dab323f0ff54b69e6fd3493))
|
|
35
|
+
* upgrade @mui/material ([571453a](https://github.com/Availity/element/commit/571453a34b21c344594ab4c03bc497d19aba942b))
|
|
36
|
+
* upgrade to MUI v6 ([7febd6f](https://github.com/Availity/element/commit/7febd6fd4fd58e87e1c97a832cea3b4595a35d58))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **mui-textfield:** remove slotProps and use custom props to ease prop merging ([4543505](https://github.com/Availity/element/commit/45435056abcca6de9538f0f6fd29f58a5b5f26d3))
|
|
42
|
+
|
|
5
43
|
## [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
44
|
|
|
7
45
|
### 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
|
|
61
|
-
__export(
|
|
60
|
+
var index_exports = {};
|
|
61
|
+
__export(index_exports, {
|
|
62
62
|
TextField: () => TextField
|
|
63
63
|
});
|
|
64
|
-
module.exports = __toCommonJS(
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Markdown } from '@storybook/blocks';
|
|
2
2
|
import { Meta } from '@storybook/addon-docs';
|
|
3
3
|
import ReadMe from './README.md?raw';
|
|
4
|
+
import CHANGELOG from './CHANGELOG.md?raw';
|
|
4
5
|
|
|
5
6
|
<Meta title="Form Components/Textfield/Introduction" />
|
|
6
7
|
|
|
7
8
|
<Markdown>{ReadMe}</Markdown>
|
|
9
|
+
|
|
10
|
+
<Markdown>{CHANGELOG}</Markdown>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-textfield",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.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.
|
|
44
|
-
"@availity/mui-icon": "0.
|
|
43
|
+
"@availity/mui-form-utils": "1.0.0",
|
|
44
|
+
"@availity/mui-icon": "1.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@mui/material": "^
|
|
47
|
+
"@mui/material": "^6.4.5",
|
|
48
48
|
"react": "18.2.0",
|
|
49
49
|
"react-dom": "18.2.0",
|
|
50
|
-
"tsup": "^8.
|
|
50
|
+
"tsup": "^8.3.6",
|
|
51
51
|
"typescript": "^5.4.5"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@mui/material": "^
|
|
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
|
|
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
|
|
131
|
-
<Grid
|
|
130
|
+
<Grid container rowSpacing={3} columnSpacing={2} sx={{ maxWidth: '360px' }}>
|
|
131
|
+
<Grid size="grow">
|
|
132
132
|
<TextField
|
|
133
|
-
type=
|
|
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
|
|
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
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
{
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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> = {
|
package/src/lib/TextField.tsx
CHANGED
|
@@ -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 [
|
|
28
|
+
const [openDetected, setOpenDetected] = useState(false);
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
31
|
<MuiTextField
|
|
32
32
|
{...rest}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
);
|