@patternfly/react-core 4.195.0 → 4.196.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/esm/components/Label/Label.js +10 -9
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/Menu/MenuItem.d.ts +1 -1
- package/dist/esm/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +5 -2
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +1 -0
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectOption.js +1 -1
- package/dist/esm/components/Select/SelectOption.js.map +1 -1
- package/dist/esm/components/Select/SelectToggle.js +1 -1
- package/dist/esm/components/Select/SelectToggle.js.map +1 -1
- package/dist/js/components/Label/Label.js +10 -9
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/Menu/MenuItem.d.ts +1 -1
- package/dist/js/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuItem.js +5 -2
- package/dist/js/components/Menu/MenuItem.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +1 -0
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectOption.js +1 -1
- package/dist/js/components/Select/SelectOption.js.map +1 -1
- package/dist/js/components/Select/SelectToggle.js +1 -1
- package/dist/js/components/Select/SelectToggle.js.map +1 -1
- package/dist/umd/react-core.css +300 -24
- package/dist/umd/react-core.js +27 -16
- package/dist/umd/react-core.min.css +369 -93
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/Label/Label.tsx +17 -17
- package/src/components/Label/__tests__/Label.test.tsx +2 -2
- package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +5 -9
- package/src/components/Menu/MenuItem.tsx +11 -3
- package/src/components/Menu/examples/Menu.md +5 -0
- package/src/components/Menu/examples/MenuDrilldownSubmenuFunctions.tsx +179 -0
- package/src/components/Select/Select.tsx +1 -0
- package/src/components/Select/SelectOption.tsx +1 -1
- package/src/components/Select/SelectToggle.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.196.0",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.47.0",
|
|
38
|
+
"@patternfly/react-styles": "^4.46.0",
|
|
39
|
+
"@patternfly/react-tokens": "^4.48.0",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.
|
|
46
|
+
"@patternfly/patternfly": "4.178.0",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "97efdeba1800844c702aba338e80b3727e9ad203"
|
|
64
64
|
}
|
|
@@ -178,7 +178,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
178
178
|
};
|
|
179
179
|
|
|
180
180
|
const LabelComponent = (isOverflowLabel ? 'button' : 'span') as any;
|
|
181
|
-
|
|
181
|
+
|
|
182
182
|
const button = closeBtn ? (
|
|
183
183
|
closeBtn
|
|
184
184
|
) : (
|
|
@@ -199,7 +199,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
199
199
|
useIsomorphicLayoutEffect(() => {
|
|
200
200
|
setIsTooltipVisible(textRef.current && textRef.current.offsetWidth < textRef.current.scrollWidth);
|
|
201
201
|
}, []);
|
|
202
|
-
|
|
202
|
+
const content = (
|
|
203
203
|
<React.Fragment>
|
|
204
204
|
{icon && <span className={css(styles.labelIcon)}>{icon}</span>}
|
|
205
205
|
{isTruncated && (
|
|
@@ -221,28 +221,30 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
221
221
|
setCurrValue(editableInputRef.current.value);
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
let labelComponentChild = <span className={css(styles.labelContent)}>{content}</span>;
|
|
225
|
+
|
|
226
|
+
if (href) {
|
|
227
|
+
labelComponentChild = (
|
|
228
|
+
<a className={css(styles.labelContent)} href={href}>
|
|
229
|
+
{content}
|
|
230
|
+
</a>
|
|
231
|
+
);
|
|
232
|
+
} else if (isEditable) {
|
|
233
|
+
labelComponentChild = (
|
|
226
234
|
<button
|
|
227
235
|
ref={editableButtonRef}
|
|
228
|
-
className={css(styles.
|
|
229
|
-
onClick={e => {
|
|
236
|
+
className={css(styles.labelContent)}
|
|
237
|
+
onClick={(e: React.MouseEvent) => {
|
|
230
238
|
setIsEditableActive(true);
|
|
231
239
|
e.stopPropagation();
|
|
232
240
|
}}
|
|
233
241
|
{...editableProps}
|
|
234
242
|
>
|
|
235
|
-
{
|
|
243
|
+
{content}
|
|
236
244
|
</button>
|
|
237
245
|
);
|
|
238
246
|
}
|
|
239
247
|
|
|
240
|
-
let labelComponentChild = (
|
|
241
|
-
<Component className={css(styles.labelContent)} {...(href && { href })}>
|
|
242
|
-
{content}
|
|
243
|
-
</Component>
|
|
244
|
-
);
|
|
245
|
-
|
|
246
248
|
if (render) {
|
|
247
249
|
labelComponentChild = (
|
|
248
250
|
<React.Fragment>
|
|
@@ -257,9 +259,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
257
259
|
} else if (isTooltipVisible) {
|
|
258
260
|
labelComponentChild = (
|
|
259
261
|
<Tooltip content={children} position={tooltipPosition}>
|
|
260
|
-
|
|
261
|
-
{content}
|
|
262
|
-
</Component>
|
|
262
|
+
{labelComponentChild}
|
|
263
263
|
</Tooltip>
|
|
264
264
|
);
|
|
265
265
|
}
|
|
@@ -282,7 +282,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
282
282
|
{!isEditableActive && onClose && button}
|
|
283
283
|
{isEditableActive && (
|
|
284
284
|
<input
|
|
285
|
-
className={css(styles.
|
|
285
|
+
className={css(styles.labelContent)}
|
|
286
286
|
type="text"
|
|
287
287
|
id="editable-input"
|
|
288
288
|
ref={editableInputRef}
|
|
@@ -72,12 +72,12 @@ test('editable label', () => {
|
|
|
72
72
|
onEditCancel={jest.fn()}
|
|
73
73
|
onEditComplete={jest.fn()}
|
|
74
74
|
isEditable>Something</Label>);
|
|
75
|
-
const button = view.find('button.pf-c-
|
|
75
|
+
const button = view.find('button.pf-c-label__content');
|
|
76
76
|
expect(button.length).toBe(1);
|
|
77
77
|
expect(view).toMatchSnapshot();
|
|
78
78
|
|
|
79
79
|
button.simulate('click');
|
|
80
|
-
const clickedButton = view.find('button.pf-c-
|
|
80
|
+
const clickedButton = view.find('button.pf-c-label__content');
|
|
81
81
|
expect(clickedButton.length).toBe(0);
|
|
82
82
|
expect(view).toMatchSnapshot();
|
|
83
83
|
});
|
|
@@ -10,16 +10,12 @@ exports[`editable label 1`] = `
|
|
|
10
10
|
<span
|
|
11
11
|
className="pf-c-label pf-m-editable"
|
|
12
12
|
>
|
|
13
|
-
<
|
|
13
|
+
<button
|
|
14
14
|
className="pf-c-label__content"
|
|
15
|
+
onClick={[Function]}
|
|
15
16
|
>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
onClick={[Function]}
|
|
19
|
-
>
|
|
20
|
-
Something
|
|
21
|
-
</button>
|
|
22
|
-
</span>
|
|
17
|
+
Something
|
|
18
|
+
</button>
|
|
23
19
|
<Button
|
|
24
20
|
aria-label="Close Something"
|
|
25
21
|
onClick={[MockFunction]}
|
|
@@ -87,7 +83,7 @@ exports[`editable label 2`] = `
|
|
|
87
83
|
className="pf-c-label pf-m-editable pf-m-editable-active"
|
|
88
84
|
>
|
|
89
85
|
<input
|
|
90
|
-
className="pf-c-
|
|
86
|
+
className="pf-c-label__content"
|
|
91
87
|
id="editable-input"
|
|
92
88
|
onChange={[Function]}
|
|
93
89
|
type="text"
|
|
@@ -51,7 +51,7 @@ export interface MenuItemProps extends Omit<React.HTMLProps<HTMLLIElement>, 'onC
|
|
|
51
51
|
/** @beta Callback function when mouse leaves trigger */
|
|
52
52
|
onShowFlyout?: (event?: any) => void;
|
|
53
53
|
/** @beta Drilldown menu of the item. Should be a Menu or DrilldownMenu type. */
|
|
54
|
-
drilldownMenu?: React.ReactNode;
|
|
54
|
+
drilldownMenu?: React.ReactNode | (() => React.ReactNode);
|
|
55
55
|
/** @beta Sub menu direction */
|
|
56
56
|
direction?: 'down' | 'up';
|
|
57
57
|
/** @beta True if item is on current selection path */
|
|
@@ -208,7 +208,15 @@ export const MenuItem: React.FunctionComponent<MenuItemProps> = ({
|
|
|
208
208
|
let _drill: () => void;
|
|
209
209
|
if (direction) {
|
|
210
210
|
if (direction === 'down') {
|
|
211
|
-
_drill = () =>
|
|
211
|
+
_drill = () =>
|
|
212
|
+
onDrillIn &&
|
|
213
|
+
onDrillIn(
|
|
214
|
+
menuId,
|
|
215
|
+
typeof drilldownMenu === 'function'
|
|
216
|
+
? drilldownMenu().props.id
|
|
217
|
+
: (drilldownMenu as React.ReactElement).props.id,
|
|
218
|
+
itemId
|
|
219
|
+
);
|
|
212
220
|
} else {
|
|
213
221
|
_drill = () => onDrillOut && onDrillOut(parentMenu, itemId);
|
|
214
222
|
}
|
|
@@ -327,7 +335,7 @@ export const MenuItem: React.FunctionComponent<MenuItemProps> = ({
|
|
|
327
335
|
<FlyoutContext.Provider value={{ direction: flyoutXDirection }}>{flyoutMenu}</FlyoutContext.Provider>
|
|
328
336
|
</MenuContext.Provider>
|
|
329
337
|
)}
|
|
330
|
-
{drilldownMenu}
|
|
338
|
+
{typeof drilldownMenu === 'function' ? drilldownMenu() : drilldownMenu}
|
|
331
339
|
<MenuItemContext.Provider value={{ itemId, isDisabled }}>
|
|
332
340
|
{actions}
|
|
333
341
|
{isFavorited !== null && (
|
|
@@ -690,6 +690,11 @@ To render an initially drilled in menu, the `menuDrilledIn`, `drilldownPath`, an
|
|
|
690
690
|
```ts file="./MenuDrilldownInitialState.tsx" isBeta
|
|
691
691
|
```
|
|
692
692
|
|
|
693
|
+
### With drilldown - submenu functions
|
|
694
|
+
|
|
695
|
+
```ts file="./MenuDrilldownSubmenuFunctions.tsx" isBeta
|
|
696
|
+
```
|
|
697
|
+
|
|
693
698
|
### With drilldown breadcrumbs
|
|
694
699
|
|
|
695
700
|
```js isBeta
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Menu, MenuContent, MenuList, MenuItem, Divider, DrilldownMenu } from '@patternfly/react-core';
|
|
3
|
+
import StorageDomainIcon from '@patternfly/react-icons/dist/esm/icons/storage-domain-icon';
|
|
4
|
+
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
5
|
+
import LayerGroupIcon from '@patternfly/react-icons/dist/esm/icons/layer-group-icon';
|
|
6
|
+
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
|
|
7
|
+
|
|
8
|
+
export const MenuDrilldownSubmenuFunctions: React.FunctionComponent = () => {
|
|
9
|
+
const [menuDrilledIn, setMenuDrilledIn] = React.useState<string[]>([]);
|
|
10
|
+
const [drilldownPath, setDrilldownPath] = React.useState<string[]>([]);
|
|
11
|
+
const [menuHeights, setMenuHeights] = React.useState<any>({});
|
|
12
|
+
const [activeMenu, setActiveMenu] = React.useState<string>('rootMenu');
|
|
13
|
+
|
|
14
|
+
const drillIn = (fromMenuId: string, toMenuId: string, pathId: string) => {
|
|
15
|
+
setMenuDrilledIn([...menuDrilledIn, fromMenuId]);
|
|
16
|
+
setDrilldownPath([...drilldownPath, pathId]);
|
|
17
|
+
setActiveMenu(toMenuId);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const drillOut = (toMenuId: string) => {
|
|
21
|
+
const menuDrilledInSansLast = menuDrilledIn.slice(0, menuDrilledIn.length - 1);
|
|
22
|
+
const pathSansLast = drilldownPath.slice(0, drilldownPath.length - 1);
|
|
23
|
+
setMenuDrilledIn(menuDrilledInSansLast);
|
|
24
|
+
setDrilldownPath(pathSansLast);
|
|
25
|
+
setActiveMenu(toMenuId);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const setHeight = (menuId: string, height: number) => {
|
|
29
|
+
if (menuHeights[menuId] === undefined) {
|
|
30
|
+
setMenuHeights({ ...menuHeights, [menuId]: height });
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Menu
|
|
36
|
+
id="rootMenu"
|
|
37
|
+
containsDrilldown
|
|
38
|
+
drilldownItemPath={drilldownPath}
|
|
39
|
+
drilledInMenus={menuDrilledIn}
|
|
40
|
+
activeMenu={activeMenu}
|
|
41
|
+
onDrillIn={drillIn}
|
|
42
|
+
onDrillOut={drillOut}
|
|
43
|
+
onGetMenuHeight={setHeight}
|
|
44
|
+
>
|
|
45
|
+
<MenuContent menuHeight={`${menuHeights[activeMenu]}px`}>
|
|
46
|
+
<MenuList>
|
|
47
|
+
<MenuItem
|
|
48
|
+
itemId="group:start_rollout"
|
|
49
|
+
direction="down"
|
|
50
|
+
drilldownMenu={() => (
|
|
51
|
+
<DrilldownMenu id="drilldownMenuStart">
|
|
52
|
+
<MenuItem itemId="group:start_rollout_breadcrumb" direction="up">
|
|
53
|
+
Start rollout
|
|
54
|
+
</MenuItem>
|
|
55
|
+
<Divider component="li" />
|
|
56
|
+
<MenuItem
|
|
57
|
+
itemId="group:app_grouping"
|
|
58
|
+
description="Groups A-C"
|
|
59
|
+
direction="down"
|
|
60
|
+
drilldownMenu={() => (
|
|
61
|
+
<DrilldownMenu id="drilldownMenuStartGrouping">
|
|
62
|
+
<MenuItem itemId="group:app_grouping_breadcrumb" direction="up">
|
|
63
|
+
Application grouping
|
|
64
|
+
</MenuItem>
|
|
65
|
+
<Divider component="li" />
|
|
66
|
+
<MenuItem itemId="group_a">Group A</MenuItem>
|
|
67
|
+
<MenuItem itemId="group_b">Group B</MenuItem>
|
|
68
|
+
<MenuItem itemId="group_c">Group C</MenuItem>
|
|
69
|
+
</DrilldownMenu>
|
|
70
|
+
)}
|
|
71
|
+
>
|
|
72
|
+
Application grouping
|
|
73
|
+
</MenuItem>
|
|
74
|
+
<MenuItem itemId="count">Count</MenuItem>
|
|
75
|
+
<MenuItem
|
|
76
|
+
itemId="group:labels"
|
|
77
|
+
direction="down"
|
|
78
|
+
drilldownMenu={() => (
|
|
79
|
+
<DrilldownMenu id="drilldownMenuStartLabels">
|
|
80
|
+
<MenuItem itemId="group:labels_breadcrumb" direction="up">
|
|
81
|
+
Labels
|
|
82
|
+
</MenuItem>
|
|
83
|
+
<Divider component="li" />
|
|
84
|
+
<MenuItem itemId="label_1">Label 1</MenuItem>
|
|
85
|
+
<MenuItem itemId="label_2">Label 2</MenuItem>
|
|
86
|
+
<MenuItem itemId="label_3">Label 3</MenuItem>
|
|
87
|
+
</DrilldownMenu>
|
|
88
|
+
)}
|
|
89
|
+
>
|
|
90
|
+
Labels
|
|
91
|
+
</MenuItem>
|
|
92
|
+
<MenuItem itemId="annotations">Annotations</MenuItem>
|
|
93
|
+
</DrilldownMenu>
|
|
94
|
+
)}
|
|
95
|
+
>
|
|
96
|
+
Start rollout
|
|
97
|
+
</MenuItem>
|
|
98
|
+
<MenuItem
|
|
99
|
+
itemId="group:pause_rollout"
|
|
100
|
+
direction="down"
|
|
101
|
+
drilldownMenu={() => (
|
|
102
|
+
<DrilldownMenu id="drilldownMenuPause">
|
|
103
|
+
<MenuItem itemId="group:pause_rollout_breadcrumb" direction="up">
|
|
104
|
+
Pause rollouts
|
|
105
|
+
</MenuItem>
|
|
106
|
+
<Divider component="li" />
|
|
107
|
+
<MenuItem
|
|
108
|
+
itemId="group:app_grouping"
|
|
109
|
+
description="Groups A-C"
|
|
110
|
+
direction="down"
|
|
111
|
+
drilldownMenu={() => (
|
|
112
|
+
<DrilldownMenu id="drilldownMenuGrouping">
|
|
113
|
+
<MenuItem itemId="group:app_grouping_breadcrumb" direction="up">
|
|
114
|
+
Application grouping
|
|
115
|
+
</MenuItem>
|
|
116
|
+
<Divider component="li" />
|
|
117
|
+
<MenuItem itemId="group_a">Group A</MenuItem>
|
|
118
|
+
<MenuItem itemId="group_b">Group B</MenuItem>
|
|
119
|
+
<MenuItem itemId="group_c">Group C</MenuItem>
|
|
120
|
+
</DrilldownMenu>
|
|
121
|
+
)}
|
|
122
|
+
>
|
|
123
|
+
Application grouping
|
|
124
|
+
</MenuItem>
|
|
125
|
+
<MenuItem itemId="count">Count</MenuItem>
|
|
126
|
+
<MenuItem
|
|
127
|
+
itemId="group:labels"
|
|
128
|
+
direction="down"
|
|
129
|
+
drilldownMenu={() => (
|
|
130
|
+
<DrilldownMenu id="drilldownMenuLabels">
|
|
131
|
+
<MenuItem itemId="group:labels_breadcrumb" direction="up">
|
|
132
|
+
Labels
|
|
133
|
+
</MenuItem>
|
|
134
|
+
<Divider component="li" />
|
|
135
|
+
<MenuItem itemId="label_1">Label 1</MenuItem>
|
|
136
|
+
<MenuItem itemId="label_2">Label 2</MenuItem>
|
|
137
|
+
<MenuItem itemId="label_3">Label 3</MenuItem>
|
|
138
|
+
</DrilldownMenu>
|
|
139
|
+
)}
|
|
140
|
+
>
|
|
141
|
+
Labels
|
|
142
|
+
</MenuItem>
|
|
143
|
+
<MenuItem itemId="annotations">Annotations</MenuItem>
|
|
144
|
+
</DrilldownMenu>
|
|
145
|
+
)}
|
|
146
|
+
>
|
|
147
|
+
Pause rollouts
|
|
148
|
+
</MenuItem>
|
|
149
|
+
<MenuItem
|
|
150
|
+
itemId="group:storage"
|
|
151
|
+
icon={<StorageDomainIcon aria-hidden />}
|
|
152
|
+
direction="down"
|
|
153
|
+
drilldownMenu={() => (
|
|
154
|
+
<DrilldownMenu id="drilldownMenuStorage">
|
|
155
|
+
<MenuItem itemId="group:storage_breadcrumb" icon={<StorageDomainIcon aria-hidden />} direction="up">
|
|
156
|
+
Add storage
|
|
157
|
+
</MenuItem>
|
|
158
|
+
<Divider component="li" />
|
|
159
|
+
<MenuItem icon={<CodeBranchIcon aria-hidden />} itemId="git">
|
|
160
|
+
From git
|
|
161
|
+
</MenuItem>
|
|
162
|
+
<MenuItem icon={<LayerGroupIcon aria-hidden />} itemId="container">
|
|
163
|
+
Container image
|
|
164
|
+
</MenuItem>
|
|
165
|
+
<MenuItem icon={<CubeIcon aria-hidden />} itemId="docker">
|
|
166
|
+
Docker file
|
|
167
|
+
</MenuItem>
|
|
168
|
+
</DrilldownMenu>
|
|
169
|
+
)}
|
|
170
|
+
>
|
|
171
|
+
Add storage
|
|
172
|
+
</MenuItem>
|
|
173
|
+
<MenuItem itemId="edit">Edit</MenuItem>
|
|
174
|
+
<MenuItem itemId="delete_deployment">Delete deployment config</MenuItem>
|
|
175
|
+
</MenuList>
|
|
176
|
+
</MenuContent>
|
|
177
|
+
</Menu>
|
|
178
|
+
);
|
|
179
|
+
};
|
|
@@ -208,7 +208,7 @@ export class SelectOption extends React.Component<SelectOptionProps> {
|
|
|
208
208
|
onFavorite(generatedId.replace('favorite-', ''), isFavorite);
|
|
209
209
|
}}
|
|
210
210
|
onKeyDown={event => {
|
|
211
|
-
this.onKeyDown(event, 1, () => onFavorite(generatedId.replace('favorite-', '')));
|
|
211
|
+
this.onKeyDown(event, 1, () => onFavorite(generatedId.replace('favorite-', ''), isFavorite));
|
|
212
212
|
}}
|
|
213
213
|
ref={this.favoriteRef}
|
|
214
214
|
>
|
|
@@ -87,7 +87,7 @@ export class SelectToggle extends React.Component<SelectToggleProps> {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
componentDidMount() {
|
|
90
|
-
document.addEventListener('click', this.onDocClick);
|
|
90
|
+
document.addEventListener('click', this.onDocClick, { capture: true });
|
|
91
91
|
document.addEventListener('touchstart', this.onDocClick);
|
|
92
92
|
document.addEventListener('keydown', this.handleGlobalKeys);
|
|
93
93
|
}
|