@wavelengthusaf/web-components 1.6.1 → 1.7.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/cjs/index.cjs +313 -27
- package/dist/cjs/index.d.cts +407 -1
- package/dist/esm/index.d.ts +407 -1
- package/dist/esm/index.js +286 -0
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -2317,7 +2317,7 @@ var WavelengthBanner = class extends HTMLElement {
|
|
|
2317
2317
|
this.updateAttributes();
|
|
2318
2318
|
}
|
|
2319
2319
|
updateAttributes() {
|
|
2320
|
-
const classificationRaw = _optionalChain([this, 'access',
|
|
2320
|
+
const classificationRaw = _optionalChain([this, 'access', _2 => _2.getAttribute, 'call', _3 => _3("classification"), 'optionalAccess', _4 => _4.toLowerCase, 'call', _5 => _5()]) || "";
|
|
2321
2321
|
const controlRaw = this.getAttribute("control") || "";
|
|
2322
2322
|
const controlList = controlRaw.split(",").map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
2323
2323
|
let bannerText = this.getAttribute("banner-text");
|
|
@@ -2569,9 +2569,9 @@ function unwrap(t) {
|
|
|
2569
2569
|
}
|
|
2570
2570
|
function isZodType(core, type) {
|
|
2571
2571
|
const anyCore = core;
|
|
2572
|
-
const typeName = _optionalChain([anyCore, 'optionalAccess',
|
|
2572
|
+
const typeName = _optionalChain([anyCore, 'optionalAccess', _6 => _6._def, 'optionalAccess', _7 => _7.typeName]);
|
|
2573
2573
|
if (typeof typeName === "string" && typeName === type) return true;
|
|
2574
|
-
const ctorName = _optionalChain([anyCore, 'optionalAccess',
|
|
2574
|
+
const ctorName = _optionalChain([anyCore, 'optionalAccess', _8 => _8.constructor, 'optionalAccess', _9 => _9.name]);
|
|
2575
2575
|
return ctorName === type;
|
|
2576
2576
|
}
|
|
2577
2577
|
function zodToFields(schema) {
|
|
@@ -2591,14 +2591,14 @@ function zodToFields(schema) {
|
|
|
2591
2591
|
type,
|
|
2592
2592
|
required: typeof anyZt.isOptional === "function" ? !anyZt.isOptional() : true
|
|
2593
2593
|
};
|
|
2594
|
-
const placeholder = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce((typeof anyZt.meta === "function" ? _optionalChain([anyZt, 'access',
|
|
2594
|
+
const placeholder = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce((typeof anyZt.meta === "function" ? _optionalChain([anyZt, 'access', _10 => _10.meta, 'call', _11 => _11(), 'optionalAccess', _12 => _12.placeholder]) : void 0), () => ( _optionalChain([anyZt, 'optionalAccess', _13 => _13.description]))), () => ( _optionalChain([anyZt, 'optionalAccess', _14 => _14._def, 'optionalAccess', _15 => _15.description]))), () => ( (typeof core.meta === "function" ? _optionalChain([core, 'access', _16 => _16.meta, 'call', _17 => _17(), 'optionalAccess', _18 => _18.placeholder]) : void 0))), () => ( _optionalChain([core, 'optionalAccess', _19 => _19.description]))), () => ( _optionalChain([core, 'optionalAccess', _20 => _20._def, 'optionalAccess', _21 => _21.description]))), () => ( field.label));
|
|
2595
2595
|
field.placeholder = placeholder;
|
|
2596
2596
|
if (type === "text") {
|
|
2597
|
-
const checks = _nullishCoalesce(_optionalChain([core, 'optionalAccess',
|
|
2597
|
+
const checks = _nullishCoalesce(_optionalChain([core, 'optionalAccess', _22 => _22._def, 'optionalAccess', _23 => _23.checks]), () => ( []));
|
|
2598
2598
|
for (const chk of checks) {
|
|
2599
|
-
const kind = chk.kind || _optionalChain([chk, 'access',
|
|
2600
|
-
const min = _nullishCoalesce(chk.value, () => ( _optionalChain([chk, 'access',
|
|
2601
|
-
const max = _nullishCoalesce(chk.value, () => ( _optionalChain([chk, 'access',
|
|
2599
|
+
const kind = chk.kind || _optionalChain([chk, 'access', _24 => _24._zod, 'optionalAccess', _25 => _25.def, 'optionalAccess', _26 => _26.check]);
|
|
2600
|
+
const min = _nullishCoalesce(chk.value, () => ( _optionalChain([chk, 'access', _27 => _27._zod, 'optionalAccess', _28 => _28.def, 'optionalAccess', _29 => _29.minimum])));
|
|
2601
|
+
const max = _nullishCoalesce(chk.value, () => ( _optionalChain([chk, 'access', _30 => _30._zod, 'optionalAccess', _31 => _31.def, 'optionalAccess', _32 => _32.maximum])));
|
|
2602
2602
|
if ((kind === "min" || kind === "min_length") && typeof min === "number") {
|
|
2603
2603
|
field.minLength = min;
|
|
2604
2604
|
}
|
|
@@ -2670,7 +2670,7 @@ var WavelengthForm = class extends HTMLElement {
|
|
|
2670
2670
|
// --- Event handlers ---
|
|
2671
2671
|
this.onInputChange = (name, rawValue) => {
|
|
2672
2672
|
this._value = { ...this._value, [name]: rawValue };
|
|
2673
|
-
const res = _optionalChain([this, 'access',
|
|
2673
|
+
const res = _optionalChain([this, 'access', _33 => _33._validator, 'optionalAccess', _34 => _34.validate, 'call', _35 => _35(this._value)]);
|
|
2674
2674
|
const issues = res && !res.isValid ? _nullishCoalesce(res.issues, () => ( [])) : [];
|
|
2675
2675
|
this.dispatchEvent(
|
|
2676
2676
|
new CustomEvent("form-change", {
|
|
@@ -2899,7 +2899,7 @@ var WavelengthForm = class extends HTMLElement {
|
|
|
2899
2899
|
if (res.isValid) {
|
|
2900
2900
|
this.setFieldError(name, void 0);
|
|
2901
2901
|
} else {
|
|
2902
|
-
const issues = _nullishCoalesce(_optionalChain([res, 'access',
|
|
2902
|
+
const issues = _nullishCoalesce(_optionalChain([res, 'access', _36 => _36.issues, 'optionalAccess', _37 => _37.filter, 'call', _38 => _38((i) => _optionalChain([i, 'access', _39 => _39.path, 'optionalAccess', _40 => _40[0]]) === name)]), () => ( []));
|
|
2903
2903
|
const messages = issues.map((i) => i.message).join("\n");
|
|
2904
2904
|
this.setFieldError(name, issues.length > 0 ? messages : "Invalid value");
|
|
2905
2905
|
}
|
|
@@ -2915,7 +2915,7 @@ var WavelengthForm = class extends HTMLElement {
|
|
|
2915
2915
|
return { isValid: true, value: res.value, issues: [] };
|
|
2916
2916
|
}
|
|
2917
2917
|
for (const f of this._fields) {
|
|
2918
|
-
const issues = _nullishCoalesce(_optionalChain([res, 'access',
|
|
2918
|
+
const issues = _nullishCoalesce(_optionalChain([res, 'access', _41 => _41.issues, 'optionalAccess', _42 => _42.filter, 'call', _43 => _43((i) => _optionalChain([i, 'access', _44 => _44.path, 'optionalAccess', _45 => _45[0]]) === f.name)]), () => ( []));
|
|
2919
2919
|
if (issues.length > 0) {
|
|
2920
2920
|
const messages = issues.map((i) => i.message).join("\n");
|
|
2921
2921
|
this.setFieldError(f.name, messages);
|
|
@@ -3045,7 +3045,7 @@ var WavelengthForm = class extends HTMLElement {
|
|
|
3045
3045
|
rightSlot.className = "right";
|
|
3046
3046
|
const buildButton = (cfg, defaultEvent) => {
|
|
3047
3047
|
const btn = document.createElement("wavelength-button");
|
|
3048
|
-
const requestedType = _nullishCoalesce(_optionalChain([cfg, 'access',
|
|
3048
|
+
const requestedType = _nullishCoalesce(_optionalChain([cfg, 'access', _46 => _46.buttonProps, 'optionalAccess', _47 => _47.type]), () => ( ""));
|
|
3049
3049
|
const type = requestedType === "submit" ? "submit" : "button";
|
|
3050
3050
|
if (cfg.buttonProps) {
|
|
3051
3051
|
for (const [key, value] of Object.entries(cfg.buttonProps)) {
|
|
@@ -3313,7 +3313,7 @@ var BaseWavelengthInput = class extends HTMLElement {
|
|
|
3313
3313
|
this._applyAttributes();
|
|
3314
3314
|
this._setupDebouncedValidation();
|
|
3315
3315
|
const maxLengthAttr = this.getAttribute("max-length");
|
|
3316
|
-
const value = _optionalChain([this, 'access',
|
|
3316
|
+
const value = _optionalChain([this, 'access', _48 => _48.inputEl, 'optionalAccess', _49 => _49.value, 'optionalAccess', _50 => _50.trim, 'optionalCall', _51 => _51()]) || "";
|
|
3317
3317
|
this.inputEl.addEventListener("input", this._onInput);
|
|
3318
3318
|
this.inputEl.addEventListener("blur", this._onBlur);
|
|
3319
3319
|
this.inputEl.addEventListener("focus", this._onFocus);
|
|
@@ -3794,8 +3794,8 @@ var WavelengthTitleBar = class extends HTMLElement {
|
|
|
3794
3794
|
}
|
|
3795
3795
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
3796
3796
|
if (oldValue === newValue) return;
|
|
3797
|
-
const titleElement = _optionalChain([this, 'access',
|
|
3798
|
-
const subtitleElement = _optionalChain([this, 'access',
|
|
3797
|
+
const titleElement = _optionalChain([this, 'access', _52 => _52.shadowRoot, 'optionalAccess', _53 => _53.querySelector, 'call', _54 => _54(".title")]);
|
|
3798
|
+
const subtitleElement = _optionalChain([this, 'access', _55 => _55.shadowRoot, 'optionalAccess', _56 => _56.querySelector, 'call', _57 => _57(".subtitle")]);
|
|
3799
3799
|
switch (name) {
|
|
3800
3800
|
case "title-text":
|
|
3801
3801
|
if (titleElement) titleElement.textContent = newValue;
|
|
@@ -4541,7 +4541,7 @@ var BaseWavelengthMultiSelectAutocomplete = class extends HTMLElement {
|
|
|
4541
4541
|
</svg>
|
|
4542
4542
|
</span>
|
|
4543
4543
|
`;
|
|
4544
|
-
_optionalChain([chip, 'access',
|
|
4544
|
+
_optionalChain([chip, 'access', _58 => _58.querySelector, 'call', _59 => _59(".multi-select-remove-button"), 'optionalAccess', _60 => _60.addEventListener, 'call', _61 => _61("click", (e) => {
|
|
4545
4545
|
e.stopPropagation();
|
|
4546
4546
|
this.handleRemoveChip(opt);
|
|
4547
4547
|
})]);
|
|
@@ -4739,7 +4739,7 @@ var WavelengthNavBar = class extends HTMLElement {
|
|
|
4739
4739
|
super();
|
|
4740
4740
|
const shadow = this.attachShadow({ mode: "open" });
|
|
4741
4741
|
shadow.appendChild(template4.content.cloneNode(true));
|
|
4742
|
-
_optionalChain([shadow, 'access',
|
|
4742
|
+
_optionalChain([shadow, 'access', _62 => _62.querySelector, 'call', _63 => _63("#logo"), 'optionalAccess', _64 => _64.addEventListener, 'call', _65 => _65("click", () => {
|
|
4743
4743
|
this.dispatchEvent(new CustomEvent("home-click"));
|
|
4744
4744
|
})]);
|
|
4745
4745
|
}
|
|
@@ -4759,7 +4759,7 @@ var WavelengthNavBar = class extends HTMLElement {
|
|
|
4759
4759
|
this.style.setProperty("--border", this.getAttribute("border") || "1px solid #ddd");
|
|
4760
4760
|
}
|
|
4761
4761
|
renderTabs() {
|
|
4762
|
-
const container = _optionalChain([this, 'access',
|
|
4762
|
+
const container = _optionalChain([this, 'access', _66 => _66.shadowRoot, 'optionalAccess', _67 => _67.querySelector, 'call', _68 => _68(".middle-tab-group")]);
|
|
4763
4763
|
if (!container) return;
|
|
4764
4764
|
container.innerHTML = "";
|
|
4765
4765
|
const itemsAttr = this.getAttribute("items");
|
|
@@ -5662,26 +5662,26 @@ var WavelengthFileDropZone = class extends HTMLElement {
|
|
|
5662
5662
|
if (!this.dropZone || !this.fileInput) return;
|
|
5663
5663
|
this.dropZone.addEventListener("dragover", (e) => {
|
|
5664
5664
|
e.preventDefault();
|
|
5665
|
-
_optionalChain([this, 'access',
|
|
5665
|
+
_optionalChain([this, 'access', _69 => _69.dropZone, 'optionalAccess', _70 => _70.classList, 'access', _71 => _71.add, 'call', _72 => _72("dragover")]);
|
|
5666
5666
|
});
|
|
5667
5667
|
this.dropZone.addEventListener("dragleave", (e) => {
|
|
5668
5668
|
e.preventDefault();
|
|
5669
|
-
_optionalChain([this, 'access',
|
|
5669
|
+
_optionalChain([this, 'access', _73 => _73.dropZone, 'optionalAccess', _74 => _74.classList, 'access', _75 => _75.remove, 'call', _76 => _76("dragover")]);
|
|
5670
5670
|
});
|
|
5671
5671
|
this.dropZone.addEventListener("drop", (e) => {
|
|
5672
5672
|
e.preventDefault();
|
|
5673
|
-
_optionalChain([this, 'access',
|
|
5674
|
-
const files = _optionalChain([e, 'access',
|
|
5675
|
-
if (_optionalChain([files, 'optionalAccess',
|
|
5673
|
+
_optionalChain([this, 'access', _77 => _77.dropZone, 'optionalAccess', _78 => _78.classList, 'access', _79 => _79.remove, 'call', _80 => _80("dragover")]);
|
|
5674
|
+
const files = _optionalChain([e, 'access', _81 => _81.dataTransfer, 'optionalAccess', _82 => _82.files]);
|
|
5675
|
+
if (_optionalChain([files, 'optionalAccess', _83 => _83.length])) {
|
|
5676
5676
|
this.validateAndProcessFiles(files);
|
|
5677
5677
|
}
|
|
5678
5678
|
});
|
|
5679
5679
|
this.dropZone.addEventListener("click", () => {
|
|
5680
|
-
_optionalChain([this, 'access',
|
|
5680
|
+
_optionalChain([this, 'access', _84 => _84.fileInput, 'optionalAccess', _85 => _85.click, 'call', _86 => _86()]);
|
|
5681
5681
|
});
|
|
5682
5682
|
this.fileInput.addEventListener("change", (event) => {
|
|
5683
5683
|
const input = event.target;
|
|
5684
|
-
if (_optionalChain([input, 'access',
|
|
5684
|
+
if (_optionalChain([input, 'access', _87 => _87.files, 'optionalAccess', _88 => _88.length])) {
|
|
5685
5685
|
this.validateAndProcessFiles(input.files);
|
|
5686
5686
|
}
|
|
5687
5687
|
});
|
|
@@ -5689,7 +5689,7 @@ var WavelengthFileDropZone = class extends HTMLElement {
|
|
|
5689
5689
|
validateAndProcessFiles(files) {
|
|
5690
5690
|
const fileList = Array.from(files);
|
|
5691
5691
|
let errorMessage = "";
|
|
5692
|
-
const acceptedTypes = _optionalChain([this, 'access',
|
|
5692
|
+
const acceptedTypes = _optionalChain([this, 'access', _89 => _89.getAttribute, 'call', _90 => _90("accepted-types"), 'optionalAccess', _91 => _91.split, 'call', _92 => _92(",")]) || [];
|
|
5693
5693
|
if (acceptedTypes.length) {
|
|
5694
5694
|
const invalidFiles = fileList.filter((file) => !acceptedTypes.some((type) => file.name.toLowerCase().endsWith(type.toLowerCase().replace("*", ""))));
|
|
5695
5695
|
if (invalidFiles.length) {
|
|
@@ -5732,6 +5732,292 @@ var WavelengthFileDropZone = class extends HTMLElement {
|
|
|
5732
5732
|
};
|
|
5733
5733
|
customElements.define("wavelength-file-drop-zone", WavelengthFileDropZone);
|
|
5734
5734
|
|
|
5735
|
+
// src/web-components/wavelength-dropdown.ts
|
|
5736
|
+
var template6 = document.createElement("template");
|
|
5737
|
+
template6.innerHTML = `
|
|
5738
|
+
<style>
|
|
5739
|
+
:host {
|
|
5740
|
+
display: inline-block;
|
|
5741
|
+
position: relative;
|
|
5742
|
+
font-family: inherit;
|
|
5743
|
+
font-size: inherit;
|
|
5744
|
+
}
|
|
5745
|
+
|
|
5746
|
+
.dropdown-box{
|
|
5747
|
+
width: 100%;
|
|
5748
|
+
height: 100%;
|
|
5749
|
+
}
|
|
5750
|
+
|
|
5751
|
+
.dropdown-field {
|
|
5752
|
+
user-select: none;
|
|
5753
|
+
height: inherit;
|
|
5754
|
+
display: flex;
|
|
5755
|
+
align-items: center;
|
|
5756
|
+
justify-content: space-between;
|
|
5757
|
+
cursor: pointer;
|
|
5758
|
+
border: 1px solid black;
|
|
5759
|
+
gap: 4px;
|
|
5760
|
+
padding: 0 8px;
|
|
5761
|
+
}
|
|
5762
|
+
|
|
5763
|
+
.selected {
|
|
5764
|
+
display: flex;
|
|
5765
|
+
height: inherit;
|
|
5766
|
+
width: inherit;
|
|
5767
|
+
overflow: hidden;
|
|
5768
|
+
white-space: nowrap;
|
|
5769
|
+
align-items: center;
|
|
5770
|
+
}
|
|
5771
|
+
|
|
5772
|
+
.arrow {
|
|
5773
|
+
width: 10px;
|
|
5774
|
+
height: 1px;
|
|
5775
|
+
background: black;
|
|
5776
|
+
margin: 8px;
|
|
5777
|
+
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
|
|
5778
|
+
transform: rotate(180deg);
|
|
5779
|
+
}
|
|
5780
|
+
|
|
5781
|
+
.arrow.active {
|
|
5782
|
+
transform: rotate(0deg);
|
|
5783
|
+
}
|
|
5784
|
+
|
|
5785
|
+
.options-list {
|
|
5786
|
+
position: relative;
|
|
5787
|
+
left: 0;
|
|
5788
|
+
right: 0;
|
|
5789
|
+
margin: 0;
|
|
5790
|
+
padding: 0;
|
|
5791
|
+
list-style: none;
|
|
5792
|
+
overflow-y: auto;
|
|
5793
|
+
display: none;
|
|
5794
|
+
z-index: 10;
|
|
5795
|
+
box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);
|
|
5796
|
+
}
|
|
5797
|
+
|
|
5798
|
+
.options-list.show {
|
|
5799
|
+
display: inline-block;
|
|
5800
|
+
}
|
|
5801
|
+
</style>
|
|
5802
|
+
|
|
5803
|
+
<div class="dropdown-box" tabindex="0">
|
|
5804
|
+
<div class="dropdown-field">
|
|
5805
|
+
<span class="selected"></span>
|
|
5806
|
+
<i class="arrow"></i>
|
|
5807
|
+
</div>
|
|
5808
|
+
<ul class="options-list"></ul>
|
|
5809
|
+
</div>
|
|
5810
|
+
`;
|
|
5811
|
+
var WavelengthDropdown = class extends HTMLElement {
|
|
5812
|
+
constructor() {
|
|
5813
|
+
super();
|
|
5814
|
+
this._options = [];
|
|
5815
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
5816
|
+
shadow.appendChild(template6.content.cloneNode(true));
|
|
5817
|
+
this.dropdownField = shadow.querySelector(".dropdown-field");
|
|
5818
|
+
this.dropdownBox = shadow.querySelector(".dropdown-box");
|
|
5819
|
+
this.selectedSpan = shadow.querySelector(".selected");
|
|
5820
|
+
this.arrow = shadow.querySelector(".arrow");
|
|
5821
|
+
this.optionsList = shadow.querySelector(".options-list");
|
|
5822
|
+
this._selectedValue = this.getAttribute("default-value");
|
|
5823
|
+
}
|
|
5824
|
+
static get observedAttributes() {
|
|
5825
|
+
return ["options", "default-value", "color", "font-size", "font-family", "border-radius", "width", "height", "arrow-size", "popup-radius", "popup-align", "popup-selected-color"];
|
|
5826
|
+
}
|
|
5827
|
+
connectedCallback() {
|
|
5828
|
+
this.parseOptionsAttribute();
|
|
5829
|
+
this.applyStyles();
|
|
5830
|
+
this.dropdownField.addEventListener("click", () => {
|
|
5831
|
+
this.optionsList.classList.toggle("show");
|
|
5832
|
+
this.arrow.classList.toggle("active");
|
|
5833
|
+
});
|
|
5834
|
+
document.addEventListener("click", (e) => {
|
|
5835
|
+
if (!this.contains(e.target)) {
|
|
5836
|
+
this.optionsList.classList.remove("show");
|
|
5837
|
+
this.arrow.classList.remove("active");
|
|
5838
|
+
}
|
|
5839
|
+
});
|
|
5840
|
+
}
|
|
5841
|
+
attributeChangedCallback() {
|
|
5842
|
+
this.parseOptionsAttribute();
|
|
5843
|
+
this.setDefaultValue();
|
|
5844
|
+
this.applyStyles();
|
|
5845
|
+
}
|
|
5846
|
+
parseOptionsAttribute() {
|
|
5847
|
+
const attr = this.getAttribute("options");
|
|
5848
|
+
if (!attr) return;
|
|
5849
|
+
this._options = JSON.parse(attr);
|
|
5850
|
+
this.renderOptions();
|
|
5851
|
+
}
|
|
5852
|
+
setDefaultValue() {
|
|
5853
|
+
const defaultValue = this.getAttribute("default-value");
|
|
5854
|
+
if (defaultValue) {
|
|
5855
|
+
const match = this._options.find((o) => o.value === defaultValue);
|
|
5856
|
+
this.setSelected(match || this._options[0]);
|
|
5857
|
+
} else {
|
|
5858
|
+
this.setSelected(this._options[0]);
|
|
5859
|
+
}
|
|
5860
|
+
}
|
|
5861
|
+
renderOptions() {
|
|
5862
|
+
this.optionsList.innerHTML = "";
|
|
5863
|
+
this._options.forEach((opt) => {
|
|
5864
|
+
const li = document.createElement("li");
|
|
5865
|
+
li.textContent = opt.value;
|
|
5866
|
+
li.style.padding = "8px";
|
|
5867
|
+
li.style.whiteSpace = "nowrap";
|
|
5868
|
+
li.style.overflow = "visible";
|
|
5869
|
+
li.style.textOverflow = "clip";
|
|
5870
|
+
li.style.fontSize = this.getAttribute("font-size") || this.style.fontSize || "inherit";
|
|
5871
|
+
li.style.fontFamily = this.getAttribute("font-family") || this.style.fontFamily || "inherit";
|
|
5872
|
+
li.style.color = "#000";
|
|
5873
|
+
const originalBg = li.style.backgroundColor;
|
|
5874
|
+
li.addEventListener("mouseenter", () => {
|
|
5875
|
+
li.style.backgroundColor = "#eee";
|
|
5876
|
+
});
|
|
5877
|
+
li.addEventListener("mouseleave", () => {
|
|
5878
|
+
if (this._selectedValue === opt.value) {
|
|
5879
|
+
li.style.backgroundColor = this.getAttribute("popup-selected-color") || "";
|
|
5880
|
+
} else {
|
|
5881
|
+
li.style.backgroundColor = originalBg;
|
|
5882
|
+
}
|
|
5883
|
+
});
|
|
5884
|
+
li.addEventListener("click", () => {
|
|
5885
|
+
this.setSelected(opt);
|
|
5886
|
+
this.optionsList.classList.remove("show");
|
|
5887
|
+
this.arrow.classList.remove("active");
|
|
5888
|
+
const event = new CustomEvent("change", {
|
|
5889
|
+
detail: { value: opt.value },
|
|
5890
|
+
bubbles: true,
|
|
5891
|
+
composed: true
|
|
5892
|
+
});
|
|
5893
|
+
this.dispatchEvent(event);
|
|
5894
|
+
});
|
|
5895
|
+
this.optionsList.appendChild(li);
|
|
5896
|
+
});
|
|
5897
|
+
}
|
|
5898
|
+
setSelected(opt) {
|
|
5899
|
+
if (!opt) return;
|
|
5900
|
+
if (opt.label) {
|
|
5901
|
+
this.selectedSpan.textContent = opt.label;
|
|
5902
|
+
} else {
|
|
5903
|
+
this.selectedSpan.textContent = opt.value;
|
|
5904
|
+
}
|
|
5905
|
+
this.dropdownField.style.backgroundColor = opt.color || "";
|
|
5906
|
+
const children = Array.from(this.optionsList.childNodes.entries(), ([_, child]) => child);
|
|
5907
|
+
children.map((child) => {
|
|
5908
|
+
if (child.textContent === opt.value) {
|
|
5909
|
+
child.style.backgroundColor = this.getAttribute("popup-selected-color") || "";
|
|
5910
|
+
} else {
|
|
5911
|
+
child.style.backgroundColor = this.optionsList.style.backgroundColor;
|
|
5912
|
+
}
|
|
5913
|
+
});
|
|
5914
|
+
}
|
|
5915
|
+
applyStyles() {
|
|
5916
|
+
const style = this.style;
|
|
5917
|
+
Object.assign(this.dropdownBox.style, {
|
|
5918
|
+
width: this.getAttribute("width") || style.width,
|
|
5919
|
+
height: this.getAttribute("height") || style.height
|
|
5920
|
+
});
|
|
5921
|
+
Object.assign(this.dropdownField.style, {
|
|
5922
|
+
borderRadius: this.getAttribute("border-radius") || style.borderRadius,
|
|
5923
|
+
fontSize: this.getAttribute("font-size") || style.fontSize,
|
|
5924
|
+
fontFamily: this.getAttribute("font-family") || style.fontFamily,
|
|
5925
|
+
color: this.getAttribute("color") || "#000"
|
|
5926
|
+
});
|
|
5927
|
+
this.dropdownBox.style.minWidth = this.getAttribute("width") || "auto";
|
|
5928
|
+
const arrow = this.dropdownField.querySelector(".arrow");
|
|
5929
|
+
arrow.style.padding = this.getAttribute("arrow-size") || "2px";
|
|
5930
|
+
this.optionsList.style.minWidth = "auto";
|
|
5931
|
+
const popupAlign = this.getAttribute("popup-align") || "left";
|
|
5932
|
+
switch (popupAlign) {
|
|
5933
|
+
case "center":
|
|
5934
|
+
this.optionsList.style.left = "50%";
|
|
5935
|
+
this.optionsList.style.transform = "translateX(-50%)";
|
|
5936
|
+
this.optionsList.style.right = "auto";
|
|
5937
|
+
break;
|
|
5938
|
+
case "right":
|
|
5939
|
+
this.optionsList.style.left = "auto";
|
|
5940
|
+
this.optionsList.style.right = "0";
|
|
5941
|
+
this.optionsList.style.transform = "none";
|
|
5942
|
+
break;
|
|
5943
|
+
case "left":
|
|
5944
|
+
default:
|
|
5945
|
+
this.optionsList.style.left = "0";
|
|
5946
|
+
this.optionsList.style.right = "auto";
|
|
5947
|
+
this.optionsList.style.transform = "none";
|
|
5948
|
+
break;
|
|
5949
|
+
}
|
|
5950
|
+
this.optionsList.style.backgroundColor = "white";
|
|
5951
|
+
this.optionsList.style.borderRadius = this.getAttribute("popup-radius") || this.getAttribute("border-radius") || "4px";
|
|
5952
|
+
}
|
|
5953
|
+
get value() {
|
|
5954
|
+
return this._selectedValue;
|
|
5955
|
+
}
|
|
5956
|
+
set value(val) {
|
|
5957
|
+
const opt = this._options.find((o) => o.value === val);
|
|
5958
|
+
if (opt) {
|
|
5959
|
+
this._selectedValue = opt.value;
|
|
5960
|
+
this.setSelected(opt);
|
|
5961
|
+
}
|
|
5962
|
+
}
|
|
5963
|
+
get color() {
|
|
5964
|
+
return this.selectedSpan.style.backgroundColor || "";
|
|
5965
|
+
}
|
|
5966
|
+
set color(col) {
|
|
5967
|
+
const opt = this._options.find((o) => o.color === col);
|
|
5968
|
+
if (opt) this.setSelected(opt);
|
|
5969
|
+
}
|
|
5970
|
+
};
|
|
5971
|
+
if (!customElements.get("wavelength-dropdown")) {
|
|
5972
|
+
customElements.define("wavelength-dropdown", WavelengthDropdown);
|
|
5973
|
+
}
|
|
5974
|
+
|
|
5975
|
+
// src/web-components/wavelength-planetrail.template.html
|
|
5976
|
+
var wavelength_planetrail_template_default = '<style>\n :host {\n display: block;\n --color: #00308F;\n }\n .flex-container {\n display: flex;\n align-items: center;\n }\n\n #inner {\n border-radius: 25px;\n height: 2px;\n flex-grow: 1;\n background-color: var(--color);\n }\n\n #path {\n fill: var(--color);\n }\n</style>\n\n<div id="outer" class="flex-container" >\n <div id="inner">\n </div>\n <div>\n <svg id="plane" width="40" height="40">\n <path\n d="M 4.1666 16.3988 L 5.7608 16.3988 L 8.1645 19.6359 L 18.2616 19.6359 L 14.1291 5.6667 L 16.2425 5.6667 L 24.5075 19.6359 L 33.985 19.6359 C 34.5022 19.6359 34.9422 19.8172 35.305 20.18 C 35.6677 20.5428 35.8491 20.9828 35.8491 21.5 C 35.8491 22.0172 35.6677 22.4572 35.305 22.82 C 34.9422 23.1828 34.5022 23.3642 33.985 23.3642 L 24.5075 23.3642 L 16.2425 37.3334 L 14.1291 37.3334 L 18.2616 23.3642 L 8.1966 23.3642 L 5.7608 26.6013 L 4.1666 26.6013 L 5.6433 21.5 L 4.1666 16.3988 Z"\n id="path"\n />\n </svg>\n </div>\n</div>\n';
|
|
5977
|
+
|
|
5978
|
+
// src/web-components/wavelength-planetrail.ts
|
|
5979
|
+
var BasePlaneTrail = class extends HTMLElement {
|
|
5980
|
+
static get observedAttributes() {
|
|
5981
|
+
return ["traildir", "color"];
|
|
5982
|
+
}
|
|
5983
|
+
constructor() {
|
|
5984
|
+
super();
|
|
5985
|
+
this.shadow = this.attachShadow({ mode: "open" });
|
|
5986
|
+
this.shadow.innerHTML = wavelength_planetrail_template_default;
|
|
5987
|
+
this.plane = this.shadow.querySelector("#plane");
|
|
5988
|
+
this.outer = this.shadow.querySelector("#outer");
|
|
5989
|
+
this.inner = this.shadow.querySelector("#inner");
|
|
5990
|
+
}
|
|
5991
|
+
connectedCallback() {
|
|
5992
|
+
this.updateComponent();
|
|
5993
|
+
}
|
|
5994
|
+
attributeChangedCallback() {
|
|
5995
|
+
this.updateComponent();
|
|
5996
|
+
}
|
|
5997
|
+
updateComponent() {
|
|
5998
|
+
const trailDir = this.getAttribute("traildir") || "right";
|
|
5999
|
+
const color = this.getAttribute("color") || "#00308F";
|
|
6000
|
+
this.style.setProperty("--color", color);
|
|
6001
|
+
this.plane.style.setProperty("transform", trailDir === "right" ? "" : "matrix(-1, 0, 0, 1, 0, 0)");
|
|
6002
|
+
this.outer.style.setProperty("flex-direction", trailDir === "right" ? "row" : "row-reverse");
|
|
6003
|
+
this.outer.style.setProperty("justify-content", trailDir === "right" ? "right" : "left");
|
|
6004
|
+
if (trailDir === "right") {
|
|
6005
|
+
this.inner.style.setProperty("margin-right", "10px");
|
|
6006
|
+
this.inner.style.setProperty("margin-left", "0px");
|
|
6007
|
+
} else {
|
|
6008
|
+
this.inner.style.setProperty("margin-left", "10px");
|
|
6009
|
+
this.inner.style.setProperty("margin-right", "0px");
|
|
6010
|
+
}
|
|
6011
|
+
}
|
|
6012
|
+
};
|
|
6013
|
+
var WavelengthPlaneTrail = class extends StylingMixin(BasePlaneTrail) {
|
|
6014
|
+
};
|
|
6015
|
+
if (!customElements.get("wavelength-planetrail")) {
|
|
6016
|
+
customElements.define("wavelength-planetrail", WavelengthPlaneTrail);
|
|
6017
|
+
}
|
|
6018
|
+
|
|
6019
|
+
|
|
6020
|
+
|
|
5735
6021
|
|
|
5736
6022
|
|
|
5737
6023
|
|
|
@@ -5748,7 +6034,7 @@ customElements.define("wavelength-file-drop-zone", WavelengthFileDropZone);
|
|
|
5748
6034
|
|
|
5749
6035
|
|
|
5750
6036
|
|
|
5751
|
-
exports.BaseWavelengthInput = BaseWavelengthInput; exports.BaseWavelengthMultiSelectAutocomplete = BaseWavelengthMultiSelectAutocomplete; exports.ChildDataTable = ChildDataTable; exports.SampleComponent = SampleComponent; exports.WavelengthBanner = WavelengthBanner; exports.WavelengthButton = WavelengthButton; exports.WavelengthCheckbox = WavelengthCheckbox; exports.WavelengthDatePicker = WavelengthDatePicker; exports.WavelengthFileDropZone = WavelengthFileDropZone; exports.WavelengthForm = WavelengthForm; exports.WavelengthInput = WavelengthInput; exports.WavelengthMultiSelectAutocomplete = WavelengthMultiSelectAutocomplete; exports.WavelengthNavBar = WavelengthNavBar; exports.WavelengthNotificationPanel = WavelengthNotificationPanel; exports.WavelengthProgressBar = WavelengthProgressBar; exports.WavelengthTitleBar = WavelengthTitleBar;
|
|
6037
|
+
exports.BaseWavelengthInput = BaseWavelengthInput; exports.BaseWavelengthMultiSelectAutocomplete = BaseWavelengthMultiSelectAutocomplete; exports.ChildDataTable = ChildDataTable; exports.SampleComponent = SampleComponent; exports.WavelengthBanner = WavelengthBanner; exports.WavelengthButton = WavelengthButton; exports.WavelengthCheckbox = WavelengthCheckbox; exports.WavelengthDatePicker = WavelengthDatePicker; exports.WavelengthDropdown = WavelengthDropdown; exports.WavelengthFileDropZone = WavelengthFileDropZone; exports.WavelengthForm = WavelengthForm; exports.WavelengthInput = WavelengthInput; exports.WavelengthMultiSelectAutocomplete = WavelengthMultiSelectAutocomplete; exports.WavelengthNavBar = WavelengthNavBar; exports.WavelengthNotificationPanel = WavelengthNotificationPanel; exports.WavelengthPlaneTrail = WavelengthPlaneTrail; exports.WavelengthProgressBar = WavelengthProgressBar; exports.WavelengthTitleBar = WavelengthTitleBar;
|
|
5752
6038
|
/*! Bundled license information:
|
|
5753
6039
|
|
|
5754
6040
|
react/cjs/react.production.min.js:
|