@commercetools-uikit/date-input 19.10.0 → 19.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.
@@ -14,7 +14,6 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
14
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
15
15
  var _pt = require('prop-types');
16
16
  var _fillInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/fill');
17
- var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
18
17
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
19
18
  var react = require('react');
20
19
  var Downshift = require('downshift');
@@ -37,7 +36,6 @@ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$def
37
36
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
38
37
  var _pt__default = /*#__PURE__*/_interopDefault(_pt);
39
38
  var _fillInstanceProperty__default = /*#__PURE__*/_interopDefault(_fillInstanceProperty);
40
- var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
41
39
  var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
42
40
  var Downshift__default = /*#__PURE__*/_interopDefault(Downshift);
43
41
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
@@ -66,7 +64,7 @@ const DateInput = props => {
66
64
  process.env.NODE_ENV !== "production" ? utils.warning(typeof props.onChange === 'function', 'DateInput: `onChange` is required when input is not read only.') : void 0;
67
65
  }
68
66
  const onChange = props.onChange;
69
- const emit = react.useCallback(value => onChange === null || onChange === void 0 ? void 0 : onChange({
67
+ const emit = react.useCallback(value => onChange?.({
70
68
  target: {
71
69
  id: props.id,
72
70
  name: props.name,
@@ -76,8 +74,7 @@ const DateInput = props => {
76
74
  }
77
75
  }), [onChange, props.id, props.name]);
78
76
  const handleChange = react.useCallback(date => {
79
- var _inputRef$current;
80
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.setSelectionRange(0, 100);
77
+ inputRef.current?.setSelectionRange(0, 100);
81
78
  emit(date);
82
79
  }, [inputRef, emit]);
83
80
  const onBlur = props.onBlur;
@@ -90,11 +87,10 @@ const DateInput = props => {
90
87
  });
91
88
  }, [onBlur, props.id, props.name]);
92
89
  const showToday = () => {
93
- var _inputRef$current2;
94
90
  const today = calendarUtils.getToday();
95
91
  setCalendarDate(today);
96
92
  setHighlightedIndex(suggestedItems.length + calendarUtils.getDateInMonth(today) - 1);
97
- (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
93
+ inputRef.current?.focus();
98
94
  };
99
95
  const jumpMonth = function (amount) {
100
96
  let dayToHighlight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
@@ -182,7 +178,7 @@ const DateInput = props => {
182
178
  preventDownshiftDefault(event);
183
179
  return;
184
180
  }
185
- if (event.key === 'Enter' && (inputValue === null || inputValue === void 0 ? void 0 : _trimInstanceProperty__default["default"](inputValue).call(inputValue)) === '') {
181
+ if (event.key === 'Enter' && inputValue?.trim() === '') {
186
182
  clearSelection();
187
183
  }
188
184
  // ArrowDown
@@ -296,7 +292,7 @@ DateInput.isEmpty = value => value === '';
296
292
  var DateInput$1 = DateInput;
297
293
 
298
294
  // NOTE: This string will be replaced on build time with the package version.
299
- var version = "19.10.0";
295
+ var version = "19.11.0";
300
296
 
301
297
  exports["default"] = DateInput$1;
302
298
  exports.version = version;
@@ -14,7 +14,6 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
14
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
15
15
  require('prop-types');
16
16
  var _fillInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/fill');
17
- var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
18
17
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
19
18
  var react = require('react');
20
19
  var Downshift = require('downshift');
@@ -36,7 +35,6 @@ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_O
36
35
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
37
36
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
38
37
  var _fillInstanceProperty__default = /*#__PURE__*/_interopDefault(_fillInstanceProperty);
39
- var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
40
38
  var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
41
39
  var Downshift__default = /*#__PURE__*/_interopDefault(Downshift);
42
40
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
@@ -63,7 +61,7 @@ const DateInput = props => {
63
61
  const inputRef = react.useRef(null);
64
62
  if (!props.isReadOnly) ;
65
63
  const onChange = props.onChange;
66
- const emit = react.useCallback(value => onChange === null || onChange === void 0 ? void 0 : onChange({
64
+ const emit = react.useCallback(value => onChange?.({
67
65
  target: {
68
66
  id: props.id,
69
67
  name: props.name,
@@ -73,8 +71,7 @@ const DateInput = props => {
73
71
  }
74
72
  }), [onChange, props.id, props.name]);
75
73
  const handleChange = react.useCallback(date => {
76
- var _inputRef$current;
77
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.setSelectionRange(0, 100);
74
+ inputRef.current?.setSelectionRange(0, 100);
78
75
  emit(date);
79
76
  }, [inputRef, emit]);
80
77
  const onBlur = props.onBlur;
@@ -87,11 +84,10 @@ const DateInput = props => {
87
84
  });
88
85
  }, [onBlur, props.id, props.name]);
89
86
  const showToday = () => {
90
- var _inputRef$current2;
91
87
  const today = calendarUtils.getToday();
92
88
  setCalendarDate(today);
93
89
  setHighlightedIndex(suggestedItems.length + calendarUtils.getDateInMonth(today) - 1);
94
- (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
90
+ inputRef.current?.focus();
95
91
  };
96
92
  const jumpMonth = function (amount) {
97
93
  let dayToHighlight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
@@ -179,7 +175,7 @@ const DateInput = props => {
179
175
  preventDownshiftDefault(event);
180
176
  return;
181
177
  }
182
- if (event.key === 'Enter' && (inputValue === null || inputValue === void 0 ? void 0 : _trimInstanceProperty__default["default"](inputValue).call(inputValue)) === '') {
178
+ if (event.key === 'Enter' && inputValue?.trim() === '') {
183
179
  clearSelection();
184
180
  }
185
181
  // ArrowDown
@@ -275,7 +271,7 @@ DateInput.isEmpty = value => value === '';
275
271
  var DateInput$1 = DateInput;
276
272
 
277
273
  // NOTE: This string will be replaced on build time with the package version.
278
- var version = "19.10.0";
274
+ var version = "19.11.0";
279
275
 
280
276
  exports["default"] = DateInput$1;
281
277
  exports.version = version;
@@ -10,7 +10,6 @@ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
10
  import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
11
11
  import _pt from 'prop-types';
12
12
  import _fillInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/fill';
13
- import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
14
13
  import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
15
14
  import { useState, useRef, useCallback } from 'react';
16
15
  import Downshift from 'downshift';
@@ -45,7 +44,7 @@ const DateInput = props => {
45
44
  process.env.NODE_ENV !== "production" ? warning(typeof props.onChange === 'function', 'DateInput: `onChange` is required when input is not read only.') : void 0;
46
45
  }
47
46
  const onChange = props.onChange;
48
- const emit = useCallback(value => onChange === null || onChange === void 0 ? void 0 : onChange({
47
+ const emit = useCallback(value => onChange?.({
49
48
  target: {
50
49
  id: props.id,
51
50
  name: props.name,
@@ -55,8 +54,7 @@ const DateInput = props => {
55
54
  }
56
55
  }), [onChange, props.id, props.name]);
57
56
  const handleChange = useCallback(date => {
58
- var _inputRef$current;
59
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.setSelectionRange(0, 100);
57
+ inputRef.current?.setSelectionRange(0, 100);
60
58
  emit(date);
61
59
  }, [inputRef, emit]);
62
60
  const onBlur = props.onBlur;
@@ -69,11 +67,10 @@ const DateInput = props => {
69
67
  });
70
68
  }, [onBlur, props.id, props.name]);
71
69
  const showToday = () => {
72
- var _inputRef$current2;
73
70
  const today = getToday();
74
71
  setCalendarDate(today);
75
72
  setHighlightedIndex(suggestedItems.length + getDateInMonth(today) - 1);
76
- (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
73
+ inputRef.current?.focus();
77
74
  };
78
75
  const jumpMonth = function (amount) {
79
76
  let dayToHighlight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
@@ -161,7 +158,7 @@ const DateInput = props => {
161
158
  preventDownshiftDefault(event);
162
159
  return;
163
160
  }
164
- if (event.key === 'Enter' && (inputValue === null || inputValue === void 0 ? void 0 : _trimInstanceProperty(inputValue).call(inputValue)) === '') {
161
+ if (event.key === 'Enter' && inputValue?.trim() === '') {
165
162
  clearSelection();
166
163
  }
167
164
  // ArrowDown
@@ -275,6 +272,6 @@ DateInput.isEmpty = value => value === '';
275
272
  var DateInput$1 = DateInput;
276
273
 
277
274
  // NOTE: This string will be replaced on build time with the package version.
278
- var version = "19.10.0";
275
+ var version = "19.11.0";
279
276
 
280
277
  export { DateInput$1 as default, version };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/date-input",
3
3
  "description": "The `DateInput` component allows the user to select a date. It formats the selected date depending on the users' locale.",
4
- "version": "19.10.0",
4
+ "version": "19.12.0",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,19 +21,19 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.20.13",
23
23
  "@babel/runtime-corejs3": "^7.20.13",
24
- "@commercetools-uikit/accessible-button": "19.10.0",
25
- "@commercetools-uikit/calendar-time-utils": "19.10.0",
26
- "@commercetools-uikit/calendar-utils": "19.10.0",
27
- "@commercetools-uikit/constraints": "19.10.0",
28
- "@commercetools-uikit/design-system": "19.10.0",
29
- "@commercetools-uikit/hooks": "19.10.0",
30
- "@commercetools-uikit/icons": "19.10.0",
31
- "@commercetools-uikit/secondary-icon-button": "19.10.0",
32
- "@commercetools-uikit/select-utils": "19.10.0",
33
- "@commercetools-uikit/spacings-inline": "19.10.0",
34
- "@commercetools-uikit/text": "19.10.0",
35
- "@commercetools-uikit/tooltip": "19.10.0",
36
- "@commercetools-uikit/utils": "19.10.0",
24
+ "@commercetools-uikit/accessible-button": "19.12.0",
25
+ "@commercetools-uikit/calendar-time-utils": "19.12.0",
26
+ "@commercetools-uikit/calendar-utils": "19.12.0",
27
+ "@commercetools-uikit/constraints": "19.12.0",
28
+ "@commercetools-uikit/design-system": "19.12.0",
29
+ "@commercetools-uikit/hooks": "19.12.0",
30
+ "@commercetools-uikit/icons": "19.12.0",
31
+ "@commercetools-uikit/secondary-icon-button": "19.12.0",
32
+ "@commercetools-uikit/select-utils": "19.12.0",
33
+ "@commercetools-uikit/spacings-inline": "19.12.0",
34
+ "@commercetools-uikit/text": "19.12.0",
35
+ "@commercetools-uikit/tooltip": "19.12.0",
36
+ "@commercetools-uikit/utils": "19.12.0",
37
37
  "@emotion/react": "^11.10.5",
38
38
  "@emotion/styled": "^11.10.5",
39
39
  "downshift": "6.1.12",