@atlaskit/datetime-picker 17.8.0 → 17.8.2

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.
@@ -0,0 +1,107 @@
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
+ var 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
+ var 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(function (acc, iso) {
27
+ var 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 var MenuTopLayer = function MenuTopLayer(_ref) {
47
+ var _selectProps$calendar, _selectProps$calendar2;
48
+ var selectProps = _ref.selectProps,
49
+ innerProps = _ref.innerProps;
50
+ var calendarValue = selectProps.calendarValue,
51
+ calendarView = selectProps.calendarView,
52
+ MenuInnerWrapper = selectProps.menuInnerWrapper;
53
+ var _getValidDate = getValidDate([calendarValue, calendarView]),
54
+ day = _getValidDate.day,
55
+ month = _getValidDate.month,
56
+ year = _getValidDate.year;
57
+
58
+ // The select's container element is the anchor for the popup.
59
+ var triggerRef = useRef((_selectProps$calendar = selectProps.calendarContainerRef) !== null && _selectProps$calendar !== void 0 ? _selectProps$calendar : null);
60
+ triggerRef.current = (_selectProps$calendar2 = selectProps.calendarContainerRef) !== null && _selectProps$calendar2 !== void 0 ? _selectProps$calendar2 : null;
61
+ var onMenuMouseDown = function onMenuMouseDown(event) {
62
+ if (event.button !== 0) {
63
+ return;
64
+ }
65
+ event.stopPropagation();
66
+ event.preventDefault();
67
+ };
68
+ var Wrapper = typeof MenuInnerWrapper === 'function' ? MenuInnerWrapper : Fragment;
69
+ return /*#__PURE__*/React.createElement(Popup.Content, {
70
+ role: "dialog",
71
+ label: "calendar",
72
+ isOpen: true
73
+ // `mode="manual"` opts out of native popover light-dismiss.
74
+ // react-select / DateTimePicker already own outside-click and
75
+ // Esc handling. Without this, the same click that opens the
76
+ // menu (which targets the select input outside the popover)
77
+ // also bubbles to the browser's auto-dismiss handler and
78
+ // immediately closes the popover.
79
+ ,
80
+ mode: "manual",
81
+ placement: popupPlacement,
82
+ triggerRef: triggerRef,
83
+ animate: animation,
84
+ testId: selectProps.testId && "".concat(selectProps.testId, "--popup")
85
+ }, /*#__PURE__*/React.createElement(Popup.Surface, null, /*#__PURE__*/React.createElement("div", _extends({}, innerProps, {
86
+ role: "presentation",
87
+ onMouseDown: onMenuMouseDown
88
+ }), /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(Calendar, {
89
+ day: day,
90
+ month: month,
91
+ year: year,
92
+ disabled: selectProps.calendarDisabled,
93
+ disabledDateFilter: selectProps.calendarDisabledDateFilter,
94
+ minDate: selectProps.calendarMinDate,
95
+ maxDate: selectProps.calendarMaxDate,
96
+ nextMonthLabel: selectProps.nextMonthLabel,
97
+ onChange: selectProps.onCalendarChange,
98
+ onSelect: selectProps.onCalendarSelect,
99
+ previousMonthLabel: selectProps.previousMonthLabel,
100
+ ref: selectProps.calendarRef,
101
+ selected: [selectProps.calendarValue],
102
+ shouldSetFocusOnCurrentDay: selectProps.shouldSetFocusOnCurrentDay,
103
+ locale: selectProps.calendarLocale,
104
+ testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
105
+ weekStartDay: selectProps.calendarWeekStartDay
106
+ })))));
107
+ };
@@ -0,0 +1,12 @@
1
+ import { type MenuProps, type OptionType } from '@atlaskit/select';
2
+ /**
3
+ * Top-layer version of the fixed layer menu used in the time picker.
4
+ *
5
+ * Uses `@atlaskit/top-layer/popup` (Popup.Content + Popup.Surface) so the
6
+ * time options list renders in the browser's top layer via the native Popover API
7
+ * and is positioned via CSS Anchor Positioning. This avoids overflow clipping,
8
+ * z-index wars, and portal-based layering.
9
+ *
10
+ * Gated behind the `platform-dst-top-layer` feature flag.
11
+ */
12
+ export declare const FixedLayerMenuTopLayer: ({ className, clearValue, cx, getStyles, getValue, hasValue, innerProps, innerRef, isLoading, isMulti, isRtl, maxMenuHeight, menuPlacement, menuPosition, menuShouldScrollIntoView, minMenuHeight, options, placement, selectOption, selectProps, setValue, children, ...rest }: MenuProps<OptionType>) => JSX.Element;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type MenuProps, type OptionType } from '@atlaskit/select';
6
+ /**
7
+ * Top-layer version of the date picker menu.
8
+ *
9
+ * Uses `@atlaskit/top-layer/popup` (Popup.Content + Popup.Surface) so the
10
+ * calendar renders in the browser's top layer via the native Popover API
11
+ * and is positioned via CSS Anchor Positioning. This avoids overflow clipping,
12
+ * z-index wars, and portal-based layering.
13
+ *
14
+ * Gated behind the `platform-dst-top-layer` feature flag.
15
+ */
16
+ export declare const MenuTopLayer: ({ selectProps, innerProps }: MenuProps<OptionType>) => JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { type MenuProps, type OptionType } from '@atlaskit/select';
2
+ /**
3
+ * Top-layer version of the fixed layer menu used in the time picker.
4
+ *
5
+ * Uses `@atlaskit/top-layer/popup` (Popup.Content + Popup.Surface) so the
6
+ * time options list renders in the browser's top layer via the native Popover API
7
+ * and is positioned via CSS Anchor Positioning. This avoids overflow clipping,
8
+ * z-index wars, and portal-based layering.
9
+ *
10
+ * Gated behind the `platform-dst-top-layer` feature flag.
11
+ */
12
+ export declare const FixedLayerMenuTopLayer: ({ className, clearValue, cx, getStyles, getValue, hasValue, innerProps, innerRef, isLoading, isMulti, isRtl, maxMenuHeight, menuPlacement, menuPosition, menuShouldScrollIntoView, minMenuHeight, options, placement, selectOption, selectProps, setValue, children, ...rest }: MenuProps<OptionType>) => JSX.Element;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type MenuProps, type OptionType } from '@atlaskit/select';
6
+ /**
7
+ * Top-layer version of the date picker menu.
8
+ *
9
+ * Uses `@atlaskit/top-layer/popup` (Popup.Content + Popup.Surface) so the
10
+ * calendar renders in the browser's top layer via the native Popover API
11
+ * and is positioned via CSS Anchor Positioning. This avoids overflow clipping,
12
+ * z-index wars, and portal-based layering.
13
+ *
14
+ * Gated behind the `platform-dst-top-layer` feature flag.
15
+ */
16
+ export declare const MenuTopLayer: ({ selectProps, innerProps }: MenuProps<OptionType>) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "17.8.0",
3
+ "version": "17.8.2",
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/"
@@ -44,14 +44,15 @@
44
44
  "@atlaskit/calendar": "^17.2.0",
45
45
  "@atlaskit/css": "^0.19.0",
46
46
  "@atlaskit/ds-lib": "^7.0.0",
47
- "@atlaskit/icon": "^34.3.0",
47
+ "@atlaskit/icon": "^34.5.0",
48
48
  "@atlaskit/layering": "^3.7.0",
49
49
  "@atlaskit/locale": "^4.1.0",
50
50
  "@atlaskit/platform-feature-flags": "^1.1.0",
51
51
  "@atlaskit/popper": "^7.2.0",
52
52
  "@atlaskit/primitives": "^19.0.0",
53
- "@atlaskit/select": "^21.10.0",
53
+ "@atlaskit/select": "^21.12.0",
54
54
  "@atlaskit/tokens": "^13.0.0",
55
+ "@atlaskit/top-layer": "^0.6.0",
55
56
  "@babel/runtime": "^7.0.0",
56
57
  "@compiled/react": "^0.20.0",
57
58
  "date-fns": "^2.17.0"
@@ -69,13 +70,13 @@
69
70
  "@atlaskit/form": "^15.5.0",
70
71
  "@atlaskit/heading": "^5.4.0",
71
72
  "@atlaskit/link": "^3.4.0",
72
- "@atlaskit/modal-dialog": "^14.18.0",
73
- "@atlaskit/popup": "^4.17.0",
73
+ "@atlaskit/modal-dialog": "^15.0.0",
74
+ "@atlaskit/popup": "^4.19.0",
74
75
  "@atlaskit/range": "^10.1.0",
75
76
  "@atlaskit/section-message": "^8.12.0",
76
77
  "@atlaskit/textfield": "^8.3.0",
77
78
  "@atlaskit/toggle": "^15.6.0",
78
- "@atlassian/feature-flags-test-utils": "^1.0.0",
79
+ "@atlassian/feature-flags-test-utils": "^1.1.0",
79
80
  "@atlassian/react-compiler-gating": "workspace:^",
80
81
  "@atlassian/ssr-tests": "workspace:^",
81
82
  "@atlassian/structured-docs-types": "workspace:^",
@@ -118,6 +119,9 @@
118
119
  "dst-date-time-picker-use-functional-component": {
119
120
  "type": "boolean"
120
121
  },
122
+ "platform-dst-top-layer": {
123
+ "type": "boolean"
124
+ },
121
125
  "platform-dst-shape-theme-default": {
122
126
  "type": "boolean"
123
127
  },