@synerise/ds-date-picker 0.9.7 → 0.9.9

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
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.9.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.9.8...@synerise/ds-date-picker@0.9.9) (2023-04-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **date-picker:** fixes rendering monthpicker using locale ([f69eb08](https://github.com/Synerise/synerise-design/commit/f69eb08c3a08da4e3aa0ee2e6f24a8c1adc200f4))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.9.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.9.7...@synerise/ds-date-picker@0.9.8) (2023-04-19)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-date-picker
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.9.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.9.6...@synerise/ds-date-picker@0.9.7) (2023-04-17)
7
26
 
8
27
 
@@ -1,9 +1,8 @@
1
1
  import * as React from 'react';
2
- import { MonthPickerProps, MonthPickerState } from './MonthPicker.types';
3
- export default class MonthPicker extends React.PureComponent<MonthPickerProps, MonthPickerState> {
4
- state: MonthPickerState;
5
- getSnapshotBeforeUpdate(prevProps: Readonly<MonthPickerProps>): null;
6
- handleLongPrev: () => void;
7
- handleLongNext: () => void;
8
- render(): React.ReactNode;
9
- }
2
+ import { MonthPickerProps } from './MonthPicker.types';
3
+ declare const _default: React.ForwardRefExoticComponent<Pick<MonthPickerProps, "max" | "min" | "onChange" | "value"> & {
4
+ forwardedRef?: ((instance: any) => void) | React.RefObject<any> | null | undefined;
5
+ } & React.RefAttributes<any>> & {
6
+ WrappedComponent: React.ComponentType<MonthPickerProps>;
7
+ };
8
+ export default _default;
@@ -5,6 +5,7 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.crea
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import * as React from 'react';
8
+ import { injectIntl } from 'react-intl';
8
9
  import { range } from 'lodash';
9
10
  import { legacyParse } from '@date-fns/upgrade/v2';
10
11
  import { fnsStartOfMonth, fnsEndOfMonth, fnsSetMonth, fnsIsBefore, fnsAddYears, fnsIsAfter, fnsIsSameMonth } from '../../fns';
@@ -20,14 +21,14 @@ function getInitialState(props) {
20
21
  };
21
22
  }
22
23
 
23
- function getCells(cursor, min, max) {
24
+ function getCells(cursor, min, max, locale) {
24
25
  var minDate = min ? fnsStartOfMonth(min) : fnsSetMonth(cursor, 0);
25
26
  var maxDate = max ? fnsEndOfMonth(max) : fnsSetMonth(cursor, 12);
26
27
  return range(0, 12).map(function (index) {
27
28
  var date = fnsSetMonth(cursor, index);
28
29
  return {
29
30
  key: date.toISOString(),
30
- text: fnsFormat(date, 'MMM'),
31
+ text: fnsFormat(date, 'MMM', locale),
31
32
  disabled: fnsIsAfter(date, maxDate) || fnsIsBefore(date, minDate)
32
33
  };
33
34
  });
@@ -88,8 +89,9 @@ var MonthPicker = /*#__PURE__*/function (_React$PureComponent) {
88
89
  min = _this$props.min,
89
90
  max = _this$props.max,
90
91
  value = _this$props.value,
92
+ intl = _this$props.intl,
91
93
  onChange = _this$props.onChange;
92
- var cells = getCells(cursor, min, max);
94
+ var cells = getCells(cursor, min, max, intl == null ? void 0 : intl.locale);
93
95
  var valueCell = value ? cells.find(function (cell) {
94
96
  return fnsIsSameMonth(value, legacyParse(cell.key));
95
97
  }) : null;
@@ -130,4 +132,4 @@ var MonthPicker = /*#__PURE__*/function (_React$PureComponent) {
130
132
  return MonthPicker;
131
133
  }(React.PureComponent);
132
134
 
133
- export { MonthPicker as default };
135
+ export default injectIntl(MonthPicker);
@@ -1,8 +1,10 @@
1
+ import { IntlShape } from 'react-intl';
1
2
  export declare type MonthPickerProps = {
2
3
  min?: Date;
3
4
  max?: Date;
4
5
  value: Date;
5
6
  onChange: (date: Date) => void;
7
+ intl: IntlShape;
6
8
  };
7
9
  export declare type MonthPickerState = {
8
10
  cursor: Date;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-date-picker",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "DatePicker UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,11 +33,11 @@
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
35
  "@date-fns/upgrade": "^1.0.3",
36
- "@synerise/ds-button": "^0.17.12",
37
- "@synerise/ds-core": "^0.39.7",
38
- "@synerise/ds-icon": "^0.54.0",
39
- "@synerise/ds-time-picker": "^0.7.5",
40
- "@synerise/ds-tooltip": "^0.13.0",
36
+ "@synerise/ds-button": "^0.17.14",
37
+ "@synerise/ds-core": "^0.39.8",
38
+ "@synerise/ds-icon": "^0.56.0",
39
+ "@synerise/ds-time-picker": "^0.7.7",
40
+ "@synerise/ds-tooltip": "^0.13.2",
41
41
  "classnames": "^2.2.6",
42
42
  "date-fns": "2.16.1",
43
43
  "lodash": "^4.17.20",
@@ -48,5 +48,5 @@
48
48
  "@synerise/ds-core": "*",
49
49
  "react": ">=16.9.0 < 17.0.0"
50
50
  },
51
- "gitHead": "7e4f888ca6bd6fe09c94cccedd7ff9bd5985dc4d"
51
+ "gitHead": "41163901b144e78a83329029519cb9eb48bf4787"
52
52
  }