scb-wc-test 0.1.82 → 0.1.83
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/index.js +2 -2
- package/mvc/components/scb-textfield/scb-textfield.js +1 -1
- package/mvc/components/scb-toc/scb-toc-item.js +39 -24
- package/mvc/components/scb-toc/scb-toc.js +11 -4
- package/mvc/components/scb-tooltip/scb-tooltip.js +166 -185
- package/package.json +2 -2
- package/scb-textfield/scb-textfield.d.ts +7 -2
- package/scb-textfield/scb-textfield.js +2 -2
- package/scb-toc/scb-toc-item.d.ts +5 -0
- package/scb-toc/scb-toc-item.js +63 -43
- package/scb-toc/scb-toc.d.ts +1 -0
- package/scb-toc/scb-toc.js +25 -12
- package/scb-tooltip/scb-tooltip.d.ts +32 -19
- package/scb-tooltip/scb-tooltip.js +396 -267
- package/scb-wc-test.bundle.js +563 -560
package/index.js
CHANGED
|
@@ -55,7 +55,7 @@ import { ScbSwitch as ro } from "./scb-switch/scb-switch.js";
|
|
|
55
55
|
import { ScbPrimaryTab as eo } from "./scb-tabs/scb-primary-tab.js";
|
|
56
56
|
import { ScbSecondaryTab as co } from "./scb-tabs/scb-secondary-tab.js";
|
|
57
57
|
import { ScbTabs as mo } from "./scb-tabs/scb-tabs.js";
|
|
58
|
-
import {
|
|
58
|
+
import { ScbTextField as bo } from "./scb-textfield/scb-textfield.js";
|
|
59
59
|
import { ScbTocItem as fo } from "./scb-toc/scb-toc-item.js";
|
|
60
60
|
import { ScbToc as io } from "./scb-toc/scb-toc.js";
|
|
61
61
|
import { ScbTooltip as uo } from "./scb-tooltip/scb-tooltip.js";
|
|
@@ -118,7 +118,7 @@ export {
|
|
|
118
118
|
Hr as ScbSubMenu,
|
|
119
119
|
ro as ScbSwitch,
|
|
120
120
|
mo as ScbTabs,
|
|
121
|
-
bo as
|
|
121
|
+
bo as ScbTextField,
|
|
122
122
|
io as ScbToc,
|
|
123
123
|
fo as ScbTocItem,
|
|
124
124
|
uo as ScbTooltip,
|
|
@@ -169,4 +169,4 @@ import{_ as h}from"../../vendor/preload-helper.js";import{i as p,x as c,a as u,n
|
|
|
169
169
|
.scb-textfield.has-error-icon {
|
|
170
170
|
padding-right: 44px; /* Adjust as needed for icon size and spacing */
|
|
171
171
|
}
|
|
172
|
-
`];s([a({type:String,reflect:!0})],i.prototype,"type",2);s([a({type:String})],i.prototype,"label",2);s([a({type:String,attribute:"supporting-text"})],i.prototype,"supportingText",2);s([a({type:String,attribute:"error-text"})],i.prototype,"errorText",2);s([a({type:String,attribute:"leading-icon"})],i.prototype,"leadingIcon",2);s([a({type:String})],i.prototype,"name",2);s([a({type:String})],i.prototype,"pattern",2);s([a({type:String,attribute:"value"})],i.prototype,"value",2);s([a({type:String})],i.prototype,"underLabel",2);s([a({type:Boolean,reflect:!0})],i.prototype,"error",2);s([a({type:Boolean,reflect:!0})],i.prototype,"disabled",2);s([a({type:Boolean,reflect:!0})],i.prototype,"required",2);i=s([b("scb-textfield")],i);export{i as
|
|
172
|
+
`];s([a({type:String,reflect:!0})],i.prototype,"type",2);s([a({type:String})],i.prototype,"label",2);s([a({type:String,attribute:"supporting-text"})],i.prototype,"supportingText",2);s([a({type:String,attribute:"error-text"})],i.prototype,"errorText",2);s([a({type:String,attribute:"leading-icon"})],i.prototype,"leadingIcon",2);s([a({type:String})],i.prototype,"name",2);s([a({type:String})],i.prototype,"pattern",2);s([a({type:String,attribute:"value"})],i.prototype,"value",2);s([a({type:String})],i.prototype,"underLabel",2);s([a({type:Boolean,reflect:!0})],i.prototype,"error",2);s([a({type:Boolean,reflect:!0})],i.prototype,"disabled",2);s([a({type:Boolean,reflect:!0})],i.prototype,"required",2);i=s([b("scb-textfield")],i);export{i as ScbTextField};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as p,n as d,i as h,x as l,t as b}from"../../vendor/vendor.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-divider/scb-divider.js";import"../../vendor/
|
|
1
|
+
import{a as p,n as d,i as h,x as l,t as b}from"../../vendor/vendor.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-divider/scb-divider.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";import"../scb-tooltip/scb-tooltip.js";import"../scb-button/scb-button.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var s=customElements.define.bind(customElements);customElements.define=function(i,t,o){try{customElements.get(i)||s(i,t,o)}catch(n){var a=String(n||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var u=Object.defineProperty,m=Object.getOwnPropertyDescriptor,c=(e,s,i,t)=>{for(var o=t>1?void 0:t?m(s,i):s,a=e.length-1,n;a>=0;a--)(n=e[a])&&(o=(t?n(s,i,o):n(o))||o);return t&&o&&u(s,i,o),o};let r=class extends h{constructor(){super(...arguments),this.expanded=!1,this.label="",this.supportingText="",this.itemHref="#",this.divider=!0,this._unique=crypto.randomUUID(),this._slotHasContent=!1,this._onSlotChange=()=>{const e=this.renderRoot.querySelector("slot");this._slotHasContent=!!e&&e.assignedNodes().length>0,this.requestUpdate(),this._updateTabbable()},this.toggleAccordion=()=>{const e=this.closest("scb-toc");e?.hasAttribute("detached")||e.querySelectorAll("scb-toc-item").forEach(t=>{t!==this&&t.expanded&&(t.expanded=!1,this.toggleBottom(t),t.dispatchEvent(new CustomEvent("expanded-changed",{detail:{expanded:!1},bubbles:!0,composed:!0})))});const s=this.expanded;this.expanded=!this.expanded,this.toggleBottom(this),s!==this.expanded&&this.dispatchEvent(new CustomEvent("expanded-changed",{detail:{expanded:this.expanded},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("slotchange",this._onSlotChange)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("slotchange",this._onSlotChange)}updated(e){e.has("expanded")&&this._updateTabbable()}_updateTabbable(){if(typeof window>"u")return;const e=this.renderRoot.querySelector("slot");if(!e)return;e.assignedElements({flatten:!0}).forEach(i=>{i.matches("a,button,input,select,textarea,[tabindex]")&&(this.expanded?i.removeAttribute("tabindex"):i.setAttribute("tabindex","-1")),i.querySelectorAll?.("a,button,input,select,textarea,[tabindex]").forEach(t=>{const o=t;this.expanded?o.removeAttribute("tabindex"):o.setAttribute("tabindex","-1")})})}toggleBottom(e){const s=e.renderRoot.querySelector(".scb-toc-item-bottom");s&&(e.expanded?(s.style.maxHeight=`${s.scrollHeight}px`,setTimeout(()=>s.style.maxHeight="unset",160)):(s.style.maxHeight=`${s.scrollHeight}px`,requestAnimationFrame(()=>s.style.maxHeight="0")))}_onKeyDown(e){const s=this.closest("scb-toc"),t=Array.from(s?.querySelectorAll("scb-toc-item")||[]).map(n=>n.renderRoot.querySelector(".scb-toc-item")).filter(n=>!!n),o=e.currentTarget,a=t.indexOf(o);switch(e.key){case"Enter":case" ":e.preventDefault(),this.toggleAccordion();break;case"ArrowDown":e.preventDefault(),a<t.length-1&&t[a+1].focus();break;case"ArrowUp":e.preventDefault(),a>0&&t[a-1].focus();break;case"Home":e.preventDefault(),t.length&&t[0].focus();break;case"End":e.preventDefault(),t.length&&t[t.length-1].focus();break}}render(){const e=`bottom-${this._unique}`,s=`toc-label-${this._unique}`;return l`
|
|
2
2
|
<div
|
|
3
3
|
class="scb-toc-item"
|
|
4
4
|
role="listitem"
|
|
@@ -7,17 +7,20 @@ import{a as p,n as d,i as h,x as l,t as b}from"../../vendor/vendor.js";import"..
|
|
|
7
7
|
>
|
|
8
8
|
<div class="scb-toc-item-top">
|
|
9
9
|
<div>
|
|
10
|
-
<
|
|
10
|
+
<div class="toc-item-label-wrapper">
|
|
11
|
+
<a id=${s} class="toc-item-label" href=${this.itemHref}>${this.label}</a>
|
|
12
|
+
<md-focus-ring for=${s} inward></md-focus-ring>
|
|
13
|
+
</div>
|
|
11
14
|
<div class="supporting-text">${this.supportingText}</div>
|
|
12
15
|
</div>
|
|
13
16
|
${this._slotHasContent?l`
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
<scb-icon-button
|
|
18
|
+
icon=${this.expanded?"keyboard_arrow_up":"keyboard_arrow_down"}
|
|
19
|
+
ariaLabel=${this.expanded?"Collapse section":"Expand section"}
|
|
20
|
+
@click=${this.toggleAccordion}
|
|
21
|
+
@keydown=${this._onKeyDown}
|
|
22
|
+
></scb-icon-button>
|
|
23
|
+
`:""}
|
|
21
24
|
</div>
|
|
22
25
|
<div
|
|
23
26
|
id=${e}
|
|
@@ -28,12 +31,17 @@ import{a as p,n as d,i as h,x as l,t as b}from"../../vendor/vendor.js";import"..
|
|
|
28
31
|
${this.divider?l`<scb-divider></scb-divider>`:""}
|
|
29
32
|
</div>
|
|
30
33
|
`}};r.styles=[p`
|
|
31
|
-
.scb-toc-item-top{
|
|
32
|
-
padding: var(--spacing-5) var(--spacing-3);
|
|
34
|
+
.scb-toc-item-top {
|
|
35
|
+
padding: var(--spacing-5) var(--spacing-3);
|
|
33
36
|
display: flex;
|
|
34
37
|
gap: var(--spacing-5);
|
|
35
38
|
flex-direction: row;
|
|
36
39
|
}
|
|
40
|
+
.toc-item-label-wrapper {
|
|
41
|
+
position: relative;
|
|
42
|
+
display: block;
|
|
43
|
+
width: fit-content;
|
|
44
|
+
}
|
|
37
45
|
.toc-item-label {
|
|
38
46
|
display: block;
|
|
39
47
|
width: fit-content;
|
|
@@ -46,23 +54,30 @@ import{a as p,n as d,i as h,x as l,t as b}from"../../vendor/vendor.js";import"..
|
|
|
46
54
|
text-decoration-thickness: 1px;
|
|
47
55
|
text-underline-offset: .1578em;
|
|
48
56
|
margin-bottom: var(--spacing-3);
|
|
49
|
-
&:hover{
|
|
50
|
-
color: var(--md-sys-color-on-surface);
|
|
51
|
-
text-decoration-thickness: 2px;
|
|
52
|
-
}
|
|
53
|
-
&:focus{
|
|
54
|
-
color: var(--md-sys-color-on-surface);
|
|
55
|
-
outline-color: var(--md-sys-color-primary);
|
|
56
|
-
}
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
.toc-item-label:hover {
|
|
59
|
+
color: var(--md-sys-color-on-surface);
|
|
60
|
+
text-decoration-thickness: 2px;
|
|
61
|
+
}
|
|
62
|
+
.toc-item-label:focus {
|
|
63
|
+
color: var(--md-sys-color-on-surface);
|
|
64
|
+
outline: none;
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
.toc-item-label-wrapper md-focus-ring {
|
|
68
|
+
position: absolute;
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
71
|
+
--md-focus-ring-inward-offset: -7px;
|
|
72
|
+
}
|
|
73
|
+
scb-icon-button {
|
|
59
74
|
margin-left: auto;
|
|
60
75
|
}
|
|
61
|
-
scb-divider{
|
|
76
|
+
scb-divider {
|
|
62
77
|
margin: var(--spacing-0) var(--spacing-3);
|
|
63
78
|
}
|
|
64
|
-
.scb-toc-item-bottom {
|
|
65
|
-
font-size: var(--md-sys-typescale-body-medium-size);
|
|
79
|
+
.scb-toc-item-bottom {
|
|
80
|
+
font-size: var(--md-sys-typescale-body-medium-size);
|
|
66
81
|
line-height: var(--md-sys-typescale-body-medium-line-height); /* 150% */
|
|
67
82
|
letter-spacing: var(--md-sys-typescale-body-medium-tracking);
|
|
68
83
|
}
|
|
@@ -78,7 +93,7 @@ import{a as p,n as d,i as h,x as l,t as b}from"../../vendor/vendor.js";import"..
|
|
|
78
93
|
padding: var(--spacing-0) var(--spacing-5) var(--spacing-5) var(--spacing-9);
|
|
79
94
|
max-height: 100%;
|
|
80
95
|
}
|
|
81
|
-
.scb-toc-item{
|
|
96
|
+
.scb-toc-item {
|
|
82
97
|
color: var(--md-sys-color-on-surface);
|
|
83
98
|
}
|
|
84
99
|
`];c([d({type:Boolean})],r.prototype,"expanded",2);c([d({type:String,reflect:!0})],r.prototype,"label",2);c([d({type:String,attribute:"supporting-text"})],r.prototype,"supportingText",2);c([d({type:String,attribute:"item-href"})],r.prototype,"itemHref",2);c([d({type:Boolean,attribute:"divider"})],r.prototype,"divider",2);r=c([b("scb-toc-item")],r);
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
<div role="list">
|
|
1
|
+
import{a,n as d,i as p,x as _,t as f}from"../../vendor/vendor.js";import"./scb-toc-item.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/preload-helper.js";import"../../vendor/vendor-material.js";import"../scb-tooltip/scb-tooltip.js";import"../scb-button/scb-button.js";import"../scb-divider/scb-divider.js";(function(){try{var c=typeof globalThis<"u"?globalThis:window;if(!c.__scb_ce_guard_installed__){c.__scb_ce_guard_installed__=!0;var r=customElements.define.bind(customElements);customElements.define=function(e,s,t){try{customElements.get(e)||r(e,s,t)}catch(i){var o=String(i||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw i}}}}catch{}})();var u=Object.defineProperty,m=Object.getOwnPropertyDescriptor,n=(c,r,e,s)=>{for(var t=s>1?void 0:s?m(r,e):r,o=c.length-1,i;o>=0;o--)(i=c[o])&&(t=(s?i(r,e,t):i(t))||t);return s&&t&&u(r,e,t),t};let l=class extends p{constructor(){super(...arguments),this.detached=!1}render(){return _`
|
|
2
|
+
<div class="scb-toc-list" role="list">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
|
-
`}};l.styles=[
|
|
6
|
-
|
|
5
|
+
`}};l.styles=[a`
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.scb-toc-list {
|
|
11
|
+
display: block;
|
|
12
|
+
}
|
|
13
|
+
`];n([d({type:Boolean,reflect:!0})],l.prototype,"detached",2);l=n([f("scb-toc")],l);
|
|
@@ -1,215 +1,196 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import{a as F,n as p,i as I,x as T,E as V,t as j}from"../../vendor/vendor.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.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(o,r,i){try{customElements.get(o)||e(o,r,i)}catch(d){var h=String(d||"");if(h.indexOf("already been used")===-1&&h.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var q=Object.defineProperty,X=Object.getOwnPropertyDescriptor,c=(t,e,o,r)=>{for(var i=r>1?void 0:r?X(e,o):e,h=t.length-1,d;h>=0;h--)(d=t[h])&&(i=(r?d(e,o,i):d(i))||i);return r&&i&&q(e,o,i),i};let Y=0,l=class extends I{constructor(){super(...arguments),this.variant="plain",this.arrow=null,this.supportingtext="",this.label="",this.trigger="hover",this.position="top",this.open=!1,this.delay=1,this.offset=0,this._hoverActive=!1,this._clickActive=!1,this._hideTimeout=null,this._triggerEl=null,this._originalPosition="top",this._tooltipId=`scb-tooltip-${++Y}`,this._onTriggerMouseEnter=()=>{this._hoverActive=!0,this.open=!0},this._onTriggerMouseLeave=()=>{this._hoverActive=!1,this._clickActive||(this.open=!1)},this._onTriggerFocus=()=>{this._hoverActive=!0,this.open=!0},this._onTriggerBlur=()=>{this._hoverActive=!1,this._clickActive||(this.open=!1)},this._onTriggerClick=()=>{this._clickActive=!this._clickActive,this._clickActive?this.open=!0:this._hoverActive||(this.open=!1)}}firstUpdated(){if(this._originalPosition=this.position,this._updateDelayCss(),this._updateTriggerElement(),this.open){const t=this._getTooltipElement();t&&this._showTooltip(t)}}updated(t){if(t.has("trigger")&&this._updateTriggerElement(),t.has("delay")&&this._updateDelayCss(),t.has("open")){const e=this._getTooltipElement();if(!e)return;this.open?this._showTooltip(e):this._hideTooltip(e)}}disconnectedCallback(){super.disconnectedCallback(),this._detachTriggerListeners(),this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null)}_getTooltipElement(){return this.renderRoot.querySelector(".scb-tooltip")}_updateDelayCss(){const t=Number.isFinite(this.delay)?this.delay:1;this.style.setProperty("--delay",`${t}s`)}_findTriggerElement(){const t=this.querySelector("[scb-tooltip-button]:not([slot])");return t||(Array.from(this.children).find(o=>o.nodeType===Node.ELEMENT_NODE)??null)}_updateTriggerElement(){const t=this._triggerEl;t&&(this._detachTriggerListeners(),t.removeAttribute("aria-describedby"));const e=this._findTriggerElement();this._triggerEl=e,e&&(e.setAttribute("aria-describedby",this._tooltipId),(this.trigger==="click"||this.trigger==="hover-click")&&e.addEventListener("click",this._onTriggerClick),(this.trigger==="hover"||this.trigger==="hover-click")&&(e.addEventListener("mouseenter",this._onTriggerMouseEnter),e.addEventListener("mouseleave",this._onTriggerMouseLeave),e.addEventListener("focus",this._onTriggerFocus),e.addEventListener("blur",this._onTriggerBlur)))}_detachTriggerListeners(){const t=this._triggerEl;t&&(t.removeEventListener("click",this._onTriggerClick),t.removeEventListener("mouseenter",this._onTriggerMouseEnter),t.removeEventListener("mouseleave",this._onTriggerMouseLeave),t.removeEventListener("focus",this._onTriggerFocus),t.removeEventListener("blur",this._onTriggerBlur))}_showTooltip(t){this._hideTimeout!==null&&(window.clearTimeout(this._hideTimeout),this._hideTimeout=null);const e=this._triggerEl;this._resetPosition(),t.classList.remove("hidden"),t.setAttribute("aria-hidden","false"),requestAnimationFrame(()=>{e&&this._positionTooltip(t,e),t.setAttribute("open","")})}_hideTooltip(t){t.removeAttribute("open"),t.setAttribute("aria-hidden","true"),this._scheduleHidden(t)}_scheduleHidden(t){const e=(Number.isFinite(this.delay)?this.delay:1)*1e3;if(e<=0){t.classList.add("hidden");return}this._hideTimeout=window.setTimeout(()=>{t.classList.add("hidden"),this._hideTimeout=null},e)}_resetPosition(){this.position=this._originalPosition}_positionTooltip(t,e){const o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=this.getBoundingClientRect(),u=(this.offset??0)+8,v=8,_=v,y=window.innerHeight-v,w=v,x=window.innerWidth-v,M=s=>s>=_&&s+r.height<=y,O=s=>s>=w&&s+r.width<=x,E=(s,n,a,f)=>{let g=0;s<a&&(g+=a-s);const b=s+n;return b>f&&(g+=b-f),g},$=s=>{let n=0,a=0;switch(s){case"top":n=o.top-i.top-r.height-u,a=o.left-i.left+(o.width-r.width)/2;break;case"bottom":n=o.bottom-i.top+u,a=o.left-i.left+(o.width-r.width)/2;break;case"left":a=o.left-i.left-r.width-u,n=o.top-i.top+(o.height-r.height)/2;break;case"right":a=o.right-i.left+u,n=o.top-i.top+(o.height-r.height)/2;break}const f=n+i.top,g=a+i.left,b=E(f,r.height,_,y),R=E(g,r.width,w,x);return{pos:s,top:n,left:a,fitsV:M(f),fitsH:O(g),totalOverflow:b+R}},L=this.position==="top"||this.position==="bottom",k=this.position,P=this._getOppositePosition(k),A=[k,P,L?"left":"top",L?"right":"bottom"].map($);let m=A.find(s=>s.fitsV&&s.fitsH)??A.reduce((s,n)=>n.totalOverflow<s.totalOverflow?n:s);const C=(s,n,a)=>Math.min(Math.max(s,n),a),S=_-i.top,B=y-r.height-i.top,D=w-i.left,z=x-r.width-i.left,H=C(m.top,S,B),N=C(m.left,D,z);t.style.top=`${H}px`,t.style.left=`${N}px`,this.position!==m.pos&&(this.position=m.pos)}_getOppositePosition(t){switch(t){case"top":return"bottom";case"bottom":return"top";case"left":return"right";case"right":return"left"}}_onDefaultSlotChange(){this._updateTriggerElement()}render(){const t=this.arrow?T`<svg
|
|
2
|
+
class="scb-tooltip-arrow"
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
width="13"
|
|
5
|
+
height="6"
|
|
6
|
+
viewBox="0 0 13 6"
|
|
7
|
+
fill="none"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M6.5 6L0.5 0H12.5L6.5 6Z"
|
|
11
|
+
fill="var(--md-sys-color-inverse-surface, #0F0865)"
|
|
12
|
+
/>
|
|
13
|
+
</svg>`:V,e=this.label||this.supportingtext;return this.variant==="rich"?T`
|
|
14
|
+
<div
|
|
15
|
+
id=${this._tooltipId}
|
|
16
|
+
class="scb-tooltip hidden"
|
|
17
|
+
role="tooltip"
|
|
18
|
+
aria-label=${e}
|
|
19
|
+
aria-hidden="true"
|
|
20
|
+
>
|
|
21
|
+
<div class="scb-tooltip-text-container">
|
|
22
|
+
<label class="scb-tooltip-label">${this.label}</label>
|
|
23
|
+
<span class="scb-tooltip-supporting-text">
|
|
24
|
+
${this.supportingtext}
|
|
25
|
+
</span>
|
|
12
26
|
</div>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
:host {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
min-width: 120px;
|
|
41
|
-
max-width: 300px;
|
|
42
|
-
transition: opacity var(--delay) ease-in-out;
|
|
43
|
-
z-index: 10;
|
|
44
|
-
opacity:0;
|
|
27
|
+
<div class="scb-tooltip-button-container">
|
|
28
|
+
<slot name="scb-tooltip-button"></slot>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<slot @slotchange=${this._onDefaultSlotChange}></slot>
|
|
32
|
+
`:T`
|
|
33
|
+
<div
|
|
34
|
+
id=${this._tooltipId}
|
|
35
|
+
class="scb-tooltip hidden"
|
|
36
|
+
role="tooltip"
|
|
37
|
+
aria-label=${e}
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
>
|
|
40
|
+
<div class="scb-tooltip-container">
|
|
41
|
+
<span class="scb-tooltip-supporting-text">
|
|
42
|
+
${this.supportingtext}
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
${t}
|
|
46
|
+
</div>
|
|
47
|
+
<slot @slotchange=${this._onDefaultSlotChange}></slot>
|
|
48
|
+
`}};l.styles=F`
|
|
49
|
+
:host {
|
|
50
|
+
position: relative;
|
|
51
|
+
display: inline-block;
|
|
52
|
+
--delay: 1s;
|
|
53
|
+
}
|
|
45
54
|
|
|
46
|
-
.scb-tooltip
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
.scb-tooltip {
|
|
56
|
+
position: absolute;
|
|
57
|
+
min-width: 120px;
|
|
58
|
+
max-width: 300px;
|
|
59
|
+
opacity: 0;
|
|
60
|
+
visibility: hidden;
|
|
61
|
+
z-index: 10;
|
|
62
|
+
transition:
|
|
63
|
+
opacity var(--delay) ease-in-out,
|
|
64
|
+
visibility var(--delay) ease-in-out;
|
|
53
65
|
}
|
|
54
66
|
|
|
55
|
-
.
|
|
67
|
+
.scb-tooltip[open] {
|
|
68
|
+
opacity: 1;
|
|
69
|
+
visibility: visible;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.hidden {
|
|
56
73
|
visibility: hidden;
|
|
57
74
|
}
|
|
58
|
-
}
|
|
59
75
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
.scb-tooltip-supporting-text {
|
|
77
|
+
font-family: var(--brand-font, Inter);
|
|
78
|
+
font-size: var(--md-sys-typescale-body-small-size);
|
|
79
|
+
font-style: normal;
|
|
80
|
+
line-height: var(--md-sys-typescale-body-small-line-height);
|
|
81
|
+
letter-spacing: var(--md-sys-typescale-body-small-tracking);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
::slotted([scb-tooltip-button]) {
|
|
85
|
+
display: inline-flex;
|
|
86
|
+
}
|
|
64
87
|
|
|
65
|
-
/* Plain variant
|
|
66
|
-
:host([variant="plain"]) .scb-tooltip {
|
|
67
|
-
max-width: 184px;
|
|
68
|
-
transition: opacity var(--delay) ease-in-out;
|
|
69
|
-
opacity:0;
|
|
70
|
-
z-index: 10;
|
|
88
|
+
/* Plain variant */
|
|
71
89
|
|
|
72
|
-
.scb-tooltip
|
|
90
|
+
:host([variant='plain']) .scb-tooltip {
|
|
91
|
+
max-width: 184px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:host([variant='plain']) .scb-tooltip-container {
|
|
73
95
|
display: inline-flex;
|
|
74
96
|
flex-direction: column;
|
|
75
97
|
justify-content: center;
|
|
76
98
|
align-items: center;
|
|
77
99
|
background: var(--md-sys-color-inverse-surface);
|
|
78
|
-
border-radius: var(--md-sys-shape-corner-extra-small);
|
|
79
|
-
min-height: 14px;
|
|
80
|
-
width: 100%;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
.scb-tooltip-arrow {
|
|
88
|
-
width: 12px;
|
|
89
|
-
height: 6px;
|
|
90
|
-
position: absolute;
|
|
91
|
-
left: 50%;
|
|
92
|
-
bottom: -5px;
|
|
93
|
-
transform: translateX(-50%) rotate(0deg);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* Rich variant styles */
|
|
98
|
-
:host([variant="rich"]) {
|
|
99
|
-
align-items: flex-start;
|
|
100
|
-
gap: var(--spacing-2);
|
|
101
|
-
|
|
102
|
-
.scb-tooltip {
|
|
103
|
-
background: var(--md-sys-color-surface-container, #EBF8FF);
|
|
104
|
-
box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.20), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 4px 5px 0 rgba(0, 0, 0, 0.14);
|
|
105
|
-
display: inline-flex;
|
|
106
|
-
padding-bottom: var(--spacing-3);
|
|
107
|
-
flex-direction: column;
|
|
108
|
-
align-items: flex-start;
|
|
109
|
-
gap: var(--spacing-3);
|
|
110
|
-
border-radius: var(--md-sys-shape-corner-medium);
|
|
111
|
-
min-width: 200px;
|
|
112
|
-
max-width: 300px;
|
|
113
|
-
opacity: 0;
|
|
114
|
-
z-index: 10;
|
|
115
|
-
transition: opacity var(--delay) ease-in-out;
|
|
116
|
-
|
|
117
|
-
.scb-tooltip-text-container {
|
|
118
|
-
display: flex;
|
|
119
|
-
min-width: 220px;
|
|
120
|
-
padding: var(--spacing-4) var(--spacing-5) var(--spacing-2) var(--spacing-5);
|
|
121
|
-
align-items: flex-start;
|
|
122
|
-
gap: var(--spacing-2);
|
|
123
|
-
flex-direction: column;
|
|
124
|
-
|
|
125
|
-
.scb-tooltip-supporting-text {
|
|
126
|
-
color: var(--md-sys-color-on-surface-variant, rgba(11, 5, 68, 0.75));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.scb-tooltip-label {
|
|
130
|
-
font-family: var(--brand-font, Inter);
|
|
131
|
-
font-size: var(--md-sys-typescale-title-small-size);
|
|
132
|
-
font-style: normal;
|
|
133
|
-
font-weight: var(--weight-semibold);
|
|
134
|
-
line-height: var(--md-sys-typescale-title-small-Line-Height);
|
|
135
|
-
letter-spacing: var(--md-sys-typescale-title-small-Tracking);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.scb-tooltip-button-container {
|
|
141
|
-
display: flex;
|
|
142
|
-
padding: 0 var(--spacing-3);
|
|
143
|
-
align-items: center;
|
|
144
|
-
gap: var(--spacing-3);
|
|
145
|
-
align-self: stretch;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/* Postion styles */
|
|
150
|
-
:host([position="left"]) .scb-tooltip {
|
|
151
|
-
right: calc(anchor( left) + var(--offset));
|
|
152
|
-
align-self: center;
|
|
153
|
-
}
|
|
154
|
-
:host([position="right"]) .scb-tooltip {
|
|
155
|
-
left: calc(anchor(right) + var(--offset));
|
|
156
|
-
align-self: center;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
:host([position="top"]) .scb-tooltip,
|
|
160
|
-
:host([position="bottom"]) .scb-tooltip {
|
|
161
|
-
transform: translateY(var(--offset));
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/* Plain tooltip arrow postions */
|
|
165
|
-
:host([position="top"][arrow]) .scb-tooltip {§
|
|
166
|
-
.scb-tooltip-arrow {
|
|
167
|
-
left: 50%;
|
|
168
|
-
bottom: -6px;
|
|
169
|
-
transform: translateX(-50%) rotate(0deg);
|
|
100
|
+
border-radius: var(--md-sys-shape-corner-extra-small);
|
|
101
|
+
min-height: 14px;
|
|
102
|
+
width: 100%;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
:host([variant='plain']) .scb-tooltip-supporting-text {
|
|
106
|
+
padding: var(--spacing-2) var(--spacing-3);
|
|
107
|
+
color: var(--md-sys-color-inverse-on-surface);
|
|
170
108
|
}
|
|
171
|
-
}
|
|
172
109
|
|
|
173
|
-
:host([position="right"][arrow]) .scb-tooltip {
|
|
174
110
|
.scb-tooltip-arrow {
|
|
111
|
+
width: 12px;
|
|
112
|
+
height: 6px;
|
|
113
|
+
position: absolute;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:host([position='top']) .scb-tooltip-arrow {
|
|
117
|
+
left: 50%;
|
|
118
|
+
bottom: -6px;
|
|
119
|
+
transform: translateX(-50%) rotate(0deg);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host([position='right']) .scb-tooltip-arrow {
|
|
175
123
|
left: -9px;
|
|
176
124
|
top: 50%;
|
|
177
125
|
transform: translateY(-50%) rotate(90deg);
|
|
178
126
|
}
|
|
179
|
-
}
|
|
180
127
|
|
|
181
|
-
:host([position=
|
|
182
|
-
.scb-tooltip-arrow {
|
|
128
|
+
:host([position='bottom']) .scb-tooltip-arrow {
|
|
183
129
|
left: 50%;
|
|
184
130
|
top: -6px;
|
|
185
131
|
transform: translateX(-50%) rotate(180deg);
|
|
186
132
|
}
|
|
187
|
-
}
|
|
188
133
|
|
|
189
|
-
:host([
|
|
190
|
-
.scb-tooltip-arrow{
|
|
134
|
+
:host([position='left']) .scb-tooltip-arrow {
|
|
191
135
|
left: 100%;
|
|
192
136
|
top: 50%;
|
|
193
137
|
transform: translateY(-50%) translateX(-3px) rotate(270deg);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
:
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
:host([variant='plain'][arrow='false']) .scb-tooltip-arrow {
|
|
141
|
+
display: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Rich variant */
|
|
145
|
+
|
|
146
|
+
:host([variant='rich']) {
|
|
147
|
+
align-items: flex-start;
|
|
148
|
+
gap: var(--spacing-2);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:host([variant='rich']) .scb-tooltip {
|
|
152
|
+
background: var(--md-sys-color-surface-container, #ebf8ff);
|
|
153
|
+
box-shadow:
|
|
154
|
+
0 2px 4px -1px rgba(0, 0, 0, 0.2),
|
|
155
|
+
0 1px 10px 0 rgba(0, 0, 0, 0.12),
|
|
156
|
+
0 4px 5px 0 rgba(0, 0, 0, 0.14);
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
padding-bottom: var(--spacing-3);
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
align-items: flex-start;
|
|
161
|
+
gap: var(--spacing-3);
|
|
162
|
+
border-radius: var(--md-sys-shape-corner-medium);
|
|
163
|
+
min-width: 200px;
|
|
164
|
+
max-width: 300px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
:host([variant='rich']) .scb-tooltip-text-container {
|
|
168
|
+
display: flex;
|
|
169
|
+
min-width: 220px;
|
|
170
|
+
padding: var(--spacing-4) var(--spacing-5) var(--spacing-2) var(--spacing-5);
|
|
171
|
+
align-items: flex-start;
|
|
172
|
+
gap: var(--spacing-2);
|
|
173
|
+
flex-direction: column;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
:host([variant='rich']) .scb-tooltip-label {
|
|
177
|
+
font-family: var(--brand-font, Inter);
|
|
178
|
+
font-size: var(--md-sys-typescale-title-small-size);
|
|
179
|
+
font-style: normal;
|
|
180
|
+
font-weight: var(--weight-semibold);
|
|
181
|
+
line-height: var(--md-sys-typescale-title-small-Line-Height);
|
|
182
|
+
letter-spacing: var(--md-sys-typescale-title-small-Tracking);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:host([variant='rich']) .scb-tooltip-supporting-text {
|
|
186
|
+
color: var(--md-sys-color-on-surface-variant, rgba(11, 5, 68, 0.75));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
:host([variant='rich']) .scb-tooltip-button-container {
|
|
190
|
+
display: flex;
|
|
191
|
+
padding: 0 var(--spacing-3);
|
|
192
|
+
align-items: center;
|
|
193
|
+
gap: var(--spacing-3);
|
|
194
|
+
align-self: stretch;
|
|
195
|
+
}
|
|
196
|
+
`;c([p({type:String,reflect:!0})],l.prototype,"variant",2);c([p({type:Boolean,reflect:!0})],l.prototype,"arrow",2);c([p({type:String,attribute:"supporting-text"})],l.prototype,"supportingtext",2);c([p({type:String})],l.prototype,"label",2);c([p({type:String,reflect:!0})],l.prototype,"trigger",2);c([p({type:String,reflect:!0})],l.prototype,"position",2);c([p({type:Boolean,reflect:!0})],l.prototype,"open",2);c([p({type:Number,reflect:!0})],l.prototype,"delay",2);c([p({type:Number,reflect:!0})],l.prototype,"offset",2);l=c([j("scb-tooltip")],l);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.83",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -308,5 +308,5 @@
|
|
|
308
308
|
},
|
|
309
309
|
"./mvc/*": "./mvc/*"
|
|
310
310
|
},
|
|
311
|
-
"buildHash": "
|
|
311
|
+
"buildHash": "7D654DFF5ACC59C07123D9AA1A68F02C4968BB29C6373A605F83B726FE403CDE"
|
|
312
312
|
}
|
|
@@ -4,7 +4,7 @@ declare global {
|
|
|
4
4
|
__scb_md_icon_loaded?: boolean;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class ScbTextField extends LitElement {
|
|
8
8
|
type: 'number' | 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | 'textarea' | 'color' | 'date' | 'datetime-local' | 'file' | 'month' | 'time' | 'week';
|
|
9
9
|
label: string;
|
|
10
10
|
supportingText: string;
|
|
@@ -26,7 +26,7 @@ export declare class ScbTextField2 extends LitElement {
|
|
|
26
26
|
render(): TemplateResult;
|
|
27
27
|
/**
|
|
28
28
|
Vi re-dispatchar inbyggda "input", "change" och "select" events med { bubbles: true, composed: true },
|
|
29
|
-
så att konsumenter kan lyssna på events direkt från
|
|
29
|
+
så att konsumenter kan lyssna på events direkt från scb-text-field. Vi kör också ett customevent onValueChanged.
|
|
30
30
|
*/
|
|
31
31
|
firstUpdated(changedProperties: Map<string, unknown>): void;
|
|
32
32
|
updated(changed: PropertyValues): void;
|
|
@@ -38,3 +38,8 @@ export declare class ScbTextField2 extends LitElement {
|
|
|
38
38
|
reportValidity(): boolean;
|
|
39
39
|
private __ensureMdIconLoaded;
|
|
40
40
|
}
|
|
41
|
+
declare global {
|
|
42
|
+
interface HTMLElementTagNameMap {
|
|
43
|
+
'scb-textfield': ScbTextField;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -55,7 +55,7 @@ let i = class extends h {
|
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
Vi re-dispatchar inbyggda "input", "change" och "select" events med { bubbles: true, composed: true },
|
|
58
|
-
så att konsumenter kan lyssna på events direkt från
|
|
58
|
+
så att konsumenter kan lyssna på events direkt från scb-text-field. Vi kör också ett customevent onValueChanged.
|
|
59
59
|
*/
|
|
60
60
|
firstUpdated(e) {
|
|
61
61
|
var r;
|
|
@@ -291,5 +291,5 @@ i = s([
|
|
|
291
291
|
u("scb-textfield")
|
|
292
292
|
], i);
|
|
293
293
|
export {
|
|
294
|
-
i as
|
|
294
|
+
i as ScbTextField
|
|
295
295
|
};
|