@everymatrix/helper-accordion 1.32.4 → 1.33.0
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/cjs/helper-accordion.cjs.entry.js +133 -0
- package/dist/cjs/helper-accordion.cjs.js +19 -0
- package/dist/cjs/index-ed89de9c.js +1191 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/helper-accordion/helper-accordion.css +101 -0
- package/dist/collection/components/helper-accordion/helper-accordion.js +353 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +23 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/components/helper-accordion.d.ts +11 -0
- package/dist/components/helper-accordion.js +162 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/helper-accordion.entry.js +129 -0
- package/dist/esm/helper-accordion.js +17 -0
- package/dist/esm/index-a87a3869.js +1165 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/helper-accordion/helper-accordion.esm.js +1 -0
- package/dist/helper-accordion/index.esm.js +0 -0
- package/dist/helper-accordion/p-a199c923.entry.js +1 -0
- package/dist/helper-accordion/p-a8ce3eea.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/helper-accordion/.stencil/packages/helper-accordion/stencil.config.d.ts +2 -0
- package/dist/types/components/helper-accordion/helper-accordion.d.ts +65 -0
- package/dist/types/components.d.ts +137 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +2 -3
- package/LICENSE +0 -21
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-ed89de9c.js');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
const patchEsm = () => {
|
|
11
|
+
return index.promiseResolve();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const defineCustomElements = (win, options) => {
|
|
15
|
+
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
|
+
return patchEsm().then(() => {
|
|
17
|
+
return index.bootstrapLazy([["helper-accordion.cjs",[[1,"helper-accordion",{"ticketHistoryFlag":[516,"ticket-history-flag"],"headerTitle":[513,"header-title"],"headerSubtitle":[513,"header-subtitle"],"description":[513],"footer":[516],"deleteTab":[516,"delete-tab"],"postMessage":[516,"post-message"],"eventName":[513,"event-name"],"collapsed":[516],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrlContent":[513,"client-styling-url-content"],"showContent":[32],"limitStylingAppends":[32]}]]]], options);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
font-family: "Roboto", sans-serif;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.Header {
|
|
8
|
+
border-radius: 5px;
|
|
9
|
+
background: #009993;
|
|
10
|
+
display: flex;
|
|
11
|
+
gap: 30px;
|
|
12
|
+
border: 1px solid #009993;
|
|
13
|
+
padding: 8px 10px;
|
|
14
|
+
user-select: none;
|
|
15
|
+
margin-bottom: 1px;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
.Header:hover {
|
|
19
|
+
background: #00ABA4;
|
|
20
|
+
}
|
|
21
|
+
.Header .Title,
|
|
22
|
+
.Header .Subtitle,
|
|
23
|
+
.Header .Description {
|
|
24
|
+
margin: 0;
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
color: #fff;
|
|
27
|
+
text-transform: capitalize;
|
|
28
|
+
}
|
|
29
|
+
.Header .Expand {
|
|
30
|
+
margin-left: auto;
|
|
31
|
+
color: #FFF;
|
|
32
|
+
width: 17px;
|
|
33
|
+
height: 17px;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
text-align: center;
|
|
36
|
+
transform: rotate(90deg);
|
|
37
|
+
font-size: 20px;
|
|
38
|
+
user-select: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.HeaderTicketHistory {
|
|
42
|
+
border-radius: 4px;
|
|
43
|
+
background: #F1F1F1;
|
|
44
|
+
display: flex;
|
|
45
|
+
gap: 30px;
|
|
46
|
+
border: 1px solid #009993;
|
|
47
|
+
padding: 8px 10px;
|
|
48
|
+
user-select: none;
|
|
49
|
+
margin-bottom: 5px;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
.HeaderTicketHistory:hover {
|
|
53
|
+
background: #00ABA4;
|
|
54
|
+
}
|
|
55
|
+
.HeaderTicketHistory .Title,
|
|
56
|
+
.HeaderTicketHistory .Subtitle,
|
|
57
|
+
.HeaderTicketHistory .Description {
|
|
58
|
+
margin: 0;
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
color: #000;
|
|
61
|
+
}
|
|
62
|
+
.HeaderTicketHistory .Expand {
|
|
63
|
+
margin-left: auto;
|
|
64
|
+
color: #FFF;
|
|
65
|
+
width: 17px;
|
|
66
|
+
height: 17px;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
text-align: center;
|
|
69
|
+
transform: rotate(90deg);
|
|
70
|
+
font-size: 20px;
|
|
71
|
+
user-select: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.Content {
|
|
75
|
+
border-radius: 0 0 4px 4px;
|
|
76
|
+
background: #fff;
|
|
77
|
+
border: 1px solid #009993;
|
|
78
|
+
padding: 10px 15px;
|
|
79
|
+
user-select: none;
|
|
80
|
+
color: #000;
|
|
81
|
+
margin-bottom: 10px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ActionButton {
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
display: inline-block;
|
|
87
|
+
border-radius: 4px;
|
|
88
|
+
margin: 20px 0 10px;
|
|
89
|
+
text-transform: uppercase;
|
|
90
|
+
font-size: 12px;
|
|
91
|
+
text-align: center;
|
|
92
|
+
padding: 8px 20px;
|
|
93
|
+
min-width: 80px;
|
|
94
|
+
background: #FF3D00;
|
|
95
|
+
border: 1px solid #FF3D00;
|
|
96
|
+
color: #FFF;
|
|
97
|
+
}
|
|
98
|
+
.ActionButton:hover {
|
|
99
|
+
background: #FF6536;
|
|
100
|
+
border: 1px solid #FF3D00;
|
|
101
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { Component, Prop, h, State, Event } from '@stencil/core';
|
|
2
|
+
import { translate } from '../../utils/locale.utils';
|
|
3
|
+
export class Accordion {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Flag for ticket history
|
|
7
|
+
*/
|
|
8
|
+
this.ticketHistoryFlag = false;
|
|
9
|
+
/**
|
|
10
|
+
* Title (top header)
|
|
11
|
+
*/
|
|
12
|
+
this.headerTitle = '';
|
|
13
|
+
/**
|
|
14
|
+
* SubTitle (top header)
|
|
15
|
+
*/
|
|
16
|
+
this.headerSubtitle = '';
|
|
17
|
+
/**
|
|
18
|
+
* Description
|
|
19
|
+
*/
|
|
20
|
+
this.description = '';
|
|
21
|
+
/**
|
|
22
|
+
* Enables footer content
|
|
23
|
+
*/
|
|
24
|
+
this.footer = false;
|
|
25
|
+
/**
|
|
26
|
+
* Enables footer button for tab deletion
|
|
27
|
+
*/
|
|
28
|
+
this.deleteTab = false;
|
|
29
|
+
/**
|
|
30
|
+
* Activates postMessages as events for actions from the widget
|
|
31
|
+
*/
|
|
32
|
+
this.postMessage = false;
|
|
33
|
+
/**
|
|
34
|
+
* Name of the event emitter by the action button
|
|
35
|
+
*/
|
|
36
|
+
this.eventName = 'helperAccordionAction';
|
|
37
|
+
/**
|
|
38
|
+
* Collapsed
|
|
39
|
+
*/
|
|
40
|
+
this.collapsed = true;
|
|
41
|
+
/**
|
|
42
|
+
* Language
|
|
43
|
+
*/
|
|
44
|
+
this.language = 'en';
|
|
45
|
+
/**
|
|
46
|
+
* Client custom styling via string
|
|
47
|
+
*/
|
|
48
|
+
this.clientStyling = '';
|
|
49
|
+
/**
|
|
50
|
+
* Client custom styling via url content
|
|
51
|
+
*/
|
|
52
|
+
this.clientStylingUrlContent = '';
|
|
53
|
+
this.limitStylingAppends = false;
|
|
54
|
+
this.setClientStyling = () => {
|
|
55
|
+
let sheet = document.createElement('style');
|
|
56
|
+
sheet.innerHTML = this.clientStyling;
|
|
57
|
+
this.stylingContainer.prepend(sheet);
|
|
58
|
+
};
|
|
59
|
+
this.setClientStylingURL = () => {
|
|
60
|
+
let cssFile = document.createElement('style');
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
63
|
+
this.stylingContainer.prepend(cssFile);
|
|
64
|
+
}, 1);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// @TODO fix the `any` type :)
|
|
68
|
+
connectedCallback() {
|
|
69
|
+
this.showContent = !this.collapsed;
|
|
70
|
+
}
|
|
71
|
+
componentDidRender() {
|
|
72
|
+
// start custom styling area
|
|
73
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
74
|
+
if (this.clientStyling)
|
|
75
|
+
this.setClientStyling();
|
|
76
|
+
if (this.clientStylingUrlContent)
|
|
77
|
+
this.setClientStylingURL();
|
|
78
|
+
this.limitStylingAppends = true;
|
|
79
|
+
}
|
|
80
|
+
// end custom styling area
|
|
81
|
+
}
|
|
82
|
+
toggleContent() {
|
|
83
|
+
this.showContent = !this.showContent;
|
|
84
|
+
}
|
|
85
|
+
deleteAction() {
|
|
86
|
+
if (this.postMessage) {
|
|
87
|
+
// @TODO maybe change the name type, this one sucks
|
|
88
|
+
window.postMessage({ type: this.eventName }, window.location.href);
|
|
89
|
+
}
|
|
90
|
+
this.accordionEvent.emit();
|
|
91
|
+
}
|
|
92
|
+
render() {
|
|
93
|
+
return (h("div", { class: "Wrapper", ref: el => this.stylingContainer = el },
|
|
94
|
+
h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header', onClick: () => this.toggleContent() },
|
|
95
|
+
h("p", { class: "Title" }, this.headerTitle),
|
|
96
|
+
h("p", { class: "Subtitle" }, this.headerSubtitle),
|
|
97
|
+
h("p", { class: "Subtitle Description" }, this.description),
|
|
98
|
+
h("span", { class: "Expand" }, this.showContent ? '<' : '>')),
|
|
99
|
+
this.showContent &&
|
|
100
|
+
h("div", null,
|
|
101
|
+
h("div", { class: "Content" },
|
|
102
|
+
h("slot", { name: 'accordionContent' }),
|
|
103
|
+
this.footer && this.showContent &&
|
|
104
|
+
h("div", null, this.deleteTab &&
|
|
105
|
+
h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
|
|
106
|
+
}
|
|
107
|
+
static get is() { return "helper-accordion"; }
|
|
108
|
+
static get encapsulation() { return "shadow"; }
|
|
109
|
+
static get originalStyleUrls() { return {
|
|
110
|
+
"$": ["helper-accordion.scss"]
|
|
111
|
+
}; }
|
|
112
|
+
static get styleUrls() { return {
|
|
113
|
+
"$": ["helper-accordion.css"]
|
|
114
|
+
}; }
|
|
115
|
+
static get properties() { return {
|
|
116
|
+
"ticketHistoryFlag": {
|
|
117
|
+
"type": "boolean",
|
|
118
|
+
"mutable": false,
|
|
119
|
+
"complexType": {
|
|
120
|
+
"original": "boolean",
|
|
121
|
+
"resolved": "boolean",
|
|
122
|
+
"references": {}
|
|
123
|
+
},
|
|
124
|
+
"required": false,
|
|
125
|
+
"optional": false,
|
|
126
|
+
"docs": {
|
|
127
|
+
"tags": [],
|
|
128
|
+
"text": "Flag for ticket history"
|
|
129
|
+
},
|
|
130
|
+
"attribute": "ticket-history-flag",
|
|
131
|
+
"reflect": true,
|
|
132
|
+
"defaultValue": "false"
|
|
133
|
+
},
|
|
134
|
+
"headerTitle": {
|
|
135
|
+
"type": "string",
|
|
136
|
+
"mutable": false,
|
|
137
|
+
"complexType": {
|
|
138
|
+
"original": "string",
|
|
139
|
+
"resolved": "string",
|
|
140
|
+
"references": {}
|
|
141
|
+
},
|
|
142
|
+
"required": false,
|
|
143
|
+
"optional": false,
|
|
144
|
+
"docs": {
|
|
145
|
+
"tags": [],
|
|
146
|
+
"text": "Title (top header)"
|
|
147
|
+
},
|
|
148
|
+
"attribute": "header-title",
|
|
149
|
+
"reflect": true,
|
|
150
|
+
"defaultValue": "''"
|
|
151
|
+
},
|
|
152
|
+
"headerSubtitle": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"mutable": false,
|
|
155
|
+
"complexType": {
|
|
156
|
+
"original": "string",
|
|
157
|
+
"resolved": "string",
|
|
158
|
+
"references": {}
|
|
159
|
+
},
|
|
160
|
+
"required": false,
|
|
161
|
+
"optional": false,
|
|
162
|
+
"docs": {
|
|
163
|
+
"tags": [],
|
|
164
|
+
"text": "SubTitle (top header)"
|
|
165
|
+
},
|
|
166
|
+
"attribute": "header-subtitle",
|
|
167
|
+
"reflect": true,
|
|
168
|
+
"defaultValue": "''"
|
|
169
|
+
},
|
|
170
|
+
"description": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"mutable": false,
|
|
173
|
+
"complexType": {
|
|
174
|
+
"original": "string",
|
|
175
|
+
"resolved": "string",
|
|
176
|
+
"references": {}
|
|
177
|
+
},
|
|
178
|
+
"required": false,
|
|
179
|
+
"optional": false,
|
|
180
|
+
"docs": {
|
|
181
|
+
"tags": [],
|
|
182
|
+
"text": "Description"
|
|
183
|
+
},
|
|
184
|
+
"attribute": "description",
|
|
185
|
+
"reflect": true,
|
|
186
|
+
"defaultValue": "''"
|
|
187
|
+
},
|
|
188
|
+
"footer": {
|
|
189
|
+
"type": "boolean",
|
|
190
|
+
"mutable": false,
|
|
191
|
+
"complexType": {
|
|
192
|
+
"original": "boolean",
|
|
193
|
+
"resolved": "boolean",
|
|
194
|
+
"references": {}
|
|
195
|
+
},
|
|
196
|
+
"required": false,
|
|
197
|
+
"optional": false,
|
|
198
|
+
"docs": {
|
|
199
|
+
"tags": [],
|
|
200
|
+
"text": "Enables footer content"
|
|
201
|
+
},
|
|
202
|
+
"attribute": "footer",
|
|
203
|
+
"reflect": true,
|
|
204
|
+
"defaultValue": "false"
|
|
205
|
+
},
|
|
206
|
+
"deleteTab": {
|
|
207
|
+
"type": "boolean",
|
|
208
|
+
"mutable": false,
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "boolean",
|
|
211
|
+
"resolved": "boolean",
|
|
212
|
+
"references": {}
|
|
213
|
+
},
|
|
214
|
+
"required": false,
|
|
215
|
+
"optional": false,
|
|
216
|
+
"docs": {
|
|
217
|
+
"tags": [],
|
|
218
|
+
"text": "Enables footer button for tab deletion"
|
|
219
|
+
},
|
|
220
|
+
"attribute": "delete-tab",
|
|
221
|
+
"reflect": true,
|
|
222
|
+
"defaultValue": "false"
|
|
223
|
+
},
|
|
224
|
+
"postMessage": {
|
|
225
|
+
"type": "boolean",
|
|
226
|
+
"mutable": false,
|
|
227
|
+
"complexType": {
|
|
228
|
+
"original": "boolean",
|
|
229
|
+
"resolved": "boolean",
|
|
230
|
+
"references": {}
|
|
231
|
+
},
|
|
232
|
+
"required": false,
|
|
233
|
+
"optional": false,
|
|
234
|
+
"docs": {
|
|
235
|
+
"tags": [],
|
|
236
|
+
"text": "Activates postMessages as events for actions from the widget"
|
|
237
|
+
},
|
|
238
|
+
"attribute": "post-message",
|
|
239
|
+
"reflect": true,
|
|
240
|
+
"defaultValue": "false"
|
|
241
|
+
},
|
|
242
|
+
"eventName": {
|
|
243
|
+
"type": "string",
|
|
244
|
+
"mutable": false,
|
|
245
|
+
"complexType": {
|
|
246
|
+
"original": "string",
|
|
247
|
+
"resolved": "string",
|
|
248
|
+
"references": {}
|
|
249
|
+
},
|
|
250
|
+
"required": false,
|
|
251
|
+
"optional": false,
|
|
252
|
+
"docs": {
|
|
253
|
+
"tags": [],
|
|
254
|
+
"text": "Name of the event emitter by the action button"
|
|
255
|
+
},
|
|
256
|
+
"attribute": "event-name",
|
|
257
|
+
"reflect": true,
|
|
258
|
+
"defaultValue": "'helperAccordionAction'"
|
|
259
|
+
},
|
|
260
|
+
"collapsed": {
|
|
261
|
+
"type": "boolean",
|
|
262
|
+
"mutable": false,
|
|
263
|
+
"complexType": {
|
|
264
|
+
"original": "boolean",
|
|
265
|
+
"resolved": "boolean",
|
|
266
|
+
"references": {}
|
|
267
|
+
},
|
|
268
|
+
"required": false,
|
|
269
|
+
"optional": false,
|
|
270
|
+
"docs": {
|
|
271
|
+
"tags": [],
|
|
272
|
+
"text": "Collapsed"
|
|
273
|
+
},
|
|
274
|
+
"attribute": "collapsed",
|
|
275
|
+
"reflect": true,
|
|
276
|
+
"defaultValue": "true"
|
|
277
|
+
},
|
|
278
|
+
"language": {
|
|
279
|
+
"type": "string",
|
|
280
|
+
"mutable": false,
|
|
281
|
+
"complexType": {
|
|
282
|
+
"original": "string",
|
|
283
|
+
"resolved": "string",
|
|
284
|
+
"references": {}
|
|
285
|
+
},
|
|
286
|
+
"required": false,
|
|
287
|
+
"optional": false,
|
|
288
|
+
"docs": {
|
|
289
|
+
"tags": [],
|
|
290
|
+
"text": "Language"
|
|
291
|
+
},
|
|
292
|
+
"attribute": "language",
|
|
293
|
+
"reflect": true,
|
|
294
|
+
"defaultValue": "'en'"
|
|
295
|
+
},
|
|
296
|
+
"clientStyling": {
|
|
297
|
+
"type": "string",
|
|
298
|
+
"mutable": false,
|
|
299
|
+
"complexType": {
|
|
300
|
+
"original": "string",
|
|
301
|
+
"resolved": "string",
|
|
302
|
+
"references": {}
|
|
303
|
+
},
|
|
304
|
+
"required": false,
|
|
305
|
+
"optional": false,
|
|
306
|
+
"docs": {
|
|
307
|
+
"tags": [],
|
|
308
|
+
"text": "Client custom styling via string"
|
|
309
|
+
},
|
|
310
|
+
"attribute": "client-styling",
|
|
311
|
+
"reflect": true,
|
|
312
|
+
"defaultValue": "''"
|
|
313
|
+
},
|
|
314
|
+
"clientStylingUrlContent": {
|
|
315
|
+
"type": "string",
|
|
316
|
+
"mutable": false,
|
|
317
|
+
"complexType": {
|
|
318
|
+
"original": "string",
|
|
319
|
+
"resolved": "string",
|
|
320
|
+
"references": {}
|
|
321
|
+
},
|
|
322
|
+
"required": false,
|
|
323
|
+
"optional": false,
|
|
324
|
+
"docs": {
|
|
325
|
+
"tags": [],
|
|
326
|
+
"text": "Client custom styling via url content"
|
|
327
|
+
},
|
|
328
|
+
"attribute": "client-styling-url-content",
|
|
329
|
+
"reflect": true,
|
|
330
|
+
"defaultValue": "''"
|
|
331
|
+
}
|
|
332
|
+
}; }
|
|
333
|
+
static get states() { return {
|
|
334
|
+
"showContent": {},
|
|
335
|
+
"limitStylingAppends": {}
|
|
336
|
+
}; }
|
|
337
|
+
static get events() { return [{
|
|
338
|
+
"method": "accordionEvent",
|
|
339
|
+
"name": "helperAccordionAction",
|
|
340
|
+
"bubbles": true,
|
|
341
|
+
"cancelable": true,
|
|
342
|
+
"composed": true,
|
|
343
|
+
"docs": {
|
|
344
|
+
"tags": [],
|
|
345
|
+
"text": "Action event"
|
|
346
|
+
},
|
|
347
|
+
"complexType": {
|
|
348
|
+
"original": "any",
|
|
349
|
+
"resolved": "any",
|
|
350
|
+
"references": {}
|
|
351
|
+
}
|
|
352
|
+
}]; }
|
|
353
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'hr'];
|
|
3
|
+
const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
deleteTicket: 'Delete ticket'
|
|
6
|
+
},
|
|
7
|
+
ro: {
|
|
8
|
+
deleteTicket: 'Sterge biletul'
|
|
9
|
+
},
|
|
10
|
+
fr: {
|
|
11
|
+
deleteTicket: 'Supprimer le billet'
|
|
12
|
+
},
|
|
13
|
+
ar: {
|
|
14
|
+
deleteTicket: 'حذف التذكرة'
|
|
15
|
+
},
|
|
16
|
+
hr: {
|
|
17
|
+
deleteTicket: 'Izbriši listić'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export const translate = (key, customLang) => {
|
|
21
|
+
const lang = customLang;
|
|
22
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
23
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface HelperAccordion extends Components.HelperAccordion, HTMLElement {}
|
|
4
|
+
export const HelperAccordion: {
|
|
5
|
+
prototype: HelperAccordion;
|
|
6
|
+
new (): HelperAccordion;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
4
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'hr'];
|
|
5
|
+
const TRANSLATIONS = {
|
|
6
|
+
en: {
|
|
7
|
+
deleteTicket: 'Delete ticket'
|
|
8
|
+
},
|
|
9
|
+
ro: {
|
|
10
|
+
deleteTicket: 'Sterge biletul'
|
|
11
|
+
},
|
|
12
|
+
fr: {
|
|
13
|
+
deleteTicket: 'Supprimer le billet'
|
|
14
|
+
},
|
|
15
|
+
ar: {
|
|
16
|
+
deleteTicket: 'حذف التذكرة'
|
|
17
|
+
},
|
|
18
|
+
hr: {
|
|
19
|
+
deleteTicket: 'Izbriši listić'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const translate = (key, customLang) => {
|
|
23
|
+
const lang = customLang;
|
|
24
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:5px;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:1px;cursor:pointer}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff;text-transform:capitalize}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px;cursor:pointer}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
|
|
28
|
+
|
|
29
|
+
const Accordion = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
this.__registerHost();
|
|
33
|
+
this.__attachShadow();
|
|
34
|
+
this.accordionEvent = createEvent(this, "helperAccordionAction", 7);
|
|
35
|
+
/**
|
|
36
|
+
* Flag for ticket history
|
|
37
|
+
*/
|
|
38
|
+
this.ticketHistoryFlag = false;
|
|
39
|
+
/**
|
|
40
|
+
* Title (top header)
|
|
41
|
+
*/
|
|
42
|
+
this.headerTitle = '';
|
|
43
|
+
/**
|
|
44
|
+
* SubTitle (top header)
|
|
45
|
+
*/
|
|
46
|
+
this.headerSubtitle = '';
|
|
47
|
+
/**
|
|
48
|
+
* Description
|
|
49
|
+
*/
|
|
50
|
+
this.description = '';
|
|
51
|
+
/**
|
|
52
|
+
* Enables footer content
|
|
53
|
+
*/
|
|
54
|
+
this.footer = false;
|
|
55
|
+
/**
|
|
56
|
+
* Enables footer button for tab deletion
|
|
57
|
+
*/
|
|
58
|
+
this.deleteTab = false;
|
|
59
|
+
/**
|
|
60
|
+
* Activates postMessages as events for actions from the widget
|
|
61
|
+
*/
|
|
62
|
+
this.postMessage = false;
|
|
63
|
+
/**
|
|
64
|
+
* Name of the event emitter by the action button
|
|
65
|
+
*/
|
|
66
|
+
this.eventName = 'helperAccordionAction';
|
|
67
|
+
/**
|
|
68
|
+
* Collapsed
|
|
69
|
+
*/
|
|
70
|
+
this.collapsed = true;
|
|
71
|
+
/**
|
|
72
|
+
* Language
|
|
73
|
+
*/
|
|
74
|
+
this.language = 'en';
|
|
75
|
+
/**
|
|
76
|
+
* Client custom styling via string
|
|
77
|
+
*/
|
|
78
|
+
this.clientStyling = '';
|
|
79
|
+
/**
|
|
80
|
+
* Client custom styling via url content
|
|
81
|
+
*/
|
|
82
|
+
this.clientStylingUrlContent = '';
|
|
83
|
+
this.limitStylingAppends = false;
|
|
84
|
+
this.setClientStyling = () => {
|
|
85
|
+
let sheet = document.createElement('style');
|
|
86
|
+
sheet.innerHTML = this.clientStyling;
|
|
87
|
+
this.stylingContainer.prepend(sheet);
|
|
88
|
+
};
|
|
89
|
+
this.setClientStylingURL = () => {
|
|
90
|
+
let cssFile = document.createElement('style');
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
cssFile.innerHTML = this.clientStylingUrlContent;
|
|
93
|
+
this.stylingContainer.prepend(cssFile);
|
|
94
|
+
}, 1);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
// @TODO fix the `any` type :)
|
|
98
|
+
connectedCallback() {
|
|
99
|
+
this.showContent = !this.collapsed;
|
|
100
|
+
}
|
|
101
|
+
componentDidRender() {
|
|
102
|
+
// start custom styling area
|
|
103
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
104
|
+
if (this.clientStyling)
|
|
105
|
+
this.setClientStyling();
|
|
106
|
+
if (this.clientStylingUrlContent)
|
|
107
|
+
this.setClientStylingURL();
|
|
108
|
+
this.limitStylingAppends = true;
|
|
109
|
+
}
|
|
110
|
+
// end custom styling area
|
|
111
|
+
}
|
|
112
|
+
toggleContent() {
|
|
113
|
+
this.showContent = !this.showContent;
|
|
114
|
+
}
|
|
115
|
+
deleteAction() {
|
|
116
|
+
if (this.postMessage) {
|
|
117
|
+
// @TODO maybe change the name type, this one sucks
|
|
118
|
+
window.postMessage({ type: this.eventName }, window.location.href);
|
|
119
|
+
}
|
|
120
|
+
this.accordionEvent.emit();
|
|
121
|
+
}
|
|
122
|
+
render() {
|
|
123
|
+
return (h("div", { class: "Wrapper", ref: el => this.stylingContainer = el }, h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header', onClick: () => this.toggleContent() }, h("p", { class: "Title" }, this.headerTitle), h("p", { class: "Subtitle" }, this.headerSubtitle), h("p", { class: "Subtitle Description" }, this.description), h("span", { class: "Expand" }, this.showContent ? '<' : '>')), this.showContent &&
|
|
124
|
+
h("div", null, h("div", { class: "Content" }, h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
|
|
125
|
+
h("div", null, this.deleteTab &&
|
|
126
|
+
h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
|
|
127
|
+
}
|
|
128
|
+
static get style() { return helperAccordionCss; }
|
|
129
|
+
}, [1, "helper-accordion", {
|
|
130
|
+
"ticketHistoryFlag": [516, "ticket-history-flag"],
|
|
131
|
+
"headerTitle": [513, "header-title"],
|
|
132
|
+
"headerSubtitle": [513, "header-subtitle"],
|
|
133
|
+
"description": [513],
|
|
134
|
+
"footer": [516],
|
|
135
|
+
"deleteTab": [516, "delete-tab"],
|
|
136
|
+
"postMessage": [516, "post-message"],
|
|
137
|
+
"eventName": [513, "event-name"],
|
|
138
|
+
"collapsed": [516],
|
|
139
|
+
"language": [513],
|
|
140
|
+
"clientStyling": [513, "client-styling"],
|
|
141
|
+
"clientStylingUrlContent": [513, "client-styling-url-content"],
|
|
142
|
+
"showContent": [32],
|
|
143
|
+
"limitStylingAppends": [32]
|
|
144
|
+
}]);
|
|
145
|
+
function defineCustomElement$1() {
|
|
146
|
+
if (typeof customElements === "undefined") {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const components = ["helper-accordion"];
|
|
150
|
+
components.forEach(tagName => { switch (tagName) {
|
|
151
|
+
case "helper-accordion":
|
|
152
|
+
if (!customElements.get(tagName)) {
|
|
153
|
+
customElements.define(tagName, Accordion);
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
} });
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const HelperAccordion = Accordion;
|
|
160
|
+
const defineCustomElement = defineCustomElement$1;
|
|
161
|
+
|
|
162
|
+
export { HelperAccordion, defineCustomElement };
|