baseui 0.0.0-alpha-3a96a5e → 0.0.0-alpha-bcb33da
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/a11y/a11y.js +2 -2
- package/a11y/a11y.js.flow +3 -3
- package/button/styled-components.js +47 -18
- package/button/styled-components.js.flow +25 -5
- package/data-table/column-categorical.js +1 -1
- package/data-table/column-categorical.js.flow +2 -2
- package/data-table/column-datetime.js +1 -1
- package/data-table/column-datetime.js.flow +1 -1
- package/data-table/column-numerical.js +1 -1
- package/data-table/column-numerical.js.flow +3 -3
- package/datepicker/calendar.js +6 -12
- package/datepicker/calendar.js.flow +12 -23
- package/datepicker/datepicker.js +5 -16
- package/datepicker/datepicker.js.flow +10 -25
- package/datepicker/day.js +30 -58
- package/datepicker/day.js.flow +51 -103
- package/datepicker/stateful-container.js.flow +1 -2
- package/datepicker/types.js.flow +9 -11
- package/drawer/drawer.js +3 -1
- package/drawer/drawer.js.flow +7 -1
- package/es/a11y/a11y.js +2 -2
- package/es/button/styled-components.js +32 -2
- package/es/data-table/column-categorical.js +2 -2
- package/es/data-table/column-datetime.js +1 -1
- package/es/data-table/column-numerical.js +2 -2
- package/es/datepicker/calendar.js +6 -12
- package/es/datepicker/datepicker.js +5 -15
- package/es/datepicker/day.js +30 -51
- package/es/drawer/drawer.js +3 -1
- package/es/form-control/form-control.js +58 -7
- package/es/form-control/styled-components.js +27 -6
- package/es/index.js +1 -1
- package/es/map-marker/badge-enhancer.js +61 -0
- package/es/map-marker/constants.js +146 -2
- package/es/map-marker/drag-shadow.js +32 -0
- package/es/map-marker/fixed-marker.js +54 -48
- package/es/map-marker/floating-marker.js +21 -12
- package/es/map-marker/index.js +1 -1
- package/es/map-marker/label-enhancer.js +39 -0
- package/es/map-marker/needle.js +26 -0
- package/es/map-marker/pin-head.js +42 -40
- package/es/map-marker/styled-components.js +177 -32
- package/es/map-marker/types.js +1 -1
- package/es/modal/modal.js +3 -1
- package/es/popover/popover.js +4 -2
- package/es/progress-bar/index.js +1 -1
- package/es/progress-bar/progressbar.js +15 -7
- package/es/progress-bar/styled-components.js +9 -5
- package/es/table/filter.js +3 -1
- package/es/themes/dark-theme/color-component-tokens.js +4 -0
- package/es/themes/light-theme/color-component-tokens.js +4 -0
- package/es/timezonepicker/timezone-picker.js +53 -36
- package/es/timezonepicker/tzdata.js +2 -0
- package/es/timezonepicker/update-tzdata.js +69 -0
- package/esm/a11y/a11y.js +3 -3
- package/esm/button/styled-components.js +47 -18
- package/esm/data-table/column-categorical.js +2 -2
- package/esm/data-table/column-datetime.js +1 -1
- package/esm/data-table/column-numerical.js +2 -2
- package/esm/datepicker/calendar.js +6 -12
- package/esm/datepicker/datepicker.js +5 -16
- package/esm/datepicker/day.js +30 -58
- package/esm/drawer/drawer.js +3 -1
- package/esm/form-control/form-control.js +60 -9
- package/esm/form-control/styled-components.js +23 -3
- package/esm/index.js +1 -1
- package/esm/map-marker/badge-enhancer.js +79 -0
- package/esm/map-marker/constants.js +94 -4
- package/esm/map-marker/drag-shadow.js +53 -0
- package/esm/map-marker/fixed-marker.js +84 -80
- package/esm/map-marker/floating-marker.js +22 -13
- package/esm/map-marker/index.js +1 -1
- package/esm/map-marker/label-enhancer.js +60 -0
- package/esm/map-marker/needle.js +43 -0
- package/esm/map-marker/pin-head.js +77 -66
- package/esm/map-marker/styled-components.js +182 -51
- package/esm/map-marker/types.js +1 -1
- package/esm/modal/modal.js +3 -1
- package/esm/popover/popover.js +4 -2
- package/esm/progress-bar/index.js +1 -1
- package/esm/progress-bar/progressbar.js +17 -8
- package/esm/progress-bar/styled-components.js +9 -4
- package/esm/table/filter.js +3 -1
- package/esm/themes/dark-theme/color-component-tokens.js +4 -0
- package/esm/themes/light-theme/color-component-tokens.js +4 -0
- package/esm/timezonepicker/timezone-picker.js +64 -36
- package/esm/timezonepicker/tzdata.js +2 -0
- package/esm/timezonepicker/update-tzdata.js +160 -0
- package/form-control/form-control.js +61 -8
- package/form-control/form-control.js.flow +82 -10
- package/form-control/index.d.ts +1 -0
- package/form-control/styled-components.js +27 -5
- package/form-control/styled-components.js.flow +25 -3
- package/form-control/types.js.flow +20 -8
- package/index.js +6 -0
- package/index.js.flow +1 -1
- package/map-marker/badge-enhancer.js +90 -0
- package/map-marker/badge-enhancer.js.flow +86 -0
- package/map-marker/constants.js +103 -5
- package/map-marker/constants.js.flow +152 -0
- package/map-marker/drag-shadow.js +64 -0
- package/map-marker/drag-shadow.js.flow +52 -0
- package/map-marker/fixed-marker.js +84 -78
- package/map-marker/fixed-marker.js.flow +78 -66
- package/map-marker/floating-marker.js +22 -13
- package/map-marker/floating-marker.js.flow +30 -17
- package/map-marker/index.d.ts +125 -24
- package/map-marker/index.js +18 -0
- package/map-marker/index.js.flow +3 -0
- package/map-marker/label-enhancer.js +71 -0
- package/map-marker/label-enhancer.js.flow +63 -0
- package/map-marker/needle.js +54 -0
- package/map-marker/needle.js.flow +29 -0
- package/map-marker/pin-head.js +80 -69
- package/map-marker/pin-head.js.flow +122 -84
- package/map-marker/styled-components.js +200 -62
- package/map-marker/styled-components.js.flow +172 -22
- package/map-marker/types.js.flow +69 -20
- package/modal/modal.js +3 -1
- package/modal/modal.js.flow +2 -0
- package/package.json +4 -4
- package/popover/popover.js +4 -2
- package/popover/popover.js.flow +3 -1
- package/progress-bar/index.d.ts +2 -0
- package/progress-bar/index.js +6 -0
- package/progress-bar/index.js.flow +1 -0
- package/progress-bar/progressbar.js +17 -8
- package/progress-bar/progressbar.js.flow +19 -7
- package/progress-bar/styled-components.js +9 -4
- package/progress-bar/styled-components.js.flow +15 -4
- package/progress-bar/types.js.flow +12 -2
- package/styles/index.js.flow +1 -1
- package/table/filter.js +3 -1
- package/table/filter.js.flow +5 -1
- package/themes/dark-theme/color-component-tokens.js +4 -0
- package/themes/dark-theme/color-component-tokens.js.flow +4 -0
- package/themes/light-theme/color-component-tokens.js +4 -0
- package/themes/light-theme/color-component-tokens.js.flow +4 -0
- package/themes/types.js.flow +4 -0
- package/timezonepicker/timezone-picker.js +69 -41
- package/timezonepicker/timezone-picker.js.flow +52 -46
- package/timezonepicker/types.js.flow +1 -1
- package/timezonepicker/tzdata.js +10 -0
- package/timezonepicker/tzdata.js.flow +347 -0
- package/timezonepicker/update-tzdata.js +164 -0
- package/timezonepicker/update-tzdata.js.flow +70 -0
package/datepicker/day.js
CHANGED
|
@@ -99,21 +99,12 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
99
99
|
var date;
|
|
100
100
|
|
|
101
101
|
if (Array.isArray(value) && range) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (!start && !end || start && end) {
|
|
108
|
-
date = [selectedDate, null]; // EndDate needs a StartDate, SelectedDate comes before EndDate
|
|
109
|
-
} else if (!start && end && _this.dateHelpers.isAfter(end, selectedDate)) {
|
|
110
|
-
date = [selectedDate, end]; // EndDate needs a StartDate, but SelectedDate comes after EndDate
|
|
111
|
-
} else if (!start && end && _this.dateHelpers.isAfter(selectedDate, end)) {
|
|
112
|
-
date = [end, selectedDate]; // StartDate needs an EndDate, SelectedDate comes after StartDate
|
|
113
|
-
} else if (start && !end && _this.dateHelpers.isAfter(selectedDate, start)) {
|
|
114
|
-
date = [start, selectedDate];
|
|
102
|
+
if (!value.length || value.length > 1) {
|
|
103
|
+
date = [selectedDate];
|
|
104
|
+
} else if (_this.dateHelpers.isAfter(selectedDate, value[0])) {
|
|
105
|
+
date = [value[0], selectedDate];
|
|
115
106
|
} else {
|
|
116
|
-
date = [selectedDate,
|
|
107
|
+
date = [selectedDate, value[0]];
|
|
117
108
|
}
|
|
118
109
|
} else {
|
|
119
110
|
date = selectedDate;
|
|
@@ -307,18 +298,13 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
307
298
|
var date = this.getDateProp();
|
|
308
299
|
var value = this.props.value;
|
|
309
300
|
|
|
310
|
-
if (Array.isArray(value)) {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
end = _value2[1];
|
|
301
|
+
if (Array.isArray(value) && !value[0] && !value[1]) {
|
|
302
|
+
return false;
|
|
303
|
+
} // fix flow by passing a specific arg type and remove 'Array.isArray(value)'
|
|
314
304
|
|
|
315
|
-
if (!start && !end) {
|
|
316
|
-
return false;
|
|
317
|
-
}
|
|
318
305
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
306
|
+
if (Array.isArray(value) && value.length > 1) {
|
|
307
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(value[0]), this.clampToDayStart(value[1]));
|
|
322
308
|
}
|
|
323
309
|
} // calculated for range case only
|
|
324
310
|
|
|
@@ -330,29 +316,16 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
330
316
|
value = _this$props4.value,
|
|
331
317
|
highlightedDate = _this$props4.highlightedDate;
|
|
332
318
|
|
|
333
|
-
if (Array.isArray(value)) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
end = _value3[1];
|
|
337
|
-
|
|
338
|
-
if (!start && !end) {
|
|
339
|
-
return false;
|
|
340
|
-
}
|
|
319
|
+
if (Array.isArray(value) && !value[0] && !value[1]) {
|
|
320
|
+
return false;
|
|
321
|
+
} // fix flow by passing a specific arg type and remove 'Array.isArray(value)'
|
|
341
322
|
|
|
342
|
-
if (highlightedDate && start && !end) {
|
|
343
|
-
if (this.dateHelpers.isAfter(highlightedDate, start)) {
|
|
344
|
-
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(start), this.clampToDayStart(highlightedDate));
|
|
345
|
-
} else {
|
|
346
|
-
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(start));
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
323
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
324
|
+
if (Array.isArray(value) && highlightedDate && value[0] && !value[1]) {
|
|
325
|
+
if (this.dateHelpers.isAfter(highlightedDate, value[0])) {
|
|
326
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(value[0]), this.clampToDayStart(highlightedDate));
|
|
327
|
+
} else {
|
|
328
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(value[0]));
|
|
356
329
|
}
|
|
357
330
|
}
|
|
358
331
|
}
|
|
@@ -364,22 +337,21 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
364
337
|
value = _this$props5.value,
|
|
365
338
|
highlightedDate = _this$props5.highlightedDate,
|
|
366
339
|
range = _this$props5.range,
|
|
367
|
-
highlighted = _this$props5.highlighted
|
|
368
|
-
peekNextMonth = _this$props5.peekNextMonth;
|
|
340
|
+
highlighted = _this$props5.highlighted;
|
|
369
341
|
var $isHighlighted = highlighted;
|
|
370
342
|
var $selected = this.isSelected();
|
|
371
|
-
var $hasRangeHighlighted = !!(Array.isArray(value) && range &&
|
|
372
|
-
var $outsideMonth = !peekNextMonth && this.isOutsideMonth();
|
|
373
|
-
var $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !peekNextMonth && this.isOutsideOfMonthButWithinRange());
|
|
343
|
+
var $hasRangeHighlighted = !!(Array.isArray(value) && range && value.length === 1 && highlightedDate && !this.dateHelpers.isSameDay(value[0], highlightedDate));
|
|
344
|
+
var $outsideMonth = !this.props.peekNextMonth && this.isOutsideMonth();
|
|
345
|
+
var $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !this.props.peekNextMonth && this.isOutsideOfMonthButWithinRange());
|
|
374
346
|
return {
|
|
375
347
|
$date: date,
|
|
376
348
|
$density: this.props.density,
|
|
377
349
|
$disabled: this.props.disabled,
|
|
378
|
-
$endDate: Array.isArray(value) &&
|
|
350
|
+
$endDate: Array.isArray(value) && this.props.range && $selected && this.dateHelpers.isSameDay(date, value[1]) || false,
|
|
379
351
|
$hasDateLabel: !!this.props.dateLabel,
|
|
380
352
|
$hasRangeHighlighted: $hasRangeHighlighted,
|
|
381
|
-
$hasRangeOnRight: Array.isArray(value) && $hasRangeHighlighted && highlightedDate &&
|
|
382
|
-
$hasRangeSelected: Array.isArray(value) ?
|
|
353
|
+
$hasRangeOnRight: Array.isArray(value) && $hasRangeHighlighted && highlightedDate && value[0] && this.dateHelpers.isAfter(highlightedDate, value[0]),
|
|
354
|
+
$hasRangeSelected: Array.isArray(value) ? value.length === 2 : false,
|
|
383
355
|
$highlightedDate: highlightedDate,
|
|
384
356
|
$isHighlighted: $isHighlighted,
|
|
385
357
|
$isHovered: this.state.isHovered,
|
|
@@ -389,12 +361,12 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
389
361
|
$month: this.getMonthProp(),
|
|
390
362
|
$outsideMonth: $outsideMonth,
|
|
391
363
|
$outsideMonthWithinRange: $outsideMonthWithinRange,
|
|
392
|
-
$peekNextMonth: peekNextMonth,
|
|
393
|
-
$pseudoHighlighted: range && !$isHighlighted && !$selected ? this.isPseudoHighlighted() : false,
|
|
394
|
-
$pseudoSelected: range && !$selected ? this.isPseudoSelected() : false,
|
|
395
|
-
$range: range,
|
|
364
|
+
$peekNextMonth: this.props.peekNextMonth,
|
|
365
|
+
$pseudoHighlighted: this.props.range && !$isHighlighted && !$selected ? this.isPseudoHighlighted() : false,
|
|
366
|
+
$pseudoSelected: this.props.range && !$selected ? this.isPseudoSelected() : false,
|
|
367
|
+
$range: this.props.range,
|
|
396
368
|
$selected: $selected,
|
|
397
|
-
$startDate: Array.isArray(value) && value
|
|
369
|
+
$startDate: Array.isArray(this.props.value) && this.props.value.length > 1 && this.props.range && $selected ? this.dateHelpers.isSameDay(date, this.props.value[0]) : false
|
|
398
370
|
};
|
|
399
371
|
}
|
|
400
372
|
}, {
|
package/datepicker/day.js.flow
CHANGED
|
@@ -87,34 +87,16 @@ export default class Day<T = Date> extends React.Component<
|
|
|
87
87
|
const {range, value} = this.props;
|
|
88
88
|
let date;
|
|
89
89
|
if (Array.isArray(value) && range) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
date = [selectedDate, null];
|
|
95
|
-
|
|
96
|
-
// EndDate needs a StartDate, SelectedDate comes before EndDate
|
|
97
|
-
} else if (!start && end && this.dateHelpers.isAfter(end, selectedDate)) {
|
|
98
|
-
date = [selectedDate, end];
|
|
99
|
-
|
|
100
|
-
// EndDate needs a StartDate, but SelectedDate comes after EndDate
|
|
101
|
-
} else if (!start && end && this.dateHelpers.isAfter(selectedDate, end)) {
|
|
102
|
-
date = [end, selectedDate];
|
|
103
|
-
|
|
104
|
-
// StartDate needs an EndDate, SelectedDate comes after StartDate
|
|
105
|
-
} else if (
|
|
106
|
-
start &&
|
|
107
|
-
!end &&
|
|
108
|
-
this.dateHelpers.isAfter(selectedDate, start)
|
|
109
|
-
) {
|
|
110
|
-
date = [start, selectedDate];
|
|
90
|
+
if (!value.length || value.length > 1) {
|
|
91
|
+
date = [selectedDate];
|
|
92
|
+
} else if (this.dateHelpers.isAfter(selectedDate, value[0])) {
|
|
93
|
+
date = [value[0], selectedDate];
|
|
111
94
|
} else {
|
|
112
|
-
date = [selectedDate,
|
|
95
|
+
date = [selectedDate, value[0]];
|
|
113
96
|
}
|
|
114
97
|
} else {
|
|
115
98
|
date = selectedDate;
|
|
116
99
|
}
|
|
117
|
-
|
|
118
100
|
this.props.onSelect({date});
|
|
119
101
|
};
|
|
120
102
|
|
|
@@ -248,21 +230,16 @@ export default class Day<T = Date> extends React.Component<
|
|
|
248
230
|
isPseudoSelected() {
|
|
249
231
|
const date = this.getDateProp();
|
|
250
232
|
const {value} = this.props;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
this.clampToDayStart(date),
|
|
262
|
-
this.clampToDayStart(start),
|
|
263
|
-
this.clampToDayStart(end),
|
|
264
|
-
);
|
|
265
|
-
}
|
|
233
|
+
if (Array.isArray(value) && !value[0] && !value[1]) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
// fix flow by passing a specific arg type and remove 'Array.isArray(value)'
|
|
237
|
+
if (Array.isArray(value) && value.length > 1) {
|
|
238
|
+
return this.dateHelpers.isDayInRange(
|
|
239
|
+
this.clampToDayStart(date),
|
|
240
|
+
this.clampToDayStart(value[0]),
|
|
241
|
+
this.clampToDayStart(value[1]),
|
|
242
|
+
);
|
|
266
243
|
}
|
|
267
244
|
}
|
|
268
245
|
|
|
@@ -270,76 +247,46 @@ export default class Day<T = Date> extends React.Component<
|
|
|
270
247
|
isPseudoHighlighted() {
|
|
271
248
|
const date = this.getDateProp();
|
|
272
249
|
const {value, highlightedDate} = this.props;
|
|
250
|
+
if (Array.isArray(value) && !value[0] && !value[1]) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
273
253
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
} else {
|
|
289
|
-
return this.dateHelpers.isDayInRange(
|
|
290
|
-
this.clampToDayStart(date),
|
|
291
|
-
this.clampToDayStart(highlightedDate),
|
|
292
|
-
this.clampToDayStart(start),
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (highlightedDate && !start && end) {
|
|
298
|
-
if (this.dateHelpers.isAfter(highlightedDate, end)) {
|
|
299
|
-
return this.dateHelpers.isDayInRange(
|
|
300
|
-
this.clampToDayStart(date),
|
|
301
|
-
this.clampToDayStart(end),
|
|
302
|
-
this.clampToDayStart(highlightedDate),
|
|
303
|
-
);
|
|
304
|
-
} else {
|
|
305
|
-
return this.dateHelpers.isDayInRange(
|
|
306
|
-
this.clampToDayStart(date),
|
|
307
|
-
this.clampToDayStart(highlightedDate),
|
|
308
|
-
this.clampToDayStart(end),
|
|
309
|
-
);
|
|
310
|
-
}
|
|
254
|
+
// fix flow by passing a specific arg type and remove 'Array.isArray(value)'
|
|
255
|
+
if (Array.isArray(value) && highlightedDate && value[0] && !value[1]) {
|
|
256
|
+
if (this.dateHelpers.isAfter(highlightedDate, value[0])) {
|
|
257
|
+
return this.dateHelpers.isDayInRange(
|
|
258
|
+
this.clampToDayStart(date),
|
|
259
|
+
this.clampToDayStart(value[0]),
|
|
260
|
+
this.clampToDayStart(highlightedDate),
|
|
261
|
+
);
|
|
262
|
+
} else {
|
|
263
|
+
return this.dateHelpers.isDayInRange(
|
|
264
|
+
this.clampToDayStart(date),
|
|
265
|
+
this.clampToDayStart(highlightedDate),
|
|
266
|
+
this.clampToDayStart(value[0]),
|
|
267
|
+
);
|
|
311
268
|
}
|
|
312
269
|
}
|
|
313
270
|
}
|
|
314
271
|
|
|
315
272
|
getSharedProps() {
|
|
316
273
|
const date = this.getDateProp();
|
|
317
|
-
const {
|
|
318
|
-
value,
|
|
319
|
-
highlightedDate,
|
|
320
|
-
range,
|
|
321
|
-
highlighted,
|
|
322
|
-
peekNextMonth,
|
|
323
|
-
} = this.props;
|
|
274
|
+
const {value, highlightedDate, range, highlighted} = this.props;
|
|
324
275
|
const $isHighlighted = highlighted;
|
|
325
276
|
const $selected = this.isSelected();
|
|
326
277
|
const $hasRangeHighlighted = !!(
|
|
327
278
|
Array.isArray(value) &&
|
|
328
279
|
range &&
|
|
280
|
+
value.length === 1 &&
|
|
329
281
|
highlightedDate &&
|
|
330
|
-
(
|
|
331
|
-
!value[1] &&
|
|
332
|
-
!this.dateHelpers.isSameDay(value[0], highlightedDate)) ||
|
|
333
|
-
(!value[0] &&
|
|
334
|
-
value[1] &&
|
|
335
|
-
!this.dateHelpers.isSameDay(value[1], highlightedDate)))
|
|
282
|
+
!this.dateHelpers.isSameDay(value[0], highlightedDate)
|
|
336
283
|
);
|
|
337
|
-
const $outsideMonth = !peekNextMonth && this.isOutsideMonth();
|
|
284
|
+
const $outsideMonth = !this.props.peekNextMonth && this.isOutsideMonth();
|
|
338
285
|
const $outsideMonthWithinRange = !!(
|
|
339
286
|
Array.isArray(value) &&
|
|
340
287
|
range &&
|
|
341
288
|
$outsideMonth &&
|
|
342
|
-
!peekNextMonth &&
|
|
289
|
+
!this.props.peekNextMonth &&
|
|
343
290
|
this.isOutsideOfMonthButWithinRange()
|
|
344
291
|
);
|
|
345
292
|
return {
|
|
@@ -348,8 +295,7 @@ export default class Day<T = Date> extends React.Component<
|
|
|
348
295
|
$disabled: this.props.disabled,
|
|
349
296
|
$endDate:
|
|
350
297
|
(Array.isArray(value) &&
|
|
351
|
-
|
|
352
|
-
range &&
|
|
298
|
+
this.props.range &&
|
|
353
299
|
$selected &&
|
|
354
300
|
this.dateHelpers.isSameDay(date, value[1])) ||
|
|
355
301
|
false,
|
|
@@ -359,11 +305,9 @@ export default class Day<T = Date> extends React.Component<
|
|
|
359
305
|
Array.isArray(value) &&
|
|
360
306
|
$hasRangeHighlighted &&
|
|
361
307
|
highlightedDate &&
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
$hasRangeSelected: Array.isArray(value)
|
|
365
|
-
? !!(value[0] && value[1])
|
|
366
|
-
: false,
|
|
308
|
+
value[0] &&
|
|
309
|
+
this.dateHelpers.isAfter(highlightedDate, value[0]),
|
|
310
|
+
$hasRangeSelected: Array.isArray(value) ? value.length === 2 : false,
|
|
367
311
|
$highlightedDate: highlightedDate,
|
|
368
312
|
$isHighlighted,
|
|
369
313
|
$isHovered: this.state.isHovered,
|
|
@@ -373,17 +317,21 @@ export default class Day<T = Date> extends React.Component<
|
|
|
373
317
|
$month: this.getMonthProp(),
|
|
374
318
|
$outsideMonth,
|
|
375
319
|
$outsideMonthWithinRange,
|
|
376
|
-
$peekNextMonth: peekNextMonth,
|
|
320
|
+
$peekNextMonth: this.props.peekNextMonth,
|
|
377
321
|
$pseudoHighlighted:
|
|
378
|
-
range && !$isHighlighted && !$selected
|
|
322
|
+
this.props.range && !$isHighlighted && !$selected
|
|
379
323
|
? this.isPseudoHighlighted()
|
|
380
324
|
: false,
|
|
381
|
-
$pseudoSelected:
|
|
382
|
-
|
|
325
|
+
$pseudoSelected:
|
|
326
|
+
this.props.range && !$selected ? this.isPseudoSelected() : false,
|
|
327
|
+
$range: this.props.range,
|
|
383
328
|
$selected,
|
|
384
329
|
$startDate:
|
|
385
|
-
Array.isArray(value) &&
|
|
386
|
-
|
|
330
|
+
Array.isArray(this.props.value) &&
|
|
331
|
+
this.props.value.length > 1 &&
|
|
332
|
+
this.props.range &&
|
|
333
|
+
$selected
|
|
334
|
+
? this.dateHelpers.isSameDay(date, this.props.value[0])
|
|
387
335
|
: false,
|
|
388
336
|
};
|
|
389
337
|
}
|
|
@@ -14,7 +14,6 @@ import type {
|
|
|
14
14
|
StatefulContainerPropsT,
|
|
15
15
|
StateChangeTypeT,
|
|
16
16
|
StateReducerT,
|
|
17
|
-
DateValueT,
|
|
18
17
|
} from './types.js';
|
|
19
18
|
|
|
20
19
|
type InputProps<T> = CalendarPropsT<T> | DatepickerPropsT<T>;
|
|
@@ -37,7 +36,7 @@ class StatefulContainer<T = Date> extends React.Component<
|
|
|
37
36
|
this.state = {value, ...props.initialState};
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
onChange: ({date:
|
|
39
|
+
onChange: ({date: ?T | Array<T>}) => mixed = data => {
|
|
41
40
|
const {date} = data;
|
|
42
41
|
this.internalSetState(STATE_CHANGE_TYPE.change, {value: date});
|
|
43
42
|
if (typeof this.props.onChange === 'function') {
|
package/datepicker/types.js.flow
CHANGED
|
@@ -21,9 +21,7 @@ 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
|
-
|
|
25
|
-
|
|
26
|
-
type onChangeT<T> = ({date: DateValueT<T>}) => mixed;
|
|
24
|
+
type onChangeT<T> = ({date: ?T | Array<T>}) => mixed;
|
|
27
25
|
|
|
28
26
|
export type DensityT = $Keys<typeof DENSITY>;
|
|
29
27
|
|
|
@@ -84,13 +82,13 @@ export type DayPropsT<T = Date> = {
|
|
|
84
82
|
month: ?number,
|
|
85
83
|
onBlur: ({event: Event, date: T}) => mixed,
|
|
86
84
|
onFocus: ({event: Event, date: T}) => mixed,
|
|
87
|
-
onSelect: ({date:
|
|
85
|
+
onSelect: ({date: ?T | Array<T>}) => mixed,
|
|
88
86
|
onClick: ({event: Event, date: T}) => mixed,
|
|
89
87
|
onMouseOver: ({event: Event, date: T}) => mixed,
|
|
90
88
|
onMouseLeave: ({event: Event, date: T}) => mixed,
|
|
91
89
|
overrides?: DatepickerOverridesT,
|
|
92
90
|
peekNextMonth: boolean,
|
|
93
|
-
value:
|
|
91
|
+
value: ?T | Array<T>,
|
|
94
92
|
};
|
|
95
93
|
|
|
96
94
|
export type DayStateT = {
|
|
@@ -122,7 +120,7 @@ export type WeekPropsT<T = Date> = {
|
|
|
122
120
|
onChange?: onChangeT<T>,
|
|
123
121
|
overrides?: DatepickerOverridesT,
|
|
124
122
|
peekNextMonth: boolean,
|
|
125
|
-
value:
|
|
123
|
+
value: ?T | Array<T>,
|
|
126
124
|
};
|
|
127
125
|
|
|
128
126
|
export type MonthPropsT<T = Date> = WeekPropsT<T> & {
|
|
@@ -135,7 +133,7 @@ export type CalendarInternalState<T = Date> = {
|
|
|
135
133
|
date: T,
|
|
136
134
|
quickSelectId: ?string,
|
|
137
135
|
rootElement: ?HTMLElement,
|
|
138
|
-
time: Array
|
|
136
|
+
time: Array<T>,
|
|
139
137
|
};
|
|
140
138
|
|
|
141
139
|
export type CalendarPropsT<T = Date> = {
|
|
@@ -196,7 +194,7 @@ export type CalendarPropsT<T = Date> = {
|
|
|
196
194
|
/** Defines if tabbing inside the calendar is circled within it. */
|
|
197
195
|
trapTabbing?: boolean,
|
|
198
196
|
/** Currently selected date. */
|
|
199
|
-
value?:
|
|
197
|
+
value?: ?T | Array<T>,
|
|
200
198
|
fixedHeight?: boolean,
|
|
201
199
|
};
|
|
202
200
|
|
|
@@ -224,7 +222,7 @@ export type DatepickerPropsT<T = Date> = CalendarPropsT<T> & {
|
|
|
224
222
|
required?: boolean,
|
|
225
223
|
clearable?: boolean,
|
|
226
224
|
displayValueAtRangeIndex?: number,
|
|
227
|
-
formatDisplayValue?: (date:
|
|
225
|
+
formatDisplayValue?: (date: ?T | Array<T>, formatString: string) => string,
|
|
228
226
|
formatString: string,
|
|
229
227
|
/** Where to mount the popover */
|
|
230
228
|
mountNode?: HTMLElement,
|
|
@@ -270,7 +268,7 @@ export type StateChangeTypeT = ?$Values<typeof STATE_CHANGE_TYPE>;
|
|
|
270
268
|
|
|
271
269
|
export type ContainerStateT<T = Date> = {
|
|
272
270
|
/** Selected `Date`. If `range` is set, `value` is an array of 2 values. */
|
|
273
|
-
value?:
|
|
271
|
+
value?: ?T | Array<T>,
|
|
274
272
|
};
|
|
275
273
|
|
|
276
274
|
export type NavigationContainerStateT<T = Date> = {
|
|
@@ -326,7 +324,7 @@ export type NavigationContainerPropsT<T = Date> = {
|
|
|
326
324
|
/** Event handler that is called when the current rendered year is changed. */
|
|
327
325
|
onYearChange?: ({date: T}) => mixed,
|
|
328
326
|
/** Selected `Date`. If `range` is set, `value` is an array of 2 values. */
|
|
329
|
-
value?:
|
|
327
|
+
value?: ?T | Array<T>,
|
|
330
328
|
stateReducer: NavigationContainerStateReducerT<T>,
|
|
331
329
|
trapTabbing: boolean,
|
|
332
330
|
};
|
package/drawer/drawer.js
CHANGED
|
@@ -340,7 +340,9 @@ var Drawer = /*#__PURE__*/function (_React$Component) {
|
|
|
340
340
|
|
|
341
341
|
var sharedProps = this.getSharedProps();
|
|
342
342
|
return /*#__PURE__*/React.createElement(_index.LocaleContext.Consumer, null, function (locale) {
|
|
343
|
-
return /*#__PURE__*/React.createElement(_reactFocusLock.default
|
|
343
|
+
return /*#__PURE__*/React.createElement(_reactFocusLock.default // Allow focus to escape when UI is within an iframe
|
|
344
|
+
, {
|
|
345
|
+
crossFrame: false,
|
|
344
346
|
returnFocus: true,
|
|
345
347
|
autoFocus: autoFocus,
|
|
346
348
|
noFocusGuards: true
|
package/drawer/drawer.js.flow
CHANGED
|
@@ -253,7 +253,13 @@ class Drawer extends React.Component<DrawerPropsT, DrawerStateT> {
|
|
|
253
253
|
<LocaleContext.Consumer>
|
|
254
254
|
{locale => {
|
|
255
255
|
return (
|
|
256
|
-
<FocusLock
|
|
256
|
+
<FocusLock
|
|
257
|
+
// Allow focus to escape when UI is within an iframe
|
|
258
|
+
crossFrame={false}
|
|
259
|
+
returnFocus
|
|
260
|
+
autoFocus={autoFocus}
|
|
261
|
+
noFocusGuards={true}
|
|
262
|
+
>
|
|
257
263
|
<Root
|
|
258
264
|
data-baseweb="drawer"
|
|
259
265
|
ref={this.getRef('Root')}
|
package/es/a11y/a11y.js
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 axe from 'axe-core';
|
|
11
11
|
import { Layer, TetherBehavior, TETHER_PLACEMENT } from '../layer/index.js';
|
|
12
|
-
import {
|
|
12
|
+
import { ParagraphSmall, ParagraphXSmall } from '../typography/index.js';
|
|
13
13
|
import { styled } from '../styles/index.js';
|
|
14
14
|
import { ThemeContext } from '../styles/theme-provider.js';
|
|
15
15
|
|
|
@@ -95,7 +95,7 @@ function Violation(props) {
|
|
|
95
95
|
ref: setPopper,
|
|
96
96
|
$top: `${offset.top}px` || '0px',
|
|
97
97
|
$left: `${offset.left}px` || '0px'
|
|
98
|
-
}, /*#__PURE__*/React.createElement(
|
|
98
|
+
}, /*#__PURE__*/React.createElement(ParagraphXSmall, null, props.target), props.violations.map((violation, index) => /*#__PURE__*/React.createElement(ParagraphSmall, {
|
|
99
99
|
key: index
|
|
100
100
|
}, violation.description)))));
|
|
101
101
|
}
|
|
@@ -39,8 +39,12 @@ export const BaseButton = styled('button', ({
|
|
|
39
39
|
cursor: 'pointer',
|
|
40
40
|
':disabled': {
|
|
41
41
|
cursor: 'not-allowed',
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
...getDisabledStyles({
|
|
43
|
+
$theme,
|
|
44
|
+
$kind,
|
|
45
|
+
$disabled,
|
|
46
|
+
$isSelected
|
|
47
|
+
})
|
|
44
48
|
},
|
|
45
49
|
marginLeft: 0,
|
|
46
50
|
marginTop: 0,
|
|
@@ -272,6 +276,32 @@ function getFontStyles({
|
|
|
272
276
|
}
|
|
273
277
|
}
|
|
274
278
|
|
|
279
|
+
function getDisabledStyles({
|
|
280
|
+
$theme,
|
|
281
|
+
$kind,
|
|
282
|
+
$isSelected,
|
|
283
|
+
$disabled
|
|
284
|
+
}) {
|
|
285
|
+
if ($disabled && $isSelected) {
|
|
286
|
+
if ($kind === KIND.primary || $kind === KIND.secondary) {
|
|
287
|
+
return {
|
|
288
|
+
color: $theme.colors.buttonDisabledActiveText,
|
|
289
|
+
backgroundColor: $theme.colors.buttonDisabledActiveFill
|
|
290
|
+
};
|
|
291
|
+
} else if ($kind === KIND.minimal || $kind === KIND.tertiary) {
|
|
292
|
+
return {
|
|
293
|
+
backgroundColor: $theme.colors.buttonTertiaryDisabledActiveFill,
|
|
294
|
+
color: $theme.colors.buttonTertiaryDisabledActiveText
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return {
|
|
300
|
+
backgroundColor: $kind === KIND.minimal || $kind === KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
|
|
301
|
+
color: $theme.colors.buttonDisabledText
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
275
305
|
function getPaddingStyles({
|
|
276
306
|
$theme,
|
|
277
307
|
$size,
|
|
@@ -13,7 +13,7 @@ import { Checkbox, StyledLabel } from '../checkbox/index.js';
|
|
|
13
13
|
import Search from '../icon/search.js';
|
|
14
14
|
import { Input, SIZE as INPUT_SIZE } from '../input/index.js';
|
|
15
15
|
import { useStyletron, withStyle } from '../styles/index.js';
|
|
16
|
-
import {
|
|
16
|
+
import { LabelSmall } from '../typography/index.js';
|
|
17
17
|
import Column from './column.js';
|
|
18
18
|
import { COLUMNS } from './constants.js';
|
|
19
19
|
import { LocaleContext } from '../locale/index.js';
|
|
@@ -139,7 +139,7 @@ export function CategoricalFilter(props) {
|
|
|
139
139
|
overflowY: 'auto',
|
|
140
140
|
marginTop: theme.sizing.scale600
|
|
141
141
|
})
|
|
142
|
-
}, !filteredCategories.length && /*#__PURE__*/React.createElement(
|
|
142
|
+
}, !filteredCategories.length && /*#__PURE__*/React.createElement(LabelSmall, null, locale.datatable.categoricalFilterEmpty), Boolean(filteredCategories.length) && filteredCategories.map((category, i) => /*#__PURE__*/React.createElement("div", {
|
|
143
143
|
className: checkboxStyles,
|
|
144
144
|
key: i
|
|
145
145
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
@@ -322,7 +322,7 @@ function DatetimeFilter(props) {
|
|
|
322
322
|
}) => {
|
|
323
323
|
if (Array.isArray(date)) {
|
|
324
324
|
if (!date.length) return;
|
|
325
|
-
const nextDates = date.map((d, i) =>
|
|
325
|
+
const nextDates = date.map((d, i) => applyDateToTime(rangeDates[i], d));
|
|
326
326
|
setRangeDates(nextDates);
|
|
327
327
|
}
|
|
328
328
|
},
|
|
@@ -11,7 +11,7 @@ import { Button, SIZE } from '../button/index.js';
|
|
|
11
11
|
import { ButtonGroup, MODE } from '../button-group/index.js';
|
|
12
12
|
import { Input, SIZE as INPUT_SIZE } from '../input/index.js';
|
|
13
13
|
import { useStyletron } from '../styles/index.js';
|
|
14
|
-
import {
|
|
14
|
+
import { ParagraphXSmall } from '../typography/index.js';
|
|
15
15
|
import Column from './column.js';
|
|
16
16
|
import { COLUMNS, NUMERICAL_FORMATS, NUMERICAL_OPERATIONS } from './constants.js';
|
|
17
17
|
import FilterShell from './filter-shell.js';
|
|
@@ -402,7 +402,7 @@ function NumericalFilter(props) {
|
|
|
402
402
|
marginLeft: theme.sizing.scale300,
|
|
403
403
|
marginRight: theme.sizing.scale300
|
|
404
404
|
})
|
|
405
|
-
}, /*#__PURE__*/React.createElement(
|
|
405
|
+
}, /*#__PURE__*/React.createElement(ParagraphXSmall, null, format(min, props.options)), ' ', /*#__PURE__*/React.createElement(ParagraphXSmall, null, format(max, props.options))), /*#__PURE__*/React.createElement("div", {
|
|
406
406
|
className: css({
|
|
407
407
|
display: 'flex',
|
|
408
408
|
justifyContent: 'space-between'
|
|
@@ -257,16 +257,10 @@ export default class Calendar extends React.Component {
|
|
|
257
257
|
const newTimeState = [...this.state.time]; // Apply the currently selected time values (saved in state) to the updated date
|
|
258
258
|
|
|
259
259
|
if (Array.isArray(data.date)) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if (end) {
|
|
265
|
-
updatedDate = [start, end];
|
|
266
|
-
newTimeState[1] = end;
|
|
267
|
-
} else {
|
|
268
|
-
updatedDate = [start];
|
|
269
|
-
}
|
|
260
|
+
updatedDate = data.date.map((date, index) => {
|
|
261
|
+
newTimeState[index] = this.dateHelpers.applyDateToTime(newTimeState[index], date);
|
|
262
|
+
return newTimeState[index];
|
|
263
|
+
});
|
|
270
264
|
} else if (!Array.isArray(this.props.value) && data.date) {
|
|
271
265
|
newTimeState[0] = this.dateHelpers.applyDateToTime(newTimeState[0], data.date);
|
|
272
266
|
updatedDate = newTimeState[0];
|
|
@@ -295,14 +289,14 @@ export default class Calendar extends React.Component {
|
|
|
295
289
|
|
|
296
290
|
if (Array.isArray(this.props.value)) {
|
|
297
291
|
const dates = this.props.value.map((date, i) => {
|
|
298
|
-
if (
|
|
292
|
+
if (index === i) {
|
|
299
293
|
return this.dateHelpers.applyTimeToDate(date, time);
|
|
300
294
|
}
|
|
301
295
|
|
|
302
296
|
return date;
|
|
303
297
|
});
|
|
304
298
|
onChange({
|
|
305
|
-
date:
|
|
299
|
+
date: dates
|
|
306
300
|
});
|
|
307
301
|
} else {
|
|
308
302
|
const date = this.dateHelpers.applyTimeToDate(this.props.value, time);
|