baseui 11.0.0 → 11.0.1
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/data-table/data-table.js +9 -1
- package/data-table/data-table.js.flow +3 -0
- package/data-table/index.d.ts +7 -8
- package/data-table/stateful-data-table.js +2 -1
- package/data-table/stateful-data-table.js.flow +1 -0
- package/data-table/types.js.flow +8 -0
- package/es/data-table/data-table.js +5 -1
- package/es/data-table/stateful-data-table.js +2 -1
- package/es/form-control/styled-components.js +0 -1
- package/es/list/list-item.js +5 -1
- package/es/list/menu-adapter.js +4 -0
- package/es/select/select-component.js +16 -12
- package/es/select/styled-components.js +17 -13
- package/esm/data-table/data-table.js +9 -1
- package/esm/data-table/stateful-data-table.js +2 -1
- package/esm/form-control/styled-components.js +0 -1
- package/esm/list/list-item.js +5 -1
- package/esm/list/menu-adapter.js +4 -0
- package/esm/select/select-component.js +16 -12
- package/esm/select/styled-components.js +17 -10
- package/form-control/index.d.ts +9 -0
- package/form-control/styled-components.js +0 -1
- package/form-control/styled-components.js.flow +0 -1
- package/list/list-item.js +5 -1
- package/list/list-item.js.flow +4 -0
- package/list/menu-adapter.js +4 -0
- package/list/menu-adapter.js.flow +4 -0
- package/list/types.js.flow +4 -0
- package/package.json +2 -1
- package/select/select-component.js +19 -16
- package/select/select-component.js.flow +23 -11
- package/select/styled-components.js +19 -13
- package/select/styled-components.js.flow +13 -8
package/data-table/data-table.js
CHANGED
|
@@ -555,7 +555,8 @@ function DataTable(_ref2) {
|
|
|
555
555
|
sortIndex = _ref2.sortIndex,
|
|
556
556
|
sortDirection = _ref2.sortDirection,
|
|
557
557
|
_ref2$textQuery = _ref2.textQuery,
|
|
558
|
-
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery
|
|
558
|
+
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery,
|
|
559
|
+
controlRef = _ref2.controlRef;
|
|
559
560
|
|
|
560
561
|
var _useStyletron13 = (0, _index2.useStyletron)(),
|
|
561
562
|
_useStyletron14 = _slicedToArray(_useStyletron13, 2),
|
|
@@ -754,6 +755,13 @@ function DataTable(_ref2) {
|
|
|
754
755
|
|
|
755
756
|
return result;
|
|
756
757
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
758
|
+
React.useImperativeHandle(controlRef, function () {
|
|
759
|
+
return {
|
|
760
|
+
getRows: function getRows() {
|
|
761
|
+
return rows;
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
}, [rows]);
|
|
757
765
|
|
|
758
766
|
var _React$useState19 = React.useState(0),
|
|
759
767
|
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
@@ -658,6 +658,7 @@ export function DataTable({
|
|
|
658
658
|
sortIndex,
|
|
659
659
|
sortDirection,
|
|
660
660
|
textQuery = '',
|
|
661
|
+
controlRef,
|
|
661
662
|
}: DataTablePropsT) {
|
|
662
663
|
const [, theme] = useStyletron();
|
|
663
664
|
const locale = React.useContext(LocaleContext);
|
|
@@ -809,6 +810,8 @@ export function DataTable({
|
|
|
809
810
|
return result;
|
|
810
811
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
811
812
|
|
|
813
|
+
React.useImperativeHandle(controlRef, () => ({ getRows: () => rows }), [rows]);
|
|
814
|
+
|
|
812
815
|
const [browserScrollbarWidth, setBrowserScrollbarWidth] = React.useState(0);
|
|
813
816
|
const normalizedWidths = React.useMemo(() => {
|
|
814
817
|
const resizedWidths = measuredWidths.map((w, i) => Math.floor(w) + Math.floor(resizeDeltas[i]));
|
package/data-table/index.d.ts
CHANGED
|
@@ -34,10 +34,7 @@ export interface SORT_DIRECTIONS {
|
|
|
34
34
|
}
|
|
35
35
|
export const SORT_DIRECTIONS: SORT_DIRECTIONS;
|
|
36
36
|
|
|
37
|
-
export type SortDirectionsT =
|
|
38
|
-
| SORT_DIRECTIONS['ASC']
|
|
39
|
-
| SORT_DIRECTIONS['DESC']
|
|
40
|
-
| null;
|
|
37
|
+
export type SortDirectionsT = SORT_DIRECTIONS['ASC'] | SORT_DIRECTIONS['DESC'] | null;
|
|
41
38
|
export type ColumnT = any;
|
|
42
39
|
export type RowT = {
|
|
43
40
|
id: number | string;
|
|
@@ -54,12 +51,13 @@ export type BatchActionT = {
|
|
|
54
51
|
renderIcon?: any;
|
|
55
52
|
};
|
|
56
53
|
|
|
54
|
+
export interface ImperativeMethods {
|
|
55
|
+
getRows: () => RowT[];
|
|
56
|
+
}
|
|
57
|
+
|
|
57
58
|
export type RowActionT = {
|
|
58
59
|
label: string;
|
|
59
|
-
onClick: (params: {
|
|
60
|
-
event: React.MouseEvent<HTMLButtonElement>;
|
|
61
|
-
row: RowT;
|
|
62
|
-
}) => any;
|
|
60
|
+
onClick: (params: { event: React.MouseEvent<HTMLButtonElement>; row: RowT }) => any;
|
|
63
61
|
renderIcon: any;
|
|
64
62
|
};
|
|
65
63
|
|
|
@@ -69,4 +67,5 @@ export type Props = {
|
|
|
69
67
|
columns: ColumnT[];
|
|
70
68
|
onSelectionChange?: (rows: RowT[]) => any;
|
|
71
69
|
rows: RowT[];
|
|
70
|
+
controlRef?: React.Ref<ImperativeMethods>;
|
|
72
71
|
};
|
package/data-table/types.js.flow
CHANGED
|
@@ -87,6 +87,13 @@ export type RowActionT = {|
|
|
|
87
87
|
renderButton?: React.AbstractComponent<{||}>,
|
|
88
88
|
|};
|
|
89
89
|
|
|
90
|
+
type ImperativeMethodsT = {|
|
|
91
|
+
getRows: () => RowT[],
|
|
92
|
+
|};
|
|
93
|
+
export type ControlRefT = {
|
|
94
|
+
current: ImperativeMethodsT | null,
|
|
95
|
+
};
|
|
96
|
+
|
|
90
97
|
export type StatefulDataTablePropsT = {|
|
|
91
98
|
batchActions?: BatchActionT[],
|
|
92
99
|
columns: ColumnT<>[],
|
|
@@ -109,6 +116,7 @@ export type StatefulDataTablePropsT = {|
|
|
|
109
116
|
rowHeight?: number,
|
|
110
117
|
rowHighlightIndex?: number,
|
|
111
118
|
searchable?: boolean,
|
|
119
|
+
controlRef?: ControlRefT,
|
|
112
120
|
|};
|
|
113
121
|
|
|
114
122
|
export type DataTablePropsT = {|
|
|
@@ -459,7 +459,8 @@ export function DataTable({
|
|
|
459
459
|
selectedRowIds,
|
|
460
460
|
sortIndex,
|
|
461
461
|
sortDirection,
|
|
462
|
-
textQuery = ''
|
|
462
|
+
textQuery = '',
|
|
463
|
+
controlRef
|
|
463
464
|
}) {
|
|
464
465
|
const [, theme] = useStyletron();
|
|
465
466
|
const locale = React.useContext(LocaleContext);
|
|
@@ -596,6 +597,9 @@ export function DataTable({
|
|
|
596
597
|
|
|
597
598
|
return result;
|
|
598
599
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
600
|
+
React.useImperativeHandle(controlRef, () => ({
|
|
601
|
+
getRows: () => rows
|
|
602
|
+
}), [rows]);
|
|
599
603
|
const [browserScrollbarWidth, setBrowserScrollbarWidth] = React.useState(0);
|
|
600
604
|
const normalizedWidths = React.useMemo(() => {
|
|
601
605
|
const resizedWidths = measuredWidths.map((w, i) => Math.floor(w) + Math.floor(resizeDeltas[i]));
|
package/es/list/list-item.js
CHANGED
|
@@ -41,7 +41,11 @@ const ListItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
41
41
|
return /*#__PURE__*/React.createElement(Root // flowlint-next-line unclear-type:off
|
|
42
42
|
, _extends({
|
|
43
43
|
ref: ref,
|
|
44
|
-
$shape: props.shape || SHAPE.DEFAULT
|
|
44
|
+
$shape: props.shape || SHAPE.DEFAULT,
|
|
45
|
+
"aria-label": props['aria-label'],
|
|
46
|
+
"aria-selected": props['aria-selected'],
|
|
47
|
+
id: props.id,
|
|
48
|
+
role: props.role
|
|
45
49
|
}, rootProps), Artwork && /*#__PURE__*/React.createElement(ArtworkContainer, _extends({
|
|
46
50
|
$artworkSize: artworkSize,
|
|
47
51
|
$sublist: Boolean(props.sublist)
|
package/es/list/menu-adapter.js
CHANGED
|
@@ -11,9 +11,13 @@ const MenuAdapter = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
11
11
|
return /*#__PURE__*/React.createElement(ListItem, {
|
|
12
12
|
ref: ref,
|
|
13
13
|
sublist: props.sublist || props.$size === 'compact',
|
|
14
|
+
"aria-label": props['aria-label'],
|
|
15
|
+
"aria-selected": props['aria-selected'],
|
|
14
16
|
artwork: props.artwork,
|
|
15
17
|
artworkSize: props.artworkSize,
|
|
16
18
|
endEnhancer: props.endEnhancer,
|
|
19
|
+
id: props.id,
|
|
20
|
+
role: props.role,
|
|
17
21
|
overrides: mergeOverrides({
|
|
18
22
|
Root: {
|
|
19
23
|
props: {
|
|
@@ -17,13 +17,12 @@ import TriangleDownIcon from '../icon/triangle-down.js';
|
|
|
17
17
|
import SearchIconComponent from '../icon/search.js';
|
|
18
18
|
import { LocaleContext } from '../locale/index.js';
|
|
19
19
|
import { Popover, PLACEMENT } from '../popover/index.js';
|
|
20
|
-
import { Spinner } from '../spinner/index.js';
|
|
21
20
|
import { UIDConsumer } from 'react-uid';
|
|
22
21
|
import AutosizeInput from './autosize-input.js';
|
|
23
22
|
import { TYPE, STATE_CHANGE_TYPE } from './constants.js';
|
|
24
23
|
import defaultProps from './default-props.js';
|
|
25
24
|
import SelectDropdown from './dropdown.js';
|
|
26
|
-
import { StyledRoot, StyledControlContainer, StyledPlaceholder, StyledValueContainer, StyledInputContainer, StyledIconsContainer, StyledSelectArrow, StyledClearIcon,
|
|
25
|
+
import { StyledRoot, StyledControlContainer, StyledPlaceholder, StyledValueContainer, StyledInputContainer, StyledIconsContainer, StyledSelectArrow, StyledClearIcon, StyledSearchIconContainer, StyledLoadingIndicator } from './styled-components.js';
|
|
27
26
|
import { expandValue, normalizeOptions } from './utils/index.js';
|
|
28
27
|
|
|
29
28
|
function Noop() {
|
|
@@ -667,20 +666,25 @@ class Select extends React.Component {
|
|
|
667
666
|
|
|
668
667
|
renderLoading() {
|
|
669
668
|
if (!this.props.isLoading) return;
|
|
670
|
-
const sharedProps = this.getSharedProps();
|
|
671
669
|
const {
|
|
672
670
|
overrides = {}
|
|
673
671
|
} = this.props;
|
|
674
|
-
const [LoadingIndicator, loadingIndicatorProps] = getOverrides(overrides.LoadingIndicator,
|
|
672
|
+
const [LoadingIndicator, loadingIndicatorProps] = getOverrides(overrides.LoadingIndicator, StyledLoadingIndicator);
|
|
675
673
|
return /*#__PURE__*/React.createElement(LoadingIndicator, _extends({
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
674
|
+
role: "status"
|
|
675
|
+
}, loadingIndicatorProps), /*#__PURE__*/React.createElement("span", {
|
|
676
|
+
style: {
|
|
677
|
+
position: 'absolute',
|
|
678
|
+
width: '1px',
|
|
679
|
+
height: '1px',
|
|
680
|
+
padding: 0,
|
|
681
|
+
margin: '-1px',
|
|
682
|
+
overflow: 'hidden',
|
|
683
|
+
clip: 'rect(0,0,0,0)',
|
|
684
|
+
whiteSpace: 'nowrap',
|
|
685
|
+
border: 0
|
|
686
|
+
}
|
|
687
|
+
}, "Loading"));
|
|
684
688
|
}
|
|
685
689
|
|
|
686
690
|
renderValue(valueArray, isOpen, locale) {
|
|
@@ -4,9 +4,10 @@ Copyright (c) Uber Technologies, Inc.
|
|
|
4
4
|
This source code is licensed under the MIT license found in the
|
|
5
5
|
LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { styled } from '../styles/index.js';
|
|
7
|
+
import { styled, withStyle } from '../styles/index.js';
|
|
8
8
|
import { TYPE, SIZE } from './constants.js';
|
|
9
9
|
import { StyledList, StyledListItem } from '../menu/index.js';
|
|
10
|
+
import { Spinner } from '../spinner/index.js';
|
|
10
11
|
import { ellipsisText } from '../styles/util.js';
|
|
11
12
|
|
|
12
13
|
function getFont(size = SIZE.default, typography) {
|
|
@@ -432,19 +433,22 @@ export const StyledClearIcon = styled('svg', props => {
|
|
|
432
433
|
};
|
|
433
434
|
});
|
|
434
435
|
StyledClearIcon.displayName = "StyledClearIcon";
|
|
435
|
-
export const
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
436
|
+
export const StyledLoadingIndicator = withStyle(Spinner, ({
|
|
437
|
+
$theme
|
|
438
|
+
}) => {
|
|
439
|
+
return {
|
|
440
|
+
borderTopWidth: '2px',
|
|
441
|
+
borderRightWidth: '2px',
|
|
442
|
+
borderBottomWidth: '2px',
|
|
443
|
+
borderLeftWidth: '2px',
|
|
444
|
+
borderRightColor: $theme.colors.borderOpaque,
|
|
445
|
+
borderBottomColor: $theme.colors.borderOpaque,
|
|
446
|
+
borderLeftColor: $theme.colors.borderOpaque,
|
|
447
|
+
width: '16px',
|
|
448
|
+
height: '16px'
|
|
446
449
|
};
|
|
447
|
-
};
|
|
450
|
+
});
|
|
451
|
+
StyledLoadingIndicator.displayName = "StyledLoadingIndicator";
|
|
448
452
|
export const StyledSearchIconContainer = styled('div', props => {
|
|
449
453
|
const {
|
|
450
454
|
$disabled,
|
|
@@ -536,7 +536,8 @@ export function DataTable(_ref2) {
|
|
|
536
536
|
sortIndex = _ref2.sortIndex,
|
|
537
537
|
sortDirection = _ref2.sortDirection,
|
|
538
538
|
_ref2$textQuery = _ref2.textQuery,
|
|
539
|
-
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery
|
|
539
|
+
textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery,
|
|
540
|
+
controlRef = _ref2.controlRef;
|
|
540
541
|
|
|
541
542
|
var _useStyletron13 = useStyletron(),
|
|
542
543
|
_useStyletron14 = _slicedToArray(_useStyletron13, 2),
|
|
@@ -735,6 +736,13 @@ export function DataTable(_ref2) {
|
|
|
735
736
|
|
|
736
737
|
return result;
|
|
737
738
|
}, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
|
|
739
|
+
React.useImperativeHandle(controlRef, function () {
|
|
740
|
+
return {
|
|
741
|
+
getRows: function getRows() {
|
|
742
|
+
return rows;
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
}, [rows]);
|
|
738
746
|
|
|
739
747
|
var _React$useState19 = React.useState(0),
|
|
740
748
|
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
|
@@ -17,7 +17,6 @@ export var Label = styled('label', function (props) {
|
|
|
17
17
|
colors = _props$$theme.colors,
|
|
18
18
|
typography = _props$$theme.typography;
|
|
19
19
|
return _objectSpread(_objectSpread({}, typography.font250), {}, {
|
|
20
|
-
fontWeight: 500,
|
|
21
20
|
width: '100%',
|
|
22
21
|
color: $disabled ? colors.contentSecondary : colors.contentPrimary,
|
|
23
22
|
display: 'block',
|
package/esm/list/list-item.js
CHANGED
|
@@ -69,7 +69,11 @@ var ListItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
69
69
|
return /*#__PURE__*/React.createElement(Root // flowlint-next-line unclear-type:off
|
|
70
70
|
, _extends({
|
|
71
71
|
ref: ref,
|
|
72
|
-
$shape: props.shape || SHAPE.DEFAULT
|
|
72
|
+
$shape: props.shape || SHAPE.DEFAULT,
|
|
73
|
+
"aria-label": props['aria-label'],
|
|
74
|
+
"aria-selected": props['aria-selected'],
|
|
75
|
+
id: props.id,
|
|
76
|
+
role: props.role
|
|
73
77
|
}, rootProps), Artwork && /*#__PURE__*/React.createElement(ArtworkContainer, _extends({
|
|
74
78
|
$artworkSize: artworkSize,
|
|
75
79
|
$sublist: Boolean(props.sublist)
|
package/esm/list/menu-adapter.js
CHANGED
|
@@ -11,9 +11,13 @@ var MenuAdapter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
11
11
|
return /*#__PURE__*/React.createElement(ListItem, {
|
|
12
12
|
ref: ref,
|
|
13
13
|
sublist: props.sublist || props.$size === 'compact',
|
|
14
|
+
"aria-label": props['aria-label'],
|
|
15
|
+
"aria-selected": props['aria-selected'],
|
|
14
16
|
artwork: props.artwork,
|
|
15
17
|
artworkSize: props.artworkSize,
|
|
16
18
|
endEnhancer: props.endEnhancer,
|
|
19
|
+
id: props.id,
|
|
20
|
+
role: props.role,
|
|
17
21
|
overrides: mergeOverrides({
|
|
18
22
|
Root: {
|
|
19
23
|
props: {
|
|
@@ -59,13 +59,12 @@ import TriangleDownIcon from '../icon/triangle-down.js';
|
|
|
59
59
|
import SearchIconComponent from '../icon/search.js';
|
|
60
60
|
import { LocaleContext } from '../locale/index.js';
|
|
61
61
|
import { Popover, PLACEMENT } from '../popover/index.js';
|
|
62
|
-
import { Spinner } from '../spinner/index.js';
|
|
63
62
|
import { UIDConsumer } from 'react-uid';
|
|
64
63
|
import AutosizeInput from './autosize-input.js';
|
|
65
64
|
import { TYPE, STATE_CHANGE_TYPE } from './constants.js';
|
|
66
65
|
import defaultProps from './default-props.js';
|
|
67
66
|
import SelectDropdown from './dropdown.js';
|
|
68
|
-
import { StyledRoot, StyledControlContainer, StyledPlaceholder, StyledValueContainer, StyledInputContainer, StyledIconsContainer, StyledSelectArrow, StyledClearIcon,
|
|
67
|
+
import { StyledRoot, StyledControlContainer, StyledPlaceholder, StyledValueContainer, StyledInputContainer, StyledIconsContainer, StyledSelectArrow, StyledClearIcon, StyledSearchIconContainer, StyledLoadingIndicator } from './styled-components.js';
|
|
69
68
|
import { expandValue, normalizeOptions } from './utils/index.js';
|
|
70
69
|
|
|
71
70
|
function Noop() {
|
|
@@ -776,24 +775,29 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
776
775
|
key: "renderLoading",
|
|
777
776
|
value: function renderLoading() {
|
|
778
777
|
if (!this.props.isLoading) return;
|
|
779
|
-
var sharedProps = this.getSharedProps();
|
|
780
778
|
var _this$props$overrides = this.props.overrides,
|
|
781
779
|
overrides = _this$props$overrides === void 0 ? {} : _this$props$overrides;
|
|
782
780
|
|
|
783
|
-
var _getOverrides = getOverrides(overrides.LoadingIndicator,
|
|
781
|
+
var _getOverrides = getOverrides(overrides.LoadingIndicator, StyledLoadingIndicator),
|
|
784
782
|
_getOverrides2 = _slicedToArray(_getOverrides, 2),
|
|
785
783
|
LoadingIndicator = _getOverrides2[0],
|
|
786
784
|
loadingIndicatorProps = _getOverrides2[1];
|
|
787
785
|
|
|
788
786
|
return /*#__PURE__*/React.createElement(LoadingIndicator, _extends({
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
787
|
+
role: "status"
|
|
788
|
+
}, loadingIndicatorProps), /*#__PURE__*/React.createElement("span", {
|
|
789
|
+
style: {
|
|
790
|
+
position: 'absolute',
|
|
791
|
+
width: '1px',
|
|
792
|
+
height: '1px',
|
|
793
|
+
padding: 0,
|
|
794
|
+
margin: '-1px',
|
|
795
|
+
overflow: 'hidden',
|
|
796
|
+
clip: 'rect(0,0,0,0)',
|
|
797
|
+
whiteSpace: 'nowrap',
|
|
798
|
+
border: 0
|
|
799
|
+
}
|
|
800
|
+
}, "Loading"));
|
|
797
801
|
}
|
|
798
802
|
}, {
|
|
799
803
|
key: "renderValue",
|
|
@@ -10,9 +10,10 @@ Copyright (c) Uber Technologies, Inc.
|
|
|
10
10
|
This source code is licensed under the MIT license found in the
|
|
11
11
|
LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
-
import { styled } from '../styles/index.js';
|
|
13
|
+
import { styled, withStyle } from '../styles/index.js';
|
|
14
14
|
import { TYPE, SIZE } from './constants.js';
|
|
15
15
|
import { StyledList, StyledListItem } from '../menu/index.js';
|
|
16
|
+
import { Spinner } from '../spinner/index.js';
|
|
16
17
|
import { ellipsisText } from '../styles/util.js';
|
|
17
18
|
|
|
18
19
|
function getFont() {
|
|
@@ -371,15 +372,21 @@ export var StyledClearIcon = styled('svg', function (props) {
|
|
|
371
372
|
});
|
|
372
373
|
});
|
|
373
374
|
StyledClearIcon.displayName = "StyledClearIcon";
|
|
374
|
-
export var
|
|
375
|
-
var $theme =
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
375
|
+
export var StyledLoadingIndicator = withStyle(Spinner, function (_ref5) {
|
|
376
|
+
var $theme = _ref5.$theme;
|
|
377
|
+
return {
|
|
378
|
+
borderTopWidth: '2px',
|
|
379
|
+
borderRightWidth: '2px',
|
|
380
|
+
borderBottomWidth: '2px',
|
|
381
|
+
borderLeftWidth: '2px',
|
|
382
|
+
borderRightColor: $theme.colors.borderOpaque,
|
|
383
|
+
borderBottomColor: $theme.colors.borderOpaque,
|
|
384
|
+
borderLeftColor: $theme.colors.borderOpaque,
|
|
385
|
+
width: '16px',
|
|
386
|
+
height: '16px'
|
|
387
|
+
};
|
|
388
|
+
});
|
|
389
|
+
StyledLoadingIndicator.displayName = "StyledLoadingIndicator";
|
|
383
390
|
export var StyledSearchIconContainer = styled('div', function (props) {
|
|
384
391
|
var _objectSpread4;
|
|
385
392
|
|
package/form-control/index.d.ts
CHANGED
|
@@ -32,3 +32,12 @@ export class FormControl extends React.Component<
|
|
|
32
32
|
FormControlProps,
|
|
33
33
|
FormControlState
|
|
34
34
|
> {}
|
|
35
|
+
|
|
36
|
+
export interface FormControlChildProps {
|
|
37
|
+
'aria-describedby': string | null,
|
|
38
|
+
'aria-errormessage': string | null,
|
|
39
|
+
key: React.Key,
|
|
40
|
+
disabled: boolean,
|
|
41
|
+
error: boolean,
|
|
42
|
+
positive: boolean
|
|
43
|
+
}
|
|
@@ -19,7 +19,6 @@ var Label = (0, _index.styled)('label', function (props) {
|
|
|
19
19
|
colors = _props$$theme.colors,
|
|
20
20
|
typography = _props$$theme.typography;
|
|
21
21
|
return _objectSpread(_objectSpread({}, typography.font250), {}, {
|
|
22
|
-
fontWeight: 500,
|
|
23
22
|
width: '100%',
|
|
24
23
|
color: $disabled ? colors.contentSecondary : colors.contentPrimary,
|
|
25
24
|
display: 'block',
|
package/list/list-item.js
CHANGED
|
@@ -78,7 +78,11 @@ var ListItem = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
78
78
|
return /*#__PURE__*/_react.default.createElement(Root // flowlint-next-line unclear-type:off
|
|
79
79
|
, _extends({
|
|
80
80
|
ref: ref,
|
|
81
|
-
$shape: props.shape || _constants.SHAPE.DEFAULT
|
|
81
|
+
$shape: props.shape || _constants.SHAPE.DEFAULT,
|
|
82
|
+
"aria-label": props['aria-label'],
|
|
83
|
+
"aria-selected": props['aria-selected'],
|
|
84
|
+
id: props.id,
|
|
85
|
+
role: props.role
|
|
82
86
|
}, rootProps), Artwork && /*#__PURE__*/_react.default.createElement(ArtworkContainer, _extends({
|
|
83
87
|
$artworkSize: artworkSize,
|
|
84
88
|
$sublist: Boolean(props.sublist)
|
package/list/list-item.js.flow
CHANGED
|
@@ -58,6 +58,10 @@ const ListItem = React.forwardRef<PropsT, HTMLLIElement>((props: PropsT, ref) =>
|
|
|
58
58
|
// flowlint-next-line unclear-type:off
|
|
59
59
|
ref={(ref: any)}
|
|
60
60
|
$shape={props.shape || SHAPE.DEFAULT}
|
|
61
|
+
aria-label={props['aria-label']}
|
|
62
|
+
aria-selected={props['aria-selected']}
|
|
63
|
+
id={props.id}
|
|
64
|
+
role={props.role}
|
|
61
65
|
{...rootProps}
|
|
62
66
|
>
|
|
63
67
|
{Artwork && (
|
package/list/menu-adapter.js
CHANGED
|
@@ -29,9 +29,13 @@ var MenuAdapter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
29
29
|
return /*#__PURE__*/React.createElement(_listItem.default, {
|
|
30
30
|
ref: ref,
|
|
31
31
|
sublist: props.sublist || props.$size === 'compact',
|
|
32
|
+
"aria-label": props['aria-label'],
|
|
33
|
+
"aria-selected": props['aria-selected'],
|
|
32
34
|
artwork: props.artwork,
|
|
33
35
|
artworkSize: props.artworkSize,
|
|
34
36
|
endEnhancer: props.endEnhancer,
|
|
37
|
+
id: props.id,
|
|
38
|
+
role: props.role,
|
|
35
39
|
overrides: (0, _overrides.mergeOverrides)({
|
|
36
40
|
Root: {
|
|
37
41
|
props: {
|
|
@@ -17,9 +17,13 @@ const MenuAdapter = React.forwardRef<MenuAdapterPropsT, HTMLLIElement>((props, r
|
|
|
17
17
|
<ListItem
|
|
18
18
|
ref={ref}
|
|
19
19
|
sublist={props.sublist || props.$size === 'compact'}
|
|
20
|
+
aria-label={props['aria-label']}
|
|
21
|
+
aria-selected={props['aria-selected']}
|
|
20
22
|
artwork={props.artwork}
|
|
21
23
|
artworkSize={props.artworkSize}
|
|
22
24
|
endEnhancer={props.endEnhancer}
|
|
25
|
+
id={props.id}
|
|
26
|
+
role={props.role}
|
|
23
27
|
overrides={mergeOverrides(
|
|
24
28
|
{
|
|
25
29
|
Root: {
|
package/list/types.js.flow
CHANGED
|
@@ -44,7 +44,11 @@ export type PropsT = {|
|
|
|
44
44
|
shape?: ShapeT,
|
|
45
45
|
children: React.Node,
|
|
46
46
|
endEnhancer?: React.AbstractComponent<{}>,
|
|
47
|
+
'aria-label'?: string,
|
|
48
|
+
'aria-selected'?: boolean,
|
|
49
|
+
id?: String,
|
|
47
50
|
overrides?: OverridesT,
|
|
51
|
+
role?: string,
|
|
48
52
|
sublist?: boolean,
|
|
49
53
|
|};
|
|
50
54
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baseui",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.1",
|
|
4
4
|
"description": "A React Component library implementing the Base design language",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"build:esm": "cross-env NODE_ENV=production BABEL_ENV=esm babel ./src --out-dir ./dist/esm --ignore **.test.js,**/__tests__/**,**/e2e.js,**/template-component/**,**/test/**",
|
|
30
30
|
"build:es": "cross-env NODE_ENV=production BABEL_ENV=es babel ./src --out-dir ./dist/es --ignore **.test.js,**/__tests__/**,**/e2e.js,**/template-component/**,**/test/**",
|
|
31
31
|
"build": "yarn build:cjs && yarn build:esm && yarn build:es && yarn build:copy-files && yarn build:copy-flow-files && yarn build:copy-ts-files && yarn build:package-json",
|
|
32
|
+
"build:docs-and-ladle": "yarn documentation:build && yarn ladle build --base-url /ladle/ && mv build public/ladle",
|
|
32
33
|
"build:documentation-site-files": "node ./scripts/build-documentation-site-files.js",
|
|
33
34
|
"unit-test": "yarn jest --coverage",
|
|
34
35
|
"e2e:build": "yarn ladle build --out build-ladle",
|
|
@@ -22,8 +22,6 @@ var _index = require("../locale/index.js");
|
|
|
22
22
|
|
|
23
23
|
var _index2 = require("../popover/index.js");
|
|
24
24
|
|
|
25
|
-
var _index3 = require("../spinner/index.js");
|
|
26
|
-
|
|
27
25
|
var _reactUid = require("react-uid");
|
|
28
26
|
|
|
29
27
|
var _autosizeInput = _interopRequireDefault(require("./autosize-input.js"));
|
|
@@ -36,7 +34,7 @@ var _dropdown = _interopRequireDefault(require("./dropdown.js"));
|
|
|
36
34
|
|
|
37
35
|
var _styledComponents = require("./styled-components.js");
|
|
38
36
|
|
|
39
|
-
var
|
|
37
|
+
var _index3 = require("./utils/index.js");
|
|
40
38
|
|
|
41
39
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
42
40
|
|
|
@@ -660,7 +658,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
660
658
|
return !_this.state.inputValue;
|
|
661
659
|
});
|
|
662
660
|
|
|
663
|
-
_this.options = (0,
|
|
661
|
+
_this.options = (0, _index3.normalizeOptions)(props.options);
|
|
664
662
|
return _this;
|
|
665
663
|
}
|
|
666
664
|
|
|
@@ -778,7 +776,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
778
776
|
}
|
|
779
777
|
|
|
780
778
|
return value.map(function (value) {
|
|
781
|
-
return (0,
|
|
779
|
+
return (0, _index3.expandValue)(value, _this2.props);
|
|
782
780
|
});
|
|
783
781
|
}
|
|
784
782
|
}, {
|
|
@@ -796,24 +794,29 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
796
794
|
key: "renderLoading",
|
|
797
795
|
value: function renderLoading() {
|
|
798
796
|
if (!this.props.isLoading) return;
|
|
799
|
-
var sharedProps = this.getSharedProps();
|
|
800
797
|
var _this$props$overrides = this.props.overrides,
|
|
801
798
|
overrides = _this$props$overrides === void 0 ? {} : _this$props$overrides;
|
|
802
799
|
|
|
803
|
-
var _getOverrides = (0, _overrides.getOverrides)(overrides.LoadingIndicator,
|
|
800
|
+
var _getOverrides = (0, _overrides.getOverrides)(overrides.LoadingIndicator, _styledComponents.StyledLoadingIndicator),
|
|
804
801
|
_getOverrides2 = _slicedToArray(_getOverrides, 2),
|
|
805
802
|
LoadingIndicator = _getOverrides2[0],
|
|
806
803
|
loadingIndicatorProps = _getOverrides2[1];
|
|
807
804
|
|
|
808
805
|
return /*#__PURE__*/React.createElement(LoadingIndicator, _extends({
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
806
|
+
role: "status"
|
|
807
|
+
}, loadingIndicatorProps), /*#__PURE__*/React.createElement("span", {
|
|
808
|
+
style: {
|
|
809
|
+
position: 'absolute',
|
|
810
|
+
width: '1px',
|
|
811
|
+
height: '1px',
|
|
812
|
+
padding: 0,
|
|
813
|
+
margin: '-1px',
|
|
814
|
+
overflow: 'hidden',
|
|
815
|
+
clip: 'rect(0,0,0,0)',
|
|
816
|
+
whiteSpace: 'nowrap',
|
|
817
|
+
border: 0
|
|
818
|
+
}
|
|
819
|
+
}, "Loading"));
|
|
817
820
|
}
|
|
818
821
|
}, {
|
|
819
822
|
key: "renderValue",
|
|
@@ -1102,7 +1105,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
1102
1105
|
value: function render() {
|
|
1103
1106
|
var _this6 = this;
|
|
1104
1107
|
|
|
1105
|
-
this.options = (0,
|
|
1108
|
+
this.options = (0, _index3.normalizeOptions)(this.props.options);
|
|
1106
1109
|
var _this$props2 = this.props,
|
|
1107
1110
|
_this$props2$override = _this$props2.overrides,
|
|
1108
1111
|
overrides = _this$props2$override === void 0 ? {} : _this$props2$override,
|
|
@@ -15,7 +15,6 @@ import SearchIconComponent from '../icon/search.js';
|
|
|
15
15
|
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
|
-
import { Spinner } from '../spinner/index.js';
|
|
19
18
|
import { UIDConsumer } from 'react-uid';
|
|
20
19
|
|
|
21
20
|
import AutosizeInput from './autosize-input.js';
|
|
@@ -31,8 +30,8 @@ import {
|
|
|
31
30
|
StyledIconsContainer,
|
|
32
31
|
StyledSelectArrow,
|
|
33
32
|
StyledClearIcon,
|
|
34
|
-
getLoadingIconStyles,
|
|
35
33
|
StyledSearchIconContainer,
|
|
34
|
+
StyledLoadingIndicator,
|
|
36
35
|
} from './styled-components.js';
|
|
37
36
|
import type { PropsT, SelectStateT, ValueT, OptionT, ChangeActionT, ReactRefT } from './types.js';
|
|
38
37
|
import { expandValue, normalizeOptions } from './utils/index.js';
|
|
@@ -616,20 +615,33 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
616
615
|
|
|
617
616
|
renderLoading() {
|
|
618
617
|
if (!this.props.isLoading) return;
|
|
619
|
-
const sharedProps = this.getSharedProps();
|
|
620
618
|
const { overrides = {} } = this.props;
|
|
621
619
|
const [LoadingIndicator, loadingIndicatorProps] = getOverrides(
|
|
622
620
|
overrides.LoadingIndicator,
|
|
623
|
-
|
|
621
|
+
StyledLoadingIndicator
|
|
624
622
|
);
|
|
623
|
+
|
|
625
624
|
return (
|
|
626
|
-
<LoadingIndicator
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
625
|
+
<LoadingIndicator role="status" {...loadingIndicatorProps}>
|
|
626
|
+
{/* Offscreen content could be defined as styled-component and
|
|
627
|
+
overridable, but I can't think of a good reason for doing so.
|
|
628
|
+
LoadingIndicator children can be overriden if required. */}
|
|
629
|
+
<span
|
|
630
|
+
style={{
|
|
631
|
+
position: 'absolute',
|
|
632
|
+
width: '1px',
|
|
633
|
+
height: '1px',
|
|
634
|
+
padding: 0,
|
|
635
|
+
margin: '-1px',
|
|
636
|
+
overflow: 'hidden',
|
|
637
|
+
clip: 'rect(0,0,0,0)',
|
|
638
|
+
whiteSpace: 'nowrap',
|
|
639
|
+
border: 0,
|
|
640
|
+
}}
|
|
641
|
+
>
|
|
642
|
+
Loading
|
|
643
|
+
</span>
|
|
644
|
+
</LoadingIndicator>
|
|
633
645
|
);
|
|
634
646
|
}
|
|
635
647
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StyledSearchIconContainer = exports.
|
|
6
|
+
exports.StyledSearchIconContainer = exports.StyledLoadingIndicator = exports.StyledClearIcon = exports.StyledSelectArrow = exports.StyledIconsContainer = exports.StyledInputSizer = exports.StyledInput = exports.StyledInputContainer = exports.StyledSingleValue = exports.StyledPlaceholder = exports.StyledValueContainer = exports.StyledControlContainer = exports.StyledRoot = exports.StyledOptionContent = exports.StyledDropdownListItem = exports.StyledDropdown = exports.StyledDropdownContainer = void 0;
|
|
7
7
|
|
|
8
8
|
var _index = require("../styles/index.js");
|
|
9
9
|
|
|
@@ -11,6 +11,8 @@ var _constants = require("./constants.js");
|
|
|
11
11
|
|
|
12
12
|
var _index2 = require("../menu/index.js");
|
|
13
13
|
|
|
14
|
+
var _index3 = require("../spinner/index.js");
|
|
15
|
+
|
|
14
16
|
var _util = require("../styles/util.js");
|
|
15
17
|
|
|
16
18
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -390,18 +392,22 @@ var StyledClearIcon = (0, _index.styled)('svg', function (props) {
|
|
|
390
392
|
});
|
|
391
393
|
exports.StyledClearIcon = StyledClearIcon;
|
|
392
394
|
StyledClearIcon.displayName = "StyledClearIcon";
|
|
393
|
-
|
|
394
|
-
var
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
395
|
+
var StyledLoadingIndicator = (0, _index.withStyle)(_index3.Spinner, function (_ref5) {
|
|
396
|
+
var $theme = _ref5.$theme;
|
|
397
|
+
return {
|
|
398
|
+
borderTopWidth: '2px',
|
|
399
|
+
borderRightWidth: '2px',
|
|
400
|
+
borderBottomWidth: '2px',
|
|
401
|
+
borderLeftWidth: '2px',
|
|
402
|
+
borderRightColor: $theme.colors.borderOpaque,
|
|
403
|
+
borderBottomColor: $theme.colors.borderOpaque,
|
|
404
|
+
borderLeftColor: $theme.colors.borderOpaque,
|
|
405
|
+
width: '16px',
|
|
406
|
+
height: '16px'
|
|
407
|
+
};
|
|
408
|
+
});
|
|
409
|
+
exports.StyledLoadingIndicator = StyledLoadingIndicator;
|
|
410
|
+
StyledLoadingIndicator.displayName = "StyledLoadingIndicator";
|
|
405
411
|
var StyledSearchIconContainer = (0, _index.styled)('div', function (props) {
|
|
406
412
|
var _objectSpread4;
|
|
407
413
|
|
|
@@ -6,13 +6,13 @@ LICENSE file in the root directory of this source tree.
|
|
|
6
6
|
*/
|
|
7
7
|
// @flow
|
|
8
8
|
|
|
9
|
-
import { styled } from '../styles/index.js';
|
|
9
|
+
import { styled, withStyle } from '../styles/index.js';
|
|
10
10
|
import { TYPE, SIZE } from './constants.js';
|
|
11
11
|
import { StyledList, StyledListItem } from '../menu/index.js';
|
|
12
|
+
import { Spinner } from '../spinner/index.js';
|
|
12
13
|
|
|
13
14
|
import type { SharedStylePropsArgT } from './types.js';
|
|
14
15
|
import { ellipsisText } from '../styles/util.js';
|
|
15
|
-
import type { ThemeT } from '../styles/types.js';
|
|
16
16
|
|
|
17
17
|
function getFont(size = SIZE.default, typography) {
|
|
18
18
|
return {
|
|
@@ -424,14 +424,19 @@ export const StyledClearIcon = styled<SharedStylePropsArgT>('svg', (props) => {
|
|
|
424
424
|
};
|
|
425
425
|
});
|
|
426
426
|
|
|
427
|
-
export const
|
|
428
|
-
const { $theme } = props;
|
|
429
|
-
const { colors } = $theme;
|
|
427
|
+
export const StyledLoadingIndicator = withStyle<typeof Spinner, {}>(Spinner, ({ $theme }) => {
|
|
430
428
|
return {
|
|
431
|
-
|
|
432
|
-
|
|
429
|
+
borderTopWidth: '2px',
|
|
430
|
+
borderRightWidth: '2px',
|
|
431
|
+
borderBottomWidth: '2px',
|
|
432
|
+
borderLeftWidth: '2px',
|
|
433
|
+
borderRightColor: $theme.colors.borderOpaque,
|
|
434
|
+
borderBottomColor: $theme.colors.borderOpaque,
|
|
435
|
+
borderLeftColor: $theme.colors.borderOpaque,
|
|
436
|
+
width: '16px',
|
|
437
|
+
height: '16px',
|
|
433
438
|
};
|
|
434
|
-
};
|
|
439
|
+
});
|
|
435
440
|
|
|
436
441
|
export const StyledSearchIconContainer = styled<SharedStylePropsArgT>('div', (props) => {
|
|
437
442
|
const { $disabled, $theme } = props;
|