@smart-react-components/ui 2.0.0-alpha-75 → 2.0.0-alpha-76
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/Dropdown/DropdownItem.js +6 -1
- package/package.json +1 -1
package/Dropdown/DropdownItem.js
CHANGED
|
@@ -7,14 +7,19 @@ const react_1 = __importDefault(require("react"));
|
|
|
7
7
|
const WaveEffect_1 = __importDefault(require("../WaveEffect"));
|
|
8
8
|
const DropdownItemElement_1 = __importDefault(require("../components/Dropdown/DropdownItemElement"));
|
|
9
9
|
const DropdownItem = ({ children, hasHover, hasWaveEffect, isDisabled, isOutline, isSoft, onClick, palette, setStatus, waveEffectPalette }) => {
|
|
10
|
+
const isClicked = react_1.default.useRef(false);
|
|
10
11
|
const handleOnClick = (e) => {
|
|
11
|
-
if (isDisabled) {
|
|
12
|
+
if (isClicked.current || isDisabled) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
15
|
+
isClicked.current = true;
|
|
14
16
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
15
17
|
if (!e.defaultPrevented) {
|
|
16
18
|
setStatus(false);
|
|
17
19
|
}
|
|
20
|
+
else {
|
|
21
|
+
isClicked.current = false;
|
|
22
|
+
}
|
|
18
23
|
};
|
|
19
24
|
const content = (react_1.default.createElement(DropdownItemElement_1.default, { hasHover: hasHover, isActive: false, isDisabled: isDisabled, isOutline: isOutline, isSoft: isSoft, palette: palette, onClick: handleOnClick }, children));
|
|
20
25
|
return hasWaveEffect ? react_1.default.createElement(WaveEffect_1.default, { palette: waveEffectPalette }, content) : content;
|