scb-wc 0.1.78 → 0.1.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -22
- package/all.js +0 -2
- package/index.js +88 -90
- package/mvc/components/all.js +0 -2
- package/mvc/components/scb-accordion/scb-accordion-item.js +3 -173
- package/mvc/components/scb-accordion/scb-accordion.js +4 -33
- package/mvc/components/scb-app-bar/scb-app-bar.js +2 -110
- package/mvc/components/scb-avatar/scb-avatar.js +2 -94
- package/mvc/components/scb-badge/scb-badge.js +2 -72
- package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +2 -12
- package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +4 -91
- package/mvc/components/scb-button/scb-button.js +47 -309
- package/mvc/components/scb-calendar/scb-calendar-event.js +2 -6
- package/mvc/components/scb-calendar/scb-calendar.js +6 -120
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +21 -350
- package/mvc/components/scb-card/scb-card.js +54 -819
- package/mvc/components/scb-checkbox/scb-checkbox-group.js +3 -31
- package/mvc/components/scb-checkbox/scb-checkbox.js +5 -127
- package/mvc/components/scb-chip/scb-chip.js +2 -76
- package/mvc/components/scb-collapse/scb-collapse.js +2 -44
- package/mvc/components/scb-cookies-consent/scb-cookies-consent.js +7 -73
- package/mvc/components/scb-dialog/scb-dialog.js +2 -213
- package/mvc/components/scb-divider/scb-divider.js +1 -69
- package/mvc/components/scb-drawer/scb-drawer.js +6 -102
- package/mvc/components/scb-drop-zone/scb-drop-zone.js +2 -410
- package/mvc/components/scb-dropdown/scb-dropdown.js +17 -222
- package/mvc/components/scb-fab/scb-fab.js +7 -95
- package/mvc/components/scb-fact-card/scb-fact-card-content.js +2 -69
- package/mvc/components/scb-fact-card/scb-fact-card.js +2 -214
- package/mvc/components/scb-footer/scb-footer-section.js +1 -3
- package/mvc/components/scb-footer/scb-footer.js +3 -172
- package/mvc/components/scb-gallery-grid/scb-gallery-grid.js +2 -112
- package/mvc/components/scb-grid/scb-grid-item.js +1 -32
- package/mvc/components/scb-grid/scb-grid.js +1 -99
- package/mvc/components/scb-grid/scb-stack.js +1 -33
- package/mvc/components/scb-header/scb-header-menu-item.js +1 -5
- package/mvc/components/scb-header/scb-header-tab.js +1 -5
- package/mvc/components/scb-header/scb-header.js +75 -888
- package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +43 -168
- package/mvc/components/scb-icon-button/scb-icon-button.js +59 -171
- package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +17 -218
- package/mvc/components/scb-link/scb-link.js +4 -55
- package/mvc/components/scb-list/scb-list-item.js +23 -126
- package/mvc/components/scb-list/scb-list.js +5 -26
- package/mvc/components/scb-menu/scb-menu-item.js +16 -190
- package/mvc/components/scb-menu/scb-menu-section.js +4 -36
- package/mvc/components/scb-menu/scb-menu.js +5 -69
- package/mvc/components/scb-menu/scb-sub-menu.js +2 -7
- package/mvc/components/scb-nav/scb-nav-item.js +1 -28
- package/mvc/components/scb-nav/scb-nav.js +5 -98
- package/mvc/components/scb-notification-card/scb-notification-card.js +7 -364
- package/mvc/components/scb-options-menu/scb-options-menu-item.js +3 -50
- package/mvc/components/scb-options-menu/scb-options-menu.js +2 -82
- package/mvc/components/scb-options-menu/scb-options-sub-menu.js +2 -31
- package/mvc/components/scb-overlay/scb-overlay.js +3 -43
- package/mvc/components/scb-pagination/scb-pagination.js +19 -221
- package/mvc/components/scb-progress-indicator/scb-progress-indicator.js +2 -67
- package/mvc/components/scb-progress-stepper/scb-progress-step.js +4 -121
- package/mvc/components/scb-progress-stepper/scb-progress-stepper.js +2 -56
- package/mvc/components/scb-radio-button/scb-radio-button.js +5 -116
- package/mvc/components/scb-radio-button/scb-radio-group.js +2 -32
- package/mvc/components/scb-scrollspy/scb-scrollspy.js +2 -61
- package/mvc/components/scb-search/scb-search.js +5 -249
- package/mvc/components/scb-segmented-button/scb-segmented-button.js +1 -32
- package/mvc/components/scb-segmented-button/scb-segmented-item.js +2 -70
- package/mvc/components/scb-select/scb-select-option.js +2 -54
- package/mvc/components/scb-select/scb-select.js +4 -244
- package/mvc/components/scb-skeleton/scb-skeleton.js +2 -35
- package/mvc/components/scb-slider/scb-slider.js +5 -9
- package/mvc/components/scb-snackbar/scb-snackbar.js +9 -84
- package/mvc/components/scb-status-pill/scb-status-pill.js +2 -43
- package/mvc/components/scb-stepper/scb-step.js +8 -186
- package/mvc/components/scb-stepper/scb-stepper.js +2 -130
- package/mvc/components/scb-switch/scb-switch.js +4 -49
- package/mvc/components/scb-table/scb-table.js +2 -48
- package/mvc/components/scb-table-advanced/scb-table-advanced.js +2 -53
- package/mvc/components/scb-tabs/scb-primary-tab.js +2 -7
- package/mvc/components/scb-tabs/scb-secondary-tab.js +2 -7
- package/mvc/components/scb-tabs/scb-tabs.js +4 -31
- package/mvc/components/scb-textfield/scb-textfield.js +142 -388
- package/mvc/components/scb-toc/scb-toc-item.js +3 -251
- package/mvc/components/scb-toc/scb-toc.js +2 -16
- package/mvc/components/scb-tooltip/scb-tooltip.js +8 -155
- package/mvc/components/scb-viz/scb-viz.js +4 -619
- package/mvc/scb-wc-core.css +1 -1
- package/mvc/scb-wc-selfhost.css +1 -1
- package/mvc/scb-wc.css +1 -1
- package/mvc/vendor/assist-chip.js +3 -3
- package/mvc/vendor/chip-set.js +1 -1
- package/mvc/vendor/chip.js +2 -2
- package/mvc/vendor/elevation.js +2 -2
- package/mvc/vendor/filter-chip.js +1 -1
- package/mvc/vendor/focusable.js +1 -1
- package/mvc/vendor/form-associated.js +1 -1
- package/mvc/vendor/icon.js +2 -2
- package/mvc/vendor/lazy-focus-ring.js +2 -0
- package/mvc/vendor/lazy-ripple.js +2 -0
- package/mvc/vendor/md-focus-ring.js +2 -2
- package/mvc/vendor/ripple.js +2 -2
- package/mvc/vendor/scb-card-variants.internal.js +284 -0
- package/mvc/vendor/scb-chevron.js +10 -0
- package/mvc/vendor/scb-header-drawer.internal.js +71 -0
- package/mvc/vendor/shared-styles.js +1 -1
- package/mvc/vendor/tab-styles.js +3 -3
- package/mvc/vendor/validator.js +1 -1
- package/mvc/vendor/vendor.js +3 -4
- package/package.json +2 -2
- package/scb-accordion/scb-accordion-item.js +33 -32
- package/scb-app-bar/scb-app-bar.js +1 -1
- package/scb-button/scb-button.js +287 -259
- package/scb-calendar/scb-calendar.js +49 -49
- package/scb-calendar-card/scb-calendar-card.js +105 -59
- package/scb-card/scb-card-variants.internal.js +230 -0
- package/scb-card/scb-card.js +387 -528
- package/scb-checkbox/scb-checkbox.js +0 -1
- package/scb-chevron/scb-chevron.js +0 -1
- package/scb-components/scb-button/scb-button.d.ts +14 -2
- package/scb-components/scb-calendar/scb-calendar.d.ts +1 -0
- package/scb-components/scb-calendar-card/scb-calendar-card.d.ts +16 -4
- package/scb-components/scb-card/scb-card-variants.internal.d.ts +15 -0
- package/scb-components/scb-card/scb-card.d.ts +26 -9
- package/scb-components/scb-cookies-consent/scb-cookies-consent.d.ts +3 -0
- package/scb-components/scb-header/scb-header-drawer.internal.d.ts +31 -0
- package/scb-components/scb-header/scb-header.d.ts +1 -2
- package/scb-components/scb-horizontal-scroller/scb-horizontal-scroller.d.ts +6 -1
- package/scb-components/scb-icon-button/scb-icon-button.d.ts +28 -29
- package/scb-components/scb-keyfigure-card/scb-keyfigure-card.d.ts +13 -4
- package/scb-components/scb-list/scb-list-item.d.ts +20 -2
- package/scb-components/scb-list/scb-list.d.ts +1 -2
- package/scb-components/scb-nav/scb-nav.d.ts +2 -0
- package/scb-components/scb-segmented-button/scb-segmented-item.d.ts +1 -0
- package/scb-components/scb-select/scb-select-option.d.ts +2 -0
- package/scb-components/scb-toc/scb-toc-item.d.ts +1 -0
- package/scb-components/scb-tooltip/scb-tooltip.d.ts +2 -0
- package/scb-cookies-consent/scb-cookies-consent.js +43 -31
- package/scb-datepicker/scb-datepicker.js +27 -25
- package/scb-dialog/scb-dialog.js +1 -1
- package/scb-dropdown/scb-dropdown.js +29 -28
- package/scb-header/scb-header-drawer.internal.js +78 -0
- package/scb-header/scb-header.js +41 -89
- package/scb-horizontal-scroller/scb-horizontal-scroller.js +181 -88
- package/scb-icon-button/scb-icon-button.js +293 -205
- package/scb-keyfigure-card/scb-keyfigure-card.js +96 -43
- package/scb-list/scb-list-item.js +117 -52
- package/scb-list/scb-list.js +9 -9
- package/scb-nav/scb-nav.js +26 -23
- package/scb-notification-card/scb-notification-card.js +0 -2
- package/scb-options-menu/scb-options-menu-item.js +20 -20
- package/scb-pagination/scb-pagination.js +0 -1
- package/scb-progress-stepper/scb-progress-step.js +19 -17
- package/scb-radio-button/scb-radio-button.js +0 -1
- package/scb-search/scb-search.js +29 -28
- package/scb-segmented-button/scb-segmented-item.js +22 -19
- package/scb-select/scb-select-option.js +20 -14
- package/scb-select/scb-select.js +26 -26
- package/scb-stepper/scb-step.js +34 -31
- package/scb-textfield/scb-textfield.js +39 -39
- package/scb-toc/scb-toc-item.js +26 -26
- package/scb-tooltip/scb-tooltip.js +5 -4
- package/scb-viz/scb-viz.js +1 -1
- package/scb-wc-core.css +1 -1
- package/scb-wc-public-entry/index.d.ts +97 -0
- package/scb-wc-selfhost.css +1 -1
- package/scb-wc.bundle.js +1873 -1476
- package/scb-wc.css +1 -1
- package/scb-wc.d.ts +194 -198
- package/mvc/components/scb-chevron/scb-chevron.js +0 -41
- package/mvc/components/scb-datepicker/scb-datepicker.js +0 -296
- package/mvc/vendor/element-internals.js +0 -1
- package/mvc/vendor/filled-icon-button.js +0 -2
- package/mvc/vendor/filled-tonal-icon-button.js +0 -2
- package/mvc/vendor/form-label-activation.js +0 -1
- package/mvc/vendor/form-submitter.js +0 -1
- package/mvc/vendor/icon-button.js +0 -2
- package/mvc/vendor/list.js +0 -8
- package/mvc/vendor/outlined-icon-button.js +0 -2
- package/mvc/vendor/shared-styles2.js +0 -30
- package/scb-components/index.d.ts +0 -99
- package/scb-components/scb-chevron/scb-chevron.d.ts +0 -11
- package/scb-components/scb-datepicker/scb-datepicker.d.ts +0 -39
|
@@ -1,33 +1,5 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as m,m as v,p as c,v as y,y as k}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as a}from"../../vendor/decorate.js";import{n as x,t as n}from"../../vendor/assertClassBrand.js";import{n as _,r as S,t as g}from"../../vendor/classPrivateFieldGet2.js";(function(){try{var s=typeof globalThis<"u"?globalThis:window;if(!s.__scb_ce_guard_installed__){s.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(o,p,e){try{customElements.get(o)||t(o,p,e)}catch(u){var h=String(u||"");if(h.indexOf("already been used")===-1&&h.indexOf("NotSupportedError")===-1)throw u}}}}catch{}})();var l,r,d,i=(l=new WeakMap,r=new WeakSet,d=class extends m{constructor(...t){super(...t),x(this,r),S(this,l,void 0),this.orientation="vertical",this.disabled=!1,this.size="medium",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,_(l,this,()=>{const o=this.shadowRoot?.querySelector("slot");if(!o)return;const p=o.assignedElements({flatten:!0}).filter(e=>e.tagName.toLowerCase()==="scb-checkbox");for(const e of p){this.disabled?e.setAttribute("disabled",""):e.removeAttribute("disabled"),this.orientation==="horizontal"?e.setAttribute("orientation","horizontal"):e.removeAttribute("orientation");const h=e.hasAttribute("data-size-from-group");this.size==="medium"?h&&(e.removeAttribute("size"),e.removeAttribute("data-size-from-group")):(!e.hasAttribute("size")||h)&&(e.setAttribute("size",this.size),e.setAttribute("data-size-from-group",""))}})}render(){const t=this.orientation==="horizontal"?"row":"column";return y`
|
|
2
2
|
<div class="g" role="group" aria-disabled=${String(this.disabled)} style=${`--_dir:${t}`}>
|
|
3
|
-
<slot @slotchange=${
|
|
3
|
+
<slot @slotchange=${g(l,this)}></slot>
|
|
4
4
|
</div>
|
|
5
|
-
`}firstUpdated(){n(r,this,f).call(this),
|
|
6
|
-
:host {
|
|
7
|
-
display: block;
|
|
8
|
-
/* Vertikal standard-spacing mellan items i gruppen */
|
|
9
|
-
--scb-checkbox-gap: var(--spacing-4, 12px);
|
|
10
|
-
|
|
11
|
-
margin-block-start: var(--scb-checkbox-group-spacing-block-start, 0);
|
|
12
|
-
margin-block-end: var(--scb-checkbox-group-spacing-block-end, 0);
|
|
13
|
-
margin-inline-start: var(--scb-checkbox-group-spacing-inline-start, 0);
|
|
14
|
-
margin-inline-end: var(--scb-checkbox-group-spacing-inline-end, 0);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/* Horisontell standard-spacing mellan items om spacing för gruppen inte overrideas via CSS-variabel */
|
|
18
|
-
:host([orientation='horizontal']) {
|
|
19
|
-
--scb-checkbox-gap: var(--spacing-8, 32px);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.g {
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-direction: var(--_dir, column);
|
|
25
|
-
align-items: flex-start;
|
|
26
|
-
gap: var(--scb-checkbox-gap);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/* När checkboxar ligger i en grupp ska spacing ägas av gruppen, inte av enskilda items */
|
|
30
|
-
::slotted(scb-checkbox) {
|
|
31
|
-
--scb-checkbox-gap: 0;
|
|
32
|
-
}
|
|
33
|
-
`,d);function f(){const s=n(r,this,g).call(this,this.spacing),t=n(r,this,g).call(this,this.spacingTop)??s,o=n(r,this,g).call(this,this.spacingBottom)??s,p=n(r,this,g).call(this,this.spacingLeft),e=n(r,this,g).call(this,this.spacingRight);t?this.style.setProperty("--scb-checkbox-group-spacing-block-start",t):this.style.removeProperty("--scb-checkbox-group-spacing-block-start"),o?this.style.setProperty("--scb-checkbox-group-spacing-block-end",o):this.style.removeProperty("--scb-checkbox-group-spacing-block-end"),p?this.style.setProperty("--scb-checkbox-group-spacing-inline-start",p):this.style.removeProperty("--scb-checkbox-group-spacing-inline-start"),e?this.style.setProperty("--scb-checkbox-group-spacing-inline-end",e):this.style.removeProperty("--scb-checkbox-group-spacing-inline-end")}function g(s){if(!s)return;const t=String(s).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}a([c({type:String,reflect:!0})],i.prototype,"orientation",void 0);a([c({type:Boolean,reflect:!0})],i.prototype,"disabled",void 0);a([c({type:String,reflect:!0})],i.prototype,"size",void 0);a([c({type:String,reflect:!0})],i.prototype,"spacing",void 0);a([c({type:String,attribute:"spacing-top",reflect:!0})],i.prototype,"spacingTop",void 0);a([c({type:String,attribute:"spacing-bottom",reflect:!0})],i.prototype,"spacingBottom",void 0);a([c({type:String,attribute:"spacing-left",reflect:!0})],i.prototype,"spacingLeft",void 0);a([c({type:String,attribute:"spacing-right",reflect:!0})],i.prototype,"spacingRight",void 0);i=a([y("scb-checkbox-group")],i);
|
|
5
|
+
`}firstUpdated(){n(r,this,f).call(this),g(l,this).call(this)}updated(t){(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&n(r,this,f).call(this),(t.has("disabled")||t.has("orientation")||t.has("size"))&&g(l,this).call(this)}},d.styles=k`:host{display:block;--scb-checkbox-gap:var(--spacing-4, 12px);margin-block-start:var(--scb-checkbox-group-spacing-block-start, 0);margin-block-end:var(--scb-checkbox-group-spacing-block-end, 0);margin-inline-start:var(--scb-checkbox-group-spacing-inline-start, 0);margin-inline-end:var(--scb-checkbox-group-spacing-inline-end, 0)}:host([orientation='horizontal']){--scb-checkbox-gap:var(--spacing-8, 32px)}.g{display:flex;flex-direction:var(--_dir, column);align-items:flex-start;gap:var(--scb-checkbox-gap)}::slotted(scb-checkbox){--scb-checkbox-gap:0}`,d);function f(){const s=n(r,this,b).call(this,this.spacing),t=n(r,this,b).call(this,this.spacingTop)??s,o=n(r,this,b).call(this,this.spacingBottom)??s,p=n(r,this,b).call(this,this.spacingLeft),e=n(r,this,b).call(this,this.spacingRight);t?this.style.setProperty("--scb-checkbox-group-spacing-block-start",t):this.style.removeProperty("--scb-checkbox-group-spacing-block-start"),o?this.style.setProperty("--scb-checkbox-group-spacing-block-end",o):this.style.removeProperty("--scb-checkbox-group-spacing-block-end"),p?this.style.setProperty("--scb-checkbox-group-spacing-inline-start",p):this.style.removeProperty("--scb-checkbox-group-spacing-inline-start"),e?this.style.setProperty("--scb-checkbox-group-spacing-inline-end",e):this.style.removeProperty("--scb-checkbox-group-spacing-inline-end")}function b(s){if(!s)return;const t=String(s).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}a([c({type:String,reflect:!0})],i.prototype,"orientation",void 0);a([c({type:Boolean,reflect:!0})],i.prototype,"disabled",void 0);a([c({type:String,reflect:!0})],i.prototype,"size",void 0);a([c({type:String,reflect:!0})],i.prototype,"spacing",void 0);a([c({type:String,attribute:"spacing-top",reflect:!0})],i.prototype,"spacingTop",void 0);a([c({type:String,attribute:"spacing-bottom",reflect:!0})],i.prototype,"spacingBottom",void 0);a([c({type:String,attribute:"spacing-left",reflect:!0})],i.prototype,"spacingLeft",void 0);a([c({type:String,attribute:"spacing-right",reflect:!0})],i.prototype,"spacingRight",void 0);i=a([v("scb-checkbox-group")],i);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{d as T,f as $,g as p,h as E,m as F,o as B,p as r,s as h,v as f,y as M}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/ripple.js";import{t as n}from"../../vendor/decorate.js";import{n as P,t as d}from"../../vendor/assertClassBrand.js";import{n as V,r as L,t as u}from"../../vendor/classPrivateFieldGet2.js";import"../../vendor/md-focus-ring.js";import{t as O}from"../../vendor/delegate.js";import{a as D,n as G,o as H,r as K,s as U,t as W}from"../../vendor/form-associated.js";import{t as N}from"../../vendor/redispatch-event.js";import{i as Y,n as j,r as J}from"../../vendor/validator.js";import{t as Q}from"../../vendor/checkbox-validator.js";import"./scb-checkbox-group.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(i,s,a){try{customElements.get(i)||e(i,s,a)}catch(_){var b=String(_||"");if(b.indexOf("already been used")===-1&&b.indexOf("NotSupportedError")===-1)throw _}}}}catch{}})();var X=Y(K(D(E))),l=class extends X{constructor(){super(),this.checked=!1,this.indeterminate=!1,this.required=!1,this.value="on",this.prevChecked=!1,this.prevDisabled=!1,this.prevIndeterminate=!1,this.addEventListener("click",t=>{!U(t)||!this.input||(this.focus(),H(this.input))})}update(t){(t.has("checked")||t.has("disabled")||t.has("indeterminate"))&&(this.prevChecked=t.get("checked")??this.checked,this.prevDisabled=t.get("disabled")??this.disabled,this.prevIndeterminate=t.get("indeterminate")??this.indeterminate),super.update(t)}render(){const t=!this.prevChecked&&!this.prevIndeterminate,e=this.prevChecked&&!this.prevIndeterminate,i=this.prevIndeterminate,s=this.checked&&!this.indeterminate,a=this.indeterminate,b=B({disabled:this.disabled,selected:s||a,unselected:!s&&!a,checked:s,indeterminate:a,"prev-unselected":t,"prev-checked":e,"prev-indeterminate":i,"prev-disabled":this.prevDisabled}),{ariaLabel:_,ariaInvalid:q}=this;return f`
|
|
2
2
|
<div class="container ${b}">
|
|
3
3
|
<input
|
|
4
4
|
type="checkbox"
|
|
@@ -22,8 +22,8 @@ import{_ as $,b as F,c as T,g as M,h as s,l as h,m as E,p as B,v as p,y as f}fro
|
|
|
22
22
|
<rect class="mark long" />
|
|
23
23
|
</svg>
|
|
24
24
|
</div>
|
|
25
|
-
`}handleInput(t){const e=t.target;this.checked=e.checked,this.indeterminate=e.indeterminate}handleChange(t){
|
|
26
|
-
`,S=class extends l{};S.styles=[Z];S=h([
|
|
25
|
+
`}handleInput(t){const e=t.target;this.checked=e.checked,this.indeterminate=e.indeterminate}handleChange(t){N(this,t)}[G](){return!this.checked||this.indeterminate?null:this.value}[W](){return String(this.checked)}formResetCallback(){this.checked=this.hasAttribute("checked")}formStateRestoreCallback(t){this.checked=t==="true"}[j](){return new Q(()=>this)}[J](){return this.input}};O(l);l.shadowRootOptions={...E.shadowRootOptions,delegatesFocus:!0};h([r({type:Boolean})],l.prototype,"checked",void 0);h([r({type:Boolean})],l.prototype,"indeterminate",void 0);h([r({type:Boolean})],l.prototype,"required",void 0);h([r()],l.prototype,"value",void 0);h([$()],l.prototype,"prevChecked",void 0);h([$()],l.prototype,"prevDisabled",void 0);h([$()],l.prototype,"prevIndeterminate",void 0);h([T("input")],l.prototype,"input",void 0);var Z=M`:host{border-start-start-radius:var(--md-checkbox-container-shape-start-start, var(--md-checkbox-container-shape, 2px));border-start-end-radius:var(--md-checkbox-container-shape-start-end, var(--md-checkbox-container-shape, 2px));border-end-end-radius:var(--md-checkbox-container-shape-end-end, var(--md-checkbox-container-shape, 2px));border-end-start-radius:var(--md-checkbox-container-shape-end-start, var(--md-checkbox-container-shape, 2px));display:inline-flex;height:var(--md-checkbox-container-size, 18px);position:relative;vertical-align:top;width:var(--md-checkbox-container-size, 18px);-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer}:host([disabled]){cursor:default}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--md-checkbox-container-size, 18px))/2)}md-focus-ring{height:44px;inset:unset;width:44px}input{appearance:none;height:48px;margin:0;opacity:0;outline:none;position:absolute;width:48px;z-index:1;cursor:inherit}:host([touch-target=none]) input{height:100%;width:100%}.container{border-radius:inherit;display:flex;height:100%;place-content:center;place-items:center;position:relative;width:100%}.outline,.background,.icon{inset:0;position:absolute}.outline,.background{border-radius:inherit}.outline{border-color:var(--md-checkbox-outline-color, var(--md-sys-color-on-surface-variant, #49454f));border-style:solid;border-width:var(--md-checkbox-outline-width, 2px);box-sizing:border-box}.background{background-color:var(--md-checkbox-selected-container-color, var(--md-sys-color-primary, #6750a4))}.background,.icon{opacity:0;transition-duration:150ms,50ms;transition-property:transform,opacity;transition-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15),linear;transform:scale(0.6)}:where(.selected) :is(.background,.icon){opacity:1;transition-duration:350ms,50ms;transition-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1),linear;transform:scale(1)}md-ripple{border-radius:var(--md-checkbox-state-layer-shape, var(--md-sys-shape-corner-full, 9999px));height:var(--md-checkbox-state-layer-size, 40px);inset:unset;width:var(--md-checkbox-state-layer-size, 40px);--md-ripple-hover-color: var(--md-checkbox-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-checkbox-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-checkbox-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-pressed-opacity: var(--md-checkbox-pressed-state-layer-opacity, 0.12)}.selected md-ripple{--md-ripple-hover-color: var(--md-checkbox-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-hover-opacity: var(--md-checkbox-selected-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-checkbox-selected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-checkbox-selected-pressed-state-layer-opacity, 0.12)}.icon{fill:var(--md-checkbox-selected-icon-color, var(--md-sys-color-on-primary, #fff));height:var(--md-checkbox-icon-size, 18px);width:var(--md-checkbox-icon-size, 18px)}.mark.short{height:2px;transition-property:transform,height;width:2px}.mark.long{height:2px;transition-property:transform,width;width:10px}.mark{animation-duration:150ms;animation-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15);transition-duration:150ms;transition-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15)}.selected .mark{animation-duration:350ms;animation-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1);transition-duration:350ms;transition-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1)}.checked .mark,.prev-checked.unselected .mark{transform:scaleY(-1) translate(7px, -14px) rotate(45deg)}.checked .mark.short,.prev-checked.unselected .mark.short{height:5.6568542495px}.checked .mark.long,.prev-checked.unselected .mark.long{width:11.313708499px}.indeterminate .mark,.prev-indeterminate.unselected .mark{transform:scaleY(-1) translate(4px, -10px) rotate(0deg)}.prev-unselected .mark{transition-property:none}.prev-unselected.checked .mark.long{animation-name:prev-unselected-to-checked}@keyframes prev-unselected-to-checked{from{width:0}}:where(:hover) .outline{border-color:var(--md-checkbox-hover-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-hover-outline-width, 2px)}:where(:hover) .background{background:var(--md-checkbox-selected-hover-container-color, var(--md-sys-color-primary, #6750a4))}:where(:hover) .icon{fill:var(--md-checkbox-selected-hover-icon-color, var(--md-sys-color-on-primary, #fff))}:where(:focus-within) .outline{border-color:var(--md-checkbox-focus-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-focus-outline-width, 2px)}:where(:focus-within) .background{background:var(--md-checkbox-selected-focus-container-color, var(--md-sys-color-primary, #6750a4))}:where(:focus-within) .icon{fill:var(--md-checkbox-selected-focus-icon-color, var(--md-sys-color-on-primary, #fff))}:where(:active) .outline{border-color:var(--md-checkbox-pressed-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-pressed-outline-width, 2px)}:where(:active) .background{background:var(--md-checkbox-selected-pressed-container-color, var(--md-sys-color-primary, #6750a4))}:where(:active) .icon{fill:var(--md-checkbox-selected-pressed-icon-color, var(--md-sys-color-on-primary, #fff))}:where(.disabled,.prev-disabled) :is(.background,.icon,.mark){animation-duration:0s;transition-duration:0s}:where(.disabled) .outline{border-color:var(--md-checkbox-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-disabled-outline-width, 2px);opacity:var(--md-checkbox-disabled-container-opacity, 0.38)}:where(.selected.disabled) .outline{visibility:hidden}:where(.selected.disabled) .background{background:var(--md-checkbox-selected-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-checkbox-selected-disabled-container-opacity, 0.38)}:where(.disabled) .icon{fill:var(--md-checkbox-selected-disabled-icon-color, var(--md-sys-color-surface, #fef7ff))}@media(forced-colors: active){.background{background-color:CanvasText}.selected.disabled .background{background-color:GrayText;opacity:1}.outline{border-color:CanvasText}.disabled .outline{border-color:GrayText;opacity:1}.icon{fill:Canvas}}
|
|
26
|
+
`,S=class extends l{};S.styles=[Z];S=h([F("md-checkbox")],S);var c,v,k,g,C,I=!1,w=0,A=t=>{t.metaKey||t.altKey||t.ctrlKey||(I=!0)},m=()=>{I=!1},ee=()=>{w===0&&(window.addEventListener("keydown",A,!0),window.addEventListener("pointerdown",m,!0),window.addEventListener("mousedown",m,!0),window.addEventListener("touchstart",m,!0)),w+=1},te=()=>{w=Math.max(0,w-1),w===0&&(window.removeEventListener("keydown",A,!0),window.removeEventListener("pointerdown",m,!0),window.removeEventListener("mousedown",m,!0),window.removeEventListener("touchstart",m,!0))},o=(c=new WeakSet,v=new WeakMap,k=new WeakMap,g=new WeakMap,C=class extends E{constructor(){super(),P(this,c),L(this,v,void 0),L(this,k,void 0),L(this,g,void 0),this._internals=null,this.disabled=!1,this.indeterminate=!1,this.checked=!1,this.required=!1,this.size="medium",this.label="",this.supportingText="",this.ariaLabel="",this.name="",this.value="on",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._form=null,this._formResetHandler=null,this._initialChecked=!1,this._customValidationMessage="",this._checkboxId="",this._showOuterFocusRing=!1,V(v,this,()=>{this.disabled||this.label?.trim()&&I&&d(c,this,x).call(this,!0)}),V(k,this,()=>{d(c,this,x).call(this,!1)}),V(g,this,()=>{d(c,this,x).call(this,!1)}),"attachInternals"in this&&(this._internals=this.attachInternals())}connectedCallback(){super.connectedCallback(),ee(),this._checkboxId=this.id||`scb-checkbox-${Math.random().toString(36).slice(2,11)}`,this._initialChecked=this.checked,d(c,this,z).call(this),this.addEventListener("focusin",u(v,this)),this.addEventListener("focusout",u(k,this)),this.addEventListener("pointerdown",u(g,this),!0),this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.checked=this._initialChecked,this.indeterminate=!1,this.__syncFormValue()},this._form.addEventListener("reset",this._formResetHandler,!0)),this.__syncFormValue()}disconnectedCallback(){super.disconnectedCallback(),te(),this.removeEventListener("focusin",u(v,this)),this.removeEventListener("focusout",u(k,this)),this.removeEventListener("pointerdown",u(g,this),!0),this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0)}firstUpdated(){const e=this.shadowRoot?.querySelector("md-checkbox");e&&e.addEventListener("change",()=>{const i=e,s=!!i.checked,a=!!i.indeterminate;this.checked=s,this.indeterminate=a,this.dispatchEvent(new CustomEvent("change",{detail:{checked:s,indeterminate:a},bubbles:!0,composed:!0}))}),this.shadowRoot?.querySelector("label.wrap")?.addEventListener("click",i=>{if(!this.disabled&&!i.composedPath().some(s=>{const a=s;return a?.tagName?.toLowerCase?.()==="md-checkbox"||a?.classList?.contains("box-wrap")})){i.preventDefault();const s=this.shadowRoot.querySelector("md-checkbox");s&&(s.checked=!s.checked,s.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}}),this.__syncInnerAria(),this.__syncValidity(),d(c,this,R).call(this)}updated(e){super.updated(e),e.has("disabled")&&(this.toggleAttribute("aria-disabled",this.disabled),this.disabled&&d(c,this,x).call(this,!1)),(e.has("label")||e.has("supportingText")||e.has("ariaLabel"))&&this.__syncInnerAria(),e.has("label")&&d(c,this,z).call(this),(e.has("checked")||e.has("disabled")||e.has("value"))&&this.__syncFormValue(),(e.has("checked")||e.has("disabled")||e.has("required"))&&this.__syncValidity(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&d(c,this,R).call(this)}formDisabledCallback(e){this.disabled=e}__syncInnerAria(){const e=this.shadowRoot?.querySelector("md-checkbox")?.shadowRoot;if(!e)return;const i=e.querySelector('[role="checkbox"]')||e.querySelector('input[type="checkbox"]');if(!i)return;const s=!!this.label?.trim(),a=s?`${this._checkboxId}-label`:"",b=this.supportingText?`${this._checkboxId}-supporting-text`:"";s&&a?(i.setAttribute("aria-labelledby",a),i.removeAttribute("aria-label")):(i.removeAttribute("aria-labelledby"),this.ariaLabel?.trim()?i.setAttribute("aria-label",this.ariaLabel.trim()):i.removeAttribute("aria-label")),b?i.setAttribute("aria-describedby",b):i.removeAttribute("aria-describedby")}__getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!this.checked?"Markera det här fältet.":""}__syncValidity(){const e=this.shadowRoot?.querySelector("md-checkbox"),i=this.disabled?"":this.__getValidationMessage();this._internals&&(i?this._internals.setValidity({valueMissing:!0},i,e??void 0):this._internals.setValidity({})),this.toggleAttribute("aria-invalid",!!i)}checkValidity(){return!this.__getValidationMessage()}reportValidity(){return this.__syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=e,this.__syncValidity()}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this.__getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}__syncFormValue(){if(!this._internals)return;const e=this.disabled||!this.checked?null:this.value;this._internals.setFormValue(e)}render(){const e=this.supportingText?`${this._checkboxId}-supporting-text`:void 0,i=!!this.label?.trim(),s=i?p:this.ariaLabel||p;return f`
|
|
27
27
|
<label class="wrap">
|
|
28
28
|
${i?f`<md-focus-ring class="outer-focus-ring" ?visible=${this._showOuterFocusRing}></md-focus-ring>`:p}
|
|
29
29
|
<div class="box-wrap">
|
|
@@ -33,7 +33,7 @@ import{_ as $,b as F,c as T,g as M,h as s,l as h,m as E,p as B,v as p,y as f}fro
|
|
|
33
33
|
?indeterminate=${this.indeterminate}
|
|
34
34
|
?checked=${this.checked}
|
|
35
35
|
?required=${this.required}
|
|
36
|
-
aria-label=${
|
|
36
|
+
aria-label=${s}
|
|
37
37
|
></md-checkbox>
|
|
38
38
|
</div>
|
|
39
39
|
${i?f`<span class="lbl" id="${this._checkboxId}-label">${this.label}</span>`:p}
|
|
@@ -42,126 +42,4 @@ import{_ as $,b as F,c as T,g as M,h as s,l as h,m as E,p as B,v as p,y as f}fro
|
|
|
42
42
|
</div>`:p}
|
|
43
43
|
</label>
|
|
44
44
|
<slot></slot>
|
|
45
|
-
`}},C.formAssociated=!0,C.styles=F
|
|
46
|
-
:host {
|
|
47
|
-
display: inline-grid;
|
|
48
|
-
grid-template-columns: auto;
|
|
49
|
-
grid-template-rows: auto auto;
|
|
50
|
-
row-gap: 0;
|
|
51
|
-
font-family: var(--brand-font, 'Inter', sans-serif);
|
|
52
|
-
|
|
53
|
-
--scb-checkbox-text-font: var(--md-sys-typescale-body-medium-font);
|
|
54
|
-
--scb-checkbox-text-size: var(--md-sys-typescale-body-medium-size);
|
|
55
|
-
--scb-checkbox-text-line-height: var(--md-sys-typescale-body-medium-line-height);
|
|
56
|
-
--scb-checkbox-text-tracking: var(--md-sys-typescale-body-medium-tracking);
|
|
57
|
-
--scb-checkbox-text-weight: var(--md-sys-typescale-body-medium-weight, var(--weight-regular, 400));
|
|
58
|
-
|
|
59
|
-
margin-block-start: var(--scb-checkbox-spacing-block-start, 0);
|
|
60
|
-
margin-block-end: var(--scb-checkbox-spacing-block-end, 0);
|
|
61
|
-
margin-inline-start: var(--scb-checkbox-spacing-inline-start, 0);
|
|
62
|
-
margin-inline-end: var(--scb-checkbox-spacing-inline-end, 0);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
:host([size='small']) {
|
|
66
|
-
--scb-checkbox-text-font: var(--md-sys-typescale-body-small-font);
|
|
67
|
-
--scb-checkbox-text-size: var(--md-sys-typescale-body-small-size);
|
|
68
|
-
--scb-checkbox-text-line-height: var(--md-sys-typescale-body-small-line-height);
|
|
69
|
-
--scb-checkbox-text-tracking: var(--md-sys-typescale-body-small-tracking);
|
|
70
|
-
--scb-checkbox-text-weight: var(--md-sys-typescale-body-small-weight, var(--weight-regular, 400));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
:host([size='large']) {
|
|
74
|
-
--scb-checkbox-text-font: var(--md-sys-typescale-body-large-font);
|
|
75
|
-
--scb-checkbox-text-size: var(--md-sys-typescale-body-large-size);
|
|
76
|
-
--scb-checkbox-text-line-height: var(--md-sys-typescale-body-large-line-height);
|
|
77
|
-
--scb-checkbox-text-tracking: var(--md-sys-typescale-body-large-tracking);
|
|
78
|
-
--scb-checkbox-text-weight: var(--md-sys-typescale-body-large-weight, var(--weight-regular, 400));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
:host([orientation='horizontal']) {
|
|
82
|
-
margin-inline-end: var(--scb-checkbox-spacing-inline-end, var(--scb-checkbox-gap, var(--spacing-7, 24px)));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.wrap {
|
|
86
|
-
display: inline-grid;
|
|
87
|
-
grid-template-columns: auto 1fr;
|
|
88
|
-
align-items: center;
|
|
89
|
-
column-gap: var(--spacing-5, 16px);
|
|
90
|
-
row-gap: 0;
|
|
91
|
-
cursor: pointer;
|
|
92
|
-
position: relative;
|
|
93
|
-
overflow: visible;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.outer-focus-ring {
|
|
97
|
-
position: absolute;
|
|
98
|
-
inset:
|
|
99
|
-
calc(var(--spacing-2, 4px) * -1) /* topp */
|
|
100
|
-
calc(var(--spacing-4, 12px) * -1) /* höger */
|
|
101
|
-
calc(var(--spacing-2, 4px) * -1) /* botten */
|
|
102
|
-
calc(var(--spacing-4, 12px) * -1); /* vänster */
|
|
103
|
-
pointer-events: none;
|
|
104
|
-
--md-focus-ring-shape-start-start: var(--radius-s, 8px);
|
|
105
|
-
--md-focus-ring-shape-start-end: var(--radius-s, 8px);
|
|
106
|
-
--md-focus-ring-shape-end-start: var(--radius-s, 8px);
|
|
107
|
-
--md-focus-ring-shape-end-end: var(--radius-s, px);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
:host([data-has-label]) md-checkbox::part(focus-ring) {
|
|
111
|
-
display: none;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
:host([disabled]) .wrap {
|
|
115
|
-
cursor: default;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.box-wrap {
|
|
119
|
-
height: var(--scb-checkbox-target, 40px);
|
|
120
|
-
display: flex;
|
|
121
|
-
align-items: center;
|
|
122
|
-
justify-content: center;
|
|
123
|
-
overflow: visible;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
md-checkbox {
|
|
127
|
-
margin: 0;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.lbl {
|
|
131
|
-
color: var(--md-sys-color-on-surface);
|
|
132
|
-
font-family: var(--scb-checkbox-text-font, var(--brand-font));
|
|
133
|
-
font-size: var(--scb-checkbox-text-size);
|
|
134
|
-
line-height: var(--scb-checkbox-text-line-height);
|
|
135
|
-
font-weight: var(--scb-checkbox-text-weight);
|
|
136
|
-
letter-spacing: var(--scb-checkbox-text-tracking);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
:host([disabled]) .lbl {
|
|
140
|
-
color: var(--n-60);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.supporting-text {
|
|
144
|
-
grid-column: 2;
|
|
145
|
-
grid-row: 2;
|
|
146
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
147
|
-
font-family: var(--scb-checkbox-text-font, var(--brand-font));
|
|
148
|
-
font-size: var(--scb-checkbox-text-size);
|
|
149
|
-
line-height: var(--scb-checkbox-text-line-height, 20px);
|
|
150
|
-
font-weight: var(--scb-checkbox-text-weight);
|
|
151
|
-
letter-spacing: var(--scb-checkbox-text-tracking);
|
|
152
|
-
margin-bottom: var(--spacing-4, 8px);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
:host([disabled]) .supporting-text {
|
|
156
|
-
color: var(--n-60);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
@media (prefers-color-scheme: dark) {
|
|
160
|
-
.lbl {
|
|
161
|
-
color: var(--md-sys-color-on-surface);
|
|
162
|
-
}
|
|
163
|
-
.supporting-text {
|
|
164
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
`,C);function x(t){this._showOuterFocusRing!==t&&(this._showOuterFocusRing=t,this.requestUpdate())}function z(){const t=!!this.label?.trim();this.toggleAttribute("data-has-label",t),t||d(c,this,x).call(this,!1)}function R(){const t=d(c,this,y).call(this,this.spacing),e=d(c,this,y).call(this,this.spacingTop)??t,i=d(c,this,y).call(this,this.spacingBottom)??t,r=d(c,this,y).call(this,this.spacingLeft),a=d(c,this,y).call(this,this.spacingRight);e?this.style.setProperty("--scb-checkbox-spacing-block-start",e):this.style.removeProperty("--scb-checkbox-spacing-block-start"),i?this.style.setProperty("--scb-checkbox-spacing-block-end",i):this.style.removeProperty("--scb-checkbox-spacing-block-end"),r?this.style.setProperty("--scb-checkbox-spacing-inline-start",r):this.style.removeProperty("--scb-checkbox-spacing-inline-start"),a?this.style.setProperty("--scb-checkbox-spacing-inline-end",a):this.style.removeProperty("--scb-checkbox-spacing-inline-end")}function y(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}n([s({type:Boolean,reflect:!0})],o.prototype,"disabled",void 0);n([s({type:Boolean,reflect:!0})],o.prototype,"indeterminate",void 0);n([s({type:Boolean,reflect:!0})],o.prototype,"checked",void 0);n([s({type:Boolean,reflect:!0})],o.prototype,"required",void 0);n([s({type:String,reflect:!0})],o.prototype,"size",void 0);n([s({type:String})],o.prototype,"label",void 0);n([s({type:String,attribute:"supporting-text"})],o.prototype,"supportingText",void 0);n([s({type:String,reflect:!0,attribute:"aria-label"})],o.prototype,"ariaLabel",void 0);n([s({type:String})],o.prototype,"name",void 0);n([s({type:String})],o.prototype,"value",void 0);n([s({type:String,reflect:!0})],o.prototype,"spacing",void 0);n([s({type:String,attribute:"spacing-top",reflect:!0})],o.prototype,"spacingTop",void 0);n([s({type:String,attribute:"spacing-bottom",reflect:!0})],o.prototype,"spacingBottom",void 0);n([s({type:String,attribute:"spacing-left",reflect:!0})],o.prototype,"spacingLeft",void 0);n([s({type:String,attribute:"spacing-right",reflect:!0})],o.prototype,"spacingRight",void 0);o=n([M("scb-checkbox")],o);export{o as ScbCheckbox};
|
|
45
|
+
`}},C.formAssociated=!0,C.styles=M`:host{display:inline-grid;grid-template-columns:auto;grid-template-rows:auto auto;row-gap:0;font-family:var(--brand-font, 'Inter', sans-serif);--scb-checkbox-text-font:var(--md-sys-typescale-body-medium-font);--scb-checkbox-text-size:var(--md-sys-typescale-body-medium-size);--scb-checkbox-text-line-height:var(--md-sys-typescale-body-medium-line-height);--scb-checkbox-text-tracking:var(--md-sys-typescale-body-medium-tracking);--scb-checkbox-text-weight:var(--md-sys-typescale-body-medium-weight, var(--weight-regular, 400));margin-block-start:var(--scb-checkbox-spacing-block-start, 0);margin-block-end:var(--scb-checkbox-spacing-block-end, 0);margin-inline-start:var(--scb-checkbox-spacing-inline-start, 0);margin-inline-end:var(--scb-checkbox-spacing-inline-end, 0)}:host([size='small']){--scb-checkbox-text-font:var(--md-sys-typescale-body-small-font);--scb-checkbox-text-size:var(--md-sys-typescale-body-small-size);--scb-checkbox-text-line-height:var(--md-sys-typescale-body-small-line-height);--scb-checkbox-text-tracking:var(--md-sys-typescale-body-small-tracking);--scb-checkbox-text-weight:var(--md-sys-typescale-body-small-weight, var(--weight-regular, 400))}:host([size='large']){--scb-checkbox-text-font:var(--md-sys-typescale-body-large-font);--scb-checkbox-text-size:var(--md-sys-typescale-body-large-size);--scb-checkbox-text-line-height:var(--md-sys-typescale-body-large-line-height);--scb-checkbox-text-tracking:var(--md-sys-typescale-body-large-tracking);--scb-checkbox-text-weight:var(--md-sys-typescale-body-large-weight, var(--weight-regular, 400))}:host([orientation='horizontal']){margin-inline-end:var(--scb-checkbox-spacing-inline-end, var(--scb-checkbox-gap, var(--spacing-7, 24px)))}.wrap{display:inline-grid;grid-template-columns:auto 1fr;align-items:center;column-gap:var(--spacing-5, 16px);row-gap:0;cursor:pointer;position:relative;overflow:visible}.outer-focus-ring{position:absolute;inset:calc(var(--spacing-2, 4px)*-1) calc(var(--spacing-4, 12px)*-1) calc(var(--spacing-2, 4px)*-1) calc(var(--spacing-4, 12px)*-1);pointer-events:none;--md-focus-ring-shape-start-start:var(--radius-s, 8px);--md-focus-ring-shape-start-end:var(--radius-s, 8px);--md-focus-ring-shape-end-start:var(--radius-s, 8px);--md-focus-ring-shape-end-end:var(--radius-s, px)}:host([data-has-label]) md-checkbox::part(focus-ring){display:none}:host([disabled]) .wrap{cursor:default}.box-wrap{height:var(--scb-checkbox-target, 40px);display:flex;align-items:center;justify-content:center;overflow:visible}md-checkbox{margin:0}.lbl{color:var(--md-sys-color-on-surface);font-family:var(--scb-checkbox-text-font, var(--brand-font));font-size:var(--scb-checkbox-text-size);line-height:var(--scb-checkbox-text-line-height);font-weight:var(--scb-checkbox-text-weight);letter-spacing:var(--scb-checkbox-text-tracking)}:host([disabled]) .lbl,:host([disabled]) .supporting-text{color:var(--n-60)}.supporting-text{grid-column:2;grid-row:2;color:var(--md-sys-color-on-surface-variant);font-family:var(--scb-checkbox-text-font, var(--brand-font));font-size:var(--scb-checkbox-text-size);line-height:var(--scb-checkbox-text-line-height, 20px);font-weight:var(--scb-checkbox-text-weight);letter-spacing:var(--scb-checkbox-text-tracking);margin-bottom:var(--spacing-4, 8px)}@media (prefers-color-scheme:dark){.lbl{color:var(--md-sys-color-on-surface)}.supporting-text{color:var(--md-sys-color-on-surface-variant)}}`,C);function x(t){this._showOuterFocusRing!==t&&(this._showOuterFocusRing=t,this.requestUpdate())}function z(){const t=!!this.label?.trim();this.toggleAttribute("data-has-label",t),t||d(c,this,x).call(this,!1)}function R(){const t=d(c,this,y).call(this,this.spacing),e=d(c,this,y).call(this,this.spacingTop)??t,i=d(c,this,y).call(this,this.spacingBottom)??t,s=d(c,this,y).call(this,this.spacingLeft),a=d(c,this,y).call(this,this.spacingRight);e?this.style.setProperty("--scb-checkbox-spacing-block-start",e):this.style.removeProperty("--scb-checkbox-spacing-block-start"),i?this.style.setProperty("--scb-checkbox-spacing-block-end",i):this.style.removeProperty("--scb-checkbox-spacing-block-end"),s?this.style.setProperty("--scb-checkbox-spacing-inline-start",s):this.style.removeProperty("--scb-checkbox-spacing-inline-start"),a?this.style.setProperty("--scb-checkbox-spacing-inline-end",a):this.style.removeProperty("--scb-checkbox-spacing-inline-end")}function y(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}n([r({type:Boolean,reflect:!0})],o.prototype,"disabled",void 0);n([r({type:Boolean,reflect:!0})],o.prototype,"indeterminate",void 0);n([r({type:Boolean,reflect:!0})],o.prototype,"checked",void 0);n([r({type:Boolean,reflect:!0})],o.prototype,"required",void 0);n([r({type:String,reflect:!0})],o.prototype,"size",void 0);n([r({type:String})],o.prototype,"label",void 0);n([r({type:String,attribute:"supporting-text"})],o.prototype,"supportingText",void 0);n([r({type:String,reflect:!0,attribute:"aria-label"})],o.prototype,"ariaLabel",void 0);n([r({type:String})],o.prototype,"name",void 0);n([r({type:String})],o.prototype,"value",void 0);n([r({type:String,reflect:!0})],o.prototype,"spacing",void 0);n([r({type:String,attribute:"spacing-top",reflect:!0})],o.prototype,"spacingTop",void 0);n([r({type:String,attribute:"spacing-bottom",reflect:!0})],o.prototype,"spacingBottom",void 0);n([r({type:String,attribute:"spacing-left",reflect:!0})],o.prototype,"spacingLeft",void 0);n([r({type:String,attribute:"spacing-right",reflect:!0})],o.prototype,"spacingRight",void 0);o=n([F("scb-checkbox")],o);export{o as ScbCheckbox};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../vendor/assist-chip.js","../../vendor/vendor.js","../../vendor/chip.js","../../vendor/md-focus-ring.js","../../vendor/rolldown-runtime.js","../../vendor/attachable-controller.js","../../vendor/vendor-lit.js","../../vendor/delegate.js","../../vendor/ripple.js","../../vendor/shared-styles.js","../../vendor/elevation.js","../../vendor/filter-chip.js","../../vendor/redispatch-event.js","../../vendor/chip-set.js","../../vendor/icon.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{
|
|
2
|
+
import{h as v,m as f,p as s,v as o,y as _}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as d}from"../../vendor/preload-helper.js";import{t as i}from"../../vendor/decorate.js";import{n as g,t as u}from"../../vendor/assertClassBrand.js";(function(){try{var r=typeof globalThis<"u"?globalThis:window;if(!r.__scb_ce_guard_installed__){r.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(a,c,p){try{customElements.get(a)||t(a,c,p)}catch(n){var l=String(n||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var h,m,e=(h=new WeakSet,m=class extends v{constructor(){super(),g(this,h),this.variant="assist",this.staticVariant="filled",this.label="",this.icon="",this.disabled=!1,this.elevated=!1,this.removable=!1,this.selected=!1,this.disableToggle=!1,this.href="",this.target="",this.name="",this.value="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.size="medium",this._internals=null,this.__loadedVariants=new Set,this.__chipSetLoaded=!1,this.__iconLoaded=!1,this._onFilterClick=t=>{if(this.disableToggle){const a=t.currentTarget;a&&(a.selected=this.selected),t.preventDefault();return}this._toggleSelected()},"attachInternals"in this&&(this._internals=this.attachInternals())}updated(t){super.updated(t),(t.has("variant")||t.has("icon"))&&this.__ensureDepsLoaded(),t.has("disabled")&&(this.toggleAttribute("aria-disabled",this.disabled),this.dispatchEvent(new CustomEvent("disabled-changed",{detail:{disabled:this.disabled},bubbles:!0,composed:!0}))),t.has("variant")&&this.dispatchEvent(new CustomEvent("variant-changed",{detail:{variant:this.variant},bubbles:!0,composed:!0})),t.has("staticVariant")&&this.dispatchEvent(new CustomEvent("static-variant-changed",{detail:{staticVariant:this.staticVariant},bubbles:!0,composed:!0})),t.has("label")&&this.dispatchEvent(new CustomEvent("label-changed",{detail:{label:this.label},bubbles:!0,composed:!0})),t.has("elevated")&&this.dispatchEvent(new CustomEvent("elevated-changed",{detail:{elevated:this.elevated},bubbles:!0,composed:!0})),t.has("icon")&&this.dispatchEvent(new CustomEvent("icon-changed",{detail:{icon:this.icon},bubbles:!0,composed:!0})),t.has("size")&&this.dispatchEvent(new CustomEvent("size-changed",{detail:{size:this.size},bubbles:!0,composed:!0})),(t.has("selected")||t.has("disabled")||t.has("variant")||t.has("value")||t.has("name"))&&this._updateFormValue(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&u(h,this,b).call(this)}firstUpdated(){this.__ensureDepsLoaded(),u(h,this,b).call(this),this._updateFormValue()}async __ensureDepsLoaded(){const t=this.variant==="assist"||this.variant==="filter"?this.variant:null;if(t&&!this.__loadedVariants.has(t)){switch(t){case"assist":await d(()=>import("../../vendor/assist-chip.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url);break;case"filter":await d(()=>import("../../vendor/filter-chip.js"),__vite__mapDeps([11,1,2,3,4,5,6,7,8,9,10,12]),import.meta.url);break}this.__loadedVariants.add(t)}t&&!this._insideChipSet&&!this.__chipSetLoaded&&(await d(()=>import("../../vendor/chip-set.js"),__vite__mapDeps([13,1,2,3,4,5,6,7,8]),import.meta.url),this.__chipSetLoaded=!0),this.icon&&!this.__iconLoaded&&(await d(()=>import("../../vendor/icon.js").then(a=>a.t),__vite__mapDeps([14,4,1,6]),import.meta.url),this.__iconLoaded=!0)}get _insideChipSet(){return!!this.closest("md-chip-set")}render(){const t=this._renderChip();return this.variant==="static"||this._insideChipSet?t:o`<md-chip-set>${t}</md-chip-set>`}_renderChip(){const t=this.icon?o`<md-icon slot="icon">${this.icon}</md-icon>`:null;switch(this.variant){case"static":return o`
|
|
3
3
|
<span class="static-chip" aria-disabled=${this.disabled?"true":"false"}>
|
|
4
4
|
${t}
|
|
5
5
|
<slot>${this.label}</slot>
|
|
@@ -28,78 +28,4 @@ import{_ as v,b as f,g,h as s,y as o}from"../../vendor/vendor.js";import"../../v
|
|
|
28
28
|
>
|
|
29
29
|
${t}
|
|
30
30
|
</md-filter-chip>
|
|
31
|
-
`;default:return o``}}_toggleSelected(){this.selected=!this.selected,this.dispatchEvent(new CustomEvent("selected-changed",{detail:{selected:this.selected},bubbles:!0,composed:!0})),this._updateFormValue()}_onRemove(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("remove",{detail:{label:this.label},bubbles:!0,composed:!0}))}_forward(t){this.dispatchEvent(new CustomEvent(t.type,{detail:t.detail,bubbles:!0,composed:!0}))}_updateFormValue(){if(!this._internals)return;if(!(this.variant==="filter"&&this.selected&&!this.disabled&&this.name)){this._internals.setFormValue(null),this._internals.setValidity({});return}const t=this.value||this.label||"";this._internals.setFormValue(t,this.name),this._internals.setValidity({})}formDisabledCallback(t){this.disabled=t}mapSpacingToken(t){if(!t)return;const a=String(t).trim();if(a)return/^\d+$/.test(a)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(a,10)))})`:a}},m.formAssociated=!0,m.styles=f
|
|
32
|
-
:host {
|
|
33
|
-
display: inline-block;
|
|
34
|
-
margin-block-start: var(--scb-chip-spacing-block-start, 0);
|
|
35
|
-
margin-block-end: var(--scb-chip-spacing-block-end, 0);
|
|
36
|
-
margin-inline-start: var(--scb-chip-spacing-inline-start, 0);
|
|
37
|
-
margin-inline-end: var(--scb-chip-spacing-inline-end, 0);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/* Sätt samma färg på label för assist som är på filter */
|
|
41
|
-
:host md-assist-chip {
|
|
42
|
-
--_label-text-color: var(--md-sys-color-on-surface-variant);
|
|
43
|
-
--_hover-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
44
|
-
--_focus-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
45
|
-
--_pressed-label-text-color: var(--md-sys-color-on-surface-variant);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.static-chip {
|
|
49
|
-
--scb-static-chip-color: var(--md-sys-color-on-surface, #0F0865);
|
|
50
|
-
display: inline-flex;
|
|
51
|
-
align-items: center;
|
|
52
|
-
gap: var(--spacing-2, 4px);
|
|
53
|
-
box-sizing: border-box;
|
|
54
|
-
width: fit-content;
|
|
55
|
-
border-radius: 8px;
|
|
56
|
-
padding: 3px 11px;
|
|
57
|
-
color: var(--md-sys-color-on-surface);
|
|
58
|
-
font-family: var(--brand-font, var(--brand, "Inter"), sans-serif);
|
|
59
|
-
font-size: 14px;
|
|
60
|
-
font-style: normal;
|
|
61
|
-
font-weight: 550;
|
|
62
|
-
line-height: 22px;
|
|
63
|
-
white-space: nowrap;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
:host([static-variant='outlined']) .static-chip {
|
|
67
|
-
border: 1px solid var(--md-sys-color-outline);
|
|
68
|
-
background: transparent;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
:host(:not([static-variant='outlined'])) .static-chip,
|
|
72
|
-
:host([static-variant='filled']) .static-chip {
|
|
73
|
-
border: none;
|
|
74
|
-
background: color-mix(in srgb, var(--scb-static-chip-color) 8%, transparent);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.static-chip md-icon {
|
|
78
|
-
font-size: 18px;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/* Storlekar: små/medium/stora chips via tokens.
|
|
82
|
-
Medium (default) är Material-standardvärdena. */
|
|
83
|
-
:host([size='small']) md-assist-chip,
|
|
84
|
-
:host([size='small']) md-filter-chip {
|
|
85
|
-
--md-assist-chip-label-text-size: var(--md-sys-typescale-label-small-size);
|
|
86
|
-
--md-filter-chip-label-text-size: var(--md-sys-typescale-label-small-size);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
:host([size='medium']) md-assist-chip,
|
|
90
|
-
:host([size='medium']) md-filter-chip {
|
|
91
|
-
--md-assist-chip-label-text-size: var(--md-sys-typescale-label-medium-size);
|
|
92
|
-
--md-filter-chip-label-text-size: var(--md-sys-typescale-label-medium-size);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
:host([size='large']) md-assist-chip,
|
|
96
|
-
:host([size='large']) md-filter-chip {
|
|
97
|
-
--md-assist-chip-label-text-size: var(--md-sys-typescale-body-large-size);
|
|
98
|
-
--md-filter-chip-label-text-size: var(--md-sys-typescale-body-large-size);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/* md-icon {
|
|
102
|
-
color: var(--md-sys-color-on-surface);
|
|
103
|
-
font-size: var(--md-sys-typescale-body-large-size);
|
|
104
|
-
} */
|
|
105
|
-
`,m);function b(){const r=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop),a=this.mapSpacingToken(this.spacingBottom),c=this.mapSpacingToken(this.spacingLeft),d=this.mapSpacingToken(this.spacingRight),l=t??r,n=a??r;l?this.style.setProperty("--scb-chip-spacing-block-start",l):this.style.removeProperty("--scb-chip-spacing-block-start"),n?this.style.setProperty("--scb-chip-spacing-block-end",n):this.style.removeProperty("--scb-chip-spacing-block-end"),c?this.style.setProperty("--scb-chip-spacing-inline-start",c):this.style.removeProperty("--scb-chip-spacing-inline-start"),d?this.style.setProperty("--scb-chip-spacing-inline-end",d):this.style.removeProperty("--scb-chip-spacing-inline-end")}i([s({type:String,reflect:!0})],e.prototype,"variant",void 0);i([s({type:String,reflect:!0,attribute:"static-variant"})],e.prototype,"staticVariant",void 0);i([s({type:String})],e.prototype,"label",void 0);i([s({type:String})],e.prototype,"icon",void 0);i([s({type:Boolean,reflect:!0})],e.prototype,"disabled",void 0);i([s({type:Boolean,reflect:!0})],e.prototype,"elevated",void 0);i([s({type:Boolean,reflect:!0})],e.prototype,"removable",void 0);i([s({type:Boolean,reflect:!0})],e.prototype,"selected",void 0);i([s({type:Boolean,reflect:!0,attribute:"disable-toggle"})],e.prototype,"disableToggle",void 0);i([s({type:String})],e.prototype,"href",void 0);i([s({type:String})],e.prototype,"target",void 0);i([s({type:String})],e.prototype,"name",void 0);i([s({type:String})],e.prototype,"value",void 0);i([s({type:String,reflect:!0})],e.prototype,"spacing",void 0);i([s({type:String,reflect:!0,attribute:"spacing-top"})],e.prototype,"spacingTop",void 0);i([s({type:String,reflect:!0,attribute:"spacing-bottom"})],e.prototype,"spacingBottom",void 0);i([s({type:String,reflect:!0,attribute:"spacing-left"})],e.prototype,"spacingLeft",void 0);i([s({type:String,reflect:!0,attribute:"spacing-right"})],e.prototype,"spacingRight",void 0);i([s({type:String,reflect:!0})],e.prototype,"size",void 0);e=i([g("scb-chip")],e);
|
|
31
|
+
`;default:return o``}}_toggleSelected(){this.selected=!this.selected,this.dispatchEvent(new CustomEvent("selected-changed",{detail:{selected:this.selected},bubbles:!0,composed:!0})),this._updateFormValue()}_onRemove(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("remove",{detail:{label:this.label},bubbles:!0,composed:!0}))}_forward(t){this.dispatchEvent(new CustomEvent(t.type,{detail:t.detail,bubbles:!0,composed:!0}))}_updateFormValue(){if(!this._internals)return;if(!(this.variant==="filter"&&this.selected&&!this.disabled&&this.name)){this._internals.setFormValue(null),this._internals.setValidity({});return}const t=this.value||this.label||"";this._internals.setFormValue(t,this.name),this._internals.setValidity({})}formDisabledCallback(t){this.disabled=t}mapSpacingToken(t){if(!t)return;const a=String(t).trim();if(a)return/^\d+$/.test(a)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(a,10)))})`:a}},m.formAssociated=!0,m.styles=_`:host{display:inline-block;margin-block-start:var(--scb-chip-spacing-block-start, 0);margin-block-end:var(--scb-chip-spacing-block-end, 0);margin-inline-start:var(--scb-chip-spacing-inline-start, 0);margin-inline-end:var(--scb-chip-spacing-inline-end, 0)}:host md-assist-chip{--_label-text-color:var(--md-sys-color-on-surface-variant);--_hover-label-text-color:var(--md-sys-color-on-surface-variant);--_focus-label-text-color:var(--md-sys-color-on-surface-variant);--_pressed-label-text-color:var(--md-sys-color-on-surface-variant)}.static-chip{--scb-static-chip-color:var(--md-sys-color-on-surface, #0F0865);display:inline-flex;align-items:center;gap:var(--spacing-2, 4px);box-sizing:border-box;width:fit-content;border-radius:8px;padding:3px 11px;color:var(--md-sys-color-on-surface);font-family:var(--brand-font, var(--brand, "Inter"), sans-serif);font-size:14px;font-style:normal;font-weight:550;line-height:22px;white-space:nowrap}:host([static-variant='outlined']) .static-chip{border:1px solid var(--md-sys-color-outline);background:0 0}:host(:not([static-variant='outlined'])) .static-chip,:host([static-variant='filled']) .static-chip{border:0;background:color-mix(in srgb,var(--scb-static-chip-color) 8%,transparent)}.static-chip md-icon{font-size:18px}:host([size='small']) md-assist-chip,:host([size='small']) md-filter-chip{--md-assist-chip-label-text-size:var(--md-sys-typescale-label-small-size);--md-filter-chip-label-text-size:var(--md-sys-typescale-label-small-size)}:host([size='medium']) md-assist-chip,:host([size='medium']) md-filter-chip{--md-assist-chip-label-text-size:var(--md-sys-typescale-label-medium-size);--md-filter-chip-label-text-size:var(--md-sys-typescale-label-medium-size)}:host([size='large']) md-assist-chip,:host([size='large']) md-filter-chip{--md-assist-chip-label-text-size:var(--md-sys-typescale-body-large-size);--md-filter-chip-label-text-size:var(--md-sys-typescale-body-large-size)}`,m);function b(){const r=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop),a=this.mapSpacingToken(this.spacingBottom),c=this.mapSpacingToken(this.spacingLeft),p=this.mapSpacingToken(this.spacingRight),l=t??r,n=a??r;l?this.style.setProperty("--scb-chip-spacing-block-start",l):this.style.removeProperty("--scb-chip-spacing-block-start"),n?this.style.setProperty("--scb-chip-spacing-block-end",n):this.style.removeProperty("--scb-chip-spacing-block-end"),c?this.style.setProperty("--scb-chip-spacing-inline-start",c):this.style.removeProperty("--scb-chip-spacing-inline-start"),p?this.style.setProperty("--scb-chip-spacing-inline-end",p):this.style.removeProperty("--scb-chip-spacing-inline-end")}i([s({type:String,reflect:!0})],e.prototype,"variant",void 0);i([s({type:String,reflect:!0,attribute:"static-variant"})],e.prototype,"staticVariant",void 0);i([s({type:String})],e.prototype,"label",void 0);i([s({type:String})],e.prototype,"icon",void 0);i([s({type:Boolean,reflect:!0})],e.prototype,"disabled",void 0);i([s({type:Boolean,reflect:!0})],e.prototype,"elevated",void 0);i([s({type:Boolean,reflect:!0})],e.prototype,"removable",void 0);i([s({type:Boolean,reflect:!0})],e.prototype,"selected",void 0);i([s({type:Boolean,reflect:!0,attribute:"disable-toggle"})],e.prototype,"disableToggle",void 0);i([s({type:String})],e.prototype,"href",void 0);i([s({type:String})],e.prototype,"target",void 0);i([s({type:String})],e.prototype,"name",void 0);i([s({type:String})],e.prototype,"value",void 0);i([s({type:String,reflect:!0})],e.prototype,"spacing",void 0);i([s({type:String,reflect:!0,attribute:"spacing-top"})],e.prototype,"spacingTop",void 0);i([s({type:String,reflect:!0,attribute:"spacing-bottom"})],e.prototype,"spacingBottom",void 0);i([s({type:String,reflect:!0,attribute:"spacing-left"})],e.prototype,"spacingLeft",void 0);i([s({type:String,reflect:!0,attribute:"spacing-right"})],e.prototype,"spacingRight",void 0);i([s({type:String,reflect:!0})],e.prototype,"size",void 0);e=i([f("scb-chip")],e);export{e as ScbChip};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as q,m as A,p as d,v as E,y as I}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as p}from"../../vendor/decorate.js";import{n as F,t as n}from"../../vendor/assertClassBrand.js";import"../scb-button/scb-button.js";import{n as l,r as f,t as r}from"../../vendor/classPrivateFieldGet2.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(i,o,a){try{customElements.get(i)||t(i,o,a)}catch(g){var h=String(g||"");if(h.indexOf("already been used")===-1&&h.indexOf("NotSupportedError")===-1)throw g}}}}catch{}})();var s,b,m,v,y,u,_,x,H,c=(s=new WeakSet,b=new WeakMap,m=new WeakMap,v=new WeakMap,y=new WeakMap,u=new WeakMap,_=new WeakMap,x=new WeakMap,H=class extends q{constructor(...t){super(...t),F(this,s),f(this,b,void 0),f(this,m,void 0),f(this,v,void 0),f(this,y,void 0),f(this,u,void 0),f(this,_,void 0),f(this,x,void 0),this._contentId=`scb-collapse-content-${Math.random().toString(36).substr(2,9)}`,this.variant="elements",this.collapsedHeight=40,this.visibleElements=1,this.expanded=!1,this._elementCount=0,this.expandButtonLabel="Mer",this.collapseButtonLabel="Mindre",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.itemsGap=void 0,this._contentHeight=0,l(m,this,0),l(v,this,0),l(u,this,0),l(_,this,0)}get _regionLabel(){return`${this.expanded?this.collapseButtonLabel:this.expandButtonLabel} – ${this._contentId}`}toggle(){this.expanded=!this.expanded}mapSpacingToken(t){if(!t)return;const i=String(t).trim();if(i)return/^\d+$/.test(i)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(i,10)))})`:i}willUpdate(t){t.has("expanded")&&this.variant==="height"&&n(s,this,P).call(this,!!t.get("expanded"),this.expanded),t.has("variant")&&(this._measureContent(!1),this._countElements(!1))}firstUpdated(){requestAnimationFrame(()=>{this._measureContent(),this._countElements(),n(s,this,S).call(this),n(s,this,w).call(this)});const t=this.shadowRoot?.querySelector("slot");t&&t.addEventListener("slotchange",()=>{requestAnimationFrame(()=>{this._measureContent(),this._countElements(),n(s,this,S).call(this),n(s,this,w).call(this)})}),n(s,this,M).call(this),n(s,this,S).call(this)}updated(t){(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&n(s,this,M).call(this),t.has("itemsGap")&&(n(s,this,S).call(this),this._measureContent()),this.variant==="elements"&&!t.has("expanded")&&(t.has("variant")||t.has("visibleElements")||t.has("itemsGap"))&&(this._countElements(),n(s,this,w).call(this)),t.has("expanded")&&(n(s,this,S).call(this),this.variant==="height"?n(s,this,W).call(this):this.variant==="elements"&&n(s,this,O).call(this,!!t.get("expanded"),this.expanded),this.dispatchEvent(new CustomEvent("expandedchange",{detail:{expanded:this.expanded},bubbles:!0,composed:!0})))}_measureContent(t=!0){if(this.variant==="height"){const i=this.shadowRoot?.querySelector(".collapse-content"),o=this.shadowRoot?.querySelector("slot");if(i){const a=i.scrollHeight;a!==this._contentHeight&&(this._contentHeight=a,t&&this.requestUpdate())}else if(o){const a=o.assignedNodes({flatten:!0});let h=0;a.forEach(L=>{if(L.nodeType===Node.ELEMENT_NODE){const T=L;h+=T.offsetHeight||T.scrollHeight||0}});const g=h;g!==this._contentHeight&&(this._contentHeight=g,t&&this.requestUpdate())}}}_countElements(t=!0){if(this.variant==="elements"){const i=this.shadowRoot?.querySelector("slot");if(i){const o=i.assignedNodes({flatten:!0}).filter(a=>a.nodeType===Node.ELEMENT_NODE).length;o!==this._elementCount&&(this._elementCount=o,t&&this.requestUpdate())}}}render(){if(this.variant==="height"){const t=this.expanded?"none":`${this.collapsedHeight}px`,i=this._contentHeight>this.collapsedHeight;return E`
|
|
2
2
|
<div
|
|
3
3
|
class="collapse-content collapse-content--height ${this.expanded?"expanded":""}"
|
|
4
4
|
id="${this._contentId}"
|
|
@@ -42,46 +42,4 @@ import{_ as q,b as A,g as I,h as d,y as E}from"../../vendor/vendor.js";import"..
|
|
|
42
42
|
>
|
|
43
43
|
</scb-button>
|
|
44
44
|
`:""}
|
|
45
|
-
`}}},H.styles=A
|
|
46
|
-
:host {
|
|
47
|
-
display: block;
|
|
48
|
-
box-sizing: border-box;
|
|
49
|
-
margin-block-start: var(--scb-collapse-spacing-block-start, 0);
|
|
50
|
-
margin-block-end: var(--scb-collapse-spacing-block-end, 0);
|
|
51
|
-
margin-inline-start: var(--scb-collapse-spacing-inline-start, 0);
|
|
52
|
-
margin-inline-end: var(--scb-collapse-spacing-inline-end, 0);
|
|
53
|
-
}
|
|
54
|
-
.collapse-content {
|
|
55
|
-
overflow: hidden;
|
|
56
|
-
display: flow-root;
|
|
57
|
-
position: relative;
|
|
58
|
-
transition: max-height var(--motion-duration-medium) var(--motion-easing-standard);
|
|
59
|
-
}
|
|
60
|
-
.collapse-content--height,
|
|
61
|
-
.collapse-content--elements {
|
|
62
|
-
transition: height var(--motion-duration-medium) var(--motion-easing-standard);
|
|
63
|
-
}
|
|
64
|
-
.collapse-content.expanded {
|
|
65
|
-
max-height: none;
|
|
66
|
-
overflow: visible;
|
|
67
|
-
}
|
|
68
|
-
.collapse-content.animating {
|
|
69
|
-
overflow: hidden;
|
|
70
|
-
}
|
|
71
|
-
.collapse-gradient-overlay {
|
|
72
|
-
position: absolute;
|
|
73
|
-
left: 0;
|
|
74
|
-
right: 0;
|
|
75
|
-
bottom: 0;
|
|
76
|
-
height: 48px;
|
|
77
|
-
pointer-events: none;
|
|
78
|
-
background: linear-gradient(180deg, rgba(255,255,255,0) 0%, var(--md-sys-color-surface) 100%);
|
|
79
|
-
z-index: 1;
|
|
80
|
-
}
|
|
81
|
-
scb-button {
|
|
82
|
-
margin-top: 8px;
|
|
83
|
-
}
|
|
84
|
-
::slotted(.scb-collapsed-hidden) {
|
|
85
|
-
display: none !important;
|
|
86
|
-
}
|
|
87
|
-
`,H);function M(){const e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,i=this.mapSpacingToken(this.spacingBottom)??e,o=this.mapSpacingToken(this.spacingLeft),a=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-collapse-spacing-block-start",t):this.style.removeProperty("--scb-collapse-spacing-block-start"),i?this.style.setProperty("--scb-collapse-spacing-block-end",i):this.style.removeProperty("--scb-collapse-spacing-block-end"),o?this.style.setProperty("--scb-collapse-spacing-inline-start",o):this.style.removeProperty("--scb-collapse-spacing-inline-start"),a?this.style.setProperty("--scb-collapse-spacing-inline-end",a):this.style.removeProperty("--scb-collapse-spacing-inline-end")}function S(){const e=this.mapSpacingToken(this.itemsGap);e?this.style.setProperty("--scb-collapse-items-gap",e):this.style.removeProperty("--scb-collapse-items-gap");const t=this.shadowRoot?.querySelector("slot");t&&t.assignedNodes({flatten:!0}).filter(i=>i.nodeType===Node.ELEMENT_NODE).forEach((i,o)=>{const a=i;o===0||!e?a.style.removeProperty("margin-block-start"):a.style.setProperty("margin-block-start","var(--scb-collapse-items-gap)")})}function P(e,t){if(e===t){l(b,this,void 0);return}const i=this.shadowRoot?.querySelector(".collapse-content");if(!i){l(b,this,void 0);return}const o=i.getBoundingClientRect().height,a=Math.max(i.scrollHeight,this._contentHeight,o),h=t?a:Math.min(this.collapsedHeight,a);l(b,this,{startHeight:o,endHeight:h,expanded:t})}function B(e){r(m,this)&&(cancelAnimationFrame(r(m,this)),l(m,this,0)),r(y,this)&&(window.clearTimeout(r(y,this)),l(y,this,0));const t=e??this.shadowRoot?.querySelector(".collapse-content");t&&r(v,this)&&t.removeEventListener("transitionend",r(v,this)),l(v,this,void 0)}function $(e,t){n(s,this,B).call(this,e),e.classList.remove("animating"),e.style.removeProperty("height"),e.style.removeProperty("transition"),e.style.setProperty("max-height",t?"none":`${this.collapsedHeight}px`)}function W(){const e=this.shadowRoot?.querySelector(".collapse-content"),t=r(b,this);if(l(b,this,void 0),!e||!t)return;const i=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;if(n(s,this,B).call(this,e),i||Math.abs(t.startHeight-t.endHeight)<1){n(s,this,$).call(this,e,t.expanded);return}e.classList.add("animating"),e.style.transition="none",e.style.setProperty("max-height","none"),e.style.height=`${t.startHeight}px`,e.getBoundingClientRect(),l(v,this,o=>{o.target===e&&o.propertyName==="height"&&n(s,this,$).call(this,e,t.expanded)}),e.addEventListener("transitionend",r(v,this)),l(m,this,requestAnimationFrame(()=>{l(m,this,0),e.style.removeProperty("transition"),e.style.height=`${t.endHeight}px`})),l(y,this,window.setTimeout(()=>{n(s,this,$).call(this,e,t.expanded)},700))}function N(){const e=typeof this.visibleElements=="string"?parseInt(this.visibleElements,10):this.visibleElements;return Number.isFinite(e)?Math.max(0,Math.floor(e)):0}function C(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedNodes({flatten:!0}).filter(t=>t.nodeType===Node.ELEMENT_NODE):[]}function w(e=this.expanded){if(this.variant!=="elements")return;const t=n(s,this,N).call(this);n(s,this,C).call(this).forEach((i,o)=>{i.classList.toggle("scb-collapsed-hidden",!e&&o>=t)})}function G(e){const t=this.shadowRoot?.querySelector(".collapse-content");if(!t)return 0;const i=n(s,this,C).call(this),o=i.map(h=>h.classList.contains("scb-collapsed-hidden"));n(s,this,w).call(this,e);const a=t.scrollHeight;return i.forEach((h,g)=>{h.classList.toggle("scb-collapsed-hidden",o[g])}),a}function R(e){r(u,this)&&(cancelAnimationFrame(r(u,this)),l(u,this,0)),r(_,this)&&(window.clearTimeout(r(_,this)),l(_,this,0));const t=e??this.shadowRoot?.querySelector(".collapse-content");t&&r(x,this)&&t.removeEventListener("transitionend",r(x,this)),l(x,this,void 0)}function k(e,t){n(s,this,R).call(this,e),n(s,this,w).call(this,t),e.classList.remove("animating"),e.style.removeProperty("height"),e.style.removeProperty("transition")}function O(e,t){const i=this.shadowRoot?.querySelector(".collapse-content");if(!i||e===t){n(s,this,w).call(this,t);return}const o=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1,a=i.getBoundingClientRect().height,h=n(s,this,G).call(this,t);if(n(s,this,R).call(this,i),o||Math.abs(a-h)<1){n(s,this,k).call(this,i,t);return}i.classList.add("animating"),i.style.transition="none",i.style.height=`${a}px`,t&&n(s,this,w).call(this,!0),i.getBoundingClientRect(),l(x,this,g=>{g.target===i&&g.propertyName==="height"&&n(s,this,k).call(this,i,t)}),i.addEventListener("transitionend",r(x,this)),l(u,this,requestAnimationFrame(()=>{l(u,this,0),i.style.removeProperty("transition"),i.style.height=`${h}px`})),l(_,this,window.setTimeout(()=>{n(s,this,k).call(this,i,t)},700))}p([d({type:String})],c.prototype,"variant",void 0);p([d({type:Number,attribute:"collapsed-height",reflect:!0})],c.prototype,"collapsedHeight",void 0);p([d({type:Number,attribute:"visible-elements",reflect:!0})],c.prototype,"visibleElements",void 0);p([d({type:Boolean,reflect:!0})],c.prototype,"expanded",void 0);p([d({type:String,attribute:"expand-button-label",reflect:!0})],c.prototype,"expandButtonLabel",void 0);p([d({type:String,attribute:"collapse-button-label",reflect:!0})],c.prototype,"collapseButtonLabel",void 0);p([d({type:String,reflect:!0})],c.prototype,"spacing",void 0);p([d({type:String,attribute:"spacing-top",reflect:!0})],c.prototype,"spacingTop",void 0);p([d({type:String,attribute:"spacing-bottom",reflect:!0})],c.prototype,"spacingBottom",void 0);p([d({type:String,attribute:"spacing-left",reflect:!0})],c.prototype,"spacingLeft",void 0);p([d({type:String,attribute:"spacing-right",reflect:!0})],c.prototype,"spacingRight",void 0);p([d({type:String,attribute:"items-gap",reflect:!0})],c.prototype,"itemsGap",void 0);c=p([I("scb-collapse")],c);
|
|
45
|
+
`}}},H.styles=I`:host{display:block;box-sizing:border-box;margin-block-start:var(--scb-collapse-spacing-block-start, 0);margin-block-end:var(--scb-collapse-spacing-block-end, 0);margin-inline-start:var(--scb-collapse-spacing-inline-start, 0);margin-inline-end:var(--scb-collapse-spacing-inline-end, 0)}.collapse-content{overflow:hidden;display:flow-root;position:relative;transition:max-height var(--motion-duration-medium) var(--motion-easing-standard)}.collapse-content--elements,.collapse-content--height{transition:height var(--motion-duration-medium) var(--motion-easing-standard)}.collapse-content.expanded{max-height:none;overflow:visible}.collapse-content.animating{overflow:hidden}.collapse-gradient-overlay{position:absolute;left:0;right:0;bottom:0;height:48px;pointer-events:none;background:linear-gradient(180deg,rgba(255,255,255,0) 0%,var(--md-sys-color-surface) 100%);z-index:1}scb-button{margin-top:8px}::slotted(.scb-collapsed-hidden){display:none!important}`,H);function M(){const e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,i=this.mapSpacingToken(this.spacingBottom)??e,o=this.mapSpacingToken(this.spacingLeft),a=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-collapse-spacing-block-start",t):this.style.removeProperty("--scb-collapse-spacing-block-start"),i?this.style.setProperty("--scb-collapse-spacing-block-end",i):this.style.removeProperty("--scb-collapse-spacing-block-end"),o?this.style.setProperty("--scb-collapse-spacing-inline-start",o):this.style.removeProperty("--scb-collapse-spacing-inline-start"),a?this.style.setProperty("--scb-collapse-spacing-inline-end",a):this.style.removeProperty("--scb-collapse-spacing-inline-end")}function S(){const e=this.mapSpacingToken(this.itemsGap);e?this.style.setProperty("--scb-collapse-items-gap",e):this.style.removeProperty("--scb-collapse-items-gap");const t=this.shadowRoot?.querySelector("slot");t&&t.assignedNodes({flatten:!0}).filter(i=>i.nodeType===Node.ELEMENT_NODE).forEach((i,o)=>{const a=i;o===0||!e?a.style.removeProperty("margin-block-start"):a.style.setProperty("margin-block-start","var(--scb-collapse-items-gap)")})}function P(e,t){if(e===t){l(b,this,void 0);return}const i=this.shadowRoot?.querySelector(".collapse-content");if(!i){l(b,this,void 0);return}const o=i.getBoundingClientRect().height,a=Math.max(i.scrollHeight,this._contentHeight,o),h=t?a:Math.min(this.collapsedHeight,a);l(b,this,{startHeight:o,endHeight:h,expanded:t})}function B(e){r(m,this)&&(cancelAnimationFrame(r(m,this)),l(m,this,0)),r(v,this)&&(window.clearTimeout(r(v,this)),l(v,this,0));const t=e??this.shadowRoot?.querySelector(".collapse-content");t&&r(y,this)&&t.removeEventListener("transitionend",r(y,this)),l(y,this,void 0)}function $(e,t){n(s,this,B).call(this,e),e.classList.remove("animating"),e.style.removeProperty("height"),e.style.removeProperty("transition"),e.style.setProperty("max-height",t?"none":`${this.collapsedHeight}px`)}function W(){const e=this.shadowRoot?.querySelector(".collapse-content"),t=r(b,this);if(l(b,this,void 0),!e||!t)return;const i=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;if(n(s,this,B).call(this,e),i||Math.abs(t.startHeight-t.endHeight)<1){n(s,this,$).call(this,e,t.expanded);return}e.classList.add("animating"),e.style.transition="none",e.style.setProperty("max-height","none"),e.style.height=`${t.startHeight}px`,e.getBoundingClientRect(),l(y,this,o=>{o.target===e&&o.propertyName==="height"&&n(s,this,$).call(this,e,t.expanded)}),e.addEventListener("transitionend",r(y,this)),l(m,this,requestAnimationFrame(()=>{l(m,this,0),e.style.removeProperty("transition"),e.style.height=`${t.endHeight}px`})),l(v,this,window.setTimeout(()=>{n(s,this,$).call(this,e,t.expanded)},700))}function N(){const e=typeof this.visibleElements=="string"?parseInt(this.visibleElements,10):this.visibleElements;return Number.isFinite(e)?Math.max(0,Math.floor(e)):0}function C(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedNodes({flatten:!0}).filter(t=>t.nodeType===Node.ELEMENT_NODE):[]}function w(e=this.expanded){if(this.variant!=="elements")return;const t=n(s,this,N).call(this);n(s,this,C).call(this).forEach((i,o)=>{i.classList.toggle("scb-collapsed-hidden",!e&&o>=t)})}function G(e){const t=this.shadowRoot?.querySelector(".collapse-content");if(!t)return 0;const i=n(s,this,C).call(this),o=i.map(h=>h.classList.contains("scb-collapsed-hidden"));n(s,this,w).call(this,e);const a=t.scrollHeight;return i.forEach((h,g)=>{h.classList.toggle("scb-collapsed-hidden",o[g])}),a}function R(e){r(u,this)&&(cancelAnimationFrame(r(u,this)),l(u,this,0)),r(_,this)&&(window.clearTimeout(r(_,this)),l(_,this,0));const t=e??this.shadowRoot?.querySelector(".collapse-content");t&&r(x,this)&&t.removeEventListener("transitionend",r(x,this)),l(x,this,void 0)}function k(e,t){n(s,this,R).call(this,e),n(s,this,w).call(this,t),e.classList.remove("animating"),e.style.removeProperty("height"),e.style.removeProperty("transition")}function O(e,t){const i=this.shadowRoot?.querySelector(".collapse-content");if(!i||e===t){n(s,this,w).call(this,t);return}const o=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1,a=i.getBoundingClientRect().height,h=n(s,this,G).call(this,t);if(n(s,this,R).call(this,i),o||Math.abs(a-h)<1){n(s,this,k).call(this,i,t);return}i.classList.add("animating"),i.style.transition="none",i.style.height=`${a}px`,t&&n(s,this,w).call(this,!0),i.getBoundingClientRect(),l(x,this,g=>{g.target===i&&g.propertyName==="height"&&n(s,this,k).call(this,i,t)}),i.addEventListener("transitionend",r(x,this)),l(u,this,requestAnimationFrame(()=>{l(u,this,0),i.style.removeProperty("transition"),i.style.height=`${h}px`})),l(_,this,window.setTimeout(()=>{n(s,this,k).call(this,i,t)},700))}p([d({type:String})],c.prototype,"variant",void 0);p([d({type:Number,attribute:"collapsed-height",reflect:!0})],c.prototype,"collapsedHeight",void 0);p([d({type:Number,attribute:"visible-elements",reflect:!0})],c.prototype,"visibleElements",void 0);p([d({type:Boolean,reflect:!0})],c.prototype,"expanded",void 0);p([d({type:String,attribute:"expand-button-label",reflect:!0})],c.prototype,"expandButtonLabel",void 0);p([d({type:String,attribute:"collapse-button-label",reflect:!0})],c.prototype,"collapseButtonLabel",void 0);p([d({type:String,reflect:!0})],c.prototype,"spacing",void 0);p([d({type:String,attribute:"spacing-top",reflect:!0})],c.prototype,"spacingTop",void 0);p([d({type:String,attribute:"spacing-bottom",reflect:!0})],c.prototype,"spacingBottom",void 0);p([d({type:String,attribute:"spacing-left",reflect:!0})],c.prototype,"spacingLeft",void 0);p([d({type:String,attribute:"spacing-right",reflect:!0})],c.prototype,"spacingRight",void 0);p([d({type:String,attribute:"items-gap",reflect:!0})],c.prototype,"itemsGap",void 0);c=p([A("scb-collapse")],c);
|