@zitadel/components 0.1.0-alpha.9 → 1.0.0-alpha.21
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 +135 -72
- package/dist/atoms/index.d.mts +2 -2
- package/dist/atoms/index.mjs +2 -2
- package/dist/atoms-DSxjEHca.mjs +2268 -0
- package/dist/atoms-DSxjEHca.mjs.map +1 -0
- package/dist/default-Dnjq9iBt.mjs +6 -0
- package/dist/default-Dnjq9iBt.mjs.map +1 -0
- package/dist/index-BlxTxXK8.d.mts +449 -0
- package/dist/index-BlxTxXK8.d.mts.map +1 -0
- package/dist/index-DFdR16-D.d.mts +1599 -0
- package/dist/index-DFdR16-D.d.mts.map +1 -0
- package/dist/index-Dx8rvpNs.d.mts +14844 -0
- package/dist/index-Dx8rvpNs.d.mts.map +1 -0
- package/dist/index.d.mts +22 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/jsx.d.ts +67 -0
- package/dist/manifests.d.mts.map +1 -1
- package/dist/manifests.mjs +4 -2
- package/dist/manifests.mjs.map +1 -1
- package/dist/orchestrator/index.d.mts +3 -3
- package/dist/orchestrator/index.mjs +3 -3
- package/dist/orchestrator-DG-YwFFE.mjs +5008 -0
- package/dist/orchestrator-DG-YwFFE.mjs.map +1 -0
- package/dist/standalone.mjs +9172 -5871
- package/dist/tokens/index.d.mts +1 -1
- package/dist/tokens/index.mjs +1 -1
- package/dist/tokens-T4N9VJz3.mjs +452 -0
- package/dist/tokens-T4N9VJz3.mjs.map +1 -0
- package/package.json +13 -12
- package/dist/atoms-B25wiDqb.mjs +0 -1464
- package/dist/atoms-B25wiDqb.mjs.map +0 -1
- package/dist/default-Cpl78hQN.mjs +0 -6
- package/dist/default-Cpl78hQN.mjs.map +0 -1
- package/dist/index-DB_JTtln.d.mts +0 -1000
- package/dist/index-DB_JTtln.d.mts.map +0 -1
- package/dist/index-DVDCrfkv.d.mts +0 -7396
- package/dist/index-DVDCrfkv.d.mts.map +0 -1
- package/dist/index-EJengPPu.d.mts +0 -249
- package/dist/index-EJengPPu.d.mts.map +0 -1
- package/dist/orchestrator-CW9zixuw.mjs +0 -3362
- package/dist/orchestrator-CW9zixuw.mjs.map +0 -1
- package/dist/tokens-BQ_augxi.mjs +0 -244
- package/dist/tokens-BQ_augxi.mjs.map +0 -1
package/dist/atoms-B25wiDqb.mjs
DELETED
|
@@ -1,1464 +0,0 @@
|
|
|
1
|
-
import { t as cssVars } from "./tokens-BQ_augxi.mjs";
|
|
2
|
-
import { LitElement, css, html, nothing, unsafeCSS } from "lit";
|
|
3
|
-
import { customElement, property, query, state } from "lit/decorators.js";
|
|
4
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
5
|
-
import { unsafeSVG } from "lit/directives/unsafe-svg.js";
|
|
6
|
-
import { ArrowLeft, ArrowRight, Check, CircleAlert, Eye, EyeOff, Info, KeyRound, LoaderCircle, Plus, TriangleAlert, User, X } from "lucide";
|
|
7
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
|
8
|
-
import { live } from "lit/directives/live.js";
|
|
9
|
-
//#region ../shared-component-styles/src/lit/alert-host.css?inline
|
|
10
|
-
var alert_host_default = ":host {\n display: block;\n}\n";
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region ../shared-component-styles/src/alert.css?inline
|
|
13
|
-
var alert_default = ".zr-alert {\n align-items: flex-start;\n gap: var(--zl-spacing-03, 1rem);\n padding: var(--zl-spacing-03, 1rem);\n border-radius: var(--zl-radius-m, .75rem);\n background: var(--zl-color-surface-default-primary-gray, #252528);\n color: var(--zl-color-text-button-invert, #f4f4f6);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n display: flex;\n box-shadow: 0 1px 2px #1018280d;\n}\n\n.zr-alert__icon {\n color: var(--zl-color-text-error, #ea4f70);\n flex-shrink: 0;\n}\n\n.zr-alert--warning .zr-alert__icon {\n color: var(--zl-color-text-subtitle-orange, #f25543);\n}\n\n.zr-alert--success .zr-alert__icon {\n color: var(--zl-color-text-success, #33a779);\n}\n\n.zr-alert--info .zr-alert__icon {\n color: var(--zl-color-text-subtitle-gray, #bfbfcf);\n}\n\n.zr-alert__body {\n gap: var(--zl-spacing-01, .25rem);\n flex-direction: column;\n flex: auto;\n min-width: 0;\n display: flex;\n}\n\n.zr-alert__title {\n color: var(--zl-color-text-button-invert, #f4f4f6);\n font-weight: 600;\n}\n\n.zr-alert__message {\n color: var(--zl-color-border-default-white, #f4f4f6);\n margin: 0;\n}\n\n.zr-alert:not(:has(.zr-alert__title)) .zr-alert__message {\n color: var(--zl-color-text-button-invert, #f4f4f6);\n}\n\n.zr-alert__close {\n all: unset;\n width: 2.25rem;\n height: 2.25rem;\n padding: var(--zl-spacing-02, .5rem);\n border-radius: var(--zl-radius-s, .5rem);\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n cursor: pointer;\n transition: background-color var(--zl-duration-fast, .12s) var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1));\n flex-shrink: 0;\n justify-content: center;\n align-items: center;\n display: inline-flex;\n}\n\n.zr-alert__close .zr-icon {\n --zl-icon-size: 1.25rem;\n width: 1.25rem;\n height: 1.25rem;\n}\n\n.zr-alert__close:hover {\n background: var(--zl-color-gray-200, #484a57);\n}\n\n.zr-alert__close:focus-visible {\n outline: var(--zl-focus-width, 2px) solid var(--zl-focus-color, #f4f4f6);\n outline-offset: var(--zl-focus-offset, 2px);\n}\n";
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/internal/emit.ts
|
|
16
|
-
/**
|
|
17
|
-
* Dispatch a custom event with the project-wide defaults (`bubbles` +
|
|
18
|
-
* `composed`) so it crosses the shadow boundary and reaches delegated
|
|
19
|
-
* listeners — whether it's an atom's `zl-*` event or the orchestrator's
|
|
20
|
-
* public `zitadel-*` event.
|
|
21
|
-
*
|
|
22
|
-
* Centralising the dispatch shape keeps every event contract identical and
|
|
23
|
-
* removes the repeated `new CustomEvent(..., { bubbles: true, composed: true,
|
|
24
|
-
* detail })` boilerplate.
|
|
25
|
-
*/
|
|
26
|
-
function emit(host, type, detail) {
|
|
27
|
-
return host.dispatchEvent(new CustomEvent(type, {
|
|
28
|
-
bubbles: true,
|
|
29
|
-
composed: true,
|
|
30
|
-
detail
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/styles/tokens.ts
|
|
35
|
-
function wrap(node) {
|
|
36
|
-
if (typeof node === "string") return unsafeCSS(node);
|
|
37
|
-
const out = {};
|
|
38
|
-
for (const [key, value] of Object.entries(node)) out[key] = wrap(value);
|
|
39
|
-
return out;
|
|
40
|
-
}
|
|
41
|
-
const t = wrap(cssVars);
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/styles/base.ts
|
|
44
|
-
/**
|
|
45
|
-
* Shared shadow-root base styles. Each atom prepends this fragment to its own
|
|
46
|
-
* `static styles` so font/colour inheritance, box-sizing, and resets stay
|
|
47
|
-
* consistent without forcing a global stylesheet on the host page.
|
|
48
|
-
*/
|
|
49
|
-
const baseHostStyles = css`
|
|
50
|
-
:host {
|
|
51
|
-
box-sizing: border-box;
|
|
52
|
-
font-family: ${t.font.family.sans};
|
|
53
|
-
color: ${t.color.text.primaryWhite};
|
|
54
|
-
line-height: 1.5;
|
|
55
|
-
-webkit-font-smoothing: antialiased;
|
|
56
|
-
}
|
|
57
|
-
*,
|
|
58
|
-
*::before,
|
|
59
|
-
*::after {
|
|
60
|
-
box-sizing: inherit;
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region src/styles/focus-ring.ts
|
|
65
|
-
/**
|
|
66
|
-
* Visible focus indicator shared across interactive atoms. Mirrors the
|
|
67
|
-
* Figma button "Focused" state — a 2px white outline offset by 2px from
|
|
68
|
-
* the element edge. Atoms apply via `&:focus-visible { ${focusVisibleStyles} }`.
|
|
69
|
-
*/
|
|
70
|
-
const focusVisibleStyles = css`
|
|
71
|
-
outline: ${t.focus.width} solid ${t.focus.color};
|
|
72
|
-
outline-offset: ${t.focus.offset};
|
|
73
|
-
`;
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/styles/surface.ts
|
|
76
|
-
/**
|
|
77
|
-
* Wrap shared surface CSS (from `@zitadel/shared-component-styles`)
|
|
78
|
-
* for Lit `static styles`. Import `.css?inline` in atoms; `@tsdown/css` inlines
|
|
79
|
-
* the strings when `components` is built.
|
|
80
|
-
*/
|
|
81
|
-
function surfaceStyles(...cssChunks) {
|
|
82
|
-
return cssChunks.map((chunk) => unsafeCSS(chunk));
|
|
83
|
-
}
|
|
84
|
-
//#endregion
|
|
85
|
-
//#region ../shared-component-styles/src/lit/icon-host.css?inline
|
|
86
|
-
var icon_host_default = ":host {\n color: inherit;\n display: contents;\n}\n";
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region ../shared-component-styles/src/icon.css?inline
|
|
89
|
-
var icon_default = ".zr-icon {\n color: inherit;\n width: var(--zl-icon-size, 1.5rem);\n height: var(--zl-icon-size, 1.5rem);\n justify-content: center;\n align-items: center;\n display: inline-flex;\n}\n\n.zr-icon--16 {\n --zl-icon-size: 1rem;\n}\n\n.zr-icon--24 {\n --zl-icon-size: 1.5rem;\n}\n\n.zr-icon--tone-error {\n color: var(--zl-color-icon-error);\n}\n\n.zr-icon--tone-success {\n color: var(--zl-color-icon-success);\n}\n\n.zr-icon--tone-disabled {\n color: var(--zl-color-icon-disabled);\n}\n\n.zr-icon svg {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n.zr-icon--spin svg {\n animation: .8s linear infinite zr-icon-spin;\n}\n\n@keyframes zr-icon-spin {\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region \0@oxc-project+runtime@0.127.0/helpers/decorate.js
|
|
92
|
-
function __decorate(decorators, target, key, desc) {
|
|
93
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
94
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
95
|
-
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;
|
|
96
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/atoms/zl-icon.ts
|
|
100
|
-
let ZlIcon = class ZlIcon extends LitElement {
|
|
101
|
-
static styles = surfaceStyles(icon_host_default, icon_default);
|
|
102
|
-
#_name_accessor_storage = "plus";
|
|
103
|
-
get name() {
|
|
104
|
-
return this.#_name_accessor_storage;
|
|
105
|
-
}
|
|
106
|
-
set name(value) {
|
|
107
|
-
this.#_name_accessor_storage = value;
|
|
108
|
-
}
|
|
109
|
-
#_size_accessor_storage = "24";
|
|
110
|
-
get size() {
|
|
111
|
-
return this.#_size_accessor_storage;
|
|
112
|
-
}
|
|
113
|
-
set size(value) {
|
|
114
|
-
this.#_size_accessor_storage = value;
|
|
115
|
-
}
|
|
116
|
-
#_tone_accessor_storage = "default";
|
|
117
|
-
get tone() {
|
|
118
|
-
return this.#_tone_accessor_storage;
|
|
119
|
-
}
|
|
120
|
-
set tone(value) {
|
|
121
|
-
this.#_tone_accessor_storage = value;
|
|
122
|
-
}
|
|
123
|
-
#_spin_accessor_storage = false;
|
|
124
|
-
get spin() {
|
|
125
|
-
return this.#_spin_accessor_storage;
|
|
126
|
-
}
|
|
127
|
-
set spin(value) {
|
|
128
|
-
this.#_spin_accessor_storage = value;
|
|
129
|
-
}
|
|
130
|
-
#_decorative_accessor_storage = false;
|
|
131
|
-
get decorative() {
|
|
132
|
-
return this.#_decorative_accessor_storage;
|
|
133
|
-
}
|
|
134
|
-
set decorative(value) {
|
|
135
|
-
this.#_decorative_accessor_storage = value;
|
|
136
|
-
}
|
|
137
|
-
#_label_accessor_storage = void 0;
|
|
138
|
-
get label() {
|
|
139
|
-
return this.#_label_accessor_storage;
|
|
140
|
-
}
|
|
141
|
-
set label(value) {
|
|
142
|
-
this.#_label_accessor_storage = value;
|
|
143
|
-
}
|
|
144
|
-
render() {
|
|
145
|
-
const ariaLabel = this.label ?? DEFAULT_LABELS[this.name];
|
|
146
|
-
const hidden = this.decorative || !ariaLabel;
|
|
147
|
-
return html`
|
|
148
|
-
<span class=${classMap({
|
|
149
|
-
"zr-icon": true,
|
|
150
|
-
[`zr-icon--${this.size}`]: true,
|
|
151
|
-
[`zr-icon--tone-${this.tone}`]: this.tone !== "default",
|
|
152
|
-
"zr-icon--spin": this.spin
|
|
153
|
-
})}>
|
|
154
|
-
<svg
|
|
155
|
-
viewBox="0 0 24 24"
|
|
156
|
-
fill="none"
|
|
157
|
-
stroke="currentColor"
|
|
158
|
-
stroke-width="2"
|
|
159
|
-
stroke-linecap="round"
|
|
160
|
-
stroke-linejoin="round"
|
|
161
|
-
role=${hidden ? "presentation" : "img"}
|
|
162
|
-
aria-hidden=${hidden ? "true" : "false"}
|
|
163
|
-
aria-label=${hidden ? nothing : ariaLabel}
|
|
164
|
-
>${unsafeSVG(ICON_MARKUP[this.name])}</svg>
|
|
165
|
-
</span>
|
|
166
|
-
`;
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
__decorate([property()], ZlIcon.prototype, "name", null);
|
|
170
|
-
__decorate([property({ reflect: true })], ZlIcon.prototype, "size", null);
|
|
171
|
-
__decorate([property({ reflect: true })], ZlIcon.prototype, "tone", null);
|
|
172
|
-
__decorate([property({
|
|
173
|
-
type: Boolean,
|
|
174
|
-
reflect: true
|
|
175
|
-
})], ZlIcon.prototype, "spin", null);
|
|
176
|
-
__decorate([property({
|
|
177
|
-
type: Boolean,
|
|
178
|
-
reflect: true
|
|
179
|
-
})], ZlIcon.prototype, "decorative", null);
|
|
180
|
-
__decorate([property()], ZlIcon.prototype, "label", null);
|
|
181
|
-
ZlIcon = __decorate([customElement("zl-icon")], ZlIcon);
|
|
182
|
-
/** Curated mapping from our public name to a Lucide canonical icon. */
|
|
183
|
-
const ICON_NODES = {
|
|
184
|
-
plus: Plus,
|
|
185
|
-
"arrow-right": ArrowRight,
|
|
186
|
-
"arrow-left": ArrowLeft,
|
|
187
|
-
spinner: LoaderCircle,
|
|
188
|
-
check: Check,
|
|
189
|
-
cross: X,
|
|
190
|
-
warning: TriangleAlert,
|
|
191
|
-
"alert-circle": CircleAlert,
|
|
192
|
-
info: Info,
|
|
193
|
-
passkey: KeyRound,
|
|
194
|
-
user: User,
|
|
195
|
-
eye: Eye,
|
|
196
|
-
"eye-off": EyeOff
|
|
197
|
-
};
|
|
198
|
-
const DEFAULT_LABELS = {
|
|
199
|
-
spinner: "Loading",
|
|
200
|
-
warning: "Warning",
|
|
201
|
-
"alert-circle": "Alert",
|
|
202
|
-
info: "Information",
|
|
203
|
-
passkey: "Passkey",
|
|
204
|
-
user: "User",
|
|
205
|
-
eye: "Show",
|
|
206
|
-
"eye-off": "Hide"
|
|
207
|
-
};
|
|
208
|
-
const ICON_MARKUP = Object.fromEntries(Object.entries(ICON_NODES).map(([name, node]) => [name, nodeToSvgMarkup(node)]));
|
|
209
|
-
function nodeToSvgMarkup(node) {
|
|
210
|
-
return node.map(([tag, attrs]) => {
|
|
211
|
-
return `<${tag} ${Object.entries(attrs).filter(([, value]) => value !== void 0).map(([key, value]) => `${key}="${String(value)}"`).join(" ")}/>`;
|
|
212
|
-
}).join("");
|
|
213
|
-
}
|
|
214
|
-
const zlIconManifest = {
|
|
215
|
-
tag: "zl-icon",
|
|
216
|
-
attrs: [
|
|
217
|
-
"name",
|
|
218
|
-
"size",
|
|
219
|
-
"tone",
|
|
220
|
-
"spin",
|
|
221
|
-
"decorative",
|
|
222
|
-
"label"
|
|
223
|
-
],
|
|
224
|
-
parts: [],
|
|
225
|
-
slots: [],
|
|
226
|
-
events: []
|
|
227
|
-
};
|
|
228
|
-
//#endregion
|
|
229
|
-
//#region src/atoms/zl-alert.ts
|
|
230
|
-
let ZlAlert = class ZlAlert extends LitElement {
|
|
231
|
-
static styles = [baseHostStyles, ...surfaceStyles(alert_host_default, alert_default)];
|
|
232
|
-
#_severity_accessor_storage = "error";
|
|
233
|
-
get severity() {
|
|
234
|
-
return this.#_severity_accessor_storage;
|
|
235
|
-
}
|
|
236
|
-
set severity(value) {
|
|
237
|
-
this.#_severity_accessor_storage = value;
|
|
238
|
-
}
|
|
239
|
-
#_heading_accessor_storage = void 0;
|
|
240
|
-
get heading() {
|
|
241
|
-
return this.#_heading_accessor_storage;
|
|
242
|
-
}
|
|
243
|
-
set heading(value) {
|
|
244
|
-
this.#_heading_accessor_storage = value;
|
|
245
|
-
}
|
|
246
|
-
#_dismissible_accessor_storage = false;
|
|
247
|
-
get dismissible() {
|
|
248
|
-
return this.#_dismissible_accessor_storage;
|
|
249
|
-
}
|
|
250
|
-
set dismissible(value) {
|
|
251
|
-
this.#_dismissible_accessor_storage = value;
|
|
252
|
-
}
|
|
253
|
-
render() {
|
|
254
|
-
const iconName = ICON_FOR_SEVERITY[this.severity];
|
|
255
|
-
return html`
|
|
256
|
-
<div
|
|
257
|
-
class="zr-alert zr-alert--${this.severity}"
|
|
258
|
-
part="alert"
|
|
259
|
-
role=${this.severity === "error" ? "alert" : "status"}
|
|
260
|
-
aria-live=${this.severity === "error" ? "assertive" : "polite"}
|
|
261
|
-
>
|
|
262
|
-
<zl-icon class="zr-alert__icon" part="icon" name=${iconName} size="16" decorative></zl-icon>
|
|
263
|
-
<div class="zr-alert__body" part="body">
|
|
264
|
-
${this.heading ? html`<span class="zr-alert__title" part="title">${this.heading}</span>` : null}
|
|
265
|
-
<div class="zr-alert__message" part="message">
|
|
266
|
-
<slot></slot>
|
|
267
|
-
</div>
|
|
268
|
-
</div>
|
|
269
|
-
${this.dismissible ? html`<button
|
|
270
|
-
type="button"
|
|
271
|
-
class="zr-alert__close"
|
|
272
|
-
part="close"
|
|
273
|
-
aria-label="Dismiss"
|
|
274
|
-
@click=${this.handleDismiss}
|
|
275
|
-
>
|
|
276
|
-
<zl-icon name="cross" size="16" label="Dismiss" decorative></zl-icon>
|
|
277
|
-
</button>` : null}
|
|
278
|
-
</div>
|
|
279
|
-
`;
|
|
280
|
-
}
|
|
281
|
-
handleDismiss = () => {
|
|
282
|
-
emit(this, "zl-dismiss");
|
|
283
|
-
this.remove();
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
__decorate([property({ reflect: true })], ZlAlert.prototype, "severity", null);
|
|
287
|
-
__decorate([property()], ZlAlert.prototype, "heading", null);
|
|
288
|
-
__decorate([property({
|
|
289
|
-
type: Boolean,
|
|
290
|
-
reflect: true
|
|
291
|
-
})], ZlAlert.prototype, "dismissible", null);
|
|
292
|
-
ZlAlert = __decorate([customElement("zl-alert")], ZlAlert);
|
|
293
|
-
const ICON_FOR_SEVERITY = {
|
|
294
|
-
error: "alert-circle",
|
|
295
|
-
warning: "alert-circle",
|
|
296
|
-
success: "check",
|
|
297
|
-
info: "info"
|
|
298
|
-
};
|
|
299
|
-
const zlAlertManifest = {
|
|
300
|
-
tag: "zl-alert",
|
|
301
|
-
attrs: [
|
|
302
|
-
"severity",
|
|
303
|
-
"heading",
|
|
304
|
-
"dismissible"
|
|
305
|
-
],
|
|
306
|
-
parts: [
|
|
307
|
-
"alert",
|
|
308
|
-
"icon",
|
|
309
|
-
"body",
|
|
310
|
-
"title",
|
|
311
|
-
"message",
|
|
312
|
-
"close"
|
|
313
|
-
],
|
|
314
|
-
slots: [""],
|
|
315
|
-
events: ["zl-dismiss"]
|
|
316
|
-
};
|
|
317
|
-
//#endregion
|
|
318
|
-
//#region ../shared-component-styles/src/lit/button-host.css?inline
|
|
319
|
-
var button_host_default = ":host {\n display: inline-flex;\n}\n\n:host([block]) {\n width: 100%;\n display: flex;\n}\n\n:host([hierarchy=\"primary\"]) {\n color: var(--zl-color-text-button-default, #0f0f11);\n}\n\n:host([hierarchy=\"secondary\"]), :host([hierarchy=\"text\"]) {\n color: var(--zl-color-text-button-invert, #f4f4f6);\n}\n\n:host([disabled]) {\n color: var(--zl-color-text-disabled, #686883);\n}\n\n::slotted([slot=\"leading\"]), ::slotted([slot=\"trailing\"]) {\n align-items: center;\n display: inline-flex;\n}\n\n.zr-btn .spinner {\n display: inline-flex;\n}\n";
|
|
320
|
-
//#endregion
|
|
321
|
-
//#region ../shared-component-styles/src/button.css?inline
|
|
322
|
-
var button_default = ":where(.zr-btn) {\n all: unset;\n box-sizing: border-box;\n cursor: pointer;\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n justify-content: center;\n align-items: center;\n gap: var(--zl-spacing-02, .5rem);\n width: max-content;\n padding-inline: var(--zl-spacing-03, 1rem);\n border-radius: var(--zl-radius-s, .5rem);\n text-align: center;\n white-space: nowrap;\n transition: background-color var(--zl-duration-fast, .12s) var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1)),\n color var(--zl-duration-fast, .12s) var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1)),\n border-color var(--zl-duration-fast, .12s) var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1)),\n background-image var(--zl-duration-fast, .12s) var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1));\n border: 1px solid #0000;\n padding-block: .625rem;\n font-weight: 600;\n display: inline-flex;\n}\n\n.zr-btn:focus-visible, .zr-btn[data-state=\"focused\"] {\n outline: var(--zl-focus-width, 2px) solid var(--zl-focus-color, #f4f4f6);\n outline-offset: var(--zl-focus-offset, 2px);\n}\n\n.zr-btn--block {\n width: 100%;\n display: flex;\n}\n\n.zr-btn--medium {\n height: 3rem;\n font-size: 1rem;\n line-height: 1.5rem;\n}\n\n.zr-btn--small {\n height: 2.5rem;\n font-size: .875rem;\n line-height: 1.25rem;\n}\n\n.zr-btn--primary {\n background: var(--zl-color-surface-default-white, #f4f4f6);\n color: var(--zl-color-text-button-default, #0f0f11);\n}\n\n.zr-btn--primary:hover:not(:disabled), .zr-btn--primary:active:not(:disabled), .zr-btn--primary:focus-visible:not(:disabled), .zr-btn--primary[data-state=\"hovered\"]:not(:disabled), .zr-btn--primary[data-state=\"pressed\"]:not(:disabled), .zr-btn--primary[data-state=\"focused\"]:not(:disabled) {\n background: var(--zl-color-gray-600, #cfcfde);\n border-color: var(--zl-color-border-default-black, #252528);\n}\n\n.zr-btn--primary:disabled {\n color: var(--zl-color-text-disabled, #686883);\n cursor: not-allowed;\n}\n\n.zr-btn--secondary {\n background: var(--zl-color-border-default-black, #252528);\n color: var(--zl-color-text-button-invert, #f4f4f6);\n}\n\n.zr-btn--secondary:hover:not(:disabled), .zr-btn--secondary:active:not(:disabled), .zr-btn--secondary[data-state=\"hovered\"]:not(:disabled), .zr-btn--secondary[data-state=\"pressed\"]:not(:disabled) {\n background: var(--zl-color-gray-200, #484a57);\n}\n\n.zr-btn--secondary:disabled {\n color: var(--zl-color-text-disabled, #686883);\n cursor: not-allowed;\n}\n\n.zr-btn--text {\n color: var(--zl-color-text-button-invert, #f4f4f6);\n background: none;\n}\n\n.zr-btn--text:hover:not(:disabled), .zr-btn--text:active:not(:disabled), .zr-btn--text[data-state=\"hovered\"]:not(:disabled), .zr-btn--text[data-state=\"pressed\"]:not(:disabled) {\n background: var(--zl-color-gray-200, #484a57);\n}\n\n.zr-btn--text:focus-visible:not(:disabled), .zr-btn--text[data-state=\"focused\"]:not(:disabled) {\n background: var(--zl-color-border-default-black, #252528);\n}\n\n.zr-btn--text:disabled {\n color: var(--zl-color-text-disabled, #686883);\n cursor: not-allowed;\n}\n";
|
|
323
|
-
//#endregion
|
|
324
|
-
//#region src/atoms/zl-button.ts
|
|
325
|
-
let ZlButton = class ZlButton extends LitElement {
|
|
326
|
-
static formAssociated = true;
|
|
327
|
-
static shadowRootOptions = {
|
|
328
|
-
...LitElement.shadowRootOptions,
|
|
329
|
-
delegatesFocus: true
|
|
330
|
-
};
|
|
331
|
-
static styles = [baseHostStyles, ...surfaceStyles(button_host_default, button_default)];
|
|
332
|
-
#_hierarchy_accessor_storage = "primary";
|
|
333
|
-
get hierarchy() {
|
|
334
|
-
return this.#_hierarchy_accessor_storage;
|
|
335
|
-
}
|
|
336
|
-
set hierarchy(value) {
|
|
337
|
-
this.#_hierarchy_accessor_storage = value;
|
|
338
|
-
}
|
|
339
|
-
#_size_accessor_storage = "medium";
|
|
340
|
-
get size() {
|
|
341
|
-
return this.#_size_accessor_storage;
|
|
342
|
-
}
|
|
343
|
-
set size(value) {
|
|
344
|
-
this.#_size_accessor_storage = value;
|
|
345
|
-
}
|
|
346
|
-
#_type_accessor_storage = "button";
|
|
347
|
-
get type() {
|
|
348
|
-
return this.#_type_accessor_storage;
|
|
349
|
-
}
|
|
350
|
-
set type(value) {
|
|
351
|
-
this.#_type_accessor_storage = value;
|
|
352
|
-
}
|
|
353
|
-
#_action_accessor_storage = void 0;
|
|
354
|
-
get action() {
|
|
355
|
-
return this.#_action_accessor_storage;
|
|
356
|
-
}
|
|
357
|
-
set action(value) {
|
|
358
|
-
this.#_action_accessor_storage = value;
|
|
359
|
-
}
|
|
360
|
-
#_loading_accessor_storage = false;
|
|
361
|
-
get loading() {
|
|
362
|
-
return this.#_loading_accessor_storage;
|
|
363
|
-
}
|
|
364
|
-
set loading(value) {
|
|
365
|
-
this.#_loading_accessor_storage = value;
|
|
366
|
-
}
|
|
367
|
-
#_disabled_accessor_storage = false;
|
|
368
|
-
get disabled() {
|
|
369
|
-
return this.#_disabled_accessor_storage;
|
|
370
|
-
}
|
|
371
|
-
set disabled(value) {
|
|
372
|
-
this.#_disabled_accessor_storage = value;
|
|
373
|
-
}
|
|
374
|
-
#_block_accessor_storage = false;
|
|
375
|
-
get block() {
|
|
376
|
-
return this.#_block_accessor_storage;
|
|
377
|
-
}
|
|
378
|
-
set block(value) {
|
|
379
|
-
this.#_block_accessor_storage = value;
|
|
380
|
-
}
|
|
381
|
-
#_label_accessor_storage = void 0;
|
|
382
|
-
get label() {
|
|
383
|
-
return this.#_label_accessor_storage;
|
|
384
|
-
}
|
|
385
|
-
set label(value) {
|
|
386
|
-
this.#_label_accessor_storage = value;
|
|
387
|
-
}
|
|
388
|
-
#_testId_accessor_storage = void 0;
|
|
389
|
-
get testId() {
|
|
390
|
-
return this.#_testId_accessor_storage;
|
|
391
|
-
}
|
|
392
|
-
set testId(value) {
|
|
393
|
-
this.#_testId_accessor_storage = value;
|
|
394
|
-
}
|
|
395
|
-
#_forcedState_accessor_storage = null;
|
|
396
|
-
get forcedState() {
|
|
397
|
-
return this.#_forcedState_accessor_storage;
|
|
398
|
-
}
|
|
399
|
-
set forcedState(value) {
|
|
400
|
-
this.#_forcedState_accessor_storage = value;
|
|
401
|
-
}
|
|
402
|
-
internals;
|
|
403
|
-
constructor() {
|
|
404
|
-
super();
|
|
405
|
-
this.internals = this.attachInternals();
|
|
406
|
-
}
|
|
407
|
-
connectedCallback() {
|
|
408
|
-
super.connectedCallback();
|
|
409
|
-
this.addEventListener("click", this.handleHostClick);
|
|
410
|
-
}
|
|
411
|
-
disconnectedCallback() {
|
|
412
|
-
this.removeEventListener("click", this.handleHostClick);
|
|
413
|
-
super.disconnectedCallback();
|
|
414
|
-
}
|
|
415
|
-
focus(options) {
|
|
416
|
-
this.shadowRoot?.querySelector("button")?.focus(options);
|
|
417
|
-
}
|
|
418
|
-
render() {
|
|
419
|
-
const hierarchy = this.stringOption("hierarchy", this.hierarchy, "primary");
|
|
420
|
-
const size = this.stringOption("size", this.size, "medium");
|
|
421
|
-
const type = this.buttonType();
|
|
422
|
-
const loading = this.booleanOption("loading", this.loading);
|
|
423
|
-
const disabled = this.booleanOption("disabled", this.disabled);
|
|
424
|
-
const block = this.booleanOption("block", this.block);
|
|
425
|
-
const label = this.stringOption("label", this.label);
|
|
426
|
-
const blocked = disabled || loading;
|
|
427
|
-
const body = label !== void 0 ? html`<span>${label}</span>` : html`<slot></slot>`;
|
|
428
|
-
return html`
|
|
429
|
-
<button
|
|
430
|
-
class=${classMap({
|
|
431
|
-
root: true,
|
|
432
|
-
"zr-btn": true,
|
|
433
|
-
[`zr-btn--${hierarchy}`]: true,
|
|
434
|
-
[`zr-btn--${size}`]: true,
|
|
435
|
-
"zr-btn--block": block
|
|
436
|
-
})}
|
|
437
|
-
part="root"
|
|
438
|
-
type=${type}
|
|
439
|
-
?disabled=${blocked}
|
|
440
|
-
aria-busy=${loading ? "true" : "false"}
|
|
441
|
-
data-testid=${this.nativeButtonTestId() ?? nothing}
|
|
442
|
-
data-state=${this.forcedState ?? nothing}
|
|
443
|
-
@click=${this.handleClick}
|
|
444
|
-
>
|
|
445
|
-
<slot name="leading"></slot>
|
|
446
|
-
${body}
|
|
447
|
-
${loading ? html`<span class="spinner" part="spinner"><zl-icon name="spinner" size=${size === "small" ? "16" : "24"} spin decorative></zl-icon></span>` : html`<slot name="trailing"></slot>`}
|
|
448
|
-
</button>
|
|
449
|
-
`;
|
|
450
|
-
}
|
|
451
|
-
handleClick = (event) => {
|
|
452
|
-
this.activate(event);
|
|
453
|
-
};
|
|
454
|
-
handleHostClick = (event) => {
|
|
455
|
-
if (event.composedPath()[0] !== this) return;
|
|
456
|
-
this.activate(event);
|
|
457
|
-
};
|
|
458
|
-
nativeButtonTestId() {
|
|
459
|
-
const testId = this.stringOption("data-testid", this.testId);
|
|
460
|
-
if (testId) return `${testId}-button`;
|
|
461
|
-
const action = this.buttonAction();
|
|
462
|
-
return action ? `zitadel-action-${action}` : void 0;
|
|
463
|
-
}
|
|
464
|
-
buttonType() {
|
|
465
|
-
const type = this.stringOption("type", this.type, "button");
|
|
466
|
-
return type === "submit" || type === "reset" ? type : "button";
|
|
467
|
-
}
|
|
468
|
-
buttonAction() {
|
|
469
|
-
return this.stringOption("action", this.action);
|
|
470
|
-
}
|
|
471
|
-
activate(event) {
|
|
472
|
-
const type = this.buttonType();
|
|
473
|
-
const action = this.buttonAction();
|
|
474
|
-
if (this.booleanOption("disabled", this.disabled) || this.booleanOption("loading", this.loading)) {
|
|
475
|
-
event.preventDefault();
|
|
476
|
-
event.stopImmediatePropagation();
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
const form = this.internals.form;
|
|
480
|
-
if (type === "submit" && form) {
|
|
481
|
-
event.preventDefault();
|
|
482
|
-
form.requestSubmit();
|
|
483
|
-
} else if (type === "reset" && form) {
|
|
484
|
-
event.preventDefault();
|
|
485
|
-
form.reset();
|
|
486
|
-
}
|
|
487
|
-
emit(this, "zl-submit", { action: action ?? null });
|
|
488
|
-
}
|
|
489
|
-
stringOption(attribute, value, fallback) {
|
|
490
|
-
if (typeof value === "string" && value.length > 0) return value;
|
|
491
|
-
const attr = this.getAttribute(attribute);
|
|
492
|
-
if (attr !== null && attr.length > 0) return attr;
|
|
493
|
-
return fallback;
|
|
494
|
-
}
|
|
495
|
-
booleanOption(attribute, value) {
|
|
496
|
-
return value === true || this.hasAttribute(attribute);
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
__decorate([property({ reflect: true })], ZlButton.prototype, "hierarchy", null);
|
|
500
|
-
__decorate([property({ reflect: true })], ZlButton.prototype, "size", null);
|
|
501
|
-
__decorate([property()], ZlButton.prototype, "type", null);
|
|
502
|
-
__decorate([property()], ZlButton.prototype, "action", null);
|
|
503
|
-
__decorate([property({ type: Boolean })], ZlButton.prototype, "loading", null);
|
|
504
|
-
__decorate([property({
|
|
505
|
-
type: Boolean,
|
|
506
|
-
reflect: true
|
|
507
|
-
})], ZlButton.prototype, "disabled", null);
|
|
508
|
-
__decorate([property({
|
|
509
|
-
type: Boolean,
|
|
510
|
-
reflect: true
|
|
511
|
-
})], ZlButton.prototype, "block", null);
|
|
512
|
-
__decorate([property()], ZlButton.prototype, "label", null);
|
|
513
|
-
__decorate([property({ attribute: "data-testid" })], ZlButton.prototype, "testId", null);
|
|
514
|
-
__decorate([property({ attribute: "data-state" })], ZlButton.prototype, "forcedState", null);
|
|
515
|
-
ZlButton = __decorate([customElement("zl-button")], ZlButton);
|
|
516
|
-
const zlButtonManifest = {
|
|
517
|
-
tag: "zl-button",
|
|
518
|
-
consumes: { action: {
|
|
519
|
-
kind: "submit",
|
|
520
|
-
required: false
|
|
521
|
-
} },
|
|
522
|
-
attrs: [
|
|
523
|
-
"hierarchy",
|
|
524
|
-
"size",
|
|
525
|
-
"type",
|
|
526
|
-
"action",
|
|
527
|
-
"loading",
|
|
528
|
-
"disabled",
|
|
529
|
-
"block",
|
|
530
|
-
"label",
|
|
531
|
-
"data-testid"
|
|
532
|
-
],
|
|
533
|
-
parts: ["root", "spinner"],
|
|
534
|
-
slots: [
|
|
535
|
-
"",
|
|
536
|
-
"leading",
|
|
537
|
-
"trailing"
|
|
538
|
-
],
|
|
539
|
-
events: ["zl-submit"]
|
|
540
|
-
};
|
|
541
|
-
//#endregion
|
|
542
|
-
//#region ../shared-component-styles/src/lit/card-host.css?inline
|
|
543
|
-
var card_host_default = ":host {\n width: 100%;\n max-width: var(--zl-container-auth-card, 24rem);\n margin-inline: auto;\n display: block;\n}\n\n.zr-card ::slotted([slot=\"header\"]), .zr-card ::slotted([slot=\"footer\"]) {\n margin: 0;\n}\n";
|
|
544
|
-
//#endregion
|
|
545
|
-
//#region ../shared-component-styles/src/card.css?inline
|
|
546
|
-
var card_default = ".zr-card {\n width: 100%;\n max-width: var(--zl-container-auth-card, 24rem);\n border: 1px solid var(--zl-color-surface-default-primary-gray, #252528);\n border-radius: var(--zl-radius-l, 1rem);\n padding: var(--zl-spacing-05, 2rem);\n gap: var(--zl-spacing-05, 2rem);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n box-sizing: border-box;\n background: none;\n flex-direction: column;\n margin-inline: auto;\n display: flex;\n}\n\n.zr-card--compact {\n gap: var(--zl-spacing-04, 1.5rem);\n}\n\n.zr-card__header, .zr-card__footer {\n gap: var(--zl-spacing-02, .5rem);\n flex-direction: column;\n display: flex;\n}\n\n.zr-card__region--empty {\n display: none;\n}\n\n.zr-card__body {\n gap: var(--zl-spacing-03, 1rem);\n flex-direction: column;\n display: flex;\n}\n";
|
|
547
|
-
//#endregion
|
|
548
|
-
//#region src/atoms/zl-card.ts
|
|
549
|
-
let ZlCard = class ZlCard extends LitElement {
|
|
550
|
-
static styles = [baseHostStyles, ...surfaceStyles(card_host_default, card_default)];
|
|
551
|
-
#_compact_accessor_storage = false;
|
|
552
|
-
get compact() {
|
|
553
|
-
return this.#_compact_accessor_storage;
|
|
554
|
-
}
|
|
555
|
-
set compact(value) {
|
|
556
|
-
this.#_compact_accessor_storage = value;
|
|
557
|
-
}
|
|
558
|
-
render() {
|
|
559
|
-
const hasHeader = this.lightDomSlotFilled("header");
|
|
560
|
-
const hasFooter = this.lightDomSlotFilled("footer");
|
|
561
|
-
const cardClass = this.compact ? "zr-card zr-card--compact" : "zr-card";
|
|
562
|
-
const headerClass = hasHeader ? "zr-card__header" : "zr-card__header zr-card__region--empty";
|
|
563
|
-
const footerClass = hasFooter ? "zr-card__footer" : "zr-card__footer zr-card__region--empty";
|
|
564
|
-
return html`
|
|
565
|
-
<section class=${cardClass} part="card">
|
|
566
|
-
<header class=${headerClass} part="header">
|
|
567
|
-
<slot name="header" @slotchange=${this.onSlotChange}></slot>
|
|
568
|
-
</header>
|
|
569
|
-
<div class="zr-card__body" part="body">
|
|
570
|
-
<slot></slot>
|
|
571
|
-
</div>
|
|
572
|
-
<footer class=${footerClass} part="footer">
|
|
573
|
-
<slot name="footer" @slotchange=${this.onSlotChange}></slot>
|
|
574
|
-
</footer>
|
|
575
|
-
</section>
|
|
576
|
-
`;
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* `lightDomSlotFilled` is a render-time snapshot, so re-run render whenever a
|
|
580
|
-
* named slot's assignment changes (e.g. a header added after first paint).
|
|
581
|
-
* The initial render still reads children synchronously, avoiding the
|
|
582
|
-
* empty-then-filled flash a slotchange-only approach would introduce.
|
|
583
|
-
*/
|
|
584
|
-
onSlotChange = () => {
|
|
585
|
-
this.requestUpdate();
|
|
586
|
-
};
|
|
587
|
-
/** Slotted nodes are always light-DOM children of the host in our templates. */
|
|
588
|
-
lightDomSlotFilled(slot) {
|
|
589
|
-
for (const child of this.children) if (child.getAttribute("slot") === slot) return true;
|
|
590
|
-
return false;
|
|
591
|
-
}
|
|
592
|
-
};
|
|
593
|
-
__decorate([property({
|
|
594
|
-
type: Boolean,
|
|
595
|
-
reflect: true
|
|
596
|
-
})], ZlCard.prototype, "compact", null);
|
|
597
|
-
ZlCard = __decorate([customElement("zl-card")], ZlCard);
|
|
598
|
-
const zlCardManifest = {
|
|
599
|
-
tag: "zl-card",
|
|
600
|
-
attrs: ["compact"],
|
|
601
|
-
parts: [
|
|
602
|
-
"card",
|
|
603
|
-
"header",
|
|
604
|
-
"body",
|
|
605
|
-
"footer"
|
|
606
|
-
],
|
|
607
|
-
slots: [
|
|
608
|
-
"",
|
|
609
|
-
"header",
|
|
610
|
-
"footer"
|
|
611
|
-
],
|
|
612
|
-
events: []
|
|
613
|
-
};
|
|
614
|
-
//#endregion
|
|
615
|
-
//#region ../shared-component-styles/src/lit/text-field-host.css?inline
|
|
616
|
-
var text_field_host_default = ":host {\n display: block;\n}\n\n::slotted([slot=\"prefix\"]), ::slotted([slot=\"suffix\"]) {\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n display: inline-flex;\n}\n\n.zr-field__help[hidden], .zr-field__error[hidden] {\n display: none;\n}\n\n:host([data-state=\"hovered\"]:not([disabled])) .zr-field:not(.zr-field--invalid):not(.zr-field--success) .zr-field__wrap:not(:focus-within) {\n border-color: var(--zl-color-gray-500, #9e9eb2);\n background-color: color-mix(in srgb, var(--zl-color-text-primary-white, #f4f4f6) 10%, transparent);\n}\n\n:host([data-state=\"focused\"]:not([disabled])) .zr-field:not(.zr-field--invalid):not(.zr-field--success) .zr-field__wrap {\n border-color: var(--zl-color-border-default-white, #f4f4f6);\n}\n\n:host([data-state=\"focused\"]:not([disabled])) .zr-field--invalid .zr-field__wrap {\n border-color: var(--zl-color-border-error, #ea4f70);\n}\n\n:host([data-state=\"focused\"]:not([disabled])) .zr-field--success .zr-field__wrap {\n border-color: var(--zl-color-border-success, #33a779);\n}\n";
|
|
617
|
-
//#endregion
|
|
618
|
-
//#region ../shared-component-styles/src/text-field.css?inline
|
|
619
|
-
var text_field_default = ".zr-field {\n align-items: stretch;\n gap: var(--zl-spacing-02, .5rem);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n flex-direction: column;\n display: flex;\n}\n\n.zr-field__label-row {\n justify-content: space-between;\n align-items: flex-start;\n gap: var(--zl-spacing-02, .5rem);\n width: 100%;\n display: flex;\n}\n\n.zr-field__label {\n align-items: center;\n gap: var(--zl-spacing-01, .25rem);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n font-size: 1rem;\n font-weight: 600;\n line-height: 1.5rem;\n display: inline-flex;\n}\n\n.zr-field__link {\n color: var(--zl-color-icon-default-purple, #bba5e4);\n flex-shrink: 0;\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n text-decoration: none;\n}\n\n.zr-field__link:hover {\n text-decoration: underline;\n}\n\n.zr-field__link:focus-visible {\n outline: var(--zl-focus-width, 2px) solid var(--zl-focus-color, #f4f4f6);\n outline-offset: var(--zl-focus-offset, 2px);\n border-radius: 2px;\n}\n\n.zr-field__required {\n color: var(--zl-color-text-error, #ea4f70);\n}\n\n.zr-field--disabled .zr-field__label {\n color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-field__wrap {\n align-items: center;\n gap: var(--zl-spacing-02, .5rem);\n padding-block: var(--zl-spacing-02, .5rem);\n padding-inline: var(--zl-spacing-03, 1rem);\n border-radius: var(--zl-radius-xs, .25rem);\n border: 1px solid var(--zl-color-border-default-gray-300, #686883);\n height: 2.5rem;\n transition: border-color var(--zl-duration-fast, .12s) var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1)),\n background-color var(--zl-duration-fast, .12s) var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1));\n box-sizing: border-box;\n background: none;\n display: flex;\n position: relative;\n overflow: visible;\n}\n\n.zr-field__wrap--trailing {\n padding-inline-end: 2.5rem;\n}\n\n.zr-field:not(.zr-field--disabled) .zr-field__wrap:hover:not(:focus-within) {\n border-color: var(--zl-color-gray-500, #9e9eb2);\n background-color: color-mix(in srgb, var(--zl-color-text-primary-white, #f4f4f6) 10%, transparent);\n}\n\n.zr-field:not(.zr-field--invalid):not(.zr-field--disabled):not(.zr-field--success) .zr-field__wrap:has(.zr-field__input:not(:placeholder-shown)):not(:focus-within) {\n border-color: var(--zl-color-border-default-gray-400, #82829c);\n}\n\n.zr-field:not(.zr-field--invalid):not(.zr-field--disabled):not(.zr-field--success) .zr-field__wrap:focus-within {\n border-color: var(--zl-color-border-default-white, #f4f4f6);\n outline: none;\n}\n\n.zr-field--invalid .zr-field__wrap {\n border-color: var(--zl-color-border-error, #ea4f70);\n}\n\n.zr-field--invalid .zr-field__wrap:focus-within {\n border-color: var(--zl-color-border-error, #ea4f70);\n outline: none;\n}\n\n.zr-field--success .zr-field__wrap {\n border-color: var(--zl-color-border-success, #33a779);\n}\n\n.zr-field--success .zr-field__wrap:focus-within {\n border-color: var(--zl-color-border-success, #33a779);\n outline: none;\n}\n\n.zr-field--disabled .zr-field__wrap {\n border-color: var(--zl-color-border-default-gray-200, #484a57);\n}\n\n.zr-field__input {\n min-width: 0;\n height: 100%;\n color: var(--zl-color-text-primary-white, #f4f4f6);\n background: none;\n border: 0;\n outline: none;\n flex: auto;\n padding: 0;\n font-family: inherit;\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n}\n\n.zr-field__input[type=\"password\"] {\n letter-spacing: .125rem;\n}\n\n.zr-field__input::placeholder {\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n}\n\n.zr-field__input:focus, .zr-field__input:focus-visible {\n outline: none;\n}\n\n.zr-field__input:disabled {\n cursor: not-allowed;\n color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-field--disabled .zr-field__wrap:hover {\n border-color: var(--zl-color-border-default-gray-200, #484a57);\n background-color: #0000;\n}\n\n.zr-field__trailing {\n width: 1rem;\n height: 1rem;\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n justify-content: center;\n align-items: center;\n display: inline-flex;\n position: absolute;\n top: 50%;\n right: .9375rem;\n transform: translateY(-50%);\n}\n\n.zr-field__trailing-action {\n color: inherit;\n cursor: pointer;\n background: none;\n border: 0;\n justify-content: center;\n align-items: center;\n margin: 0;\n padding: 0;\n line-height: 0;\n display: inline-flex;\n}\n\n.zr-field__trailing-action:focus-visible {\n outline: var(--zl-focus-width, 2px) solid var(--zl-focus-color, #f4f4f6);\n outline-offset: var(--zl-focus-offset, 2px);\n border-radius: 2px;\n}\n\n.zr-field__trailing-action:disabled {\n cursor: not-allowed;\n}\n\n.zr-field--invalid .zr-field__trailing {\n color: var(--zl-color-text-error, #ea4f70);\n}\n\n.zr-field--success .zr-field__trailing {\n color: var(--zl-color-text-success, #33a779);\n}\n\n.zr-field__help {\n color: var(--zl-color-text-primary-white, #f4f4f6);\n font-size: .75rem;\n line-height: 1rem;\n}\n\n.zr-field__success {\n color: var(--zl-color-text-success, #33a779);\n font-size: .75rem;\n line-height: 1rem;\n}\n\n.zr-field__error {\n color: var(--zl-color-text-error, #ea4f70);\n font-size: .75rem;\n line-height: 1rem;\n}\n";
|
|
620
|
-
//#endregion
|
|
621
|
-
//#region src/internal/unique-id.ts
|
|
622
|
-
/**
|
|
623
|
-
* Monotonic counter for DOM IDs that need to be unique within a document but
|
|
624
|
-
* stable across renders. Used by atoms that wire `<label for>` ↔ `<input id>`
|
|
625
|
-
* inside their Shadow DOM.
|
|
626
|
-
*
|
|
627
|
-
* A counter beats `Math.random()` and `crypto.randomUUID()` here:
|
|
628
|
-
*
|
|
629
|
-
* - Tests get deterministic IDs.
|
|
630
|
-
* - There's zero collision risk within a page.
|
|
631
|
-
* - It's an order of magnitude faster on each component instantiation.
|
|
632
|
-
*/
|
|
633
|
-
let counter = 0;
|
|
634
|
-
function nextUid(prefix) {
|
|
635
|
-
counter += 1;
|
|
636
|
-
return `${prefix}-${counter}`;
|
|
637
|
-
}
|
|
638
|
-
//#endregion
|
|
639
|
-
//#region src/atoms/zl-field.ts
|
|
640
|
-
let ZlField = class ZlField extends LitElement {
|
|
641
|
-
static formAssociated = true;
|
|
642
|
-
static shadowRootOptions = {
|
|
643
|
-
...LitElement.shadowRootOptions,
|
|
644
|
-
delegatesFocus: true
|
|
645
|
-
};
|
|
646
|
-
static styles = [baseHostStyles, ...surfaceStyles(text_field_host_default, text_field_default)];
|
|
647
|
-
/**
|
|
648
|
-
* Field name — used as the key in form submission and in `zl-input` event
|
|
649
|
-
* detail. For form-associated custom elements the browser owns a native
|
|
650
|
-
* `name` property; using `@property()` would create a conflicting accessor
|
|
651
|
-
* that loses sync with the DOM attribute. We therefore manage it manually.
|
|
652
|
-
*/
|
|
653
|
-
get name() {
|
|
654
|
-
return this.getAttribute("name") ?? "";
|
|
655
|
-
}
|
|
656
|
-
set name(value) {
|
|
657
|
-
this.setAttribute("name", value);
|
|
658
|
-
}
|
|
659
|
-
#_label_accessor_storage = "";
|
|
660
|
-
get label() {
|
|
661
|
-
return this.#_label_accessor_storage;
|
|
662
|
-
}
|
|
663
|
-
set label(value) {
|
|
664
|
-
this.#_label_accessor_storage = value;
|
|
665
|
-
}
|
|
666
|
-
#_type_accessor_storage = "text";
|
|
667
|
-
get type() {
|
|
668
|
-
return this.#_type_accessor_storage;
|
|
669
|
-
}
|
|
670
|
-
set type(value) {
|
|
671
|
-
this.#_type_accessor_storage = value;
|
|
672
|
-
}
|
|
673
|
-
#_value_accessor_storage = "";
|
|
674
|
-
get value() {
|
|
675
|
-
return this.#_value_accessor_storage;
|
|
676
|
-
}
|
|
677
|
-
set value(value) {
|
|
678
|
-
this.#_value_accessor_storage = value;
|
|
679
|
-
}
|
|
680
|
-
#_placeholder_accessor_storage = "";
|
|
681
|
-
get placeholder() {
|
|
682
|
-
return this.#_placeholder_accessor_storage;
|
|
683
|
-
}
|
|
684
|
-
set placeholder(value) {
|
|
685
|
-
this.#_placeholder_accessor_storage = value;
|
|
686
|
-
}
|
|
687
|
-
#_autocomplete_accessor_storage = void 0;
|
|
688
|
-
get autocomplete() {
|
|
689
|
-
return this.#_autocomplete_accessor_storage;
|
|
690
|
-
}
|
|
691
|
-
set autocomplete(value) {
|
|
692
|
-
this.#_autocomplete_accessor_storage = value;
|
|
693
|
-
}
|
|
694
|
-
#_pattern_accessor_storage = void 0;
|
|
695
|
-
get pattern() {
|
|
696
|
-
return this.#_pattern_accessor_storage;
|
|
697
|
-
}
|
|
698
|
-
set pattern(value) {
|
|
699
|
-
this.#_pattern_accessor_storage = value;
|
|
700
|
-
}
|
|
701
|
-
#_error_accessor_storage = "";
|
|
702
|
-
get error() {
|
|
703
|
-
return this.#_error_accessor_storage;
|
|
704
|
-
}
|
|
705
|
-
set error(value) {
|
|
706
|
-
this.#_error_accessor_storage = value;
|
|
707
|
-
}
|
|
708
|
-
#_success_accessor_storage = "";
|
|
709
|
-
get success() {
|
|
710
|
-
return this.#_success_accessor_storage;
|
|
711
|
-
}
|
|
712
|
-
set success(value) {
|
|
713
|
-
this.#_success_accessor_storage = value;
|
|
714
|
-
}
|
|
715
|
-
#_testId_accessor_storage = void 0;
|
|
716
|
-
get testId() {
|
|
717
|
-
return this.#_testId_accessor_storage;
|
|
718
|
-
}
|
|
719
|
-
set testId(value) {
|
|
720
|
-
this.#_testId_accessor_storage = value;
|
|
721
|
-
}
|
|
722
|
-
#_forgotPasswordHref_accessor_storage = void 0;
|
|
723
|
-
get forgotPasswordHref() {
|
|
724
|
-
return this.#_forgotPasswordHref_accessor_storage;
|
|
725
|
-
}
|
|
726
|
-
set forgotPasswordHref(value) {
|
|
727
|
-
this.#_forgotPasswordHref_accessor_storage = value;
|
|
728
|
-
}
|
|
729
|
-
#_forgotPasswordLabel_accessor_storage = "Forgot password?";
|
|
730
|
-
get forgotPasswordLabel() {
|
|
731
|
-
return this.#_forgotPasswordLabel_accessor_storage;
|
|
732
|
-
}
|
|
733
|
-
set forgotPasswordLabel(value) {
|
|
734
|
-
this.#_forgotPasswordLabel_accessor_storage = value;
|
|
735
|
-
}
|
|
736
|
-
#_trailingIcon_accessor_storage = true;
|
|
737
|
-
get trailingIcon() {
|
|
738
|
-
return this.#_trailingIcon_accessor_storage;
|
|
739
|
-
}
|
|
740
|
-
set trailingIcon(value) {
|
|
741
|
-
this.#_trailingIcon_accessor_storage = value;
|
|
742
|
-
}
|
|
743
|
-
#_required_accessor_storage = false;
|
|
744
|
-
get required() {
|
|
745
|
-
return this.#_required_accessor_storage;
|
|
746
|
-
}
|
|
747
|
-
set required(value) {
|
|
748
|
-
this.#_required_accessor_storage = value;
|
|
749
|
-
}
|
|
750
|
-
#_disabled_accessor_storage = false;
|
|
751
|
-
get disabled() {
|
|
752
|
-
return this.#_disabled_accessor_storage;
|
|
753
|
-
}
|
|
754
|
-
set disabled(value) {
|
|
755
|
-
this.#_disabled_accessor_storage = value;
|
|
756
|
-
}
|
|
757
|
-
#_invalid_accessor_storage = false;
|
|
758
|
-
get invalid() {
|
|
759
|
-
return this.#_invalid_accessor_storage;
|
|
760
|
-
}
|
|
761
|
-
set invalid(value) {
|
|
762
|
-
this.#_invalid_accessor_storage = value;
|
|
763
|
-
}
|
|
764
|
-
#_hasHelp_accessor_storage = false;
|
|
765
|
-
get hasHelp() {
|
|
766
|
-
return this.#_hasHelp_accessor_storage;
|
|
767
|
-
}
|
|
768
|
-
set hasHelp(value) {
|
|
769
|
-
this.#_hasHelp_accessor_storage = value;
|
|
770
|
-
}
|
|
771
|
-
#_hasSuffixSlot_accessor_storage = false;
|
|
772
|
-
get hasSuffixSlot() {
|
|
773
|
-
return this.#_hasSuffixSlot_accessor_storage;
|
|
774
|
-
}
|
|
775
|
-
set hasSuffixSlot(value) {
|
|
776
|
-
this.#_hasSuffixSlot_accessor_storage = value;
|
|
777
|
-
}
|
|
778
|
-
#_inputEl_accessor_storage = null;
|
|
779
|
-
get inputEl() {
|
|
780
|
-
return this.#_inputEl_accessor_storage;
|
|
781
|
-
}
|
|
782
|
-
set inputEl(value) {
|
|
783
|
-
this.#_inputEl_accessor_storage = value;
|
|
784
|
-
}
|
|
785
|
-
inputId = nextUid("zl-field");
|
|
786
|
-
internals;
|
|
787
|
-
constructor() {
|
|
788
|
-
super();
|
|
789
|
-
this.internals = this.attachInternals();
|
|
790
|
-
}
|
|
791
|
-
connectedCallback() {
|
|
792
|
-
super.connectedCallback();
|
|
793
|
-
this.syncFormState();
|
|
794
|
-
}
|
|
795
|
-
willUpdate(changed) {
|
|
796
|
-
if (changed.has("value") || changed.has("required") || changed.has("error")) this.syncFormState();
|
|
797
|
-
}
|
|
798
|
-
formResetCallback() {
|
|
799
|
-
this.value = "";
|
|
800
|
-
}
|
|
801
|
-
formStateRestoreCallback(state) {
|
|
802
|
-
this.value = state ?? "";
|
|
803
|
-
}
|
|
804
|
-
focus(options) {
|
|
805
|
-
this.inputEl?.focus(options);
|
|
806
|
-
}
|
|
807
|
-
render() {
|
|
808
|
-
const labelId = `${this.inputId}-label`;
|
|
809
|
-
const errorId = `${this.inputId}-error`;
|
|
810
|
-
const successId = `${this.inputId}-success`;
|
|
811
|
-
const helpId = `${this.inputId}-help`;
|
|
812
|
-
const showError = Boolean(this.error);
|
|
813
|
-
const showSuccess = Boolean(this.success) && !showError && !this.invalid;
|
|
814
|
-
const describedBy = [
|
|
815
|
-
showError ? errorId : null,
|
|
816
|
-
showSuccess ? successId : null,
|
|
817
|
-
this.hasHelp ? helpId : null
|
|
818
|
-
].filter(Boolean).join(" ");
|
|
819
|
-
const rootClass = classMap({
|
|
820
|
-
"zr-field": true,
|
|
821
|
-
"zr-field--invalid": this.invalid || showError,
|
|
822
|
-
"zr-field--success": showSuccess,
|
|
823
|
-
"zr-field--disabled": this.disabled
|
|
824
|
-
});
|
|
825
|
-
const showDefaultTrailing = this.trailingIcon && !this.hasSuffixSlot && !this.disabled;
|
|
826
|
-
const trailing = showDefaultTrailing ? this.renderTrailingIcon() : null;
|
|
827
|
-
const wrapClass = classMap({
|
|
828
|
-
"zr-field__wrap": true,
|
|
829
|
-
"zr-field__wrap--trailing": showDefaultTrailing
|
|
830
|
-
});
|
|
831
|
-
return html`
|
|
832
|
-
<div class=${rootClass} part="root">
|
|
833
|
-
${this.renderLabelRow(labelId)}
|
|
834
|
-
<div class=${wrapClass} part="input-wrap">
|
|
835
|
-
<slot name="prefix"></slot>
|
|
836
|
-
<input
|
|
837
|
-
class="zr-field__input"
|
|
838
|
-
part="input"
|
|
839
|
-
id=${this.inputId}
|
|
840
|
-
data-testid=${ifDefined(this.nativeInputTestId())}
|
|
841
|
-
name=${this.name}
|
|
842
|
-
type=${this.type}
|
|
843
|
-
.value=${live(this.value)}
|
|
844
|
-
placeholder=${this.placeholder}
|
|
845
|
-
autocomplete=${ifDefined(this.autocomplete)}
|
|
846
|
-
pattern=${ifDefined(this.pattern)}
|
|
847
|
-
?required=${this.required}
|
|
848
|
-
?disabled=${this.disabled}
|
|
849
|
-
aria-invalid=${this.invalid || showError ? "true" : "false"}
|
|
850
|
-
aria-describedby=${describedBy || nothing}
|
|
851
|
-
@input=${this.handleInput}
|
|
852
|
-
@change=${this.handleChange}
|
|
853
|
-
@keydown=${this.handleKeyDown}
|
|
854
|
-
/>
|
|
855
|
-
<slot name="suffix" @slotchange=${this.handleSuffixSlotChange}></slot>
|
|
856
|
-
${trailing}
|
|
857
|
-
</div>
|
|
858
|
-
<div class="zr-field__help" part="help" id=${helpId} ?hidden=${!this.hasHelp}>
|
|
859
|
-
<slot name="help" @slotchange=${this.handleHelpSlotChange}></slot>
|
|
860
|
-
</div>
|
|
861
|
-
<div
|
|
862
|
-
class="zr-field__success"
|
|
863
|
-
part="success"
|
|
864
|
-
id=${successId}
|
|
865
|
-
role="status"
|
|
866
|
-
?hidden=${!showSuccess}
|
|
867
|
-
>
|
|
868
|
-
${this.success}
|
|
869
|
-
</div>
|
|
870
|
-
<div class="zr-field__error" part="error" id=${errorId} role="alert" ?hidden=${!showError}>
|
|
871
|
-
${this.error}
|
|
872
|
-
</div>
|
|
873
|
-
</div>
|
|
874
|
-
`;
|
|
875
|
-
}
|
|
876
|
-
renderLabelRow(labelId) {
|
|
877
|
-
if (!this.label) return null;
|
|
878
|
-
if (this.forgotPasswordHref) return html`
|
|
879
|
-
<div class="zr-field__label-row" part="label-row">
|
|
880
|
-
<label class="zr-field__label" part="label" id=${labelId} for=${this.inputId}>
|
|
881
|
-
<span>${this.label}</span>
|
|
882
|
-
${this.required ? html`<span class="zr-field__required" aria-hidden="true">*</span>` : null}
|
|
883
|
-
</label>
|
|
884
|
-
<a class="zr-field__link" part="forgot-link" href=${this.forgotPasswordHref}
|
|
885
|
-
>${this.forgotPasswordLabel}</a
|
|
886
|
-
>
|
|
887
|
-
</div>
|
|
888
|
-
`;
|
|
889
|
-
return html`
|
|
890
|
-
<label class="zr-field__label" part="label" id=${labelId} for=${this.inputId}>
|
|
891
|
-
<span>${this.label}</span>
|
|
892
|
-
${this.required ? html`<span class="zr-field__required" aria-hidden="true">*</span>` : null}
|
|
893
|
-
</label>
|
|
894
|
-
`;
|
|
895
|
-
}
|
|
896
|
-
renderTrailingIcon() {
|
|
897
|
-
let iconName = "cross";
|
|
898
|
-
let tone = "default";
|
|
899
|
-
let clearable = true;
|
|
900
|
-
if (this.invalid || this.error) {
|
|
901
|
-
iconName = "alert-circle";
|
|
902
|
-
tone = "error";
|
|
903
|
-
clearable = false;
|
|
904
|
-
} else if (this.success) {
|
|
905
|
-
iconName = "check";
|
|
906
|
-
tone = "success";
|
|
907
|
-
clearable = false;
|
|
908
|
-
}
|
|
909
|
-
const icon = html`<zl-icon name=${iconName} size="16" tone=${tone} decorative></zl-icon>`;
|
|
910
|
-
if (!clearable) return html`<span class="zr-field__trailing" part="trailing-icon">${icon}</span>`;
|
|
911
|
-
return html`
|
|
912
|
-
<span class="zr-field__trailing" part="trailing-icon">
|
|
913
|
-
<button
|
|
914
|
-
type="button"
|
|
915
|
-
class="zr-field__trailing-action"
|
|
916
|
-
part="trailing-action"
|
|
917
|
-
aria-label="Clear"
|
|
918
|
-
?disabled=${this.disabled}
|
|
919
|
-
@click=${this.handleClear}
|
|
920
|
-
>
|
|
921
|
-
${icon}
|
|
922
|
-
</button>
|
|
923
|
-
</span>
|
|
924
|
-
`;
|
|
925
|
-
}
|
|
926
|
-
syncFormState() {
|
|
927
|
-
this.internals.setFormValue?.(this.value);
|
|
928
|
-
if (this.required && !this.value) this.internals.setValidity?.({ valueMissing: true }, "Please fill out this field.");
|
|
929
|
-
else if (this.error) this.internals.setValidity?.({ customError: true }, this.error);
|
|
930
|
-
else this.internals.setValidity?.({});
|
|
931
|
-
}
|
|
932
|
-
handleHelpSlotChange = (event) => {
|
|
933
|
-
const slot = event.target;
|
|
934
|
-
this.hasHelp = slot.assignedNodes({ flatten: true }).length > 0;
|
|
935
|
-
};
|
|
936
|
-
handleSuffixSlotChange = (event) => {
|
|
937
|
-
const slot = event.target;
|
|
938
|
-
this.hasSuffixSlot = slot.assignedNodes({ flatten: true }).length > 0;
|
|
939
|
-
};
|
|
940
|
-
handleClear = () => {
|
|
941
|
-
this.value = "";
|
|
942
|
-
emit(this, "zl-input", {
|
|
943
|
-
name: this.name,
|
|
944
|
-
value: this.value
|
|
945
|
-
});
|
|
946
|
-
this.syncFormState();
|
|
947
|
-
this.dispatchNativeInput();
|
|
948
|
-
this.inputEl?.focus();
|
|
949
|
-
};
|
|
950
|
-
handleInput = (event) => {
|
|
951
|
-
event.stopPropagation();
|
|
952
|
-
const input = event.target;
|
|
953
|
-
this.value = input.value;
|
|
954
|
-
this.syncFormState();
|
|
955
|
-
emit(this, "zl-input", {
|
|
956
|
-
name: this.name,
|
|
957
|
-
value: this.value
|
|
958
|
-
});
|
|
959
|
-
this.dispatchNativeInput(event);
|
|
960
|
-
};
|
|
961
|
-
handleChange = (event) => {
|
|
962
|
-
event.stopPropagation();
|
|
963
|
-
const input = event.target;
|
|
964
|
-
this.value = input.value;
|
|
965
|
-
this.syncFormState();
|
|
966
|
-
this.dispatchNativeChange();
|
|
967
|
-
};
|
|
968
|
-
handleKeyDown = (event) => {
|
|
969
|
-
if (event.key === "Enter" && !event.isComposing && !event.shiftKey && !event.altKey && !event.metaKey && !event.ctrlKey) {
|
|
970
|
-
const form = this.internals.form;
|
|
971
|
-
if (form) {
|
|
972
|
-
event.preventDefault();
|
|
973
|
-
form.requestSubmit();
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
};
|
|
977
|
-
nativeInputTestId() {
|
|
978
|
-
if (this.testId) return `${this.testId}-input`;
|
|
979
|
-
return this.name ? `zitadel-input-${this.name}` : void 0;
|
|
980
|
-
}
|
|
981
|
-
dispatchNativeInput(source) {
|
|
982
|
-
if (typeof InputEvent === "function") {
|
|
983
|
-
const input = source instanceof InputEvent ? source : void 0;
|
|
984
|
-
this.dispatchEvent(new InputEvent("input", {
|
|
985
|
-
bubbles: true,
|
|
986
|
-
composed: true,
|
|
987
|
-
data: input?.data ?? null,
|
|
988
|
-
inputType: input?.inputType ?? "",
|
|
989
|
-
isComposing: input?.isComposing ?? false
|
|
990
|
-
}));
|
|
991
|
-
return;
|
|
992
|
-
}
|
|
993
|
-
this.dispatchEvent(new Event("input", {
|
|
994
|
-
bubbles: true,
|
|
995
|
-
composed: true
|
|
996
|
-
}));
|
|
997
|
-
}
|
|
998
|
-
dispatchNativeChange() {
|
|
999
|
-
this.dispatchEvent(new Event("change", {
|
|
1000
|
-
bubbles: true,
|
|
1001
|
-
composed: true
|
|
1002
|
-
}));
|
|
1003
|
-
}
|
|
1004
|
-
};
|
|
1005
|
-
__decorate([property()], ZlField.prototype, "label", null);
|
|
1006
|
-
__decorate([property()], ZlField.prototype, "type", null);
|
|
1007
|
-
__decorate([property()], ZlField.prototype, "value", null);
|
|
1008
|
-
__decorate([property()], ZlField.prototype, "placeholder", null);
|
|
1009
|
-
__decorate([property()], ZlField.prototype, "autocomplete", null);
|
|
1010
|
-
__decorate([property()], ZlField.prototype, "pattern", null);
|
|
1011
|
-
__decorate([property()], ZlField.prototype, "error", null);
|
|
1012
|
-
__decorate([property()], ZlField.prototype, "success", null);
|
|
1013
|
-
__decorate([property({ attribute: "data-testid" })], ZlField.prototype, "testId", null);
|
|
1014
|
-
__decorate([property({ attribute: "forgot-password-href" })], ZlField.prototype, "forgotPasswordHref", null);
|
|
1015
|
-
__decorate([property({ attribute: "forgot-password-label" })], ZlField.prototype, "forgotPasswordLabel", null);
|
|
1016
|
-
__decorate([property({
|
|
1017
|
-
type: Boolean,
|
|
1018
|
-
attribute: "trailing-icon"
|
|
1019
|
-
})], ZlField.prototype, "trailingIcon", null);
|
|
1020
|
-
__decorate([property({ type: Boolean })], ZlField.prototype, "required", null);
|
|
1021
|
-
__decorate([property({
|
|
1022
|
-
type: Boolean,
|
|
1023
|
-
reflect: true
|
|
1024
|
-
})], ZlField.prototype, "disabled", null);
|
|
1025
|
-
__decorate([property({
|
|
1026
|
-
type: Boolean,
|
|
1027
|
-
reflect: true
|
|
1028
|
-
})], ZlField.prototype, "invalid", null);
|
|
1029
|
-
__decorate([state()], ZlField.prototype, "hasHelp", null);
|
|
1030
|
-
__decorate([state()], ZlField.prototype, "hasSuffixSlot", null);
|
|
1031
|
-
__decorate([query(".zr-field__input")], ZlField.prototype, "inputEl", null);
|
|
1032
|
-
ZlField = __decorate([customElement("zl-field")], ZlField);
|
|
1033
|
-
const zlFieldManifest = {
|
|
1034
|
-
tag: "zl-field",
|
|
1035
|
-
consumes: { field: { required: true } },
|
|
1036
|
-
attrs: [
|
|
1037
|
-
"name",
|
|
1038
|
-
"label",
|
|
1039
|
-
"type",
|
|
1040
|
-
"value",
|
|
1041
|
-
"placeholder",
|
|
1042
|
-
"autocomplete",
|
|
1043
|
-
"pattern",
|
|
1044
|
-
"data-testid",
|
|
1045
|
-
"required",
|
|
1046
|
-
"disabled",
|
|
1047
|
-
"invalid",
|
|
1048
|
-
"error",
|
|
1049
|
-
"success",
|
|
1050
|
-
"forgot-password-href",
|
|
1051
|
-
"forgot-password-label",
|
|
1052
|
-
"trailing-icon"
|
|
1053
|
-
],
|
|
1054
|
-
parts: [
|
|
1055
|
-
"root",
|
|
1056
|
-
"label",
|
|
1057
|
-
"label-row",
|
|
1058
|
-
"forgot-link",
|
|
1059
|
-
"input-wrap",
|
|
1060
|
-
"input",
|
|
1061
|
-
"trailing-icon",
|
|
1062
|
-
"trailing-action",
|
|
1063
|
-
"help",
|
|
1064
|
-
"success",
|
|
1065
|
-
"error"
|
|
1066
|
-
],
|
|
1067
|
-
slots: [
|
|
1068
|
-
"prefix",
|
|
1069
|
-
"suffix",
|
|
1070
|
-
"help"
|
|
1071
|
-
],
|
|
1072
|
-
events: ["zl-input"]
|
|
1073
|
-
};
|
|
1074
|
-
//#endregion
|
|
1075
|
-
//#region ../shared-component-styles/src/lit/page-shell-host.css?inline
|
|
1076
|
-
var page_shell_host_default = ":host {\n background: var(--zl-color-surface-default-black, #0f0f11);\n min-height: 100vh;\n color: var(--zl-color-text-primary-white, #f4f4f6);\n display: block;\n}\n\n:host([data-embedded]) {\n height: 100%;\n min-height: 100%;\n}\n\n:host([data-embedded]) .zr-page-shell {\n min-height: 100%;\n}\n\n.zr-page-shell ::slotted([slot=\"header\"]), .zr-page-shell ::slotted([slot=\"footer\"]) {\n margin: 0;\n}\n";
|
|
1077
|
-
//#endregion
|
|
1078
|
-
//#region ../shared-component-styles/src/page-shell.css?inline
|
|
1079
|
-
var page_shell_default = ".zr-page-shell {\n background: var(--zl-color-surface-default-black, #0f0f11);\n min-height: 100vh;\n color: var(--zl-color-text-primary-white, #f4f4f6);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n justify-content: center;\n align-items: center;\n gap: var(--zl-spacing-04, 1.5rem);\n padding-block: var(--zl-spacing-05, 2rem);\n padding-inline: var(--zl-spacing-03, 1rem);\n box-sizing: border-box;\n flex-direction: column;\n display: flex;\n}\n\n@media (width >= 48rem) {\n .zr-page-shell {\n padding-block: 3.25rem;\n padding-inline: var(--zl-spacing-03, 1rem);\n }\n}\n\n.zr-page-shell__header, .zr-page-shell__main, .zr-page-shell__footer {\n justify-content: center;\n align-items: center;\n width: 100%;\n display: flex;\n}\n\n.zr-page-shell__main {\n flex: none;\n}\n\n.zr-page-shell__footer {\n min-height: 1.5rem;\n}\n\n.zr-page-shell__region--empty {\n display: none;\n}\n\n.zr-page-shell[data-embedded] {\n height: 100%;\n min-height: 100%;\n}\n";
|
|
1080
|
-
//#endregion
|
|
1081
|
-
//#region src/atoms/zl-page-shell.ts
|
|
1082
|
-
let ZlPageShell = class ZlPageShell extends LitElement {
|
|
1083
|
-
static styles = [baseHostStyles, ...surfaceStyles(page_shell_host_default, page_shell_default)];
|
|
1084
|
-
render() {
|
|
1085
|
-
const hasHeader = this.lightDomSlotFilled("header");
|
|
1086
|
-
const hasFooter = this.lightDomSlotFilled("footer");
|
|
1087
|
-
const headerClass = hasHeader ? "zr-page-shell__header" : "zr-page-shell__header zr-page-shell__region--empty";
|
|
1088
|
-
const footerClass = hasFooter ? "zr-page-shell__footer" : "zr-page-shell__footer zr-page-shell__region--empty";
|
|
1089
|
-
return html`
|
|
1090
|
-
<div class="zr-page-shell" part="shell">
|
|
1091
|
-
<header class=${headerClass} part="header">
|
|
1092
|
-
<slot name="header" @slotchange=${this.onSlotChange}></slot>
|
|
1093
|
-
</header>
|
|
1094
|
-
<main class="zr-page-shell__main" part="main">
|
|
1095
|
-
<slot></slot>
|
|
1096
|
-
</main>
|
|
1097
|
-
<footer class=${footerClass} part="footer">
|
|
1098
|
-
<slot name="footer" @slotchange=${this.onSlotChange}></slot>
|
|
1099
|
-
</footer>
|
|
1100
|
-
</div>
|
|
1101
|
-
`;
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Re-render when a named slot's assignment changes so a footer/header added
|
|
1105
|
-
* after first paint updates the empty-region class. The initial render reads
|
|
1106
|
-
* children synchronously (no empty-then-filled flash).
|
|
1107
|
-
*/
|
|
1108
|
-
onSlotChange = () => {
|
|
1109
|
-
this.requestUpdate();
|
|
1110
|
-
};
|
|
1111
|
-
lightDomSlotFilled(slot) {
|
|
1112
|
-
for (const child of this.children) if (child.getAttribute("slot") === slot) return true;
|
|
1113
|
-
return false;
|
|
1114
|
-
}
|
|
1115
|
-
};
|
|
1116
|
-
ZlPageShell = __decorate([customElement("zl-page-shell")], ZlPageShell);
|
|
1117
|
-
const zlPageShellManifest = {
|
|
1118
|
-
tag: "zl-page-shell",
|
|
1119
|
-
attrs: [],
|
|
1120
|
-
parts: [
|
|
1121
|
-
"shell",
|
|
1122
|
-
"header",
|
|
1123
|
-
"main",
|
|
1124
|
-
"footer"
|
|
1125
|
-
],
|
|
1126
|
-
slots: [
|
|
1127
|
-
"",
|
|
1128
|
-
"header",
|
|
1129
|
-
"footer"
|
|
1130
|
-
],
|
|
1131
|
-
events: []
|
|
1132
|
-
};
|
|
1133
|
-
//#endregion
|
|
1134
|
-
//#region src/internal/base64url.ts
|
|
1135
|
-
/**
|
|
1136
|
-
* Base64URL encoding/decoding for WebAuthn binary fields.
|
|
1137
|
-
*
|
|
1138
|
-
* WebAuthn's `ArrayBuffer` values (`rawId`, `clientDataJSON`,
|
|
1139
|
-
* `authenticatorData`, `signature`, `attestationObject`, `userHandle`)
|
|
1140
|
-
* must be base64url-encoded before sending as JSON. The WebAuthn JSON
|
|
1141
|
-
* serialization spec (https://www.w3.org/TR/webauthn-3/) requires
|
|
1142
|
-
* Base64URL (RFC 4648 §5) — no padding, URL-safe alphabet.
|
|
1143
|
-
*/
|
|
1144
|
-
/**
|
|
1145
|
-
* Encode an `ArrayBuffer` to a Base64URL string (no padding).
|
|
1146
|
-
*/
|
|
1147
|
-
function bufferToBase64Url(buffer) {
|
|
1148
|
-
const bytes = new Uint8Array(buffer);
|
|
1149
|
-
let binary = "";
|
|
1150
|
-
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
1151
|
-
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
1152
|
-
}
|
|
1153
|
-
/**
|
|
1154
|
-
* Decode a Base64URL string to an `ArrayBuffer`.
|
|
1155
|
-
*/
|
|
1156
|
-
function base64UrlToBuffer(base64url) {
|
|
1157
|
-
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
|
|
1158
|
-
const padded = base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=");
|
|
1159
|
-
const binary = atob(padded);
|
|
1160
|
-
const bytes = new Uint8Array(binary.length);
|
|
1161
|
-
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
1162
|
-
return bytes.buffer;
|
|
1163
|
-
}
|
|
1164
|
-
//#endregion
|
|
1165
|
-
//#region src/atoms/zl-passkey.ts
|
|
1166
|
-
let ZlPasskey = class ZlPasskey extends LitElement {
|
|
1167
|
-
#_ceremony_accessor_storage = "authenticate";
|
|
1168
|
-
get ceremony() {
|
|
1169
|
-
return this.#_ceremony_accessor_storage;
|
|
1170
|
-
}
|
|
1171
|
-
set ceremony(value) {
|
|
1172
|
-
this.#_ceremony_accessor_storage = value;
|
|
1173
|
-
}
|
|
1174
|
-
#_challengeId_accessor_storage = "";
|
|
1175
|
-
get challengeId() {
|
|
1176
|
-
return this.#_challengeId_accessor_storage;
|
|
1177
|
-
}
|
|
1178
|
-
set challengeId(value) {
|
|
1179
|
-
this.#_challengeId_accessor_storage = value;
|
|
1180
|
-
}
|
|
1181
|
-
#_options_accessor_storage = null;
|
|
1182
|
-
get options() {
|
|
1183
|
-
return this.#_options_accessor_storage;
|
|
1184
|
-
}
|
|
1185
|
-
set options(value) {
|
|
1186
|
-
this.#_options_accessor_storage = value;
|
|
1187
|
-
}
|
|
1188
|
-
#_method_accessor_storage = "passkey";
|
|
1189
|
-
get method() {
|
|
1190
|
-
return this.#_method_accessor_storage;
|
|
1191
|
-
}
|
|
1192
|
-
set method(value) {
|
|
1193
|
-
this.#_method_accessor_storage = value;
|
|
1194
|
-
}
|
|
1195
|
-
#_manual_accessor_storage = false;
|
|
1196
|
-
get manual() {
|
|
1197
|
-
return this.#_manual_accessor_storage;
|
|
1198
|
-
}
|
|
1199
|
-
set manual(value) {
|
|
1200
|
-
this.#_manual_accessor_storage = value;
|
|
1201
|
-
}
|
|
1202
|
-
abortController = null;
|
|
1203
|
-
connectedCallback() {
|
|
1204
|
-
super.connectedCallback();
|
|
1205
|
-
if (!this.manual && this.options) this.startCeremony();
|
|
1206
|
-
}
|
|
1207
|
-
disconnectedCallback() {
|
|
1208
|
-
this.abort();
|
|
1209
|
-
super.disconnectedCallback();
|
|
1210
|
-
}
|
|
1211
|
-
/**
|
|
1212
|
-
* Abort any in-flight WebAuthn ceremony. Called automatically when the
|
|
1213
|
-
* component disconnects (step change, page navigation).
|
|
1214
|
-
*/
|
|
1215
|
-
abort() {
|
|
1216
|
-
this.abortController?.abort();
|
|
1217
|
-
this.abortController = null;
|
|
1218
|
-
}
|
|
1219
|
-
/**
|
|
1220
|
-
* Trigger the WebAuthn ceremony. Resolves when the ceremony completes
|
|
1221
|
-
* or rejects on error/abort.
|
|
1222
|
-
*/
|
|
1223
|
-
async startCeremony() {
|
|
1224
|
-
if (!this.options) {
|
|
1225
|
-
this.emitError("No WebAuthn options provided.", false);
|
|
1226
|
-
return;
|
|
1227
|
-
}
|
|
1228
|
-
if (!window.PublicKeyCredential) {
|
|
1229
|
-
this.emitError("WebAuthn is not supported in this browser.", false);
|
|
1230
|
-
return;
|
|
1231
|
-
}
|
|
1232
|
-
this.abort();
|
|
1233
|
-
this.abortController = new AbortController();
|
|
1234
|
-
try {
|
|
1235
|
-
const credential = this.ceremony === "register" ? await this.createCredential() : await this.getCredential();
|
|
1236
|
-
if (!credential) {
|
|
1237
|
-
this.emitError("No credential returned by the browser.", false);
|
|
1238
|
-
return;
|
|
1239
|
-
}
|
|
1240
|
-
const proof = this.serializeCredential(credential);
|
|
1241
|
-
this.emitResult(proof);
|
|
1242
|
-
} catch (error) {
|
|
1243
|
-
const aborted = error instanceof DOMException && (error.name === "AbortError" || error.name === "NotAllowedError");
|
|
1244
|
-
this.emitError(error instanceof Error ? error.message : "WebAuthn ceremony failed.", aborted);
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
/**
|
|
1248
|
-
* `navigator.credentials.get()` — authentication ceremony.
|
|
1249
|
-
*/
|
|
1250
|
-
async getCredential() {
|
|
1251
|
-
const opts = this.options;
|
|
1252
|
-
if (!opts) throw new Error("getCredential called without options");
|
|
1253
|
-
const publicKeyOptions = {
|
|
1254
|
-
challenge: base64UrlToBuffer(opts.challenge),
|
|
1255
|
-
rpId: opts.rpId,
|
|
1256
|
-
timeout: opts.timeout,
|
|
1257
|
-
userVerification: opts.userVerification,
|
|
1258
|
-
allowCredentials: this.decodeCredentialDescriptors(opts.allowCredentials)
|
|
1259
|
-
};
|
|
1260
|
-
return await navigator.credentials.get({
|
|
1261
|
-
publicKey: publicKeyOptions,
|
|
1262
|
-
signal: this.abortController?.signal
|
|
1263
|
-
});
|
|
1264
|
-
}
|
|
1265
|
-
/**
|
|
1266
|
-
* `navigator.credentials.create()` — registration ceremony.
|
|
1267
|
-
*/
|
|
1268
|
-
async createCredential() {
|
|
1269
|
-
const opts = this.options;
|
|
1270
|
-
if (!opts) throw new Error("createCredential called without options");
|
|
1271
|
-
const rp = opts.rp;
|
|
1272
|
-
const user = opts.user;
|
|
1273
|
-
const pubKeyCredParams = opts.pubKeyCredParams;
|
|
1274
|
-
const publicKeyOptions = {
|
|
1275
|
-
challenge: base64UrlToBuffer(opts.challenge),
|
|
1276
|
-
rp: {
|
|
1277
|
-
name: rp.name,
|
|
1278
|
-
...rp.id ? { id: rp.id } : {}
|
|
1279
|
-
},
|
|
1280
|
-
user: {
|
|
1281
|
-
id: base64UrlToBuffer(user.id),
|
|
1282
|
-
name: user.name,
|
|
1283
|
-
displayName: user.displayName
|
|
1284
|
-
},
|
|
1285
|
-
pubKeyCredParams: pubKeyCredParams.map((p) => ({
|
|
1286
|
-
type: p.type,
|
|
1287
|
-
alg: p.alg
|
|
1288
|
-
})),
|
|
1289
|
-
timeout: opts.timeout,
|
|
1290
|
-
attestation: opts.attestation ?? "none",
|
|
1291
|
-
authenticatorSelection: opts.authenticatorSelection,
|
|
1292
|
-
excludeCredentials: this.decodeCredentialDescriptors(opts.excludeCredentials)
|
|
1293
|
-
};
|
|
1294
|
-
return await navigator.credentials.create({
|
|
1295
|
-
publicKey: publicKeyOptions,
|
|
1296
|
-
signal: this.abortController?.signal
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1299
|
-
/**
|
|
1300
|
-
* Decode a list of credential descriptors from the server's base64url
|
|
1301
|
-
* format to the browser's ArrayBuffer format.
|
|
1302
|
-
*/
|
|
1303
|
-
decodeCredentialDescriptors(descriptors) {
|
|
1304
|
-
if (!descriptors) return [];
|
|
1305
|
-
return descriptors.map((d) => ({
|
|
1306
|
-
type: d.type,
|
|
1307
|
-
id: base64UrlToBuffer(d.id),
|
|
1308
|
-
transports: d.transports
|
|
1309
|
-
}));
|
|
1310
|
-
}
|
|
1311
|
-
/**
|
|
1312
|
-
* Serialize a `PublicKeyCredential` to the JSON shape defined in
|
|
1313
|
-
* `passkey-proof.yaml`. All `ArrayBuffer` fields are base64url-encoded.
|
|
1314
|
-
*/
|
|
1315
|
-
serializeCredential(credential) {
|
|
1316
|
-
const response = credential.response;
|
|
1317
|
-
const serialized = {
|
|
1318
|
-
id: credential.id,
|
|
1319
|
-
rawId: bufferToBase64Url(credential.rawId),
|
|
1320
|
-
type: "public-key",
|
|
1321
|
-
response: { clientDataJSON: bufferToBase64Url(response.clientDataJSON) }
|
|
1322
|
-
};
|
|
1323
|
-
if ("attestationObject" in response) {
|
|
1324
|
-
const attestation = response;
|
|
1325
|
-
serialized.response.attestationObject = bufferToBase64Url(attestation.attestationObject);
|
|
1326
|
-
}
|
|
1327
|
-
if ("authenticatorData" in response) {
|
|
1328
|
-
const assertion = response;
|
|
1329
|
-
serialized.response.authenticatorData = bufferToBase64Url(assertion.authenticatorData);
|
|
1330
|
-
serialized.response.signature = bufferToBase64Url(assertion.signature);
|
|
1331
|
-
if (assertion.userHandle) serialized.response.userHandle = bufferToBase64Url(assertion.userHandle);
|
|
1332
|
-
}
|
|
1333
|
-
if (credential.authenticatorAttachment) serialized.authenticatorAttachment = credential.authenticatorAttachment;
|
|
1334
|
-
return serialized;
|
|
1335
|
-
}
|
|
1336
|
-
emitResult(proof) {
|
|
1337
|
-
const detail = {
|
|
1338
|
-
challenge_id: this.challengeId,
|
|
1339
|
-
method: this.method,
|
|
1340
|
-
proof
|
|
1341
|
-
};
|
|
1342
|
-
this.dispatchEvent(new CustomEvent("zl-passkey-result", {
|
|
1343
|
-
bubbles: true,
|
|
1344
|
-
composed: true,
|
|
1345
|
-
detail
|
|
1346
|
-
}));
|
|
1347
|
-
}
|
|
1348
|
-
emitError(message, aborted) {
|
|
1349
|
-
const detail = {
|
|
1350
|
-
challenge_id: this.challengeId,
|
|
1351
|
-
error: message,
|
|
1352
|
-
aborted
|
|
1353
|
-
};
|
|
1354
|
-
this.dispatchEvent(new CustomEvent("zl-passkey-error", {
|
|
1355
|
-
bubbles: true,
|
|
1356
|
-
composed: true,
|
|
1357
|
-
detail
|
|
1358
|
-
}));
|
|
1359
|
-
}
|
|
1360
|
-
/** Invisible component — no shadow DOM rendering needed. */
|
|
1361
|
-
createRenderRoot() {
|
|
1362
|
-
return this;
|
|
1363
|
-
}
|
|
1364
|
-
};
|
|
1365
|
-
__decorate([property()], ZlPasskey.prototype, "ceremony", null);
|
|
1366
|
-
__decorate([property({ attribute: "challenge-id" })], ZlPasskey.prototype, "challengeId", null);
|
|
1367
|
-
__decorate([property({
|
|
1368
|
-
attribute: "options",
|
|
1369
|
-
converter: {
|
|
1370
|
-
fromAttribute(value) {
|
|
1371
|
-
if (!value) return null;
|
|
1372
|
-
try {
|
|
1373
|
-
return JSON.parse(value);
|
|
1374
|
-
} catch {
|
|
1375
|
-
return null;
|
|
1376
|
-
}
|
|
1377
|
-
},
|
|
1378
|
-
toAttribute(value) {
|
|
1379
|
-
return value ? JSON.stringify(value) : null;
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
})], ZlPasskey.prototype, "options", null);
|
|
1383
|
-
__decorate([property({ type: String })], ZlPasskey.prototype, "method", null);
|
|
1384
|
-
__decorate([property({ type: Boolean })], ZlPasskey.prototype, "manual", null);
|
|
1385
|
-
ZlPasskey = __decorate([customElement("zl-passkey")], ZlPasskey);
|
|
1386
|
-
const zlPasskeyManifest = {
|
|
1387
|
-
tag: "zl-passkey",
|
|
1388
|
-
consumes: {},
|
|
1389
|
-
attrs: [
|
|
1390
|
-
"ceremony",
|
|
1391
|
-
"method",
|
|
1392
|
-
"challenge-id",
|
|
1393
|
-
"options",
|
|
1394
|
-
"manual"
|
|
1395
|
-
],
|
|
1396
|
-
parts: [],
|
|
1397
|
-
slots: [],
|
|
1398
|
-
events: ["zl-passkey-result", "zl-passkey-error"]
|
|
1399
|
-
};
|
|
1400
|
-
//#endregion
|
|
1401
|
-
//#region ../shared-component-styles/src/lit/pill-host.css?inline
|
|
1402
|
-
var pill_host_default = ":host {\n display: inline-flex;\n}\n\n::slotted(.zr-pill__logotype) {\n flex-shrink: 0;\n width: 65px;\n height: 16px;\n margin-top: 2px;\n line-height: 0;\n display: block;\n}\n\n::slotted(.zr-pill__logotype-svg) {\n width: 100%;\n height: 100%;\n display: block;\n}\n";
|
|
1403
|
-
//#endregion
|
|
1404
|
-
//#region ../shared-component-styles/src/pill.css?inline
|
|
1405
|
-
var pill_default = ".zr-pill {\n box-sizing: border-box;\n justify-content: center;\n align-items: flex-start;\n gap: var(--zl-spacing-02, .5rem);\n height: 2.5rem;\n padding-inline: var(--zl-spacing-03, 1rem);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n letter-spacing: 0;\n text-transform: none;\n background: linear-gradient(182deg, #484a5799 28.65%, #0f0f1199 81.82%),\n var(--zl-color-surface-default-primary-gray, #252528);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n border: 1px solid var(--zl-color-border-default-gray-200, #484a57);\n white-space: nowrap;\n border-radius: 100px;\n padding-block: calc(.625rem - 1px);\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n text-decoration: none;\n display: inline-flex;\n}\n\n.zr-pill__logotype {\n flex-shrink: 0;\n width: 65px;\n height: 16px;\n margin-top: 2px;\n line-height: 0;\n display: block;\n}\n\n.zr-pill__logotype-svg {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n.zr-pill--pink {\n color: var(--zl-color-text-subtitle-pink);\n border-color: var(--zl-color-text-subtitle-pink);\n background: color-mix(in srgb, var(--zl-color-text-subtitle-pink) 10%, var(--zl-color-surface-default-primary-gray));\n}\n\n.zr-pill--purple {\n color: var(--zl-color-text-subtitle-purple);\n border-color: var(--zl-color-text-subtitle-purple);\n background: color-mix(in srgb, var(--zl-color-text-subtitle-purple) 10%, var(--zl-color-surface-default-primary-gray));\n}\n\n.zr-pill--orange {\n color: var(--zl-color-text-subtitle-orange);\n border-color: var(--zl-color-text-subtitle-orange);\n background: color-mix(in srgb, var(--zl-color-text-subtitle-orange) 10%, var(--zl-color-surface-default-primary-gray));\n}\n\n.zr-pill--success {\n color: var(--zl-color-text-success);\n border-color: var(--zl-color-text-success);\n background: color-mix(in srgb, var(--zl-color-text-success) 10%, var(--zl-color-surface-default-primary-gray));\n}\n\na.zr-pill:focus-visible {\n outline: var(--zl-focus-width, 2px) solid var(--zl-focus-color, #f4f4f6);\n outline-offset: var(--zl-focus-offset, 2px);\n}\n";
|
|
1406
|
-
//#endregion
|
|
1407
|
-
//#region src/atoms/zl-pill.ts
|
|
1408
|
-
let ZlPill = class ZlPill extends LitElement {
|
|
1409
|
-
static styles = [baseHostStyles, ...surfaceStyles(pill_host_default, pill_default)];
|
|
1410
|
-
#_tone_accessor_storage = "neutral";
|
|
1411
|
-
get tone() {
|
|
1412
|
-
return this.#_tone_accessor_storage;
|
|
1413
|
-
}
|
|
1414
|
-
set tone(value) {
|
|
1415
|
-
this.#_tone_accessor_storage = value;
|
|
1416
|
-
}
|
|
1417
|
-
#_href_accessor_storage = void 0;
|
|
1418
|
-
get href() {
|
|
1419
|
-
return this.#_href_accessor_storage;
|
|
1420
|
-
}
|
|
1421
|
-
set href(value) {
|
|
1422
|
-
this.#_href_accessor_storage = value;
|
|
1423
|
-
}
|
|
1424
|
-
#_ariaLabel_accessor_storage = null;
|
|
1425
|
-
get ariaLabel() {
|
|
1426
|
-
return this.#_ariaLabel_accessor_storage;
|
|
1427
|
-
}
|
|
1428
|
-
set ariaLabel(value) {
|
|
1429
|
-
this.#_ariaLabel_accessor_storage = value;
|
|
1430
|
-
}
|
|
1431
|
-
render() {
|
|
1432
|
-
const classes = classMap({
|
|
1433
|
-
"zr-pill": true,
|
|
1434
|
-
[`zr-pill--${this.tone}`]: this.tone !== "neutral"
|
|
1435
|
-
});
|
|
1436
|
-
if (this.href) return html`<a
|
|
1437
|
-
class=${classes}
|
|
1438
|
-
part="pill"
|
|
1439
|
-
href=${this.href}
|
|
1440
|
-
rel="noopener"
|
|
1441
|
-
aria-label=${this.ariaLabel ?? nothing}
|
|
1442
|
-
><slot></slot></a>`;
|
|
1443
|
-
return html`<span class=${classes} part="pill"><slot></slot></span>`;
|
|
1444
|
-
}
|
|
1445
|
-
};
|
|
1446
|
-
__decorate([property()], ZlPill.prototype, "tone", null);
|
|
1447
|
-
__decorate([property()], ZlPill.prototype, "href", null);
|
|
1448
|
-
__decorate([property({ attribute: "aria-label" })], ZlPill.prototype, "ariaLabel", null);
|
|
1449
|
-
ZlPill = __decorate([customElement("zl-pill")], ZlPill);
|
|
1450
|
-
const zlPillManifest = {
|
|
1451
|
-
tag: "zl-pill",
|
|
1452
|
-
attrs: [
|
|
1453
|
-
"tone",
|
|
1454
|
-
"href",
|
|
1455
|
-
"aria-label"
|
|
1456
|
-
],
|
|
1457
|
-
parts: ["pill"],
|
|
1458
|
-
slots: [""],
|
|
1459
|
-
events: []
|
|
1460
|
-
};
|
|
1461
|
-
//#endregion
|
|
1462
|
-
export { __decorate as _, ZlPageShell as a, t as b, zlFieldManifest as c, ZlButton as d, zlButtonManifest as f, zlIconManifest as g, ZlIcon as h, zlPasskeyManifest as i, ZlCard as l, zlAlertManifest as m, zlPillManifest as n, zlPageShellManifest as o, ZlAlert as p, ZlPasskey as r, ZlField as s, ZlPill as t, zlCardManifest as u, focusVisibleStyles as v, emit as x, baseHostStyles as y };
|
|
1463
|
-
|
|
1464
|
-
//# sourceMappingURL=atoms-B25wiDqb.mjs.map
|