@patternfly/react-templates 6.0.0-alpha.5 → 6.0.0-alpha.50
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 +186 -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 +19 -0
- package/dist/esm/components/Dropdown/SimpleDropdown.d.ts +48 -0
- package/dist/esm/components/Dropdown/SimpleDropdown.d.ts.map +1 -0
- package/dist/esm/components/Dropdown/SimpleDropdown.js +33 -0
- package/dist/esm/components/Dropdown/SimpleDropdown.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.d.ts +7 -3
- package/dist/esm/components/Select/CheckboxSelect.d.ts.map +1 -1
- package/dist/esm/components/Select/CheckboxSelect.js +14 -6
- package/dist/esm/components/Select/CheckboxSelect.js.map +1 -1
- package/dist/esm/components/Select/MultiTypeaheadSelect.d.ts +33 -0
- package/dist/esm/components/Select/MultiTypeaheadSelect.d.ts.map +1 -0
- package/dist/esm/components/Select/MultiTypeaheadSelect.js +186 -0
- package/dist/esm/components/Select/MultiTypeaheadSelect.js.map +1 -0
- package/dist/esm/components/Select/{SelectSimple.d.ts → SimpleSelect.d.ts} +12 -7
- package/dist/esm/components/Select/SimpleSelect.d.ts.map +1 -0
- package/dist/esm/components/Select/SimpleSelect.js +39 -0
- package/dist/esm/components/Select/SimpleSelect.js.map +1 -0
- package/dist/esm/components/Select/TypeaheadSelect.d.ts +43 -0
- package/dist/esm/components/Select/TypeaheadSelect.d.ts.map +1 -0
- package/dist/esm/components/Select/TypeaheadSelect.js +219 -0
- package/dist/esm/components/Select/TypeaheadSelect.js.map +1 -0
- package/dist/esm/components/Select/index.d.ts +3 -1
- package/dist/esm/components/Select/index.d.ts.map +1 -1
- package/dist/esm/components/Select/index.js +3 -1
- 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/SimpleDropdown.d.ts +48 -0
- package/dist/js/components/Dropdown/SimpleDropdown.d.ts.map +1 -0
- package/dist/js/components/Dropdown/SimpleDropdown.js +36 -0
- package/dist/js/components/Dropdown/SimpleDropdown.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.d.ts +7 -3
- package/dist/js/components/Select/CheckboxSelect.d.ts.map +1 -1
- package/dist/js/components/Select/CheckboxSelect.js +14 -6
- package/dist/js/components/Select/CheckboxSelect.js.map +1 -1
- package/dist/js/components/Select/MultiTypeaheadSelect.d.ts +33 -0
- package/dist/js/components/Select/MultiTypeaheadSelect.d.ts.map +1 -0
- package/dist/js/components/Select/MultiTypeaheadSelect.js +190 -0
- package/dist/js/components/Select/MultiTypeaheadSelect.js.map +1 -0
- package/dist/js/components/Select/{SelectSimple.d.ts → SimpleSelect.d.ts} +12 -7
- package/dist/js/components/Select/SimpleSelect.d.ts.map +1 -0
- package/dist/js/components/Select/SimpleSelect.js +42 -0
- package/dist/js/components/Select/SimpleSelect.js.map +1 -0
- package/dist/js/components/Select/TypeaheadSelect.d.ts +43 -0
- package/dist/js/components/Select/TypeaheadSelect.d.ts.map +1 -0
- package/dist/js/components/Select/TypeaheadSelect.js +223 -0
- package/dist/js/components/Select/TypeaheadSelect.js.map +1 -0
- package/dist/js/components/Select/index.d.ts +3 -1
- package/dist/js/components/Select/index.d.ts.map +1 -1
- package/dist/js/components/Select/index.js +3 -1
- 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-D-BvMJB5.css +23382 -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/SimpleDropdown.tsx +139 -0
- package/src/components/Dropdown/__tests__/SimpleDropdown.test.tsx +266 -0
- package/src/components/Dropdown/__tests__/__snapshots__/SimpleDropdown.test.tsx.snap +81 -0
- package/src/components/Dropdown/examples/DropdownTemplates.md +24 -0
- package/src/components/Dropdown/examples/SimpleDropdownExample.tsx +53 -0
- package/src/components/Dropdown/index.ts +1 -0
- package/src/components/Select/CheckboxSelect.tsx +23 -7
- package/src/components/Select/MultiTypeaheadSelect.tsx +348 -0
- package/src/components/Select/{SelectSimple.tsx → SimpleSelect.tsx} +39 -18
- package/src/components/Select/TypeaheadSelect.tsx +388 -0
- 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__/MultiTypeaheadSelect.test.tsx +414 -0
- package/src/components/Select/__tests__/SimpleSelect.test.tsx +241 -0
- package/src/components/Select/__tests__/TypeaheadSelect.test.tsx +408 -0
- package/src/components/Select/__tests__/__snapshots__/CheckboxSelectSnapshots.test.tsx.snap +83 -0
- package/src/components/Select/__tests__/__snapshots__/MultiTypeaheadSelect.test.tsx.snap +97 -0
- package/src/components/Select/__tests__/__snapshots__/SimpleSelect.test.tsx.snap +83 -0
- package/src/components/Select/__tests__/__snapshots__/TypeaheadSelect.test.tsx.snap +97 -0
- package/src/components/Select/examples/CheckboxSelectDemo.tsx +25 -8
- package/src/components/Select/examples/MultiTypeaheadSelectDemo.tsx +35 -0
- package/src/components/Select/examples/SelectTemplates.md +17 -4
- package/src/components/Select/examples/SimpleSelectDemo.tsx +36 -0
- package/src/components/Select/examples/TypeaheadSelectDemo.tsx +65 -0
- package/src/components/Select/index.ts +3 -1
- package/src/components/index.ts +1 -0
- package/dist/esm/components/Select/SelectSimple.d.ts.map +0 -1
- package/dist/esm/components/Select/SelectSimple.js +0 -31
- package/dist/esm/components/Select/SelectSimple.js.map +0 -1
- package/dist/js/components/Select/SelectSimple.d.ts.map +0 -1
- package/dist/js/components/Select/SelectSimple.js +0 -34
- package/dist/js/components/Select/SelectSimple.js.map +0 -1
- package/src/components/Select/__snapshots__/CheckboxSelectSnapshots.test.tsx.snap +0 -212
- package/src/components/Select/examples/SelectSimpleDemo.tsx +0 -26
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Matches snapshot 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="pf-v6-c-menu-toggle pf-m-expanded pf-m-full-width pf-m-typeahead"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="pf-v6-c-text-input-group pf-m-plain"
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
autocomplete="off"
|
|
13
|
+
class="pf-v6-c-text-input-group__main"
|
|
14
|
+
>
|
|
15
|
+
<span
|
|
16
|
+
class="pf-v6-c-text-input-group__text"
|
|
17
|
+
>
|
|
18
|
+
<input
|
|
19
|
+
aria-controls="select-typeahead-listbox"
|
|
20
|
+
aria-expanded="true"
|
|
21
|
+
aria-label="Type to filter"
|
|
22
|
+
class="pf-v6-c-text-input-group__text-input"
|
|
23
|
+
placeholder="Select an option"
|
|
24
|
+
role="combobox"
|
|
25
|
+
type="text"
|
|
26
|
+
value=""
|
|
27
|
+
/>
|
|
28
|
+
</span>
|
|
29
|
+
</div>
|
|
30
|
+
<div
|
|
31
|
+
class="pf-v6-c-text-input-group__utilities"
|
|
32
|
+
style="display: none;"
|
|
33
|
+
>
|
|
34
|
+
<button
|
|
35
|
+
aria-disabled="false"
|
|
36
|
+
aria-label="Clear input value"
|
|
37
|
+
class="pf-v6-c-button pf-m-plain"
|
|
38
|
+
data-ouia-component-id="OUIA-Generated-Button-plain-17"
|
|
39
|
+
data-ouia-component-type="PF6/Button"
|
|
40
|
+
data-ouia-safe="true"
|
|
41
|
+
type="button"
|
|
42
|
+
>
|
|
43
|
+
<span
|
|
44
|
+
class="pf-v6-c-button__icon pf-m-start"
|
|
45
|
+
>
|
|
46
|
+
<svg
|
|
47
|
+
aria-hidden="true"
|
|
48
|
+
class="pf-v6-svg"
|
|
49
|
+
fill="currentColor"
|
|
50
|
+
height="1em"
|
|
51
|
+
role="img"
|
|
52
|
+
viewBox="0 0 352 512"
|
|
53
|
+
width="1em"
|
|
54
|
+
>
|
|
55
|
+
<path
|
|
56
|
+
d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"
|
|
57
|
+
/>
|
|
58
|
+
</svg>
|
|
59
|
+
</span>
|
|
60
|
+
</button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
<button
|
|
64
|
+
aria-expanded="true"
|
|
65
|
+
aria-label="Typeahead menu toggle"
|
|
66
|
+
class="pf-v6-c-menu-toggle__button"
|
|
67
|
+
data-ouia-component-id="OUIA-Generated-MenuToggle-typeahead-17"
|
|
68
|
+
data-ouia-component-type="PF6/MenuToggle"
|
|
69
|
+
data-ouia-safe="true"
|
|
70
|
+
tabindex="-1"
|
|
71
|
+
type="button"
|
|
72
|
+
>
|
|
73
|
+
<span
|
|
74
|
+
class="pf-v6-c-menu-toggle__controls"
|
|
75
|
+
>
|
|
76
|
+
<span
|
|
77
|
+
class="pf-v6-c-menu-toggle__toggle-icon"
|
|
78
|
+
>
|
|
79
|
+
<svg
|
|
80
|
+
aria-hidden="true"
|
|
81
|
+
class="pf-v6-svg"
|
|
82
|
+
fill="currentColor"
|
|
83
|
+
height="1em"
|
|
84
|
+
role="img"
|
|
85
|
+
viewBox="0 0 320 512"
|
|
86
|
+
width="1em"
|
|
87
|
+
>
|
|
88
|
+
<path
|
|
89
|
+
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
90
|
+
/>
|
|
91
|
+
</svg>
|
|
92
|
+
</span>
|
|
93
|
+
</span>
|
|
94
|
+
</button>
|
|
95
|
+
</div>
|
|
96
|
+
</DocumentFragment>
|
|
97
|
+
`;
|
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CheckboxSelect, CheckboxSelectOption } from '@patternfly/react-templates';
|
|
3
3
|
|
|
4
|
+
const Options: { content: string; value: string; description?: string; isDisabled?: boolean }[] = [
|
|
5
|
+
{ content: 'Option 1', value: 'option-1' },
|
|
6
|
+
{ content: 'Option 2', value: 'option-2', description: 'Option with description' },
|
|
7
|
+
{ content: 'Option 3', value: 'option-3', isDisabled: true },
|
|
8
|
+
{ content: 'Option 4', value: 'option-4' }
|
|
9
|
+
];
|
|
10
|
+
|
|
4
11
|
export const SelectBasic: React.FunctionComponent = () => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return
|
|
12
|
+
const [selected, setSelected] = React.useState<string[]>(['option-2']);
|
|
13
|
+
|
|
14
|
+
const initialOptions = React.useMemo<CheckboxSelectOption[]>(
|
|
15
|
+
() => Options.map((o) => ({ ...o, selected: selected.includes(o.value) })),
|
|
16
|
+
[selected]
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<CheckboxSelect
|
|
21
|
+
initialOptions={initialOptions}
|
|
22
|
+
onSelect={(_ev, value) => {
|
|
23
|
+
const val = String(value);
|
|
24
|
+
setSelected((prevSelected) =>
|
|
25
|
+
prevSelected.includes(val) ? prevSelected.filter((item) => item !== val) : [...prevSelected, String(val)]
|
|
26
|
+
);
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
13
30
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MultiTypeaheadSelect, MultiTypeaheadSelectOption } from '@patternfly/react-templates';
|
|
3
|
+
|
|
4
|
+
const Options = [
|
|
5
|
+
{ content: 'Alabama', value: 'option1' },
|
|
6
|
+
{ content: 'Arizona', value: 'option2' },
|
|
7
|
+
{ content: 'California', value: 'option3' },
|
|
8
|
+
{ content: 'Florida', value: 'option4' },
|
|
9
|
+
{ content: 'Massachusetts', value: 'option5' },
|
|
10
|
+
{ content: 'Maine', value: 'option6' },
|
|
11
|
+
{ content: 'New Jersey', value: 'option7' },
|
|
12
|
+
{ content: 'New Mexico', value: 'option8' },
|
|
13
|
+
{ content: 'New York', value: 'option9' },
|
|
14
|
+
{ content: 'North Carolina', value: 'option10' }
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
type SelectionsType = (string | number)[];
|
|
18
|
+
|
|
19
|
+
export const MultiSelectTypeaheadDemo: React.FunctionComponent = () => {
|
|
20
|
+
const [selected, setSelected] = React.useState<SelectionsType>(['option5']);
|
|
21
|
+
|
|
22
|
+
const initialOptions = React.useMemo<MultiTypeaheadSelectOption[]>(
|
|
23
|
+
() => Options.map((o) => ({ ...o, selected: selected.includes(o.value) })),
|
|
24
|
+
[selected]
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<MultiTypeaheadSelect
|
|
29
|
+
initialOptions={initialOptions}
|
|
30
|
+
placeholder="Select a state"
|
|
31
|
+
noOptionsFoundMessage={(filter) => `No state was found for "${filter}"`}
|
|
32
|
+
onSelectionChange={(_ev, selections) => setSelected(selections)}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -4,25 +4,38 @@ section: components
|
|
|
4
4
|
subsection: menus
|
|
5
5
|
template: true
|
|
6
6
|
beta: true
|
|
7
|
-
propComponents: ['
|
|
7
|
+
propComponents: ['SimpleSelect', 'CheckboxSelect', 'TypeaheadSelect']
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
Note: Templates live in their own package at [@patternfly/react-templates](https://www.npmjs.com/package/@patternfly/react-templates)!
|
|
11
11
|
|
|
12
12
|
For custom use cases, please see the select component suite from [@patternfly/react-core](https://www.npmjs.com/package/@patternfly/react-core).
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { Checkbox } from '@patternfly/react-core';
|
|
15
|
+
import { SimpleSelect, CheckboxSelect, TypeaheadSelect, MultiTypeaheadSelect } from '@patternfly/react-templates';
|
|
16
16
|
|
|
17
17
|
## Select template examples
|
|
18
18
|
|
|
19
19
|
### Simple
|
|
20
20
|
|
|
21
|
-
```ts file="
|
|
21
|
+
```ts file="SimpleSelectDemo.tsx"
|
|
22
22
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Checkbox
|
|
26
26
|
|
|
27
27
|
```ts file="CheckboxSelectDemo.tsx"
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Typeahead
|
|
32
|
+
|
|
33
|
+
```ts file="TypeaheadSelectDemo.tsx"
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Multi-Typeahead
|
|
38
|
+
|
|
39
|
+
```ts file="MultiTypeaheadSelectDemo.tsx"
|
|
40
|
+
|
|
28
41
|
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Checkbox } from '@patternfly/react-core';
|
|
3
|
+
import { SimpleSelect, SimpleSelectOption } from '@patternfly/react-templates';
|
|
4
|
+
|
|
5
|
+
const Options: SimpleSelectOption[] = [
|
|
6
|
+
{ content: 'Option 1', value: 'Option1' },
|
|
7
|
+
{ content: 'Option 2', value: 'Option2', description: 'Option with description' },
|
|
8
|
+
{ content: 'Option 3', value: 'Option3' }
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export const SelectSimpleDemo: React.FunctionComponent = () => {
|
|
12
|
+
const [isDisabled, setIsDisabled] = React.useState<boolean>(false);
|
|
13
|
+
const [selected, setSelected] = React.useState<string | undefined>('Option1');
|
|
14
|
+
|
|
15
|
+
const initialOptions = React.useMemo<SimpleSelectOption[]>(
|
|
16
|
+
() => Options.map((o) => ({ ...o, selected: o.value === selected })),
|
|
17
|
+
[selected]
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<React.Fragment>
|
|
22
|
+
<Checkbox
|
|
23
|
+
id="toggle-disabled"
|
|
24
|
+
label="isDisabled"
|
|
25
|
+
isChecked={isDisabled}
|
|
26
|
+
onChange={(_event, checked) => setIsDisabled(checked)}
|
|
27
|
+
style={{ marginBottom: 20 }}
|
|
28
|
+
/>
|
|
29
|
+
<SimpleSelect
|
|
30
|
+
initialOptions={initialOptions}
|
|
31
|
+
isDisabled={isDisabled}
|
|
32
|
+
onSelect={(_ev, selection) => setSelected(String(selection))}
|
|
33
|
+
/>
|
|
34
|
+
</React.Fragment>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TypeaheadSelect, TypeaheadSelectOption } from '@patternfly/react-templates';
|
|
3
|
+
import { Checkbox } from '@patternfly/react-core';
|
|
4
|
+
|
|
5
|
+
const Options = [
|
|
6
|
+
{ content: 'Alabama', value: 'option1' },
|
|
7
|
+
{ content: 'Florida', value: 'option2' },
|
|
8
|
+
{ content: 'New Jersey', value: 'option3' },
|
|
9
|
+
{ content: 'New Mexico', value: 'option4' },
|
|
10
|
+
{ content: 'New York', value: 'option5' },
|
|
11
|
+
{ content: 'North Carolina', value: 'option6' }
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
/* eslint-disable no-console */
|
|
15
|
+
export const SelectTypeaheadDemo: React.FunctionComponent = () => {
|
|
16
|
+
const [selected, setSelected] = React.useState<string | undefined>();
|
|
17
|
+
const [options, setOptions] = React.useState(Options);
|
|
18
|
+
const [isCreatable, setIsCreatable] = React.useState<boolean>(false);
|
|
19
|
+
const [isCreateOptionOnTop, setIsCreateOptionOnTop] = React.useState<boolean>(false);
|
|
20
|
+
|
|
21
|
+
const initialOptions = React.useMemo<TypeaheadSelectOption[]>(
|
|
22
|
+
() => options.map((o) => ({ ...o, selected: o.value === selected })),
|
|
23
|
+
[options, selected]
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
console.log(`Selected: ${selected || 'none'}`);
|
|
28
|
+
}, [selected]);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<TypeaheadSelect
|
|
33
|
+
initialOptions={initialOptions}
|
|
34
|
+
placeholder="Select a state"
|
|
35
|
+
noOptionsFoundMessage={(filter) => `No state was found for "${filter}"`}
|
|
36
|
+
onClearSelection={() => setSelected(undefined)}
|
|
37
|
+
onSelect={(_ev, selection) => {
|
|
38
|
+
if (!options.find((o) => o.value === selection)) {
|
|
39
|
+
setOptions([...options, { content: String(selection), value: String(selection) }]);
|
|
40
|
+
}
|
|
41
|
+
setSelected(String(selection));
|
|
42
|
+
}}
|
|
43
|
+
isCreatable={isCreatable}
|
|
44
|
+
isCreateOptionOnTop={isCreateOptionOnTop}
|
|
45
|
+
/>
|
|
46
|
+
<Checkbox
|
|
47
|
+
className="pf-u-mt-sm"
|
|
48
|
+
label="isCreatable"
|
|
49
|
+
isChecked={isCreatable}
|
|
50
|
+
onChange={(_event, checked) => setIsCreatable(checked)}
|
|
51
|
+
aria-label="toggle creatable checkbox"
|
|
52
|
+
id="toggle-creatable-typeahead"
|
|
53
|
+
name="toggle-creatable-typeahead"
|
|
54
|
+
/>
|
|
55
|
+
<Checkbox
|
|
56
|
+
label="isCreateOptionOnTop"
|
|
57
|
+
isChecked={isCreateOptionOnTop}
|
|
58
|
+
onChange={(_event, checked) => setIsCreateOptionOnTop(checked)}
|
|
59
|
+
aria-label="toggle createOptionOnTop checkbox"
|
|
60
|
+
id="toggle-create-option-on-top-typeahead"
|
|
61
|
+
name="toggle-create-option-on-top-typeahead"
|
|
62
|
+
/>
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectSimple.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/SelectSimple.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoC,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AAGxH,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,iBAAiB;IAChC,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,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAqED,eAAO,MAAM,YAAY,+EAEvB,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Select, SelectList, SelectOption } from '@patternfly/react-core/dist/esm/components/Select';
|
|
4
|
-
import { MenuToggle } from '@patternfly/react-core/dist/esm/components/MenuToggle';
|
|
5
|
-
const SelectSimpleBase = (_a) => {
|
|
6
|
-
var { innerRef, initialOptions, isDisabled, onSelect, onToggle, toggleContent, toggleWidth = '200px' } = _a, props = __rest(_a, ["innerRef", "initialOptions", "isDisabled", "onSelect", "onToggle", "toggleContent", "toggleWidth"]);
|
|
7
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
8
|
-
const [selected, setSelected] = React.useState('Select a value');
|
|
9
|
-
const simpleSelectOptions = initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.map((option) => {
|
|
10
|
-
const { content, value } = option, props = __rest(option, ["content", "value"]);
|
|
11
|
-
const isSelected = selected.includes(`${value}`);
|
|
12
|
-
return (React.createElement(SelectOption, Object.assign({}, props, { value: value, key: value, isSelected: isSelected }), content));
|
|
13
|
-
});
|
|
14
|
-
const onToggleClick = () => {
|
|
15
|
-
onToggle && onToggle(!isOpen);
|
|
16
|
-
setIsOpen(!isOpen);
|
|
17
|
-
};
|
|
18
|
-
const _onSelect = (_event, value) => {
|
|
19
|
-
onSelect && onSelect(_event, value);
|
|
20
|
-
setSelected(value);
|
|
21
|
-
setIsOpen(false);
|
|
22
|
-
};
|
|
23
|
-
const toggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, style: {
|
|
24
|
-
width: toggleWidth
|
|
25
|
-
} }, toggleContent ? toggleContent : selected));
|
|
26
|
-
return (React.createElement(Select, Object.assign({ id: "single-select", isOpen: isOpen, selected: selected, onSelect: _onSelect, onOpenChange: (isOpen) => setIsOpen(isOpen), toggle: toggle, shouldFocusToggleOnSelect: true, ref: innerRef }, props),
|
|
27
|
-
React.createElement(SelectList, null, simpleSelectOptions)));
|
|
28
|
-
};
|
|
29
|
-
export const SelectSimple = React.forwardRef((props, ref) => (React.createElement(SelectSimpleBase, Object.assign({}, props, { innerRef: ref }))));
|
|
30
|
-
SelectSimple.displayName = 'SelectSimple';
|
|
31
|
-
//# sourceMappingURL=SelectSimple.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectSimple.js","sourceRoot":"","sources":["../../../../src/components/Select/SelectSimple.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAqB,MAAM,mDAAmD,CAAC;AACxH,OAAO,EAAE,UAAU,EAAqB,MAAM,uDAAuD,CAAC;AA0BtG,MAAM,gBAAgB,GAA+C,CAAC,EASlD,EAAE,EAAE;QAT8C,EACpE,QAAQ,EACR,cAAc,EACd,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,GAAG,OAAO,OAEH,EADf,KAAK,cAR4D,oGASrE,CADS;IAER,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,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/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,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAqED,eAAO,MAAM,YAAY,+EAEvB,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectSimple = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const Select_1 = require('@patternfly/react-core/dist/js/components/Select');
|
|
7
|
-
const MenuToggle_1 = require('@patternfly/react-core/dist/js/components/MenuToggle');
|
|
8
|
-
const SelectSimpleBase = (_a) => {
|
|
9
|
-
var { innerRef, initialOptions, isDisabled, onSelect, onToggle, toggleContent, toggleWidth = '200px' } = _a, props = tslib_1.__rest(_a, ["innerRef", "initialOptions", "isDisabled", "onSelect", "onToggle", "toggleContent", "toggleWidth"]);
|
|
10
|
-
const [isOpen, setIsOpen] = react_1.default.useState(false);
|
|
11
|
-
const [selected, setSelected] = react_1.default.useState('Select a value');
|
|
12
|
-
const simpleSelectOptions = initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.map((option) => {
|
|
13
|
-
const { content, value } = option, props = tslib_1.__rest(option, ["content", "value"]);
|
|
14
|
-
const isSelected = selected.includes(`${value}`);
|
|
15
|
-
return (react_1.default.createElement(Select_1.SelectOption, Object.assign({}, props, { value: value, key: value, isSelected: isSelected }), content));
|
|
16
|
-
});
|
|
17
|
-
const onToggleClick = () => {
|
|
18
|
-
onToggle && onToggle(!isOpen);
|
|
19
|
-
setIsOpen(!isOpen);
|
|
20
|
-
};
|
|
21
|
-
const _onSelect = (_event, value) => {
|
|
22
|
-
onSelect && onSelect(_event, value);
|
|
23
|
-
setSelected(value);
|
|
24
|
-
setIsOpen(false);
|
|
25
|
-
};
|
|
26
|
-
const toggle = (toggleRef) => (react_1.default.createElement(MenuToggle_1.MenuToggle, { ref: toggleRef, onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, style: {
|
|
27
|
-
width: toggleWidth
|
|
28
|
-
} }, toggleContent ? toggleContent : selected));
|
|
29
|
-
return (react_1.default.createElement(Select_1.Select, Object.assign({ id: "single-select", isOpen: isOpen, selected: selected, onSelect: _onSelect, onOpenChange: (isOpen) => setIsOpen(isOpen), toggle: toggle, shouldFocusToggleOnSelect: true, ref: innerRef }, props),
|
|
30
|
-
react_1.default.createElement(Select_1.SelectList, null, simpleSelectOptions)));
|
|
31
|
-
};
|
|
32
|
-
exports.SelectSimple = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(SelectSimpleBase, Object.assign({}, props, { innerRef: ref }))));
|
|
33
|
-
exports.SelectSimple.displayName = 'SelectSimple';
|
|
34
|
-
//# sourceMappingURL=SelectSimple.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectSimple.js","sourceRoot":"","sources":["../../../../src/components/Select/SelectSimple.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,6EAAwH;AACxH,qFAAsG;AA0BtG,MAAM,gBAAgB,GAA+C,CAAC,EASlD,EAAE,EAAE;QAT8C,EACpE,QAAQ,EACR,cAAc,EACd,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,GAAG,OAAO,OAEH,EADf,KAAK,sBAR4D,oGASrE,CADS;IAER,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAS,gBAAgB,CAAC,CAAC;IAE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,EAAE,SAAS,EACnB,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,EAC3C,MAAM,EAAE,MAAM,EACd,yBAAyB,QACzB,GAAG,EAAE,QAAQ,IACT,KAAK;QAET,8BAAC,mBAAU,QAAE,mBAAmB,CAAc,CACvC,CACV,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,YAAY,GAAG,eAAK,CAAC,UAAU,CAAC,CAAC,KAAwB,EAAE,GAAmB,EAAE,EAAE,CAAC,CAC9F,8BAAC,gBAAgB,oBAAK,KAAK,IAAE,QAAQ,EAAE,GAAG,IAAI,CAC/C,CAAC,CAAC;AAEH,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`checkbox select with no props snapshot 1`] = `
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<button
|
|
6
|
-
aria-expanded="false"
|
|
7
|
-
class="pf-v6-c-menu-toggle"
|
|
8
|
-
style="width: 200px;"
|
|
9
|
-
type="button"
|
|
10
|
-
>
|
|
11
|
-
<span
|
|
12
|
-
class="pf-v6-c-menu-toggle__text"
|
|
13
|
-
>
|
|
14
|
-
Filter by status
|
|
15
|
-
</span>
|
|
16
|
-
<span
|
|
17
|
-
class="pf-v6-c-menu-toggle__controls"
|
|
18
|
-
>
|
|
19
|
-
<span
|
|
20
|
-
class="pf-v6-c-menu-toggle__toggle-icon"
|
|
21
|
-
>
|
|
22
|
-
<svg
|
|
23
|
-
aria-hidden="true"
|
|
24
|
-
class="pf-v6-svg"
|
|
25
|
-
fill="currentColor"
|
|
26
|
-
height="1em"
|
|
27
|
-
role="img"
|
|
28
|
-
viewBox="0 0 320 512"
|
|
29
|
-
width="1em"
|
|
30
|
-
>
|
|
31
|
-
<path
|
|
32
|
-
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
33
|
-
/>
|
|
34
|
-
</svg>
|
|
35
|
-
</span>
|
|
36
|
-
</span>
|
|
37
|
-
</button>
|
|
38
|
-
</DocumentFragment>
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
exports[`opened checkbox select snapshot 1`] = `
|
|
42
|
-
<DocumentFragment>
|
|
43
|
-
<button
|
|
44
|
-
aria-expanded="true"
|
|
45
|
-
class="pf-v6-c-menu-toggle pf-m-expanded"
|
|
46
|
-
style="width: 200px;"
|
|
47
|
-
type="button"
|
|
48
|
-
>
|
|
49
|
-
<span
|
|
50
|
-
class="pf-v6-c-menu-toggle__text"
|
|
51
|
-
>
|
|
52
|
-
Filter by status
|
|
53
|
-
</span>
|
|
54
|
-
<span
|
|
55
|
-
class="pf-v6-c-menu-toggle__controls"
|
|
56
|
-
>
|
|
57
|
-
<span
|
|
58
|
-
class="pf-v6-c-menu-toggle__toggle-icon"
|
|
59
|
-
>
|
|
60
|
-
<svg
|
|
61
|
-
aria-hidden="true"
|
|
62
|
-
class="pf-v6-svg"
|
|
63
|
-
fill="currentColor"
|
|
64
|
-
height="1em"
|
|
65
|
-
role="img"
|
|
66
|
-
viewBox="0 0 320 512"
|
|
67
|
-
width="1em"
|
|
68
|
-
>
|
|
69
|
-
<path
|
|
70
|
-
d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"
|
|
71
|
-
/>
|
|
72
|
-
</svg>
|
|
73
|
-
</span>
|
|
74
|
-
</span>
|
|
75
|
-
</button>
|
|
76
|
-
<div
|
|
77
|
-
class="pf-v6-c-menu"
|
|
78
|
-
data-ouia-component-id="OUIA-Generated-Select-3"
|
|
79
|
-
data-ouia-component-type="PF6/Select"
|
|
80
|
-
data-ouia-safe="true"
|
|
81
|
-
data-popper-escaped="true"
|
|
82
|
-
data-popper-placement="bottom-start"
|
|
83
|
-
data-popper-reference-hidden="true"
|
|
84
|
-
id="checkbox-select"
|
|
85
|
-
style="position: absolute; left: 0px; top: 0px; z-index: 9999; opacity: 1; transition: opacity 0ms cubic-bezier(.54, 1.5, .38, 1.11); min-width: 0px; transform: translate(0px, 0px);"
|
|
86
|
-
>
|
|
87
|
-
<div
|
|
88
|
-
class="pf-v6-c-menu__content"
|
|
89
|
-
>
|
|
90
|
-
<ul
|
|
91
|
-
class="pf-v6-c-menu__list"
|
|
92
|
-
role="menu"
|
|
93
|
-
>
|
|
94
|
-
<li
|
|
95
|
-
class="pf-v6-c-menu__list-item"
|
|
96
|
-
role="menuitem"
|
|
97
|
-
>
|
|
98
|
-
<label
|
|
99
|
-
class="pf-v6-c-menu__item"
|
|
100
|
-
for="generated-id"
|
|
101
|
-
tabindex="-1"
|
|
102
|
-
>
|
|
103
|
-
<span
|
|
104
|
-
class="pf-v6-c-menu__item-main"
|
|
105
|
-
>
|
|
106
|
-
<span
|
|
107
|
-
class="pf-v6-c-menu__item-check"
|
|
108
|
-
>
|
|
109
|
-
<span
|
|
110
|
-
class="pf-v6-c-check pf-m-standalone"
|
|
111
|
-
>
|
|
112
|
-
<input
|
|
113
|
-
aria-disabled="false"
|
|
114
|
-
aria-invalid="false"
|
|
115
|
-
class="pf-v6-c-check__input"
|
|
116
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-1"
|
|
117
|
-
data-ouia-component-type="PF6/Checkbox"
|
|
118
|
-
data-ouia-safe="true"
|
|
119
|
-
id="generated-id"
|
|
120
|
-
type="checkbox"
|
|
121
|
-
/>
|
|
122
|
-
</span>
|
|
123
|
-
</span>
|
|
124
|
-
<span
|
|
125
|
-
class="pf-v6-c-menu__item-text"
|
|
126
|
-
>
|
|
127
|
-
Option 1
|
|
128
|
-
</span>
|
|
129
|
-
</span>
|
|
130
|
-
</label>
|
|
131
|
-
</li>
|
|
132
|
-
<li
|
|
133
|
-
class="pf-v6-c-menu__list-item"
|
|
134
|
-
role="menuitem"
|
|
135
|
-
>
|
|
136
|
-
<label
|
|
137
|
-
class="pf-v6-c-menu__item"
|
|
138
|
-
for="generated-id"
|
|
139
|
-
tabindex="-1"
|
|
140
|
-
>
|
|
141
|
-
<span
|
|
142
|
-
class="pf-v6-c-menu__item-main"
|
|
143
|
-
>
|
|
144
|
-
<span
|
|
145
|
-
class="pf-v6-c-menu__item-check"
|
|
146
|
-
>
|
|
147
|
-
<span
|
|
148
|
-
class="pf-v6-c-check pf-m-standalone"
|
|
149
|
-
>
|
|
150
|
-
<input
|
|
151
|
-
aria-disabled="false"
|
|
152
|
-
aria-invalid="false"
|
|
153
|
-
class="pf-v6-c-check__input"
|
|
154
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-2"
|
|
155
|
-
data-ouia-component-type="PF6/Checkbox"
|
|
156
|
-
data-ouia-safe="true"
|
|
157
|
-
id="generated-id"
|
|
158
|
-
type="checkbox"
|
|
159
|
-
/>
|
|
160
|
-
</span>
|
|
161
|
-
</span>
|
|
162
|
-
<span
|
|
163
|
-
class="pf-v6-c-menu__item-text"
|
|
164
|
-
>
|
|
165
|
-
Option 2
|
|
166
|
-
</span>
|
|
167
|
-
</span>
|
|
168
|
-
</label>
|
|
169
|
-
</li>
|
|
170
|
-
<li
|
|
171
|
-
class="pf-v6-c-menu__list-item"
|
|
172
|
-
role="menuitem"
|
|
173
|
-
>
|
|
174
|
-
<label
|
|
175
|
-
class="pf-v6-c-menu__item"
|
|
176
|
-
for="generated-id"
|
|
177
|
-
tabindex="-1"
|
|
178
|
-
>
|
|
179
|
-
<span
|
|
180
|
-
class="pf-v6-c-menu__item-main"
|
|
181
|
-
>
|
|
182
|
-
<span
|
|
183
|
-
class="pf-v6-c-menu__item-check"
|
|
184
|
-
>
|
|
185
|
-
<span
|
|
186
|
-
class="pf-v6-c-check pf-m-standalone"
|
|
187
|
-
>
|
|
188
|
-
<input
|
|
189
|
-
aria-disabled="false"
|
|
190
|
-
aria-invalid="false"
|
|
191
|
-
class="pf-v6-c-check__input"
|
|
192
|
-
data-ouia-component-id="OUIA-Generated-Checkbox-3"
|
|
193
|
-
data-ouia-component-type="PF6/Checkbox"
|
|
194
|
-
data-ouia-safe="true"
|
|
195
|
-
id="generated-id"
|
|
196
|
-
type="checkbox"
|
|
197
|
-
/>
|
|
198
|
-
</span>
|
|
199
|
-
</span>
|
|
200
|
-
<span
|
|
201
|
-
class="pf-v6-c-menu__item-text"
|
|
202
|
-
>
|
|
203
|
-
Option 3
|
|
204
|
-
</span>
|
|
205
|
-
</span>
|
|
206
|
-
</label>
|
|
207
|
-
</li>
|
|
208
|
-
</ul>
|
|
209
|
-
</div>
|
|
210
|
-
</div>
|
|
211
|
-
</DocumentFragment>
|
|
212
|
-
`;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Checkbox } from '@patternfly/react-core';
|
|
3
|
-
import { SelectSimple, SelectSimpleOption } from '@patternfly/react-templates';
|
|
4
|
-
|
|
5
|
-
export const SelectSimpleDemo: React.FunctionComponent = () => {
|
|
6
|
-
const [isDisabled, setIsDisabled] = React.useState<boolean>(false);
|
|
7
|
-
|
|
8
|
-
const initialOptions: SelectSimpleOption[] = [
|
|
9
|
-
{ content: 'Option 1', value: 'option1' },
|
|
10
|
-
{ content: 'Option 2', value: 'option2' },
|
|
11
|
-
{ content: 'Option 3', value: 'option3' }
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<React.Fragment>
|
|
16
|
-
<Checkbox
|
|
17
|
-
id="toggle-disabled"
|
|
18
|
-
label="isDisabled"
|
|
19
|
-
isChecked={isDisabled}
|
|
20
|
-
onChange={(_event, checked) => setIsDisabled(checked)}
|
|
21
|
-
style={{ marginBottom: 20 }}
|
|
22
|
-
/>
|
|
23
|
-
<SelectSimple initialOptions={initialOptions} isDisabled={isDisabled} />
|
|
24
|
-
</React.Fragment>
|
|
25
|
-
);
|
|
26
|
-
};
|