@smart-react-components/ui 2.0.0-alpha-133 → 2.0.0-alpha-135
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ContentElement, PaletteProp, SetState } from '@smart-react-components/core/types';
|
|
1
|
+
import { ContentElement, JSXElementProps, PaletteProp, SetState } from '@smart-react-components/core/types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface Props {
|
|
4
4
|
children: ContentElement;
|
|
5
|
+
elementProps?: JSXElementProps;
|
|
5
6
|
isDisabled?: boolean;
|
|
6
7
|
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
7
8
|
}
|
package/Dropdown/DropdownItem.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
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
|
-
const DropdownItem = ({ children, hasHover, hasWaveEffect, isDisabled, isOutline, isSoft, onClick, palette, setStatus, waveEffectPalette }) => {
|
|
9
|
+
const DropdownItem = ({ children, elementProps = {}, hasHover, hasWaveEffect, isDisabled, isOutline, isSoft, onClick, palette, setStatus, waveEffectPalette }) => {
|
|
10
10
|
const isClicked = react_1.default.useRef(false);
|
|
11
11
|
const handleOnClick = (e) => {
|
|
12
12
|
if (isClicked.current || isDisabled) {
|
|
@@ -21,7 +21,7 @@ const DropdownItem = ({ children, hasHover, hasWaveEffect, isDisabled, isOutline
|
|
|
21
21
|
isClicked.current = false;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
const content = (react_1.default.createElement(DropdownItemElement_1.default, { cursor: "$cursor.dropdown", hasHover: hasHover, isActive: false, isDisabled: isDisabled, isOutline: isOutline, isSoft: isSoft, palette: palette, onClick: handleOnClick }, children));
|
|
24
|
+
const content = (react_1.default.createElement(DropdownItemElement_1.default, Object.assign({ cursor: "$cursor.dropdown", hasHover: hasHover, isActive: false, isDisabled: isDisabled, isOutline: isOutline, isSoft: isSoft, palette: palette, onClick: handleOnClick }, elementProps), children));
|
|
25
25
|
return hasWaveEffect ? react_1.default.createElement(WaveEffect_1.default, { palette: waveEffectPalette }, content) : content;
|
|
26
26
|
};
|
|
27
27
|
exports.default = DropdownItem;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PaletteProp, Partial, ResponsiveProp, SizeProp } from '@smart-react-components/core/types';
|
|
1
|
+
import { JSXElementProps, PaletteProp, Partial, ResponsiveProp, SizeProp } from '@smart-react-components/core/types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface Props extends Partial<ResponsiveProp<'size', SizeProp>> {
|
|
4
4
|
children: JSX.Element | JSX.Element[];
|
|
5
|
+
elementProps?: JSXElementProps;
|
|
5
6
|
hasHover?: boolean;
|
|
6
7
|
hasWaveEffect?: boolean;
|
|
7
8
|
isOutline?: boolean;
|
package/Dropdown/DropdownList.js
CHANGED
|
@@ -10,9 +10,10 @@ const wave_effect_1 = require("../util/wave-effect");
|
|
|
10
10
|
const DropdownList = react_1.default.forwardRef((props, forwardRef) => {
|
|
11
11
|
const theme = (0, styled_components_1.useTheme)();
|
|
12
12
|
const waveEffectPalette = react_1.default.useMemo(() => (0, wave_effect_1.getWaveEffectPalette)(props, theme.$.vars.isDarkMode), [props.waveEffectPalette, props.palette, props.isOutline, props.isSoft, theme.$.vars.isDarkMode]);
|
|
13
|
-
return (react_1.default.createElement(DropdownListElement_1.default, { dropdownListSize: props.size, dropdownListSizeSm: props.sizeSm, dropdownListSizeMd: props.sizeMd, dropdownListSizeLg: props.sizeLg, dropdownListSizeXl: props.sizeXl, isOutline: props.isOutline, isSoft: props.isSoft, palette: props.palette, ref: forwardRef }, (Array.isArray(props.children) ? props.children : [props.children]).map((item, idx) => { var _a; return item && react_1.default.cloneElement(item, { key: (_a = item.key) !== null && _a !== void 0 ? _a : idx, hasHover: props.hasHover, hasWaveEffect: props.hasWaveEffect, isOutline: props.isOutline, isSoft: props.isSoft, palette: props.palette, setStatus: props.setStatus, waveEffectPalette }); })));
|
|
13
|
+
return (react_1.default.createElement(DropdownListElement_1.default, Object.assign({ dropdownListSize: props.size, dropdownListSizeSm: props.sizeSm, dropdownListSizeMd: props.sizeMd, dropdownListSizeLg: props.sizeLg, dropdownListSizeXl: props.sizeXl, isOutline: props.isOutline, isSoft: props.isSoft, palette: props.palette, ref: forwardRef }, props.elementProps), (Array.isArray(props.children) ? props.children : [props.children]).map((item, idx) => { var _a; return item && react_1.default.cloneElement(item, { key: (_a = item.key) !== null && _a !== void 0 ? _a : idx, hasHover: props.hasHover, hasWaveEffect: props.hasWaveEffect, isOutline: props.isOutline, isSoft: props.isSoft, palette: props.palette, setStatus: props.setStatus, waveEffectPalette }); })));
|
|
14
14
|
});
|
|
15
15
|
DropdownList.defaultProps = {
|
|
16
|
+
elementProps: {},
|
|
16
17
|
hasHover: true,
|
|
17
18
|
hasWaveEffect: true,
|
|
18
19
|
isOutline: true,
|