@mgdis/mg-components 4.1.0 → 4.2.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/{index-88560a66.js → index-64cee0c8.js} +248 -81
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{mg-badge_24.cjs.entry.js → mg-badge_23.cjs.entry.js} +206 -2180
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-modal.cjs.entry.js +8 -1
- package/dist/cjs/mg-popover.cjs.entry.js +171 -0
- package/dist/cjs/popper-71bf3058.js +1790 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +116 -99
- package/dist/collection/components/atoms/mg-button/mg-button.js +221 -220
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +72 -69
- package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +1 -2
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +102 -92
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +83 -67
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +64 -55
- package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +3 -6
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +120 -106
- package/dist/collection/components/molecules/inputs/MgInput.js +8 -17
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +323 -318
- package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +3 -2
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +356 -361
- package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +1 -2
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +462 -456
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +347 -340
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +348 -343
- package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +406 -401
- package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +12 -15
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +2 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +476 -473
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +461 -456
- package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +2 -8
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +299 -298
- package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +1 -3
- package/dist/collection/components/molecules/mg-details/mg-details.js +95 -93
- package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +13 -27
- package/dist/collection/components/molecules/mg-form/mg-form.js +175 -166
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +2 -6
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +37 -37
- package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +1 -3
- package/dist/collection/components/molecules/mg-message/mg-message.js +154 -153
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +11 -15
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +147 -134
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +5 -6
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +112 -117
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +1 -8
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +192 -189
- package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +1 -4
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +129 -127
- package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +1 -5
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +1 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +150 -135
- package/dist/collection/fonts/OpenSans-Bold.ttf +0 -0
- package/dist/collection/locales/en/messages.json +50 -0
- package/dist/collection/locales/fr/messages.json +50 -0
- package/dist/collection/stories/grids.stories.js +1 -44
- package/dist/collection/stories/helpers.stories.js +1 -19
- package/dist/collection/stories/icons.stories.js +1 -4
- package/dist/collection/stories/typography.stories.js +1 -12
- package/dist/collection/variables.css +3 -2
- package/dist/collection/variables.scss +3 -2
- package/dist/components/MgInput.js +6 -3
- package/dist/components/mg-badge2.js +7 -0
- package/dist/components/mg-button2.js +2 -7
- package/dist/components/mg-input-checkbox.js +1 -6
- package/dist/components/mg-input-date.js +10 -27
- package/dist/components/mg-input-numeric.js +1 -6
- package/dist/components/mg-input-password.js +1 -6
- package/dist/components/mg-input-radio.js +1 -6
- package/dist/components/mg-input-select2.js +1 -6
- package/dist/components/mg-input-text2.js +3 -8
- package/dist/components/mg-input-textarea.js +2 -7
- package/dist/components/mg-input-title2.js +9 -0
- package/dist/components/mg-input-toggle.js +2 -7
- package/dist/components/mg-modal.js +7 -0
- package/dist/components/mg-pagination.js +3 -3
- package/dist/components/mg-panel.js +8 -4
- package/dist/components/mg-tabs.js +8 -1
- package/dist/components/mg-tooltip2.js +7 -0
- package/dist/esm/{index-bca81100.js → index-120f47fd.js} +248 -81
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{mg-badge_24.entry.js → mg-badge_23.entry.js} +207 -2180
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-modal.entry.js +8 -1
- package/dist/esm/mg-popover.entry.js +167 -0
- package/dist/esm/popper-93ecb064.js +1788 -0
- package/dist/mg-components/fonts/OpenSans-Bold.ttf +0 -0
- package/dist/mg-components/locales/en/messages.json +50 -0
- package/dist/mg-components/locales/fr/messages.json +50 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-21991be8.entry.js +1 -0
- package/dist/mg-components/p-36a64f8c.entry.js +1 -0
- package/dist/mg-components/p-4c66f794.js +1 -0
- package/dist/mg-components/{p-b14a3443.js → p-7bc32a2f.js} +0 -0
- package/dist/mg-components/p-b380a0df.entry.js +1 -0
- package/dist/mg-components/variables.css +3 -2
- package/dist/mg-components/variables.scss +3 -2
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +0 -1
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +1 -10
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +0 -1
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +1 -1
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +1 -0
- package/dist/types/components.d.ts +29 -29
- package/loader/package.json +1 -0
- package/package.json +8 -8
- package/dist/collection/fonts/Poppins-Bold.ttf +0 -0
- package/dist/mg-components/fonts/Poppins-Bold.ttf +0 -0
- package/dist/mg-components/p-a2883dc7.entry.js +0 -1
- package/dist/mg-components/p-cffe0519.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
2
|
import { createID, ClassList } from '../../../utils/components.utils';
|
|
3
3
|
import { initLocales } from '../../../locales';
|
|
4
4
|
export class MgModal {
|
|
@@ -48,6 +48,11 @@ export class MgModal {
|
|
|
48
48
|
this.hide = true;
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
+
validateModalTitle(newValue) {
|
|
52
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
53
|
+
throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
51
56
|
validateHide(newValue) {
|
|
52
57
|
if (newValue) {
|
|
53
58
|
this.componentHide.emit();
|
|
@@ -88,6 +93,7 @@ export class MgModal {
|
|
|
88
93
|
this.closeButtonId = `${this.identifier}-close-button`;
|
|
89
94
|
}
|
|
90
95
|
this.titleId = `${this.identifier}-title`;
|
|
96
|
+
this.validateModalTitle(this.modalTitle);
|
|
91
97
|
this.validateHide(this.hide);
|
|
92
98
|
}
|
|
93
99
|
/**
|
|
@@ -96,145 +102,152 @@ export class MgModal {
|
|
|
96
102
|
* @returns {HTMLElement} HTML Element
|
|
97
103
|
*/
|
|
98
104
|
render() {
|
|
99
|
-
return (h("section", { role: "dialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide },
|
|
100
|
-
h("article", { class: "mg-modal__dialog" },
|
|
101
|
-
h("header", { class: "mg-modal__header" },
|
|
102
|
-
this.closeButton && (h("span", { class: "mg-modal__close-button" },
|
|
103
|
-
h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose },
|
|
104
|
-
h("mg-icon", { icon: "cross" })))),
|
|
105
|
-
h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)),
|
|
106
|
-
this.hasContent && (h("article", { class: "mg-modal__content" },
|
|
107
|
-
h("slot", { name: "content" }))),
|
|
108
|
-
this.hasActions && (h("footer", { class: "mg-modal__footer" },
|
|
109
|
-
h("slot", { name: "actions" }))))));
|
|
105
|
+
return (h("section", { role: "dialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("article", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" }))))));
|
|
110
106
|
}
|
|
111
107
|
static get is() { return "mg-modal"; }
|
|
112
108
|
static get encapsulation() { return "shadow"; }
|
|
113
|
-
static get originalStyleUrls() {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
"original": "string",
|
|
143
|
-
"resolved": "string",
|
|
144
|
-
"references": {}
|
|
145
|
-
},
|
|
146
|
-
"required": true,
|
|
147
|
-
"optional": false,
|
|
148
|
-
"docs": {
|
|
149
|
-
"tags": [],
|
|
150
|
-
"text": "Displayed modal title\nrequired"
|
|
151
|
-
},
|
|
152
|
-
"attribute": "modal-title",
|
|
153
|
-
"reflect": false
|
|
154
|
-
},
|
|
155
|
-
"closeButton": {
|
|
156
|
-
"type": "boolean",
|
|
157
|
-
"mutable": true,
|
|
158
|
-
"complexType": {
|
|
159
|
-
"original": "boolean",
|
|
160
|
-
"resolved": "boolean",
|
|
161
|
-
"references": {}
|
|
162
|
-
},
|
|
163
|
-
"required": false,
|
|
164
|
-
"optional": false,
|
|
165
|
-
"docs": {
|
|
166
|
-
"tags": [],
|
|
167
|
-
"text": "Define if modal has a cross button"
|
|
168
|
-
},
|
|
169
|
-
"attribute": "close-button",
|
|
170
|
-
"reflect": false,
|
|
171
|
-
"defaultValue": "false"
|
|
172
|
-
},
|
|
173
|
-
"hide": {
|
|
174
|
-
"type": "boolean",
|
|
175
|
-
"mutable": true,
|
|
176
|
-
"complexType": {
|
|
177
|
-
"original": "boolean",
|
|
178
|
-
"resolved": "boolean",
|
|
179
|
-
"references": {}
|
|
180
|
-
},
|
|
181
|
-
"required": false,
|
|
182
|
-
"optional": false,
|
|
183
|
-
"docs": {
|
|
184
|
-
"tags": [],
|
|
185
|
-
"text": "Define if modal is hidden"
|
|
109
|
+
static get originalStyleUrls() {
|
|
110
|
+
return {
|
|
111
|
+
"$": ["mg-modal.scss"]
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
static get styleUrls() {
|
|
115
|
+
return {
|
|
116
|
+
"$": ["mg-modal.css"]
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
static get properties() {
|
|
120
|
+
return {
|
|
121
|
+
"identifier": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"mutable": false,
|
|
124
|
+
"complexType": {
|
|
125
|
+
"original": "string",
|
|
126
|
+
"resolved": "string",
|
|
127
|
+
"references": {}
|
|
128
|
+
},
|
|
129
|
+
"required": false,
|
|
130
|
+
"optional": false,
|
|
131
|
+
"docs": {
|
|
132
|
+
"tags": [],
|
|
133
|
+
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)\nIf not set, it will be created."
|
|
134
|
+
},
|
|
135
|
+
"attribute": "identifier",
|
|
136
|
+
"reflect": false,
|
|
137
|
+
"defaultValue": "createID('mg-modal')"
|
|
186
138
|
},
|
|
187
|
-
"
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
"docs": {
|
|
204
|
-
"tags": [],
|
|
205
|
-
"text": "Emmited event when modal is diplayed"
|
|
139
|
+
"modalTitle": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"mutable": false,
|
|
142
|
+
"complexType": {
|
|
143
|
+
"original": "string",
|
|
144
|
+
"resolved": "string",
|
|
145
|
+
"references": {}
|
|
146
|
+
},
|
|
147
|
+
"required": true,
|
|
148
|
+
"optional": false,
|
|
149
|
+
"docs": {
|
|
150
|
+
"tags": [],
|
|
151
|
+
"text": "Displayed modal title\nrequired"
|
|
152
|
+
},
|
|
153
|
+
"attribute": "modal-title",
|
|
154
|
+
"reflect": false
|
|
206
155
|
},
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
156
|
+
"closeButton": {
|
|
157
|
+
"type": "boolean",
|
|
158
|
+
"mutable": true,
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "boolean",
|
|
161
|
+
"resolved": "boolean",
|
|
162
|
+
"references": {}
|
|
163
|
+
},
|
|
164
|
+
"required": false,
|
|
165
|
+
"optional": false,
|
|
166
|
+
"docs": {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": "Define if modal has a cross button"
|
|
169
|
+
},
|
|
170
|
+
"attribute": "close-button",
|
|
171
|
+
"reflect": false,
|
|
172
|
+
"defaultValue": "false"
|
|
221
173
|
},
|
|
222
|
-
"
|
|
223
|
-
"
|
|
224
|
-
"
|
|
225
|
-
"
|
|
174
|
+
"hide": {
|
|
175
|
+
"type": "boolean",
|
|
176
|
+
"mutable": true,
|
|
177
|
+
"complexType": {
|
|
178
|
+
"original": "boolean",
|
|
179
|
+
"resolved": "boolean",
|
|
180
|
+
"references": {}
|
|
181
|
+
},
|
|
182
|
+
"required": false,
|
|
183
|
+
"optional": false,
|
|
184
|
+
"docs": {
|
|
185
|
+
"tags": [],
|
|
186
|
+
"text": "Define if modal is hidden"
|
|
187
|
+
},
|
|
188
|
+
"attribute": "hide",
|
|
189
|
+
"reflect": false,
|
|
190
|
+
"defaultValue": "false"
|
|
226
191
|
}
|
|
227
|
-
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
static get states() {
|
|
195
|
+
return {
|
|
196
|
+
"hasActions": {},
|
|
197
|
+
"hasContent": {},
|
|
198
|
+
"classList": {}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
static get events() {
|
|
202
|
+
return [{
|
|
203
|
+
"method": "componentShow",
|
|
204
|
+
"name": "component-show",
|
|
205
|
+
"bubbles": true,
|
|
206
|
+
"cancelable": true,
|
|
207
|
+
"composed": true,
|
|
208
|
+
"docs": {
|
|
209
|
+
"tags": [],
|
|
210
|
+
"text": "Emmited event when modal is diplayed"
|
|
211
|
+
},
|
|
212
|
+
"complexType": {
|
|
213
|
+
"original": "string",
|
|
214
|
+
"resolved": "string",
|
|
215
|
+
"references": {}
|
|
216
|
+
}
|
|
217
|
+
}, {
|
|
218
|
+
"method": "componentHide",
|
|
219
|
+
"name": "component-hide",
|
|
220
|
+
"bubbles": true,
|
|
221
|
+
"cancelable": true,
|
|
222
|
+
"composed": true,
|
|
223
|
+
"docs": {
|
|
224
|
+
"tags": [],
|
|
225
|
+
"text": "Emmited event when modal is hidden"
|
|
226
|
+
},
|
|
227
|
+
"complexType": {
|
|
228
|
+
"original": "string",
|
|
229
|
+
"resolved": "string",
|
|
230
|
+
"references": {}
|
|
231
|
+
}
|
|
232
|
+
}];
|
|
233
|
+
}
|
|
228
234
|
static get elementRef() { return "element"; }
|
|
229
|
-
static get watchers() {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
static get watchers() {
|
|
236
|
+
return [{
|
|
237
|
+
"propName": "modalTitle",
|
|
238
|
+
"methodName": "validateModalTitle"
|
|
239
|
+
}, {
|
|
240
|
+
"propName": "hide",
|
|
241
|
+
"methodName": "validateHide"
|
|
242
|
+
}];
|
|
243
|
+
}
|
|
244
|
+
static get listeners() {
|
|
245
|
+
return [{
|
|
246
|
+
"name": "keydown",
|
|
247
|
+
"method": "handleKeyDown",
|
|
248
|
+
"target": "window",
|
|
249
|
+
"capture": false,
|
|
250
|
+
"passive": false
|
|
251
|
+
}];
|
|
252
|
+
}
|
|
240
253
|
}
|
|
@@ -19,21 +19,20 @@
|
|
|
19
19
|
outline: none;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.mg-
|
|
22
|
+
.mg-pagination {
|
|
23
23
|
display: flex;
|
|
24
24
|
align-items: center;
|
|
25
25
|
flex-direction: row;
|
|
26
26
|
}
|
|
27
|
-
.mg-
|
|
27
|
+
.mg-pagination mg-input-select {
|
|
28
28
|
margin-right: 0.5rem;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
.mg-pagination__button {
|
|
30
|
+
.mg-pagination mg-button {
|
|
32
31
|
display: flex;
|
|
33
32
|
}
|
|
34
|
-
.mg-
|
|
33
|
+
.mg-pagination mg-button:first-of-type {
|
|
35
34
|
margin-right: 1rem;
|
|
36
35
|
}
|
|
37
|
-
.mg-
|
|
36
|
+
.mg-pagination mg-button:last-of-type {
|
|
38
37
|
margin-left: 1rem;
|
|
39
38
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
2
|
import { createID } from '../../../utils/components.utils';
|
|
3
3
|
import { NavigationAction } from './mg-pagination.conf';
|
|
4
4
|
import { initLocales } from './../../../locales';
|
|
@@ -109,129 +109,124 @@ export class MgPagination {
|
|
|
109
109
|
* @returns {HTMLElement} HTML Element
|
|
110
110
|
*/
|
|
111
111
|
render() {
|
|
112
|
-
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`,
|
|
112
|
+
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
113
113
|
// eslint-disable-next-line react/jsx-no-bind
|
|
114
|
-
onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" },
|
|
115
|
-
|
|
116
|
-
this.messages.general[action],
|
|
117
|
-
action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
118
|
-
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination__nav" },
|
|
119
|
-
navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS),
|
|
120
|
-
h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }),
|
|
121
|
-
h("span", { class: "sr-only" },
|
|
122
|
-
this.messages.pagination.page,
|
|
123
|
-
" ",
|
|
124
|
-
this.currentPage),
|
|
125
|
-
h("span", null,
|
|
126
|
-
"/ ",
|
|
127
|
-
this.totalPages,
|
|
128
|
-
" ",
|
|
129
|
-
this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page),
|
|
130
|
-
navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
114
|
+
onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
115
|
+
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
131
116
|
}
|
|
132
117
|
static get is() { return "mg-pagination"; }
|
|
133
118
|
static get encapsulation() { return "shadow"; }
|
|
134
|
-
static get originalStyleUrls() {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
"
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
"original": "string",
|
|
164
|
-
"resolved": "string",
|
|
165
|
-
"references": {}
|
|
166
|
-
},
|
|
167
|
-
"required": false,
|
|
168
|
-
"optional": false,
|
|
169
|
-
"docs": {
|
|
170
|
-
"tags": [],
|
|
171
|
-
"text": "Panignation label. Is a short description.\nCustomize default value can be usefull to improve accessibility"
|
|
172
|
-
},
|
|
173
|
-
"attribute": "label",
|
|
174
|
-
"reflect": false
|
|
175
|
-
},
|
|
176
|
-
"totalPages": {
|
|
177
|
-
"type": "number",
|
|
178
|
-
"mutable": false,
|
|
179
|
-
"complexType": {
|
|
180
|
-
"original": "number",
|
|
181
|
-
"resolved": "number",
|
|
182
|
-
"references": {}
|
|
183
|
-
},
|
|
184
|
-
"required": false,
|
|
185
|
-
"optional": false,
|
|
186
|
-
"docs": {
|
|
187
|
-
"tags": [],
|
|
188
|
-
"text": "Component total pages"
|
|
189
|
-
},
|
|
190
|
-
"attribute": "total-pages",
|
|
191
|
-
"reflect": false,
|
|
192
|
-
"defaultValue": "1"
|
|
193
|
-
},
|
|
194
|
-
"currentPage": {
|
|
195
|
-
"type": "number",
|
|
196
|
-
"mutable": true,
|
|
197
|
-
"complexType": {
|
|
198
|
-
"original": "number",
|
|
199
|
-
"resolved": "number",
|
|
200
|
-
"references": {}
|
|
119
|
+
static get originalStyleUrls() {
|
|
120
|
+
return {
|
|
121
|
+
"$": ["mg-pagination.scss"]
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
static get styleUrls() {
|
|
125
|
+
return {
|
|
126
|
+
"$": ["mg-pagination.css"]
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
static get properties() {
|
|
130
|
+
return {
|
|
131
|
+
"identifier": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"mutable": false,
|
|
134
|
+
"complexType": {
|
|
135
|
+
"original": "string",
|
|
136
|
+
"resolved": "string",
|
|
137
|
+
"references": {}
|
|
138
|
+
},
|
|
139
|
+
"required": false,
|
|
140
|
+
"optional": false,
|
|
141
|
+
"docs": {
|
|
142
|
+
"tags": [],
|
|
143
|
+
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)\nIf not set, it will be created."
|
|
144
|
+
},
|
|
145
|
+
"attribute": "identifier",
|
|
146
|
+
"reflect": false,
|
|
147
|
+
"defaultValue": "createID('mg-pagination')"
|
|
201
148
|
},
|
|
202
|
-
"
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
"
|
|
206
|
-
|
|
149
|
+
"label": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"mutable": true,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "string",
|
|
154
|
+
"resolved": "string",
|
|
155
|
+
"references": {}
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"optional": false,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": "Panignation label. Is a short description.\nCustomize default value can be usefull to improve accessibility"
|
|
162
|
+
},
|
|
163
|
+
"attribute": "label",
|
|
164
|
+
"reflect": false
|
|
207
165
|
},
|
|
208
|
-
"
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
166
|
+
"totalPages": {
|
|
167
|
+
"type": "number",
|
|
168
|
+
"mutable": false,
|
|
169
|
+
"complexType": {
|
|
170
|
+
"original": "number",
|
|
171
|
+
"resolved": "number",
|
|
172
|
+
"references": {}
|
|
173
|
+
},
|
|
174
|
+
"required": false,
|
|
175
|
+
"optional": false,
|
|
176
|
+
"docs": {
|
|
177
|
+
"tags": [],
|
|
178
|
+
"text": "Component total pages"
|
|
179
|
+
},
|
|
180
|
+
"attribute": "total-pages",
|
|
181
|
+
"reflect": false,
|
|
182
|
+
"defaultValue": "1"
|
|
222
183
|
},
|
|
223
|
-
"
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"
|
|
184
|
+
"currentPage": {
|
|
185
|
+
"type": "number",
|
|
186
|
+
"mutable": true,
|
|
187
|
+
"complexType": {
|
|
188
|
+
"original": "number",
|
|
189
|
+
"resolved": "number",
|
|
190
|
+
"references": {}
|
|
191
|
+
},
|
|
192
|
+
"required": false,
|
|
193
|
+
"optional": false,
|
|
194
|
+
"docs": {
|
|
195
|
+
"tags": [],
|
|
196
|
+
"text": "Component current page"
|
|
197
|
+
},
|
|
198
|
+
"attribute": "current-page",
|
|
199
|
+
"reflect": true,
|
|
200
|
+
"defaultValue": "1"
|
|
227
201
|
}
|
|
228
|
-
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
static get events() {
|
|
205
|
+
return [{
|
|
206
|
+
"method": "currentPageChange",
|
|
207
|
+
"name": "current-page-change",
|
|
208
|
+
"bubbles": true,
|
|
209
|
+
"cancelable": true,
|
|
210
|
+
"composed": true,
|
|
211
|
+
"docs": {
|
|
212
|
+
"tags": [],
|
|
213
|
+
"text": "Emmited event when current page change"
|
|
214
|
+
},
|
|
215
|
+
"complexType": {
|
|
216
|
+
"original": "number",
|
|
217
|
+
"resolved": "number",
|
|
218
|
+
"references": {}
|
|
219
|
+
}
|
|
220
|
+
}];
|
|
221
|
+
}
|
|
229
222
|
static get elementRef() { return "element"; }
|
|
230
|
-
static get watchers() {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
223
|
+
static get watchers() {
|
|
224
|
+
return [{
|
|
225
|
+
"propName": "totalPages",
|
|
226
|
+
"methodName": "validateTotalPages"
|
|
227
|
+
}, {
|
|
228
|
+
"propName": "currentPage",
|
|
229
|
+
"methodName": "validateCurrentPage"
|
|
230
|
+
}];
|
|
231
|
+
}
|
|
237
232
|
}
|
|
@@ -12,14 +12,7 @@ export default {
|
|
|
12
12
|
* @returns {HTMLElement} HTMLElement
|
|
13
13
|
*/
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
const Template = (args) => (h("mg-panel", Object.assign({}, filterArgs(args)),
|
|
16
|
-
h("div", null, "Content"),
|
|
17
|
-
h("div", { slot: "header-right" },
|
|
18
|
-
h("mg-button", { variant: "secondary" },
|
|
19
|
-
h("mg-icon", { icon: "file-upload" }),
|
|
20
|
-
" Upload"),
|
|
21
|
-
h("mg-button", Object.assign({}, filterArgs({ isIcon: true }), { variant: "secondary", label: "delete" }),
|
|
22
|
-
h("mg-icon", { icon: "trash" })))));
|
|
15
|
+
const Template = (args) => (h("mg-panel", Object.assign({}, filterArgs(args)), h("div", null, "Content"), h("div", { slot: "header-right" }, h("mg-button", { variant: "secondary" }, h("mg-icon", { icon: "file-upload" }), " Upload"), h("mg-button", Object.assign({}, filterArgs({ isIcon: true }), { variant: "secondary", label: "delete" }), h("mg-icon", { icon: "trash" })))));
|
|
23
16
|
export const MgPanel = Template.bind({});
|
|
24
17
|
MgPanel.args = {
|
|
25
18
|
panelTitle: 'title',
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
.mg-panel__header-left mg-button:not([slot=append-input]) > *:first-of-type {
|
|
37
37
|
font-family: var(--font-family-heading);
|
|
38
38
|
font-size: 1.4rem;
|
|
39
|
-
font-weight:
|
|
39
|
+
font-weight: 600;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.mg-panel__content {
|
|
43
|
-
padding:
|
|
43
|
+
padding: var(--mg-panel-content-padding);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.mg-panel ::slotted([slot=header-right]) {
|