baseui 11.0.0 → 11.0.3
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/datepicker/calendar.js +16 -11
- package/datepicker/calendar.js.flow +12 -9
- package/datepicker/datepicker.js +58 -58
- package/datepicker/datepicker.js.flow +51 -34
- package/datepicker/stateful-calendar.js +6 -1
- package/datepicker/stateful-calendar.js.flow +8 -1
- package/datepicker/stateful-container.js +23 -2
- package/datepicker/stateful-container.js.flow +17 -4
- package/datepicker/stateful-datepicker.js +6 -1
- package/datepicker/stateful-datepicker.js.flow +7 -1
- package/datepicker/types.js.flow +21 -43
- package/es/data-table/data-table.js +5 -1
- package/es/data-table/stateful-data-table.js +2 -1
- package/es/datepicker/calendar.js +15 -10
- package/es/datepicker/datepicker.js +52 -52
- package/es/datepicker/stateful-calendar.js +6 -1
- package/es/datepicker/stateful-container.js +22 -2
- package/es/datepicker/stateful-datepicker.js +6 -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 +22 -12
- package/es/select/styled-components.js +17 -13
- package/es/select/utils/default-filter-options.js +1 -1
- package/es/snackbar/snackbar-context.js +1 -1
- package/esm/data-table/data-table.js +9 -1
- package/esm/data-table/stateful-data-table.js +2 -1
- package/esm/datepicker/calendar.js +16 -11
- package/esm/datepicker/datepicker.js +58 -58
- package/esm/datepicker/stateful-calendar.js +6 -1
- package/esm/datepicker/stateful-container.js +23 -2
- package/esm/datepicker/stateful-datepicker.js +6 -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 +22 -12
- package/esm/select/styled-components.js +17 -10
- package/esm/select/utils/default-filter-options.js +1 -1
- package/esm/snackbar/snackbar-context.js +1 -1
- 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/index.d.ts +20 -35
- 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/index.d.ts +1 -0
- package/select/select-component.js +25 -16
- package/select/select-component.js.flow +30 -13
- package/select/styled-components.js +19 -13
- package/select/styled-components.js.flow +13 -8
- package/select/types.js.flow +1 -0
- package/select/utils/default-filter-options.js +1 -1
- package/select/utils/default-filter-options.js.flow +1 -1
- package/snackbar/snackbar-context.js +1 -1
- package/snackbar/snackbar-context.js.flow +1 -1
- package/spinner/index.d.ts +3 -2
- package/tag/types.js.flow +1 -1
|
@@ -43,7 +43,7 @@ var filterOptions = function filterOptions(options, filterValue, excludeOptions,
|
|
|
43
43
|
acc.add(option[props.valueKey]);
|
|
44
44
|
return acc;
|
|
45
45
|
}, new Set());
|
|
46
|
-
var re = new RegExp("".concat(props.matchPos === 'start' ? '
|
|
46
|
+
var re = new RegExp("".concat(props.matchPos === 'start' ? '^' : '').concat(escapeRegExp(filterValue)), props.ignoreCase ? 'i' : ''); // $FlowFixMe
|
|
47
47
|
|
|
48
48
|
return options.filter(function (option) {
|
|
49
49
|
if (excludeValues.has(option[props.valueKey])) return false;
|
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/index.d.ts
CHANGED
|
@@ -5,53 +5,47 @@ import {
|
|
|
5
5
|
WithStyleFn as StyletronWithStyleFn,
|
|
6
6
|
StyledFn as StyletronStyledFn,
|
|
7
7
|
} from 'styletron-react';
|
|
8
|
-
import {Override, Overrides} from './overrides';
|
|
9
|
-
import {Locale} from './locale';
|
|
10
|
-
import {Theme, ThemePrimitives} from './theme';
|
|
8
|
+
import { Override, Overrides } from './overrides';
|
|
9
|
+
import { Locale } from './locale';
|
|
10
|
+
import { Theme, ThemePrimitives } from './theme';
|
|
11
11
|
|
|
12
12
|
type UseStyletronFn<Theme> = () => [(arg: StyleObject) => string, Theme];
|
|
13
13
|
export function createThemedUseStyletron<Theme>(): UseStyletronFn<Theme>;
|
|
14
14
|
export const useStyletron: UseStyletronFn<Theme>;
|
|
15
|
-
export function withWrapper<
|
|
16
|
-
C extends StyletronComponent<any>,
|
|
17
|
-
P extends object
|
|
18
|
-
>(
|
|
15
|
+
export function withWrapper<C extends StyletronComponent<any>, P extends object>(
|
|
19
16
|
component: C,
|
|
20
|
-
wrapper: (component: C) => React.ComponentType<P
|
|
17
|
+
wrapper: (component: C) => React.ComponentType<P>
|
|
21
18
|
): StyletronComponent<React.ComponentProps<C> & P>;
|
|
22
19
|
|
|
23
20
|
export function createTheme<P extends object>(
|
|
24
21
|
primitives: Partial<ThemePrimitives>,
|
|
25
|
-
overrides?: P
|
|
22
|
+
overrides?: P
|
|
26
23
|
): Theme & P;
|
|
27
24
|
export function createLightTheme<P extends object>(
|
|
28
25
|
primitives: Partial<ThemePrimitives>,
|
|
29
|
-
overrides?: P
|
|
26
|
+
overrides?: P
|
|
30
27
|
): Theme & P;
|
|
31
28
|
export function createDarkTheme<P extends object>(
|
|
32
29
|
primitives: Partial<ThemePrimitives>,
|
|
33
|
-
overrides?: P
|
|
30
|
+
overrides?: P
|
|
34
31
|
): Theme & P;
|
|
35
|
-
export function mergeOverrides<T>(
|
|
36
|
-
target?: Overrides<T>,
|
|
37
|
-
source?: Overrides<T>,
|
|
38
|
-
): Overrides<T>;
|
|
32
|
+
export function mergeOverrides<T>(target?: Overrides<T>, source?: Overrides<T>): Overrides<T>;
|
|
39
33
|
export function styled<
|
|
40
34
|
P extends object,
|
|
41
35
|
C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
|
|
42
36
|
T = Theme
|
|
43
37
|
>(
|
|
44
38
|
component: C,
|
|
45
|
-
styledFn: StyleObject | ((props: {$theme: T} & P) => StyleObject)
|
|
39
|
+
styledFn: StyleObject | ((props: { $theme: T } & P) => StyleObject)
|
|
46
40
|
): StyletronComponent<
|
|
47
|
-
Pick<
|
|
48
|
-
React.ComponentProps<C>,
|
|
49
|
-
Exclude<keyof React.ComponentProps<C>, {className: string}>
|
|
50
|
-
> &
|
|
51
|
-
P
|
|
41
|
+
Pick<React.ComponentProps<C>, Exclude<keyof React.ComponentProps<C>, { className: string }>> & P
|
|
52
42
|
>;
|
|
43
|
+
export function withStyle<C extends StyletronComponent<any>, P extends object, T = Theme>(
|
|
44
|
+
component: C,
|
|
45
|
+
styledFn: StyleObject | ((props: { $theme: T } & P) => StyleObject)
|
|
46
|
+
): StyletronComponent<React.ComponentProps<C> & P>;
|
|
53
47
|
|
|
54
|
-
export {Theme} from 'baseui/theme';
|
|
48
|
+
export { Theme } from 'baseui/theme';
|
|
55
49
|
export const LightTheme: Theme;
|
|
56
50
|
export const LightThemeMove: Theme;
|
|
57
51
|
export const lightThemePrimitives: ThemePrimitives;
|
|
@@ -85,18 +79,11 @@ export interface ThemeProviderProps {
|
|
|
85
79
|
export const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
86
80
|
|
|
87
81
|
export interface StyledFn<T> extends StyletronStyledFn {
|
|
88
|
-
<
|
|
89
|
-
C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
|
|
90
|
-
P extends object
|
|
91
|
-
>(
|
|
82
|
+
<C extends keyof JSX.IntrinsicElements | React.ComponentType<any>, P extends object>(
|
|
92
83
|
component: C,
|
|
93
|
-
style: (props: {$theme: T} & P) => StyleObject
|
|
84
|
+
style: (props: { $theme: T } & P) => StyleObject
|
|
94
85
|
): StyletronComponent<
|
|
95
|
-
Pick<
|
|
96
|
-
React.ComponentProps<C>,
|
|
97
|
-
Exclude<keyof React.ComponentProps<C>, {className: string}>
|
|
98
|
-
> &
|
|
99
|
-
P
|
|
86
|
+
Pick<React.ComponentProps<C>, Exclude<keyof React.ComponentProps<C>, { className: string }>> & P
|
|
100
87
|
>;
|
|
101
88
|
}
|
|
102
89
|
|
|
@@ -105,10 +92,8 @@ export function createThemedStyled<Theme>(): StyledFn<Theme>;
|
|
|
105
92
|
export interface WithStyleFn<T = Theme> extends StyletronWithStyleFn {
|
|
106
93
|
<C extends StyletronComponent<any>, P extends object, T1 = T>(
|
|
107
94
|
component: C,
|
|
108
|
-
style: (props: P & {$theme: T1}) => StyleObject
|
|
95
|
+
style: (props: P & { $theme: T1 }) => StyleObject
|
|
109
96
|
): StyletronComponent<React.ComponentProps<C> & P>;
|
|
110
97
|
}
|
|
111
98
|
|
|
112
|
-
export const withStyle: WithStyleFn;
|
|
113
|
-
|
|
114
99
|
export function createThemedWithStyle<Theme>(): WithStyleFn<Theme>;
|
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.3",
|
|
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",
|
package/select/index.d.ts
CHANGED
|
@@ -111,6 +111,7 @@ export interface SelectProps {
|
|
|
111
111
|
}) => React.ReactNode;
|
|
112
112
|
getValueLabel?: (args: { option: Option }) => React.ReactNode;
|
|
113
113
|
id?: string;
|
|
114
|
+
inputRef?: React.Ref<any>;
|
|
114
115
|
controlRef?: React.Ref<ImperativeMethods>;
|
|
115
116
|
isLoading?: boolean;
|
|
116
117
|
labelKey?: string;
|
|
@@ -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
|
|
|
@@ -532,6 +530,12 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
532
530
|
_defineProperty(_assertThisInitialized(_this), "handleInputRef", function (input) {
|
|
533
531
|
_this.input = input;
|
|
534
532
|
|
|
533
|
+
if (typeof _this.props.inputRef === 'function') {
|
|
534
|
+
_this.props.inputRef(input);
|
|
535
|
+
} else if (_this.props.inputRef) {
|
|
536
|
+
_this.props.inputRef.current = input;
|
|
537
|
+
}
|
|
538
|
+
|
|
535
539
|
if (_this.props.controlRef && typeof _this.props.controlRef === 'function') {
|
|
536
540
|
_this.props.controlRef(input);
|
|
537
541
|
}
|
|
@@ -660,7 +664,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
660
664
|
return !_this.state.inputValue;
|
|
661
665
|
});
|
|
662
666
|
|
|
663
|
-
_this.options = (0,
|
|
667
|
+
_this.options = (0, _index3.normalizeOptions)(props.options);
|
|
664
668
|
return _this;
|
|
665
669
|
}
|
|
666
670
|
|
|
@@ -778,7 +782,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
778
782
|
}
|
|
779
783
|
|
|
780
784
|
return value.map(function (value) {
|
|
781
|
-
return (0,
|
|
785
|
+
return (0, _index3.expandValue)(value, _this2.props);
|
|
782
786
|
});
|
|
783
787
|
}
|
|
784
788
|
}, {
|
|
@@ -796,24 +800,29 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
796
800
|
key: "renderLoading",
|
|
797
801
|
value: function renderLoading() {
|
|
798
802
|
if (!this.props.isLoading) return;
|
|
799
|
-
var sharedProps = this.getSharedProps();
|
|
800
803
|
var _this$props$overrides = this.props.overrides,
|
|
801
804
|
overrides = _this$props$overrides === void 0 ? {} : _this$props$overrides;
|
|
802
805
|
|
|
803
|
-
var _getOverrides = (0, _overrides.getOverrides)(overrides.LoadingIndicator,
|
|
806
|
+
var _getOverrides = (0, _overrides.getOverrides)(overrides.LoadingIndicator, _styledComponents.StyledLoadingIndicator),
|
|
804
807
|
_getOverrides2 = _slicedToArray(_getOverrides, 2),
|
|
805
808
|
LoadingIndicator = _getOverrides2[0],
|
|
806
809
|
loadingIndicatorProps = _getOverrides2[1];
|
|
807
810
|
|
|
808
811
|
return /*#__PURE__*/React.createElement(LoadingIndicator, _extends({
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
812
|
+
role: "status"
|
|
813
|
+
}, loadingIndicatorProps), /*#__PURE__*/React.createElement("span", {
|
|
814
|
+
style: {
|
|
815
|
+
position: 'absolute',
|
|
816
|
+
width: '1px',
|
|
817
|
+
height: '1px',
|
|
818
|
+
padding: 0,
|
|
819
|
+
margin: '-1px',
|
|
820
|
+
overflow: 'hidden',
|
|
821
|
+
clip: 'rect(0,0,0,0)',
|
|
822
|
+
whiteSpace: 'nowrap',
|
|
823
|
+
border: 0
|
|
824
|
+
}
|
|
825
|
+
}, "Loading"));
|
|
817
826
|
}
|
|
818
827
|
}, {
|
|
819
828
|
key: "renderValue",
|
|
@@ -1102,7 +1111,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
1102
1111
|
value: function render() {
|
|
1103
1112
|
var _this6 = this;
|
|
1104
1113
|
|
|
1105
|
-
this.options = (0,
|
|
1114
|
+
this.options = (0, _index3.normalizeOptions)(this.props.options);
|
|
1106
1115
|
var _this$props2 = this.props,
|
|
1107
1116
|
_this$props2$override = _this$props2.overrides,
|
|
1108
1117
|
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';
|
|
@@ -498,11 +497,16 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
498
497
|
}
|
|
499
498
|
};
|
|
500
499
|
|
|
501
|
-
// This method is to preserve backwards compatibility for users using controlRef to directly
|
|
502
|
-
// access the input element. This capability is not documented, and may be removed in the future.
|
|
503
500
|
//flowlint-next-line unclear-type:off
|
|
504
501
|
handleInputRef = (input: React.ElementRef<any>) => {
|
|
505
502
|
this.input = input;
|
|
503
|
+
|
|
504
|
+
if (typeof this.props.inputRef === 'function') {
|
|
505
|
+
this.props.inputRef(input);
|
|
506
|
+
} else if (this.props.inputRef) {
|
|
507
|
+
this.props.inputRef.current = input;
|
|
508
|
+
}
|
|
509
|
+
|
|
506
510
|
if (this.props.controlRef && typeof this.props.controlRef === 'function') {
|
|
507
511
|
this.props.controlRef(input);
|
|
508
512
|
}
|
|
@@ -616,20 +620,33 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
616
620
|
|
|
617
621
|
renderLoading() {
|
|
618
622
|
if (!this.props.isLoading) return;
|
|
619
|
-
const sharedProps = this.getSharedProps();
|
|
620
623
|
const { overrides = {} } = this.props;
|
|
621
624
|
const [LoadingIndicator, loadingIndicatorProps] = getOverrides(
|
|
622
625
|
overrides.LoadingIndicator,
|
|
623
|
-
|
|
626
|
+
StyledLoadingIndicator
|
|
624
627
|
);
|
|
628
|
+
|
|
625
629
|
return (
|
|
626
|
-
<LoadingIndicator
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
630
|
+
<LoadingIndicator role="status" {...loadingIndicatorProps}>
|
|
631
|
+
{/* Offscreen content could be defined as styled-component and
|
|
632
|
+
overridable, but I can't think of a good reason for doing so.
|
|
633
|
+
LoadingIndicator children can be overriden if required. */}
|
|
634
|
+
<span
|
|
635
|
+
style={{
|
|
636
|
+
position: 'absolute',
|
|
637
|
+
width: '1px',
|
|
638
|
+
height: '1px',
|
|
639
|
+
padding: 0,
|
|
640
|
+
margin: '-1px',
|
|
641
|
+
overflow: 'hidden',
|
|
642
|
+
clip: 'rect(0,0,0,0)',
|
|
643
|
+
whiteSpace: 'nowrap',
|
|
644
|
+
border: 0,
|
|
645
|
+
}}
|
|
646
|
+
>
|
|
647
|
+
Loading
|
|
648
|
+
</span>
|
|
649
|
+
</LoadingIndicator>
|
|
633
650
|
);
|
|
634
651
|
}
|
|
635
652
|
|
|
@@ -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;
|
package/select/types.js.flow
CHANGED
|
@@ -138,6 +138,7 @@ export type PropsT = {
|
|
|
138
138
|
id?: string,
|
|
139
139
|
/** Defines if the comparison for a new creatable value should be case-insensitive. */
|
|
140
140
|
ignoreCase?: boolean,
|
|
141
|
+
inputRef?: ReactRefT<HTMLInputElement>,
|
|
141
142
|
/** An imperative handle exposing internal methods. */
|
|
142
143
|
controlRef?: ControlRefT,
|
|
143
144
|
/** Defines if the select is in a loading (async) state. */
|
|
@@ -50,7 +50,7 @@ var filterOptions = function filterOptions(options, filterValue, excludeOptions,
|
|
|
50
50
|
acc.add(option[props.valueKey]);
|
|
51
51
|
return acc;
|
|
52
52
|
}, new Set());
|
|
53
|
-
var re = new RegExp("".concat(props.matchPos === 'start' ? '
|
|
53
|
+
var re = new RegExp("".concat(props.matchPos === 'start' ? '^' : '').concat(escapeRegExp(filterValue)), props.ignoreCase ? 'i' : ''); // $FlowFixMe
|
|
54
54
|
|
|
55
55
|
return options.filter(function (option) {
|
|
56
56
|
if (excludeValues.has(option[props.valueKey])) return false;
|
|
@@ -58,7 +58,7 @@ const filterOptions = (
|
|
|
58
58
|
}, new Set());
|
|
59
59
|
|
|
60
60
|
const re = new RegExp(
|
|
61
|
-
`${props.matchPos === 'start' ? '
|
|
61
|
+
`${props.matchPos === 'start' ? '^' : ''}${escapeRegExp(filterValue)}`,
|
|
62
62
|
props.ignoreCase ? 'i' : ''
|
|
63
63
|
);
|
|
64
64
|
|
package/spinner/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {StyletronComponent} from 'styletron-react';
|
|
2
|
-
import {Sizing} from '../theme.ts';
|
|
1
|
+
import { StyletronComponent } from 'styletron-react';
|
|
2
|
+
import { Sizing } from '../theme.ts';
|
|
3
3
|
|
|
4
4
|
export enum SIZE {
|
|
5
5
|
small = 'small',
|
|
@@ -8,6 +8,7 @@ export enum SIZE {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface SpinnerProps {
|
|
11
|
+
[key: string]: any;
|
|
11
12
|
$color?: string;
|
|
12
13
|
$borderWidth?: number | string | SIZE | Sizing;
|
|
13
14
|
$size?: number | string | SIZE | Sizing;
|