niris-public-community-components 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +59 -8
- package/dev/form-niris.html +29 -0
- package/dev/text-area-niris.html +8 -5
- package/dist/form-niris.d.ts +70 -0
- package/dist/form-niris.d.ts.map +1 -0
- package/dist/form-niris.js +1127 -0
- package/dist/form-niris.js.map +1 -0
- package/dist/form-to-niris.js +847 -0
- package/dist/generated/locale-codes.d.ts +14 -0
- package/dist/generated/locale-codes.d.ts.map +1 -0
- package/dist/generated/locale-codes.js +23 -0
- package/dist/generated/locale-codes.js.map +1 -0
- package/dist/generated/locales/ca.d.ts +61 -0
- package/dist/generated/locales/ca.d.ts.map +1 -0
- package/dist/generated/locales/ca.js +65 -0
- package/dist/generated/locales/ca.js.map +1 -0
- package/dist/generated/locales/en.d.ts +61 -0
- package/dist/generated/locales/en.d.ts.map +1 -0
- package/dist/generated/locales/en.js +65 -0
- package/dist/generated/locales/en.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/locale-codes-c2f86156.js +72 -0
- package/dist/map-niris.d.ts +25 -0
- package/dist/map-niris.d.ts.map +1 -0
- package/dist/map-niris.js +200 -0
- package/dist/map-niris.js.map +1 -0
- package/dist/styles/globalStyles.d.ts +2 -0
- package/dist/styles/globalStyles.d.ts.map +1 -0
- package/dist/styles/globalStyles.js +170 -0
- package/dist/styles/globalStyles.js.map +1 -0
- package/dist/textarea-to-niris.js +14 -47
- package/dist/types.d.ts +85 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/index.html +5 -3
- package/package.json +26 -5
- package/rollup.config.js +6 -2
- package/src/form-niris.ts +1203 -0
- package/src/generated/locale-codes.ts +25 -0
- package/src/generated/locales/ca.ts +71 -0
- package/src/generated/locales/en.ts +71 -0
- package/src/lit-localize.json +15 -0
- package/src/map-niris.ts +215 -0
- package/src/styles/globalStyles.ts +170 -0
- package/src/textarea-to-niris.ts +29 -15
- package/src/types.ts +90 -0
- package/src/xliff/ca.xlf +239 -0
- package/src/xliff/en.xlf +239 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
// Do not modify this file by hand!
|
2
|
+
// Re-generate this file by running lit-localize.
|
3
|
+
|
4
|
+
/**
|
5
|
+
* The locale code that templates in this source code are written in.
|
6
|
+
*/
|
7
|
+
export const sourceLocale = `es`;
|
8
|
+
|
9
|
+
/**
|
10
|
+
* The other locale codes that this application is localized into. Sorted
|
11
|
+
* lexicographically.
|
12
|
+
*/
|
13
|
+
export const targetLocales = [
|
14
|
+
`ca`,
|
15
|
+
`en`,
|
16
|
+
] as const;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* All valid project locale codes. Sorted lexicographically.
|
20
|
+
*/
|
21
|
+
export const allLocales = [
|
22
|
+
`ca`,
|
23
|
+
`en`,
|
24
|
+
`es`,
|
25
|
+
] as const;
|
@@ -0,0 +1,71 @@
|
|
1
|
+
|
2
|
+
// Do not modify this file by hand!
|
3
|
+
// Re-generate this file by running lit-localize
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
/* eslint-disable no-irregular-whitespace */
|
9
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
10
|
+
|
11
|
+
export const templates = {
|
12
|
+
's07f7935b16a64e43': `Agraïm que ens hagi fet arribar el seu reconeixement, el qual es farà arribar al departament responsable. Amb aquesta informació, donem per contestada la seva comunicació`,
|
13
|
+
's080ffb79b58c5d88': `Primer cognom`,
|
14
|
+
's0b9a2919aa57a8c5': `CIF`,
|
15
|
+
's10132a1f9423876e': `No implementat`,
|
16
|
+
's108402007fab3ec5': `Anglès`,
|
17
|
+
's1abaad4e0bafba35': `Error carregant el formulari`,
|
18
|
+
's1d7849c1bb306edd': `Català`,
|
19
|
+
's1f26cb0a65a0c36c': `Dades personals`,
|
20
|
+
's22d3debb0fe19771': `Atenció en línia Niris`,
|
21
|
+
's238c3ed6d3ecc66a': `Tancar`,
|
22
|
+
's26432c53ecd144e8': `Escriviu la vostra consulta`,
|
23
|
+
's2b9fde9a5739d2a0': `Nom`,
|
24
|
+
's36e2c319c2d9da17': `NIE`,
|
25
|
+
's4177fe7f5d70fd33': `Tornar`,
|
26
|
+
's4ab9666eac463302': `Porta`,
|
27
|
+
's4d7be50524a42681': `Afegir fitxer`,
|
28
|
+
's54cd3139a4d69fbc': `Ubicació`,
|
29
|
+
's572f5ed1f68bfcbc': `NIF/DNI`,
|
30
|
+
's5b2d32ceb3df3643': `Escala`,
|
31
|
+
's5ea9f272dd7f1da8': `Correu electrònic`,
|
32
|
+
's694b51e10128655f': `Escriviu el vostre telèfon`,
|
33
|
+
's6b344d8147866cc1': `Informació, Consultes, Queixes i Suggeriments:`,
|
34
|
+
's7bc25696aeb11d7f': `Persona de contacte`,
|
35
|
+
's7c953cf010581df3': `Passaport`,
|
36
|
+
's7cf6cfa5cdc725e3': `Acceptats:`,
|
37
|
+
's7fbca09fab401ca5': `Confirma el teu correu`,
|
38
|
+
's889d2b38e8eb16b1': `Escriviu el vostre correu`,
|
39
|
+
's88a1a97d95757131': `Districte`,
|
40
|
+
's9802dd10b2c2f760': `Enviar`,
|
41
|
+
'sa6e4de4116073f37': `Confirma el correu`,
|
42
|
+
'saac6d40cd7052608': `Núm. Document`,
|
43
|
+
'sac8b678ef5500421': `Districte*:`,
|
44
|
+
'saddc930eb2efdca6': `Fitxa creada!`,
|
45
|
+
'sae3f1a64e8f9c33d': `Cercar`,
|
46
|
+
'sb044a1b221567c04': `Tipus de Document`,
|
47
|
+
'sb096f7a10f6e5904': `Carrer`,
|
48
|
+
'sb1942b92592ac8cf': `Ho sentim. Torni-ho a provar més tard`,
|
49
|
+
'sb6cacaf045a2fe90': `Atenció en línia`,
|
50
|
+
'sc93268d68f7d69a4': `Número`,
|
51
|
+
'sca318e1f09f7800c': `Any de naixement`,
|
52
|
+
'scbe4c6673872bda5': `Telèfon`,
|
53
|
+
'sd08f47835375b0d2': `Idioma de la resposta`,
|
54
|
+
'sd09a1a8863c8ae5b': `Característiques de la petició`,
|
55
|
+
'sd1f44f1a8bc20e67': `Correu electrònic`,
|
56
|
+
'sd2bd4af48abb3752': `Raó social`,
|
57
|
+
'sd901c7baed664633': `Ciutadà`,
|
58
|
+
'sd9e5b15f059a59ee': `Segon cognom`,
|
59
|
+
'sdd366d6d0fe37812': `Empresa/Entitat`,
|
60
|
+
'sdf913cb738108398': `Els correus no coincideixen`,
|
61
|
+
'se1674091f5776527': `Confirma el correu electrònic`,
|
62
|
+
'se962e919c6552a74': `Planta`,
|
63
|
+
'see4f9c33f20ae7e2': `Missatge`,
|
64
|
+
'sf2d9bee1ddd749d4': `Escriviu breument el vostre missatge`,
|
65
|
+
'sf4533552651212ea': `Els camps marcats amb un (*) són obligatoris.`,
|
66
|
+
'sf6686b6b90cc7680': `Carregant formulari`,
|
67
|
+
'sf8824fc70d91da9e': `Espanyol`,
|
68
|
+
'sf9e6fbadcce256d0': `Ha ocorregut un error`,
|
69
|
+
'sfbe83072001704e5': `El codi de seguiment és`,
|
70
|
+
};
|
71
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
|
2
|
+
// Do not modify this file by hand!
|
3
|
+
// Re-generate this file by running lit-localize
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
/* eslint-disable no-irregular-whitespace */
|
9
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
10
|
+
|
11
|
+
export const templates = {
|
12
|
+
's07f7935b16a64e43': `We appreciate you sending us your recognition, which will be forwarded to the responsible department. With this information, we consider your communication answered`,
|
13
|
+
's080ffb79b58c5d88': `First surname`,
|
14
|
+
's0b9a2919aa57a8c5': `Tax ID`,
|
15
|
+
's10132a1f9423876e': `Not implemented`,
|
16
|
+
's108402007fab3ec5': `English`,
|
17
|
+
's1abaad4e0bafba35': `Error loading the form`,
|
18
|
+
's1d7849c1bb306edd': `Catalan`,
|
19
|
+
's1f26cb0a65a0c36c': `Personal information`,
|
20
|
+
's22d3debb0fe19771': `Niris online support`,
|
21
|
+
's238c3ed6d3ecc66a': `Close`,
|
22
|
+
's26432c53ecd144e8': `Write your query here`,
|
23
|
+
's2b9fde9a5739d2a0': `Name`,
|
24
|
+
's36e2c319c2d9da17': `NIE`,
|
25
|
+
's4177fe7f5d70fd33': `Go back`,
|
26
|
+
's4ab9666eac463302': `Door`,
|
27
|
+
's4d7be50524a42681': `Add file`,
|
28
|
+
's54cd3139a4d69fbc': `Location`,
|
29
|
+
's572f5ed1f68bfcbc': `NIF/DNI`,
|
30
|
+
's5b2d32ceb3df3643': `Staircase`,
|
31
|
+
's5ea9f272dd7f1da8': `Email`,
|
32
|
+
's694b51e10128655f': `Write your phone number`,
|
33
|
+
's6b344d8147866cc1': `Information, Queries, Complaints and Suggestions:`,
|
34
|
+
's7bc25696aeb11d7f': `Contact person`,
|
35
|
+
's7c953cf010581df3': `Passport`,
|
36
|
+
's7cf6cfa5cdc725e3': `Accepted:`,
|
37
|
+
's7fbca09fab401ca5': `Confirm your email`,
|
38
|
+
's889d2b38e8eb16b1': `Write your email`,
|
39
|
+
's88a1a97d95757131': `District`,
|
40
|
+
's9802dd10b2c2f760': `Send`,
|
41
|
+
'sa6e4de4116073f37': `Confirm email`,
|
42
|
+
'saac6d40cd7052608': `Document Number`,
|
43
|
+
'sac8b678ef5500421': `District*:`,
|
44
|
+
'saddc930eb2efdca6': `Form created!`,
|
45
|
+
'sae3f1a64e8f9c33d': `Search`,
|
46
|
+
'sb044a1b221567c04': `Document Type`,
|
47
|
+
'sb096f7a10f6e5904': `Street`,
|
48
|
+
'sb1942b92592ac8cf': `We apologize for the inconvenience. Please try again later`,
|
49
|
+
'sb6cacaf045a2fe90': `Online support`,
|
50
|
+
'sc93268d68f7d69a4': `Number`,
|
51
|
+
'sca318e1f09f7800c': `Year of birth`,
|
52
|
+
'scbe4c6673872bda5': `Phone`,
|
53
|
+
'sd08f47835375b0d2': `Response language`,
|
54
|
+
'sd09a1a8863c8ae5b': `Request characteristics`,
|
55
|
+
'sd1f44f1a8bc20e67': `Email`,
|
56
|
+
'sd2bd4af48abb3752': `Company name`,
|
57
|
+
'sd901c7baed664633': `Citizen`,
|
58
|
+
'sd9e5b15f059a59ee': `Second surname`,
|
59
|
+
'sdd366d6d0fe37812': `Company/Entity`,
|
60
|
+
'sdf913cb738108398': `Emails do not match`,
|
61
|
+
'se1674091f5776527': `Confirm email`,
|
62
|
+
'se962e919c6552a74': `Floor`,
|
63
|
+
'see4f9c33f20ae7e2': `Message`,
|
64
|
+
'sf2d9bee1ddd749d4': `Write your message briefly`,
|
65
|
+
'sf4533552651212ea': `Fields marked with (*) are mandatory.`,
|
66
|
+
'sf6686b6b90cc7680': `Loading form`,
|
67
|
+
'sf8824fc70d91da9e': `Spanish`,
|
68
|
+
'sf9e6fbadcce256d0': `An error has occurred`,
|
69
|
+
'sfbe83072001704e5': `The tracking code is`,
|
70
|
+
};
|
71
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://raw.githubusercontent.com/lit/lit/main/packages/localize-tools/config.schema.json",
|
3
|
+
"sourceLocale": "es",
|
4
|
+
"targetLocales": ["en", "ca"],
|
5
|
+
"tsConfig": "../tsconfig.json",
|
6
|
+
"output": {
|
7
|
+
"mode": "runtime",
|
8
|
+
"outputDir": "./generated/locales",
|
9
|
+
"localeCodesModule": "./generated/locale-codes.ts"
|
10
|
+
},
|
11
|
+
"interchange": {
|
12
|
+
"format": "xliff",
|
13
|
+
"xliffDir": "./xliff/"
|
14
|
+
}
|
15
|
+
}
|
package/src/map-niris.ts
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
import {html, css, LitElement} from 'lit';
|
2
|
+
import {property, state} from 'lit/decorators.js';
|
3
|
+
import {globalStyles} from './styles/globalStyles';
|
4
|
+
import {Icon, LeafletMouseEvent, Map, Marker} from 'leaflet';
|
5
|
+
|
6
|
+
// https://github.com/Leaflet/Leaflet/issues/7055
|
7
|
+
// https://github.com/Leaflet/Leaflet/pull/7174
|
8
|
+
// https://github.com/Leaflet/Leaflet/pull/6239
|
9
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
10
|
+
// @ts-ignore
|
11
|
+
import * as L from 'leaflet/dist/leaflet-src.esm.js';
|
12
|
+
|
13
|
+
class MapNiris extends LitElement {
|
14
|
+
private _marker!: Marker | null;
|
15
|
+
private _map!: Map;
|
16
|
+
private _markerIcon!: Icon;
|
17
|
+
|
18
|
+
@property({type: String}) domain: string =
|
19
|
+
'https://iris2-backend-demo-iris-community.labs.apsl.io/services/iris/api-public';
|
20
|
+
// TODO property for lat and lon
|
21
|
+
|
22
|
+
@state()
|
23
|
+
private street: string = '';
|
24
|
+
|
25
|
+
@state()
|
26
|
+
private streetNumber: string = '';
|
27
|
+
|
28
|
+
@state()
|
29
|
+
private latitude: string = '';
|
30
|
+
|
31
|
+
@state()
|
32
|
+
private longitude: string = '';
|
33
|
+
|
34
|
+
constructor() {
|
35
|
+
super();
|
36
|
+
L.Icon.Default.imagePath = `https://unpkg.com/leaflet@${L.version}/dist/images/`;
|
37
|
+
this._markerIcon = new L.Icon({
|
38
|
+
iconUrl:
|
39
|
+
'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-blue.png',
|
40
|
+
shadowUrl:
|
41
|
+
'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png',
|
42
|
+
iconSize: [25, 41],
|
43
|
+
iconAnchor: [12, 41],
|
44
|
+
popupAnchor: [1, -34],
|
45
|
+
shadowSize: [41, 41],
|
46
|
+
});
|
47
|
+
}
|
48
|
+
|
49
|
+
override render() {
|
50
|
+
return html`
|
51
|
+
<link
|
52
|
+
rel="stylesheet"
|
53
|
+
href="https://cdn.skypack.dev/leaflet/dist/leaflet.css"
|
54
|
+
/>
|
55
|
+
<div id="map"></div>
|
56
|
+
<form id="form2">
|
57
|
+
<section class="map-form">
|
58
|
+
<div>
|
59
|
+
<label for="map-address">Calle*:</label>
|
60
|
+
<input
|
61
|
+
id="map-address"
|
62
|
+
required
|
63
|
+
type="text"
|
64
|
+
@keyup="${(event: KeyboardEvent) =>
|
65
|
+
(this.street = (event.target as HTMLInputElement).value)}"
|
66
|
+
.value="${this.street}"
|
67
|
+
name="address"
|
68
|
+
/>
|
69
|
+
<input name="location[lat]" hidden .value="${this.latitude}" />
|
70
|
+
<input name="location[lon]" hidden .value="${this.longitude}" />
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<div>
|
74
|
+
<label for="map-number">Número*:</label>
|
75
|
+
<input
|
76
|
+
id="map-number"
|
77
|
+
@keyup="${(event: KeyboardEvent) =>
|
78
|
+
(this.streetNumber = (event.target as HTMLInputElement).value)}"
|
79
|
+
.value="${this.streetNumber}"
|
80
|
+
required
|
81
|
+
type="text"
|
82
|
+
name="location[number]"
|
83
|
+
/>
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div>
|
87
|
+
<button
|
88
|
+
.disabled="${!Boolean(this.street.length)}"
|
89
|
+
@click="${this.searchAddress}"
|
90
|
+
>
|
91
|
+
Buscar
|
92
|
+
</button>
|
93
|
+
</div>
|
94
|
+
</section>
|
95
|
+
|
96
|
+
<section class="map-form-grid">
|
97
|
+
<div>
|
98
|
+
<label for="map-floor">Piso:</label>
|
99
|
+
<input id="map-floor" required type="text" name="location[floor]" />
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div>
|
103
|
+
<label for="map-stair">Escalera:</label>
|
104
|
+
<input id="map-stair" required type="text" name="location[stair]" />
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div>
|
108
|
+
<label for="map-door">Puerta:</label>
|
109
|
+
<input id="map-door" required type="text" name="location[door]" />
|
110
|
+
</div>
|
111
|
+
</section>
|
112
|
+
</form>
|
113
|
+
`;
|
114
|
+
}
|
115
|
+
|
116
|
+
async onMapClick(e: LeafletMouseEvent) {
|
117
|
+
if (this._marker) {
|
118
|
+
this._map.removeLayer(this._marker);
|
119
|
+
}
|
120
|
+
this._marker = new L.marker([e.latlng.lat, e.latlng.lng], {
|
121
|
+
icon: this._markerIcon,
|
122
|
+
}).addTo(this._map);
|
123
|
+
try {
|
124
|
+
const response = await fetch(
|
125
|
+
`${this.domain}/geo_proxy/ubication/reverse/?lat=${e.latlng.lat}&lon=${e.latlng.lng}`
|
126
|
+
);
|
127
|
+
if (!response.ok) {
|
128
|
+
throw new Error(response.statusText);
|
129
|
+
} else {
|
130
|
+
debugger;
|
131
|
+
const ubi = await response.json();
|
132
|
+
this.street = ubi.street;
|
133
|
+
this.streetNumber = ubi.street2;
|
134
|
+
this.latitude = ubi.latitude;
|
135
|
+
this.longitude = ubi.longitude;
|
136
|
+
}
|
137
|
+
} catch (error) {
|
138
|
+
console.info(error);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
async searchAddress() {
|
143
|
+
try {
|
144
|
+
const response = await fetch(
|
145
|
+
`${this.domain}/geo_proxy/ubication/search/?q=${this.street}, ${this.streetNumber}`
|
146
|
+
);
|
147
|
+
if (this._marker) {
|
148
|
+
this._map.removeLayer(this._marker);
|
149
|
+
}
|
150
|
+
const data = await response.json();
|
151
|
+
this._marker = new L.marker([data[0].lat, data[0].lon]).addTo(this._map);
|
152
|
+
this._map.setView([data[0].lat, data[0].lon], 15);
|
153
|
+
} catch (error) {
|
154
|
+
console.error(error);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
override firstUpdated() {
|
159
|
+
const mapEl = this.shadowRoot?.querySelector('#map');
|
160
|
+
this._map = L.map(mapEl, {
|
161
|
+
markerZoomAnimation: false,
|
162
|
+
attributionControl: false,
|
163
|
+
}).setView([39.7189879, 2.8634595], 15);
|
164
|
+
|
165
|
+
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
166
|
+
attribution:
|
167
|
+
'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
168
|
+
}).addTo(this._map);
|
169
|
+
|
170
|
+
this._map.on('click', (e) => this.onMapClick(e));
|
171
|
+
}
|
172
|
+
|
173
|
+
static override styles = [
|
174
|
+
globalStyles,
|
175
|
+
css`
|
176
|
+
#map {
|
177
|
+
margin-bottom: 2rem;
|
178
|
+
width: 100%;
|
179
|
+
height: 30vh;
|
180
|
+
border: 1px solid #676774;
|
181
|
+
}
|
182
|
+
.map-form {
|
183
|
+
display: flex;
|
184
|
+
justify-content: space-between;
|
185
|
+
align-items: flex-end;
|
186
|
+
gap: 1rem;
|
187
|
+
}
|
188
|
+
|
189
|
+
.map-form div:nth-child(1) {
|
190
|
+
flex-basis: 60%;
|
191
|
+
}
|
192
|
+
.map-form div:nth-child(2) {
|
193
|
+
flex-basis: 30%;
|
194
|
+
}
|
195
|
+
.map-form button {
|
196
|
+
flex-basis: 20%;
|
197
|
+
margin-bottom: 0.5rem;
|
198
|
+
}
|
199
|
+
|
200
|
+
.map-form-grid {
|
201
|
+
display: grid;
|
202
|
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
203
|
+
gap: 1rem;
|
204
|
+
}
|
205
|
+
`,
|
206
|
+
];
|
207
|
+
}
|
208
|
+
|
209
|
+
customElements.define('map-niris', MapNiris);
|
210
|
+
|
211
|
+
declare global {
|
212
|
+
interface HTMLElementTagNameMap {
|
213
|
+
'map-niris': MapNiris;
|
214
|
+
}
|
215
|
+
}
|
@@ -0,0 +1,170 @@
|
|
1
|
+
import {css} from 'lit';
|
2
|
+
|
3
|
+
export const globalStyles = css`
|
4
|
+
/* Base */
|
5
|
+
h1 {
|
6
|
+
font-size: 2rem;
|
7
|
+
line-height: 2.5rem;
|
8
|
+
color: var(--primary-color);
|
9
|
+
margin: 2rem 0;
|
10
|
+
}
|
11
|
+
|
12
|
+
h2 {
|
13
|
+
font-size: 1.5rem;
|
14
|
+
line-height: 2rem;
|
15
|
+
margin: 3rem 0;
|
16
|
+
color: var(--primary-color);
|
17
|
+
filter: opacity(80%);
|
18
|
+
}
|
19
|
+
|
20
|
+
h3 {
|
21
|
+
font-size: 1.3rem;
|
22
|
+
line-height: 2rem;
|
23
|
+
margin: 2rem 0;
|
24
|
+
color: var(--primary-color);
|
25
|
+
filter: opacity(70%);
|
26
|
+
}
|
27
|
+
|
28
|
+
* {
|
29
|
+
font-family: 'Brush Script MT', cursive, sans-serif; /* This is fallback font for old browsers */
|
30
|
+
font-family: var(--font-family);
|
31
|
+
box-sizing: border-box;
|
32
|
+
color: #676774;
|
33
|
+
}
|
34
|
+
|
35
|
+
/* Buttons */
|
36
|
+
button,
|
37
|
+
.btn {
|
38
|
+
min-width: 120px;
|
39
|
+
background-color: var(--primary-color);
|
40
|
+
border: none;
|
41
|
+
cursor: pointer;
|
42
|
+
color: var(--color-button);
|
43
|
+
padding: var(--padding);
|
44
|
+
font-size: var(--font-size);
|
45
|
+
border-radius: var(--border-radius);
|
46
|
+
transition: 0.3s;
|
47
|
+
}
|
48
|
+
|
49
|
+
button:hover,
|
50
|
+
.btn:hover {
|
51
|
+
filter: brightness(120%);
|
52
|
+
}
|
53
|
+
|
54
|
+
button:focus-visible {
|
55
|
+
background-color: var(--primary-color);
|
56
|
+
outline: 3px solid var(--primary-color);
|
57
|
+
outline-offset: 2px;
|
58
|
+
}
|
59
|
+
|
60
|
+
button[type='submit'] {
|
61
|
+
margin: 2rem auto;
|
62
|
+
display: block;
|
63
|
+
}
|
64
|
+
|
65
|
+
button:disabled {
|
66
|
+
filter: contrast(50%);
|
67
|
+
cursor: not-allowed;
|
68
|
+
}
|
69
|
+
|
70
|
+
.btn-error {
|
71
|
+
background-color: var(--error-color);
|
72
|
+
}
|
73
|
+
|
74
|
+
.text-error {
|
75
|
+
color: var(--error-color);
|
76
|
+
}
|
77
|
+
|
78
|
+
/* Forms */
|
79
|
+
input,
|
80
|
+
textarea,
|
81
|
+
select {
|
82
|
+
border-radius: var(--border-radius);
|
83
|
+
padding: 0.5rem;
|
84
|
+
border-width: 2px;
|
85
|
+
border-color: rgb(209 213 219 / 1);
|
86
|
+
width: 100%;
|
87
|
+
font-size: 0.875rem;
|
88
|
+
margin: 0.5rem 0;
|
89
|
+
border-style: solid;
|
90
|
+
min-height: 2.5rem;
|
91
|
+
}
|
92
|
+
textarea {
|
93
|
+
resize: none;
|
94
|
+
height: 8rem;
|
95
|
+
}
|
96
|
+
|
97
|
+
input:focus,
|
98
|
+
textarea:focus,
|
99
|
+
select:focus {
|
100
|
+
outline: 2px solid transparent;
|
101
|
+
outline-offset: 2px;
|
102
|
+
--tw-ring-inset: var(--tw-empty, /*!*/ /*!*/);
|
103
|
+
--tw-ring-offset-width: 0px;
|
104
|
+
--tw-ring-offset-color: #fff;
|
105
|
+
--tw-ring-color: var(--primary-color);
|
106
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
|
107
|
+
var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
108
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0
|
109
|
+
calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
110
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
|
111
|
+
var(--tw-shadow);
|
112
|
+
border-color: var(--primary-color);
|
113
|
+
}
|
114
|
+
|
115
|
+
input::file-selector-button {
|
116
|
+
color: white;
|
117
|
+
background-color: var(--primary-color);
|
118
|
+
border-width: 0px;
|
119
|
+
padding: var(--padding);
|
120
|
+
border-radius: var(--border-radius);
|
121
|
+
}
|
122
|
+
input::file-selector-button:hover {
|
123
|
+
filter: brightness(120%);
|
124
|
+
cursor: pointer;
|
125
|
+
}
|
126
|
+
|
127
|
+
input.invalid,
|
128
|
+
textarea.invalid,
|
129
|
+
select.invalid {
|
130
|
+
border: 1px solid red;
|
131
|
+
}
|
132
|
+
|
133
|
+
input:user-invalid,
|
134
|
+
textarea:user-invalid,
|
135
|
+
select:user-invalid {
|
136
|
+
border: 1px solid red;
|
137
|
+
}
|
138
|
+
|
139
|
+
[multiple]:focus,
|
140
|
+
[type='date']:focus,
|
141
|
+
[type='datetime-local']:focus,
|
142
|
+
[type='email']:focus,
|
143
|
+
[type='month']:focus,
|
144
|
+
[type='number']:focus,
|
145
|
+
[type='password']:focus,
|
146
|
+
[type='search']:focus,
|
147
|
+
[type='tel']:focus,
|
148
|
+
[type='text']:focus,
|
149
|
+
[type='time']:focus,
|
150
|
+
[type='url']:focus,
|
151
|
+
[type='week']:focus,
|
152
|
+
input:where(:not([type])):focus,
|
153
|
+
select:focus,
|
154
|
+
textarea:focus {
|
155
|
+
outline: 2px solid transparent;
|
156
|
+
outline-offset: 2px;
|
157
|
+
--tw-empty: 1;
|
158
|
+
--tw-ring-inset: var(--tw-empty);
|
159
|
+
--tw-ring-offset-width: 0px;
|
160
|
+
--tw-ring-offset-color: #fff;
|
161
|
+
--tw-ring-color: var(--primary-color);
|
162
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
|
163
|
+
var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
164
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0
|
165
|
+
calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
166
|
+
border-color: var(--primary-color);
|
167
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
|
168
|
+
var(--tw-shadow);
|
169
|
+
}
|
170
|
+
`;
|
package/src/textarea-to-niris.ts
CHANGED
@@ -1,14 +1,29 @@
|
|
1
1
|
import {LitElement, html, css} from 'lit';
|
2
2
|
import {property} from 'lit/decorators.js';
|
3
|
-
|
3
|
+
import {msg, localized } from '@lit/localize';
|
4
|
+
import {configureLocalization} from '@lit/localize';
|
5
|
+
// Generated via output.localeCodesModule
|
6
|
+
import {sourceLocale, targetLocales} from './generated/locale-codes.js';
|
7
|
+
|
8
|
+
export const {getLocale, setLocale} = configureLocalization({
|
9
|
+
sourceLocale,
|
10
|
+
targetLocales,
|
11
|
+
loadLocale: (locale) => import(`./generated/locales/${locale}.js`),
|
12
|
+
});
|
13
|
+
|
14
|
+
@localized()
|
4
15
|
export class TextareaToNiris extends LitElement {
|
5
16
|
@property({type: String}) formAction: any;
|
6
17
|
@property({type: String}) keywords: any;
|
18
|
+
@property({type: String}) locale: string;
|
19
|
+
|
7
20
|
|
8
21
|
constructor() {
|
9
22
|
super();
|
10
23
|
this.formAction = '';
|
11
24
|
this.keywords = '';
|
25
|
+
this.locale = 'es'
|
26
|
+
setLocale(this.locale);
|
12
27
|
}
|
13
28
|
|
14
29
|
updateShownValue(event: Event) {
|
@@ -24,17 +39,17 @@ export class TextareaToNiris extends LitElement {
|
|
24
39
|
return html`
|
25
40
|
<div id="popover-container">
|
26
41
|
<button id="button-popover" popovertarget="popover">
|
27
|
-
Atención en línea
|
42
|
+
${msg('Atención en línea')}
|
28
43
|
</button>
|
29
44
|
|
30
45
|
<div popover id="popover">
|
31
46
|
<header>
|
32
|
-
<h2
|
47
|
+
<h2>${msg('Atención en línea Niris')}</h2>
|
33
48
|
</header>
|
34
|
-
<
|
35
|
-
<form action="${this.formAction}
|
36
|
-
<label for="niris-input"
|
37
|
-
|
49
|
+
<main>
|
50
|
+
<form action="${this.formAction}&keywords=${this.keywords}" method="get">
|
51
|
+
<label for="niris-input">
|
52
|
+
${msg('Información, Consultas, Quejas y Sugerencias:')}
|
38
53
|
</label>
|
39
54
|
<textarea
|
40
55
|
id="niris-input"
|
@@ -42,14 +57,14 @@ export class TextareaToNiris extends LitElement {
|
|
42
57
|
name="keywords"
|
43
58
|
required
|
44
59
|
minlength="4"
|
45
|
-
placeholder="Escribe tu consulta aquí"
|
60
|
+
placeholder="${msg('Escribe tu consulta aquí')}"
|
46
61
|
></textarea>
|
47
|
-
<button type="submit"
|
62
|
+
<button type="submit">${msg('Enviar')}</button>
|
48
63
|
<button type="button" @click="${this.closePopover}">
|
49
|
-
Cerrar
|
64
|
+
${msg('Cerrar')}
|
50
65
|
</button>
|
51
66
|
</form>
|
52
|
-
</
|
67
|
+
</main>
|
53
68
|
</div>
|
54
69
|
</div>
|
55
70
|
`;
|
@@ -57,7 +72,7 @@ export class TextareaToNiris extends LitElement {
|
|
57
72
|
|
58
73
|
static override styles = css`
|
59
74
|
:host {
|
60
|
-
--primary-color: #
|
75
|
+
--primary-color: #03599d;
|
61
76
|
--background-color: #d4d4d4;
|
62
77
|
--color: #fff;
|
63
78
|
--padding: 1rem 1rem;
|
@@ -217,9 +232,8 @@ export class TextareaToNiris extends LitElement {
|
|
217
232
|
|
218
233
|
customElements.define('textarea-to-niris', TextareaToNiris);
|
219
234
|
|
220
|
-
|
221
235
|
declare global {
|
222
236
|
interface HTMLElementTagNameMap {
|
223
|
-
|
237
|
+
'textarea-to-niris': TextareaToNiris;
|
224
238
|
}
|
225
|
-
}
|
239
|
+
}
|