@atlaskit/datetime-picker 12.10.6 → 13.0.1

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/components/date-picker.js +6 -3
  3. package/dist/cjs/components/date-time-picker.js +9 -11
  4. package/dist/cjs/components/time-picker.js +9 -4
  5. package/dist/cjs/internal/clear-button.js +47 -0
  6. package/dist/cjs/internal/clear-indicator.js +37 -0
  7. package/dist/cjs/internal/parse-time.js +30 -12
  8. package/dist/es2019/components/date-picker.js +6 -3
  9. package/dist/es2019/components/date-time-picker.js +9 -11
  10. package/dist/es2019/components/time-picker.js +9 -4
  11. package/dist/es2019/internal/clear-button.js +38 -0
  12. package/dist/es2019/internal/clear-indicator.js +31 -0
  13. package/dist/es2019/internal/parse-time.js +29 -11
  14. package/dist/esm/components/date-picker.js +6 -3
  15. package/dist/esm/components/date-time-picker.js +9 -11
  16. package/dist/esm/components/time-picker.js +9 -4
  17. package/dist/esm/internal/clear-button.js +39 -0
  18. package/dist/esm/internal/clear-indicator.js +32 -0
  19. package/dist/esm/internal/parse-time.js +29 -11
  20. package/dist/types/components/date-picker.d.ts +4 -5
  21. package/dist/types/components/date-time-picker.d.ts +3 -4
  22. package/dist/types/components/time-picker.d.ts +4 -3
  23. package/dist/types/internal/clear-button.d.ts +17 -0
  24. package/dist/types/internal/clear-indicator.d.ts +10 -0
  25. package/dist/types/internal/parse-time.d.ts +9 -9
  26. package/dist/types-ts4.5/components/date-picker.d.ts +4 -5
  27. package/dist/types-ts4.5/components/date-time-picker.d.ts +3 -4
  28. package/dist/types-ts4.5/components/time-picker.d.ts +4 -3
  29. package/dist/types-ts4.5/internal/clear-button.d.ts +17 -0
  30. package/dist/types-ts4.5/internal/clear-indicator.d.ts +10 -0
  31. package/dist/types-ts4.5/internal/parse-time.d.ts +9 -9
  32. package/package.json +4 -4
@@ -26,11 +26,12 @@ import Select, { mergeStyles } from '@atlaskit/select';
26
26
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
27
27
  import { layers } from '@atlaskit/theme/constants';
28
28
  import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from '../internal';
29
+ import ClearIndicator from '../internal/clear-indicator';
29
30
  import FixedLayer from '../internal/fixed-layer';
30
31
  import { makeSingleValue } from '../internal/single-value';
31
32
  import { convertTokens } from './utils';
32
33
  var packageName = "@atlaskit/datetime-picker";
33
- var packageVersion = "12.10.6";
34
+ var packageVersion = "13.0.1";
34
35
  function getValidDate(iso) {
35
36
  var date = parseISO(iso);
36
37
  return isValid(date) ? {
@@ -430,7 +431,9 @@ var DatePicker = /*#__PURE__*/function (_Component) {
430
431
  DropdownIndicator: dropDownIcon,
431
432
  Menu: Menu,
432
433
  SingleValue: SingleValue
433
- }, !showClearIndicator && {
434
+ }, showClearIndicator ? {
435
+ ClearIndicator: ClearIndicator
436
+ } : {
434
437
  ClearIndicator: EmptyComponent
435
438
  });
436
439
  var _selectProps$styles = selectProps.styles,
@@ -477,7 +480,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
477
480
  menuIsOpen: menuIsOpen,
478
481
  closeMenuOnSelect: true,
479
482
  autoFocus: autoFocus,
480
- instanceId: id,
483
+ inputId: id,
481
484
  isDisabled: isDisabled,
482
485
  onBlur: this.onSelectBlur,
483
486
  onFocus: this.onSelectFocus,
@@ -16,16 +16,16 @@ import { css, jsx } from '@emotion/react';
16
16
  import { format, isValid, parseISO } from 'date-fns';
17
17
  import pick from 'lodash/pick';
18
18
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
19
- import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
20
19
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
21
20
  import { mergeStyles } from '@atlaskit/select';
22
21
  import { B100, N0, N100, N20, N30, N500, N70, R400 } from '@atlaskit/theme/colors';
23
22
  import { defaultTimes, formatDateTimeZoneIntoIso } from '../internal';
23
+ import ClearButton from '../internal/clear-button';
24
24
  import DatePicker from './date-picker';
25
25
  import TimePicker from './time-picker';
26
26
  import { convertTokens } from './utils';
27
27
  var packageName = "@atlaskit/datetime-picker";
28
- var packageVersion = "12.10.6";
28
+ var packageVersion = "13.0.1";
29
29
  var isInvalidBorderStyles = css({
30
30
  borderColor: "var(--ds-border-danger, ".concat(R400, ")")
31
31
  });
@@ -299,9 +299,11 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
299
299
  // Don't use Date or TimePicker's because they can't be customised
300
300
  var isClearable = Boolean(dateValue || timeValue);
301
301
  var notFocusedOrIsDisabled = !(isFocused || isDisabled);
302
+ var ariaLabelledbyId = id && "label--".concat(id);
302
303
  return jsx("div", _extends({
303
304
  css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles), bothProps.appearance === 'none' && noBgStyles]
304
305
  }, innerProps, {
306
+ "aria-labelledby": innerProps['aria-labelledby'] || ariaLabelledbyId,
305
307
  "data-testid": testId
306
308
  }), jsx("input", {
307
309
  name: name,
@@ -332,17 +334,13 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
332
334
  timeFormat: timeFormat,
333
335
  locale: locale,
334
336
  testId: testId && "".concat(testId, "--timepicker")
335
- }, timePickerProps))), isClearable && !isDisabled ? jsx("button", {
336
- css: iconContainerStyles,
337
+ }, timePickerProps))), isClearable && !isDisabled ? jsx(ClearButton, {
338
+ inputId: id,
339
+ buttonStyles: iconContainerStyles,
337
340
  onClick: this.onClear,
338
341
  "data-testid": testId && "".concat(testId, "--icon--container"),
339
- tabIndex: -1,
340
- type: "button"
341
- }, jsx(SelectClearIcon, {
342
- size: "small",
343
- primaryColor: "inherit",
344
- label: "clear"
345
- })) : null);
342
+ primaryColor: "inherit"
343
+ }) : null);
346
344
  }
347
345
  }]);
348
346
  return DateTimePicker;
@@ -24,12 +24,13 @@ import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/sele
24
24
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
25
25
  import { gridSize } from '@atlaskit/theme/constants';
26
26
  import { defaultTimeFormat, defaultTimes, EmptyComponent, placeholderDatetime } from '../internal';
27
+ import ClearIndicator from '../internal/clear-indicator';
27
28
  import FixedLayer from '../internal/fixed-layer';
28
29
  import parseTime from '../internal/parse-time';
29
30
  import { makeSingleValue } from '../internal/single-value';
30
31
  import { convertTokens } from './utils';
31
32
  var packageName = "@atlaskit/datetime-picker";
32
- var packageVersion = "12.10.6";
33
+ var packageVersion = "13.0.1";
33
34
  var menuStyles = {
34
35
  /* Need to remove default absolute positioning as that causes issues with position fixed */
35
36
  position: 'static',
@@ -130,7 +131,9 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
130
131
  return; // do nothing, the main validation should happen in the form
131
132
  }
132
133
 
133
- var formattedValue = format(sanitizedInput, 'HH:mm') || '';
134
+ var includesSeconds = !!(_timeFormat2 && /[:.]?(s|ss)/.test(_timeFormat2));
135
+ var formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
136
+ var formattedValue = format(sanitizedInput, formatFormat) || '';
134
137
  _this.setState({
135
138
  value: formattedValue
136
139
  });
@@ -269,8 +272,10 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
269
272
  DropdownIndicator: EmptyComponent,
270
273
  Menu: FixedLayerMenu,
271
274
  SingleValue: SingleValue
272
- }, hideIcon && {
275
+ }, hideIcon ? {
273
276
  ClearIndicator: EmptyComponent
277
+ } : {
278
+ ClearIndicator: ClearIndicator
274
279
  });
275
280
  var renderIconContainer = Boolean(!hideIcon && value);
276
281
  var mergedStyles = mergeStyles(selectStyles, {
@@ -304,7 +309,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
304
309
  appearance: appearance,
305
310
  autoFocus: autoFocus,
306
311
  components: selectComponents,
307
- instanceId: id,
312
+ inputId: id,
308
313
  isClearable: true,
309
314
  isDisabled: isDisabled,
310
315
  menuIsOpen: isOpen && !isDisabled,
@@ -0,0 +1,39 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
4
+ /**
5
+ * __Clear button__
6
+ */
7
+ var ClearButton = function ClearButton(_ref) {
8
+ var inputId = _ref.inputId,
9
+ _ref$iconSize = _ref.iconSize,
10
+ iconSize = _ref$iconSize === void 0 ? 'small' : _ref$iconSize,
11
+ _ref$label = _ref.label,
12
+ label = _ref$label === void 0 ? 'Clear' : _ref$label,
13
+ primaryColor = _ref.primaryColor,
14
+ buttonStyles = _ref.buttonStyles,
15
+ dataTestId = _ref.dataTestId,
16
+ onClick = _ref.onClick;
17
+ var labelId = inputId && "label--".concat(inputId);
18
+ var clearButtonId = inputId && "clear-btn--".concat(inputId);
19
+ return jsx("button", {
20
+ css: buttonStyles,
21
+ type: "button",
22
+ tabIndex: -1,
23
+ "data-testid": "".concat(dataTestId, "--clear--btn"),
24
+ onClick: onClick
25
+ }, jsx("span", {
26
+ hidden: true,
27
+ id: clearButtonId
28
+ }, "Clear"), jsx("span", {
29
+ style: {
30
+ display: 'flex'
31
+ },
32
+ "aria-labelledby": inputId ? "".concat(clearButtonId, " ").concat(labelId) : "".concat(clearButtonId)
33
+ }, jsx(SelectClearIcon, {
34
+ size: iconSize,
35
+ label: inputId ? '' : label,
36
+ primaryColor: primaryColor
37
+ })));
38
+ };
39
+ export default ClearButton;
@@ -0,0 +1,32 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ /** @jsx jsx */
5
+
6
+ import { css, jsx } from '@emotion/react';
7
+ import { components } from '@atlaskit/select';
8
+ import ClearButton from './clear-button';
9
+ var buttonStyles = css({
10
+ display: 'flex',
11
+ alignItems: 'center',
12
+ all: 'unset',
13
+ outline: 'revert'
14
+ });
15
+
16
+ /**
17
+ * __Clear indicator__
18
+ * Overwrites the default `ClearIndicator` button with custom styles and attributes
19
+ *
20
+ */
21
+ var ClearIndicator = function ClearIndicator(props) {
22
+ return jsx(components.ClearIndicator, _objectSpread(_objectSpread({}, props), {}, {
23
+ innerProps: _objectSpread(_objectSpread({}, props.innerProps), {}, {
24
+ 'aria-hidden': 'false'
25
+ })
26
+ }), jsx(ClearButton, {
27
+ buttonStyles: buttonStyles,
28
+ inputId: props.selectProps.inputId,
29
+ dataTestId: props.selectProps.testId
30
+ }));
31
+ };
32
+ export default ClearIndicator;
@@ -13,16 +13,31 @@ var map24 = {
13
13
  '11': '23'
14
14
  };
15
15
  export function isValid(timeString) {
16
- var time = timeString.trim().match(/(\d+)(?::(\d\d))?\s*(a|p)?/i);
17
- var time24hr = timeString.trim().match(/(\d\d)[:.]?(\d\d)/);
16
+ /**
17
+ * Regex match for `12:34`, `12:34:56`, `1:23:56 p`, `1:23:56PM`, and a bit more…
18
+ */
19
+ var time = timeString.trim().match(/([012]?[\d])(?::([0-5][\d]))?(?::([0-5][\d]))?\s*([ap]m?)?/i);
20
+
21
+ /**
22
+ * Regex match for `1234`, `12:34`, `12.34`, `123456`, `12:34:56`, `12.34.56`
23
+ */
24
+ var time24hr = timeString.trim().match(/([012][\d])[:.]?([0-5][\d])([:.]?([0-5][\d]))?/);
25
+
26
+ /**
27
+ * Convert `2:34:56 pm` down to `23456`
28
+ */
18
29
  var num = timeString.replace(/[^0-9]/g, '');
30
+ var includesSeconds = time && time[1] !== undefined && time[2] !== undefined && time[3] !== undefined || time24hr && time24hr[1] !== undefined && time24hr[2] !== undefined && time24hr[4] !== undefined;
19
31
  if (!time && !time24hr) {
20
32
  return false;
21
33
  }
22
34
  if (time && !time[1]) {
23
35
  return false;
24
36
  }
25
- if (num.length > 4) {
37
+ if (num.length > 6) {
38
+ return false;
39
+ }
40
+ if (num.length > 4 && !includesSeconds) {
26
41
  return false;
27
42
  }
28
43
  if (num.length === 2 && parseInt(num, 10) > 12) {
@@ -31,7 +46,7 @@ export function isValid(timeString) {
31
46
  return true;
32
47
  }
33
48
  export function removeSpacer(time) {
34
- return time.replace(/[:.]/, '');
49
+ return time.replace(/[:.]/g, '');
35
50
  }
36
51
  export function formatSemi24(time) {
37
52
  if (time.length === 1) {
@@ -40,7 +55,7 @@ export function formatSemi24(time) {
40
55
  if (time.length === 2) {
41
56
  return "".concat(time, "00");
42
57
  }
43
- if (time.length === 3) {
58
+ if (time.length === 3 || time.length === 5) {
44
59
  return "0".concat(time);
45
60
  }
46
61
  return time;
@@ -57,31 +72,34 @@ export function checkHour(hour, meridiem) {
57
72
  }
58
73
  return hour;
59
74
  }
60
- export function checkMinute(minute) {
61
- if (minute > '59') {
75
+ export function checkMinuteSecond(value) {
76
+ if (value > '59') {
62
77
  return null;
63
78
  }
64
- return minute;
79
+ return value;
65
80
  }
66
81
  export function convertTo24hrTime(time) {
67
82
  var timeArray = time.toLowerCase().split(/(p|a)/i);
68
83
  var meridiem = timeArray[1];
69
84
  var semi24 = formatSemi24(timeArray[0].trim());
70
85
  var hour = checkHour(semi24.substring(0, 2), meridiem);
71
- var minute = checkMinute(semi24.substring(2, 4));
86
+ var minute = checkMinuteSecond(semi24.substring(2, 4));
87
+ var seconds = semi24.length === 6 && checkMinuteSecond(semi24.substring(4, 6));
72
88
  if (!hour || !minute) {
73
89
  return null;
74
90
  }
75
91
  return {
76
92
  hour: parseInt(hour, 10),
77
- minute: parseInt(minute, 10)
93
+ minute: parseInt(minute, 10),
94
+ seconds: parseInt(seconds || '0', 10) || 0
78
95
  };
79
96
  }
80
97
  export function assignToDate(time) {
81
98
  var dateTime = new Date();
82
99
  dateTime.setHours(time.hour);
83
100
  dateTime.setMinutes(time.minute);
84
- dateTime.setSeconds(0, 0);
101
+ // milliseconds is not supported
102
+ dateTime.setSeconds(time.seconds || 0, 0);
85
103
  return dateTime;
86
104
  }
87
105
  export default function (time) {
@@ -50,9 +50,8 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
50
50
  */
51
51
  icon?: React.ComponentType<DropdownIndicatorProps<OptionType>>;
52
52
  /**
53
- * The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`.
54
- *
55
- * Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
53
+ * Set the id of the field.
54
+ * Associates a `<label></label>` with the field.
56
55
  */
57
56
  id?: string;
58
57
  /**
@@ -268,7 +267,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
268
267
  render(): jsx.JSX.Element;
269
268
  }
270
269
  export { DatePicker as DatePickerWithoutAnalytics };
271
- declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "placeholder" | "maxDate" | "minDate" | "isOpen" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "dateFormat" | "weekStartDay"> & Partial<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "icon" | "disabled" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "disabledDateFilter" | "name" | "spacing" | "isInvalid" | "hideIcon" | "locale">> & Partial<Pick<{
270
+ declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "value" | "placeholder" | "testId" | "maxDate" | "minDate" | "isOpen" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "dateFormat" | "weekStartDay"> & Partial<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "autoFocus" | "disabled" | "name" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "appearance" | "innerProps" | "selectProps" | "isDisabled" | "icon" | "defaultIsOpen" | "disabledDateFilter" | "spacing" | "isInvalid" | "hideIcon" | "locale">> & Partial<Pick<{
272
271
  appearance: Appearance;
273
272
  autoFocus: boolean;
274
273
  defaultIsOpen: boolean;
@@ -288,5 +287,5 @@ declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit
288
287
  selectProps: {};
289
288
  spacing: Spacing;
290
289
  locale: string;
291
- }, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "icon" | "disabled" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "value" | "id" | "key" | "defaultValue" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "disabledDateFilter" | "maxDate" | "minDate" | "isOpen" | "name" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "spacing" | "isInvalid" | "hideIcon" | "dateFormat" | "locale" | "weekStartDay" | "analyticsContext"> & import("react").RefAttributes<any>>;
290
+ }, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "autoFocus" | "disabled" | "name" | "value" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "testId" | "appearance" | "innerProps" | "selectProps" | "isDisabled" | "icon" | "defaultIsOpen" | "disabledDateFilter" | "maxDate" | "minDate" | "isOpen" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "spacing" | "isInvalid" | "hideIcon" | "dateFormat" | "locale" | "weekStartDay" | "analyticsContext"> & import("react").RefAttributes<any>>;
292
291
  export default _default;
@@ -22,8 +22,7 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
22
22
  */
23
23
  defaultValue?: string;
24
24
  /**
25
- * The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`.
26
- * Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
25
+ * Set the id of the field.
27
26
  */
28
27
  id?: string;
29
28
  /**
@@ -194,7 +193,7 @@ declare class DateTimePicker extends React.Component<DateTimePickerProps, State>
194
193
  render(): jsx.JSX.Element;
195
194
  }
196
195
  export { DateTimePicker as DateTimePickerWithoutAnalytics };
197
- declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "innerProps" | "isDisabled" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "name" | "spacing" | "isInvalid" | "locale" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
196
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "value" | "testId" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "autoFocus" | "name" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "appearance" | "innerProps" | "isDisabled" | "spacing" | "isInvalid" | "locale" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
198
197
  appearance: string;
199
198
  autoFocus: boolean;
200
199
  isDisabled: boolean;
@@ -214,5 +213,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimeP
214
213
  times: string[];
215
214
  spacing: string;
216
215
  locale: string;
217
- }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "innerProps" | "isDisabled" | "appearance" | "value" | "id" | "key" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "name" | "spacing" | "isInvalid" | "dateFormat" | "locale" | "analyticsContext" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "parseValue" | "datePickerSelectProps" | "timePickerSelectProps"> & React.RefAttributes<any>>;
216
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "key" | "autoFocus" | "name" | "value" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "testId" | "appearance" | "innerProps" | "isDisabled" | "spacing" | "isInvalid" | "dateFormat" | "locale" | "analyticsContext" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "parseValue" | "datePickerSelectProps" | "timePickerSelectProps"> & React.RefAttributes<any>>;
218
217
  export default _default;
@@ -27,7 +27,8 @@ export interface TimePickerBaseProps extends WithAnalyticsEventsProps {
27
27
  */
28
28
  formatDisplayLabel?: (time: string, timeFormat: string) => string;
29
29
  /**
30
- * The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`. Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
30
+ * Set the id of the field.
31
+ * Associates a `<label></label>` with the field.
31
32
  */
32
33
  id?: string;
33
34
  /**
@@ -188,7 +189,7 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
188
189
  render(): JSX.Element;
189
190
  }
190
191
  export { TimePicker as TimePickerWithoutAnalytics };
191
- declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "placeholder" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "name" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "timeIsEditable">> & Partial<Pick<{
192
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "value" | "placeholder" | "testId" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "autoFocus" | "name" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "appearance" | "innerProps" | "selectProps" | "isDisabled" | "defaultIsOpen" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "timeIsEditable">> & Partial<Pick<{
192
193
  appearance: Appearance;
193
194
  autoFocus: boolean;
194
195
  defaultIsOpen: boolean;
@@ -208,5 +209,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePicke
208
209
  times: string[];
209
210
  timeIsEditable: boolean;
210
211
  locale: string;
211
- }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "value" | "id" | "key" | "defaultValue" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "analyticsContext" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<any>>;
212
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "key" | "autoFocus" | "name" | "value" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "testId" | "appearance" | "innerProps" | "selectProps" | "isDisabled" | "defaultIsOpen" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "analyticsContext" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<any>>;
212
213
  export default _default;
@@ -0,0 +1,17 @@
1
+ /** @jsx jsx */
2
+ import { jsx, SerializedStyles } from '@emotion/react';
3
+ import { Size } from '@atlaskit/icon';
4
+ interface ClearButtonProps {
5
+ inputId?: string;
6
+ iconSize?: Size;
7
+ primaryColor?: string;
8
+ label?: string;
9
+ buttonStyles?: SerializedStyles;
10
+ dataTestId?: string;
11
+ onClick?: () => void;
12
+ }
13
+ /**
14
+ * __Clear button__
15
+ */
16
+ declare const ClearButton: ({ inputId, iconSize, label, primaryColor, buttonStyles, dataTestId, onClick, }: ClearButtonProps) => jsx.JSX.Element;
17
+ export default ClearButton;
@@ -0,0 +1,10 @@
1
+ /** @jsx jsx */
2
+ import { FC } from 'react';
3
+ import { ClearIndicatorProps } from '@atlaskit/select';
4
+ /**
5
+ * __Clear indicator__
6
+ * Overwrites the default `ClearIndicator` button with custom styles and attributes
7
+ *
8
+ */
9
+ declare const ClearIndicator: FC<ClearIndicatorProps<any>>;
10
+ export default ClearIndicator;
@@ -1,14 +1,14 @@
1
+ type TimeObject = {
2
+ hour: number;
3
+ minute: number;
4
+ seconds: number;
5
+ };
1
6
  export declare function isValid(timeString: string): boolean;
2
7
  export declare function removeSpacer(time: string): string;
3
8
  export declare function formatSemi24(time: string): string;
4
9
  export declare function checkHour(hour: string, meridiem: string): string | null;
5
- export declare function checkMinute(minute: string): string | null;
6
- export declare function convertTo24hrTime(time: string): {
7
- hour: number;
8
- minute: number;
9
- } | null;
10
- export declare function assignToDate(time: {
11
- hour: number;
12
- minute: number;
13
- }): Date;
10
+ export declare function checkMinuteSecond(value: string): string | null;
11
+ export declare function convertTo24hrTime(time: string): TimeObject | null;
12
+ export declare function assignToDate(time: TimeObject): Date;
14
13
  export default function (time: string): string | Date;
14
+ export {};
@@ -50,9 +50,8 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
50
50
  */
51
51
  icon?: React.ComponentType<DropdownIndicatorProps<OptionType>>;
52
52
  /**
53
- * The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`.
54
- *
55
- * Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
53
+ * Set the id of the field.
54
+ * Associates a `<label></label>` with the field.
56
55
  */
57
56
  id?: string;
58
57
  /**
@@ -268,7 +267,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
268
267
  render(): jsx.JSX.Element;
269
268
  }
270
269
  export { DatePicker as DatePickerWithoutAnalytics };
271
- declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "placeholder" | "maxDate" | "minDate" | "isOpen" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "dateFormat" | "weekStartDay"> & Partial<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "icon" | "disabled" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "disabledDateFilter" | "name" | "spacing" | "isInvalid" | "hideIcon" | "locale">> & Partial<Pick<{
270
+ declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "value" | "placeholder" | "testId" | "maxDate" | "minDate" | "isOpen" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "dateFormat" | "weekStartDay"> & Partial<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "autoFocus" | "disabled" | "name" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "appearance" | "innerProps" | "selectProps" | "isDisabled" | "icon" | "defaultIsOpen" | "disabledDateFilter" | "spacing" | "isInvalid" | "hideIcon" | "locale">> & Partial<Pick<{
272
271
  appearance: Appearance;
273
272
  autoFocus: boolean;
274
273
  defaultIsOpen: boolean;
@@ -288,5 +287,5 @@ declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit
288
287
  selectProps: {};
289
288
  spacing: Spacing;
290
289
  locale: string;
291
- }, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "icon" | "disabled" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "value" | "id" | "key" | "defaultValue" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "disabledDateFilter" | "maxDate" | "minDate" | "isOpen" | "name" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "spacing" | "isInvalid" | "hideIcon" | "dateFormat" | "locale" | "weekStartDay" | "analyticsContext"> & import("react").RefAttributes<any>>;
290
+ }, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "autoFocus" | "disabled" | "name" | "value" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "testId" | "appearance" | "innerProps" | "selectProps" | "isDisabled" | "icon" | "defaultIsOpen" | "disabledDateFilter" | "maxDate" | "minDate" | "isOpen" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "spacing" | "isInvalid" | "hideIcon" | "dateFormat" | "locale" | "weekStartDay" | "analyticsContext"> & import("react").RefAttributes<any>>;
292
291
  export default _default;
@@ -22,8 +22,7 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
22
22
  */
23
23
  defaultValue?: string;
24
24
  /**
25
- * The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`.
26
- * Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
25
+ * Set the id of the field.
27
26
  */
28
27
  id?: string;
29
28
  /**
@@ -194,7 +193,7 @@ declare class DateTimePicker extends React.Component<DateTimePickerProps, State>
194
193
  render(): jsx.JSX.Element;
195
194
  }
196
195
  export { DateTimePicker as DateTimePickerWithoutAnalytics };
197
- declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "innerProps" | "isDisabled" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "name" | "spacing" | "isInvalid" | "locale" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
196
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "value" | "testId" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "autoFocus" | "name" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "appearance" | "innerProps" | "isDisabled" | "spacing" | "isInvalid" | "locale" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
198
197
  appearance: string;
199
198
  autoFocus: boolean;
200
199
  isDisabled: boolean;
@@ -214,5 +213,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimeP
214
213
  times: string[];
215
214
  spacing: string;
216
215
  locale: string;
217
- }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "innerProps" | "isDisabled" | "appearance" | "value" | "id" | "key" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "name" | "spacing" | "isInvalid" | "dateFormat" | "locale" | "analyticsContext" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "parseValue" | "datePickerSelectProps" | "timePickerSelectProps"> & React.RefAttributes<any>>;
216
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "key" | "autoFocus" | "name" | "value" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "testId" | "appearance" | "innerProps" | "isDisabled" | "spacing" | "isInvalid" | "dateFormat" | "locale" | "analyticsContext" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "parseValue" | "datePickerSelectProps" | "timePickerSelectProps"> & React.RefAttributes<any>>;
218
217
  export default _default;
@@ -27,7 +27,8 @@ export interface TimePickerBaseProps extends WithAnalyticsEventsProps {
27
27
  */
28
28
  formatDisplayLabel?: (time: string, timeFormat: string) => string;
29
29
  /**
30
- * The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`. Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
30
+ * Set the id of the field.
31
+ * Associates a `<label></label>` with the field.
31
32
  */
32
33
  id?: string;
33
34
  /**
@@ -188,7 +189,7 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
188
189
  render(): JSX.Element;
189
190
  }
190
191
  export { TimePicker as TimePickerWithoutAnalytics };
191
- declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "placeholder" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "name" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "timeIsEditable">> & Partial<Pick<{
192
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "value" | "placeholder" | "testId" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "autoFocus" | "name" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "appearance" | "innerProps" | "selectProps" | "isDisabled" | "defaultIsOpen" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "timeIsEditable">> & Partial<Pick<{
192
193
  appearance: Appearance;
193
194
  autoFocus: boolean;
194
195
  defaultIsOpen: boolean;
@@ -208,5 +209,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePicke
208
209
  times: string[];
209
210
  timeIsEditable: boolean;
210
211
  locale: string;
211
- }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "value" | "id" | "key" | "defaultValue" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "analyticsContext" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<any>>;
212
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "key" | "autoFocus" | "name" | "value" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "testId" | "appearance" | "innerProps" | "selectProps" | "isDisabled" | "defaultIsOpen" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "analyticsContext" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<any>>;
212
213
  export default _default;
@@ -0,0 +1,17 @@
1
+ /** @jsx jsx */
2
+ import { jsx, SerializedStyles } from '@emotion/react';
3
+ import { Size } from '@atlaskit/icon';
4
+ interface ClearButtonProps {
5
+ inputId?: string;
6
+ iconSize?: Size;
7
+ primaryColor?: string;
8
+ label?: string;
9
+ buttonStyles?: SerializedStyles;
10
+ dataTestId?: string;
11
+ onClick?: () => void;
12
+ }
13
+ /**
14
+ * __Clear button__
15
+ */
16
+ declare const ClearButton: ({ inputId, iconSize, label, primaryColor, buttonStyles, dataTestId, onClick, }: ClearButtonProps) => jsx.JSX.Element;
17
+ export default ClearButton;
@@ -0,0 +1,10 @@
1
+ /** @jsx jsx */
2
+ import { FC } from 'react';
3
+ import { ClearIndicatorProps } from '@atlaskit/select';
4
+ /**
5
+ * __Clear indicator__
6
+ * Overwrites the default `ClearIndicator` button with custom styles and attributes
7
+ *
8
+ */
9
+ declare const ClearIndicator: FC<ClearIndicatorProps<any>>;
10
+ export default ClearIndicator;
@@ -1,14 +1,14 @@
1
+ type TimeObject = {
2
+ hour: number;
3
+ minute: number;
4
+ seconds: number;
5
+ };
1
6
  export declare function isValid(timeString: string): boolean;
2
7
  export declare function removeSpacer(time: string): string;
3
8
  export declare function formatSemi24(time: string): string;
4
9
  export declare function checkHour(hour: string, meridiem: string): string | null;
5
- export declare function checkMinute(minute: string): string | null;
6
- export declare function convertTo24hrTime(time: string): {
7
- hour: number;
8
- minute: number;
9
- } | null;
10
- export declare function assignToDate(time: {
11
- hour: number;
12
- minute: number;
13
- }): Date;
10
+ export declare function checkMinuteSecond(value: string): string | null;
11
+ export declare function convertTo24hrTime(time: string): TimeObject | null;
12
+ export declare function assignToDate(time: TimeObject): Date;
14
13
  export default function (time: string): string | Date;
14
+ export {};