@haiilo/catalyst 14.1.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/{p-15f91e64.entry.js → p-6e04e50f.entry.js} +3 -3
- package/dist/catalyst/p-6e04e50f.entry.js.map +1 -0
- package/dist/cjs/cat-alert_30.cjs.entry.js +93 -75
- package/dist/collection/components/cat-select/cat-select.js +18 -5
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/components/cat-select2.js +18 -5
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/floating-ui.dom.js +75 -70
- package/dist/components/floating-ui.dom.js.map +1 -1
- package/dist/esm/cat-alert_30.entry.js +93 -75
- package/dist/types/components/cat-select/cat-select.d.ts +4 -0
- package/package.json +2 -2
- package/dist/catalyst/p-15f91e64.entry.js.map +0 -1
|
@@ -4891,6 +4891,71 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
4891
4891
|
return coords;
|
|
4892
4892
|
}
|
|
4893
4893
|
|
|
4894
|
+
/**
|
|
4895
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
4896
|
+
* element is overflowing a given clipping boundary on each side.
|
|
4897
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
4898
|
+
* - negative = how many pixels left before it will overflow
|
|
4899
|
+
* - 0 = lies flush with the boundary
|
|
4900
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
4901
|
+
*/
|
|
4902
|
+
async function detectOverflow(state, options) {
|
|
4903
|
+
var _await$platform$isEle;
|
|
4904
|
+
if (options === void 0) {
|
|
4905
|
+
options = {};
|
|
4906
|
+
}
|
|
4907
|
+
const {
|
|
4908
|
+
x,
|
|
4909
|
+
y,
|
|
4910
|
+
platform,
|
|
4911
|
+
rects,
|
|
4912
|
+
elements,
|
|
4913
|
+
strategy
|
|
4914
|
+
} = state;
|
|
4915
|
+
const {
|
|
4916
|
+
boundary = 'clippingAncestors',
|
|
4917
|
+
rootBoundary = 'viewport',
|
|
4918
|
+
elementContext = 'floating',
|
|
4919
|
+
altBoundary = false,
|
|
4920
|
+
padding = 0
|
|
4921
|
+
} = evaluate(options, state);
|
|
4922
|
+
const paddingObject = getPaddingObject(padding);
|
|
4923
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
4924
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
4925
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
4926
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
4927
|
+
boundary,
|
|
4928
|
+
rootBoundary,
|
|
4929
|
+
strategy
|
|
4930
|
+
}));
|
|
4931
|
+
const rect = elementContext === 'floating' ? {
|
|
4932
|
+
x,
|
|
4933
|
+
y,
|
|
4934
|
+
width: rects.floating.width,
|
|
4935
|
+
height: rects.floating.height
|
|
4936
|
+
} : rects.reference;
|
|
4937
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
4938
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
4939
|
+
x: 1,
|
|
4940
|
+
y: 1
|
|
4941
|
+
} : {
|
|
4942
|
+
x: 1,
|
|
4943
|
+
y: 1
|
|
4944
|
+
};
|
|
4945
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4946
|
+
elements,
|
|
4947
|
+
rect,
|
|
4948
|
+
offsetParent,
|
|
4949
|
+
strategy
|
|
4950
|
+
}) : rect);
|
|
4951
|
+
return {
|
|
4952
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
4953
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
4954
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
4955
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
4956
|
+
};
|
|
4957
|
+
}
|
|
4958
|
+
|
|
4894
4959
|
/**
|
|
4895
4960
|
* Computes the `x` and `y` coordinates that will place the floating element
|
|
4896
4961
|
* next to a given reference element.
|
|
@@ -4920,6 +4985,7 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
4920
4985
|
let middlewareData = {};
|
|
4921
4986
|
let resetCount = 0;
|
|
4922
4987
|
for (let i = 0; i < validMiddleware.length; i++) {
|
|
4988
|
+
var _platform$detectOverf;
|
|
4923
4989
|
const {
|
|
4924
4990
|
name,
|
|
4925
4991
|
fn
|
|
@@ -4937,7 +5003,10 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
4937
5003
|
strategy,
|
|
4938
5004
|
middlewareData,
|
|
4939
5005
|
rects,
|
|
4940
|
-
platform
|
|
5006
|
+
platform: {
|
|
5007
|
+
...platform,
|
|
5008
|
+
detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
5009
|
+
},
|
|
4941
5010
|
elements: {
|
|
4942
5011
|
reference,
|
|
4943
5012
|
floating
|
|
@@ -4982,71 +5051,6 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
4982
5051
|
};
|
|
4983
5052
|
};
|
|
4984
5053
|
|
|
4985
|
-
/**
|
|
4986
|
-
* Resolves with an object of overflow side offsets that determine how much the
|
|
4987
|
-
* element is overflowing a given clipping boundary on each side.
|
|
4988
|
-
* - positive = overflowing the boundary by that number of pixels
|
|
4989
|
-
* - negative = how many pixels left before it will overflow
|
|
4990
|
-
* - 0 = lies flush with the boundary
|
|
4991
|
-
* @see https://floating-ui.com/docs/detectOverflow
|
|
4992
|
-
*/
|
|
4993
|
-
async function detectOverflow(state, options) {
|
|
4994
|
-
var _await$platform$isEle;
|
|
4995
|
-
if (options === void 0) {
|
|
4996
|
-
options = {};
|
|
4997
|
-
}
|
|
4998
|
-
const {
|
|
4999
|
-
x,
|
|
5000
|
-
y,
|
|
5001
|
-
platform,
|
|
5002
|
-
rects,
|
|
5003
|
-
elements,
|
|
5004
|
-
strategy
|
|
5005
|
-
} = state;
|
|
5006
|
-
const {
|
|
5007
|
-
boundary = 'clippingAncestors',
|
|
5008
|
-
rootBoundary = 'viewport',
|
|
5009
|
-
elementContext = 'floating',
|
|
5010
|
-
altBoundary = false,
|
|
5011
|
-
padding = 0
|
|
5012
|
-
} = evaluate(options, state);
|
|
5013
|
-
const paddingObject = getPaddingObject(padding);
|
|
5014
|
-
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
5015
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
5016
|
-
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
5017
|
-
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
5018
|
-
boundary,
|
|
5019
|
-
rootBoundary,
|
|
5020
|
-
strategy
|
|
5021
|
-
}));
|
|
5022
|
-
const rect = elementContext === 'floating' ? {
|
|
5023
|
-
x,
|
|
5024
|
-
y,
|
|
5025
|
-
width: rects.floating.width,
|
|
5026
|
-
height: rects.floating.height
|
|
5027
|
-
} : rects.reference;
|
|
5028
|
-
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
5029
|
-
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
5030
|
-
x: 1,
|
|
5031
|
-
y: 1
|
|
5032
|
-
} : {
|
|
5033
|
-
x: 1,
|
|
5034
|
-
y: 1
|
|
5035
|
-
};
|
|
5036
|
-
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
5037
|
-
elements,
|
|
5038
|
-
rect,
|
|
5039
|
-
offsetParent,
|
|
5040
|
-
strategy
|
|
5041
|
-
}) : rect);
|
|
5042
|
-
return {
|
|
5043
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
5044
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
5045
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
5046
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
5047
|
-
};
|
|
5048
|
-
}
|
|
5049
|
-
|
|
5050
5054
|
/**
|
|
5051
5055
|
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
5052
5056
|
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
@@ -5097,7 +5101,7 @@ const flip$1 = function (options) {
|
|
|
5097
5101
|
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
5098
5102
|
}
|
|
5099
5103
|
const placements = [initialPlacement, ...fallbackPlacements];
|
|
5100
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
5104
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
5101
5105
|
const overflows = [];
|
|
5102
5106
|
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
5103
5107
|
if (checkMainAxis) {
|
|
@@ -5281,7 +5285,8 @@ const shift$1 = function (options) {
|
|
|
5281
5285
|
const {
|
|
5282
5286
|
x,
|
|
5283
5287
|
y,
|
|
5284
|
-
placement
|
|
5288
|
+
placement,
|
|
5289
|
+
platform
|
|
5285
5290
|
} = state;
|
|
5286
5291
|
const {
|
|
5287
5292
|
mainAxis: checkMainAxis = true,
|
|
@@ -5304,7 +5309,7 @@ const shift$1 = function (options) {
|
|
|
5304
5309
|
x,
|
|
5305
5310
|
y
|
|
5306
5311
|
};
|
|
5307
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
5312
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
5308
5313
|
const crossAxis = getSideAxis(getSide(placement));
|
|
5309
5314
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
5310
5315
|
let mainAxisCoord = coords[mainAxis];
|
|
@@ -5368,7 +5373,7 @@ const size$1 = function (options) {
|
|
|
5368
5373
|
apply = () => {},
|
|
5369
5374
|
...detectOverflowOptions
|
|
5370
5375
|
} = evaluate(options, state);
|
|
5371
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
5376
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
5372
5377
|
const side = getSide(placement);
|
|
5373
5378
|
const alignment = getAlignment(placement);
|
|
5374
5379
|
const isYAxis = getSideAxis(placement) === 'y';
|
|
@@ -9371,21 +9376,27 @@ const CatSelect = class {
|
|
|
9371
9376
|
options
|
|
9372
9377
|
});
|
|
9373
9378
|
});
|
|
9379
|
+
this.renderSubscription?.unsubscribe();
|
|
9380
|
+
if (connector.renderOptions$) {
|
|
9381
|
+
this.renderSubscription = connector.renderOptions$.subscribe(() => {
|
|
9382
|
+
this.rerenderOptions();
|
|
9383
|
+
});
|
|
9384
|
+
}
|
|
9374
9385
|
}
|
|
9375
9386
|
render() {
|
|
9376
9387
|
this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
|
|
9377
|
-
return (h(Host, { key: '
|
|
9388
|
+
return (h(Host, { key: '7489b4123c900ebefa06dcebde32b0a4ee52d4a3' }, h("div", { key: '9669441806e8bebc5f583957cc1a24330f06085a', class: {
|
|
9378
9389
|
'select-field': true,
|
|
9379
9390
|
'select-horizontal': this.horizontal ?? this.fallbackHorizontal ?? false,
|
|
9380
9391
|
'select-multiple': this.multiple
|
|
9381
|
-
} }, h("div", { key: '
|
|
9392
|
+
} }, h("div", { key: 'a94a2217157c125e34802b140843d2fffd63283f', class: { 'label-container': true, hidden: this.labelHidden } }, (this.hasSlottedLabel || this.label) && (h("label", { key: '557e2754156cb4484972dcccca103451db00a01e', htmlFor: `select-${this.id}-input`, part: "label" }, h("span", { key: '8d229578a218717dbe78a63e416cba36cc300c37', class: "label-wrapper" }, (this.hasSlottedLabel && h("slot", { key: 'f1700687e21b73edce905bc8325479bed8c31962', name: "label" })) || this.label, h("div", { key: '109009794bab604eca5d3f690858145ac770ea81', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (h("span", { key: '5868ecd309ab485a60439fd6743be56947f9d43e', class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (h("span", { key: '8e61a17e1d1b9f3fc584c08824b243b5f0c07c0f', class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")"))))))), h("div", { key: '9d211cd7674cda6f9bcfeebaf1252055239421ce', class: "select-container" }, h("div", { key: '878137436714dff589d4731ada14d11e443ab4a6', 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: '7a268001a9bc895aa5fd1157a57f89555ad9e868', 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: {
|
|
9382
9393
|
pill: true,
|
|
9383
9394
|
'select-no-open': true,
|
|
9384
9395
|
'select-option-active': this.state.activeSelectionIndex === i
|
|
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: '
|
|
9396
|
+
}, 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: 'dd9c6f767f5cfc9c2e3e0f37dd4bad075f1169c8', "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: 'c3ed10971f8f29d352df71a5bb577ff3f4499ccd' }), this.invalid && (h("cat-icon", { key: 'c4788a44a097252f58c43769edec339c57ed74e4', icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
|
|
9386
9397
|
!this.disabled &&
|
|
9387
9398
|
!this.state.isResolving &&
|
|
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: '
|
|
9399
|
+
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: 'a1ae4dfc03feec1a556f818ea08ba8a53b10f132', 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: '2557e44ce584d96cc8497cee27d8e6e8f6464fd9', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))), h("div", { key: '795de862359d06464591e32d3a410a8974a55028', class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (h("cat-scrollable", { key: 'b88fc1b204533e3714b8533c10b7a817fe2d4ef1', class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, h("ul", { key: 'f0fe6e0c398c7682363174ec6e9f04eaa8e25073', class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isFirstLoading
|
|
9389
9400
|
? 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 }))))
|
|
9390
9401
|
: !this.state.options.length &&
|
|
9391
9402
|
!this.tags && (h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : catI18nRegistry.t('select.empty')))))))));
|
|
@@ -9409,7 +9420,7 @@ const CatSelect = class {
|
|
|
9409
9420
|
return (h("li", { role: "option", class: "select-option", id: `select-${this.id}-option-${i}`, "aria-selected": isOptionSelected ? 'true' : 'false' }, this.multiple ? (h("cat-checkbox", { class: { 'select-option-active': this.state.activeOptionIndex === i }, checked: isOptionSelected, tabIndex: -1, labelLeft: true, onFocus: () => this.input?.focus(), onCatChange: e => {
|
|
9410
9421
|
!isTagOption ? this.toggle(item) : this.toggleTag(item);
|
|
9411
9422
|
e.stopPropagation();
|
|
9412
|
-
} }, h("span", { slot: "label", class: "select-option-inner" }, 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", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))) : (h("div", { class: {
|
|
9423
|
+
} }, h("span", { slot: "label", class: "select-option-inner" }, 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", { class: "select-option-text", part: "option" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))) : (h("div", { class: {
|
|
9413
9424
|
'select-option-inner': true,
|
|
9414
9425
|
'select-option-single': true,
|
|
9415
9426
|
'select-option-active': this.state.activeOptionIndex === i
|
|
@@ -9507,6 +9518,11 @@ const CatSelect = class {
|
|
|
9507
9518
|
});
|
|
9508
9519
|
}
|
|
9509
9520
|
}
|
|
9521
|
+
rerenderOptions() {
|
|
9522
|
+
const optionItems = this.state.options.map(o => o.item);
|
|
9523
|
+
const updatedOptions = this.toSelectItems(this.connector, optionItems);
|
|
9524
|
+
this.patchState({ options: updatedOptions });
|
|
9525
|
+
}
|
|
9510
9526
|
toggle(item) {
|
|
9511
9527
|
this.isSelected(item.item.id)
|
|
9512
9528
|
? this.deselect(item.item.id)
|
|
@@ -9528,6 +9544,8 @@ const CatSelect = class {
|
|
|
9528
9544
|
this.connector = connector ?? this.connector;
|
|
9529
9545
|
this.subscription?.unsubscribe();
|
|
9530
9546
|
this.subscription = undefined;
|
|
9547
|
+
this.renderSubscription?.unsubscribe();
|
|
9548
|
+
this.renderSubscription = undefined;
|
|
9531
9549
|
this.state = INIT_STATE;
|
|
9532
9550
|
}
|
|
9533
9551
|
onClick(event) {
|
|
@@ -25,12 +25,14 @@ export interface RenderInfo {
|
|
|
25
25
|
* @property resolve - Resolves the value of the select.
|
|
26
26
|
* @property retrieve - Retrieves the options of the select.
|
|
27
27
|
* @property render - Renders the items of the select.
|
|
28
|
+
* @property renderOptions$ - Observable that triggers re-rendering of options when emitted (doesn't support tags).
|
|
28
29
|
*/
|
|
29
30
|
export interface CatSelectConnector<T extends Item = any> {
|
|
30
31
|
customId?: (item: T) => string;
|
|
31
32
|
resolve: (ids: string[]) => Observable<T[]>;
|
|
32
33
|
retrieve: (term: string, page: number) => Observable<Page<T>>;
|
|
33
34
|
render: (item: T) => RenderInfo;
|
|
35
|
+
renderOptions$?: Observable<void>;
|
|
34
36
|
}
|
|
35
37
|
export interface CatSelectState {
|
|
36
38
|
term: string;
|
|
@@ -82,6 +84,7 @@ export declare class CatSelect {
|
|
|
82
84
|
private input?;
|
|
83
85
|
private errorMapSrc?;
|
|
84
86
|
private subscription?;
|
|
87
|
+
private renderSubscription?;
|
|
85
88
|
private term$;
|
|
86
89
|
private more$;
|
|
87
90
|
private valueChangedBySelection;
|
|
@@ -263,6 +266,7 @@ export declare class CatSelect {
|
|
|
263
266
|
private isSelected;
|
|
264
267
|
private select;
|
|
265
268
|
private deselect;
|
|
269
|
+
private rerenderOptions;
|
|
266
270
|
private toggle;
|
|
267
271
|
private clearInput;
|
|
268
272
|
private reset;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haiilo/catalyst",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.2.0",
|
|
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.
|
|
42
|
+
"@haiilo/catalyst-tokens": "14.2.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@babel/core": "7.28.5",
|