@atlaskit/datetime-picker 17.8.9 → 17.9.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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/components/date-picker.js +1 -1
- package/dist/cjs/components/date-time-picker.js +502 -9
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/cjs/internal/date-time-picker-container.compiled.css +1 -1
- package/dist/cjs/internal/date-time-picker-container.js +1 -1
- package/dist/cjs/internal/get-parsed-iso.js +2 -2
- package/dist/es2019/components/date-picker.js +1 -1
- package/dist/es2019/components/date-time-picker.js +485 -6
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/es2019/internal/date-time-picker-container.compiled.css +1 -1
- package/dist/es2019/internal/date-time-picker-container.js +1 -1
- package/dist/es2019/internal/get-parsed-iso.js +2 -2
- package/dist/esm/components/date-picker.js +1 -1
- package/dist/esm/components/date-time-picker.js +502 -8
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/esm/internal/date-time-picker-container.compiled.css +1 -1
- package/dist/esm/internal/date-time-picker-container.js +1 -1
- package/dist/esm/internal/get-parsed-iso.js +2 -2
- package/dist/types/components/date-time-picker.d.ts +14 -30
- package/dist/types-ts4.5/components/date-time-picker.d.ts +14 -30
- package/package.json +6 -12
- package/dist/cjs/components/date-time-picker-class.compiled.css +0 -19
- package/dist/cjs/components/date-time-picker-class.js +0 -408
- package/dist/cjs/components/date-time-picker-fc.js +0 -484
- package/dist/es2019/components/date-time-picker-class.compiled.css +0 -19
- package/dist/es2019/components/date-time-picker-class.js +0 -373
- package/dist/es2019/components/date-time-picker-fc.js +0 -461
- package/dist/esm/components/date-time-picker-class.compiled.css +0 -19
- package/dist/esm/components/date-time-picker-class.js +0 -405
- package/dist/esm/components/date-time-picker-fc.js +0 -478
- package/dist/types/components/date-time-picker-class.d.ts +0 -82
- package/dist/types/components/date-time-picker-fc.d.ts +0 -13
- package/dist/types-ts4.5/components/date-time-picker-class.d.ts +0 -82
- package/dist/types-ts4.5/components/date-time-picker-fc.d.ts +0 -13
- /package/dist/cjs/components/{date-time-picker-fc.compiled.css → date-time-picker.compiled.css} +0 -0
- /package/dist/es2019/components/{date-time-picker-fc.compiled.css → date-time-picker.compiled.css} +0 -0
- /package/dist/esm/components/{date-time-picker-fc.compiled.css → date-time-picker.compiled.css} +0 -0
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
/* date-time-picker-class.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import "./date-time-picker-class.compiled.css";
|
|
9
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
10
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
/// <reference types="node" />
|
|
15
|
-
|
|
16
|
-
import React from 'react';
|
|
17
|
-
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
18
|
-
import { format, isValid, parseISO } from 'date-fns';
|
|
19
|
-
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
20
|
-
import SelectClearIcon from '@atlaskit/icon/core/cross-circle';
|
|
21
|
-
import { mergeStyles } from '@atlaskit/select';
|
|
22
|
-
import { DateTimePickerContainer } from '../internal/date-time-picker-container';
|
|
23
|
-
import { formatDateTimeZoneIntoIso } from '../internal/format-date-time-zone-into-iso';
|
|
24
|
-
import { convertTokens } from '../internal/parse-tokens';
|
|
25
|
-
import DatePicker from './date-picker';
|
|
26
|
-
import TimePicker from './time-picker';
|
|
27
|
-
var packageName = "@atlaskit/datetime-picker";
|
|
28
|
-
var packageVersion = "17.8.8";
|
|
29
|
-
var compiledStyles = {
|
|
30
|
-
datePickerContainerStyles: "_i0dl1ssb _16jlkb7n _1o9zidpf",
|
|
31
|
-
timePickerContainerStyles: "_i0dl1ssb _16jlkb7n",
|
|
32
|
-
iconContainerStyles: "_19itglyw _v564vrg3 _1e0c1txw _4cvr1h6o _i0dl1kw7 _bfhk1kw7 _syaz1rpy _6rthe4h9 _1pfhe4h9 _12l2e4h9 _ahbqe4h9 _85i512x7 _1q5112x7 _y4tiu2gc _bozg1b66 _30l3azsu"
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// react-select overrides (via @atlaskit/select).
|
|
36
|
-
var styles = {
|
|
37
|
-
control: function control(style) {
|
|
38
|
-
return _objectSpread(_objectSpread({}, style), {}, {
|
|
39
|
-
backgroundColor: 'transparent',
|
|
40
|
-
border: 2,
|
|
41
|
-
borderRadius: 0,
|
|
42
|
-
paddingLeft: 0,
|
|
43
|
-
':hover': {
|
|
44
|
-
backgroundColor: 'transparent',
|
|
45
|
-
cursor: 'inherit'
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
var dateTimePickerDefaultProps = {
|
|
51
|
-
// These disables are here for proper typing when used as defaults. They
|
|
52
|
-
// should *not* use the `noop` function.
|
|
53
|
-
/* eslint-disable @repo/internal/react/use-noop */
|
|
54
|
-
onBlur: function onBlur(_event) {},
|
|
55
|
-
onChange: function onChange(_value) {},
|
|
56
|
-
onFocus: function onFocus(_event) {}
|
|
57
|
-
/* eslint-enable @repo/internal/react/use-noop */
|
|
58
|
-
// Not including a default prop for value as it will
|
|
59
|
-
// Make the component a controlled component
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
63
|
-
var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
|
|
64
|
-
function DateTimePickerComponent() {
|
|
65
|
-
var _this$props$datePicke, _this$props$timePicke;
|
|
66
|
-
var _this;
|
|
67
|
-
_classCallCheck(this, DateTimePickerComponent);
|
|
68
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
69
|
-
args[_key] = arguments[_key];
|
|
70
|
-
}
|
|
71
|
-
_this = _callSuper(this, DateTimePickerComponent, [].concat(args));
|
|
72
|
-
_defineProperty(_this, "state", {
|
|
73
|
-
dateValue: ((_this$props$datePicke = _this.props.datePickerProps) === null || _this$props$datePicke === void 0 ? void 0 : _this$props$datePicke.defaultValue) || '',
|
|
74
|
-
isFocused: false,
|
|
75
|
-
timeValue: ((_this$props$timePicke = _this.props.timePickerProps) === null || _this$props$timePicke === void 0 ? void 0 : _this$props$timePicke.defaultValue) || '',
|
|
76
|
-
value: _this.props.defaultValue || '',
|
|
77
|
-
zoneValue: ''
|
|
78
|
-
});
|
|
79
|
-
// All state needs to be accessed via this function so that the state is mapped from props
|
|
80
|
-
// correctly to allow controlled/uncontrolled usage.
|
|
81
|
-
_defineProperty(_this, "getParsedValues", function () {
|
|
82
|
-
return _this.parseValue(_this.getValue(), _this.state.dateValue, _this.state.timeValue, _this.state.zoneValue);
|
|
83
|
-
});
|
|
84
|
-
_defineProperty(_this, "getValue", function () {
|
|
85
|
-
var _this$props$value;
|
|
86
|
-
return (_this$props$value = _this.props.value) !== null && _this$props$value !== void 0 ? _this$props$value : _this.state.value;
|
|
87
|
-
});
|
|
88
|
-
_defineProperty(_this, "onDateBlur", function (event) {
|
|
89
|
-
var _this$props$onBlur, _this$props, _this$props$datePicke2;
|
|
90
|
-
_this.setState({
|
|
91
|
-
isFocused: false
|
|
92
|
-
});
|
|
93
|
-
(_this$props$onBlur = (_this$props = _this.props).onBlur) === null || _this$props$onBlur === void 0 || _this$props$onBlur.call(_this$props, event);
|
|
94
|
-
if ((_this$props$datePicke2 = _this.props.datePickerProps) !== null && _this$props$datePicke2 !== void 0 && _this$props$datePicke2.onBlur) {
|
|
95
|
-
_this.props.datePickerProps.onBlur(event);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
_defineProperty(_this, "onTimeBlur", function (event) {
|
|
99
|
-
var _this$props$onBlur2, _this$props2, _this$props$timePicke2;
|
|
100
|
-
_this.setState({
|
|
101
|
-
isFocused: false
|
|
102
|
-
});
|
|
103
|
-
(_this$props$onBlur2 = (_this$props2 = _this.props).onBlur) === null || _this$props$onBlur2 === void 0 || _this$props$onBlur2.call(_this$props2, event);
|
|
104
|
-
if ((_this$props$timePicke2 = _this.props.timePickerProps) !== null && _this$props$timePicke2 !== void 0 && _this$props$timePicke2.onBlur) {
|
|
105
|
-
_this.props.timePickerProps.onBlur(event);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
_defineProperty(_this, "onDateFocus", function (event) {
|
|
109
|
-
var _this$props$onFocus, _this$props3, _this$props$datePicke3;
|
|
110
|
-
_this.setState({
|
|
111
|
-
isFocused: true
|
|
112
|
-
});
|
|
113
|
-
(_this$props$onFocus = (_this$props3 = _this.props).onFocus) === null || _this$props$onFocus === void 0 || _this$props$onFocus.call(_this$props3, event);
|
|
114
|
-
if ((_this$props$datePicke3 = _this.props.datePickerProps) !== null && _this$props$datePicke3 !== void 0 && _this$props$datePicke3.onFocus) {
|
|
115
|
-
_this.props.datePickerProps.onFocus(event);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
_defineProperty(_this, "onTimeFocus", function (event) {
|
|
119
|
-
var _this$props$onFocus2, _this$props4, _this$props$timePicke3;
|
|
120
|
-
_this.setState({
|
|
121
|
-
isFocused: true
|
|
122
|
-
});
|
|
123
|
-
(_this$props$onFocus2 = (_this$props4 = _this.props).onFocus) === null || _this$props$onFocus2 === void 0 || _this$props$onFocus2.call(_this$props4, event);
|
|
124
|
-
if ((_this$props$timePicke3 = _this.props.timePickerProps) !== null && _this$props$timePicke3 !== void 0 && _this$props$timePicke3.onFocus) {
|
|
125
|
-
_this.props.timePickerProps.onFocus(event);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
_defineProperty(_this, "onDateChange", function (dateValue) {
|
|
129
|
-
var _this$props$datePicke4;
|
|
130
|
-
var parsedValues = _this.getParsedValues();
|
|
131
|
-
_this.onValueChange({
|
|
132
|
-
dateValue: dateValue,
|
|
133
|
-
timeValue: parsedValues.timeValue,
|
|
134
|
-
zoneValue: parsedValues.zoneValue
|
|
135
|
-
});
|
|
136
|
-
if ((_this$props$datePicke4 = _this.props.datePickerProps) !== null && _this$props$datePicke4 !== void 0 && _this$props$datePicke4.onChange) {
|
|
137
|
-
_this.props.datePickerProps.onChange(dateValue);
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
_defineProperty(_this, "onTimeChange", function (timeValue) {
|
|
141
|
-
var _this$props$timePicke4;
|
|
142
|
-
var parsedValues = _this.getParsedValues();
|
|
143
|
-
_this.onValueChange({
|
|
144
|
-
dateValue: parsedValues.dateValue,
|
|
145
|
-
timeValue: timeValue,
|
|
146
|
-
zoneValue: parsedValues.zoneValue
|
|
147
|
-
});
|
|
148
|
-
if ((_this$props$timePicke4 = _this.props.timePickerProps) !== null && _this$props$timePicke4 !== void 0 && _this$props$timePicke4.onChange) {
|
|
149
|
-
_this.props.timePickerProps.onChange(timeValue);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
_defineProperty(_this, "onClear", function () {
|
|
153
|
-
var _this$props$datePicke5, _this$props$timePicke5;
|
|
154
|
-
var parsedValues = _this.getParsedValues();
|
|
155
|
-
_this.onValueChange({
|
|
156
|
-
dateValue: '',
|
|
157
|
-
timeValue: '',
|
|
158
|
-
zoneValue: parsedValues.zoneValue
|
|
159
|
-
});
|
|
160
|
-
if ((_this$props$datePicke5 = _this.props.datePickerProps) !== null && _this$props$datePicke5 !== void 0 && _this$props$datePicke5.onChange) {
|
|
161
|
-
_this.props.datePickerProps.onChange('');
|
|
162
|
-
}
|
|
163
|
-
if ((_this$props$timePicke5 = _this.props.timePickerProps) !== null && _this$props$timePicke5 !== void 0 && _this$props$timePicke5.onChange) {
|
|
164
|
-
_this.props.timePickerProps.onChange('');
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
return _this;
|
|
168
|
-
}
|
|
169
|
-
_inherits(DateTimePickerComponent, _React$Component);
|
|
170
|
-
return _createClass(DateTimePickerComponent, [{
|
|
171
|
-
key: "parseValue",
|
|
172
|
-
value: function parseValue(value, dateValue, timeValue, zoneValue) {
|
|
173
|
-
if (this.props.parseValue) {
|
|
174
|
-
var parsedFromFn = this.props.parseValue(value, dateValue, timeValue, zoneValue);
|
|
175
|
-
// This handles cases found in Jira where the parse function actually does
|
|
176
|
-
// nothing and returns undefined. The previous `getSafeState` function
|
|
177
|
-
// just spread the values over the state, but if it returned `undefined`,
|
|
178
|
-
// it would just rely on the previous state values. Considering this is
|
|
179
|
-
// what is input to this function anyway, this is a safe way to handle
|
|
180
|
-
// this, colocate the behavior, and not rely on `getSafeState`.
|
|
181
|
-
return parsedFromFn || {
|
|
182
|
-
dateValue: dateValue,
|
|
183
|
-
timeValue: timeValue,
|
|
184
|
-
zoneValue: zoneValue
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
var parsed = parseISO(value);
|
|
188
|
-
return isValid(parsed) ? {
|
|
189
|
-
dateValue: format(parsed, convertTokens('YYYY-MM-DD')),
|
|
190
|
-
timeValue: format(parsed, convertTokens('HH:mm')),
|
|
191
|
-
zoneValue: format(parsed, convertTokens('ZZ'))
|
|
192
|
-
} : {
|
|
193
|
-
dateValue: dateValue,
|
|
194
|
-
timeValue: timeValue,
|
|
195
|
-
zoneValue: zoneValue
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
}, {
|
|
199
|
-
key: "onValueChange",
|
|
200
|
-
value: function onValueChange(_ref) {
|
|
201
|
-
var dateValue = _ref.dateValue,
|
|
202
|
-
timeValue = _ref.timeValue,
|
|
203
|
-
zoneValue = _ref.zoneValue;
|
|
204
|
-
this.setState({
|
|
205
|
-
dateValue: dateValue,
|
|
206
|
-
timeValue: timeValue,
|
|
207
|
-
zoneValue: zoneValue
|
|
208
|
-
});
|
|
209
|
-
if (dateValue && timeValue) {
|
|
210
|
-
var _this$props$onChange, _this$props5;
|
|
211
|
-
var value = formatDateTimeZoneIntoIso(dateValue, timeValue, zoneValue);
|
|
212
|
-
var _this$parseValue = this.parseValue(value, dateValue, timeValue, zoneValue),
|
|
213
|
-
parsedZone = _this$parseValue.zoneValue;
|
|
214
|
-
var valueWithValidZone = formatDateTimeZoneIntoIso(dateValue, timeValue, parsedZone);
|
|
215
|
-
this.setState({
|
|
216
|
-
value: valueWithValidZone
|
|
217
|
-
});
|
|
218
|
-
(_this$props$onChange = (_this$props5 = this.props).onChange) === null || _this$props$onChange === void 0 || _this$props$onChange.call(_this$props5, valueWithValidZone);
|
|
219
|
-
// If the date or time value was cleared when there is an existing datetime value, then clear the value.
|
|
220
|
-
} else if (this.getValue()) {
|
|
221
|
-
var _this$props$onChange2, _this$props6;
|
|
222
|
-
this.setState({
|
|
223
|
-
value: ''
|
|
224
|
-
});
|
|
225
|
-
(_this$props$onChange2 = (_this$props6 = this.props).onChange) === null || _this$props$onChange2 === void 0 || _this$props$onChange2.call(_this$props6, '');
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}, {
|
|
229
|
-
key: "render",
|
|
230
|
-
value: function render() {
|
|
231
|
-
var _this$props7 = this.props,
|
|
232
|
-
ariaDescribedBy = _this$props7['aria-describedby'],
|
|
233
|
-
_this$props7$appearan = _this$props7.appearance,
|
|
234
|
-
appearance = _this$props7$appearan === void 0 ? 'default' : _this$props7$appearan,
|
|
235
|
-
_this$props7$autoFocu = _this$props7.autoFocus,
|
|
236
|
-
autoFocus = _this$props7$autoFocu === void 0 ? false : _this$props7$autoFocu,
|
|
237
|
-
_this$props7$clearCon = _this$props7.clearControlLabel,
|
|
238
|
-
clearControlLabel = _this$props7$clearCon === void 0 ? 'clear' : _this$props7$clearCon,
|
|
239
|
-
_this$props7$datePick = _this$props7.datePickerProps,
|
|
240
|
-
datePickerProps = _this$props7$datePick === void 0 ? {} : _this$props7$datePick,
|
|
241
|
-
_this$props7$id = _this$props7.id,
|
|
242
|
-
id = _this$props7$id === void 0 ? '' : _this$props7$id,
|
|
243
|
-
_this$props7$innerPro = _this$props7.innerProps,
|
|
244
|
-
innerProps = _this$props7$innerPro === void 0 ? {} : _this$props7$innerPro,
|
|
245
|
-
_this$props7$isDisabl = _this$props7.isDisabled,
|
|
246
|
-
isDisabled = _this$props7$isDisabl === void 0 ? false : _this$props7$isDisabl,
|
|
247
|
-
_this$props7$isInvali = _this$props7.isInvalid,
|
|
248
|
-
isInvalid = _this$props7$isInvali === void 0 ? false : _this$props7$isInvali,
|
|
249
|
-
_this$props7$isRequir = _this$props7.isRequired,
|
|
250
|
-
isRequired = _this$props7$isRequir === void 0 ? false : _this$props7$isRequir,
|
|
251
|
-
_this$props7$locale = _this$props7.locale,
|
|
252
|
-
locale = _this$props7$locale === void 0 ? 'en-US' : _this$props7$locale,
|
|
253
|
-
_this$props7$name = _this$props7.name,
|
|
254
|
-
name = _this$props7$name === void 0 ? '' : _this$props7$name,
|
|
255
|
-
_this$props7$spacing = _this$props7.spacing,
|
|
256
|
-
spacing = _this$props7$spacing === void 0 ? 'default' : _this$props7$spacing,
|
|
257
|
-
testId = _this$props7.testId,
|
|
258
|
-
_this$props7$timePick = _this$props7.timePickerProps,
|
|
259
|
-
timePickerProps = _this$props7$timePick === void 0 ? {} : _this$props7$timePick;
|
|
260
|
-
var value = this.getValue();
|
|
261
|
-
var isFocused = this.state.isFocused;
|
|
262
|
-
var parsedValues = this.getParsedValues();
|
|
263
|
-
var dateValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.dateValue;
|
|
264
|
-
var timeValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.timeValue;
|
|
265
|
-
var datePickerSelectProps = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectProps;
|
|
266
|
-
var datePickerAriaDescribedBy = datePickerProps['aria-describedby'] || ariaDescribedBy;
|
|
267
|
-
var datePickerLabel = datePickerProps.label || 'Date';
|
|
268
|
-
var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
|
|
269
|
-
styles: mergeStyles(styles, datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.styles)
|
|
270
|
-
});
|
|
271
|
-
var timePickerSelectProps = timePickerProps === null || timePickerProps === void 0 ? void 0 : timePickerProps.selectProps;
|
|
272
|
-
var timePickerAriaDescribedBy = timePickerProps['aria-describedby'] || ariaDescribedBy;
|
|
273
|
-
var timePickerLabel = timePickerProps.label || 'Time';
|
|
274
|
-
var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
|
|
275
|
-
styles: mergeStyles(styles, timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.styles)
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
// Render DateTimePicker's IconContainer when a value has been filled
|
|
279
|
-
// Don't use Date or TimePicker's because they can't be customised
|
|
280
|
-
var isClearable = Boolean(dateValue || timeValue);
|
|
281
|
-
return /*#__PURE__*/React.createElement(DateTimePickerContainer, {
|
|
282
|
-
appearance: appearance,
|
|
283
|
-
isDisabled: isDisabled,
|
|
284
|
-
isFocused: isFocused,
|
|
285
|
-
isInvalid: isInvalid,
|
|
286
|
-
testId: testId,
|
|
287
|
-
innerProps: innerProps
|
|
288
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
289
|
-
name: name,
|
|
290
|
-
type: "hidden",
|
|
291
|
-
value: value,
|
|
292
|
-
"data-testid": testId && "".concat(testId, "--input")
|
|
293
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
294
|
-
className: ax([compiledStyles.datePickerContainerStyles])
|
|
295
|
-
}, /*#__PURE__*/React.createElement(DatePicker, {
|
|
296
|
-
appearance: appearance,
|
|
297
|
-
"aria-describedby": datePickerAriaDescribedBy,
|
|
298
|
-
autoFocus: datePickerProps.autoFocus || autoFocus,
|
|
299
|
-
dateFormat: datePickerProps.dateFormat,
|
|
300
|
-
defaultIsOpen: datePickerProps.defaultIsOpen,
|
|
301
|
-
defaultValue: datePickerProps.defaultValue,
|
|
302
|
-
disabled: datePickerProps.disabled,
|
|
303
|
-
disabledDateFilter: datePickerProps.disabledDateFilter,
|
|
304
|
-
formatDisplayLabel: datePickerProps.formatDisplayLabel,
|
|
305
|
-
hideIcon: datePickerProps.hideIcon || true,
|
|
306
|
-
icon: datePickerProps.icon,
|
|
307
|
-
id: datePickerProps.id || id,
|
|
308
|
-
innerProps: datePickerProps.innerProps,
|
|
309
|
-
isDisabled: datePickerProps.isDisabled || isDisabled,
|
|
310
|
-
isInvalid: datePickerProps.isInvalid || isInvalid,
|
|
311
|
-
isRequired: datePickerProps.isRequired || isRequired,
|
|
312
|
-
isOpen: datePickerProps.isOpen,
|
|
313
|
-
label: datePickerLabel,
|
|
314
|
-
locale: datePickerProps.locale || locale,
|
|
315
|
-
maxDate: datePickerProps.maxDate,
|
|
316
|
-
minDate: datePickerProps.minDate,
|
|
317
|
-
name: datePickerProps.name,
|
|
318
|
-
nextMonthLabel: datePickerProps.nextMonthLabel,
|
|
319
|
-
onBlur: this.onDateBlur,
|
|
320
|
-
onChange: this.onDateChange,
|
|
321
|
-
onFocus: this.onDateFocus,
|
|
322
|
-
parseInputValue: datePickerProps.parseInputValue,
|
|
323
|
-
placeholder: datePickerProps.placeholder,
|
|
324
|
-
previousMonthLabel: datePickerProps.previousMonthLabel,
|
|
325
|
-
selectProps: mergedDatePickerSelectProps,
|
|
326
|
-
shouldShowCalendarButton: datePickerProps.shouldShowCalendarButton,
|
|
327
|
-
spacing: datePickerProps.spacing || spacing,
|
|
328
|
-
testId: testId && "".concat(testId, "--datepicker") || datePickerProps.testId,
|
|
329
|
-
value: dateValue,
|
|
330
|
-
weekStartDay: datePickerProps.weekStartDay
|
|
331
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
332
|
-
className: ax([compiledStyles.timePickerContainerStyles])
|
|
333
|
-
}, /*#__PURE__*/React.createElement(TimePicker, {
|
|
334
|
-
appearance: timePickerProps.appearance || appearance,
|
|
335
|
-
"aria-describedby": timePickerAriaDescribedBy,
|
|
336
|
-
autoFocus: timePickerProps.autoFocus,
|
|
337
|
-
defaultIsOpen: timePickerProps.defaultIsOpen,
|
|
338
|
-
defaultValue: timePickerProps.defaultValue,
|
|
339
|
-
formatDisplayLabel: timePickerProps.formatDisplayLabel,
|
|
340
|
-
hideIcon: timePickerProps.hideIcon || true,
|
|
341
|
-
id: timePickerProps.id,
|
|
342
|
-
innerProps: timePickerProps.innerProps,
|
|
343
|
-
isDisabled: timePickerProps.isDisabled || isDisabled,
|
|
344
|
-
isInvalid: timePickerProps.isInvalid || isInvalid,
|
|
345
|
-
isOpen: timePickerProps.isOpen,
|
|
346
|
-
isRequired: timePickerProps.isRequired || isRequired,
|
|
347
|
-
label: timePickerLabel,
|
|
348
|
-
locale: timePickerProps.locale || locale,
|
|
349
|
-
name: timePickerProps.name,
|
|
350
|
-
onBlur: this.onTimeBlur,
|
|
351
|
-
onChange: this.onTimeChange,
|
|
352
|
-
onFocus: this.onTimeFocus,
|
|
353
|
-
parseInputValue: timePickerProps.parseInputValue,
|
|
354
|
-
placeholder: timePickerProps.placeholder,
|
|
355
|
-
selectProps: mergedTimePickerSelectProps,
|
|
356
|
-
spacing: timePickerProps.spacing || spacing,
|
|
357
|
-
testId: timePickerProps.testId || testId && "".concat(testId, "--timepicker"),
|
|
358
|
-
timeFormat: timePickerProps.timeFormat,
|
|
359
|
-
timeIsEditable: timePickerProps.timeIsEditable,
|
|
360
|
-
times: timePickerProps.times,
|
|
361
|
-
value: timeValue
|
|
362
|
-
})), isClearable && !isDisabled ? /*#__PURE__*/React.createElement("button", {
|
|
363
|
-
onClick: this.onClear,
|
|
364
|
-
"data-testid": testId && "".concat(testId, "--icon--container"),
|
|
365
|
-
tabIndex: -1,
|
|
366
|
-
type: "button",
|
|
367
|
-
className: ax([compiledStyles.iconContainerStyles])
|
|
368
|
-
}, /*#__PURE__*/React.createElement(SelectClearIcon, {
|
|
369
|
-
color: "currentColor",
|
|
370
|
-
label: clearControlLabel,
|
|
371
|
-
size: "small"
|
|
372
|
-
}), ' ') : null);
|
|
373
|
-
}
|
|
374
|
-
}]);
|
|
375
|
-
}(React.Component);
|
|
376
|
-
_defineProperty(DateTimePickerComponent, "defaultProps", dateTimePickerDefaultProps);
|
|
377
|
-
export { DateTimePickerComponent as DateTimePickerWithoutAnalytics };
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* __Date time picker__
|
|
381
|
-
*
|
|
382
|
-
* A date time picker allows the user to select an associated date and time.
|
|
383
|
-
*
|
|
384
|
-
* - [Examples](https://atlassian.design/components/datetime-picker/examples)
|
|
385
|
-
* - [Code](https://atlassian.design/components/datetime-picker/code)
|
|
386
|
-
* - [Usage](https://atlassian.design/components/datetime-picker/usage)
|
|
387
|
-
*/
|
|
388
|
-
var DateTimePicker = withAnalyticsContext({
|
|
389
|
-
componentName: 'dateTimePicker',
|
|
390
|
-
packageName: packageName,
|
|
391
|
-
packageVersion: packageVersion
|
|
392
|
-
})(withAnalyticsEvents({
|
|
393
|
-
onChange: createAndFireEvent('atlaskit')({
|
|
394
|
-
action: 'changed',
|
|
395
|
-
actionSubject: 'dateTimePicker',
|
|
396
|
-
attributes: {
|
|
397
|
-
componentName: 'dateTimePicker',
|
|
398
|
-
packageName: packageName,
|
|
399
|
-
packageVersion: packageVersion
|
|
400
|
-
}
|
|
401
|
-
})
|
|
402
|
-
})(DateTimePickerComponent));
|
|
403
|
-
|
|
404
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
405
|
-
export default DateTimePicker;
|