scb-wc 0.1.241 → 0.1.243
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/mvc/components/scb-button/scb-button.js +1 -1
- package/mvc/components/scb-calendar-card/scb-calendar-card.js +13 -13
- package/mvc/components/scb-card/scb-card.js +2 -2
- package/mvc/components/scb-checkbox/scb-checkbox.js +14 -14
- package/mvc/components/scb-cookies-consent/scb-cookies-consent.js +2 -2
- package/mvc/components/scb-dropdown/scb-dropdown.js +20 -18
- package/mvc/components/scb-header/scb-header.js +2 -2
- package/mvc/components/scb-icon-button/scb-icon-button.js +12 -13
- package/mvc/components/scb-list/scb-list-item.js +2 -2
- package/mvc/components/scb-progress-stepper/scb-progress-stepper.js +4 -5
- package/mvc/components/scb-radio-button/scb-radio-button.js +9 -9
- package/mvc/components/scb-search/scb-search.js +4 -4
- package/mvc/components/scb-select/scb-select-option.js +2 -2
- package/mvc/components/scb-select/scb-select.js +4 -3
- package/mvc/components/scb-slider/scb-slider.js +4 -4
- package/mvc/components/scb-switch/scb-switch.js +3 -3
- package/mvc/components/scb-tooltip/scb-tooltip.js +10 -13
- package/mvc/components/scb-viz/scb-viz-print-runtime.js +10 -5
- package/mvc/components/scb-viz/scb-viz-table-runtime.js +1 -1
- package/mvc/components/scb-viz/scb-viz.js +54 -46
- 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/aria-references.internal.js +1 -0
- package/mvc/vendor/vendor.js +3 -3
- package/package.json +2 -2
- package/scb-button/scb-button.js +61 -61
- package/scb-calendar-card/scb-calendar-card.js +50 -50
- package/scb-checkbox/scb-checkbox.js +11 -9
- package/scb-components/scb-dropdown/scb-dropdown.d.ts +8 -1
- package/scb-components/scb-icon-button/scb-icon-button.d.ts +2 -0
- package/scb-components/scb-radio-button/scb-radio-button.d.ts +0 -1
- package/scb-components/scb-select/scb-select.d.ts +1 -1
- package/scb-components/scb-tooltip/scb-tooltip.d.ts +5 -0
- package/scb-components/scb-viz/scb-viz-print-runtime.d.ts +6 -0
- package/scb-components/scb-viz/scb-viz-table-runtime.d.ts +8 -5
- package/scb-components/scb-viz/scb-viz.d.ts +7 -4
- package/scb-dropdown/scb-dropdown.js +47 -18
- package/scb-icon-button/scb-icon-button.js +60 -47
- package/scb-progress-stepper/scb-progress-stepper.js +18 -18
- package/scb-radio-button/scb-radio-button.js +3 -11
- package/scb-search/scb-search.js +1 -1
- package/scb-select/scb-select-option.js +3 -6
- package/scb-select/scb-select.js +21 -14
- package/scb-slider/scb-slider.js +34 -33
- package/scb-switch/scb-switch.js +33 -32
- package/scb-tooltip/scb-tooltip.js +38 -16
- package/scb-viz/scb-viz-print-runtime.js +12 -3
- package/scb-viz/scb-viz-table-runtime.js +24 -12
- package/scb-viz/scb-viz.js +97 -37
- package/scb-wc-core.css +1 -1
- package/scb-wc-selfhost.css +1 -1
- package/scb-wc.bundle.js +213 -196
- package/scb-wc.css +1 -1
- package/shared/aria-references.internal.js +19 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as T,g as p,h as _,m as S,o as w,p as s,s as u,v as o,y as z}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as c}from"../../vendor/decorate.js";import{t as m}from"../../vendor/assertClassBrand.js";import{t as E}from"../../vendor/classPrivateMethodInitSpec.js";import"../../vendor/md-focus-ring.js";import{t as
|
|
1
|
+
import{d as T,g as p,h as _,m as S,o as w,p as s,s as u,v as o,y as z}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import"../../vendor/ripple.js";import{t as c}from"../../vendor/decorate.js";import{t as m}from"../../vendor/assertClassBrand.js";import{t as E}from"../../vendor/classPrivateMethodInitSpec.js";import{n as B}from"../../vendor/aria-references.internal.js";import"../../vendor/md-focus-ring.js";import{t as C}from"../../vendor/delegate.js";import{a as M,n as R,o as I,r as H,s as L,t as q}from"../../vendor/form-associated.js";import{t as O}from"../../vendor/redispatch-event.js";import{i as P,n as A,r as F}from"../../vendor/validator.js";import{t as D}from"../../vendor/checkbox-validator.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(r,a,n){try{customElements.get(r)||e(r,a,n)}catch(v){var l=String(v||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw v}}}}catch{}})();var V=Symbol("dispatchHooks");function j(t,e){const r=t[V];if(!r)throw new Error(`'${t.type}' event needs setupDispatchHooks().`);r.addEventListener("after",e)}var k=new WeakMap;function G(t,...e){let r=k.get(t);r||(r=new Set,k.set(t,r));for(const a of e){if(r.has(a))continue;let n=!1;t.addEventListener(a,l=>{if(n)return;l.stopImmediatePropagation();const v=Reflect.construct(l.constructor,[l.type,l]),f=new EventTarget;v[V]=f,n=!0;const $=t.dispatchEvent(v);n=!1,$||l.preventDefault(),f.dispatchEvent(new Event("after"))},{capture:!0}),r.add(a)}}var U=P(H(M(_))),h=class extends U{constructor(){super(),this.selected=!1,this.icons=!1,this.showOnlySelectedIcon=!1,this.required=!1,this.value="on",this.addEventListener("click",t=>{!L(t)||!this.input||(this.focus(),I(this.input))}),G(this,"keydown"),this.addEventListener("keydown",t=>{j(t,()=>{t.defaultPrevented||t.key!=="Enter"||this.disabled||!this.input||this.input.click()})})}render(){return o`
|
|
2
2
|
<div class="switch ${w(this.getRenderClasses())}">
|
|
3
3
|
<input
|
|
4
4
|
id="switch"
|
|
@@ -42,8 +42,8 @@ import{d as T,g as p,h as _,m as S,o as w,p as s,s as u,v as o,y as z}from"../..
|
|
|
42
42
|
d="M6.4 19.2 4.8 17.6 10.4 12 4.8 6.4 6.4 4.8 12 10.4 17.6 4.8 19.2 6.4 13.6 12 19.2 17.6 17.6 19.2 12 13.6Z" />
|
|
43
43
|
</svg>
|
|
44
44
|
</slot>
|
|
45
|
-
`}renderTouchTarget(){return o`<span class="touch"></span>`}shouldShowIcons(){return this.icons||this.showOnlySelectedIcon}handleInput(t){const e=t.target;this.selected=e.checked}handleChange(t){q(this,t)}[M](){return this.selected?this.value:null}[H](){return String(this.selected)}formResetCallback(){this.selected=this.hasAttribute("selected")}formStateRestoreCallback(t){this.selected=t==="true"}[P](){return new F(()=>({checked:this.selected,required:this.required}))}[A](){return this.input}};B(h);h.shadowRootOptions={mode:"open",delegatesFocus:!0};u([s({type:Boolean})],h.prototype,"selected",void 0);u([s({type:Boolean})],h.prototype,"icons",void 0);u([s({type:Boolean,attribute:"show-only-selected-icon"})],h.prototype,"showOnlySelectedIcon",void 0);u([s({type:Boolean})],h.prototype,"required",void 0);u([s()],h.prototype,"value",void 0);u([T("input")],h.prototype,"input",void 0);var U=z`@layer styles, hcm;@layer styles{:host{display:inline-flex;outline:none;vertical-align:top;-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-switch-track-height, 32px))/2) 0px}md-focus-ring{--md-focus-ring-shape-start-start: var(--md-switch-track-shape-start-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-start-end: var(--md-switch-track-shape-start-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-end-end: var(--md-switch-track-shape-end-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-end-start: var(--md-switch-track-shape-end-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)))}.switch{align-items:center;display:inline-flex;flex-shrink:0;position:relative;width:var(--md-switch-track-width, 52px);height:var(--md-switch-track-height, 32px);border-start-start-radius:var(--md-switch-track-shape-start-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-start-end-radius:var(--md-switch-track-shape-start-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-end-radius:var(--md-switch-track-shape-end-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-start-radius:var(--md-switch-track-shape-end-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)))}input{appearance:none;height:48px;outline:none;margin:0;position:absolute;width:100%;z-index:1;cursor:inherit}:host([touch-target=none]) input{display:none}}@layer styles{.track{position:absolute;width:100%;height:100%;box-sizing:border-box;border-radius:inherit;display:flex;justify-content:center;align-items:center}.track::before{content:"";display:flex;position:absolute;height:100%;width:100%;border-radius:inherit;box-sizing:border-box;transition-property:opacity,background-color;transition-timing-function:linear;transition-duration:67ms}.disabled .track{background-color:rgba(0,0,0,0);border-color:rgba(0,0,0,0)}.disabled .track::before,.disabled .track::after{transition:none;opacity:var(--md-switch-disabled-track-opacity, 0.12)}.disabled .track::before{background-clip:content-box}.selected .track::before{background-color:var(--md-switch-selected-track-color, var(--md-sys-color-primary, #6750a4))}.selected:hover .track::before{background-color:var(--md-switch-selected-hover-track-color, var(--md-sys-color-primary, #6750a4))}.selected:focus-within .track::before{background-color:var(--md-switch-selected-focus-track-color, var(--md-sys-color-primary, #6750a4))}.selected:active .track::before{background-color:var(--md-switch-selected-pressed-track-color, var(--md-sys-color-primary, #6750a4))}.selected.disabled .track{background-clip:border-box}.selected.disabled .track::before{background-color:var(--md-switch-disabled-selected-track-color, var(--md-sys-color-on-surface, #1d1b20))}.unselected .track::before{background-color:var(--md-switch-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-track-outline-color, var(--md-sys-color-outline, #79747e));border-style:solid;border-width:var(--md-switch-track-outline-width, 2px)}.unselected:hover .track::before{background-color:var(--md-switch-hover-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-hover-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected:focus-visible .track::before{background-color:var(--md-switch-focus-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-focus-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected:active .track::before{background-color:var(--md-switch-pressed-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-pressed-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected.disabled .track::before{background-color:var(--md-switch-disabled-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-disabled-track-outline-color, var(--md-sys-color-on-surface, #1d1b20))}}@layer hcm{@media(forced-colors: active){.selected .track::before{background:ButtonText;border-color:ButtonText}.disabled .track::before{border-color:GrayText;opacity:1}.disabled.selected .track::before{background:GrayText}}}@layer styles{.handle-container{display:flex;place-content:center;place-items:center;position:relative;transition:margin 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275)}.selected .handle-container{margin-inline-start:calc(var(--md-switch-track-width, 52px) - var(--md-switch-track-height, 32px))}.unselected .handle-container{margin-inline-end:calc(var(--md-switch-track-width, 52px) - var(--md-switch-track-height, 32px))}.disabled .handle-container{transition:none}.handle{border-start-start-radius:var(--md-switch-handle-shape-start-start, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-start-end-radius:var(--md-switch-handle-shape-start-end, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-end-radius:var(--md-switch-handle-shape-end-end, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-start-radius:var(--md-switch-handle-shape-end-start, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));height:var(--md-switch-handle-height, 16px);width:var(--md-switch-handle-width, 16px);transform-origin:center;transition-property:height,width;transition-duration:250ms,250ms;transition-timing-function:cubic-bezier(0.2, 0, 0, 1),cubic-bezier(0.2, 0, 0, 1);z-index:0}.handle::before{content:"";display:flex;inset:0;position:absolute;border-radius:inherit;box-sizing:border-box;transition:background-color 67ms linear}.disabled .handle,.disabled .handle::before{transition:none}.selected .handle{height:var(--md-switch-selected-handle-height, 24px);width:var(--md-switch-selected-handle-width, 24px)}.handle.with-icon{height:var(--md-switch-with-icon-handle-height, 24px);width:var(--md-switch-with-icon-handle-width, 24px)}.selected:not(.disabled):active .handle,.unselected:not(.disabled):active .handle{height:var(--md-switch-pressed-handle-height, 28px);width:var(--md-switch-pressed-handle-width, 28px);transition-timing-function:linear;transition-duration:100ms}.selected .handle::before{background-color:var(--md-switch-selected-handle-color, var(--md-sys-color-on-primary, #fff))}.selected:hover .handle::before{background-color:var(--md-switch-selected-hover-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected:focus-within .handle::before{background-color:var(--md-switch-selected-focus-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected:active .handle::before{background-color:var(--md-switch-selected-pressed-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected.disabled .handle::before{background-color:var(--md-switch-disabled-selected-handle-color, var(--md-sys-color-surface, #fef7ff));opacity:var(--md-switch-disabled-selected-handle-opacity, 1)}.unselected .handle::before{background-color:var(--md-switch-handle-color, var(--md-sys-color-outline, #79747e))}.unselected:hover .handle::before{background-color:var(--md-switch-hover-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected:focus-within .handle::before{background-color:var(--md-switch-focus-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected:active .handle::before{background-color:var(--md-switch-pressed-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected.disabled .handle::before{background-color:var(--md-switch-disabled-handle-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-switch-disabled-handle-opacity, 0.38)}md-ripple{border-radius:var(--md-switch-state-layer-shape, var(--md-sys-shape-corner-full, 9999px));height:var(--md-switch-state-layer-size, 40px);inset:unset;width:var(--md-switch-state-layer-size, 40px)}.selected md-ripple{--md-ripple-hover-color: var(--md-switch-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-pressed-color: var(--md-switch-selected-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-hover-opacity: var(--md-switch-selected-hover-state-layer-opacity, 0.08);--md-ripple-pressed-opacity: var(--md-switch-selected-pressed-state-layer-opacity, 0.12)}.unselected md-ripple{--md-ripple-hover-color: var(--md-switch-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-color: var(--md-switch-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-switch-hover-state-layer-opacity, 0.08);--md-ripple-pressed-opacity: var(--md-switch-pressed-state-layer-opacity, 0.12)}}@layer hcm{@media(forced-colors: active){.unselected .handle::before{background:ButtonText}.disabled .handle::before{opacity:1}.disabled.unselected .handle::before{background:GrayText}}}@layer styles{.icons{position:relative;height:100%;width:100%}.icon{position:absolute;inset:0;margin:auto;display:flex;align-items:center;justify-content:center;fill:currentColor;transition:fill 67ms linear,opacity 33ms linear,transform 167ms cubic-bezier(0.2, 0, 0, 1);opacity:0}.disabled .icon{transition:none}.selected .icon--on,.unselected .icon--off{opacity:1}.unselected .handle:not(.with-icon) .icon--on{transform:rotate(-45deg)}.icon--off{width:var(--md-switch-icon-size, 16px);height:var(--md-switch-icon-size, 16px);color:var(--md-switch-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:hover .icon--off{color:var(--md-switch-hover-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:focus-within .icon--off{color:var(--md-switch-focus-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:active .icon--off{color:var(--md-switch-pressed-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected.disabled .icon--off{color:var(--md-switch-disabled-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9));opacity:var(--md-switch-disabled-icon-opacity, 0.38)}.icon--on{width:var(--md-switch-selected-icon-size, 16px);height:var(--md-switch-selected-icon-size, 16px);color:var(--md-switch-selected-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:hover .icon--on{color:var(--md-switch-selected-hover-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:focus-within .icon--on{color:var(--md-switch-selected-focus-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:active .icon--on{color:var(--md-switch-selected-pressed-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected.disabled .icon--on{color:var(--md-switch-disabled-selected-icon-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-switch-disabled-selected-icon-opacity, 0.38)}}@layer hcm{@media(forced-colors: active){.icon--off{fill:Canvas}.icon--on{fill:ButtonText}.disabled.unselected .icon--off,.disabled.selected .icon--on{opacity:1}.disabled .icon--on{fill:GrayText}}}
|
|
46
|
-
`,y=class extends h{};y.styles=[
|
|
45
|
+
`}renderTouchTarget(){return o`<span class="touch"></span>`}shouldShowIcons(){return this.icons||this.showOnlySelectedIcon}handleInput(t){const e=t.target;this.selected=e.checked}handleChange(t){O(this,t)}[R](){return this.selected?this.value:null}[q](){return String(this.selected)}formResetCallback(){this.selected=this.hasAttribute("selected")}formStateRestoreCallback(t){this.selected=t==="true"}[A](){return new D(()=>({checked:this.selected,required:this.required}))}[F](){return this.input}};C(h);h.shadowRootOptions={mode:"open",delegatesFocus:!0};u([s({type:Boolean})],h.prototype,"selected",void 0);u([s({type:Boolean})],h.prototype,"icons",void 0);u([s({type:Boolean,attribute:"show-only-selected-icon"})],h.prototype,"showOnlySelectedIcon",void 0);u([s({type:Boolean})],h.prototype,"required",void 0);u([s()],h.prototype,"value",void 0);u([T("input")],h.prototype,"input",void 0);var W=z`@layer styles, hcm;@layer styles{:host{display:inline-flex;outline:none;vertical-align:top;-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-switch-track-height, 32px))/2) 0px}md-focus-ring{--md-focus-ring-shape-start-start: var(--md-switch-track-shape-start-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-start-end: var(--md-switch-track-shape-start-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-end-end: var(--md-switch-track-shape-end-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));--md-focus-ring-shape-end-start: var(--md-switch-track-shape-end-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)))}.switch{align-items:center;display:inline-flex;flex-shrink:0;position:relative;width:var(--md-switch-track-width, 52px);height:var(--md-switch-track-height, 32px);border-start-start-radius:var(--md-switch-track-shape-start-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-start-end-radius:var(--md-switch-track-shape-start-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-end-radius:var(--md-switch-track-shape-end-end, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-start-radius:var(--md-switch-track-shape-end-start, var(--md-switch-track-shape, var(--md-sys-shape-corner-full, 9999px)))}input{appearance:none;height:48px;outline:none;margin:0;position:absolute;width:100%;z-index:1;cursor:inherit}:host([touch-target=none]) input{display:none}}@layer styles{.track{position:absolute;width:100%;height:100%;box-sizing:border-box;border-radius:inherit;display:flex;justify-content:center;align-items:center}.track::before{content:"";display:flex;position:absolute;height:100%;width:100%;border-radius:inherit;box-sizing:border-box;transition-property:opacity,background-color;transition-timing-function:linear;transition-duration:67ms}.disabled .track{background-color:rgba(0,0,0,0);border-color:rgba(0,0,0,0)}.disabled .track::before,.disabled .track::after{transition:none;opacity:var(--md-switch-disabled-track-opacity, 0.12)}.disabled .track::before{background-clip:content-box}.selected .track::before{background-color:var(--md-switch-selected-track-color, var(--md-sys-color-primary, #6750a4))}.selected:hover .track::before{background-color:var(--md-switch-selected-hover-track-color, var(--md-sys-color-primary, #6750a4))}.selected:focus-within .track::before{background-color:var(--md-switch-selected-focus-track-color, var(--md-sys-color-primary, #6750a4))}.selected:active .track::before{background-color:var(--md-switch-selected-pressed-track-color, var(--md-sys-color-primary, #6750a4))}.selected.disabled .track{background-clip:border-box}.selected.disabled .track::before{background-color:var(--md-switch-disabled-selected-track-color, var(--md-sys-color-on-surface, #1d1b20))}.unselected .track::before{background-color:var(--md-switch-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-track-outline-color, var(--md-sys-color-outline, #79747e));border-style:solid;border-width:var(--md-switch-track-outline-width, 2px)}.unselected:hover .track::before{background-color:var(--md-switch-hover-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-hover-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected:focus-visible .track::before{background-color:var(--md-switch-focus-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-focus-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected:active .track::before{background-color:var(--md-switch-pressed-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-pressed-track-outline-color, var(--md-sys-color-outline, #79747e))}.unselected.disabled .track::before{background-color:var(--md-switch-disabled-track-color, var(--md-sys-color-surface-container-highest, #e6e0e9));border-color:var(--md-switch-disabled-track-outline-color, var(--md-sys-color-on-surface, #1d1b20))}}@layer hcm{@media(forced-colors: active){.selected .track::before{background:ButtonText;border-color:ButtonText}.disabled .track::before{border-color:GrayText;opacity:1}.disabled.selected .track::before{background:GrayText}}}@layer styles{.handle-container{display:flex;place-content:center;place-items:center;position:relative;transition:margin 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275)}.selected .handle-container{margin-inline-start:calc(var(--md-switch-track-width, 52px) - var(--md-switch-track-height, 32px))}.unselected .handle-container{margin-inline-end:calc(var(--md-switch-track-width, 52px) - var(--md-switch-track-height, 32px))}.disabled .handle-container{transition:none}.handle{border-start-start-radius:var(--md-switch-handle-shape-start-start, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-start-end-radius:var(--md-switch-handle-shape-start-end, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-end-radius:var(--md-switch-handle-shape-end-end, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));border-end-start-radius:var(--md-switch-handle-shape-end-start, var(--md-switch-handle-shape, var(--md-sys-shape-corner-full, 9999px)));height:var(--md-switch-handle-height, 16px);width:var(--md-switch-handle-width, 16px);transform-origin:center;transition-property:height,width;transition-duration:250ms,250ms;transition-timing-function:cubic-bezier(0.2, 0, 0, 1),cubic-bezier(0.2, 0, 0, 1);z-index:0}.handle::before{content:"";display:flex;inset:0;position:absolute;border-radius:inherit;box-sizing:border-box;transition:background-color 67ms linear}.disabled .handle,.disabled .handle::before{transition:none}.selected .handle{height:var(--md-switch-selected-handle-height, 24px);width:var(--md-switch-selected-handle-width, 24px)}.handle.with-icon{height:var(--md-switch-with-icon-handle-height, 24px);width:var(--md-switch-with-icon-handle-width, 24px)}.selected:not(.disabled):active .handle,.unselected:not(.disabled):active .handle{height:var(--md-switch-pressed-handle-height, 28px);width:var(--md-switch-pressed-handle-width, 28px);transition-timing-function:linear;transition-duration:100ms}.selected .handle::before{background-color:var(--md-switch-selected-handle-color, var(--md-sys-color-on-primary, #fff))}.selected:hover .handle::before{background-color:var(--md-switch-selected-hover-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected:focus-within .handle::before{background-color:var(--md-switch-selected-focus-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected:active .handle::before{background-color:var(--md-switch-selected-pressed-handle-color, var(--md-sys-color-primary-container, #eaddff))}.selected.disabled .handle::before{background-color:var(--md-switch-disabled-selected-handle-color, var(--md-sys-color-surface, #fef7ff));opacity:var(--md-switch-disabled-selected-handle-opacity, 1)}.unselected .handle::before{background-color:var(--md-switch-handle-color, var(--md-sys-color-outline, #79747e))}.unselected:hover .handle::before{background-color:var(--md-switch-hover-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected:focus-within .handle::before{background-color:var(--md-switch-focus-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected:active .handle::before{background-color:var(--md-switch-pressed-handle-color, var(--md-sys-color-on-surface-variant, #49454f))}.unselected.disabled .handle::before{background-color:var(--md-switch-disabled-handle-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-switch-disabled-handle-opacity, 0.38)}md-ripple{border-radius:var(--md-switch-state-layer-shape, var(--md-sys-shape-corner-full, 9999px));height:var(--md-switch-state-layer-size, 40px);inset:unset;width:var(--md-switch-state-layer-size, 40px)}.selected md-ripple{--md-ripple-hover-color: var(--md-switch-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-pressed-color: var(--md-switch-selected-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-hover-opacity: var(--md-switch-selected-hover-state-layer-opacity, 0.08);--md-ripple-pressed-opacity: var(--md-switch-selected-pressed-state-layer-opacity, 0.12)}.unselected md-ripple{--md-ripple-hover-color: var(--md-switch-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-color: var(--md-switch-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-switch-hover-state-layer-opacity, 0.08);--md-ripple-pressed-opacity: var(--md-switch-pressed-state-layer-opacity, 0.12)}}@layer hcm{@media(forced-colors: active){.unselected .handle::before{background:ButtonText}.disabled .handle::before{opacity:1}.disabled.unselected .handle::before{background:GrayText}}}@layer styles{.icons{position:relative;height:100%;width:100%}.icon{position:absolute;inset:0;margin:auto;display:flex;align-items:center;justify-content:center;fill:currentColor;transition:fill 67ms linear,opacity 33ms linear,transform 167ms cubic-bezier(0.2, 0, 0, 1);opacity:0}.disabled .icon{transition:none}.selected .icon--on,.unselected .icon--off{opacity:1}.unselected .handle:not(.with-icon) .icon--on{transform:rotate(-45deg)}.icon--off{width:var(--md-switch-icon-size, 16px);height:var(--md-switch-icon-size, 16px);color:var(--md-switch-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:hover .icon--off{color:var(--md-switch-hover-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:focus-within .icon--off{color:var(--md-switch-focus-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected:active .icon--off{color:var(--md-switch-pressed-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9))}.unselected.disabled .icon--off{color:var(--md-switch-disabled-icon-color, var(--md-sys-color-surface-container-highest, #e6e0e9));opacity:var(--md-switch-disabled-icon-opacity, 0.38)}.icon--on{width:var(--md-switch-selected-icon-size, 16px);height:var(--md-switch-selected-icon-size, 16px);color:var(--md-switch-selected-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:hover .icon--on{color:var(--md-switch-selected-hover-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:focus-within .icon--on{color:var(--md-switch-selected-focus-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected:active .icon--on{color:var(--md-switch-selected-pressed-icon-color, var(--md-sys-color-on-primary-container, #21005d))}.selected.disabled .icon--on{color:var(--md-switch-disabled-selected-icon-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-switch-disabled-selected-icon-opacity, 0.38)}}@layer hcm{@media(forced-colors: active){.icon--off{fill:Canvas}.icon--on{fill:ButtonText}.disabled.unselected .icon--off,.disabled.selected .icon--on{opacity:1}.disabled .icon--on{fill:GrayText}}}
|
|
46
|
+
`,y=class extends h{};y.styles=[W];y=u([S("md-switch")],y);var d,g,i=(d=new WeakSet,g=class extends _{constructor(){super(),E(this,d),this._internals=null,this.label="",this.ariaLabel="",this.ariaControls=null,this.ariaExpanded=null,this.icons=!1,this.selected=!1,this.required=!1,this.error=!1,this.disabled=!1,this.supportingText="",this.errorText="",this.fullWidth=!1,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this.name="",this.value="on",this._form=null,this._formResetHandler=null,this._formSubmitHandler=null,this._initialSelected=!1,this._customValidationMessage="",this._validationMessage="",this._hasValidationBeenReported=!1,"attachInternals"in this&&(this._internals=this.attachInternals())}connectedCallback(){super.connectedCallback(),this._initialSelected=this.selected,this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.selected=this._initialSelected,this.error=!1,this._hasValidationBeenReported=!1,this.__syncFormValue(),this.__syncValidity()},this._formSubmitHandler=e=>{this.reportValidity()||(e.preventDefault(),e.stopPropagation())},this._form.addEventListener("reset",this._formResetHandler,!0),this._form.addEventListener("submit",this._formSubmitHandler,!0)),this.__syncFormValue()}disconnectedCallback(){this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),this._form&&this._formSubmitHandler&&this._form.removeEventListener("submit",this._formSubmitHandler,!0),super.disconnectedCallback()}firstUpdated(){this.shadowRoot?.querySelector("md-switch")?.addEventListener("change",e=>{this.selected=e.target.selected,this.dispatchEvent(new CustomEvent("change",{detail:{selected:this.selected},bubbles:!0,composed:!0}))}),m(d,this,x).call(this)}updated(e){super.updated(e),B(this.renderRoot.querySelector("md-switch")),e.has("disabled")&&this.toggleAttribute("aria-disabled",this.disabled),(e.has("selected")||e.has("disabled")||e.has("value"))&&this.__syncFormValue(),(e.has("selected")||e.has("disabled")||e.has("required")||e.has("errorText"))&&this.__syncValidity(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&m(d,this,x).call(this)}formDisabledCallback(e){this.disabled=e,e&&(this._hasValidationBeenReported=!1)}__getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required&&!this.selected?this.errorText||"Aktivera det här valet.":""}__syncValidity(){const e=this.shadowRoot?.querySelector("md-switch"),r=this.disabled?"":this.__getValidationMessage(),a=this.error,n=this._validationMessage;if(this._internals)if(r){const l=this._customValidationMessage?{customError:!0}:{valueMissing:!0};this._internals.setValidity(l,r,e??void 0)}else this._internals.setValidity({});this._validationMessage=r,this.error=this.disabled?!1:r?this._hasValidationBeenReported||a:a&&!this._hasValidationBeenReported&&!n,this.toggleAttribute("aria-invalid",this.error),(a!==this.error||n!==this._validationMessage)&&this.requestUpdate()}checkValidity(){return this.__syncValidity(),this._internals?this._internals.checkValidity():!this.error}reportValidity(){return this._hasValidationBeenReported=!0,this.__syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(e){this._customValidationMessage=String(e??""),this.__syncValidity()}get form(){return this._internals?.form??this._form}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this.__getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}get labels(){return this._internals?.labels}__syncFormValue(){if(!this._internals)return;const e=this.disabled||!this.selected?null:this.value;this._internals.setFormValue(e)}render(){const e=this.label?.trim(),r=e||this.ariaLabel?.trim()||p,a=this.__getVisibleSupportingText(),n=a?"switch-supporting-text":void 0,l=o`
|
|
47
47
|
<span class="switch-control">
|
|
48
48
|
${o`
|
|
49
49
|
<md-switch
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-button/scb-button.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../../vendor/preload-helper.js","../../vendor/component-defaults.js","../../vendor/decorate.js","../../vendor/assertClassBrand.js","../../vendor/classPrivateMethodInitSpec.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{g as R,h as q,m as N,p,v,y as H}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{t as I}from"../../vendor/preload-helper.js";import{componentSizeToken as K}from"../shared/component-size-token.js";import{t as l}from"../../vendor/decorate.js";import{closeManualPopover as b,openManualPopover as V}from"../shared/manual-popover.js";(function(){try{var m=typeof globalThis<"u"?globalThis:window;if(!m.__scb_ce_guard_installed__){m.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(i,e,s){try{customElements.get(i)||t(i,e,s)}catch(h){var c=String(h||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var x,X=0,T="data-scb-tooltip-managed-action-size",a=(x=class extends q{constructor(...t){super(...t),this.variant="plain",this.arrow=null,this.supportingtext="",this.label="",this.trigger="hover",this.position="top",this.open=!1,this.delay=.25,this.offset=0,this.maxWidth="300px",this._hoverActive=!1,this._clickActive=!1,this._hideTimeout=null,this._triggerEl=null,this._originalPosition="top",this._tooltipId=`scb-tooltip-${++X}`,this._buttonDepsLoaded=!1,this._listeningForPositionChanges=!1,this._listeningForDismiss=!1,this._onWindowReposition=()=>{if(!this.open)return;const i=this._getTooltipElement(),e=this._triggerEl;!i||!e||this._positionTooltip(i,e)},this._onDocumentKeyDown=i=>{i.key!=="Escape"||!this.open||(this._clickActive=!1,this._hoverActive=!1,this._setOpenState(!1))},this._onDocumentPointerDown=i=>{this.open&&(i.composedPath().includes(this)||(this._clickActive=!1,this._hoverActive=!1,this._setOpenState(!1)))},this._ensureButtonDepsIfNeeded=()=>{this._syncRichActionButtonSizes(),!this._buttonDepsLoaded&&this.querySelector('[slot="scb-tooltip-button"]')&&(this._buttonDepsLoaded=!0,I(()=>import("../scb-button/scb-button.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url))},this._onTriggerMouseEnter=()=>{this._hasTooltipContent()&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTriggerMouseLeave=()=>{this._hoverActive=!1,this._clickActive||this._setOpenState(!1)},this._onTriggerFocus=()=>{this._hasTooltipContent()&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTriggerBlur=()=>{this._hoverActive=!1,this._clickActive||this._setOpenState(!1)},this._onTriggerKeyDown=i=>{i.key==="Tab"&&(this._hoverActive=!1,this._clickActive=!1,this._setOpenState(!1),b(this._getTooltipElement()))},this._onTooltipMouseEnter=()=>{this._hasTooltipContent()&&(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTooltipMouseLeave=()=>{(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!1,this._clickActive||this._setOpenState(!1))},this._onTriggerClick=()=>{this._hasTooltipContent()&&(this._clickActive=!this._clickActive,this._clickActive?this._setOpenState(!0):this._hoverActive||this._setOpenState(!1))}}_syncRichActionButtonSizes(){const t=K(this,"--scb-tooltip-design-rich-action-button-size-medium",["small","medium","large"],"medium"),i=this.querySelectorAll(':scope > scb-button[slot="scb-tooltip-button"]');for(const e of i){const s=e.getAttribute(T);if(s!==null&&e.getAttribute("size")!==s){e.removeAttribute(T);continue}(!e.hasAttribute("size")||s!==null)&&(e.setAttribute("size",t),e.setAttribute(T,t))}}firstUpdated(){this._originalPosition=this.position,this._updateDelayCss(),this._updateMaxWidthCss(),this._updateTriggerElement(),this._updateTooltipHoverListeners(),this._ensureButtonDepsIfNeeded(),this.open&&this._syncOpenState()}updated(t){if(this._syncRichActionButtonSizes(),t.has("trigger")&&(this._updateTriggerElement(),this._updateTooltipHoverListeners()),t.has("delay")&&this._updateDelayCss(),t.has("maxWidth")&&this._updateMaxWidthCss(),(t.has("supportingtext")||t.has("label")||t.has("variant"))&&(this._hasTooltipContent()||(this._hoverActive=!1,this._clickActive=!1,this.open=!1),this._updateTriggerElement(),this._updateTooltipHoverListeners()),t.has("open")){if(this.open&&!this._hasTooltipContent()){this.open=!1;return}this._syncOpenState(),this._dispatchOpenChanged()}}disconnectedCallback(){super.disconnectedCallback(),this._detachTriggerListeners();const t=this._getTooltipElement();t&&(t.removeEventListener("mouseenter",this._onTooltipMouseEnter),t.removeEventListener("mouseleave",this._onTooltipMouseLeave),b(t)),this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null),this._detachPositionListeners(),this._detachDismissListeners()}_getTooltipElement(){return this.renderRoot.querySelector(".scb-tooltip")}_syncOpenState(){const t=this._getTooltipElement();t&&(this.open?this._showTooltip(t):this._hideTooltip(t))}_setOpenState(t){if(this.open===t){t&&this._syncOpenState();return}this.open=t}_hasTooltipContent(){const t=(this.supportingtext||"").trim();return this.variant==="rich"?!!((this.label||"").trim()||t):!!t}_updateDelayCss(){const t=Number.isFinite(this.delay)?this.delay:.25;this.style.setProperty("--delay",`${t}s`)}_updateMaxWidthCss(){const t=(this.maxWidth||"").trim(),i=t.toLowerCase()==="none",e=i?"none":t||"300px";this.style.setProperty("--max-width",e),this.style.setProperty("--wrap",i?"nowrap":"normal")}_dispatchOpenChanged(){const t={open:this.open};this.dispatchEvent(new CustomEvent("open-changed",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("openchanged",{detail:t,bubbles:!0,composed:!0}))}_findTriggerElement(){const t=this.querySelector("[scb-tooltip-anchor]:not([slot])");return t||(Array.from(this.children).find(i=>i.nodeType===Node.ELEMENT_NODE)??null)}_updateTriggerElement(){const t=this._triggerEl;t&&(this._detachTriggerListeners(),t.removeAttribute("aria-describedby"));const i=this._findTriggerElement();this._triggerEl=i,i&&this._hasTooltipContent()&&(i.setAttribute("aria-describedby",this._tooltipId),i.addEventListener("keydown",this._onTriggerKeyDown),(this.trigger==="click"||this.trigger==="hover-click")&&i.addEventListener("click",this._onTriggerClick),(this.trigger==="hover"||this.trigger==="hover-click")&&(i.addEventListener("mouseenter",this._onTriggerMouseEnter),i.addEventListener("mouseleave",this._onTriggerMouseLeave),i.addEventListener("focus",this._onTriggerFocus),i.addEventListener("blur",this._onTriggerBlur)))}_updateTooltipHoverListeners(){const t=this._getTooltipElement();t&&(t.removeEventListener("mouseenter",this._onTooltipMouseEnter),t.removeEventListener("mouseleave",this._onTooltipMouseLeave),(this.trigger==="hover"||this.trigger==="hover-click")&&(t.addEventListener("mouseenter",this._onTooltipMouseEnter),t.addEventListener("mouseleave",this._onTooltipMouseLeave)))}_detachTriggerListeners(){const t=this._triggerEl;t&&(t.removeEventListener("click",this._onTriggerClick),t.removeEventListener("keydown",this._onTriggerKeyDown),t.removeEventListener("mouseenter",this._onTriggerMouseEnter),t.removeEventListener("mouseleave",this._onTriggerMouseLeave),t.removeEventListener("focus",this._onTriggerFocus),t.removeEventListener("blur",this._onTriggerBlur))}_showTooltip(t){if(!this._hasTooltipContent()){this.open=!1;return}this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null);const i=this._triggerEl;this._resetPosition(),t.classList.remove("hidden"),t.setAttribute("aria-hidden","false"),V(t,i),this._attachPositionListeners(),this._attachDismissListeners(),requestAnimationFrame(()=>{i&&this._positionTooltip(t,i),t.setAttribute("open","")})}_hideTooltip(t){t.removeAttribute("open"),t.setAttribute("aria-hidden","true"),this._detachPositionListeners(),this._detachDismissListeners(),this._scheduleHidden(t)}_attachPositionListeners(){this._listeningForPositionChanges||(this._listeningForPositionChanges=!0,window.addEventListener("resize",this._onWindowReposition,{passive:!0}),window.addEventListener("scroll",this._onWindowReposition,{passive:!0,capture:!0}))}_detachPositionListeners(){this._listeningForPositionChanges&&(this._listeningForPositionChanges=!1,window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0))}_attachDismissListeners(){this._listeningForDismiss||(this._listeningForDismiss=!0,document.addEventListener("keydown",this._onDocumentKeyDown),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0))}_detachDismissListeners(){this._listeningForDismiss&&(this._listeningForDismiss=!1,document.removeEventListener("keydown",this._onDocumentKeyDown),document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0))}_scheduleHidden(t){const i=(Number.isFinite(this.delay)?this.delay:.25)*1e3;if(i<=0){t.classList.add("hidden"),b(t);return}this._hideTimeout=window.setTimeout(()=>{t.classList.add("hidden"),b(t),this._hideTimeout=null},i)}_resetPosition(){this.position=this._originalPosition}_positionTooltip(t,i){const e=i.getBoundingClientRect(),s=t.getBoundingClientRect(),c=(this.offset??0)+8,h=8,f=h,_=window.innerHeight-h,y=h,w=window.innerWidth-h,D=o=>o>=f&&o+s.height<=_,z=o=>o>=y&&o+s.width<=w,E=(o,r,n,u)=>{let d=0;o<n&&(d+=n-o);const C=o+r;return C>u&&(d+=C-u),d},O=o=>{let r=0,n=0;switch(o){case"top":r=e.top-s.height-c,n=e.left-(s.width-e.width)/2;break;case"bottom":r=e.bottom+c,n=e.left-(s.width-e.width)/2;break;case"left":n=e.left-s.width-c,r=e.top-(s.height-e.height)/2;break;case"right":n=e.right+c,r=e.top-(s.height-e.height)/2;break}const u=E(r,s.height,f,_),d=E(n,s.width,y,w);return{pos:o,top:r,left:n,fitsV:D(r),fitsH:z(n),totalOverflow:u+d}},k=this.position==="top"||this.position==="bottom",L=this.position,S=[L,this._getOppositePosition(L),k?"left":"top",k?"right":"bottom"].map(O);let g=S.find(o=>o.fitsV&&o.fitsH)??S.reduce((o,r)=>r.totalOverflow<o.totalOverflow?r:o);const A=(o,r,n)=>Math.min(Math.max(o,r),n),M=f,P=_-s.height,$=y,B=w-s.width,F=A(g.top,M,P),W=A(g.left,$,B);t.style.top=`${F}px`,t.style.left=`${W}px`,this.position!==g.pos&&(this.position=g.pos)}_getOppositePosition(t){switch(t){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}}_onDefaultSlotChange(){this._updateTriggerElement(),this.open&&this._syncOpenState()}render(){const t=this._hasTooltipContent(),i=this.arrow?v`<svg
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-button/scb-button.js","../../vendor/vendor.js","../../vendor/vendor-lit.js","../../vendor/preload-helper.js","../../vendor/component-defaults.js","../../vendor/decorate.js","../../vendor/assertClassBrand.js","../../vendor/classPrivateMethodInitSpec.js","../../vendor/aria-references.internal.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{g as C,h as q,m as H,p as c,v as d,y as N}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import"../../vendor/icon.js";import{t as I}from"../../vendor/preload-helper.js";import{componentSizeToken as K}from"../shared/component-size-token.js";import{t as p}from"../../vendor/decorate.js";import{closeManualPopover as m,openManualPopover as j}from"../shared/manual-popover.js";(function(){try{var f=typeof globalThis<"u"?globalThis:window;if(!f.__scb_ce_guard_installed__){f.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(i,e,o){try{customElements.get(i)||t(i,e,o)}catch(h){var n=String(h||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var T,V=0,x="data-scb-tooltip-managed-action-size",l=(T=class extends q{constructor(...t){super(...t),this.variant="plain",this.arrow=null,this.supportingtext="",this.label="",this.trigger="hover",this.position="top",this.open=!1,this.delay=.25,this.offset=0,this.maxWidth="300px",this._hoverActive=!1,this._clickActive=!1,this._hideTimeout=null,this._triggerEl=null,this._originalPosition="top",this._tooltipId=`scb-tooltip-${++V}`,this._buttonDepsLoaded=!1,this._listeningForPositionChanges=!1,this._listeningForDismiss=!1,this._onWindowReposition=()=>{if(!this.open)return;const i=this._getTooltipElement(),e=this._triggerEl;!i||!e||this._positionTooltip(i,e)},this._onDocumentKeyDown=i=>{i.key!=="Escape"||!this.open||(this._clickActive=!1,this._hoverActive=!1,this._setOpenState(!1))},this._onDocumentPointerDown=i=>{this.open&&(i.composedPath().includes(this)||(this._clickActive=!1,this._hoverActive=!1,this._setOpenState(!1)))},this._ensureButtonDepsIfNeeded=()=>{this._syncRichActionButtonSizes(),!this._buttonDepsLoaded&&this.querySelector('[slot="scb-tooltip-button"]')&&(this._buttonDepsLoaded=!0,I(()=>import("../scb-button/scb-button.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url))},this._onTriggerMouseEnter=()=>{this._hasTooltipContent()&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTriggerMouseLeave=()=>{this._hoverActive=!1,this._clickActive||this._setOpenState(!1)},this._onTriggerFocus=()=>{this._hasTooltipContent()&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTriggerBlur=()=>{this._hoverActive=!1,this._clickActive||this._setOpenState(!1)},this._onTriggerKeyDown=i=>{i.key==="Tab"&&(this._hoverActive=!1,this._clickActive=!1,this._setOpenState(!1),m(this._getTooltipElement()))},this._onTooltipMouseEnter=()=>{this._hasTooltipContent()&&(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!0,this._setOpenState(!0))},this._onTooltipMouseLeave=()=>{(this.trigger==="hover"||this.trigger==="hover-click")&&(this._hoverActive=!1,this._clickActive||this._setOpenState(!1))},this._onTriggerClick=()=>{this._hasTooltipContent()&&(this._clickActive=!this._clickActive,this._clickActive?this._setOpenState(!0):this._hoverActive||this._setOpenState(!1))}}_syncRichActionButtonSizes(){const t=K(this,"--scb-tooltip-design-rich-action-button-size-medium",["small","medium","large"],"medium"),i=this.querySelectorAll(':scope > scb-button[slot="scb-tooltip-button"]');for(const e of i){const o=e.getAttribute(x);if(o!==null&&e.getAttribute("size")!==o){e.removeAttribute(x);continue}(!e.hasAttribute("size")||o!==null)&&(e.setAttribute("size",t),e.setAttribute(x,t))}}firstUpdated(){this._originalPosition=this.position,this._updateDelayCss(),this._updateMaxWidthCss(),this._updateTriggerElement(),this._updateTooltipHoverListeners(),this._ensureButtonDepsIfNeeded(),this.open&&this._syncOpenState()}updated(t){if(this._syncRichActionButtonSizes(),t.has("trigger")&&(this._updateTriggerElement(),this._updateTooltipHoverListeners()),t.has("delay")&&this._updateDelayCss(),t.has("maxWidth")&&this._updateMaxWidthCss(),(t.has("supportingtext")||t.has("label")||t.has("variant"))&&(this._hasTooltipContent()||(this._hoverActive=!1,this._clickActive=!1,this.open=!1),this._updateTriggerElement(),this._updateTooltipHoverListeners()),t.has("open")){if(this.open&&!this._hasTooltipContent()){this.open=!1;return}this._syncOpenState(),this._dispatchOpenChanged()}}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this._updateTriggerElement(),this._updateTooltipHoverListeners(),this.open&&this._syncOpenState())}disconnectedCallback(){super.disconnectedCallback(),this._detachTriggerListeners(),this._triggerEl&&this._removeTriggerDescription(this._triggerEl);const t=this._getTooltipElement();t&&(t.removeEventListener("mouseenter",this._onTooltipMouseEnter),t.removeEventListener("mouseleave",this._onTooltipMouseLeave),m(t)),this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null),this._detachPositionListeners(),this._detachDismissListeners()}_getTooltipElement(){return this.renderRoot.querySelector(".scb-tooltip")}_syncOpenState(){const t=this._getTooltipElement();t&&(this.open?this._showTooltip(t):this._hideTooltip(t))}_setOpenState(t){if(this.open===t){t&&this._syncOpenState();return}this.open=t}_getSupportingText(){return(this.supportingtext??"").replace(/<br\s*\/?>/gi,`
|
|
3
|
+
`)}_hasTooltipContent(){const t=this._getSupportingText().trim();return this.variant==="rich"?!!((this.label||"").trim()||t):!!t}_updateDelayCss(){const t=Number.isFinite(this.delay)?this.delay:.25;this.style.setProperty("--delay",`${t}s`)}_updateMaxWidthCss(){const t=(this.maxWidth||"").trim(),i=t.toLowerCase()==="none",e=i?"none":t||"300px";this.style.setProperty("--max-width",e),this.style.setProperty("--wrap",i?"nowrap":"normal")}_dispatchOpenChanged(){const t={open:this.open};this.dispatchEvent(new CustomEvent("open-changed",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("openchanged",{detail:t,bubbles:!0,composed:!0}))}_findTriggerElement(){const t=this.querySelector("[scb-tooltip-anchor]:not([slot])");return t||(Array.from(this.children).find(i=>i!==this._triggerDescription)??null)}_updateTriggerElement(){const t=this._triggerEl;t&&(this._detachTriggerListeners(),this._removeTriggerDescription(t));const i=this._findTriggerElement();this._triggerEl=i,i&&this._hasTooltipContent()&&(this._setTriggerDescription(i),i.addEventListener("keydown",this._onTriggerKeyDown),(this.trigger==="click"||this.trigger==="hover-click")&&i.addEventListener("click",this._onTriggerClick),(this.trigger==="hover"||this.trigger==="hover-click")&&(i.addEventListener("mouseenter",this._onTriggerMouseEnter),i.addEventListener("mouseleave",this._onTriggerMouseLeave),i.addEventListener("focus",this._onTriggerFocus),i.addEventListener("blur",this._onTriggerBlur)))}_setTriggerDescription(t){if(!this._triggerDescription){const o=this.ownerDocument.createElement("span");o.id=`${this._tooltipId}-description`,o.hidden=!0,this._triggerDescription=o}const i=this._triggerDescription;i.textContent=[this.variant==="rich"?this.label:"",this._getSupportingText()].join(" ").replace(/\s+/g," ").trim(),i.parentNode!==this&&this.append(i);const e=t.getAttribute("aria-describedby")?.match(/\S+/g)??[];t.setAttribute("aria-describedby",[...new Set([...e,i.id])].join(" "))}_removeTriggerDescription(t){const i=this._triggerDescription;if(!i)return;const e=t.getAttribute("aria-describedby")?.match(/\S+/g)??[];if(!e.includes(i.id))return;const o=e.filter(n=>n!==i.id);o.length?t.setAttribute("aria-describedby",o.join(" ")):t.removeAttribute("aria-describedby")}_updateTooltipHoverListeners(){const t=this._getTooltipElement();t&&(t.removeEventListener("mouseenter",this._onTooltipMouseEnter),t.removeEventListener("mouseleave",this._onTooltipMouseLeave),(this.trigger==="hover"||this.trigger==="hover-click")&&(t.addEventListener("mouseenter",this._onTooltipMouseEnter),t.addEventListener("mouseleave",this._onTooltipMouseLeave)))}_detachTriggerListeners(){const t=this._triggerEl;t&&(t.removeEventListener("click",this._onTriggerClick),t.removeEventListener("keydown",this._onTriggerKeyDown),t.removeEventListener("mouseenter",this._onTriggerMouseEnter),t.removeEventListener("mouseleave",this._onTriggerMouseLeave),t.removeEventListener("focus",this._onTriggerFocus),t.removeEventListener("blur",this._onTriggerBlur))}_showTooltip(t){if(!this._hasTooltipContent()){this.open=!1;return}this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null);const i=this._triggerEl;this._resetPosition(),t.classList.remove("hidden"),t.setAttribute("aria-hidden","false"),j(t,i),this._attachPositionListeners(),this._attachDismissListeners(),requestAnimationFrame(()=>{i&&this._positionTooltip(t,i),t.setAttribute("open","")})}_hideTooltip(t){t.removeAttribute("open"),t.setAttribute("aria-hidden","true"),this._detachPositionListeners(),this._detachDismissListeners(),this._scheduleHidden(t)}_attachPositionListeners(){this._listeningForPositionChanges||(this._listeningForPositionChanges=!0,window.addEventListener("resize",this._onWindowReposition,{passive:!0}),window.addEventListener("scroll",this._onWindowReposition,{passive:!0,capture:!0}))}_detachPositionListeners(){this._listeningForPositionChanges&&(this._listeningForPositionChanges=!1,window.removeEventListener("resize",this._onWindowReposition),window.removeEventListener("scroll",this._onWindowReposition,!0))}_attachDismissListeners(){this._listeningForDismiss||(this._listeningForDismiss=!0,document.addEventListener("keydown",this._onDocumentKeyDown),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0))}_detachDismissListeners(){this._listeningForDismiss&&(this._listeningForDismiss=!1,document.removeEventListener("keydown",this._onDocumentKeyDown),document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0))}_scheduleHidden(t){const i=(Number.isFinite(this.delay)?this.delay:.25)*1e3;if(i<=0){t.classList.add("hidden"),m(t);return}this._hideTimeout=window.setTimeout(()=>{t.classList.add("hidden"),m(t),this._hideTimeout=null},i)}_resetPosition(){this.position=this._originalPosition}_positionTooltip(t,i){const e=i.getBoundingClientRect(),o=t.getBoundingClientRect(),n=(this.offset??0)+8,h=8,g=h,_=window.innerHeight-h,y=h,w=window.innerWidth-h,z=s=>s>=g&&s+o.height<=_,O=s=>s>=y&&s+o.width<=w,k=(s,r,a,b)=>{let u=0;s<a&&(u+=a-s);const A=s+r;return A>b&&(u+=A-b),u},P=s=>{let r=0,a=0;switch(s){case"top":r=e.top-o.height-n,a=e.left-(o.width-e.width)/2;break;case"bottom":r=e.bottom+n,a=e.left-(o.width-e.width)/2;break;case"left":a=e.left-o.width-n,r=e.top-(o.height-e.height)/2;break;case"right":a=e.right+n,r=e.top-(o.height-e.height)/2;break}const b=k(r,o.height,g,_),u=k(a,o.width,y,w);return{pos:s,top:r,left:a,fitsV:z(r),fitsH:O(a),totalOverflow:b+u}},E=this.position==="top"||this.position==="bottom",L=this.position,S=[L,this._getOppositePosition(L),E?"left":"top",E?"right":"bottom"].map(P);let v=S.find(s=>s.fitsV&&s.fitsH)??S.reduce((s,r)=>r.totalOverflow<s.totalOverflow?r:s);const D=(s,r,a)=>Math.min(Math.max(s,r),a),M=g,$=_-o.height,B=y,F=w-o.width,W=D(v.top,M,$),R=D(v.left,B,F);t.style.top=`${W}px`,t.style.left=`${R}px`,this.position!==v.pos&&(this.position=v.pos)}_getOppositePosition(t){switch(t){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}}_onDefaultSlotChange(){this._updateTriggerElement(),this.open&&this._syncOpenState()}render(){const t=this._hasTooltipContent(),i=this.arrow?d`<svg
|
|
3
4
|
class="scb-tooltip-arrow"
|
|
4
5
|
xmlns="http://www.w3.org/2000/svg"
|
|
5
6
|
width="13"
|
|
@@ -11,39 +12,35 @@ import{g as R,h as q,m as N,p,v,y as H}from"../../vendor/vendor.js";import"../..
|
|
|
11
12
|
d="M6.5 6L0.5 0H12.5L6.5 6Z"
|
|
12
13
|
fill="var(--scb-tooltip-plain-surface-color, var(--md-sys-color-inverse-surface, var(--p-20)))"
|
|
13
14
|
/>
|
|
14
|
-
</svg>`:
|
|
15
|
+
</svg>`:C;if(!t)return d`<slot @slotchange=${this._onDefaultSlotChange}></slot>`;const e=this._getSupportingText().split(/\r\n?|\n/),o=this.label||e.join(" "),n=e.length===1?e[0]:e.map((h,g)=>d`${g>0?d`<br>`:C}${h}`);return this.variant==="rich"?d`
|
|
15
16
|
<div
|
|
16
17
|
id=${this._tooltipId}
|
|
17
18
|
class="scb-tooltip hidden"
|
|
18
19
|
role="tooltip"
|
|
19
|
-
aria-label=${
|
|
20
|
+
aria-label=${o}
|
|
20
21
|
aria-hidden="true"
|
|
21
22
|
>
|
|
22
23
|
<div class="scb-tooltip-text-container">
|
|
23
24
|
<label class="scb-tooltip-label">${this.label}</label>
|
|
24
|
-
<span class="scb-tooltip-supporting-text">
|
|
25
|
-
${this.supportingtext}
|
|
26
|
-
</span>
|
|
25
|
+
<span class="scb-tooltip-supporting-text">${n}</span>
|
|
27
26
|
</div>
|
|
28
27
|
<div class="scb-tooltip-button-container">
|
|
29
28
|
<slot name="scb-tooltip-button" @slotchange=${this._ensureButtonDepsIfNeeded}></slot>
|
|
30
29
|
</div>
|
|
31
30
|
</div>
|
|
32
31
|
<slot @slotchange=${this._onDefaultSlotChange}></slot>
|
|
33
|
-
`:
|
|
32
|
+
`:d`
|
|
34
33
|
<div
|
|
35
34
|
id=${this._tooltipId}
|
|
36
35
|
class="scb-tooltip hidden"
|
|
37
36
|
role="tooltip"
|
|
38
|
-
aria-label=${
|
|
37
|
+
aria-label=${o}
|
|
39
38
|
aria-hidden="true"
|
|
40
39
|
>
|
|
41
40
|
<div class="scb-tooltip-container">
|
|
42
|
-
<span class="scb-tooltip-supporting-text">
|
|
43
|
-
${this.supportingtext}
|
|
44
|
-
</span>
|
|
41
|
+
<span class="scb-tooltip-supporting-text">${n}</span>
|
|
45
42
|
</div>
|
|
46
43
|
${i}
|
|
47
44
|
</div>
|
|
48
45
|
<slot @slotchange=${this._onDefaultSlotChange}></slot>
|
|
49
|
-
|
|
46
|
+
`}},T.styles=N`:host{position:relative;display:inline-block;--delay:0.25s;--max-width:300px;--wrap:normal}.scb-tooltip{position:fixed;min-width:120px;max-width:var(--max-width);width:max-content;opacity:0;z-index:var(--scb-tooltip-z-index, var(--scb-layer-tooltip, 1000));transition:opacity var(--delay) ease-in-out,visibility var(--delay) ease-in-out}.scb-tooltip[popover]{box-sizing:border-box;margin:0;border:0;padding:0;inset:auto;overflow:visible;background:0 0}.scb-tooltip[open]{opacity:1;visibility:visible}.hidden,.scb-tooltip{visibility:hidden}.scb-tooltip-supporting-text{font-family:var(--scb-tooltip-supporting-font, var(--scb-tooltip-design-supporting-medium-font));font-size:var(--scb-tooltip-supporting-size, var(--scb-tooltip-design-supporting-medium-size));font-style:normal;line-height:var(--scb-tooltip-supporting-line-height, var(--scb-tooltip-design-supporting-medium-line-height));font-weight:var(--scb-tooltip-supporting-weight, var(--scb-tooltip-design-supporting-medium-weight));letter-spacing:var(--scb-tooltip-supporting-tracking, var(--scb-tooltip-design-supporting-medium-tracking));white-space:var(--wrap)}:host([variant='plain']) .scb-tooltip{max-width:var(--max-width)}:host([variant='plain']) .scb-tooltip-container{display:inline-flex;flex-direction:column;justify-content:center;align-items:center;background:var(--scb-tooltip-plain-surface-color, var(--md-sys-color-inverse-surface));border-radius:var(--scb-tooltip-design-plain-radius-medium);min-height:14px;width:100%}:host([variant='plain']) .scb-tooltip-supporting-text{padding:var(--scb-tooltip-design-plain-padding-block-medium) var(--scb-tooltip-design-plain-padding-inline-medium);color:var(--scb-tooltip-plain-content-color, var(--md-sys-color-inverse-on-surface))}.scb-tooltip-arrow{width:12px;height:6px;position:absolute}:host([position='top']) .scb-tooltip-arrow{left:50%;bottom:-6px;transform:translateX(-50%) rotate(0deg)}:host([position='right']) .scb-tooltip-arrow{left:-9px;top:50%;transform:translateY(-50%) rotate(90deg)}:host([position='bottom']) .scb-tooltip-arrow{left:50%;top:-6px;transform:translateX(-50%) rotate(180deg)}:host([position='left']) .scb-tooltip-arrow{left:100%;top:50%;transform:translateY(-50%) translateX(-3px) rotate(270deg)}:host([variant='plain'][arrow='false']) .scb-tooltip-arrow{display:none}:host([variant='rich']){align-items:flex-start;gap:var(--spacing-2)}:host([variant='rich']) .scb-tooltip{background:var(--scb-tooltip-rich-surface-color, var(--md-sys-color-surface-container, var(--p-95)));box-shadow:var(--scb-tooltip-shadow, var(--scb-shadow-tooltip));display:inline-flex;padding-bottom:var(--scb-tooltip-design-rich-padding-bottom-medium);flex-direction:column;align-items:flex-start;gap:var(--scb-tooltip-design-rich-gap-medium);border-radius:var(--scb-tooltip-design-rich-radius-medium);min-width:200px;max-width:var(--max-width)}:host([variant='rich']) .scb-tooltip-text-container{display:flex;min-width:220px;padding:var(--scb-tooltip-design-rich-padding-block-medium) var(--scb-tooltip-design-rich-padding-inline-medium) var(--spacing-2) var(--scb-tooltip-design-rich-padding-inline-medium);align-items:flex-start;gap:var(--spacing-2);flex-direction:column}:host([variant='rich']) .scb-tooltip-label{color:var(--scb-tooltip-rich-heading-color, var(--md-sys-color-on-surface));font-family:var(--scb-tooltip-label-font, var(--scb-tooltip-design-title-medium-font));font-size:var(--scb-tooltip-label-size, var(--scb-tooltip-design-title-medium-size));font-style:normal;font-weight:var(--scb-tooltip-label-weight, var(--scb-tooltip-design-title-medium-weight));line-height:var(--scb-tooltip-label-line-height, var(--scb-tooltip-design-title-medium-line-height));letter-spacing:var(--scb-tooltip-label-tracking, var(--scb-tooltip-design-title-medium-tracking))}:host([variant='rich']) .scb-tooltip-supporting-text{color:var(--scb-tooltip-rich-supporting-color, var(--md-sys-color-on-surface-variant, var(--scb-color-compat-tooltip-on-surface-variant)))}:host([variant='rich']) .scb-tooltip-button-container{display:flex;padding:0 var(--spacing-3);align-items:center;gap:var(--scb-tooltip-design-rich-action-gap-medium);align-self:stretch}:host{--scb-tooltip-design-plain-padding-block-medium:var(--scb-tooltip-plain-padding-block, var(--spacing-2, 4px));--scb-tooltip-design-plain-padding-inline-medium:var(--scb-tooltip-plain-padding-inline, var(--spacing-3, 8px));--scb-tooltip-design-plain-radius-medium:var(--scb-tooltip-plain-radius, var(--radius-extra-small, 4px));--scb-tooltip-design-rich-padding-block-medium:var(--scb-tooltip-rich-padding-block, var(--spacing-4, 12px));--scb-tooltip-design-rich-padding-inline-medium:var(--scb-tooltip-rich-padding-inline, var(--spacing-5, 16px));--scb-tooltip-design-rich-padding-bottom-medium:var(--scb-tooltip-rich-padding-bottom, var(--spacing-3, 8px));--scb-tooltip-design-rich-gap-medium:var(--scb-tooltip-rich-gap, var(--spacing-3, 8px));--scb-tooltip-design-rich-action-gap-medium:var(--scb-tooltip-rich-action-gap, var(--spacing-3, 8px));--scb-tooltip-design-rich-action-button-size-medium:var(--scb-tooltip-rich-action-button-size, medium);--scb-tooltip-design-rich-radius-medium:var(--scb-tooltip-rich-radius, var(--radius-medium, 12px));--scb-tooltip-design-title-medium-font:var(--scb-ui-tooltip-label-font, var(--scb-form-question-font, var(--scb-typography-label-large-font, var(--md-sys-typescale-label-large-font, var(--brand)))));--scb-tooltip-design-title-medium-size:var(--scb-ui-tooltip-label-size, var(--scb-form-question-size, var(--scb-typography-label-large-size, var(--md-sys-typescale-label-large-size, 18px))));--scb-tooltip-design-title-medium-line-height:var(--scb-ui-tooltip-label-line-height, var(--scb-form-question-line-height, var(--scb-typography-label-large-line-height, var(--md-sys-typescale-label-large-line-height, 26px))));--scb-tooltip-design-title-medium-tracking:var(--scb-ui-tooltip-label-tracking, var(--scb-form-question-letter-spacing, var(--scb-typography-label-large-tracking, var(--md-sys-typescale-label-large-tracking, var(--tracking-05, -0.3px)))));--scb-tooltip-design-title-medium-weight:var(--scb-ui-tooltip-label-weight, var(--scb-form-question-font-weight, var(--scb-typography-label-large-weight, var(--md-sys-typescale-label-large-weight, var(--weight-semibold, 600)))));--scb-tooltip-design-title-medium-letter-spacing:var(--scb-ui-tooltip-label-letter-spacing, var(--scb-ui-tooltip-label-tracking, var(--scb-form-question-letter-spacing, var(--scb-typography-label-large-tracking, var(--md-sys-typescale-label-large-tracking, var(--tracking-05, -0.3px))))));--scb-tooltip-design-title-medium-font-weight:var(--scb-ui-tooltip-label-font-weight, var(--scb-ui-tooltip-label-weight, var(--scb-form-question-font-weight, var(--scb-typography-label-large-weight, var(--md-sys-typescale-label-large-weight, var(--weight-semibold, 600))))));--scb-tooltip-design-supporting-medium-font:var(--scb-ui-tooltip-supporting-font, var(--scb-choices-supporting-font, var(--scb-form-answer-font, var(--scb-typography-body-large-font, var(--md-sys-typescale-body-large-font, var(--brand))))));--scb-tooltip-design-supporting-medium-size:var(--scb-ui-tooltip-supporting-size, var(--scb-choices-supporting-size, var(--scb-form-answer-size, var(--scb-typography-body-large-size, var(--md-sys-typescale-body-large-size, 18px)))));--scb-tooltip-design-supporting-medium-line-height:var(--scb-ui-tooltip-supporting-line-height, var(--scb-choices-supporting-line-height, var(--scb-form-answer-line-height, var(--scb-typography-body-large-line-height, var(--md-sys-typescale-body-large-line-height, 26px)))));--scb-tooltip-design-supporting-medium-tracking:var(--scb-ui-tooltip-supporting-tracking, var(--scb-choices-supporting-letter-spacing, var(--scb-form-answer-letter-spacing, var(--scb-typography-body-large-tracking, var(--md-sys-typescale-body-large-tracking, var(--tracking-05, -0.3px))))));--scb-tooltip-design-supporting-medium-weight:var(--scb-ui-tooltip-supporting-weight, var(--scb-choices-supporting-font-weight, var(--scb-form-answer-font-weight, var(--scb-typography-body-large-weight, var(--md-sys-typescale-body-large-weight, var(--weight-regular, 400))))));--scb-tooltip-design-supporting-medium-letter-spacing:var(--scb-ui-tooltip-supporting-letter-spacing, var(--scb-ui-tooltip-supporting-tracking, var(--scb-choices-supporting-letter-spacing, var(--scb-form-answer-letter-spacing, var(--scb-typography-body-large-tracking, var(--md-sys-typescale-body-large-tracking, var(--tracking-05, -0.3px)))))));--scb-tooltip-design-supporting-medium-font-weight:var(--scb-ui-tooltip-supporting-font-weight, var(--scb-ui-tooltip-supporting-weight, var(--scb-choices-supporting-font-weight, var(--scb-form-answer-font-weight, var(--scb-typography-body-large-weight, var(--md-sys-typescale-body-large-weight, var(--weight-regular, 400)))))))}`,T);p([c({type:String,reflect:!0})],l.prototype,"variant",void 0);p([c({type:Boolean,reflect:!0})],l.prototype,"arrow",void 0);p([c({type:String,attribute:"supporting-text"})],l.prototype,"supportingtext",void 0);p([c({type:String})],l.prototype,"label",void 0);p([c({type:String,reflect:!0})],l.prototype,"trigger",void 0);p([c({type:String,reflect:!0})],l.prototype,"position",void 0);p([c({type:Boolean,reflect:!0})],l.prototype,"open",void 0);p([c({type:Number,reflect:!0})],l.prototype,"delay",void 0);p([c({type:Number,reflect:!0})],l.prototype,"offset",void 0);p([c({type:String,reflect:!0,attribute:"max-width"})],l.prototype,"maxWidth",void 0);l=p([H("scb-tooltip")],l);export{l as ScbTooltip};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{t as l}from"../../vendor/runtime-colors.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var i=customElements.define.bind(customElements);customElements.define=function(e,n,r){try{customElements.get(e)||i(e,n,r)}catch(s){var a=String(s||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw s}}}}catch{}})();var b="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;white-space:nowrap;clip:rect(0, 0, 0, 0);clip-path:inset(50%);border:0;";function d(t){return t===0?"Radrubrik":`Kolumn ${t+1}`}function p(t){return(t??"").replace(/\s+/g," ").trim()}function v(t,i,e,n){const r=t.html||e(t.text);if(p(r))return r;const a=n.getEmptyHeaderLabel?.(i)??d(i);return`<span class="visually-hidden" style="${b}">${e(a)}</span>`}function m(t,i,e={}){return`<table class="scb-viz-print-table">${t.headers.length?`<thead><tr>${t.headers.map((n,r)=>`<th scope="col" class="${t.alignments[r]==="right"?"align-right":"align-left"}"><span class="scb-viz-print-table-heading-text">${v(n,r,i,e)}</span></th>`).join("")}</tr></thead>`:""}${`<tbody>${t.rows.map((n,r)=>{const a=t.rowHeaderRows[r]===!0;return`<tr>${n.map((s,c)=>{const o=t.alignments[c]==="right"?"align-right":"align-left",h=s.html||i(s.text);return c===0&&a?`<th scope="row" class="${o}">${h}</th>`:`<td class="${o}">${h}</td>`}).join("")}</tr>`}).join("")}</tbody>`}</table>`}function
|
|
1
|
+
import{t as l}from"../../vendor/runtime-colors.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var i=customElements.define.bind(customElements);customElements.define=function(e,n,r){try{customElements.get(e)||i(e,n,r)}catch(s){var a=String(s||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw s}}}}catch{}})();var b="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;white-space:nowrap;clip:rect(0, 0, 0, 0);clip-path:inset(50%);border:0;";function d(t){return t===0?"Radrubrik":`Kolumn ${t+1}`}function p(t){return(t??"").replace(/\s+/g," ").trim()}function v(t,i,e,n){const r=t.html||e(t.text);if(p(r))return r;const a=n.getEmptyHeaderLabel?.(i)??d(i);return`<span class="visually-hidden" style="${b}">${e(a)}</span>`}function m(t,i,e={}){return`<table class="scb-viz-print-table">${t.headers.length?`<thead><tr>${t.headers.map((n,r)=>`<th scope="col" class="${t.alignments[r]==="right"?"align-right":"align-left"}"><span class="scb-viz-print-table-heading-text">${v(n,r,i,e)}</span></th>`).join("")}</tr></thead>`:""}${`<tbody>${t.rows.map((n,r)=>{const a=t.rowHeaderRows[r]===!0;return`<tr>${n.map((s,c)=>{const o=t.alignments[c]==="right"?"align-right":"align-left",h=s.html||i(s.text);return c===0&&a?`<th scope="row" class="${o}">${h}</th>`:`<td class="${o}">${h}</td>`}).join("")}</tr>`}).join("")}</tbody>`}</table>`}function u(t){const i=[];if(t.description&&i.push(`
|
|
2
2
|
<section class="print-section">
|
|
3
3
|
<h2>${t.escapeHtml(t.descriptionLabel)}</h2>
|
|
4
4
|
<div class="body-text-rich">${t.renderRichTextHtml(t.description)}</div>
|
|
5
5
|
</section>
|
|
6
|
-
`),t.comment||t.source||t.footnote||t.officialStatistics){const e=[];t.comment&&e.push(`
|
|
6
|
+
`),t.comment||t.source||t.sourceDataLink||t.footnote||t.officialStatistics){const e=[];if(t.comment&&e.push(`
|
|
7
7
|
<section class="print-section print-meta-section">
|
|
8
8
|
<h3>${t.escapeHtml(t.commentLabel)}</h3>
|
|
9
9
|
<div class="body-text-rich">${t.renderRichTextHtml(t.comment)}</div>
|
|
@@ -13,7 +13,12 @@ import{t as l}from"../../vendor/runtime-colors.js";(function(){try{var t=typeof
|
|
|
13
13
|
<h3>${t.escapeHtml(t.sourceLabel)}</h3>
|
|
14
14
|
<div>${t.escapeHtml(t.source)}</div>
|
|
15
15
|
</section>
|
|
16
|
-
`),t.
|
|
16
|
+
`),t.sourceDataLink){const{href:n,heading:r,text:a}=t.sourceDataLink;e.push(`
|
|
17
|
+
<section class="print-section print-meta-section">
|
|
18
|
+
<h3>${t.escapeHtml(r)}</h3>
|
|
19
|
+
<a href="${t.escapeHtml(n)}">${t.escapeHtml(a)}</a>
|
|
20
|
+
</section>
|
|
21
|
+
`)}t.footnote&&e.push(`
|
|
17
22
|
<section class="print-section print-meta-section">
|
|
18
23
|
<h3>${t.escapeHtml(t.footnoteLabel)}</h3>
|
|
19
24
|
<div class="body-text-rich">${t.renderRichTextHtml(t.footnote)}</div>
|
|
@@ -25,7 +30,7 @@ import{t as l}from"../../vendor/runtime-colors.js";(function(){try{var t=typeof
|
|
|
25
30
|
<h2>${t.escapeHtml(t.moreAboutStatsLabel)}</h2>
|
|
26
31
|
${e.join("")}
|
|
27
32
|
</section>
|
|
28
|
-
`)}return i.join("")}function
|
|
33
|
+
`)}return i.join("")}function z(t){const i=t.escapeHtml;return`<!doctype html>
|
|
29
34
|
<html lang="${i(t.lang||"sv")}">
|
|
30
35
|
<head>
|
|
31
36
|
<meta charset="utf-8">
|
|
@@ -126,4 +131,4 @@ import{t as l}from"../../vendor/runtime-colors.js";(function(){try{var t=typeof
|
|
|
126
131
|
${t.footerHtml||""}
|
|
127
132
|
</article>
|
|
128
133
|
</body>
|
|
129
|
-
</html>`}export{
|
|
134
|
+
</html>`}export{z as buildScbVizPrintDocumentHtml,u as buildScbVizPrintableFooterHtml,m as buildScbVizPrintableTableHtml};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var n=customElements.define.bind(customElements);customElements.define=function(r,t,o){try{customElements.get(r)||n(r,t,o)}catch(a){var l=String(a||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var p=new Set(["a","b","br","em","i","strong","sub","sup","u"]),w=new Set(["http:","https:","mailto:","tel:"]),y=new Set(["_blank","_self"]),A=new Set(["nofollow","noopener","noreferrer"]);function S(e){const n=(e??"").trim();if(!n)return null;const r=n.replace(/[\u0000-\u0020\u007f-\u009f]/g,""),t=/^[a-z][a-z0-9+.-]*:/i.exec(r)?.[0].toLowerCase();return t&&!w.has(t)?null:n}function v(e){const n=S(e.getAttribute("href")),r=(e.getAttribute("target")??"").trim().toLowerCase(),t=(e.getAttribute("rel")??"").toLowerCase().split(/\s+/).filter(l=>A.has(l));if(!n){e.removeAttribute("href"),e.removeAttribute("target"),e.removeAttribute("rel");return}e.setAttribute("href",n),y.has(r)?e.setAttribute("target",r):e.removeAttribute("target"),r==="_blank"&&t.push("noopener","noreferrer");const o=[...new Set(t)];o.length?e.setAttribute("rel",o.join(" ")):e.removeAttribute("rel")}function x(e){const n=e.trim();if(!n||typeof document>"u")return
|
|
1
|
+
(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var n=customElements.define.bind(customElements);customElements.define=function(r,t,o){try{customElements.get(r)||n(r,t,o)}catch(a){var l=String(a||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var p=new Set(["a","b","br","em","i","strong","sub","sup","u"]),w=new Set(["http:","https:","mailto:","tel:"]),y=new Set(["_blank","_self"]),A=new Set(["nofollow","noopener","noreferrer"]);function S(e){const n=(e??"").trim();if(!n)return null;const r=n.replace(/[\u0000-\u0020\u007f-\u009f]/g,""),t=/^[a-z][a-z0-9+.-]*:/i.exec(r)?.[0].toLowerCase();return t&&!w.has(t)?null:n}function v(e){const n=S(e.getAttribute("href")),r=(e.getAttribute("target")??"").trim().toLowerCase(),t=(e.getAttribute("rel")??"").toLowerCase().split(/\s+/).filter(l=>A.has(l));if(!n){e.removeAttribute("href"),e.removeAttribute("target"),e.removeAttribute("rel");return}e.setAttribute("href",n),y.has(r)?e.setAttribute("target",r):e.removeAttribute("target"),r==="_blank"&&t.push("noopener","noreferrer");const o=[...new Set(t)];o.length?e.setAttribute("rel",o.join(" ")):e.removeAttribute("rel")}function x(e){const n=e.trim();if(!n||typeof document>"u")return;const r=document.createElement("template");return r.innerHTML=n,r.content.querySelectorAll("base, button, embed, form, iframe, input, link, math, meta, object, script, select, style, svg, template, textarea").forEach(t=>t.remove()),Array.from(r.content.querySelectorAll("*")).reverse().forEach(t=>{const o=t.tagName.toLowerCase();if(!p.has(o)){t.replaceWith(...Array.from(t.childNodes));return}Array.from(t.attributes).forEach(l=>{o==="a"&&["href","rel","target","title"].includes(l.name.toLowerCase())||t.removeAttribute(l.name)}),o==="a"&&v(t)}),r}function m(e){if(e&&typeof e=="object"&&"html"in e&&"text"in e){const n=typeof e.html=="string"?x(e.html):void 0;return{html:n?.innerHTML.trim()??"",text:typeof e.text=="string"?e.text:"",fragment:n?.content}}return{html:"",text:e==null?"":String(e)}}function T(e){if(!e)return;const n=e.assignedElements({flatten:!0}),r=[];n.forEach(s=>{if(s.tagName==="TABLE"){r.push(s);return}s.querySelectorAll("table").forEach(c=>r.push(c))});const t=r[0];if(!t)return;const o=[],l=[],a=[],i=s=>s?(s.textContent??"").replace(/\s+/g," ").trim():"",h=s=>{if(!s)return{html:"",text:""};const{html:c,text:f}=m({html:(s.innerHTML??"").trim(),text:i(s)});return{html:c,text:f}},u=t.querySelector("thead tr");u&&Array.from(u.querySelectorAll("th, td")).forEach(s=>{o.push(h(s))});const d=Array.from(t.querySelectorAll("tbody tr")),g=d.length>0?d:Array.from(t.querySelectorAll("tr")).filter(s=>s.closest("thead")===null);if(g.forEach(s=>{const c=Array.from(s.querySelectorAll("th, td"));if(c.length===0)return;a.push(c[0].tagName==="TH"&&s.closest("thead")===null&&s.closest("tfoot")===null);const f=[];c.forEach(b=>f.push(h(b))),l.push(f)}),!u&&l.length>0){const s=l[0],c=g[0],f=Array.from(c?.querySelectorAll("th, td")??[]);f.length>0&&f.every(b=>b.tagName==="TH")&&c?.closest("tbody")===null&&(o.splice(0,o.length,...s),l.shift(),a.shift())}return{headers:o.length>0?o:void 0,rows:l,rowHeaderRows:a.length>0?a:void 0}}function C(e,n){const r=Math.max(e.headers?.length??0,...e.rows.map(o=>o.length)),t=[];for(let o=0;o<r;o+=1){if(o===0){t.push("left");continue}const l=e.rows.map(i=>m(i[o]).text).filter(i=>i!==""&&i!==null&&i!==void 0),a=l.length>0&&l.every(i=>n(i)!==null);t.push(a?"right":"left")}return t}function z(e,n){const r=n.normalizeCell??m,t=n.formatCell??(a=>r(a)),o=n.inferAlignments(e),l=Math.max(e.headers?.length??0,...e.rows.map(a=>a.length));return{alignments:o,colCount:l,headers:(e.headers??[]).map(a=>r(a)),rows:e.rows.map(a=>{const i=a.map((h,u)=>t(h,u,o));for(;i.length<l;)i.push({html:"",text:""});return i}),rowHeaderRows:e.rowHeaderRows??[]}}function _(e,n=m){const r=[];return e.headers?.length&&r.push(e.headers.map(t=>n(t).text)),e.rows.forEach(t=>{r.push(t.map(o=>n(o).text))}),r}export{z as buildScbVizResolvedTableView,_ as createScbVizCsvRows,C as inferScbVizTableAlignments,m as normalizeScbVizRenderableCell,T as readScbVizTableDataFromSlot};
|