baseui 10.7.4 → 10.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/a11y/a11y.js +2 -2
  2. package/a11y/a11y.js.flow +3 -3
  3. package/button/styled-components.js +47 -18
  4. package/button/styled-components.js.flow +25 -5
  5. package/combobox/combobox.js +6 -3
  6. package/combobox/combobox.js.flow +4 -2
  7. package/combobox/types.js.flow +2 -0
  8. package/data-table/column-categorical.js +1 -1
  9. package/data-table/column-categorical.js.flow +2 -2
  10. package/data-table/column-numerical.js +1 -1
  11. package/data-table/column-numerical.js.flow +3 -3
  12. package/datepicker/styled-components.js +1 -1
  13. package/datepicker/styled-components.js.flow +4 -1
  14. package/drawer/drawer.js +3 -1
  15. package/drawer/drawer.js.flow +7 -1
  16. package/es/a11y/a11y.js +2 -2
  17. package/es/button/styled-components.js +32 -2
  18. package/es/combobox/combobox.js +6 -3
  19. package/es/data-table/column-categorical.js +2 -2
  20. package/es/data-table/column-numerical.js +2 -2
  21. package/es/datepicker/styled-components.js +1 -1
  22. package/es/drawer/drawer.js +3 -1
  23. package/es/form-control/form-control.js +58 -7
  24. package/es/form-control/styled-components.js +27 -6
  25. package/es/index.js +1 -1
  26. package/es/map-marker/badge-enhancer.js +61 -0
  27. package/es/map-marker/constants.js +146 -2
  28. package/es/map-marker/drag-shadow.js +32 -0
  29. package/es/map-marker/fixed-marker.js +54 -48
  30. package/es/map-marker/floating-marker.js +21 -12
  31. package/es/map-marker/index.js +1 -1
  32. package/es/map-marker/label-enhancer.js +39 -0
  33. package/es/map-marker/needle.js +26 -0
  34. package/es/map-marker/pin-head.js +42 -40
  35. package/es/map-marker/styled-components.js +177 -32
  36. package/es/map-marker/types.js +1 -1
  37. package/es/menu/maybe-child-menu.js +0 -2
  38. package/es/menu/nested-menus.js +49 -3
  39. package/es/menu/stateful-container.js +13 -12
  40. package/es/modal/modal.js +3 -1
  41. package/es/popover/popover.js +4 -2
  42. package/es/progress-bar/index.js +1 -1
  43. package/es/progress-bar/progressbar.js +25 -10
  44. package/es/progress-bar/styled-components.js +9 -5
  45. package/es/select/select-component.js +2 -10
  46. package/es/spinner/styled-components.js +34 -16
  47. package/es/table/filter.js +3 -1
  48. package/es/themes/dark-theme/color-component-tokens.js +19 -10
  49. package/es/themes/light-theme/color-component-tokens.js +19 -10
  50. package/es/timezonepicker/timezone-picker.js +53 -36
  51. package/es/timezonepicker/tzdata.js +2 -0
  52. package/es/timezonepicker/update-tzdata.js +69 -0
  53. package/es/toast/styled-components.js +18 -7
  54. package/esm/a11y/a11y.js +3 -3
  55. package/esm/button/styled-components.js +47 -18
  56. package/esm/combobox/combobox.js +6 -3
  57. package/esm/data-table/column-categorical.js +2 -2
  58. package/esm/data-table/column-numerical.js +2 -2
  59. package/esm/datepicker/styled-components.js +1 -1
  60. package/esm/drawer/drawer.js +3 -1
  61. package/esm/form-control/form-control.js +60 -9
  62. package/esm/form-control/styled-components.js +23 -3
  63. package/esm/index.js +1 -1
  64. package/esm/map-marker/badge-enhancer.js +79 -0
  65. package/esm/map-marker/constants.js +94 -4
  66. package/esm/map-marker/drag-shadow.js +53 -0
  67. package/esm/map-marker/fixed-marker.js +84 -80
  68. package/esm/map-marker/floating-marker.js +22 -13
  69. package/esm/map-marker/index.js +1 -1
  70. package/esm/map-marker/label-enhancer.js +60 -0
  71. package/esm/map-marker/needle.js +43 -0
  72. package/esm/map-marker/pin-head.js +77 -66
  73. package/esm/map-marker/styled-components.js +182 -51
  74. package/esm/map-marker/types.js +1 -1
  75. package/esm/menu/maybe-child-menu.js +0 -2
  76. package/esm/menu/nested-menus.js +66 -5
  77. package/esm/menu/stateful-container.js +15 -13
  78. package/esm/modal/modal.js +3 -1
  79. package/esm/popover/popover.js +4 -2
  80. package/esm/progress-bar/index.js +1 -1
  81. package/esm/progress-bar/progressbar.js +32 -10
  82. package/esm/progress-bar/styled-components.js +9 -4
  83. package/esm/select/select-component.js +2 -11
  84. package/esm/spinner/styled-components.js +35 -16
  85. package/esm/table/filter.js +3 -1
  86. package/esm/themes/dark-theme/color-component-tokens.js +19 -10
  87. package/esm/themes/light-theme/color-component-tokens.js +19 -10
  88. package/esm/timezonepicker/timezone-picker.js +64 -36
  89. package/esm/timezonepicker/tzdata.js +2 -0
  90. package/esm/timezonepicker/update-tzdata.js +160 -0
  91. package/esm/toast/styled-components.js +13 -5
  92. package/form-control/form-control.js +61 -8
  93. package/form-control/form-control.js.flow +82 -10
  94. package/form-control/index.d.ts +1 -0
  95. package/form-control/styled-components.js +27 -5
  96. package/form-control/styled-components.js.flow +25 -3
  97. package/form-control/types.js.flow +20 -8
  98. package/index.js +6 -0
  99. package/index.js.flow +1 -1
  100. package/map-marker/badge-enhancer.js +90 -0
  101. package/map-marker/badge-enhancer.js.flow +86 -0
  102. package/map-marker/constants.js +103 -5
  103. package/map-marker/constants.js.flow +152 -0
  104. package/map-marker/drag-shadow.js +64 -0
  105. package/map-marker/drag-shadow.js.flow +52 -0
  106. package/map-marker/fixed-marker.js +84 -78
  107. package/map-marker/fixed-marker.js.flow +78 -66
  108. package/map-marker/floating-marker.js +22 -13
  109. package/map-marker/floating-marker.js.flow +30 -17
  110. package/map-marker/index.d.ts +125 -24
  111. package/map-marker/index.js +18 -0
  112. package/map-marker/index.js.flow +3 -0
  113. package/map-marker/label-enhancer.js +71 -0
  114. package/map-marker/label-enhancer.js.flow +63 -0
  115. package/map-marker/needle.js +54 -0
  116. package/map-marker/needle.js.flow +29 -0
  117. package/map-marker/pin-head.js +80 -69
  118. package/map-marker/pin-head.js.flow +122 -84
  119. package/map-marker/styled-components.js +200 -62
  120. package/map-marker/styled-components.js.flow +172 -22
  121. package/map-marker/types.js.flow +69 -20
  122. package/menu/index.d.ts +9 -4
  123. package/menu/maybe-child-menu.js +0 -2
  124. package/menu/maybe-child-menu.js.flow +0 -2
  125. package/menu/nested-menus.js +66 -5
  126. package/menu/nested-menus.js.flow +50 -5
  127. package/menu/stateful-container.js +15 -13
  128. package/menu/stateful-container.js.flow +19 -13
  129. package/menu/types.js.flow +7 -1
  130. package/modal/modal.js +3 -1
  131. package/modal/modal.js.flow +2 -0
  132. package/package.json +4 -4
  133. package/popover/popover.js +4 -2
  134. package/popover/popover.js.flow +3 -1
  135. package/progress-bar/index.d.ts +2 -0
  136. package/progress-bar/index.js +6 -0
  137. package/progress-bar/index.js.flow +1 -0
  138. package/progress-bar/progressbar.js +32 -10
  139. package/progress-bar/progressbar.js.flow +35 -9
  140. package/progress-bar/styled-components.js +9 -4
  141. package/progress-bar/styled-components.js.flow +15 -4
  142. package/progress-bar/types.js.flow +12 -2
  143. package/select/select-component.js +2 -11
  144. package/select/select-component.js.flow +5 -7
  145. package/spinner/styled-components.js +35 -16
  146. package/spinner/styled-components.js.flow +37 -19
  147. package/spinner/types.js.flow +10 -0
  148. package/styles/index.js.flow +1 -1
  149. package/table/filter.js +3 -1
  150. package/table/filter.js.flow +5 -1
  151. package/themes/dark-theme/color-component-tokens.js +19 -10
  152. package/themes/dark-theme/color-component-tokens.js.flow +19 -10
  153. package/themes/light-theme/color-component-tokens.js +19 -10
  154. package/themes/light-theme/color-component-tokens.js.flow +19 -10
  155. package/themes/types.js.flow +9 -0
  156. package/timezonepicker/timezone-picker.js +69 -41
  157. package/timezonepicker/timezone-picker.js.flow +52 -46
  158. package/timezonepicker/types.js.flow +1 -1
  159. package/timezonepicker/tzdata.js +10 -0
  160. package/timezonepicker/tzdata.js.flow +347 -0
  161. package/timezonepicker/update-tzdata.js +164 -0
  162. package/timezonepicker/update-tzdata.js.flow +70 -0
  163. package/toast/styled-components.js +13 -5
  164. package/toast/styled-components.js.flow +17 -7
package/a11y/a11y.js CHANGED
@@ -140,8 +140,8 @@ function Violation(props) {
140
140
  ref: setPopper,
141
141
  $top: "".concat(offset.top, "px") || '0px',
142
142
  $left: "".concat(offset.left, "px") || '0px'
143
- }, /*#__PURE__*/React.createElement(_index2.Caption1, null, props.target), props.violations.map(function (violation, index) {
144
- return /*#__PURE__*/React.createElement(_index2.Paragraph3, {
143
+ }, /*#__PURE__*/React.createElement(_index2.ParagraphXSmall, null, props.target), props.violations.map(function (violation, index) {
144
+ return /*#__PURE__*/React.createElement(_index2.ParagraphSmall, {
145
145
  key: index
146
146
  }, violation.description);
147
147
  }))));
package/a11y/a11y.js.flow CHANGED
@@ -11,7 +11,7 @@ import * as React from 'react';
11
11
  import axe from 'axe-core';
12
12
 
13
13
  import {Layer, TetherBehavior, TETHER_PLACEMENT} from '../layer/index.js';
14
- import {Paragraph3, Caption1} from '../typography/index.js';
14
+ import {ParagraphSmall, ParagraphXSmall} from '../typography/index.js';
15
15
  import {styled} from '../styles/index.js';
16
16
  import {ThemeContext} from '../styles/theme-provider.js';
17
17
 
@@ -101,9 +101,9 @@ function Violation(props: ViolationPropsT) {
101
101
  $top={`${offset.top}px` || '0px'}
102
102
  $left={`${offset.left}px` || '0px'}
103
103
  >
104
- <Caption1>{props.target}</Caption1>
104
+ <ParagraphXSmall>{props.target}</ParagraphXSmall>
105
105
  {props.violations.map((violation, index) => (
106
- <Paragraph3 key={index}>{violation.description}</Paragraph3>
106
+ <ParagraphSmall key={index}>{violation.description}</ParagraphSmall>
107
107
  ))}
108
108
  </ViolationContainer>
109
109
  </TetherBehavior>
@@ -46,11 +46,14 @@ var BaseButton = (0, _index.styled)('button', function (_ref) {
46
46
  transitionDuration: $theme.animation.timing200,
47
47
  transitionTimingFunction: $theme.animation.linearCurve,
48
48
  cursor: 'pointer',
49
- ':disabled': {
50
- cursor: 'not-allowed',
51
- backgroundColor: $kind === _constants.KIND.minimal || $kind === _constants.KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
52
- color: $theme.colors.buttonDisabledText
53
- },
49
+ ':disabled': _objectSpread({
50
+ cursor: 'not-allowed'
51
+ }, getDisabledStyles({
52
+ $theme: $theme,
53
+ $kind: $kind,
54
+ $disabled: $disabled,
55
+ $isSelected: $isSelected
56
+ })),
54
57
  marginLeft: 0,
55
58
  marginTop: 0,
56
59
  marginRight: 0,
@@ -275,10 +278,36 @@ function getFontStyles(_ref10) {
275
278
  }
276
279
  }
277
280
 
278
- function getPaddingStyles(_ref11) {
281
+ function getDisabledStyles(_ref11) {
279
282
  var $theme = _ref11.$theme,
280
- $size = _ref11.$size,
281
- $shape = _ref11.$shape;
283
+ $kind = _ref11.$kind,
284
+ $isSelected = _ref11.$isSelected,
285
+ $disabled = _ref11.$disabled;
286
+
287
+ if ($disabled && $isSelected) {
288
+ if ($kind === _constants.KIND.primary || $kind === _constants.KIND.secondary) {
289
+ return {
290
+ color: $theme.colors.buttonDisabledActiveText,
291
+ backgroundColor: $theme.colors.buttonDisabledActiveFill
292
+ };
293
+ } else if ($kind === _constants.KIND.minimal || $kind === _constants.KIND.tertiary) {
294
+ return {
295
+ backgroundColor: $theme.colors.buttonTertiaryDisabledActiveFill,
296
+ color: $theme.colors.buttonTertiaryDisabledActiveText
297
+ };
298
+ }
299
+ }
300
+
301
+ return {
302
+ backgroundColor: $kind === _constants.KIND.minimal || $kind === _constants.KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
303
+ color: $theme.colors.buttonDisabledText
304
+ };
305
+ }
306
+
307
+ function getPaddingStyles(_ref12) {
308
+ var $theme = _ref12.$theme,
309
+ $size = _ref12.$size,
310
+ $shape = _ref12.$shape;
282
311
  var iconShape = $shape === _constants.SHAPE.square || $shape === _constants.SHAPE.circle || $shape === _constants.SHAPE.round;
283
312
 
284
313
  switch ($size) {
@@ -316,12 +345,12 @@ function getPaddingStyles(_ref11) {
316
345
  }
317
346
  }
318
347
 
319
- function getKindStyles(_ref12) {
320
- var $theme = _ref12.$theme,
321
- $isLoading = _ref12.$isLoading,
322
- $isSelected = _ref12.$isSelected,
323
- $kind = _ref12.$kind,
324
- $disabled = _ref12.$disabled;
348
+ function getKindStyles(_ref13) {
349
+ var $theme = _ref13.$theme,
350
+ $isLoading = _ref13.$isLoading,
351
+ $isSelected = _ref13.$isSelected,
352
+ $kind = _ref13.$kind,
353
+ $disabled = _ref13.$disabled;
325
354
 
326
355
  if ($disabled) {
327
356
  return Object.freeze({});
@@ -409,10 +438,10 @@ function getKindStyles(_ref12) {
409
438
  }
410
439
  }
411
440
 
412
- function getShapeStyles(_ref13) {
413
- var $theme = _ref13.$theme,
414
- $shape = _ref13.$shape,
415
- $size = _ref13.$size;
441
+ function getShapeStyles(_ref14) {
442
+ var $theme = _ref14.$theme,
443
+ $shape = _ref14.$shape,
444
+ $size = _ref14.$size;
416
445
 
417
446
  if ($shape === _constants.SHAPE.circle || $shape === _constants.SHAPE.square) {
418
447
  var height, width;
@@ -46,11 +46,7 @@ export const BaseButton = styled<SharedStylePropsT>(
46
46
  cursor: 'pointer',
47
47
  ':disabled': {
48
48
  cursor: 'not-allowed',
49
- backgroundColor:
50
- $kind === KIND.minimal || $kind === KIND.tertiary
51
- ? 'transparent'
52
- : $theme.colors.buttonDisabledFill,
53
- color: $theme.colors.buttonDisabledText,
49
+ ...getDisabledStyles({$theme, $kind, $disabled, $isSelected}),
54
50
  },
55
51
  marginLeft: 0,
56
52
  marginTop: 0,
@@ -229,6 +225,30 @@ function getFontStyles({$theme, $size}) {
229
225
  }
230
226
  }
231
227
 
228
+ function getDisabledStyles({$theme, $kind, $isSelected, $disabled}) {
229
+ if ($disabled && $isSelected) {
230
+ if ($kind === KIND.primary || $kind === KIND.secondary) {
231
+ return {
232
+ color: $theme.colors.buttonDisabledActiveText,
233
+ backgroundColor: $theme.colors.buttonDisabledActiveFill,
234
+ };
235
+ } else if ($kind === KIND.minimal || $kind === KIND.tertiary) {
236
+ return {
237
+ backgroundColor: $theme.colors.buttonTertiaryDisabledActiveFill,
238
+ color: $theme.colors.buttonTertiaryDisabledActiveText,
239
+ };
240
+ }
241
+ }
242
+
243
+ return {
244
+ backgroundColor:
245
+ $kind === KIND.minimal || $kind === KIND.tertiary
246
+ ? 'transparent'
247
+ : $theme.colors.buttonDisabledFill,
248
+ color: $theme.colors.buttonDisabledText,
249
+ };
250
+ }
251
+
232
252
  function getPaddingStyles({$theme, $size, $shape}) {
233
253
  const iconShape =
234
254
  $shape === SHAPE.square ||
@@ -60,6 +60,7 @@ function Combobox(props) {
60
60
  onChange = props.onChange,
61
61
  onFocus = props.onFocus,
62
62
  onSubmit = props.onSubmit,
63
+ listBoxLabel = props.listBoxLabel,
63
64
  mapOptionToNode = props.mapOptionToNode,
64
65
  mapOptionToString = props.mapOptionToString,
65
66
  id = props.id,
@@ -322,6 +323,7 @@ function Combobox(props) {
322
323
  ,
323
324
  ref: listboxRef,
324
325
  role: "listbox",
326
+ "aria-label": listBoxLabel,
325
327
  $width: listboxWidth
326
328
  }, listBoxProps), options.map(function (option, index) {
327
329
  var isSelected = selectionIndex === index;
@@ -360,9 +362,8 @@ function Combobox(props) {
360
362
  role: "combobox"
361
363
  }, inputContainerProps), /*#__PURE__*/React.createElement(OverriddenInput, _extends({
362
364
  inputRef: handleInputRef,
363
- "aria-activedescendant": selectionIndex >= 0 ? activeDescendantId : undefined,
365
+ "aria-activedescendant": isOpen && selectionIndex >= 0 ? activeDescendantId : undefined,
364
366
  "aria-autocomplete": "list",
365
- "aria-controls": listboxId,
366
367
  disabled: disabled,
367
368
  error: error,
368
369
  name: name,
@@ -375,7 +376,9 @@ function Combobox(props) {
375
376
  positive: positive,
376
377
  size: size,
377
378
  value: tempValue ? tempValue : value
378
- }, restInputProps)))));
379
+ }, isOpen ? {
380
+ 'aria-controls': listboxId
381
+ } : {}, restInputProps)))));
379
382
  }
380
383
 
381
384
  var _default = Combobox;
@@ -38,6 +38,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
38
38
  onChange,
39
39
  onFocus,
40
40
  onSubmit,
41
+ listBoxLabel,
41
42
  mapOptionToNode,
42
43
  mapOptionToString,
43
44
  id,
@@ -274,6 +275,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
274
275
  // eslint-disable-next-line flowtype/no-weak-types
275
276
  ref={(listboxRef: any)}
276
277
  role="listbox"
278
+ aria-label={listBoxLabel}
277
279
  $width={listboxWidth}
278
280
  {...listBoxProps}
279
281
  >
@@ -322,10 +324,9 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
322
324
  <OverriddenInput
323
325
  inputRef={handleInputRef}
324
326
  aria-activedescendant={
325
- selectionIndex >= 0 ? activeDescendantId : undefined
327
+ isOpen && selectionIndex >= 0 ? activeDescendantId : undefined
326
328
  }
327
329
  aria-autocomplete="list"
328
- aria-controls={listboxId}
329
330
  disabled={disabled}
330
331
  error={error}
331
332
  name={name}
@@ -338,6 +339,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
338
339
  positive={positive}
339
340
  size={size}
340
341
  value={tempValue ? tempValue : value}
342
+ {...(isOpen ? {'aria-controls': listboxId} : {})}
341
343
  {...restInputProps}
342
344
  />
343
345
  </InputContainer>
@@ -18,6 +18,8 @@ export type PropsT<OptionT = mixed> = {|
18
18
  disabled?: boolean,
19
19
  // Proxies value through to Input component.
20
20
  error?: boolean,
21
+ // Label used for the listbox/popup with options
22
+ listBoxLabel?: string,
21
23
  // Used to render a custom node besides the default.
22
24
  mapOptionToNode?: React.AbstractComponent<{|
23
25
  isSelected: boolean,
@@ -208,7 +208,7 @@ function CategoricalFilter(props) {
208
208
  overflowY: 'auto',
209
209
  marginTop: theme.sizing.scale600
210
210
  })
211
- }, !filteredCategories.length && /*#__PURE__*/React.createElement(_index6.Label3, null, locale.datatable.categoricalFilterEmpty), Boolean(filteredCategories.length) && filteredCategories.map(function (category, i) {
211
+ }, !filteredCategories.length && /*#__PURE__*/React.createElement(_index6.LabelSmall, null, locale.datatable.categoricalFilterEmpty), Boolean(filteredCategories.length) && filteredCategories.map(function (category, i) {
212
212
  return /*#__PURE__*/React.createElement("div", {
213
213
  className: checkboxStyles,
214
214
  key: i
@@ -14,7 +14,7 @@ import {Checkbox, StyledLabel} from '../checkbox/index.js';
14
14
  import Search from '../icon/search.js';
15
15
  import {Input, SIZE as INPUT_SIZE} from '../input/index.js';
16
16
  import {useStyletron, withStyle} from '../styles/index.js';
17
- import {Label3} from '../typography/index.js';
17
+ import {LabelSmall} from '../typography/index.js';
18
18
 
19
19
  import Column from './column.js';
20
20
  import {COLUMNS} from './constants.js';
@@ -184,7 +184,7 @@ export function CategoricalFilter(props: CategoricalFilterProps) {
184
184
  })}
185
185
  >
186
186
  {!filteredCategories.length && (
187
- <Label3>{locale.datatable.categoricalFilterEmpty}</Label3>
187
+ <LabelSmall>{locale.datatable.categoricalFilterEmpty}</LabelSmall>
188
188
  )}
189
189
 
190
190
  {Boolean(filteredCategories.length) &&
@@ -493,7 +493,7 @@ function NumericalFilter(props) {
493
493
  marginLeft: theme.sizing.scale300,
494
494
  marginRight: theme.sizing.scale300
495
495
  })
496
- }, /*#__PURE__*/React.createElement(_index5.Paragraph4, null, format(min, props.options)), ' ', /*#__PURE__*/React.createElement(_index5.Paragraph4, null, format(max, props.options))), /*#__PURE__*/React.createElement("div", {
496
+ }, /*#__PURE__*/React.createElement(_index5.ParagraphXSmall, null, format(min, props.options)), ' ', /*#__PURE__*/React.createElement(_index5.ParagraphXSmall, null, format(max, props.options))), /*#__PURE__*/React.createElement("div", {
497
497
  className: css({
498
498
  display: 'flex',
499
499
  justifyContent: 'space-between'
@@ -12,7 +12,7 @@ import {Button, SIZE} from '../button/index.js';
12
12
  import {ButtonGroup, MODE} from '../button-group/index.js';
13
13
  import {Input, SIZE as INPUT_SIZE} from '../input/index.js';
14
14
  import {useStyletron} from '../styles/index.js';
15
- import {Paragraph4} from '../typography/index.js';
15
+ import {ParagraphXSmall} from '../typography/index.js';
16
16
 
17
17
  import Column from './column.js';
18
18
  import {COLUMNS, NUMERICAL_FORMATS, NUMERICAL_OPERATIONS} from './constants.js';
@@ -388,8 +388,8 @@ function NumericalFilter(props) {
388
388
  marginRight: theme.sizing.scale300,
389
389
  })}
390
390
  >
391
- <Paragraph4>{format(min, props.options)}</Paragraph4>{' '}
392
- <Paragraph4>{format(max, props.options)}</Paragraph4>
391
+ <ParagraphXSmall>{format(min, props.options)}</ParagraphXSmall>{' '}
392
+ <ParagraphXSmall>{format(max, props.options)}</ParagraphXSmall>
393
393
  </div>
394
394
 
395
395
  <div className={css({display: 'flex', justifyContent: 'space-between'})}>
@@ -502,7 +502,7 @@ var StyledDay = (0, _index.styled)('div', function (props) {
502
502
  content: '""',
503
503
  boxSizing: 'border-box',
504
504
  display: 'inline-block',
505
- boxShadow: $isFocusVisible ? "0 0 0 3px ".concat(colors.accent) : 'none',
505
+ boxShadow: $isFocusVisible && (!$outsideMonth || $peekNextMonth) ? "0 0 0 3px ".concat(colors.accent) : 'none',
506
506
  backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
507
507
  height: $hasDateLabel ? '100%' : $density === _constants.DENSITY.high ? '42px' : '50px',
508
508
  width: '100%',
@@ -496,7 +496,10 @@ export const StyledDay = styled<SharedStylePropsT>('div', props => {
496
496
  content: '""',
497
497
  boxSizing: 'border-box',
498
498
  display: 'inline-block',
499
- boxShadow: $isFocusVisible ? `0 0 0 3px ${colors.accent}` : 'none',
499
+ boxShadow:
500
+ $isFocusVisible && (!$outsideMonth || $peekNextMonth)
501
+ ? `0 0 0 3px ${colors.accent}`
502
+ : 'none',
500
503
  backgroundColor: $selected
501
504
  ? colors.calendarDayBackgroundSelectedHighlighted
502
505
  : $pseudoSelected && $isHighlighted
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
@@ -253,7 +253,13 @@ class Drawer extends React.Component<DrawerPropsT, DrawerStateT> {
253
253
  <LocaleContext.Consumer>
254
254
  {locale => {
255
255
  return (
256
- <FocusLock returnFocus autoFocus={autoFocus} noFocusGuards={true}>
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 { Paragraph3, Caption1 } from '../typography/index.js';
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(Caption1, null, props.target), props.violations.map((violation, index) => /*#__PURE__*/React.createElement(Paragraph3, {
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
- backgroundColor: $kind === KIND.minimal || $kind === KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
43
- color: $theme.colors.buttonDisabledText
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,
@@ -28,6 +28,7 @@ function Combobox(props) {
28
28
  onChange,
29
29
  onFocus,
30
30
  onSubmit,
31
+ listBoxLabel,
31
32
  mapOptionToNode,
32
33
  mapOptionToString,
33
34
  id,
@@ -251,6 +252,7 @@ function Combobox(props) {
251
252
  ,
252
253
  ref: listboxRef,
253
254
  role: "listbox",
255
+ "aria-label": listBoxLabel,
254
256
  $width: listboxWidth
255
257
  }, listBoxProps), options.map((option, index) => {
256
258
  const isSelected = selectionIndex === index;
@@ -287,9 +289,8 @@ function Combobox(props) {
287
289
  role: "combobox"
288
290
  }, inputContainerProps), /*#__PURE__*/React.createElement(OverriddenInput, _extends({
289
291
  inputRef: handleInputRef,
290
- "aria-activedescendant": selectionIndex >= 0 ? activeDescendantId : undefined,
292
+ "aria-activedescendant": isOpen && selectionIndex >= 0 ? activeDescendantId : undefined,
291
293
  "aria-autocomplete": "list",
292
- "aria-controls": listboxId,
293
294
  disabled: disabled,
294
295
  error: error,
295
296
  name: name,
@@ -302,7 +303,9 @@ function Combobox(props) {
302
303
  positive: positive,
303
304
  size: size,
304
305
  value: tempValue ? tempValue : value
305
- }, restInputProps)))));
306
+ }, isOpen ? {
307
+ 'aria-controls': listboxId
308
+ } : {}, restInputProps)))));
306
309
  }
307
310
 
308
311
  export default Combobox;
@@ -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 { Label3 } from '../typography/index.js';
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(Label3, null, locale.datatable.categoricalFilterEmpty), Boolean(filteredCategories.length) && filteredCategories.map((category, i) => /*#__PURE__*/React.createElement("div", {
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, {
@@ -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 { Paragraph4 } from '../typography/index.js';
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(Paragraph4, null, format(min, props.options)), ' ', /*#__PURE__*/React.createElement(Paragraph4, null, format(max, props.options))), /*#__PURE__*/React.createElement("div", {
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'
@@ -503,7 +503,7 @@ export const StyledDay = styled('div', props => {
503
503
  content: '""',
504
504
  boxSizing: 'border-box',
505
505
  display: 'inline-block',
506
- boxShadow: $isFocusVisible ? `0 0 0 3px ${colors.accent}` : 'none',
506
+ boxShadow: $isFocusVisible && (!$outsideMonth || $peekNextMonth) ? `0 0 0 3px ${colors.accent}` : 'none',
507
507
  backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
508
508
  height: $hasDateLabel ? '100%' : $density === DENSITY.high ? '42px' : '50px',
509
509
  width: '100%',
@@ -250,7 +250,9 @@ class Drawer extends React.Component {
250
250
  const [Close, closeProps] = getOverrides(CloseOverride, StyledClose);
251
251
  const sharedProps = this.getSharedProps();
252
252
  return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, locale => {
253
- return /*#__PURE__*/React.createElement(FocusLock, {
253
+ return /*#__PURE__*/React.createElement(FocusLock // Allow focus to escape when UI is within an iframe
254
+ , {
255
+ crossFrame: false,
254
256
  returnFocus: true,
255
257
  autoFocus: autoFocus,
256
258
  noFocusGuards: true
@@ -11,7 +11,7 @@ LICENSE file in the root directory of this source tree.
11
11
  import * as React from 'react';
12
12
  import { getOverride, getOverrideProps } from '../helpers/overrides.js';
13
13
  import { UIDConsumer } from 'react-uid';
14
- import { Label as StyledLabel, Caption as StyledCaption, ControlContainer as StyledControlContainer } from './styled-components.js';
14
+ import { Label as StyledLabel, LabelEndEnhancer as StyledLabelEndEnhancer, LabelContainer as StyledLabelContainer, Caption as StyledCaption, ControlContainer as StyledControlContainer } from './styled-components.js';
15
15
 
16
16
  function chooseRenderedHint(caption, error, positive, sharedProps) {
17
17
  if (error && typeof error !== 'boolean') {
@@ -34,6 +34,8 @@ export default class FormControl extends React.Component {
34
34
  const {
35
35
  overrides: {
36
36
  Label: LabelOverride,
37
+ LabelEndEnhancer: LabelEndEnhancerOverride,
38
+ LabelContainer: LabelContainerOverride,
37
39
  Caption: CaptionOverride,
38
40
  ControlContainer: ControlContainerOverride
39
41
  },
@@ -43,7 +45,8 @@ export default class FormControl extends React.Component {
43
45
  error,
44
46
  positive,
45
47
  htmlFor,
46
- children
48
+ children,
49
+ counter
47
50
  } = this.props;
48
51
  const onlyChildProps = React.Children.only(children).props;
49
52
  const sharedProps = {
@@ -52,6 +55,8 @@ export default class FormControl extends React.Component {
52
55
  $positive: !!positive
53
56
  };
54
57
  const Label = getOverride(LabelOverride) || StyledLabel;
58
+ const LabelEndEnhancer = getOverride(LabelEndEnhancerOverride) || StyledLabelEndEnhancer;
59
+ const LabelContainer = getOverride(LabelContainerOverride) || StyledLabelContainer;
55
60
  const Caption = getOverride(CaptionOverride) || StyledCaption;
56
61
  const ControlContainer = getOverride(ControlContainerOverride) || StyledControlContainer;
57
62
  const hint = chooseRenderedHint(caption, error, positive, sharedProps);
@@ -63,10 +68,55 @@ export default class FormControl extends React.Component {
63
68
  }
64
69
  }
65
70
 
66
- return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(Label, _extends({
71
+ let labelEndEnhancer = this.props.labelEndEnhancer;
72
+
73
+ if (counter) {
74
+ // inferred values are preferred but if the user specifies the value
75
+ // that is then used as the default.
76
+ let maxLength = null;
77
+ let length = null;
78
+ let counterError = null;
79
+
80
+ if (typeof counter === 'object') {
81
+ length = counter.length;
82
+ maxLength = counter.maxLength;
83
+ counterError = counter.error;
84
+ }
85
+
86
+ maxLength = maxLength ? maxLength : onlyChildProps.maxLength;
87
+
88
+ if (length == null && typeof onlyChildProps.value === 'string') {
89
+ length = onlyChildProps.value.length;
90
+ }
91
+
92
+ if (length == null) {
93
+ length = 0;
94
+
95
+ if (process.env.NODE_ENV !== "production") {
96
+ console.warn(`[FromControl] \`length\` must either be explicitly set via \`counter\` object property, or \`value\` string property on the child component.`);
97
+ }
98
+ }
99
+
100
+ sharedProps.$length = length;
101
+
102
+ if (maxLength == null) {
103
+ if (!labelEndEnhancer) labelEndEnhancer = `${length}`;
104
+ } else {
105
+ sharedProps.$maxLength = length;
106
+ if (!labelEndEnhancer) labelEndEnhancer = `${length}/${maxLength}`;
107
+ if (length > maxLength && counterError == null) counterError = true;
108
+ }
109
+
110
+ if (counterError) {
111
+ sharedProps.$error = true;
112
+ sharedProps.$counterError = true;
113
+ }
114
+ }
115
+
116
+ return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(LabelContainer, _extends({}, sharedProps, getOverrideProps(LabelContainerOverride)), /*#__PURE__*/React.createElement(Label, _extends({
67
117
  "data-baseweb": "form-control-label",
68
118
  htmlFor: htmlFor || onlyChildProps.id
69
- }, sharedProps, getOverrideProps(LabelOverride)), typeof label === 'function' ? label(sharedProps) : label), /*#__PURE__*/React.createElement(UIDConsumer, null, captionId => /*#__PURE__*/React.createElement(ControlContainer, _extends({
119
+ }, sharedProps, getOverrideProps(LabelOverride)), typeof label === 'function' ? label(sharedProps) : label), labelEndEnhancer && /*#__PURE__*/React.createElement(LabelEndEnhancer, _extends({}, sharedProps, getOverrideProps(LabelEndEnhancerOverride)), typeof labelEndEnhancer === 'function' ? labelEndEnhancer(sharedProps) : labelEndEnhancer)), /*#__PURE__*/React.createElement(UIDConsumer, null, captionId => /*#__PURE__*/React.createElement(ControlContainer, _extends({
70
120
  "data-baseweb": "form-control-container"
71
121
  }, sharedProps, getOverrideProps(ControlContainerOverride)), React.Children.map(children, (child, index) => {
72
122
  if (!child) return;
@@ -76,8 +126,8 @@ export default class FormControl extends React.Component {
76
126
  'aria-errormessage': error ? captionId : null,
77
127
  'aria-describedby': caption || positive ? captionId : null,
78
128
  disabled: onlyChildProps.disabled || disabled,
79
- error: typeof onlyChildProps.error !== 'undefined' ? onlyChildProps.error : error,
80
- positive: typeof onlyChildProps.positive !== 'undefined' ? onlyChildProps.positive : positive
129
+ error: typeof onlyChildProps.error !== 'undefined' ? onlyChildProps.error : sharedProps.$error,
130
+ positive: typeof onlyChildProps.positive !== 'undefined' ? onlyChildProps.positive : sharedProps.$positive
81
131
  });
82
132
  }), (caption || error || positive) && /*#__PURE__*/React.createElement(Caption, _extends({
83
133
  "data-baseweb": "form-control-caption",
@@ -91,5 +141,6 @@ _defineProperty(FormControl, "defaultProps", {
91
141
  overrides: {},
92
142
  label: null,
93
143
  caption: null,
94
- disabled: false
144
+ disabled: false,
145
+ counter: false
95
146
  });