@availity/mui-textfield 1.2.4 → 1.3.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 +12 -0
- package/dist/index.js +9 -7
- package/dist/index.mjs +9 -7
- package/package.json +1 -1
- package/src/lib/TextField.stories.tsx +3 -2
- package/src/lib/TextField.tsx +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.3.0](https://github.com/Availity/element/compare/@availity/mui-textfield@1.2.4...@availity/mui-textfield@1.3.0) (2025-05-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **mui-textfield:** new readonly and updated disabled styles ([093844f](https://github.com/Availity/element/commit/093844ff8811656acb701a95a280076a9f0cb030))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **mui-textfield:** resolve displayoverflowmaxlength not recognized prop error ([8324691](https://github.com/Availity/element/commit/83246910cfe8339a40eecba6224ce611cfa7ceaf))
|
|
16
|
+
|
|
5
17
|
## [1.2.4](https://github.com/Availity/element/compare/@availity/mui-textfield@1.2.3...@availity/mui-textfield@1.2.4) (2025-04-30)
|
|
6
18
|
|
|
7
19
|
### Dependency Updates
|
package/dist/index.js
CHANGED
|
@@ -129,7 +129,7 @@ var TextFieldFormHelperText = (_a) => {
|
|
|
129
129
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_mui_form_utils.FormHelperText, __spreadProps(__spreadValues({}, FormHelperTextProps2), { children: helperText }));
|
|
130
130
|
};
|
|
131
131
|
var TextField = (0, import_react3.forwardRef)((props, ref) => {
|
|
132
|
-
var _b, _c, _d, _e, _f, _g, _h;
|
|
132
|
+
var _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
133
133
|
const _a = props, {
|
|
134
134
|
InputProps: InputProps2,
|
|
135
135
|
helpTopicId,
|
|
@@ -156,6 +156,7 @@ var TextField = (0, import_react3.forwardRef)((props, ref) => {
|
|
|
156
156
|
const [openDetected, setOpenDetected] = (0, import_react3.useState)(false);
|
|
157
157
|
const [charCount, setCharCount] = (0, import_react3.useState)(0);
|
|
158
158
|
const maxLength = (inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength);
|
|
159
|
+
const allReadOnly = (InputProps2 == null ? void 0 : InputProps2.readOnly) || (inputProps == null ? void 0 : inputProps.readOnly) || ((_e = (_d = rest.slotProps) == null ? void 0 : _d.htmlInput) == null ? void 0 : _e.readOnly) || ((_g = (_f = rest.slotProps) == null ? void 0 : _f.input) == null ? void 0 : _g.readOnly);
|
|
159
160
|
const resolvedProps = (props2) => !props2 || Object.keys(props2).length === 0 ? void 0 : props2;
|
|
160
161
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
161
162
|
import_TextField.default,
|
|
@@ -167,26 +168,27 @@ var TextField = (0, import_react3.forwardRef)((props, ref) => {
|
|
|
167
168
|
helperText: helperText || /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, {}),
|
|
168
169
|
slots: { formHelperText: TextFieldFormHelperText },
|
|
169
170
|
slotProps: {
|
|
170
|
-
input: resolvedProps(__spreadValues(__spreadValues(__spreadValues({}, InputProps2), import_mui_form_utils.InputPropOverrides), (
|
|
171
|
+
input: resolvedProps(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, InputProps2), import_mui_form_utils.InputPropOverrides), (_h = rest.slotProps) == null ? void 0 : _h.input), {
|
|
172
|
+
readOnly: allReadOnly
|
|
173
|
+
})),
|
|
171
174
|
htmlInput: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
|
|
172
175
|
"aria-required": required
|
|
173
|
-
}, inputProps), (
|
|
176
|
+
}, inputProps), (_i = rest.slotProps) == null ? void 0 : _i.htmlInput), {
|
|
174
177
|
maxLength: !displayOverflowMaxLength ? maxLength : void 0
|
|
175
178
|
})),
|
|
176
|
-
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, SelectProps2), import_mui_form_utils.SelectPropOverrides), (0, import_mui_form_utils.SelectAccessibilityOverrides)(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (
|
|
179
|
+
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, SelectProps2), import_mui_form_utils.SelectPropOverrides), (0, import_mui_form_utils.SelectAccessibilityOverrides)(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (_j = rest.slotProps) == null ? void 0 : _j.select)),
|
|
177
180
|
inputLabel: resolvedProps(__spreadValues(__spreadValues({
|
|
178
181
|
component: import_mui_form_utils.FormLabel,
|
|
179
182
|
helpTopicId,
|
|
180
183
|
required,
|
|
181
184
|
shrink: true
|
|
182
|
-
}, InputLabelProps), (
|
|
185
|
+
}, InputLabelProps), (_k = rest.slotProps) == null ? void 0 : _k.inputLabel)),
|
|
183
186
|
formHelperText: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
|
|
184
187
|
component: "div"
|
|
185
|
-
}, FormHelperTextProps2), (
|
|
188
|
+
}, FormHelperTextProps2), (_l = rest.slotProps) == null ? void 0 : _l.formHelperText), {
|
|
186
189
|
charCount,
|
|
187
190
|
helperText,
|
|
188
191
|
maxLength,
|
|
189
|
-
displayOverflowMaxLength,
|
|
190
192
|
showCharacterCount
|
|
191
193
|
}))
|
|
192
194
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -102,7 +102,7 @@ var TextFieldFormHelperText = (_a) => {
|
|
|
102
102
|
return /* @__PURE__ */ jsx6(FormHelperText, __spreadProps(__spreadValues({}, FormHelperTextProps2), { children: helperText }));
|
|
103
103
|
};
|
|
104
104
|
var TextField = forwardRef3((props, ref) => {
|
|
105
|
-
var _b, _c, _d, _e, _f, _g, _h;
|
|
105
|
+
var _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
106
106
|
const _a = props, {
|
|
107
107
|
InputProps: InputProps2,
|
|
108
108
|
helpTopicId,
|
|
@@ -129,6 +129,7 @@ var TextField = forwardRef3((props, ref) => {
|
|
|
129
129
|
const [openDetected, setOpenDetected] = useState(false);
|
|
130
130
|
const [charCount, setCharCount] = useState(0);
|
|
131
131
|
const maxLength = (inputProps == null ? void 0 : inputProps.maxLength) || ((_c = (_b = rest.slotProps) == null ? void 0 : _b.htmlInput) == null ? void 0 : _c.maxLength);
|
|
132
|
+
const allReadOnly = (InputProps2 == null ? void 0 : InputProps2.readOnly) || (inputProps == null ? void 0 : inputProps.readOnly) || ((_e = (_d = rest.slotProps) == null ? void 0 : _d.htmlInput) == null ? void 0 : _e.readOnly) || ((_g = (_f = rest.slotProps) == null ? void 0 : _f.input) == null ? void 0 : _g.readOnly);
|
|
132
133
|
const resolvedProps = (props2) => !props2 || Object.keys(props2).length === 0 ? void 0 : props2;
|
|
133
134
|
return /* @__PURE__ */ jsx6(
|
|
134
135
|
MuiTextField,
|
|
@@ -140,26 +141,27 @@ var TextField = forwardRef3((props, ref) => {
|
|
|
140
141
|
helperText: helperText || /* @__PURE__ */ jsx6(Fragment, {}),
|
|
141
142
|
slots: { formHelperText: TextFieldFormHelperText },
|
|
142
143
|
slotProps: {
|
|
143
|
-
input: resolvedProps(__spreadValues(__spreadValues(__spreadValues({}, InputProps2), InputPropOverrides), (
|
|
144
|
+
input: resolvedProps(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, InputProps2), InputPropOverrides), (_h = rest.slotProps) == null ? void 0 : _h.input), {
|
|
145
|
+
readOnly: allReadOnly
|
|
146
|
+
})),
|
|
144
147
|
htmlInput: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
|
|
145
148
|
"aria-required": required
|
|
146
|
-
}, inputProps), (
|
|
149
|
+
}, inputProps), (_i = rest.slotProps) == null ? void 0 : _i.htmlInput), {
|
|
147
150
|
maxLength: !displayOverflowMaxLength ? maxLength : void 0
|
|
148
151
|
})),
|
|
149
|
-
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, SelectProps2), SelectPropOverrides), SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (
|
|
152
|
+
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, SelectProps2), SelectPropOverrides), SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (_j = rest.slotProps) == null ? void 0 : _j.select)),
|
|
150
153
|
inputLabel: resolvedProps(__spreadValues(__spreadValues({
|
|
151
154
|
component: FormLabel,
|
|
152
155
|
helpTopicId,
|
|
153
156
|
required,
|
|
154
157
|
shrink: true
|
|
155
|
-
}, InputLabelProps), (
|
|
158
|
+
}, InputLabelProps), (_k = rest.slotProps) == null ? void 0 : _k.inputLabel)),
|
|
156
159
|
formHelperText: resolvedProps(__spreadProps(__spreadValues(__spreadValues({
|
|
157
160
|
component: "div"
|
|
158
|
-
}, FormHelperTextProps2), (
|
|
161
|
+
}, FormHelperTextProps2), (_l = rest.slotProps) == null ? void 0 : _l.formHelperText), {
|
|
159
162
|
charCount,
|
|
160
163
|
helperText,
|
|
161
164
|
maxLength,
|
|
162
|
-
displayOverflowMaxLength,
|
|
163
165
|
showCharacterCount
|
|
164
166
|
}))
|
|
165
167
|
},
|
package/package.json
CHANGED
|
@@ -63,12 +63,13 @@ export const _States: StoryObj<typeof TextField> = {
|
|
|
63
63
|
render: (args: TextFieldProps) => (
|
|
64
64
|
<Stack direction="row" spacing={1} sx={{ flexWrap: 'wrap' }}>
|
|
65
65
|
<TextField label="Default" id="default" {...args} />
|
|
66
|
-
<TextField label="Focused" id="
|
|
66
|
+
<TextField label="Focused" id="focused" focused {...args} />
|
|
67
67
|
<TextField label="Error" id="error" error {...args} />
|
|
68
|
+
<TextField label="Read Only" id="read-only" {...args} slotProps={{input: {readOnly: true}}}/>
|
|
68
69
|
<TextField label="Disabled" id="disabled" disabled {...args} />
|
|
69
70
|
</Stack>
|
|
70
71
|
),
|
|
71
|
-
args: { margin: 'normal' },
|
|
72
|
+
args: { margin: 'normal', value: 'value' },
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
export const _Sizes: StoryObj<typeof TextField> = {
|
package/src/lib/TextField.tsx
CHANGED
|
@@ -81,6 +81,10 @@ export const TextField = forwardRef<HTMLDivElement | HTMLInputElement, TextField
|
|
|
81
81
|
// @ts-expect-error I'm not sure why maxLength is undefined in htmlInput, but it works. There's something weird with the type.
|
|
82
82
|
const maxLength = inputProps?.maxLength || rest.slotProps?.htmlInput?.maxLength;
|
|
83
83
|
|
|
84
|
+
// @ts-expect-error More htmlInput type issues.
|
|
85
|
+
// slotProps.input is correct place to pass readOnly for class to be applied, but Autocomplete passes it through deprecated inputProps.
|
|
86
|
+
const allReadOnly = InputProps?.readOnly || inputProps?.readOnly || rest.slotProps?.htmlInput?.readOnly || rest.slotProps?.input?.readOnly
|
|
87
|
+
|
|
84
88
|
const resolvedProps = (props: Record<string, unknown>) =>
|
|
85
89
|
!props || Object.keys(props).length === 0 ? undefined : props;
|
|
86
90
|
|
|
@@ -94,7 +98,12 @@ export const TextField = forwardRef<HTMLDivElement | HTMLInputElement, TextField
|
|
|
94
98
|
helperText={helperText || <></>}
|
|
95
99
|
slots={{ formHelperText: TextFieldFormHelperText }}
|
|
96
100
|
slotProps={{
|
|
97
|
-
input: resolvedProps({
|
|
101
|
+
input: resolvedProps({
|
|
102
|
+
...InputProps,
|
|
103
|
+
...InputPropOverrides,
|
|
104
|
+
...rest.slotProps?.input,
|
|
105
|
+
readOnly: allReadOnly
|
|
106
|
+
}),
|
|
98
107
|
htmlInput: resolvedProps({
|
|
99
108
|
'aria-required': required,
|
|
100
109
|
...inputProps,
|
|
@@ -122,7 +131,6 @@ export const TextField = forwardRef<HTMLDivElement | HTMLInputElement, TextField
|
|
|
122
131
|
charCount,
|
|
123
132
|
helperText,
|
|
124
133
|
maxLength,
|
|
125
|
-
displayOverflowMaxLength,
|
|
126
134
|
showCharacterCount,
|
|
127
135
|
}),
|
|
128
136
|
}}
|