@synerise/ds-date-range-picker 1.1.5 → 1.2.0
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 +16 -0
- package/dist/RangePickerInput/RangePickerInput.d.ts +1 -1
- package/dist/RangePickerInput/RangePickerInput.js +14 -6
- package/dist/RangePickerInput/RangePickerInput.styles.d.ts +0 -5
- package/dist/RangePickerInput/RangePickerInput.styles.js +1 -22
- package/dist/RangePickerInput/RangePickerInput.types.d.ts +11 -14
- package/dist/RawDateRangePicker.js +4 -1
- package/dist/RelativeRangePicker/RelativeRangePicker.styles.d.ts +4 -1
- package/package.json +20 -19
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
# [1.2.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@1.1.5...@synerise/ds-date-range-picker@1.2.0) (2025-04-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **date-range-picker:** fix clearing local value ([dc04ce0](https://github.com/Synerise/synerise-design/commit/dc04ce02685cf9fb15b22482f86a8a6065911dc1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **form-field:** add form-field component ([7f6b191](https://github.com/Synerise/synerise-design/commit/7f6b191132a3b0d694c21fb4d649f4deea6acb89))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [1.1.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@1.1.4...@synerise/ds-date-range-picker@1.1.5) (2025-04-04)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RangePickerInputProps } from './RangePickerInput.types';
|
|
3
|
-
declare const RangePickerInput: ({ value, valueFormatOptions, showTime, onChange, onClick, highlight, texts, active, label, description, tooltip, disabled, readOnly, onFocus, allowClear, onBlur, error, errorText, preferRelativeDesc, }: RangePickerInputProps) => React.JSX.Element;
|
|
3
|
+
declare const RangePickerInput: ({ value, valueFormatOptions, showTime, onChange, onClick, highlight, texts, active, label, description, tooltip, tooltipConfig, disabled, readOnly, onFocus, allowClear, onBlur, error, errorText, preferRelativeDesc, }: RangePickerInputProps) => React.JSX.Element;
|
|
4
4
|
export default RangePickerInput;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
3
|
import Icon, { ArrowRightS, CalendarM, Close3S } from '@synerise/ds-icon';
|
|
4
|
-
import {
|
|
4
|
+
import { useTheme } from '@synerise/ds-core';
|
|
5
5
|
import Tooltip from '@synerise/ds-tooltip';
|
|
6
6
|
import { getDefaultDataTimeOptions, useDataFormat } from '@synerise/ds-data-format';
|
|
7
|
+
import FormField from '@synerise/ds-form-field';
|
|
7
8
|
import * as S from './RangePickerInput.styles';
|
|
8
9
|
import { normalizeRange } from '../utils';
|
|
9
10
|
import { isLifetime } from '../RelativeRangePicker/Elements/RangeDropdown/RangeDropdown';
|
|
@@ -19,6 +20,7 @@ var RangePickerInput = function RangePickerInput(_ref) {
|
|
|
19
20
|
label = _ref.label,
|
|
20
21
|
description = _ref.description,
|
|
21
22
|
tooltip = _ref.tooltip,
|
|
23
|
+
tooltipConfig = _ref.tooltipConfig,
|
|
22
24
|
disabled = _ref.disabled,
|
|
23
25
|
readOnly = _ref.readOnly,
|
|
24
26
|
onFocus = _ref.onFocus,
|
|
@@ -29,6 +31,7 @@ var RangePickerInput = function RangePickerInput(_ref) {
|
|
|
29
31
|
errorText = _ref.errorText,
|
|
30
32
|
_ref$preferRelativeDe = _ref.preferRelativeDesc,
|
|
31
33
|
preferRelativeDesc = _ref$preferRelativeDe === void 0 ? false : _ref$preferRelativeDe;
|
|
34
|
+
var theme = useTheme();
|
|
32
35
|
var _useDataFormat = useDataFormat(),
|
|
33
36
|
formatValue = _useDataFormat.formatValue;
|
|
34
37
|
var dateRangeValue = value ? normalizeRange(value) : value;
|
|
@@ -74,15 +77,19 @@ var RangePickerInput = function RangePickerInput(_ref) {
|
|
|
74
77
|
component: /*#__PURE__*/React.createElement(ArrowRightS, null),
|
|
75
78
|
color: theme.palette['grey-400']
|
|
76
79
|
}), renderEndDate(), preferRelativeDesc && (dateRangeValue == null ? void 0 : dateRangeValue.translationKey) && value && ')');
|
|
77
|
-
}, [
|
|
78
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
80
|
+
}, [value, preferRelativeDesc, dateRangeValue == null ? void 0 : dateRangeValue.translationKey, texts, renderFromDate, theme.palette, renderEndDate]);
|
|
81
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormField, {
|
|
82
|
+
errorText: errorText,
|
|
79
83
|
label: label,
|
|
80
|
-
tooltip: tooltip
|
|
81
|
-
|
|
84
|
+
tooltip: tooltip,
|
|
85
|
+
tooltipConfig: tooltipConfig,
|
|
86
|
+
description: description
|
|
87
|
+
}, /*#__PURE__*/React.createElement(S.Container, {
|
|
82
88
|
tabIndex: 0,
|
|
83
89
|
onFocus: onFocus,
|
|
84
90
|
onClick: !disabled ? onClick : undefined,
|
|
85
91
|
onBlur: onBlur,
|
|
92
|
+
"data-testid": "date-range-picker-input-wrapper",
|
|
86
93
|
onMouseEnter: handleIconMouseEnter,
|
|
87
94
|
onMouseLeave: handleIconMouseLeave
|
|
88
95
|
}, /*#__PURE__*/React.createElement(S.RangeInputWrapper, {
|
|
@@ -95,10 +102,11 @@ var RangePickerInput = function RangePickerInput(_ref) {
|
|
|
95
102
|
title: texts == null ? void 0 : texts.clear
|
|
96
103
|
}, /*#__PURE__*/React.createElement(S.ClearIconWrapper, null, /*#__PURE__*/React.createElement(Icon, {
|
|
97
104
|
component: /*#__PURE__*/React.createElement(Close3S, null),
|
|
105
|
+
"data-testid": "date-range-picker-input-clear",
|
|
98
106
|
onClick: handleClear
|
|
99
107
|
}))) : /*#__PURE__*/React.createElement(S.DefaultIconWrapper, null, /*#__PURE__*/React.createElement(Icon, {
|
|
100
108
|
component: /*#__PURE__*/React.createElement(CalendarM, null),
|
|
101
109
|
color: theme.palette['grey-600']
|
|
102
|
-
}))))
|
|
110
|
+
}))))));
|
|
103
111
|
};
|
|
104
112
|
export default RangePickerInput;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
2
|
export declare const ClearIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
3
|
export declare const DefaultIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -15,7 +14,3 @@ export declare const DateWrapper: import("styled-components").StyledComponent<"d
|
|
|
15
14
|
export declare const DateValue: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
15
|
export declare const IconSeparator: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
16
|
export declare const SuffixWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
|
-
export declare const Label: import("styled-components").StyledComponent<({ id, className, label, tooltip, tooltipConfig, style }: import("@synerise/ds-input/dist/Label/Label.types").LabelProps) => import("react").JSX.Element, any, {}, never>;
|
|
19
|
-
export declare const ErrorText: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
20
|
-
export declare const Description: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
21
|
-
export declare const ContentBelow: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { InputWrapper } from '@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles';
|
|
3
|
-
import { Label as DSLabel } from '@synerise/ds-input';
|
|
4
3
|
export var Container = styled.div.withConfig({
|
|
5
4
|
displayName: "RangePickerInputstyles__Container",
|
|
6
5
|
componentId: "sc-1b9h1ef-0"
|
|
@@ -42,24 +41,4 @@ export var IconSeparator = styled.div.withConfig({
|
|
|
42
41
|
export var SuffixWrapper = styled.div.withConfig({
|
|
43
42
|
displayName: "RangePickerInputstyles__SuffixWrapper",
|
|
44
43
|
componentId: "sc-1b9h1ef-7"
|
|
45
|
-
})([""]);
|
|
46
|
-
export var Label = styled(DSLabel).withConfig({
|
|
47
|
-
displayName: "RangePickerInputstyles__Label",
|
|
48
|
-
componentId: "sc-1b9h1ef-8"
|
|
49
|
-
})(["margin-bottom:8px;"]);
|
|
50
|
-
export var ErrorText = styled.div.withConfig({
|
|
51
|
-
displayName: "RangePickerInputstyles__ErrorText",
|
|
52
|
-
componentId: "sc-1b9h1ef-9"
|
|
53
|
-
})(["color:", ";margin-bottom:4px;"], function (props) {
|
|
54
|
-
return props.theme.palette['red-600'];
|
|
55
|
-
});
|
|
56
|
-
export var Description = styled.div.withConfig({
|
|
57
|
-
displayName: "RangePickerInputstyles__Description",
|
|
58
|
-
componentId: "sc-1b9h1ef-10"
|
|
59
|
-
})(["color:", ";"], function (props) {
|
|
60
|
-
return props.theme.palette['grey-600'];
|
|
61
|
-
});
|
|
62
|
-
export var ContentBelow = styled.div.withConfig({
|
|
63
|
-
displayName: "RangePickerInputstyles__ContentBelow",
|
|
64
|
-
componentId: "sc-1b9h1ef-11"
|
|
65
|
-
})(["margin-top:8px;"]);
|
|
44
|
+
})([""]);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DateToFormatOptions } from '@synerise/ds-data-format';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { CSSProperties, MouseEvent as ReactMouseEvent, FocusEventHandler, ReactNode } from 'react';
|
|
2
|
+
import type { DateToFormatOptions } from '@synerise/ds-data-format';
|
|
3
|
+
import type { FormFieldCommonProps } from '@synerise/ds-form-field';
|
|
4
|
+
import type { DateFilter, DateRange } from '../date.types';
|
|
5
|
+
import type { Texts } from '../DateRangePicker.types';
|
|
5
6
|
export type RangePickerInputProps = {
|
|
6
7
|
size?: 'large' | 'default' | 'small';
|
|
7
8
|
/**
|
|
@@ -13,25 +14,21 @@ export type RangePickerInputProps = {
|
|
|
13
14
|
allowClear?: boolean;
|
|
14
15
|
value?: Pick<DateRange, 'from'> & Pick<DateRange, 'to'>;
|
|
15
16
|
onChange?: (value: Partial<DateFilter> | undefined) => void;
|
|
16
|
-
style?:
|
|
17
|
+
style?: CSSProperties;
|
|
17
18
|
placeholder?: string;
|
|
18
19
|
disabled?: boolean;
|
|
19
20
|
readOnly?: boolean;
|
|
20
|
-
onClick?: (
|
|
21
|
+
onClick?: (event?: ReactMouseEvent<HTMLElement, MouseEvent>) => void;
|
|
21
22
|
onClear?: () => void;
|
|
22
|
-
onFocus?:
|
|
23
|
-
onBlur?:
|
|
24
|
-
clearTooltip?:
|
|
23
|
+
onFocus?: FocusEventHandler;
|
|
24
|
+
onBlur?: FocusEventHandler;
|
|
25
|
+
clearTooltip?: ReactNode;
|
|
25
26
|
highlight?: boolean;
|
|
26
27
|
texts?: Texts;
|
|
27
28
|
active?: boolean;
|
|
28
|
-
label?: string | React.ReactNode;
|
|
29
|
-
description?: string | React.ReactNode;
|
|
30
|
-
tooltip?: string | React.ReactNode;
|
|
31
29
|
error?: boolean;
|
|
32
|
-
errorText?: React.ReactNode | string;
|
|
33
30
|
preferRelativeDesc?: boolean;
|
|
34
|
-
};
|
|
31
|
+
} & FormFieldCommonProps;
|
|
35
32
|
/**
|
|
36
33
|
* @deprecated use `RangePickerInputProps`
|
|
37
34
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useState, useMemo, useCallback } from 'react';
|
|
2
|
+
import React, { useState, useMemo, useCallback, useEffect } from 'react';
|
|
3
3
|
import { omitBy, isUndefined } from 'lodash';
|
|
4
4
|
import { useIntl } from 'react-intl';
|
|
5
5
|
import fnsIsValid from 'date-fns/isValid';
|
|
@@ -121,6 +121,9 @@ export var RawDateRangePicker = function RawDateRangePicker(_ref) {
|
|
|
121
121
|
setVisibleAddonKey = _useState3[1];
|
|
122
122
|
var intl = useIntl();
|
|
123
123
|
var timeZone = intl.timeZone;
|
|
124
|
+
useEffect(function () {
|
|
125
|
+
setLocalValue(normalizeRange(value));
|
|
126
|
+
}, [value]);
|
|
124
127
|
var allTexts = useMemo(function () {
|
|
125
128
|
return getDefaultTexts(intl, false, texts);
|
|
126
129
|
}, [intl, texts]);
|
|
@@ -6,7 +6,10 @@ export declare const Title: import("styled-components").StyledComponent<"div", a
|
|
|
6
6
|
export declare const Help: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
7
|
export declare const Ranges: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
8
|
export declare const CustomForm: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
|
-
export declare const InputSelectGroup: import("styled-components").StyledComponent<({ children, label, errors, description, resetMargin, tooltip, ...antdInputGroupProps }: InputGroupProps) => React.JSX.Element, any,
|
|
9
|
+
export declare const InputSelectGroup: import("styled-components").StyledComponent<({ children, label, errors, description, resetMargin, tooltip, tooltipConfig, ...antdInputGroupProps }: InputGroupProps) => React.JSX.Element, any, import("antd/es/input").GroupProps & {
|
|
10
|
+
errors?: string[] | undefined;
|
|
11
|
+
resetMargin?: boolean | undefined;
|
|
12
|
+
} & Omit<import("@synerise/ds-form-field").FormFieldCommonProps, "errorText">, never>;
|
|
10
13
|
export declare const ModeDropdownTrigger: import("styled-components").StyledComponent<({ children, ...rest }: any) => React.JSX.Element, any, {}, never>;
|
|
11
14
|
export declare const Range: import("styled-components").StyledComponent<({ children, ...rest }: any) => React.JSX.Element, any, {}, never>;
|
|
12
15
|
export declare const RangeFormColumn: import("styled-components").StyledComponent<"div", any, {}, never>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-date-range-picker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Date-Range-Picker UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -35,24 +35,25 @@
|
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@date-fns/upgrade": "^1.0.3",
|
|
38
|
-
"@synerise/ds-badge": "^1.0.
|
|
39
|
-
"@synerise/ds-button": "^1.1.
|
|
40
|
-
"@synerise/ds-button-group": "^1.0.
|
|
38
|
+
"@synerise/ds-badge": "^1.0.5",
|
|
39
|
+
"@synerise/ds-button": "^1.1.4",
|
|
40
|
+
"@synerise/ds-button-group": "^1.0.5",
|
|
41
41
|
"@synerise/ds-data-format": "^1.0.0",
|
|
42
|
-
"@synerise/ds-date-picker": "^1.0
|
|
43
|
-
"@synerise/ds-dropdown": "^1.0.
|
|
44
|
-
"@synerise/ds-
|
|
45
|
-
"@synerise/ds-
|
|
46
|
-
"@synerise/ds-
|
|
47
|
-
"@synerise/ds-input
|
|
48
|
-
"@synerise/ds-
|
|
49
|
-
"@synerise/ds-
|
|
50
|
-
"@synerise/ds-
|
|
51
|
-
"@synerise/ds-
|
|
52
|
-
"@synerise/ds-
|
|
53
|
-
"@synerise/ds-
|
|
54
|
-
"@synerise/ds-
|
|
55
|
-
"@synerise/ds-
|
|
42
|
+
"@synerise/ds-date-picker": "^1.1.0",
|
|
43
|
+
"@synerise/ds-dropdown": "^1.0.5",
|
|
44
|
+
"@synerise/ds-form-field": "^1.1.0",
|
|
45
|
+
"@synerise/ds-icon": "^1.4.0",
|
|
46
|
+
"@synerise/ds-inline-edit": "^1.0.6",
|
|
47
|
+
"@synerise/ds-input": "^1.1.0",
|
|
48
|
+
"@synerise/ds-input-number": "^1.1.0",
|
|
49
|
+
"@synerise/ds-list-item": "^1.0.5",
|
|
50
|
+
"@synerise/ds-manageable-list": "^1.2.5",
|
|
51
|
+
"@synerise/ds-scrollbar": "^1.0.5",
|
|
52
|
+
"@synerise/ds-select": "^1.1.0",
|
|
53
|
+
"@synerise/ds-slider": "^1.0.5",
|
|
54
|
+
"@synerise/ds-tag": "^1.1.4",
|
|
55
|
+
"@synerise/ds-time-picker": "^1.1.0",
|
|
56
|
+
"@synerise/ds-tooltip": "^1.1.4",
|
|
56
57
|
"@synerise/ds-utils": "^1.0.1",
|
|
57
58
|
"date-fns": "^2.16.1",
|
|
58
59
|
"date-fns-tz": "1.1.4",
|
|
@@ -69,5 +70,5 @@
|
|
|
69
70
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
70
71
|
"styled-components": "^5.3.3"
|
|
71
72
|
},
|
|
72
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "6735f9babfeef53122f54ca86cba5f581e8870d9"
|
|
73
74
|
}
|