@mgdis/mg-components 5.5.0 → 5.7.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-c3450336.js → index-5e7ede97.js} +120 -4
- package/dist/cjs/loader.cjs.js +4 -3
- package/dist/cjs/{mg-badge_30.cjs.entry.js → mg-action-more_31.cjs.entry.js} +1223 -547
- package/dist/cjs/mg-components.cjs.js +7 -3
- package/dist/collection/collection-manifest.json +6 -5
- package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.css +13 -0
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +4 -4
- package/dist/collection/components/atoms/mg-button/mg-button.css +9 -22
- package/dist/collection/components/atoms/mg-button/mg-button.js +1 -1
- package/dist/collection/components/atoms/mg-card/mg-card.css +13 -6
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +38 -28
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +3 -3
- package/dist/collection/components/atoms/mg-tag/mg-tag.css +6 -6
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +4 -4
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +2 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +14 -17
- package/dist/collection/components/molecules/inputs/MgInput.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +3 -2
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +7 -3
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +5 -2
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +7 -3
- 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.css +7 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +2 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +7 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +8 -4
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +7 -3
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +7 -3
- 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.css +4 -4
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +17 -0
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +27 -0
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +141 -19
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +0 -4
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +48 -21
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +139 -71
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js +1 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +38 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +252 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +2 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +4 -3
- package/dist/collection/components/molecules/mg-message/mg-message.css +7 -0
- package/dist/collection/components/molecules/mg-message/mg-message.js +54 -13
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +8 -1
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +19 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +7 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +72 -15
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +64 -7
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +33 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +12 -7
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +105 -57
- package/dist/collection/locales/en/messages.json +10 -1
- package/dist/collection/locales/fr/messages.json +10 -1
- package/dist/collection/locales/index.js +3 -26
- package/dist/collection/styles/a11y.scss +32 -0
- package/dist/collection/styles/components.scss +3 -0
- package/dist/collection/styles/fonts.scss +21 -0
- package/dist/collection/styles/form.scss +3 -0
- package/dist/collection/styles/global.scss +87 -0
- package/dist/collection/styles/layout.scss +29 -0
- package/dist/collection/styles/main.scss +23 -0
- package/dist/collection/styles/mg-icon-animation.scss +6 -0
- package/dist/collection/styles/navigation-button.scss +77 -0
- package/dist/collection/styles/reset-mg-card-slotted-variables.scss +9 -0
- package/dist/collection/styles/typography.scss +75 -0
- package/dist/collection/styles/utilities.scss +21 -0
- package/dist/collection/utils/behaviors.utils.js +151 -0
- package/dist/collection/utils/components.utils.js +52 -0
- package/dist/collection/utils/locale.utils.js +28 -6
- package/dist/collection/utils/unit.test.utils.js +65 -32
- package/dist/collection/variables.css +11 -10
- package/dist/components/MgInput.js +6 -1
- package/dist/components/components.utils.js +53 -1
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +2 -1
- package/dist/components/index2.js +79 -20
- package/dist/components/mg-action-more.d.ts +11 -0
- package/dist/components/mg-action-more.js +215 -0
- package/dist/components/mg-badge2.js +5 -5
- package/dist/components/mg-button2.js +2 -2
- package/dist/components/mg-card2.js +1 -1
- package/dist/components/mg-form.js +2 -2
- package/dist/components/mg-icon2.js +41 -31
- package/dist/components/mg-illustrated-message.js +4 -3
- package/dist/components/mg-input-checkbox.js +3 -3
- package/dist/components/mg-input-date.js +7 -5
- package/dist/components/mg-input-numeric.js +3 -4
- package/dist/components/mg-input-password.js +1 -1
- package/dist/components/mg-input-radio.js +2 -2
- package/dist/components/mg-input-select2.js +9 -5
- package/dist/components/mg-input-text2.js +1 -1
- package/dist/components/mg-input-textarea.js +2 -2
- package/dist/components/mg-input-toggle.js +1 -1
- package/dist/components/mg-menu-item.js +1 -253
- package/dist/components/mg-menu-item2.js +520 -0
- package/dist/components/mg-menu.js +1 -129
- package/dist/components/mg-menu2.js +247 -0
- package/dist/components/mg-message.js +55 -14
- package/dist/components/mg-modal.js +1 -1
- package/dist/components/mg-pagination.js +3 -1
- package/dist/components/mg-panel.js +3 -3
- package/dist/components/mg-popover.js +1 -190
- package/dist/components/mg-popover2.js +226 -0
- package/dist/components/mg-skip-links.js +16 -2
- package/dist/components/mg-tabs.js +104 -55
- package/dist/components/mg-tag.js +5 -5
- package/dist/components/mg-tooltip2.js +15 -18
- package/dist/esm/{index-78edde1d.js → index-03cceb11.js} +120 -5
- package/dist/esm/loader.js +4 -3
- package/dist/esm/{mg-badge_30.entry.js → mg-action-more_31.entry.js} +1223 -548
- package/dist/esm/mg-components.js +4 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/mg-components/locales/en/messages.json +10 -1
- package/dist/mg-components/locales/fr/messages.json +10 -1
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-4cfd5423.entry.js +1 -0
- package/dist/mg-components/p-e126dd84.js +2 -0
- package/dist/mg-components/styles/a11y.scss +32 -0
- package/dist/mg-components/styles/components.scss +3 -0
- package/dist/mg-components/styles/fonts.scss +21 -0
- package/dist/mg-components/styles/form.scss +3 -0
- package/dist/mg-components/styles/global.scss +87 -0
- package/dist/mg-components/styles/layout.scss +29 -0
- package/dist/mg-components/styles/main.scss +23 -0
- package/dist/mg-components/styles/mg-icon-animation.scss +6 -0
- package/dist/mg-components/styles/navigation-button.scss +77 -0
- package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +9 -0
- package/dist/mg-components/styles/typography.scss +75 -0
- package/dist/mg-components/styles/utilities.scss +21 -0
- package/dist/mg-components/variables.css +11 -10
- package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +2 -2
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +2 -2
- package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +2 -2
- package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +1 -1
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +37 -0
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +51 -3
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +0 -8
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +61 -15
- package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +42 -0
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +81 -0
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +21 -4
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +4 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +13 -0
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +1 -1
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +15 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +5 -3
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +22 -12
- package/dist/types/components.d.ts +98 -12
- package/dist/types/locales/index.d.ts +21 -10
- package/dist/types/stencil-public-runtime.d.ts +48 -3
- package/dist/types/utils/behaviors.utils.d.ts +77 -0
- package/dist/types/utils/components.utils.d.ts +14 -0
- package/dist/types/utils/locale.utils.d.ts +16 -3
- package/dist/types/utils/unit.test.utils.d.ts +68 -14
- package/loader/index.d.ts +9 -0
- package/package.json +28 -27
- package/readme.md +22 -31
- package/dist/.storybook/utils.js +0 -24
- package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +0 -27
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -38
- package/dist/collection/components/atoms/mg-card/doc/mg-card.stories.js +0 -18
- package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +0 -20
- package/dist/collection/components/atoms/mg-divider/doc/mg-divider.stories.js +0 -18
- package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +0 -41
- package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +0 -21
- package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +0 -22
- package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +0 -50
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.js +0 -50
- package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +0 -43
- package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +0 -68
- package/dist/collection/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.js +0 -46
- package/dist/collection/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.js +0 -59
- package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +0 -77
- package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +0 -110
- package/dist/collection/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.js +0 -54
- package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +0 -51
- package/dist/collection/components/molecules/menu/mg-menu/doc/mg-menu.stories.js +0 -87
- package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +0 -39
- package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +0 -24
- package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +0 -47
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +0 -19
- package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +0 -39
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +0 -39
- package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +0 -20
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +0 -22
- package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +0 -34
- package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +0 -24
- package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +0 -51
- package/dist/collection/stories/grids.stories.js +0 -7
- package/dist/collection/stories/helpers.stories.js +0 -23
- package/dist/collection/stories/icons.stories.js +0 -25
- package/dist/collection/stories/typography.stories.js +0 -24
- package/dist/components/locale.utils.js +0 -40
- package/dist/components/mg-menu.conf.js +0 -10
- package/dist/mg-components/p-125c54ca.js +0 -2
- package/dist/mg-components/p-4961c96c.entry.js +0 -1
- package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -13
- package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -16
- package/dist/types/components/atoms/mg-card/doc/mg-card.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-divider/doc/mg-divider.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-icon/doc/mg-icon.stories.d.ts +0 -26
- package/dist/types/components/atoms/mg-input-title/doc/mg-input-title.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +0 -18
- package/dist/types/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.d.ts +0 -11
- package/dist/types/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.d.ts +0 -12
- package/dist/types/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.d.ts +0 -32
- package/dist/types/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.d.ts +0 -22
- package/dist/types/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.d.ts +0 -20
- package/dist/types/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.d.ts +0 -34
- package/dist/types/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.d.ts +0 -39
- package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +0 -19
- package/dist/types/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.d.ts +0 -12
- package/dist/types/components/molecules/menu/mg-menu/doc/mg-menu.stories.d.ts +0 -17
- package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +0 -12
- package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-form/doc/mg-form.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +0 -6
- package/dist/types/components/molecules/mg-message/doc/mg-message.stories.d.ts +0 -26
- package/dist/types/components/molecules/mg-modal/doc/mg-modal.stories.d.ts +0 -13
- package/dist/types/components/molecules/mg-pagination/doc/mg-pagination.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-panel/doc/mg-panel.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +0 -22
- package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-tabs/doc/mg-tabs.stories.d.ts +0 -20
- package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +0 -1
- package/dist/types/stories/grids.stories.d.ts +0 -5
- package/dist/types/stories/helpers.stories.d.ts +0 -13
- package/dist/types/stories/icons.stories.d.ts +0 -13
- package/dist/types/stories/typography.stories.d.ts +0 -5
|
@@ -1,9 +1,270 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-03cceb11.js';
|
|
2
|
+
|
|
3
|
+
const errors$1 = {
|
|
4
|
+
required: "This field is required.",
|
|
5
|
+
date: {
|
|
6
|
+
badInput: "The date format must be <span aria-hidden=\"true\">mm/dd/yyyy</span><span class=\"sr-only\">m m / d d / y y y y</span> and the date must be greater than {min}",
|
|
7
|
+
min: "The date cannot be earlier than {min}",
|
|
8
|
+
max: "The date cannot be later than {max}",
|
|
9
|
+
minMax: "The date must be between {min} and {max}"
|
|
10
|
+
},
|
|
11
|
+
numeric: {
|
|
12
|
+
min: "The value cannot be less than {min}",
|
|
13
|
+
max: "The value cannot be greater than {max}",
|
|
14
|
+
minMax: "The value must be between {min} et {max}"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const nbCharLeft$1 = "{counter} characters left.";
|
|
18
|
+
const input$1 = {
|
|
19
|
+
select: {
|
|
20
|
+
placeholder: "Select a value"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const form$1 = {
|
|
24
|
+
required: "Fields with a <strong class=\"is-asterisk\">*</strong> are required",
|
|
25
|
+
requiredSingle: "Field with a <strong class=\"is-asterisk\">*</strong> is required",
|
|
26
|
+
allRequired: "All fields are required",
|
|
27
|
+
allRequiredSingle: "The field is required"
|
|
28
|
+
};
|
|
29
|
+
const message$1 = {
|
|
30
|
+
closeButton: "Close message"
|
|
31
|
+
};
|
|
32
|
+
const modal$1 = {
|
|
33
|
+
closeButton: "Close modal"
|
|
34
|
+
};
|
|
35
|
+
const pagination$1 = {
|
|
36
|
+
label: "Pagination",
|
|
37
|
+
page: "page",
|
|
38
|
+
pages: "pages",
|
|
39
|
+
nextPage: "Next page",
|
|
40
|
+
previousPage: "Previous page",
|
|
41
|
+
selectPage: "Select the page to display."
|
|
42
|
+
};
|
|
43
|
+
const panel$1 = {
|
|
44
|
+
editLabel: "Edit section title."
|
|
45
|
+
};
|
|
46
|
+
const skipLinks$1 = {
|
|
47
|
+
navLabel: "Quick access"
|
|
48
|
+
};
|
|
49
|
+
const general$1 = {
|
|
50
|
+
confirm: "Confirm",
|
|
51
|
+
cancel: "Cancel",
|
|
52
|
+
close: "Close",
|
|
53
|
+
next: "next",
|
|
54
|
+
previous: "previous"
|
|
55
|
+
};
|
|
56
|
+
const plusMenu$1 = {
|
|
57
|
+
moreLabel: "Additional menu",
|
|
58
|
+
badgeLabel: "Include notification(s)"
|
|
59
|
+
};
|
|
60
|
+
const actionMore$1 = {
|
|
61
|
+
label: "Actions"
|
|
62
|
+
};
|
|
63
|
+
const en = {
|
|
64
|
+
errors: errors$1,
|
|
65
|
+
nbCharLeft: nbCharLeft$1,
|
|
66
|
+
input: input$1,
|
|
67
|
+
form: form$1,
|
|
68
|
+
message: message$1,
|
|
69
|
+
modal: modal$1,
|
|
70
|
+
pagination: pagination$1,
|
|
71
|
+
panel: panel$1,
|
|
72
|
+
skipLinks: skipLinks$1,
|
|
73
|
+
general: general$1,
|
|
74
|
+
plusMenu: plusMenu$1,
|
|
75
|
+
actionMore: actionMore$1
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const errors = {
|
|
79
|
+
required: "Ce champ est obligatoire.",
|
|
80
|
+
date: {
|
|
81
|
+
badInput: "Le format de la date doit être du type <span aria-hidden=\"true\">jj/mm/aaaa</span><span class=\"sr-only\">j j / m m / a a a a</span> et la date supérieure au {min}",
|
|
82
|
+
min: "La date ne peut pas être antérieure au {min}",
|
|
83
|
+
max: "La date ne peut pas être postérieure au {max}",
|
|
84
|
+
minMax: "La date doit être comprise entre le {min} et le {max}"
|
|
85
|
+
},
|
|
86
|
+
numeric: {
|
|
87
|
+
min: "La valeur ne peut pas être inférieure à {min}",
|
|
88
|
+
max: "La valeur ne peut pas être supérieure à {max}",
|
|
89
|
+
minMax: "La valeur doit être comprise entre {min} et {max}"
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const nbCharLeft = "{counter} caractères disponibles.";
|
|
93
|
+
const input = {
|
|
94
|
+
select: {
|
|
95
|
+
placeholder: "Sélectionnez une valeur"
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const form = {
|
|
99
|
+
required: "Les champs marqués d'un <strong class=\"is-asterisk\">*</strong> sont obligatoires",
|
|
100
|
+
requiredSingle: "Le champ marqué d'un <strong class=\"is-asterisk\">*</strong> est obligatoire",
|
|
101
|
+
allRequired: "Tous les champs sont obligatoires",
|
|
102
|
+
allRequiredSingle: "Le champ est obligatoire"
|
|
103
|
+
};
|
|
104
|
+
const message = {
|
|
105
|
+
closeButton: "Fermer le message"
|
|
106
|
+
};
|
|
107
|
+
const modal = {
|
|
108
|
+
closeButton: "Fermer la modale"
|
|
109
|
+
};
|
|
110
|
+
const pagination = {
|
|
111
|
+
label: "Pagination",
|
|
112
|
+
page: "page",
|
|
113
|
+
pages: "pages",
|
|
114
|
+
nextPage: "Page suivante",
|
|
115
|
+
previousPage: "Page précédente",
|
|
116
|
+
selectPage: "Sélectionner la page à afficher."
|
|
117
|
+
};
|
|
118
|
+
const panel = {
|
|
119
|
+
editLabel: "Modifier le titre de la section."
|
|
120
|
+
};
|
|
121
|
+
const skipLinks = {
|
|
122
|
+
navLabel: "Accès rapide"
|
|
123
|
+
};
|
|
124
|
+
const general = {
|
|
125
|
+
confirm: "Valider",
|
|
126
|
+
cancel: "Annuler",
|
|
127
|
+
close: "Fermer",
|
|
128
|
+
next: "suivant",
|
|
129
|
+
previous: "précédent"
|
|
130
|
+
};
|
|
131
|
+
const plusMenu = {
|
|
132
|
+
moreLabel: "Menu complémentaire",
|
|
133
|
+
badgeLabel: "Notification(s) incluse(s)"
|
|
134
|
+
};
|
|
135
|
+
const actionMore = {
|
|
136
|
+
label: "Actions"
|
|
137
|
+
};
|
|
138
|
+
const fr = {
|
|
139
|
+
errors: errors,
|
|
140
|
+
nbCharLeft: nbCharLeft,
|
|
141
|
+
input: input,
|
|
142
|
+
form: form,
|
|
143
|
+
message: message,
|
|
144
|
+
modal: modal,
|
|
145
|
+
pagination: pagination,
|
|
146
|
+
panel: panel,
|
|
147
|
+
skipLinks: skipLinks,
|
|
148
|
+
general: general,
|
|
149
|
+
plusMenu: plusMenu,
|
|
150
|
+
actionMore: actionMore
|
|
151
|
+
};
|
|
2
152
|
|
|
3
153
|
/**
|
|
4
|
-
*
|
|
154
|
+
* Format number to the locale currency
|
|
155
|
+
*
|
|
156
|
+
* @param {number} number number to format
|
|
157
|
+
* @param {string} locale locale to apply
|
|
158
|
+
* @param {string} currency currency to apply
|
|
159
|
+
* @returns {string} formatted currency
|
|
160
|
+
*/
|
|
161
|
+
const localeCurrency = (number, locale, currency) => {
|
|
162
|
+
return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Format number to locale
|
|
166
|
+
*
|
|
167
|
+
* @param {number} number number to format
|
|
168
|
+
* @param {string} locale locale to apply
|
|
169
|
+
* @returns {string} formatted number
|
|
170
|
+
*/
|
|
171
|
+
const localeNumber = (number, locale) => {
|
|
172
|
+
return new Intl.NumberFormat(locale).format(number);
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Date RegExp
|
|
176
|
+
*/
|
|
177
|
+
const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
178
|
+
/**
|
|
179
|
+
* Locale date format
|
|
180
|
+
*
|
|
181
|
+
* @param {string} date date to format
|
|
182
|
+
* @param {string} locale locale to apply
|
|
183
|
+
* @returns {string} formatted date
|
|
184
|
+
*/
|
|
185
|
+
const localeDate = (date, locale) => {
|
|
186
|
+
if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {
|
|
187
|
+
return '';
|
|
188
|
+
}
|
|
189
|
+
return new Intl.DateTimeFormat(locale).format(new Date(date));
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Get locale and messages
|
|
193
|
+
* We load the defined locale but for now we only support the first subtag for messages
|
|
194
|
+
*
|
|
195
|
+
* @param {HTMLElement} element element we need to get the language
|
|
196
|
+
* @param {unknown} messages messages to use
|
|
197
|
+
* @param {string} defaultLocale default messages locale
|
|
198
|
+
* @returns {{ locale: string; messages: Record<string, unknown> }} messages object
|
|
199
|
+
*/
|
|
200
|
+
const getLocaleMessages = (element, messages, defaultLocale) => {
|
|
201
|
+
// Get local
|
|
202
|
+
const closestLangAttribute = element.closest('[lang]');
|
|
203
|
+
const closestLang = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute === null || closestLangAttribute === void 0 ? void 0 : closestLangAttribute.lang);
|
|
204
|
+
const locale = closestLang.length > 0 ? closestLang[0] : navigator.language || defaultLocale;
|
|
205
|
+
// Only keep first subtag
|
|
206
|
+
const localeSubtag = locale.split('-').shift();
|
|
207
|
+
// Return
|
|
208
|
+
return {
|
|
209
|
+
locale,
|
|
210
|
+
messages: messages[localeSubtag] || messages[defaultLocale],
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const defaultLocale = 'en';
|
|
215
|
+
const messages = { en, fr };
|
|
216
|
+
/**
|
|
217
|
+
* Get Intl object
|
|
218
|
+
*
|
|
219
|
+
* @param {HTMLElement} element element we need to get the language
|
|
220
|
+
* @returns {{ locale: string; messages: Record<string, unknown> }} messages object
|
|
221
|
+
*/
|
|
222
|
+
const initLocales = (element) => getLocaleMessages(element, messages, defaultLocale);
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Available menu-item positions
|
|
226
|
+
*/
|
|
227
|
+
var ElementPosition;
|
|
228
|
+
(function (ElementPosition) {
|
|
229
|
+
ElementPosition["FIRST"] = "first";
|
|
230
|
+
ElementPosition["LAST"] = "last";
|
|
231
|
+
})(ElementPosition || (ElementPosition = {}));
|
|
232
|
+
/**
|
|
233
|
+
* Available menu item status
|
|
234
|
+
*/
|
|
235
|
+
var Status$1;
|
|
236
|
+
(function (Status) {
|
|
237
|
+
Status["VISIBLE"] = "visible";
|
|
238
|
+
Status["HIDDEN"] = "hidden";
|
|
239
|
+
Status["DISABLED"] = "disabled";
|
|
240
|
+
Status["ACTIVE"] = "active";
|
|
241
|
+
})(Status$1 || (Status$1 = {}));
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Menu direction type
|
|
245
|
+
*/
|
|
246
|
+
var Direction;
|
|
247
|
+
(function (Direction) {
|
|
248
|
+
Direction["VERTICAL"] = "vertical";
|
|
249
|
+
Direction["HORIZONTAL"] = "horizontal";
|
|
250
|
+
})(Direction || (Direction = {}));
|
|
251
|
+
/**
|
|
252
|
+
* More item type guard
|
|
253
|
+
*
|
|
254
|
+
* @param {unknown} element element to control
|
|
255
|
+
* @returns {boolean} truthy if element is more-item
|
|
256
|
+
*/
|
|
257
|
+
const isMoreItem = (element) => {
|
|
258
|
+
var _a, _b, _c;
|
|
259
|
+
const item = element;
|
|
260
|
+
return (item === undefined ||
|
|
261
|
+
(typeof item === 'object' &&
|
|
262
|
+
(typeof item.size === 'string' || typeof ((_a = item.mgIcon) === null || _a === void 0 ? void 0 : _a.icon) === 'string' || typeof ((_b = item.slotLabel) === null || _b === void 0 ? void 0 : _b.label) === 'string' || typeof ((_c = item.slotLabel) === null || _c === void 0 ? void 0 : _c.display) === 'boolean')));
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* List of all possibles sizes
|
|
5
266
|
*/
|
|
6
|
-
const
|
|
267
|
+
const sizes$2 = ['regular', 'medium', 'large'];
|
|
7
268
|
|
|
8
269
|
/**
|
|
9
270
|
* Create random ID
|
|
@@ -93,8 +354,208 @@ const isTagName = (element, tagNames) => {
|
|
|
93
354
|
* Focusable elements query selector
|
|
94
355
|
*/
|
|
95
356
|
const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';
|
|
357
|
+
/**
|
|
358
|
+
*
|
|
359
|
+
* @param {Window} localWindow the window we are lookink for other windows
|
|
360
|
+
* @returns {Window[]} The list of windows found
|
|
361
|
+
*/
|
|
362
|
+
const getWindows = (localWindow) => {
|
|
363
|
+
const parentWindows = getParentWindows(localWindow);
|
|
364
|
+
const childWindows = getChildWindows(localWindow);
|
|
365
|
+
return [localWindow, ...parentWindows, ...childWindows];
|
|
366
|
+
};
|
|
367
|
+
/**
|
|
368
|
+
* Get parent windows
|
|
369
|
+
*
|
|
370
|
+
* @param {Window} localWindow the window we are lookink for parents
|
|
371
|
+
* @param {Window[]} windows The list of allready found windows
|
|
372
|
+
* @returns {Window[]} The list of windows found
|
|
373
|
+
*/
|
|
374
|
+
const getParentWindows = (localWindow, windows = []) => {
|
|
375
|
+
// Check if is in iframe
|
|
376
|
+
if (localWindow.self !== localWindow.top) {
|
|
377
|
+
// Check if we have permission to access parent
|
|
378
|
+
try {
|
|
379
|
+
const parentWindow = localWindow.parent;
|
|
380
|
+
windows.push(parentWindow);
|
|
381
|
+
return getParentWindows(parentWindow, windows);
|
|
382
|
+
}
|
|
383
|
+
catch (err) {
|
|
384
|
+
console.error('Different hosts between iframes:', err);
|
|
385
|
+
return windows;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return windows;
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Get child windows
|
|
392
|
+
*
|
|
393
|
+
* @param {Window} localWindow the window we are lookink for children
|
|
394
|
+
* @param {Window[]} windows The list of allready found windows
|
|
395
|
+
* @returns {Window[]} The list of windows found
|
|
396
|
+
*/
|
|
397
|
+
const getChildWindows = (localWindow, windows = []) => {
|
|
398
|
+
if (localWindow.frames.length > 0) {
|
|
399
|
+
// Window.frames is an array-like object, needs a classic for loop
|
|
400
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/frames
|
|
401
|
+
for (let i = 0; i < localWindow.frames.length; i++) {
|
|
402
|
+
const childWindow = localWindow.frames[i];
|
|
403
|
+
windows.push(childWindow);
|
|
404
|
+
getChildWindows(childWindow, windows);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return windows;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
const mgActionMoreCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{--mg-popover-padding-vertical:1rem;--mg-popover-padding-horizontal:0}.mg-action-more__chevron{transition:200ms}.mg-action-more__chevron--rotate.mg-action-more__chevron{transform:rotate(180deg)}";
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* MgActionMore['items'] type guard
|
|
414
|
+
*
|
|
415
|
+
* @param {unknown} prop commponent items prop
|
|
416
|
+
* @returns {boolean} return true if type is valid
|
|
417
|
+
*/
|
|
418
|
+
const isMgActionMoreItems = (prop) => {
|
|
419
|
+
const items = prop;
|
|
420
|
+
return typeof items === 'object' && items.every(item => typeof item === 'object' && typeof item.label === 'string' && typeof item.mouseEventHandler === 'function');
|
|
421
|
+
};
|
|
422
|
+
/**
|
|
423
|
+
* MgActionMore['button'] type guard
|
|
424
|
+
*
|
|
425
|
+
* @param {unknown} prop commponent button prop
|
|
426
|
+
* @returns {boolean} return true if type is valid
|
|
427
|
+
*/
|
|
428
|
+
const isMgActionMoreButton = (prop) => {
|
|
429
|
+
const button = prop;
|
|
430
|
+
return typeof button === 'object' && typeof button.variant === 'string' && typeof button.isIcon === 'boolean';
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* MgActionMore['icon'] type guard
|
|
434
|
+
*
|
|
435
|
+
* @param {unknown} prop commponent icon prop
|
|
436
|
+
* @returns {boolean} return true if type is valid
|
|
437
|
+
*/
|
|
438
|
+
const isMgActionMoreIcon = (prop) => {
|
|
439
|
+
const icon = prop;
|
|
440
|
+
return typeof icon === 'object' && typeof icon.icon === 'string';
|
|
441
|
+
};
|
|
442
|
+
const MgActionMore = class {
|
|
443
|
+
constructor(hostRef) {
|
|
444
|
+
registerInstance(this, hostRef);
|
|
445
|
+
/************
|
|
446
|
+
* Internal *
|
|
447
|
+
************/
|
|
448
|
+
this.name = 'mg-action-more';
|
|
449
|
+
this.mgPopoverIdentifier = createID(this.name);
|
|
450
|
+
/************
|
|
451
|
+
* Merthods *
|
|
452
|
+
***********/
|
|
453
|
+
/**
|
|
454
|
+
* Toogle expanded props
|
|
455
|
+
*
|
|
456
|
+
* @returns {void}
|
|
457
|
+
*/
|
|
458
|
+
this.toggleExpanded = () => {
|
|
459
|
+
this.expanded = !this.expanded;
|
|
460
|
+
};
|
|
461
|
+
/**
|
|
462
|
+
* Button click handler
|
|
463
|
+
*
|
|
464
|
+
* @returns {void}
|
|
465
|
+
*/
|
|
466
|
+
this.handleButton = () => {
|
|
467
|
+
this.toggleExpanded();
|
|
468
|
+
};
|
|
469
|
+
/**
|
|
470
|
+
* Item click handler
|
|
471
|
+
*
|
|
472
|
+
* @param {MouseEvent} event click event
|
|
473
|
+
* @param {MgActionMoreItemType['mouseEventHandler']} customHandler item['mouseEventHandler']
|
|
474
|
+
* @returns {void}
|
|
475
|
+
*/
|
|
476
|
+
this.handleItemClick = (event, customHandler) => {
|
|
477
|
+
this.expanded = false;
|
|
478
|
+
customHandler(event);
|
|
479
|
+
};
|
|
480
|
+
this.icon = { icon: 'ellipsis' };
|
|
481
|
+
this.button = { variant: 'flat', isIcon: true };
|
|
482
|
+
this.items = undefined;
|
|
483
|
+
this.displayChevron = undefined;
|
|
484
|
+
this.expanded = false;
|
|
485
|
+
}
|
|
486
|
+
validateIcon(newValue) {
|
|
487
|
+
if (newValue && !isMgActionMoreIcon(newValue)) {
|
|
488
|
+
throw new Error(`<${this.name}> prop icon must match MgActionMoreIconType.`);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
validateButton(newValue) {
|
|
492
|
+
if (newValue && !isMgActionMoreButton(newValue)) {
|
|
493
|
+
throw new Error(`<${this.name}> prop button must match MgActionMoreButtonType.`);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
validateItems(newValue) {
|
|
497
|
+
if (!isMgActionMoreItems(newValue)) {
|
|
498
|
+
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType.`);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
validateDisplayChevron(newValue) {
|
|
502
|
+
if (newValue && this.button.isIcon === true) {
|
|
503
|
+
throw new Error(`<${this.name}> prop "displayChevron" can't be used with a 'button" prop "isIcon" attribute.`);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
/*************
|
|
507
|
+
* Lifecycle *
|
|
508
|
+
*************/
|
|
509
|
+
/**
|
|
510
|
+
* Validate props
|
|
511
|
+
*
|
|
512
|
+
* @returns {void}
|
|
513
|
+
*/
|
|
514
|
+
componentWillLoad() {
|
|
515
|
+
this.messages = initLocales(this.element).messages.actionMore;
|
|
516
|
+
this.validateItems(this.items);
|
|
517
|
+
this.validateButton(this.button);
|
|
518
|
+
this.validateIcon(this.icon);
|
|
519
|
+
this.validateDisplayChevron(this.displayChevron);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Render
|
|
523
|
+
*
|
|
524
|
+
* @returns {HTMLElement} HTML Element
|
|
525
|
+
*/
|
|
526
|
+
render() {
|
|
527
|
+
const buttonLabel = this.button.label || this.messages.label;
|
|
528
|
+
const buttonContent = [buttonLabel];
|
|
529
|
+
if (!this.button.isIcon && this.displayChevron) {
|
|
530
|
+
buttonContent.push(h("span", { class: {
|
|
531
|
+
[`${this.name}__chevron`]: true,
|
|
532
|
+
[`${this.name}__chevron--rotate`]: this.expanded === true,
|
|
533
|
+
'mg-a11y-animation': true,
|
|
534
|
+
} }, h("mg-icon", { icon: "chevron-down", size: "small" })));
|
|
535
|
+
}
|
|
536
|
+
return (h(Host, { "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { class: "mg-action-more" }, h("mg-popover", { identifier: this.mgPopoverIdentifier, display: this.expanded }, h("mg-button", { variant: this.button.variant, isIcon: this.button.isIcon, type: "button", label: buttonLabel, onClick: this.handleButton }, h("mg-icon", Object.assign({}, this.icon)), !this.button.isIcon && buttonContent), h("div", { slot: "content" }, h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.label }, this.items.map(item => {
|
|
537
|
+
var _a;
|
|
538
|
+
return (
|
|
539
|
+
// eslint-disable-next-line react/jsx-no-bind
|
|
540
|
+
h("mg-menu-item", { key: item.label, status: item.status || Status$1.VISIBLE, onClick: e => this.handleItemClick(e, item.mouseEventHandler), href: item.href }, item.icon && h("mg-icon", { icon: item.icon, slot: "image" }), h("span", { slot: "label" }, item.label), ((_a = item.badge) === null || _a === void 0 ? void 0 : _a.label) && h("mg-badge", { label: item.badge.label, value: item.badge.value, slot: "information", variant: "text-color" })));
|
|
541
|
+
})))))));
|
|
542
|
+
}
|
|
543
|
+
get element() { return getElement(this); }
|
|
544
|
+
static get watchers() { return {
|
|
545
|
+
"icon": ["validateIcon"],
|
|
546
|
+
"button": ["validateButton"],
|
|
547
|
+
"items": ["validateItems"],
|
|
548
|
+
"displayChevron": ["validateDisplayChevron"]
|
|
549
|
+
}; }
|
|
550
|
+
};
|
|
551
|
+
MgActionMore.style = mgActionMoreCss;
|
|
96
552
|
|
|
97
|
-
|
|
553
|
+
/**
|
|
554
|
+
* List of all possibles variants
|
|
555
|
+
*/
|
|
556
|
+
const variants$4 = ['info', 'primary', 'secondary', 'success', 'warning', 'danger', 'text-color'];
|
|
557
|
+
|
|
558
|
+
const mgBadgeCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-badge{padding:0 0.4rem;height:var(--mg-badge-size);min-width:var(--mg-badge-size);box-sizing:border-box;border:0.1rem solid;border-radius:calc(var(--mg-badge-size) / 2);font-size:var(--mg-badge-font-size);font-weight:600;text-align:center;line-height:var(--mg-badge-size)}.mg-badge.mg-badge--primary{background-color:hsl(var(--color-dark));border-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-badge.mg-badge--primary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary{background-color:hsl(var(--color-light));border-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-light))}.mg-badge.mg-badge--success{background-color:hsl(var(--color-success));border-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-badge.mg-badge--success.mg-badge--outline{background-color:transparent;color:hsl(var(--color-success))}.mg-badge.mg-badge--warning{background-color:hsl(var(--color-warning));border-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-badge.mg-badge--warning.mg-badge--outline{background-color:transparent;color:hsl(var(--color-warning))}.mg-badge.mg-badge--danger{background-color:hsl(var(--color-danger));border-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-badge.mg-badge--danger.mg-badge--outline{background-color:transparent;color:hsl(var(--color-danger))}.mg-badge.mg-badge--info{background-color:hsl(var(--color-info));border-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-badge.mg-badge--info.mg-badge--outline{background-color:transparent;color:hsl(var(--color-info))}.mg-badge.mg-badge--text-color{background-color:currentColor;border-color:currentColor}.mg-badge.mg-badge--text-color .mg-badge__value{color:hsl(var(--mg-badge-text-color, var(--color-light)))}.mg-badge.mg-badge--text-color.mg-badge--outline{background-color:transparent}.mg-badge.mg-badge--text-color.mg-badge--outline .mg-badge__value{color:currentColor}.mg-badge,mg-badge{display:inline-flex;align-items:center;justify-content:center}";
|
|
98
559
|
|
|
99
560
|
const MgBadge = class {
|
|
100
561
|
constructor(hostRef) {
|
|
@@ -112,7 +573,7 @@ const MgBadge = class {
|
|
|
112
573
|
}
|
|
113
574
|
validateValue(newValue) {
|
|
114
575
|
if (`${newValue}`.match(/^(\d+\+*|[?*!a-z])$/i) === null) {
|
|
115
|
-
throw new Error('<mg-badge> prop "value" must be
|
|
576
|
+
throw new Error('<mg-badge> prop "value" must be integer or ponctuation character.');
|
|
116
577
|
}
|
|
117
578
|
}
|
|
118
579
|
validateLabel(newValue) {
|
|
@@ -122,7 +583,7 @@ const MgBadge = class {
|
|
|
122
583
|
}
|
|
123
584
|
validateVariant(newValue, oldValue) {
|
|
124
585
|
if (!variants$4.includes(newValue)) {
|
|
125
|
-
throw new Error(`<mg-badge> prop "variant" must be one of
|
|
586
|
+
throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}.`);
|
|
126
587
|
}
|
|
127
588
|
else {
|
|
128
589
|
if (oldValue !== undefined) {
|
|
@@ -154,7 +615,7 @@ const MgBadge = class {
|
|
|
154
615
|
* @returns {HTMLElement} HTML Element
|
|
155
616
|
*/
|
|
156
617
|
render() {
|
|
157
|
-
return (h("span", { class: this.classList.join() }, this.value, h("span", { class: "sr-only" }, this.label)));
|
|
618
|
+
return (h("span", { class: this.classList.join() }, h("span", { class: "mg-badge__value" }, this.value), h("span", { class: "sr-only" }, this.label)));
|
|
158
619
|
}
|
|
159
620
|
static get watchers() { return {
|
|
160
621
|
"value": ["validateValue"],
|
|
@@ -170,7 +631,7 @@ MgBadge.style = mgBadgeCss;
|
|
|
170
631
|
*/
|
|
171
632
|
const variants$3 = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success', 'link'];
|
|
172
633
|
|
|
173
|
-
const mgButtonCss = ":host{display:inline-block;vertical-align:middle;max-width:100%}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:0.2rem}:host(:hover) .mg-button--flat:not(.mg-button--disabled)
|
|
634
|
+
const mgButtonCss = ":host{display:inline-block;vertical-align:middle;max-width:100%}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-button{outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:0.2rem}:host(:hover) .mg-button--flat:not(.mg-button--disabled){background:hsl(var(--color-dark), 0.1)}:host([full-width]){display:block}:host([disabled]),:host([aria-disabled=true]){pointer-events:none}.mg-button.mg-button--primary{border-color:hsl(var(--mg-button-primary-border-color, var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-primary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--primary:not(.mg-button--disabled){background:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l))}.mg-button.mg-button--secondary{border-color:hsl(var(--mg-button-secondary-border-color, var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-secondary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--secondary:not(.mg-button--disabled){background:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l))}.mg-button.mg-button--danger{border-color:hsl(var(--mg-button-danger-border-color, var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--danger:not(.mg-button--disabled){background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-button.mg-button--danger-alt{border-color:hsl(var(--mg-button-danger-alt-border-color, var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-danger));background:linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--danger-alt:not(.mg-button--disabled){background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))}.mg-button.mg-button--info{border-color:hsl(var(--mg-button-info-border-color, var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--info:not(.mg-button--disabled){background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-button.mg-button--success{border-color:hsl(var(--mg-button-success-border-color, var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-dark));background:linear-gradient(to bottom, hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l)), hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--success:not(.mg-button--disabled){background:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-button{position:relative;display:inline-flex;align-items:center;column-gap:0.6rem;padding:calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;min-height:var(--default-size);box-sizing:border-box;border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));cursor:pointer;background-image:none;border-top-width:var(--mg-button-border-top-width, 0.1rem);border-right-width:var(--mg-button-border-right-width, 0.1rem);border-bottom-width:var(--mg-button-border-bottom-width, 0.1rem);border-left-width:var(--mg-button-border-left-width, 0.1rem);border-style:solid;text-decoration:none;font-family:inherit;font-weight:var(--mg-button-font-weight, normal);text-align:left;font-size:var(--font-size);touch-action:manipulation}.mg-button.mg-button--disabled{opacity:var(--mg-button-disabled-opacity);cursor:default}.mg-button.mg-button--icon{padding:0;justify-content:center;width:var(--default-size);height:var(--default-size);border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));font-size:var(--font-size);line-height:var(--font-size)}.mg-button.mg-button--flat{background:none;border:none}.mg-button.mg-button--link{padding:unset;min-height:unset;background:unset;border:unset;border-radius:unset;text-decoration:underline}.mg-button.mg-button--link slot{font-weight:600}.mg-button.mg-button--link:hover{text-decoration:none}.mg-button.mg-button--full-width{display:flex;justify-content:center}.mg-button.mg-button--loading>mg-icon:first-of-type{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.mg-button.mg-button--loading .mg-button__content{opacity:0}.mg-button mg-icon:only-child,.mg-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;line-height:1;margin:auto 0}.mg-button slot,.mg-button ::slotted(*:not(mg-icon)){text-decoration:none;font-family:inherit;font-weight:var(--mg-button-font-weight, normal);text-align:left;font-size:var(--font-size);display:flex;align-items:center;column-gap:0.6rem}";
|
|
174
635
|
|
|
175
636
|
const MgButton = class {
|
|
176
637
|
constructor(hostRef) {
|
|
@@ -238,7 +699,7 @@ const MgButton = class {
|
|
|
238
699
|
}
|
|
239
700
|
validateVariant(newValue, oldValue) {
|
|
240
701
|
if (!variants$3.includes(newValue)) {
|
|
241
|
-
throw new Error(`<mg-button> prop "variant" must be one of
|
|
702
|
+
throw new Error(`<mg-button> prop "variant" must be one of: ${variants$3.join(', ')}`);
|
|
242
703
|
}
|
|
243
704
|
else {
|
|
244
705
|
if (oldValue !== undefined) {
|
|
@@ -294,212 +755,50 @@ const MgButton = class {
|
|
|
294
755
|
if (this.isIcon) {
|
|
295
756
|
this.classList.add(`mg-button--icon`);
|
|
296
757
|
if (typeof this.label !== 'string' || this.label.trim() === '') {
|
|
297
|
-
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
// Store the onclick fn
|
|
301
|
-
this.onClickElementFn = this.element.onclick;
|
|
302
|
-
this.disabledHandler(this.disabled);
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Render component
|
|
306
|
-
*
|
|
307
|
-
* @returns {HTMLElement} html element
|
|
308
|
-
*/
|
|
309
|
-
render() {
|
|
310
|
-
return (h(Host, { role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { class: this.classList.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null)))));
|
|
311
|
-
}
|
|
312
|
-
get element() { return getElement(this); }
|
|
313
|
-
static get watchers() { return {
|
|
314
|
-
"variant": ["validateVariant"],
|
|
315
|
-
"fullWidth": ["validateFullWidth"],
|
|
316
|
-
"disabled": ["disabledHandler"],
|
|
317
|
-
"loading": ["loadingHandler"]
|
|
318
|
-
}; }
|
|
319
|
-
};
|
|
320
|
-
MgButton.style = mgButtonCss;
|
|
321
|
-
|
|
322
|
-
const mgCardCss = ".mg-card{position:relative;width:100%;padding:var(--mg-card-padding);overflow:var(--mg-card-overflow);box-sizing:border-box;z-index:inherit;background:var(--mg-card-background);border:var(--mg-card-border);border-radius:var(--mg-card-border-radius);box-shadow:var(--mg-card-box-shadow)}";
|
|
323
|
-
|
|
324
|
-
const MgCard = class {
|
|
325
|
-
constructor(hostRef) {
|
|
326
|
-
registerInstance(this, hostRef);
|
|
327
|
-
}
|
|
328
|
-
/*************
|
|
329
|
-
* Lifecycle *
|
|
330
|
-
*************/
|
|
331
|
-
/**
|
|
332
|
-
* Render
|
|
333
|
-
*
|
|
334
|
-
* @returns {HTMLElement} HTML Element
|
|
335
|
-
*/
|
|
336
|
-
render() {
|
|
337
|
-
return (h("div", { class: "mg-card" }, h("slot", null)));
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
MgCard.style = mgCardCss;
|
|
341
|
-
|
|
342
|
-
const errors$1 = {
|
|
343
|
-
required: "This field is required.",
|
|
344
|
-
date: {
|
|
345
|
-
badInput: "The date format must be <span aria-hidden=\"true\">mm/dd/yyyy</span><span class=\"sr-only\">m m / d d / y y y y</span> and the date must be greater than {min}",
|
|
346
|
-
min: "The date cannot be earlier than {min}",
|
|
347
|
-
max: "The date cannot be later than {max}",
|
|
348
|
-
minMax: "The date must be between {min} and {max}"
|
|
349
|
-
},
|
|
350
|
-
numeric: {
|
|
351
|
-
min: "The value cannot be less than {min}",
|
|
352
|
-
max: "The value cannot be greater than {max}",
|
|
353
|
-
minMax: "The value must be between {min} et {max}"
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
const nbCharLeft$1 = "{counter} characters left.";
|
|
357
|
-
const input$1 = {
|
|
358
|
-
select: {
|
|
359
|
-
placeholder: "Select a value"
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
const form$1 = {
|
|
363
|
-
required: "Fields with a <strong class=\"is-asterisk\">*</strong> are required",
|
|
364
|
-
allRequired: "All fields are required"
|
|
365
|
-
};
|
|
366
|
-
const message$1 = {
|
|
367
|
-
closeButton: "Close message"
|
|
368
|
-
};
|
|
369
|
-
const modal$1 = {
|
|
370
|
-
closeButton: "Close modal"
|
|
371
|
-
};
|
|
372
|
-
const pagination$1 = {
|
|
373
|
-
label: "Pagination",
|
|
374
|
-
page: "page",
|
|
375
|
-
pages: "pages",
|
|
376
|
-
nextPage: "Next page",
|
|
377
|
-
previousPage: "Previous page",
|
|
378
|
-
selectPage: "Select the page to display."
|
|
379
|
-
};
|
|
380
|
-
const panel$1 = {
|
|
381
|
-
editLabel: "Edit section title."
|
|
382
|
-
};
|
|
383
|
-
const skipLinks$1 = {
|
|
384
|
-
navLabel: "Quick access"
|
|
385
|
-
};
|
|
386
|
-
const general$1 = {
|
|
387
|
-
confirm: "Confirm",
|
|
388
|
-
cancel: "Cancel",
|
|
389
|
-
close: "Close",
|
|
390
|
-
next: "next",
|
|
391
|
-
previous: "previous"
|
|
392
|
-
};
|
|
393
|
-
const en = {
|
|
394
|
-
errors: errors$1,
|
|
395
|
-
nbCharLeft: nbCharLeft$1,
|
|
396
|
-
input: input$1,
|
|
397
|
-
form: form$1,
|
|
398
|
-
message: message$1,
|
|
399
|
-
modal: modal$1,
|
|
400
|
-
pagination: pagination$1,
|
|
401
|
-
panel: panel$1,
|
|
402
|
-
skipLinks: skipLinks$1,
|
|
403
|
-
general: general$1
|
|
758
|
+
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
// Store the onclick fn
|
|
762
|
+
this.onClickElementFn = this.element.onclick;
|
|
763
|
+
this.disabledHandler(this.disabled);
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Render component
|
|
767
|
+
*
|
|
768
|
+
* @returns {HTMLElement} html element
|
|
769
|
+
*/
|
|
770
|
+
render() {
|
|
771
|
+
return (h(Host, { role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { class: this.classList.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null)))));
|
|
772
|
+
}
|
|
773
|
+
get element() { return getElement(this); }
|
|
774
|
+
static get watchers() { return {
|
|
775
|
+
"variant": ["validateVariant"],
|
|
776
|
+
"fullWidth": ["validateFullWidth"],
|
|
777
|
+
"disabled": ["disabledHandler"],
|
|
778
|
+
"loading": ["loadingHandler"]
|
|
779
|
+
}; }
|
|
404
780
|
};
|
|
781
|
+
MgButton.style = mgButtonCss;
|
|
405
782
|
|
|
406
|
-
const
|
|
407
|
-
required: "Ce champ est obligatoire.",
|
|
408
|
-
date: {
|
|
409
|
-
badInput: "Le format de la date doit être du type <span aria-hidden=\"true\">jj/mm/aaaa</span><span class=\"sr-only\">j j / m m / a a a a</span> et la date supérieure au {min}",
|
|
410
|
-
min: "La date ne peut pas être antérieure au {min}",
|
|
411
|
-
max: "La date ne peut pas être postérieure au {max}",
|
|
412
|
-
minMax: "La date doit être comprise entre le {min} et le {max}"
|
|
413
|
-
},
|
|
414
|
-
numeric: {
|
|
415
|
-
min: "La valeur ne peut pas être inférieure à {min}",
|
|
416
|
-
max: "La valeur ne peut pas être supérieure à {max}",
|
|
417
|
-
minMax: "La valeur doit être comprise entre {min} et {max}"
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
const nbCharLeft = "{counter} caractères disponibles.";
|
|
421
|
-
const input = {
|
|
422
|
-
select: {
|
|
423
|
-
placeholder: "Sélectionnez une valeur"
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
const form = {
|
|
427
|
-
required: "Les champs marqués d'un <strong class=\"is-asterisk\">*</strong> sont obligatoires",
|
|
428
|
-
allRequired: "Tous les champs sont obligatoires"
|
|
429
|
-
};
|
|
430
|
-
const message = {
|
|
431
|
-
closeButton: "Fermer le message"
|
|
432
|
-
};
|
|
433
|
-
const modal = {
|
|
434
|
-
closeButton: "Fermer la modale"
|
|
435
|
-
};
|
|
436
|
-
const pagination = {
|
|
437
|
-
label: "Pagination",
|
|
438
|
-
page: "page",
|
|
439
|
-
pages: "pages",
|
|
440
|
-
nextPage: "Page suivante",
|
|
441
|
-
previousPage: "Page précédente",
|
|
442
|
-
selectPage: "Sélectionner la page à afficher."
|
|
443
|
-
};
|
|
444
|
-
const panel = {
|
|
445
|
-
editLabel: "Modifier le titre de la section."
|
|
446
|
-
};
|
|
447
|
-
const skipLinks = {
|
|
448
|
-
navLabel: "Accès rapide"
|
|
449
|
-
};
|
|
450
|
-
const general = {
|
|
451
|
-
confirm: "Valider",
|
|
452
|
-
cancel: "Annuler",
|
|
453
|
-
close: "Fermer",
|
|
454
|
-
next: "suivant",
|
|
455
|
-
previous: "précédent"
|
|
456
|
-
};
|
|
457
|
-
const fr = {
|
|
458
|
-
errors: errors,
|
|
459
|
-
nbCharLeft: nbCharLeft,
|
|
460
|
-
input: input,
|
|
461
|
-
form: form,
|
|
462
|
-
message: message,
|
|
463
|
-
modal: modal,
|
|
464
|
-
pagination: pagination,
|
|
465
|
-
panel: panel,
|
|
466
|
-
skipLinks: skipLinks,
|
|
467
|
-
general: general
|
|
468
|
-
};
|
|
783
|
+
const mgCardCss = ".mg-card{position:relative;width:100%;padding:var(--mg-card-padding, var(--mg-card-padding-default));overflow:var(--mg-card-overflow, var(--mg-card-overflow-default));box-sizing:border-box;z-index:inherit;background:var(--mg-card-background, var(--mg-card-background-default));border:var(--mg-card-border, var(--mg-card-border-default));border-radius:var(--mg-card-border-radius, var(--mg-card-border-radius-default));box-shadow:var(--mg-card-box-shadow, var(--mg-card-box-shadow-default))}.mg-card ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}";
|
|
469
784
|
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
* Get Intl object
|
|
486
|
-
* We load the defined locale but for now we only support the first subtag for messages
|
|
487
|
-
*
|
|
488
|
-
* @param {HTMLElement} element element we need to get the language
|
|
489
|
-
* @returns {{ locale: string; messages: unknown }} messages object
|
|
490
|
-
*/
|
|
491
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
492
|
-
const initLocales = (element) => {
|
|
493
|
-
// Get local
|
|
494
|
-
const locale = getLocale(element);
|
|
495
|
-
// Only keep first subtag
|
|
496
|
-
const localeSubtag = locale.split('-').shift();
|
|
497
|
-
// Return
|
|
498
|
-
return {
|
|
499
|
-
locale,
|
|
500
|
-
messages: messages[localeSubtag] || messages[defaultLocale],
|
|
501
|
-
};
|
|
785
|
+
const MgCard = class {
|
|
786
|
+
constructor(hostRef) {
|
|
787
|
+
registerInstance(this, hostRef);
|
|
788
|
+
}
|
|
789
|
+
/*************
|
|
790
|
+
* Lifecycle *
|
|
791
|
+
*************/
|
|
792
|
+
/**
|
|
793
|
+
* Render
|
|
794
|
+
*
|
|
795
|
+
* @returns {HTMLElement} HTML Element
|
|
796
|
+
*/
|
|
797
|
+
render() {
|
|
798
|
+
return (h("div", { class: "mg-card" }, h("slot", null)));
|
|
799
|
+
}
|
|
502
800
|
};
|
|
801
|
+
MgCard.style = mgCardCss;
|
|
503
802
|
|
|
504
803
|
const mgCharacterLeftCss = "mg-character-left.sc-mg-character-left{display:block}";
|
|
505
804
|
|
|
@@ -645,12 +944,12 @@ const MgForm = class {
|
|
|
645
944
|
// All fields are required
|
|
646
945
|
// mg-input-toggle can not be required
|
|
647
946
|
if (requiredInputs.length > 0 && requiredInputs.length === this.mgInputs.filter(input => input.nodeName !== 'MG-INPUT-TOGGLE').length) {
|
|
648
|
-
this.requiredMessage = this.messages.form.allRequired;
|
|
947
|
+
this.requiredMessage = requiredInputs.length === 1 ? this.messages.form.allRequiredSingle : this.messages.form.allRequired;
|
|
649
948
|
this.classList.add(this.classAllRequired);
|
|
650
949
|
}
|
|
651
950
|
// Some fields are required
|
|
652
951
|
else if (requiredInputs.length > 0) {
|
|
653
|
-
this.requiredMessage = this.messages.form.required;
|
|
952
|
+
this.requiredMessage = requiredInputs.length === 1 ? this.messages.form.requiredSingle : this.messages.form.required;
|
|
654
953
|
}
|
|
655
954
|
}
|
|
656
955
|
};
|
|
@@ -801,6 +1100,7 @@ const icons = {
|
|
|
801
1100
|
'archive': () => (h("path", { fill: "currentColor", d: "M3 6v6.96c0 .57.46 1.04 1.04 1.04H12c.55 0 1-.45 1-1V6H3Zm7 2H6V7h4v1Zm3-3H3c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h10c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1Z" })),
|
|
802
1101
|
'archive-outline': () => (h("path", { fill: "currentColor", d: "M13 2H3c-.55 0-1 .45-1 1v2c0 .55.45 1 1 1v6.96c0 .57.46 1.04 1.04 1.04H12c.55 0 1-.45 1-1V6c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1Zm-1 11H4.04S4 12.98 4 12.96V6h8v7Zm1-8H3V3h10v2Zm-3 3H6V7h4v1Z" })),
|
|
803
1102
|
'arrow-down': () => (h("path", { fill: "currentColor", d: "M13,10.1H10.23a.31.31,0,0,1-.32-.28h0V.94A.3.3,0,0,0,9.59.65H6.37A.32.32,0,0,0,6,.94H6V9.81a.29.29,0,0,1-.31.29H3a.3.3,0,0,0-.31.29.27.27,0,0,0,.08.22l5.06,4.58a.36.36,0,0,0,.46,0l5-4.58a.29.29,0,0,0,0-.42C13.22,10.1,13.12,10.1,13,10.1Z" })),
|
|
1103
|
+
'arrow-down-a-z': () => (h("path", { fill: "currentColor", d: "m6.53 10.9-1.41 1.41-.71.71-2.12-2.12.71-.71.88.88V3.02h1v8.12l.95-.95.71.71ZM12.29 6H10.5l-.36 1H9.08l1.79-5h1.05l1.79 5h-1.06l-.36-1Zm-.36-1.02-.53-1.49-.53 1.49h1.06Zm1.79 5.18V9H9.09v1h3.29l-3.29 2.84V14h4.63v-1h-3.29l3.29-2.84Z" })),
|
|
804
1104
|
'arrow-down-right': () => (h("path", { fill: "currentColor", d: "m1.98 3.47 8.75 8.75H6.94c-.58 0-1.05.47-1.05 1.06s.47 1.05 1.05 1.05h6.33c.58 0 1.05-.47 1.05-1.05V6.94a1.05 1.05 0 1 0-2.1 0v3.79L3.47 1.98c-.41-.41-1.08-.41-1.49 0-.41.41-.41 1.08 0 1.49Z" })),
|
|
805
1105
|
'arrow-left': () => (h("path", { fill: "currentColor", d: "M5.88,12.93V10.18a.3.3,0,0,1,.28-.32H15a.31.31,0,0,0,.29-.33h0V6.32A.31.31,0,0,0,15,6H6.17a.32.32,0,0,1-.29-.31h0V2.93a.3.3,0,0,0-.28-.32.32.32,0,0,0-.23.09L.79,7.76a.36.36,0,0,0,0,.46l4.58,5a.31.31,0,0,0,.43,0A.4.4,0,0,0,5.88,12.93Z" })),
|
|
806
1106
|
'arrow-right': () => (h("path", { fill: "currentColor", d: "M10.16,3V5.75a.3.3,0,0,1-.28.32H1a.31.31,0,0,0-.29.33h0V9.61A.31.31,0,0,0,1,9.94H9.87a.29.29,0,0,1,.29.31h0V13a.3.3,0,0,0,.28.32.32.32,0,0,0,.23-.09l4.58-5.06a.36.36,0,0,0,0-.46l-4.58-5a.3.3,0,0,0-.42,0C10.16,2.76,10.16,2.87,10.16,3Z" })),
|
|
@@ -809,6 +1109,7 @@ const icons = {
|
|
|
809
1109
|
'arrow-up': () => (h("path", { fill: "currentColor", d: "M3.06,5.82H5.81a.31.31,0,0,1,.32.28h0V15a.31.31,0,0,0,.33.29H9.67A.3.3,0,0,0,10,15h0V6.11a.3.3,0,0,1,.31-.29h2.75a.3.3,0,0,0,.23-.51L8.23.73a.36.36,0,0,0-.46,0l-5,4.58a.3.3,0,0,0,0,.43C2.82,5.83,2.92,5.82,3.06,5.82Z" })),
|
|
810
1110
|
'arrow-up-right': () => (h("path", { fill: "currentColor", d: "m3.47 14.02 8.75-8.75v3.78c0 .58.47 1.05 1.06 1.05s1.05-.47 1.05-1.05V2.72c0-.58-.47-1.05-1.05-1.05H6.94a1.05 1.05 0 1 0 0 2.1h3.78l-8.74 8.76c-.41.41-.41 1.08 0 1.49s1.08.41 1.49 0Z" })),
|
|
811
1111
|
'arrow-up-right-square': () => (h("path", { fill: "currentColor", d: "M14.33 3v10A1.34 1.34 0 0 1 13 14.33H3A1.34 1.34 0 0 1 1.67 13V3A1.34 1.34 0 0 1 3 1.67h10A1.34 1.34 0 0 1 14.33 3Zm-2.48.46H8.68a.67.67 0 0 0-.68.7.63.63 0 0 0 .2.47l.91.91-5.53 5.53a.33.33 0 0 0 0 .48l.87.87a.33.33 0 0 0 .48 0l5.53-5.52.91.9a.69.69 0 0 0 1 0 .71.71 0 0 0 .19-.48V4.15a.67.67 0 0 0-.67-.67Z" })),
|
|
1112
|
+
'arrow-up-z-a': () => (h("path", { fill: "currentColor", d: "m5.82 5.85-.94-.94v8.11h-1V4.96l-.89.89-.71-.71 1.41-1.41.71-.71.71.71 1.41 1.41-.71.71ZM12.29 13H10.5l-.36 1H9.08l1.79-5h1.05l1.79 5h-1.06l-.36-1Zm-.36-1.02-.53-1.49-.53 1.49h1.06Zm1.79-8.82V2H9.09v1h3.29L9.09 5.84V7h4.63V6h-3.29l3.29-2.84Z" })),
|
|
812
1113
|
'arrows-compare': () => h("path", { fill: "currentColor", d: "M5.81 9.47H.67v1.47h5.14v2.2l2.93-2.93-2.93-2.93v2.2Zm4.39-.73v-2.2h5.14V5.07H10.2v-2.2L7.27 5.8l2.93 2.93Z" }),
|
|
813
1114
|
'arrows-right-down': () => (h("path", { fill: "currentColor", d: "M10.68 10.78c.16.17.16.45-.02.61l-2.8 2.78a.43.43 0 0 1-.31.12.42.42 0 0 1-.31-.12l-2.8-2.78a.44.44 0 0 1 0-.62.44.44 0 0 1 .62 0l2.06 2.05V5.38H2.11c-.24 0-.44-.19-.44-.44 0-.24.2-.44.44-.44H8v8.32l2.06-2.05a.44.44 0 0 1 .62 0Zm3.53-6.14-2.78-2.8a.438.438 0 0 0-.61-.02.44.44 0 0 0 0 .62l2.05 2.06H8.89v.88h3.98l-2.05 2.06a.44.44 0 0 0 0 .62c.17.17.45.17.62 0l2.78-2.8s.07-.09.09-.14c.02-.05.03-.11.03-.17 0-.11-.04-.23-.12-.31Z" })),
|
|
814
1115
|
'arrows-right-left': () => (h("path", { fill: "currentColor", d: "M.73,5.65V5.23a.64.64,0,0,1,.64-.64H12V3.31a.64.64,0,0,1,.64-.64.63.63,0,0,1,.45.18L15.19,5a.63.63,0,0,1,0,.9L13.05,8A.65.65,0,0,1,12,7.57V6.29H1.37a.64.64,0,0,1-.64-.64Zm14,4.06H4.09V8.43A.64.64,0,0,0,3,8L.87,10.11a.63.63,0,0,0,0,.9L3,13.15a.64.64,0,0,0,.91,0,.61.61,0,0,0,.18-.45V11.41H14.73a.63.63,0,0,0,.64-.64h0v-.42a.63.63,0,0,0-.64-.64Z" })),
|
|
@@ -819,8 +1120,13 @@ const icons = {
|
|
|
819
1120
|
'briefcase': () => (h("path", { fill: "currentColor", d: "M14 4.5h-3v-1c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H2c-.55 0-1 .45-1 1v7c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-7c0-.55-.45-1-1-1Zm-8-1h4v1H6v-1Z" })),
|
|
820
1121
|
'briefcase-outline': () => (h("path", { fill: "currentColor", d: "M14 4.5h-3v-1c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H2c-.55 0-1 .45-1 1v7c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-7c0-.55-.45-1-1-1Zm-8-1h4v1H6v-1Zm8 9H2v-7h12v7Z" })),
|
|
821
1122
|
'calculator': () => (h("path", { fill: "currentColor", d: "M12.83.67H3.17a.5.5 0 0 0-.5.5v13.66a.5.5 0 0 0 .5.5h9.66a.5.5 0 0 0 .5-.5V1.17a.5.5 0 0 0-.5-.5ZM5.58 13.39a.29.29 0 0 1-.28.3H4.1a.29.29 0 0 1-.3-.28v-1.2a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm0-3.28a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V8.93a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm3.29 3.28a.29.29 0 0 1-.3.3H7.38a.29.29 0 0 1-.3-.3v-1.18a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm0-3.28a.32.32 0 0 1-.3.3H7.38a.32.32 0 0 1-.3-.3V8.93a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm3.33 3.28a.29.29 0 0 1-.28.3h-1.25a.29.29 0 0 1-.3-.28V8.93a.29.29 0 0 1 .28-.3h1.25a.29.29 0 0 1 .3.28v4.48Zm0-7.15a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V2.61a.29.29 0 0 1 .28-.3h7.82a.29.29 0 0 1 .3.28v3.65Z" })),
|
|
822
|
-
'calendar': () => (h("path", { fill: "currentColor", d: "M14
|
|
823
|
-
'calendar-
|
|
1123
|
+
'calendar': () => (h("path", { fill: "currentColor", d: "M14 3.5c0-.55-.45-1-1-1h-1v-1h-1v1H5v-1H4v1H3c-.55 0-1 .45-1 1v.98s0 .02.02.02H2v9c0 .55.45 1 1 1h10c.55 0 1-.45 1-1v-9h-.02s.02 0 .02-.02V3.5Zm-11 10v-8h10v8H3Z" })),
|
|
1124
|
+
'calendar-outline': () => (h("path", { fill: "currentColor", d: "M13 2.5h-1v-1h-1v1H5v-1H4v1H3c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h10c.55 0 1-.45 1-1v-10c0-.55-.45-1-1-1Zm-10 11v-8h10v8H3Zm0-9v-1h10v1H3Z" })),
|
|
1125
|
+
'calendar-euro': () => [
|
|
1126
|
+
h("path", { key: "calendar-euro-1", d: "M13 2.5h-1v-1h-1v1H5v-1H4v1H3c-.6 0-1 .4-1 1v10c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-10c0-.6-.4-1-1-1Zm-10 11v-8h10v8H3Z" }),
|
|
1127
|
+
h("path", { key: "calendar-euro-2", d: "m9.79 11.03.71.71c-.53.48-1.23.78-2 .78-1.31 0-2.43-.85-2.83-2.02H4.5v-.75h1.02c-.02-.07-.02-.15-.02-.23 0-.09 0-.18.02-.27H4.5V8.5h1.19a2.974 2.974 0 0 1 4.81-1.2l-.71.71c-.35-.3-.8-.49-1.29-.49-.73 0-1.37.39-1.72.98h1.75v.75H6.52c-.01.09-.02.18-.02.27 0 .08 0 .16.01.23h2.02v.75H6.76c.34.61 1 1.02 1.74 1.02.49 0 .94-.19 1.29-.49Z" }),
|
|
1128
|
+
],
|
|
1129
|
+
'calendar-euro-outline': () => (h("path", { d: "m9.79 11.02.71.71a2.976 2.976 0 0 1-4.83-1.24H4.5v-.75h1.01c-.01-.08-.01-.15-.01-.23 0-.09 0-.18.02-.27H4.5v-.75h1.19a2.974 2.974 0 0 1 4.81-1.2L9.79 8c-.35-.3-.8-.49-1.29-.49-.73 0-1.37.39-1.72.98h1.75v.75H6.52c-.01.09-.02.18-.02.27 0 .08 0 .16.01.23h2.02v.75H6.76c.34.61 1 1.02 1.74 1.02.49 0 .94-.19 1.29-.49ZM13 3.5v1H3v-1h10m-1-2h-1v1H5v-1H4v1H3c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h10c.55 0 1-.45 1-1v-10c0-.55-.45-1-1-1h-1v-1Zm-9 12v-8h10v8H3Z" })),
|
|
824
1130
|
'check': () => (h("path", { fill: "currentColor", d: "m15.27 4.23-1.11-1.18c-.11-.1-.27-.1-.38 0L6 10.36l-3.76-4a.187.187 0 0 0-.26 0L.71 7.6c-.07.07-.07.19 0 .26l5.12 5.41c.07.07.18.07.25 0l1.3-1.23 7.87-7.45c.1-.1.11-.26.01-.37h.01Z" })),
|
|
825
1131
|
'check-circle': () => (h("path", { fill: "currentColor", d: "M15.33 8A7.33 7.33 0 1 1 8 .67 7.33 7.33 0 0 1 15.33 8Zm-8.18 3.88 5.44-5.44a.46.46 0 0 0 0-.65l-.67-.67a.48.48 0 0 0-.67 0L6.82 9.54 4.75 7.47a.46.46 0 0 0-.65 0l-.67.67a.46.46 0 0 0 0 .65l3.07 3.07a.46.46 0 0 0 .65 0Z" })),
|
|
826
1132
|
'chevron-down': () => (h("path", { fill: "currentColor", d: "M7.43,12.21.9,5.69a.81.81,0,0,1,0-1.14h0l.76-.77a.81.81,0,0,1,1.14,0L8,9l5.2-5.18a.81.81,0,0,1,1.14,0l.76.77a.8.8,0,0,1,0,1.13h0L8.57,12.21a.79.79,0,0,1-1.13,0Z" })),
|
|
@@ -832,10 +1138,12 @@ const icons = {
|
|
|
832
1138
|
'chevron-up': () => (h("path", { fill: "currentColor", d: "M8.57,3.79l6.53,6.52a.81.81,0,0,1,0,1.14h0l-.76.77a.81.81,0,0,1-1.14,0L8,7,2.8,12.22a.81.81,0,0,1-1.14,0L.9,11.45a.8.8,0,0,1,0-1.13h0L7.43,3.79a.79.79,0,0,1,1.13,0Z" })),
|
|
833
1139
|
'chevron-up-circle': () => (h("path", { fill: "currentColor", d: "M.67 8C.67 3.95 3.95.67 8 .67S15.33 3.95 15.33 8 12.05 15.33 8 15.33C3.95 15.33.67 12.05.67 8ZM7.5 4.63l-4 4c-.28.27-.28.71-.01.99h.01l.5.53c.28.27.72.27 1 0l3-3 3 3c.28.27.72.27 1 0l.5-.51c.28-.27.28-.71.01-.99h-.01l-4-4.01a.697.697 0 0 0-.99-.01H7.5Z" })),
|
|
834
1140
|
'clock': () => (h("path", { fill: "currentColor", d: "M8,.67C3.95,.67,.67,3.95,.67,8s3.28,7.33,7.33,7.33,7.33-3.28,7.33-7.33h0C15.33,3.95,12.05,.67,8,.67h0Zm1.69,10.33l-2.61-1.88c-.09-.07-.14-.17-.14-.28V3.84c0-.19,.16-.35,.35-.36h1.42c.2,0,.35,.16,.36,.36V7.93l1.87,1.37c.16,.1,.2,.32,.09,.47v.02h-.01l-.83,1.15c-.12,.15-.34,.18-.5,.06Z" })),
|
|
1141
|
+
'clock-outline': () => (h("path", { fill: "currentColor", d: "m10.95 10.04-.71.71L7.5 8.01v-4h1V7.6l2.45 2.45ZM8 2C4.69 2 2 4.69 2 8s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6m0-1c3.87 0 7 3.13 7 7s-3.13 7-7 7-7-3.13-7-7 3.13-7 7-7Z" })),
|
|
1142
|
+
'code-square-outline': () => (h("path", { fill: "currentColor", d: "m6.32 10.28.73-.73L5.5 8l1.53-1.53-.73-.73-2.27 2.27 2.28 2.28Zm3.37 0L11.97 8 9.69 5.72l-.73.73L10.51 8 8.96 9.55l.73.73ZM3.01 14c-.27 0-.5-.1-.7-.3-.2-.2-.3-.43-.3-.7V3c0-.27.1-.5.3-.7.2-.2.43-.3.7-.3h10c.27 0 .5.1.7.3.2.2.3.43.3.7v10c0 .27-.1.5-.3.7-.2.2-.43.3-.7.3H3Zm0-1h10V3H3v10Zm0-10v10V3Z" })),
|
|
835
1143
|
'conversation': () => (h("path", { fill: "currentColor", d: "M11.22,6.48c0-2.11-2.36-3.81-5.28-3.81S.67,4.37.67,6.48a3.15,3.15,0,0,0,1,2.19A5.17,5.17,0,0,1,.72,10a.2.2,0,0,0,0,.21.23.23,0,0,0,.19.12,4.79,4.79,0,0,0,2.25-.6,6.84,6.84,0,0,0,2.82.6C8.86,10.29,11.22,8.58,11.22,6.48Zm3.1,5.23a3.08,3.08,0,0,0,1-2.19C15.28,7.93,14,6.57,12,6a3.84,3.84,0,0,1,0,.48C12,9,9.3,11.05,6,11.05a7.16,7.16,0,0,1-.8-.05A5.6,5.6,0,0,0,10,13.33a6.7,6.7,0,0,0,2.82-.59,4.66,4.66,0,0,0,2.25.59.21.21,0,0,0,.19-.11.2.2,0,0,0,0-.21,5.15,5.15,0,0,1-.91-1.3Z" })),
|
|
836
1144
|
'conversation-outline': () => [
|
|
837
|
-
h("path", { fill: "currentColor", d: "M15 8.5c0 .79-.39 1.51-1.01 2.09v1.91a.508.508 0 0 1-.68.47l-2.26-1.05c-.34.05-.69.08-1.05.08-.23 0-.47-.01-.69-.04-.18 0-.35-.03-.52-.07-.02 0-.03 0-.05-.01-.16-.02-.31-.06-.46-.1-.42-.1-.82-.25-1.18-.43l-.42-.24c-.06-.04-.12-.08-.18-.13.58-.03 1.13-.12 1.64-.27.56.19 1.19.29 1.86.29.29 0 .6-.02.91-.07l.29-.04.28.12 1.5.7v-1.12l.01-.43.31-.3c.32-.29.7-.77.7-1.36 0-.91-.82-1.72-2.01-2.15-.01-.39-.09-.77-.23-1.13.06.02.12.04.19.06.25.08.5.17.73.27.11.05.23.11.34.17.11.06.21.12.31.18.11.07.2.13.3.2.48.35.86.78 1.1 1.26a2.288 2.288 0 0 1 .17.45c.03.11.06.22.07.33.02.12.03.24.03.36Z" }),
|
|
838
|
-
h("path", { fill: "currentColor", d: "M6 4c2.17 0 4 1.14 4 2.5S8.17 9 6 9c-.29 0-.6-.02-.91-.07l-.3-.04-.27.13-1.51.7V8.17l-.32-.3c-.32-.3-.7-.77-.7-1.36 0-1.36 1.83-2.5 4-2.5m0-1c-2.76 0-5 1.57-5 3.5 0 .79.39 1.51 1.01 2.09v1.91c0 .29.24.5.5.5.06 0 .11 0 .17-.03l2.26-1.05c.34.05.69.08 1.05.08 2.76 0 5-1.57 5-3.5s-2.24-3.5-5-3.5Z" }),
|
|
1145
|
+
h("path", { key: "conversation-outline-1", fill: "currentColor", d: "M15 8.5c0 .79-.39 1.51-1.01 2.09v1.91a.508.508 0 0 1-.68.47l-2.26-1.05c-.34.05-.69.08-1.05.08-.23 0-.47-.01-.69-.04-.18 0-.35-.03-.52-.07-.02 0-.03 0-.05-.01-.16-.02-.31-.06-.46-.1-.42-.1-.82-.25-1.18-.43l-.42-.24c-.06-.04-.12-.08-.18-.13.58-.03 1.13-.12 1.64-.27.56.19 1.19.29 1.86.29.29 0 .6-.02.91-.07l.29-.04.28.12 1.5.7v-1.12l.01-.43.31-.3c.32-.29.7-.77.7-1.36 0-.91-.82-1.72-2.01-2.15-.01-.39-.09-.77-.23-1.13.06.02.12.04.19.06.25.08.5.17.73.27.11.05.23.11.34.17.11.06.21.12.31.18.11.07.2.13.3.2.48.35.86.78 1.1 1.26a2.288 2.288 0 0 1 .17.45c.03.11.06.22.07.33.02.12.03.24.03.36Z" }),
|
|
1146
|
+
h("path", { key: "conversation-outline-2", fill: "currentColor", d: "M6 4c2.17 0 4 1.14 4 2.5S8.17 9 6 9c-.29 0-.6-.02-.91-.07l-.3-.04-.27.13-1.51.7V8.17l-.32-.3c-.32-.3-.7-.77-.7-1.36 0-1.36 1.83-2.5 4-2.5m0-1c-2.76 0-5 1.57-5 3.5 0 .79.39 1.51 1.01 2.09v1.91c0 .29.24.5.5.5.06 0 .11 0 .17-.03l2.26-1.05c.34.05.69.08 1.05.08 2.76 0 5-1.57 5-3.5s-2.24-3.5-5-3.5Z" }),
|
|
839
1147
|
],
|
|
840
1148
|
'cog': () => (h("path", { fill: "currentColor", d: "M14.82 9.76 13.56 9a5.54 5.54 0 0 0 0-2.07l1.26-.72a.36.36 0 0 0 .18-.38A7.5 7.5 0 0 0 13.37 3a.35.35 0 0 0-.44 0l-1.26.72a5.51 5.51 0 0 0-1.79-1V1.21a.34.34 0 0 0-.27-.34 7.29 7.29 0 0 0-3.22 0 .34.34 0 0 0-.28.34v1.45a5.83 5.83 0 0 0-1.79 1L3.06 3a.35.35 0 0 0-.43 0A7.24 7.24 0 0 0 1 5.83a.34.34 0 0 0 .16.41L2.44 7a5.49 5.49 0 0 0 0 2l-1.26.73a.35.35 0 0 0-.16.41A7.24 7.24 0 0 0 2.63 13a.35.35 0 0 0 .43.07l1.26-.73a5.56 5.56 0 0 0 1.79 1v1.45a.35.35 0 0 0 .28.34 7.29 7.29 0 0 0 3.22 0 .35.35 0 0 0 .28-.34v-1.45a6 6 0 0 0 1.79-1l1.26.73a.35.35 0 0 0 .43-.07A7.39 7.39 0 0 0 15 10.17a.37.37 0 0 0-.17-.41Zm-6.82.6A2.36 2.36 0 1 1 10.35 8 2.36 2.36 0 0 1 8 10.36Z" })),
|
|
841
1149
|
'comment': () => (h("path", { fill: "currentColor", d: "M8 1.67c-3.37-.12-6.21 2.51-6.33 5.88 0 1.36.5 2.68 1.41 3.69-.26 1-.72 1.94-1.36 2.76-.04.08-.04.17 0 .25.03.08.1.13.18.13 1.3-.03 2.54-.55 3.48-1.45.83.34 1.72.51 2.62.5 3.37.12 6.21-2.51 6.33-5.88-.12-3.37-2.96-6-6.33-5.88Zm2.53 8.43c0 .14-.11.25-.25.25H5.73c-.14 0-.25-.1-.26-.24V9.2c0-.17.13-.3.3-.31h4.5c.14 0 .26.12.26.26v.95Zm.92-3.29c0 .17-.13.3-.3.3h-6.3c-.17 0-.3-.13-.3-.3V6c0-.16.12-.29.28-.3H11.15c.16 0 .29.12.3.28V6.81Z" })),
|
|
@@ -849,34 +1157,35 @@ const icons = {
|
|
|
849
1157
|
'download': () => (h("path", { fill: "currentColor", d: "M6.4 2v4.1c0 .2-.1.3-.3.3H4c-.2 0-.3.1-.3.3 0 .1 0 .2.1.2l4 4c.1.1.3.1.4 0l4-4c.1-.1.1-.3 0-.4-.1-.1-.1-.1-.2-.1H9.9c-.2 0-.3-.1-.3-.3V2c0-.2-.1-.3-.3-.3H6.7c-.1 0-.3.1-.3.3zm7.9 11v1c0 .2-.1.3-.3.3H2c-.2 0-.3-.1-.3-.3v-1c0-.2.1-.3.3-.3h12c.2 0 .3.1.3.3z" })),
|
|
850
1158
|
'ellipsis': () => (h("path", { fill: "currentColor", d: "M2.5 6.17A1.83 1.83 0 1 0 4.33 8c0-1.01-.82-1.83-1.83-1.83Zm11 0A1.83 1.83 0 1 0 15.33 8c0-1.01-.82-1.83-1.83-1.83Zm-5.5 0A1.83 1.83 0 1 0 9.83 8c0-1.01-.82-1.83-1.83-1.83Z" })),
|
|
851
1159
|
'ellipsis-vertical': () => (h("path", { fill: "currentColor", d: "M6.17 13.5A1.83 1.83 0 1 0 8 11.67c-1.01 0-1.83.82-1.83 1.83Zm0-11A1.83 1.83 0 1 0 8 .67c-1.01 0-1.83.82-1.83 1.83Zm0 5.5A1.83 1.83 0 1 0 8 6.17c-1.01 0-1.83.82-1.83 1.83Z" })),
|
|
852
|
-
'euro': () => (h("path", { fill: "currentColor", d: "
|
|
1160
|
+
'euro': () => (h("path", { fill: "currentColor", d: "m12.1 11.02 1.4 1.42a5.948 5.948 0 0 1-4 1.56c-2.64 0-4.86-1.68-5.66-4.04H1.5v-1.5h2.02C3.5 8.3 3.5 8.16 3.5 8c0-.18 0-.36.04-.54H1.5v-1.5h2.38C4.7 3.66 6.9 2 9.5 2c1.54 0 2.94.6 4 1.56l-1.4 1.42c-.7-.6-1.6-.98-2.6-.98-1.46 0-2.74.78-3.44 1.96h3.5v1.5H5.54c-.02.18-.04.36-.04.54 0 .16 0 .32.02.46h4.04v1.5H6.02C6.7 11.18 8.02 12 9.5 12c1 0 1.9-.38 2.6-.98Z" })),
|
|
853
1161
|
'euro-circle': () => (h("path", { fill: "currentColor", d: "M8 .67C3.95.67.67 3.95.67 8S3.95 15.33 8 15.33s7.33-3.28 7.33-7.33S12.05.67 8 .67Zm2.27 11.4c-.38.09-.76.14-1.15.14a4.038 4.038 0 0 1-3.99-2.92h-.58c-.13 0-.23-.1-.23-.22v-.54c0-.12.11-.22.23-.22h.41a5.34 5.34 0 0 1 0-.8h-.41c-.13 0-.23-.1-.23-.22v-.58c0-.13.11-.22.23-.22h.63c.6-1.65 2.18-2.74 3.94-2.71.34 0 .68.03 1.02.1.12.03.19.16.16.28l-.23.84c-.03.12-.15.19-.27.17-.24-.05-.48-.08-.73-.08A2.42 2.42 0 0 0 6.81 6.5h2.71c.12.03.2.15.17.27l-.13.58c-.02.1-.12.18-.22.18H6.52c-.03.26-.03.53 0 .8h2.63c.12.03.2.15.17.27l-.11.52c-.03.1-.12.18-.22.18H6.8c.36.96 1.28 1.6 2.31 1.61.3 0 .59-.04.88-.1.12-.02.24.05.27.18l.17.84c.02.12-.05.24-.17.27v-.03Z" })),
|
|
854
1162
|
'exclamation-circle': () => (h("path", { fill: "currentColor", d: "M8 15.33c4.05 0 7.33-3.28 7.33-7.33S12.05.67 8 .67.67 3.95.67 8 3.95 15.33 8 15.33Zm.95-3.3c0 .15-.12.27-.28.27h-1.4c-.15 0-.28-.12-.28-.27v-1.31c0-.15.12-.28.28-.28h1.4c.15 0 .28.12.28.28v1.31ZM7 3.96c0-.14.11-.25.25-.25H8.7c.14 0 .25.11.25.25v4.8c0 .14-.11.25-.25.25H7.25c-.14 0-.25-.11-.25-.25V3.95Z" })),
|
|
1163
|
+
'exclamation-stamp': () => (h("path", { fill: "currentColor", d: "m15 8-1.55-1.86.22-2.46-2.3-.55L10.17 1 8 1.98 5.84 1 4.63 3.13l-2.29.54.22 2.46L1.01 8l1.55 1.86-.22 2.47 2.3.55 1.2 2.13L8 14.03l2.17.98 1.2-2.13 2.3-.55-.22-2.46L15 8.01Zm-6.36 3.35H7.36v-1.34h1.28v1.34Zm0-2.67H7.36V4.67h1.28v4.01Z" })),
|
|
855
1164
|
'exclamation-triangle': () => (h("path", { fill: "currentColor", d: "m14.3 13.88-6-12a.32.32 0 0 0-.41-.15.31.31 0 0 0-.15.15l-6 12a.31.31 0 0 0 .14.42.32.32 0 0 0 .14 0H14a.31.31 0 0 0 .33-.29.23.23 0 0 0-.03-.13ZM7 6a.28.28 0 0 1 .28-.28h1.46A.28.28 0 0 1 9 6v4a.29.29 0 0 1-.28.29H7.3A.29.29 0 0 1 7 10Zm2 7a.31.31 0 0 1-.31.32H7.34A.32.32 0 0 1 7 13v-1.37a.31.31 0 0 1 .32-.31h1.39a.31.31 0 0 1 .31.31Z" })),
|
|
856
1165
|
'eye': () => [
|
|
857
|
-
h("circle", { fill: "currentColor", cx: "8.01", cy: "7.96", r: "2.44" }),
|
|
858
|
-
h("path", { fill: "currentColor", d: "M15.24 7.59A8.12 8.12 0 0 0 8 2.67 8.12 8.12 0 0 0 .76 7.59a1 1 0 0 0 0 .82A8.12 8.12 0 0 0 8 13.33a8.12 8.12 0 0 0 7.24-4.92 1 1 0 0 0 0-.82ZM8 11.62A3.66 3.66 0 1 1 11.67 8 3.66 3.66 0 0 1 8 11.62Z" }),
|
|
1166
|
+
h("circle", { key: "eye-1", fill: "currentColor", cx: "8.01", cy: "7.96", r: "2.44" }),
|
|
1167
|
+
h("path", { key: "eye-2", fill: "currentColor", d: "M15.24 7.59A8.12 8.12 0 0 0 8 2.67 8.12 8.12 0 0 0 .76 7.59a1 1 0 0 0 0 .82A8.12 8.12 0 0 0 8 13.33a8.12 8.12 0 0 0 7.24-4.92 1 1 0 0 0 0-.82ZM8 11.62A3.66 3.66 0 1 1 11.67 8 3.66 3.66 0 0 1 8 11.62Z" }),
|
|
859
1168
|
],
|
|
860
1169
|
'eye-slash': () => [
|
|
861
|
-
h("path", { fill: "currentColor", d: "M10.25 7a2.43 2.43 0 0 0-2.08-1.46ZM6.45 6.1a2.43 2.43 0 1 0 3.85 2.69Z" }),
|
|
862
|
-
h("path", { fill: "currentColor", d: "M15.24 7.59A8.13 8.13 0 0 0 8 2.67a8.06 8.06 0 0 0-2.89.64l1.72 1.2A3.58 3.58 0 0 1 8 4.3a3.65 3.65 0 0 1 3.64 3.6l2.77 1.93a7.91 7.91 0 0 0 .81-1.42 1 1 0 0 0 .02-.82ZM.81 3.84 2.51 5A8.16 8.16 0 0 0 .76 7.59a1 1 0 0 0 0 .82A8.13 8.13 0 0 0 8 13.33a8 8 0 0 0 4.32-1.4l2 1.38.81-1.17-13.5-9.47ZM8 11.62A3.66 3.66 0 0 1 4.35 8a3.75 3.75 0 0 1 .29-1.42l5.85 4.11a3.65 3.65 0 0 1-2.49.93Z" }),
|
|
1170
|
+
h("path", { key: "eye-slash-1", fill: "currentColor", d: "M10.25 7a2.43 2.43 0 0 0-2.08-1.46ZM6.45 6.1a2.43 2.43 0 1 0 3.85 2.69Z" }),
|
|
1171
|
+
h("path", { key: "eye-slash-2", fill: "currentColor", d: "M15.24 7.59A8.13 8.13 0 0 0 8 2.67a8.06 8.06 0 0 0-2.89.64l1.72 1.2A3.58 3.58 0 0 1 8 4.3a3.65 3.65 0 0 1 3.64 3.6l2.77 1.93a7.91 7.91 0 0 0 .81-1.42 1 1 0 0 0 .02-.82ZM.81 3.84 2.51 5A8.16 8.16 0 0 0 .76 7.59a1 1 0 0 0 0 .82A8.13 8.13 0 0 0 8 13.33a8 8 0 0 0 4.32-1.4l2 1.38.81-1.17-13.5-9.47ZM8 11.62A3.66 3.66 0 0 1 4.35 8a3.75 3.75 0 0 1 .29-1.42l5.85 4.11a3.65 3.65 0 0 1-2.49.93Z" }),
|
|
863
1172
|
],
|
|
864
1173
|
'file': () => [
|
|
865
|
-
h("path", { fill: "currentColor", d: "M8.89 4.56V.67H3.35a.66.66 0 0 0-.66.68v13.3a.67.67 0 0 0 .66.68h9.3a.66.66 0 0 0 .66-.68v-9.4H9.55a.67.67 0 0 1-.66-.69Z" }),
|
|
866
|
-
h("path", { fill: "currentColor", d: "M13.12 3.67 10.41.87a.63.63 0 0 0-.47-.2h-.17v3.66h3.54v-.17a.69.69 0 0 0-.19-.49Z" }),
|
|
1174
|
+
h("path", { key: "file-1", fill: "currentColor", d: "M8.89 4.56V.67H3.35a.66.66 0 0 0-.66.68v13.3a.67.67 0 0 0 .66.68h9.3a.66.66 0 0 0 .66-.68v-9.4H9.55a.67.67 0 0 1-.66-.69Z" }),
|
|
1175
|
+
h("path", { key: "file-2", fill: "currentColor", d: "M13.12 3.67 10.41.87a.63.63 0 0 0-.47-.2h-.17v3.66h3.54v-.17a.69.69 0 0 0-.19-.49Z" }),
|
|
867
1176
|
],
|
|
868
1177
|
'file-cog': () => (h("path", { fill: "currentColor", d: "M9,10.1C9,10.6,8.5,11,8,11l0,0c-0.6,0-1-0.4-1-1c0-0.6,0.4-1,1-1C8.6,9,9,9.4,9,10.1C9,10,9,10,9,10.1z M13.2,3.7l-2.8-2.8c-0.1-0.1-0.3-0.2-0.5-0.2H9.8v3.7h3.5V4.2C13.3,4,13.2,3.8,13.2,3.7L13.2,3.7z M9.6,5.3h3.8v9.4 c0,0.4-0.3,0.6-0.7,0.7H3.3c-0.4,0-0.7-0.3-0.7-0.7c0,0,0,0,0,0V1.3C2.7,1,3,0.7,3.3,0.7h5.5v3.9l0,0C8.9,4.9,9.2,5.2,9.6,5.3 C9.5,5.2,9.5,5.2,9.6,5.3z M10,8L9.5,8.3C9.3,8.1,9,8,8.8,7.9V7.3c0-0.1,0-0.1-0.1-0.1c-0.4-0.1-0.9-0.1-1.3,0 c-0.1,0-0.1,0.1-0.1,0.1v0.6C7,8,6.7,8.1,6.5,8.3L6,8C5.9,8,5.9,8,5.8,8C5.5,8.3,5.3,8.7,5.2,9.1c0,0.1,0,0.1,0.1,0.2l0.5,0.3 c-0.1,0.3-0.1,0.6,0,0.8l-0.5,0.3c-0.1,0-0.1,0.1-0.1,0.2c0.1,0.4,0.4,0.8,0.7,1.1c0.1,0,0.1,0,0.2,0l0.5-0.3 C6.7,11.9,7,12,7.2,12.1v0.6c0,0.1,0,0.1,0.1,0.1c0.4,0.1,0.9,0.1,1.3,0c0.1,0,0.1-0.1,0.1-0.1v-0.5C9,12.1,9.3,12,9.5,11.8l0.5,0.3 c0.1,0,0.1,0,0.2,0c0.3-0.3,0.5-0.7,0.6-1.1c0-0.1,0-0.1-0.1-0.2l0,0l-0.5-0.3c0-0.3,0-0.6,0-0.8l0.5-0.3c0.1,0,0.1-0.1,0.1-0.2 c-0.1-0.4-0.4-0.8-0.6-1.1C10.1,8,10.1,8,10,8z" })),
|
|
869
1178
|
'file-download': () => [
|
|
870
|
-
h("path", { fill: "currentColor", d: "M13.12 3.67 10.41.87a.63.63 0 0 0-.47-.2h-.17v3.66h3.54v-.17a.69.69 0 0 0-.19-.49Z" }),
|
|
871
|
-
h("path", { fill: "currentColor", d: "M13.31 14.65v-9.4H9.55a.67.67 0 0 1-.66-.68V.67H3.35a.67.67 0 0 0-.66.66v13.32a.67.67 0 0 0 .66.68h9.3a.67.67 0 0 0 .66-.66Zm-2.91-4.24-2.54 2.53a.18.18 0 0 1-.26 0l-2.54-2.53a.2.2 0 0 1-.06-.15.18.18 0 0 1 .19-.18h1.34a.2.2 0 0 0 .2-.2V7.27a.19.19 0 0 1 .19-.18h1.63a.18.18 0 0 1 .18.19v2.6a.2.2 0 0 0 .2.2h1.34a.16.16 0 0 1 .14.06.19.19 0 0 1-.01.27Z" }),
|
|
1179
|
+
h("path", { key: "file-download-1", fill: "currentColor", d: "M13.12 3.67 10.41.87a.63.63 0 0 0-.47-.2h-.17v3.66h3.54v-.17a.69.69 0 0 0-.19-.49Z" }),
|
|
1180
|
+
h("path", { key: "file-download-2", fill: "currentColor", d: "M13.31 14.65v-9.4H9.55a.67.67 0 0 1-.66-.68V.67H3.35a.67.67 0 0 0-.66.66v13.32a.67.67 0 0 0 .66.68h9.3a.67.67 0 0 0 .66-.66Zm-2.91-4.24-2.54 2.53a.18.18 0 0 1-.26 0l-2.54-2.53a.2.2 0 0 1-.06-.15.18.18 0 0 1 .19-.18h1.34a.2.2 0 0 0 .2-.2V7.27a.19.19 0 0 1 .19-.18h1.63a.18.18 0 0 1 .18.19v2.6a.2.2 0 0 0 .2.2h1.34a.16.16 0 0 1 .14.06.19.19 0 0 1-.01.27Z" }),
|
|
872
1181
|
],
|
|
873
1182
|
'file-excel': () => (h("path", { fill: "currentColor", d: "M8.89 4.43V.67H3.35a.65.65 0 0 0-.66.66v13.34a.65.65 0 0 0 .66.66h9.3a.65.65 0 0 0 .66-.66V5.09H9.55a.65.65 0 0 1-.66-.66Zm1.66 3.2-1.66 2.58 1.66 2.59a.34.34 0 0 1-.1.46.31.31 0 0 1-.18.05h-1a.32.32 0 0 1-.27-.17c-.54-1-1-1.9-1-1.9-.18.41-.28.55-1 1.9a.33.33 0 0 1-.29.18h-1A.34.34 0 0 1 5.4 13a.41.41 0 0 1 0-.18l1.67-2.58-1.62-2.61a.34.34 0 0 1 .1-.46.37.37 0 0 1 .18 0h1a.33.33 0 0 1 .3.17c.72 1.35.55.93 1 1.9 0 0 .17-.33 1-1.9a.33.33 0 0 1 .3-.17h1a.33.33 0 0 1 .33.33.41.41 0 0 1-.11.13ZM13.31 4v.17H9.77V.67h.17a.67.67 0 0 1 .47.19l2.71 2.71a.66.66 0 0 1 .19.43Z" })),
|
|
874
1183
|
'file-pdf': () => (h("path", { fill: "currentColor", d: "M7.74 8a2.68 2.68 0 0 1-.06-1.3c.24 0 .21 1.02.06 1.3Zm0 1.31a12.5 12.5 0 0 1-.79 1.75 9.8 9.8 0 0 1 1.75-.61 3.63 3.63 0 0 1-1.01-1.14Zm-2.66 3.47s.36-.15 1-1.12a3.71 3.71 0 0 0-1 1.12Zm4.49-7.67h3.78v9.56a.65.65 0 0 1-.66.66H3.31a.66.66 0 0 1-.66-.66V1.33a.65.65 0 0 1 .7-.66h5.56v3.77a.67.67 0 0 0 .66.67Zm-.22 5a2.78 2.78 0 0 1-1.18-1.5 4 4 0 0 0 .17-1.78.7.7 0 0 0-.78-.6.69.69 0 0 0-.56.41 4.58 4.58 0 0 0 .23 2.14 26 26 0 0 1-1.13 2.38c-.76.39-2 1.24-1.52 1.89a.87.87 0 0 0 .6.28c.5 0 1-.5 1.7-1.72A15.24 15.24 0 0 1 9.07 11a4.34 4.34 0 0 0 1.78.54.72.72 0 0 0 .74-.7.78.78 0 0 0-.19-.51c-.4-.4-1.51-.33-2.05-.23Zm3.81-6.53L10.44.86A.71.71 0 0 0 10 .67h-.2v3.55h3.55v-.17a.7.7 0 0 0-.19-.47ZM11.1 10.9c.11-.08-.07-.33-1.19-.25 1.03.44 1.19.25 1.19.25Z" })),
|
|
875
1184
|
'file-text': () => (h("path", { fill: "currentColor", d: "M8.89 4.56V.67H3.35c-.36 0-.66.3-.66.66v13.32c0 .37.29.67.66.68h9.3c.36 0 .66-.3.66-.66V5.25H9.55c-.37 0-.67-.31-.66-.68Zm1.77 6.75c0 .19-.15.34-.34.35H5.68c-.19 0-.34-.16-.34-.35v-.23c0-.19.15-.34.34-.34h4.64c.19 0 .34.15.34.34v.23Zm0-1.83c0 .19-.15.34-.34.34H5.68c-.19 0-.34-.15-.34-.34v-.23c0-.19.15-.34.34-.34h4.64c.19 0 .34.15.34.34v.23Zm0-2.06v.23c0 .19-.15.34-.34.34H5.68c-.19 0-.34-.15-.34-.34v-.23c0-.19.15-.34.34-.35h4.64c.19 0 .34.16.34.35Zm2.65-3.27v.17H9.77V.67h.17c.18 0 .35.07.47.2l2.71 2.8c.13.13.19.31.19.49Z" })),
|
|
876
1185
|
'file-text-outline': () => (h("path", { fill: "currentColor", d: "M10.31 10.74H5.69c-.2 0-.36.16-.36.35v.22c0 .19.16.35.36.35h4.62c.2 0 .36-.16.36-.35v-.22c0-.19-.16-.35-.36-.35Zm0-1.84H5.69c-.2 0-.36.16-.36.36v.21c0 .2.16.35.36.35h4.62c.2 0 .36-.15.36-.35v-.21c0-.2-.16-.36-.36-.36Zm0-1.83H5.69c-.2 0-.36.16-.36.35v.22c0 .19.16.35.36.35h4.62c.2 0 .36-.16.36-.35v-.22c0-.19-.16-.35-.36-.35Zm0 3.67H5.69c-.2 0-.36.16-.36.35v.22c0 .19.16.35.36.35h4.62c.2 0 .36-.16.36-.35v-.22c0-.19-.16-.35-.36-.35Zm0-1.84H5.69c-.2 0-.36.16-.36.36v.21c0 .2.16.35.36.35h4.62c.2 0 .36-.15.36-.35v-.21c0-.2-.16-.36-.36-.36Zm0-1.83H5.69c-.2 0-.36.16-.36.35v.22c0 .19.16.35.36.35h4.62c.2 0 .36-.16.36-.35v-.22c0-.19-.16-.35-.36-.35Zm2.76-2.64L9.69.92A.8.8 0 0 0 9.1.67H3.35c-.36 0-.66.3-.66.66v13.32c0 .37.29.67.66.68h9.3c.36 0 .66-.3.66-.66V5.05c0-.23-.07-.45-.24-.62Zm-.76 9.9H3.69V1.67h5.2v2.75c0 .46.37.83.83.83h2.59v9.08Z" })),
|
|
877
1186
|
'file-upload': () => [
|
|
878
|
-
h("path", { fill: "currentColor", d: "M13.1 3.7 10.4.9c-.1-.1-.3-.2-.5-.2h-.1v3.7h3.5v-.2c0-.2-.1-.4-.2-.5z" }),
|
|
879
|
-
h("path", { fill: "currentColor", d: "M13.3 14.6V5.3H9.6c-.4 0-.7-.3-.7-.7V.7H3.3c-.3 0-.6.3-.6.6v13.3c0 .4.3.7.7.7h9.3c.3 0 .6-.3.6-.7zm-3-4.6H8.9c-.1 0-.2.1-.2.2v2.6c0 .1-.1.2-.2.2H6.9c-.1 0-.2-.1-.2-.2v-2.6c0-.1-.1-.2-.2-.2H5.1C5 9.9 5 9.8 5 9.7l2.5-2.6c.1-.1.2-.1.3 0l2.5 2.5.1.1c.1.2 0 .3-.1.3z" }),
|
|
1187
|
+
h("path", { key: "file-upload-1", fill: "currentColor", d: "M13.1 3.7 10.4.9c-.1-.1-.3-.2-.5-.2h-.1v3.7h3.5v-.2c0-.2-.1-.4-.2-.5z" }),
|
|
1188
|
+
h("path", { key: "file-upload-2", fill: "currentColor", d: "M13.3 14.6V5.3H9.6c-.4 0-.7-.3-.7-.7V.7H3.3c-.3 0-.6.3-.6.6v13.3c0 .4.3.7.7.7h9.3c.3 0 .6-.3.6-.7zm-3-4.6H8.9c-.1 0-.2.1-.2.2v2.6c0 .1-.1.2-.2.2H6.9c-.1 0-.2-.1-.2-.2v-2.6c0-.1-.1-.2-.2-.2H5.1C5 9.9 5 9.8 5 9.7l2.5-2.6c.1-.1.2-.1.3 0l2.5 2.5.1.1c.1.2 0 .3-.1.3z" }),
|
|
880
1189
|
],
|
|
881
1190
|
'filter': () => (h("path", { fill: "currentColor", d: "M13.74 1.66H2.26a.6.6 0 0 0-.59.6.59.59 0 0 0 .17.42l4.58 4.58v5.1a.58.58 0 0 0 .25.48l2 1.39a.6.6 0 0 0 .83-.15.59.59 0 0 0 .1-.34V7.26l4.58-4.58a.6.6 0 0 0 0-.84.64.64 0 0 0-.44-.18Z" })),
|
|
882
1191
|
'floppy-disk': () => (h("path", { fill: "currentColor", d: "m13.93 4.44-2.37-2.37c-.25-.25-.6-.4-.96-.4H3.03c-.75 0-1.36.61-1.36 1.36v9.94c0 .75.61 1.36 1.36 1.36h9.94c.75 0 1.36-.61 1.36-1.36V5.4c0-.36-.14-.7-.4-.96ZM8 12.52A1.81 1.81 0 1 1 8 8.9a1.81 1.81 0 0 1 0 3.62Zm2.71-5.77c0 .09-.04.18-.1.24a.35.35 0 0 1-.24.1H3.82c-.19 0-.34-.15-.34-.34V3.82c0-.19.15-.34.34-.34h6.55c.19 0 .34.15.34.34v2.93Z" })),
|
|
@@ -888,8 +1197,8 @@ const icons = {
|
|
|
888
1197
|
'folder-star': () => (h("path", { fill: "currentColor", d: "M14 4.44H8.46L6.62 2.67H2A1.35 1.35 0 0 0 .67 4v8A1.35 1.35 0 0 0 2 13.33h12A1.35 1.35 0 0 0 15.33 12V5.78A1.36 1.36 0 0 0 14 4.44Zm-.2 3.89L12 9.66l.69 2a.22.22 0 0 1-.08.27.26.26 0 0 1-.13.06.39.39 0 0 1-.15-.06l-1.77-1.26L8.75 12a.34.34 0 0 1-.15 0 .31.31 0 0 1-.13 0 .23.23 0 0 1-.08-.27l.69-2-1.81-1.35a.23.23 0 0 1-.1-.17.24.24 0 0 1 .24-.24h2.21l.67-2a.26.26 0 0 1 .15-.14.24.24 0 0 1 .31.14l.67 2h2.2a.26.26 0 0 1 .26.24.3.3 0 0 1-.08.12Z" })),
|
|
889
1198
|
'graduation-cap': () => (h("path", { fill: "currentColor", d: "M14.93 5.14 8.54 2.76c-.35-.13-.73-.13-1.08 0L1.07 5.14c-.31.13-.48.47-.39.8.04.22.19.39.39.47l1.12.42c-.26.38-.4.84-.41 1.3-.35.28-.47.75-.3 1.16.06.12.14.23.24.31l-.59 3.19c-.06.22.07.45.28.53h1.37c.22-.02.38-.22.36-.44v-.1L2.55 9.6c.32-.31.4-.79.2-1.18a.814.814 0 0 0-.24-.28c0-.38.18-.75.47-1l4.48 1.65c.35.13.73.13 1.08 0l6.39-2.38c.31-.13.48-.47.39-.8a.625.625 0 0 0-.39-.47Zm-6.18 4.5c-.48.18-1.02.18-1.5 0L3.93 8.4l-.33 3.15c0 1 2 1.78 4.4 1.78s4.4-.79 4.4-1.78l-.33-3.15-3.32 1.24Z" })),
|
|
890
1199
|
'history': () => [
|
|
891
|
-
h("path", { fill: "currentColor", d: "M8,1.67A6.37,6.37,0,0,0,3.6,3.42l-.91-.91a.6.6,0,0,0-.85,0h0a.58.58,0,0,0-.18.43V6.37A.61.61,0,0,0,2.24,7H5.68a.62.62,0,0,0,.62-.62A.69.69,0,0,0,6.12,6L5.05,4.87a4.29,4.29,0,1,1,.1,6.36.3.3,0,0,0-.41,0l-1,1a.3.3,0,0,0,0,.42h0A6.33,6.33,0,1,0,8,1.67Z" }),
|
|
892
|
-
h("path", { fill: "currentColor", d: "M9.85,9.3l-.36.36a.3.3,0,0,1-.43,0L7.45,8V5.15a.3.3,0,0,1,.3-.3h.5a.3.3,0,0,1,.3.3V7.58l1.3,1.3A.31.31,0,0,1,9.85,9.3Z" }),
|
|
1200
|
+
h("path", { key: "history-1", fill: "currentColor", d: "M8,1.67A6.37,6.37,0,0,0,3.6,3.42l-.91-.91a.6.6,0,0,0-.85,0h0a.58.58,0,0,0-.18.43V6.37A.61.61,0,0,0,2.24,7H5.68a.62.62,0,0,0,.62-.62A.69.69,0,0,0,6.12,6L5.05,4.87a4.29,4.29,0,1,1,.1,6.36.3.3,0,0,0-.41,0l-1,1a.3.3,0,0,0,0,.42h0A6.33,6.33,0,1,0,8,1.67Z" }),
|
|
1201
|
+
h("path", { key: "history-2", fill: "currentColor", d: "M9.85,9.3l-.36.36a.3.3,0,0,1-.43,0L7.45,8V5.15a.3.3,0,0,1,.3-.3h.5a.3.3,0,0,1,.3.3V7.58l1.3,1.3A.31.31,0,0,1,9.85,9.3Z" }),
|
|
893
1202
|
],
|
|
894
1203
|
'hand-up': () => (h("path", { fill: "currentColor", d: "M12.75 3.5c-.41 0-.75.34-.75.75v3.5c0 .14-.11.25-.25.25s-.25-.11-.25-.25v-4c0-.41-.34-.75-.75-.75s-.75.34-.75.75v4c0 .14-.11.25-.25.25s-.25-.11-.25-.25v-5c0-.41-.34-.75-.75-.75S8 2.34 8 2.75v5c0 .14-.11.25-.25.25s-.25-.11-.25-.25v-4c0-.41-.34-.75-.75-.75S6 3.34 6 3.75V11L3.97 9.54c-.34-.34-.88-.34-1.21 0s-.34.88 0 1.21l2.22 2.22c.66.66 1.55 1.03 2.47 1.03H11a2.5 2.5 0 0 0 2.5-2.5V4.25c0-.41-.34-.75-.75-.75Z" })),
|
|
895
1204
|
'home': () => (h("path", { fill: "currentColor", d: "m13.55 5.5-5-3.33C8.38 2.06 8.19 2 7.99 2s-.39.06-.56.17L2.45 5.5c-.28.19-.45.5-.45.83v6.66c0 .55.45 1 1 1h4V12c0-.56.45-1.01 1-1.01s1 .45 1 1.01v1.99h4c.55 0 1-.45 1-1V6.33c0-.33-.17-.65-.45-.83Z" })),
|
|
@@ -902,22 +1211,22 @@ const icons = {
|
|
|
902
1211
|
'link': () => (h("path", { fill: "currentColor", d: "M9.75 6.25a3.748 3.748 0 0 1 0 5.31l-1.66 1.67a3.76 3.76 0 0 1-5.32 0 3.76 3.76 0 0 1 0-5.32l.92-.92c.15-.15.4-.16.56 0 .07.07.11.16.12.26.02.44.1.88.24 1.3.05.14.01.3-.09.41l-.32.32c-.72.67-.76 1.8-.09 2.52s1.8.76 2.52.09c.03-.02.05-.05.07-.07l1.66-1.66c.7-.7.7-1.82 0-2.52-.08-.08-.16-.15-.26-.21a.394.394 0 0 1-.17-.31.98.98 0 0 1 .29-.74l.52-.52c.14-.14.35-.15.51-.04.18.13.35.27.51.43Zm3.49-3.48a3.76 3.76 0 0 0-5.32 0L6.26 4.43a3.772 3.772 0 0 0 .52 5.75c.16.11.37.09.51-.04l.52-.52c.2-.19.3-.46.29-.74a.38.38 0 0 0-.17-.31 1.775 1.775 0 0 1-.26-2.73l1.66-1.66c.68-.71 1.81-.74 2.52-.06.71.68.74 1.81.06 2.52-.02.03-.05.05-.07.07l-.32.32c-.11.11-.14.27-.09.41.14.42.22.86.24 1.3 0 .22.19.39.41.38.1 0 .19-.05.26-.12l.92-.92a3.76 3.76 0 0 0 0-5.32Z" })),
|
|
903
1212
|
'list': () => (h("path", { fill: "currentColor", d: "M1.9 2.68c-.67 0-1.22.56-1.21 1.23 0 .67.56 1.22 1.23 1.21.67 0 1.22-.56 1.21-1.23 0-.32-.13-.63-.36-.86-.23-.23-.54-.36-.87-.35Zm0 4.09a1.23 1.23 0 1 0 0 2.46 1.23 1.23 0 1 0 0-2.46Zm0 4.09a1.23 1.23 0 1 0 0 2.46 1.23 1.23 0 1 0 0-2.46Zm13 .41H5.18c-.23 0-.41.18-.41.41v.82c0 .23.18.41.41.41h9.75c.23 0 .41-.18.41-.41v-.82c0-.23-.18-.41-.41-.41h-.03Zm0-8.18H5.18c-.23 0-.41.18-.41.41v.81c0 .23.18.41.41.41h9.75c.23 0 .41-.18.41-.41V3.5c0-.23-.18-.41-.41-.41h-.03Zm0 4.09H5.18c-.23 0-.41.18-.41.41v.82c0 .23.18.41.41.41h9.75c.23 0 .41-.18.41-.41v-.82c0-.23-.18-.41-.41-.41h-.03Z" })),
|
|
904
1213
|
'loader': () => [
|
|
905
|
-
h("path", { fill: "currentColor", class: "loader__full-circle", d: "M8 2.67A5.33 5.33 0 1 1 2.67 8 5.33 5.33 0 0 1 8 2.67m0-2A7.33 7.33 0 1 0 15.33 8 7.33 7.33 0 0 0 8 .67Z" }),
|
|
906
|
-
h("path", { fill: "currentColor", d: "M8 2.67v-2A7.33 7.33 0 0 0 .67 8h2A5.33 5.33 0 0 1 8 2.67Z" }),
|
|
1214
|
+
h("path", { key: "loader-1", fill: "currentColor", class: "loader__full-circle", d: "M8 2.67A5.33 5.33 0 1 1 2.67 8 5.33 5.33 0 0 1 8 2.67m0-2A7.33 7.33 0 1 0 15.33 8 7.33 7.33 0 0 0 8 .67Z" }),
|
|
1215
|
+
h("path", { key: "loader-2", fill: "currentColor", d: "M8 2.67v-2A7.33 7.33 0 0 0 .67 8h2A5.33 5.33 0 0 1 8 2.67Z" }),
|
|
907
1216
|
],
|
|
908
1217
|
'lock': () => (h("path", { fill: "currentColor", d: "M12 5.56h-.67v-1.4C11.37 2.28 9.88.71 8 .67 6.12.71 4.63 2.28 4.67 4.16v1.4H4c-.75.02-1.35.64-1.33 1.39V14c.02.73.6 1.31 1.33 1.33h8c.75-.02 1.35-.64 1.33-1.39V7a1.37 1.37 0 0 0-1.28-1.44H12Zm-4 6.28c-.77.04-1.43-.56-1.47-1.33-.04-.77.56-1.43 1.33-1.47.77-.04 1.43.56 1.47 1.33v.07c.02.75-.57 1.38-1.32 1.4H8Zm2.07-6.28H5.93v-1.4A2.12 2.12 0 0 1 8 2c1.17.03 2.1 1 2.07 2.17v1.39Z" })),
|
|
909
1218
|
'location': () => (h("path", { fill: "currentColor", d: "M8 .67A5.1 5.1 0 0 0 2.67 5.5c0 3.06 3.51 7.88 4.83 9.59a.64.64 0 0 0 1 0c1.32-1.71 4.83-6.53 4.83-9.59A5.1 5.1 0 0 0 8 .67Zm0 6.94a1.74 1.74 0 1 1 1.74-1.73A1.73 1.73 0 0 1 8 7.61Z" })),
|
|
910
1219
|
'log-in': () => (h("path", { fill: "currentColor", d: "M10.97,7.78h0L6.97,3.78c-.12-.12-.31-.12-.42,0h0c-.07,.06-.12,.15-.13,.24v2.07c0,.17-.13,.3-.3,.32H1.97c-.16,0-.29,.12-.3,.28h0v2.58c0,.16,.12,.29,.28,.3H6.11c.17,0,.3,.14,.3,.31v2.14c0,.16,.12,.29,.28,.3h0c.11,.01,.21-.03,.28-.11l4-4c.11-.12,.11-.3,0-.42Zm3.37,5.26h0v1c0,.16-.13,.28-.28,.28h-4.77c-.16,0-.28-.13-.28-.28v-1c0-.16,.13-.28,.28-.28h3.43V3.3h-3.42c-.16,0-.29-.13-.29-.29V1.97c0-.16,.13-.29,.29-.29h4.76c.16,0,.29,.13,.29,.29v.68h0V13.04Z" })),
|
|
911
1220
|
'log-out': () => [
|
|
912
|
-
h("path", { fill: "currentColor", d: "M14.25,7.77h0l-4-4a.31.31,0,0,0-.43,0A.34.34,0,0,0,9.7,4V6.07a.32.32,0,0,1-.3.32H5.23a.3.3,0,0,0-.3.3V9.25a.3.3,0,0,0,.3.3H9.4a.31.31,0,0,1,.3.31V12a.3.3,0,0,0,.3.3.33.33,0,0,0,.23-.09l4-4A.29.29,0,0,0,14.25,7.77Z" }),
|
|
913
|
-
h("path", { fill: "currentColor", d: "M6.71,12.72H3.27V3.26H6.69A.31.31,0,0,0,7,3V2a.3.3,0,0,0-.31-.3H2A.29.29,0,0,0,1.67,2h0V3h0V14a.27.27,0,0,0,.1.24h0a.32.32,0,0,0,.14.08H6.71A.3.3,0,0,0,7,14V13A.3.3,0,0,0,6.71,12.72Z" }),
|
|
1221
|
+
h("path", { key: "log-out-1", fill: "currentColor", d: "M14.25,7.77h0l-4-4a.31.31,0,0,0-.43,0A.34.34,0,0,0,9.7,4V6.07a.32.32,0,0,1-.3.32H5.23a.3.3,0,0,0-.3.3V9.25a.3.3,0,0,0,.3.3H9.4a.31.31,0,0,1,.3.31V12a.3.3,0,0,0,.3.3.33.33,0,0,0,.23-.09l4-4A.29.29,0,0,0,14.25,7.77Z" }),
|
|
1222
|
+
h("path", { key: "log-out-2", fill: "currentColor", d: "M6.71,12.72H3.27V3.26H6.69A.31.31,0,0,0,7,3V2a.3.3,0,0,0-.31-.3H2A.29.29,0,0,0,1.67,2h0V3h0V14a.27.27,0,0,0,.1.24h0a.32.32,0,0,0,.14.08H6.71A.3.3,0,0,0,7,14V13A.3.3,0,0,0,6.71,12.72Z" }),
|
|
914
1223
|
],
|
|
915
1224
|
'magnifying-glass': () => (h("path", { fill: "currentColor", d: "M11.24 9.5c1.48-2.44.71-5.62-1.73-7.1-.05-.03-.11-.07-.17-.1A5.232 5.232 0 0 0 2.52 4C.94 6.38 1.6 9.59 3.98 11.17a5.142 5.142 0 0 0 5.54.1L12.3 14c.39.39 1.02.39 1.41 0l.33-.33a.996.996 0 0 0 0-1.41l-2.8-2.76Zm-4.4.5c-1.76.02-3.2-1.4-3.22-3.16-.02-1.76 1.4-3.2 3.16-3.22 1.76-.02 3.2 1.4 3.22 3.16v.06A3.193 3.193 0 0 1 6.84 10Z" })),
|
|
916
1225
|
'mail': () => (h("path", { fill: "currentColor", d: "M13.87 2.67H2.13C1.36 2.64.71 3.23.67 4v8c.03.77.68 1.36 1.45 1.33h11.75c.77.04 1.42-.55 1.46-1.32V4c-.03-.77-.68-1.36-1.45-1.33h-.01Zm0 2.66L8 8.67 2.13 5.33V4L8 7.33 13.87 4v1.33Z" })),
|
|
917
1226
|
'notes': () => [
|
|
918
|
-
h("path", { fill: "currentColor", d: "M12.6 2.76v-.43c0-.75-.53-1.28-1.28-1.28H2.33c-.75 0-1.28.53-1.28 1.28v8.99c0 .75.53 1.28 1.28 1.28h.39V4.05c0-.75.53-1.28 1.28-1.28h8.6Z" }),
|
|
919
|
-
h("path", { fill: "currentColor", d: "M13.67 3.4H4.68c-.75 0-1.28.53-1.28 1.28v8.99c0 .75.53 1.28 1.28 1.28h6.42V11.1h3.85V4.68c0-.75-.53-1.28-1.28-1.28Zm-4.49 7.06H5.97V9.18h3.21v1.28Zm3.21-2.57H5.97V6.61h6.42v1.28Z" }),
|
|
920
|
-
h("path", { fill: "currentColor", d: "m11.74 14.42 2.68-2.68h-2.68v2.68z" }),
|
|
1227
|
+
h("path", { key: "notes-1", fill: "currentColor", d: "M12.6 2.76v-.43c0-.75-.53-1.28-1.28-1.28H2.33c-.75 0-1.28.53-1.28 1.28v8.99c0 .75.53 1.28 1.28 1.28h.39V4.05c0-.75.53-1.28 1.28-1.28h8.6Z" }),
|
|
1228
|
+
h("path", { key: "notes-2", fill: "currentColor", d: "M13.67 3.4H4.68c-.75 0-1.28.53-1.28 1.28v8.99c0 .75.53 1.28 1.28 1.28h6.42V11.1h3.85V4.68c0-.75-.53-1.28-1.28-1.28Zm-4.49 7.06H5.97V9.18h3.21v1.28Zm3.21-2.57H5.97V6.61h6.42v1.28Z" }),
|
|
1229
|
+
h("path", { key: "notes-3", fill: "currentColor", d: "m11.74 14.42 2.68-2.68h-2.68v2.68z" }),
|
|
921
1230
|
],
|
|
922
1231
|
'notes-outline': () => (h("path", { fill: "currentColor", d: "M13.11 4.74v5.38h-3v3H4.73V4.74h8.38m0-1.2H4.73a1.2 1.2 0 0 0-1.2 1.2v8.38a1.2 1.2 0 0 0 1.2 1.19h6l3.59-3.59v-6a1.2 1.2 0 0 0-1.21-1.18Zm-4.19 6.58h-3V8.93h3Zm3-2.39h-6v-1.2h6ZM3.8 11.19h-1V2.81h8.38v1h1.2v-1a1.2 1.2 0 0 0-1.2-1.2H2.81a1.2 1.2 0 0 0-1.2 1.2v8.38a1.2 1.2 0 0 0 1.2 1.2h1Z" })),
|
|
923
1232
|
'paper-plane': () => (h("path", { fill: "currentColor", d: "M14 1.69 1.84 7a.28.28 0 0 0-.15.36.29.29 0 0 0 .16.15l3.27 1.82a.57.57 0 0 0 .61-.06l6.45-5.57c.05 0 .15-.1.19-.06s0 .14-.06.18l-5.59 6.29a.52.52 0 0 0 0 .63l2.09 3.44a.28.28 0 0 0 .37.12.3.3 0 0 0 .13-.12l5-12.11a.3.3 0 0 0-.14-.37.28.28 0 0 0-.17-.01Z" })),
|
|
@@ -939,13 +1248,13 @@ const icons = {
|
|
|
939
1248
|
'table': () => (h("path", { fill: "currentColor", d: "M14.19 2.68H1.81A1.14 1.14 0 0 0 .67 3.82v8.36a1.14 1.14 0 0 0 1.14 1.14h12.38a1.14 1.14 0 0 0 1.14-1.14V3.82a1.14 1.14 0 0 0-1.14-1.14ZM7.24 11.8H2.19V9.52h5.05Zm0-3.8H2.19V5.72h5.05Zm6.57 3.8H8.76V9.52h5.05Zm0-3.8H8.76V5.72h5.05Z" })),
|
|
940
1249
|
'tag': () => (h("path", { fill: "currentColor", d: "M1.67 7.9V2.85a1.18 1.18 0 0 1 1.18-1.18H7.9a1.18 1.18 0 0 1 .84.33L14 7.26a1.2 1.2 0 0 1 0 1.68L8.94 14a1.2 1.2 0 0 1-1.68 0L2 8.74a1.18 1.18 0 0 1-.33-.84Zm2.77-4.65a1.19 1.19 0 1 0 1.18 1.19 1.19 1.19 0 0 0-1.18-1.19Z" })),
|
|
941
1250
|
'tags': () => [
|
|
942
|
-
h("path", { fill: "currentColor", d: "M12.08 7.37 7.22 3a1.12 1.12 0 0 0-.78-.29H1.77a1 1 0 0 0-1.1 1v4.21a1 1 0 0 0 .33.71L5.85 13a1.17 1.17 0 0 0 1.55 0l4.68-4.25a.94.94 0 0 0 0-1.38ZM3.23 6.13A1.13 1.13 0 1 1 4.36 5a1.13 1.13 0 0 1-1.13 1.13Z" }),
|
|
943
|
-
h("path", { fill: "currentColor", d: "M15 7.37 10.15 3a1.12 1.12 0 0 0-.77-.29H8.26l4.5 4.09a1.76 1.76 0 0 1 0 2.65L8.77 13a1.17 1.17 0 0 0 1.55 0L15 8.79a.94.94 0 0 0 0-1.42Z" }),
|
|
1251
|
+
h("path", { key: "tags-1", fill: "currentColor", d: "M12.08 7.37 7.22 3a1.12 1.12 0 0 0-.78-.29H1.77a1 1 0 0 0-1.1 1v4.21a1 1 0 0 0 .33.71L5.85 13a1.17 1.17 0 0 0 1.55 0l4.68-4.25a.94.94 0 0 0 0-1.38ZM3.23 6.13A1.13 1.13 0 1 1 4.36 5a1.13 1.13 0 0 1-1.13 1.13Z" }),
|
|
1252
|
+
h("path", { key: "tags-2", fill: "currentColor", d: "M15 7.37 10.15 3a1.12 1.12 0 0 0-.77-.29H8.26l4.5 4.09a1.76 1.76 0 0 1 0 2.65L8.77 13a1.17 1.17 0 0 0 1.55 0L15 8.79a.94.94 0 0 0 0-1.42Z" }),
|
|
944
1253
|
],
|
|
945
1254
|
'thumb-up': () => (h("path", { fill: "currentColor", d: "M2.11 14.36h1a.45.45 0 0 0 .45-.44V7.17a.45.45 0 0 0-.45-.44h-1a.44.44 0 0 0-.44.44v6.75a.44.44 0 0 0 .44.44Zm12.22-7a1.27 1.27 0 0 0-1.27-1.27H9.71l.61-2.91v-.2a1.07 1.07 0 0 0-.28-.68l-.68-.66-4.17 4.19a1.26 1.26 0 0 0-.37.9v6.36a1.27 1.27 0 0 0 1.27 1.27h5.06a1.24 1.24 0 0 0 1.17-.77l1.92-4.49a1.22 1.22 0 0 0 .09-.46V7.42Z" })),
|
|
946
1255
|
'trash': () => [
|
|
947
|
-
h("path", { fill: "currentColor", d: "M3.27 14.17c0 .66.54 1.19 1.2 1.2h7l-.05-.02h.08c.64-.02 1.14-.56 1.12-1.2V4.32H3.27v9.85Zm5.97-7.12c0-.33.27-.6.6-.6s.6.27.6.6v5.3c0 .33-.27.6-.6.6s-.6-.27-.6-.6v-5.3Zm-3.5 0c0-.33.27-.59.6-.6.32.02.58.28.6.6v5.3c-.02.32-.28.58-.6.6a.645.645 0 0 1-.6-.6v-5.3Zm7.28-5.39h-2.6V.95a.28.28 0 0 0-.28-.28H5.87a.28.28 0 0 0-.28.28v.72H2.91a.28.28 0 0 0-.28.28V3.1c0 .15.12.28.28.28h10.11c.15 0 .28-.12.28-.28V1.94a.28.28 0 0 0-.28-.28Z" }),
|
|
948
|
-
h("path", { fill: "currentColor", d: "M13,2h-2.9L9.9,1.6 C9.8,1.4,9.6,1.2,9.4,1.2H6.6c-0.2,0-0.4,0.1-0.5,0.3L5.8,2H2.9C2.7,2,2.5,2.2,2.5,2.4c0,0,0,0,0,0v0.8c0,0.2,0.2,0.4,0.4,0.4H13 c0.2,0,0.4-0.2,0.4-0.4V2.4C13.4,2.2,13.2,2,13,2z" }),
|
|
1256
|
+
h("path", { key: "trash-1", fill: "currentColor", d: "M3.27 14.17c0 .66.54 1.19 1.2 1.2h7l-.05-.02h.08c.64-.02 1.14-.56 1.12-1.2V4.32H3.27v9.85Zm5.97-7.12c0-.33.27-.6.6-.6s.6.27.6.6v5.3c0 .33-.27.6-.6.6s-.6-.27-.6-.6v-5.3Zm-3.5 0c0-.33.27-.59.6-.6.32.02.58.28.6.6v5.3c-.02.32-.28.58-.6.6a.645.645 0 0 1-.6-.6v-5.3Zm7.28-5.39h-2.6V.95a.28.28 0 0 0-.28-.28H5.87a.28.28 0 0 0-.28.28v.72H2.91a.28.28 0 0 0-.28.28V3.1c0 .15.12.28.28.28h10.11c.15 0 .28-.12.28-.28V1.94a.28.28 0 0 0-.28-.28Z" }),
|
|
1257
|
+
h("path", { key: "trash-2", fill: "currentColor", d: "M13,2h-2.9L9.9,1.6 C9.8,1.4,9.6,1.2,9.4,1.2H6.6c-0.2,0-0.4,0.1-0.5,0.3L5.8,2H2.9C2.7,2,2.5,2.2,2.5,2.4c0,0,0,0,0,0v0.8c0,0.2,0.2,0.4,0.4,0.4H13 c0.2,0,0.4-0.2,0.4-0.4V2.4C13.4,2.2,13.2,2,13,2z" }),
|
|
949
1258
|
],
|
|
950
1259
|
'universal-access': () => (h("path", { fill: "currentColor", d: "M8 15.33A7.33 7.33 0 1 1 15.33 8 7.34 7.34 0 0 1 8 15.33ZM8 1.71A6.29 6.29 0 1 0 14.29 8 6.29 6.29 0 0 0 8 1.71ZM13.74 8A5.74 5.74 0 1 1 8 2.25 5.75 5.75 0 0 1 13.74 8ZM8 3.77a1.07 1.07 0 1 0 1.07 1.07A1.07 1.07 0 0 0 8 3.77ZM4.67 5.63c-.6-.14-.87.86-.32 1s1.79.43 2.57.55a11.25 11.25 0 0 1-.72 4.47.54.54 0 0 0 .85.65 6.94 6.94 0 0 0 .78-2.42c0-.07.31-.11.33 0a8.73 8.73 0 0 0 .63 2.23c.3.65 1.31.26 1-.38a11.54 11.54 0 0 1-.76-4.58 21.34 21.34 0 0 0 2.41-.45.55.55 0 1 0-.2-1.08 11.47 11.47 0 0 1-6.57.01Z" })),
|
|
951
1260
|
'unlink': () => (h("path", { fill: "currentColor", d: "M9.74 6.25c-.16-.17-.32-.3-.5-.43-.14-.09-.31-.1-.44 0l1.81 1.81c-.17-.5-.47-.98-.87-1.38Zm-1.1 3.51c-.07.15-.17.28-.29.4l-1.66 1.66s-.04.05-.07.07c-.72.67-1.85.63-2.52-.09-.67-.72-.63-1.85.09-2.52l.32-.32c.1-.11.14-.27.09-.41-.14-.42-.22-.86-.24-1.3a.42.42 0 0 0-.12-.26.395.395 0 0 0-.56 0l-.92.92a3.76 3.76 0 0 0 0 5.32 3.76 3.76 0 0 0 5.32 0l1.66-1.67c.12-.12.23-.25.32-.38L8.64 9.76Zm4.61-7h-.02a3.778 3.778 0 0 0-5.32 0L6.83 3.84l1.41 1.41 1.08-1.08c.68-.71 1.81-.74 2.52-.06.71.68.74 1.81.06 2.52-.02.03-.05.05-.07.07l-.32.32c-.11.11-.14.27-.09.41.13.4.21.81.23 1.23l.44.44c.09 0 .18-.05.24-.11l.92-.92a3.76 3.76 0 0 0 0-5.32Zm.97 10.52-1.03 1.03-5.14-5.14c-.04.17-.12.33-.25.45l-.52.52c-.14.13-.35.15-.51.04-.18-.13-.35-.27-.5-.42-.74-.74-1.11-1.7-1.11-2.67 0-.24.02-.49.08-.73l-3.6-3.6 1.03-1.03 11.55 11.55Z" })),
|
|
@@ -963,7 +1272,7 @@ const icons = {
|
|
|
963
1272
|
/**
|
|
964
1273
|
* List of all possibles sizes
|
|
965
1274
|
*/
|
|
966
|
-
const sizes$
|
|
1275
|
+
const sizes$1 = ['small', 'regular', 'large', 'extra-large'];
|
|
967
1276
|
/**
|
|
968
1277
|
* List of all possibles variants
|
|
969
1278
|
*/
|
|
@@ -988,7 +1297,7 @@ const MgIcon = class {
|
|
|
988
1297
|
}
|
|
989
1298
|
validateIcon(newValue, oldValue) {
|
|
990
1299
|
if (!Object.keys(icons).includes(newValue)) {
|
|
991
|
-
throw new Error(`<mg-icon> prop "icon" must be one of
|
|
1300
|
+
throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}`);
|
|
992
1301
|
}
|
|
993
1302
|
else {
|
|
994
1303
|
if (oldValue !== undefined) {
|
|
@@ -998,8 +1307,8 @@ const MgIcon = class {
|
|
|
998
1307
|
}
|
|
999
1308
|
}
|
|
1000
1309
|
validateSize(newValue, oldValue) {
|
|
1001
|
-
if (!sizes$
|
|
1002
|
-
throw new Error(`<mg-icon> prop "size" must be one of
|
|
1310
|
+
if (!sizes$1.includes(newValue)) {
|
|
1311
|
+
throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$1.join(', ')}`);
|
|
1003
1312
|
}
|
|
1004
1313
|
else {
|
|
1005
1314
|
if (oldValue !== undefined) {
|
|
@@ -1010,7 +1319,7 @@ const MgIcon = class {
|
|
|
1010
1319
|
}
|
|
1011
1320
|
validateVariant(newValue, oldValue) {
|
|
1012
1321
|
if (newValue !== undefined && !variants$2.includes(newValue)) {
|
|
1013
|
-
throw new Error(`<mg-icon> prop "variant" must be one of
|
|
1322
|
+
throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}`);
|
|
1014
1323
|
}
|
|
1015
1324
|
else if (newValue !== undefined) {
|
|
1016
1325
|
if (oldValue !== undefined) {
|
|
@@ -1075,13 +1384,14 @@ const MgIllustratedMessage = class {
|
|
|
1075
1384
|
*/
|
|
1076
1385
|
componentDidLoad() {
|
|
1077
1386
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
1078
|
-
const
|
|
1387
|
+
const slottedIllustrations = this.element.querySelectorAll('[slot="illustration"]');
|
|
1079
1388
|
if (!isTagName(this.element.querySelector('[slot="title"]'), headingTags)) {
|
|
1080
1389
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
1081
1390
|
}
|
|
1082
|
-
else if (
|
|
1083
|
-
throw new Error(
|
|
1391
|
+
else if (slottedIllustrations.length !== 1) {
|
|
1392
|
+
throw new Error('<mg-illustrated-message> Slotted illustration must be present and unique.');
|
|
1084
1393
|
}
|
|
1394
|
+
slottedIllustrations[0].setAttribute('aria-hidden', 'true');
|
|
1085
1395
|
}
|
|
1086
1396
|
/**
|
|
1087
1397
|
* Render
|
|
@@ -1160,6 +1470,11 @@ const MgInput = (props, children, utils) => {
|
|
|
1160
1470
|
if (props.labelOnTop && props.labelHide) {
|
|
1161
1471
|
throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
|
|
1162
1472
|
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Set readonly value
|
|
1475
|
+
*/
|
|
1476
|
+
if (props.readonlyValue === undefined)
|
|
1477
|
+
props.readonlyValue = props.value;
|
|
1163
1478
|
/**
|
|
1164
1479
|
* Component classes
|
|
1165
1480
|
*/
|
|
@@ -1213,7 +1528,7 @@ const MgInput = (props, children, utils) => {
|
|
|
1213
1528
|
getInputTitle(),
|
|
1214
1529
|
!props.readonly && props.tooltip && getTooltip())) : (getInputTitle()),
|
|
1215
1530
|
props.readonly ? (h("div", { class: "mg-input__input-container" },
|
|
1216
|
-
h("strong", null, props.readonlyValue
|
|
1531
|
+
h("strong", null, props.readonlyValue),
|
|
1217
1532
|
children.filter(child => child.$name$ === 'append-input'))) : (h("div", { class: "mg-input__input-container" },
|
|
1218
1533
|
h("div", { class: { 'mg-input__input': true, 'mg-input__input--has-error': props.errorMessage !== undefined } },
|
|
1219
1534
|
applyAriadescribedBy(children, ariaDescribedbyIDs, utils),
|
|
@@ -1222,7 +1537,7 @@ const MgInput = (props, children, utils) => {
|
|
|
1222
1537
|
props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
|
|
1223
1538
|
};
|
|
1224
1539
|
|
|
1225
|
-
const mgInputCheckboxCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}fieldset.mg-input{border:0;margin-left:0;margin-right:0;padding:0}fieldset.mg-input input[type=radio],fieldset.mg-input input[type=checkbox]{flex-shrink:0;width:var(--mg-input-check-size);height:var(--mg-input-check-size);margin-top:calc((var(--font-size) * var(--line-height) - var(--mg-input-check-size)) / 2);margin-right:0.6rem;margin-bottom:0;margin-left:0}fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container{margin-top:0.7rem}.mg-input__input-container mg-tooltip{margin-left:3rem}.mg-input__input-group-container{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;column-gap:2.3rem;row-gap:1rem;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2)}.mg-input__input-group-container--vertical{flex-direction:column}.mg-input__input-group{display:flex;align-items:top}.
|
|
1540
|
+
const mgInputCheckboxCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}fieldset.mg-input{border:0;margin-left:0;margin-right:0;padding:0}fieldset.mg-input input[type=radio],fieldset.mg-input input[type=checkbox]{flex-shrink:0;width:var(--mg-input-check-size);height:var(--mg-input-check-size);margin-top:calc((var(--font-size) * var(--line-height) - var(--mg-input-check-size)) / 2);margin-right:0.6rem;margin-bottom:0;margin-left:0}fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container{margin-top:0.7rem}.mg-input__input-container mg-tooltip{margin-left:3rem}.mg-input__input-group-container{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;column-gap:2.3rem;row-gap:1rem;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2)}.mg-input__input-group-container--vertical{flex-direction:column}.mg-input__input-group{display:flex;align-items:top}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}";
|
|
1226
1541
|
|
|
1227
1542
|
/**
|
|
1228
1543
|
* type CheckboxItem validation function
|
|
@@ -1370,11 +1685,11 @@ const MgInputCheckbox = class {
|
|
|
1370
1685
|
* @returns {HTMLElement} HTML Element
|
|
1371
1686
|
*/
|
|
1372
1687
|
render() {
|
|
1373
|
-
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly ? this.tooltip : undefined, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList } }, this.checkboxItems
|
|
1688
|
+
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly ? this.tooltip : undefined, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }, role: "list" }, this.checkboxItems
|
|
1374
1689
|
.filter(item => {
|
|
1375
1690
|
return !this.readonly || item.value;
|
|
1376
1691
|
})
|
|
1377
|
-
.map((input, index) => (h("li", { class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: this.identifier, value: input.value && input.value.toString(), checked: Boolean(input.value), disabled: this.readonly || this.disabled || input.disabled, required: this.required, indeterminate: input.value === null, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
|
|
1692
|
+
.map((input, index) => (h("li", { key: input.id, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: this.identifier, value: input.value && input.value.toString(), checked: Boolean(input.value), disabled: this.readonly || this.disabled || input.disabled, required: this.required, indeterminate: input.value === null, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
|
|
1378
1693
|
if (el !== null)
|
|
1379
1694
|
this.inputs[index] = el;
|
|
1380
1695
|
} }), h("label", { htmlFor: input.id }, input.title)))))));
|
|
@@ -1397,46 +1712,7 @@ var InputError$1;
|
|
|
1397
1712
|
InputError["REQUIRED"] = "required";
|
|
1398
1713
|
})(InputError$1 || (InputError$1 = {}));
|
|
1399
1714
|
|
|
1400
|
-
|
|
1401
|
-
* Format number to the locale currency
|
|
1402
|
-
*
|
|
1403
|
-
* @param {number} number number to format
|
|
1404
|
-
* @param {string} locale locale to apply
|
|
1405
|
-
* @param {string} currency currency to apply
|
|
1406
|
-
* @returns {string} formatted currency
|
|
1407
|
-
*/
|
|
1408
|
-
function localeCurrency(number, locale, currency) {
|
|
1409
|
-
return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);
|
|
1410
|
-
}
|
|
1411
|
-
/**
|
|
1412
|
-
* Format number to locale
|
|
1413
|
-
*
|
|
1414
|
-
* @param {number} number number to format
|
|
1415
|
-
* @param {string} locale locale to apply
|
|
1416
|
-
* @returns {string} formatted number
|
|
1417
|
-
*/
|
|
1418
|
-
function localeNumber(number, locale) {
|
|
1419
|
-
return new Intl.NumberFormat(locale).format(number);
|
|
1420
|
-
}
|
|
1421
|
-
/**
|
|
1422
|
-
* Date RegExp
|
|
1423
|
-
*/
|
|
1424
|
-
const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
1425
|
-
/**
|
|
1426
|
-
* Locale date format
|
|
1427
|
-
*
|
|
1428
|
-
* @param {string} date date to format
|
|
1429
|
-
* @param {string} locale locale to apply
|
|
1430
|
-
* @returns {string} formatted date
|
|
1431
|
-
*/
|
|
1432
|
-
function localeDate(date, locale) {
|
|
1433
|
-
if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {
|
|
1434
|
-
return '';
|
|
1435
|
-
}
|
|
1436
|
-
return new Intl.DateTimeFormat(locale).format(new Date(date));
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
const mgInputDateCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsla(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0%;border-bottom-right-radius:0%}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}";
|
|
1715
|
+
const mgInputDateCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0;border-bottom-right-radius:0}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}";
|
|
1440
1716
|
|
|
1441
1717
|
const MgInputDate = class {
|
|
1442
1718
|
constructor(hostRef) {
|
|
@@ -1542,11 +1818,14 @@ const MgInputDate = class {
|
|
|
1542
1818
|
this.errorMessage = undefined;
|
|
1543
1819
|
}
|
|
1544
1820
|
validateValue(newValue) {
|
|
1821
|
+
// When the input is not fully completed or has been cleared, the value becomes an empty string.
|
|
1822
|
+
if (newValue === '')
|
|
1823
|
+
newValue = null;
|
|
1545
1824
|
if (newValue !== undefined && newValue !== null && (typeof newValue !== 'string' || !dateRegExp.test(newValue))) {
|
|
1546
1825
|
throw new Error("<mg-input-date> props 'value' doesn't match pattern: yyyy-mm-dd");
|
|
1547
1826
|
}
|
|
1548
1827
|
else {
|
|
1549
|
-
this.valueChange.emit(
|
|
1828
|
+
this.valueChange.emit(newValue);
|
|
1550
1829
|
}
|
|
1551
1830
|
}
|
|
1552
1831
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -1604,7 +1883,7 @@ const MgInputDate = class {
|
|
|
1604
1883
|
* @returns {HTMLElement} HTML Element
|
|
1605
1884
|
*/
|
|
1606
1885
|
render() {
|
|
1607
|
-
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: localeDate(this.value, this.locale), tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "date", class: "mg-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur,
|
|
1886
|
+
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: localeDate(this.value, this.locale), tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "date", class: "mg-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
|
|
1608
1887
|
if (el !== null)
|
|
1609
1888
|
this.input = el;
|
|
1610
1889
|
} })));
|
|
@@ -1633,7 +1912,7 @@ var InputError;
|
|
|
1633
1912
|
InputError["REQUIRED"] = "required";
|
|
1634
1913
|
})(InputError || (InputError = {}));
|
|
1635
1914
|
|
|
1636
|
-
const mgInputNumericCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem
|
|
1915
|
+
const mgInputNumericCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0;border-bottom-right-radius:0}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){justify-content:space-between}.mg-input.mg-input--width-full.mg-input--label-on-top .mg-input__box{width:100%}.mg-input.mg-input--width-full .mg-input__input-container{flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{max-width:100%}.mg-input:not(.mg-input--label-on-top) .mg-input__box{width:100%;max-width:calc(17.7rem + var(--mg-inputs-spacer) * 2);min-width:5rem}.mg-input.mg-input--width-16 .mg-input__input-container{width:100%}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__input{width:100%;max-width:21rem}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__with-character-left{width:100%}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__box{max-width:21rem;min-width:100%}.mg-input.mg-input--width-4 .mg-input__input-container .mg-input__box{max-width:7rem}.mg-input.mg-input--width-2 .mg-input__input-container .mg-input__box{max-width:5rem}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-input .mg-input__box{text-align:var(--mg-inputs-text-align, right)}";
|
|
1637
1916
|
|
|
1638
1917
|
const MgInputNumeric = class {
|
|
1639
1918
|
constructor(hostRef) {
|
|
@@ -1812,7 +2091,7 @@ const MgInputNumeric = class {
|
|
|
1812
2091
|
}
|
|
1813
2092
|
validateType(newValue) {
|
|
1814
2093
|
if (!types.includes(newValue)) {
|
|
1815
|
-
throw new Error(`<mg-input-numeric> prop "type" must be one of
|
|
2094
|
+
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}`);
|
|
1816
2095
|
}
|
|
1817
2096
|
}
|
|
1818
2097
|
validateIntegerLength(newValue) {
|
|
@@ -1894,7 +2173,7 @@ const MgInputNumeric = class {
|
|
|
1894
2173
|
};
|
|
1895
2174
|
MgInputNumeric.style = mgInputNumericCss;
|
|
1896
2175
|
|
|
1897
|
-
const mgInputPasswordCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem
|
|
2176
|
+
const mgInputPasswordCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0;border-bottom-right-radius:0}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){justify-content:space-between}.mg-input.mg-input--width-full.mg-input--label-on-top .mg-input__box{width:100%}.mg-input.mg-input--width-full .mg-input__input-container{flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{max-width:100%}.mg-input:not(.mg-input--label-on-top) .mg-input__box{width:100%;max-width:calc(17.7rem + var(--mg-inputs-spacer) * 2);min-width:5rem}.mg-input.mg-input--width-16 .mg-input__input-container{width:100%}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__input{width:100%;max-width:21rem}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__with-character-left{width:100%}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__box{max-width:21rem;min-width:100%}.mg-input.mg-input--width-4 .mg-input__input-container .mg-input__box{max-width:7rem}.mg-input.mg-input--width-2 .mg-input__input-container .mg-input__box{max-width:5rem}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}";
|
|
1898
2177
|
|
|
1899
2178
|
const MgInputPassword = class {
|
|
1900
2179
|
constructor(hostRef) {
|
|
@@ -2020,7 +2299,7 @@ const MgInputPassword = class {
|
|
|
2020
2299
|
};
|
|
2021
2300
|
MgInputPassword.style = mgInputPasswordCss;
|
|
2022
2301
|
|
|
2023
|
-
const mgInputRadioCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}fieldset.mg-input{border:0;margin-left:0;margin-right:0;padding:0}fieldset.mg-input input[type=radio],fieldset.mg-input input[type=checkbox]{flex-shrink:0;width:var(--mg-input-check-size);height:var(--mg-input-check-size);margin-top:calc((var(--font-size) * var(--line-height) - var(--mg-input-check-size)) / 2);margin-right:0.6rem;margin-bottom:0;margin-left:0}fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container{margin-top:0.7rem}.mg-input__input-container mg-tooltip{margin-left:3rem}.mg-input__input-group-container{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;column-gap:2.3rem;row-gap:1rem;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2)}.mg-input__input-group-container--vertical{flex-direction:column}.mg-input__input-group{display:flex;align-items:top}.
|
|
2302
|
+
const mgInputRadioCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}fieldset.mg-input{border:0;margin-left:0;margin-right:0;padding:0}fieldset.mg-input input[type=radio],fieldset.mg-input input[type=checkbox]{flex-shrink:0;width:var(--mg-input-check-size);height:var(--mg-input-check-size);margin-top:calc((var(--font-size) * var(--line-height) - var(--mg-input-check-size)) / 2);margin-right:0.6rem;margin-bottom:0;margin-left:0}fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container{margin-top:0.7rem}.mg-input__input-container mg-tooltip{margin-left:3rem}.mg-input__input-group-container{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;column-gap:2.3rem;row-gap:1rem;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2)}.mg-input__input-group-container--vertical{flex-direction:column}.mg-input__input-group{display:flex;align-items:top}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}";
|
|
2024
2303
|
|
|
2025
2304
|
/**
|
|
2026
2305
|
* type Option validation function
|
|
@@ -2175,7 +2454,7 @@ const MgInputRadio = class {
|
|
|
2175
2454
|
* @returns {HTMLElement} HTML Element
|
|
2176
2455
|
*/
|
|
2177
2456
|
render() {
|
|
2178
|
-
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList } }, this.options.map((input, index) => (h("li", { class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: el => {
|
|
2457
|
+
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }, role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: el => {
|
|
2179
2458
|
if (el !== null)
|
|
2180
2459
|
this.inputs[index] = el;
|
|
2181
2460
|
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title)))))));
|
|
@@ -2191,7 +2470,7 @@ const MgInputRadio = class {
|
|
|
2191
2470
|
};
|
|
2192
2471
|
MgInputRadio.style = mgInputRadioCss;
|
|
2193
2472
|
|
|
2194
|
-
const mgInputSelectCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem
|
|
2473
|
+
const mgInputSelectCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0;border-bottom-right-radius:0}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){justify-content:space-between}.mg-input.mg-input--width-full.mg-input--label-on-top .mg-input__box{width:100%}.mg-input.mg-input--width-full .mg-input__input-container{flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{max-width:100%}.mg-input:not(.mg-input--label-on-top) .mg-input__box{width:100%;max-width:calc(17.7rem + var(--mg-inputs-spacer) * 2);min-width:5rem}.mg-input.mg-input--width-16 .mg-input__input-container{width:100%}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__input{width:100%;max-width:21rem}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__with-character-left{width:100%}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__box{max-width:21rem;min-width:100%}.mg-input.mg-input--width-4 .mg-input__input-container .mg-input__box{max-width:7rem}.mg-input.mg-input--width-2 .mg-input__input-container .mg-input__box{max-width:5rem}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-input__box{width:100%;padding-top:0;padding-bottom:0;padding-right:1rem}.mg-input.mg-input--select:not(.mg-input--label-on-top) .mg-input__box{max-width:unset}";
|
|
2195
2474
|
|
|
2196
2475
|
/**
|
|
2197
2476
|
* Check if item is a well configured option
|
|
@@ -2311,13 +2590,17 @@ const MgInputSelect = class {
|
|
|
2311
2590
|
this.valueChange.emit(newValue);
|
|
2312
2591
|
}
|
|
2313
2592
|
validateItems(newValue) {
|
|
2593
|
+
// Empty options
|
|
2594
|
+
if (newValue.length === 0) {
|
|
2595
|
+
this.options = [];
|
|
2596
|
+
}
|
|
2314
2597
|
// String array
|
|
2315
|
-
if (allItemsAreString(newValue)) {
|
|
2598
|
+
else if (allItemsAreString(newValue)) {
|
|
2316
2599
|
this.valueExist = newValue.includes(this.value);
|
|
2317
2600
|
this.options = newValue.map((item) => ({ title: item, value: item }));
|
|
2318
2601
|
}
|
|
2319
2602
|
// Object array
|
|
2320
|
-
else if (newValue
|
|
2603
|
+
else if (newValue.every(item => isOption$1(item))) {
|
|
2321
2604
|
this.valueExist = newValue.map(item => item.value).includes(this.value);
|
|
2322
2605
|
// Grouped object options
|
|
2323
2606
|
if (newValue.some(item => item.group !== undefined)) {
|
|
@@ -2329,7 +2612,7 @@ const MgInputSelect = class {
|
|
|
2329
2612
|
}
|
|
2330
2613
|
}
|
|
2331
2614
|
else {
|
|
2332
|
-
throw new Error('<mg-input-select> prop "items" is required
|
|
2615
|
+
throw new Error('<mg-input-select> prop "items" is required, can be an empty Array or all items must be the same type: string or Option.');
|
|
2333
2616
|
}
|
|
2334
2617
|
}
|
|
2335
2618
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -2386,7 +2669,7 @@ const MgInputSelect = class {
|
|
|
2386
2669
|
if (el !== null)
|
|
2387
2670
|
this.input = el;
|
|
2388
2671
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
2389
|
-
h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => option.group !== undefined ? (h("optgroup", { label: option.group }, option.options.map(optgroup => (h("option", { value: optgroup.title, selected: JSON.stringify(this.value) === JSON.stringify(optgroup.value), disabled: optgroup.disabled }, optgroup.title))))) : (h("option", { value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title))))));
|
|
2672
|
+
h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => option.group !== undefined ? (h("optgroup", { label: option.group }, option.options.map(optgroup => (h("option", { key: optgroup.title, value: optgroup.title, selected: JSON.stringify(this.value) === JSON.stringify(optgroup.value), disabled: optgroup.disabled }, optgroup.title))))) : (h("option", { value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title))))));
|
|
2390
2673
|
}
|
|
2391
2674
|
get element() { return getElement(this); }
|
|
2392
2675
|
static get watchers() { return {
|
|
@@ -2399,7 +2682,7 @@ const MgInputSelect = class {
|
|
|
2399
2682
|
};
|
|
2400
2683
|
MgInputSelect.style = mgInputSelectCss;
|
|
2401
2684
|
|
|
2402
|
-
const mgInputTextCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem
|
|
2685
|
+
const mgInputTextCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0;border-bottom-right-radius:0}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){justify-content:space-between}.mg-input.mg-input--width-full.mg-input--label-on-top .mg-input__box{width:100%}.mg-input.mg-input--width-full .mg-input__input-container{flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{max-width:100%}.mg-input:not(.mg-input--label-on-top) .mg-input__box{width:100%;max-width:calc(17.7rem + var(--mg-inputs-spacer) * 2);min-width:5rem}.mg-input.mg-input--width-16 .mg-input__input-container{width:100%}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__input{width:100%;max-width:21rem}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__with-character-left{width:100%}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__box{max-width:21rem;min-width:100%}.mg-input.mg-input--width-4 .mg-input__input-container .mg-input__box{max-width:7rem}.mg-input.mg-input--width-2 .mg-input__input-container .mg-input__box{max-width:5rem}.mg-input mg-character-left{opacity:0.6;font-size:1.1rem}.mg-input.mg-input--has-display-character-left .mg-input__input+.mg-input__help-text,.mg-input.mg-input--has-display-character-left .mg-input__input+.mg-input__error{margin-top:0}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-input.mg-input--has-icon .mg-input__with-character-left>mg-icon{position:absolute;top:50%;left:var(--mg-inputs-spacer);color:var(--mg-inputs-color);transform:translateY(-50%)}.mg-input.mg-input--has-icon .mg-input__with-character-left .mg-input__box{padding-left:calc(var(--mg-icon-regular-size) + var(--mg-inputs-spacer) * 2)}.mg-input__with-character-left{position:relative;display:inline-flex}.mg-input--width-full .mg-input__with-character-left{width:100%}.mg-input.is-focused .mg-input__with-character-left .mg-input__box{padding-right:calc(var(--mg-character-left-message-length) * 1ch + 0.8rem)}.mg-input__with-character-left mg-character-left{position:absolute;display:none;top:50%;right:1rem;opacity:0.6;transform:translateY(-50%);font-size:1.1rem}.mg-input.is-focused .mg-input__with-character-left mg-character-left{display:block}";
|
|
2403
2686
|
|
|
2404
2687
|
const MgInputText = class {
|
|
2405
2688
|
constructor(hostRef) {
|
|
@@ -2617,7 +2900,7 @@ const MgInputText = class {
|
|
|
2617
2900
|
};
|
|
2618
2901
|
MgInputText.style = mgInputTextCss;
|
|
2619
2902
|
|
|
2620
|
-
const mgInputTextareaCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem
|
|
2903
|
+
const mgInputTextareaCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.mg-input__box{padding:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);height:var(--default-size);box-sizing:border-box;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));font-family:inherit;color:hsl(var(--color-dark));font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-input__box:focus{box-shadow:0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5)}.mg-input__box:disabled{opacity:0.3}.mg-input.mg-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0;}.mg-input.mg-input--is-input-group-append .mg-input__box{margin-right:-0.1rem;border-top-right-radius:0;border-bottom-right-radius:0}.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible{outline-style:solid;outline-offset:-0.2rem;outline-width:0.2rem}.mg-input.mg-input--is-input-group-append.mg-input--readonly slot[name=append-input]{display:none}.mg-input.mg-input--label-on-top .mg-input__box{width:auto;max-width:100%}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input.mg-input--width-full:not(.mg-input--label-on-top){justify-content:space-between}.mg-input.mg-input--width-full.mg-input--label-on-top .mg-input__box{width:100%}.mg-input.mg-input--width-full .mg-input__input-container{flex:auto;width:100%}.mg-input.mg-input--width-full .mg-input__input-container .mg-input__box{max-width:100%}.mg-input:not(.mg-input--label-on-top) .mg-input__box{width:100%;max-width:calc(17.7rem + var(--mg-inputs-spacer) * 2);min-width:5rem}.mg-input.mg-input--width-16 .mg-input__input-container{width:100%}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__input{width:100%;max-width:21rem}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__with-character-left{width:100%}.mg-input.mg-input--width-16 .mg-input__input-container .mg-input__box{max-width:21rem;min-width:100%}.mg-input.mg-input--width-4 .mg-input__input-container .mg-input__box{max-width:7rem}.mg-input.mg-input--width-2 .mg-input__input-container .mg-input__box{max-width:5rem}.mg-input mg-character-left{opacity:0.6;font-size:1.1rem}.mg-input.mg-input--has-display-character-left .mg-input__input+.mg-input__help-text,.mg-input.mg-input--has-display-character-left .mg-input__input+.mg-input__error{margin-top:0}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-input .mg-input__box{display:block;height:auto;resize:none}.mg-input .mg-input__box.mg-input__box--resizable{resize:both}.mg-input .mg-input__box.mg-input__box--resizable-horizontal{resize:horizontal}.mg-input .mg-input__box.mg-input__box--resizable-vertical{resize:vertical}.mg-input__with-character-left{width:100%}.mg-input__with-character-left mg-character-left{display:block;visibility:hidden;margin-top:0.2rem;text-align:end}.mg-input.is-focused .mg-input__with-character-left mg-character-left{visibility:visible}@-moz-document url-prefix(){.mg-input__box{overflow-x:hidden}}";
|
|
2621
2904
|
|
|
2622
2905
|
const MgInputTextarea = class {
|
|
2623
2906
|
constructor(hostRef) {
|
|
@@ -2661,7 +2944,7 @@ const MgInputTextarea = class {
|
|
|
2661
2944
|
};
|
|
2662
2945
|
/**
|
|
2663
2946
|
* Get pattern validity
|
|
2664
|
-
* Pattern is not defined on textarea field
|
|
2947
|
+
* Pattern is not defined on textarea field: https://developer.mozilla.org/fr/docs/Web/HTML/Element/Textarea
|
|
2665
2948
|
*
|
|
2666
2949
|
* @returns {boolean} is pattern valid
|
|
2667
2950
|
*/
|
|
@@ -2853,7 +3136,7 @@ const MgInputTitle = class {
|
|
|
2853
3136
|
};
|
|
2854
3137
|
MgInputTitle.style = mgInputTitleCss;
|
|
2855
3138
|
|
|
2856
|
-
const mgInputToggleCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-input.mg-input.mg-input--toggle .mg-input__input-container{flex:auto;min-width:0}.mg-input__button-toggle{display:flex;padding:0.2rem;min-width:0;background-color:hsl(var(--color-light));border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size) * var(--line-height) + 2 * (0.7rem + var(--mg-inputs-border-width))) / var(--mg-input-toggle-border-radius-ratio));font-family:var(--font-family);font-size:inherit;line-height:inherit;cursor:pointer}.mg-input__button-toggle:disabled{cursor:default}.mg-input__toggle-item-container{padding:0.5rem 0.9rem;border:0;box-sizing:border-box;border-radius:calc((var(--font-size) * var(--line-height) + 1rem) / var(--mg-input-toggle-border-radius-ratio));background-color:unset;font-weight:unset;color:hsl(var(--color-dark));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container{display:flex;justify-content:center;align-items:center;width:calc(var(--font-size) * var(--line-height) + 1rem);height:calc(var(--font-size) * var(--line-height) + 1rem);padding:0;visibility:hidden}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container:first-of-type{visibility:visible}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{visibility:hidden}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{visibility:visible}.mg-input.mg-input--toggle-on-off .mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-dark));background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%))}.mg-input.mg-input--toggle-on-off.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-readonly .mg-input__button-toggle{border-color:transparent;background-color:transparent;cursor:initial}.mg-input.mg-input--toggle-readonly .mg-input__toggle-item-container:last-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{display:flex}
|
|
3139
|
+
const mgInputToggleCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__input .mg-input__box:disabled,.mg-input__input-group--disabled label,.mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle{opacity:var(--mg-disabled-opacity)}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-input.mg-input.mg-input--toggle .mg-input__input-container{flex:auto;min-width:0}.mg-input__button-toggle{display:flex;padding:0.2rem;min-width:0;background-color:hsl(var(--color-light));border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size) * var(--line-height) + 2 * (0.7rem + var(--mg-inputs-border-width))) / var(--mg-input-toggle-border-radius-ratio));font-family:var(--font-family);font-size:inherit;line-height:inherit;cursor:pointer}.mg-input__button-toggle:disabled{cursor:default}.mg-input__toggle-item-container{padding:0.5rem 0.9rem;border:0;box-sizing:border-box;border-radius:calc((var(--font-size) * var(--line-height) + 1rem) / var(--mg-input-toggle-border-radius-ratio));background-color:unset;font-weight:unset;color:hsl(var(--color-dark));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container{display:flex;justify-content:center;align-items:center;width:calc(var(--font-size) * var(--line-height) + 1rem);height:calc(var(--font-size) * var(--line-height) + 1rem);padding:0;visibility:hidden}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container:first-of-type{visibility:visible}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{visibility:hidden}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{visibility:visible}.mg-input.mg-input--toggle-on-off .mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-dark));background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%))}.mg-input.mg-input--toggle-on-off.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-readonly .mg-input__button-toggle{border-color:transparent;background-color:transparent;cursor:initial}.mg-input.mg-input--toggle-readonly .mg-input__toggle-item-container:last-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{display:flex}";
|
|
2857
3140
|
|
|
2858
3141
|
/**
|
|
2859
3142
|
* type Option validation function
|
|
@@ -2996,56 +3279,199 @@ const MgInputToggle = class {
|
|
|
2996
3279
|
this.checked = this.value === this.options[1].value;
|
|
2997
3280
|
}
|
|
2998
3281
|
}
|
|
2999
|
-
/*************
|
|
3000
|
-
* Lifecycle *
|
|
3001
|
-
*************/
|
|
3002
|
-
/**
|
|
3003
|
-
* Check if component props are well configured on init
|
|
3004
|
-
*/
|
|
3005
|
-
componentWillLoad() {
|
|
3006
|
-
// Check items format
|
|
3007
|
-
this.validateItems(this.items);
|
|
3008
|
-
// Check slots
|
|
3009
|
-
this.validateSlots();
|
|
3010
|
-
// init checked value
|
|
3011
|
-
this.setChecked();
|
|
3012
|
-
// apply handler
|
|
3013
|
-
this.handleIsOnOff(this.isOnOff);
|
|
3014
|
-
this.handleIsIcon(this.isIcon);
|
|
3015
|
-
this.handleReadonly(this.readonly);
|
|
3016
|
-
this.handleDisabled(this.disabled);
|
|
3017
|
-
}
|
|
3018
|
-
/**
|
|
3019
|
-
* Render
|
|
3020
|
-
*
|
|
3021
|
-
* @returns {HTMLElement} HTML Element
|
|
3022
|
-
*/
|
|
3023
|
-
render() {
|
|
3024
|
-
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, helpText: this.helpText, errorMessage: undefined, isFieldset: false }, h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-2" })))));
|
|
3025
|
-
}
|
|
3026
|
-
get element() { return getElement(this); }
|
|
3027
|
-
static get watchers() { return {
|
|
3028
|
-
"value": ["handleValue"],
|
|
3029
|
-
"items": ["validateItems"],
|
|
3030
|
-
"isOnOff": ["handleIsOnOff"],
|
|
3031
|
-
"isIcon": ["handleIsIcon"],
|
|
3032
|
-
"readonly": ["handleReadonly"],
|
|
3033
|
-
"disabled": ["handleDisabled"],
|
|
3034
|
-
"checked": ["handleChecked"]
|
|
3035
|
-
}; }
|
|
3036
|
-
};
|
|
3037
|
-
MgInputToggle.style = mgInputToggleCss;
|
|
3038
|
-
|
|
3039
|
-
/**
|
|
3040
|
-
*
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3282
|
+
/*************
|
|
3283
|
+
* Lifecycle *
|
|
3284
|
+
*************/
|
|
3285
|
+
/**
|
|
3286
|
+
* Check if component props are well configured on init
|
|
3287
|
+
*/
|
|
3288
|
+
componentWillLoad() {
|
|
3289
|
+
// Check items format
|
|
3290
|
+
this.validateItems(this.items);
|
|
3291
|
+
// Check slots
|
|
3292
|
+
this.validateSlots();
|
|
3293
|
+
// init checked value
|
|
3294
|
+
this.setChecked();
|
|
3295
|
+
// apply handler
|
|
3296
|
+
this.handleIsOnOff(this.isOnOff);
|
|
3297
|
+
this.handleIsIcon(this.isIcon);
|
|
3298
|
+
this.handleReadonly(this.readonly);
|
|
3299
|
+
this.handleDisabled(this.disabled);
|
|
3300
|
+
}
|
|
3301
|
+
/**
|
|
3302
|
+
* Render
|
|
3303
|
+
*
|
|
3304
|
+
* @returns {HTMLElement} HTML Element
|
|
3305
|
+
*/
|
|
3306
|
+
render() {
|
|
3307
|
+
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, helpText: this.helpText, errorMessage: undefined, isFieldset: false }, h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-2" })))));
|
|
3308
|
+
}
|
|
3309
|
+
get element() { return getElement(this); }
|
|
3310
|
+
static get watchers() { return {
|
|
3311
|
+
"value": ["handleValue"],
|
|
3312
|
+
"items": ["validateItems"],
|
|
3313
|
+
"isOnOff": ["handleIsOnOff"],
|
|
3314
|
+
"isIcon": ["handleIsIcon"],
|
|
3315
|
+
"readonly": ["handleReadonly"],
|
|
3316
|
+
"disabled": ["handleDisabled"],
|
|
3317
|
+
"checked": ["handleChecked"]
|
|
3318
|
+
}; }
|
|
3319
|
+
};
|
|
3320
|
+
MgInputToggle.style = mgInputToggleCss;
|
|
3321
|
+
|
|
3322
|
+
/**
|
|
3323
|
+
* MgMenuItem type guard
|
|
3324
|
+
*
|
|
3325
|
+
* @param {HTMLElement} element element to control type
|
|
3326
|
+
* @returns {boolean} truthy if element is mg-menu-item
|
|
3327
|
+
*/
|
|
3328
|
+
const isMgMenuItem = (element) => element.nodeName === 'MG-MENU-ITEM';
|
|
3329
|
+
var OverflowBehaviorElements;
|
|
3330
|
+
(function (OverflowBehaviorElements) {
|
|
3331
|
+
OverflowBehaviorElements["MORE"] = "data-overflow-more";
|
|
3332
|
+
OverflowBehaviorElements["BASE_INDEX"] = "data-overflow-base-index";
|
|
3333
|
+
OverflowBehaviorElements["PROXY_INDEX"] = "data-overflow-proxy-index";
|
|
3334
|
+
})(OverflowBehaviorElements || (OverflowBehaviorElements = {}));
|
|
3335
|
+
class OverflowBehavior {
|
|
3336
|
+
constructor(element, render) {
|
|
3337
|
+
this.element = element;
|
|
3338
|
+
this.render = render;
|
|
3339
|
+
/**********
|
|
3340
|
+
* Public *
|
|
3341
|
+
**********/
|
|
3342
|
+
/**
|
|
3343
|
+
* Disconnect ResizeObserver
|
|
3344
|
+
*
|
|
3345
|
+
* @returns {void}
|
|
3346
|
+
*/
|
|
3347
|
+
this.disconnect = () => {
|
|
3348
|
+
this.resizeObserver.disconnect();
|
|
3349
|
+
};
|
|
3350
|
+
/************
|
|
3351
|
+
* Internal *
|
|
3352
|
+
************/
|
|
3353
|
+
/**
|
|
3354
|
+
* run overflow behavior
|
|
3355
|
+
*
|
|
3356
|
+
* @param {number} width width of the container
|
|
3357
|
+
* @returns {void}
|
|
3358
|
+
*/
|
|
3359
|
+
this.run = (width) => {
|
|
3360
|
+
if (this.moreElement === undefined) {
|
|
3361
|
+
// set moreElement
|
|
3362
|
+
this.moreElement = this.render();
|
|
3363
|
+
this.moreElement.setAttribute(OverflowBehaviorElements.MORE, '');
|
|
3364
|
+
// set children
|
|
3365
|
+
this.children = Array.from(this.element.children);
|
|
3366
|
+
let moreElementChildren;
|
|
3367
|
+
const allowedElements = ['MG-MENU-ITEM', 'MG-BUTTON'];
|
|
3368
|
+
if (isMgMenuItem(this.moreElement)) {
|
|
3369
|
+
moreElementChildren = Array.from(this.moreElement.querySelector('mg-menu').children).filter(element => allowedElements.includes(element.nodeName));
|
|
3370
|
+
}
|
|
3371
|
+
this.children.forEach((child, index) => {
|
|
3372
|
+
child.setAttribute(OverflowBehaviorElements.BASE_INDEX, `${index}`);
|
|
3373
|
+
if (child.getAttribute(OverflowBehaviorElements.MORE) === null) {
|
|
3374
|
+
// set moreElement children
|
|
3375
|
+
moreElementChildren[index].setAttribute(OverflowBehaviorElements.PROXY_INDEX, `${index}`);
|
|
3376
|
+
}
|
|
3377
|
+
});
|
|
3378
|
+
}
|
|
3379
|
+
this.updateDisplayedItems(width);
|
|
3380
|
+
};
|
|
3381
|
+
/**
|
|
3382
|
+
* Update displayed items in container from a given available space
|
|
3383
|
+
*
|
|
3384
|
+
* @param {number} availableWidth available width in container to display child items
|
|
3385
|
+
* @returns {void}
|
|
3386
|
+
*/
|
|
3387
|
+
this.updateDisplayedItems = (availableWidth) => {
|
|
3388
|
+
this.restoreItems();
|
|
3389
|
+
const acc = { accWidth: 0, previousItem: null };
|
|
3390
|
+
this.children.forEach((child) => {
|
|
3391
|
+
acc.accWidth += child.offsetWidth;
|
|
3392
|
+
const isPreviousItemHidden = acc.previousItem !== null && acc.previousItem.getAttribute('hidden') !== null;
|
|
3393
|
+
// if previous item is hidden AND is NOT more element we hidde current
|
|
3394
|
+
// OR if item has an overflow we hidde current
|
|
3395
|
+
// OR if current item is more element AND have NOT previous hidden items, current more element item is an hidden item
|
|
3396
|
+
// ELSE current is a display item
|
|
3397
|
+
this.toggleItem(child, (isPreviousItemHidden && !this.isMoreElement(child)) || this.isOverflowElement(acc.accWidth, child, availableWidth) || (this.isMoreElement(child) && !isPreviousItemHidden));
|
|
3398
|
+
// update previous item with current item
|
|
3399
|
+
acc.previousItem = child;
|
|
3400
|
+
});
|
|
3401
|
+
};
|
|
3402
|
+
/**
|
|
3403
|
+
* Utility method to know if item overflow partialy or totaly in the container
|
|
3404
|
+
*
|
|
3405
|
+
* @param {number} cumulateWidth previous sibling elements cumulate width + item width
|
|
3406
|
+
* @param {HTMLElement} item item HTML element
|
|
3407
|
+
* @param {number} availableWidth container available width
|
|
3408
|
+
* @returns {boolean} truthy if element is overflow
|
|
3409
|
+
*/
|
|
3410
|
+
this.isOverflowElement = (cumulateWidth, item, availableWidth) => {
|
|
3411
|
+
if (item.previousElementSibling === null || this.isMoreElement(item))
|
|
3412
|
+
return false;
|
|
3413
|
+
else if (!this.isMoreElement(item.nextElementSibling))
|
|
3414
|
+
return cumulateWidth + this.moreElement.offsetWidth > availableWidth;
|
|
3415
|
+
else
|
|
3416
|
+
return cumulateWidth > availableWidth;
|
|
3417
|
+
};
|
|
3418
|
+
/**
|
|
3419
|
+
* Utility method to know if a given element is the 'MORE' element
|
|
3420
|
+
*
|
|
3421
|
+
* @param {Element} element element to match with 'MORE' element
|
|
3422
|
+
* @returns {boolean} truthy if element is the 'MORE' element
|
|
3423
|
+
*/
|
|
3424
|
+
this.isMoreElement = (element) => element.getAttribute(OverflowBehaviorElements.MORE) !== null;
|
|
3425
|
+
/**
|
|
3426
|
+
* Toggle display item element
|
|
3427
|
+
*
|
|
3428
|
+
* @param {HTMLElement} item item to control
|
|
3429
|
+
* @param {boolean} isHidden is item hidden
|
|
3430
|
+
* @returns {void}
|
|
3431
|
+
*/
|
|
3432
|
+
this.toggleItem = (item, isHidden) => {
|
|
3433
|
+
const mgActionMenuindex = Number(item.getAttribute(OverflowBehaviorElements.BASE_INDEX));
|
|
3434
|
+
if (this.isMoreElement(item))
|
|
3435
|
+
this.toggleElement(this.moreElement, isHidden);
|
|
3436
|
+
else if (mgActionMenuindex >= 0) {
|
|
3437
|
+
this.toggleElement(item, isHidden);
|
|
3438
|
+
this.toggleElement(this.moreElement.querySelector(`[${OverflowBehaviorElements.PROXY_INDEX}="${mgActionMenuindex}"]`), !isHidden);
|
|
3439
|
+
}
|
|
3440
|
+
};
|
|
3441
|
+
/**
|
|
3442
|
+
* Toggle element's hidde attribute
|
|
3443
|
+
*
|
|
3444
|
+
* @param {Element} element element to toggle
|
|
3445
|
+
* @param {boolean} isHidden element is hidden
|
|
3446
|
+
* @returns {void}
|
|
3447
|
+
*/
|
|
3448
|
+
this.toggleElement = (element, isHidden) => {
|
|
3449
|
+
if (isHidden)
|
|
3450
|
+
element.setAttribute('hidden', '');
|
|
3451
|
+
else
|
|
3452
|
+
element.removeAttribute('hidden');
|
|
3453
|
+
};
|
|
3454
|
+
/**
|
|
3455
|
+
* Remove hidden attributes on all items
|
|
3456
|
+
*
|
|
3457
|
+
* @returns {void}
|
|
3458
|
+
*/
|
|
3459
|
+
this.restoreItems = () => {
|
|
3460
|
+
this.children.forEach(item => item.removeAttribute('hidden'));
|
|
3461
|
+
};
|
|
3462
|
+
if (this.resizeObserver === undefined) {
|
|
3463
|
+
// add resize observer
|
|
3464
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
3465
|
+
entries.forEach(entry => {
|
|
3466
|
+
this.run(entry.contentRect.width);
|
|
3467
|
+
});
|
|
3468
|
+
});
|
|
3469
|
+
this.resizeObserver.observe(this.element);
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3047
3473
|
|
|
3048
|
-
const mgMenuCss = ":host{display:flex;background-color:hsl(var(--mg-menu-background-color-hsl, var(--color-light)))}:host([direction=vertical]){flex-direction:column;height:100%;overflow-y:auto}";
|
|
3474
|
+
const mgMenuCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{display:flex;background-color:hsl(var(--mg-menu-background-color-hsl, var(--color-light)))}:host([direction=vertical]){flex-direction:column;height:100%;overflow-y:auto}";
|
|
3049
3475
|
|
|
3050
3476
|
const MgMenu = class {
|
|
3051
3477
|
constructor(hostRef) {
|
|
@@ -3054,11 +3480,12 @@ const MgMenu = class {
|
|
|
3054
3480
|
* Internal *
|
|
3055
3481
|
************/
|
|
3056
3482
|
this.name = 'mg-menu';
|
|
3483
|
+
this.menuItems = [];
|
|
3057
3484
|
this.focusedMenuItem = 0;
|
|
3058
3485
|
/**
|
|
3059
3486
|
* Close matching menu-item
|
|
3060
3487
|
*
|
|
3061
|
-
* @param {
|
|
3488
|
+
* @param {HTMLElement} item menu-item to close
|
|
3062
3489
|
* @param {boolean} condition addionnal condition
|
|
3063
3490
|
* @returns {void}
|
|
3064
3491
|
*/
|
|
@@ -3067,12 +3494,15 @@ const MgMenu = class {
|
|
|
3067
3494
|
item.expanded = false;
|
|
3068
3495
|
}
|
|
3069
3496
|
};
|
|
3497
|
+
/*************
|
|
3498
|
+
* Methods *
|
|
3499
|
+
*************/
|
|
3070
3500
|
/**
|
|
3071
3501
|
* Store menu-items on component init and add listeners
|
|
3502
|
+
*
|
|
3503
|
+
* @returns {void}
|
|
3072
3504
|
*/
|
|
3073
|
-
this.
|
|
3074
|
-
// store all menu-items
|
|
3075
|
-
this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
3505
|
+
this.initMenuItemsListeners = () => {
|
|
3076
3506
|
// add listeners on menu item and edit index
|
|
3077
3507
|
this.menuItems.forEach((item, menuItemIndex) => {
|
|
3078
3508
|
['click', 'focus'].forEach(trigger => {
|
|
@@ -3086,9 +3516,46 @@ const MgMenu = class {
|
|
|
3086
3516
|
});
|
|
3087
3517
|
});
|
|
3088
3518
|
};
|
|
3519
|
+
/**
|
|
3520
|
+
* render mg-menu-more
|
|
3521
|
+
*
|
|
3522
|
+
* @returns {HTMLElement} formated mg-menu-item element
|
|
3523
|
+
*/
|
|
3524
|
+
this.renderMgMenuMore = () => {
|
|
3525
|
+
const moreElement = this.element.shadowRoot.querySelector(`[${OverflowBehaviorElements.MORE}]`);
|
|
3526
|
+
this.menuItems.forEach((child) => {
|
|
3527
|
+
const proxy = child.cloneNode(true);
|
|
3528
|
+
moreElement.querySelector('mg-menu').appendChild(proxy);
|
|
3529
|
+
});
|
|
3530
|
+
const allMenuItem = Array.from(this.element.querySelectorAll('mg-menu-item:not([data-overflow-more])'));
|
|
3531
|
+
Array.from(moreElement.querySelectorAll('mg-menu-item:not([data-overflow-more])')).forEach((proxy, index) => {
|
|
3532
|
+
// manage click on proxy to mirror it on initial element
|
|
3533
|
+
proxy.addEventListener('click', () => {
|
|
3534
|
+
(allMenuItem[index].shadowRoot.querySelector('a') || allMenuItem[index].shadowRoot.querySelector('button')).dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
3535
|
+
});
|
|
3536
|
+
// manage status change miror in proxy
|
|
3537
|
+
allMenuItem[index].addEventListener('status-change', (event) => {
|
|
3538
|
+
proxy.setAttribute('status', event.detail);
|
|
3539
|
+
});
|
|
3540
|
+
});
|
|
3541
|
+
this.element.appendChild(moreElement);
|
|
3542
|
+
return this.element.querySelector(`[${OverflowBehaviorElements.MORE}]`);
|
|
3543
|
+
};
|
|
3544
|
+
/**
|
|
3545
|
+
* Render mg-menu-item more element for overflow behavior
|
|
3546
|
+
*
|
|
3547
|
+
* @returns {HTMLElement} rendered mg-menu-item more element
|
|
3548
|
+
*/
|
|
3549
|
+
this.renderMgMenuItemMore = () => {
|
|
3550
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3551
|
+
return (h("mg-menu-item", { "data-overflow-more": true }, h("mg-icon", { icon: ((_b = (_a = this.moreitem) === null || _a === void 0 ? void 0 : _a.mgIcon) === null || _b === void 0 ? void 0 : _b.icon) || 'ellipsis-vertical', slot: "image" }), h("span", { class: { 'sr-only': !((_d = (_c = this.moreitem) === null || _c === void 0 ? void 0 : _c.slotLabel) === null || _d === void 0 ? void 0 : _d.display) }, slot: "label" }, ((_f = (_e = this.moreitem) === null || _e === void 0 ? void 0 : _e.slotLabel) === null || _f === void 0 ? void 0 : _f.label) || this.messages.moreLabel), h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.moreLabel, size: (_g = this.moreitem) === null || _g === void 0 ? void 0 : _g.size })));
|
|
3552
|
+
};
|
|
3089
3553
|
this.label = undefined;
|
|
3090
3554
|
this.direction = Direction.HORIZONTAL;
|
|
3555
|
+
this.moreitem = undefined;
|
|
3556
|
+
this.size = 'regular';
|
|
3091
3557
|
this.isChildMenu = undefined;
|
|
3558
|
+
this.hasOverflow = false;
|
|
3092
3559
|
}
|
|
3093
3560
|
validateLabel(newValue) {
|
|
3094
3561
|
if (newValue === undefined) {
|
|
@@ -3097,7 +3564,20 @@ const MgMenu = class {
|
|
|
3097
3564
|
}
|
|
3098
3565
|
validateDirection(newValue) {
|
|
3099
3566
|
if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
|
|
3100
|
-
throw new Error(`<${this.name}> prop "direction" must be one of
|
|
3567
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}.`);
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
validateMoreItem(newValue) {
|
|
3571
|
+
if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {
|
|
3572
|
+
throw new Error(`<${this.name}> prop "moreitem" must be paired with direction ${Direction.HORIZONTAL}.`);
|
|
3573
|
+
}
|
|
3574
|
+
else if (newValue !== undefined && !isMoreItem(newValue)) {
|
|
3575
|
+
throw new Error(`<${this.name}> prop "moreitem" must match MoreItemType.`);
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
validateSize(newValue) {
|
|
3579
|
+
if (!sizes$2.includes(newValue)) {
|
|
3580
|
+
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$2.join(', ')}.`);
|
|
3101
3581
|
}
|
|
3102
3582
|
}
|
|
3103
3583
|
/*************
|
|
@@ -3109,8 +3589,12 @@ const MgMenu = class {
|
|
|
3109
3589
|
* @returns {void}
|
|
3110
3590
|
*/
|
|
3111
3591
|
componentWillLoad() {
|
|
3592
|
+
this.messages = initLocales(this.element).messages.plusMenu;
|
|
3593
|
+
// validation
|
|
3112
3594
|
this.validateDirection(this.direction);
|
|
3113
3595
|
this.validateLabel(this.label);
|
|
3596
|
+
this.validateMoreItem(this.moreitem);
|
|
3597
|
+
this.validateSize(this.size);
|
|
3114
3598
|
}
|
|
3115
3599
|
/**
|
|
3116
3600
|
* Check if component slots configuration
|
|
@@ -3122,72 +3606,64 @@ const MgMenu = class {
|
|
|
3122
3606
|
// return a promise to process action only in the FIRST render().
|
|
3123
3607
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
3124
3608
|
return setTimeout(() => {
|
|
3125
|
-
|
|
3609
|
+
// store all menu-items
|
|
3610
|
+
this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
3126
3611
|
this.isChildMenu = this.element.closest('mg-menu-item') !== null;
|
|
3127
|
-
|
|
3128
|
-
if (
|
|
3129
|
-
|
|
3130
|
-
if (event.target.closest('mg-menu') === null) {
|
|
3131
|
-
this.menuItems.forEach(item => {
|
|
3132
|
-
this.closeMenuItem(item, this.direction === Direction.HORIZONTAL);
|
|
3133
|
-
});
|
|
3134
|
-
}
|
|
3135
|
-
});
|
|
3136
|
-
}
|
|
3612
|
+
this.hasOverflow = this.direction === Direction.HORIZONTAL && !this.isChildMenu;
|
|
3613
|
+
if (this.hasOverflow && isMoreItem(this.moreitem))
|
|
3614
|
+
this.overflowBehavior = new OverflowBehavior(this.element, this.renderMgMenuMore);
|
|
3137
3615
|
}, 0);
|
|
3138
3616
|
}
|
|
3617
|
+
/**
|
|
3618
|
+
* Check add listeners to childs
|
|
3619
|
+
*
|
|
3620
|
+
* @returns {void}
|
|
3621
|
+
*/
|
|
3622
|
+
componentDidRender() {
|
|
3623
|
+
// add menu items listeners
|
|
3624
|
+
this.initMenuItemsListeners();
|
|
3625
|
+
}
|
|
3626
|
+
/**
|
|
3627
|
+
* Disconnect overflow ResizeObserver
|
|
3628
|
+
*
|
|
3629
|
+
* @returns {void} run overflow resize obeserver disconnexion
|
|
3630
|
+
*/
|
|
3631
|
+
disconnectedCallback() {
|
|
3632
|
+
if (this.hasOverflow)
|
|
3633
|
+
this.overflowBehavior.disconnect();
|
|
3634
|
+
}
|
|
3139
3635
|
/**
|
|
3140
3636
|
* Render
|
|
3141
3637
|
*
|
|
3142
3638
|
* @returns {HTMLElement} HTML Element
|
|
3143
3639
|
*/
|
|
3144
3640
|
render() {
|
|
3145
|
-
return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null)));
|
|
3641
|
+
return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null), this.hasOverflow && isMoreItem(this.moreitem) && this.renderMgMenuItemMore()));
|
|
3146
3642
|
}
|
|
3147
3643
|
get element() { return getElement(this); }
|
|
3148
3644
|
static get watchers() { return {
|
|
3149
3645
|
"label": ["validateLabel"],
|
|
3150
|
-
"direction": ["validateDirection"]
|
|
3646
|
+
"direction": ["validateDirection"],
|
|
3647
|
+
"moreitem": ["validateMoreItem"],
|
|
3648
|
+
"size": ["validateSize"]
|
|
3151
3649
|
}; }
|
|
3152
3650
|
};
|
|
3153
3651
|
MgMenu.style = mgMenuCss;
|
|
3154
3652
|
|
|
3155
|
-
/**
|
|
3156
|
-
* Available menu-item positions
|
|
3157
|
-
*/
|
|
3158
|
-
var ElementPosition;
|
|
3159
|
-
(function (ElementPosition) {
|
|
3160
|
-
ElementPosition["FIRST"] = "first";
|
|
3161
|
-
ElementPosition["LAST"] = "last";
|
|
3162
|
-
})(ElementPosition || (ElementPosition = {}));
|
|
3163
|
-
/**
|
|
3164
|
-
* Available menu item status
|
|
3165
|
-
*/
|
|
3166
|
-
var Status$1;
|
|
3167
|
-
(function (Status) {
|
|
3168
|
-
Status["VISIBLE"] = "visible";
|
|
3169
|
-
Status["HIDDEN"] = "hidden";
|
|
3170
|
-
Status["DISABLED"] = "disabled";
|
|
3171
|
-
Status["ACTIVE"] = "active";
|
|
3172
|
-
})(Status$1 || (Status$1 = {}));
|
|
3173
|
-
/**
|
|
3174
|
-
* List of all possibles sizes
|
|
3175
|
-
*/
|
|
3176
|
-
const sizes$1 = ['regular', 'medium', 'large'];
|
|
3177
|
-
|
|
3178
|
-
const mgMenuItemCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding:1rem 2rem}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular ::slotted([slot=metadata]){font-size:1.3rem}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular.mg-menu-item__navigation-button--vertical{padding-left:calc(2rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding:1.5rem 3rem}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium ::slotted([slot=metadata]){font-size:1.5rem}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1.5rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium.mg-menu-item__navigation-button--vertical{padding-left:calc(3rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding:2.5rem 4rem}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large ::slotted([slot=metadata]){font-size:1.5rem}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(2.5rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large.mg-menu-item__navigation-button--vertical{padding-left:calc(4rem - 0.3rem)}.mg-menu-item__navigation-button{display:flex;align-items:center;column-gap:1rem;background-color:unset;border:none;font-family:var(--font-family);color:hsl(var(--mg-menu-item-color-hsl, var(--color-dark)));line-height:var(--line-height);text-decoration:none;cursor:pointer}.mg-menu-item__navigation-button:disabled,.mg-menu-item__navigation-button--disabled{cursor:default;opacity:30%}.mg-menu-item__navigation-button:focus-visible{z-index:10}.mg-menu-item__navigation-button:hover:not(.mg-menu-item__navigation-button--disabled),.mg-menu-item__navigation-button:focus:not(.mg-menu-item__navigation-button--disabled){background-color:hsla(var(--mg-menu-item-focused-background-color-hsl), 10%)}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active{color:hsl(var(--mg-menu-item-color-active-hsl));font-weight:700}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active.mg-menu-item__navigation-button--horizontal{border-bottom-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active.mg-menu-item__navigation-button--vertical{border-left-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--hidden{display:none}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal{border-bottom:0.3rem solid transparent}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical{border-left:0.3rem solid transparent}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(1 * 2rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(2 * 2rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(3 * 2rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(4 * 2rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(5 * 2rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(6 * 2rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(1 * 3rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(2 * 3rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(3 * 3rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(4 * 3rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(5 * 3rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(6 * 3rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(1 * 4rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(2 * 4rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(3 * 4rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(4 * 4rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(5 * 4rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(6 * 4rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host{position:relative;display:flex}:host([data-style-position-last]) .mg-menu-item__collapse-container{left:unset;right:0}:host([data-style-direction-vertical]){flex-direction:column}:host([data-style-direction-vertical]) .mg-menu-item__collapse-container{left:unset;top:unset;position:unset;width:unset}:host([data-style-direction-vertical]) .mg-menu-item-chevron{margin-left:auto}:host([data-style-direction-horizontal]) .mg-menu-item__collapse-container.mg-menu-item__collapse-container--first-level{box-shadow:var(--box-shadow);background-color:hsl(var(--color-light))}:host([data-style-direction-horizontal]) .mg-menu-item__collapse-container.mg-menu-item__collapse-container--first-level ::slotted(mg-menu){padding:1rem 0}.mg-menu-item{max-width:var(--mg-menu-item-navigation-button-max-width)}.mg-menu-item__collapse-container{position:absolute;top:100%;left:0;width:max-content;z-index:10}.mg-menu-item__navigation-button-center{min-width:0}.mg-menu-item__navigation-button-text-content{width:100%;display:flex}.mg-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:1rem}.mg-menu-item__navigation-button-chevron{margin-left:auto;transition:200ms}.mg-menu-item__navigation-button-chevron--rotate.mg-menu-item__navigation-button-chevron{transform:rotate(180deg)}::slotted([slot=label]),::slotted([slot=metadata]){display:block;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host([status=disabled]){pointer-events:none}";
|
|
3653
|
+
const mgMenuItemCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding:1rem 2rem;height:calc(3.8rem)}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular ::slotted([slot=metadata]){font-size:var(--font-size)}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular.mg-menu-item__navigation-button--vertical{padding-left:calc(2rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding:1rem 3rem;height:calc(5.1rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium ::slotted([slot=metadata]){font-size:calc(var(--font-size) + 0.2rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium.mg-menu-item__navigation-button--vertical{padding-left:calc(3rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding:1rem 4rem;height:calc(7.1rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button ::slotted([slot=label]),.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button ::slotted([slot=metadata]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large ::slotted([slot=label]),.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large ::slotted([slot=metadata]){font-size:calc(var(--font-size) + 0.2rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large.mg-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical,.mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large.mg-menu-item__navigation-button--vertical{padding-left:calc(4rem - 0.3rem)}.mg-menu-item__navigation-button{display:flex;align-items:center;column-gap:var(--mg-menu-item-navigation-button-column-gap, 1rem);background-color:unset;border:none;font-family:var(--font-family);font-weight:400;color:hsl(var(--mg-menu-item-color-hsl, var(--color-dark)));line-height:var(--line-height);text-decoration:none;white-space:nowrap;box-sizing:border-box;cursor:pointer}.mg-menu-item__navigation-button:disabled,.mg-menu-item__navigation-button--disabled{cursor:default;opacity:var(--mg-disabled-opacity)}.mg-menu-item__navigation-button:focus-visible{z-index:10}.mg-menu-item__navigation-button:hover:not(.mg-menu-item__navigation-button--disabled),.mg-menu-item__navigation-button:focus-visible:not(.mg-menu-item__navigation-button--disabled){background-color:hsl(var(--mg-menu-item-focused-background-color-hsl), 0.1)}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active{color:hsl(var(--mg-menu-item-color-active-hsl));font-weight:600}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active.mg-menu-item__navigation-button--horizontal{border-bottom-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--active.mg-menu-item__navigation-button--vertical{border-left-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--hidden{display:none}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--horizontal{border-bottom:0.3rem solid transparent}.mg-menu-item__navigation-button.mg-menu-item__navigation-button--vertical{border-left:0.3rem solid transparent}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(1 * 2rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(2 * 2rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(3 * 2rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(4 * 2rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(5 * 2rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular{padding-left:calc(6 * 2rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(1 * 3rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(2 * 3rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(3 * 3rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(4 * 3rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(5 * 3rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium{padding-left:calc(6 * 3rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host([data-style-direction-vertical][data-level=\"1\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(1 * 4rem - 0.3rem)}:host([data-level=\"1\"]) .mg-menu-item__collapse-container{z-index:calc(1 * 10)}:host([data-style-direction-vertical][data-level=\"2\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(2 * 4rem - 0.3rem)}:host([data-level=\"2\"]) .mg-menu-item__collapse-container{z-index:calc(2 * 10)}:host([data-style-direction-vertical][data-level=\"3\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(3 * 4rem - 0.3rem)}:host([data-level=\"3\"]) .mg-menu-item__collapse-container{z-index:calc(3 * 10)}:host([data-style-direction-vertical][data-level=\"4\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(4 * 4rem - 0.3rem)}:host([data-level=\"4\"]) .mg-menu-item__collapse-container{z-index:calc(4 * 10)}:host([data-style-direction-vertical][data-level=\"5\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(5 * 4rem - 0.3rem)}:host([data-level=\"5\"]) .mg-menu-item__collapse-container{z-index:calc(5 * 10)}:host([data-style-direction-vertical][data-level=\"6\"]) .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large{padding-left:calc(6 * 4rem - 0.3rem)}:host([data-level=\"6\"]) .mg-menu-item__collapse-container{z-index:calc(6 * 10)}:host{position:relative;display:flex;--mg-popover-padding-vertical:0;--mg-popover-padding-horizontal:0}:host([data-style-direction-vertical]){flex-direction:column}:host([data-style-direction-vertical]) .mg-menu-item__navigation-button{width:100%}:host([data-style-direction-vertical]) .mg-menu-item__collapse-container{left:unset;top:unset;position:unset;width:unset}:host([data-style-direction-vertical]) .mg-menu-item-chevron{margin-left:auto}:host([data-style-direction-horizontal]) .mg-menu-item__collapse-container.mg-menu-item__collapse-container--first-level{background-color:hsl(var(--color-light))}:host([data-style-direction-horizontal]) .mg-menu-item__collapse-container.mg-menu-item__collapse-container--first-level ::slotted(mg-menu){padding:1rem 0}:host([data-overflow-more]){--mg-menu-item-navigation-button-column-gap:0}:host([data-overflow-more]) .mg-menu-item__navigation-button-chevron{display:none}:host([data-overflow-more]) .mg-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:0}:host([data-overflow-more]) ::slotted(mg-menu){--mg-menu-item-navigation-button-column-gap:1rem}.mg-menu-item{max-width:var(--mg-menu-item-navigation-button-max-width)}.mg-menu-item__collapse-container{width:max-content;z-index:10}.mg-menu-item__navigation-button-center{min-width:0}.mg-menu-item__navigation-button-text-content{width:100%;display:flex;align-items:center}.mg-menu-item__navigation-button-text-content-notification,.mg-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:1rem;font-size:var(--font-size)}.mg-menu-item__navigation-button-chevron{margin-left:auto;transition:200ms}.mg-menu-item__navigation-button-chevron--rotate.mg-menu-item__navigation-button-chevron{transform:rotate(180deg)}::slotted([slot=label]),::slotted([slot=metadata]){display:block;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}::slotted(*){display:flex;flex-direction:column}:host([status=disabled]){pointer-events:none}:host([hidden]){display:none}";
|
|
3179
3654
|
|
|
3180
3655
|
const MgMenuItem = class {
|
|
3181
3656
|
constructor(hostRef) {
|
|
3182
3657
|
registerInstance(this, hostRef);
|
|
3658
|
+
this.statusChange = createEvent(this, "status-change", 7);
|
|
3183
3659
|
/************
|
|
3184
3660
|
* Internal *
|
|
3185
3661
|
************/
|
|
3186
3662
|
this.name = 'mg-menu-item';
|
|
3187
3663
|
this.navigationButton = `${this.name}__navigation-button`;
|
|
3188
|
-
|
|
3664
|
+
/***********
|
|
3189
3665
|
* Methods *
|
|
3190
|
-
|
|
3666
|
+
**********/
|
|
3191
3667
|
/**
|
|
3192
3668
|
* Toggle expanded prop value
|
|
3193
3669
|
*
|
|
@@ -3197,20 +3673,20 @@ const MgMenuItem = class {
|
|
|
3197
3673
|
this.expanded = !this.expanded;
|
|
3198
3674
|
};
|
|
3199
3675
|
/**
|
|
3200
|
-
* Does an
|
|
3676
|
+
* Does an Element have given Status
|
|
3201
3677
|
*
|
|
3202
|
-
* @param {
|
|
3678
|
+
* @param {HTMLMgMenuItemElement} mgMenuItemElement to parse
|
|
3203
3679
|
* @param {MgMenuItem['status']} status to check
|
|
3204
3680
|
* @returns {boolean} true if element with status is found
|
|
3205
3681
|
*/
|
|
3206
|
-
this.
|
|
3682
|
+
this.hasStatus = (mgMenuItemElement, status) => mgMenuItemElement.status === status;
|
|
3207
3683
|
/**
|
|
3208
3684
|
* Is component contextual direction match the given direction
|
|
3209
3685
|
*
|
|
3210
3686
|
* @param {MgMenuItem['direction']} direction in parent menu
|
|
3211
3687
|
* @returns {boolean} true is direction match the direction propertie
|
|
3212
3688
|
*/
|
|
3213
|
-
this.
|
|
3689
|
+
this.isDirection = (direction) => this.direction === direction;
|
|
3214
3690
|
/************
|
|
3215
3691
|
* Handlers *
|
|
3216
3692
|
************/
|
|
@@ -3221,7 +3697,7 @@ const MgMenuItem = class {
|
|
|
3221
3697
|
* @returns {void}
|
|
3222
3698
|
*/
|
|
3223
3699
|
this.handleElementCLick = (event) => {
|
|
3224
|
-
if (this.hasChildren || this.status === Status$1.DISABLED) {
|
|
3700
|
+
if ((this.hasChildren && !this.isInMainMenu) || this.status === Status$1.DISABLED) {
|
|
3225
3701
|
event.preventDefault();
|
|
3226
3702
|
event.stopPropagation();
|
|
3227
3703
|
}
|
|
@@ -3229,27 +3705,60 @@ const MgMenuItem = class {
|
|
|
3229
3705
|
if (this.hasChildren)
|
|
3230
3706
|
this.toggleExpanded();
|
|
3231
3707
|
};
|
|
3708
|
+
/**
|
|
3709
|
+
* Handle popover element display-change event
|
|
3710
|
+
*
|
|
3711
|
+
* @param {CustomEvent} event popover display event
|
|
3712
|
+
* @returns {void}
|
|
3713
|
+
*/
|
|
3714
|
+
this.handlePopoverDisplay = (event) => {
|
|
3715
|
+
this.expanded = event.detail;
|
|
3716
|
+
};
|
|
3717
|
+
/**
|
|
3718
|
+
* Update displayNotificationBadge
|
|
3719
|
+
* current component notification badge have priority over the slot badge when submenu contain badge
|
|
3720
|
+
*
|
|
3721
|
+
* @returns {void} update displayNotificationBadge value
|
|
3722
|
+
*/
|
|
3723
|
+
this.updateDisplayNotificationBadge = () => {
|
|
3724
|
+
const childMenu = this.element.querySelector('mg-menu');
|
|
3725
|
+
this.displayNotificationBadge =
|
|
3726
|
+
childMenu !== null &&
|
|
3727
|
+
Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && subItem.getAttribute('hidden') === null);
|
|
3728
|
+
};
|
|
3729
|
+
/**
|
|
3730
|
+
* Method to control if one of component children have active status
|
|
3731
|
+
*
|
|
3732
|
+
* @returns {boolean} truthy if component has active child
|
|
3733
|
+
*/
|
|
3734
|
+
this.hasActiveChild = () => {
|
|
3735
|
+
var _a;
|
|
3736
|
+
return Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || [])
|
|
3737
|
+
.filter(element => element.nodeName === 'MG-MENU-ITEM')
|
|
3738
|
+
.some((element) => this.hasStatus(element, Status$1.ACTIVE) && element.getAttribute('hidden') === null);
|
|
3739
|
+
};
|
|
3740
|
+
/**
|
|
3741
|
+
* Render slot
|
|
3742
|
+
*
|
|
3743
|
+
* @returns {HTMLElement} HTML Element
|
|
3744
|
+
*/
|
|
3745
|
+
this.renderSlot = () => h("slot", null);
|
|
3232
3746
|
this.href = undefined;
|
|
3233
3747
|
this.status = Status$1.VISIBLE;
|
|
3234
|
-
this.size = 'large';
|
|
3235
3748
|
this.expanded = false;
|
|
3749
|
+
this.size = 'regular';
|
|
3236
3750
|
this.navigationButtonClassList = new ClassList([this.navigationButton]);
|
|
3237
3751
|
this.direction = undefined;
|
|
3238
3752
|
this.isInMainMenu = undefined;
|
|
3239
3753
|
this.hasChildren = false;
|
|
3754
|
+
this.displayNotificationBadge = undefined;
|
|
3240
3755
|
}
|
|
3241
3756
|
validateStatus(newValue, oldValue) {
|
|
3242
3757
|
if (oldValue !== undefined) {
|
|
3243
3758
|
this.navigationButtonClassList.delete(`${this.navigationButton}--${oldValue}`);
|
|
3244
3759
|
}
|
|
3245
3760
|
this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);
|
|
3246
|
-
|
|
3247
|
-
validateSize(newValue, oldValue) {
|
|
3248
|
-
if (!sizes$1.includes(newValue)) {
|
|
3249
|
-
throw new Error(`<${this.name}> prop "size" must be one of : ${sizes$1.join(', ')}.`);
|
|
3250
|
-
}
|
|
3251
|
-
this.navigationButtonClassList.delete(`${this.navigationButton}--size-${oldValue}`);
|
|
3252
|
-
this.navigationButtonClassList.add(`${this.navigationButton}--size-${newValue}`);
|
|
3761
|
+
this.statusChange.emit(newValue);
|
|
3253
3762
|
}
|
|
3254
3763
|
validateExpanded(newValue) {
|
|
3255
3764
|
if (typeof newValue !== 'boolean')
|
|
@@ -3263,16 +3772,20 @@ const MgMenuItem = class {
|
|
|
3263
3772
|
item.expanded = false;
|
|
3264
3773
|
});
|
|
3265
3774
|
}
|
|
3266
|
-
else if (
|
|
3775
|
+
else if (this.element.querySelector(`${this.name}[status="${Status$1.ACTIVE}"]`) !== null) {
|
|
3267
3776
|
// - when expanded and contain an active item parents are expended too
|
|
3268
3777
|
subItems.forEach(item => {
|
|
3269
|
-
if (this.
|
|
3778
|
+
if (this.hasStatus(item, Status$1.ACTIVE)) {
|
|
3270
3779
|
item.expanded = true;
|
|
3271
3780
|
}
|
|
3272
3781
|
});
|
|
3273
3782
|
}
|
|
3274
3783
|
}
|
|
3275
3784
|
}
|
|
3785
|
+
validateSize(newValue, oldValue) {
|
|
3786
|
+
this.navigationButtonClassList.delete(`${this.navigationButton}--size-${oldValue}`);
|
|
3787
|
+
this.navigationButtonClassList.add(`${this.navigationButton}--size-${newValue}`);
|
|
3788
|
+
}
|
|
3276
3789
|
validateHasChildren(newValue) {
|
|
3277
3790
|
if (newValue && this.element.href !== undefined) {
|
|
3278
3791
|
throw new Error(`<${this.name}> prop "href" is unauthorizied when element is a parent.`);
|
|
@@ -3287,13 +3800,14 @@ const MgMenuItem = class {
|
|
|
3287
3800
|
* @returns {void}
|
|
3288
3801
|
*/
|
|
3289
3802
|
componentWillLoad() {
|
|
3290
|
-
// has children items that is NOT [slot=
|
|
3803
|
+
// has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element
|
|
3291
3804
|
// we store only matching elements
|
|
3292
|
-
this.hasChildren = Array.from(this.element.children).
|
|
3805
|
+
this.hasChildren = Array.from(this.element.children).some(child => !['image', 'information', 'label', 'metadata'].includes(child.getAttribute('slot')));
|
|
3293
3806
|
// Validate props
|
|
3294
3807
|
this.validateSize(this.size);
|
|
3295
3808
|
this.validateStatus(this.status);
|
|
3296
3809
|
this.validateExpanded(this.expanded);
|
|
3810
|
+
this.badgeLabel = initLocales(this.element).messages.plusMenu.badgeLabel;
|
|
3297
3811
|
}
|
|
3298
3812
|
/**
|
|
3299
3813
|
* Check if component slots configuration
|
|
@@ -3317,55 +3831,82 @@ const MgMenuItem = class {
|
|
|
3317
3831
|
// return a promise to process action only in the FIRST render().
|
|
3318
3832
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
3319
3833
|
return setTimeout(() => {
|
|
3320
|
-
var _a
|
|
3834
|
+
var _a;
|
|
3321
3835
|
// define menu-item context states
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
this.isInMainMenu = this.element.parentElement.
|
|
3326
|
-
const hasNextMenuItem = ((_a = this.element.nextElementSibling) === null || _a === void 0 ? void 0 : _a.nodeName) === 'MG-MENU-ITEM';
|
|
3327
|
-
const hasPreviousMenuItem = ((_b = this.element.previousElementSibling) === null || _b === void 0 ? void 0 : _b.nodeName) === 'MG-MENU-ITEM';
|
|
3328
|
-
// manage last menu item
|
|
3329
|
-
if (!hasNextMenuItem && hasPreviousMenuItem && this.isdirection(Direction.HORIZONTAL)) {
|
|
3330
|
-
this.element.setAttribute('data-style-position-last', '');
|
|
3331
|
-
}
|
|
3836
|
+
const menu = this.element.closest('mg-menu');
|
|
3837
|
+
this.direction = this.element.getAttribute(OverflowBehaviorElements.MORE) !== null || menu === null ? Direction.HORIZONTAL : menu.direction;
|
|
3838
|
+
this.size = menu === null || menu === void 0 ? void 0 : menu.size;
|
|
3839
|
+
this.isInMainMenu = this.element.parentElement.closest('mg-menu-item') === null;
|
|
3332
3840
|
// when main menu item contain an active item it will get the active style
|
|
3333
3841
|
// AND if item is in vertical menu it will be expanded
|
|
3334
|
-
if (this.
|
|
3842
|
+
if (this.hasActiveChild()) {
|
|
3335
3843
|
this.status = Status$1.ACTIVE;
|
|
3336
|
-
|
|
3844
|
+
if (this.isInMainMenu)
|
|
3845
|
+
this.expanded = this.isDirection(Direction.VERTICAL);
|
|
3337
3846
|
}
|
|
3338
3847
|
// manage menu items style depending to parent menu horientation
|
|
3339
3848
|
this.element.setAttribute(`data-style-direction-${this.direction}`, '');
|
|
3340
3849
|
this.navigationButtonClassList.add(`${this.navigationButton}--${this.direction}`);
|
|
3341
|
-
|
|
3342
|
-
|
|
3850
|
+
this.updateDisplayNotificationBadge();
|
|
3851
|
+
// manage all sub levels child menu-items level with data-level attribut
|
|
3852
|
+
if (this.isDirection(Direction.VERTICAL)) {
|
|
3853
|
+
Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
|
|
3854
|
+
item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;
|
|
3855
|
+
});
|
|
3856
|
+
}
|
|
3857
|
+
// manage first sub-level menu-items
|
|
3858
|
+
const childItems = Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).filter(item => item.nodeName === 'MG-MENU-ITEM');
|
|
3343
3859
|
childItems.forEach(item => {
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3860
|
+
const updateStatus = () => {
|
|
3861
|
+
if (![Status$1.HIDDEN, Status$1.DISABLED].includes(this.status)) {
|
|
3862
|
+
this.status = this.hasActiveChild() ? Status$1.ACTIVE : Status$1.VISIBLE;
|
|
3863
|
+
}
|
|
3864
|
+
};
|
|
3865
|
+
// manage child menu listener
|
|
3866
|
+
item.addEventListener('status-change', () => {
|
|
3867
|
+
updateStatus();
|
|
3868
|
+
});
|
|
3869
|
+
new MutationObserver(mutationsList => {
|
|
3870
|
+
if (mutationsList.some(mutation => mutation.attributeName === 'hidden'))
|
|
3871
|
+
updateStatus();
|
|
3872
|
+
this.updateDisplayNotificationBadge();
|
|
3873
|
+
}).observe(item, { attributes: true });
|
|
3348
3874
|
});
|
|
3349
3875
|
}, 0);
|
|
3350
3876
|
}
|
|
3351
3877
|
/**
|
|
3352
|
-
* Render
|
|
3878
|
+
* Render ineractive element
|
|
3353
3879
|
*
|
|
3354
3880
|
* @returns {HTMLElement} HTML Element
|
|
3355
3881
|
*/
|
|
3356
|
-
|
|
3882
|
+
renderInteractiveElement() {
|
|
3357
3883
|
const TagName = this.href !== undefined ? 'a' : 'button';
|
|
3358
|
-
return (h(
|
|
3884
|
+
return (h(TagName, { href: this.href, class: this.navigationButtonClassList.join(), tabindex: [Status$1.DISABLED, Status$1.HIDDEN].includes(this.status) ? -1 : 0, disabled: this.status === Status$1.DISABLED, hidden: this.status === Status$1.HIDDEN, "aria-expanded": this.hasChildren && this.expanded.toString(), "aria-current": this.status === Status$1.ACTIVE && 'page', onClick: this.handleElementCLick }, h("slot", { name: "image" }), h("div", { class: `${this.navigationButton}-center` }, h("div", { class: `${this.navigationButton}-text-content` }, h("slot", { name: "label" }), !this.displayNotificationBadge && h("slot", { name: "information" }), this.displayNotificationBadge && (h("span", { class: "mg-menu-item__navigation-button-text-content-notification" }, h("mg-badge", { label: this.badgeLabel, value: "!", variant: "text-color", slot: "information" })))), this.size !== 'regular' && h("slot", { name: "metadata" })), this.hasChildren && this.href === undefined && (h("span", { class: {
|
|
3359
3885
|
[`${this.navigationButton}-chevron`]: true,
|
|
3360
3886
|
[`${this.navigationButton}-chevron--rotate`]: this.expanded === true,
|
|
3361
3887
|
'mg-a11y-animation': true,
|
|
3362
|
-
} }, h("mg-icon", { icon: "chevron-down" }))))
|
|
3888
|
+
} }, h("mg-icon", { icon: "chevron-down" })))));
|
|
3889
|
+
}
|
|
3890
|
+
/**
|
|
3891
|
+
* Render
|
|
3892
|
+
*
|
|
3893
|
+
* @returns {HTMLElement} HTML Element
|
|
3894
|
+
*/
|
|
3895
|
+
render() {
|
|
3896
|
+
const getContainerClasses = () => ({
|
|
3897
|
+
[`${this.name}__collapse-container`]: true,
|
|
3898
|
+
[`${this.name}__collapse-container--first-level`]: this.isInMainMenu && this.isDirection(Direction.HORIZONTAL),
|
|
3899
|
+
});
|
|
3900
|
+
return (h(Host, { role: "menuitem", "aria-haspopup": this.hasChildren.toString() }, this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
|
|
3901
|
+
this.renderInteractiveElement(),
|
|
3902
|
+
h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
3903
|
+
])));
|
|
3363
3904
|
}
|
|
3364
3905
|
get element() { return getElement(this); }
|
|
3365
3906
|
static get watchers() { return {
|
|
3366
3907
|
"status": ["validateStatus"],
|
|
3367
|
-
"size": ["validateSize"],
|
|
3368
3908
|
"expanded": ["validateExpanded"],
|
|
3909
|
+
"size": ["validateSize"],
|
|
3369
3910
|
"hasChildren": ["validateHasChildren"]
|
|
3370
3911
|
}; }
|
|
3371
3912
|
};
|
|
@@ -3376,7 +3917,7 @@ MgMenuItem.style = mgMenuItemCss;
|
|
|
3376
3917
|
*/
|
|
3377
3918
|
const variants$1 = ['info', 'warning', 'success', 'danger'];
|
|
3378
3919
|
|
|
3379
|
-
const mgMessageCss = ":host{--mg-card-padding:0;--mg-card-border-radius:var(--mg-message-border-radius);--mg-card-border:none;--mg-card-overflow:hidden}.mg-message{display:inline-block;min-height:var(--default-size)}.mg-message__bar{position:absolute;top:0;left:0;width:0.3rem;height:100%}.mg-message.mg-message--info .mg-message__bar{background-color:hsl(var(--color-info))}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning .mg-message__bar{background-color:hsl(var(--color-warning))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success .mg-message__bar{background-color:hsl(var(--color-success))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger .mg-message__bar{background-color:hsl(var(--color-danger))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{--mg-card-padding:0 3.4rem 0 0}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message,mg-message{max-width:100%}";
|
|
3920
|
+
const mgMessageCss = ":host{--mg-card-padding:0;--mg-card-border-radius:var(--mg-message-border-radius);--mg-card-border:none;--mg-card-overflow:hidden}.mg-message{display:inline-block;min-height:var(--default-size)}.mg-message__bar{position:absolute;top:0;left:0;width:0.3rem;height:100%}.mg-message.mg-message--info .mg-message__bar{background-color:hsl(var(--color-info))}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning .mg-message__bar{background-color:hsl(var(--color-warning))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success .mg-message__bar{background-color:hsl(var(--color-success))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger .mg-message__bar{background-color:hsl(var(--color-danger))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{--mg-card-padding:0 3.4rem 0 0}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}.mg-message,mg-message{max-width:100%}";
|
|
3380
3921
|
|
|
3381
3922
|
const MgMessage = class {
|
|
3382
3923
|
constructor(hostRef) {
|
|
@@ -3392,22 +3933,49 @@ const MgMessage = class {
|
|
|
3392
3933
|
this.closeButtonId = '';
|
|
3393
3934
|
// Stored timer setted when hide action is run from setTimeOut
|
|
3394
3935
|
this.storedTimer = null;
|
|
3936
|
+
// Manage hover
|
|
3937
|
+
this.isFocused = false;
|
|
3938
|
+
this.isHovered = false;
|
|
3395
3939
|
/**
|
|
3396
|
-
*
|
|
3940
|
+
* Set timer
|
|
3941
|
+
*
|
|
3942
|
+
* @returns {void}
|
|
3397
3943
|
*/
|
|
3398
|
-
this.
|
|
3399
|
-
this.hide = true;
|
|
3944
|
+
this.setTimer = () => {
|
|
3945
|
+
this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);
|
|
3400
3946
|
};
|
|
3401
3947
|
/**
|
|
3402
|
-
*
|
|
3948
|
+
* Clear timer
|
|
3949
|
+
*
|
|
3950
|
+
* @returns {void}
|
|
3403
3951
|
*/
|
|
3404
|
-
this.
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3952
|
+
this.clearTimer = () => {
|
|
3953
|
+
clearTimeout(this.storedTimer);
|
|
3954
|
+
};
|
|
3955
|
+
/**
|
|
3956
|
+
* Event to add on element
|
|
3957
|
+
*
|
|
3958
|
+
* @param {MouseEvent | FocusEvent} event event
|
|
3959
|
+
* @returns {void}
|
|
3960
|
+
*/
|
|
3961
|
+
this.timerEvents = (event) => {
|
|
3962
|
+
this.clearTimer();
|
|
3963
|
+
const isMouseEvent = event.type === 'mouseenter';
|
|
3964
|
+
// Needed to ensure we don't start the timer
|
|
3965
|
+
this[isMouseEvent ? 'isHovered' : 'isFocused'] = true;
|
|
3966
|
+
// Restart timer when loose focus AND mouse leave
|
|
3967
|
+
this.element.addEventListener(isMouseEvent ? 'mouseleave' : 'focusout', eventOut => {
|
|
3968
|
+
this[eventOut.type === 'mouseleave' ? 'isHovered' : 'isFocused'] = false;
|
|
3969
|
+
// Start timer if needed
|
|
3970
|
+
if (!this.isFocused && !this.isHovered)
|
|
3971
|
+
this.setTimer();
|
|
3972
|
+
}, { once: true });
|
|
3973
|
+
};
|
|
3974
|
+
/**
|
|
3975
|
+
* Handle close button
|
|
3976
|
+
*/
|
|
3977
|
+
this.handleClose = () => {
|
|
3978
|
+
this.hide = true;
|
|
3411
3979
|
};
|
|
3412
3980
|
/**
|
|
3413
3981
|
* Get icon corresponding to variant
|
|
@@ -3441,7 +4009,7 @@ const MgMessage = class {
|
|
|
3441
4009
|
}
|
|
3442
4010
|
validateVariant(newValue, oldValue) {
|
|
3443
4011
|
if (!variants$1.includes(newValue)) {
|
|
3444
|
-
throw new Error(`<mg-message> prop "variant" must be one of
|
|
4012
|
+
throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}`);
|
|
3445
4013
|
}
|
|
3446
4014
|
else {
|
|
3447
4015
|
if (oldValue !== undefined) {
|
|
@@ -3460,12 +4028,26 @@ const MgMessage = class {
|
|
|
3460
4028
|
if (newValue) {
|
|
3461
4029
|
this.componentHide.emit();
|
|
3462
4030
|
this.classList.add(this.classHide);
|
|
4031
|
+
// Remove event Listener
|
|
4032
|
+
['focusin', 'mouseenter'].forEach(event => {
|
|
4033
|
+
this.element.removeEventListener(event, this.timerEvents);
|
|
4034
|
+
});
|
|
4035
|
+
// Clear Timer
|
|
4036
|
+
this.clearTimer();
|
|
3463
4037
|
}
|
|
3464
4038
|
else {
|
|
3465
4039
|
this.componentShow.emit();
|
|
3466
4040
|
this.classList.delete(this.classHide);
|
|
4041
|
+
// If delay is set
|
|
4042
|
+
if (this.delay > 1) {
|
|
4043
|
+
// Start timer
|
|
4044
|
+
this.setTimer();
|
|
4045
|
+
// Stop timer when get focus or mouse enter
|
|
4046
|
+
['focusin', 'mouseenter'].forEach(event => {
|
|
4047
|
+
this.element.addEventListener(event, this.timerEvents);
|
|
4048
|
+
});
|
|
4049
|
+
}
|
|
3467
4050
|
}
|
|
3468
|
-
this.hideWithDelay();
|
|
3469
4051
|
}
|
|
3470
4052
|
/*************
|
|
3471
4053
|
* Lifecycle *
|
|
@@ -3506,7 +4088,7 @@ const MgMessage = class {
|
|
|
3506
4088
|
};
|
|
3507
4089
|
MgMessage.style = mgMessageCss;
|
|
3508
4090
|
|
|
3509
|
-
const mgModalCss = ":host{--mg-card-border-radius:var(--mg-modal-border-radius);--mg-card-padding:1.5rem 2.5rem;--mg-card-border:none}.mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;padding:2rem 0;background-color:
|
|
4091
|
+
const mgModalCss = ":host{--mg-card-border-radius:var(--mg-modal-border-radius);--mg-card-padding:1.5rem 2.5rem;--mg-card-border:none}.mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;padding:2rem 0;background-color:hsl(var(--color-light), 0.85)}.mg-modal mg-card{display:flex;width:60rem;max-width:100%;max-height:100%}.mg-modal__dialog{display:flex;position:relative;flex-direction:column;align-self:center;row-gap:3rem;height:fit-content;max-height:100%}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}.mg-modal ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}";
|
|
3510
4092
|
|
|
3511
4093
|
const MgModal = class {
|
|
3512
4094
|
constructor(hostRef) {
|
|
@@ -3719,6 +4301,7 @@ const MgPagination = class {
|
|
|
3719
4301
|
};
|
|
3720
4302
|
this.identifier = createID('mg-pagination');
|
|
3721
4303
|
this.label = undefined;
|
|
4304
|
+
this.hideNavigationLabels = undefined;
|
|
3722
4305
|
this.totalPages = 1;
|
|
3723
4306
|
this.currentPage = 1;
|
|
3724
4307
|
}
|
|
@@ -3763,7 +4346,7 @@ const MgPagination = class {
|
|
|
3763
4346
|
render() {
|
|
3764
4347
|
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
3765
4348
|
// eslint-disable-next-line react/jsx-no-bind
|
|
3766
|
-
onClick: () => this.handleGoToPage(action, disabled), 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" })));
|
|
4349
|
+
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
3767
4350
|
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)));
|
|
3768
4351
|
}
|
|
3769
4352
|
get element() { return getElement(this); }
|
|
@@ -3774,7 +4357,7 @@ const MgPagination = class {
|
|
|
3774
4357
|
};
|
|
3775
4358
|
MgPagination.style = mgPaginationCss;
|
|
3776
4359
|
|
|
3777
|
-
const mgPanelCss = ":host{--mg-card-border:none;--mg-card-padding:0;--mg-card-border-radius:var(--mg-panel-border-radius);--mg-card-background:hsl(var(--mg-panel-background));--mg-card-box-shadow:var(--mg-panel-box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-right{padding-left:0.3rem;flex:1 auto;min-height:var(--default-size);align-items:center}.mg-panel__header-left mg-input-text{flex-grow:1;margin-left:0.3rem}.mg-panel__header-left mg-button+mg-button:not([slot=append-input]){margin-left:0.3rem}.mg-panel__header-left.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__collapse-button-content{--font-size:1.4rem;--mg-button-font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}";
|
|
4360
|
+
const mgPanelCss = ":host{--mg-card-border:none;--mg-card-padding:0;--mg-card-border-radius:var(--mg-panel-border-radius);--mg-card-background:hsl(var(--mg-panel-background));--mg-card-box-shadow:var(--mg-panel-box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-right{padding-left:0.3rem;flex:1 auto;min-height:var(--default-size);align-items:center}.mg-panel__header-left mg-input-text{flex-grow:1;margin-left:0.3rem}.mg-panel__header-left mg-button+mg-button:not([slot=append-input]){margin-left:0.3rem}.mg-panel__header-left.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__collapse-button-content{--font-size:1.4rem;--mg-button-font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}.mg-panel ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}";
|
|
3778
4361
|
|
|
3779
4362
|
const MgPanel = class {
|
|
3780
4363
|
constructor(hostRef) {
|
|
@@ -3854,13 +4437,13 @@ const MgPanel = class {
|
|
|
3854
4437
|
if (this.titleEditable && !this.isEditing) {
|
|
3855
4438
|
return [
|
|
3856
4439
|
collapseButton(),
|
|
3857
|
-
h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })),
|
|
4440
|
+
h("mg-button", { key: "edit-button", "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })),
|
|
3858
4441
|
];
|
|
3859
4442
|
}
|
|
3860
4443
|
if (this.titleEditable && this.isEditing) {
|
|
3861
4444
|
return [
|
|
3862
4445
|
collapseButton(),
|
|
3863
|
-
h("mg-input-text", { label: this.messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) }, h("mg-button", { slot: "append-input", label: this.messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` }, h("mg-icon", { icon: "cross" })), h("mg-button", { slot: "append-input", label: this.messages.general.confirm, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` }, h("mg-icon", { icon: "check" }))),
|
|
4446
|
+
h("mg-input-text", { key: "edition-input", label: this.messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) }, h("mg-button", { slot: "append-input", label: this.messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` }, h("mg-icon", { icon: "cross" })), h("mg-button", { slot: "append-input", label: this.messages.general.confirm, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` }, h("mg-icon", { icon: "check" }))),
|
|
3864
4447
|
];
|
|
3865
4448
|
}
|
|
3866
4449
|
return collapseButton();
|
|
@@ -5734,13 +6317,15 @@ var createPopper = /*#__PURE__*/popperGenerator({
|
|
|
5734
6317
|
defaultModifiers: defaultModifiers
|
|
5735
6318
|
}); // eslint-disable-next-line import/no-unused-modules
|
|
5736
6319
|
|
|
5737
|
-
const mgPopoverCss = ":host{--mg-card-padding:1.5rem;--mg-card-border:none;--mg-card-border-radius:0.5rem;--mg-card-background:hsl(var(--mg-popover-background-color));position:relative;display:contents}:host::slotted(*){display:inline-block}.mg-popover{display:none;z-index:2000;color:hsl(var(--mg-popover-font-color))}.mg-popover mg-card{
|
|
6320
|
+
const mgPopoverCss = ":host{--mg-card-padding:var(--mg-popover-padding-vertical, 1.5rem) var(--mg-popover-padding-horizontal, var(--mg-popover-padding-vertical, 1.5rem));--mg-card-border:none;--mg-card-border-radius:0.5rem;--mg-card-background:hsl(var(--mg-popover-background-color));position:relative;display:contents}:host::slotted(*){display:inline-block}.mg-popover{display:none;padding:1rem;z-index:2000;color:hsl(var(--mg-popover-font-color))}.mg-popover mg-card{position:relative}.mg-popover[data-show]{display:block}.mg-popover mg-button{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-popover__arrow{position:absolute;visibility:hidden;width:calc(3rem + 2 * var(--mg-card-border-radius) + 2rem);height:calc(3rem + 2 * var(--mg-card-border-radius) + 2rem)}.mg-popover__arrow:before{visibility:visible;content:\"\";position:absolute}.mg-popover[data-popper-placement^=top]>.mg-popover__arrow,.mg-popover[data-popper-placement^=bottom]>.mg-popover__arrow{height:1rem}.mg-popover[data-popper-placement^=top]>.mg-popover__arrow:before,.mg-popover[data-popper-placement^=bottom]>.mg-popover__arrow:before{left:calc(var(--mg-card-border-radius) + 1rem);border-right:calc(3rem / 2) solid transparent;border-left:calc(3rem / 2) solid transparent}.mg-popover[data-popper-placement^=top]>.mg-popover__arrow{bottom:0.1rem;filter:drop-shadow(0 0.5rem 0.25rem hsl(var(--color-dark), 0.15))}.mg-popover[data-popper-placement^=top]>.mg-popover__arrow:before{border-top:1rem solid hsl(var(--mg-popover-background-color))}.mg-popover[data-popper-placement^=bottom]>.mg-popover__arrow{top:0.1rem;filter:drop-shadow(0 -0.5rem 0.25rem hsl(var(--color-dark), 0.15))}.mg-popover[data-popper-placement^=bottom]>.mg-popover__arrow:before{border-bottom:1rem solid hsl(var(--mg-popover-background-color))}.mg-popover[data-popper-placement^=left]>.mg-popover__arrow,.mg-popover[data-popper-placement^=right]>.mg-popover__arrow{width:1rem}.mg-popover[data-popper-placement^=left]>.mg-popover__arrow:before,.mg-popover[data-popper-placement^=right]>.mg-popover__arrow:before{top:calc(var(--mg-card-border-radius) + 1rem);border-top:calc(3rem / 2) solid transparent;border-bottom:calc(3rem / 2) solid transparent}.mg-popover[data-popper-placement^=left]>.mg-popover__arrow{right:0.1rem;filter:drop-shadow(0.5rem 0 0.25rem hsl(var(--color-dark), 0.15))}.mg-popover[data-popper-placement^=left]>.mg-popover__arrow:before{border-left:1rem solid hsl(var(--mg-popover-background-color))}.mg-popover[data-popper-placement^=right]>.mg-popover__arrow{left:0.1rem;filter:drop-shadow(-0.5rem 0 0.25rem hsl(var(--color-dark), 0.15))}.mg-popover[data-popper-placement^=right]>.mg-popover__arrow:before{border-right:1rem solid hsl(var(--mg-popover-background-color))}.mg-popover[data-popper-placement^=left-start],.mg-popover[data-popper-placement^=left-end],.mg-popover[data-popper-placement^=right-start],.mg-popover[data-popper-placement^=right-end]{padding:0 1rem}.mg-popover[data-popper-placement^=left-start]>.mg-popover__arrow,.mg-popover[data-popper-placement^=left-end]>.mg-popover__arrow,.mg-popover[data-popper-placement^=right-start]>.mg-popover__arrow,.mg-popover[data-popper-placement^=right-end]>.mg-popover__arrow{height:calc(3rem + 2 * var(--mg-card-border-radius))}.mg-popover[data-popper-placement^=left-start]>.mg-popover__arrow:before,.mg-popover[data-popper-placement^=left-end]>.mg-popover__arrow:before,.mg-popover[data-popper-placement^=right-start]>.mg-popover__arrow:before,.mg-popover[data-popper-placement^=right-end]>.mg-popover__arrow:before{top:var(--mg-card-border-radius)}.mg-popover__title ::slotted([slot=title]){margin:0 0 1rem !important;font-size:var(--mg-popover-title-font-size) !important;font-weight:600}.mg-popover--arrow-hide.mg-popover[data-popper-placement^=top]{padding-bottom:0}.mg-popover--arrow-hide.mg-popover[data-popper-placement^=bottom]{padding-top:0}.mg-popover--arrow-hide.mg-popover[data-popper-placement$=end],.mg-popover--arrow-hide.mg-popover[data-popper-placement^=left]{padding-right:0}.mg-popover--arrow-hide.mg-popover[data-popper-placement$=start],.mg-popover--arrow-hide.mg-popover[data-popper-placement^=right]{padding-left:0}.mg-popover ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}";
|
|
5738
6321
|
|
|
5739
6322
|
const MgPopover = class {
|
|
5740
6323
|
constructor(hostRef) {
|
|
5741
6324
|
registerInstance(this, hostRef);
|
|
5742
6325
|
this.displayChange = createEvent(this, "display-change", 7);
|
|
5743
6326
|
this.closeButtonId = '';
|
|
6327
|
+
// Classes
|
|
6328
|
+
this.classArrowHide = `mg-popover--arrow-hide`;
|
|
5744
6329
|
/**
|
|
5745
6330
|
* Check if clicked outside of component
|
|
5746
6331
|
*
|
|
@@ -5748,7 +6333,10 @@ const MgPopover = class {
|
|
|
5748
6333
|
* @returns {void}
|
|
5749
6334
|
*/
|
|
5750
6335
|
this.clickOutside = (event) => {
|
|
5751
|
-
|
|
6336
|
+
var _a;
|
|
6337
|
+
if (!this.disabled &&
|
|
6338
|
+
event.target.closest('mg-popover') !== this.element &&
|
|
6339
|
+
!(((_a = event.target.closest(`[data-mg-popover-guard]`)) === null || _a === void 0 ? void 0 : _a.dataset.mgPopoverGuard) === this.identifier)) {
|
|
5752
6340
|
this.display = false;
|
|
5753
6341
|
}
|
|
5754
6342
|
};
|
|
@@ -5759,7 +6347,7 @@ const MgPopover = class {
|
|
|
5759
6347
|
*/
|
|
5760
6348
|
this.show = () => {
|
|
5761
6349
|
// Make the popover visible
|
|
5762
|
-
this.popover.
|
|
6350
|
+
this.popover.dataset.show = '';
|
|
5763
6351
|
// Enable the event listeners
|
|
5764
6352
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
5765
6353
|
// Update its position
|
|
@@ -5767,7 +6355,9 @@ const MgPopover = class {
|
|
|
5767
6355
|
// hide when click outside
|
|
5768
6356
|
// setTimeout is used to prevent event to trigger after creation
|
|
5769
6357
|
setTimeout(() => {
|
|
5770
|
-
|
|
6358
|
+
this.windows.forEach((localWindow) => {
|
|
6359
|
+
localWindow.addEventListener('click', this.clickOutside, false);
|
|
6360
|
+
});
|
|
5771
6361
|
}, 0);
|
|
5772
6362
|
};
|
|
5773
6363
|
/**
|
|
@@ -5781,7 +6371,9 @@ const MgPopover = class {
|
|
|
5781
6371
|
// Disable the event listeners
|
|
5782
6372
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
5783
6373
|
// Remove event listener
|
|
5784
|
-
|
|
6374
|
+
this.windows.forEach((localWindow) => {
|
|
6375
|
+
localWindow.removeEventListener('click', this.clickOutside, false);
|
|
6376
|
+
});
|
|
5785
6377
|
};
|
|
5786
6378
|
/**
|
|
5787
6379
|
* Handle action for close button
|
|
@@ -5793,9 +6385,17 @@ const MgPopover = class {
|
|
|
5793
6385
|
};
|
|
5794
6386
|
this.identifier = createID('mg-popover');
|
|
5795
6387
|
this.placement = 'bottom';
|
|
6388
|
+
this.arrowHide = false;
|
|
5796
6389
|
this.closeButton = false;
|
|
5797
6390
|
this.display = false;
|
|
5798
6391
|
this.disabled = false;
|
|
6392
|
+
this.classList = new ClassList(['mg-popover']);
|
|
6393
|
+
}
|
|
6394
|
+
validateArrowHide(newValue) {
|
|
6395
|
+
if (newValue)
|
|
6396
|
+
this.classList.add(this.classArrowHide);
|
|
6397
|
+
else
|
|
6398
|
+
this.classList.delete(this.classArrowHide);
|
|
5799
6399
|
}
|
|
5800
6400
|
handleDisplay(newValue) {
|
|
5801
6401
|
if (newValue) {
|
|
@@ -5815,8 +6415,11 @@ const MgPopover = class {
|
|
|
5815
6415
|
* @returns {void} timeout
|
|
5816
6416
|
*/
|
|
5817
6417
|
componentWillLoad() {
|
|
6418
|
+
// Get windows to attach events
|
|
6419
|
+
this.windows = getWindows(window);
|
|
5818
6420
|
// Get locales
|
|
5819
6421
|
this.messages = initLocales(this.element).messages;
|
|
6422
|
+
this.validateArrowHide(this.arrowHide);
|
|
5820
6423
|
}
|
|
5821
6424
|
/**
|
|
5822
6425
|
* Check if component props are well configured on init
|
|
@@ -5848,11 +6451,22 @@ const MgPopover = class {
|
|
|
5848
6451
|
{
|
|
5849
6452
|
name: 'offset',
|
|
5850
6453
|
options: {
|
|
5851
|
-
offset: [0,
|
|
6454
|
+
offset: [0, 0],
|
|
5852
6455
|
},
|
|
5853
6456
|
},
|
|
5854
6457
|
],
|
|
5855
6458
|
});
|
|
6459
|
+
if (this.resizeObserver === undefined) {
|
|
6460
|
+
// add resize observer
|
|
6461
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
6462
|
+
if (entries.some(entrie => entrie.target.getAttribute('slot') !== null)) {
|
|
6463
|
+
this.popper.update();
|
|
6464
|
+
}
|
|
6465
|
+
});
|
|
6466
|
+
Array.from(this.element.querySelectorAll('[slot]')).forEach(element => {
|
|
6467
|
+
this.resizeObserver.observe(element);
|
|
6468
|
+
});
|
|
6469
|
+
}
|
|
5856
6470
|
// Add events to toggle display
|
|
5857
6471
|
interactiveElement.addEventListener('click', () => {
|
|
5858
6472
|
if (!this.disabled)
|
|
@@ -5871,10 +6485,11 @@ const MgPopover = class {
|
|
|
5871
6485
|
* @returns {HTMLElement} HTML Element
|
|
5872
6486
|
*/
|
|
5873
6487
|
render() {
|
|
5874
|
-
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class:
|
|
6488
|
+
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: this.classList.join() }, h("mg-card", null, this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" })), !this.arrowHide && h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
5875
6489
|
}
|
|
5876
6490
|
get element() { return getElement(this); }
|
|
5877
6491
|
static get watchers() { return {
|
|
6492
|
+
"arrowHide": ["validateArrowHide"],
|
|
5878
6493
|
"display": ["handleDisplay"]
|
|
5879
6494
|
}; }
|
|
5880
6495
|
};
|
|
@@ -5885,6 +6500,20 @@ const mgSkipLinksCss = ".mg-skip-links{position:absolute;transform:translateY(-1
|
|
|
5885
6500
|
const MgSkipLinks = class {
|
|
5886
6501
|
constructor(hostRef) {
|
|
5887
6502
|
registerInstance(this, hostRef);
|
|
6503
|
+
this.goToAnchor = createEvent(this, "go-to-anchor", 7);
|
|
6504
|
+
/***********
|
|
6505
|
+
* Methods *
|
|
6506
|
+
**********/
|
|
6507
|
+
/**
|
|
6508
|
+
* Handle link click and emit go-to-anchor event
|
|
6509
|
+
*
|
|
6510
|
+
* @param {MouseEvent} event mouse event
|
|
6511
|
+
* @returns {void}
|
|
6512
|
+
*/
|
|
6513
|
+
this.handleLinkCLick = (event) => {
|
|
6514
|
+
event.currentTarget.blur();
|
|
6515
|
+
this.goToAnchor.emit(event.currentTarget.getAttribute('href'));
|
|
6516
|
+
};
|
|
5888
6517
|
this.links = undefined;
|
|
5889
6518
|
}
|
|
5890
6519
|
validateLinks(links) {
|
|
@@ -5912,7 +6541,7 @@ const MgSkipLinks = class {
|
|
|
5912
6541
|
* @returns {HTMLElement} HTML Element
|
|
5913
6542
|
*/
|
|
5914
6543
|
render() {
|
|
5915
|
-
return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list" }, this.links.map(link => (h("li",
|
|
6544
|
+
return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
5916
6545
|
}
|
|
5917
6546
|
get element() { return getElement(this); }
|
|
5918
6547
|
static get watchers() { return {
|
|
@@ -5936,7 +6565,7 @@ var Status;
|
|
|
5936
6565
|
*/
|
|
5937
6566
|
const sizes = ['regular', 'large'];
|
|
5938
6567
|
|
|
5939
|
-
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular{padding:1rem 2rem}.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button ::slotted([slot=label]),.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button ::slotted([slot=metadata]),.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular ::slotted([slot=label]),.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular ::slotted([slot=metadata]){font-size:
|
|
6568
|
+
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular{padding:1rem 2rem;height:calc()}.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button ::slotted([slot=label]),.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button ::slotted([slot=metadata]),.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular ::slotted([slot=label]),.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular ::slotted([slot=metadata]){font-size:var(--font-size)}.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button.mg-tabs__navigation-button--horizontal,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular.mg-tabs__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button.mg-tabs__navigation-button--vertical,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular.mg-tabs__navigation-button--vertical{padding-left:calc(2rem - 0.3rem)}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large{padding:1.5rem 3rem;height:calc()}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button,.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button ::slotted([slot=label]),.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button ::slotted([slot=metadata]),.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large ::slotted([slot=label]),.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large ::slotted([slot=metadata]){font-size:calc(var(--font-size) + 0.2rem)}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button.mg-tabs__navigation-button--horizontal,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large.mg-tabs__navigation-button--horizontal{padding-bottom:calc(1.5rem - 0.3rem)}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button.mg-tabs__navigation-button--vertical,.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large.mg-tabs__navigation-button--vertical{padding-left:calc(3rem - 0.3rem)}.mg-tabs__navigation-button{display:flex;align-items:center;column-gap:var(--mg-tabs-navigation-button-column-gap, 1rem);background-color:unset;border:none;font-family:var(--font-family);font-weight:400;color:hsl(var(--mg-tabs-color-hsl, var(--color-dark)));line-height:var(--line-height);text-decoration:none;white-space:nowrap;box-sizing:border-box;cursor:pointer}.mg-tabs__navigation-button:disabled,.mg-tabs__navigation-button--disabled{cursor:default;opacity:var(--mg-disabled-opacity)}.mg-tabs__navigation-button:focus-visible{z-index:10}.mg-tabs__navigation-button:hover:not(.mg-tabs__navigation-button--disabled),.mg-tabs__navigation-button:focus-visible:not(.mg-tabs__navigation-button--disabled){background-color:hsl(var(--mg-tabs-focused-background-color-hsl), 0.1)}.mg-tabs__navigation-button.mg-tabs__navigation-button--active{color:hsl(var(--mg-tabs-color-active-hsl));font-weight:600}.mg-tabs__navigation-button.mg-tabs__navigation-button--active.mg-tabs__navigation-button--horizontal{border-bottom-color:hsl(var(--mg-tabs-border-color-active-hsl))}.mg-tabs__navigation-button.mg-tabs__navigation-button--active.mg-tabs__navigation-button--vertical{border-left-color:hsl(var(--mg-tabs-border-color-active-hsl))}.mg-tabs__navigation-button.mg-tabs__navigation-button--hidden{display:none}.mg-tabs__navigation-button.mg-tabs__navigation-button--horizontal{border-bottom:0.3rem solid transparent}.mg-tabs__navigation-button.mg-tabs__navigation-button--vertical{border-left:0.3rem solid transparent}.mg-tabs__header{display:flex;flex-direction:row;flex-wrap:wrap}.mg-tabs__content-container:focus-visible{outline:none}.mg-tabs__navigation-button-text{flex:0 0 content}";
|
|
5940
6569
|
|
|
5941
6570
|
/**
|
|
5942
6571
|
* type TabItem validation function
|
|
@@ -5955,25 +6584,7 @@ const MgTabs = class {
|
|
|
5955
6584
|
// classes
|
|
5956
6585
|
this.tabPanel = 'panel';
|
|
5957
6586
|
this.buttonTabBaseClass = 'mg-tabs__navigation-button';
|
|
5958
|
-
// variables
|
|
5959
6587
|
this.startIndex = 1;
|
|
5960
|
-
/**
|
|
5961
|
-
* Method to set active tab
|
|
5962
|
-
*
|
|
5963
|
-
* @param {number} tabKey item tab key to set to ACTIVE status
|
|
5964
|
-
* @returns {void}
|
|
5965
|
-
*/
|
|
5966
|
-
this.setActiveTab = (tabKey) => {
|
|
5967
|
-
// reset active tabs
|
|
5968
|
-
this.tabs.forEach(tab => {
|
|
5969
|
-
if (this.tabHasGivenStatus(tab, Status.ACTIVE))
|
|
5970
|
-
tab.status = Status.VISIBLE;
|
|
5971
|
-
});
|
|
5972
|
-
// set active tab from given tab key
|
|
5973
|
-
this.tabs[tabKey - this.startIndex].status = Status.ACTIVE;
|
|
5974
|
-
// emit change active tab key event
|
|
5975
|
-
this.activeTabChange.emit(tabKey);
|
|
5976
|
-
};
|
|
5977
6588
|
/**
|
|
5978
6589
|
* Method to know if given tab has the given status
|
|
5979
6590
|
*
|
|
@@ -5981,7 +6592,7 @@ const MgTabs = class {
|
|
|
5981
6592
|
* @param {Status} status status to valide
|
|
5982
6593
|
* @returns {boolean} status comparaison
|
|
5983
6594
|
*/
|
|
5984
|
-
this.
|
|
6595
|
+
this.tabHasStatus = (tab, status) => tab.status === status;
|
|
5985
6596
|
/**
|
|
5986
6597
|
* Method to get element id from index
|
|
5987
6598
|
*
|
|
@@ -5989,31 +6600,43 @@ const MgTabs = class {
|
|
|
5989
6600
|
* @param {number} index to generate id
|
|
5990
6601
|
* @returns {string} generated element id
|
|
5991
6602
|
*/
|
|
5992
|
-
this.getElementId = (element, index) => `${element}-${this.
|
|
6603
|
+
this.getElementId = (element, index) => `${element}-${this.getTabItemIndex(index)}`;
|
|
5993
6604
|
/**
|
|
5994
|
-
* Method to get tab index
|
|
6605
|
+
* Method to get tab item index
|
|
5995
6606
|
*
|
|
5996
6607
|
* @param {number} index to get
|
|
5997
6608
|
* @returns {number} index
|
|
5998
6609
|
*/
|
|
5999
|
-
this.
|
|
6610
|
+
this.getTabItemIndex = (index) => index + this.startIndex;
|
|
6611
|
+
/**
|
|
6612
|
+
* Method to get the active-tab value
|
|
6613
|
+
*
|
|
6614
|
+
* @returns {number} of the active-tab
|
|
6615
|
+
*/
|
|
6616
|
+
this.getActiveTab = () => this.activeTab || this.getTabItemIndex(this.tabs.map((tab, index) => (Object.assign(Object.assign({}, tab), { index }))).find(tab => this.tabHasStatus(tab, Status.ACTIVE)).index);
|
|
6000
6617
|
/**
|
|
6001
6618
|
* Handle click events on tabs
|
|
6002
6619
|
*
|
|
6003
6620
|
* @param {MouseEvent} event mouse event
|
|
6004
6621
|
*/
|
|
6005
6622
|
this.handleClick = (event) => {
|
|
6006
|
-
const tabId = event.currentTarget.
|
|
6007
|
-
|
|
6623
|
+
const tabId = event.currentTarget.dataset.index;
|
|
6624
|
+
const tab = this.tabs[Number(tabId) - this.startIndex];
|
|
6625
|
+
if (this.tabHasStatus(tab, Status.HIDDEN) || this.tabHasStatus(tab, Status.DISABLED)) {
|
|
6626
|
+
event.preventDefault();
|
|
6627
|
+
}
|
|
6628
|
+
else {
|
|
6629
|
+
this.activeTab = Number(tabId);
|
|
6630
|
+
this.tabFocus = undefined;
|
|
6631
|
+
}
|
|
6008
6632
|
};
|
|
6009
6633
|
/**
|
|
6010
6634
|
* get navigation button class from given status
|
|
6011
6635
|
*
|
|
6012
6636
|
* @param {Status} status button tab status
|
|
6013
|
-
* @param {boolean} isSelector set if we need a CSS selector with the dot '.' at the begin. default value = false.
|
|
6014
6637
|
* @returns {string} button class/selector variant
|
|
6015
6638
|
*/
|
|
6016
|
-
this.getNavigationButtonClass = (status
|
|
6639
|
+
this.getNavigationButtonClass = (status) => `${this.buttonTabBaseClass}--${status}`;
|
|
6017
6640
|
/**
|
|
6018
6641
|
* Handle keyboard event on tabs
|
|
6019
6642
|
*
|
|
@@ -6021,37 +6644,66 @@ const MgTabs = class {
|
|
|
6021
6644
|
* @returns {void}
|
|
6022
6645
|
*/
|
|
6023
6646
|
this.handleKeydown = (event) => {
|
|
6024
|
-
let tabId = Number(event.target.getAttribute('data-index'));
|
|
6025
6647
|
const parent = event.target.parentElement;
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6648
|
+
if (['ArrowRight', 'ArrowLeft'].includes(event.key)) {
|
|
6649
|
+
this.tabFocus = Number(event.target.dataset.index);
|
|
6650
|
+
parent.querySelector(`[data-index="${this.tabFocus}"]`).setAttribute('tabindex', '-1');
|
|
6651
|
+
// Move right
|
|
6652
|
+
if (event.key === 'ArrowRight') {
|
|
6653
|
+
this.tabFocus++;
|
|
6654
|
+
// If we're at the end, go to the start
|
|
6655
|
+
if (this.tabFocus > this.tabs.length)
|
|
6656
|
+
this.tabFocus = this.startIndex;
|
|
6657
|
+
// Move left
|
|
6658
|
+
}
|
|
6659
|
+
else if (event.key === 'ArrowLeft') {
|
|
6660
|
+
this.tabFocus--;
|
|
6661
|
+
// If we're at the start, move to the end
|
|
6662
|
+
if (this.tabFocus < this.startIndex)
|
|
6663
|
+
this.tabFocus = this.tabs.length;
|
|
6664
|
+
}
|
|
6665
|
+
const parentButtonElement = parent.querySelector(`[data-index="${this.tabFocus}"]`);
|
|
6666
|
+
// if focus item is ['hidden'] we recursively repeat action
|
|
6667
|
+
if (this.tabHasStatus(this.tabs[this.tabFocus - 1], Status.HIDDEN)) {
|
|
6668
|
+
parentButtonElement.dispatchEvent(new KeyboardEvent('keydown', { key: event.key, bubbles: true }));
|
|
6669
|
+
// else run focus methods on tabFocus element
|
|
6670
|
+
}
|
|
6671
|
+
else {
|
|
6672
|
+
parentButtonElement.setAttribute('tabindex', '0');
|
|
6673
|
+
parentButtonElement.focus();
|
|
6674
|
+
}
|
|
6032
6675
|
}
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
// apply selected tab if exist
|
|
6036
|
-
if (selectedTab !== null) {
|
|
6037
|
-
selectedTab.focus();
|
|
6038
|
-
this.activeTab = tabId;
|
|
6676
|
+
else if (event.key === 'Tab') {
|
|
6677
|
+
this.resetFocus();
|
|
6039
6678
|
}
|
|
6040
6679
|
};
|
|
6680
|
+
/**
|
|
6681
|
+
* Method to reset focus behavior
|
|
6682
|
+
*
|
|
6683
|
+
* @returns {void}
|
|
6684
|
+
*/
|
|
6685
|
+
this.resetFocus = () => {
|
|
6686
|
+
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
6687
|
+
setTimeout(() => {
|
|
6688
|
+
this.tabFocus = undefined;
|
|
6689
|
+
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
6690
|
+
tab.setAttribute('tabindex', this.getActiveTab() - this.startIndex !== index ? '-1' : '0');
|
|
6691
|
+
});
|
|
6692
|
+
}, 0);
|
|
6693
|
+
};
|
|
6041
6694
|
/**
|
|
6042
6695
|
* Validate slots setting
|
|
6043
6696
|
*/
|
|
6044
6697
|
this.validateSlots = () => {
|
|
6045
6698
|
const slots = Array.from(this.element.children).filter(slot => { var _a; return (_a = slot.getAttribute('slot')) === null || _a === void 0 ? void 0 : _a.includes('tab_content-'); });
|
|
6046
|
-
if (slots.length !== this.tabs.length)
|
|
6699
|
+
if (slots.length !== this.tabs.length)
|
|
6047
6700
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
6048
|
-
}
|
|
6049
6701
|
};
|
|
6050
6702
|
this.identifier = createID('mg-tabs');
|
|
6051
6703
|
this.label = undefined;
|
|
6052
6704
|
this.size = 'regular';
|
|
6053
6705
|
this.items = undefined;
|
|
6054
|
-
this.activeTab =
|
|
6706
|
+
this.activeTab = undefined;
|
|
6055
6707
|
this.tabs = [];
|
|
6056
6708
|
this.classList = new ClassList(['mg-tabs']);
|
|
6057
6709
|
}
|
|
@@ -6062,29 +6714,44 @@ const MgTabs = class {
|
|
|
6062
6714
|
}
|
|
6063
6715
|
validateSize(newValue) {
|
|
6064
6716
|
if (!sizes.includes(newValue)) {
|
|
6065
|
-
throw new Error(`<mg-tabs> prop "size" must be one of
|
|
6717
|
+
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}`);
|
|
6066
6718
|
}
|
|
6067
6719
|
this.classList.add(`mg-tabs--size-${this.size}`);
|
|
6068
6720
|
}
|
|
6069
6721
|
validateItems(newValue) {
|
|
6070
6722
|
// String array
|
|
6071
6723
|
if (allItemsAreString(newValue)) {
|
|
6072
|
-
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
6724
|
+
this.tabs = newValue.map((item, index) => ({ label: item, status: index === 0 ? Status.ACTIVE : Status.VISIBLE }));
|
|
6073
6725
|
}
|
|
6074
6726
|
// Object array
|
|
6075
|
-
else if (newValue && newValue.every(item => isTabItem(item))) {
|
|
6727
|
+
else if (newValue && newValue.length > 0 && newValue.every(item => isTabItem(item))) {
|
|
6076
6728
|
this.tabs = newValue;
|
|
6729
|
+
// init active tabs if not set. Default: index 0.
|
|
6730
|
+
if (this.tabs.find(tab => this.tabHasStatus(tab, Status.ACTIVE)) === undefined)
|
|
6731
|
+
this.tabs[0].status = Status.ACTIVE;
|
|
6077
6732
|
}
|
|
6078
6733
|
else {
|
|
6079
6734
|
throw new Error('<mg-tabs> prop "items" is required and all items must be the same type: TabItem.');
|
|
6080
6735
|
}
|
|
6081
6736
|
}
|
|
6082
6737
|
validateActiveTab(newValue) {
|
|
6083
|
-
if (newValue
|
|
6084
|
-
|
|
6738
|
+
if (typeof newValue === 'number' && newValue >= 1 && newValue <= this.tabs.length) {
|
|
6739
|
+
this.tabs.forEach((tab, index) => {
|
|
6740
|
+
const isNewActiveTab = index === newValue - this.startIndex;
|
|
6741
|
+
// reset active tabs
|
|
6742
|
+
if (this.tabHasStatus(tab, Status.ACTIVE) && !isNewActiveTab)
|
|
6743
|
+
tab.status = Status.VISIBLE;
|
|
6744
|
+
// set active tab from given tab key
|
|
6745
|
+
else if ((tab.status === undefined || this.tabHasStatus(tab, Status.VISIBLE)) && isNewActiveTab)
|
|
6746
|
+
tab.status = Status.ACTIVE;
|
|
6747
|
+
});
|
|
6748
|
+
// emit change active tab key event
|
|
6749
|
+
if (this.tabs.find(tab => this.tabHasStatus(tab, Status.ACTIVE)) !== undefined) {
|
|
6750
|
+
this.activeTabChange.emit(newValue);
|
|
6751
|
+
}
|
|
6085
6752
|
}
|
|
6086
|
-
else {
|
|
6087
|
-
|
|
6753
|
+
else if (newValue !== undefined) {
|
|
6754
|
+
throw new Error('<mg-tabs> prop "activeTab" must be between 1 and tabs length.');
|
|
6088
6755
|
}
|
|
6089
6756
|
}
|
|
6090
6757
|
/*************
|
|
@@ -6103,19 +6770,30 @@ const MgTabs = class {
|
|
|
6103
6770
|
this.validateSize(this.size);
|
|
6104
6771
|
this.validateSlots();
|
|
6105
6772
|
}
|
|
6773
|
+
/**
|
|
6774
|
+
* add listners
|
|
6775
|
+
*
|
|
6776
|
+
* @returns {void}
|
|
6777
|
+
*/
|
|
6778
|
+
componentDidLoad() {
|
|
6779
|
+
document.addEventListener('click', (event) => {
|
|
6780
|
+
if (event.target.closest('mg-tabs') !== this.element)
|
|
6781
|
+
this.resetFocus();
|
|
6782
|
+
}, false);
|
|
6783
|
+
}
|
|
6106
6784
|
/**
|
|
6107
6785
|
* Render
|
|
6108
6786
|
*
|
|
6109
6787
|
* @returns {HTMLElement} HTML Element
|
|
6110
6788
|
*/
|
|
6111
6789
|
render() {
|
|
6112
|
-
return (h("div", { class: this.classList.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
6790
|
+
return (h("div", { class: this.classList.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
6113
6791
|
[`${this.buttonTabBaseClass}`]: true,
|
|
6114
6792
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
6115
|
-
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.
|
|
6116
|
-
[`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.
|
|
6117
|
-
[`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.
|
|
6118
|
-
}, tabindex: this.
|
|
6793
|
+
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
6794
|
+
[`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasStatus(tab, Status.DISABLED),
|
|
6795
|
+
[`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasStatus(tab, Status.HIDDEN),
|
|
6796
|
+
}, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { key: tab.label, role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
|
|
6119
6797
|
}
|
|
6120
6798
|
get element() { return getElement(this); }
|
|
6121
6799
|
static get watchers() { return {
|
|
@@ -6132,7 +6810,7 @@ MgTabs.style = mgTabsCss;
|
|
|
6132
6810
|
*/
|
|
6133
6811
|
const variants = ['primary', 'secondary', 'success', 'warning', 'danger', 'info'];
|
|
6134
6812
|
|
|
6135
|
-
const mgTagCss = ".mg-tag{padding:calc((var(--mg-tag-height) - 0.2rem - var(--mg-tag-font-size) * var(--line-height)) / 2) 0.6rem;min-height:var(--mg-tag-height);box-sizing:border-box;border-radius:var(--mg-tag-border-radius);border:0.1rem solid;font-size:var(--mg-tag-font-size);font-weight:600;text-align:center}.mg-tag.mg-tag--primary{background-color:hsl(var(--color-dark));border-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-tag.mg-tag--primary.mg-tag--outline{background-color:transparent;color:hsl(var(--color-dark))}.mg-tag.mg-tag--primary.mg-tag--soft{font-weight:
|
|
6813
|
+
const mgTagCss = ".mg-tag{padding:calc((var(--mg-tag-height) - 0.2rem - var(--mg-tag-font-size) * var(--line-height)) / 2) 0.6rem;min-height:var(--mg-tag-height);box-sizing:border-box;border-radius:var(--mg-tag-border-radius);border:0.1rem solid;font-size:var(--mg-tag-font-size);font-weight:600;text-align:center}.mg-tag.mg-tag--primary{background-color:hsl(var(--color-dark));border-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-tag.mg-tag--primary.mg-tag--outline{background-color:transparent;color:hsl(var(--color-dark))}.mg-tag.mg-tag--primary.mg-tag--soft{font-weight:400;background-color:hsl(var(--color-dark-h), var(--color-dark-s), 90%);border-color:hsl(var(--color-dark-h), var(--color-dark-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--primary.mg-tag--soft ::slotted(mg-icon){color:hsl(var(--color-dark))}.mg-tag.mg-tag--secondary{background-color:hsl(var(--color-light));border-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-tag.mg-tag--secondary.mg-tag--outline{background-color:transparent;color:hsl(var(--color-light))}.mg-tag.mg-tag--secondary.mg-tag--soft{font-weight:400;background-color:hsl(var(--color-light-h), var(--color-light-s), 90%);border-color:hsl(var(--color-light-h), var(--color-light-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--secondary.mg-tag--soft ::slotted(mg-icon){color:hsl(var(--color-dark))}.mg-tag.mg-tag--success{background-color:hsl(var(--color-success));border-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-tag.mg-tag--success.mg-tag--outline{background-color:transparent;color:hsl(var(--color-success))}.mg-tag.mg-tag--success.mg-tag--soft{font-weight:400;background-color:hsl(var(--color-success-h), var(--color-success-s), 90%);border-color:hsl(var(--color-success-h), var(--color-success-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--success.mg-tag--soft ::slotted(mg-icon){color:hsl(var(--color-success))}.mg-tag.mg-tag--warning{background-color:hsl(var(--color-warning));border-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-tag.mg-tag--warning.mg-tag--outline{background-color:transparent;color:hsl(var(--color-warning))}.mg-tag.mg-tag--warning.mg-tag--soft{font-weight:400;background-color:hsl(var(--color-warning-h), var(--color-warning-s), 90%);border-color:hsl(var(--color-warning-h), var(--color-warning-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--warning.mg-tag--soft ::slotted(mg-icon){color:hsl(var(--color-warning))}.mg-tag.mg-tag--danger{background-color:hsl(var(--color-danger));border-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-tag.mg-tag--danger.mg-tag--outline{background-color:transparent;color:hsl(var(--color-danger))}.mg-tag.mg-tag--danger.mg-tag--soft{font-weight:400;background-color:hsl(var(--color-danger-h), var(--color-danger-s), 90%);border-color:hsl(var(--color-danger-h), var(--color-danger-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--danger.mg-tag--soft ::slotted(mg-icon){color:hsl(var(--color-danger))}.mg-tag.mg-tag--info{background-color:hsl(var(--color-info));border-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-tag.mg-tag--info.mg-tag--outline{background-color:transparent;color:hsl(var(--color-info))}.mg-tag.mg-tag--info.mg-tag--soft{font-weight:400;background-color:hsl(var(--color-info-h), var(--color-info-s), 90%);border-color:hsl(var(--color-info-h), var(--color-info-s), 90%);color:hsl(var(--color-dark))}.mg-tag.mg-tag--info.mg-tag--soft ::slotted(mg-icon){color:hsl(var(--color-info))}.mg-tag,mg-tag{display:inline-block;vertical-align:middle}::slotted(mg-icon){margin-right:0.4rem}";
|
|
6136
6814
|
|
|
6137
6815
|
const MgTag = class {
|
|
6138
6816
|
constructor(hostRef) {
|
|
@@ -6141,8 +6819,8 @@ const MgTag = class {
|
|
|
6141
6819
|
* Internal *
|
|
6142
6820
|
************/
|
|
6143
6821
|
// Classes
|
|
6144
|
-
this.classOutline =
|
|
6145
|
-
this.classSoft =
|
|
6822
|
+
this.classOutline = 'mg-tag--outline';
|
|
6823
|
+
this.classSoft = 'mg-tag--soft';
|
|
6146
6824
|
this.variant = variants[0];
|
|
6147
6825
|
this.outline = undefined;
|
|
6148
6826
|
this.soft = undefined;
|
|
@@ -6150,7 +6828,7 @@ const MgTag = class {
|
|
|
6150
6828
|
}
|
|
6151
6829
|
validateVariant(newValue, oldValue) {
|
|
6152
6830
|
if (!variants.includes(newValue)) {
|
|
6153
|
-
throw new Error(`<mg-tag> prop "variant" must be one of
|
|
6831
|
+
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}.`);
|
|
6154
6832
|
}
|
|
6155
6833
|
else {
|
|
6156
6834
|
if (oldValue !== undefined) {
|
|
@@ -6185,7 +6863,7 @@ const MgTag = class {
|
|
|
6185
6863
|
* @returns {void}
|
|
6186
6864
|
*/
|
|
6187
6865
|
validateTextContent(textContent) {
|
|
6188
|
-
if (
|
|
6866
|
+
if (typeof textContent !== 'string' || textContent.trim() === '')
|
|
6189
6867
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
6190
6868
|
}
|
|
6191
6869
|
/*************
|
|
@@ -6226,7 +6904,7 @@ var Guard;
|
|
|
6226
6904
|
Guard["HOVER_TOOLTIPED_ELEMENT"] = "hoverTooltipedGuard";
|
|
6227
6905
|
})(Guard || (Guard = {}));
|
|
6228
6906
|
|
|
6229
|
-
const mgTooltipCss = ":host{display:inline-block}.mg-tooltip{display:none;padding:0.5rem 0.8rem;z-index:1000;border-radius:var(--mg-tooltip-border-radius);background-color:hsl(var(--mg-tooltip-background-color));color:hsl(var(--mg-tooltip-font-color));text-align:start}.mg-tooltip[data-show]{display:block}.mg-tooltip .mg-tooltip__arrow,.mg-tooltip .mg-tooltip__arrow::before{position:absolute;width:0.8rem;height:0.8rem;z-index:9999;background:inherit}.mg-tooltip .mg-tooltip__arrow{visibility:hidden}.mg-tooltip .mg-tooltip__arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-tooltip[data-popper-placement^=top]>.mg-tooltip__arrow{bottom:-4px}.mg-tooltip[data-popper-placement^=bottom]>.mg-tooltip__arrow{top:-4px}.mg-tooltip[data-popper-placement^=left]>.mg-tooltip__arrow{right:-4px}.mg-tooltip[data-popper-placement^=right]>.mg-tooltip__arrow{left:-4px}";
|
|
6907
|
+
const mgTooltipCss = ":host{display:inline-block}.mg-tooltip{display:none;padding:0.5rem 0.8rem;z-index:1000;border-radius:var(--mg-tooltip-border-radius);background-color:hsl(var(--mg-tooltip-background-color));color:hsl(var(--mg-tooltip-font-color));text-align:start;max-width:40rem;box-sizing:border-box}.mg-tooltip[data-show]{display:block}.mg-tooltip .mg-tooltip__arrow,.mg-tooltip .mg-tooltip__arrow::before{position:absolute;width:0.8rem;height:0.8rem;z-index:9999;background:inherit}.mg-tooltip .mg-tooltip__arrow{visibility:hidden}.mg-tooltip .mg-tooltip__arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-tooltip[data-popper-placement^=top]>.mg-tooltip__arrow{bottom:-4px}.mg-tooltip[data-popper-placement^=bottom]>.mg-tooltip__arrow{top:-4px}.mg-tooltip[data-popper-placement^=left]>.mg-tooltip__arrow{right:-4px}.mg-tooltip[data-popper-placement^=right]>.mg-tooltip__arrow{left:-4px}";
|
|
6230
6908
|
|
|
6231
6909
|
const MgTooltip = class {
|
|
6232
6910
|
constructor(hostRef) {
|
|
@@ -6238,7 +6916,7 @@ const MgTooltip = class {
|
|
|
6238
6916
|
*/
|
|
6239
6917
|
this.show = () => {
|
|
6240
6918
|
// Make the tooltip visible
|
|
6241
|
-
this.tooltip.
|
|
6919
|
+
this.tooltip.dataset.show = '';
|
|
6242
6920
|
// Enable the event listeners
|
|
6243
6921
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
6244
6922
|
// Update its position
|
|
@@ -6284,7 +6962,7 @@ const MgTooltip = class {
|
|
|
6284
6962
|
this.resetGuard();
|
|
6285
6963
|
}, 100);
|
|
6286
6964
|
}
|
|
6287
|
-
else if (
|
|
6965
|
+
else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {
|
|
6288
6966
|
this.setDisplay(isMouseenter);
|
|
6289
6967
|
}
|
|
6290
6968
|
}
|
|
@@ -6353,24 +7031,22 @@ const MgTooltip = class {
|
|
|
6353
7031
|
this.guard = Guard.FOCUS;
|
|
6354
7032
|
this.setDisplay(true);
|
|
6355
7033
|
});
|
|
6356
|
-
|
|
6357
|
-
this.
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
this.resetGuard();
|
|
7034
|
+
this.tooltipedElement.addEventListener('blur', () => {
|
|
7035
|
+
this.resetGuard();
|
|
7036
|
+
this.setDisplay(false);
|
|
7037
|
+
});
|
|
7038
|
+
document.addEventListener('keydown', (event) => {
|
|
7039
|
+
if (event.code === 'Escape')
|
|
6363
7040
|
this.setDisplay(false);
|
|
6364
|
-
});
|
|
6365
7041
|
});
|
|
6366
7042
|
// manage tooltipElement & tooltipedElement mouseenter/mouseleave events
|
|
6367
|
-
['mouseenter', 'mouseleave'].forEach(
|
|
6368
|
-
const isMouseenter =
|
|
7043
|
+
['mouseenter', 'mouseleave'].forEach(eventType => {
|
|
7044
|
+
const isMouseenter = eventType === 'mouseenter';
|
|
6369
7045
|
[
|
|
6370
7046
|
{ element: this.tooltip, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIPED_ELEMENT) },
|
|
6371
7047
|
{ element: this.tooltipedElement, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIP_ELEMENT) },
|
|
6372
7048
|
].forEach(({ element, action }) => {
|
|
6373
|
-
element.addEventListener(
|
|
7049
|
+
element.addEventListener(eventType, () => {
|
|
6374
7050
|
action();
|
|
6375
7051
|
});
|
|
6376
7052
|
});
|
|
@@ -6412,8 +7088,7 @@ const MgTooltip = class {
|
|
|
6412
7088
|
// get slotted element
|
|
6413
7089
|
const slotElement = this.element.firstElementChild;
|
|
6414
7090
|
// Get interactive element
|
|
6415
|
-
const
|
|
6416
|
-
const interactiveElement = this.element.shadowRoot.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
|
|
7091
|
+
const interactiveElement = slotElement.matches(focusableElements) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(focusableElements);
|
|
6417
7092
|
// define selected element to become tooltip selector
|
|
6418
7093
|
this.tooltipedElement = interactiveElement || slotElement;
|
|
6419
7094
|
// Check if slotted element is a disabled mg-button
|
|
@@ -6438,7 +7113,7 @@ const MgTooltip = class {
|
|
|
6438
7113
|
* @returns {HTMLElement} HTML Element
|
|
6439
7114
|
*/
|
|
6440
7115
|
render() {
|
|
6441
|
-
return (h(Host, null, h("slot", null), h("div", { role: "tooltip", id: this.identifier, class: "mg-tooltip", innerHTML: this.message }, h("div", { class: "mg-tooltip__arrow", "data-popper-arrow": true }))));
|
|
7116
|
+
return (h(Host, null, h("slot", null), h("div", { role: "tooltip", id: this.identifier, class: "mg-tooltip" }, h("span", { innerHTML: this.message }), h("div", { class: "mg-tooltip__arrow", "data-popper-arrow": true }))));
|
|
6442
7117
|
}
|
|
6443
7118
|
get element() { return getElement(this); }
|
|
6444
7119
|
static get watchers() { return {
|
|
@@ -6448,4 +7123,4 @@ const MgTooltip = class {
|
|
|
6448
7123
|
};
|
|
6449
7124
|
MgTooltip.style = mgTooltipCss;
|
|
6450
7125
|
|
|
6451
|
-
export { MgBadge as mg_badge, MgButton as mg_button, MgCard as mg_card, MgCharacterLeft as mg_character_left, MgDetails as mg_details, MgDivider as mg_divider, MgForm as mg_form, MgIcon as mg_icon, MgIllustratedMessage as mg_illustrated_message, MgInputCheckbox as mg_input_checkbox, MgInputDate as mg_input_date, MgInputNumeric as mg_input_numeric, MgInputPassword as mg_input_password, MgInputRadio as mg_input_radio, MgInputSelect as mg_input_select, MgInputText as mg_input_text, MgInputTextarea as mg_input_textarea, MgInputTitle as mg_input_title, MgInputToggle as mg_input_toggle, MgMenu as mg_menu, MgMenuItem as mg_menu_item, MgMessage as mg_message, MgModal as mg_modal, MgPagination as mg_pagination, MgPanel as mg_panel, MgPopover as mg_popover, MgSkipLinks as mg_skip_links, MgTabs as mg_tabs, MgTag as mg_tag, MgTooltip as mg_tooltip };
|
|
7126
|
+
export { MgActionMore as mg_action_more, MgBadge as mg_badge, MgButton as mg_button, MgCard as mg_card, MgCharacterLeft as mg_character_left, MgDetails as mg_details, MgDivider as mg_divider, MgForm as mg_form, MgIcon as mg_icon, MgIllustratedMessage as mg_illustrated_message, MgInputCheckbox as mg_input_checkbox, MgInputDate as mg_input_date, MgInputNumeric as mg_input_numeric, MgInputPassword as mg_input_password, MgInputRadio as mg_input_radio, MgInputSelect as mg_input_select, MgInputText as mg_input_text, MgInputTextarea as mg_input_textarea, MgInputTitle as mg_input_title, MgInputToggle as mg_input_toggle, MgMenu as mg_menu, MgMenuItem as mg_menu_item, MgMessage as mg_message, MgModal as mg_modal, MgPagination as mg_pagination, MgPanel as mg_panel, MgPopover as mg_popover, MgSkipLinks as mg_skip_links, MgTabs as mg_tabs, MgTag as mg_tag, MgTooltip as mg_tooltip };
|