@smart-react-components/ui 2.1.3 → 2.1.5
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/Button/index.js
CHANGED
|
@@ -16,7 +16,6 @@ const ButtonElement_1 = __importDefault(require("../components/Button/ButtonElem
|
|
|
16
16
|
const ButtonContent_1 = __importDefault(require("../components/Button/ButtonContent"));
|
|
17
17
|
const useAddons_1 = __importDefault(require("../hooks/useAddons"));
|
|
18
18
|
const wave_effect_1 = require("../util/wave-effect");
|
|
19
|
-
const button_1 = require("../types/button");
|
|
20
19
|
const WaveEffect_1 = __importDefault(require("../WaveEffect"));
|
|
21
20
|
const Button = react_1.default.forwardRef((props, forwardRef) => {
|
|
22
21
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -63,7 +62,7 @@ const Button = react_1.default.forwardRef((props, forwardRef) => {
|
|
|
63
62
|
}, [props.loading, props.isLoading]);
|
|
64
63
|
const applyIntrinsicStyledCoreProps = () => (Object.assign(Object.assign({}, (0, element_props_1.default)(props, [intrinsic_styled_core_props_1.default])), (props.hasSpace && Object.assign(Object.assign(Object.assign(Object.assign({ margin: `$size.button.${props.size}.margin.y $size.button.${props.size}.margin.x` }, (props.sizeSm && { marginSm: `$size.button.${props.sizeSm}.margin.y $size.button.${props.sizeSm}.margin.x` })), (props.sizeMd && { marginMd: `$size.button.${props.sizeMd}.margin.y $size.button.${props.sizeMd}.margin.x` })), (props.sizeLg && { marginLg: `$size.button.${props.sizeLg}.margin.y $size.button.${props.sizeLg}.margin.x` })), (props.sizeXl && { marginXl: `$size.button.${props.sizeXl}.margin.y $size.button.${props.sizeXl}.margin.x` })))));
|
|
65
64
|
const hasButtonContainer = ((_a = leftAddon === null || leftAddon === void 0 ? void 0 : leftAddon.props) === null || _a === void 0 ? void 0 : _a.isSeparated) || ((_b = rightAddon === null || rightAddon === void 0 ? void 0 : rightAddon.props) === null || _b === void 0 ? void 0 : _b.isSeparated);
|
|
66
|
-
let Element = (react_1.default.createElement(ButtonElement_1.default, Object.assign({}, props.elementProps, ((!props.isDisabled && !props.isLoading) && (0, element_props_1.default)(props, [click_events_1.default])), (!hasButtonContainer && applyIntrinsicStyledCoreProps()), (props.as && { as: props.as }), { buttonSize: props.size, buttonSizeSm: props.sizeSm, buttonSizeMd: props.sizeMd, buttonSizeLg: props.sizeLg, buttonSizeXl: props.sizeXl, hasButtonContainer: hasButtonContainer, hasHover: props.hasHover, hasLeftAddon: !!leftAddon, hasRightAddon: !!rightAddon, hasSeparatedLeftAddon: !!((_c = leftAddon === null || leftAddon === void 0 ? void 0 : leftAddon.props) === null || _c === void 0 ? void 0 : _c.isSeparated), hasSeparatedRightAddon: !!((_d = rightAddon === null || rightAddon === void 0 ? void 0 : rightAddon.props) === null || _d === void 0 ? void 0 : _d.isSeparated), isActive: props.isActive, isBlock: props.isBlock, isDisabled: props.isDisabled, isFixedSize: props.isFixedSize, isLink: props.isLink, isLoading: props.isLoading, isSoft: props.isSoft, isOutline: props.isOutline, palette: props.palette, ref: forwardRef, shape: props.shape }),
|
|
65
|
+
let Element = (react_1.default.createElement(ButtonElement_1.default, Object.assign({}, props.elementProps, ((!props.isDisabled && !props.isLoading) && (0, element_props_1.default)(props, [click_events_1.default])), (!hasButtonContainer && applyIntrinsicStyledCoreProps()), (props.as && { as: props.as }), { buttonSize: props.size, buttonSizeSm: props.sizeSm, buttonSizeMd: props.sizeMd, buttonSizeLg: props.sizeLg, buttonSizeXl: props.sizeXl, hasButtonContainer: hasButtonContainer, hasHover: props.hasHover, hasLeftAddon: !!leftAddon, hasRightAddon: !!rightAddon, hasSeparatedLeftAddon: !!((_c = leftAddon === null || leftAddon === void 0 ? void 0 : leftAddon.props) === null || _c === void 0 ? void 0 : _c.isSeparated), hasSeparatedRightAddon: !!((_d = rightAddon === null || rightAddon === void 0 ? void 0 : rightAddon.props) === null || _d === void 0 ? void 0 : _d.isSeparated), isActive: props.isActive, isBlock: props.isBlock, isDisabled: props.isDisabled, isFixedSize: props.isFixedSize, isLink: props.isLink, isLoading: props.isLoading, isSoft: props.isSoft, isOutline: props.isOutline, palette: props.palette, ref: forwardRef, shape: props.shape, type: props.type }),
|
|
67
66
|
loadingEl && loadingEl,
|
|
68
67
|
(leftAddon && !leftAddon.props.isSeparated) && leftAddon,
|
|
69
68
|
react_1.default.createElement(ButtonContent_1.default, null, props.children),
|
|
@@ -86,6 +85,5 @@ Button.defaultProps = {
|
|
|
86
85
|
palette: 'primary',
|
|
87
86
|
shape: 'rectangle',
|
|
88
87
|
size: 'medium',
|
|
89
|
-
type: button_1.ButtonType.BUTTON,
|
|
90
88
|
};
|
|
91
89
|
exports.default = Button;
|
package/Dropdown/DropdownItem.js
CHANGED
|
@@ -14,7 +14,7 @@ const DropdownItem = ({ children, elementProps = {}, hasHover, hasWaveEffect, is
|
|
|
14
14
|
}
|
|
15
15
|
isClicked.current = true;
|
|
16
16
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
17
|
-
if (!e.defaultPrevented) {
|
|
17
|
+
if (!e.defaultPrevented || e.target instanceof HTMLAnchorElement) {
|
|
18
18
|
setStatus(false);
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
@@ -9,7 +9,8 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs({
|
|
|
9
9
|
getDropdownListSize: (v, t) => `
|
|
10
10
|
padding: ${t.$.size.dropdown[v].padding.y} 0;
|
|
11
11
|
|
|
12
|
-
> div
|
|
12
|
+
> div,
|
|
13
|
+
> a {
|
|
13
14
|
font-size: ${t.$.size.dropdown[v].fontSize};
|
|
14
15
|
margin: ${t.$.size.dropdown[v].margin.y} ${t.$.size.dropdown[v].margin.x};
|
|
15
16
|
padding: ${t.$.size.dropdown[v].padding.y} ${t.$.size.dropdown[v].padding.x};
|
|
@@ -27,7 +28,8 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs({
|
|
|
27
28
|
width: inherit;
|
|
28
29
|
-webkit-overflow-scrolling: touch;
|
|
29
30
|
|
|
30
|
-
> div
|
|
31
|
+
> div,
|
|
32
|
+
> a {
|
|
31
33
|
word-break: break-word;
|
|
32
34
|
word-wrap: break-word;
|
|
33
35
|
}
|