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
|
@@ -18,7 +18,7 @@ import SearchIconComponent from '../icon/search.js';
|
|
|
18
18
|
import { LocaleContext } from '../locale/index.js';
|
|
19
19
|
import { Popover, PLACEMENT } from '../popover/index.js';
|
|
20
20
|
import { Spinner } from '../spinner/index.js';
|
|
21
|
-
import
|
|
21
|
+
import { UIDConsumer } from 'react-uid';
|
|
22
22
|
import AutosizeInput from './autosize-input.js';
|
|
23
23
|
import { TYPE, STATE_CHANGE_TYPE } from './constants.js';
|
|
24
24
|
import defaultProps from './default-props.js';
|
|
@@ -78,7 +78,6 @@ class Select extends React.Component {
|
|
|
78
78
|
// the select components can accept an array of options or an object where properties are optgroups
|
|
79
79
|
// and values are arrays of options. this class property is constructed and updated in a normalized
|
|
80
80
|
// shape where optgroup titles are stored on the option in the __optgroup field.
|
|
81
|
-
// id generated for the listbox. used by screenreaders to associate the input with the menu it controls
|
|
82
81
|
constructor(props) {
|
|
83
82
|
super(props);
|
|
84
83
|
|
|
@@ -98,8 +97,6 @@ class Select extends React.Component {
|
|
|
98
97
|
|
|
99
98
|
_defineProperty(this, "options", []);
|
|
100
99
|
|
|
101
|
-
_defineProperty(this, "listboxId", getBuiId());
|
|
102
|
-
|
|
103
100
|
_defineProperty(this, "state", {
|
|
104
101
|
activeDescendant: null,
|
|
105
102
|
inputValue: '',
|
|
@@ -148,16 +145,17 @@ class Select extends React.Component {
|
|
|
148
145
|
if (!this.state.isFocused) {
|
|
149
146
|
this.openAfterFocus = this.props.openOnClick;
|
|
150
147
|
this.focus();
|
|
151
|
-
return;
|
|
152
148
|
}
|
|
153
149
|
|
|
154
150
|
if (!this.state.isOpen) {
|
|
155
151
|
this.setState({
|
|
156
152
|
isOpen: true,
|
|
153
|
+
isFocused: true,
|
|
157
154
|
isPseudoFocused: false
|
|
158
155
|
});
|
|
159
|
-
return;
|
|
160
156
|
}
|
|
157
|
+
|
|
158
|
+
return;
|
|
161
159
|
} // Ensures that interactive elements within the Select component do not trigger the outer click
|
|
162
160
|
// handler. For example, after an option is selected clicks on the 'clear' icon call here. We
|
|
163
161
|
// should ignore those events. This comes after case where click is on input element, so that
|
|
@@ -172,9 +170,19 @@ class Select extends React.Component {
|
|
|
172
170
|
|
|
173
171
|
if (!this.props.searchable) {
|
|
174
172
|
this.focus();
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
|
|
174
|
+
if (this.state.isOpen) {
|
|
175
|
+
this.setState({
|
|
176
|
+
isOpen: false,
|
|
177
|
+
isFocused: false
|
|
178
|
+
});
|
|
179
|
+
} else {
|
|
180
|
+
this.setState({
|
|
181
|
+
isOpen: true,
|
|
182
|
+
isFocused: true
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
178
186
|
return;
|
|
179
187
|
} // Cases below only apply to searchable Select component.
|
|
180
188
|
|
|
@@ -693,7 +701,7 @@ class Select extends React.Component {
|
|
|
693
701
|
}
|
|
694
702
|
}
|
|
695
703
|
|
|
696
|
-
renderInput() {
|
|
704
|
+
renderInput(listboxId) {
|
|
697
705
|
const {
|
|
698
706
|
overrides = {}
|
|
699
707
|
} = this.props;
|
|
@@ -714,25 +722,29 @@ class Select extends React.Component {
|
|
|
714
722
|
"aria-disabled": this.props.disabled,
|
|
715
723
|
"aria-label": label,
|
|
716
724
|
"aria-labelledby": this.props['aria-labelledby'],
|
|
717
|
-
"aria-owns": this.state.isOpen ?
|
|
725
|
+
"aria-owns": this.state.isOpen ? listboxId : null,
|
|
718
726
|
"aria-required": this.props.required || null,
|
|
719
727
|
onFocus: this.handleInputFocus,
|
|
720
|
-
ref: this.handleInputRef,
|
|
721
728
|
tabIndex: 0
|
|
722
729
|
}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement("input", {
|
|
723
|
-
"aria-hidden":
|
|
730
|
+
"aria-hidden": true,
|
|
724
731
|
id: this.props.id || null,
|
|
725
|
-
|
|
732
|
+
ref: this.handleInputRef,
|
|
726
733
|
style: {
|
|
727
|
-
|
|
728
|
-
|
|
734
|
+
opacity: 0,
|
|
735
|
+
width: 0,
|
|
736
|
+
overflow: 'hidden',
|
|
737
|
+
border: 'none',
|
|
738
|
+
padding: 0
|
|
739
|
+
},
|
|
740
|
+
tabIndex: -1
|
|
729
741
|
}));
|
|
730
742
|
}
|
|
731
743
|
|
|
732
744
|
return /*#__PURE__*/React.createElement(InputContainer, _extends({}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement(AutosizeInput, _extends({
|
|
733
745
|
"aria-activedescendant": this.state.activeDescendant,
|
|
734
746
|
"aria-autocomplete": "list",
|
|
735
|
-
"aria-controls": this.state.isOpen ?
|
|
747
|
+
"aria-controls": this.state.isOpen ? listboxId : null,
|
|
736
748
|
"aria-describedby": this.props['aria-describedby'],
|
|
737
749
|
"aria-errormessage": this.props['aria-errormessage'],
|
|
738
750
|
"aria-disabled": this.props.disabled || null,
|
|
@@ -833,7 +845,7 @@ class Select extends React.Component {
|
|
|
833
845
|
}
|
|
834
846
|
|
|
835
847
|
filterOptions(excludeOptions) {
|
|
836
|
-
const filterValue = this.state.inputValue; // apply filter function
|
|
848
|
+
const filterValue = this.state.inputValue.trim(); // apply filter function
|
|
837
849
|
|
|
838
850
|
if (this.props.filterOptions) {
|
|
839
851
|
this.options = this.props.filterOptions(this.options, filterValue, excludeOptions, {
|
|
@@ -934,13 +946,13 @@ class Select extends React.Component {
|
|
|
934
946
|
}
|
|
935
947
|
}
|
|
936
948
|
|
|
937
|
-
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, locale => /*#__PURE__*/React.createElement(PopoverOverride // Popover does not provide ability to forward refs through, and if we were to simply
|
|
949
|
+
return /*#__PURE__*/React.createElement(UIDConsumer, null, listboxId => /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, locale => /*#__PURE__*/React.createElement(PopoverOverride // Popover does not provide ability to forward refs through, and if we were to simply
|
|
938
950
|
// apply the ref to the Root component below it would be overwritten before the popover
|
|
939
951
|
// renders it. Using this strategy, we will get a ref to the popover, then reuse its
|
|
940
952
|
// anchorRef so we can check if clicks are on the select component or not.
|
|
941
953
|
// eslint-disable-next-line flowtype/no-weak-types
|
|
942
954
|
, _extends({
|
|
943
|
-
|
|
955
|
+
innerRef: ref => {
|
|
944
956
|
if (!ref) return;
|
|
945
957
|
this.anchor = ref.anchorRef;
|
|
946
958
|
},
|
|
@@ -954,7 +966,7 @@ class Select extends React.Component {
|
|
|
954
966
|
error: this.props.error,
|
|
955
967
|
positive: this.props.positive,
|
|
956
968
|
getOptionLabel: this.props.getOptionLabel || this.getOptionLabel.bind(this, locale),
|
|
957
|
-
id:
|
|
969
|
+
id: listboxId,
|
|
958
970
|
isLoading: this.props.isLoading,
|
|
959
971
|
labelKey: this.props.labelKey,
|
|
960
972
|
maxDropdownHeight: this.props.maxDropdownHeight,
|
|
@@ -987,7 +999,7 @@ class Select extends React.Component {
|
|
|
987
999
|
onTouchEnd: this.handleTouchEnd,
|
|
988
1000
|
onTouchMove: this.handleTouchMove,
|
|
989
1001
|
onTouchStart: this.handleTouchStart
|
|
990
|
-
}, sharedProps, controlContainerProps), type === TYPE.search ? this.renderSearch() : null, /*#__PURE__*/React.createElement(ValueContainer, _extends({}, sharedProps, valueContainerProps), this.renderValue(valueArray, isOpen, locale), this.renderInput(), this.shouldShowPlaceholder() ? /*#__PURE__*/React.createElement(Placeholder, _extends({}, sharedProps, placeholderProps), typeof this.props.placeholder !== 'undefined' ? this.props.placeholder : locale.select.placeholder) : null), /*#__PURE__*/React.createElement(IconsContainer, _extends({}, sharedProps, iconsContainerProps), this.renderLoading(), this.renderClear(), type === TYPE.select ? this.renderArrow() : null)))));
|
|
1002
|
+
}, sharedProps, controlContainerProps), type === TYPE.search ? this.renderSearch() : null, /*#__PURE__*/React.createElement(ValueContainer, _extends({}, sharedProps, valueContainerProps), this.renderValue(valueArray, isOpen, locale), this.renderInput(listboxId), this.shouldShowPlaceholder() ? /*#__PURE__*/React.createElement(Placeholder, _extends({}, sharedProps, placeholderProps), typeof this.props.placeholder !== 'undefined' ? this.props.placeholder : locale.select.placeholder) : null), /*#__PURE__*/React.createElement(IconsContainer, _extends({}, sharedProps, iconsContainerProps), this.renderLoading(), this.renderClear(), type === TYPE.select ? this.renderArrow() : null))))));
|
|
991
1003
|
}
|
|
992
1004
|
|
|
993
1005
|
}
|
|
@@ -45,7 +45,7 @@ export const StyledTable = styled('table', ({
|
|
|
45
45
|
$width
|
|
46
46
|
}) => {
|
|
47
47
|
return {
|
|
48
|
-
|
|
48
|
+
borderSpacing: '0',
|
|
49
49
|
boxSizing: 'border-box',
|
|
50
50
|
minWidth: '100%',
|
|
51
51
|
width: $width || null
|
|
@@ -156,16 +156,9 @@ export const StyledTableBody = styled('tbody', ({
|
|
|
156
156
|
});
|
|
157
157
|
StyledTableBody.displayName = "StyledTableBody";
|
|
158
158
|
export const StyledTableBodyRow = styled('tr', ({
|
|
159
|
-
$theme
|
|
160
|
-
$divider
|
|
159
|
+
$theme
|
|
161
160
|
}) => {
|
|
162
|
-
const borderHorizontal = $divider === undefined || $divider === DIVIDER.horizontal || $divider === DIVIDER.grid;
|
|
163
161
|
return {
|
|
164
|
-
':not(:last-child)': {
|
|
165
|
-
borderBottomColor: borderHorizontal ? $theme.borders.border300.borderColor : null,
|
|
166
|
-
borderBottomStyle: borderHorizontal ? $theme.borders.border300.borderStyle : null,
|
|
167
|
-
borderBottomWidth: borderHorizontal ? $theme.borders.border300.borderWidth : null
|
|
168
|
-
},
|
|
169
162
|
':hover': {
|
|
170
163
|
backgroundColor: $theme.colors.tableStripedBackground
|
|
171
164
|
}
|
|
@@ -176,10 +169,12 @@ export const StyledTableBodyCell = styled('td', ({
|
|
|
176
169
|
$theme,
|
|
177
170
|
$size,
|
|
178
171
|
$divider,
|
|
179
|
-
$isNumeric
|
|
172
|
+
$isNumeric,
|
|
173
|
+
$isLastRow
|
|
180
174
|
}) => {
|
|
181
175
|
const borderDir = $theme.direction === 'rtl' ? 'Left' : 'Right';
|
|
182
176
|
const borderVertical = $divider === DIVIDER.vertical || $divider === DIVIDER.grid;
|
|
177
|
+
const borderHorizontal = $divider === undefined || $divider === DIVIDER.horizontal || $divider === DIVIDER.grid;
|
|
183
178
|
const padding = sizeToCellPadding($theme, $size);
|
|
184
179
|
return { ...$theme.typography.font200,
|
|
185
180
|
paddingTop: padding,
|
|
@@ -189,6 +184,9 @@ export const StyledTableBodyCell = styled('td', ({
|
|
|
189
184
|
color: $theme.colors.contentPrimary,
|
|
190
185
|
textAlign: $isNumeric ? 'right' : null,
|
|
191
186
|
verticalAlign: 'top',
|
|
187
|
+
borderBottomColor: !$isLastRow && borderHorizontal ? $theme.borders.border300.borderColor : null,
|
|
188
|
+
borderBottomStyle: !$isLastRow && borderHorizontal ? $theme.borders.border300.borderStyle : null,
|
|
189
|
+
borderBottomWidth: !$isLastRow && borderHorizontal ? $theme.borders.border300.borderWidth : null,
|
|
192
190
|
':not(:last-child)': {
|
|
193
191
|
[`border${borderDir}Color`]: borderVertical ? $theme.borders.border300.borderColor : null,
|
|
194
192
|
[`border${borderDir}Style`]: borderVertical ? $theme.borders.border300.borderStyle : null,
|
|
@@ -131,7 +131,7 @@ export default class TableBuilder extends React.Component {
|
|
|
131
131
|
}, tableHeadCellSortableProps, colTableHeadCellSortableProps), col.header, sortIcon);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
function renderCell(col, colIndex, row, rowIndex) {
|
|
134
|
+
function renderCell(col, colIndex, row, rowIndex, lastRowindex) {
|
|
135
135
|
const colOverrides = col.overrides || {};
|
|
136
136
|
const [ColTableBodyCell, colTableBodyCellProps] = getOverrides(colOverrides.TableBodyCell, TableBodyCell);
|
|
137
137
|
return /*#__PURE__*/React.createElement(ColTableBodyCell, _extends({
|
|
@@ -142,6 +142,7 @@ export default class TableBuilder extends React.Component {
|
|
|
142
142
|
$row: row,
|
|
143
143
|
$rowIndex: rowIndex,
|
|
144
144
|
$isNumeric: col.numeric,
|
|
145
|
+
$isLastRow: rowIndex === lastRowindex,
|
|
145
146
|
$size: size
|
|
146
147
|
}, tableBodyCellProps, colTableBodyCellProps), col.children(row, rowIndex));
|
|
147
148
|
}
|
|
@@ -165,7 +166,7 @@ export default class TableBuilder extends React.Component {
|
|
|
165
166
|
$divider: divider,
|
|
166
167
|
$row: row,
|
|
167
168
|
$rowIndex: rowIndex
|
|
168
|
-
}, tableBodyRowProps), columns.map((col, colIndex) => renderCell(col, colIndex, row, rowIndex)))))));
|
|
169
|
+
}, tableBodyRowProps), columns.map((col, colIndex) => renderCell(col, colIndex, row, rowIndex, data.length - 1)))))));
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
}
|
package/es/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';
|
|
@@ -276,11 +276,9 @@ export const Action = styled('span', props => {
|
|
|
276
276
|
transitionDuration: 'background-color',
|
|
277
277
|
transitionTimingFunction: $theme.animation.easeOutCurve
|
|
278
278
|
};
|
|
279
|
-
});
|
|
280
|
-
Action.displayName = "Action";
|
|
281
|
-
export const ActionIcon = styled('svg', {}); // $FlowFixMe https://github.com/facebook/flow/issues/7745
|
|
279
|
+
}); // $FlowFixMe https://github.com/facebook/flow/issues/7745
|
|
282
280
|
|
|
283
|
-
|
|
281
|
+
Action.displayName = "Action";
|
|
284
282
|
export const StartEnhancerContainer = styled('div', ({
|
|
285
283
|
$theme,
|
|
286
284
|
$size = SIZE.small
|
package/es/tag/tag.js
CHANGED
|
@@ -8,10 +8,17 @@ LICENSE file in the root directory of this source tree.
|
|
|
8
8
|
*/
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import { getOverrides } from '../helpers/overrides.js';
|
|
11
|
-
import { Action as StyledAction, Root as StyledRoot,
|
|
11
|
+
import { Action as StyledAction, Root as StyledRoot, StartEnhancerContainer as StyledStartEnhancerContainer, Text as StyledText } from './styled-components.js';
|
|
12
12
|
import { KIND, VARIANT, SIZE } from './constants.js';
|
|
13
13
|
import { getTextFromChildren } from './utils.js';
|
|
14
|
-
import
|
|
14
|
+
import DeleteIcon from '../icon/delete.js';
|
|
15
|
+
import { isFocusVisible, forkFocus, forkBlur } from '../utils/focusVisible.js'; // Previously, Tag used a hardcoded SVG as its 'close' icon. Replacing it with
|
|
16
|
+
// Delete requires modifying Delete's viewbox to prevent visual regressions.
|
|
17
|
+
|
|
18
|
+
const ModifiedViewBoxDeleteIcon = props => /*#__PURE__*/React.createElement(DeleteIcon, _extends({
|
|
19
|
+
viewBox: "5 5 13.186 13.186"
|
|
20
|
+
}, props));
|
|
21
|
+
|
|
15
22
|
const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
16
23
|
const {
|
|
17
24
|
children,
|
|
@@ -68,7 +75,7 @@ const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
68
75
|
|
|
69
76
|
const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
|
|
70
77
|
const [Action, actionProps] = getOverrides(overrides.Action, StyledAction);
|
|
71
|
-
const [ActionIcon, actionIconProps] = getOverrides(overrides.ActionIcon,
|
|
78
|
+
const [ActionIcon, actionIconProps] = getOverrides(overrides.ActionIcon, ModifiedViewBoxDeleteIcon);
|
|
72
79
|
const [StartEnhancerContainer, startEnhancerContainerProps] = getOverrides(overrides.StartEnhancerContainer, StyledStartEnhancerContainer);
|
|
73
80
|
const [Text, textProps] = getOverrides(overrides.Text, StyledText);
|
|
74
81
|
const clickable = typeof onClick === 'function';
|
|
@@ -98,9 +105,9 @@ const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
98
105
|
const titleText = title || getTextFromChildren(children);
|
|
99
106
|
const isButton = (clickable || closeable) && !disabled;
|
|
100
107
|
const actionSize = {
|
|
101
|
-
[SIZE.small]:
|
|
102
|
-
[SIZE.medium]:
|
|
103
|
-
[SIZE.large]:
|
|
108
|
+
[SIZE.small]: 12,
|
|
109
|
+
[SIZE.medium]: 16,
|
|
110
|
+
[SIZE.large]: 20
|
|
104
111
|
}[size]; // Capitalize for JSX
|
|
105
112
|
|
|
106
113
|
const StartEnhancer = startEnhancer;
|
|
@@ -115,21 +122,14 @@ const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
115
122
|
}, rootHandlers, sharedProps, rootProps, {
|
|
116
123
|
onFocus: forkFocus(rootProps, handleFocus),
|
|
117
124
|
onBlur: forkBlur(rootProps, handleBlur)
|
|
118
|
-
}), StartEnhancer && /*#__PURE__*/React.createElement(StartEnhancerContainer, startEnhancerContainerProps, /*#__PURE__*/React.createElement(StartEnhancer, null)), /*#__PURE__*/React.createElement(Text, _extends({
|
|
125
|
+
}), StartEnhancer && StartEnhancer !== 0 && /*#__PURE__*/React.createElement(StartEnhancerContainer, startEnhancerContainerProps, /*#__PURE__*/React.createElement(StartEnhancer, null)), /*#__PURE__*/React.createElement(Text, _extends({
|
|
119
126
|
title: titleText
|
|
120
127
|
}, textProps), children), closeable ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
121
128
|
"aria-hidden": true,
|
|
122
129
|
role: "presentation"
|
|
123
130
|
}, actionHandlers, sharedProps, actionProps), /*#__PURE__*/React.createElement(ActionIcon, _extends({
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
viewBox: "0 0 24 24",
|
|
127
|
-
fill: "none",
|
|
128
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
129
|
-
}, actionIconProps), /*#__PURE__*/React.createElement("path", {
|
|
130
|
-
fill: "currentColor",
|
|
131
|
-
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"
|
|
132
|
-
}))) : null);
|
|
131
|
+
size: actionSize
|
|
132
|
+
}, actionIconProps))) : null);
|
|
133
133
|
});
|
|
134
134
|
Tag.displayName = 'Tag';
|
|
135
135
|
export default Tag;
|
package/es/textarea/textarea.js
CHANGED
|
@@ -17,12 +17,12 @@ foundation = colorTokens) => {
|
|
|
17
17
|
backgroundInversePrimary: foundation.primaryA,
|
|
18
18
|
backgroundInverseSecondary: colors.gray300,
|
|
19
19
|
// Content
|
|
20
|
-
contentPrimary:
|
|
21
|
-
contentSecondary: colors.
|
|
22
|
-
contentTertiary: colors.
|
|
23
|
-
contentInversePrimary:
|
|
24
|
-
contentInverseSecondary: colors.
|
|
25
|
-
contentInverseTertiary: colors.
|
|
20
|
+
contentPrimary: colors.white,
|
|
21
|
+
contentSecondary: colors.gray300,
|
|
22
|
+
contentTertiary: colors.gray400,
|
|
23
|
+
contentInversePrimary: colors.black,
|
|
24
|
+
contentInverseSecondary: colors.gray700,
|
|
25
|
+
contentInverseTertiary: colors.gray600,
|
|
26
26
|
// Border
|
|
27
27
|
borderOpaque: colors.gray700,
|
|
28
28
|
borderTransparent: hexToRgba(foundation.primaryA, '0.08'),
|
|
@@ -39,7 +39,7 @@ foundation = colorTokens) => {
|
|
|
39
39
|
backgroundAccent: foundation.accent,
|
|
40
40
|
backgroundNegative: foundation.negative,
|
|
41
41
|
backgroundWarning: foundation.warning,
|
|
42
|
-
backgroundPositive:
|
|
42
|
+
backgroundPositive: colors.green500,
|
|
43
43
|
backgroundLightAccent: colors.blue700,
|
|
44
44
|
backgroundLightPositive: colors.green700,
|
|
45
45
|
backgroundLightNegative: colors.red700,
|
|
@@ -60,7 +60,17 @@ foundation = colorTokens) => {
|
|
|
60
60
|
borderAccentLight: colors.blue500,
|
|
61
61
|
borderNegative: colors.red500,
|
|
62
62
|
borderWarning: colors.yellow500,
|
|
63
|
-
borderPositive: colors.green500
|
|
63
|
+
borderPositive: colors.green500,
|
|
64
|
+
// Programs
|
|
65
|
+
safety: colors.blue400,
|
|
66
|
+
eatsGreen400: colors.green400,
|
|
67
|
+
freightBlue400: colors.cobalt400,
|
|
68
|
+
jumpRed400: colors.red400,
|
|
69
|
+
rewardsTier1: colors.blue400,
|
|
70
|
+
rewardsTier2: colors.yellow400,
|
|
71
|
+
rewardsTier3: colors.platinum400,
|
|
72
|
+
rewardsTier4: colors.gray200,
|
|
73
|
+
membership: colors.yellow600
|
|
64
74
|
};
|
|
65
75
|
return { ...core,
|
|
66
76
|
...coreExtensions
|
|
@@ -39,7 +39,7 @@ foundation = colorTokens) => {
|
|
|
39
39
|
backgroundAccent: foundation.accent,
|
|
40
40
|
backgroundNegative: foundation.negative,
|
|
41
41
|
backgroundWarning: foundation.warning,
|
|
42
|
-
backgroundPositive:
|
|
42
|
+
backgroundPositive: colors.green400,
|
|
43
43
|
backgroundLightAccent: colors.blue50,
|
|
44
44
|
backgroundLightNegative: colors.red50,
|
|
45
45
|
backgroundLightWarning: colors.yellow50,
|
|
@@ -52,15 +52,25 @@ foundation = colorTokens) => {
|
|
|
52
52
|
contentOnColor: colors.white,
|
|
53
53
|
contentOnColorInverse: colors.black,
|
|
54
54
|
contentNegative: foundation.negative,
|
|
55
|
-
contentWarning: colors.
|
|
56
|
-
contentPositive:
|
|
55
|
+
contentWarning: colors.yellow600,
|
|
56
|
+
contentPositive: colors.green400,
|
|
57
57
|
// Border
|
|
58
58
|
borderStateDisabled: colors.gray50,
|
|
59
59
|
borderAccent: colors.blue400,
|
|
60
60
|
borderAccentLight: colors.blue200,
|
|
61
61
|
borderNegative: colors.red200,
|
|
62
62
|
borderWarning: colors.yellow200,
|
|
63
|
-
borderPositive: colors.green200
|
|
63
|
+
borderPositive: colors.green200,
|
|
64
|
+
// Programs
|
|
65
|
+
safety: colors.blue400,
|
|
66
|
+
eatsGreen400: colors.green400,
|
|
67
|
+
freightBlue400: colors.cobalt400,
|
|
68
|
+
jumpRed400: colors.red400,
|
|
69
|
+
rewardsTier1: colors.blue400,
|
|
70
|
+
rewardsTier2: colors.yellow400,
|
|
71
|
+
rewardsTier3: colors.platinum400,
|
|
72
|
+
rewardsTier4: colors.black,
|
|
73
|
+
membership: colors.yellow600
|
|
64
74
|
};
|
|
65
75
|
return { ...core,
|
|
66
76
|
...coreExtensions
|
package/es/tokens/colors.js
CHANGED
|
@@ -11,7 +11,7 @@ const 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 @@ const 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',
|
|
@@ -179,12 +179,14 @@ export default function MobileMenu(props) {
|
|
|
179
179
|
boxShadow: 'none'
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
ListItem: function
|
|
183
|
-
return /*#__PURE__*/React.createElement(MobileNavMenuItem, _extends({
|
|
182
|
+
ListItem: /*#__PURE__*/React.forwardRef(function (listItemProps, ref) {
|
|
183
|
+
return /*#__PURE__*/React.createElement(MobileNavMenuItem, _extends({
|
|
184
|
+
ref: ref
|
|
185
|
+
}, listItemProps, {
|
|
184
186
|
mapItemToNode: mapItemToNode,
|
|
185
187
|
overrides: overrides
|
|
186
188
|
}));
|
|
187
|
-
}
|
|
189
|
+
})
|
|
188
190
|
}, // $FlowFixMe
|
|
189
191
|
menuProps.overrides);
|
|
190
192
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SideMenuButton, _extends({
|
|
@@ -111,11 +111,13 @@ export default function UserMenuComponent(props) {
|
|
|
111
111
|
width: MENU_ITEM_WIDTH
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
|
-
ListItem: function
|
|
115
|
-
return /*#__PURE__*/React.createElement(UserMenuListItem, _extends({
|
|
114
|
+
ListItem: /*#__PURE__*/React.forwardRef(function (listItemProps, ref) {
|
|
115
|
+
return /*#__PURE__*/React.createElement(UserMenuListItem, _extends({
|
|
116
|
+
ref: ref
|
|
117
|
+
}, listItemProps, {
|
|
116
118
|
mapItemToNode: props.mapItemToNode
|
|
117
119
|
}));
|
|
118
|
-
}
|
|
120
|
+
})
|
|
119
121
|
}, // $FlowFixMe
|
|
120
122
|
userMenuProps.overrides);
|
|
121
123
|
return /*#__PURE__*/React.createElement(StatefulPopover, {
|
package/esm/combobox/combobox.js
CHANGED
|
@@ -27,7 +27,7 @@ import { Input, SIZE } from '../input/index.js';
|
|
|
27
27
|
import { scrollItemIntoView } from '../menu/utils.js';
|
|
28
28
|
import { getOverrides } from '../helpers/overrides.js';
|
|
29
29
|
import { Popover, PLACEMENT } from '../popover/index.js';
|
|
30
|
-
import
|
|
30
|
+
import { useUIDSeed } from 'react-uid';
|
|
31
31
|
import { StyledRoot, StyledInputContainer, StyledListBox, StyledListItem } from './styled-components.js';
|
|
32
32
|
var ENTER = 13;
|
|
33
33
|
var ESCAPE = 27;
|
|
@@ -79,12 +79,9 @@ function Combobox(props) {
|
|
|
79
79
|
var inputRef = React.useRef(null);
|
|
80
80
|
var listboxRef = React.useRef(null);
|
|
81
81
|
var selectedOptionRef = React.useRef(null);
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var listboxId = React.useMemo(function () {
|
|
86
|
-
return getBuiId();
|
|
87
|
-
}, []); // Handles case where an application wants to update the value in the input element
|
|
82
|
+
var seed = useUIDSeed();
|
|
83
|
+
var activeDescendantId = seed('descendant');
|
|
84
|
+
var listboxId = seed('listbox'); // Handles case where an application wants to update the value in the input element
|
|
88
85
|
// from outside of the combobox component.
|
|
89
86
|
|
|
90
87
|
React.useEffect(function () {
|
|
@@ -28,7 +28,7 @@ import { Filter as FilterIcon } from '../icon/index.js';
|
|
|
28
28
|
import { Input, SIZE as INPUT_SIZE } from '../input/index.js';
|
|
29
29
|
import { Popover, PLACEMENT } from '../popover/index.js';
|
|
30
30
|
import { useStyletron } from '../styles/index.js';
|
|
31
|
-
import
|
|
31
|
+
import { useUIDSeed } from 'react-uid';
|
|
32
32
|
import { COLUMNS } from './constants.js';
|
|
33
33
|
import { matchesQuery } from './text-search.js';
|
|
34
34
|
import { LocaleContext } from '../locale/index.js';
|
|
@@ -73,8 +73,9 @@ function Options(props) {
|
|
|
73
73
|
focusVisible = _React$useState2[0],
|
|
74
74
|
setFocusVisible = _React$useState2[1];
|
|
75
75
|
|
|
76
|
-
var
|
|
77
|
-
|
|
76
|
+
var seed = useUIDSeed();
|
|
77
|
+
var buiRef = React.useRef(props.columns.map(function (col) {
|
|
78
|
+
return seed(col);
|
|
78
79
|
}));
|
|
79
80
|
|
|
80
81
|
var handleFocus = function handleFocus(event) {
|
|
@@ -59,7 +59,7 @@ var HeaderCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
59
59
|
ref: ref,
|
|
60
60
|
role: "button",
|
|
61
61
|
tabIndex: "0",
|
|
62
|
-
className: css(_objectSpread(_objectSpread({}, theme.typography.
|
|
62
|
+
className: css(_objectSpread(_objectSpread({}, theme.typography.font350), {}, {
|
|
63
63
|
alignItems: 'center',
|
|
64
64
|
backgroundColor: backgroundColor,
|
|
65
65
|
boxSizing: 'border-box',
|
|
@@ -430,7 +430,8 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
430
430
|
onChange: _this.handleDateChange,
|
|
431
431
|
overrides: overrides,
|
|
432
432
|
value: _this.props.value,
|
|
433
|
-
peekNextMonth: _this.props.peekNextMonth
|
|
433
|
+
peekNextMonth: _this.props.peekNextMonth,
|
|
434
|
+
fixedHeight: _this.props.fixedHeight
|
|
434
435
|
})));
|
|
435
436
|
monthList.push( /*#__PURE__*/React.createElement("div", {
|
|
436
437
|
key: "month-component-".concat(i)
|
|
@@ -534,6 +535,10 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
|
534
535
|
}
|
|
535
536
|
}
|
|
536
537
|
}
|
|
538
|
+
|
|
539
|
+
if (_this.props.onQuickSelectChange) {
|
|
540
|
+
_this.props.onQuickSelectChange(params.option);
|
|
541
|
+
}
|
|
537
542
|
},
|
|
538
543
|
options: _this.props.quickSelectOptions || [{
|
|
539
544
|
id: locale.datepicker.pastWeek,
|
|
@@ -492,7 +492,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
|
|
|
492
492
|
InputWrapper = _getOverrides6[0],
|
|
493
493
|
inputWrapperProps = _getOverrides6[1];
|
|
494
494
|
|
|
495
|
-
var placeholder = this.props.placeholder ||
|
|
495
|
+
var placeholder = this.props.placeholder || this.props.placeholder === '' ? this.props.placeholder : this.props.range ? 'YYYY/MM/DD – YYYY/MM/DD' : 'YYYY/MM/DD';
|
|
496
496
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, function (locale) {
|
|
497
497
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PopoverComponent, _extends({
|
|
498
498
|
focusLock: false,
|
package/esm/datepicker/month.js
CHANGED
|
@@ -66,6 +66,7 @@ var defaultProps = {
|
|
|
66
66
|
peekNextMonth: false,
|
|
67
67
|
value: null
|
|
68
68
|
};
|
|
69
|
+
var CALENDAR_MAX_ROWS = 6;
|
|
69
70
|
|
|
70
71
|
var CalendarMonth = /*#__PURE__*/function (_React$Component) {
|
|
71
72
|
_inherits(CalendarMonth, _React$Component);
|
|
@@ -101,7 +102,7 @@ var CalendarMonth = /*#__PURE__*/function (_React$Component) {
|
|
|
101
102
|
var i = 0;
|
|
102
103
|
var isWithinMonth = true;
|
|
103
104
|
|
|
104
|
-
while (isWithinMonth) {
|
|
105
|
+
while (isWithinMonth || _this.props.fixedHeight && _this.props.peekNextMonth && i < CALENDAR_MAX_ROWS) {
|
|
105
106
|
weeks.push( /*#__PURE__*/React.createElement(Week, {
|
|
106
107
|
adapter: _this.props.adapter,
|
|
107
108
|
date: currentWeekStart,
|