@public-ui/hydrate 1.7.3 → 1.7.5
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/dist/index.js +144 -40
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -7810,7 +7810,7 @@ const initKoliBri = () => {
|
|
|
7810
7810
|
| . ' | .-. | | | ,--. | .-. \\ | .--' ,--.
|
|
7811
7811
|
| |\\ \\ | '-' | | | | | | '--' / | | | |
|
|
7812
7812
|
\`--' \`--´ \`---´ \`--' \`--' \`------´ \`--' \`--'
|
|
7813
|
-
🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io | 1.7.
|
|
7813
|
+
🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io | 1.7.5
|
|
7814
7814
|
`, {
|
|
7815
7815
|
forceLog: true,
|
|
7816
7816
|
});
|
|
@@ -10151,6 +10151,9 @@ class KolAccordion {
|
|
|
10151
10151
|
constructor(hostRef) {
|
|
10152
10152
|
registerInstance(this, hostRef);
|
|
10153
10153
|
this.nonce = nonce();
|
|
10154
|
+
this.catchRef = (ref) => {
|
|
10155
|
+
propagateFocus(this.host, ref);
|
|
10156
|
+
};
|
|
10154
10157
|
this.onClick = (event) => {
|
|
10155
10158
|
this._open = !this._open;
|
|
10156
10159
|
setTimeout(() => {
|
|
@@ -10174,7 +10177,7 @@ class KolAccordion {
|
|
|
10174
10177
|
return (hAsync(Host, null, hAsync("div", { class: {
|
|
10175
10178
|
accordion: true,
|
|
10176
10179
|
open: this.state._open === true,
|
|
10177
|
-
} }, hAsync("kol-heading-wc", { _label: "", _level: this.state._level }, hAsync("kol-button-wc", { _ariaControls: this.nonce, _ariaExpanded: this.state._open, _icons: this.state._open ? 'codicon codicon-remove' : 'codicon codicon-add', _label: this.state._label, _on: { onClick: this.onClick } })), hAsync("div", { class: "header" }, hAsync("slot", { name: "header" })), hAsync("div", { class: "wrapper" }, hAsync("div", { class: "animation-wrapper" }, hAsync("div", { "aria-hidden": this.state._open === false ? 'true' : undefined, class: "content", id: this.nonce }, hAsync("slot", { name: "content" }), " ", hAsync("slot", null)))))));
|
|
10180
|
+
} }, hAsync("kol-heading-wc", { _label: "", _level: this.state._level }, hAsync("kol-button-wc", { ref: this.catchRef, slot: "expert", _ariaControls: this.nonce, _ariaExpanded: this.state._open, _icons: this.state._open ? 'codicon codicon-remove' : 'codicon codicon-add', _label: this.state._label, _on: { onClick: this.onClick } })), hAsync("div", { class: "header" }, hAsync("slot", { name: "header" })), hAsync("div", { class: "wrapper" }, hAsync("div", { class: "animation-wrapper" }, hAsync("div", { "aria-hidden": this.state._open === false ? 'true' : undefined, class: "content", id: this.nonce }, hAsync("slot", { name: "content" }), " ", hAsync("slot", null)))))));
|
|
10178
10181
|
}
|
|
10179
10182
|
validateHeading(value) {
|
|
10180
10183
|
this.validateLabel(value);
|
|
@@ -10199,6 +10202,7 @@ class KolAccordion {
|
|
|
10199
10202
|
this.validateOn(this._on);
|
|
10200
10203
|
this.validateOpen(this._open);
|
|
10201
10204
|
}
|
|
10205
|
+
get host() { return getElement(this); }
|
|
10202
10206
|
static get watchers() { return {
|
|
10203
10207
|
"_heading": ["validateHeading"],
|
|
10204
10208
|
"_label": ["validateLabel"],
|
|
@@ -11298,8 +11302,7 @@ class KolButton {
|
|
|
11298
11302
|
constructor(hostRef) {
|
|
11299
11303
|
registerInstance(this, hostRef);
|
|
11300
11304
|
this.catchRef = (ref) => {
|
|
11301
|
-
this.
|
|
11302
|
-
propagateFocus(this.host, this.ref);
|
|
11305
|
+
propagateFocus(this.host, ref);
|
|
11303
11306
|
};
|
|
11304
11307
|
this._accessKey = undefined;
|
|
11305
11308
|
this._ariaControls = undefined;
|
|
@@ -11420,8 +11423,7 @@ class KolButtonLink {
|
|
|
11420
11423
|
constructor(hostRef) {
|
|
11421
11424
|
registerInstance(this, hostRef);
|
|
11422
11425
|
this.catchRef = (ref) => {
|
|
11423
|
-
this.
|
|
11424
|
-
propagateFocus(this.host, this.ref);
|
|
11426
|
+
propagateFocus(this.host, ref);
|
|
11425
11427
|
};
|
|
11426
11428
|
this._accessKey = undefined;
|
|
11427
11429
|
this._ariaControls = undefined;
|
|
@@ -12318,6 +12320,10 @@ const defaultStyleCss$z = "/*!@:host*/.sc-kol-details-default-h{--a11y-min-size:
|
|
|
12318
12320
|
class KolDetails {
|
|
12319
12321
|
constructor(hostRef) {
|
|
12320
12322
|
registerInstance(this, hostRef);
|
|
12323
|
+
this.catchRef = (ref) => {
|
|
12324
|
+
this.summaryElement = ref;
|
|
12325
|
+
propagateFocus(this.host, this.summaryElement);
|
|
12326
|
+
};
|
|
12321
12327
|
this.handleToggle = (event) => {
|
|
12322
12328
|
clearTimeout(this.toggleTimeout);
|
|
12323
12329
|
this.toggleTimeout = setTimeout(() => {
|
|
@@ -12344,7 +12350,7 @@ class KolDetails {
|
|
|
12344
12350
|
render() {
|
|
12345
12351
|
return (hAsync(Host, null, hAsync("details", { ref: (el) => {
|
|
12346
12352
|
this.detailsElement = el;
|
|
12347
|
-
}, onToggle: this.handleToggle }, hAsync("summary", { ref:
|
|
12353
|
+
}, onToggle: this.handleToggle }, hAsync("summary", { ref: this.catchRef }, this.state._open ? hAsync("kol-icon", { _label: "", _icons: "codicon codicon-chevron-down" }) : hAsync("kol-icon", { _label: "", _icons: "codicon codicon-chevron-right" }), hAsync("span", null, this.state._label)), hAsync("div", { "aria-hidden": this.state._open === false ? 'true' : undefined, class: "content", ref: (element) => (this.contentElement = element) }, hAsync("kol-indented-text", null, hAsync("slot", null))))));
|
|
12348
12354
|
}
|
|
12349
12355
|
validateLabel(value) {
|
|
12350
12356
|
validateLabel(this, value);
|
|
@@ -12695,7 +12701,7 @@ function validateLoading(component, value) {
|
|
|
12695
12701
|
watchValidator(component, '_loading', (value) => value === 'eager' || value === 'lazy', AVAILABLE_LOADING_VALUES, value);
|
|
12696
12702
|
}
|
|
12697
12703
|
|
|
12698
|
-
const defaultStyleCss$w = "/*!@img*/img.sc-kol-image-default{max-height:100%;max-width:100%}";
|
|
12704
|
+
const defaultStyleCss$w = "/*!@:host*/.sc-kol-image-default-h{display:inline-block}/*!@img*/img.sc-kol-image-default{max-height:100%;max-width:100%}";
|
|
12699
12705
|
|
|
12700
12706
|
class KolImage {
|
|
12701
12707
|
constructor(hostRef) {
|
|
@@ -13304,13 +13310,12 @@ class KolInputCheckbox {
|
|
|
13304
13310
|
[this.state._variant]: true,
|
|
13305
13311
|
'hide-label': !!this.state._hideLabel,
|
|
13306
13312
|
checked: this.state._checked,
|
|
13307
|
-
}, "data-role": this.state._variant === 'button' ? 'button' : undefined, onKeyPress: this.state._variant === 'button' ? this.onChange : undefined, tabIndex: this.state._variant === 'button' ? 0 : undefined, _alert: this.state._alert, _disabled: this.state._disabled, _error: this.state._error, _hideError: this.state._hideError, _hideLabel: this.state._hideLabel, _hint: this.state._hint, _id: this.state._id, _label: this.state._label, _required: this.state._required, _tooltipAlign: this._tooltipAlign, _touched: this.state._touched }, hAsync("span", { slot: "label" }, hasExpertSlot ? hAsync("slot", null) : this.state._label), hAsync("div", { slot: "input" }, hAsync("kol-icon", { class: "icon", onClick: this.handleIconClick.bind(this), _icons: this.state._indeterminate ? this.state._icons.indeterminate : this.state._checked ? this.state._icons.checked : this.state._icons.unchecked, _label: "" }), hAsync("input", Object.assign({ ref: this.catchRef, title: "", accessKey: this.state._accessKey, "aria-describedby": ariaDescribedBy.length > 0 ? ariaDescribedBy.join(' ') : undefined, "aria-label": this.state._hideLabel && typeof this.state._label === 'string' ? this.state._label : undefined, checked: this.state._checked, disabled: this.state._disabled, id: this.state._id, indeterminate: this.state._indeterminate, name: this.state._name, required: this.state._required, tabIndex: this.state._tabIndex, type: "checkbox" }, this.controller.onFacade, { onChange: this.onChange, onClick: undefined }))))));
|
|
13313
|
+
}, "data-role": this.state._variant === 'button' ? 'button' : undefined, onKeyPress: this.state._variant === 'button' ? this.onChange : undefined, tabIndex: this.state._variant === 'button' && !this.state._disabled ? 0 : undefined, _alert: this.state._alert, _disabled: this.state._disabled, _error: this.state._error, _hideError: this.state._hideError, _hideLabel: this.state._hideLabel, _hint: this.state._hint, _id: this.state._id, _label: this.state._label, _required: this.state._required, _tooltipAlign: this._tooltipAlign, _touched: this.state._touched }, hAsync("span", { slot: "label" }, hasExpertSlot ? hAsync("slot", null) : this.state._label), hAsync("div", { slot: "input" }, hAsync("kol-icon", { class: "icon", onClick: this.handleIconClick.bind(this), _icons: this.state._indeterminate ? this.state._icons.indeterminate : this.state._checked ? this.state._icons.checked : this.state._icons.unchecked, _label: "" }), hAsync("input", Object.assign({ ref: this.catchRef, title: "", accessKey: this.state._accessKey, "aria-describedby": ariaDescribedBy.length > 0 ? ariaDescribedBy.join(' ') : undefined, "aria-label": this.state._hideLabel && typeof this.state._label === 'string' ? this.state._label : undefined, checked: this.state._checked, disabled: this.state._disabled, id: this.state._id, indeterminate: this.state._indeterminate, name: this.state._name, required: this.state._required, tabIndex: this.state._tabIndex, type: "checkbox" }, this.controller.onFacade, { onChange: this.onChange, onClick: undefined }))))));
|
|
13308
13314
|
}
|
|
13309
13315
|
constructor(hostRef) {
|
|
13310
13316
|
registerInstance(this, hostRef);
|
|
13311
13317
|
this.catchRef = (ref) => {
|
|
13312
|
-
this.
|
|
13313
|
-
propagateFocus(this.host, this.ref);
|
|
13318
|
+
propagateFocus(this.host, ref);
|
|
13314
13319
|
};
|
|
13315
13320
|
this.onChange = (event) => {
|
|
13316
13321
|
var _a;
|
|
@@ -15369,8 +15374,7 @@ class KolInputRadio {
|
|
|
15369
15374
|
constructor(hostRef) {
|
|
15370
15375
|
registerInstance(this, hostRef);
|
|
15371
15376
|
this.catchRef = (ref) => {
|
|
15372
|
-
this.
|
|
15373
|
-
propagateFocus(this.host, this.ref);
|
|
15377
|
+
propagateFocus(this.host, ref);
|
|
15374
15378
|
};
|
|
15375
15379
|
this.onChange = (event) => {
|
|
15376
15380
|
var _a;
|
|
@@ -16236,8 +16240,7 @@ class KolLink {
|
|
|
16236
16240
|
constructor(hostRef) {
|
|
16237
16241
|
registerInstance(this, hostRef);
|
|
16238
16242
|
this.catchRef = (ref) => {
|
|
16239
|
-
this.
|
|
16240
|
-
propagateFocus(this.host, this.ref);
|
|
16243
|
+
propagateFocus(this.host, ref);
|
|
16241
16244
|
};
|
|
16242
16245
|
this._ariaControls = undefined;
|
|
16243
16246
|
this._ariaCurrent = undefined;
|
|
@@ -16312,8 +16315,7 @@ class KolLinkButton {
|
|
|
16312
16315
|
constructor(hostRef) {
|
|
16313
16316
|
registerInstance(this, hostRef);
|
|
16314
16317
|
this.catchRef = (ref) => {
|
|
16315
|
-
this.
|
|
16316
|
-
propagateFocus(this.host, this.ref);
|
|
16318
|
+
propagateFocus(this.host, ref);
|
|
16317
16319
|
};
|
|
16318
16320
|
this._ariaControls = undefined;
|
|
16319
16321
|
this._ariaCurrent = undefined;
|
|
@@ -33524,15 +33526,23 @@ class KolTextarea {
|
|
|
33524
33526
|
}; }
|
|
33525
33527
|
}
|
|
33526
33528
|
|
|
33527
|
-
const
|
|
33528
|
-
|
|
33529
|
-
const defaultStyleCss$2 = "";
|
|
33529
|
+
const defaultStyleCss$2 = "/*!@:host*/.sc-kol-toast-default-h{--a11y-min-size:44px;font-size:inherit}/*!@**/*.sc-kol-toast-default{font-family:Verdana;hyphens:auto;letter-spacing:inherit;word-break:break-word;word-spacing:inherit}/*!@[role='button'],\nbutton:not([role='link']),\nkol-input .input*/[role='button'].sc-kol-toast-default,button.sc-kol-toast-default:not([role='link']),kol-input.sc-kol-toast-default .input.sc-kol-toast-default{min-height:var(--a11y-min-size);min-width:var(--a11y-min-size)}/*!@a,\nbutton,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\ninput,\noption,\nselect,\ntextarea*/a.sc-kol-toast-default,button.sc-kol-toast-default,h1.sc-kol-toast-default,h2.sc-kol-toast-default,h3.sc-kol-toast-default,h4.sc-kol-toast-default,h5.sc-kol-toast-default,h6.sc-kol-toast-default,input.sc-kol-toast-default,option.sc-kol-toast-default,select.sc-kol-toast-default,textarea.sc-kol-toast-default{font-family:inherit;font-size:inherit}/*!@:is(a, button)*/.sc-kol-toast-default:is(a,button).sc-kol-toast-default{background-color:transparent;border:none;margin:0;padding:0;width:100%}/*!@:host*/.sc-kol-toast-default-h{max-width:100%}/*!@**/*.sc-kol-toast-default{box-sizing:border-box}/*!@kol-span-wc*/kol-span-wc.sc-kol-toast-default{display:grid;place-items:center}/*!@kol-span-wc > span*/kol-span-wc.sc-kol-toast-default>span.sc-kol-toast-default{display:flex;place-items:center}/*!@a,\nbutton*/a.sc-kol-toast-default,button.sc-kol-toast-default{cursor:pointer}/*!@button,\ninput,\noption,\nselect,\ntextarea*/button.sc-kol-toast-default,input.sc-kol-toast-default,option.sc-kol-toast-default,select.sc-kol-toast-default,textarea.sc-kol-toast-default{font-family:inherit}/*!@.icon-only > kol-span-wc > span > span*/.icon-only.sc-kol-toast-default>kol-span-wc.sc-kol-toast-default>span.sc-kol-toast-default>span.sc-kol-toast-default{display:none}/*!@:host*/.sc-kol-toast-default-h{display:block}/*!@:host > div*/.sc-kol-toast-default-h>div.sc-kol-toast-default{background-color:#fff;height:0;left:0;position:fixed;top:0;width:100%;z-index:200}/*!@:host > div > kol-alert*/.sc-kol-toast-default-h>div.sc-kol-toast-default>kol-alert.sc-kol-toast-default{display:block;margin:auto;max-width:750px}/*!@:host > div > kol-button-wc*/.sc-kol-toast-default-h>div.sc-kol-toast-default>kol-button-wc.sc-kol-toast-default{display:block;margin:auto;position:relative;top:0;width:1em}";
|
|
33530
33530
|
|
|
33531
33531
|
class KolToast {
|
|
33532
33532
|
constructor(hostRef) {
|
|
33533
33533
|
registerInstance(this, hostRef);
|
|
33534
|
+
this.handleShowAndDuration = () => {
|
|
33535
|
+
if (this.state._show === true && typeof this.state._showDuration === 'number' && this.state._showDuration >= 0) {
|
|
33536
|
+
clearTimeout(this.durationTimeout);
|
|
33537
|
+
this.durationTimeout = setTimeout(() => {
|
|
33538
|
+
this.close();
|
|
33539
|
+
}, this.state._showDuration);
|
|
33540
|
+
}
|
|
33541
|
+
};
|
|
33534
33542
|
this.close = () => {
|
|
33535
33543
|
var _a;
|
|
33544
|
+
this._show = false;
|
|
33545
|
+
this.state = Object.assign(Object.assign({}, this.state), { _show: false });
|
|
33536
33546
|
if (((_a = this._on) === null || _a === void 0 ? void 0 : _a.onClose) !== undefined) {
|
|
33537
33547
|
this._on.onClose(new Event('Close'));
|
|
33538
33548
|
}
|
|
@@ -33540,42 +33550,76 @@ class KolToast {
|
|
|
33540
33550
|
this.on = {
|
|
33541
33551
|
onClose: this.close,
|
|
33542
33552
|
};
|
|
33553
|
+
this._alert = true;
|
|
33554
|
+
this._hasCloser = false;
|
|
33555
|
+
this._heading = '';
|
|
33543
33556
|
this._label = undefined;
|
|
33557
|
+
this._level = 1;
|
|
33544
33558
|
this._on = undefined;
|
|
33545
|
-
this.
|
|
33559
|
+
this._show = true;
|
|
33560
|
+
this._showDuration = 10000;
|
|
33546
33561
|
this._type = 'default';
|
|
33547
33562
|
this.state = {
|
|
33548
|
-
|
|
33549
|
-
|
|
33563
|
+
_alert: true,
|
|
33564
|
+
_level: 1,
|
|
33565
|
+
_show: true,
|
|
33550
33566
|
};
|
|
33551
33567
|
}
|
|
33568
|
+
validateAlert(value) {
|
|
33569
|
+
watchBoolean(this, '_alert', value);
|
|
33570
|
+
}
|
|
33571
|
+
validateHasCloser(value) {
|
|
33572
|
+
validateHasCloser(this, value);
|
|
33573
|
+
}
|
|
33574
|
+
validateHeading(value) {
|
|
33575
|
+
this.validateLabel(value);
|
|
33576
|
+
}
|
|
33552
33577
|
validateLabel(value) {
|
|
33553
33578
|
validateLabel(this, value);
|
|
33554
33579
|
}
|
|
33580
|
+
validateLevel(value) {
|
|
33581
|
+
watchHeadingLevel(this, value);
|
|
33582
|
+
}
|
|
33555
33583
|
validateOn(value) {
|
|
33556
33584
|
if (typeof value === 'object' && (typeof (value === null || value === void 0 ? void 0 : value.onClose) === 'function' || value.onClose === true)) {
|
|
33557
33585
|
setState(this, '_on', { onClose: value.onClose });
|
|
33558
33586
|
}
|
|
33559
33587
|
}
|
|
33560
|
-
|
|
33561
|
-
|
|
33588
|
+
validateShow(value) {
|
|
33589
|
+
validateShow(this, value, { hooks: { afterPatch: this.handleShowAndDuration } });
|
|
33590
|
+
}
|
|
33591
|
+
validateShowDuration(value) {
|
|
33592
|
+
watchNumber(this, '_showDuration', value, {
|
|
33593
|
+
hooks: {
|
|
33594
|
+
afterPatch: this.handleShowAndDuration,
|
|
33595
|
+
},
|
|
33596
|
+
});
|
|
33562
33597
|
}
|
|
33563
33598
|
validateType(value) {
|
|
33564
33599
|
watchValidator(this, '_type', (value) => typeof value === 'string' && (value === 'default' || value === 'error' || value === 'info' || value === 'success' || value === 'warning'), new Set('String {success, info, warning, error}'), value);
|
|
33565
33600
|
}
|
|
33566
33601
|
componentWillLoad() {
|
|
33567
|
-
this.
|
|
33602
|
+
this.validateAlert(this._alert);
|
|
33603
|
+
this.validateHasCloser(this._hasCloser);
|
|
33604
|
+
this.validateLabel(this._label || this._heading);
|
|
33605
|
+
this.validateLevel(this._level);
|
|
33568
33606
|
this.validateOn(this._on);
|
|
33569
|
-
this.
|
|
33607
|
+
this.validateShow(this._show);
|
|
33608
|
+
this.validateShowDuration(this._showDuration);
|
|
33570
33609
|
this.validateType(this._type);
|
|
33571
33610
|
}
|
|
33572
33611
|
render() {
|
|
33573
|
-
return (hAsync(
|
|
33612
|
+
return (hAsync(Host, null, this.state._show && (hAsync("div", null, hAsync("kol-alert", { _alert: this.state._alert, _label: this.state._label, _level: this.state._level, _hasCloser: this.state._hasCloser, _type: this.state._type, _variant: "card", _on: this.on }, hAsync("slot", null))))));
|
|
33574
33613
|
}
|
|
33575
33614
|
static get watchers() { return {
|
|
33615
|
+
"_alert": ["validateAlert"],
|
|
33616
|
+
"_hasCloser": ["validateHasCloser"],
|
|
33617
|
+
"_heading": ["validateHeading"],
|
|
33576
33618
|
"_label": ["validateLabel"],
|
|
33619
|
+
"_level": ["validateLevel"],
|
|
33577
33620
|
"_on": ["validateOn"],
|
|
33578
|
-
"
|
|
33621
|
+
"_show": ["validateShow"],
|
|
33622
|
+
"_showDuration": ["validateShowDuration"],
|
|
33579
33623
|
"_type": ["validateType"]
|
|
33580
33624
|
}; }
|
|
33581
33625
|
static get style() { return {
|
|
@@ -33585,19 +33629,35 @@ class KolToast {
|
|
|
33585
33629
|
"$flags$": 41,
|
|
33586
33630
|
"$tagName$": "kol-toast",
|
|
33587
33631
|
"$members$": {
|
|
33632
|
+
"_alert": [4],
|
|
33633
|
+
"_hasCloser": [4, "_has-closer"],
|
|
33634
|
+
"_heading": [1],
|
|
33588
33635
|
"_label": [1],
|
|
33636
|
+
"_level": [2],
|
|
33589
33637
|
"_on": [16],
|
|
33590
|
-
"
|
|
33638
|
+
"_show": [1540],
|
|
33639
|
+
"_showDuration": [2, "_show-duration"],
|
|
33591
33640
|
"_type": [1],
|
|
33592
33641
|
"state": [32]
|
|
33593
33642
|
},
|
|
33594
33643
|
"$listeners$": undefined,
|
|
33595
33644
|
"$lazyBundleId$": "-",
|
|
33596
|
-
"$attrsToReflect$": []
|
|
33645
|
+
"$attrsToReflect$": [["_show", "_show"]]
|
|
33597
33646
|
}; }
|
|
33598
33647
|
}
|
|
33599
33648
|
|
|
33600
|
-
const
|
|
33649
|
+
const InternalToast = ({ toastState, onClose, key }) => {
|
|
33650
|
+
const handleRef = (element) => {
|
|
33651
|
+
if (typeof toastState.toast.render === 'function' && element) {
|
|
33652
|
+
toastState.toast.render(element, { close: () => onClose() });
|
|
33653
|
+
}
|
|
33654
|
+
};
|
|
33655
|
+
return (hAsync("div", { class: `toast ${toastState.status}`, key: key },
|
|
33656
|
+
hAsync("kol-alert", { class: "alert", _alert: true, _label: toastState.toast.label, _level: 0, _hasCloser: true, _type: toastState.toast.type, _variant: "card", _on: { onClose } },
|
|
33657
|
+
hAsync("div", { ref: handleRef }, typeof toastState.toast.description === 'string' ? toastState.toast.description : null))));
|
|
33658
|
+
};
|
|
33659
|
+
|
|
33660
|
+
const defaultStyleCss$1 = "@layer kol-component {\n\t.sc-kol-toast-container-default-h {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tposition: fixed;\n\t\tz-index: 200;\n\t}\n\n\t.close-all {\n\t\talign-self: flex-end;\n\t}\n}";
|
|
33601
33661
|
|
|
33602
33662
|
const TRANSITION_TIMEOUT = 300;
|
|
33603
33663
|
class KolToastContainer {
|
|
@@ -33637,7 +33697,7 @@ class KolToastContainer {
|
|
|
33637
33697
|
}, TRANSITION_TIMEOUT);
|
|
33638
33698
|
}
|
|
33639
33699
|
render() {
|
|
33640
|
-
return (hAsync(Fragment, null, this.state._toastStates.length > 1 && (hAsync("kol-button", { _label: translate('kol-toast-close-all'), class: "close-all", _on: { onClick: this.handleCloseAllClick.bind(this) } })), this.state._toastStates.map((toastState) => (hAsync(
|
|
33700
|
+
return (hAsync(Fragment, null, this.state._toastStates.length > 1 && (hAsync("kol-button", { _label: translate('kol-toast-close-all'), class: "close-all", _on: { onClick: this.handleCloseAllClick.bind(this) } })), this.state._toastStates.map((toastState) => (hAsync(InternalToast, { toastState: toastState, onClose: () => this.handleClose(toastState), key: toastState.id })))));
|
|
33641
33701
|
}
|
|
33642
33702
|
static get style() { return {
|
|
33643
33703
|
default: defaultStyleCss$1
|
|
@@ -34090,8 +34150,28 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
34090
34150
|
class ToasterService {
|
|
34091
34151
|
constructor(document) {
|
|
34092
34152
|
this.document = document;
|
|
34093
|
-
this.
|
|
34094
|
-
this.
|
|
34153
|
+
this.queue = new Set();
|
|
34154
|
+
this.isOpen = false;
|
|
34155
|
+
this.toastElement = this.document.createElement('kol-toast');
|
|
34156
|
+
this.toastElement.setAttribute('_level', '0');
|
|
34157
|
+
this.toastElement.setAttribute('_show', 'false');
|
|
34158
|
+
this.toastElement.setAttribute('_show-duration', '-1');
|
|
34159
|
+
this.toastElement.setAttribute('_has-closer', 'true');
|
|
34160
|
+
this.toastElement._on = {
|
|
34161
|
+
onClose: () => {
|
|
34162
|
+
const next = this.queue.values().next();
|
|
34163
|
+
if (next.value) {
|
|
34164
|
+
this.queue.delete(next.value);
|
|
34165
|
+
setTimeout(() => {
|
|
34166
|
+
this.showToast(next.value);
|
|
34167
|
+
}, 200);
|
|
34168
|
+
}
|
|
34169
|
+
else {
|
|
34170
|
+
this.isOpen = false;
|
|
34171
|
+
}
|
|
34172
|
+
},
|
|
34173
|
+
};
|
|
34174
|
+
this.document.body.insertBefore(this.toastElement, this.document.body.firstChild);
|
|
34095
34175
|
}
|
|
34096
34176
|
static getInstance(document) {
|
|
34097
34177
|
let instance = this.instances.get(document);
|
|
@@ -34102,18 +34182,42 @@ class ToasterService {
|
|
|
34102
34182
|
return instance;
|
|
34103
34183
|
}
|
|
34104
34184
|
dispose() {
|
|
34105
|
-
const element = this.
|
|
34185
|
+
const element = this.toastElement;
|
|
34106
34186
|
if (element) {
|
|
34107
|
-
this.
|
|
34187
|
+
this.toastElement = undefined;
|
|
34188
|
+
this.queue.clear();
|
|
34108
34189
|
element.remove();
|
|
34190
|
+
const on = element._on;
|
|
34191
|
+
if (on && on.onClose) {
|
|
34192
|
+
on.onClose(new Event('dispose'));
|
|
34193
|
+
}
|
|
34109
34194
|
}
|
|
34110
34195
|
else {
|
|
34111
34196
|
console.warn('Toaster service is already disposed.');
|
|
34112
34197
|
}
|
|
34113
34198
|
}
|
|
34114
|
-
|
|
34115
|
-
|
|
34116
|
-
|
|
34199
|
+
enqueue(data) {
|
|
34200
|
+
if (this.isOpen) {
|
|
34201
|
+
this.queue.add(data);
|
|
34202
|
+
}
|
|
34203
|
+
else {
|
|
34204
|
+
this.showToast(data);
|
|
34205
|
+
}
|
|
34206
|
+
}
|
|
34207
|
+
showToast(data) {
|
|
34208
|
+
const label = data.label || data.heading;
|
|
34209
|
+
if (typeof label === 'undefined') {
|
|
34210
|
+
throw new Error('Toast requires a label.');
|
|
34211
|
+
}
|
|
34212
|
+
if (!this.toastElement) {
|
|
34213
|
+
console.warn('Tried to show a new toast at a disposed toaster service!');
|
|
34214
|
+
return;
|
|
34215
|
+
}
|
|
34216
|
+
this.toastElement.setAttribute('_label', label);
|
|
34217
|
+
this.toastElement.setAttribute('_show', 'true');
|
|
34218
|
+
this.toastElement.setAttribute('_type', data.type);
|
|
34219
|
+
this.toastElement.innerText = data.description;
|
|
34220
|
+
this.isOpen = true;
|
|
34117
34221
|
}
|
|
34118
34222
|
}
|
|
34119
34223
|
ToasterService.instances = new Map();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@public-ui/hydrate",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"homepage": "https://public-ui.github.io",
|
|
6
6
|
"repository": "https://github.com/public-ui/kolibri",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"hydrate"
|
|
43
43
|
],
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@public-ui/components": "1.7.
|
|
45
|
+
"@public-ui/components": "1.7.5",
|
|
46
46
|
"rimraf": "3.0.2"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@public-ui/components": "1.7.
|
|
49
|
+
"@public-ui/components": "1.7.5"
|
|
50
50
|
},
|
|
51
51
|
"sideEffects": false,
|
|
52
52
|
"type": "commonjs",
|