@atlaskit/datetime-picker 16.2.3 → 17.0.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 (77) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/cjs/components/date-picker-class.compiled.css +16 -0
  3. package/dist/cjs/components/date-picker-class.js +122 -146
  4. package/dist/cjs/components/date-picker-fc.compiled.css +16 -0
  5. package/dist/cjs/components/date-picker-fc.js +117 -144
  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/ff-component.js +0 -2
  14. package/dist/cjs/internal/fixed-layer-menu.js +8 -8
  15. package/dist/cjs/internal/fixed-layer.compiled.css +4 -0
  16. package/dist/cjs/internal/fixed-layer.js +14 -13
  17. package/dist/cjs/internal/indicators-container.compiled.css +2 -0
  18. package/dist/cjs/internal/indicators-container.js +14 -15
  19. package/dist/cjs/internal/menu.compiled.css +6 -0
  20. package/dist/cjs/internal/menu.js +15 -32
  21. package/dist/es2019/components/date-picker-class.compiled.css +16 -0
  22. package/dist/es2019/components/date-picker-class.js +117 -143
  23. package/dist/es2019/components/date-picker-fc.compiled.css +16 -0
  24. package/dist/es2019/components/date-picker-fc.js +114 -141
  25. package/dist/es2019/components/date-time-picker-class.compiled.css +19 -0
  26. package/dist/es2019/components/date-time-picker-class.js +21 -49
  27. package/dist/es2019/components/date-time-picker-fc.compiled.css +6 -0
  28. package/dist/es2019/components/date-time-picker-fc.js +19 -24
  29. package/dist/es2019/components/time-picker.js +1 -1
  30. package/dist/es2019/internal/date-time-picker-container.compiled.css +21 -0
  31. package/dist/es2019/internal/date-time-picker-container.js +18 -69
  32. package/dist/es2019/internal/ff-component.js +0 -2
  33. package/dist/es2019/internal/fixed-layer-menu.js +5 -8
  34. package/dist/es2019/internal/fixed-layer.compiled.css +4 -0
  35. package/dist/es2019/internal/fixed-layer.js +13 -12
  36. package/dist/es2019/internal/indicators-container.compiled.css +2 -0
  37. package/dist/es2019/internal/indicators-container.js +11 -16
  38. package/dist/es2019/internal/menu.compiled.css +6 -0
  39. package/dist/es2019/internal/menu.js +11 -30
  40. package/dist/esm/components/date-picker-class.compiled.css +16 -0
  41. package/dist/esm/components/date-picker-class.js +120 -147
  42. package/dist/esm/components/date-picker-fc.compiled.css +16 -0
  43. package/dist/esm/components/date-picker-fc.js +116 -144
  44. package/dist/esm/components/date-time-picker-class.compiled.css +19 -0
  45. package/dist/esm/components/date-time-picker-class.js +21 -49
  46. package/dist/esm/components/date-time-picker-fc.compiled.css +6 -0
  47. package/dist/esm/components/date-time-picker-fc.js +19 -24
  48. package/dist/esm/components/time-picker.js +1 -1
  49. package/dist/esm/internal/date-time-picker-container.compiled.css +21 -0
  50. package/dist/esm/internal/date-time-picker-container.js +22 -69
  51. package/dist/esm/internal/ff-component.js +0 -2
  52. package/dist/esm/internal/fixed-layer-menu.js +5 -8
  53. package/dist/esm/internal/fixed-layer.compiled.css +4 -0
  54. package/dist/esm/internal/fixed-layer.js +13 -13
  55. package/dist/esm/internal/indicators-container.compiled.css +2 -0
  56. package/dist/esm/internal/indicators-container.js +11 -16
  57. package/dist/esm/internal/menu.compiled.css +6 -0
  58. package/dist/esm/internal/menu.js +11 -30
  59. package/dist/types/components/date-picker-class.d.ts +2 -3
  60. package/dist/types/components/date-picker.d.ts +1 -1
  61. package/dist/types/components/date-time-picker-class.d.ts +4 -5
  62. package/dist/types/components/date-time-picker.d.ts +3 -3
  63. package/dist/types/internal/date-time-picker-container.d.ts +4 -0
  64. package/dist/types/internal/fixed-layer-menu.d.ts +2 -6
  65. package/dist/types/internal/fixed-layer.d.ts +5 -1
  66. package/dist/types/internal/indicators-container.d.ts +2 -2
  67. package/dist/types/internal/menu.d.ts +6 -2
  68. package/dist/types-ts4.5/components/date-picker-class.d.ts +2 -3
  69. package/dist/types-ts4.5/components/date-picker.d.ts +1 -1
  70. package/dist/types-ts4.5/components/date-time-picker-class.d.ts +4 -5
  71. package/dist/types-ts4.5/components/date-time-picker.d.ts +3 -3
  72. package/dist/types-ts4.5/internal/date-time-picker-container.d.ts +4 -0
  73. package/dist/types-ts4.5/internal/fixed-layer-menu.d.ts +2 -6
  74. package/dist/types-ts4.5/internal/fixed-layer.d.ts +5 -1
  75. package/dist/types-ts4.5/internal/indicators-container.d.ts +2 -2
  76. package/dist/types-ts4.5/internal/menu.d.ts +6 -2
  77. package/package.json +12 -12
@@ -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.1";
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/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
  } : {}),
@@ -471,7 +446,8 @@ class DatePickerComponent extends Component {
471
446
  SingleValue,
472
447
  ...(!showClearIndicator && {
473
448
  ClearIndicator: EmptyComponent
474
- })
449
+ }),
450
+ ...selectProps.components
475
451
  };
476
452
  const {
477
453
  styles: selectStyles = {}
@@ -521,104 +497,102 @@ class DatePickerComponent extends Component {
521
497
 
522
498
  // `label` takes precedence of the `inputLabel`
523
499
  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
- );
500
+ return /*#__PURE__*/React.createElement("div", _extends({}, innerProps, {
501
+ // Since the onclick, onfocus are passed down, adding role="presentation" prevents typecheck errors.
502
+ role: "presentation",
503
+ onBlur: this.onContainerBlur,
504
+ onFocus: this.onContainerFocus,
505
+ onClick: this.onInputClick,
506
+ onInput: this.onTextInput,
507
+ onKeyDown: this.onInputKeyDown,
508
+ ref: this.getContainerRef,
509
+ "data-testid": testId && `${testId}--container`,
510
+ className: ax([styles.pickerContainerStyles])
511
+ }), /*#__PURE__*/React.createElement("input", {
512
+ name: name,
513
+ type: "hidden",
514
+ value: value,
515
+ "data-testid": testId && `${testId}--input`
516
+ }), /*#__PURE__*/React.createElement(Select, _extends({
517
+ appearance: this.props.appearance,
518
+ "aria-describedby": ariaDescribedBy,
519
+ label: label || undefined
520
+ // eslint-disable-next-line jsx-a11y/no-autofocus
521
+ ,
522
+ autoFocus: autoFocus,
523
+ clearControlLabel: clearControlLabel,
524
+ closeMenuOnSelect: true,
525
+ enableAnimation: false,
526
+ inputId: id,
527
+ inputValue: actualSelectInputValue,
528
+ isDisabled: isDisabled,
529
+ isRequired: isRequired,
530
+ menuIsOpen: menuIsOpen,
531
+ onBlur: this.onSelectBlur,
532
+ onChange: this.onSelectChange,
533
+ onFocus: this.onSelectFocus,
534
+ onInputChange: this.handleSelectInputChange,
535
+ placeholder: getPlaceholder({
536
+ placeholder: this.props.placeholder,
537
+ l10n: this.state.l10n
538
+ })
539
+ // @ts-ignore -- Argument of type 'StylesConfig<OptionType, false, GroupBase<OptionType>>' is not assignable to parameter of type 'StylesConfig<OptionType, boolean, GroupBase<OptionType>>'
540
+ ,
541
+ styles: mergedStyles,
542
+ value: initialValue
543
+ }, selectProps, {
544
+ // For some reason, this and the below `styles` type error _only_ show
545
+ // up when you alter some of the properties in the `selectComponents`
546
+ // object. These errors are still present, and I suspect have always
547
+ // been present, without changing the unrelated code. Ignoring as the
548
+ // component still works as expected despite this error. And also
549
+ // because the select refresh team may solve it later.
550
+ components: selectComponents
551
+ // These are below the spread because I don't know what is in
552
+ // selectProps or not and what wil be overwritten
553
+ ,
554
+ isClearable: true,
555
+ isInvalid: isInvalid,
556
+ spacing: spacing,
557
+ testId: testId
558
+ // These aren't part of `Select`'s API, but we're using them here.
559
+ // @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<...> & { ...; }>'.
560
+ ,
561
+ calendarContainerRef: calendarProps.calendarContainerRef,
562
+ calendarDisabled: calendarProps.calendarDisabled,
563
+ calendarDisabledDateFilter: calendarProps.calendarDisabledDateFilter,
564
+ calendarLocale: calendarProps.calendarLocale,
565
+ calendarMaxDate: calendarProps.calendarMaxDate,
566
+ calendarMinDate: calendarProps.calendarMinDate,
567
+ calendarRef: calendarProps.calendarRef,
568
+ calendarValue: calendarProps.calendarValue,
569
+ calendarView: calendarProps.calendarView,
570
+ calendarWeekStartDay: calendarProps.calendarWeekStartDay,
571
+ nextMonthLabel: nextMonthLabel,
572
+ onCalendarChange: calendarProps.onCalendarChange,
573
+ onCalendarSelect: calendarProps.onCalendarSelect,
574
+ previousMonthLabel: previousMonthLabel,
575
+ shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay,
576
+ menuInnerWrapper: calendarProps.menuInnerWrapper
577
+ })), shouldShowCalendarButton && !isDisabled ? /*#__PURE__*/React.createElement(IdProvider, {
578
+ prefix: "open-calendar-label--"
579
+ }, ({
580
+ id: openCalendarLabelId
581
+ }) => /*#__PURE__*/React.createElement(Box, {
582
+ xcss: cx(styles.iconContainerStyles, value && !hideIcon ? styles.iconSpacingWithClearButtonStyles : styles.iconSpacingWithoutClearButtonStyles)
583
+ }, /*#__PURE__*/React.createElement(IconButton, {
584
+ appearance: "subtle",
585
+ label: !inputLabelId ? fullopenCalendarLabel : openCalendarLabel,
586
+ "aria-labelledby": inputLabelId ? `${inputLabelId} ${openCalendarLabelId}` : undefined,
587
+ id: openCalendarLabelId,
588
+ icon: iconProps => /*#__PURE__*/React.createElement(CalendarIcon, _extends({}, iconProps, {
589
+ color: "var(--ds-icon, #44546F)"
590
+ })),
591
+ onClick: this.onCalendarButtonClick,
592
+ onKeyDown: this.onCalendarButtonKeyDown,
593
+ ref: this.calendarButtonRef,
594
+ testId: testId && `${testId}--open-calendar-button`
595
+ }))) : null);
622
596
  }
623
597
  }
624
598
  _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)}