@availity/mui-textfield 1.1.3 → 1.1.4
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 +5 -0
- package/dist/index.js +1 -10
- package/dist/index.mjs +1 -10
- package/package.json +3 -2
- package/src/lib/TextField.stories.tsx +16 -1
- package/src/lib/TextField.test.tsx +0 -13
- package/src/lib/TextField.tsx +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.1.4](https://github.com/Availity/element/compare/@availity/mui-textfield@1.1.3...@availity/mui-textfield@1.1.4) (2025-04-09)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `mui-form-utils` updated to version `1.1.3`
|
|
5
10
|
## [1.1.3](https://github.com/Availity/element/compare/@availity/mui-textfield@1.1.2...@availity/mui-textfield@1.1.3) (2025-04-08)
|
|
6
11
|
|
|
7
12
|
### Dependency Updates
|
package/dist/index.js
CHANGED
|
@@ -103,13 +103,7 @@ var Typography = (0, import_react2.forwardRef)(
|
|
|
103
103
|
);
|
|
104
104
|
|
|
105
105
|
// src/lib/TextField.tsx
|
|
106
|
-
var import_styles = require("@mui/material/styles");
|
|
107
106
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
108
|
-
var SelectPlaceholder = (0, import_styles.styled)("span", {
|
|
109
|
-
name: "MuiTextField",
|
|
110
|
-
slot: "SelectPlaceholder",
|
|
111
|
-
overridesResolver: (props, styles) => styles.avFilled
|
|
112
|
-
})(({ theme }) => ({ opacity: 1, color: theme.palette.grey[400] }));
|
|
113
107
|
var TextFieldFormHelperText = (_a) => {
|
|
114
108
|
var _b = _a, {
|
|
115
109
|
charCount,
|
|
@@ -179,10 +173,7 @@ var TextField = (0, import_react3.forwardRef)((props, ref) => {
|
|
|
179
173
|
}, inputProps), (_e = rest.slotProps) == null ? void 0 : _e.htmlInput), {
|
|
180
174
|
maxLength: !displayOverflowMaxLength ? maxLength : void 0
|
|
181
175
|
})),
|
|
182
|
-
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
183
|
-
displayEmpty: !!rest.placeholder,
|
|
184
|
-
renderValue: (value) => rest.placeholder && (!value || Array.isArray(value) && value.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectPlaceholder, { className: "MuiSelect-placeholder", children: rest.placeholder }) : value
|
|
185
|
-
}, SelectProps2), import_mui_form_utils.SelectPropOverrides), (0, import_mui_form_utils.SelectAccessibilityOverrides)(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (_f = rest.slotProps) == null ? void 0 : _f.select)),
|
|
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)), (_f = rest.slotProps) == null ? void 0 : _f.select)),
|
|
186
177
|
inputLabel: resolvedProps(__spreadValues(__spreadValues({
|
|
187
178
|
component: import_mui_form_utils.FormLabel,
|
|
188
179
|
helpTopicId,
|
package/dist/index.mjs
CHANGED
|
@@ -76,13 +76,7 @@ var Typography = forwardRef2(
|
|
|
76
76
|
);
|
|
77
77
|
|
|
78
78
|
// src/lib/TextField.tsx
|
|
79
|
-
import { styled } from "@mui/material/styles";
|
|
80
79
|
import { Fragment, jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
81
|
-
var SelectPlaceholder = styled("span", {
|
|
82
|
-
name: "MuiTextField",
|
|
83
|
-
slot: "SelectPlaceholder",
|
|
84
|
-
overridesResolver: (props, styles) => styles.avFilled
|
|
85
|
-
})(({ theme }) => ({ opacity: 1, color: theme.palette.grey[400] }));
|
|
86
80
|
var TextFieldFormHelperText = (_a) => {
|
|
87
81
|
var _b = _a, {
|
|
88
82
|
charCount,
|
|
@@ -152,10 +146,7 @@ var TextField = forwardRef3((props, ref) => {
|
|
|
152
146
|
}, inputProps), (_e = rest.slotProps) == null ? void 0 : _e.htmlInput), {
|
|
153
147
|
maxLength: !displayOverflowMaxLength ? maxLength : void 0
|
|
154
148
|
})),
|
|
155
|
-
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
156
|
-
displayEmpty: !!rest.placeholder,
|
|
157
|
-
renderValue: (value) => rest.placeholder && (!value || Array.isArray(value) && value.length === 0) ? /* @__PURE__ */ jsx6(SelectPlaceholder, { className: "MuiSelect-placeholder", children: rest.placeholder }) : value
|
|
158
|
-
}, SelectProps2), SelectPropOverrides), SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (_f = rest.slotProps) == null ? void 0 : _f.select)),
|
|
149
|
+
select: resolvedProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, SelectProps2), SelectPropOverrides), SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps2 == null ? void 0 : SelectProps2.open)), (_f = rest.slotProps) == null ? void 0 : _f.select)),
|
|
159
150
|
inputLabel: resolvedProps(__spreadValues(__spreadValues({
|
|
160
151
|
component: FormLabel,
|
|
161
152
|
helpTopicId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-textfield",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Availity MUI Textfield Component - part of the @availity/element design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -40,10 +40,11 @@
|
|
|
40
40
|
"publish:canary": "yarn npm publish --access public --tag canary"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@availity/mui-form-utils": "1.1.
|
|
43
|
+
"@availity/mui-form-utils": "1.1.2",
|
|
44
44
|
"@availity/mui-icon": "1.0.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
+
"@availity/mui-typography": "1.0.1",
|
|
47
48
|
"@mui/material": "^6.4.5",
|
|
48
49
|
"react": "18.2.0",
|
|
49
50
|
"react-dom": "18.2.0",
|
|
@@ -10,6 +10,7 @@ import { FormControl, FormLabel, Input, InputAdornment, SelectChangeEvent } from
|
|
|
10
10
|
import { EyeIcon, EyeSlashIcon, SearchIcon } from '@availity/mui-icon';
|
|
11
11
|
import { Box, Grid, Stack } from '@availity/mui-layout';
|
|
12
12
|
import { MenuItem } from '@availity/mui-menu';
|
|
13
|
+
import { Typography } from '@availity/mui-typography';
|
|
13
14
|
|
|
14
15
|
import { TextField, TextFieldProps } from './TextField';
|
|
15
16
|
|
|
@@ -320,7 +321,21 @@ export const _SelectPlaceholder: StoryObj<typeof TextField> = {
|
|
|
320
321
|
</TextField>
|
|
321
322
|
);
|
|
322
323
|
},
|
|
323
|
-
args: {
|
|
324
|
+
args: {
|
|
325
|
+
label: 'Select',
|
|
326
|
+
slotProps: {
|
|
327
|
+
select: {
|
|
328
|
+
displayEmpty: true,
|
|
329
|
+
renderValue: (selected: string) => {
|
|
330
|
+
if (!selected) {
|
|
331
|
+
return <Typography color="text.placeholder">Placeholder</Typography>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return selected;
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
},
|
|
324
339
|
};
|
|
325
340
|
|
|
326
341
|
export const _MultiSelect: StoryObj<typeof TextField> = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { render, fireEvent } from '@testing-library/react';
|
|
2
|
-
import { MenuItem } from '@availity/mui-menu';
|
|
3
2
|
import { TextField } from './TextField';
|
|
4
3
|
|
|
5
4
|
describe('TextField', () => {
|
|
@@ -50,16 +49,4 @@ describe('TextField', () => {
|
|
|
50
49
|
expect(getByTitle('Error')).toBeTruthy();
|
|
51
50
|
});
|
|
52
51
|
});
|
|
53
|
-
describe('TextField select placeholder', () => {
|
|
54
|
-
test('should render select placeholder successfully', () => {
|
|
55
|
-
const { getByText } = render(
|
|
56
|
-
<TextField label="Test" select placeholder="Select...">
|
|
57
|
-
<MenuItem value={10}>10</MenuItem>
|
|
58
|
-
<MenuItem value={20}>20</MenuItem>
|
|
59
|
-
<MenuItem value={30}>30</MenuItem>
|
|
60
|
-
</TextField>
|
|
61
|
-
);
|
|
62
|
-
expect(getByText('Select...')).toBeTruthy();
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
52
|
});
|
package/src/lib/TextField.tsx
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
} from '@availity/mui-form-utils';
|
|
14
14
|
import { Grid } from '@availity/mui-layout';
|
|
15
15
|
import { Typography } from '@availity/mui-typography';
|
|
16
|
-
import { styled } from '@mui/material/styles';
|
|
17
16
|
|
|
18
17
|
export type TextFieldProps = {
|
|
19
18
|
FormHelperTextProps?: FormHelperTextProps;
|
|
@@ -29,12 +28,6 @@ export type TextFieldProps = {
|
|
|
29
28
|
} & Pick<FormLabelProps, 'helpTopicId'> &
|
|
30
29
|
Omit<MuiTextFieldProps, 'fullWidth' | 'variant'>;
|
|
31
30
|
|
|
32
|
-
const SelectPlaceholder = styled('span', {
|
|
33
|
-
name: 'MuiTextField',
|
|
34
|
-
slot: 'SelectPlaceholder',
|
|
35
|
-
overridesResolver: (props, styles) => styles.avFilled,
|
|
36
|
-
})(({ theme }) => ({ opacity: 1, color: theme.palette.grey[400] }));
|
|
37
|
-
|
|
38
31
|
export type TextFieldFormHelperTextProps = {
|
|
39
32
|
charCount: string;
|
|
40
33
|
helperText: string;
|
|
@@ -109,13 +102,6 @@ export const TextField = forwardRef<HTMLDivElement | HTMLInputElement, TextField
|
|
|
109
102
|
maxLength: !displayOverflowMaxLength ? maxLength : undefined,
|
|
110
103
|
}),
|
|
111
104
|
select: resolvedProps({
|
|
112
|
-
displayEmpty: !!rest.placeholder,
|
|
113
|
-
renderValue: (value: unknown) =>
|
|
114
|
-
rest.placeholder && (!value || (Array.isArray(value) && value.length === 0)) ? (
|
|
115
|
-
<SelectPlaceholder className="MuiSelect-placeholder">{rest.placeholder}</SelectPlaceholder>
|
|
116
|
-
) : (
|
|
117
|
-
value
|
|
118
|
-
),
|
|
119
105
|
...SelectProps,
|
|
120
106
|
...SelectPropOverrides,
|
|
121
107
|
...SelectAccessibilityOverrides(openDetected, setOpenDetected, SelectProps?.open),
|