baseui 10.5.0 → 10.7.2

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 (165) 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/button/styled-components.js +1 -1
  4. package/button/styled-components.js.flow +4 -1
  5. package/card/styled-components.js +0 -1
  6. package/card/styled-components.js.flow +0 -1
  7. package/combobox/combobox.js +5 -1
  8. package/combobox/combobox.js.flow +4 -0
  9. package/combobox/index.d.ts +6 -3
  10. package/data-table/column-datetime.js +2 -0
  11. package/data-table/column-datetime.js.flow +2 -0
  12. package/datepicker/calendar-header.js +255 -109
  13. package/datepicker/calendar-header.js.flow +282 -145
  14. package/datepicker/calendar.js +6 -1
  15. package/datepicker/calendar.js.flow +5 -1
  16. package/datepicker/constants.js +9 -2
  17. package/datepicker/constants.js.flow +7 -0
  18. package/datepicker/datepicker.js +135 -73
  19. package/datepicker/datepicker.js.flow +161 -62
  20. package/datepicker/day.js +2 -0
  21. package/datepicker/day.js.flow +2 -0
  22. package/datepicker/index.d.ts +8 -0
  23. package/datepicker/month.js +4 -0
  24. package/datepicker/month.js.flow +3 -0
  25. package/datepicker/styled-components.js +116 -56
  26. package/datepicker/styled-components.js.flow +101 -36
  27. package/datepicker/types.js.flow +18 -1
  28. package/datepicker/utils/calendar-header-helpers.js +51 -0
  29. package/datepicker/utils/calendar-header-helpers.js.flow +53 -0
  30. package/datepicker/utils/date-helpers.js +1 -1
  31. package/datepicker/utils/date-helpers.js.flow +1 -1
  32. package/datepicker/week.js +1 -0
  33. package/datepicker/week.js.flow +1 -0
  34. package/dnd-list/index.js.flow +2 -1
  35. package/dnd-list/list.js +1 -2
  36. package/dnd-list/list.js.flow +1 -1
  37. package/dnd-list/styled-components.js +1 -1
  38. package/dnd-list/styled-components.js.flow +1 -0
  39. package/drawer/drawer.js +2 -1
  40. package/drawer/drawer.js.flow +1 -1
  41. package/es/app-nav-bar/user-menu.js +1 -0
  42. package/es/button/styled-components.js +1 -1
  43. package/es/card/styled-components.js +0 -1
  44. package/es/combobox/combobox.js +5 -1
  45. package/es/data-table/column-datetime.js +2 -0
  46. package/es/datepicker/calendar-header.js +204 -93
  47. package/es/datepicker/calendar.js +7 -2
  48. package/es/datepicker/constants.js +6 -1
  49. package/es/datepicker/datepicker.js +70 -42
  50. package/es/datepicker/day.js +2 -0
  51. package/es/datepicker/month.js +3 -0
  52. package/es/datepicker/styled-components.js +98 -37
  53. package/es/datepicker/types.js +1 -1
  54. package/es/datepicker/utils/calendar-header-helpers.js +34 -0
  55. package/es/datepicker/utils/date-helpers.js +1 -1
  56. package/es/datepicker/week.js +1 -0
  57. package/es/dnd-list/index.js +2 -1
  58. package/es/dnd-list/list.js +1 -2
  59. package/es/dnd-list/styled-components.js +1 -0
  60. package/es/drawer/drawer.js +2 -1
  61. package/es/helper/helper.js +1 -0
  62. package/es/layer/layer.js +8 -0
  63. package/es/menu/maybe-child-menu.js +1 -0
  64. package/es/popover/popover.js +6 -5
  65. package/es/popover/stateful-container.js +8 -2
  66. package/es/rating/emoticon-rating.js +3 -1
  67. package/es/rating/star-rating.js +3 -1
  68. package/es/select/select-component.js +5 -5
  69. package/es/select/styled-components.js +34 -4
  70. package/es/snackbar/snackbar-context.js +16 -4
  71. package/es/table-semantic/styled-components.js +6 -4
  72. package/es/table-semantic/table-builder.js +3 -0
  73. package/es/themes/dark-theme/color-component-tokens.js +1 -1
  74. package/es/themes/light-theme/color-component-tokens.js +9 -9
  75. package/es/themes/shared/lighting.js +5 -1
  76. package/es/timepicker/timepicker.js +16 -11
  77. package/es/tooltip/styled-components.js +8 -0
  78. package/es/tooltip/tooltip.js +1 -0
  79. package/esm/app-nav-bar/user-menu.js +1 -0
  80. package/esm/button/styled-components.js +1 -1
  81. package/esm/card/styled-components.js +0 -1
  82. package/esm/combobox/combobox.js +5 -1
  83. package/esm/data-table/column-datetime.js +2 -0
  84. package/esm/datepicker/calendar-header.js +255 -110
  85. package/esm/datepicker/calendar.js +7 -2
  86. package/esm/datepicker/constants.js +6 -1
  87. package/esm/datepicker/datepicker.js +136 -74
  88. package/esm/datepicker/day.js +2 -0
  89. package/esm/datepicker/month.js +3 -0
  90. package/esm/datepicker/styled-components.js +112 -55
  91. package/esm/datepicker/types.js +1 -1
  92. package/esm/datepicker/utils/calendar-header-helpers.js +45 -0
  93. package/esm/datepicker/utils/date-helpers.js +1 -1
  94. package/esm/datepicker/week.js +1 -0
  95. package/esm/dnd-list/index.js +2 -1
  96. package/esm/dnd-list/list.js +1 -2
  97. package/esm/dnd-list/styled-components.js +1 -1
  98. package/esm/drawer/drawer.js +2 -1
  99. package/esm/helper/helper.js +1 -0
  100. package/esm/layer/layer.js +8 -0
  101. package/esm/menu/maybe-child-menu.js +1 -0
  102. package/esm/popover/popover.js +6 -5
  103. package/esm/popover/stateful-container.js +8 -2
  104. package/esm/rating/emoticon-rating.js +2 -2
  105. package/esm/rating/star-rating.js +2 -2
  106. package/esm/select/select-component.js +5 -5
  107. package/esm/select/styled-components.js +28 -4
  108. package/esm/snackbar/snackbar-context.js +16 -4
  109. package/esm/table-semantic/styled-components.js +6 -4
  110. package/esm/table-semantic/table-builder.js +3 -0
  111. package/esm/themes/dark-theme/color-component-tokens.js +1 -1
  112. package/esm/themes/light-theme/color-component-tokens.js +9 -9
  113. package/esm/themes/shared/lighting.js +5 -1
  114. package/esm/timepicker/timepicker.js +17 -11
  115. package/esm/tooltip/styled-components.js +8 -0
  116. package/esm/tooltip/tooltip.js +1 -0
  117. package/helper/helper.js +1 -0
  118. package/helper/helper.js.flow +1 -0
  119. package/layer/layer.js +8 -0
  120. package/layer/layer.js.flow +9 -0
  121. package/link/index.d.ts +1 -0
  122. package/map-marker/index.d.ts +6 -5
  123. package/menu/index.d.ts +7 -0
  124. package/menu/maybe-child-menu.js +1 -0
  125. package/menu/maybe-child-menu.js.flow +1 -0
  126. package/menu/types.js.flow +12 -0
  127. package/modal/index.d.ts +1 -1
  128. package/modal/types.js.flow +4 -1
  129. package/package.json +4 -3
  130. package/popover/index.d.ts +2 -1
  131. package/popover/popover.js +6 -5
  132. package/popover/popover.js.flow +11 -4
  133. package/popover/stateful-container.js +8 -2
  134. package/popover/stateful-container.js.flow +5 -0
  135. package/popover/types.js.flow +6 -1
  136. package/rating/emoticon-rating.js +2 -2
  137. package/rating/emoticon-rating.js.flow +4 -1
  138. package/rating/star-rating.js +2 -2
  139. package/rating/star-rating.js.flow +4 -1
  140. package/select/select-component.js +5 -5
  141. package/select/select-component.js.flow +5 -5
  142. package/select/styled-components.js +28 -4
  143. package/select/styled-components.js.flow +30 -2
  144. package/snackbar/index.d.ts +21 -16
  145. package/snackbar/snackbar-context.js +15 -4
  146. package/snackbar/snackbar-context.js.flow +15 -3
  147. package/table-semantic/styled-components.js +6 -4
  148. package/table-semantic/styled-components.js.flow +6 -4
  149. package/table-semantic/table-builder.js +3 -0
  150. package/table-semantic/table-builder.js.flow +3 -0
  151. package/themes/dark-theme/color-component-tokens.js +1 -1
  152. package/themes/dark-theme/color-component-tokens.js.flow +1 -1
  153. package/themes/light-theme/color-component-tokens.js +9 -9
  154. package/themes/light-theme/color-component-tokens.js.flow +9 -9
  155. package/themes/shared/lighting.js +5 -1
  156. package/themes/shared/lighting.js.flow +4 -0
  157. package/themes/types.js.flow +4 -0
  158. package/timepicker/index.d.ts +1 -0
  159. package/timepicker/timepicker.js +17 -11
  160. package/timepicker/timepicker.js.flow +31 -12
  161. package/timepicker/types.js.flow +10 -0
  162. package/tooltip/styled-components.js +8 -0
  163. package/tooltip/styled-components.js.flow +8 -0
  164. package/tooltip/tooltip.js +1 -0
  165. package/tooltip/tooltip.js.flow +6 -1
@@ -326,25 +326,49 @@ function getSvgStyles(_ref4) {
326
326
  }
327
327
 
328
328
  export var StyledSelectArrow = styled('svg', function (props) {
329
+ var _sizes;
330
+
329
331
  var $theme = props.$theme,
330
- $disabled = props.$disabled;
332
+ $disabled = props.$disabled,
333
+ $size = props.$size;
331
334
  var colors = $theme.colors;
335
+ var sizes = (_sizes = {}, _defineProperty(_sizes, SIZE.mini, 16), _defineProperty(_sizes, SIZE.compact, 16), _defineProperty(_sizes, SIZE.default, 20), _defineProperty(_sizes, SIZE.large, 24), _sizes);
336
+ var size = sizes[SIZE.default];
337
+
338
+ if ($size) {
339
+ size = sizes[$size];
340
+ }
341
+
332
342
  return _objectSpread(_objectSpread({}, getSvgStyles({
333
343
  $theme: $theme
334
344
  })), {}, {
335
345
  color: $disabled ? colors.inputTextDisabled : colors.contentPrimary,
336
- cursor: $disabled ? 'not-allowed' : 'pointer'
346
+ cursor: $disabled ? 'not-allowed' : 'pointer',
347
+ height: "".concat(size, "px"),
348
+ width: "".concat(size, "px")
337
349
  });
338
350
  });
339
351
  StyledSelectArrow.displayName = "StyledSelectArrow";
340
352
  export var StyledClearIcon = styled('svg', function (props) {
341
- var $theme = props.$theme;
353
+ var _sizes2;
354
+
355
+ var $theme = props.$theme,
356
+ $size = props.$size;
342
357
  var colors = $theme.colors;
358
+ var sizes = (_sizes2 = {}, _defineProperty(_sizes2, SIZE.mini, 15), _defineProperty(_sizes2, SIZE.compact, 15), _defineProperty(_sizes2, SIZE.default, 18), _defineProperty(_sizes2, SIZE.large, 22), _sizes2);
359
+ var size = sizes[SIZE.default];
360
+
361
+ if ($size) {
362
+ size = sizes[$size];
363
+ }
364
+
343
365
  return _objectSpread(_objectSpread({}, getSvgStyles({
344
366
  $theme: $theme
345
367
  })), {}, {
346
368
  color: colors.contentPrimary,
347
- cursor: 'pointer'
369
+ cursor: 'pointer',
370
+ height: "".concat(size, "px"),
371
+ width: "".concat(size, "px")
348
372
  });
349
373
  });
350
374
  StyledClearIcon.displayName = "StyledClearIcon";
@@ -61,6 +61,15 @@ export function useSnackbar() {
61
61
  dequeue: context.dequeue
62
62
  };
63
63
  }
64
+
65
+ function usePrevious(value) {
66
+ var ref = React.useRef();
67
+ React.useEffect(function () {
68
+ ref.current = value;
69
+ });
70
+ return ref.current;
71
+ }
72
+
64
73
  export default function SnackbarProvider(_ref) {
65
74
  var children = _ref.children,
66
75
  _ref$overrides = _ref.overrides,
@@ -95,10 +104,6 @@ export default function SnackbarProvider(_ref) {
95
104
  function enqueue(elementProps) {
96
105
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultDuration;
97
106
  setSnackbars(function (prev) {
98
- if (prev.length === 0) {
99
- enter(duration);
100
- }
101
-
102
107
  return [].concat(_toConsumableArray(prev), [{
103
108
  elementProps: elementProps,
104
109
  duration: duration
@@ -106,6 +111,13 @@ export default function SnackbarProvider(_ref) {
106
111
  });
107
112
  }
108
113
 
114
+ var prevSnackbars = usePrevious(snackbars) || [];
115
+ React.useEffect(function () {
116
+ if (prevSnackbars.length === 0 && snackbars.length >= 1) {
117
+ enter(snackbars[0].duration);
118
+ }
119
+ }, [snackbars, prevSnackbars]);
120
+
109
121
  function dequeue() {
110
122
  setContainerHeight(0);
111
123
  setSnackbars(function (prev) {
@@ -70,7 +70,8 @@ export var StyledTableHeadCell = styled('th', function (_ref5) {
70
70
 
71
71
  var $theme = _ref5.$theme,
72
72
  $size = _ref5.$size,
73
- $divider = _ref5.$divider;
73
+ $divider = _ref5.$divider,
74
+ $isNumeric = _ref5.$isNumeric;
74
75
  var borderDir = $theme.direction === 'rtl' ? 'Left' : 'Right';
75
76
  var borderVertical = $divider === DIVIDER.grid || $divider === DIVIDER.vertical;
76
77
  var padding = sizeToCellPadding($theme, $size);
@@ -83,7 +84,7 @@ export var StyledTableHeadCell = styled('th', function (_ref5) {
83
84
  paddingLeft: padding,
84
85
  backgroundColor: $theme.colors.tableHeadBackgroundColor,
85
86
  color: $theme.colors.contentPrimary,
86
- textAlign: $theme.direction === 'rtl' ? 'right' : 'left',
87
+ textAlign: $theme.direction === 'rtl' || $isNumeric ? 'right' : 'left',
87
88
  verticalAlign: 'top',
88
89
  whiteSpace: 'nowrap',
89
90
  zIndex: 1
@@ -164,14 +165,15 @@ export var StyledTableBodyCell = styled('td', function (_ref12) {
164
165
  $size = _ref12.$size,
165
166
  $divider = _ref12.$divider,
166
167
  $isNumeric = _ref12.$isNumeric,
167
- $isLastRow = _ref12.$isLastRow;
168
+ $isLastRow = _ref12.$isLastRow,
169
+ $isSortable = _ref12.$isSortable;
168
170
  var borderDir = $theme.direction === 'rtl' ? 'Left' : 'Right';
169
171
  var borderVertical = $divider === DIVIDER.vertical || $divider === DIVIDER.grid;
170
172
  var borderHorizontal = $divider === undefined || $divider === DIVIDER.horizontal || $divider === DIVIDER.grid;
171
173
  var padding = sizeToCellPadding($theme, $size);
172
174
  return _objectSpread(_objectSpread({}, $theme.typography.font200), {}, {
173
175
  paddingTop: padding,
174
- paddingRight: padding,
176
+ paddingRight: !$isSortable ? padding : $theme.sizing.scale1000,
175
177
  paddingBottom: padding,
176
178
  paddingLeft: padding,
177
179
  color: $theme.colors.contentPrimary,
@@ -200,6 +200,7 @@ var TableBuilder = /*#__PURE__*/function (_React$Component) {
200
200
  $col: col,
201
201
  $colIndex: colIndex,
202
202
  $divider: divider,
203
+ $isNumeric: col.numeric,
203
204
  $size: size
204
205
  }, tableHeadCellProps, colTableHeadCellProps), col.header);
205
206
  }
@@ -242,6 +243,7 @@ var TableBuilder = /*#__PURE__*/function (_React$Component) {
242
243
  $col: col,
243
244
  $colIndex: colIndex,
244
245
  $divider: divider,
246
+ $isNumeric: col.numeric,
245
247
  role: "button",
246
248
  tabIndex: "0",
247
249
  "aria-label": "".concat(col.tableHeadAriaLabel || col.header, ", ").concat(sortLabel),
@@ -275,6 +277,7 @@ var TableBuilder = /*#__PURE__*/function (_React$Component) {
275
277
  $rowIndex: rowIndex,
276
278
  $isNumeric: col.numeric,
277
279
  $isLastRow: rowIndex === lastRowindex,
280
+ $isSortable: col.sortable,
278
281
  $size: size
279
282
  }, tableBodyCellProps, colTableBodyCellProps), col.children(row, rowIndex));
280
283
  }
@@ -93,7 +93,7 @@ export default (function () {
93
93
  linkActive: themePrimitives.primary300,
94
94
  // List
95
95
  listHeaderFill: themePrimitives.mono600,
96
- listBodyFill: themePrimitives.mono700,
96
+ listBodyFill: themePrimitives.mono800,
97
97
  listIconFill: themePrimitives.mono100,
98
98
  listBorder: themePrimitives.mono500,
99
99
  // ProgressSteps
@@ -22,32 +22,32 @@ export default (function () {
22
22
  buttonPrimaryActive: themePrimitives.primary600,
23
23
  buttonPrimarySelectedFill: themePrimitives.primary600,
24
24
  buttonPrimarySelectedText: themePrimitives.white,
25
- buttonPrimarySpinnerForeground: themePrimitives.primary50,
26
- buttonPrimarySpinnerBackground: themePrimitives.primary500,
25
+ buttonPrimarySpinnerForeground: themePrimitives.accent,
26
+ buttonPrimarySpinnerBackground: themePrimitives.primaryB,
27
27
  buttonSecondaryFill: themePrimitives.primary100,
28
28
  buttonSecondaryText: themePrimitives.primary,
29
29
  buttonSecondaryHover: themePrimitives.primary200,
30
30
  buttonSecondaryActive: themePrimitives.primary300,
31
31
  buttonSecondarySelectedFill: themePrimitives.primary300,
32
32
  buttonSecondarySelectedText: themePrimitives.primary,
33
- buttonSecondarySpinnerForeground: themePrimitives.primary700,
34
- buttonSecondarySpinnerBackground: themePrimitives.primary300,
33
+ buttonSecondarySpinnerForeground: themePrimitives.accent,
34
+ buttonSecondarySpinnerBackground: themePrimitives.primaryB,
35
35
  buttonTertiaryFill: 'transparent',
36
36
  buttonTertiaryText: themePrimitives.primary,
37
37
  buttonTertiaryHover: themePrimitives.primary50,
38
38
  buttonTertiaryActive: themePrimitives.primary100,
39
39
  buttonTertiarySelectedFill: themePrimitives.primary100,
40
40
  buttonTertiarySelectedText: themePrimitives.primary,
41
- buttonTertiarySpinnerForeground: themePrimitives.primary700,
42
- buttonTertiarySpinnerBackground: themePrimitives.primary300,
41
+ buttonTertiarySpinnerForeground: themePrimitives.accent,
42
+ buttonTertiarySpinnerBackground: themePrimitives.primary100,
43
43
  buttonMinimalFill: 'transparent',
44
44
  buttonMinimalText: themePrimitives.primary,
45
45
  buttonMinimalHover: themePrimitives.primary50,
46
46
  buttonMinimalActive: themePrimitives.primary100,
47
47
  buttonMinimalSelectedFill: themePrimitives.primary100,
48
48
  buttonMinimalSelectedText: themePrimitives.primary,
49
- buttonMinimalSpinnerForeground: themePrimitives.primary700,
50
- buttonMinimalSpinnerBackground: themePrimitives.primary300,
49
+ buttonMinimalSpinnerForeground: themePrimitives.accent,
50
+ buttonMinimalSpinnerBackground: themePrimitives.primary100,
51
51
  buttonDisabledFill: themePrimitives.mono200,
52
52
  buttonDisabledText: themePrimitives.mono600,
53
53
  buttonDisabledSpinnerForeground: themePrimitives.mono600,
@@ -93,7 +93,7 @@ export default (function () {
93
93
  linkActive: themePrimitives.primary500,
94
94
  // List
95
95
  listHeaderFill: themePrimitives.white,
96
- listBodyFill: themePrimitives.mono200,
96
+ listBodyFill: themePrimitives.white,
97
97
  listIconFill: themePrimitives.mono500,
98
98
  listBorder: themePrimitives.mono500,
99
99
  // ProgressSteps
@@ -15,6 +15,10 @@ var lighting = {
15
15
  overlay300: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.12)',
16
16
  overlay400: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.16)',
17
17
  overlay500: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.2)',
18
- overlay600: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.24)'
18
+ overlay600: 'inset 0 0 0 1000px hsla(0, 0%, 0%, 0.24)',
19
+ shallowAbove: '0px -4px 16px rgba(0, 0, 0, 0.12)',
20
+ shallowBelow: '0px 4px 16px rgba(0, 0, 0, 0.12)',
21
+ deepAbove: '0px -16px 48px rgba(0, 0, 0, 0.22)',
22
+ deepBelow: '0px 16px 48px rgba(0, 0, 0, 0.22)'
19
23
  };
20
24
  export default lighting;
@@ -206,26 +206,31 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
206
206
  _defineProperty(_assertThisInitialized(_this), "getTimeWindowInSeconds", function (step) {
207
207
  var _this$props = _this.props,
208
208
  min = _this$props.minTime,
209
- max = _this$props.maxTime;
209
+ max = _this$props.maxTime,
210
+ ignoreMinMaxDateComponent = _this$props.ignoreMinMaxDateComponent;
210
211
 
211
- var midnight = _this.setTime(_this.props.value, 0, 0, 0);
212
+ var dayStart = _this.setTime(_this.props.value, 0, 0, 0);
212
213
 
213
- if (!min) {
214
- min = midnight;
214
+ var dayEnd = _this.setTime(_this.props.value, 24, 0, 0);
215
+
216
+ if (!min || _this.props.adapter.isBefore(min, dayStart) && !ignoreMinMaxDateComponent) {
217
+ min = dayStart;
218
+ } else {
219
+ min = _this.setTime(_this.props.value, _this.props.adapter.getHours(min), _this.props.adapter.getMinutes(min), _this.props.adapter.getSeconds(min));
215
220
  }
216
221
 
217
- if (!max) {
218
- max = _this.setTime(_this.props.value, 24, 0, 0);
222
+ if (!max || _this.props.adapter.isAfter(max, dayEnd) && !ignoreMinMaxDateComponent) {
223
+ max = dayEnd;
219
224
  } else {
220
- // maxTime (if provided) should be inclusive, so add an extra step here
221
- max = _this.props.adapter.setSeconds(_this.props.adapter.date(max), _this.props.adapter.getSeconds(max) + step);
225
+ 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
226
+ _this.props.adapter.getSeconds(max) + 1);
222
227
  }
223
228
 
224
229
  var minDate = _this.props.adapter.toJsDate(min);
225
230
 
226
231
  var maxDate = _this.props.adapter.toJsDate(max);
227
232
 
228
- var midnightDate = _this.props.adapter.toJsDate(midnight);
233
+ var midnightDate = _this.props.adapter.toJsDate(dayStart);
229
234
 
230
235
  return {
231
236
  start: (minDate - midnightDate) / 1000,
@@ -312,7 +317,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
312
317
  steps: steps,
313
318
  value: this.props.nullable ? undefined : {
314
319
  id: closestStep,
315
- label: this.secondsToLabel(closestStep, undefined)
320
+ label: this.secondsToLabel(closestStep, this.props.format)
316
321
  }
317
322
  });
318
323
 
@@ -414,7 +419,8 @@ _defineProperty(TimePicker, "defaultProps", {
414
419
  format: '12',
415
420
  step: 900,
416
421
  creatable: false,
417
- adapter: dateFnsAdapter
422
+ adapter: dateFnsAdapter,
423
+ ignoreMinMaxDateComponent: false
418
424
  });
419
425
 
420
426
  export default TimePicker;
@@ -28,6 +28,10 @@ import { getEndPosition } from '../popover/utils.js';
28
28
  export var Body = styled('div', function (props) {
29
29
  return _objectSpread(_objectSpread({}, getBodyStyles(props)), {}, {
30
30
  backgroundColor: props.$theme.colors.tooltipBackground,
31
+ borderTopLeftRadius: props.$theme.borders.radius300,
32
+ borderTopRightRadius: props.$theme.borders.radius300,
33
+ borderBottomRightRadius: props.$theme.borders.radius300,
34
+ borderBottomLeftRadius: props.$theme.borders.radius300,
31
35
  boxShadow: props.$theme.lighting.shadow400,
32
36
  color: props.$theme.colors.tooltipText,
33
37
  // Reset transition property to opacity only, and static transform
@@ -39,6 +43,10 @@ Body.displayName = "Body";
39
43
  export var Inner = styled('div', function (props) {
40
44
  return _objectSpread(_objectSpread(_objectSpread({}, getInnerStyles(props)), {}, {
41
45
  backgroundColor: props.$theme.colors.tooltipBackground,
46
+ borderTopLeftRadius: props.$theme.borders.radius300,
47
+ borderTopRightRadius: props.$theme.borders.radius300,
48
+ borderBottomRightRadius: props.$theme.borders.radius300,
49
+ borderBottomLeftRadius: props.$theme.borders.radius300,
42
50
  paddingTop: props.$theme.sizing.scale300,
43
51
  paddingBottom: props.$theme.sizing.scale300,
44
52
  paddingLeft: props.$theme.sizing.scale600,
@@ -62,6 +62,7 @@ var Tooltip = /*#__PURE__*/function (_React$Component) {
62
62
  Inner: StyledInner
63
63
  }, this.props.overrides);
64
64
  return /*#__PURE__*/React.createElement(Popover, _extends({
65
+ autoFocus: false,
65
66
  "data-baseweb": "tooltip"
66
67
  }, this.props, {
67
68
  overrides: overrides
package/helper/helper.js CHANGED
@@ -55,6 +55,7 @@ function Helper(props) {
55
55
  React.createElement(_index.Popover, _extends({
56
56
  "data-baseweb": "helper"
57
57
  }, restProps, {
58
+ autoFocus: false,
58
59
  placement: placement,
59
60
  overrides: mergedOverrides
60
61
  }))
@@ -36,6 +36,7 @@ export function Helper(props: PropsT) {
36
36
  <Popover
37
37
  data-baseweb="helper"
38
38
  {...restProps}
39
+ autoFocus={false}
39
40
  placement={placement}
40
41
  overrides={mergedOverrides}
41
42
  />
package/layer/layer.js CHANGED
@@ -141,6 +141,14 @@ var LayerComponent = /*#__PURE__*/function (_React$Component) {
141
141
  if (host && host !== prevProps.host && prevProps.host === null) {
142
142
  this.addContainer(host);
143
143
  }
144
+
145
+ if (prevProps.isHoverLayer != this.props.isHoverLayer) {
146
+ if (this.props.isHoverLayer) {
147
+ this.context.removeDocClickHandler(this.onDocumentClick);
148
+ } else {
149
+ this.context.addDocClickHandler(this.onDocumentClick);
150
+ }
151
+ }
144
152
  }
145
153
  }, {
146
154
  key: "componentWillUnmount",
@@ -61,9 +61,18 @@ class LayerComponent extends React.Component<
61
61
  if (mountNode) {
62
62
  return;
63
63
  }
64
+
64
65
  if (host && host !== prevProps.host && prevProps.host === null) {
65
66
  this.addContainer(host);
66
67
  }
68
+
69
+ if (prevProps.isHoverLayer != this.props.isHoverLayer) {
70
+ if (this.props.isHoverLayer) {
71
+ this.context.removeDocClickHandler(this.onDocumentClick);
72
+ } else {
73
+ this.context.addDocClickHandler(this.onDocumentClick);
74
+ }
75
+ }
67
76
  }
68
77
 
69
78
  componentWillUnmount() {
package/link/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface LinkProps
6
6
  React.AnchorHTMLAttributes<HTMLAnchorElement>,
7
7
  HTMLAnchorElement
8
8
  > {
9
+ animateUnderline?: boolean;
9
10
  target?: '_self' | '_blank' | '_parent' | '_top';
10
11
  }
11
12
 
@@ -40,11 +40,12 @@ export interface FLOATING_MARKER_ANCHOR_TYPES {
40
40
  square: 'square';
41
41
  }
42
42
 
43
- export type NeedleSizeT = ValueOf<NEEDLE_SIZES>;
44
- export type PinHeadT = ValueOf<PINHEAD_TYPES>;
45
- export type PinHeadSizeT = ValueOf<PINHEAD_SIZES_SHAPES>;
46
- export type AnchorPositionsT = ValueOf<FLOATING_MARKER_ANCHOR_POSITIONS>;
47
- export type FloatingMarkerSizeT = ValueOf<FLOATING_MARKER_SIZES>;
43
+ export type NeedleSizeT = NEEDLE_SIZES[keyof NEEDLE_SIZES];
44
+ export type PinHeadT = PINHEAD_TYPES[keyof PINHEAD_TYPES];
45
+ export type PinHeadSizeT = PINHEAD_SIZES_SHAPES[keyof PINHEAD_SIZES_SHAPES];
46
+ export type AnchorPositionsT = FLOATING_MARKER_ANCHOR_POSITIONS[keyof FLOATING_MARKER_ANCHOR_POSITIONS];
47
+ export type FloatingMarkerSizeT = FLOATING_MARKER_SIZES[keyof FLOATING_MARKER_SIZES];
48
+ export type FloatingMarkerAnchorTypeT = FLOATING_MARKER_ANCHOR_TYPES[keyof FLOATING_MARKER_ANCHOR_TYPES];
48
49
 
49
50
  export type FixedMarkerOverridesT = {
50
51
  Root?: Override<any>;
package/menu/index.d.ts CHANGED
@@ -123,6 +123,7 @@ export interface OptionListProps extends BaseMenuPropsT {
123
123
  item: any;
124
124
  getItemLabel: (item: any) => React.ReactNode;
125
125
  getChildMenu?: (item: any) => React.ReactNode;
126
+ onMouseDown?: (event: MouseEvent) => any;
126
127
  onMouseEnter?: (event: MouseEvent) => any;
127
128
  size?: OPTION_LIST_SIZE[keyof OPTION_LIST_SIZE];
128
129
  overrides?: {
@@ -133,6 +134,12 @@ export interface OptionListProps extends BaseMenuPropsT {
133
134
  resetMenu?: () => void;
134
135
  $isHighlighted?: boolean;
135
136
  $isFocused?: boolean;
137
+ renderAll?: boolean;
138
+ $disabled?: boolean;
139
+ 'aria-disabled'?: boolean;
140
+ 'aria-selected'?: boolean;
141
+ id?: string;
142
+ role?: string;
136
143
  }
137
144
  export const OptionList: React.FC<OptionListProps>;
138
145
 
@@ -55,6 +55,7 @@ function MaybeChildMenu(props) {
55
55
  return /*#__PURE__*/React.createElement(_nestedMenus.NestedMenuContext.Consumer, null, function (ctx) {
56
56
  return /*#__PURE__*/React.createElement(PopoverOverride, _extends({
57
57
  focusLock: false,
58
+ autoFocus: false,
58
59
  isOpen: props.isOpen,
59
60
  renderAll: props.renderAll,
60
61
  content: ChildMenu,
@@ -48,6 +48,7 @@ export default function MaybeChildMenu(props: PropsT) {
48
48
  return (
49
49
  <PopoverOverride
50
50
  focusLock={false}
51
+ autoFocus={false}
51
52
  isOpen={props.isOpen}
52
53
  renderAll={props.renderAll}
53
54
  content={ChildMenu}
@@ -234,6 +234,8 @@ export type OptionListPropsT = {
234
234
  getChildMenu?: (item: ItemT) => React.Node,
235
235
  onClick?: (event: MouseEvent) => mixed,
236
236
  /** Callback used to change highlighted index in stateful menu. */
237
+ onMouseDown?: (event: MouseEvent) => mixed,
238
+ /** Callback used to change highlighted index in stateful menu. */
237
239
  onMouseEnter?: (event: MouseEvent) => mixed,
238
240
  /** Renders UI in defined scale. */
239
241
  size?: $Keys<typeof OPTION_LIST_SIZE>,
@@ -251,6 +253,16 @@ export type OptionListPropsT = {
251
253
  $isFocused?: boolean,
252
254
  /** Renders all menu content for SEO purposes regardless of menu state */
253
255
  renderAll?: boolean,
256
+ /** Is the item disabled */
257
+ $disabled?: boolean,
258
+ /** Is the item disabled */
259
+ 'aria-disabled'?: boolean,
260
+ /** Is the item selected */
261
+ 'aria-selected'?: boolean,
262
+ /** Id of the item */
263
+ id?: string,
264
+ /** Accessibility role of the item */
265
+ role?: string,
254
266
  };
255
267
 
256
268
  export type OptionProfilePropsT = {
package/modal/index.d.ts CHANGED
@@ -47,7 +47,7 @@ export interface ModalProps {
47
47
  autofocus?: boolean;
48
48
  autoFocus?: boolean;
49
49
  focusLock?: boolean;
50
- returnFocus?: boolean | FocusOptions;
50
+ returnFocus?: boolean | FocusOptions | ((returnTo: Element) => boolean | FocusOptions);
51
51
  children?: React.ReactNode;
52
52
  closeable?: boolean;
53
53
  isOpen?: boolean;
@@ -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.5.0",
3
+ "version": "10.7.2",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -81,7 +81,7 @@
81
81
  "@commitlint/config-conventional": "^8.0.0",
82
82
  "@date-io/luxon": "^2.7.0",
83
83
  "@date-io/moment": "^2.7.0",
84
- "@ladle/react": "^0.2.0",
84
+ "@ladle/react": "^0.3.0",
85
85
  "@mdx-js/tag": "^0.20.0",
86
86
  "@octokit/rest": "^16.33.1",
87
87
  "@svgr/cli": "^4.3.2",
@@ -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>,
@@ -70,6 +70,10 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
70
70
  _this.props.onBlur(e);
71
71
  }
72
72
 
73
+ if (_this.props.focusLock || _this.props.autoFocus) {
74
+ return;
75
+ }
76
+
73
77
  _this.close();
74
78
  });
75
79
 
@@ -208,7 +212,8 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
208
212
  returnFocus = _this$props.returnFocus,
209
213
  showArrow = _this$props.showArrow,
210
214
  triggerType = _this$props.triggerType,
211
- popoverMargin = _this$props.popoverMargin;
215
+ popoverMargin = _this$props.popoverMargin,
216
+ focusOptions = _this$props.focusOptions;
212
217
  var popoverProps = {
213
218
  accessibilityType: accessibilityType,
214
219
  autoFocus: autoFocus,
@@ -231,7 +236,8 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
231
236
  returnFocus: returnFocus,
232
237
  showArrow: showArrow,
233
238
  triggerType: triggerType,
234
- popoverMargin: popoverMargin
239
+ popoverMargin: popoverMargin,
240
+ focusOptions: focusOptions
235
241
  };
236
242
 
237
243
  if (dismissOnClickOutside) {