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.
- package/app-nav-bar/index.d.ts +24 -0
- package/app-nav-bar/mobile-menu.js +5 -3
- package/app-nav-bar/mobile-menu.js.flow +3 -2
- package/app-nav-bar/user-menu.js +5 -3
- package/app-nav-bar/user-menu.js.flow +3 -2
- package/block/index.d.ts +7 -0
- package/combobox/combobox.js +4 -9
- package/combobox/combobox.js.flow +4 -3
- package/combobox/index.d.ts +1 -1
- package/data-table/filter-menu.js +5 -3
- package/data-table/filter-menu.js.flow +3 -2
- package/data-table/header-cell.js +1 -1
- package/data-table/header-cell.js.flow +1 -1
- package/datepicker/calendar.js +6 -1
- package/datepicker/calendar.js.flow +4 -0
- package/datepicker/datepicker.js +1 -1
- package/datepicker/datepicker.js.flow +5 -2
- package/datepicker/index.d.ts +9 -1
- package/datepicker/month.js +2 -1
- package/datepicker/month.js.flow +8 -1
- package/datepicker/types.js.flow +13 -6
- package/es/app-nav-bar/mobile-menu.js +5 -5
- package/es/app-nav-bar/user-menu.js +5 -5
- package/es/combobox/combobox.js +4 -3
- package/es/data-table/filter-menu.js +3 -2
- package/es/data-table/header-cell.js +1 -1
- package/es/datepicker/calendar.js +6 -1
- package/es/datepicker/datepicker.js +1 -1
- package/es/datepicker/month.js +2 -1
- package/es/form-control/form-control.js +6 -14
- package/es/helper/helper.js +10 -6
- package/es/helpers/base-provider.js +4 -1
- package/es/input/input.js +9 -5
- package/es/layer/layer.js +5 -1
- package/es/layout-grid/grid.js +16 -10
- package/es/layout-grid/styled-components.js +24 -12
- package/es/list/index.js +1 -0
- package/es/list/list-heading.js +77 -0
- package/es/list/list-item.js +1 -1
- package/es/list/menu-adapter.js +4 -2
- package/es/list/styled-components.js +101 -4
- package/es/menu/stateful-container.js +41 -27
- package/es/phone-input/base-country-picker.js +2 -0
- package/es/popover/popover.js +21 -10
- package/es/select/select-component.js +34 -22
- package/es/table-semantic/styled-components.js +8 -10
- package/es/table-semantic/table-builder.js +3 -2
- package/es/table-semantic/table.js +1 -0
- package/es/tag/index.js +1 -1
- package/es/tag/styled-components.js +2 -4
- package/es/tag/tag.js +16 -16
- package/es/textarea/textarea.js +1 -2
- package/es/themes/dark-theme/color-semantic-tokens.js +18 -8
- package/es/themes/light-theme/color-semantic-tokens.js +14 -4
- package/es/tokens/colors.js +3 -3
- package/es/tree-view/tree-view.js +0 -2
- package/esm/app-nav-bar/mobile-menu.js +5 -3
- package/esm/app-nav-bar/user-menu.js +5 -3
- package/esm/combobox/combobox.js +4 -7
- package/esm/data-table/filter-menu.js +4 -3
- package/esm/data-table/header-cell.js +1 -1
- package/esm/datepicker/calendar.js +6 -1
- package/esm/datepicker/datepicker.js +1 -1
- package/esm/datepicker/month.js +2 -1
- package/esm/form-control/form-control.js +21 -33
- package/esm/helper/helper.js +10 -6
- package/esm/helpers/base-provider.js +4 -1
- package/esm/input/input.js +9 -5
- package/esm/layer/layer.js +5 -1
- package/esm/layout-grid/grid.js +20 -10
- package/esm/layout-grid/styled-components.js +52 -35
- package/esm/list/index.js +1 -0
- package/esm/list/list-heading.js +116 -0
- package/esm/list/list-item.js +1 -1
- package/esm/list/menu-adapter.js +4 -2
- package/esm/list/styled-components.js +99 -3
- package/esm/menu/stateful-container.js +56 -40
- package/esm/phone-input/base-country-picker.js +2 -0
- package/esm/popover/popover.js +25 -16
- package/esm/select/select-component.js +87 -79
- package/esm/table-semantic/styled-components.js +8 -10
- package/esm/table-semantic/table-builder.js +3 -2
- package/esm/table-semantic/table.js +1 -0
- package/esm/tag/index.js +1 -1
- package/esm/tag/styled-components.js +2 -4
- package/esm/tag/tag.js +18 -16
- package/esm/textarea/textarea.js +1 -2
- package/esm/themes/dark-theme/color-semantic-tokens.js +18 -8
- package/esm/themes/light-theme/color-semantic-tokens.js +14 -4
- package/esm/tokens/colors.js +3 -3
- package/esm/tree-view/tree-view.js +0 -2
- package/form-control/form-control.js +21 -35
- package/form-control/form-control.js.flow +37 -35
- package/helper/helper.js +10 -6
- package/helper/helper.js.flow +1 -0
- package/helpers/base-provider.js +5 -1
- package/helpers/base-provider.js.flow +4 -1
- package/index.d.ts +1 -0
- package/input/input.js +9 -5
- package/input/input.js.flow +9 -5
- package/layer/layer.js +5 -1
- package/layer/layer.js.flow +3 -1
- package/layer/types.js.flow +4 -0
- package/layout-grid/grid.js +19 -9
- package/layout-grid/grid.js.flow +52 -26
- package/layout-grid/index.d.ts +1 -0
- package/layout-grid/styled-components.js +54 -36
- package/layout-grid/styled-components.js.flow +48 -24
- package/layout-grid/types.js.flow +12 -0
- package/list/index.js +9 -0
- package/list/index.js.flow +1 -0
- package/list/list-heading.js +124 -0
- package/list/list-heading.js.flow +138 -0
- package/list/list-item.js +1 -1
- package/list/list-item.js.flow +1 -1
- package/list/menu-adapter.js +5 -2
- package/list/menu-adapter.js.flow +21 -11
- package/list/styled-components.js +108 -5
- package/list/styled-components.js.flow +103 -2
- package/list/types.js.flow +22 -0
- package/menu/stateful-container.js +57 -42
- package/menu/stateful-container.js.flow +38 -26
- package/package.json +1 -1
- package/phone-input/base-country-picker.js +2 -0
- package/phone-input/base-country-picker.js.flow +2 -0
- package/popover/popover.js +26 -17
- package/popover/popover.js.flow +19 -7
- package/select/select-component.js +87 -79
- package/select/select-component.js.flow +119 -103
- package/snackbar/index.d.ts +3 -3
- package/snackbar/types.js.flow +1 -1
- package/table-semantic/index.d.ts +1 -0
- package/table-semantic/styled-components.js +8 -10
- package/table-semantic/styled-components.js.flow +20 -20
- package/table-semantic/table-builder.js +3 -2
- package/table-semantic/table-builder.js.flow +3 -2
- package/table-semantic/table.js +1 -0
- package/table-semantic/table.js.flow +1 -0
- package/tag/index.d.ts +0 -1
- package/tag/index.js +0 -6
- package/tag/index.js.flow +0 -1
- package/tag/styled-components.js +3 -6
- package/tag/styled-components.js.flow +0 -2
- package/tag/tag.js +19 -14
- package/tag/tag.js.flow +13 -19
- package/textarea/textarea.js +1 -2
- package/textarea/textarea.js.flow +0 -1
- package/theme.ts +12 -0
- package/themes/dark-theme/color-semantic-tokens.js +18 -8
- package/themes/dark-theme/color-semantic-tokens.js.flow +18 -7
- package/themes/light-theme/color-semantic-tokens.js +14 -4
- package/themes/light-theme/color-semantic-tokens.js.flow +14 -3
- package/themes/types.js.flow +11 -0
- package/toast/index.d.ts +1 -0
- package/tokens/colors.js +3 -3
- package/tokens/colors.js.flow +3 -3
- package/tree-view/tree-view.js +0 -2
- package/tree-view/tree-view.js.flow +0 -1
- package/es/utils/get-bui-id.js +0 -33
- package/esm/utils/get-bui-id.js +0 -33
- package/utils/get-bui-id.js +0 -41
- 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
|
|
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.
|
|
261
|
-
|
|
262
|
-
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 ?
|
|
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":
|
|
876
|
+
"aria-hidden": true,
|
|
876
877
|
id: this.props.id || null,
|
|
877
|
-
|
|
878
|
+
ref: this.handleInputRef,
|
|
878
879
|
style: {
|
|
879
|
-
|
|
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 ?
|
|
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(
|
|
1141
|
-
return /*#__PURE__*/React.createElement(
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
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
|
|
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
|
-
|
|
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 ?
|
|
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
|
|
712
|
+
aria-hidden
|
|
711
713
|
id={this.props.id || null}
|
|
712
|
-
|
|
713
|
-
style={{
|
|
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 ?
|
|
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
|
-
<
|
|
993
|
-
{
|
|
994
|
-
<
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
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
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
{
|
|
1064
|
-
{
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
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
|
-
</
|
|
1097
|
+
</UIDConsumer>
|
|
1082
1098
|
);
|
|
1083
1099
|
}
|
|
1084
1100
|
}
|
package/snackbar/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import {Override} from '
|
|
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:
|
|
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.
|
|
42
|
+
children?: React.ReactNode;
|
|
43
43
|
overrides?: SnackbarElementOverridesT & {
|
|
44
44
|
PlacementContainer?: Override<any>;
|
|
45
45
|
};
|
package/snackbar/types.js.flow
CHANGED
|
@@ -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:
|
|
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
|
-
|
|
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
|
});
|