etendo-ui-library 1.2.55 → 1.2.56
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/dist-native/components/button/Button.d.ts +1 -1
- package/dist-native/components/button/Button.js +1 -1
- package/dist-native/components/button/Button.types.d.ts +0 -1
- package/dist-web/components/button/Button.d.ts +1 -1
- package/dist-web/components/button/Button.js +3 -5
- package/dist-web/components/button/Button.types.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from './Button.types';
|
|
3
|
-
declare const Button: ({ text, onPress, fontSize, typeStyle, disabled, width, height, iconLeft, iconRight, paddingHorizontal, paddingVertical, loading,
|
|
3
|
+
declare const Button: ({ text, onPress, fontSize, typeStyle, disabled, width, height, iconLeft, iconRight, paddingHorizontal, paddingVertical, loading, }: ButtonProps) => React.JSX.Element;
|
|
4
4
|
export default Button;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _colors=require("../../styles/colors");var _Button=require("./Button.styles");var _this=this,_jsxFileName="/home/jenkins/workspace/etendo_ui_library_develop/src/components/button/Button.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var Button=function Button(_ref){var text=_ref.text,onPress=_ref.onPress,_ref$fontSize=_ref.fontSize,fontSize=_ref$fontSize===void 0?16:_ref$fontSize,typeStyle=_ref.typeStyle,disabled=_ref.disabled,_ref$width=_ref.width,width=_ref$width===void 0?'auto':_ref$width,height=_ref.height,iconLeft=_ref.iconLeft,iconRight=_ref.iconRight,_ref$paddingHorizonta=_ref.paddingHorizontal,paddingHorizontal=_ref$paddingHorizonta===void 0?12:_ref$paddingHorizonta,_ref$paddingVertical=_ref.paddingVertical,paddingVertical=_ref$paddingVertical===void 0?12:_ref$paddingVertical,_ref$loading=_ref.loading,loading=_ref$loading===void 0?false:_ref$loading
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _colors=require("../../styles/colors");var _Button=require("./Button.styles");var _this=this,_jsxFileName="/home/jenkins/workspace/etendo_ui_library_develop/src/components/button/Button.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var Button=function Button(_ref){var text=_ref.text,onPress=_ref.onPress,_ref$fontSize=_ref.fontSize,fontSize=_ref$fontSize===void 0?16:_ref$fontSize,typeStyle=_ref.typeStyle,disabled=_ref.disabled,_ref$width=_ref.width,width=_ref$width===void 0?'auto':_ref$width,height=_ref.height,iconLeft=_ref.iconLeft,iconRight=_ref.iconRight,_ref$paddingHorizonta=_ref.paddingHorizontal,paddingHorizontal=_ref$paddingHorizonta===void 0?12:_ref$paddingHorizonta,_ref$paddingVertical=_ref.paddingVertical,paddingVertical=_ref$paddingVertical===void 0?12:_ref$paddingVertical,_ref$loading=_ref.loading,loading=_ref$loading===void 0?false:_ref$loading;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),isHovered=_useState2[0],setIsHovered=_useState2[1];var getHoveredBackgroundColor=function getHoveredBackgroundColor(backgroundColor){switch(backgroundColor){case'primary':return _colors.TERTIARY_800;case'secondary':return _colors.SECONDARY_300;case'terciary':return _colors.TERTIARY_50;case'whiteBorder':return _colors.PRIMARY_100;}};var getHoveredTextColorAndViewColor=function getHoveredTextColorAndViewColor(typeStyle){switch(typeStyle){case'white':return _colors.TERTIARY_800;case'whiteBorder':return _colors.NEUTRAL_50;case'primary':return _colors.NEUTRAL_50;default:return _colors.PRIMARY_100;}};var stateStyleContainer=function stateStyleContainer(pressed){if(disabled){return _Button.ButtonStyleVariant[typeStyle].containerDisabled;}if(pressed&&!isHovered&&!loading&&typeStyle==='whiteBorder'){return Object.assign({},_Button.ButtonStyleVariant[typeStyle].container,{opacity:0.7,backgroundColor:'transparent'});}if(pressed&&!loading){var hoveredBackgroundColor=getHoveredBackgroundColor(typeStyle);return Object.assign({},_Button.ButtonStyleVariant[typeStyle].container,{opacity:0.7,backgroundColor:hoveredBackgroundColor});}if(isHovered&&!loading){var _hoveredBackgroundColor=getHoveredBackgroundColor(typeStyle);return Object.assign({},_Button.ButtonStyleVariant[typeStyle].container,{backgroundColor:_hoveredBackgroundColor});}return _Button.ButtonStyleVariant[typeStyle].container;};var handleHoverIn=function handleHoverIn(){setIsHovered(true);};var handleHoverOut=function handleHoverOut(){setIsHovered(false);};var stateStyleText=function stateStyleText(){if(loading&&!iconLeft&&!iconRight){return{color:'transparent'};}if(disabled){return _Button.ButtonStyleVariant[typeStyle].textDisabled;}if(isHovered&&!loading){var hoveredTextColor=getHoveredTextColorAndViewColor(typeStyle);if(hoveredTextColor){return Object.assign({},_Button.ButtonStyleVariant[typeStyle].text,{color:hoveredTextColor});}}return _Button.ButtonStyleVariant[typeStyle].text;};var stateStyleIcon=function stateStyleIcon(){if(disabled){return _Button.ButtonStyleVariant[typeStyle].imageDisabled;}if(isHovered&&!loading){return isHovered?getHoveredTextColorAndViewColor(typeStyle):_Button.ButtonStyleVariant[typeStyle].imageColor;}return _Button.ButtonStyleVariant[typeStyle].imageColor;};var stateSizeIndicator=function stateSizeIndicator(iconComponent){var _iconComponent$props,_iconComponent$props$,_iconComponent$props4,_iconComponent$props5;if(iconComponent!=null&&(_iconComponent$props=iconComponent.props)!=null&&(_iconComponent$props$=_iconComponent$props.style)!=null&&_iconComponent$props$.height){var _iconComponent$props2,_iconComponent$props3;return iconComponent==null?void 0:(_iconComponent$props2=iconComponent.props)==null?void 0:(_iconComponent$props3=_iconComponent$props2.style)==null?void 0:_iconComponent$props3.height;}if(iconComponent!=null&&(_iconComponent$props4=iconComponent.props)!=null&&(_iconComponent$props5=_iconComponent$props4.style)!=null&&_iconComponent$props5.width){var _iconComponent$props6,_iconComponent$props7;return iconComponent==null?void 0:(_iconComponent$props6=iconComponent.props)==null?void 0:(_iconComponent$props7=_iconComponent$props6.style)==null?void 0:_iconComponent$props7.width;}return 16;};var renderIcon=function renderIcon(icon){var _icon$props,_icon$props$style,_icon$props2,_icon$props2$style;var _ref2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref2$marginRight=_ref2.marginRight,marginRight=_ref2$marginRight===void 0?0:_ref2$marginRight,_ref2$marginLeft=_ref2.marginLeft,marginLeft=_ref2$marginLeft===void 0?0:_ref2$marginLeft;if(!icon)return null;var iconSize=stateSizeIndicator(icon);var iconColor=stateStyleIcon();if(loading){return _react.default.createElement(_reactNative.ActivityIndicator,{size:iconSize,color:iconColor,style:{marginRight:marginRight,marginLeft:marginLeft},__self:_this,__source:{fileName:_jsxFileName,lineNumber:147,columnNumber:9}});}return _react.default.cloneElement(icon,{style:{width:(icon==null?void 0:(_icon$props=icon.props)==null?void 0:(_icon$props$style=_icon$props.style)==null?void 0:_icon$props$style.width)||16,height:(icon==null?void 0:(_icon$props2=icon.props)==null?void 0:(_icon$props2$style=_icon$props2.style)==null?void 0:_icon$props2$style.height)||16,marginRight:marginRight,marginLeft:marginLeft},fill:iconColor});};var handleOnPress=function handleOnPress(){if(onPress){onPress();}};return _react.default.createElement(_reactNative.TouchableOpacity,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:172,columnNumber:5}},_react.default.createElement(_reactNative.Pressable,{onHoverIn:handleHoverIn,onHoverOut:handleHoverOut,style:function style(_ref3){var pressed=_ref3.pressed;return[stateStyleContainer(pressed),{height:height,width:width,paddingHorizontal:paddingHorizontal,paddingVertical:paddingVertical}];},onPress:handleOnPress,__self:_this,__source:{fileName:_jsxFileName,lineNumber:173,columnNumber:7}},renderIcon(iconLeft,{marginRight:iconLeft&&text?8:0}),loading&&!iconLeft&&!iconRight&&_react.default.createElement(_reactNative.ActivityIndicator,{size:fontSize,color:stateStyleIcon(),style:_Button.styles.indicatorCenterStyle,__self:_this,__source:{fileName:_jsxFileName,lineNumber:185,columnNumber:11}}),_react.default.createElement(_reactNative.Text,{style:[stateStyleText(),{fontSize:fontSize}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:191,columnNumber:9}},text),renderIcon(iconRight,{marginLeft:iconRight&&text?8:0})));};var _default=exports.default=Button;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from './Button.types';
|
|
3
|
-
declare const Button: ({ text, onPress, fontSize, typeStyle, disabled, width, height, iconLeft, iconRight, paddingHorizontal, paddingVertical, loading,
|
|
3
|
+
declare const Button: ({ text, onPress, fontSize, typeStyle, disabled, width, height, iconLeft, iconRight, paddingHorizontal, paddingVertical, loading, }: ButtonProps) => React.JSX.Element;
|
|
4
4
|
export default Button;
|
|
@@ -31,9 +31,7 @@ var Button = function Button(_ref) {
|
|
|
31
31
|
_ref$paddingVertical = _ref.paddingVertical,
|
|
32
32
|
paddingVertical = _ref$paddingVertical === void 0 ? 12 : _ref$paddingVertical,
|
|
33
33
|
_ref$loading = _ref.loading,
|
|
34
|
-
loading = _ref$loading === void 0 ? false : _ref$loading
|
|
35
|
-
_ref$sizeLoadingIndic = _ref.sizeLoadingIndicator,
|
|
36
|
-
sizeLoadingIndicator = _ref$sizeLoadingIndic === void 0 ? 16 : _ref$sizeLoadingIndic;
|
|
34
|
+
loading = _ref$loading === void 0 ? false : _ref$loading;
|
|
37
35
|
var _useState = useState(false),
|
|
38
36
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
37
|
isHovered = _useState2[0],
|
|
@@ -131,7 +129,7 @@ var Button = function Button(_ref) {
|
|
|
131
129
|
var _iconComponent$props4;
|
|
132
130
|
return iconComponent === null || iconComponent === void 0 || (_iconComponent$props4 = iconComponent.props) === null || _iconComponent$props4 === void 0 || (_iconComponent$props4 = _iconComponent$props4.style) === null || _iconComponent$props4 === void 0 ? void 0 : _iconComponent$props4.width;
|
|
133
131
|
}
|
|
134
|
-
return
|
|
132
|
+
return 16;
|
|
135
133
|
};
|
|
136
134
|
var renderIcon = function renderIcon(icon) {
|
|
137
135
|
var _icon$props, _icon$props2;
|
|
@@ -184,7 +182,7 @@ var Button = function Button(_ref) {
|
|
|
184
182
|
}, renderIcon(iconLeft, {
|
|
185
183
|
marginRight: iconLeft && text ? 8 : 0
|
|
186
184
|
}), loading && !iconLeft && !iconRight && /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
187
|
-
size:
|
|
185
|
+
size: fontSize,
|
|
188
186
|
color: stateStyleIcon(),
|
|
189
187
|
style: styles.indicatorCenterStyle
|
|
190
188
|
}), /*#__PURE__*/React.createElement(Text, {
|