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
|
@@ -48,7 +48,7 @@ export var StyledTable = styled('table', function (_ref2) {
|
|
|
48
48
|
var $theme = _ref2.$theme,
|
|
49
49
|
$width = _ref2.$width;
|
|
50
50
|
return {
|
|
51
|
-
|
|
51
|
+
borderSpacing: '0',
|
|
52
52
|
boxSizing: 'border-box',
|
|
53
53
|
minWidth: '100%',
|
|
54
54
|
width: $width || null
|
|
@@ -149,15 +149,8 @@ export var StyledTableBody = styled('tbody', function (_ref10) {
|
|
|
149
149
|
});
|
|
150
150
|
StyledTableBody.displayName = "StyledTableBody";
|
|
151
151
|
export var StyledTableBodyRow = styled('tr', function (_ref11) {
|
|
152
|
-
var $theme = _ref11.$theme
|
|
153
|
-
$divider = _ref11.$divider;
|
|
154
|
-
var borderHorizontal = $divider === undefined || $divider === DIVIDER.horizontal || $divider === DIVIDER.grid;
|
|
152
|
+
var $theme = _ref11.$theme;
|
|
155
153
|
return {
|
|
156
|
-
':not(:last-child)': {
|
|
157
|
-
borderBottomColor: borderHorizontal ? $theme.borders.border300.borderColor : null,
|
|
158
|
-
borderBottomStyle: borderHorizontal ? $theme.borders.border300.borderStyle : null,
|
|
159
|
-
borderBottomWidth: borderHorizontal ? $theme.borders.border300.borderWidth : null
|
|
160
|
-
},
|
|
161
154
|
':hover': {
|
|
162
155
|
backgroundColor: $theme.colors.tableStripedBackground
|
|
163
156
|
}
|
|
@@ -170,9 +163,11 @@ export var StyledTableBodyCell = styled('td', function (_ref12) {
|
|
|
170
163
|
var $theme = _ref12.$theme,
|
|
171
164
|
$size = _ref12.$size,
|
|
172
165
|
$divider = _ref12.$divider,
|
|
173
|
-
$isNumeric = _ref12.$isNumeric
|
|
166
|
+
$isNumeric = _ref12.$isNumeric,
|
|
167
|
+
$isLastRow = _ref12.$isLastRow;
|
|
174
168
|
var borderDir = $theme.direction === 'rtl' ? 'Left' : 'Right';
|
|
175
169
|
var borderVertical = $divider === DIVIDER.vertical || $divider === DIVIDER.grid;
|
|
170
|
+
var borderHorizontal = $divider === undefined || $divider === DIVIDER.horizontal || $divider === DIVIDER.grid;
|
|
176
171
|
var padding = sizeToCellPadding($theme, $size);
|
|
177
172
|
return _objectSpread(_objectSpread({}, $theme.typography.font200), {}, {
|
|
178
173
|
paddingTop: padding,
|
|
@@ -182,6 +177,9 @@ export var StyledTableBodyCell = styled('td', function (_ref12) {
|
|
|
182
177
|
color: $theme.colors.contentPrimary,
|
|
183
178
|
textAlign: $isNumeric ? 'right' : null,
|
|
184
179
|
verticalAlign: 'top',
|
|
180
|
+
borderBottomColor: !$isLastRow && borderHorizontal ? $theme.borders.border300.borderColor : null,
|
|
181
|
+
borderBottomStyle: !$isLastRow && borderHorizontal ? $theme.borders.border300.borderStyle : null,
|
|
182
|
+
borderBottomWidth: !$isLastRow && borderHorizontal ? $theme.borders.border300.borderWidth : null,
|
|
185
183
|
':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)
|
|
186
184
|
});
|
|
187
185
|
});
|
|
@@ -258,7 +258,7 @@ var TableBuilder = /*#__PURE__*/function (_React$Component) {
|
|
|
258
258
|
}, tableHeadCellSortableProps, colTableHeadCellSortableProps), col.header, sortIcon);
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
function renderCell(col, colIndex, row, rowIndex) {
|
|
261
|
+
function renderCell(col, colIndex, row, rowIndex, lastRowindex) {
|
|
262
262
|
var colOverrides = col.overrides || {};
|
|
263
263
|
|
|
264
264
|
var _getOverrides33 = getOverrides(colOverrides.TableBodyCell, TableBodyCell),
|
|
@@ -274,6 +274,7 @@ var TableBuilder = /*#__PURE__*/function (_React$Component) {
|
|
|
274
274
|
$row: row,
|
|
275
275
|
$rowIndex: rowIndex,
|
|
276
276
|
$isNumeric: col.numeric,
|
|
277
|
+
$isLastRow: rowIndex === lastRowindex,
|
|
277
278
|
$size: size
|
|
278
279
|
}, tableBodyCellProps, colTableBodyCellProps), col.children(row, rowIndex));
|
|
279
280
|
}
|
|
@@ -301,7 +302,7 @@ var TableBuilder = /*#__PURE__*/function (_React$Component) {
|
|
|
301
302
|
$row: row,
|
|
302
303
|
$rowIndex: rowIndex
|
|
303
304
|
}, tableBodyRowProps), columns.map(function (col, colIndex) {
|
|
304
|
-
return renderCell(col, colIndex, row, rowIndex);
|
|
305
|
+
return renderCell(col, colIndex, row, rowIndex, data.length - 1);
|
|
305
306
|
}));
|
|
306
307
|
}))));
|
|
307
308
|
}
|
package/esm/tag/index.js
CHANGED
|
@@ -6,5 +6,5 @@ LICENSE file in the root directory of this source tree.
|
|
|
6
6
|
*/
|
|
7
7
|
export { default as Tag } from './tag.js'; // Styled elements
|
|
8
8
|
|
|
9
|
-
export { Root as StyledRoot, Action as StyledAction,
|
|
9
|
+
export { Root as StyledRoot, Action as StyledAction, Text as StyledText } from './styled-components.js';
|
|
10
10
|
export { KIND, VARIANT, SIZE } from './constants.js';
|
|
@@ -278,11 +278,9 @@ export var Action = styled('span', function (props) {
|
|
|
278
278
|
return _ref = {
|
|
279
279
|
alignItems: 'center'
|
|
280
280
|
}, _defineProperty(_ref, bottomRadiusDir, $theme.borders.useRoundedCorners ? $theme.borders.radius400 : 0), _defineProperty(_ref, topRadiusDir, $theme.borders.useRoundedCorners ? $theme.borders.radius400 : 0), _defineProperty(_ref, "cursor", $disabled ? 'not-allowed' : 'pointer'), _defineProperty(_ref, "display", 'flex'), _defineProperty(_ref, marginDir, (_SIZE$small$SIZE$medi = {}, _defineProperty(_SIZE$small$SIZE$medi, SIZE.small, '8px'), _defineProperty(_SIZE$small$SIZE$medi, SIZE.medium, '12px'), _defineProperty(_SIZE$small$SIZE$medi, SIZE.large, '16px'), _SIZE$small$SIZE$medi)[$size]), _defineProperty(_ref, "outline", 'none'), _defineProperty(_ref, "transitionProperty", 'all'), _defineProperty(_ref, "transitionDuration", 'background-color'), _defineProperty(_ref, "transitionTimingFunction", $theme.animation.easeOutCurve), _ref;
|
|
281
|
-
});
|
|
282
|
-
Action.displayName = "Action";
|
|
283
|
-
export var ActionIcon = styled('svg', {}); // $FlowFixMe https://github.com/facebook/flow/issues/7745
|
|
281
|
+
}); // $FlowFixMe https://github.com/facebook/flow/issues/7745
|
|
284
282
|
|
|
285
|
-
|
|
283
|
+
Action.displayName = "Action";
|
|
286
284
|
export var StartEnhancerContainer = styled('div', function (_ref2) {
|
|
287
285
|
var $theme = _ref2.$theme,
|
|
288
286
|
_ref2$$size = _ref2.$size,
|
package/esm/tag/tag.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
2
|
|
|
5
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -14,6 +12,8 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
14
12
|
|
|
15
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
14
|
|
|
15
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
|
|
17
17
|
/*
|
|
18
18
|
Copyright (c) Uber Technologies, Inc.
|
|
19
19
|
|
|
@@ -22,10 +22,19 @@ LICENSE file in the root directory of this source tree.
|
|
|
22
22
|
*/
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { getOverrides } from '../helpers/overrides.js';
|
|
25
|
-
import { Action as StyledAction, Root as StyledRoot,
|
|
25
|
+
import { Action as StyledAction, Root as StyledRoot, StartEnhancerContainer as StyledStartEnhancerContainer, Text as StyledText } from './styled-components.js';
|
|
26
26
|
import { KIND, VARIANT, SIZE } from './constants.js';
|
|
27
27
|
import { getTextFromChildren } from './utils.js';
|
|
28
|
-
import
|
|
28
|
+
import DeleteIcon from '../icon/delete.js';
|
|
29
|
+
import { isFocusVisible, forkFocus, forkBlur } from '../utils/focusVisible.js'; // Previously, Tag used a hardcoded SVG as its 'close' icon. Replacing it with
|
|
30
|
+
// Delete requires modifying Delete's viewbox to prevent visual regressions.
|
|
31
|
+
|
|
32
|
+
var ModifiedViewBoxDeleteIcon = function ModifiedViewBoxDeleteIcon(props) {
|
|
33
|
+
return /*#__PURE__*/React.createElement(DeleteIcon, _extends({
|
|
34
|
+
viewBox: "5 5 13.186 13.186"
|
|
35
|
+
}, props));
|
|
36
|
+
};
|
|
37
|
+
|
|
29
38
|
var Tag = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
30
39
|
var _SIZE$small$SIZE$medi;
|
|
31
40
|
|
|
@@ -106,7 +115,7 @@ var Tag = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
106
115
|
Action = _getOverrides4[0],
|
|
107
116
|
actionProps = _getOverrides4[1];
|
|
108
117
|
|
|
109
|
-
var _getOverrides5 = getOverrides(overrides.ActionIcon,
|
|
118
|
+
var _getOverrides5 = getOverrides(overrides.ActionIcon, ModifiedViewBoxDeleteIcon),
|
|
110
119
|
_getOverrides6 = _slicedToArray(_getOverrides5, 2),
|
|
111
120
|
ActionIcon = _getOverrides6[0],
|
|
112
121
|
actionIconProps = _getOverrides6[1];
|
|
@@ -147,7 +156,7 @@ var Tag = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
147
156
|
};
|
|
148
157
|
var titleText = title || getTextFromChildren(children);
|
|
149
158
|
var isButton = (clickable || closeable) && !disabled;
|
|
150
|
-
var actionSize = (_SIZE$small$SIZE$medi = {}, _defineProperty(_SIZE$small$SIZE$medi, SIZE.small,
|
|
159
|
+
var actionSize = (_SIZE$small$SIZE$medi = {}, _defineProperty(_SIZE$small$SIZE$medi, SIZE.small, 12), _defineProperty(_SIZE$small$SIZE$medi, SIZE.medium, 16), _defineProperty(_SIZE$small$SIZE$medi, SIZE.large, 20), _SIZE$small$SIZE$medi)[size]; // Capitalize for JSX
|
|
151
160
|
|
|
152
161
|
var StartEnhancer = startEnhancer;
|
|
153
162
|
return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line flowtype/no-weak-types
|
|
@@ -161,21 +170,14 @@ var Tag = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
161
170
|
}, rootHandlers, sharedProps, rootProps, {
|
|
162
171
|
onFocus: forkFocus(rootProps, handleFocus),
|
|
163
172
|
onBlur: forkBlur(rootProps, handleBlur)
|
|
164
|
-
}), StartEnhancer && /*#__PURE__*/React.createElement(StartEnhancerContainer, startEnhancerContainerProps, /*#__PURE__*/React.createElement(StartEnhancer, null)), /*#__PURE__*/React.createElement(Text, _extends({
|
|
173
|
+
}), StartEnhancer && StartEnhancer !== 0 && /*#__PURE__*/React.createElement(StartEnhancerContainer, startEnhancerContainerProps, /*#__PURE__*/React.createElement(StartEnhancer, null)), /*#__PURE__*/React.createElement(Text, _extends({
|
|
165
174
|
title: titleText
|
|
166
175
|
}, textProps), children), closeable ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
167
176
|
"aria-hidden": true,
|
|
168
177
|
role: "presentation"
|
|
169
178
|
}, actionHandlers, sharedProps, actionProps), /*#__PURE__*/React.createElement(ActionIcon, _extends({
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
viewBox: "0 0 24 24",
|
|
173
|
-
fill: "none",
|
|
174
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
175
|
-
}, actionIconProps), /*#__PURE__*/React.createElement("path", {
|
|
176
|
-
fill: "currentColor",
|
|
177
|
-
d: "M21.0999 5.09998L18.8999 2.90002L11.9999 9.90002L5.09985 2.90002L2.8999 5.09998L9.8999 12L2.8999 18.9L5.09985 21.1L11.9999 14.1L18.8999 21.1L21.0999 18.9L14.0999 12L21.0999 5.09998Z"
|
|
178
|
-
}))) : null);
|
|
179
|
+
size: actionSize
|
|
180
|
+
}, actionIconProps))) : null);
|
|
179
181
|
});
|
|
180
182
|
Tag.displayName = 'Tag';
|
|
181
183
|
export default Tag;
|
package/esm/textarea/textarea.js
CHANGED
|
@@ -23,12 +23,12 @@ export default (function () {
|
|
|
23
23
|
backgroundInversePrimary: foundation.primaryA,
|
|
24
24
|
backgroundInverseSecondary: colors.gray300,
|
|
25
25
|
// Content
|
|
26
|
-
contentPrimary:
|
|
27
|
-
contentSecondary: colors.
|
|
28
|
-
contentTertiary: colors.
|
|
29
|
-
contentInversePrimary:
|
|
30
|
-
contentInverseSecondary: colors.
|
|
31
|
-
contentInverseTertiary: colors.
|
|
26
|
+
contentPrimary: colors.white,
|
|
27
|
+
contentSecondary: colors.gray300,
|
|
28
|
+
contentTertiary: colors.gray400,
|
|
29
|
+
contentInversePrimary: colors.black,
|
|
30
|
+
contentInverseSecondary: colors.gray700,
|
|
31
|
+
contentInverseTertiary: colors.gray600,
|
|
32
32
|
// Border
|
|
33
33
|
borderOpaque: colors.gray700,
|
|
34
34
|
borderTransparent: hexToRgba(foundation.primaryA, '0.08'),
|
|
@@ -45,7 +45,7 @@ export default (function () {
|
|
|
45
45
|
backgroundAccent: foundation.accent,
|
|
46
46
|
backgroundNegative: foundation.negative,
|
|
47
47
|
backgroundWarning: foundation.warning,
|
|
48
|
-
backgroundPositive:
|
|
48
|
+
backgroundPositive: colors.green500,
|
|
49
49
|
backgroundLightAccent: colors.blue700,
|
|
50
50
|
backgroundLightPositive: colors.green700,
|
|
51
51
|
backgroundLightNegative: colors.red700,
|
|
@@ -66,7 +66,17 @@ export default (function () {
|
|
|
66
66
|
borderAccentLight: colors.blue500,
|
|
67
67
|
borderNegative: colors.red500,
|
|
68
68
|
borderWarning: colors.yellow500,
|
|
69
|
-
borderPositive: colors.green500
|
|
69
|
+
borderPositive: colors.green500,
|
|
70
|
+
// Programs
|
|
71
|
+
safety: colors.blue400,
|
|
72
|
+
eatsGreen400: colors.green400,
|
|
73
|
+
freightBlue400: colors.cobalt400,
|
|
74
|
+
jumpRed400: colors.red400,
|
|
75
|
+
rewardsTier1: colors.blue400,
|
|
76
|
+
rewardsTier2: colors.yellow400,
|
|
77
|
+
rewardsTier3: colors.platinum400,
|
|
78
|
+
rewardsTier4: colors.gray200,
|
|
79
|
+
membership: colors.yellow600
|
|
70
80
|
};
|
|
71
81
|
return _objectSpread(_objectSpread({}, core), coreExtensions);
|
|
72
82
|
});
|
|
@@ -45,7 +45,7 @@ export default (function () {
|
|
|
45
45
|
backgroundAccent: foundation.accent,
|
|
46
46
|
backgroundNegative: foundation.negative,
|
|
47
47
|
backgroundWarning: foundation.warning,
|
|
48
|
-
backgroundPositive:
|
|
48
|
+
backgroundPositive: colors.green400,
|
|
49
49
|
backgroundLightAccent: colors.blue50,
|
|
50
50
|
backgroundLightNegative: colors.red50,
|
|
51
51
|
backgroundLightWarning: colors.yellow50,
|
|
@@ -58,15 +58,25 @@ export default (function () {
|
|
|
58
58
|
contentOnColor: colors.white,
|
|
59
59
|
contentOnColorInverse: colors.black,
|
|
60
60
|
contentNegative: foundation.negative,
|
|
61
|
-
contentWarning: colors.
|
|
62
|
-
contentPositive:
|
|
61
|
+
contentWarning: colors.yellow600,
|
|
62
|
+
contentPositive: colors.green400,
|
|
63
63
|
// Border
|
|
64
64
|
borderStateDisabled: colors.gray50,
|
|
65
65
|
borderAccent: colors.blue400,
|
|
66
66
|
borderAccentLight: colors.blue200,
|
|
67
67
|
borderNegative: colors.red200,
|
|
68
68
|
borderWarning: colors.yellow200,
|
|
69
|
-
borderPositive: colors.green200
|
|
69
|
+
borderPositive: colors.green200,
|
|
70
|
+
// Programs
|
|
71
|
+
safety: colors.blue400,
|
|
72
|
+
eatsGreen400: colors.green400,
|
|
73
|
+
freightBlue400: colors.cobalt400,
|
|
74
|
+
jumpRed400: colors.red400,
|
|
75
|
+
rewardsTier1: colors.blue400,
|
|
76
|
+
rewardsTier2: colors.yellow400,
|
|
77
|
+
rewardsTier3: colors.platinum400,
|
|
78
|
+
rewardsTier4: colors.black,
|
|
79
|
+
membership: colors.yellow600
|
|
70
80
|
};
|
|
71
81
|
return _objectSpread(_objectSpread({}, core), coreExtensions);
|
|
72
82
|
});
|
package/esm/tokens/colors.js
CHANGED
|
@@ -11,7 +11,7 @@ var colors = {
|
|
|
11
11
|
gray200: '#E2E2E2',
|
|
12
12
|
gray300: '#CBCBCB',
|
|
13
13
|
gray400: '#AFAFAF',
|
|
14
|
-
gray500: '#
|
|
14
|
+
gray500: '#6B6B6B',
|
|
15
15
|
gray600: '#545454',
|
|
16
16
|
gray700: '#333333',
|
|
17
17
|
gray800: '#1F1F1F',
|
|
@@ -48,13 +48,13 @@ var colors = {
|
|
|
48
48
|
yellow300: '#FFCF70',
|
|
49
49
|
yellow400: '#FFC043',
|
|
50
50
|
yellow500: '#BC8B2C',
|
|
51
|
-
yellow600: '#
|
|
51
|
+
yellow600: '#996F00',
|
|
52
52
|
yellow700: '#674D1B',
|
|
53
53
|
green50: '#E6F2ED',
|
|
54
54
|
green100: '#ADDEC9',
|
|
55
55
|
green200: '#66D19E',
|
|
56
56
|
green300: '#06C167',
|
|
57
|
-
green400: '#
|
|
57
|
+
green400: '#048848',
|
|
58
58
|
green500: '#03703C',
|
|
59
59
|
green600: '#03582F',
|
|
60
60
|
green700: '#10462D',
|
|
@@ -11,12 +11,10 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _overrides = require("../helpers/overrides.js");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _reactUid = require("react-uid");
|
|
15
15
|
|
|
16
16
|
var _styledComponents = require("./styled-components.js");
|
|
17
17
|
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
18
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
21
19
|
|
|
22
20
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -67,28 +65,14 @@ var FormControl = /*#__PURE__*/function (_React$Component) {
|
|
|
67
65
|
var _super = _createSuper(FormControl);
|
|
68
66
|
|
|
69
67
|
function FormControl() {
|
|
70
|
-
var _this;
|
|
71
|
-
|
|
72
68
|
_classCallCheck(this, FormControl);
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
args[_key] = arguments[_key];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
79
|
-
|
|
80
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
81
|
-
captionId: (0, _getBuiId.default)()
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return _this;
|
|
70
|
+
return _super.apply(this, arguments);
|
|
85
71
|
}
|
|
86
72
|
|
|
87
73
|
_createClass(FormControl, [{
|
|
88
74
|
key: "render",
|
|
89
75
|
value: function render() {
|
|
90
|
-
var _this2 = this;
|
|
91
|
-
|
|
92
76
|
var _this$props = this.props,
|
|
93
77
|
_this$props$overrides = _this$props.overrides,
|
|
94
78
|
LabelOverride = _this$props$overrides.Label,
|
|
@@ -126,23 +110,25 @@ var FormControl = /*#__PURE__*/function (_React$Component) {
|
|
|
126
110
|
return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(Label, _extends({
|
|
127
111
|
"data-baseweb": "form-control-label",
|
|
128
112
|
htmlFor: htmlFor || onlyChildProps.id
|
|
129
|
-
}, sharedProps, (0, _overrides.getOverrideProps)(LabelOverride)), typeof label === 'function' ? label(sharedProps) : label), /*#__PURE__*/React.createElement(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
113
|
+
}, sharedProps, (0, _overrides.getOverrideProps)(LabelOverride)), typeof label === 'function' ? label(sharedProps) : label), /*#__PURE__*/React.createElement(_reactUid.UIDConsumer, null, function (captionId) {
|
|
114
|
+
return /*#__PURE__*/React.createElement(ControlContainer, _extends({
|
|
115
|
+
"data-baseweb": "form-control-container"
|
|
116
|
+
}, sharedProps, (0, _overrides.getOverrideProps)(ControlContainerOverride)), React.Children.map(children, function (child, index) {
|
|
117
|
+
if (!child) return;
|
|
118
|
+
var key = child.key || String(index);
|
|
119
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
120
|
+
key: key,
|
|
121
|
+
'aria-errormessage': error ? captionId : null,
|
|
122
|
+
'aria-describedby': caption || positive ? captionId : null,
|
|
123
|
+
disabled: onlyChildProps.disabled || disabled,
|
|
124
|
+
error: typeof onlyChildProps.error !== 'undefined' ? onlyChildProps.error : error,
|
|
125
|
+
positive: typeof onlyChildProps.positive !== 'undefined' ? onlyChildProps.positive : positive
|
|
126
|
+
});
|
|
127
|
+
}), (caption || error || positive) && /*#__PURE__*/React.createElement(Caption, _extends({
|
|
128
|
+
"data-baseweb": "form-control-caption",
|
|
129
|
+
id: captionId
|
|
130
|
+
}, sharedProps, (0, _overrides.getOverrideProps)(CaptionOverride)), hint));
|
|
131
|
+
}));
|
|
146
132
|
}
|
|
147
133
|
}]);
|
|
148
134
|
|
|
@@ -8,7 +8,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
8
8
|
// @flow
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import {getOverride, getOverrideProps} from '../helpers/overrides.js';
|
|
11
|
-
import
|
|
11
|
+
import {UIDConsumer} from 'react-uid';
|
|
12
12
|
import {
|
|
13
13
|
Label as StyledLabel,
|
|
14
14
|
Caption as StyledCaption,
|
|
@@ -42,7 +42,6 @@ export default class FormControl extends React.Component<
|
|
|
42
42
|
caption: null,
|
|
43
43
|
disabled: false,
|
|
44
44
|
};
|
|
45
|
-
state = {captionId: getBuiId()};
|
|
46
45
|
|
|
47
46
|
render() {
|
|
48
47
|
const {
|
|
@@ -96,42 +95,45 @@ export default class FormControl extends React.Component<
|
|
|
96
95
|
{typeof label === 'function' ? label(sharedProps) : label}
|
|
97
96
|
</Label>
|
|
98
97
|
)}
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
>
|
|
104
|
-
{React.Children.map(children, (child, index) => {
|
|
105
|
-
if (!child) return;
|
|
106
|
-
|
|
107
|
-
const key = child.key || String(index);
|
|
108
|
-
return React.cloneElement(child, {
|
|
109
|
-
key,
|
|
110
|
-
'aria-errormessage': error ? this.state.captionId : null,
|
|
111
|
-
'aria-describedby':
|
|
112
|
-
caption || positive ? this.state.captionId : null,
|
|
113
|
-
disabled: onlyChildProps.disabled || disabled,
|
|
114
|
-
error:
|
|
115
|
-
typeof onlyChildProps.error !== 'undefined'
|
|
116
|
-
? onlyChildProps.error
|
|
117
|
-
: error,
|
|
118
|
-
positive:
|
|
119
|
-
typeof onlyChildProps.positive !== 'undefined'
|
|
120
|
-
? onlyChildProps.positive
|
|
121
|
-
: positive,
|
|
122
|
-
});
|
|
123
|
-
})}
|
|
124
|
-
{(caption || error || positive) && (
|
|
125
|
-
<Caption
|
|
126
|
-
data-baseweb="form-control-caption"
|
|
127
|
-
id={this.state.captionId}
|
|
98
|
+
<UIDConsumer>
|
|
99
|
+
{captionId => (
|
|
100
|
+
<ControlContainer
|
|
101
|
+
data-baseweb="form-control-container"
|
|
128
102
|
{...sharedProps}
|
|
129
|
-
{...getOverrideProps(
|
|
103
|
+
{...getOverrideProps(ControlContainerOverride)}
|
|
130
104
|
>
|
|
131
|
-
{
|
|
132
|
-
|
|
105
|
+
{React.Children.map(children, (child, index) => {
|
|
106
|
+
if (!child) return;
|
|
107
|
+
|
|
108
|
+
const key = child.key || String(index);
|
|
109
|
+
return React.cloneElement(child, {
|
|
110
|
+
key,
|
|
111
|
+
'aria-errormessage': error ? captionId : null,
|
|
112
|
+
'aria-describedby': caption || positive ? captionId : null,
|
|
113
|
+
disabled: onlyChildProps.disabled || disabled,
|
|
114
|
+
error:
|
|
115
|
+
typeof onlyChildProps.error !== 'undefined'
|
|
116
|
+
? onlyChildProps.error
|
|
117
|
+
: error,
|
|
118
|
+
positive:
|
|
119
|
+
typeof onlyChildProps.positive !== 'undefined'
|
|
120
|
+
? onlyChildProps.positive
|
|
121
|
+
: positive,
|
|
122
|
+
});
|
|
123
|
+
})}
|
|
124
|
+
{(caption || error || positive) && (
|
|
125
|
+
<Caption
|
|
126
|
+
data-baseweb="form-control-caption"
|
|
127
|
+
id={captionId}
|
|
128
|
+
{...sharedProps}
|
|
129
|
+
{...getOverrideProps(CaptionOverride)}
|
|
130
|
+
>
|
|
131
|
+
{hint}
|
|
132
|
+
</Caption>
|
|
133
|
+
)}
|
|
134
|
+
</ControlContainer>
|
|
133
135
|
)}
|
|
134
|
-
</
|
|
136
|
+
</UIDConsumer>
|
|
135
137
|
</React.Fragment>
|
|
136
138
|
);
|
|
137
139
|
}
|
package/helper/helper.js
CHANGED
|
@@ -49,12 +49,16 @@ function Helper(props) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}, overrides);
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
return (
|
|
53
|
+
/*#__PURE__*/
|
|
54
|
+
//$FlowFixMe
|
|
55
|
+
React.createElement(_index.Popover, _extends({
|
|
56
|
+
"data-baseweb": "helper"
|
|
57
|
+
}, restProps, {
|
|
58
|
+
placement: placement,
|
|
59
|
+
overrides: mergedOverrides
|
|
60
|
+
}))
|
|
61
|
+
);
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
Helper.defaultProps = _objectSpread(_objectSpread({}, _index.Popover.defaultProps), {}, {
|
package/helper/helper.js.flow
CHANGED
package/helpers/base-provider.js
CHANGED
|
@@ -9,6 +9,8 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
+
var _reactUid = require("react-uid");
|
|
13
|
+
|
|
12
14
|
var _index = require("../layer/index.js");
|
|
13
15
|
|
|
14
16
|
var _index2 = require("../styles/index.js");
|
|
@@ -31,9 +33,11 @@ var BaseProvider = function BaseProvider(props) {
|
|
|
31
33
|
return /*#__PURE__*/React.createElement(_index.LayersManager, {
|
|
32
34
|
zIndex: zIndex,
|
|
33
35
|
overrides: overrides
|
|
36
|
+
}, /*#__PURE__*/React.createElement(_reactUid.UIDReset, {
|
|
37
|
+
prefix: "bui"
|
|
34
38
|
}, /*#__PURE__*/React.createElement(_index2.ThemeProvider, {
|
|
35
39
|
theme: theme
|
|
36
|
-
}, children));
|
|
40
|
+
}, children)));
|
|
37
41
|
};
|
|
38
42
|
|
|
39
43
|
var _default = BaseProvider;
|
|
@@ -6,6 +6,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
6
6
|
*/
|
|
7
7
|
// @flow
|
|
8
8
|
import * as React from 'react';
|
|
9
|
+
import {UIDReset} from 'react-uid';
|
|
9
10
|
import {LayersManager} from '../layer/index.js';
|
|
10
11
|
import {ThemeProvider} from '../styles/index.js';
|
|
11
12
|
import type {BaseProviderPropsT} from './types.js';
|
|
@@ -14,7 +15,9 @@ const BaseProvider = (props: BaseProviderPropsT) => {
|
|
|
14
15
|
const {children, overrides, theme, zIndex} = props;
|
|
15
16
|
return (
|
|
16
17
|
<LayersManager zIndex={zIndex} overrides={overrides}>
|
|
17
|
-
<
|
|
18
|
+
<UIDReset prefix="bui">
|
|
19
|
+
<ThemeProvider theme={theme}>{children}</ThemeProvider>
|
|
20
|
+
</UIDReset>
|
|
18
21
|
</LayersManager>
|
|
19
22
|
);
|
|
20
23
|
};
|
package/index.d.ts
CHANGED
package/input/input.js
CHANGED
|
@@ -146,14 +146,14 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
146
146
|
}, sharedProps, rootProps, {
|
|
147
147
|
$adjoined: getAdjoinedProp(startEnhancer, endEnhancer),
|
|
148
148
|
$hasIconTrailing: this.props.clearable || this.props.type == 'password'
|
|
149
|
-
}), startEnhancer && /*#__PURE__*/React.createElement(StartEnhancer, _extends({}, sharedProps, startEnhancerProps, {
|
|
149
|
+
}), isEnhancer(startEnhancer) && /*#__PURE__*/React.createElement(StartEnhancer, _extends({}, sharedProps, startEnhancerProps, {
|
|
150
150
|
$position: _constants.ENHANCER_POSITION.start
|
|
151
151
|
}), typeof startEnhancer === 'function' ? startEnhancer(sharedProps) : startEnhancer), /*#__PURE__*/React.createElement(_baseInput.default, _extends({}, restProps, {
|
|
152
152
|
overrides: restOverrides,
|
|
153
153
|
adjoined: getAdjoinedProp(startEnhancer, endEnhancer),
|
|
154
154
|
onFocus: this.onFocus,
|
|
155
155
|
onBlur: this.onBlur
|
|
156
|
-
})), endEnhancer && /*#__PURE__*/React.createElement(EndEnhancer, _extends({}, sharedProps, endEnhancerProps, {
|
|
156
|
+
})), isEnhancer(endEnhancer) && /*#__PURE__*/React.createElement(EndEnhancer, _extends({}, sharedProps, endEnhancerProps, {
|
|
157
157
|
$position: _constants.ENHANCER_POSITION.end
|
|
158
158
|
}), typeof endEnhancer === 'function' ? endEnhancer(sharedProps) : endEnhancer));
|
|
159
159
|
}
|
|
@@ -179,16 +179,20 @@ _defineProperty(Input, "defaultProps", {
|
|
|
179
179
|
});
|
|
180
180
|
|
|
181
181
|
function getAdjoinedProp(startEnhancer, endEnhancer) {
|
|
182
|
-
if (startEnhancer && endEnhancer) {
|
|
182
|
+
if (isEnhancer(startEnhancer) && isEnhancer(endEnhancer)) {
|
|
183
183
|
return _constants.ADJOINED.both;
|
|
184
|
-
} else if (startEnhancer) {
|
|
184
|
+
} else if (isEnhancer(startEnhancer)) {
|
|
185
185
|
return _constants.ADJOINED.left;
|
|
186
|
-
} else if (endEnhancer) {
|
|
186
|
+
} else if (isEnhancer(endEnhancer)) {
|
|
187
187
|
return _constants.ADJOINED.right;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
return _constants.ADJOINED.none;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
function isEnhancer(enhancer) {
|
|
194
|
+
return Boolean(enhancer || enhancer === 0);
|
|
195
|
+
}
|
|
196
|
+
|
|
193
197
|
var _default = Input;
|
|
194
198
|
exports.default = _default;
|