wj-elements 0.1.182 → 0.1.184

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/light.css CHANGED
@@ -551,7 +551,7 @@
551
551
  --wje-textarea-font-family: var(--wje-font-family);
552
552
  --wje-textarea-background-color: var(--wje-background);
553
553
  --wje-textarea-color: var(--wje-color);
554
- --wje-textarea-color-invalid: var(--wje-color-danger);
554
+ --wje-textarea-color-invalid: var(--wje-color-danger-9);
555
555
  --wje-textarea-border-width: 1px;
556
556
  --wje-textarea-border-style: solid;
557
557
  --wje-textarea-border-color: var(--wje-border-color);
@@ -578,7 +578,15 @@
578
578
  --wje-tooltip-border-radius: var(--wje-border-radius-medium);
579
579
 
580
580
  /* Tree - Item */
581
+ --wje-tree-item-padding-inline: var(--wje-spacing-3x-small);
582
+ --wje-tree-item-padding-block: var(--wje-spacing-3x-small);
581
583
  --wje-tree-item-indent: var(--wje-spacing-large);
582
584
  --wje-tree-item-indent-guid-width: 0px;
583
585
  --wje-tree-item-border-radius: var(--wje-border-radius-medium);
586
+ --wje-tree-item-background: transparent;
587
+ --wje-tree-item-color: var(--wje-color);
588
+ --wje-tree-item-background-hover: var(--wje-color-contrast-1);
589
+ --wje-tree-item-color-hover: var(--wje-color-contrast-8);
590
+ --wje-tree-item-background-selected: var(--wje-color-primary-9);
591
+ --wje-tree-item-color-selected: var(--wje-color-contrast-0);
584
592
  }
@@ -152,7 +152,7 @@ export default class IconPicker extends WJElement {
152
152
  * // The resulting structure:
153
153
  * // <div class="icon-item">
154
154
  * // <wje-tooltip content="hourglass">
155
- * // <wje-icon name="hourglass" size="large" filled></wje-icon>
155
+ * // <wje-icon name="hourglass" size="large" filled></wje-icon></wje-icon>
156
156
  * // </wje-tooltip>
157
157
  * // </div>
158
158
  */
@@ -42,13 +42,14 @@ export default class Input extends WJElement {
42
42
  */
43
43
  static formAssociated: boolean;
44
44
  /**
45
- * Setter for the invalid attribute.
46
- * @param {boolean} isInvalid Whether the input is invalid.
45
+ * Sets or removes the 'invalid' attribute on an element based on the provided value.
46
+ * @param {boolean} value If true, the 'invalid' attribute is set. If false, the 'invalid' attribute is removed.
47
47
  */
48
- set invalid(isInvalid: boolean);
48
+ set invalid(value: boolean);
49
49
  /**
50
- * Getter for the invalid attribute.
51
- * @returns {boolean} Whether the attribute is present.
50
+ * Gets the value of the 'invalid' attribute.
51
+ * Determines whether the 'invalid' attribute is present on the element.
52
+ * @returns {boolean} True if the 'invalid' attribute is present, otherwise false.
52
53
  */
53
54
  get invalid(): boolean;
54
55
  pristine: boolean;
@@ -61,16 +62,42 @@ export default class Input extends WJElement {
61
62
  */
62
63
  set value(value: string);
63
64
  /**
64
- * Getter for the value attribute.
65
- * @returns {string} The value of the attribute.
65
+ * Retrieves the value from the input element if available; otherwise,
66
+ * returns the internal _value property or an empty string as the default.
67
+ * @returns {string} The current value from the input element, the internal _value, or an empty string.
66
68
  */
67
69
  get value(): string;
68
70
  _value: string;
71
+ /**
72
+ * Sets the label attribute of the element.
73
+ * @param {string} value The value to set as the label attribute.
74
+ */
75
+ set label(value: string);
76
+ /**
77
+ * Retrieves the value of the 'label' attribute if it exists.
78
+ * If the 'label' attribute is not set, it returns false.
79
+ * @returns {string|boolean} The value of the 'label' attribute as a string, or false if the attribute is not set.
80
+ */
81
+ get label(): string | boolean;
82
+ /**
83
+ * Sets the custom error display attribute for an element.
84
+ * @param {boolean} value If true, adds the 'custom-error-display' attribute to the element. If false, removes the attribute from the element.
85
+ */
86
+ set customErrorDisplay(value: boolean);
69
87
  /**
70
88
  * Getter for the customErrorDisplay attribute.
71
89
  * @returns {boolean} Whether the attribute is present.
72
90
  */
73
91
  get customErrorDisplay(): boolean;
92
+ /**
93
+ * Sets the `validateOnChange` property. If set to a truthy value, it adds the
94
+ * `validate-on-change` attribute to the element. If set to a falsy value, it
95
+ * removes the `validate-on-change` attribute from the element.
96
+ * @param {boolean} value Determines whether to add or remove the
97
+ * `validate-on-change` attribute. A truthy value adds the attribute, whereas a
98
+ * falsy value removes it.
99
+ */
100
+ set validateOnChange(value: boolean);
74
101
  /**
75
102
  * Getter for the validateOnChange attribute.
76
103
  * @returns {boolean} Whether the attribute is present.
@@ -116,11 +143,41 @@ export default class Input extends WJElement {
116
143
  * @returns {string} The default value of the input element.
117
144
  */
118
145
  get defaultValue(): string;
146
+ /**
147
+ * Sets or removes the 'clearable' attribute on the element.
148
+ * When set to a truthy value, the 'clearable' attribute is added; when falsy, the attribute is removed.
149
+ * @param {boolean} value Determines whether to set or remove the 'clearable' attribute. If true, the 'clearable' attribute is added. If false, it is removed.
150
+ */
119
151
  set clearable(value: boolean);
152
+ /**
153
+ * Checks if the 'clearable' attribute is present on the element.
154
+ * @returns {boolean} True if the 'clearable' attribute is set, otherwise false.
155
+ */
120
156
  get clearable(): boolean;
157
+ /**
158
+ * Sets the placeholder value for an element. If the provided value is non-empty,
159
+ * it assigns the value to the "placeholder" attribute. Otherwise, it removes
160
+ * the "placeholder" attribute from the element.
161
+ * @param {string} value The placeholder text to set or null/undefined to remove the attribute.
162
+ */
121
163
  set placeholder(value: string);
164
+ /**
165
+ * Retrieves the value of the 'placeholder' attribute from the element.
166
+ * If the attribute is not set, it returns an empty string.
167
+ * @returns {string} The value of the 'placeholder' attribute or an empty string if not set.
168
+ */
122
169
  get placeholder(): string;
170
+ /**
171
+ * Sets the `variant` attribute on the element. If a value is provided, it will set the attribute to the given value.
172
+ * If no value is provided, it removes the `variant` attribute from the element.
173
+ * @param {string} value The value to set for the `variant` attribute. If falsy, the attribute is removed.
174
+ */
123
175
  set variant(value: string);
176
+ /**
177
+ * Retrieves the value of the 'variant' attribute from the element.
178
+ * If the attribute is not set, it defaults to 'default'.
179
+ * @returns {string} The value of the 'variant' attribute or 'default' if not set.
180
+ */
124
181
  get variant(): string;
125
182
  beforeDraw(): void;
126
183
  /**
@@ -155,9 +212,9 @@ export default class Input extends WJElement {
155
212
  validateInput(): void;
156
213
  validationError: string;
157
214
  /**
158
- * @summary Propagates the validation state of the input.
159
- * This method sets the 'invalid' property of the input based on its 'pristine' state and its internal validity state.
160
- * If the input is invalid and the 'customErrorDisplay' property is true, it dispatches an 'invalid' event.
215
+ * Checks and updates the validation state of the component based on its current properties.
216
+ * If the component is invalid and a custom error display is enabled, it dispatches an 'invalid' event.
217
+ * @returns {void} This method does not return a value.
161
218
  */
162
219
  propagateValidation(): void;
163
220
  /**
@@ -170,6 +170,8 @@ export default class Select extends WJElement {
170
170
  * @returns {object} The value of the attribute.
171
171
  */
172
172
  get value(): object;
173
+ set required(value: boolean);
174
+ get required(): boolean;
173
175
  /**
174
176
  * Getter for the customErrorDisplay attribute.
175
177
  * @returns {boolean} Whether the attribute is present.
@@ -181,13 +183,16 @@ export default class Select extends WJElement {
181
183
  */
182
184
  get validateOnChange(): boolean;
183
185
  /**
184
- * Setter for the invalid attribute.
185
- * @param {boolean} isInvalid Whether the input is invalid.
186
+ * Sets the 'invalid' property of the element.
187
+ * When set to a truthy value, the 'invalid' attribute is added to the element.
188
+ * When set to a falsy value, the 'invalid' attribute is removed from the element.
189
+ * @param {boolean} value A boolean indicating whether the element is invalid.
186
190
  */
187
- set invalid(isInvalid: boolean);
191
+ set invalid(value: boolean);
188
192
  /**
189
- * Getter for the invalid attribute.
190
- * @returns {boolean} Whether the attribute is present.
193
+ * Retrieves the value of the 'invalid' attribute.
194
+ * This method checks if the 'invalid' attribute is present on the element.
195
+ * @returns {boolean} Returns true if the 'invalid' attribute is present, otherwise false.
191
196
  */
192
197
  get invalid(): boolean;
193
198
  /**
@@ -263,9 +268,9 @@ export default class Select extends WJElement {
263
268
  * The options are determined by combining elements from various sources, including loaded options, added options, and HTML-sourced options.
264
269
  * If a `wje-options` element is present within the component, its loaded options are included in the merged list.
265
270
  * In the absence of a `wje-options` element, duplicates among the added and HTML options are removed, retaining their order.
266
- * @returns {Array<Object>} An array containing all the available options, combining the loaded, added, and HTML-based options, with duplicates removed where applicable.
271
+ * @returns {Array<object>} An array containing all the available options, combining the loaded, added, and HTML-based options, with duplicates removed where applicable.
267
272
  */
268
- get options(): Array<any>;
273
+ get options(): Array<object>;
269
274
  /**
270
275
  * Sets the trigger value.
271
276
  * @param {string} value The trigger value to set.
@@ -291,6 +296,7 @@ export default class Select extends WJElement {
291
296
  * @returns {void} Does not return a value. The method operates by updating the state and behavior of the component.
292
297
  */
293
298
  afterDraw(): void;
299
+ pristine: boolean;
294
300
  /**
295
301
  * Handles the option change event.
296
302
  * @param {Event} e The event.
@@ -413,9 +419,31 @@ export default class Select extends WJElement {
413
419
  */
414
420
  htmlSelectedItem(item: any): any;
415
421
  /**
416
- * @summary Callback function that is called when the custom element is associated with a form.
417
- * This function adds an event listener to the form's submit event, which validates the input and propagates the validation.
418
- * @param {HTMLFormElement} form The form the custom element is associated with.
422
+ * Clones and appends an icon from a template with slot "check" to the given option element.
423
+ * @param {HTMLElement} option The target option element where the "check" icon will be added.
424
+ * @returns {void}
425
+ */
426
+ optionCheckSlot(option: HTMLElement): void;
427
+ /**
428
+ * Validates the selection of options in the select element.
429
+ * Checks if the element is required and no option is selected,
430
+ * in which case it sets a validation error with a custom message.
431
+ * If the element passes validation, it clears any existing validation errors.
432
+ *
433
+ * @return {void} Does not return a value.
434
+ */
435
+ validateSelect(): void;
436
+ /**
437
+ * Checks and updates the validation state of the component based on its current properties.
438
+ * If the component is invalid and a custom error display is enabled, it dispatches an 'invalid' event.
439
+ * @returns {void} This method does not return a value.
440
+ */
441
+ propagateValidation(): void;
442
+ showInvalidMessage(): void;
443
+ /**
444
+ * Lifecycle callback invoked when the custom element becomes associated with a form element.
445
+ * @param {HTMLFormElement} form The form element the custom element is associated with.
446
+ * @returns {void}
419
447
  */
420
448
  formAssociatedCallback(form: HTMLFormElement): void;
421
449
  /**
@@ -454,11 +482,5 @@ export default class Select extends WJElement {
454
482
  * @returns {boolean} Returns true if all elements in the `elements` array are found within the `options` array, otherwise returns false.
455
483
  */
456
484
  areAllElementsInOptions(elements: any[], options: any[]): boolean;
457
- /**
458
- * Clones and appends an icon from a template with slot "check" to the given option element.
459
- * @param {HTMLElement} option The target option element where the "check" icon will be added.
460
- * @returns {void}
461
- */
462
- optionCheckSlot(option: HTMLElement): void;
463
485
  #private;
464
486
  }
@@ -65,6 +65,20 @@ export default class Textarea extends WJElement {
65
65
  */
66
66
  get value(): string;
67
67
  _value: string;
68
+ /**
69
+ * Sets the `validateOnChange` property. If set to a truthy value, it adds the
70
+ * `validate-on-change` attribute to the element. If set to a falsy value, it
71
+ * removes the `validate-on-change` attribute from the element.
72
+ * @param {boolean} value Determines whether to add or remove the
73
+ * `validate-on-change` attribute. A truthy value adds the attribute, whereas a
74
+ * falsy value removes it.
75
+ */
76
+ set validateOnChange(value: boolean);
77
+ /**
78
+ * Getter for the validateOnChange attribute.
79
+ * @returns {boolean} Whether the attribute is present.
80
+ */
81
+ get validateOnChange(): boolean;
68
82
  /**
69
83
  * Getter for the form attribute.
70
84
  * @returns {HTMLFormElement} The form the input is associated with.
@@ -121,6 +135,12 @@ export default class Textarea extends WJElement {
121
135
  * @param {Event} e The event object.
122
136
  */
123
137
  counterFn: (e: Event) => void;
138
+ /**
139
+ * @summary Displays the validation message for the input.
140
+ * If the input has a slot named 'error', it sets the text content of the element with attribute 'error-message' inside the slot to the validation message.
141
+ * If the input does not have an 'error' slot, it sets the text content of the errorMessage property to the validation message.
142
+ */
143
+ showInvalidMessage(): void;
124
144
  /**
125
145
  * @summary Validates the input.
126
146
  * This method checks the validity state of the input. If the input is not valid, it iterates over the validity state object.
@@ -67,6 +67,7 @@ export default class Tree extends WJElement {
67
67
  * @returns {void} This method does not return a value. If the icon matching the given status is not found, a warning is logged.
68
68
  */
69
69
  getExpandCollapseIcon(item: HTMLElement, status: string): void;
70
+ getSlots(item: any, slotName: any): void;
70
71
  /**
71
72
  * Updates the state of a checkbox, syncing the state both upwards to parent elements
72
73
  * and downwards to child elements as necessary.
@@ -96,7 +96,7 @@ class IconPicker extends WJElement {
96
96
  * // The resulting structure:
97
97
  * // <div class="icon-item">
98
98
  * // <wje-tooltip content="hourglass">
99
- * // <wje-icon name="hourglass" size="large" filled></wje-icon>
99
+ * // <wje-icon name="hourglass" size="large" filled></wje-icon></wje-icon>
100
100
  * // </wje-tooltip>
101
101
  * // </div>
102
102
  */
@@ -1 +1 @@
1
- {"version":3,"file":"wje-icon-picker.js","sources":["../packages/wje-icon-picker/icon-picker.element.js","../packages/wje-icon-picker/icon-picker.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport { getBasePath } from \"../utils/base-path.js\";\nimport InfiniteScroll from '../wje-infinite-scroll/infinite-scroll.js';\nimport Input from '../wje-input/input.js';\nimport Popup from '../wje-popup/popup.js';\nimport Tooltip from '../wje-tooltip/tooltip.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This element allows users to pick an icon from a set of available options.\n * `IconPicker` is a custom web component that represents an interactive icon picker. It features\n * search functionality, infinite scrolling, and popup-based selection. The component is highly customizable\n * and integrates seamlessly with other `WJElement` components.\n * @documentation https://elements.webjet.sk/components/icon-picker\n * @status stable\n * @augments {WJElement}\n * @attribute {string} icon - The selected icon's name.\n * @attribute {number} size - The number of icons displayed per page in infinite scroll. Default is 60.\n * @csspart native - The native part of the component.\n * @csspart anchor - The part representing the anchor button displaying the selected icon.\n * @csspart picker - The picker part containing the search and icon selection interface.\n * @csspart input - The input part for searching icons.\n * @cssproperty [--wje-color-picker-value=#ff0000] - The default color value.\n * @cssproperty [--wje-color-picker-area=transparent] - The background color of the color picker area.\n * @cssproperty [--wje-color-picker-swatch=transparent] - The background color of the swatch picker.\n * @cssproperty [--wje-color-picker-size=1rem] - The size of the icons in the picker.\n * @cssproperty [--wje-color-picker-radius=4px] - The border radius of the picker.\n * @tag wje-icon-picker\n */\n\nexport default class IconPicker extends WJElement {\n /**\n * Creates an instance of IconPicker.\n * @class\n */\n constructor() {\n super();\n }\n\n /**\n * Dependencies of the IconPicker component.\n * @property {object} dependencies\n */\n dependencies = {\n 'wje-input': Input,\n 'wje-infinite-scroll': InfiniteScroll,\n 'wje-tooltip': Tooltip,\n 'wje-popup': Popup,\n };\n\n /**\n * Setter for the markerPosition property.\n * @param {any} value The value to set.\n */\n set size(value) {\n this.setAttribute('size', value);\n }\n\n /**\n * Getter for the markerPosition property.\n * @returns {any} size The value of the markerPosition property.\n */\n get size() {\n return this.getAttribute('size') || 60;\n }\n\n /**\n * Setter for the value property.\n * @param value\n */\n set icon(value) {\n this.setAttribute('icon', value);\n }\n\n /**\n * Getter for the value property.\n * @returns {string}\n */\n get icon() {\n return this.getAttribute('icon');\n }\n\n className = 'IconPicker';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Prepares the component before drawing.\n */\n async beforeDraw() {\n this.tags = Object.values(await this.getTags());\n\n this.transformedObjects = this.convertObject(this.tags);\n\n this.index = this.transformedObjects.map((item) => ({\n ...item,\n searchText: `${item.name.toLowerCase()} ${item.tags.join(' ').toLowerCase()}`,\n }));\n }\n\n /**\n * Draws the component.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.classList.add('native-color-picker');\n\n // ANCHOR\n let anchor = document.createElement('div');\n anchor.setAttribute('slot', 'anchor');\n anchor.classList.add('anchor');\n\n if (this.hasAttribute('icon') && this.icon) {\n let icon = document.createElement('wje-icon');\n icon.setAttribute('name', this.icon);\n\n anchor.appendChild(icon);\n }\n\n // PICKER\n let picker = document.createElement('div');\n picker.classList.add('picker');\n\n let input = document.createElement('wje-input');\n input.classList.add('input');\n input.setAttribute('variant', 'standard');\n input.setAttribute('placeholder', 'type to filter...');\n input.setAttribute('clearable', '');\n input.addEventListener('wje-input:input', this.searchIcon);\n\n let infiniteScroll = new InfiniteScroll();\n infiniteScroll.setAttribute('url', getBasePath('assets/tags.json'));\n infiniteScroll.setAttribute('placement', '.icon-items');\n infiniteScroll.setAttribute('size', this.size);\n infiniteScroll.setAttribute('height', '223px');\n infiniteScroll.innerHTML = '<div class=\"icon-items\"></div>';\n\n // APPEND\n picker.appendChild(input);\n\n picker.appendChild(infiniteScroll);\n\n // POPUP\n let popup = document.createElement('wje-popup');\n popup.setAttribute('placement', this.placement || 'bottom-start');\n popup.setAttribute('offset', this.offset);\n popup.setAttribute('manual', '');\n\n popup.appendChild(anchor);\n popup.appendChild(picker);\n\n native.appendChild(popup);\n\n fragment.appendChild(native);\n\n this.popup = popup;\n this.input = input;\n this.anchor = anchor;\n this.picker = picker;\n this.infiniteScroll = infiniteScroll;\n\n this.infiniteScroll.dataToHtml = this.dataToHtml;\n this.infiniteScroll.compareFunction = (i, item) => i.name === item.name;\n this.infiniteScroll.setCustomData = (page = 0) => {\n return {\n data: this.transformedObjects.slice(page * this.size, page * this.size + this.size),\n page: page,\n size: this.size,\n totalPages: Math.round(this.transformedObjects.length / this.size),\n };\n };\n\n return fragment;\n }\n\n /**\n * Called after the component has been drawn.\n */\n afterDraw() {\n this.addEventListener('wje-popup:show', () => {\n this.initial();\n });\n\n // udalost po vymazani inputu\n this.addEventListener('wje-input:clear', () => {\n this.clearIconsContainer(); // clear icons container\n this.infiniteScroll.scrollEvent(); // bind scroll event\n this.infiniteScroll.loadPages(0); // load first page\n });\n\n this.addEventListener('wje-infinite-scroll:click-item', (e) => {\n let icon = e.detail.context.querySelector('wje-icon');\n let name = icon.getAttribute('name');\n let stylesType = icon.hasAttribute('filled') ? 'filled' : 'outline';\n let uniqueObject = this.transformedObjects.find(\n (i) => i.name === name && Object.keys(i.styles)[0] === stylesType\n );\n\n const iconElement = document.createElement('wje-icon');\n iconElement.setAttribute('name', name);\n if (uniqueObject.styles.hasOwnProperty('filled')) iconElement.setAttribute('filled', '');\n\n uniqueObject.icon = iconElement;\n\n this.value = uniqueObject;\n this.icon = uniqueObject.name;\n\n this.anchor.innerHTML = '';\n this.anchor.appendChild(iconElement);\n\n event.dispatchCustomEvent(this, 'wje-icon-picker:select', uniqueObject); // odpalenie custom eventu\n });\n\n this.init = false;\n }\n\n /**\n * Initializes the component.\n */\n initial() {\n this.infiniteScroll.scrollEvent();\n }\n\n /**\n * Converts an object of tags into a transformed array of objects, separating `filled` and `outline` styles.\n * The function processes an input object containing tags, extracts its values,\n * and for each tag that has both `filled` and `outline` styles, splits them into\n * two separate objects. Tags without `filled` styles remain unchanged.\n * @param {object} tags The input object containing tags as properties. Each property is an object with a `styles` key.\n * @param {object} tags[].styles The styles object containing `filled` and/or `outline` styles.\n * @param {object} [tags[].styles.outline] The outline style object, if present.\n * @param {object} [tags[].styles.filled] The filled style object, if present.\n * @returns {Array<object>} An array of transformed objects. Objects with both `filled` and `outline` styles are split into separate objects, each containing only one style.\n * @example\n * const tags = {\n * hourglass: {\n * styles: {\n * outline: { ... },\n * filled: { ... },\n * }\n * },\n * clock: {\n * styles: {\n * outline: { ... },\n * }\n * }\n * };\n * const result = convertObject(tags);\n * console.log(result);\n * // [\n * // { styles: { outline: { ... } } },\n * // { styles: { filled: { ... } } },\n * // { styles: { outline: { ... } } }\n * // ]\n */\n convertObject = (tags = {}) => {\n let originalObjects = Object.values(tags);\n let transformedObjects = [];\n for (let i = 0; i < originalObjects.length; i++) {\n const obj = originalObjects[i];\n if (obj.styles.filled) {\n transformedObjects.push(\n { ...obj, styles: { outline: obj.styles.outline } },\n { ...obj, styles: { filled: obj.styles.filled } }\n );\n } else {\n transformedObjects.push(obj);\n }\n }\n\n return transformedObjects;\n };\n\n /**\n * Converts an icon data object into an HTML element structure.\n * This function creates a styled HTML element that represents an icon with a tooltip.\n * The tooltip displays the name of the icon, and the icon itself is styled based on\n * whether it uses the `filled` style.\n * @param {object} data The icon data object.\n * @returns {HTMLElement} A `div` element containing the icon wrapped in a `wje-tooltip`. The tooltip displays the icon name, and the `wje-icon` element represents the icon with attributes set according to the data.\n * @example\n * const iconData = {\n * name: \"hourglass\",\n * styles: {\n * filled: { ... }\n * }\n * };\n * const htmlElement = dataToHtml(iconData);\n * document.body.appendChild(htmlElement);\n *\n * // The resulting structure:\n * // <div class=\"icon-item\">\n * // <wje-tooltip content=\"hourglass\">\n * // <wje-icon name=\"hourglass\" size=\"large\" filled></wje-icon>\n * // </wje-tooltip>\n * // </div>\n */\n dataToHtml = (data) => {\n let iconItem = document.createElement('div');\n iconItem.classList.add('icon-item');\n\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('content', data.name);\n\n let icon = document.createElement('wje-icon');\n icon.setAttribute('name', data.name);\n icon.setAttribute('size', 'large');\n if (data.styles.hasOwnProperty('filled')) icon.setAttribute('filled', '');\n\n tooltip.appendChild(icon);\n iconItem.appendChild(tooltip);\n\n return iconItem;\n };\n\n /**\n * Gets the category of the tags.\n * @param {Array} tags The tags to get the category of.\n * @returns {Array} The category of the tags.\n */\n getCategory(tags) {\n return [...new Set(tags.map((obj) => obj.category))];\n }\n\n /**\n * Gets the tags.\n * @returns {Promise<Array>} The tags of the component.\n */\n async getTags() {\n const response = await fetch(getBasePath('assets/tags.json'));\n return response.json();\n }\n\n /**\n * Called when the component is disconnected.\n */\n beforeDisconnect() {\n this.init = false;\n }\n\n /**\n * Searches icons based on user input.\n * This method handles the input event and filters the available icons based on the provided search string.\n * The filtering is performed on an index that combines icon names and their tags.\n * The results are then adjusted for infinite scrolling.\n * @param {Event} e The input event (e.g., `wje-input:input`) containing the search query details.\n */\n searchIcon = (e) => {\n const query = e.detail.value.toLowerCase();\n\n const results = this.index.filter((item) => item.searchText.includes(query));\n\n this.infiniteScroll.unScrollEvent();\n this.infiniteScroll.setCustomData = (page = 0) => {\n const data = results.slice(page * this.size, page * this.size + this.size);\n return {\n data: data,\n page: page,\n size: this.size,\n totalPages: Math.ceil(results.length / this.size),\n };\n };\n\n this.clearIconsContainer();\n this.infiniteScroll.loadPages(0);\n }\n\n /**\n * Clears the icons container.\n */\n clearIconsContainer() {\n this.context.querySelector('.icon-items').innerHTML = '';\n }\n\n /**\n * Closes the component.\n */\n onClose = () => {\n this.popup.handleHide();\n }\n}\n","import IconPicker from './icon-picker.element.js';\n\nexport default IconPicker;\n\nIconPicker.define('wje-icon-picker', IconPicker);\n"],"names":[],"mappings":";;;;;;;;;;;;AA8Be,MAAM,mBAAmB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK9C,cAAc;AACV,UAAO;AAOX;AAAA;AAAA;AAAA;AAAA,wCAAe;AAAA,MACX,aAAa;AAAA,MACb,uBAAuB;AAAA,MACvB,eAAe;AAAA,MACf,aAAa;AAAA,IAChB;AAkCD,qCAAY;AAuMZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yCAAgB,CAAC,OAAO,OAAO;AAC3B,UAAI,kBAAkB,OAAO,OAAO,IAAI;AACxC,UAAI,qBAAqB,CAAE;AAC3B,eAAS,IAAI,GAAG,IAAI,gBAAgB,QAAQ,KAAK;AAC7C,cAAM,MAAM,gBAAgB,CAAC;AAC7B,YAAI,IAAI,OAAO,QAAQ;AACnB,6BAAmB;AAAA,YACf,EAAE,GAAG,KAAK,QAAQ,EAAE,SAAS,IAAI,OAAO,UAAW;AAAA,YACnD,EAAE,GAAG,KAAK,QAAQ,EAAE,QAAQ,IAAI,OAAO,OAAQ,EAAA;AAAA,UAClD;AAAA,QACjB,OAAmB;AACH,6BAAmB,KAAK,GAAG;AAAA,QAC3C;AAAA,MACA;AAEQ,aAAO;AAAA,IACV;AA0BD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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EAC9B;AAAA;AAAA;AAAA;AAAA,EAKI,mBAAmB;AACf,SAAK,OAAO;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA,EAgCI,sBAAsB;AAClB,SAAK,QAAQ,cAAc,aAAa,EAAE,YAAY;AAAA,EAC9D;AAQA;AClZA,WAAW,OAAO,mBAAmB,UAAU;"}
1
+ {"version":3,"file":"wje-icon-picker.js","sources":["../packages/wje-icon-picker/icon-picker.element.js","../packages/wje-icon-picker/icon-picker.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport { getBasePath } from \"../utils/base-path.js\";\nimport InfiniteScroll from '../wje-infinite-scroll/infinite-scroll.js';\nimport Input from '../wje-input/input.js';\nimport Popup from '../wje-popup/popup.js';\nimport Tooltip from '../wje-tooltip/tooltip.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This element allows users to pick an icon from a set of available options.\n * `IconPicker` is a custom web component that represents an interactive icon picker. It features\n * search functionality, infinite scrolling, and popup-based selection. The component is highly customizable\n * and integrates seamlessly with other `WJElement` components.\n * @documentation https://elements.webjet.sk/components/icon-picker\n * @status stable\n * @augments {WJElement}\n * @attribute {string} icon - The selected icon's name.\n * @attribute {number} size - The number of icons displayed per page in infinite scroll. Default is 60.\n * @csspart native - The native part of the component.\n * @csspart anchor - The part representing the anchor button displaying the selected icon.\n * @csspart picker - The picker part containing the search and icon selection interface.\n * @csspart input - The input part for searching icons.\n * @cssproperty [--wje-color-picker-value=#ff0000] - The default color value.\n * @cssproperty [--wje-color-picker-area=transparent] - The background color of the color picker area.\n * @cssproperty [--wje-color-picker-swatch=transparent] - The background color of the swatch picker.\n * @cssproperty [--wje-color-picker-size=1rem] - The size of the icons in the picker.\n * @cssproperty [--wje-color-picker-radius=4px] - The border radius of the picker.\n * @tag wje-icon-picker\n */\n\nexport default class IconPicker extends WJElement {\n /**\n * Creates an instance of IconPicker.\n * @class\n */\n constructor() {\n super();\n }\n\n /**\n * Dependencies of the IconPicker component.\n * @property {object} dependencies\n */\n dependencies = {\n 'wje-input': Input,\n 'wje-infinite-scroll': InfiniteScroll,\n 'wje-tooltip': Tooltip,\n 'wje-popup': Popup,\n };\n\n /**\n * Setter for the markerPosition property.\n * @param {any} value The value to set.\n */\n set size(value) {\n this.setAttribute('size', value);\n }\n\n /**\n * Getter for the markerPosition property.\n * @returns {any} size The value of the markerPosition property.\n */\n get size() {\n return this.getAttribute('size') || 60;\n }\n\n /**\n * Setter for the value property.\n * @param value\n */\n set icon(value) {\n this.setAttribute('icon', value);\n }\n\n /**\n * Getter for the value property.\n * @returns {string}\n */\n get icon() {\n return this.getAttribute('icon');\n }\n\n className = 'IconPicker';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Prepares the component before drawing.\n */\n async beforeDraw() {\n this.tags = Object.values(await this.getTags());\n\n this.transformedObjects = this.convertObject(this.tags);\n\n this.index = this.transformedObjects.map((item) => ({\n ...item,\n searchText: `${item.name.toLowerCase()} ${item.tags.join(' ').toLowerCase()}`,\n }));\n }\n\n /**\n * Draws the component.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.classList.add('native-color-picker');\n\n // ANCHOR\n let anchor = document.createElement('div');\n anchor.setAttribute('slot', 'anchor');\n anchor.classList.add('anchor');\n\n if (this.hasAttribute('icon') && this.icon) {\n let icon = document.createElement('wje-icon');\n icon.setAttribute('name', this.icon);\n\n anchor.appendChild(icon);\n }\n\n // PICKER\n let picker = document.createElement('div');\n picker.classList.add('picker');\n\n let input = document.createElement('wje-input');\n input.classList.add('input');\n input.setAttribute('variant', 'standard');\n input.setAttribute('placeholder', 'type to filter...');\n input.setAttribute('clearable', '');\n input.addEventListener('wje-input:input', this.searchIcon);\n\n let infiniteScroll = new InfiniteScroll();\n infiniteScroll.setAttribute('url', getBasePath('assets/tags.json'));\n infiniteScroll.setAttribute('placement', '.icon-items');\n infiniteScroll.setAttribute('size', this.size);\n infiniteScroll.setAttribute('height', '223px');\n infiniteScroll.innerHTML = '<div class=\"icon-items\"></div>';\n\n // APPEND\n picker.appendChild(input);\n\n picker.appendChild(infiniteScroll);\n\n // POPUP\n let popup = document.createElement('wje-popup');\n popup.setAttribute('placement', this.placement || 'bottom-start');\n popup.setAttribute('offset', this.offset);\n popup.setAttribute('manual', '');\n\n popup.appendChild(anchor);\n popup.appendChild(picker);\n\n native.appendChild(popup);\n\n fragment.appendChild(native);\n\n this.popup = popup;\n this.input = input;\n this.anchor = anchor;\n this.picker = picker;\n this.infiniteScroll = infiniteScroll;\n\n this.infiniteScroll.dataToHtml = this.dataToHtml;\n this.infiniteScroll.compareFunction = (i, item) => i.name === item.name;\n this.infiniteScroll.setCustomData = (page = 0) => {\n return {\n data: this.transformedObjects.slice(page * this.size, page * this.size + this.size),\n page: page,\n size: this.size,\n totalPages: Math.round(this.transformedObjects.length / this.size),\n };\n };\n\n return fragment;\n }\n\n /**\n * Called after the component has been drawn.\n */\n afterDraw() {\n this.addEventListener('wje-popup:show', () => {\n this.initial();\n });\n\n // udalost po vymazani inputu\n this.addEventListener('wje-input:clear', () => {\n this.clearIconsContainer(); // clear icons container\n this.infiniteScroll.scrollEvent(); // bind scroll event\n this.infiniteScroll.loadPages(0); // load first page\n });\n\n this.addEventListener('wje-infinite-scroll:click-item', (e) => {\n let icon = e.detail.context.querySelector('wje-icon');\n let name = icon.getAttribute('name');\n let stylesType = icon.hasAttribute('filled') ? 'filled' : 'outline';\n let uniqueObject = this.transformedObjects.find(\n (i) => i.name === name && Object.keys(i.styles)[0] === stylesType\n );\n\n const iconElement = document.createElement('wje-icon');\n iconElement.setAttribute('name', name);\n if (uniqueObject.styles.hasOwnProperty('filled')) iconElement.setAttribute('filled', '');\n\n uniqueObject.icon = iconElement;\n\n this.value = uniqueObject;\n this.icon = uniqueObject.name;\n\n this.anchor.innerHTML = '';\n this.anchor.appendChild(iconElement);\n\n event.dispatchCustomEvent(this, 'wje-icon-picker:select', uniqueObject); // odpalenie custom eventu\n });\n\n this.init = false;\n }\n\n /**\n * Initializes the component.\n */\n initial() {\n this.infiniteScroll.scrollEvent();\n }\n\n /**\n * Converts an object of tags into a transformed array of objects, separating `filled` and `outline` styles.\n * The function processes an input object containing tags, extracts its values,\n * and for each tag that has both `filled` and `outline` styles, splits them into\n * two separate objects. Tags without `filled` styles remain unchanged.\n * @param {object} tags The input object containing tags as properties. Each property is an object with a `styles` key.\n * @param {object} tags[].styles The styles object containing `filled` and/or `outline` styles.\n * @param {object} [tags[].styles.outline] The outline style object, if present.\n * @param {object} [tags[].styles.filled] The filled style object, if present.\n * @returns {Array<object>} An array of transformed objects. Objects with both `filled` and `outline` styles are split into separate objects, each containing only one style.\n * @example\n * const tags = {\n * hourglass: {\n * styles: {\n * outline: { ... },\n * filled: { ... },\n * }\n * },\n * clock: {\n * styles: {\n * outline: { ... },\n * }\n * }\n * };\n * const result = convertObject(tags);\n * console.log(result);\n * // [\n * // { styles: { outline: { ... } } },\n * // { styles: { filled: { ... } } },\n * // { styles: { outline: { ... } } }\n * // ]\n */\n convertObject = (tags = {}) => {\n let originalObjects = Object.values(tags);\n let transformedObjects = [];\n for (let i = 0; i < originalObjects.length; i++) {\n const obj = originalObjects[i];\n if (obj.styles.filled) {\n transformedObjects.push(\n { ...obj, styles: { outline: obj.styles.outline } },\n { ...obj, styles: { filled: obj.styles.filled } }\n );\n } else {\n transformedObjects.push(obj);\n }\n }\n\n return transformedObjects;\n };\n\n /**\n * Converts an icon data object into an HTML element structure.\n * This function creates a styled HTML element that represents an icon with a tooltip.\n * The tooltip displays the name of the icon, and the icon itself is styled based on\n * whether it uses the `filled` style.\n * @param {object} data The icon data object.\n * @returns {HTMLElement} A `div` element containing the icon wrapped in a `wje-tooltip`. The tooltip displays the icon name, and the `wje-icon` element represents the icon with attributes set according to the data.\n * @example\n * const iconData = {\n * name: \"hourglass\",\n * styles: {\n * filled: { ... }\n * }\n * };\n * const htmlElement = dataToHtml(iconData);\n * document.body.appendChild(htmlElement);\n *\n * // The resulting structure:\n * // <div class=\"icon-item\">\n * // <wje-tooltip content=\"hourglass\">\n * // <wje-icon name=\"hourglass\" size=\"large\" filled></wje-icon></wje-icon>\n * // </wje-tooltip>\n * // </div>\n */\n dataToHtml = (data) => {\n let iconItem = document.createElement('div');\n iconItem.classList.add('icon-item');\n\n let tooltip = document.createElement('wje-tooltip');\n tooltip.setAttribute('content', data.name);\n\n let icon = document.createElement('wje-icon');\n icon.setAttribute('name', data.name);\n icon.setAttribute('size', 'large');\n if (data.styles.hasOwnProperty('filled')) icon.setAttribute('filled', '');\n\n tooltip.appendChild(icon);\n iconItem.appendChild(tooltip);\n\n return iconItem;\n };\n\n /**\n * Gets the category of the tags.\n * @param {Array} tags The tags to get the category of.\n * @returns {Array} The category of the tags.\n */\n getCategory(tags) {\n return [...new Set(tags.map((obj) => obj.category))];\n }\n\n /**\n * Gets the tags.\n * @returns {Promise<Array>} The tags of the component.\n */\n async getTags() {\n const response = await fetch(getBasePath('assets/tags.json'));\n return response.json();\n }\n\n /**\n * Called when the component is disconnected.\n */\n beforeDisconnect() {\n this.init = false;\n }\n\n /**\n * Searches icons based on user input.\n * This method handles the input event and filters the available icons based on the provided search string.\n * The filtering is performed on an index that combines icon names and their tags.\n * The results are then adjusted for infinite scrolling.\n * @param {Event} e The input event (e.g., `wje-input:input`) containing the search query details.\n */\n searchIcon = (e) => {\n const query = e.detail.value.toLowerCase();\n\n const results = this.index.filter((item) => item.searchText.includes(query));\n\n this.infiniteScroll.unScrollEvent();\n this.infiniteScroll.setCustomData = (page = 0) => {\n const data = results.slice(page * this.size, page * this.size + this.size);\n return {\n data: data,\n page: page,\n size: this.size,\n totalPages: Math.ceil(results.length / this.size),\n };\n };\n\n this.clearIconsContainer();\n this.infiniteScroll.loadPages(0);\n }\n\n /**\n * Clears the icons container.\n */\n clearIconsContainer() {\n this.context.querySelector('.icon-items').innerHTML = '';\n }\n\n /**\n * Closes the component.\n */\n onClose = () => {\n this.popup.handleHide();\n }\n}\n","import IconPicker from './icon-picker.element.js';\n\nexport default IconPicker;\n\nIconPicker.define('wje-icon-picker', IconPicker);\n"],"names":[],"mappings":";;;;;;;;;;;;AA8Be,MAAM,mBAAmB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK9C,cAAc;AACV,UAAO;AAOX;AAAA;AAAA;AAAA;AAAA,wCAAe;AAAA,MACX,aAAa;AAAA,MACb,uBAAuB;AAAA,MACvB,eAAe;AAAA,MACf,aAAa;AAAA,IAChB;AAkCD,qCAAY;AAuMZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yCAAgB,CAAC,OAAO,OAAO;AAC3B,UAAI,kBAAkB,OAAO,OAAO,IAAI;AACxC,UAAI,qBAAqB,CAAE;AAC3B,eAAS,IAAI,GAAG,IAAI,gBAAgB,QAAQ,KAAK;AAC7C,cAAM,MAAM,gBAAgB,CAAC;AAC7B,YAAI,IAAI,OAAO,QAAQ;AACnB,6BAAmB;AAAA,YACf,EAAE,GAAG,KAAK,QAAQ,EAAE,SAAS,IAAI,OAAO,UAAW;AAAA,YACnD,EAAE,GAAG,KAAK,QAAQ,EAAE,QAAQ,IAAI,OAAO,OAAQ,EAAA;AAAA,UAClD;AAAA,QACjB,OAAmB;AACH,6BAAmB,KAAK,GAAG;AAAA,QAC3C;AAAA,MACA;AAEQ,aAAO;AAAA,IACV;AA0BD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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