baseui 0.0.0-next-7202ef9 → 0.0.0-next-42ee3cb
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/combobox/combobox.js +5 -1
- package/combobox/combobox.js.flow +4 -0
- package/datepicker/calendar-header.js +27 -15
- package/datepicker/calendar-header.js.flow +13 -9
- 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 +53 -27
- package/datepicker/styled-components.js.flow +55 -17
- package/datepicker/types.js.flow +8 -1
- package/datepicker/week.js +1 -0
- package/datepicker/week.js.flow +1 -0
- package/es/combobox/combobox.js +5 -1
- package/es/datepicker/calendar-header.js +19 -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 +46 -17
- package/es/datepicker/types.js +1 -1
- package/es/datepicker/week.js +1 -0
- package/es/popover/popover.js +3 -2
- package/es/popover/stateful-container.js +4 -2
- package/esm/combobox/combobox.js +5 -1
- package/esm/datepicker/calendar-header.js +28 -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 +54 -28
- package/esm/datepicker/types.js +1 -1
- package/esm/datepicker/week.js +1 -0
- package/esm/popover/popover.js +3 -2
- package/esm/popover/stateful-container.js +4 -2
- package/modal/index.d.ts +1 -1
- package/modal/types.js.flow +4 -1
- package/package.json +2 -2
- package/popover/index.d.ts +2 -1
- package/popover/popover.js +3 -2
- package/popover/popover.js.flow +2 -1
- package/popover/stateful-container.js +4 -2
- package/popover/stateful-container.js.flow +2 -0
- package/popover/types.js.flow +6 -1
package/combobox/combobox.js
CHANGED
|
@@ -306,7 +306,11 @@ function Combobox(props) {
|
|
|
306
306
|
return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line flowtype/no-weak-types
|
|
307
307
|
, _extends({
|
|
308
308
|
ref: rootRef
|
|
309
|
-
}, rootProps), /*#__PURE__*/React.createElement(OverriddenPopover,
|
|
309
|
+
}, rootProps), /*#__PURE__*/React.createElement(OverriddenPopover // React-focus-lock used in Popover used to skip non-tabbable elements (`tabIndex=-1`) elements for focus, we had ListBox with tabIndex to disable focus on
|
|
310
|
+
// the ListBox, but we can just disable autoFocus (as ListBox / ListItem should not be focusable) (and input is also not autoFocused).
|
|
311
|
+
// Select Component does the same thing
|
|
312
|
+
, _extends({
|
|
313
|
+
autoFocus: false,
|
|
310
314
|
isOpen: isOpen,
|
|
311
315
|
overrides: popoverOverrides,
|
|
312
316
|
placement: _index2.PLACEMENT.bottomLeft,
|
|
@@ -258,6 +258,10 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
258
258
|
{...rootProps}
|
|
259
259
|
>
|
|
260
260
|
<OverriddenPopover
|
|
261
|
+
// React-focus-lock used in Popover used to skip non-tabbable elements (`tabIndex=-1`) elements for focus, we had ListBox with tabIndex to disable focus on
|
|
262
|
+
// the ListBox, but we can just disable autoFocus (as ListBox / ListItem should not be focusable) (and input is also not autoFocused).
|
|
263
|
+
// Select Component does the same thing
|
|
264
|
+
autoFocus={false}
|
|
261
265
|
isOpen={isOpen}
|
|
262
266
|
overrides={popoverOverrides}
|
|
263
267
|
placement={PLACEMENT.bottomLeft}
|
|
@@ -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: 36,
|
|
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: 36,
|
|
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({
|
|
@@ -568,7 +574,7 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
568
574
|
}
|
|
569
575
|
}
|
|
570
576
|
},
|
|
571
|
-
size: 24
|
|
577
|
+
size: density === _constants.DENSITY.high ? 16 : 24
|
|
572
578
|
})))), /*#__PURE__*/React.createElement(OverriddenPopover, _extends({
|
|
573
579
|
placement: "bottom",
|
|
574
580
|
focusLock: true,
|
|
@@ -622,6 +628,7 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
622
628
|
"aria-live": "polite",
|
|
623
629
|
type: "button",
|
|
624
630
|
$isFocusVisible: _this.state.isFocusVisible,
|
|
631
|
+
$density: density,
|
|
625
632
|
onKeyUp: function onKeyUp(event) {
|
|
626
633
|
if (_this.canArrowsOpenDropdown(event)) {
|
|
627
634
|
_this.setState({
|
|
@@ -650,7 +657,7 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
650
657
|
}
|
|
651
658
|
}
|
|
652
659
|
},
|
|
653
|
-
size: 24
|
|
660
|
+
size: density === _constants.DENSITY.high ? 16 : 24
|
|
654
661
|
})))));
|
|
655
662
|
});
|
|
656
663
|
|
|
@@ -687,8 +694,10 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
687
694
|
value: function render() {
|
|
688
695
|
var _this2 = this;
|
|
689
696
|
|
|
690
|
-
var _this$
|
|
691
|
-
|
|
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;
|
|
692
701
|
|
|
693
702
|
var _getOverrides17 = (0, _overrides.getOverrides)(overrides.CalendarHeader, _styledComponents.StyledCalendarHeader),
|
|
694
703
|
_getOverrides18 = _slicedToArray(_getOverrides17, 2),
|
|
@@ -709,6 +718,7 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
709
718
|
return /*#__PURE__*/React.createElement(_themeProvider.ThemeContext.Consumer, null, function (theme) {
|
|
710
719
|
return /*#__PURE__*/React.createElement(_index3.LocaleContext.Consumer, null, function (locale) {
|
|
711
720
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_CalendarHeader, _extends({}, calendarHeaderProps, {
|
|
721
|
+
$density: _this2.props.density,
|
|
712
722
|
onFocus: (0, _focusVisible.forkFocus)(calendarHeaderProps, _this2.handleFocus),
|
|
713
723
|
onBlur: (0, _focusVisible.forkBlur)(calendarHeaderProps, _this2.handleBlur)
|
|
714
724
|
}), _this2.renderPreviousMonthButton({
|
|
@@ -725,7 +735,9 @@ var CalendarHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
725
735
|
return /*#__PURE__*/React.createElement(WeekdayHeader, _extends({
|
|
726
736
|
key: offset,
|
|
727
737
|
alt: _this2.dateHelpers.getWeekdayInLocale(day, _this2.props.locale)
|
|
728
|
-
}, weekdayHeaderProps
|
|
738
|
+
}, weekdayHeaderProps, {
|
|
739
|
+
$density: density
|
|
740
|
+
}), _this2.dateHelpers.getWeekdayMinInLocale(day, _this2.props.locale));
|
|
729
741
|
})));
|
|
730
742
|
});
|
|
731
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={36}
|
|
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={36}
|
|
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,7 +521,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
520
521
|
<ChevronDown
|
|
521
522
|
title=""
|
|
522
523
|
overrides={{Svg: {props: {role: 'presentation'}}}}
|
|
523
|
-
size={24}
|
|
524
|
+
size={density === DENSITY.high ? 16 : 24}
|
|
524
525
|
/>
|
|
525
526
|
</MonthYearSelectIconContainer>
|
|
526
527
|
</MonthYearSelectButton>
|
|
@@ -565,6 +566,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
565
566
|
aria-live="polite"
|
|
566
567
|
type="button"
|
|
567
568
|
$isFocusVisible={this.state.isFocusVisible}
|
|
569
|
+
$density={density}
|
|
568
570
|
onKeyUp={event => {
|
|
569
571
|
if (this.canArrowsOpenDropdown(event)) {
|
|
570
572
|
this.setState({isYearDropdownOpen: true});
|
|
@@ -589,7 +591,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
589
591
|
<ChevronDown
|
|
590
592
|
title=""
|
|
591
593
|
overrides={{Svg: {props: {role: 'presentation'}}}}
|
|
592
|
-
size={24}
|
|
594
|
+
size={density === DENSITY.high ? 16 : 24}
|
|
593
595
|
/>
|
|
594
596
|
</MonthYearSelectIconContainer>
|
|
595
597
|
</MonthYearSelectButton>
|
|
@@ -599,7 +601,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
599
601
|
};
|
|
600
602
|
|
|
601
603
|
render() {
|
|
602
|
-
const {overrides = {}} = this.props;
|
|
604
|
+
const {overrides = {}, density} = this.props;
|
|
603
605
|
const [CalendarHeader, calendarHeaderProps] = getOverrides(
|
|
604
606
|
overrides.CalendarHeader,
|
|
605
607
|
StyledCalendarHeader,
|
|
@@ -625,6 +627,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
625
627
|
<>
|
|
626
628
|
<CalendarHeader
|
|
627
629
|
{...calendarHeaderProps}
|
|
630
|
+
$density={this.props.density}
|
|
628
631
|
onFocus={forkFocus(calendarHeaderProps, this.handleFocus)}
|
|
629
632
|
onBlur={forkBlur(calendarHeaderProps, this.handleBlur)}
|
|
630
633
|
>
|
|
@@ -646,6 +649,7 @@ export default class CalendarHeader<T = Date> extends React.Component<
|
|
|
646
649
|
this.props.locale,
|
|
647
650
|
)}
|
|
648
651
|
{...weekdayHeaderProps}
|
|
652
|
+
$density={density}
|
|
649
653
|
>
|
|
650
654
|
{this.dateHelpers.getWeekdayMinInLocale(
|
|
651
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,10 +90,11 @@ 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
96
|
paddingTop: sizing.scale300,
|
|
96
|
-
paddingBottom: sizing.scale300,
|
|
97
|
+
paddingBottom: $density === _constants.DENSITY.high ? sizing.scale400 : sizing.scale300,
|
|
97
98
|
paddingLeft: sizing.scale500,
|
|
98
99
|
paddingRight: sizing.scale500
|
|
99
100
|
};
|
|
@@ -114,10 +115,12 @@ 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',
|
|
@@ -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
|
});
|
|
@@ -439,21 +447,38 @@ var StyledDay = (0, _index.styled)('div', function (props) {
|
|
|
439
447
|
$outsideMonth = props.$outsideMonth,
|
|
440
448
|
$outsideMonthWithinRange = props.$outsideMonthWithinRange,
|
|
441
449
|
$hasDateLabel = props.$hasDateLabel,
|
|
442
|
-
|
|
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: '50px',
|
|
454
|
-
height:
|
|
478
|
+
width: $density === _constants.DENSITY.high ? '42px' : '50px',
|
|
479
|
+
height: height,
|
|
455
480
|
// setting lineHeight equal to the contents height to vertically center the text
|
|
456
|
-
lineHeight: sizing.scale900,
|
|
481
|
+
lineHeight: $density === _constants.DENSITY.high ? sizing.scale700 : sizing.scale900,
|
|
457
482
|
textAlign: 'center',
|
|
458
483
|
paddingTop: sizing.scale300,
|
|
459
484
|
paddingBottom: sizing.scale300,
|
|
@@ -479,7 +504,7 @@ var StyledDay = (0, _index.styled)('div', function (props) {
|
|
|
479
504
|
display: 'inline-block',
|
|
480
505
|
boxShadow: $isFocusVisible ? "0 0 0 3px ".concat(colors.accent) : 'none',
|
|
481
506
|
backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
|
|
482
|
-
height: $hasDateLabel ? '100%' : '50px',
|
|
507
|
+
height: $hasDateLabel ? '100%' : $density === _constants.DENSITY.high ? '42px' : '50px',
|
|
483
508
|
width: '100%',
|
|
484
509
|
position: 'absolute',
|
|
485
510
|
top: $hasDateLabel ? 0 : '-1px',
|
|
@@ -544,9 +569,9 @@ var StyledDay = (0, _index.styled)('div', function (props) {
|
|
|
544
569
|
exports.StyledDay = StyledDay;
|
|
545
570
|
StyledDay.displayName = "StyledDay";
|
|
546
571
|
var StyledDayLabel = (0, _index.styled)('div', function (props) {
|
|
547
|
-
var _props$$
|
|
548
|
-
typography = _props$$
|
|
549
|
-
colors = _props$$
|
|
572
|
+
var _props$$theme5 = props.$theme,
|
|
573
|
+
typography = _props$$theme5.typography,
|
|
574
|
+
colors = _props$$theme5.colors,
|
|
550
575
|
$selected = props.$selected;
|
|
551
576
|
return _objectSpread(_objectSpread({}, typography.ParagraphXSmall), {}, {
|
|
552
577
|
color: $selected ? colors.contentInverseTertiary : colors.contentTertiary
|
|
@@ -555,18 +580,19 @@ var StyledDayLabel = (0, _index.styled)('div', function (props) {
|
|
|
555
580
|
exports.StyledDayLabel = StyledDayLabel;
|
|
556
581
|
StyledDayLabel.displayName = "StyledDayLabel";
|
|
557
582
|
var StyledWeekdayHeader = (0, _index.styled)('div', function (props) {
|
|
558
|
-
var _props$$
|
|
559
|
-
typography = _props$$
|
|
560
|
-
colors = _props$$
|
|
561
|
-
sizing = _props$$
|
|
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;
|
|
562
588
|
return _objectSpread(_objectSpread({}, typography.LabelMedium), {}, {
|
|
563
589
|
color: colors.contentTertiary,
|
|
564
590
|
boxSizing: 'border-box',
|
|
565
591
|
position: 'relative',
|
|
566
592
|
cursor: 'default',
|
|
567
593
|
display: 'inline-block',
|
|
568
|
-
width: '50px',
|
|
569
|
-
height:
|
|
594
|
+
width: $density === _constants.DENSITY.high ? '42px' : '50px',
|
|
595
|
+
height: $density === _constants.DENSITY.high ? '40px' : '48px',
|
|
570
596
|
textAlign: 'center',
|
|
571
597
|
// setting lineHeight equal to the contents height to vertically center the text
|
|
572
598
|
lineHeight: sizing.scale900,
|