@rsltda/components 1.0.20 → 1.0.22
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 +46 -3
- package/custom-elements.json +11 -3
- package/dist/components/rs-map.d.ts +8 -0
- package/dist/components/rs-whatsapp.d.ts +7 -0
- package/dist/rs-components.es.js +672 -481
- package/dist/rs-components.es.js.map +1 -1
- package/dist/rs-components.iife.js +156 -27
- package/dist/rs-components.iife.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,7 +41,11 @@ import "@rsltda/components/rs-components.es.js";
|
|
|
41
41
|
```html
|
|
42
42
|
<rs-whatsapp
|
|
43
43
|
marca="ktm"
|
|
44
|
-
position="
|
|
44
|
+
position="top-right"
|
|
45
|
+
offset-x="32"
|
|
46
|
+
offset-y="32"
|
|
47
|
+
--rs-whatsapp-z-index="10000"
|
|
48
|
+
--rs-whatsapp-font-family="Inter, sans-serif"
|
|
45
49
|
time-zone="America/Santiago"
|
|
46
50
|
>
|
|
47
51
|
<rs-whatsapp-schedule dias="lun-vie" desde="09:00" hasta="18:00"></rs-whatsapp-schedule>
|
|
@@ -90,7 +94,9 @@ import "@rsltda/components/rs-components.es.js";
|
|
|
90
94
|
| `label` | Texto visible cuando se usa `show-label`. Por defecto `WhatsApp`. |
|
|
91
95
|
| `menu-label` | Texto de la accion por defecto dentro del menu. Por defecto `compra de motos`. |
|
|
92
96
|
| `aria-label` | Etiqueta accesible del boton. Por defecto `Contactar por WhatsApp`. |
|
|
93
|
-
| `position` | Posicion flotante: `bottom-right`, `bottom-left`, `top-right` o `top-left`. |
|
|
97
|
+
| `position` | Posicion flotante: `bottom-right`, `bottom-center`, `bottom-left`, `center-right`, `center`, `center-left`, `top-right`, `top-center` o `top-left`. Por defecto `bottom-right`. |
|
|
98
|
+
| `offset-x` | Ajuste fino horizontal. Acepta una longitud CSS o un numero interpretado como `px`. En posiciones de borde afina la distancia al lado; en posiciones centradas desplaza respecto del centro. |
|
|
99
|
+
| `offset-y` | Ajuste fino vertical. Acepta una longitud CSS o un numero interpretado como `px`. En posiciones de borde afina la distancia al borde; en posiciones centradas desplaza respecto del centro. |
|
|
94
100
|
| `show-label` | Muestra el texto junto al icono. |
|
|
95
101
|
| `target` | Target del enlace. Por defecto `_blank`. |
|
|
96
102
|
| `marca` | Variante visual para elementos internos como el icono de moto: `ktm`, `hqv`, `gasgas`, `voge` o `rs`. El boton principal mantiene el verde de WhatsApp. |
|
|
@@ -98,7 +104,44 @@ import "@rsltda/components/rs-components.es.js";
|
|
|
98
104
|
| `horario` | Horario de atencion opcional en formato compacto. Ejemplo: `lun-vie 09:00-18:00; sab 10:00-14:00`. |
|
|
99
105
|
| `fuera-horario` | Fuerza el estado fuera de horario manualmente. |
|
|
100
106
|
| `mensaje-fuera-horario` | Mensaje mostrado cuando el componente esta fuera de horario. Si hay horario configurado, el componente agrega el resumen del horario. |
|
|
101
|
-
| `time-zone` | Zona horaria IANA opcional para evaluar `horario`, por ejemplo `America/Santiago`. Si no se define, usa
|
|
107
|
+
| `time-zone` | Zona horaria IANA opcional para evaluar `horario`, por ejemplo `America/Santiago`. Si no se define, usa `America/Santiago`. |
|
|
108
|
+
|
|
109
|
+
### Variables CSS configurables
|
|
110
|
+
|
|
111
|
+
Estas variables se pueden pasar como atributos que empiecen por `--`, por ejemplo `--rs-whatsapp-z-index="10000"`.
|
|
112
|
+
|
|
113
|
+
| Variable CSS | Valor por defecto | Descripcion |
|
|
114
|
+
| --- | --- | --- |
|
|
115
|
+
| `--rs-whatsapp-right` | `24px` | Separacion horizontal desde la derecha en `bottom-right` y `top-right`. |
|
|
116
|
+
| `--rs-whatsapp-left` | `24px` | Separacion horizontal desde la izquierda en `bottom-left`, `top-left`, `center-left` y `bottom-center`/`top-center` cuando aplica. |
|
|
117
|
+
| `--rs-whatsapp-top` | `24px` | Separacion vertical desde arriba en `top-right`, `top-left`, `top-center` y variantes centradas verticalmente. |
|
|
118
|
+
| `--rs-whatsapp-bottom` | `24px` | Separacion vertical desde abajo en `bottom-right`, `bottom-left`, `bottom-center` y variantes centradas verticalmente. |
|
|
119
|
+
| `--rs-whatsapp-mobile-right` | `16px` | Separacion horizontal desde la derecha en mobile. |
|
|
120
|
+
| `--rs-whatsapp-mobile-left` | `16px` | Separacion horizontal desde la izquierda en mobile. |
|
|
121
|
+
| `--rs-whatsapp-mobile-top` | `16px` | Separacion vertical desde arriba en mobile. |
|
|
122
|
+
| `--rs-whatsapp-mobile-bottom` | `16px` | Separacion vertical desde abajo en mobile. |
|
|
123
|
+
| `--rs-whatsapp-offset-x` | `0px` | Ajuste fino horizontal adicional para desplazar la posicion. |
|
|
124
|
+
| `--rs-whatsapp-offset-y` | `0px` | Ajuste fino vertical adicional para desplazar la posicion. |
|
|
125
|
+
| `--rs-whatsapp-z-index` | `9999` | Orden de apilado del componente. |
|
|
126
|
+
| `--rs-whatsapp-font-family` | `system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif` | Familia tipografica del componente. |
|
|
127
|
+
| `--rs-whatsapp-size` | `60px` | Tamano del boton principal. |
|
|
128
|
+
| `--rs-whatsapp-bg` | `#25d366` | Color de fondo del boton principal. |
|
|
129
|
+
| `--rs-whatsapp-color` | `#ffffff` | Color del icono y texto del boton principal. |
|
|
130
|
+
| `--rs-whatsapp-shadow` | `0 10px 24px rgb(0 0 0 / 22%)` | Sombra del boton principal. |
|
|
131
|
+
| `--rs-whatsapp-shadow-hover` | `0 14px 28px rgb(0 0 0 / 26%)` | Sombra del boton principal en hover. |
|
|
132
|
+
| `--rs-whatsapp-menu-width` | `280px` | Ancho maximo del menu. |
|
|
133
|
+
| `--rs-whatsapp-menu-border` | `#e5e7eb` | Borde del menu. |
|
|
134
|
+
| `--rs-whatsapp-menu-radius` | `8px` | Radio de borde del menu. |
|
|
135
|
+
| `--rs-whatsapp-menu-bg` | `#ffffff` | Fondo del menu. |
|
|
136
|
+
| `--rs-whatsapp-menu-color` | `#111827` | Color de texto del menu. |
|
|
137
|
+
| `--rs-whatsapp-menu-shadow` | `0 18px 38px rgb(0 0 0 / 18%)` | Sombra del menu. |
|
|
138
|
+
| `--rs-whatsapp-menu-muted` | `#4b5563` | Color del texto secundario del encabezado del menu. |
|
|
139
|
+
| `--rs-whatsapp-menu-brand` | `#111827` | Color del texto principal del encabezado del menu. |
|
|
140
|
+
| `--rs-whatsapp-menu-hover-bg` | `#f3f4f6` | Fondo de hover para las opciones del menu. |
|
|
141
|
+
| `--rs-whatsapp-menu-icon-color` | `var(--rs-whatsapp-brand-color)` | Color de los iconos del menu. |
|
|
142
|
+
| `--rs-whatsapp-closed-bg` | `#f3f4f6` | Fondo del mensaje fuera de horario. |
|
|
143
|
+
| `--rs-whatsapp-closed-color` | `#374151` | Color del mensaje fuera de horario. |
|
|
144
|
+
| `--rs-whatsapp-brand-color` | `#25d366` | Color de marca usado por iconos internos y algunos acentos. Puede ser ajustado por `marca` o sobrescrito manualmente. |
|
|
102
145
|
|
|
103
146
|
Si `<rs-whatsapp>` contiene uno o mas `<rs-whatsapp-option>`, el menu se genera desde esas opciones. Las opciones sin `telefono` no se muestran. Si no contiene opciones, usa `telefono`, `mensaje` y `menu-label` del componente padre como opcion unica.
|
|
104
147
|
|
package/custom-elements.json
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"name": "RsWhatsapp",
|
|
60
60
|
"tagName": "rs-whatsapp",
|
|
61
61
|
"customElement": true,
|
|
62
|
-
"description": "Web component para mostrar un boton flotante de WhatsApp con menu configurable.",
|
|
62
|
+
"description": "Web component para mostrar un boton flotante de WhatsApp con menu configurable. Ademas, cualquier atributo que empiece por -- se copia al :host como variable CSS.",
|
|
63
63
|
"attributes": [
|
|
64
64
|
{
|
|
65
65
|
"name": "telefono",
|
|
@@ -83,7 +83,15 @@
|
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
"name": "position",
|
|
86
|
-
"description": "Posicion flotante: bottom-right, bottom-left, top-right o top-left. Por defecto bottom-right."
|
|
86
|
+
"description": "Posicion flotante: bottom-right, bottom-center, bottom-left, center-right, center, center-left, top-right, top-center o top-left. Por defecto bottom-right."
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "offset-x",
|
|
90
|
+
"description": "Ajuste fino horizontal. Acepta una longitud CSS o un numero interpretado como px. En posiciones de borde afina la distancia al lado; en posiciones centradas desplaza respecto del centro."
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "offset-y",
|
|
94
|
+
"description": "Ajuste fino vertical. Acepta una longitud CSS o un numero interpretado como px. En posiciones de borde afina la distancia al borde; en posiciones centradas desplaza respecto del centro."
|
|
87
95
|
},
|
|
88
96
|
{
|
|
89
97
|
"name": "show-label",
|
|
@@ -115,7 +123,7 @@
|
|
|
115
123
|
},
|
|
116
124
|
{
|
|
117
125
|
"name": "time-zone",
|
|
118
|
-
"description": "Zona horaria IANA opcional para evaluar horario, por ejemplo America/Santiago. Si no se define, usa
|
|
126
|
+
"description": "Zona horaria IANA opcional para evaluar horario, por ejemplo America/Santiago. Si no se define, usa America/Santiago."
|
|
119
127
|
}
|
|
120
128
|
]
|
|
121
129
|
},
|
|
@@ -31,11 +31,14 @@ export declare class RsMap extends HTMLElement {
|
|
|
31
31
|
private markerIconBaseUrl;
|
|
32
32
|
private defaultMarkerIconUrl;
|
|
33
33
|
private pointsCacheTtlMs;
|
|
34
|
+
private refreshIntervalMs;
|
|
35
|
+
private refreshIntervalId;
|
|
34
36
|
private static fontAwesomeAttached;
|
|
35
37
|
private panAnimationFrame;
|
|
36
38
|
private highlightTimeout;
|
|
37
39
|
private isSyncingInitialAttributes;
|
|
38
40
|
private refreshQueued;
|
|
41
|
+
private refreshQueuedForce;
|
|
39
42
|
private localPointsRequests;
|
|
40
43
|
static get observedAttributes(): string[];
|
|
41
44
|
constructor();
|
|
@@ -51,11 +54,15 @@ export declare class RsMap extends HTMLElement {
|
|
|
51
54
|
private setGoogleMapsKey;
|
|
52
55
|
private setPointsApiUrl;
|
|
53
56
|
private setCacheDays;
|
|
57
|
+
private applyRefreshInterval;
|
|
58
|
+
private parseRefreshInterval;
|
|
59
|
+
private clearRefreshTimer;
|
|
54
60
|
private setMarkerIconBase;
|
|
55
61
|
private setDefaultMarkerIcon;
|
|
56
62
|
private setMarca;
|
|
57
63
|
private setTipo;
|
|
58
64
|
private queueRefreshPoints;
|
|
65
|
+
forceRefresh(): void;
|
|
59
66
|
get marcaFilter(): string;
|
|
60
67
|
get tipoFilter(): string;
|
|
61
68
|
private updatePanelTitle;
|
|
@@ -107,6 +114,7 @@ export declare class RsMap extends HTMLElement {
|
|
|
107
114
|
private updateZoneButtonCounts;
|
|
108
115
|
private updateZoneVisibility;
|
|
109
116
|
private handleNearestClick;
|
|
117
|
+
private handleVisibilityChange;
|
|
110
118
|
private findNearestPoint;
|
|
111
119
|
private haversine;
|
|
112
120
|
private scrollToPointCard;
|
|
@@ -8,15 +8,21 @@ export declare class RsWhatsapp extends HTMLElement {
|
|
|
8
8
|
private closedMessageEl;
|
|
9
9
|
private closedMessageTextEl;
|
|
10
10
|
private labelEl;
|
|
11
|
+
private hostAttributeObserver?;
|
|
11
12
|
private childrenObserver?;
|
|
13
|
+
private appliedCssVariableNames;
|
|
12
14
|
static get observedAttributes(): string[];
|
|
13
15
|
constructor();
|
|
14
16
|
connectedCallback(): void;
|
|
17
|
+
private cacheShadowElements;
|
|
15
18
|
disconnectedCallback(): void;
|
|
16
19
|
attributeChangedCallback(): void;
|
|
17
20
|
private syncAttributesToState;
|
|
18
21
|
private buildWhatsappUrl;
|
|
19
22
|
private sanitizePhone;
|
|
23
|
+
private syncCssVariablesFromAttributes;
|
|
24
|
+
private syncPositionOffsets;
|
|
25
|
+
private normalizeCssLength;
|
|
20
26
|
private syncBrandVariant;
|
|
21
27
|
private normalizeBrandKey;
|
|
22
28
|
private renderMenuOptions;
|
|
@@ -37,6 +43,7 @@ export declare class RsWhatsapp extends HTMLElement {
|
|
|
37
43
|
private handleButtonClick;
|
|
38
44
|
private handleMenuClick;
|
|
39
45
|
private handleCustomMenuSlotChange;
|
|
46
|
+
private handleHostAttributesMutation;
|
|
40
47
|
private handleChildrenMutation;
|
|
41
48
|
private handleDocumentClick;
|
|
42
49
|
private handleDocumentKeydown;
|