@widergy/energy-ui 3.77.0 → 3.78.0
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/CHANGELOG.md +7 -0
- package/dist/components/UTDocumentWizard/README.md +10 -13
- package/dist/components/UTDocumentWizard/components/PageWizard/constants.js +11 -0
- package/dist/components/UTDocumentWizard/components/PageWizard/index.js +33 -9
- package/dist/components/UTDocumentWizard/components/PageWizard/styles.module.scss +7 -0
- package/dist/components/UTDocumentWizard/components/PageWizard/utils.js +43 -28
- package/dist/components/UTDocumentWizard/components/SectionDetails/index.js +1 -0
- package/dist/components/UTDocumentWizard/components/SectionDetails/styles.module.scss +0 -4
- package/dist/components/UTDocumentWizard/components/Sheet/index.js +1 -2
- package/dist/components/UTDocumentWizard/components/Sheet/styles.module.scss +1 -5
- package/dist/components/UTDocumentWizard/index.js +19 -14
- package/dist/components/UTDocumentWizard/styles.module.scss +11 -21
- package/dist/utils/colorUtils.js +19 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [3.78.0](https://github.com/widergy/energy-ui/compare/v3.77.0...v3.78.0) (2025-05-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [CX-651] document wizard visual fixes ([#615](https://github.com/widergy/energy-ui/issues/615)) ([5fed4ed](https://github.com/widergy/energy-ui/commit/5fed4ed3ac2daf05eab8ae602af7c60b1a452bd9))
|
|
7
|
+
|
|
1
8
|
# [3.77.0](https://github.com/widergy/energy-ui/compare/v3.76.0...v3.77.0) (2025-05-14)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -4,11 +4,14 @@ A component that provides an interactive document viewer with navigable sections
|
|
|
4
4
|
|
|
5
5
|
## Props
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
7
|
+
|
|
8
|
+
| Name | Type | Default | Description |
|
|
9
|
+
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
10
|
+
| classNames | objectOf(string) | | Additional class names to apply for further styling. |
|
|
11
|
+
| pages | array | [] | Array of page objects that define the document pages to be displayed. |
|
|
12
|
+
| scaleConfig | shapeOf({<br />extraSpacingLeft: number, extraSpacingRight: number, extraSpacingTop: number, extraSpacingBottom: number,<br /> scale: number}) | {} | Object defining rendering scale and padding parameters: includes a numeric `scale` factor and optional `extraSpacingLeft`, `extraSpacingRight`, `extraSpacingTop` and `extraSpacingBottom` values to adjust the zoom level and margins around the content. |
|
|
13
|
+
| sections | array | [] | Array of section objects that define the interactive areas within each page. |
|
|
14
|
+
| labels | object | {} | Object containing text labels for UI elements. |
|
|
12
15
|
|
|
13
16
|
### pages
|
|
14
17
|
|
|
@@ -91,13 +94,7 @@ const translations = {
|
|
|
91
94
|
}
|
|
92
95
|
};
|
|
93
96
|
|
|
94
|
-
const MyComponent = () =>
|
|
95
|
-
<UTDocumentWizard
|
|
96
|
-
pages={pages}
|
|
97
|
-
sections={sections}
|
|
98
|
-
labels={labels}
|
|
99
|
-
/>
|
|
100
|
-
);
|
|
97
|
+
const MyComponent = () => <UTDocumentWizard pages={pages} sections={sections} labels={labels} />;
|
|
101
98
|
```
|
|
102
99
|
|
|
103
100
|
## Features
|
|
@@ -106,4 +103,4 @@ const MyComponent = () => (
|
|
|
106
103
|
- Mobile-responsive design
|
|
107
104
|
- Clickable sections with detailed information panels
|
|
108
105
|
- Support for multiple pages
|
|
109
|
-
- Customizable text labels
|
|
106
|
+
- Customizable text labels
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DEFAULT_SPACING_TOP = exports.DEFAULT_SPACING_RIGHT = exports.DEFAULT_SPACING_LEFT = exports.DEFAULT_SPACING_BOTTOM = exports.DEFAULT_SCALE = void 0;
|
|
7
|
+
const DEFAULT_SCALE = exports.DEFAULT_SCALE = 1;
|
|
8
|
+
const DEFAULT_SPACING_BOTTOM = exports.DEFAULT_SPACING_BOTTOM = 0;
|
|
9
|
+
const DEFAULT_SPACING_LEFT = exports.DEFAULT_SPACING_LEFT = 0;
|
|
10
|
+
const DEFAULT_SPACING_RIGHT = exports.DEFAULT_SPACING_RIGHT = 36;
|
|
11
|
+
const DEFAULT_SPACING_TOP = exports.DEFAULT_SPACING_TOP = 48;
|
|
@@ -7,18 +7,27 @@ exports.default = void 0;
|
|
|
7
7
|
var _propTypes = require("prop-types");
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _utils = require("./utils");
|
|
10
|
+
var _constants = require("./constants");
|
|
10
11
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
14
|
const PageWizard = _ref => {
|
|
14
15
|
let {
|
|
15
16
|
canvasRef,
|
|
17
|
+
classNames,
|
|
16
18
|
clickedSection,
|
|
17
19
|
isChangingTab,
|
|
18
20
|
isMobileSize,
|
|
19
21
|
isSheetOpen,
|
|
20
22
|
onSectionChange,
|
|
21
23
|
page,
|
|
24
|
+
scaleConfig = {
|
|
25
|
+
extraSpacingLeft: _constants.DEFAULT_SPACING_LEFT,
|
|
26
|
+
extraSpacingRight: _constants.DEFAULT_SPACING_RIGHT,
|
|
27
|
+
extraSpacingTop: _constants.DEFAULT_SPACING_TOP,
|
|
28
|
+
extraSpacingBottom: _constants.DEFAULT_SPACING_BOTTOM,
|
|
29
|
+
scale: _constants.DEFAULT_SCALE
|
|
30
|
+
},
|
|
22
31
|
sectionSelected,
|
|
23
32
|
sections
|
|
24
33
|
} = _ref;
|
|
@@ -26,6 +35,13 @@ const PageWizard = _ref => {
|
|
|
26
35
|
const sectionsCoord = {};
|
|
27
36
|
const animations = (0, _react.useRef)({});
|
|
28
37
|
const isPointer = false;
|
|
38
|
+
const {
|
|
39
|
+
extraSpacingLeft,
|
|
40
|
+
extraSpacingRight,
|
|
41
|
+
extraSpacingTop,
|
|
42
|
+
extraSpacingBottom,
|
|
43
|
+
scale
|
|
44
|
+
} = scaleConfig;
|
|
29
45
|
const onClick = e => (0, _utils.handleCanvasClick)(e, canvasRef, onSectionChange, sectionsBadgeCoord, sectionsCoord);
|
|
30
46
|
const onMouseMove = e => (0, _utils.handleMouseMove)(e, canvasRef, sectionsBadgeCoord, sectionsCoord, isPointer);
|
|
31
47
|
(0, _react.useEffect)(() => {
|
|
@@ -35,14 +51,20 @@ const PageWizard = _ref => {
|
|
|
35
51
|
const image = new Image();
|
|
36
52
|
image.src = page.image;
|
|
37
53
|
image.onload = () => {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
const dpi = window.devicePixelRatio || 1;
|
|
55
|
+
const userScale = scale;
|
|
56
|
+
const padLeft = extraSpacingLeft;
|
|
57
|
+
const padRight = extraSpacingRight;
|
|
58
|
+
const padTop = extraSpacingTop;
|
|
59
|
+
const padBottom = extraSpacingBottom;
|
|
60
|
+
canvas.width = (image.width + padLeft + padRight) * dpi;
|
|
61
|
+
canvas.height = (image.height + padTop + padBottom) * dpi;
|
|
62
|
+
canvas.style.width = "".concat((image.width + padLeft + padRight) * userScale, "px");
|
|
63
|
+
canvas.style.height = "".concat((image.height + padTop + padBottom) * userScale, "px");
|
|
64
|
+
ctx.setTransform(dpi, 0, 0, dpi, padLeft, padTop);
|
|
65
|
+
ctx.clearRect(-padLeft, -padTop, canvas.width, canvas.height);
|
|
66
|
+
ctx.drawImage(image, 0, 0);
|
|
67
|
+
sections.forEach(section => (0, _utils.drawSection)(ctx, image, section, page, clickedSection, sectionsCoord, sectionsBadgeCoord, sectionSelected, animations, isSheetOpen, isMobileSize));
|
|
46
68
|
};
|
|
47
69
|
}, [page.image, sections, clickedSection, animations.current, isPointer, isSheetOpen]);
|
|
48
70
|
(0, _react.useEffect)(() => {
|
|
@@ -51,18 +73,20 @@ const PageWizard = _ref => {
|
|
|
51
73
|
return /*#__PURE__*/_react.default.createElement("canvas", {
|
|
52
74
|
ref: canvasRef,
|
|
53
75
|
tabIndex: "0",
|
|
54
|
-
className: "".concat(_stylesModule.default.container, " ").concat(isChangingTab ? _stylesModule.default.displayNone : _stylesModule.default.displayFlex),
|
|
76
|
+
className: "".concat(_stylesModule.default.container, " ").concat(classNames === null || classNames === void 0 ? void 0 : classNames.canvasContainer, " ").concat(isChangingTab ? _stylesModule.default.displayNone : _stylesModule.default.displayFlex),
|
|
55
77
|
onClick: onClick,
|
|
56
78
|
onMouseMove: onMouseMove
|
|
57
79
|
});
|
|
58
80
|
};
|
|
59
81
|
PageWizard.propTypes = {
|
|
60
82
|
canvasRef: _propTypes.object,
|
|
83
|
+
classNames: _propTypes.object,
|
|
61
84
|
clickedSection: _propTypes.string,
|
|
62
85
|
isChangingTab: _propTypes.bool,
|
|
63
86
|
isMobileSize: _propTypes.bool,
|
|
64
87
|
isSheetOpen: _propTypes.bool,
|
|
65
88
|
page: _propTypes.object,
|
|
89
|
+
scaleConfig: _propTypes.object,
|
|
66
90
|
sectionSelected: _propTypes.object,
|
|
67
91
|
sections: (0, _propTypes.arrayOf)({}),
|
|
68
92
|
onSectionChange: _propTypes.func
|
|
@@ -5,9 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.handleMouseMove = exports.handleCanvasClick = exports.drawSection = void 0;
|
|
7
7
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
8
|
+
var _colorUtils = require("../../../../utils/colorUtils");
|
|
8
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
const drawRoundedStrokeRect = (ctx, x, y, width, height, radius) => {
|
|
10
|
-
ctx.
|
|
11
|
+
ctx.save();
|
|
12
|
+
ctx.globalAlpha = 0.1;
|
|
13
|
+
ctx.fillStyle = (0, _colorUtils.getColorValue)('--identitySolidTone3', 'rgba(37, 224, 166, 1)');
|
|
11
14
|
ctx.beginPath();
|
|
12
15
|
ctx.moveTo(x + radius, y);
|
|
13
16
|
ctx.lineTo(x + width - radius, y);
|
|
@@ -20,12 +23,13 @@ const drawRoundedStrokeRect = (ctx, x, y, width, height, radius) => {
|
|
|
20
23
|
ctx.arcTo(x, y, x + radius, y, radius);
|
|
21
24
|
ctx.closePath();
|
|
22
25
|
ctx.fill();
|
|
23
|
-
ctx.
|
|
26
|
+
ctx.restore();
|
|
27
|
+
ctx.strokeStyle = (0, _colorUtils.getColorValue)('--identitySolidTone3', 'rgba(37, 224, 166, 1)');
|
|
24
28
|
ctx.lineWidth = 1;
|
|
25
29
|
ctx.stroke();
|
|
26
30
|
};
|
|
27
31
|
const resizeText = (ctx, text, maxWidth) => {
|
|
28
|
-
let fontSize =
|
|
32
|
+
let fontSize = 14;
|
|
29
33
|
ctx.font = "600 ".concat(fontSize, "px Inter");
|
|
30
34
|
while (ctx.measureText(text).width > maxWidth && fontSize > 10) {
|
|
31
35
|
fontSize -= 1;
|
|
@@ -36,39 +40,40 @@ const resizeText = (ctx, text, maxWidth) => {
|
|
|
36
40
|
const drawBadge = (ctx, x, y, radius, sectionLabel) => {
|
|
37
41
|
ctx.beginPath();
|
|
38
42
|
ctx.arc(x, y, radius, 0, Math.PI * 2);
|
|
39
|
-
ctx.fillStyle = 'rgba(255, 255, 255, 1)';
|
|
43
|
+
ctx.fillStyle = (0, _colorUtils.getColorValue)('--light01', 'rgba(255, 255, 255, 1)');
|
|
40
44
|
ctx.fill();
|
|
41
45
|
ctx.lineWidth = 1;
|
|
42
|
-
ctx.strokeStyle = 'rgba(37, 224, 166, 1)';
|
|
46
|
+
ctx.strokeStyle = (0, _colorUtils.getColorValue)('--identitySolidTone3', 'rgba(37, 224, 166, 1)');
|
|
43
47
|
ctx.stroke();
|
|
44
48
|
ctx.beginPath();
|
|
45
|
-
ctx.arc(x, y,
|
|
46
|
-
ctx.fillStyle = 'rgba(37, 224, 166, 1)';
|
|
49
|
+
ctx.arc(x, y, 14, 0, Math.PI * 2);
|
|
50
|
+
ctx.fillStyle = (0, _colorUtils.getColorValue)('--identitySolidTone3', 'rgba(37, 224, 166, 1)');
|
|
47
51
|
ctx.fill();
|
|
48
52
|
ctx.stroke();
|
|
49
|
-
ctx.fillStyle = 'rgba(9, 30, 66, 1)';
|
|
53
|
+
ctx.fillStyle = (0, _colorUtils.getColorValue)('--dark05', 'rgba(9, 30, 66, 1)');
|
|
50
54
|
const fontSize = resizeText(ctx, "".concat(sectionLabel), 48);
|
|
51
55
|
ctx.textAlign = 'center';
|
|
52
56
|
ctx.textBaseline = 'middle';
|
|
53
57
|
ctx.fillText("".concat(sectionLabel), x, y + fontSize / 10);
|
|
54
58
|
};
|
|
55
|
-
const drawRoundedRect = (ctx, x,
|
|
59
|
+
const drawRoundedRect = (ctx, x, yProps, width, height, radius) => {
|
|
56
60
|
const PADDING_TITLE = 12;
|
|
61
|
+
const y = yProps + 18;
|
|
57
62
|
ctx.beginPath();
|
|
58
63
|
ctx.arc(x - radius + PADDING_TITLE, y + radius, radius, Math.PI, 3 * Math.PI / 2);
|
|
59
|
-
ctx.arc(x + width - radius + PADDING_TITLE, y + radius, radius, -Math.PI / 2, 0);
|
|
64
|
+
ctx.arc(x + width - radius + PADDING_TITLE + 2, y + radius, radius, -Math.PI / 2, 0);
|
|
60
65
|
ctx.arc(x + width - radius + PADDING_TITLE, y + height - radius, radius, 0, Math.PI / 2);
|
|
61
66
|
ctx.arc(x - radius + PADDING_TITLE, y + height - radius, radius, Math.PI / 2, Math.PI);
|
|
62
67
|
ctx.closePath();
|
|
63
68
|
ctx.fillStyle = 'rgb(255, 255, 255)';
|
|
64
69
|
ctx.fill();
|
|
65
70
|
ctx.lineWidth = 1;
|
|
66
|
-
ctx.strokeStyle = 'rgba(37, 224, 166, 1)';
|
|
71
|
+
ctx.strokeStyle = (0, _colorUtils.getColorValue)('--identitySolidTone3', 'rgba(37, 224, 166, 1)');
|
|
67
72
|
ctx.beginPath();
|
|
68
|
-
ctx.moveTo(x - radius, y);
|
|
73
|
+
ctx.moveTo(x - radius + 4, y);
|
|
69
74
|
ctx.lineTo(x + PADDING_TITLE + width, y);
|
|
70
|
-
ctx.moveTo(x - radius, y + height);
|
|
71
|
-
ctx.lineTo(x + width - radius + PADDING_TITLE * 2, y + height);
|
|
75
|
+
ctx.moveTo(x - radius + 4, y + height);
|
|
76
|
+
ctx.lineTo(x + width - radius + PADDING_TITLE * 2 - 4, y + height);
|
|
72
77
|
ctx.stroke();
|
|
73
78
|
};
|
|
74
79
|
const drawBadgeSelected = (ctx, x, y, radius, sectionLabel, sectionTitle) => {
|
|
@@ -76,34 +81,34 @@ const drawBadgeSelected = (ctx, x, y, radius, sectionLabel, sectionTitle) => {
|
|
|
76
81
|
const renderTitle = "".concat(sectionTitle);
|
|
77
82
|
const textMetrics = ctx.measureText(renderTitle);
|
|
78
83
|
const textWidth = textMetrics.width;
|
|
79
|
-
const INTERNAL_CIRCLE_SIZE =
|
|
84
|
+
const INTERNAL_CIRCLE_SIZE = 14;
|
|
80
85
|
const PADDING_TITLE = 12;
|
|
81
86
|
const newX = x - (PADDING_TITLE + textWidth / 2);
|
|
82
87
|
ctx.beginPath();
|
|
83
88
|
ctx.arc(newX + PADDING_TITLE, y, radius, 0, Math.PI * 2);
|
|
84
|
-
ctx.fillStyle = 'rgba(255, 255, 255, 1)';
|
|
89
|
+
ctx.fillStyle = (0, _colorUtils.getColorValue)('--light01', 'rgba(255, 255, 255, 1)');
|
|
85
90
|
ctx.fill();
|
|
86
91
|
ctx.lineWidth = 1;
|
|
87
|
-
ctx.strokeStyle = 'rgba(37, 224, 166, 1)';
|
|
92
|
+
ctx.strokeStyle = (0, _colorUtils.getColorValue)('--identitySolidTone3', 'rgba(37, 224, 166, 1)');
|
|
88
93
|
ctx.stroke();
|
|
89
94
|
ctx.beginPath();
|
|
90
95
|
ctx.arc(newX + textWidth + PADDING_TITLE * 2, y, radius, 0, Math.PI * 2);
|
|
91
|
-
ctx.fillStyle = 'rgba(255, 255, 255, 1)';
|
|
96
|
+
ctx.fillStyle = (0, _colorUtils.getColorValue)('--light01', 'rgba(255, 255, 255, 1)');
|
|
92
97
|
ctx.fill();
|
|
93
98
|
ctx.lineWidth = 1;
|
|
94
|
-
ctx.strokeStyle = 'rgba(37, 224, 166, 1)';
|
|
99
|
+
ctx.strokeStyle = (0, _colorUtils.getColorValue)('--identitySolidTone3', 'rgba(37, 224, 166, 1)');
|
|
95
100
|
ctx.stroke();
|
|
96
101
|
drawRoundedRect(ctx, newX + PADDING_TITLE, y - 40, textWidth, radius * 2, Math.PI * 2);
|
|
97
102
|
ctx.textAlign = 'right';
|
|
98
103
|
ctx.textBaseline = 'middle';
|
|
99
|
-
ctx.fillStyle = 'rgba(9, 30, 66, 1)';
|
|
100
|
-
ctx.fillText(renderTitle, newX + textWidth + INTERNAL_CIRCLE_SIZE + PADDING_TITLE * 2, y + fontSize / 10);
|
|
104
|
+
ctx.fillStyle = (0, _colorUtils.getColorValue)('--dark05', 'rgba(9, 30, 66, 1)');
|
|
105
|
+
ctx.fillText(renderTitle, newX + textWidth + INTERNAL_CIRCLE_SIZE + PADDING_TITLE * 2 - 4, y + fontSize / 10);
|
|
101
106
|
ctx.beginPath();
|
|
102
107
|
ctx.arc(newX + PADDING_TITLE, y, INTERNAL_CIRCLE_SIZE, 0, Math.PI * 2);
|
|
103
|
-
ctx.fillStyle = 'rgba(37, 224, 166, 1)';
|
|
108
|
+
ctx.fillStyle = (0, _colorUtils.getColorValue)('--identitySolidTone3', 'rgba(37, 224, 166, 1)');
|
|
104
109
|
ctx.fill();
|
|
105
110
|
ctx.stroke();
|
|
106
|
-
ctx.fillStyle = 'rgba(9, 30, 66, 1)';
|
|
111
|
+
ctx.fillStyle = (0, _colorUtils.getColorValue)('--dark05', 'rgba(9, 30, 66, 1)');
|
|
107
112
|
ctx.textAlign = 'center';
|
|
108
113
|
ctx.textBaseline = 'middle';
|
|
109
114
|
ctx.fillText("".concat(sectionLabel), newX + PADDING_TITLE, y + fontSize / 10);
|
|
@@ -164,7 +169,7 @@ const drawSection = (ctx, image, section, actualPage, clickedSection, sectionsCo
|
|
|
164
169
|
height,
|
|
165
170
|
radius: 8
|
|
166
171
|
};
|
|
167
|
-
const EXTERNAL_RADIUS =
|
|
172
|
+
const EXTERNAL_RADIUS = 22;
|
|
168
173
|
const xCircle = (x2 + x1) / 2;
|
|
169
174
|
const yCircle = isClickedSection ? y1 : (y2 + y1) / 2;
|
|
170
175
|
sectionsBadgeCoord[section.id] = {
|
|
@@ -197,9 +202,14 @@ const drawSection = (ctx, image, section, actualPage, clickedSection, sectionsCo
|
|
|
197
202
|
exports.drawSection = drawSection;
|
|
198
203
|
const handleCanvasClick = (e, canvasRef, onSectionChange, sectionsBadgeCoord, sectionsCoord) => {
|
|
199
204
|
const canvas = canvasRef.current;
|
|
205
|
+
const ctx = canvas.getContext('2d');
|
|
200
206
|
const rect = canvas.getBoundingClientRect();
|
|
201
|
-
const
|
|
202
|
-
const
|
|
207
|
+
const px = (e.clientX - rect.left) * (canvas.width / rect.width);
|
|
208
|
+
const py = (e.clientY - rect.top) * (canvas.height / rect.height);
|
|
209
|
+
const inv = ctx.getTransform().invertSelf();
|
|
210
|
+
const point = new DOMPoint(px, py).matrixTransform(inv);
|
|
211
|
+
const xClick = point.x;
|
|
212
|
+
const yClick = point.y;
|
|
203
213
|
const onClick = key => {
|
|
204
214
|
onSectionChange(key);
|
|
205
215
|
};
|
|
@@ -234,9 +244,14 @@ const handleCanvasClick = (e, canvasRef, onSectionChange, sectionsBadgeCoord, se
|
|
|
234
244
|
exports.handleCanvasClick = handleCanvasClick;
|
|
235
245
|
const handleMouseMove = (e, canvasRef, sectionsBadgeCoord, sectionsCoord, isPointer) => {
|
|
236
246
|
const canvas = canvasRef.current;
|
|
247
|
+
const ctx = canvas.getContext('2d');
|
|
237
248
|
const rect = canvas.getBoundingClientRect();
|
|
238
|
-
const
|
|
239
|
-
const
|
|
249
|
+
const px = (e.clientX - rect.left) * (canvas.width / rect.width);
|
|
250
|
+
const py = (e.clientY - rect.top) * (canvas.height / rect.height);
|
|
251
|
+
const inv = ctx.getTransform().invertSelf();
|
|
252
|
+
const point = new DOMPoint(px, py).matrixTransform(inv);
|
|
253
|
+
const xMove = point.x;
|
|
254
|
+
const yMove = point.y;
|
|
240
255
|
Object.keys(sectionsBadgeCoord).forEach(key => {
|
|
241
256
|
const {
|
|
242
257
|
x,
|
|
@@ -29,6 +29,7 @@ const SectionDetails = _ref => {
|
|
|
29
29
|
className: _stylesModule.default.titleDefault,
|
|
30
30
|
variant: "title3"
|
|
31
31
|
}, titleDefault), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
32
|
+
colorTheme: "gray",
|
|
32
33
|
variant: "body",
|
|
33
34
|
className: _stylesModule.default.details
|
|
34
35
|
}, descriptionDefault));
|
|
@@ -27,8 +27,7 @@ const Sheet = _ref => {
|
|
|
27
27
|
className: _stylesModule.default.title,
|
|
28
28
|
variant: "title3"
|
|
29
29
|
}, title), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
30
|
-
colorTheme: "
|
|
31
|
-
className: _stylesModule.default.description,
|
|
30
|
+
colorTheme: "gray",
|
|
32
31
|
variant: "body"
|
|
33
32
|
}, description));
|
|
34
33
|
};
|
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
padding-bottom: 8px;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.description {
|
|
11
|
-
color: #677489;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
10
|
.swipeContainer {
|
|
15
11
|
align-items: center;
|
|
16
12
|
display: flex;
|
|
@@ -19,7 +15,7 @@
|
|
|
19
15
|
}
|
|
20
16
|
|
|
21
17
|
.swipe {
|
|
22
|
-
background-color: #F4F5F7;
|
|
18
|
+
background-color: var(--light03, #F4F5F7);
|
|
23
19
|
border-radius: 100px;
|
|
24
20
|
height: 8px;
|
|
25
21
|
margin-bottom: 16px;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
|
-
var _reactPerfectScrollbar = _interopRequireDefault(require("react-perfect-scrollbar"));
|
|
10
9
|
var _UTTabs = _interopRequireDefault(require("../UTTabs"));
|
|
11
10
|
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
12
11
|
var _Loading = _interopRequireDefault(require("../Loading"));
|
|
@@ -25,9 +24,11 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
25
24
|
const UTDocumentWizard = _ref => {
|
|
26
25
|
var _tabsOptions$;
|
|
27
26
|
let {
|
|
28
|
-
|
|
27
|
+
classNames,
|
|
28
|
+
labels,
|
|
29
29
|
pages = [],
|
|
30
|
-
|
|
30
|
+
scaleConfig,
|
|
31
|
+
sections = []
|
|
31
32
|
} = _ref;
|
|
32
33
|
const canvasRef = (0, _react.useRef)(null);
|
|
33
34
|
const tabsOptions = (0, _utils.getTabsOptions)(pages);
|
|
@@ -110,12 +111,12 @@ const UTDocumentWizard = _ref => {
|
|
|
110
111
|
sectionDetails
|
|
111
112
|
} = labels;
|
|
112
113
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
113
|
-
className: _stylesModule.default.container
|
|
114
|
+
className: "".concat(_stylesModule.default.container, " ").concat(classNames === null || classNames === void 0 ? void 0 : classNames.container)
|
|
114
115
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
115
116
|
className: _stylesModule.default.pageWizardContainer,
|
|
116
117
|
ref: containerRef
|
|
117
118
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
118
|
-
className: _stylesModule.default.pageManagerSection
|
|
119
|
+
className: "".concat(_stylesModule.default.pageManagerSection, " ").concat(classNames === null || classNames === void 0 ? void 0 : classNames.pageManagerSection)
|
|
119
120
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
120
121
|
className: _stylesModule.default.slidePageManagerContainer
|
|
121
122
|
}, /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
@@ -138,7 +139,7 @@ const UTDocumentWizard = _ref => {
|
|
|
138
139
|
indicator: _stylesModule.default.indicator
|
|
139
140
|
},
|
|
140
141
|
lastOptionProps: _constants.LAST_OPTION_PROPS
|
|
141
|
-
}))), /*#__PURE__*/_react.default.createElement(
|
|
142
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
142
143
|
className: _stylesModule.default.scrollContainer
|
|
143
144
|
}, isChangingTab && /*#__PURE__*/_react.default.createElement("div", {
|
|
144
145
|
className: _stylesModule.default.loadingContainer
|
|
@@ -146,16 +147,18 @@ const UTDocumentWizard = _ref => {
|
|
|
146
147
|
size: _constants.LOADING_SIZE,
|
|
147
148
|
thickness: _constants.LOADING_THICKNESS
|
|
148
149
|
})), !isChangingTab && actualPage && /*#__PURE__*/_react.default.createElement(_PageWizard.default, {
|
|
149
|
-
clickedSection: clickedSection,
|
|
150
150
|
canvasRef: canvasRef,
|
|
151
|
+
classNames: classNames,
|
|
152
|
+
clickedSection: clickedSection,
|
|
151
153
|
containerRef: containerRef,
|
|
152
|
-
sectionSelected: sectionSelected,
|
|
153
|
-
sections: sections,
|
|
154
|
-
onSectionChange: onSectionChange,
|
|
155
|
-
page: actualPage,
|
|
156
154
|
isChangingTab: isChangingTab,
|
|
155
|
+
isMobileSize: isMobileSize,
|
|
157
156
|
isSheetOpen: sheetOpen,
|
|
158
|
-
|
|
157
|
+
onSectionChange: onSectionChange,
|
|
158
|
+
page: actualPage,
|
|
159
|
+
scaleConfig: scaleConfig,
|
|
160
|
+
sections: sections,
|
|
161
|
+
sectionSelected: sectionSelected
|
|
159
162
|
}))), /*#__PURE__*/_react.default.createElement(_SectionDetails.default, _extends({
|
|
160
163
|
sectionSelected: sectionSelected
|
|
161
164
|
}, sectionDetails))), /*#__PURE__*/_react.default.createElement(_UTSheet.default, {
|
|
@@ -166,8 +169,10 @@ const UTDocumentWizard = _ref => {
|
|
|
166
169
|
}, SheetChildren));
|
|
167
170
|
};
|
|
168
171
|
UTDocumentWizard.propTypes = {
|
|
172
|
+
classNames: _propTypes.object,
|
|
173
|
+
labels: _propTypes.object,
|
|
169
174
|
pages: (0, _propTypes.arrayOf)({}),
|
|
170
|
-
|
|
171
|
-
|
|
175
|
+
scaleConfig: _propTypes.object,
|
|
176
|
+
sections: (0, _propTypes.arrayOf)({})
|
|
172
177
|
};
|
|
173
178
|
var _default = exports.default = UTDocumentWizard;
|
|
@@ -11,6 +11,7 @@ $assigned-to-icon-size: 24px;
|
|
|
11
11
|
|
|
12
12
|
@media #{$mobile} {
|
|
13
13
|
flex-direction: column;
|
|
14
|
+
padding: 24px 16px;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -21,7 +22,7 @@ $assigned-to-icon-size: 24px;
|
|
|
21
22
|
|
|
22
23
|
.tabRoot {
|
|
23
24
|
background-color: transparent;
|
|
24
|
-
color: rgba(103, 116, 137, 1);
|
|
25
|
+
color: var(--gray04, rgba(103, 116, 137, 1));
|
|
25
26
|
height: 46px;
|
|
26
27
|
margin-left: 4px;
|
|
27
28
|
margin-right: 8px;
|
|
@@ -40,10 +41,10 @@ $assigned-to-icon-size: 24px;
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
.selected {
|
|
43
|
-
background-color: rgba(255, 255, 255, 1);
|
|
44
|
+
background-color: var(--light01, rgba(255, 255, 255, 1));
|
|
44
45
|
border-radius: 4px;
|
|
45
|
-
box-shadow: 0px 3px 6px 0px rgba(40, 90, 255, 0.1);
|
|
46
|
-
color: rgba(1, 54, 231, 1);
|
|
46
|
+
box-shadow: var(--shadow, 0px 3px 6px 0px rgba(40, 90, 255, 0.1));
|
|
47
|
+
color: var(--actionAccent05, rgba(1, 54, 231, 1));
|
|
47
48
|
width: 100%;
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -51,7 +52,7 @@ $assigned-to-icon-size: 24px;
|
|
|
51
52
|
display: none;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
.pageWizardContainer{
|
|
55
|
+
.pageWizardContainer {
|
|
55
56
|
align-items: flex-start;
|
|
56
57
|
display: flex;
|
|
57
58
|
flex: 1;
|
|
@@ -65,12 +66,10 @@ $assigned-to-icon-size: 24px;
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
.pageManagerSection {
|
|
68
|
-
|
|
69
|
-
width: 100%;
|
|
69
|
+
width: 100%;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
.pageManagerContainer {
|
|
73
|
-
padding-top: 8px;
|
|
74
73
|
width: 100%;
|
|
75
74
|
@media #{$mobile} {
|
|
76
75
|
display: none;
|
|
@@ -84,21 +83,10 @@ $assigned-to-icon-size: 24px;
|
|
|
84
83
|
flex: 1;
|
|
85
84
|
flex-direction: row;
|
|
86
85
|
justify-content: space-between;
|
|
87
|
-
margin-right: 12px;
|
|
88
86
|
padding: 6.5px 0px 6.5px 0px;
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
89
|
|
|
92
|
-
.icon {
|
|
93
|
-
background-color: rgba(233, 239, 255, 1);
|
|
94
|
-
border-radius: 4px;
|
|
95
|
-
border-width: 0;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.iconDisabled {
|
|
99
|
-
background-color: rgba(233, 239, 255, 0.5)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
90
|
.loadingContainer {
|
|
103
91
|
align-items: center;
|
|
104
92
|
display: flex;
|
|
@@ -109,7 +97,9 @@ $assigned-to-icon-size: 24px;
|
|
|
109
97
|
|
|
110
98
|
.scrollContainer {
|
|
111
99
|
display: flex;
|
|
112
|
-
|
|
100
|
+
height: fit-content;
|
|
101
|
+
justify-content: space-around;
|
|
113
102
|
white-space: nowrap;
|
|
114
103
|
width: 100%;
|
|
115
|
-
|
|
104
|
+
overflow-x: auto;
|
|
105
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getColorValue = void 0;
|
|
7
|
+
const getColorValue = function (varName) {
|
|
8
|
+
let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
9
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') return fallback;
|
|
10
|
+
try {
|
|
11
|
+
var _window$getComputedSt, _window, _window$getComputedSt2;
|
|
12
|
+
const root = document.documentElement;
|
|
13
|
+
const cssValue = (_window$getComputedSt = (_window = window).getComputedStyle) === null || _window$getComputedSt === void 0 || (_window$getComputedSt = _window$getComputedSt.call(_window, root)) === null || _window$getComputedSt === void 0 || (_window$getComputedSt2 = _window$getComputedSt.getPropertyValue) === null || _window$getComputedSt2 === void 0 || (_window$getComputedSt2 = _window$getComputedSt2.call(_window$getComputedSt, varName)) === null || _window$getComputedSt2 === void 0 ? void 0 : _window$getComputedSt2.trim();
|
|
14
|
+
return cssValue || fallback;
|
|
15
|
+
} catch {
|
|
16
|
+
return fallback;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.getColorValue = getColorValue;
|