@synerise/ds-date-picker 0.11.3 → 0.11.5
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.11.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.11.4...@synerise/ds-date-picker@0.11.5) (2024-07-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **date-picker:** fixed display value in input ([72e58c2](https://github.com/Synerise/synerise-design/commit/72e58c2c3f2eb01f3e24163ba5f821adc1cec9f5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.11.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.11.3...@synerise/ds-date-picker@0.11.4) (2024-06-27)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @synerise/ds-date-picker
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.11.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.11.2...@synerise/ds-date-picker@0.11.3) (2024-06-21)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-date-picker
|
package/dist/DatePicker.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
declare const DatePicker: React.
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DatePickerProps } from './DatePicker.types';
|
|
3
|
+
declare const DatePicker: ({ autoFocus, disabled, texts, format, valueFormatOptions, value, onApply, showTime, onValueChange, onClear, errorText, popoverPlacement, prefixel, error, onDropdownVisibleChange, dropdownProps, suffixel, hideNow, readOnly, renderTrigger, inputProps, ...rest }: DatePickerProps) => React.JSX.Element;
|
|
4
4
|
export default DatePicker;
|
package/dist/DatePicker.js
CHANGED
|
@@ -4,7 +4,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
8
|
import Dropdown from '@synerise/ds-dropdown';
|
|
9
9
|
import { useOnClickOutside } from '@synerise/ds-utils';
|
|
10
10
|
import RawDatePicker from './RawDatePicker/RawDatePicker';
|
|
@@ -35,31 +35,30 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
35
35
|
inputProps = _ref.inputProps,
|
|
36
36
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
37
37
|
|
|
38
|
-
var
|
|
39
|
-
dropVisible =
|
|
40
|
-
setDropVisible =
|
|
38
|
+
var _useState = useState(autoFocus || false),
|
|
39
|
+
dropVisible = _useState[0],
|
|
40
|
+
setDropVisible = _useState[1];
|
|
41
41
|
|
|
42
|
-
var
|
|
43
|
-
selectedDate =
|
|
44
|
-
setSelectedDate =
|
|
42
|
+
var _useState2 = useState(value),
|
|
43
|
+
selectedDate = _useState2[0],
|
|
44
|
+
setSelectedDate = _useState2[1];
|
|
45
45
|
|
|
46
|
-
var ref =
|
|
46
|
+
var ref = useRef(null);
|
|
47
47
|
useOnClickOutside(ref, function () {
|
|
48
48
|
!!dropVisible && setDropVisible(false);
|
|
49
49
|
});
|
|
50
|
-
|
|
50
|
+
useEffect(function () {
|
|
51
51
|
setSelectedDate(value);
|
|
52
52
|
}, [value]);
|
|
53
|
-
var onValueChangeCallback =
|
|
53
|
+
var onValueChangeCallback = useCallback(function (val) {
|
|
54
54
|
onValueChange && onValueChange(val);
|
|
55
|
-
setSelectedDate(val);
|
|
56
55
|
}, [onValueChange]);
|
|
57
|
-
var onApplyCallback =
|
|
56
|
+
var onApplyCallback = useCallback(function (val) {
|
|
58
57
|
onApply && onApply(val);
|
|
59
58
|
setSelectedDate(val);
|
|
60
59
|
setDropVisible(false);
|
|
61
60
|
}, [onApply]);
|
|
62
|
-
var handleClear =
|
|
61
|
+
var handleClear = useCallback(function () {
|
|
63
62
|
setDropVisible(false);
|
|
64
63
|
setSelectedDate(undefined);
|
|
65
64
|
onClear && onClear();
|
|
@@ -3,7 +3,7 @@ import type { IntlShape } from 'react-intl';
|
|
|
3
3
|
import type { DropdownProps } from '@synerise/ds-dropdown/dist/Dropdown';
|
|
4
4
|
import type { DateToFormatOptions } from '@synerise/ds-data-format';
|
|
5
5
|
import type { InputProps } from '@synerise/ds-input';
|
|
6
|
-
export type
|
|
6
|
+
export type DatePickerProps = {
|
|
7
7
|
autoFocus?: boolean;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
disabledDates?: (date?: Date) => boolean;
|
|
@@ -36,6 +36,7 @@ export type Props = {
|
|
|
36
36
|
readOnly?: boolean;
|
|
37
37
|
inputProps?: Pick<InputProps, 'autoResize'>;
|
|
38
38
|
};
|
|
39
|
+
export type Props = DatePickerProps;
|
|
39
40
|
export type State = {
|
|
40
41
|
mode: string;
|
|
41
42
|
month: Date;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { PickerInputProps } from './PickerInput.types';
|
|
3
3
|
declare const PickerInput: ({ autoFocus, size, disabled, readOnly, value, format: dateFormat, valueFormatOptions, onChange, showTime, placeholder, onClear, onClick, clearTooltip, highlight, error, errorText, prefixel, suffixel, ...rest }: PickerInputProps) => React.JSX.Element;
|
|
4
4
|
export default PickerInput;
|
|
@@ -10,7 +10,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10
10
|
|
|
11
11
|
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; }
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
14
14
|
import Icon, { CalendarM, Close3S } from '@synerise/ds-icon';
|
|
15
15
|
import Tooltip from '@synerise/ds-tooltip';
|
|
16
16
|
import { getDefaultDataTimeOptions, useDataFormat } from '@synerise/ds-data-format';
|
|
@@ -42,11 +42,11 @@ var PickerInput = function PickerInput(_ref) {
|
|
|
42
42
|
var _useDataFormat = useDataFormat(),
|
|
43
43
|
formatValue = _useDataFormat.formatValue;
|
|
44
44
|
|
|
45
|
-
var
|
|
46
|
-
hovered =
|
|
47
|
-
setHovered =
|
|
45
|
+
var _useState = useState(false),
|
|
46
|
+
hovered = _useState[0],
|
|
47
|
+
setHovered = _useState[1];
|
|
48
48
|
|
|
49
|
-
var getText =
|
|
49
|
+
var getText = useCallback(function () {
|
|
50
50
|
if (!value) return '';
|
|
51
51
|
|
|
52
52
|
if (dateFormat) {
|
|
@@ -59,20 +59,20 @@ var PickerInput = function PickerInput(_ref) {
|
|
|
59
59
|
|
|
60
60
|
return formatValue(value, _objectSpread({}, getDefaultDataTimeOptions(showTime), {}, valueFormatOptions));
|
|
61
61
|
}, [value, dateFormat, showTime, formatValue, valueFormatOptions]);
|
|
62
|
-
var handleApply =
|
|
62
|
+
var handleApply = useCallback(function (date) {
|
|
63
63
|
if (!onChange) return;
|
|
64
64
|
onChange(date, getText());
|
|
65
65
|
}, [onChange, getText]);
|
|
66
|
-
var handleIconClick =
|
|
67
|
-
|
|
66
|
+
var handleIconClick = useCallback(function (event) {
|
|
67
|
+
event.stopPropagation();
|
|
68
68
|
onClear && onClear();
|
|
69
69
|
handleApply(null);
|
|
70
70
|
}, [onClear, handleApply]);
|
|
71
|
-
var handleInputClick =
|
|
72
|
-
|
|
71
|
+
var handleInputClick = useCallback(function (event) {
|
|
72
|
+
event.stopPropagation();
|
|
73
73
|
onClick && onClick();
|
|
74
74
|
}, [onClick]);
|
|
75
|
-
var iconInput =
|
|
75
|
+
var iconInput = useMemo(function () {
|
|
76
76
|
return (hovered || highlight) && !readOnly && !!value ? /*#__PURE__*/React.createElement(S.ClearIconWrapper, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
77
77
|
title: clearTooltip
|
|
78
78
|
}, /*#__PURE__*/React.createElement(Icon, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-date-picker",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"description": "DatePicker UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"types": "dist/index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@date-fns/upgrade": "^1.0.3",
|
|
37
|
-
"@synerise/ds-button": "^0.21.
|
|
37
|
+
"@synerise/ds-button": "^0.21.1",
|
|
38
38
|
"@synerise/ds-data-format": "^0.5.0",
|
|
39
|
-
"@synerise/ds-dropdown": "^0.18.
|
|
40
|
-
"@synerise/ds-icon": "^0.
|
|
41
|
-
"@synerise/ds-input": "^0.
|
|
42
|
-
"@synerise/ds-time-picker": "^0.10.
|
|
43
|
-
"@synerise/ds-tooltip": "^0.14.
|
|
39
|
+
"@synerise/ds-dropdown": "^0.18.3",
|
|
40
|
+
"@synerise/ds-icon": "^0.63.0",
|
|
41
|
+
"@synerise/ds-input": "^0.23.0",
|
|
42
|
+
"@synerise/ds-time-picker": "^0.10.13",
|
|
43
|
+
"@synerise/ds-tooltip": "^0.14.31",
|
|
44
44
|
"@synerise/ds-utils": "^0.27.0",
|
|
45
45
|
"classnames": "2.3.2",
|
|
46
46
|
"date-fns": "2.16.1",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react": ">=16.9.0 < 17.0.0",
|
|
56
56
|
"styled-components": "5.0.1"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "0692552b018dc9c8042f18c773f88890c9ad3270"
|
|
59
59
|
}
|