react-scroll-to-top
Advanced tools
Comparing version 2.0.2 to 2.0.3-beta.0
import React from "react"; | ||
declare type Props = React.HTMLAttributes<HTMLButtonElement> & { | ||
import "./styles.css"; | ||
declare type Props = React.ComponentPropsWithoutRef<"button"> & { | ||
top?: number; | ||
@@ -4,0 +5,0 @@ smooth?: boolean; |
@@ -75,4 +75,3 @@ 'use strict'; | ||
var css_248z = ".styles_scroll-to-top__2A70v {\n background-color: white;\n right: 40px;\n bottom: 40px;\n position: fixed;\n z-index: 2;\n cursor: pointer;\n border-radius: 7px;\n width: 40px;\n height: 40px;\n transition: opacity 1s ease-in-out;\n box-shadow: 0 9px 25px 0 rgba(132, 128, 177, 0.28);\n border: none;\n outline: none;\n}\n\n.styles_scroll-to-top__2A70v:active {\n transform: matrix(0.95, 0, 0, 0.95, 0, 0);\n}\n"; | ||
var styles = {"scroll-to-top":"styles_scroll-to-top__2A70v"}; | ||
var css_248z = ".scroll-to-top {\n background-color: white;\n right: 40px;\n bottom: 40px;\n position: fixed;\n z-index: 2;\n cursor: pointer;\n border-radius: 7px;\n width: 40px;\n height: 40px;\n transition: opacity 1s ease-in-out;\n box-shadow: 0 9px 25px 0 rgba(132, 128, 177, 0.28);\n border: none;\n outline: none;\n}\n\n.scroll-to-top:active {\n transform: matrix(0.95, 0, 0, 0.95, 0, 0);\n}\n.scroll-to-top:focus {\n box-shadow: 0 0 0 1px black;\n}\n"; | ||
styleInject(css_248z); | ||
@@ -93,3 +92,3 @@ | ||
var ScrollToTop = function (_a) { | ||
var _b = _a.top, top = _b === void 0 ? 20 : _b, _c = _a.className, className = _c === void 0 ? styles["scroll-to-top"] : _c, _d = _a.color, color = _d === void 0 ? "black" : _d, _e = _a.smooth, smooth = _e === void 0 ? false : _e, _f = _a.component, component = _f === void 0 ? "" : _f, _g = _a.viewBox, viewBox = _g === void 0 ? "0 0 256 256" : _g, _h = _a.svgPath, svgPath = _h === void 0 ? "M222.138,91.475l-89.6-89.6c-2.5-2.5-6.551-2.5-9.051,0l-89.6,89.6c-2.5,2.5-2.5,6.551,0,9.051s6.744,2.5,9.244,0L122,21.85 V249.6c0,3.535,2.466,6.4,6,6.4s6-2.865,6-6.4V21.85l78.881,78.676c1.25,1.25,2.992,1.875,4.629,1.875s3.326-0.625,4.576-1.875 C224.586,98.025,224.638,93.975,222.138,91.475z" : _h, _j = _a.width, width = _j === void 0 ? "28" : _j, _k = _a.height, height = _k === void 0 ? "28" : _k, props = __rest(_a, ["top", "className", "color", "smooth", "component", "viewBox", "svgPath", "width", "height"]); | ||
var _b = _a.top, top = _b === void 0 ? 20 : _b, _c = _a.className, className = _c === void 0 ? "scroll-to-top" : _c, _d = _a.color, color = _d === void 0 ? "black" : _d, _e = _a.smooth, smooth = _e === void 0 ? false : _e, _f = _a.component, component = _f === void 0 ? "" : _f, _g = _a.viewBox, viewBox = _g === void 0 ? "0 0 256 256" : _g, _h = _a.svgPath, svgPath = _h === void 0 ? "M222.138,91.475l-89.6-89.6c-2.5-2.5-6.551-2.5-9.051,0l-89.6,89.6c-2.5,2.5-2.5,6.551,0,9.051s6.744,2.5,9.244,0L122,21.85 V249.6c0,3.535,2.466,6.4,6,6.4s6-2.865,6-6.4V21.85l78.881,78.676c1.25,1.25,2.992,1.875,4.629,1.875s3.326-0.625,4.576-1.875 C224.586,98.025,224.638,93.975,222.138,91.475z" : _h, _j = _a.width, width = _j === void 0 ? "28" : _j, _k = _a.height, height = _k === void 0 ? "28" : _k, props = __rest(_a, ["top", "className", "color", "smooth", "component", "viewBox", "svgPath", "width", "height"]); | ||
var _l = React.useState(false), visible = _l[0], setVisible = _l[1]; | ||
@@ -104,3 +103,3 @@ var onScroll = function () { | ||
}, []); | ||
return (React__default.createElement(React__default.Fragment, null, visible && (React__default.createElement("button", __assign({ className: className, onClick: function () { return scrollToTop(smooth); } }, props), component || (React__default.createElement("svg", { width: width, height: height, fill: color, viewBox: viewBox }, | ||
return (React__default.createElement(React__default.Fragment, null, visible && (React__default.createElement("button", __assign({ className: className, onClick: function () { return scrollToTop(smooth); }, "aria-label": "Scroll to top" }, props), component || (React__default.createElement("svg", { width: width, height: height, fill: color, viewBox: viewBox }, | ||
React__default.createElement("path", { d: svgPath }))))))); | ||
@@ -107,0 +106,0 @@ }; |
{ | ||
"name": "react-scroll-to-top", | ||
"author": "Herman Nygaard", | ||
"version": "2.0.2", | ||
"version": "2.0.3-beta.0", | ||
"main": "dist/index.js", | ||
@@ -12,3 +12,7 @@ "types": "dist/index.d.ts", | ||
"lint:fix": "npm run lint -- --fix", | ||
"prettier:check": "prettier --check src" | ||
"prettier:check": "prettier --check src", | ||
"playwright": "playwright test", | ||
"start-example": "cd examples && npm i && npm run dev", | ||
"e2e": "start-server-and-test start-example http://localhost:5173 playwright", | ||
"release": "npm run build && npm publish" | ||
}, | ||
@@ -35,2 +39,3 @@ "files": [ | ||
"@babel/core": "^7.10.4", | ||
"@playwright/test": "^1.24.0", | ||
"@types/react": "^16.9.34", | ||
@@ -59,2 +64,3 @@ "@types/react-dom": "^16.9.7", | ||
"rollup-plugin-typescript2": "^0.27.1", | ||
"start-server-and-test": "^1.14.0", | ||
"tslib": "^2.0.0", | ||
@@ -61,0 +67,0 @@ "typescript": "^3.7.5" |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
16370
28
108
2