@atlaskit/datetime-picker 16.2.3 → 17.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/components/date-picker-class.compiled.css +16 -0
  3. package/dist/cjs/components/date-picker-class.js +118 -144
  4. package/dist/cjs/components/date-picker-fc.compiled.css +16 -0
  5. package/dist/cjs/components/date-picker-fc.js +115 -142
  6. package/dist/cjs/components/date-time-picker-class.compiled.css +19 -0
  7. package/dist/cjs/components/date-time-picker-class.js +22 -47
  8. package/dist/cjs/components/date-time-picker-fc.compiled.css +6 -0
  9. package/dist/cjs/components/date-time-picker-fc.js +22 -27
  10. package/dist/cjs/components/time-picker.js +1 -1
  11. package/dist/cjs/internal/date-time-picker-container.compiled.css +21 -0
  12. package/dist/cjs/internal/date-time-picker-container.js +26 -71
  13. package/dist/cjs/internal/fixed-layer-menu.js +8 -8
  14. package/dist/cjs/internal/fixed-layer.compiled.css +4 -0
  15. package/dist/cjs/internal/fixed-layer.js +14 -13
  16. package/dist/cjs/internal/indicators-container.compiled.css +2 -0
  17. package/dist/cjs/internal/indicators-container.js +14 -15
  18. package/dist/cjs/internal/menu.compiled.css +6 -0
  19. package/dist/cjs/internal/menu.js +15 -32
  20. package/dist/es2019/components/date-picker-class.compiled.css +16 -0
  21. package/dist/es2019/components/date-picker-class.js +113 -142
  22. package/dist/es2019/components/date-picker-fc.compiled.css +16 -0
  23. package/dist/es2019/components/date-picker-fc.js +112 -140
  24. package/dist/es2019/components/date-time-picker-class.compiled.css +19 -0
  25. package/dist/es2019/components/date-time-picker-class.js +21 -49
  26. package/dist/es2019/components/date-time-picker-fc.compiled.css +6 -0
  27. package/dist/es2019/components/date-time-picker-fc.js +19 -24
  28. package/dist/es2019/components/time-picker.js +1 -1
  29. package/dist/es2019/internal/date-time-picker-container.compiled.css +21 -0
  30. package/dist/es2019/internal/date-time-picker-container.js +18 -69
  31. package/dist/es2019/internal/fixed-layer-menu.js +5 -8
  32. package/dist/es2019/internal/fixed-layer.compiled.css +4 -0
  33. package/dist/es2019/internal/fixed-layer.js +13 -12
  34. package/dist/es2019/internal/indicators-container.compiled.css +2 -0
  35. package/dist/es2019/internal/indicators-container.js +11 -16
  36. package/dist/es2019/internal/menu.compiled.css +6 -0
  37. package/dist/es2019/internal/menu.js +11 -30
  38. package/dist/esm/components/date-picker-class.compiled.css +16 -0
  39. package/dist/esm/components/date-picker-class.js +116 -145
  40. package/dist/esm/components/date-picker-fc.compiled.css +16 -0
  41. package/dist/esm/components/date-picker-fc.js +114 -142
  42. package/dist/esm/components/date-time-picker-class.compiled.css +19 -0
  43. package/dist/esm/components/date-time-picker-class.js +21 -49
  44. package/dist/esm/components/date-time-picker-fc.compiled.css +6 -0
  45. package/dist/esm/components/date-time-picker-fc.js +19 -24
  46. package/dist/esm/components/time-picker.js +1 -1
  47. package/dist/esm/internal/date-time-picker-container.compiled.css +21 -0
  48. package/dist/esm/internal/date-time-picker-container.js +22 -69
  49. package/dist/esm/internal/fixed-layer-menu.js +5 -8
  50. package/dist/esm/internal/fixed-layer.compiled.css +4 -0
  51. package/dist/esm/internal/fixed-layer.js +13 -13
  52. package/dist/esm/internal/indicators-container.compiled.css +2 -0
  53. package/dist/esm/internal/indicators-container.js +11 -16
  54. package/dist/esm/internal/menu.compiled.css +6 -0
  55. package/dist/esm/internal/menu.js +11 -30
  56. package/dist/types/components/date-picker-class.d.ts +2 -3
  57. package/dist/types/components/date-picker.d.ts +1 -1
  58. package/dist/types/components/date-time-picker-class.d.ts +4 -5
  59. package/dist/types/components/date-time-picker.d.ts +3 -3
  60. package/dist/types/internal/date-time-picker-container.d.ts +4 -0
  61. package/dist/types/internal/fixed-layer-menu.d.ts +2 -6
  62. package/dist/types/internal/fixed-layer.d.ts +5 -1
  63. package/dist/types/internal/indicators-container.d.ts +2 -2
  64. package/dist/types/internal/menu.d.ts +6 -2
  65. package/dist/types-ts4.5/components/date-picker-class.d.ts +2 -3
  66. package/dist/types-ts4.5/components/date-picker.d.ts +1 -1
  67. package/dist/types-ts4.5/components/date-time-picker-class.d.ts +4 -5
  68. package/dist/types-ts4.5/components/date-time-picker.d.ts +3 -3
  69. package/dist/types-ts4.5/internal/date-time-picker-container.d.ts +4 -0
  70. package/dist/types-ts4.5/internal/fixed-layer-menu.d.ts +2 -6
  71. package/dist/types-ts4.5/internal/fixed-layer.d.ts +5 -1
  72. package/dist/types-ts4.5/internal/indicators-container.d.ts +2 -2
  73. package/dist/types-ts4.5/internal/menu.d.ts +6 -2
  74. package/package.json +10 -10
@@ -1,21 +1,19 @@
1
+ /* date-picker-class.tsx generated by @compiled/babel-plugin v0.36.1 */
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- /**
4
- * @jsxRuntime classic
5
- * @jsx jsx
6
- */
4
+ import "./date-picker-class.compiled.css";
5
+ import * as React from 'react';
6
+ import { ax, ix } from "@compiled/react/runtime";
7
7
  import { Component, createRef } from 'react';
8
-
9
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
- import { css, jsx } from '@emotion/react';
11
8
  import { isValid, parseISO } from 'date-fns';
12
9
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
13
10
  import { IconButton } from '@atlaskit/button/new';
11
+ import { cx } from '@atlaskit/css';
14
12
  import { IdProvider } from '@atlaskit/ds-lib/use-id';
15
13
  import CalendarIcon from '@atlaskit/icon/core/migration/calendar';
16
14
  import { createLocalizationProvider } from '@atlaskit/locale';
17
15
  import { fg } from '@atlaskit/platform-feature-flags';
18
- import { Box, xcss } from '@atlaskit/primitives';
16
+ import { Box } from '@atlaskit/primitives/compiled';
19
17
  import Select, { mergeStyles } from '@atlaskit/select';
20
18
  import { EmptyComponent } from '../internal';
21
19
  import { formatDate, getParsedISO, getPlaceholder, isDateDisabled, parseDate } from '../internal/date-picker-migration';
@@ -24,14 +22,7 @@ import { Menu } from '../internal/menu';
24
22
  import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
25
23
  import { makeSingleValue } from '../internal/single-value';
26
24
  const packageName = "@atlaskit/datetime-picker";
27
- const packageVersion = "16.2.3";
28
- const dropdownIndicatorStyles = xcss({
29
- minWidth: "var(--ds-space-300, 24px)",
30
- minHeight: "var(--ds-space-300, 24px)",
31
- display: 'flex',
32
- alignItems: 'center',
33
- justifyContent: 'center'
34
- });
25
+ const packageVersion = "17.0.0";
35
26
  const datePickerDefaultProps = {
36
27
  defaultIsOpen: false,
37
28
  defaultValue: '',
@@ -48,29 +39,13 @@ const datePickerDefaultProps = {
48
39
  // Not including a default prop for value as it will
49
40
  // Make the component a controlled component
50
41
  };
51
- const pickerContainerStyles = css({
52
- position: 'relative'
53
- });
54
- const iconContainerStyles = xcss({
55
- display: 'flex',
56
- height: '100%',
57
- position: 'absolute',
58
- alignItems: 'center',
59
- flexBasis: 'inherit',
60
- color: 'color.text.subtlest',
61
- insetBlockStart: 'space.0',
62
- insetInlineEnd: 'space.0',
63
- transition: `color 150ms`,
64
- ':hover': {
65
- color: 'color.text.subtle'
66
- }
67
- });
68
- const iconSpacingWithClearButtonStyles = xcss({
69
- marginInlineEnd: 'space.400'
70
- });
71
- const iconSpacingWithoutClearButtonStyles = xcss({
72
- marginInlineEnd: 'space.050'
73
- });
42
+ const styles = {
43
+ pickerContainerStyles: "_kqswh2mm",
44
+ iconContainerStyles: "_v564vrg3 _1e0c1txw _4t3i1osq _kqswstnw _4cvr1h6o _i0dl1kw7 _syaz131l _152tze3t _rjxpze3t _30l31gjq",
45
+ iconSpacingWithClearButtonStyles: "_12l2xy5q",
46
+ iconSpacingWithoutClearButtonStyles: "_12l21b66",
47
+ dropdownIndicatorStyles: "_1ul91k8s _1tke1k8s _1e0c1txw _4cvr1h6o _1bah1h6o"
48
+ };
74
49
 
75
50
  // eslint-disable-next-line @repo/internal/react/no-class-components
76
51
  class DatePickerComponent extends Component {
@@ -448,11 +423,11 @@ class DatePickerComponent extends Component {
448
423
  const showClearIndicator = Boolean((value || selectInputValue) && !hideIcon);
449
424
  let clearIndicator = Icon;
450
425
 
451
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
426
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning, @atlaskit/platform/ensure-feature-flag-prefix
452
427
  if (fg('platform-visual-refresh-icons')) {
453
- clearIndicator = props => jsx(Box, {
454
- xcss: dropdownIndicatorStyles
455
- }, jsx(Icon, props));
428
+ clearIndicator = props => /*#__PURE__*/React.createElement(Box, {
429
+ xcss: styles.dropdownIndicatorStyles
430
+ }, /*#__PURE__*/React.createElement(Icon, props));
456
431
  }
457
432
  const dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : clearIndicator;
458
433
  const SingleValue = makeSingleValue({
@@ -463,7 +438,7 @@ class DatePickerComponent extends Component {
463
438
  // Only use this new container component if the calendar button is shown.
464
439
  // Otherwise, it throws errors downstream for some reason
465
440
  ...(shouldShowCalendarButton ? {
466
- IndicatorsContainer: props => jsx(IndicatorsContainer, _extends({}, props, {
441
+ IndicatorsContainer: props => /*#__PURE__*/React.createElement(IndicatorsContainer, _extends({}, props, {
467
442
  showClearIndicator: showClearIndicator
468
443
  }))
469
444
  } : {}),
@@ -521,104 +496,100 @@ class DatePickerComponent extends Component {
521
496
 
522
497
  // `label` takes precedence of the `inputLabel`
523
498
  const fullopenCalendarLabel = label || inputLabel ? `${label || inputLabel}, ${openCalendarLabel}` : openCalendarLabel;
524
- return (
525
- // These event handlers must be on this element because the events come
526
- // from different child elements.
527
- // Until innerProps is removed, it must remain a div rather than a primitive component.
528
- jsx("div", _extends({}, innerProps, {
529
- css: pickerContainerStyles
530
- // Since the onclick, onfocus are passed down, adding role="presentation" prevents typecheck errors.
531
- ,
532
- role: "presentation",
533
- onBlur: this.onContainerBlur,
534
- onFocus: this.onContainerFocus,
535
- onClick: this.onInputClick,
536
- onInput: this.onTextInput,
537
- onKeyDown: this.onInputKeyDown,
538
- ref: this.getContainerRef,
539
- "data-testid": testId && `${testId}--container`
540
- }), jsx("input", {
541
- name: name,
542
- type: "hidden",
543
- value: value,
544
- "data-testid": testId && `${testId}--input`
545
- }), jsx(Select, _extends({
546
- appearance: this.props.appearance,
547
- "aria-describedby": ariaDescribedBy,
548
- label: label || undefined,
549
- autoFocus: autoFocus,
550
- clearControlLabel: clearControlLabel,
551
- closeMenuOnSelect: true
552
- // FOr some reason, this and the below `styles` type error _only_ show
553
- // up when you alter some of the properties in the `selectComponents`
554
- // object. These errors are still present, and I suspect have always
555
- // been present, without changing the unrelated code. Ignoring as the
556
- // component still works as expected despite this error. And also
557
- // because the select refresh team may solve it later.
558
- ,
559
- components: selectComponents,
560
- enableAnimation: false,
561
- inputId: id,
562
- inputValue: actualSelectInputValue,
563
- isDisabled: isDisabled,
564
- isRequired: isRequired,
565
- menuIsOpen: menuIsOpen,
566
- onBlur: this.onSelectBlur,
567
- onChange: this.onSelectChange,
568
- onFocus: this.onSelectFocus,
569
- onInputChange: this.handleSelectInputChange,
570
- placeholder: getPlaceholder({
571
- placeholder: this.props.placeholder,
572
- l10n: this.state.l10n
573
- }),
574
- styles: mergedStyles,
575
- value: initialValue
576
- }, selectProps, {
577
- // These are below the spread because I don't know what is in
578
- // selectProps or not and what wil be overwritten
579
- isClearable: true,
580
- isInvalid: isInvalid,
581
- spacing: spacing,
582
- testId: testId
583
- // These aren't part of `Select`'s API, but we're using them here.
584
- // @ts-ignore -- Property 'calendarContainerRef' does not exist on type 'IntrinsicAttributes & LibraryManagedAttributes<(<Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & { ...; }) => Element), AtlaskitSelectProps<...> & { ...; }>'.
585
- ,
586
- calendarContainerRef: calendarProps.calendarContainerRef,
587
- calendarDisabled: calendarProps.calendarDisabled,
588
- calendarDisabledDateFilter: calendarProps.calendarDisabledDateFilter,
589
- calendarLocale: calendarProps.calendarLocale,
590
- calendarMaxDate: calendarProps.calendarMaxDate,
591
- calendarMinDate: calendarProps.calendarMinDate,
592
- calendarRef: calendarProps.calendarRef,
593
- calendarValue: calendarProps.calendarValue,
594
- calendarView: calendarProps.calendarView,
595
- calendarWeekStartDay: calendarProps.calendarWeekStartDay,
596
- nextMonthLabel: nextMonthLabel,
597
- onCalendarChange: calendarProps.onCalendarChange,
598
- onCalendarSelect: calendarProps.onCalendarSelect,
599
- previousMonthLabel: previousMonthLabel,
600
- shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay,
601
- menuInnerWrapper: calendarProps.menuInnerWrapper
602
- })), shouldShowCalendarButton && !isDisabled ? jsx(IdProvider, {
603
- prefix: "open-calendar-label--"
604
- }, ({
605
- id: openCalendarLabelId
606
- }) => jsx(Box, {
607
- xcss: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : iconSpacingWithoutClearButtonStyles]
608
- }, jsx(IconButton, {
609
- appearance: "subtle",
610
- label: !inputLabelId ? fullopenCalendarLabel : openCalendarLabel,
611
- "aria-labelledby": inputLabelId ? `${inputLabelId} ${openCalendarLabelId}` : undefined,
612
- id: openCalendarLabelId,
613
- icon: iconProps => jsx(CalendarIcon, _extends({}, iconProps, {
614
- color: "var(--ds-icon, #44546F)"
615
- })),
616
- onClick: this.onCalendarButtonClick,
617
- onKeyDown: this.onCalendarButtonKeyDown,
618
- ref: this.calendarButtonRef,
619
- testId: testId && `${testId}--open-calendar-button`
620
- }))) : null)
621
- );
499
+ return /*#__PURE__*/React.createElement("div", _extends({}, innerProps, {
500
+ // Since the onclick, onfocus are passed down, adding role="presentation" prevents typecheck errors.
501
+ role: "presentation",
502
+ onBlur: this.onContainerBlur,
503
+ onFocus: this.onContainerFocus,
504
+ onClick: this.onInputClick,
505
+ onInput: this.onTextInput,
506
+ onKeyDown: this.onInputKeyDown,
507
+ ref: this.getContainerRef,
508
+ "data-testid": testId && `${testId}--container`,
509
+ className: ax([styles.pickerContainerStyles])
510
+ }), /*#__PURE__*/React.createElement("input", {
511
+ name: name,
512
+ type: "hidden",
513
+ value: value,
514
+ "data-testid": testId && `${testId}--input`
515
+ }), /*#__PURE__*/React.createElement(Select, _extends({
516
+ appearance: this.props.appearance,
517
+ "aria-describedby": ariaDescribedBy,
518
+ label: label || undefined
519
+ // eslint-disable-next-line jsx-a11y/no-autofocus
520
+ ,
521
+ autoFocus: autoFocus,
522
+ clearControlLabel: clearControlLabel,
523
+ closeMenuOnSelect: true
524
+ // FOr some reason, this and the below `styles` type error _only_ show
525
+ // up when you alter some of the properties in the `selectComponents`
526
+ // object. These errors are still present, and I suspect have always
527
+ // been present, without changing the unrelated code. Ignoring as the
528
+ // component still works as expected despite this error. And also
529
+ // because the select refresh team may solve it later.
530
+ ,
531
+ components: selectComponents,
532
+ enableAnimation: false,
533
+ inputId: id,
534
+ inputValue: actualSelectInputValue,
535
+ isDisabled: isDisabled,
536
+ isRequired: isRequired,
537
+ menuIsOpen: menuIsOpen,
538
+ onBlur: this.onSelectBlur,
539
+ onChange: this.onSelectChange,
540
+ onFocus: this.onSelectFocus,
541
+ onInputChange: this.handleSelectInputChange,
542
+ placeholder: getPlaceholder({
543
+ placeholder: this.props.placeholder,
544
+ l10n: this.state.l10n
545
+ }),
546
+ styles: mergedStyles,
547
+ value: initialValue
548
+ }, selectProps, {
549
+ // These are below the spread because I don't know what is in
550
+ // selectProps or not and what wil be overwritten
551
+ isClearable: true,
552
+ isInvalid: isInvalid,
553
+ spacing: spacing,
554
+ testId: testId
555
+ // These aren't part of `Select`'s API, but we're using them here.
556
+ // @ts-ignore -- Property 'calendarContainerRef' does not exist on type 'IntrinsicAttributes & LibraryManagedAttributes<(<Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & { ...; }) => Element), AtlaskitSelectProps<...> & { ...; }>'.
557
+ ,
558
+ calendarContainerRef: calendarProps.calendarContainerRef,
559
+ calendarDisabled: calendarProps.calendarDisabled,
560
+ calendarDisabledDateFilter: calendarProps.calendarDisabledDateFilter,
561
+ calendarLocale: calendarProps.calendarLocale,
562
+ calendarMaxDate: calendarProps.calendarMaxDate,
563
+ calendarMinDate: calendarProps.calendarMinDate,
564
+ calendarRef: calendarProps.calendarRef,
565
+ calendarValue: calendarProps.calendarValue,
566
+ calendarView: calendarProps.calendarView,
567
+ calendarWeekStartDay: calendarProps.calendarWeekStartDay,
568
+ nextMonthLabel: nextMonthLabel,
569
+ onCalendarChange: calendarProps.onCalendarChange,
570
+ onCalendarSelect: calendarProps.onCalendarSelect,
571
+ previousMonthLabel: previousMonthLabel,
572
+ shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay,
573
+ menuInnerWrapper: calendarProps.menuInnerWrapper
574
+ })), shouldShowCalendarButton && !isDisabled ? /*#__PURE__*/React.createElement(IdProvider, {
575
+ prefix: "open-calendar-label--"
576
+ }, ({
577
+ id: openCalendarLabelId
578
+ }) => /*#__PURE__*/React.createElement(Box, {
579
+ xcss: cx(styles.iconContainerStyles, value && !hideIcon ? styles.iconSpacingWithClearButtonStyles : styles.iconSpacingWithoutClearButtonStyles)
580
+ }, /*#__PURE__*/React.createElement(IconButton, {
581
+ appearance: "subtle",
582
+ label: !inputLabelId ? fullopenCalendarLabel : openCalendarLabel,
583
+ "aria-labelledby": inputLabelId ? `${inputLabelId} ${openCalendarLabelId}` : undefined,
584
+ id: openCalendarLabelId,
585
+ icon: iconProps => /*#__PURE__*/React.createElement(CalendarIcon, _extends({}, iconProps, {
586
+ color: "var(--ds-icon, #44546F)"
587
+ })),
588
+ onClick: this.onCalendarButtonClick,
589
+ onKeyDown: this.onCalendarButtonKeyDown,
590
+ ref: this.calendarButtonRef,
591
+ testId: testId && `${testId}--open-calendar-button`
592
+ }))) : null);
622
593
  }
623
594
  }
624
595
  _defineProperty(DatePickerComponent, "defaultProps", datePickerDefaultProps);
@@ -0,0 +1,16 @@
1
+
2
+ ._v564vrg3{transition:color .15s}._12l21b66{margin-inline-end:var(--ds-space-050,4px)}
3
+ ._12l2xy5q{margin-inline-end:var(--ds-space-400,2pc)}
4
+ ._152tze3t{inset-block-start:var(--ds-space-0,0)}
5
+ ._1bah1h6o{justify-content:center}
6
+ ._1e0c1txw{display:flex}
7
+ ._1tke1k8s{min-height:1.5rem}
8
+ ._1ul91k8s{min-width:1.5rem}
9
+ ._4cvr1h6o{align-items:center}
10
+ ._4t3i1osq{height:100%}
11
+ ._i0dl1kw7{flex-basis:inherit}
12
+ ._kqswh2mm{position:relative}
13
+ ._kqswstnw{position:absolute}
14
+ ._rjxpze3t{inset-inline-end:var(--ds-space-0,0)}
15
+ ._syaz131l{color:var(--ds-text-subtlest,#626f86)}
16
+ ._30l31gjq:hover{color:var(--ds-text-subtle,#44546f)}
@@ -1,20 +1,18 @@
1
+ /* date-picker-fc.tsx generated by @compiled/babel-plugin v0.36.1 */
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
- /**
3
- * @jsxRuntime classic
4
- * @jsx jsx
5
- */
3
+ import "./date-picker-fc.compiled.css";
4
+ import * as React from 'react';
5
+ import { ax, ix } from "@compiled/react/runtime";
6
6
  import { forwardRef, useCallback, useEffect, useReducer, useRef, useState } 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
7
  import { isValid, parseISO } from 'date-fns';
11
8
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
12
9
  import { IconButton } from '@atlaskit/button/new';
10
+ import { cx } from '@atlaskit/css';
13
11
  import { useId } from '@atlaskit/ds-lib/use-id';
14
12
  import CalendarIcon from '@atlaskit/icon/core/migration/calendar';
15
13
  import { createLocalizationProvider } from '@atlaskit/locale';
16
14
  import { fg } from '@atlaskit/platform-feature-flags';
17
- import { Box, xcss } from '@atlaskit/primitives';
15
+ import { Box } from '@atlaskit/primitives/compiled';
18
16
  import Select, { mergeStyles } from '@atlaskit/select';
19
17
  import { EmptyComponent } from '../internal';
20
18
  import { formatDate, getParsedISO, getPlaceholder, isDateDisabled, parseDate } from '../internal/date-picker-migration';
@@ -23,42 +21,19 @@ import { Menu } from '../internal/menu';
23
21
  import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
24
22
  import { makeSingleValue } from '../internal/single-value';
25
23
  const packageName = "@atlaskit/datetime-picker";
26
- const packageVersion = "16.2.3";
24
+ const packageVersion = "17.0.0";
25
+ const styles = {
26
+ pickerContainerStyle: "_kqswh2mm",
27
+ dropdownIndicatorStyles: "_1ul91k8s _1tke1k8s _1e0c1txw _4cvr1h6o _1bah1h6o",
28
+ iconContainerStyles: "_v564vrg3 _1e0c1txw _4t3i1osq _kqswstnw _4cvr1h6o _i0dl1kw7 _syaz131l _152tze3t _rjxpze3t _30l31gjq",
29
+ iconSpacingWithClearButtonStyles: "_12l2xy5q",
30
+ iconSpacingWithoutClearButtonStyles: "_12l21b66"
31
+ };
27
32
  const analyticsAttributes = {
28
33
  componentName: 'datePicker',
29
34
  packageName,
30
35
  packageVersion
31
36
  };
32
- const pickerContainerStyles = css({
33
- position: 'relative'
34
- });
35
- const dropdownIndicatorStyles = xcss({
36
- minWidth: "var(--ds-space-300, 24px)",
37
- minHeight: "var(--ds-space-300, 24px)",
38
- display: 'flex',
39
- alignItems: 'center',
40
- justifyContent: 'center'
41
- });
42
- const iconContainerStyles = xcss({
43
- display: 'flex',
44
- height: '100%',
45
- position: 'absolute',
46
- alignItems: 'center',
47
- flexBasis: 'inherit',
48
- color: 'color.text.subtlest',
49
- insetBlockStart: 'space.0',
50
- insetInlineEnd: 'space.0',
51
- transition: `color 150ms`,
52
- ':hover': {
53
- color: 'color.text.subtle'
54
- }
55
- });
56
- const iconSpacingWithClearButtonStyles = xcss({
57
- marginInlineEnd: 'space.400'
58
- });
59
- const iconSpacingWithoutClearButtonStyles = xcss({
60
- marginInlineEnd: 'space.050'
61
- });
62
37
 
63
38
  /**
64
39
  * __Date picker__
@@ -392,9 +367,9 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
392
367
 
393
368
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning, @atlaskit/platform/ensure-feature-flag-prefix
394
369
  if (fg('platform-visual-refresh-icons')) {
395
- clearIndicator = props => jsx(Box, {
396
- xcss: dropdownIndicatorStyles
397
- }, jsx(Icon, props));
370
+ clearIndicator = props => /*#__PURE__*/React.createElement(Box, {
371
+ xcss: styles.dropdownIndicatorStyles
372
+ }, /*#__PURE__*/React.createElement(Icon, props));
398
373
  }
399
374
  const dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : clearIndicator;
400
375
  const SingleValue = makeSingleValue({
@@ -405,7 +380,7 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
405
380
  // Only use this new container component if the calendar button is shown.
406
381
  // Otherwise, it throws errors downstream for some reason
407
382
  ...(shouldShowCalendarButton ? {
408
- IndicatorsContainer: props => jsx(IndicatorsContainer, _extends({}, props, {
383
+ IndicatorsContainer: props => /*#__PURE__*/React.createElement(IndicatorsContainer, _extends({}, props, {
409
384
  showClearIndicator: showClearIndicator
410
385
  }))
411
386
  } : {}),
@@ -468,102 +443,99 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
468
443
  // `label` takes precedence of the `inputLabel`
469
444
  const fullopenCalendarLabel = label || inputLabel ? `${label || inputLabel}, ${openCalendarLabel}` : openCalendarLabel;
470
445
  const openCalendarLabelId = `open-calendar-label--${useId()}`;
471
- return (
472
- // These event handlers must be on this element because the events come
473
- // from different child elements.
474
- // Until innerProps is removed, it must remain a div rather than a primitive component.
475
- jsx("div", _extends({}, innerProps, {
476
- css: pickerContainerStyles,
477
- "data-testid": testId && `${testId}--container`,
478
- onBlur: onContainerBlur,
479
- onFocus: onContainerFocus,
480
- onClick: onInputClick,
481
- onInput: onTextInput,
482
- onKeyDown: onInputKeyDown,
483
- ref: getContainerRef
484
- // Since the onclick, onfocus are passed down, adding role="presentation" prevents typecheck errors.
485
- ,
486
- role: "presentation"
487
- }), jsx("input", {
488
- name: name,
489
- type: "hidden",
490
- value: getterValue,
491
- "data-testid": testId && `${testId}--input`
492
- }), jsx(Select, _extends({
493
- appearance: appearance,
494
- "aria-describedby": ariaDescribedBy,
495
- label: label || undefined,
496
- autoFocus: autoFocus,
497
- clearControlLabel: clearControlLabel,
498
- closeMenuOnSelect: true
499
- // For some reason, this and the below `styles` type error _only_ show
500
- // up when you alter some of the properties in the `selectComponents`
501
- // object. These errors are still present, and I suspect have always
502
- // been present, without changing the unrelated code. Ignoring as the
503
- // component still works as expected despite this error. And also
504
- // because the select refresh team may solve it later.
505
- ,
506
- components: selectComponents,
507
- enableAnimation: false,
508
- inputId: id,
509
- inputValue: actualSelectInputValue,
510
- isDisabled: isDisabled,
511
- isRequired: isRequired,
512
- menuIsOpen: menuIsOpen,
513
- onBlur: onSelectBlur,
514
- onChange: onSelectChange,
515
- onFocus: onSelectFocus,
516
- onInputChange: handleSelectInputChange,
517
- placeholder: getPlaceholder({
518
- placeholder: placeholder,
519
- l10n: l10n
520
- })
521
- // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
522
- ,
523
- styles: mergedStyles,
524
- value: initialValue
525
- }, selectProps, {
526
- // These are below the spread because I don't know what is in
527
- // selectProps or not and what wil be overwritten
528
- isClearable: true,
529
- isInvalid: isInvalid,
530
- spacing: spacing,
531
- testId: testId
532
- // These aren't part of `Select`'s API, but we're using them here.
533
- // @ts-ignore -- Property 'calendarContainerRef' does not exist on type 'IntrinsicAttributes & LibraryManagedAttributes<(<Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & { ...; }) => Element), AtlaskitSelectProps<...> & { ...; }>'.
534
- ,
535
- calendarContainerRef: calendarProps.calendarContainerRef,
536
- calendarDisabled: calendarProps.calendarDisabled,
537
- calendarDisabledDateFilter: calendarProps.calendarDisabledDateFilter,
538
- calendarLocale: calendarProps.calendarLocale,
539
- calendarMaxDate: calendarProps.calendarMaxDate,
540
- calendarMinDate: calendarProps.calendarMinDate,
541
- calendarRef: calendarProps.calendarRef,
542
- calendarValue: calendarProps.calendarValue,
543
- calendarView: calendarProps.calendarView,
544
- calendarWeekStartDay: calendarProps.calendarWeekStartDay,
545
- nextMonthLabel: nextMonthLabel,
546
- onCalendarChange: calendarProps.onCalendarChange,
547
- onCalendarSelect: calendarProps.onCalendarSelect,
548
- previousMonthLabel: previousMonthLabel,
549
- shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay,
550
- menuInnerWrapper: calendarProps.menuInnerWrapper
551
- })), shouldShowCalendarButton && !isDisabled ? jsx(Box, {
552
- xcss: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : iconSpacingWithoutClearButtonStyles]
553
- }, jsx(IconButton, {
554
- appearance: "subtle",
555
- label: !inputLabelId ? fullopenCalendarLabel : openCalendarLabel,
556
- "aria-labelledby": inputLabelId ? `${inputLabelId} ${openCalendarLabelId}` : undefined,
557
- id: openCalendarLabelId,
558
- icon: iconProps => jsx(CalendarIcon, _extends({}, iconProps, {
559
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
560
- color: "var(--ds-icon, #44546F)"
561
- })),
562
- onClick: onCalendarButtonClick,
563
- onKeyDown: onCalendarButtonKeyDown,
564
- ref: calendarButtonRef,
565
- testId: testId && `${testId}--open-calendar-button`
566
- })) : null)
567
- );
446
+ return /*#__PURE__*/React.createElement("div", _extends({}, innerProps, {
447
+ "data-testid": testId && `${testId}--container`,
448
+ onBlur: onContainerBlur,
449
+ onFocus: onContainerFocus,
450
+ onClick: onInputClick,
451
+ onInput: onTextInput,
452
+ onKeyDown: onInputKeyDown,
453
+ ref: getContainerRef
454
+ // Since the onclick, onfocus are passed down, adding role="presentation" prevents typecheck errors.
455
+ ,
456
+ role: "presentation",
457
+ className: ax([styles.pickerContainerStyle])
458
+ }), /*#__PURE__*/React.createElement("input", {
459
+ name: name,
460
+ type: "hidden",
461
+ value: getterValue,
462
+ "data-testid": testId && `${testId}--input`
463
+ }), /*#__PURE__*/React.createElement(Select, _extends({
464
+ appearance: appearance,
465
+ "aria-describedby": ariaDescribedBy,
466
+ label: label || undefined
467
+ // eslint-disable-next-line jsx-a11y/no-autofocus
468
+ ,
469
+ autoFocus: autoFocus,
470
+ clearControlLabel: clearControlLabel,
471
+ closeMenuOnSelect: true
472
+ // For some reason, this and the below `styles` type error _only_ show
473
+ // up when you alter some of the properties in the `selectComponents`
474
+ // object. These errors are still present, and I suspect have always
475
+ // been present, without changing the unrelated code. Ignoring as the
476
+ // component still works as expected despite this error. And also
477
+ // because the select refresh team may solve it later.
478
+ ,
479
+ components: selectComponents,
480
+ enableAnimation: false,
481
+ inputId: id,
482
+ inputValue: actualSelectInputValue,
483
+ isDisabled: isDisabled,
484
+ isRequired: isRequired,
485
+ menuIsOpen: menuIsOpen,
486
+ onBlur: onSelectBlur,
487
+ onChange: onSelectChange,
488
+ onFocus: onSelectFocus,
489
+ onInputChange: handleSelectInputChange,
490
+ placeholder: getPlaceholder({
491
+ placeholder: placeholder,
492
+ l10n: l10n
493
+ })
494
+ // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
495
+ ,
496
+ styles: mergedStyles,
497
+ value: initialValue
498
+ }, selectProps, {
499
+ // These are below the spread because I don't know what is in
500
+ // selectProps or not and what wil be overwritten
501
+ isClearable: true,
502
+ isInvalid: isInvalid,
503
+ spacing: spacing,
504
+ testId: testId
505
+ // These aren't part of `Select`'s API, but we're using them here.
506
+ // @ts-ignore -- Property 'calendarContainerRef' does not exist on type 'IntrinsicAttributes & LibraryManagedAttributes<(<Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & { ...; }) => Element), AtlaskitSelectProps<...> & { ...; }>'.
507
+ ,
508
+ calendarContainerRef: calendarProps.calendarContainerRef,
509
+ calendarDisabled: calendarProps.calendarDisabled,
510
+ calendarDisabledDateFilter: calendarProps.calendarDisabledDateFilter,
511
+ calendarLocale: calendarProps.calendarLocale,
512
+ calendarMaxDate: calendarProps.calendarMaxDate,
513
+ calendarMinDate: calendarProps.calendarMinDate,
514
+ calendarRef: calendarProps.calendarRef,
515
+ calendarValue: calendarProps.calendarValue,
516
+ calendarView: calendarProps.calendarView,
517
+ calendarWeekStartDay: calendarProps.calendarWeekStartDay,
518
+ nextMonthLabel: nextMonthLabel,
519
+ onCalendarChange: calendarProps.onCalendarChange,
520
+ onCalendarSelect: calendarProps.onCalendarSelect,
521
+ previousMonthLabel: previousMonthLabel,
522
+ shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay,
523
+ menuInnerWrapper: calendarProps.menuInnerWrapper
524
+ })), shouldShowCalendarButton && !isDisabled ? /*#__PURE__*/React.createElement(Box, {
525
+ xcss: cx(styles.iconContainerStyles, value && !hideIcon ? styles.iconSpacingWithClearButtonStyles : styles.iconSpacingWithoutClearButtonStyles)
526
+ }, /*#__PURE__*/React.createElement(IconButton, {
527
+ appearance: "subtle",
528
+ label: !inputLabelId ? fullopenCalendarLabel : openCalendarLabel,
529
+ "aria-labelledby": inputLabelId ? `${inputLabelId} ${openCalendarLabelId}` : undefined,
530
+ id: openCalendarLabelId,
531
+ icon: iconProps => /*#__PURE__*/React.createElement(CalendarIcon, _extends({}, iconProps, {
532
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
533
+ color: "var(--ds-icon, #44546F)"
534
+ })),
535
+ onClick: onCalendarButtonClick,
536
+ onKeyDown: onCalendarButtonKeyDown,
537
+ ref: calendarButtonRef,
538
+ testId: testId && `${testId}--open-calendar-button`
539
+ })) : null);
568
540
  });
569
541
  export default DatePicker;