@wavelengthusaf/web-components 1.20.0 → 1.21.1
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/cjs/index.cjs +85 -46
- package/dist/cjs/index.d.cts +17 -6
- package/dist/esm/index.d.ts +17 -6
- package/dist/esm/index.js +85 -46
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -4044,38 +4044,69 @@ var wavelength_manyplanes_template_default = '<style>\n :host {\n display: b
|
|
|
4044
4044
|
|
|
4045
4045
|
// src/web-components/wavelength-manyplanes.ts
|
|
4046
4046
|
var WavelengthManyPlanes = class extends HTMLElement {
|
|
4047
|
-
static get observedAttributes() {
|
|
4048
|
-
return ["number-of-planes", "trail-dir", "opacity", "color", "gradient", "spaced"];
|
|
4049
|
-
}
|
|
4050
4047
|
constructor() {
|
|
4051
4048
|
super();
|
|
4049
|
+
this._numberOfPlanes = 5;
|
|
4050
|
+
this._spaced = true;
|
|
4052
4051
|
this.shadow = this.attachShadow({ mode: "open" });
|
|
4053
4052
|
this.shadow.innerHTML = wavelength_manyplanes_template_default;
|
|
4054
4053
|
}
|
|
4054
|
+
static get observedAttributes() {
|
|
4055
|
+
return ["number-of-planes", "trail-dir", "opacity", "color", "gradient", "spaced"];
|
|
4056
|
+
}
|
|
4057
|
+
get numberOfPlanes() {
|
|
4058
|
+
return this._numberOfPlanes;
|
|
4059
|
+
}
|
|
4060
|
+
set numberOfPlanes(val) {
|
|
4061
|
+
if (this._numberOfPlanes !== val) {
|
|
4062
|
+
this._numberOfPlanes = val;
|
|
4063
|
+
this.setAttribute("number-of-planes", val.toString());
|
|
4064
|
+
this.updateComponent();
|
|
4065
|
+
}
|
|
4066
|
+
}
|
|
4067
|
+
get spaced() {
|
|
4068
|
+
return this._spaced;
|
|
4069
|
+
}
|
|
4070
|
+
set spaced(val) {
|
|
4071
|
+
if (this._spaced !== val) {
|
|
4072
|
+
this._spaced = val;
|
|
4073
|
+
this.setAttribute("spaced", val.toString());
|
|
4074
|
+
this.updateComponent();
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4055
4077
|
connectedCallback() {
|
|
4056
4078
|
this.updateComponent();
|
|
4057
4079
|
}
|
|
4058
|
-
attributeChangedCallback() {
|
|
4080
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
4081
|
+
if (oldValue === newValue) return;
|
|
4082
|
+
if (name === "number-of-planes") {
|
|
4083
|
+
const parsed = Number(newValue);
|
|
4084
|
+
if (!isNaN(parsed)) {
|
|
4085
|
+
this._numberOfPlanes = parsed;
|
|
4086
|
+
}
|
|
4087
|
+
} else if (name === "spaced") {
|
|
4088
|
+
this._spaced = newValue === "true";
|
|
4089
|
+
}
|
|
4059
4090
|
this.updateComponent();
|
|
4060
4091
|
}
|
|
4061
4092
|
updateComponent() {
|
|
4062
|
-
const numberOfPlanes = this.
|
|
4093
|
+
const numberOfPlanes = this._numberOfPlanes;
|
|
4063
4094
|
const trailDir = this.getAttribute("trail-dir") || "right";
|
|
4064
4095
|
const opacity = this.getAttribute("opacity") || "1";
|
|
4065
4096
|
const color = this.getAttribute("color") || "#00308F";
|
|
4066
4097
|
const gradient = this.getAttribute("gradient") || "false";
|
|
4067
|
-
const spaced = this.
|
|
4098
|
+
const spaced = this._spaced;
|
|
4068
4099
|
const planeContainer = this.shadow.getElementById("plane-container");
|
|
4069
4100
|
if (planeContainer === null) {
|
|
4070
4101
|
return;
|
|
4071
4102
|
}
|
|
4072
4103
|
planeContainer.replaceChildren();
|
|
4073
4104
|
planeContainer.style.flexDirection = trailDir === "right" ? "row" : "row-reverse";
|
|
4074
|
-
planeContainer.style.justifyContent = spaced
|
|
4075
|
-
for (let i = 0; i <
|
|
4105
|
+
planeContainer.style.justifyContent = spaced ? "space-between" : "flex-end";
|
|
4106
|
+
for (let i = 0; i < numberOfPlanes; i++) {
|
|
4076
4107
|
let currentPlaneOpacity = opacity;
|
|
4077
4108
|
if (gradient === "true") {
|
|
4078
|
-
currentPlaneOpacity = (parseFloat(opacity) * ((i + 1) /
|
|
4109
|
+
currentPlaneOpacity = (parseFloat(opacity) * ((i + 1) / numberOfPlanes)).toString();
|
|
4079
4110
|
}
|
|
4080
4111
|
planeContainer.appendChild(this.createPlane(currentPlaneOpacity, color, trailDir === "right" ? false : true));
|
|
4081
4112
|
}
|
|
@@ -4459,7 +4490,7 @@ var wavelength_search_template_default = '<style>\n :host {\n display: block
|
|
|
4459
4490
|
var WavelengthSearch = class extends HTMLElement {
|
|
4460
4491
|
constructor() {
|
|
4461
4492
|
super();
|
|
4462
|
-
this.
|
|
4493
|
+
this._options = [];
|
|
4463
4494
|
this.highlightedIndex = -1;
|
|
4464
4495
|
this.styleAttributes = [
|
|
4465
4496
|
"width",
|
|
@@ -4477,14 +4508,15 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4477
4508
|
];
|
|
4478
4509
|
this.handleFocusIn = () => {
|
|
4479
4510
|
this.inputContainer.classList.add("focused");
|
|
4511
|
+
this.handleSearch(this.input.value || "");
|
|
4480
4512
|
};
|
|
4481
4513
|
this.handleFocusOut = () => {
|
|
4482
4514
|
this.inputContainer.classList.remove("focused");
|
|
4483
4515
|
};
|
|
4484
4516
|
this.handleInputChange = (e) => {
|
|
4485
4517
|
const mode = this.getAttribute("mode") || "automatic";
|
|
4486
|
-
const
|
|
4487
|
-
if (
|
|
4518
|
+
const currentQueryText = e.detail.value;
|
|
4519
|
+
if (currentQueryText) {
|
|
4488
4520
|
this.inputContainer.classList.add("has-value");
|
|
4489
4521
|
} else {
|
|
4490
4522
|
this.inputContainer.classList.remove("has-value");
|
|
@@ -4494,7 +4526,7 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4494
4526
|
clearTimeout(this.searchTimeout);
|
|
4495
4527
|
}
|
|
4496
4528
|
this.searchTimeout = setTimeout(() => {
|
|
4497
|
-
this.handleSearch(
|
|
4529
|
+
this.handleSearch(currentQueryText);
|
|
4498
4530
|
}, 300);
|
|
4499
4531
|
}
|
|
4500
4532
|
};
|
|
@@ -4524,18 +4556,22 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4524
4556
|
} else if (e.key === "Enter") {
|
|
4525
4557
|
if (isDropdownVisible && this.highlightedIndex >= 0 && this.highlightedIndex < items.length) {
|
|
4526
4558
|
e.preventDefault();
|
|
4527
|
-
|
|
4559
|
+
const id = items[this.highlightedIndex].getAttribute("data-id");
|
|
4560
|
+
const selected = this._options.find((o) => String(o.id) === id);
|
|
4561
|
+
if (selected) {
|
|
4562
|
+
this.selectOption(selected);
|
|
4563
|
+
}
|
|
4528
4564
|
} else {
|
|
4529
|
-
const
|
|
4530
|
-
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value }, bubbles: true, composed: true }));
|
|
4531
|
-
this.handleSearch(
|
|
4565
|
+
const submittedQuery = this.input.value;
|
|
4566
|
+
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value: submittedQuery }, bubbles: true, composed: true }));
|
|
4567
|
+
this.handleSearch(submittedQuery);
|
|
4532
4568
|
}
|
|
4533
4569
|
}
|
|
4534
4570
|
};
|
|
4535
4571
|
this.handleSearchIconClick = () => {
|
|
4536
|
-
const
|
|
4537
|
-
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value }, bubbles: true, composed: true }));
|
|
4538
|
-
this.handleSearch(
|
|
4572
|
+
const submittedQuery = this.input.value;
|
|
4573
|
+
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value: submittedQuery }, bubbles: true, composed: true }));
|
|
4574
|
+
this.handleSearch(submittedQuery);
|
|
4539
4575
|
};
|
|
4540
4576
|
this.handleDocumentClick = (e) => {
|
|
4541
4577
|
if (!this.contains(e.target)) {
|
|
@@ -4622,9 +4658,12 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4622
4658
|
}
|
|
4623
4659
|
if (name === "options" && newValue) {
|
|
4624
4660
|
try {
|
|
4625
|
-
|
|
4661
|
+
const parsed = JSON.parse(newValue);
|
|
4662
|
+
if (Array.isArray(parsed)) {
|
|
4663
|
+
this._options = parsed.map((item, index) => typeof item === "string" ? { id: index, title: item } : item);
|
|
4664
|
+
}
|
|
4626
4665
|
} catch (e) {
|
|
4627
|
-
this.
|
|
4666
|
+
this._options = newValue.split(",").map((s, index) => ({ id: index, title: s.trim() }));
|
|
4628
4667
|
}
|
|
4629
4668
|
} else if (name === "placeholder" && this.animatedPlaceholder) {
|
|
4630
4669
|
this.animatedPlaceholder.textContent = newValue || "Search...";
|
|
@@ -4641,11 +4680,7 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4641
4680
|
clearTimeout(this.searchTimeout);
|
|
4642
4681
|
this.searchTimeout = null;
|
|
4643
4682
|
}
|
|
4644
|
-
|
|
4645
|
-
this.dropdown.style.display = "none";
|
|
4646
|
-
return;
|
|
4647
|
-
}
|
|
4648
|
-
const results = this.options.filter((option) => option.toLowerCase().includes(query.toLowerCase()));
|
|
4683
|
+
const results = query ? this._options.filter((option) => option.title && option.title.toLowerCase().includes(query.toLowerCase())) : this._options;
|
|
4649
4684
|
this.highlightedIndex = -1;
|
|
4650
4685
|
this.renderDropdown(results);
|
|
4651
4686
|
}
|
|
@@ -4654,12 +4689,17 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4654
4689
|
this.dropdown.style.display = "none";
|
|
4655
4690
|
return;
|
|
4656
4691
|
}
|
|
4657
|
-
this.dropdown.innerHTML = results.map(
|
|
4692
|
+
this.dropdown.innerHTML = results.map(
|
|
4693
|
+
(r) => `<div class="dropdown-item" data-id="${r.id}">
|
|
4694
|
+
<div class="search-result-title">${r.title}</div>
|
|
4695
|
+
${r.subtitle ? `<div class="search-result-subtitle">${r.subtitle}</div>` : ""}
|
|
4696
|
+
</div>`
|
|
4697
|
+
).join("");
|
|
4658
4698
|
this.dropdown.style.display = "block";
|
|
4659
4699
|
const items = this.dropdown.querySelectorAll(".dropdown-item");
|
|
4660
4700
|
items.forEach((item, index) => {
|
|
4661
4701
|
item.addEventListener("click", () => {
|
|
4662
|
-
this.selectOption(
|
|
4702
|
+
this.selectOption(results[index]);
|
|
4663
4703
|
});
|
|
4664
4704
|
item.addEventListener("mouseenter", () => {
|
|
4665
4705
|
this.highlightedIndex = index;
|
|
@@ -4668,44 +4708,43 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4668
4708
|
});
|
|
4669
4709
|
this.updateHighlight(items);
|
|
4670
4710
|
}
|
|
4671
|
-
selectOption(
|
|
4672
|
-
this.input.value =
|
|
4711
|
+
selectOption(selectedItem) {
|
|
4712
|
+
this.input.value = selectedItem.title;
|
|
4673
4713
|
this.dropdown.style.display = "none";
|
|
4674
4714
|
this.highlightedIndex = -1;
|
|
4675
|
-
this.dispatchEvent(new CustomEvent("wavelength-search-select", { detail: { value }, bubbles: true, composed: true }));
|
|
4715
|
+
this.dispatchEvent(new CustomEvent("wavelength-search-select", { detail: { value: selectedItem }, bubbles: true, composed: true }));
|
|
4676
4716
|
}
|
|
4677
4717
|
// ---- Getters and Setters API ---- //
|
|
4678
4718
|
get value() {
|
|
4679
4719
|
return this.input.value;
|
|
4680
4720
|
}
|
|
4681
|
-
set value(
|
|
4682
|
-
this.input.value =
|
|
4721
|
+
set value(searchQueryText) {
|
|
4722
|
+
this.input.value = searchQueryText;
|
|
4683
4723
|
}
|
|
4684
|
-
get
|
|
4685
|
-
return this.
|
|
4724
|
+
get options() {
|
|
4725
|
+
return this._options;
|
|
4686
4726
|
}
|
|
4687
|
-
set
|
|
4688
|
-
if (val) {
|
|
4689
|
-
this.
|
|
4690
|
-
this.setAttribute("options", JSON.stringify(val));
|
|
4727
|
+
set options(val) {
|
|
4728
|
+
if (Array.isArray(val)) {
|
|
4729
|
+
this._options = val;
|
|
4691
4730
|
}
|
|
4692
4731
|
}
|
|
4693
4732
|
_syncStyles() {
|
|
4694
4733
|
this.styleAttributes.forEach((attr) => {
|
|
4695
|
-
const
|
|
4696
|
-
if (
|
|
4697
|
-
if (attr === "height" && ["small", "medium", "large"].includes(
|
|
4734
|
+
const attrValue = this.getAttribute(attr);
|
|
4735
|
+
if (attrValue) {
|
|
4736
|
+
if (attr === "height" && ["small", "medium", "large"].includes(attrValue)) {
|
|
4698
4737
|
} else {
|
|
4699
|
-
this.style.setProperty(`--${attr}`,
|
|
4738
|
+
this.style.setProperty(`--${attr}`, attrValue);
|
|
4700
4739
|
}
|
|
4701
4740
|
}
|
|
4702
4741
|
});
|
|
4703
4742
|
}
|
|
4704
|
-
updateHighlight(items) {
|
|
4743
|
+
updateHighlight(items, preventScroll = false) {
|
|
4705
4744
|
items.forEach((item, index) => {
|
|
4706
4745
|
const isHighlighted = index === this.highlightedIndex;
|
|
4707
4746
|
item.classList.toggle("highlighted", isHighlighted);
|
|
4708
|
-
if (isHighlighted) {
|
|
4747
|
+
if (isHighlighted && !preventScroll) {
|
|
4709
4748
|
item.scrollIntoView({ block: "nearest" });
|
|
4710
4749
|
}
|
|
4711
4750
|
});
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -2307,9 +2307,15 @@ declare class WavelengthPlaneTrail extends WavelengthPlaneTrail_base {
|
|
|
2307
2307
|
declare class WavelengthManyPlanes extends HTMLElement {
|
|
2308
2308
|
static get observedAttributes(): string[];
|
|
2309
2309
|
private shadow;
|
|
2310
|
+
private _numberOfPlanes;
|
|
2311
|
+
private _spaced;
|
|
2312
|
+
get numberOfPlanes(): number;
|
|
2313
|
+
set numberOfPlanes(val: number);
|
|
2314
|
+
get spaced(): boolean;
|
|
2315
|
+
set spaced(val: boolean);
|
|
2310
2316
|
constructor();
|
|
2311
2317
|
connectedCallback(): void;
|
|
2312
|
-
attributeChangedCallback(): void;
|
|
2318
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
2313
2319
|
updateComponent(): void;
|
|
2314
2320
|
createPlane(opacity: string, color: string, flipped: boolean): SVGSVGElement;
|
|
2315
2321
|
}
|
|
@@ -2367,6 +2373,11 @@ declare class WavelengthPagination extends HTMLElement {
|
|
|
2367
2373
|
private _syncStyles;
|
|
2368
2374
|
}
|
|
2369
2375
|
|
|
2376
|
+
interface SearchResult {
|
|
2377
|
+
id: number | string;
|
|
2378
|
+
title: string;
|
|
2379
|
+
subtitle?: string;
|
|
2380
|
+
}
|
|
2370
2381
|
declare class WavelengthSearch extends HTMLElement {
|
|
2371
2382
|
static get observedAttributes(): string[];
|
|
2372
2383
|
private shadow;
|
|
@@ -2374,7 +2385,7 @@ declare class WavelengthSearch extends HTMLElement {
|
|
|
2374
2385
|
private dropdown;
|
|
2375
2386
|
private inputContainer;
|
|
2376
2387
|
private animatedPlaceholder;
|
|
2377
|
-
private
|
|
2388
|
+
private _options;
|
|
2378
2389
|
private highlightedIndex;
|
|
2379
2390
|
private styleAttributes;
|
|
2380
2391
|
constructor();
|
|
@@ -2385,9 +2396,9 @@ declare class WavelengthSearch extends HTMLElement {
|
|
|
2385
2396
|
private renderDropdown;
|
|
2386
2397
|
private selectOption;
|
|
2387
2398
|
get value(): string;
|
|
2388
|
-
set value(
|
|
2389
|
-
get
|
|
2390
|
-
set
|
|
2399
|
+
set value(searchQueryText: string);
|
|
2400
|
+
get options(): SearchResult[];
|
|
2401
|
+
set options(val: SearchResult[]);
|
|
2391
2402
|
private _syncStyles;
|
|
2392
2403
|
private handleFocusIn;
|
|
2393
2404
|
private handleFocusOut;
|
|
@@ -2918,4 +2929,4 @@ declare class WavelengthCommentDisplay extends HTMLElement {
|
|
|
2918
2929
|
private updateSelectedState;
|
|
2919
2930
|
}
|
|
2920
2931
|
|
|
2921
|
-
export { BaseWavelengthInput, BaseWavelengthMultiSelectAutocomplete, type CheckboxElements, ChildDataTable, SampleComponent, WavelengthBadge, WavelengthBanner, WavelengthButton, WavelengthCheckbox, WavelengthCommentDisplay, WavelengthConfirmationModal, type WavelengthConfirmationModalElements, WavelengthDatePicker, WavelengthDialog, WavelengthDropdown, WavelengthFileDropZone, WavelengthForm, WavelengthInput, WavelengthManyPlanes, WavelengthMenu, WavelengthMultiSelectAutocomplete, WavelengthNavBar, WavelengthNotificationPanel, WavelengthPagination, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSwitch, WavelengthTitleBar, WavelengthToolTip };
|
|
2932
|
+
export { BaseWavelengthInput, BaseWavelengthMultiSelectAutocomplete, type CheckboxElements, ChildDataTable, SampleComponent, type SearchResult, WavelengthBadge, WavelengthBanner, WavelengthButton, WavelengthCheckbox, WavelengthCommentDisplay, WavelengthConfirmationModal, type WavelengthConfirmationModalElements, WavelengthDatePicker, WavelengthDialog, WavelengthDropdown, WavelengthFileDropZone, WavelengthForm, WavelengthInput, WavelengthManyPlanes, WavelengthMenu, WavelengthMultiSelectAutocomplete, WavelengthNavBar, WavelengthNotificationPanel, WavelengthPagination, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSwitch, WavelengthTitleBar, WavelengthToolTip };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2307,9 +2307,15 @@ declare class WavelengthPlaneTrail extends WavelengthPlaneTrail_base {
|
|
|
2307
2307
|
declare class WavelengthManyPlanes extends HTMLElement {
|
|
2308
2308
|
static get observedAttributes(): string[];
|
|
2309
2309
|
private shadow;
|
|
2310
|
+
private _numberOfPlanes;
|
|
2311
|
+
private _spaced;
|
|
2312
|
+
get numberOfPlanes(): number;
|
|
2313
|
+
set numberOfPlanes(val: number);
|
|
2314
|
+
get spaced(): boolean;
|
|
2315
|
+
set spaced(val: boolean);
|
|
2310
2316
|
constructor();
|
|
2311
2317
|
connectedCallback(): void;
|
|
2312
|
-
attributeChangedCallback(): void;
|
|
2318
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
2313
2319
|
updateComponent(): void;
|
|
2314
2320
|
createPlane(opacity: string, color: string, flipped: boolean): SVGSVGElement;
|
|
2315
2321
|
}
|
|
@@ -2367,6 +2373,11 @@ declare class WavelengthPagination extends HTMLElement {
|
|
|
2367
2373
|
private _syncStyles;
|
|
2368
2374
|
}
|
|
2369
2375
|
|
|
2376
|
+
interface SearchResult {
|
|
2377
|
+
id: number | string;
|
|
2378
|
+
title: string;
|
|
2379
|
+
subtitle?: string;
|
|
2380
|
+
}
|
|
2370
2381
|
declare class WavelengthSearch extends HTMLElement {
|
|
2371
2382
|
static get observedAttributes(): string[];
|
|
2372
2383
|
private shadow;
|
|
@@ -2374,7 +2385,7 @@ declare class WavelengthSearch extends HTMLElement {
|
|
|
2374
2385
|
private dropdown;
|
|
2375
2386
|
private inputContainer;
|
|
2376
2387
|
private animatedPlaceholder;
|
|
2377
|
-
private
|
|
2388
|
+
private _options;
|
|
2378
2389
|
private highlightedIndex;
|
|
2379
2390
|
private styleAttributes;
|
|
2380
2391
|
constructor();
|
|
@@ -2385,9 +2396,9 @@ declare class WavelengthSearch extends HTMLElement {
|
|
|
2385
2396
|
private renderDropdown;
|
|
2386
2397
|
private selectOption;
|
|
2387
2398
|
get value(): string;
|
|
2388
|
-
set value(
|
|
2389
|
-
get
|
|
2390
|
-
set
|
|
2399
|
+
set value(searchQueryText: string);
|
|
2400
|
+
get options(): SearchResult[];
|
|
2401
|
+
set options(val: SearchResult[]);
|
|
2391
2402
|
private _syncStyles;
|
|
2392
2403
|
private handleFocusIn;
|
|
2393
2404
|
private handleFocusOut;
|
|
@@ -2918,4 +2929,4 @@ declare class WavelengthCommentDisplay extends HTMLElement {
|
|
|
2918
2929
|
private updateSelectedState;
|
|
2919
2930
|
}
|
|
2920
2931
|
|
|
2921
|
-
export { BaseWavelengthInput, BaseWavelengthMultiSelectAutocomplete, type CheckboxElements, ChildDataTable, SampleComponent, WavelengthBadge, WavelengthBanner, WavelengthButton, WavelengthCheckbox, WavelengthCommentDisplay, WavelengthConfirmationModal, type WavelengthConfirmationModalElements, WavelengthDatePicker, WavelengthDialog, WavelengthDropdown, WavelengthFileDropZone, WavelengthForm, WavelengthInput, WavelengthManyPlanes, WavelengthMenu, WavelengthMultiSelectAutocomplete, WavelengthNavBar, WavelengthNotificationPanel, WavelengthPagination, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSwitch, WavelengthTitleBar, WavelengthToolTip };
|
|
2932
|
+
export { BaseWavelengthInput, BaseWavelengthMultiSelectAutocomplete, type CheckboxElements, ChildDataTable, SampleComponent, type SearchResult, WavelengthBadge, WavelengthBanner, WavelengthButton, WavelengthCheckbox, WavelengthCommentDisplay, WavelengthConfirmationModal, type WavelengthConfirmationModalElements, WavelengthDatePicker, WavelengthDialog, WavelengthDropdown, WavelengthFileDropZone, WavelengthForm, WavelengthInput, WavelengthManyPlanes, WavelengthMenu, WavelengthMultiSelectAutocomplete, WavelengthNavBar, WavelengthNotificationPanel, WavelengthPagination, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSwitch, WavelengthTitleBar, WavelengthToolTip };
|
package/dist/esm/index.js
CHANGED
|
@@ -4044,38 +4044,69 @@ var wavelength_manyplanes_template_default = '<style>\n :host {\n display: b
|
|
|
4044
4044
|
|
|
4045
4045
|
// src/web-components/wavelength-manyplanes.ts
|
|
4046
4046
|
var WavelengthManyPlanes = class extends HTMLElement {
|
|
4047
|
-
static get observedAttributes() {
|
|
4048
|
-
return ["number-of-planes", "trail-dir", "opacity", "color", "gradient", "spaced"];
|
|
4049
|
-
}
|
|
4050
4047
|
constructor() {
|
|
4051
4048
|
super();
|
|
4049
|
+
this._numberOfPlanes = 5;
|
|
4050
|
+
this._spaced = true;
|
|
4052
4051
|
this.shadow = this.attachShadow({ mode: "open" });
|
|
4053
4052
|
this.shadow.innerHTML = wavelength_manyplanes_template_default;
|
|
4054
4053
|
}
|
|
4054
|
+
static get observedAttributes() {
|
|
4055
|
+
return ["number-of-planes", "trail-dir", "opacity", "color", "gradient", "spaced"];
|
|
4056
|
+
}
|
|
4057
|
+
get numberOfPlanes() {
|
|
4058
|
+
return this._numberOfPlanes;
|
|
4059
|
+
}
|
|
4060
|
+
set numberOfPlanes(val) {
|
|
4061
|
+
if (this._numberOfPlanes !== val) {
|
|
4062
|
+
this._numberOfPlanes = val;
|
|
4063
|
+
this.setAttribute("number-of-planes", val.toString());
|
|
4064
|
+
this.updateComponent();
|
|
4065
|
+
}
|
|
4066
|
+
}
|
|
4067
|
+
get spaced() {
|
|
4068
|
+
return this._spaced;
|
|
4069
|
+
}
|
|
4070
|
+
set spaced(val) {
|
|
4071
|
+
if (this._spaced !== val) {
|
|
4072
|
+
this._spaced = val;
|
|
4073
|
+
this.setAttribute("spaced", val.toString());
|
|
4074
|
+
this.updateComponent();
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4055
4077
|
connectedCallback() {
|
|
4056
4078
|
this.updateComponent();
|
|
4057
4079
|
}
|
|
4058
|
-
attributeChangedCallback() {
|
|
4080
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
4081
|
+
if (oldValue === newValue) return;
|
|
4082
|
+
if (name === "number-of-planes") {
|
|
4083
|
+
const parsed = Number(newValue);
|
|
4084
|
+
if (!isNaN(parsed)) {
|
|
4085
|
+
this._numberOfPlanes = parsed;
|
|
4086
|
+
}
|
|
4087
|
+
} else if (name === "spaced") {
|
|
4088
|
+
this._spaced = newValue === "true";
|
|
4089
|
+
}
|
|
4059
4090
|
this.updateComponent();
|
|
4060
4091
|
}
|
|
4061
4092
|
updateComponent() {
|
|
4062
|
-
const numberOfPlanes = this.
|
|
4093
|
+
const numberOfPlanes = this._numberOfPlanes;
|
|
4063
4094
|
const trailDir = this.getAttribute("trail-dir") || "right";
|
|
4064
4095
|
const opacity = this.getAttribute("opacity") || "1";
|
|
4065
4096
|
const color = this.getAttribute("color") || "#00308F";
|
|
4066
4097
|
const gradient = this.getAttribute("gradient") || "false";
|
|
4067
|
-
const spaced = this.
|
|
4098
|
+
const spaced = this._spaced;
|
|
4068
4099
|
const planeContainer = this.shadow.getElementById("plane-container");
|
|
4069
4100
|
if (planeContainer === null) {
|
|
4070
4101
|
return;
|
|
4071
4102
|
}
|
|
4072
4103
|
planeContainer.replaceChildren();
|
|
4073
4104
|
planeContainer.style.flexDirection = trailDir === "right" ? "row" : "row-reverse";
|
|
4074
|
-
planeContainer.style.justifyContent = spaced
|
|
4075
|
-
for (let i = 0; i <
|
|
4105
|
+
planeContainer.style.justifyContent = spaced ? "space-between" : "flex-end";
|
|
4106
|
+
for (let i = 0; i < numberOfPlanes; i++) {
|
|
4076
4107
|
let currentPlaneOpacity = opacity;
|
|
4077
4108
|
if (gradient === "true") {
|
|
4078
|
-
currentPlaneOpacity = (parseFloat(opacity) * ((i + 1) /
|
|
4109
|
+
currentPlaneOpacity = (parseFloat(opacity) * ((i + 1) / numberOfPlanes)).toString();
|
|
4079
4110
|
}
|
|
4080
4111
|
planeContainer.appendChild(this.createPlane(currentPlaneOpacity, color, trailDir === "right" ? false : true));
|
|
4081
4112
|
}
|
|
@@ -4459,7 +4490,7 @@ var wavelength_search_template_default = '<style>\n :host {\n display: block
|
|
|
4459
4490
|
var WavelengthSearch = class extends HTMLElement {
|
|
4460
4491
|
constructor() {
|
|
4461
4492
|
super();
|
|
4462
|
-
this.
|
|
4493
|
+
this._options = [];
|
|
4463
4494
|
this.highlightedIndex = -1;
|
|
4464
4495
|
this.styleAttributes = [
|
|
4465
4496
|
"width",
|
|
@@ -4477,14 +4508,15 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4477
4508
|
];
|
|
4478
4509
|
this.handleFocusIn = () => {
|
|
4479
4510
|
this.inputContainer.classList.add("focused");
|
|
4511
|
+
this.handleSearch(this.input.value || "");
|
|
4480
4512
|
};
|
|
4481
4513
|
this.handleFocusOut = () => {
|
|
4482
4514
|
this.inputContainer.classList.remove("focused");
|
|
4483
4515
|
};
|
|
4484
4516
|
this.handleInputChange = (e) => {
|
|
4485
4517
|
const mode = this.getAttribute("mode") || "automatic";
|
|
4486
|
-
const
|
|
4487
|
-
if (
|
|
4518
|
+
const currentQueryText = e.detail.value;
|
|
4519
|
+
if (currentQueryText) {
|
|
4488
4520
|
this.inputContainer.classList.add("has-value");
|
|
4489
4521
|
} else {
|
|
4490
4522
|
this.inputContainer.classList.remove("has-value");
|
|
@@ -4494,7 +4526,7 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4494
4526
|
clearTimeout(this.searchTimeout);
|
|
4495
4527
|
}
|
|
4496
4528
|
this.searchTimeout = setTimeout(() => {
|
|
4497
|
-
this.handleSearch(
|
|
4529
|
+
this.handleSearch(currentQueryText);
|
|
4498
4530
|
}, 300);
|
|
4499
4531
|
}
|
|
4500
4532
|
};
|
|
@@ -4524,18 +4556,22 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4524
4556
|
} else if (e.key === "Enter") {
|
|
4525
4557
|
if (isDropdownVisible && this.highlightedIndex >= 0 && this.highlightedIndex < items.length) {
|
|
4526
4558
|
e.preventDefault();
|
|
4527
|
-
|
|
4559
|
+
const id = items[this.highlightedIndex].getAttribute("data-id");
|
|
4560
|
+
const selected = this._options.find((o) => String(o.id) === id);
|
|
4561
|
+
if (selected) {
|
|
4562
|
+
this.selectOption(selected);
|
|
4563
|
+
}
|
|
4528
4564
|
} else {
|
|
4529
|
-
const
|
|
4530
|
-
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value }, bubbles: true, composed: true }));
|
|
4531
|
-
this.handleSearch(
|
|
4565
|
+
const submittedQuery = this.input.value;
|
|
4566
|
+
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value: submittedQuery }, bubbles: true, composed: true }));
|
|
4567
|
+
this.handleSearch(submittedQuery);
|
|
4532
4568
|
}
|
|
4533
4569
|
}
|
|
4534
4570
|
};
|
|
4535
4571
|
this.handleSearchIconClick = () => {
|
|
4536
|
-
const
|
|
4537
|
-
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value }, bubbles: true, composed: true }));
|
|
4538
|
-
this.handleSearch(
|
|
4572
|
+
const submittedQuery = this.input.value;
|
|
4573
|
+
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value: submittedQuery }, bubbles: true, composed: true }));
|
|
4574
|
+
this.handleSearch(submittedQuery);
|
|
4539
4575
|
};
|
|
4540
4576
|
this.handleDocumentClick = (e) => {
|
|
4541
4577
|
if (!this.contains(e.target)) {
|
|
@@ -4622,9 +4658,12 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4622
4658
|
}
|
|
4623
4659
|
if (name === "options" && newValue) {
|
|
4624
4660
|
try {
|
|
4625
|
-
|
|
4661
|
+
const parsed = JSON.parse(newValue);
|
|
4662
|
+
if (Array.isArray(parsed)) {
|
|
4663
|
+
this._options = parsed.map((item, index) => typeof item === "string" ? { id: index, title: item } : item);
|
|
4664
|
+
}
|
|
4626
4665
|
} catch (e) {
|
|
4627
|
-
this.
|
|
4666
|
+
this._options = newValue.split(",").map((s, index) => ({ id: index, title: s.trim() }));
|
|
4628
4667
|
}
|
|
4629
4668
|
} else if (name === "placeholder" && this.animatedPlaceholder) {
|
|
4630
4669
|
this.animatedPlaceholder.textContent = newValue || "Search...";
|
|
@@ -4641,11 +4680,7 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4641
4680
|
clearTimeout(this.searchTimeout);
|
|
4642
4681
|
this.searchTimeout = null;
|
|
4643
4682
|
}
|
|
4644
|
-
|
|
4645
|
-
this.dropdown.style.display = "none";
|
|
4646
|
-
return;
|
|
4647
|
-
}
|
|
4648
|
-
const results = this.options.filter((option) => option.toLowerCase().includes(query.toLowerCase()));
|
|
4683
|
+
const results = query ? this._options.filter((option) => option.title && option.title.toLowerCase().includes(query.toLowerCase())) : this._options;
|
|
4649
4684
|
this.highlightedIndex = -1;
|
|
4650
4685
|
this.renderDropdown(results);
|
|
4651
4686
|
}
|
|
@@ -4654,12 +4689,17 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4654
4689
|
this.dropdown.style.display = "none";
|
|
4655
4690
|
return;
|
|
4656
4691
|
}
|
|
4657
|
-
this.dropdown.innerHTML = results.map(
|
|
4692
|
+
this.dropdown.innerHTML = results.map(
|
|
4693
|
+
(r) => `<div class="dropdown-item" data-id="${r.id}">
|
|
4694
|
+
<div class="search-result-title">${r.title}</div>
|
|
4695
|
+
${r.subtitle ? `<div class="search-result-subtitle">${r.subtitle}</div>` : ""}
|
|
4696
|
+
</div>`
|
|
4697
|
+
).join("");
|
|
4658
4698
|
this.dropdown.style.display = "block";
|
|
4659
4699
|
const items = this.dropdown.querySelectorAll(".dropdown-item");
|
|
4660
4700
|
items.forEach((item, index) => {
|
|
4661
4701
|
item.addEventListener("click", () => {
|
|
4662
|
-
this.selectOption(
|
|
4702
|
+
this.selectOption(results[index]);
|
|
4663
4703
|
});
|
|
4664
4704
|
item.addEventListener("mouseenter", () => {
|
|
4665
4705
|
this.highlightedIndex = index;
|
|
@@ -4668,44 +4708,43 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4668
4708
|
});
|
|
4669
4709
|
this.updateHighlight(items);
|
|
4670
4710
|
}
|
|
4671
|
-
selectOption(
|
|
4672
|
-
this.input.value =
|
|
4711
|
+
selectOption(selectedItem) {
|
|
4712
|
+
this.input.value = selectedItem.title;
|
|
4673
4713
|
this.dropdown.style.display = "none";
|
|
4674
4714
|
this.highlightedIndex = -1;
|
|
4675
|
-
this.dispatchEvent(new CustomEvent("wavelength-search-select", { detail: { value }, bubbles: true, composed: true }));
|
|
4715
|
+
this.dispatchEvent(new CustomEvent("wavelength-search-select", { detail: { value: selectedItem }, bubbles: true, composed: true }));
|
|
4676
4716
|
}
|
|
4677
4717
|
// ---- Getters and Setters API ---- //
|
|
4678
4718
|
get value() {
|
|
4679
4719
|
return this.input.value;
|
|
4680
4720
|
}
|
|
4681
|
-
set value(
|
|
4682
|
-
this.input.value =
|
|
4721
|
+
set value(searchQueryText) {
|
|
4722
|
+
this.input.value = searchQueryText;
|
|
4683
4723
|
}
|
|
4684
|
-
get
|
|
4685
|
-
return this.
|
|
4724
|
+
get options() {
|
|
4725
|
+
return this._options;
|
|
4686
4726
|
}
|
|
4687
|
-
set
|
|
4688
|
-
if (val) {
|
|
4689
|
-
this.
|
|
4690
|
-
this.setAttribute("options", JSON.stringify(val));
|
|
4727
|
+
set options(val) {
|
|
4728
|
+
if (Array.isArray(val)) {
|
|
4729
|
+
this._options = val;
|
|
4691
4730
|
}
|
|
4692
4731
|
}
|
|
4693
4732
|
_syncStyles() {
|
|
4694
4733
|
this.styleAttributes.forEach((attr) => {
|
|
4695
|
-
const
|
|
4696
|
-
if (
|
|
4697
|
-
if (attr === "height" && ["small", "medium", "large"].includes(
|
|
4734
|
+
const attrValue = this.getAttribute(attr);
|
|
4735
|
+
if (attrValue) {
|
|
4736
|
+
if (attr === "height" && ["small", "medium", "large"].includes(attrValue)) {
|
|
4698
4737
|
} else {
|
|
4699
|
-
this.style.setProperty(`--${attr}`,
|
|
4738
|
+
this.style.setProperty(`--${attr}`, attrValue);
|
|
4700
4739
|
}
|
|
4701
4740
|
}
|
|
4702
4741
|
});
|
|
4703
4742
|
}
|
|
4704
|
-
updateHighlight(items) {
|
|
4743
|
+
updateHighlight(items, preventScroll = false) {
|
|
4705
4744
|
items.forEach((item, index) => {
|
|
4706
4745
|
const isHighlighted = index === this.highlightedIndex;
|
|
4707
4746
|
item.classList.toggle("highlighted", isHighlighted);
|
|
4708
|
-
if (isHighlighted) {
|
|
4747
|
+
if (isHighlighted && !preventScroll) {
|
|
4709
4748
|
item.scrollIntoView({ block: "nearest" });
|
|
4710
4749
|
}
|
|
4711
4750
|
});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@wavelengthusaf/web-components",
|
|
3
3
|
"author": "563 EWS - Wavelength",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.21.1",
|
|
6
6
|
"description": "Common component library used by Wavelength developers (NATIVE WEB COMPONENTS)",
|
|
7
7
|
"main": "/dist/cjs/index.cjs",
|
|
8
8
|
"module": "/dist/esm/index.js",
|