@baloise/ds-core 16.0.2 → 16.0.3-nightly.20240325

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 (133) hide show
  1. package/components/bal-app.js +1 -85
  2. package/components/bal-app2.js +87 -0
  3. package/components/bal-doc-app.d.ts +11 -0
  4. package/components/bal-doc-app.js +260 -0
  5. package/components/index.js +5 -282
  6. package/components/initialize.js +281 -0
  7. package/components/tokens.esm.js +1 -1
  8. package/dist/baloise-design-system/baloise-design-system.esm.js +1 -1
  9. package/dist/baloise-design-system/baloise-design-system.js +1 -1
  10. package/dist/baloise-design-system/index.esm.js +1 -1
  11. package/dist/baloise-design-system/{p-f1a3559751.entry.js → p-01ecf8b5d6.entry.js} +1 -1
  12. package/dist/baloise-design-system/{p-eaf55a0d0e.entry.js → p-081cb26f92.entry.js} +1 -1
  13. package/dist/baloise-design-system/{p-1521c512e4.system.entry.js → p-18eb100a17.system.entry.js} +1 -1
  14. package/dist/baloise-design-system/{p-8a825bdf50.system.entry.js → p-1cee82756c.system.entry.js} +1 -1
  15. package/dist/baloise-design-system/{p-32b04c32.js → p-1f3e4d18.js} +1 -1
  16. package/dist/baloise-design-system/{p-4f7f21d9.js → p-2627c2ba.js} +1 -1
  17. package/dist/baloise-design-system/{p-0a9b41c8dc.entry.js → p-263f076e4c.entry.js} +1 -1
  18. package/dist/baloise-design-system/{p-077f77b758.entry.js → p-2df1c29da2.entry.js} +1 -1
  19. package/dist/baloise-design-system/{p-3f7f81de5f.entry.js → p-2f03d9eb45.entry.js} +1 -1
  20. package/dist/baloise-design-system/{p-96c453829c.entry.js → p-3211932dda.entry.js} +1 -1
  21. package/dist/baloise-design-system/{p-a6bdb63428.system.entry.js → p-37e96666d4.system.entry.js} +1 -1
  22. package/dist/baloise-design-system/p-3bbf43bb.system.js +1 -1
  23. package/dist/baloise-design-system/{p-e88015c785.entry.js → p-449b2c712d.entry.js} +1 -1
  24. package/dist/baloise-design-system/{p-e043c27ff9.system.entry.js → p-462d40b41e.system.entry.js} +1 -1
  25. package/dist/baloise-design-system/{p-b13482115a.system.entry.js → p-59775c0d2c.system.entry.js} +1 -1
  26. package/dist/baloise-design-system/{p-1d2086008c.system.entry.js → p-5d341a333d.system.entry.js} +1 -1
  27. package/dist/baloise-design-system/{p-2c9dcfa044.system.entry.js → p-6103fb4e8c.system.entry.js} +1 -1
  28. package/dist/baloise-design-system/{p-04bd9be8.system.js → p-655b2166.system.js} +1 -1
  29. package/dist/baloise-design-system/{p-61b074323f.system.entry.js → p-7344e7ba09.system.entry.js} +1 -1
  30. package/dist/baloise-design-system/p-7aab6e6b68.entry.js +1 -0
  31. package/dist/baloise-design-system/{p-1f3fc31a.system.js → p-85a20b4e.system.js} +1 -1
  32. package/dist/baloise-design-system/{p-beff106dec.entry.js → p-85e4c76ed7.entry.js} +1 -1
  33. package/dist/baloise-design-system/p-87067c24.js +1 -0
  34. package/dist/baloise-design-system/{p-5bcca382.system.js → p-8941a65a.system.js} +1 -1
  35. package/dist/baloise-design-system/{p-e09fa14522.system.entry.js → p-966acf8112.system.entry.js} +1 -1
  36. package/dist/baloise-design-system/{p-ea6a80e6d6.system.entry.js → p-990f01894e.system.entry.js} +1 -1
  37. package/dist/baloise-design-system/p-9d114fae.js +1 -0
  38. package/dist/baloise-design-system/p-9e4fcb76.js +1 -1
  39. package/dist/baloise-design-system/p-b0870e2498.system.entry.js +1 -0
  40. package/dist/baloise-design-system/{p-c6a6656d68.entry.js → p-c25b87c656.entry.js} +1 -1
  41. package/dist/baloise-design-system/{p-20a149e171.system.entry.js → p-c44cfcc598.system.entry.js} +1 -1
  42. package/dist/baloise-design-system/{p-6e9fcfda30.system.entry.js → p-c6648cddb7.system.entry.js} +1 -1
  43. package/dist/baloise-design-system/{p-b20bab5f6c.entry.js → p-c799e00a6e.entry.js} +1 -1
  44. package/dist/baloise-design-system/p-e960037ef1.entry.js +1 -0
  45. package/dist/baloise-design-system/{p-4ef27ea80e.system.entry.js → p-eccf2684d4.system.entry.js} +1 -1
  46. package/dist/baloise-design-system/{p-d394b42275.entry.js → p-ed2d3325c9.entry.js} +1 -1
  47. package/dist/baloise-design-system/{p-34a9557f.system.js → p-f15be367.system.js} +1 -1
  48. package/dist/baloise-design-system/{p-1e69692eb4.entry.js → p-f18f396a20.entry.js} +1 -1
  49. package/dist/baloise-design-system/p-f8c2d916.system.js +1 -0
  50. package/dist/baloise-design-system/p-fa8f56c6.system.js +1 -0
  51. package/dist/cjs/app-globals-1a8f18e4.js +7 -0
  52. package/dist/cjs/bal-carousel_2.cjs.entry.js +3 -3
  53. package/dist/cjs/bal-datepicker.cjs.entry.js +3 -3
  54. package/dist/cjs/bal-doc-app.cjs.entry.js +231 -0
  55. package/dist/cjs/bal-hint_3.cjs.entry.js +3 -3
  56. package/dist/cjs/bal-list_8.cjs.entry.js +3 -3
  57. package/dist/cjs/bal-logo.cjs.entry.js +3 -3
  58. package/dist/cjs/bal-nav_8.cjs.entry.js +3 -3
  59. package/dist/cjs/bal-navbar_5.cjs.entry.js +3 -3
  60. package/dist/cjs/bal-pagination.cjs.entry.js +3 -3
  61. package/dist/cjs/bal-popover_2.cjs.entry.js +3 -3
  62. package/dist/cjs/bal-progress-bar.cjs.entry.js +3 -3
  63. package/dist/cjs/bal-shape.cjs.entry.js +1 -1
  64. package/dist/cjs/bal-steps.cjs.entry.js +3 -3
  65. package/dist/cjs/bal-tab-item_2.cjs.entry.js +3 -3
  66. package/dist/cjs/baloise-design-system.cjs.js +3 -2
  67. package/dist/cjs/{breakpoints.decorator-ebdaca35.js → breakpoints.decorator-36e6f815.js} +1 -1
  68. package/dist/cjs/{breakpoints.subject-e790c7e3.js → breakpoints.subject-60fcfddd.js} +1 -1
  69. package/dist/cjs/{app-globals-d6bc7866.js → global-6ea60588.js} +2 -4
  70. package/dist/cjs/index.cjs.js +2 -2
  71. package/dist/cjs/initialize-e38e7028.js +1 -1
  72. package/dist/cjs/loader.cjs.js +3 -2
  73. package/dist/cjs/{tokens.esm-b8f01abd.js → tokens.esm-ea57cea3.js} +1 -1
  74. package/dist/collection/collection-manifest.json +2 -1
  75. package/dist/collection/components/docs/bal-doc-app/bal-doc-app.css +1 -0
  76. package/dist/collection/components/docs/bal-doc-app/bal-doc-app.js +229 -0
  77. package/dist/collection/utils/constants/version.constant.js +1 -1
  78. package/dist/esm/app-globals-e3e23c19.js +5 -0
  79. package/dist/esm/bal-carousel_2.entry.js +3 -3
  80. package/dist/esm/bal-datepicker.entry.js +3 -3
  81. package/dist/esm/bal-doc-app.entry.js +227 -0
  82. package/dist/esm/bal-hint_3.entry.js +3 -3
  83. package/dist/esm/bal-list_8.entry.js +3 -3
  84. package/dist/esm/bal-logo.entry.js +3 -3
  85. package/dist/esm/bal-nav_8.entry.js +3 -3
  86. package/dist/esm/bal-navbar_5.entry.js +3 -3
  87. package/dist/esm/bal-pagination.entry.js +3 -3
  88. package/dist/esm/bal-popover_2.entry.js +3 -3
  89. package/dist/esm/bal-progress-bar.entry.js +3 -3
  90. package/dist/esm/bal-shape.entry.js +1 -1
  91. package/dist/esm/bal-steps.entry.js +3 -3
  92. package/dist/esm/bal-tab-item_2.entry.js +3 -3
  93. package/dist/esm/baloise-design-system.js +3 -2
  94. package/dist/esm/{breakpoints.decorator-03a96702.js → breakpoints.decorator-82b49ea8.js} +1 -1
  95. package/dist/esm/{breakpoints.subject-290977a3.js → breakpoints.subject-9b7dd7b2.js} +1 -1
  96. package/dist/esm/{app-globals-89691d80.js → global-d54e7c09.js} +2 -4
  97. package/dist/esm/index.js +3 -3
  98. package/dist/esm/initialize-66615dde.js +1 -1
  99. package/dist/esm/loader.js +3 -2
  100. package/dist/esm/{tokens.esm-ca010903.js → tokens.esm-84367557.js} +1 -1
  101. package/dist/esm-es5/app-globals-e3e23c19.js +1 -0
  102. package/dist/esm-es5/bal-carousel_2.entry.js +1 -1
  103. package/dist/esm-es5/bal-datepicker.entry.js +1 -1
  104. package/dist/esm-es5/bal-doc-app.entry.js +1 -0
  105. package/dist/esm-es5/bal-hint_3.entry.js +1 -1
  106. package/dist/esm-es5/bal-list_8.entry.js +1 -1
  107. package/dist/esm-es5/bal-logo.entry.js +1 -1
  108. package/dist/esm-es5/bal-nav_8.entry.js +1 -1
  109. package/dist/esm-es5/bal-navbar_5.entry.js +1 -1
  110. package/dist/esm-es5/bal-pagination.entry.js +1 -1
  111. package/dist/esm-es5/bal-popover_2.entry.js +1 -1
  112. package/dist/esm-es5/bal-progress-bar.entry.js +1 -1
  113. package/dist/esm-es5/bal-shape.entry.js +1 -1
  114. package/dist/esm-es5/bal-steps.entry.js +1 -1
  115. package/dist/esm-es5/bal-tab-item_2.entry.js +1 -1
  116. package/dist/esm-es5/baloise-design-system.js +1 -1
  117. package/dist/esm-es5/{breakpoints.decorator-03a96702.js → breakpoints.decorator-82b49ea8.js} +1 -1
  118. package/dist/esm-es5/{breakpoints.subject-290977a3.js → breakpoints.subject-9b7dd7b2.js} +1 -1
  119. package/dist/esm-es5/global-d54e7c09.js +1 -0
  120. package/dist/esm-es5/index.js +1 -1
  121. package/dist/esm-es5/initialize-66615dde.js +1 -1
  122. package/dist/esm-es5/loader.js +1 -1
  123. package/dist/types/components/docs/bal-doc-app/bal-doc-app.d.ts +21 -0
  124. package/dist/types/components.d.ts +37 -0
  125. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/icons/src/index.d.ts +81 -0
  126. package/package.json +7 -7
  127. package/dist/baloise-design-system/p-34d1472a.system.js +0 -1
  128. package/dist/baloise-design-system/p-48a2de5d.js +0 -1
  129. package/dist/baloise-design-system/p-60b81d90cb.entry.js +0 -1
  130. package/dist/esm-es5/app-globals-89691d80.js +0 -1
  131. /package/dist/baloise-design-system/{p-8d102058.js → p-0adfc17e.js} +0 -0
  132. /package/dist/baloise-design-system/{p-ac42a59e.system.js → p-94a87802.system.js} +0 -0
  133. /package/dist/esm-es5/{tokens.esm-ca010903.js → tokens.esm-84367557.js} +0 -0
@@ -1,4 +1,3 @@
1
- import { setPlatformHelpers } from '@stencil/core/internal/client';
2
1
  export { getAssetPath, setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
3
2
  export { F as FileUploadRejectionReason } from './bal-file-upload.type.js';
4
3
  export { i as i18nBalDate } from './bal-date.i18n.js';
@@ -7,169 +6,26 @@ export { i as i18nBalDatepicker } from './bal-datepicker.i18n.js';
7
6
  export { i as i18nBalTimeInput } from './bal-time-input.i18n.js';
8
7
  export { i as i18nBalInputStepper } from './bal-input-stepper.i18n.js';
9
8
  export { i as i18nBalLabel } from './bal-label.i18n.js';
10
- import { b as balBrowser } from './browser.js';
11
- export { b as balBrowser } from './browser.js';
12
- import { d as defaultConfig } from './config.default.js';
13
- export { d as defaultConfig } from './config.default.js';
9
+ export { a as BalSnackbarController, B as BalToastController, c as balSnackbarController, b as balToastController, i as initialize, i as initializeBaloiseDesignSystem, s as setupConfig } from './initialize.js';
14
10
  export { n as newBalStepOption } from './bal-step.util.js';
15
11
  export { n as newBalTabOption } from './bal-tab.util.js';
16
12
  import { g as getAppRoot, c as componentOnReady } from './helpers.js';
17
13
  export { c as componentOnReady, e as deepReady, g as getAppRoot, i as isDescendant, s as shallowReady, f as wait, b as waitAfterFramePaint, d as waitAfterIdleCallback, w as waitForComponent, a as waitForDesignSystem } from './helpers.js';
18
14
  export { s as scrollToFirstInvalidField } from './form.js';
19
15
  export { B as BalScrollHandler } from './scroll.js';
16
+ import { b as balBrowser } from './browser.js';
17
+ export { b as balBrowser } from './browser.js';
20
18
  import { b as balDevice } from './device.js';
21
19
  export { B as BalDevice, b as balDevice } from './device.js';
22
20
  import { g as getOverlays, a as getOverlay } from './overlays.js';
23
21
  import { B as BalWindowResizeListener, b as balBreakpoints } from './breakpoints.subject.js';
24
22
  export { c as BalBreakpointSubject, d as BalBreakpointsUtil, a as balBreakpointSubject, b as balBreakpoints } from './breakpoints.subject.js';
25
23
  export { a as attachToConfig, d as detachFromConfig, o as onBalConfigChange, u as updateBalAllowedLanguages, b as updateBalAnimated, c as updateBalIcons, e as updateBalLanguage, f as updateBalRegion, g as useBalConfig } from './config.utils.js';
24
+ export { d as defaultConfig } from './config.default.js';
26
25
  import { S as Subject } from './listener.js';
27
26
  export { B as BalSwipeSubject } from './swipe.subject.js';
28
27
  export { B as BalDate } from './date.js';
29
28
 
30
- const BALOISE_SESSION_KEY = 'baloise-persist-config';
31
-
32
- class Config {
33
- constructor() {
34
- this._componentObservers = [];
35
- this._observers = [];
36
- this._config = defaultConfig;
37
- }
38
- get locale() {
39
- return `${this._config.language}-${this._config.region}`;
40
- }
41
- get region() {
42
- return this._config.region;
43
- }
44
- set region(region) {
45
- if (region !== this._config.region) {
46
- this._config.region = region;
47
- this._notify();
48
- }
49
- }
50
- get language() {
51
- return this._config.language;
52
- }
53
- set language(language) {
54
- if (language !== this._config.language) {
55
- if (this._config.allowedLanguages.includes(language)) {
56
- this._config.language = language;
57
- }
58
- else {
59
- this._config.language = this._config.fallbackLanguage;
60
- }
61
- this._notify();
62
- }
63
- }
64
- get allowedLanguages() {
65
- return this._config.allowedLanguages;
66
- }
67
- set allowedLanguages(allowedLanguages) {
68
- if (allowedLanguages !== this._config.allowedLanguages) {
69
- this._config.allowedLanguages = allowedLanguages;
70
- this._notify();
71
- }
72
- }
73
- get icons() {
74
- return this._config.icons;
75
- }
76
- set icons(icons) {
77
- this._config.icons = Object.assign(Object.assign({}, this._config.icons), icons);
78
- this._notify();
79
- }
80
- get logger() {
81
- return this._config.logger;
82
- }
83
- set logger(logger) {
84
- this._config.logger = Object.assign({}, logger);
85
- this._notify();
86
- }
87
- get animated() {
88
- return this._config.animated;
89
- }
90
- set animated(animated) {
91
- this._config.animated = animated;
92
- this._notify();
93
- }
94
- attach(observer) {
95
- const isExist = this._observers.includes(observer);
96
- if (isExist) {
97
- return console.log('Subject: Observer has been attached already.');
98
- }
99
- this._observers.push(observer);
100
- observer.configChanged(this._config);
101
- }
102
- detach(observer) {
103
- const observerIndex = this._observers.indexOf(observer);
104
- if (observerIndex === -1) {
105
- return console.log('Subject: Nonexistent observer.');
106
- }
107
- this._observers.splice(observerIndex, 1);
108
- }
109
- attachComponent(observer) {
110
- const isExist = this._componentObservers.includes(observer);
111
- if (isExist) {
112
- return console.log('Subject: Observer has been attached already.');
113
- }
114
- this._componentObservers.push(observer);
115
- observer.configChanged(this._config);
116
- }
117
- detachComponent(observer) {
118
- const observerIndex = this._componentObservers.indexOf(observer);
119
- if (observerIndex === -1) {
120
- return console.log('Subject: Nonexistent observer.');
121
- }
122
- this._componentObservers.splice(observerIndex, 1);
123
- }
124
- toString() {
125
- return JSON.stringify(this._config);
126
- }
127
- reset(config) {
128
- this._config = Object.assign(Object.assign(Object.assign({}, this._config), config), { icons: Object.assign(Object.assign({}, this._config.icons), config.icons) });
129
- this._notify(false);
130
- }
131
- _notify(all = true) {
132
- for (const observer of this._componentObservers) {
133
- observer.configChanged(this._config);
134
- }
135
- if (all) {
136
- for (const observer of this._observers) {
137
- observer.configChanged(this._config);
138
- }
139
- }
140
- if (balBrowser.hasWindow) {
141
- saveConfig(window, this._config);
142
- }
143
- }
144
- }
145
- const config = /*@__PURE__*/ new Config();
146
- const configFromSession = (win) => {
147
- try {
148
- const configStr = win.sessionStorage.getItem(BALOISE_SESSION_KEY);
149
- return configStr !== null ? JSON.parse(configStr) : {};
150
- }
151
- catch (e) {
152
- return {};
153
- }
154
- };
155
- const saveConfig = (win, c) => {
156
- try {
157
- win.sessionStorage.setItem(BALOISE_SESSION_KEY, JSON.stringify(c));
158
- }
159
- catch (e) {
160
- return;
161
- }
162
- };
163
-
164
- const setupConfig = (userConfig = {}, win = {}) => {
165
- if (Object.keys(win).length === 0 && balBrowser.hasWindow) {
166
- win = window;
167
- }
168
- win.BaloiseDesignSystem = win.BaloiseDesignSystem || {};
169
- config.reset(Object.assign(Object.assign(Object.assign({}, configFromSession(win)), userConfig), { icons: Object.assign(Object.assign({}, configFromSession(win).icons), userConfig.icons) }));
170
- win.BaloiseDesignSystem.config = config;
171
- };
172
-
173
29
  const i18nBalFieldLabel = {
174
30
  de: {
175
31
  optional: ' (optional)',
@@ -203,139 +59,6 @@ const i18nBalFieldLabel = {
203
59
  },
204
60
  };
205
61
 
206
- class BalNoticeController {
207
- constructor(options) {
208
- this.options = options;
209
- this.container = null;
210
- this.queue = [];
211
- this.preQueue = [];
212
- this.queueLimit = 5;
213
- }
214
- create(options) {
215
- if (balBrowser.hasDocument) {
216
- this.setupContainer();
217
- const clone = this.findClone(options);
218
- if (clone === undefined) {
219
- const el = document.createElement(this.options.tag);
220
- Object.assign(el, options);
221
- el.addEventListener('balClose', ev => {
222
- this.removeFromQueue(ev.detail);
223
- });
224
- this.preQueue.push(el);
225
- this.updateQueue();
226
- return el;
227
- }
228
- return clone;
229
- }
230
- }
231
- setQueue(queueLimit) {
232
- this.queueLimit = queueLimit;
233
- }
234
- async dismissAll() {
235
- var _a;
236
- const elements = (_a = this.container) === null || _a === void 0 ? void 0 : _a.querySelectorAll(this.options.tag);
237
- if (elements) {
238
- const closingQueue = [];
239
- for (let index = 0; index < elements.length; index++) {
240
- const el = elements[index];
241
- if (el.close) {
242
- closingQueue.push(el.close());
243
- }
244
- }
245
- await Promise.all(closingQueue);
246
- }
247
- }
248
- /**
249
- * @deprecated use dismissAll instead
250
- */
251
- async clearAll() {
252
- console.warn('[DEPRECATED] - use dismissAll() instead');
253
- return this.dismissAll();
254
- }
255
- findClone(options) {
256
- for (let index = 0; index < this.queue.length; index++) {
257
- const el = this.queue[index];
258
- if (el.message === options.message && el.color === options.color) {
259
- return el;
260
- }
261
- }
262
- return undefined;
263
- }
264
- setupContainer() {
265
- if (balBrowser.hasDocument) {
266
- const containerId = `${this.options.tag}-container`;
267
- this.container = document.getElementById(containerId);
268
- if (this.container)
269
- return;
270
- if (!this.container) {
271
- this.container = document.createElement('bal-notices');
272
- this.container.setAttribute('interface', this.options.tag.replace('bal-', ''));
273
- this.container.id = containerId;
274
- }
275
- document.body.appendChild(this.container);
276
- }
277
- }
278
- updateQueue() {
279
- var _a;
280
- if (this.queue.length < this.queueLimit) {
281
- const el = this.preQueue.shift();
282
- if (el && this.container) {
283
- this.queue.push(el);
284
- this.container.insertAdjacentElement('beforeend', el);
285
- }
286
- }
287
- if (this.queue.length === 0) {
288
- (_a = this.container) === null || _a === void 0 ? void 0 : _a.remove();
289
- }
290
- }
291
- removeFromQueue(toastId) {
292
- this.queue = this.queue.filter(el => el.id !== toastId);
293
- setTimeout(() => this.updateQueue(), 0);
294
- }
295
- }
296
-
297
- class BalToastController extends BalNoticeController {
298
- constructor() {
299
- super({
300
- tag: 'bal-toast',
301
- });
302
- }
303
- create(options) {
304
- return super.create(options);
305
- }
306
- }
307
- const balToastController = new BalToastController();
308
-
309
- class BalSnackbarController extends BalNoticeController {
310
- constructor() {
311
- super({
312
- tag: 'bal-snackbar',
313
- });
314
- }
315
- create(options) {
316
- return super.create(options);
317
- }
318
- }
319
- const balSnackbarController = new BalSnackbarController();
320
-
321
- // generated by .build/version.js
322
- const VERSION = 'BAL_DEV_VERSION';
323
-
324
- const initializeBaloiseDesignSystem = (userConfig = {}, platformConfig = undefined, win = {}) => {
325
- if (Object.keys(win).length === 0 && balBrowser.hasWindow) {
326
- win = window;
327
- }
328
- win.BaloiseDesignSystem = win.BaloiseDesignSystem || {};
329
- if (platformConfig) {
330
- setPlatformHelpers(platformConfig);
331
- }
332
- setupConfig(Object.assign(Object.assign({}, userConfig), platformConfig), win);
333
- win.BaloiseDesignSystem.toastController = balToastController;
334
- win.BaloiseDesignSystem.snackbarController = balSnackbarController;
335
- win.BaloiseDesignSystem.initialize = () => setupConfig(win.BaloiseDesignSystem.config, win);
336
- win.BaloiseDesignSystem.version = VERSION;
337
- };
338
-
339
62
  const newBalCheckboxOption = (option) => {
340
63
  return Object.assign(Object.assign({ interface: 'checkbox', labelHidden: false, flat: false, disabled: false, readonly: false, required: false, nonSubmit: false, invalid: false, checked: false }, option), { label: '', html: option.label });
341
64
  };
@@ -453,4 +176,4 @@ const isPlatform = (winOrPlatform, platform) => {
453
176
  const NewBalOptionValue = newBalOptionValue;
454
177
  const NewBalSingleOptionValue = newBalSingleOptionValue;
455
178
 
456
- export { BalModalController, BalOrientationSubject, BalSnackbarController, BalToastController, NewBalOptionValue, NewBalSingleOptionValue, balModalController, balOrientationSubject, balSnackbarController, balToastController, getPlatforms, hasTouchSupport, i18nBalFieldLabel, initializeBaloiseDesignSystem as initialize, initializeBaloiseDesignSystem, isBrowser, isPlatform, newBalCheckboxOption, newBalOptionValue, newBalRadioOption, newBalSingleOptionValue, setupConfig };
179
+ export { BalModalController, BalOrientationSubject, NewBalOptionValue, NewBalSingleOptionValue, balModalController, balOrientationSubject, getPlatforms, hasTouchSupport, i18nBalFieldLabel, isBrowser, isPlatform, newBalCheckboxOption, newBalOptionValue, newBalRadioOption, newBalSingleOptionValue };
@@ -0,0 +1,281 @@
1
+ import { setPlatformHelpers } from '@stencil/core/internal/client';
2
+ import { b as balBrowser } from './browser.js';
3
+ import { d as defaultConfig } from './config.default.js';
4
+
5
+ const BALOISE_SESSION_KEY = 'baloise-persist-config';
6
+
7
+ class Config {
8
+ constructor() {
9
+ this._componentObservers = [];
10
+ this._observers = [];
11
+ this._config = defaultConfig;
12
+ }
13
+ get locale() {
14
+ return `${this._config.language}-${this._config.region}`;
15
+ }
16
+ get region() {
17
+ return this._config.region;
18
+ }
19
+ set region(region) {
20
+ if (region !== this._config.region) {
21
+ this._config.region = region;
22
+ this._notify();
23
+ }
24
+ }
25
+ get language() {
26
+ return this._config.language;
27
+ }
28
+ set language(language) {
29
+ if (language !== this._config.language) {
30
+ if (this._config.allowedLanguages.includes(language)) {
31
+ this._config.language = language;
32
+ }
33
+ else {
34
+ this._config.language = this._config.fallbackLanguage;
35
+ }
36
+ this._notify();
37
+ }
38
+ }
39
+ get allowedLanguages() {
40
+ return this._config.allowedLanguages;
41
+ }
42
+ set allowedLanguages(allowedLanguages) {
43
+ if (allowedLanguages !== this._config.allowedLanguages) {
44
+ this._config.allowedLanguages = allowedLanguages;
45
+ this._notify();
46
+ }
47
+ }
48
+ get icons() {
49
+ return this._config.icons;
50
+ }
51
+ set icons(icons) {
52
+ this._config.icons = Object.assign(Object.assign({}, this._config.icons), icons);
53
+ this._notify();
54
+ }
55
+ get logger() {
56
+ return this._config.logger;
57
+ }
58
+ set logger(logger) {
59
+ this._config.logger = Object.assign({}, logger);
60
+ this._notify();
61
+ }
62
+ get animated() {
63
+ return this._config.animated;
64
+ }
65
+ set animated(animated) {
66
+ this._config.animated = animated;
67
+ this._notify();
68
+ }
69
+ attach(observer) {
70
+ const isExist = this._observers.includes(observer);
71
+ if (isExist) {
72
+ return console.log('Subject: Observer has been attached already.');
73
+ }
74
+ this._observers.push(observer);
75
+ observer.configChanged(this._config);
76
+ }
77
+ detach(observer) {
78
+ const observerIndex = this._observers.indexOf(observer);
79
+ if (observerIndex === -1) {
80
+ return console.log('Subject: Nonexistent observer.');
81
+ }
82
+ this._observers.splice(observerIndex, 1);
83
+ }
84
+ attachComponent(observer) {
85
+ const isExist = this._componentObservers.includes(observer);
86
+ if (isExist) {
87
+ return console.log('Subject: Observer has been attached already.');
88
+ }
89
+ this._componentObservers.push(observer);
90
+ observer.configChanged(this._config);
91
+ }
92
+ detachComponent(observer) {
93
+ const observerIndex = this._componentObservers.indexOf(observer);
94
+ if (observerIndex === -1) {
95
+ return console.log('Subject: Nonexistent observer.');
96
+ }
97
+ this._componentObservers.splice(observerIndex, 1);
98
+ }
99
+ toString() {
100
+ return JSON.stringify(this._config);
101
+ }
102
+ reset(config) {
103
+ this._config = Object.assign(Object.assign(Object.assign({}, this._config), config), { icons: Object.assign(Object.assign({}, this._config.icons), config.icons) });
104
+ this._notify(false);
105
+ }
106
+ _notify(all = true) {
107
+ for (const observer of this._componentObservers) {
108
+ observer.configChanged(this._config);
109
+ }
110
+ if (all) {
111
+ for (const observer of this._observers) {
112
+ observer.configChanged(this._config);
113
+ }
114
+ }
115
+ if (balBrowser.hasWindow) {
116
+ saveConfig(window, this._config);
117
+ }
118
+ }
119
+ }
120
+ const config = /*@__PURE__*/ new Config();
121
+ const configFromSession = (win) => {
122
+ try {
123
+ const configStr = win.sessionStorage.getItem(BALOISE_SESSION_KEY);
124
+ return configStr !== null ? JSON.parse(configStr) : {};
125
+ }
126
+ catch (e) {
127
+ return {};
128
+ }
129
+ };
130
+ const saveConfig = (win, c) => {
131
+ try {
132
+ win.sessionStorage.setItem(BALOISE_SESSION_KEY, JSON.stringify(c));
133
+ }
134
+ catch (e) {
135
+ return;
136
+ }
137
+ };
138
+
139
+ const setupConfig = (userConfig = {}, win = {}) => {
140
+ if (Object.keys(win).length === 0 && balBrowser.hasWindow) {
141
+ win = window;
142
+ }
143
+ win.BaloiseDesignSystem = win.BaloiseDesignSystem || {};
144
+ config.reset(Object.assign(Object.assign(Object.assign({}, configFromSession(win)), userConfig), { icons: Object.assign(Object.assign({}, configFromSession(win).icons), userConfig.icons) }));
145
+ win.BaloiseDesignSystem.config = config;
146
+ };
147
+
148
+ class BalNoticeController {
149
+ constructor(options) {
150
+ this.options = options;
151
+ this.container = null;
152
+ this.queue = [];
153
+ this.preQueue = [];
154
+ this.queueLimit = 5;
155
+ }
156
+ create(options) {
157
+ if (balBrowser.hasDocument) {
158
+ this.setupContainer();
159
+ const clone = this.findClone(options);
160
+ if (clone === undefined) {
161
+ const el = document.createElement(this.options.tag);
162
+ Object.assign(el, options);
163
+ el.addEventListener('balClose', ev => {
164
+ this.removeFromQueue(ev.detail);
165
+ });
166
+ this.preQueue.push(el);
167
+ this.updateQueue();
168
+ return el;
169
+ }
170
+ return clone;
171
+ }
172
+ }
173
+ setQueue(queueLimit) {
174
+ this.queueLimit = queueLimit;
175
+ }
176
+ async dismissAll() {
177
+ var _a;
178
+ const elements = (_a = this.container) === null || _a === void 0 ? void 0 : _a.querySelectorAll(this.options.tag);
179
+ if (elements) {
180
+ const closingQueue = [];
181
+ for (let index = 0; index < elements.length; index++) {
182
+ const el = elements[index];
183
+ if (el.close) {
184
+ closingQueue.push(el.close());
185
+ }
186
+ }
187
+ await Promise.all(closingQueue);
188
+ }
189
+ }
190
+ /**
191
+ * @deprecated use dismissAll instead
192
+ */
193
+ async clearAll() {
194
+ console.warn('[DEPRECATED] - use dismissAll() instead');
195
+ return this.dismissAll();
196
+ }
197
+ findClone(options) {
198
+ for (let index = 0; index < this.queue.length; index++) {
199
+ const el = this.queue[index];
200
+ if (el.message === options.message && el.color === options.color) {
201
+ return el;
202
+ }
203
+ }
204
+ return undefined;
205
+ }
206
+ setupContainer() {
207
+ if (balBrowser.hasDocument) {
208
+ const containerId = `${this.options.tag}-container`;
209
+ this.container = document.getElementById(containerId);
210
+ if (this.container)
211
+ return;
212
+ if (!this.container) {
213
+ this.container = document.createElement('bal-notices');
214
+ this.container.setAttribute('interface', this.options.tag.replace('bal-', ''));
215
+ this.container.id = containerId;
216
+ }
217
+ document.body.appendChild(this.container);
218
+ }
219
+ }
220
+ updateQueue() {
221
+ var _a;
222
+ if (this.queue.length < this.queueLimit) {
223
+ const el = this.preQueue.shift();
224
+ if (el && this.container) {
225
+ this.queue.push(el);
226
+ this.container.insertAdjacentElement('beforeend', el);
227
+ }
228
+ }
229
+ if (this.queue.length === 0) {
230
+ (_a = this.container) === null || _a === void 0 ? void 0 : _a.remove();
231
+ }
232
+ }
233
+ removeFromQueue(toastId) {
234
+ this.queue = this.queue.filter(el => el.id !== toastId);
235
+ setTimeout(() => this.updateQueue(), 0);
236
+ }
237
+ }
238
+
239
+ class BalToastController extends BalNoticeController {
240
+ constructor() {
241
+ super({
242
+ tag: 'bal-toast',
243
+ });
244
+ }
245
+ create(options) {
246
+ return super.create(options);
247
+ }
248
+ }
249
+ const balToastController = new BalToastController();
250
+
251
+ class BalSnackbarController extends BalNoticeController {
252
+ constructor() {
253
+ super({
254
+ tag: 'bal-snackbar',
255
+ });
256
+ }
257
+ create(options) {
258
+ return super.create(options);
259
+ }
260
+ }
261
+ const balSnackbarController = new BalSnackbarController();
262
+
263
+ // generated by .build/version.js
264
+ const VERSION = 'BAL_DEV_VERSION';
265
+
266
+ const initializeBaloiseDesignSystem = (userConfig = {}, platformConfig = undefined, win = {}) => {
267
+ if (Object.keys(win).length === 0 && balBrowser.hasWindow) {
268
+ win = window;
269
+ }
270
+ win.BaloiseDesignSystem = win.BaloiseDesignSystem || {};
271
+ if (platformConfig) {
272
+ setPlatformHelpers(platformConfig);
273
+ }
274
+ setupConfig(Object.assign(Object.assign({}, userConfig), platformConfig), win);
275
+ win.BaloiseDesignSystem.toastController = balToastController;
276
+ win.BaloiseDesignSystem.snackbarController = balSnackbarController;
277
+ win.BaloiseDesignSystem.initialize = () => setupConfig(win.BaloiseDesignSystem.config, win);
278
+ win.BaloiseDesignSystem.version = VERSION;
279
+ };
280
+
281
+ export { BalToastController as B, BalSnackbarController as a, balToastController as b, balSnackbarController as c, initializeBaloiseDesignSystem as i, setupConfig as s };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 19 Mar 2024 12:56:36 GMT
3
+ * Generated on Mon, 25 Mar 2024 06:10:59 GMT
4
4
  */
5
5
  const balColorGreen3 = "#94e3d4";
6
6
  const balColorGreen6 = "#1b5951";