baseui 0.0.0-next-54f08cc → 0.0.0-next-bb97580
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/card/styled-components.js +0 -1
- package/card/styled-components.js.flow +0 -1
- package/datepicker/calendar-header.js +29 -15
- package/datepicker/calendar-header.js.flow +13 -7
- package/datepicker/calendar.js +6 -1
- package/datepicker/calendar.js.flow +5 -1
- package/datepicker/constants.js +7 -2
- package/datepicker/constants.js.flow +5 -0
- package/datepicker/day.js +1 -0
- package/datepicker/day.js.flow +1 -0
- package/datepicker/month.js +4 -0
- package/datepicker/month.js.flow +3 -0
- package/datepicker/styled-components.js +73 -42
- package/datepicker/styled-components.js.flow +76 -35
- package/datepicker/types.js.flow +8 -1
- package/datepicker/utils/date-helpers.js +1 -1
- package/datepicker/utils/date-helpers.js.flow +1 -1
- package/datepicker/week.js +1 -0
- package/datepicker/week.js.flow +1 -0
- package/es/card/styled-components.js +0 -1
- package/es/datepicker/calendar-header.js +21 -10
- package/es/datepicker/calendar.js +7 -2
- package/es/datepicker/constants.js +5 -1
- package/es/datepicker/day.js +1 -0
- package/es/datepicker/month.js +3 -0
- package/es/datepicker/styled-components.js +68 -35
- package/es/datepicker/types.js +1 -1
- package/es/datepicker/utils/date-helpers.js +1 -1
- package/es/datepicker/week.js +1 -0
- package/es/timepicker/timepicker.js +16 -11
- package/esm/card/styled-components.js +0 -1
- package/esm/datepicker/calendar-header.js +30 -16
- package/esm/datepicker/calendar.js +7 -2
- package/esm/datepicker/constants.js +5 -1
- package/esm/datepicker/day.js +1 -0
- package/esm/datepicker/month.js +3 -0
- package/esm/datepicker/styled-components.js +74 -43
- package/esm/datepicker/types.js +1 -1
- package/esm/datepicker/utils/date-helpers.js +1 -1
- package/esm/datepicker/week.js +1 -0
- package/esm/timepicker/timepicker.js +17 -11
- package/package.json +1 -1
- package/timepicker/index.d.ts +1 -0
- package/timepicker/timepicker.js +17 -11
- package/timepicker/timepicker.js.flow +31 -12
- package/timepicker/types.js.flow +10 -0
|
@@ -98,7 +98,6 @@ var Title = (0, _index.styled)('h1', function (_ref7) {
|
|
|
98
98
|
var $theme = _ref7.$theme;
|
|
99
99
|
return _objectSpread(_objectSpread({}, $theme.typography.HeadingSmall), {}, {
|
|
100
100
|
color: $theme.colors.contentPrimary,
|
|
101
|
-
fontWeight: 500,
|
|
102
101
|
marginLeft: 0,
|
|
103
102
|
marginTop: 0,
|
|
104
103
|
marginRight: 0,
|
|
@@ -72,7 +72,6 @@ export const Thumbnail = styled<{}>('img', ({$theme}) => ({
|
|
|
72
72
|
export const Title = styled<{}>('h1', ({$theme}) => ({
|
|
73
73
|
...$theme.typography.HeadingSmall,
|
|
74
74
|
color: $theme.colors.contentPrimary,
|
|
75
|
-
fontWeight: 500,
|
|
76
75
|
marginLeft: 0,
|
|
77
76
|
marginTop: 0,
|
|
78
77
|
marginRight: 0,
|
|
@@ -292,8 +292,10 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
292
292
|
|
|
293
293
|
var date = _this.getDateProp();
|
|
294
294
|
|
|
295
|
-
var _this$
|
|
296
|
-
|
|
295
|
+
var _this$props3 = _this.props,
|
|
296
|
+
_this$props3$override = _this$props3.overrides,
|
|
297
|
+
overrides = _this$props3$override === void 0 ? {} : _this$props3$override,
|
|
298
|
+
density = _this$props3.density;
|
|
297
299
|
|
|
298
300
|
var allPrevDaysDisabled = _this.dateHelpers.monthDisabledBefore(date, _this.props);
|
|
299
301
|
|
|
@@ -343,7 +345,7 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
343
345
|
$disabled: isDisabled,
|
|
344
346
|
$order: _this.props.order
|
|
345
347
|
}, prevButtonProps), isHidden ? null : /*#__PURE__*/React.createElement(PrevButtonIcon, _extends({
|
|
346
|
-
size:
|
|
348
|
+
size: density === _constants.DENSITY.high ? 24 : 36,
|
|
347
349
|
overrides: {
|
|
348
350
|
Svg: {
|
|
349
351
|
style: navBtnStyle
|
|
@@ -358,8 +360,10 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
358
360
|
|
|
359
361
|
var date = _this.getDateProp();
|
|
360
362
|
|
|
361
|
-
var _this$
|
|
362
|
-
|
|
363
|
+
var _this$props4 = _this.props,
|
|
364
|
+
_this$props4$override = _this$props4.overrides,
|
|
365
|
+
overrides = _this$props4$override === void 0 ? {} : _this$props4$override,
|
|
366
|
+
density = _this$props4.density;
|
|
363
367
|
|
|
364
368
|
var allNextDaysDisabled = _this.dateHelpers.monthDisabledAfter(date, _this.props);
|
|
365
369
|
|
|
@@ -413,7 +417,7 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
413
417
|
$isFocusVisible: _this.state.isFocusVisible,
|
|
414
418
|
$order: _this.props.order
|
|
415
419
|
}, nextButtonProps), isHidden ? null : /*#__PURE__*/React.createElement(NextButtonIcon, _extends({
|
|
416
|
-
size:
|
|
420
|
+
size: density === _constants.DENSITY.high ? 24 : 36,
|
|
417
421
|
overrides: {
|
|
418
422
|
Svg: {
|
|
419
423
|
style: navBtnStyle
|
|
@@ -439,10 +443,11 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
439
443
|
|
|
440
444
|
var year = _this.dateHelpers.getYear(date);
|
|
441
445
|
|
|
442
|
-
var _this$
|
|
443
|
-
locale = _this$
|
|
444
|
-
_this$
|
|
445
|
-
overrides = _this$
|
|
446
|
+
var _this$props5 = _this.props,
|
|
447
|
+
locale = _this$props5.locale,
|
|
448
|
+
_this$props5$override = _this$props5.overrides,
|
|
449
|
+
overrides = _this$props5$override === void 0 ? {} : _this$props5$override,
|
|
450
|
+
density = _this$props5.density;
|
|
446
451
|
|
|
447
452
|
var _getOverrides9 = (0, _overrides.getOverrides)(overrides.MonthYearSelectButton, _styledComponents.StyledMonthYearSelectButton),
|
|
448
453
|
_getOverrides10 = _slicedToArray(_getOverrides9, 2),
|
|
@@ -540,6 +545,7 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
540
545
|
"aria-live": "polite",
|
|
541
546
|
type: "button",
|
|
542
547
|
$isFocusVisible: _this.state.isFocusVisible,
|
|
548
|
+
$density: density,
|
|
543
549
|
onKeyUp: function onKeyUp(event) {
|
|
544
550
|
if (_this.canArrowsOpenDropdown(event)) {
|
|
545
551
|
_this.setState({
|
|
@@ -567,7 +573,8 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
567
573
|
role: 'presentation'
|
|
568
574
|
}
|
|
569
575
|
}
|
|
570
|
-
}
|
|
576
|
+
},
|
|
577
|
+
size: density === _constants.DENSITY.high ? 16 : 24
|
|
571
578
|
})))), /*#__PURE__*/React.createElement(OverriddenPopover, _extends({
|
|
572
579
|
placement: "bottom",
|
|
573
580
|
focusLock: true,
|
|
@@ -621,6 +628,7 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
621
628
|
"aria-live": "polite",
|
|
622
629
|
type: "button",
|
|
623
630
|
$isFocusVisible: _this.state.isFocusVisible,
|
|
631
|
+
$density: density,
|
|
624
632
|
onKeyUp: function onKeyUp(event) {
|
|
625
633
|
if (_this.canArrowsOpenDropdown(event)) {
|
|
626
634
|
_this.setState({
|
|
@@ -648,7 +656,8 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
648
656
|
role: 'presentation'
|
|
649
657
|
}
|
|
650
658
|
}
|
|
651
|
-
}
|
|
659
|
+
},
|
|
660
|
+
size: density === _constants.DENSITY.high ? 16 : 24
|
|
652
661
|
})))));
|
|
653
662
|
});
|
|
654
663
|
|
|
@@ -685,8 +694,10 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
685
694
|
value: function render() {
|
|
686
695
|
var _this2 = this;
|
|
687
696
|
|
|
688
|
-
var _this$
|
|
689
|
-
|
|
697
|
+
var _this$props6 = this.props,
|
|
698
|
+
_this$props6$override = _this$props6.overrides,
|
|
699
|
+
overrides = _this$props6$override === void 0 ? {} : _this$props6$override,
|
|
700
|
+
density = _this$props6.density;
|
|
690
701
|
|
|
691
702
|
var _getOverrides17 = (0, _overrides.getOverrides)(overrides.CalendarHeader, _styledComponents.StyledCalendarHeader),
|
|
692
703
|
_getOverrides18 = _slicedToArray(_getOverrides17, 2),
|
|
@@ -707,6 +718,7 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
707
718
|
return /*#__PURE__*/React.createElement(_themeProvider.ThemeContext.Consumer, null, function (theme) {
|
|
708
719
|
return /*#__PURE__*/React.createElement(_index3.LocaleContext.Consumer, null, function (locale) {
|
|
709
720
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_CalendarHeader, _extends({}, calendarHeaderProps, {
|
|
721
|
+
$density: _this2.props.density,
|
|
710
722
|
onFocus: (0, _focusVisible.forkFocus)(calendarHeaderProps, _this2.handleFocus),
|
|
711
723
|
onBlur: (0, _focusVisible.forkBlur)(calendarHeaderProps, _this2.handleBlur)
|
|
712
724
|
}), _this2.renderPreviousMonthButton({
|
|
@@ -723,7 +735,9 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
723
735
|
return /*#__PURE__*/React.createElement(WeekdayHeader, _extends({
|
|
724
736
|
key: offset,
|
|
725
737
|
alt: _this2.dateHelpers.getWeekdayInLocale(day, _this2.props.locale)
|
|
726
|
-
}, weekdayHeaderProps
|
|
738
|
+
}, weekdayHeaderProps, {
|
|
739
|
+
$density: density
|
|
740
|
+
}), _this2.dateHelpers.getWeekdayMinInLocale(day, _this2.props.locale));
|
|
727
741
|
})));
|
|
728
742
|
});
|
|
729
743
|
});
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
StyledMonthYearSelectButton,
|
|
26
26
|
StyledMonthYearSelectIconContainer,
|
|
27
27
|
} from './styled-components.js';
|
|
28
|
-
import {ORIENTATION, WEEKDAYS} from './constants.js';
|
|
28
|
+
import {ORIENTATION, WEEKDAYS, DENSITY} from './constants.js';
|
|
29
29
|
import {getOverrides, mergeOverrides} from '../helpers/overrides.js';
|
|
30
30
|
import type {HeaderPropsT} from './types.js';
|
|
31
31
|
import type {LocaleT} from '../locale/types.js';
|
|
@@ -266,7 +266,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
266
266
|
theme: ThemeT,
|
|
267
267
|
}) => {
|
|
268
268
|
const date = this.getDateProp();
|
|
269
|
-
const {overrides = {}} = this.props;
|
|
269
|
+
const {overrides = {}, density} = this.props;
|
|
270
270
|
const allPrevDaysDisabled = this.dateHelpers.monthDisabledBefore(
|
|
271
271
|
date,
|
|
272
272
|
this.props,
|
|
@@ -315,7 +315,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
315
315
|
>
|
|
316
316
|
{isHidden ? null : (
|
|
317
317
|
<PrevButtonIcon
|
|
318
|
-
size={
|
|
318
|
+
size={density === DENSITY.high ? 24 : 36}
|
|
319
319
|
overrides={{Svg: {style: navBtnStyle}}}
|
|
320
320
|
{...prevButtonIconProps}
|
|
321
321
|
/>
|
|
@@ -332,7 +332,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
332
332
|
theme: ThemeT,
|
|
333
333
|
}) => {
|
|
334
334
|
const date = this.getDateProp();
|
|
335
|
-
const {overrides = {}} = this.props;
|
|
335
|
+
const {overrides = {}, density} = this.props;
|
|
336
336
|
const allNextDaysDisabled = this.dateHelpers.monthDisabledAfter(
|
|
337
337
|
date,
|
|
338
338
|
this.props,
|
|
@@ -388,7 +388,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
388
388
|
>
|
|
389
389
|
{isHidden ? null : (
|
|
390
390
|
<NextButtonIcon
|
|
391
|
-
size={
|
|
391
|
+
size={density === DENSITY.high ? 24 : 36}
|
|
392
392
|
overrides={{Svg: {style: navBtnStyle}}}
|
|
393
393
|
{...nextButtonIconProps}
|
|
394
394
|
/>
|
|
@@ -411,7 +411,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
411
411
|
const month = this.dateHelpers.getMonth(date);
|
|
412
412
|
const year = this.dateHelpers.getYear(date);
|
|
413
413
|
|
|
414
|
-
const {locale, overrides = {}} = this.props;
|
|
414
|
+
const {locale, overrides = {}, density} = this.props;
|
|
415
415
|
const [MonthYearSelectButton, monthYearSelectButtonProps] = getOverrides(
|
|
416
416
|
overrides.MonthYearSelectButton,
|
|
417
417
|
StyledMonthYearSelectButton,
|
|
@@ -496,6 +496,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
496
496
|
aria-live="polite"
|
|
497
497
|
type="button"
|
|
498
498
|
$isFocusVisible={this.state.isFocusVisible}
|
|
499
|
+
$density={density}
|
|
499
500
|
onKeyUp={event => {
|
|
500
501
|
if (this.canArrowsOpenDropdown(event)) {
|
|
501
502
|
this.setState({isMonthDropdownOpen: true});
|
|
@@ -520,6 +521,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
520
521
|
<ChevronDown
|
|
521
522
|
title=""
|
|
522
523
|
overrides={{Svg: {props: {role: 'presentation'}}}}
|
|
524
|
+
size={density === DENSITY.high ? 16 : 24}
|
|
523
525
|
/>
|
|
524
526
|
</MonthYearSelectIconContainer>
|
|
525
527
|
</MonthYearSelectButton>
|
|
@@ -564,6 +566,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
564
566
|
aria-live="polite"
|
|
565
567
|
type="button"
|
|
566
568
|
$isFocusVisible={this.state.isFocusVisible}
|
|
569
|
+
$density={density}
|
|
567
570
|
onKeyUp={event => {
|
|
568
571
|
if (this.canArrowsOpenDropdown(event)) {
|
|
569
572
|
this.setState({isYearDropdownOpen: true});
|
|
@@ -588,6 +591,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
588
591
|
<ChevronDown
|
|
589
592
|
title=""
|
|
590
593
|
overrides={{Svg: {props: {role: 'presentation'}}}}
|
|
594
|
+
size={density === DENSITY.high ? 16 : 24}
|
|
591
595
|
/>
|
|
592
596
|
</MonthYearSelectIconContainer>
|
|
593
597
|
</MonthYearSelectButton>
|
|
@@ -597,7 +601,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
597
601
|
};
|
|
598
602
|
|
|
599
603
|
render() {
|
|
600
|
-
const {overrides = {}} = this.props;
|
|
604
|
+
const {overrides = {}, density} = this.props;
|
|
601
605
|
const [CalendarHeader, calendarHeaderProps] = getOverrides(
|
|
602
606
|
overrides.CalendarHeader,
|
|
603
607
|
StyledCalendarHeader,
|
|
@@ -623,6 +627,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
623
627
|
<>
|
|
624
628
|
<CalendarHeader
|
|
625
629
|
{...calendarHeaderProps}
|
|
630
|
+
$density={this.props.density}
|
|
626
631
|
onFocus={forkFocus(calendarHeaderProps, this.handleFocus)}
|
|
627
632
|
onBlur={forkBlur(calendarHeaderProps, this.handleBlur)}
|
|
628
633
|
>
|
|
@@ -644,6 +649,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
644
649
|
this.props.locale,
|
|
645
650
|
)}
|
|
646
651
|
{...weekdayHeaderProps}
|
|
652
|
+
$density={density}
|
|
647
653
|
>
|
|
648
654
|
{this.dateHelpers.getWeekdayMinInLocale(
|
|
649
655
|
day,
|
package/datepicker/calendar.js
CHANGED
|
@@ -426,10 +426,13 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
426
426
|
"aria-roledescription": translations.ariaRoleDescCalMonth,
|
|
427
427
|
"aria-multiselectable": _this.props.range || null,
|
|
428
428
|
onKeyDown: _this.onKeyDown
|
|
429
|
-
}, calendarContainerProps
|
|
429
|
+
}, calendarContainerProps, {
|
|
430
|
+
$density: _this.props.density
|
|
431
|
+
}), /*#__PURE__*/React.createElement(_month.default, {
|
|
430
432
|
adapter: _this.props.adapter,
|
|
431
433
|
date: monthDate,
|
|
432
434
|
dateLabel: _this.props.dateLabel,
|
|
435
|
+
density: _this.props.density,
|
|
433
436
|
excludeDates: _this.props.excludeDates,
|
|
434
437
|
filterDate: _this.props.filterDate,
|
|
435
438
|
highlightedDate: _this.state.highlightedDate,
|
|
@@ -711,6 +714,7 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
711
714
|
|
|
712
715
|
return /*#__PURE__*/React.createElement(_index2.LocaleContext.Consumer, null, function (locale) {
|
|
713
716
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
|
717
|
+
$density: _this2.props.density,
|
|
714
718
|
"data-baseweb": "calendar",
|
|
715
719
|
role: "application",
|
|
716
720
|
"aria-roledescription": "datepicker",
|
|
@@ -742,6 +746,7 @@ exports.default = Calendar;
|
|
|
742
746
|
_defineProperty(Calendar, "defaultProps", {
|
|
743
747
|
autoFocusCalendar: false,
|
|
744
748
|
dateLabel: null,
|
|
749
|
+
density: _constants.DENSITY.default,
|
|
745
750
|
excludeDates: null,
|
|
746
751
|
filterDate: null,
|
|
747
752
|
highlightedDate: null,
|
|
@@ -23,7 +23,7 @@ import dateFnsAdapter from './utils/date-fns-adapter.js';
|
|
|
23
23
|
import DateHelpers from './utils/date-helpers.js';
|
|
24
24
|
import {getOverrides, mergeOverrides} from '../helpers/overrides.js';
|
|
25
25
|
import type {CalendarPropsT, CalendarInternalState} from './types.js';
|
|
26
|
-
import {ORIENTATION} from './constants.js';
|
|
26
|
+
import {DENSITY, ORIENTATION} from './constants.js';
|
|
27
27
|
|
|
28
28
|
export default class Calendar<T = Date> extends React.Component<
|
|
29
29
|
CalendarPropsT<T>,
|
|
@@ -32,6 +32,7 @@ export default class Calendar<T = Date> extends React.Component<
|
|
|
32
32
|
static defaultProps: {adapter: DateIOAdapter<Date>} = {
|
|
33
33
|
autoFocusCalendar: false,
|
|
34
34
|
dateLabel: null,
|
|
35
|
+
density: DENSITY.default,
|
|
35
36
|
excludeDates: null,
|
|
36
37
|
filterDate: null,
|
|
37
38
|
highlightedDate: null,
|
|
@@ -442,11 +443,13 @@ export default class Calendar<T = Date> extends React.Component<
|
|
|
442
443
|
aria-multiselectable={this.props.range || null}
|
|
443
444
|
onKeyDown={this.onKeyDown}
|
|
444
445
|
{...calendarContainerProps}
|
|
446
|
+
$density={this.props.density}
|
|
445
447
|
>
|
|
446
448
|
<Month
|
|
447
449
|
adapter={this.props.adapter}
|
|
448
450
|
date={monthDate}
|
|
449
451
|
dateLabel={this.props.dateLabel}
|
|
452
|
+
density={this.props.density}
|
|
450
453
|
excludeDates={this.props.excludeDates}
|
|
451
454
|
filterDate={this.props.filterDate}
|
|
452
455
|
highlightedDate={this.state.highlightedDate}
|
|
@@ -643,6 +646,7 @@ export default class Calendar<T = Date> extends React.Component<
|
|
|
643
646
|
<LocaleContext.Consumer>
|
|
644
647
|
{locale => (
|
|
645
648
|
<Root
|
|
649
|
+
$density={this.props.density}
|
|
646
650
|
data-baseweb="calendar"
|
|
647
651
|
role="application"
|
|
648
652
|
aria-roledescription="datepicker"
|
package/datepicker/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DEFAULT_MONTHS = exports.WEEKDAYS = exports.STATE_CHANGE_TYPE = exports.ORIENTATION = exports.ISO_MONTH_FORMAT = exports.ISO_FORMAT = exports.DISPLAY_FORMAT = void 0;
|
|
6
|
+
exports.DENSITY = exports.DEFAULT_MONTHS = exports.WEEKDAYS = exports.STATE_CHANGE_TYPE = exports.ORIENTATION = exports.ISO_MONTH_FORMAT = exports.ISO_FORMAT = exports.DISPLAY_FORMAT = void 0;
|
|
7
7
|
|
|
8
8
|
/*
|
|
9
9
|
Copyright (c) Uber Technologies, Inc.
|
|
@@ -35,4 +35,9 @@ exports.STATE_CHANGE_TYPE = STATE_CHANGE_TYPE;
|
|
|
35
35
|
var WEEKDAYS = [0, 1, 2, 3, 4, 5, 6];
|
|
36
36
|
exports.WEEKDAYS = WEEKDAYS;
|
|
37
37
|
var DEFAULT_MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
38
|
-
exports.DEFAULT_MONTHS = DEFAULT_MONTHS;
|
|
38
|
+
exports.DEFAULT_MONTHS = DEFAULT_MONTHS;
|
|
39
|
+
var DENSITY = {
|
|
40
|
+
high: 'high',
|
|
41
|
+
default: 'default'
|
|
42
|
+
};
|
|
43
|
+
exports.DENSITY = DENSITY;
|
|
@@ -28,6 +28,11 @@ export const WEEKDAYS = [0, 1, 2, 3, 4, 5, 6];
|
|
|
28
28
|
|
|
29
29
|
export const DEFAULT_MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
30
30
|
|
|
31
|
+
export const DENSITY = {
|
|
32
|
+
high: 'high',
|
|
33
|
+
default: 'default',
|
|
34
|
+
};
|
|
35
|
+
|
|
31
36
|
declare var __DEV__: boolean;
|
|
32
37
|
declare var __NODE__: boolean;
|
|
33
38
|
declare var __BROWSER__: boolean;
|
package/datepicker/day.js
CHANGED
|
@@ -345,6 +345,7 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
345
345
|
var $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !this.props.peekNextMonth && this.isOutsideOfMonthButWithinRange());
|
|
346
346
|
return {
|
|
347
347
|
$date: date,
|
|
348
|
+
$density: this.props.density,
|
|
348
349
|
$disabled: this.props.disabled,
|
|
349
350
|
$endDate: Array.isArray(value) && this.props.range && $selected && this.dateHelpers.isSameDay(date, value[1]) || false,
|
|
350
351
|
$hasDateLabel: !!this.props.dateLabel,
|
package/datepicker/day.js.flow
CHANGED
package/datepicker/month.js
CHANGED
|
@@ -19,6 +19,8 @@ var _dateHelpers = _interopRequireDefault(require("./utils/date-helpers.js"));
|
|
|
19
19
|
|
|
20
20
|
var _overrides = require("../helpers/overrides.js");
|
|
21
21
|
|
|
22
|
+
var _constants = require("./constants.js");
|
|
23
|
+
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
25
|
|
|
24
26
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
@@ -61,6 +63,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
61
63
|
|
|
62
64
|
var defaultProps = {
|
|
63
65
|
dateLabel: null,
|
|
66
|
+
density: _constants.DENSITY.high,
|
|
64
67
|
excludeDates: null,
|
|
65
68
|
filterDate: null,
|
|
66
69
|
highlightDates: null,
|
|
@@ -120,6 +123,7 @@ var CalendarMonth = /*#__PURE__*/function (_React$Component) {
|
|
|
120
123
|
adapter: _this.props.adapter,
|
|
121
124
|
date: currentWeekStart,
|
|
122
125
|
dateLabel: _this.props.dateLabel,
|
|
126
|
+
density: _this.props.density,
|
|
123
127
|
excludeDates: _this.props.excludeDates,
|
|
124
128
|
filterDate: _this.props.filterDate,
|
|
125
129
|
highlightedDate: _this.props.highlightedDate,
|
package/datepicker/month.js.flow
CHANGED
|
@@ -12,9 +12,11 @@ import dateFnsAdapter from './utils/date-fns-adapter.js';
|
|
|
12
12
|
import DateHelpers from './utils/date-helpers.js';
|
|
13
13
|
import {getOverrides} from '../helpers/overrides.js';
|
|
14
14
|
import type {MonthPropsT} from './types.js';
|
|
15
|
+
import {DENSITY} from './constants.js';
|
|
15
16
|
|
|
16
17
|
const defaultProps = {
|
|
17
18
|
dateLabel: null,
|
|
19
|
+
density: DENSITY.high,
|
|
18
20
|
excludeDates: null,
|
|
19
21
|
filterDate: null,
|
|
20
22
|
highlightDates: null,
|
|
@@ -81,6 +83,7 @@ export default class CalendarMonth<T = Date> extends React.Component<
|
|
|
81
83
|
adapter={this.props.adapter}
|
|
82
84
|
date={currentWeekStart}
|
|
83
85
|
dateLabel={this.props.dateLabel}
|
|
86
|
+
density={this.props.density}
|
|
84
87
|
excludeDates={this.props.excludeDates}
|
|
85
88
|
filterDate={this.props.filterDate}
|
|
86
89
|
highlightedDate={this.props.highlightedDate}
|
|
@@ -90,12 +90,13 @@ var StyledMonthContainer = (0, _index.styled)('div', function (props) {
|
|
|
90
90
|
exports.StyledMonthContainer = StyledMonthContainer;
|
|
91
91
|
StyledMonthContainer.displayName = "StyledMonthContainer";
|
|
92
92
|
var StyledCalendarContainer = (0, _index.styled)('div', function (props) {
|
|
93
|
-
var sizing = props.$theme.sizing
|
|
93
|
+
var sizing = props.$theme.sizing,
|
|
94
|
+
$density = props.$density;
|
|
94
95
|
return {
|
|
95
|
-
paddingTop: sizing.
|
|
96
|
-
paddingBottom: sizing.
|
|
97
|
-
paddingLeft: sizing.
|
|
98
|
-
paddingRight: sizing.
|
|
96
|
+
paddingTop: sizing.scale300,
|
|
97
|
+
paddingBottom: $density === _constants.DENSITY.high ? sizing.scale400 : sizing.scale300,
|
|
98
|
+
paddingLeft: sizing.scale500,
|
|
99
|
+
paddingRight: sizing.scale500
|
|
99
100
|
};
|
|
100
101
|
});
|
|
101
102
|
exports.StyledCalendarContainer = StyledCalendarContainer;
|
|
@@ -114,16 +115,18 @@ exports.StyledSelectorContainer = StyledSelectorContainer;
|
|
|
114
115
|
StyledSelectorContainer.displayName = "StyledSelectorContainer";
|
|
115
116
|
var StyledCalendarHeader = (0, _index.styled)('div', function (props) {
|
|
116
117
|
var _props$$theme2 = props.$theme,
|
|
118
|
+
typography = _props$$theme2.typography,
|
|
117
119
|
borders = _props$$theme2.borders,
|
|
118
120
|
colors = _props$$theme2.colors,
|
|
119
|
-
sizing = _props$$theme2.sizing
|
|
120
|
-
|
|
121
|
+
sizing = _props$$theme2.sizing,
|
|
122
|
+
$density = props.$density;
|
|
123
|
+
return _objectSpread(_objectSpread({}, $density === _constants.DENSITY.high ? typography.LabelMedium : typography.LabelLarge), {}, {
|
|
121
124
|
color: colors.calendarHeaderForeground,
|
|
122
125
|
display: 'flex',
|
|
123
126
|
justifyContent: 'space-between',
|
|
124
127
|
alignItems: 'center',
|
|
125
|
-
paddingTop: sizing.
|
|
126
|
-
paddingBottom: sizing.
|
|
128
|
+
paddingTop: sizing.scale600,
|
|
129
|
+
paddingBottom: sizing.scale300,
|
|
127
130
|
paddingLeft: sizing.scale600,
|
|
128
131
|
paddingRight: sizing.scale600,
|
|
129
132
|
backgroundColor: colors.calendarHeaderBackground,
|
|
@@ -132,8 +135,8 @@ var StyledCalendarHeader = (0, _index.styled)('div', function (props) {
|
|
|
132
135
|
borderBottomRightRadius: 0,
|
|
133
136
|
borderBottomLeftRadius: 0,
|
|
134
137
|
// account for the left/right arrow heights
|
|
135
|
-
minHeight: "calc(".concat(sizing.scale800, " + ").concat(sizing.scale0, ")")
|
|
136
|
-
};
|
|
138
|
+
minHeight: $density === _constants.DENSITY.high ? "calc(".concat(sizing.scale800, " + ").concat(sizing.scale0, ")") : sizing.scale950
|
|
139
|
+
});
|
|
137
140
|
});
|
|
138
141
|
exports.StyledCalendarHeader = StyledCalendarHeader;
|
|
139
142
|
StyledCalendarHeader.displayName = "StyledCalendarHeader";
|
|
@@ -147,19 +150,24 @@ var StyledMonthHeader = (0, _index.styled)('div', function (props) {
|
|
|
147
150
|
exports.StyledMonthHeader = StyledMonthHeader;
|
|
148
151
|
StyledMonthHeader.displayName = "StyledMonthHeader";
|
|
149
152
|
var StyledMonthYearSelectButton = (0, _index.styled)('button', function (props) {
|
|
150
|
-
|
|
153
|
+
var _props$$theme3 = props.$theme,
|
|
154
|
+
typography = _props$$theme3.typography,
|
|
155
|
+
colors = _props$$theme3.colors,
|
|
156
|
+
$isFocusVisible = props.$isFocusVisible,
|
|
157
|
+
$density = props.$density;
|
|
158
|
+
return _objectSpread(_objectSpread({}, $density === _constants.DENSITY.high ? typography.LabelMedium : typography.LabelLarge), {}, {
|
|
151
159
|
alignItems: 'center',
|
|
152
160
|
backgroundColor: 'transparent',
|
|
153
161
|
borderLeftWidth: 0,
|
|
154
162
|
borderRightWidth: 0,
|
|
155
163
|
borderTopWidth: 0,
|
|
156
164
|
borderBottomWidth: 0,
|
|
157
|
-
color:
|
|
165
|
+
color: colors.calendarHeaderForeground,
|
|
158
166
|
cursor: 'pointer',
|
|
159
167
|
display: 'flex',
|
|
160
168
|
outline: 'none',
|
|
161
169
|
':focus': {
|
|
162
|
-
boxShadow:
|
|
170
|
+
boxShadow: $isFocusVisible ? "0 0 0 3px ".concat(colors.accent) : 'none'
|
|
163
171
|
}
|
|
164
172
|
});
|
|
165
173
|
});
|
|
@@ -181,6 +189,7 @@ function getArrowBtnStyle(_ref6) {
|
|
|
181
189
|
$isFocusVisible = _ref6.$isFocusVisible;
|
|
182
190
|
return {
|
|
183
191
|
boxSizing: 'border-box',
|
|
192
|
+
display: 'flex',
|
|
184
193
|
color: $disabled ? $theme.colors.calendarHeaderForegroundDisabled : $theme.colors.calendarHeaderForeground,
|
|
185
194
|
cursor: $disabled ? 'default' : 'pointer',
|
|
186
195
|
backgroundColor: 'transparent',
|
|
@@ -192,8 +201,6 @@ function getArrowBtnStyle(_ref6) {
|
|
|
192
201
|
paddingBottom: '0',
|
|
193
202
|
paddingLeft: '0',
|
|
194
203
|
paddingRight: '0',
|
|
195
|
-
marginLeft: '6px',
|
|
196
|
-
marginRight: '6px',
|
|
197
204
|
marginBottom: 0,
|
|
198
205
|
marginTop: 0,
|
|
199
206
|
outline: 'none',
|
|
@@ -221,7 +228,7 @@ var StyledWeek = (0, _index.styled)('div', function (props) {
|
|
|
221
228
|
return {
|
|
222
229
|
whiteSpace: 'nowrap',
|
|
223
230
|
display: 'flex',
|
|
224
|
-
marginBottom: sizing.
|
|
231
|
+
marginBottom: sizing.scale0
|
|
225
232
|
};
|
|
226
233
|
});
|
|
227
234
|
exports.StyledWeek = StyledWeek;
|
|
@@ -440,24 +447,43 @@ var StyledDay = (0, _index.styled)('div', function (props) {
|
|
|
440
447
|
$outsideMonth = props.$outsideMonth,
|
|
441
448
|
$outsideMonthWithinRange = props.$outsideMonthWithinRange,
|
|
442
449
|
$hasDateLabel = props.$hasDateLabel,
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
450
|
+
$density = props.$density,
|
|
451
|
+
_props$$theme4 = props.$theme,
|
|
452
|
+
colors = _props$$theme4.colors,
|
|
453
|
+
typography = _props$$theme4.typography,
|
|
454
|
+
sizing = _props$$theme4.sizing;
|
|
446
455
|
var code = (0, _dayState.default)(props);
|
|
447
|
-
|
|
456
|
+
var height;
|
|
457
|
+
|
|
458
|
+
if ($hasDateLabel) {
|
|
459
|
+
if ($density === _constants.DENSITY.high) {
|
|
460
|
+
height = '60px';
|
|
461
|
+
} else {
|
|
462
|
+
height = '70px';
|
|
463
|
+
}
|
|
464
|
+
} else {
|
|
465
|
+
if ($density === _constants.DENSITY.high) {
|
|
466
|
+
height = '40px';
|
|
467
|
+
} else {
|
|
468
|
+
height = '48px';
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
return _objectSpread(_objectSpread(_objectSpread({}, $density === _constants.DENSITY.high ? typography.ParagraphSmall : typography.ParagraphMedium), {}, {
|
|
448
473
|
boxSizing: 'border-box',
|
|
449
474
|
position: 'relative',
|
|
450
475
|
cursor: $disabled || !$peekNextMonth && $outsideMonth ? 'default' : 'pointer',
|
|
451
476
|
color: colors.calendarForeground,
|
|
452
477
|
display: 'inline-block',
|
|
453
|
-
width:
|
|
454
|
-
height:
|
|
455
|
-
lineHeight
|
|
478
|
+
width: $density === _constants.DENSITY.high ? '42px' : '50px',
|
|
479
|
+
height: height,
|
|
480
|
+
// setting lineHeight equal to the contents height to vertically center the text
|
|
481
|
+
lineHeight: $density === _constants.DENSITY.high ? sizing.scale700 : sizing.scale900,
|
|
456
482
|
textAlign: 'center',
|
|
457
483
|
paddingTop: sizing.scale300,
|
|
458
484
|
paddingBottom: sizing.scale300,
|
|
459
|
-
paddingLeft: sizing.
|
|
460
|
-
paddingRight: sizing.
|
|
485
|
+
paddingLeft: sizing.scale300,
|
|
486
|
+
paddingRight: sizing.scale300,
|
|
461
487
|
marginTop: 0,
|
|
462
488
|
marginBottom: 0,
|
|
463
489
|
marginLeft: 0,
|
|
@@ -478,10 +504,10 @@ var StyledDay = (0, _index.styled)('div', function (props) {
|
|
|
478
504
|
display: 'inline-block',
|
|
479
505
|
boxShadow: $isFocusVisible ? "0 0 0 3px ".concat(colors.accent) : 'none',
|
|
480
506
|
backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
|
|
481
|
-
height: '100%',
|
|
507
|
+
height: $hasDateLabel ? '100%' : $density === _constants.DENSITY.high ? '42px' : '50px',
|
|
482
508
|
width: '100%',
|
|
483
509
|
position: 'absolute',
|
|
484
|
-
top: 0,
|
|
510
|
+
top: $hasDateLabel ? 0 : '-1px',
|
|
485
511
|
left: 0,
|
|
486
512
|
paddingTop: sizing.scale200,
|
|
487
513
|
paddingBottom: sizing.scale200,
|
|
@@ -497,10 +523,10 @@ var StyledDay = (0, _index.styled)('div', function (props) {
|
|
|
497
523
|
borderBottomColor: colors.borderSelected,
|
|
498
524
|
borderRightColor: colors.borderSelected,
|
|
499
525
|
borderLeftColor: colors.borderSelected,
|
|
500
|
-
borderTopLeftRadius: $hasDateLabel ? sizing.
|
|
501
|
-
borderTopRightRadius: $hasDateLabel ? sizing.
|
|
502
|
-
borderBottomLeftRadius: $hasDateLabel ? sizing.
|
|
503
|
-
borderBottomRightRadius: $hasDateLabel ? sizing.
|
|
526
|
+
borderTopLeftRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
527
|
+
borderTopRightRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
528
|
+
borderBottomLeftRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
529
|
+
borderBottomRightRadius: $hasDateLabel ? sizing.scale800 : '100%'
|
|
504
530
|
}, getDayStyles(code, props.$theme)[':after'] || {}), $outsideMonthWithinRange ? {
|
|
505
531
|
content: null
|
|
506
532
|
} : {})
|
|
@@ -543,9 +569,9 @@ var StyledDay = (0, _index.styled)('div', function (props) {
|
|
|
543
569
|
exports.StyledDay = StyledDay;
|
|
544
570
|
StyledDay.displayName = "StyledDay";
|
|
545
571
|
var StyledDayLabel = (0, _index.styled)('div', function (props) {
|
|
546
|
-
var _props$$
|
|
547
|
-
typography = _props$$
|
|
548
|
-
colors = _props$$
|
|
572
|
+
var _props$$theme5 = props.$theme,
|
|
573
|
+
typography = _props$$theme5.typography,
|
|
574
|
+
colors = _props$$theme5.colors,
|
|
549
575
|
$selected = props.$selected;
|
|
550
576
|
return _objectSpread(_objectSpread({}, typography.ParagraphXSmall), {}, {
|
|
551
577
|
color: $selected ? colors.contentInverseTertiary : colors.contentTertiary
|
|
@@ -554,16 +580,22 @@ var StyledDayLabel = (0, _index.styled)('div', function (props) {
|
|
|
554
580
|
exports.StyledDayLabel = StyledDayLabel;
|
|
555
581
|
StyledDayLabel.displayName = "StyledDayLabel";
|
|
556
582
|
var StyledWeekdayHeader = (0, _index.styled)('div', function (props) {
|
|
557
|
-
var
|
|
558
|
-
|
|
583
|
+
var _props$$theme6 = props.$theme,
|
|
584
|
+
typography = _props$$theme6.typography,
|
|
585
|
+
colors = _props$$theme6.colors,
|
|
586
|
+
sizing = _props$$theme6.sizing,
|
|
587
|
+
$density = props.$density;
|
|
588
|
+
return _objectSpread(_objectSpread({}, typography.LabelMedium), {}, {
|
|
589
|
+
color: colors.contentTertiary,
|
|
559
590
|
boxSizing: 'border-box',
|
|
560
591
|
position: 'relative',
|
|
561
592
|
cursor: 'default',
|
|
562
593
|
display: 'inline-block',
|
|
563
|
-
width:
|
|
564
|
-
height:
|
|
565
|
-
lineHeight: sizing.scale800,
|
|
594
|
+
width: $density === _constants.DENSITY.high ? '42px' : '50px',
|
|
595
|
+
height: $density === _constants.DENSITY.high ? '40px' : '48px',
|
|
566
596
|
textAlign: 'center',
|
|
597
|
+
// setting lineHeight equal to the contents height to vertically center the text
|
|
598
|
+
lineHeight: sizing.scale900,
|
|
567
599
|
paddingTop: sizing.scale300,
|
|
568
600
|
paddingBottom: sizing.scale300,
|
|
569
601
|
paddingLeft: sizing.scale200,
|
|
@@ -572,9 +604,8 @@ var StyledWeekdayHeader = (0, _index.styled)('div', function (props) {
|
|
|
572
604
|
marginBottom: 0,
|
|
573
605
|
marginLeft: 0,
|
|
574
606
|
marginRight: 0,
|
|
575
|
-
color: 'inherit',
|
|
576
607
|
backgroundColor: 'transparent'
|
|
577
|
-
};
|
|
608
|
+
});
|
|
578
609
|
});
|
|
579
610
|
exports.StyledWeekdayHeader = StyledWeekdayHeader;
|
|
580
611
|
StyledWeekdayHeader.displayName = "StyledWeekdayHeader";
|