@siemens/ix 2.4.0 → 2.4.1

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 (176) hide show
  1. package/components/application-header.js +17 -11
  2. package/components/application-header.js.map +1 -1
  3. package/components/avatar.js +1 -1
  4. package/components/avatar.js.map +1 -1
  5. package/components/dropdown.js +10 -6
  6. package/components/dropdown.js.map +1 -1
  7. package/components/group-item.js +4 -8
  8. package/components/group-item.js.map +1 -1
  9. package/components/ix-basic-navigation.js +16 -10
  10. package/components/ix-basic-navigation.js.map +1 -1
  11. package/components/ix-group.js +29 -24
  12. package/components/ix-group.js.map +1 -1
  13. package/components/ix-map-navigation.js +18 -12
  14. package/components/ix-map-navigation.js.map +1 -1
  15. package/components/ix-pagination.js +3 -3
  16. package/components/ix-pagination.js.map +1 -1
  17. package/components/ix-slider.js +20 -13
  18. package/components/ix-slider.js.map +1 -1
  19. package/components/service.js +2 -2
  20. package/components/service.js.map +1 -1
  21. package/components/tab-item.js +3 -3
  22. package/components/tab-item.js.map +1 -1
  23. package/components/tabs.js +77 -43
  24. package/components/tabs.js.map +1 -1
  25. package/components/tooltip.js +4 -4
  26. package/components/tooltip.js.map +1 -1
  27. package/dist/cjs/ix-application-header.cjs.entry.js +4 -4
  28. package/dist/cjs/ix-application-header.cjs.entry.js.map +1 -1
  29. package/dist/cjs/ix-application.cjs.entry.js +1 -1
  30. package/dist/cjs/ix-avatar_2.cjs.entry.js +1 -1
  31. package/dist/cjs/ix-avatar_2.cjs.entry.js.map +1 -1
  32. package/dist/cjs/ix-basic-navigation.cjs.entry.js +1 -1
  33. package/dist/cjs/ix-dropdown.cjs.entry.js +10 -6
  34. package/dist/cjs/ix-dropdown.cjs.entry.js.map +1 -1
  35. package/dist/cjs/ix-group-context-menu_2.cjs.entry.js +4 -8
  36. package/dist/cjs/ix-group-context-menu_2.cjs.entry.js.map +1 -1
  37. package/dist/cjs/ix-group.cjs.entry.js +29 -23
  38. package/dist/cjs/ix-group.cjs.entry.js.map +1 -1
  39. package/dist/cjs/ix-menu.cjs.entry.js +1 -1
  40. package/dist/cjs/ix-pagination.cjs.entry.js +3 -3
  41. package/dist/cjs/ix-pagination.cjs.entry.js.map +1 -1
  42. package/dist/cjs/ix-pane-layout.cjs.entry.js +1 -1
  43. package/dist/cjs/ix-pane.cjs.entry.js +1 -1
  44. package/dist/cjs/ix-slider.cjs.entry.js +20 -13
  45. package/dist/cjs/ix-slider.cjs.entry.js.map +1 -1
  46. package/dist/cjs/ix-tab-item_2.cjs.entry.js +74 -44
  47. package/dist/cjs/ix-tab-item_2.cjs.entry.js.map +1 -1
  48. package/dist/cjs/ix-tooltip.cjs.entry.js +4 -4
  49. package/dist/cjs/ix-tooltip.cjs.entry.js.map +1 -1
  50. package/dist/cjs/loader.cjs.js +1 -1
  51. package/dist/cjs/{service-a42add5f.js → service-39a8e5fe.js} +3 -3
  52. package/dist/cjs/service-39a8e5fe.js.map +1 -0
  53. package/dist/cjs/siemens-ix.cjs.js +1 -1
  54. package/dist/collection/components/application-header/application-header.js +4 -4
  55. package/dist/collection/components/application-header/application-header.js.map +1 -1
  56. package/dist/collection/components/avatar/avatar.css +42 -0
  57. package/dist/collection/components/dropdown/dropdown.js +10 -6
  58. package/dist/collection/components/dropdown/dropdown.js.map +1 -1
  59. package/dist/collection/components/group/group.js +34 -28
  60. package/dist/collection/components/group/group.js.map +1 -1
  61. package/dist/collection/components/group/test/group.ct.js +39 -1
  62. package/dist/collection/components/group/test/group.ct.js.map +1 -1
  63. package/dist/collection/components/group-item/group-item.css +0 -4
  64. package/dist/collection/components/group-item/group-item.js +9 -12
  65. package/dist/collection/components/group-item/group-item.js.map +1 -1
  66. package/dist/collection/components/pagination/pagination.js +5 -4
  67. package/dist/collection/components/pagination/pagination.js.map +1 -1
  68. package/dist/collection/components/select/test/select.ct.js +1 -1
  69. package/dist/collection/components/select/test/select.ct.js.map +1 -1
  70. package/dist/collection/components/slider/slider.css +1 -1
  71. package/dist/collection/components/slider/slider.js +23 -15
  72. package/dist/collection/components/slider/slider.js.map +1 -1
  73. package/dist/collection/components/slider/test/slider.ct.js +15 -6
  74. package/dist/collection/components/slider/test/slider.ct.js.map +1 -1
  75. package/dist/collection/components/tab-item/tab-item.js +4 -4
  76. package/dist/collection/components/tab-item/tab-item.js.map +1 -1
  77. package/dist/collection/components/tabs/tabs.js +77 -42
  78. package/dist/collection/components/tabs/tabs.js.map +1 -1
  79. package/dist/collection/components/tabs/test/tabs.ct.js +35 -9
  80. package/dist/collection/components/tabs/test/tabs.ct.js.map +1 -1
  81. package/dist/collection/components/tooltip/tooltip.js +13 -8
  82. package/dist/collection/components/tooltip/tooltip.js.map +1 -1
  83. package/dist/collection/components/utils/application-layout/service.js +2 -2
  84. package/dist/collection/components/utils/application-layout/service.js.map +1 -1
  85. package/dist/collection/tests/avatar/avatar.e2e.js +6 -0
  86. package/dist/collection/tests/avatar/avatar.e2e.js.map +1 -1
  87. package/dist/collection/tests/slider/slider.e2e.js +14 -0
  88. package/dist/collection/tests/slider/slider.e2e.js.map +1 -1
  89. package/dist/collection/tests/tabs/tabs.e2e.js +1 -1
  90. package/dist/collection/tests/tabs/tabs.e2e.js.map +1 -1
  91. package/dist/esm/ix-application-header.entry.js +4 -4
  92. package/dist/esm/ix-application-header.entry.js.map +1 -1
  93. package/dist/esm/ix-application.entry.js +1 -1
  94. package/dist/esm/ix-avatar_2.entry.js +1 -1
  95. package/dist/esm/ix-avatar_2.entry.js.map +1 -1
  96. package/dist/esm/ix-basic-navigation.entry.js +1 -1
  97. package/dist/esm/ix-dropdown.entry.js +10 -6
  98. package/dist/esm/ix-dropdown.entry.js.map +1 -1
  99. package/dist/esm/ix-group-context-menu_2.entry.js +4 -8
  100. package/dist/esm/ix-group-context-menu_2.entry.js.map +1 -1
  101. package/dist/esm/ix-group.entry.js +29 -23
  102. package/dist/esm/ix-group.entry.js.map +1 -1
  103. package/dist/esm/ix-menu.entry.js +1 -1
  104. package/dist/esm/ix-pagination.entry.js +3 -3
  105. package/dist/esm/ix-pagination.entry.js.map +1 -1
  106. package/dist/esm/ix-pane-layout.entry.js +1 -1
  107. package/dist/esm/ix-pane.entry.js +1 -1
  108. package/dist/esm/ix-slider.entry.js +20 -13
  109. package/dist/esm/ix-slider.entry.js.map +1 -1
  110. package/dist/esm/ix-tab-item_2.entry.js +74 -44
  111. package/dist/esm/ix-tab-item_2.entry.js.map +1 -1
  112. package/dist/esm/ix-tooltip.entry.js +4 -4
  113. package/dist/esm/ix-tooltip.entry.js.map +1 -1
  114. package/dist/esm/loader.js +1 -1
  115. package/dist/esm/{service-02cc9011.js → service-c7fc628b.js} +3 -3
  116. package/dist/esm/service-c7fc628b.js.map +1 -0
  117. package/dist/esm/siemens-ix.js +1 -1
  118. package/dist/siemens-ix/p-0b4e3779.entry.js +2 -0
  119. package/dist/siemens-ix/p-0b4e3779.entry.js.map +1 -0
  120. package/dist/siemens-ix/p-4df0cdd7.entry.js +2 -0
  121. package/dist/siemens-ix/p-4df0cdd7.entry.js.map +1 -0
  122. package/dist/siemens-ix/{p-96a3a750.entry.js → p-5b135f6b.entry.js} +2 -2
  123. package/dist/siemens-ix/{p-96a3a750.entry.js.map → p-5b135f6b.entry.js.map} +1 -1
  124. package/dist/siemens-ix/{p-29df2e29.entry.js → p-71315e2e.entry.js} +2 -2
  125. package/dist/siemens-ix/p-71315e2e.entry.js.map +1 -0
  126. package/dist/siemens-ix/{p-a536adcb.entry.js → p-a0a44a2b.entry.js} +2 -2
  127. package/dist/siemens-ix/{p-7750e187.entry.js → p-bc2c74c5.entry.js} +2 -2
  128. package/dist/siemens-ix/{p-c389de85.entry.js → p-c33cee36.entry.js} +2 -2
  129. package/dist/siemens-ix/p-d331216f.entry.js +2 -0
  130. package/dist/siemens-ix/p-d331216f.entry.js.map +1 -0
  131. package/dist/siemens-ix/p-d8790ff5.entry.js +2 -0
  132. package/dist/siemens-ix/p-d8790ff5.entry.js.map +1 -0
  133. package/dist/siemens-ix/p-d950c3a8.entry.js +2 -0
  134. package/dist/siemens-ix/p-d950c3a8.entry.js.map +1 -0
  135. package/dist/siemens-ix/{p-112069ca.entry.js → p-dbe8f5e6.entry.js} +2 -2
  136. package/dist/siemens-ix/p-dbe8f5e6.entry.js.map +1 -0
  137. package/dist/siemens-ix/{p-ae7a7af4.entry.js → p-dde7eb80.entry.js} +2 -2
  138. package/dist/siemens-ix/{p-4344ba99.entry.js → p-f318140c.entry.js} +2 -2
  139. package/dist/siemens-ix/p-f318140c.entry.js.map +1 -0
  140. package/dist/siemens-ix/{p-702f9349.js → p-fbe017b7.js} +2 -2
  141. package/dist/siemens-ix/p-fbe017b7.js.map +1 -0
  142. package/dist/siemens-ix/{p-6b928634.entry.js → p-fc5814df.entry.js} +2 -2
  143. package/dist/siemens-ix/siemens-ix.esm.js +1 -1
  144. package/dist/siemens-ix/siemens-ix.esm.js.map +1 -1
  145. package/dist/types/components/application-header/application-header.d.ts +1 -1
  146. package/dist/types/components/dropdown/dropdown.d.ts +1 -0
  147. package/dist/types/components/group/group.d.ts +3 -4
  148. package/dist/types/components/group-item/group-item.d.ts +4 -4
  149. package/dist/types/components/slider/slider.d.ts +3 -3
  150. package/dist/types/components/tab-item/tab-item.d.ts +1 -1
  151. package/dist/types/components/tabs/tabs.d.ts +7 -4
  152. package/dist/types/components/tooltip/tooltip.d.ts +7 -7
  153. package/dist/types/components.d.ts +16 -14
  154. package/hydrate/index.js +153 -109
  155. package/package.json +1 -1
  156. package/dist/cjs/service-a42add5f.js.map +0 -1
  157. package/dist/esm/service-02cc9011.js.map +0 -1
  158. package/dist/siemens-ix/p-112069ca.entry.js.map +0 -1
  159. package/dist/siemens-ix/p-29df2e29.entry.js.map +0 -1
  160. package/dist/siemens-ix/p-315f070d.entry.js +0 -2
  161. package/dist/siemens-ix/p-315f070d.entry.js.map +0 -1
  162. package/dist/siemens-ix/p-4344ba99.entry.js.map +0 -1
  163. package/dist/siemens-ix/p-60c16878.entry.js +0 -2
  164. package/dist/siemens-ix/p-60c16878.entry.js.map +0 -1
  165. package/dist/siemens-ix/p-702f9349.js.map +0 -1
  166. package/dist/siemens-ix/p-c55db6c7.entry.js +0 -2
  167. package/dist/siemens-ix/p-c55db6c7.entry.js.map +0 -1
  168. package/dist/siemens-ix/p-f07110c6.entry.js +0 -2
  169. package/dist/siemens-ix/p-f07110c6.entry.js.map +0 -1
  170. package/dist/siemens-ix/p-fa53933d.entry.js +0 -2
  171. package/dist/siemens-ix/p-fa53933d.entry.js.map +0 -1
  172. /package/dist/siemens-ix/{p-a536adcb.entry.js.map → p-a0a44a2b.entry.js.map} +0 -0
  173. /package/dist/siemens-ix/{p-7750e187.entry.js.map → p-bc2c74c5.entry.js.map} +0 -0
  174. /package/dist/siemens-ix/{p-c389de85.entry.js.map → p-c33cee36.entry.js.map} +0 -0
  175. /package/dist/siemens-ix/{p-ae7a7af4.entry.js.map → p-dde7eb80.entry.js.map} +0 -0
  176. /package/dist/siemens-ix/{p-6b928634.entry.js.map → p-fc5814df.entry.js.map} +0 -0
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/siemens/ix",
8
8
  "directory": "packages/core"
9
9
  },
10
- "version": "2.4.0",
10
+ "version": "2.4.1",
11
11
  "license": "MIT",
12
12
  "description": "Siemens iX Web Components",
13
13
  "main": "dist/index.cjs.js",
@@ -1 +0,0 @@
1
- {"file":"service-a42add5f.js","mappings":";;;;;SAUgB,QAAQ,CACtB,IAAO,EACP,KAAa;IAEb,IAAI,SAAwC,CAAC;IAE7C,OAAO,SAAS,SAAS,CAAC,GAAG,IAAmB;QAC9C,YAAY,CAAC,SAAS,CAAC,CAAC;QAExB,SAAS,GAAG,UAAU,CAAC;YACrB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;SACf,EAAE,KAAK,CAAC,CAAC;KACX,CAAC;AACJ;;;;;;;;;;;;;;ACXA,MAAM,wBAAwB;IAS5B;;QAPA,yDAAsC,CAAC,IAAI,EAAE,IAAI,EAAE,IAA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AQ,CAAC,IAAI,CAAC,EAAE;gBAC9C,eAAe,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;aAC/C;YAED,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;YAC1D,uBAAA,IAAI,0DAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAChD,uBAAA,IAAI,wCAAe,UAAU,MAAA,CAAC;YAC9B,OAAO;SACR;QAED,KAAK,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,gBAAgB,CAAC,OAAO,EAAE,EAAE;YAC5D,IAAI,KAAK,EAAE;gBACT,uBAAA,IAAI,0DAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAChD,uBAAA,IAAI,wCAAe,UAAU,MAAA,CAAC;gBAC9B,MAAM;aACP;SACF;KACF;IAEM,0BAA0B;QAC/B,uBAAA,IAAI,gDAAuB,KAAK,MAAA,CAAC;KAClC;IAEM,yBAAyB;QAC9B,uBAAA,IAAI,gDAAuB,IAAI,MAAA,CAAC;KACjC;IAEM,aAAa,CAAC,UAAsB;QACzC,uBAAA,IAAI,wCAAe,UAAU,MAAA,CAAC;QAC9B,uBAAA,IAAI,0DAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KACjD;IAEM,cAAc,CAAC,WAAyB;QAC7C,uBAAA,IAAI,kDAAyB,WAAW,MAAA,CAAC;QACzC,IAAI,CAAC,QAAQ,EAAE,CAAC;KACjB;CACF;;MAEY,wBAAwB,GAAG,IAAI,wBAAwB;;;;","names":["TypedEvent","breakpoints","matchBreakpoint"],"sources":["src/components/utils/debounce.ts","src/components/utils/application-layout/service.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\ntype AnyFunction = (...args: any[]) => any;\n\nexport function debounce<T extends AnyFunction>(\n func: T,\n delay: number\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout>;\n\n return function debounced(...args: Parameters<T>): void {\n clearTimeout(timeoutId);\n\n timeoutId = setTimeout(() => {\n func(...args);\n }, delay);\n };\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Breakpoint, matchBreakpoint } from '../breakpoints';\nimport { debounce } from '../debounce';\nimport { TypedEvent } from '../typed-event';\n\nclass ApplicationLayoutService {\n // Keep order of breakpoints\n #supportedBreakpoints: Breakpoint[] = ['sm', 'md', 'lg'];\n #breakpointChangeListener = new TypedEvent<Breakpoint>();\n #breakpoint: Breakpoint = 'lg';\n\n #isDetectionEnabled = true;\n debouncedOnResize = debounce(this.onResize.bind(this), 50);\n\n constructor() {\n if (typeof window !== 'undefined') {\n window.addEventListener('resize', this.debouncedOnResize.bind(this));\n this.debouncedOnResize();\n }\n }\n\n get breakpoint() {\n return this.#breakpoint;\n }\n\n get onChange() {\n return this.#breakpointChangeListener;\n }\n\n get isDetectionEnabled() {\n return this.#isDetectionEnabled;\n }\n\n private onResize() {\n if (!this.#isDetectionEnabled) {\n return;\n }\n if (!this.#supportedBreakpoints) {\n return;\n }\n const matchBreakpoints: [Breakpoint, boolean][] = [];\n\n const breakpoints = this.#supportedBreakpoints;\n\n breakpoints.forEach((breakpoint) => {\n const match = matchBreakpoint(breakpoint);\n matchBreakpoints.push([breakpoint, match]);\n });\n\n if (matchBreakpoints.every(([_, match]) => match === false)) {\n let breakPointIndex = 0;\n if (!this.#supportedBreakpoints.includes('lg')) {\n breakPointIndex = matchBreakpoints.length - 1;\n }\n\n const [breakpoint, _] = matchBreakpoints[breakPointIndex];\n this.#breakpointChangeListener.emit(breakpoint);\n this.#breakpoint = breakpoint;\n return;\n }\n\n for (const [breakpoint, match] of matchBreakpoints.reverse()) {\n if (match) {\n this.#breakpointChangeListener.emit(breakpoint);\n this.#breakpoint = breakpoint;\n break;\n }\n }\n }\n\n public disableBreakpointDetection() {\n this.#isDetectionEnabled = false;\n }\n\n public enableBreakpointDetection() {\n this.#isDetectionEnabled = true;\n }\n\n public setBreakpoint(breakpoint: Breakpoint) {\n this.#breakpoint = breakpoint;\n this.#breakpointChangeListener.emit(breakpoint);\n }\n\n public setBreakpoints(breakpoints: Breakpoint[]) {\n this.#supportedBreakpoints = breakpoints;\n this.onResize();\n }\n}\n\nexport const applicationLayoutService = new ApplicationLayoutService();\n"],"version":3}
@@ -1 +0,0 @@
1
- {"file":"service-02cc9011.js","mappings":";;;SAUgB,QAAQ,CACtB,IAAO,EACP,KAAa;IAEb,IAAI,SAAwC,CAAC;IAE7C,OAAO,SAAS,SAAS,CAAC,GAAG,IAAmB;QAC9C,YAAY,CAAC,SAAS,CAAC,CAAC;QAExB,SAAS,GAAG,UAAU,CAAC;YACrB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;SACf,EAAE,KAAK,CAAC,CAAC;KACX,CAAC;AACJ;;;;;;;;;;;;;;ACXA,MAAM,wBAAwB;IAS5B;;QAPA,yDAAsC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAC;QACzD,6DAA4B,IAAI,UAAU,EAAc,EAAC;QACzD,+CAA0B,IAAI,EAAC;QAE/B,uDAAsB,IAAI,EAAC;QAC3B,sBAAiB,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAGzD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YACjC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACrE,IAAI,CAAC,iBAAiB,EAAE,CAAC;SAC1B;KACF;IAED,IAAI,UAAU;QACZ,OAAO,uBAAA,IAAI,4C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,CAAC;gBAChD,uBAAA,IAAI,wCAAe,UAAU,MAAA,CAAC;gBAC9B,MAAM;aACP;SACF;KACF;IAEM,0BAA0B;QAC/B,uBAAA,IAAI,gDAAuB,KAAK,MAAA,CAAC;KAClC;IAEM,yBAAyB;QAC9B,uBAAA,IAAI,gDAAuB,IAAI,MAAA,CAAC;KACjC;IAEM,aAAa,CAAC,UAAsB;QACzC,uBAAA,IAAI,wCAAe,UAAU,MAAA,CAAC;QAC9B,uBAAA,IAAI,0DAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KACjD;IAEM,cAAc,CAAC,WAAyB;QAC7C,uBAAA,IAAI,kDAAyB,WAAW,MAAA,CAAC;QACzC,IAAI,CAAC,QAAQ,EAAE,CAAC;KACjB;CACF;;MAEY,wBAAwB,GAAG,IAAI,wBAAwB;;;;","names":[],"sources":["src/components/utils/debounce.ts","src/components/utils/application-layout/service.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\ntype AnyFunction = (...args: any[]) => any;\n\nexport function debounce<T extends AnyFunction>(\n func: T,\n delay: number\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout>;\n\n return function debounced(...args: Parameters<T>): void {\n clearTimeout(timeoutId);\n\n timeoutId = setTimeout(() => {\n func(...args);\n }, delay);\n };\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Breakpoint, matchBreakpoint } from '../breakpoints';\nimport { debounce } from '../debounce';\nimport { TypedEvent } from '../typed-event';\n\nclass ApplicationLayoutService {\n // Keep order of breakpoints\n #supportedBreakpoints: Breakpoint[] = ['sm', 'md', 'lg'];\n #breakpointChangeListener = new TypedEvent<Breakpoint>();\n #breakpoint: Breakpoint = 'lg';\n\n #isDetectionEnabled = true;\n debouncedOnResize = debounce(this.onResize.bind(this), 50);\n\n constructor() {\n if (typeof window !== 'undefined') {\n window.addEventListener('resize', this.debouncedOnResize.bind(this));\n this.debouncedOnResize();\n }\n }\n\n get breakpoint() {\n return this.#breakpoint;\n }\n\n get onChange() {\n return this.#breakpointChangeListener;\n }\n\n get isDetectionEnabled() {\n return this.#isDetectionEnabled;\n }\n\n private onResize() {\n if (!this.#isDetectionEnabled) {\n return;\n }\n if (!this.#supportedBreakpoints) {\n return;\n }\n const matchBreakpoints: [Breakpoint, boolean][] = [];\n\n const breakpoints = this.#supportedBreakpoints;\n\n breakpoints.forEach((breakpoint) => {\n const match = matchBreakpoint(breakpoint);\n matchBreakpoints.push([breakpoint, match]);\n });\n\n if (matchBreakpoints.every(([_, match]) => match === false)) {\n let breakPointIndex = 0;\n if (!this.#supportedBreakpoints.includes('lg')) {\n breakPointIndex = matchBreakpoints.length - 1;\n }\n\n const [breakpoint, _] = matchBreakpoints[breakPointIndex];\n this.#breakpointChangeListener.emit(breakpoint);\n this.#breakpoint = breakpoint;\n return;\n }\n\n for (const [breakpoint, match] of matchBreakpoints.reverse()) {\n if (match) {\n this.#breakpointChangeListener.emit(breakpoint);\n this.#breakpoint = breakpoint;\n break;\n }\n }\n }\n\n public disableBreakpointDetection() {\n this.#isDetectionEnabled = false;\n }\n\n public enableBreakpointDetection() {\n this.#isDetectionEnabled = true;\n }\n\n public setBreakpoint(breakpoint: Breakpoint) {\n this.#breakpoint = breakpoint;\n this.#breakpointChangeListener.emit(breakpoint);\n }\n\n public setBreakpoints(breakpoints: Breakpoint[]) {\n this.#supportedBreakpoints = breakpoints;\n this.onResize();\n }\n}\n\nexport const applicationLayoutService = new ApplicationLayoutService();\n"],"version":3}
@@ -1 +0,0 @@
1
- {"version":3,"names":["tabItemCss","IxTabItemStyle0","TabItem","tabItemClasses","props","selected","disabled","small","icon","stretched","layout","bottom","placement","top","circle","render","h","Host","key","class","this","rounded","tabIndex","onClick","event","clientEvent","tabClick","emit","nativeEvent","defaultPrevented","stopPropagation","text","counter","hidden","undefined","requestAnimationFrameNoNgZone","callback","__zone_symbol__requestAnimationFrame","requestAnimationFrame","setTimeout","tabsCss","IxTabsStyle0","Tabs","windowStartSize","window","innerWidth","clickAction","timeout","isClick","arrowLeftElement","hostElement","shadowRoot","querySelector","arrowRightElement","onWindowResize","totalItems","getTabs","length","move","Array","from","querySelectorAll","getTab","getTabsWrapper","showArrows","tabWrapper","scrollWidth","Math","ceil","getBoundingClientRect","width","error","showPreviousArrow","scrollActionAmount","showNextArrow","tabWrapperRect","getArrowStyle","condition","opacity","zIndex","amount","click","maxScrollWidth","currentScrollAmount","styles","join","setAttribute","moveTabToView","tab","x","setSelected","index","clickTab","dragStop","selectedChange","dragStart","element","button","tabPositionX","parseFloat","getComputedStyle","left","mousedownPositionX","clientX","dragMove","addEventListener","removeEventListener","tabX","mousedownX","clearTimeout","componentWillLoad","tabs","map","componentDidRender","componentWillRender","previousArrow","Object","assign","style","componentDidLoad","forEach","onTabClick","target","scrollAmount","name"],"sources":["src/components/tab-item/tab-item.scss?tag=ix-tab-item&encapsulation=shadow","src/components/tab-item/tab-item.tsx","src/components/utils/requestAnimationFrame.ts","src/components/tabs/tabs.scss?tag=ix-tabs&encapsulation=shadow","src/components/tabs/tabs.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n@import 'common-variables';\n@import 'mixins/text-truncation';\n@import 'mixins/hover';\n@import 'mixins/shadow-dom/component';\n\n:host {\n @include ix-component;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 10px $large-space;\n line-height: 20px;\n font-size: 14px;\n font-weight: bold;\n background-color: var(--theme-tab--background);\n color: var(--theme-tab--color);\n\n &::after {\n content: '';\n position: absolute;\n background-color: var(--theme-tab-indicator--background);\n width: 100%;\n height: var(--theme-tab-indicator--height);\n left: 0;\n }\n\n .text {\n @include ellipsis;\n\n span,\n span::before {\n pointer-events: none;\n }\n\n vertical-align: middle;\n }\n\n .circle {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 3rem;\n width: 3rem;\n background-color: var(--theme-animated-tab-indicator--background);\n border-radius: 50%;\n border: 2px solid var(--theme-animated-tab-circle--border-color);\n color: var(--theme-an…icon--color);\n cursor: pointer;\n\n &.selected:not(.disabled) {\n background-color: var(--theme-animated-tab-circle--background--selected);\n color: var(--theme-animated-tab-icon--color--selected);\n border-color: var(--theme-animated-tab-circle--border-color--selected);\n\n &:hover {\n background-color: var(\n --theme-animated-tab-circle--background--selected\n );\n }\n }\n\n &:hover {\n background-color: var(--theme-animated-tab-circle--background--hover);\n }\n\n &:active {\n background-color: var(--theme-animated-tab-circle--background--active);\n }\n\n &:active {\n background-color: var(--theme-animated-tab-circle--background--active);\n }\n\n &.disabled {\n background-color: var(--theme-animated-tab-circle--background--disabled);\n border-color: var(--theme-animated-tab-circle--border-color--disabled);\n }\n }\n\n .counter {\n position: absolute;\n z-index: 1;\n height: 16px;\n width: auto;\n background-color: var(--theme-pill-outline--background);\n border: 1px solid var(--theme-tab-pill--border-color);\n border-radius: 100px;\n bottom: 6px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: $tiny-space;\n padding-right: $tiny-space;\n font-size: 12px;\n line-height: 14px;\n color: var(--theme-pill-outline--color);\n cursor: pointer;\n\n &.selected {\n border-color: var(--theme-tab-pill--border-color--selected);\n }\n\n &.disabled {\n border-color: var(--theme-tab-pill--border-color--disabled);\n }\n }\n\n .hidden {\n display: none;\n }\n}\n\n:host(.circle) {\n height: 72px;\n}\n\n:host(.top) {\n &::after {\n top: 0;\n }\n}\n\n:host(.bottom) {\n &::after {\n bottom: 0;\n }\n}\n\n:host(.stretched) {\n flex-basis: 100%;\n width: 100%;\n @include ellipsis;\n}\n\n:host(:hover:not(.circle)) {\n background-color: var(--theme-tab--background--hover);\n color: var(--theme-tab-color-hover);\n cursor: pointer;\n\n &::after {\n background-color: var(--theme-tab-indicator--background--hover);\n }\n}\n\n:host(:active:not(.circle)) {\n background-color: var(--theme-tab--background--active);\n color: var(--theme-tab-color--active);\n\n &::after {\n background-color: var(--theme-tab-indicator--background--active);\n }\n}\n\n:host(:focus-visible) {\n outline: 0px solid var(--focus--border-color);\n\n .circle {\n outline: 1px solid var(--focus--border-color);\n }\n}\n\n:host(:focus-visible:not(.circle)) {\n outline: 1px solid var(--focus--border-color);\n}\n\n:host(.disabled) {\n pointer-events: none;\n color: var(--theme-tab--color--disabled);\n background-color: var(--theme-tab--background--disabled);\n\n &::after {\n background-color: var(--theme-tab-indicator--background--disabled);\n }\n}\n\n:host(.selected:not(.disabled)) {\n background-color: var(--theme-tab--background--selected);\n color: var(--theme-tab--color--selected);\n\n &::after {\n background-color: var(--theme-tab-indicator--background--selected);\n }\n}\n\n:host(.icon) {\n padding: $large-space $small-space;\n}\n\n:host(.small-tab) {\n height: 32px;\n padding: $default-space;\n}\n\n:host(.small-tab.icon) {\n padding: $default-space $tiny-space;\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Component, Event, EventEmitter, h, Host, Prop } from '@stencil/core';\n\nexport type TabClickDetail = {\n nativeEvent: MouseEvent;\n};\n\n@Component({\n tag: 'ix-tab-item',\n styleUrl: 'tab-item.scss',\n shadow: true,\n})\nexport class TabItem {\n /**\n * Set selected tab\n */\n @Prop() selected = false;\n\n /**\n * Set disabled tab\n */\n @Prop() disabled = false;\n\n /**\n * Set small size tab\n */\n @Prop() small = false;\n\n /**\n * Set icon only tab\n */\n @Prop() icon = false;\n\n /**\n * Set rounded tab\n */\n @Prop() rounded = false;\n\n /**\n * Set counter value\n */\n @Prop() counter: number;\n\n /**\n * Set layout width style\n */\n @Prop() layout: 'auto' | 'stretched' = 'auto';\n\n /**\n * Set selected placement\n */\n @Prop() placement: 'bottom' | 'top' = 'bottom';\n\n /**\n * Emitted when the tab is clicked.\n *\n * @since 2.0.0\n */\n @Event() tabClick: EventEmitter<TabClickDetail>;\n\n private tabItemClasses(props: {\n selected: boolean;\n disabled: boolean;\n small: boolean;\n icon: boolean;\n circle: boolean;\n layout: 'auto' | 'stretched';\n placement: 'bottom' | 'top';\n }) {\n return {\n selected: props.selected,\n disabled: props.disabled,\n 'small-tab': props.small,\n icon: props.small,\n stretched: props.layout === 'stretched',\n bottom: props.placement === 'bottom',\n top: props.placement === 'top',\n circle: props.circle,\n };\n }\n\n render() {\n return (\n <Host\n class={this.tabItemClasses({\n selected: this.selected,\n disabled: this.disabled,\n small: this.small,\n icon: this.icon,\n layout: this.layout,\n placement: this.placement,\n circle: this.rounded,\n })}\n tabIndex={0}\n onClick={(event: MouseEvent) => {\n const clientEvent = this.tabClick.emit({\n nativeEvent: event,\n });\n\n if (clientEvent.defaultPrevented) {\n event.stopPropagation();\n }\n }}\n >\n <div\n class={{\n circle: this.rounded,\n text: !this.rounded,\n selected: this.selected,\n disabled: this.disabled,\n }}\n >\n <slot></slot>\n </div>\n <div\n class={{\n counter: true,\n selected: this.selected,\n hidden: !(this.rounded && this.counter !== undefined),\n disabled: this.disabled,\n }}\n >\n {this.counter}\n </div>\n </Host>\n );\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\ndeclare const __zone_symbol__requestAnimationFrame: any;\n\n/**\n * Prevents angular from change detection when requesting an animation frame\n *\n * Credits goes to:\n * https://github.com/ionic-team/ionic-framework/blob/main/core/src/utils/helpers.ts\n */\nexport const requestAnimationFrameNoNgZone = (\n callback: (...args: any[]) => void\n) => {\n if (typeof __zone_symbol__requestAnimationFrame === 'function') {\n return __zone_symbol__requestAnimationFrame(callback);\n }\n if (typeof requestAnimationFrame === 'function') {\n return requestAnimationFrame(callback);\n }\n return setTimeout(callback);\n};\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n@import 'common-variables';\n@import 'mixins/text-truncation';\n@import 'mixins/shadow-dom/component';\n\n:host {\n @include ix-component;\n width: auto;\n display: flex;\n align-items: center;\n position: relative;\n\n .tab-items {\n overflow: hidden;\n scroll-behavior: smooth;\n width: 100%;\n\n .items-content {\n display: flex;\n align-items: center;\n }\n }\n\n .arrow {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n top: 0;\n bottom: 0;\n left: 0;\n margin: auto 0;\n border-radius: 4px;\n color: var(--theme-btn-invisible-primary--color);\n background-color: var(--theme-btn-invisible-primary--background);\n z-index: 2;\n\n &:hover {\n color: var(--theme-btn-invisible-primary--color--hover);\n background-color: var(--theme-btn-invisible-primary--background--hover);\n }\n\n &:active {\n color: var(--theme-btn-invisible-primary--color--active);\n background-color: var(--theme-btn-invisible-primary--background--active);\n }\n\n &.right {\n left: auto;\n right: 0;\n }\n }\n\n .overflow-shadow {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n pointer-events: all;\n\n &.shadow-left {\n mask-image: linear-gradient(90deg, transparent 0px, black 45px);\n }\n\n &.shadow-right {\n mask-image: linear-gradient(\n 90deg,\n black calc(100% - 45px),\n transparent 100%\n );\n }\n\n &.shadow-both {\n mask-image: linear-gradient(\n 90deg,\n transparent 0px,\n black 45px,\n black calc(100% - 45px),\n transparent 100%\n );\n }\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n} from '@stencil/core';\nimport { requestAnimationFrameNoNgZone } from '../utils/requestAnimationFrame';\n\n@Component({\n tag: 'ix-tabs',\n styleUrl: 'tabs.scss',\n shadow: true,\n})\nexport class Tabs {\n @Element() hostElement!: HTMLIxTabsElement;\n\n /**\n * Set tab items to small size\n */\n @Prop() small = false;\n\n /**\n * Set rounded tabs\n */\n @Prop() rounded = false;\n\n /**\n * Set default selected tab by index\n */\n @Prop({ mutable: true }) selected = 0;\n\n /**\n * Set layout width style\n */\n @Prop() layout: 'auto' | 'stretched' = 'auto';\n\n /**\n * Set placement style\n */\n @Prop() placement: 'bottom' | 'top' = 'bottom';\n\n /**\n * `selected` property changed\n *\n * @since 2.0.0\n */\n @Event() selectedChange: EventEmitter<number>;\n\n @State() totalItems = 0;\n @State() currentScrollAmount = 0;\n @State() scrollAmount = 100;\n\n @State() scrollActionAmount = 0;\n\n private windowStartSize = window.innerWidth;\n\n private get arrowLeftElement() {\n return this.hostElement.shadowRoot.querySelector(\n '[data-arrow-left]'\n ) as HTMLElement;\n }\n\n private get arrowRightElement() {\n return this.hostElement.shadowRoot.querySelector(\n '[data-arrow-right]'\n ) as HTMLElement;\n }\n\n private clickAction: {\n timeout: NodeJS.Timeout;\n isClick: boolean;\n } = {\n timeout: null,\n isClick: true,\n };\n\n @Listen('resize', { target: 'window' })\n onWindowResize() {\n this.totalItems = 0;\n this.totalItems = this.getTabs().length;\n\n if (this.windowStartSize === 0)\n return (this.windowStartSize = window.innerWidth);\n this.move(this.windowStartSize - window.innerWidth);\n this.windowStartSize = window.innerWidth;\n }\n\n private getTabs() {\n return Array.from(this.hostElement.querySelectorAll('ix-tab-item'));\n }\n\n private getTab(tabIndex: number) {\n return this.getTabs()[tabIndex];\n }\n\n private getTabsWrapper() {\n return this.hostElement.shadowRoot.querySelector('.items-content');\n }\n\n private showArrows() {\n try {\n const tabWrapper = this.getTabsWrapper();\n return (\n tabWrapper.scrollWidth >\n Math.ceil(tabWrapper.getBoundingClientRect().width) &&\n this.layout === 'auto'\n );\n } catch (error) {\n return false;\n }\n }\n\n private showPreviousArrow() {\n try {\n return this.showArrows() && this.scrollActionAmount < 0;\n } catch (error) {\n return false;\n }\n }\n\n private showNextArrow() {\n try {\n const tabWrapper = this.getTabsWrapper();\n const tabWrapperRect = tabWrapper.getBoundingClientRect();\n\n return (\n this.showArrows() &&\n this.scrollActionAmount >\n (tabWrapper.scrollWidth - tabWrapperRect.width) * -1\n );\n } catch (error) {\n return false;\n }\n }\n\n private getArrowStyle(condition: boolean) {\n return {\n opacity: condition ? '1' : '0',\n zIndex: condition ? '1' : '-1',\n };\n }\n\n private move(amount: number, click = false) {\n const tabWrapper = this.getTabsWrapper();\n const maxScrollWidth =\n (tabWrapper.scrollWidth - tabWrapper.getBoundingClientRect().width) * -1;\n\n amount = this.currentScrollAmount + amount;\n amount = amount > 0 ? 0 : amount < maxScrollWidth ? maxScrollWidth : amount;\n\n const styles = [\n `transform: translateX(${amount}px);`,\n click ? 'transition: all ease-in-out 400ms;' : '',\n ].join('');\n\n tabWrapper.setAttribute('style', styles);\n\n if (click) this.currentScrollAmount = this.scrollActionAmount = amount;\n else this.scrollActionAmount = amount;\n }\n\n private moveTabToView(tabIndex: number) {\n if (!this.showArrows()) return;\n\n const tab = this.getTab(tabIndex).getBoundingClientRect();\n const amount = tab.x * -1;\n this.move(amount, true);\n }\n\n private setSelected(index: number) {\n this.selected = index;\n }\n\n private clickTab(index: number) {\n if (this.dragStop()) {\n return;\n }\n\n const { defaultPrevented } = this.selectedChange.emit(index);\n if (defaultPrevented) {\n return;\n }\n\n this.setSelected(index);\n this.moveTabToView(index);\n }\n\n private dragStart(element: HTMLIxTabItemElement, event: MouseEvent) {\n if (!this.showArrows()) return;\n if (event.button > 0) return;\n\n this.clickAction.timeout =\n this.clickAction.timeout === null\n ? setTimeout(() => (this.clickAction.isClick = false), 300)\n : null;\n\n const tabPositionX = parseFloat(window.getComputedStyle(element).left);\n const mousedownPositionX = event.clientX;\n const move = (event: MouseEvent) =>\n this.dragMove(event, tabPositionX, mousedownPositionX);\n\n window.addEventListener('mouseup', () => {\n window.removeEventListener('mousemove', move, false);\n this.dragStop();\n });\n window.addEventListener('mousemove', move, false);\n }\n\n private dragMove(event: MouseEvent, tabX: number, mousedownX: number) {\n this.move(event.clientX + tabX - mousedownX);\n }\n\n private dragStop() {\n clearTimeout(this.clickAction.timeout);\n this.clickAction.timeout = null;\n\n if (this.clickAction.isClick) return false;\n\n this.currentScrollAmount = this.scrollActionAmount;\n this.clickAction.isClick = true;\n\n return true;\n }\n\n componentWillLoad() {\n const tabs = this.getTabs();\n\n tabs.map((element, index) => {\n if (this.small) element.setAttribute('small', 'true');\n\n if (this.rounded) element.setAttribute('rounded', 'true');\n\n element.setAttribute('layout', this.layout);\n element.setAttribute(\n 'selected',\n index === this.selected ? 'true' : 'false'\n );\n\n element.setAttribute('placement', this.placement);\n });\n }\n\n componentDidRender() {\n const tabs = this.getTabs();\n this.totalItems = tabs.length;\n\n tabs.map((element, index) => {\n element.setAttribute(\n 'selected',\n index === this.selected ? 'true' : 'false'\n );\n });\n }\n\n componentWillRender() {\n requestAnimationFrameNoNgZone(() => {\n const showNextArrow = this.showNextArrow();\n const previousArrow = this.showPreviousArrow();\n\n Object.assign(\n this.arrowLeftElement.style,\n this.getArrowStyle(previousArrow)\n );\n Object.assign(\n this.arrowRightElement.style,\n this.getArrowStyle(showNextArrow)\n );\n });\n }\n\n componentDidLoad() {\n const tabs = this.getTabs();\n tabs.forEach((element) => {\n element.addEventListener('mousedown', (event) =>\n this.dragStart(element, event)\n );\n });\n }\n\n @Listen('tabClick')\n onTabClick(event: CustomEvent) {\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target;\n const tabs = this.getTabs();\n\n tabs.forEach((tab, index) => {\n if (!tab.disabled && tab === target) {\n this.clickTab(index);\n }\n });\n }\n\n render() {\n return (\n <Host>\n <div\n class=\"arrow\"\n data-arrow-left\n onClick={() => this.move(this.scrollAmount, true)}\n >\n <ix-icon name={'chevron-left-small'}></ix-icon>\n </div>\n <div\n class={{\n 'tab-items': true,\n 'overflow-shadow': true,\n 'shadow-left': this.showPreviousArrow(),\n 'shadow-right': this.showNextArrow(),\n 'shadow-both': this.showNextArrow() && this.showPreviousArrow(),\n }}\n >\n <div class=\"items-content\">\n <slot></slot>\n </div>\n </div>\n <div\n class=\"arrow right\"\n data-arrow-right\n onClick={() => this.move(-this.scrollAmount, true)}\n >\n <ix-icon name={'chevron-right-small'}></ix-icon>\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"gEAAA,MAAMA,EAAa,mzIACnB,MAAAC,EAAeD,E,MCmBFE,EAAO,M,0EAIC,M,cAKA,M,WAKH,M,UAKD,M,aAKG,M,mCAUqB,O,eAKD,Q,CAS9B,cAAAC,CAAeC,GASrB,MAAO,CACLC,SAAUD,EAAMC,SAChBC,SAAUF,EAAME,SAChB,YAAaF,EAAMG,MACnBC,KAAMJ,EAAMG,MACZE,UAAWL,EAAMM,SAAW,YAC5BC,OAAQP,EAAMQ,YAAc,SAC5BC,IAAKT,EAAMQ,YAAc,MACzBE,OAAQV,EAAMU,O,CAIlB,MAAAC,GACE,OACEC,EAACC,EAAI,CAAAC,IAAA,2CACHC,MAAOC,KAAKjB,eAAe,CACzBE,SAAUe,KAAKf,SACfC,SAAUc,KAAKd,SACfC,MAAOa,KAAKb,MACZC,KAAMY,KAAKZ,KACXE,OAAQU,KAAKV,OACbE,UAAWQ,KAAKR,UAChBE,OAAQM,KAAKC,UAEfC,SAAU,EACVC,QAAUC,IACR,MAAMC,EAAcL,KAAKM,SAASC,KAAK,CACrCC,YAAaJ,IAGf,GAAIC,EAAYI,iBAAkB,CAChCL,EAAMM,iB,IAIVd,EAAA,OAAAE,IAAA,2CACEC,MAAO,CACLL,OAAQM,KAAKC,QACbU,MAAOX,KAAKC,QACZhB,SAAUe,KAAKf,SACfC,SAAUc,KAAKd,WAGjBU,EAAA,QAAAE,IAAA,8CAEFF,EAAA,OAAAE,IAAA,2CAC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ant","outline","ghost","iconOnly","iconOval","disabled","icon","loading","selected","type","extraClasses","maxCountPages","selectPage","index","selectedPage","count","pageSelected","emit","increase","decrease","getPageButton","baseButtonProps","Object","assign","onClick","ariaAttributes","a11yBoolean","h","BaseButton","renderPageButtons","pagesBeforeOverflow","Math","floor","hasOverflow","hasOverflowStart","hasOverflowEnd","pageButtons","start","end","min","pageCount","max","push","i","class","render","Host","key","advanced","i18nPage","value","onChange","e","Number","parseInt","target","i18nOf","showItemCount","i18nItems","hideListHeader","i18nPlaceholder","i18nSelectListHeader","itemCount","onValueChange","Array","isArray","detail","itemCountChanged","label"],"sources":["src/components/pagination/pagination.scss?tag=ix-pagination&encapsulation=shadow","src/components/pagination/pagination.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2022 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n@import 'common-variables';\n@import 'legacy/components/forms';\n@import '../icon-button/icon-button';\n@import 'mixins/shadow-dom/component';\n\n:host {\n @include ix-component;\n\n &,\n .advanced-pagination,\n .item-count {\n display: inline-flex;\n align-items: center;\n }\n\n .basic-pagination {\n padding: 0 0.125rem;\n }\n\n .advanced-pagination {\n padding: 0 $medium-space;\n }\n\n .page-selection {\n width: 4.125rem;\n text-align: center;\n margin: 0 $small-space;\n -moz-appearance: textfield;\n -webkit-appearance: textfield;\n }\n\n .page-buttons {\n white-space: nowrap;\n }\n\n .total-count {\n white-space: nowrap;\n }\n\n .item-count {\n flex-grow: 1;\n justify-content: flex-end;\n margin-inline-start: $large-space;\n\n ix-select {\n width: 4.5rem;\n margin-inline-start: $large-space;\n }\n }\n\n button {\n width: auto;\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.5rem;\n }\n\n button + button {\n margin-inline-start: 0.125rem;\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2022 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n} from '@stencil/core';\nimport { BaseButton, BaseButtonProps } from '../button/base-button';\nimport { a11yBoolean } from '../utils/a11y';\n\n/**\n * @since 1.5.0\n */\n@Component({\n tag: 'ix-pagination',\n styleUrl: 'pagination.scss',\n shadow: true,\n})\nexport class Pagination {\n private readonly baseButtonConfig: BaseButtonProps = {\n variant: 'secondary',\n outline: false,\n ghost: true,\n iconOnly: true,\n iconOval: false,\n disabled: false,\n icon: '',\n loading: false,\n selected: false,\n type: 'button',\n extraClasses: {\n ['w-auto']: true,\n },\n };\n\n private readonly maxCountPages = 7;\n\n @Element() hostElement!: HTMLIxPaginationElement;\n\n /**\n * Advanced mode\n */\n @Prop() advanced: boolean;\n\n /**\n * Number of items shown at once.\n * Can only be changed in advaced mode.\n */\n @Prop() itemCount = 15;\n\n /**\n * Show item count in advanced mode\n */\n @Prop() showItemCount = true;\n\n /**\n * Total number of pages\n */\n @Prop() count: number;\n\n /**\n * Zero based index of currently selected page\n */\n @Prop({ mutable: true }) selectedPage = 0;\n\n /**\n * i18n\n */\n @Prop() i18nPage = 'Page';\n\n /**\n * i18n\n */\n @Prop() i18nOf = 'of';\n\n /**\n /**\n * i18n\n */\n @Prop() i18nItems = 'Items';\n\n /**\n * Page selection event\n */\n @Event() pageSelected: EventEmitter<number>;\n\n /**\n * Item count change event\n */\n @Event() itemCountChanged: EventEmitter<number>;\n\n private selectPage(index: number) {\n if (index < 0) {\n this.selectedPage = 0;\n } else if (index > this.count - 1) {\n this.selectedPage = this.count - 1;\n } else {\n this.selectedPage = index;\n }\n\n this.pageSelected.emit(this.selectedPage);\n }\n\n private increase() {\n if (this.selectedPage === this.count - 1) {\n return;\n }\n\n this.selectPage(this.selectedPage + 1);\n }\n\n private decrease() {\n if (this.selectedPage === 0) {\n return;\n }\n\n this.selectPage(this.selectedPage - 1);\n }\n\n private getPageButton(index: number) {\n const baseButtonProps: BaseButtonProps = {\n ...this.baseButtonConfig,\n onClick: () => this.selectPage(index),\n selected: this.selectedPage === index,\n ariaAttributes: {\n 'aria-pressed': a11yBoolean(this.selectedPage === index),\n },\n };\n\n return <BaseButton {...baseButtonProps}>{index + 1}</BaseButton>;\n }\n\n private renderPageButtons() {\n const pagesBeforeOverflow = Math.floor(this.maxCountPages / 2);\n const hasOverflow = this.count > this.maxCountPages;\n const hasOverflowStart =\n hasOverflow && this.selectedPage > pagesBeforeOverflow;\n const hasOverflowEnd =\n hasOverflow && this.selectedPage < this.count - pagesBeforeOverflow - 1;\n const pageButtons = [];\n\n let start = 0;\n let end = Math.min(this.count, this.maxCountPages);\n let pageCount = Math.floor((this.maxCountPages - 4) / 2);\n\n if (hasOverflowStart) {\n const baseButtonProps = {\n ...this.baseButtonConfig,\n onClick: () => {\n if (hasOverflowEnd) {\n this.selectPage(this.selectedPage - Math.max(0, 2 * pageCount + 1));\n } else {\n this.selectPage(this.count - this.maxCountPages);\n }\n },\n };\n pageButtons.push(this.getPageButton(0));\n pageButtons.push(<BaseButton {...baseButtonProps}>...</BaseButton>);\n\n if (hasOverflowEnd) {\n start = this.count - this.maxCountPages + 2;\n } else {\n start = this.count - this.maxCountPages + 2;\n end = this.count;\n }\n }\n\n if (hasOverflowEnd) {\n if (hasOverflowStart) {\n start = this.selectedPage - pageCount;\n end = this.selectedPage + pageCount + 1;\n } else {\n end = this.maxCountPages - 2;\n }\n }\n\n for (let i = start; i < end; i++) {\n pageButtons.push(this.getPageButton(i));\n }\n\n if (hasOverflowEnd) {\n const baseButtonProps = {\n ...this.baseButtonConfig,\n onClick: () => {\n if (hasOverflowStart) {\n this.selectPage(this.selectedPage + Math.max(0, 2 * pageCount + 1));\n } else {\n this.selectPage(this.maxCountPages - 1);\n }\n },\n };\n pageButtons.push(<BaseButton {...baseButtonProps}>...</BaseButton>);\n pageButtons.push(this.getPageButton(this.count - 1));\n }\n\n return <span class=\"page-buttons\">{pageButtons}</span>;\n }\n\n render() {\n return (\n <Host>\n <ix-icon-button\n disabled={this.selectedPage === 0}\n ghost\n icon={'chevron-left-small'}\n onClick={() => this.decrease()}\n ></ix-icon-button>\n\n {this.advanced ? (\n <div class=\"advanced-pagination\">\n <ix-typography variant=\"default\">{this.i18nPage}</ix-typography>\n <input\n class=\"form-control page-selection\"\n type=\"number\"\n min=\"1\"\n max={this.count}\n value={this.selectedPage + 1}\n onChange={(e) => {\n const index = Number.parseInt(e.target['value']);\n this.selectPage(index - 1);\n }}\n />\n <span class=\"total-count\">\n <ix-typography variant=\"default\">\n {this.i18nOf} {this.count}\n </ix-typography>\n </span>\n </div>\n ) : (\n <span class=\"basic-pagination\">{this.renderPageButtons()} </span>\n )}\n\n <ix-icon-button\n disabled={this.selectedPage === this.count - 1}\n ghost\n icon={'chevron-right-small'}\n onClick={() => this.increase()}\n ></ix-icon-button>\n\n {this.advanced && this.showItemCount ? (\n <span class=\"item-count\">\n <ix-typography variant=\"default\">{this.i18nItems}</ix-typography>\n <ix-select\n hideListHeader\n i18nPlaceholder=\"\"\n i18nSelectListHeader=\"\"\n value={`${this.itemCount}`}\n onValueChange={(e) => {\n const count = Number.parseInt(\n Array.isArray(e.detail) ? e.detail[0] : e.detail\n );\n\n this.itemCountChanged.emit(count);\n }}\n >\n <ix-select-item label=\"10\" value=\"10\"></ix-select-item>\n <ix-select-item label=\"15\" value=\"15\"></ix-select-item>\n <ix-select-item label=\"20\" value=\"20\"></ix-select-item>\n <ix-select-item label=\"40\" value=\"40\"></ix-select-item>\n <ix-select-item label=\"100\" value=\"100\"></ix-select-item>\n </ix-select>\n </span>\n ) : (\n ''\n )}\n </Host>\n );\n }\n}\n"],"mappings":"mIAAA,MAAMA,EAAgB,uo7BACtB,MAAAC,EAAeD,E,MC4BFE,EAAU,M,uHACJC,KAAAC,iBAAoC,CACnDC,QAAS,YACTC,QAAS,MACTC,MAAO,KACPC,SAAU,KACVC,SAAU,MACVC,SAAU,MACVC,KAAM,GACNC,Q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,KAAKlB,MAAM,OACjCvB,EAAA,kBAAgByC,MAAM,MAAMlB,MAAM,UAE/B,G"}
@@ -1,2 +0,0 @@
1
- import{r as t,h as e,H as i,g as s}from"./p-f87cd962.js";import{c as o,s as r,o as n,b as a,f as c,a as l}from"./p-b3f35666.js";import{O as h}from"./p-0c8a98cd.js";class d{constructor(){this.overlays=new Set}connected(t){this.overlays.add(t)}disconnected(t){this.overlays.delete(t)}present(t){if(t.willPresent&&!t.willPresent()){return}this.dismissOthers(t);t.present()}dismiss(t){if(t.willDismiss&&!t.willDismiss()){return}t.dismiss()}dismissOthers(t){this.overlays.forEach((e=>{if(e!==t){this.dismiss(e)}}))}}class f extends d{}const u=new f;const p=':host{display:inline-block;position:fixed;left:0px;top:0px;z-index:var(--theme-z-index-tooltip);max-width:18.25rem;opacity:0;visibility:collapse !important;overflow-wrap:break-word;border-radius:0.25rem;background-color:var(--theme-tootlip--background);padding:0.375rem 0.75rem 0.375rem 0.875rem;box-shadow:var(--theme-shadow-4)}:host .tooltip-title{display:flex;align-items:center}:host .tooltip-title ::slotted(ix-icon){margin-right:0.35rem}:host(.visible){opacity:1;visibility:visible !important}:host(.visible) .arrow,:host(.visible) .arrow::before{position:absolute;width:12px;height:12px;background:inherit}:host(.visible) .arrow{visibility:hidden}:host(.visible) .arrow::before{visibility:visible;content:"";transform:rotate(45deg);background-color:var(--theme-tootlip--background)}';const m=p;var b=undefined&&undefined.__decorate||function(t,e,i,s){var o=arguments.length,r=o<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s,n;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)if(n=t[a])r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r;return o>3&&r&&Object.defineProperty(e,i,r),r};const y=t=>t!=null?`${t}px`:"";const v=class{constructor(e){t(this,e);this.for=undefined;this.titleContent=undefined;this.interactive=false;this.placement="top";this.showDelay=0;this.hideDelay=50;this.animationFrame=false;this.visible=false}get arrowElement(){return this.hostElement.shadowRoot.querySelector(".arrow")}destroyAutoUpdate(){if(this.disposeAutoUpdate!==undefined){this.disposeAutoUpdate()}}async showTooltip(t){clearTimeout(this.hideTooltipTimeout);await this.applyTooltipPosition(t);this.showTooltipTimeout=setTimeout((()=>{u.present(this);this.applyTooltipPosition(t)}),this.showDelay)}async hideTooltip(){clearTimeout(this.showTooltipTimeout);let t=50;if(this.interactive&&this.hideDelay===t){t=150}this.hideTooltipTimeout=setTimeout((()=>{u.dismiss(this)}),t);this.destroyAutoUpdate()}computeArrowPosition({placement:t,middlewareData:e}){let{x:i,y:s}=e.arrow;if(t.startsWith("top")){return{left:y(i),top:y(s)}}if(t.startsWith("right")){return{left:y(-6),top:y(s)}}if(t.startsWith("bottom")){return{left:y(i),top:y(-6)}}if(t.startsWith("left")){return{right:y(-6),top:y(s)}}}async computeTooltipPosition(t){const e=await o(t,this.hostElement,{strategy:"fixed",placement:this.placement,middleware:[r(),n(12),a({element:this.arrowElement}),c({fallbackStrategy:"initialPlacement",padding:10})]});return e}applyTooltipArrowPosition(t){const e=this.computeArrowPosition(t);Object.assign(this.arrowElement.style,e)}async applyTooltipPosition(t){if(!t){return}return new Promise((e=>{this.disposeAutoUpdate=l(t,this.hostElement,(async()=>{setTimeout((async()=>{const i=await this.computeTooltipPosition(t);if(i.middlewareData.arrow){this.applyTooltipArrowPosition(i)}const{x:s,y:o}=i;Object.assign(this.hostElement.style,{left:s!==null?`${s}px`:"",top:o!==null?`${o}px`:""});e(i)}))}),{ancestorResize:true,ancestorScroll:true,elementResize:true,animationFrame:this.animationFrame})}))}clearHideTimeout(){if(this.interactive){clearTimeout(this.hideTooltipTimeout)}}async queryAnchorElements(){if(typeof this.for==="string"){return Promise.resolve(Array.from(document.querySelectorAll(this.for)))}if(this.for instanceof HTMLElement){return Promise.resolve([this.for])}if(this.for instanceof Promise){const t=await this.for;return[t]}}async registerTriggerListener(){const t=await this.queryAnchorElements();if(this.disposeListener){this.disposeListener()}if(!t){return}t.forEach((t=>{const e=()=>{this.showTooltip(t)};const i=()=>{this.hideTooltip()};const s=()=>{if(this.showTooltipTimeout!==undefined){clearTimeout(this.showTooltipTimeout)}e()};const o=()=>{this.hideTooltip()};t.addEventListener("mouseenter",e);t.addEventListener("mouseleave",i);t.addEventListener("focusin",s);t.addEventListener("focusout",o);this.disposeListener=()=>{t.removeEventListener("mouseenter",e);t.removeEventListener("mouseleave",i);t.removeEventListener("focusin",s);t.removeEventListener("focusout",o)}}))}registerTooltipListener(){const{hostElement:t}=this;t.addEventListener("mouseenter",(()=>this.clearHideTimeout()));t.addEventListener("focusin",(()=>this.clearHideTimeout()));t.addEventListener("mouseleave",(()=>this.hideTooltip()));t.addEventListener("focusout",(()=>this.hideTooltip()))}async onKeydown(t){if(t.code==="Escape"){this.hideTooltip()}}componentWillLoad(){this.registerTriggerListener()}componentDidLoad(){this.observer=new MutationObserver((()=>{this.registerTriggerListener()}));this.observer.observe(document.body,{attributes:true,attributeFilter:["data-ix-tooltip"],childList:true,subtree:true});this.registerTooltipListener()}connectedCallback(){u.connected(this)}disconnectedCallback(){var t;(t=this.observer)===null||t===void 0?void 0:t.disconnect();this.destroyAutoUpdate();u.disconnected(this)}isPresent(){return this.visible}present(){this.visible=true}dismiss(){this.visible=false}render(){return e(i,{key:"990726c5c0bfdbdb0d5d1678ec54b5902d41d1cd",class:{visible:this.visible},role:"tooltip"},e("div",{key:"ecab668bf3f4010329c611b3d44a8103080d185e",class:"tooltip-title"},e("slot",{key:"016c833df9a38916cbd805756c48098d491f5846",name:"title-icon"}),e("ix-typography",{key:"fe0a3fe4e2c9735207e22befc6006700859df2fc",variant:"default-title"},this.titleContent,e("slot",{key:"6fcb3c9a2534922477aeb8b833f4e806d4010b84",name:"title-content"}))),e("div",{key:"fcc689886a4d9651b0f7f23fb71e7d738558fde7",class:"tooltip-content"},e("slot",{key:"610c6bc179044892c550fbfa71313a1d27ee917a"})),e("div",{key:"faf7c2a5d6b6347bd5c4ce9de377680c1ad4f06c",class:"arrow"}))}get hostElement(){return s(this)}};b([h("keydown",(t=>t.visible))],v.prototype,"onKeydown",null);v.style=m;export{v as ix_tooltip};
2
- //# sourceMappingURL=p-315f070d.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["OverlayController","constructor","this","overlays","Set","connected","instance","add","disconnected","delete","present","willPresent","dismissOthers","dismiss","willDismiss","forEach","overlay","TooltipController","tooltipController","tooltipCss","IxTooltipStyle0","numberToPixel","value","Tooltip","arrowElement","hostElement","shadowRoot","querySelector","destroyAutoUpdate","disposeAutoUpdate","undefined","showTooltip","anchorElement","clearTimeout","hideTooltipTimeout","applyTooltipPosition","showTooltipTimeout","setTimeout","showDelay","hideTooltip","hideDelay","interactive","computeArrowPosition","placement","middlewareData","x","y","arrow","startsWith","left","top","right","computeTooltipPosition","target","computeResponse","computePosition","strategy","middleware","shift","offset","element","flip","fallbackStrategy","padding","applyTooltipArrowPosition","arrowPosition","Object","assign","style","Promise","resolve","autoUpdate","async","ancestorResize","ancestorScroll","elementResize","animationFrame","clearHideTimeout","queryAnchorElements","for","Array","from","document","querySelectorAll","HTMLElement","registerTriggerListener","triggerElementList","disposeListener","onMouseEnter","onMouseLeave","onFocusIn","onFocusOut","addEventListener","removeEventListener","registerTooltipListener","onKeydown","event","code","componentWillLoad","componentDidLoad","observer","MutationObserver","observe","body","attributes","attributeFilter","childList","subtree","connectedCallback","disconnectedCallback","_a","disconnect","isPresent","visible","render","h","Host","key","class","role","name","variant","titleContent","__decorate","OnListener","self"],"sources":["src/components/utils/overlay.ts","src/components/tooltip/tooltip-controller.ts","src/components/tooltip/tooltip.scss?tag=ix-tooltip&encapsulation=shadow","src/components/tooltip/tooltip.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { IxComponent } from '../utils/internal';\n\nexport interface IxOverlayComponent extends IxComponent {\n isPresent(): boolean;\n\n willPresent?(): boolean;\n willDismiss?(): boolean;\n\n present(): void;\n dismiss(): void;\n}\n\nexport class OverlayController {\n overlays: Set<IxOverlayComponent> = new Set();\n\n connected(instance: IxOverlayComponent): void {\n this.overlays.add(instance);\n }\n\n disconnected(instance: IxOverlayComponent): void {\n this.overlays.delete(instance);\n }\n\n present(instance: IxOverlayComponent): void {\n if (instance.willPresent && !instance.willPresent()) {\n return;\n }\n this.dismissOthers(instance);\n instance.present();\n }\n\n dismiss(instance: IxOverlayComponent): void {\n if (instance.willDismiss && !instance.willDismiss()) {\n return;\n }\n instance.dismiss();\n }\n\n private dismissOthers(instance: IxOverlayComponent): void {\n this.overlays.forEach((overlay) => {\n if (overlay !== instance) {\n this.dismiss(overlay);\n }\n });\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { OverlayController } from '../utils/overlay';\n\nclass TooltipController extends OverlayController {}\n\nexport const tooltipController = new TooltipController();\n",":host {\n display: inline-block;\n position: fixed;\n left: 0px;\n top: 0px;\n z-index: var(--theme-z-index-tooltip);\n\n max-width: 18.25rem;\n\n opacity: 0;\n visibility: collapse !important;\n overflow-wrap: break-word;\n\n border-radius: 0.25rem;\n background-color: var(--theme-tootlip--background);\n padding: 0.375rem 0.75rem 0.375rem 0.875rem;\n\n box-shadow: var(--theme-shadow-4);\n\n .tooltip-title {\n display: flex;\n align-items: center;\n\n ::slotted(ix-icon) {\n margin-right: 0.35rem;\n }\n }\n}\n\n:host(.visible) {\n opacity: 1;\n visibility: visible !important;\n}\n\n:host(.visible) {\n .arrow,\n .arrow::before {\n position: absolute;\n width: 12px;\n height: 12px;\n background: inherit;\n }\n\n .arrow {\n visibility: hidden;\n }\n\n .arrow::before {\n visibility: visible;\n content: '';\n transform: rotate(45deg);\n background-color: var(--theme-tootlip--background);\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport {\n arrow,\n autoUpdate,\n computePosition,\n ComputePositionReturn,\n flip,\n offset,\n shift,\n} from '@floating-ui/dom';\nimport {\n Component,\n Element,\n h,\n Host,\n Method,\n Prop,\n State,\n} from '@stencil/core';\nimport { OnListener } from '../utils/listener';\nimport { tooltipController } from './tooltip-controller';\nimport { IxOverlayComponent } from '../utils/overlay';\n\ntype ArrowPosition = {\n top?: string;\n left?: string;\n right?: string;\n};\n\nconst numberToPixel = (value: number) => (value != null ? `${value}px` : '');\n\n/**\n * @slot title-icon - Icon of tooltip title\n * @slot title-content - Content of tooltip title\n *\n * @since 1.4.0\n */\n@Component({\n tag: 'ix-tooltip',\n styleUrl: 'tooltip.scss',\n shadow: true,\n})\nexport class Tooltip implements IxOverlayComponent {\n /**\n * CSS selector for hover trigger element e.g. `for=\"[data-my-custom-select]\"`\n */\n @Prop() for: string | HTMLElement | Promise<HTMLElement>;\n\n /**\n * Title of the tooltip\n */\n @Prop() titleContent: string;\n\n /**\n * Define if the user can access the tooltip via mouse.\n */\n @Prop() interactive = false;\n\n /**\n * Initial placement of the tooltip. If the placement don\"t have enough space,\n * the tooltip will placed on another location.\n *\n * @since 1.5.0\n */\n @Prop() placement: 'top' | 'right' | 'bottom' | 'left' = 'top';\n\n /** @internal */\n @Prop() showDelay = 0;\n\n /** @internal */\n @Prop() hideDelay = 50;\n\n /** @internal */\n @Prop() animationFrame = false;\n\n @State() visible = false;\n\n @Element() hostElement: HTMLIxTooltipElement;\n\n private observer: MutationObserver;\n private hideTooltipTimeout: NodeJS.Timeout;\n private showTooltipTimeout: NodeJS.Timeout;\n private disposeAutoUpdate?: () => void;\n private disposeListener: () => void;\n\n private get arrowElement(): HTMLElement {\n return this.hostElement.shadowRoot.querySelector('.arrow');\n }\n\n private destroyAutoUpdate() {\n if (this.disposeAutoUpdate !== undefined) {\n this.disposeAutoUpdate();\n }\n }\n\n /** @internal */\n @Method()\n async showTooltip(anchorElement: any) {\n clearTimeout(this.hideTooltipTimeout);\n await this.applyTooltipPosition(anchorElement);\n\n this.showTooltipTimeout = setTimeout(() => {\n tooltipController.present(this);\n // Need to compute and apply tooltip position after initial render,\n // because arrow has no valid bounding rect before that\n this.applyTooltipPosition(anchorElement);\n }, this.showDelay);\n }\n\n /** @internal */\n @Method()\n async hideTooltip() {\n clearTimeout(this.showTooltipTimeout);\n let hideDelay = 50;\n\n if (this.interactive && this.hideDelay === hideDelay) {\n hideDelay = 150;\n }\n\n this.hideTooltipTimeout = setTimeout(() => {\n tooltipController.dismiss(this);\n }, hideDelay);\n this.destroyAutoUpdate();\n }\n\n private computeArrowPosition({\n placement,\n middlewareData,\n }: ComputePositionReturn): ArrowPosition {\n let { x, y } = middlewareData.arrow;\n\n if (placement.startsWith('top')) {\n return {\n left: numberToPixel(x),\n top: numberToPixel(y),\n };\n }\n\n if (placement.startsWith('right')) {\n return {\n left: numberToPixel(-6),\n top: numberToPixel(y),\n };\n }\n\n if (placement.startsWith('bottom')) {\n return {\n left: numberToPixel(x),\n top: numberToPixel(-6),\n };\n }\n\n if (placement.startsWith('left')) {\n return {\n right: numberToPixel(-6),\n top: numberToPixel(y),\n };\n }\n }\n\n private async computeTooltipPosition(target: Element) {\n const computeResponse = await computePosition(target, this.hostElement, {\n strategy: 'fixed',\n placement: this.placement,\n middleware: [\n shift(),\n offset(12),\n arrow({\n element: this.arrowElement,\n }),\n flip({\n fallbackStrategy: 'initialPlacement',\n padding: 10,\n }),\n ],\n });\n return computeResponse;\n }\n\n private applyTooltipArrowPosition(computeResponse: ComputePositionReturn) {\n const arrowPosition = this.computeArrowPosition(computeResponse);\n Object.assign(this.arrowElement.style, arrowPosition);\n }\n\n private async applyTooltipPosition(target: Element) {\n if (!target) {\n return;\n }\n\n return new Promise<ComputePositionReturn>((resolve) => {\n this.disposeAutoUpdate = autoUpdate(\n target,\n this.hostElement,\n async () => {\n setTimeout(async () => {\n const computeResponse = await this.computeTooltipPosition(target);\n\n if (computeResponse.middlewareData.arrow) {\n this.applyTooltipArrowPosition(computeResponse);\n }\n\n const { x, y } = computeResponse;\n Object.assign(this.hostElement.style, {\n left: x !== null ? `${x}px` : '',\n top: y !== null ? `${y}px` : '',\n });\n\n resolve(computeResponse);\n });\n },\n {\n ancestorResize: true,\n ancestorScroll: true,\n elementResize: true,\n animationFrame: this.animationFrame,\n }\n );\n });\n }\n\n private clearHideTimeout() {\n if (this.interactive) {\n clearTimeout(this.hideTooltipTimeout);\n }\n }\n\n private async queryAnchorElements(): Promise<Array<HTMLElement> | undefined> {\n if (typeof this.for === 'string') {\n return Promise.resolve(Array.from(document.querySelectorAll(this.for)));\n }\n\n if (this.for instanceof HTMLElement) {\n return Promise.resolve([this.for]);\n }\n\n if (this.for instanceof Promise) {\n const element = await this.for;\n return [element];\n }\n }\n\n private async registerTriggerListener() {\n const triggerElementList = await this.queryAnchorElements();\n\n if (this.disposeListener) {\n this.disposeListener();\n }\n\n if (!triggerElementList) {\n return;\n }\n\n triggerElementList.forEach((element) => {\n const onMouseEnter = () => {\n this.showTooltip(element);\n };\n\n const onMouseLeave = () => {\n this.hideTooltip();\n };\n\n const onFocusIn = () => {\n if (this.showTooltipTimeout !== undefined) {\n clearTimeout(this.showTooltipTimeout);\n }\n\n onMouseEnter();\n };\n\n const onFocusOut = () => {\n this.hideTooltip();\n };\n\n element.addEventListener('mouseenter', onMouseEnter);\n element.addEventListener('mouseleave', onMouseLeave);\n element.addEventListener('focusin', onFocusIn);\n element.addEventListener('focusout', onFocusOut);\n\n this.disposeListener = () => {\n element.removeEventListener('mouseenter', onMouseEnter);\n element.removeEventListener('mouseleave', onMouseLeave);\n element.removeEventListener('focusin', onFocusIn);\n element.removeEventListener('focusout', onFocusOut);\n };\n });\n }\n\n private registerTooltipListener() {\n const { hostElement } = this;\n hostElement.addEventListener('mouseenter', () => this.clearHideTimeout());\n hostElement.addEventListener('focusin', () => this.clearHideTimeout());\n\n hostElement.addEventListener('mouseleave', () => this.hideTooltip());\n hostElement.addEventListener('focusout', () => this.hideTooltip());\n }\n\n @OnListener<Tooltip>('keydown', (self) => self.visible)\n async onKeydown(event: KeyboardEvent) {\n if (event.code === 'Escape') {\n this.hideTooltip();\n }\n }\n\n componentWillLoad() {\n this.registerTriggerListener();\n }\n\n componentDidLoad() {\n this.observer = new MutationObserver(() => {\n this.registerTriggerListener();\n });\n\n this.observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['data-ix-tooltip'],\n childList: true,\n subtree: true,\n });\n\n this.registerTooltipListener();\n }\n\n connectedCallback() {\n tooltipController.connected(this);\n }\n\n disconnectedCallback() {\n this.observer?.disconnect();\n this.destroyAutoUpdate();\n tooltipController.disconnected(this);\n }\n\n isPresent(): boolean {\n return this.visible;\n }\n\n present(): void {\n this.visible = true;\n }\n\n dismiss(): void {\n this.visible = false;\n }\n\n render() {\n return (\n <Host\n class={{\n visible: this.visible,\n }}\n role=\"tooltip\"\n >\n <div class={'tooltip-title'}>\n <slot name=\"title-icon\"></slot>\n <ix-typography variant=\"default-title\">\n {this.titleContent}\n <slot name=\"title-content\"></slot>\n </ix-typography>\n </div>\n <div class={'tooltip-content'}>\n <slot></slot>\n </div>\n <div class=\"arrow\"></div>\n </Host>\n );\n }\n}\n"],"mappings":"0KAoBaA,EAAb,WAAAC,GACEC,KAAAC,SAAoC,IAAIC,G,CAExC,SAAAC,CAAUC,GACRJ,KAAKC,SAASI,IAAID,E,CAGpB,YAAAE,CAAaF,GACXJ,KAAKC,SAASM,OAAOH,E,CAGvB,OAAAI,CAAQJ,GACN,GAAIA,EAASK,cAAgBL,EAASK,cAAe,CACnD,M,CAEFT,KAAKU,cAAcN,GACnBA,EAASI,S,CAGX,OAAAG,CAAQP,GACN,GAAIA,EAASQ,cAAgBR,EAASQ,cAAe,CACnD,M,CAEFR,EAASO,S,CAGH,aAAAD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BAAiB,KACnCnG,KAAKmF,yBAAyB,IAGhCnF,KAAKkG,SAASE,QAAQpB,SAASqB,KAAM,CACnCC,WAAY,KACZC,gBAAiB,CAAC,mBAClBC,UAAW,KACXC,QAAS,OAGXzG,KAAK4F,yB,CAGP,iBAAAc,GACE1F,EAAkBb,UAAUH,K,CAG9B,oBAAA2G,G,OACEC,EAAA5G,KAAKkG,YAAQ,MAAAU,SAAA,SAAAA,EAAEC,aACf7G,KAAK0B,oBACLV,EAAkBV,aAAaN,K,CAGjC,SAAA8G,GACE,OAAO9G,KAAK+G,O,CAGd,OAAAvG,GACER,KAAK+G,QAAU,I,CAGjB,OAAApG,GACEX,KAAK+G,QAAU,K,CAGjB,MAAAC,GACE,OACEC,EAACC,EAAI,CAAAC,IAAA,2CACHC,MAAO,CACLL,QAAS/G,KAAK+G,SAEhBM,KAAK,WAELJ,EAAA,OAAAE,IAAA,2CAAKC,MAAO,iBACVH,EAAA,QAAAE,IAAA,2CAAMG,KAAK,eACXL,EAAA,iBAAAE,IAAA,2CAAeI,QAAQ,iBACpBvH,KAAKwH,aACNP,EAAA,QAAAE,IAAA,2CAAMG,KAAK,oBAGfL,EAAA,OAAAE,IAAA,2CAAKC,MAAO,mBACVH,EAAA,QAAAE,IAAA,8CAEFF,EAAA,OAAAE,IAAA,2CAAKC,MAAM,U,oCAjEXK,EAAA,CADLC,EAAoB,WAAYC,GAASA,EAAKZ,W"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["hasDropdownItemWrapperImplemented","item","getDropdownItemElement","undefined","DropdownController","constructor","this","dropdowns","Map","submenuIds","isWindowListenerActive","connected","dropdown","addOverlayListeners","set","getId","discoverAllSubmenus","discoverSubmenus","disconnected","delete","forEach","discoverSubmenu","present","isPresent","willPresent","getAssignedSubmenuIds","dismissChildren","uid","childIds","id","dismiss","get","willDismiss","dismissAll","ignoreBehaviorForIds","ignoreRelatedDropdowns","preventClosing","closeBehavior","shouldIgnore","includes","path","buildComposedPath","Set","length","skipRelatedDropdown","has","dismissOthers","add","pathIncludesTrigger","eventTargets","eventTarget","HTMLElement","hasAttribute","pathIncludesDropdown","find","element","tagName","ruleKey","Object","keys","key","window","addEventListener","event","hasTrigger","composedPath","hasDropdown","addDisposableEventListener","eventType","callback","removeEventListener","dropdownController","dropdownCss","IxDropdownStyle0","sequenceId","Dropdown","autoUpdateCleanup","localUId","assignedSubmenu","focusDropdownItemBind","focusDropdownItem","bind","itemObserver","MutationObserver","arrowFocusController","items","dropdownItems","connectedCallback","trigger","registerListener","cacheSubmenuId","stopImmediatePropagation","preventDefault","detail","indexOf","push","disconnectedCallback","disposeClickListener","disposeKeyListener","show","defaultPrevented","showChanged","emit","Array","from","hostElement","querySelectorAll","slotElement","shadowRoot","querySelector","addEventListenersFor","_a","call","_b","toggleController","triggerElement","_c","setAttribute","dispatchEvent","CustomEvent","bubbles","composed","cancelable","registerKeyListener","document","activeElement","setTimeout","resolveElement","el","findElement","checkForSubmenuAnchor","dropdownItem","isSubMenu","style","zIndex","Promise","resolve","selector","observer","disconnect","observe","body","childList","subtree","changedShow","newShow","anchorElement","anchor","applyDropdownPosition","ArrowFocusController","dropdownRef","changedTrigger","newTriggerValue","isAnchorSubmenu","closest","isSubmenu","positionConfig","strategy","positioningStrategy","middleware","suppressAutomaticPlacement","flip","fallbackStrategy","placement","inline","shift","offset","autoUpdate","async","computeResponse","computePosition","assign","top","left","transform","Math","round","x","y","overwriteDropdownStyle","overwriteStyle","triggerRef","ancestorResize","ancestorScroll","elementResize","index","requestAnimationFrame","focus","componentDidLoad","componentDidRender","isTriggerElement","onDropdownClick","target","ignoreRelatedSubmenu","updatePosition","render","h","Host","ref","class","overflow","margin","minWidth","position","role","onClick","display","header"],"sources":["src/components/dropdown/dropdown-controller.ts","src/components/dropdown/dropdown.scss?tag=ix-dropdown&encapsulation=shadow","src/components/dropdown/dropdown.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { IxComponent } from '../utils/internal';\nexport type CloseBehavior = 'inside' | 'outside' | 'both' | boolean;\n\nexport interface DropdownInterface extends IxComponent {\n closeBehavior: CloseBehavior;\n discoverAllSubmenus: boolean;\n\n getAssignedSubmenuIds(): string[];\n getId(): string;\n\n discoverSubmenu(): void;\n\n isPresent(): boolean;\n\n willPresent?(): boolean;\n willDismiss?(): boolean;\n\n present(): void;\n dismiss(): void;\n}\n\nexport function hasDropdownItemWrapperImplemented(\n item: unknown\n): item is DropdownItemWrapper {\n return (\n item &&\n (item as DropdownItemWrapper).getDropdownItemElement !== undefined &&\n typeof (item as DropdownItemWrapper).getDropdownItemElement === 'function'\n );\n}\n\nexport interface DropdownItemWrapper {\n getDropdownItemElement(): Promise<HTMLIxDropdownItemElement>;\n}\n\ntype SubmenuIds = Record<string, string[]>;\n\nclass DropdownController {\n private dropdowns: Map<string, DropdownInterface> = new Map<\n string,\n DropdownInterface\n >();\n private submenuIds: SubmenuIds = {};\n\n private isWindowListenerActive = false;\n\n connected(dropdown: DropdownInterface) {\n if (!this.isWindowListenerActive) {\n this.addOverlayListeners();\n }\n this.dropdowns.set(dropdown.getId(), dropdown);\n\n if (dropdown.discoverAllSubmenus) {\n this.discoverSubmenus();\n }\n }\n\n disconnected(dropdown: DropdownInterface) {\n this.dropdowns.delete(dropdown.getId());\n }\n\n discoverSubmenus() {\n this.dropdowns.forEach((dropdown) => {\n dropdown.discoverSubmenu();\n });\n }\n\n present(dropdown: DropdownInterface) {\n if (!dropdown.isPresent() && dropdown.willPresent()) {\n this.submenuIds[dropdown.getId()] = dropdown.getAssignedSubmenuIds();\n dropdown.present();\n }\n }\n\n dismissChildren(uid: string) {\n const childIds = this.submenuIds[uid] || [];\n for (const id of childIds) {\n this.dismiss(this.dropdowns.get(id));\n }\n }\n\n dismiss(dropdown: DropdownInterface) {\n if (dropdown.isPresent() && dropdown.willDismiss()) {\n this.dismissChildren(dropdown.getId());\n dropdown.dismiss();\n delete this.submenuIds[dropdown.getId()];\n }\n }\n\n dismissAll(\n ignoreBehaviorForIds: string[] = [],\n ignoreRelatedDropdowns = false\n ) {\n this.dropdowns.forEach((dropdown) => {\n const preventClosing =\n dropdown.closeBehavior === 'inside' || dropdown.closeBehavior === false;\n\n const shouldIgnore = ignoreBehaviorForIds.includes(dropdown.getId());\n const path = this.buildComposedPath(dropdown.getId(), new Set<string>());\n\n if (ignoreBehaviorForIds.length > 0 && ignoreRelatedDropdowns) {\n let skipRelatedDropdown = false;\n\n ignoreBehaviorForIds.forEach((id) => {\n if (path.has(id)) {\n skipRelatedDropdown = true;\n return;\n }\n });\n\n if (!skipRelatedDropdown) {\n return;\n }\n }\n\n if (!shouldIgnore && preventClosing) {\n return;\n }\n\n this.dismiss(dropdown);\n });\n }\n\n dismissOthers(uid: string) {\n let path = this.buildComposedPath(uid, new Set<string>());\n path.add(uid);\n\n this.dropdowns.forEach((dropdown) => {\n if (\n dropdown.closeBehavior !== 'inside' &&\n dropdown.closeBehavior !== false &&\n !path.has(dropdown.getId())\n ) {\n this.dismiss(dropdown);\n }\n });\n }\n\n pathIncludesTrigger(eventTargets: EventTarget[]) {\n for (let eventTarget of eventTargets) {\n if (eventTarget instanceof HTMLElement) {\n if (eventTarget.hasAttribute('data-ix-dropdown-trigger')) {\n return eventTarget;\n }\n }\n }\n\n return;\n }\n\n private pathIncludesDropdown(eventTargets: EventTarget[]) {\n return !!eventTargets.find(\n (element: HTMLElement) => element.tagName === 'IX-DROPDOWN'\n );\n }\n\n private buildComposedPath(id: string, path: Set<string>): Set<string> {\n if (this.submenuIds[id]) {\n path.add(id);\n }\n\n for (const ruleKey of Object.keys(this.submenuIds)) {\n if (this.submenuIds[ruleKey].includes(id)) {\n this.buildComposedPath(ruleKey, path).forEach((key) => path.add(key));\n }\n }\n\n return path;\n }\n\n private addOverlayListeners() {\n this.isWindowListenerActive = true;\n\n window.addEventListener('click', (event: PointerEvent) => {\n const hasTrigger = this.pathIncludesTrigger(event.composedPath());\n const hasDropdown = this.pathIncludesDropdown(event.composedPath());\n\n if (!hasTrigger && !hasDropdown) {\n this.dismissAll();\n }\n });\n\n window.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n this.dismissAll([...this.dropdowns.keys()]);\n }\n });\n }\n}\n\nexport const addDisposableEventListener = (\n element: Element | Window | Document,\n eventType: string,\n callback: EventListenerOrEventListenerObject\n) => {\n element.addEventListener(eventType, callback);\n\n return () => {\n element.removeEventListener(eventType, callback);\n };\n};\n\nexport const addDisposableEventListenerAsArray = (\n listener: {\n element: Element | Window | Document;\n eventType: string;\n callback: EventListenerOrEventListenerObject;\n }[]\n) => {\n const disposables = listener.map(({ callback, element, eventType }) =>\n addDisposableEventListener(element, eventType, callback)\n );\n\n return () => disposables.forEach((dispose) => dispose());\n};\n\nexport const dropdownController = new DropdownController();\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n@import 'common-variables';\n\n@import 'legacy/mixins/fonts';\n@import 'mixins/text-truncation';\n@import 'mixins/shadow-dom/component';\n\n:host {\n background-color: var(--theme-color-2);\n border-radius: var(--theme-default-border-radius);\n @include ix-component;\n min-width: 0px;\n z-index: var(--theme-z-index-dropdown);\n box-shadow: var(--theme-shadow-4);\n\n padding: 0.25rem 0px;\n\n .dropdown-header {\n display: flex;\n align-items: center;\n height: $large-control-height;\n color: var(--theme-menu-header--color);\n padding: 0 $default-space;\n }\n}\n\n:host(.overflow) {\n max-height: 50vh;\n overflow-y: auto;\n}\n\n:host(:not(.show)) {\n display: none;\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n autoUpdate,\n computePosition,\n ComputePositionConfig,\n flip,\n inline,\n offset,\n shift,\n} from '@floating-ui/dom';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Method,\n Prop,\n Watch,\n} from '@stencil/core';\nimport { ComponentInterface } from '@stencil/core/internal';\nimport { ArrowFocusController } from '../utils/focus';\nimport {\n addDisposableEventListener,\n CloseBehavior,\n dropdownController,\n DropdownInterface,\n hasDropdownItemWrapperImplemented,\n} from './dropdown-controller';\nimport { AlignedPlacement } from './placement';\n\nlet sequenceId = 0;\n\n@Component({\n tag: 'ix-dropdown',\n styleUrl: 'dropdown.scss',\n shadow: true,\n})\nexport class Dropdown implements ComponentInterface, DropdownInterface {\n @Element() hostElement!: HTMLIxDropdownElement;\n\n /**\n * Suppress the automatic placement of the dropdown.\n *\n * @since 2.0.0\n */\n @Prop() suppressAutomaticPlacement = false;\n\n /**\n * Show dropdown\n */\n @Prop({ mutable: true, reflect: true }) show = false;\n\n /**\n * Define an element that triggers the dropdown.\n * A trigger can either be a string that will be interpreted as id attribute or a DOM element.\n */\n @Prop() trigger: string | HTMLElement | Promise<HTMLElement>;\n\n /**\n * Define an anchor element\n */\n @Prop() anchor: string | HTMLElement;\n\n /**\n * Controls if the dropdown will be closed in response to a click event depending on the position of the event relative to the dropdown.\n * If the dropdown is a child of another one, it will be closed with the parent, regardless of its own close behavior.\n */\n @Prop() closeBehavior: CloseBehavior = 'both';\n\n /**\n * Placement of the dropdown\n */\n @Prop() placement: AlignedPlacement = 'bottom-start';\n\n /**\n * Position strategy\n */\n @Prop() positioningStrategy: 'absolute' | 'fixed' = 'fixed';\n\n /**\n * An optional header shown at the top of the dropdown\n */\n @Prop() header?: string;\n\n /**\n * Move dropdown along main axis of alignment\n *\n * @internal\n */\n @Prop() offset: {\n mainAxis?: number;\n crossAxis?: number;\n alignmentAxis?: number;\n };\n\n /**\n * @internal\n */\n @Prop() overwriteDropdownStyle: (delegate: {\n dropdownRef: HTMLElement;\n triggerRef?: HTMLElement;\n }) => Promise<Partial<CSSStyleDeclaration>>;\n\n /**\n * @internal\n * If initialisation of this dropdown is expected to be defered submenu discovery will have to be re-run globally by the controller.\n * This property indicates the need for that to the controller.\n */\n @Prop() discoverAllSubmenus = false;\n\n /** @internal */\n @Prop() ignoreRelatedSubmenu = false;\n\n /**\n * Fire event after visibility of dropdown has changed\n */\n @Event() showChanged: EventEmitter<boolean>;\n\n private autoUpdateCleanup: () => void = null;\n\n private triggerElement?: Element;\n private anchorElement?: Element;\n\n private dropdownRef: HTMLElement;\n private localUId = `dropdown-${sequenceId++}`;\n private assignedSubmenu: string[] = [];\n\n private arrowFocusController: ArrowFocusController;\n private focusDropdownItemBind = this.focusDropdownItem.bind(this);\n\n private itemObserver = new MutationObserver(() => {\n this.arrowFocusController.items = this.dropdownItems;\n });\n\n connectedCallback(): void {\n dropdownController.connected(this);\n\n if (this.trigger != undefined) {\n this.registerListener(this.trigger);\n }\n }\n\n @Listen('ix-assign-sub-menu')\n cacheSubmenuId(event: CustomEvent<string>) {\n event.stopImmediatePropagation();\n event.preventDefault();\n\n const { detail } = event;\n\n if (this.assignedSubmenu.indexOf(detail) === -1) {\n this.assignedSubmenu.push(detail);\n }\n }\n\n disconnectedCallback() {\n dropdownController.dismiss(this);\n dropdownController.disconnected(this);\n\n if (this.disposeClickListener) {\n this.disposeClickListener();\n }\n\n if (this.disposeKeyListener) {\n this.disposeKeyListener();\n }\n\n if (this.autoUpdateCleanup) {\n this.autoUpdateCleanup();\n }\n }\n\n getAssignedSubmenuIds() {\n return this.assignedSubmenu;\n }\n\n isPresent() {\n return this.show;\n }\n\n present() {\n this.show = true;\n }\n\n dismiss() {\n this.show = false;\n }\n\n getId() {\n return this.localUId;\n }\n\n willDismiss() {\n const { defaultPrevented } = this.showChanged.emit(false);\n return !defaultPrevented;\n }\n\n willPresent() {\n const { defaultPrevented } = this.showChanged.emit(true);\n return !defaultPrevented;\n }\n\n get dropdownItems() {\n return Array.from(this.hostElement.querySelectorAll('ix-dropdown-item'));\n }\n\n get slotElement() {\n return this.hostElement.shadowRoot.querySelector('slot');\n }\n\n private disposeClickListener?: () => void;\n private disposeKeyListener?: () => void;\n\n private addEventListenersFor() {\n this.disposeClickListener?.();\n this.disposeKeyListener?.();\n\n const toggleController = () => {\n if (!this.isPresent()) {\n dropdownController.present(this);\n } else {\n dropdownController.dismiss(this);\n }\n\n dropdownController.dismissOthers(this.getId());\n };\n\n this.disposeClickListener = addDisposableEventListener(\n this.triggerElement,\n 'click',\n (event: PointerEvent) => {\n if (!event.defaultPrevented) {\n toggleController();\n }\n }\n );\n\n this.triggerElement?.setAttribute(\n 'data-ix-dropdown-trigger',\n this.localUId\n );\n }\n\n /** @internal */\n @Method()\n async discoverSubmenu() {\n this.triggerElement?.dispatchEvent(\n new CustomEvent('ix-assign-sub-menu', {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: this.localUId,\n })\n );\n }\n\n private registerKeyListener() {\n if (!this.triggerElement) {\n return;\n }\n\n this.disposeKeyListener = addDisposableEventListener(\n this.triggerElement,\n 'keydown',\n (event: KeyboardEvent) => {\n if (event.key !== 'ArrowDown') {\n return;\n }\n\n if (document.activeElement !== this.triggerElement) {\n return;\n }\n\n dropdownController.present(this);\n\n setTimeout(() => {\n this.focusDropdownItem(0);\n });\n }\n );\n }\n\n private async registerListener(\n element: string | HTMLElement | Promise<HTMLElement>\n ) {\n this.triggerElement = await this.resolveElement(element);\n if (this.triggerElement) {\n this.addEventListenersFor();\n this.discoverSubmenu();\n }\n }\n\n private async resolveElement(\n element: string | HTMLElement | Promise<HTMLElement>\n ) {\n const el = await this.findElement(element);\n\n return this.checkForSubmenuAnchor(el);\n }\n\n private async checkForSubmenuAnchor(element: Element) {\n if (!element) {\n return null;\n }\n\n if (hasDropdownItemWrapperImplemented(element)) {\n const dropdownItem = await element.getDropdownItemElement();\n dropdownItem.isSubMenu = true;\n this.hostElement.style.zIndex = `var(--theme-z-index-dropdown)`;\n }\n\n if (element.tagName === 'IX-DROPDOWN-ITEM') {\n (element as HTMLIxDropdownItemElement).isSubMenu = true;\n this.hostElement.style.zIndex = `var(--theme-z-index-dropdown)`;\n }\n\n return element;\n }\n\n private findElement(\n element: string | HTMLElement | Promise<HTMLElement>\n ): Promise<Element> {\n if (element instanceof Promise) {\n return element;\n }\n\n if (typeof element === 'object') {\n return Promise.resolve(element);\n }\n\n if (typeof element != 'string') {\n return;\n }\n\n const selector = `#${element}`;\n return new Promise((resolve) => {\n if (document.querySelector(selector)) {\n return resolve(document.querySelector(selector));\n }\n\n const observer = new MutationObserver(() => {\n if (document.querySelector(selector)) {\n resolve(document.querySelector(selector));\n observer.disconnect();\n }\n });\n\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n });\n }\n\n @Watch('show')\n async changedShow(newShow: boolean) {\n if (newShow) {\n this.anchorElement = await (this.anchor\n ? this.resolveElement(this.anchor)\n : this.resolveElement(this.trigger));\n\n if (this.anchorElement) {\n this.applyDropdownPosition();\n }\n\n this.arrowFocusController = new ArrowFocusController(\n this.dropdownItems,\n this.dropdownRef,\n this.focusDropdownItemBind\n );\n\n this.itemObserver.observe(this.dropdownRef, {\n childList: true,\n subtree: true,\n });\n\n this.registerKeyListener();\n } else {\n this.arrowFocusController?.disconnect();\n this.itemObserver.disconnect();\n this.disposeKeyListener?.();\n }\n }\n\n @Watch('trigger')\n changedTrigger(newTriggerValue: string | HTMLElement | Promise<HTMLElement>) {\n this.registerListener(newTriggerValue);\n }\n\n private isAnchorSubmenu(): boolean {\n if (!hasDropdownItemWrapperImplemented(this.anchorElement)) {\n // Is no official dropdown-item, but check if any dropdown-item\n // is placed somewhere up the DOM\n return !!this.anchorElement?.closest('ix-dropdown-item');\n }\n\n return true;\n }\n\n private async applyDropdownPosition() {\n if (!this.show) {\n return;\n }\n if (!this.anchorElement) {\n return;\n }\n if (!this.dropdownRef) {\n return;\n }\n const isSubmenu = this.isAnchorSubmenu();\n\n let positionConfig: Partial<ComputePositionConfig> = {\n strategy: this.positioningStrategy,\n middleware: [],\n };\n\n if (!this.suppressAutomaticPlacement) {\n positionConfig.middleware.push(\n flip({ fallbackStrategy: 'initialPlacement' })\n );\n }\n\n positionConfig.placement = isSubmenu ? 'right-start' : this.placement;\n\n positionConfig.middleware = [\n ...positionConfig.middleware,\n inline(),\n shift(),\n ];\n\n if (this.offset) {\n positionConfig.middleware.push(offset(this.offset));\n }\n\n if (this.autoUpdateCleanup) {\n this.autoUpdateCleanup();\n this.autoUpdateCleanup = null;\n }\n\n this.autoUpdateCleanup = autoUpdate(\n this.anchorElement,\n this.dropdownRef,\n async () => {\n const computeResponse = await computePosition(\n this.anchorElement,\n this.dropdownRef,\n positionConfig\n );\n Object.assign(this.dropdownRef.style, {\n top: '0',\n left: '0',\n transform: `translate(${Math.round(computeResponse.x)}px,${Math.round(\n computeResponse.y\n )}px)`,\n });\n if (this.overwriteDropdownStyle) {\n const overwriteStyle = await this.overwriteDropdownStyle({\n dropdownRef: this.dropdownRef,\n triggerRef: this.triggerElement as HTMLElement,\n });\n\n Object.assign(this.dropdownRef.style, overwriteStyle);\n }\n },\n {\n ancestorResize: true,\n ancestorScroll: true,\n elementResize: true,\n }\n );\n }\n\n private focusDropdownItem(index: number) {\n requestAnimationFrame(() => {\n this.dropdownItems[index]?.shadowRoot.querySelector('button').focus();\n });\n }\n\n async componentDidLoad() {\n this.changedTrigger(this.trigger);\n }\n\n async componentDidRender() {\n await this.applyDropdownPosition();\n this.anchorElement = await (this.anchor\n ? this.resolveElement(this.anchor)\n : this.resolveElement(this.trigger));\n }\n\n private isTriggerElement(element: HTMLElement) {\n const trigger = !!element.hasAttribute('data-ix-dropdown-trigger');\n\n return trigger;\n }\n\n private onDropdownClick(event: PointerEvent) {\n const target = dropdownController.pathIncludesTrigger(event.composedPath());\n if (target) {\n if (target !== this.triggerElement) {\n event.preventDefault();\n }\n\n if (this.isTriggerElement(target)) {\n if (this.closeBehavior === 'outside') {\n event.preventDefault();\n }\n return;\n }\n }\n\n if (\n !event.defaultPrevented &&\n (this.closeBehavior === 'inside' || this.closeBehavior === 'both')\n ) {\n dropdownController.dismissAll([this.getId()], this.ignoreRelatedSubmenu);\n return;\n }\n\n dropdownController.dismissOthers(this.getId());\n }\n\n /**\n * Update position of dropdown\n */\n @Method()\n async updatePosition() {\n this.applyDropdownPosition();\n }\n\n render() {\n return (\n <Host\n data-ix-dropdown={this.localUId}\n ref={(ref) => (this.dropdownRef = ref)}\n class={{\n 'dropdown-menu': true,\n show: this.show,\n overflow: true,\n }}\n style={{\n margin: '0',\n minWidth: '0px',\n position: this.positioningStrategy,\n }}\n role=\"list\"\n onClick={(event: PointerEvent) => this.onDropdownClick(event)}\n >\n <div style={{ display: 'contents' }}>\n {this.header && <div class=\"dropdown-header\">{this.header}</div>}\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"+KA8BgBA,EACdC,GAEA,OACEA,GACCA,EAA6BC,yBAA2BC,kBACjDF,EAA6BC,yBAA2B,UAEpE,CAQA,MAAME,EAAN,WAAAC,GACUC,KAAAC,UAA4C,IAAIC,IAIhDF,KAAAG,WAAyB,GAEzBH,KAAAI,uBAAyB,K,CAEjC,SAAAC,CAAUC,GACR,IAAKN,KAAKI,uBAAwB,CAChCJ,KAAKO,qB,CAEPP,KAAKC,UAAUO,IAAIF,EAASG,QAASH,GAErC,GAAIA,EAASI,oBAAqB,CAChCV,KAAKW,kB,EAIT,YAAAC,CAAaN,GACXN,KAAKC,UAAUY,OAAOP,EAASG,Q,CAGjC,gBAAAE,GACEX,KAAKC,UAAUa,SAASR,IACtBA,EAASS,iBAAiB,G,CAI9B,OAAAC,CAAQV,GACN,IAAKA,EAASW,aAAeX,EAASY,cAAe,CACnDlB,KAAKG,WAAWG,EAASG,SAAWH,EAASa,wBAC7Cb,EAASU,S,EAIb,eAAAI,CAAgBC,GACd,MAAMC,EAAWtB,KAAKG,WAAWkB,IAAQ,GACzC,IAAK,MAAME,KAAMD,EAAU,CACzBtB,KAAKwB,QAAQxB,KAAKC,UAAUwB,IAAIF,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,KAAKkF,S,CAGvB,gBAAAsG,CAAiBvI,GACvB,MAAMiC,IAAYjC,EAAQH,aAAa,4BAEvC,OAAOoC,C,CAGD,eAAAuG,CAAgBhI,GACtB,MAAMiI,EAASzH,EAAmBvB,oBAAoBe,EAAME,gBAC5D,GAAI+H,EAAQ,CACV,GAAIA,IAAW1L,KAAK6G,eAAgB,CAClCpD,EAAM6B,gB,CAGR,GAAItF,KAAKwL,iBAAiBE,GAAS,CACjC,GAAI1L,KAAK+B,gBAAkB,UAAW,CACpC0B,EAAM6B,gB,CAER,M,EAIJ,IACG7B,EAAMqC,mBACN9F,KAAK+B,gBAAkB,UAAY/B,KAAK+B,gBAAkB,QAC3D,CACAkC,EAAmBtC,WAAW,CAAC3B,KAAKS,SAAUT,KAAK2L,sBACnD,M,CAGF1H,EAAmBzB,cAAcxC,KAAKS,Q,CAOxC,oBAAMmL,GACJ5L,KAAK8I,uB,CAGP,MAAA+C,GACE,OACEC,EAACC,EAAI,CAAAzI,IAAA,8DACetD,KAAKuE,SACvByH,IAAMA,GAAShM,KAAKgJ,YAAcgD,EAClCC,MAAO,CACL,gBAAiB,KACjBpG,KAAM7F,KAAK6F,KACXqG,SAAU,MAEZnE,MAAO,CACLoE,OAAQ,IACRC,SAAU,MACVC,SAAUrM,KAAKwJ,qBAEjB8C,KAAK,OACLC,QAAU9I,GAAwBzD,KAAKyL,gBAAgBhI,IAEvDqI,EAAA,OAAAxI,IAAA,2CAAKyE,MAAO,CAAEyE,QAAS,aACpBxM,KAAKyM,QAAUX,EAAA,OAAAxI,IAAA,2CAAK2I,MAAM,mBAAmBjM,KAAKyM,QACnDX,EAAA,QAAAxI,IAAA,8C"}
@@ -1,2 +0,0 @@
1
- import{r as t,c as e,h as r,H as a,g as o}from"./p-f87cd962.js";import{b as i}from"./p-4f8ac3bf.js";import{O as s}from"./p-0c8a98cd.js";const n=':host{display:flex;flex-direction:column;min-height:2rem;--thumb-size:1rem;--value:0;--trace-start:0;--trace-end:0;--trace-reference:0;--trace-reference-color:var(--theme-color-8);--trace-color:var(--theme-color-dynamic);--tick-color:var(--theme-color-8);--tick-color--active:var(--theme-color-dynamic);--track-color:var(--theme-color-component-4);}:host *,:host *::after,:host *::before{box-sizing:border-box}:host ::-webkit-scrollbar-button{display:none}@-moz-document url-prefix(){:host *{scrollbar-color:var(--theme-scrollbar-thumb--background) var(--theme-scrollbar-track--background);scrollbar-width:thin}}:host ::-webkit-scrollbar{width:0.5rem;height:0.5rem}:host ::-webkit-scrollbar-track{border-radius:5px;background:var(--theme-scrollbar-track--background)}:host ::-webkit-scrollbar-track:hover{background:var(--theme-scrollbar-track--background--hover)}:host ::-webkit-scrollbar-thumb{border-radius:5px;background:var(--theme-scrollbar-thumb--background)}:host ::-webkit-scrollbar-thumb:hover{background:var(--theme-scrollbar-thumb--background--hover)}:host ::-webkit-scrollbar-corner{display:none}:host input[type=range]{position:absolute;top:50%;transform:translateY(-50%);left:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;cursor:pointer;width:100%;height:1rem;margin:0}:host input[type=range].trace::before{content:"";position:absolute;display:block;z-index:-1;width:calc(7px + 100% * var(--trace-end) - 16px * var(--trace-end) - (7px + 100% * var(--trace-start) - 16px * var(--trace-start)));left:calc(7px + 100% * var(--trace-start) - 16px * var(--trace-start));height:4px;background-color:var(--trace-color);top:50%;transform:translateY(-50%)}:host input[type=range].trace::after{content:"";position:absolute;display:block;width:2px;height:16px;background-color:var(--trace-reference-color);top:50%;transform:translateY(-50%);left:calc(7px + 100% * var(--trace-reference) - 16px * var(--trace-reference))}:host input[type=range]::-webkit-slider-runnable-track{background:transparent;height:0.25rem}:host input[type=range]::-moz-range-track{background:transparent;height:0.25rem}:host input[type=range i]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:-6px}:host input[type=range i]::-moz-range-thumb{border:none;border-radius:0}:host input[type=range]::-webkit-slider-thumb{border-radius:100px;background-color:var(--theme-color-dynamic);height:var(--thumb-size);width:var(--thumb-size);-webkit-transition:all var(--theme-default-time) ease-in-out;transition:all var(--theme-default-time) ease-in-out;z-index:10}:host input[type=range]::-moz-range-thumb{border-radius:100px;background-color:var(--theme-color-dynamic);height:var(--thumb-size);width:var(--thumb-size);-moz-transition:all var(--theme-default-time) ease-in-out;transition:all var(--theme-default-time) ease-in-out;z-index:10}:host input[type=range]:hover::-webkit-slider-thumb{transform:scale(1.2);background-color:var(--theme-color-dynamic)}:host input[type=range]:hover::-moz-range-thumb{transform:scale(1.2);background-color:var(--theme-color-dynamic)}:host input[type=range]:active::-webkit-slider-thumb{transform:scale(1.2);background-color:var(--theme-color-dynamic)}:host input[type=range]:active::-moz-range-thumb{transform:scale(1.2);background-color:var(--theme-color-dynamic)}:host input[type=range]:focus{outline:none}:host input[type=range]:focus-visible::-webkit-slider-thumb{outline:1px solid var(--theme-color-focus-bdr);outline-offset:0.125rem}:host input[type=range]:focus-visible::-moz-range-thumb{outline:1px solid var(--theme-color-focus-bdr);outline-offset:0.125rem}:host .ticks{display:flex;position:relative;top:50%;transform:translateY(-50%)}:host .ticks .tick{display:block;position:absolute;width:8px;height:8px;background-color:var(--tick-color);border-radius:100px;top:50%;transform:translateY(-50%);left:calc(var(--tick-value) * 100% - 4px)}:host .ticks .tick.tick-active{background-color:var(--tick-color--active)}:host .slider{position:relative;display:block;width:100%;height:1.5rem}:host .track{position:absolute;background-color:var(--track-color);height:4px;width:calc(100% - 1rem);margin-left:0.5rem;top:50%;transform:translateY(-50%);left:0px}:host .thumb{display:block;position:absolute;background-color:transparent;height:1rem;width:1rem;border-radius:100px;left:0px;top:50%;transform:translateY(-50%)}:host .hide-tooltip{display:none}:host .label{display:flex;position:relative;align-items:center;justify-content:space-between;width:100%;margin-top:0.5rem;min-height:0px}:host .label-start{margin-left:0.5rem}:host .label-end{margin-right:0.5rem}:host .label-error{margin-left:0.5rem}:host(.error){--trace-color:var(--theme-color-alarm-40);--tick-color--active:var(--theme-color-alarm)}:host(.error) input[type=range]::-webkit-slider-thumb{background-color:var(--theme-color-alarm)}:host(.error) input[type=range]::-moz-range-thumb{background-color:var(--theme-color-alarm)}:host(.disabled){pointer-events:none;--track-color:var(--theme-color-component-3);--trace-color:var(--theme-color-3);--tick-color:var(--theme-color-7);--tick-color--active:var(--theme-color-7)}:host(.disabled) input[type=range]::-webkit-slider-thumb{background-color:var(--theme-color-7)}:host(.disabled) input[type=range]::-moz-range-thumb{background-color:var(--theme-color-7)}';const c=n;var l=undefined&&undefined.__decorate||function(t,e,r,a){var o=arguments.length,i=o<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,r):a,s;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")i=Reflect.decorate(t,e,r,a);else for(var n=t.length-1;n>=0;n--)if(s=t[n])i=(o<3?s(i):o>3?s(e,r,i):s(e,r))||i;return o>3&&i&&Object.defineProperty(e,r,i),i};function h(t,e,r){if(e<t){return t}else if(e>r){return r}else{return e}}const d=class{constructor(r){t(this,r);this.valueChange=e(this,"valueChange",7);this.step=undefined;this.min=0;this.max=100;this.value=0;this.marker=undefined;this.trace=false;this.traceReference=0;this.disabled=false;this.error=undefined;this.rangeInput=0;this.rangeMin=0;this.rangeMax=100;this.rangeTraceReference=0;this.showTooltip=false}get tooltip(){return this.hostElement.shadowRoot.querySelector("ix-tooltip")}get pseudoThumb(){return this.hostElement.shadowRoot.querySelector(".thumb")}get slider(){return this.hostElement.shadowRoot.getElementById("slider")}onShowTooltipChange(){if(this.showTooltip){this.tooltip.showTooltip(this.pseudoThumb);return}this.tooltip.hideTooltip()}componentWillLoad(){this.a11yAttributes=i(this.hostElement,["role","aria-valuemin","aria-valuemax","aria-valuenow"]);this.updateRangeVariables()}updateRangeVariables(){this.rangeInput=h(this.min,this.value,this.max);this.rangeTraceReference=h(this.min,this.traceReference,this.max);this.rangeMin=Math.min(this.min,this.max);this.rangeMax=Math.max(this.min,this.max)}onInput(t){t.stopPropagation();const e=parseInt(this.slider.value);if(!isNaN(e)){this.rangeInput=e;this.emitInputEvent()}}emitInputEvent(){this.valueChange.emit(this.rangeInput)}isMarkerActive(t){const e=Math.min(this.traceReference,this.rangeInput);const r=Math.max(this.traceReference,this.rangeInput);const a=t;return a>=e&&a<=r}onPointerUp(){this.showTooltip=false}render(){const t=this.rangeMax-this.rangeMin;let e=(this.rangeTraceReference-this.rangeMin)/t;let o=(this.rangeInput-this.rangeMin)/t;const i=o-e;let s=e;let n=o;if(i<=0){s=o;n=e}return r(a,{key:"ebd23d56f5fe53cc4db2c05ade808fa58cc49886",class:{disabled:this.disabled,error:!!this.error},onPointerDown:()=>setTimeout((()=>this.showTooltip=true))},r("div",{key:"d32acfbde1e7d4a4b388b8d7ea5bfd8b8d0207e0",class:"slider"},r("div",{key:"dc7ec76891a22c313c079f333b9f90d8f8e6c3a6",class:"track"},r("div",{key:"29abcd581432484795ca44b099437bde798f5941",class:"thumb",style:{left:`calc(${o} * 100% - 8px)`}}),r("div",{key:"fa077ac5d24ea90356688992b5cd75d898cbda05",class:"ticks"},this.marker?this.marker.map((e=>{if(e>this.max||e<this.min){return}let a=(e-this.rangeMin)/t;return r("div",{class:{tick:true,"tick-active":this.isMarkerActive(e)&&this.trace},style:{"--tick-value":`${a}`}})})):null)),r("input",Object.assign({key:"5f5885ebad1e149e23424ccd353070dcf0c138f6",id:"slider",type:"range",list:this.marker?"markers":undefined,step:this.step,min:this.min,max:this.max,value:this.rangeInput,tabindex:this.disabled?-1:0,onInput:t=>this.onInput(t),style:{"--value":`${o}`,"--trace-reference":`${e}`,"--trace-start":`${s}`,"--trace-end":`${n}`},class:{trace:this.trace&&e!==o},onFocus:()=>{this.showTooltip=true},onBlur:()=>{this.showTooltip=false},role:"slider","aria-valuenow":this.rangeInput,"aria-valuemin":this.min,"aria-valuemax":this.max},this.a11yAttributes)),r("ix-tooltip",{key:"d8251a14514f40c06ae43c2c245cbac584051865",class:{"hide-tooltip":!this.showTooltip},animationFrame:true},this.rangeInput)),r("div",{key:"a8917d620aa49c5f114f2b38c9caf3d373372ba2",class:"label"},r("div",{key:"59c1c607f4ef3c330a75910015869df5b27e831c",class:"label-start"},r("slot",{key:"cb7414d304ca1f46b92bbfbd6681f027796ff65b",name:"label-start"})),r("div",{key:"40953ef4339938b9f8d36690a7a1ce7054db02fb",class:"label-end"},r("slot",{key:"2b4a62eba114d8abc4603c82804860240453ece3",name:"label-end"}))),this.error?r("ix-typography",{class:"label-error",color:"alarm"},this.error):null)}get hostElement(){return o(this)}static get watchers(){return{showTooltip:["onShowTooltipChange"],value:["updateRangeVariables"],max:["updateRangeVariables"],min:["updateRangeVariables"],traceReference:["updateRangeVariables"]}}};l([s("pointerup",(t=>t.showTooltip))],d.prototype,"onPointerUp",null);d.style=c;export{d as ix_slider};
2
- //# sourceMappingURL=p-60c16878.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["sliderCss","IxSliderStyle0","between","min","value","max","Slider","tooltip","this","hostElement","shadowRoot","querySelector","pseudoThumb","slider","getElementById","onShowTooltipChange","showTooltip","hideTooltip","componentWillLoad","a11yAttributes","a11yHostAttributes","updateRangeVariables","rangeInput","rangeTraceReference","traceReference","rangeMin","Math","rangeMax","onInput","event","stopPropagation","parseInt","isNaN","emitInputEvent","valueChange","emit","isMarkerActive","markerValue","start","end","onPointerUp","render","range","traceReferenceInPercentage","valueInPercentage","distance","traceStart","traceEnd","h","Host","key","class","disabled","error","onPointerDown","setTimeout","style","left","marker","map","tick","trace","Object","assign","id","type","list","undefined","step","tabindex","onFocus","onBlur","role","animationFrame","name","color","__decorate","OnListener","self"],"sources":["src/components/slider/slider.scss?tag=ix-slider&encapsulation=shadow","src/components/slider/slider.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n@import 'mixins/shadow-dom/component';\n\n@mixin track {\n // Chrome, Safari, Opera, and Edge Chromium\n input[type='range']::-webkit-slider-runnable-track {\n @content;\n }\n\n // Firefox\n input[type='range']::-moz-range-track {\n @content;\n }\n}\n\n@mixin clear-browser-thumb {\n // Chrome, Safari, Opera, and Edge Chromium\n input[type='range' i]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n margin-top: -6px;\n }\n\n // Firefox\n input[type='range' i]::-moz-range-thumb {\n border: none;\n border-radius: 0;\n }\n}\n\n@mixin thumb {\n // Chrome, Safari, Opera, and Edge Chromium\n input[type='range']::-webkit-slider-thumb {\n @content;\n }\n\n // Firefox\n input[type='range']::-moz-range-thumb {\n @content;\n }\n}\n\n@mixin thumb-hover {\n // Chrome, Safari, Opera, and Edge Chromium\n input[type='range']:hover::-webkit-slider-thumb {\n @content;\n }\n\n // Firefox\n input[type='range']:hover::-moz-range-thumb {\n @content;\n }\n}\n\n@mixin thumb-active {\n // Chrome, Safari, Opera, and Edge Chromium\n input[type='range']:active::-webkit-slider-thumb {\n @content;\n }\n\n // Firefox\n input[type='range']:active::-moz-range-thumb {\n @content;\n }\n}\n\n@mixin thumb-focus {\n input[type='range']:focus {\n outline: none;\n }\n\n // Chrome, Safari, Opera, and Edge Chromium\n input[type='range']:focus-visible::-webkit-slider-thumb {\n @content;\n }\n\n // Firefox\n input[type='range']:focus-visible::-moz-range-thumb {\n @content;\n }\n}\n\n:host {\n @include ix-component;\n display: flex;\n flex-direction: column;\n min-height: 2rem;\n --thumb-size: 1rem;\n --value: 0;\n --trace-start: 0;\n --trace-end: 0;\n --trace-reference: 0;\n --trace-reference-color: var(--theme-color-8);\n --trace-color: var(--theme-color-dynamic);\n --tick-color: var(--theme-color-8);\n --tick-color--active: var(--theme-color-dynamic);\n --track-color: var(--theme-color-component-4);\n\n input[type='range'] {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n left: 0;\n appearance: none;\n background: transparent;\n cursor: pointer;\n width: 100%;\n height: 1rem;\n margin: 0;\n }\n\n // Trace line\n input[type='range'].trace::before {\n content: '';\n position: absolute;\n display: block;\n z-index: -1;\n\n width: calc(\n calc(7px + calc(100% * var(--trace-end)) - calc(16px * var(--trace-end))) -\n calc(\n 7px + calc(100% * var(--trace-start)) -\n calc(16px * var(--trace-start))\n )\n );\n\n left: calc(\n 7px + calc(100% * var(--trace-start)) - calc(16px * var(--trace-start))\n );\n\n height: 4px;\n background-color: var(--trace-color);\n top: 50%;\n transform: translateY(-50%);\n }\n\n // Trace reference\n input[type='range'].trace::after {\n content: '';\n position: absolute;\n display: block;\n width: 2px;\n height: 16px;\n background-color: var(--trace-reference-color);\n top: 50%;\n transform: translateY(-50%);\n left: calc(\n 7px + calc(100% * var(--trace-reference)) -\n calc(16px * var(--trace-reference))\n );\n }\n\n @include track() {\n background: transparent;\n height: 0.25rem;\n }\n\n @include clear-browser-thumb();\n\n @include thumb() {\n border-radius: 100px;\n background-color: var(--theme-color-dynamic);\n height: var(--thumb-size);\n width: var(--thumb-size);\n transition: all var(--theme-default-time) ease-in-out;\n z-index: 10;\n }\n\n @include thumb-hover() {\n transform: scale(1.2);\n background-color: var(--theme-color-dynamic);\n }\n\n @include thumb-active() {\n transform: scale(1.2);\n\n background-color: var(--theme-color-dynamic);\n }\n\n @include thumb-focus() {\n outline: 1px solid var(--theme-color-focus-bdr);\n outline-offset: 0.125rem;\n }\n\n /* style datalist */\n .ticks {\n display: flex;\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n }\n .ticks .tick {\n display: block;\n position: absolute;\n width: 8px;\n height: 8px;\n background-color: var(--tick-color);\n border-radius: 100px;\n top: 50%;\n transform: translateY(-50%);\n left: calc(var(--tick-value) * 100% - 4px);\n }\n\n .ticks .tick.tick-active {\n background-color: var(--tick-color--active);\n }\n\n .slider {\n position: relative;\n display: block;\n width: 100%;\n height: 1.5rem;\n }\n\n .track {\n position: absolute;\n background-color: var(--track-color);\n height: 4px;\n width: calc(100% - 1rem);\n margin-left: 0.5rem;\n top: 50%;\n transform: translateY(-50%);\n left: 0px;\n }\n\n .thumb {\n display: block;\n position: absolute;\n background-color: transparent;\n height: 1rem;\n width: 1rem;\n border-radius: 100px;\n left: 0px;\n top: 50%;\n transform: translateY(-50%);\n }\n\n .hide-tooltip {\n display: none;\n }\n\n .label {\n display: flex;\n position: relative;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n margin-top: 0.5rem;\n\n min-height: 0px;\n }\n\n .label-start {\n margin-left: 0.5rem;\n }\n\n .label-end {\n margin-right: 0.5rem;\n }\n\n .label-error {\n margin-left: 0.5rem;\n }\n}\n\n:host(.error) {\n --trace-color: var(--theme-color-alarm-40);\n --tick-color--active: var(--theme-color-alarm);\n\n @include thumb() {\n background-color: var(--theme-color-alarm);\n }\n}\n\n:host(.disabled) {\n pointer-events: none;\n\n --track-color: var(--theme-color-component-3);\n --trace-color: var(--theme-color-3);\n --tick-color: var(--theme-color-7);\n --tick-color--active: var(--theme-color-7);\n\n @include thumb() {\n background-color: var(--theme-color-7);\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { A11yAttributes, a11yHostAttributes } from '../utils/a11y';\nimport { OnListener } from '../utils/listener';\n\nexport type SliderMarker = Array<number>;\n\nfunction between(min: number, value: number, max: number) {\n if (value < min) {\n return min;\n } else if (value > max) {\n return max;\n } else {\n return value;\n }\n}\n\n/**\n * @since 2.0.0\n *\n * @slot label-start - Element will be displayed at the start of the slider\n * @slot label-end - Element will be displayed at the end of the slider\n */\n@Component({\n tag: 'ix-slider',\n styleUrl: 'slider.scss',\n shadow: true,\n})\nexport class Slider {\n @Element() hostElement!: HTMLIxSliderElement;\n\n /**\n * Legal number intervals\n *\n * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#step\n */\n @Prop() step: number;\n\n /**\n * Minimum slider value\n */\n @Prop() min = 0;\n\n /**\n * Maximum slider value\n */\n @Prop() max = 100;\n\n /**\n * Current value of the slider\n */\n @Prop() value = 0;\n\n /**\n * Define tick marker on the slider. Marker has to be within slider min/max\n */\n @Prop() marker: SliderMarker;\n\n /**\n * Show a trace line\n */\n @Prop() trace = false;\n\n /**\n * Define the start point of the trace line\n */\n @Prop() traceReference = 0;\n\n /**\n * Show control as disabled\n */\n @Prop() disabled = false;\n\n /**\n * Show error state and message\n */\n @Prop() error: boolean | string;\n\n /**\n *\n */\n @Event() valueChange: EventEmitter<number>;\n\n @State() rangeInput = 0;\n @State() rangeMin = 0;\n @State() rangeMax = 100;\n @State() rangeTraceReference = 0;\n @State() showTooltip = false;\n\n private a11yAttributes: A11yAttributes;\n\n get tooltip() {\n return this.hostElement.shadowRoot.querySelector('ix-tooltip');\n }\n\n get pseudoThumb() {\n return this.hostElement.shadowRoot.querySelector('.thumb') as HTMLElement;\n }\n\n get slider() {\n return this.hostElement.shadowRoot.getElementById(\n 'slider'\n ) as HTMLInputElement;\n }\n\n @Watch('showTooltip')\n onShowTooltipChange() {\n if (this.showTooltip) {\n this.tooltip.showTooltip(this.pseudoThumb);\n return;\n }\n\n this.tooltip.hideTooltip();\n }\n\n componentWillLoad() {\n this.a11yAttributes = a11yHostAttributes(this.hostElement, [\n 'role',\n 'aria-valuemin',\n 'aria-valuemax',\n 'aria-valuenow',\n ]);\n this.updateRangeVariables();\n }\n\n @Watch('value')\n @Watch('max')\n @Watch('min')\n @Watch('traceReference')\n private updateRangeVariables() {\n this.rangeInput = between(this.min, this.value, this.max);\n this.rangeTraceReference = between(this.min, this.traceReference, this.max);\n this.rangeMin = Math.min(this.min, this.max);\n this.rangeMax = Math.max(this.min, this.max);\n }\n\n private onInput(event: InputEvent) {\n event.stopPropagation();\n const value = parseInt(this.slider.value);\n\n if (!isNaN(value)) {\n this.rangeInput = value;\n this.emitInputEvent();\n }\n }\n\n private emitInputEvent() {\n this.valueChange.emit(this.rangeInput);\n }\n\n private isMarkerActive(markerValue: number) {\n const start = Math.min(this.traceReference, this.rangeInput);\n const end = Math.max(this.traceReference, this.rangeInput);\n const value = markerValue;\n\n return value >= start && value <= end;\n }\n\n // Listen globally on window because sometimes the event listener\n // of the DOM element input itself is not called if the release\n // click is not inside the element anymore\n @OnListener<Slider>('pointerup', (self) => self.showTooltip)\n onPointerUp() {\n this.showTooltip = false;\n }\n\n render() {\n const range = this.rangeMax - this.rangeMin;\n\n let traceReferenceInPercentage =\n (this.rangeTraceReference - this.rangeMin) / range;\n\n let valueInPercentage = (this.rangeInput - this.rangeMin) / range;\n\n const distance = valueInPercentage - traceReferenceInPercentage;\n\n let traceStart = traceReferenceInPercentage;\n let traceEnd = valueInPercentage;\n\n if (distance <= 0) {\n traceStart = valueInPercentage;\n traceEnd = traceReferenceInPercentage;\n }\n\n return (\n <Host\n class={{\n disabled: this.disabled,\n error: !!this.error,\n }}\n onPointerDown={() => setTimeout(() => (this.showTooltip = true))}\n >\n <div class=\"slider\">\n <div class=\"track\">\n <div\n class=\"thumb\"\n style={{\n left: `calc(${valueInPercentage} * 100% - 8px)`,\n }}\n ></div>\n <div class=\"ticks\">\n {this.marker\n ? this.marker.map((markerValue) => {\n if (markerValue > this.max || markerValue < this.min) {\n return;\n }\n\n let left = (markerValue - this.rangeMin) / range;\n\n return (\n <div\n class={{\n tick: true,\n 'tick-active':\n this.isMarkerActive(markerValue) && this.trace,\n }}\n style={{\n '--tick-value': `${left}`,\n }}\n ></div>\n );\n })\n : null}\n </div>\n </div>\n\n <input\n id=\"slider\"\n type=\"range\"\n list={this.marker ? 'markers' : undefined}\n step={this.step}\n min={this.min}\n max={this.max}\n value={this.rangeInput}\n tabindex={this.disabled ? -1 : 0}\n onInput={(event) => this.onInput(event)}\n style={{\n '--value': `${valueInPercentage}`,\n '--trace-reference': `${traceReferenceInPercentage}`,\n '--trace-start': `${traceStart}`,\n '--trace-end': `${traceEnd}`,\n }}\n class={{\n trace:\n this.trace && traceReferenceInPercentage !== valueInPercentage,\n }}\n onFocus={() => {\n this.showTooltip = true;\n }}\n onBlur={() => {\n this.showTooltip = false;\n }}\n role=\"slider\"\n aria-valuenow={this.rangeInput}\n aria-valuemin={this.min}\n aria-valuemax={this.max}\n {...this.a11yAttributes}\n />\n\n <ix-tooltip\n class={{\n 'hide-tooltip': !this.showTooltip,\n }}\n animationFrame={true}\n >\n {this.rangeInput}\n </ix-tooltip>\n </div>\n <div class=\"label\">\n <div class=\"label-start\">\n <slot name=\"label-start\"></slot>\n </div>\n <div class=\"label-end\">\n <slot name=\"label-end\"></slot>\n </div>\n </div>\n {this.error ? (\n <ix-typography class={'label-error'} color=\"alarm\">\n {this.error}\n </ix-typography>\n ) : null}\n </Host>\n );\n }\n}\n"],"mappings":"wIAAA,MAAMA,EAAY,iuKAClB,MAAAC,EAAeD,E,2WCwBf,SAASE,EAAQC,EAAaC,EAAeC,GAC3C,GAAID,EAAQD,EAAK,CACf,OAAOA,C,MACF,GAAIC,EAAQC,EAAK,CACtB,OAAOA,C,KACF,CACL,OAAOD,C,CAEX,C,MAaaE,EAAM,M,+FAaH,E,SAKA,I,WAKE,E,iCAUA,M,oBAKS,E,cAKN,M,qCAYG,E,cACF,E,cACA,I,yBACW,E,iBACR,K,CAIvB,WAAIC,GACF,OAAOC,KAAKC,YAAYC,WAAWC,cAAc,a,CAGnD,eAAIC,GACF,OAAOJ,KAAKC,YAAYC,WAAWC,cAAc,S,CAGnD,UAAIE,GACF,OAAOL,KAAKC,YAAYC,WAAWI,eACjC,S,CAKJ,mBAAAC,GACE,GAAIP,KAAKQ,YAAa,CACpBR,KAAKD,QAAQS,YAAYR,KAAKI,aAC9B,M,CAGFJ,KAAKD,QAAQU,a,CAGf,iBAAAC,GACEV,KAAKW,eAAiBC,EAAmBZ,KAAKC,YAAa,CACzD,OACA,gBACA,gBACA,kBAEFD,KAAKa,sB,CAOC,oBAAAA,GACNb,KAAKc,WAAapB,EAAQM,KAAKL,IAAKK,KAAKJ,MAAOI,KAAKH,KACrDG,KAAKe,oBAAs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,KAAK,gBAGdlE,KAAK6C,MACJL,EAAA,iBAAeG,MAAO,cAAewB,MAAM,SACxCnE,KAAK6C,OAEN,K,uOAtHVuB,EAAA,CADCC,EAAmB,aAAcC,GAASA,EAAK9D,e"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["debounce","func","delay","timeoutId","debounced","args","clearTimeout","setTimeout","ApplicationLayoutService","constructor","_ApplicationLayoutService_supportedBreakpoints","set","this","_ApplicationLayoutService_breakpointChangeListener","TypedEvent","_ApplicationLayoutService_breakpoint","_ApplicationLayoutService_isDetectionEnabled","debouncedOnResize","onResize","bind","window","addEventListener","breakpoint","__classPrivateFieldGet","onChange","isDetectionEnabled","matchBreakpoints","breakpoints","forEach","match","matchBreakpoint","push","every","_","breakPointIndex","includes","length","emit","__classPrivateFieldSet","reverse","disableBreakpointDetection","enableBreakpointDetection","setBreakpoint","setBreakpoints","applicationLayoutService"],"sources":["src/components/utils/debounce.ts","src/components/utils/application-layout/service.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\ntype AnyFunction = (...args: any[]) => any;\n\nexport function debounce<T extends AnyFunction>(\n func: T,\n delay: number\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout>;\n\n return function debounced(...args: Parameters<T>): void {\n clearTimeout(timeoutId);\n\n timeoutId = setTimeout(() => {\n func(...args);\n }, delay);\n };\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Breakpoint, matchBreakpoint } from '../breakpoints';\nimport { debounce } from '../debounce';\nimport { TypedEvent } from '../typed-event';\n\nclass ApplicationLayoutService {\n // Keep order of breakpoints\n #supportedBreakpoints: Breakpoint[] = ['sm', 'md', 'lg'];\n #breakpointChangeListener = new TypedEvent<Breakpoint>();\n #breakpoint: Breakpoint = 'lg';\n\n #isDetectionEnabled = true;\n debouncedOnResize = debounce(this.onResize.bind(this), 50);\n\n constructor() {\n if (typeof window !== 'undefined') {\n window.addEventListener('resize', this.debouncedOnResize.bind(this));\n this.debouncedOnResize();\n }\n }\n\n get breakpoint() {\n return this.#breakpoint;\n }\n\n get onChange() {\n return this.#breakpointChangeListener;\n }\n\n get isDetectionEnabled() {\n return this.#isDetectionEnabled;\n }\n\n private onResize() {\n if (!this.#isDetectionEnabled) {\n return;\n }\n if (!this.#supportedBreakpoints) {\n return;\n }\n const matchBreakpoints: [Breakpoint, boolean][] = [];\n\n const breakpoints = this.#supportedBreakpoints;\n\n breakpoints.forEach((breakpoint) => {\n const match = matchBreakpoint(breakpoint);\n matchBreakpoints.push([breakpoint, match]);\n });\n\n if (matchBreakpoints.every(([_, match]) => match === false)) {\n let breakPointIndex = 0;\n if (!this.#supportedBreakpoints.includes('lg')) {\n breakPointIndex = matchBreakpoints.length - 1;\n }\n\n const [breakpoint, _] = matchBreakpoints[breakPointIndex];\n this.#breakpointChangeListener.emit(breakpoint);\n this.#breakpoint = breakpoint;\n return;\n }\n\n for (const [breakpoint, match] of matchBreakpoints.reverse()) {\n if (match) {\n this.#breakpointChangeListener.emit(breakpoint);\n this.#breakpoint = breakpoint;\n break;\n }\n }\n }\n\n public disableBreakpointDetection() {\n this.#isDetectionEnabled = false;\n }\n\n public enableBreakpointDetection() {\n this.#isDetectionEnabled = true;\n }\n\n public setBreakpoint(breakpoint: Breakpoint) {\n this.#breakpoint = breakpoint;\n this.#breakpointChangeListener.emit(breakpoint);\n }\n\n public setBreakpoints(breakpoints: Breakpoint[]) {\n this.#supportedBreakpoints = breakpoints;\n this.onResize();\n }\n}\n\nexport const applicationLayoutService = new ApplicationLayoutService();\n"],"mappings":"iFAUgBA,EACdC,EACAC,GAEA,IAAIC,EAEJ,OAAO,SAASC,KAAaC,GAC3BC,aAAaH,GAEbA,EAAYI,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,EAAU,KAC7B,K,GAKC,0BAAAkB,GACLF,EAAA1B,KAAII,EAAuB,MAAK,I,CAG3B,yBAAAyB,GACLH,EAAA1B,KAAII,EAAuB,KAAI,I,CAG1B,aAAA0B,CAAcpB,GACnBgB,EAAA1B,KAAIG,EAAeO,EAAU,KAC7BC,EAAAX,KAAIC,EAAA,KAA2BwB,KAAKf,E,CAG/B,cAAAqB,CAAehB,GACpBW,EAAA1B,KAAIF,EAAyBiB,EAAW,KACxCf,KAAKM,U,gEAII0B,EAA2B,IAAIpC,S"}
@@ -1,2 +0,0 @@
1
- import{r as e,c as t,h as o,H as r,g as i}from"./p-f87cd962.js";import{c as s}from"./p-e898862b.js";import{h as d}from"./p-712e0ee0.js";const a=":host{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;flex-direction:column;position:relative;max-width:19.75rem;border-color:var(--theme-group-item--border-color)}:host .group-header{height:4rem;min-height:4rem;max-height:4rem;border-radius:var(--theme-group--border-radius) var(--theme-group--border-radius) 0 0;display:flex;background-color:var(--theme-group-item--background);color:var(--theme-group-header--color);cursor:pointer}:host .group-header:not(.disabled):not(:disabled){cursor:pointer}:host .group-header:not(.disabled):not(:disabled):hover{background-color:var(--theme-group-item--background--hover)}:host .group-header:not(.disabled):not(:disabled):hover.selected{background-color:var(--theme-group-item--background--selected)}:host .group-header:not(.disabled):not(:disabled){cursor:pointer}:host .group-header:not(.disabled):not(:disabled):active,:host .group-header:not(.disabled):not(:disabled).active{background-color:var(--theme-group-item--background--active)}:host .group-header:not(.disabled):not(:disabled):active.selected,:host .group-header:not(.disabled):not(:disabled).active.selected{background-color:var(--theme-group-item--background--selected)}:host .group-header:not(.disabled):not(:disabled):focus-visible{border:1px solid var(--theme-color-focus-bdr);border-radius:var(--theme-default-border-radius) var(--theme-default-border-radius) 0px 0px;outline:none}:host .group-header.selected{background-color:var(--theme-group-item--background--selected)}:host .group-header.selected .group-header-selection-indicator{background-color:var(--theme-group-item-indicator--background--selected)}:host .group-header .group-header-selection-indicator{background-color:var(--theme-color-input--focus)}:host .group-header .group-header-selection-indicator.group-header-selection-indicator-item-selected{background-color:var(--theme-group-item-indicator--background--selected)}:host .group-header-clickable{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;width:100%;min-width:0}:host .group-header-selection-indicator{width:0.25rem;border-top-left-radius:var(--theme-group--border-radius)}:host .group-header-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;flex-direction:row;justify-content:space-between;min-width:0;flex-grow:1;flex-basis:0;padding:0.5rem;padding-left:0}:host .group-header-content .group-header-props-container{width:100%}:host .group-header-content .group-header-title{display:flex;align-items:center;font-size:1rem;font-weight:700;height:1.5rem}:host .group-header-content .group-header-title>*{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;padding-right:0}:host .group-header-content .group-subheader{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;height:1.25rem;font-size:0.875rem;color:var(--theme-group-subheader--color)}:host .expand-icon{padding:0.125rem 0.437rem;color:var(--theme-color-std-text)}:host .btn-expand-header{margin:0.5rem;margin-inline-end:0.25rem;min-width:1.5rem}:host .group-content{display:flex;flex-direction:column;gap:1px;margin-top:1px}:host .footer{visibility:collapse;height:auto;min-height:0}:host .footer-visible{visibility:visible}:host .hidden{display:none}";const h=a;const n=class{constructor(o){e(this,o);this.selectGroup=t(this,"selectGroup",7);this.selectItem=t(this,"selectItem",7);this.collapsedChanged=t(this,"collapsedChanged",7);this.suppressHeaderSelection=false;this.header=undefined;this.subHeader=undefined;this.collapsed=true;this.selected=undefined;this.index=undefined;this.expandOnHeaderClick=false;this.itemSelected=false;this.dropdownTriggerRef=undefined;this.slotSize=this.groupItems.length;this.footerVisible=false;this.showExpandCollapsedIcon=false}get dropdownItems(){return Array.from(this.hostElement.querySelectorAll("ix-group-dropdown-item"))}get groupItems(){return Array.from(this.hostElement.querySelectorAll("ix-group-item:not(.footer)"))}get groupContent(){return this.hostElement.shadowRoot.querySelector(".group-content")}onExpandClick(e){this.collapsed=!this.collapsed;this.collapsedChanged.emit(this.collapsed);e.stopPropagation()}onHeaderClick(e){this.setGroupSelection(!this.selected);if(this.suppressHeaderSelection){this.onExpandClick(e)}}onItemClick(e){if(e===this.index){this.index=undefined;this.selectItem.emit(undefined)}else{this.index=e;this.selectItem.emit(e)}if(this.index>=0){this.itemSelected=true}else this.itemSelected=false;this.setGroupSelection(false)}setGroupSelection(e){if(!this.suppressHeaderSelection){this.selected=e;this.selectGroup.emit(this.selected)}}onSlotChange(){const e=this.hostElement.shadowRoot.querySelector('slot[name="footer"]');if(e){this.footerVisible=d(e)}}componentWillRender(){this.groupItems.forEach(((e,t)=>{if(this.selected===true){e.selected=false;this.index=undefined;this.itemSelected=false;return}e.selected=t===this.index;e.index=t}))}componentDidLoad(){this.observer=s((()=>{this.slotSize=this.groupItems.length}));this.observer.observe(this.groupContent,{childList:true});this.groupContent.addEventListener("selectedChanged",(e=>{this.onItemClick(e.detail.index)}))}disconnectedCallback(){if(this.observer){this.observer.disconnect()}}render(){return o(r,{key:"a6c09009cd058c03a46699d1514a51e5befb5018"},o("div",{key:"7d0802bd7566f7d47062e91a8264b6d783a8a44b",class:{"group-header":true,expand:!this.collapsed,selected:this.selected},tabindex:"0"},o("div",{key:"3f2e851b6d35893c2a3393348474e6cefa06ae79",class:"group-header-clickable",onClick:e=>this.onHeaderClick(e)},o("div",{key:"dfed4e7962f4f3b071cc6b8d64b4efa06f139ebb",class:{"group-header-selection-indicator":true,"group-header-selection-indicator-item-selected":this.itemSelected}}),o("div",{key:"afe8c9b382b2506f1c86a56abe4b29da07c52b9f",class:"btn-expand-header"},o("ix-icon",{key:"de63d1492943de8e4bcf2f1f76b61feab1beea50","data-testid":"expand-collapsed-icon",class:{hidden:!this.showExpandCollapsedIcon},name:this.collapsed?"chevron-right-small":"chevron-down-small",onClick:e=>this.onExpandClick(e)})),o("div",{key:"5ca15ab167295402b4fc5f226b14697777b3abba",class:"group-header-content"},this.header?o("div",{class:"group-header-props-container"},o("div",{class:"group-header-title"},o("span",{title:this.header},this.header)),o("div",{class:"group-subheader",title:this.subHeader},this.subHeader)):null,o("slot",{key:"2f78d4b163682214e6325b49ce69f2f737da0399",name:"header"}))),o("ix-group-context-menu",{key:"56a4bcd4e623012de4a7a1bcc66bb1f280f66e90"},o("slot",{key:"439f0ba04c6ec4543f740ca70b965cd50eae669f",name:"dropdown"}))),o("div",{key:"3cd56e5f026a12ad05ccf85760d2bb4a72ad47d4",class:{"group-content":true}},o("div",{key:"c4fb98c378079efb91edc03c5e88e7a01b33a223",style:{display:this.collapsed?"none":"contents"}},o("slot",{key:"f77631e111614e753f99ec942ff88142c2739c36",onSlotchange:()=>{const e=this.hostElement.shadowRoot.querySelector("slot:not([name])");this.showExpandCollapsedIcon=d(e)}}),o("ix-group-item",{key:"9f84823ab01988af424b0b3beff5acc7ec963d01",suppressSelection:true,focusable:false,class:{footer:true,"footer-visible":this.footerVisible}},o("slot",{key:"14b0b37dfd590c88021c8c4c714a362dc0e82188",name:"footer",onSlotchange:()=>this.onSlotChange()})))))}get hostElement(){return i(this)}};n.style=h;export{n as ix_group};
2
- //# sourceMappingURL=p-c55db6c7.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["groupCss","IxGroupStyle0","Group","this","groupItems","length","dropdownItems","Array","from","hostElement","querySelectorAll","groupContent","shadowRoot","querySelector","onExpandClick","event","collapsed","collapsedChanged","emit","stopPropagation","onHeaderClick","setGroupSelection","selected","suppressHeaderSelection","onItemClick","index","undefined","selectItem","itemSelected","selection","selectGroup","onSlotChange","slot","footerVisible","hasSlottedElements","componentWillRender","forEach","item","componentDidLoad","observer","createMutationObserver","slotSize","observe","childList","addEventListener","evt","detail","disconnectedCallback","disconnect","render","h","Host","key","class","expand","tabindex","onClick","e","hidden","showExpandCollapsedIcon","name","header","title","subHeader","style","display","onSlotchange","suppressSelection","focusable","footer"],"sources":["src/components/group/group.scss?tag=ix-group&encapsulation=shadow","src/components/group/group.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n@import 'common-variables';\n@import 'legacy/mixins/fonts';\n@import 'mixins/hover';\n@import 'mixins/text-truncation';\n\n:host {\n @include ellipsis;\n\n display: flex;\n flex-direction: column;\n position: relative;\n max-width: 19.75rem;\n border-color: var(--theme-group-item--border-color);\n\n .group-header {\n height: 4rem;\n min-height: 4rem;\n max-height: 4rem;\n border-radius: var(--theme-group--border-radius)\n var(--theme-group--border-radius) 0 0;\n display: flex;\n background-color: var(--theme-group-item--background);\n color: var(--theme-group-header--color);\n\n cursor: pointer;\n\n @include hover {\n background-color: var(--theme-group-item--background--hover);\n\n &.selected {\n background-color: var(--theme-group-item--background--selected);\n }\n }\n\n @include active {\n background-color: var(--theme-group-item--background--active);\n\n &.selected {\n background-color: var(--theme-group-item--background--selected);\n }\n }\n\n @include focus-visible {\n border: 1px solid var(--theme-color-focus-bdr);\n border-radius: var(--theme-default-border-radius)\n var(--theme-default-border-radius) 0px 0px;\n outline: none;\n }\n\n &.selected {\n background-color: var(--theme-group-item--background--selected);\n\n .group-header-selection-indicator {\n background-color: var(\n --theme-group-item-indicator--background--selected\n );\n }\n }\n\n .group-header-selection-indicator {\n background-color: var(--theme-color-input--focus);\n\n &.group-header-selection-indicator-item-selected {\n background-color: var(\n --theme-group-item-indicator--background--selected\n );\n }\n }\n }\n\n .group-header-clickable {\n @include ellipsis;\n\n display: flex;\n width: 100%;\n min-width: 0;\n }\n\n .group-header-selection-indicator {\n width: $tiny-space;\n border-top-left-radius: var(--theme-group--border-radius);\n }\n\n .group-header-content {\n @include ellipsis;\n\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n min-width: 0;\n flex-grow: 1;\n flex-basis: 0;\n padding: 0.5rem;\n padding-left: 0;\n\n .group-header-props-container {\n width: 100%;\n }\n\n .group-header-title {\n display: flex;\n align-items: center;\n font-size: 1rem;\n font-weight: $font-weight-bold;\n height: 1.5rem;\n\n & > * {\n @include ellipsis;\n\n min-width: 0;\n padding-right: 0;\n }\n }\n\n .group-subheader {\n @include ellipsis();\n\n height: 1.25rem;\n font-size: 0.875rem;\n color: var(--theme-group-subheader--color);\n }\n }\n\n .expand-icon {\n padding: 0.125rem 0.437rem;\n color: var(--theme-color-std-text);\n }\n\n .btn-expand-header {\n margin: $small-space;\n margin-inline-end: $tiny-space;\n min-width: 1.5rem;\n }\n\n .group-content {\n display: flex;\n flex-direction: column;\n gap: 1px;\n margin-top: 1px;\n }\n\n .footer {\n visibility: collapse;\n height: auto;\n min-height: 0;\n }\n\n .footer-visible {\n visibility: visible;\n }\n\n .hidden {\n display: none;\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n} from '@stencil/core';\nimport { createMutationObserver } from '../utils/mutation-observer';\nimport { hasSlottedElements } from '../utils/shadow-dom';\n\n@Component({\n tag: 'ix-group',\n styleUrl: 'group.scss',\n shadow: true,\n})\nexport class Group {\n @Element() hostElement!: HTMLIxGroupElement;\n\n /**\n * Prevent header from being selectable\n */\n @Prop() suppressHeaderSelection = false;\n\n /**\n * Group header\n */\n @Prop() header: string;\n\n /**\n * Group header subtitle\n */\n @Prop() subHeader: string;\n\n /**\n * Whether the group is collapsed or expanded. Defaults to true.\n */\n @Prop({ mutable: true, reflect: true }) collapsed = true;\n\n /**\n * Whether the group is selected.\n */\n @Prop({ mutable: true, reflect: true }) selected: boolean;\n\n /**\n * The index of the selected group entry.\n * If undefined no group item is selected.\n */\n @Prop({ mutable: true, reflect: true }) index: number;\n\n /**\n * Expand the group if the header is clicked\n */\n @Prop() expandOnHeaderClick = false;\n\n /**\n * Emits when whole group gets selected.\n */\n @Event() selectGroup: EventEmitter<boolean>;\n\n /**\n * Emits when group item gets selected.\n */\n @Event() selectItem: EventEmitter<number>;\n\n /**\n * Group collapsed\n */\n @Event() collapsedChanged: EventEmitter<boolean>;\n\n @State() itemSelected = false;\n @State() dropdownTriggerRef: HTMLElement;\n @State() slotSize = this.groupItems.length;\n @State() footerVisible = false;\n\n @State() showExpandCollapsedIcon = false;\n\n private observer: MutationObserver;\n\n get dropdownItems() {\n return Array.from(\n this.hostElement.querySelectorAll('ix-group-dropdown-item')\n );\n }\n\n get groupItems(): Array<HTMLIxGroupItemElement> {\n return Array.from(\n this.hostElement.querySelectorAll('ix-group-item:not(.footer)')\n );\n }\n\n get groupContent() {\n return this.hostElement.shadowRoot.querySelector('.group-content');\n }\n\n private onExpandClick(event: Event) {\n this.collapsed = !this.collapsed;\n\n this.collapsedChanged.emit(this.collapsed);\n event.stopPropagation();\n }\n\n private onHeaderClick(event: Event) {\n this.setGroupSelection(!this.selected);\n\n if (this.suppressHeaderSelection) {\n this.onExpandClick(event);\n }\n }\n\n private onItemClick(index: number) {\n if (index === this.index) {\n this.index = undefined;\n this.selectItem.emit(undefined);\n } else {\n this.index = index;\n this.selectItem.emit(index);\n }\n\n if (this.index >= 0) {\n this.itemSelected = true;\n } else this.itemSelected = false;\n\n this.setGroupSelection(false);\n }\n\n private setGroupSelection(selection: boolean) {\n if (!this.suppressHeaderSelection) {\n this.selected = selection;\n this.selectGroup.emit(this.selected);\n }\n }\n\n private onSlotChange() {\n const slot = this.hostElement.shadowRoot.querySelector(\n 'slot[name=\"footer\"]'\n );\n\n if (slot) {\n this.footerVisible = hasSlottedElements(slot);\n }\n }\n\n componentWillRender() {\n this.groupItems.forEach((item, index) => {\n if (this.selected === true) {\n item.selected = false;\n this.index = undefined;\n this.itemSelected = false;\n return;\n }\n item.selected = index === this.index;\n item.index = index;\n });\n }\n\n componentDidLoad() {\n this.observer = createMutationObserver(() => {\n this.slotSize = this.groupItems.length;\n });\n\n this.observer.observe(this.groupContent, {\n childList: true,\n });\n\n this.groupContent.addEventListener(\n 'selectedChanged',\n (evt: CustomEvent<HTMLIxGroupItemElement>) => {\n this.onItemClick(evt.detail.index);\n }\n );\n }\n\n disconnectedCallback() {\n if (this.observer) {\n this.observer.disconnect();\n }\n }\n\n render() {\n return (\n <Host>\n <div\n class={{\n 'group-header': true,\n expand: !this.collapsed,\n selected: this.selected,\n }}\n tabindex=\"0\"\n >\n <div\n class=\"group-header-clickable\"\n onClick={(e) => this.onHeaderClick(e)}\n >\n <div\n class={{\n 'group-header-selection-indicator': true,\n 'group-header-selection-indicator-item-selected':\n this.itemSelected,\n }}\n ></div>\n <div class=\"btn-expand-header\">\n <ix-icon\n data-testid=\"expand-collapsed-icon\"\n class={{\n hidden: !this.showExpandCollapsedIcon,\n }}\n name={\n this.collapsed ? 'chevron-right-small' : 'chevron-down-small'\n }\n onClick={(e) => this.onExpandClick(e)}\n ></ix-icon>\n </div>\n\n <div class=\"group-header-content\">\n {this.header ? (\n <div class=\"group-header-props-container\">\n <div class=\"group-header-title\">\n <span title={this.header}>{this.header}</span>\n </div>\n <div class=\"group-subheader\" title={this.subHeader}>\n {this.subHeader}\n </div>\n </div>\n ) : null}\n <slot name=\"header\"></slot>\n </div>\n </div>\n <ix-group-context-menu>\n <slot name=\"dropdown\"></slot>\n </ix-group-context-menu>\n </div>\n <div\n class={{\n 'group-content': true,\n }}\n >\n <div\n style={{\n display: this.collapsed ? 'none' : 'contents',\n }}\n >\n <slot\n onSlotchange={() => {\n const slot =\n this.hostElement.shadowRoot.querySelector('slot:not([name])');\n this.showExpandCollapsedIcon = hasSlottedElements(slot);\n }}\n ></slot>\n <ix-group-item\n suppressSelection={true}\n focusable={false}\n class={{\n footer: true,\n 'footer-visible': this.footerVisible,\n }}\n >\n <slot\n name=\"footer\"\n onSlotchange={() => this.onSlotChange()}\n ></slot>\n </ix-group-item>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"wIAAA,MAAMA,EAAW,krGACjB,MAAAC,E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fV,EAAA,OAAAE,IAAA,2CACEC,MAAO,CACL,gBAAiB,OAGnBH,EAAA,OAAAE,IAAA,2CACEY,MAAO,CACLC,QAAS9D,KAAKa,UAAY,OAAS,aAGrCkC,EAAA,QAAAE,IAAA,2CACEc,aAAc,KACZ,MAAMlC,EACJ7B,KAAKM,YAAYG,WAAWC,cAAc,oBAC5CV,KAAKwD,wBAA0BzB,EAAmBF,EAAK,IAG3DkB,EAAA,iBAAAE,IAAA,2CACEe,kBAAmB,KACnBC,UAAW,MACXf,MAAO,CACLgB,OAAQ,KACR,iBAAkBlE,KAAK8B,gBAGzBiB,EAAA,QAAAE,IAAA,2CACEQ,KAAK,SACLM,aAAc,IAAM/D,KAAK4B,oB"}
@@ -1,2 +0,0 @@
1
- import{r as t,a as r,h as e,F as i,H as a,g as o,c as s}from"./p-f87cd962.js";import{B as n}from"./p-1d581190.js";import{c as l,h as d}from"./p-712e0ee0.js";import{m as h}from"./p-64c3fa3d.js";const c=":host{display:flex;position:relative;width:-moz-fit-content;width:fit-content}:host .avatar{display:flex;align-items:center}:host .avatar>.avatar-image{height:2rem;width:2rem;min-height:2rem;min-width:2rem;border-radius:100px}:host .avatar>.avatar-initials{display:flex;align-items:center;justify-content:center;height:2rem;width:2rem;min-height:2rem;min-width:2rem;border-radius:100px;background-color:var(--theme-avatar--background);color:var(--theme-avatar--color)}:host .avatar #avatar-path-background{fill:var(--theme-avatar--background)}:host .avatar #avatar-path-person{fill:var(--theme-avatar--color)}:host .user-info{display:flex;flex-direction:row;position:relative;height:2.5rem;padding:1rem;width:12.75rem;min-width:12.75rem;max-width:12.75rem;gap:1rem}:host .user-info .avatar{width:2rem;pointer-events:none}:host .user-info .user{display:flex;position:relative;flex-direction:column;justify-content:center;max-width:10rem;width:100%;overflow:hidden}:host .user-info .username{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .user-info .extra{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host(.avatar-button) button{all:unset;box-sizing:border-box;display:inline-flex;flex-direction:row;flex-wrap:nowrap;overflow:hidden;align-items:center;justify-content:center;width:100%;height:100%;padding:0 0.5rem;padding:0px;border-radius:100px !important}:host(.avatar-button) .btn-invisible-primary{border-radius:var(--theme-btn--border-radius)}:host(.avatar-button) .btn-invisible-primary,:host(.avatar-button) .btn-invisible-primary.focus,:host(.avatar-button) .btn-invisible-primary:focus-visible{background-color:var(--theme-btn-invisible-primary--background);color:var(--theme-btn-invisible-primary--color);--ix-button-color:var(--theme-btn-invisible-primary--color);border-color:transparent}:host(.avatar-button) .btn-invisible-primary:not(.disabled):not(:disabled):focus-visible{outline:1px solid var(--theme-color-focus-bdr);outline-offset:var(--theme-btn--focus--outline-offset)}:host(.avatar-button) .btn-invisible-primary.selected{background-color:var(--theme-color-ghost--selected);color:var(--theme-color-dynamic)}:host(.avatar-button) .btn-invisible-primary.selected:not(.disabled):not(:disabled){cursor:pointer}:host(.avatar-button) .btn-invisible-primary.selected:not(.disabled):not(:disabled):hover{background-color:var(--theme-color-ghost--selected-hover);color:var(--theme-color-dynamic)}:host(.avatar-button) .btn-invisible-primary.selected:not(.disabled):not(:disabled){cursor:pointer}:host(.avatar-button) .btn-invisible-primary.selected:not(.disabled):not(:disabled):active,:host(.avatar-button) .btn-invisible-primary.selected:not(.disabled):not(:disabled).active{background-color:var(--theme-color-ghost--selected-active);color:var(--theme-color-dynamic)}:host(.avatar-button) .btn-invisible-primary:not(.disabled):not(:disabled){cursor:pointer}:host(.avatar-button) .btn-invisible-primary:not(.disabled):not(:disabled):hover{background-color:var(--theme-btn-invisible-primary--background--hover);color:var(--theme-btn-invisible-primary--color--hover)}:host(.avatar-button) .btn-invisible-primary:not(.disabled):not(:disabled){cursor:pointer}:host(.avatar-button) .btn-invisible-primary:not(.disabled):not(:disabled):active,:host(.avatar-button) .btn-invisible-primary:not(.disabled):not(:disabled).active{background-color:var(--theme-btn-invisible-primary--background--active);color:var(--theme-btn-invisible-primary--color--active)}:host(.avatar-button) li{transform:scale(0.8)}";const b=c;function v(t){const{initials:r}=t;if(r){return e("div",{class:"avatar-initials"},r)}return e("svg",{class:"avatar-image",xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32"},e("g",{fill:"none","fill-rule":"evenodd"},e("path",{id:"avatar-path-background",d:"M16 0C7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163\n 16-16c0-4.243-1.686-8.313-4.686-11.314C24.314 1.686 20.244 0 16 0z"}),e("path",{id:"avatar-path-person",d:"M17.897 17.91c3.8-.018 7.358 1.875 9.485 5.046-2.417 3.999-6.734 6.434-11.382\n 6.42-4.648.014-8.965-2.421-11.382-6.42 2.127-3.171 5.685-5.064\n 9.485-5.045h3.794zM15.821 2.129c3.682 0 6.667 2.984 6.667 6.666 0 3.682-2.985\n 6.667-6.667 6.667s-6.667-2.985-6.667-6.667 2.985-6.666 6.667-6.666z"})))}function m(t){return e("li",{class:"avatar"},t.image?e("img",{src:t.image,class:"avatar-image"}):e(v,{initials:t.initials}))}function u(t){return e(i,null,e("div",{class:"user-info",onClick:t=>t.preventDefault()},e(m,{image:t.image,initials:t.initials}),e("div",{class:"user"},e("div",{class:"username"},t.userName),t.extra&&e("ix-typography",{class:"extra",color:"soft"},t.extra))))}const p=class{constructor(r){t(this,r);this.image=undefined;this.initials=undefined;this.username=undefined;this.extra=undefined;this.isClosestApplicationHeader=false;this.hasSlottedElements=false}componentWillLoad(){const t=l("ix-application-header",this.hostElement);this.isClosestApplicationHeader=t!==null}slottedChanged(){this.hasSlottedElements=d(this.slotElement)}resolveAvatarTrigger(){return new Promise((t=>{r((()=>t(this.hostElement.shadowRoot.querySelector("button"))))}))}onDropdownClick(t){if(t.target===this.dropdownElement){t.preventDefault()}}render(){if(this.isClosestApplicationHeader){return e(a,{slot:"ix-application-header-avatar",class:"avatar-button"},e(n,{disabled:false,ghost:true,iconOval:false,icon:undefined,iconOnly:false,loading:false,outline:false,selected:false,type:"button",variant:"primary"},e(m,{image:this.image,initials:this.initials})),e("ix-dropdown",{ref:t=>this.dropdownElement=t,trigger:this.resolveAvatarTrigger(),class:"avatar-dropdown",onClick:t=>this.onDropdownClick(t)},this.username&&e(i,null,e(u,{extra:this.extra,image:this.image,initials:this.initials,userName:this.username}),this.hasSlottedElements&&e("ix-divider",{onClick:t=>t.preventDefault()})),e("slot",{onSlotchange:()=>this.slottedChanged(),ref:t=>this.slotElement=t})))}return e(a,null,e(m,{image:this.image,initials:this.initials}))}get hostElement(){return o(this)}};p.style=b;const f=":host{display:block;color:var(--theme-color-std-text)}:host *,:host *::after,:host *::before{box-sizing:border-box}:host ::-webkit-scrollbar-button{display:none}@-moz-document url-prefix(){:host *{scrollbar-color:var(--theme-scrollbar-thumb--background) var(--theme-scrollbar-track--background);scrollbar-width:thin}}:host ::-webkit-scrollbar{width:0.5rem;height:0.5rem}:host ::-webkit-scrollbar-track{border-radius:5px;background:var(--theme-scrollbar-track--background)}:host ::-webkit-scrollbar-track:hover{background:var(--theme-scrollbar-track--background--hover)}:host ::-webkit-scrollbar-thumb{border-radius:5px;background:var(--theme-scrollbar-thumb--background)}:host ::-webkit-scrollbar-thumb:hover{background:var(--theme-scrollbar-thumb--background--hover)}:host ::-webkit-scrollbar-corner{display:none}";const g=f;const w=class{constructor(r){t(this,r);this.itemClick=s(this,"itemClick",7);this.dropdownItemRef=h();this.icon=undefined;this.label=undefined}async getDropdownItemElement(){return this.dropdownItemRef.waitForCurrent()}render(){return e("ix-dropdown-item",{key:"fe1c225ee8b21aade4ca0e679a5ca389721520a4",ref:this.dropdownItemRef,icon:this.icon,label:this.label,onClick:t=>this.itemClick.emit(t)})}get hostElement(){return o(this)}};w.style=g;export{p as ix_avatar,w as ix_menu_avatar_item};
2
- //# sourceMappingURL=p-f07110c6.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["avatarCss","IxAvatarStyle0","DefaultAvatar","props","initials","h","class","xmlns","width","height","viewBox","fill","id","d","AvatarImage","image","src","UserInfo","Fragment","onClick","event","preventDefault","userName","extra","color","Avatar","componentWillLoad","closest","closestElement","this","hostElement","isClosestApplicationHeader","slottedChanged","hasSlottedElements","slotElement","resolveAvatarTrigger","Promise","resolve","readTask","shadowRoot","querySelector","onDropdownClick","target","dropdownElement","render","Host","slot","BaseButton","disabled","ghost","iconOval","icon","undefined","iconOnly","loading","outline","selected","type","variant","ref","trigger","e","username","onSlotchange","menuAvatarItemCss","IxMenuAvatarItemStyle0","MenuAvatarItem","dropdownItemRef","makeRef","getDropdownItemElement","waitForCurrent","key","label","itemClick","emit"],"sources":["src/components/avatar/avatar.scss?tag=ix-avatar&encapsulation=shadow","src/components/avatar/avatar.tsx","src/components/menu-avatar-item/menu-avatar-item.scss?tag=ix-menu-avatar-item&encapsulation=shadow","src/components/menu-avatar-item/menu-avatar-item.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n@import 'common-variables';\n@import 'mixins/text-truncation';\n@import 'mixins/hover';\n@import './../button/button-mixin';\n\n:host {\n display: flex;\n position: relative;\n width: fit-content;\n\n .avatar {\n display: flex;\n align-items: center;\n\n > .avatar-image {\n height: 2rem;\n width: 2rem;\n min-height: 2rem;\n min-width: 2rem;\n border-radius: 100px;\n }\n\n > .avatar-initials {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 2rem;\n width: 2rem;\n min-height: 2rem;\n min-width: 2rem;\n border-radius: 100px;\n background-color: var(--theme-avatar--background);\n color: var(--theme-avatar--color);\n }\n\n #avatar-path-background {\n fill: var(--theme-avatar--background);\n }\n\n #avatar-path-person {\n fill:var(--theme-avatar--color);\n }\n }\n}\n\n:host {\n .user-info {\n display: flex;\n flex-direction: row;\n position: relative;\n height: 2.5rem;\n padding: 1rem;\n width: 12.75rem;\n min-width: 12.75rem;\n max-width: 12.75rem;\n\n gap: 1rem;\n\n .avatar {\n width: 2rem;\n pointer-events: none;\n }\n\n .user {\n display: flex;\n position: relative;\n flex-direction: column;\n justify-content: center;\n max-width: 10rem;\n width: 100%;\n overflow: hidden;\n }\n\n .username {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .extra {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n}\n\n:host(.avatar-button) {\n button {\n @include btn-base;\n padding: 0px;\n\n border-radius: 100px !important;\n }\n\n @include btn-base-variant('invisible-primary', false);\n\n li {\n transform: scale(0.8);\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Fragment,\n h,\n Host,\n Prop,\n readTask,\n State,\n} from '@stencil/core';\nimport { BaseButton } from '../button/base-button';\nimport { closestElement, hasSlottedElements } from '../utils/shadow-dom';\n\nfunction DefaultAvatar(props: { initials?: string }) {\n const { initials } = props;\n\n if (initials) {\n return <div class={'avatar-initials'}>{initials}</div>;\n }\n\n return (\n <svg\n class={'avatar-image'}\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"32\"\n height=\"32\"\n viewBox=\"0 0 32 32\"\n >\n <g fill=\"none\" fill-rule=\"evenodd\">\n <path\n id=\"avatar-path-background\"\n d=\"M16 0C7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163\n 16-16c0-4.243-1.686-8.313-4.686-11.314C24.314 1.686 20.244 0 16 0z\"\n />\n <path\n id=\"avatar-path-person\"\n d=\"M17.897 17.91c3.8-.018 7.358 1.875 9.485 5.046-2.417 3.999-6.734 6.434-11.382\n 6.42-4.648.014-8.965-2.421-11.382-6.42 2.127-3.171 5.685-5.064\n 9.485-5.045h3.794zM15.821 2.129c3.682 0 6.667 2.984 6.667 6.666 0 3.682-2.985\n 6.667-6.667 6.667s-6.667-2.985-6.667-6.667 2.985-6.666 6.667-6.666z\"\n />\n </g>\n </svg>\n );\n}\n\nfunction AvatarImage(props: { image: string; initials: string }) {\n return (\n <li class=\"avatar\">\n {props.image ? (\n <img src={props.image} class=\"avatar-image\"></img>\n ) : (\n <DefaultAvatar initials={props.initials} />\n )}\n </li>\n );\n}\n\nfunction UserInfo(props: {\n image: string;\n initials: string;\n userName: string;\n extra: string;\n}) {\n return (\n <Fragment>\n <div class=\"user-info\" onClick={(event) => event.preventDefault()}>\n <AvatarImage image={props.image} initials={props.initials} />\n <div class=\"user\">\n <div class=\"username\">{props.userName}</div>\n {props.extra && (\n <ix-typography class=\"extra\" color={'soft'}>\n {props.extra}\n </ix-typography>\n )}\n </div>\n </div>\n </Fragment>\n );\n}\n\n/**\n * @since 2.0.0\n */\n@Component({\n tag: 'ix-avatar',\n styleUrl: 'avatar.scss',\n shadow: true,\n})\nexport class Avatar {\n @Element() hostElement: HTMLIxAvatarElement;\n\n /**\n * Display an avatar image\n *\n */\n @Prop() image: string;\n\n /**\n * Display the initials of the user. Will be overwritten by image\n *\n */\n @Prop() initials: string;\n\n /**\n * If set an info card displaying the username will be placed inside the dropdown.\n * Note: Only working if avatar is part of the ix-application-header\n *\n * @since 2.1.0\n */\n @Prop() username: string;\n\n /**\n * Optional description text that will be displayed underneath the username.\n * Note: Only working if avatar is part of the ix-application-header\n *\n * @since 2.1.0\n */\n @Prop() extra: string;\n\n @State() isClosestApplicationHeader = false;\n @State() hasSlottedElements = false;\n\n private slotElement: HTMLSlotElement;\n private dropdownElement: HTMLIxDropdownElement;\n\n componentWillLoad() {\n const closest = closestElement('ix-application-header', this.hostElement);\n this.isClosestApplicationHeader = closest !== null;\n }\n\n private slottedChanged() {\n this.hasSlottedElements = hasSlottedElements(this.slotElement);\n }\n\n private resolveAvatarTrigger() {\n return new Promise<HTMLElement>((resolve) => {\n readTask(() =>\n resolve(this.hostElement.shadowRoot.querySelector('button'))\n );\n });\n }\n\n private onDropdownClick(event: MouseEvent) {\n if (event.target === this.dropdownElement) {\n event.preventDefault();\n }\n }\n\n render() {\n if (this.isClosestApplicationHeader) {\n return (\n <Host slot=\"ix-application-header-avatar\" class={'avatar-button'}>\n <BaseButton\n disabled={false}\n ghost={true}\n iconOval={false}\n icon={undefined}\n iconOnly={false}\n loading={false}\n outline={false}\n selected={false}\n type=\"button\"\n variant=\"primary\"\n >\n <AvatarImage image={this.image} initials={this.initials} />\n </BaseButton>\n <ix-dropdown\n ref={(ref: HTMLIxDropdownElement) => (this.dropdownElement = ref)}\n trigger={this.resolveAvatarTrigger()}\n class=\"avatar-dropdown\"\n onClick={(e) => this.onDropdownClick(e)}\n >\n {this.username && (\n <Fragment>\n <UserInfo\n extra={this.extra}\n image={this.image}\n initials={this.initials}\n userName={this.username}\n />\n {this.hasSlottedElements && (\n <ix-divider onClick={(e) => e.preventDefault()}></ix-divider>\n )}\n </Fragment>\n )}\n <slot\n onSlotchange={() => this.slottedChanged()}\n ref={(ref: HTMLSlotElement) => (this.slotElement = ref)}\n ></slot>\n </ix-dropdown>\n </Host>\n );\n }\n\n return (\n <Host>\n <AvatarImage image={this.image} initials={this.initials} />\n </Host>\n );\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n@import 'mixins/shadow-dom/component';\n\n:host {\n @include ix-component;\n display: block;\n color: var(--theme-color-std-text);\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Method,\n Prop,\n} from '@stencil/core';\nimport { DropdownItemWrapper } from '../dropdown/dropdown-controller';\nimport { makeRef } from '../utils/make-ref';\n\n@Component({\n tag: 'ix-menu-avatar-item',\n styleUrl: 'menu-avatar-item.scss',\n shadow: true,\n})\nexport class MenuAvatarItem implements DropdownItemWrapper {\n /**\n * Avatar dropdown icon\n */\n @Prop() icon: string;\n\n /**\n * Avatar dropdown label\n */\n @Prop() label: string;\n\n /**\n * Avatar dropdown item clicked\n */\n @Event() itemClick: EventEmitter<MouseEvent>;\n\n @Element() hostElement: HTMLIxMenuAvatarItemElement;\n\n private dropdownItemRef = makeRef<HTMLIxDropdownItemElement>();\n\n /** @internal */\n @Method()\n async getDropdownItemElement() {\n return this.dropdownItemRef.waitForCurrent();\n }\n\n render() {\n return (\n <ix-dropdown-item\n ref={this.dropdownItemRef}\n icon={this.icon}\n label={this.label}\n onClick={(e) => this.itemClick.emit(e)}\n ></ix-dropdown-item>\n );\n }\n}\n"],"mappings":"iMAAA,MAAMA,EAAY,s9GAClB,MAAAC,EAAeD,ECqBf,SAASE,EAAcC,GACrB,MAAMC,SAAEA,GAAaD,EAErB,GAAIC,EAAU,CACZ,OAAOC,EAAA,OAAKC,MAAO,mBAAoBF,E,CAGzC,OACEC,EAAA,OACEC,MAAO,eACPC,MAAM,6BACNC,MAAM,KACNC,OAAO,KACPC,QAAQ,aAERL,EAAA,KAAGM,KAAK,OAAM,YAAW,WACvBN,EAAA,QACEO,GAAG,yBACHC,EAAE,qIAGJR,EAAA,QACEO,GAAG,qBACHC,EAAE,+TAQZ,CAEA,SAASC,EAAYX,GACnB,OACEE,EAAA,MAAIC,MAAM,UACPH,EAAMY,MACLV,EAAA,OAAKW,IAAKb,EAAMY,MAAOT,MAAM,iBAE7BD,EAACH,EAAa,CAACE,SAAUD,EAAMC,WAIvC,CAEA,SAASa,EAASd,GAMhB,OACEE,EAACa,EAAQ,KACPb,EAAA,OAAKC,MAAM,YAAYa,QAAUC,GAAUA,EAAMC,kBAC/ChB,EAACS,EAAW,CAACC,MAAOZ,EAAMY,MAAOX,SAAUD,EAAMC,WACjDC,EAAA,OAAKC,MAAM,QACTD,EAAA,OAAKC,MAAM,YAAYH,EAAMmB,UAC5BnB,EAAMoB,OACLlB,EAAA,iBAAeC,MAAM,QAAQkB,MAAO,QACjCrB,E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C9MvD,MAAM4D,EAAoB,izBAC1B,MAAAC,EAAeD,E,MCyBFE,EAAc,M,8DAkBjBrC,KAAAsC,gBAAkBC,I,yCAI1B,4BAAMC,GACJ,OAAOxC,KAAKsC,gBAAgBG,gB,CAG9B,MAAA1B,GACE,OACEvC,EAAA,oBAAAkE,IAAA,2CACEZ,IAAK9B,KAAKsC,gBACVhB,KAAMtB,KAAKsB,KACXqB,MAAO3C,KAAK2C,MACZrD,QAAU0C,GAAMhC,KAAK4C,UAAUC,KAAKb,I"}
@@ -1,2 +0,0 @@
1
- import{r as t,a as e,h as o,F as r,H as i,g as a}from"./p-f87cd962.js";import{s}from"./p-0ca3528f.js";import{a as n}from"./p-702f9349.js";import{a as l,A as d}from"./p-7c36d3fa.js";import{m as h}from"./p-c146af8e.js";import{h as c}from"./p-712e0ee0.js";import"./p-46a6cd9d.js";import"./p-6e6efb4c.js";import"./p-c4749812.js";import"./p-68a274e7.js";const m=":host{display:flex;align-items:center;position:relative;width:100%;height:2.75rem;min-height:2.75rem;padding:0 1rem 0 0.625rem;color:var(--theme-app-header--color);background-color:var(--theme-app-header--background);border-bottom:var(--theme-app-header--border-width) solid var(--theme-app-header--border-color);z-index:var(--theme-z-index-fixed)}:host *,:host *::after,:host *::before{box-sizing:border-box}:host ::-webkit-scrollbar-button{display:none}@-moz-document url-prefix(){:host *{scrollbar-color:var(--theme-scrollbar-thumb--background) var(--theme-scrollbar-track--background);scrollbar-width:thin}}:host ::-webkit-scrollbar{width:0.5rem;height:0.5rem}:host ::-webkit-scrollbar-track{border-radius:5px;background:var(--theme-scrollbar-track--background)}:host ::-webkit-scrollbar-track:hover{background:var(--theme-scrollbar-track--background--hover)}:host ::-webkit-scrollbar-thumb{border-radius:5px;background:var(--theme-scrollbar-thumb--background)}:host ::-webkit-scrollbar-thumb:hover{background:var(--theme-scrollbar-thumb--background--hover)}:host ::-webkit-scrollbar-corner{display:none}:host .app-switch{margin-right:1rem}:host .name{overflow:hidden;overflow-wrap:anywhere;text-overflow:ellipsis;text-wrap:nowrap;max-width:50%;margin-left:1.5rem;margin-right:2.5rem;color:var(--theme-app-header--color)}:host .logo{display:inline-flex;align-items:center;position:relative;height:32px;overflow:hidden;line-height:0rem;color:var(--theme-app-header-logo--color);margin-left:0.375rem}:host .content{display:flex;position:relative;flex-direction:row;margin-left:auto;margin-right:0px}:host .dropdown{overflow:visible}:host .dropdown-content{padding:1rem}:host .context-menu{display:none}:host .context-menu.context-menu-visible{display:block}@media only screen and (max-width: 48em){:host .logo{display:none}}:host ::slotted(ix-avatar){margin-left:1rem}:host(.breakpoint-sm){padding-left:0.625rem}:host(.breakpoint-sm) .logo{margin-left:0.5rem}";const p=m;const b=class{constructor(e){t(this,e);this.name=undefined;this.breakpoint="lg";this.menuExpanded=false;this.suppressResponsive=false;this.hasSlottedElements=false;this.applicationLayoutContext=undefined}get contentBackground(){return this.hostElement.shadowRoot.querySelector(".dropdown-content")}componentWillLoad(){l(this.hostElement,d,(t=>{if((t===null||t===void 0?void 0:t.host)==="map-navigation"){this.suppressResponsive=true;this.breakpoint="md";return}this.breakpoint=n.breakpoint;this.applicationLayoutContext=t;this.tryUpdateAppSwitch()}),true);this.menuDisposable=h.expandChange.on((t=>{this.menuExpanded=t}));this.modeDisposable=n.onChange.on((t=>{if(this.suppressResponsive){this.breakpoint="md";return}this.breakpoint=t}));this.updateIsSlottedContent()}componentDidLoad(){this.attachSiemensLogoIfLoaded()}disconnectedCallback(){var t,e;(t=this.menuDisposable)===null||t===void 0?void 0:t.dispose();(e=this.modeDisposable)===null||e===void 0?void 0:e.dispose()}isLogoSlotted(){const t=this.hostElement.shadowRoot.querySelector('slot[name="logo"]');const e=t.assignedNodes({flatten:true});return e.length!==0}async attachSiemensLogoIfLoaded(){await window.customElements.whenDefined("ix-siemens-logo");const t=document.createElement("ix-siemens-logo");if(!this.isLogoSlotted()){this.hostElement.shadowRoot.querySelector(".logo").appendChild(t)}}async onMenuClick(){h.toggle()}resolveContextMenuButton(){return new Promise((t=>e((()=>t(this.hostElement.shadowRoot.querySelector("[data-context-menu]"))))))}tryUpdateAppSwitch(){var t;if(!this.callbackUpdateAppSwitchModal){return}this.callbackUpdateAppSwitchModal((t=this.applicationLayoutContext)===null||t===void 0?void 0:t.appSwitchConfig)}async showAppSwitch(){var t;this.callbackUpdateAppSwitchModal=await s((t=this.applicationLayoutContext)===null||t===void 0?void 0:t.appSwitchConfig)}updateIsSlottedContent(){const t=this.hostElement.shadowRoot.querySelector(".content slot");this.hasSlottedElements=c(t)}onContentBgClick(t){if(t.target===this.contentBackground){t.preventDefault()}}render(){var t;return o(i,{key:"58565e3136e17a2d3cae46a4add8f2ba245b59bc",class:{[`breakpoint-${this.breakpoint}`]:true},slot:"application-header"},this.breakpoint==="sm"&&this.suppressResponsive===false&&o("ix-menu-expand-icon",{key:"da63965f1ced1898c799a48212eb7a4afdf35ffd",onClick:()=>this.onMenuClick(),expanded:this.menuExpanded}),((t=this.applicationLayoutContext)===null||t===void 0?void 0:t.appSwitchConfig)&&this.breakpoint!=="sm"&&this.suppressResponsive===false&&o("ix-icon-button",{key:"fce7acda771398cd8f8f79dcb05254354e9524c8",onClick:()=>this.showAppSwitch(),icon:"apps",ghost:true,class:"app-switch"}),o("div",{key:"20d47359153147df9636a2170e4987113871e701",class:"logo"},o("slot",{key:"3889ece809965cd8c5a256e6551b1d4961774977",name:"logo"})),o("div",{key:"4e9c07f44beb7c476d61657bb303764c74ee174e",class:"name"},this.name),o("div",{key:"099a3a4842da94cd54f789ee29380ab057957550",class:"content"},this.breakpoint==="sm"?o(r,null,o("ix-icon-button",{class:{["context-menu"]:true,["context-menu-visible"]:this.hasSlottedElements},"data-context-menu":true,icon:"more-menu",ghost:true}),o("ix-dropdown",{"data-overflow-dropdown":true,class:"dropdown",discoverAllSubmenus:true,trigger:this.resolveContextMenuButton()},o("div",{class:"dropdown-content",onClick:t=>this.onContentBgClick(t)},o("slot",{onSlotchange:()=>this.updateIsSlottedContent()})))):o("slot",{onSlotchange:()=>this.updateIsSlottedContent()}),o("slot",{key:"ba4c1d46798c9cb325b933905df7bb17a4aedfc6",name:"ix-application-header-avatar"})))}get hostElement(){return a(this)}};b.style=p;export{b as ix_application_header};
2
- //# sourceMappingURL=p-fa53933d.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["applicationHeaderCss","IxApplicationHeaderStyle0","ApplicationHeader","contentBackground","this","hostElement","shadowRoot","querySelector","componentWillLoad","useContextConsumer","ApplicationLayoutContext","ctx","host","suppressResponsive","breakpoint","applicationLayoutService","applicationLayoutContext","tryUpdateAppSwitch","menuDisposable","menuController","expandChange","on","show","menuExpanded","modeDisposable","onChange","mode","updateIsSlottedContent","componentDidLoad","attachSiemensLogoIfLoaded","disconnectedCallback","_a","dispose","_b","isLogoSlotted","slotElement","nodes","assignedNodes","flatten","length","window","customElements","whenDefined","logoElement","document","createElement","appendChild","onMenuClick","toggle","resolveContextMenuButton","Promise","resolve","readTask","callbackUpdateAppSwitchModal","appSwitchConfig","showAppSwitch","hasSlottedElements","onContentBgClick","e","target","preventDefault","render","h","Host","key","class","slot","onClick","expanded","icon","ghost","name","Fragment","discoverAllSubmenus","trigger","onSlotchange"],"sources":["src/components/application-header/application-header.scss?tag=ix-application-header&encapsulation=shadow","src/components/application-header/application-header.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n @import 'mixins/shadow-dom/component';\n @import 'mixins/break-points';\n\n:host {\n @include ix-component;\n\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n height: 2.75rem;\n min-height: 2.75rem;\n padding: 0 1rem 0 0.625rem;\n\n color: var(--theme-app-header--color);\n background-color: var(--theme-app-header--background);\n\n border-bottom: var(--theme-app-header--border-width) solid\n var(--theme-app-header--border-color);\n\n z-index: var(--theme-z-index-fixed);\n\n .app-switch {\n margin-right: 1rem;\n }\n\n .name {\n overflow: hidden;\n overflow-wrap: anywhere;\n text-overflow: ellipsis;\n text-wrap: nowrap;\n max-width: 50%;\n margin-left: 1.5rem;\n margin-right: 2.5rem;\n color: var(--theme-app-header--color);\n }\n\n .logo {\n display: inline-flex;\n align-items: center;\n position: relative;\n height: 32px;\n overflow: hidden;\n line-height: 0rem;\n color: var(--theme-app-header-logo--color);\n margin-left: 0.375rem;\n }\n\n .content {\n display: flex;\n position: relative;\n flex-direction: row;\n margin-left: auto;\n margin-right: 0px;\n }\n\n .dropdown {\n overflow: visible;\n }\n\n .dropdown-content {\n padding: 1rem;\n }\n\n .context-menu {\n display: none;\n }\n\n .context-menu.context-menu-visible {\n display: block;\n }\n\n @include media-breakpoint-match('sm') {\n .logo {\n display: none;\n }\n }\n\n ::slotted(ix-avatar) {\n margin-left: 1rem;\n }\n}\n\n:host(.breakpoint-sm) {\n padding-left: 0.625rem;\n\n .logo {\n margin-left: 0.5rem;\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Fragment,\n h,\n Host,\n Prop,\n readTask,\n State,\n} from '@stencil/core';\nimport { showAppSwitch } from '../utils/app-switch';\nimport { applicationLayoutService } from '../utils/application-layout';\nimport {\n ApplicationLayoutContext,\n AppSwitchConfiguration,\n} from '../utils/application-layout/context';\nimport { Breakpoint } from '../utils/breakpoints';\nimport { ContextType, useContextConsumer } from '../utils/context';\nimport { menuController } from '../utils/menu-service/menu-service';\nimport { hasSlottedElements } from '../utils/shadow-dom';\nimport { Disposable } from '../utils/typed-event';\n\n/**\n * @slot logo - Location of the logo\n */\n@Component({\n tag: 'ix-application-header',\n styleUrl: 'application-header.scss',\n shadow: true,\n})\nexport class ApplicationHeader {\n @Element() hostElement!: HTMLIxApplicationHeaderElement;\n\n /**\n * Application name\n */\n @Prop() name: string;\n\n @State() breakpoint: Breakpoint = 'lg';\n @State() menuExpanded = false;\n @State() suppressResponsive = false;\n\n @State() hasSlottedElements = false;\n\n private menuDisposable?: Disposable;\n private modeDisposable?: Disposable;\n private callbackUpdateAppSwitchModal?: (\n config: AppSwitchConfiguration\n ) => void;\n\n @State() applicationLayoutContext: ContextType<\n typeof ApplicationLayoutContext\n >;\n\n get contentBackground() {\n return this.hostElement.shadowRoot.querySelector('.dropdown-content');\n }\n\n componentWillLoad() {\n useContextConsumer(\n this.hostElement,\n ApplicationLayoutContext,\n (ctx) => {\n if (ctx?.host === 'map-navigation') {\n this.suppressResponsive = true;\n this.breakpoint = 'md';\n return;\n }\n\n this.breakpoint = applicationLayoutService.breakpoint;\n this.applicationLayoutContext = ctx;\n\n this.tryUpdateAppSwitch();\n },\n true\n );\n\n this.menuDisposable = menuController.expandChange.on((show) => {\n this.menuExpanded = show;\n });\n\n this.modeDisposable = applicationLayoutService.onChange.on((mode) => {\n if (this.suppressResponsive) {\n this.breakpoint = 'md';\n return;\n }\n\n this.breakpoint = mode;\n });\n\n this.updateIsSlottedContent();\n }\n\n componentDidLoad() {\n this.attachSiemensLogoIfLoaded();\n }\n\n disconnectedCallback() {\n this.menuDisposable?.dispose();\n this.modeDisposable?.dispose();\n }\n\n private isLogoSlotted() {\n const slotElement = this.hostElement.shadowRoot.querySelector(\n 'slot[name=\"logo\"]'\n ) as HTMLSlotElement;\n const nodes = slotElement.assignedNodes({\n flatten: true,\n });\n\n return nodes.length !== 0;\n }\n\n private async attachSiemensLogoIfLoaded() {\n await window.customElements.whenDefined('ix-siemens-logo');\n const logoElement = document.createElement('ix-siemens-logo');\n if (!this.isLogoSlotted()) {\n this.hostElement.shadowRoot\n .querySelector('.logo')\n .appendChild(logoElement);\n }\n }\n\n private async onMenuClick() {\n menuController.toggle();\n }\n\n private resolveContextMenuButton() {\n return new Promise<HTMLElement>((resolve) =>\n readTask(() =>\n resolve(\n this.hostElement.shadowRoot.querySelector(\n '[data-context-menu]'\n ) as HTMLElement\n )\n )\n );\n }\n\n private tryUpdateAppSwitch() {\n if (!this.callbackUpdateAppSwitchModal) {\n return;\n }\n\n this.callbackUpdateAppSwitchModal(\n this.applicationLayoutContext?.appSwitchConfig\n );\n }\n\n private async showAppSwitch() {\n this.callbackUpdateAppSwitchModal = await showAppSwitch(\n this.applicationLayoutContext?.appSwitchConfig\n );\n }\n\n private updateIsSlottedContent() {\n const slotElement =\n this.hostElement.shadowRoot.querySelector('.content slot');\n\n this.hasSlottedElements = hasSlottedElements(slotElement);\n }\n\n private onContentBgClick(e: MouseEvent) {\n if (e.target === this.contentBackground) {\n e.preventDefault();\n }\n }\n\n render() {\n return (\n <Host\n class={{ [`breakpoint-${this.breakpoint}`]: true }}\n slot=\"application-header\"\n >\n {this.breakpoint === 'sm' && this.suppressResponsive === false && (\n <ix-menu-expand-icon\n onClick={() => this.onMenuClick()}\n expanded={this.menuExpanded}\n ></ix-menu-expand-icon>\n )}\n {this.applicationLayoutContext?.appSwitchConfig &&\n this.breakpoint !== 'sm' &&\n this.suppressResponsive === false && (\n <ix-icon-button\n onClick={() => this.showAppSwitch()}\n icon=\"apps\"\n ghost\n class=\"app-switch\"\n ></ix-icon-button>\n )}\n <div class=\"logo\">\n <slot name=\"logo\"></slot>\n </div>\n <div class=\"name\">{this.name}</div>\n <div class=\"content\">\n {this.breakpoint === 'sm' ? (\n <Fragment>\n <ix-icon-button\n class={{\n ['context-menu']: true,\n ['context-menu-visible']: this.hasSlottedElements,\n }}\n data-context-menu\n icon=\"more-menu\"\n ghost\n ></ix-icon-button>\n <ix-dropdown\n data-overflow-dropdown\n class=\"dropdown\"\n discoverAllSubmenus\n trigger={this.resolveContextMenuButton()}\n >\n <div\n class=\"dropdown-content\"\n onClick={(e) => this.onContentBgClick(e)}\n >\n <slot\n onSlotchange={() => this.updateIsSlottedContent()}\n ></slot>\n </div>\n </ix-dropdown>\n </Fragment>\n ) : (\n <slot onSlotchange={() => this.updateIsSlottedContent()}></slot>\n )}\n <slot name=\"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