baseui 10.6.0 → 10.7.0

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.
Files changed (111) hide show
  1. package/app-nav-bar/user-menu.js +1 -0
  2. package/app-nav-bar/user-menu.js.flow +1 -0
  3. package/card/styled-components.js +0 -1
  4. package/card/styled-components.js.flow +0 -1
  5. package/combobox/combobox.js +5 -1
  6. package/combobox/combobox.js.flow +4 -0
  7. package/combobox/index.d.ts +6 -3
  8. package/data-table/column-datetime.js +2 -0
  9. package/data-table/column-datetime.js.flow +2 -0
  10. package/datepicker/calendar-header.js +29 -15
  11. package/datepicker/calendar-header.js.flow +13 -7
  12. package/datepicker/calendar.js +6 -1
  13. package/datepicker/calendar.js.flow +5 -1
  14. package/datepicker/constants.js +7 -2
  15. package/datepicker/constants.js.flow +5 -0
  16. package/datepicker/datepicker.js +135 -73
  17. package/datepicker/datepicker.js.flow +161 -62
  18. package/datepicker/day.js +1 -0
  19. package/datepicker/day.js.flow +1 -0
  20. package/datepicker/index.d.ts +7 -0
  21. package/datepicker/month.js +4 -0
  22. package/datepicker/month.js.flow +3 -0
  23. package/datepicker/styled-components.js +116 -56
  24. package/datepicker/styled-components.js.flow +101 -36
  25. package/datepicker/types.js.flow +17 -1
  26. package/datepicker/utils/date-helpers.js +1 -1
  27. package/datepicker/utils/date-helpers.js.flow +1 -1
  28. package/datepicker/week.js +1 -0
  29. package/datepicker/week.js.flow +1 -0
  30. package/dnd-list/list.js +1 -2
  31. package/dnd-list/list.js.flow +1 -1
  32. package/dnd-list/styled-components.js +1 -1
  33. package/dnd-list/styled-components.js.flow +1 -0
  34. package/es/app-nav-bar/user-menu.js +1 -0
  35. package/es/card/styled-components.js +0 -1
  36. package/es/combobox/combobox.js +5 -1
  37. package/es/data-table/column-datetime.js +2 -0
  38. package/es/datepicker/calendar-header.js +21 -10
  39. package/es/datepicker/calendar.js +7 -2
  40. package/es/datepicker/constants.js +5 -1
  41. package/es/datepicker/datepicker.js +70 -42
  42. package/es/datepicker/day.js +1 -0
  43. package/es/datepicker/month.js +3 -0
  44. package/es/datepicker/styled-components.js +98 -37
  45. package/es/datepicker/types.js +1 -1
  46. package/es/datepicker/utils/date-helpers.js +1 -1
  47. package/es/datepicker/week.js +1 -0
  48. package/es/dnd-list/list.js +1 -2
  49. package/es/dnd-list/styled-components.js +1 -0
  50. package/es/helper/helper.js +1 -0
  51. package/es/layer/layer.js +8 -0
  52. package/es/menu/maybe-child-menu.js +1 -0
  53. package/es/popover/popover.js +6 -5
  54. package/es/popover/stateful-container.js +4 -2
  55. package/es/select/select-component.js +1 -0
  56. package/es/themes/shared/lighting.js +5 -1
  57. package/es/timepicker/timepicker.js +16 -11
  58. package/es/tooltip/tooltip.js +1 -0
  59. package/esm/app-nav-bar/user-menu.js +1 -0
  60. package/esm/card/styled-components.js +0 -1
  61. package/esm/combobox/combobox.js +5 -1
  62. package/esm/data-table/column-datetime.js +2 -0
  63. package/esm/datepicker/calendar-header.js +30 -16
  64. package/esm/datepicker/calendar.js +7 -2
  65. package/esm/datepicker/constants.js +5 -1
  66. package/esm/datepicker/datepicker.js +136 -74
  67. package/esm/datepicker/day.js +1 -0
  68. package/esm/datepicker/month.js +3 -0
  69. package/esm/datepicker/styled-components.js +112 -55
  70. package/esm/datepicker/types.js +1 -1
  71. package/esm/datepicker/utils/date-helpers.js +1 -1
  72. package/esm/datepicker/week.js +1 -0
  73. package/esm/dnd-list/list.js +1 -2
  74. package/esm/dnd-list/styled-components.js +1 -1
  75. package/esm/helper/helper.js +1 -0
  76. package/esm/layer/layer.js +8 -0
  77. package/esm/menu/maybe-child-menu.js +1 -0
  78. package/esm/popover/popover.js +6 -5
  79. package/esm/popover/stateful-container.js +4 -2
  80. package/esm/select/select-component.js +1 -0
  81. package/esm/themes/shared/lighting.js +5 -1
  82. package/esm/timepicker/timepicker.js +17 -11
  83. package/esm/tooltip/tooltip.js +1 -0
  84. package/helper/helper.js +1 -0
  85. package/helper/helper.js.flow +1 -0
  86. package/layer/layer.js +8 -0
  87. package/layer/layer.js.flow +9 -0
  88. package/map-marker/index.d.ts +6 -5
  89. package/menu/maybe-child-menu.js +1 -0
  90. package/menu/maybe-child-menu.js.flow +1 -0
  91. package/modal/index.d.ts +1 -1
  92. package/modal/types.js.flow +4 -1
  93. package/package.json +3 -2
  94. package/popover/index.d.ts +2 -1
  95. package/popover/popover.js +6 -5
  96. package/popover/popover.js.flow +11 -4
  97. package/popover/stateful-container.js +4 -2
  98. package/popover/stateful-container.js.flow +2 -0
  99. package/popover/types.js.flow +6 -1
  100. package/select/select-component.js +1 -0
  101. package/select/select-component.js.flow +1 -0
  102. package/snackbar/index.d.ts +21 -16
  103. package/themes/shared/lighting.js +5 -1
  104. package/themes/shared/lighting.js.flow +4 -0
  105. package/themes/types.js.flow +4 -0
  106. package/timepicker/index.d.ts +1 -0
  107. package/timepicker/timepicker.js +17 -11
  108. package/timepicker/timepicker.js.flow +31 -12
  109. package/timepicker/types.js.flow +10 -0
  110. package/tooltip/tooltip.js +1 -0
  111. package/tooltip/tooltip.js.flow +6 -1
@@ -48,7 +48,10 @@ export type ModalPropsT = {
48
48
  * Optionally, can pass focus options instead of `true` to control the focus
49
49
  * more precisely (ie. `{ preventScroll: true }`)
50
50
  */
51
- returnFocus?: boolean | FocusOptions,
51
+ returnFocus?:
52
+ | boolean
53
+ | FocusOptions
54
+ | ((returnTo: Element) => boolean | FocusOptions),
52
55
  /** Modal content. The children-as-function API may be preferable
53
56
  * for performance reasons (wont render until opened) */
54
57
  children?: React.Node | (() => React.Node),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "10.6.0",
3
+ "version": "10.7.0",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -197,10 +197,11 @@
197
197
  "glob": "^7.1.6",
198
198
  "just-extend": "^4.0.2",
199
199
  "memoize-one": "^5.1.1",
200
+ "mockdate": "^3.0.5",
200
201
  "polished": "^3.2.0",
201
202
  "popper.js": "^1.16.0",
202
203
  "react-dropzone": "^9.0.0",
203
- "react-focus-lock": "^2.2.1",
204
+ "react-focus-lock": "^2.7.1",
204
205
  "react-input-mask": "^2.0.4",
205
206
  "react-is": "^16.8.6",
206
207
  "react-movable": "^2.5.4",
@@ -96,7 +96,8 @@ export interface BasePopoverProps {
96
96
  accessibilityType?: ACCESSIBILITY_TYPE[keyof ACCESSIBILITY_TYPE];
97
97
  focusLock?: boolean;
98
98
  autoFocus?: boolean;
99
- returnFocus?: boolean;
99
+ focusOptions?: FocusOptions;
100
+ returnFocus?: boolean | FocusOptions | ((returnTo: Element) => (boolean | FocusOptions));
100
101
  'data-baseweb'?: string;
101
102
  id?: string;
102
103
  ignoreBoundary?: boolean;
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
 
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
 
10
- var _reactFocusLock = _interopRequireDefault(require("react-focus-lock"));
10
+ var _reactFocusLock = _interopRequireWildcard(require("react-focus-lock"));
11
11
 
12
12
  var _overrides = require("../helpers/overrides.js");
13
13
 
@@ -213,7 +213,7 @@ var PopoverInner = /*#__PURE__*/function (_React$Component) {
213
213
  value: function componentDidUpdate(prevProps, prevState) {
214
214
  this.init(prevProps, prevState);
215
215
 
216
- if (this.props.autoFocus && this.props.focusLock && !this.state.autoFocusAfterPositioning && this.popperRef.current !== null && this.popperRef.current.getBoundingClientRect().top > 0) {
216
+ if (this.props.autoFocus && !this.state.autoFocusAfterPositioning && this.popperRef.current !== null && this.popperRef.current.getBoundingClientRect().top > 0) {
217
217
  this.setState({
218
218
  autoFocusAfterPositioning: true
219
219
  });
@@ -529,9 +529,10 @@ var PopoverInner = /*#__PURE__*/function (_React$Component) {
529
529
  disabled: !this.props.focusLock,
530
530
  noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
531
531
  ,
532
- returnFocus: this.props.returnFocus && !this.isHoverTrigger(),
533
- autoFocus: this.state.autoFocusAfterPositioning
534
- }, this.renderPopover(renderedContent)))));
532
+ returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
533
+ autoFocus: this.state.autoFocusAfterPositioning,
534
+ focusOptions: this.props.focusOptions
535
+ }, !this.props.focusLock && this.state.autoFocusAfterPositioning ? /*#__PURE__*/React.createElement(_reactFocusLock.MoveFocusInside, null, this.renderPopover(renderedContent)) : this.renderPopover(renderedContent)))));
535
536
  } else {
536
537
  rendered.push( /*#__PURE__*/React.createElement(_styledComponents.Hidden, {
537
538
  key: "hidden-layer"
@@ -8,7 +8,7 @@ LICENSE file in the root directory of this source tree.
8
8
  /* eslint-disable react/no-find-dom-node */
9
9
  /* eslint-disable cup/no-undef */
10
10
  import * as React from 'react';
11
- import FocusLock from 'react-focus-lock';
11
+ import FocusLock, {MoveFocusInside} from 'react-focus-lock';
12
12
 
13
13
  import {getOverride, getOverrideProps} from '../helpers/overrides.js';
14
14
  import {
@@ -73,7 +73,6 @@ class PopoverInner extends React.Component<
73
73
  this.init(prevProps, prevState);
74
74
  if (
75
75
  this.props.autoFocus &&
76
- this.props.focusLock &&
77
76
  !this.state.autoFocusAfterPositioning &&
78
77
  this.popperRef.current !== null &&
79
78
  this.popperRef.current.getBoundingClientRect().top > 0
@@ -475,10 +474,18 @@ class PopoverInner extends React.Component<
475
474
  disabled={!this.props.focusLock}
476
475
  noFocusGuards={false}
477
476
  // see popover-focus-loop.scenario.js for why hover cannot return focus
478
- returnFocus={this.props.returnFocus && !this.isHoverTrigger()}
477
+ returnFocus={!this.isHoverTrigger() && this.props.returnFocus}
479
478
  autoFocus={this.state.autoFocusAfterPositioning}
479
+ focusOptions={this.props.focusOptions}
480
480
  >
481
- {this.renderPopover(renderedContent)}
481
+ {!this.props.focusLock &&
482
+ this.state.autoFocusAfterPositioning ? (
483
+ <MoveFocusInside>
484
+ {this.renderPopover(renderedContent)}
485
+ </MoveFocusInside>
486
+ ) : (
487
+ this.renderPopover(renderedContent)
488
+ )}
482
489
  </FocusLock>
483
490
  </TetherBehavior>
484
491
  </Layer>,
@@ -212,7 +212,8 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
212
212
  returnFocus = _this$props.returnFocus,
213
213
  showArrow = _this$props.showArrow,
214
214
  triggerType = _this$props.triggerType,
215
- popoverMargin = _this$props.popoverMargin;
215
+ popoverMargin = _this$props.popoverMargin,
216
+ focusOptions = _this$props.focusOptions;
216
217
  var popoverProps = {
217
218
  accessibilityType: accessibilityType,
218
219
  autoFocus: autoFocus,
@@ -235,7 +236,8 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
235
236
  returnFocus: returnFocus,
236
237
  showArrow: showArrow,
237
238
  triggerType: triggerType,
238
- popoverMargin: popoverMargin
239
+ popoverMargin: popoverMargin,
240
+ focusOptions: focusOptions
239
241
  };
240
242
 
241
243
  if (dismissOnClickOutside) {
@@ -171,6 +171,7 @@ class StatefulContainer extends React.Component<
171
171
  showArrow,
172
172
  triggerType,
173
173
  popoverMargin,
174
+ focusOptions,
174
175
  } = this.props;
175
176
 
176
177
  const popoverProps: PopoverPropsWithoutChildrenT = {
@@ -196,6 +197,7 @@ class StatefulContainer extends React.Component<
196
197
  showArrow,
197
198
  triggerType,
198
199
  popoverMargin,
200
+ focusOptions,
199
201
  };
200
202
 
201
203
  if (dismissOnClickOutside) {
@@ -83,6 +83,8 @@ export type BasePopoverPropsT = {
83
83
  onClick?: (e: Event) => mixed,
84
84
  /** Handler for 'Esc' keypress events */
85
85
  onFocus?: (e: Event) => mixed,
86
+ /** Pass FocusOptions for focusing (used as `HtmlElement.focus(focusOptions)`) */
87
+ focusOptions?: FocusOptions,
86
88
  /** Handler for mouseenter events on trigger element. */
87
89
  onMouseEnter?: (e: Event) => mixed,
88
90
  /** Number of milliseconds to wait before showing the popover after mouse enters the trigger element (for triggerType `hover`). */
@@ -104,7 +106,10 @@ export type BasePopoverPropsT = {
104
106
  /** If true, focus will shift back to the original element that triggered the popover
105
107
  * Be careful with elements that open the popover on focus (e.g. input) this will cause the popover to reopen on close!
106
108
  */
107
- returnFocus?: boolean,
109
+ returnFocus?:
110
+ | boolean
111
+ | FocusOptions
112
+ | ((returnTo: Element) => boolean | FocusOptions),
108
113
  /** Whether or not to show the arrow pointing from the popover to the trigger. */
109
114
  showArrow?: boolean,
110
115
  /** Whether to toggle the popover when trigger is clicked or hovered. */
@@ -1168,6 +1168,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
1168
1168
  if (!ref) return;
1169
1169
  _this6.anchor = ref.anchorRef;
1170
1170
  },
1171
+ autoFocus: false,
1171
1172
  focusLock: false,
1172
1173
  mountNode: _this6.props.mountNode,
1173
1174
  onEsc: function onEsc() {
@@ -1025,6 +1025,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
1025
1025
  if (!ref) return;
1026
1026
  this.anchor = ref.anchorRef;
1027
1027
  }}
1028
+ autoFocus={false}
1028
1029
  focusLock={false}
1029
1030
  mountNode={this.props.mountNode}
1030
1031
  onEsc={() => this.closeMenu()}
@@ -1,22 +1,27 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  import {Override} from '../overrides';
4
- import {DURATION, PLACEMENT} from './constants.js';
5
- export {DURATION, PLACEMENT} from './constants.js';
6
-
7
- export type DurationT =
8
- | typeof DURATION.infinite
9
- | typeof DURATION.short
10
- | typeof DURATION.medium
11
- | typeof DURATION.long;
12
-
13
- export type PlacementT =
14
- | typeof PLACEMENT.topLeft
15
- | typeof PLACEMENT.top
16
- | typeof PLACEMENT.topRight
17
- | typeof PLACEMENT.bottomLeft
18
- | typeof PLACEMENT.bottom
19
- | typeof PLACEMENT.bottomRight;
4
+
5
+ declare const DURATION: {
6
+ infinite: number;
7
+ short: number;
8
+ medium: number;
9
+ long: number;
10
+ };
11
+
12
+ declare const PLACEMENT: {
13
+ topLeft: 'topLeft';
14
+ top: 'top';
15
+ topRight: 'topRight';
16
+ bottomRight: 'bottomRight';
17
+ bottom: 'bottom';
18
+ bottomLeft: 'bottomLeft';
19
+ };
20
+ export {DURATION, PLACEMENT};
21
+
22
+ export type DurationT = (typeof DURATION)[keyof typeof DURATION];
23
+
24
+ export type PlacementT = (typeof PLACEMENT)[keyof typeof PLACEMENT];
20
25
 
21
26
  export type SnackbarElementOverridesT = {
22
27
  Root?: Override<any>;
@@ -22,7 +22,11 @@ var lighting = {
22
22
  overlay300: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.12)',
23
23
  overlay400: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.16)',
24
24
  overlay500: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.2)',
25
- overlay600: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.24)'
25
+ overlay600: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.24)',
26
+ shallowAbove: '0px -4px 16px rgba(0, 0, 0, 0.12)',
27
+ shallowBelow: '0px 4px 16px rgba(0, 0, 0, 0.12)',
28
+ deepAbove: '0px -16px 48px rgba(0, 0, 0, 0.22)',
29
+ deepBelow: '0px 16px 48px rgba(0, 0, 0, 0.22)'
26
30
  };
27
31
  var _default = lighting;
28
32
  exports.default = _default;
@@ -19,6 +19,10 @@ const lighting: LightingT = {
19
19
  overlay400: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.16)',
20
20
  overlay500: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.2)',
21
21
  overlay600: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.24)',
22
+ shallowAbove: '0px -4px 16px rgba(0, 0, 0, 0.12)',
23
+ shallowBelow: '0px 4px 16px rgba(0, 0, 0, 0.12)',
24
+ deepAbove: '0px -16px 48px rgba(0, 0, 0, 0.22)',
25
+ deepBelow: '0px 16px 48px rgba(0, 0, 0, 0.22)',
22
26
  };
23
27
 
24
28
  export default lighting;
@@ -690,6 +690,10 @@ export type LightingT = {
690
690
  overlay400: string,
691
691
  overlay500: string,
692
692
  overlay600: string,
693
+ shallowAbove: string,
694
+ shallowBelow: string,
695
+ deepAbove: string,
696
+ deepBelow: string,
693
697
  };
694
698
 
695
699
  export type AnimationT = {
@@ -22,6 +22,7 @@ export interface TimePickerProps {
22
22
  size?: SIZE[keyof SIZE];
23
23
  minTime?: Date;
24
24
  maxTime?: Date;
25
+ ignoreMinMaxDateComponent?: boolean;
25
26
  }
26
27
  export interface TimePickerState {
27
28
  steps: number[];
@@ -219,26 +219,31 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
219
219
  _defineProperty(_assertThisInitialized(_this), "getTimeWindowInSeconds", function (step) {
220
220
  var _this$props = _this.props,
221
221
  min = _this$props.minTime,
222
- max = _this$props.maxTime;
222
+ max = _this$props.maxTime,
223
+ ignoreMinMaxDateComponent = _this$props.ignoreMinMaxDateComponent;
223
224
 
224
- var midnight = _this.setTime(_this.props.value, 0, 0, 0);
225
+ var dayStart = _this.setTime(_this.props.value, 0, 0, 0);
225
226
 
226
- if (!min) {
227
- min = midnight;
227
+ var dayEnd = _this.setTime(_this.props.value, 24, 0, 0);
228
+
229
+ if (!min || _this.props.adapter.isBefore(min, dayStart) && !ignoreMinMaxDateComponent) {
230
+ min = dayStart;
231
+ } else {
232
+ min = _this.setTime(_this.props.value, _this.props.adapter.getHours(min), _this.props.adapter.getMinutes(min), _this.props.adapter.getSeconds(min));
228
233
  }
229
234
 
230
- if (!max) {
231
- max = _this.setTime(_this.props.value, 24, 0, 0);
235
+ if (!max || _this.props.adapter.isAfter(max, dayEnd) && !ignoreMinMaxDateComponent) {
236
+ max = dayEnd;
232
237
  } else {
233
- // maxTime (if provided) should be inclusive, so add an extra step here
234
- max = _this.props.adapter.setSeconds(_this.props.adapter.date(max), _this.props.adapter.getSeconds(max) + step);
238
+ max = _this.setTime(_this.props.value, _this.props.adapter.getHours(max), _this.props.adapter.getMinutes(max), // maxTime (if provided) should be inclusive, so add an extra second here
239
+ _this.props.adapter.getSeconds(max) + 1);
235
240
  }
236
241
 
237
242
  var minDate = _this.props.adapter.toJsDate(min);
238
243
 
239
244
  var maxDate = _this.props.adapter.toJsDate(max);
240
245
 
241
- var midnightDate = _this.props.adapter.toJsDate(midnight);
246
+ var midnightDate = _this.props.adapter.toJsDate(dayStart);
242
247
 
243
248
  return {
244
249
  start: (minDate - midnightDate) / 1000,
@@ -325,7 +330,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
325
330
  steps: steps,
326
331
  value: this.props.nullable ? undefined : {
327
332
  id: closestStep,
328
- label: this.secondsToLabel(closestStep, undefined)
333
+ label: this.secondsToLabel(closestStep, this.props.format)
329
334
  }
330
335
  });
331
336
 
@@ -427,7 +432,8 @@ _defineProperty(TimePicker, "defaultProps", {
427
432
  format: '12',
428
433
  step: 900,
429
434
  creatable: false,
430
- adapter: _dateFnsAdapter.default
435
+ adapter: _dateFnsAdapter.default,
436
+ ignoreMinMaxDateComponent: false
431
437
  });
432
438
 
433
439
  var _default = TimePicker;
@@ -34,6 +34,7 @@ class TimePicker<T = Date> extends React.Component<
34
34
  step: 900,
35
35
  creatable: false,
36
36
  adapter: dateFnsAdapter,
37
+ ignoreMinMaxDateComponent: false,
37
38
  };
38
39
  dateHelpers: DateHelpers<T>;
39
40
 
@@ -66,7 +67,7 @@ class TimePicker<T = Date> extends React.Component<
66
67
  ? undefined
67
68
  : {
68
69
  id: closestStep,
69
- label: this.secondsToLabel(closestStep, undefined),
70
+ label: this.secondsToLabel(closestStep, this.props.format),
70
71
  },
71
72
  });
72
73
  if (this.props.value || (!this.props.nullable && !this.props.value)) {
@@ -200,24 +201,42 @@ class TimePicker<T = Date> extends React.Component<
200
201
  };
201
202
 
202
203
  getTimeWindowInSeconds = (step: number): {start: number, end: number} => {
203
- let {minTime: min, maxTime: max} = this.props;
204
- let midnight = this.setTime(this.props.value, 0, 0, 0);
205
- if (!min) {
206
- min = midnight;
204
+ let {minTime: min, maxTime: max, ignoreMinMaxDateComponent} = this.props;
205
+ const dayStart = this.setTime(this.props.value, 0, 0, 0);
206
+ const dayEnd = this.setTime(this.props.value, 24, 0, 0);
207
+
208
+ if (
209
+ !min ||
210
+ (this.props.adapter.isBefore(min, dayStart) && !ignoreMinMaxDateComponent)
211
+ ) {
212
+ min = dayStart;
213
+ } else {
214
+ min = this.setTime(
215
+ this.props.value,
216
+ this.props.adapter.getHours(min),
217
+ this.props.adapter.getMinutes(min),
218
+ this.props.adapter.getSeconds(min),
219
+ );
207
220
  }
208
- if (!max) {
209
- max = this.setTime(this.props.value, 24, 0, 0);
221
+
222
+ if (
223
+ !max ||
224
+ (this.props.adapter.isAfter(max, dayEnd) && !ignoreMinMaxDateComponent)
225
+ ) {
226
+ max = dayEnd;
210
227
  } else {
211
- // maxTime (if provided) should be inclusive, so add an extra step here
212
- max = this.props.adapter.setSeconds(
213
- this.props.adapter.date(max),
214
- this.props.adapter.getSeconds(max) + step,
228
+ max = this.setTime(
229
+ this.props.value,
230
+ this.props.adapter.getHours(max),
231
+ this.props.adapter.getMinutes(max),
232
+ // maxTime (if provided) should be inclusive, so add an extra second here
233
+ this.props.adapter.getSeconds(max) + 1,
215
234
  );
216
235
  }
217
236
 
218
237
  const minDate = this.props.adapter.toJsDate(min);
219
238
  const maxDate = this.props.adapter.toJsDate(max);
220
- const midnightDate = this.props.adapter.toJsDate(midnight);
239
+ const midnightDate = this.props.adapter.toJsDate(dayStart);
221
240
  return {
222
241
  start: (minDate - midnightDate) / 1000,
223
242
  end: (maxDate - midnightDate) / 1000,
@@ -37,6 +37,15 @@ export type TimePickerPropsT<T = Date> = {
37
37
  size?: SizeT,
38
38
  minTime?: T,
39
39
  maxTime?: T,
40
+ /**
41
+ * There are two strategies available for setting min/max times. If the min/max datetimes are
42
+ * beyond the start/end times of the current value's date, Timepicker could either clamp the
43
+ * min/max time of the start/end of the day or it can ignore the min/max date components and
44
+ * only apply the time components. Each strategy has the potential to save developer time in
45
+ * avoiding the need to perform conversion before providing min/max datetimes to the component.
46
+ * By default the component will clamp the time window and setting this flag will ignore dates.
47
+ */
48
+ ignoreMinMaxDateComponent?: boolean,
40
49
  };
41
50
  export type TimePickerStateT = {
42
51
  /** List of times (in seconds) displayed in the dropdown menu. */
@@ -50,6 +59,7 @@ export type TimePickerDefaultPropsT = {
50
59
  step: 900,
51
60
  creatable: false,
52
61
  adapter: DateIOAdapter<Date>,
62
+ ignoreMinMaxDateComponent: false,
53
63
  };
54
64
 
55
65
  declare var __DEV__: boolean;
@@ -71,6 +71,7 @@ var Tooltip = /*#__PURE__*/function (_React$Component) {
71
71
  Inner: _styledComponents.Inner
72
72
  }, this.props.overrides);
73
73
  return /*#__PURE__*/React.createElement(_index.Popover, _extends({
74
+ autoFocus: false,
74
75
  "data-baseweb": "tooltip"
75
76
  }, this.props, {
76
77
  overrides: overrides
@@ -32,7 +32,12 @@ class Tooltip extends React.Component<TooltipPropsT> {
32
32
  this.props.overrides,
33
33
  );
34
34
  return (
35
- <Popover data-baseweb="tooltip" {...this.props} overrides={overrides} />
35
+ <Popover
36
+ autoFocus={false}
37
+ data-baseweb="tooltip"
38
+ {...this.props}
39
+ overrides={overrides}
40
+ />
36
41
  );
37
42
  }
38
43
  }