@mgdis/mg-components 6.19.0 → 6.21.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-Bp6wZzau.js → index-C2viYwrR.js} +1757 -80
- package/dist/cjs/{index-TUElr4Wv.js → index-CCsGMNyq.js} +46 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +735 -337
- package/dist/cjs/mg-alert.cjs.entry.js +17 -9
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-fieldset.cjs.entry.js +24 -7
- package/dist/cjs/mg-input-combobox.cjs.entry.js +63 -29
- package/dist/cjs/mg-input-file.cjs.entry.js +384 -0
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +30 -18
- package/dist/cjs/{mg-input.conf-D7jmj_lh.js → mg-input.conf-BNpeATnq.js} +7 -0
- package/dist/cjs/mg-loader.cjs.entry.js +8 -6
- package/dist/cjs/mg-progress.cjs.entry.js +19 -9
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +6 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +15 -11
- package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +877 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +12 -12
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +72 -84
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +12 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +12 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/collection/locales/en/messages.json +11 -0
- package/dist/collection/locales/fr/messages.json +11 -0
- package/dist/components/events.utils.js +1 -23
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -408
- package/dist/components/index3.js +1 -476
- package/dist/components/mg-action-more.js +1 -254
- package/dist/components/mg-alert.js +1 -224
- package/dist/components/mg-badge.js +1 -6
- package/dist/components/mg-badge2.js +1 -113
- package/dist/components/mg-button.js +1 -6
- package/dist/components/mg-button2.js +1 -275
- package/dist/components/mg-card.js +1 -6
- package/dist/components/mg-card2.js +1 -92
- package/dist/components/mg-character-left.js +1 -6
- package/dist/components/mg-character-left2.js +1 -75
- package/dist/components/mg-details.js +1 -104
- package/dist/components/mg-divider.js +1 -6
- package/dist/components/mg-divider2.js +1 -49
- package/dist/components/mg-fieldset.js +1 -209
- package/dist/components/mg-form.js +1 -302
- package/dist/components/mg-icon.js +1 -6
- package/dist/components/mg-icon2.js +1 -188
- package/dist/components/mg-illustrated-message.js +1 -129
- package/dist/components/mg-input-checkbox-paginated.js +1 -6
- package/dist/components/mg-input-checkbox-paginated2.js +1 -135
- package/dist/components/mg-input-checkbox.js +1 -762
- package/dist/components/mg-input-combobox.js +1 -936
- package/dist/components/mg-input-date.js +1 -463
- package/dist/components/mg-input-file.d.ts +11 -0
- package/dist/components/mg-input-file.js +1 -0
- package/dist/components/mg-input-numeric.js +1 -592
- package/dist/components/mg-input-password.js +1 -360
- package/dist/components/mg-input-radio.js +1 -392
- package/dist/components/mg-input-rich-text-editor.js +1 -16797
- package/dist/components/mg-input-select.js +1 -6
- package/dist/components/mg-input-select2.js +1 -481
- package/dist/components/mg-input-text.js +1 -6
- package/dist/components/mg-input-text2.js +1 -514
- package/dist/components/mg-input-textarea.js +1 -412
- package/dist/components/mg-input-title.js +1 -6
- package/dist/components/mg-input-title2.js +1 -81
- package/dist/components/mg-input-toggle.js +1 -386
- package/dist/components/mg-input.conf.js +1 -0
- package/dist/components/mg-input.js +1 -6
- package/dist/components/mg-input2.js +1 -459
- package/dist/components/mg-item-more.js +1 -6
- package/dist/components/mg-item-more2.js +1 -505
- package/dist/components/mg-loader.js +1 -6
- package/dist/components/mg-loader2.js +1 -74
- package/dist/components/mg-menu-item.js +1 -6
- package/dist/components/mg-menu-item2.js +1 -485
- package/dist/components/mg-menu.js +1 -6
- package/dist/components/mg-message.js +1 -6
- package/dist/components/mg-message2.js +1 -146
- package/dist/components/mg-modal.js +1 -184
- package/dist/components/mg-pagination.js +1 -234
- package/dist/components/mg-panel.js +1 -350
- package/dist/components/mg-popover-content.js +1 -6
- package/dist/components/mg-popover-content2.js +1 -96
- package/dist/components/mg-popover.js +1 -6
- package/dist/components/mg-popover2.js +1 -312
- package/dist/components/mg-progress.js +1 -123
- package/dist/components/mg-skip-links.js +1 -78
- package/dist/components/mg-table.js +1 -319
- package/dist/components/mg-tabs.js +1 -6
- package/dist/components/mg-tabs2.js +1 -315
- package/dist/components/mg-tag.js +1 -133
- package/dist/components/mg-tooltip-content.js +1 -6
- package/dist/components/mg-tooltip-content2.js +1 -42
- package/dist/components/mg-tooltip.js +1 -6
- package/dist/components/mg-tooltip2.js +1 -421
- package/dist/components/popper.js +1 -1790
- package/dist/esm/{index-CNX6lq0x.js → index-D-uaxCxH.js} +46 -1
- package/dist/esm/{index-BluNKQ3L.js → index-DFwaH2hS.js} +1757 -80
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +735 -337
- package/dist/esm/mg-alert.entry.js +17 -9
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-fieldset.entry.js +24 -7
- package/dist/esm/mg-input-combobox.entry.js +63 -29
- package/dist/esm/mg-input-file.entry.js +382 -0
- package/dist/esm/mg-input-rich-text-editor.entry.js +30 -18
- package/dist/esm/{mg-input.conf-DDnrE1hD.js → mg-input.conf-C9rmNQIL.js} +7 -1
- package/dist/esm/mg-loader.entry.js +8 -6
- package/dist/esm/mg-progress.entry.js +19 -9
- package/dist/mg-components/locales/en/messages.json +11 -0
- package/dist/mg-components/locales/fr/messages.json +11 -0
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-d5a276eb.entry.js → p-08fa327b.entry.js} +1 -1
- package/dist/mg-components/p-4175dcbe.entry.js +1 -0
- package/dist/mg-components/p-6b57f249.entry.js +1 -0
- package/dist/mg-components/p-6b655830.entry.js +1 -0
- package/dist/mg-components/p-988c282e.entry.js +1 -0
- package/dist/mg-components/p-C9rmNQIL.js +1 -0
- package/dist/mg-components/p-D-uaxCxH.js +1 -0
- package/dist/mg-components/p-DFwaH2hS.js +2 -0
- package/dist/mg-components/p-a79b1f19.entry.js +1 -0
- package/dist/mg-components/{p-916dfb6d.entry.js → p-c3d116b9.entry.js} +1 -1
- package/dist/mg-components/p-dd1934f4.entry.js +1 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +7 -1
- package/dist/types/components/molecules/inputs/mg-input-file/mg-input-file.d.ts +210 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -4
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +13 -16
- package/dist/types/components.d.ts +217 -18
- package/dist/types/stencil-public-runtime.d.ts +76 -12
- package/ide/intellij/web-types.json +373 -26
- package/ide/vscode/css-custom-data.json +12 -0
- package/ide/vscode/html-custom-data.json +341 -79
- package/package.json +22 -22
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.js +0 -1
- package/dist/mg-components/p-016bd291.entry.js +0 -1
- package/dist/mg-components/p-186a6139.entry.js +0 -1
- package/dist/mg-components/p-66a1cb83.entry.js +0 -1
- package/dist/mg-components/p-6efd819f.entry.js +0 -1
- package/dist/mg-components/p-BluNKQ3L.js +0 -2
- package/dist/mg-components/p-CNX6lq0x.js +0 -1
- package/dist/mg-components/p-DDnrE1hD.js +0 -1
- package/dist/mg-components/p-d2c72f09.entry.js +0 -1
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +0 -8
|
@@ -29,7 +29,7 @@ export class MgLoader {
|
|
|
29
29
|
* @returns HTML Element
|
|
30
30
|
*/
|
|
31
31
|
render() {
|
|
32
|
-
return (h("div", { key: '
|
|
32
|
+
return (h("div", { key: 'ad7aa5e4fa0704cf2fa174ae1ed960f72deb79e3', class: "mg-c-loader", "aria-live": "polite" }, h("mg-icon", { key: '47e6df1e459a74851bf370e460438b7bdc2ed3d0', icon: "loader", spin: true }), h("span", { key: '44d36e8492401cacb911f21fc707c1de03ae7a5d', class: { 'mg-u-visually-hidden': this.messageHide } }, this.message || this.messages.loader.inProgress)));
|
|
33
33
|
}
|
|
34
34
|
static get is() { return "mg-loader"; }
|
|
35
35
|
static get encapsulation() { return "shadow"; }
|
|
@@ -86,9 +86,9 @@ export class MgMessage {
|
|
|
86
86
|
* @returns HTML Element
|
|
87
87
|
*/
|
|
88
88
|
render() {
|
|
89
|
-
return (h("div", { key: '
|
|
89
|
+
return (h("div", { key: '9619c3fe51c76045c7c2ac7be24d71f317749f3d', class: this.classCollection.join() }, h("mg-card", { key: '270c8b9b0479a1762fb0b180b99bab8fcf92be40', shadow: true }, this.variantStyle === 'bar-left' && h("span", { key: '8d568740eb1a579cc8e3b447aa1df27691fd3473', class: "mg-c-message__bar" }), h("span", { key: '96bbd399ce78b312755f238d68f46c4c633b898a', class: "mg-c-message__icon" }, h("mg-icon", { key: 'ebaa2fd3d7d60ae8f9864afdb6fd0fa79e7b1d40', icon: this.getIcon() })), h("div", { key: '8ff7552abb158fa9787f8501b2068254455b8cbb', class: "mg-c-message__content" }, h("span", { key: '1af60ee247054d5ce5ae1d8bf0a33503cdebf857', class: "mg-c-message__content-slot" }, h("slot", { key: 'd35b2cca2ac8231e257972bb1251f318c10e6e2f' })), this.hasActions && [
|
|
90
90
|
h("span", { class: "mg-c-message__content-separator", key: "content-separator" }),
|
|
91
|
-
h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '
|
|
91
|
+
h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '90a115e7e49ea5058da58d096184151f7aa7b7d8', name: "actions" })),
|
|
92
92
|
]))));
|
|
93
93
|
}
|
|
94
94
|
static get is() { return "mg-message"; }
|
|
@@ -106,11 +106,11 @@ export class MgModal {
|
|
|
106
106
|
* @returns HTML Element
|
|
107
107
|
*/
|
|
108
108
|
render() {
|
|
109
|
-
return (h("dialog", { key: '
|
|
109
|
+
return (h("dialog", { key: 'e104352d5cdb04886d4db6bac62ecb772c6df004', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
|
|
110
110
|
if (el !== null) {
|
|
111
111
|
this.dialog = el;
|
|
112
112
|
}
|
|
113
|
-
} }, h("mg-card", { key: '
|
|
113
|
+
} }, h("mg-card", { key: 'd69679cb9118dfe4b141c1dcf6d1ef0fd53d9df9', shadow: true }, h("div", { key: '29e0a092a73d4e05c300c0840191823d3e3bbd30', class: "mg-c-modal__dialog" }, h("header", { key: 'c3a595adc778b67e5cafbbb964741ebc56c2dba5', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: 'f19447c5c29ae4fdaa46c2e35629622091b172d6', class: "mg-c-modal__close-button" }, h("mg-button", { key: 'af85956cc5e16e2c8c05156a4f54f63ad35b913a', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { key: 'fd6aa0394f8b39bacd50e7b087f1b155c38e1bc9', icon: "cross" })))), h("h1", { key: '0e80bdf6182c01257f487741661754a1224b802d', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: 'c23c02cc9046545b4b851ce640ed8409fa190511', class: "mg-c-modal__content" }, h("slot", { key: 'db7c708e38ff3e7de6e4a7d299cd7a3c1e9d1e00' })), this.hasActions && (h("footer", { key: '4ba012a916db38e219287a5ea9ca7b4644dd96d9', class: "mg-c-modal__footer" }, h("slot", { key: 'c541075b02466d95defae7831c3fc7e4b786d7fc', name: "actions" })))))));
|
|
114
114
|
}
|
|
115
115
|
static get is() { return "mg-modal"; }
|
|
116
116
|
static get encapsulation() { return "shadow"; }
|
|
@@ -224,7 +224,7 @@ export class MgPanel {
|
|
|
224
224
|
*/
|
|
225
225
|
render() {
|
|
226
226
|
const headerId = `${this.identifier}-header`;
|
|
227
|
-
return (h("section", { key: '
|
|
227
|
+
return (h("section", { key: '6604c4a895a244a5e47d6ec138ddc0d931c07d59', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: '28d2de8b8796dbd42b9da5302c4e7e4d3503b2ae', shadow: this.shadow }, h("header", { key: '74fd2c618f57a0e3089f6908b184223c1586cf00', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: '811fffa80ba75ed57ffecbcf7bc4e6f94f75faa2', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: '27b372c17275726113a02b8e6bda9333a73b806f' })))));
|
|
228
228
|
}
|
|
229
229
|
static get is() { return "mg-panel"; }
|
|
230
230
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js
CHANGED
|
@@ -46,7 +46,7 @@ export class MgPopoverContent {
|
|
|
46
46
|
* @returns HTML Element
|
|
47
47
|
*/
|
|
48
48
|
render() {
|
|
49
|
-
return (h(Host, { key: '
|
|
49
|
+
return (h(Host, { key: 'c87fe52d52b80954170963fd1378b3a05313f9c6' }, h("mg-card", { key: 'a38755a5a7055d4bd4166531326b1be245d2906f', class: this.classCollection.join(), shadow: true }, this.closeButton && (h("mg-button", { key: '823e99beb15aa19f6f2f7cee2c5e1088cc116425', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { key: '70daf81e59533585b6a051a6d97539a75833432e', icon: "cross" }))), h("div", { key: 'cccf70c8fba6906e6724629642383fad0c98656e', class: "mg-c-popover-content__title" }, h("slot", { key: 'b05acb47b32d27d1629d39451e4a786d2f404406', name: "title" })), h("slot", { key: '40de167b1fb77c7d8fc557f60cf176c0991e991d', name: "content" })), h("slot", { key: 'c6c1305d5ff51d2af0d56b1199731cd41645c99d', name: "arrow" })));
|
|
50
50
|
}
|
|
51
51
|
static get is() { return "mg-popover-content"; }
|
|
52
52
|
static get encapsulation() { return "shadow"; }
|
|
@@ -242,7 +242,7 @@ export class MgPopover {
|
|
|
242
242
|
* @returns HTML Element
|
|
243
243
|
*/
|
|
244
244
|
render() {
|
|
245
|
-
return (h(Host, { key: '
|
|
245
|
+
return (h(Host, { key: 'c25d773831395cf154f85cda3be67af22d6d8767' }, h("slot", { key: 'c6fb5897222e527cc36c78e1f32aaadc4d3c4b01' }), h("slot", { key: 'd7f682fdf78caa8491b8e9a74e6d5e91dbf5ef84', name: "content" })));
|
|
246
246
|
}
|
|
247
247
|
static get is() { return "mg-popover"; }
|
|
248
248
|
static get encapsulation() { return "shadow"; }
|
|
@@ -65,7 +65,7 @@ export class MgProgress {
|
|
|
65
65
|
* @returns HTML Element
|
|
66
66
|
*/
|
|
67
67
|
render() {
|
|
68
|
-
return (h(Host, { key: '
|
|
68
|
+
return (h(Host, { key: 'e6d254a68f35c5019158ab17fcb0e4dfd1943ef8', role: this.ariaRole, "aria-label": this.label, "aria-valuenow": this.value, "aria-valuemin": this.min, "aria-valuemax": this.max }, h("div", { key: '5b427579ad97336076504a45013a0be00673f9a9', class: "mg-c-progress" }, h("div", { key: '76dbdf88550caf51890e10c45c034d73cd02db5d', class: { 'mg-c-progress__bar': true, 'mg-c-progress__bar--active': this.value > this.min } }, h("div", { key: 'b0ab6f784cdb8cc25a40b83a0d97bcda5b5c1f9b', class: "mg-c-progress__fill", style: {
|
|
69
69
|
width: `${Math.round(((this.value - this.min) / (this.max - this.min)) * 100)}%`,
|
|
70
70
|
} })))));
|
|
71
71
|
}
|
|
@@ -36,7 +36,7 @@ export class MgSkipLinks {
|
|
|
36
36
|
* @returns HTML Element
|
|
37
37
|
*/
|
|
38
38
|
render() {
|
|
39
|
-
return (h("nav", { key: '
|
|
39
|
+
return (h("nav", { key: '9df42d332b207abf989ef73f3c83ebbcfcf222a6', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { key: '0185490dbd3dfb08b534a898fe779850ce96c427', class: "mg-c-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-c-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
40
40
|
}
|
|
41
41
|
static get is() { return "mg-skip-links"; }
|
|
42
42
|
static get encapsulation() { return "shadow"; }
|
|
@@ -234,7 +234,7 @@ export class MgTabs {
|
|
|
234
234
|
* @returns HTML Element
|
|
235
235
|
*/
|
|
236
236
|
render() {
|
|
237
|
-
return (h("div", { key: '
|
|
237
|
+
return (h("div", { key: '06dd97d9d4e77f606dee3c4a8960b51265345666', class: this.classCollection.join() }, h("header", { key: 'ea3771bdfe8576bb8b443823a2c338a51ed3ba69', role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
238
238
|
[`${this.buttonTabBaseClass}`]: true,
|
|
239
239
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
240
240
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -83,6 +83,17 @@
|
|
|
83
83
|
"url": "The value is incorrect, the expected format is https://example.com"
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
},
|
|
87
|
+
"file": {
|
|
88
|
+
"helpText": {
|
|
89
|
+
"accept": "Accepted extensions: {{accept}}",
|
|
90
|
+
"maxSize": "Maximum size: {{maxSize}}"
|
|
91
|
+
},
|
|
92
|
+
"errors": {
|
|
93
|
+
"maxSize": "The file size exceeds the maximum allowed size of {{maxSize}}"
|
|
94
|
+
},
|
|
95
|
+
"browse": "Browse…",
|
|
96
|
+
"deleteButton": "Delete file"
|
|
86
97
|
}
|
|
87
98
|
},
|
|
88
99
|
"form": {
|
|
@@ -83,6 +83,17 @@
|
|
|
83
83
|
"url": "La valeur est incorrecte, le format attendu est https://exemple.fr"
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
},
|
|
87
|
+
"file": {
|
|
88
|
+
"helpText": {
|
|
89
|
+
"accept": "Extensions autorisée : {{acceptedFormat}}",
|
|
90
|
+
"maxSize": "Taille maximale : {{maxSize}}"
|
|
91
|
+
},
|
|
92
|
+
"errors": {
|
|
93
|
+
"maxSize": "La taille du fichier dépasse la taille maximale autorisée de {{maxSize}}"
|
|
94
|
+
},
|
|
95
|
+
"browse": "Parcourir…",
|
|
96
|
+
"deleteButton": "Supprimer le fichier"
|
|
86
97
|
}
|
|
87
98
|
},
|
|
88
99
|
"form": {
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Keyboard keys
|
|
3
|
-
*/
|
|
4
|
-
const Keys = {
|
|
5
|
-
TAB: 'Tab',
|
|
6
|
-
ENTER: 'Enter',
|
|
7
|
-
DOWN: 'Down',
|
|
8
|
-
UP: 'Up',
|
|
9
|
-
LEFT: 'Left',
|
|
10
|
-
RIGHT: 'Right',
|
|
11
|
-
ARROWDOWN: 'ArrowDown',
|
|
12
|
-
ARROWUP: 'ArrowUp',
|
|
13
|
-
ARROWRIGHT: 'ArrowRight',
|
|
14
|
-
ARROWLEFT: 'ArrowLeft',
|
|
15
|
-
HOME: 'Home',
|
|
16
|
-
END: 'End',
|
|
17
|
-
ESC: 'Esc',
|
|
18
|
-
ESCAPE: 'Escape',
|
|
19
|
-
NUMPADENTER: 'NumpadEnter',
|
|
20
|
-
SPACE: 'Space',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export { Keys as K };
|
|
1
|
+
const E={TAB:"Tab",ENTER:"Enter",DOWN:"Down",UP:"Up",LEFT:"Left",RIGHT:"Right",ARROWDOWN:"ArrowDown",ARROWUP:"ArrowUp",ARROWRIGHT:"ArrowRight",ARROWLEFT:"ArrowLeft",HOME:"Home",END:"End",ESC:"Esc",ESCAPE:"Escape",NUMPADENTER:"NumpadEnter",SPACE:"Space"};export{E as K}
|
|
@@ -31,3 +31,5 @@ export interface SetPlatformOptions {
|
|
|
31
31
|
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
32
32
|
}
|
|
33
33
|
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
34
|
+
|
|
35
|
+
export * from '../types';
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{getAssetPath,render,setAssetPath,setNonce,setPlatformOptions}from"@stencil/core/internal/client";
|
|
@@ -1,408 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Class to manage component classlist
|
|
3
|
-
*/
|
|
4
|
-
class ClassList {
|
|
5
|
-
/**
|
|
6
|
-
* Available classes
|
|
7
|
-
*/
|
|
8
|
-
classes;
|
|
9
|
-
constructor(classlist = []) {
|
|
10
|
-
this.classes = classlist;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Add class
|
|
14
|
-
* @param className - class name to add
|
|
15
|
-
*/
|
|
16
|
-
add = (className) => {
|
|
17
|
-
if (!this.has(className)) {
|
|
18
|
-
this.classes.push(className);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Delete class
|
|
23
|
-
* @param className - class name to delete
|
|
24
|
-
*/
|
|
25
|
-
delete = (className) => {
|
|
26
|
-
const index = this.classes.indexOf(className);
|
|
27
|
-
if (index > -1) {
|
|
28
|
-
this.classes.splice(index, 1);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Check if class exist in list
|
|
33
|
-
* @param className - class name to check
|
|
34
|
-
* @returns class name is in the list
|
|
35
|
-
*/
|
|
36
|
-
has = (className) => {
|
|
37
|
-
return this.classes.includes(className);
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Join classes seperated by spaces
|
|
41
|
-
* @returns joined values
|
|
42
|
-
*/
|
|
43
|
-
join = () => {
|
|
44
|
-
return this.classes.join(' ');
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Check if a value is of object type.
|
|
50
|
-
* @param object - The value to validate.
|
|
51
|
-
* @returns `true` if the value is a valid object (non-null and not an array), otherwise `false`.
|
|
52
|
-
*/
|
|
53
|
-
const isObject = (object) => typeof object === 'object' && !Array.isArray(object) && object !== null;
|
|
54
|
-
/**
|
|
55
|
-
* Get object value from key
|
|
56
|
-
* @param object - object to query
|
|
57
|
-
* @param path - path of the property to get. Nested keys are allowed with `.` separators (eg: 'key0.key1.key2' = object[key0][key1][key2])
|
|
58
|
-
* @param defaultValue - The value returned for `undefined` resolved values
|
|
59
|
-
* @returns object value
|
|
60
|
-
*/
|
|
61
|
-
const getObjectValueFromKey = (object, path, defaultValue) => {
|
|
62
|
-
const separator = '.';
|
|
63
|
-
if (!isObject(object) || typeof path !== 'string') {
|
|
64
|
-
return defaultValue;
|
|
65
|
-
}
|
|
66
|
-
const [current, ...next] = path.split(separator);
|
|
67
|
-
if (next.length) {
|
|
68
|
-
return getObjectValueFromKey(object[current], next.join(separator), defaultValue);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
return object[current] ?? defaultValue;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Typeguard function to check if all array items are strings.
|
|
77
|
-
* @param items - items to check
|
|
78
|
-
* @returns `true` if all items are strings
|
|
79
|
-
*/
|
|
80
|
-
const allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');
|
|
81
|
-
/**
|
|
82
|
-
* Validate string
|
|
83
|
-
* @param value - value to check
|
|
84
|
-
* @returns `true` if string is valid
|
|
85
|
-
*/
|
|
86
|
-
const isValidString = (value) => typeof value === 'string' && value.trim() !== '';
|
|
87
|
-
/**
|
|
88
|
-
* Stringify value
|
|
89
|
-
* @param value - value to stringify
|
|
90
|
-
* @returns stringified value
|
|
91
|
-
*/
|
|
92
|
-
const toString = (value) => (typeof value === 'object' ? JSON.stringify(value) : String(value));
|
|
93
|
-
/**
|
|
94
|
-
* Cleans string characters by removing special characters and converting to lowercase.
|
|
95
|
-
* @param text - text to clean
|
|
96
|
-
* @returns cleaned string
|
|
97
|
-
* @example
|
|
98
|
-
* ```ts
|
|
99
|
-
* cleanString('âäàçéèêñù') // 'aaaceeenu'
|
|
100
|
-
* cleanString('BATMAN') // 'batman'
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
const cleanString = (text) => typeof text === 'string'
|
|
104
|
-
? text
|
|
105
|
-
.toLocaleLowerCase()
|
|
106
|
-
.normalize('NFD')
|
|
107
|
-
.replaceAll(/[\u0300-\u036f]/g, '')
|
|
108
|
-
: text;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Convert a string to kebab-case.
|
|
112
|
-
*
|
|
113
|
-
* This function ensures:
|
|
114
|
-
* - All characters are converted to lowercase. Based on : https://stackoverflow.com/questions/63116039/camelcase-to-kebab-case
|
|
115
|
-
* - Non-alphabetic characters (except numbers and hyphens) are replaced with hyphens.
|
|
116
|
-
* - Consecutive hyphens are replaced with a single hyphen.
|
|
117
|
-
* - Leading and trailing hyphens are removed.
|
|
118
|
-
*
|
|
119
|
-
* @param str - The input string to convert.
|
|
120
|
-
* @returns The kebab-case formatted string.
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```typescript
|
|
124
|
-
* toKebabCase('XMLHttpRequest'); // 'xml-http-request'
|
|
125
|
-
* ```
|
|
126
|
-
*/
|
|
127
|
-
const toKebabCase = (str) => str
|
|
128
|
-
.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (match, offset) => (offset > 0 ? '-' : '') + match.toLowerCase())
|
|
129
|
-
.replace(/[^a-z0-9-]+/g, '-') // Replace non a-z, 0-9, or hyphen characters with a hyphen
|
|
130
|
-
.replace(/--+/g, '-') // Replace multiple consecutive hyphens with a single hyphen
|
|
131
|
-
.replace(/(?:^-)|(?:-$)/g, ''); // Remove leading hyphens or number or trailing hyphens
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Create random ID
|
|
135
|
-
* @param prefix - add prefix to created ID
|
|
136
|
-
* @param length - ID length
|
|
137
|
-
* @returns ID
|
|
138
|
-
*/
|
|
139
|
-
const createID = (prefix = '', length = 10) => {
|
|
140
|
-
const randomBytes = new Uint8Array(length);
|
|
141
|
-
crypto.getRandomValues(randomBytes);
|
|
142
|
-
const hexString = Array.from(randomBytes)
|
|
143
|
-
.map(byte => byte.toString(16).padStart(2, '0'))
|
|
144
|
-
.join('')
|
|
145
|
-
.slice(0, length);
|
|
146
|
-
return prefix !== '' ? `${prefix}-${hexString}` : hexString;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* Validate html `id` format
|
|
150
|
-
* @param newValue - id value to validate
|
|
151
|
-
* @returns true if `id` is valid
|
|
152
|
-
*/
|
|
153
|
-
const isValideID = (newValue) => isValidString(newValue) && /^([a-z][a-z0-9]*)(-[a-z0-9]+)*$/.exec(newValue) !== null;
|
|
154
|
-
/**
|
|
155
|
-
* Format id from value
|
|
156
|
-
* @param value - id to transforme
|
|
157
|
-
* @returns valid id
|
|
158
|
-
*/
|
|
159
|
-
const formatID = (value) => {
|
|
160
|
-
let id;
|
|
161
|
-
if (typeof value === 'string') {
|
|
162
|
-
id = value;
|
|
163
|
-
}
|
|
164
|
-
else if (Boolean(value) && typeof value === 'object' && (isObject(value) || Array.isArray(value))) {
|
|
165
|
-
id = JSON.stringify(value);
|
|
166
|
-
}
|
|
167
|
-
else if (value !== null && value !== undefined && typeof value !== 'boolean' && typeof value !== 'object') {
|
|
168
|
-
id = String(value);
|
|
169
|
-
}
|
|
170
|
-
return id ? toKebabCase(id) : id;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Use to process code next tick in the event loop
|
|
175
|
-
* @param callback - code to excute on next tick
|
|
176
|
-
* @returns differed code excution
|
|
177
|
-
*/
|
|
178
|
-
const nextTick = async (callback) => {
|
|
179
|
-
if (callback)
|
|
180
|
-
return callback();
|
|
181
|
-
};
|
|
182
|
-
/**
|
|
183
|
-
* Cursor possible values
|
|
184
|
-
*/
|
|
185
|
-
const Cursor = {
|
|
186
|
-
FIRST: 'first',
|
|
187
|
-
NEXT: 'next',
|
|
188
|
-
PREVIOUS: 'previous',
|
|
189
|
-
LAST: 'last',
|
|
190
|
-
};
|
|
191
|
-
const DEFAULT_TOP = 10;
|
|
192
|
-
/**
|
|
193
|
-
* Define a valid Page object and navigate throw page items with cursor.
|
|
194
|
-
* Page object entries follow the REST API page practices.
|
|
195
|
-
*/
|
|
196
|
-
class Page {
|
|
197
|
-
/**
|
|
198
|
-
* Define items
|
|
199
|
-
*/
|
|
200
|
-
items = [];
|
|
201
|
-
/**
|
|
202
|
-
* Define total
|
|
203
|
-
*/
|
|
204
|
-
total;
|
|
205
|
-
/**
|
|
206
|
-
* Define top
|
|
207
|
-
*/
|
|
208
|
-
top = DEFAULT_TOP;
|
|
209
|
-
/**
|
|
210
|
-
* Define next
|
|
211
|
-
*/
|
|
212
|
-
next;
|
|
213
|
-
/**
|
|
214
|
-
* Define base index
|
|
215
|
-
*/
|
|
216
|
-
baseIndex = 1;
|
|
217
|
-
constructor(init) {
|
|
218
|
-
if (!isObject(init)) {
|
|
219
|
-
throw new Error('Page - init must match IPage type.');
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
if (Array.isArray(init.items))
|
|
223
|
-
this.items = init.items;
|
|
224
|
-
if (typeof init.top === 'number')
|
|
225
|
-
this.top = init.top;
|
|
226
|
-
this.total = typeof init.total === 'number' ? init.total : this.items.length;
|
|
227
|
-
this.next = init.next;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Get index of items from cursor
|
|
232
|
-
* @param cursor - cursor to find
|
|
233
|
-
* @param oldItem - previous item
|
|
234
|
-
* @returns item index
|
|
235
|
-
*/
|
|
236
|
-
getIndexFromCursor = (cursor = 'first', oldItem) => {
|
|
237
|
-
const startIndex = 0;
|
|
238
|
-
if (!Array.isArray(this.items) || !this.items.length)
|
|
239
|
-
return null;
|
|
240
|
-
const lastIndex = this.items.length - this.baseIndex;
|
|
241
|
-
let newIndex;
|
|
242
|
-
let oldIndex = startIndex;
|
|
243
|
-
if (['previous', 'next'].includes(cursor) && oldItem) {
|
|
244
|
-
const findedIndex = this.items.findIndex(item => JSON.stringify(item) === JSON.stringify(oldItem));
|
|
245
|
-
if (findedIndex === -1)
|
|
246
|
-
return startIndex;
|
|
247
|
-
oldIndex = findedIndex;
|
|
248
|
-
}
|
|
249
|
-
// Update index from cursor
|
|
250
|
-
if (cursor === 'first') {
|
|
251
|
-
newIndex = startIndex;
|
|
252
|
-
}
|
|
253
|
-
else if (cursor === 'last') {
|
|
254
|
-
newIndex = lastIndex;
|
|
255
|
-
}
|
|
256
|
-
else if (cursor === 'previous') {
|
|
257
|
-
newIndex = JSON.stringify(this.items[oldIndex]) === JSON.stringify(this.items[startIndex]) ? lastIndex : oldIndex - this.baseIndex;
|
|
258
|
-
}
|
|
259
|
-
else if (cursor === 'next') {
|
|
260
|
-
newIndex = JSON.stringify(this.items[oldIndex]) === JSON.stringify(this.items[lastIndex]) ? startIndex : oldIndex + this.baseIndex;
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
newIndex = startIndex;
|
|
264
|
-
}
|
|
265
|
-
return newIndex;
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Paginate an items array to navigate into with pages.
|
|
270
|
-
* It follow REST standard and allow to navigate in items array with a similar format.
|
|
271
|
-
*/
|
|
272
|
-
class Paginate {
|
|
273
|
-
/**
|
|
274
|
-
* Define paginated items
|
|
275
|
-
*/
|
|
276
|
-
items = [];
|
|
277
|
-
/* Privates */
|
|
278
|
-
#top = DEFAULT_TOP;
|
|
279
|
-
#next;
|
|
280
|
-
#total;
|
|
281
|
-
constructor(items, options) {
|
|
282
|
-
if (Array.isArray(items))
|
|
283
|
-
this.items = items;
|
|
284
|
-
if (options && (['string', 'function'].includes(typeof options.next) || (isObject(options.next) && URL.canParse(options.next))))
|
|
285
|
-
this.#next = options.next;
|
|
286
|
-
if (typeof options?.top === 'number')
|
|
287
|
-
this.#top = options.top;
|
|
288
|
-
if (typeof options?.total === 'number')
|
|
289
|
-
this.#total = options.total;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Get page
|
|
293
|
-
* @param offset - pagiantion offset
|
|
294
|
-
* @param filter - filter methode
|
|
295
|
-
* @returns formated page
|
|
296
|
-
*/
|
|
297
|
-
getPage = (offset = 0, filter) => {
|
|
298
|
-
const items = typeof filter === 'function' ? this.items.filter(filter) : this.items;
|
|
299
|
-
let next;
|
|
300
|
-
if (this.#next)
|
|
301
|
-
next = this.#next;
|
|
302
|
-
else if (items.length > offset + this.#top)
|
|
303
|
-
next = () => this.getPage(offset + this.#top, filter);
|
|
304
|
-
return new Page({
|
|
305
|
-
items: items.slice(offset, offset + this.#top),
|
|
306
|
-
total: this.#total,
|
|
307
|
-
top: this.#top,
|
|
308
|
-
next,
|
|
309
|
-
});
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Date RegExp, usefull to test if string is a follow the date pattern
|
|
315
|
-
* @example
|
|
316
|
-
* ```ts
|
|
317
|
-
* dateRegExp.test('mystring') // false
|
|
318
|
-
* dateRegExp.test('2020-12-31') // true
|
|
319
|
-
* ```
|
|
320
|
-
*/
|
|
321
|
-
const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
322
|
-
/**
|
|
323
|
-
* Formats a date object to a string with the pattern 'YYYY-MM-DD'.
|
|
324
|
-
* @param date - date to parse
|
|
325
|
-
* @returns string date with pattern 'YYYY-MM-DD'
|
|
326
|
-
* @example
|
|
327
|
-
* ```ts
|
|
328
|
-
* dateToString(new Date('2023-12-24')) // '2023-12-24'
|
|
329
|
-
* ```
|
|
330
|
-
*/
|
|
331
|
-
const dateToString = (date) => date.toISOString().split('T')[0];
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Check if element belongs to the given tagNames list
|
|
335
|
-
* @param element - element to check
|
|
336
|
-
* @param tagNames - allowed tag names list
|
|
337
|
-
* @returns `true` if element tagName is in the tagNames list
|
|
338
|
-
*/
|
|
339
|
-
const isTagName = (element, tagNames) => tagNames.includes(element?.tagName.toLowerCase());
|
|
340
|
-
/**
|
|
341
|
-
* CSS selector to select focusable elements.
|
|
342
|
-
* @example
|
|
343
|
-
* ```ts
|
|
344
|
-
* const allFocusableElements: HTMLElement[] = Array.from(this.element.querySelectorAll(focusableElements));
|
|
345
|
-
* ```
|
|
346
|
-
*/
|
|
347
|
-
const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier], mg-button';
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Validate number
|
|
351
|
-
* @param value - value to check
|
|
352
|
-
* @returns `true` if number is valid
|
|
353
|
-
*/
|
|
354
|
-
const isValidNumber = (value) => typeof value === 'number' && !Number.isNaN(value);
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Get windows
|
|
358
|
-
* @param localWindow - the window we are lookink for other windows
|
|
359
|
-
* @returns The list of windows found
|
|
360
|
-
*/
|
|
361
|
-
const getWindows = (localWindow) => {
|
|
362
|
-
const parentWindows = getParentWindows(localWindow);
|
|
363
|
-
const childWindows = getChildWindows(localWindow);
|
|
364
|
-
return [localWindow, ...parentWindows, ...childWindows];
|
|
365
|
-
};
|
|
366
|
-
/**
|
|
367
|
-
* Get parent windows
|
|
368
|
-
* @param localWindow - the window we are lookink for parents
|
|
369
|
-
* @param windows - The list of allready found windows
|
|
370
|
-
* @returns The list of windows found
|
|
371
|
-
*/
|
|
372
|
-
const getParentWindows = (localWindow, windows = []) => {
|
|
373
|
-
// Check if is in iframe
|
|
374
|
-
if (localWindow.self !== localWindow.top) {
|
|
375
|
-
// Check if we have permission to access parent
|
|
376
|
-
try {
|
|
377
|
-
const parentWindow = localWindow.parent;
|
|
378
|
-
if (parentWindow) {
|
|
379
|
-
windows.push(parentWindow);
|
|
380
|
-
return getParentWindows(parentWindow, windows);
|
|
381
|
-
}
|
|
382
|
-
else
|
|
383
|
-
return windows;
|
|
384
|
-
}
|
|
385
|
-
catch (err) {
|
|
386
|
-
console.error('Different hosts between iframes:', err);
|
|
387
|
-
return windows;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
return windows;
|
|
391
|
-
};
|
|
392
|
-
/**
|
|
393
|
-
* Get child windows
|
|
394
|
-
* @param localWindow - the window we are lookink for children
|
|
395
|
-
* @param windows - The list of allready found windows
|
|
396
|
-
* @returns The list of windows found
|
|
397
|
-
*/
|
|
398
|
-
const getChildWindows = (localWindow, windows = []) => {
|
|
399
|
-
if (localWindow.frames.length > 0) {
|
|
400
|
-
for (const childWindow of Array.from(localWindow.frames)) {
|
|
401
|
-
windows.push(childWindow);
|
|
402
|
-
getChildWindows(childWindow, windows);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return windows;
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
export { ClassList as C, Paginate as P, isValideID as a, isTagName as b, createID as c, allItemsAreString as d, Cursor as e, formatID as f, getWindows as g, Page as h, isValidString as i, getObjectValueFromKey as j, isObject as k, focusableElements as l, cleanString as m, nextTick as n, dateRegExp as o, dateToString as p, isValidNumber as q, toString as t };
|
|
1
|
+
class t{classes;constructor(t=[]){this.classes=t}add=t=>{this.has(t)||this.classes.push(t)};delete=t=>{const s=this.classes.indexOf(t);s>-1&&this.classes.splice(s,1)};has=t=>this.classes.includes(t);join=()=>this.classes.join(" ")}const s=t=>"object"==typeof t&&!Array.isArray(t)&&null!==t,e=(t,r,i)=>{if(!s(t)||"string"!=typeof r)return i;const[n,...o]=r.split(".");return o.length?e(t[n],o.join("."),i):t[n]??i},r=t=>Array.isArray(t)&&t.every((t=>"string"==typeof t)),i=t=>"string"==typeof t&&""!==t.trim(),n=t=>"object"==typeof t?JSON.stringify(t):String(t),o=t=>"string"==typeof t?t.toLocaleLowerCase().normalize("NFD").replaceAll(/[\u0300-\u036f]/g,""):t,a=(t="",s=10)=>{const e=new Uint8Array(s);crypto.getRandomValues(e);const r=Array.from(e).map((t=>t.toString(16).padStart(2,"0"))).join("").slice(0,s);return""!==t?`${t}-${r}`:r},h=t=>i(t)&&null!==/^([a-z][a-z0-9]*)(-[a-z0-9]+)*$/.exec(t),f=t=>{let e;return"string"==typeof t?e=t:Boolean(t)&&"object"==typeof t&&(s(t)||Array.isArray(t))?e=JSON.stringify(t):null!=t&&"boolean"!=typeof t&&"object"!=typeof t&&(e=String(t)),e?e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((t,s)=>(s>0?"-":"")+t.toLowerCase())).replace(/[^a-z0-9-]+/g,"-").replace(/--+/g,"-").replace(/(?:^-)|(?:-$)/g,""):e},u=async t=>{if(t)return t()},c={FIRST:"first",NEXT:"next",PREVIOUS:"previous",LAST:"last"};class y{items=[];total;top=10;next;baseIndex=1;constructor(t){if(!s(t))throw new Error("Page - init must match IPage type.");Array.isArray(t.items)&&(this.items=t.items),"number"==typeof t.top&&(this.top=t.top),this.total="number"==typeof t.total?t.total:this.items.length,this.next=t.next}getIndexFromCursor=(t="first",s)=>{if(!Array.isArray(this.items)||!this.items.length)return null;const e=this.items.length-this.baseIndex;let r,i=0;if(["previous","next"].includes(t)&&s){const t=this.items.findIndex((t=>JSON.stringify(t)===JSON.stringify(s)));if(-1===t)return 0;i=t}return r="first"===t?0:"last"===t?e:"previous"===t?JSON.stringify(this.items[i])===JSON.stringify(this.items[0])?e:i-this.baseIndex:"next"===t?JSON.stringify(this.items[i])===JSON.stringify(this.items[e])?0:i+this.baseIndex:0,r}}class p{items=[];#t=10;#s;#e;constructor(t,e){Array.isArray(t)&&(this.items=t),e&&(["string","function"].includes(typeof e.next)||s(e.next)&&URL.canParse(e.next))&&(this.#s=e.next),"number"==typeof e?.top&&(this.#t=e.top),"number"==typeof e?.total&&(this.#e=e.total)}getPage=(t=0,s)=>{const e="function"==typeof s?this.items.filter(s):this.items;let r;return this.#s?r=this.#s:e.length>t+this.#t&&(r=()=>this.getPage(t+this.#t,s)),new y({items:e.slice(t,t+this.#t),total:this.#e,top:this.#t,next:r})}}const l=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,g=t=>t.toISOString().split("T")[0],b=(t,s)=>s.includes(t?.tagName.toLowerCase()),m='a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier], mg-button',S=t=>"number"==typeof t&&!Number.isNaN(t),d=t=>[t,...x(t),...A(t)],x=(t,s=[])=>{if(t.self!==t.top)try{const e=t.parent;return e?(s.push(e),x(e,s)):s}catch(t){return console.error("Different hosts between iframes:",t),s}return s},A=(t,s=[])=>{if(t.frames.length>0)for(const e of Array.from(t.frames))s.push(e),A(e,s);return s};export{t as C,p as P,h as a,b,a as c,r as d,c as e,f,d as g,y as h,i,e as j,s as k,m as l,o as m,u as n,l as o,g as p,S as q,n as t}
|