@pedidopago/ui 1.10.10 → 1.10.11

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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Examples/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,eAkDnD;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,aAAa,eAe/D;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,aAAa,eAoChE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Carousel/Examples/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,eAwDnD;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,aAAa,eAe/D;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,aAAa,eAoChE"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CarouselExample=CarouselExample,exports.CarouselExampleCustomButtons=CarouselExampleCustomButtons,exports.CarouselExampleDynamicChids=CarouselExampleDynamicChids;var _=require(".."),_Button=_interopRequireDefault(require("../../../components/Button")),_Flex=_interopRequireDefault(require("../../../components/Flex")),_styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}var arrayTeste=["1","2","3","4","5","6","7","8","9","10","11","12"];function CarouselExample(props){return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",spacing:"1rem",alignItems:"flex-start",style:{maxWidth:"100%",height:"80vh"},children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"250px"},children:"1"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"150px"},children:"2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"50px"},children:"3"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"350px"},children:"4"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"350px"},children:"5"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"250px"},children:"6"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"150px"},children:"7"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"450px"},children:"8"})]})),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:arrayTeste.map(function(item,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"800px"},children:item},"".concat(index,"-item-big"))})})),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:arrayTeste.map(function(item,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"300px"},children:item},"".concat(index,"-item-large"))})})),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:arrayTeste.map(function(item,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"150px"},children:item},"".concat(index,"-item-middle"))})})),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"150px"},children:"S\xF3 um"})}))]})}function CarouselExampleDynamicChids(props){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_Flex.default,{style:{height:"500px"},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"250px"},children:"1"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"150px"},children:"2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"50px"},children:"3"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"350px"},children:"4"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"350px"},children:"5"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"250px"},children:"6"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"150px"},children:"7"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"450px"},children:"8"})]}))})}function CarouselExampleCustomButtons(props){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_Flex.default,{style:{height:"500px"},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Carousel,_objectSpread(_objectSpread({},props),{},{leftButton:function leftButton(moveLeft){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{onClick:function onClick(){moveLeft()},children:"Voltar"})},rightButton:function rightButton(moveRight){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{style:{whiteSpace:"nowrap"},onClick:function onClick(){moveRight()},children:"Avan\xE7ar"})},children:arrayTeste.map(function(item,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"800px"},children:item},"".concat(index,"-item-custom-button"))})}))})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CarouselExample=CarouselExample,exports.CarouselExampleCustomButtons=CarouselExampleCustomButtons,exports.CarouselExampleDynamicChids=CarouselExampleDynamicChids;var _=require(".."),_Button=_interopRequireDefault(require("../../../components/Button")),_Flex=_interopRequireDefault(require("../../../components/Flex")),_styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}/* eslint-disable no-console */var arrayTeste=["1","2","3","4","5","6","7","8","9","10","11","12"];function CarouselExample(props){return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",spacing:"1rem",alignItems:"flex-start",style:{maxWidth:"100%",height:"80vh"},children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"250px"},children:"1"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"150px"},children:"2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"50px"},children:"3"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"350px"},children:"4"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"350px"},children:"5"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"250px"},children:"6"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"150px"},children:"7"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"450px"},children:"8"})]})),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:arrayTeste.map(function(item,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{onClick:function onClick(){console.log(item)},style:{height:"100px",width:"800px"},children:item},"".concat(index,"-item-big"))})})),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:arrayTeste.map(function(item,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"300px"},children:item},"".concat(index,"-item-large"))})})),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:arrayTeste.map(function(item,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"150px"},children:item},"".concat(index,"-item-middle"))})})),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"150px"},children:"S\xF3 um"})}))]})}function CarouselExampleDynamicChids(props){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_Flex.default,{style:{height:"500px"},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.Carousel,_objectSpread(_objectSpread({},props),{},{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"250px"},children:"1"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"150px"},children:"2"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"50px"},children:"3"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"350px"},children:"4"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"350px"},children:"5"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"250px"},children:"6"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"150px"},children:"7"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100px",width:"450px"},children:"8"})]}))})}function CarouselExampleCustomButtons(props){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_Flex.default,{style:{height:"500px"},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_.Carousel,_objectSpread(_objectSpread({},props),{},{leftButton:function leftButton(moveLeft){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{onClick:function onClick(){moveLeft()},children:"Voltar"})},rightButton:function rightButton(moveRight){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{style:{whiteSpace:"nowrap"},onClick:function onClick(){moveRight()},children:"Avan\xE7ar"})},children:arrayTeste.map(function(item,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CarouselItemExample,{style:{height:"100%",width:"800px"},children:item},"".concat(index,"-item-custom-button"))})}))})}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIxC,wBAAgB,QAAQ,CAAC,EACvB,GAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,WAAW,EACX,GAAG,QAAQ,EACZ,EAAE,aAAa,eAuTf"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIxC,wBAAgB,QAAQ,CAAC,EACvB,GAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,WAAW,EACX,GAAG,QAAQ,EACZ,EAAE,aAAa,eAoUf"}
@@ -1 +1 @@
1
- "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Carousel=Carousel;var _react=require("react"),_classnames=_interopRequireDefault(require("classnames")),_Icon=_interopRequireDefault(require("../Icon")),_styles=require("./styles"),_formatters=require("../../utils/formatters"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["gap","hideArrowButtons","children","buttonShadow","leftButton","rightButton"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}function Carousel(_ref){function hideRightButton(hide){rightButtonRef.current&&(hide?rightButtonRef.current.classList.add("hide"):rightButtonRef.current.classList.remove("hide"))}function hideLeftButton(hide){leftButtonRef.current&&(hide?leftButtonRef.current.classList.add("hide"):leftButtonRef.current.classList.remove("hide"))}function beginMomentumTracking(){cancelMomentumTracking(),momentumID=requestAnimationFrame(momentumLoop)}function cancelMomentumTracking(){cancelAnimationFrame(momentumID)}function handleHideButtons(){if(sliderRef.current){var maxScroll=sliderRef.current.scrollWidth-sliderRef.current.clientWidth,isEndOfScroll=sliderRef.current.scrollLeft>=maxScroll;isMaxScroll.current=isEndOfScroll,hideRightButton(isEndOfScroll),hideLeftButton(0===sliderRef.current.scrollLeft)}}function onMomentumEnd(){handleHideButtons()}function momentumLoop(){if(sliderRef.current){var _sliderRef$current;sliderRef.current.scrollLeft+=2*velX,velX*=.95;var disableMomentum=isMaxScroll.current||0===(null===(_sliderRef$current=sliderRef.current)||void 0===_sliderRef$current?void 0:_sliderRef$current.scrollLeft);.75<Math.abs(velX)&&!disableMomentum?(hideLeftButton(!0),hideRightButton(!0),momentumID=requestAnimationFrame(momentumLoop)):onMomentumEnd()}}function changeScrollLeft(scrollLeft){sliderRef.current&&sliderRef.current.scrollTo({behavior:"smooth",left:scrollLeft})}function moveLeftItem(){if(sliderRef.current)for(var childs=sliderRef.current.childNodes,sliderWidth=sliderRef.current.offsetWidth,i=0;i<childs.length;i++){var child=childs[i],itemTotalOffset=child.offsetLeft+child.offsetWidth,isPrevVisibleItem=itemTotalOffset>sliderRef.current.scrollLeft;if(isPrevVisibleItem){var prevChild=childs[i-1];if(!prevChild)return void changeScrollLeft(0);var isLargeItem=prevChild.offsetWidth>(0,_formatters.halfDivisor)(sliderWidth);isLargeItem?changeScrollLeft(prevChild.offsetLeft):changeScrollLeft(prevChild.offsetLeft+(0,_formatters.halfDivisor)(prevChild.offsetWidth));break}}}function moveRightItem(){if(sliderRef.current)for(var childs=sliderRef.current.childNodes,sliderWidth=sliderRef.current.offsetWidth,i=1;i<childs.length;i++){var child=childs[i],itemTotalOffset=child.offsetLeft+child.offsetWidth,isNextVisibleItem=itemTotalOffset>sliderRef.current.scrollLeft+sliderWidth;if(isNextVisibleItem){var nextSibling=child.nextSibling||child,nextSiblingWidth=nextSibling.offsetWidth||0,isLargeItem=nextSiblingWidth>(0,_formatters.halfDivisor)(sliderWidth),nextSiblingLeft=(null===nextSibling||void 0===nextSibling?void 0:nextSibling.offsetLeft)||0;if(isLargeItem)return void changeScrollLeft(child.offsetLeft);if(!child.nextSibling)return void changeScrollLeft(nextSiblingLeft+nextSiblingWidth-sliderWidth);changeScrollLeft(nextSiblingLeft+(0,_formatters.halfDivisor)(nextSiblingWidth)-sliderWidth);break}}}var startX,initialScrollLeft,momentumID,_ref$gap=_ref.gap,gap=void 0===_ref$gap?16:_ref$gap,hideArrowButtons=_ref.hideArrowButtons,children=_ref.children,buttonShadow=_ref.buttonShadow,leftButton=_ref.leftButton,rightButton=_ref.rightButton,divProps=_objectWithoutProperties(_ref,_excluded),rightButtonRef=(0,_react.useRef)(null),leftButtonRef=(0,_react.useRef)(null),sliderRef=(0,_react.useRef)(null),isMaxScroll=(0,_react.useRef)(!1),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),itemsHasNoOverflow=_useState2[0],setItemsHasNoOverflow=_useState2[1],isDragging=!1,velX=0,moveCarousel=function moveCarousel(direction){sliderRef.current&&(hideRightButton(!1),hideLeftButton(!1),"left"===direction?moveLeftItem():moveRightItem())};(0,_react.useEffect)(function(){if(sliderRef.current){var _sliderRef$current2,lastChild=null===(_sliderRef$current2=sliderRef.current)||void 0===_sliderRef$current2?void 0:_sliderRef$current2.querySelector(".item-".concat(_react.Children.count(children))),lastChildOffsetLeft=(null===lastChild||void 0===lastChild?void 0:lastChild.offsetLeft)||0,lastChildWidth=(null===lastChild||void 0===lastChild?void 0:lastChild.offsetWidth)||0,hasNoOverflow=lastChildOffsetLeft+lastChildWidth<sliderRef.current.offsetWidth;setItemsHasNoOverflow(hasNoOverflow)}},[sliderRef.current]),(0,_react.useEffect)(function(){sliderRef.current&&hideRightButton(!1)},[sliderRef]);var customLeftButton=null===leftButton||void 0===leftButton?void 0:leftButton(function(){return moveCarousel("left")}),customRightButton=null===rightButton||void 0===rightButton?void 0:rightButton(function(){return moveCarousel("right")});return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",_objectSpread(_objectSpread({style:{position:"relative",overflow:"hidden",width:"100%",height:"100%"}},divProps),{},{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.SliderContainer,{onTouchMove:function onTouchMove(){hideLeftButton(!0),hideRightButton(!0)},onTouchEnd:beginMomentumTracking,className:"slider_container",style:{gap:gap+"px"},ref:sliderRef,onMouseDown:function handleMouseDown(event){isDragging=!0,sliderRef.current&&(startX=event.pageX-sliderRef.current.offsetLeft,initialScrollLeft=sliderRef.current.scrollLeft,cancelMomentumTracking())},onMouseUp:function handleMouseUp(){if(isDragging=!1,sliderRef.current){hideLeftButton(!1),beginMomentumTracking(),hideRightButton(isMaxScroll.current);var isStartOfScroll=0===sliderRef.current.scrollLeft;hideLeftButton(isStartOfScroll)}},onMouseMove:function handleMouseMove(e){if(isDragging&&(e.preventDefault(),sliderRef.current)){hideRightButton(!0),hideLeftButton(!0);var x=e.pageX-sliderRef.current.offsetLeft,walk=x-startX,prevScrollLeft=sliderRef.current.scrollLeft;sliderRef.current.scrollLeft=initialScrollLeft-walk,velX=sliderRef.current.scrollLeft-prevScrollLeft}},onWheel:function handleWheel(){cancelMomentumTracking()},onScroll:function handleScroll(event){var element=event.currentTarget,maxScroll=element.scrollWidth-element.clientWidth,isEndOfScroll=element.scrollLeft>=maxScroll;isMaxScroll.current=!1,isEndOfScroll?(isMaxScroll.current=!0,hideRightButton(!0)):0===element.scrollLeft&&hideLeftButton(!0)},onMouseLeave:function handleMouseLeave(){isDragging=!1,handleHideButtons()},children:_react.Children.map(children,function(child,index){var childElement=child;return/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:"item-".concat(index+1," carousel_item"),children:childElement})})}),!hideArrowButtons&&/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ContainerButton,{className:(0,_classnames.default)("left_button hide",{button_shadow:buttonShadow,hide:itemsHasNoOverflow}),ref:leftButtonRef,children:customLeftButton||/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DefaultButton,{onClick:function onClick(){return moveCarousel("left")},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"chevron-left",color:"neutral.neutral6",size:"18px"})})}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ContainerButton,{className:(0,_classnames.default)("right_button",{button_shadow:buttonShadow,hide:itemsHasNoOverflow}),ref:rightButtonRef,children:customRightButton||/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DefaultButton,{onClick:function onClick(){return moveCarousel("right")},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"chevron-right",color:"neutral.neutral6",size:"18px"})})})]})]}))}
1
+ "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Carousel=Carousel;var _react=require("react"),_classnames=_interopRequireDefault(require("classnames")),_Icon=_interopRequireDefault(require("../Icon")),_styles=require("./styles"),_formatters=require("../../utils/formatters"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["gap","hideArrowButtons","children","buttonShadow","leftButton","rightButton"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}function Carousel(_ref){function hideRightButton(hide){rightButtonRef.current&&(hide?rightButtonRef.current.classList.add("hide"):rightButtonRef.current.classList.remove("hide"))}function hideLeftButton(hide){leftButtonRef.current&&(hide?leftButtonRef.current.classList.add("hide"):leftButtonRef.current.classList.remove("hide"))}function beginMomentumTracking(){cancelMomentumTracking(),momentumID=requestAnimationFrame(momentumLoop)}function cancelMomentumTracking(){cancelAnimationFrame(momentumID)}function handleHideButtons(){if(sliderRef.current){var maxScroll=sliderRef.current.scrollWidth-sliderRef.current.clientWidth,isEndOfScroll=sliderRef.current.scrollLeft>=maxScroll;isMaxScroll.current=isEndOfScroll,hideRightButton(isEndOfScroll),hideLeftButton(0===sliderRef.current.scrollLeft)}}function onMomentumEnd(){handleHideButtons()}function momentumLoop(){if(sliderRef.current){var _sliderRef$current;sliderRef.current.scrollLeft+=2*velX,velX*=.95;var disableMomentum=isMaxScroll.current||0===(null===(_sliderRef$current=sliderRef.current)||void 0===_sliderRef$current?void 0:_sliderRef$current.scrollLeft);.75<Math.abs(velX)&&!disableMomentum?(hideLeftButton(!0),hideRightButton(!0),momentumID=requestAnimationFrame(momentumLoop)):onMomentumEnd()}}function changeScrollLeft(scrollLeft){sliderRef.current&&sliderRef.current.scrollTo({behavior:"smooth",left:scrollLeft})}function moveLeftItem(){if(sliderRef.current)for(var childs=sliderRef.current.childNodes,sliderWidth=sliderRef.current.offsetWidth,i=0;i<childs.length;i++){var child=childs[i],itemTotalOffset=child.offsetLeft+child.offsetWidth,isPrevVisibleItem=itemTotalOffset>sliderRef.current.scrollLeft;if(isPrevVisibleItem){var prevChild=childs[i-1];if(!prevChild)return void changeScrollLeft(0);var isLargeItem=prevChild.offsetWidth>(0,_formatters.halfDivisor)(sliderWidth);isLargeItem?changeScrollLeft(prevChild.offsetLeft):changeScrollLeft(prevChild.offsetLeft+(0,_formatters.halfDivisor)(prevChild.offsetWidth));break}}}function moveRightItem(){if(sliderRef.current)for(var childs=sliderRef.current.childNodes,sliderWidth=sliderRef.current.offsetWidth,i=1;i<childs.length;i++){var child=childs[i],itemTotalOffset=child.offsetLeft+child.offsetWidth,isNextVisibleItem=itemTotalOffset>sliderRef.current.scrollLeft+sliderWidth;if(isNextVisibleItem){var nextSibling=child.nextSibling||child,nextSiblingWidth=nextSibling.offsetWidth||0,isLargeItem=nextSiblingWidth>(0,_formatters.halfDivisor)(sliderWidth),nextSiblingLeft=(null===nextSibling||void 0===nextSibling?void 0:nextSibling.offsetLeft)||0;if(isLargeItem)return void changeScrollLeft(child.offsetLeft);if(!child.nextSibling)return void changeScrollLeft(nextSiblingLeft+nextSiblingWidth-sliderWidth);changeScrollLeft(nextSiblingLeft+(0,_formatters.halfDivisor)(nextSiblingWidth)-sliderWidth);break}}}var startX,initialScrollLeft,momentumID,_ref$gap=_ref.gap,gap=void 0===_ref$gap?16:_ref$gap,hideArrowButtons=_ref.hideArrowButtons,children=_ref.children,buttonShadow=_ref.buttonShadow,leftButton=_ref.leftButton,rightButton=_ref.rightButton,divProps=_objectWithoutProperties(_ref,_excluded),rightButtonRef=(0,_react.useRef)(null),leftButtonRef=(0,_react.useRef)(null),sliderRef=(0,_react.useRef)(null),isMaxScroll=(0,_react.useRef)(!1),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),itemsHasNoOverflow=_useState2[0],setItemsHasNoOverflow=_useState2[1],isDragging=!1,velX=0,moveCarousel=function moveCarousel(direction){sliderRef.current&&(hideRightButton(!1),hideLeftButton(!1),"left"===direction?moveLeftItem():moveRightItem())};(0,_react.useEffect)(function(){if(sliderRef.current){var _sliderRef$current2,lastChild=null===(_sliderRef$current2=sliderRef.current)||void 0===_sliderRef$current2?void 0:_sliderRef$current2.querySelector(".item-".concat(_react.Children.count(children))),lastChildOffsetLeft=(null===lastChild||void 0===lastChild?void 0:lastChild.offsetLeft)||0,lastChildWidth=(null===lastChild||void 0===lastChild?void 0:lastChild.offsetWidth)||0,hasNoOverflow=lastChildOffsetLeft+lastChildWidth<sliderRef.current.offsetWidth;setItemsHasNoOverflow(hasNoOverflow)}},[sliderRef.current]),(0,_react.useEffect)(function(){sliderRef.current&&hideRightButton(!1)},[sliderRef]);var customLeftButton=null===leftButton||void 0===leftButton?void 0:leftButton(function(){return moveCarousel("left")}),customRightButton=null===rightButton||void 0===rightButton?void 0:rightButton(function(){return moveCarousel("right")});return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",_objectSpread(_objectSpread({style:{position:"relative",overflow:"hidden",width:"100%",height:"100%"}},divProps),{},{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.SliderContainer,{onTouchMove:function onTouchMove(){hideLeftButton(!0),hideRightButton(!0)},onTouchEnd:beginMomentumTracking,className:"slider_container",style:{gap:gap+"px"},ref:sliderRef,onMouseDown:function handleMouseDown(event){isDragging=!0,sliderRef.current&&(startX=event.pageX-sliderRef.current.offsetLeft,initialScrollLeft=sliderRef.current.scrollLeft,cancelMomentumTracking())},onMouseUp:function handleMouseUp(event){isDragging=!1;var targets=event.currentTarget.childNodes;if(targets.forEach(function(item){item.style.pointerEvents="auto"}),sliderRef.current){hideLeftButton(!1),beginMomentumTracking(),hideRightButton(isMaxScroll.current);var isStartOfScroll=0===sliderRef.current.scrollLeft;hideLeftButton(isStartOfScroll)}},onMouseMove:function handleMouseMove(e){if(isDragging){e.preventDefault();var targets=e.currentTarget.childNodes;if(targets.forEach(function(item){item.style.pointerEvents="none"}),sliderRef.current){hideRightButton(!0),hideLeftButton(!0);var x=e.pageX-sliderRef.current.offsetLeft,walk=x-startX,prevScrollLeft=sliderRef.current.scrollLeft;sliderRef.current.scrollLeft=initialScrollLeft-walk,velX=sliderRef.current.scrollLeft-prevScrollLeft}}},onWheel:function handleWheel(){cancelMomentumTracking()},onScroll:function handleScroll(event){var element=event.currentTarget,maxScroll=element.scrollWidth-element.clientWidth,isEndOfScroll=element.scrollLeft>=maxScroll;isMaxScroll.current=!1,isEndOfScroll?(isMaxScroll.current=!0,hideRightButton(!0)):0===element.scrollLeft&&hideLeftButton(!0)},onMouseLeave:function handleMouseLeave(){isDragging=!1,handleHideButtons()},children:_react.Children.map(children,function(child,index){var childElement=child;return/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:"item-".concat(index+1," carousel_item"),children:childElement})})}),!hideArrowButtons&&/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ContainerButton,{className:(0,_classnames.default)("left_button hide",{button_shadow:buttonShadow,hide:itemsHasNoOverflow}),ref:leftButtonRef,children:customLeftButton||/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DefaultButton,{onClick:function onClick(){return moveCarousel("left")},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"chevron-left",color:"neutral.neutral6",size:"18px"})})}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ContainerButton,{className:(0,_classnames.default)("right_button",{button_shadow:buttonShadow,hide:itemsHasNoOverflow}),ref:rightButtonRef,children:customRightButton||/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DefaultButton,{onClick:function onClick(){return moveCarousel("right")},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"chevron-right",color:"neutral.neutral6",size:"18px"})})})]})]}))}
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/styles.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,eAAe;;;yGAmB3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;yGAsD3B,CAAC;AAEF,eAAO,MAAM,aAAa;;;qHAWzB,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/styles.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,eAAe;;;yGAmB3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;yGA8D3B,CAAC;AAEF,eAAO,MAAM,aAAa;;;qHAWzB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SliderContainer=exports.DefaultButton=exports.ContainerButton=void 0;var _templateObject,_templateObject2,_templateObject3,_styled=_interopRequireDefault(require("@emotion/styled"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _taggedTemplateLiteral(strings,raw){return raw||(raw=strings.slice(0)),Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))}var SliderContainer=_styled.default.div(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: none;\n scrollbar-width: none;\n display: flex;\n width: 100%;\n height: 100%;\n cursor: pointer;\n overflow-x: auto;\n display: flex;\n\n &::-webkit-scrollbar {\n display: none;\n }\n\n .carousel_item {\n margin: auto;\n flex-shrink: 0;\n }\n"])));exports.SliderContainer=SliderContainer;var ContainerButton=_styled.default.div(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n width: fit-content;\n display: flex;\n align-items: center;\n height: 100%;\n position: absolute;\n top: 50%;\n transform: translate(0px, -50%);\n\n transition: all ease 0.2s;\n justify-content: center;\n transition: all cubic-bezier(0.25, 1.5, 0.25, 1) 0.5s;\n\n &::before {\n content: '';\n position: absolute;\n height: 100%;\n width: 200%;\n z-index: -1;\n top: 0;\n transition: all cubic-bezier(0.25, 1.5, 0.25, 1) 0.5s;\n }\n\n &.left_button.button_shadow::before {\n left: -100%;\n background: ",";\n }\n\n &.right_button.button_shadow::before {\n right: -100%;\n background: ",";\n }\n\n &.hide.left_button {\n transform: translate(-150%, -50%);\n }\n\n &.hide.right_button {\n transform: translate(150%, -50%);\n }\n\n &.right_button {\n right: 1rem;\n }\n\n &.left_button {\n left: 1rem;\n }\n\n @media (max-width: 750px) {\n display: none;\n }\n"])),function(_ref){var theme=_ref.theme;return"linear-gradient(90deg, ".concat(theme.colors.neutral.white,"80 0%, rgba(255, 255, 255, 0) 100%)")},function(_ref2){var theme=_ref2.theme;return"linear-gradient(270deg, ".concat(theme.colors.neutral.white,"80 0%, rgba(255, 255, 255, 0) 100%)")});exports.ContainerButton=ContainerButton;var DefaultButton=_styled.default.button(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n background: ",";\n border: none;\n padding: 0.75rem;\n border-radius: 50%;\n cursor: pointer;\n transition: all cubic-bezier(0.25, 1.5, 0.2, 1) 0.4s;\n\n &:hover {\n transform: scale(0.85);\n }\n"])),function(_ref3){var theme=_ref3.theme;return theme.colors.neutral.white});exports.DefaultButton=DefaultButton;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SliderContainer=exports.DefaultButton=exports.ContainerButton=void 0;var _templateObject,_templateObject2,_templateObject3,_styled=_interopRequireDefault(require("@emotion/styled"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _taggedTemplateLiteral(strings,raw){return raw||(raw=strings.slice(0)),Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))}var SliderContainer=_styled.default.div(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: none;\n scrollbar-width: none;\n display: flex;\n width: 100%;\n height: 100%;\n cursor: pointer;\n overflow-x: auto;\n display: flex;\n\n &::-webkit-scrollbar {\n display: none;\n }\n\n .carousel_item {\n margin: auto;\n flex-shrink: 0;\n }\n"])));exports.SliderContainer=SliderContainer;var ContainerButton=_styled.default.div(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n width: fit-content;\n display: flex;\n align-items: center;\n height: 100%;\n position: absolute;\n top: 50%;\n transform: translate(0px, -50%);\n\n transition: all ease 0.2s;\n justify-content: center;\n transition: all cubic-bezier(0.25, 1.5, 0.25, 1) 0.5s;\n\n &::before {\n content: '';\n position: absolute;\n height: 100%;\n width: 200%;\n z-index: -1;\n top: 0;\n transition: all cubic-bezier(0.25, 1.5, 0.25, 1) 0.5s;\n }\n\n &.left_button.button_shadow::before {\n left: -100%;\n background: ",";\n }\n\n &.right_button.button_shadow::before {\n right: -100%;\n background: ",";\n }\n\n &.hide {\n > button {\n pointer-events: none;\n }\n\n filter: brightness(0.8);\n }\n\n &:not(:hover).hide.left_button {\n transform: translate(-150%, -50%);\n }\n\n &:not(:hover).hide.right_button {\n transform: translate(150%, -50%);\n }\n\n &.right_button {\n right: 1rem;\n }\n\n &.left_button {\n left: 1rem;\n }\n\n @media (max-width: 750px) {\n display: none;\n }\n"])),function(_ref){var theme=_ref.theme;return"linear-gradient(90deg, ".concat(theme.colors.neutral.white,"80 0%, rgba(255, 255, 255, 0) 100%)")},function(_ref2){var theme=_ref2.theme;return"linear-gradient(270deg, ".concat(theme.colors.neutral.white,"80 0%, rgba(255, 255, 255, 0) 100%)")});exports.ContainerButton=ContainerButton;var DefaultButton=_styled.default.button(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n background: ",";\n border: none;\n padding: 0.75rem;\n border-radius: 50%;\n cursor: pointer;\n transition: all cubic-bezier(0.25, 1.5, 0.2, 1) 0.4s;\n\n &:hover {\n transform: scale(0.85);\n }\n"])),function(_ref3){var theme=_ref3.theme;return theme.colors.neutral.white});exports.DefaultButton=DefaultButton;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Dropzone/index.tsx"],"names":[],"mappings":";AAyBA,OAAO,EAAE,aAAa,EAAa,MAAM,SAAS,CAAC;AAEnD,QAAA,MAAM,QAAQ,4KAgBX,aAAa,gBAyOf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Dropzone/index.tsx"],"names":[],"mappings":";AA0BA,OAAO,EAAE,aAAa,EAAa,MAAM,SAAS,CAAC;AAEnD,QAAA,MAAM,QAAQ,4KAgBX,aAAa,gBAuOf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1 +1 @@
1
- "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=require("react"),_framerMotion=require("framer-motion"),_Icon=_interopRequireDefault(require("../Icon")),_Flex=_interopRequireDefault(require("../Flex")),_Button=_interopRequireDefault(require("../Button")),_styles=require("./styles"),_accepts=require("./utils/accepts"),_generateUUID=require("../../utils/generateUUID"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["icon","title","disabledButton","buttonText","alert","helperText","multiple","onChange","onDropAccepted","onDropRejected","accept","onDragEnter","onDragLeave","disabled"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}var Dropzone=function(_ref){function updateInputFiles(files){if(fileInputRef.current){var acceptedFilesFilter=new DataTransfer;files.forEach(function(file){var newFile=new File([file.preview],file.name,{type:file.type});acceptedFilesFilter.items.add(newFile)}),fileInputRef.current.files=acceptedFilesFilter.files}}function addIdToFiles(files){var filesWithId=files.map(function(file){var newFile=file;return newFile.id=(0,_generateUUID.generateUUID)(),newFile.preview=URL.createObjectURL(file),newFile});return filesWithId}function handleUploadFile(files,isDropEvent){var filterAcceptedFiles=files.filter(function(file){return(0,_accepts.accepts)(file,accept)}),filterRejectedFiles=files.filter(function(file){return!(0,_accepts.accepts)(file,accept)});setAcceptedFiles(function(oldValue){var filesWithId=addIdToFiles(filterAcceptedFiles),mergedValues=[].concat(_toConsumableArray(oldValue),_toConsumableArray(filesWithId)),newValue=multiple?mergedValues:filesWithId;if(updateInputFiles(newValue),0<filterAcceptedFiles.length&&fileInputRef.current){var allAcceptedFiles=Array.from(fileInputRef.current.files||[]);null===onChange||void 0===onChange?void 0:onChange(allAcceptedFiles),isDropEvent&&(null===onDropAccepted||void 0===onDropAccepted?void 0:onDropAccepted(filterAcceptedFiles))}return isDropEvent&&0<filterRejectedFiles.length&&(null===onDropRejected||void 0===onDropRejected?void 0:onDropRejected(filterRejectedFiles)),newValue})}function handleDragEnterLeave(e,type){e.preventDefault(),e.stopPropagation(),"enter"===type?(setIsDragging(!0),null===onDragEnter||void 0===onDragEnter?void 0:onDragEnter(e)):(setIsDragging(!1),null===onDragLeave||void 0===onDragLeave?void 0:onDragLeave(e))}function handleRemoveFile(fileId){var filteredFiles=acceptedFiles.filter(function(file){return file.id!==fileId});setAcceptedFiles(filteredFiles),null===onChange||void 0===onChange?void 0:onChange(filteredFiles),0===filteredFiles.length&&fileInputRef.current&&(fileInputRef.current.value="",fileInputRef.current.files=null)}var icon=_ref.icon,title=_ref.title,_ref$disabledButton=_ref.disabledButton,buttonText=_ref.buttonText,alert=_ref.alert,helperText=_ref.helperText,multiple=_ref.multiple,onChange=_ref.onChange,onDropAccepted=_ref.onDropAccepted,onDropRejected=_ref.onDropRejected,_ref$accept=_ref.accept,accept=void 0===_ref$accept?"":_ref$accept,onDragEnter=_ref.onDragEnter,onDragLeave=_ref.onDragLeave,disabled=_ref.disabled,rest=_objectWithoutProperties(_ref,_excluded),_useState=(0,_react.useState)([]),_useState2=_slicedToArray(_useState,2),acceptedFiles=_useState2[0],setAcceptedFiles=_useState2[1],_useState3=(0,_react.useState)(!1),_useState4=_slicedToArray(_useState3,2),isDragging=_useState4[0],setIsDragging=_useState4[1],fileInputRef=(0,_react.useRef)(null),dropzoneVariants={initial:{opacity:0,scale:.8},visible:{opacity:1,y:0,scale:1},hidden:{opacity:0,scale:.8}};return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.DropzoneContainer,_objectSpread(_objectSpread({isDraggingOver:isDragging,isDisabled:disabled,alert:alert},rest),{},{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneInput,{ref:fileInputRef,type:"file",multiple:multiple,accept:accept,onChange:function(e){var files=Array.from(e.target.files||[]);handleUploadFile(files)},onDrop:function(e){e.preventDefault(),e.stopPropagation();var files=Array.from(e.dataTransfer.files);handleUploadFile(files,!0),setIsDragging(!1)},onDragEnter:function(event){return handleDragEnterLeave(event,"enter")},onDragLeave:function(event){return handleDragEnterLeave(event,"leave")},disabled:disabled}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.AnimatePresence,{mode:"wait",children:0<acceptedFiles.length?/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{alignItems:"center",spacing:"4",wrap:"wrap",justifyContent:"center",children:[acceptedFiles.map(function(file){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{variants:dropzoneVariants,initial:"initial",animate:"visible",exit:"hidden",transition:{duration:.2,ease:"easeInOut"},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.DropzoneFileBox,{disabled:disabled,children:[-1===file.type.indexOf("image")?/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",spacing:"2",justifyContent:"center",alignItems:"center",style:{maxWidth:"100%"},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:file.type.split("/").includes("pdf")?"pdf":file.type.split("/").includes("csv")?"csv":file.type.split("/").includes("xls")?"xls":"file",size:"30",color:"neutral.black"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneFilename,{children:file.name})]}):/*#__PURE__*/(0,_jsxRuntime.jsx)("img",{src:file.preview,alt:file.name}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneRemoveButton,{onClick:function onClick(){return!disabled&&handleRemoveFile(file.id)},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"x",color:"background.light",size:25})})]})},file.id)}),multiple&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneImageAddButton,{isDraggingOver:isDragging,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"plus-circle",color:"neutral.neutral3"})})]}):/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{variants:dropzoneVariants,initial:"initial",animate:"visible",exit:"hidden",transition:{duration:.2,ease:"easeInOut"},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",spacing:"2",alignItems:"center",justifyContent:"center",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeInOut",delay:.2},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:icon||"arrow-up-circle",size:48,color:"neutral.neutral5"})}),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",alignItems:"center",children:[title&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneText,{fontWeight:"600",fontSize:"xs",alert:alert,children:title}),helperText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneText,{fontSize:"xxs",textAlign:"center",color:"neutral.neutral2",alert:alert,children:helperText||"ou solte um arquivo aqui"})]}),!(void 0!==_ref$disabledButton&&_ref$disabledButton)&&/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Button.default,{variant:"outline",bgColor:"neutral.neutral4",children:[buttonText||"Selecionar um arquivo"," "]})]})})})]}))},_default=Dropzone;exports.default=_default;
1
+ "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=require("react"),_framerMotion=require("framer-motion"),_Icon=_interopRequireDefault(require("../Icon")),_Flex=_interopRequireDefault(require("../Flex")),_Button=_interopRequireDefault(require("../Button")),_styles=require("./styles"),_accepts=require("./utils/accepts"),_covertBlob=require("./utils/covert-blob"),_generateUUID=require("../../utils/generateUUID"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["icon","title","disabledButton","buttonText","alert","helperText","multiple","onChange","onDropAccepted","onDropRejected","accept","onDragEnter","onDragLeave","disabled"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return defineProperty(generator,"_invoke",{value:makeInvokeMethod(innerFn,self,context)}),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;defineProperty(this,"_invoke",{value:function value(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"==state)throw new Error("Generator is already running");if("completed"==state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"==state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}function maybeInvokeDelegate(delegate,context){var methodName=context.method,method=delegate.iterator[methodName];if(void 0===method)return context.delegate=null,"throw"===methodName&&delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method)||"return"!==methodName&&(context.method="throw",context.arg=new TypeError("The iterator does not provide a '"+methodName+"' method")),ContinueSentinel;var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,defineProperty=Object.defineProperty||function(obj,key,desc){obj[key]=desc.value},$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,defineProperty(Gp,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),defineProperty(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(val){var object=Object(val),keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function _createForOfIteratorHelper(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&"number"==typeof o.length){it&&(o=it);var i=0,F=function(){};return{s:F,n:function n(){return i>=o.length?{done:!0}:{done:!1,value:o[i++]}},e:function e(_e2){throw _e2},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var err,normalCompletion=!0,didErr=!1;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();return normalCompletion=step.done,step},e:function e(_e3){didErr=!0,err=_e3},f:function f(){try{normalCompletion||null==it.return||it.return()}finally{if(didErr)throw err}}}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}var Dropzone=function(_ref){function updateInputFiles(_x2){return _updateInputFiles.apply(this,arguments)}function _updateInputFiles(){return _updateInputFiles=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(files){var acceptedFilesFilter,_iterator,_step,file,blob,newFile;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(!fileInputRef.current){_context.next=23;break}acceptedFilesFilter=new DataTransfer,_iterator=_createForOfIteratorHelper(files),_context.prev=3,_iterator.s();case 5:if((_step=_iterator.n()).done){_context.next=14;break}return file=_step.value,_context.next=9,(0,_covertBlob.convertToBlob)(file.preview);case 9:blob=_context.sent,newFile=new File([blob],file.name,{type:file.type}),acceptedFilesFilter.items.add(newFile);case 12:_context.next=5;break;case 14:_context.next=19;break;case 16:_context.prev=16,_context.t0=_context["catch"](3),_iterator.e(_context.t0);case 19:return _context.prev=19,_iterator.f(),_context.finish(19);case 22:fileInputRef.current.files=acceptedFilesFilter.files;case 23:case"end":return _context.stop();}},_callee,null,[[3,16,19,22]])})),_updateInputFiles.apply(this,arguments)}function addIdToFiles(files){var filesWithId=files.map(function(file){var newFile=file;return newFile.id=(0,_generateUUID.generateUUID)(),newFile.preview=URL.createObjectURL(file),newFile});return filesWithId}function handleUploadFile(_x3,_x4){return _handleUploadFile.apply(this,arguments)}function _handleUploadFile(){return _handleUploadFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(files,isDropEvent){var filterAcceptedFiles,filterRejectedFiles;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:filterAcceptedFiles=files.filter(function(file){return(0,_accepts.accepts)(file,accept)}),filterRejectedFiles=files.filter(function(file){return!(0,_accepts.accepts)(file,accept)}),setAcceptedFiles(function(oldValue){var filesWithId=addIdToFiles(filterAcceptedFiles),mergedValues=[].concat(_toConsumableArray(oldValue),_toConsumableArray(filesWithId)),newValue=multiple?mergedValues:filesWithId;return updateInputFiles(newValue).then(function(){if(0<filterAcceptedFiles.length&&fileInputRef.current){var allAcceptedFiles=Array.from(fileInputRef.current.files||[]);null===onChange||void 0===onChange?void 0:onChange(allAcceptedFiles),isDropEvent&&(null===onDropAccepted||void 0===onDropAccepted?void 0:onDropAccepted(filterAcceptedFiles))}isDropEvent&&0<filterRejectedFiles.length&&(null===onDropRejected||void 0===onDropRejected?void 0:onDropRejected(filterRejectedFiles))}),newValue});case 3:case"end":return _context2.stop();}},_callee2)})),_handleUploadFile.apply(this,arguments)}function handleDragEnterLeave(e,type){e.preventDefault(),e.stopPropagation(),"enter"===type?(setIsDragging(!0),null===onDragEnter||void 0===onDragEnter?void 0:onDragEnter(e)):(setIsDragging(!1),null===onDragLeave||void 0===onDragLeave?void 0:onDragLeave(e))}function handleRemoveFile(fileId){var filteredFiles=acceptedFiles.filter(function(file){return file.id!==fileId});setAcceptedFiles(filteredFiles),null===onChange||void 0===onChange?void 0:onChange(filteredFiles),0===filteredFiles.length&&fileInputRef.current&&(fileInputRef.current.value="",fileInputRef.current.files=null)}var icon=_ref.icon,title=_ref.title,_ref$disabledButton=_ref.disabledButton,buttonText=_ref.buttonText,alert=_ref.alert,helperText=_ref.helperText,multiple=_ref.multiple,onChange=_ref.onChange,onDropAccepted=_ref.onDropAccepted,onDropRejected=_ref.onDropRejected,_ref$accept=_ref.accept,accept=void 0===_ref$accept?"":_ref$accept,onDragEnter=_ref.onDragEnter,onDragLeave=_ref.onDragLeave,disabled=_ref.disabled,rest=_objectWithoutProperties(_ref,_excluded),_useState=(0,_react.useState)([]),_useState2=_slicedToArray(_useState,2),acceptedFiles=_useState2[0],setAcceptedFiles=_useState2[1],_useState3=(0,_react.useState)(!1),_useState4=_slicedToArray(_useState3,2),isDragging=_useState4[0],setIsDragging=_useState4[1],fileInputRef=(0,_react.useRef)(null),dropzoneVariants={initial:{opacity:0,scale:.8},visible:{opacity:1,y:0,scale:1},hidden:{opacity:0,scale:.8}};return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.DropzoneContainer,_objectSpread(_objectSpread({isDraggingOver:isDragging,isDisabled:disabled,alert:alert},rest),{},{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneInput,{ref:fileInputRef,type:"file",multiple:multiple,accept:accept,onChange:function handleChange(e){var files=Array.from(e.target.files||[]);handleUploadFile(files)},onDrop:function handleDrop(e){e.preventDefault(),e.stopPropagation();var files=Array.from(e.dataTransfer.files);handleUploadFile(files,!0),setIsDragging(!1)},onDragEnter:function onDragEnter(event){return handleDragEnterLeave(event,"enter")},onDragLeave:function onDragLeave(event){return handleDragEnterLeave(event,"leave")},disabled:disabled}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.AnimatePresence,{mode:"wait",children:0<acceptedFiles.length?/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{alignItems:"center",spacing:"4",wrap:"wrap",justifyContent:"center",children:[acceptedFiles.map(function(file){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{variants:dropzoneVariants,initial:"initial",animate:"visible",exit:"hidden",transition:{duration:.2,ease:"easeInOut"},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.DropzoneFileBox,{disabled:disabled,children:[-1===file.type.indexOf("image")?/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",spacing:"2",justifyContent:"center",alignItems:"center",style:{maxWidth:"100%"},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:file.type.split("/").includes("pdf")?"pdf":file.type.split("/").includes("csv")?"csv":file.type.split("/").includes("xls")?"xls":"file",size:"30",color:"neutral.black"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneFilename,{children:file.name})]}):/*#__PURE__*/(0,_jsxRuntime.jsx)("img",{src:file.preview,alt:file.name}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneRemoveButton,{onClick:function onClick(){return!disabled&&handleRemoveFile(file.id)},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"x",color:"background.light",size:25})})]})},file.id)}),multiple&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneImageAddButton,{isDraggingOver:isDragging,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"plus-circle",color:"neutral.neutral3"})})]}):/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{variants:dropzoneVariants,initial:"initial",animate:"visible",exit:"hidden",transition:{duration:.2,ease:"easeInOut"},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",spacing:"2",alignItems:"center",justifyContent:"center",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeInOut",delay:.2},children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:icon||"arrow-up-circle",size:48,color:"neutral.neutral5"})}),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",alignItems:"center",children:[title&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneText,{fontWeight:"600",fontSize:"xs",alert:alert,children:title}),helperText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.DropzoneText,{fontSize:"xxs",textAlign:"center",color:"neutral.neutral2",alert:alert,children:helperText||"ou solte um arquivo aqui"})]}),!(void 0!==_ref$disabledButton&&_ref$disabledButton)&&/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Button.default,{variant:"outline",bgColor:"neutral.neutral4",children:[buttonText||"Selecionar um arquivo"," "]})]})})})]}))},_default=Dropzone;exports.default=_default;
@@ -0,0 +1,2 @@
1
+ export declare function convertToBlob(blobUrl: string): Promise<Blob>;
2
+ //# sourceMappingURL=covert-blob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"covert-blob.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropzone/utils/covert-blob.ts"],"names":[],"mappings":"AAAA,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,iBAElD"}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.convertToBlob=convertToBlob;function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return defineProperty(generator,"_invoke",{value:makeInvokeMethod(innerFn,self,context)}),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;defineProperty(this,"_invoke",{value:function value(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"==state)throw new Error("Generator is already running");if("completed"==state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"==state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}function maybeInvokeDelegate(delegate,context){var methodName=context.method,method=delegate.iterator[methodName];if(void 0===method)return context.delegate=null,"throw"===methodName&&delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method)||"return"!==methodName&&(context.method="throw",context.arg=new TypeError("The iterator does not provide a '"+methodName+"' method")),ContinueSentinel;var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,defineProperty=Object.defineProperty||function(obj,key,desc){obj[key]=desc.value},$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,defineProperty(Gp,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),defineProperty(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(val){var object=Object(val),keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}function convertToBlob(){return _convertToBlob.apply(this,arguments)}function _convertToBlob(){return _convertToBlob=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(blobUrl){return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:return _context.abrupt("return",fetch(blobUrl).then(function(response){return response.blob()}));case 1:case"end":return _context.stop();}},_callee)})),_convertToBlob.apply(this,arguments)}
@@ -1 +1 @@
1
- "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=require("react"),_Button=_interopRequireDefault(require("../Button")),_styles=require("./styles"),_Typography=_interopRequireDefault(require("../Typography")),_Icon=_interopRequireDefault(require("../Icon")),_jsxRuntime=require("react/jsx-runtime"),_excluded=["placeholder","type","disabled","label","labelBackground","hiddenContent","helperText","alert","withAddon","addonContent","withIcon","onLeftIconClick","onRightIconClick","leftIcon","rightIcon","ContainerProps"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}var Input=/*#__PURE__*/(0,_react.forwardRef)(function(_ref,forwardedRef){function handleInputChange(value){setHasValueOnInput(0<value.length)}var placeholder=_ref.placeholder,type=_ref.type,disabled=_ref.disabled,label=_ref.label,labelBackground=_ref.labelBackground,hiddenContent=_ref.hiddenContent,helperText=_ref.helperText,alert=_ref.alert,withAddon=_ref.withAddon,addonContent=_ref.addonContent,withIcon=_ref.withIcon,onLeftIconClick=_ref.onLeftIconClick,onRightIconClick=_ref.onRightIconClick,leftIcon=_ref.leftIcon,rightIcon=_ref.rightIcon,ContainerProps=_ref.ContainerProps,rest=_objectWithoutProperties(_ref,_excluded),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),hasValueOnInput=_useState2[0],setHasValueOnInput=_useState2[1],_useState3=(0,_react.useState)(hiddenContent||!1),_useState4=_slicedToArray(_useState3,2),hiddenInfo=_useState4[0],setHiddenInfo=_useState4[1];return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputGroupElement,_objectSpread(_objectSpread({withIcon:!!withIcon,hasValueOnInput:!!(placeholder||rest.value||rest.defaultValue)||hasValueOnInput,alert:alert,withAddon:withAddon,hasDisabled:disabled,labelBackground:labelBackground,className:rest.className,style:rest.style},ContainerProps),{},{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputColumn,{children:[withAddon&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.AddonElement,{alert:alert,hasDisabled:disabled,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Typography.default,{fontSize:"xs",children:addonContent})}),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputContent,{withAddon:withAddon,children:[label&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputLabel,{withIcon:!!withIcon,hasDisabled:disabled,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Fieldset,{"aria-hidden":!0,hasDisabled:disabled,withAddon:withAddon,alert:alert,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Legend,{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.LegendText,{children:label})})}),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputContentRow,{children:[(withIcon||leftIcon)&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputIcon,{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{type:"button",variant:"ghost",style:{padding:0,cursor:onLeftIconClick?"pointer":"default"},onClick:onLeftIconClick,tabIndex:onLeftIconClick?0:-1,children:withIcon||leftIcon})}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Input,_objectSpread(_objectSpread({"data-input":"input",type:hiddenInfo?"password":type,"aria-label":label,withIcon:withIcon,leftIcon:leftIcon,rightIcon:rightIcon,hiddenContent:hiddenContent,disabled:disabled,alert:alert,placeholder:placeholder,ref:function inputRef(element){return element&&((null!==element&&void 0!==element&&element.value||null!==element&&void 0!==element&&element.defaultValue)&&setHasValueOnInput(!0),forwardedRef&&("function"==typeof forwardedRef?forwardedRef(element):forwardedRef.current=element)),element}},rest),{},{onChange:function onChange(e){var _rest$onChange;handleInputChange(e.currentTarget.value),null===(_rest$onChange=rest.onChange)||void 0===_rest$onChange?void 0:_rest$onChange.call(rest,e)}})),hiddenContent&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputIcon,{clickable:!0,onClick:function(){setHiddenInfo(!hiddenInfo)},children:hiddenInfo?/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"eye"}):/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"eye-off"})}),rightIcon&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputIcon,{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{type:"button",variant:"ghost",style:{padding:0,cursor:onRightIconClick?"pointer":"default"},onClick:onRightIconClick,tabIndex:onRightIconClick?0:-1,children:rightIcon})})]})]})]}),helperText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.HelperText,{alert:alert,children:helperText})]}))});Input.displayName="Input";var _default=Input;exports.default=_default;
1
+ "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=require("react"),_Button=_interopRequireDefault(require("../Button")),_styles=require("./styles"),_Typography=_interopRequireDefault(require("../Typography")),_Icon=_interopRequireDefault(require("../Icon")),_jsxRuntime=require("react/jsx-runtime"),_excluded=["placeholder","type","disabled","label","labelBackground","hiddenContent","helperText","alert","withAddon","addonContent","withIcon","onLeftIconClick","onRightIconClick","leftIcon","rightIcon","ContainerProps"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}var Input=/*#__PURE__*/(0,_react.forwardRef)(function(_ref,forwardedRef){function handleInputChange(value){setHasValueOnInput(0<value.length)}var placeholder=_ref.placeholder,type=_ref.type,disabled=_ref.disabled,label=_ref.label,labelBackground=_ref.labelBackground,hiddenContent=_ref.hiddenContent,helperText=_ref.helperText,alert=_ref.alert,withAddon=_ref.withAddon,addonContent=_ref.addonContent,withIcon=_ref.withIcon,onLeftIconClick=_ref.onLeftIconClick,onRightIconClick=_ref.onRightIconClick,leftIcon=_ref.leftIcon,rightIcon=_ref.rightIcon,ContainerProps=_ref.ContainerProps,rest=_objectWithoutProperties(_ref,_excluded),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),hasValueOnInput=_useState2[0],setHasValueOnInput=_useState2[1],_useState3=(0,_react.useState)(hiddenContent||!1),_useState4=_slicedToArray(_useState3,2),hiddenInfo=_useState4[0],setHiddenInfo=_useState4[1];return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputGroupElement,_objectSpread(_objectSpread({withIcon:!!withIcon,hasValueOnInput:!!(placeholder||rest.value||rest.defaultValue)||hasValueOnInput,alert:alert,withAddon:withAddon,hasDisabled:disabled,labelBackground:labelBackground,className:rest.className,style:rest.style},ContainerProps),{},{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputColumn,{children:[withAddon&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.AddonElement,{alert:alert,hasDisabled:disabled,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Typography.default,{fontSize:"xs",children:addonContent})}),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputContent,{withAddon:withAddon,children:[label&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputLabel,{withIcon:!!withIcon,hasDisabled:disabled,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Fieldset,{"aria-hidden":!0,hasDisabled:disabled,withAddon:withAddon,alert:alert,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Legend,{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.LegendText,{children:label})})}),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.InputContentRow,{children:[(withIcon||leftIcon)&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputIcon,{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{type:"button",variant:"ghost",style:{padding:0,cursor:onLeftIconClick?"pointer":"default"},onClick:onLeftIconClick,tabIndex:onLeftIconClick?0:-1,children:withIcon||leftIcon})}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Input,_objectSpread(_objectSpread({"data-input":"input",type:hiddenInfo?"password":type,"aria-label":label,withIcon:withIcon,leftIcon:leftIcon,rightIcon:rightIcon,hiddenContent:hiddenContent,disabled:disabled,alert:alert,placeholder:placeholder,ref:function inputRef(element){return element&&(forwardedRef&&("function"==typeof forwardedRef?forwardedRef(element):forwardedRef.current=element),(null!==element&&void 0!==element&&element.value||null!==element&&void 0!==element&&element.defaultValue)&&setHasValueOnInput(!0)),element}},rest),{},{onChange:function onChange(e){var _rest$onChange;handleInputChange(e.currentTarget.value),null===(_rest$onChange=rest.onChange)||void 0===_rest$onChange?void 0:_rest$onChange.call(rest,e)}})),hiddenContent&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputIcon,{clickable:!0,onClick:function(){setHiddenInfo(!hiddenInfo)},children:hiddenInfo?/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"eye"}):/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"eye-off"})}),rightIcon&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.InputIcon,{children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{type:"button",variant:"ghost",style:{padding:0,cursor:onRightIconClick?"pointer":"default"},onClick:onRightIconClick,tabIndex:onRightIconClick?0:-1,children:rightIcon})})]})]})]}),helperText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.HelperText,{alert:alert,children:helperText})]}))});Input.displayName="Input";var _default=Input;exports.default=_default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pedidopago/ui",
3
- "version": "1.10.10",
3
+ "version": "1.10.11",
4
4
  "description": "Quick build beatiful Pedido Pago apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",