@cas-smartdesign/token-selector 0.16.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/5_other.js +1 -1
- package/dist/docs/button.mjs +2 -2
- package/dist/docs/doc.mjs +78 -95
- package/dist/docs/index.html +3 -1
- package/dist/token-selector-with-externals.js +35 -61
- package/dist/token-selector-with-externals.js.map +4 -4
- package/dist/token-selector.d.ts +1 -1
- package/dist/token-selector.mjs +116 -106
- package/dist/token-selector.mjs.map +1 -1
- package/dist/token-suggest-popover.d.ts +4 -2
- package/package.json +7 -7
package/dist/docs/5_other.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./button.mjs";import{T as d,g as u}from"./doc.mjs";import{g
|
|
1
|
+
import"./button.mjs";import{T as d,g as u}from"./doc.mjs";import{g}from"./token-provider.mjs";var l=(t=>(t.Accept="accept",t.Decline="decline",t.NoResponse="no-response-received",t.Tentative="tentative",t))(l||{}),c=(t=>(t.Free="free",t.Blocked="blocked",t))(c||{});function v(){const t=[];return t.push({caption:"Robert Glaser",overlapStatus:"free",invitationStatus:"accept",type:"participant",disabled:!1}),t.push({caption:"Britta Glatt",overlapStatus:"blocked",invitationStatus:"decline",type:"participant",disabled:!1}),t.push({caption:"Frank Shreeve",overlapStatus:"blocked",invitationStatus:"no-response-received",type:"participant",disabled:!1}),t.push({caption:"Mario Rossi",invitationStatus:"tentative",icon:"./monkey.svg",type:"participant",disabled:!1}),t}d.ensureDefined();document.querySelectorAll("#other-example sd-token-selector").forEach(t=>{const p=t.querySelector("sd-button"),n=t;if(n.hasAttribute("additional-icons")){n.tokenGenerator=(o,r)=>{const i=u(o,r),e=document.createElement("span");e.classList.add("overlap-indicator"),e.classList.add(o.overlapStatus),e.setAttribute("slot","before-icon");const a=document.createElement("img");return a.style.backgroundColor="transparent",a.src="state-"+o.invitationStatus+".svg",a.setAttribute("slot","after-icon"),i.appendChild(e),i.appendChild(a),i};const s=n.autoSuggestItemGenerator;n.autoSuggestItemGenerator=(o,r)=>{const i=document.createElement("span"),e=i.style;e.width="4px",e.height="100%",o.overlapStatus==c.Free?e.backgroundColor="#59a531":o.overlapStatus==c.Blocked?e.backgroundColor="#cc0000":e.backgroundColor="#999999",i.setAttribute("slot","left-content");const a=s(o,r);return a.appendChild(i),a},n.items=v(),n.selectedIndexes=[0,1,2,3]}else if(n.classList.contains("many-tokens")){const s=[];for(let o=1;o<=5e3;o++)s.push({caption:"Token_"+Math.random().toString(36).substring(7),description:String(o)});n.items=s}else n.items=g(!0);n.hasAttribute("search-also-in-description")&&(n.suggestionFilter=(s,o)=>{if(!s)return o;const r=[],i=[];return o.forEach(e=>{e.disabled||e.deactivated||(e.caption&&e.caption.toLowerCase().includes(s)?r.push(e):e.description&&e.description.toLowerCase().includes(s)&&i.push(e))}),r.concat(i)}),n.addEventListener("token-created",s=>{n.items.push({caption:s.detail.value,type:"participant",disabled:!1,overlapStatus:c.Free,invitationStatus:l.NoResponse}),n.selectedIndexes.push(n.items.length-1)}),p.addEventListener("click",()=>n.openSuggestions())});
|
package/dist/docs/button.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const n=class a extends HTMLElement{memoizedTemplate(){const t=this.is();if(a.TEMPLATE_CACHE[t])return a.TEMPLATE_CACHE[t];const e=this.template();return window.ShadyCSS&&window.ShadyCSS.prepareTemplate(e,this.is()),a.TEMPLATE_CACHE[t]=e,e}connectedCallback(){const t=this.memoizedTemplate();window.ShadyCSS&&window.ShadyCSS.styleElement(this),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(document.importNode(t.content,!0)),requestAnimationFrame(()=>this.dispatchEvent(new CustomEvent("ready"))))}whenReady(t){this.shadowRoot?t():this.addEventListener("ready",()=>t())}};n.TEMPLATE_CACHE={};let l=n;const h=`<style>
|
|
2
2
|
:host {
|
|
3
3
|
contain: content;
|
|
4
4
|
background: rgba(20, 103, 186, 0);
|
|
@@ -100,4 +100,4 @@ import{s as d}from"./doc.mjs";const c=`<style>
|
|
|
100
100
|
<div class="content">
|
|
101
101
|
<slot></slot>
|
|
102
102
|
</div>
|
|
103
|
-
`,
|
|
103
|
+
`,d=class c extends l{constructor(){super(),this._isSpaceOrEnterKeyDown=!1,this.addEventListener("keydown",t=>{this.isSpaceOrEnter(t)&&(this._isSpaceOrEnterKeyDown=!0,t.preventDefault())}),this.addEventListener("keyup",t=>{this.isSpaceOrEnter(t)&&this._isSpaceOrEnterKeyDown==!0&&(this._isSpaceOrEnterKeyDown=!1,this.click())}),this.addEventListener("click",t=>{var e,o;if(this.disabled||this.hasAttribute("disabled")){t.stopImmediatePropagation();return}const i=(o=(e=this.getAttribute("type"))==null?void 0:e.toLowerCase())==null?void 0:o.trim();if(i!=="submit"&&i!=="reset")return;const s=this.closest("form");s&&i==="submit"&&s.requestSubmit(),s&&i==="reset"&&s.reset()},{capture:!0})}get imageElement(){return this._image}get icon(){return this.getAttribute("icon")}set icon(t){this.icon!==t&&(t?this.setAttribute("icon",t):this.removeAttribute("icon"),this.updateIcon())}get primary(){return this.hasAttribute("primary")}set primary(t){t?this.setAttribute("primary",""):this.removeAttribute("primary")}get disabled(){return this.getAttribute("aria-disabled")=="true"}set disabled(t){this.setAttribute("aria-disabled",t.toString())}static get observedAttributes(){return["icon"]}is(){return c.ID}template(){const t=document.createElement("template");return t.innerHTML=h,t}isSpaceOrEnter(t){switch(t.key){case" ":case"Space":case"Enter":return!0;default:return!1}}click(){!this.disabled&&!this.hasAttribute("disabled")&&super.click()}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabIndex")||(this.tabIndex=0),this._image=this.shadowRoot.querySelector(".icon"),this.updateIcon(),this.hasAttribute("role")||this.setAttribute("role","button")}attributeChangedCallback(){this.updateIcon()}updateIcon(){if(this._image){const t=this.getAttribute("icon");t&&(this._image.src=t)}}};d.ID="sd-button";let r=d;customElements.get(r.ID)||customElements.define(r.ID,r);
|