baseui 10.0.0 → 10.3.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 (162) hide show
  1. package/app-nav-bar/index.d.ts +24 -0
  2. package/app-nav-bar/mobile-menu.js +5 -3
  3. package/app-nav-bar/mobile-menu.js.flow +3 -2
  4. package/app-nav-bar/user-menu.js +5 -3
  5. package/app-nav-bar/user-menu.js.flow +3 -2
  6. package/block/index.d.ts +7 -0
  7. package/combobox/combobox.js +4 -9
  8. package/combobox/combobox.js.flow +4 -3
  9. package/combobox/index.d.ts +1 -1
  10. package/data-table/filter-menu.js +5 -3
  11. package/data-table/filter-menu.js.flow +3 -2
  12. package/data-table/header-cell.js +1 -1
  13. package/data-table/header-cell.js.flow +1 -1
  14. package/datepicker/calendar.js +6 -1
  15. package/datepicker/calendar.js.flow +4 -0
  16. package/datepicker/datepicker.js +1 -1
  17. package/datepicker/datepicker.js.flow +5 -2
  18. package/datepicker/index.d.ts +9 -1
  19. package/datepicker/month.js +2 -1
  20. package/datepicker/month.js.flow +8 -1
  21. package/datepicker/types.js.flow +13 -6
  22. package/es/app-nav-bar/mobile-menu.js +5 -5
  23. package/es/app-nav-bar/user-menu.js +5 -5
  24. package/es/combobox/combobox.js +4 -3
  25. package/es/data-table/filter-menu.js +3 -2
  26. package/es/data-table/header-cell.js +1 -1
  27. package/es/datepicker/calendar.js +6 -1
  28. package/es/datepicker/datepicker.js +1 -1
  29. package/es/datepicker/month.js +2 -1
  30. package/es/form-control/form-control.js +6 -14
  31. package/es/helper/helper.js +10 -6
  32. package/es/helpers/base-provider.js +4 -1
  33. package/es/input/input.js +9 -5
  34. package/es/layer/layer.js +5 -1
  35. package/es/layout-grid/grid.js +16 -10
  36. package/es/layout-grid/styled-components.js +24 -12
  37. package/es/list/index.js +1 -0
  38. package/es/list/list-heading.js +77 -0
  39. package/es/list/list-item.js +1 -1
  40. package/es/list/menu-adapter.js +4 -2
  41. package/es/list/styled-components.js +101 -4
  42. package/es/menu/stateful-container.js +41 -27
  43. package/es/phone-input/base-country-picker.js +2 -0
  44. package/es/popover/popover.js +21 -10
  45. package/es/select/select-component.js +34 -22
  46. package/es/table-semantic/styled-components.js +8 -10
  47. package/es/table-semantic/table-builder.js +3 -2
  48. package/es/table-semantic/table.js +1 -0
  49. package/es/tag/index.js +1 -1
  50. package/es/tag/styled-components.js +2 -4
  51. package/es/tag/tag.js +16 -16
  52. package/es/textarea/textarea.js +1 -2
  53. package/es/themes/dark-theme/color-semantic-tokens.js +18 -8
  54. package/es/themes/light-theme/color-semantic-tokens.js +14 -4
  55. package/es/tokens/colors.js +3 -3
  56. package/es/tree-view/tree-view.js +0 -2
  57. package/esm/app-nav-bar/mobile-menu.js +5 -3
  58. package/esm/app-nav-bar/user-menu.js +5 -3
  59. package/esm/combobox/combobox.js +4 -7
  60. package/esm/data-table/filter-menu.js +4 -3
  61. package/esm/data-table/header-cell.js +1 -1
  62. package/esm/datepicker/calendar.js +6 -1
  63. package/esm/datepicker/datepicker.js +1 -1
  64. package/esm/datepicker/month.js +2 -1
  65. package/esm/form-control/form-control.js +21 -33
  66. package/esm/helper/helper.js +10 -6
  67. package/esm/helpers/base-provider.js +4 -1
  68. package/esm/input/input.js +9 -5
  69. package/esm/layer/layer.js +5 -1
  70. package/esm/layout-grid/grid.js +20 -10
  71. package/esm/layout-grid/styled-components.js +52 -35
  72. package/esm/list/index.js +1 -0
  73. package/esm/list/list-heading.js +116 -0
  74. package/esm/list/list-item.js +1 -1
  75. package/esm/list/menu-adapter.js +4 -2
  76. package/esm/list/styled-components.js +99 -3
  77. package/esm/menu/stateful-container.js +56 -40
  78. package/esm/phone-input/base-country-picker.js +2 -0
  79. package/esm/popover/popover.js +25 -16
  80. package/esm/select/select-component.js +87 -79
  81. package/esm/table-semantic/styled-components.js +8 -10
  82. package/esm/table-semantic/table-builder.js +3 -2
  83. package/esm/table-semantic/table.js +1 -0
  84. package/esm/tag/index.js +1 -1
  85. package/esm/tag/styled-components.js +2 -4
  86. package/esm/tag/tag.js +18 -16
  87. package/esm/textarea/textarea.js +1 -2
  88. package/esm/themes/dark-theme/color-semantic-tokens.js +18 -8
  89. package/esm/themes/light-theme/color-semantic-tokens.js +14 -4
  90. package/esm/tokens/colors.js +3 -3
  91. package/esm/tree-view/tree-view.js +0 -2
  92. package/form-control/form-control.js +21 -35
  93. package/form-control/form-control.js.flow +37 -35
  94. package/helper/helper.js +10 -6
  95. package/helper/helper.js.flow +1 -0
  96. package/helpers/base-provider.js +5 -1
  97. package/helpers/base-provider.js.flow +4 -1
  98. package/index.d.ts +1 -0
  99. package/input/input.js +9 -5
  100. package/input/input.js.flow +9 -5
  101. package/layer/layer.js +5 -1
  102. package/layer/layer.js.flow +3 -1
  103. package/layer/types.js.flow +4 -0
  104. package/layout-grid/grid.js +19 -9
  105. package/layout-grid/grid.js.flow +52 -26
  106. package/layout-grid/index.d.ts +1 -0
  107. package/layout-grid/styled-components.js +54 -36
  108. package/layout-grid/styled-components.js.flow +48 -24
  109. package/layout-grid/types.js.flow +12 -0
  110. package/list/index.js +9 -0
  111. package/list/index.js.flow +1 -0
  112. package/list/list-heading.js +124 -0
  113. package/list/list-heading.js.flow +138 -0
  114. package/list/list-item.js +1 -1
  115. package/list/list-item.js.flow +1 -1
  116. package/list/menu-adapter.js +5 -2
  117. package/list/menu-adapter.js.flow +21 -11
  118. package/list/styled-components.js +108 -5
  119. package/list/styled-components.js.flow +103 -2
  120. package/list/types.js.flow +22 -0
  121. package/menu/stateful-container.js +57 -42
  122. package/menu/stateful-container.js.flow +38 -26
  123. package/package.json +1 -1
  124. package/phone-input/base-country-picker.js +2 -0
  125. package/phone-input/base-country-picker.js.flow +2 -0
  126. package/popover/popover.js +26 -17
  127. package/popover/popover.js.flow +19 -7
  128. package/select/select-component.js +87 -79
  129. package/select/select-component.js.flow +119 -103
  130. package/snackbar/index.d.ts +3 -3
  131. package/snackbar/types.js.flow +1 -1
  132. package/table-semantic/index.d.ts +1 -0
  133. package/table-semantic/styled-components.js +8 -10
  134. package/table-semantic/styled-components.js.flow +20 -20
  135. package/table-semantic/table-builder.js +3 -2
  136. package/table-semantic/table-builder.js.flow +3 -2
  137. package/table-semantic/table.js +1 -0
  138. package/table-semantic/table.js.flow +1 -0
  139. package/tag/index.d.ts +0 -1
  140. package/tag/index.js +0 -6
  141. package/tag/index.js.flow +0 -1
  142. package/tag/styled-components.js +3 -6
  143. package/tag/styled-components.js.flow +0 -2
  144. package/tag/tag.js +19 -14
  145. package/tag/tag.js.flow +13 -19
  146. package/textarea/textarea.js +1 -2
  147. package/textarea/textarea.js.flow +0 -1
  148. package/theme.ts +12 -0
  149. package/themes/dark-theme/color-semantic-tokens.js +18 -8
  150. package/themes/dark-theme/color-semantic-tokens.js.flow +18 -7
  151. package/themes/light-theme/color-semantic-tokens.js +14 -4
  152. package/themes/light-theme/color-semantic-tokens.js.flow +14 -3
  153. package/themes/types.js.flow +11 -0
  154. package/toast/index.d.ts +1 -0
  155. package/tokens/colors.js +3 -3
  156. package/tokens/colors.js.flow +3 -3
  157. package/tree-view/tree-view.js +0 -2
  158. package/tree-view/tree-view.js.flow +0 -1
  159. package/es/utils/get-bui-id.js +0 -33
  160. package/esm/utils/get-bui-id.js +0 -33
  161. package/utils/get-bui-id.js +0 -41
  162. package/utils/get-bui-id.js.flow +0 -39
@@ -24,7 +24,7 @@ var _index2 = require("../popover/index.js");
24
24
 
25
25
  var _index3 = require("../spinner/index.js");
26
26
 
27
- var _getBuiId = _interopRequireDefault(require("../utils/get-bui-id.js"));
27
+ var _reactUid = require("react-uid");
28
28
 
29
29
  var _autosizeInput = _interopRequireDefault(require("./autosize-input.js"));
30
30
 
@@ -149,7 +149,6 @@ var Select = /*#__PURE__*/function (_React$Component) {
149
149
  // the select components can accept an array of options or an object where properties are optgroups
150
150
  // and values are arrays of options. this class property is constructed and updated in a normalized
151
151
  // shape where optgroup titles are stored on the option in the __optgroup field.
152
- // id generated for the listbox. used by screenreaders to associate the input with the menu it controls
153
152
  function Select(props) {
154
153
  var _this;
155
154
 
@@ -173,8 +172,6 @@ var Select = /*#__PURE__*/function (_React$Component) {
173
172
 
174
173
  _defineProperty(_assertThisInitialized(_this), "options", []);
175
174
 
176
- _defineProperty(_assertThisInitialized(_this), "listboxId", (0, _getBuiId.default)());
177
-
178
175
  _defineProperty(_assertThisInitialized(_this), "state", {
179
176
  activeDescendant: null,
180
177
  inputValue: '',
@@ -230,18 +227,17 @@ var Select = /*#__PURE__*/function (_React$Component) {
230
227
  _this.openAfterFocus = _this.props.openOnClick;
231
228
 
232
229
  _this.focus();
233
-
234
- return;
235
230
  }
236
231
 
237
232
  if (!_this.state.isOpen) {
238
233
  _this.setState({
239
234
  isOpen: true,
235
+ isFocused: true,
240
236
  isPseudoFocused: false
241
237
  });
242
-
243
- return;
244
238
  }
239
+
240
+ return;
245
241
  } // Ensures that interactive elements within the Select component do not trigger the outer click
246
242
  // handler. For example, after an option is selected clicks on the 'clear' icon call here. We
247
243
  // should ignore those events. This comes after case where click is on input element, so that
@@ -257,11 +253,17 @@ var Select = /*#__PURE__*/function (_React$Component) {
257
253
  if (!_this.props.searchable) {
258
254
  _this.focus();
259
255
 
260
- _this.setState(function (prev) {
261
- return {
262
- isOpen: !prev.isOpen
263
- };
264
- });
256
+ if (_this.state.isOpen) {
257
+ _this.setState({
258
+ isOpen: false,
259
+ isFocused: false
260
+ });
261
+ } else {
262
+ _this.setState({
263
+ isOpen: true,
264
+ isFocused: true
265
+ });
266
+ }
265
267
 
266
268
  return;
267
269
  } // Cases below only apply to searchable Select component.
@@ -837,7 +839,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
837
839
  }
838
840
  }, {
839
841
  key: "renderInput",
840
- value: function renderInput() {
842
+ value: function renderInput(listboxId) {
841
843
  var _this4 = this;
842
844
 
843
845
  var _this$props$overrides3 = this.props.overrides,
@@ -866,25 +868,29 @@ var Select = /*#__PURE__*/function (_React$Component) {
866
868
  "aria-disabled": this.props.disabled,
867
869
  "aria-label": label,
868
870
  "aria-labelledby": this.props['aria-labelledby'],
869
- "aria-owns": this.state.isOpen ? this.listboxId : null,
871
+ "aria-owns": this.state.isOpen ? listboxId : null,
870
872
  "aria-required": this.props.required || null,
871
873
  onFocus: this.handleInputFocus,
872
- ref: this.handleInputRef,
873
874
  tabIndex: 0
874
875
  }, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement("input", {
875
- "aria-hidden": "true",
876
+ "aria-hidden": true,
876
877
  id: this.props.id || null,
877
- onFocus: this.handleInputFocus,
878
+ ref: this.handleInputRef,
878
879
  style: {
879
- display: 'none'
880
- }
880
+ opacity: 0,
881
+ width: 0,
882
+ overflow: 'hidden',
883
+ border: 'none',
884
+ padding: 0
885
+ },
886
+ tabIndex: -1
881
887
  }));
882
888
  }
883
889
 
884
890
  return /*#__PURE__*/React.createElement(InputContainer, _extends({}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement(_autosizeInput.default, _extends({
885
891
  "aria-activedescendant": this.state.activeDescendant,
886
892
  "aria-autocomplete": "list",
887
- "aria-controls": this.state.isOpen ? this.listboxId : null,
893
+ "aria-controls": this.state.isOpen ? listboxId : null,
888
894
  "aria-describedby": this.props['aria-describedby'],
889
895
  "aria-errormessage": this.props['aria-errormessage'],
890
896
  "aria-disabled": this.props.disabled || null,
@@ -1007,7 +1013,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
1007
1013
  value: function filterOptions(excludeOptions) {
1008
1014
  var _this5 = this;
1009
1015
 
1010
- var filterValue = this.state.inputValue; // apply filter function
1016
+ var filterValue = this.state.inputValue.trim(); // apply filter function
1011
1017
 
1012
1018
  if (this.props.filterOptions) {
1013
1019
  this.options = this.props.filterOptions(this.options, filterValue, excludeOptions, {
@@ -1137,63 +1143,65 @@ var Select = /*#__PURE__*/function (_React$Component) {
1137
1143
  }
1138
1144
  }
1139
1145
 
1140
- return /*#__PURE__*/React.createElement(_index.LocaleContext.Consumer, null, function (locale) {
1141
- return /*#__PURE__*/React.createElement(PopoverOverride // Popover does not provide ability to forward refs through, and if we were to simply
1142
- // apply the ref to the Root component below it would be overwritten before the popover
1143
- // renders it. Using this strategy, we will get a ref to the popover, then reuse its
1144
- // anchorRef so we can check if clicks are on the select component or not.
1145
- // eslint-disable-next-line flowtype/no-weak-types
1146
- , _extends({
1147
- ref: function ref(_ref4) {
1148
- if (!_ref4) return;
1149
- _this6.anchor = _ref4.anchorRef;
1150
- },
1151
- focusLock: false,
1152
- mountNode: _this6.props.mountNode,
1153
- onEsc: function onEsc() {
1154
- return _this6.closeMenu();
1155
- },
1156
- isOpen: isOpen,
1157
- popoverMargin: 0,
1158
- content: function content() {
1159
- var dropdownProps = {
1160
- error: _this6.props.error,
1161
- positive: _this6.props.positive,
1162
- getOptionLabel: _this6.props.getOptionLabel || _this6.getOptionLabel.bind(_this6, locale),
1163
- id: _this6.listboxId,
1164
- isLoading: _this6.props.isLoading,
1165
- labelKey: _this6.props.labelKey,
1166
- maxDropdownHeight: _this6.props.maxDropdownHeight,
1167
- multi: multi,
1168
- noResultsMsg: noResultsMsg,
1169
- onActiveDescendantChange: _this6.handleActiveDescendantChange,
1170
- onItemSelect: _this6.selectValue,
1171
- options: options,
1172
- overrides: overrides,
1173
- required: _this6.props.required,
1174
- searchable: _this6.props.searchable,
1175
- size: _this6.props.size,
1176
- type: type,
1177
- value: valueArray,
1178
- valueKey: _this6.props.valueKey,
1179
- width: _this6.anchor.current ? _this6.anchor.current.clientWidth : null,
1180
- keyboardControlNode: _this6.anchor
1181
- };
1182
- return /*#__PURE__*/React.createElement(_dropdown.default, _extends({
1183
- innerRef: _this6.dropdown
1184
- }, dropdownProps));
1185
- },
1186
- placement: _index2.PLACEMENT.bottom
1187
- }, popoverProps), /*#__PURE__*/React.createElement(Root, _extends({
1188
- onBlur: _this6.handleBlur,
1189
- "data-baseweb": "select"
1190
- }, sharedProps, rootProps), /*#__PURE__*/React.createElement(ControlContainer, _extends({
1191
- onKeyDown: _this6.handleKeyDown,
1192
- onClick: _this6.handleClick,
1193
- onTouchEnd: _this6.handleTouchEnd,
1194
- onTouchMove: _this6.handleTouchMove,
1195
- onTouchStart: _this6.handleTouchStart
1196
- }, sharedProps, controlContainerProps), type === _constants.TYPE.search ? _this6.renderSearch() : null, /*#__PURE__*/React.createElement(ValueContainer, _extends({}, sharedProps, valueContainerProps), _this6.renderValue(valueArray, isOpen, locale), _this6.renderInput(), _this6.shouldShowPlaceholder() ? /*#__PURE__*/React.createElement(Placeholder, _extends({}, sharedProps, placeholderProps), typeof _this6.props.placeholder !== 'undefined' ? _this6.props.placeholder : locale.select.placeholder) : null), /*#__PURE__*/React.createElement(IconsContainer, _extends({}, sharedProps, iconsContainerProps), _this6.renderLoading(), _this6.renderClear(), type === _constants.TYPE.select ? _this6.renderArrow() : null))));
1146
+ return /*#__PURE__*/React.createElement(_reactUid.UIDConsumer, null, function (listboxId) {
1147
+ return /*#__PURE__*/React.createElement(_index.LocaleContext.Consumer, null, function (locale) {
1148
+ return /*#__PURE__*/React.createElement(PopoverOverride // Popover does not provide ability to forward refs through, and if we were to simply
1149
+ // apply the ref to the Root component below it would be overwritten before the popover
1150
+ // renders it. Using this strategy, we will get a ref to the popover, then reuse its
1151
+ // anchorRef so we can check if clicks are on the select component or not.
1152
+ // eslint-disable-next-line flowtype/no-weak-types
1153
+ , _extends({
1154
+ innerRef: function innerRef(ref) {
1155
+ if (!ref) return;
1156
+ _this6.anchor = ref.anchorRef;
1157
+ },
1158
+ focusLock: false,
1159
+ mountNode: _this6.props.mountNode,
1160
+ onEsc: function onEsc() {
1161
+ return _this6.closeMenu();
1162
+ },
1163
+ isOpen: isOpen,
1164
+ popoverMargin: 0,
1165
+ content: function content() {
1166
+ var dropdownProps = {
1167
+ error: _this6.props.error,
1168
+ positive: _this6.props.positive,
1169
+ getOptionLabel: _this6.props.getOptionLabel || _this6.getOptionLabel.bind(_this6, locale),
1170
+ id: listboxId,
1171
+ isLoading: _this6.props.isLoading,
1172
+ labelKey: _this6.props.labelKey,
1173
+ maxDropdownHeight: _this6.props.maxDropdownHeight,
1174
+ multi: multi,
1175
+ noResultsMsg: noResultsMsg,
1176
+ onActiveDescendantChange: _this6.handleActiveDescendantChange,
1177
+ onItemSelect: _this6.selectValue,
1178
+ options: options,
1179
+ overrides: overrides,
1180
+ required: _this6.props.required,
1181
+ searchable: _this6.props.searchable,
1182
+ size: _this6.props.size,
1183
+ type: type,
1184
+ value: valueArray,
1185
+ valueKey: _this6.props.valueKey,
1186
+ width: _this6.anchor.current ? _this6.anchor.current.clientWidth : null,
1187
+ keyboardControlNode: _this6.anchor
1188
+ };
1189
+ return /*#__PURE__*/React.createElement(_dropdown.default, _extends({
1190
+ innerRef: _this6.dropdown
1191
+ }, dropdownProps));
1192
+ },
1193
+ placement: _index2.PLACEMENT.bottom
1194
+ }, popoverProps), /*#__PURE__*/React.createElement(Root, _extends({
1195
+ onBlur: _this6.handleBlur,
1196
+ "data-baseweb": "select"
1197
+ }, sharedProps, rootProps), /*#__PURE__*/React.createElement(ControlContainer, _extends({
1198
+ onKeyDown: _this6.handleKeyDown,
1199
+ onClick: _this6.handleClick,
1200
+ onTouchEnd: _this6.handleTouchEnd,
1201
+ onTouchMove: _this6.handleTouchMove,
1202
+ onTouchStart: _this6.handleTouchStart
1203
+ }, sharedProps, controlContainerProps), type === _constants.TYPE.search ? _this6.renderSearch() : null, /*#__PURE__*/React.createElement(ValueContainer, _extends({}, sharedProps, valueContainerProps), _this6.renderValue(valueArray, isOpen, locale), _this6.renderInput(listboxId), _this6.shouldShowPlaceholder() ? /*#__PURE__*/React.createElement(Placeholder, _extends({}, sharedProps, placeholderProps), typeof _this6.props.placeholder !== 'undefined' ? _this6.props.placeholder : locale.select.placeholder) : null), /*#__PURE__*/React.createElement(IconsContainer, _extends({}, sharedProps, iconsContainerProps), _this6.renderLoading(), _this6.renderClear(), type === _constants.TYPE.select ? _this6.renderArrow() : null))));
1204
+ });
1197
1205
  });
1198
1206
  }
1199
1207
  }]);
@@ -16,7 +16,7 @@ import {LocaleContext} from '../locale/index.js';
16
16
  import type {LocaleT} from '../locale/types.js';
17
17
  import {Popover, PLACEMENT} from '../popover/index.js';
18
18
  import {Spinner} from '../spinner/index.js';
19
- import getBuiId from '../utils/get-bui-id.js';
19
+ import {UIDConsumer} from 'react-uid';
20
20
 
21
21
  import AutosizeInput from './autosize-input.js';
22
22
  import {TYPE, STATE_CHANGE_TYPE} from './constants.js';
@@ -104,9 +104,6 @@ class Select extends React.Component<PropsT, SelectStateT> {
104
104
  // shape where optgroup titles are stored on the option in the __optgroup field.
105
105
  options: ValueT = [];
106
106
 
107
- // id generated for the listbox. used by screenreaders to associate the input with the menu it controls
108
- listboxId: string = getBuiId();
109
-
110
107
  constructor(props: PropsT) {
111
108
  super(props);
112
109
  this.options = normalizeOptions(props.options);
@@ -198,16 +195,17 @@ class Select extends React.Component<PropsT, SelectStateT> {
198
195
  if (!this.state.isFocused) {
199
196
  this.openAfterFocus = this.props.openOnClick;
200
197
  this.focus();
201
- return;
202
198
  }
203
199
 
204
200
  if (!this.state.isOpen) {
205
201
  this.setState({
206
202
  isOpen: true,
203
+ isFocused: true,
207
204
  isPseudoFocused: false,
208
205
  });
209
- return;
210
206
  }
207
+
208
+ return;
211
209
  }
212
210
 
213
211
  // Ensures that interactive elements within the Select component do not trigger the outer click
@@ -222,7 +220,12 @@ class Select extends React.Component<PropsT, SelectStateT> {
222
220
  // text input to filter the dropdown options.
223
221
  if (!this.props.searchable) {
224
222
  this.focus();
225
- this.setState(prev => ({isOpen: !prev.isOpen}));
223
+ if (this.state.isOpen) {
224
+ this.setState({isOpen: false, isFocused: false});
225
+ } else {
226
+ this.setState({isOpen: true, isFocused: true});
227
+ }
228
+
226
229
  return;
227
230
  }
228
231
 
@@ -673,7 +676,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
673
676
  }
674
677
  }
675
678
 
676
- renderInput() {
679
+ renderInput(listboxId: string) {
677
680
  const {overrides = {}} = this.props;
678
681
  const [InputContainer, inputContainerProps] = getOverrides(
679
682
  overrides.InputContainer,
@@ -698,19 +701,25 @@ class Select extends React.Component<PropsT, SelectStateT> {
698
701
  aria-disabled={this.props.disabled}
699
702
  aria-label={label}
700
703
  aria-labelledby={this.props['aria-labelledby']}
701
- aria-owns={this.state.isOpen ? this.listboxId : null}
704
+ aria-owns={this.state.isOpen ? listboxId : null}
702
705
  aria-required={this.props.required || null}
703
706
  onFocus={this.handleInputFocus}
704
- ref={this.handleInputRef}
705
707
  tabIndex={0}
706
708
  {...sharedProps}
707
709
  {...inputContainerProps}
708
710
  >
709
711
  <input
710
- aria-hidden="true"
712
+ aria-hidden
711
713
  id={this.props.id || null}
712
- onFocus={this.handleInputFocus}
713
- style={{display: 'none'}}
714
+ ref={this.handleInputRef}
715
+ style={{
716
+ opacity: 0,
717
+ width: 0,
718
+ overflow: 'hidden',
719
+ border: 'none',
720
+ padding: 0,
721
+ }}
722
+ tabIndex={-1}
714
723
  />
715
724
  </InputContainer>
716
725
  );
@@ -721,7 +730,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
721
730
  <AutosizeInput
722
731
  aria-activedescendant={this.state.activeDescendant}
723
732
  aria-autocomplete="list"
724
- aria-controls={this.state.isOpen ? this.listboxId : null}
733
+ aria-controls={this.state.isOpen ? listboxId : null}
725
734
  aria-describedby={this.props['aria-describedby']}
726
735
  aria-errormessage={this.props['aria-errormessage']}
727
736
  aria-disabled={this.props.disabled || null}
@@ -858,7 +867,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
858
867
  }
859
868
 
860
869
  filterOptions(excludeOptions: ?ValueT) {
861
- const filterValue = this.state.inputValue;
870
+ const filterValue = this.state.inputValue.trim();
862
871
  // apply filter function
863
872
  if (this.props.filterOptions) {
864
873
  this.options = this.props.filterOptions(
@@ -989,96 +998,103 @@ class Select extends React.Component<PropsT, SelectStateT> {
989
998
  }
990
999
 
991
1000
  return (
992
- <LocaleContext.Consumer>
993
- {locale => (
994
- <PopoverOverride
995
- // Popover does not provide ability to forward refs through, and if we were to simply
996
- // apply the ref to the Root component below it would be overwritten before the popover
997
- // renders it. Using this strategy, we will get a ref to the popover, then reuse its
998
- // anchorRef so we can check if clicks are on the select component or not.
999
- // eslint-disable-next-line flowtype/no-weak-types
1000
- ref={(ref: any) => {
1001
- if (!ref) return;
1002
- this.anchor = ref.anchorRef;
1003
- }}
1004
- focusLock={false}
1005
- mountNode={this.props.mountNode}
1006
- onEsc={() => this.closeMenu()}
1007
- isOpen={isOpen}
1008
- popoverMargin={0}
1009
- content={() => {
1010
- const dropdownProps = {
1011
- error: this.props.error,
1012
- positive: this.props.positive,
1013
- getOptionLabel:
1014
- this.props.getOptionLabel ||
1015
- this.getOptionLabel.bind(this, locale),
1016
- id: this.listboxId,
1017
- isLoading: this.props.isLoading,
1018
- labelKey: this.props.labelKey,
1019
- maxDropdownHeight: this.props.maxDropdownHeight,
1020
- multi,
1021
- noResultsMsg,
1022
- onActiveDescendantChange: this.handleActiveDescendantChange,
1023
- onItemSelect: this.selectValue,
1024
- options,
1025
- overrides,
1026
- required: this.props.required,
1027
- searchable: this.props.searchable,
1028
- size: this.props.size,
1029
- type,
1030
- value: valueArray,
1031
- valueKey: this.props.valueKey,
1032
- width: this.anchor.current
1033
- ? this.anchor.current.clientWidth
1034
- : null,
1035
- keyboardControlNode: this.anchor,
1036
- };
1037
-
1038
- return (
1039
- <SelectDropdown innerRef={this.dropdown} {...dropdownProps} />
1040
- );
1041
- }}
1042
- placement={PLACEMENT.bottom}
1043
- {...popoverProps}
1044
- >
1045
- <Root
1046
- onBlur={this.handleBlur}
1047
- data-baseweb="select"
1048
- {...sharedProps}
1049
- {...rootProps}
1050
- >
1051
- <ControlContainer
1052
- onKeyDown={this.handleKeyDown}
1053
- onClick={this.handleClick}
1054
- onTouchEnd={this.handleTouchEnd}
1055
- onTouchMove={this.handleTouchMove}
1056
- onTouchStart={this.handleTouchStart}
1057
- {...sharedProps}
1058
- {...controlContainerProps}
1001
+ <UIDConsumer>
1002
+ {listboxId => (
1003
+ <LocaleContext.Consumer>
1004
+ {locale => (
1005
+ <PopoverOverride
1006
+ // Popover does not provide ability to forward refs through, and if we were to simply
1007
+ // apply the ref to the Root component below it would be overwritten before the popover
1008
+ // renders it. Using this strategy, we will get a ref to the popover, then reuse its
1009
+ // anchorRef so we can check if clicks are on the select component or not.
1010
+ // eslint-disable-next-line flowtype/no-weak-types
1011
+ innerRef={(ref: any) => {
1012
+ if (!ref) return;
1013
+ this.anchor = ref.anchorRef;
1014
+ }}
1015
+ focusLock={false}
1016
+ mountNode={this.props.mountNode}
1017
+ onEsc={() => this.closeMenu()}
1018
+ isOpen={isOpen}
1019
+ popoverMargin={0}
1020
+ content={() => {
1021
+ const dropdownProps = {
1022
+ error: this.props.error,
1023
+ positive: this.props.positive,
1024
+ getOptionLabel:
1025
+ this.props.getOptionLabel ||
1026
+ this.getOptionLabel.bind(this, locale),
1027
+ id: listboxId,
1028
+ isLoading: this.props.isLoading,
1029
+ labelKey: this.props.labelKey,
1030
+ maxDropdownHeight: this.props.maxDropdownHeight,
1031
+ multi,
1032
+ noResultsMsg,
1033
+ onActiveDescendantChange: this.handleActiveDescendantChange,
1034
+ onItemSelect: this.selectValue,
1035
+ options,
1036
+ overrides,
1037
+ required: this.props.required,
1038
+ searchable: this.props.searchable,
1039
+ size: this.props.size,
1040
+ type,
1041
+ value: valueArray,
1042
+ valueKey: this.props.valueKey,
1043
+ width: this.anchor.current
1044
+ ? this.anchor.current.clientWidth
1045
+ : null,
1046
+ keyboardControlNode: this.anchor,
1047
+ };
1048
+
1049
+ return (
1050
+ <SelectDropdown
1051
+ innerRef={this.dropdown}
1052
+ {...dropdownProps}
1053
+ />
1054
+ );
1055
+ }}
1056
+ placement={PLACEMENT.bottom}
1057
+ {...popoverProps}
1059
1058
  >
1060
- {type === TYPE.search ? this.renderSearch() : null}
1061
- <ValueContainer {...sharedProps} {...valueContainerProps}>
1062
- {this.renderValue(valueArray, isOpen, locale)}
1063
- {this.renderInput()}
1064
- {this.shouldShowPlaceholder() ? (
1065
- <Placeholder {...sharedProps} {...placeholderProps}>
1066
- {typeof this.props.placeholder !== 'undefined'
1067
- ? this.props.placeholder
1068
- : locale.select.placeholder}
1069
- </Placeholder>
1070
- ) : null}
1071
- </ValueContainer>
1072
- <IconsContainer {...sharedProps} {...iconsContainerProps}>
1073
- {this.renderLoading()}
1074
- {this.renderClear()}
1075
- {type === TYPE.select ? this.renderArrow() : null}
1076
- </IconsContainer>
1077
- </ControlContainer>
1078
- </Root>
1079
- </PopoverOverride>
1059
+ <Root
1060
+ onBlur={this.handleBlur}
1061
+ data-baseweb="select"
1062
+ {...sharedProps}
1063
+ {...rootProps}
1064
+ >
1065
+ <ControlContainer
1066
+ onKeyDown={this.handleKeyDown}
1067
+ onClick={this.handleClick}
1068
+ onTouchEnd={this.handleTouchEnd}
1069
+ onTouchMove={this.handleTouchMove}
1070
+ onTouchStart={this.handleTouchStart}
1071
+ {...sharedProps}
1072
+ {...controlContainerProps}
1073
+ >
1074
+ {type === TYPE.search ? this.renderSearch() : null}
1075
+ <ValueContainer {...sharedProps} {...valueContainerProps}>
1076
+ {this.renderValue(valueArray, isOpen, locale)}
1077
+ {this.renderInput(listboxId)}
1078
+ {this.shouldShowPlaceholder() ? (
1079
+ <Placeholder {...sharedProps} {...placeholderProps}>
1080
+ {typeof this.props.placeholder !== 'undefined'
1081
+ ? this.props.placeholder
1082
+ : locale.select.placeholder}
1083
+ </Placeholder>
1084
+ ) : null}
1085
+ </ValueContainer>
1086
+ <IconsContainer {...sharedProps} {...iconsContainerProps}>
1087
+ {this.renderLoading()}
1088
+ {this.renderClear()}
1089
+ {type === TYPE.select ? this.renderArrow() : null}
1090
+ </IconsContainer>
1091
+ </ControlContainer>
1092
+ </Root>
1093
+ </PopoverOverride>
1094
+ )}
1095
+ </LocaleContext.Consumer>
1080
1096
  )}
1081
- </LocaleContext.Consumer>
1097
+ </UIDConsumer>
1082
1098
  );
1083
1099
  }
1084
1100
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
 
3
- import {Override} from './overrides';
3
+ import {Override} from '../overrides';
4
4
  import {DURATION, PLACEMENT} from './constants.js';
5
5
  export {DURATION, PLACEMENT} from './constants.js';
6
6
 
@@ -32,14 +32,14 @@ export type SnackbarElementPropsT = {
32
32
  actionMessage?: string;
33
33
  actionOnClick?: (event: React.MouseEvent<HTMLButtonElement>) => any;
34
34
  focus?: boolean;
35
- message: string;
35
+ message: React.ReactNode;
36
36
  overrides?: SnackbarElementOverridesT;
37
37
  progress?: boolean;
38
38
  startEnhancer?: React.FC<{size: number}>;
39
39
  };
40
40
 
41
41
  export type SnackbarProviderPropsT = {
42
- children?: React.Node;
42
+ children?: React.ReactNode;
43
43
  overrides?: SnackbarElementOverridesT & {
44
44
  PlacementContainer?: Override<any>;
45
45
  };
@@ -45,7 +45,7 @@ export type SnackbarElementPropsT = {|
45
45
  // if action button preset focus it, defaults to true
46
46
  focus?: boolean,
47
47
  // primary message displayed in snackbar
48
- message: string,
48
+ message: React.Node,
49
49
  overrides?: SnackbarElementOverridesT,
50
50
  // renders spinner in start enhancer position
51
51
  progress?: boolean,
@@ -57,6 +57,7 @@ export interface TableBuilderProps<RowT> {
57
57
  isLoading?: boolean;
58
58
  loadingMessage?: React.ReactNode | (() => React.ReactNode);
59
59
  emptyMessage?: React.ReactNode | (() => React.ReactNode);
60
+ size?: SIZE[keyof SIZE];
60
61
  }
61
62
  export class TableBuilder<RowT> extends React.Component<
62
63
  TableBuilderProps<RowT>
@@ -56,7 +56,7 @@ var StyledTable = (0, _index.styled)('table', function (_ref2) {
56
56
  var $theme = _ref2.$theme,
57
57
  $width = _ref2.$width;
58
58
  return {
59
- borderCollapse: 'collapse',
59
+ borderSpacing: '0',
60
60
  boxSizing: 'border-box',
61
61
  minWidth: '100%',
62
62
  width: $width || null
@@ -166,15 +166,8 @@ var StyledTableBody = (0, _index.styled)('tbody', function (_ref10) {
166
166
  exports.StyledTableBody = StyledTableBody;
167
167
  StyledTableBody.displayName = "StyledTableBody";
168
168
  var StyledTableBodyRow = (0, _index.styled)('tr', function (_ref11) {
169
- var $theme = _ref11.$theme,
170
- $divider = _ref11.$divider;
171
- var borderHorizontal = $divider === undefined || $divider === _constants.DIVIDER.horizontal || $divider === _constants.DIVIDER.grid;
169
+ var $theme = _ref11.$theme;
172
170
  return {
173
- ':not(:last-child)': {
174
- borderBottomColor: borderHorizontal ? $theme.borders.border300.borderColor : null,
175
- borderBottomStyle: borderHorizontal ? $theme.borders.border300.borderStyle : null,
176
- borderBottomWidth: borderHorizontal ? $theme.borders.border300.borderWidth : null
177
- },
178
171
  ':hover': {
179
172
  backgroundColor: $theme.colors.tableStripedBackground
180
173
  }
@@ -188,9 +181,11 @@ var StyledTableBodyCell = (0, _index.styled)('td', function (_ref12) {
188
181
  var $theme = _ref12.$theme,
189
182
  $size = _ref12.$size,
190
183
  $divider = _ref12.$divider,
191
- $isNumeric = _ref12.$isNumeric;
184
+ $isNumeric = _ref12.$isNumeric,
185
+ $isLastRow = _ref12.$isLastRow;
192
186
  var borderDir = $theme.direction === 'rtl' ? 'Left' : 'Right';
193
187
  var borderVertical = $divider === _constants.DIVIDER.vertical || $divider === _constants.DIVIDER.grid;
188
+ var borderHorizontal = $divider === undefined || $divider === _constants.DIVIDER.horizontal || $divider === _constants.DIVIDER.grid;
194
189
  var padding = sizeToCellPadding($theme, $size);
195
190
  return _objectSpread(_objectSpread({}, $theme.typography.font200), {}, {
196
191
  paddingTop: padding,
@@ -200,6 +195,9 @@ var StyledTableBodyCell = (0, _index.styled)('td', function (_ref12) {
200
195
  color: $theme.colors.contentPrimary,
201
196
  textAlign: $isNumeric ? 'right' : null,
202
197
  verticalAlign: 'top',
198
+ borderBottomColor: !$isLastRow && borderHorizontal ? $theme.borders.border300.borderColor : null,
199
+ borderBottomStyle: !$isLastRow && borderHorizontal ? $theme.borders.border300.borderStyle : null,
200
+ borderBottomWidth: !$isLastRow && borderHorizontal ? $theme.borders.border300.borderWidth : null,
203
201
  ':not(:last-child)': (_notLastChild2 = {}, _defineProperty(_notLastChild2, "border".concat(borderDir, "Color"), borderVertical ? $theme.borders.border300.borderColor : null), _defineProperty(_notLastChild2, "border".concat(borderDir, "Style"), borderVertical ? $theme.borders.border300.borderStyle : null), _defineProperty(_notLastChild2, "border".concat(borderDir, "Width"), borderVertical ? $theme.borders.border300.borderWidth : null), _notLastChild2)
204
202
  });
205
203
  });