@pedidopago/ui 1.3.19 → 1.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,93 +1,93 @@
1
- <h1 align="center">
2
- <img src="https://user-images.githubusercontent.com/75874462/145101826-9244932f-7072-4727-9124-8c26620ad786.png" alt="Logo"/>
3
- <br/>
4
- </h1>
5
-
6
- <div align="center">
7
- <img src="https://img.shields.io/badge/React-v17.0.2-1DD195?style=for-the-badge&logo=react&link=http://google.com" />
8
- <img src="https://img.shields.io/badge/Emotion-v11.3.0-1DD195?style=for-the-badge&logo=styled-components" />
9
- <img src="https://img.shields.io/badge/Storybook-v6.3.7-1DD195?style=for-the-badge&logo=storybook" />
10
- <img src="https://img.shields.io/badge/React Testing Library-v11.1.0-1DD195?style=for-the-badge&logo=testinglibrary" />
11
- <img src="https://img.shields.io/badge/FrameMotion-v4.1.17-1DD195?style=for-the-badge&logo=framer" />
12
- <img src="https://img.shields.io/badge/Typescript-v4.3.5-1DD195?style=for-the-badge&logo=typescript" />
13
- </div>
14
-
15
- <p align="center">
16
- <a href="#iniciar-">Iniciar&nbsp;</a> | &nbsp;
17
- <a href="#estrutura-de-codigo-">Estrutura de codigo&nbsp;</a> | &nbsp;
18
- <a href="#roadmap-">Roadmap&nbsp;</a> | &nbsp;
19
- <a href="#contribuir-">Contribuir&nbsp;</a>
20
- </p>
21
-
22
- ## Iniciar 🚀
23
-
24
- ### Requisitos:
25
- - [Nodejs](https://github.com/nodejs/node)
26
- - [Yarn](https://github.com/yarnpkg/yarn)
27
-
28
- ### Instalação:
29
-
30
- 1. Clone o Repositorio
31
-
32
- ``` bash
33
- git clone git@github.com:pedidopago/pedidopago-ui.git
34
- ```
35
-
36
- 2. Instalar as dependencias:
37
-
38
- ```bash
39
- yarn
40
- ```
41
-
42
- ### Executar o projeto localmente:
43
-
44
- Iniciar o projeto com o storybook:
45
-
46
- ```bash
47
- yarn storybook
48
- ```
49
-
50
- Para executar os testes use o script:
51
-
52
- ```bash
53
- yarn test
54
- ```
55
-
56
- > Para mais detalhes dos scripts considere consultar o package.json na raiz do projeto.
57
-
58
- #### 📌 Ira precisar tambem das variaveis de ambiente `CHROMATIC_PROJECT_TOKEN` e `SKIP_PREFLIGHT_CHECK`.
59
-
60
-
61
- ## Estrutura de codigo
62
-
63
-
64
-
65
- > Ao entrar no projeto sempre entre em `packages/pedidopago-ui` para trabalhar/executar os scripts
66
-
67
- ## Roadmap 🌐
68
-
69
- - [ ] Mudar a estrutura de pastas
70
-
71
- - [ ] Sessão de novos componentes
72
-
73
- - [ ] Atualização de pacotes
74
-
75
- - [ ] Incrementação dos testes
76
-
77
- - [ ] Melhorias na documentação
78
-
79
- - [ ] Adicionar license
80
-
81
- ## Contribuir 💡
82
-
83
- 1. Crie uma branch apartir da **`dev`** com o prefixo **`lib`-[número da issue]-[nome da issue]**.
84
- exemplo:
85
- ```bash
86
- git checkout -b lib-99-buttom
87
- ```
88
- 2. Desenvolver
89
-
90
- 3. Criar a pull request
91
- - Número da issue no inicio da pr.
92
- - Descritivo com pontos importantes do que foi feito.
93
- - Print dos tests no terminal e video de apresentação que pode ser feito via [loom](https://www.loom.com/).
1
+ <h1 align="center">
2
+ <img src="https://user-images.githubusercontent.com/75874462/145101826-9244932f-7072-4727-9124-8c26620ad786.png" alt="Logo"/>
3
+ <br/>
4
+ </h1>
5
+
6
+ <div align="center">
7
+ <img src="https://img.shields.io/badge/React-v17.0.2-1DD195?style=for-the-badge&logo=react&link=http://google.com" />
8
+ <img src="https://img.shields.io/badge/Emotion-v11.3.0-1DD195?style=for-the-badge&logo=styled-components" />
9
+ <img src="https://img.shields.io/badge/Storybook-v6.3.7-1DD195?style=for-the-badge&logo=storybook" />
10
+ <img src="https://img.shields.io/badge/React Testing Library-v11.1.0-1DD195?style=for-the-badge&logo=testinglibrary" />
11
+ <img src="https://img.shields.io/badge/FrameMotion-v4.1.17-1DD195?style=for-the-badge&logo=framer" />
12
+ <img src="https://img.shields.io/badge/Typescript-v4.3.5-1DD195?style=for-the-badge&logo=typescript" />
13
+ </div>
14
+
15
+ <p align="center">
16
+ <a href="#iniciar-">Iniciar&nbsp;</a> | &nbsp;
17
+ <a href="#estrutura-de-codigo-">Estrutura de codigo&nbsp;</a> | &nbsp;
18
+ <a href="#roadmap-">Roadmap&nbsp;</a> | &nbsp;
19
+ <a href="#contribuir-">Contribuir&nbsp;</a>
20
+ </p>
21
+
22
+ ## Iniciar 🚀
23
+
24
+ ### Requisitos:
25
+ - [Nodejs](https://github.com/nodejs/node)
26
+ - [Yarn](https://github.com/yarnpkg/yarn)
27
+
28
+ ### Instalação:
29
+
30
+ 1. Clone o Repositorio
31
+
32
+ ``` bash
33
+ git clone git@github.com:pedidopago/pedidopago-ui.git
34
+ ```
35
+
36
+ 2. Instalar as dependencias:
37
+
38
+ ```bash
39
+ yarn
40
+ ```
41
+
42
+ ### Executar o projeto localmente:
43
+
44
+ Iniciar o projeto com o storybook:
45
+
46
+ ```bash
47
+ yarn storybook
48
+ ```
49
+
50
+ Para executar os testes use o script:
51
+
52
+ ```bash
53
+ yarn test
54
+ ```
55
+
56
+ > Para mais detalhes dos scripts considere consultar o package.json na raiz do projeto.
57
+
58
+ #### 📌 Ira precisar tambem das variaveis de ambiente `CHROMATIC_PROJECT_TOKEN` e `SKIP_PREFLIGHT_CHECK`.
59
+
60
+
61
+ ## Estrutura de codigo
62
+
63
+
64
+
65
+ > Ao entrar no projeto sempre entre em `packages/pedidopago-ui` para trabalhar/executar os scripts
66
+
67
+ ## Roadmap 🌐
68
+
69
+ - [ ] Mudar a estrutura de pastas
70
+
71
+ - [ ] Sessão de novos componentes
72
+
73
+ - [ ] Atualização de pacotes
74
+
75
+ - [ ] Incrementação dos testes
76
+
77
+ - [ ] Melhorias na documentação
78
+
79
+ - [ ] Adicionar license
80
+
81
+ ## Contribuir 💡
82
+
83
+ 1. Crie uma branch apartir da **`dev`** com o prefixo **`lib`-[número da issue]-[nome da issue]**.
84
+ exemplo:
85
+ ```bash
86
+ git checkout -b lib-99-buttom
87
+ ```
88
+ 2. Desenvolver
89
+
90
+ 3. Criar a pull request
91
+ - Número da issue no inicio da pr.
92
+ - Descritivo com pontos importantes do que foi feito.
93
+ - Print dos tests no terminal e video de apresentação que pode ser feito via [loom](https://www.loom.com/).
@@ -93,7 +93,7 @@ function DateInput(_ref) {
93
93
  (0, _react.useEffect)(function () {
94
94
  setCurrentValue(value);
95
95
  }, [value]);
96
- (0, _useDisableBodyScroll.useDisableBodyScroll)(datePickerOpen);
96
+ (0, _useDisableBodyScroll.useDisableBodyScroll)(datePickerOpen, 'child_element');
97
97
 
98
98
  function handleRepositionModal() {
99
99
  var _containerRef$current2;
@@ -1,4 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { ModalProps } from './types';
3
+ export declare const SelectOptionsPagination: {
4
+ label: string;
5
+ value: string;
6
+ }[];
3
7
  export declare function ModalExample(props: ModalProps): JSX.Element;
4
8
  //# sourceMappingURL=ModalExample.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModalExample.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalExample.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,eAoB7C"}
1
+ {"version":3,"file":"ModalExample.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ModalExample.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,uBAAuB;;;GAGnC,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,eA8B7C"}
@@ -4,14 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ModalExample = ModalExample;
7
+ exports.SelectOptionsPagination = void 0;
7
8
 
8
9
  var _react = require("react");
9
10
 
10
11
  var _ = require(".");
11
12
 
13
+ var _Flex = _interopRequireDefault(require("../Flex"));
14
+
12
15
  var _Button = _interopRequireDefault(require("../Button"));
13
16
 
14
- var _Flex = _interopRequireDefault(require("../Flex"));
17
+ var _Select = _interopRequireDefault(require("../Select"));
18
+
19
+ var _Typography = _interopRequireDefault(require("../Typography"));
15
20
 
16
21
  var _jsxRuntime = require("react/jsx-runtime");
17
22
 
@@ -35,6 +40,15 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
35
40
 
36
41
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
42
 
43
+ var SelectOptionsPagination = [{
44
+ label: 'Opcao01',
45
+ value: '1'
46
+ }, {
47
+ label: 'Opcao02',
48
+ value: '2'
49
+ }];
50
+ exports.SelectOptionsPagination = SelectOptionsPagination;
51
+
38
52
  function ModalExample(props) {
39
53
  var _useState = (0, _react.useState)(false),
40
54
  _useState2 = _slicedToArray(_useState, 2),
@@ -53,13 +67,21 @@ function ModalExample(props) {
53
67
  maxWidth: props.maxWidth || '350px',
54
68
  open: props.open || modalOpen,
55
69
  onClose: handleModal,
56
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Flex.default, {
70
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Flex.default, {
71
+ direction: "column",
57
72
  justifyContent: "center",
58
73
  alignItems: "center",
59
74
  style: {
60
- height: '350px'
75
+ height: '350px',
76
+ padding: '1em'
61
77
  },
62
- children: "Eu sou um modal :)"
78
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
79
+ children: ["Eu sou um modal, com um select :", ")"]
80
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, {
81
+ placeholder: "Selecione uma op\xE7\xE3o",
82
+ options: SelectOptionsPagination,
83
+ sizeSelect: "md"
84
+ })]
63
85
  })
64
86
  }))]
65
87
  });
@@ -58,7 +58,7 @@ var Modal = function Modal(_ref) {
58
58
  (0, _useKeyPress.useKeyPress)('Escape', function () {
59
59
  return onClose && onClose();
60
60
  });
61
- (0, _useDisableBodyScroll.useDisableBodyScroll)(open && disableScrollOnOpen);
61
+ (0, _useDisableBodyScroll.useDisableBodyScroll)(open && disableScrollOnOpen, 'modal');
62
62
 
63
63
  function getAnchorTranslate() {
64
64
  var percentageX = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/components/Progress/style.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGpG,eAAO,MAAM,WAAW;;;gIAYvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;kHA2BvB,CAAC;AAEF,eAAO,MAAM,UAAU;;;+HAOtB,CAAC;AAIF,eAAO,MAAM,UAAU;;;;;yGAKtB,CAAC;AAEF,eAAO,MAAM,KAAK;;;kHA0BjB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;+CAGnB,CAAC;AACF,eAAO,MAAM,SAAS;;;gEAWrB,CAAC;AAEF,eAAO,MAAM,eAAe;;;+DAW3B,CAAC"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/components/Progress/style.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGpG,eAAO,MAAM,WAAW;;;gIAYvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;kHA2BvB,CAAC;AAEF,eAAO,MAAM,UAAU;;;+HAOtB,CAAC;AAIF,eAAO,MAAM,UAAU;;;;;yGAKtB,CAAC;AAEF,eAAO,MAAM,KAAK;;;kHA0BjB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;+CAInB,CAAC;AACF,eAAO,MAAM,SAAS;;;gEAWrB,CAAC;AAEF,eAAO,MAAM,eAAe;;;+DAW3B,CAAC"}
@@ -95,7 +95,7 @@ var Value = _styled.default.div(_templateObject5 || (_templateObject5 = _taggedT
95
95
 
96
96
  exports.Value = Value;
97
97
 
98
- var SVGArea = _styled.default.svg(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n"])), function (_ref19) {
98
+ var SVGArea = _styled.default.svg(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n transform: rotate(-90deg);\n"])), function (_ref19) {
99
99
  var size = _ref19.size;
100
100
  return size || 101;
101
101
  }, function (_ref20) {
@@ -76,7 +76,7 @@ var OptionsSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
76
76
  }
77
77
  });
78
78
  });
79
- (0, _useDisableBodyScroll.useDisableBodyScroll)(open && disableScrollOnOpen);
79
+ (0, _useDisableBodyScroll.useDisableBodyScroll)(open && disableScrollOnOpen, 'child_element');
80
80
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.OptionsContainer, {
81
81
  ref: optionsContainerRef,
82
82
  open: open,
@@ -15,12 +15,12 @@ export declare type ISkeletonProps = {
15
15
  * The width of the skeleton
16
16
  * @default '100%'
17
17
  */
18
- width?: number;
18
+ width?: number | string;
19
19
  /**
20
20
  * The height of the skeleton
21
21
  * @default '100%'
22
22
  */
23
- height?: number;
23
+ height?: number | string;
24
24
  /**
25
25
  * The color of the skeleton
26
26
  * @default '#EEEEEE'
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,oBAAY,cAAc,GAAG;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IACxC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,oBAAY,cAAc,GAAG;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IACxC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC"}
@@ -50,7 +50,7 @@ var ToastProvider = function ToastProvider(_ref) {
50
50
  toasts = _useState2[0],
51
51
  setToasts = _useState2[1];
52
52
 
53
- var addToast = function addToast(options) {
53
+ var addToast = (0, _react.useCallback)(function (options) {
54
54
  var toastOptions = {
55
55
  config: _objectSpread(_objectSpread({}, options), {}, {
56
56
  icon: options.icon || 'info',
@@ -62,8 +62,7 @@ var ToastProvider = function ToastProvider(_ref) {
62
62
  id: Math.random().toString(36).substring(2, 9)
63
63
  };
64
64
  setToasts([].concat(_toConsumableArray(toasts), [toastOptions]));
65
- };
66
-
65
+ }, []);
67
66
  var remoteToast = (0, _react.useCallback)(function (id) {
68
67
  setToasts(function (prevState) {
69
68
  var _filterToast$0$config, _filterToast$0$config2;
@@ -3,7 +3,7 @@ import { GenericStyledProps } from './../../@types/index';
3
3
  export declare const StyledText: import("@emotion/styled").StyledComponent<{
4
4
  theme?: import("@emotion/react").Theme | undefined;
5
5
  as?: import("react").ElementType<any> | undefined;
6
- } & GenericStyledProps & import("react").ClassAttributes<HTMLParagraphElement> & import("react").HTMLAttributes<HTMLParagraphElement> & {
6
+ } & GenericStyledProps & import("react").HTMLAttributes<HTMLLabelElement | HTMLParagraphElement> & {
7
7
  variant?: "small" | "caption" | "em" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "label" | "p" | "span" | "strong" | undefined;
8
8
  color?: import("../..").GlobalColorsProps | (string & {}) | undefined;
9
9
  fontSize?: number | "display" | "tiny" | "xxxs" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "xxxl" | "giant" | undefined;
@@ -1,6 +1,6 @@
1
- import { DetailedHTMLProps, HTMLAttributes, ReactNode } from 'react';
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
2
  import { GlobalColorsProps, defaultTheme } from './../../shared/theme';
3
- export declare type TypographyProps = DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement> & {
3
+ export declare type TypographyProps = HTMLAttributes<HTMLParagraphElement | HTMLLabelElement> & {
4
4
  variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'label' | 'caption' | 'small' | 'strong' | 'em';
5
5
  color?: GlobalColorsProps | (string & {});
6
6
  fontSize?: keyof typeof defaultTheme.fontSizes | number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Typography/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEvE,oBAAY,eAAe,GAAG,iBAAiB,CAC7C,cAAc,CAAC,oBAAoB,CAAC,EACpC,oBAAoB,CACrB,GAAG;IACF,OAAO,CAAC,EACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,GAAG,GACH,MAAM,GACN,OAAO,GACP,SAAS,GACT,OAAO,GACP,QAAQ,GACR,IAAI,CAAC;IACT,KAAK,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC,SAAS,GAAG,MAAM,CAAC;IACxD,UAAU,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC,UAAU,CAAC;IAClD,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACpE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC,aAAa,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,CAAC;IAClE,cAAc,CAAC,EAAE,WAAW,GAAG,cAAc,GAAG,MAAM,CAAC;IACvD,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Typography/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEvE,oBAAY,eAAe,GAAG,cAAc,CAAC,oBAAoB,GAAG,gBAAgB,CAAC,GAAG;IACtF,OAAO,CAAC,EACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,GAAG,GACH,MAAM,GACN,OAAO,GACP,SAAS,GACT,OAAO,GACP,QAAQ,GACR,IAAI,CAAC;IACT,KAAK,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC,SAAS,GAAG,MAAM,CAAC;IACxD,UAAU,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC,UAAU,CAAC;IAClD,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACpE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC,aAAa,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,CAAC;IAClE,cAAc,CAAC,EAAE,WAAW,GAAG,cAAc,GAAG,MAAM,CAAC;IACvD,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const useDisableBodyScroll: (disable: boolean) => void;
1
+ export declare const useDisableBodyScroll: (disable: boolean, type?: 'modal' | 'child_element') => void;
2
2
  //# sourceMappingURL=useDisableBodyScroll.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDisableBodyScroll.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useDisableBodyScroll.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,YAAa,OAAO,SAWpD,CAAC"}
1
+ {"version":3,"file":"useDisableBodyScroll.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/useDisableBodyScroll.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,oBAAoB,YACtB,OAAO,SACV,OAAO,GAAG,eAAe,SAwBhC,CAAC"}
@@ -7,15 +7,42 @@ exports.useDisableBodyScroll = void 0;
7
7
 
8
8
  var _react = require("react");
9
9
 
10
+ function disableBodyOverflow() {
11
+ var scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
12
+ document.body.style.paddingRight = "".concat(scrollBarWidth, "px");
13
+ document.body.style.overflow = 'hidden';
14
+ }
15
+
16
+ function enableBodyOverflow() {
17
+ document.body.style.overflow = '';
18
+ document.body.style.paddingRight = '';
19
+ }
20
+
10
21
  var useDisableBodyScroll = function useDisableBodyScroll(disable) {
22
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'child_element';
11
23
  (0, _react.useEffect)(function () {
12
- if (disable) {
13
- var scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
14
- document.body.style.paddingRight = "".concat(scrollBarWidth, "px");
15
- document.body.style.overflow = 'hidden';
16
- } else {
17
- document.body.style.overflow = '';
18
- document.body.style.paddingRight = '';
24
+ // disable body scroll when type modal:
25
+ if (disable && type === 'modal') {
26
+ document.body.setAttribute('data-modal-open', 'true');
27
+ return disableBodyOverflow();
28
+ } // enable body scroll when type modal:
29
+
30
+
31
+ if (!disable && type === 'modal') {
32
+ document.body.setAttribute('data-modal-open', 'false');
33
+ return enableBodyOverflow();
34
+ } // disable body scroll when type child_element:
35
+
36
+
37
+ if (disable && type === 'child_element') {
38
+ if (document.body.getAttribute('data-modal-open') === 'true') return;
39
+ return disableBodyOverflow();
40
+ } // enable body scroll when type child_element:
41
+
42
+
43
+ if (!disable && type === 'child_element') {
44
+ if (document.body.getAttribute('data-modal-open') === 'true') return;
45
+ return enableBodyOverflow();
19
46
  }
20
47
  }, [disable]);
21
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../../../src/shared/theme/contexts/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAuB,MAAM,OAAO,CAAC;AAQtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,aAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,aAAK,kBAAkB,GAAG;IACxB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,YAAY,4CAAyC,CAAC;AAEnE,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,eA8B1F"}
1
+ {"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../../../src/shared/theme/contexts/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAuB,MAAM,OAAO,CAAC;AAQtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,aAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,aAAK,kBAAkB,GAAG;IACxB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,YAAY,4CAAyC,CAAC;AAEnE,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,eAmC1F"}
@@ -51,6 +51,11 @@ function PPUIThemeProvider(_ref) {
51
51
  colorMode = _useState2[0],
52
52
  setColorMode = _useState2[1];
53
53
 
54
+ var _useState3 = (0, _react.useState)(theme || _.defaultTheme),
55
+ _useState4 = _slicedToArray(_useState3, 2),
56
+ currentTheme = _useState4[0],
57
+ setCurrentTheme = _useState4[1];
58
+
54
59
  (0, _react.useEffect)(function () {
55
60
  var localStorageColorMode = _localStorageController.localStorageController.get('UIColorMode');
56
61
 
@@ -58,6 +63,9 @@ function PPUIThemeProvider(_ref) {
58
63
  setColorMode(localStorageColorMode === 'dark');
59
64
  }
60
65
  }, [setColorMode]);
66
+ (0, _react.useEffect)(function () {
67
+ setCurrentTheme(theme || _.defaultTheme);
68
+ }, [theme]);
61
69
 
62
70
  function switchColorMode() {
63
71
  var newColorMode = !colorMode;
@@ -69,12 +77,12 @@ function PPUIThemeProvider(_ref) {
69
77
 
70
78
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeContext.Provider, {
71
79
  value: {
72
- theme: theme || _.defaultTheme,
80
+ theme: currentTheme,
73
81
  colorMode: colorMode,
74
82
  switchColorMode: switchColorMode
75
83
  },
76
84
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.ThemeProvider, {
77
- theme: _objectSpread(_objectSpread({}, theme || _.defaultTheme), {}, {
85
+ theme: _objectSpread(_objectSpread({}, currentTheme), {}, {
78
86
  colorMode: colorMode ? 'dark' : 'light'
79
87
  }),
80
88
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToastProvider.default, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pedidopago/ui",
3
- "version": "1.3.19",
3
+ "version": "1.3.22",
4
4
  "description": "Quick build beatiful Pedido Pago apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",