@synerise/ds-date-picker 0.13.9 → 0.14.1
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 +19 -0
- package/dist/DatePicker.js +1 -0
- package/dist/Elements/DecadePicker/DecadePicker.js +7 -10
- package/dist/Elements/GridPicker/GridPicker.js +4 -7
- package/dist/Elements/MonthPicker/MonthPicker.js +5 -8
- package/dist/Elements/PickerInput/PickerInput.js +1 -6
- package/dist/Elements/PickerInput/PickerInput.styles.d.ts +2 -1
- package/dist/Elements/TimePicker/TimePicker.js +4 -7
- package/dist/Elements/TimePicker/TimePicker.styles.d.ts +0 -9
- package/dist/Elements/TimePicker/TimePicker.styles.js +1 -6
- package/dist/Elements/YearPicker/YearPicker.js +7 -10
- package/dist/RawDatePicker/RawDatePicker.js +28 -31
- package/dist/index.d.ts +1 -0
- package/dist/localeUtils.js +2 -6
- package/dist/modules.d.js +1 -1
- package/dist/utils/getDefaultTexts.js +2 -6
- package/package.json +13 -13
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.14.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.14.0...@synerise/ds-date-picker@0.14.1) (2025-02-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-date-picker
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.14.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.13.9...@synerise/ds-date-picker@0.14.0) (2025-01-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* antd@4.24 react@18 ([d97a667](https://github.com/Synerise/synerise-design/commit/d97a667b1f33aed3177e1851de3b6f60be2d46a6))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.13.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.13.8...@synerise/ds-date-picker@0.13.9) (2025-01-21)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-date-picker
|
package/dist/DatePicker.js
CHANGED
|
@@ -85,6 +85,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
85
85
|
}));
|
|
86
86
|
return readOnly ? trigger : /*#__PURE__*/React.createElement(Dropdown, _extends({
|
|
87
87
|
overlay: /*#__PURE__*/React.createElement(S.OverlayContainer, {
|
|
88
|
+
"data-testid": "date-picker-overlay-container",
|
|
88
89
|
ref: ref
|
|
89
90
|
}, /*#__PURE__*/React.createElement(RawDatePicker, _extends({}, rest, {
|
|
90
91
|
showTime: showTime,
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
2
2
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
3
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
3
|
import React from 'react';
|
|
7
4
|
import { range } from 'lodash';
|
|
8
5
|
import { legacyParse } from '@date-fns/upgrade/v2';
|
|
@@ -32,20 +29,20 @@ var DecadePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
32
29
|
args[_key] = arguments[_key];
|
|
33
30
|
}
|
|
34
31
|
_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
_this.state = getInitialState(_this.props);
|
|
33
|
+
_this.handleLongPrev = function () {
|
|
37
34
|
var cursor = _this.state.cursor;
|
|
38
35
|
_this.setState({
|
|
39
36
|
cursor: fnsAddYears(cursor, -100)
|
|
40
37
|
});
|
|
41
|
-
}
|
|
42
|
-
|
|
38
|
+
};
|
|
39
|
+
_this.handleLongNext = function () {
|
|
43
40
|
var cursor = _this.state.cursor;
|
|
44
41
|
_this.setState({
|
|
45
42
|
cursor: fnsAddYears(cursor, 100)
|
|
46
43
|
});
|
|
47
|
-
}
|
|
48
|
-
|
|
44
|
+
};
|
|
45
|
+
_this.handleCellClick = function (isoDate) {
|
|
49
46
|
var onChange = _this.props.onChange;
|
|
50
47
|
if (isoDate === -1) {
|
|
51
48
|
_this.handleLongPrev();
|
|
@@ -56,7 +53,7 @@ var DecadePicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
56
53
|
return;
|
|
57
54
|
}
|
|
58
55
|
onChange && onChange(new Date(isoDate));
|
|
59
|
-
}
|
|
56
|
+
};
|
|
60
57
|
return _this;
|
|
61
58
|
}
|
|
62
59
|
_inheritsLoose(DecadePicker, _React$PureComponent);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
2
2
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
3
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
3
|
import React from 'react';
|
|
7
4
|
import classNames from 'classnames';
|
|
8
5
|
import * as S from './GridPicker.styles';
|
|
@@ -13,12 +10,12 @@ var GridPicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
13
10
|
args[_key] = arguments[_key];
|
|
14
11
|
}
|
|
15
12
|
_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
|
|
16
|
-
|
|
13
|
+
_this.handleCellClick = function (cell) {
|
|
17
14
|
if (cell.disabled) return;
|
|
18
15
|
var onCellClick = _this.props.onCellClick;
|
|
19
16
|
onCellClick && onCellClick(cell.key);
|
|
20
|
-
}
|
|
21
|
-
|
|
17
|
+
};
|
|
18
|
+
_this.renderCell = function (cell) {
|
|
22
19
|
var selectedKey = _this.props.selectedKey;
|
|
23
20
|
var key = cell.key,
|
|
24
21
|
text = cell.text,
|
|
@@ -38,7 +35,7 @@ var GridPicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
38
35
|
}, /*#__PURE__*/React.createElement("div", {
|
|
39
36
|
className: "cell-content"
|
|
40
37
|
}, text));
|
|
41
|
-
}
|
|
38
|
+
};
|
|
42
39
|
return _this;
|
|
43
40
|
}
|
|
44
41
|
_inheritsLoose(GridPicker, _React$PureComponent);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
2
2
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
3
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
3
|
import React from 'react';
|
|
7
4
|
import { injectIntl } from 'react-intl';
|
|
8
5
|
import { range } from 'lodash';
|
|
@@ -37,19 +34,19 @@ var MonthPicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
37
34
|
args[_key] = arguments[_key];
|
|
38
35
|
}
|
|
39
36
|
_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
_this.state = getInitialState(_this.props);
|
|
38
|
+
_this.handleLongPrev = function () {
|
|
42
39
|
var cursor = _this.state.cursor;
|
|
43
40
|
_this.setState({
|
|
44
41
|
cursor: fnsAddYears(cursor, -1)
|
|
45
42
|
});
|
|
46
|
-
}
|
|
47
|
-
|
|
43
|
+
};
|
|
44
|
+
_this.handleLongNext = function () {
|
|
48
45
|
var cursor = _this.state.cursor;
|
|
49
46
|
_this.setState({
|
|
50
47
|
cursor: fnsAddYears(cursor, 1)
|
|
51
48
|
});
|
|
52
|
-
}
|
|
49
|
+
};
|
|
53
50
|
return _this;
|
|
54
51
|
}
|
|
55
52
|
_inheritsLoose(MonthPicker, _React$PureComponent);
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
var _excluded = ["autoFocus", "size", "disabled", "readOnly", "value", "format", "valueFormatOptions", "onChange", "showTime", "placeholder", "onClear", "onClick", "clearTooltip", "highlight", "error", "errorText", "prefixel", "suffixel", "allowClear"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
4
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
10
5
|
import Icon, { CalendarM, Close3S } from '@synerise/ds-icon';
|
|
@@ -47,7 +42,7 @@ var PickerInput = function PickerInput(_ref) {
|
|
|
47
42
|
if (typeof value === 'string') {
|
|
48
43
|
return format(legacyParse(value), dateFormat || showTime ? 'MMM d, yyyy, HH:mm' : 'MMM d, yyyy');
|
|
49
44
|
}
|
|
50
|
-
return formatValue(value,
|
|
45
|
+
return formatValue(value, _extends({}, getDefaultDataTimeOptions(showTime), valueFormatOptions));
|
|
51
46
|
}, [value, dateFormat, showTime, formatValue, valueFormatOptions]);
|
|
52
47
|
var handleApply = useCallback(function (date) {
|
|
53
48
|
if (!onChange) return;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { InputProps } from '@synerise/ds-input';
|
|
2
3
|
export declare const Prefixel: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
4
|
export declare const Suffixel: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export declare const Input: import("styled-components").StyledComponent<
|
|
5
|
+
export declare const Input: import("styled-components").StyledComponent<({ className, errorText, label, description, counterLimit, tooltip, tooltipConfig, icon1, icon1Tooltip, autoResize, icon2, icon2Tooltip, resetMargin, handleInputRef, prefixel, suffixel, error, expandable, expandableTooltip, renderCustomCounter, ...antdInputProps }: InputProps) => import("react").JSX.Element, any, import("@synerise/ds-input").BaseProps<HTMLInputElement> & import("antd/lib/input").InputProps & {
|
|
5
6
|
active: boolean;
|
|
6
7
|
}, never>;
|
|
7
8
|
export declare const PickerInputWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
function
|
|
2
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
2
|
import React from 'react';
|
|
7
3
|
import { useDataFormat, getDefaultDataTimeOptions } from '@synerise/ds-data-format';
|
|
4
|
+
import DSTimePicker from '@synerise/ds-time-picker';
|
|
8
5
|
import Navbar from '../Navbar/Navbar';
|
|
9
6
|
import * as S from './TimePicker.styles';
|
|
10
7
|
var TimePicker = function TimePicker(_ref) {
|
|
@@ -24,7 +21,7 @@ var TimePicker = function TimePicker(_ref) {
|
|
|
24
21
|
var _useDataFormat = useDataFormat(),
|
|
25
22
|
is12HoursClock = _useDataFormat.is12HoursClock,
|
|
26
23
|
formatValue = _useDataFormat.formatValue;
|
|
27
|
-
var navbarDate = formatValue(value,
|
|
24
|
+
var navbarDate = formatValue(value, _extends({}, getDefaultDataTimeOptions(), {
|
|
28
25
|
targetFormat: 'date',
|
|
29
26
|
month: 'short'
|
|
30
27
|
}));
|
|
@@ -38,7 +35,7 @@ var TimePicker = function TimePicker(_ref) {
|
|
|
38
35
|
}), /*#__PURE__*/React.createElement(S.Container, {
|
|
39
36
|
key: "ds-time-picker-body",
|
|
40
37
|
className: "ds-time-picker"
|
|
41
|
-
}, /*#__PURE__*/React.createElement(
|
|
38
|
+
}, /*#__PURE__*/React.createElement(DSTimePicker, {
|
|
42
39
|
value: value,
|
|
43
40
|
onChange: onChange,
|
|
44
41
|
disabledHours: disabledHours,
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const Picker: import("styled-components").StyledComponent<{
|
|
4
|
-
({ placement, placeholder, trigger, value, units, defaultOpen, onChange, containerStyle, timeFormat, valueFormatOptions, use12HourClock, alwaysOpen, dropdownProps, inputProps, disabled, disabledHours, disabledMinutes, disabledSeconds, overlayClassName, className, clearTooltip, raw, onClockModeChange, errorText, }: import("@synerise/ds-time-picker").TimePickerProps): import("react").JSX.Element;
|
|
5
|
-
defaultProps: {
|
|
6
|
-
placement: string;
|
|
7
|
-
trigger: string[];
|
|
8
|
-
units: import("dayjs").UnitType[];
|
|
9
|
-
};
|
|
10
|
-
}, any, {}, never>;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import DSTimePicker from '@synerise/ds-time-picker';
|
|
3
2
|
export var Container = styled.div.withConfig({
|
|
4
3
|
displayName: "TimePickerstyles__Container",
|
|
5
4
|
componentId: "js4ktp-0"
|
|
6
|
-
})(["display:grid;grid-auto-columns:1fr;> *{grid-row:1;}&&{& > div > div{height:calc(100% - 18px);}}padding:16px 24px 0 24px;"]);
|
|
7
|
-
export var Picker = styled(DSTimePicker).withConfig({
|
|
8
|
-
displayName: "TimePickerstyles__Picker",
|
|
9
|
-
componentId: "js4ktp-1"
|
|
10
|
-
})([""]);
|
|
5
|
+
})(["display:grid;grid-auto-columns:1fr;> *{grid-row:1;}&&{& > div > div{height:calc(100% - 18px);}}padding:16px 24px 0 24px;"]);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
2
2
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
3
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
3
|
import React from 'react';
|
|
7
4
|
import { legacyParse } from '@date-fns/upgrade/v2';
|
|
8
5
|
import fnsFormat from '../../format';
|
|
@@ -34,20 +31,20 @@ var YearPicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
34
31
|
args[_key] = arguments[_key];
|
|
35
32
|
}
|
|
36
33
|
_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
_this.state = getInitialState(_this.props);
|
|
35
|
+
_this.handleLongPrev = function () {
|
|
39
36
|
var cursor = _this.state.cursor;
|
|
40
37
|
_this.setState({
|
|
41
38
|
cursor: fnsAddYears(cursor, -10)
|
|
42
39
|
});
|
|
43
|
-
}
|
|
44
|
-
|
|
40
|
+
};
|
|
41
|
+
_this.handleLongNext = function () {
|
|
45
42
|
var cursor = _this.state.cursor;
|
|
46
43
|
_this.setState({
|
|
47
44
|
cursor: fnsAddYears(cursor, 10)
|
|
48
45
|
});
|
|
49
|
-
}
|
|
50
|
-
|
|
46
|
+
};
|
|
47
|
+
_this.handleCellClick = function (isoDate) {
|
|
51
48
|
var onChange = _this.props.onChange;
|
|
52
49
|
if (isoDate === -1) {
|
|
53
50
|
_this.handleLongPrev();
|
|
@@ -58,7 +55,7 @@ var YearPicker = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
58
55
|
return;
|
|
59
56
|
}
|
|
60
57
|
onChange && onChange(new Date(isoDate));
|
|
61
|
-
}
|
|
58
|
+
};
|
|
62
59
|
return _this;
|
|
63
60
|
}
|
|
64
61
|
_inheritsLoose(YearPicker, _React$PureComponent);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
2
2
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
3
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
3
|
import React from 'react';
|
|
7
4
|
import { injectIntl } from 'react-intl';
|
|
8
5
|
import { legacyParse } from '@date-fns/upgrade/v2';
|
|
@@ -23,7 +20,7 @@ var RawDatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
23
20
|
_this = _React$Component.call(this, props) || this;
|
|
24
21
|
|
|
25
22
|
// eslint-disable-next-line react/state-in-constructor
|
|
26
|
-
|
|
23
|
+
_this.handleChange = function (value) {
|
|
27
24
|
var onValueChange = _this.props.onValueChange;
|
|
28
25
|
var _this$state = _this.state,
|
|
29
26
|
mode = _this$state.mode,
|
|
@@ -42,18 +39,18 @@ var RawDatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
42
39
|
});
|
|
43
40
|
onValueChange && onValueChange(value);
|
|
44
41
|
}
|
|
45
|
-
}
|
|
46
|
-
|
|
42
|
+
};
|
|
43
|
+
_this.handleDayMouseEnter = function (day) {
|
|
47
44
|
return _this.setState({
|
|
48
45
|
enteredTo: day
|
|
49
46
|
});
|
|
50
|
-
}
|
|
51
|
-
|
|
47
|
+
};
|
|
48
|
+
_this.handleDayMouseLeave = function () {
|
|
52
49
|
return _this.setState({
|
|
53
50
|
enteredTo: undefined
|
|
54
51
|
});
|
|
55
|
-
}
|
|
56
|
-
|
|
52
|
+
};
|
|
53
|
+
_this.handleDayClick = function (day, modifiers) {
|
|
57
54
|
var _this$state2 = _this.state,
|
|
58
55
|
isChanged = _this$state2.changed,
|
|
59
56
|
value = _this$state2.value;
|
|
@@ -74,13 +71,13 @@ var RawDatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
74
71
|
_this.handleChange(nextDateWithCurrentTime);
|
|
75
72
|
}
|
|
76
73
|
!!showTime && _this.handleModeSwitch('time');
|
|
77
|
-
}
|
|
78
|
-
|
|
74
|
+
};
|
|
75
|
+
_this.handleModeSwitch = function (mode) {
|
|
79
76
|
return _this.setState({
|
|
80
77
|
mode: mode
|
|
81
78
|
});
|
|
82
|
-
}
|
|
83
|
-
|
|
79
|
+
};
|
|
80
|
+
_this.handleApply = function (date) {
|
|
84
81
|
var onApply = _this.props.onApply;
|
|
85
82
|
if (!onApply) return;
|
|
86
83
|
var value = _this.state.value;
|
|
@@ -93,20 +90,20 @@ var RawDatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
93
90
|
onApply(value);
|
|
94
91
|
}
|
|
95
92
|
_this.handleModeSwitch('date');
|
|
96
|
-
}
|
|
97
|
-
|
|
93
|
+
};
|
|
94
|
+
_this.handleMonthChange = function (month, mode) {
|
|
98
95
|
return _this.setState({
|
|
99
96
|
month: month,
|
|
100
97
|
mode: mode
|
|
101
98
|
});
|
|
102
|
-
}
|
|
103
|
-
|
|
99
|
+
};
|
|
100
|
+
_this.renderDay = function (day) {
|
|
104
101
|
var text = day.getDate();
|
|
105
102
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DayBackground, null), /*#__PURE__*/React.createElement(DayText, {
|
|
106
103
|
"data-attr": text
|
|
107
104
|
}, text), /*#__PURE__*/React.createElement(DayForeground, null));
|
|
108
|
-
}
|
|
109
|
-
|
|
105
|
+
};
|
|
106
|
+
_this.renderYearPicker = function () {
|
|
110
107
|
var month = _this.state.month;
|
|
111
108
|
return /*#__PURE__*/React.createElement(YearPicker, {
|
|
112
109
|
value: month,
|
|
@@ -114,8 +111,8 @@ var RawDatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
114
111
|
return changedMonth && _this.handleMonthChange(changedMonth, 'date');
|
|
115
112
|
}
|
|
116
113
|
});
|
|
117
|
-
}
|
|
118
|
-
|
|
114
|
+
};
|
|
115
|
+
_this.renderMonthPicker = function () {
|
|
119
116
|
var month = _this.state.month;
|
|
120
117
|
return /*#__PURE__*/React.createElement(MonthPicker, {
|
|
121
118
|
value: month,
|
|
@@ -123,8 +120,8 @@ var RawDatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
123
120
|
return changedMonth && _this.handleMonthChange(changedMonth, 'date');
|
|
124
121
|
}
|
|
125
122
|
});
|
|
126
|
-
}
|
|
127
|
-
|
|
123
|
+
};
|
|
124
|
+
_this.renderDayPicker = function () {
|
|
128
125
|
var _this$state3 = _this.state,
|
|
129
126
|
value = _this$state3.value,
|
|
130
127
|
enteredTo = _this$state3.enteredTo;
|
|
@@ -161,16 +158,16 @@ var RawDatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
161
158
|
},
|
|
162
159
|
modifiers: modifiers
|
|
163
160
|
});
|
|
164
|
-
}
|
|
165
|
-
|
|
161
|
+
};
|
|
162
|
+
_this.handleDaySwitch = function (day) {
|
|
166
163
|
var disabledDates = _this.props.disabledDates;
|
|
167
164
|
|
|
168
165
|
// @ts-ignore
|
|
169
166
|
_this.handleDayClick(day, {
|
|
170
167
|
disabled: disabledDates ? disabledDates(day) : false
|
|
171
168
|
});
|
|
172
|
-
}
|
|
173
|
-
|
|
169
|
+
};
|
|
170
|
+
_this.renderTimePicker = function () {
|
|
174
171
|
var value = _this.state.value;
|
|
175
172
|
var _this$props2 = _this.props,
|
|
176
173
|
disabledHours = _this$props2.disabledHours,
|
|
@@ -196,7 +193,7 @@ var RawDatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
196
193
|
return _this.handleDaySwitch(prevDay);
|
|
197
194
|
}
|
|
198
195
|
});
|
|
199
|
-
}
|
|
196
|
+
};
|
|
200
197
|
_this.state = {
|
|
201
198
|
mode: 'date',
|
|
202
199
|
month: fnsStartOfMonth(props.value || new Date()),
|
|
@@ -272,10 +269,10 @@ var RawDatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
272
269
|
};
|
|
273
270
|
return RawDatePicker;
|
|
274
271
|
}(React.Component);
|
|
275
|
-
|
|
272
|
+
RawDatePicker.defaultProps = {
|
|
276
273
|
showTime: false,
|
|
277
274
|
disabledHours: [],
|
|
278
275
|
disabledMinutes: [],
|
|
279
276
|
disabledSeconds: []
|
|
280
|
-
}
|
|
277
|
+
};
|
|
281
278
|
export default injectIntl(RawDatePicker);
|
package/dist/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export { default as MonthPicker } from './Elements/MonthPicker/MonthPicker';
|
|
|
5
5
|
export { default as YearPicker } from './Elements/YearPicker/YearPicker';
|
|
6
6
|
export { default as DayPicker } from './Elements/DayPicker/DayPicker';
|
|
7
7
|
export { default as TimePicker } from './Elements/TimePicker/TimePicker';
|
|
8
|
+
export type { DatePickerProps } from './DatePicker.types';
|
package/dist/localeUtils.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
function
|
|
2
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
2
|
import MomentLocaleUtils from 'react-day-picker/moment';
|
|
7
3
|
var WEEKDAYS_LONG = {
|
|
8
4
|
en: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
@@ -60,7 +56,7 @@ function getFirstDayOfWeek(locale) {
|
|
|
60
56
|
}
|
|
61
57
|
return FIRST_DAY[getValidLocale(locale)];
|
|
62
58
|
}
|
|
63
|
-
var localeUtils =
|
|
59
|
+
var localeUtils = _extends({}, MomentLocaleUtils, {
|
|
64
60
|
formatDay: formatDay,
|
|
65
61
|
formatMonthTitle: formatMonthTitle,
|
|
66
62
|
formatWeekdayShort: formatWeekdayShort,
|
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import '@testing-library/jest-dom
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
function
|
|
2
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
2
|
import React from 'react';
|
|
7
3
|
import { FormattedMessage } from 'react-intl';
|
|
8
4
|
export var getDefaultTexts = function getDefaultTexts(intl, texts) {
|
|
@@ -23,5 +19,5 @@ export var getDefaultTexts = function getDefaultTexts(intl, texts) {
|
|
|
23
19
|
defaultMessage: "Clear"
|
|
24
20
|
})
|
|
25
21
|
};
|
|
26
|
-
return texts ?
|
|
22
|
+
return texts ? _extends({}, defaultTexts, texts) : defaultTexts;
|
|
27
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-date-picker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "DatePicker UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@date-fns/upgrade": "^1.0.3",
|
|
38
|
-
"@synerise/ds-button": "^0.
|
|
39
|
-
"@synerise/ds-data-format": "^0.
|
|
40
|
-
"@synerise/ds-dropdown": "^0.
|
|
41
|
-
"@synerise/ds-icon": "^0.
|
|
42
|
-
"@synerise/ds-input": "^0.
|
|
43
|
-
"@synerise/ds-time-picker": "^0.
|
|
44
|
-
"@synerise/ds-tooltip": "^0.
|
|
45
|
-
"@synerise/ds-utils": "^0.
|
|
38
|
+
"@synerise/ds-button": "^0.23.0",
|
|
39
|
+
"@synerise/ds-data-format": "^0.7.0",
|
|
40
|
+
"@synerise/ds-dropdown": "^0.19.1",
|
|
41
|
+
"@synerise/ds-icon": "^0.71.0",
|
|
42
|
+
"@synerise/ds-input": "^0.25.1",
|
|
43
|
+
"@synerise/ds-time-picker": "^0.12.1",
|
|
44
|
+
"@synerise/ds-tooltip": "^0.15.0",
|
|
45
|
+
"@synerise/ds-utils": "^0.32.0",
|
|
46
46
|
"classnames": "2.3.2",
|
|
47
47
|
"date-fns": "2.16.1",
|
|
48
48
|
"lodash": "^4.17.21",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@synerise/ds-core": "*",
|
|
54
|
-
"antd": "4.
|
|
55
|
-
"react": ">=16.9.0 <=
|
|
54
|
+
"antd": "4.24.16",
|
|
55
|
+
"react": ">=16.9.0 <= 18.3.1",
|
|
56
56
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
57
|
-
"styled-components": "5.
|
|
57
|
+
"styled-components": "^5.3.3"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "9aaa7260a474fb987a6dad183ce6e609ddc965d2"
|
|
60
60
|
}
|