@patternfly/react-templates 6.0.0-alpha.2 → 6.0.0-alpha.20
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 +76 -0
- package/README.md +4 -17
- package/components/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -0
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic-modules.json +15 -0
- package/dist/esm/components/Dropdown/DropdownSimple.d.ts +43 -0
- package/dist/esm/components/Dropdown/DropdownSimple.d.ts.map +1 -0
- package/dist/esm/components/Dropdown/DropdownSimple.js +27 -0
- package/dist/esm/components/Dropdown/DropdownSimple.js.map +1 -0
- package/dist/esm/components/Dropdown/index.d.ts +2 -0
- package/dist/esm/components/Dropdown/index.d.ts.map +1 -0
- package/dist/esm/components/Dropdown/index.js +2 -0
- package/dist/esm/components/Dropdown/index.js.map +1 -0
- package/dist/esm/components/Select/CheckboxSelect.js.map +1 -1
- package/dist/esm/components/Select/SelectTypeahead.d.ts +29 -0
- package/dist/esm/components/Select/SelectTypeahead.d.ts.map +1 -0
- package/dist/esm/components/Select/SelectTypeahead.js +179 -0
- package/dist/esm/components/Select/SelectTypeahead.js.map +1 -0
- package/dist/esm/components/Select/index.d.ts +1 -0
- package/dist/esm/components/Select/index.d.ts.map +1 -1
- package/dist/esm/components/Select/index.js +1 -0
- package/dist/esm/components/Select/index.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownSimple.d.ts +43 -0
- package/dist/js/components/Dropdown/DropdownSimple.d.ts.map +1 -0
- package/dist/js/components/Dropdown/DropdownSimple.js +30 -0
- package/dist/js/components/Dropdown/DropdownSimple.js.map +1 -0
- package/dist/js/components/Dropdown/index.d.ts +2 -0
- package/dist/js/components/Dropdown/index.d.ts.map +1 -0
- package/dist/js/components/Dropdown/index.js +5 -0
- package/dist/js/components/Dropdown/index.js.map +1 -0
- package/dist/js/components/Select/CheckboxSelect.js.map +1 -1
- package/dist/js/components/Select/SelectSimple.js.map +1 -1
- package/dist/js/components/Select/SelectTypeahead.d.ts +29 -0
- package/dist/js/components/Select/SelectTypeahead.d.ts.map +1 -0
- package/dist/js/components/Select/SelectTypeahead.js +183 -0
- package/dist/js/components/Select/SelectTypeahead.js.map +1 -0
- package/dist/js/components/Select/index.d.ts +1 -0
- package/dist/js/components/Select/index.d.ts.map +1 -1
- package/dist/js/components/Select/index.js +1 -0
- package/dist/js/components/Select/index.js.map +1 -1
- package/dist/js/components/index.d.ts +1 -0
- package/dist/js/components/index.d.ts.map +1 -1
- package/dist/js/components/index.js +1 -0
- package/dist/js/components/index.js.map +1 -1
- package/dist/umd/assets/output-BrdjX-Jk.css +24359 -0
- package/dist/umd/react-templates.min.js +1 -1
- package/package.json +7 -11
- package/rollup.config.mjs +8 -0
- package/src/components/Dropdown/DropdownSimple.tsx +122 -0
- package/src/components/Dropdown/__tests__/DropdownSimple.test.tsx +254 -0
- package/src/components/Dropdown/__tests__/__snapshots__/DropdownSimple.test.tsx.snap +147 -0
- package/src/components/Dropdown/examples/DropdownSimpleExample.tsx +53 -0
- package/src/components/Dropdown/examples/DropdownTemplates.md +36 -0
- package/src/components/Dropdown/index.ts +1 -0
- package/src/components/Select/SelectTypeahead.tsx +321 -0
- package/src/components/Select/__snapshots__/CheckboxSelectSnapshots.test.tsx.snap +4 -4
- package/src/components/Select/examples/SelectTemplates.md +9 -2
- package/src/components/Select/examples/SelectTypeaheadDemo.tsx +21 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,82 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [6.0.0-alpha.20](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.19...@patternfly/react-templates@6.0.0-alpha.20) (2024-06-20)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
9
|
+
|
|
10
|
+
# [6.0.0-alpha.19](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.18...@patternfly/react-templates@6.0.0-alpha.19) (2024-06-13)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
13
|
+
|
|
14
|
+
# [6.0.0-alpha.18](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.17...@patternfly/react-templates@6.0.0-alpha.18) (2024-06-12)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
17
|
+
|
|
18
|
+
# [6.0.0-alpha.17](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.16...@patternfly/react-templates@6.0.0-alpha.17) (2024-06-11)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
21
|
+
|
|
22
|
+
# [6.0.0-alpha.16](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.15...@patternfly/react-templates@6.0.0-alpha.16) (2024-06-06)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
25
|
+
|
|
26
|
+
# [6.0.0-alpha.15](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.14...@patternfly/react-templates@6.0.0-alpha.15) (2024-06-06)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
29
|
+
|
|
30
|
+
# [6.0.0-alpha.14](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.13...@patternfly/react-templates@6.0.0-alpha.14) (2024-06-05)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
33
|
+
|
|
34
|
+
# [6.0.0-alpha.13](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.12...@patternfly/react-templates@6.0.0-alpha.13) (2024-06-05)
|
|
35
|
+
|
|
36
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
37
|
+
|
|
38
|
+
# [6.0.0-alpha.12](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.11...@patternfly/react-templates@6.0.0-alpha.12) (2024-06-04)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
41
|
+
|
|
42
|
+
# [6.0.0-alpha.11](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.10...@patternfly/react-templates@6.0.0-alpha.11) (2024-05-31)
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
- **build:** whitespace change to test v6 build ([#10484](https://github.com/patternfly/patternfly-react/issues/10484)) ([870fc3a](https://github.com/patternfly/patternfly-react/commit/870fc3a3a364a68702d774fc94b260d961241855))
|
|
47
|
+
|
|
48
|
+
# 6.0.0-alpha.10 (2024-05-23)
|
|
49
|
+
|
|
50
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
51
|
+
|
|
52
|
+
# [6.0.0-alpha.9](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.8...@patternfly/react-templates@6.0.0-alpha.9) (2024-05-21)
|
|
53
|
+
|
|
54
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
55
|
+
|
|
56
|
+
# [6.0.0-alpha.8](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.7...@patternfly/react-templates@6.0.0-alpha.8) (2024-05-16)
|
|
57
|
+
|
|
58
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
59
|
+
|
|
60
|
+
# [6.0.0-alpha.7](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.6...@patternfly/react-templates@6.0.0-alpha.7) (2024-05-15)
|
|
61
|
+
|
|
62
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
63
|
+
|
|
64
|
+
# [6.0.0-alpha.6](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.5...@patternfly/react-templates@6.0.0-alpha.6) (2024-05-08)
|
|
65
|
+
|
|
66
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
67
|
+
|
|
68
|
+
# [6.0.0-alpha.5](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.4...@patternfly/react-templates@6.0.0-alpha.5) (2024-05-03)
|
|
69
|
+
|
|
70
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
71
|
+
|
|
72
|
+
# [6.0.0-alpha.4](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.3...@patternfly/react-templates@6.0.0-alpha.4) (2024-04-29)
|
|
73
|
+
|
|
74
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
75
|
+
|
|
76
|
+
# 6.0.0-alpha.3 (2024-04-26)
|
|
77
|
+
|
|
78
|
+
### Bug Fixes
|
|
79
|
+
|
|
80
|
+
- **helpers:** Updated OUIA ID prefix to PF6 ([#10292](https://github.com/patternfly/patternfly-react/issues/10292)) ([1c7af7a](https://github.com/patternfly/patternfly-react/commit/1c7af7ab9f352b9ad02caabb1deef08cf69e0950))
|
|
81
|
+
|
|
6
82
|
# [6.0.0-alpha.2](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.1...@patternfly/react-templates@6.0.0-alpha.2) (2024-04-24)
|
|
7
83
|
|
|
8
84
|
**Note:** Version bump only for package @patternfly/react-templates
|
package/README.md
CHANGED
|
@@ -2,30 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
This package provides wrapped Patternfly component demos with a streamlined API for ease of use.
|
|
4
4
|
|
|
5
|
-
### Prerequisite
|
|
6
|
-
|
|
7
|
-
#### Node Environment
|
|
8
|
-
|
|
9
|
-
This project currently supports [Node Active LTS](https://github.com/nodejs/Release#release-schedule) releases. Please stay current with Node Active LTS when developing patternfly-react.
|
|
10
|
-
|
|
11
|
-
For example, to develop with Node 18, use the following:
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
nvm install 18
|
|
15
|
-
nvm use 18
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
This project also requires a Yarn version of >=1.6.0. The latest version can be installed from the [Yarn](https://yarnpkg.com/) home page.
|
|
19
|
-
|
|
20
5
|
### Installing
|
|
21
6
|
|
|
22
|
-
```
|
|
7
|
+
```sh
|
|
23
8
|
yarn add @patternfly/react-templates
|
|
24
9
|
```
|
|
25
10
|
|
|
26
11
|
or
|
|
27
12
|
|
|
28
|
-
```
|
|
13
|
+
```sh
|
|
29
14
|
npm install @patternfly/react-templates --save
|
|
30
15
|
```
|
|
31
16
|
|
|
@@ -40,3 +25,5 @@ import '@patternfly/react-core/dist/styles/base.css';
|
|
|
40
25
|
```js
|
|
41
26
|
import { SimpleSelect } from '@patternfly/react-templates';
|
|
42
27
|
```
|
|
28
|
+
|
|
29
|
+
|
package/components/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-templates-components","main":"../dist/js/components/index.js","module":"../dist/esm/components/index.js","typings":"../dist/esm/components/index.d.ts","version":"6.0.0-alpha.
|
|
1
|
+
{"name":"@patternfly/react-templates-components","main":"../dist/js/components/index.js","module":"../dist/esm/components/index.js","typings":"../dist/esm/components/index.d.ts","version":"6.0.0-alpha.19","private":true}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"@patternfly/react-templates-dropdown-dynamic","main":"../../../js/components/Dropdown/index.js","module":"../../../esm/components/Dropdown/index.js","typings":"../../../esm/components/Dropdown/index.d.ts","version":"6.0.0-alpha.19","private":true}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-templates-select-dynamic","main":"../../../js/components/Select/index.js","module":"../../../esm/components/Select/index.js","typings":"../../../esm/components/Select/index.d.ts","version":"6.0.0-alpha.
|
|
1
|
+
{"name":"@patternfly/react-templates-select-dynamic","main":"../../../js/components/Select/index.js","module":"../../../esm/components/Select/index.js","typings":"../../../esm/components/Select/index.d.ts","version":"6.0.0-alpha.19","private":true}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"CheckboxSelect": "dist/dynamic/components/Select",
|
|
3
|
+
"CheckboxSelectOption": "dist/dynamic/components/Select",
|
|
4
|
+
"CheckboxSelectProps": "dist/dynamic/components/Select",
|
|
5
|
+
"DropdownSimple": "dist/dynamic/components/Dropdown",
|
|
6
|
+
"DropdownSimpleItem": "dist/dynamic/components/Dropdown",
|
|
7
|
+
"DropdownSimpleProps": "dist/dynamic/components/Dropdown",
|
|
8
|
+
"SelectSimple": "dist/dynamic/components/Select",
|
|
9
|
+
"SelectSimpleOption": "dist/dynamic/components/Select",
|
|
10
|
+
"SelectSimpleProps": "dist/dynamic/components/Select",
|
|
11
|
+
"SelectTypeahead": "dist/dynamic/components/Select",
|
|
12
|
+
"SelectTypeaheadBase": "dist/dynamic/components/Select",
|
|
13
|
+
"SelectTypeaheadOption": "dist/dynamic/components/Select",
|
|
14
|
+
"SelectTypeaheadProps": "dist/dynamic/components/Select"
|
|
15
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DropdownItemProps } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
3
|
+
import { OUIAProps } from '@patternfly/react-core/dist/esm/helpers';
|
|
4
|
+
export interface DropdownSimpleItem extends Omit<DropdownItemProps, 'content'> {
|
|
5
|
+
/** Content of the dropdown item. If the isDivider prop is true, this prop will be ignored. */
|
|
6
|
+
content?: React.ReactNode;
|
|
7
|
+
/** Unique identifier for the dropdown item, which is used in the dropdown onSelect callback */
|
|
8
|
+
value: string | number;
|
|
9
|
+
/** Callback for when the dropdown item is clicked. */
|
|
10
|
+
onClick?: (event?: any) => void;
|
|
11
|
+
/** URL to redirect to when the dropdown item is clicked. */
|
|
12
|
+
to?: string;
|
|
13
|
+
/** Flag indicating whether the dropdown item should render as a divider. If true, the item will be rendered without
|
|
14
|
+
* the dropdown item wrapper.
|
|
15
|
+
*/
|
|
16
|
+
isDivider?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface DropdownSimpleProps extends OUIAProps {
|
|
19
|
+
/** Initial items of the dropdown. */
|
|
20
|
+
initialItems?: DropdownSimpleItem[];
|
|
21
|
+
/** @hide Forwarded ref */
|
|
22
|
+
innerRef?: React.Ref<any>;
|
|
23
|
+
/** Flag indicating the dropdown should be disabled. */
|
|
24
|
+
isDisabled?: boolean;
|
|
25
|
+
/** Flag indicated whether the dropdown toggle should take up the full width of its parent. */
|
|
26
|
+
isToggleFullWidth?: boolean;
|
|
27
|
+
/** Callback triggered when any dropdown item is clicked. */
|
|
28
|
+
onSelect?: (event?: React.MouseEvent<Element, MouseEvent>, value?: string | number) => void;
|
|
29
|
+
/** Callback triggered when the dropdown toggle opens or closes. */
|
|
30
|
+
onToggle?: (nextIsOpen: boolean) => void;
|
|
31
|
+
/** Flag indicating the dropdown toggle should be focused after a dropdown item is clicked. */
|
|
32
|
+
shouldFocusToggleOnSelect?: boolean;
|
|
33
|
+
/** Adds an accessible name to the dropdown toggle. Required when the dropdown toggle does not
|
|
34
|
+
* have any text content.
|
|
35
|
+
*/
|
|
36
|
+
toggleAriaLabel?: string;
|
|
37
|
+
/** Content of the toggle. */
|
|
38
|
+
toggleContent: React.ReactNode;
|
|
39
|
+
/** Variant style of the dropdown toggle. */
|
|
40
|
+
toggleVariant?: 'default' | 'plain' | 'plainText';
|
|
41
|
+
}
|
|
42
|
+
export declare const DropdownSimple: React.ForwardRefExoticComponent<DropdownSimpleProps & React.RefAttributes<any>>;
|
|
43
|
+
//# sourceMappingURL=DropdownSimple.d.ts.map
|
|
@@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E,OAAO,CAAC;IACpC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6BAA6B;IAC7B,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;CACnD;AAoED,eAAO,MAAM,cAAc,iFAEzB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
4
|
+
import { MenuToggle } from '@patternfly/react-core/dist/esm/components/MenuToggle';
|
|
5
|
+
import { Divider } from '@patternfly/react-core/dist/esm/components/Divider';
|
|
6
|
+
const DropdownSimpleBase = (_a) => {
|
|
7
|
+
var { innerRef, initialItems, onSelect: onSelectProp, onToggle: onToggleProp, isDisabled, toggleAriaLabel, toggleContent, isToggleFullWidth, toggleVariant = 'default', shouldFocusToggleOnSelect } = _a, props = __rest(_a, ["innerRef", "initialItems", "onSelect", "onToggle", "isDisabled", "toggleAriaLabel", "toggleContent", "isToggleFullWidth", "toggleVariant", "shouldFocusToggleOnSelect"]);
|
|
8
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
9
|
+
const onSelect = (event, value) => {
|
|
10
|
+
onSelectProp && onSelectProp(event, value);
|
|
11
|
+
setIsOpen(false);
|
|
12
|
+
};
|
|
13
|
+
const onToggle = () => {
|
|
14
|
+
onToggleProp && onToggleProp(!isOpen);
|
|
15
|
+
setIsOpen(!isOpen);
|
|
16
|
+
};
|
|
17
|
+
const dropdownToggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: onToggle, isExpanded: isOpen, isDisabled: isDisabled, variant: toggleVariant, "aria-label": toggleAriaLabel, isFullWidth: isToggleFullWidth }, toggleContent));
|
|
18
|
+
const dropdownSimpleItems = initialItems === null || initialItems === void 0 ? void 0 : initialItems.map((item) => {
|
|
19
|
+
const { content, onClick, to, value, isDivider } = item, itemProps = __rest(item, ["content", "onClick", "to", "value", "isDivider"]);
|
|
20
|
+
return isDivider ? (React.createElement(Divider, { component: "li", key: value })) : (React.createElement(DropdownItem, Object.assign({ onClick: onClick, to: to, key: value, value: value }, itemProps), content));
|
|
21
|
+
});
|
|
22
|
+
return (React.createElement(Dropdown, Object.assign({ toggle: dropdownToggle, isOpen: isOpen, onSelect: onSelect, shouldFocusToggleOnSelect: shouldFocusToggleOnSelect, onOpenChange: (isOpen) => setIsOpen(isOpen), ref: innerRef }, props),
|
|
23
|
+
React.createElement(DropdownList, null, dropdownSimpleItems)));
|
|
24
|
+
};
|
|
25
|
+
export const DropdownSimple = React.forwardRef((props, ref) => (React.createElement(DropdownSimpleBase, Object.assign({}, props, { innerRef: ref }))));
|
|
26
|
+
DropdownSimple.displayName = 'DropdownSimple';
|
|
27
|
+
//# sourceMappingURL=DropdownSimple.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownSimple.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/DropdownSimple.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EAEb,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAqB,MAAM,uDAAuD,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,MAAM,oDAAoD,CAAC;AA2C7E,MAAM,kBAAkB,GAAiD,CAAC,EAYpD,EAAE,EAAE;QAZgD,EACxE,QAAQ,EACR,YAAY,EACZ,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,YAAY,EACtB,UAAU,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,aAAa,GAAG,SAAS,EACzB,yBAAyB,OAEL,EADjB,KAAK,cAXgE,yKAYzE,CADS;IAER,MAAM,CAAC,MAAM,EAAE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AAC,QAAQ,kBACP,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,yBAAyB,EAAE,yBAAyB,EACpD,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,EAC3C,GAAG,EAAE,QAAQ,IACT,KAAK;QAET,oBAAC,YAAY,QAAE,mBAAmB,CAAgB,CACzC,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAA0B,EAAE,GAAmB,EAAE,EAAE,CAAC,CAClG,oBAAC,kBAAkB,oBAAK,KAAK,IAAE,QAAQ,EAAE,GAAG,IAAI,CACjD,CAAC,CAAC;AAEH,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxSelect.js","sourceRoot":"","sources":["../../../../src/components/Select/CheckboxSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,KAAK,EACL,UAAU,EAEV,MAAM,EACN,UAAU,EACV,YAAY,EAEb,MAAM,wBAAwB,CAAC;AAwBhC,MAAM,kBAAkB,GAAiD,CAAC,EAQpD,EAAE,EAAE;QARgD,EACxE,QAAQ,EACR,cAAc,EACd,UAAU,EACV,QAAQ,EAAE,cAAc,EACxB,QAAQ,EACR,aAAa,OAEO,EADjB,KAAK,cAPgE,qFAQ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+1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectOptionProps } from '@patternfly/react-core';
|
|
3
|
+
export interface SelectTypeaheadOption extends Omit<SelectOptionProps, 'content'> {
|
|
4
|
+
/** Content of the select option. */
|
|
5
|
+
content: string | number;
|
|
6
|
+
/** Value of the select option. */
|
|
7
|
+
value: string | number;
|
|
8
|
+
}
|
|
9
|
+
export interface SelectTypeaheadProps {
|
|
10
|
+
/** @hide Forwarded ref */
|
|
11
|
+
innerRef?: React.Ref<any>;
|
|
12
|
+
/** Initial options of the select. */
|
|
13
|
+
initialOptions: SelectTypeaheadOption[];
|
|
14
|
+
/** Callback triggered on selection. */
|
|
15
|
+
onSelect?: (_event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<HTMLInputElement>, selection: string | number) => void;
|
|
16
|
+
/** Callback triggered when the select opens or closes. */
|
|
17
|
+
onToggle?: (nextIsOpen: boolean) => void;
|
|
18
|
+
/** Callback triggered when the text in the input field changes. */
|
|
19
|
+
onInputChange?: (newValue: string) => void;
|
|
20
|
+
/** Placeholder text for the select input. */
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
/** Message to display when no options match the filter. */
|
|
23
|
+
noOptionsFoundMessage?: string | ((filter: string) => string);
|
|
24
|
+
/** Flag indicating the select should be disabled. */
|
|
25
|
+
isDisabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const SelectTypeaheadBase: React.FunctionComponent<SelectTypeaheadProps>;
|
|
28
|
+
export declare const SelectTypeahead: React.ForwardRefExoticComponent<SelectTypeaheadProps & React.RefAttributes<any>>;
|
|
29
|
+
//# sourceMappingURL=SelectTypeahead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectTypeahead.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/SelectTypeahead.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,iBAAiB,EAOlB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC;IAC/E,oCAAoC;IACpC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,kCAAkC;IAClC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,qCAAqC;IACrC,cAAc,EAAE,qBAAqB,EAAE,CAAC;IACxC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,CACT,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,EACrF,SAAS,EAAE,MAAM,GAAG,MAAM,KACvB,IAAI,CAAC;IACV,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,mEAAmE;IACnE,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,qBAAqB,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAC9D,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CA6Q7E,CAAC;AAGF,eAAO,MAAM,eAAe,kFAE1B,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Select, SelectOption, SelectList, MenuToggle, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
|
|
4
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
5
|
+
export const SelectTypeaheadBase = (_a) => {
|
|
6
|
+
var { innerRef, initialOptions, onSelect, onToggle, onInputChange, placeholder = 'Select an option', noOptionsFoundMessage = (filter) => `No results found for "${filter}"`, isDisabled } = _a, props = __rest(_a, ["innerRef", "initialOptions", "onSelect", "onToggle", "onInputChange", "placeholder", "noOptionsFoundMessage", "isDisabled"]);
|
|
7
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
8
|
+
const [selected, setSelected] = React.useState('');
|
|
9
|
+
const [inputValue, setInputValue] = React.useState('');
|
|
10
|
+
const [filterValue, setFilterValue] = React.useState('');
|
|
11
|
+
const [selectOptions, setSelectOptions] = React.useState(initialOptions);
|
|
12
|
+
const [focusedItemIndex, setFocusedItemIndex] = React.useState(null);
|
|
13
|
+
const [activeItemId, setActiveItemId] = React.useState(null);
|
|
14
|
+
const textInputRef = React.useRef();
|
|
15
|
+
const NO_RESULTS = 'no results';
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
let newSelectOptions = initialOptions;
|
|
18
|
+
// Filter menu items based on the text input value when one exists
|
|
19
|
+
if (filterValue) {
|
|
20
|
+
newSelectOptions = initialOptions.filter((option) => String(option.content).toLowerCase().includes(filterValue.toLowerCase()));
|
|
21
|
+
// When no options are found after filtering, display 'No results found'
|
|
22
|
+
if (!newSelectOptions.length) {
|
|
23
|
+
newSelectOptions = [
|
|
24
|
+
{
|
|
25
|
+
isAriaDisabled: true,
|
|
26
|
+
content: typeof noOptionsFoundMessage === 'string' ? noOptionsFoundMessage : noOptionsFoundMessage(filterValue),
|
|
27
|
+
value: NO_RESULTS
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
// Open the menu when the input value changes and the new value is not empty
|
|
32
|
+
if (!isOpen) {
|
|
33
|
+
openMenu();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
setSelectOptions(newSelectOptions);
|
|
37
|
+
}, [filterValue]);
|
|
38
|
+
const createItemId = (value) => `select-typeahead-${String(value).replace(' ', '-')}`;
|
|
39
|
+
const setActiveAndFocusedItem = (itemIndex) => {
|
|
40
|
+
setFocusedItemIndex(itemIndex);
|
|
41
|
+
const focusedItem = selectOptions[itemIndex];
|
|
42
|
+
setActiveItemId(createItemId(focusedItem.value));
|
|
43
|
+
};
|
|
44
|
+
const resetActiveAndFocusedItem = () => {
|
|
45
|
+
setFocusedItemIndex(null);
|
|
46
|
+
setActiveItemId(null);
|
|
47
|
+
};
|
|
48
|
+
const openMenu = () => {
|
|
49
|
+
onToggle && onToggle(true);
|
|
50
|
+
setIsOpen(true);
|
|
51
|
+
};
|
|
52
|
+
const closeMenu = () => {
|
|
53
|
+
onToggle && onToggle(false);
|
|
54
|
+
setIsOpen(false);
|
|
55
|
+
resetActiveAndFocusedItem();
|
|
56
|
+
};
|
|
57
|
+
const onInputClick = () => {
|
|
58
|
+
if (!isOpen) {
|
|
59
|
+
openMenu();
|
|
60
|
+
}
|
|
61
|
+
else if (!inputValue) {
|
|
62
|
+
closeMenu();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const selectOption = (_event, option) => {
|
|
66
|
+
onSelect && onSelect(_event, option.value);
|
|
67
|
+
setInputValue(String(option.content));
|
|
68
|
+
setFilterValue('');
|
|
69
|
+
setSelected(String(option.value));
|
|
70
|
+
closeMenu();
|
|
71
|
+
};
|
|
72
|
+
const _onSelect = (_event, value) => {
|
|
73
|
+
if (value && value !== NO_RESULTS) {
|
|
74
|
+
const optionToSelect = selectOptions.find((option) => option.value === value);
|
|
75
|
+
selectOption(_event, optionToSelect);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const onTextInputChange = (_event, value) => {
|
|
79
|
+
setInputValue(value);
|
|
80
|
+
onInputChange && onInputChange(value);
|
|
81
|
+
setFilterValue(value);
|
|
82
|
+
resetActiveAndFocusedItem();
|
|
83
|
+
if (value !== selected) {
|
|
84
|
+
setSelected('');
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const handleMenuArrowKeys = (key) => {
|
|
88
|
+
let indexToFocus = 0;
|
|
89
|
+
if (!isOpen) {
|
|
90
|
+
openMenu();
|
|
91
|
+
}
|
|
92
|
+
if (selectOptions.every((option) => option.isDisabled)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (key === 'ArrowUp') {
|
|
96
|
+
// When no index is set or at the first index, focus to the last, otherwise decrement focus index
|
|
97
|
+
if (focusedItemIndex === null || focusedItemIndex === 0) {
|
|
98
|
+
indexToFocus = selectOptions.length - 1;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
indexToFocus = focusedItemIndex - 1;
|
|
102
|
+
}
|
|
103
|
+
// Skip disabled options
|
|
104
|
+
while (selectOptions[indexToFocus].isDisabled) {
|
|
105
|
+
indexToFocus--;
|
|
106
|
+
if (indexToFocus === -1) {
|
|
107
|
+
indexToFocus = selectOptions.length - 1;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (key === 'ArrowDown') {
|
|
112
|
+
// When no index is set or at the last index, focus to the first, otherwise increment focus index
|
|
113
|
+
if (focusedItemIndex === null || focusedItemIndex === selectOptions.length - 1) {
|
|
114
|
+
indexToFocus = 0;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
indexToFocus = focusedItemIndex + 1;
|
|
118
|
+
}
|
|
119
|
+
// Skip disabled options
|
|
120
|
+
while (selectOptions[indexToFocus].isDisabled) {
|
|
121
|
+
indexToFocus++;
|
|
122
|
+
if (indexToFocus === selectOptions.length) {
|
|
123
|
+
indexToFocus = 0;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
setActiveAndFocusedItem(indexToFocus);
|
|
128
|
+
};
|
|
129
|
+
const onInputKeyDown = (event) => {
|
|
130
|
+
const focusedItem = focusedItemIndex !== null ? selectOptions[focusedItemIndex] : null;
|
|
131
|
+
switch (event.key) {
|
|
132
|
+
case 'Enter':
|
|
133
|
+
if (isOpen && focusedItem && focusedItem.value !== NO_RESULTS && !focusedItem.isAriaDisabled) {
|
|
134
|
+
selectOption(event, focusedItem);
|
|
135
|
+
}
|
|
136
|
+
if (!isOpen) {
|
|
137
|
+
setIsOpen(true);
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
case 'ArrowUp':
|
|
141
|
+
case 'ArrowDown':
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
handleMenuArrowKeys(event.key);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const onToggleClick = () => {
|
|
148
|
+
var _a;
|
|
149
|
+
onToggle && onToggle(!isOpen);
|
|
150
|
+
setIsOpen(!isOpen);
|
|
151
|
+
(_a = textInputRef === null || textInputRef === void 0 ? void 0 : textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
152
|
+
};
|
|
153
|
+
const onClearButtonClick = () => {
|
|
154
|
+
var _a;
|
|
155
|
+
setSelected('');
|
|
156
|
+
setInputValue('');
|
|
157
|
+
onInputChange && onInputChange('');
|
|
158
|
+
setFilterValue('');
|
|
159
|
+
resetActiveAndFocusedItem();
|
|
160
|
+
(_a = textInputRef === null || textInputRef === void 0 ? void 0 : textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
161
|
+
};
|
|
162
|
+
const toggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, variant: "typeahead", "aria-label": "Typeahead menu toggle", onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, isFullWidth: true },
|
|
163
|
+
React.createElement(TextInputGroup, { isPlain: true },
|
|
164
|
+
React.createElement(TextInputGroupMain, Object.assign({ value: inputValue, onClick: onInputClick, onChange: onTextInputChange, onKeyDown: onInputKeyDown, id: "typeahead-select-input", autoComplete: "off", innerRef: textInputRef, placeholder: placeholder }, (activeItemId && { 'aria-activedescendant': activeItemId }), { role: "combobox", isExpanded: isOpen, "aria-controls": "select-typeahead-listbox" })),
|
|
165
|
+
React.createElement(TextInputGroupUtilities, Object.assign({}, (!inputValue ? { style: { display: 'none' } } : {})),
|
|
166
|
+
React.createElement(Button, { variant: "plain", onClick: onClearButtonClick, "aria-label": "Clear input value" },
|
|
167
|
+
React.createElement(TimesIcon, { "aria-hidden": true }))))));
|
|
168
|
+
return (React.createElement(Select, Object.assign({ id: "typeahead-select", isOpen: isOpen, selected: selected, onSelect: _onSelect, onOpenChange: (isOpen) => {
|
|
169
|
+
!isOpen && closeMenu();
|
|
170
|
+
}, toggle: toggle, shouldFocusFirstItemOnOpen: false, ref: innerRef }, props),
|
|
171
|
+
React.createElement(SelectList, { id: "select-typeahead-listbox" }, selectOptions.map((option, index) => {
|
|
172
|
+
const { content, value } = option, props = __rest(option, ["content", "value"]);
|
|
173
|
+
return (React.createElement(SelectOption, Object.assign({}, props, { key: value, value: value, isFocused: focusedItemIndex === index, id: createItemId(value) }), content));
|
|
174
|
+
}))));
|
|
175
|
+
};
|
|
176
|
+
SelectTypeaheadBase.displayName = 'SelectTypeaheadBase';
|
|
177
|
+
export const SelectTypeahead = React.forwardRef((props, ref) => (React.createElement(SelectTypeaheadBase, Object.assign({}, props, { innerRef: ref }))));
|
|
178
|
+
SelectTypeahead.displayName = 'SelectTypeahead';
|
|
179
|
+
//# sourceMappingURL=SelectTypeahead.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectTypeahead.js","sourceRoot":"","sources":["../../../../src/components/Select/SelectTypeahead.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EAEV,UAAU,EAEV,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,MAAM,EACP,MAAM,wBAAwB,CAAC;AAChC,OAAO,SAAS,MAAM,mDAAmD,CAAC;AA+B1E,MAAM,CAA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,EAAE,SAAS,EACnB,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;YACvB,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QACzB,CAAC,EACD,MAAM,EAAE,MAAM,EACd,0BAA0B,EAAE,KAAK,EACjC,GAAG,EAAE,QAAQ,IACT,KAAK;QAET,oBAAC,UAAU,IAAC,EAAE,EAAC,0BAA0B,IACtC,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACnC,MAAM,EAAE,OAAO,EAAE,KAAK,KAAe,MAAM,EAAhB,KAAK,UAAK,MAAM,EAArC,oBAA4B,CAAS,CAAC;YAE5C,OAAO,CACL,oBAAC,YAAY,oBACP,KAAK,IACT,GAAG,EAAE,KAAK,EACV,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,gBAAgB,KAAK,KAAK,EACrC,EAAE,EAAE,YAAY,CAAC,KAAK,CAAC,KAEtB,OAAO,CACK,CAChB,CAAC;QACJ,CAAC,CAAC,CACS,CACN,CACV,CAAC;AACJ,CAAC,CAAC;AACF,mBAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAExD,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAA2B,EAAE,GAAmB,EAAE,EAAE,CAAC,CACpG,oBAAC,mBAAmB,oBAAK,KAAK,IAAE,QAAQ,EAAE,GAAG,IAAI,CAClD,CAAC,CAAC;AAEH,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Select/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Select/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DropdownItemProps } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
3
|
+
import { OUIAProps } from '@patternfly/react-core/dist/esm/helpers';
|
|
4
|
+
export interface DropdownSimpleItem extends Omit<DropdownItemProps, 'content'> {
|
|
5
|
+
/** Content of the dropdown item. If the isDivider prop is true, this prop will be ignored. */
|
|
6
|
+
content?: React.ReactNode;
|
|
7
|
+
/** Unique identifier for the dropdown item, which is used in the dropdown onSelect callback */
|
|
8
|
+
value: string | number;
|
|
9
|
+
/** Callback for when the dropdown item is clicked. */
|
|
10
|
+
onClick?: (event?: any) => void;
|
|
11
|
+
/** URL to redirect to when the dropdown item is clicked. */
|
|
12
|
+
to?: string;
|
|
13
|
+
/** Flag indicating whether the dropdown item should render as a divider. If true, the item will be rendered without
|
|
14
|
+
* the dropdown item wrapper.
|
|
15
|
+
*/
|
|
16
|
+
isDivider?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface DropdownSimpleProps extends OUIAProps {
|
|
19
|
+
/** Initial items of the dropdown. */
|
|
20
|
+
initialItems?: DropdownSimpleItem[];
|
|
21
|
+
/** @hide Forwarded ref */
|
|
22
|
+
innerRef?: React.Ref<any>;
|
|
23
|
+
/** Flag indicating the dropdown should be disabled. */
|
|
24
|
+
isDisabled?: boolean;
|
|
25
|
+
/** Flag indicated whether the dropdown toggle should take up the full width of its parent. */
|
|
26
|
+
isToggleFullWidth?: boolean;
|
|
27
|
+
/** Callback triggered when any dropdown item is clicked. */
|
|
28
|
+
onSelect?: (event?: React.MouseEvent<Element, MouseEvent>, value?: string | number) => void;
|
|
29
|
+
/** Callback triggered when the dropdown toggle opens or closes. */
|
|
30
|
+
onToggle?: (nextIsOpen: boolean) => void;
|
|
31
|
+
/** Flag indicating the dropdown toggle should be focused after a dropdown item is clicked. */
|
|
32
|
+
shouldFocusToggleOnSelect?: boolean;
|
|
33
|
+
/** Adds an accessible name to the dropdown toggle. Required when the dropdown toggle does not
|
|
34
|
+
* have any text content.
|
|
35
|
+
*/
|
|
36
|
+
toggleAriaLabel?: string;
|
|
37
|
+
/** Content of the toggle. */
|
|
38
|
+
toggleContent: React.ReactNode;
|
|
39
|
+
/** Variant style of the dropdown toggle. */
|
|
40
|
+
toggleVariant?: 'default' | 'plain' | 'plainText';
|
|
41
|
+
}
|
|
42
|
+
export declare const DropdownSimple: React.ForwardRefExoticComponent<DropdownSimpleProps & React.RefAttributes<any>>;
|
|
43
|
+
//# sourceMappingURL=DropdownSimple.d.ts.map
|
|
@@ -0,0 +1 @@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