wj-elements 0.1.174 → 0.1.175
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/packages/wje-element/element.d.ts +28 -31
- package/dist/packages/wje-select/select.element.d.ts +17 -6
- package/dist/packages/wje-stepper/stepper.element.d.ts +7 -6
- package/dist/wje-element.js +101 -100
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-orgchart-item.js +1 -1
- package/dist/wje-routerx.js.map +1 -1
- package/dist/wje-select.js +25 -26
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-stepper.js +79 -31
- package/dist/wje-stepper.js.map +1 -1
- package/dist/wje-tree-item.js +2 -4
- package/dist/wje-tree-item.js.map +1 -1
- package/dist/wje-tree.js +4 -0
- package/dist/wje-tree.js.map +1 -1
- package/package.json +2 -1
- package/dist/packages/wje-accordion/accordion.test.d.ts +0 -0
- package/dist/packages/wje-color-picker/color-picker.test.d.ts +0 -1
package/dist/wje-select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-select.js","sources":["../packages/wje-select/select.element.js","../packages/wje-select/select.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport Button from '../wje-button/button.js';\nimport Popup from '../wje-popup/popup.js';\nimport Icon from '../wje-icon/icon.js';\nimport Label from '../wje-label/label.js';\nimport Chip from '../wje-chip/chip.js';\nimport Input from '../wje-input/input.js';\nimport Option from '../wje-option/option.js';\nimport Options from '../wje-options/options.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Select` is a custom web component that represents a select input.\n * @summary This element represents a select input.\n * @documentation https://elements.webjet.sk/components/select\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the select.\n * @slot anchor - The slot for the anchor.\n * @slot arrow - The slot for the arrow.\n * @csspart native - The native select wrapper.\n * @csspart input - The input field.\n * @csspart clear - The clear button.\n * @property {Array} _selected - An array to store selected items.\n * @property {HTMLElement|null} counterEl - A reference to the counter element, initially null.\n * @property {ElementInternals} internals - The internal element API for managing state and attributes.\n * @property {number} maxOptions - The maximum number of options allowed.\n * @property {boolean} _wasOppened - Tracks whether the select element was previously opened, initially false.\n * @cssproperty [--wje-select-border-width=1px] - Specifies the width of the border around the select component. Accepts any valid CSS length unit (e.g., `px`, `rem`, `em`).\n * @cssproperty [--wje-select-border-style=solid] - Defines the style of the border for the select component. Accepts standard CSS border styles, such as `solid`, `dashed`, or `dotted`.\n * @cssproperty [--wje-select-border-color=var(--wje-border-color)] - Sets the color of the border for the select component. Accepts any valid CSS color value, including color variables, named colors, and hex values.\n * @cssproperty [--wje-select-options-border-width=1px] - Specifies the width of the border for the select options dropdown. Accepts any valid CSS length unit.\n * @cssproperty [--wje-select-options-border-style=var(--wje-border-style)] - Defines the border style for the select options dropdown. Inherits from a defined CSS variable for consistency.\n * @cssproperty [--wje-select-options-border-color=var(--wje-border-color)] - Sets the border color for the select options dropdown. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-background=var(--wje-background)] - Specifies the background color of the select component. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-line-height=20px] - Defines the line height for the text within the select component. Accepts any valid CSS length value, ensuring consistent vertical alignment.\n * @cssproperty [--wje-select-color=var(--wje-color)] - Sets the text color for the select component. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-border-radius=var(--wje-border-radius-medium)] - Specifies the border radius for the select component.Determines the roundness of the corners and accepts any valid CSS length unit or variable.\n * @tag wje-select\n */\n\nexport default class Select extends WJElement {\n /**\n * Constructor for the Select class.\n * @class\n * @description Initializes the Select component.\n * This constructor sets up the initial state of the component, including selected items, counter element, and internal element API.\n * It also tracks whether the select element was previously opened.\n * @class\n * @augments {WJElement}\n * @memberof Select\n */\n constructor() {\n super();\n\n /**\n * @type {Array}\n * @description An array to store selected items.\n */\n this._selected = [];\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the counter element, initially null.\n * @private\n */\n this.counterEl = null;\n\n /**\n * @type {ElementInternals}\n * @description The internal element API for managing state and attributes.\n * @private\n * @readonly\n * @constant\n * @default {ElementInternals} this.attachInternals()\n * @description Attaches the internals to the element.\n */\n this.internals = this.attachInternals();\n\n /**\n * @type {boolean}\n * @description Tracks whether the select element was previously opened, initially false.\n * @private\n * @default {boolean} false\n */\n this._wasOppened = false;\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the native select element, initially null.\n */\n this.native = null;\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the popup element, initially null.\n */\n this.popup = null;\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the label element, initially null.\n */\n this.labelElement = null;\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the slot start element, initially null.\n */\n this.slotStart = null;\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the slot end element, initially null.\n */\n this.slotEnd = null;\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the input element, initially null.\n */\n this.input = null;\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the options wrapper element, initially null.\n */\n this.optionsWrapper = null;\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the chips element, initially null.\n */\n this.chips = null;\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the clear button element, initially null.\n */\n this.clear = null;\n\n /**\n * @type {HTMLElement|null}\n * @description A reference to the list element, initially null.\n */\n this.list = null;\n\n this.selectedOptions = []\n }\n\n /**\n * An object representing component dependencies with their respective classes.\n * Each property in the object maps a custom component name (as a string key)\n * to its corresponding class or constructor.\n * @typedef {{[key: string]: Function}} Dependencies\n * @property {Function} 'wje-button' Represents the Button component class.\n * @property {Function} 'wje-popup' Represents the Popup component class.\n * @property {Function} 'wje-icon' Represents the Icon component class.\n * @property {Function} 'wje-label' Represents the Label component class.\n * @property {Function} 'wje-chip' Represents the Chip component class.\n * @property {Function} 'wje-input' Represents the Input component class.\n * @property {Function} 'wje-option' Represents the Option component class.\n * @property {Function} 'wje-options' Represents the Options component class.\n */\n dependencies = {\n 'wje-button': Button,\n 'wje-popup': Popup,\n 'wje-icon': Icon,\n 'wje-label': Label,\n 'wje-chip': Chip,\n 'wje-input': Input,\n 'wje-option': Option,\n 'wje-options': Options,\n };\n\n /**\n * Setter for the value attribute.\n * @param {string} value The value to set.\n */\n set value(value) {\n if (this.hasAttribute('multiple')) {\n const formData = new FormData();\n value.forEach(v => formData.append(this.name, v));\n this.internals.setFormValue(formData);\n } else {\n this.internals.setFormValue(value);\n }\n }\n\n /**\n * Getter for the value attribute.\n * @returns {string} The value of the attribute.\n */\n get value() {\n return this.selected;\n }\n\n /**\n * Getter for the customErrorDisplay attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get customErrorDisplay() {\n return this.hasAttribute('custom-error-display');\n }\n\n /**\n * Getter for the validateOnChange attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get validateOnChange() {\n return this.hasAttribute('validate-on-change');\n }\n\n /**\n * Getter for the invalid attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get invalid() {\n return this.hasAttribute('invalid');\n }\n\n /**\n * Setter for the invalid attribute.\n * @param {boolean} isInvalid Whether the input is invalid.\n */\n set invalid(isInvalid) {\n if (isInvalid) this.setAttribute('invalid', '');\n else this.removeAttribute('invalid');\n }\n\n /**\n * Sets the maximum number of options allowed.\n * @param {string | number | null} value The value to set as the maximum number of options.\n * If null, the 'max-options' attribute will be removed.\n */\n set maxOptions(value) {\n if (value) {\n this.setAttribute('max-options', value);\n } else {\n this.removeAttribute('max-options');\n }\n }\n\n /**\n * Retrieves the maximum number of options allowed.\n * Parses the value of the 'max-options' attribute from the element and converts it to a number.\n * If the attribute is not present or cannot be converted to a valid number, defaults to 1.\n * @returns {number} The maximum number of options, or 0 if the attribute is not set or invalid.\n */\n get maxOptions() {\n return +this.getAttribute('max-options') || 1;\n }\n\n /**\n * Getter for the form attribute.\n * @returns {HTMLFormElement} The form the input is associated with.\n */\n get form() {\n return this.internals.form;\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string} The name of the input.\n */\n get name() {\n return this.getAttribute('name');\n }\n\n /**\n * Getter for the type attribute.\n * @returns {string} The type of the input.\n */\n get type() {\n return this.localName;\n }\n\n /**\n * Getter for the validity attribute.\n * @returns {ValidityState} The validity state of the input.\n */\n get validity() {\n return this.internals.validity;\n }\n\n /**\n * Getter for the validationMessage attribute.\n * @returns {string} The validation message of the input.\n */\n get validationMessage() {\n return this.internals.validationMessage;\n }\n\n /**\n * Getter for the willValidate attribute.\n * @returns {boolean} Whether the input will be validated.\n */\n get willValidate() {\n return this.internals.willValidate;\n }\n\n /**\n * @summary Getter for the defaultValue attribute.\n * This method retrieves the 'value' attribute of the custom input element.\n * The 'value' attribute represents the default value of the input element.\n * If the 'value' attribute is not set, it returns an empty string.\n * @returns {string} The default value of the input element.\n */\n get defaultValue() {\n return this.getAttribute('value') ?? '';\n }\n\n /**\n * @summary Setter for the defaultValue attribute.\n * This method sets the 'value' attribute of the custom input element to the provided value.\n * The 'value' attribute represents the default value of the input element.\n * @param {string} value The value to set as the default value.\n */\n set defaultValue(value) {\n this.setAttribute('value', value);\n }\n\n /**\n * Sets the label value.\n * @param {Array} value The selected value to set.\n */\n set selected(value) {\n this._selected = value;\n }\n\n /**\n * Returns the selected value.\n * @returns {Array} The selected value.\n */\n get selected() {\n return this.getSelected();\n }\n\n /**\n * Sets the trigger value.\n * @param {string} value The trigger value to set.\n */\n set trigger(value) {\n this.setAttribute('trigger', value);\n }\n\n /**\n * Returns the trigger value.\n * @returns {string} The trigger value.\n */\n get trigger() {\n return this.getAttribute('trigger') || 'click';\n }\n\n className = 'Select';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return ['active', 'value', 'disabled', 'multiple', 'label', 'placeholder', 'max-height', 'max-options', 'variant', 'placement'];\n }\n\n /**\n * Whether the input is associated with a form.\n * @type {boolean}\n */\n static formAssociated = true;\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the select.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n this.classList.add('wje-placement', this.placement ? 'wje-' + this.placement : 'wje-start');\n\n // zakladny obalovac\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-select', this.variant || 'default');\n\n // wrapper pre label a inputWrapper\n let wrapper = document.createElement('div');\n wrapper.classList.add('wrapper');\n wrapper.setAttribute('slot', 'anchor');\n\n // label\n let label = document.createElement('wje-label');\n label.setAttribute('part', 'label');\n label.innerText = this.label || '';\n\n // obalovac pre input\n let inputWrapper = document.createElement('div');\n inputWrapper.setAttribute('part', 'input-wrapper');\n inputWrapper.classList.add('input-wrapper');\n\n let slotStart = document.createElement('div');\n slotStart.classList.add('slot-start');\n\n let input = document.createElement('input');\n input.setAttribute('type', 'text');\n input.setAttribute('part', 'input');\n input.setAttribute('autocomplete', 'off');\n input.setAttribute('readonly', '');\n input.setAttribute('placeholder', this.placeholder || '');\n\n let slotEnd = document.createElement('div');\n slotEnd.classList.add('slot-end');\n\n let arrow = document.createElement('wje-icon');\n arrow.setAttribute('name', 'chevron-down');\n arrow.setAttribute('slot', 'arrow');\n\n let chips = document.createElement('div');\n chips.classList.add('chips');\n chips.innerText = this.placeholder || '';\n\n // obalovac pre option a find\n let optionsWrapper = document.createElement('div');\n optionsWrapper.setAttribute('part', 'options-wrapper');\n optionsWrapper.classList.add('options-wrapper');\n optionsWrapper.style.setProperty('height', this.maxHeight || 'auto');\n\n let list = document.createElement('div');\n list.classList.add('list');\n\n let slot = document.createElement('slot');\n\n let clear = document.createElement('wje-button');\n clear.setAttribute('fill', 'link');\n clear.setAttribute('part', 'clear');\n clear.setAttribute('stop-propagation', '');\n\n let clearIcon = document.createElement('wje-icon');\n clearIcon.setAttribute('name', 'x');\n\n clear.appendChild(clearIcon);\n\n // vytvorime popup\n let popup = document.createElement('wje-popup');\n popup.setAttribute('placement', 'bottom-start');\n popup.setAttribute('manual', '');\n popup.setAttribute('size', '');\n popup.setAttribute('part', 'popup');\n\n if (this.hasAttribute('disabled')) popup.setAttribute('disabled', '');\n\n if (this.variant === 'standard') {\n if (this.hasAttribute('label')) native.appendChild(label);\n } else {\n wrapper.appendChild(label);\n }\n\n inputWrapper.appendChild(slotStart);\n inputWrapper.appendChild(input);\n if (this.hasAttribute('multiple')) inputWrapper.appendChild(chips);\n\n if (this.hasAttribute('clearable')) inputWrapper.appendChild(clear);\n\n inputWrapper.appendChild(slotEnd);\n inputWrapper.appendChild(arrow);\n\n list.appendChild(slot);\n\n if (this.hasAttribute('find')) {\n let find = document.createElement('wje-input');\n find.setAttribute('variant', 'standard');\n find.setAttribute('placeholder', 'Hľadať');\n find.setAttribute('part', 'find');\n find.classList.add('find');\n\n optionsWrapper.appendChild(find);\n\n this.findEl = find;\n }\n\n if (this.hasAttribute('lazy')) {\n event.addListener(popup, 'wje-popup:show', null, (e) => {\n if (this._wasOppened) return;\n this._wasOppened = true;\n\n const optionsElement = this.querySelector('wje-options');\n optionsElement.setAttribute('lazy', '');\n optionsElement.setAttribute('attached', '');\n });\n } else {\n const optionsElement = this.querySelector('wje-options');\n optionsElement?.setAttribute('attached', '');\n }\n\n optionsWrapper.appendChild(list);\n\n wrapper.appendChild(inputWrapper);\n popup.appendChild(optionsWrapper);\n popup.appendChild(wrapper);\n\n if (this.trigger === 'click') popup.setAttribute('manual', '');\n\n native.appendChild(popup);\n\n this.native = native;\n this.popup = popup;\n this.labelElement = label;\n this.slotStart = slotStart;\n this.slotEnd = slotEnd;\n this.input = input;\n this.optionsWrapper = optionsWrapper;\n this.chips = chips;\n this.clear = clear;\n this.list = list;\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Sets up the event listeners after the component is drawn.\n */\n afterDraw() {\n this.input.addEventListener('focus', (e) => {\n this.labelElement?.classList.add('fade');\n this.native.classList.add('focused');\n });\n\n this.input.addEventListener('blur', (e) => {\n this.native.classList.remove('focused');\n if (!e.target.value) this.labelElement?.classList.remove('fade');\n });\n\n this.addEventListener('wje-option:change', this.optionChange);\n\n this.clear?.addEventListener('wje-button:click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n this.selectedOptions = [];\n\n this.getAllOptions().forEach((option) => {\n option.selected = false;\n option.removeAttribute('selected');\n });\n this.selections();\n\n e.stopPropagation();\n });\n\n this.selectedOptions = this.getSelectedOptions();\n this.selections(true);\n\n this.list.addEventListener('wje-options:load', (e) => {\n // todo select options from this.selectedOptions\n this.selectedOptions.forEach((option) => {\n this.getAllOptions().forEach((el) => {\n if (el.value === option.value) {\n el.selected = true;\n el.setAttribute('selected', '');\n }\n });\n })\n\n this.list.scrollTo(0, 0);\n });\n\n // skontrolujeme ci ma select atribut find\n if (this.hasAttribute('find') && this.findEl instanceof HTMLElement) {\n event.addListener(this.findEl, 'keyup', '', (e) => {\n // contains wj-options element with options\n const optionsElement = this.querySelector('wje-options');\n if (optionsElement && optionsElement.hasAttribute('lazy')) {\n // pass search value to wj-options element and infinite scroll will handle the rest\n optionsElement.setAttribute('search', e.target.value);\n } else {\n let value = e.target.value.trim().toLowerCase();\n\n this.getAllOptions().forEach((option) => {\n if (option.textContent.trim().toLowerCase().includes(value)) option.style.display = 'block';\n else option.style.display = 'none';\n });\n }\n });\n }\n }\n\n /**\n * Handles the option change event.\n * @param {Event} e The event.\n */\n optionChange = (e) => {\n e.stopPropagation()\n e.stopImmediatePropagation()\n\n let allOptions = this.getAllOptions();\n\n if (!this.hasAttribute('multiple')) {\n allOptions.forEach((option) => {\n if (option.value === e.target.value) {\n this.processClickedOption(option);\n } else {\n option.selected = false;\n option.removeAttribute('selected');\n }\n });\n this.popup.hide(false);\n } else {\n this.processClickedOption(e.target, true);\n }\n\n this.selections();\n };\n\n /**\n * Handles the selection and deselection of an option element.\n * @param {HTMLElement} option The option element that was clicked.\n * @param {boolean} [multiple] Indicates whether multiple selection is allowed.\n */\n processClickedOption = (option, multiple = false) => {\n const isSelected = option.hasAttribute(\"selected\")\n option.selected = !isSelected;\n\n if (isSelected) {\n option.removeAttribute('selected');\n this.filterOutOption(option);\n } else {\n option.setAttribute('selected', '');\n this.selectedOptions = multiple ? [...this.selectedOptions, option] : [option];\n }\n }\n\n /**\n * Filters out a specified option from the `selectedOptions` array.\n * This function removes an option from the `selectedOptions` array if its value\n * matches the value of the option provided as an argument. It allows for dynamically\n * updating the selected options by excluding the specified option.\n * @param {object} option The option to be removed from the `selectedOptions` array.\n * Should be an object containing a `value` property that is compared to the\n * `value` property of objects in the `selectedOptions` array.\n */\n filterOutOption = (option) => {\n this.selectedOptions = this.selectedOptions.filter((sOption) => {\n return sOption.value !== option.value;\n });\n }\n\n /**\n * Returns all the options as HTML.\n * @returns {NodeList} The options as HTML.\n */\n getAllOptions() {\n return this.querySelectorAll('wje-option');\n }\n\n /**\n * Returns the selected options as HTML.\n * @returns {NodeList} The selected options as HTML.\n */\n getSelectedOptions() {\n return Array.from(this.querySelectorAll('wje-option[selected]'));\n }\n\n /**\n * Returns the selected options.\n * @returns {Array} The selected options.\n */\n getSelected() {\n return this.selectedOptions.map((option) => {\n return {\n value: option.value,\n text: option.textContent.trim(),\n };\n });\n }\n\n /**\n * Handles the selection change.\n * @param {Element} option The option that changed.\n * @param {number} length The length of the selected options.\n */\n selectionChanged(option = null, length = 0) {\n console.log(\"TU TU TU:\",option, length);\n if (this.hasAttribute('multiple')) {\n this.value = this.selectedOptions.map((el) => el.value).reverse();\n\n if (this.placeholder && length === 0) {\n this.chips.innerHTML = this.placeholder;\n this.input.value = '';\n } else {\n if (option !== null) {\n this.chips.append(this.getChip(option));\n }\n if (this.counterEl instanceof HTMLElement || this.counterEl || length > this.maxOptions && this.chips.querySelectorAll('wje-chip').length >= this.maxOptions) {\n this.counter();\n }\n }\n } else {\n console.log(\"TU SOM 6\");\n let value = option?.textContent.trim() || '';\n this.value = this.selectedOptions?.map((el) => el.value)?.at(0);\n this.input.value = value;\n\n if (option && option instanceof HTMLElement) {\n this.slotStart.innerHTML = '';\n\n let optionSlotStart = option?.querySelector('wje-option > [slot=start]');\n if (optionSlotStart) {\n this.slotStart.appendChild(optionSlotStart.cloneNode(true));\n }\n\n this.slotEnd.innerHTML = '';\n\n let optionSlotEnd = option?.querySelector('wje-option > [slot=end]');\n if (optionSlotEnd) {\n this.slotEnd.appendChild(optionSlotEnd.cloneNode(true));\n }\n }\n }\n }\n\n /**\n * Handles the selection of options and updates the UI chips accordingly.\n * Also manages the max selection logic and fires an event when selections change.\n * @param {boolean} [silence] Indicates whether to suppress the event dispatch when a change occurs.\n * @returns {void} Does not return anything.\n */\n selections(silence = false) {\n let chips = Array.from(this.chips.querySelectorAll('wje-chip'));\n\n if (this.selectedOptions.length > 0) {\n console.log(\"SOM TU 1\");\n if(this.counterEl && this.selectedOptions.length >= this.maxOptions && this.areAllElementsInOptions(chips, this.selectedOptions)) {\n console.log(\"TU SOM 3\");\n this.counter();\n } else {\n console.log(\"TU SOM 4\");\n this.counterEl = null;\n this.chips.innerHTML = '';\n console.log(\"TU SOM 5\", this.maxOptions);\n for(let i = 0; i < this.maxOptions; i++) {\n this.selectionChanged(this.selectedOptions.at(i), this.selectedOptions.length);\n }\n }\n } else {\n console.log(\"SOM TU 2\");\n this.selectionChanged();\n }\n\n if (silence) return;\n event.dispatchCustomEvent(this, 'wje-select:change');\n }\n\n /**\n * Manages the display of a counter element to indicate the number of items exceeding the maximum allowed options.\n * - If the number of selected items equals the maximum allowed, the counter element is removed.\n * - If the counter element doesn't exist and the number of items exceeds the maximum, it is created and updated.\n */\n counter() {\n // zmazanie counter (span)\n if (this.counterEl && this.value.length === +this.maxOptions) {\n this.counterEl.remove();\n this.counterEl = null;\n return;\n }\n\n // ak counter nie je, tak ho vytvorime\n if (!this.counterEl) {\n this.counterEl = document.createElement('span');\n this.counterEl.classList.add('counter');\n\n this.chips.appendChild(this.counterEl);\n }\n\n // nastavime hodnotu counter\n this.counterEl.innerText = `+${this.value.length - +this.maxOptions}`;\n }\n\n /**\n * Returns a chip element.\n * @param {Element} option The option to get the chip for.\n * @returns {Element} The chip element.\n */\n getChip(option) {\n let chip = document.createElement('wje-chip');\n chip.size = 'small';\n chip.removable = true;\n chip.round = true;\n chip.addEventListener('wje:chip-remove', this.removeChip);\n chip.option = option;\n\n let label = document.createElement('wje-label');\n label.innerText = option.textContent.trim();\n\n chip.appendChild(label);\n\n return chip;\n }\n\n /**\n * Handles the chip remove event.\n * @param {Event} e The event.\n */\n removeChip = (e) => {\n e.target.parentNode.removeChild(e.target);\n this.processClickedOption(e.target.option, true);\n this.selections();\n };\n\n /**\n * Generates an HTML option element based on the provided item and mapping.\n * @param {object} item The item to generate the option for.\n * @param {object} [map] The mapping object that specifies the properties of the item to use for the option's value and text.\n * @param {string} [map.value] The property of the item to use for the option's value.\n * @param {string} [map.text] The property of the item to use for the option's text.\n * @returns {HTMLElement} The generated HTML option element.\n */\n htmlOption(item, map = { value: 'value', text: 'text' }) {\n let option = document.createElement('wje-option');\n\n if (item[map.value] === null) {\n console.warn(`The item ${JSON.stringify(item)} does not have the property ${map.value}`);\n }\n\n if (item[map.text] === null) {\n console.warn(`The item ${JSON.stringify(item)} does not have the property ${map.text}`);\n }\n\n option.setAttribute('value', item[map.value] ?? '');\n option.innerText = item[map.text] ?? '';\n return option;\n }\n\n /**\n * Adds an option to the select element.\n * @param {any} optionData The data for the option to be added.\n * @param {boolean} [silent] Whether to suppress any events triggered by the addition of the option.\n * @param {object} [map] The mapping object specifying the properties of the option data to be used for the value and text of the option.\n */\n addOption(optionData, silent = false, map = { value: 'value', text: 'text' }) {\n if (!optionData) return;\n\n const optionsElement = this.querySelector('wje-options');\n if (optionsElement) {\n optionsElement.addOption(optionData, silent, map);\n return;\n }\n\n let option = this.htmlOption(optionData, map);\n this.appendChild(option);\n }\n\n /**\n * Adds options to the select element.\n * @param {Array | object} optionsData The options data to be added. Can be an array of objects or a single object.\n * @param {boolean} [silent] Indicates whether to trigger events when adding options. Default is false.\n * @param {object} [map] The mapping object that specifies the properties of the options data object. Default is { value: \"value\", text: \"text\" }.\n */\n addOptions(optionsData, silent = false, map = { value: 'value', text: 'text' }) {\n if (!Array.isArray(optionsData)) {\n this.addOption(optionsData, silent, map);\n } else {\n const optionsElement = this.querySelector('wje-options');\n if (optionsElement) {\n optionsElement.addOptions(optionsData, silent, map);\n return;\n }\n\n optionsData.forEach((item) => {\n this.addOption(item, silent, map);\n });\n }\n }\n\n /**\n * Selects an option with the specified value.\n * @param {string} value The value of the option to be selected.\n * @param {boolean} [silent] Whether to suppress firing events.\n */\n selectOption(value, silent = false) {\n if (!value) return;\n\n let option = this.querySelector(`wje-option[value=\"${value}\"]`);\n\n if (option) {\n this.processClickedOption(option, this.hasAttribute('multiple'));\n }\n\n if (this.drawingStatus > this.drawingStatuses.START) this.selections(silent);\n }\n\n /**\n * Selects one or multiple options in the select element.\n * @param {Array|any} values The value(s) of the option(s) to be selected.\n * @param {boolean} [silent] Whether to trigger the change event or not.\n */\n selectOptions(values, silent = false) {\n if (!Array.isArray(values)) {\n this.selectOption(values, silent);\n } else {\n values.forEach((value) => {\n this.selectOption(value, silent);\n });\n }\n }\n\n /**\n * @summary Callback function that is called when the custom element is associated with a form.\n * This function adds an event listener to the form's submit event, which validates the input and propagates the validation.\n * @param {HTMLFormElement} form The form the custom element is associated with.\n */\n formAssociatedCallback(form) {\n if (form) {\n this.internals.setFormValue(this.value);\n }\n }\n\n /**\n * The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.\n * This method is responsible for resetting the value of the custom input element to its default value.\n * It also resets the form value and validity state in the form internals.\n * @function\n */\n formResetCallback() {\n // Set the value of the custom input element to its default value\n this.value = this.defaultValue;\n // Reset the form value in the form internals to the default value\n this.internals.setFormValue(this.defaultValue);\n // Reset the validity state in the form internals\n this.internals.setValidity({});\n }\n\n /**\n * The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.\n * This method is responsible for restoring the value of the custom input element to its saved state.\n * It also restores the form value and validity state in the form internals to their saved states.\n * @param {object} state The saved state of the custom input element.\n * @function\n */\n formStateRestoreCallback(state) {\n // Set the value of the custom input element to its saved value\n this.value = state.value;\n // Restore the form value in the form internals to the saved value\n this.internals.setFormValue(state.value);\n // Restore the validity state in the form internals to the saved state\n this.internals.setValidity({});\n }\n\n /**\n * The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.\n * This method is responsible for saving the value of the custom input element.\n * @returns {object} The saved state of the custom input element.\n * @function\n */\n formStateSaveCallback() {\n return {\n value: this.value,\n };\n }\n\n /**\n * The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.\n * This method is not implemented yet.\n * @param {boolean} disabled The new disabled state of the custom input element.\n * @function\n */\n formDisabledCallback(disabled) {\n console.warn('formDisabledCallback not implemented yet');\n this.native?.classList.toggle('disabled', disabled);\n this.toggleAttribute('disabled', disabled);\n }\n\n /**\n * Checks if all elements in the `elements` array are present in the `options` array based on their `option` property.\n * @param {Array} elements The array of elements to check. Each element should have an `option` property.\n * @param {Array} options The array of options to verify against.\n * @returns {boolean} Returns true if all elements in the `elements` array are found within the `options` array, otherwise returns false.\n */\n areAllElementsInOptions(elements, options) {\n if (elements.length === 0) return false;\n\n return elements.every(el =>\n options.some(opt => JSON.stringify(opt) === JSON.stringify(el.option))\n );\n }\n}\n","import Select from './select.element.js';\n\nexport default Select;\n\nSelect.define('wje-select', Select);\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;AAyCe,MAAM,eAAe,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW1C,cAAc;AACV,UAAO;AA+GX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAAe;AAAA,MACX,cAAc;AAAA,MACd,aAAa;AAAA,MACb,YAAY;AAAA,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AAK,UAAU,GAAG,MAAM,CAAC;AAAA,IACtE;AAAA,EACT;AACA;AAAA;AAAA;AAAA;AAAA;AA/mBI,cAjViB,QAiVV,kBAAiB;ACtX5B,OAAO,OAAO,cAAc,MAAM;"}
|
|
1
|
+
{"version":3,"file":"wje-select.js","sources":["../packages/wje-select/select.element.js","../packages/wje-select/select.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport Button from '../wje-button/button.js';\nimport Popup from '../wje-popup/popup.js';\nimport Icon from '../wje-icon/icon.js';\nimport Label from '../wje-label/label.js';\nimport Chip from '../wje-chip/chip.js';\nimport Input from '../wje-input/input.js';\nimport Option from '../wje-option/option.js';\nimport Options from '../wje-options/options.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Select` is a custom web component that represents a select input.\n * @summary This element represents a select input.\n * @documentation https://elements.webjet.sk/components/select\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the select.\n * @slot anchor - The slot for the anchor.\n * @slot arrow - The slot for the arrow.\n * @csspart native - The native select wrapper.\n * @csspart input - The input field.\n * @csspart clear - The clear button.\n * @property {Array} _selected - An array to store selected items.\n * @property {HTMLElement|null} counterEl - A reference to the counter element, initially null.\n * @property {ElementInternals} internals - The internal element API for managing state and attributes.\n * @property {number} maxOptions - The maximum number of options allowed.\n * @property {boolean} _wasOppened - Tracks whether the select element was previously opened, initially false.\n * @cssproperty [--wje-select-border-width=1px] - Specifies the width of the border around the select component. Accepts any valid CSS length unit (e.g., `px`, `rem`, `em`).\n * @cssproperty [--wje-select-border-style=solid] - Defines the style of the border for the select component. Accepts standard CSS border styles, such as `solid`, `dashed`, or `dotted`.\n * @cssproperty [--wje-select-border-color=var(--wje-border-color)] - Sets the color of the border for the select component. Accepts any valid CSS color value, including color variables, named colors, and hex values.\n * @cssproperty [--wje-select-options-border-width=1px] - Specifies the width of the border for the select options dropdown. Accepts any valid CSS length unit.\n * @cssproperty [--wje-select-options-border-style=var(--wje-border-style)] - Defines the border style for the select options dropdown. Inherits from a defined CSS variable for consistency.\n * @cssproperty [--wje-select-options-border-color=var(--wje-border-color)] - Sets the border color for the select options dropdown. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-background=var(--wje-background)] - Specifies the background color of the select component. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-line-height=20px] - Defines the line height for the text within the select component. Accepts any valid CSS length value, ensuring consistent vertical alignment.\n * @cssproperty [--wje-select-color=var(--wje-color)] - Sets the text color for the select component. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-border-radius=var(--wje-border-radius-medium)] - Specifies the border radius for the select component.Determines the roundness of the corners and accepts any valid CSS length unit or variable.\n * @tag wje-select\n */\n\nexport default class Select extends WJElement {\n\t/**\n\t * Constructor for the Select class.\n\t * @class\n\t * @description Initializes the Select component.\n\t * This constructor sets up the initial state of the component, including selected items, counter element, and internal element API.\n\t * It also tracks whether the select element was previously opened.\n\t * @class\n\t * @augments {WJElement}\n\t * @memberof Select\n\t */\n\tconstructor() {\n\t\tsuper();\n\n\t\t/**\n\t\t * @type {Array}\n\t\t * @description An array to store selected items.\n\t\t */\n\t\tthis._selected = [];\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the counter element, initially null.\n\t\t * @private\n\t\t */\n\t\tthis.counterEl = null;\n\n\t\t/**\n\t\t * @type {ElementInternals}\n\t\t * @description The internal element API for managing state and attributes.\n\t\t * @private\n\t\t * @readonly\n\t\t * @constant\n\t\t * @default {ElementInternals} this.attachInternals()\n\t\t * @description Attaches the internals to the element.\n\t\t */\n\t\tthis.internals = this.attachInternals();\n\n\t\t/**\n\t\t * @type {boolean}\n\t\t * @description Tracks whether the select element was previously opened, initially false.\n\t\t * @private\n\t\t * @default {boolean} false\n\t\t */\n\t\tthis._wasOppened = false;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the native select element, initially null.\n\t\t */\n\t\tthis.native = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the popup element, initially null.\n\t\t */\n\t\tthis.popup = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the label element, initially null.\n\t\t */\n\t\tthis.labelElement = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the slot start element, initially null.\n\t\t */\n\t\tthis.slotStart = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the slot end element, initially null.\n\t\t */\n\t\tthis.slotEnd = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the input element, initially null.\n\t\t */\n\t\tthis.input = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the options wrapper element, initially null.\n\t\t */\n\t\tthis.optionsWrapper = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the chips element, initially null.\n\t\t */\n\t\tthis.chips = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the clear button element, initially null.\n\t\t */\n\t\tthis.clear = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the list element, initially null.\n\t\t */\n\t\tthis.list = null;\n\n\t\tthis.selectedOptions = []\n\t}\n\n\t/**\n\t * An object representing component dependencies with their respective classes.\n\t * Each property in the object maps a custom component name (as a string key)\n\t * to its corresponding class or constructor.\n\t * @typedef {{[key: string]: Function}} Dependencies\n\t * @property {Function} 'wje-button' Represents the Button component class.\n\t * @property {Function} 'wje-popup' Represents the Popup component class.\n\t * @property {Function} 'wje-icon' Represents the Icon component class.\n\t * @property {Function} 'wje-label' Represents the Label component class.\n\t * @property {Function} 'wje-chip' Represents the Chip component class.\n\t * @property {Function} 'wje-input' Represents the Input component class.\n\t * @property {Function} 'wje-option' Represents the Option component class.\n\t * @property {Function} 'wje-options' Represents the Options component class.\n\t */\n\tdependencies = {\n\t\t'wje-button': Button,\n\t\t'wje-popup': Popup,\n\t\t'wje-icon': Icon,\n\t\t'wje-label': Label,\n\t\t'wje-chip': Chip,\n\t\t'wje-input': Input,\n\t\t'wje-option': Option,\n\t\t'wje-options': Options,\n\t};\n\n\t/**\n\t * Setter for the value attribute.\n\t * @param {string} value The value to set.\n\t */\n\tset value(value) {\n\t\tif (this.hasAttribute('multiple')) {\n\t\t\tconst formData = new FormData();\n\t\t\tvalue.forEach(v => formData.append(this.name, v));\n\t\t\tthis.internals.setFormValue(formData);\n\t\t} else {\n\t\t\tthis.internals.setFormValue(value);\n\t\t}\n\t}\n\n\t/**\n\t * Getter for the value attribute.\n\t * @returns {object} The value of the attribute.\n\t */\n\tget value() {\n\t\treturn this.selected;\n\t}\n\n\t/**\n\t * Getter for the customErrorDisplay attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget customErrorDisplay() {\n\t\treturn this.hasAttribute('custom-error-display');\n\t}\n\n\t/**\n\t * Getter for the validateOnChange attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget validateOnChange() {\n\t\treturn this.hasAttribute('validate-on-change');\n\t}\n\n\t/**\n\t * Getter for the invalid attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget invalid() {\n\t\treturn this.hasAttribute('invalid');\n\t}\n\n\t/**\n\t * Setter for the invalid attribute.\n\t * @param {boolean} isInvalid Whether the input is invalid.\n\t */\n\tset invalid(isInvalid) {\n\t\tif (isInvalid) this.setAttribute('invalid', '');\n\t\telse this.removeAttribute('invalid');\n\t}\n\n\t/**\n\t * Sets the maximum number of options allowed.\n\t * @param {string | number | null} value The value to set as the maximum number of options.\n\t * If null, the 'max-options' attribute will be removed.\n\t */\n\tset maxOptions(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('max-options', value);\n\t\t} else {\n\t\t\tthis.removeAttribute('max-options');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the maximum number of options allowed.\n\t * Parses the value of the 'max-options' attribute from the element and converts it to a number.\n\t * If the attribute is not present or cannot be converted to a valid number, defaults to 1.\n\t * @returns {number} The maximum number of options, or 0 if the attribute is not set or invalid.\n\t */\n\tget maxOptions() {\n\t\treturn +this.getAttribute('max-options') || 1;\n\t}\n\n\t/**\n\t * Getter for the form attribute.\n\t * @returns {HTMLFormElement} The form the input is associated with.\n\t */\n\tget form() {\n\t\treturn this.internals.form;\n\t}\n\n\t/**\n\t * Getter for the name attribute.\n\t * @returns {string} The name of the input.\n\t */\n\tget name() {\n\t\treturn this.getAttribute('name');\n\t}\n\n\t/**\n\t * Getter for the type attribute.\n\t * @returns {string} The type of the input.\n\t */\n\tget type() {\n\t\treturn this.localName;\n\t}\n\n\t/**\n\t * Getter for the validity attribute.\n\t * @returns {ValidityState} The validity state of the input.\n\t */\n\tget validity() {\n\t\treturn this.internals.validity;\n\t}\n\n\t/**\n\t * Getter for the validationMessage attribute.\n\t * @returns {string} The validation message of the input.\n\t */\n\tget validationMessage() {\n\t\treturn this.internals.validationMessage;\n\t}\n\n\t/**\n\t * Getter for the willValidate attribute.\n\t * @returns {boolean} Whether the input will be validated.\n\t */\n\tget willValidate() {\n\t\treturn this.internals.willValidate;\n\t}\n\n\t/**\n\t * @summary Getter for the defaultValue attribute.\n\t * This method retrieves the 'value' attribute of the custom input element.\n\t * The 'value' attribute represents the default value of the input element.\n\t * If the 'value' attribute is not set, it returns an empty string.\n\t * @returns {string} The default value of the input element.\n\t */\n\tget defaultValue() {\n\t\treturn this.getAttribute('value') ?? '';\n\t}\n\n\t/**\n\t * @summary Setter for the defaultValue attribute.\n\t * This method sets the 'value' attribute of the custom input element to the provided value.\n\t * The 'value' attribute represents the default value of the input element.\n\t * @param {string} value The value to set as the default value.\n\t */\n\tset defaultValue(value) {\n\t\tthis.setAttribute('value', value);\n\t}\n\n\t/**\n\t * Sets the label value.\n\t * @param {Array} value The selected value to set.\n\t */\n\tset selected(value) {\n\t\tthis._selected = value;\n\t}\n\n\t/**\n\t * Returns the selected value.\n\t * @returns {Array} The selected value.\n\t */\n\tget selected() {\n\t\treturn this.getSelected();\n\t}\n\n\t/**\n\t * Sets the trigger value.\n\t * @param {string} value The trigger value to set.\n\t */\n\tset trigger(value) {\n\t\tthis.setAttribute('trigger', value);\n\t}\n\n\t/**\n\t * Returns the trigger value.\n\t * @returns {string} The trigger value.\n\t */\n\tget trigger() {\n\t\treturn this.getAttribute('trigger') || 'click';\n\t}\n\n\tclassName = 'Select';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet}\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Returns the list of attributes to observe for changes.\n\t * @static\n\t * @returns {Array<string>}\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['active', 'value', 'disabled', 'multiple', 'label', 'placeholder', 'max-height', 'max-options', 'variant', 'placement'];\n\t}\n\n\t/**\n\t * Whether the input is associated with a form.\n\t * @type {boolean}\n\t */\n\tstatic formAssociated = true;\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t}\n\n\t/**\n\t * Draws the component for the select.\n\t * @returns {DocumentFragment}\n\t */\n\tdraw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tthis.classList.add('wje-placement', this.placement ? 'wje-' + this.placement : 'wje-start');\n\n\t\t// zakladny obalovac\n\t\tlet native = document.createElement('div');\n\t\tnative.setAttribute('part', 'native');\n\t\tnative.classList.add('native-select', this.variant || 'default');\n\n\t\t// wrapper pre label a inputWrapper\n\t\tlet wrapper = document.createElement('div');\n\t\twrapper.classList.add('wrapper');\n\t\twrapper.setAttribute('slot', 'anchor');\n\n\t\t// label\n\t\tlet label = document.createElement('wje-label');\n\t\tlabel.setAttribute('part', 'label');\n\t\tlabel.innerText = this.label || '';\n\n\t\t// obalovac pre input\n\t\tlet inputWrapper = document.createElement('div');\n\t\tinputWrapper.setAttribute('part', 'input-wrapper');\n\t\tinputWrapper.classList.add('input-wrapper');\n\n\t\tlet slotStart = document.createElement('div');\n\t\tslotStart.classList.add('slot-start');\n\n\t\tlet input = document.createElement('input');\n\t\tinput.setAttribute('type', 'text');\n\t\tinput.setAttribute('part', 'input');\n\t\tinput.setAttribute('autocomplete', 'off');\n\t\tinput.setAttribute('readonly', '');\n\t\tinput.setAttribute('placeholder', this.placeholder || '');\n\n\t\tlet slotEnd = document.createElement('div');\n\t\tslotEnd.classList.add('slot-end');\n\n\t\tlet arrow = document.createElement('wje-icon');\n\t\tarrow.setAttribute('name', 'chevron-down');\n\t\tarrow.setAttribute('slot', 'arrow');\n\n\t\tlet chips = document.createElement('div');\n\t\tchips.classList.add('chips');\n\t\tchips.innerText = this.placeholder || '';\n\n\t\t// obalovac pre option a find\n\t\tlet optionsWrapper = document.createElement('div');\n\t\toptionsWrapper.setAttribute('part', 'options-wrapper');\n\t\toptionsWrapper.classList.add('options-wrapper');\n\t\toptionsWrapper.style.setProperty('height', this.maxHeight || 'auto');\n\n\t\tlet list = document.createElement('div');\n\t\tlist.classList.add('list');\n\n\t\tlet slot = document.createElement('slot');\n\n\t\tlet clear = document.createElement('wje-button');\n\t\tclear.setAttribute('fill', 'link');\n\t\tclear.setAttribute('part', 'clear');\n\t\tclear.setAttribute('stop-propagation', '');\n\n\t\tlet clearIcon = document.createElement('wje-icon');\n\t\tclearIcon.setAttribute('name', 'x');\n\n\t\tclear.appendChild(clearIcon);\n\n\t\t// vytvorime popup\n\t\tlet popup = document.createElement('wje-popup');\n\t\tpopup.setAttribute('placement', 'bottom-start');\n\t\tpopup.setAttribute('manual', '');\n\t\tpopup.setAttribute('size', '');\n\t\tpopup.setAttribute('part', 'popup');\n\n\t\tif (this.hasAttribute('disabled')) popup.setAttribute('disabled', '');\n\n\t\tif (this.variant === 'standard') {\n\t\t\tif (this.hasAttribute('label')) native.appendChild(label);\n\t\t} else {\n\t\t\twrapper.appendChild(label);\n\t\t}\n\n\t\tinputWrapper.appendChild(slotStart);\n\t\tinputWrapper.appendChild(input);\n\t\tif (this.hasAttribute('multiple')) inputWrapper.appendChild(chips);\n\n\t\tif (this.hasAttribute('clearable')) inputWrapper.appendChild(clear);\n\n\t\tinputWrapper.appendChild(slotEnd);\n\t\tinputWrapper.appendChild(arrow);\n\n\t\tlist.appendChild(slot);\n\n\t\tif (this.hasAttribute('find')) {\n\t\t\tlet find = document.createElement('wje-input');\n\t\t\tfind.setAttribute('variant', 'standard');\n\t\t\tfind.setAttribute('placeholder', 'Hľadať');\n\t\t\tfind.setAttribute('part', 'find');\n\t\t\tfind.classList.add('find');\n\n\t\t\toptionsWrapper.appendChild(find);\n\n\t\t\tthis.findEl = find;\n\t\t}\n\n\t\tif (this.hasAttribute('lazy')) {\n\t\t\tevent.addListener(popup, 'wje-popup:show', null, (e) => {\n\t\t\t\tif (this._wasOppened) return;\n\t\t\t\tthis._wasOppened = true;\n\n\t\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\t\toptionsElement.setAttribute('lazy', '');\n\t\t\t\toptionsElement.setAttribute('attached', '');\n\t\t\t});\n\t\t} else {\n\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\toptionsElement?.setAttribute('attached', '');\n\t\t}\n\n\t\toptionsWrapper.appendChild(list);\n\n\t\twrapper.appendChild(inputWrapper);\n\t\tpopup.appendChild(optionsWrapper);\n\t\tpopup.appendChild(wrapper);\n\n\t\tif (this.trigger === 'click') popup.setAttribute('manual', '');\n\n\t\tnative.appendChild(popup);\n\n\t\tthis.native = native;\n\t\tthis.popup = popup;\n\t\tthis.labelElement = label;\n\t\tthis.slotStart = slotStart;\n\t\tthis.slotEnd = slotEnd;\n\t\tthis.input = input;\n\t\tthis.optionsWrapper = optionsWrapper;\n\t\tthis.chips = chips;\n\t\tthis.clear = clear;\n\t\tthis.list = list;\n\n\t\tfragment.appendChild(native);\n\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Sets up the event listeners after the component is drawn.\n\t */\n\tafterDraw() {\n\t\tthis.input.addEventListener('focus', (e) => {\n\t\t\tthis.labelElement?.classList.add('fade');\n\t\t\tthis.native.classList.add('focused');\n\t\t});\n\n\t\tthis.input.addEventListener('blur', (e) => {\n\t\t\tthis.native.classList.remove('focused');\n\t\t\tif (!e.target.value) this.labelElement?.classList.remove('fade');\n\t\t});\n\n\t\tthis.addEventListener('wje-option:change', this.optionChange);\n\n\t\tthis.clear?.addEventListener('wje-button:click', (e) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.selectedOptions = [];\n\n\t\t\tthis.getAllOptions().forEach((option) => {\n\t\t\t\toption.selected = false;\n\t\t\t\toption.removeAttribute('selected');\n\t\t\t});\n\t\t\tthis.selections();\n\n\t\t\te.stopPropagation();\n\t\t});\n\n\t\tthis.selectedOptions = this.getSelectedOptions();\n\t\tthis.selections(true);\n\n\t\tthis.list.addEventListener('wje-options:load', (e) => {\n\t\t\t// todo select options from this.selectedOptions\n\t\t\tthis.selectedOptions.forEach((option) => {\n\t\t\t\tthis.getAllOptions().forEach((el) => {\n\t\t\t\t\tif (el.value === option.value) {\n\t\t\t\t\t\tel.selected = true;\n\t\t\t\t\t\tel.setAttribute('selected', '');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t})\n\n\t\t\tthis.list.scrollTo(0, 0);\n\t\t});\n\n\t\t// skontrolujeme ci ma select atribut find\n\t\tif (this.hasAttribute('find') && this.findEl instanceof HTMLElement) {\n\t\t\tevent.addListener(this.findEl, 'keyup', '', (e) => {\n\t\t\t\t// contains wj-options element with options\n\t\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\t\tif (optionsElement && optionsElement.hasAttribute('lazy')) {\n\t\t\t\t\t// pass search value to wj-options element and infinite scroll will handle the rest\n\t\t\t\t\toptionsElement.setAttribute('search', e.target.value);\n\t\t\t\t} else {\n\t\t\t\t\tlet value = e.target.value.trim().toLowerCase();\n\n\t\t\t\t\tthis.getAllOptions().forEach((option) => {\n\t\t\t\t\t\tif (option.textContent.trim().toLowerCase().includes(value)) option.style.display = 'block';\n\t\t\t\t\t\telse option.style.display = 'none';\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Handles the option change event.\n\t * @param {Event} e The event.\n\t */\n\toptionChange = (e) => {\n\t\te.stopPropagation()\n\t\te.stopImmediatePropagation()\n\n\t\tlet allOptions = this.getAllOptions();\n\n\t\tif (!this.hasAttribute('multiple')) {\n\t\t\tallOptions.forEach((option) => {\n\t\t\t\tif (option.value === e.target.value) {\n\t\t\t\t\tthis.processClickedOption(option);\n\t\t\t\t} else {\n\t\t\t\t\toption.selected = false;\n\t\t\t\t\toption.removeAttribute('selected');\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.popup.hide(false);\n\t\t} else {\n\t\t\tthis.processClickedOption(e.target, true);\n\t\t}\n\n\t\tthis.selections();\n\t};\n\n\t/**\n\t * Handles the selection and deselection of an option element.\n\t * @param {HTMLElement} option The option element that was clicked.\n\t * @param {boolean} [multiple] Indicates whether multiple selection is allowed.\n\t */\n\tprocessClickedOption = (option, multiple = false) => {\n\t\tconst isSelected = option.hasAttribute(\"selected\")\n\t\toption.selected = !isSelected;\n\n\t\tif (isSelected) {\n\t\t\toption.removeAttribute('selected');\n\t\t\tthis.filterOutOption(option);\n\t\t} else {\n\t\t\toption.setAttribute('selected', '');\n\t\t\tthis.selectedOptions = multiple ? [...this.selectedOptions, option] : [option];\n\t\t}\n\t}\n\n\t/**\n\t * Filters out a specified option from the `selectedOptions` array.\n\t * This function removes an option from the `selectedOptions` array if its value\n\t * matches the value of the option provided as an argument. It allows for dynamically\n\t * updating the selected options by excluding the specified option.\n\t * @param {object} option The option to be removed from the `selectedOptions` array.\n\t * Should be an object containing a `value` property that is compared to the\n\t * `value` property of objects in the `selectedOptions` array.\n\t */\n\tfilterOutOption = (option) => {\n\t\tthis.selectedOptions = this.selectedOptions.filter((sOption) => {\n\t\t\treturn sOption.value !== option.value;\n\t\t});\n\t}\n\n\t/**\n\t * Returns all the options as HTML.\n\t * @returns {NodeList} The options as HTML.\n\t */\n\tgetAllOptions() {\n\t\treturn this.querySelectorAll('wje-option');\n\t}\n\n\t/**\n\t * Returns the selected options as HTML.\n\t * @returns {NodeList} The selected options as HTML.\n\t */\n\tgetSelectedOptions() {\n\t\treturn Array.from(this.querySelectorAll('wje-option[selected]'));\n\t}\n\n\t/**\n\t * Returns the selected options.\n\t * @returns {Array} The selected options.\n\t */\n\tgetSelected() {\n\t\treturn this.selectedOptions.map((option) => {\n\t\t\treturn {\n\t\t\t\tvalue: option.value,\n\t\t\t\ttext: option.textContent.trim(),\n\t\t\t};\n\t\t});\n\t}\n\n\t/**\n\t * Handles the selection change.\n\t * @param {Element} option The option that changed.\n\t * @param {number} length The length of the selected options.\n\t */\n\tselectionChanged(option = null, length = 0) {\n\t\tif (this.hasAttribute('multiple')) {\n\t\t\tthis.value = this.selectedOptions.map((el) => el.value).reverse();\n\n\t\t\tif (this.placeholder && length === 0) {\n\t\t\t\tthis.chips.innerHTML = this.placeholder;\n\t\t\t\tthis.input.value = '';\n\t\t\t} else {\n\t\t\t\tif (option !== null) this.chips.appendChild(this.getChip(option));\n\t\t\t\tif (this.counterEl instanceof HTMLElement || !this.maxOptions || length > +this.maxOptions) {\n\t\t\t\t\tthis.counter();\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tlet value = option?.textContent.trim() || '';\n\t\t\tthis.value = this.selectedOptions?.map((el) => el.value)?.at(0);\n\t\t\tthis.input.value = value;\n\n\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\tthis.slotStart.innerHTML = '';\n\n\t\t\t\tlet optionSlotStart = option?.querySelector('wje-option > [slot=start]');\n\t\t\t\tif (optionSlotStart) {\n\t\t\t\t\tthis.slotStart.appendChild(optionSlotStart.cloneNode(true));\n\t\t\t\t}\n\n\t\t\t\tthis.slotEnd.innerHTML = '';\n\n\t\t\t\tlet optionSlotEnd = option?.querySelector('wje-option > [slot=end]');\n\t\t\t\tif (optionSlotEnd) {\n\t\t\t\t\tthis.slotEnd.appendChild(optionSlotEnd.cloneNode(true));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Updates the selected options and their corresponding chips.\n\t * @param {boolean} [silence] Determines whether to suppress the \"wje-select:change\" event.\n\t * @returns {void}\n\t * @description\n\t * This method fetches the currently selected options and updates the `selectedOptions` array.\n\t * It clears and rebuilds the chips representing the selected items in the UI.\n\t * If the number of selected options reaches the maximum allowed (`maxOptions`), it stops updating the counter.\n\t * Optionally, it dispatches a custom event when the selection changes unless `silence` is set to `true`.\n\t * //@fires wje-select:change - Dispatched when the selection changes, unless `silence` is `true`.\n\t * @example\n\t * // Call the method and allow event dispatch\n\t * selections();\n\t * @example\n\t * // Call the method without dispatching the event\n\t * selections(true);\n\t */\n\tselections(silence = false) {\n\t\tif (this.selectedOptions.length >= +this.maxOptions) {\n\t\t\tthis.counterEl = null;\n\t\t}\n\n\t\tif (this.chips) {\n\t\t\tthis.chips.innerHTML = '';\n\t\t}\n\n\t\tif (this.selectedOptions.length > 0) {\n\t\t\tthis.selectionChanged(this.selectedOptions.at(0), this.selectedOptions.length);\n\n\t\t} else {\n\t\t\tthis.selectionChanged();\n\t\t}\n\n\t\tif (silence) return;\n\t\tevent.dispatchCustomEvent(this, 'wje-select:change');\n\t}\n\n\t/**\n\t * Manages the display of a counter element to indicate the number of items exceeding the maximum allowed options.\n\t * - If the number of selected items equals the maximum allowed, the counter element is removed.\n\t * - If the counter element doesn't exist and the number of items exceeds the maximum, it is created and updated.\n\t */\n\tcounter() {\n\t\t// zmazanie counter (span)\n\t\tif (this.counterEl && this.value.length === +this.maxOptions) {\n\t\t\tthis.counterEl.remove();\n\t\t\tthis.counterEl = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// ak counter nie je, tak ho vytvorime\n\t\tif (!this.counterEl) {\n\t\t\tthis.counterEl = document.createElement('span');\n\t\t\tthis.counterEl.classList.add('counter');\n\n\t\t\tthis.chips.appendChild(this.counterEl);\n\t\t}\n\n\t\t// nastavime hodnotu counter\n\t\tthis.counterEl.innerText = `+${this.value.length - +this.maxOptions}`;\n\t}\n\n\t/**\n\t * Returns a chip element.\n\t * @param {Element} option The option to get the chip for.\n\t * @returns {Element} The chip element.\n\t */\n\tgetChip(option) {\n\t\tlet chip = document.createElement('wje-chip');\n\t\tchip.size = 'small';\n\t\tchip.removable = true;\n\t\tchip.round = true;\n\t\tchip.addEventListener('wje:chip-remove', this.removeChip);\n\t\tchip.option = option;\n\n\t\tlet label = document.createElement('wje-label');\n\t\tlabel.innerText = option.textContent.trim();\n\n\t\tchip.appendChild(label);\n\n\t\treturn chip;\n\t}\n\n\t/**\n\t * Handles the chip remove event.\n\t * @param {Event} e The event.\n\t */\n\tremoveChip = (e) => {\n\t\te.target.parentNode.removeChild(e.target);\n\t\tthis.processClickedOption(e.target.option, true);\n\t\tthis.selections();\n\t};\n\n\t/**\n\t * Generates an HTML option element based on the provided item and mapping.\n\t * @param {object} item The item to generate the option for.\n\t * @param {object} [map] The mapping object that specifies the properties of the item to use for the option's value and text.\n\t * @param {string} [map.value] The property of the item to use for the option's value.\n\t * @param {string} [map.text] The property of the item to use for the option's text.\n\t * @returns {HTMLElement} The generated HTML option element.\n\t */\n\thtmlOption(item, map = { value: 'value', text: 'text' }) {\n\t\tlet option = document.createElement('wje-option');\n\n\t\tif (item[map.value] === null) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${map.value}`);\n\t\t}\n\n\t\tif (item[map.text] === null) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${map.text}`);\n\t\t}\n\n\t\toption.setAttribute('value', item[map.value] ?? '');\n\t\toption.innerText = item[map.text] ?? '';\n\t\treturn option;\n\t}\n\n\t/**\n\t * Adds an option to the select element.\n\t * @param {any} optionData The data for the option to be added.\n\t * @param {boolean} [silent] Whether to suppress any events triggered by the addition of the option.\n\t * @param {object} [map] The mapping object specifying the properties of the option data to be used for the value and text of the option.\n\t */\n\taddOption(optionData, silent = false, map = { value: 'value', text: 'text' }) {\n\t\tif (!optionData) return;\n\n\t\tconst optionsElement = this.querySelector('wje-options');\n\t\tif (optionsElement) {\n\t\t\toptionsElement.addOption(optionData, silent, map);\n\t\t\treturn;\n\t\t}\n\n\t\tlet option = this.htmlOption(optionData, map);\n\t\tthis.appendChild(option);\n\t}\n\n\t/**\n\t * Adds options to the select element.\n\t * @param {Array | object} optionsData The options data to be added. Can be an array of objects or a single object.\n\t * @param {boolean} [silent] Indicates whether to trigger events when adding options. Default is false.\n\t * @param {object} [map] The mapping object that specifies the properties of the options data object. Default is { value: \"value\", text: \"text\" }.\n\t */\n\taddOptions(optionsData, silent = false, map = { value: 'value', text: 'text' }) {\n\t\tif (!Array.isArray(optionsData)) {\n\t\t\tthis.addOption(optionsData, silent, map);\n\t\t} else {\n\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\tif (optionsElement) {\n\t\t\t\toptionsElement.addOptions(optionsData, silent, map);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\toptionsData.forEach((item) => {\n\t\t\t\tthis.addOption(item, silent, map);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Selects an option with the specified value.\n\t * @param {string} value The value of the option to be selected.\n\t * @param {boolean} [silent] Whether to suppress firing events.\n\t */\n\tselectOption(value, silent = false) {\n\t\tif (!value) return;\n\n\t\tlet option = this.querySelector(`wje-option[value=\"${value}\"]`);\n\n\t\tif (option) {\n\t\t\tthis.processClickedOption(option, this.hasAttribute('multiple'));\n\t\t}\n\n\t\tif (this.drawingStatus > this.drawingStatuses.START) this.selections(silent);\n\t}\n\n\t/**\n\t * Selects one or multiple options in the select element.\n\t * @param {Array|any} values The value(s) of the option(s) to be selected.\n\t * @param {boolean} [silent] Whether to trigger the change event or not.\n\t */\n\tselectOptions(values, silent = false) {\n\t\tif (!Array.isArray(values)) {\n\t\t\tthis.selectOption(values, silent);\n\t\t} else {\n\t\t\tvalues.forEach((value) => {\n\t\t\t\tthis.selectOption(value, silent);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * @summary Callback function that is called when the custom element is associated with a form.\n\t * This function adds an event listener to the form's submit event, which validates the input and propagates the validation.\n\t * @param {HTMLFormElement} form The form the custom element is associated with.\n\t */\n\tformAssociatedCallback(form) {\n\t\tif (form) {\n\t\t\tthis.internals.setFormValue(this.value);\n\t\t}\n\t}\n\n\t/**\n\t * The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.\n\t * This method is responsible for resetting the value of the custom input element to its default value.\n\t * It also resets the form value and validity state in the form internals.\n\t * @function\n\t */\n\tformResetCallback() {\n\t\t// Set the value of the custom input element to its default value\n\t\tthis.value = this.defaultValue;\n\t\t// Reset the form value in the form internals to the default value\n\t\tthis.internals.setFormValue(this.defaultValue);\n\t\t// Reset the validity state in the form internals\n\t\tthis.internals.setValidity({});\n\t}\n\n\t/**\n\t * The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.\n\t * This method is responsible for restoring the value of the custom input element to its saved state.\n\t * It also restores the form value and validity state in the form internals to their saved states.\n\t * @param {object} state The saved state of the custom input element.\n\t * @function\n\t */\n\tformStateRestoreCallback(state) {\n\t\t// Set the value of the custom input element to its saved value\n\t\tthis.value = state.value;\n\t\t// Restore the form value in the form internals to the saved value\n\t\tthis.internals.setFormValue(state.value);\n\t\t// Restore the validity state in the form internals to the saved state\n\t\tthis.internals.setValidity({});\n\t}\n\n\t/**\n\t * The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.\n\t * This method is responsible for saving the value of the custom input element.\n\t * @returns {object} The saved state of the custom input element.\n\t * @function\n\t */\n\tformStateSaveCallback() {\n\t\treturn {\n\t\t\tvalue: this.value,\n\t\t};\n\t}\n\n\t/**\n\t * The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.\n\t * This method is not implemented yet.\n\t * @param {boolean} disabled The new disabled state of the custom input element.\n\t * @function\n\t */\n\tformDisabledCallback(disabled) {\n\t\tconsole.warn('formDisabledCallback not implemented yet');\n\t\tthis.native?.classList.toggle('disabled', disabled);\n\t\tthis.toggleAttribute('disabled', disabled);\n\t}\n\n\t/**\n\t * Checks if all elements in the `elements` array are present in the `options` array based on their `option` property.\n\t * @param {Array} elements The array of elements to check. Each element should have an `option` property.\n\t * @param {Array} options The array of options to verify against.\n\t * @returns {boolean} Returns true if all elements in the `elements` array are found within the `options` array, otherwise returns false.\n\t */\n\tareAllElementsInOptions(elements, options) {\n\t\tif (elements.length === 0) return false;\n\n\t\treturn elements.every(el =>\n\t\t\toptions.some(opt => JSON.stringify(opt) === JSON.stringify(el.option))\n\t\t);\n\t}\n}\n","import Select from './select.element.js';\n\nexport default Select;\n\nSelect.define('wje-select', Select);\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;AAyCe,MAAM,eAAe,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW7C,cAAc;AACb,UAAO;AA+GR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAAe;AAAA,MACd,cAAc;AAAA,MACd,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,cAAc;AAAA,MACd,eAAe;AAAA,IACf;AAqLD,qCAAY;AA6PZ;AAAA;AAAA;AAAA;AAAA,wCAAe,CAAC,MAAM;AACrB,QAAE,gBAAe;AACjB,QAAE,yBAAwB;AAE1B,UAAI,aAAa,KAAK,cAAe;AAErC,UAAI,CAAC,KAAK,aAAa,UAAU,GAAG;AACnC,mBAAW,QAAQ,CAAC,WAAW;AAC9B,cAAI,OAAO,UAAU,EAAE,OAAO,OAAO;AACpC,iBAAK,qBAAqB,MAAM;AAAA,UACrC,OAAW;AACN,mBAAO,WAAW;AAClB,mBAAO,gBAAgB,UAAU;A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ACN,OAAO,KAAK;AAAA,IACZ;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQC,qBAAqB,UAAU;;AAC9B,YAAQ,KAAK,0CAA0C;AACvD,eAAK,WAAL,mBAAa,UAAU,OAAO,YAAY;AAC1C,SAAK,gBAAgB,YAAY,QAAQ;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQC,wBAAwB,UAAU,SAAS;AAC1C,QAAI,SAAS,WAAW,EAAG,QAAO;AAElC,WAAO,SAAS;AAAA,MAAM,QACrB,QAAQ,KAAK,SAAO,KAAK,UAAU,GAAG,MAAM,KAAK,UAAU,GAAG,MAAM,CAAC;AAAA,IACrE;AAAA,EACH;AACA;AAAA;AAAA;AAAA;AAAA;AAhnBC,cAjVoB,QAiVb,kBAAiB;ACtXzB,OAAO,OAAO,cAAc,MAAM;"}
|
package/dist/wje-stepper.js
CHANGED
|
@@ -3,7 +3,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { Localizer } from "./localize.js";
|
|
5
5
|
import WJElement, { event } from "./wje-element.js";
|
|
6
|
-
const styles =
|
|
6
|
+
const styles = '.container {\n display: flex;\n flex-direction: column;\n}\n\n.header {\n display: flex;\n justify-content: var(--wje-stepper-justify);\n margin-bottom: var(--wje-spacing-medium);\n}\n\n.step-header {\n display: flex;\n padding: var(--wje-spacing-medium);\n gap: var(--wje-spacing-x-small);\n color: var(--wje-color-contrast-5);\n flex-grow: var(--wje-stepper-grow);\n text-align: center;\n}\n\n.pointer {\n cursor: pointer;\n}\n\n[active] {\n color: var(--wje-color-contrast-11);\n}\n\n.content {\n margin-bottom: var(--wje-spacing-medium);\n}\n\n.arrow-icon {\n margin-top: var(--wje-stepper-margin);\n}\n\n.step {\n padding: var(--wje-spacing-medium);\n text-align: center;\n}\n\n[done] {\n color: var(--wje-color-contrast-11);\n}\n\n.nav-buttons {\n display: flex;\n justify-content: space-between;\n\n slot[hidden] {\n visibility: hidden;\n display: initial;\n }\n\n slot[disabled] {\n opacity: 0.5;\n pointer-events: none;\n cursor: not-allowed;\n\n /* after */\n ::after {\n content: "";\n display: block;\n width: 100%;\n height: 100%;\n background-color: var(--wje-color-contrast-2);\n position: absolute;\n top: 0;\n left: 0;\n opacity: .5;\n }\n }\n}';
|
|
7
7
|
class Stepper extends WJElement {
|
|
8
8
|
constructor() {
|
|
9
9
|
super();
|
|
@@ -11,6 +11,7 @@ class Stepper extends WJElement {
|
|
|
11
11
|
this.currentStep = 0;
|
|
12
12
|
this.localizer = new Localizer(this);
|
|
13
13
|
this.steps = [];
|
|
14
|
+
this.headerSteps = [];
|
|
14
15
|
}
|
|
15
16
|
get active() {
|
|
16
17
|
if (this.hasAttribute("active")) return this.getAttribute("active");
|
|
@@ -31,6 +32,7 @@ class Stepper extends WJElement {
|
|
|
31
32
|
* @returns {DocumentFragment}
|
|
32
33
|
*/
|
|
33
34
|
draw() {
|
|
35
|
+
var _a;
|
|
34
36
|
let fragment = document.createDocumentFragment();
|
|
35
37
|
const native = document.createElement("div");
|
|
36
38
|
native.setAttribute("part", "native");
|
|
@@ -44,7 +46,7 @@ class Stepper extends WJElement {
|
|
|
44
46
|
const steps = Array.from(this.children);
|
|
45
47
|
steps == null ? void 0 : steps.forEach((step, index) => {
|
|
46
48
|
if (step.nodeName === "WJE-STEP") {
|
|
47
|
-
this.processStep(index, step, header, steps);
|
|
49
|
+
this.headerSteps.push(this.processStep(index, step, header, steps));
|
|
48
50
|
}
|
|
49
51
|
});
|
|
50
52
|
let slot = document.createElement("slot");
|
|
@@ -52,39 +54,61 @@ class Stepper extends WJElement {
|
|
|
52
54
|
navButtons.className = "nav-buttons";
|
|
53
55
|
const prevButton = document.createElement("wje-button");
|
|
54
56
|
prevButton.setAttribute("label", this.localizer.translate("wj.stepper.button.previous"));
|
|
55
|
-
prevButton.
|
|
56
|
-
prevButton.innerHTML = "Prev";
|
|
57
|
+
prevButton.innerHTML = this.localizer.translate("wj.stepper.button.previous");
|
|
57
58
|
let nextButton = document.createElement("wje-button");
|
|
58
59
|
nextButton.setAttribute("label", this.localizer.translate("wj.stepper.button.next"));
|
|
59
|
-
nextButton.
|
|
60
|
-
|
|
60
|
+
nextButton.innerHTML = this.localizer.translate("wj.stepper.button.next");
|
|
61
|
+
let finishButton = document.createElement("wje-button");
|
|
62
|
+
finishButton.setAttribute("label", this.localizer.translate("wj.stepper.button.next"));
|
|
63
|
+
finishButton.innerHTML = this.localizer.translate("wj.stepper.button.finish");
|
|
64
|
+
finishButton.setAttribute("color", "primary");
|
|
65
|
+
const navButtonPrevSlot = document.createElement("slot");
|
|
66
|
+
navButtonPrevSlot.setAttribute("name", "prev");
|
|
67
|
+
navButtonPrevSlot.appendChild(prevButton);
|
|
68
|
+
navButtonPrevSlot.hidden = this.currentStep === 0;
|
|
69
|
+
const navButtonNextSlot = document.createElement("slot");
|
|
70
|
+
navButtonNextSlot.setAttribute("name", "next");
|
|
71
|
+
navButtonNextSlot.appendChild(nextButton);
|
|
72
|
+
navButtonNextSlot.hidden = this.currentStep === this.steps.length - 1;
|
|
73
|
+
const navButtonFinishSlot = document.createElement("slot");
|
|
74
|
+
navButtonFinishSlot.setAttribute("name", "finish");
|
|
75
|
+
navButtonFinishSlot.appendChild(nextButton);
|
|
76
|
+
navButtonFinishSlot.hidden = this.currentStep !== this.steps.length - 1;
|
|
77
|
+
const isNextLocked = (_a = this.headerSteps[this.currentStep + 1]) == null ? void 0 : _a.hasAttribute("locked");
|
|
78
|
+
navButtonNextSlot.toggleAttribute("disabled", !!isNextLocked);
|
|
79
|
+
navButtonFinishSlot.toggleAttribute("disabled", !!isNextLocked);
|
|
61
80
|
if (steps.length > 1) {
|
|
62
|
-
|
|
63
|
-
|
|
81
|
+
navButtonPrevSlot.appendChild(prevButton);
|
|
82
|
+
navButtonNextSlot.appendChild(nextButton);
|
|
83
|
+
navButtonFinishSlot.appendChild(finishButton);
|
|
84
|
+
navButtonFinishSlot.style.display = "none";
|
|
64
85
|
} else {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
navButtons.appendChild(prevButton);
|
|
71
|
-
navButtons.appendChild(nextButton);
|
|
86
|
+
navButtonPrevSlot.hidden = true;
|
|
87
|
+
navButtonNextSlot.hidden = true;
|
|
88
|
+
navButtonPrevSlot.appendChild(prevButton);
|
|
89
|
+
navButtonNextSlot.appendChild(nextButton);
|
|
90
|
+
navButtonFinishSlot.appendChild(finishButton);
|
|
72
91
|
}
|
|
73
92
|
content.appendChild(slot);
|
|
74
93
|
native.appendChild(header);
|
|
75
94
|
native.appendChild(content);
|
|
76
95
|
native.appendChild(navButtons);
|
|
96
|
+
navButtons.appendChild(navButtonPrevSlot);
|
|
97
|
+
navButtons.appendChild(navButtonNextSlot);
|
|
98
|
+
navButtons.appendChild(navButtonFinishSlot);
|
|
77
99
|
fragment.appendChild(native);
|
|
78
100
|
this.header = header;
|
|
79
|
-
this.
|
|
80
|
-
this.
|
|
81
|
-
this.
|
|
101
|
+
this.prev = navButtonPrevSlot;
|
|
102
|
+
this.next = navButtonNextSlot;
|
|
103
|
+
this.finish = navButtonFinishSlot;
|
|
82
104
|
return fragment;
|
|
83
105
|
}
|
|
84
106
|
processStep(index, step, header, steps) {
|
|
85
107
|
const nav = document.createElement("div");
|
|
86
108
|
nav.className = "step-header";
|
|
87
|
-
nav.addEventListener("click", () =>
|
|
109
|
+
nav.addEventListener("click", (e) => {
|
|
110
|
+
this.goToStep(index);
|
|
111
|
+
});
|
|
88
112
|
const badge = document.createElement("wje-badge");
|
|
89
113
|
badge.setAttribute("label", (index + 1).toString());
|
|
90
114
|
badge.className = "step-badge";
|
|
@@ -96,6 +120,7 @@ class Stepper extends WJElement {
|
|
|
96
120
|
}
|
|
97
121
|
if (step.hasAttribute("disabled")) {
|
|
98
122
|
nav.setAttribute("disabled", "");
|
|
123
|
+
this.setStepLocked(nav, badge);
|
|
99
124
|
} else {
|
|
100
125
|
nav.classList.add("pointer");
|
|
101
126
|
}
|
|
@@ -114,6 +139,7 @@ class Stepper extends WJElement {
|
|
|
114
139
|
step.style.display = "none";
|
|
115
140
|
}
|
|
116
141
|
this.steps.push(step);
|
|
142
|
+
return nav;
|
|
117
143
|
}
|
|
118
144
|
/**
|
|
119
145
|
* Sets up the attributes for the component.
|
|
@@ -124,6 +150,7 @@ class Stepper extends WJElement {
|
|
|
124
150
|
}
|
|
125
151
|
event.addListener(this.prev, "click", "", () => this.navigate(-1));
|
|
126
152
|
event.addListener(this.next, "click", "", () => this.navigate(1));
|
|
153
|
+
event.addListener(this.finish, "click", "", () => this.navigate(1));
|
|
127
154
|
}
|
|
128
155
|
/**
|
|
129
156
|
* Navigates to a different step in a multi-step process based on the provided direction.
|
|
@@ -131,19 +158,22 @@ class Stepper extends WJElement {
|
|
|
131
158
|
* Use a positive value to move forward or a negative value to move backward.
|
|
132
159
|
*/
|
|
133
160
|
navigate(direction) {
|
|
134
|
-
this.goToStep(this.currentStep + direction
|
|
161
|
+
this.goToStep(this.currentStep + direction);
|
|
135
162
|
}
|
|
136
163
|
/**
|
|
137
164
|
* Navigates to a specific step in a multi-step process and updates the stepper UI accordingly.
|
|
138
165
|
* @param {number} stepIndex The index of the step to navigate to.
|
|
139
|
-
* @param {number} direction The navigation direction. A positive value indicates forward navigation, and a negative value indicates backward navigation.
|
|
140
166
|
* //@fires stepper:next Dispatched when navigating to the next step.
|
|
141
167
|
* //@fires stepper:prev Dispatched when navigating to the previous step.
|
|
142
168
|
* //@fires stepper:finish Dispatched when the final step is completed.
|
|
143
169
|
*/
|
|
144
|
-
goToStep(stepIndex
|
|
170
|
+
goToStep(stepIndex) {
|
|
171
|
+
var _a;
|
|
145
172
|
if (stepIndex >= 0 && stepIndex < this.steps.length) {
|
|
146
|
-
if (
|
|
173
|
+
if (this.headerSteps[stepIndex].hasAttribute("disabled")) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (stepIndex > this.currentStep) {
|
|
147
177
|
this.dispatchEvent(
|
|
148
178
|
new CustomEvent("stepper:next", { detail: { stepIndex }, bubbles: true, composed: true })
|
|
149
179
|
);
|
|
@@ -152,24 +182,27 @@ class Stepper extends WJElement {
|
|
|
152
182
|
new CustomEvent("stepper:prev", { detail: { stepIndex }, bubbles: true, composed: true })
|
|
153
183
|
);
|
|
154
184
|
}
|
|
155
|
-
if (this.headerSteps[stepIndex].hasAttribute("disabled")) stepIndex += direction;
|
|
156
185
|
this.headerSteps.forEach((step, index) => {
|
|
157
186
|
let badge = step.querySelector("wje-badge");
|
|
158
187
|
this.setStepDefault(step, badge, index);
|
|
159
188
|
if (index < stepIndex) this.setStepDone(step, badge);
|
|
189
|
+
if (index > stepIndex && step.hasAttribute("disabled")) this.setStepLocked(step, badge, index);
|
|
160
190
|
});
|
|
161
191
|
this.setStepActive(this.headerSteps[stepIndex], null, stepIndex);
|
|
162
192
|
this.setContentActive(stepIndex);
|
|
163
193
|
this.currentStep = stepIndex;
|
|
164
|
-
this.prev.
|
|
194
|
+
this.prev.hidden = this.currentStep === 0;
|
|
195
|
+
const isNextLocked = (_a = this.headerSteps[this.currentStep + 1]) == null ? void 0 : _a.hasAttribute("locked");
|
|
196
|
+
this.next.toggleAttribute("disabled", !!isNextLocked);
|
|
197
|
+
this.finish.toggleAttribute("disabled", !!isNextLocked);
|
|
165
198
|
if (this.currentStep === this.steps.length - 1) {
|
|
166
|
-
this.next.
|
|
167
|
-
this.
|
|
168
|
-
this.
|
|
199
|
+
this.next.hidden = true;
|
|
200
|
+
this.finish.hidden = false;
|
|
201
|
+
this.finish.style.display = "block";
|
|
169
202
|
} else {
|
|
170
|
-
this.next.
|
|
171
|
-
this.
|
|
172
|
-
this.
|
|
203
|
+
this.next.hidden = false;
|
|
204
|
+
this.finish.hidden = true;
|
|
205
|
+
this.finish.style.display = "none";
|
|
173
206
|
}
|
|
174
207
|
} else if (stepIndex === this.steps.length) {
|
|
175
208
|
this.dispatchEvent(
|
|
@@ -239,6 +272,21 @@ class Stepper extends WJElement {
|
|
|
239
272
|
badge.innerHTML = "";
|
|
240
273
|
badge.appendChild(checkIcon);
|
|
241
274
|
}
|
|
275
|
+
setStepLocked(nav, badge = null) {
|
|
276
|
+
nav.setAttribute("disabled", "");
|
|
277
|
+
nav.setAttribute("locked", "");
|
|
278
|
+
const lockIcon = document.createElement("wje-icon");
|
|
279
|
+
lockIcon.setAttribute("name", "lock");
|
|
280
|
+
lockIcon.setAttribute("color", "danger");
|
|
281
|
+
lockIcon.setAttribute("size", "medium");
|
|
282
|
+
if (!badge) {
|
|
283
|
+
badge = nav.querySelector("wje-badge");
|
|
284
|
+
}
|
|
285
|
+
badge.innerHTML = "";
|
|
286
|
+
badge.removeAttribute("color");
|
|
287
|
+
badge.classList.add("disabled");
|
|
288
|
+
badge.appendChild(lockIcon);
|
|
289
|
+
}
|
|
242
290
|
}
|
|
243
291
|
Stepper.define("wje-stepper", Stepper);
|
|
244
292
|
export {
|
package/dist/wje-stepper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-stepper.js","sources":["../packages/wje-stepper/stepper.element.js","../packages/wje-stepper/stepper.js"],"sourcesContent":["import { Localizer } from '../utils/localize.js';\nimport { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Stepper` is a custom web component that represents a stepper.\n * @summary This element represents a stepper.\n * @documentation https://elements.webjet.sk/components/stepper\n * @status stable\n * @augments WJElement\n * @attribute {string} active - The active color for the stepper.\n * @attribute {string} done - The done color for the stepper.\n * @slot - The default slot for the stepper.\n * @csspart native - The native part of the stepper.\n * @csspart header - The header part of the stepper.\n * @csspart content - The content part of the stepper.\n * @tag wje-stepper\n */\nexport default class Stepper extends WJElement {\n constructor() {\n super();\n this.currentStep = 0;\n\n this.localizer = new Localizer(this);\n this.steps = [];\n }\n\n get active() {\n if (this.hasAttribute('active')) return this.getAttribute('active');\n\n return 'primary';\n }\n\n get done() {\n if (this.hasAttribute('done')) return this.getAttribute('done');\n\n return 'success';\n }\n\n className = 'Stepper';\n\n static get cssStyleSheet() {\n return styles;\n }\n\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the stepper.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n const native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.className = 'native-stepper';\n\n const header = document.createElement('div');\n header.setAttribute('part', 'header');\n header.className = 'header';\n\n const content = document.createElement('div');\n content.setAttribute('part', 'content');\n content.className = 'content';\n\n const steps = Array.from(this.children);\n\n steps?.forEach((step, index) => {\n if (step.nodeName === 'WJE-STEP') {\n this.processStep(index, step, header, steps);\n }\n });\n\n let slot = document.createElement('slot');\n\n const navButtons = document.createElement('div');\n navButtons.className = 'nav-buttons';\n\n const prevButton = document.createElement('wje-button');\n prevButton.setAttribute('label', this.localizer.translate('wj.stepper.button.previous'));\n prevButton.disabled = this.currentStep === 0;\n prevButton.innerHTML = 'Prev';\n\n let nextButton = document.createElement('wje-button');\n nextButton.setAttribute('label', this.localizer.translate('wj.stepper.button.next'));\n nextButton.disabled = this.currentStep === this.steps.length - 1;\n nextButton.innerHTML = 'Next';\n\n if (steps.length > 1) {\n navButtons.appendChild(prevButton);\n navButtons.appendChild(nextButton);\n } else {\n nextButton = document.createElement('wje-button');\n nextButton.setAttribute('label', this.localizer.translate('wj.stepper.button.finish'));\n nextButton.innerHTML = this.localizer.translate('wj.stepper.button.finish');\n nextButton.setAttribute('color', 'primary');\n\n prevButton.hidden = true;\n navButtons.appendChild(prevButton);\n navButtons.appendChild(nextButton);\n }\n\n content.appendChild(slot);\n\n native.appendChild(header);\n native.appendChild(content);\n native.appendChild(navButtons);\n\n fragment.appendChild(native);\n\n this.header = header;\n this.headerSteps = header.querySelectorAll('.step-header');\n this.prev = prevButton;\n this.next = nextButton;\n\n return fragment;\n }\n\n processStep(index, step, header, steps) {\n const nav = document.createElement('div');\n nav.className = 'step-header';\n nav.addEventListener('click', () => this.goToStep(index));\n\n const badge = document.createElement('wje-badge');\n badge.setAttribute('label', (index + 1).toString());\n badge.className = 'step-badge';\n badge.innerHTML = index + 1;\n\n const label = document.createElement('span');\n label.innerText = step.getAttribute('label') || `${this.localizer.translate('wj.stepper.step')} ${index + 1}`; // default label\n\n // set active step\n if (index === this.currentStep || step.hasAttribute('active')) {\n this.setStepActive(nav, badge);\n }\n\n if (step.hasAttribute('disabled')) {\n nav.setAttribute('disabled', '');\n } else {\n nav.classList.add('pointer');\n }\n\n nav.appendChild(badge);\n nav.appendChild(label);\n\n header.appendChild(nav);\n\n if (index < steps.length - 1) {\n const arrowIcon = document.createElement('wje-icon');\n arrowIcon.setAttribute('name', 'chevron-right');\n arrowIcon.classList.add('arrow-icon');\n arrowIcon.setAttribute('size', 'small');\n\n header.appendChild(arrowIcon);\n }\n\n step.classList.add('step');\n if (index !== this.currentStep) {\n step.style.display = 'none';\n }\n\n this.steps.push(step);\n }\n\n /**\n * Sets up the attributes for the component.\n */\n afterDraw() {\n if (this.steps.length <= 1) {\n this.prev.hidden = true;\n }\n\n event.addListener(this.prev, 'click', '', () => this.navigate(-1));\n event.addListener(this.next, 'click', '', () => this.navigate(1));\n }\n\n /**\n * Navigates to a different step in a multi-step process based on the provided direction.\n * @param {number} direction The navigation direction.\n * Use a positive value to move forward or a negative value to move backward.\n */\n navigate(direction) {\n this.goToStep(this.currentStep + direction, direction);\n }\n\n /**\n * Navigates to a specific step in a multi-step process and updates the stepper UI accordingly.\n * @param {number} stepIndex The index of the step to navigate to.\n * @param {number} direction The navigation direction. A positive value indicates forward navigation, and a negative value indicates backward navigation.\n * //@fires stepper:next Dispatched when navigating to the next step.\n * //@fires stepper:prev Dispatched when navigating to the previous step.\n * //@fires stepper:finish Dispatched when the final step is completed.\n */\n goToStep(stepIndex, direction) {\n if (stepIndex >= 0 && stepIndex < this.steps.length) {\n if (direction > 0) {\n this.dispatchEvent(\n new CustomEvent('stepper:next', { detail: { stepIndex }, bubbles: true, composed: true })\n );\n } else {\n this.dispatchEvent(\n new CustomEvent('stepper:prev', { detail: { stepIndex }, bubbles: true, composed: true })\n );\n }\n\n if (this.headerSteps[stepIndex].hasAttribute('disabled')) stepIndex += direction;\n\n this.headerSteps.forEach((step, index) => {\n let badge = step.querySelector('wje-badge');\n\n this.setStepDefault(step, badge, index);\n if (index < stepIndex) this.setStepDone(step, badge);\n });\n\n this.setStepActive(this.headerSteps[stepIndex], null, stepIndex);\n this.setContentActive(stepIndex);\n\n this.currentStep = stepIndex;\n\n this.prev.disabled = this.currentStep === 0;\n if (this.currentStep === this.steps.length - 1) {\n this.next.innerHTML = this.localizer.translate('wj.stepper.button.finish');\n this.next.setAttribute('color', 'primary');\n this.next.refresh();\n } else {\n this.next.innerHTML = this.localizer.translate('wj.stepper.button.next');\n this.next.removeAttribute('color');\n this.next.refresh();\n }\n } else if (stepIndex === this.steps.length) {\n this.dispatchEvent(\n new CustomEvent('stepper:finish', { detail: { stepIndex }, bubbles: true, composed: true })\n );\n }\n }\n\n /**\n * Resets a step to its default state by clearing its active and done attributes.\n * Updates the step's badge to show its index and removes any color styling.\n * @param {HTMLElement} nav The navigation element representing the step.\n * @param {HTMLElement|null} [badge] The badge element within the step. If not provided, it will be selected from the `nav` element.\n * @param {number} [stepIndex] The index of the step, used to set the badge content.\n */\n setStepDefault(nav, badge = null, stepIndex = 0) {\n nav.removeAttribute('active');\n nav.removeAttribute('done');\n\n if (!badge) {\n badge = nav.querySelector('wje-badge');\n }\n badge.innerHTML = stepIndex + 1;\n badge.removeAttribute('color');\n }\n\n /**\n * Sets a step as active by adding the `active` attribute and updating the step's badge.\n * @param {HTMLElement} nav The navigation element representing the step to activate.\n * @param {HTMLElement|null} [badge] The badge element within the step. If not provided, it will be selected from the `nav` element.\n * @param {number|null} [stepIndex] The index of the step, used to set the badge content. Defaults to `null` if not provided.\n */\n setStepActive(nav, badge = null, stepIndex = null) {\n nav.setAttribute('active', '');\n\n if (!badge) {\n badge = nav.querySelector('wje-badge');\n }\n badge.innerHTML = stepIndex + 1;\n badge.setAttribute('color', this.active);\n }\n\n /**\n * Activates the content of a specific step by displaying it and hiding all others.\n * @param {number} stepIndex The index of the step whose content should be displayed.\n */\n setContentActive(stepIndex) {\n this.steps?.forEach((step, index) => {\n if (index === stepIndex) {\n step.style.display = 'block';\n } else {\n step.style.display = 'none';\n }\n });\n }\n\n /**\n * Marks a step as completed by setting the `done` attribute and updating its badge with a check icon.\n * @param {HTMLElement} nav The navigation element representing the completed step.\n * @param {HTMLElement|null} [badge] The badge element within the step. If not provided, it will be selected from the `nav` element.\n */\n setStepDone(nav, badge = null) {\n nav.setAttribute('done', '');\n\n const checkIcon = document.createElement('wje-icon');\n checkIcon.setAttribute('name', 'check');\n checkIcon.setAttribute('color', this.done);\n checkIcon.setAttribute('size', 'medium');\n\n if (!badge) {\n badge = nav.querySelector('wje-badge');\n }\n\n badge.setAttribute('color', this.done);\n badge.innerHTML = '';\n badge.appendChild(checkIcon);\n }\n}\n","import Stepper from './stepper.element.js';\n\nexport default Stepper;\n\nStepper.define('wje-stepper', Stepper);\n"],"names":[],"mappings":";;;;;;AAkBe,MAAM,gBAAgB,UAAU;AAAA,EAC3C,cAAc;AACV,UAAO;AAmBX,qCAAY;AAlBR,SAAK,cAAc;AAEnB,SAAK,YAAY,IAAI,UAAU,IAAI;AACnC,SAAK,QAAQ,CAAE;AAAA,EACvB;AAAA,EAEI,IAAI,SAAS;AACT,QAAI,KAAK,aAAa,QAAQ,EAAG,QAAO,KAAK,aAAa,QAAQ;AAElE,WAAO;AAAA,EACf;AAAA,EAEI,IAAI,OAAO;AACP,QAAI,KAAK,aAAa,MAAM,EAAG,QAAO,KAAK,aAAa,MAAM;AAE9D,WAAO;AAAA,EACf;AAAA,EAII,WAAW,gBAAgB;AACvB,WAAO;AAAA,EACf;AAAA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,MAAM,UAAU;AACjC,UAAI,UAAU,WAAW;AACrB,aAAK,MAAM,UAAU;AAAA,MACrC,OAAmB;AACH,aAAK,MAAM,UAAU;AAAA,MACrC;AAAA,IACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOI,YAAY,KAAK,QAAQ,MAAM;AAC3B,QAAI,aAAa,QAAQ,EAAE;AAE3B,UAAM,YAAY,SAAS,cAAc,UAAU;AACnD,cAAU,aAAa,QAAQ,OAAO;AACtC,cAAU,aAAa,SAAS,KAAK,IAAI;AACzC,cAAU,aAAa,QAAQ,QAAQ;AAEvC,QAAI,CAAC,OAAO;AACR,cAAQ,IAAI,cAAc,WAAW;AAAA,IACjD;AAEQ,UAAM,aAAa,SAAS,KAAK,IAAI;AACrC,UAAM,YAAY;AAClB,UAAM,YAAY,SAAS;AAAA,EACnC;AACA;AChTA,QAAQ,OAAO,eAAe,OAAO;"}
|
|
1
|
+
{"version":3,"file":"wje-stepper.js","sources":["../packages/wje-stepper/stepper.element.js","../packages/wje-stepper/stepper.js"],"sourcesContent":["import { Localizer } from '../utils/localize.js';\nimport { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Stepper` is a custom web component that represents a stepper.\n * @summary This element represents a stepper.\n * @documentation https://elements.webjet.sk/components/stepper\n * @status stable\n * @augments WJElement\n * @attribute {string} active - The active color for the stepper.\n * @attribute {string} done - The done color for the stepper.\n * @slot - The default slot for the stepper.\n * @csspart native - The native part of the stepper.\n * @csspart header - The header part of the stepper.\n * @csspart content - The content part of the stepper.\n * @tag wje-stepper\n */\nexport default class Stepper extends WJElement {\n\tconstructor() {\n\t\tsuper();\n\t\tthis.currentStep = 0;\n\n\t\tthis.localizer = new Localizer(this);\n\t\tthis.steps = [];\n\t\tthis.headerSteps = [];\n\n\t}\n\n\tget active() {\n\t\tif (this.hasAttribute('active')) return this.getAttribute('active');\n\n\t\treturn 'primary';\n\t}\n\n\tget done() {\n\t\tif (this.hasAttribute('done')) return this.getAttribute('done');\n\n\t\treturn 'success';\n\t}\n\n\tclassName = 'Stepper';\n\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t}\n\n\t/**\n\t * Draws the component for the stepper.\n\t * @returns {DocumentFragment}\n\t */\n\tdraw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tconst native = document.createElement('div');\n\t\tnative.setAttribute('part', 'native');\n\t\tnative.className = 'native-stepper';\n\n\t\tconst header = document.createElement('div');\n\t\theader.setAttribute('part', 'header');\n\t\theader.className = 'header';\n\n\t\tconst content = document.createElement('div');\n\t\tcontent.setAttribute('part', 'content');\n\t\tcontent.className = 'content';\n\n\t\tconst steps = Array.from(this.children);\n\n\t\tsteps?.forEach((step, index) => {\n\t\t\tif (step.nodeName === 'WJE-STEP') {\n\t\t\t\tthis.headerSteps.push(this.processStep(index, step, header, steps));\n\t\t\t}\n\t\t});\n\n\t\tlet slot = document.createElement('slot');\n\n\t\tconst navButtons = document.createElement('div');\n\t\tnavButtons.className = 'nav-buttons';\n\n\t\tconst prevButton = document.createElement('wje-button');\n\t\tprevButton.setAttribute('label', this.localizer.translate('wj.stepper.button.previous'));\n\t\tprevButton.innerHTML = this.localizer.translate('wj.stepper.button.previous');\n\n\t\tlet nextButton = document.createElement('wje-button');\n\t\tnextButton.setAttribute('label', this.localizer.translate('wj.stepper.button.next'));\n\t\tnextButton.innerHTML = this.localizer.translate('wj.stepper.button.next');\n\n\t\tlet finishButton = document.createElement('wje-button');\n\t\tfinishButton.setAttribute('label', this.localizer.translate('wj.stepper.button.next'));\n\t\tfinishButton.innerHTML = this.localizer.translate('wj.stepper.button.finish');\n\t\tfinishButton.setAttribute('color', 'primary');\n\n\t\tconst navButtonPrevSlot = document.createElement('slot');\n\t\tnavButtonPrevSlot.setAttribute('name', 'prev');\n\t\tnavButtonPrevSlot.appendChild(prevButton);\n\t\tnavButtonPrevSlot.hidden = this.currentStep === 0;\n\n\t\tconst navButtonNextSlot = document.createElement('slot');\n\t\tnavButtonNextSlot.setAttribute('name', 'next');\n\t\tnavButtonNextSlot.appendChild(nextButton);\n\t\tnavButtonNextSlot.hidden = this.currentStep === this.steps.length - 1;\n\n\t\tconst navButtonFinishSlot = document.createElement('slot');\n\t\tnavButtonFinishSlot.setAttribute('name', 'finish');\n\t\tnavButtonFinishSlot.appendChild(nextButton);\n\t\tnavButtonFinishSlot.hidden = this.currentStep !== this.steps.length - 1;\n\n\t\tconst isNextLocked = this.headerSteps[this.currentStep + 1]?.hasAttribute('locked');\n\t\tnavButtonNextSlot.toggleAttribute('disabled', !!isNextLocked);\n\t\tnavButtonFinishSlot.toggleAttribute('disabled', !!isNextLocked);\n\n\t\tif (steps.length > 1) {\n\t\t\tnavButtonPrevSlot.appendChild(prevButton);\n\t\t\tnavButtonNextSlot.appendChild(nextButton);\n\t\t\tnavButtonFinishSlot.appendChild(finishButton);\n\t\t\tnavButtonFinishSlot.style.display = 'none';\n\n\t\t} else {\n\t\t\tnavButtonPrevSlot.hidden = true;\n\t\t\tnavButtonNextSlot.hidden = true;\n\t\t\tnavButtonPrevSlot.appendChild(prevButton);\n\t\t\tnavButtonNextSlot.appendChild(nextButton);\n\t\t\tnavButtonFinishSlot.appendChild(finishButton);\n\t\t}\n\n\t\tcontent.appendChild(slot);\n\n\t\tnative.appendChild(header);\n\t\tnative.appendChild(content);\n\t\tnative.appendChild(navButtons);\n\n\t\tnavButtons.appendChild(navButtonPrevSlot);\n\t\tnavButtons.appendChild(navButtonNextSlot);\n\t\tnavButtons.appendChild(navButtonFinishSlot);\n\n\t\tfragment.appendChild(native);\n\n\t\tthis.header = header;\n\t\tthis.prev = navButtonPrevSlot;\n\t\tthis.next = navButtonNextSlot;\n\t\tthis.finish = navButtonFinishSlot;\n\n\t\treturn fragment;\n\t}\n\n\tprocessStep(index, step, header, steps) {\n\t\tconst nav = document.createElement('div');\n\t\tnav.className = 'step-header';\n\t\tnav.addEventListener('click', (e) => {\n\t\t\tthis.goToStep(index)\n\t\t});\n\n\t\tconst badge = document.createElement('wje-badge');\n\t\tbadge.setAttribute('label', (index + 1).toString());\n\t\tbadge.className = 'step-badge';\n\t\tbadge.innerHTML = index + 1;\n\n\t\tconst label = document.createElement('span');\n\t\tlabel.innerText = step.getAttribute('label') || `${this.localizer.translate('wj.stepper.step')} ${index + 1}`; // default label\n\n\t\t// set active step\n\t\tif (index === this.currentStep || step.hasAttribute('active')) {\n\t\t\tthis.setStepActive(nav, badge);\n\t\t}\n\n\t\tif (step.hasAttribute('disabled')) {\n\t\t\tnav.setAttribute('disabled', '');\n\t\t\tthis.setStepLocked(nav, badge);\n\t\t} else {\n\t\t\tnav.classList.add('pointer');\n\t\t}\n\n\t\tnav.appendChild(badge);\n\t\tnav.appendChild(label);\n\n\t\theader.appendChild(nav);\n\n\t\tif (index < steps.length - 1) {\n\t\t\tconst arrowIcon = document.createElement('wje-icon');\n\t\t\tarrowIcon.setAttribute('name', 'chevron-right');\n\t\t\tarrowIcon.classList.add('arrow-icon');\n\t\t\tarrowIcon.setAttribute('size', 'small');\n\n\t\t\theader.appendChild(arrowIcon);\n\t\t}\n\n\t\tstep.classList.add('step');\n\t\tif (index !== this.currentStep) {\n\t\t\tstep.style.display = 'none';\n\t\t}\n\n\t\tthis.steps.push(step);\n\n\t\treturn nav\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tafterDraw() {\n\t\tif (this.steps.length <= 1) {\n\t\t\tthis.prev.hidden = true;\n\t\t}\n\n\t\tevent.addListener(this.prev, 'click', '', () => this.navigate(-1));\n\t\tevent.addListener(this.next, 'click', '', () => this.navigate(1));\n\t\tevent.addListener(this.finish, 'click', '', () => this.navigate(1));\n\t}\n\n\t/**\n\t * Navigates to a different step in a multi-step process based on the provided direction.\n\t * @param {number} direction The navigation direction.\n\t * Use a positive value to move forward or a negative value to move backward.\n\t */\n\tnavigate(direction) {\n\t\tthis.goToStep(this.currentStep + direction);\n\t}\n\n\t/**\n\t * Navigates to a specific step in a multi-step process and updates the stepper UI accordingly.\n\t * @param {number} stepIndex The index of the step to navigate to.\n\t * //@fires stepper:next Dispatched when navigating to the next step.\n\t * //@fires stepper:prev Dispatched when navigating to the previous step.\n\t * //@fires stepper:finish Dispatched when the final step is completed.\n\t */\n\tgoToStep(stepIndex) {\n\t\tif (stepIndex >= 0 && stepIndex < this.steps.length) {\n\t\t\tif (this.headerSteps[stepIndex].hasAttribute('disabled')) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (stepIndex > this.currentStep) {\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent('stepper:next', { detail: { stepIndex }, bubbles: true, composed: true })\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent('stepper:prev', { detail: { stepIndex }, bubbles: true, composed: true })\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.headerSteps.forEach((step, index) => {\n\t\t\t\tlet badge = step.querySelector('wje-badge');\n\n\t\t\t\tthis.setStepDefault(step, badge, index);\n\t\t\t\tif (index < stepIndex) this.setStepDone(step, badge);\n\t\t\t\tif (index > stepIndex && step.hasAttribute('disabled')) this.setStepLocked(step, badge, index);\n\t\t\t});\n\n\t\t\tthis.setStepActive(this.headerSteps[stepIndex], null, stepIndex);\n\t\t\tthis.setContentActive(stepIndex);\n\n\t\t\tthis.currentStep = stepIndex;\n\t\t\tthis.prev.hidden = this.currentStep === 0;\n\n\t\t\tconst isNextLocked = this.headerSteps[this.currentStep + 1]?.hasAttribute('locked');\n\t\t\tthis.next.toggleAttribute('disabled', !!isNextLocked);\n\t\t\tthis.finish.toggleAttribute('disabled', !!isNextLocked);\n\n\t\t\tif (this.currentStep === this.steps.length - 1) {\n\t\t\t\tthis.next.hidden = true;\n\t\t\t\tthis.finish.hidden = false;\n\t\t\t\tthis.finish.style.display = 'block';\n\t\t\t} else {\n\t\t\t\tthis.next.hidden = false;\n\t\t\t\tthis.finish.hidden = true;\n\t\t\t\tthis.finish.style.display = 'none';\n\t\t\t}\n\t\t} else if (stepIndex === this.steps.length) {\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('stepper:finish', { detail: { stepIndex }, bubbles: true, composed: true })\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Resets a step to its default state by clearing its active and done attributes.\n\t * Updates the step's badge to show its index and removes any color styling.\n\t * @param {HTMLElement} nav The navigation element representing the step.\n\t * @param {HTMLElement|null} [badge] The badge element within the step. If not provided, it will be selected from the `nav` element.\n\t * @param {number} [stepIndex] The index of the step, used to set the badge content.\n\t */\n\tsetStepDefault(nav, badge = null, stepIndex = 0) {\n\t\tnav.removeAttribute('active');\n\t\tnav.removeAttribute('done');\n\n\t\tif (!badge) {\n\t\t\tbadge = nav.querySelector('wje-badge');\n\t\t}\n\t\tbadge.innerHTML = stepIndex + 1;\n\t\tbadge.removeAttribute('color');\n\t}\n\n\t/**\n\t * Sets a step as active by adding the `active` attribute and updating the step's badge.\n\t * @param {HTMLElement} nav The navigation element representing the step to activate.\n\t * @param {HTMLElement|null} [badge] The badge element within the step. If not provided, it will be selected from the `nav` element.\n\t * @param {number|null} [stepIndex] The index of the step, used to set the badge content. Defaults to `null` if not provided.\n\t */\n\tsetStepActive(nav, badge = null, stepIndex = null) {\n\t\tnav.setAttribute('active', '');\n\n\t\tif (!badge) {\n\t\t\tbadge = nav.querySelector('wje-badge');\n\t\t}\n\t\tbadge.innerHTML = stepIndex + 1;\n\t\tbadge.setAttribute('color', this.active);\n\t}\n\n\t/**\n\t * Activates the content of a specific step by displaying it and hiding all others.\n\t * @param {number} stepIndex The index of the step whose content should be displayed.\n\t */\n\tsetContentActive(stepIndex) {\n\t\tthis.steps?.forEach((step, index) => {\n\t\t\tif (index === stepIndex) {\n\t\t\t\tstep.style.display = 'block';\n\t\t\t} else {\n\t\t\t\tstep.style.display = 'none';\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Marks a step as completed by setting the `done` attribute and updating its badge with a check icon.\n\t * @param {HTMLElement} nav The navigation element representing the completed step.\n\t * @param {HTMLElement|null} [badge] The badge element within the step. If not provided, it will be selected from the `nav` element.\n\t */\n\tsetStepDone(nav, badge = null) {\n\t\tnav.setAttribute('done', '');\n\n\t\tconst checkIcon = document.createElement('wje-icon');\n\t\tcheckIcon.setAttribute('name', 'check');\n\t\tcheckIcon.setAttribute('color', this.done);\n\t\tcheckIcon.setAttribute('size', 'medium');\n\n\t\tif (!badge) {\n\t\t\tbadge = nav.querySelector('wje-badge');\n\t\t}\n\n\t\tbadge.setAttribute('color', this.done);\n\t\tbadge.innerHTML = '';\n\t\tbadge.appendChild(checkIcon);\n\t}\n\n\tsetStepLocked(nav, badge = null) {\n\t\tnav.setAttribute('disabled', '');\n\t\tnav.setAttribute('locked', '');\n\n\t\tconst lockIcon = document.createElement('wje-icon');\n\t\tlockIcon.setAttribute('name', 'lock');\n\t\tlockIcon.setAttribute('color', \"danger\");\n\t\tlockIcon.setAttribute('size', 'medium');\n\n\t\tif (!badge) {\n\t\t\tbadge = nav.querySelector('wje-badge');\n\t\t}\n\t\tbadge.innerHTML = '';\n\t\tbadge.removeAttribute('color');\n\t\tbadge.classList.add('disabled');\n\t\tbadge.appendChild(lockIcon);\n\t}\n}\n","import Stepper from './stepper.element.js';\n\nexport default Stepper;\n\nStepper.define('wje-stepper', Stepper);\n"],"names":[],"mappings":";;;;;;AAkBe,MAAM,gBAAgB,UAAU;AAAA,EAC9C,cAAc;AACb,UAAO;AAqBR,qCAAY;AApBX,SAAK,cAAc;AAEnB,SAAK,YAAY,IAAI,UAAU,IAAI;AACnC,SAAK,QAAQ,CAAE;AACf,SAAK,cAAc,CAAE;AAAA,EAEvB;AAAA,EAEC,IAAI,SAAS;AACZ,QAAI,KAAK,aAAa,QAAQ,EAAG,QAAO,KAAK,aAAa,QAAQ;AAElE,WAAO;AAAA,EACT;AAAA,EAEC,IAAI,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,MAAM,UAAU;AACpC,UAAI,UAAU,WAAW;AACxB,aAAK,MAAM,UAAU;AAAA,MACzB,OAAU;AACN,aAAK,MAAM,UAAU;AAAA,MACzB;AAAA,IACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOC,YAAY,KAAK,QAAQ,MAAM;AAC9B,QAAI,aAAa,QAAQ,EAAE;AAE3B,UAAM,YAAY,SAAS,cAAc,UAAU;AACnD,cAAU,aAAa,QAAQ,OAAO;AACtC,cAAU,aAAa,SAAS,KAAK,IAAI;AACzC,cAAU,aAAa,QAAQ,QAAQ;AAEvC,QAAI,CAAC,OAAO;AACX,cAAQ,IAAI,cAAc,WAAW;AAAA,IACxC;AAEE,UAAM,aAAa,SAAS,KAAK,IAAI;AACrC,UAAM,YAAY;AAClB,UAAM,YAAY,SAAS;AAAA,EAC7B;AAAA,EAEC,cAAc,KAAK,QAAQ,MAAM;AAChC,QAAI,aAAa,YAAY,EAAE;AAC/B,QAAI,aAAa,UAAU,EAAE;AAE7B,UAAM,WAAW,SAAS,cAAc,UAAU;AAClD,aAAS,aAAa,QAAQ,MAAM;AACpC,aAAS,aAAa,SAAS,QAAQ;AACvC,aAAS,aAAa,QAAQ,QAAQ;AAEtC,QAAI,CAAC,OAAO;AACX,cAAQ,IAAI,cAAc,WAAW;AAAA,IACxC;AACE,UAAM,YAAY;AAClB,UAAM,gBAAgB,OAAO;AAC7B,UAAM,UAAU,IAAI,UAAU;AAC9B,UAAM,YAAY,QAAQ;AAAA,EAC5B;AACA;AC1WA,QAAQ,OAAO,eAAe,OAAO;"}
|
package/dist/wje-tree-item.js
CHANGED
|
@@ -217,12 +217,10 @@ class TreeItem extends WJElement {
|
|
|
217
217
|
*/
|
|
218
218
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
219
219
|
if (name === "selected") {
|
|
220
|
-
console.log(name, oldValue, newValue, this.checkbox);
|
|
221
|
-
this.checkbox.removeAttribute("indeterminate");
|
|
222
220
|
if (this.selected) {
|
|
223
|
-
this.checkbox.
|
|
221
|
+
this.checkbox.checked = true;
|
|
224
222
|
} else {
|
|
225
|
-
this.checkbox.
|
|
223
|
+
this.checkbox.checked = false;
|
|
226
224
|
}
|
|
227
225
|
}
|
|
228
226
|
if (name === "indeterminate" && !this.selected) {
|