@fluid-topics/ft-search-result-metadata 0.3.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/build/SearchResultMetadataMessages.d.ts +7 -0
- package/build/SearchResultMetadataMessages.js +3 -0
- package/build/ft-search-result-metadata.css.d.ts +3 -0
- package/build/ft-search-result-metadata.css.js +6 -0
- package/build/ft-search-result-metadata.d.ts +27 -0
- package/build/ft-search-result-metadata.js +107 -0
- package/build/ft-search-result-metadata.light.js +488 -0
- package/build/ft-search-result-metadata.min.js +610 -0
- package/build/ft-search-result-metadata.properties.d.ts +6 -0
- package/build/ft-search-result-metadata.properties.js +2 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +7 -0
- package/package.json +35 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
!function(t,i,e,o,s,n){const r=e.css`
|
|
2
|
+
`;var l=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class a extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const h=Symbol("registerInterval");class p extends(function(t){var i;class e extends t{constructor(){super(...arguments),this[i]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}get service(){var t;return null===(t=this.stateManager)||void 0===t?void 0:t.service}connectedCallback(){super.connectedCallback(),this[h]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[h]):this.dispatchEvent(new a)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return i=h,l([o.state()],e.prototype,"stateManager",void 0),e}(i.FtLitElementRedux)){}var c=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class f extends Event{constructor(){super("register-ft-search-result-component",{bubbles:!0,composed:!0})}}const d=Symbol("registerInterval");class u extends(function(t){var i;class e extends t{constructor(){super(...arguments),this[i]=0}connectedCallback(){super.connectedCallback(),this[d]=window.setInterval((()=>this.tryToRegisterToResultContext()),50)}tryToRegisterToResultContext(){null!=this.result?window.clearInterval(this[d]):this.dispatchEvent(new f)}disconnectedCallback(){super.disconnectedCallback(),this.result=void 0}}return i=d,c([o.property({attribute:!1})],e.prototype,"result",void 0),e}(p)){}const g=e.css`
|
|
3
|
+
`,v=i.FtReduxStore.get({name:"ft-app-info",reducers:{setBaseUrl:(t,i)=>{t.baseUrl=i.payload},setApiIntegrationIdentifier:(t,i)=>{t.apiIntegrationIdentifier=i.payload},setUiLocale:(t,i)=>{t.uiLocale=i.payload},setAvailableUiLocales:(t,i)=>{t.availableUiLocales=i.payload},setEditorMode:(t,i)=>{t.editorMode=i.payload},setNoCustom:(t,i)=>{t.noCustom=i.payload},setNoCustomComponent:(t,i)=>{t.noCustomComponent=i.payload},setSession:(t,i)=>{t.session=i.payload}},initialState:{uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class y{static build(t){const{baseUrl:i,apiIntegrationIdentifier:e}=v.getState(),o=null!=t?t:e;if(i&&o&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(i,o,!0)}static get(t){var i;return null!=t?y.build(t):null!==(i=y.API)&&void 0!==i?i:y.API=y.build()}static await(t){return new Promise((i=>{let e=y.get(t);if(e)i(e);else{const o=v.subscribe((()=>{e=y.get(t),e&&(o(),i(e))}))}}))}}var x;const m=Symbol("clearAfterUnitTest");class b{constructor(t){this.apiProvider=t,this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={},this.currentUiLocale="",this[x]=()=>{this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={}},this.currentUiLocale=v.getState().uiLocale,v.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=v.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const i=t.name.toLowerCase();this.cache.setFinal(i,t),this.notify(i)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var o;if(t=t.toLowerCase(),Object.keys(e).length>0){const s={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};i.deepEqual(this.defaultMessages[t],s)||(this.defaultMessages[t]=s,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){var s,n,r;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(n=null===(s=this.cache.getNow(t))||void 0===s?void 0:s.messages)&&void 0!==n?n:{};return new i.ParametrizedLabelResolver(null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},l).resolve(e,...o)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(async()=>{var i;return await(null===(i=this.apiProvider())||void 0===i?void 0:i.getFluidTopicsMessageContext(this.currentUiLocale,t))})),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,i){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(i),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(i)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>i.delay(0).then((()=>t())).catch((()=>null)))))}}x=m,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new b(y.get));const $=window.FluidTopicsI18nService;var w=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class k extends i.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.availableUiLocales=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>y.get(),this.cache=new i.CacheRegistry,this.cleanSessionDebouncer=new i.Debouncer}render(){return e.html`
|
|
4
|
+
<slot></slot>
|
|
5
|
+
`}updated(t){super.updated(t),t.has("baseUrl")&&v.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&v.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&v.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&v.actions.setNoCustom(this.noCustom),t.has("editorMode")&&v.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&v.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&v.actions.setSession(this.session),t.has("availableUiLocales")&&v.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>$.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const i=await t.getCurrentSession();return i.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),i.idleTimeoutInMillis),i}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}k.elementDefinitions={},k.styles=g,w([o.property()],k.prototype,"baseUrl",void 0),w([o.property()],k.prototype,"apiIntegrationIdentifier",void 0),w([o.property()],k.prototype,"uiLocale",void 0),w([i.jsonProperty([])],k.prototype,"availableUiLocales",void 0),w([o.property({type:Boolean})],k.prototype,"editorMode",void 0),w([o.property({type:Boolean})],k.prototype,"noCustom",void 0),w([o.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],k.prototype,"noCustomComponent",void 0),w([o.property({type:Boolean})],k.prototype,"withManualResources",void 0),w([i.jsonProperty([])],k.prototype,"messageContexts",void 0),w([i.jsonProperty(void 0)],k.prototype,"session",void 0),w([o.property({type:Object})],k.prototype,"apiProvider",void 0),i.customElement("ft-app-context")(k);const z=e.css`
|
|
6
|
+
`,C=Symbol("i18nProperties"),S=Symbol("i18nUnsubs");function O(t){var i;return i=S,class extends t{constructor(){super(...arguments),this[i]=new Map}i18n(t,i,...e){var o;if("string"==typeof t)return $.resolveMessage(t,i,...e);const s=null!==(o=t.args)&&void 0!==o?o:t.argsProvider?t.argsProvider(this):[];return $.resolveMessage(t.context,t.key,...s)}onI18nUpdate(t){var i;null===(i=this[C])||void 0===i||i.forEach(((i,e)=>{i.context.toLowerCase()===t.toLowerCase()&&(this[e]=this.i18n(i))})),setTimeout((()=>this.requestUpdate()),0)}updated(t){var i;super.updated(t),null===(i=this[C])||void 0===i||i.forEach(((t,i)=>{null!=t.argsProvider&&(this[i]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[C]&&new Set([...this[C].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,i){t=t.toLowerCase(),this[S].has(t)||this[S].set(t,$.subscribe(t,(()=>this.onI18nUpdate(t)))),$.prepareContext(t,null!=i?i:{})}addI18nContext(t,i){this.addI18nMessages(t.name,i)}disconnectedCallback(){super.disconnectedCallback(),this[S].forEach((t=>t())),this[S].clear()}}}class j extends(O(i.FtLitElement)){}class I extends(O(i.FtLitElementRedux)){}var N=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class U extends j{render(){return this.key&&this.context?e.html`
|
|
7
|
+
<span class="ft-i18n">${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}</span>
|
|
8
|
+
`:e.nothing}update(t){super.update(t),this.context&&this.key&&this.defaultMessage&&this.addI18nMessages(this.context,{[this.key]:this.defaultMessage})}}U.elementDefinitions={},U.styles=z,N([o.property()],U.prototype,"context",void 0),N([o.property()],U.prototype,"key",void 0),N([i.jsonProperty([])],U.prototype,"args",void 0),N([o.property()],U.prototype,"defaultMessage",void 0);class M{constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,i)=>{const e=i;return t=>({context:this.name,key:e,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,i)=>(...t)=>$.resolveMessage(this.name,i,...t)})}static build(t){return new M(t)}static fromGwt(t){return new M(t)}}i.customElement("ft-i18n")(U);const A=M.build("designedSearchResultMetadata");
|
|
9
|
+
/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2017 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*/var E;const T=window,B=T.trustedTypes,_=B?B.createPolicy("lit-html",{createHTML:t=>t}):void 0,F=`lit$${(Math.random()+"").slice(9)}$`,L="?"+F,R=`<${L}>`,P=document,Z=(t="")=>P.createComment(t),W=t=>null===t||"object"!=typeof t&&"function"!=typeof t,D=Array.isArray,K=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,G=/-->/g,H=/>/g,q=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),X=/'/g,Y=/"/g,J=/^(?:script|style|textarea|title)$/i,Q=(t=>(i,...e)=>({_$litType$:t,strings:i,values:e}))(1),V=Symbol.for("lit-noChange"),tt=Symbol.for("lit-nothing"),it=new WeakMap,et=P.createTreeWalker(P,129,null,!1),ot=(t,i)=>{const e=t.length-1,o=[];let s,n=2===i?"<svg>":"",r=K;for(let i=0;i<e;i++){const e=t[i];let l,a,h=-1,p=0;for(;p<e.length&&(r.lastIndex=p,a=r.exec(e),null!==a);)p=r.lastIndex,r===K?"!--"===a[1]?r=G:void 0!==a[1]?r=H:void 0!==a[2]?(J.test(a[2])&&(s=RegExp("</"+a[2],"g")),r=q):void 0!==a[3]&&(r=q):r===q?">"===a[0]?(r=null!=s?s:K,h=-1):void 0===a[1]?h=-2:(h=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?q:'"'===a[3]?Y:X):r===Y||r===X?r=q:r===G||r===H?r=K:(r=q,s=void 0);const c=r===q&&t[i+1].startsWith("/>")?" ":"";n+=r===K?e+R:h>=0?(o.push(l),e.slice(0,h)+"$lit$"+e.slice(h)+F+c):e+F+(-2===h?(o.push(void 0),i):c)}const l=n+(t[e]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==_?_.createHTML(l):l,o]};class st{constructor({strings:t,_$litType$:i},e){let o;this.parts=[];let s=0,n=0;const r=t.length-1,l=this.parts,[a,h]=ot(t,i);if(this.el=st.createElement(a,e),et.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(o=et.nextNode())&&l.length<r;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const i of o.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(F)){const e=h[n++];if(t.push(i),void 0!==e){const t=o.getAttribute(e.toLowerCase()+"$lit$").split(F),i=/([.?@])?(.*)/.exec(e);l.push({type:1,index:s,name:i[2],strings:t,ctor:"."===i[1]?ht:"?"===i[1]?ct:"@"===i[1]?ft:at})}else l.push({type:6,index:s})}for(const i of t)o.removeAttribute(i)}if(J.test(o.tagName)){const t=o.textContent.split(F),i=t.length-1;if(i>0){o.textContent=B?B.emptyScript:"";for(let e=0;e<i;e++)o.append(t[e],Z()),et.nextNode(),l.push({type:2,index:++s});o.append(t[i],Z())}}}else if(8===o.nodeType)if(o.data===L)l.push({type:2,index:s});else{let t=-1;for(;-1!==(t=o.data.indexOf(F,t+1));)l.push({type:7,index:s}),t+=F.length-1}s++}}static createElement(t,i){const e=P.createElement("template");return e.innerHTML=t,e}}function nt(t,i,e=t,o){var s,n,r,l;if(i===V)return i;let a=void 0!==o?null===(s=e._$Co)||void 0===s?void 0:s[o]:e._$Cl;const h=W(i)?void 0:i._$litDirective$;return(null==a?void 0:a.constructor)!==h&&(null===(n=null==a?void 0:a._$AO)||void 0===n||n.call(a,!1),void 0===h?a=void 0:(a=new h(t),a._$AT(t,e,o)),void 0!==o?(null!==(r=(l=e)._$Co)&&void 0!==r?r:l._$Co=[])[o]=a:e._$Cl=a),void 0!==a&&(i=nt(t,a._$AS(t,i.values),a,o)),i}class rt{constructor(t,i){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var i;const{el:{content:e},parts:o}=this._$AD,s=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:P).importNode(e,!0);et.currentNode=s;let n=et.nextNode(),r=0,l=0,a=o[0];for(;void 0!==a;){if(r===a.index){let i;2===a.type?i=new lt(n,n.nextSibling,this,t):1===a.type?i=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(i=new dt(n,this,t)),this.u.push(i),a=o[++l]}r!==(null==a?void 0:a.index)&&(n=et.nextNode(),r++)}return s}p(t){let i=0;for(const e of this.u)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,i),i+=e.strings.length-2):e._$AI(t[i])),i++}}class lt{constructor(t,i,e,o){var s;this.type=2,this._$AH=tt,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=e,this.options=o,this._$Cm=null===(s=null==o?void 0:o.isConnected)||void 0===s||s}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=nt(this,t,i),W(t)?t===tt||null==t||""===t?(this._$AH!==tt&&this._$AR(),this._$AH=tt):t!==this._$AH&&t!==V&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>D(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==tt&&W(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){var i;const{values:e,_$litType$:o}=t,s="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=st.createElement(o.h,this.options)),o);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===s)this._$AH.p(e);else{const t=new rt(s,this),i=t.v(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let i=it.get(t.strings);return void 0===i&&it.set(t.strings,i=new st(t)),i}k(t){D(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let e,o=0;for(const s of t)o===i.length?i.push(e=new lt(this.O(Z()),this.O(Z()),this,this.options)):e=i[o],e._$AI(s),o++;o<i.length&&(this._$AR(e&&e._$AB.nextSibling,o),i.length=o)}_$AR(t=this._$AA.nextSibling,i){var e;for(null===(e=this._$AP)||void 0===e||e.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cm=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class at{constructor(t,i,e,o,s){this.type=1,this._$AH=tt,this._$AN=void 0,this.element=t,this.name=i,this._$AM=o,this.options=s,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=tt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,e,o){const s=this.strings;let n=!1;if(void 0===s)t=nt(this,t,i,0),n=!W(t)||t!==this._$AH&&t!==V,n&&(this._$AH=t);else{const o=t;let r,l;for(t=s[0],r=0;r<s.length-1;r++)l=nt(this,o[e+r],i,r),l===V&&(l=this._$AH[r]),n||(n=!W(l)||l!==this._$AH[r]),l===tt?t=tt:t!==tt&&(t+=(null!=l?l:"")+s[r+1]),this._$AH[r]=l}n&&!o&&this.j(t)}j(t){t===tt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class ht extends at{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===tt?void 0:t}}const pt=B?B.emptyScript:"";class ct extends at{constructor(){super(...arguments),this.type=4}j(t){t&&t!==tt?this.element.setAttribute(this.name,pt):this.element.removeAttribute(this.name)}}class ft extends at{constructor(t,i,e,o,s){super(t,i,e,o,s),this.type=5}_$AI(t,i=this){var e;if((t=null!==(e=nt(this,t,i,0))&&void 0!==e?e:tt)===V)return;const o=this._$AH,s=t===tt&&o!==tt||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==tt&&(o===tt||s);s&&this.element.removeEventListener(this.name,this,o),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,e;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}class dt{constructor(t,i,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){nt(this,t)}}const ut=T.litHtmlPolyfillSupport;null==ut||ut(st,lt),(null!==(E=T.litHtmlVersions)&&void 0!==E?E:T.litHtmlVersions=[]).push("2.4.0");
|
|
14
|
+
/**
|
|
15
|
+
* @license
|
|
16
|
+
* Copyright 2020 Google LLC
|
|
17
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
|
+
*/
|
|
19
|
+
const gt=Symbol.for(""),vt=t=>{if((null==t?void 0:t.r)===gt)return null==t?void 0:t._$litStatic$},yt=t=>({_$litStatic$:t,r:gt}),xt=new Map,mt=(t=>(i,...e)=>{const o=e.length;let s,n;const r=[],l=[];let a,h=0,p=!1;for(;h<o;){for(a=i[h];h<o&&void 0!==(n=e[h],s=vt(n));)a+=s+i[++h],p=!0;l.push(n),r.push(a),h++}if(h===o&&r.push(i[o]),p){const t=r.join("$$lit$$");void 0===(i=xt.get(t))&&(r.raw=r,xt.set(t,i=r)),e=l}return t(i,...e)})(Q);var bt;!function(t){t.title="title",t.title_dense="title-dense",t.subtitle1="subtitle1",t.subtitle2="subtitle2",t.body1="body1",t.body2="body2",t.caption="caption",t.breadcrumb="breadcrumb",t.overline="overline",t.button="button"}(bt||(bt={}));const $t=i.FtCssVariableFactory.extend("--ft-typography-font-family",i.designSystemVariables.titleFont),wt=i.FtCssVariableFactory.extend("--ft-typography-font-family",i.designSystemVariables.contentFont),kt={fontFamily:wt,fontSize:i.FtCssVariableFactory.create("--ft-typography-font-size","SIZE","16px"),fontWeight:i.FtCssVariableFactory.create("--ft-typography-font-weight","UNKNOWN","normal"),letterSpacing:i.FtCssVariableFactory.create("--ft-typography-letter-spacing","SIZE","0.496px"),lineHeight:i.FtCssVariableFactory.create("--ft-typography-line-height","NUMBER","1.5"),textTransform:i.FtCssVariableFactory.create("--ft-typography-text-transform","UNKNOWN","inherit")},zt=i.FtCssVariableFactory.extend("--ft-typography-title-font-family",$t),Ct=i.FtCssVariableFactory.extend("--ft-typography-title-font-size",kt.fontSize,"20px"),St=i.FtCssVariableFactory.extend("--ft-typography-title-font-weight",kt.fontWeight,"normal"),Ot=i.FtCssVariableFactory.extend("--ft-typography-title-letter-spacing",kt.letterSpacing,"0.15px"),jt=i.FtCssVariableFactory.extend("--ft-typography-title-line-height",kt.lineHeight,"1.2"),It=i.FtCssVariableFactory.extend("--ft-typography-title-text-transform",kt.textTransform,"inherit"),Nt=i.FtCssVariableFactory.extend("--ft-typography-title-dense-font-family",$t),Ut=i.FtCssVariableFactory.extend("--ft-typography-title-dense-font-size",kt.fontSize,"14px"),Mt=i.FtCssVariableFactory.extend("--ft-typography-title-dense-font-weight",kt.fontWeight,"normal"),At=i.FtCssVariableFactory.extend("--ft-typography-title-dense-letter-spacing",kt.letterSpacing,"0.105px"),Et=i.FtCssVariableFactory.extend("--ft-typography-title-dense-line-height",kt.lineHeight,"1.7"),Tt=i.FtCssVariableFactory.extend("--ft-typography-title-dense-text-transform",kt.textTransform,"inherit"),Bt=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-font-family",wt),_t=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-font-size",kt.fontSize,"16px"),Ft=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-font-weight",kt.fontWeight,"600"),Lt=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-letter-spacing",kt.letterSpacing,"0.144px"),Rt=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-line-height",kt.lineHeight,"1.5"),Pt=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-text-transform",kt.textTransform,"inherit"),Zt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-font-family",wt),Wt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-font-size",kt.fontSize,"14px"),Dt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-font-weight",kt.fontWeight,"normal"),Kt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-letter-spacing",kt.letterSpacing,"0.098px"),Gt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-line-height",kt.lineHeight,"1.7"),Ht=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-text-transform",kt.textTransform,"inherit"),qt=i.FtCssVariableFactory.extend("--ft-typography-body1-font-family",wt),Xt=i.FtCssVariableFactory.extend("--ft-typography-body1-font-size",kt.fontSize,"16px"),Yt=i.FtCssVariableFactory.extend("--ft-typography-body1-font-weight",kt.fontWeight,"normal"),Jt=i.FtCssVariableFactory.extend("--ft-typography-body1-letter-spacing",kt.letterSpacing,"0.496px"),Qt=i.FtCssVariableFactory.extend("--ft-typography-body1-line-height",kt.lineHeight,"1.5"),Vt=i.FtCssVariableFactory.extend("--ft-typography-body1-text-transform",kt.textTransform,"inherit"),ti={fontFamily:i.FtCssVariableFactory.extend("--ft-typography-body2-font-family",wt),fontSize:i.FtCssVariableFactory.extend("--ft-typography-body2-font-size",kt.fontSize,"14px"),fontWeight:i.FtCssVariableFactory.extend("--ft-typography-body2-font-weight",kt.fontWeight,"normal"),letterSpacing:i.FtCssVariableFactory.extend("--ft-typography-body2-letter-spacing",kt.letterSpacing,"0.252px"),lineHeight:i.FtCssVariableFactory.extend("--ft-typography-body2-line-height",kt.lineHeight,"1.4"),textTransform:i.FtCssVariableFactory.extend("--ft-typography-body2-text-transform",kt.textTransform,"inherit")},ii=i.FtCssVariableFactory.extend("--ft-typography-caption-font-family",wt),ei=i.FtCssVariableFactory.extend("--ft-typography-caption-font-size",kt.fontSize,"12px"),oi=i.FtCssVariableFactory.extend("--ft-typography-caption-font-weight",kt.fontWeight,"normal"),si=i.FtCssVariableFactory.extend("--ft-typography-caption-letter-spacing",kt.letterSpacing,"0.396px"),ni=i.FtCssVariableFactory.extend("--ft-typography-caption-line-height",kt.lineHeight,"1.33"),ri=i.FtCssVariableFactory.extend("--ft-typography-caption-text-transform",kt.textTransform,"inherit"),li=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-font-family",wt),ai=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-font-size",kt.fontSize,"10px"),hi=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-font-weight",kt.fontWeight,"normal"),pi=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-letter-spacing",kt.letterSpacing,"0.33px"),ci=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-line-height",kt.lineHeight,"1.6"),fi=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-text-transform",kt.textTransform,"inherit"),di=i.FtCssVariableFactory.extend("--ft-typography-overline-font-family",wt),ui=i.FtCssVariableFactory.extend("--ft-typography-overline-font-size",kt.fontSize,"10px"),gi=i.FtCssVariableFactory.extend("--ft-typography-overline-font-weight",kt.fontWeight,"normal"),vi=i.FtCssVariableFactory.extend("--ft-typography-overline-letter-spacing",kt.letterSpacing,"1.5px"),yi=i.FtCssVariableFactory.extend("--ft-typography-overline-line-height",kt.lineHeight,"1.6"),xi=i.FtCssVariableFactory.extend("--ft-typography-overline-text-transform",kt.textTransform,"uppercase"),mi=i.FtCssVariableFactory.extend("--ft-typography-button-font-family",wt),bi=i.FtCssVariableFactory.extend("--ft-typography-button-font-size",kt.fontSize,"14px"),$i=i.FtCssVariableFactory.extend("--ft-typography-button-font-weight",kt.fontWeight,"600"),wi=i.FtCssVariableFactory.extend("--ft-typography-button-letter-spacing",kt.letterSpacing,"1.246px"),ki=i.FtCssVariableFactory.extend("--ft-typography-button-line-height",kt.lineHeight,"1.15"),zi=i.FtCssVariableFactory.extend("--ft-typography-button-text-transform",kt.textTransform,"uppercase"),Ci=e.css`
|
|
20
|
+
.ft-typography--title {
|
|
21
|
+
font-family: ${zt};
|
|
22
|
+
font-size: ${Ct};
|
|
23
|
+
font-weight: ${St};
|
|
24
|
+
letter-spacing: ${Ot};
|
|
25
|
+
line-height: ${jt};
|
|
26
|
+
text-transform: ${It};
|
|
27
|
+
}
|
|
28
|
+
`,Si=e.css`
|
|
29
|
+
.ft-typography--title-dense {
|
|
30
|
+
font-family: ${Nt};
|
|
31
|
+
font-size: ${Ut};
|
|
32
|
+
font-weight: ${Mt};
|
|
33
|
+
letter-spacing: ${At};
|
|
34
|
+
line-height: ${Et};
|
|
35
|
+
text-transform: ${Tt};
|
|
36
|
+
}
|
|
37
|
+
`,Oi=e.css`
|
|
38
|
+
.ft-typography--subtitle1 {
|
|
39
|
+
font-family: ${Bt};
|
|
40
|
+
font-size: ${_t};
|
|
41
|
+
font-weight: ${Ft};
|
|
42
|
+
letter-spacing: ${Lt};
|
|
43
|
+
line-height: ${Rt};
|
|
44
|
+
text-transform: ${Pt};
|
|
45
|
+
}
|
|
46
|
+
`,ji=e.css`
|
|
47
|
+
.ft-typography--subtitle2 {
|
|
48
|
+
font-family: ${Zt};
|
|
49
|
+
font-size: ${Wt};
|
|
50
|
+
font-weight: ${Dt};
|
|
51
|
+
letter-spacing: ${Kt};
|
|
52
|
+
line-height: ${Gt};
|
|
53
|
+
text-transform: ${Ht};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
`,Ii=e.css`
|
|
57
|
+
.ft-typography--body1 {
|
|
58
|
+
font-family: ${qt};
|
|
59
|
+
font-size: ${Xt};
|
|
60
|
+
font-weight: ${Yt};
|
|
61
|
+
letter-spacing: ${Jt};
|
|
62
|
+
line-height: ${Qt};
|
|
63
|
+
text-transform: ${Vt};
|
|
64
|
+
}
|
|
65
|
+
`,Ni=e.css`
|
|
66
|
+
.ft-typography--body2 {
|
|
67
|
+
font-family: ${ti.fontFamily};
|
|
68
|
+
font-size: ${ti.fontSize};
|
|
69
|
+
font-weight: ${ti.fontWeight};
|
|
70
|
+
letter-spacing: ${ti.letterSpacing};
|
|
71
|
+
line-height: ${ti.lineHeight};
|
|
72
|
+
text-transform: ${ti.textTransform};
|
|
73
|
+
}
|
|
74
|
+
`,Ui=e.css`
|
|
75
|
+
.ft-typography--caption {
|
|
76
|
+
font-family: ${ii};
|
|
77
|
+
font-size: ${ei};
|
|
78
|
+
font-weight: ${oi};
|
|
79
|
+
letter-spacing: ${si};
|
|
80
|
+
line-height: ${ni};
|
|
81
|
+
text-transform: ${ri};
|
|
82
|
+
}
|
|
83
|
+
`,Mi=e.css`
|
|
84
|
+
.ft-typography--breadcrumb {
|
|
85
|
+
font-family: ${li};
|
|
86
|
+
font-size: ${ai};
|
|
87
|
+
font-weight: ${hi};
|
|
88
|
+
letter-spacing: ${pi};
|
|
89
|
+
line-height: ${ci};
|
|
90
|
+
text-transform: ${fi};
|
|
91
|
+
}
|
|
92
|
+
`,Ai=e.css`
|
|
93
|
+
.ft-typography--overline {
|
|
94
|
+
font-family: ${di};
|
|
95
|
+
font-size: ${ui};
|
|
96
|
+
font-weight: ${gi};
|
|
97
|
+
letter-spacing: ${vi};
|
|
98
|
+
line-height: ${yi};
|
|
99
|
+
text-transform: ${xi};
|
|
100
|
+
}
|
|
101
|
+
`,Ei=e.css`
|
|
102
|
+
.ft-typography--button {
|
|
103
|
+
font-family: ${mi};
|
|
104
|
+
font-size: ${bi};
|
|
105
|
+
font-weight: ${$i};
|
|
106
|
+
letter-spacing: ${wi};
|
|
107
|
+
line-height: ${ki};
|
|
108
|
+
text-transform: ${zi};
|
|
109
|
+
}
|
|
110
|
+
`,Ti=e.css`
|
|
111
|
+
.ft-typography {
|
|
112
|
+
vertical-align: inherit;
|
|
113
|
+
}
|
|
114
|
+
`;var Bi=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class _i extends i.FtLitElement{constructor(){super(...arguments),this.variant=bt.body1}render(){return this.element?mt`
|
|
115
|
+
<${yt(this.element)}
|
|
116
|
+
class="ft-typography ft-typography--${this.variant}">
|
|
117
|
+
<slot></slot>
|
|
118
|
+
</${yt(this.element)}>
|
|
119
|
+
`:mt`
|
|
120
|
+
<slot class="ft-typography ft-typography--${this.variant}"></slot>
|
|
121
|
+
`}}_i.styles=[Ci,Si,Oi,ji,Ii,Ni,Ui,Mi,Ai,Ei,Ti],Bi([o.property()],_i.prototype,"element",void 0),Bi([o.property()],_i.prototype,"variant",void 0),i.customElement("ft-typography")(_i);const Fi=i.FtCssVariableFactory.create("--ft-tooltip-distance","SIZE","4px"),Li=i.FtCssVariableFactory.create("--ft-tooltip-color","COLOR","#FFFFFF"),Ri=i.FtCssVariableFactory.create("--ft-tooltip-background-color","COLOR","#666666"),Pi=i.FtCssVariableFactory.create("--ft-tooltip-z-index","NUMBER","1"),Zi=i.FtCssVariableFactory.external(i.designSystemVariables.borderRadiusS,"Design system"),Wi=i.FtCssVariableFactory.create("--ft-tooltip-max-width","SIZE","150px"),Di=e.css`
|
|
122
|
+
.ft-tooltip--container {
|
|
123
|
+
display: block;
|
|
124
|
+
position: relative;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.ft-tooltip--inline {
|
|
128
|
+
display: inline-block;
|
|
129
|
+
max-width: 100%;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ft-tooltip {
|
|
133
|
+
position: absolute;
|
|
134
|
+
box-sizing: border-box;
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
width: max-content;
|
|
137
|
+
max-width: ${Wi};
|
|
138
|
+
text-align: center;
|
|
139
|
+
padding: ${Fi};
|
|
140
|
+
z-index: ${Pi};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ft-tooltip--content {
|
|
144
|
+
padding: 4px 8px;
|
|
145
|
+
border-radius: ${Zi};
|
|
146
|
+
background-color: ${Ri};
|
|
147
|
+
color: ${Li};
|
|
148
|
+
top: -500px;
|
|
149
|
+
left: -500px;
|
|
150
|
+
position: relative;
|
|
151
|
+
word-break: break-word;
|
|
152
|
+
}
|
|
153
|
+
`;var Ki=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class Gi extends i.FtLitElement{constructor(){super(...arguments),this.text="",this.manual=!1,this.inline=!1,this.delay=500,this.position="bottom",this.visible=!1,this.validPositions=new Set(["top","bottom","left","right"]),this.hideDebounce=new i.Debouncer,this.revealDebouncer=new i.Debouncer}get validPosition(){return this.validPositions.has(this.position)?this.position:"bottom"}render(){return e.html`
|
|
154
|
+
<div part="container"
|
|
155
|
+
class="ft-tooltip--container ${this.inline?"ft-tooltip--inline":""}"
|
|
156
|
+
@mouseenter=${this.onHover}
|
|
157
|
+
@mouseleave=${this.onOut}
|
|
158
|
+
@focusin=${this.onHover}
|
|
159
|
+
@focusout=${this.onOut}
|
|
160
|
+
@touchstart=${this.onTouch}>
|
|
161
|
+
<slot></slot>
|
|
162
|
+
<div part="tooltip" role="tooltip" inert
|
|
163
|
+
class="ft-tooltip ft-tooltip--${this.validPosition}"
|
|
164
|
+
?hidden=${!this.visible}>
|
|
165
|
+
<div part="tooltip-content" class="ft-tooltip--content">
|
|
166
|
+
<slot name="text"></slot>
|
|
167
|
+
<ft-typography variant="caption" ?hidden=${!this.text}>${this.text}</ft-typography>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){["visible","text"].some((i=>t.has(i)))&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.validPosition){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=t.getBoundingClientRect(),e=(i.height-this.tooltip.clientHeight)/2,o=(i.width-this.tooltip.clientWidth)/2;let s=0,n=0;switch(this.validPosition){case"top":n=-this.tooltip.clientHeight,s=o;break;case"bottom":n=i.height,s=o;break;case"left":n=e,s=-this.tooltip.clientWidth;break;case"right":n=e,s=i.width}i.left+s+this.tooltip.clientWidth>window.innerWidth&&(s=window.innerWidth-this.tooltip.clientWidth-i.left),i.left+s<0&&(s=0);const r=this.tooltip.style;r.left=s+"px",r.top=n+"px",r.maxWidth=`max(${i.width}px, ${Wi})`}this.revealDebouncer.run((()=>{this.tooltipContent&&(this.tooltipContent.style.transition="top var(--ft-transition-duration, 250ms), left var(--ft-transition-duration, 250ms)",this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")}),this.manual?0:this.delay)}onTouch(){this.manual||(this.show(),setTimeout((()=>window.addEventListener("touchstart",(t=>{t.composedPath().includes(this.container)||this.onOut()}),{once:!0})),100))}onHover(){this.manual||this.show()}onOut(){this.manual||(this.revealDebouncer.cancel(),this.hide())}}Gi.elementDefinitions={"ft-typography":_i},Gi.styles=Di,Ki([o.property()],Gi.prototype,"text",void 0),Ki([o.property({type:Boolean})],Gi.prototype,"manual",void 0),Ki([o.property({type:Boolean})],Gi.prototype,"inline",void 0),Ki([o.property({type:Number})],Gi.prototype,"delay",void 0),Ki([o.property()],Gi.prototype,"position",void 0),Ki([o.queryAssignedNodes("",!0)],Gi.prototype,"slotNodes",void 0),Ki([o.query(".ft-tooltip--container")],Gi.prototype,"container",void 0),Ki([o.query("slot")],Gi.prototype,"target",void 0),Ki([o.query(".ft-tooltip")],Gi.prototype,"tooltip",void 0),Ki([o.query(".ft-tooltip--content")],Gi.prototype,"tooltipContent",void 0),Ki([o.state()],Gi.prototype,"visible",void 0),i.customElement("ft-tooltip")(Gi);const Hi=i.FtCssVariableFactory.extend("--ft-ripple-color",i.designSystemVariables.colorContent),qi={color:Hi,backgroundColor:i.FtCssVariableFactory.extend("--ft-ripple-background-color",Hi),opacityContentOnSurfacePressed:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfacePressed,"Design system"),opacityContentOnSurfaceHover:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfaceHover,"Design system"),opacityContentOnSurfaceFocused:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfaceFocused,"Design system"),opacityContentOnSurfaceSelected:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfaceSelected,"Design system")},Xi=i.FtCssVariableFactory.extend("--ft-ripple-color",i.designSystemVariables.colorPrimary),Yi=Xi,Ji=i.FtCssVariableFactory.extend("--ft-ripple-background-color",Xi),Qi=i.FtCssVariableFactory.extend("--ft-ripple-color",i.designSystemVariables.colorSecondary),Vi=Qi,te=i.FtCssVariableFactory.extend("--ft-ripple-background-color",Qi),ie=e.css`
|
|
172
|
+
:host {
|
|
173
|
+
display: contents;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.ft-ripple {
|
|
177
|
+
position: absolute;
|
|
178
|
+
inset: 0;
|
|
179
|
+
pointer-events: none;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.ft-ripple:not(.ft-ripple--unbounded) {
|
|
183
|
+
overflow: hidden;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.ft-ripple .ft-ripple--background,
|
|
187
|
+
.ft-ripple .ft-ripple--effect {
|
|
188
|
+
position: absolute;
|
|
189
|
+
opacity: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.ft-ripple .ft-ripple--background {
|
|
193
|
+
background-color: ${qi.backgroundColor};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.ft-ripple .ft-ripple--effect {
|
|
197
|
+
background-color: ${qi.color};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.ft-ripple.ft-ripple--secondary .ft-ripple--background {
|
|
201
|
+
background-color: ${te};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.ft-ripple.ft-ripple--secondary .ft-ripple--effect {
|
|
205
|
+
background-color: ${Vi};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.ft-ripple.ft-ripple--primary .ft-ripple--background {
|
|
209
|
+
background-color: ${Ji};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.ft-ripple.ft-ripple--primary .ft-ripple--effect {
|
|
213
|
+
background-color: ${Yi};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.ft-ripple .ft-ripple--background {
|
|
217
|
+
top: 0;
|
|
218
|
+
left: 0;
|
|
219
|
+
height: 100%;
|
|
220
|
+
width: 100%;
|
|
221
|
+
transition: opacity 75ms linear;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.ft-ripple .ft-ripple--effect,
|
|
225
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--background {
|
|
226
|
+
border-radius: 50%;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.ft-ripple .ft-ripple--effect {
|
|
230
|
+
transform: translate(-50%, -50%) scale(0.15);
|
|
231
|
+
transition: transform 300ms ease, opacity 75ms linear;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--effect,
|
|
235
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--background {
|
|
236
|
+
left: 50%;
|
|
237
|
+
top: 50%;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--background {
|
|
241
|
+
transform: translate(-50%, -50%);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.ft-ripple.ft-ripple--hovered .ft-ripple--background {
|
|
245
|
+
opacity: ${qi.opacityContentOnSurfaceHover};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.ft-ripple.ft-ripple--selected .ft-ripple--background {
|
|
249
|
+
opacity: ${qi.opacityContentOnSurfaceSelected};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.ft-ripple.ft-ripple--focused .ft-ripple--background {
|
|
253
|
+
opacity: ${qi.opacityContentOnSurfaceFocused};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.ft-ripple.ft-ripple--pressed .ft-ripple--effect {
|
|
257
|
+
opacity: ${qi.opacityContentOnSurfacePressed};
|
|
258
|
+
transform: translate(-50%, -50%) scale(1);
|
|
259
|
+
}
|
|
260
|
+
`;var ee,oe,se=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class ne extends i.FtLitElement{constructor(){super(...arguments),this.primary=!1,this.secondary=!1,this.unbounded=!1,this.activated=!1,this.selected=!1,this.disabled=!1,this.hovered=!1,this.focused=!1,this.pressed=!1,this.rippling=!1,this.rippleSize=0,this.originX=0,this.originY=0,this.resizeObserver=new ResizeObserver((()=>this.setRippleSize())),this.debouncer=new i.Debouncer(1e3),this.onTransitionStart=t=>{"transform"===t.propertyName&&(this.rippling=this.pressed,this.debouncer.run((()=>this.rippling=!1)))},this.onTransitionEnd=t=>{"transform"===t.propertyName&&(this.rippling=!1)},this.setupDebouncer=new i.Debouncer(10),this.moveRipple=t=>{var i,e;let{x:o,y:s}=this.getCoordinates(t),n=null!==(e=null===(i=this.ripple)||void 0===i?void 0:i.getBoundingClientRect())&&void 0!==e?e:{x:0,y:0,width:0,height:0};this.originX=Math.round(null!=o?o-n.x:n.width/2),this.originY=Math.round(null!=s?s-n.y:n.height/2)},this.startPress=t=>{this.moveRipple(t),this.pressed=!this.isIgnored(t)},this.endPress=()=>{this.pressed=!1},this.startHover=t=>{this.hovered=!this.isIgnored(t)},this.endHover=()=>{this.hovered=!1},this.startFocus=t=>{this.focused=!this.isIgnored(t)},this.endFocus=()=>{this.focused=!1}}render(){let t={"ft-ripple":!0,"ft-ripple--primary":this.primary,"ft-ripple--secondary":this.secondary,"ft-ripple--unbounded":this.unbounded,"ft-ripple--selected":(this.selected||this.activated)&&!this.disabled,"ft-ripple--pressed":(this.pressed||this.rippling)&&!this.disabled,"ft-ripple--hovered":this.hovered&&!this.disabled,"ft-ripple--focused":this.focused&&!this.disabled};return e.html`
|
|
261
|
+
<style>
|
|
262
|
+
.ft-ripple .ft-ripple--effect,
|
|
263
|
+
.ft-ripple.ft-ripple--unbounded .ft-ripple--background {
|
|
264
|
+
width: ${this.rippleSize}px;
|
|
265
|
+
height: ${this.rippleSize}px;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.ft-ripple .ft-ripple--effect {
|
|
269
|
+
left: ${this.originX}px;
|
|
270
|
+
top: ${this.originY}px;
|
|
271
|
+
}
|
|
272
|
+
</style>
|
|
273
|
+
<div class="${s.classMap(t)}">
|
|
274
|
+
<div class="ft-ripple--background"></div>
|
|
275
|
+
<div class="ft-ripple--effect"></div>
|
|
276
|
+
</div>
|
|
277
|
+
`}contentAvailableCallback(t){super.contentAvailableCallback(t),this.ripple&&this.resizeObserver.observe(this.ripple),this.rippleEffect&&this.rippleEffect.ontransitionstart!==this.onTransitionStart&&(this.rippleEffect.ontransitionstart=this.onTransitionStart,this.rippleEffect.ontransitionend=this.onTransitionEnd)}updated(t){var i,e;super.updated(t),t.has("disabled")&&(this.disabled?(this.endRipple(),null===(i=this.target)||void 0===i||i.removeAttribute("data-is-ft-ripple-target")):null===(e=this.target)||void 0===e||e.setAttribute("data-is-ft-ripple-target","true")),t.has("unbounded")&&this.setRippleSize()}endRipple(){this.endHover(),this.endFocus(),this.endPress(),this.rippling=!1}setRippleSize(){if(this.ripple){const t=this.ripple.getBoundingClientRect();this.rippleSize=(this.unbounded?1:1.7)*Math.max(t.width,t.height)}}connectedCallback(){super.connectedCallback(),this.setupDebouncer.run((()=>{var t;const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentElement;i&&this.setupFor(i),this.setRippleSize()}))}setupFor(t){if(this.target===t)return;this.onDisconnect&&this.onDisconnect(),this.target=t,t.setAttribute("data-is-ft-ripple-target","true");const i=(...t)=>i=>{t.forEach((t=>window.addEventListener(t,this.endPress,{once:!0}))),this.startPress(i)},e=i("mouseup","contextmenu"),o=i("touchend","touchcancel"),s=t=>{["Enter"," "].includes(t.key)&&i("keyup")(t)};t.addEventListener("mouseover",this.startHover),t.addEventListener("mousemove",this.moveRipple),t.addEventListener("mouseleave",this.endHover),t.addEventListener("mousedown",e),t.addEventListener("touchstart",o),t.addEventListener("touchmove",this.moveRipple),t.addEventListener("keydown",s),t.addEventListener("focus",this.startFocus),t.addEventListener("blur",this.endFocus),t.addEventListener("focusin",this.startFocus),t.addEventListener("focusout",this.endFocus),this.onDisconnect=()=>{t.removeAttribute("data-is-ft-ripple-target"),t.removeEventListener("mouseover",this.startHover),t.removeEventListener("mousemove",this.moveRipple),t.removeEventListener("mouseleave",this.endHover),t.removeEventListener("mousedown",e),t.removeEventListener("touchstart",o),t.removeEventListener("touchmove",this.moveRipple),t.removeEventListener("keydown",s),t.removeEventListener("focus",this.startFocus),t.removeEventListener("blur",this.endFocus),t.removeEventListener("focusin",this.startFocus),t.removeEventListener("focusout",this.endFocus),this.onDisconnect=void 0,this.target=void 0}}getCoordinates(t){const i=t,e=t;let o,s;return null!=i.x?({x:o,y:s}=i):null!=e.touches&&(o=e.touches[0].clientX,s=e.touches[0].clientY),{x:o,y:s}}isIgnored(t){if(this.disabled)return!0;if(null!=t)for(let i of t.composedPath()){if(i===this.target)break;if("hasAttribute"in i&&i.hasAttribute("data-is-ft-ripple-target"))return!0}return!1}disconnectedCallback(){super.disconnectedCallback(),this.onDisconnect&&this.onDisconnect(),this.resizeObserver.disconnect(),this.endRipple()}}ne.elementDefinitions={},ne.styles=ie,se([o.property({type:Boolean})],ne.prototype,"primary",void 0),se([o.property({type:Boolean})],ne.prototype,"secondary",void 0),se([o.property({type:Boolean})],ne.prototype,"unbounded",void 0),se([o.property({type:Boolean})],ne.prototype,"activated",void 0),se([o.property({type:Boolean})],ne.prototype,"selected",void 0),se([o.property({type:Boolean})],ne.prototype,"disabled",void 0),se([o.state()],ne.prototype,"hovered",void 0),se([o.state()],ne.prototype,"focused",void 0),se([o.state()],ne.prototype,"pressed",void 0),se([o.state()],ne.prototype,"rippling",void 0),se([o.state()],ne.prototype,"rippleSize",void 0),se([o.state()],ne.prototype,"originX",void 0),se([o.state()],ne.prototype,"originY",void 0),se([o.query(".ft-ripple")],ne.prototype,"ripple",void 0),se([o.query(".ft-ripple--effect")],ne.prototype,"rippleEffect",void 0),i.customElement("ft-ripple")(ne),function(t){t.THUMBS_DOWN="",t.THUMBS_DOWN_PLAIN="",t.THUMBS_UP="",t.THUMBS_UP_PLAIN="",t.STAR="",t.STAR_PLAIN="",t.DESKTOP="",t.TABLET_LANDSCAPE="",t.TABLET_PORTRAIT="",t.MOBILE_LANDSCAPE="",t.MOBILE_PORTRAIT="",t.ARROW_RIGHT_TO_LINE="",t.THIN_ARROW_UP="",t.CONTEXTUAL="",t.UNSTRUCTURED_DOC="",t.RESET="",t.THIN_ARROW_LEFT="",t.THIN_ARROW_RIGHT="",t.MY_COLLECTIONS="",t.OFFLINE_SETTINGS="",t.MY_LIBRARY="",t.RATE_PLAIN="",t.RATE="",t.FEEDBACK_PLAIN="",t.PAUSE="",t.PLAY="",t.RELATIVES_PLAIN="",t.RELATIVES="",t.SHORTCUT_MENU="",t.PRINT="",t.DEFAULT_ROLES="",t.ACCOUNT_SETTINGS="",t.ONLINE="",t.OFFLINE="",t.UPLOAD="",t.BOOK_PLAIN="",t.SYNC="",t.SHARED_PBK="",t.COLLECTIONS="",t.SEARCH_IN_PUBLICATION="",t.BOOKS="",t.LOCKER="",t.ARROW_DOWN="",t.ARROW_LEFT="",t.ARROW_RIGHT="",t.ARROW_UP="",t.SAVE="",t.MAILS_AND_NOTIFICATIONS="",t.DOT="",t.MINUS="",t.PLUS="",t.FILTERS="",t.STRIPE_ARROW_RIGHT="",t.STRIPE_ARROW_LEFT="",t.ATTACHMENTS="",t.ADD_BOOKMARK="",t.BOOKMARK="",t.EXPORT="",t.MENU="",t.TAG="",t.TAG_PLAIN="",t.COPY_TO_CLIPBOARD="",t.COLUMNS="",t.ARTICLE="",t.CLOSE_PLAIN="",t.CHECK_PLAIN="",t.LOGOUT="",t.SIGN_IN="",t.THIN_ARROW="",t.TRIANGLE_BOTTOM="",t.TRIANGLE_LEFT="",t.TRIANGLE_RIGHT="",t.TRIANGLE_TOP="",t.FACET_HAS_DESCENDANT="",t.MINUS_PLAIN="",t.PLUS_PLAIN="",t.INFO="",t.ICON_EXPAND="",t.ICON_COLLAPSE="",t.ADD_TO_PBK="",t.ALERT="",t.ADD_ALERT="",t.BACK_TO_SEARCH="",t.DOWNLOAD="",t.EDIT="",t.FEEDBACK="",t.MODIFY_PBK="",t.SCHEDULED="",t.SEARCH="",t.SHARE="󨃱",t.TOC="",t.WRITE_UGC="",t.TRASH="",t.EXTLINK="",t.CALENDAR="",t.BOOK="",t.DOWNLOAD_PLAIN="",t.CHECK="",t.TOPICS="",t.EYE="",t.DISC="",t.CIRCLE="",t.SHARED="",t.SORT_UNSORTED="",t.SORT_UP="",t.SORT_DOWN="",t.WORKING="",t.CLOSE="",t.ZOOM_OUT="",t.ZOOM_IN="",t.ZOOM_REALSIZE="",t.ZOOM_FULLSCREEN="",t.ADMIN_RESTRICTED="",t.ADMIN_THEME="",t.WARNING="",t.CONTEXT="",t.SEARCH_HOME="",t.STEPS="",t.HOME="",t.TRANSLATE="",t.USER="",t.ADMIN="",t.ANALYTICS="",t.ADMIN_KHUB="",t.ADMIN_USERS="",t.ADMIN_INTEGRATION="",t.ADMIN_PORTAL=""}(ee||(ee={})),function(t){t.UNKNOWN="",t.ABW="",t.AUDIO="",t.AVI="",t.CHM="",t.CODE="",t.CSV="",t.DITA="",t.EPUB="",t.EXCEL="",t.FLAC="",t.GIF="",t.GZIP="",t.HTML="",t.IMAGE="",t.JPEG="",t.JSON="",t.M4A="",t.MOV="",t.MP3="",t.MP4="",t.OGG="",t.PDF="",t.PNG="",t.POWERPOINT="",t.RAR="",t.STP="",t.TEXT="",t.VIDEO="",t.WAV="",t.WMA="",t.WORD="",t.XML="",t.YAML="",t.ZIP=""}(oe||(oe={})),new Map([...["abw"].map((t=>[t,oe.ABW])),...["3gp","act","aiff","aac","amr","au","awb","dct","dss","dvf","gsm","iklax","ivs","mmf","mpc","msv","opus","ra","rm","raw","sln","tta","vox","wv"].map((t=>[t,oe.AUDIO])),...["avi"].map((t=>[t,oe.AVI])),...["chm","xhs"].map((t=>[t,oe.CHM])),...["java","py","php","php3","php4","php5","js","javascript","rb","rbw","c","cpp","cxx","h","hh","hpp","hxx","sh","bash","zsh","tcsh","ksh","csh","vb","scala","pl","prl","perl","groovy","ceylon","aspx","jsp","scpt","applescript","bas","bat","lua","jsp","mk","cmake","css","sass","less","m","mm","xcodeproj"].map((t=>[t,oe.CODE])),...["csv"].map((t=>[t,oe.CSV])),...["dita","ditamap","ditaval"].map((t=>[t,oe.DITA])),...["epub"].map((t=>[t,oe.EPUB])),...["xls","xlt","xlm","xlsx","xlsm","xltx","xltm","xlsb","xla","xlam","xll","xlw"].map((t=>[t,oe.EXCEL])),...["flac"].map((t=>[t,oe.FLAC])),...["gif"].map((t=>[t,oe.GIF])),...["gzip","x-gzip","giz","gz","tgz"].map((t=>[t,oe.GZIP])),...["html","htm","xhtml"].map((t=>[t,oe.HTML])),...["ai","vml","xps","img","cpt","psd","psp","xcf","svg","svg+xml","bmp","bpg","ppm","pgm","pbm","pnm","rif","tif","tiff","webp","wmf"].map((t=>[t,oe.IMAGE])),...["jpeg","jpg","jpe"].map((t=>[t,oe.JPEG])),...["json"].map((t=>[t,oe.JSON])),...["m4a","m4p"].map((t=>[t,oe.M4A])),...["mov","qt"].map((t=>[t,oe.MOV])),...["mp3"].map((t=>[t,oe.MP3])),...["mp4","m4v"].map((t=>[t,oe.MP4])),...["ogg","oga"].map((t=>[t,oe.OGG])),...["pdf","ps"].map((t=>[t,oe.PDF])),...["png"].map((t=>[t,oe.PNG])),...["ppt","pot","pps","pptx","pptm","potx","potm","ppam","ppsx","ppsm","sldx","sldm"].map((t=>[t,oe.POWERPOINT])),...["rar"].map((t=>[t,oe.RAR])),...["stp"].map((t=>[t,oe.STP])),...["txt","rtf","md","mdown"].map((t=>[t,oe.TEXT])),...["webm","mkv","flv","vob","ogv","ogg","drc","mng","wmv","yuv","rm","rmvb","asf","mpg","mp2","mpeg","mpe","mpv","m2v","svi","3gp","3g2","mxf","roq","nsv"].map((t=>[t,oe.VIDEO])),...["wav"].map((t=>[t,oe.WAV])),...["wma"].map((t=>[t,oe.WMA])),...["doc","dot","docx","docm","dotx","dotm","docb"].map((t=>[t,oe.WORD])),...["xml","xsl","rdf"].map((t=>[t,oe.XML])),...["yaml","yml","x-yaml"].map((t=>[t,oe.YAML])),...["zip"].map((t=>[t,oe.ZIP]))]);const re={size:i.FtCssVariableFactory.create("--ft-icon-font-size","SIZE","24px"),fluidTopicsFontFamily:i.FtCssVariableFactory.extend("--ft-icon-fluid-topics-font-family",i.FtCssVariableFactory.create("--ft-icon-font-family","UNKNOWN","ft-icons")),fileFormatFontFamily:i.FtCssVariableFactory.extend("--ft-icon-file-format-font-family",i.FtCssVariableFactory.create("--ft-icon-font-family","UNKNOWN","ft-mime")),materialFontFamily:i.FtCssVariableFactory.extend("--ft-icon-material-font-family",i.FtCssVariableFactory.create("--ft-icon-font-family","UNKNOWN","Material Icons")),verticalAlign:i.FtCssVariableFactory.create("--ft-icon-vertical-align","UNKNOWN","unset")},le=e.css`
|
|
278
|
+
:host, i.ft-icon {
|
|
279
|
+
display: inline-flex;
|
|
280
|
+
align-items: center;
|
|
281
|
+
flex-shrink: 0;
|
|
282
|
+
flex-grow: 0;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
:host {
|
|
286
|
+
width: ${re.size};
|
|
287
|
+
height: ${re.size};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
i.ft-icon {
|
|
291
|
+
width: 100%;
|
|
292
|
+
height: 100%;
|
|
293
|
+
font-size: ${re.size};
|
|
294
|
+
line-height: 1;
|
|
295
|
+
font-weight: normal;
|
|
296
|
+
text-transform: none;
|
|
297
|
+
font-style: normal;
|
|
298
|
+
font-variant: normal;
|
|
299
|
+
speak: none;
|
|
300
|
+
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.004);
|
|
301
|
+
text-rendering: auto;
|
|
302
|
+
-webkit-font-smoothing: antialiased;
|
|
303
|
+
-moz-osx-font-smoothing: grayscale;
|
|
304
|
+
vertical-align: ${re.verticalAlign};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
i.ft-icon.ft-icon--fluid-topics {
|
|
308
|
+
font-family: ${re.fluidTopicsFontFamily}, ft-icons, fticons, sans-serif;
|
|
309
|
+
|
|
310
|
+
/* Ugly fix because font is broken */
|
|
311
|
+
font-size: calc(0.9 * ${re.size});
|
|
312
|
+
position: relative;
|
|
313
|
+
top: -5%;
|
|
314
|
+
justify-content: center;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.ft-icon--file-format {
|
|
318
|
+
font-family: ${re.fileFormatFontFamily}, ft-mime, sans-serif;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.ft-icon--material {
|
|
322
|
+
font-family: ${re.materialFontFamily}, "Material Icons", sans-serif;
|
|
323
|
+
}
|
|
324
|
+
`;var ae;!function(t){t.fluid_topics="fluid-topics",t.file_format="file-format",t.material="material"}(ae||(ae={}));var he=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class pe extends i.FtLitElement{constructor(){super(...arguments),this.resolvedIcon=e.nothing}render(){var t;const i=null!==(t=this.variant)&&void 0!==t?t:ae.fluid_topics,o="material"!==i||this.value;return e.html`
|
|
325
|
+
<i class="ft-icon ${"ft-icon--"+i}">
|
|
326
|
+
${n.unsafeHTML(this.resolvedIcon)}
|
|
327
|
+
<slot ?hidden=${o}></slot>
|
|
328
|
+
</i>
|
|
329
|
+
`}get textContent(){var t,i;return null!==(i=null===(t=this.slottedContent)||void 0===t?void 0:t.assignedNodes().map((t=>t.textContent)).join("").trim())&&void 0!==i?i:""}update(t){super.update(t),["value","variant"].some((i=>t.has(i)))&&this.resolveIcon()}resolveIcon(){var t,i;let o=this.value||this.textContent;switch(this.variant){case ae.file_format:this.resolvedIcon=null!==(t=oe[o.replace("-","_").toUpperCase()])&&void 0!==t?t:o;break;case ae.material:this.resolvedIcon=this.value||e.nothing;break;default:this.resolvedIcon=null!==(i=ee[o.replace("-","_").toUpperCase()])&&void 0!==i?i:o}}firstUpdated(t){super.firstUpdated(t),setTimeout((()=>this.resolveIcon()))}}pe.elementDefinitions={},pe.styles=le,he([o.property()],pe.prototype,"variant",void 0),he([o.property()],pe.prototype,"value",void 0),he([o.state()],pe.prototype,"resolvedIcon",void 0),he([o.query("slot")],pe.prototype,"slottedContent",void 0),i.customElement("ft-icon")(pe);const ce=i.FtCssVariableFactory.extend("--ft-chip-color",i.designSystemVariables.colorOnSurface),fe={backgroundColor:i.FtCssVariableFactory.extend("--ft-chip-background-color",i.designSystemVariables.colorSurface),color:ce,fontSize:i.FtCssVariableFactory.extend("--ft-chip-font-size",ti.fontSize),iconSize:i.FtCssVariableFactory.create("--ft-chip-icon-size","SIZE","18px"),rippleColor:i.FtCssVariableFactory.extend("--ft-chip-ripple-color",ce),horizontalPadding:i.FtCssVariableFactory.create("--ft-chip-horizontal-padding","SIZE","6px"),verticalPadding:i.FtCssVariableFactory.create("--ft-chip-vertical-padding","SIZE","6px"),colorOutline:i.FtCssVariableFactory.external(i.designSystemVariables.colorOutline,"Design system"),opacityDisabled:i.FtCssVariableFactory.external(i.designSystemVariables.colorOpacityDisabled,"Design system")},de=i.FtCssVariableFactory.extend("--ft-chip-highlighted-color",i.FtCssVariableFactory.extend("--ft-chip-color",i.designSystemVariables.colorOnPrimary)),ue={backgroundColor:i.FtCssVariableFactory.extend("--ft-chip-highlighted-background-color",i.FtCssVariableFactory.extend("--ft-chip-background-color",i.designSystemVariables.colorPrimary)),color:de,rippleColor:i.FtCssVariableFactory.extend("--ft-chip-highlighted-ripple-color",de)},ge=i.FtCssVariableFactory.create("--ft-chip-dense-horizontal-padding","SIZE","4px"),ve=i.FtCssVariableFactory.create("--ft-chip-dense-vertical-padding","SIZE","4px"),ye=[i.noTextSelect,e.css`
|
|
330
|
+
:host {
|
|
331
|
+
display: inline-block;
|
|
332
|
+
max-width: 100%;
|
|
333
|
+
pointer-events: none;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.ft-chip {
|
|
337
|
+
position: relative;
|
|
338
|
+
display: flex;
|
|
339
|
+
justify-content: center;
|
|
340
|
+
align-items: center;
|
|
341
|
+
width: 100%;
|
|
342
|
+
overflow: hidden;
|
|
343
|
+
box-sizing: border-box;
|
|
344
|
+
pointer-events: auto;
|
|
345
|
+
|
|
346
|
+
--ft-chip-internal-font-size: ${fe.fontSize};
|
|
347
|
+
--ft-chip-internal-line-height: max(20px, calc(var(--ft-chip-internal-font-size) + 2px));
|
|
348
|
+
${i.setVariable(re.size,fe.iconSize)};
|
|
349
|
+
--ft-chip-internal-vertical-padding: ${fe.verticalPadding};
|
|
350
|
+
--ft-chip-internal-horizontal-padding: ${fe.horizontalPadding};
|
|
351
|
+
--ft-chip-internal-icon-padding: 3px;
|
|
352
|
+
--ft-chip-internal-content-height: max(var(--ft-chip-internal-line-height), ${fe.iconSize});
|
|
353
|
+
|
|
354
|
+
border: 1px solid ${fe.colorOutline};
|
|
355
|
+
color: ${fe.color};
|
|
356
|
+
${i.setVariable(qi.color,fe.rippleColor)};
|
|
357
|
+
border-radius: calc(var(--ft-chip-internal-content-height) / 2 + var(--ft-chip-internal-vertical-padding));
|
|
358
|
+
padding: calc(var(--ft-chip-internal-vertical-padding) - 1px) calc(var(--ft-chip-internal-horizontal-padding) - 1px);
|
|
359
|
+
background-color: ${fe.backgroundColor};
|
|
360
|
+
line-height: var(--ft-chip-internal-content-height);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.ft-chip > *:not(ft-ripple) {
|
|
364
|
+
position: relative;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.ft-chip--dense {
|
|
368
|
+
--ft-chip-internal-icon-padding: 3px;
|
|
369
|
+
--ft-chip-internal-vertical-padding: ${ve};
|
|
370
|
+
--ft-chip-internal-horizontal-padding: ${ge};
|
|
371
|
+
--ft-chip-internal-line-height: max(16px, calc(var(--ft-chip-internal-font-size) + 2px));
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.ft-chip--no-content {
|
|
375
|
+
--ft-chip-internal-horizontal-padding: var(--ft-chip-horizontal-padding, var(--ft-chip-internal-vertical-padding));
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.ft-chip--disabled {
|
|
379
|
+
cursor: default;
|
|
380
|
+
pointer-events: none;
|
|
381
|
+
filter: grayscale(1);
|
|
382
|
+
opacity: ${fe.opacityDisabled};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.ft-chip--highlighted {
|
|
386
|
+
border: none;
|
|
387
|
+
padding: var(--ft-chip-internal-vertical-padding) var(--ft-chip-internal-horizontal-padding);
|
|
388
|
+
background-color: ${ue.backgroundColor};
|
|
389
|
+
${i.setVariable(qi.color,ue.rippleColor)};
|
|
390
|
+
color: ${ue.color};
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.ft-chip--clickable {
|
|
394
|
+
cursor: pointer;
|
|
395
|
+
-webkit-mask-image: radial-gradient(white, black);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.ft-chip:focus {
|
|
399
|
+
outline: none;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.ft-chip--icon-container {
|
|
403
|
+
display: inline-flex;
|
|
404
|
+
position: relative;
|
|
405
|
+
overflow: hidden;
|
|
406
|
+
border-radius: 100%;
|
|
407
|
+
justify-content: center;
|
|
408
|
+
align-items: center;
|
|
409
|
+
flex-shrink: 0;
|
|
410
|
+
|
|
411
|
+
padding: var(--ft-chip-internal-icon-padding);
|
|
412
|
+
margin: calc((-1) * var(--ft-chip-internal-icon-padding));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.ft-chip--icon-container > *:not(ft-ripple) {
|
|
416
|
+
position: relative;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.ft-chip--label {
|
|
420
|
+
vertical-align: bottom;
|
|
421
|
+
display: block;
|
|
422
|
+
margin: 0 var(--ft-chip-internal-horizontal-padding);
|
|
423
|
+
${i.setVariable(ti.fontSize,"var(--ft-chip-internal-font-size)")};
|
|
424
|
+
${i.setVariable(ti.lineHeight,"var(--ft-chip-internal-content-height)")};
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.ft-chip--safari-fix .ft-chip--label {
|
|
428
|
+
margin-right: 0;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.ft-chip:not(.ft-chip--multi-line) .ft-chip--label {
|
|
432
|
+
overflow: hidden;
|
|
433
|
+
white-space: nowrap;
|
|
434
|
+
text-overflow: ellipsis;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.ft-chip--safari-fix:not(.ft-chip--multi-line) .ft-chip--label:after {
|
|
438
|
+
content: "\\0000a0";
|
|
439
|
+
display: inline-block;
|
|
440
|
+
width: 0;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.ft-chip--no-content .ft-chip--label {
|
|
444
|
+
display: none;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.ft-chip--no-content .ft-chip--label + .ft-chip--icon-container {
|
|
448
|
+
width: var(--ft-chip-internal-content-height);
|
|
449
|
+
height: var(--ft-chip-internal-content-height);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.ft-chip--icon-container:focus {
|
|
453
|
+
outline: none;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.ft-chip:not(.ft-chip--trailing-icon) .ft-chip--icon-container {
|
|
457
|
+
order: -1;
|
|
458
|
+
}
|
|
459
|
+
`];var xe=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class me extends CustomEvent{constructor(){super("icon-click")}}class be extends i.FtLitElement{constructor(){super(...arguments),this.highlighted=!1,this.removable=!1,this.disabled=!1,this.clickable=!1,this.iconClickable=!1,this.dense=!1,this.multiLine=!1,this.label="",this.icon=void 0,this.trailingIcon=!1}render(){const t={"ft-chip":!0,"ft-chip--highlighted":this.highlighted,"ft-chip--disabled":this.disabled,"ft-chip--clickable":this.interactionsOnChip,"ft-chip--trailing-icon":this.trailingIcon||this.removable,"ft-chip--no-content":!this.hasTextContent(),"ft-chip--dense":this.dense,"ft-chip--multi-line":this.multiLine,"ft-chip--safari-fix":i.isSafari};return e.html`
|
|
460
|
+
<div class="${s.classMap(t)}"
|
|
461
|
+
aria-label="${this.getLabel()}"
|
|
462
|
+
tabindex="${this.interactionsOnChip?0:-1}"
|
|
463
|
+
@keyup=${this.onKeyUp}>
|
|
464
|
+
<ft-ripple ?disabled=${!this.interactionsOnChip}></ft-ripple>
|
|
465
|
+
<ft-typography variant="body2" element="span" class="ft-chip--label">
|
|
466
|
+
<slot @slotchange=${this.onSlotchange}></slot>
|
|
467
|
+
</ft-typography>
|
|
468
|
+
${this.internalIcon?this.renderIcon():null}
|
|
469
|
+
</div>
|
|
470
|
+
`}get interactionsOnChip(){return this.clickable&&!this.disabled}get interactionsOnIcon(){return(this.iconClickable||this.removable)&&!this.disabled}renderIcon(){return e.html`
|
|
471
|
+
<div class="ft-chip--icon-container ft-no-text-select ${this.interactionsOnIcon?"ft-chip--clickable":""}"
|
|
472
|
+
tabindex="${this.interactionsOnIcon?0:-1}"
|
|
473
|
+
@click=${this.onIconClick}
|
|
474
|
+
@keyup=${this.onIconKeyUp}>
|
|
475
|
+
<ft-ripple ?disabled=${!this.interactionsOnIcon}></ft-ripple>
|
|
476
|
+
<ft-icon variant="material">${this.internalIcon}</ft-icon>
|
|
477
|
+
</div>
|
|
478
|
+
`}onKeyUp(t){this.interactionsOnChip&&["Enter"," "].includes(t.key)&&t.target.click()}onIconKeyUp(t){this.interactionsOnIcon&&["Enter"," "].includes(t.key)&&(t.stopPropagation(),this.dispatchEvent(new me))}onIconClick(t){this.interactionsOnIcon&&(t.stopPropagation(),this.dispatchEvent(new me))}getLabel(){return this.label||this.textContent}get textContent(){var t,i;return null!==(i=null===(t=this.slottedContent)||void 0===t?void 0:t.assignedNodes().map((t=>t.textContent)).join("").trim())&&void 0!==i?i:""}hasTextContent(){return this.textContent.length>0}onSlotchange(){this.requestUpdate()}get internalIcon(){return this.icon||(this.removable?"cancel":void 0)}}be.elementDefinitions={"ft-ripple":ne,"ft-typography":_i,"ft-icon":pe},be.styles=ye,xe([o.property({type:Boolean})],be.prototype,"highlighted",void 0),xe([o.property({type:Boolean})],be.prototype,"removable",void 0),xe([o.property({type:Boolean})],be.prototype,"disabled",void 0),xe([o.property({type:Boolean})],be.prototype,"clickable",void 0),xe([o.property({type:Boolean})],be.prototype,"iconClickable",void 0),xe([o.property({type:Boolean})],be.prototype,"dense",void 0),xe([o.property({type:Boolean})],be.prototype,"multiLine",void 0),xe([o.property({type:String})],be.prototype,"label",void 0),xe([o.property({type:String})],be.prototype,"icon",void 0),xe([o.property({type:Boolean})],be.prototype,"trailingIcon",void 0),xe([o.query("ft-typography slot")],be.prototype,"slottedContent",void 0),i.customElement("ft-chip")(be);var $e=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class we extends(O(u)){constructor(){super(),this.useChip=!1,this.editorMode=!1,this.addStore(v),this.addI18nContext(A)}render(){return this.useChip?e.html`
|
|
479
|
+
<ft-tooltip text="${this.tooltipText}">
|
|
480
|
+
<ft-chip>${this.renderContent()}</ft-chip>
|
|
481
|
+
</ft-tooltip>
|
|
482
|
+
`:e.html`${this.renderContent()}`}renderContent(){return this.metadata?e.html`${this.getEllipsis(this.valueText)}`:this.editorMode?this.key?e.html`${A.messages.noValuePresent(this.key)}`:e.html`${A.messages.noKeySelected()}`:e.html`
|
|
483
|
+
<style>
|
|
484
|
+
:host {
|
|
485
|
+
display: none !important;
|
|
486
|
+
}
|
|
487
|
+
</style>
|
|
488
|
+
`}getEllipsis(t){let i=this.maxLength?t.substring(0,this.maxLength):t;return i+(i.length<t.length?"...":"")}updated(t){super.updated(t),t.has("result")&&this.result&&(this.metadata=this.selectMetadata(this.result))}selectMetadata(t){switch(t.type){case"MAP":return t.map.metadata.find((t=>t.key==this.key));case"DOCUMENT":return t.document.metadata.find((t=>t.key==this.key));case"TOPIC":return t.topic.metadata.find((t=>t.key==this.key))}}get valueText(){var t,i;return null!==(i=null===(t=this.metadata)||void 0===t?void 0:t.values.join(", "))&&void 0!==i?i:""}get tooltipText(){var t,i;return this.metadata?`${null!==(i=null===(t=this.metadata)||void 0===t?void 0:t.label)&&void 0!==i?i:this.metadata.key}: ${this.valueText}`:""}}we.elementDefinitions={"ft-tooltip":Gi,"ft-chip":be},we.styles=r,$e([o.property()],we.prototype,"key",void 0),$e([o.property({type:Boolean})],we.prototype,"useChip",void 0),$e([o.property({type:Number,attribute:"max-length"})],we.prototype,"maxLength",void 0),$e([i.redux({store:v.name})],we.prototype,"editorMode",void 0),$e([o.state()],we.prototype,"metadata",void 0),i.customElement("ft-search-result-metadata")(we),t.FtSearchResultMetadata=we,t.FtSearchResultMetadataCssVariables={},t.styles=r,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
|