typescript-overlay-essentials 1.6.1 → 2.0.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/dist/ConfirmationBox.css +18 -8
- package/dist/ConfirmationBox.d.ts +2 -2
- package/dist/ConfirmationBox.js +3 -3
- package/dist/Dropdown.css +3 -3
- package/dist/Dropdown.d.ts +1 -1
- package/dist/Dropdown.js +14 -8
- package/dist/InfoOverlay.css +18 -8
- package/dist/InfoOverlay.d.ts +2 -2
- package/dist/InfoOverlay.js +4 -4
- package/dist/InfoOverlayWithInput.css +39 -12
- package/dist/InfoOverlayWithInput.d.ts +2 -2
- package/dist/InfoOverlayWithInput.js +4 -4
- package/dist/LoadingOverlay.css +15 -15
- package/dist/LoadingOverlay.d.ts +2 -2
- package/dist/LoadingOverlay.js +1 -1
- package/dist/MultipleChoiceOverlay.css +28 -26
- package/dist/MultipleChoiceOverlay.d.ts +2 -2
- package/dist/MultipleChoiceOverlay.js +8 -8
- package/dist/MultipleRadioOverlay.css +27 -25
- package/dist/MultipleRadioOverlay.d.ts +2 -2
- package/dist/MultipleRadioOverlay.js +8 -8
- package/dist/Toast.css +1 -1
- package/dist/Toast.d.ts +3 -3
- package/dist/Toast.js +1 -1
- package/dist/ToggleSwitch.css +7 -7
- package/dist/ToggleSwitch.js +1 -1
- package/dist/TutorialOverlay.css +94 -0
- package/dist/TutorialOverlay.d.ts +26 -0
- package/dist/TutorialOverlay.js +195 -0
- package/package.json +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
.overlay-essentials-tutorial-headline {
|
|
2
|
+
white-space: pre-line;
|
|
3
|
+
word-break: break-word;
|
|
4
|
+
text-align: center;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.overlay-essentials-tutorial-message {
|
|
8
|
+
white-space: pre-line;
|
|
9
|
+
word-break: break-word;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.overlay-essentials-tutorial-overlay {
|
|
13
|
+
position: fixed;
|
|
14
|
+
top: 0;
|
|
15
|
+
left: 0;
|
|
16
|
+
width: 100vw;
|
|
17
|
+
height: 100vh;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
z-index: 10000;
|
|
22
|
+
inset: 0;
|
|
23
|
+
|
|
24
|
+
&.overlay-essentials-darken {
|
|
25
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.overlay-essentials-tutorial-highlight-hole {
|
|
30
|
+
position: fixed;
|
|
31
|
+
border-radius: 8px;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
|
|
34
|
+
z-index: 10000;
|
|
35
|
+
|
|
36
|
+
border: 2px solid white;
|
|
37
|
+
|
|
38
|
+
box-shadow:
|
|
39
|
+
0 0 0 4px rgba(255,255,255,0.25),
|
|
40
|
+
0 0 0 9999px rgba(0,0,0,0.6);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
.overlay-essentials-tutorial-box {
|
|
45
|
+
background-color: var(--Hellgrau, white);
|
|
46
|
+
color: var(--HellSchwarz,#2c2c2c);
|
|
47
|
+
padding: 2rem;
|
|
48
|
+
border-radius: 12px;
|
|
49
|
+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
|
|
50
|
+
max-width: 500px;
|
|
51
|
+
width: 90%;
|
|
52
|
+
animation: fadeIn 0.3s ease-in-out;
|
|
53
|
+
z-index: 10001;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@keyframes fadeIn {
|
|
57
|
+
from {
|
|
58
|
+
opacity: 0;
|
|
59
|
+
transform: scale(0.95);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
to {
|
|
63
|
+
opacity: 1;
|
|
64
|
+
transform: scale(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.overlay-essentials-tutorial-box div {
|
|
69
|
+
margin-bottom: 0.5em;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.overlay-essentials-tutorial-box .headline {
|
|
73
|
+
margin-bottom: 0.75em;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.overlay-essentials-tutorial-box .tutorial-buttons {
|
|
77
|
+
display: flex;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
gap: 1rem;
|
|
80
|
+
margin-top: 1.5rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.overlay-essentials-tutorial-box .tutorial-buttons button {
|
|
84
|
+
font-size: 85%;
|
|
85
|
+
padding: 0.5rem 1.1rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* ==== Dark Mode Support ==== */
|
|
89
|
+
[visual-theme="dark"] {
|
|
90
|
+
.tutorial-box {
|
|
91
|
+
background-color: var(--HellSchwarz,#2c2c2c);
|
|
92
|
+
color: white;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CSSProperties, Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import './TutorialOverlay.css';
|
|
3
|
+
export interface Steps {
|
|
4
|
+
headline: React.ReactNode;
|
|
5
|
+
message: React.ReactNode;
|
|
6
|
+
attachToObject?: string | HTMLElement;
|
|
7
|
+
command?: string;
|
|
8
|
+
backCommand?: string;
|
|
9
|
+
waitFor?: number;
|
|
10
|
+
dontHighlightObject?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface TutorialState {
|
|
13
|
+
steps: Steps[];
|
|
14
|
+
currentCommand?: string;
|
|
15
|
+
proceedButtonText?: React.ReactNode;
|
|
16
|
+
completeButtonText?: React.ReactNode;
|
|
17
|
+
backButtonText?: React.ReactNode;
|
|
18
|
+
cancelButtonText?: React.ReactNode;
|
|
19
|
+
completeCommand?: string;
|
|
20
|
+
cancelCommand?: string;
|
|
21
|
+
style?: CSSProperties;
|
|
22
|
+
}
|
|
23
|
+
export declare function TutorialOverlay({ state, setState }: {
|
|
24
|
+
state: TutorialState;
|
|
25
|
+
setState: Dispatch<SetStateAction<TutorialState>>;
|
|
26
|
+
}): React.ReactElement;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, useRef } from 'react';
|
|
3
|
+
import './TutorialOverlay.css';
|
|
4
|
+
const defaultTutorialState = {
|
|
5
|
+
steps: [
|
|
6
|
+
// {
|
|
7
|
+
// headline: undefined,
|
|
8
|
+
// message: undefined,
|
|
9
|
+
// attachToObject: undefined,
|
|
10
|
+
// command: undefined,
|
|
11
|
+
// backCommand: undefined,
|
|
12
|
+
// dontHighlightObject: undefined,
|
|
13
|
+
// }
|
|
14
|
+
],
|
|
15
|
+
currentCommand: undefined,
|
|
16
|
+
proceedButtonText: undefined,
|
|
17
|
+
completeButtonText: undefined,
|
|
18
|
+
backButtonText: undefined,
|
|
19
|
+
cancelButtonText: undefined,
|
|
20
|
+
completeCommand: undefined,
|
|
21
|
+
cancelCommand: undefined,
|
|
22
|
+
style: undefined,
|
|
23
|
+
};
|
|
24
|
+
const TIMEOUT_OVERLAY_WAIT_FOR_COMMAND_EXECUTION_MS = 100;
|
|
25
|
+
// Wobei alle Attribute grundsätzlich optional sind:
|
|
26
|
+
// - steps: Ist ein Array, welches alle Schritte des Tutorials im Format {message: string, attachToObject: JSX.Element, dontHighlightObject: boolean} angibt.
|
|
27
|
+
// - headline: Eine fett hinterlegte Überschrift für diesen Schritt (optional)
|
|
28
|
+
// - message: Die in diesem Schritt angezeigte Nachricht
|
|
29
|
+
// - attachToObject: Die HTML-ID des Objekts im Dokument oder ein HTMLElement neben dem die Nachricht angezeigt werden soll (optional, sonst in der Mitte des Bildschirms)
|
|
30
|
+
// - command: Ein String, der an einer Stelle gesetzt und an anderer Stelle ausgelesen werden kann, um z.B. Funktionsaufrufe zu triggern beim BETRETEN des steps (optional)
|
|
31
|
+
// - backCommand: Wie command. Aber gedacht für den Fall, dass AUS diesem Schritt ZURÜCKgegangen wird. Soll also rückgängig machen, was in command passiert ist (optional)
|
|
32
|
+
// - waitFor: Ein int, der angibt wie viele ms nach dem ausführen des Commands /bzw. backCommands) gewartet werden soll, bis zum nächsten Step gewechselt wird (optional, standard 100)
|
|
33
|
+
// - dontHighlightObject: Gibt an, ob die standardmäßige hervoerhebung des Objekts aufgehoben werden soll (also das NICHT visuell in den Vordergrund gezogen wird, vor das Overlay) (optional)
|
|
34
|
+
// - currentCommand: Wird bei jedem Schritt aktualisiert, damit von außen auf einen Command reagiert werden kann
|
|
35
|
+
// - completeCommand: ist der Command, auf den currentCommand nach Bestätigung des "Abschließen" Buttons auf der letzten Seite gesetzt wird
|
|
36
|
+
// - cancelCommand: ist der Command, auf den currentCommand nach Abbruch auf der ersten Seite gesetzt wird ODER beim abbrechen in einem beliebigen Step durch ESC-Taste
|
|
37
|
+
// - proceedButtonText: ist der Text der auf dem Fortfahren Button stehen soll (ohne Angabe wird "Weiter" verwendet)
|
|
38
|
+
// - completeButtonText: ist der Text der auf dem Abschließenden Button stehen soll (ohne Angabe wird "Abschließen" verwendet)
|
|
39
|
+
// - backButtonText: ist der Text der auf dem Zurück Button stehen soll (ohne Angabe wird "Zurück" verwendet)
|
|
40
|
+
// - cancelButtonText: ist der Text der auf dem Abbrechen Button stehen soll (ohne Angabe wird "Überspringen" verwendet)
|
|
41
|
+
// - style: ist der Style des Tutorial-Overlays (Standardmäßig unverändert)
|
|
42
|
+
export function TutorialOverlay({ state, setState }) {
|
|
43
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
44
|
+
// Wird verwendet um das Tutorial-Overlay ein- und auszublenden
|
|
45
|
+
const [showTutorial, setShowTutorial] = useState(false);
|
|
46
|
+
// Wird verwendet um die Position des Textes zu bestimmen
|
|
47
|
+
const [tutorialPos, setTutorialPos] = useState(null);
|
|
48
|
+
const [highlightElementRect, setHighlightElementRect] = useState(null);
|
|
49
|
+
// Wird verwendet um zu tracken bei welchem Schritt des Tutorials der Nutzer ist
|
|
50
|
+
const [tutorialStep, setTutorialStep] = useState(0);
|
|
51
|
+
const proceedButtonRef = useRef(null);
|
|
52
|
+
// Sobald der State von außen aktualisiert wird triggert diese Funktion
|
|
53
|
+
// Die setzt showTutorial auf true
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
var _a, _b, _c, _d;
|
|
56
|
+
setTutorialStep(0);
|
|
57
|
+
setHighlightElementRect(null);
|
|
58
|
+
setTutorialPos(null);
|
|
59
|
+
if ((state === null || state === void 0 ? void 0 : state.steps) !== undefined && state.steps.length > 0) {
|
|
60
|
+
const attachElement = typeof ((_a = state === null || state === void 0 ? void 0 : state.steps[0]) === null || _a === void 0 ? void 0 : _a.attachToObject) === "string"
|
|
61
|
+
? document.getElementById((_b = state === null || state === void 0 ? void 0 : state.steps[0]) === null || _b === void 0 ? void 0 : _b.attachToObject)
|
|
62
|
+
: (_c = state === null || state === void 0 ? void 0 : state.steps[0]) === null || _c === void 0 ? void 0 : _c.attachToObject;
|
|
63
|
+
if (attachElement instanceof HTMLElement) {
|
|
64
|
+
showTutorialAtElement(attachElement, (_d = state.steps[0].dontHighlightObject) !== null && _d !== void 0 ? _d : false);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
setShowTutorial(true);
|
|
68
|
+
}
|
|
69
|
+
setTimeout(() => { var _a; (_a = proceedButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, 500);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
setShowTutorial(false);
|
|
73
|
+
}
|
|
74
|
+
}, [state === null || state === void 0 ? void 0 : state.steps]);
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (showTutorial) {
|
|
77
|
+
document.body.style.overflow = "hidden";
|
|
78
|
+
}
|
|
79
|
+
return () => {
|
|
80
|
+
document.body.style.overflow = "";
|
|
81
|
+
};
|
|
82
|
+
}, [showTutorial]);
|
|
83
|
+
const showTutorialAtElement = (e, dontHighlightElement) => {
|
|
84
|
+
var rect = e.getBoundingClientRect();
|
|
85
|
+
const viewportHeight = window.innerHeight;
|
|
86
|
+
// Element ist höher als der sichtbare Bereich
|
|
87
|
+
if (rect.height > viewportHeight) {
|
|
88
|
+
e.scrollIntoView({ behavior: "instant", block: "start" });
|
|
89
|
+
// Etwas nach unten scrollen, damit das Element nicht direkt am oberen Rand klebt
|
|
90
|
+
window.scrollBy({ top: -viewportHeight * 0.3, behavior: "instant" });
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
e.scrollIntoView({ behavior: "instant", block: "center" });
|
|
94
|
+
}
|
|
95
|
+
rect = e.getBoundingClientRect();
|
|
96
|
+
// 25 rem
|
|
97
|
+
const tooltipWidth = 31 * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
98
|
+
const showLeft = rect.right + tooltipWidth > window.innerWidth;
|
|
99
|
+
setTutorialPos({
|
|
100
|
+
showLeft,
|
|
101
|
+
px_left: showLeft
|
|
102
|
+
? rect.left - tooltipWidth - parseFloat(getComputedStyle(document.documentElement).fontSize)
|
|
103
|
+
: rect.right + parseFloat(getComputedStyle(document.documentElement).fontSize),
|
|
104
|
+
px_top: rect.top
|
|
105
|
+
});
|
|
106
|
+
if (!dontHighlightElement) {
|
|
107
|
+
setHighlightElementRect({
|
|
108
|
+
left: rect.left,
|
|
109
|
+
top: rect.top,
|
|
110
|
+
width: rect.width,
|
|
111
|
+
height: rect.height
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
setHighlightElementRect(null);
|
|
116
|
+
}
|
|
117
|
+
setShowTutorial(true);
|
|
118
|
+
};
|
|
119
|
+
return showTutorial ?
|
|
120
|
+
_jsxs("div", { className: "overlay-essentials-tutorial-overlay" + (highlightElementRect === null ? " overlay-essentials-darken" : ""), children: [_jsx("div", { className: "overlay-essentials-overlay-essentials-tutorial-highlight-hole", style: highlightElementRect === null
|
|
121
|
+
? {
|
|
122
|
+
display: "none"
|
|
123
|
+
} : {
|
|
124
|
+
left: `${(_a = highlightElementRect === null || highlightElementRect === void 0 ? void 0 : highlightElementRect.left) !== null && _a !== void 0 ? _a : 0}px`,
|
|
125
|
+
top: `${(_b = highlightElementRect === null || highlightElementRect === void 0 ? void 0 : highlightElementRect.top) !== null && _b !== void 0 ? _b : 0}px`,
|
|
126
|
+
width: `${(_c = highlightElementRect === null || highlightElementRect === void 0 ? void 0 : highlightElementRect.width) !== null && _c !== void 0 ? _c : 0}px`,
|
|
127
|
+
height: `${(_d = highlightElementRect === null || highlightElementRect === void 0 ? void 0 : highlightElementRect.height) !== null && _d !== void 0 ? _d : 0}px`,
|
|
128
|
+
} }), _jsxs("div", { className: "overlay-essentials-overlay-essentials-tutorial-box", style: {
|
|
129
|
+
...(tutorialPos
|
|
130
|
+
? {
|
|
131
|
+
position: "fixed",
|
|
132
|
+
left: tutorialPos.px_left,
|
|
133
|
+
top: tutorialPos.px_top,
|
|
134
|
+
transform: 'none'
|
|
135
|
+
}
|
|
136
|
+
: {}),
|
|
137
|
+
...((state === null || state === void 0 ? void 0 : state.style) != null ? state.style : {})
|
|
138
|
+
}, role: "dialog", "aria-modal": "true", "aria-labelledby": (state === null || state === void 0 ? void 0 : state.steps[tutorialStep].headline) != null ? "tutorial-headline" : undefined, "aria-label": ((_e = state === null || state === void 0 ? void 0 : state.steps[tutorialStep]) === null || _e === void 0 ? void 0 : _e.headline) != null ? undefined : "Tutorial", "aria-describedby": "tutorial-message", onKeyDown: (event) => {
|
|
139
|
+
var _a;
|
|
140
|
+
if (event.key === "Escape") {
|
|
141
|
+
const nextCommand = (_a = state.cancelCommand) !== null && _a !== void 0 ? _a : null;
|
|
142
|
+
setState((prev) => ({ ...prev, currentCommand: nextCommand !== null && nextCommand !== void 0 ? nextCommand : undefined }));
|
|
143
|
+
}
|
|
144
|
+
}, children: [_jsx("div", { id: "overlay-essentials-overlay-essentials-tutorial-headline", className: "overlay-essentials-overlay-essentials-tutorial-headline", children: _jsxs("strong", { children: [(_g = (_f = state === null || state === void 0 ? void 0 : state.steps[tutorialStep]) === null || _f === void 0 ? void 0 : _f.headline) !== null && _g !== void 0 ? _g : "", " ", tutorialStep + 1, "/", state.steps.length] }) }), _jsx("div", { id: "overlay-essentials-overlay-essentials-tutorial-message", className: "overlay-essentials-overlay-essentials-tutorial-message", children: (_j = (_h = state === null || state === void 0 ? void 0 : state.steps[tutorialStep]) === null || _h === void 0 ? void 0 : _h.message) !== null && _j !== void 0 ? _j : "" }), _jsxs("div", { className: "overlay-essentials-tutorial-buttons", children: [_jsx("button", { onClick: () => {
|
|
145
|
+
var _a, _b, _c, _d;
|
|
146
|
+
if (tutorialStep > 0) {
|
|
147
|
+
const nextCommand = (_b = (_a = state.steps[tutorialStep]) === null || _a === void 0 ? void 0 : _a.backCommand) !== null && _b !== void 0 ? _b : null;
|
|
148
|
+
setState((prev) => ({ ...prev, currentCommand: nextCommand !== null && nextCommand !== void 0 ? nextCommand : undefined }));
|
|
149
|
+
setTimeout(() => {
|
|
150
|
+
var _a, _b, _c;
|
|
151
|
+
const attachTo = (_a = state === null || state === void 0 ? void 0 : state.steps[tutorialStep - 1]) === null || _a === void 0 ? void 0 : _a.attachToObject;
|
|
152
|
+
const attachElement = typeof attachTo === "string"
|
|
153
|
+
? document.getElementById(attachTo)
|
|
154
|
+
: (_b = state === null || state === void 0 ? void 0 : state.steps[tutorialStep - 1]) === null || _b === void 0 ? void 0 : _b.attachToObject;
|
|
155
|
+
if (attachElement instanceof HTMLElement) {
|
|
156
|
+
showTutorialAtElement(attachElement, (_c = state.steps[tutorialStep - 1].dontHighlightObject) !== null && _c !== void 0 ? _c : false);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
setTutorialPos(null);
|
|
160
|
+
setHighlightElementRect(null);
|
|
161
|
+
}
|
|
162
|
+
setTutorialStep(prev => prev - 1);
|
|
163
|
+
}, nextCommand != null ? ((_c = state === null || state === void 0 ? void 0 : state.steps[tutorialStep - 1].waitFor) !== null && _c !== void 0 ? _c : TIMEOUT_OVERLAY_WAIT_FOR_COMMAND_EXECUTION_MS) : 0);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
const nextCommand = (_d = state.cancelCommand) !== null && _d !== void 0 ? _d : null;
|
|
167
|
+
setState((prev) => ({ ...prev, currentCommand: nextCommand !== null && nextCommand !== void 0 ? nextCommand : undefined, steps: [] }));
|
|
168
|
+
}
|
|
169
|
+
}, type: "button", className: "px-4 py-2 bg-gray-300 rounded " + (tutorialStep > 0 ? "overlay-essentials-back-button" : "overlay-essentials-cancel-button"), children: tutorialStep > 0 ? ((_k = state === null || state === void 0 ? void 0 : state.backButtonText) !== null && _k !== void 0 ? _k : "Zurück") : ((_l = state === null || state === void 0 ? void 0 : state.cancelButtonText) !== null && _l !== void 0 ? _l : "Überspringen") }), _jsx("button", { onClick: () => {
|
|
170
|
+
var _a, _b, _c, _d;
|
|
171
|
+
if (tutorialStep + 1 < state.steps.length) {
|
|
172
|
+
const nextCommand = (_b = (_a = state.steps[tutorialStep + 1]) === null || _a === void 0 ? void 0 : _a.command) !== null && _b !== void 0 ? _b : null;
|
|
173
|
+
setState((prev) => ({ ...prev, currentCommand: nextCommand !== null && nextCommand !== void 0 ? nextCommand : undefined }));
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
var _a, _b, _c;
|
|
176
|
+
const attachTo = (_a = state === null || state === void 0 ? void 0 : state.steps[tutorialStep + 1]) === null || _a === void 0 ? void 0 : _a.attachToObject;
|
|
177
|
+
const attachElement = typeof attachTo === "string"
|
|
178
|
+
? document.getElementById(attachTo)
|
|
179
|
+
: (_b = state === null || state === void 0 ? void 0 : state.steps[tutorialStep + 1]) === null || _b === void 0 ? void 0 : _b.attachToObject;
|
|
180
|
+
if (attachElement instanceof HTMLElement) {
|
|
181
|
+
showTutorialAtElement(attachElement, (_c = state.steps[tutorialStep + 1].dontHighlightObject) !== null && _c !== void 0 ? _c : false);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
setTutorialPos(null);
|
|
185
|
+
setHighlightElementRect(null);
|
|
186
|
+
}
|
|
187
|
+
setTutorialStep(prev => prev + 1);
|
|
188
|
+
}, nextCommand != null ? (_c = state === null || state === void 0 ? void 0 : state.steps[tutorialStep + 1].waitFor) !== null && _c !== void 0 ? _c : TIMEOUT_OVERLAY_WAIT_FOR_COMMAND_EXECUTION_MS : 0);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
const nextCommand = (_d = state.completeCommand) !== null && _d !== void 0 ? _d : null;
|
|
192
|
+
setState((prev) => ({ ...prev, currentCommand: nextCommand !== null && nextCommand !== void 0 ? nextCommand : undefined, steps: [] }));
|
|
193
|
+
}
|
|
194
|
+
}, ref: proceedButtonRef, type: "button", className: "px-4 py-2 bg-blue-600 text-white rounded " + (tutorialStep > 0 ? "overlay-essentials-proceed-button" : "overlay-essentials-complete-button"), children: tutorialStep < state.steps.length - 1 ? ((_m = state === null || state === void 0 ? void 0 : state.proceedButtonText) !== null && _m !== void 0 ? _m : "Weiter") : ((_o = state === null || state === void 0 ? void 0 : state.completeButtonText) !== null && _o !== void 0 ? _o : "Abschließen") })] })] })] }) : _jsx(_Fragment, {});
|
|
195
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-overlay-essentials",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Eine kleine Ansammlung an praktischen Tools, die out of the Box genutzt werden können. Alle enthaltenen Overlays können als Reaktion auf etwas geöffnet werden und schließen sich danach automatisch. Es beinhaltet: \\n - [ConfirmationBox]: Ein Overlay mit einer ConfirmationBox (Fortfahren / Abbrechen), \\n - [InfoOverlay]: ein simples Overlay mit einer Informationsbox die man bestätigen kann, \\n - [InfoOverlayWithInput]: Ein Overlay bei dem ein User zusätzlich ein Freitext-Feld zur Eingabe hat, \\n - [LoadingOverlay]: Ein simples Overlay mit einer Lade-animation und optionalem Ladetext, \\n - [MultipleChoiceOverlay]: Ein simples Overlay bei dem ein Nutzer aus mehreren gegebenen Aktionen auswählen kann, \\n - [MultipleRadioOverlay]: Ein simples Overlay bei dem ein Nutzer genau eine aus mehreren gegebenen Aktionen auswählen kann, \\n - [Toast]: Ein simpler Toast der für kurze Zeit grün hinterlegt in der oberen rechten Ecke des Bildschirms angezeigt wird, \\n - [ToggleSwitch]: Eine Auswahl aus zwei Optionen aus denen ein Nutzer wählen kann in der Darstellung (Option 1 | Option 2), \\n - [Dropdown]: Ein simples Dropdown-Menü (auf Basis von react-select), welches einfacherer zu Konfigurieren ist und einige default-Einstellungen hat, \\n - [InputFilter]: Ein Tool was genutzt werden kann um auf einem Inputfeld einen Regex-Filter anzuwenden und dem User so nur Eingaben erlaubt die dem Filter entsprechen.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|