@atlaskit/datetime-picker 13.0.0 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/datetime-picker
2
2
 
3
+ ## 13.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#40391](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40391) [`4300c9d6f18`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4300c9d6f18) - Associate the label with the `Date` / `Time` picker and the clear button.
8
+ Add hidden span to the Label component.
9
+ This allows to associate a label with a clear button.
10
+ Unit tests update.
11
+
3
12
  ## 13.0.0
4
13
 
5
14
  ### Major Changes
@@ -29,6 +29,7 @@ var _select = _interopRequireWildcard(require("@atlaskit/select"));
29
29
  var _colors = require("@atlaskit/theme/colors");
30
30
  var _constants = require("@atlaskit/theme/constants");
31
31
  var _internal = require("../internal");
32
+ var _clearIndicator = _interopRequireDefault(require("../internal/clear-indicator"));
32
33
  var _fixedLayer = _interopRequireDefault(require("../internal/fixed-layer"));
33
34
  var _singleValue = require("../internal/single-value");
34
35
  var _utils = require("./utils");
@@ -39,7 +40,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
39
40
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
40
41
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
41
42
  var packageName = "@atlaskit/datetime-picker";
42
- var packageVersion = "13.0.0";
43
+ var packageVersion = "13.0.1";
43
44
  function getValidDate(iso) {
44
45
  var date = (0, _dateFns.parseISO)(iso);
45
46
  return (0, _dateFns.isValid)(date) ? {
@@ -439,7 +440,9 @@ var DatePicker = exports.DatePickerWithoutAnalytics = /*#__PURE__*/function (_Co
439
440
  DropdownIndicator: dropDownIcon,
440
441
  Menu: Menu,
441
442
  SingleValue: SingleValue
442
- }, !showClearIndicator && {
443
+ }, showClearIndicator ? {
444
+ ClearIndicator: _clearIndicator.default
445
+ } : {
443
446
  ClearIndicator: _internal.EmptyComponent
444
447
  });
445
448
  var _selectProps$styles = selectProps.styles,
@@ -486,7 +489,7 @@ var DatePicker = exports.DatePickerWithoutAnalytics = /*#__PURE__*/function (_Co
486
489
  menuIsOpen: menuIsOpen,
487
490
  closeMenuOnSelect: true,
488
491
  autoFocus: autoFocus,
489
- instanceId: id,
492
+ inputId: id,
490
493
  isDisabled: isDisabled,
491
494
  onBlur: this.onSelectBlur,
492
495
  onFocus: this.onSelectFocus,
@@ -18,11 +18,11 @@ var _react2 = require("@emotion/react");
18
18
  var _dateFns = require("date-fns");
19
19
  var _pick = _interopRequireDefault(require("lodash/pick"));
20
20
  var _analyticsNext = require("@atlaskit/analytics-next");
21
- var _selectClear = _interopRequireDefault(require("@atlaskit/icon/glyph/select-clear"));
22
21
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
23
22
  var _select = require("@atlaskit/select");
24
23
  var _colors = require("@atlaskit/theme/colors");
25
24
  var _internal = require("../internal");
25
+ var _clearButton = _interopRequireDefault(require("../internal/clear-button"));
26
26
  var _datePicker = _interopRequireDefault(require("./date-picker"));
27
27
  var _timePicker = _interopRequireDefault(require("./time-picker"));
28
28
  var _utils = require("./utils");
@@ -31,7 +31,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
31
31
  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; }
32
32
  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) { (0, _defineProperty2.default)(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; } /** @jsx jsx */
33
33
  var packageName = "@atlaskit/datetime-picker";
34
- var packageVersion = "13.0.0";
34
+ var packageVersion = "13.0.1";
35
35
  var isInvalidBorderStyles = (0, _react2.css)({
36
36
  borderColor: "var(--ds-border-danger, ".concat(_colors.R400, ")")
37
37
  });
@@ -305,9 +305,11 @@ var DateTimePicker = exports.DateTimePickerWithoutAnalytics = /*#__PURE__*/funct
305
305
  // Don't use Date or TimePicker's because they can't be customised
306
306
  var isClearable = Boolean(dateValue || timeValue);
307
307
  var notFocusedOrIsDisabled = !(isFocused || isDisabled);
308
+ var ariaLabelledbyId = id && "label--".concat(id);
308
309
  return (0, _react2.jsx)("div", (0, _extends2.default)({
309
310
  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]
310
311
  }, innerProps, {
312
+ "aria-labelledby": innerProps['aria-labelledby'] || ariaLabelledbyId,
311
313
  "data-testid": testId
312
314
  }), (0, _react2.jsx)("input", {
313
315
  name: name,
@@ -338,17 +340,13 @@ var DateTimePicker = exports.DateTimePickerWithoutAnalytics = /*#__PURE__*/funct
338
340
  timeFormat: timeFormat,
339
341
  locale: locale,
340
342
  testId: testId && "".concat(testId, "--timepicker")
341
- }, timePickerProps))), isClearable && !isDisabled ? (0, _react2.jsx)("button", {
342
- css: iconContainerStyles,
343
+ }, timePickerProps))), isClearable && !isDisabled ? (0, _react2.jsx)(_clearButton.default, {
344
+ inputId: id,
345
+ buttonStyles: iconContainerStyles,
343
346
  onClick: this.onClear,
344
347
  "data-testid": testId && "".concat(testId, "--icon--container"),
345
- tabIndex: -1,
346
- type: "button"
347
- }, (0, _react2.jsx)(_selectClear.default, {
348
- size: "small",
349
- primaryColor: "inherit",
350
- label: "clear"
351
- })) : null);
348
+ primaryColor: "inherit"
349
+ }) : null);
352
350
  }
353
351
  }]);
354
352
  return DateTimePicker;
@@ -23,6 +23,7 @@ var _locale = require("@atlaskit/locale");
23
23
  var _select = _interopRequireWildcard(require("@atlaskit/select"));
24
24
  var _constants = require("@atlaskit/theme/constants");
25
25
  var _internal = require("../internal");
26
+ var _clearIndicator = _interopRequireDefault(require("../internal/clear-indicator"));
26
27
  var _fixedLayer = _interopRequireDefault(require("../internal/fixed-layer"));
27
28
  var _parseTime = _interopRequireDefault(require("../internal/parse-time"));
28
29
  var _singleValue = require("../internal/single-value");
@@ -37,7 +38,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
37
38
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
38
39
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
39
40
  var packageName = "@atlaskit/datetime-picker";
40
- var packageVersion = "13.0.0";
41
+ var packageVersion = "13.0.1";
41
42
  var menuStyles = {
42
43
  /* Need to remove default absolute positioning as that causes issues with position fixed */
43
44
  position: 'static',
@@ -279,8 +280,10 @@ var TimePicker = exports.TimePickerWithoutAnalytics = /*#__PURE__*/function (_Re
279
280
  DropdownIndicator: _internal.EmptyComponent,
280
281
  Menu: FixedLayerMenu,
281
282
  SingleValue: SingleValue
282
- }, hideIcon && {
283
+ }, hideIcon ? {
283
284
  ClearIndicator: _internal.EmptyComponent
285
+ } : {
286
+ ClearIndicator: _clearIndicator.default
284
287
  });
285
288
  var renderIconContainer = Boolean(!hideIcon && value);
286
289
  var mergedStyles = (0, _select.mergeStyles)(selectStyles, {
@@ -314,7 +317,7 @@ var TimePicker = exports.TimePickerWithoutAnalytics = /*#__PURE__*/function (_Re
314
317
  appearance: appearance,
315
318
  autoFocus: autoFocus,
316
319
  components: selectComponents,
317
- instanceId: id,
320
+ inputId: id,
318
321
  isClearable: true,
319
322
  isDisabled: isDisabled,
320
323
  menuIsOpen: isOpen && !isDisabled,
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = require("@emotion/react");
9
+ var _selectClear = _interopRequireDefault(require("@atlaskit/icon/glyph/select-clear"));
10
+ /** @jsx jsx */
11
+
12
+ /**
13
+ * __Clear button__
14
+ */
15
+ var ClearButton = function ClearButton(_ref) {
16
+ var inputId = _ref.inputId,
17
+ _ref$iconSize = _ref.iconSize,
18
+ iconSize = _ref$iconSize === void 0 ? 'small' : _ref$iconSize,
19
+ _ref$label = _ref.label,
20
+ label = _ref$label === void 0 ? 'Clear' : _ref$label,
21
+ primaryColor = _ref.primaryColor,
22
+ buttonStyles = _ref.buttonStyles,
23
+ dataTestId = _ref.dataTestId,
24
+ onClick = _ref.onClick;
25
+ var labelId = inputId && "label--".concat(inputId);
26
+ var clearButtonId = inputId && "clear-btn--".concat(inputId);
27
+ return (0, _react.jsx)("button", {
28
+ css: buttonStyles,
29
+ type: "button",
30
+ tabIndex: -1,
31
+ "data-testid": "".concat(dataTestId, "--clear--btn"),
32
+ onClick: onClick
33
+ }, (0, _react.jsx)("span", {
34
+ hidden: true,
35
+ id: clearButtonId
36
+ }, "Clear"), (0, _react.jsx)("span", {
37
+ style: {
38
+ display: 'flex'
39
+ },
40
+ "aria-labelledby": inputId ? "".concat(clearButtonId, " ").concat(labelId) : "".concat(clearButtonId)
41
+ }, (0, _react.jsx)(_selectClear.default, {
42
+ size: iconSize,
43
+ label: inputId ? '' : label,
44
+ primaryColor: primaryColor
45
+ })));
46
+ };
47
+ var _default = exports.default = ClearButton;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _react = require("@emotion/react");
10
+ var _select = require("@atlaskit/select");
11
+ var _clearButton = _interopRequireDefault(require("./clear-button"));
12
+ 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; }
13
+ 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) { (0, _defineProperty2.default)(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; } /** @jsx jsx */
14
+ var buttonStyles = (0, _react.css)({
15
+ display: 'flex',
16
+ alignItems: 'center',
17
+ all: 'unset',
18
+ outline: 'revert'
19
+ });
20
+
21
+ /**
22
+ * __Clear indicator__
23
+ * Overwrites the default `ClearIndicator` button with custom styles and attributes
24
+ *
25
+ */
26
+ var ClearIndicator = function ClearIndicator(props) {
27
+ return (0, _react.jsx)(_select.components.ClearIndicator, _objectSpread(_objectSpread({}, props), {}, {
28
+ innerProps: _objectSpread(_objectSpread({}, props.innerProps), {}, {
29
+ 'aria-hidden': 'false'
30
+ })
31
+ }), (0, _react.jsx)(_clearButton.default, {
32
+ buttonStyles: buttonStyles,
33
+ inputId: props.selectProps.inputId,
34
+ dataTestId: props.selectProps.testId
35
+ }));
36
+ };
37
+ var _default = exports.default = ClearIndicator;
@@ -15,11 +15,12 @@ import Select, { mergeStyles } from '@atlaskit/select';
15
15
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
16
16
  import { layers } from '@atlaskit/theme/constants';
17
17
  import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from '../internal';
18
+ import ClearIndicator from '../internal/clear-indicator';
18
19
  import FixedLayer from '../internal/fixed-layer';
19
20
  import { makeSingleValue } from '../internal/single-value';
20
21
  import { convertTokens } from './utils';
21
22
  const packageName = "@atlaskit/datetime-picker";
22
- const packageVersion = "13.0.0";
23
+ const packageVersion = "13.0.1";
23
24
  function getValidDate(iso) {
24
25
  const date = parseISO(iso);
25
26
  return isValid(date) ? {
@@ -437,7 +438,9 @@ class DatePicker extends Component {
437
438
  DropdownIndicator: dropDownIcon,
438
439
  Menu,
439
440
  SingleValue,
440
- ...(!showClearIndicator && {
441
+ ...(showClearIndicator ? {
442
+ ClearIndicator: ClearIndicator
443
+ } : {
441
444
  ClearIndicator: EmptyComponent
442
445
  })
443
446
  };
@@ -486,7 +489,7 @@ class DatePicker extends Component {
486
489
  menuIsOpen: menuIsOpen,
487
490
  closeMenuOnSelect: true,
488
491
  autoFocus: autoFocus,
489
- instanceId: id,
492
+ inputId: id,
490
493
  isDisabled: isDisabled,
491
494
  onBlur: this.onSelectBlur,
492
495
  onFocus: this.onSelectFocus,
@@ -6,16 +6,16 @@ import { css, jsx } from '@emotion/react';
6
6
  import { format, isValid, parseISO } from 'date-fns';
7
7
  import pick from 'lodash/pick';
8
8
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
9
- import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
10
9
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
10
  import { mergeStyles } from '@atlaskit/select';
12
11
  import { B100, N0, N100, N20, N30, N500, N70, R400 } from '@atlaskit/theme/colors';
13
12
  import { defaultTimes, formatDateTimeZoneIntoIso } from '../internal';
13
+ import ClearButton from '../internal/clear-button';
14
14
  import DatePicker from './date-picker';
15
15
  import TimePicker from './time-picker';
16
16
  import { convertTokens } from './utils';
17
17
  const packageName = "@atlaskit/datetime-picker";
18
- const packageVersion = "13.0.0";
18
+ const packageVersion = "13.0.1";
19
19
  const isInvalidBorderStyles = css({
20
20
  borderColor: `var(--ds-border-danger, ${R400})`
21
21
  });
@@ -291,9 +291,11 @@ class DateTimePicker extends React.Component {
291
291
  // Don't use Date or TimePicker's because they can't be customised
292
292
  const isClearable = Boolean(dateValue || timeValue);
293
293
  const notFocusedOrIsDisabled = !(isFocused || isDisabled);
294
+ const ariaLabelledbyId = id && `label--${id}`;
294
295
  return jsx("div", _extends({
295
296
  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]
296
297
  }, innerProps, {
298
+ "aria-labelledby": innerProps['aria-labelledby'] || ariaLabelledbyId,
297
299
  "data-testid": testId
298
300
  }), jsx("input", {
299
301
  name: name,
@@ -324,17 +326,13 @@ class DateTimePicker extends React.Component {
324
326
  timeFormat: timeFormat,
325
327
  locale: locale,
326
328
  testId: testId && `${testId}--timepicker`
327
- }, timePickerProps))), isClearable && !isDisabled ? jsx("button", {
328
- css: iconContainerStyles,
329
+ }, timePickerProps))), isClearable && !isDisabled ? jsx(ClearButton, {
330
+ inputId: id,
331
+ buttonStyles: iconContainerStyles,
329
332
  onClick: this.onClear,
330
333
  "data-testid": testId && `${testId}--icon--container`,
331
- tabIndex: -1,
332
- type: "button"
333
- }, jsx(SelectClearIcon, {
334
- size: "small",
335
- primaryColor: "inherit",
336
- label: "clear"
337
- })) : null);
334
+ primaryColor: "inherit"
335
+ }) : null);
338
336
  }
339
337
  }
340
338
  _defineProperty(DateTimePicker, "defaultProps", dateTimePickerDefaultProps);
@@ -11,12 +11,13 @@ import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/sele
11
11
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
12
12
  import { gridSize } from '@atlaskit/theme/constants';
13
13
  import { defaultTimeFormat, defaultTimes, EmptyComponent, placeholderDatetime } from '../internal';
14
+ import ClearIndicator from '../internal/clear-indicator';
14
15
  import FixedLayer from '../internal/fixed-layer';
15
16
  import parseTime from '../internal/parse-time';
16
17
  import { makeSingleValue } from '../internal/single-value';
17
18
  import { convertTokens } from './utils';
18
19
  const packageName = "@atlaskit/datetime-picker";
19
- const packageVersion = "13.0.0";
20
+ const packageVersion = "13.0.1";
20
21
  const menuStyles = {
21
22
  /* Need to remove default absolute positioning as that causes issues with position fixed */
22
23
  position: 'static',
@@ -254,8 +255,10 @@ class TimePicker extends React.Component {
254
255
  DropdownIndicator: EmptyComponent,
255
256
  Menu: FixedLayerMenu,
256
257
  SingleValue,
257
- ...(hideIcon && {
258
+ ...(hideIcon ? {
258
259
  ClearIndicator: EmptyComponent
260
+ } : {
261
+ ClearIndicator: ClearIndicator
259
262
  })
260
263
  };
261
264
  const renderIconContainer = Boolean(!hideIcon && value);
@@ -289,7 +292,7 @@ class TimePicker extends React.Component {
289
292
  appearance: appearance,
290
293
  autoFocus: autoFocus,
291
294
  components: selectComponents,
292
- instanceId: id,
295
+ inputId: id,
293
296
  isClearable: true,
294
297
  isDisabled: isDisabled,
295
298
  menuIsOpen: isOpen && !isDisabled,
@@ -0,0 +1,38 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
4
+ /**
5
+ * __Clear button__
6
+ */
7
+ const ClearButton = ({
8
+ inputId,
9
+ iconSize = 'small',
10
+ label = 'Clear',
11
+ primaryColor,
12
+ buttonStyles,
13
+ dataTestId,
14
+ onClick
15
+ }) => {
16
+ const labelId = inputId && `label--${inputId}`;
17
+ const clearButtonId = inputId && `clear-btn--${inputId}`;
18
+ return jsx("button", {
19
+ css: buttonStyles,
20
+ type: "button",
21
+ tabIndex: -1,
22
+ "data-testid": `${dataTestId}--clear--btn`,
23
+ onClick: onClick
24
+ }, jsx("span", {
25
+ hidden: true,
26
+ id: clearButtonId
27
+ }, "Clear"), jsx("span", {
28
+ style: {
29
+ display: 'flex'
30
+ },
31
+ "aria-labelledby": inputId ? `${clearButtonId} ${labelId}` : `${clearButtonId}`
32
+ }, jsx(SelectClearIcon, {
33
+ size: iconSize,
34
+ label: inputId ? '' : label,
35
+ primaryColor: primaryColor
36
+ })));
37
+ };
38
+ export default ClearButton;
@@ -0,0 +1,31 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+
4
+ import { css, jsx } from '@emotion/react';
5
+ import { components } from '@atlaskit/select';
6
+ import ClearButton from './clear-button';
7
+ const buttonStyles = css({
8
+ display: 'flex',
9
+ alignItems: 'center',
10
+ all: 'unset',
11
+ outline: 'revert'
12
+ });
13
+
14
+ /**
15
+ * __Clear indicator__
16
+ * Overwrites the default `ClearIndicator` button with custom styles and attributes
17
+ *
18
+ */
19
+ const ClearIndicator = props => {
20
+ return jsx(components.ClearIndicator, _extends({}, props, {
21
+ innerProps: {
22
+ ...props.innerProps,
23
+ 'aria-hidden': 'false'
24
+ }
25
+ }), jsx(ClearButton, {
26
+ buttonStyles: buttonStyles,
27
+ inputId: props.selectProps.inputId,
28
+ dataTestId: props.selectProps.testId
29
+ }));
30
+ };
31
+ export default ClearIndicator;
@@ -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 = "13.0.0";
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 = "13.0.0";
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 = "13.0.0";
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',
@@ -271,8 +272,10 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
271
272
  DropdownIndicator: EmptyComponent,
272
273
  Menu: FixedLayerMenu,
273
274
  SingleValue: SingleValue
274
- }, hideIcon && {
275
+ }, hideIcon ? {
275
276
  ClearIndicator: EmptyComponent
277
+ } : {
278
+ ClearIndicator: ClearIndicator
276
279
  });
277
280
  var renderIconContainer = Boolean(!hideIcon && value);
278
281
  var mergedStyles = mergeStyles(selectStyles, {
@@ -306,7 +309,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
306
309
  appearance: appearance,
307
310
  autoFocus: autoFocus,
308
311
  components: selectComponents,
309
- instanceId: id,
312
+ inputId: id,
310
313
  isClearable: true,
311
314
  isDisabled: isDisabled,
312
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;
@@ -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;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "13.0.0",
3
+ "version": "13.0.1",
4
4
  "description": "A date time picker allows the user to select an associated date and time.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@af/accessibility-testing": "*",
57
- "@atlaskit/button": "^16.16.0",
57
+ "@atlaskit/button": "^16.17.0",
58
58
  "@atlaskit/docs": "*",
59
59
  "@atlaskit/form": "^9.0.0",
60
60
  "@atlaskit/modal-dialog": "^12.8.0",
@@ -62,7 +62,7 @@
62
62
  "@atlaskit/range": "^7.1.0",
63
63
  "@atlaskit/section-message": "^6.4.0",
64
64
  "@atlaskit/ssr": "*",
65
- "@atlaskit/textfield": "^5.6.0",
65
+ "@atlaskit/textfield": "^6.0.0",
66
66
  "@atlaskit/toggle": "^13.0.0",
67
67
  "@atlaskit/visual-regression": "*",
68
68
  "@atlaskit/webdriver-runner": "*",