@patternfly/react-core 4.220.0 → 4.221.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/CHANGELOG.md +27 -0
- package/dist/esm/components/InputGroup/InputGroup.d.ts +2 -0
- package/dist/esm/components/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/esm/components/InputGroup/InputGroup.js +3 -2
- package/dist/esm/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts +2 -0
- package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
- package/dist/esm/components/SearchInput/AdvancedSearchMenu.js +12 -10
- package/dist/esm/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.d.ts +8 -0
- package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +38 -28
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +2 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.js +3 -2
- package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +2 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +3 -2
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
- package/dist/js/components/InputGroup/InputGroup.d.ts +2 -0
- package/dist/js/components/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/js/components/InputGroup/InputGroup.js +3 -2
- package/dist/js/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts +2 -0
- package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
- package/dist/js/components/SearchInput/AdvancedSearchMenu.js +12 -10
- package/dist/js/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.d.ts +8 -0
- package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.js +38 -28
- package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +2 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.js +3 -2
- package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +2 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js +3 -2
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
- package/dist/umd/react-core.js +323 -289
- package/dist/umd/react-core.min.js +6 -6
- package/package.json +5 -5
- package/src/components/InputGroup/InputGroup.tsx +7 -1
- package/src/components/SearchInput/AdvancedSearchMenu.tsx +24 -18
- package/src/components/SearchInput/SearchInput.tsx +130 -113
- package/src/components/SearchInput/__tests__/SearchInput.test.tsx +1 -1
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +297 -301
- package/src/components/SearchInput/examples/SearchInput.md +5 -2
- package/src/components/TextInputGroup/TextInputGroup.tsx +18 -7
- package/src/components/TextInputGroup/TextInputGroupMain.tsx +5 -0
|
@@ -99,7 +99,9 @@ class SearchInputWithNavigableOptions extends React.Component {
|
|
|
99
99
|
this.state = {
|
|
100
100
|
value: '',
|
|
101
101
|
resultsCount: 0,
|
|
102
|
-
currentResult: 1
|
|
102
|
+
currentResult: 1,
|
|
103
|
+
isPreviousNavigationButtonDisabled: false,
|
|
104
|
+
isNextNavigationButtonDisabled: false
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
this.onChange = (value, event) => {
|
|
@@ -135,7 +137,6 @@ class SearchInputWithNavigableOptions extends React.Component {
|
|
|
135
137
|
});
|
|
136
138
|
};
|
|
137
139
|
}
|
|
138
|
-
|
|
139
140
|
render() {
|
|
140
141
|
return (
|
|
141
142
|
<SearchInput
|
|
@@ -143,6 +144,8 @@ class SearchInputWithNavigableOptions extends React.Component {
|
|
|
143
144
|
value={this.state.value}
|
|
144
145
|
onChange={this.onChange}
|
|
145
146
|
onClear={this.onClear}
|
|
147
|
+
isNextNavigationButtonDisabled={this.state.currentResult === 3}
|
|
148
|
+
isPreviousNavigationButtonDisabled={this.state.currentResult === 1}
|
|
146
149
|
resultsCount={`${this.state.currentResult} / ${this.state.resultsCount}`}
|
|
147
150
|
onNextClick={this.onNext}
|
|
148
151
|
onPreviousClick={this.onPrevious}
|
|
@@ -9,6 +9,8 @@ export interface TextInputGroupProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
9
9
|
className?: string;
|
|
10
10
|
/** Adds disabled styling and a disabled context value which text input group main hooks into for the input itself */
|
|
11
11
|
isDisabled?: boolean;
|
|
12
|
+
/** @hide A reference object to attach to the input box */
|
|
13
|
+
innerRef?: React.RefObject<any>;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export const TextInputGroupContext = React.createContext<Partial<TextInputGroupProps>>({
|
|
@@ -19,13 +21,22 @@ export const TextInputGroup: React.FunctionComponent<TextInputGroupProps> = ({
|
|
|
19
21
|
children,
|
|
20
22
|
className,
|
|
21
23
|
isDisabled,
|
|
24
|
+
innerRef,
|
|
22
25
|
...props
|
|
23
|
-
}: TextInputGroupProps) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
}: TextInputGroupProps) => {
|
|
27
|
+
const textInputGroupRef = innerRef || React.useRef(null);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<TextInputGroupContext.Provider value={{ isDisabled }}>
|
|
31
|
+
<div
|
|
32
|
+
ref={textInputGroupRef}
|
|
33
|
+
className={css(styles.textInputGroup, isDisabled && styles.modifiers.disabled, className)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</div>
|
|
38
|
+
</TextInputGroupContext.Provider>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
30
41
|
|
|
31
42
|
TextInputGroup.displayName = 'TextInputGroup';
|
|
@@ -37,6 +37,8 @@ export interface TextInputGroupMainProps extends Omit<React.HTMLProps<HTMLDivEle
|
|
|
37
37
|
value?: string | number;
|
|
38
38
|
/** Placeholder value for the input */
|
|
39
39
|
placeholder?: string;
|
|
40
|
+
/** @hide A reference object to attach to the input box */
|
|
41
|
+
innerRef?: React.RefObject<any>;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps> = ({
|
|
@@ -51,9 +53,11 @@ export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps
|
|
|
51
53
|
'aria-label': ariaLabel = 'Type to filter',
|
|
52
54
|
value: inputValue,
|
|
53
55
|
placeholder: inputPlaceHolder,
|
|
56
|
+
innerRef,
|
|
54
57
|
...props
|
|
55
58
|
}: TextInputGroupMainProps) => {
|
|
56
59
|
const { isDisabled } = React.useContext(TextInputGroupContext);
|
|
60
|
+
const textInputGroupInputInputRef = innerRef || React.useRef(null);
|
|
57
61
|
|
|
58
62
|
const handleChange = (event: React.FormEvent<HTMLInputElement>) => {
|
|
59
63
|
onChange(event.currentTarget.value, event);
|
|
@@ -74,6 +78,7 @@ export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps
|
|
|
74
78
|
)}
|
|
75
79
|
{icon && <span className={css(styles.textInputGroupIcon)}>{icon}</span>}
|
|
76
80
|
<input
|
|
81
|
+
ref={textInputGroupInputInputRef}
|
|
77
82
|
type={type}
|
|
78
83
|
className={css(styles.textInputGroupTextInput)}
|
|
79
84
|
aria-label={ariaLabel}
|