@zitadel/components 0.1.0-alpha.11 → 0.1.0-alpha.13

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.
@@ -3,7 +3,7 @@ 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";
5
5
  import { unsafeSVG } from "lit/directives/unsafe-svg.js";
6
- import { ArrowLeft, ArrowRight, Check, CircleAlert, Eye, EyeOff, Info, KeyRound, LoaderCircle, Plus, TriangleAlert, User, X } from "lucide";
6
+ import { ArrowLeft, ArrowRight, Check, ChevronDown, CircleAlert, Eye, EyeOff, Info, KeyRound, LoaderCircle, Plus, TriangleAlert, User, X } from "lucide";
7
7
  import { ifDefined } from "lit/directives/if-defined.js";
8
8
  import { live } from "lit/directives/live.js";
9
9
  //#region ../shared-component-styles/src/lit/alert-host.css?inline
@@ -86,7 +86,7 @@ function surfaceStyles(...cssChunks) {
86
86
  var icon_host_default = ":host {\n color: inherit;\n display: contents;\n}\n";
87
87
  //#endregion
88
88
  //#region ../shared-component-styles/src/icon.css?inline
89
- var icon_default = ".zr-icon {\n color: inherit;\n width: var(--zl-icon-size, 1.5rem);\n height: var(--zl-icon-size, 1.5rem);\n justify-content: center;\n align-items: center;\n display: inline-flex;\n}\n\n.zr-icon--16 {\n --zl-icon-size: 1rem;\n}\n\n.zr-icon--24 {\n --zl-icon-size: 1.5rem;\n}\n\n.zr-icon--tone-error {\n color: var(--zl-color-icon-error);\n}\n\n.zr-icon--tone-success {\n color: var(--zl-color-icon-success);\n}\n\n.zr-icon--tone-disabled {\n color: var(--zl-color-icon-disabled);\n}\n\n.zr-icon svg {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n.zr-icon--spin svg {\n animation: .8s linear infinite zr-icon-spin;\n}\n\n@keyframes zr-icon-spin {\n to {\n transform: rotate(360deg);\n }\n}\n";
89
+ var icon_default = ".zr-icon {\n width: var(--zl-icon-size, 1.5rem);\n height: var(--zl-icon-size, 1.5rem);\n justify-content: center;\n align-items: center;\n display: inline-flex;\n}\n\n.zr-icon--16 {\n --zl-icon-size: 1rem;\n}\n\n.zr-icon--24 {\n --zl-icon-size: 1.5rem;\n}\n\n.zr-icon--tone-error {\n color: var(--zl-color-icon-error);\n}\n\n.zr-icon--tone-success {\n color: var(--zl-color-icon-success);\n}\n\n.zr-icon--tone-disabled {\n color: var(--zl-color-icon-disabled);\n}\n\n.zr-icon svg {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n.zr-icon--spin svg {\n animation: .8s linear infinite zr-icon-spin;\n}\n\n@keyframes zr-icon-spin {\n to {\n transform: rotate(360deg);\n }\n}\n";
90
90
  //#endregion
91
91
  //#region \0@oxc-project+runtime@0.127.0/helpers/decorate.js
92
92
  function __decorate(decorators, target, key, desc) {
@@ -186,6 +186,7 @@ const ICON_NODES = {
186
186
  "arrow-left": ArrowLeft,
187
187
  spinner: LoaderCircle,
188
188
  check: Check,
189
+ "chevron-down": ChevronDown,
189
190
  cross: X,
190
191
  warning: TriangleAlert,
191
192
  "alert-circle": CircleAlert,
@@ -543,7 +544,7 @@ const zlButtonManifest = {
543
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";
544
545
  //#endregion
545
546
  //#region ../shared-component-styles/src/card.css?inline
546
- var card_default = ".zr-card {\n width: 100%;\n max-width: var(--zl-container-auth-card, 24rem);\n border: 1px solid var(--zl-color-surface-default-primary-gray, #252528);\n border-radius: var(--zl-radius-l, 1rem);\n padding: var(--zl-spacing-05, 2rem);\n gap: var(--zl-spacing-05, 2rem);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n box-sizing: border-box;\n background: none;\n flex-direction: column;\n margin-inline: auto;\n display: flex;\n}\n\n.zr-card--compact {\n gap: var(--zl-spacing-04, 1.5rem);\n}\n\n.zr-card__header, .zr-card__footer {\n gap: var(--zl-spacing-02, .5rem);\n flex-direction: column;\n display: flex;\n}\n\n.zr-card__region--empty {\n display: none;\n}\n\n.zr-card__body {\n gap: var(--zl-spacing-03, 1rem);\n flex-direction: column;\n display: flex;\n}\n";
547
+ var card_default = ".zr-card {\n width: 100%;\n max-width: var(--zl-container-auth-card, 24rem);\n border: 1px solid var(--zl-color-surface-default-primary-gray, #252528);\n border-radius: var(--zl-radius-l, 1rem);\n padding: var(--zl-spacing-05, 2rem);\n gap: var(--zl-spacing-05, 2rem);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n box-sizing: border-box;\n background: none;\n flex-direction: column;\n margin-inline: auto;\n 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";
547
548
  //#endregion
548
549
  //#region src/atoms/zl-card.ts
549
550
  let ZlCard = class ZlCard extends LitElement {
@@ -612,11 +613,11 @@ const zlCardManifest = {
612
613
  events: []
613
614
  };
614
615
  //#endregion
615
- //#region ../shared-component-styles/src/lit/text-field-host.css?inline
616
- var text_field_host_default = ":host {\n display: block;\n}\n\n::slotted([slot=\"prefix\"]), ::slotted([slot=\"suffix\"]) {\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n display: inline-flex;\n}\n\n.zr-field__help[hidden], .zr-field__error[hidden] {\n display: none;\n}\n\n:host([data-state=\"hovered\"]:not([disabled])) .zr-field:not(.zr-field--invalid):not(.zr-field--success) .zr-field__wrap:not(:focus-within) {\n border-color: var(--zl-color-gray-500, #9e9eb2);\n background-color: color-mix(in srgb, var(--zl-color-text-primary-white, #f4f4f6) 10%, transparent);\n}\n\n:host([data-state=\"focused\"]:not([disabled])) .zr-field:not(.zr-field--invalid):not(.zr-field--success) .zr-field__wrap {\n border-color: var(--zl-color-border-default-white, #f4f4f6);\n}\n\n:host([data-state=\"focused\"]:not([disabled])) .zr-field--invalid .zr-field__wrap {\n border-color: var(--zl-color-border-error, #ea4f70);\n}\n\n:host([data-state=\"focused\"]:not([disabled])) .zr-field--success .zr-field__wrap {\n border-color: var(--zl-color-border-success, #33a779);\n}\n";
616
+ //#region ../shared-component-styles/src/lit/checkbox-host.css?inline
617
+ var checkbox_host_default = ":host {\n display: inline-flex;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n";
617
618
  //#endregion
618
- //#region ../shared-component-styles/src/text-field.css?inline
619
- var text_field_default = ".zr-field {\n align-items: stretch;\n gap: var(--zl-spacing-02, .5rem);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n flex-direction: column;\n display: flex;\n}\n\n.zr-field__label-row {\n justify-content: space-between;\n align-items: flex-start;\n gap: var(--zl-spacing-02, .5rem);\n width: 100%;\n display: flex;\n}\n\n.zr-field__label {\n align-items: center;\n gap: var(--zl-spacing-01, .25rem);\n color: var(--zl-color-text-primary-white, #f4f4f6);\n font-size: 1rem;\n font-weight: 600;\n line-height: 1.5rem;\n display: inline-flex;\n}\n\n.zr-field__link {\n color: var(--zl-color-icon-default-purple, #bba5e4);\n flex-shrink: 0;\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n text-decoration: none;\n}\n\n.zr-field__link:hover {\n text-decoration: underline;\n}\n\n.zr-field__link:focus-visible {\n outline: var(--zl-focus-width, 2px) solid var(--zl-focus-color, #f4f4f6);\n outline-offset: var(--zl-focus-offset, 2px);\n border-radius: 2px;\n}\n\n.zr-field__required {\n color: var(--zl-color-text-error, #ea4f70);\n}\n\n.zr-field--disabled .zr-field__label {\n color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-field__wrap {\n align-items: center;\n gap: var(--zl-spacing-02, .5rem);\n padding-block: var(--zl-spacing-02, .5rem);\n padding-inline: var(--zl-spacing-03, 1rem);\n border-radius: var(--zl-radius-xs, .25rem);\n border: 1px solid var(--zl-color-border-default-gray-300, #686883);\n height: 2.5rem;\n transition: border-color var(--zl-duration-fast, .12s) var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1)),\n background-color var(--zl-duration-fast, .12s) var(--zl-easing-standard, cubic-bezier(.2, 0, 0, 1));\n box-sizing: border-box;\n background: none;\n display: flex;\n position: relative;\n overflow: visible;\n}\n\n.zr-field__wrap--trailing {\n padding-inline-end: 2.5rem;\n}\n\n.zr-field:not(.zr-field--disabled) .zr-field__wrap:hover:not(:focus-within) {\n border-color: var(--zl-color-gray-500, #9e9eb2);\n background-color: color-mix(in srgb, var(--zl-color-text-primary-white, #f4f4f6) 10%, transparent);\n}\n\n.zr-field:not(.zr-field--invalid):not(.zr-field--disabled):not(.zr-field--success) .zr-field__wrap:has(.zr-field__input:not(:placeholder-shown)):not(:focus-within) {\n border-color: var(--zl-color-border-default-gray-400, #82829c);\n}\n\n.zr-field:not(.zr-field--invalid):not(.zr-field--disabled):not(.zr-field--success) .zr-field__wrap:focus-within {\n border-color: var(--zl-color-border-default-white, #f4f4f6);\n outline: none;\n}\n\n.zr-field--invalid .zr-field__wrap {\n border-color: var(--zl-color-border-error, #ea4f70);\n}\n\n.zr-field--invalid .zr-field__wrap:focus-within {\n border-color: var(--zl-color-border-error, #ea4f70);\n outline: none;\n}\n\n.zr-field--success .zr-field__wrap {\n border-color: var(--zl-color-border-success, #33a779);\n}\n\n.zr-field--success .zr-field__wrap:focus-within {\n border-color: var(--zl-color-border-success, #33a779);\n outline: none;\n}\n\n.zr-field--disabled .zr-field__wrap {\n border-color: var(--zl-color-border-default-gray-200, #484a57);\n}\n\n.zr-field__input {\n min-width: 0;\n height: 100%;\n color: var(--zl-color-text-primary-white, #f4f4f6);\n background: none;\n border: 0;\n outline: none;\n flex: auto;\n padding: 0;\n font-family: inherit;\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n}\n\n.zr-field__input[type=\"password\"] {\n letter-spacing: .125rem;\n}\n\n.zr-field__input::placeholder {\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n}\n\n.zr-field__input:focus, .zr-field__input:focus-visible {\n outline: none;\n}\n\n.zr-field__input:disabled {\n cursor: not-allowed;\n color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-field--disabled .zr-field__wrap:hover {\n border-color: var(--zl-color-border-default-gray-200, #484a57);\n background-color: #0000;\n}\n\n.zr-field__trailing {\n width: 1rem;\n height: 1rem;\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n justify-content: center;\n align-items: center;\n display: inline-flex;\n position: absolute;\n top: 50%;\n right: .9375rem;\n transform: translateY(-50%);\n}\n\n.zr-field__trailing-action {\n color: inherit;\n cursor: pointer;\n background: none;\n border: 0;\n justify-content: center;\n align-items: center;\n margin: 0;\n padding: 0;\n line-height: 0;\n display: inline-flex;\n}\n\n.zr-field__trailing-action:focus-visible {\n outline: var(--zl-focus-width, 2px) solid var(--zl-focus-color, #f4f4f6);\n outline-offset: var(--zl-focus-offset, 2px);\n border-radius: 2px;\n}\n\n.zr-field__trailing-action:disabled {\n cursor: not-allowed;\n}\n\n.zr-field--invalid .zr-field__trailing {\n color: var(--zl-color-text-error, #ea4f70);\n}\n\n.zr-field--success .zr-field__trailing {\n color: var(--zl-color-text-success, #33a779);\n}\n\n.zr-field__help {\n color: var(--zl-color-text-primary-white, #f4f4f6);\n font-size: .75rem;\n line-height: 1rem;\n}\n\n.zr-field__success {\n color: var(--zl-color-text-success, #33a779);\n font-size: .75rem;\n line-height: 1rem;\n}\n\n.zr-field__error {\n color: var(--zl-color-text-error, #ea4f70);\n font-size: .75rem;\n line-height: 1rem;\n}\n";
619
+ //#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";
620
621
  //#endregion
621
622
  //#region src/internal/unique-id.ts
622
623
  /**
@@ -636,6 +637,215 @@ function nextUid(prefix) {
636
637
  return `${prefix}-${counter}`;
637
638
  }
638
639
  //#endregion
640
+ //#region src/atoms/zl-checkbox.ts
641
+ let ZlCheckbox = class ZlCheckbox extends LitElement {
642
+ static formAssociated = true;
643
+ static shadowRootOptions = {
644
+ ...LitElement.shadowRootOptions,
645
+ delegatesFocus: true
646
+ };
647
+ static styles = [baseHostStyles, ...surfaceStyles(checkbox_host_default, checkbox_default)];
648
+ /**
649
+ * Field name — used as the key in form submission and in `zl-change` detail.
650
+ * The browser owns a native `name` property on form-associated elements, so
651
+ * we manage it manually to avoid a conflicting auto-generated accessor (see
652
+ * `<zl-field>`).
653
+ */
654
+ get name() {
655
+ return this.getAttribute("name") ?? "";
656
+ }
657
+ set name(value) {
658
+ this.setAttribute("name", value);
659
+ }
660
+ #_label_accessor_storage = "";
661
+ get label() {
662
+ return this.#_label_accessor_storage;
663
+ }
664
+ set label(value) {
665
+ this.#_label_accessor_storage = value;
666
+ }
667
+ #_value_accessor_storage = "on";
668
+ get value() {
669
+ return this.#_value_accessor_storage;
670
+ }
671
+ set value(value) {
672
+ this.#_value_accessor_storage = value;
673
+ }
674
+ #_checked_accessor_storage = false;
675
+ get checked() {
676
+ return this.#_checked_accessor_storage;
677
+ }
678
+ set checked(value) {
679
+ this.#_checked_accessor_storage = value;
680
+ }
681
+ #_disabled_accessor_storage = false;
682
+ get disabled() {
683
+ return this.#_disabled_accessor_storage;
684
+ }
685
+ set disabled(value) {
686
+ this.#_disabled_accessor_storage = value;
687
+ }
688
+ #_required_accessor_storage = false;
689
+ get required() {
690
+ return this.#_required_accessor_storage;
691
+ }
692
+ set required(value) {
693
+ this.#_required_accessor_storage = value;
694
+ }
695
+ #_ariaLabelText_accessor_storage = void 0;
696
+ get ariaLabelText() {
697
+ return this.#_ariaLabelText_accessor_storage;
698
+ }
699
+ set ariaLabelText(value) {
700
+ this.#_ariaLabelText_accessor_storage = value;
701
+ }
702
+ #_testId_accessor_storage = void 0;
703
+ get testId() {
704
+ return this.#_testId_accessor_storage;
705
+ }
706
+ set testId(value) {
707
+ this.#_testId_accessor_storage = value;
708
+ }
709
+ #_forcedState_accessor_storage = null;
710
+ get forcedState() {
711
+ return this.#_forcedState_accessor_storage;
712
+ }
713
+ set forcedState(value) {
714
+ this.#_forcedState_accessor_storage = value;
715
+ }
716
+ #_inputEl_accessor_storage = null;
717
+ get inputEl() {
718
+ return this.#_inputEl_accessor_storage;
719
+ }
720
+ set inputEl(value) {
721
+ this.#_inputEl_accessor_storage = value;
722
+ }
723
+ inputId = nextUid("zl-checkbox");
724
+ internals;
725
+ defaultChecked = false;
726
+ constructor() {
727
+ super();
728
+ this.internals = this.attachInternals();
729
+ }
730
+ connectedCallback() {
731
+ super.connectedCallback();
732
+ this.defaultChecked = this.hasAttribute("checked");
733
+ this.syncFormState();
734
+ }
735
+ willUpdate(changed) {
736
+ if (changed.has("checked") || changed.has("required") || changed.has("value")) this.syncFormState();
737
+ }
738
+ formResetCallback() {
739
+ this.checked = this.defaultChecked;
740
+ }
741
+ formStateRestoreCallback(state) {
742
+ this.checked = state === this.value;
743
+ }
744
+ focus(options) {
745
+ this.inputEl?.focus(options);
746
+ }
747
+ render() {
748
+ const rootClass = classMap({
749
+ "zr-checkbox": true,
750
+ "zr-checkbox--disabled": this.disabled
751
+ });
752
+ const labelText = this.label;
753
+ return html`
754
+ <label class=${rootClass} part="root" data-state=${this.forcedState ?? nothing}>
755
+ <input
756
+ class="zr-checkbox__input"
757
+ part="input"
758
+ id=${this.inputId}
759
+ type="checkbox"
760
+ name=${this.name || nothing}
761
+ .checked=${live(this.checked)}
762
+ value=${this.value}
763
+ ?required=${this.required}
764
+ ?disabled=${this.disabled}
765
+ aria-label=${ifDefined(labelText ? void 0 : this.ariaLabelText)}
766
+ data-testid=${ifDefined(this.nativeInputTestId())}
767
+ @change=${this.handleChange}
768
+ />
769
+ <span class="zr-checkbox__box" part="box">
770
+ <span class="zr-checkbox__face" part="face">
771
+ <zl-icon class="zr-checkbox__check" part="check" name="check" size="16" decorative></zl-icon>
772
+ </span>
773
+ </span>
774
+ ${labelText ? html`<span class="zr-checkbox__label" part="label">${labelText}</span>` : html`<slot></slot>`}
775
+ </label>
776
+ `;
777
+ }
778
+ handleChange = (event) => {
779
+ event.stopPropagation();
780
+ const input = event.target;
781
+ this.checked = input.checked;
782
+ this.syncFormState();
783
+ emit(this, "zl-change", {
784
+ name: this.name,
785
+ checked: this.checked,
786
+ value: this.value
787
+ });
788
+ this.dispatchEvent(new Event("change", {
789
+ bubbles: true,
790
+ composed: true
791
+ }));
792
+ };
793
+ syncFormState() {
794
+ this.internals.setFormValue?.(this.checked ? this.value : null);
795
+ if (this.required && !this.checked) this.internals.setValidity?.({ valueMissing: true }, "Please check this box to continue.");
796
+ else this.internals.setValidity?.({});
797
+ }
798
+ nativeInputTestId() {
799
+ if (this.name) return `zitadel-checkbox-${this.name}`;
800
+ if (this.testId) return `${this.testId}-input`;
801
+ }
802
+ };
803
+ __decorate([property()], ZlCheckbox.prototype, "label", null);
804
+ __decorate([property()], ZlCheckbox.prototype, "value", null);
805
+ __decorate([property({
806
+ type: Boolean,
807
+ reflect: true
808
+ })], ZlCheckbox.prototype, "checked", null);
809
+ __decorate([property({
810
+ type: Boolean,
811
+ reflect: true
812
+ })], ZlCheckbox.prototype, "disabled", null);
813
+ __decorate([property({ type: Boolean })], ZlCheckbox.prototype, "required", null);
814
+ __decorate([property({ attribute: "aria-label" })], ZlCheckbox.prototype, "ariaLabelText", null);
815
+ __decorate([property({ attribute: "data-testid" })], ZlCheckbox.prototype, "testId", null);
816
+ __decorate([property({ attribute: "data-state" })], ZlCheckbox.prototype, "forcedState", null);
817
+ __decorate([query(".zr-checkbox__input")], ZlCheckbox.prototype, "inputEl", null);
818
+ ZlCheckbox = __decorate([customElement("zl-checkbox")], ZlCheckbox);
819
+ const zlCheckboxManifest = {
820
+ tag: "zl-checkbox",
821
+ attrs: [
822
+ "name",
823
+ "label",
824
+ "value",
825
+ "checked",
826
+ "disabled",
827
+ "required",
828
+ "aria-label",
829
+ "data-testid"
830
+ ],
831
+ parts: [
832
+ "root",
833
+ "input",
834
+ "box",
835
+ "face",
836
+ "check",
837
+ "label"
838
+ ],
839
+ slots: [""],
840
+ events: ["zl-change"]
841
+ };
842
+ //#endregion
843
+ //#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-gray-500, #9e9eb2);\n background-color: color-mix(in srgb, var(--zl-color-text-primary-white, #f4f4f6) 10%, transparent);\n}\n\n:host([data-state=\"focused\"]:not([disabled])) .zr-field:not(.zr-field--invalid):not(.zr-field--success) .zr-field__wrap {\n border-color: var(--zl-color-border-default-white, #f4f4f6);\n}\n\n:host([data-state=\"focused\"]:not([disabled])) .zr-field--invalid .zr-field__wrap {\n border-color: var(--zl-color-border-error, #ea4f70);\n}\n\n:host([data-state=\"focused\"]:not([disabled])) .zr-field--success .zr-field__wrap {\n border-color: var(--zl-color-border-success, #33a779);\n}\n";
845
+ //#endregion
846
+ //#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-gray-500, #9e9eb2);\n background-color: color-mix(in srgb, var(--zl-color-text-primary-white, #f4f4f6) 10%, transparent);\n}\n\n.zr-field:not(.zr-field--invalid):not(.zr-field--disabled):not(.zr-field--success) .zr-field__wrap:has(.zr-field__input:not(:placeholder-shown)):not(:focus-within) {\n border-color: var(--zl-color-border-default-gray-400, #82829c);\n}\n\n.zr-field:not(.zr-field--invalid):not(.zr-field--disabled):not(.zr-field--success) .zr-field__wrap:focus-within {\n border-color: var(--zl-color-border-default-white, #f4f4f6);\n outline: none;\n}\n\n.zr-field--invalid .zr-field__wrap {\n border-color: var(--zl-color-border-error, #ea4f70);\n}\n\n.zr-field--invalid .zr-field__wrap:focus-within {\n border-color: var(--zl-color-border-error, #ea4f70);\n outline: none;\n}\n\n.zr-field--success .zr-field__wrap {\n border-color: var(--zl-color-border-success, #33a779);\n}\n\n.zr-field--success .zr-field__wrap:focus-within {\n border-color: var(--zl-color-border-success, #33a779);\n outline: none;\n}\n\n.zr-field--disabled .zr-field__wrap {\n border-color: var(--zl-color-border-default-gray-200, #484a57);\n}\n\n.zr-field__input {\n min-width: 0;\n height: 100%;\n color: var(--zl-color-text-primary-white, #f4f4f6);\n background: none;\n border: 0;\n outline: none;\n flex: auto;\n padding: 0;\n font-family: inherit;\n font-size: .875rem;\n font-weight: 400;\n line-height: 1.25rem;\n}\n\n.zr-field__input[type=\"password\"] {\n letter-spacing: .125rem;\n}\n\n.zr-field__input::placeholder {\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n}\n\n.zr-field__input:focus, .zr-field__input:focus-visible {\n outline: none;\n}\n\n.zr-field__input:disabled {\n cursor: not-allowed;\n color: var(--zl-color-text-disabled, #686883);\n}\n\n.zr-field--disabled .zr-field__wrap:hover {\n border-color: var(--zl-color-border-default-gray-200, #484a57);\n background-color: #0000;\n}\n\n.zr-field__trailing {\n width: 1rem;\n height: 1rem;\n color: var(--zl-color-text-secondary-gray, #bfbfcf);\n justify-content: center;\n align-items: center;\n display: inline-flex;\n position: absolute;\n top: 50%;\n right: .9375rem;\n transform: translateY(-50%);\n}\n\n.zr-field__trailing-action {\n color: inherit;\n cursor: pointer;\n background: none;\n border: 0;\n justify-content: center;\n align-items: center;\n margin: 0;\n padding: 0;\n line-height: 0;\n display: inline-flex;\n}\n\n.zr-field__trailing-action:focus-visible {\n outline: var(--zl-focus-width, 2px) solid var(--zl-focus-color, #f4f4f6);\n outline-offset: var(--zl-focus-offset, 2px);\n border-radius: 2px;\n}\n\n.zr-field__trailing-action:disabled {\n cursor: not-allowed;\n}\n\n.zr-field--invalid .zr-field__trailing {\n color: var(--zl-color-text-error, #ea4f70);\n}\n\n.zr-field--success .zr-field__trailing {\n color: var(--zl-color-text-success, #33a779);\n}\n\n.zr-field__help {\n color: var(--zl-color-text-primary-white, #f4f4f6);\n font-size: .75rem;\n line-height: 1rem;\n}\n\n.zr-field__success {\n color: var(--zl-color-text-success, #33a779);\n font-size: .75rem;\n line-height: 1rem;\n}\n\n.zr-field__error {\n color: var(--zl-color-text-error, #ea4f70);\n font-size: .75rem;\n line-height: 1rem;\n}\n";
848
+ //#endregion
639
849
  //#region src/atoms/zl-field.ts
640
850
  let ZlField = class ZlField extends LitElement {
641
851
  static formAssociated = true;
@@ -1076,7 +1286,7 @@ const zlFieldManifest = {
1076
1286
  var page_shell_host_default = ":host {\n background: var(--zl-color-surface-default-black, #0f0f11);\n min-height: 100vh;\n color: var(--zl-color-text-primary-white, #f4f4f6);\n display: block;\n}\n\n:host([data-embedded]) {\n height: 100%;\n min-height: 100%;\n}\n\n:host([data-embedded]) .zr-page-shell {\n min-height: 100%;\n}\n\n.zr-page-shell ::slotted([slot=\"header\"]), .zr-page-shell ::slotted([slot=\"footer\"]) {\n margin: 0;\n}\n";
1077
1287
  //#endregion
1078
1288
  //#region ../shared-component-styles/src/page-shell.css?inline
1079
- var page_shell_default = ".zr-page-shell {\n background: var(--zl-color-surface-default-black, #0f0f11);\n min-height: 100vh;\n color: var(--zl-color-text-primary-white, #f4f4f6);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n justify-content: center;\n align-items: center;\n gap: var(--zl-spacing-04, 1.5rem);\n padding-block: var(--zl-spacing-05, 2rem);\n padding-inline: var(--zl-spacing-03, 1rem);\n box-sizing: border-box;\n flex-direction: column;\n display: flex;\n}\n\n@media (width >= 48rem) {\n .zr-page-shell {\n padding-block: 3.25rem;\n padding-inline: var(--zl-spacing-03, 1rem);\n }\n}\n\n.zr-page-shell__header, .zr-page-shell__main, .zr-page-shell__footer {\n justify-content: center;\n align-items: center;\n width: 100%;\n display: flex;\n}\n\n.zr-page-shell__main {\n flex: none;\n}\n\n.zr-page-shell__footer {\n min-height: 1.5rem;\n}\n\n.zr-page-shell__region--empty {\n display: none;\n}\n\n.zr-page-shell[data-embedded] {\n height: 100%;\n min-height: 100%;\n}\n";
1289
+ var page_shell_default = ".zr-page-shell {\n background: var(--zl-color-surface-default-black, #0f0f11);\n min-height: 100vh;\n color: var(--zl-color-text-primary-white, #f4f4f6);\n font-family: var(--zl-font-family-sans, system-ui, sans-serif);\n justify-content: center;\n align-items: center;\n gap: var(--zl-spacing-04, 1.5rem);\n padding-block: var(--zl-spacing-05, 2rem);\n padding-inline: var(--zl-spacing-03, 1rem);\n box-sizing: border-box;\n flex-direction: column;\n 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";
1080
1290
  //#endregion
1081
1291
  //#region src/atoms/zl-page-shell.ts
1082
1292
  let ZlPageShell = class ZlPageShell extends LitElement {
@@ -1459,6 +1669,402 @@ const zlPillManifest = {
1459
1669
  events: []
1460
1670
  };
1461
1671
  //#endregion
1462
- export { __decorate as _, ZlPageShell as a, t as b, zlFieldManifest as c, ZlButton as d, zlButtonManifest as f, zlIconManifest as g, ZlIcon as h, zlPasskeyManifest as i, ZlCard as l, zlAlertManifest as m, zlPillManifest as n, zlPageShellManifest as o, ZlAlert as p, ZlPasskey as r, ZlField as s, ZlPill as t, zlCardManifest as u, focusVisibleStyles as v, emit as x, baseHostStyles as y };
1672
+ //#region ../shared-component-styles/src/lit/select-host.css?inline
1673
+ var select_host_default = ":host {\n display: block;\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n";
1674
+ //#endregion
1675
+ //#region ../shared-component-styles/src/select.css?inline
1676
+ 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-gray-500, #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__trigger:focus-visible, .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__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([aria-disabled=\"true\"]):hover, .zr-select__option[data-active=\"true\"]:not([aria-disabled=\"true\"]) {\n background-color: color-mix(in srgb, var(--zl-color-text-primary-white, #f4f4f6) 10%, transparent);\n}\n\n.zr-select__option[aria-selected=\"true\"] {\n background-color: var(--zl-color-surface-default-primary-gray, #252528);\n}\n\n.zr-select__option[aria-selected=\"true\"] .zr-select__option-check {\n opacity: 1;\n}\n\n.zr-select__option[aria-disabled=\"true\"] {\n color: var(--zl-color-text-disabled, #686883);\n cursor: not-allowed;\n}\n";
1677
+ //#endregion
1678
+ //#region src/atoms/zl-select.ts
1679
+ let ZlSelect = class ZlSelect extends LitElement {
1680
+ static formAssociated = true;
1681
+ static shadowRootOptions = {
1682
+ ...LitElement.shadowRootOptions,
1683
+ delegatesFocus: true
1684
+ };
1685
+ static styles = [baseHostStyles, ...surfaceStyles(select_host_default, select_default)];
1686
+ /**
1687
+ * Field name — used as the key in form submission and in `zl-change` detail.
1688
+ * Managed manually to avoid clobbering the native form-associated `name`
1689
+ * accessor the browser owns (see `<zl-field>` / `<zl-checkbox>`).
1690
+ */
1691
+ get name() {
1692
+ return this.getAttribute("name") ?? "";
1693
+ }
1694
+ set name(value) {
1695
+ this.setAttribute("name", value);
1696
+ }
1697
+ #_label_accessor_storage = "";
1698
+ get label() {
1699
+ return this.#_label_accessor_storage;
1700
+ }
1701
+ set label(value) {
1702
+ this.#_label_accessor_storage = value;
1703
+ }
1704
+ #_value_accessor_storage = "";
1705
+ get value() {
1706
+ return this.#_value_accessor_storage;
1707
+ }
1708
+ set value(value) {
1709
+ this.#_value_accessor_storage = value;
1710
+ }
1711
+ #_placeholder_accessor_storage = "Select…";
1712
+ get placeholder() {
1713
+ return this.#_placeholder_accessor_storage;
1714
+ }
1715
+ set placeholder(value) {
1716
+ this.#_placeholder_accessor_storage = value;
1717
+ }
1718
+ #_options_accessor_storage = [];
1719
+ get options() {
1720
+ return this.#_options_accessor_storage;
1721
+ }
1722
+ set options(value) {
1723
+ this.#_options_accessor_storage = value;
1724
+ }
1725
+ #_required_accessor_storage = false;
1726
+ get required() {
1727
+ return this.#_required_accessor_storage;
1728
+ }
1729
+ set required(value) {
1730
+ this.#_required_accessor_storage = value;
1731
+ }
1732
+ #_disabled_accessor_storage = false;
1733
+ get disabled() {
1734
+ return this.#_disabled_accessor_storage;
1735
+ }
1736
+ set disabled(value) {
1737
+ this.#_disabled_accessor_storage = value;
1738
+ }
1739
+ #_open_accessor_storage = false;
1740
+ get open() {
1741
+ return this.#_open_accessor_storage;
1742
+ }
1743
+ set open(value) {
1744
+ this.#_open_accessor_storage = value;
1745
+ }
1746
+ #_ariaLabelText_accessor_storage = void 0;
1747
+ get ariaLabelText() {
1748
+ return this.#_ariaLabelText_accessor_storage;
1749
+ }
1750
+ set ariaLabelText(value) {
1751
+ this.#_ariaLabelText_accessor_storage = value;
1752
+ }
1753
+ #_testId_accessor_storage = void 0;
1754
+ get testId() {
1755
+ return this.#_testId_accessor_storage;
1756
+ }
1757
+ set testId(value) {
1758
+ this.#_testId_accessor_storage = value;
1759
+ }
1760
+ #_activeIndex_accessor_storage = -1;
1761
+ get activeIndex() {
1762
+ return this.#_activeIndex_accessor_storage;
1763
+ }
1764
+ set activeIndex(value) {
1765
+ this.#_activeIndex_accessor_storage = value;
1766
+ }
1767
+ #_triggerEl_accessor_storage = null;
1768
+ get triggerEl() {
1769
+ return this.#_triggerEl_accessor_storage;
1770
+ }
1771
+ set triggerEl(value) {
1772
+ this.#_triggerEl_accessor_storage = value;
1773
+ }
1774
+ baseId = nextUid("zl-select");
1775
+ internals;
1776
+ defaultValue = "";
1777
+ constructor() {
1778
+ super();
1779
+ this.internals = this.attachInternals();
1780
+ }
1781
+ connectedCallback() {
1782
+ super.connectedCallback();
1783
+ this.defaultValue = this.getAttribute("value") ?? "";
1784
+ this.syncFormState();
1785
+ document.addEventListener("pointerdown", this.handleDocumentPointerDown, true);
1786
+ }
1787
+ disconnectedCallback() {
1788
+ super.disconnectedCallback();
1789
+ document.removeEventListener("pointerdown", this.handleDocumentPointerDown, true);
1790
+ }
1791
+ willUpdate(changed) {
1792
+ if (changed.has("value") || changed.has("required")) this.syncFormState();
1793
+ if (changed.has("disabled") && this.disabled) this.open = false;
1794
+ }
1795
+ formResetCallback() {
1796
+ this.value = this.defaultValue;
1797
+ this.open = false;
1798
+ }
1799
+ formStateRestoreCallback(state) {
1800
+ this.value = state ?? "";
1801
+ }
1802
+ focus(options) {
1803
+ this.triggerEl?.focus(options);
1804
+ }
1805
+ render() {
1806
+ const labelId = `${this.baseId}-label`;
1807
+ const listboxId = `${this.baseId}-listbox`;
1808
+ const selected = this.options.find((option) => option.value === this.value);
1809
+ return html`
1810
+ <div class=${classMap({
1811
+ "zr-select": true,
1812
+ "zr-select--open": this.open,
1813
+ "zr-select--disabled": this.disabled
1814
+ })} part="root">
1815
+ ${this.renderLabel(labelId)}
1816
+ <div class="zr-select__field" part="field">
1817
+ <button
1818
+ type="button"
1819
+ class="zr-select__trigger"
1820
+ part="trigger"
1821
+ id=${`${this.baseId}-trigger`}
1822
+ role="combobox"
1823
+ aria-haspopup="listbox"
1824
+ aria-expanded=${this.open ? "true" : "false"}
1825
+ aria-controls=${listboxId}
1826
+ aria-labelledby=${this.label ? labelId : nothing}
1827
+ aria-label=${ifDefined(this.label ? void 0 : this.ariaLabelText)}
1828
+ aria-activedescendant=${this.open && this.activeIndex >= 0 ? this.optionId(this.activeIndex) : nothing}
1829
+ data-testid=${ifDefined(this.triggerTestId())}
1830
+ ?disabled=${this.disabled}
1831
+ @click=${this.handleTriggerClick}
1832
+ @keydown=${this.handleTriggerKeyDown}
1833
+ >
1834
+ <span
1835
+ class=${classMap({
1836
+ "zr-select__value": true,
1837
+ "zr-select__value--placeholder": !selected
1838
+ })}
1839
+ >
1840
+ ${selected ? selected.label : this.placeholder}
1841
+ </span>
1842
+ <zl-icon class="zr-select__icon" name="chevron-down" size="16" decorative></zl-icon>
1843
+ </button>
1844
+ <ul
1845
+ class="zr-select__listbox"
1846
+ part="listbox"
1847
+ id=${listboxId}
1848
+ role="listbox"
1849
+ tabindex="-1"
1850
+ aria-labelledby=${this.label ? labelId : nothing}
1851
+ ?hidden=${!this.open}
1852
+ >
1853
+ ${this.options.map((option, index) => this.renderOption(option, index))}
1854
+ </ul>
1855
+ </div>
1856
+ </div>
1857
+ `;
1858
+ }
1859
+ renderLabel(labelId) {
1860
+ if (!this.label) return null;
1861
+ return html`
1862
+ <label class="zr-select__label" part="label" id=${labelId} @click=${this.handleLabelClick}>
1863
+ <span>${this.label}</span>
1864
+ ${this.required ? html`<span class="zr-select__required" aria-hidden="true">*</span>` : null}
1865
+ </label>
1866
+ `;
1867
+ }
1868
+ renderOption(option, index) {
1869
+ const isSelected = option.value === this.value;
1870
+ return html`
1871
+ <li
1872
+ class="zr-select__option"
1873
+ part="option"
1874
+ id=${this.optionId(index)}
1875
+ role="option"
1876
+ aria-selected=${isSelected ? "true" : "false"}
1877
+ aria-disabled=${option.disabled ? "true" : nothing}
1878
+ data-active=${this.open && index === this.activeIndex ? "true" : nothing}
1879
+ data-value=${option.value}
1880
+ @click=${() => this.handleOptionClick(index)}
1881
+ @pointermove=${() => this.handleOptionPointerMove(index)}
1882
+ >
1883
+ <span class="zr-select__option-label">${option.label}</span>
1884
+ <zl-icon class="zr-select__option-check" name="check" size="16" decorative></zl-icon>
1885
+ </li>
1886
+ `;
1887
+ }
1888
+ optionId(index) {
1889
+ return `${this.baseId}-option-${index}`;
1890
+ }
1891
+ handleLabelClick = () => {
1892
+ if (!this.disabled) this.triggerEl?.focus();
1893
+ };
1894
+ handleTriggerClick = () => {
1895
+ if (this.disabled) return;
1896
+ if (this.open) this.close();
1897
+ else this.openMenu();
1898
+ };
1899
+ handleTriggerKeyDown = (event) => {
1900
+ if (this.disabled) return;
1901
+ switch (event.key) {
1902
+ case "ArrowDown":
1903
+ case "ArrowUp":
1904
+ event.preventDefault();
1905
+ if (!this.open) this.openMenu();
1906
+ else this.moveActive(event.key === "ArrowDown" ? 1 : -1);
1907
+ break;
1908
+ case "Home":
1909
+ if (this.open) {
1910
+ event.preventDefault();
1911
+ this.setActive(this.firstEnabledIndex());
1912
+ }
1913
+ break;
1914
+ case "End":
1915
+ if (this.open) {
1916
+ event.preventDefault();
1917
+ this.setActive(this.lastEnabledIndex());
1918
+ }
1919
+ break;
1920
+ case "Enter":
1921
+ case " ":
1922
+ event.preventDefault();
1923
+ if (this.open) this.commitActive();
1924
+ else this.openMenu();
1925
+ break;
1926
+ case "Escape":
1927
+ if (this.open) {
1928
+ event.preventDefault();
1929
+ this.close();
1930
+ }
1931
+ break;
1932
+ case "Tab":
1933
+ if (this.open) this.close();
1934
+ break;
1935
+ default: break;
1936
+ }
1937
+ };
1938
+ handleOptionClick(index) {
1939
+ if (this.options[index]?.disabled) return;
1940
+ this.setActive(index);
1941
+ this.commitActive();
1942
+ }
1943
+ handleOptionPointerMove(index) {
1944
+ if (!this.options[index]?.disabled && index !== this.activeIndex) this.activeIndex = index;
1945
+ }
1946
+ handleDocumentPointerDown = (event) => {
1947
+ if (this.open && !event.composedPath().includes(this)) this.close();
1948
+ };
1949
+ openMenu() {
1950
+ if (this.options.length === 0) return;
1951
+ this.open = true;
1952
+ const selectedIndex = this.options.findIndex((option) => option.value === this.value);
1953
+ this.activeIndex = selectedIndex >= 0 ? selectedIndex : this.firstEnabledIndex();
1954
+ }
1955
+ close() {
1956
+ if (!this.open) return;
1957
+ this.open = false;
1958
+ this.activeIndex = -1;
1959
+ this.triggerEl?.focus();
1960
+ }
1961
+ commitActive() {
1962
+ const option = this.options[this.activeIndex];
1963
+ if (!option || option.disabled) return;
1964
+ const changed = option.value !== this.value;
1965
+ this.value = option.value;
1966
+ this.open = false;
1967
+ this.activeIndex = -1;
1968
+ this.triggerEl?.focus();
1969
+ this.syncFormState();
1970
+ if (changed) {
1971
+ emit(this, "zl-change", {
1972
+ name: this.name,
1973
+ value: this.value
1974
+ });
1975
+ this.dispatchEvent(new Event("change", {
1976
+ bubbles: true,
1977
+ composed: true
1978
+ }));
1979
+ }
1980
+ }
1981
+ moveActive(delta) {
1982
+ const count = this.options.length;
1983
+ if (count === 0) return;
1984
+ let next = this.activeIndex;
1985
+ for (let step = 0; step < count; step += 1) {
1986
+ next = (next + delta + count) % count;
1987
+ if (!this.options[next]?.disabled) {
1988
+ this.setActive(next);
1989
+ return;
1990
+ }
1991
+ }
1992
+ }
1993
+ setActive(index) {
1994
+ if (index >= 0 && index < this.options.length) this.activeIndex = index;
1995
+ }
1996
+ firstEnabledIndex() {
1997
+ return this.options.findIndex((option) => !option.disabled);
1998
+ }
1999
+ lastEnabledIndex() {
2000
+ for (let index = this.options.length - 1; index >= 0; index -= 1) if (!this.options[index]?.disabled) return index;
2001
+ return -1;
2002
+ }
2003
+ syncFormState() {
2004
+ this.internals.setFormValue?.(this.value || null);
2005
+ if (this.required && !this.value) this.internals.setValidity?.({ valueMissing: true }, "Please select an item in the list.", this.triggerEl ?? void 0);
2006
+ else this.internals.setValidity?.({});
2007
+ }
2008
+ triggerTestId() {
2009
+ if (this.name) return `zitadel-select-${this.name}`;
2010
+ if (this.testId) return `${this.testId}-trigger`;
2011
+ }
2012
+ };
2013
+ __decorate([property()], ZlSelect.prototype, "label", null);
2014
+ __decorate([property()], ZlSelect.prototype, "value", null);
2015
+ __decorate([property()], ZlSelect.prototype, "placeholder", null);
2016
+ __decorate([property({
2017
+ attribute: "options",
2018
+ converter: { fromAttribute(value) {
2019
+ if (!value) return [];
2020
+ try {
2021
+ const parsed = JSON.parse(value);
2022
+ return Array.isArray(parsed) ? parsed : [];
2023
+ } catch {
2024
+ return [];
2025
+ }
2026
+ } }
2027
+ })], ZlSelect.prototype, "options", null);
2028
+ __decorate([property({ type: Boolean })], ZlSelect.prototype, "required", null);
2029
+ __decorate([property({
2030
+ type: Boolean,
2031
+ reflect: true
2032
+ })], ZlSelect.prototype, "disabled", null);
2033
+ __decorate([property({
2034
+ type: Boolean,
2035
+ reflect: true
2036
+ })], ZlSelect.prototype, "open", null);
2037
+ __decorate([property({ attribute: "aria-label" })], ZlSelect.prototype, "ariaLabelText", null);
2038
+ __decorate([property({ attribute: "data-testid" })], ZlSelect.prototype, "testId", null);
2039
+ __decorate([state()], ZlSelect.prototype, "activeIndex", null);
2040
+ __decorate([query(".zr-select__trigger")], ZlSelect.prototype, "triggerEl", null);
2041
+ ZlSelect = __decorate([customElement("zl-select")], ZlSelect);
2042
+ const zlSelectManifest = {
2043
+ tag: "zl-select",
2044
+ attrs: [
2045
+ "name",
2046
+ "label",
2047
+ "value",
2048
+ "placeholder",
2049
+ "options",
2050
+ "required",
2051
+ "disabled",
2052
+ "open",
2053
+ "aria-label",
2054
+ "data-testid"
2055
+ ],
2056
+ parts: [
2057
+ "root",
2058
+ "label",
2059
+ "field",
2060
+ "trigger",
2061
+ "listbox",
2062
+ "option"
2063
+ ],
2064
+ slots: [],
2065
+ events: ["zl-change"]
2066
+ };
2067
+ //#endregion
2068
+ export { baseHostStyles as C, focusVisibleStyles as S, emit as T, ZlAlert as _, ZlPasskey as a, zlIconManifest as b, zlPageShellManifest as c, ZlCheckbox as d, zlCheckboxManifest as f, zlButtonManifest as g, ZlButton as h, zlPillManifest as i, ZlField as l, zlCardManifest as m, zlSelectManifest as n, zlPasskeyManifest as o, ZlCard as p, ZlPill as r, ZlPageShell as s, ZlSelect as t, zlFieldManifest as u, zlAlertManifest as v, t as w, __decorate as x, ZlIcon as y };
1463
2069
 
1464
- //# sourceMappingURL=atoms-BHSt5lSe.mjs.map
2070
+ //# sourceMappingURL=atoms-BSwVl736.mjs.map