niris-public-community-components 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/textarea-to-niris.js +189 -0
- package/package.json +1 -1
@@ -0,0 +1,189 @@
|
|
1
|
+
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"./locale-codes-c2f86156.js";var l=function(r,o,e,t){for(var i,a=arguments.length,n=a<3?o:null===t?t=Object.getOwnPropertyDescriptor(o,e):t,s=r.length-1;s>=0;s--)(i=r[s])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};const{getLocale:c,setLocale:p}=r({sourceLocale:i,targetLocales:a,loadLocale:r=>import(`./generated/locales/${r}.js`)});let f=class extends n{constructor(){super(),this.formAction="",this.keywords="",this.locale="es",p(this.locale)}updateShownValue(r){this.keywords=r.target?.value}closePopover(r){r.preventDefault(),(this.shadowRoot?.getElementById("popover")).hidePopover()}render(){return s`
|
2
|
+
<div id="popover-container">
|
3
|
+
<button id="button-popover" popovertarget="popover">
|
4
|
+
${d("Atención en línea")}
|
5
|
+
</button>
|
6
|
+
|
7
|
+
<div popover id="popover">
|
8
|
+
<header>
|
9
|
+
<h2>${d("Atención en línea Niris")}</h2>
|
10
|
+
</header>
|
11
|
+
<main>
|
12
|
+
<form action="${this.formAction}&keywords=${this.keywords}">
|
13
|
+
<label for="niris-input">
|
14
|
+
${d("Información, Consultas, Quejas y Sugerencias:")}
|
15
|
+
</label>
|
16
|
+
<textarea
|
17
|
+
id="niris-input"
|
18
|
+
@change=${this.updateShownValue}
|
19
|
+
name="keywords"
|
20
|
+
required
|
21
|
+
minlength="4"
|
22
|
+
placeholder="${d("Escribe tu consulta aquí")}"
|
23
|
+
></textarea>
|
24
|
+
<button type="submit">${d("Enviar")}</button>
|
25
|
+
<button type="button" @click="${this.closePopover}">
|
26
|
+
${d("Cerrar")}
|
27
|
+
</button>
|
28
|
+
</form>
|
29
|
+
</main>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
`}};f.styles=o`
|
33
|
+
:host {
|
34
|
+
--primary-color: #03599d;
|
35
|
+
--background-color: #d4d4d4;
|
36
|
+
--color: #fff;
|
37
|
+
--padding: 1rem 1rem;
|
38
|
+
--font-size: 1rem;
|
39
|
+
--border-radius: 0rem;
|
40
|
+
--font-weight: 500;
|
41
|
+
--font-family: 'Arial', sans-serif;
|
42
|
+
}
|
43
|
+
* {
|
44
|
+
font-family: 'Brush Script MT', cursive, sans-serif; /* This is fallback font for old browsers */
|
45
|
+
font-family: var(--font-family);
|
46
|
+
box-sizing: border-box;
|
47
|
+
}
|
48
|
+
|
49
|
+
button {
|
50
|
+
min-width: 120px;
|
51
|
+
background-color: var(--primary-color);
|
52
|
+
border: none;
|
53
|
+
color: white;
|
54
|
+
text-align: center;
|
55
|
+
text-decoration: none;
|
56
|
+
font-size: 16px;
|
57
|
+
cursor: pointer;
|
58
|
+
position: relative;
|
59
|
+
color: var(--color);
|
60
|
+
padding: var(--padding);
|
61
|
+
font-size: var(--font-size);
|
62
|
+
font-weight: var(--font-weight);
|
63
|
+
border-radius: var(--border-radius);
|
64
|
+
transition: 0.3s;
|
65
|
+
}
|
66
|
+
|
67
|
+
button:hover {
|
68
|
+
filter: brightness(120%);
|
69
|
+
}
|
70
|
+
|
71
|
+
button:focus-visible {
|
72
|
+
background-color: var(--primary-color);
|
73
|
+
outline: 3px solid var(--primary-color);
|
74
|
+
outline-offset: 2px;
|
75
|
+
}
|
76
|
+
|
77
|
+
#popover:popover-open {
|
78
|
+
display: flex;
|
79
|
+
flex-direction: column;
|
80
|
+
justify-content: center;
|
81
|
+
padding: 0;
|
82
|
+
border: 0;
|
83
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.24);
|
84
|
+
width: 60%;
|
85
|
+
border-radius: var(--border-radius);
|
86
|
+
animation: fadeIn 150ms ease-in-out;
|
87
|
+
}
|
88
|
+
|
89
|
+
header {
|
90
|
+
text-align: center;
|
91
|
+
box-sizing: border-box;
|
92
|
+
padding-left: 1rem;
|
93
|
+
margin-bottom: 2rem;
|
94
|
+
width: 100%;
|
95
|
+
border-bottom: 1px solid #d4d4d4;
|
96
|
+
background-color: #f6f7f7;
|
97
|
+
}
|
98
|
+
|
99
|
+
header h2 {
|
100
|
+
color: var(--primary-color);
|
101
|
+
filter: opacity(100%);
|
102
|
+
}
|
103
|
+
|
104
|
+
header h2::before {
|
105
|
+
filter: opacity(50%);
|
106
|
+
color: var(--primary-color);
|
107
|
+
filter: opacity(100%);
|
108
|
+
}
|
109
|
+
|
110
|
+
form {
|
111
|
+
margin: 0 auto;
|
112
|
+
width: 90%;
|
113
|
+
}
|
114
|
+
|
115
|
+
textarea {
|
116
|
+
resize: none;
|
117
|
+
border-radius: var(--border-radius);
|
118
|
+
height: 8rem;
|
119
|
+
border-width: 2px;
|
120
|
+
margin: 0.7rem 0;
|
121
|
+
--tw-border-opacity: 1;
|
122
|
+
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
123
|
+
width: 100%;
|
124
|
+
font-size: 0.875rem;
|
125
|
+
padding: 0.5rem;
|
126
|
+
}
|
127
|
+
|
128
|
+
textarea:focus,
|
129
|
+
select:focus {
|
130
|
+
outline: 2px solid transparent;
|
131
|
+
outline-offset: 2px;
|
132
|
+
--tw-ring-inset: var(--tw-empty, /*!*/ /*!*/);
|
133
|
+
--tw-ring-offset-width: 0px;
|
134
|
+
--tw-ring-offset-color: #fff;
|
135
|
+
--tw-ring-color: var(--primary-color);
|
136
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
|
137
|
+
var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
138
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0
|
139
|
+
calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
140
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
|
141
|
+
var(--tw-shadow);
|
142
|
+
border-color: var(--primary-color);
|
143
|
+
}
|
144
|
+
form button {
|
145
|
+
float: left;
|
146
|
+
margin: 1rem auto;
|
147
|
+
}
|
148
|
+
|
149
|
+
form button:last-child {
|
150
|
+
background-color: transparent;
|
151
|
+
margin-left: 1rem;
|
152
|
+
border: inset 2px solid var(--primary-color);
|
153
|
+
box-shadow: 0 0 0 1px var(--primary-color),
|
154
|
+
inset 0 0 0 2px var(--primary-color);
|
155
|
+
color: var(--primary-color);
|
156
|
+
}
|
157
|
+
form button:last-child:hover {
|
158
|
+
background-color: var(--primary-color);
|
159
|
+
color: white;
|
160
|
+
filter: none;
|
161
|
+
}
|
162
|
+
#popover::backdrop {
|
163
|
+
background-color: rgba(#c6c8ce 0.3);
|
164
|
+
backdrop-filter: blur(2px);
|
165
|
+
}
|
166
|
+
|
167
|
+
@keyframes fadeIn {
|
168
|
+
0% {
|
169
|
+
scale: 0.8;
|
170
|
+
opacity: 0;
|
171
|
+
}
|
172
|
+
100% {
|
173
|
+
scale: 1;
|
174
|
+
opacity: 1;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
@media (max-width: 1024px) {
|
179
|
+
#popover:popover-open {
|
180
|
+
width: 90%;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
@media (min-width: 1024px) {
|
185
|
+
#popover:popover-open {
|
186
|
+
width: 60%;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
`,l([e({type:String})],f.prototype,"formAction",void 0),l([e({type:String})],f.prototype,"keywords",void 0),l([e({type:String})],f.prototype,"locale",void 0),f=l([t()],f),customElements.define("textarea-to-niris",f);export{f as TextareaToNiris,c as getLocale,p as setLocale};
|
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.4",
|
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",
|