@kya-os/consent 0.2.3 → 0.4.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/README.md +223 -4
- package/dist/bundle/index.d.ts +10 -0
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/index.js +10 -0
- package/dist/bundle/index.js.map +1 -1
- package/dist/bundle/inline.d.ts.map +1 -1
- package/dist/bundle/inline.js +4 -4
- package/dist/bundle/inline.js.map +1 -1
- package/dist/cjs/bundle/index.js +10 -0
- package/dist/cjs/bundle/index.js.map +1 -1
- package/dist/cjs/bundle/inline.js +4 -4
- package/dist/cjs/bundle/inline.js.map +1 -1
- package/dist/cjs/components/consent-action-bar.js +66 -15
- package/dist/cjs/components/consent-action-bar.js.map +1 -1
- package/dist/cjs/components/consent-agent-header.js +5 -1
- package/dist/cjs/components/consent-agent-header.js.map +1 -1
- package/dist/cjs/components/consent-capabilities-screen.js +56 -4
- package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
- package/dist/cjs/components/consent-capability-card.js +75 -24
- package/dist/cjs/components/consent-capability-card.js.map +1 -1
- package/dist/cjs/components/consent-checkbox.js +2 -2
- package/dist/cjs/components/consent-checkbox.js.map +1 -1
- package/dist/cjs/components/consent-duration.js +187 -0
- package/dist/cjs/components/consent-duration.js.map +1 -0
- package/dist/cjs/components/consent-folder-scope.js +169 -0
- package/dist/cjs/components/consent-folder-scope.js.map +1 -0
- package/dist/cjs/components/consent-footer.js +13 -2
- package/dist/cjs/components/consent-footer.js.map +1 -1
- package/dist/cjs/components/consent-grant-terms.js +321 -0
- package/dist/cjs/components/consent-grant-terms.js.map +1 -0
- package/dist/cjs/components/consent-headline.js +50 -1
- package/dist/cjs/components/consent-headline.js.map +1 -1
- package/dist/cjs/components/consent-input.js +47 -27
- package/dist/cjs/components/consent-input.js.map +1 -1
- package/dist/cjs/components/consent-otp-input.js +49 -42
- package/dist/cjs/components/consent-otp-input.js.map +1 -1
- package/dist/cjs/components/consent-phone-handoff.js +219 -0
- package/dist/cjs/components/consent-phone-handoff.js.map +1 -0
- package/dist/cjs/components/consent-request-expiry.js +159 -0
- package/dist/cjs/components/consent-request-expiry.js.map +1 -0
- package/dist/cjs/components/consent-revoke.js +308 -0
- package/dist/cjs/components/consent-revoke.js.map +1 -0
- package/dist/cjs/components/consent-shell.js +3 -0
- package/dist/cjs/components/consent-shell.js.map +1 -1
- package/dist/cjs/components/consent-terms.js +2 -2
- package/dist/cjs/components/consent-terms.js.map +1 -1
- package/dist/cjs/components/consent-wallet-check.js +107 -0
- package/dist/cjs/components/consent-wallet-check.js.map +1 -0
- package/dist/cjs/components/consent-wallet-notice.js +189 -0
- package/dist/cjs/components/consent-wallet-notice.js.map +1 -0
- package/dist/cjs/components/consent-wallet-orb.js +273 -0
- package/dist/cjs/components/consent-wallet-orb.js.map +1 -0
- package/dist/cjs/components/consent-wallet-signature.js +104 -0
- package/dist/cjs/components/consent-wallet-signature.js.map +1 -0
- package/dist/cjs/components/grant-field-styles.js +85 -0
- package/dist/cjs/components/grant-field-styles.js.map +1 -0
- package/dist/cjs/components/index.js +33 -1
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/components/mcp-consent.js +18 -1
- package/dist/cjs/components/mcp-consent.js.map +1 -1
- package/dist/cjs/components/template-link.js +32 -0
- package/dist/cjs/components/template-link.js.map +1 -0
- package/dist/cjs/components/wallet-globe.js +184 -0
- package/dist/cjs/components/wallet-globe.js.map +1 -0
- package/dist/cjs/components/wallet-icons.js +19 -0
- package/dist/cjs/components/wallet-icons.js.map +1 -0
- package/dist/cjs/components/wallet-status.js +34 -0
- package/dist/cjs/components/wallet-status.js.map +1 -0
- package/dist/cjs/constants/capabilities.js +11 -2
- package/dist/cjs/constants/capabilities.js.map +1 -1
- package/dist/cjs/copy/tokens.js +91 -0
- package/dist/cjs/copy/tokens.js.map +1 -1
- package/dist/cjs/grant/index.js +24 -0
- package/dist/cjs/grant/index.js.map +1 -0
- package/dist/cjs/grant/terms.js +148 -0
- package/dist/cjs/grant/terms.js.map +1 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mcp-app/inline.js +2 -2
- package/dist/cjs/mcp-app/inline.js.map +1 -1
- package/dist/cjs/react/index.js +120 -1
- package/dist/cjs/react/index.js.map +1 -1
- package/dist/components/consent-action-bar.d.ts +17 -0
- package/dist/components/consent-action-bar.d.ts.map +1 -1
- package/dist/components/consent-action-bar.js +67 -16
- package/dist/components/consent-action-bar.js.map +1 -1
- package/dist/components/consent-agent-header.d.ts.map +1 -1
- package/dist/components/consent-agent-header.js +5 -1
- package/dist/components/consent-agent-header.js.map +1 -1
- package/dist/components/consent-capabilities-screen.d.ts +24 -3
- package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
- package/dist/components/consent-capabilities-screen.js +54 -3
- package/dist/components/consent-capabilities-screen.js.map +1 -1
- package/dist/components/consent-capability-card.d.ts +19 -2
- package/dist/components/consent-capability-card.d.ts.map +1 -1
- package/dist/components/consent-capability-card.js +74 -23
- package/dist/components/consent-capability-card.js.map +1 -1
- package/dist/components/consent-checkbox.d.ts +1 -1
- package/dist/components/consent-checkbox.js +2 -2
- package/dist/components/consent-checkbox.js.map +1 -1
- package/dist/components/consent-duration.d.ts +64 -0
- package/dist/components/consent-duration.d.ts.map +1 -0
- package/dist/components/consent-duration.js +184 -0
- package/dist/components/consent-duration.js.map +1 -0
- package/dist/components/consent-folder-scope.d.ts +70 -0
- package/dist/components/consent-folder-scope.d.ts.map +1 -0
- package/dist/components/consent-folder-scope.js +166 -0
- package/dist/components/consent-folder-scope.js.map +1 -0
- package/dist/components/consent-footer.d.ts.map +1 -1
- package/dist/components/consent-footer.js +13 -2
- package/dist/components/consent-footer.js.map +1 -1
- package/dist/components/consent-grant-terms.d.ts +88 -0
- package/dist/components/consent-grant-terms.d.ts.map +1 -0
- package/dist/components/consent-grant-terms.js +318 -0
- package/dist/components/consent-grant-terms.js.map +1 -0
- package/dist/components/consent-headline.d.ts +25 -0
- package/dist/components/consent-headline.d.ts.map +1 -1
- package/dist/components/consent-headline.js +52 -3
- package/dist/components/consent-headline.js.map +1 -1
- package/dist/components/consent-input.d.ts +4 -4
- package/dist/components/consent-input.d.ts.map +1 -1
- package/dist/components/consent-input.js +49 -29
- package/dist/components/consent-input.js.map +1 -1
- package/dist/components/consent-otp-input.d.ts +4 -4
- package/dist/components/consent-otp-input.d.ts.map +1 -1
- package/dist/components/consent-otp-input.js +51 -44
- package/dist/components/consent-otp-input.js.map +1 -1
- package/dist/components/consent-phone-handoff.d.ts +50 -0
- package/dist/components/consent-phone-handoff.d.ts.map +1 -0
- package/dist/components/consent-phone-handoff.js +215 -0
- package/dist/components/consent-phone-handoff.js.map +1 -0
- package/dist/components/consent-request-expiry.d.ts +52 -0
- package/dist/components/consent-request-expiry.d.ts.map +1 -0
- package/dist/components/consent-request-expiry.js +154 -0
- package/dist/components/consent-request-expiry.js.map +1 -0
- package/dist/components/consent-revoke.d.ts +53 -0
- package/dist/components/consent-revoke.d.ts.map +1 -0
- package/dist/components/consent-revoke.js +305 -0
- package/dist/components/consent-revoke.js.map +1 -0
- package/dist/components/consent-shell.d.ts.map +1 -1
- package/dist/components/consent-shell.js +3 -0
- package/dist/components/consent-shell.js.map +1 -1
- package/dist/components/consent-terms.d.ts +1 -1
- package/dist/components/consent-terms.js +2 -2
- package/dist/components/consent-terms.js.map +1 -1
- package/dist/components/consent-wallet-check.d.ts +45 -0
- package/dist/components/consent-wallet-check.d.ts.map +1 -0
- package/dist/components/consent-wallet-check.js +102 -0
- package/dist/components/consent-wallet-check.js.map +1 -0
- package/dist/components/consent-wallet-notice.d.ts +54 -0
- package/dist/components/consent-wallet-notice.d.ts.map +1 -0
- package/dist/components/consent-wallet-notice.js +186 -0
- package/dist/components/consent-wallet-notice.js.map +1 -0
- package/dist/components/consent-wallet-orb.d.ts +48 -0
- package/dist/components/consent-wallet-orb.d.ts.map +1 -0
- package/dist/components/consent-wallet-orb.js +269 -0
- package/dist/components/consent-wallet-orb.js.map +1 -0
- package/dist/components/consent-wallet-signature.d.ts +26 -0
- package/dist/components/consent-wallet-signature.d.ts.map +1 -0
- package/dist/components/consent-wallet-signature.js +101 -0
- package/dist/components/consent-wallet-signature.js.map +1 -0
- package/dist/components/grant-field-styles.d.ts +9 -0
- package/dist/components/grant-field-styles.d.ts.map +1 -0
- package/dist/components/grant-field-styles.js +82 -0
- package/dist/components/grant-field-styles.js.map +1 -0
- package/dist/components/index.d.ts +11 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +14 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/mcp-consent.d.ts.map +1 -1
- package/dist/components/mcp-consent.js +18 -1
- package/dist/components/mcp-consent.js.map +1 -1
- package/dist/components/template-link.d.ts +24 -0
- package/dist/components/template-link.d.ts.map +1 -0
- package/dist/components/template-link.js +29 -0
- package/dist/components/template-link.js.map +1 -0
- package/dist/components/wallet-globe.d.ts +29 -0
- package/dist/components/wallet-globe.d.ts.map +1 -0
- package/dist/components/wallet-globe.js +181 -0
- package/dist/components/wallet-globe.js.map +1 -0
- package/dist/components/wallet-icons.d.ts +16 -0
- package/dist/components/wallet-icons.d.ts.map +1 -0
- package/dist/components/wallet-icons.js +16 -0
- package/dist/components/wallet-icons.js.map +1 -0
- package/dist/components/wallet-status.d.ts +19 -0
- package/dist/components/wallet-status.d.ts.map +1 -0
- package/dist/components/wallet-status.js +29 -0
- package/dist/components/wallet-status.js.map +1 -0
- package/dist/consent.js +3246 -807
- package/dist/consent.min.js +1360 -281
- package/dist/constants/capabilities.d.ts +5 -2
- package/dist/constants/capabilities.d.ts.map +1 -1
- package/dist/constants/capabilities.js +11 -2
- package/dist/constants/capabilities.js.map +1 -1
- package/dist/copy/tokens.d.ts +91 -0
- package/dist/copy/tokens.d.ts.map +1 -1
- package/dist/copy/tokens.js +91 -0
- package/dist/copy/tokens.js.map +1 -1
- package/dist/grant/index.d.ts +8 -0
- package/dist/grant/index.d.ts.map +1 -0
- package/dist/grant/index.js +8 -0
- package/dist/grant/index.js.map +1 -0
- package/dist/grant/terms.d.ts +97 -0
- package/dist/grant/terms.d.ts.map +1 -0
- package/dist/grant/terms.js +139 -0
- package/dist/grant/terms.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-app/inline.d.ts.map +1 -1
- package/dist/mcp-app/inline.js +2 -2
- package/dist/mcp-app/inline.js.map +1 -1
- package/dist/react/index.d.ts +74 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +119 -0
- package/dist/react/index.js.map +1 -1
- package/package.json +10 -4
|
@@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
|
-
import { LitElement, html, css } from
|
|
16
|
-
import { customElement, property, state } from
|
|
15
|
+
import { LitElement, html, css } from "lit";
|
|
16
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
17
17
|
/**
|
|
18
18
|
* ConsentInput - A themed input component with label
|
|
19
19
|
*
|
|
@@ -40,23 +40,23 @@ let ConsentInput = class ConsentInput extends LitElement {
|
|
|
40
40
|
/**
|
|
41
41
|
* Input type
|
|
42
42
|
*/
|
|
43
|
-
this.type =
|
|
43
|
+
this.type = "text";
|
|
44
44
|
/**
|
|
45
|
-
* Form field name
|
|
45
|
+
* Form field name. Reflected: a form reads the attribute.
|
|
46
46
|
*/
|
|
47
|
-
this.name =
|
|
47
|
+
this.name = "";
|
|
48
48
|
/**
|
|
49
49
|
* Input value
|
|
50
50
|
*/
|
|
51
|
-
this.value =
|
|
51
|
+
this.value = "";
|
|
52
52
|
/**
|
|
53
53
|
* Label text
|
|
54
54
|
*/
|
|
55
|
-
this.label =
|
|
55
|
+
this.label = "";
|
|
56
56
|
/**
|
|
57
57
|
* Placeholder text
|
|
58
58
|
*/
|
|
59
|
-
this.placeholder =
|
|
59
|
+
this.placeholder = "";
|
|
60
60
|
/**
|
|
61
61
|
* Required for form validation
|
|
62
62
|
*/
|
|
@@ -68,7 +68,7 @@ let ConsentInput = class ConsentInput extends LitElement {
|
|
|
68
68
|
/**
|
|
69
69
|
* Autocomplete attribute
|
|
70
70
|
*/
|
|
71
|
-
this.autocomplete =
|
|
71
|
+
this.autocomplete = "";
|
|
72
72
|
/**
|
|
73
73
|
* Show password toggle for password inputs
|
|
74
74
|
*/
|
|
@@ -77,7 +77,7 @@ let ConsentInput = class ConsentInput extends LitElement {
|
|
|
77
77
|
}
|
|
78
78
|
// Update form value when properties change
|
|
79
79
|
updated(changedProperties) {
|
|
80
|
-
if (changedProperties.has(
|
|
80
|
+
if (changedProperties.has("value")) {
|
|
81
81
|
this.internals.setFormValue(this.value || null);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -85,7 +85,7 @@ let ConsentInput = class ConsentInput extends LitElement {
|
|
|
85
85
|
const input = e.target;
|
|
86
86
|
this.value = input.value;
|
|
87
87
|
this.internals.setFormValue(this.value || null);
|
|
88
|
-
this.dispatchEvent(new CustomEvent(
|
|
88
|
+
this.dispatchEvent(new CustomEvent("input", {
|
|
89
89
|
detail: { value: this.value },
|
|
90
90
|
bubbles: true,
|
|
91
91
|
composed: true,
|
|
@@ -94,7 +94,7 @@ let ConsentInput = class ConsentInput extends LitElement {
|
|
|
94
94
|
handleChange(e) {
|
|
95
95
|
const input = e.target;
|
|
96
96
|
this.value = input.value;
|
|
97
|
-
this.dispatchEvent(new CustomEvent(
|
|
97
|
+
this.dispatchEvent(new CustomEvent("change", {
|
|
98
98
|
detail: { value: this.value },
|
|
99
99
|
bubbles: true,
|
|
100
100
|
composed: true,
|
|
@@ -104,19 +104,33 @@ let ConsentInput = class ConsentInput extends LitElement {
|
|
|
104
104
|
this.showPassword = !this.showPassword;
|
|
105
105
|
}
|
|
106
106
|
renderPasswordToggle() {
|
|
107
|
-
if (this.type !==
|
|
107
|
+
if (this.type !== "password")
|
|
108
108
|
return null;
|
|
109
109
|
const icon = this.showPassword
|
|
110
110
|
? html `
|
|
111
|
-
<svg
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
<svg
|
|
112
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
113
|
+
viewBox="0 0 24 24"
|
|
114
|
+
fill="none"
|
|
115
|
+
stroke="currentColor"
|
|
116
|
+
stroke-width="2"
|
|
117
|
+
>
|
|
118
|
+
<path
|
|
119
|
+
d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"
|
|
120
|
+
/>
|
|
121
|
+
<line x1="1" y1="1" x2="23" y2="23" />
|
|
114
122
|
</svg>
|
|
115
123
|
`
|
|
116
124
|
: html `
|
|
117
|
-
<svg
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
<svg
|
|
126
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
127
|
+
viewBox="0 0 24 24"
|
|
128
|
+
fill="none"
|
|
129
|
+
stroke="currentColor"
|
|
130
|
+
stroke-width="2"
|
|
131
|
+
>
|
|
132
|
+
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
|
|
133
|
+
<circle cx="12" cy="12" r="3" />
|
|
120
134
|
</svg>
|
|
121
135
|
`;
|
|
122
136
|
return html `
|
|
@@ -125,24 +139,26 @@ let ConsentInput = class ConsentInput extends LitElement {
|
|
|
125
139
|
class="password-toggle"
|
|
126
140
|
@click=${this.togglePasswordVisibility}
|
|
127
141
|
tabindex="-1"
|
|
128
|
-
aria-label=${this.showPassword ?
|
|
142
|
+
aria-label=${this.showPassword ? "Hide password" : "Show password"}
|
|
129
143
|
>
|
|
130
144
|
${icon}
|
|
131
145
|
</button>
|
|
132
146
|
`;
|
|
133
147
|
}
|
|
134
148
|
render() {
|
|
135
|
-
const inputType = this.type ===
|
|
149
|
+
const inputType = this.type === "password" && this.showPassword ? "text" : this.type;
|
|
136
150
|
return html `
|
|
137
151
|
<div class="field">
|
|
138
152
|
${this.label
|
|
139
153
|
? html `
|
|
140
154
|
<label part="label" for="input">
|
|
141
|
-
${this.label}${this.required
|
|
155
|
+
${this.label}${this.required
|
|
156
|
+
? html `<span class="required">*</span>`
|
|
157
|
+
: null}
|
|
142
158
|
</label>
|
|
143
159
|
`
|
|
144
160
|
: null}
|
|
145
|
-
<div class="input-wrapper${this.error ?
|
|
161
|
+
<div class="input-wrapper${this.error ? " has-error" : ""}">
|
|
146
162
|
<input
|
|
147
163
|
part="input"
|
|
148
164
|
id="input"
|
|
@@ -152,13 +168,15 @@ let ConsentInput = class ConsentInput extends LitElement {
|
|
|
152
168
|
placeholder=${this.placeholder}
|
|
153
169
|
?required=${this.required}
|
|
154
170
|
?disabled=${this.disabled}
|
|
155
|
-
autocomplete=${this.autocomplete ||
|
|
171
|
+
autocomplete=${this.autocomplete || "off"}
|
|
156
172
|
@input=${this.handleInput}
|
|
157
173
|
@change=${this.handleChange}
|
|
158
174
|
/>
|
|
159
175
|
${this.renderPasswordToggle()}
|
|
160
176
|
</div>
|
|
161
|
-
${this.error
|
|
177
|
+
${this.error
|
|
178
|
+
? html `<div class="error-message">${this.error}</div>`
|
|
179
|
+
: null}
|
|
162
180
|
</div>
|
|
163
181
|
`;
|
|
164
182
|
}
|
|
@@ -200,7 +218,9 @@ ConsentInput.styles = css `
|
|
|
200
218
|
border-radius: 0.5rem;
|
|
201
219
|
outline: none;
|
|
202
220
|
box-shadow: none;
|
|
203
|
-
transition:
|
|
221
|
+
transition:
|
|
222
|
+
border-color 0.15s ease,
|
|
223
|
+
box-shadow 0.15s ease;
|
|
204
224
|
}
|
|
205
225
|
|
|
206
226
|
.input-wrapper input:focus {
|
|
@@ -247,7 +267,7 @@ ConsentInput.styles = css `
|
|
|
247
267
|
}
|
|
248
268
|
|
|
249
269
|
/* Password toggle */
|
|
250
|
-
.input-wrapper input[type=
|
|
270
|
+
.input-wrapper input[type="password"] {
|
|
251
271
|
padding-right: 2.5rem;
|
|
252
272
|
}
|
|
253
273
|
|
|
@@ -299,7 +319,7 @@ __decorate([
|
|
|
299
319
|
property({ type: String })
|
|
300
320
|
], ConsentInput.prototype, "type", void 0);
|
|
301
321
|
__decorate([
|
|
302
|
-
property({ type: String })
|
|
322
|
+
property({ type: String, reflect: true })
|
|
303
323
|
], ConsentInput.prototype, "name", void 0);
|
|
304
324
|
__decorate([
|
|
305
325
|
property({ type: String })
|
|
@@ -326,7 +346,7 @@ __decorate([
|
|
|
326
346
|
state()
|
|
327
347
|
], ConsentInput.prototype, "showPassword", void 0);
|
|
328
348
|
ConsentInput = __decorate([
|
|
329
|
-
customElement(
|
|
349
|
+
customElement("consent-input")
|
|
330
350
|
], ConsentInput);
|
|
331
351
|
export { ConsentInput };
|
|
332
352
|
//# sourceMappingURL=consent-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-input.js","sourceRoot":"","sources":["../../src/components/consent-input.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAOnE;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAM1C;QACE,KAAK,EAAE,CAAC;QAIV;;WAEG;QAEH,SAAI,GAAc,MAAM,CAAC;QAEzB;;WAEG;QAEH,SAAI,GA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmI3B,AAnIqB,CAmIpB;AA3LF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CACF;AAMzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAChC;AAMV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAChB;AAMX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAChB;AAMX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACV;AAMjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CACX;AAMjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAC1B;AAMjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACT;AAMlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACZ;AAMP;IADP,KAAK,EAAE;kDACqB;AArElB,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAmUxB"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module components/consent-otp-input
|
|
9
9
|
*/
|
|
10
|
-
import { LitElement, TemplateResult } from
|
|
10
|
+
import { LitElement, TemplateResult } from "lit";
|
|
11
11
|
/**
|
|
12
12
|
* ConsentOTPInput - OTP digit input boxes
|
|
13
13
|
*
|
|
@@ -35,7 +35,7 @@ export declare class ConsentOTPInput extends LitElement {
|
|
|
35
35
|
*/
|
|
36
36
|
length: number;
|
|
37
37
|
/**
|
|
38
|
-
* Form field name
|
|
38
|
+
* Form field name. Reflected: a form reads the attribute.
|
|
39
39
|
*/
|
|
40
40
|
name: string;
|
|
41
41
|
/**
|
|
@@ -57,7 +57,7 @@ export declare class ConsentOTPInput extends LitElement {
|
|
|
57
57
|
/**
|
|
58
58
|
* Input type (text or number)
|
|
59
59
|
*/
|
|
60
|
-
inputType:
|
|
60
|
+
inputType: "text" | "number";
|
|
61
61
|
/**
|
|
62
62
|
* Internal digit values
|
|
63
63
|
*/
|
|
@@ -91,7 +91,7 @@ export declare class ConsentOTPInput extends LitElement {
|
|
|
91
91
|
}
|
|
92
92
|
declare global {
|
|
93
93
|
interface HTMLElementTagNameMap {
|
|
94
|
-
|
|
94
|
+
"consent-otp-input": ConsentOTPInput;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
//# sourceMappingURL=consent-otp-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-otp-input.d.ts","sourceRoot":"","sources":["../../src/components/consent-otp-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAG5D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAE7C,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAO,CAAC,SAAS,CAAmB;;IAOpC;;OAEG;IAEH,MAAM,SAAK;IAEX;;OAEG;IAEH,IAAI,SAAS;IAEb;;OAEG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,KAAK,UAAS;IAEd;;OAEG;IAEH,SAAS,UAAS;IAElB;;OAEG;IAEH,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAU;IAEtC;;OAEG;IAEH,OAAO,CAAC,MAAM,CAAgB;IAG9B,OAAO,CAAC,MAAM,CAAgC;IAE9C,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"consent-otp-input.d.ts","sourceRoot":"","sources":["../../src/components/consent-otp-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAG5D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAE7C,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAO,CAAC,SAAS,CAAmB;;IAOpC;;OAEG;IAEH,MAAM,SAAK;IAEX;;OAEG;IAEH,IAAI,SAAS;IAEb;;OAEG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,KAAK,UAAS;IAEd;;OAEG;IAEH,SAAS,UAAS;IAElB;;OAEG;IAEH,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAU;IAEtC;;OAEG;IAEH,OAAO,CAAC,MAAM,CAAgB;IAG9B,OAAO,CAAC,MAAM,CAAgC;IAE9C,OAAgB,MAAM,0BAiFpB;IAEO,iBAAiB;IAK1B,OAAO,CAAC,gBAAgB;cAYL,YAAY;cAMZ,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAclE,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,WAAW;IAyDnB,OAAO,CAAC,aAAa;IAmCrB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,WAAW;IAqDnB,OAAO,CAAC,WAAW;IAKnB;;OAEG;IACa,KAAK;IAMrB;;OAEG;IACI,KAAK;IAMZ,OAAO,CAAC,gBAAgB;IAwBf,MAAM;CAchB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,mBAAmB,EAAE,eAAe,CAAC;KACtC;CACF"}
|
|
@@ -13,8 +13,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
13
13
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
14
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
15
|
};
|
|
16
|
-
import { LitElement, html, css } from
|
|
17
|
-
import { customElement, property, state, queryAll } from
|
|
16
|
+
import { LitElement, html, css } from "lit";
|
|
17
|
+
import { customElement, property, state, queryAll } from "lit/decorators.js";
|
|
18
18
|
/**
|
|
19
19
|
* ConsentOTPInput - OTP digit input boxes
|
|
20
20
|
*
|
|
@@ -41,13 +41,13 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
41
41
|
*/
|
|
42
42
|
this.length = 6;
|
|
43
43
|
/**
|
|
44
|
-
* Form field name
|
|
44
|
+
* Form field name. Reflected: a form reads the attribute.
|
|
45
45
|
*/
|
|
46
|
-
this.name =
|
|
46
|
+
this.name = "otp";
|
|
47
47
|
/**
|
|
48
48
|
* Current OTP value
|
|
49
49
|
*/
|
|
50
|
-
this.value =
|
|
50
|
+
this.value = "";
|
|
51
51
|
/**
|
|
52
52
|
* Disabled state
|
|
53
53
|
*/
|
|
@@ -63,7 +63,7 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
63
63
|
/**
|
|
64
64
|
* Input type (text or number)
|
|
65
65
|
*/
|
|
66
|
-
this.inputType =
|
|
66
|
+
this.inputType = "text";
|
|
67
67
|
/**
|
|
68
68
|
* Internal digit values
|
|
69
69
|
*/
|
|
@@ -75,11 +75,11 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
75
75
|
this.initializeDigits();
|
|
76
76
|
}
|
|
77
77
|
initializeDigits() {
|
|
78
|
-
this.digits = Array.from({ length: this.length }, () =>
|
|
78
|
+
this.digits = Array.from({ length: this.length }, () => "");
|
|
79
79
|
if (this.value) {
|
|
80
80
|
// Filter non-digits (consistent with handleInput and handlePaste)
|
|
81
|
-
const digitsOnly = this.value.replace(/\D/g,
|
|
82
|
-
const chars = digitsOnly.split(
|
|
81
|
+
const digitsOnly = this.value.replace(/\D/g, "").slice(0, this.length);
|
|
82
|
+
const chars = digitsOnly.split("");
|
|
83
83
|
chars.forEach((char, i) => {
|
|
84
84
|
this.digits[i] = char;
|
|
85
85
|
});
|
|
@@ -91,18 +91,18 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
updated(changedProperties) {
|
|
94
|
-
if (changedProperties.has(
|
|
94
|
+
if (changedProperties.has("value") && !changedProperties.has("digits")) {
|
|
95
95
|
this.initializeDigits();
|
|
96
96
|
}
|
|
97
|
-
if (changedProperties.has(
|
|
97
|
+
if (changedProperties.has("length")) {
|
|
98
98
|
this.initializeDigits();
|
|
99
99
|
}
|
|
100
100
|
// Update form value
|
|
101
|
-
const fullValue = this.digits.join(
|
|
101
|
+
const fullValue = this.digits.join("");
|
|
102
102
|
this.internals.setFormValue(fullValue || null);
|
|
103
103
|
}
|
|
104
104
|
getFullValue() {
|
|
105
|
-
return this.digits.join(
|
|
105
|
+
return this.digits.join("");
|
|
106
106
|
}
|
|
107
107
|
handleInput(index, e) {
|
|
108
108
|
const input = e.target;
|
|
@@ -113,7 +113,7 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
113
113
|
}
|
|
114
114
|
// Validate input (only digits for OTP)
|
|
115
115
|
if (newValue && !/^\d$/.test(newValue)) {
|
|
116
|
-
input.value = this.digits[index] ??
|
|
116
|
+
input.value = this.digits[index] ?? "";
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
this.digits[index] = newValue;
|
|
@@ -122,7 +122,7 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
122
122
|
const fullValue = this.getFullValue();
|
|
123
123
|
this.value = fullValue;
|
|
124
124
|
// Dispatch input event
|
|
125
|
-
this.dispatchEvent(new CustomEvent(
|
|
125
|
+
this.dispatchEvent(new CustomEvent("input", {
|
|
126
126
|
detail: { value: fullValue, index, digit: newValue },
|
|
127
127
|
bubbles: true,
|
|
128
128
|
composed: true,
|
|
@@ -133,14 +133,14 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
133
133
|
}
|
|
134
134
|
// Check if complete
|
|
135
135
|
if (fullValue.length === this.length) {
|
|
136
|
-
this.dispatchEvent(new CustomEvent(
|
|
136
|
+
this.dispatchEvent(new CustomEvent("complete", {
|
|
137
137
|
detail: { value: fullValue },
|
|
138
138
|
bubbles: true,
|
|
139
139
|
composed: true,
|
|
140
140
|
}));
|
|
141
141
|
}
|
|
142
142
|
// Dispatch change event
|
|
143
|
-
this.dispatchEvent(new CustomEvent(
|
|
143
|
+
this.dispatchEvent(new CustomEvent("change", {
|
|
144
144
|
detail: { value: fullValue },
|
|
145
145
|
bubbles: true,
|
|
146
146
|
composed: true,
|
|
@@ -148,7 +148,7 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
148
148
|
}
|
|
149
149
|
handleKeyDown(index, e) {
|
|
150
150
|
switch (e.key) {
|
|
151
|
-
case
|
|
151
|
+
case "Backspace": {
|
|
152
152
|
// The element makes every deletion itself, so each one is reported
|
|
153
153
|
// once. In an empty cell, Backspace clears the digit before it.
|
|
154
154
|
e.preventDefault();
|
|
@@ -159,19 +159,19 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
159
159
|
this.clearDigit(target);
|
|
160
160
|
break;
|
|
161
161
|
}
|
|
162
|
-
case
|
|
162
|
+
case "ArrowLeft":
|
|
163
163
|
e.preventDefault();
|
|
164
164
|
if (index > 0) {
|
|
165
165
|
this.inputs[index - 1]?.focus();
|
|
166
166
|
}
|
|
167
167
|
break;
|
|
168
|
-
case
|
|
168
|
+
case "ArrowRight":
|
|
169
169
|
e.preventDefault();
|
|
170
170
|
if (index < this.length - 1) {
|
|
171
171
|
this.inputs[index + 1]?.focus();
|
|
172
172
|
}
|
|
173
173
|
break;
|
|
174
|
-
case
|
|
174
|
+
case "Delete":
|
|
175
175
|
e.preventDefault();
|
|
176
176
|
this.clearDigit(index);
|
|
177
177
|
break;
|
|
@@ -184,16 +184,16 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
184
184
|
clearDigit(index) {
|
|
185
185
|
if (!this.digits[index])
|
|
186
186
|
return;
|
|
187
|
-
this.digits[index] =
|
|
187
|
+
this.digits[index] = "";
|
|
188
188
|
this.digits = [...this.digits];
|
|
189
189
|
const fullValue = this.getFullValue();
|
|
190
190
|
this.value = fullValue;
|
|
191
|
-
this.dispatchEvent(new CustomEvent(
|
|
192
|
-
detail: { value: fullValue, index, digit:
|
|
191
|
+
this.dispatchEvent(new CustomEvent("input", {
|
|
192
|
+
detail: { value: fullValue, index, digit: "" },
|
|
193
193
|
bubbles: true,
|
|
194
194
|
composed: true,
|
|
195
195
|
}));
|
|
196
|
-
this.dispatchEvent(new CustomEvent(
|
|
196
|
+
this.dispatchEvent(new CustomEvent("change", {
|
|
197
197
|
detail: { value: fullValue },
|
|
198
198
|
bubbles: true,
|
|
199
199
|
composed: true,
|
|
@@ -201,10 +201,10 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
201
201
|
}
|
|
202
202
|
handlePaste(e) {
|
|
203
203
|
e.preventDefault();
|
|
204
|
-
const pastedData = e.clipboardData?.getData(
|
|
205
|
-
const digits = pastedData.replace(/\D/g,
|
|
204
|
+
const pastedData = e.clipboardData?.getData("text") || "";
|
|
205
|
+
const digits = pastedData.replace(/\D/g, "").slice(0, this.length);
|
|
206
206
|
if (digits) {
|
|
207
|
-
this.digits = Array.from({ length: this.length }, (_, i) => digits[i] ||
|
|
207
|
+
this.digits = Array.from({ length: this.length }, (_, i) => digits[i] || "");
|
|
208
208
|
this.value = this.getFullValue();
|
|
209
209
|
// Update inputs
|
|
210
210
|
this.requestUpdate();
|
|
@@ -215,20 +215,20 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
215
215
|
}, 0);
|
|
216
216
|
// Dispatch input event (consistent with handleInput behavior)
|
|
217
217
|
// This ensures parent components can track partial pastes
|
|
218
|
-
this.dispatchEvent(new CustomEvent(
|
|
219
|
-
detail: { value: this.value, index: 0, digit: digits[0] ||
|
|
218
|
+
this.dispatchEvent(new CustomEvent("input", {
|
|
219
|
+
detail: { value: this.value, index: 0, digit: digits[0] || "" },
|
|
220
220
|
bubbles: true,
|
|
221
221
|
composed: true,
|
|
222
222
|
}));
|
|
223
223
|
// Always dispatch change event so parent components can track the value
|
|
224
|
-
this.dispatchEvent(new CustomEvent(
|
|
224
|
+
this.dispatchEvent(new CustomEvent("change", {
|
|
225
225
|
detail: { value: this.value },
|
|
226
226
|
bubbles: true,
|
|
227
227
|
composed: true,
|
|
228
228
|
}));
|
|
229
229
|
// Check if complete
|
|
230
230
|
if (digits.length === this.length) {
|
|
231
|
-
this.dispatchEvent(new CustomEvent(
|
|
231
|
+
this.dispatchEvent(new CustomEvent("complete", {
|
|
232
232
|
detail: { value: this.value },
|
|
233
233
|
bubbles: true,
|
|
234
234
|
composed: true,
|
|
@@ -252,13 +252,13 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
252
252
|
* Clear all digits
|
|
253
253
|
*/
|
|
254
254
|
clear() {
|
|
255
|
-
this.digits = Array.from({ length: this.length }, () =>
|
|
256
|
-
this.value =
|
|
255
|
+
this.digits = Array.from({ length: this.length }, () => "");
|
|
256
|
+
this.value = "";
|
|
257
257
|
this.inputs[0]?.focus();
|
|
258
258
|
}
|
|
259
259
|
renderDigitInput(index) {
|
|
260
|
-
const digit = this.digits[index] ||
|
|
261
|
-
const isFilled = digit !==
|
|
260
|
+
const digit = this.digits[index] || "";
|
|
261
|
+
const isFilled = digit !== "";
|
|
262
262
|
return html `
|
|
263
263
|
<input
|
|
264
264
|
part="input"
|
|
@@ -269,7 +269,7 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
269
269
|
.value=${digit}
|
|
270
270
|
?disabled=${this.disabled}
|
|
271
271
|
placeholder="○"
|
|
272
|
-
class=${isFilled ?
|
|
272
|
+
class=${isFilled ? "filled" : ""}
|
|
273
273
|
@input=${(e) => this.handleInput(index, e)}
|
|
274
274
|
@keydown=${(e) => this.handleKeyDown(index, e)}
|
|
275
275
|
@paste=${this.handlePaste}
|
|
@@ -280,7 +280,12 @@ let ConsentOTPInput = class ConsentOTPInput extends LitElement {
|
|
|
280
280
|
}
|
|
281
281
|
render() {
|
|
282
282
|
return html `
|
|
283
|
-
<div
|
|
283
|
+
<div
|
|
284
|
+
class="container"
|
|
285
|
+
part="container"
|
|
286
|
+
role="group"
|
|
287
|
+
aria-label="One-time password input"
|
|
288
|
+
>
|
|
284
289
|
${Array.from({ length: this.length }, (_, i) => this.renderDigitInput(i))}
|
|
285
290
|
</div>
|
|
286
291
|
`;
|
|
@@ -312,7 +317,9 @@ ConsentOTPInput.styles = css `
|
|
|
312
317
|
border: 1px solid #d1d5db;
|
|
313
318
|
border-radius: 0.5rem;
|
|
314
319
|
outline: none;
|
|
315
|
-
transition:
|
|
320
|
+
transition:
|
|
321
|
+
border-color 0.15s ease,
|
|
322
|
+
box-shadow 0.15s ease;
|
|
316
323
|
|
|
317
324
|
/* Hide spinner for number inputs */
|
|
318
325
|
-moz-appearance: textfield;
|
|
@@ -372,7 +379,7 @@ __decorate([
|
|
|
372
379
|
property({ type: Number })
|
|
373
380
|
], ConsentOTPInput.prototype, "length", void 0);
|
|
374
381
|
__decorate([
|
|
375
|
-
property({ type: String })
|
|
382
|
+
property({ type: String, reflect: true })
|
|
376
383
|
], ConsentOTPInput.prototype, "name", void 0);
|
|
377
384
|
__decorate([
|
|
378
385
|
property({ type: String })
|
|
@@ -384,19 +391,19 @@ __decorate([
|
|
|
384
391
|
property({ type: Boolean, reflect: true })
|
|
385
392
|
], ConsentOTPInput.prototype, "error", void 0);
|
|
386
393
|
__decorate([
|
|
387
|
-
property({ type: Boolean, attribute:
|
|
394
|
+
property({ type: Boolean, attribute: "auto-focus" })
|
|
388
395
|
], ConsentOTPInput.prototype, "autoFocus", void 0);
|
|
389
396
|
__decorate([
|
|
390
|
-
property({ type: String, attribute:
|
|
397
|
+
property({ type: String, attribute: "input-type" })
|
|
391
398
|
], ConsentOTPInput.prototype, "inputType", void 0);
|
|
392
399
|
__decorate([
|
|
393
400
|
state()
|
|
394
401
|
], ConsentOTPInput.prototype, "digits", void 0);
|
|
395
402
|
__decorate([
|
|
396
|
-
queryAll(
|
|
403
|
+
queryAll("input")
|
|
397
404
|
], ConsentOTPInput.prototype, "inputs", void 0);
|
|
398
405
|
ConsentOTPInput = __decorate([
|
|
399
|
-
customElement(
|
|
406
|
+
customElement("consent-otp-input")
|
|
400
407
|
], ConsentOTPInput);
|
|
401
408
|
export { ConsentOTPInput };
|
|
402
409
|
//# sourceMappingURL=consent-otp-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-otp-input.js","sourceRoot":"","sources":["../../src/components/consent-otp-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7E;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAM7C;QACE,KAAK,EAAE,CAAC;QAIV;;WAEG;QAEH,WAAM,GAAG,CAAC,CAAC;QAEX;;WAEG;QAEH,SAAI,GAAG,KAAK,CAAC;QAEb;;WAEG;QAEH,UAAK,GAAG,EAAE,CAAC;QAEX;;WAEG;QAEH,aAAQ,GAAG,KAAK,CAAC;QAEjB;;WAEG;QAEH,UAAK,GAAG,KAAK,CAAC;QAEd;;WAEG;QAEH,cAAS,GAAG,KAAK,CAAC;QAElB;;WAEG;QAEH,cAAS,GAAsB,MAAM,CAAC;QAEtC;;WAEG;Q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7B;AAMd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;kDACnC;AAMlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;kDACd;AAM9B;IADP,KAAK,EAAE;+CACsB;AAGtB;IADP,QAAQ,CAAC,OAAO,CAAC;+CAC4B;AA5DnC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAoa3B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent Phone Handoff
|
|
3
|
+
*
|
|
4
|
+
* Approving on a phone instead: a QR code of the request's link, for a
|
|
5
|
+
* person whose wallet passkey lives on their phone. Scanning it opens the
|
|
6
|
+
* same request there.
|
|
7
|
+
*
|
|
8
|
+
* The code is dark on light in every theme, inside its own light box,
|
|
9
|
+
* because phone cameras read it best that way. It renders nothing without a
|
|
10
|
+
* `url`. Hide it on phones yourself: the element can't tell which device it
|
|
11
|
+
* is on.
|
|
12
|
+
*
|
|
13
|
+
* Parts: `frame`, `title`, `body`, `box` (the light box behind the code),
|
|
14
|
+
* `code`, `scan`.
|
|
15
|
+
*
|
|
16
|
+
* @module components/consent-phone-handoff
|
|
17
|
+
*/
|
|
18
|
+
import { LitElement, nothing, type PropertyValues } from "lit";
|
|
19
|
+
interface QrCode {
|
|
20
|
+
size: number;
|
|
21
|
+
path: string;
|
|
22
|
+
}
|
|
23
|
+
/** The link as QR modules, one square path per dark module; null if it won't fit. */
|
|
24
|
+
export declare function qrCodeFor(url: string): QrCode | null;
|
|
25
|
+
/**
|
|
26
|
+
* @cssprop --cs-qr-size - The code's width and height (default: 148px).
|
|
27
|
+
* @cssprop --cs-qr-fg - The code's dark modules (default: black).
|
|
28
|
+
* @cssprop --cs-qr-bg - The box behind the code (default: white).
|
|
29
|
+
* @cssprop --cs-card-radius - The card's corners (default: 16px).
|
|
30
|
+
* @cssprop --cs-card-padding - The card's padding (default: 24px).
|
|
31
|
+
*/
|
|
32
|
+
export declare class ConsentPhoneHandoff extends LitElement {
|
|
33
|
+
/** The request's link, the same one this page is on. */
|
|
34
|
+
url: string;
|
|
35
|
+
heading: string;
|
|
36
|
+
description: string;
|
|
37
|
+
/** The page reflects an approval made on the phone, so it can say so. */
|
|
38
|
+
updatesOnItsOwn: boolean;
|
|
39
|
+
private code;
|
|
40
|
+
static styles: import("lit").CSSResult;
|
|
41
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
42
|
+
render(): import("lit").TemplateResult<1> | typeof nothing;
|
|
43
|
+
}
|
|
44
|
+
declare global {
|
|
45
|
+
interface HTMLElementTagNameMap {
|
|
46
|
+
"consent-phone-handoff": ConsentPhoneHandoff;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=consent-phone-handoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent-phone-handoff.d.ts","sourceRoot":"","sources":["../../src/components/consent-phone-handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAa,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAO1E,UAAU,MAAM;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qFAAqF;AACrF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAcpD;AAED;;;;;;GAMG;AACH,qBACa,mBAAoB,SAAQ,UAAU;IACjD,wDAAwD;IAC5B,GAAG,SAAM;IACT,OAAO,SAAM;IACb,WAAW,SAAM;IAC7C,yEAAyE;IAEzE,eAAe,UAAS;IAExB,OAAO,CAAC,IAAI,CAAuB;IAEnC,OAAgB,MAAM,0BAgFpB;cAEiB,UAAU,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAIzD,MAAM;CA8ChB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,uBAAuB,EAAE,mBAAmB,CAAC;KAC9C;CACF"}
|