baseui 10.4.0 → 10.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +2 -0
- package/data-table/column-datetime.js.flow +2 -0
- package/datepicker/calendar-header.js +255 -109
- package/datepicker/calendar-header.js.flow +282 -145
- package/datepicker/calendar.js +6 -1
- package/datepicker/calendar.js.flow +5 -1
- package/datepicker/constants.js +9 -2
- package/datepicker/constants.js.flow +7 -0
- package/datepicker/datepicker.js +135 -73
- package/datepicker/datepicker.js.flow +161 -62
- package/datepicker/day.js +2 -0
- package/datepicker/day.js.flow +2 -0
- package/datepicker/index.d.ts +8 -0
- package/datepicker/month.js +4 -0
- package/datepicker/month.js.flow +3 -0
- package/datepicker/styled-components.js +116 -56
- package/datepicker/styled-components.js.flow +101 -36
- package/datepicker/types.js.flow +18 -1
- 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 +2 -0
- package/es/datepicker/calendar-header.js +204 -93
- package/es/datepicker/calendar.js +7 -2
- package/es/datepicker/constants.js +6 -1
- package/es/datepicker/datepicker.js +70 -42
- package/es/datepicker/day.js +2 -0
- 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 +2 -0
- package/esm/datepicker/calendar-header.js +255 -110
- package/esm/datepicker/calendar.js +7 -2
- package/esm/datepicker/constants.js +6 -1
- package/esm/datepicker/datepicker.js +136 -74
- package/esm/datepicker/day.js +2 -0
- 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
|
@@ -15,10 +15,27 @@ import Calendar from './calendar.js';
|
|
|
15
15
|
import { getOverrides } from '../helpers/overrides.js';
|
|
16
16
|
import getInterpolatedString from '../helpers/i18n-interpolation.js';
|
|
17
17
|
import { LocaleContext } from '../locale/index.js';
|
|
18
|
-
import { StyledInputWrapper } from './styled-components.js';
|
|
18
|
+
import { StyledInputWrapper, StyledInputLabel, StyledStartDate, StyledEndDate } from './styled-components.js';
|
|
19
19
|
import DateHelpers from './utils/date-helpers.js';
|
|
20
20
|
import dateFnsAdapter from './utils/date-fns-adapter.js';
|
|
21
21
|
export const DEFAULT_DATE_FORMAT = 'yyyy/MM/dd';
|
|
22
|
+
const INPUT_DELIMITER = ' – ';
|
|
23
|
+
|
|
24
|
+
const combineSeparatedInputs = (newInputValue, prevCombinedInputValue = '', separatedInput) => {
|
|
25
|
+
let inputValue = newInputValue;
|
|
26
|
+
const [prevStartDate = '', prevEndDate = ''] = prevCombinedInputValue.split(INPUT_DELIMITER);
|
|
27
|
+
|
|
28
|
+
if (separatedInput === 'startDate' && prevEndDate) {
|
|
29
|
+
inputValue = `${inputValue} – ${prevEndDate}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (separatedInput === 'endDate') {
|
|
33
|
+
inputValue = `${prevStartDate} – ${inputValue}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return inputValue;
|
|
37
|
+
};
|
|
38
|
+
|
|
22
39
|
export default class Datepicker extends React.Component {
|
|
23
40
|
constructor(props) {
|
|
24
41
|
super(props);
|
|
@@ -134,7 +151,7 @@ export default class Datepicker extends React.Component {
|
|
|
134
151
|
isOpen: true,
|
|
135
152
|
isPseudoFocused: true,
|
|
136
153
|
calendarFocused: false
|
|
137
|
-
});
|
|
154
|
+
}, this.props.onOpen);
|
|
138
155
|
});
|
|
139
156
|
|
|
140
157
|
_defineProperty(this, "close", () => {
|
|
@@ -164,10 +181,11 @@ export default class Datepicker extends React.Component {
|
|
|
164
181
|
const {
|
|
165
182
|
formatString,
|
|
166
183
|
mask,
|
|
167
|
-
range
|
|
184
|
+
range,
|
|
185
|
+
separateRangeInputs
|
|
168
186
|
} = this.props;
|
|
169
187
|
|
|
170
|
-
if (mask === null) {
|
|
188
|
+
if (mask === null || mask === undefined && formatString !== DEFAULT_DATE_FORMAT) {
|
|
171
189
|
return null;
|
|
172
190
|
}
|
|
173
191
|
|
|
@@ -175,26 +193,17 @@ export default class Datepicker extends React.Component {
|
|
|
175
193
|
return this.normalizeDashes(mask);
|
|
176
194
|
}
|
|
177
195
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (formatString) {
|
|
181
|
-
if (range) {
|
|
182
|
-
return `${normalizedFormatString} – ${normalizedFormatString}`.replace(/[a-z]/gi, '9');
|
|
183
|
-
} else {
|
|
184
|
-
return normalizedFormatString.replace(/[a-z]/gi, '9');
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (range) {
|
|
196
|
+
if (range && !separateRangeInputs) {
|
|
189
197
|
return '9999/99/99 – 9999/99/99';
|
|
190
198
|
}
|
|
191
199
|
|
|
192
200
|
return '9999/99/99';
|
|
193
201
|
});
|
|
194
202
|
|
|
195
|
-
_defineProperty(this, "handleInputChange", event => {
|
|
196
|
-
const inputValue = event.currentTarget.value;
|
|
203
|
+
_defineProperty(this, "handleInputChange", (event, separatedInput) => {
|
|
204
|
+
const inputValue = this.props.range && this.props.separateRangeInputs ? combineSeparatedInputs(event.currentTarget.value, this.state.inputValue, separatedInput) : event.currentTarget.value;
|
|
197
205
|
const mask = this.getMask();
|
|
206
|
+
const formatString = this.normalizeDashes(this.props.formatString);
|
|
198
207
|
|
|
199
208
|
if (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ') || inputValue.length === 0) {
|
|
200
209
|
if (this.props.onChange) {
|
|
@@ -213,7 +222,6 @@ export default class Datepicker extends React.Component {
|
|
|
213
222
|
this.setState({
|
|
214
223
|
inputValue
|
|
215
224
|
});
|
|
216
|
-
const formatString = this.normalizeDashes(this.props.formatString);
|
|
217
225
|
|
|
218
226
|
const parseDateString = dateString => {
|
|
219
227
|
if (formatString === DEFAULT_DATE_FORMAT) {
|
|
@@ -224,7 +232,7 @@ export default class Datepicker extends React.Component {
|
|
|
224
232
|
};
|
|
225
233
|
|
|
226
234
|
if (this.props.range && typeof this.props.displayValueAtRangeIndex !== 'number') {
|
|
227
|
-
const [left, right] = this.normalizeDashes(inputValue).split(
|
|
235
|
+
const [left, right] = this.normalizeDashes(inputValue).split(INPUT_DELIMITER);
|
|
228
236
|
let startDate = this.dateHelpers.date(left);
|
|
229
237
|
let endDate = this.dateHelpers.date(right);
|
|
230
238
|
|
|
@@ -372,7 +380,7 @@ export default class Datepicker extends React.Component {
|
|
|
372
380
|
} else if (Array.isArray(date) && !date[0] && !date[1]) {
|
|
373
381
|
return '';
|
|
374
382
|
} else if (Array.isArray(date)) {
|
|
375
|
-
return date.map(day => format(day)).join(
|
|
383
|
+
return date.map(day => format(day)).join(INPUT_DELIMITER);
|
|
376
384
|
} else {
|
|
377
385
|
return format(date);
|
|
378
386
|
}
|
|
@@ -386,16 +394,53 @@ export default class Datepicker extends React.Component {
|
|
|
386
394
|
}
|
|
387
395
|
}
|
|
388
396
|
|
|
389
|
-
|
|
397
|
+
renderInputComponent(locale, separatedInput) {
|
|
390
398
|
const {
|
|
391
399
|
overrides = {}
|
|
392
400
|
} = this.props;
|
|
393
401
|
const [InputComponent, inputProps] = getOverrides(overrides.Input, MaskedInput);
|
|
402
|
+
const placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range && !this.props.separateRangeInputs ? 'YYYY/MM/DD – YYYY/MM/DD' : 'YYYY/MM/DD';
|
|
403
|
+
const [startDate = '', endDate = ''] = (this.state.inputValue || '').split(INPUT_DELIMITER);
|
|
404
|
+
const value = separatedInput === 'startDate' ? startDate : separatedInput === 'endDate' ? endDate : this.state.inputValue;
|
|
405
|
+
|
|
406
|
+
const onChange = event => this.handleInputChange(event, separatedInput);
|
|
407
|
+
|
|
408
|
+
return /*#__PURE__*/React.createElement(InputComponent, _extends({
|
|
409
|
+
"aria-disabled": this.props.disabled,
|
|
410
|
+
"aria-label": this.props['aria-label'] || (this.props.range ? locale.datepicker.ariaLabelRange : locale.datepicker.ariaLabel),
|
|
411
|
+
error: this.props.error,
|
|
412
|
+
positive: this.props.positive,
|
|
413
|
+
"aria-describedby": this.props['aria-describedby'],
|
|
414
|
+
"aria-labelledby": this.props['aria-labelledby'],
|
|
415
|
+
"aria-required": this.props.required || null,
|
|
416
|
+
disabled: this.props.disabled,
|
|
417
|
+
size: this.props.size,
|
|
418
|
+
value: value,
|
|
419
|
+
onFocus: this.open,
|
|
420
|
+
onBlur: this.handleInputBlur,
|
|
421
|
+
onKeyDown: this.handleKeyDown,
|
|
422
|
+
onChange: onChange,
|
|
423
|
+
placeholder: placeholder,
|
|
424
|
+
mask: this.getMask(),
|
|
425
|
+
required: this.props.required,
|
|
426
|
+
clearable: this.props.clearable
|
|
427
|
+
}, inputProps));
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
render() {
|
|
431
|
+
const {
|
|
432
|
+
overrides = {},
|
|
433
|
+
startDateLabel = 'Start Date',
|
|
434
|
+
endDateLabel = 'End Date'
|
|
435
|
+
} = this.props;
|
|
394
436
|
const [PopoverComponent, popoverProps] = getOverrides(overrides.Popover, Popover);
|
|
395
437
|
const [InputWrapper, inputWrapperProps] = getOverrides(overrides.InputWrapper, StyledInputWrapper);
|
|
396
|
-
const
|
|
438
|
+
const [StartDate, startDateProps] = getOverrides(overrides.StartDate, StyledStartDate);
|
|
439
|
+
const [EndDate, endDateProps] = getOverrides(overrides.EndDate, StyledEndDate);
|
|
440
|
+
const [InputLabel, inputLabelProps] = getOverrides(overrides.InputLabel, StyledInputLabel);
|
|
397
441
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, locale => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PopoverComponent, _extends({
|
|
398
442
|
focusLock: false,
|
|
443
|
+
autoFocus: false,
|
|
399
444
|
mountNode: this.props.mountNode,
|
|
400
445
|
placement: PLACEMENT.bottom,
|
|
401
446
|
isOpen: this.state.isOpen,
|
|
@@ -409,26 +454,9 @@ export default class Datepicker extends React.Component {
|
|
|
409
454
|
}, this.props, {
|
|
410
455
|
onChange: this.onChange
|
|
411
456
|
}))
|
|
412
|
-
}, popoverProps), /*#__PURE__*/React.createElement(InputWrapper,
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
error: this.props.error,
|
|
416
|
-
positive: this.props.positive,
|
|
417
|
-
"aria-describedby": this.props['aria-describedby'],
|
|
418
|
-
"aria-labelledby": this.props['aria-labelledby'],
|
|
419
|
-
"aria-required": this.props.required || null,
|
|
420
|
-
disabled: this.props.disabled,
|
|
421
|
-
size: this.props.size,
|
|
422
|
-
value: this.state.inputValue,
|
|
423
|
-
onFocus: this.open,
|
|
424
|
-
onBlur: this.handleInputBlur,
|
|
425
|
-
onKeyDown: this.handleKeyDown,
|
|
426
|
-
onChange: this.handleInputChange,
|
|
427
|
-
placeholder: placeholder,
|
|
428
|
-
mask: this.getMask(),
|
|
429
|
-
required: this.props.required,
|
|
430
|
-
clearable: this.props.clearable
|
|
431
|
-
}, inputProps)))), /*#__PURE__*/React.createElement("p", {
|
|
457
|
+
}, popoverProps), /*#__PURE__*/React.createElement(InputWrapper, _extends({}, inputWrapperProps, {
|
|
458
|
+
$separateRangeInputs: this.props.range && this.props.separateRangeInputs
|
|
459
|
+
}), this.props.range && this.props.separateRangeInputs ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StartDate, startDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, startDateLabel), this.renderInputComponent(locale, 'startDate')), /*#__PURE__*/React.createElement(EndDate, endDateProps, /*#__PURE__*/React.createElement(InputLabel, inputLabelProps, endDateLabel), this.renderInputComponent(locale, 'endDate'))) : /*#__PURE__*/React.createElement(React.Fragment, null, this.renderInputComponent(locale)))), /*#__PURE__*/React.createElement("p", {
|
|
432
460
|
id: this.props['aria-describedby'],
|
|
433
461
|
style: {
|
|
434
462
|
position: 'fixed',
|
package/es/datepicker/day.js
CHANGED
|
@@ -280,6 +280,7 @@ export default class Day extends React.Component {
|
|
|
280
280
|
const $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !this.props.peekNextMonth && this.isOutsideOfMonthButWithinRange());
|
|
281
281
|
return {
|
|
282
282
|
$date: date,
|
|
283
|
+
$density: this.props.density,
|
|
283
284
|
$disabled: this.props.disabled,
|
|
284
285
|
$endDate: Array.isArray(value) && this.props.range && $selected && this.dateHelpers.isSameDay(date, value[1]) || false,
|
|
285
286
|
$hasDateLabel: !!this.props.dateLabel,
|
|
@@ -292,6 +293,7 @@ export default class Day extends React.Component {
|
|
|
292
293
|
$isFocusVisible: this.state.isFocusVisible,
|
|
293
294
|
$startOfMonth: this.dateHelpers.isStartOfMonth(date),
|
|
294
295
|
$endOfMonth: this.dateHelpers.isEndOfMonth(date),
|
|
296
|
+
$month: this.getMonthProp(),
|
|
295
297
|
$outsideMonth,
|
|
296
298
|
$outsideMonthWithinRange,
|
|
297
299
|
$peekNextMonth: this.props.peekNextMonth,
|
package/es/datepicker/month.js
CHANGED
|
@@ -12,8 +12,10 @@ import { StyledMonth } from './styled-components.js';
|
|
|
12
12
|
import dateFnsAdapter from './utils/date-fns-adapter.js';
|
|
13
13
|
import DateHelpers from './utils/date-helpers.js';
|
|
14
14
|
import { getOverrides } from '../helpers/overrides.js';
|
|
15
|
+
import { DENSITY } from './constants.js';
|
|
15
16
|
const defaultProps = {
|
|
16
17
|
dateLabel: null,
|
|
18
|
+
density: DENSITY.high,
|
|
17
19
|
excludeDates: null,
|
|
18
20
|
filterDate: null,
|
|
19
21
|
highlightDates: null,
|
|
@@ -60,6 +62,7 @@ export default class CalendarMonth extends React.Component {
|
|
|
60
62
|
adapter: this.props.adapter,
|
|
61
63
|
date: currentWeekStart,
|
|
62
64
|
dateLabel: this.props.dateLabel,
|
|
65
|
+
density: this.props.density,
|
|
63
66
|
excludeDates: this.props.excludeDates,
|
|
64
67
|
filterDate: this.props.filterDate,
|
|
65
68
|
highlightedDate: this.props.highlightedDate,
|
|
@@ -6,19 +6,47 @@ LICENSE file in the root directory of this source tree.
|
|
|
6
6
|
*/
|
|
7
7
|
import { styled } from '../styles/index.js';
|
|
8
8
|
import getDayStateCode from './utils/day-state.js';
|
|
9
|
-
import { ORIENTATION } from './constants.js';
|
|
9
|
+
import { ORIENTATION, DENSITY } from './constants.js';
|
|
10
10
|
/**
|
|
11
11
|
* Main component container element
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
export const StyledInputWrapper = styled('div',
|
|
14
|
+
export const StyledInputWrapper = styled('div', props => {
|
|
15
|
+
const {
|
|
16
|
+
$separateRangeInputs
|
|
17
|
+
} = props;
|
|
18
|
+
return {
|
|
19
|
+
width: '100%',
|
|
20
|
+
...($separateRangeInputs ? {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
justifyContent: 'center'
|
|
23
|
+
} : {})
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
StyledInputWrapper.displayName = "StyledInputWrapper";
|
|
27
|
+
export const StyledInputLabel = styled('div', ({
|
|
28
|
+
$theme
|
|
29
|
+
}) => ({ ...$theme.typography.LabelMedium,
|
|
30
|
+
marginBottom: $theme.sizing.scale300
|
|
31
|
+
}));
|
|
32
|
+
StyledInputLabel.displayName = "StyledInputLabel";
|
|
33
|
+
export const StyledStartDate = styled('div', ({
|
|
34
|
+
$theme
|
|
35
|
+
}) => ({
|
|
36
|
+
width: '100%',
|
|
37
|
+
marginRight: $theme.sizing.scale300
|
|
38
|
+
}));
|
|
39
|
+
StyledStartDate.displayName = "StyledStartDate";
|
|
40
|
+
export const StyledEndDate = styled('div', ({
|
|
41
|
+
$theme
|
|
42
|
+
}) => ({
|
|
15
43
|
width: '100%'
|
|
16
44
|
}));
|
|
17
45
|
/**
|
|
18
46
|
* Main component container element
|
|
19
47
|
*/
|
|
20
48
|
|
|
21
|
-
|
|
49
|
+
StyledEndDate.displayName = "StyledEndDate";
|
|
22
50
|
export const StyledRoot = styled('div', props => {
|
|
23
51
|
const {
|
|
24
52
|
$theme: {
|
|
@@ -53,13 +81,14 @@ export const StyledCalendarContainer = styled('div', props => {
|
|
|
53
81
|
const {
|
|
54
82
|
$theme: {
|
|
55
83
|
sizing
|
|
56
|
-
}
|
|
84
|
+
},
|
|
85
|
+
$density
|
|
57
86
|
} = props;
|
|
58
87
|
return {
|
|
59
|
-
paddingTop: sizing.
|
|
60
|
-
paddingBottom: sizing.
|
|
61
|
-
paddingLeft: sizing.
|
|
62
|
-
paddingRight: sizing.
|
|
88
|
+
paddingTop: sizing.scale300,
|
|
89
|
+
paddingBottom: $density === DENSITY.high ? sizing.scale400 : sizing.scale300,
|
|
90
|
+
paddingLeft: sizing.scale500,
|
|
91
|
+
paddingRight: sizing.scale500
|
|
63
92
|
};
|
|
64
93
|
});
|
|
65
94
|
StyledCalendarContainer.displayName = "StyledCalendarContainer";
|
|
@@ -78,18 +107,20 @@ StyledSelectorContainer.displayName = "StyledSelectorContainer";
|
|
|
78
107
|
export const StyledCalendarHeader = styled('div', props => {
|
|
79
108
|
const {
|
|
80
109
|
$theme: {
|
|
110
|
+
typography,
|
|
81
111
|
borders,
|
|
82
112
|
colors,
|
|
83
113
|
sizing
|
|
84
|
-
}
|
|
114
|
+
},
|
|
115
|
+
$density
|
|
85
116
|
} = props;
|
|
86
|
-
return {
|
|
117
|
+
return { ...($density === DENSITY.high ? typography.LabelMedium : typography.LabelLarge),
|
|
87
118
|
color: colors.calendarHeaderForeground,
|
|
88
119
|
display: 'flex',
|
|
89
120
|
justifyContent: 'space-between',
|
|
90
121
|
alignItems: 'center',
|
|
91
|
-
paddingTop: sizing.
|
|
92
|
-
paddingBottom: sizing.
|
|
122
|
+
paddingTop: sizing.scale600,
|
|
123
|
+
paddingBottom: sizing.scale300,
|
|
93
124
|
paddingLeft: sizing.scale600,
|
|
94
125
|
paddingRight: sizing.scale600,
|
|
95
126
|
backgroundColor: colors.calendarHeaderBackground,
|
|
@@ -98,7 +129,7 @@ export const StyledCalendarHeader = styled('div', props => {
|
|
|
98
129
|
borderBottomRightRadius: 0,
|
|
99
130
|
borderBottomLeftRadius: 0,
|
|
100
131
|
// account for the left/right arrow heights
|
|
101
|
-
minHeight: `calc(${sizing.scale800} + ${sizing.scale0})`
|
|
132
|
+
minHeight: $density === DENSITY.high ? `calc(${sizing.scale800} + ${sizing.scale0})` : sizing.scale950
|
|
102
133
|
};
|
|
103
134
|
});
|
|
104
135
|
StyledCalendarHeader.displayName = "StyledCalendarHeader";
|
|
@@ -111,19 +142,27 @@ export const StyledMonthHeader = styled('div', props => {
|
|
|
111
142
|
});
|
|
112
143
|
StyledMonthHeader.displayName = "StyledMonthHeader";
|
|
113
144
|
export const StyledMonthYearSelectButton = styled('button', props => {
|
|
114
|
-
|
|
145
|
+
const {
|
|
146
|
+
$theme: {
|
|
147
|
+
typography,
|
|
148
|
+
colors
|
|
149
|
+
},
|
|
150
|
+
$isFocusVisible,
|
|
151
|
+
$density
|
|
152
|
+
} = props;
|
|
153
|
+
return { ...($density === DENSITY.high ? typography.LabelMedium : typography.LabelLarge),
|
|
115
154
|
alignItems: 'center',
|
|
116
155
|
backgroundColor: 'transparent',
|
|
117
156
|
borderLeftWidth: 0,
|
|
118
157
|
borderRightWidth: 0,
|
|
119
158
|
borderTopWidth: 0,
|
|
120
159
|
borderBottomWidth: 0,
|
|
121
|
-
color:
|
|
160
|
+
color: colors.calendarHeaderForeground,
|
|
122
161
|
cursor: 'pointer',
|
|
123
162
|
display: 'flex',
|
|
124
163
|
outline: 'none',
|
|
125
164
|
':focus': {
|
|
126
|
-
boxShadow:
|
|
165
|
+
boxShadow: $isFocusVisible ? `0 0 0 3px ${colors.accent}` : 'none'
|
|
127
166
|
}
|
|
128
167
|
};
|
|
129
168
|
});
|
|
@@ -145,6 +184,7 @@ function getArrowBtnStyle({
|
|
|
145
184
|
}) {
|
|
146
185
|
return {
|
|
147
186
|
boxSizing: 'border-box',
|
|
187
|
+
display: 'flex',
|
|
148
188
|
color: $disabled ? $theme.colors.calendarHeaderForegroundDisabled : $theme.colors.calendarHeaderForeground,
|
|
149
189
|
cursor: $disabled ? 'default' : 'pointer',
|
|
150
190
|
backgroundColor: 'transparent',
|
|
@@ -156,8 +196,6 @@ function getArrowBtnStyle({
|
|
|
156
196
|
paddingBottom: '0',
|
|
157
197
|
paddingLeft: '0',
|
|
158
198
|
paddingRight: '0',
|
|
159
|
-
marginLeft: '6px',
|
|
160
|
-
marginRight: '6px',
|
|
161
199
|
marginBottom: 0,
|
|
162
200
|
marginTop: 0,
|
|
163
201
|
outline: 'none',
|
|
@@ -186,7 +224,7 @@ export const StyledWeek = styled('div', props => {
|
|
|
186
224
|
return {
|
|
187
225
|
whiteSpace: 'nowrap',
|
|
188
226
|
display: 'flex',
|
|
189
|
-
marginBottom: sizing.
|
|
227
|
+
marginBottom: sizing.scale0
|
|
190
228
|
};
|
|
191
229
|
});
|
|
192
230
|
StyledWeek.displayName = "StyledWeek";
|
|
@@ -408,26 +446,45 @@ export const StyledDay = styled('div', props => {
|
|
|
408
446
|
$outsideMonth,
|
|
409
447
|
$outsideMonthWithinRange,
|
|
410
448
|
$hasDateLabel,
|
|
449
|
+
$density,
|
|
411
450
|
$theme: {
|
|
412
451
|
colors,
|
|
452
|
+
typography,
|
|
413
453
|
sizing
|
|
414
454
|
}
|
|
415
455
|
} = props;
|
|
416
456
|
const code = getDayStateCode(props);
|
|
417
|
-
|
|
457
|
+
let height;
|
|
458
|
+
|
|
459
|
+
if ($hasDateLabel) {
|
|
460
|
+
if ($density === DENSITY.high) {
|
|
461
|
+
height = '60px';
|
|
462
|
+
} else {
|
|
463
|
+
height = '70px';
|
|
464
|
+
}
|
|
465
|
+
} else {
|
|
466
|
+
if ($density === DENSITY.high) {
|
|
467
|
+
height = '40px';
|
|
468
|
+
} else {
|
|
469
|
+
height = '48px';
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return { ...($density === DENSITY.high ? typography.ParagraphSmall : typography.ParagraphMedium),
|
|
418
474
|
boxSizing: 'border-box',
|
|
419
475
|
position: 'relative',
|
|
420
476
|
cursor: $disabled || !$peekNextMonth && $outsideMonth ? 'default' : 'pointer',
|
|
421
477
|
color: colors.calendarForeground,
|
|
422
478
|
display: 'inline-block',
|
|
423
|
-
width:
|
|
424
|
-
height:
|
|
425
|
-
lineHeight
|
|
479
|
+
width: $density === DENSITY.high ? '42px' : '50px',
|
|
480
|
+
height: height,
|
|
481
|
+
// setting lineHeight equal to the contents height to vertically center the text
|
|
482
|
+
lineHeight: $density === DENSITY.high ? sizing.scale700 : sizing.scale900,
|
|
426
483
|
textAlign: 'center',
|
|
427
484
|
paddingTop: sizing.scale300,
|
|
428
485
|
paddingBottom: sizing.scale300,
|
|
429
|
-
paddingLeft: sizing.
|
|
430
|
-
paddingRight: sizing.
|
|
486
|
+
paddingLeft: sizing.scale300,
|
|
487
|
+
paddingRight: sizing.scale300,
|
|
431
488
|
marginTop: 0,
|
|
432
489
|
marginBottom: 0,
|
|
433
490
|
marginLeft: 0,
|
|
@@ -448,10 +505,10 @@ export const StyledDay = styled('div', props => {
|
|
|
448
505
|
display: 'inline-block',
|
|
449
506
|
boxShadow: $isFocusVisible ? `0 0 0 3px ${colors.accent}` : 'none',
|
|
450
507
|
backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
|
|
451
|
-
height: '100%',
|
|
508
|
+
height: $hasDateLabel ? '100%' : $density === DENSITY.high ? '42px' : '50px',
|
|
452
509
|
width: '100%',
|
|
453
510
|
position: 'absolute',
|
|
454
|
-
top: 0,
|
|
511
|
+
top: $hasDateLabel ? 0 : '-1px',
|
|
455
512
|
left: 0,
|
|
456
513
|
paddingTop: sizing.scale200,
|
|
457
514
|
paddingBottom: sizing.scale200,
|
|
@@ -467,10 +524,10 @@ export const StyledDay = styled('div', props => {
|
|
|
467
524
|
borderBottomColor: colors.borderSelected,
|
|
468
525
|
borderRightColor: colors.borderSelected,
|
|
469
526
|
borderLeftColor: colors.borderSelected,
|
|
470
|
-
borderTopLeftRadius: $hasDateLabel ? sizing.
|
|
471
|
-
borderTopRightRadius: $hasDateLabel ? sizing.
|
|
472
|
-
borderBottomLeftRadius: $hasDateLabel ? sizing.
|
|
473
|
-
borderBottomRightRadius: $hasDateLabel ? sizing.
|
|
527
|
+
borderTopLeftRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
528
|
+
borderTopRightRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
529
|
+
borderBottomLeftRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
530
|
+
borderBottomRightRadius: $hasDateLabel ? sizing.scale800 : '100%',
|
|
474
531
|
...(getDayStyles(code, props.$theme)[':after'] || {}),
|
|
475
532
|
...($outsideMonthWithinRange ? {
|
|
476
533
|
content: null
|
|
@@ -532,18 +589,23 @@ StyledDayLabel.displayName = "StyledDayLabel";
|
|
|
532
589
|
export const StyledWeekdayHeader = styled('div', props => {
|
|
533
590
|
const {
|
|
534
591
|
$theme: {
|
|
592
|
+
typography,
|
|
593
|
+
colors,
|
|
535
594
|
sizing
|
|
536
|
-
}
|
|
595
|
+
},
|
|
596
|
+
$density
|
|
537
597
|
} = props;
|
|
538
|
-
return {
|
|
598
|
+
return { ...typography.LabelMedium,
|
|
599
|
+
color: colors.contentTertiary,
|
|
539
600
|
boxSizing: 'border-box',
|
|
540
601
|
position: 'relative',
|
|
541
602
|
cursor: 'default',
|
|
542
603
|
display: 'inline-block',
|
|
543
|
-
width:
|
|
544
|
-
height:
|
|
545
|
-
lineHeight: sizing.scale800,
|
|
604
|
+
width: $density === DENSITY.high ? '42px' : '50px',
|
|
605
|
+
height: $density === DENSITY.high ? '40px' : '48px',
|
|
546
606
|
textAlign: 'center',
|
|
607
|
+
// setting lineHeight equal to the contents height to vertically center the text
|
|
608
|
+
lineHeight: sizing.scale900,
|
|
547
609
|
paddingTop: sizing.scale300,
|
|
548
610
|
paddingBottom: sizing.scale300,
|
|
549
611
|
paddingLeft: sizing.scale200,
|
|
@@ -552,7 +614,6 @@ export const StyledWeekdayHeader = styled('div', props => {
|
|
|
552
614
|
marginBottom: 0,
|
|
553
615
|
marginLeft: 0,
|
|
554
616
|
marginRight: 0,
|
|
555
|
-
color: 'inherit',
|
|
556
617
|
backgroundColor: 'transparent'
|
|
557
618
|
};
|
|
558
619
|
});
|
package/es/datepicker/types.js
CHANGED
|
@@ -7,4 +7,4 @@ LICENSE file in the root directory of this source tree.
|
|
|
7
7
|
|
|
8
8
|
/* eslint-disable flowtype/generic-spacing */
|
|
9
9
|
import * as React from 'react';
|
|
10
|
-
import { ORIENTATION, STATE_CHANGE_TYPE } from './constants.js';
|
|
10
|
+
import { ORIENTATION, STATE_CHANGE_TYPE, DENSITY } from './constants.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
import { DEFAULT_MONTHS } from '../constants.js';
|
|
8
|
+
|
|
9
|
+
const getDefaultMonthItems = formatMonthLabel => DEFAULT_MONTHS.map(month => ({
|
|
10
|
+
id: month.toString(),
|
|
11
|
+
label: formatMonthLabel(month)
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
export const filterMonthItems = (monthItems, filterList) => monthItems.map(month => {
|
|
15
|
+
if (!filterList.includes(Number(month.id))) {
|
|
16
|
+
return { ...month,
|
|
17
|
+
disabled: true
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return month;
|
|
22
|
+
});
|
|
23
|
+
export const getFilteredMonthItems = ({
|
|
24
|
+
filterMonthsList,
|
|
25
|
+
formatMonthLabel
|
|
26
|
+
}) => {
|
|
27
|
+
let monthItems = getDefaultMonthItems(formatMonthLabel);
|
|
28
|
+
|
|
29
|
+
if (filterMonthsList) {
|
|
30
|
+
monthItems = filterMonthItems(monthItems, filterMonthsList);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return monthItems;
|
|
34
|
+
};
|
package/es/datepicker/week.js
CHANGED
|
@@ -34,6 +34,7 @@ export default class Week extends React.Component {
|
|
|
34
34
|
adapter: this.props.adapter,
|
|
35
35
|
date: day,
|
|
36
36
|
dateLabel: this.props.dateLabel,
|
|
37
|
+
density: this.props.density,
|
|
37
38
|
disabled: this.dateHelpers.isDayDisabled(day, this.props),
|
|
38
39
|
excludeDates: this.props.excludeDates,
|
|
39
40
|
filterDate: this.props.filterDate,
|
package/es/dnd-list/index.js
CHANGED
|
@@ -4,7 +4,8 @@ Copyright (c) Uber Technologies, Inc.
|
|
|
4
4
|
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
|
+
import { arrayMove, arrayRemove } from 'react-movable';
|
|
8
|
+
export { arrayMove, arrayRemove };
|
|
8
9
|
export { default as StatefulList } from './stateful-list.js';
|
|
9
10
|
export { default as StatefulListContainer } from './stateful-list-container.js';
|
|
10
11
|
export { default as List } from './list.js'; // Constants
|
package/es/dnd-list/list.js
CHANGED
|
@@ -127,8 +127,7 @@ class StatelessList extends React.Component {
|
|
|
127
127
|
display: 'flex'
|
|
128
128
|
}
|
|
129
129
|
}), /*#__PURE__*/React.createElement(DragHandle, _extends({}, sharedProps, dragHandleProps), /*#__PURE__*/React.createElement(Grab, {
|
|
130
|
-
size: 24
|
|
131
|
-
color: "#CCC"
|
|
130
|
+
size: 24
|
|
132
131
|
})), /*#__PURE__*/React.createElement(Label, _extends({}, sharedProps, labelProps), value), removable && /*#__PURE__*/React.createElement(CloseHandle, _extends({}, sharedProps, {
|
|
133
132
|
onClick: evt => {
|
|
134
133
|
evt.preventDefault();
|
package/es/drawer/drawer.js
CHANGED
|
@@ -252,7 +252,8 @@ class Drawer extends React.Component {
|
|
|
252
252
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, locale => {
|
|
253
253
|
return /*#__PURE__*/React.createElement(FocusLock, {
|
|
254
254
|
returnFocus: true,
|
|
255
|
-
autoFocus: autoFocus
|
|
255
|
+
autoFocus: autoFocus,
|
|
256
|
+
noFocusGuards: true
|
|
256
257
|
}, /*#__PURE__*/React.createElement(Root, _extends({
|
|
257
258
|
"data-baseweb": "drawer",
|
|
258
259
|
ref: this.getRef('Root')
|
package/es/helper/helper.js
CHANGED
package/es/layer/layer.js
CHANGED
|
@@ -94,6 +94,14 @@ class LayerComponent extends React.Component {
|
|
|
94
94
|
if (host && host !== prevProps.host && prevProps.host === null) {
|
|
95
95
|
this.addContainer(host);
|
|
96
96
|
}
|
|
97
|
+
|
|
98
|
+
if (prevProps.isHoverLayer != this.props.isHoverLayer) {
|
|
99
|
+
if (this.props.isHoverLayer) {
|
|
100
|
+
this.context.removeDocClickHandler(this.onDocumentClick);
|
|
101
|
+
} else {
|
|
102
|
+
this.context.addDocClickHandler(this.onDocumentClick);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
97
105
|
}
|
|
98
106
|
|
|
99
107
|
componentWillUnmount() {
|