@pedidopago/ui 1.3.7 → 1.3.8

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/DateInput/components/ModalWrapper/index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,YAAY,8GA+BxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,YAAY,8GAkBxB,CAAC"}
@@ -7,8 +7,6 @@ exports.ModalWrapper = void 0;
7
7
 
8
8
  var _react = require("react");
9
9
 
10
- var _useDisableBodyScroll = require("../../../../shared/hooks/useDisableBodyScroll");
11
-
12
10
  var _styles = require("./styles");
13
11
 
14
12
  var _jsxRuntime = require("react/jsx-runtime");
@@ -21,15 +19,12 @@ var ModalWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
21
19
  top = _ref$top === void 0 ? '' : _ref$top,
22
20
  _ref$offsetX = _ref.offsetX,
23
21
  offsetX = _ref$offsetX === void 0 ? '0px' : _ref$offsetX,
24
- _ref$disableScrollOnO = _ref.disableScrollOnOpen,
25
- disableScrollOnOpen = _ref$disableScrollOnO === void 0 ? true : _ref$disableScrollOnO,
26
22
  maxWidth = _ref.maxWidth,
27
23
  children = _ref.children;
28
24
  var optionsContainerRef = (0, _react.useRef)(null);
29
25
  (0, _react.useImperativeHandle)(ref, function () {
30
26
  return optionsContainerRef.current;
31
27
  });
32
- (0, _useDisableBodyScroll.useDisableBodyScroll)(open && disableScrollOnOpen);
33
28
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ModalWrapperContainer, {
34
29
  ref: optionsContainerRef,
35
30
  open: open,
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/styles.ts"],"names":[],"mappings":";AAIA,UAAU,0BAA0B;IAClC,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAyBjC,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/styles.ts"],"names":[],"mappings":";AAIA,UAAU,0BAA0B;IAClC,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAsBjC,CAAC"}
@@ -27,6 +27,6 @@ var ModalWrapperContainer = (0, _styled.default)(_framerMotion.motion.div)(funct
27
27
  var theme = _ref.theme,
28
28
  props = _objectWithoutProperties(_ref, _excluded);
29
29
 
30
- return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: auto;\n position: fixed;\n left: ", ";\n top: ", ";\n z-index: ", ";\n opacity: ", ";\n pointer-events: ", ";\n transition: opacity ease ", ";\n overflow-y: hidden;\n overflow-x: hidden;\n background: ", ";\n /* border: 2px solid ", "; */\n border-radius: ", ";\n box-shadow: ", ";\n\n li {\n list-style: none;\n }\n "])), props.left, props.top, theme.zIndex.level24, props.open ? 1 : 0, props.open ? 'auto' : 'none', theme.transition.speed, theme.colors.background.light, theme.colors.neutral.neutral1, theme.borderRadius.default, theme.shadow.level3);
30
+ return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: auto;\n position: fixed;\n left: ", ";\n top: ", ";\n z-index: ", ";\n opacity: ", ";\n pointer-events: ", ";\n transition: opacity ease ", ";\n background: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n\n li {\n list-style: none;\n }\n "])), props.left, props.top, theme.zIndex.level24, props.open ? 1 : 0, props.open ? 'auto' : 'none', theme.transition.speed, theme.colors.background.light, theme.borderRadius.default, theme.shadow.level3);
31
31
  });
32
32
  exports.ModalWrapperContainer = ModalWrapperContainer;
@@ -10,7 +10,5 @@ export interface ModalWrapperProps extends HTMLAttributes<HTMLDivElement> {
10
10
  offsetX?: string;
11
11
  /** The max width of the Modal. */
12
12
  maxWidth?: string | number;
13
- /** Optional. Will disable the scroll body scroll. */
14
- disableScrollOnOpen?: boolean;
15
13
  }
16
14
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACvE,mCAAmC;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE3B,qDAAqD;IACrD,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACvE,mCAAmC;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/index.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,WAAW,EACX,KAAK,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,QAAgB,EAChB,GAAG,IAAI,EACR,EAAE,cAAc,eAyFhB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/index.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,WAAW,EACX,KAAK,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,QAAgB,EAChB,GAAG,IAAI,EACR,EAAE,cAAc,eAqFhB"}
@@ -19,6 +19,8 @@ var _DatePicker = _interopRequireDefault(require("../DatePicker"));
19
19
 
20
20
  var _ModalWrapper = require("./components/ModalWrapper");
21
21
 
22
+ var _useDisableBodyScroll = require("../../shared/hooks/useDisableBodyScroll");
23
+
22
24
  var _jsxRuntime = require("react/jsx-runtime");
23
25
 
24
26
  var _excluded = ["label", "placeholder", "alert", "helperText", "value", "locales", "localeOptions", "onChange", "disabled"];
@@ -47,9 +49,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
47
49
 
48
50
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
49
51
 
50
- // TODO: Mudar a posição do datepicker dependendo da posição dele aberto.
51
52
  function DateInput(_ref) {
52
- var _containerRef$current, _optionsModalRef$curr, _containerRef$current3, _containerRef$current4, _containerRef$current5;
53
+ var _containerRef$current, _containerRef$current3, _containerRef$current4, _containerRef$current5;
53
54
 
54
55
  var label = _ref.label,
55
56
  placeholder = _ref.placeholder,
@@ -81,11 +82,6 @@ function DateInput(_ref) {
81
82
  datePickerOpen = _useState6[0],
82
83
  setDatePickerOpen = _useState6[1];
83
84
 
84
- var _useState7 = (0, _react.useState)((_optionsModalRef$curr = optionsModalRef.current) === null || _optionsModalRef$curr === void 0 ? void 0 : _optionsModalRef$curr.getBoundingClientRect().height),
85
- _useState8 = _slicedToArray(_useState7, 2),
86
- heightModal = _useState8[0],
87
- setHeightModal = _useState8[1];
88
-
89
85
  function selectDate(value) {
90
86
  setCurrentValue(value);
91
87
  setDatePickerOpen(false);
@@ -95,12 +91,12 @@ function DateInput(_ref) {
95
91
  (0, _react.useEffect)(function () {
96
92
  setCurrentValue(value);
97
93
  }, [value]);
94
+ (0, _useDisableBodyScroll.useDisableBodyScroll)(datePickerOpen);
98
95
 
99
96
  function handleRepositionModal() {
100
- var _containerRef$current2, _optionsModalRef$curr2;
97
+ var _containerRef$current2;
101
98
 
102
- setPositionContainer((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.getBoundingClientRect().top);
103
- setHeightModal((_optionsModalRef$curr2 = optionsModalRef.current) === null || _optionsModalRef$curr2 === void 0 ? void 0 : _optionsModalRef$curr2.getBoundingClientRect().height);
99
+ setPositionContainer((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.getBoundingClientRect().top); // setHeightModal(optionsModalRef.current?.getBoundingClientRect().height);
104
100
  }
105
101
 
106
102
  var toggleOptionsAreaView = (0, _react.useCallback)(function (event) {
@@ -131,9 +127,9 @@ function DateInput(_ref) {
131
127
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ReactPortal.ReactPortal, {
132
128
  wrapperId: "portal-root",
133
129
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalWrapper.ModalWrapper, {
134
- open: true,
130
+ open: datePickerOpen,
135
131
  left: "".concat((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getBoundingClientRect().left, "px"),
136
- top: Number(positionContainer) < 470 ? "calc(".concat(((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.getBoundingClientRect().bottom) || 0, "px + 10px)") : "calc(".concat(((_containerRef$current5 = containerRef.current) === null || _containerRef$current5 === void 0 ? void 0 : _containerRef$current5.getBoundingClientRect().top) || 0, "px - ").concat(heightModal && heightModal + 10, "px)"),
132
+ top: Number(positionContainer) < 540 ? "calc(".concat(((_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.getBoundingClientRect().bottom) || 0, "px + 10px)") : "calc(".concat(((_containerRef$current5 = containerRef.current) === null || _containerRef$current5 === void 0 ? void 0 : _containerRef$current5.getBoundingClientRect().top) || 0, "px - ", 360, "px)"),
137
133
  ref: optionsModalRef,
138
134
  maxWidth: "auto",
139
135
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.default, _objectSpread({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pedidopago/ui",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "Quick build beatiful Pedido Pago apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",