wj-elements 0.3.0-alpha.1 → 0.3.0-alpha.2
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/animations.js.map +1 -1
- package/dist/base-path.js.map +1 -1
- package/dist/date.js.map +1 -1
- package/dist/element-utils.js.map +1 -1
- package/dist/event.js.map +1 -1
- package/dist/form-associated-element-DEQ4y-jn.js.map +1 -1
- package/dist/icon-DVyMc4Wv.js.map +1 -1
- package/dist/localize.js.map +1 -1
- package/dist/permissions.js.map +1 -1
- package/dist/{popup.element-Cl6QeG8M.js → popup.element-DklicGea.js} +129 -96
- package/dist/popup.element-DklicGea.js.map +1 -0
- package/dist/{router-links-CJnOdbas.js → router-links-wjqCnncc.js} +9 -3
- package/dist/router-links-wjqCnncc.js.map +1 -0
- package/dist/universal-service.js.map +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/wje-accordion-item.js.map +1 -1
- package/dist/wje-accordion.js.map +1 -1
- package/dist/wje-animation.js.map +1 -1
- package/dist/wje-aside.js.map +1 -1
- package/dist/wje-avatar.js.map +1 -1
- package/dist/wje-badge.js.map +1 -1
- package/dist/wje-breadcrumb.js.map +1 -1
- package/dist/wje-breadcrumbs.js.map +1 -1
- package/dist/wje-button-group.js.map +1 -1
- package/dist/wje-button.js +1 -1
- package/dist/wje-button.js.map +1 -1
- package/dist/wje-card-content.js.map +1 -1
- package/dist/wje-card-controls.js.map +1 -1
- package/dist/wje-card-header.js.map +1 -1
- package/dist/wje-card-subtitle.js.map +1 -1
- package/dist/wje-card-title.js.map +1 -1
- package/dist/wje-card.js.map +1 -1
- package/dist/wje-carousel-item.js.map +1 -1
- package/dist/wje-carousel.js.map +1 -1
- package/dist/wje-checkbox.js.map +1 -1
- package/dist/wje-chip.js.map +1 -1
- package/dist/wje-col.js.map +1 -1
- package/dist/wje-color-picker.js +2 -2
- package/dist/wje-color-picker.js.map +1 -1
- package/dist/wje-container.js.map +1 -1
- package/dist/wje-copy-button.js.map +1 -1
- package/dist/wje-dialog.js.map +1 -1
- package/dist/wje-divider.js.map +1 -1
- package/dist/wje-dropdown.js +1 -1
- package/dist/wje-dropdown.js.map +1 -1
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-file-upload-item.js.map +1 -1
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-footer.js.map +1 -1
- package/dist/wje-form.js.map +1 -1
- package/dist/wje-format-digital.js.map +1 -1
- package/dist/wje-grid.js.map +1 -1
- package/dist/wje-header.js.map +1 -1
- package/dist/wje-icon-library.js.map +1 -1
- package/dist/wje-icon-picker.js.map +1 -1
- package/dist/wje-img-comparer.js.map +1 -1
- package/dist/wje-img.js.map +1 -1
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input-file.js.map +1 -1
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-item.js.map +1 -1
- package/dist/wje-kanban.js.map +1 -1
- package/dist/wje-label.js.map +1 -1
- package/dist/wje-level-indicator.js.map +1 -1
- package/dist/wje-list.js.map +1 -1
- package/dist/wje-main.js.map +1 -1
- package/dist/wje-masonry.js.map +1 -1
- package/dist/wje-master.js +2 -2
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-menu-button.js.map +1 -1
- package/dist/wje-menu-item.js +1 -1
- package/dist/wje-menu-item.js.map +1 -1
- package/dist/wje-menu-label.js.map +1 -1
- package/dist/wje-menu.js.map +1 -1
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-orgchart-group.js.map +1 -1
- package/dist/wje-orgchart-item.js.map +1 -1
- package/dist/wje-orgchart.js.map +1 -1
- package/dist/wje-pagination.js.map +1 -1
- package/dist/wje-popup.js +1 -1
- package/dist/wje-progress-bar.js.map +1 -1
- package/dist/wje-qr-code.js +3 -3
- package/dist/wje-qr-code.js.map +1 -1
- package/dist/wje-radio-group.js.map +1 -1
- package/dist/wje-radio.js.map +1 -1
- package/dist/wje-rate.js.map +1 -1
- package/dist/wje-relative-time.js.map +1 -1
- package/dist/wje-reorder-dropzone.js.map +1 -1
- package/dist/wje-reorder-handle.js.map +1 -1
- package/dist/wje-reorder-item.js.map +1 -1
- package/dist/wje-reorder.js.map +1 -1
- package/dist/wje-route.js.map +1 -1
- package/dist/wje-router-link.js +1 -1
- package/dist/wje-router-link.js.map +1 -1
- package/dist/wje-router-outlet.js +15 -5
- package/dist/wje-router-outlet.js.map +1 -1
- package/dist/wje-routerx.js +64 -66
- package/dist/wje-routerx.js.map +1 -1
- package/dist/wje-row.js.map +1 -1
- package/dist/wje-select.js +1 -1
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-slider.js.map +1 -1
- package/dist/wje-sliding-container.js.map +1 -1
- package/dist/wje-split-view.js.map +1 -1
- package/dist/wje-status.js.map +1 -1
- package/dist/wje-step.js.map +1 -1
- package/dist/wje-stepper.js.map +1 -1
- package/dist/wje-store.js.map +1 -1
- package/dist/wje-tab-group.js.map +1 -1
- package/dist/wje-tab-panel.js.map +1 -1
- package/dist/wje-tab.js +1 -1
- package/dist/wje-tab.js.map +1 -1
- package/dist/wje-textarea.js.map +1 -1
- package/dist/wje-thumbnail.js.map +1 -1
- package/dist/wje-toast.js.map +1 -1
- package/dist/wje-toggle.js.map +1 -1
- package/dist/wje-toolbar-action.js.map +1 -1
- package/dist/wje-toolbar.js.map +1 -1
- package/dist/wje-tooltip.js +1 -1
- package/dist/wje-tooltip.js.map +1 -1
- package/dist/wje-tree-item.js.map +1 -1
- package/dist/wje-tree.js.map +1 -1
- package/dist/wje-visually-hidden.js.map +1 -1
- package/package.json +2 -2
- package/dist/popup.element-Cl6QeG8M.js.map +0 -1
- package/dist/router-links-CJnOdbas.js.map +0 -1
package/dist/wje-masonry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-masonry.js","sources":["../packages/wje-masonry/service/service.js","../packages/wje-masonry/masonry.element.js","../packages/wje-masonry/masonry.js"],"sourcesContent":["export const DEFAULT_MAX_COL_WIDTH = 500;\nexport const DEFAULT_DEBOUNCE_MS = 300;\n\nexport const COL_COUNT_CSS_VAR_NAME = `--wje-masonry-layout-col-count`;\nexport const GAP_CSS_VAR_NAME = `--wje-masonry-layout-gap`;\n\nexport const ELEMENT_NODE_TYPE = 1;\n\nconst DEBOUNCE_MAP = new Map();\n\n/**\n * Returns a number attribute from an element.\n * @param $elem\n * @param name\n * @param defaultValue\n * @returns {string|number}\n */\nexport function getNumberAttribute($elem, name, defaultValue) {\n const value = parseFloat($elem.getAttribute(name) || '');\n return isNaN(value) ? defaultValue : value;\n}\n\n/**\n * Returns the amount of cols that the masonry grid should have.\n * @param totalWidth\n * @param cols\n * @param maxColWidth\n */\nexport function getColCount(totalWidth, cols, maxColWidth) {\n return isNaN(cols) ? Math.max(1, Math.ceil(totalWidth / maxColWidth)) : cols;\n}\n\n/**\n * Debounces a function.\n * @param cb\n * @param ms\n * @param id\n */\nexport function debounce(cb, ms, id) {\n const existingTimeout = DEBOUNCE_MAP.get(id);\n if (existingTimeout !== null && existingTimeout !== undefined) window.clearTimeout(existingTimeout);\n DEBOUNCE_MAP.set(id, window.setTimeout(cb, ms));\n}\n\n/**\n * Returns the index of the column with the smallest height.\n * @param colHeights\n */\nexport function findSmallestColIndex(colHeights) {\n let smallestIndex = 0;\n let smallestHeight = Infinity;\n\n colHeights.forEach((height, i) => {\n if (height < smallestHeight) {\n smallestHeight = height;\n smallestIndex = i;\n }\n });\n\n return smallestIndex;\n}\n","import { default as WJElement } from '../wje-element/element.js';\nimport {\n COL_COUNT_CSS_VAR_NAME,\n debounce,\n DEFAULT_DEBOUNCE_MS,\n DEFAULT_MAX_COL_WIDTH,\n ELEMENT_NODE_TYPE,\n findSmallestColIndex,\n GAP_CSS_VAR_NAME,\n getColCount,\n getNumberAttribute,\n} from './service/service.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Masonry` is a custom web component that represents a masonry layout.\n * It extends from `WJElement`.\n * @summary This element represents a masonry layout.\n * @documentation https://elements.webjet.sk/components/masonry\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the masonry layout.\n * @csspart column - The individual columns in the masonry layout.\n * @slot - The default slot for the masonry layout.\n * @cssproperty [--wje-masonry-layout-gap=1rem] - The gap between items in the masonry layout. Accepts any valid CSS length. Default is 1rem.\n * @cssproperty [--wje-masonry-layout-col-count=1] - The count column in the masonry layout. Accepts any valid CSS length.\n * @tag wje-masonry\n */\nexport default class Masonry extends WJElement {\n /**\n * Constructor for the Masonry class.\n */\n constructor() {\n super();\n\n this.debounceId = `layout_${Math.random()}`;\n this.ro = undefined;\n this.currentRequestAnimationFrameCallback = undefined;\n this.unsetSlot = undefined;\n }\n\n /**\n * Setter for the maxColWidth property.\n * @param {number} value The maximum column width.\n */\n set maxColWidth(value) {\n this.setAttribute('max-col-width', value);\n }\n\n /**\n * Getter for the maxColWidth property.\n * @returns {number} The maximum column width.\n */\n get maxColWidth() {\n return this.hasAttribute('max-col-width') ? +this.getAttribute('max-col-width') : +DEFAULT_MAX_COL_WIDTH;\n }\n\n /**\n * Setter for the cols property.\n * @param {number} value The number of columns.\n */\n set cols(value) {\n if (this.hasAttribute('cols')) this.setAttribute('cols', value);\n else this.setAttribute('cols', 'auto');\n }\n\n /**\n * Getter for the cols property.\n * @returns {number} The number of columns.\n */\n get cols() {\n return getNumberAttribute(this, 'cols', 'auto');\n }\n\n /**\n * Setter for the gap property.\n * @param {number} value The gap between columns.\n */\n set gap(value) {\n this.setAttribute('gap', value);\n }\n\n /**\n * Getter for the gap property.\n * @returns {number} The gap between columns.\n */\n get gap() {\n return getNumberAttribute(this, 'gap', '24');\n }\n\n /**\n * Setter for the debounce property.\n * @param {number} value The debounce time.\n */\n set debounce(value) {\n this.setAttribute('debounce', value);\n }\n\n /**\n * Getter for the debounce property.\n * @returns {number} The debounce time.\n */\n get debounce() {\n return getNumberAttribute(this, 'debounce', DEFAULT_DEBOUNCE_MS);\n }\n\n /**\n * Getter for the columns property.\n * @returns {Array} An array of all the columns.\n */\n get columns() {\n return Array.from(this.shadowRoot.querySelectorAll(`.column`));\n }\n\n debounceId = `layout_${Math.random()}`;\n\n ro = undefined;\n\n className = 'Masonry';\n\n /**\n * Getter for the cssStyleSheet property.\n * @static\n * @returns {CSSStyleSheet} The CSS style sheet for the masonry layout.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes property.\n * @returns {Array} An array of the observed attributes.\n */\n static get observedAttributes() {\n return ['max-col-width', 'gap', 'cols'];\n }\n\n /**\n * Callback for when an attribute changes.\n */\n attributeChangedCallback(name, old, newName) {\n switch (name) {\n case 'gap':\n this.style.setProperty(GAP_CSS_VAR_NAME, `${this.gap}px`);\n break;\n }\n\n this.scheduleLayout();\n }\n\n /**\n * Callback for when the element is disconnected.\n */\n beforeDisconnect() {\n this.unsetSlot.removeEventListener('slotchange', this.onSlotChange);\n window.removeEventListener('resize', this.onResize);\n if (this.ro !== null && this.ro !== undefined) {\n this.ro.unobserve(this);\n }\n }\n\n /**\n * Sets up the attributes for the element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the element for the masonry layout.\n * @returns {DocumentFragment} The drawn element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('id', 'unset-items');\n native.setAttribute('part', 'native');\n\n let unsetSlot = document.createElement('slot');\n\n native.appendChild(unsetSlot);\n\n this.unsetSlot = unsetSlot;\n this.native = native;\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Called after the element is drawn.\n */\n afterDraw() {\n this.onSlotChange();\n this.onResize();\n this.layout();\n\n this.unsetSlot.addEventListener('slotchange', this.onSlotChange);\n\n if ('ResizeObserver' in window) {\n this.ro = new ResizeObserver(this.onResize);\n this.ro.observe(this);\n } else {\n window.addEventListener('resize', this.onResize);\n }\n }\n\n /**\n * Called when the slot changes.\n */\n onSlotChange = () => {\n const $unsetElements = (this.unsetSlot.assignedNodes() || []).filter(\n (node) => node.nodeType === ELEMENT_NODE_TYPE\n );\n if ($unsetElements.length > 0) {\n this.layout();\n }\n };\n\n /**\n * Called when the window resizes.\n * @param {Array} entries The entries to use.\n */\n onResize = (entries) => {\n const { width } =\n entries !== null && entries !== undefined && Array.isArray(entries) && entries.length > 0\n ? entries[0].contentRect\n : { width: this.offsetWidth };\n const colCount = getColCount(width, this.cols, this.maxColWidth);\n if (colCount !== this.columns.length) {\n this.scheduleLayout();\n }\n };\n\n /**\n * Renders the columns.\n * @param {number} colCount The number of columns to render.\n */\n renderCols(colCount) {\n const columns = this.columns;\n\n if (columns.length === colCount) {\n return;\n }\n\n for (let i = 0; i < colCount; i++) {\n const column = document.createElement('div');\n column.classList.add('column');\n column.setAttribute('part', `column column-${i}`);\n\n const slot = document.createElement('slot');\n slot.setAttribute('name', i);\n\n column.appendChild(slot);\n\n this.context.appendChild(column);\n }\n\n this.style.setProperty(COL_COUNT_CSS_VAR_NAME, colCount);\n }\n\n /**\n * Schedules a layout.\n * @param {number} ms The number of milliseconds to wait before laying out.\n */\n scheduleLayout(ms = this.debounce) {\n debounce(this.layout, ms, this.debounceId);\n }\n\n /**\n * Lays out the element.\n */\n layout = () => {\n if (\n this.currentRequestAnimationFrameCallback !== null &&\n this.currentRequestAnimationFrameCallback !== undefined\n ) {\n window.cancelAnimationFrame(this.currentRequestAnimationFrameCallback);\n }\n\n this.currentRequestAnimationFrameCallback = requestAnimationFrame(() => {\n const gap = this.gap;\n const $elements = Array.from(this.children).filter((node) => node.nodeType === ELEMENT_NODE_TYPE);\n const colCount = getColCount(this.offsetWidth, this.cols, this.maxColWidth);\n const colHeights = Array(colCount).fill(0);\n const writes = [];\n\n for (const elem of $elements) {\n const height = elem.getBoundingClientRect().height;\n let smallestColIndex = findSmallestColIndex(colHeights);\n\n colHeights[smallestColIndex] += height + +gap;\n\n const newSlot = smallestColIndex;\n\n if (elem.slot !== newSlot) {\n writes.push(() => (elem.slot = newSlot));\n }\n }\n\n for (const write of writes) {\n write();\n }\n\n this.renderCols(colCount);\n });\n };\n}\n","import Masonry from './masonry.element.js';\n\nexport default Masonry;\n\nMasonry.define('wje-masonry', Masonry);\n"],"names":[],"mappings":";;;;AACO,MAAM,sBAAsB;AAE5B,MAAM,yBAAyB;AAC/B,MAAM,mBAAmB;AAEzB,MAAM,oBAAoB;AAEjC,MAAM,eAAe,oBAAI,IAAK;AASvB,SAAS,mBAAmB,OAAO,MAAM,cAAc;AAC1D,QAAM,QAAQ,WAAW,MAAM,aAAa,IAAI,KAAK,EAAE;AACvD,SAAO,MAAM,KAAK,IAAI,eAAe;AACzC;AAQO,SAAS,YAAY,YAAY,MAAM,aAAa;AACvD,SAAO,MAAM,IAAI,IAAI,KAAK,IAAI,GAAG,KAAK,KAAK,aAAa,WAAW,CAAC,IAAI;AAC5E;AAQO,SAAS,SAAS,IAAI,IAAI,IAAI;AACjC,QAAM,kBAAkB,aAAa,IAAI,EAAE;AAC3C,MAAI,oBAAoB,QAAQ,oBAAoB,OAAW,QAAO,aAAa,eAAe;AAClG,eAAa,IAAI,IAAI,OAAO,WAAW,IAAI,EAAE,CAAC;AAClD;AAMO,SAAS,qBAAqB,YAAY;AAC7C,MAAI,gBAAgB;AACpB,MAAI,iBAAiB;AAErB,aAAW,QAAQ,CAAC,QAAQ,MAAM;AAC9B,QAAI,SAAS,gBAAgB;AACzB,uBAAiB;AACjB,sBAAgB;AAAA,IAC5B;AAAA,EACA,CAAK;AAED,SAAO;AACX;;AChCe,MAAM,gBAAgB,UAAU;AAAA;AAAA;AAAA;AAAA,EAI3C,cAAc;AACV,UAAO;AAiFX,sCAAa,UAAU,KAAK,OAAQ,CAAA;AAEpC;AAEA,qCAAY;AA8FZ;AAAA;AAAA;AAAA,wCAAe,MAAM;AACjB,YAAM,kBAAkB,KAAK,UAAU,cAAa,KAAM,CAAA,GAAI;AAAA,QAC1D,CAAC,SAAS,KAAK,aAAa;AAAA,MAC/B;AACD,UAAI,eAAe,SAAS,GAAG;AAC3B,aAAK,O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IACZ;AAEQ,aAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AAC/B,YAAM,SAAS,SAAS,cAAc,KAAK;AAC3C,aAAO,UAAU,IAAI,QAAQ;AAC7B,aAAO,aAAa,QAAQ,iBAAiB,CAAC,EAAE;AAEhD,YAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,WAAK,aAAa,QAAQ,CAAC;AAE3B,aAAO,YAAY,IAAI;AAEvB,WAAK,QAAQ,YAAY,MAAM;AAAA,IAC3C;AAEQ,SAAK,MAAM,YAAY,wBAAwB,QAAQ;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMI,eAAe,KAAK,KAAK,UAAU;AAC/B,aAAS,KAAK,QAAQ,IAAI,KAAK,UAAU;AAAA,EACjD;AAwCA;ACjTA,QAAQ,OAAO,eAAe,OAAO;"}
|
|
1
|
+
{"version":3,"file":"wje-masonry.js","sources":["../packages/wje-masonry/service/service.js","../packages/wje-masonry/masonry.element.js","../packages/wje-masonry/masonry.js"],"sourcesContent":["export const DEFAULT_MAX_COL_WIDTH = 500;\nexport const DEFAULT_DEBOUNCE_MS = 300;\n\nexport const COL_COUNT_CSS_VAR_NAME = `--wje-masonry-layout-col-count`;\nexport const GAP_CSS_VAR_NAME = `--wje-masonry-layout-gap`;\n\nexport const ELEMENT_NODE_TYPE = 1;\n\nconst DEBOUNCE_MAP = new Map();\n\n/**\n * Returns a number attribute from an element.\n * @param $elem\n * @param name\n * @param defaultValue\n * @returns {string|number}\n */\nexport function getNumberAttribute($elem, name, defaultValue) {\n const value = parseFloat($elem.getAttribute(name) || '');\n return isNaN(value) ? defaultValue : value;\n}\n\n/**\n * Returns the amount of cols that the masonry grid should have.\n * @param totalWidth\n * @param cols\n * @param maxColWidth\n */\nexport function getColCount(totalWidth, cols, maxColWidth) {\n return isNaN(cols) ? Math.max(1, Math.ceil(totalWidth / maxColWidth)) : cols;\n}\n\n/**\n * Debounces a function.\n * @param cb\n * @param ms\n * @param id\n */\nexport function debounce(cb, ms, id) {\n const existingTimeout = DEBOUNCE_MAP.get(id);\n if (existingTimeout !== null && existingTimeout !== undefined) window.clearTimeout(existingTimeout);\n DEBOUNCE_MAP.set(id, window.setTimeout(cb, ms));\n}\n\n/**\n * Returns the index of the column with the smallest height.\n * @param colHeights\n */\nexport function findSmallestColIndex(colHeights) {\n let smallestIndex = 0;\n let smallestHeight = Infinity;\n\n colHeights.forEach((height, i) => {\n if (height < smallestHeight) {\n smallestHeight = height;\n smallestIndex = i;\n }\n });\n\n return smallestIndex;\n}\n","import { default as WJElement } from '../wje-element/element.js';\nimport {\n COL_COUNT_CSS_VAR_NAME,\n debounce,\n DEFAULT_DEBOUNCE_MS,\n DEFAULT_MAX_COL_WIDTH,\n ELEMENT_NODE_TYPE,\n findSmallestColIndex,\n GAP_CSS_VAR_NAME,\n getColCount,\n getNumberAttribute,\n} from './service/service.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Masonry` is a custom web component that represents a masonry layout.\n * It extends from `WJElement`.\n * @summary This element represents a masonry layout.\n * @documentation https://elements.webjet.sk/components/masonry\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the masonry layout.\n * @csspart column - The individual columns in the masonry layout.\n * @slot - The default slot for the masonry layout.\n * @cssproperty [--wje-masonry-layout-gap=1rem] - The gap between items in the masonry layout. Accepts any valid CSS length. Default is 1rem.\n * @cssproperty [--wje-masonry-layout-col-count=1] - The count column in the masonry layout. Accepts any valid CSS length.\n * @tag wje-masonry\n */\nexport default class Masonry extends WJElement {\n /**\n * Constructor for the Masonry class.\n */\n constructor() {\n super();\n\n this.debounceId = `layout_${Math.random()}`;\n this.ro = undefined;\n this.currentRequestAnimationFrameCallback = undefined;\n this.unsetSlot = undefined;\n }\n\n /**\n * Setter for the maxColWidth property.\n * @param {number} value The maximum column width.\n */\n set maxColWidth(value) {\n this.setAttribute('max-col-width', value);\n }\n\n /**\n * Getter for the maxColWidth property.\n * @returns {number} The maximum column width.\n */\n get maxColWidth() {\n return this.hasAttribute('max-col-width') ? +this.getAttribute('max-col-width') : +DEFAULT_MAX_COL_WIDTH;\n }\n\n /**\n * Setter for the cols property.\n * @param {number} value The number of columns.\n */\n set cols(value) {\n if (this.hasAttribute('cols')) this.setAttribute('cols', value);\n else this.setAttribute('cols', 'auto');\n }\n\n /**\n * Getter for the cols property.\n * @returns {number} The number of columns.\n */\n get cols() {\n return getNumberAttribute(this, 'cols', 'auto');\n }\n\n /**\n * Setter for the gap property.\n * @param {number} value The gap between columns.\n */\n set gap(value) {\n this.setAttribute('gap', value);\n }\n\n /**\n * Getter for the gap property.\n * @returns {number} The gap between columns.\n */\n get gap() {\n return getNumberAttribute(this, 'gap', '24');\n }\n\n /**\n * Setter for the debounce property.\n * @param {number} value The debounce time.\n */\n set debounce(value) {\n this.setAttribute('debounce', value);\n }\n\n /**\n * Getter for the debounce property.\n * @returns {number} The debounce time.\n */\n get debounce() {\n return getNumberAttribute(this, 'debounce', DEFAULT_DEBOUNCE_MS);\n }\n\n /**\n * Getter for the columns property.\n * @returns {Array} An array of all the columns.\n */\n get columns() {\n return Array.from(this.shadowRoot.querySelectorAll(`.column`));\n }\n\n debounceId = `layout_${Math.random()}`;\n\n ro = undefined;\n\n className = 'Masonry';\n\n /**\n * Getter for the cssStyleSheet property.\n * @static\n * @returns {CSSStyleSheet} The CSS style sheet for the masonry layout.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes property.\n * @returns {Array} An array of the observed attributes.\n */\n static get observedAttributes() {\n return ['max-col-width', 'gap', 'cols'];\n }\n\n /**\n * Callback for when an attribute changes.\n */\n attributeChangedCallback(name, old, newName) {\n switch (name) {\n case 'gap':\n this.style.setProperty(GAP_CSS_VAR_NAME, `${this.gap}px`);\n break;\n }\n\n this.scheduleLayout();\n }\n\n /**\n * Callback for when the element is disconnected.\n */\n beforeDisconnect() {\n this.unsetSlot.removeEventListener('slotchange', this.onSlotChange);\n window.removeEventListener('resize', this.onResize);\n if (this.ro !== null && this.ro !== undefined) {\n this.ro.unobserve(this);\n }\n }\n\n /**\n * Sets up the attributes for the element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the element for the masonry layout.\n * @returns {DocumentFragment} The drawn element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('id', 'unset-items');\n native.setAttribute('part', 'native');\n\n let unsetSlot = document.createElement('slot');\n\n native.appendChild(unsetSlot);\n\n this.unsetSlot = unsetSlot;\n this.native = native;\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Called after the element is drawn.\n */\n afterDraw() {\n this.onSlotChange();\n this.onResize();\n this.layout();\n\n this.unsetSlot.addEventListener('slotchange', this.onSlotChange);\n\n if ('ResizeObserver' in window) {\n this.ro = new ResizeObserver(this.onResize);\n this.ro.observe(this);\n } else {\n window.addEventListener('resize', this.onResize);\n }\n }\n\n /**\n * Called when the slot changes.\n */\n onSlotChange = () => {\n const $unsetElements = (this.unsetSlot.assignedNodes() || []).filter(\n (node) => node.nodeType === ELEMENT_NODE_TYPE\n );\n if ($unsetElements.length > 0) {\n this.layout();\n }\n };\n\n /**\n * Called when the window resizes.\n * @param {Array} entries The entries to use.\n */\n onResize = (entries) => {\n const { width } =\n entries !== null && entries !== undefined && Array.isArray(entries) && entries.length > 0\n ? entries[0].contentRect\n : { width: this.offsetWidth };\n const colCount = getColCount(width, this.cols, this.maxColWidth);\n if (colCount !== this.columns.length) {\n this.scheduleLayout();\n }\n };\n\n /**\n * Renders the columns.\n * @param {number} colCount The number of columns to render.\n */\n renderCols(colCount) {\n const columns = this.columns;\n\n if (columns.length === colCount) {\n return;\n }\n\n for (let i = 0; i < colCount; i++) {\n const column = document.createElement('div');\n column.classList.add('column');\n column.setAttribute('part', `column column-${i}`);\n\n const slot = document.createElement('slot');\n slot.setAttribute('name', i);\n\n column.appendChild(slot);\n\n this.context.appendChild(column);\n }\n\n this.style.setProperty(COL_COUNT_CSS_VAR_NAME, colCount);\n }\n\n /**\n * Schedules a layout.\n * @param {number} ms The number of milliseconds to wait before laying out.\n */\n scheduleLayout(ms = this.debounce) {\n debounce(this.layout, ms, this.debounceId);\n }\n\n /**\n * Lays out the element.\n */\n layout = () => {\n if (\n this.currentRequestAnimationFrameCallback !== null &&\n this.currentRequestAnimationFrameCallback !== undefined\n ) {\n window.cancelAnimationFrame(this.currentRequestAnimationFrameCallback);\n }\n\n this.currentRequestAnimationFrameCallback = requestAnimationFrame(() => {\n const gap = this.gap;\n const $elements = Array.from(this.children).filter((node) => node.nodeType === ELEMENT_NODE_TYPE);\n const colCount = getColCount(this.offsetWidth, this.cols, this.maxColWidth);\n const colHeights = Array(colCount).fill(0);\n const writes = [];\n\n for (const elem of $elements) {\n const height = elem.getBoundingClientRect().height;\n let smallestColIndex = findSmallestColIndex(colHeights);\n\n colHeights[smallestColIndex] += height + +gap;\n\n const newSlot = smallestColIndex;\n\n if (elem.slot !== newSlot) {\n writes.push(() => (elem.slot = newSlot));\n }\n }\n\n for (const write of writes) {\n write();\n }\n\n this.renderCols(colCount);\n });\n };\n}\n","import Masonry from './masonry.element.js';\n\nexport default Masonry;\n\nMasonry.define('wje-masonry', Masonry);\n"],"names":[],"mappings":";;;;AACO,MAAM,sBAAsB;AAE5B,MAAM,yBAAyB;AAC/B,MAAM,mBAAmB;AAEzB,MAAM,oBAAoB;AAEjC,MAAM,eAAe,oBAAI,IAAG;AASrB,SAAS,mBAAmB,OAAO,MAAM,cAAc;AAC1D,QAAM,QAAQ,WAAW,MAAM,aAAa,IAAI,KAAK,EAAE;AACvD,SAAO,MAAM,KAAK,IAAI,eAAe;AACzC;AAQO,SAAS,YAAY,YAAY,MAAM,aAAa;AACvD,SAAO,MAAM,IAAI,IAAI,KAAK,IAAI,GAAG,KAAK,KAAK,aAAa,WAAW,CAAC,IAAI;AAC5E;AAQO,SAAS,SAAS,IAAI,IAAI,IAAI;AACjC,QAAM,kBAAkB,aAAa,IAAI,EAAE;AAC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Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { b } from "./router-links-
|
|
4
|
+
import { b } from "./router-links-wjqCnncc.js";
|
|
5
5
|
import { Localizer } from "./localize.js";
|
|
6
6
|
import { Permissions } from "./permissions.js";
|
|
7
7
|
import { UniversalService } from "./universal-service.js";
|
|
@@ -105,7 +105,7 @@ import { default as default89 } from "./wje-tooltip.js";
|
|
|
105
105
|
import { default as default90 } from "./wje-tree.js";
|
|
106
106
|
import { default as default91 } from "./wje-tree-item.js";
|
|
107
107
|
import { default as default92 } from "./wje-visually-hidden.js";
|
|
108
|
-
import { P } from "./popup.element-
|
|
108
|
+
import { P } from "./popup.element-DklicGea.js";
|
|
109
109
|
const skSk = {
|
|
110
110
|
code: "sk-sk",
|
|
111
111
|
name: "Slovak",
|
package/dist/wje-master.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-master.js","sources":["../packages/translations/sk-sk.js","../packages/translations/en-gb.js","../packages/wje-timeline/timeline.element.js","../packages/wje-timeline/timeline.js","../packages/wje-timeline-item/timeline-item.element.js","../packages/wje-timeline-item/timeline-item.js"],"sourcesContent":["import { Localizer } from '../utils/localize.js';\n\nexport const skSk = {\n code: 'sk-sk',\n name: 'Slovak',\n dir: 'ltr',\n\n welcome: 'Vitajte',\n 'wj.file.upload.button': 'Vybrať súbor',\n 'wj.file.upload.uploaded': 'Nahraných: ',\n 'wj.file.upload.from': 'z',\n 'wj.stepper.button.next': 'Ďalej',\n 'wj.stepper.button.finish': 'Dokončiť',\n 'wj.stepper.button.previous': 'Späť',\n 'wj.stepper.step': 'Krok',\n};\n\nLocalizer.registerTranslation(skSk);\n","import { Localizer } from '../utils/localize.js';\n\nexport const enGb = {\n code: 'en-gb',\n name: 'English',\n dir: 'ltr',\n\n welcome: 'Welcome',\n 'wj.file.upload.button': 'Browse files',\n 'wj.file.upload.uploaded': 'Uploaded: ',\n 'wj.file.upload.from': 'from',\n 'wj.stepper.button.next': 'Next',\n 'wj.stepper.button.finish': 'Finish',\n 'wj.stepper.button.previous': 'Previous',\n 'wj.stepper.step': 'Step',\n 'wj.pagination.of': 'of',\n 'wj.pagination.first': 'First page',\n 'wj.pagination.prev': 'Previous',\n 'wj.pagination.next': 'Next',\n 'wj.pagination.last': 'Last page',\n};\n\nLocalizer.registerTranslation(enGb);\n","import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Timeline` is a custom web component that represents a timeline.\n * @summary This element represents a timeline.\n * @documentation https://elements.webjet.sk/components/timeline\n * @status stable\n * @augments WJElement\n * @slot - Slot for the timeline items.\n * @csspart native - The native part of the rating component.\n * @csspart vertical-line - The vertical line part of the rating component.\n * @tag wje-timeline\n */\nexport default class Timeline extends WJElement {\n /**\n * Creates an instance of Timeline.\n */\n constructor() {\n super();\n }\n\n /**\n * The class name for the component.\n */\n className = 'Timeline';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n /**\n * Draws the component for the timeline.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n const native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-timeline');\n\n const verticalLine = document.createElement('div');\n verticalLine.setAttribute('part', 'vertical-line');\n verticalLine.classList.add('vertical-line');\n\n const slot = document.createElement('slot');\n\n native.appendChild(verticalLine);\n native.appendChild(slot);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Sync ARIA attributes on host.\n */\n syncAria() {\n if (!this.hasAttribute('role')) {\n this.setAriaState({ role: 'list' });\n }\n }\n}\n","import Timeline from './timeline.element.js';\n\nexport default Timeline;\n\nTimeline.define('wje-timeline', Timeline);\n","import { formatDate } from '../utils/date.js';\nimport { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * The TimelineItem component.\n * @summary This element represents a timeline item.\n * @documentation https://elements.webjet.sk/components/timeline-item\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the timeline item.\n * @csspart content-container - The content container part of the timeline item.\n * @csspart default-icon - The default icon part of the timeline item.\n * @slot - Slot for the content of the timeline item.\n * @slot status - Slot for the status of the timeline item.\n * @tag wje-timeline-item\n */\nexport default class TimelineItem extends WJElement {\n constructor() {\n super();\n }\n\n /**\n * Returns the class name of the tab.\n * @returns {string} The class name of the tab.\n */\n className = 'TimelineItem';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAttribute('relative-time', '');\n }\n\n /**\n * Draws the component for the timeline item.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-timeline-item');\n\n let contentContainer = document.createElement('div');\n contentContainer.setAttribute('part', 'content-container');\n contentContainer.classList.add('content-container');\n\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('text', this.getAttribute('tooltip') || '');\n tooltip.setAttribute('position', 'top');\n tooltip.setAttribute('content', formatDate(this.datetime, 'dd.MM.yyyy HH:mm'));\n\n let relativeTime = document.createElement('wje-relative-time');\n relativeTime.setAttribute('date', this.datetime || '');\n relativeTime.setAttribute('format', this.getAttribute('format') || '');\n\n tooltip.appendChild(relativeTime);\n\n let event = document.createElement('h3');\n event.classList.add('event');\n event.textContent = this.getAttribute('event') || '';\n\n // additional text content\n let slot = document.createElement('slot');\n\n // status slot\n let slotStatus = document.createElement('wje-icon');\n slotStatus.setAttribute('name', 'circle-dot');\n slotStatus.setAttribute('filled', '');\n slotStatus.setAttribute('part', 'default-icon');\n\n // if status slot is present\n if (this.querySelector('[slot=\"status\"]')) {\n slotStatus = document.createElement('slot');\n slotStatus.setAttribute('name', 'status');\n }\n\n contentContainer.appendChild(tooltip);\n contentContainer.appendChild(event);\n contentContainer.appendChild(slot);\n\n native.appendChild(slotStatus);\n native.appendChild(contentContainer);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n}\n","import TimelineItem from './timeline-item.element.js';\n\nexport default TimelineItem;\n\nTimelineItem.define('wje-timeline-item', TimelineItem);\n"],"names":["styles","event"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEY,MAAC,OAAO;AAAA,EAChB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EAEL,SAAS;AAAA,EACT,yBAAyB;AAAA,EACzB,2BAA2B;AAAA,EAC3B,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,8BAA8B;AAAA,EAC9B,mBAAmB;AACvB;AAEA,UAAU,oBAAoB,IAAI;ACftB,MAAC,OAAO;AAAA,EAChB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EAEL,SAAS;AAAA,EACT,yBAAyB;AAAA,EACzB,2BAA2B;AAAA,EAC3B,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,8BAA8B;AAAA,EAC9B,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,sBAAsB;AAC1B;AAEA,UAAU,oBAAoB,IAAI;;ACRnB,MAAM,iB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","sources":["../packages/translations/sk-sk.js","../packages/translations/en-gb.js","../packages/wje-timeline/timeline.element.js","../packages/wje-timeline/timeline.js","../packages/wje-timeline-item/timeline-item.element.js","../packages/wje-timeline-item/timeline-item.js"],"sourcesContent":["import { Localizer } from '../utils/localize.js';\n\nexport const skSk = {\n code: 'sk-sk',\n name: 'Slovak',\n dir: 'ltr',\n\n welcome: 'Vitajte',\n 'wj.file.upload.button': 'Vybrať súbor',\n 'wj.file.upload.uploaded': 'Nahraných: ',\n 'wj.file.upload.from': 'z',\n 'wj.stepper.button.next': 'Ďalej',\n 'wj.stepper.button.finish': 'Dokončiť',\n 'wj.stepper.button.previous': 'Späť',\n 'wj.stepper.step': 'Krok',\n};\n\nLocalizer.registerTranslation(skSk);\n","import { Localizer } from '../utils/localize.js';\n\nexport const enGb = {\n code: 'en-gb',\n name: 'English',\n dir: 'ltr',\n\n welcome: 'Welcome',\n 'wj.file.upload.button': 'Browse files',\n 'wj.file.upload.uploaded': 'Uploaded: ',\n 'wj.file.upload.from': 'from',\n 'wj.stepper.button.next': 'Next',\n 'wj.stepper.button.finish': 'Finish',\n 'wj.stepper.button.previous': 'Previous',\n 'wj.stepper.step': 'Step',\n 'wj.pagination.of': 'of',\n 'wj.pagination.first': 'First page',\n 'wj.pagination.prev': 'Previous',\n 'wj.pagination.next': 'Next',\n 'wj.pagination.last': 'Last page',\n};\n\nLocalizer.registerTranslation(enGb);\n","import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Timeline` is a custom web component that represents a timeline.\n * @summary This element represents a timeline.\n * @documentation https://elements.webjet.sk/components/timeline\n * @status stable\n * @augments WJElement\n * @slot - Slot for the timeline items.\n * @csspart native - The native part of the rating component.\n * @csspart vertical-line - The vertical line part of the rating component.\n * @tag wje-timeline\n */\nexport default class Timeline extends WJElement {\n /**\n * Creates an instance of Timeline.\n */\n constructor() {\n super();\n }\n\n /**\n * The class name for the component.\n */\n className = 'Timeline';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n /**\n * Draws the component for the timeline.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n const native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-timeline');\n\n const verticalLine = document.createElement('div');\n verticalLine.setAttribute('part', 'vertical-line');\n verticalLine.classList.add('vertical-line');\n\n const slot = document.createElement('slot');\n\n native.appendChild(verticalLine);\n native.appendChild(slot);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Sync ARIA attributes on host.\n */\n syncAria() {\n if (!this.hasAttribute('role')) {\n this.setAriaState({ role: 'list' });\n }\n }\n}\n","import Timeline from './timeline.element.js';\n\nexport default Timeline;\n\nTimeline.define('wje-timeline', Timeline);\n","import { formatDate } from '../utils/date.js';\nimport { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * The TimelineItem component.\n * @summary This element represents a timeline item.\n * @documentation https://elements.webjet.sk/components/timeline-item\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the timeline item.\n * @csspart content-container - The content container part of the timeline item.\n * @csspart default-icon - The default icon part of the timeline item.\n * @slot - Slot for the content of the timeline item.\n * @slot status - Slot for the status of the timeline item.\n * @tag wje-timeline-item\n */\nexport default class TimelineItem extends WJElement {\n constructor() {\n super();\n }\n\n /**\n * Returns the class name of the tab.\n * @returns {string} The class name of the tab.\n */\n className = 'TimelineItem';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAttribute('relative-time', '');\n }\n\n /**\n * Draws the component for the timeline item.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-timeline-item');\n\n let contentContainer = document.createElement('div');\n contentContainer.setAttribute('part', 'content-container');\n contentContainer.classList.add('content-container');\n\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('text', this.getAttribute('tooltip') || '');\n tooltip.setAttribute('position', 'top');\n tooltip.setAttribute('content', formatDate(this.datetime, 'dd.MM.yyyy HH:mm'));\n\n let relativeTime = document.createElement('wje-relative-time');\n relativeTime.setAttribute('date', this.datetime || '');\n relativeTime.setAttribute('format', this.getAttribute('format') || '');\n\n tooltip.appendChild(relativeTime);\n\n let event = document.createElement('h3');\n event.classList.add('event');\n event.textContent = this.getAttribute('event') || '';\n\n // additional text content\n let slot = document.createElement('slot');\n\n // status slot\n let slotStatus = document.createElement('wje-icon');\n slotStatus.setAttribute('name', 'circle-dot');\n slotStatus.setAttribute('filled', '');\n slotStatus.setAttribute('part', 'default-icon');\n\n // if status slot is present\n if (this.querySelector('[slot=\"status\"]')) {\n slotStatus = document.createElement('slot');\n slotStatus.setAttribute('name', 'status');\n }\n\n contentContainer.appendChild(tooltip);\n contentContainer.appendChild(event);\n contentContainer.appendChild(slot);\n\n native.appendChild(slotStatus);\n native.appendChild(contentContainer);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n}\n","import TimelineItem from './timeline-item.element.js';\n\nexport default TimelineItem;\n\nTimelineItem.define('wje-timeline-item', TimelineItem);\n"],"names":["styles","event"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEY,MAAC,OAAO;AAAA,EAChB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EAEL,SAAS;AAAA,EACT,yBAAyB;AAAA,EACzB,2BAA2B;AAAA,EAC3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AAc,MAAM;AAGxC,QAAI,aAAa,SAAS,cAAc,UAAU;AAClD,eAAW,aAAa,QAAQ,YAAY;AAC5C,eAAW,aAAa,UAAU,EAAE;AACpC,eAAW,aAAa,QAAQ,cAAc;AAG9C,QAAI,KAAK,cAAc,iBAAiB,GAAG;AACvC,mBAAa,SAAS,cAAc,MAAM;AAC1C,iBAAW,aAAa,QAAQ,QAAQ;AAAA,IAC5C;AAEA,qBAAiB,YAAY,OAAO;AACpC,qBAAiB,YAAYA,MAAK;AAClC,qBAAiB,YAAY,IAAI;AAEjC,WAAO,YAAY,UAAU;AAC7B,WAAO,YAAY,gBAAgB;AAEnC,aAAS,YAAY,MAAM;AAE3B,WAAO;AAAA,EACX;AACJ;ACjGA,aAAa,OAAO,qBAAqB,YAAY;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-menu-button.js","sources":["../packages/wje-menu-button/menu-button.element.js","../packages/wje-menu-button/menu-button.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `MenuButton` is a custom web component that represents a menu button.\n * @summary This element represents a menu button.\n * @documentation https://elements.webjet.sk/components/menu-button\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the menu button.\n * // @fires click - Event fired when the menu button is clicked.\n * @tag wje-menu-button\n */\n\nexport default class MenuButton extends WJElement {\n /**\n * Creates an instance of MenuButton.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'MenuButton';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAriaState({ role: 'button' });\n }\n\n /**\n * Draws the component for the menu button.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let slot = document.createElement('slot');\n\n fragment.appendChild(slot);\n\n return fragment;\n }\n\n /**\n * Refreshes the component after drawing. Adds a click event listener that toggles the \"open\" class on the content element.\n */\n afterDraw() {\n event.addListener(this, 'click', null, (e) => {\n document.querySelector(`#${this.contentId}`).classList.toggle('open');\n });\n }\n}\n","import MenuButton from './menu-button.element.js';\n\nexport default MenuButton;\n\nMenuButton.define('wje-menu-button', MenuButton);\n"],"names":[],"mappings":";;;;;;AAce,MAAM,mBAAmB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK9C,cAAc;AACV,
|
|
1
|
+
{"version":3,"file":"wje-menu-button.js","sources":["../packages/wje-menu-button/menu-button.element.js","../packages/wje-menu-button/menu-button.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `MenuButton` is a custom web component that represents a menu button.\n * @summary This element represents a menu button.\n * @documentation https://elements.webjet.sk/components/menu-button\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the menu button.\n * // @fires click - Event fired when the menu button is clicked.\n * @tag wje-menu-button\n */\n\nexport default class MenuButton extends WJElement {\n /**\n * Creates an instance of MenuButton.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'MenuButton';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAriaState({ role: 'button' });\n }\n\n /**\n * Draws the component for the menu button.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let slot = document.createElement('slot');\n\n fragment.appendChild(slot);\n\n return fragment;\n }\n\n /**\n * Refreshes the component after drawing. Adds a click event listener that toggles the \"open\" class on the content element.\n */\n afterDraw() {\n event.addListener(this, 'click', null, (e) => {\n document.querySelector(`#${this.contentId}`).classList.toggle('open');\n });\n }\n}\n","import MenuButton from './menu-button.element.js';\n\nexport default MenuButton;\n\nMenuButton.define('wje-menu-button', MenuButton);\n"],"names":[],"mappings":";;;;;;AAce,MAAM,mBAAmB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK9C,cAAc;AACV,UAAK;AAGT,qCAAY;AAAA,EAFZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,WAAW,gBAAgB;AACvB,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW,qBAAqB;AAC5B,WAAO,CAAA;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAkB;AACd,SAAK,eAAe;AACpB,SAAK,aAAa,EAAE,MAAM,SAAQ,CAAE;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO;AACH,QAAI,WAAW,SAAS,uBAAsB;AAE9C,QAAI,OAAO,SAAS,cAAc,MAAM;AAExC,aAAS,YAAY,IAAI;AAEzB,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AACR,UAAM,YAAY,MAAM,SAAS,MAAM,CAAC,MAAM;AAC1C,eAAS,cAAc,IAAI,KAAK,SAAS,EAAE,EAAE,UAAU,OAAO,MAAM;AAAA,IACxE,CAAC;AAAA,EACL;AACJ;ACrEA,WAAW,OAAO,mBAAmB,UAAU;"}
|
package/dist/wje-menu-item.js
CHANGED
|
@@ -8,7 +8,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
8
8
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
9
9
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
10
10
|
var _MenuItem_instances, populateCustomEvent_fn;
|
|
11
|
-
import { b as bindRouterLinks } from "./router-links-
|
|
11
|
+
import { b as bindRouterLinks } from "./router-links-wjqCnncc.js";
|
|
12
12
|
import WJElement from "./wje-element.js";
|
|
13
13
|
import { WjElementUtils } from "./element-utils.js";
|
|
14
14
|
import { event } from "./event.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-menu-item.js","sources":["../packages/wje-menu-item/menu-item.element.js","../packages/wje-menu-item/menu-item.js"],"sourcesContent":["import { bindRouterLinks } from 'slick-router/middlewares/router-links.js';\n\nimport { default as WJElement, event, WjElementUtils } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `MenuItem` is a custom web component that represents a menu item.\n * @summary This element represents a menu item.\n * @documentation https://elements.webjet.sk/components/menu-item\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the menu item.\n * @csspart submenu - The submenu part of the menu item.\n * @slot - The default slot for the menu item.\n * @slot start - The slot for the start of the menu item.\n * @slot end - The slot for the end of the menu item.\n * @slot submenu - The slot for the submenu of the menu item.\n * @cssproperty [--wje-menu-item-color=var(--wje-color)] - Sets the text color of a menu item. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-background=transparent] - Defines the background color of a menu item. Default is `transparent`. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-color-hover=var(--wje-color-contrast-8)] - Specifies the text color of a menu item when hovered. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-background-hover=var(--wje-border-color)] - Sets the background color of a menu item when hovered. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-color-focus=var(--wje-color-contrast-8)] - Defines the text color of a menu item when focused. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-background-focus=var(--wje-border-color)] - Specifies the background color of a menu item when focused. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-color-active=var(--wje-color-contrast-8)] - Sets the text color of a menu item when active. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-background-active=var(--wje-border-color)] - Specifies the background color of a menu item when active. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-padding-top=.5rem] - Specifies the top padding inside a menu item. Accepts any valid CSS length value (e.g., `px`, `rem`).\n * @cssproperty [--wje-menu-item-padding-bottom=.5rem] - Specifies the bottom padding inside a menu item. Accepts any valid CSS length value (e.g., `px`, `rem`).\n * @cssproperty [--wje-menu-item-line-height=1.8rem] - Sets the line height for the text within a menu item. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-submenu-offset=0] - Determines the horizontal offset of a submenu relative to its parent. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-item-icon-visibility=hidden] - Controls the visibility of the icon in a menu item. Accepts `visible`, `hidden`, or `collapse`.\n * @cssproperty [--wje-menu-item-safe-triangle-cursor-x] - Specifies the x-coordinate of the cursor for the safe triangle area. Used for managing hover or focus transitions between menu items and submenus.\n * @cssproperty [--wje-menu-item-safe-triangle-cursor-y] - Specifies the y-coordinate of the cursor for the safe triangle area.\n * @cssproperty [--wje-menu-item-safe-triangle-submenu-start-x] - Defines the x-coordinate where the submenu's safe triangle starts. Helps prevent accidental submenu closing when navigating.\n * @cssproperty [--wje-menu-item-safe-triangle-submenu-start-y] - Defines the y-coordinate where the submenu's safe triangle starts.\n * @cssproperty [--wje-menu-item-safe-triangle-submenu-end-x] - Specifies the x-coordinate where the submenu's safe triangle ends.\n * @cssproperty [--wje-menu-item-safe-triangle-submenu-end-y] - Specifies the y-coordinate where the submenu's safe triangle ends.\n * @tag wje-menu-item\n */\nexport default class MenuItem extends WJElement {\n /**\n * Constructor for MenuItem class.\n * @class\n */\n constructor() {\n super();\n\n this._bind = false;\n\n }\n\n /**\n * Getter for placement attribute.\n * @returns {string} The placement attribute of the menu or \"right-start\" if it doesn't exist.\n */\n get placement() {\n let menu = this.querySelector('wje-menu');\n\n if (menu?.hasAttribute('placement')) {\n return menu.getAttribute('placement');\n }\n return 'right-start';\n }\n\n /**\n * Getter for offset attribute.\n * @returns {string} The offset attribute of the menu or \"0\" if it doesn't exist.\n */\n get offset() {\n let menu = this.querySelector('wje-menu');\n\n if (menu?.hasAttribute('offset')) {\n return menu.getAttribute('offset');\n }\n return '0';\n }\n\n /**\n * Getter for variant attribute.\n * @returns {string} The variant attribute of the menu or \"CONTEXT\" if it doesn't exist.\n */\n get variant() {\n let menu = this.querySelector('wje-menu');\n\n if (menu?.hasAttribute('variant') && !this.collapse) {\n return menu.getAttribute('variant').toUpperCase();\n }\n\n return 'CONTEXT';\n }\n\n /**\n * Getter for collapse attribute.\n * @returns {boolean} True if the closest parent has the collapse attribute, false otherwise.\n */\n get collapse() {\n if (this.closest('[collapse]')) return true;\n\n return false;\n }\n\n /**\n * Sets the value of the custom event attribute.\n * @param {string} value The value to be assigned to the custom event attribute.\n */\n set customEvent(value) {\n this.setAttribute('custom-event', value);\n }\n\n /**\n * Retrieves the value of the 'custom-event' attribute from the element.\n * @returns {string | null} The value of the 'custom-event' attribute, or null if the attribute is not set.\n */\n get customEvent() {\n return this.getAttribute('custom-event');\n }\n\n /**\n * Retrieves a mapped object containing custom event parameters extracted from the element's attributes.\n * Attributes considered are those that begin with 'custom-event-'.\n * The mapped object's keys are derived by removing the 'custom-event-' prefix from the attribute names,\n * and the values are the corresponding attribute values.\n * @returns {object} An object containing key-value pairs of custom event parameters.\n */\n get customEventParameters() {\n const attributes = Array.from(this.attributes).filter((attr) => attr.name.startsWith('custom-event-'));\n\n return attributes.reduce((acc, attr) => {\n const key = attr.name.replace('custom-event-', '');\n acc[key] = attr.value;\n\n return acc;\n }, {});\n }\n\n className = 'MenuItem';\n\n /**\n * Getter for cssStyleSheet.\n * @returns {string} The styles imported from styles.css.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for observedAttributes.\n * @returns {Array} An empty array as no attributes are being observed.\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the MenuItem element.\n */\n setupAttributes() {\n super.setupAttributes();\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n /**\n * Removes the active attribute from the menu before drawing the MenuItem.\n */\n beforeDraw() {\n this.querySelector('wje-menu')?.removeAttribute('active');\n }\n\n /**\n * Draws the MenuItem element and sets the variant and collapse attributes.\n * @returns {DocumentFragment} The fragment to be appended to the MenuItem.\n */\n draw() {\n this.hasSubmenu = WjElementUtils.hasSlot(this, 'submenu');\n\n let fragment = document.createDocumentFragment();\n\n this.setAttribute('tabindex', '0');\n\n this.classList.forEach((className) => {\n // Ak trieda začína na \"wje-menu-variant-\", odstráňte ju\n if (className.startsWith('wje-menu-variant-')) {\n this.classList.remove(className);\n }\n });\n\n this.classList.remove('collapse');\n this.classList.add('wje-menu-variant-' + this.variant.toLowerCase());\n\n if (!this.collapse) {\n this.querySelector('wje-menu')?.setAttribute('variant', this.variant.toLowerCase());\n } else if (this.parentElement?.hasAttribute('collapse')) {\n this.classList.add('collapse');\n }\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.setAttribute('id', 'anchor');\n native.classList.add('native-menu-item');\n\n // CHECKED - Icon\n let checkedIcon = document.createElement('span');\n checkedIcon.setAttribute('part', 'check');\n checkedIcon.classList.add('check-icon');\n checkedIcon.innerHTML = `<wje-icon name=\"check\"></wje-icon>`;\n\n if (this.hasAttribute('checked')) checkedIcon.classList.add('checked');\n else checkedIcon.classList.remove('checked');\n\n // SLOT - Start\n let start = document.createElement('slot');\n start.name = 'start';\n\n // SLOT\n let slot = document.createElement('slot');\n slot.classList.add('label');\n\n // SLOT - End\n let end = document.createElement('slot');\n end.setAttribute('part', 'end');\n end.name = 'end';\n\n // SLOT - Submenu\n let submenu = document.createElement('slot');\n submenu.setAttribute('part', 'submenu');\n submenu.name = 'submenu';\n\n // SUBMENU - Icon\n let submenuIconClass = this.collapse ? 'collapse' : 'expand';\n let submenuIcon = document.createElement('span');\n submenuIcon.setAttribute('part', 'submenu-icon');\n submenuIcon.classList.add('submenu-icon', submenuIconClass);\n submenuIcon.innerHTML = this.collapse\n ? `<wje-icon name=\"chevron-down\"></wje-icon>`\n : `<wje-icon name=\"chevron-right\"></wje-icon>`;\n\n if (this.hasSubmenu) native.classList.add('has-submenu');\n else native.classList.remove('has-submenu');\n\n native.appendChild(checkedIcon);\n native.appendChild(start);\n native.appendChild(slot);\n native.appendChild(end);\n native.appendChild(submenuIcon);\n\n let isAppend = false;\n // ak je variant typu CONTEXT zobrazime submenu ako popup\n if (this.variant === 'CONTEXT' && this.hasSubmenu) {\n native.setAttribute('slot', 'anchor'); // pridame slot anchor pre popup\n\n let popup = document.createElement('wje-popup');\n popup.setAttribute('anchor', 'anchor');\n popup.setAttribute('placement', this.placement);\n popup.setAttribute('offset', this.offset);\n\n popup.appendChild(native);\n popup.appendChild(submenu);\n\n this.popup = popup;\n fragment.appendChild(popup);\n isAppend = true;\n }\n\n if (this.parentElement?.hasAttribute('collapse') && !this.hasSubmenu) {\n fragment.appendChild(this.collapseItem(native));\n } else if (!isAppend) {\n fragment.appendChild(native);\n }\n\n if ((!this.collapse && this.variant === 'NAV') || (this.variant === 'MEGAMENU' && this.hasSubmenu)) {\n fragment.appendChild(submenu);\n }\n\n this.native = native;\n this.submenu = submenu;\n\n this.syncAria();\n return fragment;\n }\n\n /**\n * Adds event listeners after drawing the MenuItem.\n */\n afterDraw() {\n\n this.unbindRouterLinks = bindRouterLinks(this.parentElement, { selector: '[route]' });\n\n document.addEventListener('wje-router:rebind', this.rebindRouterLinks);\n\n this.addEventListener('mousemove', this.dispatchMove);\n this.addEventListener('wje-popup:reposition', this.dispatchReposition);\n\n // Event na zobrazenie submenu\n event.addListener(this, 'mouseenter', null, this.mouseenterHandler);\n // Event na zrusenie zobrazenia submenu ked sa klikne mimo\n event.addListener(this, 'mouseleave', null, this.shouldHideSubmenu);\n // Event na zrusenie zobrazenia submenu ked sa klikne mimo\n event.addListener(this, 'focusout', null, this.shouldHideSubmenu);\n event.addListener(this, 'click', null, this.clickHandler);\n\n if (this.hasAttribute('custom-event')) {\n event.addListener(this, 'click', null, this.#populateCustomEvent);\n }\n\n if(this.hasAttribute('active-class')) {\n this.addEventListener('click', this.handleActiveClick);\n }\n }\n\n /**\n * Syncs ARIA attributes based on menu item state.\n */\n syncAria() {\n const hasSubmenu = !!this.hasSubmenu;\n const expanded = this.classList.contains('expanded-submenu') || this.native?.classList?.contains('expanded-submenu');\n const disabled = this.hasAttribute('disabled');\n\n this.setAriaState({\n role: 'menuitem',\n disabled,\n haspopup: hasSubmenu ? 'menu' : undefined,\n expanded: hasSubmenu ? expanded : undefined,\n });\n }\n\n mouseenterHandler = (e) => {\n if (this.collapse || (this.variant === 'CONTEXT' && this.hasSubmenu)) {\n if (this.hasAttribute('manual') || (this.variant === 'NAV' && this.collapse)) return;\n\n this.activateSubmenu(e);\n\n e.stopPropagation();\n\n this.showSubmenu();\n }\n };\n\n rebindRouterLinks = (e) => {\n this.unbindPortalRouterLinks = bindRouterLinks(e.detail.container, { selector: '[route]' });\n }\n\n /**\n * Handles the click event on the MenuItem.\n * @param {object} e\n */\n clickHandler = (e) => {\n if (this.hasAttribute('disabled')) return;\n switch (this.variant) {\n case 'NAV':\n if (!this.collapse && this.hasSubmenu) {\n this.submenuToggle(e);\n this.hideSubmenu();\n e.stopPropagation();\n } else {\n event.dispatchCustomEvent(this, 'wje-menu-item:click');\n event.dispatchCustomEvent(this, this.dialog);\n }\n break;\n case 'CONTEXT':\n if (!this.collapse && this.hasSubmenu) {\n let submenuElements = this.submenu.assignedElements({ flatten: true })[0];\n if (submenuElements?.hasAttribute('active')) {\n this.shouldHideSubmenu(e);\n } else {\n this.activateSubmenu(e);\n this.showSubmenu(e);\n }\n } else {\n event.dispatchCustomEvent(this, 'wje-menu-item:click');\n event.dispatchCustomEvent(this, this.dialog);\n }\n\n break;\n }\n }\n\n /**\n * Checks if the submenu should be hidden based on the event.\n * @param {Event} e The event object.\n */\n shouldHideSubmenu = (e) => {\n if (this.collapse || (this.variant === 'CONTEXT' && this.hasSubmenu)) {\n if ((e.relatedTarget && this.contains(e.relatedTarget)) || (this.variant === 'NAV' && !this.collapse)) {\n return;\n }\n\n this.deactivateSubmenu();\n this.hideSubmenu();\n }\n };\n\n /**\n * Creates a tooltip for the MenuItem when it is collapsed.\n * @param {HTMLElement} native The native MenuItem element.\n * @returns {HTMLElement} The tooltip element.\n */\n collapseItem(native) {\n let tooltipStart = document.createElement('slot');\n tooltipStart.setAttribute('slot', 'start');\n tooltipStart.setAttribute('name', 'tooltip-start');\n\n let tooltipEnd = document.createElement('slot');\n tooltipEnd.setAttribute('slot', 'end');\n tooltipEnd.setAttribute('name', 'tooltip-end');\n\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('content', this.getTextFromElement(this));\n tooltip.setAttribute('placement', 'right');\n tooltip.setAttribute('offset', this.offset || '0');\n\n tooltip.appendChild(tooltipStart);\n tooltip.appendChild(tooltipEnd);\n tooltip.appendChild(native);\n\n return tooltip;\n }\n\n /**\n * Dispatches a mousemove event.\n */\n dispatchMove = (e) => {\n this.style.setProperty('--wje-menu-item-safe-triangle-cursor-x', `${e.clientX}px`);\n this.style.setProperty('--wje-menu-item-safe-triangle-cursor-y', `${e.clientY}px`);\n };\n\n /**\n * Dispatches a reposition event.\n */\n dispatchReposition = (e) => {\n // ak nemame submenu tak to ukoncime\n if (this.submenu.assignedNodes().length === 0) return;\n\n let submenu = this.submenu.assignedNodes()[0];\n const { left, top, width, height } = submenu.getBoundingClientRect();\n\n this.style.setProperty('--wje-menu-item-safe-triangle-submenu-start-x', `${left}px`);\n this.style.setProperty('--wje-menu-item-safe-triangle-submenu-start-y', `${top}px`);\n this.style.setProperty('--wje-menu-item-safe-triangle-submenu-end-x', `${left}px`);\n this.style.setProperty('--wje-menu-item-safe-triangle-submenu-end-y', `${top + height}px`);\n };\n\n /**\n * Shows the submenu of the MenuItem.\n */\n showSubmenu() {\n this.tabIndex = -1;\n if (this.hasSubmenu) {\n this.popup?.show();\n this.classList.add('expanded-submenu');\n this.native.classList.add('expanded-submenu');\n this.syncAria();\n }\n }\n\n /**\n * Hides the submenu of the MenuItem.\n */\n hideSubmenu() {\n this.tabIndex = 0;\n if (this.hasSubmenu) {\n this.popup?.hide();\n this.classList.remove('expanded-submenu');\n this.native.classList.remove('expanded-submenu');\n this.syncAria();\n }\n }\n\n /**\n * Toggles the active state of the submenu element.\n * If the submenu is not active, it sets the \"active\" attribute.\n * If the submenu is already active, it removes the \"active\" attribute.\n * @param {Event} e The event object.\n */\n submenuToggle(e) {\n if (this.hasSubmenu) {\n let submenuElements = this.submenu.assignedElements({ flatten: true })[0];\n if (!submenuElements.hasAttribute('active')) {\n submenuElements.setAttribute('active', '');\n this.syncAria();\n } else {\n if (this === e.target) submenuElements.removeAttribute('active');\n this.syncAria();\n }\n }\n }\n\n /**\n * Deactivates the submenu by removing the \"active\" attribute.\n */\n deactivateSubmenu() {\n if (this.hasSubmenu) {\n let submenuElements = this.submenu.assignedElements({ flatten: true })[0];\n if (submenuElements?.hasAttribute('active')) {\n submenuElements?.removeAttribute('active');\n this.syncAria();\n }\n }\n }\n\n /**\n * Activates the submenu of the menu item.\n */\n activateSubmenu() {\n if (this.hasSubmenu) {\n let submenuElements = this.submenu.assignedElements({ flatten: true })[0];\n if (!submenuElements?.hasAttribute('active')) {\n submenuElements?.setAttribute('active', '');\n this.syncAria();\n }\n }\n }\n\n /**\n * Gets the text from the element and returns it.\n */\n beforeDisconnect() {\n document.removeEventListener('wje-router:rebind', this.rebindRouterLinks);\n\n this.removeEventListener('mousemove', this.dispatchMove);\n this.removeEventListener('wje-popup:reposition', this.dispatchReposition);\n\n event.removeListener(this, 'mouseenter', null, this.mouseenterHandler);\n event.removeListener(this, 'mouseleave', null, this.shouldHideSubmenu);\n event.removeListener(this, 'focusout', null, this.shouldHideSubmenu);\n event.removeListener(this, 'click', null, this.clickHandler);\n\n this.unbindRouterLinks?.();\n this.unbindPortalRouterLinks?.();\n }\n\n /**\n * Extracts and returns the concatenated text content from all text nodes within the specified element.\n * @param {HTMLElement} element The HTML element from which to extract text content.\n * @returns {string} The concatenated and trimmed text content from the element's text nodes.\n */\n getTextFromElement(element) {\n let text = '';\n for (let node of element.childNodes) {\n if (node.nodeType === Node.TEXT_NODE) {\n text += node.textContent;\n }\n }\n return text.trim();\n }\n\n /**\n * Dispatches a custom event with specified parameters.\n * This method uses the `customEvent` and `customEventParameters` properties\n * to create and dispatch a `CustomEvent`. The event is configured to be\n * composed and bubbles up through the DOM.\n * @returns {void} This method does not return a value.\n */\n #populateCustomEvent() {\n this.dispatchEvent(\n new CustomEvent(this.customEvent, { detail: this.customEventParameters, composed: true, bubbles: true })\n );\n }\n\n handleActiveClick = (e) => {\n const target = e.target.closest('wje-menu-item');\n if (!target) return;\n\n let rootMenu = target.closest('wje-menu');\n let currentMenu = rootMenu;\n\n // Nájdite najvyšší rodičovský wje-menu, ktorý obsahuje tento menu-item\n while (currentMenu?.parentElement) {\n const parent = currentMenu.parentElement.closest?.('wje-menu');\n if (!parent) break;\n rootMenu = parent;\n currentMenu = parent;\n }\n\n // Ak je item v portálovanom submenu, pôvodný closest nemusí nájsť root menu.\n // Skúsime ho získať z composedPath a vystúpiť na najvyšší <wje-menu>.\n if (!rootMenu) {\n const path = typeof e.composedPath === 'function' ? e.composedPath() : [];\n let firstMenuInPath = path.find(n => n && n.tagName === 'WJE-MENU');\n if (firstMenuInPath) {\n let top = firstMenuInPath;\n while (top && top.parentElement) {\n const parent = top.parentElement.closest?.('wje-menu');\n if (!parent) break;\n top = parent;\n }\n rootMenu = top;\n }\n }\n\n // Ak stále nemáme rootMenu, nevieme kde aplikovať active-class\n if (!rootMenu) return;\n\n // Odstráň všetky existujúce triedy z predchádzajúcich kliknutí\n rootMenu.querySelectorAll('wje-menu-item').forEach(item => {\n const activeClass = item.getAttribute('active-class');\n if (activeClass) item.classList.remove(activeClass);\n });\n\n // Pridaj active-class všetkým nadradeným menu-itemom vrátane targetu\n let current = target;\n while (current && current.tagName === 'WJE-MENU-ITEM') {\n const activeClass = current.getAttribute('active-class');\n if (activeClass) current.classList.add(activeClass);\n\n // nájdi najbližší parent wje-menu\n const parentMenu = current.closest('wje-menu');\n if (!parentMenu) break;\n\n // pokračuj na menu-item, ktorý má ako submenu tento parentMenu\n const candidate = parentMenu.closest('wje-menu-item');\n if (!candidate) break;\n\n current = candidate;\n }\n }\n}\n","import MenuItem from './menu-item.element.js';\n\nexport default MenuItem;\n\nMenuItem.define('wje-menu-item', MenuItem);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCe,MAAM,iBAAiB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5C,cAAc;AACV,UAAO;AANA;AAgGX,qCAAY;AA+LZ,6CAAoB,CAAC,MAAM;AACvB,UAAI,KAAK,YAAa,KAAK,YAAY,aAAa,KAAK,YAAa;AAClE,YAAI,KAAK,aAAa,QAAQ,KAAM,KAAK,YAAY,SAAS,KAAK,SAAW;AAE9E,aAAK,gBAAgB,CAAC;AAEtB,UAAE,gBAAiB;AAEnB,aAAK,YAAa;AAAA,MAC9B;AAAA,IACK;AAED,6CAAoB,CAAC,MAAM;AACvB,WAAK,0BAA0B,gBAAgB,EAAE,OAAO,WAAW,EAAE,UAAU,WAAW;AAAA,IAClG;AAMI;AAAA;AAAA;AAAA;AAAA,wCAAe,CAAC,MAAM;AAClB,UAAI,KAAK,aAAa,UAAU,EAAG;AACnC,cAAQ,KAAK,SAAO;AAAA,QAChB,KAAK;AACD,cAAI,CAAC,KAAK,YAAY,KAAK,YAAY;AACnC,iBAAK,cAAc,CAAC;AACpB,iBAAK,YAAa;AAClB,cAAE,gBAAiB;AAAA,UACvC,OAAuB;AACH,kBAAM,oBAAoB,MAAM,qB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AwEA;AAjkBe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkgBX,yBAAoB,WAAG;AACnB,OAAK;AAAA,IACH,IAAI,YAAY,KAAK,aAAa,EAAE,QAAQ,KAAK,uBAAuB,UAAU,MAAM,SAAS,KAAM,CAAA;AAAA,EACxG;AACT;ACxiBA,SAAS,OAAO,iBAAiB,QAAQ;"}
|
|
1
|
+
{"version":3,"file":"wje-menu-item.js","sources":["../packages/wje-menu-item/menu-item.element.js","../packages/wje-menu-item/menu-item.js"],"sourcesContent":["import { bindRouterLinks } from 'slick-router/middlewares/router-links.js';\n\nimport { default as WJElement, event, WjElementUtils } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `MenuItem` is a custom web component that represents a menu item.\n * @summary This element represents a menu item.\n * @documentation https://elements.webjet.sk/components/menu-item\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the menu item.\n * @csspart submenu - The submenu part of the menu item.\n * @slot - The default slot for the menu item.\n * @slot start - The slot for the start of the menu item.\n * @slot end - The slot for the end of the menu item.\n * @slot submenu - The slot for the submenu of the menu item.\n * @cssproperty [--wje-menu-item-color=var(--wje-color)] - Sets the text color of a menu item. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-background=transparent] - Defines the background color of a menu item. Default is `transparent`. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-color-hover=var(--wje-color-contrast-8)] - Specifies the text color of a menu item when hovered. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-background-hover=var(--wje-border-color)] - Sets the background color of a menu item when hovered. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-color-focus=var(--wje-color-contrast-8)] - Defines the text color of a menu item when focused. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-background-focus=var(--wje-border-color)] - Specifies the background color of a menu item when focused. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-color-active=var(--wje-color-contrast-8)] - Sets the text color of a menu item when active. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-background-active=var(--wje-border-color)] - Specifies the background color of a menu item when active. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-item-padding-top=.5rem] - Specifies the top padding inside a menu item. Accepts any valid CSS length value (e.g., `px`, `rem`).\n * @cssproperty [--wje-menu-item-padding-bottom=.5rem] - Specifies the bottom padding inside a menu item. Accepts any valid CSS length value (e.g., `px`, `rem`).\n * @cssproperty [--wje-menu-item-line-height=1.8rem] - Sets the line height for the text within a menu item. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-submenu-offset=0] - Determines the horizontal offset of a submenu relative to its parent. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-item-icon-visibility=hidden] - Controls the visibility of the icon in a menu item. Accepts `visible`, `hidden`, or `collapse`.\n * @cssproperty [--wje-menu-item-safe-triangle-cursor-x] - Specifies the x-coordinate of the cursor for the safe triangle area. Used for managing hover or focus transitions between menu items and submenus.\n * @cssproperty [--wje-menu-item-safe-triangle-cursor-y] - Specifies the y-coordinate of the cursor for the safe triangle area.\n * @cssproperty [--wje-menu-item-safe-triangle-submenu-start-x] - Defines the x-coordinate where the submenu's safe triangle starts. Helps prevent accidental submenu closing when navigating.\n * @cssproperty [--wje-menu-item-safe-triangle-submenu-start-y] - Defines the y-coordinate where the submenu's safe triangle starts.\n * @cssproperty [--wje-menu-item-safe-triangle-submenu-end-x] - Specifies the x-coordinate where the submenu's safe triangle ends.\n * @cssproperty [--wje-menu-item-safe-triangle-submenu-end-y] - Specifies the y-coordinate where the submenu's safe triangle ends.\n * @tag wje-menu-item\n */\nexport default class MenuItem extends WJElement {\n /**\n * Constructor for MenuItem class.\n * @class\n */\n constructor() {\n super();\n\n this._bind = false;\n\n }\n\n /**\n * Getter for placement attribute.\n * @returns {string} The placement attribute of the menu or \"right-start\" if it doesn't exist.\n */\n get placement() {\n let menu = this.querySelector('wje-menu');\n\n if (menu?.hasAttribute('placement')) {\n return menu.getAttribute('placement');\n }\n return 'right-start';\n }\n\n /**\n * Getter for offset attribute.\n * @returns {string} The offset attribute of the menu or \"0\" if it doesn't exist.\n */\n get offset() {\n let menu = this.querySelector('wje-menu');\n\n if (menu?.hasAttribute('offset')) {\n return menu.getAttribute('offset');\n }\n return '0';\n }\n\n /**\n * Getter for variant attribute.\n * @returns {string} The variant attribute of the menu or \"CONTEXT\" if it doesn't exist.\n */\n get variant() {\n let menu = this.querySelector('wje-menu');\n\n if (menu?.hasAttribute('variant') && !this.collapse) {\n return menu.getAttribute('variant').toUpperCase();\n }\n\n return 'CONTEXT';\n }\n\n /**\n * Getter for collapse attribute.\n * @returns {boolean} True if the closest parent has the collapse attribute, false otherwise.\n */\n get collapse() {\n if (this.closest('[collapse]')) return true;\n\n return false;\n }\n\n /**\n * Sets the value of the custom event attribute.\n * @param {string} value The value to be assigned to the custom event attribute.\n */\n set customEvent(value) {\n this.setAttribute('custom-event', value);\n }\n\n /**\n * Retrieves the value of the 'custom-event' attribute from the element.\n * @returns {string | null} The value of the 'custom-event' attribute, or null if the attribute is not set.\n */\n get customEvent() {\n return this.getAttribute('custom-event');\n }\n\n /**\n * Retrieves a mapped object containing custom event parameters extracted from the element's attributes.\n * Attributes considered are those that begin with 'custom-event-'.\n * The mapped object's keys are derived by removing the 'custom-event-' prefix from the attribute names,\n * and the values are the corresponding attribute values.\n * @returns {object} An object containing key-value pairs of custom event parameters.\n */\n get customEventParameters() {\n const attributes = Array.from(this.attributes).filter((attr) => attr.name.startsWith('custom-event-'));\n\n return attributes.reduce((acc, attr) => {\n const key = attr.name.replace('custom-event-', '');\n acc[key] = attr.value;\n\n return acc;\n }, {});\n }\n\n className = 'MenuItem';\n\n /**\n * Getter for cssStyleSheet.\n * @returns {string} The styles imported from styles.css.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for observedAttributes.\n * @returns {Array} An empty array as no attributes are being observed.\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the MenuItem element.\n */\n setupAttributes() {\n super.setupAttributes();\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n /**\n * Removes the active attribute from the menu before drawing the MenuItem.\n */\n beforeDraw() {\n this.querySelector('wje-menu')?.removeAttribute('active');\n }\n\n /**\n * Draws the MenuItem element and sets the variant and collapse attributes.\n * @returns {DocumentFragment} The fragment to be appended to the MenuItem.\n */\n draw() {\n this.hasSubmenu = WjElementUtils.hasSlot(this, 'submenu');\n\n let fragment = document.createDocumentFragment();\n\n this.setAttribute('tabindex', '0');\n\n this.classList.forEach((className) => {\n // Ak trieda začína na \"wje-menu-variant-\", odstráňte ju\n if (className.startsWith('wje-menu-variant-')) {\n this.classList.remove(className);\n }\n });\n\n this.classList.remove('collapse');\n this.classList.add('wje-menu-variant-' + this.variant.toLowerCase());\n\n if (!this.collapse) {\n this.querySelector('wje-menu')?.setAttribute('variant', this.variant.toLowerCase());\n } else if (this.parentElement?.hasAttribute('collapse')) {\n this.classList.add('collapse');\n }\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.setAttribute('id', 'anchor');\n native.classList.add('native-menu-item');\n\n // CHECKED - Icon\n let checkedIcon = document.createElement('span');\n checkedIcon.setAttribute('part', 'check');\n checkedIcon.classList.add('check-icon');\n checkedIcon.innerHTML = `<wje-icon name=\"check\"></wje-icon>`;\n\n if (this.hasAttribute('checked')) checkedIcon.classList.add('checked');\n else checkedIcon.classList.remove('checked');\n\n // SLOT - Start\n let start = document.createElement('slot');\n start.name = 'start';\n\n // SLOT\n let slot = document.createElement('slot');\n slot.classList.add('label');\n\n // SLOT - End\n let end = document.createElement('slot');\n end.setAttribute('part', 'end');\n end.name = 'end';\n\n // SLOT - Submenu\n let submenu = document.createElement('slot');\n submenu.setAttribute('part', 'submenu');\n submenu.name = 'submenu';\n\n // SUBMENU - Icon\n let submenuIconClass = this.collapse ? 'collapse' : 'expand';\n let submenuIcon = document.createElement('span');\n submenuIcon.setAttribute('part', 'submenu-icon');\n submenuIcon.classList.add('submenu-icon', submenuIconClass);\n submenuIcon.innerHTML = this.collapse\n ? `<wje-icon name=\"chevron-down\"></wje-icon>`\n : `<wje-icon name=\"chevron-right\"></wje-icon>`;\n\n if (this.hasSubmenu) native.classList.add('has-submenu');\n else native.classList.remove('has-submenu');\n\n native.appendChild(checkedIcon);\n native.appendChild(start);\n native.appendChild(slot);\n native.appendChild(end);\n native.appendChild(submenuIcon);\n\n let isAppend = false;\n // ak je variant typu CONTEXT zobrazime submenu ako popup\n if (this.variant === 'CONTEXT' && this.hasSubmenu) {\n native.setAttribute('slot', 'anchor'); // pridame slot anchor pre popup\n\n let popup = document.createElement('wje-popup');\n popup.setAttribute('anchor', 'anchor');\n popup.setAttribute('placement', this.placement);\n popup.setAttribute('offset', this.offset);\n\n popup.appendChild(native);\n popup.appendChild(submenu);\n\n this.popup = popup;\n fragment.appendChild(popup);\n isAppend = true;\n }\n\n if (this.parentElement?.hasAttribute('collapse') && !this.hasSubmenu) {\n fragment.appendChild(this.collapseItem(native));\n } else if (!isAppend) {\n fragment.appendChild(native);\n }\n\n if ((!this.collapse && this.variant === 'NAV') || (this.variant === 'MEGAMENU' && this.hasSubmenu)) {\n fragment.appendChild(submenu);\n }\n\n this.native = native;\n this.submenu = submenu;\n\n this.syncAria();\n return fragment;\n }\n\n /**\n * Adds event listeners after drawing the MenuItem.\n */\n afterDraw() {\n\n this.unbindRouterLinks = bindRouterLinks(this.parentElement, { selector: '[route]' });\n\n document.addEventListener('wje-router:rebind', this.rebindRouterLinks);\n\n this.addEventListener('mousemove', this.dispatchMove);\n this.addEventListener('wje-popup:reposition', this.dispatchReposition);\n\n // Event na zobrazenie submenu\n event.addListener(this, 'mouseenter', null, this.mouseenterHandler);\n // Event na zrusenie zobrazenia submenu ked sa klikne mimo\n event.addListener(this, 'mouseleave', null, this.shouldHideSubmenu);\n // Event na zrusenie zobrazenia submenu ked sa klikne mimo\n event.addListener(this, 'focusout', null, this.shouldHideSubmenu);\n event.addListener(this, 'click', null, this.clickHandler);\n\n if (this.hasAttribute('custom-event')) {\n event.addListener(this, 'click', null, this.#populateCustomEvent);\n }\n\n if(this.hasAttribute('active-class')) {\n this.addEventListener('click', this.handleActiveClick);\n }\n }\n\n /**\n * Syncs ARIA attributes based on menu item state.\n */\n syncAria() {\n const hasSubmenu = !!this.hasSubmenu;\n const expanded = this.classList.contains('expanded-submenu') || this.native?.classList?.contains('expanded-submenu');\n const disabled = this.hasAttribute('disabled');\n\n this.setAriaState({\n role: 'menuitem',\n disabled,\n haspopup: hasSubmenu ? 'menu' : undefined,\n expanded: hasSubmenu ? expanded : undefined,\n });\n }\n\n mouseenterHandler = (e) => {\n if (this.collapse || (this.variant === 'CONTEXT' && this.hasSubmenu)) {\n if (this.hasAttribute('manual') || (this.variant === 'NAV' && this.collapse)) return;\n\n this.activateSubmenu(e);\n\n e.stopPropagation();\n\n this.showSubmenu();\n }\n };\n\n rebindRouterLinks = (e) => {\n this.unbindPortalRouterLinks = bindRouterLinks(e.detail.container, { selector: '[route]' });\n }\n\n /**\n * Handles the click event on the MenuItem.\n * @param {object} e\n */\n clickHandler = (e) => {\n if (this.hasAttribute('disabled')) return;\n switch (this.variant) {\n case 'NAV':\n if (!this.collapse && this.hasSubmenu) {\n this.submenuToggle(e);\n this.hideSubmenu();\n e.stopPropagation();\n } else {\n event.dispatchCustomEvent(this, 'wje-menu-item:click');\n event.dispatchCustomEvent(this, this.dialog);\n }\n break;\n case 'CONTEXT':\n if (!this.collapse && this.hasSubmenu) {\n let submenuElements = this.submenu.assignedElements({ flatten: true })[0];\n if (submenuElements?.hasAttribute('active')) {\n this.shouldHideSubmenu(e);\n } else {\n this.activateSubmenu(e);\n this.showSubmenu(e);\n }\n } else {\n event.dispatchCustomEvent(this, 'wje-menu-item:click');\n event.dispatchCustomEvent(this, this.dialog);\n }\n\n break;\n }\n }\n\n /**\n * Checks if the submenu should be hidden based on the event.\n * @param {Event} e The event object.\n */\n shouldHideSubmenu = (e) => {\n if (this.collapse || (this.variant === 'CONTEXT' && this.hasSubmenu)) {\n if ((e.relatedTarget && this.contains(e.relatedTarget)) || (this.variant === 'NAV' && !this.collapse)) {\n return;\n }\n\n this.deactivateSubmenu();\n this.hideSubmenu();\n }\n };\n\n /**\n * Creates a tooltip for the MenuItem when it is collapsed.\n * @param {HTMLElement} native The native MenuItem element.\n * @returns {HTMLElement} The tooltip element.\n */\n collapseItem(native) {\n let tooltipStart = document.createElement('slot');\n tooltipStart.setAttribute('slot', 'start');\n tooltipStart.setAttribute('name', 'tooltip-start');\n\n let tooltipEnd = document.createElement('slot');\n tooltipEnd.setAttribute('slot', 'end');\n tooltipEnd.setAttribute('name', 'tooltip-end');\n\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('content', this.getTextFromElement(this));\n tooltip.setAttribute('placement', 'right');\n tooltip.setAttribute('offset', this.offset || '0');\n\n tooltip.appendChild(tooltipStart);\n tooltip.appendChild(tooltipEnd);\n tooltip.appendChild(native);\n\n return tooltip;\n }\n\n /**\n * Dispatches a mousemove event.\n */\n dispatchMove = (e) => {\n this.style.setProperty('--wje-menu-item-safe-triangle-cursor-x', `${e.clientX}px`);\n this.style.setProperty('--wje-menu-item-safe-triangle-cursor-y', `${e.clientY}px`);\n };\n\n /**\n * Dispatches a reposition event.\n */\n dispatchReposition = (e) => {\n // ak nemame submenu tak to ukoncime\n if (this.submenu.assignedNodes().length === 0) return;\n\n let submenu = this.submenu.assignedNodes()[0];\n const { left, top, width, height } = submenu.getBoundingClientRect();\n\n this.style.setProperty('--wje-menu-item-safe-triangle-submenu-start-x', `${left}px`);\n this.style.setProperty('--wje-menu-item-safe-triangle-submenu-start-y', `${top}px`);\n this.style.setProperty('--wje-menu-item-safe-triangle-submenu-end-x', `${left}px`);\n this.style.setProperty('--wje-menu-item-safe-triangle-submenu-end-y', `${top + height}px`);\n };\n\n /**\n * Shows the submenu of the MenuItem.\n */\n showSubmenu() {\n this.tabIndex = -1;\n if (this.hasSubmenu) {\n this.popup?.show();\n this.classList.add('expanded-submenu');\n this.native.classList.add('expanded-submenu');\n this.syncAria();\n }\n }\n\n /**\n * Hides the submenu of the MenuItem.\n */\n hideSubmenu() {\n this.tabIndex = 0;\n if (this.hasSubmenu) {\n this.popup?.hide();\n this.classList.remove('expanded-submenu');\n this.native.classList.remove('expanded-submenu');\n this.syncAria();\n }\n }\n\n /**\n * Toggles the active state of the submenu element.\n * If the submenu is not active, it sets the \"active\" attribute.\n * If the submenu is already active, it removes the \"active\" attribute.\n * @param {Event} e The event object.\n */\n submenuToggle(e) {\n if (this.hasSubmenu) {\n let submenuElements = this.submenu.assignedElements({ flatten: true })[0];\n if (!submenuElements.hasAttribute('active')) {\n submenuElements.setAttribute('active', '');\n this.syncAria();\n } else {\n if (this === e.target) submenuElements.removeAttribute('active');\n this.syncAria();\n }\n }\n }\n\n /**\n * Deactivates the submenu by removing the \"active\" attribute.\n */\n deactivateSubmenu() {\n if (this.hasSubmenu) {\n let submenuElements = this.submenu.assignedElements({ flatten: true })[0];\n if (submenuElements?.hasAttribute('active')) {\n submenuElements?.removeAttribute('active');\n this.syncAria();\n }\n }\n }\n\n /**\n * Activates the submenu of the menu item.\n */\n activateSubmenu() {\n if (this.hasSubmenu) {\n let submenuElements = this.submenu.assignedElements({ flatten: true })[0];\n if (!submenuElements?.hasAttribute('active')) {\n submenuElements?.setAttribute('active', '');\n this.syncAria();\n }\n }\n }\n\n /**\n * Gets the text from the element and returns it.\n */\n beforeDisconnect() {\n document.removeEventListener('wje-router:rebind', this.rebindRouterLinks);\n\n this.removeEventListener('mousemove', this.dispatchMove);\n this.removeEventListener('wje-popup:reposition', this.dispatchReposition);\n\n event.removeListener(this, 'mouseenter', null, this.mouseenterHandler);\n event.removeListener(this, 'mouseleave', null, this.shouldHideSubmenu);\n event.removeListener(this, 'focusout', null, this.shouldHideSubmenu);\n event.removeListener(this, 'click', null, this.clickHandler);\n\n this.unbindRouterLinks?.();\n this.unbindPortalRouterLinks?.();\n }\n\n /**\n * Extracts and returns the concatenated text content from all text nodes within the specified element.\n * @param {HTMLElement} element The HTML element from which to extract text content.\n * @returns {string} The concatenated and trimmed text content from the element's text nodes.\n */\n getTextFromElement(element) {\n let text = '';\n for (let node of element.childNodes) {\n if (node.nodeType === Node.TEXT_NODE) {\n text += node.textContent;\n }\n }\n return text.trim();\n }\n\n /**\n * Dispatches a custom event with specified parameters.\n * This method uses the `customEvent` and `customEventParameters` properties\n * to create and dispatch a `CustomEvent`. The event is configured to be\n * composed and bubbles up through the DOM.\n * @returns {void} This method does not return a value.\n */\n #populateCustomEvent() {\n this.dispatchEvent(\n new CustomEvent(this.customEvent, { detail: this.customEventParameters, composed: true, bubbles: true })\n );\n }\n\n handleActiveClick = (e) => {\n const target = e.target.closest('wje-menu-item');\n if (!target) return;\n\n let rootMenu = target.closest('wje-menu');\n let currentMenu = rootMenu;\n\n // Nájdite najvyšší rodičovský wje-menu, ktorý obsahuje tento menu-item\n while (currentMenu?.parentElement) {\n const parent = currentMenu.parentElement.closest?.('wje-menu');\n if (!parent) break;\n rootMenu = parent;\n currentMenu = parent;\n }\n\n // Ak je item v portálovanom submenu, pôvodný closest nemusí nájsť root menu.\n // Skúsime ho získať z composedPath a vystúpiť na najvyšší <wje-menu>.\n if (!rootMenu) {\n const path = typeof e.composedPath === 'function' ? e.composedPath() : [];\n let firstMenuInPath = path.find(n => n && n.tagName === 'WJE-MENU');\n if (firstMenuInPath) {\n let top = firstMenuInPath;\n while (top && top.parentElement) {\n const parent = top.parentElement.closest?.('wje-menu');\n if (!parent) break;\n top = parent;\n }\n rootMenu = top;\n }\n }\n\n // Ak stále nemáme rootMenu, nevieme kde aplikovať active-class\n if (!rootMenu) return;\n\n // Odstráň všetky existujúce triedy z predchádzajúcich kliknutí\n rootMenu.querySelectorAll('wje-menu-item').forEach(item => {\n const activeClass = item.getAttribute('active-class');\n if (activeClass) item.classList.remove(activeClass);\n });\n\n // Pridaj active-class všetkým nadradeným menu-itemom vrátane targetu\n let current = target;\n while (current && current.tagName === 'WJE-MENU-ITEM') {\n const activeClass = current.getAttribute('active-class');\n if (activeClass) current.classList.add(activeClass);\n\n // nájdi najbližší parent wje-menu\n const parentMenu = current.closest('wje-menu');\n if (!parentMenu) break;\n\n // pokračuj na menu-item, ktorý má ako submenu tento parentMenu\n const candidate = parentMenu.closest('wje-menu-item');\n if (!candidate) break;\n\n current = candidate;\n }\n }\n}\n","import MenuItem from './menu-item.element.js';\n\nexport default MenuItem;\n\nMenuItem.define('wje-menu-item', MenuItem);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCe,MAAM,iBAAiB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5C,cAAc;AACV,UAAK;AANE;AAgGX,qCAAY;AA+LZ,6CAAoB,CAAC,MAAM;AACvB,UAAI,KAAK,YAAa,KAAK,YAAY,aAAa,KAAK,YAAa;AAClE,YAAI,KAAK,aAAa,QAAQ,KAAM,KAAK,YAAY,SAAS,KAAK,SAAW;AAE9E,aAAK,gBAAgB,CAAC;AAEtB,UAAE,gBAAe;AAEjB,aAAK,YAAW;AAAA,MACpB;AAAA,IACJ;AAEA,6CAAoB,CAAC,MAAM;AACvB,WAAK,0BAA0B,gBAAgB,EAAE,OAAO,WAAW,EAAE,UAAU,WAAW;AAAA,IAC9F;AAMA;AAAA;AAAA;AAAA;AAAA,wCAAe,CAAC,MAAM;AAClB,UAAI,KAAK,aAAa,UAAU,EAAG;AACnC,cAAQ,KAAK,SAAO;AAAA,QAChB,KAAK;AACD,cAAI,CAAC,KAAK,YAAY,KAAK,YAAY;AACnC,iBAAK,cAAc,CAAC;AACpB,iBAAK,YAAW;AAChB,cAAE,gBAAe;AAAA,UACrB,OAAO;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AAA,EACpB;AAwEJ;AAjkBe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkgBX,yBAAoB,WAAG;AACnB,OAAK;AAAA,IACH,IAAI,YAAY,KAAK,aAAa,EAAE,QAAQ,KAAK,uBAAuB,UAAU,MAAM,SAAS,KAAI,CAAE;AAAA,EACjH;AACI;ACxiBJ,SAAS,OAAO,iBAAiB,QAAQ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-menu-label.js","sources":["../packages/wje-menu-label/menu-label.element.js","../packages/wje-menu-label/menu-label.js"],"sourcesContent":["import { default as WJElement, WjElementUtils } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `MenuLabel` is a custom web component that represents a menu label.\n * @summary This element represents a menu label.\n * @documentation https://elements.webjet.sk/components/menu-label\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the menu label.\n * @slot - The default slot for the menu label.\n * @cssproperty [--wje-menu-label-font-size=.75rem] - Sets the font size of the menu label. Accepts any valid CSS length unit (e.g., `rem`, `px`, `em`).\n * @cssproperty [--wje-menu-label-weight=600] - Specifies the font weight of the menu label. Accepts values such as `normal`, `bold`, or numeric values (e.g., `400`, `600`).\n * @cssproperty [--wje-letter-spacing=.025rem] - Defines the spacing between letters in the menu label. Accepts any valid CSS length unit. Default value ensures slight spacing for improved readability.\n * @cssproperty [--wje-menu-label-color=var(--wje-color-contrast-6)] - Specifies the text color of the menu label. Accepts any valid CSS color value, including variables and named colors.\n * @cssproperty [--wje-padding-top=0] - Sets the top padding of the menu label. Accepts any valid CSS length value to control spacing above the label.\n * @cssproperty [--wje-padding-bottom=0] - Sets the bottom padding of the menu label. Accepts any valid CSS length value to control spacing below the label.\n * @cssproperty [--wje-padding-start=1.5rem] - Specifies the left padding of the menu label in left-to-right (LTR) layouts. In right-to-left (RTL) layouts, this becomes the right padding. Accepts any valid CSS length value.\n * @cssproperty [--wje-padding-end=1.5rem] - Specifies the right padding of the menu label in left-to-right (LTR) layouts. In right-to-left (RTL) layouts, this becomes the left padding. Accepts any valid CSS length value.\n * @tag wje-menu-label\n */\n\nexport default class MenuLabel extends WJElement {\n /**\n * Creates an instance of MenuLabel.\n * @class\n */\n constructor() {\n super();\n\n this.hasSubmenu = WjElementUtils.hasSlot(this, 'submenu');\n }\n\n className = 'MenuLabel';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the menu label.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n // SLOT\n let slot = document.createElement('slot');\n slot.setAttribute('part', 'native');\n slot.classList.add('native-menu-label');\n\n fragment.appendChild(slot);\n\n return fragment;\n }\n}\n","import MenuLabel from './menu-label.element.js';\n\nexport default MenuLabel;\n\nMenuLabel.define('wje-menu-label', MenuLabel);\n"],"names":[],"mappings":";;;;;;AAsBe,MAAM,kBAAkB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7C,cAAc;AACV,
|
|
1
|
+
{"version":3,"file":"wje-menu-label.js","sources":["../packages/wje-menu-label/menu-label.element.js","../packages/wje-menu-label/menu-label.js"],"sourcesContent":["import { default as WJElement, WjElementUtils } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `MenuLabel` is a custom web component that represents a menu label.\n * @summary This element represents a menu label.\n * @documentation https://elements.webjet.sk/components/menu-label\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the menu label.\n * @slot - The default slot for the menu label.\n * @cssproperty [--wje-menu-label-font-size=.75rem] - Sets the font size of the menu label. Accepts any valid CSS length unit (e.g., `rem`, `px`, `em`).\n * @cssproperty [--wje-menu-label-weight=600] - Specifies the font weight of the menu label. Accepts values such as `normal`, `bold`, or numeric values (e.g., `400`, `600`).\n * @cssproperty [--wje-letter-spacing=.025rem] - Defines the spacing between letters in the menu label. Accepts any valid CSS length unit. Default value ensures slight spacing for improved readability.\n * @cssproperty [--wje-menu-label-color=var(--wje-color-contrast-6)] - Specifies the text color of the menu label. Accepts any valid CSS color value, including variables and named colors.\n * @cssproperty [--wje-padding-top=0] - Sets the top padding of the menu label. Accepts any valid CSS length value to control spacing above the label.\n * @cssproperty [--wje-padding-bottom=0] - Sets the bottom padding of the menu label. Accepts any valid CSS length value to control spacing below the label.\n * @cssproperty [--wje-padding-start=1.5rem] - Specifies the left padding of the menu label in left-to-right (LTR) layouts. In right-to-left (RTL) layouts, this becomes the right padding. Accepts any valid CSS length value.\n * @cssproperty [--wje-padding-end=1.5rem] - Specifies the right padding of the menu label in left-to-right (LTR) layouts. In right-to-left (RTL) layouts, this becomes the left padding. Accepts any valid CSS length value.\n * @tag wje-menu-label\n */\n\nexport default class MenuLabel extends WJElement {\n /**\n * Creates an instance of MenuLabel.\n * @class\n */\n constructor() {\n super();\n\n this.hasSubmenu = WjElementUtils.hasSlot(this, 'submenu');\n }\n\n className = 'MenuLabel';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the menu label.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n // SLOT\n let slot = document.createElement('slot');\n slot.setAttribute('part', 'native');\n slot.classList.add('native-menu-label');\n\n fragment.appendChild(slot);\n\n return fragment;\n }\n}\n","import MenuLabel from './menu-label.element.js';\n\nexport default MenuLabel;\n\nMenuLabel.define('wje-menu-label', MenuLabel);\n"],"names":[],"mappings":";;;;;;AAsBe,MAAM,kBAAkB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7C,cAAc;AACV,UAAK;AAKT,qCAAY;AAHR,SAAK,aAAa,eAAe,QAAQ,MAAM,SAAS;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,WAAW,gBAAgB;AACvB,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW,qBAAqB;AAC5B,WAAO,CAAA;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAkB;AACd,SAAK,eAAe;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO;AACH,QAAI,WAAW,SAAS,uBAAsB;AAG9C,QAAI,OAAO,SAAS,cAAc,MAAM;AACxC,SAAK,aAAa,QAAQ,QAAQ;AAClC,SAAK,UAAU,IAAI,mBAAmB;AAEtC,aAAS,YAAY,IAAI;AAEzB,WAAO;AAAA,EACX;AACJ;ACxEA,UAAU,OAAO,kBAAkB,SAAS;"}
|
package/dist/wje-menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-menu.js","sources":["../packages/wje-menu/menu.element.js","../packages/wje-menu/menu.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Menu` is a custom web component that represents a menu.\n * It extends from `WJElement`.\n * @summary This element represents a menu.\n * @documentation https://elements.webjet.sk/components/menu\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the menu.\n * @slot - The default slot for the menu.\n * @cssproperty [--wje-menu-background=var(--wje-background)] - Defines the background color of the menu. Accepts any valid CSS color value, such as `#ffffff`, `rgb(255, 255, 255)`, or CSS variables.\n * @cssproperty [--wje-menu-border-width=1px] - Specifies the width of the menu's border. Accepts any valid CSS length value (e.g., `px`, `em`, `%`).\n * @cssproperty [--wje-menu-border-style=solid] - Sets the style of the menu's border. Common values include `solid`, `dashed`, `dotted`, etc.\n * @cssproperty [--wje-menu-border-color=var(--wje-border-color)] - Defines the color of the menu's border. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-border-radius=var(--wje-border-radius-small)] - Determines the radius of the menu's corners, creating rounded edges. Accepts any valid CSS length value (e.g., `px`, `%`).\n * @cssproperty [--wje-menu-padding-top=.5rem] - Specifies the top padding inside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-padding-bottom=.5rem] - Specifies the bottom padding inside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-padding-inline=0] - Sets the horizontal (left and right) padding inside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-margin-top=0] - Defines the top margin outside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-margin-bottom=0] - Defines the bottom margin outside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-margin-inline=0] - Specifies the horizontal (left and right) margin outside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-collapse-width=65px] - Sets the width of the menu when it is collapsed. This property is typically used to define the reduced size of the menu in collapsed state. Accepts any valid CSS length value.\n * @tag wje-menu\n */\nexport default class Menu extends WJElement {\n /**\n * Creates an instance of Menu.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'Menu';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return ['active', 'collapse'];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAriaState({\n role: 'menu',\n });\n }\n\n /**\n * Draws the component for the menu.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n this.classList.remove('wje-menu-collapse');\n\n if (this.hasAttribute('collapse')) this.classList.add('wje-menu-collapse');\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-menu');\n\n let slot = document.createElement('slot');\n\n native.appendChild(slot);\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Refreshes the component after drawing.\n */\n afterDraw() {\n Array.from(this.children).forEach((child) => {\n if (child.tagName.includes('-')) child.refresh();\n });\n }\n\n /**\n * Cleans up the component before disconnecting.\n */\n beforeDisconnect() {\n this.context.innerHTML = '';\n }\n}\n","import Menu from './menu.element.js';\n\nexport default Menu;\n\nMenu.define('wje-menu', Menu);\n"],"names":[],"mappings":";;;;;AA0Be,MAAM,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAKxC,cAAc;AACV,
|
|
1
|
+
{"version":3,"file":"wje-menu.js","sources":["../packages/wje-menu/menu.element.js","../packages/wje-menu/menu.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Menu` is a custom web component that represents a menu.\n * It extends from `WJElement`.\n * @summary This element represents a menu.\n * @documentation https://elements.webjet.sk/components/menu\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the menu.\n * @slot - The default slot for the menu.\n * @cssproperty [--wje-menu-background=var(--wje-background)] - Defines the background color of the menu. Accepts any valid CSS color value, such as `#ffffff`, `rgb(255, 255, 255)`, or CSS variables.\n * @cssproperty [--wje-menu-border-width=1px] - Specifies the width of the menu's border. Accepts any valid CSS length value (e.g., `px`, `em`, `%`).\n * @cssproperty [--wje-menu-border-style=solid] - Sets the style of the menu's border. Common values include `solid`, `dashed`, `dotted`, etc.\n * @cssproperty [--wje-menu-border-color=var(--wje-border-color)] - Defines the color of the menu's border. Accepts any valid CSS color value.\n * @cssproperty [--wje-menu-border-radius=var(--wje-border-radius-small)] - Determines the radius of the menu's corners, creating rounded edges. Accepts any valid CSS length value (e.g., `px`, `%`).\n * @cssproperty [--wje-menu-padding-top=.5rem] - Specifies the top padding inside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-padding-bottom=.5rem] - Specifies the bottom padding inside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-padding-inline=0] - Sets the horizontal (left and right) padding inside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-margin-top=0] - Defines the top margin outside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-margin-bottom=0] - Defines the bottom margin outside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-margin-inline=0] - Specifies the horizontal (left and right) margin outside the menu. Accepts any valid CSS length value.\n * @cssproperty [--wje-menu-collapse-width=65px] - Sets the width of the menu when it is collapsed. This property is typically used to define the reduced size of the menu in collapsed state. Accepts any valid CSS length value.\n * @tag wje-menu\n */\nexport default class Menu extends WJElement {\n /**\n * Creates an instance of Menu.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'Menu';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return ['active', 'collapse'];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAriaState({\n role: 'menu',\n });\n }\n\n /**\n * Draws the component for the menu.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n this.classList.remove('wje-menu-collapse');\n\n if (this.hasAttribute('collapse')) this.classList.add('wje-menu-collapse');\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-menu');\n\n let slot = document.createElement('slot');\n\n native.appendChild(slot);\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Refreshes the component after drawing.\n */\n afterDraw() {\n Array.from(this.children).forEach((child) => {\n if (child.tagName.includes('-')) child.refresh();\n });\n }\n\n /**\n * Cleans up the component before disconnecting.\n */\n beforeDisconnect() {\n this.context.innerHTML = '';\n }\n}\n","import Menu from './menu.element.js';\n\nexport default Menu;\n\nMenu.define('wje-menu', Menu);\n"],"names":[],"mappings":";;;;;AA0Be,MAAM,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAKxC,cAAc;AACV,UAAK;AAGT,qCAAY;AAAA,EAFZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,WAAW,gBAAgB;AACvB,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW,qBAAqB;AAC5B,WAAO,CAAC,UAAU,UAAU;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAkB;AACd,SAAK,eAAe;AACpB,SAAK,aAAa;AAAA,MACd,MAAM;AAAA,IAClB,CAAS;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO;AACH,QAAI,WAAW,SAAS,uBAAsB;AAE9C,SAAK,UAAU,OAAO,mBAAmB;AAEzC,QAAI,KAAK,aAAa,UAAU,EAAG,MAAK,UAAU,IAAI,mBAAmB;AAEzE,QAAI,SAAS,SAAS,cAAc,KAAK;AACzC,WAAO,aAAa,QAAQ,QAAQ;AACpC,WAAO,UAAU,IAAI,aAAa;AAElC,QAAI,OAAO,SAAS,cAAc,MAAM;AAExC,WAAO,YAAY,IAAI;AACvB,aAAS,YAAY,MAAM;AAE3B,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AACR,UAAM,KAAK,KAAK,QAAQ,EAAE,QAAQ,CAAC,UAAU;AACzC,UAAI,MAAM,QAAQ,SAAS,GAAG,EAAG,OAAM,QAAO;AAAA,IAClD,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,mBAAmB;AACf,SAAK,QAAQ,YAAY;AAAA,EAC7B;AACJ;ACnGA,KAAK,OAAO,YAAY,IAAI;"}
|
package/dist/wje-option.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-option.js","sources":["../packages/wje-option/option.element.js","../packages/wje-option/option.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport Icon from '../wje-icon/icon.js';\nimport Checkbox from '../wje-checkbox/checkbox.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Option` is a custom web component that represents an option.\n * @summary This element represents an option.\n * @documentation https://elements.webjet.sk/components/option\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the option.\n * @slot start - The slot for the start of the option.\n * @slot - The default slot for the option.\n * @slot end - The slot for the end of the option.\n * // @fires wje-option:change - Event fired when the option is clicked.\n * @tag wje-option\n */\nexport default class Option extends WJElement {\n\t/**\n\t * Creates an instance of Option.\n\t * @class\n\t */\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\t/**\n\t * Dependencies of the Option component.\n\t */\n\tdependencies = {\n\t\t'wje-icon': Icon,\n\t\t'wje-checkbox': Checkbox,\n\t};\n\n\t/**\n\t * Sets the selected attribute of the option.\n\t * @param {boolean} value The value to set.\n\t */\n\tset selected(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('selected', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('selected');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the 'selected' attribute status of the element.\n\t * @returns {boolean} Returns true if the 'selected' attribute is set on the element; otherwise, false.\n\t */\n\tget selected() {\n\t\treturn this.hasAttribute('selected');\n\t}\n\n\t/**\n\t * Retrieves the value indicating whether the closest 'wje-select' element has a 'checkbox' attribute.\n\t * @returns {boolean} True if the closest 'wje-select' element has a 'checkbox' attribute; otherwise, false.\n\t */\n\tget checkbox() {\n\t\treturn this.closest('wje-select')?.hasAttribute('checkbox');\n\t}\n\n\t/**\n\t * Determines whether the closest 'wje-select' element has the 'multiple' attribute.\n\t * @returns {boolean} Returns true if the 'wje-select' element has the 'multiple' attribute, otherwise false.\n\t */\n\tget multiple() {\n\t\treturn this.closest('wje-select')?.hasAttribute('multiple') || false;\n\t}\n\n\t/**\n\t * Sets the value attribute of the option.\n\t * @param {string} value The value to set.\n\t */\n\tset value(value) {\n\t\tthis.setAttribute('value', value);\n\t}\n\n\tget value() {\n\t\treturn this.getAttribute('value');\n\t}\n\n\t/**\n\t * Sets the text content of the option.\n\t * @param {string} value The text to set.\n\t */\n\tset text(value) {\n\t\tthis.innerText = value;\n\t}\n\n\tclassName = 'Option';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet}\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Returns the list of attributes to observe for changes.\n\t * @static\n\t * @returns {Array<string>}\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['selected'];\n\t}\n\n\t/**\n\t * This method is called whenever an observed attribute is added, removed, or changed.\n\t * @param {string} name The name of the attribute that was changed.\n\t * @param {*} old The previous value of the attribute before the change.\n\t * @param {*} newName The new value of the attribute after the change.\n\t * @returns {void} This method does not return a value.\n\t */\n\tattributeChangedCallback(name, old, newName) {\n\t\tif (this.checkbox) {\n\t\t\tif (name === 'selected' && newName !== null) {\n\t\t\t\tthis.#setCheckbox(true);\n\t\t\t} else {\n\t\t\t\tthis.#setCheckbox(false);\n\t\t\t}\n\t\t}\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Draws the component for the option.\n\t * @returns {DocumentFragment}\n\t */\n\tdraw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tlet native = document.createElement('div');\n\t\tnative.classList.add('native-option');\n\t\tnative.setAttribute('part', 'native');\n\n\t\tlet icon = document.createElement('wje-icon');\n\t\ticon.setAttribute('name', 'check');\n\t\ticon.setAttribute('slot', 'check');\n\n\t\tlet checkboxEl = document.createElement('wje-checkbox');\n\t\tcheckboxEl.setAttribute('slot', 'check');\n\n\t\tlet check = document.createElement('slot');\n\t\tcheck.setAttribute('name', 'check');\n\t\tcheck.setAttribute('part', 'check');\n\n\t\tlet start = document.createElement('slot');\n\t\tstart.setAttribute('name', 'start');\n\n\t\tlet slot = document.createElement('slot');\n\n\t\tlet endWrapper = document.createElement('span');\n\t\tendWrapper.classList.add('end-slot');\n\n\t\tlet end = document.createElement('slot');\n\t\tend.setAttribute('name', 'end');\n\n\t\tendWrapper.append(end);\n\n\t\tconst hasCheckSlot = this.querySelector('[slot=\"check\"]') !== null;\n\n\t\tif (!hasCheckSlot) {\n\t\t\tif (this.checkbox && this.multiple) {\n\t\t\t\tthis.append(checkboxEl);\n\t\t\t} else {\n\t\t\t\tthis.append(icon);\n\t\t\t}\n\t\t}\n\n\t\tnative.append(check);\n\t\tnative.append(start);\n\t\tnative.append(slot);\n\t\tnative.append(endWrapper);\n\n\t\tfragment.append(native);\n\n\t\tthis.check = check;\n\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Method executed after the drawing process is completed.\n\t * Sets up an event listener for 'click' events, linking them to the specified callback function.\n\t * @returns {void} Does not return a value.\n\t */\n\tafterDraw() {\n\t\tevent.addListener(this, 'click', null, this.optionClickCallback);\n\n\t\t// If `selected` was set before render, attributeChangedCallback may have run\n\t\t// before `this.check` existed. Sync the checkbox state once slots exist.\n\t\tif (this.checkbox && this.multiple) {\n\t\t\tthis.#setCheckbox(this.selected);\n\t\t}\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Syncs ARIA attributes on the host element.\n\t */\n\tsyncAria() {\n\t\tthis.setAriaState({\n\t\t\trole: 'option',\n\t\t\tselected: this.selected,\n\t\t\tdisabled: this.hasAttribute('disabled'),\n\t\t});\n\t}\n\n\t/**\n\t * Handles operations or cleanup tasks that need to occur before disconnecting.\n\t * Removes an event listener associated with the 'click' event and a specified callback function.\n\t * @returns {void} This method does not return a value.\n\t */\n\tbeforeDisconnect() {\n\t\tevent.removeListener(this, 'click', null, this.optionClickCallback);\n\t}\n\n\t/**\n\t * Handles the click event on an option element and dispatches a custom event when triggered.\n\t * @param {Event} e The click event object that triggered the callback.\n\t * @returns {void} No return value.\n\t */\n\toptionClickCallback(e) {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\te.stopImmediatePropagation();\n\n\t\tif (this.hasAttribute('disabled')) return;\n\n\t\tevent.dispatchCustomEvent(this, 'wje-option:change', {\n\t\t\tvalue: this.value,\n\t\t\ttext: this.textContent,\n\t\t\toption: this,\n\t\t});\n\t}\n\n\t/**\n\t * Checks if the given DOM node represents a checkbox element.\n\t * @param {Node} node The DOM node to be checked.\n\t * @returns {boolean} Returns true if the node is an element with a class name of 'Checkbox', otherwise false.\n\t */\n\t#isCheckbox(node) {\n\t\treturn node instanceof Element && node.className === 'Checkbox';\n\t}\n\n\t/**\n\t * Updates the checked status of the first checkbox element found within the assigned elements of the specified container.\n\t * @param {boolean} checked The desired checked state to be applied to the checkbox.\n\t * @returns {void}\n\t */\n\t#setCheckbox(checked) {\n\t\tconst assigned = this.check?.assignedElements({ flatten: true }) ?? [];\n\t\tconst arr = assigned.filter((item) => this.#isCheckbox(item));\n\t\tif (arr.length > 0) arr[0].checked = checked;\n\t}\n}\n","import Option from './option.element.js';\n\nexport default Option;\n\nOption.define('wje-option', Option);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBe,MAAM,eAAe,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7C,cAAc;AACb,UAAO;AANM;AAYd;AAAA;AAAA;AAAA,wCAAe;AAAA,MACd,YAAY;AAAA,MACZ,gBAAgB;AAAA,IAChB;AA0DD,qCAAY;AAAA,EAlEb;AAAA;AAAA;AAAA;AAAA;AAAA,EAcC,IAAI,SAAS,OAAO;AACnB,QAAI,OAAO;AACV,WAAK,aAAa,YAAY,EAAE;AAAA,IACnC,OAAS;AACN,WAAK,gBAAgB,UAAU;AAAA,IAClC;AAAA,E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KAAK;AAAA,MACf,UAAU,KAAK,aAAa,UAAU;AAAA,IACzC,CAAG;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOC,mBAAmB;AAClB,UAAM,eAAe,MAAM,SAAS,MAAM,KAAK,mBAAmB;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOC,oBAAoB,GAAG;AACtB,MAAE,eAAgB;AAClB,MAAE,gBAAiB;AACnB,MAAE,yBAA0B;AAE5B,QAAI,KAAK,aAAa,UAAU,EAAG;AAEnC,UAAM,oBAAoB,MAAM,qBAAqB;AAAA,MACpD,OAAO,KAAK;AAAA,MACZ,MAAM,KAAK;AAAA,MACX,QAAQ;AAAA,IACX,CAAG;AAAA,EACH;AAqBA;AA1Pe;AAAA;AAAA;AAAA;AAAA;AAAA;AA4Od,gBAAW,SAAC,MAAM;AACjB,SAAO,gBAAgB,WAAW,KAAK,cAAc;AACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAOC,iBAAY,SAAC,SAAS;;AACrB,QAAM,aAAW,UAAK,UAAL,mBAAY,iBAAiB,EAAE,SAAS,KAAM,OAAK,CAAE;AACtE,QAAM,MAAM,SAAS,OAAO,CAAC,SAAS,sBAAK,kCAAL,WAAiB,KAAK;AAC5D,MAAI,IAAI,SAAS,EAAG,KAAI,CAAC,EAAE,UAAU;AACvC;ACvQA,OAAO,OAAO,cAAc,MAAM;"}
|
|
1
|
+
{"version":3,"file":"wje-option.js","sources":["../packages/wje-option/option.element.js","../packages/wje-option/option.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport Icon from '../wje-icon/icon.js';\nimport Checkbox from '../wje-checkbox/checkbox.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Option` is a custom web component that represents an option.\n * @summary This element represents an option.\n * @documentation https://elements.webjet.sk/components/option\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the option.\n * @slot start - The slot for the start of the option.\n * @slot - The default slot for the option.\n * @slot end - The slot for the end of the option.\n * // @fires wje-option:change - Event fired when the option is clicked.\n * @tag wje-option\n */\nexport default class Option extends WJElement {\n\t/**\n\t * Creates an instance of Option.\n\t * @class\n\t */\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\t/**\n\t * Dependencies of the Option component.\n\t */\n\tdependencies = {\n\t\t'wje-icon': Icon,\n\t\t'wje-checkbox': Checkbox,\n\t};\n\n\t/**\n\t * Sets the selected attribute of the option.\n\t * @param {boolean} value The value to set.\n\t */\n\tset selected(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('selected', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('selected');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the 'selected' attribute status of the element.\n\t * @returns {boolean} Returns true if the 'selected' attribute is set on the element; otherwise, false.\n\t */\n\tget selected() {\n\t\treturn this.hasAttribute('selected');\n\t}\n\n\t/**\n\t * Retrieves the value indicating whether the closest 'wje-select' element has a 'checkbox' attribute.\n\t * @returns {boolean} True if the closest 'wje-select' element has a 'checkbox' attribute; otherwise, false.\n\t */\n\tget checkbox() {\n\t\treturn this.closest('wje-select')?.hasAttribute('checkbox');\n\t}\n\n\t/**\n\t * Determines whether the closest 'wje-select' element has the 'multiple' attribute.\n\t * @returns {boolean} Returns true if the 'wje-select' element has the 'multiple' attribute, otherwise false.\n\t */\n\tget multiple() {\n\t\treturn this.closest('wje-select')?.hasAttribute('multiple') || false;\n\t}\n\n\t/**\n\t * Sets the value attribute of the option.\n\t * @param {string} value The value to set.\n\t */\n\tset value(value) {\n\t\tthis.setAttribute('value', value);\n\t}\n\n\tget value() {\n\t\treturn this.getAttribute('value');\n\t}\n\n\t/**\n\t * Sets the text content of the option.\n\t * @param {string} value The text to set.\n\t */\n\tset text(value) {\n\t\tthis.innerText = value;\n\t}\n\n\tclassName = 'Option';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet}\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Returns the list of attributes to observe for changes.\n\t * @static\n\t * @returns {Array<string>}\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['selected'];\n\t}\n\n\t/**\n\t * This method is called whenever an observed attribute is added, removed, or changed.\n\t * @param {string} name The name of the attribute that was changed.\n\t * @param {*} old The previous value of the attribute before the change.\n\t * @param {*} newName The new value of the attribute after the change.\n\t * @returns {void} This method does not return a value.\n\t */\n\tattributeChangedCallback(name, old, newName) {\n\t\tif (this.checkbox) {\n\t\t\tif (name === 'selected' && newName !== null) {\n\t\t\t\tthis.#setCheckbox(true);\n\t\t\t} else {\n\t\t\t\tthis.#setCheckbox(false);\n\t\t\t}\n\t\t}\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Draws the component for the option.\n\t * @returns {DocumentFragment}\n\t */\n\tdraw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tlet native = document.createElement('div');\n\t\tnative.classList.add('native-option');\n\t\tnative.setAttribute('part', 'native');\n\n\t\tlet icon = document.createElement('wje-icon');\n\t\ticon.setAttribute('name', 'check');\n\t\ticon.setAttribute('slot', 'check');\n\n\t\tlet checkboxEl = document.createElement('wje-checkbox');\n\t\tcheckboxEl.setAttribute('slot', 'check');\n\n\t\tlet check = document.createElement('slot');\n\t\tcheck.setAttribute('name', 'check');\n\t\tcheck.setAttribute('part', 'check');\n\n\t\tlet start = document.createElement('slot');\n\t\tstart.setAttribute('name', 'start');\n\n\t\tlet slot = document.createElement('slot');\n\n\t\tlet endWrapper = document.createElement('span');\n\t\tendWrapper.classList.add('end-slot');\n\n\t\tlet end = document.createElement('slot');\n\t\tend.setAttribute('name', 'end');\n\n\t\tendWrapper.append(end);\n\n\t\tconst hasCheckSlot = this.querySelector('[slot=\"check\"]') !== null;\n\n\t\tif (!hasCheckSlot) {\n\t\t\tif (this.checkbox && this.multiple) {\n\t\t\t\tthis.append(checkboxEl);\n\t\t\t} else {\n\t\t\t\tthis.append(icon);\n\t\t\t}\n\t\t}\n\n\t\tnative.append(check);\n\t\tnative.append(start);\n\t\tnative.append(slot);\n\t\tnative.append(endWrapper);\n\n\t\tfragment.append(native);\n\n\t\tthis.check = check;\n\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Method executed after the drawing process is completed.\n\t * Sets up an event listener for 'click' events, linking them to the specified callback function.\n\t * @returns {void} Does not return a value.\n\t */\n\tafterDraw() {\n\t\tevent.addListener(this, 'click', null, this.optionClickCallback);\n\n\t\t// If `selected` was set before render, attributeChangedCallback may have run\n\t\t// before `this.check` existed. Sync the checkbox state once slots exist.\n\t\tif (this.checkbox && this.multiple) {\n\t\t\tthis.#setCheckbox(this.selected);\n\t\t}\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Syncs ARIA attributes on the host element.\n\t */\n\tsyncAria() {\n\t\tthis.setAriaState({\n\t\t\trole: 'option',\n\t\t\tselected: this.selected,\n\t\t\tdisabled: this.hasAttribute('disabled'),\n\t\t});\n\t}\n\n\t/**\n\t * Handles operations or cleanup tasks that need to occur before disconnecting.\n\t * Removes an event listener associated with the 'click' event and a specified callback function.\n\t * @returns {void} This method does not return a value.\n\t */\n\tbeforeDisconnect() {\n\t\tevent.removeListener(this, 'click', null, this.optionClickCallback);\n\t}\n\n\t/**\n\t * Handles the click event on an option element and dispatches a custom event when triggered.\n\t * @param {Event} e The click event object that triggered the callback.\n\t * @returns {void} No return value.\n\t */\n\toptionClickCallback(e) {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\te.stopImmediatePropagation();\n\n\t\tif (this.hasAttribute('disabled')) return;\n\n\t\tevent.dispatchCustomEvent(this, 'wje-option:change', {\n\t\t\tvalue: this.value,\n\t\t\ttext: this.textContent,\n\t\t\toption: this,\n\t\t});\n\t}\n\n\t/**\n\t * Checks if the given DOM node represents a checkbox element.\n\t * @param {Node} node The DOM node to be checked.\n\t * @returns {boolean} Returns true if the node is an element with a class name of 'Checkbox', otherwise false.\n\t */\n\t#isCheckbox(node) {\n\t\treturn node instanceof Element && node.className === 'Checkbox';\n\t}\n\n\t/**\n\t * Updates the checked status of the first checkbox element found within the assigned elements of the specified container.\n\t * @param {boolean} checked The desired checked state to be applied to the checkbox.\n\t * @returns {void}\n\t */\n\t#setCheckbox(checked) {\n\t\tconst assigned = this.check?.assignedElements({ flatten: true }) ?? [];\n\t\tconst arr = assigned.filter((item) => this.#isCheckbox(item));\n\t\tif (arr.length > 0) arr[0].checked = checked;\n\t}\n}\n","import Option from './option.element.js';\n\nexport default Option;\n\nOption.define('wje-option', Option);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBe,MAAM,eAAe,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7C,cAAc;AACb,UAAK;AANQ;AAYd;AAAA;AAAA;AAAA,wCAAe;AAAA,MACd,YAAY;AAAA,MACZ,gBAAgB;AAAA,IAClB;AA0DC,qCAAY;AAAA,EAlEZ;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,IAAI,SAAS,OAAO;AACnB,QAAI,OAAO;AACV,WAAK,aAAa,YAAY,EAAE;AAAA,IACjC,OAAO;AACN,WAAK,gBAAgB,UAAU;AAAA,IAChC;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,WAAW;AACd,WAAO,KAAK,aAAa,UAAU;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,WAAW;;AACd,YAAO,UAAK,QAAQ,YAAY,MAAzB,mBAA4B,aAAa;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,WAAW;;AACd,aAAO,UAAK,QAAQ,YAAY,MAAzB,mBAA4B,aAAa,gBAAe;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aAAa,UAAU,EAAG;AAEnC,UAAM,oBAAoB,MAAM,qBAAqB;AAAA,MACpD,OAAO,KAAK;AAAA,MACZ,MAAM,KAAK;AAAA,MACX,QAAQ;AAAA,IACX,CAAG;AAAA,EACF;AAqBD;AA1Pe;AAAA;AAAA;AAAA;AAAA;AAAA;AA4Od,gBAAW,SAAC,MAAM;AACjB,SAAO,gBAAgB,WAAW,KAAK,cAAc;AACtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAAY,SAAC,SAAS;;AACrB,QAAM,aAAW,UAAK,UAAL,mBAAY,iBAAiB,EAAE,SAAS,KAAI,OAAO,CAAA;AACpE,QAAM,MAAM,SAAS,OAAO,CAAC,SAAS,sBAAK,kCAAL,WAAiB,KAAK;AAC5D,MAAI,IAAI,SAAS,EAAG,KAAI,CAAC,EAAE,UAAU;AACtC;ACvQD,OAAO,OAAO,cAAc,MAAM;"}
|
package/dist/wje-options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-options.js","sources":["../packages/wje-options/options.element.js","../packages/wje-options/options.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport InfiniteScroll from '../wje-infinite-scroll/infinite-scroll.js';\nimport List from '../wje-list/list.js';\nimport Option from '../wje-option/option.js';\n\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Options` is a custom web component that represents a set of options. It extends from `WJElement`.\n * @summary This element represents a set of options.\n * @documentation https://elements.webjet.sk/components/options\n * @status stable\n * @tag wje-options\n */\n\nexport default class Options extends WJElement {\n\n\t#loadedOptions = [];\n\n\t#drawPreloadedElements = [];\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tdependencies = {\n\t\t'wje-option': Option,\n\t\t'wje-infinite-scroll': InfiniteScroll,\n\t\t'wje-list': List,\n\t}\n\n\t/**\n\t * Sets the option array path attribute.\n\t * @param {string} value The value to set for the option array path.\n\t */\n\tset optionArrayPath(value) {\n\t\tthis.setAttribute('option-array-path', value);\n\t}\n\n\t/**\n\t * Gets the option array path attribute.\n\t * @returns {string} The value of the option array path attribute or \"data\" if not set.\n\t */\n\tget optionArrayPath() {\n\t\treturn this.getAttribute('option-array-path');\n\t}\n\n\t/**\n\t * Checks if the option array path attribute is present.\n\t * @returns {boolean} True if the option array path attribute is present, false otherwise.\n\t */\n\tget hasOptionArrayPath() {\n\t\treturn this.hasAttribute('option-array-path');\n\t}\n\n\t/**\n\t * Gets the dropdown height attribute.\n\t * @returns {string} The value of the dropdown height attribute or \"100%\" if not set.\n\t */\n\tget dropdownHeight() {\n\t\treturn this.getAttribute('dropdown-height') || '100%';\n\t}\n\n\t/**\n\t * Sets the dropdown height attribute.\n\t * @param {string} value The value to set for the dropdown height.\n\t */\n\tset dropdownHeight(value) {\n\t\tthis.setAttribute('dropdown-height', value);\n\t}\n\n\t/**\n\t * Sets the item value attribute.\n\t * @param {string} value The value to set for the item value.\n\t */\n\tset itemValue(value) {\n\t\tthis.setAttribute('item-value', value);\n\t}\n\n\t/**\n\t * Gets the item value attribute.\n\t * @returns {string} The value of the item value attribute or \"value\" if not set.\n\t */\n\tget itemValue() {\n\t\treturn this.getAttribute('item-value') || 'value';\n\t}\n\n\t/**\n\t * Sets the item text attribute.\n\t * @param {string} value The value to set for the item text.\n\t */\n\tset itemText(value) {\n\t\tthis.setAttribute('item-text', value);\n\t}\n\n\t/**\n\t * Gets the item text attribute.\n\t * @returns {string} The value of the item text attribute or \"text\" if not set.\n\t */\n\tget itemText() {\n\t\treturn this.getAttribute('item-text') || 'text';\n\t}\n\n\t/**\n\t * Gets the lazy load size attribute.\n\t * @returns {number} The value of the lazy load size attribute or 10 if not set.\n\t */\n\tget lazyLoadSize() {\n\t\treturn this.getAttribute('lazy-load-size') || 10;\n\t}\n\n\t/**\n\t * Sets the lazy load size attribute.\n\t * @param {number} value The value to set for the lazy load size.\n\t */\n\tset lazyLoadSize(value) {\n\t\tthis.setAttribute('lazy-load-size', value);\n\t}\n\n\t/**\n\t * Sets the search attribute.\n\t * @param {string} value The value to set for the search.\n\t */\n\tset search(value) {\n\t\tthis.setAttribute('search', value);\n\t}\n\n\t/**\n\t * Gets the search attribute.\n\t * @returns {string} The value of the search attribute.\n\t */\n\tget search() {\n\t\treturn this.getAttribute('search');\n\t}\n\n\t/**\n\t * Checks if the search attribute is present.\n\t * @returns {boolean} True if the search attribute is present, false otherwise.\n\t */\n\tget hasSearch() {\n\t\treturn this.hasAttribute('search');\n\t}\n\n\t/**\n\t * Retrieves the value of the 'search-to-query-params' attribute from the current instance.\n\t * @returns {string | null} The value of the 'search-to-query-params' attribute, or null if the attribute is not set.\n\t */\n\tget searchToQueryParams() {\n\t\treturn this.getAttribute('search-to-query-params');\n\t}\n\n\t/**\n\t * Sets the value to define search-to-query params behavior.\n\t * @param {string} value The value to be set for the search-to-query-params attribute.\n\t */\n\tset searchToQueryParams(value) {\n\t\tthis.setAttribute('search-to-query-params', value);\n\t}\n\n\t/**\n\t * Determines whether the 'search-to-query-params' attribute is present on the element.\n\t * @returns {boolean} True if the 'search-to-query-params' attribute exists, otherwise false.\n\t */\n\tget hasSearchToQueryParams() {\n\t\treturn this.hasAttribute('search-to-query-params');\n\t}\n\n\t/**\n\t * Sets the value of the search parameter name attribute.\n\t * @param {string} value The string value to set as the search parameter name.\n\t */\n\tset searchParamName(value) {\n\t\tthis.setAttribute('search-param-name', value);\n\t}\n\n\t/**\n\t * Gets the search parameter name used in queries.\n\t * Retrieves the value of the 'search-param-name' attribute.\n\t * If the attribute is not set, it defaults to 'search'.\n\t * @returns {string} The search parameter name used for queries.\n\t */\n\tget searchParamName() {\n\t\treturn this.getAttribute('search-param-name') || 'search';\n\t}\n\n\t/**\n\t * Sets the queryParams attribute on the element.\n\t * @param {string} value The query parameters to set, represented as a string.\n\t */\n\tset queryParams(value) {\n\t\tthis.setAttribute('query-params', value);\n\t}\n\n\t/**\n\t * Retrieves the value of the 'query-params' attribute.\n\t * @returns {string | null} The value of the 'query-params' attribute, or null if the attribute is not set.\n\t */\n\tget queryParams() {\n\t\treturn this.getAttribute('query-params');\n\t}\n\n\t/**\n\t * Sets the lazy attribute.\n\t * @param {boolean} value The value to set for the lazy attribute.\n\t */\n\tset lazy(value) {\n\t\tthis.setAttribute('lazy', value);\n\t}\n\n\t/**\n\t * Checks if the lazy attribute is present.\n\t * @returns {boolean} True if the lazy attribute is present, false otherwise.\n\t */\n\tget lazy() {\n\t\treturn this.hasAttribute('lazy');\n\t}\n\n\t/**\n\t * Gets the loaded options.\n\t * @returns {Array} The loaded options.\n\t */\n\tget options() {\n\t\treturn this.loadedOptions?.flat();\n\t}\n\n\t/**\n\t * Gets the loaded options.\n\t * @type {Array}\n\t */\n\tget loadedOptions() {\n\t\treturn this.#loadedOptions;\n\t}\n\n\t/**\n\t * Sets the loaded options.\n\t * @type {Array}\n\t */\n\tset loadedOptions(loadedOptions) {\n\t\tthis.#loadedOptions = loadedOptions;\n\t}\n\n\t/**\n\t * Array of preloaded elements.\n\t * @type {Array}\n\t * @private\n\t */\n\tget drawPreloadedElements() {\n\t\treturn this.#drawPreloadedElements;\n\t}\n\n\t/**\n\t * Sets the elements that are preloaded and ready to be drawn.\n\t * @param {Array|object} elements The elements to be set for preloading. This can be an array or a specific object containing drawable elements.\n\t */\n\tset drawPreloadedElements(elements) {\n\t\tthis.#drawPreloadedElements = elements;\n\t}\n\n\tclassName = 'Options';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet} The CSS styles for the component.\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Retrieves an array of attributes that should be observed for changes.\n\t * The method returns a list of attribute names that the browser will monitor for changes.\n\t * @returns {Array<string>} An array of attribute names to observe.\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['search', 'attached'];\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Draws the component.\n\t * @returns {DocumentFragment}\n\t */\n\tasync draw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tconst slot = document.createElement('slot');\n\t\tfragment.appendChild(slot);\n\t\tthis.syncAria();\n\n\t\tif (this.lazy) {\n\t\t\tif (this.contains(this.infiniteScroll)) {\n\t\t\t\tthis.drawPreloadedElements.forEach((el) => { el.remove() });\n\t\t\t\tthis.loadedOptions = [];\n\t\t\t\tthis.infiniteScroll.placementObj.innerHTML = '';\n\t\t\t\tthis.infiniteScroll.totalPages = 0;\n\t\t\t\tthis.infiniteScroll.refresh();\n\t\t\t}\n\n\t\t\tlet loader = document.createElement('div');\n\t\t\tloader.setAttribute('slot', 'loader');\n\t\t\tloader.append('Loading...');\n\t\t\tloader.classList.add('loader');\n\n\t\t\tconst infiniteScroll = document.createElement('wje-infinite-scroll');\n\t\t\tinfiniteScroll.setAttribute('placement', 'wje-list');\n\t\t\tinfiniteScroll.setAttribute('height', this.dropdownHeight);\n\t\t\tinfiniteScroll.setAttribute('object-name', this.optionArrayPath);\n\t\t\tinfiniteScroll.dataToHtml = this.htmlItem;\n\t\t\tinfiniteScroll.setCustomData = async (page, signal) => {\n\t\t\t\tlet processedUrl = `${this.url}${this.search ? `/${this.search}` : ''}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ''}`;\n\n\t\t\t\tif (this.hasSearchToQueryParams) {\n\t\t\t\t\tprocessedUrl = `${this.url}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ''}${this.search ? `&${this.searchParamName}=${this.search}` : ''}`;\n\t\t\t\t}\n\n\t\t\t\tlet res = await this.service.get(processedUrl, null, false, signal);\n\t\t\t\tconst filteredOptions = this.filterOutDrawnOptions(res);\n\t\t\t\tthis.loadedOptions.push(...this.processData(filteredOptions));\n\n\t\t\t\treturn filteredOptions;\n\t\t\t};\n\n\t\t\tconst list = document.createElement('wje-list');\n\n\t\t\tinfiniteScroll.append(list);\n\t\t\tinfiniteScroll.append(loader);\n\n\t\t\tif (this.hasAttribute('attached') && !this.hasSearch) {\n\t\t\t\tthis.appendChild(infiniteScroll);\n\t\t\t\tthis.drawPreloadedElements.forEach((el) => {\n\t\t\t\t\tlist.appendChild(el);\n\t\t\t\t});\n\t\t\t\tthis.infiniteScroll = infiniteScroll;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.response = await this.getPages();\n\n\t\t\tlet optionsData = this.filterOutDrawnOptions(this.response);\n\t\t\toptionsData = this.processData(optionsData);\n\n\t\t\tthis.loadedOptions.push(...optionsData);\n\n\t\t\tthis.append(...optionsData.map(this.htmlItem));\n\n\t\t\tevent.dispatchCustomEvent(this, 'wje-options:load', {});\n\t\t}\n\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Syncs ARIA attributes on the host element.\n\t */\n\tsyncAria() {\n\t\tconst isMultiple = this.closest('wje-select')?.hasAttribute('multiple');\n\t\tthis.setAriaState({\n\t\t\trole: 'listbox',\n\t\t\tmultiselectable: isMultiple ? 'true' : undefined,\n\t\t});\n\t}\n\n\tafterDraw() {\n\t\tevent.addListener(this.infiniteScroll, 'wje-infinite-scroll:load', null, this.dispatchOptionsLoadEvent);\n\t}\n\n\tdispatchOptionsLoadEvent = (e) => {\n\t\t// Wait for next paint cycle to ensure options are in DOM\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tevent.dispatchCustomEvent(this, 'wje-options:load', {});\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Processes the provided data based on the optional array path set in the instance.\n\t * @param {object} data The input data to be processed.\n\t * @returns {Array} The resolved options array from the data or an empty array if no match is found.\n\t */\n\tprocessData(data) {\n\t\tconst splittedOptionArrayPath = this.optionArrayPath ? this.optionArrayPath?.split('.') : null;\n\t\tlet options = data;\n\n\t\tsplittedOptionArrayPath?.forEach((path) => {\n\t\t\toptions = options[path];\n\t\t});\n\n\t\treturn options ?? [];\n\t}\n\n\t/**\n\t * Filters out options from the response object that have already been drawn, based on the specified option array path.\n\t * @param {object} response The response object containing data to process.\n\t * @returns {object} The filtered response object with drawn options removed.\n\t */\n\tfilterOutDrawnOptions(response) {\n\t\tconst splittedOptionArrayPath = this.optionArrayPath ? this.optionArrayPath?.split('.') : [];\n\t\tlet filteredResponse = structuredClone(response);\n\n\t\tfilteredResponse = this.recursiveUpdate(filteredResponse, splittedOptionArrayPath);\n\t\treturn filteredResponse;\n\t}\n\n\t/**\n\t * Recursively updates the object based on the provided path to the property.\n\t * @param {object | Array | null} object\n\t * @param {Array<string> | null} pathToProperty\n\t * @returns {object | Array | null}\n\t */\n\trecursiveUpdate = (object, pathToProperty) => {\n\t\tif (pathToProperty.length === 0) {\n\t\t\tif (Array.isArray(object)) {\n\t\t\t\treturn object.filter(\n\t\t\t\t\t(option) =>\n\t\t\t\t\t\t!this.loadedOptions.some(\n\t\t\t\t\t\t\t(loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconsole.error('Expected an array but got:', object, pathToProperty);\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}\n\n\t\tconst [currentPath, ...remainingPath] = pathToProperty;\n\t\tif (remainingPath.length > 0) {\n\t\t\tobject[currentPath] = this.recursiveUpdate(object[currentPath], remainingPath);\n\t\t} else {\n\t\t\tobject[currentPath] =\n\t\t\t\tobject[currentPath]?.filter(\n\t\t\t\t\t(option) =>\n\t\t\t\t\t\t!this.loadedOptions.some(\n\t\t\t\t\t\t\t(loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]\n\t\t\t\t\t\t)\n\t\t\t\t) ?? [];\n\t\t}\n\t\treturn object;\n\t};\n\n\t/**\n\t * Generates an HTML option element based on the provided item.\n\t * @param {object} item The item to generate the option element for.\n\t * @returns {HTMLElement} The generated option element.\n\t */\n\thtmlItem = (item) => {\n\t\tlet option = document.createElement('wje-option');\n\n\t\tif (item[this.itemValue] === null || item[this.itemValue] === undefined) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemValue}`);\n\t\t}\n\n\t\tif (item[this.itemText] === null || item[this.itemText] === undefined) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemText}`);\n\t\t}\n\n\t\toption.setAttribute('value', item[this.itemValue] ?? '');\n\t\toption.innerText = item[this.itemText] ?? '';\n\n\t\treturn option;\n\t};\n\n\t/**\n\t * Fetches the pages from the provided URL.\n\t * @param {number} page The page number to fetch.\n\t * @returns {Promise<object>} The fetched data.\n\t * @throws Will throw an error if the response is not ok.\n\t */\n\tasync getPages(page) {\n\t\tconst response = await fetch(this.url);\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`An error occurred: ${response.status}`);\n\t\t}\n\t\treturn await response.json();\n\t}\n\n\t/**\n\t * Finds the selected option data based on the given selected option values.\n\t * @param {Array} selectedOptionValues The array of selected option values.\n\t * @returns {Array} - The array of option data that matches the selected option values.\n\t */\n\tfindSelectedOptionData(selectedOptionValues = []) {\n\t\treturn this.options.filter((option) => selectedOptionValues.includes(option[this.itemValue]));\n\t}\n\n\t/**\n\t * Adds an option to the element.\n\t * @param {object} optionData The data of the option to be added.\n\t */\n\taddOption(optionData) {\n\t\tif (this.loadedOptions.some((option) => option[this.itemValue] === optionData[this.itemValue])) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst item = this.htmlItem(optionData);\n\t\tthis.#drawPreloadedElements.push(item);\n\t\tthis.prepend(item);\n\t\tthis.loadedOptions.push(optionData);\n\t}\n\n\t/**\n\t * Adds options to the element.\n\t * @param {Array} optionsData The array of option data to be added.\n\t * @param {boolean} [silent] Whether to suppress events triggered by adding options.\n\t */\n\taddOptions(optionsData = [], silent = false) {\n\t\tif (Array.isArray(optionsData)) optionsData?.forEach((od) => this.addOption(od, silent));\n\t\telse this.addOption(optionsData, silent);\n\t}\n\n\tbeforeDisconnect() {\n\t\tevent.removeListener(this.infiniteScroll, 'wje-infinite-scroll:load', null, this.dispatchOptionsLoadEvent);\n\t}\n}\n","import Options from './options.element.js';\n\nexport default Options;\n\nOptions.define('wje-options', Options);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAee,MAAM,gBAAgB,UAAU;AAAA,EAM9C,cAAc;AACb,UAAO;AALR,uCAAiB,CAAE;AAEnB,+CAAyB,CAAE;AAM3B,wCAAe;AAAA,MACd,cAAc;AAAA,MACd,uBAAuB;AAAA,MACvB,YAAY;AAAA,IACd;AAqOC,qCAAY;AAmHZ,oDAA2B,CAAC,MAAM;AAEjC,4BAAsB,MAAM;AAC3B,8BAAsB,MAAM;AAC3B,gBAAM,oBAAoB,MAAM,oBAAoB,CAAA,CAAE;AAAA,QAC1D,CAAI;AAAA,MACJ,CAAG;AAAA,IACH;AAqCC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2CAAkB,CAAC,QAAQ,mBAAmB;;AAC7C,UAAI,eAAe,WAAW,GAAG;AAChC,YAAI,MAAM,QAAQ,MAAM,GAAG;AAC1B,iBAAO,OAAO;AAAA,YACb,CAAC,WACA,CAAC,KAAK,cAAc;AAAA,cACnB,CAAC,iBAAiB,aAAa,KAAK,SAAS,MAAM,OAAO,KAAK,SAAS;AAAA,YAC/E;AAAA,UACK;AAAA,QACL,OAAU;AACN,kBAAQ,MAAM,8BAA8B,QAAQ,cAAc;AAClE,iBAAO,CAAE;AAAA,QACb;AAAA,MACA;AAEE,YAAM,CAAC,aAAa,GAAG,aAAa,IAAI;AACxC,UAAI,cAAc,SAAS,GAAG;AAC7B,eAAO,WAAW,IAAI,KAAK,gBAAgB,OAAO,WAAW,GAAG,aAAa;AAAA,MAChF,OAAS;AACN,eAAO,WAAW,MACjB,YAAO,WAAW,MAAlB,mBAAqB;AAAA,UACpB,CAAC,WACA,CAAC,KAAK,cAAc;AAAA,YACnB,CAAC,iBAAiB,aAAa,KAAK,SAAS,MAAM,OAAO,KAAK,SAAS;AAAA,UAC/E;AAAA,cACS,CAAE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;AAE/C,uBAAmB,KAAK,gBAAgB,kBAAkB,uBAAuB;AACjF,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkEC,MAAM,SAAS,MAAM;AACpB,UAAM,WAAW,MAAM,MAAM,KAAK,GAAG;AACrC,QAAI,CAAC,SAAS,IAAI;AACjB,YAAM,IAAI,MAAM,sBAAsB,SAAS,MAAM,EAAE;AAAA,IAC1D;AACE,WAAO,MAAM,SAAS,KAAM;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOC,uBAAuB,uBAAuB,IAAI;AACjD,WAAO,KAAK,QAAQ,OAAO,CAAC,WAAW,qBAAqB,SAAS,OAAO,KAAK,SAAS,CAAC,CAAC;AAAA,EAC9F;AAAA;AAAA;AAAA;AAAA;AAAA,EAMC,UAAU,YAAY;AACrB,QAAI,KAAK,cAAc,KAAK,CAAC,WAAW,OAAO,KAAK,SAAS,MAAM,WAAW,KAAK,SAAS,CAAC,GAAG;AAC/F;AAAA,IACH;AAEE,UAAM,OAAO,KAAK,SAAS,UAAU;AACrC,uBAAK,wBAAuB,KAAK,IAAI;AACrC,SAAK,QAAQ,IAAI;AACjB,SAAK,cAAc,KAAK,UAAU;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOC,WAAW,cAAc,IAAI,SAAS,OAAO;AAC5C,QAAI,MAAM,QAAQ,WAAW,EAAG,4CAAa,QAAQ,CAAC,OAAO,KAAK,UAAU,IAAI,MAAM;AAAA,QACjF,MAAK,UAAU,aAAa,MAAM;AAAA,EACzC;AAAA,EAEC,mBAAmB;AAClB,UAAM,eAAe,KAAK,gBAAgB,4BAA4B,MAAM,KAAK,wBAAwB;AAAA,EAC3G;AACA;AAvfC;AAEA;ACfD,QAAQ,OAAO,eAAe,OAAO;"}
|
|
1
|
+
{"version":3,"file":"wje-options.js","sources":["../packages/wje-options/options.element.js","../packages/wje-options/options.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport InfiniteScroll from '../wje-infinite-scroll/infinite-scroll.js';\nimport List from '../wje-list/list.js';\nimport Option from '../wje-option/option.js';\n\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Options` is a custom web component that represents a set of options. It extends from `WJElement`.\n * @summary This element represents a set of options.\n * @documentation https://elements.webjet.sk/components/options\n * @status stable\n * @tag wje-options\n */\n\nexport default class Options extends WJElement {\n\n\t#loadedOptions = [];\n\n\t#drawPreloadedElements = [];\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tdependencies = {\n\t\t'wje-option': Option,\n\t\t'wje-infinite-scroll': InfiniteScroll,\n\t\t'wje-list': List,\n\t}\n\n\t/**\n\t * Sets the option array path attribute.\n\t * @param {string} value The value to set for the option array path.\n\t */\n\tset optionArrayPath(value) {\n\t\tthis.setAttribute('option-array-path', value);\n\t}\n\n\t/**\n\t * Gets the option array path attribute.\n\t * @returns {string} The value of the option array path attribute or \"data\" if not set.\n\t */\n\tget optionArrayPath() {\n\t\treturn this.getAttribute('option-array-path');\n\t}\n\n\t/**\n\t * Checks if the option array path attribute is present.\n\t * @returns {boolean} True if the option array path attribute is present, false otherwise.\n\t */\n\tget hasOptionArrayPath() {\n\t\treturn this.hasAttribute('option-array-path');\n\t}\n\n\t/**\n\t * Gets the dropdown height attribute.\n\t * @returns {string} The value of the dropdown height attribute or \"100%\" if not set.\n\t */\n\tget dropdownHeight() {\n\t\treturn this.getAttribute('dropdown-height') || '100%';\n\t}\n\n\t/**\n\t * Sets the dropdown height attribute.\n\t * @param {string} value The value to set for the dropdown height.\n\t */\n\tset dropdownHeight(value) {\n\t\tthis.setAttribute('dropdown-height', value);\n\t}\n\n\t/**\n\t * Sets the item value attribute.\n\t * @param {string} value The value to set for the item value.\n\t */\n\tset itemValue(value) {\n\t\tthis.setAttribute('item-value', value);\n\t}\n\n\t/**\n\t * Gets the item value attribute.\n\t * @returns {string} The value of the item value attribute or \"value\" if not set.\n\t */\n\tget itemValue() {\n\t\treturn this.getAttribute('item-value') || 'value';\n\t}\n\n\t/**\n\t * Sets the item text attribute.\n\t * @param {string} value The value to set for the item text.\n\t */\n\tset itemText(value) {\n\t\tthis.setAttribute('item-text', value);\n\t}\n\n\t/**\n\t * Gets the item text attribute.\n\t * @returns {string} The value of the item text attribute or \"text\" if not set.\n\t */\n\tget itemText() {\n\t\treturn this.getAttribute('item-text') || 'text';\n\t}\n\n\t/**\n\t * Gets the lazy load size attribute.\n\t * @returns {number} The value of the lazy load size attribute or 10 if not set.\n\t */\n\tget lazyLoadSize() {\n\t\treturn this.getAttribute('lazy-load-size') || 10;\n\t}\n\n\t/**\n\t * Sets the lazy load size attribute.\n\t * @param {number} value The value to set for the lazy load size.\n\t */\n\tset lazyLoadSize(value) {\n\t\tthis.setAttribute('lazy-load-size', value);\n\t}\n\n\t/**\n\t * Sets the search attribute.\n\t * @param {string} value The value to set for the search.\n\t */\n\tset search(value) {\n\t\tthis.setAttribute('search', value);\n\t}\n\n\t/**\n\t * Gets the search attribute.\n\t * @returns {string} The value of the search attribute.\n\t */\n\tget search() {\n\t\treturn this.getAttribute('search');\n\t}\n\n\t/**\n\t * Checks if the search attribute is present.\n\t * @returns {boolean} True if the search attribute is present, false otherwise.\n\t */\n\tget hasSearch() {\n\t\treturn this.hasAttribute('search');\n\t}\n\n\t/**\n\t * Retrieves the value of the 'search-to-query-params' attribute from the current instance.\n\t * @returns {string | null} The value of the 'search-to-query-params' attribute, or null if the attribute is not set.\n\t */\n\tget searchToQueryParams() {\n\t\treturn this.getAttribute('search-to-query-params');\n\t}\n\n\t/**\n\t * Sets the value to define search-to-query params behavior.\n\t * @param {string} value The value to be set for the search-to-query-params attribute.\n\t */\n\tset searchToQueryParams(value) {\n\t\tthis.setAttribute('search-to-query-params', value);\n\t}\n\n\t/**\n\t * Determines whether the 'search-to-query-params' attribute is present on the element.\n\t * @returns {boolean} True if the 'search-to-query-params' attribute exists, otherwise false.\n\t */\n\tget hasSearchToQueryParams() {\n\t\treturn this.hasAttribute('search-to-query-params');\n\t}\n\n\t/**\n\t * Sets the value of the search parameter name attribute.\n\t * @param {string} value The string value to set as the search parameter name.\n\t */\n\tset searchParamName(value) {\n\t\tthis.setAttribute('search-param-name', value);\n\t}\n\n\t/**\n\t * Gets the search parameter name used in queries.\n\t * Retrieves the value of the 'search-param-name' attribute.\n\t * If the attribute is not set, it defaults to 'search'.\n\t * @returns {string} The search parameter name used for queries.\n\t */\n\tget searchParamName() {\n\t\treturn this.getAttribute('search-param-name') || 'search';\n\t}\n\n\t/**\n\t * Sets the queryParams attribute on the element.\n\t * @param {string} value The query parameters to set, represented as a string.\n\t */\n\tset queryParams(value) {\n\t\tthis.setAttribute('query-params', value);\n\t}\n\n\t/**\n\t * Retrieves the value of the 'query-params' attribute.\n\t * @returns {string | null} The value of the 'query-params' attribute, or null if the attribute is not set.\n\t */\n\tget queryParams() {\n\t\treturn this.getAttribute('query-params');\n\t}\n\n\t/**\n\t * Sets the lazy attribute.\n\t * @param {boolean} value The value to set for the lazy attribute.\n\t */\n\tset lazy(value) {\n\t\tthis.setAttribute('lazy', value);\n\t}\n\n\t/**\n\t * Checks if the lazy attribute is present.\n\t * @returns {boolean} True if the lazy attribute is present, false otherwise.\n\t */\n\tget lazy() {\n\t\treturn this.hasAttribute('lazy');\n\t}\n\n\t/**\n\t * Gets the loaded options.\n\t * @returns {Array} The loaded options.\n\t */\n\tget options() {\n\t\treturn this.loadedOptions?.flat();\n\t}\n\n\t/**\n\t * Gets the loaded options.\n\t * @type {Array}\n\t */\n\tget loadedOptions() {\n\t\treturn this.#loadedOptions;\n\t}\n\n\t/**\n\t * Sets the loaded options.\n\t * @type {Array}\n\t */\n\tset loadedOptions(loadedOptions) {\n\t\tthis.#loadedOptions = loadedOptions;\n\t}\n\n\t/**\n\t * Array of preloaded elements.\n\t * @type {Array}\n\t * @private\n\t */\n\tget drawPreloadedElements() {\n\t\treturn this.#drawPreloadedElements;\n\t}\n\n\t/**\n\t * Sets the elements that are preloaded and ready to be drawn.\n\t * @param {Array|object} elements The elements to be set for preloading. This can be an array or a specific object containing drawable elements.\n\t */\n\tset drawPreloadedElements(elements) {\n\t\tthis.#drawPreloadedElements = elements;\n\t}\n\n\tclassName = 'Options';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet} The CSS styles for the component.\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Retrieves an array of attributes that should be observed for changes.\n\t * The method returns a list of attribute names that the browser will monitor for changes.\n\t * @returns {Array<string>} An array of attribute names to observe.\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['search', 'attached'];\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t\tthis.syncAria();\n\t}\n\n\t/**\n\t * Draws the component.\n\t * @returns {DocumentFragment}\n\t */\n\tasync draw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tconst slot = document.createElement('slot');\n\t\tfragment.appendChild(slot);\n\t\tthis.syncAria();\n\n\t\tif (this.lazy) {\n\t\t\tif (this.contains(this.infiniteScroll)) {\n\t\t\t\tthis.drawPreloadedElements.forEach((el) => { el.remove() });\n\t\t\t\tthis.loadedOptions = [];\n\t\t\t\tthis.infiniteScroll.placementObj.innerHTML = '';\n\t\t\t\tthis.infiniteScroll.totalPages = 0;\n\t\t\t\tthis.infiniteScroll.refresh();\n\t\t\t}\n\n\t\t\tlet loader = document.createElement('div');\n\t\t\tloader.setAttribute('slot', 'loader');\n\t\t\tloader.append('Loading...');\n\t\t\tloader.classList.add('loader');\n\n\t\t\tconst infiniteScroll = document.createElement('wje-infinite-scroll');\n\t\t\tinfiniteScroll.setAttribute('placement', 'wje-list');\n\t\t\tinfiniteScroll.setAttribute('height', this.dropdownHeight);\n\t\t\tinfiniteScroll.setAttribute('object-name', this.optionArrayPath);\n\t\t\tinfiniteScroll.dataToHtml = this.htmlItem;\n\t\t\tinfiniteScroll.setCustomData = async (page, signal) => {\n\t\t\t\tlet processedUrl = `${this.url}${this.search ? `/${this.search}` : ''}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ''}`;\n\n\t\t\t\tif (this.hasSearchToQueryParams) {\n\t\t\t\t\tprocessedUrl = `${this.url}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ''}${this.search ? `&${this.searchParamName}=${this.search}` : ''}`;\n\t\t\t\t}\n\n\t\t\t\tlet res = await this.service.get(processedUrl, null, false, signal);\n\t\t\t\tconst filteredOptions = this.filterOutDrawnOptions(res);\n\t\t\t\tthis.loadedOptions.push(...this.processData(filteredOptions));\n\n\t\t\t\treturn filteredOptions;\n\t\t\t};\n\n\t\t\tconst list = document.createElement('wje-list');\n\n\t\t\tinfiniteScroll.append(list);\n\t\t\tinfiniteScroll.append(loader);\n\n\t\t\tif (this.hasAttribute('attached') && !this.hasSearch) {\n\t\t\t\tthis.appendChild(infiniteScroll);\n\t\t\t\tthis.drawPreloadedElements.forEach((el) => {\n\t\t\t\t\tlist.appendChild(el);\n\t\t\t\t});\n\t\t\t\tthis.infiniteScroll = infiniteScroll;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.response = await this.getPages();\n\n\t\t\tlet optionsData = this.filterOutDrawnOptions(this.response);\n\t\t\toptionsData = this.processData(optionsData);\n\n\t\t\tthis.loadedOptions.push(...optionsData);\n\n\t\t\tthis.append(...optionsData.map(this.htmlItem));\n\n\t\t\tevent.dispatchCustomEvent(this, 'wje-options:load', {});\n\t\t}\n\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Syncs ARIA attributes on the host element.\n\t */\n\tsyncAria() {\n\t\tconst isMultiple = this.closest('wje-select')?.hasAttribute('multiple');\n\t\tthis.setAriaState({\n\t\t\trole: 'listbox',\n\t\t\tmultiselectable: isMultiple ? 'true' : undefined,\n\t\t});\n\t}\n\n\tafterDraw() {\n\t\tevent.addListener(this.infiniteScroll, 'wje-infinite-scroll:load', null, this.dispatchOptionsLoadEvent);\n\t}\n\n\tdispatchOptionsLoadEvent = (e) => {\n\t\t// Wait for next paint cycle to ensure options are in DOM\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tevent.dispatchCustomEvent(this, 'wje-options:load', {});\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Processes the provided data based on the optional array path set in the instance.\n\t * @param {object} data The input data to be processed.\n\t * @returns {Array} The resolved options array from the data or an empty array if no match is found.\n\t */\n\tprocessData(data) {\n\t\tconst splittedOptionArrayPath = this.optionArrayPath ? this.optionArrayPath?.split('.') : null;\n\t\tlet options = data;\n\n\t\tsplittedOptionArrayPath?.forEach((path) => {\n\t\t\toptions = options[path];\n\t\t});\n\n\t\treturn options ?? [];\n\t}\n\n\t/**\n\t * Filters out options from the response object that have already been drawn, based on the specified option array path.\n\t * @param {object} response The response object containing data to process.\n\t * @returns {object} The filtered response object with drawn options removed.\n\t */\n\tfilterOutDrawnOptions(response) {\n\t\tconst splittedOptionArrayPath = this.optionArrayPath ? this.optionArrayPath?.split('.') : [];\n\t\tlet filteredResponse = structuredClone(response);\n\n\t\tfilteredResponse = this.recursiveUpdate(filteredResponse, splittedOptionArrayPath);\n\t\treturn filteredResponse;\n\t}\n\n\t/**\n\t * Recursively updates the object based on the provided path to the property.\n\t * @param {object | Array | null} object\n\t * @param {Array<string> | null} pathToProperty\n\t * @returns {object | Array | null}\n\t */\n\trecursiveUpdate = (object, pathToProperty) => {\n\t\tif (pathToProperty.length === 0) {\n\t\t\tif (Array.isArray(object)) {\n\t\t\t\treturn object.filter(\n\t\t\t\t\t(option) =>\n\t\t\t\t\t\t!this.loadedOptions.some(\n\t\t\t\t\t\t\t(loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconsole.error('Expected an array but got:', object, pathToProperty);\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}\n\n\t\tconst [currentPath, ...remainingPath] = pathToProperty;\n\t\tif (remainingPath.length > 0) {\n\t\t\tobject[currentPath] = this.recursiveUpdate(object[currentPath], remainingPath);\n\t\t} else {\n\t\t\tobject[currentPath] =\n\t\t\t\tobject[currentPath]?.filter(\n\t\t\t\t\t(option) =>\n\t\t\t\t\t\t!this.loadedOptions.some(\n\t\t\t\t\t\t\t(loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]\n\t\t\t\t\t\t)\n\t\t\t\t) ?? [];\n\t\t}\n\t\treturn object;\n\t};\n\n\t/**\n\t * Generates an HTML option element based on the provided item.\n\t * @param {object} item The item to generate the option element for.\n\t * @returns {HTMLElement} The generated option element.\n\t */\n\thtmlItem = (item) => {\n\t\tlet option = document.createElement('wje-option');\n\n\t\tif (item[this.itemValue] === null || item[this.itemValue] === undefined) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemValue}`);\n\t\t}\n\n\t\tif (item[this.itemText] === null || item[this.itemText] === undefined) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemText}`);\n\t\t}\n\n\t\toption.setAttribute('value', item[this.itemValue] ?? '');\n\t\toption.innerText = item[this.itemText] ?? '';\n\n\t\treturn option;\n\t};\n\n\t/**\n\t * Fetches the pages from the provided URL.\n\t * @param {number} page The page number to fetch.\n\t * @returns {Promise<object>} The fetched data.\n\t * @throws Will throw an error if the response is not ok.\n\t */\n\tasync getPages(page) {\n\t\tconst response = await fetch(this.url);\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`An error occurred: ${response.status}`);\n\t\t}\n\t\treturn await response.json();\n\t}\n\n\t/**\n\t * Finds the selected option data based on the given selected option values.\n\t * @param {Array} selectedOptionValues The array of selected option values.\n\t * @returns {Array} - The array of option data that matches the selected option values.\n\t */\n\tfindSelectedOptionData(selectedOptionValues = []) {\n\t\treturn this.options.filter((option) => selectedOptionValues.includes(option[this.itemValue]));\n\t}\n\n\t/**\n\t * Adds an option to the element.\n\t * @param {object} optionData The data of the option to be added.\n\t */\n\taddOption(optionData) {\n\t\tif (this.loadedOptions.some((option) => option[this.itemValue] === optionData[this.itemValue])) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst item = this.htmlItem(optionData);\n\t\tthis.#drawPreloadedElements.push(item);\n\t\tthis.prepend(item);\n\t\tthis.loadedOptions.push(optionData);\n\t}\n\n\t/**\n\t * Adds options to the element.\n\t * @param {Array} optionsData The array of option data to be added.\n\t * @param {boolean} [silent] Whether to suppress events triggered by adding options.\n\t */\n\taddOptions(optionsData = [], silent = false) {\n\t\tif (Array.isArray(optionsData)) optionsData?.forEach((od) => this.addOption(od, silent));\n\t\telse this.addOption(optionsData, silent);\n\t}\n\n\tbeforeDisconnect() {\n\t\tevent.removeListener(this.infiniteScroll, 'wje-infinite-scroll:load', null, this.dispatchOptionsLoadEvent);\n\t}\n}\n","import Options from './options.element.js';\n\nexport default Options;\n\nOptions.define('wje-options', Options);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAee,MAAM,gBAAgB,UAAU;AAAA,EAM9C,cAAc;AACb,UAAK;AALN,uCAAiB,CAAA;AAEjB,+CAAyB,CAAA;AAMzB,wCAAe;AAAA,MACd,cAAc;AAAA,MACd,uBAAuB;AAAA,MACvB,YAAY;AAAA,IACd;AAqOC,qCAAY;AAmHZ,oDAA2B,CAAC,MAAM;AAEjC,4BAAsB,MAAM;AAC3B,8BAAsB,MAAM;AAC3B,gBAAM,oBAAoB,MAAM,oBAAoB,CAAA,CAAE;AAAA,QACvD,CAAC;AAAA,MACF,CAAC;AAAA,IACF;AAqCA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2CAAkB,CAAC,QAAQ,mBAAmB;;AAC7C,UAAI,eAAe,WAAW,GAAG;AAChC,YAAI,MAAM,QAAQ,MAAM,GAAG;AAC1B,iBAAO,OAAO;AAAA,YACb,CAAC,WACA,CAAC,KAAK,cAAc;AAAA,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