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