baseui 0.0.0-alpha-cfc8585 → 0.0.0-alpha-fd35cbd
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/app-nav-bar/user-menu.js +1 -0
- package/app-nav-bar/user-menu.js.flow +1 -0
- package/button/styled-components.js +1 -1
- package/button/styled-components.js.flow +4 -1
- package/card/styled-components.js +0 -1
- package/card/styled-components.js.flow +0 -1
- package/combobox/combobox.js +5 -1
- package/combobox/combobox.js.flow +4 -0
- package/combobox/index.d.ts +6 -3
- package/data-table/column-datetime.js +3 -1
- package/data-table/column-datetime.js.flow +3 -1
- package/data-table/data-table.js +13 -3
- package/data-table/data-table.js.flow +20 -4
- package/data-table/types.js.flow +2 -1
- package/datepicker/calendar-header.js +255 -109
- package/datepicker/calendar-header.js.flow +282 -145
- package/datepicker/calendar.js +18 -7
- package/datepicker/calendar.js.flow +28 -13
- package/datepicker/constants.js +9 -2
- package/datepicker/constants.js.flow +7 -0
- package/datepicker/datepicker.js +149 -76
- package/datepicker/datepicker.js.flow +185 -71
- package/datepicker/day.js +60 -30
- package/datepicker/day.js.flow +105 -51
- package/datepicker/index.d.ts +8 -0
- package/datepicker/month.js +4 -0
- package/datepicker/month.js.flow +3 -0
- package/datepicker/stateful-container.js.flow +2 -1
- package/datepicker/styled-components.js +116 -56
- package/datepicker/styled-components.js.flow +101 -36
- package/datepicker/types.js.flow +29 -10
- package/datepicker/utils/calendar-header-helpers.js +51 -0
- package/datepicker/utils/calendar-header-helpers.js.flow +53 -0
- 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/dnd-list/index.js.flow +2 -1
- package/dnd-list/list.js +1 -2
- package/dnd-list/list.js.flow +1 -1
- package/dnd-list/styled-components.js +1 -1
- package/dnd-list/styled-components.js.flow +1 -0
- package/drawer/drawer.js +2 -1
- package/drawer/drawer.js.flow +1 -1
- package/es/app-nav-bar/user-menu.js +1 -0
- package/es/button/styled-components.js +1 -1
- package/es/card/styled-components.js +0 -1
- package/es/combobox/combobox.js +5 -1
- package/es/data-table/column-datetime.js +3 -1
- package/es/data-table/data-table.js +13 -3
- package/es/datepicker/calendar-header.js +204 -93
- package/es/datepicker/calendar.js +19 -8
- package/es/datepicker/constants.js +6 -1
- package/es/datepicker/datepicker.js +84 -46
- package/es/datepicker/day.js +53 -30
- package/es/datepicker/month.js +3 -0
- package/es/datepicker/styled-components.js +98 -37
- package/es/datepicker/types.js +1 -1
- package/es/datepicker/utils/calendar-header-helpers.js +34 -0
- package/es/datepicker/utils/date-helpers.js +1 -1
- package/es/datepicker/week.js +1 -0
- package/es/dnd-list/index.js +2 -1
- package/es/dnd-list/list.js +1 -2
- package/es/dnd-list/styled-components.js +1 -0
- package/es/drawer/drawer.js +2 -1
- package/es/helper/helper.js +1 -0
- package/es/layer/layer.js +8 -0
- package/es/map-marker/constants.js +69 -0
- package/es/map-marker/fixed-marker.js +98 -0
- package/es/map-marker/floating-marker.js +65 -0
- package/es/map-marker/index.js +9 -0
- package/es/map-marker/pin-head.js +108 -0
- package/es/map-marker/styled-components.js +156 -0
- package/es/map-marker/types.js +8 -0
- package/es/menu/maybe-child-menu.js +1 -0
- package/es/popover/popover.js +6 -5
- package/es/popover/stateful-container.js +8 -2
- package/es/rating/emoticon-rating.js +3 -1
- package/es/rating/star-rating.js +3 -1
- package/es/select/select-component.js +20 -5
- package/es/select/styled-components.js +34 -4
- package/es/snackbar/snackbar-context.js +16 -4
- package/es/table-semantic/styled-components.js +6 -4
- package/es/table-semantic/table-builder.js +3 -0
- package/es/themes/dark-theme/color-component-tokens.js +1 -1
- package/es/themes/light-theme/color-component-tokens.js +9 -9
- package/es/themes/shared/lighting.js +5 -1
- package/es/timepicker/timepicker.js +16 -11
- package/es/tooltip/styled-components.js +8 -0
- package/es/tooltip/tooltip.js +1 -0
- package/esm/app-nav-bar/user-menu.js +1 -0
- package/esm/button/styled-components.js +1 -1
- package/esm/card/styled-components.js +0 -1
- package/esm/combobox/combobox.js +5 -1
- package/esm/data-table/column-datetime.js +3 -1
- package/esm/data-table/data-table.js +13 -3
- package/esm/datepicker/calendar-header.js +255 -110
- package/esm/datepicker/calendar.js +19 -8
- package/esm/datepicker/constants.js +6 -1
- package/esm/datepicker/datepicker.js +150 -77
- package/esm/datepicker/day.js +60 -30
- package/esm/datepicker/month.js +3 -0
- package/esm/datepicker/styled-components.js +112 -55
- package/esm/datepicker/types.js +1 -1
- package/esm/datepicker/utils/calendar-header-helpers.js +45 -0
- package/esm/datepicker/utils/date-helpers.js +1 -1
- package/esm/datepicker/week.js +1 -0
- package/esm/dnd-list/index.js +2 -1
- package/esm/dnd-list/list.js +1 -2
- package/esm/dnd-list/styled-components.js +1 -1
- package/esm/drawer/drawer.js +2 -1
- package/esm/helper/helper.js +1 -0
- package/esm/layer/layer.js +8 -0
- package/esm/map-marker/constants.js +62 -0
- package/esm/map-marker/fixed-marker.js +137 -0
- package/esm/map-marker/floating-marker.js +94 -0
- package/esm/map-marker/index.js +9 -0
- package/esm/map-marker/pin-head.js +144 -0
- package/esm/map-marker/styled-components.js +168 -0
- package/esm/map-marker/types.js +8 -0
- package/esm/menu/maybe-child-menu.js +1 -0
- package/esm/popover/popover.js +6 -5
- package/esm/popover/stateful-container.js +8 -2
- package/esm/rating/emoticon-rating.js +2 -2
- package/esm/rating/star-rating.js +2 -2
- package/esm/select/select-component.js +19 -5
- package/esm/select/styled-components.js +28 -4
- package/esm/snackbar/snackbar-context.js +16 -4
- package/esm/table-semantic/styled-components.js +6 -4
- package/esm/table-semantic/table-builder.js +3 -0
- package/esm/themes/dark-theme/color-component-tokens.js +1 -1
- package/esm/themes/light-theme/color-component-tokens.js +9 -9
- package/esm/themes/shared/lighting.js +5 -1
- package/esm/timepicker/timepicker.js +17 -11
- package/esm/tooltip/styled-components.js +8 -0
- package/esm/tooltip/tooltip.js +1 -0
- package/helper/helper.js +1 -0
- package/helper/helper.js.flow +1 -0
- package/layer/layer.js +8 -0
- package/layer/layer.js.flow +9 -0
- package/link/index.d.ts +1 -0
- package/map-marker/constants.js +82 -0
- package/map-marker/constants.js.flow +74 -0
- package/map-marker/fixed-marker.js +152 -0
- package/map-marker/fixed-marker.js.flow +137 -0
- package/map-marker/floating-marker.js +109 -0
- package/map-marker/floating-marker.js.flow +102 -0
- package/map-marker/index.d.ts +105 -0
- package/map-marker/index.js +55 -0
- package/map-marker/index.js.flow +23 -0
- package/map-marker/package.json +4 -0
- package/map-marker/pin-head.js +159 -0
- package/map-marker/pin-head.js.flow +155 -0
- package/map-marker/styled-components.js +184 -0
- package/map-marker/styled-components.js.flow +177 -0
- package/map-marker/types.js +11 -0
- package/map-marker/types.js.flow +114 -0
- package/menu/index.d.ts +7 -0
- package/menu/maybe-child-menu.js +1 -0
- package/menu/maybe-child-menu.js.flow +1 -0
- package/menu/types.js.flow +12 -0
- package/modal/index.d.ts +1 -1
- package/modal/types.js.flow +4 -1
- package/package.json +5 -3
- package/popover/index.d.ts +2 -1
- package/popover/popover.js +6 -5
- package/popover/popover.js.flow +11 -4
- package/popover/stateful-container.js +8 -2
- package/popover/stateful-container.js.flow +5 -0
- package/popover/types.js.flow +6 -1
- package/rating/emoticon-rating.js +2 -2
- package/rating/emoticon-rating.js.flow +4 -1
- package/rating/star-rating.js +2 -2
- package/rating/star-rating.js.flow +4 -1
- package/select/select-component.js +19 -5
- package/select/select-component.js.flow +19 -5
- package/select/styled-components.js +28 -4
- package/select/styled-components.js.flow +30 -2
- package/select/types.js.flow +9 -0
- package/snackbar/index.d.ts +21 -16
- package/snackbar/snackbar-context.js +15 -4
- package/snackbar/snackbar-context.js.flow +15 -3
- package/table-semantic/styled-components.js +6 -4
- package/table-semantic/styled-components.js.flow +6 -4
- package/table-semantic/table-builder.js +3 -0
- package/table-semantic/table-builder.js.flow +3 -0
- package/themes/dark-theme/color-component-tokens.js +1 -1
- package/themes/dark-theme/color-component-tokens.js.flow +1 -1
- package/themes/light-theme/color-component-tokens.js +9 -9
- package/themes/light-theme/color-component-tokens.js.flow +9 -9
- package/themes/shared/lighting.js +5 -1
- package/themes/shared/lighting.js.flow +4 -0
- package/themes/types.js.flow +4 -0
- 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
- package/tooltip/styled-components.js +8 -0
- package/tooltip/styled-components.js.flow +8 -0
- package/tooltip/tooltip.js +1 -0
- package/tooltip/tooltip.js.flow +6 -1
|
@@ -8,12 +8,36 @@ LICENSE file in the root directory of this source tree.
|
|
|
8
8
|
import {styled} from '../styles/index.js';
|
|
9
9
|
import getDayStateCode from './utils/day-state.js';
|
|
10
10
|
import type {SharedStylePropsT, CalendarPropsT} from './types.js';
|
|
11
|
-
import {ORIENTATION} from './constants.js';
|
|
11
|
+
import {ORIENTATION, DENSITY} from './constants.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Main component container element
|
|
15
15
|
*/
|
|
16
|
-
export const StyledInputWrapper = styled<
|
|
16
|
+
export const StyledInputWrapper = styled<{
|
|
17
|
+
...SharedStylePropsT,
|
|
18
|
+
$separateRangeInputs: boolean,
|
|
19
|
+
}>('div', props => {
|
|
20
|
+
const {$separateRangeInputs} = props;
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
width: '100%',
|
|
24
|
+
...($separateRangeInputs
|
|
25
|
+
? {display: 'flex', justifyContent: 'center'}
|
|
26
|
+
: {}),
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const StyledInputLabel = styled<{}>('div', ({$theme}) => ({
|
|
31
|
+
...$theme.typography.LabelMedium,
|
|
32
|
+
marginBottom: $theme.sizing.scale300,
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
export const StyledStartDate = styled<{}>('div', ({$theme}) => ({
|
|
36
|
+
width: '100%',
|
|
37
|
+
marginRight: $theme.sizing.scale300,
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
export const StyledEndDate = styled<{}>('div', ({$theme}) => ({
|
|
17
41
|
width: '100%',
|
|
18
42
|
}));
|
|
19
43
|
|
|
@@ -52,12 +76,14 @@ export const StyledCalendarContainer = styled<SharedStylePropsT>(
|
|
|
52
76
|
props => {
|
|
53
77
|
const {
|
|
54
78
|
$theme: {sizing},
|
|
79
|
+
$density,
|
|
55
80
|
} = props;
|
|
56
81
|
return {
|
|
57
|
-
paddingTop: sizing.
|
|
58
|
-
paddingBottom:
|
|
59
|
-
|
|
60
|
-
|
|
82
|
+
paddingTop: sizing.scale300,
|
|
83
|
+
paddingBottom:
|
|
84
|
+
$density === DENSITY.high ? sizing.scale400 : sizing.scale300,
|
|
85
|
+
paddingLeft: sizing.scale500,
|
|
86
|
+
paddingRight: sizing.scale500,
|
|
61
87
|
};
|
|
62
88
|
},
|
|
63
89
|
);
|
|
@@ -77,15 +103,19 @@ export const StyledSelectorContainer = styled<SharedStylePropsT>(
|
|
|
77
103
|
|
|
78
104
|
export const StyledCalendarHeader = styled<SharedStylePropsT>('div', props => {
|
|
79
105
|
const {
|
|
80
|
-
$theme: {borders, colors, sizing},
|
|
106
|
+
$theme: {typography, borders, colors, sizing},
|
|
107
|
+
$density,
|
|
81
108
|
} = props;
|
|
82
109
|
return {
|
|
110
|
+
...($density === DENSITY.high
|
|
111
|
+
? typography.LabelMedium
|
|
112
|
+
: typography.LabelLarge),
|
|
83
113
|
color: colors.calendarHeaderForeground,
|
|
84
114
|
display: 'flex',
|
|
85
115
|
justifyContent: 'space-between',
|
|
86
116
|
alignItems: 'center',
|
|
87
|
-
paddingTop: sizing.
|
|
88
|
-
paddingBottom: sizing.
|
|
117
|
+
paddingTop: sizing.scale600,
|
|
118
|
+
paddingBottom: sizing.scale300,
|
|
89
119
|
paddingLeft: sizing.scale600,
|
|
90
120
|
paddingRight: sizing.scale600,
|
|
91
121
|
backgroundColor: colors.calendarHeaderBackground,
|
|
@@ -94,7 +124,10 @@ export const StyledCalendarHeader = styled<SharedStylePropsT>('div', props => {
|
|
|
94
124
|
borderBottomRightRadius: 0,
|
|
95
125
|
borderBottomLeftRadius: 0,
|
|
96
126
|
// account for the left/right arrow heights
|
|
97
|
-
minHeight:
|
|
127
|
+
minHeight:
|
|
128
|
+
$density === DENSITY.high
|
|
129
|
+
? `calc(${sizing.scale800} + ${sizing.scale0})`
|
|
130
|
+
: sizing.scale950,
|
|
98
131
|
};
|
|
99
132
|
});
|
|
100
133
|
|
|
@@ -106,25 +139,30 @@ export const StyledMonthHeader = styled<SharedStylePropsT>('div', props => {
|
|
|
106
139
|
};
|
|
107
140
|
});
|
|
108
141
|
|
|
109
|
-
export const StyledMonthYearSelectButton = styled<
|
|
142
|
+
export const StyledMonthYearSelectButton = styled<SharedStylePropsT>(
|
|
110
143
|
'button',
|
|
111
144
|
props => {
|
|
145
|
+
const {
|
|
146
|
+
$theme: {typography, colors},
|
|
147
|
+
$isFocusVisible,
|
|
148
|
+
$density,
|
|
149
|
+
} = props;
|
|
112
150
|
return {
|
|
113
|
-
...
|
|
151
|
+
...($density === DENSITY.high
|
|
152
|
+
? typography.LabelMedium
|
|
153
|
+
: typography.LabelLarge),
|
|
114
154
|
alignItems: 'center',
|
|
115
155
|
backgroundColor: 'transparent',
|
|
116
156
|
borderLeftWidth: 0,
|
|
117
157
|
borderRightWidth: 0,
|
|
118
158
|
borderTopWidth: 0,
|
|
119
159
|
borderBottomWidth: 0,
|
|
120
|
-
color:
|
|
160
|
+
color: colors.calendarHeaderForeground,
|
|
121
161
|
cursor: 'pointer',
|
|
122
162
|
display: 'flex',
|
|
123
163
|
outline: 'none',
|
|
124
164
|
':focus': {
|
|
125
|
-
boxShadow:
|
|
126
|
-
? `0 0 0 3px ${props.$theme.colors.accent}`
|
|
127
|
-
: 'none',
|
|
165
|
+
boxShadow: $isFocusVisible ? `0 0 0 3px ${colors.accent}` : 'none',
|
|
128
166
|
},
|
|
129
167
|
};
|
|
130
168
|
},
|
|
@@ -143,6 +181,7 @@ export const StyledMonthYearSelectIconContainer = styled<{}>('span', props => {
|
|
|
143
181
|
function getArrowBtnStyle({$theme, $disabled, $isFocusVisible}) {
|
|
144
182
|
return {
|
|
145
183
|
boxSizing: 'border-box',
|
|
184
|
+
display: 'flex',
|
|
146
185
|
color: $disabled
|
|
147
186
|
? $theme.colors.calendarHeaderForegroundDisabled
|
|
148
187
|
: $theme.colors.calendarHeaderForeground,
|
|
@@ -156,8 +195,6 @@ function getArrowBtnStyle({$theme, $disabled, $isFocusVisible}) {
|
|
|
156
195
|
paddingBottom: '0',
|
|
157
196
|
paddingLeft: '0',
|
|
158
197
|
paddingRight: '0',
|
|
159
|
-
marginLeft: '6px',
|
|
160
|
-
marginRight: '6px',
|
|
161
198
|
marginBottom: 0,
|
|
162
199
|
marginTop: 0,
|
|
163
200
|
outline: 'none',
|
|
@@ -197,7 +234,7 @@ export const StyledWeek = styled<SharedStylePropsT>('div', props => {
|
|
|
197
234
|
return {
|
|
198
235
|
whiteSpace: 'nowrap',
|
|
199
236
|
display: 'flex',
|
|
200
|
-
marginBottom: sizing.
|
|
237
|
+
marginBottom: sizing.scale0,
|
|
201
238
|
};
|
|
202
239
|
});
|
|
203
240
|
|
|
@@ -402,24 +439,45 @@ export const StyledDay = styled<SharedStylePropsT>('div', props => {
|
|
|
402
439
|
$outsideMonth,
|
|
403
440
|
$outsideMonthWithinRange,
|
|
404
441
|
$hasDateLabel,
|
|
405
|
-
$
|
|
442
|
+
$density,
|
|
443
|
+
$theme: {colors, typography, sizing},
|
|
406
444
|
} = props;
|
|
407
445
|
const code = getDayStateCode(props);
|
|
446
|
+
|
|
447
|
+
let height;
|
|
448
|
+
if ($hasDateLabel) {
|
|
449
|
+
if ($density === DENSITY.high) {
|
|
450
|
+
height = '60px';
|
|
451
|
+
} else {
|
|
452
|
+
height = '70px';
|
|
453
|
+
}
|
|
454
|
+
} else {
|
|
455
|
+
if ($density === DENSITY.high) {
|
|
456
|
+
height = '40px';
|
|
457
|
+
} else {
|
|
458
|
+
height = '48px';
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
408
462
|
return ({
|
|
463
|
+
...($density === DENSITY.high
|
|
464
|
+
? typography.ParagraphSmall
|
|
465
|
+
: typography.ParagraphMedium),
|
|
409
466
|
boxSizing: 'border-box',
|
|
410
467
|
position: 'relative',
|
|
411
468
|
cursor:
|
|
412
469
|
$disabled || (!$peekNextMonth && $outsideMonth) ? 'default' : 'pointer',
|
|
413
470
|
color: colors.calendarForeground,
|
|
414
471
|
display: 'inline-block',
|
|
415
|
-
width:
|
|
416
|
-
height:
|
|
417
|
-
lineHeight
|
|
472
|
+
width: $density === DENSITY.high ? '42px' : '50px',
|
|
473
|
+
height: height,
|
|
474
|
+
// setting lineHeight equal to the contents height to vertically center the text
|
|
475
|
+
lineHeight: $density === DENSITY.high ? sizing.scale700 : sizing.scale900,
|
|
418
476
|
textAlign: 'center',
|
|
419
477
|
paddingTop: sizing.scale300,
|
|
420
478
|
paddingBottom: sizing.scale300,
|
|
421
|
-
paddingLeft: sizing.
|
|
422
|
-
paddingRight: sizing.
|
|
479
|
+
paddingLeft: sizing.scale300,
|
|
480
|
+
paddingRight: sizing.scale300,
|
|
423
481
|
marginTop: 0,
|
|
424
482
|
marginBottom: 0,
|
|
425
483
|
marginLeft: 0,
|
|
@@ -444,10 +502,14 @@ export const StyledDay = styled<SharedStylePropsT>('div', props => {
|
|
|
444
502
|
: $pseudoSelected && $isHighlighted
|
|
445
503
|
? colors.calendarDayBackgroundPseudoSelectedHighlighted
|
|
446
504
|
: colors.calendarBackground,
|
|
447
|
-
height:
|
|
505
|
+
height: $hasDateLabel
|
|
506
|
+
? '100%'
|
|
507
|
+
: $density === DENSITY.high
|
|
508
|
+
? '42px'
|
|
509
|
+
: '50px',
|
|
448
510
|
width: '100%',
|
|
449
511
|
position: 'absolute',
|
|
450
|
-
top: 0,
|
|
512
|
+
top: $hasDateLabel ? 0 : '-1px',
|
|
451
513
|
left: 0,
|
|
452
514
|
paddingTop: sizing.scale200,
|
|
453
515
|
paddingBottom: sizing.scale200,
|
|
@@ -463,10 +525,10 @@ export const StyledDay = styled<SharedStylePropsT>('div', props => {
|
|
|
463
525
|
borderBottomColor: colors.borderSelected,
|
|
464
526
|
borderRightColor: colors.borderSelected,
|
|
465
527
|
borderLeftColor: colors.borderSelected,
|
|
466
|
-
borderTopLeftRadius: $hasDateLabel ? sizing.
|
|
467
|
-
borderTopRightRadius: $hasDateLabel ? sizing.
|
|
468
|
-
borderBottomLeftRadius: $hasDateLabel ? sizing.
|
|
469
|
-
borderBottomRightRadius: $hasDateLabel ? sizing.
|
|
528
|
+
borderTopLeftRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
529
|
+
borderTopRightRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
530
|
+
borderBottomLeftRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
531
|
+
borderBottomRightRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
470
532
|
...(getDayStyles(code, props.$theme)[':after'] || {}),
|
|
471
533
|
...($outsideMonthWithinRange ? {content: null} : {}),
|
|
472
534
|
},
|
|
@@ -527,17 +589,21 @@ export const StyledDayLabel = styled<SharedStylePropsT>('div', props => {
|
|
|
527
589
|
|
|
528
590
|
export const StyledWeekdayHeader = styled<SharedStylePropsT>('div', props => {
|
|
529
591
|
const {
|
|
530
|
-
$theme: {sizing},
|
|
592
|
+
$theme: {typography, colors, sizing},
|
|
593
|
+
$density,
|
|
531
594
|
} = props;
|
|
532
595
|
return ({
|
|
596
|
+
...typography.LabelMedium,
|
|
597
|
+
color: colors.contentTertiary,
|
|
533
598
|
boxSizing: 'border-box',
|
|
534
599
|
position: 'relative',
|
|
535
600
|
cursor: 'default',
|
|
536
601
|
display: 'inline-block',
|
|
537
|
-
width:
|
|
538
|
-
height:
|
|
539
|
-
lineHeight: sizing.scale800,
|
|
602
|
+
width: $density === DENSITY.high ? '42px' : '50px',
|
|
603
|
+
height: $density === DENSITY.high ? '40px' : '48px',
|
|
540
604
|
textAlign: 'center',
|
|
605
|
+
// setting lineHeight equal to the contents height to vertically center the text
|
|
606
|
+
lineHeight: sizing.scale900,
|
|
541
607
|
paddingTop: sizing.scale300,
|
|
542
608
|
paddingBottom: sizing.scale300,
|
|
543
609
|
paddingLeft: sizing.scale200,
|
|
@@ -546,7 +612,6 @@ export const StyledWeekdayHeader = styled<SharedStylePropsT>('div', props => {
|
|
|
546
612
|
marginBottom: 0,
|
|
547
613
|
marginLeft: 0,
|
|
548
614
|
marginRight: 0,
|
|
549
|
-
color: 'inherit',
|
|
550
615
|
backgroundColor: 'transparent',
|
|
551
616
|
}: {});
|
|
552
617
|
});
|
package/datepicker/types.js.flow
CHANGED
|
@@ -9,7 +9,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import type {OverrideT} from '../helpers/overrides.js';
|
|
11
11
|
import type {SizeT} from '../input/types.js';
|
|
12
|
-
import {ORIENTATION, STATE_CHANGE_TYPE} from './constants.js';
|
|
12
|
+
import {ORIENTATION, STATE_CHANGE_TYPE, DENSITY} from './constants.js';
|
|
13
13
|
import type {DateIOAdapter} from './utils/types.js';
|
|
14
14
|
import type {
|
|
15
15
|
TimePickerPropsT as TimePickerPropsTBase,
|
|
@@ -21,7 +21,11 @@ import type {OptionT} from '../select/index.js';
|
|
|
21
21
|
// eslint-disable-next-line flowtype/no-weak-types
|
|
22
22
|
type LocaleT = any; // see https://github.com/date-fns/date-fns/blob/master/src/locale/index.js.flow
|
|
23
23
|
|
|
24
|
-
type
|
|
24
|
+
export type DateValueT<T> = ?T | Array<?T>;
|
|
25
|
+
|
|
26
|
+
type onChangeT<T> = ({date: DateValueT<T>}) => mixed;
|
|
27
|
+
|
|
28
|
+
export type DensityT = $Keys<typeof DENSITY>;
|
|
25
29
|
|
|
26
30
|
export type DatepickerOverridesT = {
|
|
27
31
|
Root?: OverrideT,
|
|
@@ -57,12 +61,16 @@ export type DatepickerOverridesT = {
|
|
|
57
61
|
InputWrapper?: OverrideT,
|
|
58
62
|
/** Override for reused Popover component. Popover is **not a styled element** but a react component that can be replaced */
|
|
59
63
|
Popover?: OverrideT,
|
|
64
|
+
StartDate?: OverrideT,
|
|
65
|
+
EndDate?: OverrideT,
|
|
66
|
+
InputLabel?: OverrideT,
|
|
60
67
|
};
|
|
61
68
|
|
|
62
69
|
export type DayPropsT<T = Date> = {
|
|
63
70
|
disabled: boolean,
|
|
64
71
|
date: T,
|
|
65
72
|
dateLabel: ?(day: T) => React.Node,
|
|
73
|
+
density: DensityT,
|
|
66
74
|
filterDate: ?(day: T) => boolean,
|
|
67
75
|
highlightedDate: ?T,
|
|
68
76
|
includeDates: ?Array<T>,
|
|
@@ -76,13 +84,13 @@ export type DayPropsT<T = Date> = {
|
|
|
76
84
|
month: ?number,
|
|
77
85
|
onBlur: ({event: Event, date: T}) => mixed,
|
|
78
86
|
onFocus: ({event: Event, date: T}) => mixed,
|
|
79
|
-
onSelect: ({date:
|
|
87
|
+
onSelect: ({date: DateValueT<T>}) => mixed,
|
|
80
88
|
onClick: ({event: Event, date: T}) => mixed,
|
|
81
89
|
onMouseOver: ({event: Event, date: T}) => mixed,
|
|
82
90
|
onMouseLeave: ({event: Event, date: T}) => mixed,
|
|
83
91
|
overrides?: DatepickerOverridesT,
|
|
84
92
|
peekNextMonth: boolean,
|
|
85
|
-
value:
|
|
93
|
+
value: DateValueT<T>,
|
|
86
94
|
};
|
|
87
95
|
|
|
88
96
|
export type DayStateT = {
|
|
@@ -93,6 +101,7 @@ export type DayStateT = {
|
|
|
93
101
|
export type WeekPropsT<T = Date> = {
|
|
94
102
|
date: T,
|
|
95
103
|
dateLabel: ?(date: T) => React.Node,
|
|
104
|
+
density: DensityT,
|
|
96
105
|
excludeDates: ?Array<T>,
|
|
97
106
|
filterDate: ?(day: T) => boolean,
|
|
98
107
|
// highlighted while keyboard navigating or hovered
|
|
@@ -113,7 +122,7 @@ export type WeekPropsT<T = Date> = {
|
|
|
113
122
|
onChange?: onChangeT<T>,
|
|
114
123
|
overrides?: DatepickerOverridesT,
|
|
115
124
|
peekNextMonth: boolean,
|
|
116
|
-
value:
|
|
125
|
+
value: DateValueT<T>,
|
|
117
126
|
};
|
|
118
127
|
|
|
119
128
|
export type MonthPropsT<T = Date> = WeekPropsT<T> & {
|
|
@@ -126,12 +135,14 @@ export type CalendarInternalState<T = Date> = {
|
|
|
126
135
|
date: T,
|
|
127
136
|
quickSelectId: ?string,
|
|
128
137
|
rootElement: ?HTMLElement,
|
|
129
|
-
time: Array
|
|
138
|
+
time: Array<?T>,
|
|
130
139
|
};
|
|
131
140
|
|
|
132
141
|
export type CalendarPropsT<T = Date> = {
|
|
133
142
|
/** Defines if the calendar is set to be focused on an initial render. */
|
|
134
143
|
autoFocusCalendar?: boolean,
|
|
144
|
+
/** Determines the density of the calendar */
|
|
145
|
+
density?: DensityT,
|
|
135
146
|
/** A list of dates to disable. */
|
|
136
147
|
excludeDates?: ?Array<T>,
|
|
137
148
|
/** Display select for quickly choosing date ranges. `range` must be true as well. */
|
|
@@ -185,7 +196,7 @@ export type CalendarPropsT<T = Date> = {
|
|
|
185
196
|
/** Defines if tabbing inside the calendar is circled within it. */
|
|
186
197
|
trapTabbing?: boolean,
|
|
187
198
|
/** Currently selected date. */
|
|
188
|
-
value?:
|
|
199
|
+
value?: DateValueT<T>,
|
|
189
200
|
fixedHeight?: boolean,
|
|
190
201
|
};
|
|
191
202
|
|
|
@@ -213,24 +224,32 @@ export type DatepickerPropsT<T = Date> = CalendarPropsT<T> & {
|
|
|
213
224
|
required?: boolean,
|
|
214
225
|
clearable?: boolean,
|
|
215
226
|
displayValueAtRangeIndex?: number,
|
|
216
|
-
formatDisplayValue?: (date:
|
|
227
|
+
formatDisplayValue?: (date: DateValueT<T>, formatString: string) => string,
|
|
217
228
|
formatString: string,
|
|
218
229
|
/** Where to mount the popover */
|
|
219
230
|
mountNode?: HTMLElement,
|
|
220
231
|
/** Called when calendar is closed */
|
|
221
232
|
onClose?: () => mixed,
|
|
233
|
+
/** Called when calendar is opened */
|
|
234
|
+
onOpen?: () => mixed,
|
|
222
235
|
mask?: string | null,
|
|
236
|
+
/** Determines if startDate and endDate should be separated into two input fields. Ignored if `range` is not true. */
|
|
237
|
+
separateRangeInputs?: boolean,
|
|
238
|
+
startDateLabel?: string,
|
|
239
|
+
endDateLabel?: string,
|
|
223
240
|
};
|
|
224
241
|
|
|
225
242
|
export type SharedStylePropsT = {
|
|
226
243
|
// eslint-disable-next-line flowtype/no-weak-types
|
|
227
244
|
$date: any,
|
|
228
245
|
$disabled: ?boolean,
|
|
246
|
+
$density: DensityT,
|
|
229
247
|
$endDate: ?boolean,
|
|
230
248
|
$endOfMonth: ?boolean,
|
|
231
249
|
$isHighlighted: ?boolean,
|
|
232
250
|
$isHovered: ?boolean,
|
|
233
251
|
$isFocusVisible: ?boolean,
|
|
252
|
+
$month: ?number,
|
|
234
253
|
$outsideMonth: ?boolean,
|
|
235
254
|
$outsideMonthWithinRange: ?boolean,
|
|
236
255
|
$peekNextMonth: ?boolean,
|
|
@@ -251,7 +270,7 @@ export type StateChangeTypeT = ?$Values<typeof STATE_CHANGE_TYPE>;
|
|
|
251
270
|
|
|
252
271
|
export type ContainerStateT<T = Date> = {
|
|
253
272
|
/** Selected `Date`. If `range` is set, `value` is an array of 2 values. */
|
|
254
|
-
value?:
|
|
273
|
+
value?: DateValueT<T>,
|
|
255
274
|
};
|
|
256
275
|
|
|
257
276
|
export type NavigationContainerStateT<T = Date> = {
|
|
@@ -307,7 +326,7 @@ export type NavigationContainerPropsT<T = Date> = {
|
|
|
307
326
|
/** Event handler that is called when the current rendered year is changed. */
|
|
308
327
|
onYearChange?: ({date: T}) => mixed,
|
|
309
328
|
/** Selected `Date`. If `range` is set, `value` is an array of 2 values. */
|
|
310
|
-
value?:
|
|
329
|
+
value?: DateValueT<T>,
|
|
311
330
|
stateReducer: NavigationContainerStateReducerT<T>,
|
|
312
331
|
trapTabbing: boolean,
|
|
313
332
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getFilteredMonthItems = exports.filterMonthItems = void 0;
|
|
7
|
+
|
|
8
|
+
var _constants = require("../constants.js");
|
|
9
|
+
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
+
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
13
|
+
|
|
14
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
|
|
16
|
+
var getDefaultMonthItems = function getDefaultMonthItems(formatMonthLabel) {
|
|
17
|
+
return _constants.DEFAULT_MONTHS.map(function (month) {
|
|
18
|
+
return {
|
|
19
|
+
id: month.toString(),
|
|
20
|
+
label: formatMonthLabel(month)
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var filterMonthItems = function filterMonthItems(monthItems, filterList) {
|
|
26
|
+
return monthItems.map(function (month) {
|
|
27
|
+
if (!filterList.includes(Number(month.id))) {
|
|
28
|
+
return _objectSpread(_objectSpread({}, month), {}, {
|
|
29
|
+
disabled: true
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return month;
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.filterMonthItems = filterMonthItems;
|
|
38
|
+
|
|
39
|
+
var getFilteredMonthItems = function getFilteredMonthItems(_ref) {
|
|
40
|
+
var filterMonthsList = _ref.filterMonthsList,
|
|
41
|
+
formatMonthLabel = _ref.formatMonthLabel;
|
|
42
|
+
var monthItems = getDefaultMonthItems(formatMonthLabel);
|
|
43
|
+
|
|
44
|
+
if (filterMonthsList) {
|
|
45
|
+
monthItems = filterMonthItems(monthItems, filterMonthsList);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return monthItems;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.getFilteredMonthItems = getFilteredMonthItems;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) Uber Technologies, Inc.
|
|
3
|
+
|
|
4
|
+
This source code is licensed under the MIT license found in the
|
|
5
|
+
LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
// @flow
|
|
8
|
+
import {DEFAULT_MONTHS} from '../constants.js';
|
|
9
|
+
|
|
10
|
+
export type OptionT = {
|
|
11
|
+
id: string,
|
|
12
|
+
label: string,
|
|
13
|
+
disabled?: boolean,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type GetMonthItemsArgsT = {
|
|
17
|
+
filterMonthsList: number[] | null,
|
|
18
|
+
formatMonthLabel: number => string,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const getDefaultMonthItems = (formatMonthLabel: number => string) =>
|
|
22
|
+
DEFAULT_MONTHS.map<OptionT>(month => ({
|
|
23
|
+
id: month.toString(),
|
|
24
|
+
label: formatMonthLabel(month),
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
export const filterMonthItems = (monthItems: OptionT[], filterList: number[]) =>
|
|
28
|
+
monthItems.map<OptionT>(month => {
|
|
29
|
+
if (!filterList.includes(Number(month.id))) {
|
|
30
|
+
return {
|
|
31
|
+
...month,
|
|
32
|
+
disabled: true,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return month;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const getFilteredMonthItems = ({
|
|
39
|
+
filterMonthsList,
|
|
40
|
+
formatMonthLabel,
|
|
41
|
+
}: GetMonthItemsArgsT) => {
|
|
42
|
+
let monthItems = getDefaultMonthItems(formatMonthLabel);
|
|
43
|
+
|
|
44
|
+
if (filterMonthsList) {
|
|
45
|
+
monthItems = filterMonthItems(monthItems, filterMonthsList);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return monthItems;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
declare var __DEV__: boolean;
|
|
52
|
+
declare var __NODE__: boolean;
|
|
53
|
+
declare var __BROWSER__: boolean;
|
package/datepicker/week.js
CHANGED
|
@@ -92,6 +92,7 @@ var Week = /*#__PURE__*/function (_React$Component) {
|
|
|
92
92
|
adapter: _this.props.adapter,
|
|
93
93
|
date: day,
|
|
94
94
|
dateLabel: _this.props.dateLabel,
|
|
95
|
+
density: _this.props.density,
|
|
95
96
|
disabled: _this.dateHelpers.isDayDisabled(day, _this.props),
|
|
96
97
|
excludeDates: _this.props.excludeDates,
|
|
97
98
|
filterDate: _this.props.filterDate,
|
package/datepicker/week.js.flow
CHANGED
|
@@ -52,6 +52,7 @@ export default class Week<T = Date> extends React.Component<WeekPropsT<T>> {
|
|
|
52
52
|
adapter={this.props.adapter}
|
|
53
53
|
date={day}
|
|
54
54
|
dateLabel={this.props.dateLabel}
|
|
55
|
+
density={this.props.density}
|
|
55
56
|
disabled={this.dateHelpers.isDayDisabled(day, this.props)}
|
|
56
57
|
excludeDates={this.props.excludeDates}
|
|
57
58
|
filterDate={this.props.filterDate}
|
package/dnd-list/index.js.flow
CHANGED
|
@@ -5,7 +5,8 @@ This source code is licensed under the MIT license found in the
|
|
|
5
5
|
LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
// @flow
|
|
8
|
-
|
|
8
|
+
import {arrayMove, arrayRemove} from 'react-movable';
|
|
9
|
+
export {arrayMove, arrayRemove};
|
|
9
10
|
export {default as StatefulList} from './stateful-list.js';
|
|
10
11
|
export {default as StatefulListContainer} from './stateful-list-container.js';
|
|
11
12
|
export {default as List} from './list.js';
|
package/dnd-list/list.js
CHANGED
|
@@ -220,8 +220,7 @@ var StatelessList = /*#__PURE__*/function (_React$Component) {
|
|
|
220
220
|
display: 'flex'
|
|
221
221
|
})
|
|
222
222
|
}), /*#__PURE__*/React.createElement(DragHandle, _extends({}, sharedProps, dragHandleProps), /*#__PURE__*/React.createElement(_grab.default, {
|
|
223
|
-
size: 24
|
|
224
|
-
color: "#CCC"
|
|
223
|
+
size: 24
|
|
225
224
|
})), /*#__PURE__*/React.createElement(Label, _extends({}, sharedProps, labelProps), value), removable && /*#__PURE__*/React.createElement(CloseHandle, _extends({}, sharedProps, {
|
|
226
225
|
onClick: function onClick(evt) {
|
|
227
226
|
evt.preventDefault();
|
package/dnd-list/list.js.flow
CHANGED
|
@@ -136,7 +136,7 @@ class StatelessList extends React.Component<
|
|
|
136
136
|
style={{...props.style, display: 'flex'}}
|
|
137
137
|
>
|
|
138
138
|
<DragHandle {...sharedProps} {...dragHandleProps}>
|
|
139
|
-
<Grab size={24}
|
|
139
|
+
<Grab size={24} />
|
|
140
140
|
</DragHandle>
|
|
141
141
|
<Label {...sharedProps} {...labelProps}>
|
|
142
142
|
{value}
|
|
@@ -94,7 +94,7 @@ var DragHandle = (0, _index.styled)('div', function (_ref4) {
|
|
|
94
94
|
|
|
95
95
|
var $theme = _ref4.$theme;
|
|
96
96
|
var marginDir = $theme.direction === 'rtl' ? 'marginLeft' : 'marginRight';
|
|
97
|
-
return _ref5 = {}, _defineProperty(_ref5, marginDir, $theme.sizing.scale600), _defineProperty(_ref5, "width", $theme.sizing.scale800), _defineProperty(_ref5, "display", 'flex'), _defineProperty(_ref5, "alignItems", 'center'), _ref5;
|
|
97
|
+
return _ref5 = {}, _defineProperty(_ref5, marginDir, $theme.sizing.scale600), _defineProperty(_ref5, "width", $theme.sizing.scale800), _defineProperty(_ref5, "color", '#CCC'), _defineProperty(_ref5, "display", 'flex'), _defineProperty(_ref5, "alignItems", 'center'), _ref5;
|
|
98
98
|
});
|
|
99
99
|
exports.DragHandle = DragHandle;
|
|
100
100
|
DragHandle.displayName = "DragHandle";
|
package/drawer/drawer.js
CHANGED
|
@@ -342,7 +342,8 @@ var Drawer = /*#__PURE__*/function (_React$Component) {
|
|
|
342
342
|
return /*#__PURE__*/React.createElement(_index.LocaleContext.Consumer, null, function (locale) {
|
|
343
343
|
return /*#__PURE__*/React.createElement(_reactFocusLock.default, {
|
|
344
344
|
returnFocus: true,
|
|
345
|
-
autoFocus: autoFocus
|
|
345
|
+
autoFocus: autoFocus,
|
|
346
|
+
noFocusGuards: true
|
|
346
347
|
}, /*#__PURE__*/React.createElement(Root, _extends({
|
|
347
348
|
"data-baseweb": "drawer",
|
|
348
349
|
ref: _this3.getRef('Root')
|
package/drawer/drawer.js.flow
CHANGED
|
@@ -253,7 +253,7 @@ class Drawer extends React.Component<DrawerPropsT, DrawerStateT> {
|
|
|
253
253
|
<LocaleContext.Consumer>
|
|
254
254
|
{locale => {
|
|
255
255
|
return (
|
|
256
|
-
<FocusLock returnFocus autoFocus={autoFocus}>
|
|
256
|
+
<FocusLock returnFocus autoFocus={autoFocus} noFocusGuards={true}>
|
|
257
257
|
<Root
|
|
258
258
|
data-baseweb="drawer"
|
|
259
259
|
ref={this.getRef('Root')}
|
|
@@ -39,7 +39,7 @@ export const BaseButton = styled('button', ({
|
|
|
39
39
|
cursor: 'pointer',
|
|
40
40
|
':disabled': {
|
|
41
41
|
cursor: 'not-allowed',
|
|
42
|
-
backgroundColor: $theme.colors.buttonDisabledFill,
|
|
42
|
+
backgroundColor: $kind === KIND.minimal || $kind === KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
|
|
43
43
|
color: $theme.colors.buttonDisabledText
|
|
44
44
|
},
|
|
45
45
|
marginLeft: 0,
|