@orangelogic/design-system 2.116.0 → 2.117.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/library/chunks/asset-link-format.QzzboHHE.js +6 -0
- package/library/chunks/asset.CIWxY-Aw.js +469 -0
- package/library/chunks/{endpoints.DBlquU2-.js → endpoints.D4h8hp1m.js} +90 -90
- package/library/chunks/{folder-select.Bc9x2hMO.js → folder-select.CrWjwQcw.js} +2 -2
- package/library/chunks/{list-editor.on8VVRn-.js → list-editor.BfpDIsU5.js} +127 -122
- package/library/chunks/{transformation.BlQCWMfI.js → transformation.c-RS37zA.js} +1 -1
- package/library/components/asset-link-format.js +3 -3
- package/library/components/audio.js +165 -103
- package/library/components/cropper.js +1 -1
- package/library/components/folder-select.js +2 -2
- package/library/components/list-editor.js +1 -1
- package/library/components/molecules.js +2 -2
- package/library/components/select.js +107 -107
- package/library/components/types.js +23956 -24118
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/audio/audio.d.ts +32 -5
- package/library/packages/molecules/src/asset-data-display/asset-data-display.d.ts +2 -1
- package/library/packages/molecules/src/asset-picker/asset-picker.d.ts +2 -0
- package/library/packages/molecules/src/index.d.ts +0 -1
- package/library/packages/molecules/src/page-outline/page-outline.d.ts +1 -2
- package/library/packages/organisms/src/asset-transformation-dialog/asset-transformation-dialog.d.ts +4 -1
- package/library/packages/organisms/src/content-builder/configs/audio.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs-controller.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/styleController.d.ts +1 -0
- package/library/packages/services/src/api/asset/asset.d.ts +6 -3
- package/library/packages/services/src/api/endpoints.d.ts +2 -1
- package/library/packages/tools/src/fetch-asset/fetch-asset.d.ts +6 -1
- package/library/packages/tools/src/fetch-image/fetch-image.d.ts +2 -0
- package/library/packages/types/src/asset-link-format.d.ts +1 -0
- package/library/packages/types/src/content-builder.d.ts +4 -0
- package/library/react-web-component.d.ts +741 -721
- package/library/utils.js +1 -1
- package/package.json +1 -1
- package/library/chunks/asset-link-format.B0c92pSs.js +0 -6
- package/library/chunks/asset.D_xAgoOX.js +0 -460
- package/library/packages/molecules/src/timeline/timeline.d.ts +0 -71
- package/library/packages/molecules/src/timeline/timeline.styles.d.ts +0 -2
|
@@ -25,10 +25,10 @@ import U from "./popup.js";
|
|
|
25
25
|
import M from "./spinner.js";
|
|
26
26
|
import N from "./tag.js";
|
|
27
27
|
const R = (t) => !(document.createElement(t.tagName).constructor === HTMLElement || customElements.get(t.tagName.toLowerCase())), W = T`:host{display:block}:host([data-user-invalid])::part(combobox){border-color:var(--cx-input-invalid-border-color)}:host([data-user-invalid]:focus-within)::part(combobox){border-color:var(--cx-input-invalid-border-color);box-shadow:var(--cx-input-invalid-shadow)}.select{vertical-align:middle;flex:auto;width:100%;display:inline-flex;position:relative}.select::part(popup){z-index:var(--cx-z-index-dropdown)}.select[data-current-placement^=top]::part(popup){transform-origin:bottom}.select[data-current-placement^=bottom]::part(popup){transform-origin:top}.select__combobox{font-family:var(--cx-input-font-family);font-weight:var(--cx-input-font-weight);letter-spacing:var(--cx-input-letter-spacing);vertical-align:middle;cursor:pointer;transition:var(--cx-transition-fast) color, var(--cx-transition-fast) border, var(--cx-transition-fast) box-shadow, var(--cx-transition-fast) background-color;flex:1;justify-content:start;align-items:center;width:20ch;min-width:0;display:flex;position:relative;overflow:hidden}.select__display-input{width:100%;font:inherit;color:var(--cx-input-color);cursor:inherit;-webkit-appearance:none;text-overflow:ellipsis;background:0 0;border:none;margin:0;padding:0;transition:padding-top .2s ease-in-out;position:relative;overflow:hidden}:host([allow-freetext]) .input-container,:host([allow-freetext]) .select__display-input{cursor:text}:host([allow-freetext]) .select--disabled .input-container,:host([allow-freetext]) .select--disabled .select__display-input{cursor:default}.select__tags+.select__display-input{padding-top:var(--cx-spacing-2x-small)}.select__display-input--small{line-height:var(--cx-line-height-small)}.select__display-input--medium{line-height:var(--cx-line-height-medium)}.select__display-input--large{line-height:var(--cx-line-height-large)}.select__display-input--hidden{visibility:hidden;height:0;padding-top:0!important}.form-control--has-label .select__display-input{padding-top:var(--cx-spacing-x-small);padding-bottom:var(--cx-spacing-2x-small)}.select__display-input::placeholder{color:var(--cx-input-placeholder-color)}.select:not(.select--disabled):hover .select__display-input{color:var(--cx-input-color-hover)}.select:not(.select--disabled):hover .select__combobox{border-color:var(--cx-input-border-color-hover)}.select__display-input:focus{outline:none}.select__value-input{opacity:0;z-index:-1;width:100%;height:100%;margin:0;padding:0;position:absolute;top:0;left:0}.select__tags{flex-wrap:wrap;align-items:center;max-width:100%;display:flex}.form-control--has-label .select__tags{margin-top:var(--cx-spacing-x-small)}.select--small:not(.select--placeholder-visible) .select__tags,.select--medium:not(.select--placeholder-visible) .select__tags,.select--large:not(.select--placeholder-visible) .select__tags{min-height:var(--cx-line-height-medium)}.select__tags::slotted(cx-tag){cursor:pointer!important}.select--disabled .select__tags,.select--disabled .select__tags::slotted(cx-tag){cursor:default!important}.select__tag-wrapper{line-height:1}.select--standard .select__combobox{background-color:var(--cx-input-background-color);border:solid var(--cx-input-border-width) var(--cx-input-border-color)}.select--standard.select--disabled .select__combobox{background-color:var(--cx-input-background-color-disabled);border-color:var(--cx-input-border-color-disabled);color:var(--cx-input-color-disabled);opacity:.5;cursor:default;outline:none}.select--standard:not(.select--disabled).select--open .select__combobox,.select--standard:not(.select--disabled).select--focused .select__combobox{background-color:var(--cx-input-background-color-focus);border-color:var(--cx-input-border-color-focus)}.select--filled .select__combobox{background-color:var(--cx-input-filled-background-color);color:var(--cx-input-color);border:none}.select--filled:hover:not(.select--disabled) .select__combobox{background-color:var(--cx-input-filled-background-color-hover)}.select--filled.select--disabled .select__combobox{background-color:var(--cx-input-filled-background-color-disabled);opacity:.5;cursor:default}.select--filled:not(.select--disabled).select--open .select__combobox,.select--filled:not(.select--disabled).select--focused .select__combobox{background-color:var(--cx-input-filled-background-color-focus);outline:var(--cx-focus-ring)}.select--small .select__combobox{border-radius:var(--cx-input-border-radius-small);font-size:var(--cx-input-font-size-small);min-height:var(--cx-input-height-small);padding-block:0;padding-inline:var(--cx-input-spacing-small)}.form-control:not(.form-control--has-label) .select--small.select--multiple .select__combobox{padding-block:2px}.form-control:not(.form-control--has-label) .select--multiple .select__display-input{margin-top:0}.form-control:not(.form-control--has-label) .input-container{justify-content:center}.form-control:not(.form-control--has-label) .input-container .select__display-input{margin-top:0}.select--small .select__clear{margin-inline-start:var(--cx-input-spacing-small)}.select--small .select__prefix::slotted(*){margin-inline-end:var(--cx-input-spacing-small)}.select--small .select__tags{gap:2px}.select--medium .select__combobox{border-radius:var(--cx-input-border-radius-medium);font-size:var(--cx-input-font-size-small);min-height:var(--cx-input-height-medium);padding-block:0;padding-inline:var(--cx-input-spacing-medium)}.form-control:not(.form-control--has-label) .select--medium.select--multiple .select__combobox{padding-block:3px}.select--medium .select__clear{margin-inline-start:var(--cx-input-spacing-medium)}.select--medium .select__prefix::slotted(*){margin-inline-end:var(--cx-input-spacing-medium)}.select--medium .select__tags{gap:3px}.select--large .select__combobox{border-radius:var(--cx-input-border-radius-large);font-size:var(--cx-input-font-size-small);min-height:var(--cx-input-height-large);padding-block:0;padding-inline:var(--cx-input-spacing-large)}.form-control:not(.form-control--has-label) .select--large.select--multiple .select__combobox{padding-block:4px}.select--large .select__clear{margin-inline-start:var(--cx-input-spacing-large)}.select--large .select__prefix::slotted(*){margin-inline-end:var(--cx-input-spacing-large)}.select--large .select__tags{gap:4px}.select--pill.select--small .select__combobox{border-radius:var(--cx-input-height-small)}.select--pill.select--medium .select__combobox{border-radius:var(--cx-input-height-medium)}.select--pill.select--large .select__combobox{border-radius:var(--cx-input-height-large)}.select__prefix,.select__suffix{color:var(--cx-input-placeholder-color);flex:0;align-items:center;display:inline-flex}.select__clear{font-size:inherit;color:var(--cx-input-icon-color);transition:var(--cx-transition-fast) color;cursor:pointer;z-index:1;background:0 0;border:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.select__clear:hover{color:var(--cx-input-icon-color-hover)}.select__clear:focus{outline:none}.select__expand-icon{transition:var(--cx-transition-medium) rotate ease;rotate:0;font-size:var(--cx-font-size-large);flex:none;align-items:center;margin-inline-start:var(--cx-spacing-small);display:flex}.select--open .select__expand-icon{rotate:var(--cx-select-expand-icon-rotate-open,-180deg)}.select__listbox{font-family:var(--cx-font-sans);font-size:var(--cx-font-size-medium);font-weight:var(--cx-font-weight-regular);box-shadow:var(--cx-shadow-large);background:var(--cx-panel-background-color);border:solid var(--cx-panel-border-width) var(--cx-panel-border-color);border-radius:var(--cx-border-radius-large);padding-block:var(--cx-spacing-x-small);overscroll-behavior:none;max-width:var(--auto-size-available-width);max-height:var(--auto-size-available-height);padding-inline:0;display:block;position:relative;overflow:auto}.select__listbox ::slotted(cx-divider){--spacing:var(--cx-spacing-x-small)}.select__listbox ::slotted(small){font-size:var(--cx-font-size-small);color:var(--cx-color-neutral-500);padding-block:var(--cx-spacing-2x-small);padding-inline:var(--cx-spacing-small);display:block}.select__no-options{font-size:var(--cx-font-size-small);color:var(--cx-color-neutral-500);padding-block:var(--cx-spacing-2x-small);padding-inline:var(--cx-spacing-small);text-align:left;cursor:default;user-select:none;display:block}.input-container{flex-direction:column;flex:1;align-self:stretch;width:0;display:inline-flex;position:relative}.input-container__display-value{column-gap:var(--cx-spacing-small);row-gap:var(--cx-spacing-3x-small);flex-flow:wrap;width:100%;height:100%;display:flex}.form-control__label{pointer-events:none;width:fit-content;line-height:1;-webkit-transition:transform .2s ease-in-out;-moz-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;position:relative}.select--small .form-control__label{transform:translateY(calc(( var(--cx-input-height-small) + 1.25rem - var(--cx-input-font-size-small) ) / 2));margin:0}.select--medium .form-control__label{transform:translateY(calc(( var(--cx-input-height-medium) / 2 + 1rem - var(--cx-input-font-size-medium) )));margin:0}.select--large .form-control__label{transform:translateY(calc(( var(--cx-input-height-large) + 1rem - var(--cx-input-font-size-large) ) / 2));margin:0}.form-control--has-label .select--small{min-height:calc(var(--cx-input-height-small) + 1rem)}.form-control--has-label .select--medium{min-height:calc(var(--cx-input-height-medium) + 1rem)}.form-control--has-label .select--large{min-height:calc(var(--cx-input-height-large) + 1rem)}.form-control--has-label .select--focused .form-control__label,.form-control--has-label .select--placeholder-visible .form-control__label,.form-control--has-label .select:not(.select--empty) .form-control__label{transform:translateY(calc(var(--cx-spacing-2x-small) + var(--cx-spacing-3x-small)))}.select__listbox slot{flex-direction:column;display:flex}:host([data-cx-input-group__input--first]:not([data-cx-input-group__input--last])) .select__combobox{border-start-end-radius:0;border-end-end-radius:0}:host([data-cx-input-group__input--inner]) .select__combobox{border-radius:0}:host([data-cx-input-group__input--last]:not([data-cx-input-group__input--first])) .select__combobox{border-start-start-radius:0;border-end-start-radius:0}:host([data-cx-input-group__input]:not([data-cx-input-group__input--first])){margin-inline-start:calc(-1 * var(--cx-input-border-width))}:host([data-cx-input-group__input--hover]){z-index:1}:host([data-cx-input-group__input--focus]),:host([data-cx-input-group__input][checked]){z-index:2}`;
|
|
28
|
-
var H = Object.defineProperty, q = Object.getOwnPropertyDescriptor,
|
|
29
|
-
for (var
|
|
30
|
-
(c = t[r]) && (
|
|
31
|
-
return n &&
|
|
28
|
+
var H = Object.defineProperty, q = Object.getOwnPropertyDescriptor, s = (t, e, o, n) => {
|
|
29
|
+
for (var l = n > 1 ? void 0 : n ? q(e, o) : e, r = t.length - 1, c; r >= 0; r--)
|
|
30
|
+
(c = t[r]) && (l = (n ? c(e, o, l) : c(l)) || l);
|
|
31
|
+
return n && l && H(e, o, l), l;
|
|
32
32
|
};
|
|
33
33
|
let i = class extends S {
|
|
34
34
|
constructor() {
|
|
@@ -39,7 +39,7 @@ let i = class extends S {
|
|
|
39
39
|
"help-text",
|
|
40
40
|
"label"
|
|
41
41
|
), this.localize = new I(this), this.typeToSelectString = "", this.hasFocus = !1, this.displayLabel = "", this.selectedOptions = [], this.name = "", this.value = "", this.fallbackOptionValue = "", this.defaultValue = "", this.size = "medium", this.placeholder = "", this.allowFreetext = !1, this.multiple = !1, this.maxOptionsVisible = 3, this.disabled = !1, this.clearable = !1, this.open = !1, this.hoist = !1, this.noFlip = !1, this.freeWidth = !1, this.autosizePadding = 10, this.filled = !1, this.pill = !1, this.label = "", this.placement = "bottom", this.helpText = "", this.form = void 0, this.required = !1, this.useTag = !1, this.noSelectOnEnter = !1, this.noResetCurrent = !1, this.noDropdown = !1, this.loading = !1, this.getTag = (t) => {
|
|
42
|
-
const e = this.hasSlotController.test("label"), n = (this.label ? !0 : !!e) ? this.size === "large" ? "medium" : "small" : this.size,
|
|
42
|
+
const e = this.hasSlotController.test("label"), n = (this.label ? !0 : !!e) ? this.size === "large" ? "medium" : "small" : this.size, l = (r) => {
|
|
43
43
|
this.handleTagRemove(r, t);
|
|
44
44
|
};
|
|
45
45
|
return u`<cx-tag part="tag" exportparts="
|
|
@@ -47,7 +47,7 @@ let i = class extends S {
|
|
|
47
47
|
content:tag__content,
|
|
48
48
|
remove-button:tag__remove-button,
|
|
49
49
|
remove-button__base:tag__remove-button__base
|
|
50
|
-
" ?pill=${this.pill} size=${n} ?removable=${this.multiple} @cx-remove=${
|
|
50
|
+
" ?pill=${this.pill} size=${n} ?removable=${this.multiple} @cx-remove=${l}><cx-line-clamp lines="1">${this.getOptionLabel(t)}</cx-line-clamp></cx-tag>`;
|
|
51
51
|
}, this.inputBehavior = "filter", this.getOptionValue = (t) => !t || !(t instanceof d) ? "" : t.value, this.getOptionLabel = (t) => !t || !(t instanceof d) ? "" : t.getTextLabel(), this.getOptionSelected = (t) => {
|
|
52
52
|
if (!(!t || !(t instanceof d)))
|
|
53
53
|
return t.selected;
|
|
@@ -58,8 +58,8 @@ let i = class extends S {
|
|
|
58
58
|
const e = t.composedPath();
|
|
59
59
|
this && !e.includes(this) && !this.stayOpenOnSelect && this.hide();
|
|
60
60
|
}, this.handleDocumentKeyDown = (t) => {
|
|
61
|
-
const e = t.target,
|
|
62
|
-
if (!(
|
|
61
|
+
const e = t.target, o = e.closest(".select__clear") !== null, n = e.closest("cx-icon-button") !== null;
|
|
62
|
+
if (!(o || n)) {
|
|
63
63
|
if (t.key === "Escape" && this.open && !this.closeWatcher) {
|
|
64
64
|
(this.shouldShowNoOptionsMessage || this.getVisibleOptions().length > 0) && t.stopPropagation(), t.preventDefault(), this.hide(), this.displayInput.focus({ preventScroll: !0 });
|
|
65
65
|
return;
|
|
@@ -95,11 +95,11 @@ let i = class extends S {
|
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
if (["ArrowUp", "ArrowDown", "Home", "End"].includes(t.key)) {
|
|
98
|
-
const
|
|
98
|
+
const l = this.getAllOptions().filter((h) => this.inputBehavior === "filter" ? !h.hidden : !0), r = this.currentOption ? l.indexOf(this.currentOption) : -1;
|
|
99
99
|
let c = Math.max(0, r);
|
|
100
100
|
if (t.preventDefault(), !this.open && (this.show(), this.currentOption))
|
|
101
101
|
return;
|
|
102
|
-
t.key === "ArrowDown" ? (c = r + 1, c >
|
|
102
|
+
t.key === "ArrowDown" ? (c = r + 1, c > l.length - 1 && (c = 0)) : t.key === "ArrowUp" ? (c = r - 1, c < 0 && (c = l.length - 1)) : t.key === "Home" ? c = 0 : t.key === "End" && (c = l.length - 1), this.setCurrentOption(l[c]);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}, this.handleDocumentMouseDown = (t) => {
|
|
@@ -215,7 +215,7 @@ let i = class extends S {
|
|
|
215
215
|
handleInput(t) {
|
|
216
216
|
if (!this.open && (this.show(), t.data === " "))
|
|
217
217
|
return;
|
|
218
|
-
const e = t.target,
|
|
218
|
+
const e = t.target, o = [
|
|
219
219
|
"ArrowUp",
|
|
220
220
|
"ArrowDown",
|
|
221
221
|
"Enter",
|
|
@@ -224,7 +224,7 @@ let i = class extends S {
|
|
|
224
224
|
"Home",
|
|
225
225
|
"End"
|
|
226
226
|
];
|
|
227
|
-
if (!(t.data &&
|
|
227
|
+
if (!(t.data && o.includes(t.data)))
|
|
228
228
|
switch (this.typeToSelectString = e.value.toLowerCase(), this.displayLabel = e.value, this.emit("cx-input"), this.inputBehavior) {
|
|
229
229
|
case "filter": {
|
|
230
230
|
this.filterOptionsByInput();
|
|
@@ -236,14 +236,14 @@ let i = class extends S {
|
|
|
236
236
|
}
|
|
237
237
|
handleComboboxMouseDown(t) {
|
|
238
238
|
const e = t.composedPath();
|
|
239
|
-
let
|
|
240
|
-
e.forEach((
|
|
241
|
-
if (
|
|
239
|
+
let o = !1, n = !1;
|
|
240
|
+
e.forEach((l) => {
|
|
241
|
+
if (l instanceof HTMLElement && l.classList.contains("select__expand-icon")) {
|
|
242
242
|
n = !0;
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
-
|
|
246
|
-
}), !(this.disabled ||
|
|
245
|
+
l instanceof HTMLElement && l.tagName.toLowerCase() === "cx-icon-button" && (o = !0);
|
|
246
|
+
}), !(this.disabled || o) && (n || this.inputBehavior !== "filter" || !this.open || !this.multiple && !this.useTag ? (this.allowDefaultMouseDown || this.allowFreetext ? requestAnimationFrame(() => {
|
|
247
247
|
this.displayInput.focus({ preventScroll: !0 });
|
|
248
248
|
}) : (t.preventDefault(), this.displayInput.focus({ preventScroll: !0 })), this.open = !this.open) : (this.allowFreetext || t.preventDefault(), this.displayInput.focus({ preventScroll: !0 })));
|
|
249
249
|
}
|
|
@@ -259,36 +259,36 @@ let i = class extends S {
|
|
|
259
259
|
t.stopPropagation(), t.preventDefault();
|
|
260
260
|
}
|
|
261
261
|
handleOptionClick(t) {
|
|
262
|
-
const
|
|
262
|
+
const o = t.target.closest('[role="option"], cx-option'), n = this.value, l = t.composedPath().some(
|
|
263
263
|
(c) => c?.classList?.contains("tree-item__expand-button")
|
|
264
264
|
), r = t.composedPath().some(
|
|
265
265
|
(c) => c?.classList?.contains("tree-item__actions")
|
|
266
266
|
);
|
|
267
|
-
|
|
267
|
+
o && !this.getOptionDisabled(o) && !l && !r && (this.multiple ? this.toggleOptionSelection(o) : this.setSelectedOptions(o), this.updateComplete.then(
|
|
268
268
|
() => this.displayInput.focus({ preventScroll: !0 })
|
|
269
269
|
), (this.value !== n || this.forceOnChange) && this.updateComplete.then(() => {
|
|
270
270
|
this.emit("cx-input"), this.emit("cx-change");
|
|
271
271
|
}), !this.multiple && !this.stayOpenOnSelect && (this.hide(), this.displayInput.focus({ preventScroll: !0 })));
|
|
272
272
|
}
|
|
273
273
|
handleDefaultSlotChange() {
|
|
274
|
-
const t = this.getAllOptions(), e = Array.isArray(this.value) ? this.value : [this.value],
|
|
274
|
+
const t = this.getAllOptions(), e = Array.isArray(this.value) ? this.value : [this.value], o = [];
|
|
275
275
|
for (const r of t) {
|
|
276
276
|
const c = this.getOptionValue(r);
|
|
277
277
|
if (!c && !(r instanceof d))
|
|
278
278
|
return;
|
|
279
|
-
|
|
279
|
+
o.push(c);
|
|
280
280
|
const h = r.tagName.toLowerCase();
|
|
281
281
|
if (!R(r) && !customElements.get(h)) {
|
|
282
282
|
customElements.whenDefined(h).then(() => this.handleDefaultSlotChange());
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
t.forEach((r) =>
|
|
287
|
-
const { options: n, preserveValue:
|
|
286
|
+
t.forEach((r) => o.push(this.getOptionValue(r)));
|
|
287
|
+
const { options: n, preserveValue: l } = this.getOptionsForValue(
|
|
288
288
|
e,
|
|
289
289
|
t
|
|
290
290
|
);
|
|
291
|
-
this.setSelectedOptions(n,
|
|
291
|
+
this.setSelectedOptions(n, l ? this.value : void 0);
|
|
292
292
|
}
|
|
293
293
|
handleTagRemove(t, e) {
|
|
294
294
|
t.stopPropagation(), this.disabled || (this.toggleOptionSelection(e, !1), this.updateComplete.then(() => {
|
|
@@ -320,20 +320,20 @@ let i = class extends S {
|
|
|
320
320
|
* when unmatched values exist and `fallbackOptionValue` is configured.
|
|
321
321
|
*/
|
|
322
322
|
getOptionsForValue(t, e = this.getAllOptions()) {
|
|
323
|
-
const
|
|
323
|
+
const o = [], n = this.fallbackOptionValue ? e.find(
|
|
324
324
|
(r) => this.getOptionValue(r) === this.fallbackOptionValue
|
|
325
325
|
) : void 0;
|
|
326
|
-
let
|
|
326
|
+
let l = !1;
|
|
327
327
|
return t.forEach((r) => {
|
|
328
328
|
if (r === "")
|
|
329
329
|
return;
|
|
330
330
|
const c = e.find(
|
|
331
331
|
(h) => this.getOptionValue(h) === r
|
|
332
332
|
);
|
|
333
|
-
c ?
|
|
334
|
-
}),
|
|
335
|
-
options:
|
|
336
|
-
preserveValue:
|
|
333
|
+
c ? o.push(c) : l = !0;
|
|
334
|
+
}), l && n && o.push(n), {
|
|
335
|
+
options: o,
|
|
336
|
+
preserveValue: l && !!n
|
|
337
337
|
};
|
|
338
338
|
}
|
|
339
339
|
/**
|
|
@@ -341,43 +341,43 @@ let i = class extends S {
|
|
|
341
341
|
* option may be "current" at a time.
|
|
342
342
|
*/
|
|
343
343
|
setCurrentOption(t) {
|
|
344
|
-
this.getAllOptions().forEach((
|
|
345
|
-
this.setOptionCurrent(
|
|
344
|
+
this.getAllOptions().forEach((o) => {
|
|
345
|
+
this.setOptionCurrent(o, !1), o.tabIndex = -1;
|
|
346
346
|
}), t && (this.currentOption = t, this.setOptionCurrent(t, !0), t.tabIndex = 0, t.scrollIntoView({ block: "nearest" }));
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
349
|
* Sets the selected option(s)
|
|
350
350
|
*/
|
|
351
351
|
setSelectedOptions(t, e) {
|
|
352
|
-
const
|
|
353
|
-
|
|
352
|
+
const o = this.getAllOptions(), n = Array.isArray(t) ? t : [t];
|
|
353
|
+
o.forEach((l) => this.setOptionSelected(l, !1)), n.length && n.forEach((l) => this.setOptionSelected(l, !0)), this.selectionChanged(e, n);
|
|
354
354
|
}
|
|
355
355
|
/**
|
|
356
356
|
* Toggles an option's selected state
|
|
357
357
|
*/
|
|
358
358
|
toggleOptionSelection(t, e) {
|
|
359
|
-
this.setOptionSelected(t, e)
|
|
359
|
+
this.setOptionSelected(t, e);
|
|
360
|
+
const o = this.getOptionSelected(t), n = new Set(this.selectedOptions);
|
|
361
|
+
o ? n.add(t) : n.delete(t), this.selectionChanged(void 0, [...n]);
|
|
360
362
|
}
|
|
361
363
|
/**
|
|
362
364
|
* This method must be called whenever the selection changes. It will update the selected options cache, the current
|
|
363
365
|
* value, and the display value
|
|
364
366
|
*/
|
|
365
|
-
selectionChanged(t) {
|
|
366
|
-
this.selectedOptions = this.getAllOptions().filter(
|
|
367
|
-
(e) => this.getOptionSelected(e)
|
|
368
|
-
), this.multiple ? (this.value = t ?? this.selectedOptions.map((e) => this.getOptionValue(e)), this.displayLabel = "") : (this.value = t ?? this.getOptionValue(this.selectedOptions[0]) ?? "", this.displayLabel = this.getOptionLabel(this.selectedOptions[0]) ?? ""), this.updateComplete.then(() => {
|
|
367
|
+
selectionChanged(t, e) {
|
|
368
|
+
this.selectedOptions = e ?? this.getAllOptions().filter((o) => this.getOptionSelected(o)), this.multiple ? (this.value = t ?? this.selectedOptions.map((o) => this.getOptionValue(o)), this.displayLabel = "") : (this.value = t ?? this.getOptionValue(this.selectedOptions[0]) ?? "", this.displayLabel = this.getOptionLabel(this.selectedOptions[0]) ?? ""), this.updateComplete.then(() => {
|
|
369
369
|
this.formControlController.updateValidity();
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
get tags() {
|
|
373
|
-
const t = this.hasSlotController.test("label"),
|
|
374
|
-
return this.selectedOptions.map((n,
|
|
375
|
-
if (
|
|
376
|
-
const r = this.getTag(n,
|
|
373
|
+
const t = this.hasSlotController.test("label"), o = (this.label ? !0 : !!t) ? this.size === "large" ? "medium" : "small" : this.size;
|
|
374
|
+
return this.selectedOptions.map((n, l) => {
|
|
375
|
+
if (l < this.maxOptionsVisible || this.maxOptionsVisible <= 0) {
|
|
376
|
+
const r = this.getTag(n, l);
|
|
377
377
|
return u`${typeof r == "string" ? A(r) : r}`;
|
|
378
|
-
} else if (
|
|
379
|
-
return u`<cx-tag ?pill=${this.pill} size=${
|
|
380
|
-
+${this.selectedOptions.length -
|
|
378
|
+
} else if (l === this.maxOptionsVisible)
|
|
379
|
+
return u`<cx-tag ?pill=${this.pill} size=${o}>
|
|
380
|
+
+${this.selectedOptions.length - l}</cx-tag>`;
|
|
381
381
|
return B;
|
|
382
382
|
});
|
|
383
383
|
}
|
|
@@ -388,11 +388,11 @@ let i = class extends S {
|
|
|
388
388
|
this.disabled && (this.open = !1, this.handleOpenChange());
|
|
389
389
|
}
|
|
390
390
|
handleValueChange() {
|
|
391
|
-
const t = this.getAllOptions(), e = Array.isArray(this.value) ? this.value : [this.value], { options:
|
|
391
|
+
const t = this.getAllOptions(), e = Array.isArray(this.value) ? this.value : [this.value], { options: o, preserveValue: n } = this.getOptionsForValue(
|
|
392
392
|
e,
|
|
393
393
|
t
|
|
394
394
|
);
|
|
395
|
-
this.setSelectedOptions(
|
|
395
|
+
this.setSelectedOptions(o, n ? this.value : void 0);
|
|
396
396
|
}
|
|
397
397
|
async handleNoDropdownChange() {
|
|
398
398
|
await this.updateComplete, this.noDropdown ? this.open = !1 : this.handleOpenChange();
|
|
@@ -471,11 +471,11 @@ let i = class extends S {
|
|
|
471
471
|
this.displayInput.blur();
|
|
472
472
|
}
|
|
473
473
|
render() {
|
|
474
|
-
const t = this.hasSlotController.test("label"), e = this.hasSlotController.test("help-text"),
|
|
474
|
+
const t = this.hasSlotController.test("label"), e = this.hasSlotController.test("help-text"), o = this.label ? !0 : !!t, n = this.helpText ? !0 : !!e, l = this.clearable && !this.disabled && (this.displayLabel.length > 0 || this.selectedOptions.length > 0), r = this.placeholder && this.value.length === 0 && this.displayLabel.length === 0, c = this.value.length === 0 && this.displayLabel.length === 0 || (this.multiple || this.useTag) && this.tags.length === 0, h = (this.multiple || this.useTag) && this.selectedOptions.length > 0;
|
|
475
475
|
return u`<div part="form-control" class=${b({
|
|
476
476
|
"form-control": !0,
|
|
477
477
|
"form-control--has-help-text": n,
|
|
478
|
-
"form-control--has-label":
|
|
478
|
+
"form-control--has-label": o,
|
|
479
479
|
"form-control--large": this.size === "large",
|
|
480
480
|
"form-control--medium": this.size === "medium",
|
|
481
481
|
"form-control--small": this.size === "small"
|
|
@@ -495,7 +495,7 @@ let i = class extends S {
|
|
|
495
495
|
"select--small": this.size === "small",
|
|
496
496
|
"select--standard": !0,
|
|
497
497
|
"select--top": this.placement === "top"
|
|
498
|
-
})} placement=${this.placement} strategy=${this.hoist ? "overlay" : "absolute"} ?flip=${!this.noFlip} shift sync=${this.freeWidth ? void 0 : "width"} auto-size="both" auto-size-padding=${this.autosizePadding} flip-padding="10"><div part="combobox" class="select__combobox" slot="anchor" @keydown=${this.handleComboboxKeyDown} @mousedown=${this.handleComboboxMouseDown}><slot part="prefix" name="prefix" class="select__prefix"></slot><span class="input-container" @click=${this.handleFocus}><label id="label" part="form-control-label" class="form-control__label" aria-hidden=${
|
|
498
|
+
})} placement=${this.placement} strategy=${this.hoist ? "overlay" : "absolute"} ?flip=${!this.noFlip} shift sync=${this.freeWidth ? void 0 : "width"} auto-size="both" auto-size-padding=${this.autosizePadding} flip-padding="10"><div part="combobox" class="select__combobox" slot="anchor" @keydown=${this.handleComboboxKeyDown} @mousedown=${this.handleComboboxMouseDown}><slot part="prefix" name="prefix" class="select__prefix"></slot><span class="input-container" @click=${this.handleFocus}><label id="label" part="form-control-label" class="form-control__label" aria-hidden=${o ? "false" : "true"}><slot name="label">${this.label}</slot></label>${f(
|
|
499
499
|
h,
|
|
500
500
|
() => u`<div part="tags" class="select__tags" @cx-remove=${this.handleTagRemove}>${this.tags}</div>`
|
|
501
501
|
)}<input part="display-input" class=${b({
|
|
@@ -504,12 +504,12 @@ let i = class extends S {
|
|
|
504
504
|
"select__display-input--large": this.size === "large",
|
|
505
505
|
"select__display-input--medium": this.size === "medium",
|
|
506
506
|
"select__display-input--small": this.size === "small"
|
|
507
|
-
})} type="text" placeholder=${this.placeholder} .disabled=${this.disabled} ?readonly=${this.inputBehavior === "none" && !this.allowFreetext} .value=${this.displayLabel} autocomplete="off" spellcheck="false" autocapitalize="off" aria-controls="listbox" aria-expanded=${this.open ? "true" : "false"} aria-haspopup="listbox" aria-label=${
|
|
507
|
+
})} type="text" placeholder=${this.placeholder} .disabled=${this.disabled} ?readonly=${this.inputBehavior === "none" && !this.allowFreetext} .value=${this.displayLabel} autocomplete="off" spellcheck="false" autocapitalize="off" aria-controls="listbox" aria-expanded=${this.open ? "true" : "false"} aria-haspopup="listbox" aria-label=${o ? void 0 : this.dataset.label} aria-labelledby="label" aria-disabled=${this.disabled ? "true" : "false"} aria-describedby="help-text" role="combobox" tabindex="0" @input=${this.handleInput} @blur=${this.handleBlur}></span><input class="select__value-input" type="text" ?disabled=${this.disabled} ?required=${this.required} .value=${Array.isArray(this.value) ? this.value.join(", ") : this.value} tabindex="-1" aria-hidden="true" @focus=${this.focus} @invalid=${this.handleInvalid}>${f(
|
|
508
508
|
this.loading,
|
|
509
509
|
() => u`<cx-spinner part="spinner" role="status" aria-live="polite"></cx-spinner>`
|
|
510
510
|
)}
|
|
511
511
|
${f(
|
|
512
|
-
|
|
512
|
+
l,
|
|
513
513
|
() => u`<button part="clear-button" class="select__clear" type="button" aria-label=${this.localize.term("clearEntry")} @mousedown=${this.handleClearMouseDown} @click=${this.handleClearClick} tabindex="-1"><slot name="clear-icon"><cx-icon name="cancel"></cx-icon></slot></button>`
|
|
514
514
|
)}<slot name="suffix" part="suffix" class="select__suffix"></slot><slot name="expand-icon" part="expand-icon" class="select__expand-icon"><cx-icon name="arrow_drop_down"></cx-icon></slot></div><div id="listbox" role="listbox" aria-expanded=${this.open ? "true" : "false"} ?hidden=${!this.open || this.disabled} aria-multiselectable=${this.multiple ? "true" : "false"} aria-labelledby="label" part="listbox" class="select__listbox" tabindex="-1" @mouseup=${this.handleOptionClick} @slotchange=${this.handleDefaultSlotChange}><slot></slot>${f(
|
|
515
515
|
this.shouldShowNoOptionsMessage,
|
|
@@ -530,37 +530,37 @@ i.dependencies = {
|
|
|
530
530
|
"cx-tag": N,
|
|
531
531
|
"cx-typography": C
|
|
532
532
|
};
|
|
533
|
-
|
|
533
|
+
s([
|
|
534
534
|
m(".select")
|
|
535
535
|
], i.prototype, "popup", 2);
|
|
536
|
-
|
|
536
|
+
s([
|
|
537
537
|
m(".select__combobox")
|
|
538
538
|
], i.prototype, "combobox", 2);
|
|
539
|
-
|
|
539
|
+
s([
|
|
540
540
|
m(".select__display-input")
|
|
541
541
|
], i.prototype, "displayInput", 2);
|
|
542
|
-
|
|
542
|
+
s([
|
|
543
543
|
m(".select__value-input")
|
|
544
544
|
], i.prototype, "valueInput", 2);
|
|
545
|
-
|
|
545
|
+
s([
|
|
546
546
|
m(".select__listbox")
|
|
547
547
|
], i.prototype, "listbox", 2);
|
|
548
|
-
|
|
548
|
+
s([
|
|
549
549
|
g()
|
|
550
550
|
], i.prototype, "hasFocus", 2);
|
|
551
|
-
|
|
551
|
+
s([
|
|
552
552
|
g()
|
|
553
553
|
], i.prototype, "displayLabel", 2);
|
|
554
|
-
|
|
554
|
+
s([
|
|
555
555
|
g()
|
|
556
556
|
], i.prototype, "currentOption", 2);
|
|
557
|
-
|
|
557
|
+
s([
|
|
558
558
|
g()
|
|
559
559
|
], i.prototype, "selectedOptions", 2);
|
|
560
|
-
|
|
560
|
+
s([
|
|
561
561
|
a()
|
|
562
562
|
], i.prototype, "name", 2);
|
|
563
|
-
|
|
563
|
+
s([
|
|
564
564
|
a({
|
|
565
565
|
converter: {
|
|
566
566
|
fromAttribute: (t) => t.split(" "),
|
|
@@ -568,153 +568,153 @@ o([
|
|
|
568
568
|
}
|
|
569
569
|
})
|
|
570
570
|
], i.prototype, "value", 2);
|
|
571
|
-
|
|
571
|
+
s([
|
|
572
572
|
a({ attribute: "fallback-option-value", type: String })
|
|
573
573
|
], i.prototype, "fallbackOptionValue", 2);
|
|
574
|
-
|
|
574
|
+
s([
|
|
575
575
|
$()
|
|
576
576
|
], i.prototype, "defaultValue", 2);
|
|
577
|
-
|
|
577
|
+
s([
|
|
578
578
|
a({ reflect: !0 })
|
|
579
579
|
], i.prototype, "size", 2);
|
|
580
|
-
|
|
580
|
+
s([
|
|
581
581
|
a()
|
|
582
582
|
], i.prototype, "placeholder", 2);
|
|
583
|
-
|
|
583
|
+
s([
|
|
584
584
|
a({ attribute: "allow-freetext", reflect: !0, type: Boolean })
|
|
585
585
|
], i.prototype, "allowFreetext", 2);
|
|
586
|
-
|
|
586
|
+
s([
|
|
587
587
|
a({ reflect: !0, type: Boolean })
|
|
588
588
|
], i.prototype, "multiple", 2);
|
|
589
|
-
|
|
589
|
+
s([
|
|
590
590
|
a({ attribute: "max-options-visible", type: Number })
|
|
591
591
|
], i.prototype, "maxOptionsVisible", 2);
|
|
592
|
-
|
|
592
|
+
s([
|
|
593
593
|
a({ reflect: !0, type: Boolean })
|
|
594
594
|
], i.prototype, "disabled", 2);
|
|
595
|
-
|
|
595
|
+
s([
|
|
596
596
|
a({ type: Boolean })
|
|
597
597
|
], i.prototype, "clearable", 2);
|
|
598
|
-
|
|
598
|
+
s([
|
|
599
599
|
a({ reflect: !0, type: Boolean })
|
|
600
600
|
], i.prototype, "open", 2);
|
|
601
|
-
|
|
601
|
+
s([
|
|
602
602
|
a({ type: Boolean })
|
|
603
603
|
], i.prototype, "hoist", 2);
|
|
604
|
-
|
|
604
|
+
s([
|
|
605
605
|
a({ attribute: "no-flip", reflect: !0, type: Boolean })
|
|
606
606
|
], i.prototype, "noFlip", 2);
|
|
607
|
-
|
|
607
|
+
s([
|
|
608
608
|
a({ attribute: "sync-element" })
|
|
609
609
|
], i.prototype, "syncElement", 2);
|
|
610
|
-
|
|
610
|
+
s([
|
|
611
611
|
a({ attribute: "free-width", reflect: !0, type: Boolean })
|
|
612
612
|
], i.prototype, "freeWidth", 2);
|
|
613
|
-
|
|
613
|
+
s([
|
|
614
614
|
a({ attribute: "auto-size-padding", type: Number })
|
|
615
615
|
], i.prototype, "autosizePadding", 2);
|
|
616
|
-
|
|
616
|
+
s([
|
|
617
617
|
a({ reflect: !0, type: Boolean })
|
|
618
618
|
], i.prototype, "filled", 2);
|
|
619
|
-
|
|
619
|
+
s([
|
|
620
620
|
a({ reflect: !0, type: Boolean })
|
|
621
621
|
], i.prototype, "pill", 2);
|
|
622
|
-
|
|
622
|
+
s([
|
|
623
623
|
a()
|
|
624
624
|
], i.prototype, "label", 2);
|
|
625
|
-
|
|
625
|
+
s([
|
|
626
626
|
a({ reflect: !0 })
|
|
627
627
|
], i.prototype, "placement", 2);
|
|
628
|
-
|
|
628
|
+
s([
|
|
629
629
|
a({ attribute: "help-text" })
|
|
630
630
|
], i.prototype, "helpText", 2);
|
|
631
|
-
|
|
631
|
+
s([
|
|
632
632
|
a({ reflect: !1 })
|
|
633
633
|
], i.prototype, "form", 2);
|
|
634
|
-
|
|
634
|
+
s([
|
|
635
635
|
a({ reflect: !0, type: Boolean })
|
|
636
636
|
], i.prototype, "required", 2);
|
|
637
|
-
|
|
637
|
+
s([
|
|
638
638
|
a({ attribute: "use-tag", reflect: !0, type: Boolean })
|
|
639
639
|
], i.prototype, "useTag", 2);
|
|
640
|
-
|
|
640
|
+
s([
|
|
641
641
|
a({
|
|
642
642
|
attribute: "no-select-on-enter",
|
|
643
643
|
reflect: !0,
|
|
644
644
|
type: Boolean
|
|
645
645
|
})
|
|
646
646
|
], i.prototype, "noSelectOnEnter", 2);
|
|
647
|
-
|
|
647
|
+
s([
|
|
648
648
|
a({
|
|
649
649
|
attribute: "no-reset-current",
|
|
650
650
|
reflect: !0,
|
|
651
651
|
type: Boolean
|
|
652
652
|
})
|
|
653
653
|
], i.prototype, "noResetCurrent", 2);
|
|
654
|
-
|
|
654
|
+
s([
|
|
655
655
|
a({
|
|
656
656
|
attribute: "no-dropdown",
|
|
657
657
|
reflect: !0,
|
|
658
658
|
type: Boolean
|
|
659
659
|
})
|
|
660
660
|
], i.prototype, "noDropdown", 2);
|
|
661
|
-
|
|
661
|
+
s([
|
|
662
662
|
a({
|
|
663
663
|
attribute: "loading",
|
|
664
664
|
reflect: !0,
|
|
665
665
|
type: Boolean
|
|
666
666
|
})
|
|
667
667
|
], i.prototype, "loading", 2);
|
|
668
|
-
|
|
668
|
+
s([
|
|
669
669
|
a({ attribute: "get-tag", type: Function })
|
|
670
670
|
], i.prototype, "getTag", 2);
|
|
671
|
-
|
|
671
|
+
s([
|
|
672
672
|
a({ attribute: "input-behavior" })
|
|
673
673
|
], i.prototype, "inputBehavior", 2);
|
|
674
|
-
|
|
674
|
+
s([
|
|
675
675
|
a({ attribute: "get-option-value", type: Function })
|
|
676
676
|
], i.prototype, "getOptionValue", 2);
|
|
677
|
-
|
|
677
|
+
s([
|
|
678
678
|
a({ attribute: "get-option-label", type: Function })
|
|
679
679
|
], i.prototype, "getOptionLabel", 2);
|
|
680
|
-
|
|
680
|
+
s([
|
|
681
681
|
a({ attribute: "get-option-selected", type: Function })
|
|
682
682
|
], i.prototype, "getOptionSelected", 2);
|
|
683
|
-
|
|
683
|
+
s([
|
|
684
684
|
a({ attribute: "get-option-disabled", type: Function })
|
|
685
685
|
], i.prototype, "getOptionDisabled", 2);
|
|
686
|
-
|
|
686
|
+
s([
|
|
687
687
|
a({ attribute: "stay-open-on-select", type: Boolean })
|
|
688
688
|
], i.prototype, "stayOpenOnSelect", 2);
|
|
689
|
-
|
|
689
|
+
s([
|
|
690
690
|
a({ attribute: "force-on-change", type: Boolean })
|
|
691
691
|
], i.prototype, "forceOnChange", 2);
|
|
692
|
-
|
|
692
|
+
s([
|
|
693
693
|
a({ attribute: "allow-default-mouse-down", type: Boolean })
|
|
694
694
|
], i.prototype, "allowDefaultMouseDown", 2);
|
|
695
|
-
|
|
695
|
+
s([
|
|
696
696
|
a({ attribute: "no-option-text", type: String })
|
|
697
697
|
], i.prototype, "noOptionText", 2);
|
|
698
|
-
|
|
698
|
+
s([
|
|
699
699
|
p("getOptionValue", { waitUntilFirstUpdate: !0 }),
|
|
700
700
|
p("getOptionLabel", { waitUntilFirstUpdate: !0 }),
|
|
701
701
|
p("getOptionSelected", { waitUntilFirstUpdate: !0 }),
|
|
702
702
|
p("getOptionDisabled", { waitUntilFirstUpdate: !0 }),
|
|
703
703
|
p("fallbackOptionValue", { waitUntilFirstUpdate: !0 })
|
|
704
704
|
], i.prototype, "handleDefaultSlotChange", 1);
|
|
705
|
-
|
|
705
|
+
s([
|
|
706
706
|
p("disabled", { waitUntilFirstUpdate: !0 })
|
|
707
707
|
], i.prototype, "handleDisabledChange", 1);
|
|
708
|
-
|
|
708
|
+
s([
|
|
709
709
|
p("value", { waitUntilFirstUpdate: !0 })
|
|
710
710
|
], i.prototype, "handleValueChange", 1);
|
|
711
|
-
|
|
711
|
+
s([
|
|
712
712
|
p("noDropdown", { waitUntilFirstUpdate: !0 })
|
|
713
713
|
], i.prototype, "handleNoDropdownChange", 1);
|
|
714
|
-
|
|
714
|
+
s([
|
|
715
715
|
p("open", { waitUntilFirstUpdate: !0 })
|
|
716
716
|
], i.prototype, "handleOpenChange", 1);
|
|
717
|
-
i =
|
|
717
|
+
i = s([
|
|
718
718
|
z("cx-select")
|
|
719
719
|
], i);
|
|
720
720
|
O("select.show", {
|