@oiz/stzh-components 2.8.0-alpha → 2.8.0-beta

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 (132) hide show
  1. package/dist/cjs/{app-globals-7c3a8979.js → app-globals-dff738b3.js} +2 -2
  2. package/dist/cjs/{app-globals-7c3a8979.js.map → app-globals-dff738b3.js.map} +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/stzh-badge_3.cjs.entry.js +6 -6
  5. package/dist/cjs/stzh-badge_3.cjs.entry.js.map +1 -1
  6. package/dist/cjs/stzh-chip_2.cjs.entry.js +2 -2
  7. package/dist/cjs/stzh-chip_2.cjs.entry.js.map +1 -1
  8. package/dist/cjs/stzh-components.cjs.js +1 -1
  9. package/dist/cjs/stzh-datalist_2.cjs.entry.js +1 -1
  10. package/dist/cjs/stzh-datalist_2.cjs.entry.js.map +1 -1
  11. package/dist/cjs/stzh-datepicker_3.cjs.entry.js.map +1 -1
  12. package/dist/cjs/stzh-dialog.cjs.entry.js +1 -1
  13. package/dist/cjs/stzh-dialog.cjs.entry.js.map +1 -1
  14. package/dist/cjs/stzh-link.cjs.entry.js +4 -4
  15. package/dist/cjs/stzh-link.cjs.entry.js.map +1 -1
  16. package/dist/cjs/stzh-menu_2.cjs.entry.js +2 -2
  17. package/dist/cjs/stzh-menu_2.cjs.entry.js.map +1 -1
  18. package/dist/cjs/stzh-overlay.cjs.entry.js +1 -1
  19. package/dist/cjs/stzh-overlay.cjs.entry.js.map +1 -1
  20. package/dist/collection/assets/i18n/de.json +1 -1
  21. package/dist/collection/assets/i18n/en.json +1 -1
  22. package/dist/collection/components/stzh-button/stzh-button.js +6 -6
  23. package/dist/collection/components/stzh-button/stzh-button.js.map +1 -1
  24. package/dist/collection/components/stzh-chip/stzh-chip.js +2 -2
  25. package/dist/collection/components/stzh-chip/stzh-chip.js.map +1 -1
  26. package/dist/collection/components/stzh-datalist-item/stzh-datalist-item.js +1 -1
  27. package/dist/collection/components/stzh-datalist-item/stzh-datalist-item.js.map +1 -1
  28. package/dist/collection/components/stzh-datepicker/stzh-datepicker.js.map +1 -1
  29. package/dist/collection/components/stzh-dialog/stzh-dialog.js +1 -1
  30. package/dist/collection/components/stzh-dialog/stzh-dialog.js.map +1 -1
  31. package/dist/collection/components/stzh-link/stzh-link.js +4 -4
  32. package/dist/collection/components/stzh-link/stzh-link.js.map +1 -1
  33. package/dist/collection/components/stzh-menu-item/stzh-menu-item.js +2 -2
  34. package/dist/collection/components/stzh-menu-item/stzh-menu-item.js.map +1 -1
  35. package/dist/collection/components/stzh-overlay/stzh-overlay.js +1 -1
  36. package/dist/collection/components/stzh-overlay/stzh-overlay.js.map +1 -1
  37. package/dist/components/index.js +1 -1
  38. package/dist/components/stzh-button2.js +6 -6
  39. package/dist/components/stzh-button2.js.map +1 -1
  40. package/dist/components/stzh-chip2.js +2 -2
  41. package/dist/components/stzh-chip2.js.map +1 -1
  42. package/dist/components/stzh-datalist-item2.js +1 -1
  43. package/dist/components/stzh-datalist-item2.js.map +1 -1
  44. package/dist/components/stzh-datepicker2.js.map +1 -1
  45. package/dist/components/stzh-dialog.js +1 -1
  46. package/dist/components/stzh-dialog.js.map +1 -1
  47. package/dist/components/stzh-link2.js +4 -4
  48. package/dist/components/stzh-link2.js.map +1 -1
  49. package/dist/components/stzh-menu-item2.js +2 -2
  50. package/dist/components/stzh-menu-item2.js.map +1 -1
  51. package/dist/components/stzh-overlay.js +1 -1
  52. package/dist/components/stzh-overlay.js.map +1 -1
  53. package/dist/esm/{app-globals-4f0f7957.js → app-globals-07e538f3.js} +2 -2
  54. package/dist/esm/{app-globals-4f0f7957.js.map → app-globals-07e538f3.js.map} +1 -1
  55. package/dist/esm/loader.js +1 -1
  56. package/dist/esm/stzh-badge_3.entry.js +6 -6
  57. package/dist/esm/stzh-badge_3.entry.js.map +1 -1
  58. package/dist/esm/stzh-chip_2.entry.js +2 -2
  59. package/dist/esm/stzh-chip_2.entry.js.map +1 -1
  60. package/dist/esm/stzh-components.js +1 -1
  61. package/dist/esm/stzh-datalist_2.entry.js +1 -1
  62. package/dist/esm/stzh-datalist_2.entry.js.map +1 -1
  63. package/dist/esm/stzh-datepicker_3.entry.js.map +1 -1
  64. package/dist/esm/stzh-dialog.entry.js +1 -1
  65. package/dist/esm/stzh-dialog.entry.js.map +1 -1
  66. package/dist/esm/stzh-link.entry.js +4 -4
  67. package/dist/esm/stzh-link.entry.js.map +1 -1
  68. package/dist/esm/stzh-menu_2.entry.js +2 -2
  69. package/dist/esm/stzh-menu_2.entry.js.map +1 -1
  70. package/dist/esm/stzh-overlay.entry.js +1 -1
  71. package/dist/esm/stzh-overlay.entry.js.map +1 -1
  72. package/dist/esm-es5/{app-globals-4f0f7957.js → app-globals-07e538f3.js} +2 -2
  73. package/dist/esm-es5/{app-globals-4f0f7957.js.map → app-globals-07e538f3.js.map} +1 -1
  74. package/dist/esm-es5/loader.js +1 -1
  75. package/dist/esm-es5/stzh-badge_3.entry.js +1 -1
  76. package/dist/esm-es5/stzh-badge_3.entry.js.map +1 -1
  77. package/dist/esm-es5/stzh-chip_2.entry.js +1 -1
  78. package/dist/esm-es5/stzh-chip_2.entry.js.map +1 -1
  79. package/dist/esm-es5/stzh-components.js +1 -1
  80. package/dist/esm-es5/stzh-datalist_2.entry.js +1 -1
  81. package/dist/esm-es5/stzh-datalist_2.entry.js.map +1 -1
  82. package/dist/esm-es5/stzh-datepicker_3.entry.js.map +1 -1
  83. package/dist/esm-es5/stzh-dialog.entry.js +1 -1
  84. package/dist/esm-es5/stzh-dialog.entry.js.map +1 -1
  85. package/dist/esm-es5/stzh-link.entry.js +1 -1
  86. package/dist/esm-es5/stzh-link.entry.js.map +1 -1
  87. package/dist/esm-es5/stzh-menu_2.entry.js +1 -1
  88. package/dist/esm-es5/stzh-menu_2.entry.js.map +1 -1
  89. package/dist/esm-es5/stzh-overlay.entry.js +1 -1
  90. package/dist/esm-es5/stzh-overlay.entry.js.map +1 -1
  91. package/dist/stzh-components/assets/i18n/de.json +1 -1
  92. package/dist/stzh-components/assets/i18n/en.json +1 -1
  93. package/dist/stzh-components/{p-a16ce152.system.entry.js → p-0b5fbb86.system.entry.js} +2 -2
  94. package/dist/stzh-components/{p-a16ce152.system.entry.js.map → p-0b5fbb86.system.entry.js.map} +1 -1
  95. package/dist/stzh-components/p-1fad78a6.entry.js +2 -0
  96. package/dist/stzh-components/{p-5c3d0895.entry.js.map → p-1fad78a6.entry.js.map} +1 -1
  97. package/dist/stzh-components/{p-26680e97.js → p-26ec7788.js} +2 -2
  98. package/dist/stzh-components/{p-26680e97.js.map → p-26ec7788.js.map} +1 -1
  99. package/dist/stzh-components/{p-d531fbaf.system.entry.js → p-2d777867.system.entry.js} +2 -2
  100. package/dist/stzh-components/{p-d531fbaf.system.entry.js.map → p-2d777867.system.entry.js.map} +1 -1
  101. package/dist/stzh-components/{p-76c2f21a.entry.js → p-432d3ec4.entry.js} +2 -2
  102. package/dist/stzh-components/{p-76c2f21a.entry.js.map → p-432d3ec4.entry.js.map} +1 -1
  103. package/dist/stzh-components/p-4bcc414d.system.entry.js.map +1 -1
  104. package/dist/stzh-components/{p-6c0f3c5e.entry.js → p-4c4a05b3.entry.js} +2 -2
  105. package/dist/stzh-components/{p-6c0f3c5e.entry.js.map → p-4c4a05b3.entry.js.map} +1 -1
  106. package/dist/stzh-components/{p-08050ce2.system.entry.js → p-62ca262c.system.entry.js} +2 -2
  107. package/dist/stzh-components/{p-08050ce2.system.entry.js.map → p-62ca262c.system.entry.js.map} +1 -1
  108. package/dist/stzh-components/{p-6cb99167.system.entry.js → p-62e0ad8d.system.entry.js} +2 -2
  109. package/dist/stzh-components/{p-6cb99167.system.entry.js.map → p-62e0ad8d.system.entry.js.map} +1 -1
  110. package/dist/stzh-components/{p-f5c99792.system.entry.js → p-8547ae9e.system.entry.js} +2 -2
  111. package/dist/stzh-components/{p-f5c99792.system.entry.js.map → p-8547ae9e.system.entry.js.map} +1 -1
  112. package/dist/stzh-components/{p-2009a8df.system.entry.js → p-88440469.system.entry.js} +2 -2
  113. package/dist/stzh-components/{p-2009a8df.system.entry.js.map → p-88440469.system.entry.js.map} +1 -1
  114. package/dist/stzh-components/{p-0f71e85f.entry.js → p-8a44987c.entry.js} +2 -2
  115. package/dist/stzh-components/{p-0f71e85f.entry.js.map → p-8a44987c.entry.js.map} +1 -1
  116. package/dist/stzh-components/{p-78f89f65.entry.js → p-8eaac610.entry.js} +2 -2
  117. package/dist/stzh-components/{p-78f89f65.entry.js.map → p-8eaac610.entry.js.map} +1 -1
  118. package/dist/stzh-components/{p-3184a123.system.entry.js → p-8f6c5346.system.entry.js} +2 -2
  119. package/dist/stzh-components/{p-3184a123.system.entry.js.map → p-8f6c5346.system.entry.js.map} +1 -1
  120. package/dist/stzh-components/{p-a8c1b679.system.js → p-9b4e4b9d.system.js} +2 -2
  121. package/dist/stzh-components/{p-a8c1b679.system.js.map → p-9b4e4b9d.system.js.map} +1 -1
  122. package/dist/stzh-components/{p-70d7389a.entry.js → p-9f2332f6.entry.js} +2 -2
  123. package/dist/stzh-components/{p-70d7389a.entry.js.map → p-9f2332f6.entry.js.map} +1 -1
  124. package/dist/stzh-components/{p-bac7cf37.entry.js → p-b61c752e.entry.js} +2 -2
  125. package/dist/stzh-components/{p-bac7cf37.entry.js.map → p-b61c752e.entry.js.map} +1 -1
  126. package/dist/stzh-components/{p-c1814eec.system.js → p-f02d484d.system.js} +2 -2
  127. package/dist/stzh-components/p-fdb1fd0a.entry.js.map +1 -1
  128. package/dist/stzh-components/stzh-components.esm.js +1 -1
  129. package/dist/stzh-components/stzh-components.js +1 -1
  130. package/package.json +1 -1
  131. package/dist/stzh-components/p-5c3d0895.entry.js +0 -2
  132. /package/dist/stzh-components/{p-c1814eec.system.js.map → p-f02d484d.system.js.map} +0 -0
@@ -1 +1 @@
1
- {"file":"stzh-dialog.entry.cjs.js","mappings":";;;;;;;;;;AAAA,MAAM,aAAa,GAAG,8wIAA8wI;;ACyB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,GAAO,EACzCA,iBAAK,KAAK,EAAC,sBAAsB,IAC/BA,iBACE,KAAK,EAAC,qBAAqB,EAC3B,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,aAAa,GAAG,EAAoB,CAAC,EACxD,QAAQ,EAAC,IAAI,EACb,IAAI,EAAE,IAAI,CAAC,QAAQ,gBACP,IAAI,CAAC,SAAS,qBACT,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,iBAC9C,IAAI,CAAC,IAAI,GAAG,OAAO,GAAG,MAAM,EACzC,OAAO,EAAE,IAAI,CAAC,iBAAiB,IAE9B,IAAI,CAAC,OAAO;MACXA,0BACE,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,UAAU,EACxB,KAAK,EAAC,sBAAsB,EAC5B,KAAK,EAAC,GAAG,yBAGR,IAAI,CAAC,OAAO,CACA,EAGjBA,iBAAK,KAAK,EAAC,6BAA6B,IACtCA,qBAAa,CACT,EAENA,iBAAK,KAAK,EAAC,sBAAsB,IAC/BA,kBAAM,IAAI,EAAC,SAAS,GAAQ,CACxB,EAEL,CAAC,IAAI,CAAC,SAAS;MACdA,oBACE,KAAK,EAAC,2BAA2B,EACjC,OAAO,EAAE,IAAI,CAAC,sBAAsB,gBACxB,IAAI,CAAC,YAAY,CAAC,KAAK,EACnC,IAAI,EAAC,QAAQ,iBACA,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,IAE7DA,uBAAW,KAAK,EAAC,yBAAyB,EAAC,IAAI,EAAC,OAAO,GAAa,CAC7D,CAEP,CACF,CACF,CACD,EACP;GACH;;;;;;;","names":["setPropsIfNull","fetchTranslations","createFocusTrap","createBaseFocusTrapOptions","h","Host"],"sources":["./src/components/stzh-dialog/stzh-dialog.scss?tag=stzh-dialog&encapsulation=scoped","./src/components/stzh-dialog/stzh-dialog.tsx"],"sourcesContent":[":host {\n --width: 100%;\n --padding: #{spaceCurveValue('large')};\n --close-color: #{$baseLeadColor};\n --backdrop-opacity: 0.8;\n\n @include mq($from: small) {\n --width: 536px;\n --padding: #{spaceCurveValue('large', 'small')};\n }\n\n @include mq($from: medium) {\n --width: 782px;\n --padding: #{spaceCurveValue('large', 'medium')};\n }\n\n @include mq($from: large) {\n --width: 832px;\n --padding: #{spaceCurveValue('large', 'large')};\n }\n\n &[size=\"small\"] {\n @include mq($from: small) {\n --width: 395px;\n }\n\n @include mq($from: medium) {\n --width: 460px;\n }\n\n @include mq($from: large) {\n --width: 512px;\n }\n }\n}\n\n.stzh-dialog {\n z-index: $zIndexDialog;\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: stretch;\n justify-content: stretch;\n\n &__content {\n z-index: 2;\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n flex-grow: 1;\n overflow: auto;\n }\n\n &__dialog {\n position: relative;\n display: flex;\n flex-direction: column;\n margin: auto;\n border: none;\n background-color: $colorWhite;\n width: var(--width);\n max-width: 100%;\n box-shadow: $boxShadowOverlay;\n height: 100vh;\n max-height: 100vh;\n // overflow: visible;\n overflow: hidden;\n outline: none;\n\n @include mq($from: small) {\n height: auto;\n }\n }\n\n &__backdrop {\n z-index: 1;\n\t\tposition: absolute;\n\t\ttop: 0px;\n\t\tleft: 0px;\n\t\twidth: 100%;\n height: 100%;\n\t\toverflow-x: hidden;\n\t\toverflow-y: auto;\n\t\ttext-align: center;\n background-color: $colorPrimary;\n opacity: var(--backdrop-opacity);\n }\n\n &__heading {\n padding: var(--padding);\n padding-bottom: 0;\n }\n\n &__dialog-content {\n padding: var(--padding);\n @include spaceCurve('padding-top', 'medium');\n @include spaceCurve('padding-bottom', 'medium');\n overflow: auto;\n flex-grow: 1;\n }\n\n &__actions {\n padding: var(--padding);\n padding-top: 0;\n }\n\n &__close-button {\n position: absolute;\n top: space('xsmall');\n right: space('xsmall');\n display: flex;\n appearance: none;\n font-family: inherit;\n border: none;\n background: none;\n padding: space('xsmall');\n margin: calc(#{space('xsmall')} * -1);\n border-radius: $buttonBorderRadius;\n cursor: pointer;\n\n @include mq($from: small) {\n top: space('small');\n right: space('small');\n }\n\n @include mq($from: medium) {\n top: space('large');\n right: space('large');\n }\n\n @include mq($from: large) {\n top: calc(#{space('xxlarge')} + #{space('xxsmall')});\n right: calc(#{space('xxlarge')} + #{space('xxsmall')});\n }\n }\n\n &__close-icon {\n --size: #{iconSize('medium')};\n color: var(--close-color);\n }\n\n &--is-open {\n display: flex;\n }\n}\n","import {\n Host,\n Component,\n Element,\n Method,\n Listen,\n Prop,\n Event,\n EventEmitter,\n h,\n} from \"@stencil/core\";\n\nimport {\n StzhDialogOpenEvent,\n StzhDialogCloseEvent\n} from \"../../index\";\n\nimport { setPropsIfNull } from \"../../utils/utils\";\nimport { fetchTranslations } from \"../../utils/translation-utils\";\nimport { createBaseFocusTrapOptions } from \"../../utils/overlay-utils\";\n\nimport { StzhDialogLocalizedText } from \"./stzh-dialog.localization\"\n\nimport { createFocusTrap, FocusTrap } from 'focus-trap';\n\nconst keyCode = {\n ESC: 27\n};\n\nconst CLASS_BODY_OPEN = \"stzh-dialog-open\";\n\nlet activeDialog: StzhDialog = null;\nlet dialogCounter = 0;\n\n/**\n * @slot - Slot for any content inside the dialog\n * @prop --width: Width of dialog\n */\n@Component({\n tag: \"stzh-dialog\",\n styleUrl: \"stzh-dialog.scss\",\n scoped: true\n})\nexport class StzhDialog {\n /** Translation strings */\n @Prop() localization: StzhDialogLocalizedText;\n\n /** Close dialog when pressing ESC */\n @Prop() closeOnEscapeKey: boolean = false;\n\n /** Close dialog when clicking outside of it */\n @Prop() closeOnBackdropClick: boolean = false;\n\n /** Open status */\n @Prop({ mutable: true }) open: boolean = false;\n\n /** Stay in original position (true) or move to body (false) */\n @Prop() stay: boolean = true;\n\n /** Size */\n @Prop({ reflect: true }) size: \"default\" | \"small\" = \"default\";\n\n /** Whether to hide close button */\n @Prop() hideClose: boolean = false;\n\n /** Heading text */\n @Prop() heading: string = \"\";\n\n /** Accessibility role */\n @Prop({ attribute: \"a11y-role\" }) a11yRole: \"dialog\" | \"alertdialog\" = \"alertdialog\";\n\n /** Accessible label for dialog (use if no heading is used) */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string = \"\";\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the close button element.\n * Default value will be taken from translations.\n */\n @Prop() closeAnalyticsId: string;\n\n /** Dialog open event */\n @Event() stzhOpen: EventEmitter<StzhDialogOpenEvent>;\n\n /** Dialog close event */\n @Event() stzhClose: EventEmitter<StzhDialogCloseEvent>;\n\n @Element() element: HTMLStzhDialogElement;\n\n @Listen(\"click\", { target: \"document\", capture: true })\n handleOutsideClick(event: MouseEvent) {\n if (!this.open || !this.closeOnBackdropClick) {\n return\n }\n\n const isClickOutside = event.target !== this.dialogElement\n && this.dialogElement.contains(event.target as HTMLElement) === false\n\n if (isClickOutside) {\n this.hide()\n }\n }\n\n @Listen(\"keydown\", { target: \"document\" })\n handleKeydown(event: KeyboardEvent) {\n if (\n event.keyCode === keyCode.ESC\n && activeDialog === this\n && this.closeOnEscapeKey\n ) {\n this.hide();\n }\n }\n\n @Listen(\"click\", { target: \"document\" })\n handleOpenTriggerClick(event: MouseEvent) {\n const target = event.target as HTMLElement;\n\n if (target.dataset.stzhDialogTrigger === this.element.id) {\n this.show();\n } else {\n const closest = target.closest(\"[data-stzh-dialog-trigger]\") as HTMLElement;\n\n if (closest && closest.dataset.stzhDialogTrigger === this.element.id) {\n this.show();\n }\n }\n }\n\n @Method()\n async show() {\n this.open = true;\n this.stzhOpen.emit({\n component: \"stzh-dialog\"\n });\n }\n\n @Method()\n async hide() {\n this.open = false;\n this.stzhClose.emit({\n component: \"stzh-dialog\"\n });\n }\n\n private observer: MutationObserver;\n private id: string;\n private trap: FocusTrap;\n private parentElement: HTMLElement;\n private dialogElement: HTMLDivElement;\n\n private handleDialogClick = (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n if (target.dataset.stzhDialogClose) {\n this.hide();\n } else {\n const closest = target.closest(\"[data-stzh-dialog-close]\");\n\n if (closest) {\n this.hide();\n }\n }\n }\n\n private handleCloseButtonClick = () => {\n this.hide();\n }\n\n private init = () => {\n const actions = this.element.querySelector('stzh-actions[slot=\"actions\"]');\n\n if (actions) {\n setPropsIfNull(actions, {\n variant: \"dialog\",\n withBorder: true\n } as HTMLStzhActionsElement)\n }\n }\n\n private getSiblings() {\n if (!this.parentElement) {\n return [];\n }\n\n return Array.from(this.parentElement.children).filter(\n (child) => child !== this.element\n );\n }\n\n private disableSiblings() {\n this.getSiblings().forEach((sibling) => {\n sibling.setAttribute(\"aria-hidden\", \"true\");\n });\n }\n\n private enableSiblings() {\n this.getSiblings().forEach((sibling) => {\n sibling.removeAttribute(\"aria-hidden\");\n });\n }\n\n private dialogShown() {\n activeDialog = this;\n document.body.classList.add(CLASS_BODY_OPEN);\n this.disableSiblings();\n\n if (this.trap) {\n this.trap.activate();\n }\n }\n\n private dialogHidden() {\n document.body.classList.remove(CLASS_BODY_OPEN);\n this.enableSiblings();\n\n if (this.trap) {\n this.trap.deactivate();\n }\n\n activeDialog = null;\n }\n\n async componentWillLoad() {\n this.id = `stzh-dialog-${dialogCounter}`;\n dialogCounter++;\n\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"dialog\");\n }\n }\n\n componentDidRender() {\n this.open ? this.dialogShown() : this.dialogHidden();\n }\n\n componentDidUpdate() {\n this.trap.updateContainerElements(this.element);\n }\n\n componentDidLoad() {\n this.trap = createFocusTrap(this.element, {\n fallbackFocus: this.dialogElement,\n ...createBaseFocusTrapOptions()\n });\n\n if (this.open) {\n this.dialogShown();\n }\n }\n\n connectedCallback() {\n if (!this.stay && this.element.parentElement !== document.body) {\n document.body.appendChild(this.element);\n }\n\n this.parentElement = this.element.parentElement;\n\n this.init();\n\n this.observer = new MutationObserver(this.init);\n this.observer.observe(this.element, {\n childList: true,\n subtree: true\n });\n }\n\n disconnectedCallback() {\n this.dialogHidden();\n\n if (this.observer) {\n this.observer.disconnect();\n }\n }\n\n render() {\n return (\n <Host>\n <div\n class={{\n \"stzh-dialog\": true,\n \"stzh-dialog--is-open\": this.open,\n \"stzh-dialog--has-heading\": !!this.heading,\n \"stzh-dialog--has-close-hidden\": this.hideClose,\n [`stzh-dialog--size-${this.size}`]: !!this.size,\n }}\n >\n <div class=\"stzh-dialog__backdrop\"></div>\n <div class=\"stzh-dialog__content\">\n <div\n class=\"stzh-dialog__dialog\"\n ref={(el) => (this.dialogElement = el as HTMLDivElement)}\n tabindex=\"-1\"\n role={this.a11yRole}\n aria-label={this.a11yLabel}\n aria-labelledby={this.heading ? `${this.id}-heading` : null}\n aria-hidden={this.open ? \"false\" : \"true\"}\n onClick={this.handleDialogClick}\n >\n {this.heading &&\n <stzh-heading\n id={`${this.id}-heading`}\n class=\"stzh-dialog__heading\"\n level=\"2\"\n with-border\n >\n {this.heading}\n </stzh-heading>\n }\n\n <div class=\"stzh-dialog__dialog-content\">\n <slot></slot>\n </div>\n\n <div class=\"stzh-dialog__actions\">\n <slot name=\"actions\"></slot>\n </div>\n\n {!this.hideClose &&\n <button\n class=\"stzh-dialog__close-button\"\n onClick={this.handleCloseButtonClick}\n aria-label={this.localization.close}\n type=\"button\"\n s-object-id={this.closeAnalyticsId || this.localization.close}\n >\n <stzh-icon class=\"stzh-dialog__close-icon\" name=\"close\"></stzh-icon>\n </button>\n }\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n\n"],"version":3}
1
+ {"file":"stzh-dialog.entry.cjs.js","mappings":";;;;;;;;;;AAAA,MAAM,aAAa,GAAG,8wIAA8wI;;ACyBpyI,MAAM,OAAO,GAAG;EACd,GAAG,EAAE,EAAE;CACR,CAAC;AAEF,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAE3C,IAAI,YAAY,GAAe,IAAI,CAAC;AACpC,IAAI,aAAa,GAAG,CAAC,CAAC;MAWT,UAAU;;;;;IA4Gb,sBA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I,CAAC,QAAQ,gBACP,IAAI,CAAC,SAAS,IAAI,IAAI,qBACjB,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,iBAC9C,IAAI,CAAC,IAAI,GAAG,OAAO,GAAG,MAAM,EACzC,OAAO,EAAE,IAAI,CAAC,iBAAiB,IAE9B,IAAI,CAAC,OAAO;MACXA,0BACE,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,UAAU,EACxB,KAAK,EAAC,sBAAsB,EAC5B,KAAK,EAAC,GAAG,yBAGR,IAAI,CAAC,OAAO,CACA,EAGjBA,iBAAK,KAAK,EAAC,6BAA6B,IACtCA,qBAAa,CACT,EAENA,iBAAK,KAAK,EAAC,sBAAsB,IAC/BA,kBAAM,IAAI,EAAC,SAAS,GAAQ,CACxB,EAEL,CAAC,IAAI,CAAC,SAAS;MACdA,oBACE,KAAK,EAAC,2BAA2B,EACjC,OAAO,EAAE,IAAI,CAAC,sBAAsB,gBACxB,IAAI,CAAC,YAAY,CAAC,KAAK,EACnC,IAAI,EAAC,QAAQ,iBACA,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,IAE7DA,uBAAW,KAAK,EAAC,yBAAyB,EAAC,IAAI,EAAC,OAAO,GAAa,CAC7D,CAEP,CACF,CACF,CACD,EACP;GACH;;;;;;;","names":["setPropsIfNull","fetchTranslations","createFocusTrap","createBaseFocusTrapOptions","h","Host"],"sources":["./src/components/stzh-dialog/stzh-dialog.scss?tag=stzh-dialog&encapsulation=scoped","./src/components/stzh-dialog/stzh-dialog.tsx"],"sourcesContent":[":host {\n --width: 100%;\n --padding: #{spaceCurveValue('large')};\n --close-color: #{$baseLeadColor};\n --backdrop-opacity: 0.8;\n\n @include mq($from: small) {\n --width: 536px;\n --padding: #{spaceCurveValue('large', 'small')};\n }\n\n @include mq($from: medium) {\n --width: 782px;\n --padding: #{spaceCurveValue('large', 'medium')};\n }\n\n @include mq($from: large) {\n --width: 832px;\n --padding: #{spaceCurveValue('large', 'large')};\n }\n\n &[size=\"small\"] {\n @include mq($from: small) {\n --width: 395px;\n }\n\n @include mq($from: medium) {\n --width: 460px;\n }\n\n @include mq($from: large) {\n --width: 512px;\n }\n }\n}\n\n.stzh-dialog {\n z-index: $zIndexDialog;\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: stretch;\n justify-content: stretch;\n\n &__content {\n z-index: 2;\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n flex-grow: 1;\n overflow: auto;\n }\n\n &__dialog {\n position: relative;\n display: flex;\n flex-direction: column;\n margin: auto;\n border: none;\n background-color: $colorWhite;\n width: var(--width);\n max-width: 100%;\n box-shadow: $boxShadowOverlay;\n height: 100vh;\n max-height: 100vh;\n // overflow: visible;\n overflow: hidden;\n outline: none;\n\n @include mq($from: small) {\n height: auto;\n }\n }\n\n &__backdrop {\n z-index: 1;\n\t\tposition: absolute;\n\t\ttop: 0px;\n\t\tleft: 0px;\n\t\twidth: 100%;\n height: 100%;\n\t\toverflow-x: hidden;\n\t\toverflow-y: auto;\n\t\ttext-align: center;\n background-color: $colorPrimary;\n opacity: var(--backdrop-opacity);\n }\n\n &__heading {\n padding: var(--padding);\n padding-bottom: 0;\n }\n\n &__dialog-content {\n padding: var(--padding);\n @include spaceCurve('padding-top', 'medium');\n @include spaceCurve('padding-bottom', 'medium');\n overflow: auto;\n flex-grow: 1;\n }\n\n &__actions {\n padding: var(--padding);\n padding-top: 0;\n }\n\n &__close-button {\n position: absolute;\n top: space('xsmall');\n right: space('xsmall');\n display: flex;\n appearance: none;\n font-family: inherit;\n border: none;\n background: none;\n padding: space('xsmall');\n margin: calc(#{space('xsmall')} * -1);\n border-radius: $buttonBorderRadius;\n cursor: pointer;\n\n @include mq($from: small) {\n top: space('small');\n right: space('small');\n }\n\n @include mq($from: medium) {\n top: space('large');\n right: space('large');\n }\n\n @include mq($from: large) {\n top: calc(#{space('xxlarge')} + #{space('xxsmall')});\n right: calc(#{space('xxlarge')} + #{space('xxsmall')});\n }\n }\n\n &__close-icon {\n --size: #{iconSize('medium')};\n color: var(--close-color);\n }\n\n &--is-open {\n display: flex;\n }\n}\n","import {\n Host,\n Component,\n Element,\n Method,\n Listen,\n Prop,\n Event,\n EventEmitter,\n h,\n} from \"@stencil/core\";\n\nimport {\n StzhDialogOpenEvent,\n StzhDialogCloseEvent\n} from \"../../index\";\n\nimport { setPropsIfNull } from \"../../utils/utils\";\nimport { fetchTranslations } from \"../../utils/translation-utils\";\nimport { createBaseFocusTrapOptions } from \"../../utils/overlay-utils\";\n\nimport { StzhDialogLocalizedText } from \"./stzh-dialog.localization\"\n\nimport { createFocusTrap, FocusTrap } from 'focus-trap';\n\nconst keyCode = {\n ESC: 27\n};\n\nconst CLASS_BODY_OPEN = \"stzh-dialog-open\";\n\nlet activeDialog: StzhDialog = null;\nlet dialogCounter = 0;\n\n/**\n * @slot - Slot for any content inside the dialog\n * @prop --width: Width of dialog\n */\n@Component({\n tag: \"stzh-dialog\",\n styleUrl: \"stzh-dialog.scss\",\n scoped: true\n})\nexport class StzhDialog {\n /** Translation strings */\n @Prop() localization: StzhDialogLocalizedText;\n\n /** Close dialog when pressing ESC */\n @Prop() closeOnEscapeKey: boolean = false;\n\n /** Close dialog when clicking outside of it */\n @Prop() closeOnBackdropClick: boolean = false;\n\n /** Open status */\n @Prop({ mutable: true }) open: boolean = false;\n\n /** Stay in original position (true) or move to body (false) */\n @Prop() stay: boolean = true;\n\n /** Size */\n @Prop({ reflect: true }) size: \"default\" | \"small\" = \"default\";\n\n /** Whether to hide close button */\n @Prop() hideClose: boolean = false;\n\n /** Heading text */\n @Prop() heading: string = \"\";\n\n /** Accessibility role */\n @Prop({ attribute: \"a11y-role\" }) a11yRole: \"dialog\" | \"alertdialog\" = \"alertdialog\";\n\n /** Accessible label for dialog (use if no heading is used) */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string = \"\";\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the close button element.\n * Default value will be taken from translations.\n */\n @Prop() closeAnalyticsId: string;\n\n /** Dialog open event */\n @Event() stzhOpen: EventEmitter<StzhDialogOpenEvent>;\n\n /** Dialog close event */\n @Event() stzhClose: EventEmitter<StzhDialogCloseEvent>;\n\n @Element() element: HTMLStzhDialogElement;\n\n @Listen(\"click\", { target: \"document\", capture: true })\n handleOutsideClick(event: MouseEvent) {\n if (!this.open || !this.closeOnBackdropClick) {\n return\n }\n\n const isClickOutside = event.target !== this.dialogElement\n && this.dialogElement.contains(event.target as HTMLElement) === false\n\n if (isClickOutside) {\n this.hide()\n }\n }\n\n @Listen(\"keydown\", { target: \"document\" })\n handleKeydown(event: KeyboardEvent) {\n if (\n event.keyCode === keyCode.ESC\n && activeDialog === this\n && this.closeOnEscapeKey\n ) {\n this.hide();\n }\n }\n\n @Listen(\"click\", { target: \"document\" })\n handleOpenTriggerClick(event: MouseEvent) {\n const target = event.target as HTMLElement;\n\n if (target.dataset.stzhDialogTrigger === this.element.id) {\n this.show();\n } else {\n const closest = target.closest(\"[data-stzh-dialog-trigger]\") as HTMLElement;\n\n if (closest && closest.dataset.stzhDialogTrigger === this.element.id) {\n this.show();\n }\n }\n }\n\n @Method()\n async show() {\n this.open = true;\n this.stzhOpen.emit({\n component: \"stzh-dialog\"\n });\n }\n\n @Method()\n async hide() {\n this.open = false;\n this.stzhClose.emit({\n component: \"stzh-dialog\"\n });\n }\n\n private observer: MutationObserver;\n private id: string;\n private trap: FocusTrap;\n private parentElement: HTMLElement;\n private dialogElement: HTMLDivElement;\n\n private handleDialogClick = (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n if (target.dataset.stzhDialogClose) {\n this.hide();\n } else {\n const closest = target.closest(\"[data-stzh-dialog-close]\");\n\n if (closest) {\n this.hide();\n }\n }\n }\n\n private handleCloseButtonClick = () => {\n this.hide();\n }\n\n private init = () => {\n const actions = this.element.querySelector('stzh-actions[slot=\"actions\"]');\n\n if (actions) {\n setPropsIfNull(actions, {\n variant: \"dialog\",\n withBorder: true\n } as HTMLStzhActionsElement)\n }\n }\n\n private getSiblings() {\n if (!this.parentElement) {\n return [];\n }\n\n return Array.from(this.parentElement.children).filter(\n (child) => child !== this.element\n );\n }\n\n private disableSiblings() {\n this.getSiblings().forEach((sibling) => {\n sibling.setAttribute(\"aria-hidden\", \"true\");\n });\n }\n\n private enableSiblings() {\n this.getSiblings().forEach((sibling) => {\n sibling.removeAttribute(\"aria-hidden\");\n });\n }\n\n private dialogShown() {\n activeDialog = this;\n document.body.classList.add(CLASS_BODY_OPEN);\n this.disableSiblings();\n\n if (this.trap) {\n this.trap.activate();\n }\n }\n\n private dialogHidden() {\n document.body.classList.remove(CLASS_BODY_OPEN);\n this.enableSiblings();\n\n if (this.trap) {\n this.trap.deactivate();\n }\n\n activeDialog = null;\n }\n\n async componentWillLoad() {\n this.id = `stzh-dialog-${dialogCounter}`;\n dialogCounter++;\n\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"dialog\");\n }\n }\n\n componentDidRender() {\n this.open ? this.dialogShown() : this.dialogHidden();\n }\n\n componentDidUpdate() {\n this.trap.updateContainerElements(this.element);\n }\n\n componentDidLoad() {\n this.trap = createFocusTrap(this.element, {\n fallbackFocus: this.dialogElement,\n ...createBaseFocusTrapOptions()\n });\n\n if (this.open) {\n this.dialogShown();\n }\n }\n\n connectedCallback() {\n if (!this.stay && this.element.parentElement !== document.body) {\n document.body.appendChild(this.element);\n }\n\n this.parentElement = this.element.parentElement;\n\n this.init();\n\n this.observer = new MutationObserver(this.init);\n this.observer.observe(this.element, {\n childList: true,\n subtree: true\n });\n }\n\n disconnectedCallback() {\n this.dialogHidden();\n\n if (this.observer) {\n this.observer.disconnect();\n }\n }\n\n render() {\n return (\n <Host>\n <div\n class={{\n \"stzh-dialog\": true,\n \"stzh-dialog--is-open\": this.open,\n \"stzh-dialog--has-heading\": !!this.heading,\n \"stzh-dialog--has-close-hidden\": this.hideClose,\n [`stzh-dialog--size-${this.size}`]: !!this.size,\n }}\n >\n <div class=\"stzh-dialog__backdrop\"></div>\n <div class=\"stzh-dialog__content\">\n <div\n class=\"stzh-dialog__dialog\"\n ref={(el) => (this.dialogElement = el as HTMLDivElement)}\n tabindex=\"-1\"\n role={this.a11yRole}\n aria-label={this.a11yLabel || null}\n aria-labelledby={this.heading ? `${this.id}-heading` : null}\n aria-hidden={this.open ? \"false\" : \"true\"}\n onClick={this.handleDialogClick}\n >\n {this.heading &&\n <stzh-heading\n id={`${this.id}-heading`}\n class=\"stzh-dialog__heading\"\n level=\"2\"\n with-border\n >\n {this.heading}\n </stzh-heading>\n }\n\n <div class=\"stzh-dialog__dialog-content\">\n <slot></slot>\n </div>\n\n <div class=\"stzh-dialog__actions\">\n <slot name=\"actions\"></slot>\n </div>\n\n {!this.hideClose &&\n <button\n class=\"stzh-dialog__close-button\"\n onClick={this.handleCloseButtonClick}\n aria-label={this.localization.close}\n type=\"button\"\n s-object-id={this.closeAnalyticsId || this.localization.close}\n >\n <stzh-icon class=\"stzh-dialog__close-icon\" name=\"close\"></stzh-icon>\n </button>\n }\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n\n"],"version":3}
@@ -118,13 +118,13 @@ const StzhLink = class {
118
118
  [`stzh-link--${this.variant}`]: !!this.variant,
119
119
  };
120
120
  return (index.h(index.Host, { tabindex: this.disabled ? null : "-1", onFocus: this.onRootFocus }, this.href ?
121
- index.h("a", { ref: (el) => (this.link = el), href: this.disabled ? null : this.href, download: this.download, rel: this.rel, target: this.target, class: classes, accessKey: this.linkAccesskey, tabindex: this.a11yTabindex, "aria-label": this.a11yLabel, "aria-describedby": this.a11yDescribedby, "aria-disabled": typeof this.a11yDisabled !== "undefined"
121
+ index.h("a", { ref: (el) => (this.link = el), href: this.disabled ? null : this.href, download: this.download, rel: this.rel, target: this.target, class: classes, accessKey: this.linkAccesskey, tabindex: this.a11yTabindex, "aria-label": this.a11yLabel || null, "aria-describedby": this.a11yDescribedby || null, "aria-disabled": typeof this.a11yDisabled !== "undefined"
122
122
  ? (this.a11yDisabled ? "true" : "false") : null, "aria-expanded": typeof this.a11yExpanded !== "undefined"
123
- ? (this.a11yExpanded ? "true" : "false") : null, "aria-controls": this.a11yControls, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner(iconUsed))
123
+ ? (this.a11yExpanded ? "true" : "false") : null, "aria-controls": this.a11yControls || null, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner(iconUsed))
124
124
  :
125
- index.h("button", { ref: (el) => (this.link = el), class: classes, type: this.type, disabled: this.disabled, accessKey: this.linkAccesskey, tabindex: this.a11yTabindex, "aria-label": this.a11yLabel, "aria-describedby": this.a11yDescribedby, "aria-disabled": typeof this.a11yDisabled !== "undefined"
125
+ index.h("button", { ref: (el) => (this.link = el), class: classes, type: this.type, disabled: this.disabled, accessKey: this.linkAccesskey, tabindex: this.a11yTabindex, "aria-label": this.a11yLabel || null, "aria-describedby": this.a11yDescribedby || null, "aria-disabled": typeof this.a11yDisabled !== "undefined"
126
126
  ? (this.a11yDisabled ? "true" : "false") : null, "aria-expanded": typeof this.a11yExpanded !== "undefined"
127
- ? (this.a11yExpanded ? "true" : "false") : null, "aria-controls": this.a11yControls, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner(iconUsed))));
127
+ ? (this.a11yExpanded ? "true" : "false") : null, "aria-controls": this.a11yControls || null, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner(iconUsed))));
128
128
  }
129
129
  get element() { return index.getElement(this); }
130
130
  };
@@ -1 +1 @@
1
- {"file":"stzh-link.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,6gLAA6gL;;MC6BphL,QAAQ;;;;;IAyGX,mBAAc,GAAY,KAAK,CAAC;IAEhC,gBAAW,GAAG;MACpB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;OACjB;MA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Y,KAAK,WAAW;eAClD,IAAI,CAAC,YAAY,GAAG,MAAM,GAAG,OAAO,IAAI,IAAI,mBAClC,IAAI,CAAC,YAAY,EAChC,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,IAElB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CACpB,CAEN,EACP;GACH;;;;;;;","names":["h","Fragment","fetchTranslations","hasSlot","Host"],"sources":["./src/components/stzh-link/stzh-link.scss?tag=stzh-link&encapsulation=scoped","./src/components/stzh-link/stzh-link.tsx"],"sourcesContent":[":host {\n --color: #{$linkColor};\n --text-decoration-line: underline;\n --icon-size: #{iconSize('medium')};\n --icon-wrapper-height: #{$linkIconWrapperHeight};\n\n --hover-color: #{$linkHoverColor};\n --hover-text-decoration-line: underline;\n\n color: var(--color);\n display: inline-block;\n\n ::slotted(stzh-text) {\n --color: initial;\n }\n\n &[fullwidth]:not([fullwidth=\"false\"]) {\n width: 100%;\n display: block;\n }\n\n &[size=\"small\"] {\n --icon-size: #{iconSize('small')};\n }\n\n &[variant=\"secondary\"] {\n --color: #{$baseColor};\n }\n\n &[active]:not([active=\"false\"]) {\n --color: var(--hover-color);\n }\n\n &[disabled]:not([disabled=\"false\"]) {\n --color: #{$colorGrey25};\n --hover-color: #{$colorGrey25};\n }\n}\n\n:host ::slotted(stzh-icon),\n.stzh-link__icon {\n --size: var(--icon-size);\n}\n\n.stzh-link {\n @include fontCurve('p1');\n font-family: inherit;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: stretch;\n appearance: none;\n border: none;\n color: var(--color);\n transition: color $baseTransitionAnimationSpeed;\n cursor: pointer;\n width: 100%;\n text-decoration-line: none;\n background-color: transparent;\n padding: 0;\n border-radius: $buttonBorderRadius;\n text-align: left;\n\n &:hover {\n color: var(--hover-color);\n }\n\n &:hover &__text {\n text-decoration-line: var(--hover-text-decoration-line);\n }\n\n &__vhidden {\n @include visuallyhidden;\n }\n\n &__inner {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n }\n\n &__icon-wrapper {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: auto;\n height: var(--icon-wrapper-height);\n }\n\n &__text {\n text-decoration-line: var(--text-decoration-line);\n }\n\n &__icon-wrapper:not(:empty) + &__text:not(:empty),\n &__text:not(:empty) + &__icon-wrapper:not(:empty) {\n margin-left: space('xxsmall');\n }\n\n &__badge {\n position: absolute;\n z-index: 1;\n top: 0;\n right: 0;\n }\n\n /* Variant if link only has icon */\n\n &--has-icon-only &__text {\n @include visuallyhidden;\n }\n\n /* Badge positioning variants */\n\n &--badge-position-link &__icon-wrapper {\n position: static;\n }\n\n &__badge,\n &--badge-position-link &__badge {\n top: calc(#{space('xxsmall')} * -1);\n right: calc(#{space('large')} * -1);\n }\n\n &--badge-position-icon#{&}--has-icon &__icon-wrapper {\n position: relative;\n }\n\n &--badge-position-icon#{&}--has-icon &__badge {\n top: calc(#{space('xsmall')} * -1);\n right: calc(#{space('small')} * -1);;\n }\n\n &--badge-position-icon#{&}--has-icon#{&}--has-badge &__icon-wrapper + &__text:not(:empty) {\n margin-left: space('small');\n }\n\n /* Size variants */\n\n &--size-small {\n @include fontSize('micro');\n }\n\n &--size-inherit {\n font-size: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n }\n\n /* Alignment variants */\n\n &--align-left &__inner {\n justify-content: flex-start;\n }\n\n &--align-right &__inner {\n justify-content: flex-end;\n }\n\n &--align-center &__inner {\n justify-content: center;\n }\n\n &--align-space-between &__inner {\n justify-content: space-between;\n }\n\n /* Disabled variant */\n\n &--is-disabled {\n cursor: not-allowed;\n }\n}\n","import {\n Component,\n Host,\n Fragment,\n Element,\n h,\n Prop,\n Method,\n Event,\n EventEmitter\n} from \"@stencil/core\";\n\nimport {\n StzhLinkFocusEvent,\n StzhLinkBlurEvent\n} from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\nimport { fetchTranslations, StzhLocaleComponent } from \"../../utils/translation-utils\";\n\n/**\n * @slot - Slot for text content\n * @slot icon - Slot for icon element\n */\n@Component({\n tag: \"stzh-link\",\n styleUrl: \"stzh-link.scss\",\n scoped: true\n})\nexport class StzhLink {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Icon (use instead of icon slot) */\n @Prop() icon: string = \"\";\n\n /** Icon Position */\n @Prop({ reflect: true }) iconPosition: \"left\" | \"right\" = \"left\";\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" | \"inherit\" = \"default\";\n\n /** href attribute of the link */\n @Prop() href: string = \"\";\n\n /** Rel (if href is used) */\n @Prop() rel: string;\n\n /** target if the button is used as link (if href used) */\n @Prop() target: string = \"\";\n\n /** Download attribute of link (if `href` used) */\n @Prop() download: string;\n\n /** type of the button, if used as button (if no href used) */\n @Prop() type: \"button\" | \"submit\" | \"reset\" = \"button\";\n\n /** Variant style */\n @Prop({ reflect: true }) variant: \"default\" | \"secondary\" = \"default\";\n\n /** Whether the link is full width */\n @Prop({ reflect: true }) fullwidth: boolean = false;\n\n /** Text alignment */\n @Prop({ reflect: true }) textAlign: \"left\" | \"center\" | \"right\" | \"space-between\" | \"default\" = \"default\";\n\n /** Badge text */\n @Prop() badge: string = \"\";\n\n /** Badge type */\n @Prop({ reflect: true }) badgeType: \"default\" | \"success\" | \"warning\" | \"error\" | \"info\" = \"default\";\n\n /** Whether badge should be displayed empty */\n @Prop({ reflect: true }) badgeEmpty: boolean = false;\n\n /** Badge position */\n @Prop({ reflect: true }) badgePosition: \"icon\" | \"link\" = \"icon\";\n\n /** Disabled status */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Active status */\n @Prop({ reflect: true }) active: boolean = false;\n\n /** Whether only an icon is used inside the link */\n @Prop({ reflect: true }) iconOnly: boolean = false;\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Access key of link (usually a number e.g. 1) */\n @Prop() linkAccesskey: string;\n\n /** Accessible label for screen readers to replace visible text */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string;\n\n /** Id for element which describes the button (this will be overwritten if description prop or slot is used, used by stzh-radiogroup) */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = \"\";\n\n /** Aria expanded of link/button */\n @Prop({ reflect: true, attribute: \"a11y-expanded\" }) a11yExpanded: boolean;\n\n /** Aria disabled of link/button */\n @Prop({ reflect: true, attribute: \"a11y-disabled\" }) a11yDisabled: boolean;\n\n /** Aria controls of link/button */\n @Prop({ attribute: \"a11y-controls\" }) a11yControls: string;\n\n /** Tabindex of link/button */\n @Prop({ attribute: \"a11y-tabindex\" }) a11yTabindex: string;\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the link/button element.\n * Default value will be taken from `label` prop or default slot.\n */\n @Prop() analyticsId: string;\n\n @Element() element: HTMLStzhLinkElement;\n\n /** Focus link */\n @Method()\n async setFocus() {\n this.link.focus();\n }\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhLinkFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhLinkBlurEvent>;\n\n private link: HTMLButtonElement | HTMLAnchorElement;\n private text: HTMLDivElement;\n private focusedByInput: boolean = false;\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent(\"focus\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-link\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent(\"blur\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-link\",\n originalEvent: event\n });\n }\n\n private renderIcon(): HTMLInputElement {\n return (\n <div class=\"stzh-link__icon-wrapper\">\n {this.icon ?\n <stzh-icon class=\"stzh-link__icon\" name={this.icon}></stzh-icon>\n :\n <slot name=\"icon\"></slot>\n }\n {(this.badge || this.badgeEmpty) &&\n <stzh-badge class=\"stzh-link__badge\" label={this.badge} type={this.badgeType}></stzh-badge>\n }\n </div>\n );\n }\n\n private renderContent(): HTMLDivElement {\n return (\n <div class=\"stzh-link__text\">\n {this.rel && this.rel.includes('external') && <div class=\"stzh-link__vhidden\">{this.localization.$globals.externalLinkLabel}</div>}\n {this.download && <div class=\"stzh-link__vhidden\">{this.localization.$globals.downloadLinkLabel}</div>}\n <div ref={(el) => (this.text = el as HTMLDivElement)}>{this.label ? this.label : <slot></slot>}</div>\n </div>\n );\n }\n\n private renderInner(iconUsed: boolean): DocumentFragment {\n return (\n <Fragment>\n <div class=\"stzh-link__inner\">\n {this.iconPosition === \"left\" && this.renderIcon()}\n {this.renderContent()}\n {this.iconPosition === \"right\" && this.renderIcon()}\n </div>\n {(this.badge || this.badgeEmpty) && !iconUsed &&\n <stzh-badge class=\"stzh-link__badge\" label={this.badge} type={this.badgeType}></stzh-badge>\n }\n </Fragment>\n );\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"link\");\n }\n }\n\n componentDidRender() {\n requestAnimationFrame(() => {\n this.link.setAttribute(\"s-object-id\", this.analyticsId || this.text.innerText);\n });\n }\n\n render() {\n const iconUsed = hasSlot(this.element, \"icon\") || !!this.icon;\n const classes = {\n \"stzh-link\": true,\n \"stzh-link--has-icon\": iconUsed,\n \"stzh-link--has-icon-only\": this.iconOnly,\n \"stzh-link--has-badge\": !!this.badge,\n \"stzh-link--is-fullwidth\": this.fullwidth,\n \"stzh-link--is-disabled\": this.disabled,\n \"stzh-link--is-active\": this.active,\n [`stzh-link--badge-position-${this.badgePosition}`]: !!this.badgePosition,\n [`stzh-link--align-${this.textAlign}`]: !!this.textAlign,\n [`stzh-link--size-${this.size}`]: !!this.size,\n [`stzh-link--${this.variant}`]: !!this.variant,\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n {this.href ?\n <a\n ref={(el) => (this.link = el as HTMLAnchorElement)}\n href={this.disabled ? null : this.href}\n download={this.download}\n rel={this.rel}\n target={this.target}\n class={classes}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner(iconUsed)}\n </a>\n :\n <button\n ref={(el) => (this.link = el as HTMLButtonElement)}\n class={classes}\n type={this.type}\n disabled={this.disabled}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner(iconUsed)}\n </button>\n }\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"stzh-link.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,6gLAA6gL;;MC6BphL,QAAQ;;;;;IAyGX,mBAAc,GAAY,KAAK,CAAC;IAEhC,gBAAW,GAAG;MACpB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;OACjB;MAED,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;KAC7B,CAAA;IAEO,YAAO,GAAG,CAAC,KAAiB;MA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IAAI,CAAC,YAAY,GAAG,MAAM,GAAG,OAAO,IAAI,IAAI,mBAClC,IAAI,CAAC,YAAY,IAAI,IAAI,EACxC,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,IAElB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CACpB,CAEN,EACP;GACH;;;;;;;","names":["h","Fragment","fetchTranslations","hasSlot","Host"],"sources":["./src/components/stzh-link/stzh-link.scss?tag=stzh-link&encapsulation=scoped","./src/components/stzh-link/stzh-link.tsx"],"sourcesContent":[":host {\n --color: #{$linkColor};\n --text-decoration-line: underline;\n --icon-size: #{iconSize('medium')};\n --icon-wrapper-height: #{$linkIconWrapperHeight};\n\n --hover-color: #{$linkHoverColor};\n --hover-text-decoration-line: underline;\n\n color: var(--color);\n display: inline-block;\n\n ::slotted(stzh-text) {\n --color: initial;\n }\n\n &[fullwidth]:not([fullwidth=\"false\"]) {\n width: 100%;\n display: block;\n }\n\n &[size=\"small\"] {\n --icon-size: #{iconSize('small')};\n }\n\n &[variant=\"secondary\"] {\n --color: #{$baseColor};\n }\n\n &[active]:not([active=\"false\"]) {\n --color: var(--hover-color);\n }\n\n &[disabled]:not([disabled=\"false\"]) {\n --color: #{$colorGrey25};\n --hover-color: #{$colorGrey25};\n }\n}\n\n:host ::slotted(stzh-icon),\n.stzh-link__icon {\n --size: var(--icon-size);\n}\n\n.stzh-link {\n @include fontCurve('p1');\n font-family: inherit;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: stretch;\n appearance: none;\n border: none;\n color: var(--color);\n transition: color $baseTransitionAnimationSpeed;\n cursor: pointer;\n width: 100%;\n text-decoration-line: none;\n background-color: transparent;\n padding: 0;\n border-radius: $buttonBorderRadius;\n text-align: left;\n\n &:hover {\n color: var(--hover-color);\n }\n\n &:hover &__text {\n text-decoration-line: var(--hover-text-decoration-line);\n }\n\n &__vhidden {\n @include visuallyhidden;\n }\n\n &__inner {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n }\n\n &__icon-wrapper {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: auto;\n height: var(--icon-wrapper-height);\n }\n\n &__text {\n text-decoration-line: var(--text-decoration-line);\n }\n\n &__icon-wrapper:not(:empty) + &__text:not(:empty),\n &__text:not(:empty) + &__icon-wrapper:not(:empty) {\n margin-left: space('xxsmall');\n }\n\n &__badge {\n position: absolute;\n z-index: 1;\n top: 0;\n right: 0;\n }\n\n /* Variant if link only has icon */\n\n &--has-icon-only &__text {\n @include visuallyhidden;\n }\n\n /* Badge positioning variants */\n\n &--badge-position-link &__icon-wrapper {\n position: static;\n }\n\n &__badge,\n &--badge-position-link &__badge {\n top: calc(#{space('xxsmall')} * -1);\n right: calc(#{space('large')} * -1);\n }\n\n &--badge-position-icon#{&}--has-icon &__icon-wrapper {\n position: relative;\n }\n\n &--badge-position-icon#{&}--has-icon &__badge {\n top: calc(#{space('xsmall')} * -1);\n right: calc(#{space('small')} * -1);;\n }\n\n &--badge-position-icon#{&}--has-icon#{&}--has-badge &__icon-wrapper + &__text:not(:empty) {\n margin-left: space('small');\n }\n\n /* Size variants */\n\n &--size-small {\n @include fontSize('micro');\n }\n\n &--size-inherit {\n font-size: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n }\n\n /* Alignment variants */\n\n &--align-left &__inner {\n justify-content: flex-start;\n }\n\n &--align-right &__inner {\n justify-content: flex-end;\n }\n\n &--align-center &__inner {\n justify-content: center;\n }\n\n &--align-space-between &__inner {\n justify-content: space-between;\n }\n\n /* Disabled variant */\n\n &--is-disabled {\n cursor: not-allowed;\n }\n}\n","import {\n Component,\n Host,\n Fragment,\n Element,\n h,\n Prop,\n Method,\n Event,\n EventEmitter\n} from \"@stencil/core\";\n\nimport {\n StzhLinkFocusEvent,\n StzhLinkBlurEvent\n} from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\nimport { fetchTranslations, StzhLocaleComponent } from \"../../utils/translation-utils\";\n\n/**\n * @slot - Slot for text content\n * @slot icon - Slot for icon element\n */\n@Component({\n tag: \"stzh-link\",\n styleUrl: \"stzh-link.scss\",\n scoped: true\n})\nexport class StzhLink {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Icon (use instead of icon slot) */\n @Prop() icon: string = \"\";\n\n /** Icon Position */\n @Prop({ reflect: true }) iconPosition: \"left\" | \"right\" = \"left\";\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" | \"inherit\" = \"default\";\n\n /** href attribute of the link */\n @Prop() href: string = \"\";\n\n /** Rel (if href is used) */\n @Prop() rel: string;\n\n /** target if the button is used as link (if href used) */\n @Prop() target: string = \"\";\n\n /** Download attribute of link (if `href` used) */\n @Prop() download: string;\n\n /** type of the button, if used as button (if no href used) */\n @Prop() type: \"button\" | \"submit\" | \"reset\" = \"button\";\n\n /** Variant style */\n @Prop({ reflect: true }) variant: \"default\" | \"secondary\" = \"default\";\n\n /** Whether the link is full width */\n @Prop({ reflect: true }) fullwidth: boolean = false;\n\n /** Text alignment */\n @Prop({ reflect: true }) textAlign: \"left\" | \"center\" | \"right\" | \"space-between\" | \"default\" = \"default\";\n\n /** Badge text */\n @Prop() badge: string = \"\";\n\n /** Badge type */\n @Prop({ reflect: true }) badgeType: \"default\" | \"success\" | \"warning\" | \"error\" | \"info\" = \"default\";\n\n /** Whether badge should be displayed empty */\n @Prop({ reflect: true }) badgeEmpty: boolean = false;\n\n /** Badge position */\n @Prop({ reflect: true }) badgePosition: \"icon\" | \"link\" = \"icon\";\n\n /** Disabled status */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Active status */\n @Prop({ reflect: true }) active: boolean = false;\n\n /** Whether only an icon is used inside the link */\n @Prop({ reflect: true }) iconOnly: boolean = false;\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Access key of link (usually a number e.g. 1) */\n @Prop() linkAccesskey: string;\n\n /** Accessible label for screen readers to replace visible text */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string;\n\n /** Id for element which describes the button (this will be overwritten if description prop or slot is used, used by stzh-radiogroup) */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = \"\";\n\n /** Aria expanded of link/button */\n @Prop({ reflect: true, attribute: \"a11y-expanded\" }) a11yExpanded: boolean;\n\n /** Aria disabled of link/button */\n @Prop({ reflect: true, attribute: \"a11y-disabled\" }) a11yDisabled: boolean;\n\n /** Aria controls of link/button */\n @Prop({ attribute: \"a11y-controls\" }) a11yControls: string;\n\n /** Tabindex of link/button */\n @Prop({ attribute: \"a11y-tabindex\" }) a11yTabindex: string;\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the link/button element.\n * Default value will be taken from `label` prop or default slot.\n */\n @Prop() analyticsId: string;\n\n @Element() element: HTMLStzhLinkElement;\n\n /** Focus link */\n @Method()\n async setFocus() {\n this.link.focus();\n }\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhLinkFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhLinkBlurEvent>;\n\n private link: HTMLButtonElement | HTMLAnchorElement;\n private text: HTMLDivElement;\n private focusedByInput: boolean = false;\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent(\"focus\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-link\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent(\"blur\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-link\",\n originalEvent: event\n });\n }\n\n private renderIcon(): HTMLInputElement {\n return (\n <div class=\"stzh-link__icon-wrapper\">\n {this.icon ?\n <stzh-icon class=\"stzh-link__icon\" name={this.icon}></stzh-icon>\n :\n <slot name=\"icon\"></slot>\n }\n {(this.badge || this.badgeEmpty) &&\n <stzh-badge class=\"stzh-link__badge\" label={this.badge} type={this.badgeType}></stzh-badge>\n }\n </div>\n );\n }\n\n private renderContent(): HTMLDivElement {\n return (\n <div class=\"stzh-link__text\">\n {this.rel && this.rel.includes('external') && <div class=\"stzh-link__vhidden\">{this.localization.$globals.externalLinkLabel}</div>}\n {this.download && <div class=\"stzh-link__vhidden\">{this.localization.$globals.downloadLinkLabel}</div>}\n <div ref={(el) => (this.text = el as HTMLDivElement)}>{this.label ? this.label : <slot></slot>}</div>\n </div>\n );\n }\n\n private renderInner(iconUsed: boolean): DocumentFragment {\n return (\n <Fragment>\n <div class=\"stzh-link__inner\">\n {this.iconPosition === \"left\" && this.renderIcon()}\n {this.renderContent()}\n {this.iconPosition === \"right\" && this.renderIcon()}\n </div>\n {(this.badge || this.badgeEmpty) && !iconUsed &&\n <stzh-badge class=\"stzh-link__badge\" label={this.badge} type={this.badgeType}></stzh-badge>\n }\n </Fragment>\n );\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"link\");\n }\n }\n\n componentDidRender() {\n requestAnimationFrame(() => {\n this.link.setAttribute(\"s-object-id\", this.analyticsId || this.text.innerText);\n });\n }\n\n render() {\n const iconUsed = hasSlot(this.element, \"icon\") || !!this.icon;\n const classes = {\n \"stzh-link\": true,\n \"stzh-link--has-icon\": iconUsed,\n \"stzh-link--has-icon-only\": this.iconOnly,\n \"stzh-link--has-badge\": !!this.badge,\n \"stzh-link--is-fullwidth\": this.fullwidth,\n \"stzh-link--is-disabled\": this.disabled,\n \"stzh-link--is-active\": this.active,\n [`stzh-link--badge-position-${this.badgePosition}`]: !!this.badgePosition,\n [`stzh-link--align-${this.textAlign}`]: !!this.textAlign,\n [`stzh-link--size-${this.size}`]: !!this.size,\n [`stzh-link--${this.variant}`]: !!this.variant,\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n {this.href ?\n <a\n ref={(el) => (this.link = el as HTMLAnchorElement)}\n href={this.disabled ? null : this.href}\n download={this.download}\n rel={this.rel}\n target={this.target}\n class={classes}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n aria-label={this.a11yLabel || null}\n aria-describedby={this.a11yDescribedby || null}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls || null}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner(iconUsed)}\n </a>\n :\n <button\n ref={(el) => (this.link = el as HTMLButtonElement)}\n class={classes}\n type={this.type}\n disabled={this.disabled}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n aria-label={this.a11yLabel || null}\n aria-describedby={this.a11yDescribedby || null}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls || null}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner(iconUsed)}\n </button>\n }\n </Host>\n );\n }\n}\n"],"version":3}
@@ -95,9 +95,9 @@ const StzhMenuItem = class {
95
95
  "stzh-menu-item--is-active": this.active
96
96
  };
97
97
  return (index.h(index.Host, { role: "menuitem", tabindex: this.disabled ? null : "-1", onFocus: this.onRootFocus }, this.href ?
98
- index.h("a", { ref: (el) => (this.menuItem = el), href: this.disabled ? null : this.href, target: this.target, class: classes, "aria-label": this.a11yLabel, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner(iconUsed))
98
+ index.h("a", { ref: (el) => (this.menuItem = el), href: this.disabled ? null : this.href, target: this.target, class: classes, "aria-label": this.a11yLabel || null, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner(iconUsed))
99
99
  :
100
- index.h("button", { ref: (el) => (this.menuItem = el), class: classes, type: "button", disabled: this.disabled, "aria-label": this.a11yLabel, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner(iconUsed))));
100
+ index.h("button", { ref: (el) => (this.menuItem = el), class: classes, type: "button", disabled: this.disabled, "aria-label": this.a11yLabel || null, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner(iconUsed))));
101
101
  }
102
102
  get element() { return index.getElement(this); }
103
103
  };
@@ -1 +1 @@
1
- {"file":"stzh-menu.stzh-menu-item.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,WAAW,GAAG,8vBAA8vB;;MCcrwB,QAAQ;;;;EACnB,MAAM;IACJ,QACEA,QAACC,UAAI,IAAC,IAAI,EAAC,MAAM,IACfD,iBAAK,KAAK,EAAC,WAAW,IACpBA,qBAAa,CACT,CACD,EACP;GACH;;;;ACvBH,MAAM,eAAe,GAAG,ijGAAijG;;MC4B5jG,YAAY;;;;;IAuDf,mBAAc,GAAY,KAAK,CAAC;IAEhC,gBAAW,GAAG;MACpB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;OACjB;MAED,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;KAC7B,CAAA;IAEO,YAAO,GAAG,CAAC,KAAiB;MAClC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;MAE3B,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,EAAE;QACzC,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,KAAK;OAClB,CAAC,CAAC;MAEH,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;MACvC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAClB,SAAS,EAAE,gBAAg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AAI,CAAC,SAAS,EAC1B,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,IAElB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CACpB,CAEN,EACP;GACH;;;;;;;;","names":["h","Host","Fragment","hasSlot"],"sources":["./src/components/stzh-menu/stzh-menu.scss?tag=stzh-menu&encapsulation=scoped","./src/components/stzh-menu/stzh-menu.tsx","./src/components/stzh-menu-item/stzh-menu-item.scss?tag=stzh-menu-item&encapsulation=scoped","./src/components/stzh-menu-item/stzh-menu-item.tsx"],"sourcesContent":[":host {\n ::slotted(stzh-hr) {\n margin-top: space('xsmall');\n margin-bottom: space('xsmall');\n }\n}\n\n.stzh-menu {\n display: flex;\n flex-direction: column;\n}\n","import {\n Component,\n Host,\n h,\n} from \"@stencil/core\";\n\n/**\n * @slot - Slot for `stzh-menu-item` elements\n */\n@Component({\n tag: \"stzh-menu\",\n styleUrl: \"stzh-menu.scss\",\n scoped: true\n})\nexport class StzhMenu {\n render() {\n return (\n <Host role=\"menu\">\n <div class=\"stzh-menu\">\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n",":host {\n --height: #{$menuItemHeight};\n --color: #{$colorGrey70};\n --background-color: transparent;\n --icon-size: #{iconSize('small')};\n\n --hover-color: #{$colorGrey70};\n --hover-background-color: #{$colorGrey5};\n\n &[active]:not([active=\"false\"]) {\n --color: #{$colorPrimary};\n --hover-color: #{$colorPrimaryHover};\n --hover-background-color: #{$colorPrimary8};\n }\n\n &[disabled]:not([disabled=\"false\"]) {\n --color: #{$colorWhite};\n --background-color: #{$colorGrey13};\n\n --hover-color: #{$colorWhite};\n --hover-background-color: #{$colorGrey13};\n }\n}\n\n:host ::slotted(stzh-icon),\n.stzh-menu-item__icon {\n --size: var(--icon-size);\n}\n\n.stzh-menu-item {\n @include fontSize('micro');\n font-family: inherit;\n display: flex;\n align-items: center;\n justify-content: stretch;\n appearance: none;\n text-decoration-line: none;\n border: none;\n padding: space('xsmall') space('medium');\n padding-left: space('large');\n color: var(--color);\n background-color: var(--background-color);\n width: 100%;\n height: var(--height);\n line-height: var(--height);\n transition-duration: $baseTransitionAnimationSpeed;\n transition-property: color, background-color, border-color;\n cursor: pointer;\n\n &:hover {\n color: var(--hover-color);\n background-color: var(--hover-background-color);\n }\n\n &__icon-wrapper {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: auto;\n height: 1em;\n }\n\n &__badge {\n position: absolute;\n z-index: 1;\n top: calc(#{space('xsmall')} * -1);\n right: calc(#{space('xsmall')} * -1);\n }\n\n &__icon-wrapper + &__text:not(:empty) {\n margin-left: space('xsmall');\n }\n\n &__text {\n @include truncate;\n }\n\n /* Disabled variant */\n\n &--is-disabled {\n cursor: not-allowed;\n }\n}\n","import {\n Component,\n Host,\n h,\n Prop,\n Method,\n Element,\n Fragment,\n Event,\n EventEmitter\n} from \"@stencil/core\";\n\nimport {\n StzhMenuItemFocusEvent,\n StzhMenuItemBlurEvent\n} from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\n\n/**\n * @slot - Slot for any content\n * @slot icon - Slot for `stzh-icon` element\n */\n@Component({\n tag: \"stzh-menu-item\",\n styleUrl: \"stzh-menu-item.scss\",\n scoped: true\n})\nexport class StzhMenuItem {\n /** Badge (only displayed if `icon` property or icon slot is used) */\n @Prop() badge: string = \"\";\n\n /** Badge type */\n @Prop({ reflect: true }) badgeType: \"default\" | \"success\" | \"warning\" | \"error\" | \"info\" = \"default\";\n\n /** Whether badge should be displayed empty */\n @Prop({ reflect: true }) badgeEmpty: boolean = false;\n\n /** Whether the button is disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Whether the button is active */\n @Prop({ reflect: true }) active: boolean = false;\n\n /** Icon (use instead of icon slot) */\n @Prop() icon: string = \"\";\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** `href` if the button should be used as link */\n @Prop() href: string = \"\";\n\n /** Target if the button is used as link (if `href` used) */\n @Prop() target: string = \"\";\n\n /** Accessible label for screen readers to replace visible text */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string;\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the link/button element.\n * Default value will be taken from `label` prop or default slot.\n */\n @Prop() analyticsId: string;\n\n @Element() element: HTMLStzhMenuItemElement;\n\n /** Focus menu item */\n @Method()\n async setFocus() {\n this.menuItem.focus();\n }\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhMenuItemFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhMenuItemBlurEvent>;\n\n private menuItem: HTMLButtonElement | HTMLAnchorElement;\n private text: HTMLDivElement;\n\n private focusedByInput: boolean = false;\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent(\"focus\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-menu-item\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent(\"blur\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-menu-item\",\n originalEvent: event\n });\n }\n\n componentDidRender() {\n requestAnimationFrame(() => {\n this.menuItem.setAttribute(\"s-object-id\", this.analyticsId || this.text.innerText);\n });\n }\n\n private renderInner(iconUsed: boolean): DocumentFragment {\n return (\n <Fragment>\n {iconUsed &&\n <div class=\"stzh-menu-item__icon-wrapper\">\n {this.icon ?\n <stzh-icon class=\"stzh-menu-item__icon\" name={this.icon}></stzh-icon>\n :\n <slot name=\"icon\"></slot>\n }\n {(this.badge || this.badgeEmpty) &&\n <stzh-badge class=\"stzh-menu-item__badge\" label={this.badge} type={this.badgeType}></stzh-badge>\n }\n </div>\n }\n <div\n ref={(el) => (this.text = el as HTMLDivElement)}\n class=\"stzh-menu-item__text\"\n >\n {this.label ? this.label : <slot></slot>}\n </div>\n </Fragment>\n );\n }\n\n render() {\n const iconUsed: boolean = hasSlot(this.element, \"icon\") || !!this.icon;\n const classes = {\n \"stzh-menu-item\": true,\n \"stzh-menu-item--has-icon\": iconUsed,\n \"stzh-menu-item--has-badge\": !!this.badge,\n \"stzh-menu-item--is-disabled\": this.disabled,\n \"stzh-menu-item--is-active\": this.active\n };\n\n return (\n <Host role=\"menuitem\" tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n {this.href ?\n <a\n ref={(el) => (this.menuItem = el as HTMLAnchorElement)}\n href={this.disabled ? null : this.href}\n target={this.target}\n class={classes}\n aria-label={this.a11yLabel}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner(iconUsed)}\n </a>\n :\n <button\n ref={(el) => (this.menuItem = el as HTMLButtonElement)}\n class={classes}\n type=\"button\"\n disabled={this.disabled}\n aria-label={this.a11yLabel}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner(iconUsed)}\n </button>\n }\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"stzh-menu.stzh-menu-item.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,WAAW,GAAG,8vBAA8vB;;MCcrwB,QAAQ;;;;EACnB,MAAM;IACJ,QACEA,QAACC,UAAI,IAAC,IAAI,EAAC,MAAM,IACfD,iBAAK,KAAK,EAAC,WAAW,IACpBA,qBAAa,CACT,CACD,EACP;GACH;;;;ACvBH,MAAM,eAAe,GAAG,ijGAAijG;;MC4B5jG,YAAY;;;;;IAuDf,mBAAc,GAAY,KAAK,CAAC;IAEhC,gBAAW,GAAG;MACpB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;OACjB;MAED,IAAI,CAAC,cAAc,GA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M,EAAE,IAAI,CAAC,MAAM,EACnB,KAAK,EAAE,OAAO,gBACF,IAAI,CAAC,SAAS,IAAI,IAAI,EAClC,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,IAElB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CACzB;;QAEJA,oBACE,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,QAAQ,GAAG,EAAuB,CAAC,EACtD,KAAK,EAAE,OAAO,EACd,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,gBACX,IAAI,CAAC,SAAS,IAAI,IAAI,EAClC,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,IAElB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CACpB,CAEN,EACP;GACH;;;;;;;;","names":["h","Host","Fragment","hasSlot"],"sources":["./src/components/stzh-menu/stzh-menu.scss?tag=stzh-menu&encapsulation=scoped","./src/components/stzh-menu/stzh-menu.tsx","./src/components/stzh-menu-item/stzh-menu-item.scss?tag=stzh-menu-item&encapsulation=scoped","./src/components/stzh-menu-item/stzh-menu-item.tsx"],"sourcesContent":[":host {\n ::slotted(stzh-hr) {\n margin-top: space('xsmall');\n margin-bottom: space('xsmall');\n }\n}\n\n.stzh-menu {\n display: flex;\n flex-direction: column;\n}\n","import {\n Component,\n Host,\n h,\n} from \"@stencil/core\";\n\n/**\n * @slot - Slot for `stzh-menu-item` elements\n */\n@Component({\n tag: \"stzh-menu\",\n styleUrl: \"stzh-menu.scss\",\n scoped: true\n})\nexport class StzhMenu {\n render() {\n return (\n <Host role=\"menu\">\n <div class=\"stzh-menu\">\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n",":host {\n --height: #{$menuItemHeight};\n --color: #{$colorGrey70};\n --background-color: transparent;\n --icon-size: #{iconSize('small')};\n\n --hover-color: #{$colorGrey70};\n --hover-background-color: #{$colorGrey5};\n\n &[active]:not([active=\"false\"]) {\n --color: #{$colorPrimary};\n --hover-color: #{$colorPrimaryHover};\n --hover-background-color: #{$colorPrimary8};\n }\n\n &[disabled]:not([disabled=\"false\"]) {\n --color: #{$colorWhite};\n --background-color: #{$colorGrey13};\n\n --hover-color: #{$colorWhite};\n --hover-background-color: #{$colorGrey13};\n }\n}\n\n:host ::slotted(stzh-icon),\n.stzh-menu-item__icon {\n --size: var(--icon-size);\n}\n\n.stzh-menu-item {\n @include fontSize('micro');\n font-family: inherit;\n display: flex;\n align-items: center;\n justify-content: stretch;\n appearance: none;\n text-decoration-line: none;\n border: none;\n padding: space('xsmall') space('medium');\n padding-left: space('large');\n color: var(--color);\n background-color: var(--background-color);\n width: 100%;\n height: var(--height);\n line-height: var(--height);\n transition-duration: $baseTransitionAnimationSpeed;\n transition-property: color, background-color, border-color;\n cursor: pointer;\n\n &:hover {\n color: var(--hover-color);\n background-color: var(--hover-background-color);\n }\n\n &__icon-wrapper {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: auto;\n height: 1em;\n }\n\n &__badge {\n position: absolute;\n z-index: 1;\n top: calc(#{space('xsmall')} * -1);\n right: calc(#{space('xsmall')} * -1);\n }\n\n &__icon-wrapper + &__text:not(:empty) {\n margin-left: space('xsmall');\n }\n\n &__text {\n @include truncate;\n }\n\n /* Disabled variant */\n\n &--is-disabled {\n cursor: not-allowed;\n }\n}\n","import {\n Component,\n Host,\n h,\n Prop,\n Method,\n Element,\n Fragment,\n Event,\n EventEmitter\n} from \"@stencil/core\";\n\nimport {\n StzhMenuItemFocusEvent,\n StzhMenuItemBlurEvent\n} from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\n\n/**\n * @slot - Slot for any content\n * @slot icon - Slot for `stzh-icon` element\n */\n@Component({\n tag: \"stzh-menu-item\",\n styleUrl: \"stzh-menu-item.scss\",\n scoped: true\n})\nexport class StzhMenuItem {\n /** Badge (only displayed if `icon` property or icon slot is used) */\n @Prop() badge: string = \"\";\n\n /** Badge type */\n @Prop({ reflect: true }) badgeType: \"default\" | \"success\" | \"warning\" | \"error\" | \"info\" = \"default\";\n\n /** Whether badge should be displayed empty */\n @Prop({ reflect: true }) badgeEmpty: boolean = false;\n\n /** Whether the button is disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Whether the button is active */\n @Prop({ reflect: true }) active: boolean = false;\n\n /** Icon (use instead of icon slot) */\n @Prop() icon: string = \"\";\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** `href` if the button should be used as link */\n @Prop() href: string = \"\";\n\n /** Target if the button is used as link (if `href` used) */\n @Prop() target: string = \"\";\n\n /** Accessible label for screen readers to replace visible text */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string;\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the link/button element.\n * Default value will be taken from `label` prop or default slot.\n */\n @Prop() analyticsId: string;\n\n @Element() element: HTMLStzhMenuItemElement;\n\n /** Focus menu item */\n @Method()\n async setFocus() {\n this.menuItem.focus();\n }\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhMenuItemFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhMenuItemBlurEvent>;\n\n private menuItem: HTMLButtonElement | HTMLAnchorElement;\n private text: HTMLDivElement;\n\n private focusedByInput: boolean = false;\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent(\"focus\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-menu-item\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent(\"blur\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-menu-item\",\n originalEvent: event\n });\n }\n\n componentDidRender() {\n requestAnimationFrame(() => {\n this.menuItem.setAttribute(\"s-object-id\", this.analyticsId || this.text.innerText);\n });\n }\n\n private renderInner(iconUsed: boolean): DocumentFragment {\n return (\n <Fragment>\n {iconUsed &&\n <div class=\"stzh-menu-item__icon-wrapper\">\n {this.icon ?\n <stzh-icon class=\"stzh-menu-item__icon\" name={this.icon}></stzh-icon>\n :\n <slot name=\"icon\"></slot>\n }\n {(this.badge || this.badgeEmpty) &&\n <stzh-badge class=\"stzh-menu-item__badge\" label={this.badge} type={this.badgeType}></stzh-badge>\n }\n </div>\n }\n <div\n ref={(el) => (this.text = el as HTMLDivElement)}\n class=\"stzh-menu-item__text\"\n >\n {this.label ? this.label : <slot></slot>}\n </div>\n </Fragment>\n );\n }\n\n render() {\n const iconUsed: boolean = hasSlot(this.element, \"icon\") || !!this.icon;\n const classes = {\n \"stzh-menu-item\": true,\n \"stzh-menu-item--has-icon\": iconUsed,\n \"stzh-menu-item--has-badge\": !!this.badge,\n \"stzh-menu-item--is-disabled\": this.disabled,\n \"stzh-menu-item--is-active\": this.active\n };\n\n return (\n <Host role=\"menuitem\" tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n {this.href ?\n <a\n ref={(el) => (this.menuItem = el as HTMLAnchorElement)}\n href={this.disabled ? null : this.href}\n target={this.target}\n class={classes}\n aria-label={this.a11yLabel || null}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner(iconUsed)}\n </a>\n :\n <button\n ref={(el) => (this.menuItem = el as HTMLButtonElement)}\n class={classes}\n type=\"button\"\n disabled={this.disabled}\n aria-label={this.a11yLabel || null}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner(iconUsed)}\n </button>\n }\n </Host>\n );\n }\n}\n"],"version":3}
@@ -86,7 +86,7 @@ const StzhOverlay = class {
86
86
  "stzh-overlay": true,
87
87
  "stzh-overlay--is-open": this.open
88
88
  };
89
- return (index.h(index.Host, null, index.h("div", { class: classes }, index.h("div", { class: "stzh-overlay__backdrop" }), index.h("div", { class: "stzh-overlay__content" }, index.h("div", { class: "stzh-overlay__content-inner", ref: (el) => (this.dialogElement = el), tabindex: "-1", role: "dialog", "aria-label": this.a11yLabel, "aria-hidden": this.open ? "false" : "true" }, index.h("slot", null))))));
89
+ return (index.h(index.Host, null, index.h("div", { class: classes }, index.h("div", { class: "stzh-overlay__backdrop" }), index.h("div", { class: "stzh-overlay__content" }, index.h("div", { class: "stzh-overlay__content-inner", ref: (el) => (this.dialogElement = el), tabindex: "-1", role: "dialog", "aria-label": this.a11yLabel || null, "aria-hidden": this.open ? "false" : "true" }, index.h("slot", null))))));
90
90
  }
91
91
  get element() { return index.getElement(this); }
92
92
  };
@@ -1 +1 @@
1
- {"file":"stzh-overlay.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,cAAc,GAAG,g7CAAg7C;;ACoBv8C,MAAM,eAAe,GAAG,mBAAmB,CAAC;MAU/B,WAAW;;;;;gBAEmB,KAAK;gBAGtB,IAAI;qBAG2B,EAAE;;EAWzD,MAAM,IAAI;IACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACjB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;MACjB,SAAS,EAAE,cAAc;KAC1B,CAAC,CAAC;GACJ;EAGD,MAAM,IAAI;IACR,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IAClB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;MAClB,SAAS,EAAE,cAAc;KAC1B,CAAC,CAAC;GACJ;EAMO,WAAW;IACjB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;MACvB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,CACnD,CAAC,KAAK,KAAK,KAAK,KAAK,IAAI,CAAC,O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ED,gBAAgB;IACd,IAAI,CAAC,IAAI,GAAGA,6BAAe,CAAC,IAAI,CAAC,OAAO,kBACtC,aAAa,EAAE,IAAI,CAAC,aAAa,IAC9BC,uCAA0B,EAAE,EAC/B,CAAC;IAEH,IAAI,IAAI,CAAC,IAAI,EAAE;MACb,IAAI,CAAC,WAAW,EAAE,CAAC;KACpB;GACF;EAED,oBAAoB;IAClB,IAAI,CAAC,YAAY,EAAE,CAAC;GACrB;EAED,MAAM;IACJ,MAAM,OAAO,GAAG;MACd,cAAc,EAAE,IAAI;MACpB,uBAAuB,EAAE,IAAI,CAAC,IAAI;KACnC,CAAC;IAEF,QACEC,QAACC,UAAI,QACHD,iBAAK,KAAK,EAAE,OAAO,IACjBA,iBAAK,KAAK,EAAC,wBAAwB,GAAO,EAC1CA,iBAAK,KAAK,EAAC,uBAAuB,IAChCA,iBACE,KAAK,EAAC,6BAA6B,EACnC,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,aAAa,GAAG,EAAoB,CAAC,EACxD,QAAQ,EAAC,IAAI,EACb,IAAI,EAAC,QAAQ,gBACD,IAAI,CAAC,SAAS,iBACb,IAAI,CAAC,IAAI,GAAG,OAAO,GAAG,MAAM,IAEzCA,qBAAa,CACT,CACF,CACF,CACD,EACP;GACH;;;;;;;","names":["createFocusTrap","createBaseFocusTrapOptions","h","Host"],"sources":["./src/components/stzh-overlay/stzh-overlay.scss?tag=stzh-overlay&encapsulation=scoped","./src/components/stzh-overlay/stzh-overlay.tsx"],"sourcesContent":[":host {\n --backdrop-opacity: 0.8;\n}\n\n.stzh-overlay {\n display: none;\n z-index: $zIndexOverlay;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-direction: column;\n justify-content: stretch;\n align-items: stretch;\n\n &__backdrop {\n z-index: 1;\n background-color: $colorWhite;\n opacity: var(--backdrop-opacity);\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n\n &__content {\n z-index: 2;\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n flex-grow: 1;\n overflow: auto;\n }\n\n &__content-inner {\n // center content vertically\n margin-top: auto;\n margin-bottom: auto;\n outline: none;\n }\n\n &--is-open {\n display: flex;\n }\n}\n","import {\n Component,\n Host,\n h,\n Prop,\n Event,\n EventEmitter,\n Method,\n Element\n} from \"@stencil/core\";\n\nimport {\n StzhOverlayOpenEvent,\n StzhOverlayCloseEvent\n} from \"../../index\";\n\nimport { createBaseFocusTrapOptions } from \"../../utils/overlay-utils\";\n\nimport { createFocusTrap, FocusTrap } from 'focus-trap';\n\nconst CLASS_BODY_OPEN = \"stzh-overlay-open\";\n\n/**\n * @slot - Slot for any content\n */\n@Component({\n tag: \"stzh-overlay\",\n styleUrl: \"stzh-overlay.scss\",\n scoped: true\n})\nexport class StzhOverlay {\n /** Whether overlay is open */\n @Prop({ mutable: true }) open: boolean = false;\n\n /** Stay in original position (true) or move to body (false) */\n @Prop() stay: boolean = true;\n\n /** Accessible label for dialog */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string = \"\";\n\n /** Dialog open event */\n @Event() stzhOpen: EventEmitter<StzhOverlayOpenEvent>;\n\n /** Dialog close event */\n @Event() stzhClose: EventEmitter<StzhOverlayCloseEvent>;\n\n @Element() element: HTMLStzhOverlayElement;\n\n @Method()\n async show() {\n this.open = true;\n this.stzhOpen.emit({\n component: \"stzh-overlay\"\n });\n }\n\n @Method()\n async hide() {\n this.open = false;\n this.stzhClose.emit({\n component: \"stzh-overlay\"\n });\n }\n\n private trap: FocusTrap;\n private parentElement: HTMLElement;\n private dialogElement: HTMLDivElement;\n\n private getSiblings() {\n if (!this.parentElement) {\n return [];\n }\n\n return Array.from(this.parentElement.children).filter(\n (child) => child !== this.element\n );\n }\n\n private disableSiblings() {\n this.getSiblings().forEach((sibling) => {\n sibling.setAttribute(\"aria-hidden\", \"true\");\n });\n }\n\n private enableSiblings() {\n this.getSiblings().forEach((sibling) => {\n sibling.removeAttribute(\"aria-hidden\");\n });\n }\n\n private dialogShown() {\n document.body.classList.add(CLASS_BODY_OPEN);\n this.disableSiblings();\n\n if (this.trap) {\n this.trap.activate();\n }\n }\n\n private dialogHidden() {\n document.body.classList.remove(CLASS_BODY_OPEN);\n this.enableSiblings();\n\n if (this.trap) {\n this.trap.deactivate();\n }\n }\n\n connectedCallback() {\n if (!this.stay && this.element.parentElement !== document.body) {\n document.body.appendChild(this.element);\n }\n\n this.parentElement = this.element.parentElement;\n }\n\n componentDidRender() {\n this.open ? this.dialogShown() : this.dialogHidden();\n }\n\n componentDidUpdate() {\n this.trap.updateContainerElements(this.element);\n }\n\n componentDidLoad() {\n this.trap = createFocusTrap(this.element, {\n fallbackFocus: this.dialogElement,\n ...createBaseFocusTrapOptions()\n });\n\n if (this.open) {\n this.dialogShown();\n }\n }\n\n disconnectedCallback() {\n this.dialogHidden();\n }\n\n render() {\n const classes = {\n \"stzh-overlay\": true,\n \"stzh-overlay--is-open\": this.open\n };\n\n return (\n <Host>\n <div class={classes}>\n <div class=\"stzh-overlay__backdrop\"></div>\n <div class=\"stzh-overlay__content\">\n <div\n class=\"stzh-overlay__content-inner\"\n ref={(el) => (this.dialogElement = el as HTMLDivElement)}\n tabindex=\"-1\"\n role=\"dialog\"\n aria-label={this.a11yLabel}\n aria-hidden={this.open ? \"false\" : \"true\"}\n >\n <slot></slot>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"stzh-overlay.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,cAAc,GAAG,g7CAAg7C;;ACoBv8C,MAAM,eAAe,GAAG,mBAAmB,CAAC;MAU/B,WAAW;;;;;gBAEmB,KAAK;gBAGtB,IAAI;qBAG2B,EAAE;;EAWzD,MAAM,IAAI;IACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACjB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;MACjB,SAAS,EAAE,cAAc;KAC1B,CAAC,CAAC;GACJ;EAG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zh-overlay/stzh-overlay.scss?tag=stzh-overlay&encapsulation=scoped","./src/components/stzh-overlay/stzh-overlay.tsx"],"sourcesContent":[":host {\n --backdrop-opacity: 0.8;\n}\n\n.stzh-overlay {\n display: none;\n z-index: $zIndexOverlay;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n flex-direction: column;\n justify-content: stretch;\n align-items: stretch;\n\n &__backdrop {\n z-index: 1;\n background-color: $colorWhite;\n opacity: var(--backdrop-opacity);\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n\n &__content {\n z-index: 2;\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n flex-grow: 1;\n overflow: auto;\n }\n\n &__content-inner {\n // center content vertically\n margin-top: auto;\n margin-bottom: auto;\n outline: none;\n }\n\n &--is-open {\n display: flex;\n }\n}\n","import {\n Component,\n Host,\n h,\n Prop,\n Event,\n EventEmitter,\n Method,\n Element\n} from \"@stencil/core\";\n\nimport {\n StzhOverlayOpenEvent,\n StzhOverlayCloseEvent\n} from \"../../index\";\n\nimport { createBaseFocusTrapOptions } from \"../../utils/overlay-utils\";\n\nimport { createFocusTrap, FocusTrap } from 'focus-trap';\n\nconst CLASS_BODY_OPEN = \"stzh-overlay-open\";\n\n/**\n * @slot - Slot for any content\n */\n@Component({\n tag: \"stzh-overlay\",\n styleUrl: \"stzh-overlay.scss\",\n scoped: true\n})\nexport class StzhOverlay {\n /** Whether overlay is open */\n @Prop({ mutable: true }) open: boolean = false;\n\n /** Stay in original position (true) or move to body (false) */\n @Prop() stay: boolean = true;\n\n /** Accessible label for dialog */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string = \"\";\n\n /** Dialog open event */\n @Event() stzhOpen: EventEmitter<StzhOverlayOpenEvent>;\n\n /** Dialog close event */\n @Event() stzhClose: EventEmitter<StzhOverlayCloseEvent>;\n\n @Element() element: HTMLStzhOverlayElement;\n\n @Method()\n async show() {\n this.open = true;\n this.stzhOpen.emit({\n component: \"stzh-overlay\"\n });\n }\n\n @Method()\n async hide() {\n this.open = false;\n this.stzhClose.emit({\n component: \"stzh-overlay\"\n });\n }\n\n private trap: FocusTrap;\n private parentElement: HTMLElement;\n private dialogElement: HTMLDivElement;\n\n private getSiblings() {\n if (!this.parentElement) {\n return [];\n }\n\n return Array.from(this.parentElement.children).filter(\n (child) => child !== this.element\n );\n }\n\n private disableSiblings() {\n this.getSiblings().forEach((sibling) => {\n sibling.setAttribute(\"aria-hidden\", \"true\");\n });\n }\n\n private enableSiblings() {\n this.getSiblings().forEach((sibling) => {\n sibling.removeAttribute(\"aria-hidden\");\n });\n }\n\n private dialogShown() {\n document.body.classList.add(CLASS_BODY_OPEN);\n this.disableSiblings();\n\n if (this.trap) {\n this.trap.activate();\n }\n }\n\n private dialogHidden() {\n document.body.classList.remove(CLASS_BODY_OPEN);\n this.enableSiblings();\n\n if (this.trap) {\n this.trap.deactivate();\n }\n }\n\n connectedCallback() {\n if (!this.stay && this.element.parentElement !== document.body) {\n document.body.appendChild(this.element);\n }\n\n this.parentElement = this.element.parentElement;\n }\n\n componentDidRender() {\n this.open ? this.dialogShown() : this.dialogHidden();\n }\n\n componentDidUpdate() {\n this.trap.updateContainerElements(this.element);\n }\n\n componentDidLoad() {\n this.trap = createFocusTrap(this.element, {\n fallbackFocus: this.dialogElement,\n ...createBaseFocusTrapOptions()\n });\n\n if (this.open) {\n this.dialogShown();\n }\n }\n\n disconnectedCallback() {\n this.dialogHidden();\n }\n\n render() {\n const classes = {\n \"stzh-overlay\": true,\n \"stzh-overlay--is-open\": this.open\n };\n\n return (\n <Host>\n <div class={classes}>\n <div class=\"stzh-overlay__backdrop\"></div>\n <div class=\"stzh-overlay__content\">\n <div\n class=\"stzh-overlay__content-inner\"\n ref={(el) => (this.dialogElement = el as HTMLDivElement)}\n tabindex=\"-1\"\n role=\"dialog\"\n aria-label={this.a11yLabel || null}\n aria-hidden={this.open ? \"false\" : \"true\"}\n >\n <slot></slot>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -3,7 +3,7 @@
3
3
  "$formats": {
4
4
  "inputdate": {
5
5
  "format": "{d}.{m}.{Y}",
6
- "parse": "^(?<d>\\d{2}).(?<m>\\d{2}).(?<Y>\\d{4})$"
6
+ "parse": "^(?<d>\\d{1,2}).(?<m>\\d{1,2}).(?<Y>\\d{4})$"
7
7
  },
8
8
  "date": {
9
9
  "format": "{l}, {j}. {F} {Y}"
@@ -3,7 +3,7 @@
3
3
  "$formats": {
4
4
  "inputdate": {
5
5
  "format": "{d}.{m}.{Y}",
6
- "parse": "^(?<d>\\d{2}).(?<m>\\d{2}).(?<Y>\\d{4})$"
6
+ "parse": "^(?<d>\\d{1,2}).(?<m>\\d{1,2}).(?<Y>\\d{4})$"
7
7
  },
8
8
  "date": {
9
9
  "format": "{l}, {j}. {F} {Y}"
@@ -138,18 +138,18 @@ export class StzhButton {
138
138
  [`stzh-button--${this.variant}`]: !!this.variant
139
139
  };
140
140
  return (h(Host, { tabindex: this.disabled ? null : "-1", onFocus: this.onRootFocus }, this.href ?
141
- h("a", { ref: (el) => (this.button = el), href: this.disabled ? null : this.href, rel: this.rel, download: this.download, target: this.target, class: classes, "aria-label": this.a11yLabel, "aria-describedby": this.a11yDescribedby, "aria-disabled": typeof this.a11yDisabled !== "undefined"
141
+ h("a", { ref: (el) => (this.button = el), href: this.disabled ? null : this.href, rel: this.rel, download: this.download, target: this.target, class: classes, "aria-label": this.a11yLabel || null, "aria-describedby": this.a11yDescribedby || null, "aria-disabled": typeof this.a11yDisabled !== "undefined"
142
142
  ? (this.a11yDisabled ? "true" : "false") : null, "aria-expanded": typeof this.a11yExpanded !== "undefined"
143
- ? (this.a11yExpanded ? "true" : "false") : null, "aria-controls": this.a11yControls, accessKey: this.linkAccesskey, tabindex: this.a11yTabindex, onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick }, this.renderInner(iconUsed))
143
+ ? (this.a11yExpanded ? "true" : "false") : null, "aria-controls": this.a11yControls || null, accessKey: this.linkAccesskey, tabindex: this.a11yTabindex, onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick }, this.renderInner(iconUsed))
144
144
  :
145
145
  this.type === "radio" ?
146
- h("label", { ref: (el) => (this.button = el), class: classes, onClick: this.onClick }, h("input", { ref: (el) => (this.input = el), type: "radio", class: "stzh-button__input", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, "aria-label": this.a11yLabel, "aria-describedby": this.a11yDescribedby, "aria-disabled": typeof this.a11yDisabled !== "undefined"
146
+ h("label", { ref: (el) => (this.button = el), class: classes, onClick: this.onClick }, h("input", { ref: (el) => (this.input = el), type: "radio", class: "stzh-button__input", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, "aria-label": this.a11yLabel || null, "aria-describedby": this.a11yDescribedby || null, "aria-disabled": typeof this.a11yDisabled !== "undefined"
147
147
  ? (this.a11yDisabled ? "true" : "false") : null, "aria-expanded": typeof this.a11yExpanded !== "undefined"
148
- ? (this.a11yExpanded ? "true" : "false") : null, "aria-controls": this.a11yControls, accessKey: this.linkAccesskey, tabindex: this.a11yTabindex, onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick, onInput: this.onInput }), this.renderInner(iconUsed))
148
+ ? (this.a11yExpanded ? "true" : "false") : null, "aria-controls": this.a11yControls || null, accessKey: this.linkAccesskey, tabindex: this.a11yTabindex, onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick, onInput: this.onInput }), this.renderInner(iconUsed))
149
149
  :
150
- h("button", { ref: (el) => (this.button = el), class: classes, type: this.type, disabled: this.disabled, "aria-label": this.a11yLabel, "aria-describedby": this.a11yDescribedby, "aria-disabled": typeof this.a11yDisabled !== "undefined"
150
+ h("button", { ref: (el) => (this.button = el), class: classes, type: this.type, disabled: this.disabled, "aria-label": this.a11yLabel || null, "aria-describedby": this.a11yDescribedby || null, "aria-disabled": typeof this.a11yDisabled !== "undefined"
151
151
  ? (this.a11yDisabled ? "true" : "false") : null, "aria-expanded": typeof this.a11yExpanded !== "undefined"
152
- ? (this.a11yExpanded ? "true" : "false") : null, "aria-controls": this.a11yControls, accessKey: this.linkAccesskey, tabindex: this.a11yTabindex, onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick }, this.renderInner(iconUsed))));
152
+ ? (this.a11yExpanded ? "true" : "false") : null, "aria-controls": this.a11yControls || null, accessKey: this.linkAccesskey, tabindex: this.a11yTabindex, onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick }, this.renderInner(iconUsed))));
153
153
  }
154
154
  static get is() { return "stzh-button"; }
155
155
  static get encapsulation() { return "scoped"; }
@@ -1 +1 @@
1
- {"version":3,"file":"stzh-button.js","sourceRoot":"","sources":["../../../src/components/stzh-button/stzh-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,OAAO,EACP,CAAC,EACD,IAAI,EACJ,KAAK,EAEN,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAuB,MAAM,+BAA+B,CAAC;AAEvF;;;GAGG;AAMH,MAAM,OAAO,UAAU;;IA+Hb,mBAAc,GAAY,KAAK,CAAC;IAEhC,YAAO,GAAG,CAAC,KAAiB,EAAE,EAAE;MACtC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;MAClC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QACnB,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;OACtB,CAAC,CAAC;IACL,CAAC,CAAA;IAEO,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;OACjB;MAED,IAAI,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n Method,\n Fragment,\n Element,\n h,\n Prop,\n Event,\n EventEmitter\n} from \"@stencil/core\";\n\nimport {\n StzhButtonFocusEvent,\n StzhButtonBlurEvent,\n StzhButtonChangeEvent\n} from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\nimport { fetchTranslations, StzhLocaleComponent } from \"../../utils/translation-utils\";\n\n/**\n * @slot - Slot for label/text content\n * @slot icon - Slot for icon element\n */\n@Component({\n tag: \"stzh-button\",\n styleUrl: \"stzh-button.scss\",\n scoped: true\n})\nexport class StzhButton {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Display a badge aligned to button or icons */\n @Prop() badge: string = \"\";\n\n /** Badge type */\n @Prop({ reflect: true }) badgeType: \"default\" | \"success\" | \"warning\" | \"error\" | \"info\" = \"default\";\n\n /** Badge position */\n @Prop({ reflect: true }) badgePosition: \"icon\" | \"button\" = \"button\";\n\n /** Whether badge should be displayed empty */\n @Prop({ reflect: true }) badgeEmpty: boolean = false;\n\n /** Whether the button is full width */\n @Prop({ reflect: true }) fullwidth: boolean = false;\n\n /** Whether the button is rounded */\n @Prop({ reflect: true }) rounded: boolean = false;\n\n /** Whether the button is floating */\n @Prop({ reflect: true }) floating: boolean = false;\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" | \"tiny\" = \"default\";\n\n /** Text alignment */\n @Prop({ reflect: true }) textAlign: \"left\" | \"center\" | \"right\" | \"space-between\" | \"default\" = \"default\";\n\n /** Variant style */\n @Prop({ reflect: true }) variant: \"default\" | \"secondary\" | \"input\" | \"tertiary\" = \"default\";\n\n /** Icon (use instead of icon slot) */\n @Prop() icon: string = \"\";\n\n /** Icon Position */\n @Prop({ reflect: true }) iconPosition: \"left\" | \"right\" = \"left\";\n\n /** Checked status (if type is radio) */\n @Prop({ mutable: true, reflect: true }) checked: boolean = false;\n\n /** The name of the input element (if type is radio) */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** The value of the input element (if type is radio) */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** `href` if the button should be used as link */\n @Prop() href: string = \"\";\n\n /** Rel (if href is used) */\n @Prop() rel: string;\n\n /** Target if the button is used as link (if `href` used) */\n @Prop() target: string = \"\";\n\n /** Download attribute of link (if `href` used) */\n @Prop() download: string;\n\n /** Type of the button */\n @Prop() type: \"button\" | \"submit\" | \"reset\" | \"radio\" = \"button\";\n\n /** Whether the button is disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Whether the button is active */\n @Prop({ reflect: true }) active: boolean = false;\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Effect/Animation used */\n @Prop() effect: \"default\" | \"cta\" = \"default\";\n\n /** Whether only an icon is used inside the button */\n @Prop({ reflect: true }) iconOnly: boolean = false;\n\n /** Access key of link (usually a number e.g. 1) */\n @Prop() linkAccesskey: string;\n\n /** Accessible label for screen readers to replace visible text */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string;\n\n /** Id for element which describes the button (this will be overwritten if description prop or slot is used, used by stzh-radiogroup) */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = \"\";\n\n /** Aria expanded of link/button */\n @Prop({ reflect: true, attribute: \"a11y-expanded\" }) a11yExpanded: boolean;\n\n /** Aria disabled of link/button */\n @Prop({ reflect: true, attribute: \"a11y-disabled\" }) a11yDisabled: boolean;\n\n /** Aria controls of link/button */\n @Prop({ attribute: \"a11y-controls\" }) a11yControls: string;\n\n /** Tabindex of link/button */\n @Prop({ attribute: \"a11y-tabindex\" }) a11yTabindex: string;\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the link/button element.\n * Default value will be taken from `label` prop or default slot.\n */\n @Prop() analyticsId: string;\n\n @Element() element: HTMLStzhButtonElement;\n\n /** Focus button */\n @Method()\n async setFocus() {\n this.button.focus();\n }\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhButtonFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhButtonBlurEvent>;\n\n /** Change event (only called if type is radio) */\n @Event() stzhChange: EventEmitter<StzhButtonChangeEvent>;\n\n private button: HTMLButtonElement | HTMLAnchorElement | HTMLLabelElement;\n private input: HTMLInputElement;\n private text: HTMLDivElement;\n private focusedByInput: boolean = false;\n\n private onInput = (event: InputEvent) => {\n this.checked = this.input.checked;\n this.stzhChange.emit({\n component: \"stzh-button\",\n originalEvent: event,\n value: this.value,\n checked: this.checked\n });\n }\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent(\"focus\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-button\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent(\"blur\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-button\",\n originalEvent: event\n });\n }\n\n private onClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n private renderIcon(iconUsed: boolean): HTMLInputElement {\n return (\n <div class=\"stzh-button__icon-wrapper\">\n {this.icon ?\n <stzh-icon class=\"stzh-button__icon\" name={this.icon}></stzh-icon>\n :\n <slot name=\"icon\"></slot>\n }\n {(this.badge || this.badgeEmpty) && this.badgePosition === \"icon\" && iconUsed &&\n <stzh-badge class=\"stzh-button__badge\" label={this.badge} type={this.badgeType}></stzh-badge>\n }\n </div>\n );\n }\n\n private renderContent(): HTMLDivElement {\n return (\n <div class=\"stzh-button__text\">\n {this.rel && this.rel.includes('external') && <div class=\"stzh-button__vhidden\">{this.localization.$globals.externalLinkLabel}</div>}\n {this.download && <div class=\"stzh-button__vhidden\">{this.localization.$globals.downloadLinkLabel}</div>}\n <div ref={(el) => (this.text = el as HTMLDivElement)}>{this.label ? this.label : <slot></slot>}</div>\n </div>\n );\n }\n\n private renderInner(iconUsed: boolean): DocumentFragment {\n return (\n <Fragment>\n <div\n class=\"stzh-button__inner\"\n onClick={this.onClick}\n >\n {this.type === \"radio\" &&\n <div class=\"stzh-button__mark\">\n <div class=\"stzh-button__check\"></div>\n </div>\n }\n {this.iconPosition === \"left\" && this.renderIcon(iconUsed)}\n {this.renderContent()}\n {this.iconPosition === \"right\" && this.renderIcon(iconUsed)}\n </div>\n {(this.badge || this.badgeEmpty) && (this.badgePosition === \"button\" || !iconUsed) &&\n <stzh-badge\n class=\"stzh-button__badge\"\n label={this.badge}\n type={this.badgeType}\n onClick={this.onClick}\n ></stzh-badge>\n }\n </Fragment>\n );\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"button\");\n }\n }\n\n componentDidRender() {\n requestAnimationFrame(() => {\n this.button.setAttribute(\"s-object-id\", this.analyticsId || this.text.innerText);\n });\n }\n\n render() {\n const iconUsed: boolean = hasSlot(this.element, \"icon\") || !!this.icon;\n const classes = {\n \"stzh-button\": true,\n \"stzh-button--has-icon\": iconUsed,\n \"stzh-button--has-icon-only\": this.iconOnly,\n \"stzh-button--has-badge\": !!this.badge,\n \"stzh-button--is-floating\": this.floating,\n \"stzh-button--is-rounded\": this.rounded,\n \"stzh-button--is-fullwidth\": this.fullwidth,\n \"stzh-button--is-disabled\": this.disabled || this.a11yDisabled,\n \"stzh-button--is-active\": this.active,\n [`stzh-button--effect-${this.effect}`]: !!this.effect,\n [`stzh-button--badge-position-${this.badgePosition}`]: !!this.badgePosition,\n [`stzh-button--align-${this.textAlign}`]: !!this.textAlign,\n [`stzh-button--size-${this.size}`]: !!this.size,\n [`stzh-button--type-${this.type}`]: !!this.type,\n [`stzh-button--${this.variant}`]: !!this.variant\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n {this.href ?\n <a\n ref={(el) => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? null : this.href}\n rel={this.rel}\n download={this.download}\n target={this.target}\n class={classes}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n >\n {this.renderInner(iconUsed)}\n </a>\n :\n this.type === \"radio\" ?\n <label\n ref={(el) => (this.button = el as HTMLLabelElement)}\n class={classes}\n onClick={this.onClick}\n >\n <input\n ref={(el) => (this.input = el as HTMLInputElement)}\n type=\"radio\"\n class=\"stzh-button__input\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n onInput={this.onInput}\n />\n {this.renderInner(iconUsed)}\n </label>\n :\n <button\n ref={(el) => (this.button = el as HTMLButtonElement)}\n class={classes}\n type={this.type}\n disabled={this.disabled}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n >\n {this.renderInner(iconUsed)}\n </button>\n }\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"stzh-button.js","sourceRoot":"","sources":["../../../src/components/stzh-button/stzh-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,OAAO,EACP,CAAC,EACD,IAAI,EACJ,KAAK,EAEN,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAuB,MAAM,+BAA+B,CAAC;AAEvF;;;GAGG;AAMH,MAAM,OAAO,UAAU;;IA+Hb,mBAAc,GAAY,KAAK,CAAC;IAEhC,YAAO,GAAG,CAAC,KAAiB,EAAE,EAAE;MACtC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;MAClC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QACnB,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;OACtB,CAAC,CAAC;IACL,CAAC,CAAA;IAEO,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;OACjB;MAED,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;IAC9B,CAAC,CAAA;IAEO,YAAO,GAAG,CAAC,KAAiB,EAAE,EAAE;MACtC,IAAI,CAAC,cAAc,GAAG,IAAI,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n Method,\n Fragment,\n Element,\n h,\n Prop,\n Event,\n EventEmitter\n} from \"@stencil/core\";\n\nimport {\n StzhButtonFocusEvent,\n StzhButtonBlurEvent,\n StzhButtonChangeEvent\n} from \"../../index\";\n\nimport { hasSlot } from \"../../utils/utils\";\nimport { fetchTranslations, StzhLocaleComponent } from \"../../utils/translation-utils\";\n\n/**\n * @slot - Slot for label/text content\n * @slot icon - Slot for icon element\n */\n@Component({\n tag: \"stzh-button\",\n styleUrl: \"stzh-button.scss\",\n scoped: true\n})\nexport class StzhButton {\n /** Translation strings */\n @Prop() localization: StzhLocaleComponent;\n\n /** Display a badge aligned to button or icons */\n @Prop() badge: string = \"\";\n\n /** Badge type */\n @Prop({ reflect: true }) badgeType: \"default\" | \"success\" | \"warning\" | \"error\" | \"info\" = \"default\";\n\n /** Badge position */\n @Prop({ reflect: true }) badgePosition: \"icon\" | \"button\" = \"button\";\n\n /** Whether badge should be displayed empty */\n @Prop({ reflect: true }) badgeEmpty: boolean = false;\n\n /** Whether the button is full width */\n @Prop({ reflect: true }) fullwidth: boolean = false;\n\n /** Whether the button is rounded */\n @Prop({ reflect: true }) rounded: boolean = false;\n\n /** Whether the button is floating */\n @Prop({ reflect: true }) floating: boolean = false;\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" | \"tiny\" = \"default\";\n\n /** Text alignment */\n @Prop({ reflect: true }) textAlign: \"left\" | \"center\" | \"right\" | \"space-between\" | \"default\" = \"default\";\n\n /** Variant style */\n @Prop({ reflect: true }) variant: \"default\" | \"secondary\" | \"input\" | \"tertiary\" = \"default\";\n\n /** Icon (use instead of icon slot) */\n @Prop() icon: string = \"\";\n\n /** Icon Position */\n @Prop({ reflect: true }) iconPosition: \"left\" | \"right\" = \"left\";\n\n /** Checked status (if type is radio) */\n @Prop({ mutable: true, reflect: true }) checked: boolean = false;\n\n /** The name of the input element (if type is radio) */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** The value of the input element (if type is radio) */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** `href` if the button should be used as link */\n @Prop() href: string = \"\";\n\n /** Rel (if href is used) */\n @Prop() rel: string;\n\n /** Target if the button is used as link (if `href` used) */\n @Prop() target: string = \"\";\n\n /** Download attribute of link (if `href` used) */\n @Prop() download: string;\n\n /** Type of the button */\n @Prop() type: \"button\" | \"submit\" | \"reset\" | \"radio\" = \"button\";\n\n /** Whether the button is disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Whether the button is active */\n @Prop({ reflect: true }) active: boolean = false;\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Effect/Animation used */\n @Prop() effect: \"default\" | \"cta\" = \"default\";\n\n /** Whether only an icon is used inside the button */\n @Prop({ reflect: true }) iconOnly: boolean = false;\n\n /** Access key of link (usually a number e.g. 1) */\n @Prop() linkAccesskey: string;\n\n /** Accessible label for screen readers to replace visible text */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string;\n\n /** Id for element which describes the button (this will be overwritten if description prop or slot is used, used by stzh-radiogroup) */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = \"\";\n\n /** Aria expanded of link/button */\n @Prop({ reflect: true, attribute: \"a11y-expanded\" }) a11yExpanded: boolean;\n\n /** Aria disabled of link/button */\n @Prop({ reflect: true, attribute: \"a11y-disabled\" }) a11yDisabled: boolean;\n\n /** Aria controls of link/button */\n @Prop({ attribute: \"a11y-controls\" }) a11yControls: string;\n\n /** Tabindex of link/button */\n @Prop({ attribute: \"a11y-tabindex\" }) a11yTabindex: string;\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the link/button element.\n * Default value will be taken from `label` prop or default slot.\n */\n @Prop() analyticsId: string;\n\n @Element() element: HTMLStzhButtonElement;\n\n /** Focus button */\n @Method()\n async setFocus() {\n this.button.focus();\n }\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhButtonFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhButtonBlurEvent>;\n\n /** Change event (only called if type is radio) */\n @Event() stzhChange: EventEmitter<StzhButtonChangeEvent>;\n\n private button: HTMLButtonElement | HTMLAnchorElement | HTMLLabelElement;\n private input: HTMLInputElement;\n private text: HTMLDivElement;\n private focusedByInput: boolean = false;\n\n private onInput = (event: InputEvent) => {\n this.checked = this.input.checked;\n this.stzhChange.emit({\n component: \"stzh-button\",\n originalEvent: event,\n value: this.value,\n checked: this.checked\n });\n }\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent(\"focus\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-button\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent(\"blur\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-button\",\n originalEvent: event\n });\n }\n\n private onClick = (event: MouseEvent) => {\n if (this.disabled) {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n private renderIcon(iconUsed: boolean): HTMLInputElement {\n return (\n <div class=\"stzh-button__icon-wrapper\">\n {this.icon ?\n <stzh-icon class=\"stzh-button__icon\" name={this.icon}></stzh-icon>\n :\n <slot name=\"icon\"></slot>\n }\n {(this.badge || this.badgeEmpty) && this.badgePosition === \"icon\" && iconUsed &&\n <stzh-badge class=\"stzh-button__badge\" label={this.badge} type={this.badgeType}></stzh-badge>\n }\n </div>\n );\n }\n\n private renderContent(): HTMLDivElement {\n return (\n <div class=\"stzh-button__text\">\n {this.rel && this.rel.includes('external') && <div class=\"stzh-button__vhidden\">{this.localization.$globals.externalLinkLabel}</div>}\n {this.download && <div class=\"stzh-button__vhidden\">{this.localization.$globals.downloadLinkLabel}</div>}\n <div ref={(el) => (this.text = el as HTMLDivElement)}>{this.label ? this.label : <slot></slot>}</div>\n </div>\n );\n }\n\n private renderInner(iconUsed: boolean): DocumentFragment {\n return (\n <Fragment>\n <div\n class=\"stzh-button__inner\"\n onClick={this.onClick}\n >\n {this.type === \"radio\" &&\n <div class=\"stzh-button__mark\">\n <div class=\"stzh-button__check\"></div>\n </div>\n }\n {this.iconPosition === \"left\" && this.renderIcon(iconUsed)}\n {this.renderContent()}\n {this.iconPosition === \"right\" && this.renderIcon(iconUsed)}\n </div>\n {(this.badge || this.badgeEmpty) && (this.badgePosition === \"button\" || !iconUsed) &&\n <stzh-badge\n class=\"stzh-button__badge\"\n label={this.badge}\n type={this.badgeType}\n onClick={this.onClick}\n ></stzh-badge>\n }\n </Fragment>\n );\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"button\");\n }\n }\n\n componentDidRender() {\n requestAnimationFrame(() => {\n this.button.setAttribute(\"s-object-id\", this.analyticsId || this.text.innerText);\n });\n }\n\n render() {\n const iconUsed: boolean = hasSlot(this.element, \"icon\") || !!this.icon;\n const classes = {\n \"stzh-button\": true,\n \"stzh-button--has-icon\": iconUsed,\n \"stzh-button--has-icon-only\": this.iconOnly,\n \"stzh-button--has-badge\": !!this.badge,\n \"stzh-button--is-floating\": this.floating,\n \"stzh-button--is-rounded\": this.rounded,\n \"stzh-button--is-fullwidth\": this.fullwidth,\n \"stzh-button--is-disabled\": this.disabled || this.a11yDisabled,\n \"stzh-button--is-active\": this.active,\n [`stzh-button--effect-${this.effect}`]: !!this.effect,\n [`stzh-button--badge-position-${this.badgePosition}`]: !!this.badgePosition,\n [`stzh-button--align-${this.textAlign}`]: !!this.textAlign,\n [`stzh-button--size-${this.size}`]: !!this.size,\n [`stzh-button--type-${this.type}`]: !!this.type,\n [`stzh-button--${this.variant}`]: !!this.variant\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n {this.href ?\n <a\n ref={(el) => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? null : this.href}\n rel={this.rel}\n download={this.download}\n target={this.target}\n class={classes}\n aria-label={this.a11yLabel || null}\n aria-describedby={this.a11yDescribedby || null}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls || null}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n >\n {this.renderInner(iconUsed)}\n </a>\n :\n this.type === \"radio\" ?\n <label\n ref={(el) => (this.button = el as HTMLLabelElement)}\n class={classes}\n onClick={this.onClick}\n >\n <input\n ref={(el) => (this.input = el as HTMLInputElement)}\n type=\"radio\"\n class=\"stzh-button__input\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n aria-label={this.a11yLabel || null}\n aria-describedby={this.a11yDescribedby || null}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls || null}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n onInput={this.onInput}\n />\n {this.renderInner(iconUsed)}\n </label>\n :\n <button\n ref={(el) => (this.button = el as HTMLButtonElement)}\n class={classes}\n type={this.type}\n disabled={this.disabled}\n aria-label={this.a11yLabel || null}\n aria-describedby={this.a11yDescribedby || null}\n aria-disabled={typeof this.a11yDisabled !== \"undefined\"\n ? (this.a11yDisabled ? \"true\" : \"false\") : null}\n aria-expanded={typeof this.a11yExpanded !== \"undefined\"\n ? (this.a11yExpanded ? \"true\" : \"false\") : null}\n aria-controls={this.a11yControls || null}\n accessKey={this.linkAccesskey}\n tabindex={this.a11yTabindex}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onClick={this.onClick}\n >\n {this.renderInner(iconUsed)}\n </button>\n }\n </Host>\n );\n }\n}\n"]}
@@ -104,13 +104,13 @@ export class StzhChip {
104
104
  "stzh-chip__button": true,
105
105
  "is-button": !this.nonInteractive && !this.href,
106
106
  "is-link": !this.nonInteractive && !!this.href
107
- }, href: this.disabled ? null : this.href, target: this.target, tabindex: this.a11yTabindex, "aria-label": this.a11yLabel, "aria-describedby": this.a11yDescribedby, onClick: this.onClick, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner())
107
+ }, href: this.disabled ? null : this.href, target: this.target, tabindex: this.a11yTabindex, "aria-label": this.a11yLabel || null, "aria-describedby": this.a11yDescribedby || null, onClick: this.onClick, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner())
108
108
  :
109
109
  h(Chip, { ref: (el) => (this.chip = el), class: {
110
110
  "stzh-chip__button": true,
111
111
  "is-button": !this.nonInteractive && !this.href,
112
112
  "is-link": !this.nonInteractive && !!this.href
113
- }, disabled: this.disabled, type: "button", tabindex: this.a11yTabindex, "aria-label": this.a11yLabel, "aria-describedby": this.a11yDescribedby, onClick: this.onClick, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner()))));
113
+ }, disabled: this.disabled, type: "button", tabindex: this.a11yTabindex, "aria-label": this.a11yLabel || null, "aria-describedby": this.a11yDescribedby || null, onClick: this.onClick, onFocus: this.onFocus, onBlur: this.onBlur }, this.renderInner()))));
114
114
  }
115
115
  static get is() { return "stzh-chip"; }
116
116
  static get encapsulation() { return "scoped"; }
@@ -1 +1 @@
1
- {"version":3,"file":"stzh-chip.js","sourceRoot":"","sources":["../../../src/components/stzh-chip/stzh-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,QAAQ,EACvB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,IAAI,CAAC,YAAY,gBACf,IAAI,CAAC,SAAS,sBACR,IAAI,CAAC,eAAe,EACtC,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,IAElB,IAAI,CAAC,WAAW,EAAE,CACd,CAEL,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n h,\n Prop,\n Event,\n EventEmitter,\n Element,\n Method,\n Fragment\n} from \"@stencil/core\";\n\nimport {\n StzhChipClickEvent,\n StzhChipRemoveEvent,\n StzhChipFocusEvent,\n StzhChipBlurEvent\n} from \"../../index\";\n\n/**\n * @slot - Slot for label\n * @slot icon - Slot for icon\n */\n@Component({\n tag: \"stzh-chip\",\n styleUrl: \"stzh-chip.scss\",\n scoped: true\n})\nexport class StzhChip {\n /** Label */\n @Prop() label: string = \"\";\n\n /** Icon (use instead of icon slot) */\n @Prop() icon: string = \"\";\n\n /** `href` if the chip should be used as link */\n @Prop() href: string = \"\";\n\n /** Target if the button is used as link (if `href` used) */\n @Prop() target: string = \"\";\n\n /** Whether chip is not interactive */\n @Prop({ reflect: true }) nonInteractive: boolean = false;\n\n /** Whether remove button should be shown */\n @Prop({ reflect: true }) removable: boolean = false;\n\n /** Variant */\n @Prop({ reflect: true }) variant: \"tag\" | \"filter\" | \"input\" = \"tag\";\n\n /** Size */\n @Prop({ reflect: true }) size: \"default\" | \"small\" | \"large\" = \"default\";\n\n /** Type */\n @Prop({ reflect: true }) type: \"default\" | \"secondary\" | \"important\" = \"default\";\n\n /** Counter */\n @Prop() counter: string = \"\";\n\n /** Label of remove button for screenreaders */\n @Prop() removeLabel: string = \"\";\n\n /** Active */\n @Prop({ reflect: true }) active: boolean = false;\n\n /** Disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Tabindex of link/button */\n @Prop({ attribute: \"a11y-tabindex\" }) a11yTabindex: string;\n\n /** Accessible label for screen readers to replace visible text */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string;\n\n /** Id for element which describes the link/button */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = \"\";\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the link/button element.\n * Default value will be taken from `label` prop or default slot.\n */\n @Prop() analyticsId: string;\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the remove button element.\n * Default value will be taken from `removeLabel` prop.\n */\n @Prop() removeAnalyticsId: string;\n\n @Element() element: HTMLStzhChipElement;\n\n /** Focus menu item */\n @Method()\n async setFocus() {\n this.chip.focus();\n }\n\n /** Chip click event */\n @Event() stzhClick: EventEmitter<StzhChipClickEvent>;\n\n /** Chip remove event */\n @Event() stzhRemove: EventEmitter<StzhChipRemoveEvent>;\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhChipFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhChipBlurEvent>;\n\n private chip: HTMLButtonElement | HTMLAnchorElement;\n private text: HTMLElement;\n private focusedByInput: boolean = false;\n\n componentDidRender() {\n requestAnimationFrame(() => {\n this.chip.setAttribute(\"s-object-id\", this.analyticsId || this.text.innerText);\n });\n }\n\n private renderInner(): DocumentFragment {\n return (\n <Fragment>\n <div class=\"stzh-chip__icon-wrapper\">\n {this.icon ?\n <stzh-icon class=\"stzh-chip__icon\" name={this.icon}></stzh-icon>\n :\n <slot name=\"icon\"></slot>\n }\n </div>\n\n <stzh-clamp\n lines={1}\n class=\"stzh-chip__label\"\n ref={(el) => (this.text = el as HTMLElement)}\n >\n {this.label ? this.label : <slot></slot>}\n {this.counter &&\n <span class=\"stzh-chip__vhidden\">\n &nbsp;({this.counter})\n </span>\n }\n </stzh-clamp>\n\n {this.counter &&\n <div class=\"stzh-chip__counter\" aria-hidden=\"true\">\n {this.counter}\n </div>\n }\n </Fragment>\n );\n }\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent(\"focus\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-chip\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent(\"blur\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-chip\",\n originalEvent: event\n });\n }\n\n private onClick = (event: MouseEvent) => {\n this.stzhClick.emit({\n component: \"stzh-chip\",\n originalEvent: event\n });\n }\n\n private onRemoveClick = (event: MouseEvent) => {\n this.stzhRemove.emit({\n component: \"stzh-chip\",\n originalEvent: event\n });\n }\n\n render() {\n const classes = {\n \"stzh-chip\": true,\n \"stzh-chip--is-active\": this.active,\n \"stzh-chip--is-disabled\": this.disabled,\n \"stzh-chip--is-removable\": this.removable,\n \"stzh-chip--has-counter\": !!this.counter,\n [`stzh-chip--type-${this.type}`]: !!this.type,\n [`stzh-chip--size-${this.size}`]: !!this.size,\n [`stzh-chip--${this.variant}`]: !!this.variant\n };\n\n const Chip = this.nonInteractive ? \"div\" :\n this.href ? \"a\" : \"button\";\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes}>\n {this.removable &&\n <button\n class=\"stzh-chip__remove\"\n onClick={this.onRemoveClick}\n disabled={this.disabled}\n aria-label={this.removeLabel}\n type=\"button\"\n s-object-id={this.removeAnalyticsId || this.removeLabel}\n >\n <stzh-icon class=\"stzh-chip__remove-icon\" name=\"close\"></stzh-icon>\n </button>\n }\n\n {this.href ?\n <Chip\n ref={(el) => (this.chip = el as HTMLAnchorElement)}\n class={{\n \"stzh-chip__button\": true,\n \"is-button\": !this.nonInteractive && !this.href,\n \"is-link\": !this.nonInteractive && !!this.href\n }}\n href={this.disabled ? null : this.href}\n target={this.target}\n tabindex={this.a11yTabindex}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n onClick={this.onClick}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner()}\n </Chip>\n :\n <Chip\n ref={(el) => (this.chip = el as HTMLButtonElement)}\n class={{\n \"stzh-chip__button\": true,\n \"is-button\": !this.nonInteractive && !this.href,\n \"is-link\": !this.nonInteractive && !!this.href\n }}\n disabled={this.disabled}\n type=\"button\"\n tabindex={this.a11yTabindex}\n aria-label={this.a11yLabel}\n aria-describedby={this.a11yDescribedby}\n onClick={this.onClick}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner()}\n </Chip>\n }\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"stzh-chip.js","sourceRoot":"","sources":["../../../src/components/stzh-chip/stzh-chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,CAAC,EACD,IAAI,EACJ,KAAK,EAE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,gBACf,IAAI,CAAC,SAAS,IAAI,IAAI,sBAChB,IAAI,CAAC,eAAe,IAAI,IAAI,EAC9C,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,IAElB,IAAI,CAAC,WAAW,EAAE,CACd,CAEL,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n h,\n Prop,\n Event,\n EventEmitter,\n Element,\n Method,\n Fragment\n} from \"@stencil/core\";\n\nimport {\n StzhChipClickEvent,\n StzhChipRemoveEvent,\n StzhChipFocusEvent,\n StzhChipBlurEvent\n} from \"../../index\";\n\n/**\n * @slot - Slot for label\n * @slot icon - Slot for icon\n */\n@Component({\n tag: \"stzh-chip\",\n styleUrl: \"stzh-chip.scss\",\n scoped: true\n})\nexport class StzhChip {\n /** Label */\n @Prop() label: string = \"\";\n\n /** Icon (use instead of icon slot) */\n @Prop() icon: string = \"\";\n\n /** `href` if the chip should be used as link */\n @Prop() href: string = \"\";\n\n /** Target if the button is used as link (if `href` used) */\n @Prop() target: string = \"\";\n\n /** Whether chip is not interactive */\n @Prop({ reflect: true }) nonInteractive: boolean = false;\n\n /** Whether remove button should be shown */\n @Prop({ reflect: true }) removable: boolean = false;\n\n /** Variant */\n @Prop({ reflect: true }) variant: \"tag\" | \"filter\" | \"input\" = \"tag\";\n\n /** Size */\n @Prop({ reflect: true }) size: \"default\" | \"small\" | \"large\" = \"default\";\n\n /** Type */\n @Prop({ reflect: true }) type: \"default\" | \"secondary\" | \"important\" = \"default\";\n\n /** Counter */\n @Prop() counter: string = \"\";\n\n /** Label of remove button for screenreaders */\n @Prop() removeLabel: string = \"\";\n\n /** Active */\n @Prop({ reflect: true }) active: boolean = false;\n\n /** Disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Tabindex of link/button */\n @Prop({ attribute: \"a11y-tabindex\" }) a11yTabindex: string;\n\n /** Accessible label for screen readers to replace visible text */\n @Prop({ attribute: \"a11y-label\" }) a11yLabel: string;\n\n /** Id for element which describes the link/button */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = \"\";\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the link/button element.\n * Default value will be taken from `label` prop or default slot.\n */\n @Prop() analyticsId: string;\n\n /**\n * For Adobe Analytics.\n * Will be rendered as value of `s-object-id` attribute to the remove button element.\n * Default value will be taken from `removeLabel` prop.\n */\n @Prop() removeAnalyticsId: string;\n\n @Element() element: HTMLStzhChipElement;\n\n /** Focus menu item */\n @Method()\n async setFocus() {\n this.chip.focus();\n }\n\n /** Chip click event */\n @Event() stzhClick: EventEmitter<StzhChipClickEvent>;\n\n /** Chip remove event */\n @Event() stzhRemove: EventEmitter<StzhChipRemoveEvent>;\n\n /** Focus event */\n @Event() stzhFocus: EventEmitter<StzhChipFocusEvent>;\n\n /** Input blur event */\n @Event() stzhBlur: EventEmitter<StzhChipBlurEvent>;\n\n private chip: HTMLButtonElement | HTMLAnchorElement;\n private text: HTMLElement;\n private focusedByInput: boolean = false;\n\n componentDidRender() {\n requestAnimationFrame(() => {\n this.chip.setAttribute(\"s-object-id\", this.analyticsId || this.text.innerText);\n });\n }\n\n private renderInner(): DocumentFragment {\n return (\n <Fragment>\n <div class=\"stzh-chip__icon-wrapper\">\n {this.icon ?\n <stzh-icon class=\"stzh-chip__icon\" name={this.icon}></stzh-icon>\n :\n <slot name=\"icon\"></slot>\n }\n </div>\n\n <stzh-clamp\n lines={1}\n class=\"stzh-chip__label\"\n ref={(el) => (this.text = el as HTMLElement)}\n >\n {this.label ? this.label : <slot></slot>}\n {this.counter &&\n <span class=\"stzh-chip__vhidden\">\n &nbsp;({this.counter})\n </span>\n }\n </stzh-clamp>\n\n {this.counter &&\n <div class=\"stzh-chip__counter\" aria-hidden=\"true\">\n {this.counter}\n </div>\n }\n </Fragment>\n );\n }\n\n private onRootFocus = () => {\n if (!this.focusedByInput) {\n this.setFocus();\n }\n\n this.focusedByInput = false;\n }\n\n private onFocus = (event: FocusEvent) => {\n this.focusedByInput = true;\n\n const focusEvent = new FocusEvent(\"focus\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(focusEvent);\n this.stzhFocus.emit({\n component: \"stzh-chip\",\n originalEvent: event\n });\n }\n\n private onBlur = (event: FocusEvent) => {\n const blurEvent = new FocusEvent(\"blur\", {\n view: window,\n bubbles: false,\n cancelable: false\n });\n\n this.element.dispatchEvent(blurEvent);\n this.stzhBlur.emit({\n component: \"stzh-chip\",\n originalEvent: event\n });\n }\n\n private onClick = (event: MouseEvent) => {\n this.stzhClick.emit({\n component: \"stzh-chip\",\n originalEvent: event\n });\n }\n\n private onRemoveClick = (event: MouseEvent) => {\n this.stzhRemove.emit({\n component: \"stzh-chip\",\n originalEvent: event\n });\n }\n\n render() {\n const classes = {\n \"stzh-chip\": true,\n \"stzh-chip--is-active\": this.active,\n \"stzh-chip--is-disabled\": this.disabled,\n \"stzh-chip--is-removable\": this.removable,\n \"stzh-chip--has-counter\": !!this.counter,\n [`stzh-chip--type-${this.type}`]: !!this.type,\n [`stzh-chip--size-${this.size}`]: !!this.size,\n [`stzh-chip--${this.variant}`]: !!this.variant\n };\n\n const Chip = this.nonInteractive ? \"div\" :\n this.href ? \"a\" : \"button\";\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes}>\n {this.removable &&\n <button\n class=\"stzh-chip__remove\"\n onClick={this.onRemoveClick}\n disabled={this.disabled}\n aria-label={this.removeLabel}\n type=\"button\"\n s-object-id={this.removeAnalyticsId || this.removeLabel}\n >\n <stzh-icon class=\"stzh-chip__remove-icon\" name=\"close\"></stzh-icon>\n </button>\n }\n\n {this.href ?\n <Chip\n ref={(el) => (this.chip = el as HTMLAnchorElement)}\n class={{\n \"stzh-chip__button\": true,\n \"is-button\": !this.nonInteractive && !this.href,\n \"is-link\": !this.nonInteractive && !!this.href\n }}\n href={this.disabled ? null : this.href}\n target={this.target}\n tabindex={this.a11yTabindex}\n aria-label={this.a11yLabel || null}\n aria-describedby={this.a11yDescribedby || null}\n onClick={this.onClick}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner()}\n </Chip>\n :\n <Chip\n ref={(el) => (this.chip = el as HTMLButtonElement)}\n class={{\n \"stzh-chip__button\": true,\n \"is-button\": !this.nonInteractive && !this.href,\n \"is-link\": !this.nonInteractive && !!this.href\n }}\n disabled={this.disabled}\n type=\"button\"\n tabindex={this.a11yTabindex}\n aria-label={this.a11yLabel || null}\n aria-describedby={this.a11yDescribedby || null}\n onClick={this.onClick}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n >\n {this.renderInner()}\n </Chip>\n }\n </div>\n </Host>\n );\n }\n}\n"]}