@netlib/widerrufsbutton 1.0.5
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/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/api.d.ts +2 -0
- package/dist/components/WiderrufsModal.d.ts +7 -0
- package/dist/components/WiderrufsWidget.d.ts +6 -0
- package/dist/index.cjs.js +203 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +459 -0
- package/dist/styles.d.ts +2 -0
- package/dist/types.d.ts +28 -0
- package/dist/widerrufsbutton.iife.js +242 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 netlib-de
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Widerrufsbutton Widget
|
|
2
|
+
|
|
3
|
+
Widerrufsformular einbettbares JavaScript-Widget (React + TypeScript, IIFE-Build).
|
|
4
|
+
|
|
5
|
+
## Rechtliche Grundlage
|
|
6
|
+
|
|
7
|
+
Pflichtfelder laut IT-Recht Kanzlei / § 356 BGB:
|
|
8
|
+
- **Name** des Verbrauchers
|
|
9
|
+
- **E-Mail-Adresse** (für die gesetzlich vorgeschriebene Eingangsbestätigung)
|
|
10
|
+
- **Bestell- / Auftrags- / Vertragsnummer** (Vertragsidentifikation)
|
|
11
|
+
- **Datum** der Widerrufserklärung (automatisch gesetzt)
|
|
12
|
+
- **Widerrufsgrund** — optional, darf nicht als Pflichtfeld abgefragt werden
|
|
13
|
+
|
|
14
|
+
Button-Beschriftung: `Vertrag widerrufen`
|
|
15
|
+
Bestätigungs-Button: `Widerruf bestätigen`
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @netlib-de/widerrufsbutton
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Build
|
|
24
|
+
|
|
25
|
+
Benötigt Node.js ≥ 20 (`.nvmrc` auf `22` gesetzt).
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
nvm use
|
|
29
|
+
npm install
|
|
30
|
+
|
|
31
|
+
# Dev-Server (Demo unter http://localhost:5173)
|
|
32
|
+
npm run dev
|
|
33
|
+
|
|
34
|
+
# Produktions-Build (IIFE → dist/widerrufsbutton.iife.js)
|
|
35
|
+
npm run build:lib
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## API-Integration
|
|
39
|
+
|
|
40
|
+
Das Widget schickt beim Absenden einen `PATCH`-Request:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
PATCH /your-endpoint
|
|
44
|
+
Content-Type: application/json
|
|
45
|
+
|
|
46
|
+
{
|
|
47
|
+
"action": "widerruf_submit",
|
|
48
|
+
"payload": {
|
|
49
|
+
"name": "Max Mustermann",
|
|
50
|
+
"email": "max@beispiel.de",
|
|
51
|
+
"vertragId": "ORD-2026-001",
|
|
52
|
+
"widerrufsgrund": "",
|
|
53
|
+
"datum": "2026-06-07T10:00:00.000Z"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Konfigurationsparameter
|
|
59
|
+
|
|
60
|
+
| Parameter | Typ | Pflicht | Beschreibung |
|
|
61
|
+
|---|---|---|---|
|
|
62
|
+
| `apiUrl` | string | ja | PATCH-Endpunkt |
|
|
63
|
+
| `action` | string | ja | Action-Name, Default: `widerruf_submit` |
|
|
64
|
+
| `introText` | string | – | Einleitungstext im Modal |
|
|
65
|
+
| `companyName` | string | – | Firmenname im Modal-Titel |
|
|
66
|
+
| `buttonLabel` | string | – | Button-Beschriftung, Default: `Vertrag widerrufen` |
|
|
67
|
+
| `cancelLabel` | string | – | Abbrechen-Button, Default: `Abbrechen` |
|
|
68
|
+
| `submitLabel` | string | – | Absenden-Button, Default: `Widerruf bestätigen` |
|
|
69
|
+
| `buttonClass` | string | – | Zusätzliche CSS-Klassen am Button |
|
|
70
|
+
| `authToken` | string | – | Bearer-Token für `Authorization`-Header |
|
|
71
|
+
|
|
72
|
+
## Einbindung
|
|
73
|
+
|
|
74
|
+
### Option A – React / Astro
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { WiderrufsWidget } from '@netlib-de/widerrufsbutton'
|
|
78
|
+
|
|
79
|
+
<WiderrufsWidget config={{
|
|
80
|
+
apiUrl: 'https://example.com/api',
|
|
81
|
+
action: 'widerruf_submit',
|
|
82
|
+
companyName: 'Muster GmbH',
|
|
83
|
+
introText: 'Hiermit erkläre ich den Widerruf...',
|
|
84
|
+
}} />
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Option B – IIFE / Data-Attribute (kein Framework nötig)
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<script src="widerrufsbutton.iife.js" defer></script>
|
|
91
|
+
|
|
92
|
+
<button
|
|
93
|
+
data-widerrufs
|
|
94
|
+
data-api-url="https://example.com/api"
|
|
95
|
+
data-action="widerruf_submit"
|
|
96
|
+
data-company-name="Muster GmbH"
|
|
97
|
+
data-intro-text="Hiermit erkläre ich den Widerruf..."
|
|
98
|
+
>Vertrag widerrufen</button>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Das Script erkennt alle `[data-widerrufs]`-Elemente beim `DOMContentLoaded` automatisch.
|
|
102
|
+
|
|
103
|
+
### Option C – IIFE / JavaScript-API
|
|
104
|
+
|
|
105
|
+
```html
|
|
106
|
+
<script src="widerrufsbutton.iife.js" defer></script>
|
|
107
|
+
<div id="wrb-container"></div>
|
|
108
|
+
<script>
|
|
109
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
110
|
+
WiderrufsButton.render('#wrb-container', {
|
|
111
|
+
apiUrl: 'https://example.com/api',
|
|
112
|
+
action: 'widerruf_submit',
|
|
113
|
+
companyName: 'Muster GmbH',
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
</script>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Projektstruktur
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
src/
|
|
123
|
+
├── components/
|
|
124
|
+
│ ├── WiderrufsModal.tsx # Modal + Formular + Validierung
|
|
125
|
+
│ └── WiderrufsWidget.tsx # Button + Portal-Mount
|
|
126
|
+
├── api.ts # PATCH-Request
|
|
127
|
+
├── embed.tsx # IIFE-Einstiegspunkt, window.WiderrufsButton
|
|
128
|
+
├── styles.ts # Scoped CSS (Prefix: wrb-)
|
|
129
|
+
└── types.ts # WiderrufsConfig, WiderrufsFormData
|
|
130
|
+
dist/
|
|
131
|
+
├── index.es.js # ES-Modul für React/Astro
|
|
132
|
+
├── index.cjs.js # CommonJS
|
|
133
|
+
└── widerrufsbutton.iife.js # Standalone-Bundle (~152 KB, gzip ~49 KB)
|
|
134
|
+
```
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),I=require("react-dom");async function W(r,a){const n={"Content-Type":"application/json"};r.authToken&&(n.Authorization=`Bearer ${r.authToken}`);const d={action:r.action,payload:{...a,datum:new Date().toISOString()}},i=await fetch(r.apiUrl,{method:"PATCH",headers:n,body:JSON.stringify(d)});if(!i.ok)throw new Error(`Server antwortete mit Status ${i.status}`)}const k=new Date().toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),B={name:"",email:"",vertragId:"",widerrufsgrund:"",datum:k};function h(r){const a={};return r.name.trim()||(a.name="Bitte geben Sie Ihren Namen an."),r.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r.email)||(a.email="Bitte geben Sie eine gültige E-Mail-Adresse an."):a.email="Bitte geben Sie Ihre E-Mail-Adresse an.",r.vertragId.trim()||(a.vertragId="Bitte geben Sie die Bestellnummer oder Vertragsnummer an."),a}function N({config:r,onClose:a}){const[n,d]=s.useState(B),[i,x]=s.useState({}),[c,w]=s.useState({}),[p,f]=s.useState("idle"),[y,v]=s.useState(""),j=s.useRef(null);s.useEffect(()=>{var l;(l=j.current)==null||l.focus();const t=o=>o.key==="Escape"&&a();return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[a]);function m(t,l){const o={...n,[t]:l};if(d(o),c[t]){const b=h(o);x(z=>({...z,[t]:b[t]}))}}function g(t){w(o=>({...o,[t]:!0}));const l=h(n);x(o=>({...o,[t]:l[t]}))}async function S(t){t.preventDefault();const l=Object.fromEntries(Object.keys(n).map(b=>[b,!0]));w(l);const o=h(n);if(x(o),!(Object.keys(o).length>0)){f("loading"),v("");try{await W(r,n),f("success")}catch(b){v(b instanceof Error?b.message:"Ein unbekannter Fehler ist aufgetreten."),f("error")}}}const E=r.companyName?`Widerruf – ${r.companyName}`:"Widerrufsformular";return e.jsx("div",{className:"wrb-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"wrb-title",onClick:t=>t.target===t.currentTarget&&a(),children:e.jsxs("div",{className:"wrb-modal",children:[e.jsxs("div",{className:"wrb-modal-header",children:[e.jsx("h2",{className:"wrb-modal-title",id:"wrb-title",children:E}),e.jsx("button",{className:"wrb-close-btn",onClick:a,"aria-label":"Schließen",type:"button",children:"✕"})]}),p==="success"?e.jsxs("div",{className:"wrb-success",children:[e.jsx("span",{className:"wrb-success-icon",children:"✓"}),e.jsx("h3",{children:"Widerruf eingegangen"}),e.jsxs("p",{children:["Ihr Widerruf wurde erfolgreich übermittelt. Sie erhalten in Kürze eine Bestätigung an ",e.jsx("strong",{children:n.email}),"."]})]}):e.jsxs("div",{className:"wrb-modal-body",children:[r.introText&&e.jsx("p",{className:"wrb-intro",children:r.introText}),p==="error"&&y&&e.jsx("div",{className:"wrb-alert wrb-alert-error",role:"alert",children:y}),e.jsxs("form",{onSubmit:S,noValidate:!0,children:[e.jsx(u,{label:"Name",required:!0,error:c.name?i.name:void 0,children:e.jsx("input",{ref:j,className:`wrb-input${c.name&&i.name?" wrb-error":""}`,type:"text",autoComplete:"name",value:n.name,onChange:t=>m("name",t.target.value),onBlur:()=>g("name"),placeholder:"Vor- und Nachname"})}),e.jsx(u,{label:"E-Mail-Adresse",required:!0,hint:"Hierüber erhalten Sie die Eingangsbestätigung.",error:c.email?i.email:void 0,children:e.jsx("input",{className:`wrb-input${c.email&&i.email?" wrb-error":""}`,type:"email",autoComplete:"email",value:n.email,onChange:t=>m("email",t.target.value),onBlur:()=>g("email"),placeholder:"name@beispiel.de"})}),e.jsx(u,{label:"Bestell- / Auftrags- / Vertragsnummer",required:!0,hint:"Zu finden in Ihrer Bestellbestätigung.",error:c.vertragId?i.vertragId:void 0,children:e.jsx("input",{className:`wrb-input${c.vertragId&&i.vertragId?" wrb-error":""}`,type:"text",value:n.vertragId,onChange:t=>m("vertragId",t.target.value),onBlur:()=>g("vertragId"),placeholder:"z.B. 10045678"})}),e.jsx(u,{label:"Widerrufsgrund",hint:"Freiwillige Angabe – ein Widerruf ist ohne Angabe von Gründen möglich.",children:e.jsx("textarea",{className:"wrb-textarea",value:n.widerrufsgrund,onChange:t=>m("widerrufsgrund",t.target.value),placeholder:"Optional",rows:3})}),e.jsx(u,{label:"Datum der Widerrufserklärung",children:e.jsx("div",{className:"wrb-date-display",children:k})}),e.jsxs("div",{className:"wrb-actions",children:[e.jsx("button",{type:"button",className:"wrb-cancel-btn",onClick:a,children:r.cancelLabel??"Abbrechen"}),e.jsx("button",{type:"submit",className:"wrb-submit-btn",disabled:p==="loading",children:p==="loading"?"Wird gesendet…":r.submitLabel??"Absenden"})]})]})]})]})})}function u({label:r,required:a,hint:n,error:d,children:i}){return e.jsxs("div",{className:"wrb-field",children:[e.jsxs("label",{className:"wrb-label",children:[r,a&&e.jsx("span",{className:"wrb-required","aria-hidden":"true",children:"*"})]}),i,n&&!d&&e.jsx("p",{className:"wrb-hint",children:n}),d&&e.jsx("p",{className:"wrb-field-error",role:"alert",children:d})]})}function C(){const r="wrb-styles";if(document.getElementById(r))return;const a=`
|
|
2
|
+
/* Widerrufsbutton widget — prefix: wrb- */
|
|
3
|
+
.wrb-btn {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: 6px;
|
|
7
|
+
padding: 10px 20px;
|
|
8
|
+
background: #c0392b;
|
|
9
|
+
color: #fff;
|
|
10
|
+
border: none;
|
|
11
|
+
border-radius: 6px;
|
|
12
|
+
font-size: 15px;
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
font-family: inherit;
|
|
16
|
+
transition: background 0.2s;
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
}
|
|
19
|
+
.wrb-btn:hover { background: #a93226; }
|
|
20
|
+
.wrb-btn:focus-visible { outline: 3px solid #e74c3c; outline-offset: 2px; }
|
|
21
|
+
|
|
22
|
+
/* Overlay */
|
|
23
|
+
.wrb-overlay {
|
|
24
|
+
position: fixed;
|
|
25
|
+
inset: 0;
|
|
26
|
+
background: rgba(0,0,0,0.55);
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
z-index: 99999;
|
|
31
|
+
padding: 16px;
|
|
32
|
+
animation: wrb-fade-in 0.15s ease;
|
|
33
|
+
}
|
|
34
|
+
@keyframes wrb-fade-in { from { opacity: 0 } to { opacity: 1 } }
|
|
35
|
+
|
|
36
|
+
/* Modal box */
|
|
37
|
+
.wrb-modal {
|
|
38
|
+
background: #fff;
|
|
39
|
+
border-radius: 10px;
|
|
40
|
+
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
|
|
41
|
+
width: 100%;
|
|
42
|
+
max-width: 540px;
|
|
43
|
+
max-height: 90vh;
|
|
44
|
+
overflow-y: auto;
|
|
45
|
+
animation: wrb-slide-up 0.2s ease;
|
|
46
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
47
|
+
font-size: 15px;
|
|
48
|
+
color: #1a1a1a;
|
|
49
|
+
}
|
|
50
|
+
@keyframes wrb-slide-up { from { transform: translateY(20px); opacity: 0 } to { transform: none; opacity: 1 } }
|
|
51
|
+
|
|
52
|
+
.wrb-modal-header {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: flex-start;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
padding: 20px 24px 16px;
|
|
57
|
+
border-bottom: 1px solid #e5e7eb;
|
|
58
|
+
gap: 12px;
|
|
59
|
+
}
|
|
60
|
+
.wrb-modal-title {
|
|
61
|
+
margin: 0;
|
|
62
|
+
font-size: 18px;
|
|
63
|
+
font-weight: 700;
|
|
64
|
+
color: #111;
|
|
65
|
+
line-height: 1.3;
|
|
66
|
+
}
|
|
67
|
+
.wrb-close-btn {
|
|
68
|
+
background: none;
|
|
69
|
+
border: none;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
color: #6b7280;
|
|
72
|
+
padding: 4px;
|
|
73
|
+
border-radius: 4px;
|
|
74
|
+
font-size: 20px;
|
|
75
|
+
line-height: 1;
|
|
76
|
+
flex-shrink: 0;
|
|
77
|
+
}
|
|
78
|
+
.wrb-close-btn:hover { color: #111; background: #f3f4f6; }
|
|
79
|
+
|
|
80
|
+
.wrb-modal-body {
|
|
81
|
+
padding: 20px 24px 24px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.wrb-intro {
|
|
85
|
+
margin: 0 0 20px;
|
|
86
|
+
color: #4b5563;
|
|
87
|
+
line-height: 1.6;
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Form */
|
|
92
|
+
.wrb-field {
|
|
93
|
+
margin-bottom: 16px;
|
|
94
|
+
}
|
|
95
|
+
.wrb-label {
|
|
96
|
+
display: block;
|
|
97
|
+
font-size: 13px;
|
|
98
|
+
font-weight: 600;
|
|
99
|
+
color: #374151;
|
|
100
|
+
margin-bottom: 5px;
|
|
101
|
+
}
|
|
102
|
+
.wrb-required {
|
|
103
|
+
color: #c0392b;
|
|
104
|
+
margin-left: 2px;
|
|
105
|
+
}
|
|
106
|
+
.wrb-input,
|
|
107
|
+
.wrb-textarea {
|
|
108
|
+
width: 100%;
|
|
109
|
+
padding: 9px 12px;
|
|
110
|
+
border: 1.5px solid #d1d5db;
|
|
111
|
+
border-radius: 6px;
|
|
112
|
+
font-size: 15px;
|
|
113
|
+
font-family: inherit;
|
|
114
|
+
color: #111;
|
|
115
|
+
background: #fff;
|
|
116
|
+
box-sizing: border-box;
|
|
117
|
+
transition: border-color 0.15s;
|
|
118
|
+
}
|
|
119
|
+
.wrb-input:focus,
|
|
120
|
+
.wrb-textarea:focus {
|
|
121
|
+
outline: none;
|
|
122
|
+
border-color: #c0392b;
|
|
123
|
+
box-shadow: 0 0 0 3px rgba(192,57,43,0.12);
|
|
124
|
+
}
|
|
125
|
+
.wrb-input.wrb-error,
|
|
126
|
+
.wrb-textarea.wrb-error {
|
|
127
|
+
border-color: #c0392b;
|
|
128
|
+
}
|
|
129
|
+
.wrb-field-error {
|
|
130
|
+
color: #c0392b;
|
|
131
|
+
font-size: 12px;
|
|
132
|
+
margin-top: 4px;
|
|
133
|
+
}
|
|
134
|
+
.wrb-textarea { resize: vertical; min-height: 80px; }
|
|
135
|
+
|
|
136
|
+
.wrb-hint {
|
|
137
|
+
font-size: 12px;
|
|
138
|
+
color: #6b7280;
|
|
139
|
+
margin-top: 4px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.wrb-date-display {
|
|
143
|
+
padding: 9px 12px;
|
|
144
|
+
background: #f9fafb;
|
|
145
|
+
border: 1.5px solid #e5e7eb;
|
|
146
|
+
border-radius: 6px;
|
|
147
|
+
color: #6b7280;
|
|
148
|
+
font-size: 15px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Actions */
|
|
152
|
+
.wrb-actions {
|
|
153
|
+
display: flex;
|
|
154
|
+
gap: 10px;
|
|
155
|
+
justify-content: flex-end;
|
|
156
|
+
margin-top: 24px;
|
|
157
|
+
padding-top: 16px;
|
|
158
|
+
border-top: 1px solid #e5e7eb;
|
|
159
|
+
}
|
|
160
|
+
.wrb-submit-btn {
|
|
161
|
+
padding: 10px 22px;
|
|
162
|
+
background: #c0392b;
|
|
163
|
+
color: #fff;
|
|
164
|
+
border: none;
|
|
165
|
+
border-radius: 6px;
|
|
166
|
+
font-size: 15px;
|
|
167
|
+
font-weight: 600;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
font-family: inherit;
|
|
170
|
+
transition: background 0.2s;
|
|
171
|
+
}
|
|
172
|
+
.wrb-submit-btn:hover:not(:disabled) { background: #a93226; }
|
|
173
|
+
.wrb-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
|
|
174
|
+
.wrb-cancel-btn {
|
|
175
|
+
padding: 10px 18px;
|
|
176
|
+
background: transparent;
|
|
177
|
+
color: #374151;
|
|
178
|
+
border: 1.5px solid #d1d5db;
|
|
179
|
+
border-radius: 6px;
|
|
180
|
+
font-size: 15px;
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
font-family: inherit;
|
|
183
|
+
transition: background 0.15s;
|
|
184
|
+
}
|
|
185
|
+
.wrb-cancel-btn:hover { background: #f3f4f6; }
|
|
186
|
+
|
|
187
|
+
/* Success / Error states */
|
|
188
|
+
.wrb-success {
|
|
189
|
+
text-align: center;
|
|
190
|
+
padding: 32px 24px;
|
|
191
|
+
}
|
|
192
|
+
.wrb-success-icon { font-size: 48px; display: block; margin-bottom: 12px; }
|
|
193
|
+
.wrb-success h3 { margin: 0 0 8px; font-size: 20px; color: #111; }
|
|
194
|
+
.wrb-success p { margin: 0; color: #4b5563; line-height: 1.6; }
|
|
195
|
+
|
|
196
|
+
.wrb-alert {
|
|
197
|
+
padding: 12px 16px;
|
|
198
|
+
border-radius: 6px;
|
|
199
|
+
margin-bottom: 16px;
|
|
200
|
+
font-size: 14px;
|
|
201
|
+
}
|
|
202
|
+
.wrb-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
|
|
203
|
+
`,n=document.createElement("style");n.id=r,n.textContent=a,document.head.appendChild(n)}function A({config:r}){const[a,n]=s.useState(!1);return s.useEffect(()=>{C()},[]),e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:`wrb-btn${r.buttonClass?` ${r.buttonClass}`:""}`,onClick:()=>n(!0),children:r.buttonLabel??"Vertrag widerrufen"}),a&&I.createPortal(e.jsx(N,{config:r,onClose:()=>n(!1)}),document.body)]})}exports.WiderrufsModal=N;exports.WiderrufsWidget=A;
|
package/dist/index.d.ts
ADDED