@baloise/ds-core 0.0.5 → 0.0.6-nightly.20240306
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.
- package/README.md +32 -41
- package/components/bal-app.js +1 -85
- package/components/bal-app2.js +87 -0
- package/components/bal-doc-app.d.ts +11 -0
- package/components/bal-doc-app.js +260 -0
- package/components/index.js +5 -282
- package/components/initialize.js +281 -0
- package/components/tokens.esm.js +1 -1
- package/dist/cjs/app-globals-96827f05.js +7 -0
- package/dist/cjs/bal-carousel_2.cjs.entry.js +3 -3
- package/dist/cjs/bal-datepicker.cjs.entry.js +3 -3
- package/dist/cjs/bal-doc-app.cjs.entry.js +231 -0
- package/dist/cjs/bal-hint_3.cjs.entry.js +3 -3
- package/dist/cjs/bal-list_8.cjs.entry.js +3 -3
- package/dist/cjs/bal-logo.cjs.entry.js +3 -3
- package/dist/cjs/bal-nav_8.cjs.entry.js +3 -3
- package/dist/cjs/bal-navbar_5.cjs.entry.js +3 -3
- package/dist/cjs/bal-pagination.cjs.entry.js +3 -3
- package/dist/cjs/bal-popover_2.cjs.entry.js +3 -3
- package/dist/cjs/bal-progress-bar.cjs.entry.js +3 -3
- package/dist/cjs/bal-shape.cjs.entry.js +1 -1
- package/dist/cjs/bal-steps.cjs.entry.js +3 -3
- package/dist/cjs/bal-tab-item_2.cjs.entry.js +3 -3
- package/dist/cjs/{breakpoints.decorator-317b79eb.js → breakpoints.decorator-4394690a.js} +1 -1
- package/dist/cjs/{breakpoints.subject-d01efdb0.js → breakpoints.subject-eea07e58.js} +1 -1
- package/dist/cjs/design-system-components.cjs.js +3 -2
- package/dist/cjs/{app-globals-96247350.js → global-e99d827b.js} +2 -4
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/initialize-9c752efa.js +1 -1
- package/dist/cjs/loader.cjs.js +3 -2
- package/dist/cjs/{tokens.esm-49773ac1.js → tokens.esm-b1635d58.js} +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/docs/bal-doc-app/bal-doc-app.css +1 -0
- package/dist/collection/components/docs/bal-doc-app/bal-doc-app.js +229 -0
- package/dist/collection/utils/constants/version.constant.js +1 -1
- package/dist/design-system-components/design-system-components.esm.js +1 -1
- package/dist/design-system-components/design-system-components.js +1 -1
- package/dist/design-system-components/index.esm.js +1 -1
- package/dist/design-system-components/p-01ebb73de9.entry.js +1 -0
- package/dist/design-system-components/{p-14bd447f.system.js → p-051f8a1a.system.js} +1 -1
- package/dist/design-system-components/{p-97b3918054.entry.js → p-0eaafbcbad.entry.js} +1 -1
- package/dist/design-system-components/{p-97dbfd519a.entry.js → p-22e809d132.entry.js} +1 -1
- package/dist/design-system-components/{p-5ee8262d62.system.entry.js → p-234c477ae5.system.entry.js} +1 -1
- package/dist/design-system-components/{p-1063c5cdc0.system.entry.js → p-2a221a0dd6.system.entry.js} +1 -1
- package/dist/design-system-components/{p-c835e3cce4.system.entry.js → p-2b229153ea.system.entry.js} +1 -1
- package/dist/design-system-components/{p-3c8c5b6dd2.entry.js → p-3b0be28a72.entry.js} +1 -1
- package/dist/design-system-components/{p-d3c37b705b.system.entry.js → p-41e12fbd0e.system.entry.js} +1 -1
- package/dist/design-system-components/{p-81a1bd545f.system.entry.js → p-48579784ac.system.entry.js} +1 -1
- package/dist/design-system-components/{p-7653dae772.system.entry.js → p-4ec9659760.system.entry.js} +1 -1
- package/dist/design-system-components/p-50f12cb1.system.js +1 -1
- package/dist/design-system-components/{p-458253ab5b.entry.js → p-5127e9d38c.entry.js} +1 -1
- package/dist/design-system-components/{p-7e2faa5297.system.entry.js → p-63c6f2337f.system.entry.js} +1 -1
- package/dist/design-system-components/p-66904dc1.js +1 -1
- package/dist/design-system-components/p-787f9258.system.js +1 -0
- package/dist/design-system-components/{p-77c0fa3e01.entry.js → p-839e191f8e.entry.js} +1 -1
- package/dist/design-system-components/{p-2b79fb51.system.js → p-8bf5f409.system.js} +1 -1
- package/dist/design-system-components/{p-5650ce58.js → p-8ee8f800.js} +1 -1
- package/dist/design-system-components/{p-b293bf1ba0.entry.js → p-9263f309be.entry.js} +1 -1
- package/dist/design-system-components/{p-ed0e733640.entry.js → p-95fe1a5554.entry.js} +1 -1
- package/dist/design-system-components/{p-3865f038de.system.entry.js → p-97e174c2bd.system.entry.js} +1 -1
- package/dist/design-system-components/{p-d1ebb10fc2.entry.js → p-a42c73fd60.entry.js} +1 -1
- package/dist/design-system-components/{p-7b57f1bf7a.system.entry.js → p-adff529ba9.system.entry.js} +1 -1
- package/dist/design-system-components/p-adff9a327e.system.entry.js +1 -0
- package/dist/design-system-components/{p-55a5a05ad3.entry.js → p-b212f33e19.entry.js} +1 -1
- package/dist/design-system-components/{p-2cc957ce.js → p-b2f9d54e.js} +1 -1
- package/dist/design-system-components/p-bafa7b4e.js +1 -0
- package/dist/design-system-components/p-bfbc64f2.js +1 -0
- package/dist/design-system-components/{p-356f5cfef3.system.entry.js → p-c039f78c22.system.entry.js} +1 -1
- package/dist/design-system-components/{p-464c925d97.entry.js → p-c0dd3e0c97.entry.js} +1 -1
- package/dist/design-system-components/{p-17391ff3.system.js → p-c767145c.system.js} +1 -1
- package/dist/design-system-components/{p-adb6bc44ef.system.entry.js → p-cfdb85c37c.system.entry.js} +1 -1
- package/dist/design-system-components/{p-b5ff90d62d.system.entry.js → p-d07979a870.system.entry.js} +1 -1
- package/dist/design-system-components/{p-75c02a9ff4.entry.js → p-d55da08c4c.entry.js} +1 -1
- package/dist/design-system-components/{p-a2e1502c7f.system.entry.js → p-d76af8b053.system.entry.js} +1 -1
- package/dist/design-system-components/{p-c994b45363.entry.js → p-f8c217c145.entry.js} +1 -1
- package/dist/design-system-components/{p-16910f58.system.js → p-fb7dc931.system.js} +1 -1
- package/dist/design-system-components/p-fc586c6a.system.js +1 -0
- package/dist/design-system-components/{p-0685d79c20.entry.js → p-ff2cd9ac97.entry.js} +1 -1
- package/dist/esm/app-globals-46c15307.js +5 -0
- package/dist/esm/bal-carousel_2.entry.js +3 -3
- package/dist/esm/bal-datepicker.entry.js +3 -3
- package/dist/esm/bal-doc-app.entry.js +227 -0
- package/dist/esm/bal-hint_3.entry.js +3 -3
- package/dist/esm/bal-list_8.entry.js +3 -3
- package/dist/esm/bal-logo.entry.js +3 -3
- package/dist/esm/bal-nav_8.entry.js +3 -3
- package/dist/esm/bal-navbar_5.entry.js +3 -3
- package/dist/esm/bal-pagination.entry.js +3 -3
- package/dist/esm/bal-popover_2.entry.js +3 -3
- package/dist/esm/bal-progress-bar.entry.js +3 -3
- package/dist/esm/bal-shape.entry.js +1 -1
- package/dist/esm/bal-steps.entry.js +3 -3
- package/dist/esm/bal-tab-item_2.entry.js +3 -3
- package/dist/esm/{breakpoints.decorator-4c9411f6.js → breakpoints.decorator-17caefa3.js} +1 -1
- package/dist/esm/{breakpoints.subject-b9035870.js → breakpoints.subject-4a8d587a.js} +1 -1
- package/dist/esm/design-system-components.js +3 -2
- package/dist/esm/{app-globals-04db8eba.js → global-648bb593.js} +2 -4
- package/dist/esm/index.js +3 -3
- package/dist/esm/initialize-ff8054a2.js +1 -1
- package/dist/esm/loader.js +3 -2
- package/dist/esm/{tokens.esm-09a5bc3a.js → tokens.esm-eb9bcb02.js} +1 -1
- package/dist/esm-es5/app-globals-46c15307.js +1 -0
- package/dist/esm-es5/bal-carousel_2.entry.js +1 -1
- package/dist/esm-es5/bal-datepicker.entry.js +1 -1
- package/dist/esm-es5/bal-doc-app.entry.js +1 -0
- package/dist/esm-es5/bal-hint_3.entry.js +1 -1
- package/dist/esm-es5/bal-list_8.entry.js +1 -1
- package/dist/esm-es5/bal-logo.entry.js +1 -1
- package/dist/esm-es5/bal-nav_8.entry.js +1 -1
- package/dist/esm-es5/bal-navbar_5.entry.js +1 -1
- package/dist/esm-es5/bal-pagination.entry.js +1 -1
- package/dist/esm-es5/bal-popover_2.entry.js +1 -1
- package/dist/esm-es5/bal-progress-bar.entry.js +1 -1
- package/dist/esm-es5/bal-shape.entry.js +1 -1
- package/dist/esm-es5/bal-steps.entry.js +1 -1
- package/dist/esm-es5/bal-tab-item_2.entry.js +1 -1
- package/dist/esm-es5/{breakpoints.decorator-4c9411f6.js → breakpoints.decorator-17caefa3.js} +1 -1
- package/dist/esm-es5/{breakpoints.subject-b9035870.js → breakpoints.subject-4a8d587a.js} +1 -1
- package/dist/esm-es5/design-system-components.js +1 -1
- package/dist/esm-es5/global-648bb593.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/initialize-ff8054a2.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/types/components/docs/bal-doc-app/bal-doc-app.d.ts +21 -0
- package/dist/types/components.d.ts +37 -0
- package/dist/types/home/runner/work/ds-playground/ds-playground/packages/core/.stencil/packages/icons/src/index.d.ts +81 -0
- package/package.json +7 -7
- package/dist/design-system-components/p-238f1f34.js +0 -1
- package/dist/design-system-components/p-9f5e39e1.system.js +0 -1
- package/dist/esm-es5/app-globals-04db8eba.js +0 -1
- /package/dist/design-system-components/{p-e33303db.js → p-6081827b.js} +0 -0
- /package/dist/design-system-components/{p-dab8ac06.system.js → p-7e89da8e.system.js} +0 -0
- /package/dist/esm-es5/{tokens.esm-09a5bc3a.js → tokens.esm-eb9bcb02.js} +0 -0
package/components/index.js
CHANGED
|
@@ -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
|
-
|
|
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,
|
|
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 };
|
package/components/tokens.esm.js
CHANGED
|
@@ -7,12 +7,12 @@ const tslib_es6 = require('./tslib.es6-a680968e.js');
|
|
|
7
7
|
const helpers = require('./helpers-2a8c8333.js');
|
|
8
8
|
const bem = require('./bem-81bc6a2d.js');
|
|
9
9
|
const formInput = require('./form-input-134c5116.js');
|
|
10
|
-
const breakpoints_decorator = require('./breakpoints.decorator-
|
|
10
|
+
const breakpoints_decorator = require('./breakpoints.decorator-4394690a.js');
|
|
11
11
|
const style = require('./style-799e9253.js');
|
|
12
12
|
const mutation_decorator = require('./mutation.decorator-8877b940.js');
|
|
13
13
|
const swipe_decorator = require('./swipe.decorator-5206d283.js');
|
|
14
14
|
const resize_decorator = require('./resize.decorator-ae91ead2.js');
|
|
15
|
-
const breakpoints_subject = require('./breakpoints.subject-
|
|
15
|
+
const breakpoints_subject = require('./breakpoints.subject-eea07e58.js');
|
|
16
16
|
const config_default = require('./config.default-32725178.js');
|
|
17
17
|
const config_decorator = require('./config.decorator-b393a72f.js');
|
|
18
18
|
const attributes = require('./attributes-9f366716.js');
|
|
@@ -22,7 +22,7 @@ require('./config.utils-e4cd49d6.js');
|
|
|
22
22
|
require('./listener-52d2e5fd.js');
|
|
23
23
|
require('./swipe.subject-4ec94271.js');
|
|
24
24
|
require('./device-9f97a845.js');
|
|
25
|
-
require('./tokens.esm-
|
|
25
|
+
require('./tokens.esm-b1635d58.js');
|
|
26
26
|
require('./log-33398c2a.js');
|
|
27
27
|
|
|
28
28
|
const TabControl = ({ value, items, onControlChange }) => {
|
|
@@ -16,16 +16,16 @@ const bem = require('./bem-81bc6a2d.js');
|
|
|
16
16
|
const log = require('./log-33398c2a.js');
|
|
17
17
|
const form = require('./form-2279fb2f.js');
|
|
18
18
|
const config_default = require('./config.default-32725178.js');
|
|
19
|
-
const breakpoints_subject = require('./breakpoints.subject-
|
|
19
|
+
const breakpoints_subject = require('./breakpoints.subject-eea07e58.js');
|
|
20
20
|
const config_utils = require('./config.utils-e4cd49d6.js');
|
|
21
|
-
const breakpoints_decorator = require('./breakpoints.decorator-
|
|
21
|
+
const breakpoints_decorator = require('./breakpoints.decorator-4394690a.js');
|
|
22
22
|
const config_decorator = require('./config.decorator-b393a72f.js');
|
|
23
23
|
require('./browser-1d542d0f.js');
|
|
24
24
|
require('./icons.constant-7c82086a.js');
|
|
25
25
|
require('./_commonjsHelpers-68cdf74f.js');
|
|
26
26
|
require('./device-9f97a845.js');
|
|
27
27
|
require('./listener-52d2e5fd.js');
|
|
28
|
-
require('./tokens.esm-
|
|
28
|
+
require('./tokens.esm-b1635d58.js');
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* @name addDays
|