@manuscripts/style-guide 2.0.28-LEAN-4186.1 → 2.0.28-LEAN-4186.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.
@@ -4,13 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Tooltip = void 0;
7
+ const react_1 = __importDefault(require("react"));
7
8
  const react_tooltip_1 = require("react-tooltip");
8
9
  const styled_components_1 = __importDefault(require("styled-components"));
9
- exports.Tooltip = (0, styled_components_1.default)(react_tooltip_1.Tooltip).attrs({
10
- positionStrategy: 'fixed',
11
- offset: 10,
12
- }) `
13
- &.react-tooltip {
10
+ const StyledTooltipWrapper = styled_components_1.default.div `
11
+ & .react-tooltip {
14
12
  z-index: 1000;
15
13
  font-size: 12px;
16
14
  line-height: 16px;
@@ -29,3 +27,16 @@ exports.Tooltip = (0, styled_components_1.default)(react_tooltip_1.Tooltip).attr
29
27
  }
30
28
  }
31
29
  `;
30
+ const defaultOpenEvents = ['click', 'mouseenter'];
31
+ const Tooltip = (props) => (react_1.default.createElement(StyledTooltipWrapper, null,
32
+ react_1.default.createElement(react_tooltip_1.Tooltip, Object.assign({ positionStrategy: "fixed", offset: 10, openEvents: {
33
+ mouseenter: true,
34
+ mouseover: true,
35
+ click: false,
36
+ }, closeEvents: {
37
+ mouseleave: true,
38
+ mouseout: true,
39
+ blur: true,
40
+ click: false,
41
+ } }, props))));
42
+ exports.Tooltip = Tooltip;
@@ -28,17 +28,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const react_1 = __importDefault(require("react"));
30
30
  const styled_components_1 = __importStar(require("styled-components"));
31
+ const fadeIn = (0, styled_components_1.keyframes) `
32
+ 0% {
33
+ opacity: 0;
34
+ transform: scale(0.8);
35
+ }
36
+ 100% {
37
+ opacity: 1;
38
+ transform: scale(1);
39
+ }
40
+ `;
41
+ const fadeOut = (0, styled_components_1.keyframes) `
42
+ 0% {
43
+ opacity: 1;
44
+ transform: scale(1);
45
+ }
46
+ 100% {
47
+ opacity: 0;
48
+ transform: scale(0.8);
49
+ }
50
+ `;
31
51
  const fillCircle = (0, styled_components_1.keyframes) `
32
52
  from {
33
- stroke-dashoffset: 283; /* Full circumference */
53
+ stroke-dashoffset: 283;
34
54
  }
35
55
  to {
36
56
  stroke-dashoffset: 0;
37
57
  }
38
58
  `;
39
- const Svg = styled_components_1.default.svg `
40
- position: absolute;
41
- `;
42
59
  const drawTick = (0, styled_components_1.keyframes) `
43
60
  from {
44
61
  stroke-dasharray: 0 100;
@@ -49,29 +66,46 @@ const drawTick = (0, styled_components_1.keyframes) `
49
66
  opacity: 1;
50
67
  }
51
68
  `;
69
+ const Svg = styled_components_1.default.svg `
70
+ position: absolute;
71
+ opacity: 0;
72
+ animation: ${fadeIn} 0.3s ease-out forwards;
73
+
74
+ // Start fading out at 2.7s (300ms before the 3s unmount)
75
+ @keyframes autoFadeOut {
76
+ 0%,
77
+ 90% {
78
+ opacity: 1;
79
+ transform: scale(1);
80
+ }
81
+ 100% {
82
+ opacity: 0;
83
+ transform: scale(0.8);
84
+ }
85
+ }
86
+ animation: ${fadeIn} 0.3s ease-out forwards,
87
+ autoFadeOut 3s ease-in-out forwards;
88
+ `;
52
89
  const Circle = styled_components_1.default.circle `
53
90
  stroke-dasharray: 283;
54
- stroke-dashoffset: 283;
55
- animation: ${fillCircle} 2s linear forwards;
56
- stroke: ${(props) => props.color || '#4CAF50'};
91
+ stroke: #4caf50;
57
92
  fill: none;
58
93
  transform-origin: center;
59
94
  transform: rotate(-90deg);
95
+ animation: ${fillCircle} 2s linear forwards;
60
96
  `;
61
97
  const Tick = styled_components_1.default.polyline `
62
- stroke-dasharray: 100;
63
- stroke-dashoffset: 100;
64
- animation: ${drawTick} 1s ease-in-out 2s forwards;
65
- stroke: ${(props) => props.color || '#4CAF50'};
98
+ animation: ${drawTick} 1s ease-in-out 1s forwards;
99
+ stroke: #4caf50;
66
100
  fill: none;
67
101
  stroke-width: 5;
68
102
  stroke-linecap: round;
69
103
  stroke-linejoin: round;
70
104
  opacity: 0;
71
105
  `;
72
- const CircleTickAnimation = ({ color, size, }) => {
106
+ const CircleTickAnimation = ({ size }) => {
73
107
  return (react_1.default.createElement(Svg, { width: size, height: size, viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg" },
74
- react_1.default.createElement(Circle, { cx: "50", cy: "50", r: "45", strokeWidth: "5", color: color }),
75
- react_1.default.createElement(Tick, { points: "30,50 45,65 70,40", color: color })));
108
+ react_1.default.createElement(Circle, { cx: "50", cy: "50", r: "45", strokeWidth: "5" }),
109
+ react_1.default.createElement(Tick, { points: "30,50 45,65 70,40" })));
76
110
  };
77
111
  exports.default = CircleTickAnimation;
@@ -1,10 +1,8 @@
1
+ import React from 'react';
1
2
  import { Tooltip as ReactTooltip } from 'react-tooltip';
2
3
  import styled from 'styled-components';
3
- export const Tooltip = styled(ReactTooltip).attrs({
4
- positionStrategy: 'fixed',
5
- offset: 10,
6
- }) `
7
- &.react-tooltip {
4
+ const StyledTooltipWrapper = styled.div `
5
+ & .react-tooltip {
8
6
  z-index: 1000;
9
7
  font-size: 12px;
10
8
  line-height: 16px;
@@ -23,3 +21,15 @@ export const Tooltip = styled(ReactTooltip).attrs({
23
21
  }
24
22
  }
25
23
  `;
24
+ const defaultOpenEvents = ['click', 'mouseenter'];
25
+ export const Tooltip = (props) => (React.createElement(StyledTooltipWrapper, null,
26
+ React.createElement(ReactTooltip, Object.assign({ positionStrategy: "fixed", offset: 10, openEvents: {
27
+ mouseenter: true,
28
+ mouseover: true,
29
+ click: false,
30
+ }, closeEvents: {
31
+ mouseleave: true,
32
+ mouseout: true,
33
+ blur: true,
34
+ click: false,
35
+ } }, props))));
@@ -1,16 +1,33 @@
1
1
  import React from 'react';
2
2
  import styled, { keyframes } from 'styled-components';
3
+ const fadeIn = keyframes `
4
+ 0% {
5
+ opacity: 0;
6
+ transform: scale(0.8);
7
+ }
8
+ 100% {
9
+ opacity: 1;
10
+ transform: scale(1);
11
+ }
12
+ `;
13
+ const fadeOut = keyframes `
14
+ 0% {
15
+ opacity: 1;
16
+ transform: scale(1);
17
+ }
18
+ 100% {
19
+ opacity: 0;
20
+ transform: scale(0.8);
21
+ }
22
+ `;
3
23
  const fillCircle = keyframes `
4
24
  from {
5
- stroke-dashoffset: 283; /* Full circumference */
25
+ stroke-dashoffset: 283;
6
26
  }
7
27
  to {
8
28
  stroke-dashoffset: 0;
9
29
  }
10
30
  `;
11
- const Svg = styled.svg `
12
- position: absolute;
13
- `;
14
31
  const drawTick = keyframes `
15
32
  from {
16
33
  stroke-dasharray: 0 100;
@@ -21,29 +38,46 @@ const drawTick = keyframes `
21
38
  opacity: 1;
22
39
  }
23
40
  `;
41
+ const Svg = styled.svg `
42
+ position: absolute;
43
+ opacity: 0;
44
+ animation: ${fadeIn} 0.3s ease-out forwards;
45
+
46
+ // Start fading out at 2.7s (300ms before the 3s unmount)
47
+ @keyframes autoFadeOut {
48
+ 0%,
49
+ 90% {
50
+ opacity: 1;
51
+ transform: scale(1);
52
+ }
53
+ 100% {
54
+ opacity: 0;
55
+ transform: scale(0.8);
56
+ }
57
+ }
58
+ animation: ${fadeIn} 0.3s ease-out forwards,
59
+ autoFadeOut 3s ease-in-out forwards;
60
+ `;
24
61
  const Circle = styled.circle `
25
62
  stroke-dasharray: 283;
26
- stroke-dashoffset: 283;
27
- animation: ${fillCircle} 2s linear forwards;
28
- stroke: ${(props) => props.color || '#4CAF50'};
63
+ stroke: #4caf50;
29
64
  fill: none;
30
65
  transform-origin: center;
31
66
  transform: rotate(-90deg);
67
+ animation: ${fillCircle} 2s linear forwards;
32
68
  `;
33
69
  const Tick = styled.polyline `
34
- stroke-dasharray: 100;
35
- stroke-dashoffset: 100;
36
- animation: ${drawTick} 1s ease-in-out 2s forwards;
37
- stroke: ${(props) => props.color || '#4CAF50'};
70
+ animation: ${drawTick} 1s ease-in-out 1s forwards;
71
+ stroke: #4caf50;
38
72
  fill: none;
39
73
  stroke-width: 5;
40
74
  stroke-linecap: round;
41
75
  stroke-linejoin: round;
42
76
  opacity: 0;
43
77
  `;
44
- const CircleTickAnimation = ({ color, size, }) => {
78
+ const CircleTickAnimation = ({ size }) => {
45
79
  return (React.createElement(Svg, { width: size, height: size, viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg" },
46
- React.createElement(Circle, { cx: "50", cy: "50", r: "45", strokeWidth: "5", color: color }),
47
- React.createElement(Tick, { points: "30,50 45,65 70,40", color: color })));
80
+ React.createElement(Circle, { cx: "50", cy: "50", r: "45", strokeWidth: "5" }),
81
+ React.createElement(Tick, { points: "30,50 45,65 70,40" })));
48
82
  };
49
83
  export default CircleTickAnimation;
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- export declare const Tooltip: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("react-tooltip").ITooltip & import("react").RefAttributes<import("react-tooltip").TooltipRefProps>>, import("styled-components").DefaultTheme, {
3
- positionStrategy: "fixed";
4
- offset: 10;
5
- }, "offset" | "positionStrategy">;
1
+ import React from 'react';
2
+ import { Tooltip as ReactTooltip } from 'react-tooltip';
3
+ export declare const Tooltip: (props: React.ComponentProps<typeof ReactTooltip>) => React.JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  interface CircleTickAnimationProps {
3
3
  size: number;
4
- color?: string;
5
4
  }
6
5
  declare const CircleTickAnimation: React.FC<CircleTickAnimationProps>;
7
6
  export default CircleTickAnimation;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/style-guide",
3
3
  "description": "Shared components for Manuscripts applications",
4
- "version": "2.0.28-LEAN-4186.1",
4
+ "version": "2.0.28-LEAN-4186.3",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -54,7 +54,7 @@
54
54
  "react-router-dom": "^5.3.4",
55
55
  "react-select": "^5.7.3",
56
56
  "react-sizeme": "^3.0.2",
57
- "react-tooltip": "^5.26.0",
57
+ "react-tooltip": "^5.28.0",
58
58
  "styled-components": "^5.2.0"
59
59
  },
60
60
  "devDependencies": {