niris-public-community-components 0.0.7 → 0.0.9
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 +75 -59
- package/dev/form-niris.html +1 -1
- package/dist/form-niris.d.ts.map +1 -1
- package/dist/form-niris.js +25 -14
- package/dist/form-niris.js.map +1 -1
- package/dist/form-to-niris.js +14 -5
- package/dist/my-element.d.ts +37 -0
- package/dist/my-element.d.ts.map +1 -0
- package/dist/my-element.js +72 -0
- package/dist/my-element.js.map +1 -0
- package/dist/textarea-to-niris.bundled.js +261 -0
- package/dist/textarea-to-niris.d.ts +22 -0
- package/dist/textarea-to-niris.d.ts.map +1 -0
- package/dist/textarea-to-niris.js +60 -9
- package/dist/textarea-to-niris.js.map +1 -0
- package/package.json +1 -1
- package/src/form-niris.ts +29 -19
- package/src/textarea-to-niris.ts +1 -1
@@ -0,0 +1,37 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2019 Google LLC
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
5
|
+
*/
|
6
|
+
import { LitElement } from 'lit';
|
7
|
+
/**
|
8
|
+
* An example element.
|
9
|
+
*
|
10
|
+
* @fires count-changed - Indicates when the count changes
|
11
|
+
* @slot - This element has a slot
|
12
|
+
* @csspart button - The button
|
13
|
+
*/
|
14
|
+
export declare class MyElement extends LitElement {
|
15
|
+
static styles: import("lit").CSSResult;
|
16
|
+
/**
|
17
|
+
* The name to say "Hello" to.
|
18
|
+
*/
|
19
|
+
name: string;
|
20
|
+
/**
|
21
|
+
* The number of times the button has been clicked.
|
22
|
+
*/
|
23
|
+
count: number;
|
24
|
+
render(): import("lit-html").TemplateResult<1>;
|
25
|
+
private _onClick;
|
26
|
+
/**
|
27
|
+
* Formats a greeting
|
28
|
+
* @param name The name to say "Hello" to
|
29
|
+
*/
|
30
|
+
sayHello(name: string): string;
|
31
|
+
}
|
32
|
+
declare global {
|
33
|
+
interface HTMLElementTagNameMap {
|
34
|
+
'my-element': MyElement;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
//# sourceMappingURL=my-element.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"my-element.d.ts","sourceRoot":"","sources":["../src/my-element.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,UAAU,EAAY,MAAM,KAAK,CAAC;AAG1C;;;;;;GAMG;AACH,qBACa,SAAU,SAAQ,UAAU;IACvC,OAAgB,MAAM,0BAOpB;IAEF;;OAEG;IAEH,IAAI,SAAW;IAEf;;OAEG;IAEH,KAAK,SAAK;IAED,MAAM;IAUf,OAAO,CAAC,QAAQ;IAKhB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAG/B;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2019 Google LLC
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
5
|
+
*/
|
6
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
9
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
11
|
+
};
|
12
|
+
import { LitElement, html, css } from 'lit';
|
13
|
+
import { customElement, property } from 'lit/decorators.js';
|
14
|
+
/**
|
15
|
+
* An example element.
|
16
|
+
*
|
17
|
+
* @fires count-changed - Indicates when the count changes
|
18
|
+
* @slot - This element has a slot
|
19
|
+
* @csspart button - The button
|
20
|
+
*/
|
21
|
+
let MyElement = class MyElement extends LitElement {
|
22
|
+
constructor() {
|
23
|
+
super(...arguments);
|
24
|
+
/**
|
25
|
+
* The name to say "Hello" to.
|
26
|
+
*/
|
27
|
+
this.name = 'World';
|
28
|
+
/**
|
29
|
+
* The number of times the button has been clicked.
|
30
|
+
*/
|
31
|
+
this.count = 0;
|
32
|
+
}
|
33
|
+
render() {
|
34
|
+
return html `
|
35
|
+
<h1>${this.sayHello(this.name)}!</h1>
|
36
|
+
<button @click=${this._onClick} part="button">
|
37
|
+
Click Count: ${this.count}
|
38
|
+
</button>
|
39
|
+
<slot></slot>
|
40
|
+
`;
|
41
|
+
}
|
42
|
+
_onClick() {
|
43
|
+
this.count++;
|
44
|
+
this.dispatchEvent(new CustomEvent('count-changed'));
|
45
|
+
}
|
46
|
+
/**
|
47
|
+
* Formats a greeting
|
48
|
+
* @param name The name to say "Hello" to
|
49
|
+
*/
|
50
|
+
sayHello(name) {
|
51
|
+
return `Hello, ${name}`;
|
52
|
+
}
|
53
|
+
};
|
54
|
+
MyElement.styles = css `
|
55
|
+
:host {
|
56
|
+
display: block;
|
57
|
+
border: solid 1px gray;
|
58
|
+
padding: 16px;
|
59
|
+
max-width: 800px;
|
60
|
+
}
|
61
|
+
`;
|
62
|
+
__decorate([
|
63
|
+
property()
|
64
|
+
], MyElement.prototype, "name", void 0);
|
65
|
+
__decorate([
|
66
|
+
property({ type: Number })
|
67
|
+
], MyElement.prototype, "count", void 0);
|
68
|
+
MyElement = __decorate([
|
69
|
+
customElement('my-element')
|
70
|
+
], MyElement);
|
71
|
+
export { MyElement };
|
72
|
+
//# sourceMappingURL=my-element.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"my-element.js","sourceRoot":"","sources":["../src/my-element.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;AAEH,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAC,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE1D;;;;;;GAMG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QAUL;;WAEG;QAEH,SAAI,GAAG,OAAO,CAAC;QAEf;;WAEG;QAEH,UAAK,GAAG,CAAC,CAAC;IAwBZ,CAAC;IAtBU,MAAM;QACb,OAAO,IAAI,CAAA;YACH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;uBACb,IAAI,CAAC,QAAQ;uBACb,IAAI,CAAC,KAAK;;;KAG5B,CAAC;IACJ,CAAC;IAEO,QAAQ;QACd,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAY;QACnB,OAAO,UAAU,IAAI,EAAE,CAAC;IAC1B,CAAC;;AA1Ce,gBAAM,GAAG,GAAG,CAAA;;;;;;;GAO3B,AAPqB,CAOpB;AAMF;IADC,QAAQ,EAAE;uCACI;AAMf;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;wCACf;AApBC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA4CrB","sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {LitElement, html, css} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\n\n/**\n * An example element.\n *\n * @fires count-changed - Indicates when the count changes\n * @slot - This element has a slot\n * @csspart button - The button\n */\n@customElement('my-element')\nexport class MyElement extends LitElement {\n static override styles = css`\n :host {\n display: block;\n border: solid 1px gray;\n padding: 16px;\n max-width: 800px;\n }\n `;\n\n /**\n * The name to say \"Hello\" to.\n */\n @property()\n name = 'World';\n\n /**\n * The number of times the button has been clicked.\n */\n @property({type: Number})\n count = 0;\n\n override render() {\n return html`\n <h1>${this.sayHello(this.name)}!</h1>\n <button @click=${this._onClick} part=\"button\">\n Click Count: ${this.count}\n </button>\n <slot></slot>\n `;\n }\n\n private _onClick() {\n this.count++;\n this.dispatchEvent(new CustomEvent('count-changed'));\n }\n\n /**\n * Formats a greeting\n * @param name The name to say \"Hello\" to\n */\n sayHello(name: string): string {\n return `Hello, ${name}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'my-element': MyElement;\n }\n}\n"]}
|
@@ -0,0 +1,261 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2019 Google LLC
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
5
|
+
*/
|
6
|
+
const t=globalThis,i=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,e=Symbol(),s=new WeakMap;class r{constructor(t,i,s){if(this._$cssResult$=!0,s!==e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(e,t))}return t}toString(){return this.cssText}}const o=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let i="";for(const e of t.cssRules)i+=e.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,e))(i)})(t):t
|
7
|
+
/**
|
8
|
+
* @license
|
9
|
+
* Copyright 2017 Google LLC
|
10
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
11
|
+
*/,{is:n,defineProperty:h,getOwnPropertyDescriptor:a,getOwnPropertyNames:c,getOwnPropertySymbols:l,getPrototypeOf:d}=Object,u=globalThis,f=u.trustedTypes,p=f?f.emptyScript:"",v=u.reactiveElementPolyfillSupport,g=(t,i)=>t,b={toAttribute(t,i){switch(i){case Boolean:t=t?p:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let e=t;switch(i){case Boolean:e=null!==t;break;case Number:e=null===t?null:Number(t);break;case Object:case Array:try{e=JSON.parse(t)}catch(t){e=null}}return e}},w=(t,i)=>!n(t,i),m={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),u.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=m){if(i.state&&(i.attribute=!1),this._$Ei(),this.elementProperties.set(t,i),!i.noAccessor){const e=Symbol(),s=this.getPropertyDescriptor(t,e,i);void 0!==s&&h(this.prototype,t,s)}}static getPropertyDescriptor(t,i,e){const{get:s,set:r}=a(this.prototype,t)??{get(){return this[i]},set(t){this[i]=t}};return{get(){return s?.call(this)},set(i){const o=s?.call(this);r.call(this,i),this.requestUpdate(t,o,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??m}static _$Ei(){if(this.hasOwnProperty(g("elementProperties")))return;const t=d(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(g("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(g("properties"))){const t=this.properties,i=[...c(t),...l(t)];for(const e of i)this.createProperty(e,t[e])}const t=this[Symbol.metadata];if(null!==t){const i=litPropertyMetadata.get(t);if(void 0!==i)for(const[t,e]of i)this.elementProperties.set(t,e)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const e=this._$Eu(t,i);void 0!==e&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const e=new Set(t.flat(1/0).reverse());for(const t of e)i.unshift(o(t))}else void 0!==t&&i.push(o(t));return i}static _$Eu(t,i){const e=i.attribute;return!1===e?void 0:"string"==typeof e?e:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,i=this.constructor.elementProperties;for(const e of i.keys())this.hasOwnProperty(e)&&(t.set(e,this[e]),delete this[e]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,s)=>{if(i)e.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of s){const s=document.createElement("style"),r=t.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=i.cssText,e.appendChild(s)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,i,e){this._$AK(t,e)}_$EC(t,i){const e=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,e);if(void 0!==s&&!0===e.reflect){const r=(void 0!==e.converter?.toAttribute?e.converter:b).toAttribute(i,e.type);this._$Em=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,i){const e=this.constructor,s=e._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=e.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:b;this._$Em=s,this[s]=r.fromAttribute(i,t.type),this._$Em=null}}requestUpdate(t,i,e){if(void 0!==t){if(e??=this.constructor.getPropertyOptions(t),!(e.hasChanged??w)(this[t],i))return;this.P(t,i,e)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,i,e){this._$AL.has(t)||this._$AL.set(t,i),!0===e.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,i]of this._$Ep)this[t]=i;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[i,e]of t)!0!==e.wrapped||this._$AL.has(i)||void 0===this[i]||this.P(i,this[i],e)}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(i)):this._$EU()}catch(i){throw t=!1,this._$EU(),i}t&&this._$AE(i)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[g("elementProperties")]=new Map,y[g("finalized")]=new Map,v?.({ReactiveElement:y}),(u.reactiveElementVersions??=[]).push("2.0.4");
|
12
|
+
/**
|
13
|
+
* @license
|
14
|
+
* Copyright 2017 Google LLC
|
15
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
16
|
+
*/
|
17
|
+
const x=globalThis,S=x.trustedTypes,$=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,k="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+A,E=`<${C}>`,_=document,T=()=>_.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,z=Array.isArray,P="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,L=/>/g,O=RegExp(`>|${P}(?:([^\\s"'>=/]+)(${P}*=${P}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),N=/'/g,I=/"/g,R=/^(?:script|style|textarea|title)$/i,D=(t=>(i,...e)=>({_$litType$:t,strings:i,values:e}))(1),W=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),B=new WeakMap,H=_.createTreeWalker(_,129);function J(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$?$.createHTML(i):i}const V=(t,i)=>{const e=t.length-1,s=[];let r,o=2===i?"<svg>":"",n=U;for(let i=0;i<e;i++){const e=t[i];let h,a,c=-1,l=0;for(;l<e.length&&(n.lastIndex=l,a=n.exec(e),null!==a);)l=n.lastIndex,n===U?"!--"===a[1]?n=j:void 0!==a[1]?n=L:void 0!==a[2]?(R.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=O):void 0!==a[3]&&(n=O):n===O?">"===a[0]?(n=r??U,c=-1):void 0===a[1]?c=-2:(c=n.lastIndex-a[2].length,h=a[1],n=void 0===a[3]?O:'"'===a[3]?I:N):n===I||n===N?n=O:n===j||n===L?n=U:(n=O,r=void 0);const d=n===O&&t[i+1].startsWith("/>")?" ":"";o+=n===U?e+E:c>=0?(s.push(h),e.slice(0,c)+k+e.slice(c)+A+d):e+A+(-2===c?i:d)}return[J(t,o+(t[e]||"<?>")+(2===i?"</svg>":"")),s]};class Z{constructor({strings:t,_$litType$:i},e){let s;this.parts=[];let r=0,o=0;const n=t.length-1,h=this.parts,[a,c]=V(t,i);if(this.el=Z.createElement(a,e),H.currentNode=this.el.content,2===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=H.nextNode())&&h.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(k)){const i=c[o++],e=s.getAttribute(t).split(A),n=/([.?@])?(.*)/.exec(i);h.push({type:1,index:r,name:n[2],strings:e,ctor:"."===n[1]?X:"?"===n[1]?Y:"@"===n[1]?tt:G}),s.removeAttribute(t)}else t.startsWith(A)&&(h.push({type:6,index:r}),s.removeAttribute(t));if(R.test(s.tagName)){const t=s.textContent.split(A),i=t.length-1;if(i>0){s.textContent=S?S.emptyScript:"";for(let e=0;e<i;e++)s.append(t[e],T()),H.nextNode(),h.push({type:2,index:++r});s.append(t[i],T())}}}else if(8===s.nodeType)if(s.data===C)h.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(A,t+1));)h.push({type:7,index:r}),t+=A.length-1}r++}}static createElement(t,i){const e=_.createElement("template");return e.innerHTML=t,e}}function K(t,i,e=t,s){if(i===W)return i;let r=void 0!==s?e._$Co?.[s]:e._$Cl;const o=M(i)?void 0:i._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),void 0===o?r=void 0:(r=new o(t),r._$AT(t,e,s)),void 0!==s?(e._$Co??=[])[s]=r:e._$Cl=r),void 0!==r&&(i=K(t,r._$AS(t,i.values),r,s)),i}class Q{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:e}=this._$AD,s=(t?.creationScope??_).importNode(i,!0);H.currentNode=s;let r=H.nextNode(),o=0,n=0,h=e[0];for(;void 0!==h;){if(o===h.index){let i;2===h.type?i=new F(r,r.nextSibling,this,t):1===h.type?i=new h.ctor(r,h.name,h.strings,this,t):6===h.type&&(i=new it(r,this,t)),this._$AV.push(i),h=e[++n]}o!==h?.index&&(r=H.nextNode(),o++)}return H.currentNode=_,s}p(t){let i=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,i),i+=e.strings.length-2):e._$AI(t[i])),i++}}class F{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,e,s){this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=e,this.options=s,this._$Cv=s?.isConnected??!0}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=K(this,t,i),M(t)?t===q||null==t||""===t?(this._$AH!==q&&this._$AR(),this._$AH=q):t!==this._$AH&&t!==W&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>z(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==q&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(_.createTextNode(t)),this._$AH=t}$(t){const{values:i,_$litType$:e}=t,s="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=Z.createElement(J(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===s)this._$AH.p(i);else{const t=new Q(s,this),e=t.u(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let i=B.get(t.strings);return void 0===i&&B.set(t.strings,i=new Z(t)),i}k(t){z(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let e,s=0;for(const r of t)s===i.length?i.push(e=new F(this.S(T()),this.S(T()),this,this.options)):e=i[s],e._$AI(r),s++;s<i.length&&(this._$AR(e&&e._$AB.nextSibling,s),i.length=s)}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class G{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,e,s,r){this.type=1,this._$AH=q,this._$AN=void 0,this.element=t,this.name=i,this._$AM=s,this.options=r,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=q}_$AI(t,i=this,e,s){const r=this.strings;let o=!1;if(void 0===r)t=K(this,t,i,0),o=!M(t)||t!==this._$AH&&t!==W,o&&(this._$AH=t);else{const s=t;let n,h;for(t=r[0],n=0;n<r.length-1;n++)h=K(this,s[e+n],i,n),h===W&&(h=this._$AH[n]),o||=!M(h)||h!==this._$AH[n],h===q?t=q:t!==q&&(t+=(h??"")+r[n+1]),this._$AH[n]=h}o&&!s&&this.j(t)}j(t){t===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class X extends G{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===q?void 0:t}}class Y extends G{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==q)}}class tt extends G{constructor(t,i,e,s,r){super(t,i,e,s,r),this.type=5}_$AI(t,i=this){if((t=K(this,t,i,0)??q)===W)return;const e=this._$AH,s=t===q&&e!==q||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,r=t!==q&&(e===q||s);s&&this.element.removeEventListener(this.name,this,e),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class it{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){K(this,t)}}const et=x.litHtmlPolyfillSupport;et?.(Z,F),(x.litHtmlVersions??=[]).push("3.1.4");
|
18
|
+
/**
|
19
|
+
* @license
|
20
|
+
* Copyright 2017 Google LLC
|
21
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
22
|
+
*/
|
23
|
+
class st extends y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,i,e)=>{const s=e?.renderBefore??i;let r=s._$litPart$;if(void 0===r){const t=e?.renderBefore??null;s._$litPart$=r=new F(i.insertBefore(T(),t),t,void 0,e??{})}return r._$AI(t),r})(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}}st._$litElement$=!0,st.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:st});const rt=globalThis.litElementPolyfillSupport;rt?.({LitElement:st}),(globalThis.litElementVersions??=[]).push("4.0.6");
|
24
|
+
/**
|
25
|
+
* @license
|
26
|
+
* Copyright 2017 Google LLC
|
27
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
28
|
+
*/
|
29
|
+
const ot={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:w},nt=(t=ot,i,e)=>{const{kind:s,metadata:r}=e;let o=globalThis.litPropertyMetadata.get(r);if(void 0===o&&globalThis.litPropertyMetadata.set(r,o=new Map),o.set(e.name,t),"accessor"===s){const{name:s}=e;return{set(e){const r=i.get.call(this);i.set.call(this,e),this.requestUpdate(s,r,t)},init(i){return void 0!==i&&this.P(s,void 0,t),i}}}if("setter"===s){const{name:s}=e;return function(e){const r=this[s];i.call(this,e),this.requestUpdate(s,r,t)}}throw Error("Unsupported decorator location: "+s)};function ht(t){return(i,e)=>"object"==typeof e?nt(t,i,e):((t,i,e)=>{const s=i.hasOwnProperty(e);return i.constructor.createProperty(e,s?{...t,wrapped:!0}:t),s?Object.getOwnPropertyDescriptor(i,e):void 0})(t,i,e)
|
30
|
+
/**
|
31
|
+
* @license
|
32
|
+
* Copyright 2021 Google LLC
|
33
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
34
|
+
*/}const at=(t,i,e)=>{let s=t[0];for(let r=1;r<t.length;r++)s+=i[e?e[r-1]:r-1],s+=t[r];return s},ct=t=>{return"string"!=typeof(i=t)&&"strTag"in i?at(t.strings,t.values):t;var i},lt="lit-localize-status";
|
35
|
+
/**
|
36
|
+
* @license
|
37
|
+
* Copyright 2021 Google LLC
|
38
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
39
|
+
*/
|
40
|
+
class dt{constructor(t){this.i=t=>{"ready"===t.detail.status&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(lt,this.i)}hostDisconnected(){window.removeEventListener(lt,this.i)}}const ut=t=>t.addController(new dt(t));
|
41
|
+
/**
|
42
|
+
* @license
|
43
|
+
* Copyright 2020 Google LLC
|
44
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
45
|
+
*/
|
46
|
+
class ft{constructor(){this.settled=!1,this.promise=new Promise(((t,i)=>{this._resolve=t,this._reject=i}))}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}}
|
47
|
+
/**
|
48
|
+
* @license
|
49
|
+
* Copyright 2014 Travis Webb
|
50
|
+
* SPDX-License-Identifier: MIT
|
51
|
+
*/const pt=[];for(let t=0;t<256;t++)pt[t]=(t>>4&15).toString(16)+(15&t).toString(16);
|
52
|
+
/**
|
53
|
+
* @license
|
54
|
+
* Copyright 2020 Google LLC
|
55
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
56
|
+
*/
|
57
|
+
const vt="",gt="h",bt="s";function wt(t,i){return(i?gt:bt)+function(t){let i=0,e=8997,s=0,r=33826,o=0,n=40164,h=0,a=52210;for(let c=0;c<t.length;c++)e^=t.charCodeAt(c),i=435*e,s=435*r,o=435*n,h=435*a,o+=e<<8,h+=r<<8,s+=i>>>16,e=65535&i,o+=s>>>16,r=65535&s,a=h+(o>>>16)&65535,n=65535&o;return pt[a>>8]+pt[255&a]+pt[n>>8]+pt[255&n]+pt[r>>8]+pt[255&r]+pt[e>>8]+pt[255&e]}("string"==typeof t?t:t.join(vt))}
|
58
|
+
/**
|
59
|
+
* @license
|
60
|
+
* Copyright 2021 Google LLC
|
61
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
62
|
+
*/const mt=new WeakMap,yt=new Map;function xt(t,i,e){if(t){const s=e?.id??function(t){const i="string"==typeof t?t:t.strings;let e=yt.get(i);void 0===e&&(e=wt(i,"string"!=typeof t&&!("strTag"in t)),yt.set(i,e));return e}
|
63
|
+
/**
|
64
|
+
* @license
|
65
|
+
* Copyright 2021 Google LLC
|
66
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
67
|
+
*/(i),r=t[s];if(r){if("string"==typeof r)return r;if("strTag"in r)return at(r.strings,i.values,r.values);{let t=mt.get(r);return void 0===t&&(t=r.values,mt.set(r,t)),{...r,values:t.map((t=>i.values[t]))}}}}return ct(i)}function St(t){window.dispatchEvent(new CustomEvent(lt,{detail:t}))}let $t,kt,At,Ct,Et,_t="",Tt=new ft;Tt.resolve();let Mt=0;const zt=()=>_t,Pt=t=>{if(t===($t??_t))return Tt.promise;if(!At||!Ct)throw new Error("Internal error");if(!At.has(t))throw new Error("Invalid locale code");Mt++;const i=Mt;$t=t,Tt.settled&&(Tt=new ft),St({status:"loading",loadingLocale:t});return(t===kt?Promise.resolve({templates:void 0}):Ct(t)).then((e=>{Mt===i&&(_t=t,$t=void 0,Et=e.templates,St({status:"ready",readyLocale:t}),Tt.resolve())}),(e=>{Mt===i&&(St({status:"error",errorLocale:t,errorMessage:e.toString()}),Tt.reject(e))})),Tt.promise};
|
68
|
+
/**
|
69
|
+
* @license
|
70
|
+
* Copyright 2020 Google LLC
|
71
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
72
|
+
*/
|
73
|
+
let Ut=ct,jt=!1;const Lt=["ca","en"];var Ot=function(t,i,e,s){for(var r,o=arguments.length,n=o<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,h=t.length-1;h>=0;h--)(r=t[h])&&(n=(o<3?r(n):o>3?r(i,e,n):r(i,e))||n);return o>3&&n&&Object.defineProperty(i,e,n),n};const{getLocale:Nt,setLocale:It}=(Rt={sourceLocale:"es",targetLocales:Lt,loadLocale:t=>import(`./generated/locales/${t}.js`)},function(t){if(jt)throw new Error("lit-localize can only be configured once");Ut=t,jt=!0}(((t,i)=>xt(Et,t,i))),_t=kt=Rt.sourceLocale,At=new Set(Rt.targetLocales),At.add(Rt.sourceLocale),Ct=Rt.loadLocale,{getLocale:zt,setLocale:Pt});var Rt;let Dt=class extends st{constructor(){super(),this.formAction="",this.keywords="",this.locale="",It(this.locale)}updateShownValue(t){this.keywords=t.target?.value}closePopover(t){t.preventDefault(),(this.shadowRoot?.getElementById("popover")).hidePopover()}render(){return D`
|
74
|
+
<div id="popover-container">
|
75
|
+
<button id="button-popover" popovertarget="popover">
|
76
|
+
${Ut("Atención en línea")}
|
77
|
+
</button>
|
78
|
+
|
79
|
+
<div popover id="popover">
|
80
|
+
<header>
|
81
|
+
<h2>${Ut("Atención en línea Niris")}</h2>
|
82
|
+
</header>
|
83
|
+
<main>
|
84
|
+
<form action="${this.formAction}?keywords=${this.keywords}">
|
85
|
+
<label for="niris-input">
|
86
|
+
${Ut("Información, Consultas, Quejas y Sugerencias:")}
|
87
|
+
</label>
|
88
|
+
<textarea
|
89
|
+
id="niris-input"
|
90
|
+
@change=${this.updateShownValue}
|
91
|
+
name="keywords"
|
92
|
+
required
|
93
|
+
minlength="4"
|
94
|
+
placeholder="${Ut("Escribe tu consulta aquí")}"
|
95
|
+
></textarea>
|
96
|
+
<button type="submit">${Ut("Enviar")}</button>
|
97
|
+
<button type="button" @click="${this.closePopover}">
|
98
|
+
${Ut("Cerrar")}
|
99
|
+
</button>
|
100
|
+
</form>
|
101
|
+
</main>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
`}};Dt.styles=((t,...i)=>{const s=1===t.length?t[0]:i.reduce(((i,e,s)=>i+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+t[s+1]),t[0]);return new r(s,t,e)})`
|
105
|
+
:host {
|
106
|
+
--primary-color: #03599d;
|
107
|
+
--background-color: #d4d4d4;
|
108
|
+
--color: #fff;
|
109
|
+
--padding: 1rem 1rem;
|
110
|
+
--font-size: 1rem;
|
111
|
+
--border-radius: 0rem;
|
112
|
+
--font-weight: 500;
|
113
|
+
--font-family: 'Arial', sans-serif;
|
114
|
+
}
|
115
|
+
* {
|
116
|
+
font-family: 'Brush Script MT', cursive, sans-serif; /* This is fallback font for old browsers */
|
117
|
+
font-family: var(--font-family);
|
118
|
+
box-sizing: border-box;
|
119
|
+
}
|
120
|
+
|
121
|
+
button {
|
122
|
+
min-width: 120px;
|
123
|
+
background-color: var(--primary-color);
|
124
|
+
border: none;
|
125
|
+
color: white;
|
126
|
+
text-align: center;
|
127
|
+
text-decoration: none;
|
128
|
+
font-size: 16px;
|
129
|
+
cursor: pointer;
|
130
|
+
position: relative;
|
131
|
+
color: var(--color);
|
132
|
+
padding: var(--padding);
|
133
|
+
font-size: var(--font-size);
|
134
|
+
font-weight: var(--font-weight);
|
135
|
+
border-radius: var(--border-radius);
|
136
|
+
transition: 0.3s;
|
137
|
+
}
|
138
|
+
|
139
|
+
button:hover {
|
140
|
+
filter: brightness(120%);
|
141
|
+
}
|
142
|
+
|
143
|
+
button:focus-visible {
|
144
|
+
background-color: var(--primary-color);
|
145
|
+
outline: 3px solid var(--primary-color);
|
146
|
+
outline-offset: 2px;
|
147
|
+
}
|
148
|
+
|
149
|
+
#popover:popover-open {
|
150
|
+
display: flex;
|
151
|
+
flex-direction: column;
|
152
|
+
justify-content: center;
|
153
|
+
padding: 0;
|
154
|
+
border: 0;
|
155
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.24);
|
156
|
+
width: 60%;
|
157
|
+
border-radius: var(--border-radius);
|
158
|
+
animation: fadeIn 150ms ease-in-out;
|
159
|
+
}
|
160
|
+
|
161
|
+
header {
|
162
|
+
text-align: center;
|
163
|
+
box-sizing: border-box;
|
164
|
+
padding-left: 1rem;
|
165
|
+
margin-bottom: 2rem;
|
166
|
+
width: 100%;
|
167
|
+
border-bottom: 1px solid #d4d4d4;
|
168
|
+
background-color: #f6f7f7;
|
169
|
+
}
|
170
|
+
|
171
|
+
header h2 {
|
172
|
+
color: var(--primary-color);
|
173
|
+
filter: opacity(100%);
|
174
|
+
}
|
175
|
+
|
176
|
+
header h2::before {
|
177
|
+
filter: opacity(50%);
|
178
|
+
color: var(--primary-color);
|
179
|
+
filter: opacity(100%);
|
180
|
+
}
|
181
|
+
|
182
|
+
form {
|
183
|
+
margin: 0 auto;
|
184
|
+
width: 90%;
|
185
|
+
}
|
186
|
+
|
187
|
+
textarea {
|
188
|
+
resize: none;
|
189
|
+
border-radius: var(--border-radius);
|
190
|
+
height: 8rem;
|
191
|
+
border-width: 2px;
|
192
|
+
margin: 0.7rem 0;
|
193
|
+
--tw-border-opacity: 1;
|
194
|
+
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
195
|
+
width: 100%;
|
196
|
+
font-size: 0.875rem;
|
197
|
+
padding: 0.5rem;
|
198
|
+
}
|
199
|
+
|
200
|
+
textarea:focus,
|
201
|
+
select:focus {
|
202
|
+
outline: 2px solid transparent;
|
203
|
+
outline-offset: 2px;
|
204
|
+
--tw-ring-inset: var(--tw-empty, /*!*/ /*!*/);
|
205
|
+
--tw-ring-offset-width: 0px;
|
206
|
+
--tw-ring-offset-color: #fff;
|
207
|
+
--tw-ring-color: var(--primary-color);
|
208
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
|
209
|
+
var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
210
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0
|
211
|
+
calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
212
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
|
213
|
+
var(--tw-shadow);
|
214
|
+
border-color: var(--primary-color);
|
215
|
+
}
|
216
|
+
form button {
|
217
|
+
float: left;
|
218
|
+
margin: 1rem auto;
|
219
|
+
}
|
220
|
+
|
221
|
+
form button:last-child {
|
222
|
+
background-color: transparent;
|
223
|
+
margin-left: 1rem;
|
224
|
+
border: inset 2px solid var(--primary-color);
|
225
|
+
box-shadow: 0 0 0 1px var(--primary-color),
|
226
|
+
inset 0 0 0 2px var(--primary-color);
|
227
|
+
color: var(--primary-color);
|
228
|
+
}
|
229
|
+
form button:last-child:hover {
|
230
|
+
background-color: var(--primary-color);
|
231
|
+
color: white;
|
232
|
+
filter: none;
|
233
|
+
}
|
234
|
+
#popover::backdrop {
|
235
|
+
background-color: rgba(#c6c8ce 0.3);
|
236
|
+
backdrop-filter: blur(2px);
|
237
|
+
}
|
238
|
+
|
239
|
+
@keyframes fadeIn {
|
240
|
+
0% {
|
241
|
+
scale: 0.8;
|
242
|
+
opacity: 0;
|
243
|
+
}
|
244
|
+
100% {
|
245
|
+
scale: 1;
|
246
|
+
opacity: 1;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
@media (max-width: 1024px) {
|
251
|
+
#popover:popover-open {
|
252
|
+
width: 90%;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
@media (min-width: 1024px) {
|
257
|
+
#popover:popover-open {
|
258
|
+
width: 60%;
|
259
|
+
}
|
260
|
+
}
|
261
|
+
`,Ot([ht({type:String})],Dt.prototype,"formAction",void 0),Ot([ht({type:String})],Dt.prototype,"keywords",void 0),Ot([ht({type:String})],Dt.prototype,"locale",void 0),Dt=Ot([(t,i)=>(t.addInitializer(ut),t)],Dt),customElements.define("textarea-to-niris",Dt);export{Dt as TextareaToNiris,Nt as getLocale,It as setLocale};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { LitElement } from 'lit';
|
2
|
+
export declare const getLocale: (() => string) & {
|
3
|
+
_LIT_LOCALIZE_GET_LOCALE_?: undefined;
|
4
|
+
}, setLocale: ((newLocale: string) => Promise<void>) & {
|
5
|
+
_LIT_LOCALIZE_SET_LOCALE_?: undefined;
|
6
|
+
};
|
7
|
+
export declare class TextareaToNiris extends LitElement {
|
8
|
+
formAction: any;
|
9
|
+
keywords: any;
|
10
|
+
locale: string;
|
11
|
+
constructor();
|
12
|
+
updateShownValue(event: Event): void;
|
13
|
+
closePopover(event: Event): void;
|
14
|
+
render(): import("lit-html").TemplateResult<1>;
|
15
|
+
static styles: import("lit").CSSResult;
|
16
|
+
}
|
17
|
+
declare global {
|
18
|
+
interface HTMLElementTagNameMap {
|
19
|
+
'textarea-to-niris': TextareaToNiris;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
//# sourceMappingURL=textarea-to-niris.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"textarea-to-niris.d.ts","sourceRoot":"","sources":["../src/textarea-to-niris.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAY,MAAM,KAAK,CAAC;AAO1C,eAAO,MAAO,SAAS;;GAAE,SAAS;;CAIhC,CAAC;AAEH,qBACa,eAAgB,SAAQ,UAAU;IACnB,UAAU,EAAE,GAAG,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;;IAW/C,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAI7B,YAAY,CAAC,KAAK,EAAE,KAAK;IAKhB,MAAM;IAmCf,OAAgB,MAAM,0BA6JpB;CACH;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,mBAAmB,EAAE,eAAe,CAAC;KACtC;CACF"}
|
@@ -1,17 +1,50 @@
|
|
1
|
-
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
import { LitElement, html, css } from 'lit';
|
8
|
+
import { property } from 'lit/decorators.js';
|
9
|
+
import { msg, localized } from '@lit/localize';
|
10
|
+
import { configureLocalization } from '@lit/localize';
|
11
|
+
// Generated via output.localeCodesModule
|
12
|
+
import { sourceLocale, targetLocales } from './generated/locale-codes.js';
|
13
|
+
export const { getLocale, setLocale } = configureLocalization({
|
14
|
+
sourceLocale,
|
15
|
+
targetLocales,
|
16
|
+
loadLocale: (locale) => import(`./generated/locales/${locale}.js`),
|
17
|
+
});
|
18
|
+
let TextareaToNiris = class TextareaToNiris extends LitElement {
|
19
|
+
constructor() {
|
20
|
+
super();
|
21
|
+
this.formAction = '';
|
22
|
+
this.keywords = '';
|
23
|
+
this.locale = 'es';
|
24
|
+
//setLocale(this.locale);
|
25
|
+
}
|
26
|
+
updateShownValue(event) {
|
27
|
+
this.keywords = event.target?.value;
|
28
|
+
}
|
29
|
+
closePopover(event) {
|
30
|
+
event.preventDefault();
|
31
|
+
(this.shadowRoot?.getElementById('popover')).hidePopover();
|
32
|
+
}
|
33
|
+
render() {
|
34
|
+
return html `
|
2
35
|
<div id="popover-container">
|
3
36
|
<button id="button-popover" popovertarget="popover">
|
4
|
-
${
|
37
|
+
${msg('Atención en línea')}
|
5
38
|
</button>
|
6
39
|
|
7
40
|
<div popover id="popover">
|
8
41
|
<header>
|
9
|
-
<h2>${
|
42
|
+
<h2>${msg('Atención en línea Niris')}</h2>
|
10
43
|
</header>
|
11
44
|
<main>
|
12
45
|
<form action="${this.formAction}&keywords=${this.keywords}" method="get">
|
13
46
|
<label for="niris-input">
|
14
|
-
${
|
47
|
+
${msg('Información, Consultas, Quejas y Sugerencias:')}
|
15
48
|
</label>
|
16
49
|
<textarea
|
17
50
|
id="niris-input"
|
@@ -19,17 +52,20 @@ import{c as r,i as o,n as e,l as t,s as i,t as a,a as n,x as s,m as d}from"./loc
|
|
19
52
|
name="keywords"
|
20
53
|
required
|
21
54
|
minlength="4"
|
22
|
-
placeholder="${
|
55
|
+
placeholder="${msg('Escribe tu consulta aquí')}"
|
23
56
|
></textarea>
|
24
|
-
<button type="submit">${
|
57
|
+
<button type="submit">${msg('Enviar')}</button>
|
25
58
|
<button type="button" @click="${this.closePopover}">
|
26
|
-
${
|
59
|
+
${msg('Cerrar')}
|
27
60
|
</button>
|
28
61
|
</form>
|
29
62
|
</main>
|
30
63
|
</div>
|
31
64
|
</div>
|
32
|
-
|
65
|
+
`;
|
66
|
+
}
|
67
|
+
};
|
68
|
+
TextareaToNiris.styles = css `
|
33
69
|
:host {
|
34
70
|
--primary-color: #03599d;
|
35
71
|
--background-color: #d4d4d4;
|
@@ -186,4 +222,19 @@ import{c as r,i as o,n as e,l as t,s as i,t as a,a as n,x as s,m as d}from"./loc
|
|
186
222
|
width: 60%;
|
187
223
|
}
|
188
224
|
}
|
189
|
-
|
225
|
+
`;
|
226
|
+
__decorate([
|
227
|
+
property({ type: String })
|
228
|
+
], TextareaToNiris.prototype, "formAction", void 0);
|
229
|
+
__decorate([
|
230
|
+
property({ type: String })
|
231
|
+
], TextareaToNiris.prototype, "keywords", void 0);
|
232
|
+
__decorate([
|
233
|
+
property({ type: String })
|
234
|
+
], TextareaToNiris.prototype, "locale", void 0);
|
235
|
+
TextareaToNiris = __decorate([
|
236
|
+
localized()
|
237
|
+
], TextareaToNiris);
|
238
|
+
export { TextareaToNiris };
|
239
|
+
customElements.define('textarea-to-niris', TextareaToNiris);
|
240
|
+
//# sourceMappingURL=textarea-to-niris.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"textarea-to-niris.js","sourceRoot":"","sources":["../src/textarea-to-niris.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAC,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAC,qBAAqB,EAAC,MAAM,eAAe,CAAC;AACpD,yCAAyC;AACzC,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAExE,MAAM,CAAC,MAAM,EAAC,SAAS,EAAE,SAAS,EAAC,GAAG,qBAAqB,CAAC;IAC1D,YAAY;IACZ,aAAa;IACb,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,uBAAuB,MAAM,KAAK,CAAC;CACnE,CAAC,CAAC;AAGI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAM7C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAClB,yBAAyB;IAC3B,CAAC;IAED,gBAAgB,CAAC,KAAY;QAC3B,IAAI,CAAC,QAAQ,GAAI,KAAK,CAAC,MAA2B,EAAE,KAAK,CAAC;IAC5D,CAAC;IAED,YAAY,CAAC,KAAY;QACvB,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,SAAS,CAAiB,CAAA,CAAC,WAAW,EAAE,CAAC;IAC5E,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;;YAGH,GAAG,CAAC,mBAAmB,CAAC;;;;;kBAKlB,GAAG,CAAC,yBAAyB,CAAC;;;4BAGpB,IAAI,CAAC,UAAU,aAAa,IAAI,CAAC,QAAQ;;gBAErD,GAAG,CAAC,+CAA+C,CAAC;;;;0BAI1C,IAAI,CAAC,gBAAgB;;;;+BAIhB,GAAG,CAAC,0BAA0B,CAAC;;sCAExB,GAAG,CAAC,QAAQ,CAAC;8CACL,IAAI,CAAC,YAAY;kBAC7C,GAAG,CAAC,QAAQ,CAAC;;;;;;KAM1B,CAAC;IACJ,CAAC;;AAEe,sBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6J3B,AA7JqB,CA6JpB;AAtNwB;IAAzB,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mDAAiB;AAChB;IAAzB,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;iDAAe;AACR;IAA/B,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;+CAAsB;AAHpC,eAAe;IAD3B,SAAS,EAAE;GACC,eAAe,CAwN3B;;AAED,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import {LitElement, html, css} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {msg, localized } from '@lit/localize';\nimport {configureLocalization} from '@lit/localize';\n// Generated via output.localeCodesModule\nimport {sourceLocale, targetLocales} from './generated/locale-codes.js';\n\nexport const {getLocale, setLocale} = configureLocalization({\n sourceLocale,\n targetLocales,\n loadLocale: (locale) => import(`./generated/locales/${locale}.js`),\n});\n\n@localized()\nexport class TextareaToNiris extends LitElement {\n @property({type: String}) formAction: any;\n @property({type: String}) keywords: any;\n @property({type: String}) locale: string;\n\n\n constructor() {\n super();\n this.formAction = '';\n this.keywords = '';\n this.locale = 'es'\n //setLocale(this.locale);\n }\n\n updateShownValue(event: Event) {\n this.keywords = (event.target as HTMLInputElement)?.value;\n }\n\n closePopover(event: Event) {\n event.preventDefault();\n (this.shadowRoot?.getElementById('popover') as HTMLElement).hidePopover();\n }\n\n override render() {\n return html`\n <div id=\"popover-container\">\n <button id=\"button-popover\" popovertarget=\"popover\">\n ${msg('Atención en línea')}\n </button>\n\n <div popover id=\"popover\">\n <header>\n <h2>${msg('Atención en línea Niris')}</h2>\n </header>\n <main>\n <form action=\"${this.formAction}&keywords=${this.keywords}\" method=\"get\">\n <label for=\"niris-input\">\n ${msg('Información, Consultas, Quejas y Sugerencias:')}\n </label>\n <textarea\n id=\"niris-input\"\n @change=${this.updateShownValue}\n name=\"keywords\"\n required\n minlength=\"4\"\n placeholder=\"${msg('Escribe tu consulta aquí')}\"\n ></textarea>\n <button type=\"submit\">${msg('Enviar')}</button>\n <button type=\"button\" @click=\"${this.closePopover}\">\n ${msg('Cerrar')}\n </button>\n </form>\n </main>\n </div>\n </div>\n `;\n }\n\n static override styles = css`\n :host {\n --primary-color: #03599d;\n --background-color: #d4d4d4;\n --color: #fff;\n --padding: 1rem 1rem;\n --font-size: 1rem;\n --border-radius: 0rem;\n --font-weight: 500;\n --font-family: 'Arial', sans-serif;\n }\n * {\n font-family: 'Brush Script MT', cursive, sans-serif; /* This is fallback font for old browsers */\n font-family: var(--font-family);\n box-sizing: border-box;\n }\n\n button {\n min-width: 120px;\n background-color: var(--primary-color);\n border: none;\n color: white;\n text-align: center;\n text-decoration: none;\n font-size: 16px;\n cursor: pointer;\n position: relative;\n color: var(--color);\n padding: var(--padding);\n font-size: var(--font-size);\n font-weight: var(--font-weight);\n border-radius: var(--border-radius);\n transition: 0.3s;\n }\n\n button:hover {\n filter: brightness(120%);\n }\n\n button:focus-visible {\n background-color: var(--primary-color);\n outline: 3px solid var(--primary-color);\n outline-offset: 2px;\n }\n\n #popover:popover-open {\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0;\n border: 0;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.24);\n width: 60%;\n border-radius: var(--border-radius);\n animation: fadeIn 150ms ease-in-out;\n }\n\n header {\n text-align: center;\n box-sizing: border-box;\n padding-left: 1rem;\n margin-bottom: 2rem;\n width: 100%;\n border-bottom: 1px solid #d4d4d4;\n background-color: #f6f7f7;\n }\n\n header h2 {\n color: var(--primary-color);\n filter: opacity(100%);\n }\n\n header h2::before {\n filter: opacity(50%);\n color: var(--primary-color);\n filter: opacity(100%);\n }\n\n form {\n margin: 0 auto;\n width: 90%;\n }\n\n textarea {\n resize: none;\n border-radius: var(--border-radius);\n height: 8rem;\n border-width: 2px;\n margin: 0.7rem 0;\n --tw-border-opacity: 1;\n border-color: rgb(209 213 219 / var(--tw-border-opacity));\n width: 100%;\n font-size: 0.875rem;\n padding: 0.5rem;\n }\n\n textarea:focus,\n select:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n --tw-ring-inset: var(--tw-empty, /*!*/ /*!*/);\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: var(--primary-color);\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0\n var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0\n calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),\n var(--tw-shadow);\n border-color: var(--primary-color);\n }\n form button {\n float: left;\n margin: 1rem auto;\n }\n\n form button:last-child {\n background-color: transparent;\n margin-left: 1rem;\n border: inset 2px solid var(--primary-color);\n box-shadow: 0 0 0 1px var(--primary-color),\n inset 0 0 0 2px var(--primary-color);\n color: var(--primary-color);\n }\n form button:last-child:hover {\n background-color: var(--primary-color);\n color: white;\n filter: none;\n }\n #popover::backdrop {\n background-color: rgba(#c6c8ce 0.3);\n backdrop-filter: blur(2px);\n }\n\n @keyframes fadeIn {\n 0% {\n scale: 0.8;\n opacity: 0;\n }\n 100% {\n scale: 1;\n opacity: 1;\n }\n }\n\n @media (max-width: 1024px) {\n #popover:popover-open {\n width: 90%;\n }\n }\n\n @media (min-width: 1024px) {\n #popover:popover-open {\n width: 60%;\n }\n }\n `;\n}\n\ncustomElements.define('textarea-to-niris', TextareaToNiris);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'textarea-to-niris': TextareaToNiris;\n }\n}\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "niris-public-community-components",
|
3
3
|
"private": false,
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.9",
|
5
5
|
"homepage": "https://iris.apsl.net",
|
6
6
|
"description": "Web components for the NIRIS project developed with the Lit library",
|
7
7
|
"main": "dist/index.js",
|