@widergy/energy-ui 3.76.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 +14 -0
- package/dist/components/UTAlert/index.js +4 -5
- package/dist/components/UTBarChart/components/Bars/components/Bar/index.js +3 -3
- package/dist/components/UTBarChart/components/XAxis/index.js +4 -5
- package/dist/components/UTBreadcrumbs/index.js +4 -4
- package/dist/components/UTCreditCard/index.js +10 -13
- package/dist/components/UTDialog/index.js +6 -9
- 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/components/UTOnboarding/index.js +7 -11
- package/dist/components/UTPanel/versions/V0/index.js +4 -5
- package/dist/components/UTPanel/versions/V1/index.js +6 -9
- package/dist/components/UTStatusMessage/index.js +6 -9
- package/dist/components/UTTable/components/ResponsiveCell/index.js +7 -4
- package/dist/components/UTTable/components/TableHeader/index.js +3 -3
- package/dist/components/UTTable/components/TableRow/index.js +6 -3
- package/dist/components/UTTable/index.js +14 -6
- package/dist/components/UTTabs/index.js +3 -3
- package/dist/components/UTWorkflowContainer/versions/V0/index.js +4 -5
- package/dist/components/UTWorkflowContainer/versions/V1/components/NavActions/index.js +6 -9
- package/dist/components/UTWorkflowContainer/versions/V1/index.js +7 -11
- package/dist/constants/testIds.js +76 -66
- package/dist/utils/colorUtils.js +19 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
8
|
+
# [3.77.0](https://github.com/widergy/energy-ui/compare/v3.76.0...v3.77.0) (2025-05-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* [AUT-597] new testid structure object ([#618](https://github.com/widergy/energy-ui/issues/618)) ([adb5090](https://github.com/widergy/energy-ui/commit/adb509016b0bc7b009813f397199e7592b0630d4))
|
|
14
|
+
|
|
1
15
|
# [3.76.0](https://github.com/widergy/energy-ui/compare/v3.75.0...v3.76.0) (2025-05-09)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -25,9 +25,8 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
25
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
26
26
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
27
|
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _testIds.COMPONENT_IDS.snackBarIds;
|
|
28
|
+
snackBar
|
|
29
|
+
} = _testIds.TEST_IDS;
|
|
31
30
|
const variantIcon = {
|
|
32
31
|
error: _Error.default,
|
|
33
32
|
info: _Info.default,
|
|
@@ -67,9 +66,9 @@ class UTAlert extends _react.PureComponent {
|
|
|
67
66
|
render() {
|
|
68
67
|
const {
|
|
69
68
|
classes = {},
|
|
70
|
-
closeDataTestId =
|
|
69
|
+
closeDataTestId = snackBar.closeButton,
|
|
71
70
|
content: alert = {},
|
|
72
|
-
labelDataTestId =
|
|
71
|
+
labelDataTestId = snackBar.label,
|
|
73
72
|
withoutIcon
|
|
74
73
|
} = this.props;
|
|
75
74
|
const anchor = {
|
|
@@ -14,8 +14,8 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
14
14
|
var _constants = require("./constants");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
const {
|
|
17
|
-
|
|
18
|
-
} = _testIds.
|
|
17
|
+
barChart
|
|
18
|
+
} = _testIds.TEST_IDS;
|
|
19
19
|
const Bar = _ref => {
|
|
20
20
|
let {
|
|
21
21
|
width,
|
|
@@ -38,7 +38,7 @@ const Bar = _ref => {
|
|
|
38
38
|
return /*#__PURE__*/_react.default.createElement(_UTTooltip.default, {
|
|
39
39
|
className: tooltipClassName,
|
|
40
40
|
content: tooltipContent,
|
|
41
|
-
dataTestId: "".concat(
|
|
41
|
+
dataTestId: "".concat(barChart.bar.tooltip).concat(id),
|
|
42
42
|
interactive: false,
|
|
43
43
|
stringContentClassName: _stylesModule.default.tooltip
|
|
44
44
|
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
@@ -16,9 +16,8 @@ var _constants = require("./constants");
|
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
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); }
|
|
18
18
|
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _testIds.COMPONENT_IDS.barChartIds;
|
|
19
|
+
barChart
|
|
20
|
+
} = _testIds.TEST_IDS;
|
|
22
21
|
const XAxis = _ref => {
|
|
23
22
|
let {
|
|
24
23
|
data,
|
|
@@ -87,7 +86,7 @@ const XAxis = _ref => {
|
|
|
87
86
|
labelBackgroundPadding: labelBackgroundPadding,
|
|
88
87
|
labelYOffset: labelYOffset,
|
|
89
88
|
mainLabel: mainLabel,
|
|
90
|
-
mainLabelDataTestId: "".concat(
|
|
89
|
+
mainLabelDataTestId: "".concat(barChart.xAxis.mainLabel).concat(index),
|
|
91
90
|
mainLabelStyles: mainLabelStyles,
|
|
92
91
|
selected: selected,
|
|
93
92
|
selectedLabelBackground: selectedLabelBackground,
|
|
@@ -106,7 +105,7 @@ const XAxis = _ref => {
|
|
|
106
105
|
color: color || '',
|
|
107
106
|
graphYStart: graphYStart,
|
|
108
107
|
secondaryLabel: secondaryLabel,
|
|
109
|
-
secondaryLabelDataTestId: "".concat(
|
|
108
|
+
secondaryLabelDataTestId: "".concat(barChart.xAxis.secondaryLabel).concat(index),
|
|
110
109
|
x: xAxis(index) + xOffset,
|
|
111
110
|
yOffset: _constants.Y_OFFSET
|
|
112
111
|
});
|
|
@@ -19,8 +19,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
19
19
|
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); }
|
|
20
20
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
21
21
|
const {
|
|
22
|
-
|
|
23
|
-
} = _testIds.
|
|
22
|
+
breadcrumbs: breadcrumbsIds
|
|
23
|
+
} = _testIds.TEST_IDS;
|
|
24
24
|
const UTBreadcrumbs = _ref => {
|
|
25
25
|
let {
|
|
26
26
|
breadcrumbs,
|
|
@@ -153,7 +153,7 @@ const UTBreadcrumbs = _ref => {
|
|
|
153
153
|
key: "".concat(route, "-").concat(label)
|
|
154
154
|
}, !route && !menuItems || disableMenu ? /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
155
155
|
className: _stylesModule.default.label,
|
|
156
|
-
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(index) : "".concat(
|
|
156
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(index) : "".concat(breadcrumbsIds.item, ".").concat(index),
|
|
157
157
|
variant: "small",
|
|
158
158
|
weight: "medium"
|
|
159
159
|
}, colorThemesDefinition.label), label) : /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
@@ -162,7 +162,7 @@ const UTBreadcrumbs = _ref => {
|
|
|
162
162
|
childrenContainer: overflowControl ? _stylesModule.default.buttonContainer : null,
|
|
163
163
|
text: overflowControl ? _stylesModule.default.ellipsis : null
|
|
164
164
|
},
|
|
165
|
-
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(index) : "".concat(
|
|
165
|
+
dataTestId: dataTestId ? "".concat(dataTestId, ".").concat(index) : "".concat(breadcrumbsIds.item, ".").concat(index),
|
|
166
166
|
onClick: handleClick,
|
|
167
167
|
size: "small",
|
|
168
168
|
variant: "text"
|
|
@@ -16,11 +16,8 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
16
16
|
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); }
|
|
17
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
cvcFieldId,
|
|
22
|
-
cardFieldId
|
|
23
|
-
} = _testIds.COMPONENT_IDS.creditCardIds;
|
|
19
|
+
creditCard
|
|
20
|
+
} = _testIds.TEST_IDS;
|
|
24
21
|
const UTCreditCard = _ref => {
|
|
25
22
|
var _value$expYearField;
|
|
26
23
|
let {
|
|
@@ -89,13 +86,13 @@ const UTCreditCard = _ref => {
|
|
|
89
86
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
90
87
|
className: _stylesModule.default.fields
|
|
91
88
|
}, /*#__PURE__*/_react.default.createElement(_UTTextInput.default, {
|
|
92
|
-
dataTestId:
|
|
89
|
+
dataTestId: creditCard.cardField,
|
|
93
90
|
error: errors[cardField],
|
|
94
91
|
onChange: onChangeField(cardField),
|
|
95
92
|
onFocus: () => setFocused(_constants.fields.NUMBER),
|
|
96
93
|
required: true,
|
|
97
94
|
title: numberTitle,
|
|
98
|
-
validationDataTestId: "".concat(
|
|
95
|
+
validationDataTestId: "".concat(creditCard.cardField, ".validation"),
|
|
99
96
|
value: values[cardField],
|
|
100
97
|
version: "V1"
|
|
101
98
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -104,37 +101,37 @@ const UTCreditCard = _ref => {
|
|
|
104
101
|
classNames: {
|
|
105
102
|
container: _stylesModule.default.inRow
|
|
106
103
|
},
|
|
107
|
-
dataTestId:
|
|
104
|
+
dataTestId: creditCard.expires,
|
|
108
105
|
error: errors[expires],
|
|
109
106
|
onChange: onChangeField(expires),
|
|
110
107
|
onFocus: () => setFocused(_constants.fields.EXPIRY),
|
|
111
108
|
required: true,
|
|
112
109
|
title: expiryTitle,
|
|
113
|
-
validationDataTestId: "".concat(
|
|
110
|
+
validationDataTestId: "".concat(creditCard.expires, ".validation"),
|
|
114
111
|
value: values[expires],
|
|
115
112
|
version: "V1"
|
|
116
113
|
}), /*#__PURE__*/_react.default.createElement(_UTPasswordField.default, {
|
|
117
114
|
classNames: {
|
|
118
115
|
container: _stylesModule.default.inRow
|
|
119
116
|
},
|
|
120
|
-
dataTestId:
|
|
117
|
+
dataTestId: creditCard.cvcField,
|
|
121
118
|
error: errors[cvcField],
|
|
122
119
|
onChange: onChangeField(cvcField),
|
|
123
120
|
onVisibilityToggle: setCvcVisibility,
|
|
124
121
|
title: cvcTitle,
|
|
125
122
|
required: true,
|
|
126
123
|
onFocus: () => setFocused(_constants.fields.CVC),
|
|
127
|
-
validationDataTestId: "".concat(
|
|
124
|
+
validationDataTestId: "".concat(creditCard.cvcField, ".validation"),
|
|
128
125
|
value: values[cvcField],
|
|
129
126
|
version: "V1"
|
|
130
127
|
})), /*#__PURE__*/_react.default.createElement(_UTTextInput.default, {
|
|
131
|
-
dataTestId:
|
|
128
|
+
dataTestId: creditCard.nameField,
|
|
132
129
|
error: errors[nameFiled],
|
|
133
130
|
onChange: onChangeField(nameFiled),
|
|
134
131
|
required: true,
|
|
135
132
|
onFocus: () => setFocused(_constants.fields.NAME),
|
|
136
133
|
title: nameTitle,
|
|
137
|
-
validationDataTestId: "".concat(
|
|
134
|
+
validationDataTestId: "".concat(creditCard.nameField, ".validation"),
|
|
138
135
|
value: values[nameFiled],
|
|
139
136
|
version: "V1"
|
|
140
137
|
})));
|
|
@@ -22,22 +22,19 @@ var _constants = require("./constants");
|
|
|
22
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
23
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
24
24
|
const {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
closeButtonId,
|
|
28
|
-
titleId
|
|
29
|
-
} = _testIds.COMPONENT_IDS.dialogIds;
|
|
25
|
+
dialog
|
|
26
|
+
} = _testIds.TEST_IDS;
|
|
30
27
|
const UTDialog = _ref => {
|
|
31
28
|
let {
|
|
32
29
|
acceptButton,
|
|
33
|
-
acceptButtonDataTestId =
|
|
30
|
+
acceptButtonDataTestId = dialog.acceptButton,
|
|
34
31
|
alertConfig,
|
|
35
32
|
cancelButton,
|
|
36
|
-
cancelButtonDataTestId =
|
|
33
|
+
cancelButtonDataTestId = dialog.cancelButton,
|
|
37
34
|
children,
|
|
38
35
|
classNames,
|
|
39
36
|
classes,
|
|
40
|
-
closeButtonDataTestId =
|
|
37
|
+
closeButtonDataTestId = dialog.closeButton,
|
|
41
38
|
contentName,
|
|
42
39
|
dialogProps,
|
|
43
40
|
disableEnforceFocus,
|
|
@@ -49,7 +46,7 @@ const UTDialog = _ref => {
|
|
|
49
46
|
onRequestClose,
|
|
50
47
|
roundedCloseButton,
|
|
51
48
|
title,
|
|
52
|
-
titleDataTestId =
|
|
49
|
+
titleDataTestId = dialog.title,
|
|
53
50
|
TransitionProps,
|
|
54
51
|
warningAlert,
|
|
55
52
|
whiteTitle,
|
|
@@ -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;
|