@synerise/ds-date-range-picker 0.14.6 → 0.15.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 CHANGED
@@ -3,6 +3,56 @@
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.15.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.14.10...@synerise/ds-date-range-picker@0.15.0) (2022-09-05)
7
+
8
+
9
+ ### Features
10
+
11
+ * **core:** change i18n in storybook localStorage.setItem('lang', 'pt') ([622c644](https://github.com/Synerise/synerise-design/commit/622c6444c229e3909911b1b2f05a797026fd7d51))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.14.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.14.9...@synerise/ds-date-range-picker@0.14.10) (2022-08-31)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-date-range-picker
20
+
21
+
22
+
23
+
24
+
25
+ ## [0.14.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.14.8...@synerise/ds-date-range-picker@0.14.9) (2022-08-29)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **date-range-picker:** fix apply button active, validation ([eddbdd3](https://github.com/Synerise/synerise-design/commit/eddbdd3349cc1bc2bcd20da69947c9d572e85923))
31
+
32
+
33
+
34
+
35
+
36
+ ## [0.14.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.14.7...@synerise/ds-date-range-picker@0.14.8) (2022-08-29)
37
+
38
+ **Note:** Version bump only for package @synerise/ds-date-range-picker
39
+
40
+
41
+
42
+
43
+
44
+ ## [0.14.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.14.6...@synerise/ds-date-range-picker@0.14.7) (2022-08-29)
45
+
46
+
47
+ ### Bug Fixes
48
+
49
+ * **date-range-picker:** increase specificity input-group drp-addon ([2d1cb77](https://github.com/Synerise/synerise-design/commit/2d1cb7715c56ac2c2add8a3f7658bf17ab29b5a0))
50
+ * **ds-date-range-picker:** lifetime ([48e1032](https://github.com/Synerise/synerise-design/commit/48e1032fd102e5050908bf7ebb1293e16d5724cb))
51
+
52
+
53
+
54
+
55
+
6
56
  ## [0.14.6](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.14.5...@synerise/ds-date-range-picker@0.14.6) (2022-08-25)
7
57
 
8
58
  **Note:** Version bump only for package @synerise/ds-date-range-picker
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Props, State, AddonType } from './DateRangePicker.types';
3
- import { DateRange } from './date.types';
3
+ import { DateRange, RelativeDateRange } from './date.types';
4
4
  import { FilterDefinition, FilterValue } from './RangeFilter/RangeFilter.types';
5
5
  export declare class RawDateRangePicker extends React.PureComponent<Props, State> {
6
6
  static defaultProps: {
@@ -15,7 +15,7 @@ export declare class RawDateRangePicker extends React.PureComponent<Props, State
15
15
  componentDidUpdate(prevProps: Readonly<Props>): void;
16
16
  handleFilterCancel: () => void;
17
17
  handleFilterApply: (filter?: FilterValue<FilterDefinition> | undefined) => void;
18
- handleRangeChange: (range?: import("./date.types").AbsoluteDateRange | import("./date.types").RelativeDateRange | undefined) => void;
18
+ handleRangeChange: (range?: import("./date.types").AbsoluteDateRange | RelativeDateRange | undefined) => void;
19
19
  handleApply: () => void;
20
20
  handleModalOpenClick: () => void;
21
21
  handleRemoveFilterClick: () => void;
@@ -74,9 +74,13 @@ export var RawDateRangePicker = /*#__PURE__*/function (_React$PureComponent) {
74
74
  });
75
75
  }
76
76
 
77
+ if (range != null && range.key) {
78
+ // for validation, see `isValidAbsolute`, this key shouldn't be present
79
+ newValue.key = range == null ? void 0 : range.key;
80
+ }
81
+
77
82
  _this.setState({
78
83
  value: _objectSpread({}, newValue, {
79
- key: range == null ? void 0 : range.key,
80
84
  translationKey: range == null ? void 0 : range.translationKey
81
85
  })
82
86
  });
@@ -257,7 +261,17 @@ export var RawDateRangePicker = /*#__PURE__*/function (_React$PureComponent) {
257
261
  var validator = validate ? validate(value) : {
258
262
  valid: true
259
263
  };
260
- var isValid = key !== CONST.ALL_TIME && !!(from && to) && validator.valid;
264
+ var isValidAbsolute = !Object.keys(value).includes('key') && Boolean(from && to);
265
+
266
+ function isRelative(dateRange) {
267
+ var isLegacyCustom = Object.keys(value).includes('key') && key === undefined;
268
+ return CONST.RELATIVE_PRESETS.map(function (e) {
269
+ return e.key;
270
+ }).includes(dateRange.key) || isLegacyCustom;
271
+ }
272
+
273
+ var isValidRelative = isRelative(value) && Boolean(value.offset && value.duration);
274
+ var isValid = (isValidAbsolute || isValidRelative || key === CONST.ALL_TIME) && validator.valid;
261
275
  return /*#__PURE__*/React.createElement(Container, {
262
276
  className: containerClass
263
277
  }, /*#__PURE__*/React.createElement(RangePicker, {
@@ -10,6 +10,7 @@ import Button from '@synerise/ds-button';
10
10
  import * as React from 'react';
11
11
  import Menu from '@synerise/ds-menu';
12
12
  import { InputGroup } from '@synerise/ds-input';
13
+ // import 'antd/lib/input/style/index.css' // this style might be in imported scopes as we use input; not needed here, but worth to mention this
13
14
  export var Container = styled.div.withConfig({
14
15
  displayName: "RelativeRangePickerstyles__Container",
15
16
  componentId: "sc-17ul7sp-0"
@@ -39,7 +40,7 @@ export var CustomForm = styled.div.withConfig({
39
40
  export var InputSelectGroup = styled(InputGroup).withConfig({
40
41
  displayName: "RelativeRangePickerstyles__InputSelectGroup",
41
42
  componentId: "sc-17ul7sp-6"
42
- })(["&&{display:flex;align-items:center;.ant-input-number{display:flex;flex:1;}.ds-select-wrapper{width:122px;}height:32px;}"]);
43
+ })(["&&,.ant-input-group.ant-input-group-compact&&{display:flex;align-items:center;.ant-input-number{display:flex;flex:1;}.ds-select-wrapper{width:122px;}height:32px;}"]);
43
44
  export var ModeDropdownTrigger = styled(function (_ref) {
44
45
  var children = _ref.children,
45
46
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
package/dist/index.d.ts CHANGED
@@ -2,5 +2,6 @@ export { default as DailyDateFilter } from './RangeFilter/Filters/new/Daily/Dail
2
2
  export { default as WeeklyDateFilter } from './RangeFilter/Filters/new/Weekly/Weekly';
3
3
  export { default as MonthlyDateFilter } from './RangeFilter/Filters/MonthlyFilter/MonthlyFilter';
4
4
  export { RawDateRangePicker } from './RawDateRangePicker';
5
+ export * as utils from './utils';
5
6
  export * as CONST from './constants';
6
7
  export { default } from './DateRangePicker';
package/dist/index.js CHANGED
@@ -2,6 +2,8 @@ export { default as DailyDateFilter } from './RangeFilter/Filters/new/Daily/Dail
2
2
  export { default as WeeklyDateFilter } from './RangeFilter/Filters/new/Weekly/Weekly';
3
3
  export { default as MonthlyDateFilter } from './RangeFilter/Filters/MonthlyFilter/MonthlyFilter';
4
4
  export { RawDateRangePicker } from './RawDateRangePicker';
5
+ import * as _utils from './utils';
6
+ export { _utils as utils };
5
7
  import * as _CONST from './constants';
6
8
  export { _CONST as CONST };
7
9
  export { default } from './DateRangePicker';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-date-range-picker",
3
- "version": "0.14.6",
3
+ "version": "0.15.0",
4
4
  "description": "Date-Range-Picker UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,12 +33,12 @@
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
35
  "@date-fns/upgrade": "^1.0.3",
36
- "@synerise/ds-button": "^0.17.8",
37
- "@synerise/ds-date-picker": "^0.6.30",
38
- "@synerise/ds-icon": "^0.50.0",
39
- "@synerise/ds-manageable-list": "^0.23.25",
40
- "@synerise/ds-time-picker": "^0.6.29",
41
- "@synerise/ds-tooltip": "^0.11.16",
36
+ "@synerise/ds-button": "^0.17.9",
37
+ "@synerise/ds-date-picker": "^0.6.33",
38
+ "@synerise/ds-icon": "^0.51.0",
39
+ "@synerise/ds-manageable-list": "^0.23.28",
40
+ "@synerise/ds-time-picker": "^0.6.32",
41
+ "@synerise/ds-tooltip": "^0.11.17",
42
42
  "@synerise/ds-utils": "^0.19.0",
43
43
  "date-fns": "^2.16.1",
44
44
  "dayjs": "^1.8.35",
@@ -54,5 +54,5 @@
54
54
  "devDependencies": {
55
55
  "@types/ramda": "^0.27.14"
56
56
  },
57
- "gitHead": "c9530f0548fa244796b0c6b1ea5fa3d6330e84ea"
57
+ "gitHead": "428157b5217485a8d335e54a54e95bec93a768a7"
58
58
  }