baseui 11.0.2 → 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/datepicker/types.js.flow +2 -2
- package/es/select/select-component.js +6 -0
- package/es/select/utils/default-filter-options.js +1 -1
- package/esm/select/select-component.js +6 -0
- package/esm/select/utils/default-filter-options.js +1 -1
- package/index.d.ts +20 -35
- package/package.json +1 -1
- package/select/index.d.ts +1 -0
- package/select/select-component.js +6 -0
- package/select/select-component.js.flow +7 -2
- 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/spinner/index.d.ts +3 -2
package/datepicker/types.js.flow
CHANGED
|
@@ -241,7 +241,7 @@ export type DatepickerPropsT<T = Date> = {
|
|
|
241
241
|
/** Where to mount the popover */
|
|
242
242
|
mountNode?: HTMLElement,
|
|
243
243
|
/** When single picker, fn is always called. When range picker, fn is called when start and end date are selected. */
|
|
244
|
-
onChange?: ({
|
|
244
|
+
onChange?: ({ date: ?T | Array<T> }) => mixed,
|
|
245
245
|
/** Called when calendar is closed */
|
|
246
246
|
onClose?: () => mixed,
|
|
247
247
|
/** Called when calendar is opened */
|
|
@@ -320,7 +320,7 @@ export type StatefulContainerPropsT<PropsT, T = Date> = {
|
|
|
320
320
|
/** A state change handler. */
|
|
321
321
|
stateReducer: StateReducerT<T>,
|
|
322
322
|
/** When single picker, fn is called when date/time is selected. When range picker, fn is called when both start and end are selected. */
|
|
323
|
-
onChange?: ({
|
|
323
|
+
onChange?: ({ date: ?T | Array<T> }) => mixed,
|
|
324
324
|
/** When single picker, fn is called when date/time is selected. When range picker, fn is called when either start or end date changes. */
|
|
325
325
|
onRangeChange?: ({ +date: ?T | Array<?T> }) => mixed,
|
|
326
326
|
adapter?: DateIOAdapter<T>,
|
|
@@ -436,6 +436,12 @@ class Select extends React.Component {
|
|
|
436
436
|
_defineProperty(this, "handleInputRef", input => {
|
|
437
437
|
this.input = input;
|
|
438
438
|
|
|
439
|
+
if (typeof this.props.inputRef === 'function') {
|
|
440
|
+
this.props.inputRef(input);
|
|
441
|
+
} else if (this.props.inputRef) {
|
|
442
|
+
this.props.inputRef.current = input;
|
|
443
|
+
}
|
|
444
|
+
|
|
439
445
|
if (this.props.controlRef && typeof this.props.controlRef === 'function') {
|
|
440
446
|
this.props.controlRef(input);
|
|
441
447
|
}
|
|
@@ -37,7 +37,7 @@ const filterOptions = (options, filterValue, excludeOptions, newProps) => {
|
|
|
37
37
|
acc.add(option[props.valueKey]);
|
|
38
38
|
return acc;
|
|
39
39
|
}, new Set());
|
|
40
|
-
const re = new RegExp(`${props.matchPos === 'start' ? '
|
|
40
|
+
const re = new RegExp(`${props.matchPos === 'start' ? '^' : ''}${escapeRegExp(filterValue)}`, props.ignoreCase ? 'i' : ''); // $FlowFixMe
|
|
41
41
|
|
|
42
42
|
return options.filter(option => {
|
|
43
43
|
if (excludeValues.has(option[props.valueKey])) return false;
|
|
@@ -511,6 +511,12 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
511
511
|
_defineProperty(_assertThisInitialized(_this), "handleInputRef", function (input) {
|
|
512
512
|
_this.input = input;
|
|
513
513
|
|
|
514
|
+
if (typeof _this.props.inputRef === 'function') {
|
|
515
|
+
_this.props.inputRef(input);
|
|
516
|
+
} else if (_this.props.inputRef) {
|
|
517
|
+
_this.props.inputRef.current = input;
|
|
518
|
+
}
|
|
519
|
+
|
|
514
520
|
if (_this.props.controlRef && typeof _this.props.controlRef === 'function') {
|
|
515
521
|
_this.props.controlRef(input);
|
|
516
522
|
}
|
|
@@ -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/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/package.json
CHANGED
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;
|
|
@@ -530,6 +530,12 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
530
530
|
_defineProperty(_assertThisInitialized(_this), "handleInputRef", function (input) {
|
|
531
531
|
_this.input = input;
|
|
532
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
|
+
|
|
533
539
|
if (_this.props.controlRef && typeof _this.props.controlRef === 'function') {
|
|
534
540
|
_this.props.controlRef(input);
|
|
535
541
|
}
|
|
@@ -497,11 +497,16 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
497
497
|
}
|
|
498
498
|
};
|
|
499
499
|
|
|
500
|
-
// This method is to preserve backwards compatibility for users using controlRef to directly
|
|
501
|
-
// access the input element. This capability is not documented, and may be removed in the future.
|
|
502
500
|
//flowlint-next-line unclear-type:off
|
|
503
501
|
handleInputRef = (input: React.ElementRef<any>) => {
|
|
504
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
|
+
|
|
505
510
|
if (this.props.controlRef && typeof this.props.controlRef === 'function') {
|
|
506
511
|
this.props.controlRef(input);
|
|
507
512
|
}
|
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;
|