@atlaskit/datetime-picker 13.11.1 → 13.11.3
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 +16 -0
- package/dist/cjs/components/date-picker.js +51 -38
- package/dist/cjs/components/date-time-picker.js +98 -52
- package/dist/cjs/components/time-picker.js +14 -14
- package/dist/cjs/internal/fixed-layer-menu.js +50 -4
- package/dist/cjs/internal/menu.js +24 -9
- package/dist/cjs/internal/single-value.js +37 -4
- package/dist/es2019/components/date-picker.js +50 -36
- package/dist/es2019/components/date-time-picker.js +91 -55
- package/dist/es2019/components/time-picker.js +14 -17
- package/dist/es2019/internal/fixed-layer-menu.js +48 -2
- package/dist/es2019/internal/menu.js +53 -32
- package/dist/es2019/internal/single-value.js +36 -3
- package/dist/esm/components/date-picker.js +51 -38
- package/dist/esm/components/date-time-picker.js +98 -52
- package/dist/esm/components/time-picker.js +14 -14
- package/dist/esm/internal/fixed-layer-menu.js +50 -4
- package/dist/esm/internal/menu.js +25 -9
- package/dist/esm/internal/single-value.js +37 -4
- package/dist/types/components/date-picker.d.ts +2 -12
- package/dist/types/components/date-time-picker.d.ts +2 -3
- package/dist/types/components/time-picker.d.ts +2 -1
- package/dist/types/internal/fixed-layer-menu.d.ts +1 -1
- package/dist/types/internal/single-value.d.ts +1 -1
- package/dist/types-ts4.5/components/date-picker.d.ts +2 -12
- package/dist/types-ts4.5/components/date-time-picker.d.ts +2 -3
- package/dist/types-ts4.5/components/time-picker.d.ts +2 -1
- package/dist/types-ts4.5/internal/fixed-layer-menu.d.ts +1 -1
- package/dist/types-ts4.5/internal/single-value.d.ts +1 -1
- package/package.json +6 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["selectProps"];
|
|
3
|
+
var _excluded = ["className", "clearValue", "cx", "getStyles", "getValue", "hasValue", "innerProps", "innerRef", "isLoading", "isMulti", "isRtl", "maxMenuHeight", "menuPlacement", "menuPosition", "menuShouldScrollIntoView", "minMenuHeight", "options", "placement", "selectOption", "selectProps", "setValue", "theme", "children"];
|
|
4
4
|
/**
|
|
5
5
|
* @jsxRuntime classic
|
|
6
6
|
* @jsx jsx
|
|
@@ -14,14 +14,60 @@ import FixedLayer from '../internal/fixed-layer';
|
|
|
14
14
|
* This is the fixed layer menu used in the time picker.
|
|
15
15
|
*/
|
|
16
16
|
export var FixedLayerMenu = function FixedLayerMenu(_ref) {
|
|
17
|
-
var
|
|
17
|
+
var className = _ref.className,
|
|
18
|
+
clearValue = _ref.clearValue,
|
|
19
|
+
cx = _ref.cx,
|
|
20
|
+
getStyles = _ref.getStyles,
|
|
21
|
+
getValue = _ref.getValue,
|
|
22
|
+
hasValue = _ref.hasValue,
|
|
23
|
+
innerProps = _ref.innerProps,
|
|
24
|
+
innerRef = _ref.innerRef,
|
|
25
|
+
isLoading = _ref.isLoading,
|
|
26
|
+
isMulti = _ref.isMulti,
|
|
27
|
+
isRtl = _ref.isRtl,
|
|
28
|
+
maxMenuHeight = _ref.maxMenuHeight,
|
|
29
|
+
menuPlacement = _ref.menuPlacement,
|
|
30
|
+
menuPosition = _ref.menuPosition,
|
|
31
|
+
menuShouldScrollIntoView = _ref.menuShouldScrollIntoView,
|
|
32
|
+
minMenuHeight = _ref.minMenuHeight,
|
|
33
|
+
options = _ref.options,
|
|
34
|
+
placement = _ref.placement,
|
|
35
|
+
selectOption = _ref.selectOption,
|
|
36
|
+
selectProps = _ref.selectProps,
|
|
37
|
+
setValue = _ref.setValue,
|
|
38
|
+
theme = _ref.theme,
|
|
39
|
+
children = _ref.children,
|
|
18
40
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
41
|
return jsx(FixedLayer, {
|
|
20
42
|
inputValue: selectProps.inputValue,
|
|
21
43
|
containerRef: selectProps.fixedLayerRef,
|
|
22
44
|
content: jsx(components.Menu, _extends({}, rest, {
|
|
23
|
-
|
|
24
|
-
|
|
45
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
|
|
46
|
+
className: className,
|
|
47
|
+
clearValue: clearValue,
|
|
48
|
+
cx: cx,
|
|
49
|
+
getStyles: getStyles,
|
|
50
|
+
getValue: getValue,
|
|
51
|
+
hasValue: hasValue,
|
|
52
|
+
innerProps: innerProps,
|
|
53
|
+
innerRef: innerRef,
|
|
54
|
+
isLoading: isLoading,
|
|
55
|
+
isMulti: isMulti,
|
|
56
|
+
isRtl: isRtl,
|
|
57
|
+
maxMenuHeight: maxMenuHeight,
|
|
58
|
+
menuPlacement: menuPlacement,
|
|
59
|
+
menuPosition: menuPosition,
|
|
60
|
+
menuShouldScrollIntoView: false || menuShouldScrollIntoView,
|
|
61
|
+
minMenuHeight: minMenuHeight,
|
|
62
|
+
options: options,
|
|
63
|
+
placement: placement,
|
|
64
|
+
selectOption: selectOption,
|
|
65
|
+
selectProps: selectProps,
|
|
66
|
+
setValue: setValue
|
|
67
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides, @atlaskit/design-system/no-unsafe-style-overrides
|
|
68
|
+
,
|
|
69
|
+
theme: theme
|
|
70
|
+
}), children),
|
|
25
71
|
testId: selectProps.testId
|
|
26
72
|
});
|
|
27
73
|
};
|
|
@@ -11,13 +11,20 @@ import { UNSAFE_LAYERING } from '@atlaskit/layering';
|
|
|
11
11
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
12
12
|
import { layers } from '@atlaskit/theme/constants';
|
|
13
13
|
import FixedLayer from '../internal/fixed-layer';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param isos A series of ISO dates.
|
|
17
|
+
* @returns The last valid date within the array of ISO strings.
|
|
18
|
+
*/
|
|
19
|
+
function getValidDate(isos) {
|
|
20
|
+
return isos.reduce(function (acc, iso) {
|
|
21
|
+
var date = parseISO(iso);
|
|
22
|
+
return isValid(date) ? {
|
|
23
|
+
day: date.getDate(),
|
|
24
|
+
month: date.getMonth() + 1,
|
|
25
|
+
year: date.getFullYear()
|
|
26
|
+
} : acc;
|
|
27
|
+
}, {});
|
|
21
28
|
}
|
|
22
29
|
var menuStyles = css({
|
|
23
30
|
zIndex: layers.dialog(),
|
|
@@ -33,6 +40,12 @@ var menuStyles = css({
|
|
|
33
40
|
export var Menu = function Menu(_ref) {
|
|
34
41
|
var selectProps = _ref.selectProps,
|
|
35
42
|
innerProps = _ref.innerProps;
|
|
43
|
+
var calendarValue = selectProps.calendarValue,
|
|
44
|
+
calendarView = selectProps.calendarView;
|
|
45
|
+
var _getValidDate = getValidDate([calendarValue, calendarView]),
|
|
46
|
+
day = _getValidDate.day,
|
|
47
|
+
month = _getValidDate.month,
|
|
48
|
+
year = _getValidDate.year;
|
|
36
49
|
return jsx(UNSAFE_LAYERING, {
|
|
37
50
|
isDisabled: false
|
|
38
51
|
}, jsx(FixedLayer, {
|
|
@@ -40,7 +53,10 @@ export var Menu = function Menu(_ref) {
|
|
|
40
53
|
containerRef: selectProps.calendarContainerRef,
|
|
41
54
|
content: jsx("div", _extends({
|
|
42
55
|
css: menuStyles
|
|
43
|
-
}, innerProps), jsx(Calendar,
|
|
56
|
+
}, innerProps), jsx(Calendar, {
|
|
57
|
+
day: day,
|
|
58
|
+
month: month,
|
|
59
|
+
year: year,
|
|
44
60
|
disabled: selectProps.calendarDisabled,
|
|
45
61
|
disabledDateFilter: selectProps.calendarDisabledDateFilter,
|
|
46
62
|
minDate: selectProps.calendarMinDate,
|
|
@@ -55,7 +71,7 @@ export var Menu = function Menu(_ref) {
|
|
|
55
71
|
locale: selectProps.calendarLocale,
|
|
56
72
|
testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
|
|
57
73
|
weekStartDay: selectProps.calendarWeekStartDay
|
|
58
|
-
}))
|
|
74
|
+
})),
|
|
59
75
|
testId: selectProps.testId
|
|
60
76
|
}));
|
|
61
77
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children"];
|
|
3
|
+
var _excluded = ["children", "className", "clearValue", "cx", "data", "getStyles", "getValue", "hasValue", "isDisabled", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { components } from '@atlaskit/select';
|
|
6
6
|
|
|
@@ -12,11 +12,44 @@ export var makeSingleValue = function makeSingleValue(_ref) {
|
|
|
12
12
|
var lang = _ref.lang;
|
|
13
13
|
return function (_ref2) {
|
|
14
14
|
var children = _ref2.children,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
className = _ref2.className,
|
|
16
|
+
clearValue = _ref2.clearValue,
|
|
17
|
+
cx = _ref2.cx,
|
|
18
|
+
data = _ref2.data,
|
|
19
|
+
getStyles = _ref2.getStyles,
|
|
20
|
+
getValue = _ref2.getValue,
|
|
21
|
+
hasValue = _ref2.hasValue,
|
|
22
|
+
isDisabled = _ref2.isDisabled,
|
|
23
|
+
isMulti = _ref2.isMulti,
|
|
24
|
+
isRtl = _ref2.isRtl,
|
|
25
|
+
options = _ref2.options,
|
|
26
|
+
selectOption = _ref2.selectOption,
|
|
27
|
+
selectProps = _ref2.selectProps,
|
|
28
|
+
setValue = _ref2.setValue,
|
|
29
|
+
theme = _ref2.theme,
|
|
30
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
31
|
+
return /*#__PURE__*/React.createElement(components.SingleValue, _extends({}, rest, {
|
|
32
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
|
|
33
|
+
className: className,
|
|
34
|
+
clearValue: clearValue,
|
|
35
|
+
cx: cx,
|
|
36
|
+
data: data,
|
|
37
|
+
getStyles: getStyles,
|
|
38
|
+
getValue: getValue,
|
|
39
|
+
hasValue: hasValue,
|
|
17
40
|
innerProps: {
|
|
18
41
|
lang: lang
|
|
19
|
-
}
|
|
42
|
+
},
|
|
43
|
+
isDisabled: isDisabled,
|
|
44
|
+
isMulti: isMulti,
|
|
45
|
+
isRtl: isRtl,
|
|
46
|
+
options: options,
|
|
47
|
+
selectOption: selectOption,
|
|
48
|
+
selectProps: selectProps,
|
|
49
|
+
setValue: setValue
|
|
50
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides, @atlaskit/design-system/no-unsafe-style-overrides
|
|
51
|
+
,
|
|
52
|
+
theme: theme
|
|
20
53
|
}), children);
|
|
21
54
|
};
|
|
22
55
|
};
|
|
@@ -77,18 +77,8 @@ declare class DatePickerComponent extends Component<DatePickerProps, State> {
|
|
|
77
77
|
l10n: LocalizationProvider;
|
|
78
78
|
locale: string;
|
|
79
79
|
} | null;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
value: string;
|
|
83
|
-
isOpen: boolean;
|
|
84
|
-
isFocused: boolean;
|
|
85
|
-
clearingFromIcon: boolean;
|
|
86
|
-
calendarValue: string;
|
|
87
|
-
selectInputValue: string;
|
|
88
|
-
l10n: LocalizationProvider;
|
|
89
|
-
locale: string;
|
|
90
|
-
shouldSetFocusOnCurrentDay: boolean;
|
|
91
|
-
};
|
|
80
|
+
getValue: () => string;
|
|
81
|
+
getIsOpen: () => boolean;
|
|
92
82
|
isDateDisabled: (date: string) => boolean;
|
|
93
83
|
onCalendarChange: ({ iso }: {
|
|
94
84
|
iso: string;
|
|
@@ -39,13 +39,12 @@ export declare const timePickerDefaultAriaLabel = "Time";
|
|
|
39
39
|
declare class DateTimePickerComponent extends React.Component<DateTimePickerProps, State> {
|
|
40
40
|
static defaultProps: DateTimePickerProps;
|
|
41
41
|
state: State;
|
|
42
|
-
|
|
42
|
+
getParsedValues: () => {
|
|
43
43
|
dateValue: string;
|
|
44
44
|
timeValue: string;
|
|
45
45
|
zoneValue: string;
|
|
46
|
-
value: string;
|
|
47
|
-
isFocused: boolean;
|
|
48
46
|
};
|
|
47
|
+
getValue: () => string;
|
|
49
48
|
parseValue(value: string, dateValue: string, timeValue: string, zoneValue: string): {
|
|
50
49
|
dateValue: string;
|
|
51
50
|
timeValue: string;
|
|
@@ -65,7 +65,8 @@ declare class TimePickerComponent extends React.Component<TimePickerProps, State
|
|
|
65
65
|
value: string;
|
|
66
66
|
isFocused: boolean;
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
getValue: () => string;
|
|
69
|
+
getIsOpen: () => boolean;
|
|
69
70
|
onChange: (newValue: ValueType<OptionType> | string, action?: ActionMeta<OptionType>) => void;
|
|
70
71
|
/**
|
|
71
72
|
* Only allow custom times if timeIsEditable prop is true
|
|
@@ -7,4 +7,4 @@ import { type MenuProps, type OptionType } from '@atlaskit/select';
|
|
|
7
7
|
/**
|
|
8
8
|
* This is the fixed layer menu used in the time picker.
|
|
9
9
|
*/
|
|
10
|
-
export declare const FixedLayerMenu: ({ selectProps, ...rest }: MenuProps<OptionType>) => jsx.JSX.Element;
|
|
10
|
+
export declare const FixedLayerMenu: ({ className, clearValue, cx, getStyles, getValue, hasValue, innerProps, innerRef, isLoading, isMulti, isRtl, maxMenuHeight, menuPlacement, menuPosition, menuShouldScrollIntoView, minMenuHeight, options, placement, selectOption, selectProps, setValue, theme, children, ...rest }: MenuProps<OptionType>) => jsx.JSX.Element;
|
|
@@ -6,4 +6,4 @@ import { type OptionType, type SingleValueProps } from '@atlaskit/select';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const makeSingleValue: ({ lang }: {
|
|
8
8
|
lang: string;
|
|
9
|
-
}) => ({ children, ...
|
|
9
|
+
}) => ({ children, className, clearValue, cx, data, getStyles, getValue, hasValue, isDisabled, isMulti, isRtl, options, selectOption, selectProps, setValue, theme, ...rest }: SingleValueProps<OptionType, false>) => JSX.Element;
|
|
@@ -77,18 +77,8 @@ declare class DatePickerComponent extends Component<DatePickerProps, State> {
|
|
|
77
77
|
l10n: LocalizationProvider;
|
|
78
78
|
locale: string;
|
|
79
79
|
} | null;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
value: string;
|
|
83
|
-
isOpen: boolean;
|
|
84
|
-
isFocused: boolean;
|
|
85
|
-
clearingFromIcon: boolean;
|
|
86
|
-
calendarValue: string;
|
|
87
|
-
selectInputValue: string;
|
|
88
|
-
l10n: LocalizationProvider;
|
|
89
|
-
locale: string;
|
|
90
|
-
shouldSetFocusOnCurrentDay: boolean;
|
|
91
|
-
};
|
|
80
|
+
getValue: () => string;
|
|
81
|
+
getIsOpen: () => boolean;
|
|
92
82
|
isDateDisabled: (date: string) => boolean;
|
|
93
83
|
onCalendarChange: ({ iso }: {
|
|
94
84
|
iso: string;
|
|
@@ -39,13 +39,12 @@ export declare const timePickerDefaultAriaLabel = "Time";
|
|
|
39
39
|
declare class DateTimePickerComponent extends React.Component<DateTimePickerProps, State> {
|
|
40
40
|
static defaultProps: DateTimePickerProps;
|
|
41
41
|
state: State;
|
|
42
|
-
|
|
42
|
+
getParsedValues: () => {
|
|
43
43
|
dateValue: string;
|
|
44
44
|
timeValue: string;
|
|
45
45
|
zoneValue: string;
|
|
46
|
-
value: string;
|
|
47
|
-
isFocused: boolean;
|
|
48
46
|
};
|
|
47
|
+
getValue: () => string;
|
|
49
48
|
parseValue(value: string, dateValue: string, timeValue: string, zoneValue: string): {
|
|
50
49
|
dateValue: string;
|
|
51
50
|
timeValue: string;
|
|
@@ -65,7 +65,8 @@ declare class TimePickerComponent extends React.Component<TimePickerProps, State
|
|
|
65
65
|
value: string;
|
|
66
66
|
isFocused: boolean;
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
getValue: () => string;
|
|
69
|
+
getIsOpen: () => boolean;
|
|
69
70
|
onChange: (newValue: ValueType<OptionType> | string, action?: ActionMeta<OptionType>) => void;
|
|
70
71
|
/**
|
|
71
72
|
* Only allow custom times if timeIsEditable prop is true
|
|
@@ -7,4 +7,4 @@ import { type MenuProps, type OptionType } from '@atlaskit/select';
|
|
|
7
7
|
/**
|
|
8
8
|
* This is the fixed layer menu used in the time picker.
|
|
9
9
|
*/
|
|
10
|
-
export declare const FixedLayerMenu: ({ selectProps, ...rest }: MenuProps<OptionType>) => jsx.JSX.Element;
|
|
10
|
+
export declare const FixedLayerMenu: ({ className, clearValue, cx, getStyles, getValue, hasValue, innerProps, innerRef, isLoading, isMulti, isRtl, maxMenuHeight, menuPlacement, menuPosition, menuShouldScrollIntoView, minMenuHeight, options, placement, selectOption, selectProps, setValue, theme, children, ...rest }: MenuProps<OptionType>) => jsx.JSX.Element;
|
|
@@ -6,4 +6,4 @@ import { type OptionType, type SingleValueProps } from '@atlaskit/select';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const makeSingleValue: ({ lang }: {
|
|
8
8
|
lang: string;
|
|
9
|
-
}) => ({ children, ...
|
|
9
|
+
}) => ({ children, className, clearValue, cx, data, getStyles, getValue, hasValue, isDisabled, isMulti, isRtl, options, selectOption, selectProps, setValue, theme, ...rest }: SingleValueProps<OptionType, false>) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "13.11.
|
|
3
|
+
"version": "13.11.3",
|
|
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/"
|
|
@@ -41,18 +41,17 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
43
43
|
"@atlaskit/calendar": "^14.5.0",
|
|
44
|
-
"@atlaskit/ds-lib": "^2.
|
|
45
|
-
"@atlaskit/icon": "^22.
|
|
44
|
+
"@atlaskit/ds-lib": "^2.5.0",
|
|
45
|
+
"@atlaskit/icon": "^22.14.0",
|
|
46
46
|
"@atlaskit/layering": "^0.4.0",
|
|
47
47
|
"@atlaskit/locale": "^2.8.0",
|
|
48
48
|
"@atlaskit/popper": "^6.2.0",
|
|
49
49
|
"@atlaskit/select": "^17.15.0",
|
|
50
50
|
"@atlaskit/theme": "^13.0.0",
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
51
|
+
"@atlaskit/tokens": "^1.59.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@emotion/react": "^11.7.1",
|
|
54
|
-
"date-fns": "^2.17.0"
|
|
55
|
-
"lodash": "^4.17.21"
|
|
54
|
+
"date-fns": "^2.17.0"
|
|
56
55
|
},
|
|
57
56
|
"peerDependencies": {
|
|
58
57
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
"@af/accessibility-testing": "*",
|
|
62
61
|
"@af/integration-testing": "*",
|
|
63
62
|
"@af/visual-regression": "*",
|
|
64
|
-
"@atlaskit/button": "^20.
|
|
63
|
+
"@atlaskit/button": "^20.1.0",
|
|
65
64
|
"@atlaskit/docs": "*",
|
|
66
65
|
"@atlaskit/form": "^10.5.0",
|
|
67
66
|
"@atlaskit/modal-dialog": "^12.15.0",
|