@zitadel/components 0.1.0-alpha.17 → 0.1.0-alpha.19
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 +99 -26
- package/dist/atoms/index.d.mts +1 -1
- package/dist/atoms/index.mjs +1 -1
- package/dist/{atoms-KC7OJWXZ.mjs → atoms-B6QmUAzo.mjs} +264 -189
- package/dist/atoms-B6QmUAzo.mjs.map +1 -0
- package/dist/default-Bnjy2dJB.mjs +6 -0
- package/dist/default-Bnjy2dJB.mjs.map +1 -0
- package/dist/{index-DSZnfOJH.d.mts → index-CAi5gsHK.d.mts} +4789 -2181
- package/dist/index-CAi5gsHK.d.mts.map +1 -0
- package/dist/{index-DjYJwejg.d.mts → index-Ce_81oFH.d.mts} +505 -230
- package/dist/index-Ce_81oFH.d.mts.map +1 -0
- package/dist/{index-BniwXaIC.d.mts → index-Dgc94IMN.d.mts} +113 -1
- package/dist/index-Dgc94IMN.d.mts.map +1 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- package/dist/jsx.d.ts +67 -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-BWqJw4Yl.mjs → orchestrator-CsHP57zo.mjs} +2847 -2272
- package/dist/orchestrator-CsHP57zo.mjs.map +1 -0
- package/dist/standalone.mjs +8340 -6946
- package/dist/tokens/index.d.mts +1 -1
- package/dist/tokens/index.mjs +1 -1
- package/dist/tokens-DSnSf1mf.mjs +358 -0
- package/dist/tokens-DSnSf1mf.mjs.map +1 -0
- package/package.json +14 -10
- package/dist/atoms-KC7OJWXZ.mjs.map +0 -1
- package/dist/default-CfF7GoLv.mjs +0 -6
- package/dist/default-CfF7GoLv.mjs.map +0 -1
- package/dist/index-BniwXaIC.d.mts.map +0 -1
- package/dist/index-DSZnfOJH.d.mts.map +0 -1
- package/dist/index-DjYJwejg.d.mts.map +0 -1
- package/dist/orchestrator-BWqJw4Yl.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-DSnSf1mf.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
|
}
|
|
@@ -541,10 +543,10 @@ const zlButtonManifest = {
|
|
|
541
543
|
};
|
|
542
544
|
//#endregion
|
|
543
545
|
//#region ../shared-component-styles/src/lit/card-host.css?inline
|
|
544
|
-
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";
|
|
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\n:host([data-suppress-header]) .zr-card__header {\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden;\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,30 @@ 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-text-link, 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";
|
|
848
902
|
//#endregion
|
|
849
903
|
//#region src/internal/hook-name.ts
|
|
850
904
|
/**
|
|
@@ -1044,6 +1098,23 @@ let ZlField = class ZlField extends LitElement {
|
|
|
1044
1098
|
focus(options) {
|
|
1045
1099
|
this.inputEl?.focus(options);
|
|
1046
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
|
+
}
|
|
1047
1118
|
render() {
|
|
1048
1119
|
const labelId = `${this.inputId}-label`;
|
|
1049
1120
|
const errorId = `${this.inputId}-error`;
|
|
@@ -1313,10 +1384,10 @@ const zlFieldManifest = {
|
|
|
1313
1384
|
};
|
|
1314
1385
|
//#endregion
|
|
1315
1386
|
//#region ../shared-component-styles/src/lit/page-shell-host.css?inline
|
|
1316
|
-
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";
|
|
1317
1388
|
//#endregion
|
|
1318
1389
|
//#region ../shared-component-styles/src/page-shell.css?inline
|
|
1319
|
-
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";
|
|
1320
1391
|
//#endregion
|
|
1321
1392
|
//#region src/atoms/zl-page-shell.ts
|
|
1322
1393
|
let ZlPageShell = class ZlPageShell extends LitElement {
|
|
@@ -1738,7 +1809,7 @@ const zlPasskeyManifest = {
|
|
|
1738
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";
|
|
1739
1810
|
//#endregion
|
|
1740
1811
|
//#region ../shared-component-styles/src/pill.css?inline
|
|
1741
|
-
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";
|
|
1742
1813
|
//#endregion
|
|
1743
1814
|
//#region src/atoms/zl-pill.ts
|
|
1744
1815
|
let ZlPill = class ZlPill extends LitElement {
|
|
@@ -1799,7 +1870,7 @@ const zlPillManifest = {
|
|
|
1799
1870
|
var select_host_default = ":host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n";
|
|
1800
1871
|
//#endregion
|
|
1801
1872
|
//#region ../shared-component-styles/src/select.css?inline
|
|
1802
|
-
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";
|
|
1803
1874
|
//#endregion
|
|
1804
1875
|
//#region src/atoms/zl-select.ts
|
|
1805
1876
|
let ZlSelect = class ZlSelect extends LitElement {
|
|
@@ -1855,6 +1926,20 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1855
1926
|
set required(value) {
|
|
1856
1927
|
this.#_required_accessor_storage = value;
|
|
1857
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
|
+
}
|
|
1858
1943
|
#_disabled_accessor_storage = false;
|
|
1859
1944
|
get disabled() {
|
|
1860
1945
|
return this.#_disabled_accessor_storage;
|
|
@@ -1883,19 +1968,19 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1883
1968
|
set testId(value) {
|
|
1884
1969
|
this.#_testId_accessor_storage = value;
|
|
1885
1970
|
}
|
|
1886
|
-
#
|
|
1887
|
-
get
|
|
1888
|
-
return this.#
|
|
1971
|
+
#_activeValue_accessor_storage = null;
|
|
1972
|
+
get activeValue() {
|
|
1973
|
+
return this.#_activeValue_accessor_storage;
|
|
1889
1974
|
}
|
|
1890
|
-
set
|
|
1891
|
-
this.#
|
|
1975
|
+
set activeValue(value) {
|
|
1976
|
+
this.#_activeValue_accessor_storage = value;
|
|
1892
1977
|
}
|
|
1893
|
-
#
|
|
1894
|
-
get
|
|
1895
|
-
return this.#
|
|
1978
|
+
#_nativeEl_accessor_storage = null;
|
|
1979
|
+
get nativeEl() {
|
|
1980
|
+
return this.#_nativeEl_accessor_storage;
|
|
1896
1981
|
}
|
|
1897
|
-
set
|
|
1898
|
-
this.#
|
|
1982
|
+
set nativeEl(value) {
|
|
1983
|
+
this.#_nativeEl_accessor_storage = value;
|
|
1899
1984
|
}
|
|
1900
1985
|
baseId = nextUid("zl-select");
|
|
1901
1986
|
internals;
|
|
@@ -1909,10 +1994,12 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1909
1994
|
this.defaultValue = this.getAttribute("value") ?? "";
|
|
1910
1995
|
this.syncFormState();
|
|
1911
1996
|
document.addEventListener("pointerdown", this.handleDocumentPointerDown, true);
|
|
1997
|
+
document.addEventListener("keydown", this.handleDocumentKeydown, true);
|
|
1912
1998
|
}
|
|
1913
1999
|
disconnectedCallback() {
|
|
1914
2000
|
super.disconnectedCallback();
|
|
1915
2001
|
document.removeEventListener("pointerdown", this.handleDocumentPointerDown, true);
|
|
2002
|
+
document.removeEventListener("keydown", this.handleDocumentKeydown, true);
|
|
1916
2003
|
}
|
|
1917
2004
|
willUpdate(changed) {
|
|
1918
2005
|
if (changed.has("value") || changed.has("required")) this.syncFormState();
|
|
@@ -1926,36 +2013,73 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1926
2013
|
this.value = state ?? "";
|
|
1927
2014
|
}
|
|
1928
2015
|
focus(options) {
|
|
1929
|
-
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 !== "")];
|
|
1930
2044
|
}
|
|
1931
2045
|
render() {
|
|
1932
2046
|
const labelId = `${this.baseId}-label`;
|
|
1933
|
-
const
|
|
1934
|
-
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);
|
|
1935
2050
|
return html`
|
|
1936
2051
|
<div class=${classMap({
|
|
1937
2052
|
"zr-select": true,
|
|
1938
2053
|
"zr-select--open": this.open,
|
|
2054
|
+
"zr-select--invalid": this.invalid || showError,
|
|
1939
2055
|
"zr-select--disabled": this.disabled
|
|
1940
2056
|
})} part="root">
|
|
1941
2057
|
${this.renderLabel(labelId)}
|
|
1942
2058
|
<div class="zr-select__field" part="field">
|
|
1943
|
-
<
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
role="combobox"
|
|
1949
|
-
aria-haspopup="listbox"
|
|
1950
|
-
aria-expanded=${this.open ? "true" : "false"}
|
|
1951
|
-
aria-controls=${listboxId}
|
|
2059
|
+
<select
|
|
2060
|
+
class="zr-select__native"
|
|
2061
|
+
part="native"
|
|
2062
|
+
id=${`${this.baseId}-native`}
|
|
2063
|
+
data-testid=${ifDefined(this.nativeTestId())}
|
|
1952
2064
|
aria-labelledby=${this.label ? labelId : nothing}
|
|
1953
2065
|
aria-label=${ifDefined(this.label ? void 0 : this.ariaLabelText)}
|
|
1954
|
-
aria-
|
|
1955
|
-
|
|
2066
|
+
aria-invalid=${this.invalid || showError ? "true" : "false"}
|
|
2067
|
+
aria-describedby=${showError ? errorId : nothing}
|
|
1956
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"
|
|
1957
2082
|
@click=${this.handleTriggerClick}
|
|
1958
|
-
@keydown=${this.handleTriggerKeyDown}
|
|
1959
2083
|
>
|
|
1960
2084
|
<span
|
|
1961
2085
|
class=${classMap({
|
|
@@ -1966,19 +2090,20 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1966
2090
|
${selected ? selected.label : this.placeholder}
|
|
1967
2091
|
</span>
|
|
1968
2092
|
<zl-icon class="zr-select__icon" name="chevron-down" size="16" decorative></zl-icon>
|
|
1969
|
-
</
|
|
1970
|
-
<ul
|
|
1971
|
-
|
|
1972
|
-
part="listbox"
|
|
1973
|
-
id=${listboxId}
|
|
1974
|
-
role="listbox"
|
|
1975
|
-
tabindex="-1"
|
|
1976
|
-
aria-labelledby=${this.label ? labelId : nothing}
|
|
1977
|
-
?hidden=${!this.open}
|
|
1978
|
-
>
|
|
1979
|
-
${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))}
|
|
1980
2096
|
</ul>
|
|
1981
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>
|
|
1982
2107
|
</div>
|
|
1983
2108
|
`;
|
|
1984
2109
|
}
|
|
@@ -1991,149 +2116,90 @@ let ZlSelect = class ZlSelect extends LitElement {
|
|
|
1991
2116
|
</label>
|
|
1992
2117
|
`;
|
|
1993
2118
|
}
|
|
1994
|
-
renderOption(option
|
|
2119
|
+
renderOption(option) {
|
|
1995
2120
|
const isSelected = option.value === this.value;
|
|
1996
2121
|
return html`
|
|
1997
2122
|
<li
|
|
1998
2123
|
class="zr-select__option"
|
|
1999
2124
|
part="option"
|
|
2000
|
-
id=${this.optionId(index)}
|
|
2001
|
-
role="option"
|
|
2002
|
-
aria-selected=${isSelected ? "true" : "false"}
|
|
2003
|
-
aria-disabled=${option.disabled ? "true" : nothing}
|
|
2004
|
-
data-active=${this.open && index === this.activeIndex ? "true" : nothing}
|
|
2005
2125
|
data-value=${option.value}
|
|
2006
|
-
|
|
2007
|
-
|
|
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)}
|
|
2008
2131
|
>
|
|
2009
2132
|
<span class="zr-select__option-label">${option.label}</span>
|
|
2010
2133
|
<zl-icon class="zr-select__option-check" name="check" size="16" decorative></zl-icon>
|
|
2011
2134
|
</li>
|
|
2012
2135
|
`;
|
|
2013
2136
|
}
|
|
2014
|
-
optionId(index) {
|
|
2015
|
-
return `${this.baseId}-option-${index}`;
|
|
2016
|
-
}
|
|
2017
2137
|
handleLabelClick = () => {
|
|
2018
|
-
if (!this.disabled) this.
|
|
2138
|
+
if (!this.disabled) this.nativeEl?.focus();
|
|
2019
2139
|
};
|
|
2020
2140
|
handleTriggerClick = () => {
|
|
2021
2141
|
if (this.disabled) return;
|
|
2022
|
-
|
|
2023
|
-
else this.openMenu();
|
|
2142
|
+
this.open = !this.open;
|
|
2024
2143
|
};
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
case "Home":
|
|
2035
|
-
if (this.open) {
|
|
2036
|
-
event.preventDefault();
|
|
2037
|
-
this.setActive(this.firstEnabledIndex());
|
|
2038
|
-
}
|
|
2039
|
-
break;
|
|
2040
|
-
case "End":
|
|
2041
|
-
if (this.open) {
|
|
2042
|
-
event.preventDefault();
|
|
2043
|
-
this.setActive(this.lastEnabledIndex());
|
|
2044
|
-
}
|
|
2045
|
-
break;
|
|
2046
|
-
case "Enter":
|
|
2047
|
-
case " ":
|
|
2048
|
-
event.preventDefault();
|
|
2049
|
-
if (this.open) this.commitActive();
|
|
2050
|
-
else this.openMenu();
|
|
2051
|
-
break;
|
|
2052
|
-
case "Escape":
|
|
2053
|
-
if (this.open) {
|
|
2054
|
-
event.preventDefault();
|
|
2055
|
-
this.close();
|
|
2056
|
-
}
|
|
2057
|
-
break;
|
|
2058
|
-
case "Tab":
|
|
2059
|
-
if (this.open) this.close();
|
|
2060
|
-
break;
|
|
2061
|
-
default: break;
|
|
2062
|
-
}
|
|
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);
|
|
2063
2153
|
};
|
|
2064
|
-
handleOptionClick(
|
|
2065
|
-
if (
|
|
2066
|
-
this.
|
|
2067
|
-
this.
|
|
2154
|
+
handleOptionClick(option) {
|
|
2155
|
+
if (option.disabled) return;
|
|
2156
|
+
this.open = false;
|
|
2157
|
+
this.nativeEl?.focus();
|
|
2158
|
+
this.commitValue(option.value);
|
|
2068
2159
|
}
|
|
2069
|
-
handleOptionPointerMove(
|
|
2070
|
-
if (!
|
|
2160
|
+
handleOptionPointerMove(option) {
|
|
2161
|
+
if (!option.disabled && option.value !== this.activeValue) this.activeValue = option.value;
|
|
2071
2162
|
}
|
|
2072
2163
|
handleDocumentPointerDown = (event) => {
|
|
2073
|
-
if (this.open && !event.composedPath().includes(this)) this.
|
|
2164
|
+
if (this.open && !event.composedPath().includes(this)) this.open = false;
|
|
2074
2165
|
};
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
this.activeIndex = -1;
|
|
2085
|
-
this.triggerEl?.focus();
|
|
2086
|
-
}
|
|
2087
|
-
commitActive() {
|
|
2088
|
-
const option = this.options[this.activeIndex];
|
|
2089
|
-
if (!option || option.disabled) return;
|
|
2090
|
-
const changed = option.value !== this.value;
|
|
2091
|
-
this.value = option.value;
|
|
2092
|
-
this.open = false;
|
|
2093
|
-
this.activeIndex = -1;
|
|
2094
|
-
this.triggerEl?.focus();
|
|
2095
|
-
this.syncFormState();
|
|
2096
|
-
if (changed) {
|
|
2097
|
-
emit(this, "zl-change", {
|
|
2098
|
-
name: this.name,
|
|
2099
|
-
value: this.value
|
|
2100
|
-
});
|
|
2101
|
-
this.dispatchEvent(new Event("change", {
|
|
2102
|
-
bubbles: true,
|
|
2103
|
-
composed: true
|
|
2104
|
-
}));
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
moveActive(delta) {
|
|
2108
|
-
const count = this.options.length;
|
|
2109
|
-
if (count === 0) return;
|
|
2110
|
-
let next = this.activeIndex;
|
|
2111
|
-
for (let step = 0; step < count; step += 1) {
|
|
2112
|
-
next = (next + delta + count) % count;
|
|
2113
|
-
if (!this.options[next]?.disabled) {
|
|
2114
|
-
this.setActive(next);
|
|
2115
|
-
return;
|
|
2116
|
-
}
|
|
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();
|
|
2117
2175
|
}
|
|
2118
|
-
}
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
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
|
+
}));
|
|
2128
2194
|
}
|
|
2129
2195
|
syncFormState() {
|
|
2130
2196
|
this.internals.setFormValue?.(this.value || null);
|
|
2131
|
-
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);
|
|
2132
2198
|
else this.internals.setValidity?.({});
|
|
2133
2199
|
}
|
|
2134
|
-
|
|
2200
|
+
nativeTestId() {
|
|
2135
2201
|
if (this.name) return `zitadel-select-${this.name}`;
|
|
2136
|
-
if (this.testId) return `${this.testId}-
|
|
2202
|
+
if (this.testId) return `${this.testId}-native`;
|
|
2137
2203
|
}
|
|
2138
2204
|
};
|
|
2139
2205
|
__decorate([property()], ZlSelect.prototype, "label", null);
|
|
@@ -2152,6 +2218,11 @@ __decorate([property({
|
|
|
2152
2218
|
} }
|
|
2153
2219
|
})], ZlSelect.prototype, "options", null);
|
|
2154
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);
|
|
2155
2226
|
__decorate([property({
|
|
2156
2227
|
type: Boolean,
|
|
2157
2228
|
reflect: true
|
|
@@ -2162,8 +2233,8 @@ __decorate([property({
|
|
|
2162
2233
|
})], ZlSelect.prototype, "open", null);
|
|
2163
2234
|
__decorate([property({ attribute: "aria-label" })], ZlSelect.prototype, "ariaLabelText", null);
|
|
2164
2235
|
__decorate([property({ attribute: "data-testid" })], ZlSelect.prototype, "testId", null);
|
|
2165
|
-
__decorate([state()], ZlSelect.prototype, "
|
|
2166
|
-
__decorate([query(".zr-
|
|
2236
|
+
__decorate([state()], ZlSelect.prototype, "activeValue", null);
|
|
2237
|
+
__decorate([query(".zr-select__native")], ZlSelect.prototype, "nativeEl", null);
|
|
2167
2238
|
ZlSelect = __decorate([customElement("zl-select")], ZlSelect);
|
|
2168
2239
|
const zlSelectManifest = {
|
|
2169
2240
|
tag: "zl-select",
|
|
@@ -2174,6 +2245,8 @@ const zlSelectManifest = {
|
|
|
2174
2245
|
"placeholder",
|
|
2175
2246
|
"options",
|
|
2176
2247
|
"required",
|
|
2248
|
+
"error",
|
|
2249
|
+
"invalid",
|
|
2177
2250
|
"disabled",
|
|
2178
2251
|
"open",
|
|
2179
2252
|
"aria-label",
|
|
@@ -2183,9 +2256,11 @@ const zlSelectManifest = {
|
|
|
2183
2256
|
"root",
|
|
2184
2257
|
"label",
|
|
2185
2258
|
"field",
|
|
2259
|
+
"native",
|
|
2186
2260
|
"trigger",
|
|
2187
2261
|
"listbox",
|
|
2188
|
-
"option"
|
|
2262
|
+
"option",
|
|
2263
|
+
"error"
|
|
2189
2264
|
],
|
|
2190
2265
|
slots: [],
|
|
2191
2266
|
events: ["zl-change"]
|
|
@@ -2193,4 +2268,4 @@ const zlSelectManifest = {
|
|
|
2193
2268
|
//#endregion
|
|
2194
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 };
|
|
2195
2270
|
|
|
2196
|
-
//# sourceMappingURL=atoms-
|
|
2271
|
+
//# sourceMappingURL=atoms-B6QmUAzo.mjs.map
|