UNPKG

qvt-components

Version:

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

3 lines (2 loc) 19.8 kB
var e=require("react/jsx-runtime"),t=require("native-base"),r=require("react"),n=require("react-native");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/o(r);function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function c(e){var t={exports:{}};return e(t,t.exports),t.exports}var u="function"==typeof Symbol&&Symbol.for,l=u?Symbol.for("react.element"):60103,f=u?Symbol.for("react.portal"):60106,p=u?Symbol.for("react.fragment"):60107,d=u?Symbol.for("react.strict_mode"):60108,y=u?Symbol.for("react.profiler"):60114,b=u?Symbol.for("react.provider"):60109,m=u?Symbol.for("react.context"):60110,v=u?Symbol.for("react.async_mode"):60111,h=u?Symbol.for("react.concurrent_mode"):60111,g=u?Symbol.for("react.forward_ref"):60112,S=u?Symbol.for("react.suspense"):60113,x=u?Symbol.for("react.suspense_list"):60120,j=u?Symbol.for("react.memo"):60115,O=u?Symbol.for("react.lazy"):60116,w=u?Symbol.for("react.block"):60121,C=u?Symbol.for("react.fundamental"):60117,E=u?Symbol.for("react.responder"):60118,I=u?Symbol.for("react.scope"):60119;function P(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case l:switch(e=e.type){case v:case h:case p:case y:case d:case S:return e;default:switch(e=e&&e.$$typeof){case m:case g:case O:case j:case b:return e;default:return t}}case f:return t}}}function T(e){return P(e)===h}var $={AsyncMode:v,ConcurrentMode:h,ContextConsumer:m,ContextProvider:b,Element:l,ForwardRef:g,Fragment:p,Lazy:O,Memo:j,Portal:f,Profiler:y,StrictMode:d,Suspense:S,isAsyncMode:function(e){return T(e)||P(e)===v},isConcurrentMode:T,isContextConsumer:function(e){return P(e)===m},isContextProvider:function(e){return P(e)===b},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===l},isForwardRef:function(e){return P(e)===g},isFragment:function(e){return P(e)===p},isLazy:function(e){return P(e)===O},isMemo:function(e){return P(e)===j},isPortal:function(e){return P(e)===f},isProfiler:function(e){return P(e)===y},isStrictMode:function(e){return P(e)===d},isSuspense:function(e){return P(e)===S},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===p||e===h||e===y||e===d||e===S||e===x||"object"==typeof e&&null!==e&&(e.$$typeof===O||e.$$typeof===j||e.$$typeof===b||e.$$typeof===m||e.$$typeof===g||e.$$typeof===C||e.$$typeof===E||e.$$typeof===I||e.$$typeof===w)},typeOf:P},R=c(function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,r=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,y=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,h=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:var d=e.type;switch(d){case u:case l:case o:case a:case i:case p:return d;default:var m=d&&d.$$typeof;switch(m){case c:case f:case b:case y:case s:return m;default:return t}}case n:return t}}}var x=l,j=c,O=s,w=r,C=f,E=o,I=b,P=y,T=n,$=a,R=i,k=p,_=!1;function V(e){return S(e)===l}t.AsyncMode=u,t.ConcurrentMode=x,t.ContextConsumer=j,t.ContextProvider=O,t.Element=w,t.ForwardRef=C,t.Fragment=E,t.Lazy=I,t.Memo=P,t.Portal=T,t.Profiler=$,t.StrictMode=R,t.Suspense=k,t.isAsyncMode=function(e){return _||(_=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),V(e)||S(e)===u},t.isConcurrentMode=V,t.isContextConsumer=function(e){return S(e)===c},t.isContextProvider=function(e){return S(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return S(e)===f},t.isFragment=function(e){return S(e)===o},t.isLazy=function(e){return S(e)===b},t.isMemo=function(e){return S(e)===y},t.isPortal=function(e){return S(e)===n},t.isProfiler=function(e){return S(e)===a},t.isStrictMode=function(e){return S(e)===i},t.isSuspense=function(e){return S(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===l||e===a||e===i||e===p||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===y||e.$$typeof===s||e.$$typeof===c||e.$$typeof===f||e.$$typeof===v||e.$$typeof===h||e.$$typeof===g||e.$$typeof===m)},t.typeOf=S}()}),k=c(function(e){e.exports="production"===process.env.NODE_ENV?$:R}),_=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;function D(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var N=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,n,o=D(e),i=1;i<arguments.length;i++){for(var a in r=Object(arguments[i]))V.call(r,a)&&(o[a]=r[a]);if(_){n=_(r);for(var s=0;s<n.length;s++)M.call(r,n[s])&&(o[n[s]]=r[n[s]])}}return o},A="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",L=function(){};if("production"!==process.env.NODE_ENV){var F=A,W={},z=Function.call.bind(Object.prototype.hasOwnProperty);L=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function q(e,t,r,n,o){if("production"!==process.env.NODE_ENV)for(var i in e)if(z(e,i)){var a;try{if("function"!=typeof e[i]){var s=Error((n||"React class")+": "+r+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.");throw s.name="Invariant Violation",s}a=e[i](t,i,n,r,null,F)}catch(e){a=e}if(!a||a instanceof Error||L((n||"React class")+": type specification of "+r+" `"+i+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof a+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),a instanceof Error&&!(a.message in W)){W[a.message]=!0;var c=o?o():"";L("Failed "+r+" type: "+a.message+(null!=c?c:""))}}}q.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(W={})};var H=q,B=Function.call.bind(Object.prototype.hasOwnProperty),G=function(){};function U(){return null}function J(){}function Y(){}"production"!==process.env.NODE_ENV&&(G=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),Y.resetWarningCache=J;var X=c(function(e){e.exports="production"!==process.env.NODE_ENV?function(e,t){var r="function"==typeof Symbol&&Symbol.iterator,n="<<anonymous>>",o={array:c("array"),bool:c("boolean"),func:c("function"),number:c("number"),object:c("object"),string:c("string"),symbol:c("symbol"),any:s(U),arrayOf:function(e){return s(function(t,r,n,o,i){if("function"!=typeof e)return new a("Property `"+i+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var s=t[r];if(!Array.isArray(s))return new a("Invalid "+o+" `"+i+"` of type `"+l(s)+"` supplied to `"+n+"`, expected an array.");for(var c=0;c<s.length;c++){var u=e(s,c,n,o,i+"["+c+"]",A);if(u instanceof Error)return u}return null})},element:s(function(t,r,n,o,i){var s=t[r];return e(s)?null:new a("Invalid "+o+" `"+i+"` of type `"+l(s)+"` supplied to `"+n+"`, expected a single ReactElement.")}),elementType:s(function(e,t,r,n,o){var i=e[t];return k.isValidElementType(i)?null:new a("Invalid "+n+" `"+o+"` of type `"+l(i)+"` supplied to `"+r+"`, expected a single ReactElement type.")}),instanceOf:function(e){return s(function(t,r,o,i,s){return t[r]instanceof e?null:new a("Invalid "+i+" `"+s+"` of type `"+((c=t[r]).constructor&&c.constructor.name?c.constructor.name:n)+"` supplied to `"+o+"`, expected instance of `"+(e.name||n)+"`.");var c})},node:s(function(e,t,r,n,o){return u(e[t])?null:new a("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")}),objectOf:function(e){return s(function(t,r,n,o,i){if("function"!=typeof e)return new a("Property `"+i+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var s=t[r],c=l(s);if("object"!==c)return new a("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+n+"`, expected an object.");for(var u in s)if(B(s,u)){var f=e(s,u,n,o,i+"."+u,A);if(f instanceof Error)return f}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&G(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),U;function t(t,r,n,o,s){for(var c=t[r],u=0;u<e.length;u++)if(i(c,e[u]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===f(t)?String(t):t});return new a("Invalid "+o+" `"+s+"` of value `"+String(c)+"` supplied to `"+n+"`, expected one of "+l+".")}return s(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&G("Invalid argument supplied to oneOfType, expected an instance of array."),U;for(var t=0;t<e.length;t++){var r=e[t];if("function"!=typeof r)return G("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(r)+" at index "+t+"."),U}return s(function(t,r,n,o,i){for(var s=0;s<e.length;s++)if(null==(0,e[s])(t,r,n,o,i,A))return null;return new a("Invalid "+o+" `"+i+"` supplied to `"+n+"`.")})},shape:function(e){return s(function(t,r,n,o,i){var s=t[r],c=l(s);if("object"!==c)return new a("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");for(var u in e){var f=e[u];if(f){var p=f(s,u,n,o,i+"."+u,A);if(p)return p}}return null})},exact:function(e){return s(function(t,r,n,o,i){var s=t[r],c=l(s);if("object"!==c)return new a("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");var u=N({},t[r],e);for(var f in u){var p=e[f];if(!p)return new a("Invalid "+o+" `"+i+"` key `"+f+"` supplied to `"+n+"`.\nBad object: "+JSON.stringify(t[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var d=p(s,f,n,o,i+"."+f,A);if(d)return d}return null})}};function i(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function a(e){this.message=e,this.stack=""}function s(e){function t(t,r,o,i,s,c,u){if(i=i||n,c=c||o,u!==A){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}return null==r[o]?t?new a(null===r[o]?"The "+s+" `"+c+"` is marked as required in `"+i+"`, but its value is `null`.":"The "+s+" `"+c+"` is marked as required in `"+i+"`, but its value is `undefined`."):null:e(r,o,i,s,c)}process;var r=t.bind(null,!1);return r.isRequired=t.bind(null,!0),r}function c(e){return s(function(t,r,n,o,i,s){var c=t[r];return l(c)!==e?new a("Invalid "+o+" `"+i+"` of type `"+f(c)+"` supplied to `"+n+"`, expected `"+e+"`."):null})}function u(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(u);if(null===t||e(t))return!0;var n=function(e){var t=e&&(r&&e[r]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!n)return!1;var o,i=n.call(t);if(n!==t.entries){for(;!(o=i.next()).done;)if(!u(o.value))return!1}else for(;!(o=i.next()).done;){var a=o.value;if(a&&!u(a[1]))return!1}return!0;default:return!1}}function l(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function f(e){if(null==e)return""+e;var t=l(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function p(e){var t=f(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return a.prototype=Error.prototype,o.checkPropTypes=H,o.resetWarningCache=H.resetWarningCache,o.PropTypes=o,o}(k.isElement):function(){function e(e,t,r,n,o,i){if(i!==A){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Y,resetWarningCache:J};return r.PropTypes=r,r}()}),K={button:{flex:1,flexDirection:"row",justifyContent:"center",alignItems:"center"},animated:{borderWidth:0,position:"absolute"}},Q=/*#__PURE__*/function(t){var r,o;function i(e){var r;(r=t.call(this,e)||this).responderEnd=function(e,t){var n=r.props,o=n.options,i=r.state.selected;if(!n.disabled){var a=r.getSwipeDirection(t);"RIGHT"===a&&i<o.length-1?r.toggleItem(i+1):"LEFT"===a&&i>0&&r.toggleItem(i-1)}},r.shouldSetResponder=function(e,t){return 1===e.nativeEvent.touches.length&&!(Math.abs(t.dx)<5&&Math.abs(t.dy)<5)},r.animate=function(e,t){var o=r.props.animationDuration;r.animatedValue.setValue(t),n.Animated.timing(r.animatedValue,{toValue:e,duration:o,useNativeDriver:!0}).start()},r.toggleItem=function(e,t){void 0===t&&(t=!0);var o=r.state.selected,i=r.props,a=i.options,s=i.returnObject,c=i.onPress;a.length<=1||null===e||isNaN(e)||(r.animate(n.I18nManager.isRTL?-e/a.length:e/a.length,n.I18nManager.isRTL?-o/a.length:o/a.length),t&&c?c(s?a[e]:a[e].value):console.log("Call onPress with value: ",a[e].value),r.setState({selected:e}))};var o=e.initial,i=e.options;return r.state={selected:o},r.panResponder=n.PanResponder.create({onStartShouldSetPanResponder:r.shouldSetResponder,onMoveShouldSetPanResponder:r.shouldSetResponder,onPanResponderRelease:r.responderEnd,onPanResponderTerminate:r.responderEnd}),r.animatedValue=new n.Animated.Value(o?n.I18nManager.isRTL?-o/i.length:o/i.length:0),r}o=t,(r=i).prototype=Object.create(o.prototype),r.prototype.constructor=r,s(r,o);var c=i.prototype;return c.componentDidUpdate=function(e){var t=this.props,r=t.value;e.value!==r&&this.toggleItem(r,!t.disableValueChangeOnPress)},c.getSwipeDirection=function(e){var t=e.dx,r=e.dy;return Math.abs(e.vx)>.1&&Math.abs(r)<80?t>0?"RIGHT":"LEFT":null},c.getBgColor=function(){var e=this.state.selected,t=this.props;return-1===e?"transparent":t.options[e].activeColor||t.buttonColor},c.render=function(){var t=this,r=this.props,o=r.style,i=r.textStyle,s=r.selectedTextStyle,c=r.textContainerStyle,u=r.selectedTextContainerStyle,l=r.imageStyle,f=r.textColor,p=r.selectedColor,d=r.fontSize,y=r.backgroundColor,b=r.borderColor,m=r.borderRadius,v=r.borderWidth,h=r.hasPadding,g=r.valuePadding,S=r.height,x=r.bold,j=r.disabled,O=r.buttonMargin,w=r.options,C=this.state,E=C.selected,I=C.sliderWidth,P=w.map(function(r,o){var a=E===o;return e.jsxs(n.TouchableOpacity,{disabled:j,style:[K.button,a?u:c],onPress:function(){return t.toggleItem(o)},accessibilityLabel:r.accessibilityLabel,testID:r.testID,children:["function"==typeof r.customIcon?r.customIcon(a):r.customIcon,r.imageIcon&&e.jsx(n.Image,{source:r.imageIcon,style:[{height:30,width:30,tintColor:a?p:f},l]},void 0),e.jsx(n.Text,{style:[{fontSize:d,fontWeight:x?"bold":"normal",textAlign:"center",color:a?p:f,backgroundColor:"transparent"},a?s:i],numberOfLines:1,children:r.label},void 0)]},o)});return e.jsx(n.View,{style:[{flexDirection:"row"},o],accessibilityLabel:this.props.accessibilityLabel,testID:this.props.testID,children:e.jsx(n.View,a({},this.panResponder.panHandlers,{style:{flex:1},children:e.jsx(n.View,{style:{borderRadius:m,backgroundColor:y,height:S+2*O},onLayout:function(e){t.setState({sliderWidth:e.nativeEvent.layout.width-(h?2:0)})},children:e.jsxs(n.View,{style:{flex:1,flexDirection:"row",borderColor:b,borderRadius:m,borderWidth:h?v:0,alignItems:"center"},children:[!!I&&e.jsx(n.Animated.View,{style:[{height:h?S-2*g-2*v:S,backgroundColor:this.getBgColor(),width:I/w.length-((h?g:0)+2*O),transform:[{translateX:this.animatedValue.interpolate({inputRange:[0,1],outputRange:[h?g:0,I-(h?g:0)]})}],borderRadius:m,margin:O},K.animated]},void 0),P]},void 0)},void 0)}),void 0)},void 0)},i}(r.Component);Q.defaultProps={style:{marginHorizontal:20,marginVertical:5,flex:1},textStyle:{flex:1},selectedTextStyle:{fontWeight:"bold"},textContainerStyle:{flexGrow:1,paddingHorizontal:20,marginHorizontal:5},selectedTextContainerStyle:{paddingHorizontal:20},imageStyle:{},options:[],textColor:"#67758B",selectedColor:"#ffffff",fontSize:14,backgroundColor:"#ffffff",borderColor:"#f4f5f9",borderRadius:50,borderWidth:1,hasPadding:!0,valuePadding:1,height:40,bold:!1,buttonMargin:0,buttonColor:"#d22e2e",returnObject:!1,animationDuration:100,disabled:!1,disableValueChangeOnPress:!1,initial:-1,value:1,onPress:null,accessibilityLabel:null,testID:null},Q.propTypes={style:X.oneOfType([X.object,X.array]),textStyle:X.object,selectedTextStyle:X.object,textContainerStyle:X.object,selectedTextContainerStyle:X.object,imageStyle:X.object,options:X.array,textColor:X.string,selectedColor:X.string,fontSize:X.number,backgroundColor:X.string,borderColor:X.string,borderRadius:X.number,borderWidth:X.number,hasPadding:X.bool,valuePadding:X.number,height:X.number,bold:X.bool,buttonMargin:X.number,buttonColor:X.string,returnObject:X.bool,animationDuration:X.number,disabled:X.bool,disableValueChangeOnPress:X.bool,initial:X.number,value:X.number,onPress:X.func,accessibilityLabel:X.string,testID:X.string},exports.Button=function(r){return e.jsx(t.Button,a({colorScheme:"primary",variant:"solid"},r),void 0)},exports.Checkbox=function(r){var n=i.default.useState([]);return e.jsxs(t.Checkbox.Group,{onChange:n[1],value:n[0],children:[e.jsx(t.Checkbox,{value:"one",my:2,children:"Item 1"},void 0),e.jsx(t.Checkbox,{value:"two"},void 0)]},void 0)},exports.FormControl=function(r){return e.jsx(t.FormControl,a({},r),void 0)},exports.Heading=function(r){return e.jsx(t.Heading,a({},r),void 0)},exports.Input=function(r){return e.jsx(t.Input,a({},r),void 0)},exports.SelectGroup=function(r){return e.jsx(t.Select,a({},r),void 0)},exports.SelectItem=function(r){return e.jsx(t.Select.Item,a({},r),void 0)},exports.Slider=function(r){return e.jsxs(t.Slider,a({},r,{children:[e.jsx(t.Slider.Track,{children:e.jsx(t.Slider.FilledTrack,{},void 0)},void 0),e.jsx(t.Slider.Thumb,{},void 0)]}),void 0)},exports.Switch=function(r){return e.jsx(t.Switch,a({},r),void 0)},exports.SwitchSelector=Q,exports.TextArea=function(r){return e.jsx(t.TextArea,a({},r),void 0)}; //# sourceMappingURL=qvt-components.js.map