@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.
- package/CHANGELOG.md +27 -0
- package/dist/cjs/components/date-picker-class.compiled.css +16 -0
- package/dist/cjs/components/date-picker-class.js +122 -146
- package/dist/cjs/components/date-picker-fc.compiled.css +16 -0
- package/dist/cjs/components/date-picker-fc.js +117 -144
- package/dist/cjs/components/date-time-picker-class.compiled.css +19 -0
- package/dist/cjs/components/date-time-picker-class.js +22 -47
- package/dist/cjs/components/date-time-picker-fc.compiled.css +6 -0
- package/dist/cjs/components/date-time-picker-fc.js +22 -27
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/cjs/internal/date-time-picker-container.compiled.css +21 -0
- package/dist/cjs/internal/date-time-picker-container.js +26 -71
- package/dist/cjs/internal/ff-component.js +0 -2
- package/dist/cjs/internal/fixed-layer-menu.js +8 -8
- package/dist/cjs/internal/fixed-layer.compiled.css +4 -0
- package/dist/cjs/internal/fixed-layer.js +14 -13
- package/dist/cjs/internal/indicators-container.compiled.css +2 -0
- package/dist/cjs/internal/indicators-container.js +14 -15
- package/dist/cjs/internal/menu.compiled.css +6 -0
- package/dist/cjs/internal/menu.js +15 -32
- package/dist/es2019/components/date-picker-class.compiled.css +16 -0
- package/dist/es2019/components/date-picker-class.js +117 -143
- package/dist/es2019/components/date-picker-fc.compiled.css +16 -0
- package/dist/es2019/components/date-picker-fc.js +114 -141
- package/dist/es2019/components/date-time-picker-class.compiled.css +19 -0
- package/dist/es2019/components/date-time-picker-class.js +21 -49
- package/dist/es2019/components/date-time-picker-fc.compiled.css +6 -0
- package/dist/es2019/components/date-time-picker-fc.js +19 -24
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/es2019/internal/date-time-picker-container.compiled.css +21 -0
- package/dist/es2019/internal/date-time-picker-container.js +18 -69
- package/dist/es2019/internal/ff-component.js +0 -2
- package/dist/es2019/internal/fixed-layer-menu.js +5 -8
- package/dist/es2019/internal/fixed-layer.compiled.css +4 -0
- package/dist/es2019/internal/fixed-layer.js +13 -12
- package/dist/es2019/internal/indicators-container.compiled.css +2 -0
- package/dist/es2019/internal/indicators-container.js +11 -16
- package/dist/es2019/internal/menu.compiled.css +6 -0
- package/dist/es2019/internal/menu.js +11 -30
- package/dist/esm/components/date-picker-class.compiled.css +16 -0
- package/dist/esm/components/date-picker-class.js +120 -147
- package/dist/esm/components/date-picker-fc.compiled.css +16 -0
- package/dist/esm/components/date-picker-fc.js +116 -144
- package/dist/esm/components/date-time-picker-class.compiled.css +19 -0
- package/dist/esm/components/date-time-picker-class.js +21 -49
- package/dist/esm/components/date-time-picker-fc.compiled.css +6 -0
- package/dist/esm/components/date-time-picker-fc.js +19 -24
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/esm/internal/date-time-picker-container.compiled.css +21 -0
- package/dist/esm/internal/date-time-picker-container.js +22 -69
- package/dist/esm/internal/ff-component.js +0 -2
- package/dist/esm/internal/fixed-layer-menu.js +5 -8
- package/dist/esm/internal/fixed-layer.compiled.css +4 -0
- package/dist/esm/internal/fixed-layer.js +13 -13
- package/dist/esm/internal/indicators-container.compiled.css +2 -0
- package/dist/esm/internal/indicators-container.js +11 -16
- package/dist/esm/internal/menu.compiled.css +6 -0
- package/dist/esm/internal/menu.js +11 -30
- package/dist/types/components/date-picker-class.d.ts +2 -3
- package/dist/types/components/date-picker.d.ts +1 -1
- package/dist/types/components/date-time-picker-class.d.ts +4 -5
- package/dist/types/components/date-time-picker.d.ts +3 -3
- package/dist/types/internal/date-time-picker-container.d.ts +4 -0
- package/dist/types/internal/fixed-layer-menu.d.ts +2 -6
- package/dist/types/internal/fixed-layer.d.ts +5 -1
- package/dist/types/internal/indicators-container.d.ts +2 -2
- package/dist/types/internal/menu.d.ts +6 -2
- package/dist/types-ts4.5/components/date-picker-class.d.ts +2 -3
- package/dist/types-ts4.5/components/date-picker.d.ts +1 -1
- package/dist/types-ts4.5/components/date-time-picker-class.d.ts +4 -5
- package/dist/types-ts4.5/components/date-time-picker.d.ts +3 -3
- package/dist/types-ts4.5/internal/date-time-picker-container.d.ts +4 -0
- package/dist/types-ts4.5/internal/fixed-layer-menu.d.ts +2 -6
- package/dist/types-ts4.5/internal/fixed-layer.d.ts +5 -1
- package/dist/types-ts4.5/internal/indicators-container.d.ts +2 -2
- package/dist/types-ts4.5/internal/menu.d.ts +6 -2
- package/package.json +12 -12
|
@@ -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
|
-
*
|
|
4
|
-
|
|
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
|
|
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 = "
|
|
24
|
+
const packageVersion = "17.0.1";
|
|
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__
|
|
@@ -390,22 +365,23 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
390
365
|
const showClearIndicator = Boolean((getterValue || selectInputValue) && !hideIcon);
|
|
391
366
|
let clearIndicator = Icon;
|
|
392
367
|
|
|
393
|
-
// eslint-disable-next-line @atlaskit/platform/
|
|
368
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
394
369
|
if (fg('platform-visual-refresh-icons')) {
|
|
395
|
-
clearIndicator = props =>
|
|
396
|
-
xcss: dropdownIndicatorStyles
|
|
397
|
-
},
|
|
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({
|
|
401
376
|
lang: propLocale
|
|
402
377
|
});
|
|
403
378
|
const selectComponents = {
|
|
379
|
+
...selectProps.components,
|
|
404
380
|
DropdownIndicator: shouldShowCalendarButton ? EmptyComponent : dropDownIcon,
|
|
405
381
|
// Only use this new container component if the calendar button is shown.
|
|
406
382
|
// Otherwise, it throws errors downstream for some reason
|
|
407
383
|
...(shouldShowCalendarButton ? {
|
|
408
|
-
IndicatorsContainer: props =>
|
|
384
|
+
IndicatorsContainer: props => /*#__PURE__*/React.createElement(IndicatorsContainer, _extends({}, props, {
|
|
409
385
|
showClearIndicator: showClearIndicator
|
|
410
386
|
}))
|
|
411
387
|
} : {}),
|
|
@@ -468,102 +444,99 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
468
444
|
// `label` takes precedence of the `inputLabel`
|
|
469
445
|
const fullopenCalendarLabel = label || inputLabel ? `${label || inputLabel}, ${openCalendarLabel}` : openCalendarLabel;
|
|
470
446
|
const openCalendarLabelId = `open-calendar-label--${useId()}`;
|
|
471
|
-
return (
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
testId: testId && `${testId}--open-calendar-button`
|
|
566
|
-
})) : null)
|
|
567
|
-
);
|
|
447
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, innerProps, {
|
|
448
|
+
"data-testid": testId && `${testId}--container`,
|
|
449
|
+
onBlur: onContainerBlur,
|
|
450
|
+
onFocus: onContainerFocus,
|
|
451
|
+
onClick: onInputClick,
|
|
452
|
+
onInput: onTextInput,
|
|
453
|
+
onKeyDown: onInputKeyDown,
|
|
454
|
+
ref: getContainerRef
|
|
455
|
+
// Since the onclick, onfocus are passed down, adding role="presentation" prevents typecheck errors.
|
|
456
|
+
,
|
|
457
|
+
role: "presentation",
|
|
458
|
+
className: ax([styles.pickerContainerStyle])
|
|
459
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
460
|
+
name: name,
|
|
461
|
+
type: "hidden",
|
|
462
|
+
value: getterValue,
|
|
463
|
+
"data-testid": testId && `${testId}--input`
|
|
464
|
+
}), /*#__PURE__*/React.createElement(Select, _extends({
|
|
465
|
+
appearance: appearance,
|
|
466
|
+
"aria-describedby": ariaDescribedBy,
|
|
467
|
+
label: label || undefined
|
|
468
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
469
|
+
,
|
|
470
|
+
autoFocus: autoFocus,
|
|
471
|
+
clearControlLabel: clearControlLabel,
|
|
472
|
+
closeMenuOnSelect: true,
|
|
473
|
+
enableAnimation: false,
|
|
474
|
+
inputId: id,
|
|
475
|
+
inputValue: actualSelectInputValue,
|
|
476
|
+
isDisabled: isDisabled,
|
|
477
|
+
isRequired: isRequired,
|
|
478
|
+
menuIsOpen: menuIsOpen,
|
|
479
|
+
onBlur: onSelectBlur,
|
|
480
|
+
onChange: onSelectChange,
|
|
481
|
+
onFocus: onSelectFocus,
|
|
482
|
+
onInputChange: handleSelectInputChange,
|
|
483
|
+
placeholder: getPlaceholder({
|
|
484
|
+
placeholder: placeholder,
|
|
485
|
+
l10n: l10n
|
|
486
|
+
})
|
|
487
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
488
|
+
// @ts-ignore -- Type 'OptionType' is not assignable to type '{ label: string; value: string; }'
|
|
489
|
+
,
|
|
490
|
+
styles: mergedStyles,
|
|
491
|
+
value: initialValue
|
|
492
|
+
}, selectProps, {
|
|
493
|
+
// For some reason, this and the below `styles` type error _only_ show
|
|
494
|
+
// up when you alter some of the properties in the `selectComponents`
|
|
495
|
+
// object. These errors are still present, and I suspect have always
|
|
496
|
+
// been present, without changing the unrelated code. Ignoring as the
|
|
497
|
+
// component still works as expected despite this error. And also
|
|
498
|
+
// because the select refresh team may solve it later.
|
|
499
|
+
components: selectComponents
|
|
500
|
+
// These are below the spread because I don't know what is in
|
|
501
|
+
// selectProps or not and what wil be overwritten
|
|
502
|
+
,
|
|
503
|
+
isClearable: true,
|
|
504
|
+
isInvalid: isInvalid,
|
|
505
|
+
spacing: spacing,
|
|
506
|
+
testId: testId
|
|
507
|
+
// These aren't part of `Select`'s API, but we're using them here.
|
|
508
|
+
// @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<...> & { ...; }>'.
|
|
509
|
+
,
|
|
510
|
+
calendarContainerRef: calendarProps.calendarContainerRef,
|
|
511
|
+
calendarDisabled: calendarProps.calendarDisabled,
|
|
512
|
+
calendarDisabledDateFilter: calendarProps.calendarDisabledDateFilter,
|
|
513
|
+
calendarLocale: calendarProps.calendarLocale,
|
|
514
|
+
calendarMaxDate: calendarProps.calendarMaxDate,
|
|
515
|
+
calendarMinDate: calendarProps.calendarMinDate,
|
|
516
|
+
calendarRef: calendarProps.calendarRef,
|
|
517
|
+
calendarValue: calendarProps.calendarValue,
|
|
518
|
+
calendarView: calendarProps.calendarView,
|
|
519
|
+
calendarWeekStartDay: calendarProps.calendarWeekStartDay,
|
|
520
|
+
nextMonthLabel: nextMonthLabel,
|
|
521
|
+
onCalendarChange: calendarProps.onCalendarChange,
|
|
522
|
+
onCalendarSelect: calendarProps.onCalendarSelect,
|
|
523
|
+
previousMonthLabel: previousMonthLabel,
|
|
524
|
+
shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay,
|
|
525
|
+
menuInnerWrapper: calendarProps.menuInnerWrapper
|
|
526
|
+
})), shouldShowCalendarButton && !isDisabled ? /*#__PURE__*/React.createElement(Box, {
|
|
527
|
+
xcss: cx(styles.iconContainerStyles, value && !hideIcon ? styles.iconSpacingWithClearButtonStyles : styles.iconSpacingWithoutClearButtonStyles)
|
|
528
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
529
|
+
appearance: "subtle",
|
|
530
|
+
label: !inputLabelId ? fullopenCalendarLabel : openCalendarLabel,
|
|
531
|
+
"aria-labelledby": inputLabelId ? `${inputLabelId} ${openCalendarLabelId}` : undefined,
|
|
532
|
+
id: openCalendarLabelId,
|
|
533
|
+
icon: iconProps => /*#__PURE__*/React.createElement(CalendarIcon, _extends({}, iconProps, {
|
|
534
|
+
color: "var(--ds-icon, #44546F)"
|
|
535
|
+
})),
|
|
536
|
+
onClick: onCalendarButtonClick,
|
|
537
|
+
onKeyDown: onCalendarButtonKeyDown,
|
|
538
|
+
ref: calendarButtonRef,
|
|
539
|
+
testId: testId && `${testId}--open-calendar-button`
|
|
540
|
+
})) : null);
|
|
568
541
|
});
|
|
569
542
|
export default DatePicker;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
._19itglyw{border:none}
|
|
3
|
+
._v564vrg3{transition:color .15s}._12l2e4h9{margin-inline-end:var(--ds-border-width,1px)}
|
|
4
|
+
._16jlkb7n{flex-grow:1}
|
|
5
|
+
._1e0c1txw{display:flex}
|
|
6
|
+
._1o9zidpf{flex-shrink:0}
|
|
7
|
+
._1pfhe4h9{margin-block-start:var(--ds-border-width,1px)}
|
|
8
|
+
._1q5112x7{padding-block-start:var(--ds-space-075,6px)}
|
|
9
|
+
._4cvr1h6o{align-items:center}
|
|
10
|
+
._6rthe4h9{margin-block-end:var(--ds-border-width,1px)}
|
|
11
|
+
._85i512x7{padding-block-end:var(--ds-space-075,6px)}
|
|
12
|
+
._ahbqe4h9{margin-inline-start:var(--ds-border-width,1px)}
|
|
13
|
+
._bfhk1kw7{background-color:inherit}
|
|
14
|
+
._bozg1b66{padding-inline-start:var(--ds-space-050,4px)}
|
|
15
|
+
._i0dl1kw7{flex-basis:inherit}
|
|
16
|
+
._i0dl1ssb{flex-basis:50%}
|
|
17
|
+
._syaz131l{color:var(--ds-text-subtlest,#626f86)}
|
|
18
|
+
._y4tiu2gc{padding-inline-end:var(--ds-space-100,8px)}
|
|
19
|
+
._30l31gjq:hover{color:var(--ds-text-subtle,#44546f)}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
+
/* date-time-picker-class.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
3
|
+
import "./date-time-picker-class.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
5
|
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
6
|
import { format, isValid, parseISO } from 'date-fns';
|
|
11
7
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
8
|
import SelectClearIcon from '@atlaskit/icon/utility/migration/cross-circle--select-clear';
|
|
13
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
10
|
import { mergeStyles } from '@atlaskit/select';
|
|
15
|
-
import { N500, N70 } from '@atlaskit/theme/colors';
|
|
16
11
|
import { formatDateTimeZoneIntoIso } from '../internal';
|
|
17
12
|
import { DateTimePickerContainer } from '../internal/date-time-picker-container';
|
|
18
13
|
import { componentWithCondition } from '../internal/ff-component';
|
|
@@ -22,35 +17,12 @@ import DatePickerNew from './date-picker-fc';
|
|
|
22
17
|
import TimePicker from './time-picker';
|
|
23
18
|
const DatePicker = componentWithCondition(() => fg('dst-date-picker-use-functional-component'), DatePickerNew, DatePickerOld);
|
|
24
19
|
const packageName = "@atlaskit/datetime-picker";
|
|
25
|
-
const packageVersion = "
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
});
|
|
20
|
+
const packageVersion = "17.0.1";
|
|
21
|
+
const compiledStyles = {
|
|
22
|
+
datePickerContainerStyles: "_i0dl1ssb _16jlkb7n _1o9zidpf",
|
|
23
|
+
timePickerContainerStyles: "_i0dl1ssb _16jlkb7n",
|
|
24
|
+
iconContainerStyles: "_19itglyw _v564vrg3 _1e0c1txw _4cvr1h6o _i0dl1kw7 _bfhk1kw7 _syaz131l _6rthe4h9 _1pfhe4h9 _12l2e4h9 _ahbqe4h9 _85i512x7 _1q5112x7 _y4tiu2gc _bozg1b66 _30l31gjq"
|
|
25
|
+
};
|
|
54
26
|
|
|
55
27
|
// react-select overrides (via @atlaskit/select).
|
|
56
28
|
const styles = {
|
|
@@ -278,21 +250,21 @@ class DateTimePickerComponent extends React.Component {
|
|
|
278
250
|
// Render DateTimePicker's IconContainer when a value has been filled
|
|
279
251
|
// Don't use Date or TimePicker's because they can't be customised
|
|
280
252
|
const isClearable = Boolean(dateValue || timeValue);
|
|
281
|
-
return
|
|
253
|
+
return /*#__PURE__*/React.createElement(DateTimePickerContainer, {
|
|
282
254
|
appearance: appearance,
|
|
283
255
|
isDisabled: isDisabled,
|
|
284
256
|
isFocused: isFocused,
|
|
285
257
|
isInvalid: isInvalid,
|
|
286
258
|
testId: testId,
|
|
287
259
|
innerProps: innerProps
|
|
288
|
-
},
|
|
260
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
289
261
|
name: name,
|
|
290
262
|
type: "hidden",
|
|
291
263
|
value: value,
|
|
292
264
|
"data-testid": testId && `${testId}--input`
|
|
293
|
-
}),
|
|
294
|
-
|
|
295
|
-
},
|
|
265
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
266
|
+
className: ax([compiledStyles.datePickerContainerStyles])
|
|
267
|
+
}, /*#__PURE__*/React.createElement(DatePicker, {
|
|
296
268
|
appearance: appearance,
|
|
297
269
|
"aria-describedby": datePickerAriaDescribedBy,
|
|
298
270
|
autoFocus: datePickerProps.autoFocus || autoFocus,
|
|
@@ -328,9 +300,9 @@ class DateTimePickerComponent extends React.Component {
|
|
|
328
300
|
testId: testId && `${testId}--datepicker` || datePickerProps.testId,
|
|
329
301
|
value: dateValue,
|
|
330
302
|
weekStartDay: datePickerProps.weekStartDay
|
|
331
|
-
})),
|
|
332
|
-
|
|
333
|
-
},
|
|
303
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
304
|
+
className: ax([compiledStyles.timePickerContainerStyles])
|
|
305
|
+
}, /*#__PURE__*/React.createElement(TimePicker, {
|
|
334
306
|
appearance: timePickerProps.appearance || appearance,
|
|
335
307
|
"aria-describedby": timePickerAriaDescribedBy,
|
|
336
308
|
autoFocus: timePickerProps.autoFocus,
|
|
@@ -359,13 +331,13 @@ class DateTimePickerComponent extends React.Component {
|
|
|
359
331
|
timeIsEditable: timePickerProps.timeIsEditable,
|
|
360
332
|
times: timePickerProps.times,
|
|
361
333
|
value: timeValue
|
|
362
|
-
})), isClearable && !isDisabled ?
|
|
363
|
-
css: iconContainerStyles,
|
|
334
|
+
})), isClearable && !isDisabled ? /*#__PURE__*/React.createElement("button", {
|
|
364
335
|
onClick: this.onClear,
|
|
365
336
|
"data-testid": testId && `${testId}--icon--container`,
|
|
366
337
|
tabIndex: -1,
|
|
367
|
-
type: "button"
|
|
368
|
-
|
|
338
|
+
type: "button",
|
|
339
|
+
className: ax([compiledStyles.iconContainerStyles])
|
|
340
|
+
}, /*#__PURE__*/React.createElement(SelectClearIcon, {
|
|
369
341
|
LEGACY_size: "small",
|
|
370
342
|
color: "currentColor",
|
|
371
343
|
label: clearControlLabel
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
/* date-time-picker-fc.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./date-time-picker-fc.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
2
5
|
import React, { forwardRef, useCallback, useEffect, useState } from 'react';
|
|
3
6
|
import { format, isValid, parseISO } from 'date-fns';
|
|
4
7
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
5
8
|
import { IconButton } from '@atlaskit/button/new';
|
|
6
9
|
import SelectClearIcon from '@atlaskit/icon/utility/migration/cross-circle--select-clear';
|
|
7
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import { Box, Inline
|
|
11
|
+
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
9
12
|
import { mergeStyles } from '@atlaskit/select';
|
|
10
13
|
import { formatDateTimeZoneIntoIso } from '../internal';
|
|
11
14
|
import { DateTimePickerContainer } from '../internal/date-time-picker-container';
|
|
@@ -18,29 +21,17 @@ const DatePicker = componentWithCondition(
|
|
|
18
21
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
19
22
|
() => fg('dst-date-picker-use-functional-component'), DatePickerNew, DatePickerOld);
|
|
20
23
|
const packageName = "@atlaskit/datetime-picker";
|
|
21
|
-
const packageVersion = "
|
|
24
|
+
const packageVersion = "17.0.1";
|
|
22
25
|
const analyticsAttributes = {
|
|
23
26
|
componentName: 'dateTimePicker',
|
|
24
27
|
packageName,
|
|
25
28
|
packageVersion
|
|
26
29
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
flexGrow: 1,
|
|
33
|
-
flexShrink: 0
|
|
34
|
-
});
|
|
35
|
-
const timePickerContainerStyles = xcss({
|
|
36
|
-
flexBasis: '50%',
|
|
37
|
-
flexGrow: 1
|
|
38
|
-
});
|
|
39
|
-
const iconContainerStyles = xcss({
|
|
40
|
-
display: 'flex',
|
|
41
|
-
alignItems: 'center',
|
|
42
|
-
flexBasis: 'inherit'
|
|
43
|
-
});
|
|
30
|
+
const compiledStyles = {
|
|
31
|
+
datePickerContainerStyles: "_i0dl1ssb _16jlkb7n _1o9zidpf",
|
|
32
|
+
timePickerContainerStyles: "_i0dl1ssb _16jlkb7n",
|
|
33
|
+
iconContainerStyles: "_1e0c1txw _4cvr1h6o _i0dl1kw7"
|
|
34
|
+
};
|
|
44
35
|
|
|
45
36
|
// react-select overrides (via @atlaskit/select).
|
|
46
37
|
const styles = {
|
|
@@ -266,10 +257,12 @@ const DateTimePicker = /*#__PURE__*/forwardRef(({
|
|
|
266
257
|
value: value,
|
|
267
258
|
"data-testid": testId && `${testId}--input`
|
|
268
259
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
269
|
-
xcss: datePickerContainerStyles
|
|
260
|
+
xcss: compiledStyles.datePickerContainerStyles
|
|
270
261
|
}, /*#__PURE__*/React.createElement(DatePicker, {
|
|
271
262
|
appearance: appearance,
|
|
272
|
-
"aria-describedby": datePickerAriaDescribedBy
|
|
263
|
+
"aria-describedby": datePickerAriaDescribedBy
|
|
264
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
265
|
+
,
|
|
273
266
|
autoFocus: datePickerProps.autoFocus || autoFocus,
|
|
274
267
|
dateFormat: datePickerProps.dateFormat,
|
|
275
268
|
defaultIsOpen: datePickerProps.defaultIsOpen,
|
|
@@ -307,10 +300,12 @@ const DateTimePicker = /*#__PURE__*/forwardRef(({
|
|
|
307
300
|
value: dateValue,
|
|
308
301
|
weekStartDay: datePickerProps.weekStartDay
|
|
309
302
|
})), /*#__PURE__*/React.createElement(Box, {
|
|
310
|
-
xcss: timePickerContainerStyles
|
|
303
|
+
xcss: compiledStyles.timePickerContainerStyles
|
|
311
304
|
}, /*#__PURE__*/React.createElement(TimePicker, {
|
|
312
305
|
appearance: timePickerProps.appearance || appearance,
|
|
313
|
-
"aria-describedby": timePickerAriaDescribedBy
|
|
306
|
+
"aria-describedby": timePickerAriaDescribedBy
|
|
307
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
308
|
+
,
|
|
314
309
|
autoFocus: timePickerProps.autoFocus,
|
|
315
310
|
defaultIsOpen: timePickerProps.defaultIsOpen,
|
|
316
311
|
defaultValue: timePickerProps.defaultValue,
|
|
@@ -338,7 +333,7 @@ const DateTimePicker = /*#__PURE__*/forwardRef(({
|
|
|
338
333
|
times: timePickerProps.times,
|
|
339
334
|
value: timeValue
|
|
340
335
|
})), isClearable && !isDisabled ? /*#__PURE__*/React.createElement(Inline, {
|
|
341
|
-
xcss: iconContainerStyles
|
|
336
|
+
xcss: compiledStyles.iconContainerStyles
|
|
342
337
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
343
338
|
appearance: "subtle",
|
|
344
339
|
label: clearControlLabel,
|
|
@@ -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 = "
|
|
14
|
+
const packageVersion = "17.0.1";
|
|
15
15
|
const menuStyles = {
|
|
16
16
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
17
17
|
position: 'static',
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
._19it1k9g{border:var(--ds-border-width,1px) solid var(--ds-border-input,#8590a2)}
|
|
3
|
+
._2rkoglpi{border-radius:var(--ds-border-radius,4px)}
|
|
4
|
+
._v564r5cv{transition:background-color .2s ease-in-out,border-color .2s ease-in-out}
|
|
5
|
+
._1h6d13gt{border-color:var(--ds-border-disabled,#091e420f)}
|
|
6
|
+
._1h6d1bqt{border-color:var(--ds-border-danger,#e2483d)}
|
|
7
|
+
._1h6d1j28{border-color:transparent}
|
|
8
|
+
._1h6d1p6i{border-color:var(--ds-border-focused,#388bff)}._16qsq049{box-shadow:inset 0 0 0 var(--ds-border-width,1px) var(--ds-border-focused,#388bff)}
|
|
9
|
+
._1e0c1txw{display:flex}
|
|
10
|
+
._bfhk1j28{background-color:transparent}
|
|
11
|
+
._bfhk1j9a{background-color:var(--ds-background-input,#fff)}
|
|
12
|
+
._bfhk1y3p{background-color:var(--ds-background-input-pressed,transparent)}
|
|
13
|
+
._bfhkr01l{background-color:var(--ds-background-input-pressed,#fff)}
|
|
14
|
+
._bfhksyzs{background-color:var(--ds-background-disabled,#091e4208)}
|
|
15
|
+
._4cvx1bqt:hover{border-color:var(--ds-border-danger,#e2483d)}
|
|
16
|
+
._4cvx1elr:hover{border-color:var(--ds-border-input,#8590a2)}
|
|
17
|
+
._4cvx1j28:hover{border-color:transparent}
|
|
18
|
+
._d0al73ad:hover{cursor:default}
|
|
19
|
+
._d0altlke:hover{cursor:pointer}
|
|
20
|
+
._irr31d5g:hover{background-color:var(--ds-background-input-hovered,#f7f8f9)}
|
|
21
|
+
._irr31j28:hover{background-color:transparent}
|