baseui 10.7.2 → 10.9.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 (174) 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 +307 -355
  11. package/data-table/column-numerical.js.flow +273 -287
  12. package/data-table/constants.js +17 -11
  13. package/data-table/constants.js.flow +11 -8
  14. package/data-table/data-table.js +53 -50
  15. package/data-table/data-table.js.flow +18 -13
  16. package/data-table/filter-shell.js +27 -4
  17. package/data-table/filter-shell.js.flow +33 -9
  18. package/data-table/locale.js +4 -2
  19. package/data-table/locale.js.flow +6 -2
  20. package/data-table/measure-column-widths.js +83 -121
  21. package/data-table/measure-column-widths.js.flow +87 -109
  22. package/datepicker/styled-components.js +1 -1
  23. package/datepicker/styled-components.js.flow +4 -1
  24. package/drawer/drawer.js +3 -1
  25. package/drawer/drawer.js.flow +7 -1
  26. package/es/a11y/a11y.js +2 -2
  27. package/es/button/styled-components.js +32 -2
  28. package/es/combobox/combobox.js +6 -3
  29. package/es/data-table/column-categorical.js +2 -2
  30. package/es/data-table/column-numerical.js +245 -317
  31. package/es/data-table/constants.js +12 -8
  32. package/es/data-table/data-table.js +18 -16
  33. package/es/data-table/filter-shell.js +26 -4
  34. package/es/data-table/locale.js +4 -2
  35. package/es/data-table/measure-column-widths.js +75 -86
  36. package/es/datepicker/styled-components.js +1 -1
  37. package/es/drawer/drawer.js +3 -1
  38. package/es/index.js +1 -1
  39. package/es/map-marker/badge-enhancer.js +61 -0
  40. package/es/map-marker/constants.js +146 -2
  41. package/es/map-marker/drag-shadow.js +32 -0
  42. package/es/map-marker/fixed-marker.js +54 -48
  43. package/es/map-marker/floating-marker.js +21 -12
  44. package/es/map-marker/index.js +1 -1
  45. package/es/map-marker/label-enhancer.js +39 -0
  46. package/es/map-marker/needle.js +26 -0
  47. package/es/map-marker/pin-head.js +42 -40
  48. package/es/map-marker/styled-components.js +177 -32
  49. package/es/map-marker/types.js +1 -1
  50. package/es/menu/maybe-child-menu.js +0 -2
  51. package/es/menu/nested-menus.js +49 -3
  52. package/es/menu/stateful-container.js +13 -12
  53. package/es/modal/modal.js +3 -1
  54. package/es/popover/popover.js +7 -3
  55. package/es/progress-bar/index.js +1 -1
  56. package/es/progress-bar/progressbar.js +25 -10
  57. package/es/progress-bar/styled-components.js +9 -5
  58. package/es/select/select-component.js +2 -10
  59. package/es/spinner/styled-components.js +34 -16
  60. package/es/table/filter.js +3 -1
  61. package/es/themes/dark-theme/color-component-tokens.js +19 -10
  62. package/es/themes/light-theme/color-component-tokens.js +19 -10
  63. package/es/timezonepicker/timezone-picker.js +53 -36
  64. package/es/timezonepicker/tzdata.js +2 -0
  65. package/es/timezonepicker/update-tzdata.js +69 -0
  66. package/es/toast/styled-components.js +18 -7
  67. package/esm/a11y/a11y.js +3 -3
  68. package/esm/button/styled-components.js +47 -18
  69. package/esm/combobox/combobox.js +6 -3
  70. package/esm/data-table/column-categorical.js +2 -2
  71. package/esm/data-table/column-numerical.js +304 -353
  72. package/esm/data-table/constants.js +12 -8
  73. package/esm/data-table/data-table.js +53 -50
  74. package/esm/data-table/filter-shell.js +26 -4
  75. package/esm/data-table/locale.js +4 -2
  76. package/esm/data-table/measure-column-widths.js +83 -121
  77. package/esm/datepicker/styled-components.js +1 -1
  78. package/esm/drawer/drawer.js +3 -1
  79. package/esm/index.js +1 -1
  80. package/esm/map-marker/badge-enhancer.js +79 -0
  81. package/esm/map-marker/constants.js +94 -4
  82. package/esm/map-marker/drag-shadow.js +53 -0
  83. package/esm/map-marker/fixed-marker.js +84 -80
  84. package/esm/map-marker/floating-marker.js +22 -13
  85. package/esm/map-marker/index.js +1 -1
  86. package/esm/map-marker/label-enhancer.js +60 -0
  87. package/esm/map-marker/needle.js +43 -0
  88. package/esm/map-marker/pin-head.js +77 -66
  89. package/esm/map-marker/styled-components.js +182 -51
  90. package/esm/map-marker/types.js +1 -1
  91. package/esm/menu/maybe-child-menu.js +0 -2
  92. package/esm/menu/nested-menus.js +66 -5
  93. package/esm/menu/stateful-container.js +15 -13
  94. package/esm/modal/modal.js +3 -1
  95. package/esm/popover/popover.js +7 -3
  96. package/esm/progress-bar/index.js +1 -1
  97. package/esm/progress-bar/progressbar.js +32 -10
  98. package/esm/progress-bar/styled-components.js +9 -4
  99. package/esm/select/select-component.js +2 -11
  100. package/esm/spinner/styled-components.js +35 -16
  101. package/esm/table/filter.js +3 -1
  102. package/esm/themes/dark-theme/color-component-tokens.js +19 -10
  103. package/esm/themes/light-theme/color-component-tokens.js +19 -10
  104. package/esm/timezonepicker/timezone-picker.js +64 -36
  105. package/esm/timezonepicker/tzdata.js +2 -0
  106. package/esm/timezonepicker/update-tzdata.js +160 -0
  107. package/esm/toast/styled-components.js +13 -5
  108. package/index.js +6 -0
  109. package/index.js.flow +1 -1
  110. package/map-marker/badge-enhancer.js +90 -0
  111. package/map-marker/badge-enhancer.js.flow +86 -0
  112. package/map-marker/constants.js +103 -5
  113. package/map-marker/constants.js.flow +152 -0
  114. package/map-marker/drag-shadow.js +64 -0
  115. package/map-marker/drag-shadow.js.flow +52 -0
  116. package/map-marker/fixed-marker.js +84 -78
  117. package/map-marker/fixed-marker.js.flow +78 -66
  118. package/map-marker/floating-marker.js +22 -13
  119. package/map-marker/floating-marker.js.flow +30 -17
  120. package/map-marker/index.d.ts +125 -24
  121. package/map-marker/index.js +18 -0
  122. package/map-marker/index.js.flow +3 -0
  123. package/map-marker/label-enhancer.js +71 -0
  124. package/map-marker/label-enhancer.js.flow +63 -0
  125. package/map-marker/needle.js +54 -0
  126. package/map-marker/needle.js.flow +29 -0
  127. package/map-marker/pin-head.js +80 -69
  128. package/map-marker/pin-head.js.flow +122 -84
  129. package/map-marker/styled-components.js +200 -62
  130. package/map-marker/styled-components.js.flow +172 -22
  131. package/map-marker/types.js.flow +69 -20
  132. package/menu/index.d.ts +9 -4
  133. package/menu/maybe-child-menu.js +0 -2
  134. package/menu/maybe-child-menu.js.flow +0 -2
  135. package/menu/nested-menus.js +66 -5
  136. package/menu/nested-menus.js.flow +50 -5
  137. package/menu/stateful-container.js +15 -13
  138. package/menu/stateful-container.js.flow +19 -13
  139. package/menu/types.js.flow +7 -1
  140. package/modal/modal.js +3 -1
  141. package/modal/modal.js.flow +2 -0
  142. package/package.json +5 -4
  143. package/popover/popover.js +7 -3
  144. package/popover/popover.js.flow +23 -17
  145. package/progress-bar/index.d.ts +2 -0
  146. package/progress-bar/index.js +6 -0
  147. package/progress-bar/index.js.flow +1 -0
  148. package/progress-bar/progressbar.js +32 -10
  149. package/progress-bar/progressbar.js.flow +35 -9
  150. package/progress-bar/styled-components.js +9 -4
  151. package/progress-bar/styled-components.js.flow +15 -4
  152. package/progress-bar/types.js.flow +12 -2
  153. package/select/select-component.js +2 -11
  154. package/select/select-component.js.flow +5 -7
  155. package/spinner/styled-components.js +35 -16
  156. package/spinner/styled-components.js.flow +37 -19
  157. package/spinner/types.js.flow +10 -0
  158. package/styles/index.js.flow +1 -1
  159. package/table/filter.js +3 -1
  160. package/table/filter.js.flow +5 -1
  161. package/themes/dark-theme/color-component-tokens.js +19 -10
  162. package/themes/dark-theme/color-component-tokens.js.flow +19 -10
  163. package/themes/light-theme/color-component-tokens.js +19 -10
  164. package/themes/light-theme/color-component-tokens.js.flow +19 -10
  165. package/themes/types.js.flow +9 -0
  166. package/timezonepicker/timezone-picker.js +69 -41
  167. package/timezonepicker/timezone-picker.js.flow +52 -46
  168. package/timezonepicker/types.js.flow +1 -1
  169. package/timezonepicker/tzdata.js +10 -0
  170. package/timezonepicker/tzdata.js.flow +347 -0
  171. package/timezonepicker/update-tzdata.js +164 -0
  172. package/timezonepicker/update-tzdata.js.flow +70 -0
  173. package/toast/styled-components.js +13 -5
  174. 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) &&