@availity/mui-datepicker 0.4.43 → 0.4.44

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,16 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.4.44](https://github.com/Availity/element/compare/@availity/mui-datepicker@0.4.43...@availity/mui-datepicker@0.4.44) (2024-10-18)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `theme-provider` updated to version `0.4.43`
10
+
11
+ ### Bug Fixes
12
+
13
+ * **mui-datepicker:** accessible dialog name and other updates ([6c530fe](https://github.com/Availity/element/commit/6c530fecf1051f32d72d4c113f29c86619299119))
14
+
5
15
  ## [0.4.43](https://github.com/Availity/element/compare/@availity/mui-datepicker@0.4.42...@availity/mui-datepicker@0.4.43) (2024-10-18)
6
16
 
7
17
  ### Dependency Updates
package/dist/index.d.mts CHANGED
@@ -10,7 +10,7 @@ type DatepickerProps = {
10
10
  * @default bottom-start
11
11
  */
12
12
  placement?: 'bottom-start' | 'bottom' | 'bottom-end';
13
- } & Omit<DatePickerProps<Dayjs, false>, 'components' | 'componentsProps' | 'desktopModeMediaQuery' | 'DialogProps' | 'OpenPickerButtonProps' | 'openTo' | 'orientation' | 'PaperProps' | 'PopperProps' | 'reduceAnimations' | 'renderInput' | 'rifmFormatter' | 'showToolbar' | 'ToolbarComponent' | 'toolbarFormat' | 'toolbarPlaceholder' | 'toolbarTitle' | 'TransitionComponent' | 'value'>;
13
+ } & Omit<DatePickerProps<Dayjs, false>, 'components' | 'componentsProps' | 'desktopModeMediaQuery' | 'DialogProps' | 'OpenPickerButtonProps' | 'openTo' | 'orientation' | 'PaperProps' | 'PopperProps' | 'reduceAnimations' | 'renderInput' | 'rifmFormatter' | 'showToolbar' | 'slots' | 'slotProps' | 'ToolbarComponent' | 'toolbarFormat' | 'toolbarPlaceholder' | 'toolbarTitle' | 'TransitionComponent' | 'value'>;
14
14
  declare const Datepicker: ({ FieldProps, placement, ...props }: DatepickerProps) => JSX.Element;
15
15
 
16
16
  export { Datepicker, type DatepickerProps };
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ type DatepickerProps = {
10
10
  * @default bottom-start
11
11
  */
12
12
  placement?: 'bottom-start' | 'bottom' | 'bottom-end';
13
- } & Omit<DatePickerProps<Dayjs, false>, 'components' | 'componentsProps' | 'desktopModeMediaQuery' | 'DialogProps' | 'OpenPickerButtonProps' | 'openTo' | 'orientation' | 'PaperProps' | 'PopperProps' | 'reduceAnimations' | 'renderInput' | 'rifmFormatter' | 'showToolbar' | 'ToolbarComponent' | 'toolbarFormat' | 'toolbarPlaceholder' | 'toolbarTitle' | 'TransitionComponent' | 'value'>;
13
+ } & Omit<DatePickerProps<Dayjs, false>, 'components' | 'componentsProps' | 'desktopModeMediaQuery' | 'DialogProps' | 'OpenPickerButtonProps' | 'openTo' | 'orientation' | 'PaperProps' | 'PopperProps' | 'reduceAnimations' | 'renderInput' | 'rifmFormatter' | 'showToolbar' | 'slots' | 'slotProps' | 'ToolbarComponent' | 'toolbarFormat' | 'toolbarPlaceholder' | 'toolbarTitle' | 'TransitionComponent' | 'value'>;
14
14
  declare const Datepicker: ({ FieldProps, placement, ...props }: DatepickerProps) => JSX.Element;
15
15
 
16
16
  export { Datepicker, type DatepickerProps };
package/dist/index.js CHANGED
@@ -55,30 +55,36 @@ module.exports = __toCommonJS(src_exports);
55
55
 
56
56
  // src/lib/Datepicker.tsx
57
57
  var import_mui_textfield = require("@availity/mui-textfield");
58
+ var import_mui_icon = require("@availity/mui-icon");
58
59
  var import_DatePicker = require("@mui/x-date-pickers/DatePicker");
59
60
  var import_jsx_runtime = require("react/jsx-runtime");
60
61
  var paperProps = { elevation: 8, variant: "elevation", sx: { marginTop: "4px" } };
61
- var PickerTextField = (params) => {
62
- if (params.inputProps) {
63
- params.inputProps.placeholder = "MM/DD/YYYY";
64
- }
65
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_textfield.TextField, __spreadValues({}, params));
66
- };
67
62
  var Datepicker = (_a) => {
68
63
  var _b = _a, { FieldProps, placement = "bottom-start" } = _b, props = __objRest(_b, ["FieldProps", "placement"]);
64
+ var _a2, _b2, _c, _d, _e, _f;
69
65
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
66
  import_DatePicker.DatePicker,
71
67
  __spreadProps(__spreadValues({}, props), {
68
+ dayOfWeekFormatter: (weekday) => weekday.format("dd"),
72
69
  slotProps: {
73
70
  desktopPaper: paperProps,
74
- mobilePaper: paperProps,
75
- textField: FieldProps,
71
+ mobilePaper: __spreadProps(__spreadValues({}, paperProps), {
72
+ "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
+ "aria-labelledby": ((_c = FieldProps == null ? void 0 : FieldProps.inputProps) == null ? void 0 : _c["aria-labelledby"]) || void 0
74
+ }),
76
75
  popper: {
77
- placement
78
- }
76
+ placement,
77
+ "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",
78
+ "aria-labelledby": ((_f = FieldProps == null ? void 0 : FieldProps.inputProps) == null ? void 0 : _f["aria-labelledby"]) || void 0
79
+ },
80
+ openPickerIcon: {
81
+ fontSize: "xsmall"
82
+ },
83
+ textField: FieldProps
79
84
  },
80
85
  slots: {
81
- textField: PickerTextField
86
+ openPickerIcon: import_mui_icon.CalendarDaysIcon,
87
+ textField: import_mui_textfield.TextField
82
88
  }
83
89
  })
84
90
  );
package/dist/index.mjs CHANGED
@@ -32,30 +32,36 @@ var __objRest = (source, exclude) => {
32
32
 
33
33
  // src/lib/Datepicker.tsx
34
34
  import { TextField } from "@availity/mui-textfield";
35
+ import { CalendarDaysIcon } from "@availity/mui-icon";
35
36
  import { DatePicker as MuiDatePicker } from "@mui/x-date-pickers/DatePicker";
36
37
  import { jsx } from "react/jsx-runtime";
37
38
  var paperProps = { elevation: 8, variant: "elevation", sx: { marginTop: "4px" } };
38
- var PickerTextField = (params) => {
39
- if (params.inputProps) {
40
- params.inputProps.placeholder = "MM/DD/YYYY";
41
- }
42
- return /* @__PURE__ */ jsx(TextField, __spreadValues({}, params));
43
- };
44
39
  var Datepicker = (_a) => {
45
40
  var _b = _a, { FieldProps, placement = "bottom-start" } = _b, props = __objRest(_b, ["FieldProps", "placement"]);
41
+ var _a2, _b2, _c, _d, _e, _f;
46
42
  return /* @__PURE__ */ jsx(
47
43
  MuiDatePicker,
48
44
  __spreadProps(__spreadValues({}, props), {
45
+ dayOfWeekFormatter: (weekday) => weekday.format("dd"),
49
46
  slotProps: {
50
47
  desktopPaper: paperProps,
51
- mobilePaper: paperProps,
52
- textField: FieldProps,
48
+ mobilePaper: __spreadProps(__spreadValues({}, paperProps), {
49
+ "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
+ "aria-labelledby": ((_c = FieldProps == null ? void 0 : FieldProps.inputProps) == null ? void 0 : _c["aria-labelledby"]) || void 0
51
+ }),
53
52
  popper: {
54
- placement
55
- }
53
+ placement,
54
+ "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",
55
+ "aria-labelledby": ((_f = FieldProps == null ? void 0 : FieldProps.inputProps) == null ? void 0 : _f["aria-labelledby"]) || void 0
56
+ },
57
+ openPickerIcon: {
58
+ fontSize: "xsmall"
59
+ },
60
+ textField: FieldProps
56
61
  },
57
62
  slots: {
58
- textField: PickerTextField
63
+ openPickerIcon: CalendarDaysIcon,
64
+ textField: TextField
59
65
  }
60
66
  })
61
67
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-datepicker",
3
- "version": "0.4.43",
3
+ "version": "0.4.44",
4
4
  "description": "Availity MUI Datepicker Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -32,6 +32,7 @@
32
32
  "publish:canary": "yarn npm publish --access public --tag canary"
33
33
  },
34
34
  "dependencies": {
35
+ "@availity/mui-icon": "0.10.1",
35
36
  "@availity/mui-textfield": "0.6.9",
36
37
  "@mui/x-date-pickers": "^7.2.0",
37
38
  "dayjs": "^1.11.10"
@@ -0,0 +1,25 @@
1
+ import { DateCalendar as MuiDateCalendar, DateCalendarProps as MuiDateCalendarProps } from '@mui/x-date-pickers/DateCalendar';
2
+ import type { Dayjs } from 'dayjs';
3
+ import type {} from '@mui/x-date-pickers/AdapterDayjs';
4
+
5
+ export type DateCalendarProps = Omit<MuiDateCalendarProps<Dayjs>,
6
+ | 'components'
7
+ | 'componentsProps'
8
+ | 'slots'
9
+ | 'slotProps'
10
+ | 'ToolbarComponent'
11
+ | 'toolbarFormat'
12
+ | 'toolbarPlaceholder'
13
+ | 'toolbarTitle'
14
+ | 'TransitionComponent'
15
+ >;
16
+
17
+ // just being used for stories atm, if ux finds a use for it we can add it to index.
18
+ export const DateCalendar = (props: DateCalendarProps): JSX.Element => {
19
+ return (
20
+ <MuiDateCalendar
21
+ {...props}
22
+ dayOfWeekFormatter = {(weekday: Dayjs) => weekday.format('dd')}
23
+ />
24
+ );
25
+ };
@@ -1,14 +1,14 @@
1
1
  // Each exported component in the package should have its own stories file
2
+ import { useState } from 'react';
2
3
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { DateCalendar } from '@mui/x-date-pickers/DateCalendar';
4
+ import Grid from '@mui/material/Unstable_Grid2';
5
+ import Paper from '@mui/material/Paper';
6
+ import Typography from '@mui/material/Typography';
4
7
  import { MonthCalendar } from '@mui/x-date-pickers/MonthCalendar';
5
8
  import { YearCalendar } from '@mui/x-date-pickers/YearCalendar';
6
- import { useState } from 'react';
7
9
  import dayjs, { Dayjs } from 'dayjs';
8
10
  import { Datepicker, DatepickerProps } from './Datepicker';
9
- import Grid from '@mui/material/Unstable_Grid2';
10
- import Paper from '@mui/material/Paper';
11
- import Typography from '@mui/material/Typography';
11
+ import { DateCalendar } from './DateCalendar';
12
12
 
13
13
  const meta: Meta<typeof Datepicker> = {
14
14
  title: 'Form Components/Datepicker/Datepicker',
@@ -42,7 +42,7 @@ export const _Datepicker: StoryObj<typeof Datepicker> = {
42
42
  },
43
43
  };
44
44
 
45
- export const _PickerViews: StoryObj<typeof Datepicker> = {
45
+ export const _PickerViews: StoryObj<typeof DateCalendar> = {
46
46
  render: () => {
47
47
  const minDate = dayjs('2020-01-01T00:00:00.000');
48
48
  const maxDate = dayjs('2034-01-01T00:00:00.000');
@@ -52,7 +52,7 @@ export const _PickerViews: StoryObj<typeof Datepicker> = {
52
52
  <Grid container spacing={3}>
53
53
  <Grid xs="auto">
54
54
  <Typography variant="h3" component="span">
55
- Day View
55
+ Default View
56
56
  </Typography>
57
57
  <Paper sx={{ width: 'min-content' }}>
58
58
  <DateCalendar value={date} onChange={(newDate) => setDate(newDate)} />
@@ -1,4 +1,5 @@
1
1
  import { TextField, TextFieldProps } from '@availity/mui-textfield';
2
+ import { CalendarDaysIcon } from '@availity/mui-icon';
2
3
  import { DatePicker as MuiDatePicker, DatePickerProps as MuiDatePickerProps } from '@mui/x-date-pickers/DatePicker';
3
4
  import type { Dayjs } from 'dayjs';
4
5
  import type {} from '@mui/x-date-pickers/AdapterDayjs';
@@ -26,6 +27,8 @@ export type DatepickerProps = {
26
27
  | 'renderInput'
27
28
  | 'rifmFormatter'
28
29
  | 'showToolbar'
30
+ | 'slots'
31
+ | 'slotProps'
29
32
  | 'ToolbarComponent'
30
33
  | 'toolbarFormat'
31
34
  | 'toolbarPlaceholder'
@@ -36,29 +39,33 @@ export type DatepickerProps = {
36
39
 
37
40
  const paperProps = { elevation: 8, variant: 'elevation', sx: { marginTop: '4px' } } as const;
38
41
 
39
- const PickerTextField = (params: TextFieldProps) => {
40
- if (params.inputProps) {
41
- params.inputProps.placeholder = 'MM/DD/YYYY';
42
- }
43
-
44
- return <TextField {...params} />;
45
- };
46
-
47
42
  export const Datepicker = ({ FieldProps, placement = 'bottom-start', ...props }: DatepickerProps): JSX.Element => {
48
43
  return (
49
44
  <MuiDatePicker
50
45
  {...props}
46
+ dayOfWeekFormatter = {(weekday: Dayjs) => weekday.format('dd')}
51
47
  slotProps={{
52
48
  desktopPaper: paperProps,
53
- mobilePaper: paperProps,
54
- textField: FieldProps,
49
+ mobilePaper: {
50
+ ...paperProps,
51
+ 'aria-label': FieldProps?.label?.toString() || FieldProps?.inputProps?.['aria-label'] || "Date picker",
52
+ 'aria-labelledby': FieldProps?.inputProps?.['aria-labelledby'] || undefined
53
+ },
55
54
  popper: {
56
55
  placement,
56
+ 'aria-label': FieldProps?.label?.toString() || FieldProps?.inputProps?.['aria-label'] || "Date picker",
57
+ 'aria-labelledby': FieldProps?.inputProps?.['aria-labelledby'] || undefined
58
+ },
59
+ openPickerIcon: {
60
+ fontSize: 'xsmall'
57
61
  },
62
+ textField: FieldProps,
58
63
  }}
59
64
  slots={{
60
- textField: PickerTextField,
65
+ openPickerIcon: CalendarDaysIcon,
66
+ textField: TextField,
61
67
  }}
68
+
62
69
  />
63
70
  );
64
71
  };