@pedidopago/ui 1.13.50 → 1.13.51

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,11 +1,4 @@
1
- export type BreakpointsConfig = {
2
- base: number;
3
- sm: number;
4
- md: number;
5
- lg: number;
6
- xl: number;
7
- xxl: number;
8
- };
1
+ import { BreakpointsConfig } from '../types/breakpoints';
9
2
  type BreakpointName = 'base' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
10
3
  type BreakpointValue<T> = {
11
4
  [key in BreakpointName]?: T;
@@ -1 +1 @@
1
- {"version":3,"file":"useBreakpoints.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useBreakpoints.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,KAAK,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAEjE,KAAK,eAAe,CAAC,CAAC,IAAI;KAEvB,GAAG,IAAI,cAAc,CAAC,CAAC,EAAE,CAAC;CAC5B,CAAC;AAoBF,eAAO,MAAM,cAAc,uBAAwB,iBAAiB;;;CA6FnE,CAAC"}
1
+ {"version":3,"file":"useBreakpoints.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useBreakpoints.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,KAAK,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAEjE,KAAK,eAAe,CAAC,CAAC,IAAI;KAEvB,GAAG,IAAI,cAAc,CAAC,CAAC,EAAE,CAAC;CAC5B,CAAC;AAoBF,eAAO,MAAM,cAAc,uBAAwB,iBAAiB;;;CAqEnE,CAAC"}
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useBreakpoints=void 0;var _react=require("react"),_useWindowSize=require("./useWindowSize");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}/**
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useBreakpoints=void 0;var _react=require("react"),_breakpoints=require("src/utils/breakpoints"),_useWindowSize=require("./useWindowSize");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}/**
2
2
  * It returns a function that takes a breakpoint value object and returns the value
3
3
  * of the closest breakpoint to the current window size
4
4
  * @param {BreakpointsConfig} [breakpointsConfig] - This is an optional parameter
5
5
  * that allows you to pass in your own breakpoints.
6
6
  * @returns a `breakpointPicker` function, which receives an object with breakpoint keys and values.
7
7
  * @example const flexDirection = breapointPicker({ sm: 'column', lg: 'row' });
8
- */var defaultBreakpoints={base:1,sm:480,md:768,lg:1024,xl:1280,xxl:1600},useBreakpoints=function(breakpointsConfig){function currentBreakpointWidth(windowSize,breakpoints){var response;return breakpoints.base<=windowSize.width&&(response=breakpoints.base),breakpoints.sm<=windowSize.width&&(response=breakpoints.sm),breakpoints.md<=windowSize.width&&(response=breakpoints.md),breakpoints.lg<=windowSize.width&&(response=breakpoints.lg),breakpoints.xl<=windowSize.width&&(response=breakpoints.xl),breakpoints.xxl<=windowSize.width&&(response=breakpoints.xxl),response}function getClosestBreakpointName(activeBreakpoint,breakpointValues,breakpoints){var breakpointIndex=Object.keys(breakpointValues).findIndex(function(breakpoint){return breakpoint===activeBreakpoint});if(-1!==breakpointIndex)return activeBreakpoint;for(var key,stopIndex=Object.keys(breakpoints).indexOf(activeBreakpoint);0<=stopIndex;){if(key=Object.keys(breakpoints)[stopIndex],Object.prototype.hasOwnProperty.call(breakpointValues,key)){breakpointIndex=stopIndex;break}stopIndex-=1}if(-1!==breakpointIndex){var _key=Object.keys(breakpoints)[breakpointIndex];return _key}return Object.keys(breakpointValues)[0]}var _useState=(0,_react.useState)(null),_useState2=_slicedToArray(_useState,2),breakpoint=_useState2[0],setBreakpoint=_useState2[1],breakpoints=breakpointsConfig||defaultBreakpoints,windowSize=(0,_useWindowSize.useWindowSize)(breakpoints);return(0,_react.useEffect)(function(){var breakpointWidth=currentBreakpointWidth(windowSize,breakpoints);if(breakpointWidth){var activeBreakpoint=Object.keys(breakpoints).filter(function(activeBreakpoint){return breakpoints[activeBreakpoint]===breakpointWidth})[0];setBreakpoint(activeBreakpoint)}},[breakpoints,windowSize]),{breakpoint:breakpoint,breakpointPicker:function(breakpointValues){if(breakpoint){var closestBreakpoint=getClosestBreakpointName(breakpoint,breakpointValues,breakpoints);return closestBreakpoint?breakpointValues[closestBreakpoint]:void 0}}}};exports.useBreakpoints=useBreakpoints;
8
+ */var defaultBreakpoints={base:1,sm:480,md:768,lg:1024,xl:1280,xxl:1600},useBreakpoints=function(breakpointsConfig){function getClosestBreakpointName(activeBreakpoint,breakpointValues,breakpoints){var breakpointIndex=Object.keys(breakpointValues).findIndex(function(breakpoint){return breakpoint===activeBreakpoint});if(-1!==breakpointIndex)return activeBreakpoint;for(var key,stopIndex=Object.keys(breakpoints).indexOf(activeBreakpoint);0<=stopIndex;){if(key=Object.keys(breakpoints)[stopIndex],Object.prototype.hasOwnProperty.call(breakpointValues,key)){breakpointIndex=stopIndex;break}stopIndex-=1}if(-1!==breakpointIndex){var _key=Object.keys(breakpoints)[breakpointIndex];return _key}return Object.keys(breakpointValues)[0]}var _useState=(0,_react.useState)(null),_useState2=_slicedToArray(_useState,2),breakpoint=_useState2[0],setBreakpoint=_useState2[1],breakpoints=breakpointsConfig||defaultBreakpoints,windowSize=(0,_useWindowSize.useWindowSize)(breakpoints);return(0,_react.useEffect)(function(){var breakpointWidth=(0,_breakpoints.currentBreakpointWidth)(windowSize,breakpoints);if(breakpointWidth){var activeBreakpoint=Object.keys(breakpoints).filter(function(activeBreakpoint){return breakpoints[activeBreakpoint]===breakpointWidth})[0];setBreakpoint(activeBreakpoint)}},[breakpoints,windowSize]),{breakpoint:breakpoint,breakpointPicker:function(breakpointValues){if(breakpoint){var closestBreakpoint=getClosestBreakpointName(breakpoint,breakpointValues,breakpoints);return closestBreakpoint?breakpointValues[closestBreakpoint]:void 0}}}};exports.useBreakpoints=useBreakpoints;
@@ -1,7 +1,4 @@
1
- import { BreakpointsConfig } from './useBreakpoints';
2
- export type WindowSize = {
3
- width: number;
4
- height: number;
5
- };
1
+ import { BreakpointsConfig } from '../types/breakpoints';
2
+ import { WindowSize } from '../types/window-size';
6
3
  export declare function useWindowSize(breakpoints?: BreakpointsConfig): WindowSize;
7
4
  //# sourceMappingURL=useWindowSize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWindowSize.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useWindowSize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,aAAa,CAAC,WAAW,CAAC,EAAE,iBAAiB,cA8C5D"}
1
+ {"version":3,"file":"useWindowSize.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useWindowSize.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,wBAAgB,aAAa,CAAC,WAAW,CAAC,EAAE,iBAAiB,cAoC5D"}
@@ -1 +1 @@
1
- "use strict";var _react=require("react");Object.defineProperty(exports,"__esModule",{value:!0}),exports.useWindowSize=useWindowSize;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 _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 useWindowSize(breakpoints){var isClient="object"===("undefined"==typeof window?"undefined":_typeof(window)),_useState=(0,_react.useState)({width:isClient?window.innerWidth:0,height:isClient?window.innerHeight:0}),_useState2=_slicedToArray(_useState,2),currentSize=_useState2[0],setCurrentSize=_useState2[1];return(0,_react.useEffect)(function(){var findClosestBreakpoint=function(width){return breakpoints?Object.values(breakpoints).reduce(function(prev,curr){return Math.abs(curr-width)<Math.abs(prev-width)?curr:prev}):void 0},handleResize=function(){var newWidth=window.innerWidth,newHeight=window.innerHeight;if(!breakpoints)return void setCurrentSize({width:newWidth,height:newHeight});var closestBreakpoint=findClosestBreakpoint(newWidth);closestBreakpoint!==findClosestBreakpoint(currentSize.width)&&setCurrentSize({width:newWidth,height:newHeight})};return window.addEventListener("resize",handleResize),function(){return window.removeEventListener("resize",handleResize)}},[currentSize,breakpoints]),currentSize}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useWindowSize=useWindowSize;var _react=require("react"),_breakpoints=require("src/utils/breakpoints");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 _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 useWindowSize(breakpoints){var isClient="object"===("undefined"==typeof window?"undefined":_typeof(window)),_useState=(0,_react.useState)({width:isClient?window.innerWidth:0,height:isClient?window.innerHeight:0}),_useState2=_slicedToArray(_useState,2),currentSize=_useState2[0],setCurrentSize=_useState2[1];return(0,_react.useEffect)(function(){var handleResize=function(){var newWindowSize={width:window.innerWidth,height:window.innerHeight};if(!breakpoints)return void setCurrentSize(newWindowSize);var currentBreakpoint=(0,_breakpoints.currentBreakpointWidth)(newWindowSize,breakpoints);currentBreakpoint&&(currentSize.width===currentBreakpoint||setCurrentSize({width:currentBreakpoint,height:newWindowSize.height}))};return window.addEventListener("resize",handleResize),function(){return window.removeEventListener("resize",handleResize)}},[currentSize,breakpoints]),currentSize}
@@ -0,0 +1,9 @@
1
+ export type BreakpointsConfig = {
2
+ base: number;
3
+ sm: number;
4
+ md: number;
5
+ lg: number;
6
+ xl: number;
7
+ xxl: number;
8
+ };
9
+ //# sourceMappingURL=breakpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../src/shared/types/breakpoints.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,5 @@
1
+ export type WindowSize = {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ //# sourceMappingURL=window-size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window-size.d.ts","sourceRoot":"","sources":["../../../src/shared/types/window-size.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,4 @@
1
+ import { BreakpointsConfig } from 'src/shared/types/breakpoints';
2
+ import { WindowSize } from 'src/shared/types/window-size';
3
+ export declare function currentBreakpointWidth(windowSize: WindowSize, breakpoints: BreakpointsConfig): number | undefined;
4
+ //# sourceMappingURL=breakpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../src/utils/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,sBAsB5F"}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.currentBreakpointWidth=currentBreakpointWidth;function currentBreakpointWidth(windowSize,breakpoints){var response;return breakpoints.base<=windowSize.width&&(response=breakpoints.base),breakpoints.sm<=windowSize.width&&(response=breakpoints.sm),breakpoints.md<=windowSize.width&&(response=breakpoints.md),breakpoints.lg<=windowSize.width&&(response=breakpoints.lg),breakpoints.xl<=windowSize.width&&(response=breakpoints.xl),breakpoints.xxl<=windowSize.width&&(response=breakpoints.xxl),response}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pedidopago/ui",
3
- "version": "1.13.50",
3
+ "version": "1.13.51",
4
4
  "description": "Quick build beatiful Pedido Pago apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",