@synerise/ds-factors 0.11.9 → 0.12.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,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
+ # [0.12.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.11.9...@synerise/ds-factors@0.12.0) (2022-04-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix eslint errors ([7cce9b9](https://github.com/Synerise/synerise-design/commit/7cce9b94f8dea533b3c36a0f0cfd5145d4737166))
12
+
13
+
14
+ ### Features
15
+
16
+ * **filter:** fixes bugs ([b862ddd](https://github.com/Synerise/synerise-design/commit/b862dddbce1293c2a5381663fc903bb574edd135))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [0.11.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.11.8...@synerise/ds-factors@0.11.9) (2022-03-30)
7
23
 
8
24
  **Note:** Version bump only for package @synerise/ds-factors
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { InputProps } from '../../Factors.types';
3
+ declare const DateRangeInput: React.FC<InputProps>;
4
+ export default DateRangeInput;
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import DateRangePicker from '@synerise/ds-date-range-picker';
3
+ import { useIntl } from 'react-intl';
4
+
5
+ var DateRangeInput = function DateRangeInput(_ref) {
6
+ var value = _ref.value,
7
+ onChange = _ref.onChange,
8
+ texts = _ref.texts;
9
+ var intl = useIntl();
10
+ var changeHandler = React.useCallback(function (date) {
11
+ onChange(date);
12
+ }, [onChange]);
13
+ return /*#__PURE__*/React.createElement(DateRangePicker, {
14
+ intl: intl,
15
+ onApply: changeHandler,
16
+ showTime: true,
17
+ showFilter: true,
18
+ value: value,
19
+ texts: texts.dateRangePicker,
20
+ relativeFuture: false,
21
+ relativeModes: ['PAST'],
22
+ showRelativePicker: true,
23
+ popoverProps: {
24
+ placement: 'bottomLeft'
25
+ }
26
+ });
27
+ };
28
+
29
+ export default DateRangeInput;
@@ -44,8 +44,9 @@ var ParameterInput = function ParameterInput(_ref) {
44
44
  onActivate && onActivate();
45
45
  }, [onParamsClick, onActivate]);
46
46
  React.useEffect(function () {
47
+ setDropdownVisible(Boolean(opened));
48
+
47
49
  if (opened) {
48
- setDropdownVisible(true);
49
50
  onParamsClick && onParamsClick();
50
51
  } // eslint-disable-next-line
51
52
 
package/dist/Factors.d.ts CHANGED
@@ -41,6 +41,11 @@ export declare const factorTypes: {
41
41
  name: string;
42
42
  input: React.FC<import("./Factors.types").InputProps>;
43
43
  };
44
+ dateRange: {
45
+ icon: JSX.Element;
46
+ name: string;
47
+ input: React.FC<import("./Factors.types").InputProps>;
48
+ };
44
49
  };
45
50
  declare const Factors: React.FC<FactorsProps>;
46
51
  export default Factors;
package/dist/Factors.js CHANGED
@@ -16,6 +16,7 @@ import FormulaInput from './FactorValue/Formula/Formula';
16
16
  import TextInput from './FactorValue/Text/Text';
17
17
  import ParameterInput from './FactorValue/Parameter/Parameter';
18
18
  import NumberInput from './FactorValue/Number/NumberInput';
19
+ import DateRangeInput from './FactorValue/DateRange/DateRange';
19
20
  export var factorTypes = {
20
21
  text: {
21
22
  icon: /*#__PURE__*/React.createElement(TextM, null),
@@ -56,6 +57,11 @@ export var factorTypes = {
56
57
  icon: /*#__PURE__*/React.createElement(Calendar2M, null),
57
58
  name: 'Date',
58
59
  input: DateInput
60
+ },
61
+ dateRange: {
62
+ icon: /*#__PURE__*/React.createElement(Calendar2M, null),
63
+ name: 'Date range',
64
+ input: DateRangeInput
59
65
  }
60
66
  }; // eslint-disable-next-line @typescript-eslint/no-empty-function
61
67
 
@@ -92,6 +98,216 @@ var Factors = function Factors(_ref) {
92
98
 
93
99
  var text = React.useMemo(function () {
94
100
  return _objectSpread({
101
+ dateRangePicker: {
102
+ after: formatMessage({
103
+ id: "DS.DATE-RANGE-PICKER.AFTER",
104
+ defaultMessage: 'after'
105
+ }),
106
+ allTime: formatMessage({
107
+ id: "DS.DATE-RANGE-PICKER.ALL-TIME",
108
+ defaultMessage: 'Lifetime'
109
+ }),
110
+ apply: formatMessage({
111
+ id: "DS.DATE-RANGE-PICKER.APPLY",
112
+ defaultMessage: 'Apply'
113
+ }),
114
+ before: formatMessage({
115
+ id: "DS.DATE-RANGE-PICKER.BEFORE",
116
+ defaultMessage: 'before'
117
+ }),
118
+ clear: formatMessage({
119
+ id: "DS.DATE-RANGE-PICKER.CLEAR",
120
+ defaultMessage: 'Clear'
121
+ }),
122
+ clearRange: formatMessage({
123
+ id: "DS.DATE-RANGE-PICKER.CLEAR-RANGE",
124
+ defaultMessage: ' Clear range'
125
+ }),
126
+ copyRange: formatMessage({
127
+ id: "DS.DATE-RANGE-PICKER.COPY-RANGE",
128
+ defaultMessage: 'Copy range'
129
+ }),
130
+ custom: formatMessage({
131
+ id: "DS.DATE-RANGE-PICKER.CUSTOM",
132
+ defaultMessage: 'Custom'
133
+ }),
134
+ days: formatMessage({
135
+ id: "DS.DATE-RANGE-PICKER.DAYS",
136
+ defaultMessage: 'Days'
137
+ }),
138
+ emptyDateError: formatMessage({
139
+ id: "DS.DATE-RANGE-PICKER.EMPTY-DATE-ERROR",
140
+ defaultMessage: 'Date cannot be empty'
141
+ }),
142
+ endDate: formatMessage({
143
+ id: "DS.DATE-RANGE-PICKER.END-DATE",
144
+ defaultMessage: 'End date'
145
+ }),
146
+ endDatePlaceholder: formatMessage({
147
+ id: "DS.DATE-RANGE-PICKER.END-DATE-PLACEHOLDER",
148
+ defaultMessage: 'End date'
149
+ }),
150
+ filter: formatMessage({
151
+ id: "DS.DATE-RANGE-PICKER.FILTER",
152
+ defaultMessage: 'Date filter'
153
+ }),
154
+ hours: formatMessage({
155
+ id: "DS.DATE-RANGE-PICKER.HOURS",
156
+ defaultMessage: 'Hours'
157
+ }),
158
+ last3Months: formatMessage({
159
+ id: "DS.DATE-RANGE-PICKER.LAST-3-MONTHS",
160
+ defaultMessage: 'Last 3 months'
161
+ }),
162
+ last6Months: formatMessage({
163
+ id: "DS.DATE-RANGE-PICKER.LAST-6-MONTHS",
164
+ defaultMessage: 'Last 6 months'
165
+ }),
166
+ last7Days: formatMessage({
167
+ id: "DS.DATE-RANGE-PICKER.LAST-7-DAYS",
168
+ defaultMessage: 'Last 7 days'
169
+ }),
170
+ last: formatMessage({
171
+ id: "DS.DATE-RANGE-PICKER.LAST",
172
+ defaultMessage: 'Last'
173
+ }),
174
+ lastMonth: formatMessage({
175
+ id: "DS.DATE-RANGE-PICKER.LAST-MONTH",
176
+ defaultMessage: 'Last month'
177
+ }),
178
+ lastWeek: formatMessage({
179
+ id: "DS.DATE-RANGE-PICKER.LAST-WEEK",
180
+ defaultMessage: 'Last week'
181
+ }),
182
+ lastYear: formatMessage({
183
+ id: "DS.DATE-RANGE-PICKER.LAST-YEAR",
184
+ defaultMessage: 'Last year'
185
+ }),
186
+ minutes: formatMessage({
187
+ id: "DS.DATE-RANGE-PICKER.MINUTES",
188
+ defaultMessage: 'Minutes'
189
+ }),
190
+ months: formatMessage({
191
+ id: "DS.DATE-RANGE-PICKER.MONTHS",
192
+ defaultMessage: 'Months'
193
+ }),
194
+ more: formatMessage({
195
+ id: "DS.DATE-RANGE-PICKER.MORE",
196
+ defaultMessage: 'More'
197
+ }),
198
+ next3Months: formatMessage({
199
+ id: "DS.DATE-RANGE-PICKER.NEXT-3-MONTHS",
200
+ defaultMessage: 'Next 3 months'
201
+ }),
202
+ next6Months: formatMessage({
203
+ id: "DS.DATE-RANGE-PICKER.NEXT-6-MONTHS",
204
+ defaultMessage: 'Next 6 months'
205
+ }),
206
+ next7Days: formatMessage({
207
+ id: "DS.DATE-RANGE-PICKER.NEXT-7-DAYS",
208
+ defaultMessage: 'Next 7 days'
209
+ }),
210
+ next: formatMessage({
211
+ id: "DS.DATE-RANGE-PICKER.NEXT",
212
+ defaultMessage: 'Next'
213
+ }),
214
+ nextMonth: formatMessage({
215
+ id: "DS.DATE-RANGE-PICKER.NEXT-MONTH",
216
+ defaultMessage: 'Next month'
217
+ }),
218
+ nextWeek: formatMessage({
219
+ id: "DS.DATE-RANGE-PICKER.NEXT-WEEK",
220
+ defaultMessage: 'Next week'
221
+ }),
222
+ nextYear: formatMessage({
223
+ id: "DS.DATE-RANGE-PICKER.NEXT-YEAR",
224
+ defaultMessage: 'Next year'
225
+ }),
226
+ now: formatMessage({
227
+ id: "DS.DATE-RANGE-PICKER.NOW",
228
+ defaultMessage: 'Now'
229
+ }),
230
+ pasteRange: formatMessage({
231
+ id: "DS.DATE-RANGE-PICKER.PASTE-RANGE",
232
+ defaultMessage: 'Paste range'
233
+ }),
234
+ relativeDateRange: formatMessage({
235
+ id: "DS.DATE-RANGE-PICKER.RELATIVE-DATE-RANGE",
236
+ defaultMessage: 'Relative date range'
237
+ }),
238
+ remove: formatMessage({
239
+ id: "DS.DATE-RANGE-PICKER.REMOVE",
240
+ defaultMessage: 'Remove'
241
+ }),
242
+ savedFiltersTrigger: formatMessage({
243
+ id: "DS.DATE-RANGE-PICKER.SAVED-FILTERS",
244
+ defaultMessage: 'Saved filters'
245
+ }),
246
+ seconds: formatMessage({
247
+ id: "DS.DATE-RANGE-PICKER.SECONDS",
248
+ defaultMessage: 'Seconds'
249
+ }),
250
+ selectDate: formatMessage({
251
+ id: "DS.DATE-RANGE-PICKER.SELECT-DATE",
252
+ defaultMessage: 'Select date'
253
+ }),
254
+ selectTime: formatMessage({
255
+ id: "DS.DATE-RANGE-PICKER.SELECT-TIME",
256
+ defaultMessage: 'Select time'
257
+ }),
258
+ since: formatMessage({
259
+ id: "DS.DATE-RANGE-PICKER.SINCE",
260
+ defaultMessage: 'Since'
261
+ }),
262
+ startDate: formatMessage({
263
+ id: "DS.DATE-RANGE-PICKER.START-DATE",
264
+ defaultMessage: 'Start date'
265
+ }),
266
+ startDatePlaceholder: formatMessage({
267
+ id: "DS.DATE-RANGE-PICKER.START-DATE-PLACEHOLDER",
268
+ defaultMessage: 'Start date'
269
+ }),
270
+ thisMonth: formatMessage({
271
+ id: "DS.DATE-RANGE-PICKER.THIS-MONTH",
272
+ defaultMessage: 'This month'
273
+ }),
274
+ thisWeek: formatMessage({
275
+ id: "DS.DATE-RANGE-PICKER.THIS-WEEK",
276
+ defaultMessage: 'This week'
277
+ }),
278
+ timestampLast: formatMessage({
279
+ id: "DS.DATE-RANGE-PICKER.TIMESTAMP-LAST",
280
+ defaultMessage: 'Last'
281
+ }),
282
+ timestampNext: formatMessage({
283
+ id: "DS.DATE-RANGE-PICKER.TIMESTAMP-NEXT",
284
+ defaultMessage: 'Next'
285
+ }),
286
+ timestampTill: formatMessage({
287
+ id: "DS.DATE-RANGE-PICKER.TIMESTAMP-TILL",
288
+ defaultMessage: 'till'
289
+ }),
290
+ today: formatMessage({
291
+ id: "DS.DATE-RANGE-PICKER.TODAY",
292
+ defaultMessage: 'Today'
293
+ }),
294
+ tomorrow: formatMessage({
295
+ id: "DS.DATE-RANGE-PICKER.TOMORROW",
296
+ defaultMessage: 'Tomorrow'
297
+ }),
298
+ weeks: formatMessage({
299
+ id: "DS.DATE-RANGE-PICKER.WEEKS",
300
+ defaultMessage: 'Weeks'
301
+ }),
302
+ years: formatMessage({
303
+ id: "DS.DATE-RANGE-PICKER.YEARS",
304
+ defaultMessage: 'Years'
305
+ }),
306
+ yesterday: formatMessage({
307
+ id: "DS.DATE-RANGE-PICKER.YESTERDAY",
308
+ defaultMessage: 'Yesterday'
309
+ })
310
+ },
95
311
  datePicker: {
96
312
  apply: formatMessage({
97
313
  id: 'DS.FACTORS.DATE_PICKER.APPLY',
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
- export declare const ALL_FACTOR_TYPES: readonly ["text", "number", "parameter", "contextParameter", "dynamicKey", "formula", "array", "date"];
2
+ import { DateFilter } from '@synerise/ds-date-range-picker/dist/date.types';
3
+ import { Texts as DateRangeTexts } from '@synerise/ds-date-range-picker/dist/DateRangePicker.types';
4
+ export declare const ALL_FACTOR_TYPES: readonly ["text", "number", "parameter", "contextParameter", "dynamicKey", "formula", "array", "date", "dateRange"];
3
5
  export declare type FactorType = typeof ALL_FACTOR_TYPES[number] | string;
4
6
  export declare type DynamicKeyValueType = {
5
7
  key: React.ReactText;
@@ -29,13 +31,14 @@ export declare type ParameterItem = {
29
31
  groupId: React.ReactText;
30
32
  icon?: React.ReactNode;
31
33
  };
32
- export declare type FactorValueType = string | number | Date | undefined | DynamicKeyValueType | FormulaValueType | ParameterValueType;
34
+ export declare type FactorValueType = string | number | Date | undefined | DynamicKeyValueType | FormulaValueType | ParameterValueType | Partial<DateFilter>;
33
35
  export declare type SelectedFactorType = {
34
36
  name: string;
35
37
  icon: React.ReactNode;
36
38
  input: React.ReactNode;
37
39
  };
38
40
  export declare type FactorsTexts = {
41
+ dateRangePicker: DateRangeTexts;
39
42
  datePicker: {
40
43
  apply: string;
41
44
  clearTooltip: string;
@@ -1 +1 @@
1
- export var ALL_FACTOR_TYPES = ['text', 'number', 'parameter', 'contextParameter', 'dynamicKey', 'formula', 'array', 'date'];
1
+ export var ALL_FACTOR_TYPES = ['text', 'number', 'parameter', 'contextParameter', 'dynamicKey', 'formula', 'array', 'date', 'dateRange'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-factors",
3
- "version": "0.11.9",
3
+ "version": "0.12.0",
4
4
  "description": "Factors UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -32,19 +32,20 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-autocomplete": "^0.4.8",
36
- "@synerise/ds-badge": "^0.6.1",
35
+ "@synerise/ds-autocomplete": "^0.4.9",
36
+ "@synerise/ds-badge": "^0.6.2",
37
37
  "@synerise/ds-button": "^0.17.2",
38
- "@synerise/ds-date-picker": "^0.6.15",
39
- "@synerise/ds-dropdown": "^0.17.15",
38
+ "@synerise/ds-date-picker": "^0.6.16",
39
+ "@synerise/ds-date-range-picker": "^0.12.11",
40
+ "@synerise/ds-dropdown": "^0.17.16",
40
41
  "@synerise/ds-icon": "^0.49.0",
41
- "@synerise/ds-inline-edit": "^0.6.9",
42
+ "@synerise/ds-inline-edit": "^0.6.10",
42
43
  "@synerise/ds-input": "^0.18.10",
43
- "@synerise/ds-input-number": "^0.6.8",
44
+ "@synerise/ds-input-number": "^0.6.9",
44
45
  "@synerise/ds-menu": "^0.13.2",
45
46
  "@synerise/ds-modal": "^0.15.9",
46
47
  "@synerise/ds-result": "^0.6.9",
47
- "@synerise/ds-tabs": "^0.13.9",
48
+ "@synerise/ds-tabs": "^0.13.10",
48
49
  "@synerise/ds-typography": "^0.12.2",
49
50
  "@synerise/ds-utils": "^0.19.0",
50
51
  "classnames": "^2.2.6",
@@ -54,5 +55,5 @@
54
55
  "@synerise/ds-core": "*",
55
56
  "react": ">=16.9.0 < 17.0.0"
56
57
  },
57
- "gitHead": "93d7c60a7fe73188d715fd52b9701f81fcb4e60a"
58
+ "gitHead": "5793ce09feb88b36cc8ca1923ddfcb272b889cb0"
58
59
  }