baseui 10.11.1 → 10.12.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/es/select/select-component.js +28 -12
- package/esm/select/select-component.js +30 -11
- package/package.json +9 -9
- package/progress-bar/index.d.ts +3 -3
- package/select/index.d.ts +8 -1
- package/select/select-component.js +30 -11
- package/select/select-component.js.flow +27 -10
- package/select/types.js.flow +11 -7
|
@@ -437,12 +437,8 @@ class Select extends React.Component {
|
|
|
437
437
|
_defineProperty(this, "handleInputRef", input => {
|
|
438
438
|
this.input = input;
|
|
439
439
|
|
|
440
|
-
if (this.props.controlRef) {
|
|
441
|
-
|
|
442
|
-
this.props.controlRef(input);
|
|
443
|
-
} else {
|
|
444
|
-
this.props.controlRef.current = input;
|
|
445
|
-
}
|
|
440
|
+
if (this.props.controlRef && typeof this.props.controlRef === 'function') {
|
|
441
|
+
this.props.controlRef(input);
|
|
446
442
|
}
|
|
447
443
|
});
|
|
448
444
|
|
|
@@ -561,13 +557,19 @@ class Select extends React.Component {
|
|
|
561
557
|
}
|
|
562
558
|
|
|
563
559
|
this.isItMounted = true;
|
|
560
|
+
const {
|
|
561
|
+
controlRef
|
|
562
|
+
} = this.props;
|
|
564
563
|
|
|
565
|
-
if (
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
564
|
+
if (controlRef && typeof controlRef !== 'function') {
|
|
565
|
+
controlRef.current = {
|
|
566
|
+
setDropdownOpen: this.handleDropdownOpen.bind(this),
|
|
567
|
+
setInputValue: this.handleSetInputValue.bind(this),
|
|
568
|
+
setInputFocus: this.handleSetInputFocus.bind(this),
|
|
569
|
+
setInputBlur: this.handleSetInputBlur.bind(this),
|
|
570
|
+
// `focus` & `blur` below are for backwards compatibility and may be removed. Use setInputFocus and setInputBlur instead.
|
|
571
|
+
focus: this.handleSetInputFocus.bind(this),
|
|
572
|
+
blur: this.handleSetInputBlur.bind(this)
|
|
571
573
|
};
|
|
572
574
|
}
|
|
573
575
|
}
|
|
@@ -608,6 +610,20 @@ class Select extends React.Component {
|
|
|
608
610
|
this.setState({
|
|
609
611
|
isOpen: nextOpenState
|
|
610
612
|
});
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
handleSetInputValue(newInputValue) {
|
|
616
|
+
this.setState({
|
|
617
|
+
inputValue: newInputValue
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
handleSetInputFocus() {
|
|
622
|
+
this.input.focus();
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
handleSetInputBlur() {
|
|
626
|
+
this.input.blur();
|
|
611
627
|
} // Handle touch outside on mobile to dismiss menu, ensures that the
|
|
612
628
|
// touch target is not within the anchor DOM node.
|
|
613
629
|
|
|
@@ -512,12 +512,8 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
512
512
|
_defineProperty(_assertThisInitialized(_this), "handleInputRef", function (input) {
|
|
513
513
|
_this.input = input;
|
|
514
514
|
|
|
515
|
-
if (_this.props.controlRef) {
|
|
516
|
-
|
|
517
|
-
_this.props.controlRef(input);
|
|
518
|
-
} else {
|
|
519
|
-
_this.props.controlRef.current = input;
|
|
520
|
-
}
|
|
515
|
+
if (_this.props.controlRef && typeof _this.props.controlRef === 'function') {
|
|
516
|
+
_this.props.controlRef(input);
|
|
521
517
|
}
|
|
522
518
|
});
|
|
523
519
|
|
|
@@ -656,11 +652,17 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
656
652
|
}
|
|
657
653
|
|
|
658
654
|
this.isItMounted = true;
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
setDropdownOpen: this.handleDropdownOpen.bind(this)
|
|
655
|
+
var controlRef = this.props.controlRef;
|
|
656
|
+
|
|
657
|
+
if (controlRef && typeof controlRef !== 'function') {
|
|
658
|
+
controlRef.current = {
|
|
659
|
+
setDropdownOpen: this.handleDropdownOpen.bind(this),
|
|
660
|
+
setInputValue: this.handleSetInputValue.bind(this),
|
|
661
|
+
setInputFocus: this.handleSetInputFocus.bind(this),
|
|
662
|
+
setInputBlur: this.handleSetInputBlur.bind(this),
|
|
663
|
+
// `focus` & `blur` below are for backwards compatibility and may be removed. Use setInputFocus and setInputBlur instead.
|
|
664
|
+
focus: this.handleSetInputFocus.bind(this),
|
|
665
|
+
blur: this.handleSetInputBlur.bind(this)
|
|
664
666
|
};
|
|
665
667
|
}
|
|
666
668
|
}
|
|
@@ -705,6 +707,23 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
705
707
|
this.setState({
|
|
706
708
|
isOpen: nextOpenState
|
|
707
709
|
});
|
|
710
|
+
}
|
|
711
|
+
}, {
|
|
712
|
+
key: "handleSetInputValue",
|
|
713
|
+
value: function handleSetInputValue(newInputValue) {
|
|
714
|
+
this.setState({
|
|
715
|
+
inputValue: newInputValue
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
}, {
|
|
719
|
+
key: "handleSetInputFocus",
|
|
720
|
+
value: function handleSetInputFocus() {
|
|
721
|
+
this.input.focus();
|
|
722
|
+
}
|
|
723
|
+
}, {
|
|
724
|
+
key: "handleSetInputBlur",
|
|
725
|
+
value: function handleSetInputBlur() {
|
|
726
|
+
this.input.blur();
|
|
708
727
|
} // Handle touch outside on mobile to dismiss menu, ensures that the
|
|
709
728
|
// touch target is not within the anchor DOM node.
|
|
710
729
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baseui",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.12.0",
|
|
4
4
|
"description": "A React Component library implementing the Base design language",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -81,13 +81,13 @@
|
|
|
81
81
|
"@commitlint/config-conventional": "^8.0.0",
|
|
82
82
|
"@date-io/luxon": "^2.7.0",
|
|
83
83
|
"@date-io/moment": "^2.7.0",
|
|
84
|
-
"@ladle/react": "^0.
|
|
84
|
+
"@ladle/react": "^0.10.2",
|
|
85
85
|
"@mdx-js/tag": "^0.20.0",
|
|
86
86
|
"@octokit/rest": "^16.33.1",
|
|
87
87
|
"@svgr/cli": "^4.3.2",
|
|
88
|
-
"@testing-library/jest-dom": "^5.
|
|
89
|
-
"@testing-library/react": "^
|
|
90
|
-
"@testing-library/user-event": "^
|
|
88
|
+
"@testing-library/jest-dom": "^5.16.3",
|
|
89
|
+
"@testing-library/react": "^12.1.4",
|
|
90
|
+
"@testing-library/user-event": "^13.5.0",
|
|
91
91
|
"@types/babel__code-frame": "^7.0.1",
|
|
92
92
|
"@types/babel__core": "^7.1.3",
|
|
93
93
|
"@types/babel__generator": "^7.0.2",
|
|
@@ -168,10 +168,10 @@
|
|
|
168
168
|
"puppeteer": "^9.1.1",
|
|
169
169
|
"query-string": "^6.14.0",
|
|
170
170
|
"raw-loader": "^3.1.0",
|
|
171
|
-
"react": "^
|
|
171
|
+
"react": "^17.0.2",
|
|
172
172
|
"react-codesandboxer": "^3.1.5",
|
|
173
173
|
"react-compare-image": "^2.0.3",
|
|
174
|
-
"react-dom": "^
|
|
174
|
+
"react-dom": "^17.0.2",
|
|
175
175
|
"react-hook-form": "^7.9.0",
|
|
176
176
|
"react-icons": "^3.8.0",
|
|
177
177
|
"react-map-gl": "^5.3.19",
|
|
@@ -220,8 +220,8 @@
|
|
|
220
220
|
"resize-observer-polyfill": "^1.5.1"
|
|
221
221
|
},
|
|
222
222
|
"peerDependencies": {
|
|
223
|
-
"react": ">= 16.8.0 <
|
|
224
|
-
"react-dom": ">= 16.8.0 <
|
|
223
|
+
"react": ">= 16.8.0 < 19",
|
|
224
|
+
"react-dom": ">= 16.8.0 < 19",
|
|
225
225
|
"styletron-react": ">=5.2.2 < 7"
|
|
226
226
|
},
|
|
227
227
|
"resolutions": {
|
package/progress-bar/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {StyletronComponent} from 'styletron-react';
|
|
3
|
-
import {Override} from '../overrides';
|
|
2
|
+
import { StyletronComponent } from 'styletron-react';
|
|
3
|
+
import { Override } from '../overrides';
|
|
4
4
|
|
|
5
5
|
export interface SIZE {
|
|
6
6
|
small: 'small';
|
|
@@ -27,7 +27,7 @@ export interface ProgressBarProps {
|
|
|
27
27
|
steps?: number;
|
|
28
28
|
successValue?: number;
|
|
29
29
|
minValue?: number;
|
|
30
|
-
|
|
30
|
+
maxValue?: number;
|
|
31
31
|
value?: number;
|
|
32
32
|
}
|
|
33
33
|
export class ProgressBar extends React.Component<ProgressBarProps> {}
|
package/select/index.d.ts
CHANGED
|
@@ -47,6 +47,13 @@ export type filterOptions = (
|
|
|
47
47
|
}
|
|
48
48
|
) => Value;
|
|
49
49
|
|
|
50
|
+
export interface ImperativeMethods {
|
|
51
|
+
setInputFocus: () => void;
|
|
52
|
+
setInputBlur: () => void;
|
|
53
|
+
setDropdownOpen: (d: boolean) => void;
|
|
54
|
+
setInputValue: (s: string) => void;
|
|
55
|
+
}
|
|
56
|
+
|
|
50
57
|
export interface SelectOverrides {
|
|
51
58
|
Root?: Override<any>;
|
|
52
59
|
ControlContainer?: Override<any>;
|
|
@@ -104,7 +111,7 @@ export interface SelectProps {
|
|
|
104
111
|
}) => React.ReactNode;
|
|
105
112
|
getValueLabel?: (args: { option: Option }) => React.ReactNode;
|
|
106
113
|
id?: string;
|
|
107
|
-
controlRef?: React.Ref<
|
|
114
|
+
controlRef?: React.Ref<ImperativeMethods>;
|
|
108
115
|
isLoading?: boolean;
|
|
109
116
|
labelKey?: string;
|
|
110
117
|
startOpen?: boolean;
|
|
@@ -532,12 +532,8 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
532
532
|
_defineProperty(_assertThisInitialized(_this), "handleInputRef", function (input) {
|
|
533
533
|
_this.input = input;
|
|
534
534
|
|
|
535
|
-
if (_this.props.controlRef) {
|
|
536
|
-
|
|
537
|
-
_this.props.controlRef(input);
|
|
538
|
-
} else {
|
|
539
|
-
_this.props.controlRef.current = input;
|
|
540
|
-
}
|
|
535
|
+
if (_this.props.controlRef && typeof _this.props.controlRef === 'function') {
|
|
536
|
+
_this.props.controlRef(input);
|
|
541
537
|
}
|
|
542
538
|
});
|
|
543
539
|
|
|
@@ -676,11 +672,17 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
676
672
|
}
|
|
677
673
|
|
|
678
674
|
this.isItMounted = true;
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
setDropdownOpen: this.handleDropdownOpen.bind(this)
|
|
675
|
+
var controlRef = this.props.controlRef;
|
|
676
|
+
|
|
677
|
+
if (controlRef && typeof controlRef !== 'function') {
|
|
678
|
+
controlRef.current = {
|
|
679
|
+
setDropdownOpen: this.handleDropdownOpen.bind(this),
|
|
680
|
+
setInputValue: this.handleSetInputValue.bind(this),
|
|
681
|
+
setInputFocus: this.handleSetInputFocus.bind(this),
|
|
682
|
+
setInputBlur: this.handleSetInputBlur.bind(this),
|
|
683
|
+
// `focus` & `blur` below are for backwards compatibility and may be removed. Use setInputFocus and setInputBlur instead.
|
|
684
|
+
focus: this.handleSetInputFocus.bind(this),
|
|
685
|
+
blur: this.handleSetInputBlur.bind(this)
|
|
684
686
|
};
|
|
685
687
|
}
|
|
686
688
|
}
|
|
@@ -725,6 +727,23 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
725
727
|
this.setState({
|
|
726
728
|
isOpen: nextOpenState
|
|
727
729
|
});
|
|
730
|
+
}
|
|
731
|
+
}, {
|
|
732
|
+
key: "handleSetInputValue",
|
|
733
|
+
value: function handleSetInputValue(newInputValue) {
|
|
734
|
+
this.setState({
|
|
735
|
+
inputValue: newInputValue
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
}, {
|
|
739
|
+
key: "handleSetInputFocus",
|
|
740
|
+
value: function handleSetInputFocus() {
|
|
741
|
+
this.input.focus();
|
|
742
|
+
}
|
|
743
|
+
}, {
|
|
744
|
+
key: "handleSetInputBlur",
|
|
745
|
+
value: function handleSetInputBlur() {
|
|
746
|
+
this.input.blur();
|
|
728
747
|
} // Handle touch outside on mobile to dismiss menu, ensures that the
|
|
729
748
|
// touch target is not within the anchor DOM node.
|
|
730
749
|
|
|
@@ -118,11 +118,16 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
118
118
|
}
|
|
119
119
|
this.isItMounted = true;
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
methodsRef.current = {
|
|
121
|
+
const { controlRef } = this.props;
|
|
122
|
+
if (controlRef && typeof controlRef !== 'function') {
|
|
123
|
+
controlRef.current = {
|
|
125
124
|
setDropdownOpen: this.handleDropdownOpen.bind(this),
|
|
125
|
+
setInputValue: this.handleSetInputValue.bind(this),
|
|
126
|
+
setInputFocus: this.handleSetInputFocus.bind(this),
|
|
127
|
+
setInputBlur: this.handleSetInputBlur.bind(this),
|
|
128
|
+
// `focus` & `blur` below are for backwards compatibility and may be removed. Use setInputFocus and setInputBlur instead.
|
|
129
|
+
focus: this.handleSetInputFocus.bind(this),
|
|
130
|
+
blur: this.handleSetInputBlur.bind(this),
|
|
126
131
|
};
|
|
127
132
|
}
|
|
128
133
|
}
|
|
@@ -164,6 +169,20 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
164
169
|
});
|
|
165
170
|
}
|
|
166
171
|
|
|
172
|
+
handleSetInputValue(newInputValue: string) {
|
|
173
|
+
this.setState({
|
|
174
|
+
inputValue: newInputValue,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
handleSetInputFocus() {
|
|
179
|
+
this.input.focus();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
handleSetInputBlur() {
|
|
183
|
+
this.input.blur();
|
|
184
|
+
}
|
|
185
|
+
|
|
167
186
|
// Handle touch outside on mobile to dismiss menu, ensures that the
|
|
168
187
|
// touch target is not within the anchor DOM node.
|
|
169
188
|
handleTouchOutside = (event: TouchEvent) => {
|
|
@@ -479,15 +498,13 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
479
498
|
}
|
|
480
499
|
};
|
|
481
500
|
|
|
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.
|
|
482
503
|
//flowlint-next-line unclear-type:off
|
|
483
504
|
handleInputRef = (input: React.ElementRef<any>) => {
|
|
484
505
|
this.input = input;
|
|
485
|
-
if (this.props.controlRef) {
|
|
486
|
-
|
|
487
|
-
this.props.controlRef(input);
|
|
488
|
-
} else {
|
|
489
|
-
this.props.controlRef.current = input;
|
|
490
|
-
}
|
|
506
|
+
if (this.props.controlRef && typeof this.props.controlRef === 'function') {
|
|
507
|
+
this.props.controlRef(input);
|
|
491
508
|
}
|
|
492
509
|
};
|
|
493
510
|
|
package/select/types.js.flow
CHANGED
|
@@ -73,11 +73,17 @@ export type OverridesDropdownT = {
|
|
|
73
73
|
StatefulMenu?: OverrideT,
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
type
|
|
76
|
+
type ImperativeMethodsT = {|
|
|
77
77
|
setDropdownOpen: (boolean) => mixed,
|
|
78
|
+
setInputValue: (string) => void,
|
|
79
|
+
setInputFocus: () => void,
|
|
80
|
+
setInputBlur: () => void,
|
|
81
|
+
// these below are for backwards compatibility and may be removed. Don't use them.
|
|
82
|
+
focus: () => void,
|
|
83
|
+
blur: () => void,
|
|
78
84
|
|};
|
|
79
|
-
export type
|
|
80
|
-
current:
|
|
85
|
+
export type ControlRefT = {
|
|
86
|
+
current: ImperativeMethodsT | null,
|
|
81
87
|
};
|
|
82
88
|
|
|
83
89
|
export type PropsT = {
|
|
@@ -132,8 +138,8 @@ export type PropsT = {
|
|
|
132
138
|
id?: string,
|
|
133
139
|
/** Defines if the comparison for a new creatable value should be case-insensitive. */
|
|
134
140
|
ignoreCase?: boolean,
|
|
135
|
-
/**
|
|
136
|
-
controlRef?:
|
|
141
|
+
/** An imperative handle exposing internal methods. */
|
|
142
|
+
controlRef?: ControlRefT,
|
|
137
143
|
/** Defines if the select is in a loading (async) state. */
|
|
138
144
|
isLoading: boolean,
|
|
139
145
|
/** Defines an option key for a default label value. */
|
|
@@ -142,8 +148,6 @@ export type PropsT = {
|
|
|
142
148
|
maxDropdownHeight: string,
|
|
143
149
|
/** Defines if multiple options can be selected. */
|
|
144
150
|
multi: boolean,
|
|
145
|
-
/** Handle for accessing internal methods. */
|
|
146
|
-
methodsRef?: MethodsRefT,
|
|
147
151
|
/** Message to be displayed if no options is found for a search query. */
|
|
148
152
|
noResultsMsg?: React.Node,
|
|
149
153
|
onBlur: (e: Event) => mixed,
|