@haiilo/catalyst 14.0.3 → 14.0.4
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/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/{p-817db2bd.entry.js → p-fae91392.entry.js} +2 -2
- package/dist/catalyst/{p-817db2bd.entry.js.map → p-fae91392.entry.js.map} +1 -1
- package/dist/cjs/cat-alert_30.cjs.entry.js +18 -14
- package/dist/collection/components/cat-dropdown/cat-dropdown.js +9 -7
- package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.js +9 -7
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/components/cat-dropdown2.js +9 -7
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-select2.js +9 -7
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/esm/cat-alert_30.entry.js +18 -14
- package/dist/types/components/cat-dropdown/cat-dropdown.d.ts +1 -0
- package/dist/types/components/cat-select/cat-select.d.ts +1 -0
- package/package.json +2 -2
|
@@ -7718,6 +7718,10 @@ const CatDropdown = class {
|
|
|
7718
7718
|
this._isOpen = null;
|
|
7719
7719
|
this.content.style.display = 'block';
|
|
7720
7720
|
this.hasInitialFocus = isFocusVisible ?? this.hasInitialFocus;
|
|
7721
|
+
const trigger = this.anchor || this.trigger;
|
|
7722
|
+
if (trigger) {
|
|
7723
|
+
this.cleanupFloatingUi = autoUpdate(trigger, this.content, () => this.update(trigger));
|
|
7724
|
+
}
|
|
7721
7725
|
// give CSS transition time to apply
|
|
7722
7726
|
setTimeout(() => {
|
|
7723
7727
|
this._isOpen = true;
|
|
@@ -7778,6 +7782,8 @@ const CatDropdown = class {
|
|
|
7778
7782
|
this.content.classList.remove('show');
|
|
7779
7783
|
this.content.style.display = '';
|
|
7780
7784
|
this.trigger?.setAttribute('aria-expanded', 'false');
|
|
7785
|
+
this.cleanupFloatingUi?.();
|
|
7786
|
+
this.cleanupFloatingUi = undefined;
|
|
7781
7787
|
this.catClose.emit();
|
|
7782
7788
|
}, timeTransitionS);
|
|
7783
7789
|
}
|
|
@@ -7790,9 +7796,11 @@ const CatDropdown = class {
|
|
|
7790
7796
|
disconnectedCallback() {
|
|
7791
7797
|
this.trap?.deactivate();
|
|
7792
7798
|
this.trap = undefined;
|
|
7799
|
+
this.cleanupFloatingUi?.();
|
|
7800
|
+
this.cleanupFloatingUi = undefined;
|
|
7793
7801
|
}
|
|
7794
7802
|
render() {
|
|
7795
|
-
return (h(Host, { key: '
|
|
7803
|
+
return (h(Host, { key: '0b02719eae82077fd11262620f260c86f6ef5854' }, h("slot", { key: '809f803bad06e9b9dfab850809709191f8a3bc2e', name: "anchor", ref: el => (this.anchorSlot = el) }), h("slot", { key: 'b6e32999e3cb4e4e4e9a4c534a22a17ae7708486', name: "trigger", ref: el => (this.triggerSlot = el) }), h("div", { key: '47592ef2faeb4a5ba26185a98952c56c3b0804f6', id: this.contentId, class: { content: true, 'overflow-auto': !this.overflow, justified: this.justify, aligned: !this.justify }, ref: el => (this.content = el) }, h("slot", { key: '8b6ba45f55abf7983a66550f161652e5a40205d7', name: "content" }))));
|
|
7796
7804
|
}
|
|
7797
7805
|
get contentId() {
|
|
7798
7806
|
return `cat-dropdown-${this.id}`;
|
|
@@ -7807,18 +7815,12 @@ const CatDropdown = class {
|
|
|
7807
7815
|
this.hasInitialFocus = this.isEventOriginFromKeyboard(event);
|
|
7808
7816
|
this.toggle();
|
|
7809
7817
|
});
|
|
7810
|
-
if (!this.anchor) {
|
|
7811
|
-
autoUpdate(this.trigger, this.content, () => this.update(this.trigger));
|
|
7812
|
-
}
|
|
7813
7818
|
}
|
|
7814
7819
|
isEventOriginFromKeyboard(event) {
|
|
7815
7820
|
return event.detail === 0;
|
|
7816
7821
|
}
|
|
7817
7822
|
initAnchor() {
|
|
7818
7823
|
this.anchor = (this.anchorSlot?.assignedElements?.() || [])[0];
|
|
7819
|
-
if (this.anchor) {
|
|
7820
|
-
autoUpdate(this.anchor, this.content, () => this.update(this.anchor));
|
|
7821
|
-
}
|
|
7822
7824
|
}
|
|
7823
7825
|
findTrigger() {
|
|
7824
7826
|
let trigger;
|
|
@@ -9182,9 +9184,6 @@ const CatSelect = class {
|
|
|
9182
9184
|
if (this.input) {
|
|
9183
9185
|
autosizeInput(this.input, { minWidth: true });
|
|
9184
9186
|
}
|
|
9185
|
-
if (this.trigger && this.dropdown) {
|
|
9186
|
-
autoUpdate(this.trigger, this.dropdown, () => this.update());
|
|
9187
|
-
}
|
|
9188
9187
|
}
|
|
9189
9188
|
componentWillLoad() {
|
|
9190
9189
|
this.onErrorsChanged(this.errors, undefined, false);
|
|
@@ -9375,18 +9374,18 @@ const CatSelect = class {
|
|
|
9375
9374
|
}
|
|
9376
9375
|
render() {
|
|
9377
9376
|
this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
|
|
9378
|
-
return (h(Host, { key: '
|
|
9377
|
+
return (h(Host, { key: '044a13b28c3c3d3fcb5b06efa53d489783ae9698' }, h("div", { key: 'b540d0b58849b8b401c611dfa08da42f45a7953c', class: {
|
|
9379
9378
|
'select-field': true,
|
|
9380
9379
|
'select-horizontal': this.horizontal ?? this.fallbackHorizontal ?? false,
|
|
9381
9380
|
'select-multiple': this.multiple
|
|
9382
|
-
} }, h("div", { key: '
|
|
9381
|
+
} }, h("div", { key: '3864749c06c0aa54df1912f90636094dcdd4a229', class: { 'label-container': true, hidden: this.labelHidden } }, (this.hasSlottedLabel || this.label) && (h("label", { key: 'b2e64f375a8d2e9430007b548f468055a1a83b9b', htmlFor: `select-${this.id}-input`, part: "label" }, h("span", { key: '1d09f458ed23045ecbd3ca3b9bb2fa5740f6c4e1', class: "label-wrapper" }, (this.hasSlottedLabel && h("slot", { key: '7c569d0f97e2c48d6515e051dd8098003b0dc2c2', name: "label" })) || this.label, h("div", { key: 'f3c8709ea17c26d65e41ceb505af51dac81dda37', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (h("span", { key: 'f2cc0d4a5fd0d815a1087b7f2b1c55c73ca36e93', class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (h("span", { key: 'beb3aaaf8261978be7895a1580a42f25f65ef5e7', class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")"))))))), h("div", { key: '23a30b437dca6aea6d6f01156dc6c56faae3912f', class: "select-container" }, h("div", { key: '146509fd8146b3afa9c5157c7a37198c810330d7', class: { 'select-wrapper': true, 'select-disabled': this.disabled, 'select-invalid': this.invalid }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required ? 'true' : false, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, h("div", { key: 'f9f8b2cc0914ba4a7151c580f9e9eda332aad35e', class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (h("span", { class: {
|
|
9383
9382
|
pill: true,
|
|
9384
9383
|
'select-no-open': true,
|
|
9385
9384
|
'select-option-active': this.state.activeSelectionIndex === i
|
|
9386
|
-
}, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", null, item.render.label), !this.disabled && (h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1, "data-dropdown-no-close": true }))))))) : this.state.selection.length && this.state.selection[0].render.avatar ? (h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, icon: this.state.selection[0].render.avatar.icon, initials: this.state.selection[0].render.avatar.initials ?? '' })) : null, h("input", { key: '
|
|
9385
|
+
}, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", null, item.render.label), !this.disabled && (h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1, "data-dropdown-no-close": true }))))))) : this.state.selection.length && this.state.selection[0].render.avatar ? (h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, icon: this.state.selection[0].render.avatar.icon, initials: this.state.selection[0].render.avatar.initials ?? '' })) : null, h("input", { key: 'ccf158ead3c32c1376744366ccae13d32762e150', "data-test": this.testId, ...this.nativeAttributes, part: "input", id: `select-${this.id}-input`, class: "select-input", role: "combobox", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.hasHint ? this.id + '-hint' : undefined, "aria-autocomplete": "list", onInput: this.onInput.bind(this), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving })), this.state.isResolving && h("cat-spinner", { key: '8af750f50e620a73f9a35c66708293e758a2786e' }), this.invalid && (h("cat-icon", { key: '114ead7c9b473945a1fb2f5774e74d75c57819f5', icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
|
|
9387
9386
|
!this.disabled &&
|
|
9388
9387
|
!this.state.isResolving &&
|
|
9389
|
-
this.clearable ? (h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: catI18nRegistry.t('input.clear'), onCatClick: () => this.clearInput(), "data-dropdown-no-close": true })) : null, !this.state.isResolving && (h("cat-button", { key: '
|
|
9388
|
+
this.clearable ? (h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: catI18nRegistry.t('input.clear'), onCatClick: () => this.clearInput(), "data-dropdown-no-close": true })) : null, !this.state.isResolving && (h("cat-button", { key: 'ece4331f89cbb9c37d9f9693800bca1320ff7f37', iconOnly: true, icon: "$cat:select-open", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? catI18nRegistry.t('select.close') : catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving, "data-dropdown-no-close": true }))), this.hasHint && (h(CatFormHint, { key: 'd25455be1db5404a698b35d088ba0a303215a321', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))), h("div", { key: 'c58c1914f90b0fb9a7b40c4c37e2fe7d92877ab8', class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (h("cat-scrollable", { key: '73a6a048ba31d8f5944d4a1aa6c8c4fb96e56df2', class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, h("ul", { key: '4b86961480022fd7dd0e1641fdaed8116e320090', class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isFirstLoading
|
|
9390
9389
|
? Array.from(Array(CatSelect.SKELETON_COUNT)).map(() => (h("li", { class: "select-option-loading" }, h("cat-skeleton", { variant: "body", lines: 1 }), h("cat-skeleton", { variant: "body", lines: 1 }))))
|
|
9391
9390
|
: !this.state.options.length &&
|
|
9392
9391
|
!this.tags && (h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : catI18nRegistry.t('select.empty')))))))));
|
|
@@ -9453,6 +9452,9 @@ const CatSelect = class {
|
|
|
9453
9452
|
}
|
|
9454
9453
|
show() {
|
|
9455
9454
|
if (!this.state.isOpen && this.connector) {
|
|
9455
|
+
if (this.trigger && this.dropdown) {
|
|
9456
|
+
this.cleanupFloatingUi = autoUpdate(this.trigger, this.dropdown, () => this.update());
|
|
9457
|
+
}
|
|
9456
9458
|
// reconnect to reset the connection, i.e. the pagination
|
|
9457
9459
|
this.connect(this.connector);
|
|
9458
9460
|
this.patchState({ isOpen: true, isFirstLoading: true, options: [] });
|
|
@@ -9464,6 +9466,8 @@ const CatSelect = class {
|
|
|
9464
9466
|
hide() {
|
|
9465
9467
|
if (this.state.isOpen) {
|
|
9466
9468
|
this.patchState({ isOpen: false, activeOptionIndex: -1 });
|
|
9469
|
+
this.cleanupFloatingUi?.();
|
|
9470
|
+
this.cleanupFloatingUi = undefined;
|
|
9467
9471
|
this.catClose.emit();
|
|
9468
9472
|
return true;
|
|
9469
9473
|
}
|
|
@@ -14,6 +14,7 @@ export declare class CatDropdown {
|
|
|
14
14
|
private content;
|
|
15
15
|
private trap?;
|
|
16
16
|
private _isOpen;
|
|
17
|
+
private cleanupFloatingUi?;
|
|
17
18
|
/**
|
|
18
19
|
* Tracking the origin of opening the dropdown and specify if initial focus should be set.
|
|
19
20
|
* Currently we set it only when the origin is keyboard.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haiilo/catalyst",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.4",
|
|
4
4
|
"description": "Catalyst Design System",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"sanitize.css": "13.0.0",
|
|
40
40
|
"tabbable": "6.2.0",
|
|
41
41
|
"toastify-js": "1.12.0",
|
|
42
|
-
"@haiilo/catalyst-tokens": "14.0.
|
|
42
|
+
"@haiilo/catalyst-tokens": "14.0.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@babel/core": "7.28.5",
|