@patternfly/react-core 6.3.0-prerelease.24 → 6.3.0-prerelease.26
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 +12 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Content/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
- package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/esm/components/SearchInput/SearchInput.d.ts +2 -0
- package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +35 -11
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/Tabs/TabsContext.d.ts +1 -1
- package/dist/esm/components/Tabs/TabsContext.d.ts.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.d.ts +2 -0
- package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.js +34 -10
- package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/js/components/Tabs/TabsContext.d.ts +1 -1
- package/dist/js/components/Tabs/TabsContext.d.ts.map +1 -1
- package/dist/umd/assets/{output-F0J9fqfn.css → output-ZKJooW_2.css} +19898 -19898
- package/dist/umd/react-core.min.js +2 -2
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +6 -6
- package/src/components/SearchInput/SearchInput.tsx +103 -14
- package/src/components/SearchInput/__tests__/SearchInput.test.tsx +84 -0
- package/src/components/SearchInput/examples/SearchInput.md +11 -2
- package/src/components/SearchInput/examples/SearchInputWithExpandable.tsx +6 -1
- package/src/components/Tabs/TabsContext.ts +1 -1
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.3.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.3.0-prerelease.25","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.3.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.3.0-prerelease.25","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.3.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.3.0-prerelease.25","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.3.0-prerelease.
|
|
3
|
+
"version": "6.3.0-prerelease.26",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"subpaths": "node ../../scripts/exportSubpaths.mjs --config subpaths.config.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@patternfly/react-icons": "^6.3.0-prerelease.
|
|
50
|
-
"@patternfly/react-styles": "^6.3.0-prerelease.
|
|
51
|
-
"@patternfly/react-tokens": "^6.3.0-prerelease.
|
|
49
|
+
"@patternfly/react-icons": "^6.3.0-prerelease.8",
|
|
50
|
+
"@patternfly/react-styles": "^6.3.0-prerelease.8",
|
|
51
|
+
"@patternfly/react-tokens": "^6.3.0-prerelease.8",
|
|
52
52
|
"focus-trap": "7.6.4",
|
|
53
53
|
"react-dropzone": "^14.3.5",
|
|
54
54
|
"tslib": "^2.8.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@patternfly/patternfly": "6.3.0-prerelease.
|
|
57
|
+
"@patternfly/patternfly": "6.3.0-prerelease.35",
|
|
58
58
|
"case-anything": "^3.1.2",
|
|
59
59
|
"css": "^3.0.0",
|
|
60
60
|
"fs-extra": "^11.3.0"
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": "^17 || ^18 || ^19",
|
|
64
64
|
"react-dom": "^17 || ^18 || ^19"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "f7974fbc0bcfaeff92cb05a4604bb48f4df54375"
|
|
67
67
|
}
|
|
@@ -14,6 +14,7 @@ import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities } from '../
|
|
|
14
14
|
import { InputGroup, InputGroupItem } from '../InputGroup';
|
|
15
15
|
import { Popper } from '../../helpers';
|
|
16
16
|
import textInputGroupStyles from '@patternfly/react-styles/css/components/TextInputGroup/text-input-group';
|
|
17
|
+
import inputGroupStyles from '@patternfly/react-styles/css/components/InputGroup/input-group';
|
|
17
18
|
|
|
18
19
|
/** Properties for adding search attributes to an advanced search input. These properties must
|
|
19
20
|
* be passed in as an object within an array to the search input component's attribute property.
|
|
@@ -41,6 +42,8 @@ export interface SearchInputExpandable {
|
|
|
41
42
|
onToggleExpand: (event: React.SyntheticEvent<HTMLButtonElement>, isExpanded: boolean) => void;
|
|
42
43
|
/** An accessible label for the expandable search input toggle. */
|
|
43
44
|
toggleAriaLabel: string;
|
|
45
|
+
/** Flag indicating animations should be enabled when the search input expands and collapses. Note: this will change the component's DOM structure. In a future breaking change release, this will become the default behavior and will no longer be needed. */
|
|
46
|
+
hasAnimations?: boolean;
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
/** The main search input component. */
|
|
@@ -177,7 +180,7 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
|
|
|
177
180
|
const popperRef = useRef(null);
|
|
178
181
|
const [focusAfterExpandChange, setFocusAfterExpandChange] = useState(false);
|
|
179
182
|
|
|
180
|
-
const { isExpanded, onToggleExpand, toggleAriaLabel } = expandableInput || {};
|
|
183
|
+
const { isExpanded, onToggleExpand, toggleAriaLabel, hasAnimations } = expandableInput || {};
|
|
181
184
|
|
|
182
185
|
useEffect(() => {
|
|
183
186
|
// this effect and the focusAfterExpandChange variable are needed to focus the input/toggle as needed when the
|
|
@@ -187,9 +190,13 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
|
|
|
187
190
|
} else if (isExpanded) {
|
|
188
191
|
searchInputInputRef?.current?.focus();
|
|
189
192
|
} else {
|
|
190
|
-
|
|
193
|
+
if (!hasAnimations) {
|
|
194
|
+
searchInputExpandableToggleRef?.current?.focus();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (!hasAnimations) {
|
|
198
|
+
setFocusAfterExpandChange(false);
|
|
191
199
|
}
|
|
192
|
-
setFocusAfterExpandChange(false);
|
|
193
200
|
}, [focusAfterExpandChange, isExpanded, searchInputInputRef, searchInputExpandableToggleRef]);
|
|
194
201
|
|
|
195
202
|
useEffect(() => {
|
|
@@ -349,7 +356,28 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
|
|
|
349
356
|
</TextInputGroup>
|
|
350
357
|
);
|
|
351
358
|
|
|
352
|
-
const
|
|
359
|
+
const expandToggleButton = (
|
|
360
|
+
<Button
|
|
361
|
+
variant={ButtonVariant.plain}
|
|
362
|
+
aria-label={toggleAriaLabel}
|
|
363
|
+
aria-expanded={isExpanded}
|
|
364
|
+
icon={<SearchIcon />}
|
|
365
|
+
onClick={onExpandHandler}
|
|
366
|
+
ref={searchInputExpandableToggleRef}
|
|
367
|
+
/>
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
const collapseToggleButton = (
|
|
371
|
+
<Button
|
|
372
|
+
variant={ButtonVariant.plain}
|
|
373
|
+
aria-label={toggleAriaLabel}
|
|
374
|
+
aria-expanded={isExpanded}
|
|
375
|
+
icon={<TimesIcon />}
|
|
376
|
+
onClick={onExpandHandler}
|
|
377
|
+
/>
|
|
378
|
+
);
|
|
379
|
+
|
|
380
|
+
const singleButtonToggle = (
|
|
353
381
|
<Button
|
|
354
382
|
variant={ButtonVariant.plain}
|
|
355
383
|
aria-label={toggleAriaLabel}
|
|
@@ -360,10 +388,48 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
|
|
|
360
388
|
/>
|
|
361
389
|
);
|
|
362
390
|
|
|
363
|
-
const
|
|
391
|
+
const onTransitionEnd = () => {
|
|
392
|
+
!isExpanded && focusAfterExpandChange && searchInputExpandableToggleRef?.current?.focus();
|
|
393
|
+
setFocusAfterExpandChange(false);
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const expandableToggle = (
|
|
397
|
+
<>
|
|
398
|
+
{!hasAnimations && <InputGroupItem isPlain>{singleButtonToggle}</InputGroupItem>}
|
|
399
|
+
{hasAnimations && (
|
|
400
|
+
<>
|
|
401
|
+
<InputGroupItem
|
|
402
|
+
className={inputGroupStyles.modifiers.searchExpand}
|
|
403
|
+
isPlain
|
|
404
|
+
onTransitionEnd={onTransitionEnd}
|
|
405
|
+
{...(isExpanded && { inert: '' })}
|
|
406
|
+
>
|
|
407
|
+
{expandToggleButton}
|
|
408
|
+
</InputGroupItem>
|
|
409
|
+
<InputGroupItem
|
|
410
|
+
className={inputGroupStyles.modifiers.searchAction}
|
|
411
|
+
isPlain
|
|
412
|
+
{...(!isExpanded && { inert: '' })}
|
|
413
|
+
>
|
|
414
|
+
{collapseToggleButton}
|
|
415
|
+
</InputGroupItem>
|
|
416
|
+
</>
|
|
417
|
+
)}
|
|
418
|
+
</>
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
const buildExpandableSearchInput = ({ ...searchInputProps }: any = {}) => (
|
|
364
422
|
<InputGroup {...searchInputProps}>
|
|
365
|
-
<InputGroupItem
|
|
366
|
-
|
|
423
|
+
<InputGroupItem
|
|
424
|
+
{...(!hasAnimations && { isFill: true })}
|
|
425
|
+
{...(hasAnimations && { className: inputGroupStyles.modifiers.searchInput })}
|
|
426
|
+
{...(!isExpanded && {
|
|
427
|
+
inert: ''
|
|
428
|
+
})}
|
|
429
|
+
>
|
|
430
|
+
{buildTextInputGroup()}
|
|
431
|
+
</InputGroupItem>
|
|
432
|
+
{expandableToggle}
|
|
367
433
|
</InputGroup>
|
|
368
434
|
);
|
|
369
435
|
|
|
@@ -377,9 +443,19 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
|
|
|
377
443
|
|
|
378
444
|
const buildSearchTextInputGroupWithExtraButtons = ({ ...searchInputProps } = {}) => (
|
|
379
445
|
<InputGroup ref={triggerRef} {...searchInputProps}>
|
|
380
|
-
<InputGroupItem
|
|
446
|
+
<InputGroupItem
|
|
447
|
+
{...(!hasAnimations && { isFill: true })}
|
|
448
|
+
{...(expandableInput && hasAnimations && { className: inputGroupStyles.modifiers.searchInput })}
|
|
449
|
+
{...(expandableInput &&
|
|
450
|
+
hasAnimations &&
|
|
451
|
+
!isExpanded && {
|
|
452
|
+
inert: ''
|
|
453
|
+
})}
|
|
454
|
+
>
|
|
455
|
+
{buildTextInputGroup()}
|
|
456
|
+
</InputGroupItem>
|
|
381
457
|
{(attributes.length > 0 || onToggleAdvancedSearch) && (
|
|
382
|
-
<InputGroupItem isPlain>
|
|
458
|
+
<InputGroupItem isPlain {...(hasAnimations && { className: inputGroupStyles.modifiers.searchAction })}>
|
|
383
459
|
<Button
|
|
384
460
|
className={isSearchMenuOpen && 'pf-m-expanded'}
|
|
385
461
|
variant={ButtonVariant.control}
|
|
@@ -392,7 +468,7 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
|
|
|
392
468
|
</InputGroupItem>
|
|
393
469
|
)}
|
|
394
470
|
{!!onSearch && (
|
|
395
|
-
<InputGroupItem>
|
|
471
|
+
<InputGroupItem {...(hasAnimations && { className: inputGroupStyles.modifiers.searchAction })}>
|
|
396
472
|
<Button
|
|
397
473
|
type="submit"
|
|
398
474
|
variant={ButtonVariant.control}
|
|
@@ -413,11 +489,15 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
|
|
|
413
489
|
|
|
414
490
|
const searchInputProps = {
|
|
415
491
|
...props,
|
|
416
|
-
className:
|
|
492
|
+
className: css(
|
|
493
|
+
expandableInput && hasAnimations && inputGroupStyles.modifiers.searchExpandable,
|
|
494
|
+
expandableInput && hasAnimations && isExpanded && inputGroupStyles.modifiers.expanded,
|
|
495
|
+
className && css(className)
|
|
496
|
+
),
|
|
417
497
|
innerRef: searchInputRef
|
|
418
498
|
};
|
|
419
499
|
|
|
420
|
-
if (!!expandableInput && !isExpanded) {
|
|
500
|
+
if (!!expandableInput && !isExpanded && !hasAnimations) {
|
|
421
501
|
return (
|
|
422
502
|
<InputGroup {...searchInputProps}>
|
|
423
503
|
<InputGroupItem>{expandableToggle}</InputGroupItem>
|
|
@@ -449,10 +529,19 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
|
|
|
449
529
|
</div>
|
|
450
530
|
);
|
|
451
531
|
|
|
532
|
+
const advancedSearchInputProps = hasAnimations
|
|
533
|
+
? {
|
|
534
|
+
className: css(
|
|
535
|
+
expandableInput && inputGroupStyles.modifiers.searchExpandable,
|
|
536
|
+
expandableInput && isExpanded && inputGroupStyles.modifiers.expanded
|
|
537
|
+
)
|
|
538
|
+
}
|
|
539
|
+
: {};
|
|
540
|
+
|
|
452
541
|
const AdvancedSearchWithPopper = (
|
|
453
542
|
<div className={css(className)} ref={searchInputRef} {...props}>
|
|
454
543
|
<Popper
|
|
455
|
-
trigger={buildSearchTextInputGroupWithExtraButtons()}
|
|
544
|
+
trigger={buildSearchTextInputGroupWithExtraButtons(advancedSearchInputProps)}
|
|
456
545
|
triggerRef={triggerRef}
|
|
457
546
|
popper={AdvancedSearch}
|
|
458
547
|
popperRef={popperRef}
|
|
@@ -466,7 +555,7 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
|
|
|
466
555
|
|
|
467
556
|
const AdvancedSearchInline = (
|
|
468
557
|
<div className={css(className)} ref={searchInputRef} {...props}>
|
|
469
|
-
{buildSearchTextInputGroupWithExtraButtons()}
|
|
558
|
+
{buildSearchTextInputGroupWithExtraButtons(advancedSearchInputProps)}
|
|
470
559
|
{AdvancedSearch}
|
|
471
560
|
</div>
|
|
472
561
|
);
|
|
@@ -8,6 +8,7 @@ import { Button } from '../../Button';
|
|
|
8
8
|
import ExternalLinkSquareAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon';
|
|
9
9
|
import badgeStyles from '@patternfly/react-styles/css/components/Badge/badge';
|
|
10
10
|
import textInputGroupStyles from '@patternfly/react-styles/css/components/TextInputGroup/text-input-group';
|
|
11
|
+
import inputGroupStyles from '@patternfly/react-styles/css/components/InputGroup/input-group';
|
|
11
12
|
|
|
12
13
|
jest.mock('../../../helpers/OUIA/ouia');
|
|
13
14
|
jest.mock('../../../helpers/GenerateId/GenerateId');
|
|
@@ -234,6 +235,89 @@ test('text input is rendered when isExpanded is true', () => {
|
|
|
234
235
|
expect(screen.getByRole('textbox')).toBeVisible();
|
|
235
236
|
});
|
|
236
237
|
|
|
238
|
+
test('animate classes & inert are not rendered when hasAnimations is false', () => {
|
|
239
|
+
render(
|
|
240
|
+
<SearchInput
|
|
241
|
+
data-testid="test-id"
|
|
242
|
+
expandableInput={{
|
|
243
|
+
hasAnimations: false,
|
|
244
|
+
isExpanded: true,
|
|
245
|
+
onToggleExpand: () => {},
|
|
246
|
+
toggleAriaLabel: 'Test label'
|
|
247
|
+
}}
|
|
248
|
+
/>
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
expect(screen.getByTestId('test-id')).not.toHaveClass(`${inputGroupStyles.modifiers.searchExpandable}`);
|
|
252
|
+
expect(screen.getByTestId('test-id')).not.toHaveClass(`${inputGroupStyles.modifiers.expanded}`);
|
|
253
|
+
|
|
254
|
+
expect(screen.getByTestId('test-id').children[0]).not.toHaveClass(`${inputGroupStyles.modifiers.searchInput}`);
|
|
255
|
+
expect(screen.getByTestId('test-id').children[0].parentElement).not.toHaveAttribute('inert', '');
|
|
256
|
+
|
|
257
|
+
expect(screen.getAllByRole('button')).toHaveLength(1);
|
|
258
|
+
expect(screen.getAllByRole('button')[0].parentElement).not.toHaveClass(`${inputGroupStyles.modifiers.searchExpand}`);
|
|
259
|
+
expect(screen.getAllByRole('button')[0].parentElement).not.toHaveClass(`${inputGroupStyles.modifiers.searchAction}`);
|
|
260
|
+
expect(screen.getAllByRole('button')[0].parentElement).not.toHaveAttribute('inert', '');
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
test('animate classes & inert are properly rendered when hasAnimations is true and isExpanded is false', () => {
|
|
264
|
+
render(
|
|
265
|
+
<SearchInput
|
|
266
|
+
data-testid="test-id"
|
|
267
|
+
expandableInput={{
|
|
268
|
+
hasAnimations: true,
|
|
269
|
+
isExpanded: false,
|
|
270
|
+
onToggleExpand: () => {},
|
|
271
|
+
toggleAriaLabel: 'Test label'
|
|
272
|
+
}}
|
|
273
|
+
/>
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
expect(screen.getByTestId('test-id')).toHaveClass(`${inputGroupStyles.modifiers.searchExpandable}`);
|
|
277
|
+
expect(screen.getByTestId('test-id')).not.toHaveClass(`${inputGroupStyles.modifiers.expanded}`);
|
|
278
|
+
|
|
279
|
+
expect(screen.getByTestId('test-id').querySelector(`.${inputGroupStyles.modifiers.searchInput}`)).toBeInTheDocument();
|
|
280
|
+
expect(screen.getByTestId('test-id').querySelector(`.${inputGroupStyles.modifiers.searchInput}`)).toHaveAttribute(
|
|
281
|
+
'inert',
|
|
282
|
+
''
|
|
283
|
+
);
|
|
284
|
+
expect(screen.getAllByRole('button')).toHaveLength(2);
|
|
285
|
+
expect(screen.getAllByRole('button')[0].parentElement).toHaveClass(`${inputGroupStyles.modifiers.searchExpand}`);
|
|
286
|
+
expect(screen.getAllByRole('button')[0].parentElement).not.toHaveAttribute('inert', '');
|
|
287
|
+
|
|
288
|
+
expect(screen.getAllByRole('button')[1].parentElement).toHaveClass(`${inputGroupStyles.modifiers.searchAction}`);
|
|
289
|
+
expect(screen.getAllByRole('button')[1].parentElement).toHaveAttribute('inert', '');
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
test('animate classes and inert are properly rendered when hasAnimations and isExpanded are true', () => {
|
|
293
|
+
render(
|
|
294
|
+
<SearchInput
|
|
295
|
+
data-testid="test-id"
|
|
296
|
+
expandableInput={{
|
|
297
|
+
hasAnimations: true,
|
|
298
|
+
isExpanded: true,
|
|
299
|
+
onToggleExpand: () => {},
|
|
300
|
+
toggleAriaLabel: 'Test label'
|
|
301
|
+
}}
|
|
302
|
+
/>
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
expect(screen.getByTestId('test-id')).toHaveClass(`${inputGroupStyles.modifiers.searchExpandable}`);
|
|
306
|
+
expect(screen.getByTestId('test-id')).toHaveClass(`${inputGroupStyles.modifiers.expanded}`);
|
|
307
|
+
|
|
308
|
+
expect(screen.getByTestId('test-id').querySelector(`.${inputGroupStyles.modifiers.searchInput}`)).toBeInTheDocument();
|
|
309
|
+
expect(screen.getByTestId('test-id').querySelector(`.${inputGroupStyles.modifiers.searchInput}`)).not.toHaveAttribute(
|
|
310
|
+
'inert',
|
|
311
|
+
''
|
|
312
|
+
);
|
|
313
|
+
expect(screen.getAllByRole('button')).toHaveLength(2);
|
|
314
|
+
expect(screen.getAllByRole('button')[0].parentElement).toHaveClass(`${inputGroupStyles.modifiers.searchExpand}`);
|
|
315
|
+
expect(screen.getAllByRole('button')[0].parentElement).toHaveAttribute('inert', '');
|
|
316
|
+
|
|
317
|
+
expect(screen.getAllByRole('button')[1].parentElement).toHaveClass(`${inputGroupStyles.modifiers.searchAction}`);
|
|
318
|
+
expect(screen.getAllByRole('button')[1].parentElement).not.toHaveAttribute('inert', '');
|
|
319
|
+
});
|
|
320
|
+
|
|
237
321
|
test('onToggleExpand is not called if the expandable toggle is not clicked', () => {
|
|
238
322
|
const mockOnToggleExpand = jest.fn();
|
|
239
323
|
|
|
@@ -13,39 +13,47 @@ import { ExternalLinkSquareAltIcon } from '@patternfly/react-icons';
|
|
|
13
13
|
### Basic
|
|
14
14
|
|
|
15
15
|
```ts file='./SearchInputBasic.tsx'
|
|
16
|
+
|
|
16
17
|
```
|
|
17
18
|
|
|
18
19
|
### Match with result count
|
|
19
20
|
|
|
20
21
|
```ts file='./SearchInputWithResultCount.tsx'
|
|
22
|
+
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
### Match with navigable options
|
|
24
26
|
|
|
25
27
|
```ts file='./SearchInputWithNavigableOptions.tsx'
|
|
28
|
+
|
|
26
29
|
```
|
|
27
30
|
|
|
28
31
|
### With submit button
|
|
29
32
|
|
|
30
33
|
```ts file='./SearchInputWithSubmitButton.tsx'
|
|
34
|
+
|
|
31
35
|
```
|
|
32
36
|
|
|
33
37
|
### Focus search input using ref
|
|
34
38
|
|
|
35
39
|
```ts file='./SearchInputFocusSearch.tsx'
|
|
40
|
+
|
|
36
41
|
```
|
|
37
42
|
|
|
38
43
|
### With expandable button
|
|
39
44
|
|
|
45
|
+
Animations on the expansion and collapse of the search input may be opted into by passing `hasAnimations` to the `expandableInput` object.
|
|
46
|
+
|
|
40
47
|
```ts file='./SearchInputWithExpandable.tsx'
|
|
48
|
+
|
|
41
49
|
```
|
|
42
50
|
|
|
43
51
|
### Advanced
|
|
44
52
|
|
|
45
53
|
The search input component can be used to dynamically build a one to one attribute-value advanced search.
|
|
46
54
|
Using the `attributes` prop alongside the `advancedSearchDelimiter` will expose this functionality, as demonstrated in
|
|
47
|
-
the following example. The search input component can also be used as a composable component and paired with a Popper
|
|
48
|
-
or other elements to build a completely custom advanced search form. This feature is demonstrated
|
|
55
|
+
the following example. The search input component can also be used as a composable component and paired with a Popper
|
|
56
|
+
or other elements to build a completely custom advanced search form. This feature is demonstrated
|
|
49
57
|
in the search input's <a href="/components/search-input/react-demos">react demos</a>.
|
|
50
58
|
|
|
51
59
|
The values used in the attribute-value form fields may contain spaces. The values containing spaces
|
|
@@ -53,4 +61,5 @@ should be wrapped with quotes inside the summary search string in the input fiel
|
|
|
53
61
|
autogenerated from the individual fields the quotes will be autoplaced.
|
|
54
62
|
|
|
55
63
|
```ts file='./SearchInputAdvanced.tsx'
|
|
64
|
+
|
|
56
65
|
```
|
|
@@ -20,7 +20,12 @@ export const SearchInputWithExpandable: React.FunctionComponent = () => {
|
|
|
20
20
|
value={value}
|
|
21
21
|
onChange={(_event, value) => onChange(value)}
|
|
22
22
|
onClear={() => onChange('')}
|
|
23
|
-
expandableInput={{
|
|
23
|
+
expandableInput={{
|
|
24
|
+
isExpanded,
|
|
25
|
+
onToggleExpand,
|
|
26
|
+
toggleAriaLabel: 'Expandable search input toggle',
|
|
27
|
+
hasAnimations: true
|
|
28
|
+
}}
|
|
24
29
|
/>
|
|
25
30
|
);
|
|
26
31
|
};
|
|
@@ -6,7 +6,7 @@ export interface TabsContextProps {
|
|
|
6
6
|
unmountOnExit: boolean;
|
|
7
7
|
localActiveKey: string | number;
|
|
8
8
|
uniqueId: string;
|
|
9
|
-
setAccentStyles
|
|
9
|
+
setAccentStyles?: (shouldInitializeStyles?: boolean) => void;
|
|
10
10
|
handleTabClick: (
|
|
11
11
|
event: React.MouseEvent<HTMLElement, MouseEvent>,
|
|
12
12
|
eventKey: number | string,
|