@wavelengthusaf/web-components 1.9.0 → 1.11.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 +282 -1
- package/dist/cjs/index.d.cts +44 -1
- package/dist/esm/index.d.ts +44 -1
- package/dist/esm/index.js +281 -0
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -6227,6 +6227,287 @@ if (!customElements.get("wavelength-tooltip")) {
|
|
|
6227
6227
|
customElements.define("wavelength-tooltip", WavelengthToolTip);
|
|
6228
6228
|
}
|
|
6229
6229
|
|
|
6230
|
+
// src/web-components/wavelength-menu.template.html
|
|
6231
|
+
var wavelength_menu_template_default = '<style>\n :host {\n display: block;\n --background-color: white;\n --text-color: black;\n --font: Arial, Helvetica, sans-serif;\n --font-size: 12px;\n --border: 0px solid #ccc;\n --padding: 5px;\n --border-radius: 3px;\n --selected-color: #5799ea;\n --disabled-color: #d1d1d1;\n }\n .flex-container {\n overflow-y: scroll;\n height: 125px;\n width: 175px;\n flex-direction: column;\n background-color: var(--background-color);\n border: var(--border);\n border-radius: var(--border-radius);\n padding: var(--padding);\n margin: 5px;\n box-shadow: 4px 5px 7px 4px rgba(0, 0, 0, 0.1);\n }\n .menu-item {\n display: block;\n padding: var(--padding);\n margin: 5px;\n font-size: var(--font-size);\n font-family: var(--font);\n color: var(--text-color);\n background-color: var(--background-color);\n cursor: pointer;\n transition: background-color 0.1s ease;\n border-radius: var(--border-radius);\n }\n .menu-item:hover {\n background-color: #f0f0f0;\n }\n .menu-item.selected {\n background-color: var(--selected-color) !important;\n color: white !important;\n }\n .menu-item:focus {\n background-color: #d1d1d1;\n }\n .menu-item:active {\n background-color: #d1d1d1;\n }\n .menu-item.disabled {\n color: var(--disabled-color);\n background-color: var(--background-color);\n cursor: not-allowed;\n pointer-events: none;\n opacity: 0.6;\n }\n</style>\n<div class="flex-container"></div>\n';
|
|
6232
|
+
|
|
6233
|
+
// src/web-components/wavelength-menu.ts
|
|
6234
|
+
var WavelengthMenu = class extends HTMLElement {
|
|
6235
|
+
constructor() {
|
|
6236
|
+
super();
|
|
6237
|
+
this._items = [];
|
|
6238
|
+
this._selectedIndex = -1;
|
|
6239
|
+
this._selectedId = null;
|
|
6240
|
+
this._onItemClick = (e) => {
|
|
6241
|
+
const menuItem = e.target.closest(".menu-item");
|
|
6242
|
+
if (!menuItem || menuItem.classList.contains("disabled")) return;
|
|
6243
|
+
const index = parseInt(menuItem.getAttribute("data-index") || "-1");
|
|
6244
|
+
const isAlreadySelected = menuItem.classList.contains("selected");
|
|
6245
|
+
const menuItems = this._shadow.querySelectorAll(".menu-item");
|
|
6246
|
+
menuItems.forEach((item) => item.classList.remove("selected"));
|
|
6247
|
+
if (!isAlreadySelected) {
|
|
6248
|
+
menuItem.classList.add("selected");
|
|
6249
|
+
this._selectedIndex = index;
|
|
6250
|
+
this._selectedId = menuItem.getAttribute("data-id");
|
|
6251
|
+
} else {
|
|
6252
|
+
this._selectedIndex = -1;
|
|
6253
|
+
this._selectedId = null;
|
|
6254
|
+
}
|
|
6255
|
+
this._dispatchSelectEvent();
|
|
6256
|
+
};
|
|
6257
|
+
this._shadow = this.attachShadow({ mode: "open" });
|
|
6258
|
+
this._shadow.innerHTML = wavelength_menu_template_default;
|
|
6259
|
+
this._flexContainer = this._shadow.querySelector(".flex-container");
|
|
6260
|
+
try {
|
|
6261
|
+
this._items = JSON.parse(this.getAttribute("items") || "[]");
|
|
6262
|
+
} catch (e) {
|
|
6263
|
+
this._items = [];
|
|
6264
|
+
}
|
|
6265
|
+
}
|
|
6266
|
+
static get observedAttributes() {
|
|
6267
|
+
return ["background-color", "text-color", "font", "font-size", "border", "padding", "border-radius", "selected-color", "items", "disabled-color"];
|
|
6268
|
+
}
|
|
6269
|
+
// Getter for items array.
|
|
6270
|
+
get items() {
|
|
6271
|
+
return this._items;
|
|
6272
|
+
}
|
|
6273
|
+
set items(value) {
|
|
6274
|
+
this._items = Array.isArray(value) ? value : [];
|
|
6275
|
+
this.render();
|
|
6276
|
+
}
|
|
6277
|
+
get value() {
|
|
6278
|
+
return _nullishCoalesce(this._items[this._selectedIndex], () => ( null));
|
|
6279
|
+
}
|
|
6280
|
+
connectedCallback() {
|
|
6281
|
+
this.render();
|
|
6282
|
+
this._flexContainer.addEventListener("click", this._onItemClick);
|
|
6283
|
+
}
|
|
6284
|
+
disconnectedCallback() {
|
|
6285
|
+
this._flexContainer.removeEventListener("click", this._onItemClick);
|
|
6286
|
+
}
|
|
6287
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
6288
|
+
if (oldValue === newValue) return;
|
|
6289
|
+
if (name === "items") {
|
|
6290
|
+
try {
|
|
6291
|
+
this._items = JSON.parse(newValue || "[]");
|
|
6292
|
+
} catch (e) {
|
|
6293
|
+
this._items = [];
|
|
6294
|
+
}
|
|
6295
|
+
}
|
|
6296
|
+
this.render();
|
|
6297
|
+
}
|
|
6298
|
+
render() {
|
|
6299
|
+
this._syncStyles();
|
|
6300
|
+
this._renderItems();
|
|
6301
|
+
}
|
|
6302
|
+
_syncStyles() {
|
|
6303
|
+
const styleAttributes = ["background-color", "text-color", "font", "font-size", "border", "padding", "border-radius", "selected-color", "disabled-color"];
|
|
6304
|
+
styleAttributes.forEach((attr) => {
|
|
6305
|
+
const value = this.getAttribute(attr);
|
|
6306
|
+
if (value) {
|
|
6307
|
+
this.style.setProperty(`--${attr}`, value);
|
|
6308
|
+
}
|
|
6309
|
+
});
|
|
6310
|
+
}
|
|
6311
|
+
_renderItems() {
|
|
6312
|
+
if (!this._flexContainer) return;
|
|
6313
|
+
this._flexContainer.innerHTML = "";
|
|
6314
|
+
this._items.forEach((item, index) => {
|
|
6315
|
+
const itemEl = document.createElement("div");
|
|
6316
|
+
itemEl.classList.add("menu-item");
|
|
6317
|
+
itemEl.textContent = item.label || item.toString();
|
|
6318
|
+
const isSelected = this._selectedId ? item.id === this._selectedId : this._selectedIndex === index;
|
|
6319
|
+
if (isSelected) {
|
|
6320
|
+
itemEl.classList.add("selected");
|
|
6321
|
+
}
|
|
6322
|
+
if (item.disabled) {
|
|
6323
|
+
itemEl.classList.add("disabled");
|
|
6324
|
+
itemEl.setAttribute("disabled", "");
|
|
6325
|
+
}
|
|
6326
|
+
if (item.id) {
|
|
6327
|
+
itemEl.id = item.id;
|
|
6328
|
+
itemEl.setAttribute("data-id", item.id);
|
|
6329
|
+
}
|
|
6330
|
+
itemEl.setAttribute("data-index", index.toString());
|
|
6331
|
+
this._flexContainer.appendChild(itemEl);
|
|
6332
|
+
});
|
|
6333
|
+
}
|
|
6334
|
+
_dispatchSelectEvent() {
|
|
6335
|
+
this.dispatchEvent(
|
|
6336
|
+
new CustomEvent("wavelength-menu-select", {
|
|
6337
|
+
detail: this.value,
|
|
6338
|
+
bubbles: true,
|
|
6339
|
+
composed: true
|
|
6340
|
+
})
|
|
6341
|
+
);
|
|
6342
|
+
}
|
|
6343
|
+
};
|
|
6344
|
+
if (!customElements.get("wavelength-menu")) {
|
|
6345
|
+
customElements.define("wavelength-menu", WavelengthMenu);
|
|
6346
|
+
}
|
|
6347
|
+
|
|
6348
|
+
// src/web-components/wavelength-pagination.template.html
|
|
6349
|
+
var wavelength_pagination_template_default = '<style>\n :host {\n display: block;\n --local-font: var(--font, "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);\n font-family: var(--local-font);\n }\n\n .pagination-list,\n .pagination-list * {\n font-family: inherit;\n font-size: var(--font-size, 16px);\n color: var(--text-color, black);\n }\n\n .pagination-list {\n display: flex;\n list-style: none;\n padding: var(--padding, 10px);\n margin: 0;\n align-items: center;\n }\n\n .page-item {\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: all 0.3s ease;\n user-select: none;\n background-color: var(--background-color, white);\n }\n\n .page-item.disabled,\n .page-item.disabled * {\n cursor: default;\n background-color: var(--background-color, white);\n color: var(--disabled-color, #ccc);\n border-color: var(--disabled-color, #ccc);\n }\n\n /* --- BASIC VARIANT --- */\n .pagination-list.basic {\n gap: 15px;\n }\n\n .pagination-list.basic .page-info {\n margin-right: 10px;\n font-weight: 500;\n }\n\n .pagination-list.basic .page-item {\n width: 32px;\n height: 32px;\n border: var(--border, none);\n border-radius: var(--border-radius, 50%);\n }\n\n .pagination-list.basic .page-item:not(.disabled):hover {\n filter: brightness(0.95);\n }\n\n /* --- COMMON VARIANT --- */\n .pagination-list.common {\n gap: 8px;\n }\n\n .pagination-list.common .page-item {\n width: 40px;\n height: 40px;\n border: var(--border, none);\n border-radius: var(--border-radius, 50%);\n }\n\n .pagination-list.common .page-item.active,\n .pagination-list.common .page-item.active * {\n background-color: var(--active-color, #49baf7);\n color: var(--active-text-color, #fff);\n border-color: var(--active-color, #49baf7);\n }\n\n .pagination-list.common .page-item:not(.disabled):not(.active):hover {\n filter: brightness(0.95);\n transform: scale(1.1);\n }\n</style>\n<nav aria-label="pagination">\n <ul class="pagination-list"></ul>\n</nav>\n';
|
|
6350
|
+
|
|
6351
|
+
// src/web-components/wavelength-pagination.ts
|
|
6352
|
+
var WavelengthPagination = class extends HTMLElement {
|
|
6353
|
+
constructor() {
|
|
6354
|
+
super();
|
|
6355
|
+
this.styleAttributes = ["variant", "text-color", "font", "font-size", "border", "border-radius", "padding", "active-color", "active-text-color", "background-color", "disabled-color"];
|
|
6356
|
+
this.renderAttributes = ["variant", "total-pages", "current-page"];
|
|
6357
|
+
this.shadow = this.attachShadow({ mode: "open" });
|
|
6358
|
+
this.shadow.innerHTML = wavelength_pagination_template_default;
|
|
6359
|
+
}
|
|
6360
|
+
static get observedAttributes() {
|
|
6361
|
+
return [
|
|
6362
|
+
"variant",
|
|
6363
|
+
"text-color",
|
|
6364
|
+
"font",
|
|
6365
|
+
"font-size",
|
|
6366
|
+
"border",
|
|
6367
|
+
"border-radius",
|
|
6368
|
+
"padding",
|
|
6369
|
+
"total-pages",
|
|
6370
|
+
"current-page",
|
|
6371
|
+
"active-color",
|
|
6372
|
+
"active-text-color",
|
|
6373
|
+
"background-color",
|
|
6374
|
+
"disabled-color"
|
|
6375
|
+
];
|
|
6376
|
+
}
|
|
6377
|
+
get totalPages() {
|
|
6378
|
+
const parsed = Number.parseInt(this.getAttribute("total-pages") || "1", 10);
|
|
6379
|
+
return isNaN(parsed) ? 1 : parsed;
|
|
6380
|
+
}
|
|
6381
|
+
set totalPages(val) {
|
|
6382
|
+
this.setAttribute("total-pages", val.toString());
|
|
6383
|
+
}
|
|
6384
|
+
get currentPage() {
|
|
6385
|
+
const parsed = Number.parseInt(this.getAttribute("current-page") || "1", 10);
|
|
6386
|
+
return isNaN(parsed) ? 1 : parsed;
|
|
6387
|
+
}
|
|
6388
|
+
set currentPage(val) {
|
|
6389
|
+
this.setAttribute("current-page", val.toString());
|
|
6390
|
+
}
|
|
6391
|
+
connectedCallback() {
|
|
6392
|
+
this._clearAndRender();
|
|
6393
|
+
this._syncStyles();
|
|
6394
|
+
}
|
|
6395
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
6396
|
+
if (oldValue === newValue) return;
|
|
6397
|
+
if (this.styleAttributes.includes(name)) {
|
|
6398
|
+
this.style.setProperty(`--${name}`, newValue);
|
|
6399
|
+
}
|
|
6400
|
+
if (this.renderAttributes.includes(name)) {
|
|
6401
|
+
this._clearAndRender();
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6404
|
+
_clearAndRender() {
|
|
6405
|
+
const list = this.shadow.querySelector(".pagination-list");
|
|
6406
|
+
if (!list) return;
|
|
6407
|
+
const variant = this.getAttribute("variant") || "basic";
|
|
6408
|
+
list.innerHTML = "";
|
|
6409
|
+
list.className = `pagination-list ${variant}`;
|
|
6410
|
+
this._renderByVariant(list, variant);
|
|
6411
|
+
}
|
|
6412
|
+
_renderByVariant(container, variant) {
|
|
6413
|
+
if (variant === "basic") {
|
|
6414
|
+
this._renderBasic(container);
|
|
6415
|
+
} else {
|
|
6416
|
+
this._renderCommon(container);
|
|
6417
|
+
}
|
|
6418
|
+
}
|
|
6419
|
+
_renderBasic(container) {
|
|
6420
|
+
const { singlePrevSvg, singleNextSvg } = this._getIcons();
|
|
6421
|
+
const textInfo = document.createElement("span");
|
|
6422
|
+
textInfo.className = "page-info";
|
|
6423
|
+
textInfo.textContent = `Page ${this.currentPage} of ${this.totalPages}`;
|
|
6424
|
+
container.appendChild(textInfo);
|
|
6425
|
+
const prevBtn = this._createButton(singlePrevSvg, () => this._changePage(this.currentPage - 1), this.currentPage === 1);
|
|
6426
|
+
const nextBtn = this._createButton(singleNextSvg, () => this._changePage(this.currentPage + 1), this.currentPage === this.totalPages);
|
|
6427
|
+
container.appendChild(prevBtn);
|
|
6428
|
+
container.appendChild(nextBtn);
|
|
6429
|
+
}
|
|
6430
|
+
_getIcons() {
|
|
6431
|
+
const doubleArrowPath = `M185.27637,135.6062q-.36694.4466-.77393.85608c-.00732.00745-.01318.01575-.021.02307l-72,72a12.0001,12.0001,0,0,1-16.97071-16.9707L147.02539,140H31.99609a12,12,0,0,1,0-24h115.0293L95.51074,64.48535a12.0001,12.0001,0,0,1,16.97071-16.9707l72,72c.00781.00732.01367.01562.021.02307q.40723.409.77393.85608c.11425.1394.21386.28662.32129.42993.12744.17.25927.33643.37744.51318.11474.17115.21386.34888.31836.5243.09619.1604.19677.31726.28515.48242.09619.17944.17725.36389.26368.547.08105.17188.1665.34083.23974.51685.07373.17847.1333.36084.19824.54187.06787.18836.14014.37415.19825.56677.05468.18116.09472.36524.14111.54834.04932.19641.10449.39038.144.59034.042.21167.0669.42553.09766.63867.0249.17431.05762.3457.07519.52221a12.07306,12.07306,0,0,1,0,2.36866c-.01757.17651-.05029.3479-.07519.52221-.03076.21314-.05567.427-.09766.63867-.03955.2-.09472.39393-.144.59034-.04639.1831-.08643.36718-.14111.54834-.0586.19287-.13086.3789-.19825.56762-.06494.18067-.12451.36255-.19824.54078-.07324.17651-.15918.34558-.24023.5177-.08594.18286-.16748.36718-.26319.54638-.08838.16516-.189.322-.28515.48242-.1045.17542-.20362.35315-.31836.5243-.11817.17675-.25.34314-.37744.51318C185.49023,135.31958,185.39062,135.4668,185.27637,135.6062ZM216,28a12,12,0,0,0-12,12V216a12,12,0,0,0,24,0V40A12,12,0,0,0,216,28Z`;
|
|
6432
|
+
const singleArrowPath = `M426.6 755.2L375 703.6l193.1-193.2L375 317.3l51.6-51.6 244.7 244.7z`;
|
|
6433
|
+
const iconStyle = `width: 24px; height: 24px;`;
|
|
6434
|
+
return {
|
|
6435
|
+
nextSvg: `<svg fill="currentColor" viewBox="0 0 256 256" id="Flat" xmlns="http://www.w3.org/2000/svg" style="${iconStyle}"><g id="SVGRepo_iconCarrier"> <path d="${doubleArrowPath}"></path> </g></svg>`,
|
|
6436
|
+
prevSvg: `<svg fill="currentColor" viewBox="0 0 256 256" id="Flat" xmlns="http://www.w3.org/2000/svg" style="${iconStyle} transform: scaleX(-1);"><g id="SVGRepo_iconCarrier"> <path d="${doubleArrowPath}"></path> </g></svg>`,
|
|
6437
|
+
singleNextSvg: `<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" style="${iconStyle}"><g id="SVGRepo_iconCarrier"><path d="${singleArrowPath}" fill="currentColor"></path></g></svg>`,
|
|
6438
|
+
singlePrevSvg: `<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" style="${iconStyle} transform: scaleX(-1);"><g id="SVGRepo_iconCarrier"><path d="${singleArrowPath}" fill="currentColor"></path></g></svg>`
|
|
6439
|
+
};
|
|
6440
|
+
}
|
|
6441
|
+
_renderCommon(container) {
|
|
6442
|
+
const { nextSvg, prevSvg, singleNextSvg, singlePrevSvg } = this._getIcons();
|
|
6443
|
+
container.appendChild(this._createButton(prevSvg, () => this._changePage(1), this.currentPage === 1));
|
|
6444
|
+
container.appendChild(this._createButton(singlePrevSvg, () => this._changePage(this.currentPage - 1), this.currentPage === 1));
|
|
6445
|
+
let startPage = Math.max(1, this.currentPage - 3);
|
|
6446
|
+
const endPage = Math.min(this.totalPages, startPage + 6);
|
|
6447
|
+
if (endPage - startPage < 6) {
|
|
6448
|
+
startPage = Math.max(1, endPage - 6);
|
|
6449
|
+
}
|
|
6450
|
+
for (let i = startPage; i <= endPage; i++) {
|
|
6451
|
+
const btn = this._createButton(i.toString(), () => this._changePage(i), false);
|
|
6452
|
+
if (i === this.currentPage) btn.classList.add("active");
|
|
6453
|
+
container.appendChild(btn);
|
|
6454
|
+
}
|
|
6455
|
+
container.appendChild(this._createButton(singleNextSvg, () => this._changePage(this.currentPage + 1), this.currentPage === this.totalPages, false, "Next Page"));
|
|
6456
|
+
container.appendChild(this._createButton(nextSvg, () => this._changePage(this.totalPages), this.currentPage === this.totalPages, false, "Last Page"));
|
|
6457
|
+
}
|
|
6458
|
+
_createButton(content, onClick, disabled, isActive = false, ariaLabel) {
|
|
6459
|
+
const li = document.createElement("li");
|
|
6460
|
+
li.className = "page-item";
|
|
6461
|
+
const btn = document.createElement("button");
|
|
6462
|
+
btn.style.all = "unset";
|
|
6463
|
+
btn.style.width = "100%";
|
|
6464
|
+
btn.style.height = "100%";
|
|
6465
|
+
btn.style.display = "flex";
|
|
6466
|
+
btn.style.alignItems = "center";
|
|
6467
|
+
btn.style.justifyContent = "center";
|
|
6468
|
+
btn.style.cursor = disabled ? "default" : "pointer";
|
|
6469
|
+
if (ariaLabel) btn.setAttribute("aria-label", ariaLabel);
|
|
6470
|
+
if (isActive) btn.setAttribute("aria-current", "page");
|
|
6471
|
+
btn.disabled = disabled;
|
|
6472
|
+
if (!disabled) {
|
|
6473
|
+
btn.onclick = onClick;
|
|
6474
|
+
}
|
|
6475
|
+
if (isActive) li.classList.add("active");
|
|
6476
|
+
if (disabled) li.classList.add("disabled");
|
|
6477
|
+
if (content.includes("<svg")) {
|
|
6478
|
+
btn.innerHTML = content;
|
|
6479
|
+
} else {
|
|
6480
|
+
btn.textContent = content;
|
|
6481
|
+
}
|
|
6482
|
+
li.appendChild(btn);
|
|
6483
|
+
return li;
|
|
6484
|
+
}
|
|
6485
|
+
_changePage(newPage) {
|
|
6486
|
+
if (newPage < 1 || newPage > this.totalPages) return;
|
|
6487
|
+
this.setAttribute("current-page", newPage.toString());
|
|
6488
|
+
this.dispatchEvent(
|
|
6489
|
+
new CustomEvent("page-change", {
|
|
6490
|
+
detail: { page: newPage },
|
|
6491
|
+
bubbles: true,
|
|
6492
|
+
composed: true
|
|
6493
|
+
})
|
|
6494
|
+
);
|
|
6495
|
+
}
|
|
6496
|
+
_syncStyles() {
|
|
6497
|
+
this.styleAttributes.forEach((attr) => {
|
|
6498
|
+
const value = this.getAttribute(attr);
|
|
6499
|
+
if (value) {
|
|
6500
|
+
this.style.setProperty(`--${attr}`, value);
|
|
6501
|
+
}
|
|
6502
|
+
});
|
|
6503
|
+
}
|
|
6504
|
+
};
|
|
6505
|
+
if (!customElements.get("wavelength-pagination")) {
|
|
6506
|
+
customElements.define("wavelength-pagination", WavelengthPagination);
|
|
6507
|
+
}
|
|
6508
|
+
|
|
6509
|
+
|
|
6510
|
+
|
|
6230
6511
|
|
|
6231
6512
|
|
|
6232
6513
|
|
|
@@ -6248,7 +6529,7 @@ if (!customElements.get("wavelength-tooltip")) {
|
|
|
6248
6529
|
|
|
6249
6530
|
|
|
6250
6531
|
|
|
6251
|
-
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.WavelengthManyPlanes = WavelengthManyPlanes; exports.WavelengthMultiSelectAutocomplete = WavelengthMultiSelectAutocomplete; exports.WavelengthNavBar = WavelengthNavBar; exports.WavelengthNotificationPanel = WavelengthNotificationPanel; exports.WavelengthPlaneTrail = WavelengthPlaneTrail; exports.WavelengthProgressBar = WavelengthProgressBar; exports.WavelengthSnackbar = WavelengthSnackbar; exports.WavelengthTitleBar = WavelengthTitleBar; exports.WavelengthToolTip = WavelengthToolTip;
|
|
6532
|
+
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.WavelengthManyPlanes = WavelengthManyPlanes; exports.WavelengthMenu = WavelengthMenu; exports.WavelengthMultiSelectAutocomplete = WavelengthMultiSelectAutocomplete; exports.WavelengthNavBar = WavelengthNavBar; exports.WavelengthNotificationPanel = WavelengthNotificationPanel; exports.WavelengthPagination = WavelengthPagination; exports.WavelengthPlaneTrail = WavelengthPlaneTrail; exports.WavelengthProgressBar = WavelengthProgressBar; exports.WavelengthSnackbar = WavelengthSnackbar; exports.WavelengthTitleBar = WavelengthTitleBar; exports.WavelengthToolTip = WavelengthToolTip;
|
|
6252
6533
|
/*! Bundled license information:
|
|
6253
6534
|
|
|
6254
6535
|
react/cjs/react.production.min.js:
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -2265,4 +2265,47 @@ declare class WavelengthToolTip extends HTMLElement {
|
|
|
2265
2265
|
updateComponent(): void;
|
|
2266
2266
|
}
|
|
2267
2267
|
|
|
2268
|
-
|
|
2268
|
+
declare class WavelengthMenu extends HTMLElement {
|
|
2269
|
+
static get observedAttributes(): string[];
|
|
2270
|
+
private _items;
|
|
2271
|
+
private _selectedIndex;
|
|
2272
|
+
private _selectedId;
|
|
2273
|
+
private _flexContainer;
|
|
2274
|
+
private _shadow;
|
|
2275
|
+
constructor();
|
|
2276
|
+
get items(): any[];
|
|
2277
|
+
set items(value: any[]);
|
|
2278
|
+
get value(): any;
|
|
2279
|
+
connectedCallback(): void;
|
|
2280
|
+
disconnectedCallback(): void;
|
|
2281
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
2282
|
+
render(): void;
|
|
2283
|
+
private _syncStyles;
|
|
2284
|
+
private _renderItems;
|
|
2285
|
+
private _onItemClick;
|
|
2286
|
+
private _dispatchSelectEvent;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
declare class WavelengthPagination extends HTMLElement {
|
|
2290
|
+
static get observedAttributes(): string[];
|
|
2291
|
+
private shadow;
|
|
2292
|
+
private styleAttributes;
|
|
2293
|
+
private renderAttributes;
|
|
2294
|
+
constructor();
|
|
2295
|
+
get totalPages(): number;
|
|
2296
|
+
set totalPages(val: number);
|
|
2297
|
+
get currentPage(): number;
|
|
2298
|
+
set currentPage(val: number);
|
|
2299
|
+
connectedCallback(): void;
|
|
2300
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
2301
|
+
private _clearAndRender;
|
|
2302
|
+
private _renderByVariant;
|
|
2303
|
+
private _renderBasic;
|
|
2304
|
+
private _getIcons;
|
|
2305
|
+
private _renderCommon;
|
|
2306
|
+
private _createButton;
|
|
2307
|
+
private _changePage;
|
|
2308
|
+
private _syncStyles;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
export { BaseWavelengthInput, BaseWavelengthMultiSelectAutocomplete, type CheckboxElements, ChildDataTable, SampleComponent, WavelengthBanner, WavelengthButton, WavelengthCheckbox, WavelengthDatePicker, WavelengthDropdown, WavelengthFileDropZone, WavelengthForm, WavelengthInput, WavelengthManyPlanes, WavelengthMenu, WavelengthMultiSelectAutocomplete, WavelengthNavBar, WavelengthNotificationPanel, WavelengthPagination, WavelengthPlaneTrail, WavelengthProgressBar, WavelengthSnackbar, WavelengthTitleBar, WavelengthToolTip };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2265,4 +2265,47 @@ declare class WavelengthToolTip extends HTMLElement {
|
|
|
2265
2265
|
updateComponent(): void;
|
|
2266
2266
|
}
|
|
2267
2267
|
|
|
2268
|
-
|
|
2268
|
+
declare class WavelengthMenu extends HTMLElement {
|
|
2269
|
+
static get observedAttributes(): string[];
|
|
2270
|
+
private _items;
|
|
2271
|
+
private _selectedIndex;
|
|
2272
|
+
private _selectedId;
|
|
2273
|
+
private _flexContainer;
|
|
2274
|
+
private _shadow;
|
|
2275
|
+
constructor();
|
|
2276
|
+
get items(): any[];
|
|
2277
|
+
set items(value: any[]);
|
|
2278
|
+
get value(): any;
|
|
2279
|
+
connectedCallback(): void;
|
|
2280
|
+
disconnectedCallback(): void;
|
|
2281
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
2282
|
+
render(): void;
|
|
2283
|
+
private _syncStyles;
|
|
2284
|
+
private _renderItems;
|
|
2285
|
+
private _onItemClick;
|
|
2286
|
+
private _dispatchSelectEvent;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
declare class WavelengthPagination extends HTMLElement {
|
|
2290
|
+
static get observedAttributes(): string[];
|
|
2291
|
+
private shadow;
|
|
2292
|
+
private styleAttributes;
|
|
2293
|
+
private renderAttributes;
|
|
2294
|
+
constructor();
|
|
2295
|
+
get totalPages(): number;
|
|
2296
|
+
set totalPages(val: number);
|
|
2297
|
+
get currentPage(): number;
|
|
2298
|
+
set currentPage(val: number);
|
|
2299
|
+
connectedCallback(): void;
|
|
2300
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
2301
|
+
private _clearAndRender;
|
|
2302
|
+
private _renderByVariant;
|
|
2303
|
+
private _renderBasic;
|
|
2304
|
+
private _getIcons;
|
|
2305
|
+
private _renderCommon;
|
|
2306
|
+
private _createButton;
|
|
2307
|
+
private _changePage;
|
|
2308
|
+
private _syncStyles;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
export { BaseWavelengthInput, BaseWavelengthMultiSelectAutocomplete, type CheckboxElements, ChildDataTable, SampleComponent, WavelengthBanner, WavelengthButton, WavelengthCheckbox, WavelengthDatePicker, WavelengthDropdown, WavelengthFileDropZone, WavelengthForm, WavelengthInput, WavelengthManyPlanes, WavelengthMenu, WavelengthMultiSelectAutocomplete, WavelengthNavBar, WavelengthNotificationPanel, WavelengthPagination, WavelengthPlaneTrail, WavelengthProgressBar, WavelengthSnackbar, WavelengthTitleBar, WavelengthToolTip };
|
package/dist/esm/index.js
CHANGED
|
@@ -6226,6 +6226,285 @@ var WavelengthToolTip = class extends HTMLElement {
|
|
|
6226
6226
|
if (!customElements.get("wavelength-tooltip")) {
|
|
6227
6227
|
customElements.define("wavelength-tooltip", WavelengthToolTip);
|
|
6228
6228
|
}
|
|
6229
|
+
|
|
6230
|
+
// src/web-components/wavelength-menu.template.html
|
|
6231
|
+
var wavelength_menu_template_default = '<style>\n :host {\n display: block;\n --background-color: white;\n --text-color: black;\n --font: Arial, Helvetica, sans-serif;\n --font-size: 12px;\n --border: 0px solid #ccc;\n --padding: 5px;\n --border-radius: 3px;\n --selected-color: #5799ea;\n --disabled-color: #d1d1d1;\n }\n .flex-container {\n overflow-y: scroll;\n height: 125px;\n width: 175px;\n flex-direction: column;\n background-color: var(--background-color);\n border: var(--border);\n border-radius: var(--border-radius);\n padding: var(--padding);\n margin: 5px;\n box-shadow: 4px 5px 7px 4px rgba(0, 0, 0, 0.1);\n }\n .menu-item {\n display: block;\n padding: var(--padding);\n margin: 5px;\n font-size: var(--font-size);\n font-family: var(--font);\n color: var(--text-color);\n background-color: var(--background-color);\n cursor: pointer;\n transition: background-color 0.1s ease;\n border-radius: var(--border-radius);\n }\n .menu-item:hover {\n background-color: #f0f0f0;\n }\n .menu-item.selected {\n background-color: var(--selected-color) !important;\n color: white !important;\n }\n .menu-item:focus {\n background-color: #d1d1d1;\n }\n .menu-item:active {\n background-color: #d1d1d1;\n }\n .menu-item.disabled {\n color: var(--disabled-color);\n background-color: var(--background-color);\n cursor: not-allowed;\n pointer-events: none;\n opacity: 0.6;\n }\n</style>\n<div class="flex-container"></div>\n';
|
|
6232
|
+
|
|
6233
|
+
// src/web-components/wavelength-menu.ts
|
|
6234
|
+
var WavelengthMenu = class extends HTMLElement {
|
|
6235
|
+
constructor() {
|
|
6236
|
+
super();
|
|
6237
|
+
this._items = [];
|
|
6238
|
+
this._selectedIndex = -1;
|
|
6239
|
+
this._selectedId = null;
|
|
6240
|
+
this._onItemClick = (e) => {
|
|
6241
|
+
const menuItem = e.target.closest(".menu-item");
|
|
6242
|
+
if (!menuItem || menuItem.classList.contains("disabled")) return;
|
|
6243
|
+
const index = parseInt(menuItem.getAttribute("data-index") || "-1");
|
|
6244
|
+
const isAlreadySelected = menuItem.classList.contains("selected");
|
|
6245
|
+
const menuItems = this._shadow.querySelectorAll(".menu-item");
|
|
6246
|
+
menuItems.forEach((item) => item.classList.remove("selected"));
|
|
6247
|
+
if (!isAlreadySelected) {
|
|
6248
|
+
menuItem.classList.add("selected");
|
|
6249
|
+
this._selectedIndex = index;
|
|
6250
|
+
this._selectedId = menuItem.getAttribute("data-id");
|
|
6251
|
+
} else {
|
|
6252
|
+
this._selectedIndex = -1;
|
|
6253
|
+
this._selectedId = null;
|
|
6254
|
+
}
|
|
6255
|
+
this._dispatchSelectEvent();
|
|
6256
|
+
};
|
|
6257
|
+
this._shadow = this.attachShadow({ mode: "open" });
|
|
6258
|
+
this._shadow.innerHTML = wavelength_menu_template_default;
|
|
6259
|
+
this._flexContainer = this._shadow.querySelector(".flex-container");
|
|
6260
|
+
try {
|
|
6261
|
+
this._items = JSON.parse(this.getAttribute("items") || "[]");
|
|
6262
|
+
} catch (e) {
|
|
6263
|
+
this._items = [];
|
|
6264
|
+
}
|
|
6265
|
+
}
|
|
6266
|
+
static get observedAttributes() {
|
|
6267
|
+
return ["background-color", "text-color", "font", "font-size", "border", "padding", "border-radius", "selected-color", "items", "disabled-color"];
|
|
6268
|
+
}
|
|
6269
|
+
// Getter for items array.
|
|
6270
|
+
get items() {
|
|
6271
|
+
return this._items;
|
|
6272
|
+
}
|
|
6273
|
+
set items(value) {
|
|
6274
|
+
this._items = Array.isArray(value) ? value : [];
|
|
6275
|
+
this.render();
|
|
6276
|
+
}
|
|
6277
|
+
get value() {
|
|
6278
|
+
return this._items[this._selectedIndex] ?? null;
|
|
6279
|
+
}
|
|
6280
|
+
connectedCallback() {
|
|
6281
|
+
this.render();
|
|
6282
|
+
this._flexContainer.addEventListener("click", this._onItemClick);
|
|
6283
|
+
}
|
|
6284
|
+
disconnectedCallback() {
|
|
6285
|
+
this._flexContainer.removeEventListener("click", this._onItemClick);
|
|
6286
|
+
}
|
|
6287
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
6288
|
+
if (oldValue === newValue) return;
|
|
6289
|
+
if (name === "items") {
|
|
6290
|
+
try {
|
|
6291
|
+
this._items = JSON.parse(newValue || "[]");
|
|
6292
|
+
} catch (e) {
|
|
6293
|
+
this._items = [];
|
|
6294
|
+
}
|
|
6295
|
+
}
|
|
6296
|
+
this.render();
|
|
6297
|
+
}
|
|
6298
|
+
render() {
|
|
6299
|
+
this._syncStyles();
|
|
6300
|
+
this._renderItems();
|
|
6301
|
+
}
|
|
6302
|
+
_syncStyles() {
|
|
6303
|
+
const styleAttributes = ["background-color", "text-color", "font", "font-size", "border", "padding", "border-radius", "selected-color", "disabled-color"];
|
|
6304
|
+
styleAttributes.forEach((attr) => {
|
|
6305
|
+
const value = this.getAttribute(attr);
|
|
6306
|
+
if (value) {
|
|
6307
|
+
this.style.setProperty(`--${attr}`, value);
|
|
6308
|
+
}
|
|
6309
|
+
});
|
|
6310
|
+
}
|
|
6311
|
+
_renderItems() {
|
|
6312
|
+
if (!this._flexContainer) return;
|
|
6313
|
+
this._flexContainer.innerHTML = "";
|
|
6314
|
+
this._items.forEach((item, index) => {
|
|
6315
|
+
const itemEl = document.createElement("div");
|
|
6316
|
+
itemEl.classList.add("menu-item");
|
|
6317
|
+
itemEl.textContent = item.label || item.toString();
|
|
6318
|
+
const isSelected = this._selectedId ? item.id === this._selectedId : this._selectedIndex === index;
|
|
6319
|
+
if (isSelected) {
|
|
6320
|
+
itemEl.classList.add("selected");
|
|
6321
|
+
}
|
|
6322
|
+
if (item.disabled) {
|
|
6323
|
+
itemEl.classList.add("disabled");
|
|
6324
|
+
itemEl.setAttribute("disabled", "");
|
|
6325
|
+
}
|
|
6326
|
+
if (item.id) {
|
|
6327
|
+
itemEl.id = item.id;
|
|
6328
|
+
itemEl.setAttribute("data-id", item.id);
|
|
6329
|
+
}
|
|
6330
|
+
itemEl.setAttribute("data-index", index.toString());
|
|
6331
|
+
this._flexContainer.appendChild(itemEl);
|
|
6332
|
+
});
|
|
6333
|
+
}
|
|
6334
|
+
_dispatchSelectEvent() {
|
|
6335
|
+
this.dispatchEvent(
|
|
6336
|
+
new CustomEvent("wavelength-menu-select", {
|
|
6337
|
+
detail: this.value,
|
|
6338
|
+
bubbles: true,
|
|
6339
|
+
composed: true
|
|
6340
|
+
})
|
|
6341
|
+
);
|
|
6342
|
+
}
|
|
6343
|
+
};
|
|
6344
|
+
if (!customElements.get("wavelength-menu")) {
|
|
6345
|
+
customElements.define("wavelength-menu", WavelengthMenu);
|
|
6346
|
+
}
|
|
6347
|
+
|
|
6348
|
+
// src/web-components/wavelength-pagination.template.html
|
|
6349
|
+
var wavelength_pagination_template_default = '<style>\n :host {\n display: block;\n --local-font: var(--font, "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);\n font-family: var(--local-font);\n }\n\n .pagination-list,\n .pagination-list * {\n font-family: inherit;\n font-size: var(--font-size, 16px);\n color: var(--text-color, black);\n }\n\n .pagination-list {\n display: flex;\n list-style: none;\n padding: var(--padding, 10px);\n margin: 0;\n align-items: center;\n }\n\n .page-item {\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: all 0.3s ease;\n user-select: none;\n background-color: var(--background-color, white);\n }\n\n .page-item.disabled,\n .page-item.disabled * {\n cursor: default;\n background-color: var(--background-color, white);\n color: var(--disabled-color, #ccc);\n border-color: var(--disabled-color, #ccc);\n }\n\n /* --- BASIC VARIANT --- */\n .pagination-list.basic {\n gap: 15px;\n }\n\n .pagination-list.basic .page-info {\n margin-right: 10px;\n font-weight: 500;\n }\n\n .pagination-list.basic .page-item {\n width: 32px;\n height: 32px;\n border: var(--border, none);\n border-radius: var(--border-radius, 50%);\n }\n\n .pagination-list.basic .page-item:not(.disabled):hover {\n filter: brightness(0.95);\n }\n\n /* --- COMMON VARIANT --- */\n .pagination-list.common {\n gap: 8px;\n }\n\n .pagination-list.common .page-item {\n width: 40px;\n height: 40px;\n border: var(--border, none);\n border-radius: var(--border-radius, 50%);\n }\n\n .pagination-list.common .page-item.active,\n .pagination-list.common .page-item.active * {\n background-color: var(--active-color, #49baf7);\n color: var(--active-text-color, #fff);\n border-color: var(--active-color, #49baf7);\n }\n\n .pagination-list.common .page-item:not(.disabled):not(.active):hover {\n filter: brightness(0.95);\n transform: scale(1.1);\n }\n</style>\n<nav aria-label="pagination">\n <ul class="pagination-list"></ul>\n</nav>\n';
|
|
6350
|
+
|
|
6351
|
+
// src/web-components/wavelength-pagination.ts
|
|
6352
|
+
var WavelengthPagination = class extends HTMLElement {
|
|
6353
|
+
constructor() {
|
|
6354
|
+
super();
|
|
6355
|
+
this.styleAttributes = ["variant", "text-color", "font", "font-size", "border", "border-radius", "padding", "active-color", "active-text-color", "background-color", "disabled-color"];
|
|
6356
|
+
this.renderAttributes = ["variant", "total-pages", "current-page"];
|
|
6357
|
+
this.shadow = this.attachShadow({ mode: "open" });
|
|
6358
|
+
this.shadow.innerHTML = wavelength_pagination_template_default;
|
|
6359
|
+
}
|
|
6360
|
+
static get observedAttributes() {
|
|
6361
|
+
return [
|
|
6362
|
+
"variant",
|
|
6363
|
+
"text-color",
|
|
6364
|
+
"font",
|
|
6365
|
+
"font-size",
|
|
6366
|
+
"border",
|
|
6367
|
+
"border-radius",
|
|
6368
|
+
"padding",
|
|
6369
|
+
"total-pages",
|
|
6370
|
+
"current-page",
|
|
6371
|
+
"active-color",
|
|
6372
|
+
"active-text-color",
|
|
6373
|
+
"background-color",
|
|
6374
|
+
"disabled-color"
|
|
6375
|
+
];
|
|
6376
|
+
}
|
|
6377
|
+
get totalPages() {
|
|
6378
|
+
const parsed = Number.parseInt(this.getAttribute("total-pages") || "1", 10);
|
|
6379
|
+
return isNaN(parsed) ? 1 : parsed;
|
|
6380
|
+
}
|
|
6381
|
+
set totalPages(val) {
|
|
6382
|
+
this.setAttribute("total-pages", val.toString());
|
|
6383
|
+
}
|
|
6384
|
+
get currentPage() {
|
|
6385
|
+
const parsed = Number.parseInt(this.getAttribute("current-page") || "1", 10);
|
|
6386
|
+
return isNaN(parsed) ? 1 : parsed;
|
|
6387
|
+
}
|
|
6388
|
+
set currentPage(val) {
|
|
6389
|
+
this.setAttribute("current-page", val.toString());
|
|
6390
|
+
}
|
|
6391
|
+
connectedCallback() {
|
|
6392
|
+
this._clearAndRender();
|
|
6393
|
+
this._syncStyles();
|
|
6394
|
+
}
|
|
6395
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
6396
|
+
if (oldValue === newValue) return;
|
|
6397
|
+
if (this.styleAttributes.includes(name)) {
|
|
6398
|
+
this.style.setProperty(`--${name}`, newValue);
|
|
6399
|
+
}
|
|
6400
|
+
if (this.renderAttributes.includes(name)) {
|
|
6401
|
+
this._clearAndRender();
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6404
|
+
_clearAndRender() {
|
|
6405
|
+
const list = this.shadow.querySelector(".pagination-list");
|
|
6406
|
+
if (!list) return;
|
|
6407
|
+
const variant = this.getAttribute("variant") || "basic";
|
|
6408
|
+
list.innerHTML = "";
|
|
6409
|
+
list.className = `pagination-list ${variant}`;
|
|
6410
|
+
this._renderByVariant(list, variant);
|
|
6411
|
+
}
|
|
6412
|
+
_renderByVariant(container, variant) {
|
|
6413
|
+
if (variant === "basic") {
|
|
6414
|
+
this._renderBasic(container);
|
|
6415
|
+
} else {
|
|
6416
|
+
this._renderCommon(container);
|
|
6417
|
+
}
|
|
6418
|
+
}
|
|
6419
|
+
_renderBasic(container) {
|
|
6420
|
+
const { singlePrevSvg, singleNextSvg } = this._getIcons();
|
|
6421
|
+
const textInfo = document.createElement("span");
|
|
6422
|
+
textInfo.className = "page-info";
|
|
6423
|
+
textInfo.textContent = `Page ${this.currentPage} of ${this.totalPages}`;
|
|
6424
|
+
container.appendChild(textInfo);
|
|
6425
|
+
const prevBtn = this._createButton(singlePrevSvg, () => this._changePage(this.currentPage - 1), this.currentPage === 1);
|
|
6426
|
+
const nextBtn = this._createButton(singleNextSvg, () => this._changePage(this.currentPage + 1), this.currentPage === this.totalPages);
|
|
6427
|
+
container.appendChild(prevBtn);
|
|
6428
|
+
container.appendChild(nextBtn);
|
|
6429
|
+
}
|
|
6430
|
+
_getIcons() {
|
|
6431
|
+
const doubleArrowPath = `M185.27637,135.6062q-.36694.4466-.77393.85608c-.00732.00745-.01318.01575-.021.02307l-72,72a12.0001,12.0001,0,0,1-16.97071-16.9707L147.02539,140H31.99609a12,12,0,0,1,0-24h115.0293L95.51074,64.48535a12.0001,12.0001,0,0,1,16.97071-16.9707l72,72c.00781.00732.01367.01562.021.02307q.40723.409.77393.85608c.11425.1394.21386.28662.32129.42993.12744.17.25927.33643.37744.51318.11474.17115.21386.34888.31836.5243.09619.1604.19677.31726.28515.48242.09619.17944.17725.36389.26368.547.08105.17188.1665.34083.23974.51685.07373.17847.1333.36084.19824.54187.06787.18836.14014.37415.19825.56677.05468.18116.09472.36524.14111.54834.04932.19641.10449.39038.144.59034.042.21167.0669.42553.09766.63867.0249.17431.05762.3457.07519.52221a12.07306,12.07306,0,0,1,0,2.36866c-.01757.17651-.05029.3479-.07519.52221-.03076.21314-.05567.427-.09766.63867-.03955.2-.09472.39393-.144.59034-.04639.1831-.08643.36718-.14111.54834-.0586.19287-.13086.3789-.19825.56762-.06494.18067-.12451.36255-.19824.54078-.07324.17651-.15918.34558-.24023.5177-.08594.18286-.16748.36718-.26319.54638-.08838.16516-.189.322-.28515.48242-.1045.17542-.20362.35315-.31836.5243-.11817.17675-.25.34314-.37744.51318C185.49023,135.31958,185.39062,135.4668,185.27637,135.6062ZM216,28a12,12,0,0,0-12,12V216a12,12,0,0,0,24,0V40A12,12,0,0,0,216,28Z`;
|
|
6432
|
+
const singleArrowPath = `M426.6 755.2L375 703.6l193.1-193.2L375 317.3l51.6-51.6 244.7 244.7z`;
|
|
6433
|
+
const iconStyle = `width: 24px; height: 24px;`;
|
|
6434
|
+
return {
|
|
6435
|
+
nextSvg: `<svg fill="currentColor" viewBox="0 0 256 256" id="Flat" xmlns="http://www.w3.org/2000/svg" style="${iconStyle}"><g id="SVGRepo_iconCarrier"> <path d="${doubleArrowPath}"></path> </g></svg>`,
|
|
6436
|
+
prevSvg: `<svg fill="currentColor" viewBox="0 0 256 256" id="Flat" xmlns="http://www.w3.org/2000/svg" style="${iconStyle} transform: scaleX(-1);"><g id="SVGRepo_iconCarrier"> <path d="${doubleArrowPath}"></path> </g></svg>`,
|
|
6437
|
+
singleNextSvg: `<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" style="${iconStyle}"><g id="SVGRepo_iconCarrier"><path d="${singleArrowPath}" fill="currentColor"></path></g></svg>`,
|
|
6438
|
+
singlePrevSvg: `<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" style="${iconStyle} transform: scaleX(-1);"><g id="SVGRepo_iconCarrier"><path d="${singleArrowPath}" fill="currentColor"></path></g></svg>`
|
|
6439
|
+
};
|
|
6440
|
+
}
|
|
6441
|
+
_renderCommon(container) {
|
|
6442
|
+
const { nextSvg, prevSvg, singleNextSvg, singlePrevSvg } = this._getIcons();
|
|
6443
|
+
container.appendChild(this._createButton(prevSvg, () => this._changePage(1), this.currentPage === 1));
|
|
6444
|
+
container.appendChild(this._createButton(singlePrevSvg, () => this._changePage(this.currentPage - 1), this.currentPage === 1));
|
|
6445
|
+
let startPage = Math.max(1, this.currentPage - 3);
|
|
6446
|
+
const endPage = Math.min(this.totalPages, startPage + 6);
|
|
6447
|
+
if (endPage - startPage < 6) {
|
|
6448
|
+
startPage = Math.max(1, endPage - 6);
|
|
6449
|
+
}
|
|
6450
|
+
for (let i = startPage; i <= endPage; i++) {
|
|
6451
|
+
const btn = this._createButton(i.toString(), () => this._changePage(i), false);
|
|
6452
|
+
if (i === this.currentPage) btn.classList.add("active");
|
|
6453
|
+
container.appendChild(btn);
|
|
6454
|
+
}
|
|
6455
|
+
container.appendChild(this._createButton(singleNextSvg, () => this._changePage(this.currentPage + 1), this.currentPage === this.totalPages, false, "Next Page"));
|
|
6456
|
+
container.appendChild(this._createButton(nextSvg, () => this._changePage(this.totalPages), this.currentPage === this.totalPages, false, "Last Page"));
|
|
6457
|
+
}
|
|
6458
|
+
_createButton(content, onClick, disabled, isActive = false, ariaLabel) {
|
|
6459
|
+
const li = document.createElement("li");
|
|
6460
|
+
li.className = "page-item";
|
|
6461
|
+
const btn = document.createElement("button");
|
|
6462
|
+
btn.style.all = "unset";
|
|
6463
|
+
btn.style.width = "100%";
|
|
6464
|
+
btn.style.height = "100%";
|
|
6465
|
+
btn.style.display = "flex";
|
|
6466
|
+
btn.style.alignItems = "center";
|
|
6467
|
+
btn.style.justifyContent = "center";
|
|
6468
|
+
btn.style.cursor = disabled ? "default" : "pointer";
|
|
6469
|
+
if (ariaLabel) btn.setAttribute("aria-label", ariaLabel);
|
|
6470
|
+
if (isActive) btn.setAttribute("aria-current", "page");
|
|
6471
|
+
btn.disabled = disabled;
|
|
6472
|
+
if (!disabled) {
|
|
6473
|
+
btn.onclick = onClick;
|
|
6474
|
+
}
|
|
6475
|
+
if (isActive) li.classList.add("active");
|
|
6476
|
+
if (disabled) li.classList.add("disabled");
|
|
6477
|
+
if (content.includes("<svg")) {
|
|
6478
|
+
btn.innerHTML = content;
|
|
6479
|
+
} else {
|
|
6480
|
+
btn.textContent = content;
|
|
6481
|
+
}
|
|
6482
|
+
li.appendChild(btn);
|
|
6483
|
+
return li;
|
|
6484
|
+
}
|
|
6485
|
+
_changePage(newPage) {
|
|
6486
|
+
if (newPage < 1 || newPage > this.totalPages) return;
|
|
6487
|
+
this.setAttribute("current-page", newPage.toString());
|
|
6488
|
+
this.dispatchEvent(
|
|
6489
|
+
new CustomEvent("page-change", {
|
|
6490
|
+
detail: { page: newPage },
|
|
6491
|
+
bubbles: true,
|
|
6492
|
+
composed: true
|
|
6493
|
+
})
|
|
6494
|
+
);
|
|
6495
|
+
}
|
|
6496
|
+
_syncStyles() {
|
|
6497
|
+
this.styleAttributes.forEach((attr) => {
|
|
6498
|
+
const value = this.getAttribute(attr);
|
|
6499
|
+
if (value) {
|
|
6500
|
+
this.style.setProperty(`--${attr}`, value);
|
|
6501
|
+
}
|
|
6502
|
+
});
|
|
6503
|
+
}
|
|
6504
|
+
};
|
|
6505
|
+
if (!customElements.get("wavelength-pagination")) {
|
|
6506
|
+
customElements.define("wavelength-pagination", WavelengthPagination);
|
|
6507
|
+
}
|
|
6229
6508
|
export {
|
|
6230
6509
|
BaseWavelengthInput,
|
|
6231
6510
|
BaseWavelengthMultiSelectAutocomplete,
|
|
@@ -6240,9 +6519,11 @@ export {
|
|
|
6240
6519
|
WavelengthForm,
|
|
6241
6520
|
WavelengthInput,
|
|
6242
6521
|
WavelengthManyPlanes,
|
|
6522
|
+
WavelengthMenu,
|
|
6243
6523
|
WavelengthMultiSelectAutocomplete,
|
|
6244
6524
|
WavelengthNavBar,
|
|
6245
6525
|
WavelengthNotificationPanel,
|
|
6526
|
+
WavelengthPagination,
|
|
6246
6527
|
WavelengthPlaneTrail,
|
|
6247
6528
|
WavelengthProgressBar,
|
|
6248
6529
|
WavelengthSnackbar,
|
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.11.0",
|
|
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",
|