@availity/mui-datepicker 0.6.2 → 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 +14 -0
- package/DateRangePickerDocs.md +2 -2
- package/dist/index.js +7 -6
- package/dist/index.mjs +4 -3
- package/package.json +7 -7
- package/src/lib/Datepicker.stories.tsx +3 -3
- package/src/lib/Datepicker.test.tsx +9 -0
- package/src/lib/Datepicker.tsx +4 -2
- /package/{DateRangePicker.stories.mdx → DateRangePicker.mdx} +0 -0
- /package/{introduction.stories.mdx → introduction.mdx} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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-datepicker@0.6.2...@availity/mui-datepicker@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
|
+
|
|
5
19
|
## [0.6.2](https://github.com/Availity/element/compare/@availity/mui-datepicker@0.6.1...@availity/mui-datepicker@0.6.2) (2025-02-18)
|
|
6
20
|
|
|
7
21
|
### Dependency Updates
|
package/DateRangePickerDocs.md
CHANGED
|
@@ -46,7 +46,7 @@ const DateRangePicker = ({
|
|
|
46
46
|
return (
|
|
47
47
|
<>
|
|
48
48
|
<Grid container spacing={2}>
|
|
49
|
-
<Grid
|
|
49
|
+
<Grid size={{xs: 12, sm: 6}}>
|
|
50
50
|
<Datepicker
|
|
51
51
|
value={startDate}
|
|
52
52
|
onChange={onStartDateChange}
|
|
@@ -55,7 +55,7 @@ const DateRangePicker = ({
|
|
|
55
55
|
views={['day', 'month', 'year']}
|
|
56
56
|
/>
|
|
57
57
|
</Grid>
|
|
58
|
-
<Grid
|
|
58
|
+
<Grid size={{xs: 12, sm: 6}}>
|
|
59
59
|
<Datepicker
|
|
60
60
|
value={endDate}
|
|
61
61
|
onChange={onEndDateChange}
|
package/dist/index.js
CHANGED
|
@@ -47,11 +47,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
47
47
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
48
|
|
|
49
49
|
// src/index.ts
|
|
50
|
-
var
|
|
51
|
-
__export(
|
|
50
|
+
var index_exports = {};
|
|
51
|
+
__export(index_exports, {
|
|
52
52
|
Datepicker: () => Datepicker
|
|
53
53
|
});
|
|
54
|
-
module.exports = __toCommonJS(
|
|
54
|
+
module.exports = __toCommonJS(index_exports);
|
|
55
55
|
|
|
56
56
|
// src/lib/Datepicker.tsx
|
|
57
57
|
var import_mui_textfield = require("@availity/mui-textfield");
|
|
@@ -59,6 +59,7 @@ var import_mui_icon = require("@availity/mui-icon");
|
|
|
59
59
|
var import_DatePicker = require("@mui/x-date-pickers/DatePicker");
|
|
60
60
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
61
61
|
var paperProps = { elevation: 8, variant: "elevation", sx: { marginTop: "4px" } };
|
|
62
|
+
var PickerTextField = (params) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_textfield.TextField, __spreadProps(__spreadValues({}, params), { placeholder: "MM/DD/YYYY" }));
|
|
62
63
|
var Datepicker = (_a) => {
|
|
63
64
|
var _b = _a, { FieldProps, placement = "bottom-start" } = _b, props = __objRest(_b, ["FieldProps", "placement"]);
|
|
64
65
|
var _a2, _b2, _c, _d, _e, _f;
|
|
@@ -72,6 +73,7 @@ var Datepicker = (_a) => {
|
|
|
72
73
|
"aria-label": ((_a2 = FieldProps == null ? void 0 : FieldProps.label) == null ? void 0 : _a2.toString()) || ((_b2 = FieldProps == null ? void 0 : FieldProps.inputProps) == null ? void 0 : _b2["aria-label"]) || "Date picker",
|
|
73
74
|
"aria-labelledby": ((_c = FieldProps == null ? void 0 : FieldProps.inputProps) == null ? void 0 : _c["aria-labelledby"]) || void 0
|
|
74
75
|
}),
|
|
76
|
+
textField: FieldProps,
|
|
75
77
|
popper: {
|
|
76
78
|
placement,
|
|
77
79
|
"aria-label": ((_d = FieldProps == null ? void 0 : FieldProps.label) == null ? void 0 : _d.toString()) || ((_e = FieldProps == null ? void 0 : FieldProps.inputProps) == null ? void 0 : _e["aria-label"]) || "Date picker",
|
|
@@ -79,12 +81,11 @@ var Datepicker = (_a) => {
|
|
|
79
81
|
},
|
|
80
82
|
openPickerIcon: {
|
|
81
83
|
fontSize: "xsmall"
|
|
82
|
-
}
|
|
83
|
-
textField: FieldProps
|
|
84
|
+
}
|
|
84
85
|
},
|
|
85
86
|
slots: {
|
|
86
87
|
openPickerIcon: import_mui_icon.CalendarDaysIcon,
|
|
87
|
-
textField:
|
|
88
|
+
textField: PickerTextField
|
|
88
89
|
}
|
|
89
90
|
})
|
|
90
91
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -36,6 +36,7 @@ import { CalendarDaysIcon } from "@availity/mui-icon";
|
|
|
36
36
|
import { DatePicker as MuiDatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
37
37
|
import { jsx } from "react/jsx-runtime";
|
|
38
38
|
var paperProps = { elevation: 8, variant: "elevation", sx: { marginTop: "4px" } };
|
|
39
|
+
var PickerTextField = (params) => /* @__PURE__ */ jsx(TextField, __spreadProps(__spreadValues({}, params), { placeholder: "MM/DD/YYYY" }));
|
|
39
40
|
var Datepicker = (_a) => {
|
|
40
41
|
var _b = _a, { FieldProps, placement = "bottom-start" } = _b, props = __objRest(_b, ["FieldProps", "placement"]);
|
|
41
42
|
var _a2, _b2, _c, _d, _e, _f;
|
|
@@ -49,6 +50,7 @@ var Datepicker = (_a) => {
|
|
|
49
50
|
"aria-label": ((_a2 = FieldProps == null ? void 0 : FieldProps.label) == null ? void 0 : _a2.toString()) || ((_b2 = FieldProps == null ? void 0 : FieldProps.inputProps) == null ? void 0 : _b2["aria-label"]) || "Date picker",
|
|
50
51
|
"aria-labelledby": ((_c = FieldProps == null ? void 0 : FieldProps.inputProps) == null ? void 0 : _c["aria-labelledby"]) || void 0
|
|
51
52
|
}),
|
|
53
|
+
textField: FieldProps,
|
|
52
54
|
popper: {
|
|
53
55
|
placement,
|
|
54
56
|
"aria-label": ((_d = FieldProps == null ? void 0 : FieldProps.label) == null ? void 0 : _d.toString()) || ((_e = FieldProps == null ? void 0 : FieldProps.inputProps) == null ? void 0 : _e["aria-label"]) || "Date picker",
|
|
@@ -56,12 +58,11 @@ var Datepicker = (_a) => {
|
|
|
56
58
|
},
|
|
57
59
|
openPickerIcon: {
|
|
58
60
|
fontSize: "xsmall"
|
|
59
|
-
}
|
|
60
|
-
textField: FieldProps
|
|
61
|
+
}
|
|
61
62
|
},
|
|
62
63
|
slots: {
|
|
63
64
|
openPickerIcon: CalendarDaysIcon,
|
|
64
|
-
textField:
|
|
65
|
+
textField: PickerTextField
|
|
65
66
|
}
|
|
66
67
|
})
|
|
67
68
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-datepicker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
4
|
"description": "Availity MUI Datepicker Component - part of the @availity/element design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -40,20 +40,20 @@
|
|
|
40
40
|
"publish:canary": "yarn npm publish --access public --tag canary"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@availity/mui-icon": "0.
|
|
44
|
-
"@availity/mui-textfield": "0.
|
|
45
|
-
"@mui/x-date-pickers": "^7.
|
|
43
|
+
"@availity/mui-icon": "1.0.0-alpha.0",
|
|
44
|
+
"@availity/mui-textfield": "1.0.0-alpha.0",
|
|
45
|
+
"@mui/x-date-pickers": "^7.26.0",
|
|
46
46
|
"dayjs": "^1.11.13"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@mui/material": "^
|
|
49
|
+
"@mui/material": "^6.4.5",
|
|
50
50
|
"react": "18.2.0",
|
|
51
51
|
"react-dom": "18.2.0",
|
|
52
|
-
"tsup": "^8.
|
|
52
|
+
"tsup": "^8.3.6",
|
|
53
53
|
"typescript": "^5.4.5"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mui/material": "^
|
|
56
|
+
"@mui/material": "^6.4.5",
|
|
57
57
|
"react": ">=16.3.0"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
@@ -109,7 +109,7 @@ export const _PickerViews: StoryObj<typeof DateCalendar> = {
|
|
|
109
109
|
|
|
110
110
|
return (
|
|
111
111
|
<Grid container spacing={3}>
|
|
112
|
-
<Grid xs
|
|
112
|
+
<Grid size={{ xs: 'auto' }}>
|
|
113
113
|
<Typography variant="h3" component="span">
|
|
114
114
|
Default View
|
|
115
115
|
</Typography>
|
|
@@ -117,7 +117,7 @@ export const _PickerViews: StoryObj<typeof DateCalendar> = {
|
|
|
117
117
|
<DateCalendar value={date} onChange={(newDate) => setDate(newDate)} />
|
|
118
118
|
</Paper>
|
|
119
119
|
</Grid>
|
|
120
|
-
<Grid xs
|
|
120
|
+
<Grid size={{ xs: 'auto' }}>
|
|
121
121
|
<Typography variant="h3" component="span">
|
|
122
122
|
Month View
|
|
123
123
|
</Typography>
|
|
@@ -125,7 +125,7 @@ export const _PickerViews: StoryObj<typeof DateCalendar> = {
|
|
|
125
125
|
<MonthCalendar value={date} minDate={minDate} maxDate={maxDate} onChange={(newDate) => setDate(newDate)} />
|
|
126
126
|
</Paper>
|
|
127
127
|
</Grid>
|
|
128
|
-
<Grid xs
|
|
128
|
+
<Grid size={{ xs: 'auto' }}>
|
|
129
129
|
<Typography variant="h3" component="span">
|
|
130
130
|
Year View
|
|
131
131
|
</Typography>
|
|
@@ -11,4 +11,13 @@ describe('Datepicker', () => {
|
|
|
11
11
|
);
|
|
12
12
|
expect(getAllByText('Test')).toBeTruthy();
|
|
13
13
|
});
|
|
14
|
+
|
|
15
|
+
test('should render placeholder successfully', () => {
|
|
16
|
+
const { container } = render(
|
|
17
|
+
<ThemeProvider>
|
|
18
|
+
<Datepicker FieldProps={{ InputProps: { placeholder: 'InputProps' } }} onChange={jest.fn()} value={null} />
|
|
19
|
+
</ThemeProvider>
|
|
20
|
+
);
|
|
21
|
+
expect(container.getElementsByClassName('MuiInputBase-input')[0].getAttribute('placeholder')).toBe('InputProps');
|
|
22
|
+
});
|
|
14
23
|
});
|
package/src/lib/Datepicker.tsx
CHANGED
|
@@ -39,6 +39,8 @@ export type DatepickerProps = {
|
|
|
39
39
|
|
|
40
40
|
const paperProps = { elevation: 8, variant: 'elevation', sx: { marginTop: '4px' } } as const;
|
|
41
41
|
|
|
42
|
+
const PickerTextField = (params: TextFieldProps) => <TextField {...params} placeholder="MM/DD/YYYY" />;
|
|
43
|
+
|
|
42
44
|
export const Datepicker = ({ FieldProps, placement = 'bottom-start', ...props }: DatepickerProps): JSX.Element => {
|
|
43
45
|
return (
|
|
44
46
|
<MuiDatePicker
|
|
@@ -51,6 +53,7 @@ export const Datepicker = ({ FieldProps, placement = 'bottom-start', ...props }:
|
|
|
51
53
|
'aria-label': FieldProps?.label?.toString() || FieldProps?.inputProps?.['aria-label'] || 'Date picker',
|
|
52
54
|
'aria-labelledby': FieldProps?.inputProps?.['aria-labelledby'] || undefined,
|
|
53
55
|
},
|
|
56
|
+
textField: FieldProps,
|
|
54
57
|
popper: {
|
|
55
58
|
placement,
|
|
56
59
|
'aria-label': FieldProps?.label?.toString() || FieldProps?.inputProps?.['aria-label'] || 'Date picker',
|
|
@@ -59,11 +62,10 @@ export const Datepicker = ({ FieldProps, placement = 'bottom-start', ...props }:
|
|
|
59
62
|
openPickerIcon: {
|
|
60
63
|
fontSize: 'xsmall',
|
|
61
64
|
},
|
|
62
|
-
textField: FieldProps,
|
|
63
65
|
}}
|
|
64
66
|
slots={{
|
|
65
67
|
openPickerIcon: CalendarDaysIcon,
|
|
66
|
-
textField:
|
|
68
|
+
textField: PickerTextField,
|
|
67
69
|
}}
|
|
68
70
|
/>
|
|
69
71
|
);
|
|
File without changes
|
|
File without changes
|