niris-public-community-components 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/textarea-to-niris.js +240 -0
- package/package.json +1 -1
- package/src/textarea-to-niris.ts +1 -1
@@ -0,0 +1,240 @@
|
|
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 `
|
35
|
+
<div id="popover-container">
|
36
|
+
<button id="button-popover" popovertarget="popover">
|
37
|
+
${msg('Atención en línea')}
|
38
|
+
</button>
|
39
|
+
|
40
|
+
<div popover id="popover">
|
41
|
+
<header>
|
42
|
+
<h2>${msg('Atención en línea Niris')}</h2>
|
43
|
+
</header>
|
44
|
+
<main>
|
45
|
+
<form action="${this.formAction}&keywords=${this.keywords}" method="get">
|
46
|
+
<label for="niris-input">
|
47
|
+
${msg('Información, Consultas, Quejas y Sugerencias:')}
|
48
|
+
</label>
|
49
|
+
<textarea
|
50
|
+
id="niris-input"
|
51
|
+
@change=${this.updateShownValue}
|
52
|
+
name="keywords"
|
53
|
+
required
|
54
|
+
minlength="4"
|
55
|
+
placeholder="${msg('Escribe tu consulta aquí')}"
|
56
|
+
></textarea>
|
57
|
+
<button type="submit">${msg('Enviar')}</button>
|
58
|
+
<button type="button" @click="${this.closePopover}">
|
59
|
+
${msg('Cerrar')}
|
60
|
+
</button>
|
61
|
+
</form>
|
62
|
+
</main>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
`;
|
66
|
+
}
|
67
|
+
};
|
68
|
+
TextareaToNiris.styles = css `
|
69
|
+
:host {
|
70
|
+
--primary-color: #03599d;
|
71
|
+
--background-color: #d4d4d4;
|
72
|
+
--color: #fff;
|
73
|
+
--padding: 1rem 1rem;
|
74
|
+
--font-size: 1rem;
|
75
|
+
--border-radius: 0rem;
|
76
|
+
--font-weight: 500;
|
77
|
+
--font-family: 'Arial', sans-serif;
|
78
|
+
}
|
79
|
+
* {
|
80
|
+
font-family: 'Brush Script MT', cursive, sans-serif; /* This is fallback font for old browsers */
|
81
|
+
font-family: var(--font-family);
|
82
|
+
box-sizing: border-box;
|
83
|
+
}
|
84
|
+
|
85
|
+
button {
|
86
|
+
min-width: 120px;
|
87
|
+
background-color: var(--primary-color);
|
88
|
+
border: none;
|
89
|
+
color: white;
|
90
|
+
text-align: center;
|
91
|
+
text-decoration: none;
|
92
|
+
font-size: 16px;
|
93
|
+
cursor: pointer;
|
94
|
+
position: relative;
|
95
|
+
color: var(--color);
|
96
|
+
padding: var(--padding);
|
97
|
+
font-size: var(--font-size);
|
98
|
+
font-weight: var(--font-weight);
|
99
|
+
border-radius: var(--border-radius);
|
100
|
+
transition: 0.3s;
|
101
|
+
}
|
102
|
+
|
103
|
+
button:hover {
|
104
|
+
filter: brightness(120%);
|
105
|
+
}
|
106
|
+
|
107
|
+
button:focus-visible {
|
108
|
+
background-color: var(--primary-color);
|
109
|
+
outline: 3px solid var(--primary-color);
|
110
|
+
outline-offset: 2px;
|
111
|
+
}
|
112
|
+
|
113
|
+
#popover:popover-open {
|
114
|
+
display: flex;
|
115
|
+
flex-direction: column;
|
116
|
+
justify-content: center;
|
117
|
+
padding: 0;
|
118
|
+
border: 0;
|
119
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.24);
|
120
|
+
width: 60%;
|
121
|
+
border-radius: var(--border-radius);
|
122
|
+
animation: fadeIn 150ms ease-in-out;
|
123
|
+
}
|
124
|
+
|
125
|
+
header {
|
126
|
+
text-align: center;
|
127
|
+
box-sizing: border-box;
|
128
|
+
padding-left: 1rem;
|
129
|
+
margin-bottom: 2rem;
|
130
|
+
width: 100%;
|
131
|
+
border-bottom: 1px solid #d4d4d4;
|
132
|
+
background-color: #f6f7f7;
|
133
|
+
}
|
134
|
+
|
135
|
+
header h2 {
|
136
|
+
color: var(--primary-color);
|
137
|
+
filter: opacity(100%);
|
138
|
+
}
|
139
|
+
|
140
|
+
header h2::before {
|
141
|
+
filter: opacity(50%);
|
142
|
+
color: var(--primary-color);
|
143
|
+
filter: opacity(100%);
|
144
|
+
}
|
145
|
+
|
146
|
+
form {
|
147
|
+
margin: 0 auto;
|
148
|
+
width: 90%;
|
149
|
+
}
|
150
|
+
|
151
|
+
textarea {
|
152
|
+
resize: none;
|
153
|
+
border-radius: var(--border-radius);
|
154
|
+
height: 8rem;
|
155
|
+
border-width: 2px;
|
156
|
+
margin: 0.7rem 0;
|
157
|
+
--tw-border-opacity: 1;
|
158
|
+
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
159
|
+
width: 100%;
|
160
|
+
font-size: 0.875rem;
|
161
|
+
padding: 0.5rem;
|
162
|
+
}
|
163
|
+
|
164
|
+
textarea:focus,
|
165
|
+
select:focus {
|
166
|
+
outline: 2px solid transparent;
|
167
|
+
outline-offset: 2px;
|
168
|
+
--tw-ring-inset: var(--tw-empty, /*!*/ /*!*/);
|
169
|
+
--tw-ring-offset-width: 0px;
|
170
|
+
--tw-ring-offset-color: #fff;
|
171
|
+
--tw-ring-color: var(--primary-color);
|
172
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
|
173
|
+
var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
174
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0
|
175
|
+
calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
176
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
|
177
|
+
var(--tw-shadow);
|
178
|
+
border-color: var(--primary-color);
|
179
|
+
}
|
180
|
+
form button {
|
181
|
+
float: left;
|
182
|
+
margin: 1rem auto;
|
183
|
+
}
|
184
|
+
|
185
|
+
form button:last-child {
|
186
|
+
background-color: transparent;
|
187
|
+
margin-left: 1rem;
|
188
|
+
border: inset 2px solid var(--primary-color);
|
189
|
+
box-shadow: 0 0 0 1px var(--primary-color),
|
190
|
+
inset 0 0 0 2px var(--primary-color);
|
191
|
+
color: var(--primary-color);
|
192
|
+
}
|
193
|
+
form button:last-child:hover {
|
194
|
+
background-color: var(--primary-color);
|
195
|
+
color: white;
|
196
|
+
filter: none;
|
197
|
+
}
|
198
|
+
#popover::backdrop {
|
199
|
+
background-color: rgba(#c6c8ce 0.3);
|
200
|
+
backdrop-filter: blur(2px);
|
201
|
+
}
|
202
|
+
|
203
|
+
@keyframes fadeIn {
|
204
|
+
0% {
|
205
|
+
scale: 0.8;
|
206
|
+
opacity: 0;
|
207
|
+
}
|
208
|
+
100% {
|
209
|
+
scale: 1;
|
210
|
+
opacity: 1;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
|
214
|
+
@media (max-width: 1024px) {
|
215
|
+
#popover:popover-open {
|
216
|
+
width: 90%;
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
@media (min-width: 1024px) {
|
221
|
+
#popover:popover-open {
|
222
|
+
width: 60%;
|
223
|
+
}
|
224
|
+
}
|
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
|
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.5",
|
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",
|
package/src/textarea-to-niris.ts
CHANGED