pcm-shared-components 2.0.171 → 2.0.173

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.
@@ -1,10 +1,10 @@
1
- import React from 'react';
1
+ // import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { orange } from '@mui/material/colors';
3
+ // import { orange } from '@mui/material/colors';
4
4
  import { Datepicker } from '@datepicker-react/styled';
5
5
  import { ThemeProvider } from 'styled-components';
6
6
  import './css/style.css';
7
- import { calendarTheme } from '../common/theme';
7
+ import { commonCalendarTheme } from '../common/theme';
8
8
 
9
9
  /**
10
10
  * example with styling https://codesandbox.io/s/react-date-picker-rangeinput-jw726?from-embed=&file=/src/index.js:2503-2537
@@ -35,7 +35,9 @@ export const DateCalendar = props => {
35
35
  variant,
36
36
  vertical,
37
37
  zIndex,
38
- i18next
38
+ i18next,
39
+ daySize,
40
+ datepickerPadding
39
41
  } = props;
40
42
  const handleOnDayRender = date => {
41
43
  return /*#__PURE__*/React.createElement(React.Fragment, null, onDayRender ? /*#__PURE__*/React.createElement(React.Fragment, null, onDayRender(date)) : /*#__PURE__*/React.createElement("span", {
@@ -70,13 +72,14 @@ export const DateCalendar = props => {
70
72
  console.error(error);
71
73
  }
72
74
  };
75
+ const overrideCalendarTheme = {};
73
76
  return /*#__PURE__*/React.createElement("div", {
74
77
  className: `m-auto pt-0 md:pt-0 ${variant === 'standard' ? 'bottom_border' : undefined}`,
75
78
  style: {
76
79
  zIndex: 100
77
80
  }
78
81
  }, /*#__PURE__*/React.createElement(ThemeProvider, {
79
- theme: calendarTheme({
82
+ theme: commonCalendarTheme({
80
83
  ...props
81
84
  })
82
85
  }, /*#__PURE__*/React.createElement(Datepicker, {
@@ -128,7 +131,9 @@ DateCalendar.defaultProps = {
128
131
  variant: 'standard',
129
132
  vertical: false,
130
133
  zIndex: 1000,
131
- i18next: undefined
134
+ i18next: undefined,
135
+ daySize: 40,
136
+ datepickerPadding: 25
132
137
  };
133
138
  DateCalendar.propTypes = {
134
139
  /** Used to provide the minimum booking date. To allow date selection past todays date simply pas it an old past date example 'new Date('1999-10-02')' */
@@ -160,5 +165,9 @@ DateCalendar.propTypes = {
160
165
  /** Controls the z-index of the calendar dropdown date selection */
161
166
  zIndex: PropTypes.number,
162
167
  /** i18next localization to use for the component. Don't use the library localization or else it won't load properly on the consuming application */
163
- i18next: PropTypes.any
168
+ i18next: PropTypes.any,
169
+ /** Controls the size of the day in the calendar */
170
+ daySize: PropTypes.oneOf([PropTypes.instanceOf(Number), PropTypes.instanceOf(Array)]),
171
+ /** Controls the padding of the datepicker */
172
+ datepickerPadding: PropTypes.number
164
173
  };
@@ -51,7 +51,9 @@ const DateCalendarComp = props => {
51
51
  endDate: state.endDate,
52
52
  focusedInput: state.focusedInput,
53
53
  minBookingDays: 2,
54
- i18next: i18next
54
+ i18next: i18next,
55
+ daySize: 40,
56
+ datepickerPadding: 25
55
57
  }, props));
56
58
  };
57
59
  export default {
@@ -70,5 +72,7 @@ export const DateCalendarExample = DateCalendarTemplate.bind({});
70
72
  DateCalendarExample.args = {
71
73
  Help: 'Note not all props listed see docs for full list...',
72
74
  variant: 'standard',
73
- numberOfMonthsVisible: 2
75
+ numberOfMonthsVisible: 2,
76
+ daySize: 40,
77
+ datepickerPadding: 25
74
78
  };
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import { orange } from '@mui/material/colors';
4
4
  import { DateRangeInput } from '@datepicker-react/styled';
5
5
  import { ThemeProvider } from 'styled-components';
6
- import { calendarTheme } from '../common/theme';
6
+ import { commonCalendarTheme } from '../common/theme';
7
7
  import './css/style.css';
8
8
 
9
9
  /**
@@ -73,7 +73,7 @@ export const DateRangeCalendar = props => {
73
73
  zIndex: 100
74
74
  }
75
75
  }, /*#__PURE__*/React.createElement(ThemeProvider, {
76
- theme: calendarTheme({
76
+ theme: commonCalendarTheme({
77
77
  ...props
78
78
  })
79
79
  }, /*#__PURE__*/React.createElement(DateRangeInput, {
@@ -1,12 +1,14 @@
1
1
  import { orange } from '@mui/material/colors';
2
- export const calendarTheme = ({
2
+ export const commonCalendarTheme = ({
3
3
  variant = 'outlined',
4
- zIndex = 1000
4
+ zIndex = 1000,
5
+ daySize = [36, 40],
6
+ datepickerPadding = 25
5
7
  }) => {
6
8
  return {
7
9
  breakpoints: ['32em', '48em', '64em'],
8
10
  reactDatepicker: {
9
- daySize: [36, 40],
11
+ daySize: daySize,
10
12
  fontFamily: 'system-ui, -apple-system',
11
13
  colors: {
12
14
  primaryColor: orange[900],
@@ -28,7 +30,8 @@ export const calendarTheme = ({
28
30
  datepickerZIndex: zIndex,
29
31
  dateRangeZIndex: zIndex,
30
32
  dateSingleZIndex: zIndex,
31
- dayAccessibilityBorderColor: "none"
33
+ dayAccessibilityBorderColor: "none",
34
+ datepickerPadding: datepickerPadding
32
35
  }
33
36
  };
34
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pcm-shared-components",
3
- "version": "2.0.171",
3
+ "version": "2.0.173",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "babel": {