@atlaskit/datetime-picker 17.7.0 → 17.8.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 (100) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/date-picker/package.json +17 -0
  3. package/date-time-picker/package.json +17 -0
  4. package/dist/cjs/components/date-picker.js +31 -27
  5. package/dist/cjs/components/date-time-picker-class.js +9 -9
  6. package/dist/cjs/components/date-time-picker-fc.js +5 -8
  7. package/dist/cjs/components/time-picker.js +14 -9
  8. package/dist/cjs/entry-points/date-picker.js +13 -0
  9. package/dist/cjs/entry-points/date-time-picker.js +13 -0
  10. package/dist/cjs/entry-points/time-picker.js +13 -0
  11. package/dist/cjs/entry-points/types.js +1 -0
  12. package/dist/cjs/internal/default-date-format.js +7 -0
  13. package/dist/cjs/internal/default-times.js +7 -0
  14. package/dist/cjs/internal/empty-component.js +12 -0
  15. package/dist/cjs/internal/fixed-layer-menu-top-layer.js +113 -0
  16. package/dist/cjs/internal/format-date-time-zone-into-iso.js +15 -0
  17. package/dist/cjs/internal/format-date.js +2 -2
  18. package/dist/cjs/internal/get-parsed-iso.js +3 -3
  19. package/dist/cjs/internal/get-placeholder.js +2 -2
  20. package/dist/cjs/internal/menu-top-layer.js +116 -0
  21. package/dist/cjs/internal/pad-two.js +9 -0
  22. package/dist/cjs/internal/parse-date.js +2 -2
  23. package/dist/cjs/internal/placeholder-date-time.js +9 -0
  24. package/dist/es2019/components/date-picker.js +29 -25
  25. package/dist/es2019/components/date-time-picker-class.js +6 -6
  26. package/dist/es2019/components/date-time-picker-fc.js +2 -5
  27. package/dist/es2019/components/time-picker.js +8 -3
  28. package/dist/es2019/entry-points/date-picker.js +1 -0
  29. package/dist/es2019/entry-points/date-time-picker.js +1 -0
  30. package/dist/es2019/entry-points/time-picker.js +1 -0
  31. package/dist/es2019/entry-points/types.js +0 -0
  32. package/dist/es2019/internal/default-date-format.js +1 -0
  33. package/dist/es2019/internal/default-times.js +1 -0
  34. package/dist/es2019/internal/empty-component.js +4 -0
  35. package/dist/es2019/internal/fixed-layer-menu-top-layer.js +103 -0
  36. package/dist/es2019/internal/format-date-time-zone-into-iso.js +9 -0
  37. package/dist/es2019/internal/format-date.js +1 -1
  38. package/dist/es2019/internal/get-parsed-iso.js +1 -1
  39. package/dist/es2019/internal/get-placeholder.js +1 -1
  40. package/dist/es2019/internal/menu-top-layer.js +111 -0
  41. package/dist/es2019/internal/pad-two.js +3 -0
  42. package/dist/es2019/internal/parse-date.js +1 -1
  43. package/dist/es2019/internal/placeholder-date-time.js +3 -0
  44. package/dist/esm/components/date-picker.js +29 -25
  45. package/dist/esm/components/date-time-picker-class.js +6 -6
  46. package/dist/esm/components/date-time-picker-fc.js +2 -5
  47. package/dist/esm/components/time-picker.js +8 -3
  48. package/dist/esm/entry-points/date-picker.js +1 -0
  49. package/dist/esm/entry-points/date-time-picker.js +1 -0
  50. package/dist/esm/entry-points/time-picker.js +1 -0
  51. package/dist/esm/entry-points/types.js +0 -0
  52. package/dist/esm/internal/default-date-format.js +1 -0
  53. package/dist/esm/internal/default-times.js +1 -0
  54. package/dist/esm/internal/empty-component.js +6 -0
  55. package/dist/esm/internal/fixed-layer-menu-top-layer.js +105 -0
  56. package/dist/esm/internal/format-date-time-zone-into-iso.js +9 -0
  57. package/dist/esm/internal/format-date.js +1 -1
  58. package/dist/esm/internal/get-parsed-iso.js +1 -1
  59. package/dist/esm/internal/get-placeholder.js +1 -1
  60. package/dist/esm/internal/menu-top-layer.js +107 -0
  61. package/dist/esm/internal/pad-two.js +3 -0
  62. package/dist/esm/internal/parse-date.js +1 -1
  63. package/dist/esm/internal/placeholder-date-time.js +3 -0
  64. package/dist/types/components/date-time-picker-class.d.ts +0 -2
  65. package/dist/types/components/date-time-picker-fc.d.ts +0 -2
  66. package/dist/types/entry-points/date-picker.d.ts +2 -0
  67. package/dist/types/entry-points/date-time-picker.d.ts +1 -0
  68. package/dist/types/entry-points/time-picker.d.ts +1 -0
  69. package/dist/types/entry-points/types.d.ts +1 -0
  70. package/dist/types/internal/default-date-format.d.ts +1 -0
  71. package/dist/types/internal/default-times.d.ts +1 -0
  72. package/dist/types/internal/empty-component.d.ts +4 -0
  73. package/dist/types/internal/fixed-layer-menu-top-layer.d.ts +12 -0
  74. package/dist/types/internal/format-date-time-zone-into-iso.d.ts +4 -0
  75. package/dist/types/internal/menu-top-layer.d.ts +16 -0
  76. package/dist/types/internal/pad-two.d.ts +1 -0
  77. package/dist/types/internal/placeholder-date-time.d.ts +1 -0
  78. package/dist/types-ts4.5/components/date-time-picker-class.d.ts +0 -2
  79. package/dist/types-ts4.5/components/date-time-picker-fc.d.ts +0 -2
  80. package/dist/types-ts4.5/entry-points/date-picker.d.ts +2 -0
  81. package/dist/types-ts4.5/entry-points/date-time-picker.d.ts +1 -0
  82. package/dist/types-ts4.5/entry-points/time-picker.d.ts +1 -0
  83. package/dist/types-ts4.5/entry-points/types.d.ts +1 -0
  84. package/dist/types-ts4.5/internal/default-date-format.d.ts +1 -0
  85. package/dist/types-ts4.5/internal/default-times.d.ts +1 -0
  86. package/dist/types-ts4.5/internal/empty-component.d.ts +4 -0
  87. package/dist/types-ts4.5/internal/fixed-layer-menu-top-layer.d.ts +12 -0
  88. package/dist/types-ts4.5/internal/format-date-time-zone-into-iso.d.ts +4 -0
  89. package/dist/types-ts4.5/internal/menu-top-layer.d.ts +16 -0
  90. package/dist/types-ts4.5/internal/pad-two.d.ts +1 -0
  91. package/dist/types-ts4.5/internal/placeholder-date-time.d.ts +1 -0
  92. package/package.json +12 -8
  93. package/time-picker/package.json +17 -0
  94. package/types/package.json +5 -5
  95. package/dist/cjs/internal/index.js +0 -31
  96. package/dist/es2019/internal/index.js +0 -20
  97. package/dist/esm/internal/index.js +0 -22
  98. package/dist/types/internal/index.d.ts +0 -10
  99. package/dist/types-ts4.5/internal/index.d.ts +0 -10
  100. package/offerings.json +0 -98
@@ -0,0 +1,103 @@
1
+ /* fixed-layer-menu-top-layer.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import * as React from 'react';
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ import { useRef } from 'react';
6
+ import { components } from '@atlaskit/select';
7
+ import { slideAndFade } from '@atlaskit/top-layer/animations';
8
+ import { fromLegacyPlacement } from '@atlaskit/top-layer/placement-map';
9
+ import { Popup } from '@atlaskit/top-layer/popup';
10
+ const animation = slideAndFade();
11
+
12
+ /**
13
+ * Bottom-start placement: time options menu appears below and aligned to the
14
+ * start edge of the trigger (the select input).
15
+ */
16
+ const popupPlacement = fromLegacyPlacement({
17
+ legacy: 'bottom-start'
18
+ });
19
+
20
+ /**
21
+ * Top-layer version of the fixed layer menu used in the time picker.
22
+ *
23
+ * Uses `@atlaskit/top-layer/popup` (Popup.Content + Popup.Surface) so the
24
+ * time options list renders in the browser's top layer via the native Popover API
25
+ * and is positioned via CSS Anchor Positioning. This avoids overflow clipping,
26
+ * z-index wars, and portal-based layering.
27
+ *
28
+ * Gated behind the `platform-dst-top-layer` feature flag.
29
+ */
30
+ export const FixedLayerMenuTopLayer = ({
31
+ className,
32
+ clearValue,
33
+ cx,
34
+ getStyles,
35
+ getValue,
36
+ hasValue,
37
+ innerProps,
38
+ innerRef,
39
+ isLoading,
40
+ isMulti,
41
+ isRtl,
42
+ maxMenuHeight,
43
+ menuPlacement,
44
+ menuPosition,
45
+ menuShouldScrollIntoView,
46
+ minMenuHeight,
47
+ options,
48
+ placement,
49
+ selectOption,
50
+ selectProps,
51
+ setValue,
52
+ children,
53
+ ...rest
54
+ }) => {
55
+ var _selectProps$fixedLay, _selectProps$fixedLay2;
56
+ // The select's container element is the anchor for the popup.
57
+ // @ts-ignore -- fixedLayerRef is a custom prop passed through selectProps
58
+ const triggerRef = useRef((_selectProps$fixedLay = selectProps.fixedLayerRef) !== null && _selectProps$fixedLay !== void 0 ? _selectProps$fixedLay : null);
59
+ // @ts-ignore -- fixedLayerRef is a custom prop passed through selectProps
60
+ triggerRef.current = (_selectProps$fixedLay2 = selectProps.fixedLayerRef) !== null && _selectProps$fixedLay2 !== void 0 ? _selectProps$fixedLay2 : null;
61
+ return /*#__PURE__*/React.createElement(Popup.Content, {
62
+ role: "listbox",
63
+ isOpen: true
64
+ // `mode="manual"` opts out of the native popover light-dismiss
65
+ // (Esc / click-outside). react-select already owns those: opening
66
+ // the menu via a click on the input that lives outside the popover
67
+ // element triggers the browser's auto-dismiss as that very click
68
+ // bubbles, slamming the menu shut before the user sees it. With
69
+ // `manual`, react-select's existing onMenuClose / outside-click
70
+ // logic remains the single source of truth.
71
+ ,
72
+ mode: "manual",
73
+ placement: popupPlacement,
74
+ triggerRef: triggerRef,
75
+ animate: animation
76
+ // @ts-ignore -- testId is a custom prop passed through selectProps
77
+ ,
78
+ testId: selectProps.testId && `${selectProps.testId}--popup`
79
+ }, /*#__PURE__*/React.createElement(Popup.Surface, null, /*#__PURE__*/React.createElement(components.Menu, _extends({}, rest, {
80
+ // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
81
+ className: className,
82
+ clearValue: clearValue,
83
+ cx: cx,
84
+ getStyles: getStyles,
85
+ getValue: getValue,
86
+ hasValue: hasValue,
87
+ innerProps: innerProps,
88
+ innerRef: innerRef,
89
+ isLoading: isLoading,
90
+ isMulti: isMulti,
91
+ isRtl: isRtl,
92
+ maxMenuHeight: maxMenuHeight,
93
+ menuPlacement: menuPlacement,
94
+ menuPosition: menuPosition,
95
+ menuShouldScrollIntoView: false || menuShouldScrollIntoView,
96
+ minMenuHeight: minMenuHeight,
97
+ options: options,
98
+ placement: placement,
99
+ selectOption: selectOption,
100
+ selectProps: selectProps,
101
+ setValue: setValue
102
+ }), children)));
103
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Formats a date, time, and zone into a ISO string.
3
+ */
4
+ export function formatDateTimeZoneIntoIso(date, time, zone) {
5
+ // 12:00 => 12:00, 1:00 => 01:00
6
+ const needsLeadingZero = /^\d:/;
7
+ const sanitizedTime = needsLeadingZero.test(time) ? `0${time}` : time;
8
+ return `${date}T${sanitizedTime}${zone}`;
9
+ }
@@ -18,8 +18,8 @@
18
18
 
19
19
  // oxlint-disable-next-line @atlassian/no-restricted-imports
20
20
  import { format, parseISO } from 'date-fns';
21
+ import { defaultDateFormat } from './default-date-format';
21
22
  import { convertTokens } from './parse-tokens';
22
- import { defaultDateFormat } from './index';
23
23
  export const formatDate = (value, di) => {
24
24
  const {
25
25
  formatDisplayLabel,
@@ -18,7 +18,7 @@
18
18
 
19
19
  // oxlint-disable-next-line @atlassian/no-restricted-imports
20
20
  import { lastDayOfMonth } from 'date-fns';
21
- import { padToTwo } from './index';
21
+ import { padToTwo } from './pad-two';
22
22
  export const getParsedISO = di => {
23
23
  const {
24
24
  iso
@@ -18,7 +18,7 @@
18
18
 
19
19
  // oxlint-disable-next-line @atlassian/no-restricted-imports
20
20
 
21
- import { placeholderDatetime } from './index';
21
+ import { placeholderDatetime } from './placeholder-date-time';
22
22
  export const getPlaceholder = di => {
23
23
  const {
24
24
  placeholder,
@@ -0,0 +1,111 @@
1
+ /* menu-top-layer.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import * as React from 'react';
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ import { Fragment, useRef } from 'react';
6
+ import { isValid, parseISO } from 'date-fns';
7
+ import Calendar from '@atlaskit/calendar';
8
+ import { slideAndFade } from '@atlaskit/top-layer/animations';
9
+ import { fromLegacyPlacement } from '@atlaskit/top-layer/placement-map';
10
+ import { Popup } from '@atlaskit/top-layer/popup';
11
+ const animation = slideAndFade();
12
+
13
+ /**
14
+ * Bottom-start placement: calendar appears below and aligned to the
15
+ * start edge of the trigger (the select input).
16
+ */
17
+ const popupPlacement = fromLegacyPlacement({
18
+ legacy: 'bottom-start'
19
+ });
20
+
21
+ /**
22
+ * @param isos A series of ISO dates.
23
+ * @returns The last valid date within the array of ISO strings.
24
+ */
25
+ function getValidDate(isos) {
26
+ return isos.reduce((acc, iso) => {
27
+ const date = parseISO(iso);
28
+ return isValid(date) ? {
29
+ day: date.getDate(),
30
+ month: date.getMonth() + 1,
31
+ year: date.getFullYear()
32
+ } : acc;
33
+ }, {});
34
+ }
35
+
36
+ /**
37
+ * Top-layer version of the date picker menu.
38
+ *
39
+ * Uses `@atlaskit/top-layer/popup` (Popup.Content + Popup.Surface) so the
40
+ * calendar renders in the browser's top layer via the native Popover API
41
+ * and is positioned via CSS Anchor Positioning. This avoids overflow clipping,
42
+ * z-index wars, and portal-based layering.
43
+ *
44
+ * Gated behind the `platform-dst-top-layer` feature flag.
45
+ */
46
+ export const MenuTopLayer = ({
47
+ selectProps,
48
+ innerProps
49
+ }) => {
50
+ var _selectProps$calendar, _selectProps$calendar2;
51
+ const {
52
+ calendarValue,
53
+ calendarView,
54
+ menuInnerWrapper: MenuInnerWrapper
55
+ } = selectProps;
56
+ const {
57
+ day,
58
+ month,
59
+ year
60
+ } = getValidDate([calendarValue, calendarView]);
61
+
62
+ // The select's container element is the anchor for the popup.
63
+ const triggerRef = useRef((_selectProps$calendar = selectProps.calendarContainerRef) !== null && _selectProps$calendar !== void 0 ? _selectProps$calendar : null);
64
+ triggerRef.current = (_selectProps$calendar2 = selectProps.calendarContainerRef) !== null && _selectProps$calendar2 !== void 0 ? _selectProps$calendar2 : null;
65
+ const onMenuMouseDown = event => {
66
+ if (event.button !== 0) {
67
+ return;
68
+ }
69
+ event.stopPropagation();
70
+ event.preventDefault();
71
+ };
72
+ const Wrapper = typeof MenuInnerWrapper === 'function' ? MenuInnerWrapper : Fragment;
73
+ return /*#__PURE__*/React.createElement(Popup.Content, {
74
+ role: "dialog",
75
+ label: "calendar",
76
+ isOpen: true
77
+ // `mode="manual"` opts out of native popover light-dismiss.
78
+ // react-select / DateTimePicker already own outside-click and
79
+ // Esc handling. Without this, the same click that opens the
80
+ // menu (which targets the select input outside the popover)
81
+ // also bubbles to the browser's auto-dismiss handler and
82
+ // immediately closes the popover.
83
+ ,
84
+ mode: "manual",
85
+ placement: popupPlacement,
86
+ triggerRef: triggerRef,
87
+ animate: animation,
88
+ testId: selectProps.testId && `${selectProps.testId}--popup`
89
+ }, /*#__PURE__*/React.createElement(Popup.Surface, null, /*#__PURE__*/React.createElement("div", _extends({}, innerProps, {
90
+ role: "presentation",
91
+ onMouseDown: onMenuMouseDown
92
+ }), /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(Calendar, {
93
+ day: day,
94
+ month: month,
95
+ year: year,
96
+ disabled: selectProps.calendarDisabled,
97
+ disabledDateFilter: selectProps.calendarDisabledDateFilter,
98
+ minDate: selectProps.calendarMinDate,
99
+ maxDate: selectProps.calendarMaxDate,
100
+ nextMonthLabel: selectProps.nextMonthLabel,
101
+ onChange: selectProps.onCalendarChange,
102
+ onSelect: selectProps.onCalendarSelect,
103
+ previousMonthLabel: selectProps.previousMonthLabel,
104
+ ref: selectProps.calendarRef,
105
+ selected: [selectProps.calendarValue],
106
+ shouldSetFocusOnCurrentDay: selectProps.shouldSetFocusOnCurrentDay,
107
+ locale: selectProps.calendarLocale,
108
+ testId: selectProps.testId && `${selectProps.testId}--calendar`,
109
+ weekStartDay: selectProps.calendarWeekStartDay
110
+ })))));
111
+ };
@@ -0,0 +1,3 @@
1
+ export function padToTwo(number) {
2
+ return number <= 99 ? `0${number}`.slice(-2) : `${number}`;
3
+ }
@@ -16,7 +16,7 @@
16
16
  * broken out to be it's own function.
17
17
  */
18
18
 
19
- import { defaultDateFormat } from './index';
19
+ import { defaultDateFormat } from './default-date-format';
20
20
 
21
21
  /**
22
22
  * There are two props that can change how the date is parsed.
@@ -0,0 +1,3 @@
1
+ // This date was chosen to clearly show date and time formats (day > 12)
2
+ // e.g. 18/02/1993 vs. 2/18/1993 and 1:00 PM vs 13:00
3
+ export const placeholderDatetime = new Date(1993, 1, 18, 13);
@@ -21,9 +21,10 @@ import { cx } from '@atlaskit/css';
21
21
  import { useId } from '@atlaskit/ds-lib/use-id';
22
22
  import CalendarIcon from '@atlaskit/icon/core/calendar';
23
23
  import { createLocalizationProvider } from '@atlaskit/locale';
24
+ import { fg } from '@atlaskit/platform-feature-flags';
24
25
  import { Box } from '@atlaskit/primitives/compiled';
25
26
  import Select, { mergeStyles } from '@atlaskit/select';
26
- import { EmptyComponent } from '../internal';
27
+ import { EmptyComponent } from '../internal/empty-component';
27
28
  import { formatDate } from '../internal/format-date';
28
29
  import { getParsedISO } from '../internal/get-parsed-iso';
29
30
  import { getPlaceholder } from '../internal/get-placeholder';
@@ -32,10 +33,11 @@ import { getShortISOString } from '../internal/get-short-iso-string';
32
33
  import { IndicatorsContainer as _IndicatorsContainer } from '../internal/indicators-container';
33
34
  import { isDateDisabled } from '../internal/is-date-disabled';
34
35
  import { Menu } from '../internal/menu';
36
+ import { MenuTopLayer } from '../internal/menu-top-layer';
35
37
  import { parseDate } from '../internal/parse-date';
36
38
  import { makeSingleValue } from '../internal/single-value';
37
39
  var packageName = "@atlaskit/datetime-picker";
38
- var packageVersion = "0.0.0-development";
40
+ var packageVersion = "17.8.0";
39
41
  var styles = {
40
42
  pickerContainerStyle: "_kqswh2mm",
41
43
  dropdownIndicatorStyles: "_1ul91k8s _1tke1k8s _1e0c1txw _4cvr1h6o _1bah1h6o",
@@ -192,10 +194,14 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, _forwardedRef) {
192
194
  return;
193
195
  }
194
196
  if (isOpen && wasOpenedFromCalendarButton) {
195
- var _calendarRef$current;
196
197
  setIsKeyDown(false);
197
- // Focus on the first button within the calendar
198
- calendarRef === null || calendarRef === void 0 || (_calendarRef$current = calendarRef.current) === null || _calendarRef$current === void 0 || (_calendarRef$current = _calendarRef$current.querySelector('button')) === null || _calendarRef$current === void 0 || _calendarRef$current.focus();
198
+ // When using top-layer, Popup.Content with role='dialog' automatically
199
+ // focuses the first focusable element no manual focus needed.
200
+ if (!fg('platform-dst-top-layer')) {
201
+ var _calendarRef$current;
202
+ // Focus on the first button within the calendar
203
+ calendarRef === null || calendarRef === void 0 || (_calendarRef$current = calendarRef.current) === null || _calendarRef$current === void 0 || (_calendarRef$current = _calendarRef$current.querySelector('button')) === null || _calendarRef$current === void 0 || _calendarRef$current.focus();
204
+ }
199
205
  }
200
206
  }, [isKeyDown, calendarRef, isOpen, wasOpenedFromCalendarButton]);
201
207
  var getValue = function getValue() {
@@ -219,19 +225,17 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, _forwardedRef) {
219
225
  setWasOpenedFromCalendarButton(false);
220
226
  onChangePropWithAnalytics(iso);
221
227
 
222
- // Yes, this is not ideal. The alternative is to be able to place a ref
223
- // on the inner input of Select itself, which would require a lot of
224
- // extra stuff in the Select component for only this one thing. While
225
- // this would be more "React-y", it doesn't seem to pose any other
226
- // benefits. Performance-wise, we are only searching within the
227
- // container, so it's quick.
228
- if (wasOpenedFromCalendarButton) {
229
- var _calendarButtonRef$cu;
230
- (_calendarButtonRef$cu = calendarButtonRef.current) === null || _calendarButtonRef$cu === void 0 || _calendarButtonRef$cu.focus();
231
- } else {
232
- var _containerRef$current;
233
- var innerCombobox = containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector('[role="combobox"]');
234
- innerCombobox === null || innerCombobox === void 0 || innerCombobox.focus();
228
+ // When using top-layer, PopupContent handles focus restoration automatically
229
+ // on close based on the role. Only manually restore focus for the legacy path.
230
+ if (!fg('platform-dst-top-layer')) {
231
+ if (wasOpenedFromCalendarButton) {
232
+ var _calendarButtonRef$cu;
233
+ (_calendarButtonRef$cu = calendarButtonRef.current) === null || _calendarButtonRef$cu === void 0 || _calendarButtonRef$cu.focus();
234
+ } else {
235
+ var _containerRef$current;
236
+ var innerCombobox = containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector('[role="combobox"]');
237
+ innerCombobox === null || innerCombobox === void 0 || innerCombobox.focus();
238
+ }
235
239
  }
236
240
  setIsOpen(false);
237
241
  };
@@ -311,12 +315,12 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, _forwardedRef) {
311
315
  }
312
316
  switch (keyPressed) {
313
317
  case 'escape':
314
- // Yes, this is not ideal. The alternative is to be able to place a ref
315
- // on the inner input of Select itself, which would require a lot of
316
- // extra stuff in the Select component for only this one thing. While
317
- // this would be more "React-y", it doesn't seem to pose any other
318
- // benefits. Performance-wise, we are only searching within the
319
- // container, so it's quick.
318
+ // Restore focus on close. Both code paths handle this here:
319
+ // the legacy path because it has no built-in restoration, and
320
+ // the top-layer path because the menu uses `mode="manual"` to
321
+ // avoid the auto-popover light-dismiss closing the menu on the
322
+ // same click that opens it (see internal/menu-top-layer.tsx).
323
+ // `manual` mode disables the browser's native focus return.
320
324
  if (wasOpenedFromCalendarButton) {
321
325
  var _calendarButtonRef$cu2;
322
326
  (_calendarButtonRef$cu2 = calendarButtonRef.current) === null || _calendarButtonRef$cu2 === void 0 || _calendarButtonRef$cu2.focus();
@@ -466,7 +470,7 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, _forwardedRef) {
466
470
  }));
467
471
  }
468
472
  } : {}), {}, {
469
- Menu: Menu,
473
+ Menu: fg('platform-dst-top-layer') ? MenuTopLayer : Menu,
470
474
  SingleValue: SingleValue
471
475
  }, !showClearIndicator && {
472
476
  ClearIndicator: EmptyComponent
@@ -19,13 +19,13 @@ import { format, isValid, parseISO } from 'date-fns';
19
19
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
20
20
  import SelectClearIcon from '@atlaskit/icon/core/cross-circle';
21
21
  import { mergeStyles } from '@atlaskit/select';
22
- import { formatDateTimeZoneIntoIso } from '../internal';
23
22
  import { DateTimePickerContainer } from '../internal/date-time-picker-container';
23
+ import { formatDateTimeZoneIntoIso } from '../internal/format-date-time-zone-into-iso';
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 = "0.0.0-development";
28
+ var packageVersion = "17.8.0";
29
29
  var compiledStyles = {
30
30
  datePickerContainerStyles: "_i0dl1ssb _16jlkb7n _1o9zidpf",
31
31
  timePickerContainerStyles: "_i0dl1ssb _16jlkb7n",
@@ -58,8 +58,6 @@ var dateTimePickerDefaultProps = {
58
58
  // Not including a default prop for value as it will
59
59
  // Make the component a controlled component
60
60
  };
61
- export var datePickerDefaultAriaLabel = 'Date';
62
- export var timePickerDefaultAriaLabel = 'Time';
63
61
 
64
62
  // eslint-disable-next-line @repo/internal/react/no-class-components
65
63
  var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
@@ -266,13 +264,13 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
266
264
  var timeValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.timeValue;
267
265
  var datePickerSelectProps = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectProps;
268
266
  var datePickerAriaDescribedBy = datePickerProps['aria-describedby'] || ariaDescribedBy;
269
- var datePickerLabel = datePickerProps.label || datePickerDefaultAriaLabel;
267
+ var datePickerLabel = datePickerProps.label || 'Date';
270
268
  var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
271
269
  styles: mergeStyles(styles, datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.styles)
272
270
  });
273
271
  var timePickerSelectProps = timePickerProps === null || timePickerProps === void 0 ? void 0 : timePickerProps.selectProps;
274
272
  var timePickerAriaDescribedBy = timePickerProps['aria-describedby'] || ariaDescribedBy;
275
- var timePickerLabel = timePickerProps.label || timePickerDefaultAriaLabel;
273
+ var timePickerLabel = timePickerProps.label || 'Time';
276
274
  var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
277
275
  styles: mergeStyles(styles, timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.styles)
278
276
  });
@@ -402,4 +400,6 @@ var DateTimePicker = withAnalyticsContext({
402
400
  }
403
401
  })
404
402
  })(DateTimePickerComponent));
403
+
404
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
405
405
  export default DateTimePicker;
@@ -21,13 +21,13 @@ import { IconButton } from '@atlaskit/button/new';
21
21
  import SelectClearIcon from '@atlaskit/icon/core/cross-circle';
22
22
  import { Box, Inline } from '@atlaskit/primitives/compiled';
23
23
  import { mergeStyles } from '@atlaskit/select';
24
- import { formatDateTimeZoneIntoIso } from '../internal';
25
24
  import { DateTimePickerContainer } from '../internal/date-time-picker-container';
25
+ import { formatDateTimeZoneIntoIso } from '../internal/format-date-time-zone-into-iso';
26
26
  import { convertTokens } from '../internal/parse-tokens';
27
27
  import DatePicker from './date-picker';
28
28
  import TimePicker from './time-picker';
29
29
  var packageName = "@atlaskit/datetime-picker";
30
- var packageVersion = "0.0.0-development";
30
+ var packageVersion = "17.8.0";
31
31
  var analyticsAttributes = {
32
32
  componentName: 'dateTimePicker',
33
33
  packageName: packageName,
@@ -67,9 +67,6 @@ var styles = {
67
67
  * that the previous useState approach missed.
68
68
  */
69
69
 
70
- export var datePickerDefaultAriaLabel = 'Date';
71
- export var timePickerDefaultAriaLabel = 'Time';
72
-
73
70
  /**
74
71
  * __Date time picker__
75
72
  *
@@ -12,14 +12,19 @@ import { format, isValid } from 'date-fns';
12
12
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
13
13
  import __noop from '@atlaskit/ds-lib/noop';
14
14
  import { createLocalizationProvider } from '@atlaskit/locale';
15
+ import { fg } from '@atlaskit/platform-feature-flags';
15
16
  import Select, { CreatableSelect, mergeStyles } from '@atlaskit/select';
16
- import { defaultTimeFormat, defaultTimes, EmptyComponent, placeholderDatetime } from '../internal';
17
+ import { defaultTimes } from '../internal/default-times';
18
+ import { EmptyComponent } from '../internal/empty-component';
17
19
  import { FixedLayerMenu } from '../internal/fixed-layer-menu';
20
+ import { FixedLayerMenuTopLayer } from '../internal/fixed-layer-menu-top-layer';
18
21
  import parseTime from '../internal/parse-time';
19
22
  import { convertTokens } from '../internal/parse-tokens';
23
+ import { placeholderDatetime } from '../internal/placeholder-date-time';
20
24
  import { makeSingleValue } from '../internal/single-value';
21
25
  var packageName = "@atlaskit/datetime-picker";
22
- var packageVersion = "0.0.0-development";
26
+ var packageVersion = "17.8.0";
27
+ var defaultTimeFormat = 'h:mma';
23
28
  var menuStyles = {
24
29
  /* Need to remove default absolute positioning as that causes issues with position fixed */
25
30
  position: 'static',
@@ -271,7 +276,7 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref2, _ref) {
271
276
  });
272
277
  var selectComponents = _objectSpread({
273
278
  DropdownIndicator: EmptyComponent,
274
- Menu: FixedLayerMenu,
279
+ Menu: fg('platform-dst-top-layer') ? FixedLayerMenuTopLayer : FixedLayerMenu,
275
280
  SingleValue: SingleValue
276
281
  }, hideIcon && {
277
282
  ClearIndicator: EmptyComponent
@@ -0,0 +1 @@
1
+ export { default } from '../components/date-picker';
@@ -0,0 +1 @@
1
+ export { default } from '../components/date-time-picker';
@@ -0,0 +1 @@
1
+ export { default } from '../components/time-picker';
File without changes
@@ -0,0 +1 @@
1
+ export var defaultDateFormat = 'YYYY/MM/DD';
@@ -0,0 +1 @@
1
+ export var defaultTimes = ['09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00'];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This component is used to hide portions of Select component.
3
+ */
4
+ export var EmptyComponent = function EmptyComponent() {
5
+ return null;
6
+ };
@@ -0,0 +1,105 @@
1
+ /* fixed-layer-menu-top-layer.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["className", "clearValue", "cx", "getStyles", "getValue", "hasValue", "innerProps", "innerRef", "isLoading", "isMulti", "isRtl", "maxMenuHeight", "menuPlacement", "menuPosition", "menuShouldScrollIntoView", "minMenuHeight", "options", "placement", "selectOption", "selectProps", "setValue", "children"];
5
+ import * as React from 'react';
6
+ import { ax, ix } from "@compiled/react/runtime";
7
+ import { useRef } from 'react';
8
+ import { components } from '@atlaskit/select';
9
+ import { slideAndFade } from '@atlaskit/top-layer/animations';
10
+ import { fromLegacyPlacement } from '@atlaskit/top-layer/placement-map';
11
+ import { Popup } from '@atlaskit/top-layer/popup';
12
+ var animation = slideAndFade();
13
+
14
+ /**
15
+ * Bottom-start placement: time options menu appears below and aligned to the
16
+ * start edge of the trigger (the select input).
17
+ */
18
+ var popupPlacement = fromLegacyPlacement({
19
+ legacy: 'bottom-start'
20
+ });
21
+
22
+ /**
23
+ * Top-layer version of the fixed layer menu used in the time picker.
24
+ *
25
+ * Uses `@atlaskit/top-layer/popup` (Popup.Content + Popup.Surface) so the
26
+ * time options list renders in the browser's top layer via the native Popover API
27
+ * and is positioned via CSS Anchor Positioning. This avoids overflow clipping,
28
+ * z-index wars, and portal-based layering.
29
+ *
30
+ * Gated behind the `platform-dst-top-layer` feature flag.
31
+ */
32
+ var FixedLayerMenuTopLayer = function FixedLayerMenuTopLayer(_ref) {
33
+ var _selectProps$fixedLay, _selectProps$fixedLay2;
34
+ var className = _ref.className,
35
+ clearValue = _ref.clearValue,
36
+ cx = _ref.cx,
37
+ getStyles = _ref.getStyles,
38
+ getValue = _ref.getValue,
39
+ hasValue = _ref.hasValue,
40
+ innerProps = _ref.innerProps,
41
+ innerRef = _ref.innerRef,
42
+ isLoading = _ref.isLoading,
43
+ isMulti = _ref.isMulti,
44
+ isRtl = _ref.isRtl,
45
+ maxMenuHeight = _ref.maxMenuHeight,
46
+ menuPlacement = _ref.menuPlacement,
47
+ menuPosition = _ref.menuPosition,
48
+ menuShouldScrollIntoView = _ref.menuShouldScrollIntoView,
49
+ minMenuHeight = _ref.minMenuHeight,
50
+ options = _ref.options,
51
+ placement = _ref.placement,
52
+ selectOption = _ref.selectOption,
53
+ selectProps = _ref.selectProps,
54
+ setValue = _ref.setValue,
55
+ children = _ref.children,
56
+ rest = _objectWithoutProperties(_ref, _excluded);
57
+ // The select's container element is the anchor for the popup.
58
+ // @ts-ignore -- fixedLayerRef is a custom prop passed through selectProps
59
+ var triggerRef = useRef((_selectProps$fixedLay = selectProps.fixedLayerRef) !== null && _selectProps$fixedLay !== void 0 ? _selectProps$fixedLay : null);
60
+ // @ts-ignore -- fixedLayerRef is a custom prop passed through selectProps
61
+ triggerRef.current = (_selectProps$fixedLay2 = selectProps.fixedLayerRef) !== null && _selectProps$fixedLay2 !== void 0 ? _selectProps$fixedLay2 : null;
62
+ return /*#__PURE__*/React.createElement(Popup.Content, {
63
+ role: "listbox",
64
+ isOpen: true
65
+ // `mode="manual"` opts out of the native popover light-dismiss
66
+ // (Esc / click-outside). react-select already owns those: opening
67
+ // the menu via a click on the input that lives outside the popover
68
+ // element triggers the browser's auto-dismiss as that very click
69
+ // bubbles, slamming the menu shut before the user sees it. With
70
+ // `manual`, react-select's existing onMenuClose / outside-click
71
+ // logic remains the single source of truth.
72
+ ,
73
+ mode: "manual",
74
+ placement: popupPlacement,
75
+ triggerRef: triggerRef,
76
+ animate: animation
77
+ // @ts-ignore -- testId is a custom prop passed through selectProps
78
+ ,
79
+ testId: selectProps.testId && "".concat(selectProps.testId, "--popup")
80
+ }, /*#__PURE__*/React.createElement(Popup.Surface, null, /*#__PURE__*/React.createElement(components.Menu, _extends({}, rest, {
81
+ // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
82
+ className: className,
83
+ clearValue: clearValue,
84
+ cx: cx,
85
+ getStyles: getStyles,
86
+ getValue: getValue,
87
+ hasValue: hasValue,
88
+ innerProps: innerProps,
89
+ innerRef: innerRef,
90
+ isLoading: isLoading,
91
+ isMulti: isMulti,
92
+ isRtl: isRtl,
93
+ maxMenuHeight: maxMenuHeight,
94
+ menuPlacement: menuPlacement,
95
+ menuPosition: menuPosition,
96
+ menuShouldScrollIntoView: false || menuShouldScrollIntoView,
97
+ minMenuHeight: minMenuHeight,
98
+ options: options,
99
+ placement: placement,
100
+ selectOption: selectOption,
101
+ selectProps: selectProps,
102
+ setValue: setValue
103
+ }), children)));
104
+ };
105
+ export { FixedLayerMenuTopLayer };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Formats a date, time, and zone into a ISO string.
3
+ */
4
+ export function formatDateTimeZoneIntoIso(date, time, zone) {
5
+ // 12:00 => 12:00, 1:00 => 01:00
6
+ var needsLeadingZero = /^\d:/;
7
+ var sanitizedTime = needsLeadingZero.test(time) ? "0".concat(time) : time;
8
+ return "".concat(date, "T").concat(sanitizedTime).concat(zone);
9
+ }
@@ -18,8 +18,8 @@
18
18
 
19
19
  // oxlint-disable-next-line @atlassian/no-restricted-imports
20
20
  import { format, parseISO } from 'date-fns';
21
+ import { defaultDateFormat } from './default-date-format';
21
22
  import { convertTokens } from './parse-tokens';
22
- import { defaultDateFormat } from './index';
23
23
  export var formatDate = function formatDate(value, di) {
24
24
  var formatDisplayLabel = di.formatDisplayLabel,
25
25
  dateFormat = di.dateFormat,
@@ -19,7 +19,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
19
19
 
20
20
  // oxlint-disable-next-line @atlassian/no-restricted-imports
21
21
  import { lastDayOfMonth } from 'date-fns';
22
- import { padToTwo } from './index';
22
+ import { padToTwo } from './pad-two';
23
23
  export var getParsedISO = function getParsedISO(di) {
24
24
  var iso = di.iso;
25
25
  var _iso$split = iso.split('-'),