@zitadel/components 0.1.0-alpha.16 → 0.1.0-alpha.18
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 +89 -20
- package/dist/atoms/index.d.mts +1 -1
- package/dist/atoms/index.mjs +1 -1
- package/dist/{atoms-C-zXJjaz.mjs → atoms-5-wYIl88.mjs} +295 -190
- package/dist/atoms-5-wYIl88.mjs.map +1 -0
- package/dist/default-Bnjy2dJB.mjs +6 -0
- package/dist/default-Bnjy2dJB.mjs.map +1 -0
- package/dist/{index-BniwXaIC.d.mts → index-BRGZPZ2y.d.mts} +111 -1
- package/dist/index-BRGZPZ2y.d.mts.map +1 -0
- package/dist/{index-D1eMaWbY.d.mts → index-CsJiPZtJ.d.mts} +438 -210
- package/dist/index-CsJiPZtJ.d.mts.map +1 -0
- package/dist/{index-BwQLFs9R.d.mts → index-DIGjtG4z.d.mts} +1642 -1027
- package/dist/index-DIGjtG4z.d.mts.map +1 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- package/dist/jsx.d.ts +63 -0
- package/dist/manifests.mjs +1 -1
- package/dist/orchestrator/index.d.mts +3 -3
- package/dist/orchestrator/index.mjs +3 -3
- package/dist/{orchestrator-BN2nT9FZ.mjs → orchestrator-CctLkpmB.mjs} +1229 -767
- package/dist/orchestrator-CctLkpmB.mjs.map +1 -0
- package/dist/standalone.mjs +2552 -1291
- package/dist/tokens/index.d.mts +1 -1
- package/dist/tokens/index.mjs +1 -1
- package/dist/tokens-BV-PPbQd.mjs +356 -0
- package/dist/tokens-BV-PPbQd.mjs.map +1 -0
- package/package.json +14 -10
- package/dist/atoms-C-zXJjaz.mjs.map +0 -1
- package/dist/default-BoC3JEsO.mjs +0 -6
- package/dist/default-BoC3JEsO.mjs.map +0 -1
- package/dist/index-BniwXaIC.d.mts.map +0 -1
- package/dist/index-BwQLFs9R.d.mts.map +0 -1
- package/dist/index-D1eMaWbY.d.mts.map +0 -1
- package/dist/orchestrator-BN2nT9FZ.mjs.map +0 -1
- package/dist/tokens-CbH2s1jV.mjs +0 -246
- package/dist/tokens-CbH2s1jV.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cssVars } from "./tokens-
|
|
1
|
+
import { t as cssVars } from "./tokens-BV-PPbQd.mjs";
|
|
2
2
|
import { LitElement, css, html, nothing, unsafeCSS } from "lit";
|
|
3
3
|
import { customElement, property, query, state } from "lit/decorators.js";
|
|
4
4
|
import { classMap } from "lit/directives/class-map.js";
|
|
@@ -10,7 +10,7 @@ import { live } from "lit/directives/live.js";
|
|
|
10
10
|
var alert_host_default = ":host {\n display: block;\n}\n";
|
|
11
11
|
//#endregion
|
|
12
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-
|
|
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-surface-hover-subtle, #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
14
|
//#endregion
|
|
15
15
|
//#region src/internal/emit.ts
|
|
16
16
|
/**
|
|
@@ -320,7 +320,7 @@ const zlAlertManifest = {
|
|
|
320
320
|
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";
|
|
321
321
|
//#endregion
|
|
322
322
|
//#region ../shared-component-styles/src/button.css?inline
|
|
323
|
-
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-
|
|
323
|
+
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-surface-hover-strong, #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-surface-hover-subtle, #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-surface-hover-subtle, #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";
|
|
324
324
|
//#endregion
|
|
325
325
|
//#region src/atoms/zl-button.ts
|
|
326
326
|
let ZlButton = class ZlButton extends LitElement {
|
|
@@ -481,7 +481,9 @@ let ZlButton = class ZlButton extends LitElement {
|
|
|
481
481
|
if (type === "submit" && form) {
|
|
482
482
|
event.preventDefault();
|
|
483
483
|
form.requestSubmit();
|
|
484
|
-
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
if (type === "reset" && form) {
|
|
485
487
|
event.preventDefault();
|
|
486
488
|
form.reset();
|
|
487
489
|
}
|
|
@@ -544,7 +546,7 @@ const zlButtonManifest = {
|
|
|
544
546
|
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";
|
|
545
547
|
//#endregion
|
|
546
548
|
//#region ../shared-component-styles/src/card.css?inline
|
|
547
|
-
var card_default = ".zr-card {\n width: 100%;\n max-width: var(--zl-container-auth-card, 24rem);\n border: 1px solid var(--zl-color-
|
|
549
|
+
var card_default = ".zr-card {\n width: 100%;\n max-width: var(--zl-container-auth-card, 24rem);\n border: 1px solid var(--zl-color-border-default-black, #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 line-height: 1.5;\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";
|
|
548
550
|
//#endregion
|
|
549
551
|
//#region src/atoms/zl-card.ts
|
|
550
552
|
let ZlCard = class ZlCard extends LitElement {
|
|
@@ -617,7 +619,7 @@ const zlCardManifest = {
|
|
|
617
619
|
var checkbox_host_default = ":host {\n display: inline-flex;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n";
|
|
618
620
|
//#endregion
|
|
619
621
|
//#region ../shared-component-styles/src/checkbox.css?inline
|
|
620
|
-
var checkbox_default = ".zr-checkbox {\n align-items: center;\n gap: var(--zl-spacing-02, .5rem);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n line-height: 1.5;\n display: inline-flex;\n}\n\n.zr-checkbox, .zr-checkbox *, .zr-checkbox :before, .zr-checkbox :after {\n box-sizing: border-box;\n}\n\n.zr-checkbox--disabled {\n cursor: not-allowed;\n}\n\n.zr-checkbox__input {\n opacity: 0;\n pointer-events: none;\n border: 0;\n width: 1px;\n height: 1px;\n margin: 0;\n padding: 0;\n position: absolute;\n}\n\n.zr-checkbox__box {\n flex-shrink: 0;\n justify-content: center;\n align-items: center;\n width: 1rem;\n height: 1rem;\n display: inline-flex;\n position: relative;\n}\n\n.zr-checkbox__box:before {\n content: \"\";\n background: var(--zl-color-surface-default-primary-gray, #252528);\n opacity: 0;\n pointer-events: none;\n width: 2rem;\n height: 2rem;\n transition: opacity var(--zl-duration-fast, .12s)\n var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1));\n border-radius: 50%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.zr-checkbox__face {\n z-index: 1;\n border: 1px solid var(--zl-color-icon-default-white, #f4f4f6);\n width: 1rem;\n height: 1rem;\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 background: none;\n border-radius: 2px;\n justify-content: center;\n align-items: center;\n display: inline-flex;\n position: relative;\n}\n\n.zr-checkbox__check {\n color: var(--zl-color-surface-default-black, #0f0f11);\n opacity: 0;\n display: inline-flex;\n}\n\n.zr-checkbox__label {\n color: var(--zl-color-text-primary-white, #f4f4f6);\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n}\n\n.zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-icon-default-white, #f4f4f6);\n background: var(--zl-color-icon-default-white, #f4f4f6);\n}\n\n.zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__check, .zr-checkbox:not(.zr-checkbox--disabled):hover .zr-checkbox__box:before, .zr-checkbox:not(.zr-checkbox--disabled):active .zr-checkbox__box:before, .zr-checkbox__input:focus-visible + .zr-checkbox__box:before, .zr-checkbox[data-state=\"hovered\"] .zr-checkbox__box:before, .zr-checkbox[data-state=\"focused\"] .zr-checkbox__box:before, .zr-checkbox[data-state=\"pressed\"] .zr-checkbox__box:before {\n opacity: 1;\n}\n\n.zr-checkbox:not(.zr-checkbox--disabled):hover .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"hovered\"] .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-icon-default-gray, #bfbfcf);\n}\n\n.zr-checkbox:not(.zr-checkbox--disabled):hover .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"hovered\"] .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-icon-default-gray, #bfbfcf);\n background: var(--zl-color-icon-default-gray, #bfbfcf);\n}\n\n.zr-checkbox__input:focus-visible:not(:checked) + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox:not(.zr-checkbox--disabled):active .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"focused\"] .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"pressed\"] .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-surface-default-white, #f4f4f6);\n}\n\n.zr-checkbox__input:focus-visible:checked + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox:not(.zr-checkbox--disabled):active .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"focused\"] .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"pressed\"] .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-surface-default-white, #f4f4f6);\n background: var(--zl-color-surface-default-white, #f4f4f6);\n}\n\n.zr-checkbox__input:focus-visible + .zr-checkbox__box .zr-checkbox__face {\n outline: none;\n}\n\n.zr-checkbox--disabled .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-checkbox--disabled .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-text-disabled, #686883);\n background: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-checkbox--disabled .zr-checkbox__label {\n color: var(--zl-color-text-disabled, #686883);\n}\n";
|
|
622
|
+
var checkbox_default = ".zr-checkbox-field {\n align-items: flex-start;\n gap: var(--zl-spacing-01, .25rem);\n flex-direction: column;\n display: inline-flex;\n}\n\n.zr-checkbox {\n align-items: center;\n gap: var(--zl-spacing-02, .5rem);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n line-height: 1.5;\n display: inline-flex;\n}\n\n.zr-checkbox-field, .zr-checkbox, .zr-checkbox-field *, .zr-checkbox *, .zr-checkbox :before, .zr-checkbox :after {\n box-sizing: border-box;\n}\n\n.zr-checkbox--disabled {\n cursor: not-allowed;\n}\n\n.zr-checkbox__input {\n opacity: 0;\n pointer-events: none;\n border: 0;\n width: 1px;\n height: 1px;\n margin: 0;\n padding: 0;\n position: absolute;\n}\n\n.zr-checkbox__box {\n flex-shrink: 0;\n justify-content: center;\n align-items: center;\n width: 1rem;\n height: 1rem;\n display: inline-flex;\n position: relative;\n}\n\n.zr-checkbox__box:before {\n content: \"\";\n background: var(--zl-color-surface-default-primary-gray, #252528);\n opacity: 0;\n pointer-events: none;\n width: 2rem;\n height: 2rem;\n transition: opacity var(--zl-duration-fast, .12s)\n var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1));\n border-radius: 50%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.zr-checkbox__face {\n z-index: 1;\n border: 1px solid var(--zl-color-icon-default-white, #f4f4f6);\n width: 1rem;\n height: 1rem;\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 background: none;\n border-radius: 2px;\n justify-content: center;\n align-items: center;\n display: inline-flex;\n position: relative;\n}\n\n.zr-checkbox__check {\n color: var(--zl-color-surface-default-black, #0f0f11);\n opacity: 0;\n display: inline-flex;\n}\n\n.zr-checkbox__label {\n color: var(--zl-color-text-primary-white, #f4f4f6);\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n}\n\n.zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-icon-default-white, #f4f4f6);\n background: var(--zl-color-icon-default-white, #f4f4f6);\n}\n\n.zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__check, .zr-checkbox:not(.zr-checkbox--disabled):hover .zr-checkbox__box:before, .zr-checkbox:not(.zr-checkbox--disabled):active .zr-checkbox__box:before, .zr-checkbox__input:focus-visible + .zr-checkbox__box:before, .zr-checkbox[data-state=\"hovered\"] .zr-checkbox__box:before, .zr-checkbox[data-state=\"focused\"] .zr-checkbox__box:before, .zr-checkbox[data-state=\"pressed\"] .zr-checkbox__box:before {\n opacity: 1;\n}\n\n.zr-checkbox:not(.zr-checkbox--disabled):hover .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"hovered\"] .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-icon-default-gray, #bfbfcf);\n}\n\n.zr-checkbox:not(.zr-checkbox--disabled):hover .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"hovered\"] .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-icon-default-gray, #bfbfcf);\n background: var(--zl-color-icon-default-gray, #bfbfcf);\n}\n\n.zr-checkbox__input:focus-visible:not(:checked) + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox:not(.zr-checkbox--disabled):active .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"focused\"] .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"pressed\"] .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-surface-default-white, #f4f4f6);\n}\n\n.zr-checkbox__input:focus-visible:checked + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox:not(.zr-checkbox--disabled):active .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"focused\"] .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face, .zr-checkbox[data-state=\"pressed\"] .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-surface-default-white, #f4f4f6);\n background: var(--zl-color-surface-default-white, #f4f4f6);\n}\n\n.zr-checkbox__input:focus-visible + .zr-checkbox__box .zr-checkbox__face {\n outline: none;\n}\n\n.zr-checkbox--disabled .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-checkbox--disabled .zr-checkbox__input:checked + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-text-disabled, #686883);\n background: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-checkbox--disabled .zr-checkbox__label {\n color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-checkbox--invalid .zr-checkbox__input:not(:checked) + .zr-checkbox__box .zr-checkbox__face {\n border-color: var(--zl-color-text-error, #ea4f70);\n}\n\n.zr-checkbox__error {\n color: var(--zl-color-text-error, #ea4f70);\n font-size: .75rem;\n line-height: 1rem;\n}\n";
|
|
621
623
|
//#endregion
|
|
622
624
|
//#region src/internal/unique-id.ts
|
|
623
625
|
/**
|
|
@@ -692,6 +694,20 @@ let ZlCheckbox = class ZlCheckbox extends LitElement {
|
|
|
692
694
|
set required(value) {
|
|
693
695
|
this.#_required_accessor_storage = value;
|
|
694
696
|
}
|
|
697
|
+
#_error_accessor_storage = "";
|
|
698
|
+
get error() {
|
|
699
|
+
return this.#_error_accessor_storage;
|
|
700
|
+
}
|
|
701
|
+
set error(value) {
|
|
702
|
+
this.#_error_accessor_storage = value;
|
|
703
|
+
}
|
|
704
|
+
#_invalid_accessor_storage = false;
|
|
705
|
+
get invalid() {
|
|
706
|
+
return this.#_invalid_accessor_storage;
|
|
707
|
+
}
|
|
708
|
+
set invalid(value) {
|
|
709
|
+
this.#_invalid_accessor_storage = value;
|
|
710
|
+
}
|
|
695
711
|
#_ariaLabelText_accessor_storage = void 0;
|
|
696
712
|
get ariaLabelText() {
|
|
697
713
|
return this.#_ariaLabelText_accessor_storage;
|
|
@@ -744,35 +760,64 @@ let ZlCheckbox = class ZlCheckbox extends LitElement {
|
|
|
744
760
|
focus(options) {
|
|
745
761
|
this.inputEl?.focus(options);
|
|
746
762
|
}
|
|
763
|
+
/**
|
|
764
|
+
* The string this control contributes to form submission — the uniform
|
|
765
|
+
* read/write contract `<zitadel-login>` uses to capture and restore field
|
|
766
|
+
* values without knowing each atom's internal shape. Like a native checkbox
|
|
767
|
+
* this is the value token only when checked, empty otherwise; assigning it
|
|
768
|
+
* back restores the checked state.
|
|
769
|
+
*/
|
|
770
|
+
get formValue() {
|
|
771
|
+
return this.checked ? this.value : "";
|
|
772
|
+
}
|
|
773
|
+
set formValue(value) {
|
|
774
|
+
this.checked = value !== "";
|
|
775
|
+
}
|
|
747
776
|
render() {
|
|
777
|
+
const errorId = `${this.inputId}-error`;
|
|
778
|
+
const showError = Boolean(this.error);
|
|
748
779
|
const rootClass = classMap({
|
|
749
780
|
"zr-checkbox": true,
|
|
781
|
+
"zr-checkbox--invalid": this.invalid || showError,
|
|
750
782
|
"zr-checkbox--disabled": this.disabled
|
|
751
783
|
});
|
|
752
784
|
const labelText = this.label;
|
|
753
785
|
return html`
|
|
754
|
-
<
|
|
755
|
-
<
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
786
|
+
<div class="zr-checkbox-field" part="field">
|
|
787
|
+
<label class=${rootClass} part="root" data-state=${this.forcedState ?? nothing}>
|
|
788
|
+
<input
|
|
789
|
+
class="zr-checkbox__input"
|
|
790
|
+
part="input"
|
|
791
|
+
id=${this.inputId}
|
|
792
|
+
type="checkbox"
|
|
793
|
+
name=${this.name || nothing}
|
|
794
|
+
.checked=${live(this.checked)}
|
|
795
|
+
value=${this.value}
|
|
796
|
+
?required=${this.required}
|
|
797
|
+
?disabled=${this.disabled}
|
|
798
|
+
aria-label=${ifDefined(labelText ? void 0 : this.ariaLabelText)}
|
|
799
|
+
aria-invalid=${this.invalid || showError ? "true" : "false"}
|
|
800
|
+
aria-describedby=${showError ? errorId : nothing}
|
|
801
|
+
data-testid=${ifDefined(this.nativeInputTestId())}
|
|
802
|
+
@change=${this.handleChange}
|
|
803
|
+
/>
|
|
804
|
+
<span class="zr-checkbox__box" part="box">
|
|
805
|
+
<span class="zr-checkbox__face" part="face">
|
|
806
|
+
<zl-icon class="zr-checkbox__check" part="check" name="check" size="16" decorative></zl-icon>
|
|
807
|
+
</span>
|
|
772
808
|
</span>
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
809
|
+
${labelText ? html`<span class="zr-checkbox__label" part="label">${labelText}</span>` : html`<slot></slot>`}
|
|
810
|
+
</label>
|
|
811
|
+
<div
|
|
812
|
+
class="zr-checkbox__error"
|
|
813
|
+
part="error"
|
|
814
|
+
id=${errorId}
|
|
815
|
+
role="alert"
|
|
816
|
+
?hidden=${!showError}
|
|
817
|
+
>
|
|
818
|
+
${this.error}
|
|
819
|
+
</div>
|
|
820
|
+
</div>
|
|
776
821
|
`;
|
|
777
822
|
}
|
|
778
823
|
handleChange = (event) => {
|
|
@@ -811,6 +856,11 @@ __decorate([property({
|
|
|
811
856
|
reflect: true
|
|
812
857
|
})], ZlCheckbox.prototype, "disabled", null);
|
|
813
858
|
__decorate([property({ type: Boolean })], ZlCheckbox.prototype, "required", null);
|
|
859
|
+
__decorate([property()], ZlCheckbox.prototype, "error", null);
|
|
860
|
+
__decorate([property({
|
|
861
|
+
type: Boolean,
|
|
862
|
+
reflect: true
|
|
863
|
+
})], ZlCheckbox.prototype, "invalid", null);
|
|
814
864
|
__decorate([property({ attribute: "aria-label" })], ZlCheckbox.prototype, "ariaLabelText", null);
|
|
815
865
|
__decorate([property({ attribute: "data-testid" })], ZlCheckbox.prototype, "testId", null);
|
|
816
866
|
__decorate([property({ attribute: "data-state" })], ZlCheckbox.prototype, "forcedState", null);
|
|
@@ -825,26 +875,60 @@ const zlCheckboxManifest = {
|
|
|
825
875
|
"checked",
|
|
826
876
|
"disabled",
|
|
827
877
|
"required",
|
|
878
|
+
"error",
|
|
879
|
+
"invalid",
|
|
828
880
|
"aria-label",
|
|
829
881
|
"data-testid"
|
|
830
882
|
],
|
|
831
883
|
parts: [
|
|
884
|
+
"field",
|
|
832
885
|
"root",
|
|
833
886
|
"input",
|
|
834
887
|
"box",
|
|
835
888
|
"face",
|
|
836
889
|
"check",
|
|
837
|
-
"label"
|
|
890
|
+
"label",
|
|
891
|
+
"error"
|
|
838
892
|
],
|
|
839
893
|
slots: [""],
|
|
840
894
|
events: ["zl-change"]
|
|
841
895
|
};
|
|
842
896
|
//#endregion
|
|
843
897
|
//#region ../shared-component-styles/src/lit/text-field-host.css?inline
|
|
844
|
-
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-
|
|
898
|
+
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-border-hover, #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";
|
|
845
899
|
//#endregion
|
|
846
900
|
//#region ../shared-component-styles/src/text-field.css?inline
|
|
847
|
-
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-
|
|
901
|
+
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-border-hover, #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";
|
|
902
|
+
//#endregion
|
|
903
|
+
//#region src/internal/hook-name.ts
|
|
904
|
+
/**
|
|
905
|
+
* Reserved auth-method credential prefix of flow field names. Mirrors
|
|
906
|
+
* `AUTH_METHOD_PREFIX` in `@zitadel/config` (`src/validate.ts`), which
|
|
907
|
+
* owns the wire dialect; components has no dependency on that package,
|
|
908
|
+
* so the literal is repeated here.
|
|
909
|
+
*/
|
|
910
|
+
const AUTH_METHOD_PREFIX = "x-auth-methods#";
|
|
911
|
+
/**
|
|
912
|
+
* Normalises a flow field name into its automation-hook token.
|
|
913
|
+
*
|
|
914
|
+
* Auth-method credential fields arrive from the flow engine as
|
|
915
|
+
* `x-auth-methods#<method>` (e.g. `x-auth-methods#password`), but the
|
|
916
|
+
* documented `data-testid` hooks are method-named
|
|
917
|
+
* (`zitadel-field-password`, `zitadel-input-password` — see
|
|
918
|
+
* packages/components/README.md and apps/cli/SKILLS.md). This helper
|
|
919
|
+
* feeds both hook construction sites: the bundled template's `testid`
|
|
920
|
+
* Liquid filter and `<zl-field>`'s native-input testid.
|
|
921
|
+
*
|
|
922
|
+
* Only the reserved credential prefix is stripped — user-schema
|
|
923
|
+
* property names are tenant-authored arbitrary strings, so a `#`
|
|
924
|
+
* anywhere else is part of the name and stays in the hook. The
|
|
925
|
+
* after-prefix token is used verbatim (no case or spacing changes),
|
|
926
|
+
* and the field's `name` attribute always keeps the raw wire/form key.
|
|
927
|
+
*/
|
|
928
|
+
function hookName(field) {
|
|
929
|
+
if (field.startsWith(AUTH_METHOD_PREFIX) && field.length > 15) return field.slice(15);
|
|
930
|
+
return field;
|
|
931
|
+
}
|
|
848
932
|
//#endregion
|
|
849
933
|
//#region src/atoms/zl-field.ts
|
|
850
934
|
let ZlField = class ZlField extends LitElement {
|
|
@@ -1014,6 +1098,23 @@ let ZlField = class ZlField extends LitElement {
|
|
|
1014
1098
|
focus(options) {
|
|
1015
1099
|
this.inputEl?.focus(options);
|
|
1016
1100
|
}
|
|
1101
|
+
/**
|
|
1102
|
+
* The string this control contributes to form submission — the uniform
|
|
1103
|
+
* read/write contract `<zitadel-login>` uses to capture and restore field
|
|
1104
|
+
* values without knowing each atom's internal shape. The getter reads the
|
|
1105
|
+
* live `<input>` so browser/password-manager autofill that writes the native
|
|
1106
|
+
* control directly (bypassing the `value` property and its `input` event) is
|
|
1107
|
+
* still captured.
|
|
1108
|
+
*/
|
|
1109
|
+
get formValue() {
|
|
1110
|
+
const native = this.inputEl ?? this.shadowRoot?.querySelector("input");
|
|
1111
|
+
return native ? native.value : this.value;
|
|
1112
|
+
}
|
|
1113
|
+
set formValue(value) {
|
|
1114
|
+
this.value = value;
|
|
1115
|
+
const native = this.inputEl ?? this.shadowRoot?.querySelector("input");
|
|
1116
|
+
if (native && native.value !== value) native.value = value;
|
|
1117
|
+
}
|
|
1017
1118
|
render() {
|
|
1018
1119
|
const labelId = `${this.inputId}-label`;
|
|
1019
1120
|
const errorId = `${this.inputId}-error`;
|
|
@@ -1185,7 +1286,7 @@ let ZlField = class ZlField extends LitElement {
|
|
|
1185
1286
|
}
|
|
1186
1287
|
};
|
|
1187
1288
|
nativeInputTestId() {
|
|
1188
|
-
if (this.name) return `zitadel-input-${this.name}`;
|
|
1289
|
+
if (this.name) return `zitadel-input-${hookName(this.name)}`;
|
|
1189
1290
|
if (this.testId) return `${this.testId}-input`;
|
|
1190
1291
|
}
|
|
1191
1292
|
dispatchNativeInput(source) {
|
|
@@ -1283,10 +1384,10 @@ const zlFieldManifest = {
|
|
|
1283
1384
|
};
|
|
1284
1385
|
//#endregion
|
|
1285
1386
|
//#region ../shared-component-styles/src/lit/page-shell-host.css?inline
|
|
1286
|
-
var page_shell_host_default = ":host {\n background: var(--zl-color-surface-default-black, #0f0f11);\n
|
|
1387
|
+
var page_shell_host_default = ":host {\n min-height: var(--zl-page-min-height, 100vh);\n background: var(--zl-color-surface-default-black, #0f0f11);\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:host([data-widget]) {\n background: none;\n min-height: auto;\n}\n\n:host([data-widget]) .zr-page-shell {\n min-height: var(--zl-page-min-height, auto);\n background: none;\n padding: 0;\n}\n\n.zr-page-shell ::slotted([slot=\"header\"]), .zr-page-shell ::slotted([slot=\"footer\"]) {\n margin: 0;\n}\n";
|
|
1287
1388
|
//#endregion
|
|
1288
1389
|
//#region ../shared-component-styles/src/page-shell.css?inline
|
|
1289
|
-
var page_shell_default = ".zr-page-shell {\n background: var(--zl-color-surface-default-black, #0f0f11);\n
|
|
1390
|
+
var page_shell_default = ".zr-page-shell {\n min-height: var(--zl-page-min-height, 100vh);\n background: var(--zl-color-surface-default-black, #0f0f11);\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 line-height: 1.5;\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\n.zr-page-shell[data-widget] {\n min-height: var(--zl-page-min-height, auto);\n background: none;\n padding: 0;\n}\n";
|
|
1290
1391
|
//#endregion
|
|
1291
1392
|
//#region src/atoms/zl-page-shell.ts
|
|
1292
1393
|
let ZlPageShell = class ZlPageShell extends LitElement {
|
|
@@ -1708,7 +1809,7 @@ const zlPasskeyManifest = {
|
|
|
1708
1809
|
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";
|
|
1709
1810
|
//#endregion
|
|
1710
1811
|
//#region ../shared-component-styles/src/pill.css?inline
|
|
1711
|
-
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, #
|
|
1812
|
+
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,\n color-mix(in srgb, var(--zl-gradient-neutral-start, #484a57) 60%, transparent) 28.65%,\n color-mix(in srgb, var(--zl-gradient-base-end, #0f0f11) 60%, transparent) 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";
|
|
1712
1813
|
//#endregion
|
|
1713
1814
|
//#region src/atoms/zl-pill.ts
|
|
1714
1815
|
let ZlPill = class ZlPill extends LitElement {
|
|
@@ -1769,7 +1870,7 @@ const zlPillManifest = {
|
|
|
1769
1870
|
var select_host_default = ":host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n";
|
|
1770
1871
|
//#endregion
|
|
1771
1872
|
//#region ../shared-component-styles/src/select.css?inline
|
|
1772
|
-
var select_default = ".zr-select {\n align-items: stretch;\n gap: var(--zl-spacing-02, .5rem);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n flex-direction: column;\n line-height: 1.5;\n display: flex;\n}\n\n.zr-select, .zr-select *, .zr-select :before, .zr-select :after {\n box-sizing: border-box;\n}\n\n.zr-select__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-select__required {\n color: var(--zl-color-text-error, #ea4f70);\n}\n\n.zr-select--disabled .zr-select__label {\n color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-select__field {\n position: relative;\n}\n\n.zr-select__trigger {\n align-items: center;\n gap: var(--zl-spacing-02, .5rem);\n width: 100%;\n height: 2.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 color: var(--zl-color-text-primary-white, #f4f4f6);\n text-align: start;\n cursor: pointer;\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 background: none;\n margin: 0;\n font-family: inherit;\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n display: flex;\n}\n\n.zr-select__value {\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n color: var(--zl-color-text-primary-white, #f4f4f6);\n flex: auto;\n overflow: hidden;\n}\n\n.zr-select__value--placeholder {\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n}\n\n.zr-select__icon {\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n transition: transform var(--zl-duration-fast, .12s)\n var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1));\n flex-shrink: 0;\n display: inline-flex;\n}\n\n.zr-select--open .zr-select__icon {\n transform: rotate(180deg);\n}\n\n.zr-select:not(.zr-select--disabled):not(.zr-select--open) .zr-select__trigger:hover {\n border-color: var(--zl-color-
|
|
1873
|
+
var select_default = ".zr-select {\n align-items: stretch;\n gap: var(--zl-spacing-02, .5rem);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n flex-direction: column;\n line-height: 1.5;\n display: flex;\n}\n\n.zr-select, .zr-select *, .zr-select :before, .zr-select :after {\n box-sizing: border-box;\n}\n\n.zr-select__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-select__required {\n color: var(--zl-color-text-error, #ea4f70);\n}\n\n.zr-select--disabled .zr-select__label {\n color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-select__field {\n position: relative;\n}\n\n.zr-select__native {\n opacity: 0;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n border: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n position: absolute;\n inset: 0;\n}\n\n.zr-select__trigger {\n align-items: center;\n gap: var(--zl-spacing-02, .5rem);\n width: 100%;\n height: 2.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 color: var(--zl-color-text-primary-white, #f4f4f6);\n text-align: start;\n cursor: pointer;\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 background: none;\n margin: 0;\n font-family: inherit;\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n display: flex;\n}\n\n.zr-select__value {\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n color: var(--zl-color-text-primary-white, #f4f4f6);\n flex: auto;\n overflow: hidden;\n}\n\n.zr-select__value--placeholder {\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n}\n\n.zr-select__icon {\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n transition: transform var(--zl-duration-fast, .12s)\n var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1));\n flex-shrink: 0;\n display: inline-flex;\n}\n\n.zr-select--open .zr-select__icon {\n transform: rotate(180deg);\n}\n\n.zr-select:not(.zr-select--disabled):not(.zr-select--open) .zr-select__trigger:hover {\n border-color: var(--zl-color-border-hover, #9e9eb2);\n background-color: color-mix(in srgb, var(--zl-color-text-primary-white, #f4f4f6) 10%, transparent);\n}\n\n.zr-select:not(.zr-select--disabled) .zr-select__field:focus-within .zr-select__trigger, .zr-select--open .zr-select__trigger {\n border-color: var(--zl-color-border-default-white, #f4f4f6);\n outline: none;\n}\n\n.zr-select--disabled .zr-select__trigger {\n border-color: var(--zl-color-border-default-gray-200, #484a57);\n color: var(--zl-color-text-disabled, #686883);\n cursor: not-allowed;\n}\n\n.zr-select--disabled .zr-select__value--placeholder {\n color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-select--invalid .zr-select__trigger, .zr-select--invalid .zr-select__field:focus-within .zr-select__trigger {\n border-color: var(--zl-color-text-error, #ea4f70);\n}\n\n.zr-select__error {\n color: var(--zl-color-text-error, #ea4f70);\n font-size: .75rem;\n line-height: 1rem;\n}\n\n.zr-select__listbox {\n top: calc(100% + var(--zl-spacing-02, .5rem));\n z-index: 20;\n border-radius: var(--zl-radius-xs, .25rem);\n border: 1px solid var(--zl-color-border-default-gray-200, #484a57);\n background: var(--zl-color-surface-default-black, #0f0f11);\n max-height: 15rem;\n margin: 0;\n padding: 0;\n list-style: none;\n position: absolute;\n left: 0;\n right: 0;\n overflow-y: auto;\n}\n\n.zr-select__listbox[hidden] {\n display: none;\n}\n\n.zr-select__option {\n align-items: center;\n gap: var(--zl-spacing-02, .5rem);\n height: 2.5rem;\n padding-block: var(--zl-spacing-02, .5rem);\n padding-inline: var(--zl-spacing-03, 1rem);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n cursor: pointer;\n font-size: .875rem;\n line-height: 1.25rem;\n display: flex;\n}\n\n.zr-select__option-label {\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: auto;\n min-width: 0;\n overflow: hidden;\n}\n\n.zr-select__option-check {\n color: var(--zl-color-text-primary-white, #f4f4f6);\n opacity: 0;\n flex-shrink: 0;\n display: inline-flex;\n}\n\n.zr-select__option:not([data-disabled]):hover, .zr-select__option[data-active]:not([data-disabled]) {\n background-color: color-mix(in srgb, var(--zl-color-text-primary-white, #f4f4f6) 10%, transparent);\n}\n\n.zr-select__option[data-selected] {\n background-color: var(--zl-color-surface-default-primary-gray, #252528);\n}\n\n.zr-select__option[data-selected] .zr-select__option-check {\n opacity: 1;\n}\n\n.zr-select__option[data-disabled] {\n color: var(--zl-color-text-disabled, #686883);\n cursor: not-allowed;\n}\n";
|
|
1773
1874
|
//#endregion
|
|
1774
1875
|
//#region src/atoms/zl-select.ts
|
|
1775
1876
|
let ZlSelect = class ZlSelect extends LitElement {
|
|
@@ -1825,6 +1926,20 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1825
1926
|
set required(value) {
|
|
1826
1927
|
this.#_required_accessor_storage = value;
|
|
1827
1928
|
}
|
|
1929
|
+
#_error_accessor_storage = "";
|
|
1930
|
+
get error() {
|
|
1931
|
+
return this.#_error_accessor_storage;
|
|
1932
|
+
}
|
|
1933
|
+
set error(value) {
|
|
1934
|
+
this.#_error_accessor_storage = value;
|
|
1935
|
+
}
|
|
1936
|
+
#_invalid_accessor_storage = false;
|
|
1937
|
+
get invalid() {
|
|
1938
|
+
return this.#_invalid_accessor_storage;
|
|
1939
|
+
}
|
|
1940
|
+
set invalid(value) {
|
|
1941
|
+
this.#_invalid_accessor_storage = value;
|
|
1942
|
+
}
|
|
1828
1943
|
#_disabled_accessor_storage = false;
|
|
1829
1944
|
get disabled() {
|
|
1830
1945
|
return this.#_disabled_accessor_storage;
|
|
@@ -1853,19 +1968,19 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1853
1968
|
set testId(value) {
|
|
1854
1969
|
this.#_testId_accessor_storage = value;
|
|
1855
1970
|
}
|
|
1856
|
-
#
|
|
1857
|
-
get
|
|
1858
|
-
return this.#
|
|
1971
|
+
#_activeValue_accessor_storage = null;
|
|
1972
|
+
get activeValue() {
|
|
1973
|
+
return this.#_activeValue_accessor_storage;
|
|
1859
1974
|
}
|
|
1860
|
-
set
|
|
1861
|
-
this.#
|
|
1975
|
+
set activeValue(value) {
|
|
1976
|
+
this.#_activeValue_accessor_storage = value;
|
|
1862
1977
|
}
|
|
1863
|
-
#
|
|
1864
|
-
get
|
|
1865
|
-
return this.#
|
|
1978
|
+
#_nativeEl_accessor_storage = null;
|
|
1979
|
+
get nativeEl() {
|
|
1980
|
+
return this.#_nativeEl_accessor_storage;
|
|
1866
1981
|
}
|
|
1867
|
-
set
|
|
1868
|
-
this.#
|
|
1982
|
+
set nativeEl(value) {
|
|
1983
|
+
this.#_nativeEl_accessor_storage = value;
|
|
1869
1984
|
}
|
|
1870
1985
|
baseId = nextUid("zl-select");
|
|
1871
1986
|
internals;
|
|
@@ -1879,10 +1994,12 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1879
1994
|
this.defaultValue = this.getAttribute("value") ?? "";
|
|
1880
1995
|
this.syncFormState();
|
|
1881
1996
|
document.addEventListener("pointerdown", this.handleDocumentPointerDown, true);
|
|
1997
|
+
document.addEventListener("keydown", this.handleDocumentKeydown, true);
|
|
1882
1998
|
}
|
|
1883
1999
|
disconnectedCallback() {
|
|
1884
2000
|
super.disconnectedCallback();
|
|
1885
2001
|
document.removeEventListener("pointerdown", this.handleDocumentPointerDown, true);
|
|
2002
|
+
document.removeEventListener("keydown", this.handleDocumentKeydown, true);
|
|
1886
2003
|
}
|
|
1887
2004
|
willUpdate(changed) {
|
|
1888
2005
|
if (changed.has("value") || changed.has("required")) this.syncFormState();
|
|
@@ -1896,36 +2013,73 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1896
2013
|
this.value = state ?? "";
|
|
1897
2014
|
}
|
|
1898
2015
|
focus(options) {
|
|
1899
|
-
this.
|
|
2016
|
+
this.nativeEl?.focus(options);
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* The string this control contributes to form submission — the uniform
|
|
2020
|
+
* read/write contract `<zitadel-login>` uses to capture and restore field
|
|
2021
|
+
* values without knowing each atom's internal shape. For a select that is
|
|
2022
|
+
* simply the chosen option's value (empty = nothing chosen).
|
|
2023
|
+
*/
|
|
2024
|
+
get formValue() {
|
|
2025
|
+
return this.value;
|
|
2026
|
+
}
|
|
2027
|
+
set formValue(value) {
|
|
2028
|
+
this.value = value;
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Options as painted in the listbox: a leading empty row (labelled with the
|
|
2032
|
+
* placeholder) so the user can return to "no selection". For a `required`
|
|
2033
|
+
* field this empty row is the prompt — choosing it leaves the value empty,
|
|
2034
|
+
* so `required` validation still blocks submit (native `<select>`
|
|
2035
|
+
* semantics). Any empty-valued member of the caller's list is dropped first,
|
|
2036
|
+
* so a schema enum that lists "" doesn't render a second, duplicate empty
|
|
2037
|
+
* option. The public `options` property stays the caller's list.
|
|
2038
|
+
*/
|
|
2039
|
+
get listOptions() {
|
|
2040
|
+
return [{
|
|
2041
|
+
value: "",
|
|
2042
|
+
label: this.placeholder
|
|
2043
|
+
}, ...this.options.filter((o) => o.value !== "")];
|
|
1900
2044
|
}
|
|
1901
2045
|
render() {
|
|
1902
2046
|
const labelId = `${this.baseId}-label`;
|
|
1903
|
-
const
|
|
1904
|
-
const
|
|
2047
|
+
const errorId = `${this.baseId}-error`;
|
|
2048
|
+
const showError = Boolean(this.error);
|
|
2049
|
+
const selected = this.value === "" ? void 0 : this.options.find((option) => option.value === this.value);
|
|
1905
2050
|
return html`
|
|
1906
2051
|
<div class=${classMap({
|
|
1907
2052
|
"zr-select": true,
|
|
1908
2053
|
"zr-select--open": this.open,
|
|
2054
|
+
"zr-select--invalid": this.invalid || showError,
|
|
1909
2055
|
"zr-select--disabled": this.disabled
|
|
1910
2056
|
})} part="root">
|
|
1911
2057
|
${this.renderLabel(labelId)}
|
|
1912
2058
|
<div class="zr-select__field" part="field">
|
|
1913
|
-
<
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
role="combobox"
|
|
1919
|
-
aria-haspopup="listbox"
|
|
1920
|
-
aria-expanded=${this.open ? "true" : "false"}
|
|
1921
|
-
aria-controls=${listboxId}
|
|
2059
|
+
<select
|
|
2060
|
+
class="zr-select__native"
|
|
2061
|
+
part="native"
|
|
2062
|
+
id=${`${this.baseId}-native`}
|
|
2063
|
+
data-testid=${ifDefined(this.nativeTestId())}
|
|
1922
2064
|
aria-labelledby=${this.label ? labelId : nothing}
|
|
1923
2065
|
aria-label=${ifDefined(this.label ? void 0 : this.ariaLabelText)}
|
|
1924
|
-
aria-
|
|
1925
|
-
|
|
2066
|
+
aria-invalid=${this.invalid || showError ? "true" : "false"}
|
|
2067
|
+
aria-describedby=${showError ? errorId : nothing}
|
|
1926
2068
|
?disabled=${this.disabled}
|
|
2069
|
+
?required=${this.required}
|
|
2070
|
+
@change=${this.handleNativeChange}
|
|
2071
|
+
>
|
|
2072
|
+
${this.listOptions.map((option) => html`<option
|
|
2073
|
+
value=${option.value}
|
|
2074
|
+
?disabled=${option.disabled ?? false}
|
|
2075
|
+
.selected=${live(option.value === this.value)}
|
|
2076
|
+
>${option.label}</option>`)}
|
|
2077
|
+
</select>
|
|
2078
|
+
<div
|
|
2079
|
+
class="zr-select__trigger"
|
|
2080
|
+
part="trigger"
|
|
2081
|
+
aria-hidden="true"
|
|
1927
2082
|
@click=${this.handleTriggerClick}
|
|
1928
|
-
@keydown=${this.handleTriggerKeyDown}
|
|
1929
2083
|
>
|
|
1930
2084
|
<span
|
|
1931
2085
|
class=${classMap({
|
|
@@ -1936,19 +2090,20 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1936
2090
|
${selected ? selected.label : this.placeholder}
|
|
1937
2091
|
</span>
|
|
1938
2092
|
<zl-icon class="zr-select__icon" name="chevron-down" size="16" decorative></zl-icon>
|
|
1939
|
-
</
|
|
1940
|
-
<ul
|
|
1941
|
-
|
|
1942
|
-
part="listbox"
|
|
1943
|
-
id=${listboxId}
|
|
1944
|
-
role="listbox"
|
|
1945
|
-
tabindex="-1"
|
|
1946
|
-
aria-labelledby=${this.label ? labelId : nothing}
|
|
1947
|
-
?hidden=${!this.open}
|
|
1948
|
-
>
|
|
1949
|
-
${this.options.map((option, index) => this.renderOption(option, index))}
|
|
2093
|
+
</div>
|
|
2094
|
+
<ul class="zr-select__listbox" part="listbox" aria-hidden="true" ?hidden=${!this.open}>
|
|
2095
|
+
${this.listOptions.map((option) => this.renderOption(option))}
|
|
1950
2096
|
</ul>
|
|
1951
2097
|
</div>
|
|
2098
|
+
<div
|
|
2099
|
+
class="zr-select__error"
|
|
2100
|
+
part="error"
|
|
2101
|
+
id=${errorId}
|
|
2102
|
+
role="alert"
|
|
2103
|
+
?hidden=${!showError}
|
|
2104
|
+
>
|
|
2105
|
+
${this.error}
|
|
2106
|
+
</div>
|
|
1952
2107
|
</div>
|
|
1953
2108
|
`;
|
|
1954
2109
|
}
|
|
@@ -1961,149 +2116,90 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1961
2116
|
</label>
|
|
1962
2117
|
`;
|
|
1963
2118
|
}
|
|
1964
|
-
renderOption(option
|
|
2119
|
+
renderOption(option) {
|
|
1965
2120
|
const isSelected = option.value === this.value;
|
|
1966
2121
|
return html`
|
|
1967
2122
|
<li
|
|
1968
2123
|
class="zr-select__option"
|
|
1969
2124
|
part="option"
|
|
1970
|
-
id=${this.optionId(index)}
|
|
1971
|
-
role="option"
|
|
1972
|
-
aria-selected=${isSelected ? "true" : "false"}
|
|
1973
|
-
aria-disabled=${option.disabled ? "true" : nothing}
|
|
1974
|
-
data-active=${this.open && index === this.activeIndex ? "true" : nothing}
|
|
1975
2125
|
data-value=${option.value}
|
|
1976
|
-
|
|
1977
|
-
|
|
2126
|
+
data-selected=${isSelected ? "" : nothing}
|
|
2127
|
+
data-active=${this.open && option.value === this.activeValue ? "" : nothing}
|
|
2128
|
+
data-disabled=${option.disabled ? "" : nothing}
|
|
2129
|
+
@click=${() => this.handleOptionClick(option)}
|
|
2130
|
+
@pointermove=${() => this.handleOptionPointerMove(option)}
|
|
1978
2131
|
>
|
|
1979
2132
|
<span class="zr-select__option-label">${option.label}</span>
|
|
1980
2133
|
<zl-icon class="zr-select__option-check" name="check" size="16" decorative></zl-icon>
|
|
1981
2134
|
</li>
|
|
1982
2135
|
`;
|
|
1983
2136
|
}
|
|
1984
|
-
optionId(index) {
|
|
1985
|
-
return `${this.baseId}-option-${index}`;
|
|
1986
|
-
}
|
|
1987
2137
|
handleLabelClick = () => {
|
|
1988
|
-
if (!this.disabled) this.
|
|
2138
|
+
if (!this.disabled) this.nativeEl?.focus();
|
|
1989
2139
|
};
|
|
1990
2140
|
handleTriggerClick = () => {
|
|
1991
2141
|
if (this.disabled) return;
|
|
1992
|
-
|
|
1993
|
-
else this.openMenu();
|
|
2142
|
+
this.open = !this.open;
|
|
1994
2143
|
};
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
case "Home":
|
|
2005
|
-
if (this.open) {
|
|
2006
|
-
event.preventDefault();
|
|
2007
|
-
this.setActive(this.firstEnabledIndex());
|
|
2008
|
-
}
|
|
2009
|
-
break;
|
|
2010
|
-
case "End":
|
|
2011
|
-
if (this.open) {
|
|
2012
|
-
event.preventDefault();
|
|
2013
|
-
this.setActive(this.lastEnabledIndex());
|
|
2014
|
-
}
|
|
2015
|
-
break;
|
|
2016
|
-
case "Enter":
|
|
2017
|
-
case " ":
|
|
2018
|
-
event.preventDefault();
|
|
2019
|
-
if (this.open) this.commitActive();
|
|
2020
|
-
else this.openMenu();
|
|
2021
|
-
break;
|
|
2022
|
-
case "Escape":
|
|
2023
|
-
if (this.open) {
|
|
2024
|
-
event.preventDefault();
|
|
2025
|
-
this.close();
|
|
2026
|
-
}
|
|
2027
|
-
break;
|
|
2028
|
-
case "Tab":
|
|
2029
|
-
if (this.open) this.close();
|
|
2030
|
-
break;
|
|
2031
|
-
default: break;
|
|
2032
|
-
}
|
|
2144
|
+
/**
|
|
2145
|
+
* The native `<select>` is the source of truth for keyboard, AT, and
|
|
2146
|
+
* automation. Its `change` event covers native-popup selection as well as
|
|
2147
|
+
* programmatic value-setting by automation drivers.
|
|
2148
|
+
*/
|
|
2149
|
+
handleNativeChange = (event) => {
|
|
2150
|
+
const next = event.target.value;
|
|
2151
|
+
this.open = false;
|
|
2152
|
+
this.commitValue(next);
|
|
2033
2153
|
};
|
|
2034
|
-
handleOptionClick(
|
|
2035
|
-
if (
|
|
2036
|
-
this.
|
|
2037
|
-
this.
|
|
2154
|
+
handleOptionClick(option) {
|
|
2155
|
+
if (option.disabled) return;
|
|
2156
|
+
this.open = false;
|
|
2157
|
+
this.nativeEl?.focus();
|
|
2158
|
+
this.commitValue(option.value);
|
|
2038
2159
|
}
|
|
2039
|
-
handleOptionPointerMove(
|
|
2040
|
-
if (!
|
|
2160
|
+
handleOptionPointerMove(option) {
|
|
2161
|
+
if (!option.disabled && option.value !== this.activeValue) this.activeValue = option.value;
|
|
2041
2162
|
}
|
|
2042
2163
|
handleDocumentPointerDown = (event) => {
|
|
2043
|
-
if (this.open && !event.composedPath().includes(this)) this.
|
|
2164
|
+
if (this.open && !event.composedPath().includes(this)) this.open = false;
|
|
2044
2165
|
};
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
this.activeIndex = -1;
|
|
2055
|
-
this.triggerEl?.focus();
|
|
2056
|
-
}
|
|
2057
|
-
commitActive() {
|
|
2058
|
-
const option = this.options[this.activeIndex];
|
|
2059
|
-
if (!option || option.disabled) return;
|
|
2060
|
-
const changed = option.value !== this.value;
|
|
2061
|
-
this.value = option.value;
|
|
2062
|
-
this.open = false;
|
|
2063
|
-
this.activeIndex = -1;
|
|
2064
|
-
this.triggerEl?.focus();
|
|
2065
|
-
this.syncFormState();
|
|
2066
|
-
if (changed) {
|
|
2067
|
-
emit(this, "zl-change", {
|
|
2068
|
-
name: this.name,
|
|
2069
|
-
value: this.value
|
|
2070
|
-
});
|
|
2071
|
-
this.dispatchEvent(new Event("change", {
|
|
2072
|
-
bubbles: true,
|
|
2073
|
-
composed: true
|
|
2074
|
-
}));
|
|
2075
|
-
}
|
|
2076
|
-
}
|
|
2077
|
-
moveActive(delta) {
|
|
2078
|
-
const count = this.options.length;
|
|
2079
|
-
if (count === 0) return;
|
|
2080
|
-
let next = this.activeIndex;
|
|
2081
|
-
for (let step = 0; step < count; step += 1) {
|
|
2082
|
-
next = (next + delta + count) % count;
|
|
2083
|
-
if (!this.options[next]?.disabled) {
|
|
2084
|
-
this.setActive(next);
|
|
2085
|
-
return;
|
|
2086
|
-
}
|
|
2166
|
+
/**
|
|
2167
|
+
* Escape closes the styled popup and stops propagation so it doesn't also
|
|
2168
|
+
* dismiss an enclosing dialog.
|
|
2169
|
+
*/
|
|
2170
|
+
handleDocumentKeydown = (event) => {
|
|
2171
|
+
if (this.open && event.key === "Escape") {
|
|
2172
|
+
event.stopPropagation();
|
|
2173
|
+
this.open = false;
|
|
2174
|
+
this.nativeEl?.focus();
|
|
2087
2175
|
}
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2176
|
+
};
|
|
2177
|
+
/**
|
|
2178
|
+
* Apply a new value from any input path (native select, styled popup), keeping
|
|
2179
|
+
* `value`, form state, and listeners in sync and emitting the `zl-change`
|
|
2180
|
+
* contract plus a composed native `change` for host forms.
|
|
2181
|
+
*/
|
|
2182
|
+
commitValue(next) {
|
|
2183
|
+
if (next === this.value) return;
|
|
2184
|
+
this.value = next;
|
|
2185
|
+
this.syncFormState();
|
|
2186
|
+
emit(this, "zl-change", {
|
|
2187
|
+
name: this.name,
|
|
2188
|
+
value: this.value
|
|
2189
|
+
});
|
|
2190
|
+
this.dispatchEvent(new Event("change", {
|
|
2191
|
+
bubbles: true,
|
|
2192
|
+
composed: true
|
|
2193
|
+
}));
|
|
2098
2194
|
}
|
|
2099
2195
|
syncFormState() {
|
|
2100
2196
|
this.internals.setFormValue?.(this.value || null);
|
|
2101
|
-
if (this.required && !this.value) this.internals.setValidity?.({ valueMissing: true }, "Please select an item in the list.", this.
|
|
2197
|
+
if (this.required && !this.value) this.internals.setValidity?.({ valueMissing: true }, "Please select an item in the list.", this.nativeEl ?? void 0);
|
|
2102
2198
|
else this.internals.setValidity?.({});
|
|
2103
2199
|
}
|
|
2104
|
-
|
|
2200
|
+
nativeTestId() {
|
|
2105
2201
|
if (this.name) return `zitadel-select-${this.name}`;
|
|
2106
|
-
if (this.testId) return `${this.testId}-
|
|
2202
|
+
if (this.testId) return `${this.testId}-native`;
|
|
2107
2203
|
}
|
|
2108
2204
|
};
|
|
2109
2205
|
__decorate([property()], ZlSelect.prototype, "label", null);
|
|
@@ -2122,6 +2218,11 @@ __decorate([property({
|
|
|
2122
2218
|
} }
|
|
2123
2219
|
})], ZlSelect.prototype, "options", null);
|
|
2124
2220
|
__decorate([property({ type: Boolean })], ZlSelect.prototype, "required", null);
|
|
2221
|
+
__decorate([property()], ZlSelect.prototype, "error", null);
|
|
2222
|
+
__decorate([property({
|
|
2223
|
+
type: Boolean,
|
|
2224
|
+
reflect: true
|
|
2225
|
+
})], ZlSelect.prototype, "invalid", null);
|
|
2125
2226
|
__decorate([property({
|
|
2126
2227
|
type: Boolean,
|
|
2127
2228
|
reflect: true
|
|
@@ -2132,8 +2233,8 @@ __decorate([property({
|
|
|
2132
2233
|
})], ZlSelect.prototype, "open", null);
|
|
2133
2234
|
__decorate([property({ attribute: "aria-label" })], ZlSelect.prototype, "ariaLabelText", null);
|
|
2134
2235
|
__decorate([property({ attribute: "data-testid" })], ZlSelect.prototype, "testId", null);
|
|
2135
|
-
__decorate([state()], ZlSelect.prototype, "
|
|
2136
|
-
__decorate([query(".zr-
|
|
2236
|
+
__decorate([state()], ZlSelect.prototype, "activeValue", null);
|
|
2237
|
+
__decorate([query(".zr-select__native")], ZlSelect.prototype, "nativeEl", null);
|
|
2137
2238
|
ZlSelect = __decorate([customElement("zl-select")], ZlSelect);
|
|
2138
2239
|
const zlSelectManifest = {
|
|
2139
2240
|
tag: "zl-select",
|
|
@@ -2144,6 +2245,8 @@ const zlSelectManifest = {
|
|
|
2144
2245
|
"placeholder",
|
|
2145
2246
|
"options",
|
|
2146
2247
|
"required",
|
|
2248
|
+
"error",
|
|
2249
|
+
"invalid",
|
|
2147
2250
|
"disabled",
|
|
2148
2251
|
"open",
|
|
2149
2252
|
"aria-label",
|
|
@@ -2153,14 +2256,16 @@ const zlSelectManifest = {
|
|
|
2153
2256
|
"root",
|
|
2154
2257
|
"label",
|
|
2155
2258
|
"field",
|
|
2259
|
+
"native",
|
|
2156
2260
|
"trigger",
|
|
2157
2261
|
"listbox",
|
|
2158
|
-
"option"
|
|
2262
|
+
"option",
|
|
2263
|
+
"error"
|
|
2159
2264
|
],
|
|
2160
2265
|
slots: [],
|
|
2161
2266
|
events: ["zl-change"]
|
|
2162
2267
|
};
|
|
2163
2268
|
//#endregion
|
|
2164
|
-
export {
|
|
2269
|
+
export { focusVisibleStyles as C, emit as E, __decorate as S, t as T, zlButtonManifest as _, ZlPasskey as a, ZlIcon as b, zlPageShellManifest as c, hookName as d, ZlCheckbox as f, ZlButton as g, zlCardManifest as h, zlPillManifest as i, ZlField as l, ZlCard as m, zlSelectManifest as n, zlPasskeyManifest as o, zlCheckboxManifest as p, ZlPill as r, ZlPageShell as s, ZlSelect as t, zlFieldManifest as u, ZlAlert as v, baseHostStyles as w, zlIconManifest as x, zlAlertManifest as y };
|
|
2165
2270
|
|
|
2166
|
-
//# sourceMappingURL=atoms-
|
|
2271
|
+
//# sourceMappingURL=atoms-5-wYIl88.mjs.map
|