@atlaskit/datetime-picker 13.0.11 → 13.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/components/date-picker.js +13 -49
  3. package/dist/cjs/components/date-time-picker.js +12 -63
  4. package/dist/cjs/components/time-picker.js +12 -22
  5. package/dist/cjs/internal/date-time-picker-container.js +84 -0
  6. package/dist/cjs/internal/fixed-layer-menu.js +29 -0
  7. package/dist/cjs/internal/menu.js +57 -0
  8. package/dist/es2019/components/date-picker.js +8 -43
  9. package/dist/es2019/components/date-time-picker.js +13 -64
  10. package/dist/es2019/components/time-picker.js +7 -15
  11. package/dist/es2019/internal/date-time-picker-container.js +77 -0
  12. package/dist/es2019/internal/fixed-layer-menu.js +20 -0
  13. package/dist/es2019/internal/menu.js +48 -0
  14. package/dist/esm/components/date-picker.js +12 -48
  15. package/dist/esm/components/date-time-picker.js +13 -64
  16. package/dist/esm/components/time-picker.js +10 -20
  17. package/dist/esm/internal/date-time-picker-container.js +76 -0
  18. package/dist/esm/internal/fixed-layer-menu.js +23 -0
  19. package/dist/esm/internal/menu.js +49 -0
  20. package/dist/types/components/date-picker.d.ts +5 -2
  21. package/dist/types/components/date-time-picker.d.ts +2 -2
  22. package/dist/types/components/time-picker.d.ts +5 -2
  23. package/dist/types/internal/date-time-picker-container.d.ts +15 -0
  24. package/dist/types/internal/fixed-layer-menu.d.ts +7 -0
  25. package/dist/types/internal/menu.d.ts +7 -0
  26. package/dist/types/types.d.ts +8 -0
  27. package/dist/types-ts4.5/components/date-picker.d.ts +5 -2
  28. package/dist/types-ts4.5/components/date-time-picker.d.ts +2 -2
  29. package/dist/types-ts4.5/components/time-picker.d.ts +5 -2
  30. package/dist/types-ts4.5/internal/date-time-picker-container.d.ts +15 -0
  31. package/dist/types-ts4.5/internal/fixed-layer-menu.d.ts +7 -0
  32. package/dist/types-ts4.5/internal/menu.d.ts +7 -0
  33. package/dist/types-ts4.5/types.d.ts +8 -0
  34. package/extract-react-types/date-picker-props.tsx +1 -1
  35. package/extract-react-types/time-picker-props.tsx +1 -1
  36. package/package.json +7 -6
@@ -7,68 +7,15 @@ 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
9
  import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
10
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
10
  import { mergeStyles } from '@atlaskit/select';
12
- import { B100, N0, N100, N20, N30, N500, N70, R400 } from '@atlaskit/theme/colors';
11
+ import { N500, N70 } from '@atlaskit/theme/colors';
13
12
  import { defaultTimes, formatDateTimeZoneIntoIso } from '../internal';
13
+ import { DateTimePickerContainer } from '../internal/date-time-picker-container';
14
14
  import { convertTokens } from '../internal/parse-tokens';
15
15
  import DatePicker from './date-picker';
16
16
  import TimePicker from './time-picker';
17
17
  const packageName = "@atlaskit/datetime-picker";
18
- const packageVersion = "13.0.11";
19
- const isInvalidBorderStyles = css({
20
- borderColor: `var(--ds-border-danger, ${R400})`
21
- });
22
- const isFocusedBorderStyles = css({
23
- borderColor: `var(--ds-border-focused, ${B100})`
24
- });
25
- const isFocusedStyles = css({
26
- backgroundColor: `var(--ds-background-input-pressed, ${N0})`
27
- });
28
- const subtleBgStyles = css({
29
- backgroundColor: 'transparent',
30
- borderColor: 'transparent'
31
- });
32
- const subtleFocusedBgStyles = css({
33
- backgroundColor: "var(--ds-background-input-pressed, transparent)",
34
- borderColor: 'transparent'
35
- });
36
- const noBgStyles = css({
37
- backgroundColor: 'transparent',
38
- borderColor: 'transparent',
39
- '&:hover': {
40
- backgroundColor: 'transparent',
41
- borderColor: 'transparent'
42
- }
43
- });
44
- const hoverStyles = css({
45
- '&:hover': {
46
- backgroundColor: `var(--ds-background-input-hovered, ${N30})`,
47
- borderColor: `var(--ds-border-input, ${getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? N100 : N30})`
48
- }
49
- });
50
- const isInvalidHoverStyles = css({
51
- '&:hover': {
52
- backgroundColor: `var(--ds-background-input-hovered, ${N0})`,
53
- borderColor: `var(--ds-border-danger, ${R400})`
54
- }
55
- });
56
- const isDisabledStyles = css({
57
- '&:hover': {
58
- cursor: 'default'
59
- }
60
- });
61
- const baseContainerStyles = css({
62
- display: 'flex',
63
- backgroundColor: `var(--ds-background-input, ${N20})`,
64
- border: getBooleanFF('platform.design-system-team.update-input-border-wdith_5abwv') ? `${"var(--ds-border-width, 1px)"} solid ${`var(--ds-border-input, ${N100})`}` : `2px solid ${`var(--ds-border-input, ${N20})`}`,
65
- borderRadius: "var(--ds-border-radius, 3px)",
66
- transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
67
- '&:hover': {
68
- cursor: 'pointer'
69
- }
70
- });
71
-
18
+ const packageVersion = "13.1.0";
72
19
  // Make DatePicker 50% the width of DateTimePicker
73
20
  // If rendering an icon container, shrink the TimePicker
74
21
  const datePickerContainerStyles = css({
@@ -278,24 +225,26 @@ class DateTimePicker extends React.Component {
278
225
  } = timePickerSelectProps;
279
226
  const mergedDatePickerSelectProps = {
280
227
  ...datePickerSelectProps,
281
- 'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
228
+ 'aria-label': datePickerProps['label'] || datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
282
229
  styles: mergeStyles(styles, datePickerStyles)
283
230
  };
284
231
  const mergedTimePickerSelectProps = {
285
232
  ...timePickerSelectProps,
286
- 'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
233
+ 'aria-label': timePickerProps['label'] || timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
287
234
  styles: mergeStyles(styles, timePickerStyles)
288
235
  };
289
236
 
290
237
  // Render DateTimePicker's IconContainer when a value has been filled
291
238
  // Don't use Date or TimePicker's because they can't be customised
292
239
  const isClearable = Boolean(dateValue || timeValue);
293
- const notFocusedOrIsDisabled = !(isFocused || isDisabled);
294
- return jsx("div", _extends({
295
- 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
- }, innerProps, {
297
- "data-testid": testId
298
- }), jsx("input", {
240
+ return jsx(DateTimePickerContainer, {
241
+ appearance: bothProps.appearance,
242
+ isDisabled: isDisabled,
243
+ isFocused: isFocused,
244
+ isInvalid: bothProps.isInvalid,
245
+ testId: testId,
246
+ innerProps: innerProps
247
+ }, jsx("input", {
299
248
  name: name,
300
249
  type: "hidden",
301
250
  value: value,
@@ -1,5 +1,5 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
4
 
5
5
  // eslint-disable-next-line no-restricted-imports
@@ -7,16 +7,16 @@ import { format, isValid } from 'date-fns';
7
7
  import pick from 'lodash/pick';
8
8
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
9
9
  import { createLocalizationProvider } from '@atlaskit/locale';
10
- import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/select';
10
+ import Select, { CreatableSelect, mergeStyles } from '@atlaskit/select';
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 FixedLayer from '../internal/fixed-layer';
14
+ import { FixedLayerMenu } from '../internal/fixed-layer-menu';
15
15
  import parseTime from '../internal/parse-time';
16
16
  import { convertTokens } from '../internal/parse-tokens';
17
17
  import { makeSingleValue } from '../internal/single-value';
18
18
  const packageName = "@atlaskit/datetime-picker";
19
- const packageVersion = "13.0.11";
19
+ const packageVersion = "13.1.0";
20
20
  const menuStyles = {
21
21
  /* Need to remove default absolute positioning as that causes issues with position fixed */
22
22
  position: 'static',
@@ -25,17 +25,6 @@ const menuStyles = {
25
25
  /* React-Popper has already offset the menu so we need to reset the margin, otherwise the offset value is doubled */
26
26
  margin: 0
27
27
  };
28
- const FixedLayerMenu = ({
29
- selectProps,
30
- ...rest
31
- }) => /*#__PURE__*/React.createElement(FixedLayer, {
32
- inputValue: selectProps.inputValue,
33
- containerRef: selectProps.fixedLayerRef,
34
- content: /*#__PURE__*/React.createElement(components.Menu, _extends({}, rest, {
35
- menuShouldScrollIntoView: false
36
- })),
37
- testId: selectProps.testId
38
- });
39
28
  const timePickerDefaultProps = {
40
29
  appearance: 'default',
41
30
  autoFocus: false,
@@ -46,6 +35,7 @@ const timePickerDefaultProps = {
46
35
  innerProps: {},
47
36
  isDisabled: false,
48
37
  isInvalid: false,
38
+ label: '',
49
39
  name: '',
50
40
  // These disables are here for proper typing when used as defaults. They
51
41
  // should *not* use the `noop` function.
@@ -191,6 +181,7 @@ class TimePicker extends React.Component {
191
181
  id,
192
182
  innerProps,
193
183
  isDisabled,
184
+ label,
194
185
  locale,
195
186
  name,
196
187
  placeholder,
@@ -286,6 +277,7 @@ class TimePicker extends React.Component {
286
277
  "data-testid": testId && `${testId}--input`,
287
278
  onKeyDown: this.onSelectKeyDown
288
279
  }), /*#__PURE__*/React.createElement(SelectComponent, _extends({
280
+ "aria-label": label || undefined,
289
281
  appearance: appearance,
290
282
  autoFocus: autoFocus,
291
283
  components: selectComponents,
@@ -0,0 +1,77 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import { css, jsx } from '@emotion/react';
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
+ import { B100, N0, N100, N20, N30, R400 } from '@atlaskit/theme/colors';
6
+ const isInvalidBorderStyles = css({
7
+ borderColor: `var(--ds-border-danger, ${R400})`
8
+ });
9
+ const isFocusedBorderStyles = css({
10
+ borderColor: `var(--ds-border-focused, ${B100})`
11
+ });
12
+ const isFocusedStyles = css({
13
+ backgroundColor: `var(--ds-background-input-pressed, ${N0})`
14
+ });
15
+ const subtleBgStyles = css({
16
+ backgroundColor: 'transparent',
17
+ borderColor: 'transparent'
18
+ });
19
+ const subtleFocusedBgStyles = css({
20
+ backgroundColor: "var(--ds-background-input-pressed, transparent)",
21
+ borderColor: 'transparent'
22
+ });
23
+ const noBgStyles = css({
24
+ backgroundColor: 'transparent',
25
+ borderColor: 'transparent',
26
+ '&:hover': {
27
+ backgroundColor: 'transparent',
28
+ borderColor: 'transparent'
29
+ }
30
+ });
31
+ const hoverStyles = css({
32
+ '&:hover': {
33
+ backgroundColor: `var(--ds-background-input-hovered, ${N30})`,
34
+ borderColor: `var(--ds-border-input, ${getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? N100 : N30})`
35
+ }
36
+ });
37
+ const isInvalidHoverStyles = css({
38
+ '&:hover': {
39
+ backgroundColor: `var(--ds-background-input-hovered, ${N0})`,
40
+ borderColor: `var(--ds-border-danger, ${R400})`
41
+ }
42
+ });
43
+ const isDisabledStyles = css({
44
+ '&:hover': {
45
+ cursor: 'default'
46
+ }
47
+ });
48
+ const baseContainerStyles = css({
49
+ display: 'flex',
50
+ backgroundColor: `var(--ds-background-input, ${N20})`,
51
+ border: getBooleanFF('platform.design-system-team.update-input-border-wdith_5abwv') ? `${"var(--ds-border-width, 1px)"} solid ${`var(--ds-border-input, ${N100})`}` : `2px solid ${`var(--ds-border-input, ${N20})`}`,
52
+ borderRadius: "var(--ds-border-radius, 3px)",
53
+ transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
54
+ '&:hover': {
55
+ cursor: 'pointer'
56
+ }
57
+ });
58
+
59
+ /**
60
+ * This is the container for the datetime picker component.
61
+ */
62
+ export const DateTimePickerContainer = ({
63
+ isDisabled,
64
+ isFocused,
65
+ appearance,
66
+ isInvalid,
67
+ innerProps,
68
+ testId,
69
+ children
70
+ }) => {
71
+ const notFocusedOrIsDisabled = !(isFocused || isDisabled);
72
+ return jsx("div", _extends({
73
+ css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (isInvalid ? isInvalidHoverStyles : hoverStyles), appearance === 'none' && noBgStyles]
74
+ }, innerProps, {
75
+ "data-testid": testId
76
+ }), children);
77
+ };
@@ -0,0 +1,20 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import { jsx } from '@emotion/react';
4
+ import { components } from '@atlaskit/select';
5
+ import FixedLayer from '../internal/fixed-layer';
6
+
7
+ /**
8
+ * This is the fixed layer menu used in the time picker.
9
+ */
10
+ export const FixedLayerMenu = ({
11
+ selectProps,
12
+ ...rest
13
+ }) => jsx(FixedLayer, {
14
+ inputValue: selectProps.inputValue,
15
+ containerRef: selectProps.fixedLayerRef,
16
+ content: jsx(components.Menu, _extends({}, rest, {
17
+ menuShouldScrollIntoView: false
18
+ })),
19
+ testId: selectProps.testId
20
+ });
@@ -0,0 +1,48 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import { css, jsx } from '@emotion/react';
4
+ import Calendar from '@atlaskit/calendar';
5
+ import { UNSAFE_LAYERING } from '@atlaskit/layering';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
+ import { N0, N50A, N60A } from '@atlaskit/theme/colors';
8
+ import { layers } from '@atlaskit/theme/constants';
9
+ import FixedLayer from '../internal/fixed-layer';
10
+ import { getValidDate } from './parse-date';
11
+ const menuStyles = css({
12
+ zIndex: layers.dialog(),
13
+ backgroundColor: `var(--ds-surface-overlay, ${N0})`,
14
+ borderRadius: "var(--ds-border-radius, 3px)",
15
+ boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`,
16
+ overflow: 'hidden'
17
+ });
18
+
19
+ /**
20
+ * This is the menu used in the select of the date picker.
21
+ */
22
+ export const Menu = ({
23
+ selectProps,
24
+ innerProps
25
+ }) => jsx(UNSAFE_LAYERING, {
26
+ isDisabled: getBooleanFF('platform.design-system-team.layering_qmiw3') ? false : true
27
+ }, jsx(FixedLayer, {
28
+ inputValue: selectProps.inputValue,
29
+ containerRef: selectProps.calendarContainerRef,
30
+ content: jsx("div", _extends({
31
+ css: menuStyles
32
+ }, innerProps), jsx(Calendar, _extends({}, getValidDate(selectProps.calendarValue), getValidDate(selectProps.calendarView), {
33
+ disabled: selectProps.calendarDisabled,
34
+ disabledDateFilter: selectProps.calendarDisabledDateFilter,
35
+ minDate: selectProps.calendarMinDate,
36
+ maxDate: selectProps.calendarMaxDate,
37
+ nextMonthLabel: selectProps.nextMonthLabel,
38
+ onChange: selectProps.onCalendarChange,
39
+ onSelect: selectProps.onCalendarSelect,
40
+ previousMonthLabel: selectProps.previousMonthLabel,
41
+ calendarRef: selectProps.calendarRef,
42
+ selected: [selectProps.calendarValue],
43
+ locale: selectProps.calendarLocale,
44
+ testId: selectProps.testId && `${selectProps.testId}--calendar`,
45
+ weekStartDay: selectProps.calendarWeekStartDay
46
+ }))),
47
+ testId: selectProps.testId
48
+ }));
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -6,67 +7,27 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _extends from "@babel/runtime/helpers/extends";
10
10
  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; }
11
11
  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; }
12
12
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
13
  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; } }
14
14
  /** @jsx jsx */
15
15
  import { Component } from 'react';
16
- import { css, jsx } from '@emotion/react';
16
+ import { jsx } from '@emotion/react';
17
17
  import { format, isValid, lastDayOfMonth, parseISO } from 'date-fns';
18
18
  import pick from 'lodash/pick';
19
19
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
20
- import Calendar from '@atlaskit/calendar';
21
20
  import CalendarIcon from '@atlaskit/icon/glyph/calendar';
22
- import { UNSAFE_LAYERING } from '@atlaskit/layering';
23
21
  import { createLocalizationProvider } from '@atlaskit/locale';
24
22
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
25
23
  import Select, { mergeStyles } from '@atlaskit/select';
26
- import { N0, N50A, N60A } from '@atlaskit/theme/colors';
27
- import { layers } from '@atlaskit/theme/constants';
28
24
  import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from '../internal';
29
- import FixedLayer from '../internal/fixed-layer';
30
- import { getSafeCalendarValue, getShortISOString, getValidDate } from '../internal/parse-date';
25
+ import { Menu } from '../internal/menu';
26
+ import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
31
27
  import { convertTokens } from '../internal/parse-tokens';
32
28
  import { makeSingleValue } from '../internal/single-value';
33
29
  var packageName = "@atlaskit/datetime-picker";
34
- var packageVersion = "13.0.11";
35
- var menuStyles = css({
36
- zIndex: layers.dialog(),
37
- backgroundColor: "var(--ds-surface-overlay, ".concat(N0, ")"),
38
- borderRadius: "var(--ds-border-radius, 3px)",
39
- boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A), ")"),
40
- overflow: 'hidden'
41
- });
42
- var Menu = function Menu(_ref) {
43
- var selectProps = _ref.selectProps,
44
- innerProps = _ref.innerProps;
45
- return jsx(UNSAFE_LAYERING, {
46
- isDisabled: getBooleanFF('platform.design-system-team.layering_qmiw3') ? false : true
47
- }, jsx(FixedLayer, {
48
- inputValue: selectProps.inputValue,
49
- containerRef: selectProps.calendarContainerRef,
50
- content: jsx("div", _extends({
51
- css: menuStyles
52
- }, innerProps), jsx(Calendar, _extends({}, getValidDate(selectProps.calendarValue), getValidDate(selectProps.calendarView), {
53
- disabled: selectProps.calendarDisabled,
54
- disabledDateFilter: selectProps.calendarDisabledDateFilter,
55
- minDate: selectProps.calendarMinDate,
56
- maxDate: selectProps.calendarMaxDate,
57
- nextMonthLabel: selectProps.nextMonthLabel,
58
- onChange: selectProps.onCalendarChange,
59
- onSelect: selectProps.onCalendarSelect,
60
- previousMonthLabel: selectProps.previousMonthLabel,
61
- calendarRef: selectProps.calendarRef,
62
- selected: [selectProps.calendarValue],
63
- locale: selectProps.calendarLocale,
64
- testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
65
- weekStartDay: selectProps.calendarWeekStartDay
66
- }))),
67
- testId: selectProps.testId
68
- }));
69
- };
30
+ var packageVersion = "13.1.0";
70
31
  var datePickerDefaultProps = {
71
32
  appearance: 'default',
72
33
  autoFocus: false,
@@ -82,6 +43,7 @@ var datePickerDefaultProps = {
82
43
  innerProps: {},
83
44
  isDisabled: false,
84
45
  isInvalid: false,
46
+ label: '',
85
47
  name: '',
86
48
  // These disables are here for proper typing when used as defaults. They
87
49
  // should *not* use the `noop` function.
@@ -113,8 +75,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
113
75
  _defineProperty(_assertThisInitialized(_this), "isDateDisabled", function (date) {
114
76
  return _this.props.disabled.indexOf(date) > -1;
115
77
  });
116
- _defineProperty(_assertThisInitialized(_this), "onCalendarChange", function (_ref2) {
117
- var iso = _ref2.iso;
78
+ _defineProperty(_assertThisInitialized(_this), "onCalendarChange", function (_ref) {
79
+ var iso = _ref.iso;
118
80
  var _iso$split = iso.split('-'),
119
81
  _iso$split2 = _slicedToArray(_iso$split, 3),
120
82
  year = _iso$split2[0],
@@ -135,8 +97,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
135
97
  calendarValue: newIso
136
98
  });
137
99
  });
138
- _defineProperty(_assertThisInitialized(_this), "onCalendarSelect", function (_ref3) {
139
- var iso = _ref3.iso;
100
+ _defineProperty(_assertThisInitialized(_this), "onCalendarSelect", function (_ref2) {
101
+ var iso = _ref2.iso;
140
102
  _this.setState({
141
103
  selectInputValue: '',
142
104
  isOpen: false,
@@ -389,6 +351,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
389
351
  maxDate = _this$props3.maxDate,
390
352
  minDate = _this$props3.minDate,
391
353
  isInvalid = _this$props3.isInvalid,
354
+ label = _this$props3.label,
392
355
  name = _this$props3.name,
393
356
  nextMonthLabel = _this$props3.nextMonthLabel,
394
357
  previousMonthLabel = _this$props3.previousMonthLabel,
@@ -460,6 +423,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
460
423
  value: value,
461
424
  "data-testid": testId && "".concat(testId, "--input")
462
425
  }), jsx(Select, _extends({
426
+ "aria-label": label || undefined,
463
427
  appearance: this.props.appearance,
464
428
  enableAnimation: false,
465
429
  menuIsOpen: menuIsOpen,
@@ -17,68 +17,15 @@ 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
19
  import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
20
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
21
20
  import { mergeStyles } from '@atlaskit/select';
22
- import { B100, N0, N100, N20, N30, N500, N70, R400 } from '@atlaskit/theme/colors';
21
+ import { N500, N70 } from '@atlaskit/theme/colors';
23
22
  import { defaultTimes, formatDateTimeZoneIntoIso } from '../internal';
23
+ import { DateTimePickerContainer } from '../internal/date-time-picker-container';
24
24
  import { convertTokens } from '../internal/parse-tokens';
25
25
  import DatePicker from './date-picker';
26
26
  import TimePicker from './time-picker';
27
27
  var packageName = "@atlaskit/datetime-picker";
28
- var packageVersion = "13.0.11";
29
- var isInvalidBorderStyles = css({
30
- borderColor: "var(--ds-border-danger, ".concat(R400, ")")
31
- });
32
- var isFocusedBorderStyles = css({
33
- borderColor: "var(--ds-border-focused, ".concat(B100, ")")
34
- });
35
- var isFocusedStyles = css({
36
- backgroundColor: "var(--ds-background-input-pressed, ".concat(N0, ")")
37
- });
38
- var subtleBgStyles = css({
39
- backgroundColor: 'transparent',
40
- borderColor: 'transparent'
41
- });
42
- var subtleFocusedBgStyles = css({
43
- backgroundColor: "var(--ds-background-input-pressed, transparent)",
44
- borderColor: 'transparent'
45
- });
46
- var noBgStyles = css({
47
- backgroundColor: 'transparent',
48
- borderColor: 'transparent',
49
- '&:hover': {
50
- backgroundColor: 'transparent',
51
- borderColor: 'transparent'
52
- }
53
- });
54
- var hoverStyles = css({
55
- '&:hover': {
56
- backgroundColor: "var(--ds-background-input-hovered, ".concat(N30, ")"),
57
- borderColor: "var(--ds-border-input, ".concat(getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? N100 : N30, ")")
58
- }
59
- });
60
- var isInvalidHoverStyles = css({
61
- '&:hover': {
62
- backgroundColor: "var(--ds-background-input-hovered, ".concat(N0, ")"),
63
- borderColor: "var(--ds-border-danger, ".concat(R400, ")")
64
- }
65
- });
66
- var isDisabledStyles = css({
67
- '&:hover': {
68
- cursor: 'default'
69
- }
70
- });
71
- var baseContainerStyles = css({
72
- display: 'flex',
73
- backgroundColor: "var(--ds-background-input, ".concat(N20, ")"),
74
- border: getBooleanFF('platform.design-system-team.update-input-border-wdith_5abwv') ? "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border-input, ".concat(N100, ")")) : "2px solid ".concat("var(--ds-border-input, ".concat(N20, ")")),
75
- borderRadius: "var(--ds-border-radius, 3px)",
76
- transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
77
- '&:hover': {
78
- cursor: 'pointer'
79
- }
80
- });
81
-
28
+ var packageVersion = "13.1.0";
82
29
  // Make DatePicker 50% the width of DateTimePicker
83
30
  // If rendering an icon container, shrink the TimePicker
84
31
  var datePickerContainerStyles = css({
@@ -287,23 +234,25 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
287
234
  var _timePickerSelectProp = timePickerSelectProps.styles,
288
235
  timePickerStyles = _timePickerSelectProp === void 0 ? {} : _timePickerSelectProp;
289
236
  var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
290
- 'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
237
+ 'aria-label': datePickerProps['label'] || datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
291
238
  styles: mergeStyles(styles, datePickerStyles)
292
239
  });
293
240
  var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
294
- 'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
241
+ 'aria-label': timePickerProps['label'] || timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
295
242
  styles: mergeStyles(styles, timePickerStyles)
296
243
  });
297
244
 
298
245
  // Render DateTimePicker's IconContainer when a value has been filled
299
246
  // Don't use Date or TimePicker's because they can't be customised
300
247
  var isClearable = Boolean(dateValue || timeValue);
301
- var notFocusedOrIsDisabled = !(isFocused || isDisabled);
302
- return jsx("div", _extends({
303
- 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
- }, innerProps, {
305
- "data-testid": testId
306
- }), jsx("input", {
248
+ return jsx(DateTimePickerContainer, {
249
+ appearance: bothProps.appearance,
250
+ isDisabled: isDisabled,
251
+ isFocused: isFocused,
252
+ isInvalid: bothProps.isInvalid,
253
+ testId: testId,
254
+ innerProps: innerProps
255
+ }, jsx("input", {
307
256
  name: name,
308
257
  type: "hidden",
309
258
  value: value,
@@ -1,3 +1,5 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
1
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
4
  import _createClass from "@babel/runtime/helpers/createClass";
3
5
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -5,10 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- import _extends from "@babel/runtime/helpers/extends";
9
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
10
- var _excluded = ["selectProps"],
11
- _excluded2 = ["styles"];
10
+ var _excluded = ["styles"];
12
11
  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
12
  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; }
14
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -20,16 +19,16 @@ import { format, isValid } from 'date-fns';
20
19
  import pick from 'lodash/pick';
21
20
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
22
21
  import { createLocalizationProvider } from '@atlaskit/locale';
23
- import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/select';
22
+ import Select, { CreatableSelect, mergeStyles } from '@atlaskit/select';
24
23
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
25
24
  import { gridSize } from '@atlaskit/theme/constants';
26
25
  import { defaultTimeFormat, defaultTimes, EmptyComponent, placeholderDatetime } from '../internal';
27
- import FixedLayer from '../internal/fixed-layer';
26
+ import { FixedLayerMenu } from '../internal/fixed-layer-menu';
28
27
  import parseTime from '../internal/parse-time';
29
28
  import { convertTokens } from '../internal/parse-tokens';
30
29
  import { makeSingleValue } from '../internal/single-value';
31
30
  var packageName = "@atlaskit/datetime-picker";
32
- var packageVersion = "13.0.11";
31
+ var packageVersion = "13.1.0";
33
32
  var menuStyles = {
34
33
  /* Need to remove default absolute positioning as that causes issues with position fixed */
35
34
  position: 'static',
@@ -38,18 +37,6 @@ var menuStyles = {
38
37
  /* React-Popper has already offset the menu so we need to reset the margin, otherwise the offset value is doubled */
39
38
  margin: 0
40
39
  };
41
- var FixedLayerMenu = function FixedLayerMenu(_ref) {
42
- var selectProps = _ref.selectProps,
43
- rest = _objectWithoutProperties(_ref, _excluded);
44
- return /*#__PURE__*/React.createElement(FixedLayer, {
45
- inputValue: selectProps.inputValue,
46
- containerRef: selectProps.fixedLayerRef,
47
- content: /*#__PURE__*/React.createElement(components.Menu, _extends({}, rest, {
48
- menuShouldScrollIntoView: false
49
- })),
50
- testId: selectProps.testId
51
- });
52
- };
53
40
  var timePickerDefaultProps = {
54
41
  appearance: 'default',
55
42
  autoFocus: false,
@@ -60,6 +47,7 @@ var timePickerDefaultProps = {
60
47
  innerProps: {},
61
48
  isDisabled: false,
62
49
  isInvalid: false,
50
+ label: '',
63
51
  name: '',
64
52
  // These disables are here for proper typing when used as defaults. They
65
53
  // should *not* use the `noop` function.
@@ -210,6 +198,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
210
198
  id = _this$props2.id,
211
199
  innerProps = _this$props2.innerProps,
212
200
  isDisabled = _this$props2.isDisabled,
201
+ label = _this$props2.label,
213
202
  locale = _this$props2.locale,
214
203
  name = _this$props2.name,
215
204
  placeholder = _this$props2.placeholder,
@@ -228,7 +217,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
228
217
  isOpen = _this$getSafeState.isOpen;
229
218
  var _selectProps$styles = selectProps.styles,
230
219
  selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles,
231
- otherSelectProps = _objectWithoutProperties(selectProps, _excluded2);
220
+ otherSelectProps = _objectWithoutProperties(selectProps, _excluded);
232
221
  var SelectComponent = timeIsEditable ? CreatableSelect : Select;
233
222
 
234
223
  /**
@@ -303,6 +292,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
303
292
  "data-testid": testId && "".concat(testId, "--input"),
304
293
  onKeyDown: this.onSelectKeyDown
305
294
  }), /*#__PURE__*/React.createElement(SelectComponent, _extends({
295
+ "aria-label": label || undefined,
306
296
  appearance: appearance,
307
297
  autoFocus: autoFocus,
308
298
  components: selectComponents,