@mgdis/mg-components 4.2.1 → 5.0.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.
Files changed (65) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{mg-badge_23.cjs.entry.js → mg-badge_24.cjs.entry.js} +2032 -42
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/cjs/mg-modal.cjs.entry.js +1 -3
  5. package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -3
  6. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -2
  7. package/dist/collection/components/atoms/mg-button/mg-button.css +106 -68
  8. package/dist/collection/components/atoms/mg-button/mg-button.js +51 -64
  9. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +3 -0
  10. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -3
  11. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +4 -6
  12. package/dist/collection/components/molecules/inputs/MgInput.js +1 -3
  13. package/dist/collection/components/molecules/mg-form/mg-form.js +2 -3
  14. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +2 -1
  15. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +15 -7
  16. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +27 -2
  17. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +1 -1
  18. package/dist/collection/components/molecules/mg-modal/mg-modal.js +1 -3
  19. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -3
  20. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +1 -1
  21. package/dist/collection/components/molecules/mg-panel/mg-panel.css +8 -7
  22. package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -4
  23. package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -2
  24. package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -8
  25. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -3
  26. package/dist/collection/variables.css +6 -0
  27. package/dist/components/MgInput.js +1 -3
  28. package/dist/components/mg-badge2.js +1 -3
  29. package/dist/components/mg-button2.js +44 -13
  30. package/dist/components/mg-form.js +2 -3
  31. package/dist/components/mg-icon2.js +3 -0
  32. package/dist/components/mg-illustrated-message.js +12 -4
  33. package/dist/components/mg-input-title2.js +1 -3
  34. package/dist/components/mg-modal.js +1 -3
  35. package/dist/components/mg-pagination.js +4 -3
  36. package/dist/components/mg-panel.js +3 -5
  37. package/dist/components/mg-popover.js +9 -9
  38. package/dist/components/mg-tabs.js +1 -3
  39. package/dist/components/mg-tooltip2.js +6 -7
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/{mg-badge_23.entry.js → mg-badge_24.entry.js} +2032 -43
  42. package/dist/esm/mg-components.js +1 -1
  43. package/dist/esm/mg-modal.entry.js +1 -3
  44. package/dist/mg-components/mg-components.css +1 -1
  45. package/dist/mg-components/mg-components.esm.js +1 -1
  46. package/dist/mg-components/p-b60a4c53.entry.js +1 -0
  47. package/dist/mg-components/p-df947fa5.entry.js +1 -0
  48. package/dist/mg-components/variables.css +6 -0
  49. package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +2 -2
  50. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +5 -1
  51. package/dist/types/components/atoms/mg-button/mg-button.d.ts +19 -17
  52. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +4 -0
  53. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +1 -0
  54. package/dist/types/components.d.ts +13 -29
  55. package/package.json +1 -1
  56. package/dist/cjs/mg-popover.cjs.entry.js +0 -171
  57. package/dist/cjs/popper-11d5f714.js +0 -1801
  58. package/dist/collection/variables.scss +0 -212
  59. package/dist/esm/mg-popover.entry.js +0 -167
  60. package/dist/esm/popper-f860750c.js +0 -1799
  61. package/dist/mg-components/p-25452f60.entry.js +0 -1
  62. package/dist/mg-components/p-a20fc541.entry.js +0 -1
  63. package/dist/mg-components/p-e08bc19a.entry.js +0 -1
  64. package/dist/mg-components/p-ec26fc38.js +0 -1
  65. package/dist/mg-components/variables.scss +0 -212
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["mg-badge_23.cjs",[[1,"mg-panel",{"identifier":[1],"panelTitle":[1025,"panel-title"],"titlePattern":[1025,"title-pattern"],"titlePatternErrorMessage":[1025,"title-pattern-error-message"],"expanded":[1028],"expandToggleDisabled":[1028,"expand-toggle-disabled"],"titleEditable":[4,"title-editable"],"classList":[32],"isEditing":[32],"updatedPanelTitle":[32]}],[1,"mg-pagination",{"identifier":[1],"label":[1025],"totalPages":[2,"total-pages"],"currentPage":[1538,"current-page"]}],[1,"mg-input-textarea",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"rows":[2],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"resizable":[1],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-checkbox",{"value":[1040],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"checkboxItems":[32],"displayError":[64]}],[1,"mg-input-date",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"min":[1],"max":[1],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-numeric",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"type":[1],"currency":[1],"max":[2],"min":[2],"integerLength":[2,"integer-length"],"decimalLength":[2,"decimal-length"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"hasFocus":[32],"displayError":[64]}],[1,"mg-input-password",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-radio",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"displayError":[64]}],[1,"mg-input-toggle",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"isOnOff":[4,"is-on-off"],"isIcon":[4,"is-icon"],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"classList":[32],"options":[32],"checked":[32]}],[1,"mg-message",{"identifier":[1],"delay":[2],"variant":[1],"closeButton":[1028,"close-button"],"hide":[1028],"classList":[32],"hasActions":[32]}],[1,"mg-tabs",{"identifier":[1],"label":[1],"size":[1],"items":[16],"activeTab":[1538,"active-tab"],"tabs":[32],"classList":[32]}],[1,"mg-details",{"toggleClosed":[1,"toggle-closed"],"toggleOpened":[1,"toggle-opened"],"expanded":[1028]}],[1,"mg-form",{"identifier":[1],"name":[1],"readonly":[4],"disabled":[4],"valid":[1028],"invalid":[1028],"classList":[32],"displayError":[64]}],[1,"mg-illustrated-message",{"size":[1]}],[1,"mg-tag",{"variant":[1],"outline":[4],"classList":[32]}],[1,"mg-input-text",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"type":[1],"icon":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"setFocus":[64],"displayError":[64]}],[1,"mg-input-select",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1025],"placeholderHide":[4,"placeholder-hide"],"placeholderDisabled":[4,"placeholder-disabled"],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"valueExist":[32],"readonlyValue":[32],"displayError":[64]}],[1,"mg-badge",{"value":[1032],"label":[1],"variant":[1],"outline":[4],"classList":[32]}],[2,"mg-character-left",{"identifier":[1],"characters":[1],"maxlength":[2]}],[6,"mg-button",{"variant":[1],"identifier":[1],"label":[1],"type":[1],"form":[1025],"disabled":[1028],"isIcon":[4,"is-icon"],"disableOnClick":[4,"disable-on-click"],"expanded":[4],"controls":[1],"haspopup":[8],"loading":[32],"classList":[32]}],[6,"mg-input-title",{"identifier":[1],"required":[4],"isLegend":[4,"is-legend"],"tagName":[32]}],[6,"mg-tooltip",{"identifier":[1],"message":[1],"placement":[1],"display":[1028],"disabled":[1028]}],[1,"mg-icon",{"icon":[1],"size":[1],"variant":[1],"spin":[4],"classList":[32]}]]],["mg-modal.cjs",[[1,"mg-modal",{"identifier":[1],"modalTitle":[1,"modal-title"],"closeButton":[1028,"close-button"],"hide":[1028],"hasActions":[32],"hasContent":[32],"classList":[32]},[[8,"keydown","handleKeyDown"]]]]],["mg-popover.cjs",[[6,"mg-popover",{"identifier":[1],"placement":[1],"closeButton":[4,"close-button"],"display":[1028],"disabled":[1028]}]]]], options);
18
+ return index.bootstrapLazy([["mg-badge_24.cjs",[[1,"mg-panel",{"identifier":[1],"panelTitle":[1025,"panel-title"],"titlePattern":[1025,"title-pattern"],"titlePatternErrorMessage":[1025,"title-pattern-error-message"],"expanded":[1028],"expandToggleDisabled":[1028,"expand-toggle-disabled"],"titleEditable":[4,"title-editable"],"classList":[32],"isEditing":[32],"updatedPanelTitle":[32]}],[1,"mg-pagination",{"identifier":[1],"label":[1025],"totalPages":[2,"total-pages"],"currentPage":[1538,"current-page"]}],[1,"mg-input-textarea",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"rows":[2],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"resizable":[1],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-checkbox",{"value":[1040],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"checkboxItems":[32],"displayError":[64]}],[1,"mg-input-date",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"min":[1],"max":[1],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-numeric",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"type":[1],"currency":[1],"max":[2],"min":[2],"integerLength":[2,"integer-length"],"decimalLength":[2,"decimal-length"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"hasFocus":[32],"displayError":[64]}],[1,"mg-input-password",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-radio",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"displayError":[64]}],[1,"mg-input-toggle",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"isOnOff":[4,"is-on-off"],"isIcon":[4,"is-icon"],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"classList":[32],"options":[32],"checked":[32]}],[1,"mg-message",{"identifier":[1],"delay":[2],"variant":[1],"closeButton":[1028,"close-button"],"hide":[1028],"classList":[32],"hasActions":[32]}],[1,"mg-popover",{"identifier":[1],"placement":[1],"closeButton":[4,"close-button"],"display":[1028],"disabled":[1028]}],[1,"mg-tabs",{"identifier":[1],"label":[1],"size":[1],"items":[16],"activeTab":[1538,"active-tab"],"tabs":[32],"classList":[32]}],[1,"mg-details",{"toggleClosed":[1,"toggle-closed"],"toggleOpened":[1,"toggle-opened"],"expanded":[1028]}],[1,"mg-form",{"identifier":[1],"name":[1],"readonly":[4],"disabled":[4],"valid":[1028],"invalid":[1028],"classList":[32],"displayError":[64]}],[1,"mg-illustrated-message",{"size":[1],"direction":[1]}],[1,"mg-tag",{"variant":[1],"outline":[4],"classList":[32]}],[1,"mg-input-text",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"type":[1],"icon":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"setFocus":[64],"displayError":[64]}],[1,"mg-input-select",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1025],"placeholderHide":[4,"placeholder-hide"],"placeholderDisabled":[4,"placeholder-disabled"],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classList":[32],"errorMessage":[32],"options":[32],"valueExist":[32],"readonlyValue":[32],"displayError":[64]}],[1,"mg-badge",{"value":[1032],"label":[1],"variant":[1],"outline":[4],"classList":[32]}],[2,"mg-character-left",{"identifier":[1],"characters":[1],"maxlength":[2]}],[1,"mg-button",{"variant":[1],"identifier":[1],"label":[1],"type":[1],"form":[1025],"disabled":[1028],"isIcon":[4,"is-icon"],"disableOnClick":[4,"disable-on-click"],"loading":[32],"classList":[32]}],[6,"mg-input-title",{"identifier":[1],"required":[4],"isLegend":[4,"is-legend"],"tagName":[32]}],[1,"mg-tooltip",{"identifier":[1],"message":[1],"placement":[1],"display":[1028],"disabled":[1028]}],[1,"mg-icon",{"icon":[1],"size":[1],"variant":[1],"spin":[4],"classList":[32]}]]],["mg-modal.cjs",[[1,"mg-modal",{"identifier":[1],"modalTitle":[1,"modal-title"],"closeButton":[1028,"close-button"],"hide":[1028],"hasActions":[32],"hasContent":[32],"classList":[32]},[[8,"keydown","handleKeyDown"]]]]]], options);
19
19
  });
@@ -59,9 +59,7 @@ const MgModal = class {
59
59
  }
60
60
  validateModalTitle(newValue) {
61
61
  if (typeof newValue !== 'string' || newValue.trim() === '') {
62
- // TODO: throw new Error on next major (5.0.0)
63
- // throw new Error('<mg-modal> prop "modalTitle" is required.');
64
- console.error('<mg-modal> prop "modalTitle" is required.');
62
+ throw new Error('<mg-modal> prop "modalTitle" is required.');
65
63
  }
66
64
  }
67
65
  validateHide(newValue) {
@@ -24,9 +24,7 @@ export class MgBadge {
24
24
  }
25
25
  validateLabel(newValue) {
26
26
  if (typeof newValue !== 'string' || newValue.trim() === '') {
27
- // TODO: throw new Error on next major (5.0.0)
28
- // throw new Error('<mg-badge> prop "label" is required.');
29
- console.error('<mg-badge> prop "label" is required.');
27
+ throw new Error('<mg-badge> prop "label" is required.');
30
28
  }
31
29
  }
32
30
  validateVariant(newValue, oldValue) {
@@ -36,8 +36,6 @@ MgButton.args = {
36
36
  disabled: false,
37
37
  disableOnClick: false,
38
38
  isIcon: false,
39
- expanded: false,
40
- controls: undefined,
41
39
  type: undefined,
42
40
  };
43
41
  export const IsIcon = Template.bind({});
@@ -1,110 +1,146 @@
1
1
  /* Variables */
2
2
  /* Mixins */
3
- /* Styles */
4
- .mg-button {
5
- position: relative;
6
- display: inline-flex;
7
- align-items: center;
8
- column-gap: 0.6rem;
9
- padding: calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;
10
- min-height: var(--default-size);
11
- box-sizing: border-box;
12
- border-top-right-radius: var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));
13
- border-top-left-radius: var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));
14
- border-bottom-right-radius: var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));
15
- border-bottom-left-radius: var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));
16
- cursor: pointer;
17
- background-image: none;
18
- border-top-width: var(--mg-button-border-top-width, 0.1rem);
19
- border-right-width: var(--mg-button-border-right-width, 0.1rem);
20
- border-bottom-width: var(--mg-button-border-bottom-width, 0.1rem);
21
- border-left-width: var(--mg-button-border-left-width, 0.1rem);
22
- border-style: solid;
23
- font-family: inherit;
24
- text-decoration: none;
25
- font-weight: normal;
26
- text-align: left;
27
- touch-action: manipulation;
3
+ :host {
4
+ display: inline-block;
5
+ vertical-align: middle;
6
+ max-width: 100%;
28
7
  }
29
- .mg-button[disabled], .mg-button[aria-disabled=true], .mg-button.disabled {
30
- opacity: var(--mg-button-disabled-opacity);
31
- cursor: default;
8
+
9
+ :host(:focus-visible) {
10
+ outline: 0;
32
11
  }
33
- .mg-button.mg-button--icon {
34
- padding: 0;
35
- justify-content: center;
36
- width: var(--default-size);
37
- height: var(--default-size);
38
- border-top-right-radius: var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius));
39
- border-top-left-radius: var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius));
40
- border-bottom-right-radius: var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius));
41
- border-bottom-left-radius: var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));
42
- font-size: var(--font-size);
43
- line-height: var(--font-size);
12
+ :host(:focus-visible) .mg-button:not(.mg-button--disabled) {
13
+ outline-color: -webkit-focus-ring-color;
14
+ outline-style: auto;
15
+ outline-width: 0.2rem;
16
+ }
17
+
18
+ :host(:hover) .mg-button--flat:not(.mg-button--disabled),
19
+ :host(:focus) .mg-button--flat:not(.mg-button--disabled),
20
+ :host(:active) .mg-button--flat:not(.mg-button--disabled) {
21
+ background: hsla(var(--color-dark), 0.1);
44
22
  }
23
+
45
24
  .mg-button.mg-button--primary {
46
25
  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%)));
47
26
  color: hsl(var(--mg-button-primary-font-color));
48
27
  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%)));
49
28
  }
50
- .mg-button.mg-button--primary:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--primary:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--primary:active:not([disabled], [aria-disabled=true], .disabled) {
29
+
30
+ :host(:hover) .mg-button--primary:not(.mg-button--disabled),
31
+ :host(:focus) .mg-button--primary:not(.mg-button--disabled),
32
+ :host(:active) .mg-button--primary:not(.mg-button--disabled) {
51
33
  background: hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l));
52
34
  }
35
+
53
36
  .mg-button.mg-button--secondary {
54
37
  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%)));
55
38
  color: hsl(var(--mg-button-secondary-font-color));
56
39
  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%)));
57
40
  }
58
- .mg-button.mg-button--secondary:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--secondary:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--secondary:active:not([disabled], [aria-disabled=true], .disabled) {
41
+
42
+ :host(:hover) .mg-button--secondary:not(.mg-button--disabled),
43
+ :host(:focus) .mg-button--secondary:not(.mg-button--disabled),
44
+ :host(:active) .mg-button--secondary:not(.mg-button--disabled) {
59
45
  background: hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l));
60
46
  }
47
+
61
48
  .mg-button.mg-button--danger {
62
49
  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%)));
63
50
  color: hsl(var(--color-neutral));
64
51
  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%)));
65
52
  }
66
- .mg-button.mg-button--danger:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--danger:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--danger:active:not([disabled], [aria-disabled=true], .disabled) {
53
+
54
+ :host(:hover) .mg-button--danger:not(.mg-button--disabled),
55
+ :host(:focus) .mg-button--danger:not(.mg-button--disabled),
56
+ :host(:active) .mg-button--danger:not(.mg-button--disabled) {
67
57
  background: hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l));
68
58
  }
59
+
69
60
  .mg-button.mg-button--danger-alt {
70
61
  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%)));
71
62
  color: hsl(var(--color-danger));
72
63
  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%)));
73
64
  }
74
- .mg-button.mg-button--danger-alt:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--danger-alt:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--danger-alt:active:not([disabled], [aria-disabled=true], .disabled) {
65
+
66
+ :host(:hover) .mg-button--danger-alt:not(.mg-button--disabled),
67
+ :host(:focus) .mg-button--danger-alt:not(.mg-button--disabled),
68
+ :host(:active) .mg-button--danger-alt:not(.mg-button--disabled) {
75
69
  background: hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l));
76
70
  }
71
+
77
72
  .mg-button.mg-button--info {
78
73
  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%)));
79
74
  color: hsl(var(--color-neutral));
80
75
  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%)));
81
76
  }
82
- .mg-button.mg-button--info:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--info:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--info:active:not([disabled], [aria-disabled=true], .disabled) {
77
+
78
+ :host(:hover) .mg-button--info:not(.mg-button--disabled),
79
+ :host(:focus) .mg-button--info:not(.mg-button--disabled),
80
+ :host(:active) .mg-button--info:not(.mg-button--disabled) {
83
81
  background: hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l));
84
82
  }
83
+
85
84
  .mg-button.mg-button--success {
86
85
  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%)));
87
86
  color: hsl(var(--color-dark));
88
87
  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%)));
89
88
  }
90
- .mg-button.mg-button--success:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--success:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--success:active:not([disabled], [aria-disabled=true], .disabled) {
89
+
90
+ :host(:hover) .mg-button--success:not(.mg-button--disabled),
91
+ :host(:focus) .mg-button--success:not(.mg-button--disabled),
92
+ :host(:active) .mg-button--success:not(.mg-button--disabled) {
91
93
  background: hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l));
92
94
  }
95
+
96
+ /* Styles */
97
+ .mg-button {
98
+ position: relative;
99
+ display: inline-flex;
100
+ align-items: center;
101
+ column-gap: 0.6rem;
102
+ padding: calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;
103
+ min-height: var(--default-size);
104
+ box-sizing: border-box;
105
+ border-top-right-radius: var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));
106
+ border-top-left-radius: var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));
107
+ border-bottom-right-radius: var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));
108
+ border-bottom-left-radius: var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));
109
+ cursor: pointer;
110
+ background-image: none;
111
+ border-top-width: var(--mg-button-border-top-width, 0.1rem);
112
+ border-right-width: var(--mg-button-border-right-width, 0.1rem);
113
+ border-bottom-width: var(--mg-button-border-bottom-width, 0.1rem);
114
+ border-left-width: var(--mg-button-border-left-width, 0.1rem);
115
+ border-style: solid;
116
+ text-decoration: none;
117
+ font-family: inherit;
118
+ font-weight: var(--mg-button-font-weight, normal);
119
+ text-align: left;
120
+ font-size: var(--font-size);
121
+ touch-action: manipulation;
122
+ }
123
+ .mg-button.mg-button--disabled {
124
+ opacity: var(--mg-button-disabled-opacity);
125
+ cursor: default;
126
+ }
127
+ .mg-button.mg-button--icon {
128
+ padding: 0;
129
+ justify-content: center;
130
+ width: var(--default-size);
131
+ height: var(--default-size);
132
+ border-top-right-radius: var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius));
133
+ border-top-left-radius: var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius));
134
+ border-bottom-right-radius: var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius));
135
+ border-bottom-left-radius: var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));
136
+ font-size: var(--font-size);
137
+ line-height: var(--font-size);
138
+ }
93
139
  .mg-button.mg-button--flat {
94
140
  background: none;
95
141
  border: none;
96
142
  }
97
- .mg-button.mg-button--flat:hover:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--flat:focus:not([disabled], [aria-disabled=true], .disabled), .mg-button.mg-button--flat:active:not([disabled], [aria-disabled=true], .disabled) {
98
- background: hsla(var(--color-dark), 0.1);
99
- }
100
- .mg-button mg-icon:only-child,
101
- .mg-button ::slotted(mg-icon) {
102
- display: inline-flex;
103
- flex-shrink: 0;
104
- line-height: 1;
105
- margin: auto 0;
106
- }
107
- .mg-button.mg-button--loading > mg-icon {
143
+ .mg-button.mg-button--loading > mg-icon:first-of-type {
108
144
  position: absolute;
109
145
  left: 50%;
110
146
  top: 50%;
@@ -113,19 +149,21 @@
113
149
  .mg-button.mg-button--loading .mg-button__content {
114
150
  opacity: 0;
115
151
  }
116
-
117
- .mg-button__content {
152
+ .mg-button mg-icon:only-child,
153
+ .mg-button ::slotted(mg-icon) {
154
+ display: inline-flex;
155
+ flex-shrink: 0;
156
+ line-height: 1;
157
+ margin: auto 0;
158
+ }
159
+ .mg-button slot,
160
+ .mg-button ::slotted(*:not(mg-icon)) {
161
+ text-decoration: none;
162
+ font-family: inherit;
163
+ font-weight: var(--mg-button-font-weight, normal);
164
+ text-align: left;
165
+ font-size: var(--font-size);
118
166
  display: flex;
119
167
  align-items: center;
120
168
  column-gap: 0.6rem;
121
- }
122
-
123
- mg-button {
124
- display: inline-block;
125
- }
126
-
127
- .mg-button,
128
- mg-button {
129
- vertical-align: middle;
130
- max-width: 100%;
131
169
  }
@@ -1,4 +1,4 @@
1
- import { h } from '@stencil/core';
1
+ import { h, Host } from '@stencil/core';
2
2
  import { variants } from './mg-button.conf';
3
3
  import { ClassList } from '../../../utils/components.utils';
4
4
  export class MgButton {
@@ -7,6 +7,8 @@ export class MgButton {
7
7
  * Internal *
8
8
  ************/
9
9
  this.onClickElementFn = null;
10
+ this.classDisabled = 'mg-button--disabled';
11
+ this.classLoading = 'mg-button--loading';
10
12
  /**
11
13
  * Define button variant
12
14
  */
@@ -41,11 +43,38 @@ export class MgButton {
41
43
  if (this.disabled)
42
44
  event.stopPropagation();
43
45
  // Used to prevent multi-click.
44
- if (this.disableOnClick && !this.disabled) {
46
+ else if (this.disableOnClick) {
45
47
  this.loading = true;
46
48
  this.disabled = true;
47
49
  }
48
50
  };
51
+ /**
52
+ * Handle onKeyDown event
53
+ *
54
+ * @param {KeyboardEvent} event keyboard event
55
+ * @returns {void}
56
+ */
57
+ this.handleKeydown = (event) => {
58
+ if (!this.disabled && event.key === ' ') {
59
+ event.preventDefault();
60
+ }
61
+ else if (!this.disabled && ['Enter', 'NumpadEnter', 'Space'].includes(event.key)) {
62
+ event.preventDefault();
63
+ this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
64
+ }
65
+ };
66
+ /**
67
+ * Handle onKeyUp event
68
+ *
69
+ * @param {KeyboardEvent} event keyboard event
70
+ * @returns {void}
71
+ */
72
+ this.handleKeyup = (event) => {
73
+ if (!this.disabled && event.key === ' ') {
74
+ event.preventDefault();
75
+ this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
76
+ }
77
+ };
49
78
  }
50
79
  validateVariant(newValue, oldValue) {
51
80
  if (!variants.includes(newValue)) {
@@ -66,14 +95,21 @@ export class MgButton {
66
95
  }
67
96
  // Manage if onclick
68
97
  this.element.onclick = isDisabled ? undefined : this.onClickElementFn;
98
+ // apply style
99
+ if (isDisabled) {
100
+ this.classList.add(this.classDisabled);
101
+ }
102
+ else {
103
+ this.classList.delete(this.classDisabled);
104
+ }
69
105
  }
70
106
  loadingHandler(newValue) {
71
107
  // we add loading style if it newvalue is true else we remove it
72
108
  if (newValue) {
73
- this.classList.add('mg-button--loading');
109
+ this.classList.add(this.classLoading);
74
110
  }
75
111
  else {
76
- this.classList.delete('mg-button--loading');
112
+ this.classList.delete(this.classLoading);
77
113
  }
78
114
  }
79
115
  /**
@@ -99,13 +135,10 @@ export class MgButton {
99
135
  * @returns {HTMLElement} html element
100
136
  */
101
137
  render() {
102
- return (h("button", { id: this.identifier, class: this.classList.join(), type: this.type, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": this.controls, "aria-haspopup": this.haspopup !== undefined && this.haspopup.toString(), onClick: this.handleClick,
103
- // has stencil does not support form attribute on button, we set the attribute from the ref
104
- // https://github.com/ionic-team/stencil/issues/2703#issuecomment-1050943715
105
- ref: btn => this.form && btn.setAttribute('form', this.form) }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null))));
138
+ return (h(Host, { role: "button", tabIndex: this.disabled ? -1 : 0, type: this.type, form: this.form, "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)))));
106
139
  }
107
140
  static get is() { return "mg-button"; }
108
- static get encapsulation() { return "scoped"; }
141
+ static get encapsulation() { return "shadow"; }
109
142
  static get originalStyleUrls() {
110
143
  return {
111
144
  "$": ["mg-button.scss"]
@@ -122,9 +155,14 @@ export class MgButton {
122
155
  "type": "string",
123
156
  "mutable": false,
124
157
  "complexType": {
125
- "original": "string",
126
- "resolved": "string",
127
- "references": {}
158
+ "original": "VariantType",
159
+ "resolved": "\"danger\" | \"danger-alt\" | \"flat\" | \"info\" | \"primary\" | \"secondary\" | \"success\"",
160
+ "references": {
161
+ "VariantType": {
162
+ "location": "import",
163
+ "path": "./mg-button.conf"
164
+ }
165
+ }
128
166
  },
129
167
  "required": false,
130
168
  "optional": false,
@@ -187,7 +225,7 @@ export class MgButton {
187
225
  "optional": false,
188
226
  "docs": {
189
227
  "tags": [],
190
- "text": "Define button type\nDefault: 'submit', as HTMLButtonElement type is submit by default"
228
+ "text": "Define button type"
191
229
  },
192
230
  "attribute": "type",
193
231
  "reflect": false
@@ -261,57 +299,6 @@ export class MgButton {
261
299
  "attribute": "disable-on-click",
262
300
  "reflect": false,
263
301
  "defaultValue": "false"
264
- },
265
- "expanded": {
266
- "type": "boolean",
267
- "mutable": false,
268
- "complexType": {
269
- "original": "boolean",
270
- "resolved": "boolean",
271
- "references": {}
272
- },
273
- "required": false,
274
- "optional": false,
275
- "docs": {
276
- "tags": [],
277
- "text": "Prop to set aria-expanded on button element"
278
- },
279
- "attribute": "expanded",
280
- "reflect": false
281
- },
282
- "controls": {
283
- "type": "string",
284
- "mutable": false,
285
- "complexType": {
286
- "original": "string",
287
- "resolved": "string",
288
- "references": {}
289
- },
290
- "required": false,
291
- "optional": false,
292
- "docs": {
293
- "tags": [],
294
- "text": "Prop to set aria-controls on button element"
295
- },
296
- "attribute": "controls",
297
- "reflect": false
298
- },
299
- "haspopup": {
300
- "type": "any",
301
- "mutable": false,
302
- "complexType": {
303
- "original": "boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'",
304
- "resolved": "\"dialog\" | \"grid\" | \"listbox\" | \"menu\" | \"tree\" | boolean",
305
- "references": {}
306
- },
307
- "required": false,
308
- "optional": false,
309
- "docs": {
310
- "tags": [],
311
- "text": "Option to set aria-haspopup\nThe aria-haspopup state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity."
312
- },
313
- "attribute": "haspopup",
314
- "reflect": false
315
302
  }
316
303
  };
317
304
  }
@@ -50,6 +50,8 @@ export const icons = {
50
50
  'dashboard': () => h("path", { fill: "currentColor", d: "M1.67 8.7H7.3V1.67H1.67v7.04Zm0 5.63H7.3v-4.22H1.67v4.22Zm7.04 0h5.63V7.3H8.71v7.04Zm0-12.67v4.23h5.63V1.67H8.71Z" }),
51
51
  'dashboard-outline': () => (h("path", { fill: "currentColor", d: "M13.33 2.67v2.22H9.7V2.67h3.63m-7.04 0V7.7H2.67V2.67H6.3m7.04 5.63v5.04H9.71V8.3h3.63M6.3 11.11v2.22H2.67v-2.22H6.3m8.03-9.44H8.7v4.22h5.63V1.67Zm-7.04 0H1.67v7.04H7.3V1.67Zm7.04 5.63H8.7v7.04h5.63V7.3Zm-7.04 2.81H1.67v4.22H7.3v-4.22Z" })),
52
52
  '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" })),
53
+ '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" })),
54
+ '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" })),
53
55
  'euro': () => (h("path", { fill: "currentColor", d: "M13 13.14a.4.4 0 0 0-.47-.31A7.79 7.79 0 0 1 11 13a4.31 4.31 0 0 1-4-2.79h3.8a.41.41 0 0 0 .39-.31l.19-.9a.39.39 0 0 0-.3-.47H6.51a7.07 7.07 0 0 1 0-1.38h4.89a.4.4 0 0 0 .39-.31l.22-1a.4.4 0 0 0-.3-.47H7a4.2 4.2 0 0 1 3.92-2.45 6.57 6.57 0 0 1 1.26.14.41.41 0 0 0 .47-.29l.4-1.45a.4.4 0 0 0-.28-.48A9.43 9.43 0 0 0 11 .67a7.12 7.12 0 0 0-6.83 4.7h-1.1a.4.4 0 0 0-.4.39v1a.4.4 0 0 0 .4.39h.72a9.08 9.08 0 0 0 0 1.38h-.72a.39.39 0 0 0-.4.39v.93a.4.4 0 0 0 .4.39h1A7 7 0 0 0 11 15.3a8.7 8.7 0 0 0 2-.25.39.39 0 0 0 .3-.46l-.3-1.45Z" })),
54
56
  '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" })),
55
57
  '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" })),
@@ -149,6 +151,7 @@ export const icons = {
149
151
  'user-group': () => (h("path", { fill: "currentColor", d: "M13.15 4.12c-.81-.01-1.47.65-1.48 1.46 0 .82.65 1.47 1.46 1.48s1.47-.65 1.48-1.46-.65-1.47-1.46-1.48Zm-10.04.01a1.47 1.47 0 0 0-1.58 1.59c.06.71.62 1.28 1.34 1.34.81.07 1.52-.53 1.59-1.34.06-.81-.54-1.52-1.35-1.59Zm7.36.39c-.22-.84-.87-1.51-1.71-1.75-1.36-.41-2.8.36-3.22 1.72-.18.61-.13 1.27.14 1.85.41.9 1.33 1.48 2.32 1.45 1.41.01 2.56-1.14 2.57-2.55 0-.24-.03-.49-.1-.72Zm-.71 4h-.19c-.99.49-2.14.49-3.13 0h-.19c-1.46 0-2.64 1.18-2.64 2.64v2.69c1.23.93 2.74 1.47 4.39 1.47s3.17-.55 4.4-1.48v-2.68c0-1.46-1.18-2.64-2.64-2.64Zm5.52.25a7.282 7.282 0 0 1-1.65 3.91c-.08.1-.16.19-.25.28-.08.09-.17.18-.25.27v-.55h.03v-.72s.01-.07 0-.1v-.66c.01-1.25-.66-2.4-1.76-3 .27-.26.63-.41 1-.41h1.51c.63.01 1.17.41 1.37.98ZM2.86 11.16v1.52h.01v.55l-.28-.31c-.08-.08-.15-.16-.22-.24A7.238 7.238 0 0 1 .74 8.86c.16-.62.72-1.07 1.4-1.07h1.47c.37-.01.73.12 1.01.37-1.1.6-1.77 1.75-1.76 3Z" })),
150
152
  'user-plus': () => (h("path", { fill: "currentColor", d: "M14,3.33H12.65V2a.36.36,0,0,0-.35-.33h-.65A.36.36,0,0,0,11.3,2V3.33H10a.34.34,0,0,0-.33.34v.66a.34.34,0,0,0,.33.34H11.3V6a.37.37,0,0,0,.35.33h.65A.37.37,0,0,0,12.65,6V4.67H14a.34.34,0,0,0,.32-.34V3.67A.34.34,0,0,0,14,3.33ZM9.28,9.77h-.2a5.19,5.19,0,0,1-3.91,0H5A3,3,0,0,0,1.7,12.46h0v.72A1.27,1.27,0,0,0,3,14.33h8.25a1.26,1.26,0,0,0,1.36-1.14v-.68A3,3,0,0,0,9.37,9.76H9.28ZM7.13,3.7A2.64,2.64,0,1,1,4.5,6.34h0A2.64,2.64,0,0,1,7.13,3.7Z" })),
151
153
  'user-question-outline': () => (h("path", { fill: "currentColor", d: "M5.23 11.14c.86-.66 1.01-1.9.35-2.75s-1.9-1.01-2.75-.35a1.96 1.96 0 0 0 0 3.1c-.72.42-1.16 1.2-1.16 2.03v.8c0 .2.17.37.37.37h3.98c.2 0 .37-.17.37-.37v-.8c0-.83-.44-1.61-1.16-2.03ZM2.81 9.59c0-.67.55-1.22 1.22-1.22s1.22.55 1.22 1.22-.55 1.22-1.22 1.22-1.22-.55-1.22-1.22Zm2.83 4H2.41v-.42c0-.89.72-1.62 1.62-1.62s1.62.72 1.62 1.62v.42h-.01Zm7.13-11.93H8c-.86 0-1.56.7-1.56 1.56v7.16c0 .21.17.37.37.37.08 0 .16-.03.22-.07l1.49-1.12h4.25c.86 0 1.56-.7 1.56-1.56V3.22c0-.86-.7-1.56-1.56-1.56Zm.82 6.33c0 .45-.37.82-.82.82H8.4a.41.41 0 0 0-.22.07l-1 .75V3.22c0-.45.37-.82.82-.82h4.77c.45 0 .82.37.82.82v4.77Zm-2.8-.42c0 .23-.18.41-.41.41s-.41-.18-.41-.41.18-.41.41-.41c.23 0 .41.18.41.41Zm-.41-4.34c-.83 0-1.5.67-1.5 1.5 0 .23.18.41.41.41s.41-.18.41-.41c0-.38.31-.68.69-.68.38 0 .68.31.68.69 0 .38-.31.68-.68.68-.23 0-.41.18-.41.41v.44c0 .23.18.41.41.41s.41-.18.41-.41v-.09c.8-.23 1.26-1.06 1.04-1.85-.18-.65-.77-1.09-1.44-1.09Z" })),
154
+ 'user-shield-outline': () => (h("path", { fill: "currentColor", d: "M8 8.92c-1.5 0-2.72-1.22-2.72-2.72S6.5 3.48 8 3.48s2.72 1.22 2.72 2.72S9.5 8.92 8 8.92Zm0-4.64a1.92 1.92 0 1 0 .001 3.841A1.92 1.92 0 0 0 8 4.28Zm4.97-1.84L8.56.78C8.2.65 7.81.65 7.45.78L3.03 2.43C2.41 2.66 2 3.26 2 3.92V8c0 3.82 4.23 6.47 5.52 7.2.15.08.31.13.48.13s.33-.04.48-.13C9.78 14.48 14 11.82 14 8V3.92c0-.66-.41-1.25-1.03-1.48ZM8.08 14.5c-.05.03-.12.03-.17 0-.49-.28-2.12-1.24-3.4-2.68.62-.82 1.94-1.39 3.47-1.39s2.84.61 3.49 1.4c-1.29 1.43-2.9 2.39-3.39 2.67ZM13.19 8c0 1.2-.51 2.28-1.22 3.22-.83-.91-2.34-1.59-4-1.59s-3.16.64-3.98 1.58c-.7-.93-1.2-2.01-1.2-3.2V3.93c0-.33.21-.62.51-.74l4.43-1.66c.09-.03.18-.05.27-.05s.19.02.27.05l4.42 1.66c.3.11.51.41.51.73V8Z" })),
152
155
  'users': () => (h("path", { fill: "currentColor", d: "M12,8.76h-.2a5.24,5.24,0,0,1-3.93,0H7.61a3.05,3.05,0,0,0-3.3,2.75v.69a1.28,1.28,0,0,0,1.38,1.14H14a1.27,1.27,0,0,0,1.37-1.14v-.69A3.07,3.07,0,0,0,12,8.75Zm-6.4-.32A2,2,0,0,0,4.31,8H2.48A1.69,1.69,0,0,0,.65,9.53v.76a.85.85,0,0,0,.91.76H3.45A3.58,3.58,0,0,1,5.61,8.44ZM9.81,2.66A2.65,2.65,0,1,1,7.16,5.31h0A2.65,2.65,0,0,1,9.81,2.66ZM3.31,4.18A1.51,1.51,0,1,1,1.8,5.69,1.51,1.51,0,0,1,3.31,4.18Z" })),
153
156
  'wallet': () => (h("path", { fill: "currentColor", d: "M13.88 5H3a.43.43 0 0 1-.46-.38.43.43 0 0 1 .46-.43h11a.43.43 0 0 0 .46-.38A1.28 1.28 0 0 0 13 2.67H2.5A1.7 1.7 0 0 0 .67 4.19v7.62a1.7 1.7 0 0 0 1.83 1.52h11.38a1.32 1.32 0 0 0 1.45-1.14V6.1A1.33 1.33 0 0 0 13.88 5Zm-1.21 5.29a1.1 1.1 0 1 1 1.1-1.1 1.1 1.1 0 0 1-1.1 1.05Z" })),
154
157
  };
@@ -15,9 +15,7 @@ export class MgInputTitle {
15
15
  }
16
16
  validateIdentifier(newValue) {
17
17
  if (typeof newValue !== 'string' || newValue.trim() === '') {
18
- // TODO: throw new Error on next major (5.0.0)
19
- // throw new Error('<mg-input-title> prop "identifier" is required.');
20
- console.error('<mg-input-title> prop "identifier" is required.');
18
+ throw new Error('<mg-input-title> prop "identifier" is required.');
21
19
  }
22
20
  }
23
21
  /*************
@@ -90,9 +90,7 @@ export class MgTooltip {
90
90
  }
91
91
  validateMessage(newValue) {
92
92
  if (typeof newValue !== 'string' || newValue.trim() === '') {
93
- // TODO: throw new Error on next major (5.0.0)
94
- // throw new Error('<mg-tooltip> prop "message" is required.');
95
- console.error('<mg-tooltip> prop "message" is required.');
93
+ throw new Error('<mg-tooltip> prop "message" is required.');
96
94
  }
97
95
  }
98
96
  handleDisplay(newValue) {
@@ -116,12 +114,12 @@ export class MgTooltip {
116
114
  componentDidLoad() {
117
115
  var _a;
118
116
  // Get tooltip element
119
- this.tooltip = this.element.querySelector(`#${this.identifier}`);
117
+ this.tooltip = this.element.shadowRoot.querySelector(`#${this.identifier}`);
120
118
  // get slotted element
121
119
  const slotElement = this.element.firstElementChild;
122
120
  // Get interactive element
123
121
  const interactiveElements = ['a', 'button', 'input', 'textarea', 'select']; //! Might needs updates
124
- const interactiveElement = this.element.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
122
+ const interactiveElement = this.element.shadowRoot.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
125
123
  // define selected element to become tooltip selector
126
124
  const tooltipedElement = interactiveElement || slotElement;
127
125
  // Add tabindex to slotted element if we can't find any interactive element
@@ -186,7 +184,7 @@ export class MgTooltip {
186
184
  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 }))));
187
185
  }
188
186
  static get is() { return "mg-tooltip"; }
189
- static get encapsulation() { return "scoped"; }
187
+ static get encapsulation() { return "shadow"; }
190
188
  static get originalStyleUrls() {
191
189
  return {
192
190
  "$": ["mg-tooltip.scss"]
@@ -50,9 +50,7 @@ export const MgInput = (props, children, utils) => {
50
50
  * Check required properties
51
51
  */
52
52
  if (typeof props.identifier !== 'string' || props.identifier.trim() === '') {
53
- // TODO: throw new Error on next major (5.0.0)
54
- // throw new Error('<mg-input> prop "identifier" is required.');
55
- console.error('<mg-input> prop "identifier" is required.');
53
+ throw new Error('<mg-input> prop "identifier" is required.');
56
54
  }
57
55
  if (typeof props.label !== 'string' || props.label.trim() === '') {
58
56
  throw new Error('<mg-input> prop "label" is required.');
@@ -120,9 +120,8 @@ export class MgForm {
120
120
  */
121
121
  componentDidLoad() {
122
122
  this.mgButtons.forEach(mgButton => {
123
- // submit buttons should trigger form submition
124
- const button = mgButton.querySelector('button');
125
- if (['submit', null].includes(button.getAttribute('type'))) {
123
+ // submit buttons should trigger form submition;
124
+ if (['submit', null].includes(mgButton.getAttribute('type'))) {
126
125
  mgButton.addEventListener('click', () => {
127
126
  this.form.dispatchEvent(new CustomEvent('submit', { bubbles: true }));
128
127
  });
@@ -10,9 +10,10 @@ export default {
10
10
  */
11
11
  const Template = args => {
12
12
  // return element
13
- return (h("mg-illustrated-message", Object.assign({}, filterArgs(args, { size: 'regular' })), h("svg", { slot: "illustration", width: "190", height: "350", viewBox: "0 0 190 350", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M0 0H15C23.2843 0 30 6.71573 30 15V290H40V15C40 6.71573 46.7157 0 55 0C63.2843 0 70 6.71573 70 15V275C70 277.761 67.7615 280 65 280H60V40H50V340H60V290H65C67.7615 290 70 292.239 70 295V340H80V295C80 291.158 78.5558 287.654 76.1805 285C78.5558 282.346 80 278.842 80 275V0H95C103.284 0 110 6.71573 110 15V25C110 28.8418 108.556 32.3462 106.181 35C108.556 37.6538 110 41.1582 110 45V305C110 307.761 107.761 310 105 310H100V45C100 42.2386 97.7615 40 95 40H90V325C90 333.284 96.7157 340 105 340H120V330H105C102.239 330 100 327.761 100 325V320H105C113.284 320 120 313.284 120 305V15C120 6.71573 126.716 0 135 0C143.284 0 150 6.71573 150 15V330H140V15C140 12.2386 137.761 10 135 10C132.239 10 130 12.2386 130 15V340H165C173.284 340 180 333.284 180 325V15C180 12.2386 177.761 10 175 10H170V325C170 327.761 167.761 330 165 330H160V0H175C183.284 0 190 6.71573 190 15V350H0V0ZM10 325C10 333.284 16.7157 340 25 340C33.2843 340 40 333.284 40 325V300H30V325C30 327.761 27.7615 330 25 330C22.2385 330 20 327.761 20 325V15C20 12.2386 17.7615 10 15 10H10V325ZM60 15V30H50V15C50 12.2386 52.2385 10 55 10C57.7615 10 60 12.2386 60 15ZM95 30H90V10H95C97.7615 10 100 12.2386 100 15V25C100 27.7614 97.7615 30 95 30Z", fill: "black" })), h("h2", { slot: "title" }, "Lorem Ipsum"), h("h3", { slot: "details" }, "The standard Lorem Ipsum passage, used since the 1500s"), h("div", { slot: "details" }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")));
13
+ return (h("mg-illustrated-message", Object.assign({}, filterArgs(args, { size: 'regular', direction: 'vertical' })), h("svg", { slot: "illustration", width: "190", height: "350", viewBox: "0 0 190 350", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M0 0H15C23.2843 0 30 6.71573 30 15V290H40V15C40 6.71573 46.7157 0 55 0C63.2843 0 70 6.71573 70 15V275C70 277.761 67.7615 280 65 280H60V40H50V340H60V290H65C67.7615 290 70 292.239 70 295V340H80V295C80 291.158 78.5558 287.654 76.1805 285C78.5558 282.346 80 278.842 80 275V0H95C103.284 0 110 6.71573 110 15V25C110 28.8418 108.556 32.3462 106.181 35C108.556 37.6538 110 41.1582 110 45V305C110 307.761 107.761 310 105 310H100V45C100 42.2386 97.7615 40 95 40H90V325C90 333.284 96.7157 340 105 340H120V330H105C102.239 330 100 327.761 100 325V320H105C113.284 320 120 313.284 120 305V15C120 6.71573 126.716 0 135 0C143.284 0 150 6.71573 150 15V330H140V15C140 12.2386 137.761 10 135 10C132.239 10 130 12.2386 130 15V340H165C173.284 340 180 333.284 180 325V15C180 12.2386 177.761 10 175 10H170V325C170 327.761 167.761 330 165 330H160V0H175C183.284 0 190 6.71573 190 15V350H0V0ZM10 325C10 333.284 16.7157 340 25 340C33.2843 340 40 333.284 40 325V300H30V325C30 327.761 27.7615 330 25 330C22.2385 330 20 327.761 20 325V15C20 12.2386 17.7615 10 15 10H10V325ZM60 15V30H50V15C50 12.2386 52.2385 10 55 10C57.7615 10 60 12.2386 60 15ZM95 30H90V10H95C97.7615 10 100 12.2386 100 15V25C100 27.7614 97.7615 30 95 30Z", fill: "black" })), h("h2", { slot: "title" }, "Lorem Ipsum"), h("h3", { slot: "details" }, "The standard Lorem Ipsum passage, used since the 1500s"), h("div", { slot: "details" }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")));
14
14
  };
15
15
  export const MgIllustratedMessage = Template.bind({});
16
16
  MgIllustratedMessage.args = {
17
17
  size: 'regular',
18
+ direction: 'vertical',
18
19
  };