@atlaskit/datetime-picker 15.4.3 → 15.5.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cjs/components/date-picker-class.js +11 -3
  3. package/dist/cjs/components/date-picker-fc.js +11 -3
  4. package/dist/cjs/components/date-time-picker-class.js +439 -0
  5. package/dist/cjs/components/date-time-picker-fc.js +398 -0
  6. package/dist/cjs/components/date-time-picker.js +7 -430
  7. package/dist/cjs/components/time-picker.js +9 -3
  8. package/dist/cjs/internal/date-time-picker-container.js +21 -20
  9. package/dist/cjs/internal/indicators-container.js +31 -0
  10. package/dist/es2019/components/date-picker-class.js +9 -1
  11. package/dist/es2019/components/date-picker-fc.js +9 -1
  12. package/dist/es2019/components/date-time-picker-class.js +400 -0
  13. package/dist/es2019/components/date-time-picker-fc.js +363 -0
  14. package/dist/es2019/components/date-time-picker.js +4 -397
  15. package/dist/es2019/components/time-picker.js +8 -3
  16. package/dist/es2019/internal/date-time-picker-container.js +8 -7
  17. package/dist/es2019/internal/indicators-container.js +22 -0
  18. package/dist/esm/components/date-picker-class.js +11 -3
  19. package/dist/esm/components/date-picker-fc.js +11 -3
  20. package/dist/esm/components/date-time-picker-class.js +437 -0
  21. package/dist/esm/components/date-time-picker-fc.js +391 -0
  22. package/dist/esm/components/date-time-picker.js +6 -434
  23. package/dist/esm/components/time-picker.js +9 -3
  24. package/dist/esm/internal/date-time-picker-container.js +8 -7
  25. package/dist/esm/internal/indicators-container.js +25 -0
  26. package/dist/types/components/date-picker-class.d.ts +2 -2
  27. package/dist/types/components/date-picker-fc.d.ts +1 -1
  28. package/dist/types/components/date-picker.d.ts +3 -3
  29. package/dist/types/components/date-time-picker-class.d.ts +56 -0
  30. package/dist/types/components/date-time-picker-fc.d.ts +19 -0
  31. package/dist/types/components/date-time-picker.d.ts +2 -55
  32. package/dist/types/components/time-picker.d.ts +1 -1
  33. package/dist/types/internal/date-time-picker-container.d.ts +10 -12
  34. package/dist/types/internal/indicators-container.d.ts +9 -0
  35. package/dist/types/types.d.ts +4 -0
  36. package/dist/types-ts4.5/components/date-picker-class.d.ts +2 -2
  37. package/dist/types-ts4.5/components/date-picker-fc.d.ts +1 -1
  38. package/dist/types-ts4.5/components/date-picker.d.ts +3 -3
  39. package/dist/types-ts4.5/components/date-time-picker-class.d.ts +56 -0
  40. package/dist/types-ts4.5/components/date-time-picker-fc.d.ts +19 -0
  41. package/dist/types-ts4.5/components/date-time-picker.d.ts +2 -55
  42. package/dist/types-ts4.5/components/time-picker.d.ts +1 -1
  43. package/dist/types-ts4.5/internal/date-time-picker-container.d.ts +10 -12
  44. package/dist/types-ts4.5/internal/indicators-container.d.ts +9 -0
  45. package/dist/types-ts4.5/types.d.ts +4 -0
  46. package/package.json +8 -5
@@ -1,400 +1,7 @@
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/glyph/select-clear';
13
1
  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
2
  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 = "15.4.3";
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
- size: "small",
368
- primaryColor: "inherit",
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));
3
+ import DateTimePickerOld from './date-time-picker-class';
4
+ import DateTimePickerNew from './date-time-picker-fc';
5
+ const DateTimePicker = componentWithCondition(() => fg('dst-date-time-picker-use-functional-component'), DateTimePickerNew, DateTimePickerOld);
6
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
400
7
  export default DateTimePicker;
@@ -11,7 +11,7 @@ import parseTime from '../internal/parse-time';
11
11
  import { convertTokens } from '../internal/parse-tokens';
12
12
  import { makeSingleValue } from '../internal/single-value';
13
13
  const packageName = "@atlaskit/datetime-picker";
14
- const packageVersion = "15.4.3";
14
+ const packageVersion = "15.5.1";
15
15
  const menuStyles = {
16
16
  /* Need to remove default absolute positioning as that causes issues with position fixed */
17
17
  position: 'static',
@@ -39,6 +39,7 @@ const TimePicker = /*#__PURE__*/forwardRef(({
39
39
  'aria-describedby': ariaDescribedBy,
40
40
  appearance = 'default',
41
41
  autoFocus = false,
42
+ clearControlLabel = 'clear timepicker',
42
43
  defaultIsOpen = false,
43
44
  defaultValue = '',
44
45
  formatDisplayLabel,
@@ -262,8 +263,12 @@ const TimePicker = /*#__PURE__*/forwardRef(({
262
263
  }), /*#__PURE__*/React.createElement(SelectComponent, _extends({
263
264
  "aria-describedby": ariaDescribedBy,
264
265
  "aria-label": label || undefined,
265
- appearance: appearance,
266
+ appearance: appearance
267
+ // we need this disabled as we might need focus to move to the select
268
+ // eslint-disable-next-line jsx-a11y/no-autofocus
269
+ ,
266
270
  autoFocus: autoFocus,
271
+ clearControlLabel: clearControlLabel,
267
272
  components: selectComponents,
268
273
  inputId: id,
269
274
  isClearable: true,
@@ -284,7 +289,7 @@ const TimePicker = /*#__PURE__*/forwardRef(({
284
289
  value: initialValue,
285
290
  spacing: spacing
286
291
  // We need this to get things to work, even though it's not supported.
287
- // @ts-ignore - https://product-fabric.atlassian.net/browse/DSP-21000
292
+ // @ts-ignore
288
293
  ,
289
294
  fixedLayerRef: containerRef,
290
295
  isInvalid: isInvalid,
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
4
4
  * @jsx jsx
5
5
  */
6
6
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
+ import { forwardRef } from 'react';
7
8
  import { css, jsx } from '@emotion/react';
8
9
  import { B100, N0, N100, N20, N30, R400 } from '@atlaskit/theme/colors';
9
10
  const isInvalidBorderStyles = css({
@@ -62,23 +63,23 @@ const baseContainerStyles = css({
62
63
  cursor: 'pointer'
63
64
  }
64
65
  });
65
-
66
66
  /**
67
67
  * This is the container for the datetime picker component.
68
68
  */
69
- export const DateTimePickerContainer = ({
69
+ export const DateTimePickerContainer = /*#__PURE__*/forwardRef(({
70
+ children,
70
71
  isDisabled,
71
72
  isFocused,
72
73
  appearance,
73
74
  isInvalid,
74
75
  innerProps,
75
- testId,
76
- children
77
- }) => {
76
+ testId
77
+ }, ref) => {
78
78
  const notFocusedOrIsDisabled = !(isFocused || isDisabled);
79
79
  return jsx("div", _extends({
80
80
  css: [baseContainerStyles, newBorderStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (isInvalid ? isInvalidHoverStyles : hoverStyles), appearance === 'none' && noBgStyles]
81
81
  }, innerProps, {
82
- "data-testid": testId
82
+ "data-testid": testId,
83
+ ref: ref
83
84
  }), children);
84
- };
85
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+
6
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
+ import { css, jsx } from '@emotion/react';
8
+ import { components } from '@atlaskit/select';
9
+ const calendarButtonInclusionStyles = css({
10
+ marginInlineStart: "var(--ds-space-400, 32px)"
11
+ });
12
+ const calendarButtonOnlyInclusionStyles = css({
13
+ marginInlineStart: "var(--ds-space-300, 24px)"
14
+ });
15
+
16
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
17
+ export const IndicatorsContainer = ({
18
+ showClearIndicator,
19
+ ...rest
20
+ }) => jsx("div", {
21
+ css: showClearIndicator ? calendarButtonInclusionStyles : calendarButtonOnlyInclusionStyles
22
+ }, jsx(components.IndicatorsContainer, rest));
@@ -32,11 +32,12 @@ import { N500, N70 } from '@atlaskit/theme/colors';
32
32
  import VisuallyHidden from '@atlaskit/visually-hidden';
33
33
  import { EmptyComponent } from '../internal';
34
34
  import { formatDate, getParsedISO, getPlaceholder, isDateDisabled, parseDate } from '../internal/date-picker-migration';
35
+ import { IndicatorsContainer as _IndicatorsContainer } from '../internal/indicators-container';
35
36
  import { Menu } from '../internal/menu';
36
37
  import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
37
38
  import { makeSingleValue } from '../internal/single-value';
38
39
  var packageName = "@atlaskit/datetime-picker";
39
- var packageVersion = "15.4.3";
40
+ var packageVersion = "15.5.1";
40
41
  var datePickerDefaultProps = {
41
42
  defaultIsOpen: false,
42
43
  defaultValue: '',
@@ -463,8 +464,15 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
463
464
  var SingleValue = makeSingleValue({
464
465
  lang: this.props.locale
465
466
  });
466
- var selectComponents = _objectSpread({
467
- DropdownIndicator: shouldShowCalendarButton ? EmptyComponent : dropDownIcon,
467
+ var selectComponents = _objectSpread(_objectSpread({
468
+ DropdownIndicator: shouldShowCalendarButton ? EmptyComponent : dropDownIcon
469
+ }, shouldShowCalendarButton ? {
470
+ IndicatorsContainer: function IndicatorsContainer(props) {
471
+ return jsx(_IndicatorsContainer, _extends({}, props, {
472
+ showClearIndicator: showClearIndicator
473
+ }));
474
+ }
475
+ } : {}), {}, {
468
476
  Menu: Menu,
469
477
  SingleValue: SingleValue
470
478
  }, !showClearIndicator && {
@@ -27,11 +27,12 @@ import { N500, N70 } from '@atlaskit/theme/colors';
27
27
  import VisuallyHidden from '@atlaskit/visually-hidden';
28
28
  import { EmptyComponent } from '../internal';
29
29
  import { formatDate, getParsedISO, getPlaceholder, isDateDisabled, parseDate } from '../internal/date-picker-migration';
30
+ import { IndicatorsContainer as _IndicatorsContainer } from '../internal/indicators-container';
30
31
  import { Menu } from '../internal/menu';
31
32
  import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
32
33
  import { makeSingleValue } from '../internal/single-value';
33
34
  var packageName = "@atlaskit/datetime-picker";
34
- var packageVersion = "15.4.3";
35
+ var packageVersion = "15.5.1";
35
36
  var analyticsAttributes = {
36
37
  componentName: 'datePicker',
37
38
  packageName: packageName,
@@ -452,8 +453,15 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
452
453
  var SingleValue = makeSingleValue({
453
454
  lang: propLocale
454
455
  });
455
- var selectComponents = _objectSpread({
456
- DropdownIndicator: shouldShowCalendarButton ? EmptyComponent : dropDownIcon,
456
+ var selectComponents = _objectSpread(_objectSpread({
457
+ DropdownIndicator: shouldShowCalendarButton ? EmptyComponent : dropDownIcon
458
+ }, shouldShowCalendarButton ? {
459
+ IndicatorsContainer: function IndicatorsContainer(props) {
460
+ return jsx(_IndicatorsContainer, _extends({}, props, {
461
+ showClearIndicator: showClearIndicator
462
+ }));
463
+ }
464
+ } : {}), {}, {
457
465
  Menu: Menu,
458
466
  SingleValue: SingleValue
459
467
  }, !showClearIndicator && {