@onepercentio/one-ui 0.20.1 → 0.20.3
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/.babelrc +1 -0
- package/.prod.babelrc +1 -0
- package/dist/components/HSForms/HSForms.js +2 -4
- package/dist/hooks/useHero.d.ts +2 -2
- package/dist/hooks/useHero.js +14 -5
- package/package.json +1 -1
package/.babelrc
CHANGED
package/.prod.babelrc
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = HSForms;
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
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); }
|
|
9
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
11
|
function HSForms(_ref) {
|
|
@@ -18,9 +18,7 @@ function HSForms(_ref) {
|
|
|
18
18
|
if (window.PRERENDER) return null;
|
|
19
19
|
const container = (0, _react.useRef)(null);
|
|
20
20
|
(0, _react.useEffect)(function () {
|
|
21
|
-
|
|
22
|
-
return _interopRequireWildcard(require(s));
|
|
23
|
-
}).then(function (jqueryModule) {
|
|
21
|
+
import("jquery").then(function (jqueryModule) {
|
|
24
22
|
const funcId = String(Math.round(Math.random() * 999999));
|
|
25
23
|
const idx = "onLoad".concat(funcId);
|
|
26
24
|
const idx2 = "onSubmit".concat(funcId);
|
package/dist/hooks/useHero.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties } from "react";
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
2
|
declare type ShouldSkip = boolean;
|
|
3
3
|
declare type Result = [
|
|
4
4
|
originContainer: Element | VisualViewport,
|
|
@@ -53,7 +53,7 @@ export default function useHero(id: string, options?: Partial<{
|
|
|
53
53
|
*/
|
|
54
54
|
onBeforeTransition?: (origin: HTMLDivElement, target: HTMLDivElement) => Result | Readonly<Result>;
|
|
55
55
|
}): {
|
|
56
|
-
heroRef:
|
|
56
|
+
heroRef: React.RefObject<HTMLDivElement>;
|
|
57
57
|
getHerosOnScreen: () => HTMLDivElement[];
|
|
58
58
|
trigger: () => void;
|
|
59
59
|
};
|
package/dist/hooks/useHero.js
CHANGED
|
@@ -147,11 +147,21 @@ function useHero(id) {
|
|
|
147
147
|
const willMove = setCloneToCoordinatesOf(el);
|
|
148
148
|
if (!willMove) cleanup();else {
|
|
149
149
|
for (let propToTransition of propsToTransition) clone.style[propToTransition] = window.getComputedStyle(el)[propToTransition];
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
let initialOffset;
|
|
151
|
+
const s = function s(_ref3) {
|
|
152
|
+
let target = _ref3.target;
|
|
153
|
+
const d = target;
|
|
154
|
+
if (d.contains(el)) {
|
|
155
|
+
if (initialOffset === undefined) initialOffset = d.scrollTop;else clone.style.marginTop = "".concat(-(d.scrollTop - initialOffset), "px");
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const transitionEndCb = (0, _ownEvent.default)(function (_ref4) {
|
|
159
|
+
let target = _ref4.target,
|
|
160
|
+
currentTarget = _ref4.currentTarget;
|
|
153
161
|
if (target === currentTarget) cleanup();
|
|
162
|
+
document.removeEventListener("scroll", s, true);
|
|
154
163
|
});
|
|
164
|
+
document.addEventListener("scroll", s, true);
|
|
155
165
|
clone.addEventListener("transitionend", transitionEndCb);
|
|
156
166
|
clone.addEventListener("transitionstart", function () {
|
|
157
167
|
const onCancelCb = (0, _ownEvent.default)(function () {
|
|
@@ -211,9 +221,8 @@ const TRANSITION_FACTORY = {
|
|
|
211
221
|
const originX = (vectorY + 1) * 50;
|
|
212
222
|
const rotateX = -(10 * vectorX).toFixed(0);
|
|
213
223
|
const originY = (vectorX + 1) * 50;
|
|
214
|
-
console.log(vectorX, vectorY, originX);
|
|
215
224
|
clone.style.setProperty("--stage-1", "rotateY(".concat(rotateY, "deg) rotateX(").concat(-rotateX, "deg)"));
|
|
216
|
-
clone.style.setProperty("--stage-2", "rotateY(".concat(-rotateY, "deg) rotateX(").concat(rotateX, "deg)"));
|
|
225
|
+
clone.style.setProperty("--stage-2", "rotateY(".concat(-rotateY * 0.3, "deg) rotateX(").concat(rotateX * 0.3, "deg)"));
|
|
217
226
|
clone.style.setProperty("--origin-1", "".concat(originX, "% ").concat(originY, "%"));
|
|
218
227
|
clone.style.setProperty("--origin-2", "".concat(100 - originX, "% ").concat(100 - originY, "%"));
|
|
219
228
|
document.body.style.perspective = "100vw";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onepercentio/one-ui",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.3",
|
|
4
4
|
"description": "A set of reusable components created through the development of Onepercent projects",
|
|
5
5
|
"repository": "git@github.com:onepercentio/one-ui.git",
|
|
6
6
|
"author": "Murilo Oliveira de Araujo <murilo.araujo@onepercent.io>",
|