@atlaskit/datetime-picker 13.0.8 → 13.0.10
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 +12 -0
- package/dist/cjs/components/date-picker.js +1 -1
- package/dist/cjs/components/date-time-picker.js +4 -4
- package/dist/cjs/components/time-picker.js +4 -4
- package/dist/es2019/components/date-picker.js +1 -1
- package/dist/es2019/components/date-time-picker.js +2 -2
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/esm/components/date-picker.js +1 -1
- package/dist/esm/components/date-time-picker.js +4 -4
- package/dist/esm/components/time-picker.js +4 -4
- package/dist/types/components/date-picker.d.ts +3 -150
- package/dist/types/components/date-time-picker.d.ts +3 -115
- package/dist/types/components/time-picker.d.ts +4 -115
- package/dist/types/index.d.ts +1 -4
- package/dist/types/types.d.ts +367 -0
- package/dist/types-ts4.5/components/date-picker.d.ts +3 -150
- package/dist/types-ts4.5/components/date-time-picker.d.ts +3 -115
- package/dist/types-ts4.5/components/time-picker.d.ts +4 -115
- package/dist/types-ts4.5/index.d.ts +1 -4
- package/dist/types-ts4.5/types.d.ts +367 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 13.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#74796](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74796) [`47a2a39b4033`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/47a2a39b4033) - Move types for all the pickers to the appropriate `types` file.
|
|
8
|
+
|
|
9
|
+
## 13.0.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#74756](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74756) [`8e66f751df96`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8e66f751df96) - Use feature flag to roll out border width update from 2px to 1px
|
|
14
|
+
|
|
3
15
|
## 13.0.8
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -39,7 +39,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
39
39
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
40
40
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
41
41
|
var packageName = "@atlaskit/datetime-picker";
|
|
42
|
-
var packageVersion = "13.0.
|
|
42
|
+
var packageVersion = "13.0.10";
|
|
43
43
|
function getValidDate(iso) {
|
|
44
44
|
var date = (0, _dateFns.parseISO)(iso);
|
|
45
45
|
return (0, _dateFns.isValid)(date) ? {
|
|
@@ -31,7 +31,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
31
31
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
32
32
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @jsx jsx */
|
|
33
33
|
var packageName = "@atlaskit/datetime-picker";
|
|
34
|
-
var packageVersion = "13.0.
|
|
34
|
+
var packageVersion = "13.0.10";
|
|
35
35
|
var isInvalidBorderStyles = (0, _react2.css)({
|
|
36
36
|
borderColor: "var(--ds-border-danger, ".concat(_colors.R400, ")")
|
|
37
37
|
});
|
|
@@ -77,7 +77,7 @@ var isDisabledStyles = (0, _react2.css)({
|
|
|
77
77
|
var baseContainerStyles = (0, _react2.css)({
|
|
78
78
|
display: 'flex',
|
|
79
79
|
backgroundColor: "var(--ds-background-input, ".concat(_colors.N20, ")"),
|
|
80
|
-
border: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-
|
|
80
|
+
border: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.update-input-border-wdith_5abwv') ? "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border-input, ".concat(_colors.N100, ")")) : "2px solid ".concat("var(--ds-border-input, ".concat(_colors.N20, ")")),
|
|
81
81
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
82
82
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
83
83
|
'&:hover': {
|
|
@@ -240,8 +240,8 @@ var DateTimePicker = exports.DateTimePickerWithoutAnalytics = /*#__PURE__*/funct
|
|
|
240
240
|
zoneValue: zoneValue
|
|
241
241
|
});
|
|
242
242
|
if (dateValue && timeValue) {
|
|
243
|
-
var
|
|
244
|
-
var _this$parseValue = this.parseValue(
|
|
243
|
+
var value = (0, _internal.formatDateTimeZoneIntoIso)(dateValue, timeValue, zoneValue);
|
|
244
|
+
var _this$parseValue = this.parseValue(value, dateValue, timeValue, zoneValue),
|
|
245
245
|
parsedZone = _this$parseValue.zoneValue;
|
|
246
246
|
var valueWithValidZone = (0, _internal.formatDateTimeZoneIntoIso)(dateValue, timeValue, parsedZone);
|
|
247
247
|
this.setState({
|
|
@@ -37,7 +37,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
37
37
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
38
38
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
39
|
var packageName = "@atlaskit/datetime-picker";
|
|
40
|
-
var packageVersion = "13.0.
|
|
40
|
+
var packageVersion = "13.0.10";
|
|
41
41
|
var menuStyles = {
|
|
42
42
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
43
43
|
position: 'static',
|
|
@@ -130,15 +130,15 @@ var TimePicker = exports.TimePickerWithoutAnalytics = /*#__PURE__*/function (_Re
|
|
|
130
130
|
if (_this.props.timeIsEditable) {
|
|
131
131
|
var _this$props = _this.props,
|
|
132
132
|
parseInputValue = _this$props.parseInputValue,
|
|
133
|
-
|
|
133
|
+
timeFormat = _this$props.timeFormat;
|
|
134
134
|
var sanitizedInput;
|
|
135
135
|
try {
|
|
136
|
-
sanitizedInput = parseInputValue(inputValue,
|
|
136
|
+
sanitizedInput = parseInputValue(inputValue, timeFormat || _internal.defaultTimeFormat);
|
|
137
137
|
} catch (e) {
|
|
138
138
|
return; // do nothing, the main validation should happen in the form
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
var includesSeconds = !!(
|
|
141
|
+
var includesSeconds = !!(timeFormat && /[:.]?(s|ss)/.test(timeFormat));
|
|
142
142
|
var formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
|
|
143
143
|
var formattedValue = (0, _dateFns.format)(sanitizedInput, formatFormat) || '';
|
|
144
144
|
_this.setState({
|
|
@@ -19,7 +19,7 @@ import FixedLayer from '../internal/fixed-layer';
|
|
|
19
19
|
import { makeSingleValue } from '../internal/single-value';
|
|
20
20
|
import { convertTokens } from './utils';
|
|
21
21
|
const packageName = "@atlaskit/datetime-picker";
|
|
22
|
-
const packageVersion = "13.0.
|
|
22
|
+
const packageVersion = "13.0.10";
|
|
23
23
|
function getValidDate(iso) {
|
|
24
24
|
const date = parseISO(iso);
|
|
25
25
|
return isValid(date) ? {
|
|
@@ -15,7 +15,7 @@ import DatePicker from './date-picker';
|
|
|
15
15
|
import TimePicker from './time-picker';
|
|
16
16
|
import { convertTokens } from './utils';
|
|
17
17
|
const packageName = "@atlaskit/datetime-picker";
|
|
18
|
-
const packageVersion = "13.0.
|
|
18
|
+
const packageVersion = "13.0.10";
|
|
19
19
|
const isInvalidBorderStyles = css({
|
|
20
20
|
borderColor: `var(--ds-border-danger, ${R400})`
|
|
21
21
|
});
|
|
@@ -61,7 +61,7 @@ const isDisabledStyles = css({
|
|
|
61
61
|
const baseContainerStyles = css({
|
|
62
62
|
display: 'flex',
|
|
63
63
|
backgroundColor: `var(--ds-background-input, ${N20})`,
|
|
64
|
-
border: getBooleanFF('platform.design-system-team.border-
|
|
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
65
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
66
66
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
67
67
|
'&:hover': {
|
|
@@ -16,7 +16,7 @@ import parseTime from '../internal/parse-time';
|
|
|
16
16
|
import { makeSingleValue } from '../internal/single-value';
|
|
17
17
|
import { convertTokens } from './utils';
|
|
18
18
|
const packageName = "@atlaskit/datetime-picker";
|
|
19
|
-
const packageVersion = "13.0.
|
|
19
|
+
const packageVersion = "13.0.10";
|
|
20
20
|
const menuStyles = {
|
|
21
21
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
22
22
|
position: 'static',
|
|
@@ -30,7 +30,7 @@ import FixedLayer from '../internal/fixed-layer';
|
|
|
30
30
|
import { makeSingleValue } from '../internal/single-value';
|
|
31
31
|
import { convertTokens } from './utils';
|
|
32
32
|
var packageName = "@atlaskit/datetime-picker";
|
|
33
|
-
var packageVersion = "13.0.
|
|
33
|
+
var packageVersion = "13.0.10";
|
|
34
34
|
function getValidDate(iso) {
|
|
35
35
|
var date = parseISO(iso);
|
|
36
36
|
return isValid(date) ? {
|
|
@@ -25,7 +25,7 @@ import DatePicker from './date-picker';
|
|
|
25
25
|
import TimePicker from './time-picker';
|
|
26
26
|
import { convertTokens } from './utils';
|
|
27
27
|
var packageName = "@atlaskit/datetime-picker";
|
|
28
|
-
var packageVersion = "13.0.
|
|
28
|
+
var packageVersion = "13.0.10";
|
|
29
29
|
var isInvalidBorderStyles = css({
|
|
30
30
|
borderColor: "var(--ds-border-danger, ".concat(R400, ")")
|
|
31
31
|
});
|
|
@@ -71,7 +71,7 @@ var isDisabledStyles = css({
|
|
|
71
71
|
var baseContainerStyles = css({
|
|
72
72
|
display: 'flex',
|
|
73
73
|
backgroundColor: "var(--ds-background-input, ".concat(N20, ")"),
|
|
74
|
-
border: getBooleanFF('platform.design-system-team.border-
|
|
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
75
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
76
76
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
77
77
|
'&:hover': {
|
|
@@ -234,8 +234,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
234
234
|
zoneValue: zoneValue
|
|
235
235
|
});
|
|
236
236
|
if (dateValue && timeValue) {
|
|
237
|
-
var
|
|
238
|
-
var _this$parseValue = this.parseValue(
|
|
237
|
+
var value = formatDateTimeZoneIntoIso(dateValue, timeValue, zoneValue);
|
|
238
|
+
var _this$parseValue = this.parseValue(value, dateValue, timeValue, zoneValue),
|
|
239
239
|
parsedZone = _this$parseValue.zoneValue;
|
|
240
240
|
var valueWithValidZone = formatDateTimeZoneIntoIso(dateValue, timeValue, parsedZone);
|
|
241
241
|
this.setState({
|
|
@@ -29,7 +29,7 @@ import parseTime from '../internal/parse-time';
|
|
|
29
29
|
import { makeSingleValue } from '../internal/single-value';
|
|
30
30
|
import { convertTokens } from './utils';
|
|
31
31
|
var packageName = "@atlaskit/datetime-picker";
|
|
32
|
-
var packageVersion = "13.0.
|
|
32
|
+
var packageVersion = "13.0.10";
|
|
33
33
|
var menuStyles = {
|
|
34
34
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
35
35
|
position: 'static',
|
|
@@ -122,15 +122,15 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
122
122
|
if (_this.props.timeIsEditable) {
|
|
123
123
|
var _this$props = _this.props,
|
|
124
124
|
parseInputValue = _this$props.parseInputValue,
|
|
125
|
-
|
|
125
|
+
timeFormat = _this$props.timeFormat;
|
|
126
126
|
var sanitizedInput;
|
|
127
127
|
try {
|
|
128
|
-
sanitizedInput = parseInputValue(inputValue,
|
|
128
|
+
sanitizedInput = parseInputValue(inputValue, timeFormat || defaultTimeFormat);
|
|
129
129
|
} catch (e) {
|
|
130
130
|
return; // do nothing, the main validation should happen in the form
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
var includesSeconds = !!(
|
|
133
|
+
var includesSeconds = !!(timeFormat && /[:.]?(s|ss)/.test(timeFormat));
|
|
134
134
|
var formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
|
|
135
135
|
var formattedValue = format(sanitizedInput, formatFormat) || '';
|
|
136
136
|
_this.setState({
|
|
@@ -1,157 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
5
4
|
import { CalendarRef } from '@atlaskit/calendar';
|
|
6
5
|
import { LocalizationProvider } from '@atlaskit/locale';
|
|
7
|
-
import { ActionMeta, DropdownIndicatorProps, InputActionMeta, OptionType,
|
|
8
|
-
import { Appearance, Spacing } from '../types';
|
|
9
|
-
export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
|
|
10
|
-
/**
|
|
11
|
-
* Set the appearance of the picker.
|
|
12
|
-
*
|
|
13
|
-
* `subtle` will remove the borders, background, and icon.
|
|
14
|
-
*
|
|
15
|
-
*NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
16
|
-
*/
|
|
17
|
-
appearance?: Appearance;
|
|
18
|
-
/**
|
|
19
|
-
* Set the picker to autofocus on mount.
|
|
20
|
-
*/
|
|
21
|
-
autoFocus?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* The default for `isOpen`. Will be `false` if not provided.
|
|
24
|
-
*/
|
|
25
|
-
defaultIsOpen?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* The default for `value`.
|
|
28
|
-
*/
|
|
29
|
-
defaultValue?: string;
|
|
30
|
-
/**
|
|
31
|
-
* An array of ISO dates that should be disabled on the calendar. This does not affect what users can type into the picker.
|
|
32
|
-
*/
|
|
33
|
-
disabled?: string[];
|
|
34
|
-
/**
|
|
35
|
-
* A filter function for disabling dates on the calendar. This does not affect what users can type into the picker.
|
|
36
|
-
*
|
|
37
|
-
* The function is called with a date string in the format `YYYY-MM-DD` and should return `true` if the date should be disabled.
|
|
38
|
-
*/
|
|
39
|
-
disabledDateFilter?: (date: string) => boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The latest enabled date. Dates after this are disabled on the calendar. This does not affect what users can type into the picker.
|
|
42
|
-
*/
|
|
43
|
-
maxDate?: string;
|
|
44
|
-
/**
|
|
45
|
-
* The earliest enabled date. Dates before this are disabled on the calendar. This does not affect what users can type into the picker.
|
|
46
|
-
*/
|
|
47
|
-
minDate?: string;
|
|
48
|
-
/**
|
|
49
|
-
* The icon shown in the picker.
|
|
50
|
-
*/
|
|
51
|
-
icon?: React.ComponentType<DropdownIndicatorProps<OptionType>>;
|
|
52
|
-
/**
|
|
53
|
-
* Set the id of the field.
|
|
54
|
-
* Associates a `<label></label>` with the field.
|
|
55
|
-
*/
|
|
56
|
-
id?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Props to apply to the container.
|
|
59
|
-
*/
|
|
60
|
-
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
61
|
-
/**
|
|
62
|
-
* Set if the picker is disabled.
|
|
63
|
-
*/
|
|
64
|
-
isDisabled?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Set if the picker is open.
|
|
67
|
-
*/
|
|
68
|
-
isOpen?: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* The name of the field.
|
|
71
|
-
*/
|
|
72
|
-
name?: string;
|
|
73
|
-
/**
|
|
74
|
-
* The aria-label attribute associated with the next-month arrow.
|
|
75
|
-
*/
|
|
76
|
-
nextMonthLabel?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Called when the field is blurred.
|
|
79
|
-
*/
|
|
80
|
-
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
81
|
-
/**
|
|
82
|
-
* Called when the value changes. The only argument is an ISO time or empty string.
|
|
83
|
-
*/
|
|
84
|
-
onChange?: (value: string) => void;
|
|
85
|
-
/**
|
|
86
|
-
* Called when the field is focused.
|
|
87
|
-
*/
|
|
88
|
-
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
89
|
-
/**
|
|
90
|
-
* A function for parsing input characters and transforming them into a Date object.
|
|
91
|
-
* By default parses the date string based off the locale.
|
|
92
|
-
*/
|
|
93
|
-
parseInputValue?: (date: string, dateFormat: string) => Date;
|
|
94
|
-
/**
|
|
95
|
-
* A function for formatting the date displayed in the input. By default composes together [date-fn's parse method](https://date-fns.org/v1.29.0/docs/parse) and [date-fn's format method](https://date-fns.org/v1.29.0/docs/format) to return a correctly formatted date string.
|
|
96
|
-
*/
|
|
97
|
-
formatDisplayLabel?: (value: string, dateFormat: string) => string;
|
|
98
|
-
/**
|
|
99
|
-
* The aria-label attribute associated with the previous-month arrow.
|
|
100
|
-
*/
|
|
101
|
-
previousMonthLabel?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Props to apply to the select. This can be used to set options such as placeholder text.
|
|
104
|
-
* See [the `Select` documentation for further information](/components/select).
|
|
105
|
-
*/
|
|
106
|
-
selectProps?: SelectProps<any>;
|
|
107
|
-
/**
|
|
108
|
-
* The spacing for the select control.
|
|
109
|
-
*
|
|
110
|
-
* Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
111
|
-
*/
|
|
112
|
-
spacing?: Spacing;
|
|
113
|
-
/**
|
|
114
|
-
* The ISO time used as the input value.
|
|
115
|
-
*/
|
|
116
|
-
value?: string;
|
|
117
|
-
/**
|
|
118
|
-
* Set if the picker has an invalid value.
|
|
119
|
-
*/
|
|
120
|
-
isInvalid?: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Hides icon for dropdown indicator.
|
|
123
|
-
*/
|
|
124
|
-
hideIcon?: boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Format the date with a string that is accepted by [date-fn's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
127
|
-
*/
|
|
128
|
-
dateFormat?: string;
|
|
129
|
-
/**
|
|
130
|
-
* Placeholder text displayed in input.
|
|
131
|
-
*/
|
|
132
|
-
placeholder?: string;
|
|
133
|
-
/**
|
|
134
|
-
* Locale used to format the date and calendar. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
|
|
135
|
-
*/
|
|
136
|
-
locale?: string;
|
|
137
|
-
/**
|
|
138
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
139
|
-
* - `{testId}--container` wrapping element of date-picker
|
|
140
|
-
* - `{testId}--calendar--container` nested calendar component
|
|
141
|
-
*/
|
|
142
|
-
testId?: string;
|
|
143
|
-
/**
|
|
144
|
-
* Start day of the week for the calendar.
|
|
145
|
-
* - `0` sunday (default value)
|
|
146
|
-
* - `1` monday
|
|
147
|
-
* - `2` tuesday
|
|
148
|
-
* - `3` wednesday
|
|
149
|
-
* - `4` thursday
|
|
150
|
-
* - `5` friday
|
|
151
|
-
* - `6` saturday
|
|
152
|
-
*/
|
|
153
|
-
weekStartDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
154
|
-
}
|
|
6
|
+
import { ActionMeta, DropdownIndicatorProps, InputActionMeta, OptionType, ValueType } from '@atlaskit/select';
|
|
7
|
+
import { Appearance, DatePickerBaseProps, Spacing } from '../types';
|
|
155
8
|
type DatePickerProps = typeof datePickerDefaultProps & DatePickerBaseProps;
|
|
156
9
|
interface State {
|
|
157
10
|
isOpen: boolean;
|
|
@@ -267,7 +120,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
|
|
|
267
120
|
render(): jsx.JSX.Element;
|
|
268
121
|
}
|
|
269
122
|
export { DatePicker as DatePickerWithoutAnalytics };
|
|
270
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "placeholder" | "maxDate" | "minDate" | "isOpen" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "dateFormat" | "weekStartDay"> & Partial<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "icon" | "disabled" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "disabledDateFilter" | "name" | "spacing" | "isInvalid" | "hideIcon" | "locale">> & Partial<Pick<{
|
|
123
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "value" | "placeholder" | "maxDate" | "minDate" | "isOpen" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "dateFormat" | "weekStartDay"> & Partial<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "icon" | "disabled" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "disabledDateFilter" | "name" | "spacing" | "isInvalid" | "hideIcon" | "locale">> & Partial<Pick<{
|
|
271
124
|
appearance: Appearance;
|
|
272
125
|
autoFocus: boolean;
|
|
273
126
|
defaultIsOpen: boolean;
|
|
@@ -1,119 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import {
|
|
5
|
-
import { SelectProps } from '@atlaskit/select';
|
|
6
|
-
import { Appearance, Spacing } from '../types';
|
|
7
|
-
import { DatePickerBaseProps as DatePickerProps } from './date-picker';
|
|
8
|
-
import { TimePickerBaseProps as TimePickerProps } from './time-picker';
|
|
9
|
-
export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
10
|
-
/**
|
|
11
|
-
* Set the appearance of the picker.
|
|
12
|
-
*
|
|
13
|
-
* `subtle` will remove the borders and background.
|
|
14
|
-
*/
|
|
15
|
-
appearance?: Appearance;
|
|
16
|
-
/**
|
|
17
|
-
* Set the picker to autofocus on mount.
|
|
18
|
-
*/
|
|
19
|
-
autoFocus?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* The default for `value`.
|
|
22
|
-
*/
|
|
23
|
-
defaultValue?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Set the id of the field.
|
|
26
|
-
*/
|
|
27
|
-
id?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Props to apply to the container. *
|
|
30
|
-
*/
|
|
31
|
-
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
32
|
-
/**
|
|
33
|
-
* Set if the field is disabled.
|
|
34
|
-
*/
|
|
35
|
-
isDisabled?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* The name of the field.
|
|
38
|
-
*/
|
|
39
|
-
name?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Called when the field is blurred.
|
|
42
|
-
*/
|
|
43
|
-
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
44
|
-
/**
|
|
45
|
-
* Called when the value changes and the date / time is a complete value, or empty. The only value is an ISO string or empty string.
|
|
46
|
-
*/
|
|
47
|
-
onChange?: (value: string) => void;
|
|
48
|
-
/**
|
|
49
|
-
* Called when the field is focused.
|
|
50
|
-
*/
|
|
51
|
-
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
52
|
-
/**
|
|
53
|
-
* The ISO time that should be used as the input value.
|
|
54
|
-
*/
|
|
55
|
-
value?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Set if users can edit the input, allowing them to add custom times.
|
|
58
|
-
*/
|
|
59
|
-
timeIsEditable?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Set if the picker has an invalid value.
|
|
62
|
-
*/
|
|
63
|
-
isInvalid?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Format the date with a string that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
66
|
-
*/
|
|
67
|
-
dateFormat?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Props applied to the `DatePicker`.
|
|
70
|
-
*/
|
|
71
|
-
datePickerProps?: DatePickerProps;
|
|
72
|
-
/**
|
|
73
|
-
* Props applied to the `TimePicker`.
|
|
74
|
-
*/
|
|
75
|
-
timePickerProps?: TimePickerProps;
|
|
76
|
-
/**
|
|
77
|
-
* Function used to parse datetime values into their date, time and timezone sub-values. *
|
|
78
|
-
*/
|
|
79
|
-
parseValue?: (dateTimeValue: string, date: string, time: string, timezone: string) => {
|
|
80
|
-
dateValue: string;
|
|
81
|
-
timeValue: string;
|
|
82
|
-
zoneValue: string;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* [Select props](/components/select) to pass onto the `DatePicker` component's `Select`. This can be used to set options such as placeholder text.
|
|
86
|
-
*/
|
|
87
|
-
datePickerSelectProps?: SelectProps<any>;
|
|
88
|
-
/**
|
|
89
|
-
* [Select props](/components/select) to pass onto the `TimePicker` component's `Select`. This can be used to set options such as placeholder text.
|
|
90
|
-
*/
|
|
91
|
-
timePickerSelectProps?: SelectProps<any>;
|
|
92
|
-
/**
|
|
93
|
-
* The times shown by the `TimePicker`.
|
|
94
|
-
*/
|
|
95
|
-
times?: Array<string>;
|
|
96
|
-
/**
|
|
97
|
-
* The format that times are displayed in. Values should be those accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
98
|
-
*/
|
|
99
|
-
timeFormat?: string;
|
|
100
|
-
/**
|
|
101
|
-
* The spacing for the select control.
|
|
102
|
-
*
|
|
103
|
-
* Compact is `gridSize() * 4`, default is `gridSize() * 5`.
|
|
104
|
-
*/
|
|
105
|
-
spacing?: Spacing;
|
|
106
|
-
/**
|
|
107
|
-
* Locale used for formatting dates and times. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
|
|
108
|
-
*/
|
|
109
|
-
locale?: string;
|
|
110
|
-
/**
|
|
111
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
112
|
-
* - `{testId}--datepicker--container` wrapping element of date-picker
|
|
113
|
-
* - `{testId}--timepicker--container` wrapping element of time-picker
|
|
114
|
-
*/
|
|
115
|
-
testId?: string;
|
|
116
|
-
}
|
|
4
|
+
import { DateTimePickerBaseProps } from '../types';
|
|
117
5
|
type DateTimePickerProps = typeof dateTimePickerDefaultProps & DateTimePickerBaseProps;
|
|
118
6
|
interface State {
|
|
119
7
|
dateValue: string;
|
|
@@ -193,7 +81,7 @@ declare class DateTimePicker extends React.Component<DateTimePickerProps, State>
|
|
|
193
81
|
render(): jsx.JSX.Element;
|
|
194
82
|
}
|
|
195
83
|
export { DateTimePicker as DateTimePickerWithoutAnalytics };
|
|
196
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "innerProps" | "isDisabled" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "name" | "spacing" | "isInvalid" | "locale" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
|
|
84
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "innerProps" | "isDisabled" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "name" | "spacing" | "isInvalid" | "locale" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
|
|
197
85
|
appearance: string;
|
|
198
86
|
autoFocus: boolean;
|
|
199
87
|
isDisabled: boolean;
|
|
@@ -213,5 +101,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimeP
|
|
|
213
101
|
times: string[];
|
|
214
102
|
spacing: string;
|
|
215
103
|
locale: string;
|
|
216
|
-
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "innerProps" | "isDisabled" | "appearance" | "value" | "id" | "key" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "name" | "spacing" | "isInvalid" | "dateFormat" | "locale" | "
|
|
104
|
+
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "innerProps" | "isDisabled" | "appearance" | "value" | "id" | "key" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "name" | "spacing" | "isInvalid" | "dateFormat" | "locale" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "parseValue" | "datePickerSelectProps" | "timePickerSelectProps" | "analyticsContext"> & React.RefAttributes<any>>;
|
|
217
105
|
export default _default;
|
|
@@ -1,117 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Appearance, Spacing } from '../types';
|
|
5
|
-
export interface TimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
6
|
-
/**
|
|
7
|
-
* Set the appearance of the picker.
|
|
8
|
-
* `subtle` will remove the borders, background, and icon.
|
|
9
|
-
*
|
|
10
|
-
* __NOTE:__ Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
11
|
-
*/
|
|
12
|
-
appearance?: Appearance;
|
|
13
|
-
/**
|
|
14
|
-
* Set the picker to autofocus on mount.
|
|
15
|
-
*/
|
|
16
|
-
autoFocus?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* The default for `isOpen`.
|
|
19
|
-
*/
|
|
20
|
-
defaultIsOpen?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* The default for `value`.
|
|
23
|
-
*/
|
|
24
|
-
defaultValue?: string;
|
|
25
|
-
/**
|
|
26
|
-
* A function for formatting the displayed time value in the input. By default parses with an internal time parser, and formats using the [date-fns format function]((https://date-fns.org/v1.29.0/docs/format))
|
|
27
|
-
*/
|
|
28
|
-
formatDisplayLabel?: (time: string, timeFormat: string) => string;
|
|
29
|
-
/**
|
|
30
|
-
* Set the id of the field.
|
|
31
|
-
* Associates a `<label></label>` with the field.
|
|
32
|
-
*/
|
|
33
|
-
id?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Props to apply to the container. *
|
|
36
|
-
*/
|
|
37
|
-
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
38
|
-
/**
|
|
39
|
-
* Set if the field is disabled.
|
|
40
|
-
*/
|
|
41
|
-
isDisabled?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Set if the dropdown is open. Will be `false` if not provided.
|
|
44
|
-
*/
|
|
45
|
-
isOpen?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* The name of the field.
|
|
48
|
-
*/
|
|
49
|
-
name?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Called when the field is blurred.
|
|
52
|
-
*/
|
|
53
|
-
onBlur?: React.FocusEventHandler<HTMLElement>;
|
|
54
|
-
/**
|
|
55
|
-
* Called when the value changes. The only argument is an ISO time or empty string.
|
|
56
|
-
*/
|
|
57
|
-
onChange?: (value: string) => void;
|
|
58
|
-
/**
|
|
59
|
-
* Called when the field is focused.
|
|
60
|
-
*/
|
|
61
|
-
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
62
|
-
/**
|
|
63
|
-
* A function for parsing input characters and transforming them into either a string or a Date object.
|
|
64
|
-
* By default parses the string based off the locale.
|
|
65
|
-
*/
|
|
66
|
-
parseInputValue?: (time: string, timeFormat: string) => string | Date;
|
|
67
|
-
/**
|
|
68
|
-
* Props to apply to the select.
|
|
69
|
-
*/
|
|
70
|
-
selectProps?: SelectProps<any>;
|
|
71
|
-
/**
|
|
72
|
-
* The spacing for the select control.
|
|
73
|
-
*
|
|
74
|
-
* Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
75
|
-
*/
|
|
76
|
-
spacing?: Spacing;
|
|
77
|
-
/**
|
|
78
|
-
* The times shown in the dropdown.
|
|
79
|
-
*/
|
|
80
|
-
times?: string[];
|
|
81
|
-
/**
|
|
82
|
-
* Set if users can edit the input, allowing them to add custom times.
|
|
83
|
-
*/
|
|
84
|
-
timeIsEditable?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* The ISO time that should be used as the input value.
|
|
87
|
-
*/
|
|
88
|
-
value?: string;
|
|
89
|
-
/**
|
|
90
|
-
* Set if the picker has an invalid value.
|
|
91
|
-
*/
|
|
92
|
-
isInvalid?: boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Hides icon for dropdown indicator.
|
|
95
|
-
*/
|
|
96
|
-
hideIcon?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Time format that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
99
|
-
*/
|
|
100
|
-
timeFormat?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Placeholder text displayed in input.
|
|
103
|
-
*/
|
|
104
|
-
placeholder?: string;
|
|
105
|
-
/**
|
|
106
|
-
* Locale used to format the time. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
|
|
107
|
-
*/
|
|
108
|
-
locale?: string;
|
|
109
|
-
/**
|
|
110
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests:
|
|
111
|
-
* - `{testId}--container` wrapping element of time-picker
|
|
112
|
-
*/
|
|
113
|
-
testId?: string;
|
|
114
|
-
}
|
|
2
|
+
import { ActionMeta, OptionType, ValueType } from '@atlaskit/select';
|
|
3
|
+
import { Appearance, Spacing, TimePickerBaseProps } from '../types';
|
|
115
4
|
type TimePickerProps = typeof timePickerDefaultProps & TimePickerBaseProps;
|
|
116
5
|
interface State {
|
|
117
6
|
isOpen: boolean;
|
|
@@ -189,7 +78,7 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
|
|
|
189
78
|
render(): JSX.Element;
|
|
190
79
|
}
|
|
191
80
|
export { TimePicker as TimePickerWithoutAnalytics };
|
|
192
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "placeholder" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "name" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "timeIsEditable">> & Partial<Pick<{
|
|
81
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "value" | "placeholder" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "name" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "timeIsEditable">> & Partial<Pick<{
|
|
193
82
|
appearance: Appearance;
|
|
194
83
|
autoFocus: boolean;
|
|
195
84
|
defaultIsOpen: boolean;
|
|
@@ -209,5 +98,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePicke
|
|
|
209
98
|
times: string[];
|
|
210
99
|
timeIsEditable: boolean;
|
|
211
100
|
locale: string;
|
|
212
|
-
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "value" | "id" | "key" | "defaultValue" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "
|
|
101
|
+
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "value" | "id" | "key" | "defaultValue" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "timeIsEditable" | "timeFormat" | "analyticsContext"> & React.RefAttributes<any>>;
|
|
213
102
|
export default _default;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export { default as DatePicker } from './components/date-picker';
|
|
2
|
-
export type { DatePickerBaseProps as DatePickerProps } from './components/date-picker';
|
|
3
2
|
export { default as TimePicker } from './components/time-picker';
|
|
4
|
-
export type { TimePickerBaseProps as TimePickerProps } from './components/time-picker';
|
|
5
3
|
export { default as DateTimePicker } from './components/date-time-picker';
|
|
6
|
-
export type { DateTimePickerBaseProps as DateTimePickerProps } from './
|
|
7
|
-
export type { Appearance, Spacing } from './types';
|
|
4
|
+
export type { Appearance, Spacing, DatePickerBaseProps as DatePickerProps, TimePickerBaseProps as TimePickerProps, DateTimePickerBaseProps as DateTimePickerProps, } from './types';
|