@onepercentio/one-ui 0.19.3 → 0.19.4
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/dist/components/CheckBox/CheckBox.module.scss +2 -0
- package/dist/components/PingPongText/PingPongText.d.ts +6 -0
- package/dist/components/PingPongText/PingPongText.js +69 -0
- package/dist/components/PingPongText/PingPongText.module.scss +4 -0
- package/dist/components/PingPongText/index.d.ts +1 -0
- package/dist/components/PingPongText/index.js +13 -0
- package/dist/components/ProgressBar/ProgressBar.js +1 -1
- package/dist/components/ProgressBar/ProgressBar.module.scss +4 -0
- package/dist/components/Radio/Radio.module.scss +3 -2
- package/package.json +2 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import Text from "../Text/Text";
|
|
3
|
+
/**
|
|
4
|
+
* A component that keeps an overflow piece of text visible by continously scrolling it back and forward
|
|
5
|
+
**/
|
|
6
|
+
export default function PingPongText({ ...props }: ComponentProps<typeof Text>): JSX.Element;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = PingPongText;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _Text = _interopRequireDefault(require("../Text/Text"));
|
|
10
|
+
var _PingPongTextModule = _interopRequireDefault(require("./PingPongText.module.scss"));
|
|
11
|
+
var _useMouseHover2 = _interopRequireDefault(require("../../hooks/ui/useMouseHover"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
const HOW_MUCH_PIXELS_TO_SCROLL_PER_SECOND = 50;
|
|
17
|
+
const RIGHT_TEXT_MULTIPLIER = 5;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A component that keeps an overflow piece of text visible by continously scrolling it back and forward
|
|
21
|
+
**/
|
|
22
|
+
function PingPongText(_ref) {
|
|
23
|
+
let props = _extends({}, _ref);
|
|
24
|
+
const textRef = (0, _react.useRef)(null);
|
|
25
|
+
const _useMouseHover = (0, _useMouseHover2.default)(),
|
|
26
|
+
uiEvents = _useMouseHover.uiEvents,
|
|
27
|
+
hovering = _useMouseHover.hovering;
|
|
28
|
+
(0, _react.useEffect)(function () {
|
|
29
|
+
if (!hovering) {
|
|
30
|
+
let scrollingInterval;
|
|
31
|
+
let scrollStartTimeout;
|
|
32
|
+
scrollStartTimeout = setTimeout(function () {
|
|
33
|
+
const textEl = textRef.current;
|
|
34
|
+
const overflowWidth = textEl.scrollWidth;
|
|
35
|
+
const viewWidth = textEl.clientWidth;
|
|
36
|
+
const secondsPerFrame = 1000 / 60;
|
|
37
|
+
const howMuchToMove = secondsPerFrame * HOW_MUCH_PIXELS_TO_SCROLL_PER_SECOND / 1000;
|
|
38
|
+
if (overflowWidth > viewWidth) {
|
|
39
|
+
let scrollText = function scrollText() {
|
|
40
|
+
let direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "r";
|
|
41
|
+
return setInterval(function () {
|
|
42
|
+
const reachedEnd = direction === "r" ? textEl.scrollLeft >= overflowWidth - viewWidth : textEl.scrollLeft === 0;
|
|
43
|
+
if (reachedEnd) {
|
|
44
|
+
clearInterval(scrollingInterval);
|
|
45
|
+
scrollStartTimeout = setTimeout(function () {
|
|
46
|
+
scrollingInterval = scrollText(direction === "r" ? "l" : "r");
|
|
47
|
+
}, direction === "r" ? 2000 : 1000);
|
|
48
|
+
} else {
|
|
49
|
+
if (direction === "r") textEl.scrollTo(textEl.scrollLeft + howMuchToMove, 0);else {
|
|
50
|
+
textEl.scrollTo(textEl.scrollLeft - howMuchToMove * RIGHT_TEXT_MULTIPLIER, 0);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, secondsPerFrame);
|
|
54
|
+
};
|
|
55
|
+
scrollingInterval = scrollText();
|
|
56
|
+
}
|
|
57
|
+
}, 1000);
|
|
58
|
+
return function () {
|
|
59
|
+
clearTimeout(scrollStartTimeout);
|
|
60
|
+
clearInterval(scrollingInterval);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}, [hovering]);
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement(_Text.default, _extends({
|
|
65
|
+
ref: textRef
|
|
66
|
+
}, uiEvents, props, {
|
|
67
|
+
className: "".concat(_PingPongTextModule.default.pingPong, " ").concat(props.className || "")
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PingPongText';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _PingPongText.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _PingPongText = _interopRequireDefault(require("./PingPongText"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -20,7 +20,7 @@ function ProgressBar(_ref) {
|
|
|
20
20
|
_ref$style = _ref.style,
|
|
21
21
|
style = _ref$style === void 0 ? "guide" : _ref$style;
|
|
22
22
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
23
|
-
className: "".concat(_ProgressBarModule.default.container, " ").concat(_ProgressBarModule.default[style]),
|
|
23
|
+
className: "".concat(_ProgressBarModule.default.container, " ").concat(_ProgressBarModule.default[style], " ").concat(progress === 100 ? _ProgressBarModule.default.completed : ""),
|
|
24
24
|
style: {
|
|
25
25
|
fontSize: size
|
|
26
26
|
}
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
background: var(--progress-bar-bar, var(--digital-blue));
|
|
25
25
|
transition: width var(--animation-speed-transition, $fast) ease-out;
|
|
26
26
|
}
|
|
27
|
+
&.completed > :first-child {
|
|
28
|
+
border-top-right-radius: math.div(0.25em, 2);
|
|
29
|
+
border-bottom-right-radius: math.div(0.25em, 2);
|
|
30
|
+
}
|
|
27
31
|
&.guide > :last-child {
|
|
28
32
|
position: absolute;
|
|
29
33
|
margin-top: math.div(-0.5em, 1.25);
|
|
@@ -15,14 +15,15 @@
|
|
|
15
15
|
visibility: visible;
|
|
16
16
|
width: 1.5em;
|
|
17
17
|
height: 1.5em;
|
|
18
|
-
border-radius: 0.
|
|
18
|
+
border-radius: 0.8em;
|
|
19
19
|
background-image: url("../../assets/img/svg/checkbox.svg");
|
|
20
20
|
background-color: transparent;
|
|
21
21
|
transition: background-color 250ms, border 250ms, box-shadow 250ms;
|
|
22
22
|
border: 1px solid rgb(40, 43, 53);
|
|
23
23
|
box-shadow: 0px 0px 0px -4px $digitalBlue;
|
|
24
|
+
flex-shrink: 0;
|
|
24
25
|
&.wContent {
|
|
25
|
-
margin-right: 0.
|
|
26
|
+
margin-right: 0.8em;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
> span:first-child.checked {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onepercentio/one-ui",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.4",
|
|
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>",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"cpy-cli": "^3.1.1",
|
|
43
43
|
"crypto-browserify": "^3.12.0",
|
|
44
44
|
"css-loader": "^5",
|
|
45
|
-
"cypress": "^12.
|
|
45
|
+
"cypress": "^12.17.2",
|
|
46
46
|
"firebase": "^9.8.1",
|
|
47
47
|
"firebase-admin": "^10.2.0",
|
|
48
48
|
"https-browserify": "^1.0.0",
|