wj-elements 0.4.2 → 0.4.4

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.
Files changed (41) hide show
  1. package/dist/base-path.js.map +1 -1
  2. package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +2 -2
  3. package/dist/packages/wje-avatar/service/service.d.ts +0 -1
  4. package/dist/packages/wje-breadcrumb/breadcrumb.element.d.ts +1 -2
  5. package/dist/packages/wje-button/button.element.d.ts +4 -0
  6. package/dist/packages/wje-carousel/carousel.element.d.ts +6 -6
  7. package/dist/packages/wje-copy-button/copy-button.element.d.ts +5 -3
  8. package/dist/packages/wje-element/element.d.ts +1 -1
  9. package/dist/packages/wje-input/input.element.d.ts +1 -0
  10. package/dist/{popup.element-DklicGea.js → popup.element-C8-g3WLs.js} +3 -3
  11. package/dist/{popup.element-DklicGea.js.map → popup.element-C8-g3WLs.js.map} +1 -1
  12. package/dist/wje-accordion-item.js.map +1 -1
  13. package/dist/wje-avatar.js.map +1 -1
  14. package/dist/wje-breadcrumb.js +0 -1
  15. package/dist/wje-breadcrumb.js.map +1 -1
  16. package/dist/wje-button.js +19 -19
  17. package/dist/wje-button.js.map +1 -1
  18. package/dist/wje-carousel.js +6 -6
  19. package/dist/wje-carousel.js.map +1 -1
  20. package/dist/wje-copy-button.js +21 -12
  21. package/dist/wje-copy-button.js.map +1 -1
  22. package/dist/wje-dropdown.js +1 -1
  23. package/dist/wje-element.js +1 -1
  24. package/dist/wje-element.js.map +1 -1
  25. package/dist/wje-file-upload.js +0 -1
  26. package/dist/wje-file-upload.js.map +1 -1
  27. package/dist/wje-input.js +50 -6
  28. package/dist/wje-input.js.map +1 -1
  29. package/dist/wje-master.js +1 -1
  30. package/dist/wje-options.js +15 -2
  31. package/dist/wje-options.js.map +1 -1
  32. package/dist/wje-popup.js +1 -1
  33. package/dist/wje-select.js +14 -3
  34. package/dist/wje-select.js.map +1 -1
  35. package/dist/wje-tab-group.js +9 -2
  36. package/dist/wje-tab-group.js.map +1 -1
  37. package/dist/wje-tab.js.map +1 -1
  38. package/dist/wje-tooltip.js +1 -1
  39. package/package.json +5 -4
  40. package/dist/custom-elements.json +0 -21140
  41. package/dist/web-types.json +0 -3842
@@ -1 +1 @@
1
- {"version":3,"file":"wje-accordion-item.js","sources":["../packages/wje-accordion-item/accordion-item.element.js","../packages/wje-accordion-item/accordion-item.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents an Accordion Item element, extending the WJElement class.\n * @documentation https://elements.webjet.sk/components/accordion-item\n * @status stable\n * @augments WJElement\n * @attribute {string} color - Applies a contextual color variant such as `primary`, `success`, `danger`, `warning`, `info`, or `complete`.\n * @slot headline - Slot for the clickable accordion headline content.\n * @slot description - Slot for supporting text shown below the headline.\n * @slot toggle - Slot for a custom toggle icon or toggle content.\n * @slot content - Slot for the expandable panel body.\n * @csspart native - The wrapper of the whole accordion item.\n * @csspart headline - The clickable headline area.\n * @csspart description - The description slot container inside the headline.\n * @csspart toggle - The toggle slot container and fallback chevron area.\n * @csspart content - The expandable content panel.\n * @cssproperty [--wje-accordion-background=var(--wje-color-contrast-0)] - Background color of the collapsed item wrapper.\n * @cssproperty [--wje-accordion-border=var(--wje-color-contrast-0)] - Border color of the collapsed item wrapper.\n * @cssproperty [--wje-accordion-border-radius=var(--wje-border-radius-large)] - Border radius of the item wrapper.\n * @cssproperty [--wje-accordion-background-hover=var(--wje-color-contrast-1)] - Background color used when the headline is hovered.\n * @cssproperty [--wje-accordion-border-hover=var(--wje-color-contrast-2)] - Border color used when the headline is hovered.\n * @cssproperty [--wje-accordion-background-expanded=var(--wje-color-contrast-0)] - Background color of the expanded item wrapper.\n * @cssproperty [--wje-accordion-border-expanded=var(--wje-color-contrast-0)] - Border color of the expanded item wrapper.\n * @cssproperty [--wje-accordion-headline-color=var(--wje-color-contrast-11)] - Text color of the headline area.\n * @cssproperty [--wje-accordion-content-color=var(--wje-color-contrast-6)] - Text color of the expandable content area.\n * @cssproperty [--wje-accordion-marker-rotate=0deg] - Rotation applied to the toggle marker icon.\n * @fires wje-accordion-item:open - Dispatched when the item is expanded.\n * @fires wje-accordion-item:close - Dispatched when the item is collapsed.\n * @tag wje-accordion-item\n */\nexport default class AccordionItem extends WJElement {\n static _instanceId = 0;\n /**\n * Constructor for the AccordionItem class.\n */\n constructor() {\n super();\n this._instanceId = ++AccordionItem._instanceId;\n }\n\n /**\n * The class name for the Accordion Item element.\n * @type {string}\n */\n className = 'AccordionItem';\n\n /**\n * Getter for the CSS stylesheet.\n * @returns {object} The styles for the Accordion Item element.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observed attributes.\n * @returns {Array} An array containing the name of the observed attribute.\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Method to setup attributes for the Accordion Item element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Method to draw the Accordion Item element. This method returns a document fragment containing the drawn element.\n * @returns {object} The document fragment containing the drawn element.\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-accordion-item');\n\n let headline = document.createElement('div');\n headline.setAttribute('part', 'headline');\n headline.classList.add('headline');\n const baseId = this.id || `wje-accordion-item-${this._instanceId}`;\n headline.id = `${baseId}-header`;\n\n let headlineDescription = document.createElement('slot');\n headlineDescription.setAttribute('part', 'description');\n headlineDescription.setAttribute('name', 'description');\n\n let slotHeadline = document.createElement('slot');\n slotHeadline.setAttribute('name', 'headline');\n\n let toggle = document.createElement('slot');\n toggle.setAttribute('part', 'toggle');\n toggle.setAttribute('name', 'toggle');\n\n let mark = document.createElement('wje-icon');\n mark.setAttribute('name', 'chevron-down');\n\n let content = document.createElement('div');\n content.setAttribute('part', 'content');\n content.setAttribute('id', `${baseId}-panel`);\n content.setAttribute('role', 'region');\n content.setAttribute('aria-labelledby', headline.id);\n\n let slot = document.createElement('slot');\n slot.setAttribute('name', 'content');\n\n toggle.appendChild(mark);\n\n headline.appendChild(slotHeadline);\n headline.appendChild(toggle);\n headline.appendChild(headlineDescription);\n\n content.appendChild(slot);\n\n native.appendChild(headline);\n native.appendChild(content);\n\n fragment.appendChild(native);\n\n this.headline = headline;\n this.toggle = toggle;\n this.content = content;\n\n return fragment;\n }\n\n /**\n * Method to execute after the Accordion Item element is drawn.\n */\n afterDraw() {\n if (!this.classList.contains('expanded')) this.classList.add('collapsed');\n\n this.headline.setAttribute('role', 'button');\n this.headline.setAttribute('tabindex', '0');\n this.headline.setAttribute('aria-controls', this.content.id);\n this.headline.setAttribute('aria-expanded', this.classList.contains('expanded') ? 'true' : 'false');\n\n this.headline.addEventListener('click', () => {\n if (this.classList.contains('collapsed')) {\n event.dispatchCustomEvent(this, 'wje-accordion-item:open');\n this.toggle.style.setProperty('--wje-accordion-marker-rotate', '180deg');\n this.expand();\n } else {\n event.dispatchCustomEvent(this, 'wje-accordion-item:close');\n this.toggle.style.setProperty('--wje-accordion-marker-rotate', '0deg');\n this.collapse();\n }\n });\n\n this.headline.addEventListener('keydown', (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.headline.click();\n }\n });\n }\n\n /**\n * Collapses the accordion item and updates the headline ARIA state.\n */\n collapse() {\n this.classList.remove('expanded');\n this.classList.add('collapsed');\n this.headline?.setAttribute('aria-expanded', 'false');\n }\n\n /**\n * Expands the accordion item and updates the headline ARIA state.\n */\n expand() {\n this.classList.remove('collapsed');\n this.classList.add('expanded');\n this.headline?.setAttribute('aria-expanded', 'true');\n }\n}\n","import AccordionItem from './accordion-item.element.js';\n\nexport default AccordionItem;\n\nAccordionItem.define('wje-accordion-item', AccordionItem);\n"],"names":[],"mappings":";;;;;;AAgCe,MAAM,iBAAN,MAAM,uBAAsB,UAAU;AAAA;AAAA;AAAA;AAAA,EAKjD,cAAc;AACV,UAAK;AAQT;AAAA;AAAA;AAAA;AAAA,qCAAY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AA,EACjD;AAAA;AAAA;AAAA;AAAA,EAKA,SAAS;;AACL,SAAK,UAAU,OAAO,WAAW;AACjC,SAAK,UAAU,IAAI,UAAU;AAC7B,eAAK,aAAL,mBAAe,aAAa,iBAAiB;AAAA,EACjD;AACJ;AAlJI,cADiB,gBACV,eAAc;AADV,IAAM,gBAAN;AC5Bf,cAAc,OAAO,sBAAsB,aAAa;"}
1
+ {"version":3,"file":"wje-accordion-item.js","sources":["../packages/wje-accordion-item/accordion-item.element.js","../packages/wje-accordion-item/accordion-item.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents an Accordion Item element, extending the WJElement class.\n * @documentation https://elements.webjet.sk/components/accordion-item\n * @status stable\n * @augments WJElement\n * @attribute {string} color - Applies a contextual color variant such as `primary`, `success`, `danger`, `warning`, `info`, or `complete`.\n * @slot headline - Slot for the clickable accordion headline content.\n * @slot description - Slot for supporting text shown below the headline.\n * @slot toggle - Slot for a custom toggle icon or toggle content.\n * @slot content - Slot for the expandable panel body.\n * @csspart native - The wrapper of the whole accordion item.\n * @csspart headline - The clickable headline area.\n * @csspart description - The description slot container inside the headline.\n * @csspart toggle - The toggle slot container and fallback chevron area.\n * @csspart content - The expandable content panel.\n * @cssproperty [--wje-accordion-background=var(--wje-color-contrast-0)] - Background color of the collapsed item wrapper.\n * @cssproperty [--wje-accordion-border=var(--wje-color-contrast-0)] - Border color of the collapsed item wrapper.\n * @cssproperty [--wje-accordion-border-radius=var(--wje-border-radius-large)] - Border radius of the item wrapper.\n * @cssproperty [--wje-accordion-background-hover=var(--wje-color-contrast-1)] - Background color used when the headline is hovered.\n * @cssproperty [--wje-accordion-border-hover=var(--wje-color-contrast-2)] - Border color used when the headline is hovered.\n * @cssproperty [--wje-accordion-background-expanded=var(--wje-color-contrast-0)] - Background color of the expanded item wrapper.\n * @cssproperty [--wje-accordion-border-expanded=var(--wje-color-contrast-0)] - Border color of the expanded item wrapper.\n * @cssproperty [--wje-accordion-headline-color=var(--wje-color-contrast-11)] - Text color of the headline area.\n * @cssproperty [--wje-accordion-content-color=var(--wje-color-contrast-6)] - Text color of the expandable content area.\n * @cssproperty [--wje-accordion-marker-rotate=0deg] - Rotation applied to the toggle marker icon.\n * // @fires wje-accordion-item:open - Dispatched when the item is expanded.\n * // @fires wje-accordion-item:close - Dispatched when the item is collapsed.\n * @tag wje-accordion-item\n */\nexport default class AccordionItem extends WJElement {\n static _instanceId = 0;\n /**\n * Constructor for the AccordionItem class.\n */\n constructor() {\n super();\n this._instanceId = ++AccordionItem._instanceId;\n }\n\n /**\n * The class name for the Accordion Item element.\n * @type {string}\n */\n className = 'AccordionItem';\n\n /**\n * Getter for the CSS stylesheet.\n * @returns {object} The styles for the Accordion Item element.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observed attributes.\n * @returns {Array} An array containing the name of the observed attribute.\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Method to setup attributes for the Accordion Item element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Method to draw the Accordion Item element. This method returns a document fragment containing the drawn element.\n * @returns {object} The document fragment containing the drawn element.\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-accordion-item');\n\n let headline = document.createElement('div');\n headline.setAttribute('part', 'headline');\n headline.classList.add('headline');\n const baseId = this.id || `wje-accordion-item-${this._instanceId}`;\n headline.id = `${baseId}-header`;\n\n let headlineDescription = document.createElement('slot');\n headlineDescription.setAttribute('part', 'description');\n headlineDescription.setAttribute('name', 'description');\n\n let slotHeadline = document.createElement('slot');\n slotHeadline.setAttribute('name', 'headline');\n\n let toggle = document.createElement('slot');\n toggle.setAttribute('part', 'toggle');\n toggle.setAttribute('name', 'toggle');\n\n let mark = document.createElement('wje-icon');\n mark.setAttribute('name', 'chevron-down');\n\n let content = document.createElement('div');\n content.setAttribute('part', 'content');\n content.setAttribute('id', `${baseId}-panel`);\n content.setAttribute('role', 'region');\n content.setAttribute('aria-labelledby', headline.id);\n\n let slot = document.createElement('slot');\n slot.setAttribute('name', 'content');\n\n toggle.appendChild(mark);\n\n headline.appendChild(slotHeadline);\n headline.appendChild(toggle);\n headline.appendChild(headlineDescription);\n\n content.appendChild(slot);\n\n native.appendChild(headline);\n native.appendChild(content);\n\n fragment.appendChild(native);\n\n this.headline = headline;\n this.toggle = toggle;\n this.content = content;\n\n return fragment;\n }\n\n /**\n * Method to execute after the Accordion Item element is drawn.\n */\n afterDraw() {\n if (!this.classList.contains('expanded')) this.classList.add('collapsed');\n\n this.headline.setAttribute('role', 'button');\n this.headline.setAttribute('tabindex', '0');\n this.headline.setAttribute('aria-controls', this.content.id);\n this.headline.setAttribute('aria-expanded', this.classList.contains('expanded') ? 'true' : 'false');\n\n this.headline.addEventListener('click', () => {\n if (this.classList.contains('collapsed')) {\n event.dispatchCustomEvent(this, 'wje-accordion-item:open');\n this.toggle.style.setProperty('--wje-accordion-marker-rotate', '180deg');\n this.expand();\n } else {\n event.dispatchCustomEvent(this, 'wje-accordion-item:close');\n this.toggle.style.setProperty('--wje-accordion-marker-rotate', '0deg');\n this.collapse();\n }\n });\n\n this.headline.addEventListener('keydown', (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n this.headline.click();\n }\n });\n }\n\n /**\n * Collapses the accordion item and updates the headline ARIA state.\n */\n collapse() {\n this.classList.remove('expanded');\n this.classList.add('collapsed');\n this.headline?.setAttribute('aria-expanded', 'false');\n }\n\n /**\n * Expands the accordion item and updates the headline ARIA state.\n */\n expand() {\n this.classList.remove('collapsed');\n this.classList.add('expanded');\n this.headline?.setAttribute('aria-expanded', 'true');\n }\n}\n","import AccordionItem from './accordion-item.element.js';\n\nexport default AccordionItem;\n\nAccordionItem.define('wje-accordion-item', AccordionItem);\n"],"names":[],"mappings":";;;;;;AAgCe,MAAM,iBAAN,MAAM,uBAAsB,UAAU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OAAO,UAAU;AAChC,SAAK,UAAU,IAAI,WAAW;AAC9B,eAAK,aAAL,mBAAe,aAAa,iBAAiB;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA,EAKA,SAAS;;AACL,SAAK,UAAU,OAAO,WAAW;AACjC,SAAK,UAAU,IAAI,UAAU;AAC7B,eAAK,aAAL,mBAAe,aAAa,iBAAiB;AAAA,EACjD;AACJ;AAlJI,cADiB,gBACV,eAAc;AADV,IAAM,gBAAN;AC5Bf,cAAc,OAAO,sBAAsB,aAAa;"}
@@ -1 +1 @@
1
- {"version":3,"file":"wje-avatar.js","sources":["../packages/wje-avatar/service/service.js","../packages/wje-avatar/avatar.element.js","../packages/wje-avatar/avatar.js"],"sourcesContent":["/**\n * Generates an HSL color value based on the input text.\n * @param {string} text The input text to generate the HSL color.\n * @param {number} [s] The saturation value (in percentage) for the HSL color.\n * @param {number} [l] The lightness value (in percentage) for the HSL color.\n * @returns {string} - The HSL color string in the format `hsl(h, s%, l%)`.\n * @description\n * This function computes a hash from the input text and uses it to generate\n * a hue value. The hue is combined with the provided saturation and lightness\n * values to create an HSL color. This can be useful for consistently assigning\n * colors based on text input, such as for avatars or tags.\n * @example\n * // Returns 'hsl(180, 40%, 65%)'\n * getHsl('example');\n * @example\n * // Returns 'hsl(300, 50%, 70%)'\n * getHsl('test', 50, 70);\n */\nexport function getHsl(text, s = 40, l = 75) {\n let str = text;\n let hash = 0;\n\n for (let i = 0; i < str?.length; i++) {\n hash = str.charCodeAt(i) + hash * 31;\n }\n\n let h = hash % 360;\n\n return `hsl(${h}, ${s}%, ${l}%)`;\n}\n\n/**\n * Generates background and text HSL colors for avatars based on input text.\n * The text color is a darker, more saturated variant of the background color\n * to ensure sufficient contrast while keeping the same hue.\n *\n * @param {string} text The input text (e.g. initials or name).\n * @returns {{ background: string, color: string }}\n */\nexport function getAvatarColors(text) {\n let hash = 0;\n for (let i = 0; i < text?.length; i++) {\n hash = text.charCodeAt(i) + hash * 31;\n }\n\n const h = Math.abs(hash) % 360;\n\n // 👇 Figma-like pastel background\n const bgS = 30;\n const bgL = 88;\n\n // 👇 Softer text color (same hue)\n const textS = 50;\n const textL = 48;\n\n return {\n background: `hsl(${h}, ${bgS}%, ${bgL}%)`,\n color: `hsl(${h}, ${textS}%, ${textL}%)`\n };\n}\n\n/**\n * Generates initials from a given string.\n * @param {string} string The input string, typically a full name.\n * @param {number} [length] The desired number of initials (default is 2).\n * @returns {string} - The generated initials in uppercase.\n * @description\n * This function takes a string, splits it by spaces, and generates initials.\n * It always includes the first character of the first word. If the input string\n * contains more than one word and the `length` parameter is greater than 1, it\n * also includes the first character of the last word.\n * @example\n * // Returns 'JD'\n * getInitials('John Doe');\n * @example\n * // Returns 'J'\n * getInitials('John');\n * @example\n * // Returns 'JM'\n * getInitials('John Michael Doe', 2);\n */\nexport function getInitials(string, length = 2) {\n let names = string.split(' ');\n let initials = names[0].substring(0, 1).toUpperCase();\n\n if (names.length > 1 && length > 1) {\n initials += names[names.length - 1].substring(0, 1).toUpperCase();\n }\n return initials;\n}\n","import { default as WJElement } from '../wje-element/element.js';\nimport { getHsl, getInitials, getAvatarColors } from './service/service.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents an Avatar element, extending the WJElement class.\n * @documentation https://elements.webjet.sk/components/avatar\n * @status stable\n * @augments WJElement\n * @attribute {boolean} initials - Renders generated initials from `label` instead of the default slotted content.\n * @attribute {string} label - Provides the source text for generated initials and the accessible label of the avatar.\n * @attribute {string} size - Selects a predefined avatar size such as `small`, `medium`, `normal`, `large`, or larger variants.\n * @attribute {string} status-placement - Positions the `status` slot on one of the avatar corners.\n * @slot default - Slot for the main avatar content, typically an image.\n * @slot icon - Slot for an icon rendered inside the avatar.\n * @slot status - Slot for a status badge or indicator positioned on the avatar edge.\n * @slot secondary - Slot for additional secondary content rendered with the avatar.\n * @csspart native - The component's native wrapper.\n * @csspart status - The positioned slot container for status content.\n * @csspart secondary - The slot container for secondary avatar content.\n * @cssproperty [--wje-avatar-size] - Controls the overall rendered size of the avatar shell.\n * @cssproperty [--wje-avatar-font-size] - Controls the font size used for initials and text content.\n * @cssproperty [--wje-avatar-font-weight] - Controls the font weight used for initials and text content.\n * @cssproperty [--wje-avatar-color] - Controls the text color inside the avatar.\n * @cssproperty [--wje-avatar-background-color] - Controls the background color of the avatar surface.\n * @cssproperty [--wje-avatar-border-radius] - Controls the avatar border radius.\n * @cssproperty [--wje-avatar-border-color] - Controls the avatar border color when a border is applied.\n * @cssproperty [--wje-avatar-border-width] - Controls the avatar border width when a border is applied.\n * @cssproperty [--wje-avatar-border-style] - Controls the avatar border style when a border is applied.\n * @tag wje-avatar\n */\nexport default class Avatar extends WJElement {\n /**\n * Avatar class constructor.\n */\n constructor() {\n super();\n }\n\n /**\n * Sets the value of the 'label' attribute for the element.\n * @param {string} value The new value to be set for the 'label' attribute.\n */\n set label(value) {\n this.setAttribute('label', value);\n }\n\n /**\n * Retrieves the value of the 'label' attribute for the element.\n * If the attribute is not set, it defaults to an empty string.\n * @returns {string} The value of the 'label' attribute or an empty string if not defined.\n */\n get label() {\n return this.getAttribute('label') || '';\n }\n\n /**\n * Sets the value of initials for the element by updating\n * the 'initials' attribute with the provided value.\n * @param {string} value The value to be set as the initials.\n */\n set initials(value) {\n this.setAttribute('initials', '');\n }\n\n /**\n * Retrieves the value of the 'initials' attribute if it exists.\n * @returns {boolean} Returns true if the 'initials' attribute is present, otherwise false.\n */\n get initials() {\n return this.hasAttribute('initials') || false;\n }\n\n /**\n * Sets the size attribute for the element.\n * @param {string | number} value The value to set for the size attribute.\n */\n set size(value) {\n this.setAttribute('size', value);\n }\n\n /**\n * Retrieves the size attribute of the element. If the size attribute\n * is not defined, it returns the default value 'medium'.\n * @returns {string} The size value of the element or 'medium' if not specified.\n */\n get size() {\n return this.getAttribute('size') || 'medium';\n }\n\n /**\n * Class name for the Avatar element.\n */\n className = 'Avatar';\n\n /**\n * Getter for cssStyleSheet.\n * @returns {string} styles\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 ['initials', 'label'];\n }\n\n /**\n * Method to setup attributes.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n if (name === 'label' || name === 'initials') {\n this.syncAria();\n }\n }\n\n /**\n * Method to draw the avatar element and return a document fragment.\n * @returns {object} fragment - The document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let element = document.createElement('div');\n element.setAttribute('part', 'native');\n element.classList.add('native-avatar');\n\n let slot = document.createElement('slot');\n\n element.appendChild(slot);\n\n if (this.initials) {\n let initials = getInitials(this.label);\n const { background, color } = getAvatarColors(initials);\n\n this.style.setProperty('--wje-avatar-background-color', background);\n this.style.setProperty('--wje-avatar-color', color);\n\n element.innerText = initials;\n } else {\n let slotIcon = document.createElement('slot');\n slotIcon.setAttribute('name', 'icon');\n\n element.appendChild(slotIcon);\n }\n\n let status = document.createElement('slot');\n status.setAttribute('name', 'status');\n status.setAttribute('part', 'status');\n\n let secondary = document.createElement('slot');\n secondary.setAttribute('name', 'secondary');\n secondary.setAttribute('part', 'secondary');\n\n element.appendChild(status);\n element.appendChild(secondary);\n\n fragment.appendChild(element);\n\n return fragment;\n }\n\n /**\n * Syncs ARIA attributes on the host element.\n */\n syncAria() {\n const label = this.label?.trim();\n if (label) {\n this.setAriaState({ label });\n }\n }\n\n /**\n * Method to check if the avatar is an image.\n * @returns {boolean} - True if the avatar is an image, false otherwise\n */\n isImage() {\n return this.getElementsByTagName('wje-img').length > 0;\n }\n}\n","import Avatar from './avatar.element.js';\n\nexport default Avatar;\n\nAvatar.define('wje-avatar', Avatar);\n"],"names":[],"mappings":";;;;AAuCO,SAAS,gBAAgB,MAAM;AAClC,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,KAAI,6BAAM,SAAQ,KA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AAQ,WAAW;AAC1C,cAAU,aAAa,QAAQ,WAAW;AAE1C,YAAQ,YAAY,MAAM;AAC1B,YAAQ,YAAY,SAAS;AAE7B,aAAS,YAAY,OAAO;AAE5B,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,WAAW;;AACP,UAAM,SAAQ,UAAK,UAAL,mBAAY;AAC1B,QAAI,OAAO;AACP,WAAK,aAAa,EAAE,OAAO;AAAA,IAC/B;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU;AACN,WAAO,KAAK,qBAAqB,SAAS,EAAE,SAAS;AAAA,EACzD;AACJ;AC1LA,OAAO,OAAO,cAAc,MAAM;"}
1
+ {"version":3,"file":"wje-avatar.js","sources":["../packages/wje-avatar/service/service.js","../packages/wje-avatar/avatar.element.js","../packages/wje-avatar/avatar.js"],"sourcesContent":["/**\n * Generates an HSL color value based on the input text.\n * @param {string} text The input text to generate the HSL color.\n * @param {number} [s] The saturation value (in percentage) for the HSL color.\n * @param {number} [l] The lightness value (in percentage) for the HSL color.\n * @returns {string} - The HSL color string in the format `hsl(h, s%, l%)`.\n * @description\n * This function computes a hash from the input text and uses it to generate\n * a hue value. The hue is combined with the provided saturation and lightness\n * values to create an HSL color. This can be useful for consistently assigning\n * colors based on text input, such as for avatars or tags.\n * @example\n * // Returns 'hsl(180, 40%, 65%)'\n * getHsl('example');\n * @example\n * // Returns 'hsl(300, 50%, 70%)'\n * getHsl('test', 50, 70);\n */\nexport function getHsl(text, s = 40, l = 75) {\n let str = text;\n let hash = 0;\n\n for (let i = 0; i < str?.length; i++) {\n hash = str.charCodeAt(i) + hash * 31;\n }\n\n let h = hash % 360;\n\n return `hsl(${h}, ${s}%, ${l}%)`;\n}\n\n/**\n * Generates background and text HSL colors for avatars based on input text.\n * The text color is a darker, more saturated variant of the background color\n * to ensure sufficient contrast while keeping the same hue.\n * @param {string} text The input text (e.g. initials or name).\n * @returns {{ background: string, color: string }}\n */\nexport function getAvatarColors(text) {\n let hash = 0;\n for (let i = 0; i < text?.length; i++) {\n hash = text.charCodeAt(i) + hash * 31;\n }\n\n const h = Math.abs(hash) % 360;\n\n // 👇 Figma-like pastel background\n const bgS = 30;\n const bgL = 88;\n\n // 👇 Softer text color (same hue)\n const textS = 50;\n const textL = 48;\n\n return {\n background: `hsl(${h}, ${bgS}%, ${bgL}%)`,\n color: `hsl(${h}, ${textS}%, ${textL}%)`\n };\n}\n\n/**\n * Generates initials from a given string.\n * @param {string} string The input string, typically a full name.\n * @param {number} [length] The desired number of initials (default is 2).\n * @returns {string} - The generated initials in uppercase.\n * @description\n * This function takes a string, splits it by spaces, and generates initials.\n * It always includes the first character of the first word. If the input string\n * contains more than one word and the `length` parameter is greater than 1, it\n * also includes the first character of the last word.\n * @example\n * // Returns 'JD'\n * getInitials('John Doe');\n * @example\n * // Returns 'J'\n * getInitials('John');\n * @example\n * // Returns 'JM'\n * getInitials('John Michael Doe', 2);\n */\nexport function getInitials(string, length = 2) {\n let names = string.split(' ');\n let initials = names[0].substring(0, 1).toUpperCase();\n\n if (names.length > 1 && length > 1) {\n initials += names[names.length - 1].substring(0, 1).toUpperCase();\n }\n return initials;\n}\n","import { default as WJElement } from '../wje-element/element.js';\nimport { getHsl, getInitials, getAvatarColors } from './service/service.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents an Avatar element, extending the WJElement class.\n * @documentation https://elements.webjet.sk/components/avatar\n * @status stable\n * @augments WJElement\n * @attribute {boolean} initials - Renders generated initials from `label` instead of the default slotted content.\n * @attribute {string} label - Provides the source text for generated initials and the accessible label of the avatar.\n * @attribute {string} size - Selects a predefined avatar size such as `small`, `medium`, `normal`, `large`, or larger variants.\n * @attribute {string} status-placement - Positions the `status` slot on one of the avatar corners.\n * @slot default - Slot for the main avatar content, typically an image.\n * @slot icon - Slot for an icon rendered inside the avatar.\n * @slot status - Slot for a status badge or indicator positioned on the avatar edge.\n * @slot secondary - Slot for additional secondary content rendered with the avatar.\n * @csspart native - The component's native wrapper.\n * @csspart status - The positioned slot container for status content.\n * @csspart secondary - The slot container for secondary avatar content.\n * @cssproperty [--wje-avatar-size] - Controls the overall rendered size of the avatar shell.\n * @cssproperty [--wje-avatar-font-size] - Controls the font size used for initials and text content.\n * @cssproperty [--wje-avatar-font-weight] - Controls the font weight used for initials and text content.\n * @cssproperty [--wje-avatar-color] - Controls the text color inside the avatar.\n * @cssproperty [--wje-avatar-background-color] - Controls the background color of the avatar surface.\n * @cssproperty [--wje-avatar-border-radius] - Controls the avatar border radius.\n * @cssproperty [--wje-avatar-border-color] - Controls the avatar border color when a border is applied.\n * @cssproperty [--wje-avatar-border-width] - Controls the avatar border width when a border is applied.\n * @cssproperty [--wje-avatar-border-style] - Controls the avatar border style when a border is applied.\n * @tag wje-avatar\n */\nexport default class Avatar extends WJElement {\n /**\n * Avatar class constructor.\n */\n constructor() {\n super();\n }\n\n /**\n * Sets the value of the 'label' attribute for the element.\n * @param {string} value The new value to be set for the 'label' attribute.\n */\n set label(value) {\n this.setAttribute('label', value);\n }\n\n /**\n * Retrieves the value of the 'label' attribute for the element.\n * If the attribute is not set, it defaults to an empty string.\n * @returns {string} The value of the 'label' attribute or an empty string if not defined.\n */\n get label() {\n return this.getAttribute('label') || '';\n }\n\n /**\n * Sets the value of initials for the element by updating\n * the 'initials' attribute with the provided value.\n * @param {string} value The value to be set as the initials.\n */\n set initials(value) {\n this.setAttribute('initials', '');\n }\n\n /**\n * Retrieves the value of the 'initials' attribute if it exists.\n * @returns {boolean} Returns true if the 'initials' attribute is present, otherwise false.\n */\n get initials() {\n return this.hasAttribute('initials') || false;\n }\n\n /**\n * Sets the size attribute for the element.\n * @param {string | number} value The value to set for the size attribute.\n */\n set size(value) {\n this.setAttribute('size', value);\n }\n\n /**\n * Retrieves the size attribute of the element. If the size attribute\n * is not defined, it returns the default value 'medium'.\n * @returns {string} The size value of the element or 'medium' if not specified.\n */\n get size() {\n return this.getAttribute('size') || 'medium';\n }\n\n /**\n * Class name for the Avatar element.\n */\n className = 'Avatar';\n\n /**\n * Getter for cssStyleSheet.\n * @returns {string} styles\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 ['initials', 'label'];\n }\n\n /**\n * Method to setup attributes.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n if (name === 'label' || name === 'initials') {\n this.syncAria();\n }\n }\n\n /**\n * Method to draw the avatar element and return a document fragment.\n * @returns {object} fragment - The document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let element = document.createElement('div');\n element.setAttribute('part', 'native');\n element.classList.add('native-avatar');\n\n let slot = document.createElement('slot');\n\n element.appendChild(slot);\n\n if (this.initials) {\n let initials = getInitials(this.label);\n const { background, color } = getAvatarColors(initials);\n\n this.style.setProperty('--wje-avatar-background-color', background);\n this.style.setProperty('--wje-avatar-color', color);\n\n element.innerText = initials;\n } else {\n let slotIcon = document.createElement('slot');\n slotIcon.setAttribute('name', 'icon');\n\n element.appendChild(slotIcon);\n }\n\n let status = document.createElement('slot');\n status.setAttribute('name', 'status');\n status.setAttribute('part', 'status');\n\n let secondary = document.createElement('slot');\n secondary.setAttribute('name', 'secondary');\n secondary.setAttribute('part', 'secondary');\n\n element.appendChild(status);\n element.appendChild(secondary);\n\n fragment.appendChild(element);\n\n return fragment;\n }\n\n /**\n * Syncs ARIA attributes on the host element.\n */\n syncAria() {\n const label = this.label?.trim();\n if (label) {\n this.setAriaState({ label });\n }\n }\n\n /**\n * Method to check if the avatar is an image.\n * @returns {boolean} - True if the avatar is an image, false otherwise\n */\n isImage() {\n return this.getElementsByTagName('wje-img').length > 0;\n }\n}\n","import Avatar from './avatar.element.js';\n\nexport default Avatar;\n\nAvatar.define('wje-avatar', Avatar);\n"],"names":[],"mappings":";;;;AAsCO,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,WAAO,aAAa,QAAQ,QAAQ;AAEpC,QAAI,YAAY,SAAS,cAAc,MAAM;AAC7C,cAAU,aAAa,QAAQ,WAAW;AAC1C,cAAU,aAAa,QAAQ,WAAW;AAE1C,YAAQ,YAAY,MAAM;AAC1B,YAAQ,YAAY,SAAS;AAE7B,aAAS,YAAY,OAAO;AAE5B,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,WAAW;;AACP,UAAM,SAAQ,UAAK,UAAL,mBAAY;AAC1B,QAAI,OAAO;AACP,WAAK,aAAa,EAAE,OAAO;AAAA,IAC/B;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU;AACN,WAAO,KAAK,qBAAqB,SAAS,EAAE,SAAS;AAAA,EACzD;AACJ;AC1LA,OAAO,OAAO,cAAc,MAAM;"}
@@ -70,7 +70,6 @@ class Breadcrumb extends WJElement {
70
70
  * @param {string} name The name of the attribute that was changed.
71
71
  * @param {string|null} oldValue The previous value of the attribute before it was changed. Null if the attribute was not previously set.
72
72
  * @param {string|null} newValue The new value of the attribute after it was changed. Null if the attribute was removed.
73
- * @returns {boolean} Returns false to signal no default behavior is implemented.
74
73
  */
75
74
  attributeChangedCallback(name, oldValue, newValue) {
76
75
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"wje-breadcrumb.js","sources":["../packages/wje-breadcrumb/breadcrumb.element.js","../packages/wje-breadcrumb/breadcrumb.js"],"sourcesContent":["import { default as WJElement, event, WjElementUtils } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents a Breadcrumb element, extending the WJElement class. It provides a navigational aid in user interfaces, displaying the current location within a hierarchy.\n * @documentation https://elements.webjet.sk/components/breadcrumb\n * @status stable\n * @augments WJElement\n * @slot - The main content of the breadcrumb.\n * @slot start - Slot for content at the start of the breadcrumb.\n * @slot end - Slot for content at the end of the breadcrumb.\n * @slot separator - Slot for a custom separator between breadcrumb items.\n * @csspart native - The native wrapper of the breadcrumb component.\n * @csspart separator - The separator between breadcrumb items.\n * @cssproperty [--wje-breadcrumb-a=var(--wje-color-contrast-8)] - The color of the breadcrumb text.\n * @cssproperty [--wje-breadcrumb-a-hover=var(--wje-color-contrast-6)] - The color of the breadcrumb separator line.\n * @tag wje-breadcrumb\n */\nexport default class Breadcrumb extends WJElement {\n /**\n * Breadcrumb constructor method.\n */\n constructor() {\n super();\n\n this._showSeparator = true;\n this._showCollapsedIndicator = false;\n }\n\n /**\n * Get show separator flag.\n * @returns {boolean} showSeparator - The show separator flag\n */\n get showSeparator() {\n return this._showSeparator;\n }\n\n /**\n * Set show separator flag.\n * @param {boolean} value The value to set\n */\n set showSeparator(value) {\n this._showSeparator = value;\n }\n\n /**\n * Set collapsed variant.\n * @param {string} value The value to set\n */\n set collapsedVariant(value) {\n this._collapsedVariant = value;\n }\n\n /**\n * Get collapsed variant.\n * @returns {string} The collapsed variant value in uppercase.\n */\n get collapsedVariant() {\n let variant = this.parentElement?.variant || this._collapsedVariant;\n return variant.toUpperCase();\n }\n\n /**\n * Class name for the Breadcrumb element.\n * @type {string}\n */\n className = 'Breadcrumb';\n\n /**\n * Get CSS stylesheet for the Breadcrumb element.\n * @static\n * @returns {object} styles - The CSS styles\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Get observed attributes for the Breadcrumb element.\n * @static\n * @returns {Array<string>} - The observed attributes array for the Breadcrumb element.\n */\n static get observedAttributes() {\n return ['show-collapsed-indicator', 'collapsed', 'last'];\n }\n\n /**\n * Handles attribute changes for the custom element and updates its behavior or appearance accordingly.\n * @param {string} name The name of the attribute that was changed.\n * @param {string|null} oldValue The previous value of the attribute before it was changed. Null if the attribute was not previously set.\n * @param {string|null} newValue The new value of the attribute after it was changed. Null if the attribute was removed.\n * @returns {boolean} Returns false to signal no default behavior is implemented.\n */\n attributeChangedCallback(name, oldValue, newValue) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n\n if (name === 'collapsed') {\n const isCollapsed = WjElementUtils.stringToBoolean(newValue);\n\n // toggle class podľa stavu\n this.classList.toggle('collapsed', isCollapsed && !this.hasAttribute('show-collapsed-indicator'));\n\n } else if (name === 'show-collapsed-indicator') {\n const isOn = WjElementUtils.stringToBoolean(newValue);\n this._showCollapsedIndicator = isOn;\n this.refresh();\n\n } else if (name === 'last') {\n const isLast = WjElementUtils.stringToBoolean(newValue);\n this.active = isLast;\n this.showSeparator = !isLast;\n this.syncAria();\n if (this.native) {\n if (isLast) this.native.setAttribute('aria-current', 'page');\n else this.native.removeAttribute('aria-current');\n }\n this.refresh();\n }\n }\n\n /**\n * Setup attributes for the Breadcrumb element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n syncAria() {\n this.setAriaState({ role: 'link' });\n if (this.active) this.setAriaState({ current: 'page' });\n else this.removeAttribute('aria-current');\n }\n\n /**\n * Draw method for the Breadcrumb element.\n * @returns {object} fragment - The document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('a');\n native.classList.add('native-breadcrumb');\n native.setAttribute('part', 'native');\n if (this.active) native.setAttribute('aria-current', 'page');\n\n if (this.active) native.classList.add('active');\n\n let slot = document.createElement('slot');\n\n let start = document.createElement('slot');\n start.setAttribute('name', 'start');\n\n let end = document.createElement('slot');\n end.setAttribute('name', 'end');\n\n native.append(start, slot, end);\n\n // APPEND\n fragment.append(native);\n\n if (WjElementUtils.stringToBoolean(this._showCollapsedIndicator)) {\n // pridame button za native element\n fragment.append(this.drawCollapsedIndicator());\n\n // skryjeme native element\n native.classList.add('hidden');\n }\n\n if (this.showSeparator) {\n let separator = document.createElement('span');\n separator.classList.add('separator');\n separator.setAttribute('part', 'separator');\n\n if (WjElementUtils.hasSlot(this, 'separator')) {\n let slotSeparator = document.createElement('slot');\n slotSeparator.setAttribute('name', 'separator');\n\n separator.append(slotSeparator);\n } else {\n separator.innerHTML = `<wje-icon name=${this.separator || 'chevron-right'}></wje-icon>`;\n }\n\n fragment.append(separator);\n }\n\n this.native = native;\n\n return fragment;\n }\n\n /**\n * Renders the collapsed indicator based on the current collapsed variant.\n * If the collapsed variant is 'DROPDOWN', it invokes the collapseDropdown method.\n * Otherwise, it invokes the collapseButton method.\n * @returns {any} The rendered collapsed indicator, either as a dropdown or a button.\n */\n drawCollapsedIndicator() {\n let collapsedIndicator = null;\n\n if (this.collapsedVariant === 'DROPDOWN') {\n collapsedIndicator = this.collapseDropdown();\n } else {\n collapsedIndicator = this.collapseButton();\n }\n\n return collapsedIndicator;\n }\n\n /**\n * Creates and returns a dropdown UI component for collapsed breadcrumbs.\n * This method generates a dropdown element with a button trigger and a menu populated with items corresponding\n * to the collapsed breadcrumbs. The dropdown is configured to handle specific interactions and ensure that\n * events are appropriately managed to avoid propagation issues. Menu items are linked to their corresponding\n * breadcrumbs, enabling the same functionality as clicking on the original breadcrumb.\n * @returns {HTMLElement} A configured dropdown element containing a button as trigger and a menu with breadcrumb items.\n */\n collapseDropdown() {\n let dropdown = document.createElement('wje-dropdown');\n dropdown.setAttribute('placement', 'bottom');\n dropdown.setAttribute('offset', '10');\n\n let button = document.createElement('wje-button');\n button.setAttribute('slot', 'trigger');\n button.setAttribute('fill', 'link');\n button.innerHTML = `<wje-icon name=\"dots\"></wje-icon>`;\n\n let menu = document.createElement('wje-menu');\n menu.setAttribute('variant', 'context');\n\n menu.addEventListener('click', (e) => {\n e.stopPropagation();\n e.stopImmediatePropagation?.();\n });\n\n this.getBreadcrumbs().getBreadcrumbsCollapsed().forEach((b) => {\n let menuItem = document.createElement('wje-menu-item');\n menuItem.innerHTML = b.innerHTML;\n\n menuItem.__breadcrumb = b;\n\n menuItem.addEventListener('wje-menu-item:click', (e) => {\n e.preventDefault?.();\n e.stopPropagation();\n e.stopImmediatePropagation?.();\n\n const breadcrumb = e.currentTarget.__breadcrumb;\n if (!breadcrumb) return;\n\n // Prefer clicking the internal anchor (same behavior as real user click), fallback to host click.\n const native = breadcrumb.native || breadcrumb.context?.querySelector('a.native-breadcrumb');\n if (native && typeof native.click === 'function') {\n native.click();\n } else if (typeof breadcrumb.click === 'function') {\n breadcrumb.click();\n } else {\n breadcrumb.dispatchEvent(\n new MouseEvent('click', {\n bubbles: true,\n composed: true,\n cancelable: true\n })\n );\n }\n });\n\n menu.append(menuItem);\n });\n\n dropdown.append(button, menu);\n\n return dropdown;\n }\n\n /**\n * Creates a button element that expands hidden breadcrumbs when clicked.\n * The button is set with appropriate attributes and event listeners to handle\n * the expanding of hidden breadcrumb elements. Clicking the button will remove\n * the button itself, reveal hidden breadcrumbs, and stop the current event\n * propagation.\n * @returns {HTMLButtonElement} The created button configured to expand breadcrumbs.\n */\n collapseButton() {\n let button = document.createElement('button');\n button.setAttribute('aria-label', 'Show more breadcrumbs');\n button.setAttribute('part', 'collapsed-indicator');\n button.innerHTML = `<wje-icon name=\"dots\"></wje-icon>`;\n\n event.addListener(button, 'click', null, (e) => {\n this.native.classList.remove('hidden');\n button.remove();\n this.getBreadcrumbs().getBreadcrumbsCollapsed().forEach((el) => {\n el.classList.remove('collapsed');\n });\n e.stopPropagation();\n });\n\n return button;\n }\n\n /**\n * Retrieves the breadcrumb trail for the current element by returning its parent element.\n * @returns {Element} The parent element representing the breadcrumb trail.\n */\n getBreadcrumbs() {\n return this.parentElement;\n }\n}\n","import Breadcrumb from './breadcrumb.element.js';\n\n// export * from \"./breadcrumb.element.js\";\nexport default Breadcrumb;\n\nBreadcrumb.define('wje-breadcrumb', Breadcrumb);\n"],"names":[],"mappings":";;;;;;;AAkBe,MAAM,mBAAmB,UAAU;AAAA;AAAA;AAAA;AAAA,EAI9C,cAAc;AACV,UAAK;AA2CT;AAAA;AAAA;AAAA;AAAA,qCAAY;AAzCR,SAAK,iBAAiB;AACtB,SAAK,0BAA0B;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,gBAAgB;AAChB,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,cAAc,OAAO;AAC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AA,YACxC,CAAyB;AAAA,UACzB;AAAA,QACgB;AAAA,MACJ,CAAC;AAED,WAAK,OAAO,QAAQ;AAAA,IACxB,CAAC;AAED,aAAS,OAAO,QAAQ,IAAI;AAE5B,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,iBAAiB;AACb,QAAI,SAAS,SAAS,cAAc,QAAQ;AAC5C,WAAO,aAAa,cAAc,uBAAuB;AACzD,WAAO,aAAa,QAAQ,qBAAqB;AACjD,WAAO,YAAY;AAEnB,UAAM,YAAY,QAAQ,SAAS,MAAM,CAAC,MAAM;AAC5C,WAAK,OAAO,UAAU,OAAO,QAAQ;AACrC,aAAO,OAAM;AACb,WAAK,eAAc,EAAG,wBAAuB,EAAG,QAAQ,CAAC,OAAO;AAC5D,WAAG,UAAU,OAAO,WAAW;AAAA,MACnC,CAAC;AACD,QAAE,gBAAe;AAAA,IACrB,CAAC;AAED,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,iBAAiB;AACb,WAAO,KAAK;AAAA,EAChB;AACJ;AC9SA,WAAW,OAAO,kBAAkB,UAAU;"}
1
+ {"version":3,"file":"wje-breadcrumb.js","sources":["../packages/wje-breadcrumb/breadcrumb.element.js","../packages/wje-breadcrumb/breadcrumb.js"],"sourcesContent":["import { default as WJElement, event, WjElementUtils } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents a Breadcrumb element, extending the WJElement class. It provides a navigational aid in user interfaces, displaying the current location within a hierarchy.\n * @documentation https://elements.webjet.sk/components/breadcrumb\n * @status stable\n * @augments WJElement\n * @slot - The main content of the breadcrumb.\n * @slot start - Slot for content at the start of the breadcrumb.\n * @slot end - Slot for content at the end of the breadcrumb.\n * @slot separator - Slot for a custom separator between breadcrumb items.\n * @csspart native - The native wrapper of the breadcrumb component.\n * @csspart separator - The separator between breadcrumb items.\n * @cssproperty [--wje-breadcrumb-a=var(--wje-color-contrast-8)] - The color of the breadcrumb text.\n * @cssproperty [--wje-breadcrumb-a-hover=var(--wje-color-contrast-6)] - The color of the breadcrumb separator line.\n * @tag wje-breadcrumb\n */\nexport default class Breadcrumb extends WJElement {\n /**\n * Breadcrumb constructor method.\n */\n constructor() {\n super();\n\n this._showSeparator = true;\n this._showCollapsedIndicator = false;\n }\n\n /**\n * Get show separator flag.\n * @returns {boolean} showSeparator - The show separator flag\n */\n get showSeparator() {\n return this._showSeparator;\n }\n\n /**\n * Set show separator flag.\n * @param {boolean} value The value to set\n */\n set showSeparator(value) {\n this._showSeparator = value;\n }\n\n /**\n * Set collapsed variant.\n * @param {string} value The value to set\n */\n set collapsedVariant(value) {\n this._collapsedVariant = value;\n }\n\n /**\n * Get collapsed variant.\n * @returns {string} The collapsed variant value in uppercase.\n */\n get collapsedVariant() {\n let variant = this.parentElement?.variant || this._collapsedVariant;\n return variant.toUpperCase();\n }\n\n /**\n * Class name for the Breadcrumb element.\n * @type {string}\n */\n className = 'Breadcrumb';\n\n /**\n * Get CSS stylesheet for the Breadcrumb element.\n * @static\n * @returns {object} styles - The CSS styles\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Get observed attributes for the Breadcrumb element.\n * @static\n * @returns {Array<string>} - The observed attributes array for the Breadcrumb element.\n */\n static get observedAttributes() {\n return ['show-collapsed-indicator', 'collapsed', 'last'];\n }\n\n /**\n * Handles attribute changes for the custom element and updates its behavior or appearance accordingly.\n * @param {string} name The name of the attribute that was changed.\n * @param {string|null} oldValue The previous value of the attribute before it was changed. Null if the attribute was not previously set.\n * @param {string|null} newValue The new value of the attribute after it was changed. Null if the attribute was removed.\n */\n attributeChangedCallback(name, oldValue, newValue) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n\n if (name === 'collapsed') {\n const isCollapsed = WjElementUtils.stringToBoolean(newValue);\n\n // toggle class podľa stavu\n this.classList.toggle('collapsed', isCollapsed && !this.hasAttribute('show-collapsed-indicator'));\n\n } else if (name === 'show-collapsed-indicator') {\n const isOn = WjElementUtils.stringToBoolean(newValue);\n this._showCollapsedIndicator = isOn;\n this.refresh();\n\n } else if (name === 'last') {\n const isLast = WjElementUtils.stringToBoolean(newValue);\n this.active = isLast;\n this.showSeparator = !isLast;\n this.syncAria();\n if (this.native) {\n if (isLast) this.native.setAttribute('aria-current', 'page');\n else this.native.removeAttribute('aria-current');\n }\n this.refresh();\n }\n }\n\n /**\n * Setup attributes for the Breadcrumb element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n syncAria() {\n this.setAriaState({ role: 'link' });\n if (this.active) this.setAriaState({ current: 'page' });\n else this.removeAttribute('aria-current');\n }\n\n /**\n * Draw method for the Breadcrumb element.\n * @returns {object} fragment - The document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('a');\n native.classList.add('native-breadcrumb');\n native.setAttribute('part', 'native');\n if (this.active) native.setAttribute('aria-current', 'page');\n\n if (this.active) native.classList.add('active');\n\n let slot = document.createElement('slot');\n\n let start = document.createElement('slot');\n start.setAttribute('name', 'start');\n\n let end = document.createElement('slot');\n end.setAttribute('name', 'end');\n\n native.append(start, slot, end);\n\n // APPEND\n fragment.append(native);\n\n if (WjElementUtils.stringToBoolean(this._showCollapsedIndicator)) {\n // pridame button za native element\n fragment.append(this.drawCollapsedIndicator());\n\n // skryjeme native element\n native.classList.add('hidden');\n }\n\n if (this.showSeparator) {\n let separator = document.createElement('span');\n separator.classList.add('separator');\n separator.setAttribute('part', 'separator');\n\n if (WjElementUtils.hasSlot(this, 'separator')) {\n let slotSeparator = document.createElement('slot');\n slotSeparator.setAttribute('name', 'separator');\n\n separator.append(slotSeparator);\n } else {\n separator.innerHTML = `<wje-icon name=${this.separator || 'chevron-right'}></wje-icon>`;\n }\n\n fragment.append(separator);\n }\n\n this.native = native;\n\n return fragment;\n }\n\n /**\n * Renders the collapsed indicator based on the current collapsed variant.\n * If the collapsed variant is 'DROPDOWN', it invokes the collapseDropdown method.\n * Otherwise, it invokes the collapseButton method.\n * @returns {any} The rendered collapsed indicator, either as a dropdown or a button.\n */\n drawCollapsedIndicator() {\n let collapsedIndicator = null;\n\n if (this.collapsedVariant === 'DROPDOWN') {\n collapsedIndicator = this.collapseDropdown();\n } else {\n collapsedIndicator = this.collapseButton();\n }\n\n return collapsedIndicator;\n }\n\n /**\n * Creates and returns a dropdown UI component for collapsed breadcrumbs.\n * This method generates a dropdown element with a button trigger and a menu populated with items corresponding\n * to the collapsed breadcrumbs. The dropdown is configured to handle specific interactions and ensure that\n * events are appropriately managed to avoid propagation issues. Menu items are linked to their corresponding\n * breadcrumbs, enabling the same functionality as clicking on the original breadcrumb.\n * @returns {HTMLElement} A configured dropdown element containing a button as trigger and a menu with breadcrumb items.\n */\n collapseDropdown() {\n let dropdown = document.createElement('wje-dropdown');\n dropdown.setAttribute('placement', 'bottom');\n dropdown.setAttribute('offset', '10');\n\n let button = document.createElement('wje-button');\n button.setAttribute('slot', 'trigger');\n button.setAttribute('fill', 'link');\n button.innerHTML = `<wje-icon name=\"dots\"></wje-icon>`;\n\n let menu = document.createElement('wje-menu');\n menu.setAttribute('variant', 'context');\n\n menu.addEventListener('click', (e) => {\n e.stopPropagation();\n e.stopImmediatePropagation?.();\n });\n\n this.getBreadcrumbs().getBreadcrumbsCollapsed().forEach((b) => {\n let menuItem = document.createElement('wje-menu-item');\n menuItem.innerHTML = b.innerHTML;\n\n menuItem.__breadcrumb = b;\n\n menuItem.addEventListener('wje-menu-item:click', (e) => {\n e.preventDefault?.();\n e.stopPropagation();\n e.stopImmediatePropagation?.();\n\n const breadcrumb = e.currentTarget.__breadcrumb;\n if (!breadcrumb) return;\n\n // Prefer clicking the internal anchor (same behavior as real user click), fallback to host click.\n const native = breadcrumb.native || breadcrumb.context?.querySelector('a.native-breadcrumb');\n if (native && typeof native.click === 'function') {\n native.click();\n } else if (typeof breadcrumb.click === 'function') {\n breadcrumb.click();\n } else {\n breadcrumb.dispatchEvent(\n new MouseEvent('click', {\n bubbles: true,\n composed: true,\n cancelable: true\n })\n );\n }\n });\n\n menu.append(menuItem);\n });\n\n dropdown.append(button, menu);\n\n return dropdown;\n }\n\n /**\n * Creates a button element that expands hidden breadcrumbs when clicked.\n * The button is set with appropriate attributes and event listeners to handle\n * the expanding of hidden breadcrumb elements. Clicking the button will remove\n * the button itself, reveal hidden breadcrumbs, and stop the current event\n * propagation.\n * @returns {HTMLButtonElement} The created button configured to expand breadcrumbs.\n */\n collapseButton() {\n let button = document.createElement('button');\n button.setAttribute('aria-label', 'Show more breadcrumbs');\n button.setAttribute('part', 'collapsed-indicator');\n button.innerHTML = `<wje-icon name=\"dots\"></wje-icon>`;\n\n event.addListener(button, 'click', null, (e) => {\n this.native.classList.remove('hidden');\n button.remove();\n this.getBreadcrumbs().getBreadcrumbsCollapsed().forEach((el) => {\n el.classList.remove('collapsed');\n });\n e.stopPropagation();\n });\n\n return button;\n }\n\n /**\n * Retrieves the breadcrumb trail for the current element by returning its parent element.\n * @returns {Element} The parent element representing the breadcrumb trail.\n */\n getBreadcrumbs() {\n return this.parentElement;\n }\n}\n","import Breadcrumb from './breadcrumb.element.js';\n\n// export * from \"./breadcrumb.element.js\";\nexport default Breadcrumb;\n\nBreadcrumb.define('wje-breadcrumb', Breadcrumb);\n"],"names":[],"mappings":";;;;;;;AAkBe,MAAM,mBAAmB,UAAU;AAAA;AAAA;AAAA;AAAA,EAI9C,cAAc;AACV,UAAK;AA2CT;AAAA;AAAA;AAAA;AAAA,qCAAY;AAzCR,SAAK,iBAAiB;AACtB,SAAK,0BAA0B;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,gBAAgB;AAChB,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,cAAc,OAAO;AACrB,SAAK,iBAAiB;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,iBAAiB,OAAO;AACxB,SAA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AED,aAAS,OAAO,QAAQ,IAAI;AAE5B,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,iBAAiB;AACb,QAAI,SAAS,SAAS,cAAc,QAAQ;AAC5C,WAAO,aAAa,cAAc,uBAAuB;AACzD,WAAO,aAAa,QAAQ,qBAAqB;AACjD,WAAO,YAAY;AAEnB,UAAM,YAAY,QAAQ,SAAS,MAAM,CAAC,MAAM;AAC5C,WAAK,OAAO,UAAU,OAAO,QAAQ;AACrC,aAAO,OAAM;AACb,WAAK,eAAc,EAAG,wBAAuB,EAAG,QAAQ,CAAC,OAAO;AAC5D,WAAG,UAAU,OAAO,WAAW;AAAA,MACnC,CAAC;AACD,QAAE,gBAAe;AAAA,IACrB,CAAC;AAED,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,iBAAiB;AACb,WAAO,KAAK;AAAA,EAChB;AACJ;AC7SA,WAAW,OAAO,kBAAkB,UAAU;"}
@@ -46,15 +46,8 @@ class Button extends WJElement {
46
46
  * Toggle states method for the Button element.
47
47
  */
48
48
  __publicField(this, "toggleStates", () => {
49
- const nodes = this.slotToggle.assignedNodes().filter((node) => node.nodeType === Node.ELEMENT_NODE);
50
- nodes.forEach((node, index) => {
51
- if (node.classList.contains("show")) {
52
- node.classList.remove("show");
53
- } else {
54
- node.classList.add("show");
55
- this.setAttribute("value", index === 0 ? "on" : "off");
56
- }
57
- });
49
+ this.setAttribute("value", this.getAttribute("value") === "on" ? "off" : "on");
50
+ this.syncToggleState();
58
51
  this.syncAria();
59
52
  });
60
53
  }
@@ -250,7 +243,7 @@ class Button extends WJElement {
250
243
  * @returns {Array<string>} observedAttributes - The observed attributes array for the Button element.
251
244
  */
252
245
  static get observedAttributes() {
253
- return ["disabled", "color", "value", "active", "href"];
246
+ return ["disabled", "color", "value", "active", "href", "toggle"];
254
247
  }
255
248
  attributeChangedCallback(name, oldValue, newValue) {
256
249
  var _a, _b;
@@ -367,15 +360,7 @@ class Button extends WJElement {
367
360
  if (this.hasAttribute("route")) {
368
361
  this.unbindRouterLinks = bindRouterLinks(this.parentElement, { selector: false });
369
362
  }
370
- if (this.hasToggle) {
371
- if (this.toggle === "off") {
372
- this.slotToggle.assignedNodes()[1].classList.add("show");
373
- this.setAttribute("value", "off");
374
- } else {
375
- this.slotToggle.assignedNodes()[0].classList.add("show");
376
- this.setAttribute("value", "on");
377
- }
378
- }
363
+ if (this.hasToggle) this.syncToggleState();
379
364
  if (this.hasAttribute("custom-event")) {
380
365
  event.addListener(this, "click", null, __privateMethod(this, _Button_instances, populateCustomEvent_fn));
381
366
  }
@@ -416,6 +401,21 @@ class Button extends WJElement {
416
401
  this.removeEventListener("click", this.eventDialogOpen);
417
402
  (_a = this.unbindRouterLinks) == null ? void 0 : _a.call(this);
418
403
  }
404
+ /**
405
+ * Keeps toggle slot visibility aligned with the current value.
406
+ */
407
+ syncToggleState() {
408
+ var _a, _b;
409
+ const nodes = ((_b = (_a = this.slotToggle) == null ? void 0 : _a.assignedElements) == null ? void 0 : _b.call(_a, { flatten: true })) || [];
410
+ const state = this.getAttribute("value") || this.getAttribute("toggle") || "on";
411
+ const selectedIndex = state === "off" ? 1 : 0;
412
+ const selected = nodes[selectedIndex] || nodes[0];
413
+ nodes.forEach((node) => node.classList.remove("show"));
414
+ selected == null ? void 0 : selected.classList.add("show");
415
+ if (state !== this.getAttribute("value")) {
416
+ this.setAttribute("value", state);
417
+ }
418
+ }
419
419
  /**
420
420
  * Syncs ARIA attributes on the host element.
421
421
  */
@@ -1 +1 @@
1
- {"version":3,"file":"wje-button.js","sources":["../packages/wje-button/button.element.js","../packages/wje-button/button.js"],"sourcesContent":["import { bindRouterLinks } from 'slick-router/middlewares/router-links.js';\n\nimport { bool } from '../utils/utils.js';\nimport { default as WJElement, event, WjElementUtils } from '../wje-element/element.js';\nimport Icon from '../wje-icon/icon.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents Button element, extending the WJElement class.\n * @documentation https://elements.webjet.sk/components/button\n * @status stable\n * @augments WJElement\n * @dependency wje-icon\n * @slot - The button main content.\n * @slot icon - The button icon.\n * @slot caret - The button caret.\n * @slot start - The button start slot.\n * @slot end - The button end slot.\n * @slot toggle - The button toggle slot.\n * @csspart native - The component's native wrapper.\n * @cssproperty [--wje-button-background-color=transparent] - Background color of the component;\n * @cssproperty [--wje-button-border-color=--wje-color-contrast-4] - Border color of the component;\n * @cssproperty [--wje-button-color=--wje-color-contrast-11] - Color of the component;\n * @cssproperty [--wje-button-border-radius=--wje-border-radius-medium] - Border radius of the component;\n * @cssproperty [--wje-button-border-width=1px] - Border width of the component;\n * @cssproperty [--wje-button-border-style=solid] - Border style of the component;\n * @cssproperty [--wje-button-border-color=--wje-color-contrast-1] - Border color of the component;\n * @cssproperty [--wje-button-margin-inline=0] - Margin inline of the component;\n */\n\nexport default class Button extends WJElement {\n /**\n * Button constructor method.\n * @class\n */\n constructor() {\n super();\n }\n\n /**\n * Dependencies of the Button element.\n * @type {object}\n */\n dependencies = {\n 'wje-icon': Icon,\n };\n\n /**\n * Properties of the element Button.\n * @param value\n */\n set color(value) {\n this.setAttribute('color', value || 'default');\n }\n\n /**\n * Get color of the Button element.\n * @returns {string|string}\n */\n get color() {\n return this.getAttribute('color') || 'default';\n }\n\n /**\n * Set variant of the Button element.\n * @param value\n */\n set caret(value) {\n this.setAttribute('caret', value);\n }\n\n /**\n * Get variant of the Button element.\n * @returns {boolean}\n */\n get caret() {\n return this.hasAttribute('caret');\n }\n\n /**\n * Sets the 'round' attribute on the element. If the value is true, the attribute is added;\n * otherwise, it is removed from the element.\n * @param {boolean} value A boolean indicating whether to set or remove the 'round' attribute.\n */\n set round(value) {\n if (value) {\n this.setAttribute('round', '');\n } else {\n this.removeAttribute('round');\n }\n }\n\n /**\n * Retrieves the value of the 'round' attribute as a boolean.\n * Checks if the 'round' attribute is present on the element.\n * @returns {boolean} True if the 'round' attribute exists, otherwise false.\n */\n get round() {\n return this.hasAttribute('round');\n }\n\n /**\n * Set variant of the Button element.\n * @param value\n */\n set tooltip(value) {\n this.setAttribute('tooltip', value);\n }\n\n /**\n * Get variant of the Button element.\n * @returns {boolean}\n */\n get tooltip() {\n return this.hasAttribute('tooltip');\n }\n\n /**\n * Set variant of the Button element.\n * @param value\n */\n set dialog(value) {\n this.setAttribute('dialog', value);\n }\n\n /**\n * Get variant of the Button element.\n * @returns {string|object}\n */\n get dialog() {\n return this.getAttribute('dialog');\n }\n\n /**\n * Set active state of the Button element.\n * @param {boolean} value The value to set\n */\n set active(value) {\n this.setAttribute('active', '');\n }\n\n /**\n * Get active state of the Button element.\n * @returns {boolean} active - The active state\n */\n get active() {\n return this.hasAttribute('active');\n }\n\n /**\n * Set disabled state of the Button element.\n * @param {boolean} value The value to set\n */\n set disabled(value) {\n this.removeAttribute('disabled');\n\n if (value) {\n this.setAttribute('disabled', '');\n }\n }\n\n /**\n * Get disabled state of the Button element.\n * @returns {boolean} disabled - The disabled state\n */\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n /**\n * Set fill of the Button element.\n * @param {string} value The value to set\n */\n set fill(value) {\n this.setAttribute('fill', value);\n }\n\n /**\n * Get fill of the Button element.\n * @returns {string} fill - The fill value\n */\n get fill() {\n return this.getAttribute('fill') || 'solid';\n }\n\n /**\n * Set outline state of the Button element.\n * @param {boolean} value The value to set\n */\n set outline(value) {\n this.setAttribute('outline', '');\n }\n\n /**\n * Get outline state of the Button element.\n * @returns {boolean} outline - The outline state\n */\n get outline() {\n return this.hasAttribute('outline');\n }\n\n /**\n * Set stop propagation state of the Button element.\n * @param {boolean} value The value to set\n */\n set stopPropagation(value) {\n this.setAttribute('stop-propagation', bool(value));\n }\n\n /**\n * Get stop propagation state of the Button element.\n * @returns {boolean} stopPropagation - The stop propagation state\n */\n get stopPropagation() {\n return bool(this.getAttribute('stop-propagation'));\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 /**\n * Class name for the Button element\n * @type {string}\n */\n className = 'Button';\n\n /**\n * Get CSS stylesheet for the Button element.\n * @static\n * @returns {CSSStyleSheet} styles - The CSS stylesheet for the Button element.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Get observed attributes for the Button element.\n * @static\n * @returns {Array<string>} observedAttributes - The observed attributes array for the Button element.\n */\n static get observedAttributes() {\n return ['disabled', 'color', 'value', 'active', 'href'];\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n if (['disabled', 'value', 'active', 'href'].includes(name)) {\n this.syncAria?.();\n }\n }\n\n /**\n * @summary A static property that indicates whether the custom element is form-associated or not.\n * Form-associated custom elements are elements that can participate in form submission.\n * @type {boolean}\n */\n static formAssociated = true;\n\n /**\n * @summary Callback function that is called when the custom element is associated with a form.\n * This function sets the internal `_form` property to the associated form.\n * @param {HTMLFormElement} form The form the custom element is associated with.\n */\n formAssociatedCallback(form) {\n this._form = form;\n }\n\n /**\n * @summary Callback function that is called when the form-associated state of the custom element changes.\n * This function updates the 'disabled' attribute of the element based on the new state.\n * @param {boolean} disabled The new form-associated state.\n */\n formDisabledCallback(disabled) {\n if (disabled) {\n this.setAttribute('disabled', '');\n } else {\n this.removeAttribute('disabled');\n }\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n /**\n * Draw method for the Button element.\n * @returns {object} fragment - The document fragment containing the drawn element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement(this.hasAttribute('href') ? 'a' : 'button');\n if (this.hasAttribute('href')) {\n native.setAttribute('href', this.getAttribute('href'));\n } else {\n if (this.type === 'submit') {\n native.setAttribute('type', 'submit');\n }\n }\n\n native.classList.add('native-button');\n native.setAttribute('part', 'native');\n\n this.classList.remove('wje-button-disabled');\n\n if (this.disabled) native.classList.add('wje-button-disabled');\n\n if (this.variant) native.classList.add('wje-button-' + this.variant);\n\n if (this.hasAttribute('round')) native.classList.add('wje-button-round');\n\n if (this.hasAttribute('circle')) native.classList.add('wje-button-circle');\n\n if (this.outline) native.classList.add('wje-outline');\n\n if (this.fill) native.classList.add('wje-button-' + this.fill);\n\n if (this.size) native.classList.add('wje-button-' + this.size);\n\n if (\n (this.querySelectorAll('[slot=caret]').length < 1 && this.hasAttribute('caret')) ||\n this.hasAttribute('only-caret')\n ) {\n let i = document.createElement('wje-icon');\n i.style.setProperty('--wje-icon-size', '14px');\n i.setAttribute('slot', 'caret');\n i.setAttribute('name', 'chevron-down');\n i.setAttribute('part', 'caret');\n\n this.appendChild(i);\n }\n\n if (this.active) {\n this.classList.add('wje-active');\n let i = document.createElement('wje-icon');\n i.setAttribute('name', 'check');\n\n this.appendChild(i);\n }\n\n native.classList.add('wje-color-' + this.color, 'wje-color');\n\n let span = document.createElement('span');\n span.setAttribute('part', 'inner');\n span.classList.add('button-inner');\n\n let slot = document.createElement('slot');\n slot.setAttribute('name', 'icon-only');\n span.appendChild(slot);\n\n slot = document.createElement('slot');\n slot.setAttribute('name', 'start');\n span.appendChild(slot);\n\n slot = document.createElement('slot');\n span.appendChild(slot);\n\n slot = document.createElement('slot');\n slot.setAttribute('name', 'end');\n span.appendChild(slot);\n\n slot = document.createElement('slot');\n slot.setAttribute('name', 'caret');\n span.appendChild(slot);\n\n this.hasToggle = WjElementUtils.hasSlot(this, 'toggle');\n\n if (this.hasToggle) {\n this.slotToggle = document.createElement('slot');\n this.slotToggle.setAttribute('name', 'toggle');\n\n span.appendChild(this.slotToggle);\n }\n\n native.appendChild(span);\n\n if (this.tooltip) {\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('content', this.getAttribute('tooltip'));\n tooltip.setAttribute('placement', this.getAttribute('tooltip-placement') || 'top');\n tooltip.appendChild(native);\n\n fragment.appendChild(tooltip);\n } else {\n fragment.appendChild(native);\n }\n\n return fragment;\n }\n\n /**\n * After draw method for the Button element.\n */\n afterDraw() {\n if (this.hasAttribute('route')) {\n this.unbindRouterLinks = bindRouterLinks(this.parentElement, { selector: false });\n }\n\n // nastavenie toggle podla atributu, ak nie je nastaveny, tak sa zobrazi vzdy prvy element\n if (this.hasToggle) {\n if (this.toggle === 'off') {\n this.slotToggle.assignedNodes()[1].classList.add('show');\n this.setAttribute('value', 'off');\n } else {\n this.slotToggle.assignedNodes()[0].classList.add('show');\n this.setAttribute('value', 'on');\n }\n }\n\n if (this.hasAttribute('custom-event')) {\n event.addListener(this, 'click', null, this.#populateCustomEvent);\n }\n\n if (this.hasAttribute('dialog')) {\n event.addListener(this, 'click', null, this.eventDialogOpen);\n } else {\n event.addListener(this, 'click', 'wje-button:click', null); // { stopPropagation: this.stopPropagation } - zrusene kvoli dropdown kde som nevedel odchytit event click\n }\n\n if (this.hasToggle)\n event.addListener(this, 'click', 'wje-button:toggle', this.toggleStates, {\n stopPropagation: this.stopPropagation,\n });\n\n if (this.type === 'submit') {\n event.addListener(this, 'click', 'wje-button:submit', () => {\n event.dispatchCustomEvent(this.internals?.form, 'submit', {});\n });\n }\n\n if (this.type === 'reset') {\n event.addListener(this, 'click', 'wje-button:reset', () => {\n this.internals?.form.reset();\n });\n }\n\n this.syncAria();\n }\n\n /**\n * Before disconnect method for the Button element.\n */\n beforeDisconnect() {\n // remove all events from the button\n event.removeListener(this, 'click', null, this.eventDialogOpen);\n event.removeListener(this, 'click', 'wje-button:click', null);\n event.removeListener(this, 'click', 'wje-button:toggle', this.toggleStates);\n event.removeListener(this, 'click', null, this.#populateCustomEvent);\n event.removeListener(this, 'click', 'wje-button:submit', null);\n event.removeListener(this, 'click', 'wje-button:reset', null);\n\n this.removeEventListener('click', this.eventDialogOpen);\n this.unbindRouterLinks?.();\n }\n\n /**\n * Event dialog open method for the Button element.\n * @param {Event} e The event object\n */\n eventDialogOpen = (e) => {\n event.dispatchCustomEvent(this, this.dialog);\n };\n\n /**\n * Toggle states method for the Button element.\n */\n toggleStates = () => {\n const nodes = this.slotToggle.assignedNodes().filter((node) => node.nodeType === Node.ELEMENT_NODE);\n\n nodes.forEach((node, index) => {\n if (node.classList.contains('show')) {\n node.classList.remove('show');\n } else {\n node.classList.add('show');\n this.setAttribute('value', index === 0 ? 'on' : 'off');\n }\n });\n\n this.syncAria();\n }\n\n /**\n * Syncs ARIA attributes on the host element.\n */\n syncAria() {\n const isLink = this.hasAttribute('href');\n const isToggle = !!this.hasToggle;\n const pressed = isToggle && !isLink ? this.getAttribute('value') === 'on' : undefined;\n\n this.setAriaState({\n role: isLink ? 'link' : 'button',\n disabled: this.disabled,\n pressed,\n });\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","import Button from './button.element.js';\n\nexport default Button;\n\nButton.define('wje-button', Button);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA8Be,MAAM,eAAe,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK1C,c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AA,MACzB,CAAC;AAAA,IACL;AAEA,SAAK,SAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA,EAKA,mBAAmB;;AAEf,UAAM,eAAe,MAAM,SAAS,MAAM,KAAK,eAAe;AAC9D,UAAM,eAAe,MAAM,SAAS,oBAAoB,IAAI;AAC5D,UAAM,eAAe,MAAM,SAAS,qBAAqB,KAAK,YAAY;AAC1E,UAAM,eAAe,MAAM,SAAS,MAAM,sBAAK,0CAAoB;AACnE,UAAM,eAAe,MAAM,SAAS,qBAAqB,IAAI;AAC7D,UAAM,eAAe,MAAM,SAAS,oBAAoB,IAAI;AAE5D,SAAK,oBAAoB,SAAS,KAAK,eAAe;AACtD,eAAK,sBAAL;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EA+BA,WAAW;AACP,UAAM,SAAS,KAAK,aAAa,MAAM;AACvC,UAAM,WAAW,CAAC,CAAC,KAAK;AACxB,UAAM,UAAU,YAAY,CAAC,SAAS,KAAK,aAAa,OAAO,MAAM,OAAO;AAE5E,SAAK,aAAa;AAAA,MACd,MAAM,SAAS,SAAS;AAAA,MACxB,UAAU,KAAK;AAAA,MACf;AAAA,IACZ,CAAS;AAAA,EACL;AAcJ;AAjgBe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4fX,yBAAoB,WAAG;AACnB,OAAK;AAAA,IACH,IAAI,YAAY,KAAK,aAAa,EAAE,QAAQ,KAAK,uBAAuB,UAAU,MAAM,SAAS,KAAI,CAAE;AAAA,EACjH;AACI;AAAA;AAAA;AAAA;AAAA;AAAA;AA/PA,cAjQiB,QAiQV,kBAAiB;AC3R5B,OAAO,OAAO,cAAc,MAAM;"}
1
+ {"version":3,"file":"wje-button.js","sources":["../packages/wje-button/button.element.js","../packages/wje-button/button.js"],"sourcesContent":["import { bindRouterLinks } from 'slick-router/middlewares/router-links.js';\n\nimport { bool } from '../utils/utils.js';\nimport { default as WJElement, event, WjElementUtils } from '../wje-element/element.js';\nimport Icon from '../wje-icon/icon.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents Button element, extending the WJElement class.\n * @documentation https://elements.webjet.sk/components/button\n * @status stable\n * @augments WJElement\n * @dependency wje-icon\n * @slot - The button main content.\n * @slot icon - The button icon.\n * @slot caret - The button caret.\n * @slot start - The button start slot.\n * @slot end - The button end slot.\n * @slot toggle - The button toggle slot.\n * @csspart native - The component's native wrapper.\n * @cssproperty [--wje-button-background-color=transparent] - Background color of the component;\n * @cssproperty [--wje-button-border-color=--wje-color-contrast-4] - Border color of the component;\n * @cssproperty [--wje-button-color=--wje-color-contrast-11] - Color of the component;\n * @cssproperty [--wje-button-border-radius=--wje-border-radius-medium] - Border radius of the component;\n * @cssproperty [--wje-button-border-width=1px] - Border width of the component;\n * @cssproperty [--wje-button-border-style=solid] - Border style of the component;\n * @cssproperty [--wje-button-border-color=--wje-color-contrast-1] - Border color of the component;\n * @cssproperty [--wje-button-margin-inline=0] - Margin inline of the component;\n */\n\nexport default class Button extends WJElement {\n /**\n * Button constructor method.\n * @class\n */\n constructor() {\n super();\n }\n\n /**\n * Dependencies of the Button element.\n * @type {object}\n */\n dependencies = {\n 'wje-icon': Icon,\n };\n\n /**\n * Properties of the element Button.\n * @param value\n */\n set color(value) {\n this.setAttribute('color', value || 'default');\n }\n\n /**\n * Get color of the Button element.\n * @returns {string|string}\n */\n get color() {\n return this.getAttribute('color') || 'default';\n }\n\n /**\n * Set variant of the Button element.\n * @param value\n */\n set caret(value) {\n this.setAttribute('caret', value);\n }\n\n /**\n * Get variant of the Button element.\n * @returns {boolean}\n */\n get caret() {\n return this.hasAttribute('caret');\n }\n\n /**\n * Sets the 'round' attribute on the element. If the value is true, the attribute is added;\n * otherwise, it is removed from the element.\n * @param {boolean} value A boolean indicating whether to set or remove the 'round' attribute.\n */\n set round(value) {\n if (value) {\n this.setAttribute('round', '');\n } else {\n this.removeAttribute('round');\n }\n }\n\n /**\n * Retrieves the value of the 'round' attribute as a boolean.\n * Checks if the 'round' attribute is present on the element.\n * @returns {boolean} True if the 'round' attribute exists, otherwise false.\n */\n get round() {\n return this.hasAttribute('round');\n }\n\n /**\n * Set variant of the Button element.\n * @param value\n */\n set tooltip(value) {\n this.setAttribute('tooltip', value);\n }\n\n /**\n * Get variant of the Button element.\n * @returns {boolean}\n */\n get tooltip() {\n return this.hasAttribute('tooltip');\n }\n\n /**\n * Set variant of the Button element.\n * @param value\n */\n set dialog(value) {\n this.setAttribute('dialog', value);\n }\n\n /**\n * Get variant of the Button element.\n * @returns {string|object}\n */\n get dialog() {\n return this.getAttribute('dialog');\n }\n\n /**\n * Set active state of the Button element.\n * @param {boolean} value The value to set\n */\n set active(value) {\n this.setAttribute('active', '');\n }\n\n /**\n * Get active state of the Button element.\n * @returns {boolean} active - The active state\n */\n get active() {\n return this.hasAttribute('active');\n }\n\n /**\n * Set disabled state of the Button element.\n * @param {boolean} value The value to set\n */\n set disabled(value) {\n this.removeAttribute('disabled');\n\n if (value) {\n this.setAttribute('disabled', '');\n }\n }\n\n /**\n * Get disabled state of the Button element.\n * @returns {boolean} disabled - The disabled state\n */\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n /**\n * Set fill of the Button element.\n * @param {string} value The value to set\n */\n set fill(value) {\n this.setAttribute('fill', value);\n }\n\n /**\n * Get fill of the Button element.\n * @returns {string} fill - The fill value\n */\n get fill() {\n return this.getAttribute('fill') || 'solid';\n }\n\n /**\n * Set outline state of the Button element.\n * @param {boolean} value The value to set\n */\n set outline(value) {\n this.setAttribute('outline', '');\n }\n\n /**\n * Get outline state of the Button element.\n * @returns {boolean} outline - The outline state\n */\n get outline() {\n return this.hasAttribute('outline');\n }\n\n /**\n * Set stop propagation state of the Button element.\n * @param {boolean} value The value to set\n */\n set stopPropagation(value) {\n this.setAttribute('stop-propagation', bool(value));\n }\n\n /**\n * Get stop propagation state of the Button element.\n * @returns {boolean} stopPropagation - The stop propagation state\n */\n get stopPropagation() {\n return bool(this.getAttribute('stop-propagation'));\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 /**\n * Class name for the Button element\n * @type {string}\n */\n className = 'Button';\n\n /**\n * Get CSS stylesheet for the Button element.\n * @static\n * @returns {CSSStyleSheet} styles - The CSS stylesheet for the Button element.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Get observed attributes for the Button element.\n * @static\n * @returns {Array<string>} observedAttributes - The observed attributes array for the Button element.\n */\n static get observedAttributes() {\n return ['disabled', 'color', 'value', 'active', 'href', 'toggle'];\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n if (['disabled', 'value', 'active', 'href'].includes(name)) {\n this.syncAria?.();\n }\n }\n\n /**\n * @summary A static property that indicates whether the custom element is form-associated or not.\n * Form-associated custom elements are elements that can participate in form submission.\n * @type {boolean}\n */\n static formAssociated = true;\n\n /**\n * @summary Callback function that is called when the custom element is associated with a form.\n * This function sets the internal `_form` property to the associated form.\n * @param {HTMLFormElement} form The form the custom element is associated with.\n */\n formAssociatedCallback(form) {\n this._form = form;\n }\n\n /**\n * @summary Callback function that is called when the form-associated state of the custom element changes.\n * This function updates the 'disabled' attribute of the element based on the new state.\n * @param {boolean} disabled The new form-associated state.\n */\n formDisabledCallback(disabled) {\n if (disabled) {\n this.setAttribute('disabled', '');\n } else {\n this.removeAttribute('disabled');\n }\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n /**\n * Draw method for the Button element.\n * @returns {object} fragment - The document fragment containing the drawn element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement(this.hasAttribute('href') ? 'a' : 'button');\n if (this.hasAttribute('href')) {\n native.setAttribute('href', this.getAttribute('href'));\n } else {\n if (this.type === 'submit') {\n native.setAttribute('type', 'submit');\n }\n }\n\n native.classList.add('native-button');\n native.setAttribute('part', 'native');\n\n this.classList.remove('wje-button-disabled');\n\n if (this.disabled) native.classList.add('wje-button-disabled');\n\n if (this.variant) native.classList.add('wje-button-' + this.variant);\n\n if (this.hasAttribute('round')) native.classList.add('wje-button-round');\n\n if (this.hasAttribute('circle')) native.classList.add('wje-button-circle');\n\n if (this.outline) native.classList.add('wje-outline');\n\n if (this.fill) native.classList.add('wje-button-' + this.fill);\n\n if (this.size) native.classList.add('wje-button-' + this.size);\n\n if (\n (this.querySelectorAll('[slot=caret]').length < 1 && this.hasAttribute('caret')) ||\n this.hasAttribute('only-caret')\n ) {\n let i = document.createElement('wje-icon');\n i.style.setProperty('--wje-icon-size', '14px');\n i.setAttribute('slot', 'caret');\n i.setAttribute('name', 'chevron-down');\n i.setAttribute('part', 'caret');\n\n this.appendChild(i);\n }\n\n if (this.active) {\n this.classList.add('wje-active');\n let i = document.createElement('wje-icon');\n i.setAttribute('name', 'check');\n\n this.appendChild(i);\n }\n\n native.classList.add('wje-color-' + this.color, 'wje-color');\n\n let span = document.createElement('span');\n span.setAttribute('part', 'inner');\n span.classList.add('button-inner');\n\n let slot = document.createElement('slot');\n slot.setAttribute('name', 'icon-only');\n span.appendChild(slot);\n\n slot = document.createElement('slot');\n slot.setAttribute('name', 'start');\n span.appendChild(slot);\n\n slot = document.createElement('slot');\n span.appendChild(slot);\n\n slot = document.createElement('slot');\n slot.setAttribute('name', 'end');\n span.appendChild(slot);\n\n slot = document.createElement('slot');\n slot.setAttribute('name', 'caret');\n span.appendChild(slot);\n\n this.hasToggle = WjElementUtils.hasSlot(this, 'toggle');\n\n if (this.hasToggle) {\n this.slotToggle = document.createElement('slot');\n this.slotToggle.setAttribute('name', 'toggle');\n\n span.appendChild(this.slotToggle);\n }\n\n native.appendChild(span);\n\n if (this.tooltip) {\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('content', this.getAttribute('tooltip'));\n tooltip.setAttribute('placement', this.getAttribute('tooltip-placement') || 'top');\n tooltip.appendChild(native);\n\n fragment.appendChild(tooltip);\n } else {\n fragment.appendChild(native);\n }\n\n return fragment;\n }\n\n /**\n * After draw method for the Button element.\n */\n afterDraw() {\n if (this.hasAttribute('route')) {\n this.unbindRouterLinks = bindRouterLinks(this.parentElement, { selector: false });\n }\n\n // nastavenie toggle podla atributu, ak nie je nastaveny, tak sa zobrazi vzdy prvy element\n if (this.hasToggle) this.syncToggleState();\n\n if (this.hasAttribute('custom-event')) {\n event.addListener(this, 'click', null, this.#populateCustomEvent);\n }\n\n if (this.hasAttribute('dialog')) {\n event.addListener(this, 'click', null, this.eventDialogOpen);\n } else {\n event.addListener(this, 'click', 'wje-button:click', null); // { stopPropagation: this.stopPropagation } - zrusene kvoli dropdown kde som nevedel odchytit event click\n }\n\n if (this.hasToggle)\n event.addListener(this, 'click', 'wje-button:toggle', this.toggleStates, {\n stopPropagation: this.stopPropagation,\n });\n\n if (this.type === 'submit') {\n event.addListener(this, 'click', 'wje-button:submit', () => {\n event.dispatchCustomEvent(this.internals?.form, 'submit', {});\n });\n }\n\n if (this.type === 'reset') {\n event.addListener(this, 'click', 'wje-button:reset', () => {\n this.internals?.form.reset();\n });\n }\n\n this.syncAria();\n }\n\n /**\n * Before disconnect method for the Button element.\n */\n beforeDisconnect() {\n // remove all events from the button\n event.removeListener(this, 'click', null, this.eventDialogOpen);\n event.removeListener(this, 'click', 'wje-button:click', null);\n event.removeListener(this, 'click', 'wje-button:toggle', this.toggleStates);\n event.removeListener(this, 'click', null, this.#populateCustomEvent);\n event.removeListener(this, 'click', 'wje-button:submit', null);\n event.removeListener(this, 'click', 'wje-button:reset', null);\n\n this.removeEventListener('click', this.eventDialogOpen);\n this.unbindRouterLinks?.();\n }\n\n /**\n * Event dialog open method for the Button element.\n * @param {Event} e The event object\n */\n eventDialogOpen = (e) => {\n event.dispatchCustomEvent(this, this.dialog);\n };\n\n /**\n * Toggle states method for the Button element.\n */\n toggleStates = () => {\n this.setAttribute('value', this.getAttribute('value') === 'on' ? 'off' : 'on');\n this.syncToggleState();\n this.syncAria();\n }\n\n /**\n * Keeps toggle slot visibility aligned with the current value.\n */\n syncToggleState() {\n const nodes = this.slotToggle?.assignedElements?.({ flatten: true }) || [];\n const state = this.getAttribute('value') || this.getAttribute('toggle') || 'on';\n const selectedIndex = state === 'off' ? 1 : 0;\n const selected = nodes[selectedIndex] || nodes[0];\n\n nodes.forEach((node) => node.classList.remove('show'));\n selected?.classList.add('show');\n\n if (state !== this.getAttribute('value')) {\n this.setAttribute('value', state);\n }\n }\n\n /**\n * Syncs ARIA attributes on the host element.\n */\n syncAria() {\n const isLink = this.hasAttribute('href');\n const isToggle = !!this.hasToggle;\n const pressed = isToggle && !isLink ? this.getAttribute('value') === 'on' : undefined;\n\n this.setAriaState({\n role: isLink ? 'link' : 'button',\n disabled: this.disabled,\n pressed,\n });\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","import Button from './button.element.js';\n\nexport default Button;\n\nButton.define('wje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(!this.slides) return 0;
225
- const styles2 = getComputedStyle(this.slides);
226
- return parseFloat(styles2.scrollPaddingInlineStart || styles2.scrollPaddingLeft || "0") || 0;
225
+ const slideStyles = getComputedStyle(this.slides);
226
+ return parseFloat(slideStyles.scrollPaddingInlineStart || slideStyles.scrollPaddingLeft || "0") || 0;
227
227
  }
228
228
  /**
229
229
  * Returns the interaction scroll behavior for UI controls.
230
230
  * Continuous multi-slide loops use instant snapping to avoid blank edge states
231
231
  * while the browser is still animating a previous smooth scroll.
232
- * @returns {ScrollBehavior|string}
232
+ * @returns {string}
233
233
  */
234
234
  getControlBehavior() {
235
235
  return this.continuousLoop && this.slidePerPage > 1 ? "auto" : "smooth";
@@ -368,7 +368,7 @@ class Carousel extends WJElement {
368
368
  /**
369
369
  * Scrolls the carousel to a visual slide index.
370
370
  * @param {number} vIndex
371
- * @param {ScrollBehavior|string} behavior
371
+ * @param {string} behavior
372
372
  */
373
373
  scrollToVisualIndex(vIndex, behavior = "smooth") {
374
374
  const withClones = this.getSlidesWithClones();
@@ -535,11 +535,11 @@ class Carousel extends WJElement {
535
535
  getSlidesWithClones() {
536
536
  return Array.from(this.querySelectorAll("wje-carousel-item"));
537
537
  }
538
- /** Maps logical index -> visual index (accounts for leading clone when loop=true) */
538
+ /** Maps logical index to visual index, including leading clones when loop is enabled. */
539
539
  getVisualIndexForLogical(index) {
540
540
  return this.loop ? index + this.getLoopCloneCount() : index;
541
541
  }
542
- /** Maps visual index -> logical index (handles clones at 0 and last when loop=true) */
542
+ /** Maps visual index to logical index, including edge clones when loop is enabled. */
543
543
  getLogicalIndexForVisual(vIndex) {
544
544
  const slides = this.getSlides();
545
545
  const maxIndex = this.getMaxVisibleStartIndex(slides.length);