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