@commercetools-uikit/time-input 14.0.0 → 14.0.3

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/README.md CHANGED
@@ -49,23 +49,15 @@ export default Example;
49
49
  | `name` | `string` | | | Used as HTML name of the input component. |
50
50
  | `autoComplete` | `string` | | | Used as HTML autocomplete of the input component. |
51
51
  | `value` | `string` | | | Value of the input |
52
- | `onChange` | `Function`<br/>[See signature.](#signature-onChange) || | Called with an event holding the new value. |
53
- | `onBlur` | `FocusEventHandler` | | | Called when input is blurred&#xA;<br/> |
54
- | `onFocus` | `FocusEventHandler` | | | Called when input is focused&#xA;<br/>&#xA;Signature: `(event) => void` |
52
+ | `onChange` | `ChangeEventHandler` | | | Called with an event holding the new value. |
53
+ | `onBlur` | `FocusEventHandler` | | | Called when input is blurred |
54
+ | `onFocus` | `FocusEventHandler` | | | Called when input is focused |
55
55
  | `isAutofocussed` | `boolean` | | | Focus the input on initial render |
56
56
  | `isDisabled` | `boolean` | | | Indicates that the input cannot be modified (e.g not authorized, or changes currently saving). |
57
57
  | `placeholder` | `string` | | | Placeholder text for the input |
58
58
  | `hasError` | `boolean` | | | Indicates if the input has invalid values |
59
59
  | `isReadOnly` | `boolean` | | | Indicates that the field is displaying read-only content |
60
60
 
61
- ## Signatures
62
-
63
- ### Signature `onChange`
64
-
65
- ```ts
66
- (event: TEvent) => void
67
- ```
68
-
69
61
  ## `value`
70
62
 
71
63
  The value after the field has been blurred is always either valid or an empty string. The input automatically formats the value on blur by calling `onChange` with the formatted value - or with an empty value in case the input was not a valid time.
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
6
7
  var _pt = require('prop-types');
7
8
  var _padStartInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/pad-start');
8
9
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
@@ -190,14 +191,14 @@ ClearSection.propTypes = process.env.NODE_ENV !== "production" ? {
190
191
  onClear: _pt__default["default"].func.isRequired
191
192
  } : {};
192
193
  ClearSection.displayName = 'ClearSection';
193
-
194
- var TimeInputBody = function TimeInputBody(props) {
194
+ var TimeInputBody = /*#__PURE__*/react$1.forwardRef(function (props, ref) {
195
195
  var theme = react.useTheme();
196
196
  return jsxRuntime.jsx(Inline__default["default"], {
197
197
  alignItems: "center",
198
198
  children: jsxRuntime.jsxs(StyledInputContainer, {
199
199
  css: getInputContainerStyles(props, theme),
200
200
  children: [jsxRuntime.jsx("input", _objectSpread$1(_objectSpread$1({
201
+ ref: ref,
201
202
  css: getTimeInputStyles(props),
202
203
  id: props.id,
203
204
  name: props.name,
@@ -232,11 +233,7 @@ var TimeInputBody = function TimeInputBody(props) {
232
233
  })]
233
234
  })
234
235
  });
235
- };
236
-
237
- TimeInputBody.propTypes = process.env.NODE_ENV !== "production" ? {
238
- onClear: _pt__default["default"].func.isRequired
239
- } : {};
236
+ });
240
237
  TimeInputBody.displayName = 'TimeInputBody';
241
238
  var TimeInputBody$1 = TimeInputBody;
242
239
 
@@ -283,51 +280,60 @@ var hasMilliseconds = function hasMilliseconds(parsedTime) {
283
280
  var TimeInput = function TimeInput(props) {
284
281
  var id = hooks.useFieldId(props.id, sequentialId);
285
282
  var intl = reactIntl.useIntl();
286
- var prevLocale = hooks.usePrevious(intl.locale);
287
- var name = props.name,
288
- value = props.value,
289
- onBlur = props.onBlur,
290
- onChange = props.onChange;
291
- var emitChange = react$1.useCallback(function (nextValue) {
292
- var event = {
293
- target: {
294
- id: id,
295
- name: name,
296
- value: nextValue
297
- }
298
- };
299
- onChange(event);
300
- }, [id, name, onChange]);
301
- var handleBlur = react$1.useCallback(function (event) {
302
- // check formatting and reformat when necessary
303
- var formattedTime = value && TimeInput.toLocaleTime(value, intl.locale);
304
- if (formattedTime !== value) emitChange(formattedTime); // forward the onBlur call
305
-
306
- if (onBlur) onBlur(event);
307
- }, [intl.locale, value, onBlur, emitChange]);
308
- var onClear = react$1.useCallback(function () {
309
- return emitChange('');
310
- }, [emitChange]); // if locale has changed
311
-
312
- if (typeof prevLocale !== 'undefined' && prevLocale !== intl.locale) {
313
- emitChange(TimeInput.toLocaleTime(value, intl.locale));
283
+ var element = react$1.useRef(null); // Keep internal state to allow clearing the value manually (`onClear`).
284
+
285
+ var _useState = react$1.useState(props.value),
286
+ _useState2 = _slicedToArray(_useState, 2),
287
+ controlledValue = _useState2[0],
288
+ setControlledValue = _useState2[1];
289
+
290
+ if (!props.isReadOnly) {
291
+ process.env.NODE_ENV !== "production" ? utils.warning(typeof props.onChange === 'function', 'TimeInput: `onChange` is required when input is not read only.') : void 0;
314
292
  }
315
293
 
294
+ var onBlur = props.onBlur,
295
+ onChange = props.onChange;
296
+ var handleChange = react$1.useCallback(function (event) {
297
+ var rawValue = event.target.value;
298
+ setControlledValue(rawValue);
299
+ var formattedValue = TimeInput.toLocaleTime(rawValue, intl.locale);
300
+ event.target.value = formattedValue;
301
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
302
+ }, [intl.locale, onChange]);
303
+ var handleBlur = react$1.useCallback(function (event) {
304
+ var rawValue = event.target.value;
305
+ var formattedValue = TimeInput.toLocaleTime(rawValue, intl.locale);
306
+ event.target.value = formattedValue;
307
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
308
+ }, [intl.locale, onBlur]);
309
+ var handleClear = react$1.useCallback(function () {
310
+ var _element$current;
311
+
312
+ setControlledValue('');
313
+ (_element$current = element.current) === null || _element$current === void 0 ? void 0 : _element$current.dispatchEvent(new Event('change'));
314
+ }, []); // if locale has changed trigger a new change event
315
+
316
+ react$1.useEffect(function () {
317
+ var _element$current2;
318
+
319
+ (_element$current2 = element.current) === null || _element$current2 === void 0 ? void 0 : _element$current2.dispatchEvent(new Event('change'));
320
+ }, [intl.locale]);
316
321
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
317
322
  max: props.horizontalConstraint,
318
323
  children: jsxRuntime.jsx(TimeInputBody$1, _objectSpread(_objectSpread({
324
+ ref: element,
319
325
  id: id,
320
326
  name: props.name,
321
327
  autoComplete: props.autoComplete,
322
- value: props.value,
323
- onChange: props.onChange,
324
- onFocus: props.onFocus,
328
+ value: controlledValue,
329
+ onChange: handleChange,
325
330
  onBlur: handleBlur,
331
+ onFocus: props.onFocus,
326
332
  isAutofocussed: props.isAutofocussed,
327
333
  isDisabled: props.isDisabled,
328
334
  hasError: props.hasError,
329
335
  isReadOnly: props.isReadOnly,
330
- onClear: onClear,
336
+ onClear: handleClear,
331
337
  placeholder: typeof props.placeholder === 'string' ? props.placeholder : intl.formatMessage(messages.placeholder)
332
338
  }, utils.filterDataAttributes(props)), {}, {
333
339
  /* ARIA */
@@ -345,7 +351,7 @@ TimeInput.propTypes = process.env.NODE_ENV !== "production" ? {
345
351
  name: _pt__default["default"].string,
346
352
  autoComplete: _pt__default["default"].string,
347
353
  value: _pt__default["default"].string,
348
- onChange: _pt__default["default"].func.isRequired,
354
+ onChange: _pt__default["default"].func,
349
355
  onBlur: _pt__default["default"].func,
350
356
  onFocus: _pt__default["default"].func,
351
357
  isAutofocussed: _pt__default["default"].bool,
@@ -392,7 +398,7 @@ TimeInput.toLocaleTime = function (time, locale) {
392
398
  var TimeInput$1 = TimeInput;
393
399
 
394
400
  // NOTE: This string will be replaced on build time with the package version.
395
- var version = "14.0.0";
401
+ var version = "14.0.3";
396
402
 
397
403
  exports["default"] = TimeInput$1;
398
404
  exports.version = version;
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
6
7
  require('prop-types');
7
8
  var _padStartInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/pad-start');
8
9
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
@@ -171,14 +172,14 @@ var ClearSection = function ClearSection(props) {
171
172
  };
172
173
  ClearSection.propTypes = {};
173
174
  ClearSection.displayName = 'ClearSection';
174
-
175
- var TimeInputBody = function TimeInputBody(props) {
175
+ var TimeInputBody = /*#__PURE__*/react$1.forwardRef(function (props, ref) {
176
176
  var theme = react.useTheme();
177
177
  return jsxRuntime.jsx(Inline__default["default"], {
178
178
  alignItems: "center",
179
179
  children: jsxRuntime.jsxs(StyledInputContainer, {
180
180
  css: getInputContainerStyles(props, theme),
181
181
  children: [jsxRuntime.jsx("input", _objectSpread$1(_objectSpread$1({
182
+ ref: ref,
182
183
  css: getTimeInputStyles(props),
183
184
  id: props.id,
184
185
  name: props.name,
@@ -213,9 +214,7 @@ var TimeInputBody = function TimeInputBody(props) {
213
214
  })]
214
215
  })
215
216
  });
216
- };
217
-
218
- TimeInputBody.propTypes = {};
217
+ });
219
218
  TimeInputBody.displayName = 'TimeInputBody';
220
219
  var TimeInputBody$1 = TimeInputBody;
221
220
 
@@ -262,51 +261,58 @@ var hasMilliseconds = function hasMilliseconds(parsedTime) {
262
261
  var TimeInput = function TimeInput(props) {
263
262
  var id = hooks.useFieldId(props.id, sequentialId);
264
263
  var intl = reactIntl.useIntl();
265
- var prevLocale = hooks.usePrevious(intl.locale);
266
- var name = props.name,
267
- value = props.value,
268
- onBlur = props.onBlur,
264
+ var element = react$1.useRef(null); // Keep internal state to allow clearing the value manually (`onClear`).
265
+
266
+ var _useState = react$1.useState(props.value),
267
+ _useState2 = _slicedToArray(_useState, 2),
268
+ controlledValue = _useState2[0],
269
+ setControlledValue = _useState2[1];
270
+
271
+ if (!props.isReadOnly) ;
272
+
273
+ var onBlur = props.onBlur,
269
274
  onChange = props.onChange;
270
- var emitChange = react$1.useCallback(function (nextValue) {
271
- var event = {
272
- target: {
273
- id: id,
274
- name: name,
275
- value: nextValue
276
- }
277
- };
278
- onChange(event);
279
- }, [id, name, onChange]);
275
+ var handleChange = react$1.useCallback(function (event) {
276
+ var rawValue = event.target.value;
277
+ setControlledValue(rawValue);
278
+ var formattedValue = TimeInput.toLocaleTime(rawValue, intl.locale);
279
+ event.target.value = formattedValue;
280
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
281
+ }, [intl.locale, onChange]);
280
282
  var handleBlur = react$1.useCallback(function (event) {
281
- // check formatting and reformat when necessary
282
- var formattedTime = value && TimeInput.toLocaleTime(value, intl.locale);
283
- if (formattedTime !== value) emitChange(formattedTime); // forward the onBlur call
284
-
285
- if (onBlur) onBlur(event);
286
- }, [intl.locale, value, onBlur, emitChange]);
287
- var onClear = react$1.useCallback(function () {
288
- return emitChange('');
289
- }, [emitChange]); // if locale has changed
290
-
291
- if (typeof prevLocale !== 'undefined' && prevLocale !== intl.locale) {
292
- emitChange(TimeInput.toLocaleTime(value, intl.locale));
293
- }
294
-
283
+ var rawValue = event.target.value;
284
+ var formattedValue = TimeInput.toLocaleTime(rawValue, intl.locale);
285
+ event.target.value = formattedValue;
286
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
287
+ }, [intl.locale, onBlur]);
288
+ var handleClear = react$1.useCallback(function () {
289
+ var _element$current;
290
+
291
+ setControlledValue('');
292
+ (_element$current = element.current) === null || _element$current === void 0 ? void 0 : _element$current.dispatchEvent(new Event('change'));
293
+ }, []); // if locale has changed trigger a new change event
294
+
295
+ react$1.useEffect(function () {
296
+ var _element$current2;
297
+
298
+ (_element$current2 = element.current) === null || _element$current2 === void 0 ? void 0 : _element$current2.dispatchEvent(new Event('change'));
299
+ }, [intl.locale]);
295
300
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
296
301
  max: props.horizontalConstraint,
297
302
  children: jsxRuntime.jsx(TimeInputBody$1, _objectSpread(_objectSpread({
303
+ ref: element,
298
304
  id: id,
299
305
  name: props.name,
300
306
  autoComplete: props.autoComplete,
301
- value: props.value,
302
- onChange: props.onChange,
303
- onFocus: props.onFocus,
307
+ value: controlledValue,
308
+ onChange: handleChange,
304
309
  onBlur: handleBlur,
310
+ onFocus: props.onFocus,
305
311
  isAutofocussed: props.isAutofocussed,
306
312
  isDisabled: props.isDisabled,
307
313
  hasError: props.hasError,
308
314
  isReadOnly: props.isReadOnly,
309
- onClear: onClear,
315
+ onClear: handleClear,
310
316
  placeholder: typeof props.placeholder === 'string' ? props.placeholder : intl.formatMessage(messages.placeholder)
311
317
  }, utils.filterDataAttributes(props)), {}, {
312
318
  /* ARIA */
@@ -355,7 +361,7 @@ TimeInput.toLocaleTime = function (time, locale) {
355
361
  var TimeInput$1 = TimeInput;
356
362
 
357
363
  // NOTE: This string will be replaced on build time with the package version.
358
- var version = "14.0.0";
364
+ var version = "14.0.3";
359
365
 
360
366
  exports["default"] = TimeInput$1;
361
367
  exports.version = version;
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
2
+ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
2
3
  import _pt from 'prop-types';
3
4
  import _padStartInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/pad-start';
4
5
  import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
@@ -10,11 +11,11 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
10
11
  import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
11
12
  import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
12
13
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
13
- import { useCallback } from 'react';
14
+ import { forwardRef, useRef, useState, useCallback, useEffect } from 'react';
14
15
  import { defineMessages, useIntl } from 'react-intl';
15
16
  import Constraints from '@commercetools-uikit/constraints';
16
- import { filterDataAttributes, createSequentialId, parseTime } from '@commercetools-uikit/utils';
17
- import { useFieldId, usePrevious } from '@commercetools-uikit/hooks';
17
+ import { filterDataAttributes, createSequentialId, warning, parseTime } from '@commercetools-uikit/utils';
18
+ import { useFieldId } from '@commercetools-uikit/hooks';
18
19
  import { css, useTheme } from '@emotion/react';
19
20
  import { ClockIcon, CloseIcon } from '@commercetools-uikit/icons';
20
21
  import Inline from '@commercetools-uikit/spacings-inline';
@@ -168,14 +169,14 @@ ClearSection.propTypes = process.env.NODE_ENV !== "production" ? {
168
169
  onClear: _pt.func.isRequired
169
170
  } : {};
170
171
  ClearSection.displayName = 'ClearSection';
171
-
172
- var TimeInputBody = function TimeInputBody(props) {
172
+ var TimeInputBody = /*#__PURE__*/forwardRef(function (props, ref) {
173
173
  var theme = useTheme();
174
174
  return jsx(Inline, {
175
175
  alignItems: "center",
176
176
  children: jsxs(StyledInputContainer, {
177
177
  css: getInputContainerStyles(props, theme),
178
178
  children: [jsx("input", _objectSpread$1(_objectSpread$1({
179
+ ref: ref,
179
180
  css: getTimeInputStyles(props),
180
181
  id: props.id,
181
182
  name: props.name,
@@ -210,11 +211,7 @@ var TimeInputBody = function TimeInputBody(props) {
210
211
  })]
211
212
  })
212
213
  });
213
- };
214
-
215
- TimeInputBody.propTypes = process.env.NODE_ENV !== "production" ? {
216
- onClear: _pt.func.isRequired
217
- } : {};
214
+ });
218
215
  TimeInputBody.displayName = 'TimeInputBody';
219
216
  var TimeInputBody$1 = TimeInputBody;
220
217
 
@@ -261,51 +258,60 @@ var hasMilliseconds = function hasMilliseconds(parsedTime) {
261
258
  var TimeInput = function TimeInput(props) {
262
259
  var id = useFieldId(props.id, sequentialId);
263
260
  var intl = useIntl();
264
- var prevLocale = usePrevious(intl.locale);
265
- var name = props.name,
266
- value = props.value,
267
- onBlur = props.onBlur,
268
- onChange = props.onChange;
269
- var emitChange = useCallback(function (nextValue) {
270
- var event = {
271
- target: {
272
- id: id,
273
- name: name,
274
- value: nextValue
275
- }
276
- };
277
- onChange(event);
278
- }, [id, name, onChange]);
279
- var handleBlur = useCallback(function (event) {
280
- // check formatting and reformat when necessary
281
- var formattedTime = value && TimeInput.toLocaleTime(value, intl.locale);
282
- if (formattedTime !== value) emitChange(formattedTime); // forward the onBlur call
283
-
284
- if (onBlur) onBlur(event);
285
- }, [intl.locale, value, onBlur, emitChange]);
286
- var onClear = useCallback(function () {
287
- return emitChange('');
288
- }, [emitChange]); // if locale has changed
289
-
290
- if (typeof prevLocale !== 'undefined' && prevLocale !== intl.locale) {
291
- emitChange(TimeInput.toLocaleTime(value, intl.locale));
261
+ var element = useRef(null); // Keep internal state to allow clearing the value manually (`onClear`).
262
+
263
+ var _useState = useState(props.value),
264
+ _useState2 = _slicedToArray(_useState, 2),
265
+ controlledValue = _useState2[0],
266
+ setControlledValue = _useState2[1];
267
+
268
+ if (!props.isReadOnly) {
269
+ process.env.NODE_ENV !== "production" ? warning(typeof props.onChange === 'function', 'TimeInput: `onChange` is required when input is not read only.') : void 0;
292
270
  }
293
271
 
272
+ var onBlur = props.onBlur,
273
+ onChange = props.onChange;
274
+ var handleChange = useCallback(function (event) {
275
+ var rawValue = event.target.value;
276
+ setControlledValue(rawValue);
277
+ var formattedValue = TimeInput.toLocaleTime(rawValue, intl.locale);
278
+ event.target.value = formattedValue;
279
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
280
+ }, [intl.locale, onChange]);
281
+ var handleBlur = useCallback(function (event) {
282
+ var rawValue = event.target.value;
283
+ var formattedValue = TimeInput.toLocaleTime(rawValue, intl.locale);
284
+ event.target.value = formattedValue;
285
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
286
+ }, [intl.locale, onBlur]);
287
+ var handleClear = useCallback(function () {
288
+ var _element$current;
289
+
290
+ setControlledValue('');
291
+ (_element$current = element.current) === null || _element$current === void 0 ? void 0 : _element$current.dispatchEvent(new Event('change'));
292
+ }, []); // if locale has changed trigger a new change event
293
+
294
+ useEffect(function () {
295
+ var _element$current2;
296
+
297
+ (_element$current2 = element.current) === null || _element$current2 === void 0 ? void 0 : _element$current2.dispatchEvent(new Event('change'));
298
+ }, [intl.locale]);
294
299
  return jsx(Constraints.Horizontal, {
295
300
  max: props.horizontalConstraint,
296
301
  children: jsx(TimeInputBody$1, _objectSpread(_objectSpread({
302
+ ref: element,
297
303
  id: id,
298
304
  name: props.name,
299
305
  autoComplete: props.autoComplete,
300
- value: props.value,
301
- onChange: props.onChange,
302
- onFocus: props.onFocus,
306
+ value: controlledValue,
307
+ onChange: handleChange,
303
308
  onBlur: handleBlur,
309
+ onFocus: props.onFocus,
304
310
  isAutofocussed: props.isAutofocussed,
305
311
  isDisabled: props.isDisabled,
306
312
  hasError: props.hasError,
307
313
  isReadOnly: props.isReadOnly,
308
- onClear: onClear,
314
+ onClear: handleClear,
309
315
  placeholder: typeof props.placeholder === 'string' ? props.placeholder : intl.formatMessage(messages.placeholder)
310
316
  }, filterDataAttributes(props)), {}, {
311
317
  /* ARIA */
@@ -323,7 +329,7 @@ TimeInput.propTypes = process.env.NODE_ENV !== "production" ? {
323
329
  name: _pt.string,
324
330
  autoComplete: _pt.string,
325
331
  value: _pt.string,
326
- onChange: _pt.func.isRequired,
332
+ onChange: _pt.func,
327
333
  onBlur: _pt.func,
328
334
  onFocus: _pt.func,
329
335
  isAutofocussed: _pt.bool,
@@ -370,6 +376,6 @@ TimeInput.toLocaleTime = function (time, locale) {
370
376
  var TimeInput$1 = TimeInput;
371
377
 
372
378
  // NOTE: This string will be replaced on build time with the package version.
373
- var version = "14.0.0";
379
+ var version = "14.0.3";
374
380
 
375
381
  export { TimeInput$1 as default, version };
@@ -1,8 +1,5 @@
1
- import type { KeyboardEvent, MouseEvent } from 'react';
1
+ import { type KeyboardEvent, type MouseEvent } from 'react';
2
2
  import type { TTimeInputProps } from './time-input';
3
- declare type TTimeInputBodyProps = TTimeInputProps & {
4
- onClear: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
5
- };
6
3
  declare type TClearSectionProps = {
7
4
  isDisabled?: boolean;
8
5
  hasError?: boolean;
@@ -13,8 +10,7 @@ export declare const ClearSection: {
13
10
  (props: TClearSectionProps): import("@emotion/react/jsx-runtime").JSX.Element;
14
11
  displayName: string;
15
12
  };
16
- declare const TimeInputBody: {
17
- (props: TTimeInputBodyProps): import("@emotion/react/jsx-runtime").JSX.Element;
18
- displayName: string;
19
- };
13
+ declare const TimeInputBody: import("react").ForwardRefExoticComponent<TTimeInputProps & {
14
+ onClear: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
15
+ } & import("react").RefAttributes<HTMLInputElement>>;
20
16
  export default TimeInputBody;
@@ -1,11 +1,4 @@
1
- import { type FocusEventHandler } from 'react';
2
- declare type TEvent = {
3
- target: {
4
- id: string;
5
- name?: string;
6
- value: unknown;
7
- };
8
- };
1
+ import { type FocusEventHandler, type ChangeEventHandler } from 'react';
9
2
  export declare type TTimeInputProps = {
10
3
  id?: string;
11
4
  'aria-invalid'?: boolean;
@@ -14,9 +7,9 @@ export declare type TTimeInputProps = {
14
7
  name?: string;
15
8
  autoComplete?: string;
16
9
  value?: string;
17
- onChange: (event: TEvent) => void;
18
- onBlur?: FocusEventHandler;
19
- onFocus?: FocusEventHandler;
10
+ onChange?: ChangeEventHandler<HTMLInputElement>;
11
+ onBlur?: FocusEventHandler<HTMLInputElement>;
12
+ onFocus?: FocusEventHandler<HTMLInputElement>;
20
13
  isAutofocussed?: boolean;
21
14
  isDisabled?: boolean;
22
15
  placeholder?: string;
@@ -30,6 +23,6 @@ declare const TimeInput: {
30
23
  defaultProps: {
31
24
  horizontalConstraint: string;
32
25
  };
33
- toLocaleTime(time: string, locale: string): string;
26
+ toLocaleTime(time: string | undefined, locale: string): string;
34
27
  };
35
28
  export default TimeInput;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/time-input",
3
3
  "description": "The TimeInput component allows the user to select a time.",
4
- "version": "14.0.0",
4
+ "version": "14.0.3",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,14 +21,14 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.17.2",
23
23
  "@babel/runtime-corejs3": "^7.17.2",
24
- "@commercetools-uikit/accessible-button": "14.0.0",
25
- "@commercetools-uikit/constraints": "14.0.0",
24
+ "@commercetools-uikit/accessible-button": "14.0.1",
25
+ "@commercetools-uikit/constraints": "14.0.1",
26
26
  "@commercetools-uikit/design-system": "14.0.0",
27
- "@commercetools-uikit/hooks": "14.0.0",
28
- "@commercetools-uikit/icons": "14.0.0",
29
- "@commercetools-uikit/input-utils": "14.0.0",
30
- "@commercetools-uikit/spacings-inline": "14.0.0",
31
- "@commercetools-uikit/utils": "14.0.0",
27
+ "@commercetools-uikit/hooks": "14.0.3",
28
+ "@commercetools-uikit/icons": "14.0.1",
29
+ "@commercetools-uikit/input-utils": "14.0.2",
30
+ "@commercetools-uikit/spacings-inline": "14.0.1",
31
+ "@commercetools-uikit/utils": "14.0.1",
32
32
  "@emotion/is-prop-valid": "1.1.2",
33
33
  "@emotion/react": "^11.4.0",
34
34
  "@emotion/styled": "^11.3.0",