@baloise/ds-core 19.0.1 → 19.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/components/bal-button2.js +14 -10
  2. package/components/bal-date.js +84 -61
  3. package/components/bal-field-hint.js +22 -10
  4. package/components/bal-hint2.js +35 -28
  5. package/components/bal-nav.js +154 -154
  6. package/components/bal-number-input.js +3 -0
  7. package/components/bal-popover2.js +1 -1
  8. package/components/bal-popup.js +1 -692
  9. package/components/bal-popup2.js +694 -0
  10. package/components/bal-radio2.js +1 -1
  11. package/components/bal-steps.js +1 -1
  12. package/components/bal-tabs2.js +35 -27
  13. package/components/index.esm.js +7 -1
  14. package/components/index.js +1 -1
  15. package/components/scroll.js +2 -0
  16. package/components/swiper.util.js +36 -36
  17. package/components/tokens.esm.js +1 -1
  18. package/dist/baloise-design-system/baloise-design-system.esm.js +1 -1
  19. package/dist/baloise-design-system/index.esm.js +1 -1
  20. package/dist/baloise-design-system/{p-3b1a0df0.js → p-022af4f2.js} +1 -1
  21. package/dist/baloise-design-system/{p-bbdf082862.entry.js → p-131fd635ef.entry.js} +1 -1
  22. package/dist/baloise-design-system/{p-40b022e526.entry.js → p-13ea819488.entry.js} +1 -1
  23. package/dist/baloise-design-system/{p-beb28f85.system.js → p-14c507db.system.js} +1 -1
  24. package/dist/baloise-design-system/{p-8f17a55f2b.system.entry.js → p-1693fa7649.system.entry.js} +1 -1
  25. package/dist/baloise-design-system/{p-0ac528b6cb.entry.js → p-16ebe71517.entry.js} +1 -1
  26. package/dist/baloise-design-system/p-1d4ea7e42b.system.entry.js +1 -0
  27. package/dist/baloise-design-system/{p-9b9be713.system.js → p-1d7c3cf2.system.js} +1 -1
  28. package/dist/baloise-design-system/{p-98b6f8ba43.entry.js → p-1e0a2263fb.entry.js} +1 -1
  29. package/dist/baloise-design-system/p-20bc89d933.entry.js +1 -0
  30. package/dist/baloise-design-system/{p-817f7907be.system.entry.js → p-2367556371.system.entry.js} +1 -1
  31. package/dist/baloise-design-system/{p-859c0fae39.system.entry.js → p-24336e0fca.system.entry.js} +1 -1
  32. package/dist/baloise-design-system/p-290dfd0212.system.entry.js +1 -0
  33. package/dist/baloise-design-system/p-2a27350c.js +1 -0
  34. package/dist/baloise-design-system/{p-b79164fedd.entry.js → p-32bf71aa6c.entry.js} +1 -1
  35. package/dist/baloise-design-system/p-345aa92d.system.js +1 -1
  36. package/dist/baloise-design-system/{p-a15a24d3a1.system.entry.js → p-35fde87c2a.system.entry.js} +1 -1
  37. package/dist/baloise-design-system/p-363a7f7760.entry.js +1 -0
  38. package/dist/baloise-design-system/{p-afe7f75fcf.system.entry.js → p-390b2af6a5.system.entry.js} +1 -1
  39. package/dist/baloise-design-system/p-3913c6ae.js +1 -1
  40. package/dist/baloise-design-system/{p-b268996da1.system.entry.js → p-42b2e62411.system.entry.js} +1 -1
  41. package/dist/baloise-design-system/{p-9f14664495.system.entry.js → p-47eaccc384.system.entry.js} +1 -1
  42. package/dist/baloise-design-system/{p-1e738175.system.js → p-490383ab.system.js} +1 -1
  43. package/dist/baloise-design-system/{p-f005df0cd0.entry.js → p-53b2b718c5.entry.js} +1 -1
  44. package/dist/baloise-design-system/{p-58cd37922d.system.entry.js → p-58b1d6fa96.system.entry.js} +1 -1
  45. package/dist/baloise-design-system/{p-faab35937e.system.entry.js → p-5fcfbec540.system.entry.js} +1 -1
  46. package/dist/baloise-design-system/{p-c8ee46d5bc.entry.js → p-64916e34a4.entry.js} +1 -1
  47. package/dist/baloise-design-system/p-659ecadc.system.js +1 -1
  48. package/dist/baloise-design-system/{p-655d37c8.system.js → p-68d7e929.system.js} +1 -1
  49. package/dist/baloise-design-system/p-702abad387.entry.js +1 -0
  50. package/dist/baloise-design-system/p-7d4fac85.js +1 -0
  51. package/dist/baloise-design-system/p-8a9fb4619a.entry.js +1 -0
  52. package/dist/baloise-design-system/p-8bd42bba68.entry.js +1 -0
  53. package/dist/baloise-design-system/p-967bdfab.js +1 -0
  54. package/dist/baloise-design-system/{p-5cfc65b40f.system.entry.js → p-98cf514345.system.entry.js} +1 -1
  55. package/dist/baloise-design-system/p-9d3935fbbc.entry.js +1 -0
  56. package/dist/baloise-design-system/{p-f19ea306.system.js → p-9f7a1215.system.js} +1 -1
  57. package/dist/baloise-design-system/p-a64c7a3b82.system.entry.js +1 -0
  58. package/dist/baloise-design-system/p-a7963df92a.entry.js +1 -0
  59. package/dist/baloise-design-system/p-b2f7e364.js +1 -0
  60. package/dist/baloise-design-system/{p-ef4bf5f5.js → p-b96e5a6c.js} +1 -1
  61. package/dist/baloise-design-system/{p-ec777a9167.entry.js → p-b9a4f3580b.entry.js} +1 -1
  62. package/dist/baloise-design-system/{p-df5ddf4439.system.entry.js → p-c5ac7b5d30.system.entry.js} +1 -1
  63. package/dist/baloise-design-system/{p-2bc77d4c8d.system.entry.js → p-c89750c825.system.entry.js} +1 -1
  64. package/dist/baloise-design-system/{p-f4f96647cf.system.entry.js → p-d09026edb1.system.entry.js} +1 -1
  65. package/dist/baloise-design-system/{p-234c26f450.system.entry.js → p-dd2a76bd7c.system.entry.js} +1 -1
  66. package/dist/baloise-design-system/p-df9bc850dc.system.entry.js +1 -0
  67. package/dist/baloise-design-system/p-e43b61e151.system.entry.js +1 -0
  68. package/dist/baloise-design-system/{p-5281d378.system.js → p-e453a2de.system.js} +1 -1
  69. package/dist/baloise-design-system/p-e75452d8.system.js +1 -0
  70. package/dist/baloise-design-system/{p-77c6d65eb1.entry.js → p-eaed1f800c.entry.js} +1 -1
  71. package/dist/baloise-design-system/p-f04cab5af1.entry.js +1 -0
  72. package/dist/baloise-design-system/p-f2cc4e63d4.entry.js +1 -0
  73. package/dist/baloise-design-system/{p-2556cb83d1.entry.js → p-f6b1d87619.entry.js} +1 -1
  74. package/dist/cjs/bal-button_2.cjs.entry.js +13 -9
  75. package/dist/cjs/bal-carousel_2.cjs.entry.js +4 -4
  76. package/dist/cjs/bal-date.cjs.entry.js +83 -60
  77. package/dist/cjs/bal-footer.cjs.entry.js +1 -1
  78. package/dist/cjs/bal-hint_5.cjs.entry.js +16 -21
  79. package/dist/cjs/bal-list_8.cjs.entry.js +3 -3
  80. package/dist/cjs/bal-logo.cjs.entry.js +3 -3
  81. package/dist/cjs/bal-modal_3.cjs.entry.js +1 -1
  82. package/dist/cjs/bal-nav_8.cjs.entry.js +157 -157
  83. package/dist/cjs/bal-navbar_5.cjs.entry.js +4 -4
  84. package/dist/cjs/bal-number-input.cjs.entry.js +3 -0
  85. package/dist/cjs/bal-pagination.cjs.entry.js +3 -3
  86. package/dist/cjs/bal-popup.cjs.entry.js +4 -4
  87. package/dist/cjs/bal-progress-bar.cjs.entry.js +4 -4
  88. package/dist/cjs/bal-radio_2.cjs.entry.js +1 -1
  89. package/dist/cjs/bal-segment_2.cjs.entry.js +4 -4
  90. package/dist/cjs/bal-shape.cjs.entry.js +1 -1
  91. package/dist/cjs/bal-steps.cjs.entry.js +4 -4
  92. package/dist/cjs/bal-tab-item_2.cjs.entry.js +36 -28
  93. package/dist/cjs/baloise-design-system.cjs.js +1 -1
  94. package/dist/cjs/{breakpoints.decorator-9a0be218.js → breakpoints.decorator-5086ec90.js} +1 -1
  95. package/dist/cjs/{breakpoints.subject-19c7123e.js → breakpoints.subject-a1180187.js} +1 -1
  96. package/dist/cjs/index.cjs.js +3 -3
  97. package/dist/cjs/{index.esm-1f386b07.js → index.esm-a38eebac.js} +7 -0
  98. package/dist/cjs/initialize-2e8978a4.js +1 -1
  99. package/dist/cjs/loader.cjs.js +1 -1
  100. package/dist/cjs/{scroll-73c1b762.js → scroll-dc37ea84.js} +2 -0
  101. package/dist/cjs/{tokens.esm-3468979c.js → tokens.esm-263be70d.js} +1 -1
  102. package/dist/cjs/{window-resize.decorator-86974eaf.js → window-resize.decorator-9a06680f.js} +1 -1
  103. package/dist/collection/components/bal-button/bal-button.js +33 -10
  104. package/dist/collection/components/bal-date/bal-date.js +86 -107
  105. package/dist/collection/components/bal-hint/bal-hint.css +1 -1
  106. package/dist/collection/components/bal-hint/bal-hint.js +11 -16
  107. package/dist/collection/components/bal-nav/bal-nav.js +7 -7
  108. package/dist/collection/components/bal-number-input/bal-number-input.utils.js +3 -0
  109. package/dist/collection/components/bal-popup/bal-popup.css +1 -1
  110. package/dist/collection/components/bal-popup/bal-popup.js +3 -3
  111. package/dist/collection/components/bal-steps/components/step-button.js +1 -1
  112. package/dist/collection/components/bal-tabs/bal-tabs.js +12 -12
  113. package/dist/collection/components/bal-tabs/components/tab-nav.js +9 -1
  114. package/dist/collection/utils/constants/version.constant.js +1 -1
  115. package/dist/collection/utils/scroll.js +2 -0
  116. package/dist/collection/utils/swiper/swiper.util.js +6 -6
  117. package/dist/esm/bal-button_2.entry.js +13 -9
  118. package/dist/esm/bal-carousel_2.entry.js +4 -4
  119. package/dist/esm/bal-date.entry.js +84 -61
  120. package/dist/esm/bal-footer.entry.js +1 -1
  121. package/dist/esm/bal-hint_5.entry.js +16 -21
  122. package/dist/esm/bal-list_8.entry.js +3 -3
  123. package/dist/esm/bal-logo.entry.js +3 -3
  124. package/dist/esm/bal-modal_3.entry.js +1 -1
  125. package/dist/esm/bal-nav_8.entry.js +157 -157
  126. package/dist/esm/bal-navbar_5.entry.js +4 -4
  127. package/dist/esm/bal-number-input.entry.js +3 -0
  128. package/dist/esm/bal-pagination.entry.js +3 -3
  129. package/dist/esm/bal-popup.entry.js +4 -4
  130. package/dist/esm/bal-progress-bar.entry.js +4 -4
  131. package/dist/esm/bal-radio_2.entry.js +1 -1
  132. package/dist/esm/bal-segment_2.entry.js +4 -4
  133. package/dist/esm/bal-shape.entry.js +1 -1
  134. package/dist/esm/bal-steps.entry.js +4 -4
  135. package/dist/esm/bal-tab-item_2.entry.js +36 -28
  136. package/dist/esm/baloise-design-system.js +1 -1
  137. package/dist/esm/{breakpoints.decorator-899aba5d.js → breakpoints.decorator-3666716a.js} +1 -1
  138. package/dist/esm/{breakpoints.subject-2397d734.js → breakpoints.subject-1aa7be9a.js} +1 -1
  139. package/dist/esm/{index.esm-21c97d14.js → index.esm-9079680d.js} +7 -1
  140. package/dist/esm/index.js +4 -4
  141. package/dist/esm/initialize-be160cc4.js +1 -1
  142. package/dist/esm/loader.js +1 -1
  143. package/dist/esm/{scroll-f4b20848.js → scroll-521224a9.js} +2 -0
  144. package/dist/esm/{tokens.esm-a6a0f537.js → tokens.esm-a3abda33.js} +1 -1
  145. package/dist/esm/{window-resize.decorator-f286b710.js → window-resize.decorator-ef52bf33.js} +1 -1
  146. package/dist/esm-es5/bal-button_2.entry.js +1 -1
  147. package/dist/esm-es5/bal-carousel_2.entry.js +1 -1
  148. package/dist/esm-es5/bal-date.entry.js +1 -1
  149. package/dist/esm-es5/bal-footer.entry.js +1 -1
  150. package/dist/esm-es5/bal-hint_5.entry.js +1 -1
  151. package/dist/esm-es5/bal-list_8.entry.js +1 -1
  152. package/dist/esm-es5/bal-logo.entry.js +1 -1
  153. package/dist/esm-es5/bal-modal_3.entry.js +1 -1
  154. package/dist/esm-es5/bal-nav_8.entry.js +1 -1
  155. package/dist/esm-es5/bal-navbar_5.entry.js +1 -1
  156. package/dist/esm-es5/bal-number-input.entry.js +1 -1
  157. package/dist/esm-es5/bal-pagination.entry.js +1 -1
  158. package/dist/esm-es5/bal-popup.entry.js +1 -1
  159. package/dist/esm-es5/bal-progress-bar.entry.js +1 -1
  160. package/dist/esm-es5/bal-radio_2.entry.js +1 -1
  161. package/dist/esm-es5/bal-segment_2.entry.js +1 -1
  162. package/dist/esm-es5/bal-shape.entry.js +1 -1
  163. package/dist/esm-es5/bal-steps.entry.js +1 -1
  164. package/dist/esm-es5/bal-tab-item_2.entry.js +1 -1
  165. package/dist/esm-es5/baloise-design-system.js +1 -1
  166. package/dist/esm-es5/breakpoints.decorator-3666716a.js +1 -0
  167. package/dist/esm-es5/{breakpoints.subject-2397d734.js → breakpoints.subject-1aa7be9a.js} +1 -1
  168. package/dist/esm-es5/index.esm-9079680d.js +1 -0
  169. package/dist/esm-es5/index.js +1 -1
  170. package/dist/esm-es5/initialize-be160cc4.js +1 -1
  171. package/dist/esm-es5/loader.js +1 -1
  172. package/dist/esm-es5/scroll-521224a9.js +1 -0
  173. package/dist/esm-es5/{swiper.util-01fa2dd9.js → swiper.util-5f92ac1c.js} +1 -1
  174. package/dist/esm-es5/{window-resize.decorator-f286b710.js → window-resize.decorator-ef52bf33.js} +1 -1
  175. package/dist/types/components/bal-button/bal-button.d.ts +5 -1
  176. package/dist/types/components/bal-button/bal-button.interfaces.d.ts +2 -0
  177. package/dist/types/components/bal-date/bal-date.d.ts +10 -15
  178. package/dist/types/components/bal-hint/bal-hint.d.ts +3 -2
  179. package/dist/types/components/bal-nav/bal-nav.d.ts +5 -5
  180. package/dist/types/components/bal-popup/bal-popup.d.ts +1 -1
  181. package/dist/types/components/bal-tabs/bal-tabs.d.ts +6 -6
  182. package/dist/types/components/bal-tabs/components/tab-nav.d.ts +1 -1
  183. package/dist/types/components.d.ts +5 -1
  184. package/package.json +6 -6
  185. package/dist/baloise-design-system/p-058dece332.system.entry.js +0 -1
  186. package/dist/baloise-design-system/p-082910ce81.entry.js +0 -1
  187. package/dist/baloise-design-system/p-28fbcf6fc9.entry.js +0 -1
  188. package/dist/baloise-design-system/p-2ff3021da9.entry.js +0 -1
  189. package/dist/baloise-design-system/p-36ce945a77.entry.js +0 -1
  190. package/dist/baloise-design-system/p-42629a573a.system.entry.js +0 -1
  191. package/dist/baloise-design-system/p-5e1f2c26.js +0 -1
  192. package/dist/baloise-design-system/p-65e20456c6.entry.js +0 -1
  193. package/dist/baloise-design-system/p-85a6191cd8.entry.js +0 -1
  194. package/dist/baloise-design-system/p-894423fd.system.js +0 -1
  195. package/dist/baloise-design-system/p-917729be7f.entry.js +0 -1
  196. package/dist/baloise-design-system/p-b26a67d805.entry.js +0 -1
  197. package/dist/baloise-design-system/p-c1852273.js +0 -1
  198. package/dist/baloise-design-system/p-c661a0bb96.system.entry.js +0 -1
  199. package/dist/baloise-design-system/p-c72db97c1c.system.entry.js +0 -1
  200. package/dist/baloise-design-system/p-ddec5b99.js +0 -1
  201. package/dist/baloise-design-system/p-e5604d449d.system.entry.js +0 -1
  202. package/dist/baloise-design-system/p-ee275c12a9.entry.js +0 -1
  203. package/dist/baloise-design-system/p-f89208a3.js +0 -1
  204. package/dist/esm-es5/breakpoints.decorator-899aba5d.js +0 -1
  205. package/dist/esm-es5/index.esm-21c97d14.js +0 -1
  206. package/dist/esm-es5/scroll-f4b20848.js +0 -1
  207. package/dist/baloise-design-system/{p-95d42ad1.js → p-928bbc47.js} +0 -0
  208. package/dist/baloise-design-system/{p-cebe968d.system.js → p-bccc3d48.system.js} +0 -0
  209. package/dist/cjs/{swiper.util-f1c856f3.js → swiper.util-d23b8eb0.js} +36 -36
  210. package/dist/esm/{swiper.util-01fa2dd9.js → swiper.util-5f92ac1c.js} +36 -36
  211. /package/dist/esm-es5/{tokens.esm-a6a0f537.js → tokens.esm-a3abda33.js} +0 -0
@@ -1,695 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { _ as __decorate, a as __metadata } from './tslib.es6.js';
3
- import { B as BEM } from './bem.js';
4
- import { b as balBrowser } from './browser.js';
5
- import { s as stopEventBubbling } from './form-input.js';
6
- import { k as debounce } from './helpers.js';
7
- import { L as Logger } from './log.js';
8
- import { f as focusableQueryString } from './focus-visible.js';
9
- import { d as defineCustomElement$5 } from './bal-close2.js';
10
- import { d as defineCustomElement$4 } from './bal-heading2.js';
11
- import { d as defineCustomElement$3 } from './bal-icon2.js';
12
- import { d as defineCustomElement$2 } from './bal-stack2.js';
13
- import { b as balFloatingUi } from './floating-ui.js';
14
- import { e as isEscapeKey } from './keyboard.helpers.js';
15
-
16
- class AbstractVariantRenderer {
17
- showContainerElement(component) {
18
- if (component.containerEl) {
19
- this.showElement(component.containerEl);
20
- }
21
- }
22
- hideContainerElement(component) {
23
- if (component.containerEl) {
24
- this.hideElement(component.containerEl);
25
- }
26
- }
27
- showArrowElement(component, hasArrow = component.arrow) {
28
- if (hasArrow && component.arrowEl) {
29
- this.showElement(component.arrowEl);
30
- }
31
- }
32
- hideArrowElement(component) {
33
- if (component.arrowEl) {
34
- Object.assign(component.arrowEl.style, {
35
- left: '',
36
- top: '',
37
- display: 'none',
38
- visibility: 'hidden',
39
- });
40
- }
41
- }
42
- showBackdropElement(component, hasBackdrop = component.backdrop) {
43
- if (hasBackdrop && component.backdropEl) {
44
- this.showElement(component.backdropEl);
45
- }
46
- }
47
- hideBackdropElement(component) {
48
- if (component.backdropEl) {
49
- this.hideElement(component.backdropEl);
50
- }
51
- }
52
- showElement(element) {
53
- if (element) {
54
- element.style.setProperty('display', 'block');
55
- element.style.setProperty('visibility', 'visible');
56
- }
57
- }
58
- hideElement(element) {
59
- if (element) {
60
- element.style.removeProperty('display');
61
- element.style.removeProperty('visibility');
62
- }
63
- }
64
- }
65
-
66
- class DrawerVariantRenderer extends AbstractVariantRenderer {
67
- constructor() {
68
- super(...arguments);
69
- this.backdrop = false;
70
- this.offset = 0;
71
- }
72
- async present(component) {
73
- if (component.containerEl && component.trigger && component.backdropEl) {
74
- this.backdrop = component.getBooleanValue(component.trigger, 'bal-popup-backdrop', component.backdrop);
75
- this.offset = component.getValue(component.trigger, 'bal-popup-offset', component.offset);
76
- component.containerEl.style.setProperty('inset', `auto 0px 0px 0px`);
77
- component.containerEl.style.setProperty('bottom', `${this.offset}px`);
78
- component.backdropEl.style.setProperty('bottom', `${this.offset}px`);
79
- this.showBackdropElement(component, this.backdrop);
80
- this.showContainerElement(component);
81
- return true;
82
- }
83
- return false;
84
- }
85
- async update(_component) {
86
- return false;
87
- }
88
- async dismiss(component) {
89
- if (component.containerEl && component.backdropEl) {
90
- component.balWillAnimate.emit();
91
- this.hideBackdropElement(component);
92
- this.hideContainerElement(component);
93
- component.containerEl.style.removeProperty('inset');
94
- component.containerEl.style.removeProperty('bottom');
95
- component.backdropEl.style.removeProperty('bottom');
96
- return true;
97
- }
98
- return false;
99
- }
100
- }
101
-
102
- class FullscreenVariantRenderer extends AbstractVariantRenderer {
103
- constructor() {
104
- super(...arguments);
105
- this.offset = 0;
106
- }
107
- async present(component) {
108
- if (component.containerEl && component.trigger) {
109
- this.offset = component.getValue(component.trigger, 'bal-popup-offset', component.offset);
110
- component.containerEl.style.setProperty('inset', `${this.offset}px auto auto 0px`);
111
- if (this.offset > 0) {
112
- component.containerEl.style.setProperty('box-shadow', `inset var(--bal-nav-meta-bar-variant-white-shadow)`);
113
- }
114
- this.showBackdropElement(component);
115
- this.showContainerElement(component);
116
- this.hideArrowElement(component);
117
- return true;
118
- }
119
- return false;
120
- }
121
- async update(_component) {
122
- return false;
123
- }
124
- async dismiss(component) {
125
- if (component.containerEl) {
126
- this.hideBackdropElement(component);
127
- this.hideContainerElement(component);
128
- this.hideArrowElement(component);
129
- component.containerEl.style.removeProperty('box-shadow');
130
- component.containerEl.style.removeProperty('inset');
131
- return true;
132
- }
133
- return false;
134
- }
135
- }
136
-
137
- class PopoverVariantRenderer extends AbstractVariantRenderer {
138
- constructor() {
139
- super(...arguments);
140
- this.placement = 'bottom';
141
- this.offset = 0;
142
- this.arrow = false;
143
- this.backdrop = false;
144
- this.reference = undefined;
145
- this.triggerEl = null;
146
- }
147
- async present(component) {
148
- const lib = await balFloatingUi.load();
149
- //
150
- // identify trigger element or the the closest trigger available
151
- if (!component.trigger && balBrowser.hasDocument) {
152
- const firstTrigger = Array.from(document.querySelectorAll(`[bal-popup="${component.el.id}"]`))[0];
153
- component.trigger = firstTrigger;
154
- }
155
- if (component.trigger && component.containerEl && component.arrowEl) {
156
- this.placement = component.getValue(component.trigger, 'bal-popup-placement', component.placement);
157
- this.arrow = component.getBooleanValue(component.trigger, 'bal-popup-arrow', component.arrow);
158
- this.backdrop = component.getBooleanValue(component.trigger, 'bal-popup-backdrop', component.backdrop);
159
- this.reference = component.getValue(component.trigger, 'bal-popup-reference', component.reference);
160
- this.offset = component.getNumberValue(component.trigger, 'bal-popup-offset', component.offset);
161
- this.triggerEl = component.trigger;
162
- if (this.reference && balBrowser.hasDocument) {
163
- const referenceEl = document.getElementById(this.reference);
164
- this.triggerEl = referenceEl ? referenceEl : component.trigger;
165
- }
166
- if (this.triggerEl) {
167
- //
168
- // show all required elements
169
- this.showContainerElement(component);
170
- this.showBackdropElement(component, this.backdrop);
171
- this.showArrowElement(component, this.arrow);
172
- this.triggerEl.classList.add('bal-popup-variant-popover-trigger');
173
- const isNavMetaDesktopPopup = this.placement === 'bottom-end' && this.triggerEl !== component.trigger;
174
- if (isNavMetaDesktopPopup) {
175
- component.setMinWidth(this.triggerEl.clientWidth);
176
- }
177
- this.cleanup = lib.autoUpdate(this.triggerEl, component.containerEl, () => {
178
- this.update(component);
179
- }, {
180
- ancestorScroll: true,
181
- ancestorResize: true,
182
- elementResize: false,
183
- layoutShift: true,
184
- animationFrame: true,
185
- });
186
- return true;
187
- }
188
- }
189
- return false;
190
- }
191
- async update(component) {
192
- var _a, _b;
193
- if (this.triggerEl && component.trigger && component.containerEl && component.arrowEl) {
194
- const lib = await balFloatingUi.load();
195
- const isNavMetaDesktopPopup = this.placement === 'bottom-end' && this.triggerEl !== component.trigger;
196
- const referenceRect = (_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
197
- const triggerRect = (_b = component.trigger) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
198
- let isInFrame = false;
199
- if (balBrowser.hasWindow) {
200
- isInFrame = !!window.frameElement;
201
- }
202
- lib
203
- .computePosition(this.triggerEl, component.containerEl, {
204
- placement: this.placement,
205
- middleware: [
206
- isInFrame ? undefined : lib.shift(),
207
- lib.flip(),
208
- lib.offset(this.arrow ? 16 : this.offset),
209
- lib.arrow({
210
- element: component.arrowEl,
211
- padding: 4,
212
- }),
213
- ],
214
- })
215
- .then(({ x, y, middlewareData, placement }) => {
216
- if (component.containerEl) {
217
- Object.assign(component.containerEl.style, {
218
- left: `${x}px`,
219
- top: `${y}px`,
220
- });
221
- const side = placement.split('-')[0];
222
- const staticSide = {
223
- top: 'bottom',
224
- right: 'left',
225
- bottom: 'top',
226
- left: 'right',
227
- }[side];
228
- if (middlewareData.arrow && component.arrowEl) {
229
- const arrowPosition = middlewareData.arrow;
230
- if (isNavMetaDesktopPopup) {
231
- const diff = referenceRect.right - triggerRect.right - 4;
232
- Object.assign(component.arrowEl.style, {
233
- right: `${diff + triggerRect.width / 2}px`,
234
- left: '',
235
- top: y != null && arrowPosition.y != null ? `${arrowPosition.y}px` : '',
236
- bottom: '',
237
- [staticSide]: `${-4}px`,
238
- });
239
- }
240
- else {
241
- Object.assign(component.arrowEl.style, {
242
- left: x != null && arrowPosition.x != null ? `${arrowPosition.x}px` : '',
243
- top: y != null && arrowPosition.y != null ? `${arrowPosition.y}px` : '',
244
- right: '',
245
- bottom: '',
246
- [staticSide]: `${-4}px`,
247
- });
248
- }
249
- }
250
- }
251
- });
252
- return true;
253
- }
254
- return false;
255
- }
256
- async dismiss(component) {
257
- if (component.containerEl && component.arrowEl && this.triggerEl) {
258
- if (this.cleanup) {
259
- this.cleanup();
260
- }
261
- this.triggerEl.classList.remove('bal-popup-variant-popover-trigger');
262
- this.hideBackdropElement(component);
263
- this.hideContainerElement(component);
264
- this.hideArrowElement(component);
265
- return true;
266
- }
267
- return false;
268
- }
269
- }
270
-
271
- class VariantRenderer {
272
- constructor(renderer) {
273
- this.renderer = renderer;
274
- }
275
- async present(component) {
276
- component.balWillAnimate.emit();
277
- const didRender = await this.renderer.present(component);
278
- if (didRender) {
279
- component.presented = true;
280
- component.balDidAnimate.emit();
281
- }
282
- return didRender;
283
- }
284
- async update(component) {
285
- component.balWillAnimate.emit();
286
- const didRender = await this.renderer.update(component);
287
- if (didRender) {
288
- component.balDidAnimate.emit();
289
- }
290
- return didRender;
291
- }
292
- async dismiss(component) {
293
- component.balWillAnimate.emit();
294
- const didRender = await this.renderer.dismiss(component);
295
- if (didRender) {
296
- component.presented = false;
297
- component.balDidAnimate.emit();
298
- }
299
- return didRender;
300
- }
301
- }
302
-
303
- const balPopupCss = ":root{--bal-popup-backdrop-background:rgba(0,7,57,.8);--bal-popup-container-padding-top:0;--bal-popup-container-padding-bottom:0;--bal-popup-container-background:var(--bal-color-white);--bal-popup-variant-popover-max-width:auto;--bal-popup-variant-popover-radius:var(--bal-radius-large);--bal-popup-variant-popover-shadow:var(--bal-shadow-normal);--bal-popup-variant-drawer-radius:var(--bal-radius-large);--bal-popup-arrow-background:var(--bal-color-white)}.bal-popup{position:static;display:inline;z-index:var(--bal-z-index-popup)}.bal-popup__container{background:var(--bal-popup-container-background);display:none;visibility:hidden;padding-top:var(--bal-popup-container-padding-top);padding-bottom:var(--bal-popup-container-padding-bottom);-ms-flex-positive:1;flex-grow:1;margin:0 auto;position:relative;width:auto}.bal-popup__container--variant-popover{border-radius:var(--bal-popup-variant-popover-radius);-webkit-box-shadow:var(--bal-popup-variant-popover-shadow);box-shadow:var(--bal-popup-variant-popover-shadow);width:var(--bal-popup-variant-popover-max-width);position:absolute;top:0;left:0}.bal-popup__container--variant-fullscreen{position:fixed;margin:0;width:100%;min-width:100%;max-width:100% !important;min-height:var(--bal-app-height, 100%)}.bal-popup__container--variant-fullscreen .bal-popup__inner{padding-left:var(--bal-container-space);padding-right:var(--bal-container-space)}.bal-popup__container--variant-drawer{position:fixed;border-top-left-radius:var(--bal-popup-variant-drawer-radius);border-top-right-radius:var(--bal-popup-variant-drawer-radius);padding-left:var(--bal-container-space);padding-right:var(--bal-container-space);width:100%}.bal-popup__inner{overflow-y:auto;max-height:calc(var(--bal-app-height, 100%) - 4rem)}.bal-popup__inner__head{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.bal-popup__inner__content{width:100%}.bal-popup__arrow{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:absolute;width:8px;height:8px;background:var(--bal-popup-arrow-background);-webkit-transform:rotate(45deg);transform:rotate(45deg);display:none;visibility:hidden}.bal-popup__backdrop{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:fixed;bottom:0;left:0;right:0;top:0;background-color:var(--bal-popup-backdrop-background);width:100vw;display:none;visibility:hidden}.bal-popup-variant-popover-trigger,.bal-popup-permanent-trigger{z-index:calc(var(--bal-z-index-popup) + 1) !important;position:relative !important}";
304
- const BalPopupStyle0 = balPopupCss;
305
-
306
- const Popup = /*@__PURE__*/ proxyCustomElement(class Popup extends HTMLElement {
307
- constructor() {
308
- super();
309
- this.__registerHost();
310
- this.balChange = createEvent(this, "balChange", 7);
311
- this.balWillAnimate = createEvent(this, "balWillAnimate", 7);
312
- this.balDidAnimate = createEvent(this, "balDidAnimate", 7);
313
- this.popupId = `bal-pu-${popupIds++}`;
314
- this.isClickedOutsideOnMouseDown = false;
315
- this.isClickedOutsideOnMouseUp = false;
316
- this.popoverVariantRenderer = new VariantRenderer(new PopoverVariantRenderer());
317
- this.fullscreenVariantRenderer = new VariantRenderer(new FullscreenVariantRenderer());
318
- this.drawerVariantRenderer = new VariantRenderer(new DrawerVariantRenderer());
319
- this.lastVariant = 'popover';
320
- this.initialActive = this.active;
321
- /**
322
- * LISTENERS
323
- * ------------------------------------------------------
324
- */
325
- this.debouncedGlobalClick = debounce((trigger) => this.notifyGlobalClick(trigger), 10);
326
- /**
327
- * EVENT BINDING
328
- * ------------------------------------------------------
329
- */
330
- this.onBackdropClick = (ev) => {
331
- if (this.activeBackdropDismiss && this.presented && ev && ev.target) {
332
- const element = ev.target;
333
- return element.classList.contains('bal-popup__backdrop');
334
- }
335
- return false;
336
- };
337
- this.onCloseClick = () => {
338
- if (this.activeClosable) {
339
- this.dismiss();
340
- }
341
- };
342
- this.activeClosable = false;
343
- this.activeBackdropDismiss = false;
344
- this.activeVariant = 'popover';
345
- this.trigger = undefined;
346
- this.lastTrigger = undefined;
347
- this.minContainerWidth = 0;
348
- this.label = '';
349
- this.reference = undefined;
350
- this.variant = 'popover';
351
- this.placement = 'bottom';
352
- this.arrow = false;
353
- this.backdrop = false;
354
- this.offset = 0;
355
- this.closable = false;
356
- this.backdropDismiss = false;
357
- this.active = false;
358
- this.presented = false;
359
- this.contentWidth = undefined;
360
- this.demo = false;
361
- }
362
- createLogger(log) {
363
- this.log = log;
364
- }
365
- async variantChanged(newVariant, oldVariant) {
366
- if (newVariant !== oldVariant) {
367
- await this.getVariantRenderer(oldVariant).dismiss(this);
368
- if (this.activeVariant !== newVariant) {
369
- this.lastVariant = this.activeVariant;
370
- this.activeVariant = newVariant;
371
- await this.getVariantRenderer(this.lastVariant).dismiss(this);
372
- }
373
- if (this.presented) {
374
- await this.getVariantRenderer(newVariant).present(this);
375
- }
376
- }
377
- }
378
- async activeChanged(newActive, oldActive) {
379
- if (newActive !== oldActive && newActive !== this.presented) {
380
- if (newActive) {
381
- this.present();
382
- }
383
- else {
384
- this.dismiss();
385
- }
386
- }
387
- }
388
- contentWidthChanged(newValue, oldValue) {
389
- if (newValue !== oldValue) {
390
- if (newValue === undefined) {
391
- this.el.style.removeProperty('--bal-popup-variant-popover-max-width');
392
- }
393
- else {
394
- this.el.style.setProperty('--bal-popup-variant-popover-max-width', `${this.contentWidth}px`);
395
- }
396
- }
397
- }
398
- /**
399
- * LIFECYCLE
400
- * ------------------------------------------------------
401
- */
402
- componentDidLoad() {
403
- this.contentWidthChanged(this.contentWidth, 0);
404
- if (this.initialActive === true && this.presented !== true) {
405
- this.present();
406
- }
407
- if (this.demo) {
408
- this.present();
409
- }
410
- }
411
- async listenOnGlobalClick(ev) {
412
- var _a;
413
- const target = ev.target;
414
- const trigger = target.closest('[bal-popup]');
415
- if (trigger && balBrowser.hasWindow) {
416
- const popupId = ((_a = trigger.attributes.getNamedItem('bal-popup')) === null || _a === void 0 ? void 0 : _a.nodeValue) || '';
417
- if (this.el.id === popupId) {
418
- this.debouncedGlobalClick(trigger);
419
- }
420
- }
421
- }
422
- async listenOnKeyDown(ev) {
423
- if (this.activeClosable && this.presented && isEscapeKey(ev)) {
424
- stopEventBubbling(ev);
425
- this.dismiss();
426
- }
427
- }
428
- async listenOnMouseDown(ev) {
429
- this.isClickedOutsideOnMouseDown = this.onBackdropClick(ev);
430
- }
431
- async listenOnMouseUp(ev) {
432
- this.isClickedOutsideOnMouseUp = this.onBackdropClick(ev);
433
- }
434
- async listenOnComponentClick() {
435
- if (this.presented &&
436
- this.activeBackdropDismiss &&
437
- this.isClickedOutsideOnMouseUp &&
438
- this.isClickedOutsideOnMouseDown) {
439
- await this.dismiss();
440
- }
441
- }
442
- /**
443
- * PUBLIC METHODS
444
- * ------------------------------------------------------
445
- */
446
- /**
447
- * Opens the popup
448
- */
449
- async present() {
450
- await this.resetAllVariants();
451
- if (await this._present()) {
452
- this.lastTrigger = this.trigger;
453
- this.balChange.emit(this.presented);
454
- }
455
- }
456
- /**
457
- * Closes the popup
458
- */
459
- async dismiss() {
460
- await this.resetAllVariants();
461
- if (await this._dismiss()) {
462
- this.lastTrigger = this.trigger;
463
- this.balChange.emit(this.presented);
464
- }
465
- }
466
- /**
467
- * Triggers the popup
468
- */
469
- async toggle() {
470
- if (this.presented) {
471
- return this.dismiss();
472
- }
473
- else {
474
- return this.present();
475
- }
476
- }
477
- /**
478
- * @internal
479
- */
480
- async setMinWidth(value) {
481
- if (this.containerEl) {
482
- this.containerEl.style.minWidth = `${value}px`;
483
- this.minContainerWidth = value;
484
- }
485
- }
486
- /**
487
- * @internal
488
- */
489
- async _emitChange() {
490
- this.balChange.emit(this.presented);
491
- }
492
- /**
493
- * @internal
494
- */
495
- async _present() {
496
- if (balBrowser.hasDocument) {
497
- this.lastFocus = document.activeElement || undefined;
498
- }
499
- if (this.lastVariantRenderer) {
500
- await this.lastVariantRenderer.dismiss(this);
501
- this.presented = true;
502
- }
503
- this.lastVariantRenderer = this.getVariantRenderer();
504
- const result = await this.lastVariantRenderer.present(this);
505
- this.focusFirstDescendant();
506
- return result;
507
- }
508
- /**
509
- * @internal
510
- */
511
- async _dismiss() {
512
- var _a;
513
- const result = await this.getVariantRenderer().dismiss(this);
514
- this.lastVariantRenderer = undefined;
515
- if (this.lastFocus && this.lastFocus.focus) {
516
- (_a = this.lastFocus) === null || _a === void 0 ? void 0 : _a.focus();
517
- }
518
- return result;
519
- }
520
- /**
521
- * GETTERS
522
- * ------------------------------------------------------
523
- */
524
- getVariantRenderer(variant = this.activeVariant) {
525
- switch (variant) {
526
- case 'fullscreen':
527
- return this.fullscreenVariantRenderer;
528
- case 'drawer':
529
- return this.drawerVariantRenderer;
530
- default:
531
- return this.popoverVariantRenderer;
532
- }
533
- }
534
- getValue(trigger, attributeName, componentValue) {
535
- const attributeValue = trigger.attributes.getNamedItem(attributeName);
536
- return attributeValue ? attributeValue.value : componentValue;
537
- }
538
- getNumberValue(trigger, attributeName, componentValue) {
539
- const attributeValue = trigger.attributes.getNamedItem(attributeName);
540
- if (attributeValue) {
541
- return parseInt(attributeValue.value, 10) || componentValue;
542
- }
543
- return componentValue;
544
- }
545
- getBooleanValue(trigger, attributeName, componentValue) {
546
- const attributeValue = trigger.attributes.getNamedItem(attributeName);
547
- if (attributeValue) {
548
- const booleanValue = attributeValue.value === '' || attributeValue.value === 'true' ? true : false;
549
- return attributeValue ? booleanValue : componentValue;
550
- }
551
- return componentValue;
552
- }
553
- /**
554
- * PRIVATE METHODS
555
- * ------------------------------------------------------
556
- */
557
- notifyGlobalClick(trigger) {
558
- this.trigger = trigger;
559
- this.lastTrigger = this.lastTrigger === undefined ? this.trigger : this.lastTrigger;
560
- this.activeVariant = this.getValue(trigger, 'bal-popup-variant', this.variant);
561
- this.activeClosable = this.getBooleanValue(trigger, 'bal-popup-closable', this.closable);
562
- this.activeBackdropDismiss = this.getBooleanValue(trigger, 'bal-popup-backdrop-dismiss', this.backdropDismiss);
563
- // present or dismiss active variant
564
- if (this.presented && this.lastTrigger !== this.trigger) {
565
- this._present();
566
- this.lastTrigger = this.trigger;
567
- }
568
- else {
569
- this.toggle();
570
- }
571
- }
572
- async resetAllVariants() {
573
- await this.dismissAllOtherPopups();
574
- if (this.lastVariant !== this.activeVariant) {
575
- const lastVariant = this.getVariantRenderer(this.lastVariant);
576
- await lastVariant.dismiss(this);
577
- }
578
- this.lastVariant = this.activeVariant;
579
- }
580
- async dismissAllOtherPopups() {
581
- if (balBrowser.hasDocument) {
582
- const popups = Array.from(document.getElementsByTagName('bal-popup')).filter(el => el.id !== this.el.id && el.ariaHidden !== 'true');
583
- for (let index = 0; index < popups.length; index++) {
584
- const popup = popups[index];
585
- await popup._dismiss();
586
- await popup._emitChange();
587
- }
588
- }
589
- }
590
- focusFirstDescendant() {
591
- const { el } = this;
592
- const firstInput = el.querySelector(focusableQueryString);
593
- if (firstInput) {
594
- firstInput.focus();
595
- }
596
- else {
597
- el.focus();
598
- }
599
- }
600
- /**
601
- * RENDER
602
- * ------------------------------------------------------
603
- */
604
- render() {
605
- const block = BEM.block('popup');
606
- const containerBlock = block.element('container');
607
- const arrowBlock = block.element('arrow');
608
- const backdropBlock = block.element('backdrop');
609
- const innerBlock = block.element('inner');
610
- const innerHeadBlock = innerBlock.element('head');
611
- const innerContentBlock = innerBlock.element('content');
612
- return (h(Host, { key: '22256d10b23aaeefad30786345780029c23f10a5', class: Object.assign({}, block.class()), role: "dialog", "aria-hidden": `${this.presented !== true}`, "aria-modal": `${this.presented === true}`, "aria-presented": `${this.presented === true}`, "aria-labelledby": `${this.popupId}-heading` }, h("div", { key: 'a3a5862b32a8a6acadd12893729148e016527dec', class: Object.assign({}, backdropBlock.class()), ref: backdropEl => (this.backdropEl = backdropEl) }), h("div", { key: 'da06417052ab28135f651a6e3015462ae4d36915', class: Object.assign(Object.assign({}, containerBlock.class()), containerBlock.modifier(`variant-${this.activeVariant}`).class()), ref: containerEl => (this.containerEl = containerEl), style: { minWidth: `${this.minContainerWidth}px` } }, h("div", { key: 'd442c9ae9d377cd18d7853cb850182e5e117a199', class: Object.assign({}, arrowBlock.class()), ref: arrowEl => (this.arrowEl = arrowEl) }), h("bal-stack", { key: '078c31c4580e387b73b455afcc81610ea9ce7c9e', layout: "vertical", px: this.activeVariant === 'popover' ? 'medium' : 'none', py: "medium", class: Object.assign({}, innerBlock.class()) }, this.label ? (h("bal-stack", { space: "auto", class: Object.assign({}, innerHeadBlock.class()) }, h("bal-heading", { "data-test": "bal-popup-label", level: "span", "visual-level": "large", id: `${this.popupId}-heading` }, this.label), this.activeClosable ? (h("bal-close", { "data-test": "bal-popup-close", tabindex: -1, onClick: () => this.onCloseClick() })) : (''))) : (''), h("div", { key: '14cee241ee538a5ff4075b255841deaa0ca06ff6', class: Object.assign({}, innerContentBlock.class()), ref: contentEl => (this.contentEl = contentEl), "data-test": "bal-popup-content" }, h("slot", { key: '834174282762c50461b4a9851c74416804905344' }))))));
613
- }
614
- get el() { return this; }
615
- static get watchers() { return {
616
- "variant": ["variantChanged"],
617
- "active": ["activeChanged"],
618
- "contentWidth": ["contentWidthChanged"]
619
- }; }
620
- static get style() { return BalPopupStyle0; }
621
- }, [4, "bal-popup", {
622
- "label": [1],
623
- "reference": [1],
624
- "variant": [1],
625
- "placement": [1],
626
- "arrow": [4],
627
- "backdrop": [4],
628
- "offset": [2],
629
- "closable": [4],
630
- "backdropDismiss": [4, "backdrop-dismiss"],
631
- "active": [4],
632
- "contentWidth": [2, "content-width"],
633
- "demo": [4],
634
- "activeClosable": [32],
635
- "activeBackdropDismiss": [32],
636
- "activeVariant": [32],
637
- "trigger": [32],
638
- "lastTrigger": [32],
639
- "minContainerWidth": [32],
640
- "presented": [32],
641
- "present": [64],
642
- "dismiss": [64],
643
- "toggle": [64],
644
- "setMinWidth": [64],
645
- "_emitChange": [64],
646
- "_present": [64],
647
- "_dismiss": [64]
648
- }, [[8, "click", "listenOnGlobalClick"], [4, "keydown", "listenOnKeyDown"], [1, "mousedown", "listenOnMouseDown"], [1, "mouseup", "listenOnMouseUp"], [0, "click", "listenOnComponentClick"]], {
649
- "variant": ["variantChanged"],
650
- "active": ["activeChanged"],
651
- "contentWidth": ["contentWidthChanged"]
652
- }]);
653
- __decorate([
654
- Logger('bal-popup'),
655
- __metadata("design:type", Function),
656
- __metadata("design:paramtypes", [Function]),
657
- __metadata("design:returntype", void 0)
658
- ], Popup.prototype, "createLogger", null);
659
- let popupIds = 0;
660
- function defineCustomElement$1() {
661
- if (typeof customElements === "undefined") {
662
- return;
663
- }
664
- const components = ["bal-popup", "bal-close", "bal-heading", "bal-icon", "bal-stack"];
665
- components.forEach(tagName => { switch (tagName) {
666
- case "bal-popup":
667
- if (!customElements.get(tagName)) {
668
- customElements.define(tagName, Popup);
669
- }
670
- break;
671
- case "bal-close":
672
- if (!customElements.get(tagName)) {
673
- defineCustomElement$5();
674
- }
675
- break;
676
- case "bal-heading":
677
- if (!customElements.get(tagName)) {
678
- defineCustomElement$4();
679
- }
680
- break;
681
- case "bal-icon":
682
- if (!customElements.get(tagName)) {
683
- defineCustomElement$3();
684
- }
685
- break;
686
- case "bal-stack":
687
- if (!customElements.get(tagName)) {
688
- defineCustomElement$2();
689
- }
690
- break;
691
- } });
692
- }
1
+ import { P as Popup, d as defineCustomElement$1 } from './bal-popup2.js';
693
2
 
694
3
  const BalPopup = Popup;
695
4
  const defineCustomElement = defineCustomElement$1;