@proximus/lavender-checkbox 2.0.0-alpha.23 → 2.0.0-alpha.231

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/dist/index.es.js CHANGED
@@ -1,159 +1,134 @@
1
- import { PxElement as c, log as d } from "@proximus/lavender-common";
2
- const h = `:host{display:block}input{font-size:var(--px-font-size-base)}.checkbox{display:flex;flex-direction:column;gap:var(--px-spacing-xs-mobile);font-family:var(--px-font-family);line-height:var(--px-line-height-ratio-l);font-weight:var(--px-font-weight-body)}.checkbox ::slotted([slot="error-text"]){font-size:var(--px-text-size-body-m-mobile);color:var(--px-color-text-purpose-error-default)}.checkbox #checkbox-container{display:flex;align-items:flex-start;gap:var(--px-spacing-s-mobile)}.all-slots-empty :is(.checkbox #checkbox-container){gap:0}.checkbox label{line-height:calc(var(--px-line-height-ratio-l) * 1em);color:var(--px-color-text-neutral-default)}:host(:not([variant="selectable-tag"])) input{-webkit-appearance:none;-moz-appearance:none;appearance:none;margin:0;border-radius:var(--px-radius-main);border:var(--px-size-border-m) solid var(--px-color-border-neutral-default);width:var(--px-size-icon-m);height:var(--px-size-icon-m);flex-shrink:0;transition:box-shadow .3s ease-out,background-color .3s;animation:anim-pop .2s cubic-bezier(.9,-.13,.61,.99) forwards .1s}:host(:not([variant="selectable-tag"])) input:focus-visible{outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default);outline-offset:var(--px-focus-offset-mobile)}:host([checked]) :is(:host(:not([variant="selectable-tag"])) input){background-color:var(--px-color-background-container-primary-default);border-color:var(--px-color-border-none-default);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.6726 10.0557L11.1723 16.1192C10.9368 16.3298 10.6319 16.4463 10.3159 16.4463C9.99992 16.4463 9.69501 16.3298 9.45948 16.1192L6.28215 12.9418C6.08774 12.7087 5.98754 12.4113 6.00124 12.1081C6.01494 11.8048 6.14155 11.5177 6.3562 11.303C6.57084 11.0884 6.85799 10.9618 7.16123 10.9481C7.46447 10.9344 7.76187 11.0346 7.995 11.229L10.333 13.567L15.994 8.29143C16.2319 8.08824 16.5389 7.98454 16.8513 8.00187C17.1636 8.0192 17.4573 8.15625 17.6712 8.38451C17.8851 8.61277 18.0029 8.9147 17.9999 9.22753C17.997 9.54036 17.8736 9.84002 17.6555 10.0642L17.6726 10.0557Z' fill='white'/%3E%3C/svg%3E");background-position:center center;background-repeat:no-repeat}:host(:not([disabled])) :is(:host(:not([variant="selectable-tag"])) input):hover,:host([hover]) :is(:host(:not([disabled])) :is(:host(:not([variant="selectable-tag"])) input)){border:var(--px-size-border-l) solid var(--px-color-border-state-hover-default)}:host([checked]) :is(:host(:not([disabled])) :is(:host(:not([variant="selectable-tag"])) input):hover),:host([checked]) :is(:host([hover]) :is(:host(:not([disabled])) :is(:host(:not([variant="selectable-tag"])) input))){box-shadow:inset 0 0 0 var(--px-size-border-s) var(--px-color-border-state-hover-default),0 0 0 var(--px-size-border-s) var(--px-color-border-state-hover-default)}:host(:not([disabled])) :is(:host(:not([variant="selectable-tag"])) input):hover{cursor:pointer}:host([disabled]) :is(:host(:not([variant="selectable-tag"])) input){background-color:var(--px-color-background-state-disabled-default);border-color:var(--px-color-border-main-default)}:host([checked]) :is(:host([disabled]) :is(:host(:not([variant="selectable-tag"])) input)){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.6726 10.0557L11.1723 16.1192C10.9368 16.3298 10.6319 16.4463 10.3159 16.4463C9.99992 16.4463 9.69501 16.3298 9.45948 16.1192L6.28215 12.9418C6.08774 12.7087 5.98754 12.4113 6.00124 12.1081C6.01494 11.8048 6.14155 11.5177 6.3562 11.303C6.57084 11.0884 6.85799 10.9618 7.16123 10.9481C7.46447 10.9344 7.76187 11.0346 7.995 11.229L10.333 13.567L15.994 8.29143C16.2319 8.08824 16.5389 7.98454 16.8513 8.00187C17.1636 8.0192 17.4573 8.15625 17.6712 8.38451C17.8851 8.61277 18.0029 8.9147 17.9999 9.22753C17.997 9.54036 17.8736 9.84002 17.6555 10.0642L17.6726 10.0557Z' fill='%23000' fill-opacity='0.12'/%3E%3C/svg%3E")}:host([disabled]) :is(:host(:not([variant="selectable-tag"])) input)+label{color:var(--px-color-text-state-disabled-default)}:host([state="error"]:not([disabled])) :is(:host(:not([variant="selectable-tag"])) input){border-color:var(--px-color-border-purpose-error-default)}:host([checked]) :is(:host([state="error"]:not([disabled])) :is(:host(:not([variant="selectable-tag"])) input)){background-color:var(--px-color-background-purpose-error-default)}:host([checked]) :is(:host([state="error"]:not([disabled])) :is(:host(:not([variant="selectable-tag"])) input)):hover,:host([hover]) :is(:host([checked]) :is(:host([state="error"]:not([disabled])) :is(:host(:not([variant="selectable-tag"])) input))){background-color:var(--px-color-background-purpose-error-default);border-color:var(--px-color-border-purpose-error-default);box-shadow:inset 0 0 0 var(--px-size-border-s) var(--px-color-border-purpose-error-default),0 0 0 var(--px-size-border-s) var(--px-color-border-purpose-error-default)}:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input){border-color:var(--px-color-border-neutral-inverted)}:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input):focus-visible{outline-color:var(--px-color-border-focus-outline-inverted)}:host([checked]) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input)){background-color:var(--px-color-background-container-primary-inverted);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.6726 10.0557L11.1723 16.1192C10.9368 16.3298 10.6319 16.4463 10.3159 16.4463C9.99992 16.4463 9.69501 16.3298 9.45948 16.1192L6.28215 12.9418C6.08774 12.7087 5.98754 12.4113 6.00124 12.1081C6.01494 11.8048 6.14155 11.5177 6.3562 11.303C6.57084 11.0884 6.85799 10.9618 7.16123 10.9481C7.46447 10.9344 7.76187 11.0346 7.995 11.229L10.333 13.567L15.994 8.29143C16.2319 8.08824 16.5389 7.98454 16.8513 8.00187C17.1636 8.0192 17.4573 8.15625 17.6712 8.38451C17.8851 8.61277 18.0029 8.9147 17.9999 9.22753C17.997 9.54036 17.8736 9.84002 17.6555 10.0642L17.6726 10.0557Z' fill='%235C2D91'/%3E%3C/svg%3E")}:host(:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input)):hover,:host([hover]) :is(:host(:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input))){border-color:var(--px-color-border-state-hover-inverted)}:host([checked]) :is(:host(:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input)):hover),:host([checked]) :is(:host([hover]) :is(:host(:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input)))){box-shadow:inset 0 0 0 var(--px-size-border-s) var(--px-color-border-state-hover-inverted),0 0 0 var(--px-size-border-s) var(--px-color-border-state-hover-inverted)}:host([disabled]) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input)){background-color:var(--px-color-background-state-disabled-inverted);border-color:var(--px-color-border-main-inverted)}:host([checked]) :is(:host([disabled]) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input))){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.6726 10.0557L11.1723 16.1192C10.9368 16.3298 10.6319 16.4463 10.3159 16.4463C9.99992 16.4463 9.69501 16.3298 9.45948 16.1192L6.28215 12.9418C6.08774 12.7087 5.98754 12.4113 6.00124 12.1081C6.01494 11.8048 6.14155 11.5177 6.3562 11.303C6.57084 11.0884 6.85799 10.9618 7.16123 10.9481C7.46447 10.9344 7.76187 11.0346 7.995 11.229L10.333 13.567L15.994 8.29143C16.2319 8.08824 16.5389 7.98454 16.8513 8.00187C17.1636 8.0192 17.4573 8.15625 17.6712 8.38451C17.8851 8.61277 18.0029 8.9147 17.9999 9.22753C17.997 9.54036 17.8736 9.84002 17.6555 10.0642L17.6726 10.0557Z' fill='white' fill-opacity='0.08'/%3E%3C/svg%3E")}:host([disabled]) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input))+label{color:var(--px-color-text-state-disabled-inverted)}:host([state="error"]:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input)){border-color:var(--px-color-border-purpose-error-inverted)}:host([checked]) :is(:host([state="error"]:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input))){background-color:var(--px-color-background-purpose-error-inverted);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.6726 10.0557L11.1723 16.1192C10.9368 16.3298 10.6319 16.4463 10.3159 16.4463C9.99992 16.4463 9.69501 16.3298 9.45948 16.1192L6.28215 12.9418C6.08774 12.7087 5.98754 12.4113 6.00124 12.1081C6.01494 11.8048 6.14155 11.5177 6.3562 11.303C6.57084 11.0884 6.85799 10.9618 7.16123 10.9481C7.46447 10.9344 7.76187 11.0346 7.995 11.229L10.333 13.567L15.994 8.29143C16.2319 8.08824 16.5389 7.98454 16.8513 8.00187C17.1636 8.0192 17.4573 8.15625 17.6712 8.38451C17.8851 8.61277 18.0029 8.9147 17.9999 9.22753C17.997 9.54036 17.8736 9.84002 17.6555 10.0642L17.6726 10.0557Z' fill='white'/%3E%3C/svg%3E")}:host([checked]) :is(:host([state="error"]:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input))):hover,:host([hover]) :is(:host([checked]) :is(:host([state="error"]:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input)))){background-color:var(--px-color-background-purpose-error-inverted);border-color:var(--px-color-border-purpose-error-inverted);box-shadow:inset 0 0 0 var(--px-size-border-s) var(--px-color-border-purpose-error-inverted),0 0 0 var(--px-size-border-s) var(--px-color-border-purpose-error-inverted)}:host([inverted]) :is(:host(:not([variant="selectable-tag"])) input)+label{color:var(--px-color-text-neutral-inverted)}:host([indeterminate][checked]) :is(:host(:not([variant="selectable-tag"])) input){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8558_6622)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='white'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8558_6622'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E")}:host([disabled]) :is(:host([indeterminate][checked]) :is(:host(:not([variant="selectable-tag"])) input)){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8685_408)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='black' fill-opacity='0.12'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8685_408'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E")}:host([inverted]) :is(:host([indeterminate][checked]) :is(:host(:not([variant="selectable-tag"])) input)){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8685_6804)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='%235C2D91'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8685_6804'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E")}:host([disabled]) :is(:host([inverted]) :is(:host([indeterminate][checked]) :is(:host(:not([variant="selectable-tag"])) input))){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8685_6817)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='white' fill-opacity='0.08'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8685_6817'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E")}:host([state="error"]) :is(:host([inverted]) :is(:host([indeterminate][checked]) :is(:host(:not([variant="selectable-tag"])) input))){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8685_6256)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='white'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8685_6256'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E")}:host([state="error"]) :is(:host([inverted]) :is(:host([indeterminate][checked]) :is(:host(:not([variant="selectable-tag"])) input))):hover,:host([hover]) :is(:host([state="error"]) :is(:host([inverted]) :is(:host([indeterminate][checked]) :is(:host(:not([variant="selectable-tag"])) input)))){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8685_6804)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='white'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8685_6804'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E")}.checkbox.selectable-tag,.checkbox.selectable-tag #checkbox-container{gap:0}:host([variant="selectable-tag"]){display:inline-flex}:host([variant="selectable-tag"]) label{line-height:var(--px-line-height-ratio-l);display:inline-flex;vertical-align:middle;align-items:center;justify-content:center;gap:var(--px-spacing-xs-mobile);background-color:var(--px-color-background-container-default-inverted);color:var(--px-color-text-neutral-default);padding:var(--px-padding-2xs-mobile) var(--px-padding-xs-mobile);border:var(--px-size-border-m) solid var(--px-color-border-neutral-default);border-radius:var(--px-radius-pill);transition:all .2s ease-in-out 0s}:host([variant="selectable-tag"]) input{-webkit-appearance:none;-moz-appearance:none;appearance:none;margin:0}:host([variant="selectable-tag"]) input:focus-visible+label{outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default);outline-offset:var(--px-focus-offset-mobile)}:host([variant="selectable-tag"]) input:hover:not([disabled],[aria-disabled=true],.loading)+label,:host([variant="selectable-tag"]) input.hover:not([disabled],[aria-disabled=true],.loading)+label{color:var(--px-color-text-brand-default);background:var(--px-color-background-state-hover-bordered-default);border-color:var(--px-color-border-state-hover-default);cursor:pointer}:host([variant="selectable-tag"]) input:active:not([disabled],[aria-disabled=true],.loading)+label{background:var(--px-color-background-state-active-default);color:var(--px-color-text-state-active-inverted);border-color:var(--px-color-border-none-default)}:host([variant="selectable-tag"]) input:checked+label,:host([variant="selectable-tag"]) input:checked+label:hover{background-color:var(--px-color-background-state-active-default);border-color:var(--px-color-border-none-default);color:var(--px-color-text-state-active-inverted)}:host([variant="selectable-tag"]) input[disabled]+label{background:var(--px-color-background-state-disabled-default);color:var(--px-color-text-state-disabled-default);border-color:var(--px-color-border-none-default)}:host([variant="selectable-tag"]):host([inverted]) label{background:var(--px-color-background-container-default-default);color:var(--px-color-text-brand-inverted);border-color:var(--px-color-border-neutral-inverted)}:host([variant="selectable-tag"]):host([inverted]) input:hover:not([disabled],[aria-disabled=true])+label,:host([variant="selectable-tag"]):host([inverted]) input.hover:not([disabled],[aria-disabled=true])+label{color:var(--px-color-text-brand-inverted);background:var(--px-color-background-state-hover-bordered-inverted);border-color:var(--px-color-border-state-hover-inverted)}:host([variant="selectable-tag"]):host([inverted]) input:active:not([disabled],[aria-disabled=true])+label{background:var(--px-color-background-state-active-inverted);color:var(--px-color-text-state-active-default);border-color:var(--px-color-border-none-inverted)}:host([variant="selectable-tag"]):host([inverted]) input:checked+label,:host([variant="selectable-tag"]):host([inverted]) input:checked+label:hover{background-color:var(--px-color-background-state-active-inverted);border-color:var(--px-color-border-none-inverted);color:var(--px-color-text-state-active-default)}:host([variant="selectable-tag"]):host([inverted]) input[disabled]+label{background:var(--px-color-background-state-disabled-inverted);color:var(--px-color-text-state-disabled-inverted);border-color:var(--px-color-border-none-inverted)}:host([variant="selectable-tag"]):host([inverted]) input:focus-visible+label{outline-color:var(--px-color-border-focus-outline-inverted)}@media only screen and (min-width: 48em){.checkbox{gap:var(--px-spacing-xs-tablet)}.checkbox ::slotted([slot="error-text"]){font-size:var(--px-text-size-body-m-tablet)}#checkbox-container{gap:var(--px-spacing-s-tablet)}:host(:not([variant="selectable-tag"])) input:focus-visible,:host([variant="selectable-tag"]) input:focus-visible+label{outline-width:var(--px-focus-outline-tablet);outline-offset:var(--px-focus-offset-tablet)}label{font-size:var(--px-text-size-label-m-tablet)}}@media only screen and (min-width: 64.0625em){.checkbox{gap:var(--px-spacing-xs-laptop)}.checkbox ::slotted([slot="error-text"]){font-size:var(--px-text-size-body-m-laptop)}#checkbox-container{gap:var(--px-spacing-s-laptop)}:host(:not([variant="selectable-tag"])) input:focus-visible,:host([variant="selectable-tag"]) input:focus-visible+label{outline-width:var(--px-focus-outline-laptop);outline-offset:var(--px-focus-offset-laptop)}label{font-size:var(--px-text-size-label-m-laptop)}}@media only screen and (min-width: 90.0625em){.checkbox{gap:var(--px-spacing-xs-desktop)}.checkbox ::slotted([slot="error-text"]){font-size:var(--px-text-size-body-m-desktop)}#checkbox-container{gap:var(--px-spacing-s-desktop)}:host(:not([variant="selectable-tag"])) input:focus-visible,:host([variant="selectable-tag"]) input:focus-visible+label{outline-width:var(--px-focus-outline-desktop);outline-offset:var(--px-focus-offset-desktop)}label{font-size:var(--px-text-size-label-m-desktop)}}:host([inverted]) .checkbox ::slotted([slot="error-text"]){color:var(--px-color-text-purpose-error-inverted)}@keyframes anim-pop{0%{transform:scale(0)}to{transform:scale(1)}}`, n = new CSSStyleSheet();
3
- n.replaceSync(h);
4
- const b = ["", "default", "selectable-tag"], v = ["", "error"], i = class i extends c {
5
- constructor() {
6
- var e;
7
- super(n), this.template = () => `<div class="checkbox">
8
- <slot name="error-text"></slot>
9
- <div id="checkbox-container">
10
- <input type="checkbox"/>
11
- <label><slot name="before"></slot><slot name="label"></slot></label>
12
- </div>
13
- </div>`, this.shadowRoot.innerHTML = this.template(), this.internals = (e = this.attachInternals) == null ? void 0 : e.call(this);
14
- }
15
- static get observedAttributes() {
16
- return [
17
- ...super.observedAttributes,
18
- "state",
19
- "variant",
20
- "indeterminate",
21
- "inverted",
22
- "hover"
23
- ];
24
- }
25
- connectedCallback() {
26
- this.$el.addEventListener("change", () => {
27
- var t;
28
- const e = new Event("change", {
29
- bubbles: !0,
30
- composed: !0
31
- // Allow the event to pass through shadow DOM boundaries
32
- });
33
- this.dispatchEvent(e), (t = this.internals) == null || t.setFormValue(this.formData()), this.$el.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked");
34
- }), this.setupForId(), this.hasAttribute("checked") && (this.checked = !0), this.$iconSlot && (this.$iconSlot.setAttribute("size", "xs"), this.$iconSlot.setAttribute("color", "inherit")), !this.$labelSlot && !this.$iconSlot && this.$checkbox.classList.add("all-slots-empty"), this.setupAriaDescribedBy(
35
- this.$slotErrorText,
36
- this.$errorTextSlot,
37
- "error-text"
38
- );
39
- }
40
- attributeChangedCallback(e, t, o) {
41
- if (t !== o)
42
- switch (e) {
43
- case "state":
44
- this.updateAttribute(
45
- t,
46
- o,
47
- v,
48
- e
49
- ), this.setupAriaDescribedBy(
50
- this.$slotErrorText,
51
- this.$errorTextSlot,
52
- "error-text"
53
- );
54
- break;
55
- case "variant":
56
- this.updateAttribute(
57
- t,
58
- o,
59
- b,
60
- e
61
- );
62
- break;
63
- case "hover":
64
- this.$el.classList.toggle("hover");
65
- break;
66
- default:
67
- super.attributeChangedCallback(e, t, o);
68
- break;
69
- }
70
- }
71
- updateAttribute(e, t, o, r) {
72
- var s, l;
73
- if (!this.checkName(o, t)) {
74
- d(
75
- `${t} is not an allowed ${r} value for ${this.tagName.toLowerCase()}`
76
- );
77
- return;
78
- }
79
- e !== null && (r === "variant" ? (s = this.$checkbox) == null || s.classList.toggle(e) : this.$el.classList.toggle(e)), t !== null && (r === "variant" ? (l = this.$checkbox) == null || l.classList.toggle(t) : this.$el.classList.toggle(t));
80
- }
81
- formData() {
82
- if (this.$el.name) {
83
- const e = new FormData();
84
- return e.append(this.getAttribute("name"), this.$el.value), e;
85
- }
86
- }
87
- // Form-associated callbacks
88
- static get formAssociated() {
89
- return !0;
90
- }
91
- // Set default behavior when the element is attached to a form
92
- formResetCallback() {
93
- this.checked = !1;
94
- }
95
- formStateRestoreCallback(e) {
96
- this.checked = e;
97
- }
98
- setupForId() {
99
- const e = Math.random().toString(36).substr(2, 9);
100
- this.$el.setAttribute("id", e), this.$label && this.$label.setAttribute("for", e);
101
- }
102
- setupAriaDescribedBy(e, t, o) {
103
- if (e.length > 0 && this.$el.hasAttribute("id")) {
104
- t.setAttribute("id", `${this.$el.id}-${o}`);
105
- let r = this.$el.getAttribute("aria-describedby");
106
- r ? r += ` ${this.$el.id}-${o}` : r = `${this.$el.id}-${o}`, this.$el.setAttribute("aria-describedby", r);
107
- }
108
- }
109
- get $checkbox() {
110
- return this.shadowRoot.querySelector(".checkbox");
111
- }
112
- get $label() {
113
- return this.shadowRoot.querySelector("label");
114
- }
115
- get $labelSlot() {
116
- return this.querySelector('[slot="label"]');
117
- }
118
- get $iconSlot() {
119
- return this.querySelector('px-icon[slot="before"]');
120
- }
121
- get $errorTextSlot() {
122
- return this.shadowRoot.querySelector('slot[name="error-text"]');
123
- }
124
- get $slotErrorText() {
125
- return this.querySelectorAll('[slot="error-text"]');
126
- }
127
- get variant() {
128
- return this.getAttribute("variant");
129
- }
130
- set variant(e) {
131
- this.setAttribute("variant", e);
132
- }
133
- get state() {
134
- return this.getAttribute("state");
135
- }
136
- set state(e) {
137
- this.setAttribute("state", e);
138
- }
139
- get inverted() {
140
- return this.getAttribute("inverted");
141
- }
142
- set inverted(e) {
143
- this.setAttribute("inverted", e);
144
- }
145
- get checked() {
146
- return this.$el.checked;
147
- }
148
- set checked(e) {
149
- this.$el.checked = e, e ? this.setAttribute("checked", "") : this.removeAttribute("checked");
150
- }
151
- };
152
- i.nativeName = "input";
153
- let a = i;
154
- customElements.get("px-checkbox") || customElements.define("px-checkbox", a);
155
- export {
156
- a as Checkbox,
157
- v as checkboxStateValues,
158
- b as checkboxVariantValues
1
+ import { PxElement as e, createTemplate as t, log as n, nativeInputAttributes as r, nativeInputMethods as i, nativeInputProperties as a, omitKeys as o, renderTemplate as s } from "@proximus/lavender-common";
2
+ //#region src/checkbox.css?inline
3
+ var c = ":host{display:block}input{font-size:var(--px-font-size-base)}.checkbox{gap:var(--px-spacing-xs-mobile);font-family:var(--px-font-family);line-height:var(--px-line-height-ratio-l);font-weight:var(--px-font-weight-body);flex-direction:column;display:flex}.checkbox ::slotted([slot=error-text]){font-size:var(--px-text-size-body-m-mobile);color:var(--px-color-text-purpose-error-default)}.checkbox #checkbox-container{align-items:flex-start;gap:var(--px-spacing-s-mobile);display:flex}.all-slots-empty :is(.checkbox #checkbox-container){gap:0}.checkbox label{line-height:calc(var(--px-line-height-ratio-l) * 1rem);color:var(--px-color-text-neutral-default)}:host(:not([variant=selectable-tag])) input{appearance:none;border-radius:var(--px-radius-main);border:var(--px-size-border-m) solid var(--px-color-border-neutral-default);width:var(--px-size-icon-m);height:var(--px-size-icon-m);flex-shrink:0;margin:0;transition:box-shadow .3s ease-out,background-color .3s;animation:.2s cubic-bezier(.9,-.13,.61,.99) .1s forwards anim-pop}:host(:not([variant=selectable-tag])) input:focus-visible{outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default);outline-offset:var(--px-focus-offset-mobile)}:host(:not([variant=selectable-tag])) input:checked{background-color:var(--px-color-background-state-active-default);border-color:var(--px-color-border-none-default);background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.6726 10.0557L11.1723 16.1192C10.9368 16.3298 10.6319 16.4463 10.3159 16.4463C9.99992 16.4463 9.69501 16.3298 9.45948 16.1192L6.28215 12.9418C6.08774 12.7087 5.98754 12.4113 6.00124 12.1081C6.01494 11.8048 6.14155 11.5177 6.3562 11.303C6.57084 11.0884 6.85799 10.9618 7.16123 10.9481C7.46447 10.9344 7.76187 11.0346 7.995 11.229L10.333 13.567L15.994 8.29143C16.2319 8.08824 16.5389 7.98454 16.8513 8.00187C17.1636 8.0192 17.4573 8.15625 17.6712 8.38451C17.8851 8.61277 18.0029 8.9147 17.9999 9.22753C17.997 9.54036 17.8736 9.84002 17.6555 10.0642L17.6726 10.0557Z' fill='white'/%3E%3C/svg%3E\");background-position:50%;background-repeat:no-repeat}:host(:not([disabled])) :is(:host(:not([variant=selectable-tag])) input):hover,:host([hover]) :is(:host(:not([disabled])) :is(:host(:not([variant=selectable-tag])) input)){border:var(--px-size-border-l) solid var(--px-color-border-state-hover-default)}:host([checked]) :is(:host(:not([disabled])) :is(:host(:not([variant=selectable-tag])) input):hover,:host([hover]) :is(:host(:not([disabled])) :is(:host(:not([variant=selectable-tag])) input))){box-shadow:inset 0 0 0 var(--px-size-border-s) var(--px-color-border-state-hover-default), 0 0 0 var(--px-size-border-s) var(--px-color-border-state-hover-default)}:host(:not([disabled])) :is(:host(:not([variant=selectable-tag])) input):hover{cursor:pointer}:host([disabled]) :is(:host(:not([variant=selectable-tag])) input){background-color:var(--px-color-background-state-disabled-default);border-color:var(--px-color-border-main-default)}:host([checked]) :is(:host([disabled]) :is(:host(:not([variant=selectable-tag])) input)){background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.6726 10.0557L11.1723 16.1192C10.9368 16.3298 10.6319 16.4463 10.3159 16.4463C9.99992 16.4463 9.69501 16.3298 9.45948 16.1192L6.28215 12.9418C6.08774 12.7087 5.98754 12.4113 6.00124 12.1081C6.01494 11.8048 6.14155 11.5177 6.3562 11.303C6.57084 11.0884 6.85799 10.9618 7.16123 10.9481C7.46447 10.9344 7.76187 11.0346 7.995 11.229L10.333 13.567L15.994 8.29143C16.2319 8.08824 16.5389 7.98454 16.8513 8.00187C17.1636 8.0192 17.4573 8.15625 17.6712 8.38451C17.8851 8.61277 18.0029 8.9147 17.9999 9.22753C17.997 9.54036 17.8736 9.84002 17.6555 10.0642L17.6726 10.0557Z' fill='%23000' fill-opacity='0.12'/%3E%3C/svg%3E\")}:host([disabled]) :is(:host(:not([variant=selectable-tag])) input)+label{color:var(--px-color-text-state-disabled-default)}:host([state=error]:not([disabled])) :is(:host(:not([variant=selectable-tag])) input){border-color:var(--px-color-border-purpose-error-default)}:host([state=error]:not([disabled])) :is(:host(:not([variant=selectable-tag])) input):checked{background-color:var(--px-color-background-purpose-error-default)}:host([state=error]:not([disabled])) :is(:host(:not([variant=selectable-tag])) input):checked:hover,:host([hover]) :host([state=error]:not([disabled])) :is(:host(:not([variant=selectable-tag])) input):checked{background-color:var(--px-color-background-purpose-error-default);border-color:var(--px-color-border-purpose-error-default);box-shadow:inset 0 0 0 var(--px-size-border-s) var(--px-color-border-purpose-error-default), 0 0 0 var(--px-size-border-s) var(--px-color-border-purpose-error-default)}:host([inverted]) :is(:host(:not([variant=selectable-tag])) input){border-color:var(--px-color-border-neutral-inverted)}:host([inverted]) :is(:host(:not([variant=selectable-tag])) input):focus-visible{outline-color:var(--px-color-border-focus-outline-inverted)}:host([inverted]) :is(:host(:not([variant=selectable-tag])) input):checked{background-color:var(--px-color-background-state-active-inverted);background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.6726 10.0557L11.1723 16.1192C10.9368 16.3298 10.6319 16.4463 10.3159 16.4463C9.99992 16.4463 9.69501 16.3298 9.45948 16.1192L6.28215 12.9418C6.08774 12.7087 5.98754 12.4113 6.00124 12.1081C6.01494 11.8048 6.14155 11.5177 6.3562 11.303C6.57084 11.0884 6.85799 10.9618 7.16123 10.9481C7.46447 10.9344 7.76187 11.0346 7.995 11.229L10.333 13.567L15.994 8.29143C16.2319 8.08824 16.5389 7.98454 16.8513 8.00187C17.1636 8.0192 17.4573 8.15625 17.6712 8.38451C17.8851 8.61277 18.0029 8.9147 17.9999 9.22753C17.997 9.54036 17.8736 9.84002 17.6555 10.0642L17.6726 10.0557Z' fill='%235C2D91'/%3E%3C/svg%3E\")}:host(:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input)):hover,:host([hover]) :is(:host(:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input))){border-color:var(--px-color-border-state-hover-inverted)}:is(:host(:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input)):hover,:host([hover]) :is(:host(:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input)))):checked{box-shadow:inset 0 0 0 var(--px-size-border-s) var(--px-color-border-state-hover-inverted), 0 0 0 var(--px-size-border-s) var(--px-color-border-state-hover-inverted)}:host([disabled]) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input)){background-color:var(--px-color-background-state-disabled-inverted);border-color:var(--px-color-border-main-inverted)}:host([disabled]) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input)):checked{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.6726 10.0557L11.1723 16.1192C10.9368 16.3298 10.6319 16.4463 10.3159 16.4463C9.99992 16.4463 9.69501 16.3298 9.45948 16.1192L6.28215 12.9418C6.08774 12.7087 5.98754 12.4113 6.00124 12.1081C6.01494 11.8048 6.14155 11.5177 6.3562 11.303C6.57084 11.0884 6.85799 10.9618 7.16123 10.9481C7.46447 10.9344 7.76187 11.0346 7.995 11.229L10.333 13.567L15.994 8.29143C16.2319 8.08824 16.5389 7.98454 16.8513 8.00187C17.1636 8.0192 17.4573 8.15625 17.6712 8.38451C17.8851 8.61277 18.0029 8.9147 17.9999 9.22753C17.997 9.54036 17.8736 9.84002 17.6555 10.0642L17.6726 10.0557Z' fill='white' fill-opacity='0.08'/%3E%3C/svg%3E\")}:host([disabled]) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input))+label{color:var(--px-color-text-state-disabled-inverted)}:host([state=error]:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input)){border-color:var(--px-color-border-purpose-error-inverted)}:host([state=error]:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input)):checked{background-color:var(--px-color-background-purpose-error-inverted);background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.6726 10.0557L11.1723 16.1192C10.9368 16.3298 10.6319 16.4463 10.3159 16.4463C9.99992 16.4463 9.69501 16.3298 9.45948 16.1192L6.28215 12.9418C6.08774 12.7087 5.98754 12.4113 6.00124 12.1081C6.01494 11.8048 6.14155 11.5177 6.3562 11.303C6.57084 11.0884 6.85799 10.9618 7.16123 10.9481C7.46447 10.9344 7.76187 11.0346 7.995 11.229L10.333 13.567L15.994 8.29143C16.2319 8.08824 16.5389 7.98454 16.8513 8.00187C17.1636 8.0192 17.4573 8.15625 17.6712 8.38451C17.8851 8.61277 18.0029 8.9147 17.9999 9.22753C17.997 9.54036 17.8736 9.84002 17.6555 10.0642L17.6726 10.0557Z' fill='white'/%3E%3C/svg%3E\")}:host([state=error]:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input)):checked:hover,:host([hover]) :host([state=error]:not([disabled])) :is(:host([inverted]) :is(:host(:not([variant=selectable-tag])) input)):checked{background-color:var(--px-color-background-purpose-error-inverted);border-color:var(--px-color-border-purpose-error-inverted);box-shadow:inset 0 0 0 var(--px-size-border-s) var(--px-color-border-purpose-error-inverted), 0 0 0 var(--px-size-border-s) var(--px-color-border-purpose-error-inverted)}:host([inverted]) :is(:host(:not([variant=selectable-tag])) input)+label{color:var(--px-color-text-neutral-inverted)}:host([indeterminate][checked]) :is(:host(:not([variant=selectable-tag])) input){background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8558_6622)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='white'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8558_6622'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E\")}:host([disabled]) :is(:host([indeterminate][checked]) :is(:host(:not([variant=selectable-tag])) input)){background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8685_408)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='black' fill-opacity='0.12'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8685_408'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E\")}:host([inverted]) :is(:host([indeterminate][checked]) :is(:host(:not([variant=selectable-tag])) input)){background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8685_6804)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='%235C2D91'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8685_6804'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E\")}:host([disabled]) :is(:host([inverted]) :is(:host([indeterminate][checked]) :is(:host(:not([variant=selectable-tag])) input))){background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8685_6817)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='white' fill-opacity='0.08'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8685_6817'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E\")}:host([state=error]) :is(:host([inverted]) :is(:host([indeterminate][checked]) :is(:host(:not([variant=selectable-tag])) input))){background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8685_6256)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='white'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8685_6256'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E\")}:host([state=error]) :is(:host([inverted]) :is(:host([indeterminate][checked]) :is(:host(:not([variant=selectable-tag])) input))):hover,:host([hover]) :is(:host([state=error]) :is(:host([inverted]) :is(:host([indeterminate][checked]) :is(:host(:not([variant=selectable-tag])) input)))){background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2' fill='none'%3E%3Cg clip-path='url(%23clip0_8685_6804)'%3E%3Cpath d='M11 0H1C0.447715 0 0 0.447715 0 1C0 1.55228 0.447715 2 1 2H11C11.5523 2 12 1.55228 12 1C12 0.447715 11.5523 0 11 0Z' fill='white'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_8685_6804'%3E%3Crect width='12' height='2' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E\")}.checkbox.selectable-tag{gap:0}.checkbox.selectable-tag #checkbox-container{gap:0}:host([variant=selectable-tag]){display:inline-flex}:host([variant=selectable-tag]) label{line-height:var(--px-line-height-ratio-l);vertical-align:middle;justify-content:center;align-items:center;gap:var(--px-spacing-2xs-mobile);background-color:var(--px-color-background-container-default-inverted);color:var(--px-color-text-neutral-default);padding:var(--px-padding-2xs-mobile) var(--px-padding-xs-mobile);box-shadow:0 0 0 var(--px-size-border-s) var(--px-color-border-neutral-default);border-radius:var(--px-radius-pill);border:none;transition:all .2s ease-in-out;display:inline-flex}:host([size=s]) :is(:host([variant=selectable-tag]) label){padding:var(--px-padding-2xs-mobile) var(--px-padding-xs-mobile);gap:var(--px-spacing-2xs-mobile)}:host([size=m]) :is(:host([variant=selectable-tag]) label){padding:var(--px-padding-xs-mobile) var(--px-padding-s-mobile);gap:var(--px-spacing-xs-mobile)}:host([variant=selectable-tag]) input{appearance:none;margin:0}:host([variant=selectable-tag]) input:focus-visible+label{outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default);outline-offset:var(--px-focus-offset-mobile)}:is(:host([variant=selectable-tag]) input:hover,:host([variant=selectable-tag]) input.hover):not([disabled],[aria-disabled=true],.loading)+label{color:var(--px-color-text-brand-default);background:var(--px-color-background-state-hover-bordered-default);box-shadow:0 0 0 var(--px-size-border-m) var(--px-color-border-brand-default);cursor:pointer}:host([variant=selectable-tag]) input:active:not([disabled],[aria-disabled=true],.loading)+label{background:var(--px-color-background-state-active-default);color:var(--px-color-text-state-active-inverted);box-shadow:0 0 0 var(--px-size-border-m) var(--px-color-border-state-active-default)}:host([variant=selectable-tag]) input:checked+label,:host([variant=selectable-tag]) input:checked+label:hover{background-color:var(--px-color-background-state-active-default);box-shadow:0 0 0 var(--px-size-border-m) var(--px-color-border-state-active-default);color:var(--px-color-text-state-active-inverted)}:host([variant=selectable-tag]) input[disabled]+label{background:var(--px-color-background-state-disabled-default);color:var(--px-color-text-state-disabled-default);box-shadow:0 0 0 var(--px-size-border-m) var(--px-color-background-state-disabled-default)}:host([variant=selectable-tag]):host([inverted]) label{background:var(--px-color-background-container-default-default);color:var(--px-color-text-brand-inverted);box-shadow:0 0 0 var(--px-size-border-s) var(--px-color-border-neutral-inverted)}:is(:host([variant=selectable-tag]):host([inverted]) input:hover,:host([variant=selectable-tag]):host([inverted]) input.hover):not([disabled],[aria-disabled=true])+label{color:var(--px-color-text-brand-inverted);background:var(--px-color-background-state-hover-bordered-inverted);box-shadow:0 0 0 var(--px-size-border-m) var(--px-color-border-brand-inverted)}:host([variant=selectable-tag]):host([inverted]) input:active:not([disabled],[aria-disabled=true])+label{background:var(--px-color-background-state-active-inverted);color:var(--px-color-text-state-active-default);box-shadow:0 0 0 var(--px-size-border-m) var(--px-color-border-state-active-inverted)}:host([variant=selectable-tag]):host([inverted]) input:checked+label,:host([variant=selectable-tag]):host([inverted]) input:checked+label:hover{background-color:var(--px-color-background-state-active-inverted);box-shadow:0 0 0 var(--px-size-border-m) var(--px-color-border-state-active-inverted);color:var(--px-color-text-state-active-default)}:host([variant=selectable-tag]):host([inverted]) input[disabled]+label{background:var(--px-color-background-state-disabled-inverted);color:var(--px-color-text-state-disabled-inverted);box-shadow:0 0 0 var(--px-size-border-m) var(--px-color-background-state-disabled-inverted)}:host([variant=selectable-tag]):host([inverted]) input:focus-visible+label{outline-color:var(--px-color-border-focus-outline-inverted)}@media screen and (width>=48rem){.checkbox{gap:var(--px-spacing-xs-tablet)}.checkbox ::slotted([slot=error-text]){font-size:var(--px-text-size-body-m-tablet)}#checkbox-container{gap:var(--px-spacing-s-tablet)}:host(:not([variant=selectable-tag])) input:focus-visible,:host([variant=selectable-tag]) input:focus-visible+label{outline-width:var(--px-focus-outline-tablet);outline-offset:var(--px-focus-offset-tablet)}label{font-size:var(--px-text-size-label-m-tablet)}:host([variant=selectable-tag]) label{padding:var(--px-padding-2xs-tablet) var(--px-padding-xs-tablet);gap:var(--px-spacing-2xs-tablet)}:host([size=s]) :is(:host([variant=selectable-tag]) label){padding:var(--px-padding-2xs-tablet) var(--px-padding-xs-tablet);gap:var(--px-spacing-2xs-tablet)}:host([size=m]) :is(:host([variant=selectable-tag]) label){padding:var(--px-padding-xs-tablet) var(--px-padding-s-tablet);gap:var(--px-spacing-xs-tablet)}}@media screen and (width>=64.0625rem){.checkbox{gap:var(--px-spacing-xs-laptop)}.checkbox ::slotted([slot=error-text]){font-size:var(--px-text-size-body-m-laptop)}#checkbox-container{gap:var(--px-spacing-s-laptop)}:host(:not([variant=selectable-tag])) input:focus-visible,:host([variant=selectable-tag]) input:focus-visible+label{outline-width:var(--px-focus-outline-laptop);outline-offset:var(--px-focus-offset-laptop)}label{font-size:var(--px-text-size-label-m-laptop)}:host([variant=selectable-tag]) label{padding:var(--px-padding-2xs-laptop) var(--px-padding-xs-laptop);gap:var(--px-spacing-2xs-laptop)}:host([size=s]) :is(:host([variant=selectable-tag]) label){padding:var(--px-padding-2xs-laptop) var(--px-padding-xs-laptop);gap:var(--px-spacing-2xs-laptop)}:host([size=m]) :is(:host([variant=selectable-tag]) label){padding:var(--px-padding-xs-laptop) var(--px-padding-s-laptop);gap:var(--px-spacing-xs-laptop)}}@media screen and (width>=90.0625rem){.checkbox{gap:var(--px-spacing-xs-desktop)}.checkbox ::slotted([slot=error-text]){font-size:var(--px-text-size-body-m-desktop)}#checkbox-container{gap:var(--px-spacing-s-desktop)}:host(:not([variant=selectable-tag])) input:focus-visible,:host([variant=selectable-tag]) input:focus-visible+label{outline-width:var(--px-focus-outline-desktop);outline-offset:var(--px-focus-offset-desktop)}label{font-size:var(--px-text-size-label-m-desktop)}:host([variant=selectable-tag]) label{padding:var(--px-padding-2xs-desktop) var(--px-padding-xs-desktop);gap:var(--px-spacing-2xs-desktop)}:host([size=s]) :is(:host([variant=selectable-tag]) label){padding:var(--px-padding-2xs-desktop) var(--px-padding-xs-desktop);gap:var(--px-spacing-2xs-desktop)}:host([size=m]) :is(:host([variant=selectable-tag]) label){padding:var(--px-padding-xs-desktop) var(--px-padding-s-desktop);gap:var(--px-spacing-xs-desktop)}}:host([inverted]) .checkbox ::slotted([slot=error-text]){color:var(--px-color-text-purpose-error-inverted)}@keyframes anim-pop{0%{transform:scale(0)}to{transform:scale(1)}}", l = new CSSStyleSheet();
4
+ l.replaceSync(c);
5
+ var u = [
6
+ "",
7
+ "default",
8
+ "selectable-tag"
9
+ ], d = ["", "error"], f = class c extends e {
10
+ static {
11
+ this.template = t("<div class=\"checkbox\"><slot name=\"error-text\"></slot><div id=\"checkbox-container\"><input type=\"checkbox\"/><label><slot name=\"before\"></slot><slot name=\"label\"></slot></label></div></div>");
12
+ }
13
+ static {
14
+ this.nativeName = "input";
15
+ }
16
+ static {
17
+ this.nativeProperties = a;
18
+ }
19
+ static {
20
+ this.nativeMethods = i;
21
+ }
22
+ static {
23
+ this.nativeAttributes = o(r, "size");
24
+ }
25
+ constructor() {
26
+ super(l), s(this.shadowRoot, c.template), this.internals = this.attachInternals?.();
27
+ }
28
+ static get observedAttributes() {
29
+ return [
30
+ ...super.observedAttributes,
31
+ "state",
32
+ "variant",
33
+ "indeterminate",
34
+ "inverted",
35
+ "hover",
36
+ "size"
37
+ ];
38
+ }
39
+ connectedCallback() {
40
+ this.$el.addEventListener("change", () => {
41
+ let e = new Event("change", {
42
+ bubbles: !0,
43
+ composed: !0
44
+ });
45
+ this.dispatchEvent(e), this.internals?.setFormValue(this.formData());
46
+ }), this.setupForId(), this.$iconSlot && (this.$iconSlot.setAttribute("size", "xs"), this.$iconSlot.setAttribute("color", "inherit")), !this.$labelSlot && !this.$iconSlot && this.$checkbox.classList.add("all-slots-empty"), this.setupAriaDescribedBy(this.$slotErrorText, this.$errorTextSlot, "error-text");
47
+ }
48
+ attributeChangedCallback(e, t, n) {
49
+ if (t !== n) switch (e) {
50
+ case "state":
51
+ this.updateAttribute(t, n, d, e), this.setupAriaDescribedBy(this.$slotErrorText, this.$errorTextSlot, "error-text");
52
+ break;
53
+ case "variant":
54
+ this.updateAttribute(t, n, u, e);
55
+ break;
56
+ case "hover":
57
+ this.$el.classList.toggle("hover");
58
+ break;
59
+ default: super.attributeChangedCallback(e, t, n);
60
+ }
61
+ }
62
+ updateAttribute(e, t, r, i) {
63
+ this.checkName(r, t) ? (e !== null && (i === "variant" ? this.$checkbox?.classList.toggle(e) : this.$el.classList.toggle(e)), t !== null && (i === "variant" ? this.$checkbox?.classList.toggle(t) : this.$el.classList.toggle(t))) : n(`"${t}" is not a valid ${i} value for ${this.tagName.toLowerCase()}. Allowed values are: "${r.join("\", \"")}".`);
64
+ }
65
+ formData() {
66
+ let e = new FormData(), t = this.getAttribute("name");
67
+ return this.$el.name && t && e.append(t, this.$el.value), e;
68
+ }
69
+ static get formAssociated() {
70
+ return !0;
71
+ }
72
+ formResetCallback() {
73
+ this.checked = !1;
74
+ }
75
+ formStateRestoreCallback(e) {
76
+ this.checked = e;
77
+ }
78
+ setupForId() {
79
+ let e = Math.random().toString(36).substr(2, 9);
80
+ this.$el.setAttribute("id", e), this.$label && this.$label.setAttribute("for", e);
81
+ }
82
+ setupAriaDescribedBy(e, t, n) {
83
+ if (e.length > 0 && this.$el.hasAttribute("id")) {
84
+ t.setAttribute("id", `${this.$el.id}-${n}`);
85
+ let e = this.$el.getAttribute("aria-describedby");
86
+ e ? e += ` ${this.$el.id}-${n}` : e = `${this.$el.id}-${n}`, this.$el.setAttribute("aria-describedby", e);
87
+ }
88
+ }
89
+ get $checkbox() {
90
+ return this.shadowRoot.querySelector(".checkbox");
91
+ }
92
+ get $label() {
93
+ return this.shadowRoot.querySelector("label");
94
+ }
95
+ get $labelSlot() {
96
+ return this.querySelector("[slot=\"label\"]");
97
+ }
98
+ get $iconSlot() {
99
+ return this.querySelector("px-icon[slot=\"before\"]");
100
+ }
101
+ get $errorTextSlot() {
102
+ return this.shadowRoot.querySelector("slot[name=\"error-text\"]");
103
+ }
104
+ get $slotErrorText() {
105
+ return this.querySelectorAll("[slot=\"error-text\"]");
106
+ }
107
+ get variant() {
108
+ return this.getAttribute("variant");
109
+ }
110
+ set variant(e) {
111
+ this._updateAttribute("variant", e);
112
+ }
113
+ get state() {
114
+ return this.getAttribute("state");
115
+ }
116
+ set state(e) {
117
+ this._updateAttribute("state", e);
118
+ }
119
+ get inverted() {
120
+ return this.hasAttribute("inverted");
121
+ }
122
+ set inverted(e) {
123
+ this._updateBooleanAttribute("inverted", e);
124
+ }
125
+ get size() {
126
+ return this.getAttribute("size") || "";
127
+ }
128
+ set size(e) {
129
+ this._updateAttribute("size", e);
130
+ }
159
131
  };
132
+ customElements.get("px-checkbox") || customElements.define("px-checkbox", f);
133
+ //#endregion
134
+ export { f as Checkbox, d as checkboxStateValues, u as checkboxVariantValues };
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "properties": [],
5
+ "pseudoElements": []
6
+ }
@@ -0,0 +1,205 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "tags": [
5
+ {
6
+ "name": "px-checkbox",
7
+ "description": "\n---\n",
8
+ "attributes": [
9
+ { "name": "state", "values": [] },
10
+ { "name": "variant", "values": [] },
11
+ { "name": "indeterminate", "values": [] },
12
+ { "name": "inverted", "values": [] },
13
+ { "name": "hover", "values": [] },
14
+ {
15
+ "name": "size",
16
+ "description": "The Lavender control size token.",
17
+ "values": []
18
+ },
19
+ {
20
+ "name": "name",
21
+ "description": "The native element name.",
22
+ "values": []
23
+ },
24
+ {
25
+ "name": "accept",
26
+ "description": "The accepted file types.",
27
+ "values": []
28
+ },
29
+ { "name": "alt", "description": "The alternative text.", "values": [] },
30
+ {
31
+ "name": "autocomplete",
32
+ "description": "The native autofill hint.",
33
+ "values": [{ "name": "AutoFill" }]
34
+ },
35
+ {
36
+ "name": "autofocus",
37
+ "description": "Whether the native element requests autofocus.",
38
+ "values": []
39
+ },
40
+ {
41
+ "name": "capture",
42
+ "description": "The preferred capture device for file selection.",
43
+ "values": []
44
+ },
45
+ {
46
+ "name": "checked",
47
+ "description": "The initial checked state; checked is live state.",
48
+ "values": []
49
+ },
50
+ {
51
+ "name": "dirname",
52
+ "description": "The field name used to submit the text direction.",
53
+ "values": []
54
+ },
55
+ {
56
+ "name": "disabled",
57
+ "description": "Whether the native control is disabled.",
58
+ "values": []
59
+ },
60
+ {
61
+ "name": "formaction",
62
+ "description": "The submission URL override.",
63
+ "values": []
64
+ },
65
+ {
66
+ "name": "formenctype",
67
+ "description": "The submission encoding override.",
68
+ "values": []
69
+ },
70
+ {
71
+ "name": "formmethod",
72
+ "description": "The submission method override.",
73
+ "values": []
74
+ },
75
+ {
76
+ "name": "formnovalidate",
77
+ "description": "Whether submission bypasses validation.",
78
+ "values": []
79
+ },
80
+ {
81
+ "name": "formtarget",
82
+ "description": "The submission target override.",
83
+ "values": []
84
+ },
85
+ {
86
+ "name": "height",
87
+ "description": "The native height in pixels.",
88
+ "values": []
89
+ },
90
+ {
91
+ "name": "inputmode",
92
+ "description": "The virtual keyboard input hint.",
93
+ "values": []
94
+ },
95
+ {
96
+ "name": "enterkeyhint",
97
+ "description": "The virtual keyboard enter-key hint.",
98
+ "values": []
99
+ },
100
+ {
101
+ "name": "max",
102
+ "description": "The maximum allowed value.",
103
+ "values": []
104
+ },
105
+ {
106
+ "name": "maxlength",
107
+ "description": "The maximum text length.",
108
+ "values": []
109
+ },
110
+ {
111
+ "name": "min",
112
+ "description": "The minimum allowed value.",
113
+ "values": []
114
+ },
115
+ {
116
+ "name": "minlength",
117
+ "description": "The minimum text length.",
118
+ "values": []
119
+ },
120
+ {
121
+ "name": "multiple",
122
+ "description": "Whether multiple values are allowed.",
123
+ "values": []
124
+ },
125
+ {
126
+ "name": "pattern",
127
+ "description": "The native validation pattern.",
128
+ "values": []
129
+ },
130
+ {
131
+ "name": "placeholder",
132
+ "description": "The placeholder text.",
133
+ "values": []
134
+ },
135
+ {
136
+ "name": "popovertargetaction",
137
+ "description": "The action for the target popover.",
138
+ "values": []
139
+ },
140
+ {
141
+ "name": "readonly",
142
+ "description": "Whether the native control is read-only.",
143
+ "values": []
144
+ },
145
+ {
146
+ "name": "required",
147
+ "description": "Whether a value is required.",
148
+ "values": []
149
+ },
150
+ { "name": "src", "description": "The resource URL.", "values": [] },
151
+ {
152
+ "name": "step",
153
+ "description": "The allowed value increment.",
154
+ "values": []
155
+ },
156
+ {
157
+ "name": "title",
158
+ "description": "The native element tooltip.",
159
+ "values": []
160
+ },
161
+ {
162
+ "name": "type",
163
+ "description": "The native element type.",
164
+ "values": []
165
+ },
166
+ {
167
+ "name": "usemap",
168
+ "description": "The associated image-map reference.",
169
+ "values": []
170
+ },
171
+ {
172
+ "name": "value",
173
+ "description": "The initial native value; use value for live state.",
174
+ "values": []
175
+ },
176
+ {
177
+ "name": "webkitdirectory",
178
+ "description": "Whether directory selection is enabled, where supported.",
179
+ "values": []
180
+ },
181
+ {
182
+ "name": "width",
183
+ "description": "The native width in pixels.",
184
+ "values": []
185
+ },
186
+ {
187
+ "name": "form",
188
+ "description": "The ID of the associated form; the form property is the native form reference.",
189
+ "values": []
190
+ },
191
+ {
192
+ "name": "list",
193
+ "description": "The ID of the associated datalist; the list property is the native datalist reference.",
194
+ "values": []
195
+ },
196
+ {
197
+ "name": "popovertarget",
198
+ "description": "The ID of the target popover.",
199
+ "values": []
200
+ }
201
+ ],
202
+ "references": []
203
+ }
204
+ ]
205
+ }