material-motion-views-react
Version:
React support for Material Motion
41 lines • 1.98 kB
JavaScript
;
/** @license
* Copyright 2016 - present The Material Motion Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const React = require("react");
const material_motion_views_dom_1 = require("material-motion-views-dom");
/**
* Applies translate, rotate, and scale in the order specified by the CSS
* Transforms 2 spec. Passes through other props to inline style - similar to
* jsxstyle, but without the stylesheet hoisting.
*
* https://drafts.csswg.org/css-transforms-2/
*/
function TransformTarget(_a) {
var { translate = {
x: 0,
y: 0,
}, origin = {
x: 0,
y: 0,
}, rotate = 0, scale = 1, opacity = 1, className = '', domRef, position = 'static', touchAction, children, style = {} } = _a, propsPassthrough = tslib_1.__rest(_a, ["translate", "origin", "rotate", "scale", "opacity", "className", "domRef", "position", "touchAction", "children", "style"]);
return (React.createElement("div", { className: className, ref: domRef, style: Object.assign({}, propsPassthrough, { transform: material_motion_views_dom_1.buildTransformString({ translate, rotate, scale }), transformOrigin: `${origin.x}px ${origin.y}px`, opacity,
position,
touchAction }, style) }, children));
}
exports.default = TransformTarget;
//# sourceMappingURL=TransformTarget.js.map