@cas-smartdesign/token-selector 0.21.3 → 0.21.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/token-selector.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement as w, unsafeCSS as T, html as
|
|
1
|
+
import { LitElement as w, unsafeCSS as T, html as m, nothing as x } from "lit";
|
|
2
2
|
import { property as d } from "lit/decorators/property.js";
|
|
3
3
|
import "@cas-smartdesign/lit-input";
|
|
4
4
|
import S from "@cas-smartdesign/field-validation-message";
|
|
@@ -110,20 +110,20 @@ const p = (u = class extends w {
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
render() {
|
|
113
|
-
return
|
|
113
|
+
return m`
|
|
114
114
|
<div class="container">
|
|
115
115
|
<slot name="before-icon"></slot>
|
|
116
116
|
${this.renderIcon()}
|
|
117
117
|
<slot name="after-icon"></slot>
|
|
118
118
|
<div class="value">${this.value}</div>
|
|
119
|
-
${this.disabled ? x :
|
|
119
|
+
${this.disabled ? x : m` <div class="delete-button-wrapper">${P($)}</div> `}
|
|
120
120
|
</div>
|
|
121
121
|
`;
|
|
122
122
|
}
|
|
123
123
|
renderIcon() {
|
|
124
124
|
if (this.icon || this.iconPlaceholder) {
|
|
125
125
|
const e = this.iconBackgroundColor != null ? `--sd-token-icon-background-color: ${this.iconBackgroundColor}` : void 0;
|
|
126
|
-
return
|
|
126
|
+
return m`
|
|
127
127
|
<div class="icon-wrapper" style="${C(e)}" role="img">
|
|
128
128
|
<div part="icon" class="icon"></div>
|
|
129
129
|
</div>
|
|
@@ -211,7 +211,7 @@ class G {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
const H = ":host{display:flex;contain:layout style}:host .additonal-content::slotted(*){align-self:end;flex-shrink:0}:host([drop]) ::slotted(*){pointer-events:none}:host(:not([readonly])) ::slotted(sd-token:last-of-type){max-width:calc(100% - 24px);margin-right:24px;margin-bottom:4px}:host ::slotted(sd-token){--sd-token-border: 1px solid transparent;margin:1px}.input[focus-visible]:focus-within ::slotted(sd-token[aria-current=true]),.container:focus-visible ::slotted(sd-token[aria-current=true]){outline:1px solid #1467ba;--sd-token-focused-border: 1px solid #fff}.input[focus-visible]:focus-within ::slotted(sd-token[aria-current=true][aria-disabled=true]:not([aria-haspopup])),.container:focus-visible ::slotted(sd-token[aria-current=true][aria-disabled=true]:not([aria-haspopup])){outline-color:#767676}.container{outline:none;display:flex;flex-wrap:wrap;gap:6px;flex-grow:1;min-width:0;margin-top:auto}.container .placeholder{color:#767676;line-height:24px;align-self:flex-end}.input{flex-grow:1;min-width:0;width:100%;margin-top:auto}.input .token-wrapper{display:flex;flex-wrap:wrap;flex:1 0 auto;width:100%;gap:6px}";
|
|
214
|
+
const H = ":host{display:flex;contain:layout style}:host .additonal-content::slotted(*){align-self:end;flex-shrink:0}:host([drop]) ::slotted(*){pointer-events:none}:host(:not([readonly])) ::slotted(sd-token:last-of-type){max-width:calc(100% - 24px);margin-right:24px;margin-bottom:4px}:host ::slotted(sd-token){--sd-token-border: 1px solid transparent;margin:1px}:host([selection-mode=multi][aria-disabled=true]){opacity:.6}:host([selection-mode=multi][aria-disabled=true]) .input[effective-disabled]{opacity:1}:host([selection-mode=multi][aria-disabled=true]) ::slotted([aria-disabled=true]){opacity:1}.input[focus-visible]:focus-within ::slotted(sd-token[aria-current=true]),.container:focus-visible ::slotted(sd-token[aria-current=true]){outline:1px solid #1467ba;--sd-token-focused-border: 1px solid #fff}.input[focus-visible]:focus-within ::slotted(sd-token[aria-current=true][aria-disabled=true]:not([aria-haspopup])),.container:focus-visible ::slotted(sd-token[aria-current=true][aria-disabled=true]:not([aria-haspopup])){outline-color:#767676}.container{outline:none;display:flex;flex-wrap:wrap;gap:6px;flex-grow:1;min-width:0;margin-top:auto}.container .placeholder{color:#767676;line-height:24px;align-self:flex-end}.input{flex-grow:1;min-width:0;width:100%;margin-top:auto}.input .token-wrapper{display:flex;flex-wrap:wrap;flex:1 0 auto;width:100%;gap:6px}";
|
|
215
215
|
class B {
|
|
216
216
|
constructor(e, t) {
|
|
217
217
|
this.tokenSelector = e;
|
|
@@ -219,7 +219,7 @@ class B {
|
|
|
219
219
|
const o = n.target;
|
|
220
220
|
if (e.removeAttribute("drag-source"), !e.contains(o)) {
|
|
221
221
|
const a = n.addedIndexes;
|
|
222
|
-
a && e.removeTokens(a.map((
|
|
222
|
+
a && e.removeTokens(a.map((v) => i.get(v)));
|
|
223
223
|
}
|
|
224
224
|
i.clear();
|
|
225
225
|
};
|
|
@@ -233,9 +233,9 @@ class B {
|
|
|
233
233
|
e.setAttribute("drag-source", ""), o.setAttribute("aria-checked", "true");
|
|
234
234
|
const a = e.querySelectorAll("[slot='items'][aria-checked='true']");
|
|
235
235
|
if (a.length > 0) {
|
|
236
|
-
const
|
|
237
|
-
if (n.dataTransfer.setData("text/sd-token-selector", JSON.stringify(
|
|
238
|
-
const g = this.createCustomDragImage(o,
|
|
236
|
+
const v = Array.from(a).filter((g) => !g.disabled).map((g, E) => (i.set(E, g.index), e.items[g.index]));
|
|
237
|
+
if (n.dataTransfer.setData("text/sd-token-selector", JSON.stringify(v)), n.dataTransfer.dropEffect = "move", n.dataTransfer.effectAllowed = "move", a.length > 1) {
|
|
238
|
+
const g = this.createCustomDragImage(o, v.length);
|
|
239
239
|
n.dataTransfer.setDragImage(g, -14, -14);
|
|
240
240
|
}
|
|
241
241
|
window.addEventListener("drop", s, { once: !0 });
|
|
@@ -388,14 +388,14 @@ const l = (h = class extends w {
|
|
|
388
388
|
e ? e.focus() : this.shadowRoot.querySelector(".container").focus();
|
|
389
389
|
}
|
|
390
390
|
render() {
|
|
391
|
-
return this.selectionMode == "remove-only" ?
|
|
391
|
+
return this.selectionMode == "remove-only" ? m`<div class="container" tabindex="${this.disabled ? -1 : 0}">
|
|
392
392
|
<slot name="items"
|
|
393
|
-
>${this.placeholder ?
|
|
393
|
+
>${this.placeholder ? m`<span part="remove-only-placeholder" class="placeholder"
|
|
394
394
|
>${this.placeholder}</span
|
|
395
395
|
>` : x}</slot
|
|
396
396
|
>
|
|
397
397
|
</div>
|
|
398
|
-
<slot class="additonal-content" name="additional-content" @focusin=${this.clearCheckedTokens}></slot>` :
|
|
398
|
+
<slot class="additonal-content" name="additional-content" @focusin=${this.clearCheckedTokens}></slot>` : m`
|
|
399
399
|
<sd-lit-input
|
|
400
400
|
class="input"
|
|
401
401
|
.extendedPrefix=${!0}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cas-smartdesign/token-selector",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.4",
|
|
4
4
|
"description": "A token-selector based on LitElement",
|
|
5
5
|
"main": "dist/token-selector-with-externals.js",
|
|
6
6
|
"module": "dist/token-selector.mjs",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"@cas-smartdesign/field-validation-message": "^5.0.2",
|
|
13
13
|
"@cas-smartdesign/image-tools": "^3.0.2",
|
|
14
14
|
"@cas-smartdesign/virtual-list": "^6.2.3",
|
|
15
|
-
"@cas-smartdesign/list-item": "^7.2.
|
|
16
|
-
"@cas-smartdesign/lit-input": "^7.2.
|
|
15
|
+
"@cas-smartdesign/list-item": "^7.2.4",
|
|
16
|
+
"@cas-smartdesign/lit-input": "^7.2.2",
|
|
17
17
|
"@cas-smartdesign/popover": "^4.1.2",
|
|
18
18
|
"@cas-smartdesign/styles": "^3.6.2"
|
|
19
19
|
},
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cas-smartdesign/button": "^5.0.2",
|
|
30
29
|
"@cas-smartdesign/license-generator": "^1.6.3",
|
|
30
|
+
"@cas-smartdesign/button": "^5.0.2",
|
|
31
31
|
"@cas-smartdesign/element-preview": "^0.2.2"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|