@design.estate/dees-catalog 24.4.0 → 24.5.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_bundle/bundle.js +60 -174
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-7CM7S6EQ.js → chunk-LRGVCS7F.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-R6EBIDCM.js → chunk-PKH6IGY6.js} +347 -4
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-R6EBIDCM.js.map → chunk-PKH6IGY6.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-Z3DSEMNI.js → dees-modal-ORXOZADW.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-KPB3RVGL.js → dees-workspace-terminal-MUU2HDU3.js} +3 -3
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.d.ts +8 -1
- package/dist_ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.demo.js +7 -1
- package/dist_ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.js +18 -5
- package/dist_ts_web/elements/00group-input/dees-input-tags/dees-input-tags.d.ts +4 -13
- package/dist_ts_web/elements/00group-input/dees-input-tags/dees-input-tags.js +29 -174
- package/dist_ts_web/elements/00group-input/dees-input-text/dees-input-text.d.ts +41 -0
- package/dist_ts_web/elements/00group-input/dees-input-text/dees-input-text.demo.js +16 -1
- package/dist_ts_web/elements/00group-input/dees-input-text/dees-input-text.js +103 -3
- package/dist_ts_web/elements/00group-input/suggestion-list.d.ts +102 -0
- package/dist_ts_web/elements/00group-input/suggestion-list.js +300 -0
- package/package.json +1 -1
- package/readme.md +27 -1
- package/scripts/token-baseline.json +1 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.demo.ts +6 -0
- package/ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.ts +24 -7
- package/ts_web/elements/00group-input/dees-input-tags/dees-input-tags.ts +27 -171
- package/ts_web/elements/00group-input/dees-input-text/dees-input-text.demo.ts +17 -0
- package/ts_web/elements/00group-input/dees-input-text/dees-input-text.ts +106 -1
- package/ts_web/elements/00group-input/suggestion-list.ts +323 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-7CM7S6EQ.js.map → chunk-LRGVCS7F.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-Z3DSEMNI.js.map → dees-modal-ORXOZADW.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-KPB3RVGL.js.map → dees-workspace-terminal-MUU2HDU3.js.map} +0 -0
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
terminalFontFamily,
|
|
27
27
|
terminalTheme,
|
|
28
28
|
themeDefaultStyles
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-PKH6IGY6.js";
|
|
30
30
|
import {
|
|
31
31
|
dcMessages,
|
|
32
32
|
dist_ts_exports2 as dist_ts_exports
|
|
@@ -5817,4 +5817,4 @@ export {
|
|
|
5817
5817
|
WebContainerEnvironment,
|
|
5818
5818
|
DeesWorkspaceTerminal
|
|
5819
5819
|
};
|
|
5820
|
-
//# sourceMappingURL=chunk-
|
|
5820
|
+
//# sourceMappingURL=chunk-LRGVCS7F.js.map
|
|
@@ -64154,7 +64154,272 @@ __publicField(_DeesButtonExit, "styles", [
|
|
|
64154
64154
|
__runInitializers(_init18, 1, _DeesButtonExit);
|
|
64155
64155
|
var DeesButtonExit = _DeesButtonExit;
|
|
64156
64156
|
|
|
64157
|
+
// ts_web/elements/00group-input/suggestion-list.ts
|
|
64158
|
+
var inputSuggestion = /* @__PURE__ */ __name((suggestionArg) => typeof suggestionArg === "string" ? { value: suggestionArg } : suggestionArg, "inputSuggestion");
|
|
64159
|
+
var SuggestionListController = class _SuggestionListController {
|
|
64160
|
+
constructor(host, options) {
|
|
64161
|
+
this.host = host;
|
|
64162
|
+
this.options = options;
|
|
64163
|
+
host.addController(this);
|
|
64164
|
+
this.scrollbars = new OverlayScrollbarController(host, () => this.popup()?.querySelector(".suggestions-list"));
|
|
64165
|
+
}
|
|
64166
|
+
host;
|
|
64167
|
+
options;
|
|
64168
|
+
static {
|
|
64169
|
+
__name(this, "SuggestionListController");
|
|
64170
|
+
}
|
|
64171
|
+
/** The id of the list in the host's shadow root, for the field's `aria-controls`. */
|
|
64172
|
+
static listboxId = "suggestion-listbox";
|
|
64173
|
+
/** Whether the list shows while there are suggestions. */
|
|
64174
|
+
expanded = false;
|
|
64175
|
+
/** The highlighted option, -1 for none. */
|
|
64176
|
+
highlightedIndex = -1;
|
|
64177
|
+
/** The name the last render gave the list; empty for none. */
|
|
64178
|
+
listLabel = "";
|
|
64179
|
+
/** Ends the listeners that keep the open list beside the field. */
|
|
64180
|
+
tracking;
|
|
64181
|
+
/** The list's scrollbar, shown while it scrolls. */
|
|
64182
|
+
scrollbars;
|
|
64183
|
+
/** The id of the option at `indexArg`, for the field's `aria-activedescendant`. */
|
|
64184
|
+
static optionId(indexArg) {
|
|
64185
|
+
return `suggestion-option-${indexArg}`;
|
|
64186
|
+
}
|
|
64187
|
+
/** Whether the list shows `countArg` suggestions now. */
|
|
64188
|
+
isOpen(countArg) {
|
|
64189
|
+
return this.expanded && countArg > 0;
|
|
64190
|
+
}
|
|
64191
|
+
/** Opens the list; it shows while there are suggestions. */
|
|
64192
|
+
show() {
|
|
64193
|
+
if (this.expanded) return;
|
|
64194
|
+
this.expanded = true;
|
|
64195
|
+
this.host.requestUpdate();
|
|
64196
|
+
}
|
|
64197
|
+
/** Closes the list and lets go of the highlighted option. */
|
|
64198
|
+
hide() {
|
|
64199
|
+
if (!this.expanded && this.highlightedIndex === -1) return;
|
|
64200
|
+
this.expanded = false;
|
|
64201
|
+
this.highlightedIndex = -1;
|
|
64202
|
+
this.host.requestUpdate();
|
|
64203
|
+
}
|
|
64204
|
+
/** Highlights the option at `indexArg`, -1 for none. */
|
|
64205
|
+
highlight(indexArg) {
|
|
64206
|
+
if (indexArg === this.highlightedIndex) return;
|
|
64207
|
+
this.highlightedIndex = indexArg;
|
|
64208
|
+
this.host.requestUpdate();
|
|
64209
|
+
}
|
|
64210
|
+
/**
|
|
64211
|
+
* Answers the list's keys in the field while the list shows: ArrowDown and ArrowUp move the
|
|
64212
|
+
* highlighted option, Enter picks the highlighted one, Escape closes the list. Returns whether it
|
|
64213
|
+
* answered the key; a key it answers in a showing list is prevented, so a form does not take Enter
|
|
64214
|
+
* and a dialog does not take Escape. A list with no suggestions shows nothing and answers none of
|
|
64215
|
+
* them: the arrows move the caret and Enter is the host's or the form's. Tab is the host's: it
|
|
64216
|
+
* leaves the field without a pick.
|
|
64217
|
+
*/
|
|
64218
|
+
handleKeydown(eventArg, countArg) {
|
|
64219
|
+
if (eventArg.isComposing) return false;
|
|
64220
|
+
const open = this.isOpen(countArg);
|
|
64221
|
+
switch (eventArg.key) {
|
|
64222
|
+
case "ArrowDown":
|
|
64223
|
+
if (!open) return false;
|
|
64224
|
+
eventArg.preventDefault();
|
|
64225
|
+
this.highlight(Math.min(this.highlightedIndex + 1, countArg - 1));
|
|
64226
|
+
return true;
|
|
64227
|
+
case "ArrowUp":
|
|
64228
|
+
if (!open) return false;
|
|
64229
|
+
eventArg.preventDefault();
|
|
64230
|
+
this.highlight(Math.min(Math.max(this.highlightedIndex - 1, 0), countArg - 1));
|
|
64231
|
+
return true;
|
|
64232
|
+
case "Enter":
|
|
64233
|
+
if (!open || this.highlightedIndex < 0 || this.highlightedIndex >= countArg) return false;
|
|
64234
|
+
eventArg.preventDefault();
|
|
64235
|
+
this.options.pick(this.highlightedIndex);
|
|
64236
|
+
return true;
|
|
64237
|
+
case "Escape": {
|
|
64238
|
+
if (!this.expanded) return false;
|
|
64239
|
+
if (open) eventArg.preventDefault();
|
|
64240
|
+
this.hide();
|
|
64241
|
+
return true;
|
|
64242
|
+
}
|
|
64243
|
+
default:
|
|
64244
|
+
return false;
|
|
64245
|
+
}
|
|
64246
|
+
}
|
|
64247
|
+
/**
|
|
64248
|
+
* Writes the combobox state onto the field: `role="combobox"`, `aria-autocomplete="list"`,
|
|
64249
|
+
* `aria-expanded`, and while the list shows `aria-controls` and the highlighted option's
|
|
64250
|
+
* `aria-activedescendant`. With `activeArg` false it removes all of them, for a field that offers
|
|
64251
|
+
* no suggestions and is a plain text field.
|
|
64252
|
+
*/
|
|
64253
|
+
applyComboboxAttributes(fieldArg, countArg, activeArg = true) {
|
|
64254
|
+
const open = this.isOpen(countArg);
|
|
64255
|
+
const highlighted = open && this.highlightedIndex >= 0 && this.highlightedIndex < countArg;
|
|
64256
|
+
const attributes = {
|
|
64257
|
+
role: activeArg ? "combobox" : null,
|
|
64258
|
+
"aria-autocomplete": activeArg ? "list" : null,
|
|
64259
|
+
"aria-expanded": activeArg ? String(open) : null,
|
|
64260
|
+
"aria-controls": activeArg && open ? _SuggestionListController.listboxId : null,
|
|
64261
|
+
"aria-activedescendant": activeArg && highlighted ? _SuggestionListController.optionId(this.highlightedIndex) : null
|
|
64262
|
+
};
|
|
64263
|
+
for (const [name, value] of Object.entries(attributes)) {
|
|
64264
|
+
if (value === null) fieldArg.removeAttribute(name);
|
|
64265
|
+
else if (fieldArg.getAttribute(name) !== value) fieldArg.setAttribute(name, value);
|
|
64266
|
+
}
|
|
64267
|
+
}
|
|
64268
|
+
/**
|
|
64269
|
+
* The open list, or nothing while it is closed or has no suggestions. `labelArg` names it; an
|
|
64270
|
+
* empty one leaves it without an `aria-label`.
|
|
64271
|
+
*/
|
|
64272
|
+
render(itemsArg, labelArg = "") {
|
|
64273
|
+
this.listLabel = labelArg;
|
|
64274
|
+
if (!this.isOpen(itemsArg.length)) return "";
|
|
64275
|
+
return b3`
|
|
64276
|
+
<div class="suggestions-dropdown" popover="manual"><div
|
|
64277
|
+
class="suggestions-list"
|
|
64278
|
+
id=${_SuggestionListController.listboxId}
|
|
64279
|
+
role="listbox"
|
|
64280
|
+
>
|
|
64281
|
+
${itemsArg.map((item, index) => b3`
|
|
64282
|
+
<div
|
|
64283
|
+
class="suggestion ${index === this.highlightedIndex ? "highlighted" : ""}"
|
|
64284
|
+
id=${_SuggestionListController.optionId(index)}
|
|
64285
|
+
role="option"
|
|
64286
|
+
aria-selected=${index === this.highlightedIndex ? "true" : "false"}
|
|
64287
|
+
@mousedown=${(event) => {
|
|
64288
|
+
event.preventDefault();
|
|
64289
|
+
this.options.pick(index);
|
|
64290
|
+
}}
|
|
64291
|
+
@mouseenter=${() => this.highlight(index)}
|
|
64292
|
+
>
|
|
64293
|
+
${item.label ?? item.value}
|
|
64294
|
+
${item.description ? b3`<div class="suggestion-description">${item.description}</div>` : ""}
|
|
64295
|
+
</div>
|
|
64296
|
+
`)}
|
|
64297
|
+
</div></div>
|
|
64298
|
+
`;
|
|
64299
|
+
}
|
|
64300
|
+
/** The open list follows the field from the render that shows it until the render that removes it. */
|
|
64301
|
+
hostUpdated() {
|
|
64302
|
+
const popup = this.popup();
|
|
64303
|
+
if (!popup) {
|
|
64304
|
+
this.stopTracking();
|
|
64305
|
+
return;
|
|
64306
|
+
}
|
|
64307
|
+
const listbox = popup.querySelector('[role="listbox"]');
|
|
64308
|
+
if (this.listLabel) listbox.setAttribute("aria-label", this.listLabel);
|
|
64309
|
+
else listbox.removeAttribute("aria-label");
|
|
64310
|
+
const field = this.options.anchor();
|
|
64311
|
+
if (!field) return;
|
|
64312
|
+
if (!this.tracking) {
|
|
64313
|
+
const tracking = new AbortController();
|
|
64314
|
+
this.tracking = tracking;
|
|
64315
|
+
listenForScrollAround(field, this.place, tracking.signal);
|
|
64316
|
+
window.addEventListener("resize", this.place, { passive: true, signal: tracking.signal });
|
|
64317
|
+
const observer = new ResizeObserver(this.place);
|
|
64318
|
+
observer.observe(field);
|
|
64319
|
+
tracking.signal.addEventListener("abort", () => observer.disconnect());
|
|
64320
|
+
}
|
|
64321
|
+
this.place();
|
|
64322
|
+
}
|
|
64323
|
+
hostDisconnected() {
|
|
64324
|
+
this.stopTracking();
|
|
64325
|
+
}
|
|
64326
|
+
popup() {
|
|
64327
|
+
return this.host.shadowRoot?.querySelector(".suggestions-dropdown");
|
|
64328
|
+
}
|
|
64329
|
+
stopTracking() {
|
|
64330
|
+
this.tracking?.abort();
|
|
64331
|
+
this.tracking = void 0;
|
|
64332
|
+
}
|
|
64333
|
+
/** Places the open list below the field, or above it without room there, as wide as the field. */
|
|
64334
|
+
place = /* @__PURE__ */ __name(() => {
|
|
64335
|
+
const popup = this.popup();
|
|
64336
|
+
const field = this.options.anchor();
|
|
64337
|
+
if (!popup || !field) return;
|
|
64338
|
+
const shown = visibleRect(field);
|
|
64339
|
+
if (!shown) {
|
|
64340
|
+
if (popup.matches(":popover-open")) popup.hidePopover();
|
|
64341
|
+
return;
|
|
64342
|
+
}
|
|
64343
|
+
if (!popup.matches(":popover-open")) popup.showPopover();
|
|
64344
|
+
const box = field.getBoundingClientRect();
|
|
64345
|
+
popup.style.width = `${box.width}px`;
|
|
64346
|
+
const placed2 = placeAnchored({
|
|
64347
|
+
anchor: { left: box.left, right: box.right, top: shown.top, bottom: shown.bottom },
|
|
64348
|
+
width: box.width,
|
|
64349
|
+
height: popup.offsetHeight,
|
|
64350
|
+
placement: "bottom",
|
|
64351
|
+
flip: true,
|
|
64352
|
+
gap: 4
|
|
64353
|
+
});
|
|
64354
|
+
popup.style.left = `${placed2.left}px`;
|
|
64355
|
+
popup.style.top = `${placed2.top}px`;
|
|
64356
|
+
}, "place");
|
|
64357
|
+
};
|
|
64358
|
+
var suggestionListStyles = i`
|
|
64359
|
+
/* A popover in the top layer, placed by the controller. The list scrolls inside it, the frame
|
|
64360
|
+
its scrollbar is placed in. */
|
|
64361
|
+
.suggestions-dropdown {
|
|
64362
|
+
position: fixed;
|
|
64363
|
+
inset: auto;
|
|
64364
|
+
margin: 0;
|
|
64365
|
+
padding: 0;
|
|
64366
|
+
color: inherit;
|
|
64367
|
+
background: var(--dees-material-regular-bg-opaque);
|
|
64368
|
+
border: var(--dees-line-width-hairline) solid var(--dees-color-border-default);
|
|
64369
|
+
border-radius: var(--dees-radius-lg);
|
|
64370
|
+
corner-shape: var(--dees-corner-shape);
|
|
64371
|
+
box-shadow: var(--dees-shadow-lg);
|
|
64372
|
+
overflow: hidden;
|
|
64373
|
+
}
|
|
64374
|
+
|
|
64375
|
+
.suggestions-list {
|
|
64376
|
+
max-height: calc(200px - 2 * var(--dees-line-width-hairline));
|
|
64377
|
+
overflow-y: auto;
|
|
64378
|
+
}
|
|
64379
|
+
|
|
64380
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
64381
|
+
.suggestions-dropdown {
|
|
64382
|
+
-webkit-backdrop-filter: none;
|
|
64383
|
+
backdrop-filter: none;
|
|
64384
|
+
}
|
|
64385
|
+
}
|
|
64386
|
+
|
|
64387
|
+
.suggestion {
|
|
64388
|
+
padding: var(--dees-spacing-xs-plus) var(--dees-spacing-sm-plus);
|
|
64389
|
+
cursor: pointer;
|
|
64390
|
+
transition: background-color var(--dees-transition-fast) var(--dees-ease-standard);
|
|
64391
|
+
font-size: 14px;
|
|
64392
|
+
color: var(--dees-color-text-primary);
|
|
64393
|
+
}
|
|
64394
|
+
|
|
64395
|
+
.suggestion:hover {
|
|
64396
|
+
background: var(--dees-color-hover);
|
|
64397
|
+
}
|
|
64398
|
+
|
|
64399
|
+
.suggestion.highlighted {
|
|
64400
|
+
background: var(--dees-color-active);
|
|
64401
|
+
color: var(--dees-color-text-primary);
|
|
64402
|
+
}
|
|
64403
|
+
|
|
64404
|
+
.suggestion-description {
|
|
64405
|
+
color: var(--dees-color-text-secondary);
|
|
64406
|
+
font-size: var(--dees-font-footnote-size);
|
|
64407
|
+
line-height: var(--dees-font-footnote-line);
|
|
64408
|
+
}
|
|
64409
|
+
`;
|
|
64410
|
+
|
|
64157
64411
|
// ts_web/elements/00group-input/dees-input-text/dees-input-text.demo.ts
|
|
64412
|
+
var serverPaths = ["/home/", "/home/alex/", "/home/alex/projects/", "/home/alex/projects/catalog/", "/srv/", "/srv/www/", "/srv/www/site/", "/var/", "/var/log/", "/var/log/nginx/"];
|
|
64413
|
+
var completePath = /* @__PURE__ */ __name((event) => {
|
|
64414
|
+
const field = event.currentTarget;
|
|
64415
|
+
const typed = String(field.value ?? "");
|
|
64416
|
+
field.suggestions = serverPaths.filter((path) => path.startsWith(typed) && path !== typed);
|
|
64417
|
+
}, "completePath");
|
|
64418
|
+
var regions = [
|
|
64419
|
+
{ value: "eu-central-1", label: "Frankfurt", description: "eu-central-1" },
|
|
64420
|
+
{ value: "eu-west-1", label: "Ireland", description: "eu-west-1" },
|
|
64421
|
+
{ value: "us-east-1", label: "Virginia", description: "us-east-1" }
|
|
64422
|
+
];
|
|
64158
64423
|
var demoFunc13 = /* @__PURE__ */ __name(() => demoPage("Text input", "A compact editor field and a quiet grouped value, with accessible labels, password controls, and validation feedback.", b3`
|
|
64159
64424
|
${demoSection("Everyday entry", "Labels and descriptions explain what belongs in each field.", b3`
|
|
64160
64425
|
<div class="dees-demo-grid"><dees-input-text label="Workspace name" value="Design studio" description="A recognizable name for your team."></dees-input-text><dees-input-text label="Contact email" value="hello@example.com" autocomplete="email" required></dees-input-text></div>`)}
|
|
@@ -64167,12 +64432,15 @@ var demoFunc13 = /* @__PURE__ */ __name(() => demoPage("Text input", "A compact
|
|
|
64167
64432
|
${demoSection("Password visibility", "A dedicated button reveals or conceals the value and follows the disabled state.", b3`
|
|
64168
64433
|
<div class="dees-demo-grid"><dees-input-text label="Password" value="catalog-preview" .isPasswordBool=${true} autocomplete="new-password"></dees-input-text><dees-input-text label="Visible password" value="catalog-preview" .isPasswordBool=${true} .showPasswordBool=${true}></dees-input-text></div>
|
|
64169
64434
|
${demoCode('<dees-input-text label="Password" .isPasswordBool=${true}></dees-input-text>')}`)}
|
|
64435
|
+
${demoSection("Suggestions", "The field offers values in a list under it. Arrow keys move through them, Enter or a click picks one, Escape closes the list. The host sends the list for what is typed; the field filters nothing.", b3`
|
|
64436
|
+
<div class="dees-demo-grid"><dees-input-text label="Working directory" placeholder="/home/" .suggestions=${serverPaths} @input=${completePath} @suggestion-select=${(event) => showDemoResult(event.currentTarget, event.detail.value)}></dees-input-text><dees-input-text label="Region" .suggestions=${regions} @suggestion-select=${(event) => showDemoResult(event.currentTarget, event.detail.value)}></dees-input-text></div>${demoOutput("Pick a suggestion to see its value.")}
|
|
64437
|
+
${demoCode('<dees-input-text label="Working directory" .suggestions=${paths} @input=${complete} @suggestion-select=${picked}></dees-input-text>')}`)}
|
|
64170
64438
|
${demoSection("Live value", "Native input events cross the shadow boundary. The result is rendered as text.", b3`
|
|
64171
64439
|
<dees-input-text class="dees-demo-field" label="Try a workspace name" @input=${(event) => showDemoResult(event.currentTarget, event.composedPath()[0].value)}></dees-input-text>${demoOutput()}`)}
|
|
64172
64440
|
`), "demoFunc");
|
|
64173
64441
|
|
|
64174
64442
|
// ts_web/elements/00group-input/dees-input-text/dees-input-text.ts
|
|
64175
|
-
var _maxLength_dec2, _placeholder_dec2, _autocomplete_dec, _validConfirmed_dec, _frameless_dec, _validationFunction_dec2, _validationText_dec2, _validationState_dec2, _showPasswordBool_dec, _isPasswordBool_dec, _value_dec2, _type_dec4, _a19, _DeesInputText_decorators, _init19, _type4, _value2, _isPasswordBool, _showPasswordBool, _validationState2, _validationText2, _validationFunction2, _frameless, _validConfirmed, _autocomplete, _placeholder2, _maxLength2;
|
|
64443
|
+
var _suggestions_dec, _maxLength_dec2, _placeholder_dec2, _autocomplete_dec, _validConfirmed_dec, _frameless_dec, _validationFunction_dec2, _validationText_dec2, _validationState_dec2, _showPasswordBool_dec, _isPasswordBool_dec, _value_dec2, _type_dec4, _a19, _DeesInputText_decorators, _init19, _type4, _value2, _isPasswordBool, _showPasswordBool, _validationState2, _validationText2, _validationFunction2, _frameless, _validConfirmed, _autocomplete, _placeholder2, _maxLength2, _suggestions;
|
|
64176
64444
|
var defaultInputModes = {
|
|
64177
64445
|
text: "text",
|
|
64178
64446
|
number: "decimal",
|
|
@@ -64202,7 +64470,7 @@ var _DeesInputText = class _DeesInputText extends (_a19 = DeesInputBase, _type_d
|
|
|
64202
64470
|
})], _validationFunction_dec2 = [n5({ attribute: false })], _frameless_dec = [n5({
|
|
64203
64471
|
type: Boolean,
|
|
64204
64472
|
reflect: true
|
|
64205
|
-
})], _validConfirmed_dec = [n5({ attribute: false })], _autocomplete_dec = [n5({ type: String, reflect: true })], _placeholder_dec2 = [n5({ type: String, reflect: true })], _maxLength_dec2 = [n5({ type: Number, reflect: true })], _a19) {
|
|
64473
|
+
})], _validConfirmed_dec = [n5({ attribute: false })], _autocomplete_dec = [n5({ type: String, reflect: true })], _placeholder_dec2 = [n5({ type: String, reflect: true })], _maxLength_dec2 = [n5({ type: Number, reflect: true })], _suggestions_dec = [n5({ attribute: false })], _a19) {
|
|
64206
64474
|
constructor() {
|
|
64207
64475
|
super(...arguments);
|
|
64208
64476
|
__publicField(this, "t", dcLocalize(this));
|
|
@@ -64218,7 +64486,40 @@ var _DeesInputText = class _DeesInputText extends (_a19 = DeesInputBase, _type_d
|
|
|
64218
64486
|
__privateAdd(this, _autocomplete, __runInitializers(_init19, 44, this, "")), __runInitializers(_init19, 47, this);
|
|
64219
64487
|
__privateAdd(this, _placeholder2, __runInitializers(_init19, 48, this, "")), __runInitializers(_init19, 51, this);
|
|
64220
64488
|
__privateAdd(this, _maxLength2, __runInitializers(_init19, 52, this, -1)), __runInitializers(_init19, 55, this);
|
|
64489
|
+
__privateAdd(this, _suggestions, __runInitializers(_init19, 56, this, null)), __runInitializers(_init19, 59, this);
|
|
64490
|
+
/** The suggestions under the field. */
|
|
64491
|
+
__publicField(this, "suggestionList", new SuggestionListController(this, {
|
|
64492
|
+
anchor: /* @__PURE__ */ __name(() => this.shadowRoot?.querySelector("input"), "anchor"),
|
|
64493
|
+
pick: /* @__PURE__ */ __name((index) => this.pickSuggestion(index), "pick")
|
|
64494
|
+
}));
|
|
64495
|
+
/**
|
|
64496
|
+
* The text a pick committed, until the reader edits again. The browser keeps its own `change`
|
|
64497
|
+
* baseline, which a value set by script does not move: after typing and a pick it fires `change`
|
|
64498
|
+
* again on leaving the field, for the commit the pick already reported.
|
|
64499
|
+
*/
|
|
64500
|
+
__publicField(this, "pickedText", null);
|
|
64221
64501
|
__publicField(this, "validTimeout");
|
|
64502
|
+
/** Reports the native field's `change`, unless it repeats the commit of a pick. */
|
|
64503
|
+
__publicField(this, "handleNativeChange", /* @__PURE__ */ __name((eventArg) => {
|
|
64504
|
+
const repeatsPick = this.pickedText !== null && this.pickedText === this.valueAsText;
|
|
64505
|
+
this.pickedText = null;
|
|
64506
|
+
if (repeatsPick) {
|
|
64507
|
+
eventArg.stopPropagation();
|
|
64508
|
+
return;
|
|
64509
|
+
}
|
|
64510
|
+
this.forwardNativeChange(eventArg);
|
|
64511
|
+
}, "handleNativeChange"));
|
|
64512
|
+
__publicField(this, "handleSuggestionKeydown", /* @__PURE__ */ __name((eventArg) => {
|
|
64513
|
+
if (!this.suggestions || this.disabled) return;
|
|
64514
|
+
if (eventArg.key === "ArrowDown" && !eventArg.isComposing && this.suggestions.length) this.suggestionList.show();
|
|
64515
|
+
this.suggestionList.handleKeydown(eventArg, this.suggestions.length);
|
|
64516
|
+
}, "handleSuggestionKeydown"));
|
|
64517
|
+
__publicField(this, "handleSuggestionFocus", /* @__PURE__ */ __name(() => {
|
|
64518
|
+
if (this.suggestions) this.suggestionList.show();
|
|
64519
|
+
}, "handleSuggestionFocus"));
|
|
64520
|
+
__publicField(this, "handleSuggestionBlur", /* @__PURE__ */ __name(() => {
|
|
64521
|
+
this.suggestionList.hide();
|
|
64522
|
+
}, "handleSuggestionBlur"));
|
|
64222
64523
|
}
|
|
64223
64524
|
render() {
|
|
64224
64525
|
return b3`
|
|
@@ -64251,7 +64552,10 @@ var _DeesInputText = class _DeesInputText extends (_a19 = DeesInputBase, _type_d
|
|
|
64251
64552
|
type="${this.nativeInputType}"
|
|
64252
64553
|
.value=${this.valueAsText}
|
|
64253
64554
|
@input="${this.updateValue}"
|
|
64254
|
-
@change=${this.
|
|
64555
|
+
@change=${this.handleNativeChange}
|
|
64556
|
+
@keydown=${this.handleSuggestionKeydown}
|
|
64557
|
+
@focus=${this.handleSuggestionFocus}
|
|
64558
|
+
@blur=${this.handleSuggestionBlur}
|
|
64255
64559
|
.disabled=${this.disabled}
|
|
64256
64560
|
?required=${this.required}
|
|
64257
64561
|
aria-label=${this.label}
|
|
@@ -64269,6 +64573,7 @@ var _DeesInputText = class _DeesInputText extends (_a19 = DeesInputBase, _type_d
|
|
|
64269
64573
|
<div class="validIcon ${this.validConfirmed ? "show" : ""}">
|
|
64270
64574
|
<dees-icon .icon=${"lucide:Check"}></dees-icon>
|
|
64271
64575
|
</div>
|
|
64576
|
+
${this.suggestions ? this.suggestionList.render(this.suggestions.map(inputSuggestion), this.label) : ""}
|
|
64272
64577
|
</div>
|
|
64273
64578
|
${this.validationText || this.description ? b3`<div class="field-messages">
|
|
64274
64579
|
${this.validationText ? b3`
|
|
@@ -64306,6 +64611,7 @@ var _DeesInputText = class _DeesInputText extends (_a19 = DeesInputBase, _type_d
|
|
|
64306
64611
|
}
|
|
64307
64612
|
willUpdate(changedProperties) {
|
|
64308
64613
|
super.willUpdate(changedProperties);
|
|
64614
|
+
if (changedProperties.has("suggestions")) this.suggestionList.highlight(-1);
|
|
64309
64615
|
if (!changedProperties.has("value") && !changedProperties.has("type")) return;
|
|
64310
64616
|
const normalized = this.normalizeValue(this.value);
|
|
64311
64617
|
if (normalized !== this.value) this.value = normalized;
|
|
@@ -64335,6 +64641,7 @@ var _DeesInputText = class _DeesInputText extends (_a19 = DeesInputBase, _type_d
|
|
|
64335
64641
|
} else {
|
|
64336
64642
|
input.removeAttribute("maxlength");
|
|
64337
64643
|
}
|
|
64644
|
+
this.suggestionList.applyComboboxAttributes(input, this.suggestions?.length ?? 0, this.suggestions !== null);
|
|
64338
64645
|
}
|
|
64339
64646
|
firstUpdated() {
|
|
64340
64647
|
if (this.validationFunction && this.value !== null && this.value !== "") {
|
|
@@ -64353,6 +64660,16 @@ var _DeesInputText = class _DeesInputText extends (_a19 = DeesInputBase, _type_d
|
|
|
64353
64660
|
async updateValue(eventArg) {
|
|
64354
64661
|
const target = eventArg.target;
|
|
64355
64662
|
this.value = this.normalizeValue(target.value);
|
|
64663
|
+
this.pickedText = null;
|
|
64664
|
+
if (this.suggestions) {
|
|
64665
|
+
this.suggestionList.show();
|
|
64666
|
+
this.suggestionList.highlight(-1);
|
|
64667
|
+
}
|
|
64668
|
+
this.runValidationFunction();
|
|
64669
|
+
this.changeSubject.next(this);
|
|
64670
|
+
}
|
|
64671
|
+
/** Runs `validationFunction` on the value, as each edit of the reader does. */
|
|
64672
|
+
runValidationFunction() {
|
|
64356
64673
|
if (this.validationFunction) {
|
|
64357
64674
|
const result2 = this.validationFunction(this.valueAsText);
|
|
64358
64675
|
this.validationState = result2.valid ? "valid" : "invalid";
|
|
@@ -64369,7 +64686,26 @@ var _DeesInputText = class _DeesInputText extends (_a19 = DeesInputBase, _type_d
|
|
|
64369
64686
|
this.validConfirmed = false;
|
|
64370
64687
|
}
|
|
64371
64688
|
}
|
|
64689
|
+
}
|
|
64690
|
+
/**
|
|
64691
|
+
* Sets the value of the suggestion at `indexArg`, as the reader's own edit: `validationFunction`
|
|
64692
|
+
* runs, `input` and `change` report it, and `suggestion-select` names the suggestion. The list
|
|
64693
|
+
* closes; typing or ArrowDown opens it again.
|
|
64694
|
+
*/
|
|
64695
|
+
pickSuggestion(indexArg) {
|
|
64696
|
+
const suggestion = this.suggestions?.[indexArg];
|
|
64697
|
+
if (suggestion === void 0 || this.disabled) return;
|
|
64698
|
+
const value = inputSuggestion(suggestion).value;
|
|
64699
|
+
this.value = this.normalizeValue(value);
|
|
64700
|
+
const input = this.shadowRoot?.querySelector("input");
|
|
64701
|
+
if (input) input.value = this.valueAsText;
|
|
64702
|
+
this.pickedText = this.valueAsText;
|
|
64703
|
+
this.suggestionList.hide();
|
|
64704
|
+
this.runValidationFunction();
|
|
64372
64705
|
this.changeSubject.next(this);
|
|
64706
|
+
this.reportValueCommit();
|
|
64707
|
+
const detail = { value, suggestion };
|
|
64708
|
+
this.dispatchEvent(new CustomEvent("suggestion-select", { detail, bubbles: true, composed: true }));
|
|
64373
64709
|
}
|
|
64374
64710
|
getContextMenuItems() {
|
|
64375
64711
|
return textInputContextMenuItems({ input: this.shadowRoot.querySelector("input"), t: this.t, disabled: this.disabled });
|
|
@@ -64406,6 +64742,7 @@ _validConfirmed = new WeakMap();
|
|
|
64406
64742
|
_autocomplete = new WeakMap();
|
|
64407
64743
|
_placeholder2 = new WeakMap();
|
|
64408
64744
|
_maxLength2 = new WeakMap();
|
|
64745
|
+
_suggestions = new WeakMap();
|
|
64409
64746
|
__decorateElement(_init19, 4, "type", _type_dec4, _DeesInputText, _type4);
|
|
64410
64747
|
__decorateElement(_init19, 4, "value", _value_dec2, _DeesInputText, _value2);
|
|
64411
64748
|
__decorateElement(_init19, 4, "isPasswordBool", _isPasswordBool_dec, _DeesInputText, _isPasswordBool);
|
|
@@ -64418,6 +64755,7 @@ __decorateElement(_init19, 4, "validConfirmed", _validConfirmed_dec, _DeesInputT
|
|
|
64418
64755
|
__decorateElement(_init19, 4, "autocomplete", _autocomplete_dec, _DeesInputText, _autocomplete);
|
|
64419
64756
|
__decorateElement(_init19, 4, "placeholder", _placeholder_dec2, _DeesInputText, _placeholder2);
|
|
64420
64757
|
__decorateElement(_init19, 4, "maxLength", _maxLength_dec2, _DeesInputText, _maxLength2);
|
|
64758
|
+
__decorateElement(_init19, 4, "suggestions", _suggestions_dec, _DeesInputText, _suggestions);
|
|
64421
64759
|
_DeesInputText = __decorateElement(_init19, 0, "DeesInputText", _DeesInputText_decorators, _DeesInputText);
|
|
64422
64760
|
__name(_DeesInputText, "DeesInputText");
|
|
64423
64761
|
__publicField(_DeesInputText, "demo", demoFunc13);
|
|
@@ -64429,6 +64767,8 @@ __publicField(_DeesInputText, "styles", [
|
|
|
64429
64767
|
...DeesInputBase.baseStyles,
|
|
64430
64768
|
cssManager.defaultStyles,
|
|
64431
64769
|
insetInlineStyles("--text-inset-inline"),
|
|
64770
|
+
overlayScrollbarStyles,
|
|
64771
|
+
suggestionListStyles,
|
|
64432
64772
|
i`
|
|
64433
64773
|
/* TODO: Migrate hardcoded values to --dees-* CSS variables */
|
|
64434
64774
|
* {
|
|
@@ -65293,6 +65633,9 @@ export {
|
|
|
65293
65633
|
DeesSpeechbubble,
|
|
65294
65634
|
DeesLabel,
|
|
65295
65635
|
DeesInputBase,
|
|
65636
|
+
inputSuggestion,
|
|
65637
|
+
SuggestionListController,
|
|
65638
|
+
suggestionListStyles,
|
|
65296
65639
|
DeesInputText,
|
|
65297
65640
|
focusedInputDemo,
|
|
65298
65641
|
DeesInputTextarea,
|
|
@@ -67149,4 +67492,4 @@ lucide/dist/esm/lucide.js:
|
|
|
67149
67492
|
* See the LICENSE file in the root directory of this source tree.
|
|
67150
67493
|
*)
|
|
67151
67494
|
*/
|
|
67152
|
-
//# sourceMappingURL=chunk-
|
|
67495
|
+
//# sourceMappingURL=chunk-PKH6IGY6.js.map
|