wj-elements 0.7.6 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/dist/animations.js +28 -51
  2. package/dist/animations.js.map +1 -1
  3. package/dist/base-path.js +19 -31
  4. package/dist/base-path.js.map +1 -1
  5. package/dist/custom-elements.json +9053 -9048
  6. package/dist/dark.css +1 -302
  7. package/dist/date.js +16 -36
  8. package/dist/date.js.map +1 -1
  9. package/dist/element-utils.js +20 -81
  10. package/dist/element-utils.js.map +1 -1
  11. package/dist/event.js +49 -165
  12. package/dist/event.js.map +1 -1
  13. package/dist/form-associated-element-BjeJn7j8.js +101 -0
  14. package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
  15. package/dist/icon-DmsqtDpL.js +102 -0
  16. package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
  17. package/dist/light.css +1 -731
  18. package/dist/localize.js +36 -111
  19. package/dist/localize.js.map +1 -1
  20. package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
  21. package/dist/packages/wje-img/img.element.d.ts +4 -4
  22. package/dist/permissions.js +14 -41
  23. package/dist/permissions.js.map +1 -1
  24. package/dist/popup.element-CbkhthPP.js +806 -0
  25. package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
  26. package/dist/router-links-CNsJ-elb.js +105 -0
  27. package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
  28. package/dist/skeleton.css +1 -197
  29. package/dist/styles.css +1 -866
  30. package/dist/universal-service.js +48 -109
  31. package/dist/universal-service.js.map +1 -1
  32. package/dist/utils.js +11 -18
  33. package/dist/utils.js.map +1 -1
  34. package/dist/web-types.json +698 -698
  35. package/dist/wje-accordion-item.js +33 -106
  36. package/dist/wje-accordion-item.js.map +1 -1
  37. package/dist/wje-accordion.js +19 -84
  38. package/dist/wje-accordion.js.map +1 -1
  39. package/dist/wje-animation.js +37 -4258
  40. package/dist/wje-animation.js.map +1 -1
  41. package/dist/wje-aside.js +9 -34
  42. package/dist/wje-aside.js.map +1 -1
  43. package/dist/wje-avatar.js +36 -126
  44. package/dist/wje-avatar.js.map +1 -1
  45. package/dist/wje-badge.js +10 -52
  46. package/dist/wje-badge.js.map +1 -1
  47. package/dist/wje-breadcrumb.js +205 -668
  48. package/dist/wje-breadcrumb.js.map +1 -1
  49. package/dist/wje-breadcrumbs.js +177 -633
  50. package/dist/wje-breadcrumbs.js.map +1 -1
  51. package/dist/wje-button-group.js +48 -153
  52. package/dist/wje-button-group.js.map +1 -1
  53. package/dist/wje-button.js +92 -413
  54. package/dist/wje-button.js.map +1 -1
  55. package/dist/wje-card-content.js +7 -30
  56. package/dist/wje-card-content.js.map +1 -1
  57. package/dist/wje-card-controls.js +7 -30
  58. package/dist/wje-card-controls.js.map +1 -1
  59. package/dist/wje-card-header.js +7 -30
  60. package/dist/wje-card-header.js.map +1 -1
  61. package/dist/wje-card-subtitle.js +7 -34
  62. package/dist/wje-card-subtitle.js.map +1 -1
  63. package/dist/wje-card-title.js +7 -34
  64. package/dist/wje-card-title.js.map +1 -1
  65. package/dist/wje-card.js +15 -71
  66. package/dist/wje-card.js.map +1 -1
  67. package/dist/wje-carousel-item.js +12 -56
  68. package/dist/wje-carousel-item.js.map +1 -1
  69. package/dist/wje-carousel.js +154 -509
  70. package/dist/wje-carousel.js.map +1 -1
  71. package/dist/wje-checkbox.js +50 -227
  72. package/dist/wje-checkbox.js.map +1 -1
  73. package/dist/wje-chip.js +43 -160
  74. package/dist/wje-chip.js.map +1 -1
  75. package/dist/wje-col.js +7 -20
  76. package/dist/wje-col.js.map +1 -1
  77. package/dist/wje-color-picker.js +445 -1464
  78. package/dist/wje-color-picker.js.map +1 -1
  79. package/dist/wje-container.js +9 -35
  80. package/dist/wje-container.js.map +1 -1
  81. package/dist/wje-copy-button.js +64 -204
  82. package/dist/wje-copy-button.js.map +1 -1
  83. package/dist/wje-dialog.js +85 -553
  84. package/dist/wje-dialog.js.map +1 -1
  85. package/dist/wje-divider.js +7 -34
  86. package/dist/wje-divider.js.map +1 -1
  87. package/dist/wje-dropdown.js +78 -305
  88. package/dist/wje-dropdown.js.map +1 -1
  89. package/dist/wje-element.js +191 -700
  90. package/dist/wje-element.js.map +1 -1
  91. package/dist/wje-file-upload-item.js +51 -156
  92. package/dist/wje-file-upload-item.js.map +1 -1
  93. package/dist/wje-file-upload.js +181 -619
  94. package/dist/wje-file-upload.js.map +1 -1
  95. package/dist/wje-footer.js +7 -31
  96. package/dist/wje-footer.js.map +1 -1
  97. package/dist/wje-form.js +7 -32
  98. package/dist/wje-form.js.map +1 -1
  99. package/dist/wje-format-digital.js +26 -118
  100. package/dist/wje-format-digital.js.map +1 -1
  101. package/dist/wje-grid.js +7 -33
  102. package/dist/wje-grid.js.map +1 -1
  103. package/dist/wje-header.js +9 -35
  104. package/dist/wje-header.js.map +1 -1
  105. package/dist/wje-icon-library.js +12 -18
  106. package/dist/wje-icon-library.js.map +1 -1
  107. package/dist/wje-icon-picker.js +65 -320
  108. package/dist/wje-icon-picker.js.map +1 -1
  109. package/dist/wje-icon.js +1 -1
  110. package/dist/wje-img-comparer.js +37 -114
  111. package/dist/wje-img-comparer.js.map +1 -1
  112. package/dist/wje-img.js +50 -197
  113. package/dist/wje-img.js.map +1 -1
  114. package/dist/wje-infinite-scroll.js +94 -346
  115. package/dist/wje-infinite-scroll.js.map +1 -1
  116. package/dist/wje-input-file.js +23 -84
  117. package/dist/wje-input-file.js.map +1 -1
  118. package/dist/wje-input.js +78 -392
  119. package/dist/wje-input.js.map +1 -1
  120. package/dist/wje-item.js +11 -64
  121. package/dist/wje-item.js.map +1 -1
  122. package/dist/wje-kanban.js +124 -401
  123. package/dist/wje-kanban.js.map +1 -1
  124. package/dist/wje-label.js +9 -32
  125. package/dist/wje-label.js.map +1 -1
  126. package/dist/wje-level-indicator.js +38 -157
  127. package/dist/wje-level-indicator.js.map +1 -1
  128. package/dist/wje-list.js +10 -40
  129. package/dist/wje-list.js.map +1 -1
  130. package/dist/wje-main.js +7 -31
  131. package/dist/wje-main.js.map +1 -1
  132. package/dist/wje-masonry.js +66 -211
  133. package/dist/wje-masonry.js.map +1 -1
  134. package/dist/wje-master.js +45 -161
  135. package/dist/wje-master.js.map +1 -1
  136. package/dist/wje-menu-button.js +10 -38
  137. package/dist/wje-menu-button.js.map +1 -1
  138. package/dist/wje-menu-item.js +127 -577
  139. package/dist/wje-menu-item.js.map +1 -1
  140. package/dist/wje-menu-label.js +9 -35
  141. package/dist/wje-menu-label.js.map +1 -1
  142. package/dist/wje-menu.js +14 -49
  143. package/dist/wje-menu.js.map +1 -1
  144. package/dist/wje-option.js +48 -279
  145. package/dist/wje-option.js.map +1 -1
  146. package/dist/wje-options.js +130 -384
  147. package/dist/wje-options.js.map +1 -1
  148. package/dist/wje-orgchart-group.js +16 -52
  149. package/dist/wje-orgchart-group.js.map +1 -1
  150. package/dist/wje-orgchart-item.js +24 -93
  151. package/dist/wje-orgchart-item.js.map +1 -1
  152. package/dist/wje-orgchart.js +18 -68
  153. package/dist/wje-orgchart.js.map +1 -1
  154. package/dist/wje-pagination.js +113 -397
  155. package/dist/wje-pagination.js.map +1 -1
  156. package/dist/wje-popup.js +3 -3
  157. package/dist/wje-popup.js.map +1 -1
  158. package/dist/wje-progress-bar.js +53 -205
  159. package/dist/wje-progress-bar.js.map +1 -1
  160. package/dist/wje-qr-code.js +398 -2980
  161. package/dist/wje-qr-code.js.map +1 -1
  162. package/dist/wje-radio-group.js +52 -190
  163. package/dist/wje-radio-group.js.map +1 -1
  164. package/dist/wje-radio.js +24 -118
  165. package/dist/wje-radio.js.map +1 -1
  166. package/dist/wje-rate.js +62 -266
  167. package/dist/wje-rate.js.map +1 -1
  168. package/dist/wje-relative-time.js +24 -99
  169. package/dist/wje-relative-time.js.map +1 -1
  170. package/dist/wje-reorder-dropzone.js +9 -31
  171. package/dist/wje-reorder-dropzone.js.map +1 -1
  172. package/dist/wje-reorder-handle.js +67 -204
  173. package/dist/wje-reorder-handle.js.map +1 -1
  174. package/dist/wje-reorder-item.js +14 -44
  175. package/dist/wje-reorder-item.js.map +1 -1
  176. package/dist/wje-reorder.js +61 -246
  177. package/dist/wje-reorder.js.map +1 -1
  178. package/dist/wje-route.js +6 -24
  179. package/dist/wje-route.js.map +1 -1
  180. package/dist/wje-router-link.js +11 -39
  181. package/dist/wje-router-link.js.map +1 -1
  182. package/dist/wje-router-outlet.js +76 -172
  183. package/dist/wje-router-outlet.js.map +1 -1
  184. package/dist/wje-routerx.js +537 -1331
  185. package/dist/wje-routerx.js.map +1 -1
  186. package/dist/wje-row.js +9 -31
  187. package/dist/wje-row.js.map +1 -1
  188. package/dist/wje-select.js +326 -1152
  189. package/dist/wje-select.js.map +1 -1
  190. package/dist/wje-slider.js +44 -225
  191. package/dist/wje-slider.js.map +1 -1
  192. package/dist/wje-sliding-container.js +295 -1319
  193. package/dist/wje-sliding-container.js.map +1 -1
  194. package/dist/wje-split-view.js +35 -121
  195. package/dist/wje-split-view.js.map +1 -1
  196. package/dist/wje-status.js +14 -45
  197. package/dist/wje-status.js.map +1 -1
  198. package/dist/wje-step.js +9 -32
  199. package/dist/wje-step.js.map +1 -1
  200. package/dist/wje-stepper.js +109 -357
  201. package/dist/wje-stepper.js.map +1 -1
  202. package/dist/wje-store.js +67 -360
  203. package/dist/wje-store.js.map +1 -1
  204. package/dist/wje-tab-group.js +85 -314
  205. package/dist/wje-tab-group.js.map +1 -1
  206. package/dist/wje-tab-panel.js +7 -28
  207. package/dist/wje-tab-panel.js.map +1 -1
  208. package/dist/wje-tab.js +21 -198
  209. package/dist/wje-tab.js.map +1 -1
  210. package/dist/wje-textarea.js +64 -264
  211. package/dist/wje-textarea.js.map +1 -1
  212. package/dist/wje-thumbnail.js +10 -51
  213. package/dist/wje-thumbnail.js.map +1 -1
  214. package/dist/wje-toast.js +127 -632
  215. package/dist/wje-toast.js.map +1 -1
  216. package/dist/wje-toggle.js +52 -177
  217. package/dist/wje-toggle.js.map +1 -1
  218. package/dist/wje-toolbar-action.js +128 -456
  219. package/dist/wje-toolbar-action.js.map +1 -1
  220. package/dist/wje-toolbar.js +75 -270
  221. package/dist/wje-toolbar.js.map +1 -1
  222. package/dist/wje-tooltip.js +50 -161
  223. package/dist/wje-tooltip.js.map +1 -1
  224. package/dist/wje-tree-item.js +70 -301
  225. package/dist/wje-tree-item.js.map +1 -1
  226. package/dist/wje-tree.js +145 -489
  227. package/dist/wje-tree.js.map +1 -1
  228. package/dist/wje-visually-hidden.js +7 -34
  229. package/dist/wje-visually-hidden.js.map +1 -1
  230. package/package.json +4 -2
  231. package/dist/form-associated-element-DEQ4y-jn.js +0 -245
  232. package/dist/icon-CReYMzAK.js +0 -245
  233. package/dist/popup.element-CwXvVFK7.js +0 -2133
  234. package/dist/router-links-wjqCnncc.js +0 -156
@@ -1 +1 @@
1
- {"version":3,"file":"wje-input.js","sources":["../packages/wje-input/input.element.js","../packages/wje-input/input.js"],"sourcesContent":["import { FormAssociatedElement } from '../internals/form-associated-element.js';\nimport { event } from '../utils/event.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents a custom input element. It extends the WJElement class and provides additional functionality for handling input.\n * @documentation https://elements.webjet.sk/components/input\n * @status stable\n * @augments {FormAssociatedElement}\n * @csspart native - The native part.\n * @csspart wrapper - The wrapper part.\n * @csspart input - The input part.\n * @csspart clear - The clear part.\n * @slot start - Slot for content at the start of the input.\n * @slot end - Slot for content at the end of the input.\n * @cssproperty [--wje-input-font-family=var(--wje-font-family)] - Defines the font family for the input text.\n * @cssproperty [--wje-input-background-color=var(--wje-background)] - Specifies the background color of the input field.\n * @cssproperty [--wje-input-color=var(--wje-color)] - Sets the text color within the input field.\n * @cssproperty [--wje-input-color-invalid=var(--wje-color-danger)] - Changes the text color when the input value is invalid.\n * @cssproperty [--wje-input-error-background-color=var(--wje-tooltip-background)] - Controls the background color of the validation error bubble.\n * @cssproperty [--wje-input-error-color=var(--wje-tooltip-color)] - Controls the text color of the validation error bubble.\n * @cssproperty [--wje-input-border-color=var(--wje-border-color)] - Defines the border color of the input field.\n * @cssproperty [--wje-input-border-color-focus=var(--wje-color-primary)] - Specifies the border color when the input is focused.\n * @cssproperty [--wje-input-border-width=1px] - Sets the width of the input border.\n * @cssproperty [--wje-input-border-style=solid] - Defines the border style of the input (e.g., solid, dashed).\n * @cssproperty [--wje-input-border-radius=4px] - Specifies the border radius, creating rounded corners.\n * @cssproperty [--wje-input-margin-bottom=.5rem] - Adds spacing below the input field.\n * @cssproperty [--wje-input-line-height=20px] - Sets the line height of the text within the input field.\n * @cssproperty [--wje-input-slot-padding-inline=.5rem] - Controls the padding on the left and right of the input slot content.\n * // @fires wje-input:input - Dispatched when the input value changes.\n * // @fires wje-input:clear - Dispatched when the input is cleared.\n */\nexport default class Input extends FormAssociatedElement {\n static _instanceId = 0;\n /**\n * Creates an instance of Input.\n */\n constructor() {\n super();\n\n this.invalid = false;\n this.pristine = true;\n this._instanceId = ++Input._instanceId;\n }\n\n /**\n * Setter for the value attribute.\n * @param {string} value The value to set.\n */\n set value(value) {\n value = value ?? '';\n\n this.internals.setFormValue(value);\n\n if (this.input && this.input.value !== value) this.input.value = value;\n\n this.pristine = false;\n this._value = value;\n this.syncAria();\n }\n\n /**\n * Retrieves the value from the input element if available; otherwise,\n * returns the internal _value property or an empty string as the default.\n * @returns {string} The current value from the input element, the internal _value, or an empty string.\n */\n get value() {\n return this.input?.value ?? this._value ?? '';\n }\n\n /**\n * Sets the label attribute of the element.\n * @param {string} value The value to set as the label attribute.\n */\n set label(value) {\n this.setAttribute('label', value);\n }\n\n /**\n * Retrieves the value of the 'label' attribute if it exists.\n * If the 'label' attribute is not set, it returns false.\n * @returns {string|boolean} The value of the 'label' attribute as a string, or false if the attribute is not set.\n */\n get label() {\n return this.getAttribute('label') || false;\n }\n\n /**\n * Sets the custom error display attribute for an element.\n * @param {boolean} value If true, adds the 'custom-error-display' attribute to the element. If false, removes the attribute from the element.\n */\n set customErrorDisplay(value) {\n if (value) {\n this.setAttribute('custom-error-display', '');\n } else {\n this.removeAttribute('custom-error-display');\n }\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 * Sets the `validateOnChange` property. If set to a truthy value, it adds the\n * `validate-on-change` attribute to the element. If set to a falsy value, it\n * removes the `validate-on-change` attribute from the element.\n * @param {boolean} value Determines whether to add or remove the\n * `validate-on-change` attribute. A truthy value adds the attribute, whereas a\n * falsy value removes it.\n */\n set validateOnChange(value) {\n if (value) {\n this.setAttribute('validate-on-change', '');\n } else {\n this.removeAttribute('validate-on-change');\n }\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 * @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 or removes the 'clearable' attribute on the element.\n * When set to a truthy value, the 'clearable' attribute is added; when falsy, the attribute is removed.\n * @param {boolean} value Determines whether to set or remove the 'clearable' attribute. If true, the 'clearable' attribute is added. If false, it is removed.\n */\n set clearable(value) {\n if (value) {\n this.setAttribute('clearable', '');\n } else {\n this.removeAttribute('clearable');\n }\n }\n\n /**\n * Checks if the 'clearable' attribute is present on the element.\n * @returns {boolean} True if the 'clearable' attribute is set, otherwise false.\n */\n get clearable() {\n return this.hasAttribute('clearable');\n }\n\n /**\n * Sets the placeholder value for an element. If the provided value is non-empty,\n * it assigns the value to the \"placeholder\" attribute. Otherwise, it removes\n * the \"placeholder\" attribute from the element.\n * @param {string} value The placeholder text to set or null/undefined to remove the attribute.\n */\n set placeholder(value) {\n if (value) {\n this.setAttribute('placeholder', value);\n } else {\n this.removeAttribute('placeholder');\n }\n }\n\n /**\n * Retrieves the value of the 'placeholder' attribute from the element.\n * If the attribute is not set, it returns an empty string.\n * @returns {string} The value of the 'placeholder' attribute or an empty string if not set.\n */\n get placeholder() {\n return this.getAttribute('placeholder') || '';\n }\n\n /**\n * Sets the `variant` attribute on the element. If a value is provided, it will set the attribute to the given value.\n * If no value is provided, it removes the `variant` attribute from the element.\n * @param {string} value The value to set for the `variant` attribute. If falsy, the attribute is removed.\n */\n set variant(value) {\n if (value) {\n this.setAttribute('variant', value);\n } else {\n this.removeAttribute('variant');\n }\n }\n\n /**\n * Retrieves the value of the 'variant' attribute from the element.\n * If the attribute is not set, it defaults to 'default'.\n * @returns {string} The value of the 'variant' attribute or 'default' if not set.\n */\n get variant() {\n return this.getAttribute('variant') || 'default';\n }\n\n /**\n * The class name of the input element.\n * @type {string}\n */\n className = 'Input';\n\n /**\n * Getter for the cssStyleSheet attribute.\n * @returns {CSSStyleSheet} The CSS style sheet of the input element.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes attribute of the input element.\n * @returns {Array} The attributes to observe for changes.\n */\n static get observedAttributes() {\n return [\n 'type',\n 'value',\n 'name',\n 'disabled',\n 'placeholder',\n 'label',\n 'message',\n 'error-inline',\n 'required',\n 'readonly',\n 'invalid',\n 'min',\n 'max',\n 'step',\n 'inputmode',\n ];\n }\n\n /**\n * Sets up the attributes for the input.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n // if some value was set via value setter then dont use default value\n if (this.pristine) {\n this.value = this.defaultValue;\n this.pristine = false;\n }\n this.syncAria();\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue === newValue) return;\n\n const labelVisibilityChanged = Boolean(oldValue) !== Boolean(newValue);\n\n if (name === 'label' && labelVisibilityChanged) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n return;\n }\n\n if (!this.input) {\n this.syncAria();\n return;\n }\n\n if (name === 'value') {\n this._value = newValue ?? '';\n if (this.input.value !== this._value) this.input.value = this._value;\n this.internals.setFormValue(this._value);\n } else if (name === 'type') {\n this.input.type = this.getAttribute('type') || 'text';\n } else if (name === 'name') {\n this.input.name = this.name;\n } else if (name === 'disabled') {\n this.input.disabled = this.disabled;\n } else if (name === 'required') {\n this.input.required = this.required;\n } else if (name === 'readonly') {\n this.input.readOnly = this.hasAttribute('readonly');\n } else if (name === 'placeholder') {\n this.input.placeholder = this.placeholder;\n } else if (['min', 'max', 'step', 'inputmode'].includes(name)) {\n this.#syncNativeAttribute(name, newValue);\n } else if (name === 'label') {\n if (this.labelElement) this.labelElement.innerText = this.label || '';\n } else if (name === 'invalid') {\n this.native?.classList.toggle('has-error', this.invalid);\n\n if (this.invalid && this.validationMessage) {\n this.showInvalidMessage();\n } else if (!this.invalid && this.errorMessage) {\n this.errorMessage.textContent = '';\n }\n }\n\n this.syncAria();\n }\n\n /**\n * Draws the input element.\n * @returns {DocumentFragment} The drawn input.\n */\n draw() {\n let hasSlotStart = this.hasSlot(this, 'start');\n let hasSlotEnd = this.hasSlot(this, 'end');\n let hasSlotError = this.hasSlot(this, 'error');\n let fragment = document.createDocumentFragment();\n\n // Wrapper\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-input', this.variant);\n\n if (this.invalid) native.classList.add('has-error');\n\n let wrapper = document.createElement('div');\n wrapper.classList.add('wrapper');\n\n let inputWrapper = document.createElement('div');\n inputWrapper.setAttribute('part', 'wrapper');\n inputWrapper.classList.add('input-wrapper');\n\n // Label\n let label = document.createElement('label');\n label.setAttribute('part', 'label');\n label.innerText = this.label;\n if (this.value && !this.hasAttribute('error')) label.classList.add('fade');\n\n // Input\n let input = document.createElement('input');\n input.setAttribute('type', 'text');\n input.setAttribute('part', 'input');\n input.setAttribute('value', this.value || '');\n input.classList.add('form-control');\n\n const attributes = Array.from(this.attributes).map((attr) => attr.name);\n\n attributes.forEach((attr) => {\n if (this.hasAttribute(attr)) {\n input.setAttribute(attr, this[attr] || '');\n }\n });\n\n // Error\n let errorSlot = document.createElement('slot');\n errorSlot.setAttribute('name', 'error');\n errorSlot.setAttribute('part', 'error-slot');\n this._ariaErrorId = this.id ? `${this.id}-error` : `wje-input-${this._instanceId}-error`;\n errorSlot.id = this._ariaErrorId;\n\n let error = document.createElement('div');\n error.setAttribute('slot', 'error');\n\n let start = null;\n if (hasSlotStart) {\n start = document.createElement('slot');\n start.setAttribute('name', 'start');\n start.setAttribute('part', 'start');\n }\n\n let end = null;\n if (hasSlotEnd) {\n end = document.createElement('slot');\n end.setAttribute('name', 'end');\n end.setAttribute('part', 'end');\n }\n\n if (hasSlotStart) {\n wrapper.appendChild(start); // zmenene\n native.classList.add('has-start');\n }\n\n if (this.label) {\n if (this.variant === 'standard') {\n native.append(label);\n } else {\n inputWrapper.appendChild(label);\n }\n }\n\n inputWrapper.appendChild(input);\n wrapper.appendChild(inputWrapper);\n\n native.appendChild(wrapper);\n native.append(errorSlot);\n\n this.append(error);\n\n if (this.clearable) {\n this.clear = document.createElement('wje-button');\n this.clear.classList.add('clear');\n this.clear.setAttribute('fill', 'link');\n this.clear.setAttribute('part', 'clear');\n\n let clearIcon = document.createElement('wje-icon');\n clearIcon.setAttribute('name', 'x');\n this.clear.appendChild(clearIcon);\n inputWrapper.appendChild(this.clear);\n }\n\n if (hasSlotEnd) {\n wrapper.appendChild(end);// zmenene\n native.classList.add('has-end');\n }\n\n fragment.appendChild(native);\n\n this.native = native;\n this.labelElement = label;\n this.input = input;\n this.errorMessage = error;\n\n this.syncAria();\n return fragment;\n }\n\n /**\n * Runs after the input is drawn to the DOM.\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.input.addEventListener('input', (e) => {\n this.validate();\n\n if (this.validateOnChange) {\n this.pristine = false;\n this.propagateValidation();\n }\n\n if (this.invalid && this.checkValidity()) {\n this.invalid = false;\n this.errorMessage.textContent = '';\n this.internals.setValidity({}, '');\n }\n\n this.input.classList.remove('pristine');\n this.labelElement.classList.add('fade');\n\n event.dispatchCustomEvent(this, 'wje-input:input', {\n value: this.input.value,\n });\n\n this.pristine = false;\n this._value = this.input.value;\n this.internals.setFormValue(this._value);\n this.syncAria();\n });\n\n this.addEventListener('invalid', (e) => {\n this.invalid = true;\n this.pristine = false;\n\n this.showInvalidMessage();\n\n if (this.customErrorDisplay) {\n e.preventDefault();\n }\n });\n\n this.addEventListener('focus', () => this.input.focus());\n\n if (this.clear) {\n this.clear.addEventListener('wje-button:click', (e) => {\n this.input.value = '';\n event.dispatchCustomEvent(this.clear, 'wje-input:clear');\n });\n }\n\n this.validate();\n\n if (this.invalid) {\n this.showInvalidMessage();\n }\n\n this.syncAria();\n }\n\n /**\n * Syncs ARIA attributes on the host element.\n */\n syncAria() {\n const requiredInvalid = this.required && !this.value;\n const invalid = this.invalid || requiredInvalid;\n const label = this.label && this.label !== false ? this.label.trim() : '';\n this.setAriaState({\n role: 'textbox',\n disabled: this.disabled,\n required: this.required,\n readonly: this.hasAttribute('readonly'),\n invalid,\n describedBy: this._ariaErrorId,\n ...(label ? { label } : {}),\n });\n }\n\n /**\n * Checks whether the input has a slot.\n * @param {HTMLElement} el The element to check.\n * @param {string} slotName The name of the slot to check for.\n * @returns {boolean} Whether the input has the slot.\n */\n hasSlot(el, slotName = null) {\n let selector = slotName ? `[slot=\"${slotName}\"]` : '[slot]';\n\n return el.querySelectorAll(selector).length > 0 ? true : false;\n }\n\n /**\n * Syncs an attribute from the host element to the native input without redrawing.\n * @param {string} name The attribute name.\n * @param {string|null} value The new attribute value.\n */\n #syncNativeAttribute(name, value) {\n if (!(this.input instanceof HTMLInputElement)) return;\n\n if (value === null) {\n this.input.removeAttribute(name);\n } else {\n this.input.setAttribute(name, value);\n }\n }\n}\n","import Input from './input.element.js';\n\nexport default Input;\n\nInput.define('wje-input', Input);\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgCe,MAAM,SAAN,MAAM,eAAc,sBAAsB;AAAA;AAAA;AAAA;AAAA,EAKrD,cAAc;AACV,UAAK;AANE;AA8LX;AAAA;AAAA;AAAA;AAAA,qCAAY;AAtLR,SAAK,UAAU;AACf,SAAK,WAAW;AAChB,SAAK,cAAc,EAAE,OAAM;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,MAAM,OAAO;AACb,YAAQ,SAAS;AAEjB,SAAK,UAAU,aAAa,KAAK;AAEjC,QAAI,KAAK,SAAS,KAAK,MAAM,UAAU,MAAO,MAAK,MAAM,QAAQ;AAEjE,SAAK,WAAW;AAChB,SAAK,SAAS;AACd,SAAK,SAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,QAAQ;;AACR,aAAO,UAAK,UAAL,mBAAY,UAAS,KAAK,UAAU;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,MAAM,OAAO;AACb,SAAK,aAAa,SAAS,KAAK;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,QAAQ;AACR,WAAO,KAAK,aAAa,OAAO,KAAK;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,mBAAmB,OAAO;AAC1B,QAAI,OAAO;AACP,WAAK,aAAa,wBAAwB,EAAE;AAAA,IAChD,OAAO;AACH,WAAK,gBAAgB,sBAAsB;AAAA,IAC/C;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,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;AAAA,MACf,UAAU,KAAK,aAAa,UAAU;AAAA,MACtC;AAAA,MACA,aAAa,KAAK;AAAA,MAClB,GAAI,QAAQ,EAAE,MAAK,IAAK;IACpC,CAAS;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QAAQ,IAAI,WAAW,MAAM;AACzB,QAAI,WAAW,WAAW,UAAU,QAAQ,OAAO;AAEnD,WAAO,GAAG,iBAAiB,QAAQ,EAAE,SAAS,IAAI,OAAO;AAAA,EAC7D;AAgBJ;AArgBe;AAAA;AAAA;AAAA;AAAA;AAAA;AA4fX,yBAAoB,SAAC,MAAM,OAAO;AAC9B,MAAI,EAAE,KAAK,iBAAiB,kBAAmB;AAE/C,MAAI,UAAU,MAAM;AAChB,SAAK,MAAM,gBAAgB,IAAI;AAAA,EACnC,OAAO;AACH,SAAK,MAAM,aAAa,MAAM,KAAK;AAAA,EACvC;AACJ;AAngBA,cADiB,QACV,eAAc;AADV,IAAM,QAAN;AC5Bf,MAAM,OAAO,aAAa,KAAK;"}
1
+ {"version":3,"file":"wje-input.js","sources":["../packages/wje-input/input.element.js","../packages/wje-input/input.js"],"sourcesContent":["import { FormAssociatedElement } from '../internals/form-associated-element.js';\nimport { event } from '../utils/event.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents a custom input element. It extends the WJElement class and provides additional functionality for handling input.\n * @documentation https://elements.webjet.sk/components/input\n * @status stable\n * @augments {FormAssociatedElement}\n * @csspart native - The native part.\n * @csspart wrapper - The wrapper part.\n * @csspart input - The input part.\n * @csspart clear - The clear part.\n * @slot start - Slot for content at the start of the input.\n * @slot end - Slot for content at the end of the input.\n * @cssproperty [--wje-input-font-family=var(--wje-font-family)] - Defines the font family for the input text.\n * @cssproperty [--wje-input-background-color=var(--wje-background)] - Specifies the background color of the input field.\n * @cssproperty [--wje-input-color=var(--wje-color)] - Sets the text color within the input field.\n * @cssproperty [--wje-input-color-invalid=var(--wje-color-danger)] - Changes the text color when the input value is invalid.\n * @cssproperty [--wje-input-error-background-color=var(--wje-tooltip-background)] - Controls the background color of the validation error bubble.\n * @cssproperty [--wje-input-error-color=var(--wje-tooltip-color)] - Controls the text color of the validation error bubble.\n * @cssproperty [--wje-input-border-color=var(--wje-border-color)] - Defines the border color of the input field.\n * @cssproperty [--wje-input-border-color-focus=var(--wje-color-primary)] - Specifies the border color when the input is focused.\n * @cssproperty [--wje-input-border-width=1px] - Sets the width of the input border.\n * @cssproperty [--wje-input-border-style=solid] - Defines the border style of the input (e.g., solid, dashed).\n * @cssproperty [--wje-input-border-radius=4px] - Specifies the border radius, creating rounded corners.\n * @cssproperty [--wje-input-margin-bottom=.5rem] - Adds spacing below the input field.\n * @cssproperty [--wje-input-line-height=20px] - Sets the line height of the text within the input field.\n * @cssproperty [--wje-input-slot-padding-inline=.5rem] - Controls the padding on the left and right of the input slot content.\n * // @fires wje-input:input - Dispatched when the input value changes.\n * // @fires wje-input:clear - Dispatched when the input is cleared.\n */\nexport default class Input extends FormAssociatedElement {\n static _instanceId = 0;\n /**\n * Creates an instance of Input.\n */\n constructor() {\n super();\n\n this.invalid = false;\n this.pristine = true;\n this._instanceId = ++Input._instanceId;\n }\n\n /**\n * Setter for the value attribute.\n * @param {string} value The value to set.\n */\n set value(value) {\n value = value ?? '';\n\n this.internals.setFormValue(value);\n\n if (this.input && this.input.value !== value) this.input.value = value;\n\n this.pristine = false;\n this._value = value;\n this.syncAria();\n }\n\n /**\n * Retrieves the value from the input element if available; otherwise,\n * returns the internal _value property or an empty string as the default.\n * @returns {string} The current value from the input element, the internal _value, or an empty string.\n */\n get value() {\n return this.input?.value ?? this._value ?? '';\n }\n\n /**\n * Sets the label attribute of the element.\n * @param {string} value The value to set as the label attribute.\n */\n set label(value) {\n this.setAttribute('label', value);\n }\n\n /**\n * Retrieves the value of the 'label' attribute if it exists.\n * If the 'label' attribute is not set, it returns false.\n * @returns {string|boolean} The value of the 'label' attribute as a string, or false if the attribute is not set.\n */\n get label() {\n return this.getAttribute('label') || false;\n }\n\n /**\n * Sets the custom error display attribute for an element.\n * @param {boolean} value If true, adds the 'custom-error-display' attribute to the element. If false, removes the attribute from the element.\n */\n set customErrorDisplay(value) {\n if (value) {\n this.setAttribute('custom-error-display', '');\n } else {\n this.removeAttribute('custom-error-display');\n }\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 * Sets the `validateOnChange` property. If set to a truthy value, it adds the\n * `validate-on-change` attribute to the element. If set to a falsy value, it\n * removes the `validate-on-change` attribute from the element.\n * @param {boolean} value Determines whether to add or remove the\n * `validate-on-change` attribute. A truthy value adds the attribute, whereas a\n * falsy value removes it.\n */\n set validateOnChange(value) {\n if (value) {\n this.setAttribute('validate-on-change', '');\n } else {\n this.removeAttribute('validate-on-change');\n }\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 * @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 or removes the 'clearable' attribute on the element.\n * When set to a truthy value, the 'clearable' attribute is added; when falsy, the attribute is removed.\n * @param {boolean} value Determines whether to set or remove the 'clearable' attribute. If true, the 'clearable' attribute is added. If false, it is removed.\n */\n set clearable(value) {\n if (value) {\n this.setAttribute('clearable', '');\n } else {\n this.removeAttribute('clearable');\n }\n }\n\n /**\n * Checks if the 'clearable' attribute is present on the element.\n * @returns {boolean} True if the 'clearable' attribute is set, otherwise false.\n */\n get clearable() {\n return this.hasAttribute('clearable');\n }\n\n /**\n * Sets the placeholder value for an element. If the provided value is non-empty,\n * it assigns the value to the \"placeholder\" attribute. Otherwise, it removes\n * the \"placeholder\" attribute from the element.\n * @param {string} value The placeholder text to set or null/undefined to remove the attribute.\n */\n set placeholder(value) {\n if (value) {\n this.setAttribute('placeholder', value);\n } else {\n this.removeAttribute('placeholder');\n }\n }\n\n /**\n * Retrieves the value of the 'placeholder' attribute from the element.\n * If the attribute is not set, it returns an empty string.\n * @returns {string} The value of the 'placeholder' attribute or an empty string if not set.\n */\n get placeholder() {\n return this.getAttribute('placeholder') || '';\n }\n\n /**\n * Sets the `variant` attribute on the element. If a value is provided, it will set the attribute to the given value.\n * If no value is provided, it removes the `variant` attribute from the element.\n * @param {string} value The value to set for the `variant` attribute. If falsy, the attribute is removed.\n */\n set variant(value) {\n if (value) {\n this.setAttribute('variant', value);\n } else {\n this.removeAttribute('variant');\n }\n }\n\n /**\n * Retrieves the value of the 'variant' attribute from the element.\n * If the attribute is not set, it defaults to 'default'.\n * @returns {string} The value of the 'variant' attribute or 'default' if not set.\n */\n get variant() {\n return this.getAttribute('variant') || 'default';\n }\n\n /**\n * The class name of the input element.\n * @type {string}\n */\n className = 'Input';\n\n /**\n * Getter for the cssStyleSheet attribute.\n * @returns {CSSStyleSheet} The CSS style sheet of the input element.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes attribute of the input element.\n * @returns {Array} The attributes to observe for changes.\n */\n static get observedAttributes() {\n return [\n 'type',\n 'value',\n 'name',\n 'disabled',\n 'placeholder',\n 'label',\n 'message',\n 'error-inline',\n 'required',\n 'readonly',\n 'invalid',\n 'min',\n 'max',\n 'step',\n 'inputmode',\n ];\n }\n\n /**\n * Sets up the attributes for the input.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n // if some value was set via value setter then dont use default value\n if (this.pristine) {\n this.value = this.defaultValue;\n this.pristine = false;\n }\n this.syncAria();\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue === newValue) return;\n\n const labelVisibilityChanged = Boolean(oldValue) !== Boolean(newValue);\n\n if (name === 'label' && labelVisibilityChanged) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n return;\n }\n\n if (!this.input) {\n this.syncAria();\n return;\n }\n\n if (name === 'value') {\n this._value = newValue ?? '';\n if (this.input.value !== this._value) this.input.value = this._value;\n this.internals.setFormValue(this._value);\n } else if (name === 'type') {\n this.input.type = this.getAttribute('type') || 'text';\n } else if (name === 'name') {\n this.input.name = this.name;\n } else if (name === 'disabled') {\n this.input.disabled = this.disabled;\n } else if (name === 'required') {\n this.input.required = this.required;\n } else if (name === 'readonly') {\n this.input.readOnly = this.hasAttribute('readonly');\n } else if (name === 'placeholder') {\n this.input.placeholder = this.placeholder;\n } else if (['min', 'max', 'step', 'inputmode'].includes(name)) {\n this.#syncNativeAttribute(name, newValue);\n } else if (name === 'label') {\n if (this.labelElement) this.labelElement.innerText = this.label || '';\n } else if (name === 'invalid') {\n this.native?.classList.toggle('has-error', this.invalid);\n\n if (this.invalid && this.validationMessage) {\n this.showInvalidMessage();\n } else if (!this.invalid && this.errorMessage) {\n this.errorMessage.textContent = '';\n }\n }\n\n this.syncAria();\n }\n\n /**\n * Draws the input element.\n * @returns {DocumentFragment} The drawn input.\n */\n draw() {\n let hasSlotStart = this.hasSlot(this, 'start');\n let hasSlotEnd = this.hasSlot(this, 'end');\n let hasSlotError = this.hasSlot(this, 'error');\n let fragment = document.createDocumentFragment();\n\n // Wrapper\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-input', this.variant);\n\n if (this.invalid) native.classList.add('has-error');\n\n let wrapper = document.createElement('div');\n wrapper.classList.add('wrapper');\n\n let inputWrapper = document.createElement('div');\n inputWrapper.setAttribute('part', 'wrapper');\n inputWrapper.classList.add('input-wrapper');\n\n // Label\n let label = document.createElement('label');\n label.setAttribute('part', 'label');\n label.innerText = this.label;\n if (this.value && !this.hasAttribute('error')) label.classList.add('fade');\n\n // Input\n let input = document.createElement('input');\n input.setAttribute('type', 'text');\n input.setAttribute('part', 'input');\n input.setAttribute('value', this.value || '');\n input.classList.add('form-control');\n\n const attributes = Array.from(this.attributes).map((attr) => attr.name);\n\n attributes.forEach((attr) => {\n if (this.hasAttribute(attr)) {\n input.setAttribute(attr, this[attr] || '');\n }\n });\n\n // Error\n let errorSlot = document.createElement('slot');\n errorSlot.setAttribute('name', 'error');\n errorSlot.setAttribute('part', 'error-slot');\n this._ariaErrorId = this.id ? `${this.id}-error` : `wje-input-${this._instanceId}-error`;\n errorSlot.id = this._ariaErrorId;\n\n let error = document.createElement('div');\n error.setAttribute('slot', 'error');\n\n let start = null;\n if (hasSlotStart) {\n start = document.createElement('slot');\n start.setAttribute('name', 'start');\n start.setAttribute('part', 'start');\n }\n\n let end = null;\n if (hasSlotEnd) {\n end = document.createElement('slot');\n end.setAttribute('name', 'end');\n end.setAttribute('part', 'end');\n }\n\n if (hasSlotStart) {\n wrapper.appendChild(start); // zmenene\n native.classList.add('has-start');\n }\n\n if (this.label) {\n if (this.variant === 'standard') {\n native.append(label);\n } else {\n inputWrapper.appendChild(label);\n }\n }\n\n inputWrapper.appendChild(input);\n wrapper.appendChild(inputWrapper);\n\n native.appendChild(wrapper);\n native.append(errorSlot);\n\n this.append(error);\n\n if (this.clearable) {\n this.clear = document.createElement('wje-button');\n this.clear.classList.add('clear');\n this.clear.setAttribute('fill', 'link');\n this.clear.setAttribute('part', 'clear');\n\n let clearIcon = document.createElement('wje-icon');\n clearIcon.setAttribute('name', 'x');\n this.clear.appendChild(clearIcon);\n inputWrapper.appendChild(this.clear);\n }\n\n if (hasSlotEnd) {\n wrapper.appendChild(end);// zmenene\n native.classList.add('has-end');\n }\n\n fragment.appendChild(native);\n\n this.native = native;\n this.labelElement = label;\n this.input = input;\n this.errorMessage = error;\n\n this.syncAria();\n return fragment;\n }\n\n /**\n * Runs after the input is drawn to the DOM.\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.input.addEventListener('input', (e) => {\n this.validate();\n\n if (this.validateOnChange) {\n this.pristine = false;\n this.propagateValidation();\n }\n\n if (this.invalid && this.checkValidity()) {\n this.invalid = false;\n this.errorMessage.textContent = '';\n this.internals.setValidity({}, '');\n }\n\n this.input.classList.remove('pristine');\n this.labelElement.classList.add('fade');\n\n event.dispatchCustomEvent(this, 'wje-input:input', {\n value: this.input.value,\n });\n\n this.pristine = false;\n this._value = this.input.value;\n this.internals.setFormValue(this._value);\n this.syncAria();\n });\n\n this.addEventListener('invalid', (e) => {\n this.invalid = true;\n this.pristine = false;\n\n this.showInvalidMessage();\n\n if (this.customErrorDisplay) {\n e.preventDefault();\n }\n });\n\n this.addEventListener('focus', () => this.input.focus());\n\n if (this.clear) {\n this.clear.addEventListener('wje-button:click', (e) => {\n this.input.value = '';\n event.dispatchCustomEvent(this.clear, 'wje-input:clear');\n });\n }\n\n this.validate();\n\n if (this.invalid) {\n this.showInvalidMessage();\n }\n\n this.syncAria();\n }\n\n /**\n * Syncs ARIA attributes on the host element.\n */\n syncAria() {\n const requiredInvalid = this.required && !this.value;\n const invalid = this.invalid || requiredInvalid;\n const label = this.label && this.label !== false ? this.label.trim() : '';\n this.setAriaState({\n role: 'textbox',\n disabled: this.disabled,\n required: this.required,\n readonly: this.hasAttribute('readonly'),\n invalid,\n describedBy: this._ariaErrorId,\n ...(label ? { label } : {}),\n });\n }\n\n /**\n * Checks whether the input has a slot.\n * @param {HTMLElement} el The element to check.\n * @param {string} slotName The name of the slot to check for.\n * @returns {boolean} Whether the input has the slot.\n */\n hasSlot(el, slotName = null) {\n let selector = slotName ? `[slot=\"${slotName}\"]` : '[slot]';\n\n return el.querySelectorAll(selector).length > 0 ? true : false;\n }\n\n /**\n * Syncs an attribute from the host element to the native input without redrawing.\n * @param {string} name The attribute name.\n * @param {string|null} value The new attribute value.\n */\n #syncNativeAttribute(name, value) {\n if (!(this.input instanceof HTMLInputElement)) return;\n\n if (value === null) {\n this.input.removeAttribute(name);\n } else {\n this.input.setAttribute(name, value);\n }\n }\n}\n","import Input from './input.element.js';\n\nexport default Input;\n\nInput.define('wje-input', Input);\n"],"names":["Input","FormAssociatedElement","constructor","super","className","this","invalid","pristine","_instanceId","value","internals","setFormValue","input","_value","syncAria","setAttribute","label","getAttribute","removeAttribute","hasAttribute","validateOnChange","defaultValue","clearable","placeholder","cssStyleSheet","observedAttributes","setupAttributes","isShadowRoot","name","oldValue","newValue","labelVisibilityChanged","Boolean","attributeChangedCallback","type","disabled","required","readOnly","includes","labelElement","innerText","native","classList","toggle","validationMessage","showInvalidMessage","errorMessage","textContent","hasSlotStart","hasSlot","hasSlotEnd","fragment","document","createDocumentFragment","createElement","add","variant","wrapper","inputWrapper","Array","from","attributes","map","attr","forEach","errorSlot","_ariaErrorId","id","error","start","end","appendChild","append","clear","clearIcon","afterDraw","addEventListener","e","remove","target","validate","propagateValidation","checkValidity","setValidity","event","dispatchCustomEvent","customErrorDisplay","preventDefault","focus","requiredInvalid","trim","setAriaState","role","readonly","describedBy","el","slotName","selector","querySelectorAll","length","syncNativeAttribute","HTMLInputElement","static","define"],"mappings":";;;;;;;;;;;;AAgCe,MAAMA,KAAN,MAAMA,WAAcC;EAK/B,cAAAC;AACIC,UAAAA;AANO;AA8LXC,qCAAY;AAtLRC,SAAKC,iBACLD,KAAKE,WAAAA,MACLF,KAAKG,cAAAA,EAAgBR,GAAMQ;AAAAA,EAC/B;AAAA,EAMA,IAAA,MAAUC,IAAAA;AACNA,IAAAA,KAAQA,MAAS,IAEjBJ,KAAKK,UAAUC,aAAaF,EAAAA,GAExBJ,KAAKO,SAASP,KAAKO,MAAMH,UAAUA,OAAOJ,KAAKO,M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A,GAAAA,IAAU;EAEhC;AAAA,EAQA,QAAQ+E,IAAIC,KAAW,MAAA;AACnB,QAAIC,KAAWD,KAAW,UAAUA,EAAAA,OAAe;AAEnD,WAAOD,GAAGG,iBAAiBD,EAAAA,EAAUE,SAAS;AAAA,EAClD;AAeA;AApgBW;AA4fX,OAAAC,SAAqBxE,IAAMnB,IAAAA;AACjBJ,OAAKO,iBAAiByF,qBAEd,SAAV5F,KACAJ,KAAKO,MAAMM,gBAAgBU,EAAAA,IAE3BvB,KAAKO,MAAMG,aAAaa,IAAMnB,EAAAA;AAEtC;AAngBA6F,cADiBtG,IACjBsG,eAAqB;AADV,IAAMtG,IAAN;AC5BfA,EAAMuG,OAAO,aAAavG,CAAAA;"}
package/dist/wje-item.js CHANGED
@@ -1,71 +1,26 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import WJElement from "./wje-element.js";
5
- const styles = "/*\n[ WJ Item ]\n*/\n\n:host {\n display: block;\n /*position: relative;*/\n align-items: center;\n justify-content: space-between;\n outline: none;\n color: var(--wje-item-color);\n text-align: initial;\n text-decoration: none;\n box-sizing: border-box;\n width: 100%;\n}\n\n.item-native {\n border-radius: var(--wje-item-border-radius);\n padding-top: var(--wje-item-padding-top);\n padding-bottom: var(--wje-item-padding-bottom);\n padding-inline: var(--wje-item-padding-start) var(--wje-item-padding-end);\n margin: 0;\n display: flex;\n align-items: inherit;\n justify-content: inherit;\n width: 100%;\n min-height: var(--wje-item-min-height);\n transition: var(--wje-item-transition);\n outline: none;\n background: var(--wje-item-background);\n box-sizing: border-box;\n z-index: 1;\n text-decoration: none;\n color: var(--wje-item-color);\n\n .item-inner {\n margin: 0;\n padding: var(--wje-item-inner-padding-top) var(--wje-item-inner-padding-end)\n var(--wje-item-inner-padding-bottom) var(--wje-item-inner-padding-start);\n\n display: flex;\n position: relative;\n\n flex: 1 1 0;\n flex-direction: inherit;\n align-items: inherit;\n align-self: stretch;\n\n min-height: inherit;\n\n border-width: var(--wje-item-border-width);\n border-style: var(--wje-item-border-style);\n border-color: var(--wje-item-border-color);\n\n box-shadow: var(--wje-item-inner-box-shadow);\n overflow: inherit;\n box-sizing: border-box;\n\n .input-wrapper {\n display: flex;\n flex: 1 1 0;\n flex-direction: inherit;\n align-items: inherit;\n align-self: stretch;\n text-overflow: ellipsis;\n overflow: inherit;\n box-sizing: border-box;\n }\n }\n\n .item-bottom {\n padding: 0 var(--wje-item-inner-padding-end) 0 var(--wje-item-padding-start);\n display: flex;\n justify-content: space-between;\n }\n}\n\n@media (any-hover: hover) {\n :host(:hover) .item-native {\n position: relative;\n color: var(--wje-item-color);\n\n :after {\n transition: var(--wje-item-transition);\n z-index: -1;\n inset: 0;\n position: absolute;\n content: '';\n background: var(--wje-item-background-hover);\n opacity: 0.7;\n }\n }\n}\n\nbutton,\na {\n cursor: pointer;\n user-select: none;\n -webkit-user-drag: none;\n}\n\n::slotted([slot='start']) {\n margin-inline: 0 1rem;\n}\n\n::slotted(wje-label:not([slot='end'])) {\n flex: 1 1 0;\n}\n";
6
- class Item extends WJElement {
7
- /**
8
- * Item constructor for the class.
9
- */
4
+ import t from "./wje-element.js";
5
+ class e extends t {
10
6
  constructor() {
11
7
  super();
12
- /**
13
- * Returns the CSS styles for the component.
14
- * @type {string}
15
- */
16
8
  __publicField(this, "className", "Item");
17
- /**
18
- * Determines if the given element or any of its ancestors matches the specified selector.
19
- * @param {string} selector The CSS selector to match against the element's ancestors.
20
- * @param {HTMLElement} el The element from which to start the search.
21
- * @returns {boolean} - Returns `true` if the element or one of its ancestors matches the selector; otherwise, `false`.
22
- */
23
- __publicField(this, "hostContext", (selector, el) => {
24
- return el.closest(selector) !== null;
25
- });
26
- this.labelColorStyles = {};
27
- this.itemStyles = /* @__PURE__ */ new Map();
28
- this.inheritedAriaAttributes = {};
29
- this.multipleInputs = false;
30
- this.focusable = true;
31
- this.button = false;
32
- this.detailIcon = ``;
33
- this.disabled = false;
34
- this.counter = false;
35
- this.routerDirection = "forward";
36
- this.type = "button";
9
+ __publicField(this, "hostContext", (t2, e2) => null !== e2.closest(t2));
10
+ this.labelColorStyles = {}, this.itemStyles = /* @__PURE__ */ new Map(), this.inheritedAriaAttributes = {}, this.multipleInputs = false, this.focusable = true, this.button = false, this.detailIcon = "", this.disabled = false, this.counter = false, this.routerDirection = "forward", this.type = "button";
37
11
  }
38
- /**
39
- * Returns the CSS styles for the component.
40
- * @returns {boolean}
41
- */
42
12
  isClickable() {
43
13
  return this.hasAttribute("href") || this.button;
44
14
  }
45
- /**
46
- * Returns the CSS styles for the component.
47
- * @static
48
- * @returns {object} styles
49
- */
50
15
  static get cssStyleSheet() {
51
- return styles;
16
+ return ':host{display:block;align-items:center;justify-content:space-between;outline:none;color:var(--wje-item-color);text-align:initial;text-decoration:none;box-sizing:border-box;width:100%}.item-native{border-radius:var(--wje-item-border-radius);padding-top:var(--wje-item-padding-top);padding-bottom:var(--wje-item-padding-bottom);padding-inline:var(--wje-item-padding-start) var(--wje-item-padding-end);margin:0;display:flex;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--wje-item-min-height);transition:var(--wje-item-transition);outline:none;background:var(--wje-item-background);box-sizing:border-box;z-index:1;text-decoration:none;color:var(--wje-item-color)}.item-native .item-inner{margin:0;padding:var(--wje-item-inner-padding-top) var(--wje-item-inner-padding-end) var(--wje-item-inner-padding-bottom) var(--wje-item-inner-padding-start);display:flex;position:relative;flex:1 1 0;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--wje-item-border-width);border-style:var(--wje-item-border-style);border-color:var(--wje-item-border-color);box-shadow:var(--wje-item-inner-box-shadow);overflow:inherit;box-sizing:border-box}.item-native .item-inner .input-wrapper{display:flex;flex:1 1 0;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}.item-native .item-bottom{padding:0 var(--wje-item-inner-padding-end) 0 var(--wje-item-padding-start);display:flex;justify-content:space-between}@media(any-hover:hover){:host(:hover) .item-native{position:relative;color:var(--wje-item-color)}:host(:hover) .item-native :after{transition:var(--wje-item-transition);z-index:-1;top:0;right:0;bottom:0;left:0;position:absolute;content:"";background:var(--wje-item-background-hover);opacity:.7}}button,a{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}::slotted([slot="start"]){margin-inline:0 1rem}::slotted(wje-label:not([slot="end"])){flex:1 1 0}';
52
17
  }
53
- /**
54
- * Sets up the attributes for the component.
55
- */
56
18
  setupAttributes() {
57
19
  this.isShadowRoot = "open";
58
20
  }
59
- /**
60
- * Draws the component for the item.
61
- * @returns {DocumentFragment}
62
- */
63
21
  draw() {
64
- const TagType = this.isClickable() ? this.hasAttribute("href") === void 0 ? "button" : "a" : "div";
65
- if (this.hostContext("wje-list", this)) {
66
- this.classList.add("wje-item-list");
67
- }
68
- return `<${TagType} class="item-native" part="native">
22
+ const t2 = this.isClickable() ? void 0 === this.hasAttribute("href") ? "button" : "a" : "div";
23
+ return this.hostContext("wje-list", this) && this.classList.add("wje-item-list"), `<${t2} class="item-native" part="native">
69
24
  <slot name="start"></slot>
70
25
  <div class="item-inner">
71
26
  <div class="input-wrapper" part="inner">
@@ -74,29 +29,21 @@ class Item extends WJElement {
74
29
  <slot name="end"></slot>
75
30
  </div>
76
31
  <div class="item-highlight"></div>
77
- </${TagType}>
32
+ </${t2}>
78
33
  <div class="item-bottom">
79
34
  <slot name="error"></slot>
80
35
  <slot name="helper"></slot>
81
36
  </div>`;
82
37
  }
83
- /**
84
- * Called after the component has been drawn.
85
- */
86
38
  afterDraw() {
87
39
  this.syncAria();
88
40
  }
89
- /**
90
- * Sync ARIA attributes on host.
91
- */
92
41
  syncAria() {
93
- if (this.hostContext("wje-list", this) && !this.hasAttribute("role")) {
94
- this.setAriaState({ role: "listitem" });
95
- }
42
+ this.hostContext("wje-list", this) && !this.hasAttribute("role") && this.setAriaState({ role: "listitem" });
96
43
  }
97
44
  }
98
- Item.define("wje-item", Item);
45
+ e.define("wje-item", e);
99
46
  export {
100
- Item as default
47
+ e as default
101
48
  };
102
49
  //# sourceMappingURL=wje-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wje-item.js","sources":["../packages/wje-item/item.element.js","../packages/wje-item/item.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Item` is a custom web component that represents an item.\n * @summary This element represents an item.\n * @documentation https://elements.webjet.sk/components/item\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part\n * @csspart inner - The inner part\n * @slot start - The start slot\n * @slot end - The end slot\n * @slot error - The error slot\n * @slot helper - The helper slot\n * @cssproperty [--wje-item-background=var(--wje-background)] - Sets the background color of the item. Accepts any valid CSS color value.\n * @cssproperty [--wje-item-color=var(--wje-color)] - Defines the text color for the item. Accepts any valid CSS color value.\n * @cssproperty [--wje-item-padding-start=var(--wje-padding)] - Specifies the left padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-padding-end=var(--wje-padding)] - Specifies the right padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-padding-top=var(--wje-padding)] - Specifies the top padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-padding-bottom=var(--wje-padding)] - Specifies the bottom padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-inner-padding-start=var(--wje-padding)] - Specifies the left inner padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-inner-padding-end=var(--wje-padding)] - Specifies the right inner padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-inner-padding-top=var(--wje-padding)] - Specifies the top inner padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-inner-padding-bottom=var(--wje-padding)] - Specifies the bottom inner padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-border-radius=var(--wje-border-radius)] - Defines the border radius, providing rounded corners for the item.\n * @cssproperty [--wje-item-border-width=var(--wje-border-width)] - Sets the border width of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-border-style=var(--wje-border-style)] - Specifies the style of the border, such as `solid`, `dashed`, or `dotted`.\n * @cssproperty [--wje-item-border-color=var(--wje-border-color)] - Defines the color of the item's border. Accepts any valid CSS color value.\n * @cssproperty [--wje-item-min-height=var(--wje-min-height)] - Sets the minimum height of the item to ensure consistent layout.\n * @cssproperty [--wje-item-transition=var(--wje-transition)] - Specifies the transition effects for the item, such as for hover or focus states.\n * @cssproperty [--wje-item-inner-box-shadow=var(--wje-box-shadow)] - Adds a shadow effect inside the item for a 3D appearance.\n * @tag wje-item\n */\nexport default class Item extends WJElement {\n /**\n * Item constructor for the class.\n */\n constructor() {\n super();\n\n this.labelColorStyles = {};\n this.itemStyles = new Map();\n this.inheritedAriaAttributes = {};\n this.multipleInputs = false;\n this.focusable = true;\n this.button = false;\n this.detailIcon = ``; // TODO icon\n this.disabled = false;\n this.counter = false;\n this.routerDirection = 'forward';\n this.type = 'button';\n }\n\n /**\n * Returns the CSS styles for the component.\n * @returns {boolean}\n */\n isClickable() {\n return this.hasAttribute('href') || this.button;\n }\n\n /**\n * Returns the CSS styles for the component.\n * @type {string}\n */\n className = 'Item';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {object} styles\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the item.\n * @returns {DocumentFragment}\n */\n draw() {\n const TagType = this.isClickable() ? (this.hasAttribute('href') === undefined ? 'button' : 'a') : 'div';\n\n if (this.hostContext('wje-list', this)) {\n this.classList.add('wje-item-list');\n }\n\n return `<${TagType} class=\"item-native\" part=\"native\">\n\t\t\t<slot name=\"start\"></slot>\n\t\t\t<div class=\"item-inner\">\n\t\t\t\t\t<div class=\"input-wrapper\" part=\"inner\">\n\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t</div>\n\t\t\t\t\t<slot name=\"end\"></slot>\n\t\t\t</div>\n\t\t\t<div class=\"item-highlight\"></div>\n </${TagType}>\n\t\t<div class=\"item-bottom\">\n\t\t\t\t<slot name=\"error\"></slot>\n\t\t\t\t<slot name=\"helper\"></slot>\n\t\t</div>`;\n }\n\n /**\n * Called after the component has been drawn.\n */\n afterDraw() {\n this.syncAria();\n }\n\n /**\n * Sync ARIA attributes on host.\n */\n syncAria() {\n if (this.hostContext('wje-list', this) && !this.hasAttribute('role')) {\n this.setAriaState({ role: 'listitem' });\n }\n }\n\n /**\n * Determines if the given element or any of its ancestors matches the specified selector.\n * @param {string} selector The CSS selector to match against the element's ancestors.\n * @param {HTMLElement} el The element from which to start the search.\n * @returns {boolean} - Returns `true` if the element or one of its ancestors matches the selector; otherwise, `false`.\n */\n hostContext = (selector, el) => {\n return el.closest(selector) !== null;\n };\n}\n","import Item from './item.element.js';\n\nexport default Item;\n\nItem.define('wje-item', Item);\n"],"names":[],"mappings":";;;;;AAkCe,MAAM,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA,EAIxC,cAAc;AACV,UAAK;AA2BT;AAAA;AAAA;AAAA;AAAA,qCAAY;AAmEZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAc,CAAC,UAAU,OAAO;AAC5B,aAAO,GAAG,QAAQ,QAAQ,MAAM;AAAA,IACpC;AA9FI,SAAK,mBAAmB,CAAA;AACxB,SAAK,aAAa,oBAAI,IAAG;AACzB,SAAK,0BAA0B,CAAA;AAC/B,SAAK,iBAAiB;AACtB,SAAK,YAAY;AACjB,SAAK,SAAS;AACd,SAAK,aAAa;AAClB,SAAK,WAAW;AAChB,SAAK,UAAU;AACf,SAAK,kBAAkB;AACvB,SAAK,OAAO;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,cAAc;AACV,WAAO,KAAK,aAAa,MAAM,KAAK,KAAK;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,WAAW,gBAAgB;AACvB,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAkB;AACd,SAAK,eAAe;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO;AACH,UAAM,UAAU,KAAK,YAAW,IAAM,KAAK,aAAa,MAAM,MAAM,SAAY,WAAW,MAAO;AAElG,QAAI,KAAK,YAAY,YAAY,IAAI,GAAG;AACpC,WAAK,UAAU,IAAI,eAAe;AAAA,IACtC;AAEA,WAAO,IAAI,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QASlB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKX;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AACR,SAAK,SAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA,EAKA,WAAW;AACP,QAAI,KAAK,YAAY,YAAY,IAAI,KAAK,CAAC,KAAK,aAAa,MAAM,GAAG;AAClE,WAAK,aAAa,EAAE,MAAM,WAAU,CAAE;AAAA,IAC1C;AAAA,EACJ;AAWJ;ACpIA,KAAK,OAAO,YAAY,IAAI;"}
1
+ {"version":3,"file":"wje-item.js","sources":["../packages/wje-item/item.element.js","../packages/wje-item/item.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Item` is a custom web component that represents an item.\n * @summary This element represents an item.\n * @documentation https://elements.webjet.sk/components/item\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part\n * @csspart inner - The inner part\n * @slot start - The start slot\n * @slot end - The end slot\n * @slot error - The error slot\n * @slot helper - The helper slot\n * @cssproperty [--wje-item-background=var(--wje-background)] - Sets the background color of the item. Accepts any valid CSS color value.\n * @cssproperty [--wje-item-color=var(--wje-color)] - Defines the text color for the item. Accepts any valid CSS color value.\n * @cssproperty [--wje-item-padding-start=var(--wje-padding)] - Specifies the left padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-padding-end=var(--wje-padding)] - Specifies the right padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-padding-top=var(--wje-padding)] - Specifies the top padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-padding-bottom=var(--wje-padding)] - Specifies the bottom padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-inner-padding-start=var(--wje-padding)] - Specifies the left inner padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-inner-padding-end=var(--wje-padding)] - Specifies the right inner padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-inner-padding-top=var(--wje-padding)] - Specifies the top inner padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-inner-padding-bottom=var(--wje-padding)] - Specifies the bottom inner padding of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-border-radius=var(--wje-border-radius)] - Defines the border radius, providing rounded corners for the item.\n * @cssproperty [--wje-item-border-width=var(--wje-border-width)] - Sets the border width of the item. Accepts any valid CSS length.\n * @cssproperty [--wje-item-border-style=var(--wje-border-style)] - Specifies the style of the border, such as `solid`, `dashed`, or `dotted`.\n * @cssproperty [--wje-item-border-color=var(--wje-border-color)] - Defines the color of the item's border. Accepts any valid CSS color value.\n * @cssproperty [--wje-item-min-height=var(--wje-min-height)] - Sets the minimum height of the item to ensure consistent layout.\n * @cssproperty [--wje-item-transition=var(--wje-transition)] - Specifies the transition effects for the item, such as for hover or focus states.\n * @cssproperty [--wje-item-inner-box-shadow=var(--wje-box-shadow)] - Adds a shadow effect inside the item for a 3D appearance.\n * @tag wje-item\n */\nexport default class Item extends WJElement {\n /**\n * Item constructor for the class.\n */\n constructor() {\n super();\n\n this.labelColorStyles = {};\n this.itemStyles = new Map();\n this.inheritedAriaAttributes = {};\n this.multipleInputs = false;\n this.focusable = true;\n this.button = false;\n this.detailIcon = ``; // TODO icon\n this.disabled = false;\n this.counter = false;\n this.routerDirection = 'forward';\n this.type = 'button';\n }\n\n /**\n * Returns the CSS styles for the component.\n * @returns {boolean}\n */\n isClickable() {\n return this.hasAttribute('href') || this.button;\n }\n\n /**\n * Returns the CSS styles for the component.\n * @type {string}\n */\n className = 'Item';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {object} styles\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the item.\n * @returns {DocumentFragment}\n */\n draw() {\n const TagType = this.isClickable() ? (this.hasAttribute('href') === undefined ? 'button' : 'a') : 'div';\n\n if (this.hostContext('wje-list', this)) {\n this.classList.add('wje-item-list');\n }\n\n return `<${TagType} class=\"item-native\" part=\"native\">\n\t\t\t<slot name=\"start\"></slot>\n\t\t\t<div class=\"item-inner\">\n\t\t\t\t\t<div class=\"input-wrapper\" part=\"inner\">\n\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t</div>\n\t\t\t\t\t<slot name=\"end\"></slot>\n\t\t\t</div>\n\t\t\t<div class=\"item-highlight\"></div>\n </${TagType}>\n\t\t<div class=\"item-bottom\">\n\t\t\t\t<slot name=\"error\"></slot>\n\t\t\t\t<slot name=\"helper\"></slot>\n\t\t</div>`;\n }\n\n /**\n * Called after the component has been drawn.\n */\n afterDraw() {\n this.syncAria();\n }\n\n /**\n * Sync ARIA attributes on host.\n */\n syncAria() {\n if (this.hostContext('wje-list', this) && !this.hasAttribute('role')) {\n this.setAriaState({ role: 'listitem' });\n }\n }\n\n /**\n * Determines if the given element or any of its ancestors matches the specified selector.\n * @param {string} selector The CSS selector to match against the element's ancestors.\n * @param {HTMLElement} el The element from which to start the search.\n * @returns {boolean} - Returns `true` if the element or one of its ancestors matches the selector; otherwise, `false`.\n */\n hostContext = (selector, el) => {\n return el.closest(selector) !== null;\n };\n}\n","import Item from './item.element.js';\n\nexport default Item;\n\nItem.define('wje-item', Item);\n"],"names":["Item","WJElement","constructor","super","className","hostContext","selector","el","closest","this","labelColorStyles","itemStyles","Map","inheritedAriaAttributes","multipleInputs","focusable","button","detailIcon","disabled","counter","routerDirection","type","isClickable","hasAttribute","cssStyleSheet","setupAttributes","isShadowRoot","draw","TagType","classList","add","afterDraw","syncAria","setAriaState","role","define"],"mappings":";;;;AAkCe,MAAMA,UAAaC,EAAAA;AAAAA,EAI9B,cAAAC;AACIC,UAAAA;AA2BJC,qCAAY;AAmEZC,uCAAc,CAACC,IAAUC,OACW,SAAzBA,GAAGC,QAAQF,EAAAA;AA7FlBG,SAAKC,mBAAmB,CAAA,GACxBD,KAAKE,aAAa,oBAAIC,OACtBH,KAAKI,0BAA0B,CAAA,GAC/BJ,KAAKK,iBAAAA,OACLL,KAAKM,YAAAA,MACLN,KAAKO,SAAAA,OACLP,KAAKQ,aAAa,IAClBR,KAAKS,WAAAA,OACLT,KAAKU,UAAAA,OACLV,KAAKW,kBAAkB,WACvBX,KAAKY,OAAO;AAAA,EAChB;AAAA,EAMA,cAAAC;AACI,WAAOb,KAAKc,aAAa,MAAA,KAAWd,KAAKO;AAAAA,EAC7C;AAAA,EAaA,WAAA,gBAAWQ;AACP;EACJ;AAAA,EAKA,kBAAAC;AACIhB,SAAKiB,eAAe;AAAA,EACxB;AAAA,EAMA,OAAAC;AACI,UAAMC,KAAUnB,KAAKa,YAAAA,IAAAA,WAAiBb,KAAKc,aAAa,MAAA,IAAwB,WAAW,MAAO;AAMlG,WAJId,KAAKJ,YAAY,YAAYI,IAAAA,KAC7BA,KAAKoB,UAAUC,IAAI,eAAA,GAGhB,IAAIF,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,QASXA,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAKJ;AAAA,EAKA,YAAAG;AACItB,SAAKuB,SAAAA;AAAAA,EACT;AAAA,EAKA,WAAAA;AACQvB,SAAKJ,YAAY,Y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