@patternfly/react-templates 6.0.0-alpha.20 → 6.0.0-alpha.22
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 +8 -0
- package/components/package.json +8 -1
- package/dist/dynamic/components/Dropdown/package.json +8 -1
- package/dist/dynamic/components/Select/package.json +8 -1
- package/dist/dynamic-modules.json +10 -10
- package/dist/esm/components/Dropdown/{DropdownSimple.d.ts → SimpleDropdown.d.ts} +11 -6
- package/dist/esm/components/Dropdown/SimpleDropdown.d.ts.map +1 -0
- package/dist/esm/components/Dropdown/{DropdownSimple.js → SimpleDropdown.js} +13 -7
- package/dist/esm/components/Dropdown/SimpleDropdown.js.map +1 -0
- package/dist/esm/components/Dropdown/index.d.ts +1 -1
- package/dist/esm/components/Dropdown/index.js +1 -1
- package/dist/esm/components/Select/CheckboxSelect.d.ts +7 -3
- package/dist/esm/components/Select/CheckboxSelect.d.ts.map +1 -1
- package/dist/esm/components/Select/CheckboxSelect.js +9 -6
- package/dist/esm/components/Select/CheckboxSelect.js.map +1 -1
- package/dist/{js/components/Select/SelectSimple.d.ts → esm/components/Select/SimpleSelect.d.ts} +10 -7
- package/dist/esm/components/Select/SimpleSelect.d.ts.map +1 -0
- package/dist/esm/components/Select/{SelectSimple.js → SimpleSelect.js} +13 -9
- package/dist/esm/components/Select/SimpleSelect.js.map +1 -0
- package/dist/esm/components/Select/{SelectTypeahead.d.ts → TypeaheadSelect.d.ts} +11 -7
- package/dist/esm/components/Select/TypeaheadSelect.d.ts.map +1 -0
- package/dist/esm/components/Select/{SelectTypeahead.js → TypeaheadSelect.js} +16 -14
- package/dist/esm/components/Select/TypeaheadSelect.js.map +1 -0
- package/dist/esm/components/Select/index.d.ts +2 -2
- package/dist/esm/components/Select/index.js +2 -2
- package/dist/js/components/Dropdown/{DropdownSimple.d.ts → SimpleDropdown.d.ts} +11 -6
- package/dist/js/components/Dropdown/SimpleDropdown.d.ts.map +1 -0
- package/dist/js/components/Dropdown/{DropdownSimple.js → SimpleDropdown.js} +14 -8
- package/dist/js/components/Dropdown/SimpleDropdown.js.map +1 -0
- package/dist/js/components/Dropdown/index.d.ts +1 -1
- package/dist/js/components/Dropdown/index.js +1 -1
- package/dist/js/components/Select/CheckboxSelect.d.ts +7 -3
- package/dist/js/components/Select/CheckboxSelect.d.ts.map +1 -1
- package/dist/js/components/Select/CheckboxSelect.js +9 -6
- package/dist/js/components/Select/CheckboxSelect.js.map +1 -1
- package/dist/{esm/components/Select/SelectSimple.d.ts → js/components/Select/SimpleSelect.d.ts} +10 -7
- package/dist/js/components/Select/SimpleSelect.d.ts.map +1 -0
- package/dist/js/components/Select/{SelectSimple.js → SimpleSelect.js} +14 -10
- package/dist/js/components/Select/SimpleSelect.js.map +1 -0
- package/dist/js/components/Select/{SelectTypeahead.d.ts → TypeaheadSelect.d.ts} +11 -7
- package/dist/js/components/Select/TypeaheadSelect.d.ts.map +1 -0
- package/dist/js/components/Select/{SelectTypeahead.js → TypeaheadSelect.js} +18 -16
- package/dist/js/components/Select/TypeaheadSelect.js.map +1 -0
- package/dist/js/components/Select/index.d.ts +2 -2
- package/dist/js/components/Select/index.js +2 -2
- package/dist/umd/assets/{output-BrdjX-Jk.css → output-CP_aQiOP.css} +2794 -2794
- package/dist/umd/react-templates.min.js +1 -1
- package/package.json +7 -7
- package/src/components/Dropdown/{DropdownSimple.tsx → SimpleDropdown.tsx} +28 -11
- package/src/components/Dropdown/__tests__/{DropdownSimple.test.tsx → SimpleDropdown.test.tsx} +35 -23
- package/src/components/Dropdown/__tests__/__snapshots__/{DropdownSimple.test.tsx.snap → SimpleDropdown.test.tsx.snap} +6 -0
- package/src/components/Dropdown/examples/DropdownTemplates.md +4 -16
- package/src/components/Dropdown/examples/{DropdownSimpleExample.tsx → SimpleDropdownExample.tsx} +7 -7
- package/src/components/Dropdown/index.ts +1 -1
- package/src/components/Select/CheckboxSelect.tsx +18 -7
- package/src/components/Select/{SelectSimple.tsx → SimpleSelect.tsx} +27 -14
- package/src/components/Select/{SelectTypeahead.tsx → TypeaheadSelect.tsx} +32 -27
- package/src/components/Select/{CheckboxSelect.test.tsx → __tests__/CheckboxSelect.test.tsx} +29 -1
- package/src/components/Select/{CheckboxSelectSnapshots.test.tsx → __tests__/CheckboxSelectSnapshots.test.tsx} +1 -1
- package/src/components/Select/__tests__/SimpleSelect.test.tsx +243 -0
- package/src/components/Select/{__snapshots__ → __tests__/__snapshots__}/CheckboxSelectSnapshots.test.tsx.snap +6 -1
- package/src/components/Select/__tests__/__snapshots__/SimpleSelect.test.tsx.snap +170 -0
- package/src/components/Select/examples/CheckboxSelectDemo.tsx +1 -1
- package/src/components/Select/examples/SelectTemplates.md +5 -5
- package/src/components/Select/examples/{SelectSimpleDemo.tsx → SimpleSelectDemo.tsx} +6 -6
- package/src/components/Select/examples/{SelectTypeaheadDemo.tsx → TypeaheadSelectDemo.tsx} +3 -3
- package/src/components/Select/index.ts +2 -2
- package/dist/esm/components/Dropdown/DropdownSimple.d.ts.map +0 -1
- package/dist/esm/components/Dropdown/DropdownSimple.js.map +0 -1
- package/dist/esm/components/Select/SelectSimple.d.ts.map +0 -1
- package/dist/esm/components/Select/SelectSimple.js.map +0 -1
- package/dist/esm/components/Select/SelectTypeahead.d.ts.map +0 -1
- package/dist/esm/components/Select/SelectTypeahead.js.map +0 -1
- package/dist/js/components/Dropdown/DropdownSimple.d.ts.map +0 -1
- package/dist/js/components/Dropdown/DropdownSimple.js.map +0 -1
- package/dist/js/components/Select/SelectSimple.d.ts.map +0 -1
- package/dist/js/components/Select/SelectSimple.js.map +0 -1
- package/dist/js/components/Select/SelectTypeahead.d.ts.map +0 -1
- package/dist/js/components/Select/SelectTypeahead.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.22](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.21...@patternfly/react-templates@6.0.0-alpha.22) (2024-06-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
9
|
+
|
|
10
|
+
# [6.0.0-alpha.21](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-templates@6.0.0-alpha.20...@patternfly/react-templates@6.0.0-alpha.21) (2024-06-25)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @patternfly/react-templates
|
|
13
|
+
|
|
6
14
|
# [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
15
|
|
|
8
16
|
**Note:** Version bump only for package @patternfly/react-templates
|
package/components/package.json
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@patternfly/react-templates-components",
|
|
3
|
+
"main": "../dist/js/components/index.js",
|
|
4
|
+
"module": "../dist/esm/components/index.js",
|
|
5
|
+
"typings": "../dist/esm/components/index.d.ts",
|
|
6
|
+
"version": "6.0.0-alpha.21",
|
|
7
|
+
"private": true
|
|
8
|
+
}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@patternfly/react-templates-dropdown-dynamic",
|
|
3
|
+
"main": "../../../js/components/Dropdown/index.js",
|
|
4
|
+
"module": "../../../esm/components/Dropdown/index.js",
|
|
5
|
+
"typings": "../../../esm/components/Dropdown/index.d.ts",
|
|
6
|
+
"version": "6.0.0-alpha.21",
|
|
7
|
+
"private": true
|
|
8
|
+
}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@patternfly/react-templates-select-dynamic",
|
|
3
|
+
"main": "../../../js/components/Select/index.js",
|
|
4
|
+
"module": "../../../esm/components/Select/index.js",
|
|
5
|
+
"typings": "../../../esm/components/Select/index.d.ts",
|
|
6
|
+
"version": "6.0.0-alpha.21",
|
|
7
|
+
"private": true
|
|
8
|
+
}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"CheckboxSelect": "dist/dynamic/components/Select",
|
|
3
3
|
"CheckboxSelectOption": "dist/dynamic/components/Select",
|
|
4
4
|
"CheckboxSelectProps": "dist/dynamic/components/Select",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
5
|
+
"SimpleDropdown": "dist/dynamic/components/Dropdown",
|
|
6
|
+
"SimpleDropdownItem": "dist/dynamic/components/Dropdown",
|
|
7
|
+
"SimpleDropdownProps": "dist/dynamic/components/Dropdown",
|
|
8
|
+
"SimpleSelect": "dist/dynamic/components/Select",
|
|
9
|
+
"SimpleSelectOption": "dist/dynamic/components/Select",
|
|
10
|
+
"SimpleSelectProps": "dist/dynamic/components/Select",
|
|
11
|
+
"TypeaheadSelect": "dist/dynamic/components/Select",
|
|
12
|
+
"TypeaheadSelectBase": "dist/dynamic/components/Select",
|
|
13
|
+
"TypeaheadSelectOption": "dist/dynamic/components/Select",
|
|
14
|
+
"TypeaheadSelectProps": "dist/dynamic/components/Select"
|
|
15
15
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DropdownItemProps } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
2
|
+
import { DropdownItemProps, DropdownProps } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
3
|
+
import { MenuToggleProps } from '@patternfly/react-core/dist/esm/components/MenuToggle';
|
|
3
4
|
import { OUIAProps } from '@patternfly/react-core/dist/esm/helpers';
|
|
4
|
-
export interface
|
|
5
|
+
export interface SimpleDropdownItem extends Omit<DropdownItemProps, 'content'> {
|
|
5
6
|
/** Content of the dropdown item. If the isDivider prop is true, this prop will be ignored. */
|
|
6
7
|
content?: React.ReactNode;
|
|
7
8
|
/** Unique identifier for the dropdown item, which is used in the dropdown onSelect callback */
|
|
@@ -15,9 +16,9 @@ export interface DropdownSimpleItem extends Omit<DropdownItemProps, 'content'> {
|
|
|
15
16
|
*/
|
|
16
17
|
isDivider?: boolean;
|
|
17
18
|
}
|
|
18
|
-
export interface
|
|
19
|
+
export interface SimpleDropdownProps extends Omit<DropdownProps, 'toggle'>, OUIAProps {
|
|
19
20
|
/** Initial items of the dropdown. */
|
|
20
|
-
initialItems?:
|
|
21
|
+
initialItems?: SimpleDropdownItem[];
|
|
21
22
|
/** @hide Forwarded ref */
|
|
22
23
|
innerRef?: React.Ref<any>;
|
|
23
24
|
/** Flag indicating the dropdown should be disabled. */
|
|
@@ -38,6 +39,10 @@ export interface DropdownSimpleProps extends OUIAProps {
|
|
|
38
39
|
toggleContent: React.ReactNode;
|
|
39
40
|
/** Variant style of the dropdown toggle. */
|
|
40
41
|
toggleVariant?: 'default' | 'plain' | 'plainText';
|
|
42
|
+
/** Width of the toggle. */
|
|
43
|
+
toggleWidth?: string;
|
|
44
|
+
/** Additional props passed to the toggle. */
|
|
45
|
+
toggleProps?: MenuToggleProps;
|
|
41
46
|
}
|
|
42
|
-
export declare const
|
|
43
|
-
//# sourceMappingURL=
|
|
47
|
+
export declare const SimpleDropdown: React.ForwardRefExoticComponent<SimpleDropdownProps & React.RefAttributes<any>>;
|
|
48
|
+
//# sourceMappingURL=SimpleDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/SimpleDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,iBAAiB,EACjB,aAAa,EACd,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAiC,eA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C;IAC5C,aAAa,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;IAClD,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAgFD,eAAO,MAAM,cAAc,iFAEzB,CAAC"}
|
|
@@ -3,25 +3,31 @@ import React from 'react';
|
|
|
3
3
|
import { Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
4
4
|
import { MenuToggle } from '@patternfly/react-core/dist/esm/components/MenuToggle';
|
|
5
5
|
import { Divider } from '@patternfly/react-core/dist/esm/components/Divider';
|
|
6
|
-
const
|
|
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"]);
|
|
6
|
+
const SimpleDropdownBase = (_a) => {
|
|
7
|
+
var { innerRef, initialItems, onSelect: onSelectProp, onToggle: onToggleProp, isDisabled, toggleAriaLabel, toggleContent, isToggleFullWidth, toggleVariant = 'default', toggleWidth, toggleProps, shouldFocusToggleOnSelect } = _a, props = __rest(_a, ["innerRef", "initialItems", "onSelect", "onToggle", "isDisabled", "toggleAriaLabel", "toggleContent", "isToggleFullWidth", "toggleVariant", "toggleWidth", "toggleProps", "shouldFocusToggleOnSelect"]);
|
|
8
8
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
9
9
|
const onSelect = (event, value) => {
|
|
10
10
|
onSelectProp && onSelectProp(event, value);
|
|
11
|
+
onToggleProp && onToggleProp(false);
|
|
11
12
|
setIsOpen(false);
|
|
12
13
|
};
|
|
13
14
|
const onToggle = () => {
|
|
14
15
|
onToggleProp && onToggleProp(!isOpen);
|
|
15
16
|
setIsOpen(!isOpen);
|
|
16
17
|
};
|
|
17
|
-
const dropdownToggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: onToggle, isExpanded: isOpen, isDisabled: isDisabled, variant: toggleVariant, "aria-label": toggleAriaLabel, isFullWidth: isToggleFullWidth
|
|
18
|
+
const dropdownToggle = (toggleRef) => (React.createElement(MenuToggle, Object.assign({ ref: toggleRef, onClick: onToggle, isExpanded: isOpen, isDisabled: isDisabled, variant: toggleVariant, "aria-label": toggleAriaLabel, isFullWidth: isToggleFullWidth, style: {
|
|
19
|
+
width: toggleWidth
|
|
20
|
+
} }, toggleProps), toggleContent));
|
|
18
21
|
const dropdownSimpleItems = initialItems === null || initialItems === void 0 ? void 0 : initialItems.map((item) => {
|
|
19
22
|
const { content, onClick, to, value, isDivider } = item, itemProps = __rest(item, ["content", "onClick", "to", "value", "isDivider"]);
|
|
20
23
|
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
24
|
});
|
|
22
|
-
return (React.createElement(Dropdown, Object.assign({ toggle: dropdownToggle, isOpen: isOpen, onSelect: onSelect, shouldFocusToggleOnSelect: shouldFocusToggleOnSelect, onOpenChange: (isOpen) =>
|
|
25
|
+
return (React.createElement(Dropdown, Object.assign({ toggle: dropdownToggle, isOpen: isOpen, onSelect: onSelect, shouldFocusToggleOnSelect: shouldFocusToggleOnSelect, onOpenChange: (isOpen) => {
|
|
26
|
+
onToggleProp && onToggleProp(isOpen);
|
|
27
|
+
setIsOpen(isOpen);
|
|
28
|
+
}, ref: innerRef }, props),
|
|
23
29
|
React.createElement(DropdownList, null, dropdownSimpleItems)));
|
|
24
30
|
};
|
|
25
|
-
export const
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=
|
|
31
|
+
export const SimpleDropdown = React.forwardRef((props, ref) => (React.createElement(SimpleDropdownBase, Object.assign({}, props, { innerRef: ref }))));
|
|
32
|
+
SimpleDropdown.displayName = 'SimpleDropdown';
|
|
33
|
+
//# sourceMappingURL=SimpleDropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleDropdown.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/SimpleDropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EAGb,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAsC,MAAM,uDAAuD,CAAC;AACvH,OAAO,EAAE,OAAO,EAAE,MAAM,oDAAoD,CAAC;AA+C7E,MAAM,kBAAkB,GAAiD,CAAC,EAcpD,EAAE,EAAE;QAdgD,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,WAAW,EACX,WAAW,EACX,yBAAyB,OAEL,EADjB,KAAK,cAbgE,uMAczE,CADS;IAER,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,QAAQ,GAAG,CAAC,KAA4C,EAAE,KAAsB,EAAE,EAAE;QACxF,YAAY,IAAI,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC3C,YAAY,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;QACpC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,GAAG,EAAE;QACpB,YAAY,IAAI,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;QACtC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,CAAC,SAAuC,EAAE,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AC,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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './SimpleDropdown';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './SimpleDropdown';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SelectOptionProps } from '@patternfly/react-core';
|
|
2
|
+
import { MenuToggleProps, SelectOptionProps, SelectProps } from '@patternfly/react-core';
|
|
3
3
|
export interface CheckboxSelectOption extends Omit<SelectOptionProps, 'content'> {
|
|
4
4
|
/** Content of the select option. */
|
|
5
5
|
content: React.ReactNode;
|
|
6
6
|
/** Value of the select option. */
|
|
7
7
|
value: string | number;
|
|
8
8
|
}
|
|
9
|
-
export interface CheckboxSelectProps {
|
|
9
|
+
export interface CheckboxSelectProps extends Omit<SelectProps, 'toggle'> {
|
|
10
10
|
/** @hide Forwarded ref */
|
|
11
11
|
innerRef?: React.Ref<any>;
|
|
12
12
|
/** Initial options of the select. */
|
|
@@ -17,8 +17,12 @@ export interface CheckboxSelectProps {
|
|
|
17
17
|
onToggle?: (nextIsOpen: boolean) => void;
|
|
18
18
|
/** Flag indicating the select should be disabled. */
|
|
19
19
|
isDisabled?: boolean;
|
|
20
|
-
/** Content of the toggle. Defaults to
|
|
20
|
+
/** Content of the toggle. Defaults to a string with badge count of selected options. */
|
|
21
21
|
toggleContent?: React.ReactNode;
|
|
22
|
+
/** Width of the toggle. */
|
|
23
|
+
toggleWidth?: string;
|
|
24
|
+
/** Additional props passed to the toggle. */
|
|
25
|
+
toggleProps?: MenuToggleProps;
|
|
22
26
|
}
|
|
23
27
|
export declare const CheckboxSelect: React.ForwardRefExoticComponent<CheckboxSelectProps & React.RefAttributes<any>>;
|
|
24
28
|
//# sourceMappingURL=CheckboxSelect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/CheckboxSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"CheckboxSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/CheckboxSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,eAAe,EAIf,iBAAiB,EACjB,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC;IAC9E,oCAAoC;IACpC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,kCAAkC;IAClC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;IACtE,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,qCAAqC;IACrC,cAAc,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACxC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC5F,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wFAAwF;IACxF,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAoFD,eAAO,MAAM,cAAc,iFAEzB,CAAC"}
|
|
@@ -2,13 +2,13 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Badge, MenuToggle, Select, SelectList, SelectOption } from '@patternfly/react-core';
|
|
4
4
|
const CheckboxSelectBase = (_a) => {
|
|
5
|
-
var { innerRef, initialOptions, isDisabled, onSelect: passedOnSelect, onToggle, toggleContent } = _a, props = __rest(_a, ["innerRef", "initialOptions", "isDisabled", "onSelect", "onToggle", "toggleContent"]);
|
|
5
|
+
var { innerRef, initialOptions, isDisabled, onSelect: passedOnSelect, onToggle, toggleContent, toggleWidth = '200px', toggleProps } = _a, props = __rest(_a, ["innerRef", "initialOptions", "isDisabled", "onSelect", "onToggle", "toggleContent", "toggleWidth", "toggleProps"]);
|
|
6
6
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
7
7
|
const [selected, setSelected] = React.useState([]);
|
|
8
8
|
const checkboxSelectOptions = initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.map((option) => {
|
|
9
9
|
const { content, value } = option, props = __rest(option, ["content", "value"]);
|
|
10
10
|
const isSelected = selected.includes(`${value}`);
|
|
11
|
-
return (React.createElement(SelectOption, Object.assign({
|
|
11
|
+
return (React.createElement(SelectOption, Object.assign({ value: value, key: value, hasCheckbox: true, isSelected: isSelected }, props), content));
|
|
12
12
|
});
|
|
13
13
|
const onToggleClick = () => {
|
|
14
14
|
onToggle && onToggle(!isOpen);
|
|
@@ -27,10 +27,13 @@ const CheckboxSelectBase = (_a) => {
|
|
|
27
27
|
const defaultToggleContent = (React.createElement(React.Fragment, null,
|
|
28
28
|
"Filter by status",
|
|
29
29
|
selected.length > 0 && React.createElement(Badge, { isRead: true }, selected.length)));
|
|
30
|
-
const toggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, style: {
|
|
31
|
-
width:
|
|
32
|
-
} }, toggleContent || defaultToggleContent));
|
|
33
|
-
return (React.createElement(Select, Object.assign({
|
|
30
|
+
const toggle = (toggleRef) => (React.createElement(MenuToggle, Object.assign({ ref: toggleRef, onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, style: {
|
|
31
|
+
width: toggleWidth
|
|
32
|
+
} }, toggleProps), toggleContent || defaultToggleContent));
|
|
33
|
+
return (React.createElement(Select, Object.assign({ isOpen: isOpen, selected: selected, onSelect: onSelect, onOpenChange: (isOpen) => {
|
|
34
|
+
onToggle && onToggle(isOpen);
|
|
35
|
+
setIsOpen(isOpen);
|
|
36
|
+
}, toggle: toggle, ref: innerRef, role: "menu" }, props),
|
|
34
37
|
React.createElement(SelectList, null, checkboxSelectOptions)));
|
|
35
38
|
};
|
|
36
39
|
export const CheckboxSelect = React.forwardRef((props, ref) => (React.createElement(CheckboxSelectBase, Object.assign({}, props, { innerRef: ref }))));
|
|
@@ -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,
|
|
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,EAGV,MAAM,EACN,UAAU,EACV,YAAY,EAGb,MAAM,wBAAwB,CAAC;AA4BhC,MAAM,kBAAkB,GAAiD,CAAC,E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,KAAK,IAAE,QAAQ,EAAE,GAAG,IAAI,CACjD,CAAC,CAAC"}
|
package/dist/{js/components/Select/SelectSimple.d.ts → esm/components/Select/SimpleSelect.d.ts}
RENAMED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SelectOptionProps } from '@patternfly/react-core/dist/esm/components/Select';
|
|
3
|
-
|
|
2
|
+
import { SelectOptionProps, SelectProps } from '@patternfly/react-core/dist/esm/components/Select';
|
|
3
|
+
import { MenuToggleProps } from '@patternfly/react-core/dist/esm/components/MenuToggle';
|
|
4
|
+
export interface SimpleSelectOption extends Omit<SelectOptionProps, 'content'> {
|
|
4
5
|
/** Content of the select option. */
|
|
5
6
|
content: React.ReactNode;
|
|
6
7
|
/** Value of the select option. */
|
|
7
8
|
value: string | number;
|
|
8
9
|
}
|
|
9
|
-
export interface
|
|
10
|
+
export interface SimpleSelectProps extends Omit<SelectProps, 'toggle'> {
|
|
10
11
|
/** @hide Forwarded ref */
|
|
11
12
|
innerRef?: React.Ref<any>;
|
|
12
13
|
/** Initial options of the select. */
|
|
13
|
-
initialOptions?:
|
|
14
|
+
initialOptions?: SimpleSelectOption[];
|
|
14
15
|
/** Callback triggered on selection. */
|
|
15
16
|
onSelect?: (_event: React.MouseEvent<Element, MouseEvent>, selection: string | number) => void;
|
|
16
17
|
/** Callback triggered when the select opens or closes. */
|
|
@@ -19,8 +20,10 @@ export interface SelectSimpleProps {
|
|
|
19
20
|
isDisabled?: boolean;
|
|
20
21
|
/** Content of the toggle. Defaults to the selected option. */
|
|
21
22
|
toggleContent?: React.ReactNode;
|
|
22
|
-
/** Width of the toggle */
|
|
23
|
+
/** Width of the toggle. */
|
|
23
24
|
toggleWidth?: string;
|
|
25
|
+
/** Additional props passed to the toggle. */
|
|
26
|
+
toggleProps?: MenuToggleProps;
|
|
24
27
|
}
|
|
25
|
-
export declare const
|
|
26
|
-
//# sourceMappingURL=
|
|
28
|
+
export declare const SimpleSelect: React.ForwardRefExoticComponent<SimpleSelectProps & React.RefAttributes<any>>;
|
|
29
|
+
//# sourceMappingURL=SimpleSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/SimpleSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,iBAAiB,EACjB,WAAW,EACZ,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAiC,eAAe,EAAE,MAAM,uDAAuD,CAAC;AAEvH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC;IAC5E,oCAAoC;IACpC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,kCAAkC;IAClC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;IACpE,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,qCAAqC;IACrC,cAAc,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACtC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC/F,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AA0ED,eAAO,MAAM,YAAY,+EAEvB,CAAC"}
|
|
@@ -2,14 +2,14 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Select, SelectList, SelectOption } from '@patternfly/react-core/dist/esm/components/Select';
|
|
4
4
|
import { MenuToggle } from '@patternfly/react-core/dist/esm/components/MenuToggle';
|
|
5
|
-
const
|
|
6
|
-
var { innerRef, initialOptions, isDisabled, onSelect, onToggle, toggleContent, toggleWidth = '200px' } = _a, props = __rest(_a, ["innerRef", "initialOptions", "isDisabled", "onSelect", "onToggle", "toggleContent", "toggleWidth"]);
|
|
5
|
+
const SimpleSelectBase = (_a) => {
|
|
6
|
+
var { innerRef, initialOptions, isDisabled, onSelect, onToggle, toggleContent, toggleWidth = '200px', toggleProps } = _a, props = __rest(_a, ["innerRef", "initialOptions", "isDisabled", "onSelect", "onToggle", "toggleContent", "toggleWidth", "toggleProps"]);
|
|
7
7
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
8
8
|
const [selected, setSelected] = React.useState('Select a value');
|
|
9
9
|
const simpleSelectOptions = initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.map((option) => {
|
|
10
10
|
const { content, value } = option, props = __rest(option, ["content", "value"]);
|
|
11
11
|
const isSelected = selected.includes(`${value}`);
|
|
12
|
-
return (React.createElement(SelectOption, Object.assign({
|
|
12
|
+
return (React.createElement(SelectOption, Object.assign({ value: value, key: value, isSelected: isSelected }, props), content));
|
|
13
13
|
});
|
|
14
14
|
const onToggleClick = () => {
|
|
15
15
|
onToggle && onToggle(!isOpen);
|
|
@@ -18,14 +18,18 @@ const SelectSimpleBase = (_a) => {
|
|
|
18
18
|
const _onSelect = (_event, value) => {
|
|
19
19
|
onSelect && onSelect(_event, value);
|
|
20
20
|
setSelected(value);
|
|
21
|
+
onToggle && onToggle(!false);
|
|
21
22
|
setIsOpen(false);
|
|
22
23
|
};
|
|
23
|
-
const toggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, style: {
|
|
24
|
+
const toggle = (toggleRef) => (React.createElement(MenuToggle, Object.assign({ ref: toggleRef, onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, style: {
|
|
24
25
|
width: toggleWidth
|
|
25
|
-
} }, toggleContent ? toggleContent : selected));
|
|
26
|
-
return (React.createElement(Select, Object.assign({
|
|
26
|
+
} }, toggleProps), toggleContent ? toggleContent : selected));
|
|
27
|
+
return (React.createElement(Select, Object.assign({ isOpen: isOpen, selected: selected, onSelect: _onSelect, onOpenChange: (isOpen) => {
|
|
28
|
+
onToggle && onToggle(isOpen);
|
|
29
|
+
setIsOpen(isOpen);
|
|
30
|
+
}, toggle: toggle, shouldFocusToggleOnSelect: true, ref: innerRef }, props),
|
|
27
31
|
React.createElement(SelectList, null, simpleSelectOptions)));
|
|
28
32
|
};
|
|
29
|
-
export const
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=
|
|
33
|
+
export const SimpleSelect = React.forwardRef((props, ref) => (React.createElement(SimpleSelectBase, Object.assign({}, props, { innerRef: ref }))));
|
|
34
|
+
SimpleSelect.displayName = 'SimpleSelect';
|
|
35
|
+
//# sourceMappingURL=SimpleSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleSelect.js","sourceRoot":"","sources":["../../../../src/components/Select/SimpleSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,MAAM,EACN,UAAU,EACV,YAAY,EAGb,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAsC,MAAM,uDAAuD,CAAC;AA4BvH,MAAM,gBAAgB,GAA+C,CAAC,EAUlD,EAAE,EAAE;QAV8C,EACpE,QAAQ,EACR,cAAc,EACd,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,GAAG,OAAO,EACrB,WAAW,OAEO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EAAE,MAAM,EAClB,UAAU,EAAE,UAAU,EACtB,KAAK,EACH;YACE,KAAK,EAAE,WAAW;SACI,IAEtB,WAAW,GAEd,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAC9B,CACd,CAAC;IAEF,OAAO,CACL,oBAAC,MAAM,kBACL,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,SAAS,EACnB,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;YACvB,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC7B,SAAS,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC,EACD,MAAM,EAAE,MAAM,EACd,yBAAyB,QACzB,GAAG,EAAE,QAAQ,IACT,KAAK;QAET,oBAAC,UAAU,QAAE,mBAAmB,CAAc,CACvC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAwB,EAAE,GAAmB,EAAE,EAAE,CAAC,CAC9F,oBAAC,gBAAgB,oBAAK,KAAK,IAAE,QAAQ,EAAE,GAAG,IAAI,CAC/C,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SelectOptionProps } from '@patternfly/react-core';
|
|
3
|
-
export interface
|
|
2
|
+
import { SelectOptionProps, MenuToggleProps, SelectProps } from '@patternfly/react-core';
|
|
3
|
+
export interface TypeaheadSelectOption extends Omit<SelectOptionProps, 'content'> {
|
|
4
4
|
/** Content of the select option. */
|
|
5
5
|
content: string | number;
|
|
6
6
|
/** Value of the select option. */
|
|
7
7
|
value: string | number;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
9
|
+
export interface TypeaheadSelectProps extends Omit<SelectProps, 'toggle'> {
|
|
10
10
|
/** @hide Forwarded ref */
|
|
11
11
|
innerRef?: React.Ref<any>;
|
|
12
12
|
/** Initial options of the select. */
|
|
13
|
-
initialOptions:
|
|
13
|
+
initialOptions: TypeaheadSelectOption[];
|
|
14
14
|
/** Callback triggered on selection. */
|
|
15
15
|
onSelect?: (_event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<HTMLInputElement>, selection: string | number) => void;
|
|
16
16
|
/** Callback triggered when the select opens or closes. */
|
|
@@ -23,7 +23,11 @@ export interface SelectTypeaheadProps {
|
|
|
23
23
|
noOptionsFoundMessage?: string | ((filter: string) => string);
|
|
24
24
|
/** Flag indicating the select should be disabled. */
|
|
25
25
|
isDisabled?: boolean;
|
|
26
|
+
/** Width of the toggle. */
|
|
27
|
+
toggleWidth?: string;
|
|
28
|
+
/** Additional props passed to the toggle. */
|
|
29
|
+
toggleProps?: MenuToggleProps;
|
|
26
30
|
}
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const
|
|
29
|
-
//# sourceMappingURL=
|
|
31
|
+
export declare const TypeaheadSelectBase: React.FunctionComponent<TypeaheadSelectProps>;
|
|
32
|
+
export declare const TypeaheadSelect: React.ForwardRefExoticComponent<TypeaheadSelectProps & React.RefAttributes<any>>;
|
|
33
|
+
//# sourceMappingURL=TypeaheadSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeaheadSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/TypeaheadSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,iBAAiB,EAOjB,eAAe,EACf,WAAW,EACZ,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,oBAAqB,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;IACvE,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;IACrB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CA4Q7E,CAAC;AAGF,eAAO,MAAM,eAAe,kFAE1B,CAAC"}
|
|
@@ -2,8 +2,8 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Select, SelectOption, SelectList, MenuToggle, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
|
|
4
4
|
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
5
|
-
export const
|
|
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"]);
|
|
5
|
+
export const TypeaheadSelectBase = (_a) => {
|
|
6
|
+
var { innerRef, initialOptions, onSelect, onToggle, onInputChange, placeholder = 'Select an option', noOptionsFoundMessage = (filter) => `No results found for "${filter}"`, isDisabled, toggleWidth, toggleProps } = _a, props = __rest(_a, ["innerRef", "initialOptions", "onSelect", "onToggle", "onInputChange", "placeholder", "noOptionsFoundMessage", "isDisabled", "toggleWidth", "toggleProps"]);
|
|
7
7
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
8
8
|
const [selected, setSelected] = React.useState('');
|
|
9
9
|
const [inputValue, setInputValue] = React.useState('');
|
|
@@ -34,12 +34,11 @@ export const SelectTypeaheadBase = (_a) => {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
setSelectOptions(newSelectOptions);
|
|
37
|
-
}, [filterValue]);
|
|
38
|
-
const createItemId = (value) => `select-typeahead-${String(value).replace(' ', '-')}`;
|
|
37
|
+
}, [filterValue, initialOptions]);
|
|
39
38
|
const setActiveAndFocusedItem = (itemIndex) => {
|
|
40
39
|
setFocusedItemIndex(itemIndex);
|
|
41
40
|
const focusedItem = selectOptions[itemIndex];
|
|
42
|
-
setActiveItemId(
|
|
41
|
+
setActiveItemId(focusedItem.value);
|
|
43
42
|
};
|
|
44
43
|
const resetActiveAndFocusedItem = () => {
|
|
45
44
|
setFocusedItemIndex(null);
|
|
@@ -134,6 +133,7 @@ export const SelectTypeaheadBase = (_a) => {
|
|
|
134
133
|
selectOption(event, focusedItem);
|
|
135
134
|
}
|
|
136
135
|
if (!isOpen) {
|
|
136
|
+
onToggle && onToggle(true);
|
|
137
137
|
setIsOpen(true);
|
|
138
138
|
}
|
|
139
139
|
break;
|
|
@@ -159,21 +159,23 @@ export const SelectTypeaheadBase = (_a) => {
|
|
|
159
159
|
resetActiveAndFocusedItem();
|
|
160
160
|
(_a = textInputRef === null || textInputRef === void 0 ? void 0 : textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
161
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
|
|
162
|
+
const toggle = (toggleRef) => (React.createElement(MenuToggle, Object.assign({ ref: toggleRef, variant: "typeahead", "aria-label": "Typeahead menu toggle", onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, isFullWidth: true, style: {
|
|
163
|
+
width: toggleWidth
|
|
164
|
+
} }, toggleProps),
|
|
163
165
|
React.createElement(TextInputGroup, { isPlain: true },
|
|
164
|
-
React.createElement(TextInputGroupMain, Object.assign({ value: inputValue, onClick: onInputClick, onChange: onTextInputChange, onKeyDown: onInputKeyDown,
|
|
166
|
+
React.createElement(TextInputGroupMain, Object.assign({ value: inputValue, onClick: onInputClick, onChange: onTextInputChange, onKeyDown: onInputKeyDown, autoComplete: "off", innerRef: textInputRef, placeholder: placeholder }, (activeItemId && { 'aria-activedescendant': activeItemId }), { role: "combobox", isExpanded: isOpen, "aria-controls": "select-typeahead-listbox" })),
|
|
165
167
|
React.createElement(TextInputGroupUtilities, Object.assign({}, (!inputValue ? { style: { display: 'none' } } : {})),
|
|
166
168
|
React.createElement(Button, { variant: "plain", onClick: onClearButtonClick, "aria-label": "Clear input value" },
|
|
167
169
|
React.createElement(TimesIcon, { "aria-hidden": true }))))));
|
|
168
|
-
return (React.createElement(Select, Object.assign({
|
|
170
|
+
return (React.createElement(Select, Object.assign({ isOpen: isOpen, selected: selected, onSelect: _onSelect, onOpenChange: (isOpen) => {
|
|
169
171
|
!isOpen && closeMenu();
|
|
170
172
|
}, toggle: toggle, shouldFocusFirstItemOnOpen: false, ref: innerRef }, props),
|
|
171
|
-
React.createElement(SelectList,
|
|
173
|
+
React.createElement(SelectList, null, selectOptions.map((option, index) => {
|
|
172
174
|
const { content, value } = option, props = __rest(option, ["content", "value"]);
|
|
173
|
-
return (React.createElement(SelectOption, Object.assign({
|
|
175
|
+
return (React.createElement(SelectOption, Object.assign({ key: value, value: value, isFocused: focusedItemIndex === index }, props), content));
|
|
174
176
|
}))));
|
|
175
177
|
};
|
|
176
|
-
|
|
177
|
-
export const
|
|
178
|
-
|
|
179
|
-
//# sourceMappingURL=
|
|
178
|
+
TypeaheadSelectBase.displayName = 'TypeaheadSelectBase';
|
|
179
|
+
export const TypeaheadSelect = React.forwardRef((props, ref) => (React.createElement(TypeaheadSelectBase, Object.assign({}, props, { innerRef: ref }))));
|
|
180
|
+
TypeaheadSelect.displayName = 'TypeaheadSelect';
|
|
181
|
+
//# sourceMappingURL=TypeaheadSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypeaheadSelect.js","sourceRoot":"","sources":["../../../../src/components/Select/TypeaheadSelect.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,EAGP,MAAM,wBAAwB,CAAC;AAChC,OAAO,SAAS,MAAM,mDAAmD,CAAC;AAmC1E,MAAM,CAAC,MAAM,mBAAmB,GAAkD,CAAC,EAY5D,EAAE,EAAE;QAZwD,EACjF,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,GAAG,kBAAkB,EAChC,qBAAqB,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,yBAAyB,MAAM,GAAG,EACtE,UAAU,EACV,WAAW,EACX,WAAW,OAEU,EADlB,KAAK,cAXyE,2JAYlF,CADS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EAArC,oBAA4B,CAAS,CAAC;YAE5C,OAAO,CACL,oBAAC,YAAY,kBAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,KAAK,KAAK,IAAM,KAAK,GACrF,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,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DropdownItemProps } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
2
|
+
import { DropdownItemProps, DropdownProps } from '@patternfly/react-core/dist/esm/components/Dropdown';
|
|
3
|
+
import { MenuToggleProps } from '@patternfly/react-core/dist/esm/components/MenuToggle';
|
|
3
4
|
import { OUIAProps } from '@patternfly/react-core/dist/esm/helpers';
|
|
4
|
-
export interface
|
|
5
|
+
export interface SimpleDropdownItem extends Omit<DropdownItemProps, 'content'> {
|
|
5
6
|
/** Content of the dropdown item. If the isDivider prop is true, this prop will be ignored. */
|
|
6
7
|
content?: React.ReactNode;
|
|
7
8
|
/** Unique identifier for the dropdown item, which is used in the dropdown onSelect callback */
|
|
@@ -15,9 +16,9 @@ export interface DropdownSimpleItem extends Omit<DropdownItemProps, 'content'> {
|
|
|
15
16
|
*/
|
|
16
17
|
isDivider?: boolean;
|
|
17
18
|
}
|
|
18
|
-
export interface
|
|
19
|
+
export interface SimpleDropdownProps extends Omit<DropdownProps, 'toggle'>, OUIAProps {
|
|
19
20
|
/** Initial items of the dropdown. */
|
|
20
|
-
initialItems?:
|
|
21
|
+
initialItems?: SimpleDropdownItem[];
|
|
21
22
|
/** @hide Forwarded ref */
|
|
22
23
|
innerRef?: React.Ref<any>;
|
|
23
24
|
/** Flag indicating the dropdown should be disabled. */
|
|
@@ -38,6 +39,10 @@ export interface DropdownSimpleProps extends OUIAProps {
|
|
|
38
39
|
toggleContent: React.ReactNode;
|
|
39
40
|
/** Variant style of the dropdown toggle. */
|
|
40
41
|
toggleVariant?: 'default' | 'plain' | 'plainText';
|
|
42
|
+
/** Width of the toggle. */
|
|
43
|
+
toggleWidth?: string;
|
|
44
|
+
/** Additional props passed to the toggle. */
|
|
45
|
+
toggleProps?: MenuToggleProps;
|
|
41
46
|
}
|
|
42
|
-
export declare const
|
|
43
|
-
//# sourceMappingURL=
|
|
47
|
+
export declare const SimpleDropdown: React.ForwardRefExoticComponent<SimpleDropdownProps & React.RefAttributes<any>>;
|
|
48
|
+
//# sourceMappingURL=SimpleDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleDropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/SimpleDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,iBAAiB,EACjB,aAAa,EACd,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAiC,eAAe,EAAE,MAAM,uDAAuD,CAAC;AAEvH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC;IAC5E,8FAA8F;IAC9F,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,+FAA+F;IAC/F,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,sDAAsD;IACtD,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CA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