wj-elements 0.7.7 → 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 (233) 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 +11504 -11499
  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/permissions.js +14 -41
  22. package/dist/permissions.js.map +1 -1
  23. package/dist/popup.element-CbkhthPP.js +806 -0
  24. package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
  25. package/dist/router-links-CNsJ-elb.js +105 -0
  26. package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
  27. package/dist/skeleton.css +1 -197
  28. package/dist/styles.css +1 -866
  29. package/dist/universal-service.js +48 -109
  30. package/dist/universal-service.js.map +1 -1
  31. package/dist/utils.js +11 -18
  32. package/dist/utils.js.map +1 -1
  33. package/dist/web-types.json +760 -760
  34. package/dist/wje-accordion-item.js +33 -106
  35. package/dist/wje-accordion-item.js.map +1 -1
  36. package/dist/wje-accordion.js +19 -84
  37. package/dist/wje-accordion.js.map +1 -1
  38. package/dist/wje-animation.js +37 -4258
  39. package/dist/wje-animation.js.map +1 -1
  40. package/dist/wje-aside.js +9 -34
  41. package/dist/wje-aside.js.map +1 -1
  42. package/dist/wje-avatar.js +36 -126
  43. package/dist/wje-avatar.js.map +1 -1
  44. package/dist/wje-badge.js +10 -52
  45. package/dist/wje-badge.js.map +1 -1
  46. package/dist/wje-breadcrumb.js +205 -672
  47. package/dist/wje-breadcrumb.js.map +1 -1
  48. package/dist/wje-breadcrumbs.js +177 -633
  49. package/dist/wje-breadcrumbs.js.map +1 -1
  50. package/dist/wje-button-group.js +48 -153
  51. package/dist/wje-button-group.js.map +1 -1
  52. package/dist/wje-button.js +92 -413
  53. package/dist/wje-button.js.map +1 -1
  54. package/dist/wje-card-content.js +7 -30
  55. package/dist/wje-card-content.js.map +1 -1
  56. package/dist/wje-card-controls.js +7 -30
  57. package/dist/wje-card-controls.js.map +1 -1
  58. package/dist/wje-card-header.js +7 -30
  59. package/dist/wje-card-header.js.map +1 -1
  60. package/dist/wje-card-subtitle.js +7 -34
  61. package/dist/wje-card-subtitle.js.map +1 -1
  62. package/dist/wje-card-title.js +7 -34
  63. package/dist/wje-card-title.js.map +1 -1
  64. package/dist/wje-card.js +15 -71
  65. package/dist/wje-card.js.map +1 -1
  66. package/dist/wje-carousel-item.js +12 -56
  67. package/dist/wje-carousel-item.js.map +1 -1
  68. package/dist/wje-carousel.js +154 -509
  69. package/dist/wje-carousel.js.map +1 -1
  70. package/dist/wje-checkbox.js +50 -227
  71. package/dist/wje-checkbox.js.map +1 -1
  72. package/dist/wje-chip.js +43 -160
  73. package/dist/wje-chip.js.map +1 -1
  74. package/dist/wje-col.js +7 -20
  75. package/dist/wje-col.js.map +1 -1
  76. package/dist/wje-color-picker.js +445 -1464
  77. package/dist/wje-color-picker.js.map +1 -1
  78. package/dist/wje-container.js +9 -35
  79. package/dist/wje-container.js.map +1 -1
  80. package/dist/wje-copy-button.js +64 -204
  81. package/dist/wje-copy-button.js.map +1 -1
  82. package/dist/wje-dialog.js +85 -553
  83. package/dist/wje-dialog.js.map +1 -1
  84. package/dist/wje-divider.js +7 -34
  85. package/dist/wje-divider.js.map +1 -1
  86. package/dist/wje-dropdown.js +78 -305
  87. package/dist/wje-dropdown.js.map +1 -1
  88. package/dist/wje-element.js +191 -700
  89. package/dist/wje-element.js.map +1 -1
  90. package/dist/wje-file-upload-item.js +51 -156
  91. package/dist/wje-file-upload-item.js.map +1 -1
  92. package/dist/wje-file-upload.js +181 -619
  93. package/dist/wje-file-upload.js.map +1 -1
  94. package/dist/wje-footer.js +7 -31
  95. package/dist/wje-footer.js.map +1 -1
  96. package/dist/wje-form.js +7 -32
  97. package/dist/wje-form.js.map +1 -1
  98. package/dist/wje-format-digital.js +26 -118
  99. package/dist/wje-format-digital.js.map +1 -1
  100. package/dist/wje-grid.js +7 -33
  101. package/dist/wje-grid.js.map +1 -1
  102. package/dist/wje-header.js +9 -35
  103. package/dist/wje-header.js.map +1 -1
  104. package/dist/wje-icon-library.js +12 -18
  105. package/dist/wje-icon-library.js.map +1 -1
  106. package/dist/wje-icon-picker.js +65 -320
  107. package/dist/wje-icon-picker.js.map +1 -1
  108. package/dist/wje-icon.js +1 -1
  109. package/dist/wje-img-comparer.js +37 -114
  110. package/dist/wje-img-comparer.js.map +1 -1
  111. package/dist/wje-img.js +50 -198
  112. package/dist/wje-img.js.map +1 -1
  113. package/dist/wje-infinite-scroll.js +94 -346
  114. package/dist/wje-infinite-scroll.js.map +1 -1
  115. package/dist/wje-input-file.js +23 -84
  116. package/dist/wje-input-file.js.map +1 -1
  117. package/dist/wje-input.js +78 -392
  118. package/dist/wje-input.js.map +1 -1
  119. package/dist/wje-item.js +11 -64
  120. package/dist/wje-item.js.map +1 -1
  121. package/dist/wje-kanban.js +124 -401
  122. package/dist/wje-kanban.js.map +1 -1
  123. package/dist/wje-label.js +9 -32
  124. package/dist/wje-label.js.map +1 -1
  125. package/dist/wje-level-indicator.js +38 -157
  126. package/dist/wje-level-indicator.js.map +1 -1
  127. package/dist/wje-list.js +10 -40
  128. package/dist/wje-list.js.map +1 -1
  129. package/dist/wje-main.js +7 -31
  130. package/dist/wje-main.js.map +1 -1
  131. package/dist/wje-masonry.js +66 -211
  132. package/dist/wje-masonry.js.map +1 -1
  133. package/dist/wje-master.js +45 -161
  134. package/dist/wje-master.js.map +1 -1
  135. package/dist/wje-menu-button.js +10 -38
  136. package/dist/wje-menu-button.js.map +1 -1
  137. package/dist/wje-menu-item.js +127 -577
  138. package/dist/wje-menu-item.js.map +1 -1
  139. package/dist/wje-menu-label.js +9 -35
  140. package/dist/wje-menu-label.js.map +1 -1
  141. package/dist/wje-menu.js +14 -49
  142. package/dist/wje-menu.js.map +1 -1
  143. package/dist/wje-option.js +48 -279
  144. package/dist/wje-option.js.map +1 -1
  145. package/dist/wje-options.js +130 -384
  146. package/dist/wje-options.js.map +1 -1
  147. package/dist/wje-orgchart-group.js +16 -52
  148. package/dist/wje-orgchart-group.js.map +1 -1
  149. package/dist/wje-orgchart-item.js +24 -93
  150. package/dist/wje-orgchart-item.js.map +1 -1
  151. package/dist/wje-orgchart.js +18 -68
  152. package/dist/wje-orgchart.js.map +1 -1
  153. package/dist/wje-pagination.js +113 -397
  154. package/dist/wje-pagination.js.map +1 -1
  155. package/dist/wje-popup.js +3 -3
  156. package/dist/wje-popup.js.map +1 -1
  157. package/dist/wje-progress-bar.js +53 -205
  158. package/dist/wje-progress-bar.js.map +1 -1
  159. package/dist/wje-qr-code.js +398 -2980
  160. package/dist/wje-qr-code.js.map +1 -1
  161. package/dist/wje-radio-group.js +52 -190
  162. package/dist/wje-radio-group.js.map +1 -1
  163. package/dist/wje-radio.js +24 -118
  164. package/dist/wje-radio.js.map +1 -1
  165. package/dist/wje-rate.js +62 -266
  166. package/dist/wje-rate.js.map +1 -1
  167. package/dist/wje-relative-time.js +24 -99
  168. package/dist/wje-relative-time.js.map +1 -1
  169. package/dist/wje-reorder-dropzone.js +9 -31
  170. package/dist/wje-reorder-dropzone.js.map +1 -1
  171. package/dist/wje-reorder-handle.js +67 -204
  172. package/dist/wje-reorder-handle.js.map +1 -1
  173. package/dist/wje-reorder-item.js +14 -44
  174. package/dist/wje-reorder-item.js.map +1 -1
  175. package/dist/wje-reorder.js +61 -246
  176. package/dist/wje-reorder.js.map +1 -1
  177. package/dist/wje-route.js +6 -24
  178. package/dist/wje-route.js.map +1 -1
  179. package/dist/wje-router-link.js +11 -39
  180. package/dist/wje-router-link.js.map +1 -1
  181. package/dist/wje-router-outlet.js +76 -172
  182. package/dist/wje-router-outlet.js.map +1 -1
  183. package/dist/wje-routerx.js +537 -1331
  184. package/dist/wje-routerx.js.map +1 -1
  185. package/dist/wje-row.js +9 -31
  186. package/dist/wje-row.js.map +1 -1
  187. package/dist/wje-select.js +326 -1152
  188. package/dist/wje-select.js.map +1 -1
  189. package/dist/wje-slider.js +44 -225
  190. package/dist/wje-slider.js.map +1 -1
  191. package/dist/wje-sliding-container.js +295 -1319
  192. package/dist/wje-sliding-container.js.map +1 -1
  193. package/dist/wje-split-view.js +35 -121
  194. package/dist/wje-split-view.js.map +1 -1
  195. package/dist/wje-status.js +14 -45
  196. package/dist/wje-status.js.map +1 -1
  197. package/dist/wje-step.js +9 -32
  198. package/dist/wje-step.js.map +1 -1
  199. package/dist/wje-stepper.js +109 -357
  200. package/dist/wje-stepper.js.map +1 -1
  201. package/dist/wje-store.js +67 -360
  202. package/dist/wje-store.js.map +1 -1
  203. package/dist/wje-tab-group.js +85 -314
  204. package/dist/wje-tab-group.js.map +1 -1
  205. package/dist/wje-tab-panel.js +7 -28
  206. package/dist/wje-tab-panel.js.map +1 -1
  207. package/dist/wje-tab.js +21 -198
  208. package/dist/wje-tab.js.map +1 -1
  209. package/dist/wje-textarea.js +64 -264
  210. package/dist/wje-textarea.js.map +1 -1
  211. package/dist/wje-thumbnail.js +10 -51
  212. package/dist/wje-thumbnail.js.map +1 -1
  213. package/dist/wje-toast.js +127 -632
  214. package/dist/wje-toast.js.map +1 -1
  215. package/dist/wje-toggle.js +52 -177
  216. package/dist/wje-toggle.js.map +1 -1
  217. package/dist/wje-toolbar-action.js +128 -456
  218. package/dist/wje-toolbar-action.js.map +1 -1
  219. package/dist/wje-toolbar.js +75 -270
  220. package/dist/wje-toolbar.js.map +1 -1
  221. package/dist/wje-tooltip.js +50 -161
  222. package/dist/wje-tooltip.js.map +1 -1
  223. package/dist/wje-tree-item.js +70 -301
  224. package/dist/wje-tree-item.js.map +1 -1
  225. package/dist/wje-tree.js +145 -489
  226. package/dist/wje-tree.js.map +1 -1
  227. package/dist/wje-visually-hidden.js +7 -34
  228. package/dist/wje-visually-hidden.js.map +1 -1
  229. package/package.json +3 -2
  230. package/dist/form-associated-element-DEQ4y-jn.js +0 -245
  231. package/dist/icon-CReYMzAK.js +0 -245
  232. package/dist/popup.element-CwXvVFK7.js +0 -2133
  233. package/dist/router-links-wjqCnncc.js +0 -156
@@ -1 +1 @@
1
- {"version":3,"file":"wje-toast.js","sources":["../packages/wje-toast/toast.element.js","../packages/wje-toast/toast.js"],"sourcesContent":["import { default as WJElement, WjElementUtils, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\nconst DEFAULT_STACK_POSITION = 'top-end';\nconst DEFAULT_STACK_DEPTH = 3;\nconst VALID_STACK_POSITIONS = new Set([\n 'top-start',\n 'top-center',\n 'top-end',\n 'bottom-start',\n 'bottom-center',\n 'bottom-end',\n]);\nconst STACKED_SCALE_STEP = 0.04;\nconst STACKED_MIN_SCALE = 0.88;\nconst STACKED_MIN_OPACITY = 0.72;\nconst STACKED_VISIBLE_SLICE = 16;\nconst STACKED_EXPANDED_MARGIN = '0.5rem';\nconst STACKED_PADDING = '1rem';\nconst STACKED_ENTER_OFFSET = 24;\n\nconst toggleStackExpanded = (stack, expanded) => {\n if (expanded) {\n stack.dataset.expanded = 'true';\n return;\n }\n\n delete stack.dataset.expanded;\n};\n\nconst syncExpandedStackToasts = (stack, expanded) => {\n Array.from(stack.children)\n .filter((child) => child.tagName === 'WJE-TOAST')\n .forEach((toast) => {\n if (expanded) {\n toast.pause?.();\n return;\n }\n\n toast.resume?.();\n });\n};\n\nconst setStackExpandedState = (stack, expanded) => {\n let shouldExpand = stack.dataset.stacked === 'true' && expanded;\n let isExpanded = stack.dataset.expanded === 'true';\n\n if (shouldExpand === isExpanded) {\n return;\n }\n\n toggleStackExpanded(stack, shouldExpand);\n syncExpandedStackToasts(stack, shouldExpand);\n stack.updateToastLayout?.();\n};\n\nconst syncStackExpandedState = (stack) => {\n setStackExpandedState(stack, stack.matches(':hover') || stack.matches(':focus-within'));\n};\n\n/**\n * `Toast` is a custom web component that represents a toast notification.\n * @summary This element represents a toast notification.\n * @documentation https://elements.webjet.sk/components/toast\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part\n * @slot - The content of the toast.\n * @slot media - The media of the toast.\n * @attribute {string} headline - Specifies the headline text of the toast. Represents the main title or heading displayed in the toast.\n * @attribute {boolean} open - Indicates whether the toast is currently open (visible). A value of `true` shows the toast, while `false` hides it.\n * @attribute {number} duration - Determines the duration (in milliseconds) for which the toast is displayed. After this time, the toast will automatically close unless it is manually closed.\n * @attribute {boolean} closable - Specifies whether the toast can be manually closed by the user. If `true`, the toast will include a close button or mechanism.\n * @attribute {string} color - Defines the color variant of the toast. Supports values such as `primary`, `complete`, `success`, `warning`, `danger`, `info`, and `contrast`.\n * @attribute {boolean} countdown - Indicates whether a countdown is displayed in the toast. When `true`, a visual countdown timer is shown to indicate the remaining time before the toast closes.\n * @attribute {boolean} stacked - Enables a layered toast stack where the newest toast stays visually on top while older ones shrink behind it.\n * @attribute {string} stack-position - Defines where the toast stack is placed on the screen. Supports `top-start`, `top-center`, `top-end`, `bottom-start`, `bottom-center`, and `bottom-end`.\n * @attribute {number} stack-depth - Defines how many visual levels the collapsed stacked toast can show. Older toasts beyond this limit stay at the last reduced level. Default is `3`.\n * @attribute {string} icon - Adds a leading icon into the `media` slot by icon name.\n * @cssproperty [--wje-toast-stack-width=300px] - Defines the width of the toast stack container. Useful for centered stacked toasts and demo layouts.\n * // @fires wje-toast:after-show - Fired after the toast is shown.\n * // @fires wje-toast:after-hide - Fired after the toast is hidden.\n */\n\nexport default class Toast extends WJElement {\n /**\n * Creates an instance of Toast.\n */\n constructor() {\n super();\n\n this.toastStack = this.createToastStack();\n }\n\n /**\n * Set headline value of the toast.\n * @param value\n */\n set headline(value) {\n this.setAttribute('headline', value);\n }\n\n /**\n * Get headline value of the toast.\n * @returns {string}\n */\n get headline() {\n return this.getAttribute('headline');\n }\n\n /**\n * Set open value of the toast.\n * @param value\n */\n set open(value) {\n this.removeAttribute('open');\n\n if (WjElementUtils.stringToBoolean(value)) this.setAttribute('open', value);\n }\n\n /**\n * Get open value of the toast.\n * @returns {boolean}\n */\n get open() {\n return this.hasAttribute('open');\n }\n\n /**\n * Set duration value of the toast.\n * @param value\n */\n set duration(value) {\n this.setAttribute('duration', value);\n }\n\n /**\n * Get duration value of the toast.\n * @returns {number}\n */\n get duration() {\n return +this.getAttribute('duration');\n }\n\n /**\n * Set closable value of the toast.\n * @param value\n */\n set closable(value) {\n this.setAttribute('closable', value || '');\n }\n\n /**\n * Get closable value of the toast.\n * @returns {boolean}\n */\n get closable() {\n return this.hasAttribute('closable');\n }\n\n /**\n * Set color value of the toast.\n * @param value\n */\n set color(value) {\n this.setAttribute('color', value);\n }\n\n /**\n * Get color value of the toast.\n * @returns {string}\n */\n get color() {\n return this.getAttribute('color');\n }\n\n /**\n * Set countdown value of the toast.\n * @param value\n */\n set countdown(value) {\n if (value) this.setAttribute('countdown', value);\n }\n\n /**\n * Get countdown value of the toast.\n * @returns {boolean}\n */\n get countdown() {\n return this.hasAttribute('countdown');\n }\n\n /**\n * Set stacked value of the toast.\n * @param value\n */\n set stacked(value) {\n this.toggleAttribute('stacked', WjElementUtils.stringToBoolean(value));\n }\n\n /**\n * Get stacked value of the toast.\n * @returns {boolean}\n */\n get stacked() {\n return this.hasAttribute('stacked');\n }\n\n /**\n * Set stack depth of the toast.\n * @param value\n */\n set stackDepth(value) {\n if (value === null || value === undefined || value === '') {\n this.removeAttribute('stack-depth');\n return;\n }\n\n this.setAttribute('stack-depth', value);\n }\n\n /**\n * Get stack depth of the toast.\n * @returns {number}\n */\n get stackDepth() {\n let value = Number.parseInt(this.getAttribute('stack-depth'), 10);\n\n if (Number.isFinite(value) && value > 0) {\n return value;\n }\n\n return DEFAULT_STACK_DEPTH;\n }\n\n /**\n * Set stack position of the toast.\n * @param value\n */\n set stackPosition(value) {\n if (!value) {\n this.removeAttribute('stack-position');\n return;\n }\n\n this.setAttribute('stack-position', value);\n }\n\n /**\n * Get stack position of the toast.\n * @returns {string}\n */\n get stackPosition() {\n let value = this.getAttribute('stack-position');\n\n if (VALID_STACK_POSITIONS.has(value)) {\n return value;\n }\n\n if (this.getAttribute('position') === 'bottom') {\n return 'bottom-end';\n }\n\n return DEFAULT_STACK_POSITION;\n }\n\n /**\n * Set icon value of the toast.\n * @param value\n */\n set icon(value) {\n this.setAttribute('icon', value);\n }\n\n /**\n * Get icon value of the toast.\n * @returns {string}\n */\n get icon() {\n return this.getAttribute('icon');\n }\n\n /**\n * Creates a toast stack container.\n * @returns {HTMLDivElement}\n */\n createToastStack() {\n let stack = Object.assign(document.createElement('div'), { className: 'wje-toast-stack' });\n\n stack.addEventListener('mouseenter', () => setStackExpandedState(stack, true));\n stack.addEventListener('mouseleave', () => requestAnimationFrame(() => syncStackExpandedState(stack)));\n stack.addEventListener('focusin', () => setStackExpandedState(stack, true));\n stack.addEventListener('focusout', () => requestAnimationFrame(() => syncStackExpandedState(stack)));\n\n this.syncToastStack(stack);\n\n return stack;\n }\n\n /**\n * Returns the key of the toast stack.\n * @returns {string}\n */\n getToastStackKey() {\n return `${this.stackPosition}:${this.stacked ? `stacked:${this.stackDepth}` : 'default'}`;\n }\n\n /**\n * Applies the stack placement directly on the element so demo/app layout CSS cannot override it accidentally.\n * @param {HTMLDivElement} stack\n */\n applyToastStackPlacement(stack = this.toastStack) {\n const positions = {\n 'top-start': {\n top: '0',\n bottom: 'auto',\n left: '0',\n right: 'auto',\n transform: 'none',\n margin: '0.5rem',\n },\n 'top-center': {\n top: '0',\n bottom: 'auto',\n left: '50%',\n right: 'auto',\n transform: 'translateX(-50%)',\n margin: '0.5rem 0 0',\n },\n 'top-end': {\n top: '0',\n bottom: 'auto',\n left: 'auto',\n right: '0',\n transform: 'none',\n margin: '0.5rem',\n },\n 'bottom-start': {\n top: 'auto',\n bottom: '0',\n left: '0',\n right: 'auto',\n transform: 'none',\n margin: '0 0.5rem 0.5rem',\n },\n 'bottom-center': {\n top: 'auto',\n bottom: '0',\n left: '50%',\n right: 'auto',\n transform: 'translateX(-50%)',\n margin: '0 0 0.5rem',\n },\n 'bottom-end': {\n top: 'auto',\n bottom: '0',\n left: 'auto',\n right: '0',\n transform: 'none',\n margin: '0 0.5rem 0.5rem',\n },\n };\n\n stack.style.removeProperty('inset-inline');\n stack.style.removeProperty('inset-inline-start');\n stack.style.removeProperty('inset-inline-end');\n Object.assign(stack.style, positions[this.stackPosition] || positions[DEFAULT_STACK_POSITION]);\n }\n\n /**\n * Applies the current toast stack configuration to a stack element.\n * @param {HTMLDivElement} stack\n */\n syncToastStack(stack = this.toastStack) {\n stack.dataset.position = this.stackPosition;\n stack.dataset.stackKey = this.getToastStackKey();\n stack.updateToastLayout = () => this.updateToastStack(stack);\n stack.style.display = 'flex';\n stack.style.alignItems = 'stretch';\n stack.style.width = 'min(var(--wje-toast-stack-width, 300px), calc(100vw - 1rem))';\n stack.style.maxWidth = 'calc(100vw - 1rem)';\n stack.style.maxHeight = 'calc(100vh - 1rem)';\n stack.style.zIndex = '9999';\n this.applyToastStackPlacement(stack);\n\n if (this.stacked) {\n stack.dataset.stacked = 'true';\n stack.dataset.stackDepth = String(this.stackDepth);\n } else {\n delete stack.dataset.stacked;\n delete stack.dataset.stackDepth;\n delete stack.dataset.expanded;\n }\n }\n\n /**\n * Clears transient stack styling from a toast.\n * @param {Toast} toast\n */\n clearStackItemStyles(toast) {\n [\n '--wje-toast-stack-scale',\n '--wje-toast-stack-shift',\n '--wje-toast-stack-opacity',\n '--wje-toast-stack-z',\n '--wje-toast-stack-origin',\n '--wje-toast-stack-host-margin-top',\n '--wje-toast-stack-host-margin-bottom',\n 'order',\n 'position',\n 'top',\n 'left',\n 'right',\n 'width',\n 'margin',\n 'margin-top',\n 'margin-bottom',\n ].forEach((property) => toast.style.removeProperty(property));\n }\n\n /**\n * Measures the rendered height of a toast for stack overlap calculations.\n * @param {Toast} toast\n * @returns {number}\n */\n getToastVisualHeight(toast) {\n let hostHeight = toast.getBoundingClientRect().height;\n let nativeHeight = toast.shadowRoot?.querySelector('.native-toast')?.getBoundingClientRect().height || 0;\n\n return Math.max(hostHeight, nativeHeight, toast.offsetHeight || 0);\n }\n\n /**\n * Recomputes the visual order of toasts inside the stack.\n * @param {HTMLDivElement} stack\n */\n updateToastStack(stack = this.toastStack) {\n let toasts = Array.from(stack.children).filter((child) => child.tagName === 'WJE-TOAST');\n let isStacked = stack.dataset.stacked === 'true';\n let isExpanded = stack.dataset.expanded === 'true';\n let isBottomStack = stack.dataset.position?.startsWith('bottom');\n let transformOrigin = stack.dataset.position?.startsWith('bottom') ? 'center bottom' : 'center top';\n let stackHeight = 0;\n\n stack.dataset.count = String(toasts.length);\n stack.style.gap = 'var(--wje-spacing-x-small)';\n stack.style.flexDirection = 'column';\n stack.style.overflow = isStacked ? (isExpanded ? 'auto' : 'visible') : 'auto';\n\n if (isStacked) {\n stack.style.paddingTop = isExpanded ? (isBottomStack ? STACKED_PADDING : '0px') : STACKED_PADDING;\n stack.style.paddingBottom = isExpanded ? (isBottomStack ? '0px' : STACKED_PADDING) : STACKED_PADDING;\n } else {\n stack.style.removeProperty('padding-top');\n stack.style.removeProperty('padding-bottom');\n }\n\n if (!isStacked || isExpanded) {\n stack.style.removeProperty('height');\n }\n\n toasts.forEach((toast, index) => {\n this.clearStackItemStyles(toast);\n\n toast.style.setProperty('--wje-toast-stack-z', String(index + 1));\n\n if (!isStacked) {\n return;\n }\n\n if (isExpanded) {\n let visualOrder = isBottomStack ? index : toasts.length - index - 1;\n let isVisualFirst = visualOrder === 0;\n let isVisualLast = visualOrder === toasts.length - 1;\n\n toast.style.setProperty('--wje-toast-stack-scale', '1.000');\n toast.style.setProperty('--wje-toast-stack-shift', '0px');\n toast.style.setProperty('--wje-toast-stack-opacity', '1.000');\n toast.style.setProperty('--wje-toast-stack-origin', transformOrigin);\n toast.style.order = String(visualOrder);\n toast.style.width = '100%';\n toast.style.setProperty(\n '--wje-toast-stack-host-margin-top',\n isBottomStack && !isVisualFirst ? STACKED_EXPANDED_MARGIN : '0px'\n );\n toast.style.setProperty(\n '--wje-toast-stack-host-margin-bottom',\n !isBottomStack && !isVisualLast ? STACKED_EXPANDED_MARGIN : '0px'\n );\n return;\n }\n\n let toastHeight = this.getToastVisualHeight(toast);\n let maxDepth = Math.max(0, this.stackDepth - 1);\n let visibleLevels = Math.min(toasts.length, this.stackDepth);\n let depth = Math.min(toasts.length - index - 1, maxDepth);\n let visibleIndex = Math.max(0, index - Math.max(0, toasts.length - this.stackDepth));\n let targetTop = isBottomStack\n ? visibleIndex * STACKED_VISIBLE_SLICE\n : (visibleLevels - 1 - visibleIndex) * STACKED_VISIBLE_SLICE;\n let scale = Math.max(STACKED_MIN_SCALE, 1 - depth * STACKED_SCALE_STEP);\n let opacity = Math.max(STACKED_MIN_OPACITY, 1 - depth * 0.08);\n\n toast.style.setProperty('--wje-toast-stack-scale', scale.toFixed(3));\n toast.style.setProperty('--wje-toast-stack-shift', '0px');\n toast.style.setProperty('--wje-toast-stack-opacity', opacity.toFixed(3));\n toast.style.setProperty('--wje-toast-stack-origin', transformOrigin);\n toast.style.position = 'absolute';\n toast.style.top = `${targetTop}px`;\n toast.style.left = '0';\n toast.style.right = '0';\n toast.style.width = '100%';\n toast.style.setProperty('--wje-toast-stack-host-margin-top', '0px');\n toast.style.setProperty('--wje-toast-stack-host-margin-bottom', '0px');\n\n stackHeight = Math.max(stackHeight, targetTop + toastHeight);\n });\n\n if (isStacked && !isExpanded) {\n stack.style.height = `${stackHeight}px`;\n }\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Toast';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAriaState({\n role: 'status',\n });\n }\n\n /**\n * Draw method for the toast notification.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-toast');\n\n let mediaSlot = document.createElement('slot');\n mediaSlot.setAttribute('name', 'media');\n mediaSlot.classList.add('media');\n mediaSlot.addEventListener('slotchange', () => {\n if (WjElementUtils.hasSlotContent(this.context, 'media')) {\n mediaSlot.parentElement.classList.add('has-media');\n } else {\n mediaSlot.parentElement.classList.remove('has-media');\n }\n });\n\n let content = document.createElement('div');\n content.classList.add('content');\n content.innerHTML = `<div class=\"headline\">${this.headline}</div><div class=\"message\"><slot></slot></div>`;\n\n let iconX = document.createElement('wje-icon');\n iconX.setAttribute('name', 'x');\n\n let closeBtn = document.createElement('wje-button');\n closeBtn.setAttribute('fill', 'link');\n closeBtn.setAttribute('color', this.color);\n closeBtn.setAttribute('size', 'small');\n closeBtn.classList.add('close');\n closeBtn.setAttribute('label', 'Close');\n\n let countdownEl = document.createElement('div');\n countdownEl.classList.add('countdown');\n\n let countdownBar = document.createElement('div');\n countdownBar.classList.add('countdown-bar');\n\n closeBtn.appendChild(iconX);\n countdownEl.appendChild(countdownBar);\n\n if (this.hasAttribute('icon') && this.icon) {\n let icon = document.createElement('wje-icon');\n icon.setAttribute('name', this.icon);\n icon.setAttribute('color', this.color);\n icon.setAttribute('slot', 'media');\n icon.setAttribute('part', 'icon');\n\n this.appendChild(icon);\n }\n\n native.appendChild(mediaSlot);\n native.appendChild(content);\n\n if (this.closable) native.appendChild(closeBtn);\n\n if (this.hasAttribute('countdown')) native.appendChild(countdownEl);\n\n fragment.appendChild(native);\n\n this.closeBtn = closeBtn;\n this.countdownBar = countdownBar;\n\n return fragment;\n }\n\n /**\n * After draw method for the toast notification.\n */\n afterDraw() {\n this.closeBtn.addEventListener('wje-button:click', this.hide);\n this.addEventListener('mouseenter', this.pause);\n this.addEventListener('mouseleave', this.resume);\n\n if (this.hasAttribute('countdown')) {\n const startWidth = '100%';\n const endWidth = '0';\n\n this.countdownAnimation = this.countdownBar.animate([{ width: startWidth }, { width: endWidth }], {\n duration: this.duration,\n easing: 'linear',\n });\n }\n\n if (this.duration > 0) {\n this.remainingTime = this.duration;\n this.startTimer();\n }\n }\n\n /**\n * Before disconnect method\n * This method is called before the element is disconnected from the document.\n */\n beforeDisconnect() {\n this.closeBtn?.removeEventListener('wje-button:click', this.hide);\n this.removeEventListener('wje-toast:after-hide', this.removeChildAndStack);\n this.removeEventListener('mouseenter', this.pause);\n this.removeEventListener('mouseleave', this.resume);\n\n clearTimeout(this.timeoutID);\n }\n\n /**\n * Starts the timer.\n * This method sets the `startTime` property to the current time and sets\n * the `timeoutID` property to the ID of the timeout. The method also\n * dispatches the `wje-toast:after-hide` custom event when the timeout\n * expires.\n */\n startTimer() {\n this.startTime = Date.now();\n if (this.timeoutID) {\n clearTimeout(this.timeoutID);\n }\n this.isTimerPaused = false;\n this.timeoutID = window.setTimeout(() => {\n this.hide();\n }, this.remainingTime);\n }\n\n /**\n * Stops the timer.\n * This method clears the timeout and calculates the remaining time.\n * The method is called when the toast notification is paused.\n */\n stopTimer() {\n if (!this.timeoutID || this.isTimerPaused) {\n return;\n }\n\n window.clearTimeout(this.timeoutID);\n this.timeoutID = null;\n const elapsedTime = Date.now() - this.startTime;\n this.remainingTime = Math.max(0, this.remainingTime - elapsedTime);\n this.isTimerPaused = true;\n }\n\n /**\n * Resumes the timer.\n * This method resumes the timer if the remaining time is greater\n * than zero. The method is called when the toast notification is resumed.\n */\n resumeTimer() {\n if (this.isTimerPaused && this.remainingTime > 0) {\n this.startTimer();\n }\n }\n\n /**\n * Asynchronously shows the toast notification.\n * This method sets the `open` property to `true` and dispatches the\n * `wje-toast:after-show` custom event. If the toast is already open,\n * the method returns `undefined`.\n */\n show = () => {\n if (this.open) {\n return;\n }\n\n this.open = true;\n event.dispatchCustomEvent(this, 'wje-toast:after-show');\n };\n\n /**\n * Asynchronously hides the toast notification.\n * This method sets the `open` property to `false` and dispatches the\n * `wje-toast:after-hide` custom event. If the toast is already hidden,\n * the method returns `undefined`.\n */\n hide = () => {\n if (!this.open) {\n return;\n }\n\n this.open = false;\n event.dispatchCustomEvent(this, 'wje-toast:after-hide');\n };\n\n /**\n * Pauses the countdown animation and stops the timer.\n */\n pause = () => {\n this.countdownAnimation?.pause();\n this.stopTimer();\n };\n\n /**\n * Resumes the countdown animation and resumes the timer.\n */\n resume = () => {\n if (this.toastStack?.dataset.expanded === 'true') {\n return;\n }\n\n this.countdownAnimation?.play();\n this.resumeTimer();\n };\n\n /**\n * Removes the toast notification and the toast stack.\n *\n * This method removes the toast notification from the toast stack and\n * removes the toast stack from the document body if the toast stack is\n * empty.\n */\n removeChildAndStack() {\n if (this.parentElement === this.toastStack) {\n this.toastStack.removeChild(this);\n }\n\n this.toastStack.style.setProperty('--wje-toast-stack-layout-duration', '0s');\n this.toastStack.style.setProperty('--wje-toast-stack-visual-duration', '0s');\n this.updateToastStack(this.toastStack);\n\n requestAnimationFrame(() => {\n this.toastStack.style.removeProperty('--wje-toast-stack-layout-duration');\n this.toastStack.style.removeProperty('--wje-toast-stack-visual-duration');\n });\n\n if (this.toastStack.querySelector('wje-toast') === null) {\n this.toastStack.remove();\n }\n }\n\n /**\n * Asynchronously starts the toast notification.\n * This method appends the toast notification to the document body and\n * shows the toast notification. The method returns a promise that\n * resolves when the toast notification is shown.\n * @returns {Promise<unknown>}\n */\n start = () => {\n return new Promise((resolve) => {\n let stack = document.body.querySelector(`.wje-toast-stack[data-stack-key=\"${this.getToastStackKey()}\"]`);\n if (stack) {\n this.toastStack = stack;\n } else {\n this.toastStack = this.createToastStack();\n }\n\n this.syncToastStack(this.toastStack);\n\n if (this.toastStack.parentElement === null) {\n document.body.append(this.toastStack);\n }\n\n this.toastStack.append(this);\n if (this.stacked) {\n this.toastStack.style.setProperty('--wje-toast-stack-layout-duration', '0s');\n this.toastStack.style.setProperty('--wje-toast-stack-visual-duration', '0s');\n this.style.setProperty(\n '--wje-toast-enter-offset',\n this.stackPosition.startsWith('bottom') ? `${STACKED_ENTER_OFFSET}px` : `-${STACKED_ENTER_OFFSET}px`\n );\n this.style.visibility = 'hidden';\n this.show();\n this.updateToastStack(this.toastStack);\n } else {\n this.updateToastStack(this.toastStack);\n this.show();\n }\n\n if (this.toastStack.dataset.expanded === 'true') {\n this.pause();\n }\n\n requestAnimationFrame(() => {\n this.updateToastStack(this.toastStack);\n\n if (this.stacked) {\n this.style.removeProperty('visibility');\n this.toastStack.style.removeProperty('--wje-toast-stack-layout-duration');\n this.toastStack.style.removeProperty('--wje-toast-stack-visual-duration');\n\n requestAnimationFrame(() => this.style.setProperty('--wje-toast-enter-offset', '0px'));\n }\n });\n this.updateComplete?.then(() => this.updateToastStack(this.toastStack));\n\n this.addEventListener('wje-toast:after-hide', this.removeChildAndStack);\n\n resolve(this);\n });\n };\n}\n","import Toast from './toast.element.js';\n\nexport default Toast;\n\nToast.define('wje-toast', Toast);\n"],"names":[],"mappings":";;;;;;;AAGA,MAAM,yBAAyB;AAC/B,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB,oBAAI,IAAI;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,CAAC;AACD,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AAC1B,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAC9B,MAAM,0BAA0B;AAChC,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;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,WAAW;AACjE,SAAK,gBAAgB;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAc;AACV,QAAI,KAAK,iBAAiB,KAAK,gBAAgB,GAAG;AAC9C,WAAK,WAAU;AAAA,IACnB;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA2DA,sBAAsB;AAClB,QAAI,KAAK,kBAAkB,KAAK,YAAY;AACxC,WAAK,WAAW,YAAY,IAAI;AAAA,IACpC;AAEA,SAAK,WAAW,MAAM,YAAY,qCAAqC,IAAI;AAC3E,SAAK,WAAW,MAAM,YAAY,qCAAqC,IAAI;AAC3E,SAAK,iBAAiB,KAAK,UAAU;AAErC,0BAAsB,MAAM;AACxB,WAAK,WAAW,MAAM,eAAe,mCAAmC;AACxE,WAAK,WAAW,MAAM,eAAe,mCAAmC;AAAA,IAC5E,CAAC;AAED,QAAI,KAAK,WAAW,cAAc,WAAW,MAAM,MAAM;AACrD,WAAK,WAAW,OAAM;AAAA,IAC1B;AAAA,EACJ;AA8DJ;ACj0BA,MAAM,OAAO,aAAa,KAAK;"}
1
+ {"version":3,"file":"wje-toast.js","sources":["../packages/wje-toast/toast.element.js","../packages/wje-toast/toast.js"],"sourcesContent":["import { default as WJElement, WjElementUtils, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\nconst DEFAULT_STACK_POSITION = 'top-end';\nconst DEFAULT_STACK_DEPTH = 3;\nconst VALID_STACK_POSITIONS = new Set([\n 'top-start',\n 'top-center',\n 'top-end',\n 'bottom-start',\n 'bottom-center',\n 'bottom-end',\n]);\nconst STACKED_SCALE_STEP = 0.04;\nconst STACKED_MIN_SCALE = 0.88;\nconst STACKED_MIN_OPACITY = 0.72;\nconst STACKED_VISIBLE_SLICE = 16;\nconst STACKED_EXPANDED_MARGIN = '0.5rem';\nconst STACKED_PADDING = '1rem';\nconst STACKED_ENTER_OFFSET = 24;\n\nconst toggleStackExpanded = (stack, expanded) => {\n if (expanded) {\n stack.dataset.expanded = 'true';\n return;\n }\n\n delete stack.dataset.expanded;\n};\n\nconst syncExpandedStackToasts = (stack, expanded) => {\n Array.from(stack.children)\n .filter((child) => child.tagName === 'WJE-TOAST')\n .forEach((toast) => {\n if (expanded) {\n toast.pause?.();\n return;\n }\n\n toast.resume?.();\n });\n};\n\nconst setStackExpandedState = (stack, expanded) => {\n let shouldExpand = stack.dataset.stacked === 'true' && expanded;\n let isExpanded = stack.dataset.expanded === 'true';\n\n if (shouldExpand === isExpanded) {\n return;\n }\n\n toggleStackExpanded(stack, shouldExpand);\n syncExpandedStackToasts(stack, shouldExpand);\n stack.updateToastLayout?.();\n};\n\nconst syncStackExpandedState = (stack) => {\n setStackExpandedState(stack, stack.matches(':hover') || stack.matches(':focus-within'));\n};\n\n/**\n * `Toast` is a custom web component that represents a toast notification.\n * @summary This element represents a toast notification.\n * @documentation https://elements.webjet.sk/components/toast\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part\n * @slot - The content of the toast.\n * @slot media - The media of the toast.\n * @attribute {string} headline - Specifies the headline text of the toast. Represents the main title or heading displayed in the toast.\n * @attribute {boolean} open - Indicates whether the toast is currently open (visible). A value of `true` shows the toast, while `false` hides it.\n * @attribute {number} duration - Determines the duration (in milliseconds) for which the toast is displayed. After this time, the toast will automatically close unless it is manually closed.\n * @attribute {boolean} closable - Specifies whether the toast can be manually closed by the user. If `true`, the toast will include a close button or mechanism.\n * @attribute {string} color - Defines the color variant of the toast. Supports values such as `primary`, `complete`, `success`, `warning`, `danger`, `info`, and `contrast`.\n * @attribute {boolean} countdown - Indicates whether a countdown is displayed in the toast. When `true`, a visual countdown timer is shown to indicate the remaining time before the toast closes.\n * @attribute {boolean} stacked - Enables a layered toast stack where the newest toast stays visually on top while older ones shrink behind it.\n * @attribute {string} stack-position - Defines where the toast stack is placed on the screen. Supports `top-start`, `top-center`, `top-end`, `bottom-start`, `bottom-center`, and `bottom-end`.\n * @attribute {number} stack-depth - Defines how many visual levels the collapsed stacked toast can show. Older toasts beyond this limit stay at the last reduced level. Default is `3`.\n * @attribute {string} icon - Adds a leading icon into the `media` slot by icon name.\n * @cssproperty [--wje-toast-stack-width=300px] - Defines the width of the toast stack container. Useful for centered stacked toasts and demo layouts.\n * // @fires wje-toast:after-show - Fired after the toast is shown.\n * // @fires wje-toast:after-hide - Fired after the toast is hidden.\n */\n\nexport default class Toast extends WJElement {\n /**\n * Creates an instance of Toast.\n */\n constructor() {\n super();\n\n this.toastStack = this.createToastStack();\n }\n\n /**\n * Set headline value of the toast.\n * @param value\n */\n set headline(value) {\n this.setAttribute('headline', value);\n }\n\n /**\n * Get headline value of the toast.\n * @returns {string}\n */\n get headline() {\n return this.getAttribute('headline');\n }\n\n /**\n * Set open value of the toast.\n * @param value\n */\n set open(value) {\n this.removeAttribute('open');\n\n if (WjElementUtils.stringToBoolean(value)) this.setAttribute('open', value);\n }\n\n /**\n * Get open value of the toast.\n * @returns {boolean}\n */\n get open() {\n return this.hasAttribute('open');\n }\n\n /**\n * Set duration value of the toast.\n * @param value\n */\n set duration(value) {\n this.setAttribute('duration', value);\n }\n\n /**\n * Get duration value of the toast.\n * @returns {number}\n */\n get duration() {\n return +this.getAttribute('duration');\n }\n\n /**\n * Set closable value of the toast.\n * @param value\n */\n set closable(value) {\n this.setAttribute('closable', value || '');\n }\n\n /**\n * Get closable value of the toast.\n * @returns {boolean}\n */\n get closable() {\n return this.hasAttribute('closable');\n }\n\n /**\n * Set color value of the toast.\n * @param value\n */\n set color(value) {\n this.setAttribute('color', value);\n }\n\n /**\n * Get color value of the toast.\n * @returns {string}\n */\n get color() {\n return this.getAttribute('color');\n }\n\n /**\n * Set countdown value of the toast.\n * @param value\n */\n set countdown(value) {\n if (value) this.setAttribute('countdown', value);\n }\n\n /**\n * Get countdown value of the toast.\n * @returns {boolean}\n */\n get countdown() {\n return this.hasAttribute('countdown');\n }\n\n /**\n * Set stacked value of the toast.\n * @param value\n */\n set stacked(value) {\n this.toggleAttribute('stacked', WjElementUtils.stringToBoolean(value));\n }\n\n /**\n * Get stacked value of the toast.\n * @returns {boolean}\n */\n get stacked() {\n return this.hasAttribute('stacked');\n }\n\n /**\n * Set stack depth of the toast.\n * @param value\n */\n set stackDepth(value) {\n if (value === null || value === undefined || value === '') {\n this.removeAttribute('stack-depth');\n return;\n }\n\n this.setAttribute('stack-depth', value);\n }\n\n /**\n * Get stack depth of the toast.\n * @returns {number}\n */\n get stackDepth() {\n let value = Number.parseInt(this.getAttribute('stack-depth'), 10);\n\n if (Number.isFinite(value) && value > 0) {\n return value;\n }\n\n return DEFAULT_STACK_DEPTH;\n }\n\n /**\n * Set stack position of the toast.\n * @param value\n */\n set stackPosition(value) {\n if (!value) {\n this.removeAttribute('stack-position');\n return;\n }\n\n this.setAttribute('stack-position', value);\n }\n\n /**\n * Get stack position of the toast.\n * @returns {string}\n */\n get stackPosition() {\n let value = this.getAttribute('stack-position');\n\n if (VALID_STACK_POSITIONS.has(value)) {\n return value;\n }\n\n if (this.getAttribute('position') === 'bottom') {\n return 'bottom-end';\n }\n\n return DEFAULT_STACK_POSITION;\n }\n\n /**\n * Set icon value of the toast.\n * @param value\n */\n set icon(value) {\n this.setAttribute('icon', value);\n }\n\n /**\n * Get icon value of the toast.\n * @returns {string}\n */\n get icon() {\n return this.getAttribute('icon');\n }\n\n /**\n * Creates a toast stack container.\n * @returns {HTMLDivElement}\n */\n createToastStack() {\n let stack = Object.assign(document.createElement('div'), { className: 'wje-toast-stack' });\n\n stack.addEventListener('mouseenter', () => setStackExpandedState(stack, true));\n stack.addEventListener('mouseleave', () => requestAnimationFrame(() => syncStackExpandedState(stack)));\n stack.addEventListener('focusin', () => setStackExpandedState(stack, true));\n stack.addEventListener('focusout', () => requestAnimationFrame(() => syncStackExpandedState(stack)));\n\n this.syncToastStack(stack);\n\n return stack;\n }\n\n /**\n * Returns the key of the toast stack.\n * @returns {string}\n */\n getToastStackKey() {\n return `${this.stackPosition}:${this.stacked ? `stacked:${this.stackDepth}` : 'default'}`;\n }\n\n /**\n * Applies the stack placement directly on the element so demo/app layout CSS cannot override it accidentally.\n * @param {HTMLDivElement} stack\n */\n applyToastStackPlacement(stack = this.toastStack) {\n const positions = {\n 'top-start': {\n top: '0',\n bottom: 'auto',\n left: '0',\n right: 'auto',\n transform: 'none',\n margin: '0.5rem',\n },\n 'top-center': {\n top: '0',\n bottom: 'auto',\n left: '50%',\n right: 'auto',\n transform: 'translateX(-50%)',\n margin: '0.5rem 0 0',\n },\n 'top-end': {\n top: '0',\n bottom: 'auto',\n left: 'auto',\n right: '0',\n transform: 'none',\n margin: '0.5rem',\n },\n 'bottom-start': {\n top: 'auto',\n bottom: '0',\n left: '0',\n right: 'auto',\n transform: 'none',\n margin: '0 0.5rem 0.5rem',\n },\n 'bottom-center': {\n top: 'auto',\n bottom: '0',\n left: '50%',\n right: 'auto',\n transform: 'translateX(-50%)',\n margin: '0 0 0.5rem',\n },\n 'bottom-end': {\n top: 'auto',\n bottom: '0',\n left: 'auto',\n right: '0',\n transform: 'none',\n margin: '0 0.5rem 0.5rem',\n },\n };\n\n stack.style.removeProperty('inset-inline');\n stack.style.removeProperty('inset-inline-start');\n stack.style.removeProperty('inset-inline-end');\n Object.assign(stack.style, positions[this.stackPosition] || positions[DEFAULT_STACK_POSITION]);\n }\n\n /**\n * Applies the current toast stack configuration to a stack element.\n * @param {HTMLDivElement} stack\n */\n syncToastStack(stack = this.toastStack) {\n stack.dataset.position = this.stackPosition;\n stack.dataset.stackKey = this.getToastStackKey();\n stack.updateToastLayout = () => this.updateToastStack(stack);\n stack.style.display = 'flex';\n stack.style.alignItems = 'stretch';\n stack.style.width = 'min(var(--wje-toast-stack-width, 300px), calc(100vw - 1rem))';\n stack.style.maxWidth = 'calc(100vw - 1rem)';\n stack.style.maxHeight = 'calc(100vh - 1rem)';\n stack.style.zIndex = '9999';\n this.applyToastStackPlacement(stack);\n\n if (this.stacked) {\n stack.dataset.stacked = 'true';\n stack.dataset.stackDepth = String(this.stackDepth);\n } else {\n delete stack.dataset.stacked;\n delete stack.dataset.stackDepth;\n delete stack.dataset.expanded;\n }\n }\n\n /**\n * Clears transient stack styling from a toast.\n * @param {Toast} toast\n */\n clearStackItemStyles(toast) {\n [\n '--wje-toast-stack-scale',\n '--wje-toast-stack-shift',\n '--wje-toast-stack-opacity',\n '--wje-toast-stack-z',\n '--wje-toast-stack-origin',\n '--wje-toast-stack-host-margin-top',\n '--wje-toast-stack-host-margin-bottom',\n 'order',\n 'position',\n 'top',\n 'left',\n 'right',\n 'width',\n 'margin',\n 'margin-top',\n 'margin-bottom',\n ].forEach((property) => toast.style.removeProperty(property));\n }\n\n /**\n * Measures the rendered height of a toast for stack overlap calculations.\n * @param {Toast} toast\n * @returns {number}\n */\n getToastVisualHeight(toast) {\n let hostHeight = toast.getBoundingClientRect().height;\n let nativeHeight = toast.shadowRoot?.querySelector('.native-toast')?.getBoundingClientRect().height || 0;\n\n return Math.max(hostHeight, nativeHeight, toast.offsetHeight || 0);\n }\n\n /**\n * Recomputes the visual order of toasts inside the stack.\n * @param {HTMLDivElement} stack\n */\n updateToastStack(stack = this.toastStack) {\n let toasts = Array.from(stack.children).filter((child) => child.tagName === 'WJE-TOAST');\n let isStacked = stack.dataset.stacked === 'true';\n let isExpanded = stack.dataset.expanded === 'true';\n let isBottomStack = stack.dataset.position?.startsWith('bottom');\n let transformOrigin = stack.dataset.position?.startsWith('bottom') ? 'center bottom' : 'center top';\n let stackHeight = 0;\n\n stack.dataset.count = String(toasts.length);\n stack.style.gap = 'var(--wje-spacing-x-small)';\n stack.style.flexDirection = 'column';\n stack.style.overflow = isStacked ? (isExpanded ? 'auto' : 'visible') : 'auto';\n\n if (isStacked) {\n stack.style.paddingTop = isExpanded ? (isBottomStack ? STACKED_PADDING : '0px') : STACKED_PADDING;\n stack.style.paddingBottom = isExpanded ? (isBottomStack ? '0px' : STACKED_PADDING) : STACKED_PADDING;\n } else {\n stack.style.removeProperty('padding-top');\n stack.style.removeProperty('padding-bottom');\n }\n\n if (!isStacked || isExpanded) {\n stack.style.removeProperty('height');\n }\n\n toasts.forEach((toast, index) => {\n this.clearStackItemStyles(toast);\n\n toast.style.setProperty('--wje-toast-stack-z', String(index + 1));\n\n if (!isStacked) {\n return;\n }\n\n if (isExpanded) {\n let visualOrder = isBottomStack ? index : toasts.length - index - 1;\n let isVisualFirst = visualOrder === 0;\n let isVisualLast = visualOrder === toasts.length - 1;\n\n toast.style.setProperty('--wje-toast-stack-scale', '1.000');\n toast.style.setProperty('--wje-toast-stack-shift', '0px');\n toast.style.setProperty('--wje-toast-stack-opacity', '1.000');\n toast.style.setProperty('--wje-toast-stack-origin', transformOrigin);\n toast.style.order = String(visualOrder);\n toast.style.width = '100%';\n toast.style.setProperty(\n '--wje-toast-stack-host-margin-top',\n isBottomStack && !isVisualFirst ? STACKED_EXPANDED_MARGIN : '0px'\n );\n toast.style.setProperty(\n '--wje-toast-stack-host-margin-bottom',\n !isBottomStack && !isVisualLast ? STACKED_EXPANDED_MARGIN : '0px'\n );\n return;\n }\n\n let toastHeight = this.getToastVisualHeight(toast);\n let maxDepth = Math.max(0, this.stackDepth - 1);\n let visibleLevels = Math.min(toasts.length, this.stackDepth);\n let depth = Math.min(toasts.length - index - 1, maxDepth);\n let visibleIndex = Math.max(0, index - Math.max(0, toasts.length - this.stackDepth));\n let targetTop = isBottomStack\n ? visibleIndex * STACKED_VISIBLE_SLICE\n : (visibleLevels - 1 - visibleIndex) * STACKED_VISIBLE_SLICE;\n let scale = Math.max(STACKED_MIN_SCALE, 1 - depth * STACKED_SCALE_STEP);\n let opacity = Math.max(STACKED_MIN_OPACITY, 1 - depth * 0.08);\n\n toast.style.setProperty('--wje-toast-stack-scale', scale.toFixed(3));\n toast.style.setProperty('--wje-toast-stack-shift', '0px');\n toast.style.setProperty('--wje-toast-stack-opacity', opacity.toFixed(3));\n toast.style.setProperty('--wje-toast-stack-origin', transformOrigin);\n toast.style.position = 'absolute';\n toast.style.top = `${targetTop}px`;\n toast.style.left = '0';\n toast.style.right = '0';\n toast.style.width = '100%';\n toast.style.setProperty('--wje-toast-stack-host-margin-top', '0px');\n toast.style.setProperty('--wje-toast-stack-host-margin-bottom', '0px');\n\n stackHeight = Math.max(stackHeight, targetTop + toastHeight);\n });\n\n if (isStacked && !isExpanded) {\n stack.style.height = `${stackHeight}px`;\n }\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Toast';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.setAriaState({\n role: 'status',\n });\n }\n\n /**\n * Draw method for the toast notification.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-toast');\n\n let mediaSlot = document.createElement('slot');\n mediaSlot.setAttribute('name', 'media');\n mediaSlot.classList.add('media');\n mediaSlot.addEventListener('slotchange', () => {\n if (WjElementUtils.hasSlotContent(this.context, 'media')) {\n mediaSlot.parentElement.classList.add('has-media');\n } else {\n mediaSlot.parentElement.classList.remove('has-media');\n }\n });\n\n let content = document.createElement('div');\n content.classList.add('content');\n content.innerHTML = `<div class=\"headline\">${this.headline}</div><div class=\"message\"><slot></slot></div>`;\n\n let iconX = document.createElement('wje-icon');\n iconX.setAttribute('name', 'x');\n\n let closeBtn = document.createElement('wje-button');\n closeBtn.setAttribute('fill', 'link');\n closeBtn.setAttribute('color', this.color);\n closeBtn.setAttribute('size', 'small');\n closeBtn.classList.add('close');\n closeBtn.setAttribute('label', 'Close');\n\n let countdownEl = document.createElement('div');\n countdownEl.classList.add('countdown');\n\n let countdownBar = document.createElement('div');\n countdownBar.classList.add('countdown-bar');\n\n closeBtn.appendChild(iconX);\n countdownEl.appendChild(countdownBar);\n\n if (this.hasAttribute('icon') && this.icon) {\n let icon = document.createElement('wje-icon');\n icon.setAttribute('name', this.icon);\n icon.setAttribute('color', this.color);\n icon.setAttribute('slot', 'media');\n icon.setAttribute('part', 'icon');\n\n this.appendChild(icon);\n }\n\n native.appendChild(mediaSlot);\n native.appendChild(content);\n\n if (this.closable) native.appendChild(closeBtn);\n\n if (this.hasAttribute('countdown')) native.appendChild(countdownEl);\n\n fragment.appendChild(native);\n\n this.closeBtn = closeBtn;\n this.countdownBar = countdownBar;\n\n return fragment;\n }\n\n /**\n * After draw method for the toast notification.\n */\n afterDraw() {\n this.closeBtn.addEventListener('wje-button:click', this.hide);\n this.addEventListener('mouseenter', this.pause);\n this.addEventListener('mouseleave', this.resume);\n\n if (this.hasAttribute('countdown')) {\n const startWidth = '100%';\n const endWidth = '0';\n\n this.countdownAnimation = this.countdownBar.animate([{ width: startWidth }, { width: endWidth }], {\n duration: this.duration,\n easing: 'linear',\n });\n }\n\n if (this.duration > 0) {\n this.remainingTime = this.duration;\n this.startTimer();\n }\n }\n\n /**\n * Before disconnect method\n * This method is called before the element is disconnected from the document.\n */\n beforeDisconnect() {\n this.closeBtn?.removeEventListener('wje-button:click', this.hide);\n this.removeEventListener('wje-toast:after-hide', this.removeChildAndStack);\n this.removeEventListener('mouseenter', this.pause);\n this.removeEventListener('mouseleave', this.resume);\n\n clearTimeout(this.timeoutID);\n }\n\n /**\n * Starts the timer.\n * This method sets the `startTime` property to the current time and sets\n * the `timeoutID` property to the ID of the timeout. The method also\n * dispatches the `wje-toast:after-hide` custom event when the timeout\n * expires.\n */\n startTimer() {\n this.startTime = Date.now();\n if (this.timeoutID) {\n clearTimeout(this.timeoutID);\n }\n this.isTimerPaused = false;\n this.timeoutID = window.setTimeout(() => {\n this.hide();\n }, this.remainingTime);\n }\n\n /**\n * Stops the timer.\n * This method clears the timeout and calculates the remaining time.\n * The method is called when the toast notification is paused.\n */\n stopTimer() {\n if (!this.timeoutID || this.isTimerPaused) {\n return;\n }\n\n window.clearTimeout(this.timeoutID);\n this.timeoutID = null;\n const elapsedTime = Date.now() - this.startTime;\n this.remainingTime = Math.max(0, this.remainingTime - elapsedTime);\n this.isTimerPaused = true;\n }\n\n /**\n * Resumes the timer.\n * This method resumes the timer if the remaining time is greater\n * than zero. The method is called when the toast notification is resumed.\n */\n resumeTimer() {\n if (this.isTimerPaused && this.remainingTime > 0) {\n this.startTimer();\n }\n }\n\n /**\n * Asynchronously shows the toast notification.\n * This method sets the `open` property to `true` and dispatches the\n * `wje-toast:after-show` custom event. If the toast is already open,\n * the method returns `undefined`.\n */\n show = () => {\n if (this.open) {\n return;\n }\n\n this.open = true;\n event.dispatchCustomEvent(this, 'wje-toast:after-show');\n };\n\n /**\n * Asynchronously hides the toast notification.\n * This method sets the `open` property to `false` and dispatches the\n * `wje-toast:after-hide` custom event. If the toast is already hidden,\n * the method returns `undefined`.\n */\n hide = () => {\n if (!this.open) {\n return;\n }\n\n this.open = false;\n event.dispatchCustomEvent(this, 'wje-toast:after-hide');\n };\n\n /**\n * Pauses the countdown animation and stops the timer.\n */\n pause = () => {\n this.countdownAnimation?.pause();\n this.stopTimer();\n };\n\n /**\n * Resumes the countdown animation and resumes the timer.\n */\n resume = () => {\n if (this.toastStack?.dataset.expanded === 'true') {\n return;\n }\n\n this.countdownAnimation?.play();\n this.resumeTimer();\n };\n\n /**\n * Removes the toast notification and the toast stack.\n *\n * This method removes the toast notification from the toast stack and\n * removes the toast stack from the document body if the toast stack is\n * empty.\n */\n removeChildAndStack() {\n if (this.parentElement === this.toastStack) {\n this.toastStack.removeChild(this);\n }\n\n this.toastStack.style.setProperty('--wje-toast-stack-layout-duration', '0s');\n this.toastStack.style.setProperty('--wje-toast-stack-visual-duration', '0s');\n this.updateToastStack(this.toastStack);\n\n requestAnimationFrame(() => {\n this.toastStack.style.removeProperty('--wje-toast-stack-layout-duration');\n this.toastStack.style.removeProperty('--wje-toast-stack-visual-duration');\n });\n\n if (this.toastStack.querySelector('wje-toast') === null) {\n this.toastStack.remove();\n }\n }\n\n /**\n * Asynchronously starts the toast notification.\n * This method appends the toast notification to the document body and\n * shows the toast notification. The method returns a promise that\n * resolves when the toast notification is shown.\n * @returns {Promise<unknown>}\n */\n start = () => {\n return new Promise((resolve) => {\n let stack = document.body.querySelector(`.wje-toast-stack[data-stack-key=\"${this.getToastStackKey()}\"]`);\n if (stack) {\n this.toastStack = stack;\n } else {\n this.toastStack = this.createToastStack();\n }\n\n this.syncToastStack(this.toastStack);\n\n if (this.toastStack.parentElement === null) {\n document.body.append(this.toastStack);\n }\n\n this.toastStack.append(this);\n if (this.stacked) {\n this.toastStack.style.setProperty('--wje-toast-stack-layout-duration', '0s');\n this.toastStack.style.setProperty('--wje-toast-stack-visual-duration', '0s');\n this.style.setProperty(\n '--wje-toast-enter-offset',\n this.stackPosition.startsWith('bottom') ? `${STACKED_ENTER_OFFSET}px` : `-${STACKED_ENTER_OFFSET}px`\n );\n this.style.visibility = 'hidden';\n this.show();\n this.updateToastStack(this.toastStack);\n } else {\n this.updateToastStack(this.toastStack);\n this.show();\n }\n\n if (this.toastStack.dataset.expanded === 'true') {\n this.pause();\n }\n\n requestAnimationFrame(() => {\n this.updateToastStack(this.toastStack);\n\n if (this.stacked) {\n this.style.removeProperty('visibility');\n this.toastStack.style.removeProperty('--wje-toast-stack-layout-duration');\n this.toastStack.style.removeProperty('--wje-toast-stack-visual-duration');\n\n requestAnimationFrame(() => this.style.setProperty('--wje-toast-enter-offset', '0px'));\n }\n });\n this.updateComplete?.then(() => this.updateToastStack(this.toastStack));\n\n this.addEventListener('wje-toast:after-hide', this.removeChildAndStack);\n\n resolve(this);\n });\n };\n}\n","import Toast from './toast.element.js';\n\nexport default Toast;\n\nToast.define('wje-toast', Toast);\n"],"names":["DEFAULT_STACK_POSITION","VALID_STACK_POSITIONS","Set","STACKED_EXPANDED_MARGIN","STACKED_PADDING","setStackExpandedState","stack","expanded","shouldExpand","dataset","stacked","Array","from","children","filter","child","tagName","forEach","toast","pause","resume","updateToastLayout","syncStackExpandedState","matches","Toast","WJElement","constructor","super","className","show","this","open","event","dispatchCustomEvent","hide","countdownAnimation","stopTimer","toastStack","play","resumeTimer","start","Promise","resolve","document","body","querySelector","getToastStackKey","createToastStack","syncToastStack","parentElement","append","style","setProperty","stackPosition","startsWith","visibility","updateToastStack","requestAnimationFrame","removeProperty","updateComplete","then","addEventListener","removeChildAndStack","value","setAttribute","headline","getAttribute","removeAttribute","WjElementUtils","stringToBoolean","hasAttribute","duration","closable","countdown","toggleAttribute","stackDepth","Number","parseInt","isFinite","has","Object","assign","createElement","positions","top","bottom","left","right","transform","margin","position","stackKey","display","alignItems","width","maxWidth","maxHeight","zIndex","applyToastStackPlacement","String","property","hostHeight","getBoundingClientRect","height","nativeHeight","shadowRoot","Math","max","offsetHeight","toasts","isStacked","isExpanded","isBottomStack","transformOrigin","stackHeight","count","length","gap","flexDirection","overflow","paddingTop","paddingBottom","index","clearStackItemStyles","visualOrder","isVisualFirst","isVisualLast","order","toastHeight","getToastVisualHeight","maxDepth","visibleLevels","min","depth","visibleIndex","targetTop","scale","opacity","toFixed","cssStyleSheet","setupAttributes","isShadowRoot","setAriaState","role","fragment","createDocumentFragment","native","classList","add","mediaSlot","hasSlotContent","context","remove","content","innerHTML","iconX","closeBtn","color","countdownEl","countdownBar","appendChild","icon","afterDraw","startWidth","endWidth","animate","easing","remainingTime","startTimer","beforeDisconnect","removeEventListener","clearTimeout","timeoutID","startTime","Date","now","isTimerPaused","window","setTimeout","elapsedTime","removeChild","define"],"mappings":";;;;;;MAGMA,IAAyB,WAEzBC,IAAwB,oBAAIC,IAAI,CAClC,aACA,cACA,WACA,gBACA,iBACA,YAAA,CAAA,GAMEC,IAA0B,UAC1BC,IAAkB,QAyBlBC,IAAwB,CAACC,IAAOC,OAAAA;;AAClC,MAAIC,KAAyC,WAA1BF,GAAMG,QAAQC,WAAsBH;AAGnDC,EAAAA,QAFwC,WAA3BF,GAAMG,QAAQF,gBAxBND,IAAOC,OAAAA;AAC5BA,IAAAA,KACAD,GAAM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AAiBlJ,KAAKyI,gBAAgB,KAC3CzI,KAAK0I,WAAAA;AAAAA,EAEb;AAAA,EA2DA,sBAAA1G;AACQhC,SAAKmB,kBAAkBnB,KAAKO,cAC5BP,KAAKO,WAAW+I,YAAYtJ,IAAAA,GAGhCA,KAAKO,WAAWc,MAAMC,YAAY,qCAAqC,IAAA,GACvEtB,KAAKO,WAAWc,MAAMC,YAAY,qCAAqC,IAAA,GACvEtB,KAAK0B,iBAAiB1B,KAAKO,aAE3BoB,sBAAsB,MAAA;AAClB3B,WAAKO,WAAWc,MAAMO,eAAe,mCAAA,GACrC5B,KAAKO,WAAWc,MAAMO,eAAe;QAGU,SAA/C5B,KAAKO,WAAWQ,cAAc,gBAC9Bf,KAAKO,WAAWmH;EAExB;;ACnwBJhI,EAAM6J,OAAO,aAAa7J,CAAAA;"}
@@ -5,217 +5,92 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
5
5
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
6
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
7
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
- var _internalValue;
9
- import { F as FormAssociatedElement } from "./form-associated-element-DEQ4y-jn.js";
10
- import { event } from "./event.js";
11
- const styles = "/*\n[ WJ Toggle ]\n*/\n\n:host {\n --wje-toggle-color-base: var(--wje-color-contrast-3);\n --wje-toggle-width: 30px;\n --wje-toggle-height: 18px;\n --wje-toggle-border-radius: 50px;\n --wje-toggle-handle-width: 13px;\n --wje-toggle-handle-height: 13px;\n --wje-toggle-handle-border-radius: 9px;\n --wje-toggle-handle-color: #fff;\n --wje-toggle-handle-shadow: 1px 0 1px 0.5px rgba(0, 0, 0, 0.12), 2px 4px 6px rgba(0, 0, 0, 0.2);\n --wje-toggle-handle-shadow-checked: 1px 1px 0 rgba(0, 0, 0, 0.08), -3px 3px 6px rgba(0, 0, 0, 0.3);\n --wje-toggle-duration: 250ms;\n --wje-toggle-curve: cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n:host([color='primary']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-primary-9) !important;\n}\n\n:host([color='complete']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-complete-9);\n}\n\n:host([color='success']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-success-9) !important;\n}\n\n:host([color='warning']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-warning-9);\n}\n\n:host([color='danger']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-danger-9);\n}\n\n:host([color='info']) input:checked + label > .label-wrapper {\n --wje-toggle-color-base: var(--wje-color-info-9);\n}\n\n.native-toggle {\n\n label {\n display: flex;\n cursor: pointer;\n align-items: center;\n user-select: none;\n\n .label-wrapper {\n width: var(--wje-toggle-width) !important;\n min-width: var(--wje-toggle-width);\n height: var(--wje-toggle-height);\n position: relative;\n display: flex;\n align-items: center;\n\n &:before {\n content: '';\n position: absolute;\n cursor: pointer;\n width: 100%;\n height: 100%;\n top: auto;\n left: 0;\n background: var(--wje-toggle-color-base);\n background-size: 300%;\n background-position: right;\n border-radius: var(--wje-toggle-border-radius);\n border: none;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);\n transition: background calc(var(--wje-toggle-duration) + (var(--wje-toggle-duration) * 0.24)),\n box-shadow var(--wje-toggle-duration);\n transition-timing-function: var(--wje-toggle-curve);\n }\n\n &:after {\n content: '';\n position: absolute;\n transform: translateX(0%);\n background: var(--wje-toggle-handle-color);\n width: var(--wje-toggle-handle-width);\n height: var(--wje-toggle-handle-height);\n border-radius: var(--wje-toggle-handle-border-radius);\n top: auto;\n left: 2px;\n box-shadow: var(--wje-toggle-handle-shadow);\n transition: transform, box-shadow;\n transition-duration: var(--wje-toggle-duration);\n transition-timing-function: var(--wje-toggle-curve);\n }\n }\n }\n\n input[type='checkbox'][disabled] {\n & + label {\n cursor: not-allowed !important;\n color: var(--wje-color-contrast-9);\n opacity: 0.58;\n\n &:before {\n cursor: not-allowed !important;\n }\n }\n }\n\n input[type='checkbox'] {\n position: absolute;\n z-index: -1;\n opacity: 0;\n\n &:checked {\n & + label {\n .label-wrapper:before {\n background-position: left;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);\n }\n\n .label-wrapper:after {\n transform: translateX(calc(var(--wje-toggle-width) - var(--wje-toggle-handle-width) - 4px));\n box-shadow: var(--wje-toggle-handle-shadow-checked);\n }\n }\n }\n\n &:focus {\n & + label {\n .label-wrapper:before {\n outline: none !important;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12),\n 0 0 0 0 #78c8fe;\n }\n }\n }\n\n &[disabled]:active {\n & + label {\n .label-wrapper:after {\n transform: scaleX(1.1);\n transform-origin: center left;\n transition: transform step-start;\n }\n }\n }\n\n &:checked {\n &[disabled]:active {\n & + label {\n .label-wrapper:after {\n transform: translateX(calc(100% - 6px)) scaleX(1.1);\n transform-origin: center right;\n }\n }\n }\n }\n\n &:hover {\n &:active {\n & + label {\n .label-wrapper:before {\n background-color: transparent;\n }\n }\n }\n }\n }\n}\n\n:host .text {\n margin-inline: 0.5rem 0;\n}\n\n/*Placememt*/\n:host([placement='end']) {\n label {\n width: 100%;\n }\n .text {\n margin-inline: 0 0.5rem;\n width: 100%;\n }\n}\n\n:host([invalid]) {\n label{\n color: var(--wje-input-color-invalid);\n }\n}\n\nslot[name='error'] {\n display: none;\n}\n\n:host([invalid]) slot[name='error'] {\n display: block;\n}\n\nslot[name='error'] {\n display: none;\n max-width: 100%;\n min-width: auto;\n border-radius: 50px;\n top: 0;\n width: max-content;\n line-height: normal;\n position: static;\n background: transparent;\n padding: 0.25rem 0;\n left: auto;\n transform: none;\n color: var(--wje-input-color-invalid);\n font-size: 12px;\n}\n";
12
- class Toggle extends FormAssociatedElement {
8
+ var _e;
9
+ import { F as e } from "./form-associated-element-BjeJn7j8.js";
10
+ import { event as t } from "./event.js";
11
+ class a extends e {
13
12
  constructor() {
14
13
  super();
15
- __privateAdd(this, _internalValue);
16
- this.invalid = false;
17
- this.pristine = true;
18
- }
19
- /**
20
- * Setter for the value attribute.
21
- * @param {string} value The value to set.
22
- */
23
- set value(value) {
24
- __privateSet(this, _internalValue, value);
25
- if (this.input) {
26
- this.input.value = value;
27
- }
14
+ __privateAdd(this, _e);
15
+ this.invalid = false, this.pristine = true;
16
+ }
17
+ set value(e2) {
18
+ __privateSet(this, _e, e2), this.input && (this.input.value = e2);
28
19
  }
29
- /**
30
- * Getter for the value attribute.
31
- * @returns {string} The value of the attribute.
32
- */
33
20
  get value() {
34
- return __privateGet(this, _internalValue) ?? this.getAttribute("value") ?? "on";
21
+ return __privateGet(this, _e) ?? this.getAttribute("value") ?? "on";
35
22
  }
36
- /**
37
- * Getter for the customErrorDisplay attribute.
38
- * @returns {boolean} Whether the attribute is present.
39
- */
40
23
  get customErrorDisplay() {
41
24
  return this.hasAttribute("custom-error-display");
42
25
  }
43
- /**
44
- * Getter for the validateOnChange attribute.
45
- * @returns {boolean} Whether the attribute is present.
46
- */
47
26
  get validateOnChange() {
48
27
  return this.hasAttribute("validate-on-change");
49
28
  }
50
- /**
51
- * Setter for the defaultValue attribute.
52
- * This method sets the 'value' attribute of the custom input element to the provided value.
53
- * The 'value' attribute represents the default value of the input element.
54
- * @param {string} value The value to set as the default value.
55
- */
56
- set defaultValue(value) {
57
- this.setAttribute("value", value);
58
- }
59
- /**
60
- * Getter for the defaultValue attribute.
61
- * This method retrieves the 'value' attribute of the custom input element.
62
- * The 'value' attribute represents the default value of the input element.
63
- * If the 'value' attribute is not set, it returns an empty string.
64
- * @returns {string} The default value of the input element.
65
- */
29
+ set defaultValue(e2) {
30
+ this.setAttribute("value", e2);
31
+ }
66
32
  get defaultValue() {
67
33
  return this.getAttribute("value") ?? "";
68
34
  }
69
- /**
70
- * Set checked attribute.
71
- * @param {boolean} value true if the toggle is checked, false otherwise
72
- */
73
- set checked(value) {
74
- if (value) {
75
- this.setAttribute("checked", "");
76
- this.internals.setFormValue(this.value);
77
- } else {
78
- this.removeAttribute("checked");
79
- this.internals.setFormValue(null);
80
- }
81
- if (this.input) {
82
- this.input.checked = value;
83
- }
35
+ set checked(e2) {
36
+ e2 ? (this.setAttribute("checked", ""), this.internals.setFormValue(this.value)) : (this.removeAttribute("checked"), this.internals.setFormValue(null)), this.input && (this.input.checked = e2);
84
37
  }
85
- /**
86
- * Get checked attribute.
87
- * @returns {boolean} true if the toggle is checked, false otherwise
88
- */
89
38
  get checked() {
90
39
  return this.hasAttribute("checked");
91
40
  }
92
41
  static get cssStyleSheet() {
93
- return styles;
42
+ return ':host{--wje-toggle-color-base: var(--wje-color-contrast-3);--wje-toggle-width: 30px;--wje-toggle-height: 18px;--wje-toggle-border-radius: 50px;--wje-toggle-handle-width: 13px;--wje-toggle-handle-height: 13px;--wje-toggle-handle-border-radius: 9px;--wje-toggle-handle-color: #fff;--wje-toggle-handle-shadow: 1px 0 1px .5px rgba(0, 0, 0, .12), 2px 4px 6px rgba(0, 0, 0, .2);--wje-toggle-handle-shadow-checked: 1px 1px 0 rgba(0, 0, 0, .08), -3px 3px 6px rgba(0, 0, 0, .3);--wje-toggle-duration: .25s;--wje-toggle-curve: cubic-bezier(.4, 0, .2, 1)}:host([color="primary"]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-primary-9) !important}:host([color="complete"]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-complete-9)}:host([color="success"]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-success-9) !important}:host([color="warning"]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-warning-9)}:host([color="danger"]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-danger-9)}:host([color="info"]) input:checked+label>.label-wrapper{--wje-toggle-color-base: var(--wje-color-info-9)}.native-toggle label{display:flex;cursor:pointer;align-items:center;-webkit-user-select:none;user-select:none}.native-toggle label .label-wrapper{width:var(--wje-toggle-width)!important;min-width:var(--wje-toggle-width);height:var(--wje-toggle-height);position:relative;display:flex;align-items:center}.native-toggle label .label-wrapper:before{content:"";position:absolute;cursor:pointer;width:100%;height:100%;top:auto;left:0;background:var(--wje-toggle-color-base);background-size:300%;background-position:right;border-radius:var(--wje-toggle-border-radius);border:none;box-shadow:inset 0 0 0 1px #0000001f;transition:background calc(var(--wje-toggle-duration) + (var(--wje-toggle-duration) * .24)),box-shadow var(--wje-toggle-duration);transition-timing-function:var(--wje-toggle-curve)}.native-toggle label .label-wrapper:after{content:"";position:absolute;transform:translate(0);background:var(--wje-toggle-handle-color);width:var(--wje-toggle-handle-width);height:var(--wje-toggle-handle-height);border-radius:var(--wje-toggle-handle-border-radius);top:auto;left:2px;box-shadow:var(--wje-toggle-handle-shadow);transition:transform,box-shadow;transition-duration:var(--wje-toggle-duration);transition-timing-function:var(--wje-toggle-curve)}.native-toggle input[type=checkbox][disabled]+label{cursor:not-allowed!important;color:var(--wje-color-contrast-9);opacity:.58}.native-toggle input[type=checkbox][disabled]+label:before{cursor:not-allowed!important}.native-toggle input[type=checkbox]{position:absolute;z-index:-1;opacity:0}.native-toggle input[type=checkbox]:checked+label .label-wrapper:before{background-position:left;box-shadow:inset 0 0 0 1px #0000001f}.native-toggle input[type=checkbox]:checked+label .label-wrapper:after{transform:translate(calc(var(--wje-toggle-width) - var(--wje-toggle-handle-width) - 4px));box-shadow:var(--wje-toggle-handle-shadow-checked)}.native-toggle input[type=checkbox]:focus+label .label-wrapper:before{outline:none!important;box-shadow:inset 0 0 0 1px #0000001f,0 0 #78c8fe}.native-toggle input[type=checkbox][disabled]:active+label .label-wrapper:after{transform:scaleX(1.1);transform-origin:center left;transition:transform step-start}.native-toggle input[type=checkbox]:checked[disabled]:active+label .label-wrapper:after{transform:translate(calc(100% - 6px)) scaleX(1.1);transform-origin:center right}.native-toggle input[type=checkbox]:hover:active+label .label-wrapper:before{background-color:transparent}:host .text{margin-inline:.5rem 0}:host([placement="end"]) label{width:100%}:host([placement="end"]) .text{margin-inline:0 .5rem;width:100%}:host([invalid]) label{color:var(--wje-input-color-invalid)}slot[name=error]{display:none}:host([invalid]) slot[name=error]{display:block}slot[name=error]{display:none;max-width:100%;min-width:auto;border-radius:50px;top:0;width:max-content;line-height:normal;position:static;background:transparent;padding:.25rem 0;left:auto;transform:none;color:var(--wje-input-color-invalid);font-size:12px}';
94
43
  }
95
44
  static get observedAttributes() {
96
45
  return ["checked", "disabled", "required"];
97
46
  }
98
47
  setupAttributes() {
99
- this.isShadowRoot = "open";
100
- if (this.pristine) {
101
- this.value = __privateGet(this, _internalValue);
102
- this.pristine = false;
103
- }
104
- this.syncAria();
105
- }
106
- attributeChangedCallback(name, oldValue, newValue) {
107
- if (!this.input) return;
108
- if (name === "checked") {
109
- const isChecked = this.hasAttribute("checked");
110
- this.input.checked = isChecked;
111
- if (isChecked) {
112
- this.internals.setFormValue(this.value);
113
- } else {
114
- this.internals.setFormValue(null);
115
- }
116
- } else if (name === "disabled") {
117
- this.input.disabled = this.hasAttribute("disabled");
118
- } else if (name === "indeterminate") {
119
- this.input.indeterminate = this.hasAttribute("indeterminate");
120
- } else if (name === "value") {
121
- __privateSet(this, _internalValue, newValue ?? void 0);
122
- this.input.value = this.value;
123
- if (this.input.checked) {
124
- this.internals.setFormValue(this.value);
125
- }
48
+ this.isShadowRoot = "open", this.pristine && (this.value = __privateGet(this, _e), this.pristine = false), this.syncAria();
49
+ }
50
+ attributeChangedCallback(e2, t2, a2) {
51
+ if (this.input) {
52
+ if ("checked" === e2) {
53
+ const e3 = this.hasAttribute("checked");
54
+ this.input.checked = e3, e3 ? this.internals.setFormValue(this.value) : this.internals.setFormValue(null);
55
+ } else "disabled" === e2 ? this.input.disabled = this.hasAttribute("disabled") : "indeterminate" === e2 ? this.input.indeterminate = this.hasAttribute("indeterminate") : "value" === e2 && (__privateSet(this, _e, a2 ?? void 0), this.input.value = this.value, this.input.checked && this.internals.setFormValue(this.value));
56
+ this.syncAria();
126
57
  }
127
- this.syncAria();
128
58
  }
129
59
  draw() {
130
- const fragment = document.createDocumentFragment();
131
- const native = document.createElement("div");
132
- native.setAttribute("part", "native");
133
- native.classList.add("native-toggle");
134
- const input = document.createElement("input");
135
- input.setAttribute("part", "input");
136
- input.type = "checkbox";
137
- input.name = this.name;
138
- input.id = "input";
139
- input.checked = this.hasAttribute("checked");
140
- input.disabled = this.hasAttribute("disabled");
141
- if (this.hasAttribute("required")) input.required = true;
142
- const label = document.createElement("label");
143
- label.setAttribute("for", "input");
144
- const toggle = document.createElement("div");
145
- toggle.setAttribute("part", "toggle");
146
- toggle.classList.add("label-wrapper");
147
- const text = document.createElement("div");
148
- text.classList.add("text");
149
- text.innerHTML = "<slot></slot>";
150
- let errorSlot = document.createElement("slot");
151
- errorSlot.setAttribute("name", "error");
152
- let error = document.createElement("div");
153
- error.setAttribute("slot", "error");
154
- if (this.placement === "end") {
155
- native.classList.add("end");
156
- label.appendChild(text);
157
- label.appendChild(toggle);
158
- } else {
159
- label.appendChild(toggle);
160
- label.appendChild(text);
161
- }
162
- native.appendChild(input);
163
- native.appendChild(label);
164
- native.append(errorSlot);
165
- this.append(error);
166
- fragment.appendChild(native);
167
- this.input = input;
168
- return fragment;
60
+ const e2 = document.createDocumentFragment(), t2 = document.createElement("div");
61
+ t2.setAttribute("part", "native"), t2.classList.add("native-toggle");
62
+ const a2 = document.createElement("input");
63
+ a2.setAttribute("part", "input"), a2.type = "checkbox", a2.name = this.name, a2.id = "input", a2.checked = this.hasAttribute("checked"), a2.disabled = this.hasAttribute("disabled"), this.hasAttribute("required") && (a2.required = true);
64
+ const i = document.createElement("label");
65
+ i.setAttribute("for", "input");
66
+ const r = document.createElement("div");
67
+ r.setAttribute("part", "toggle"), r.classList.add("label-wrapper");
68
+ const o = document.createElement("div");
69
+ o.classList.add("text"), o.innerHTML = "<slot></slot>";
70
+ let l = document.createElement("slot");
71
+ l.setAttribute("name", "error");
72
+ let n = document.createElement("div");
73
+ return n.setAttribute("slot", "error"), "end" === this.placement ? (t2.classList.add("end"), i.appendChild(o), i.appendChild(r)) : (i.appendChild(r), i.appendChild(o)), t2.appendChild(a2), t2.appendChild(i), t2.append(l), this.append(n), e2.appendChild(t2), this.input = a2, e2;
169
74
  }
170
75
  afterDraw() {
171
- this.internals.setFormValue(this.checked ? this.value : null);
172
- this.syncAria();
173
- if (!this.disabled) {
174
- this.input.addEventListener("input", (e) => {
175
- this.validate();
176
- this.pristine = false;
177
- this.propagateValidation();
178
- this.indeterminate = false;
179
- this.checked = e.target.checked;
180
- this.syncAria();
181
- event.dispatchCustomEvent(this, "wje-toggle:input");
182
- });
183
- this.input.addEventListener("change", (e) => {
184
- event.dispatchCustomEvent(this, "wje-toggle:change");
185
- });
186
- this.addEventListener("invalid", (e) => {
187
- this.invalid = true;
188
- this.pristine = false;
189
- this.showInvalidMessage();
190
- });
191
- this.validate();
192
- if (this.invalid) {
193
- this.showInvalidMessage();
194
- }
195
- }
76
+ this.internals.setFormValue(this.checked ? this.value : null), this.syncAria(), this.disabled || (this.input.addEventListener("input", (e2) => {
77
+ this.validate(), this.pristine = false, this.propagateValidation(), this.indeterminate = false, this.checked = e2.target.checked, this.syncAria(), t.dispatchCustomEvent(this, "wje-toggle:input");
78
+ }), this.input.addEventListener("change", (e2) => {
79
+ t.dispatchCustomEvent(this, "wje-toggle:change");
80
+ }), this.addEventListener("invalid", (e2) => {
81
+ this.invalid = true, this.pristine = false, this.showInvalidMessage();
82
+ }), this.validate(), this.invalid && this.showInvalidMessage());
196
83
  }
197
- /**
198
- * Syncs ARIA attributes on the host element.
199
- */
200
84
  syncAria() {
201
- this.setAriaState({
202
- role: "switch",
203
- checked: this.checked,
204
- disabled: this.disabled,
205
- required: this.required,
206
- invalid: this.invalid
207
- });
208
- }
209
- /**
210
- * Removes the event listener when the checkbox is disconnected.
211
- */
85
+ this.setAriaState({ role: "switch", checked: this.checked, disabled: this.disabled, required: this.required, invalid: this.invalid });
86
+ }
212
87
  beforeDisconnect() {
213
- event.removeElement(this.input);
88
+ t.removeElement(this.input);
214
89
  }
215
90
  }
216
- _internalValue = new WeakMap();
217
- Toggle.define("wje-toggle", Toggle);
91
+ _e = new WeakMap();
92
+ a.define("wje-toggle", a);
218
93
  export {
219
- Toggle as default
94
+ a as default
220
95
  };
221
96
  //# sourceMappingURL=wje-toggle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wje-toggle.js","sources":["../packages/wje-toggle/toggle.element.js","../packages/wje-toggle/toggle.js"],"sourcesContent":["import { FormAssociatedElement } from '../internals/form-associated-element.js';\nimport { event } from '../utils/event.js';\n\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Toggle` is a custom web component that represents a toggle input.\n * @summary This element represents a toggle input.\n * @documentation https://elements.webjet.sk/components/toggle\n * @status stable\n * @augments {FormAssociatedElement}\n * @csspart native - The native toggle wrapper.\n * @csspart input - The toggle input.\n * @csspart toggle - The toggle part.\n * @slot - The default slot for the toggle.\n * @cssproperty [--wje-toggle-color-base=var(--wje-color-contrast-3)] - The base background color of the toggle. Defines the default background color when the toggle is in an unselected state.\n * @cssproperty [--wje-toggle-width=30px] - The overall width of the toggle switch. Determines how wide the toggle component appears.\n * @cssproperty [--wje-toggle-height=18px] - The overall height of the toggle switch. Specifies how tall the toggle component appears.\n * @cssproperty [--wje-toggle-border-radius=50px] - The border radius of the toggle. Controls how rounded the corners of the toggle are.\n * @cssproperty [--wje-toggle-handle-width=14px] - The width of the toggle handle (knob). Determines the size of the handle for user interaction.\n * @cssproperty [--wje-toggle-handle-height=14px] - The height of the toggle handle (knob). Specifies the vertical size of the handle.\n * @cssproperty [--wje-toggle-handle-border-radius=9px] - The border radius of the toggle handle. Controls how rounded the handle is.\n * @cssproperty [--wje-toggle-handle-color=#fff] - The color of the toggle handle. Accepts any valid CSS color, such as `hex`, `rgb`, or `css variable`.\n * @cssproperty [--wje-toggle-handle-shadow=1px 0 1px 0.5px rgba(0,0,0,0.12), 2px 4px 6px rgba(0,0,0,0.2)] - The shadow applied to the toggle handle. Adds a subtle shadow effect for better visual clarity.\n * @cssproperty [--wje-toggle-handle-shadow-checked=1px 1px 0 rgba(0,0,0,0.08), -3px 3px 6px rgba(0,0,0,0.3)] - The shadow applied to the toggle handle when it is in the checked (on) state. Provides visual feedback to indicate the toggle state.\n * @cssproperty [--wje-toggle-duration=250ms] - The duration of the toggle animation in milliseconds. Controls how long the toggle animation lasts during state changes.\n * @cssproperty [--wje-toggle-curve=cubic-bezier(.4,0,.2,1)] - The easing curve used for the toggle animation. Defines the speed curve for the animation, enhancing the user experience with smooth transitions.\n * @tag wje-toggle\n */\n\nexport default class Toggle extends FormAssociatedElement {\n #internalValue;\n\n constructor() {\n super();\n\n this.invalid = false;\n this.pristine = true;\n }\n\n /**\n * Setter for the value attribute.\n * @param {string} value The value to set.\n */\n set value(value) {\n this.#internalValue = value;\n if (this.input) {\n this.input.value = value;\n }\n }\n\n /**\n * Getter for the value attribute.\n * @returns {string} The value of the attribute.\n */\n get value() {\n return this.#internalValue ?? this.getAttribute('value') ?? 'on';\n }\n\n /**\n * Getter for the customErrorDisplay attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get customErrorDisplay() {\n return this.hasAttribute('custom-error-display');\n }\n\n /**\n * Getter for the validateOnChange attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get validateOnChange() {\n return this.hasAttribute('validate-on-change');\n }\n\n /**\n * 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 * 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 * Set checked attribute.\n * @param {boolean} value true if the toggle is checked, false otherwise\n */\n set checked(value) {\n if (value) {\n this.setAttribute('checked', '');\n this.internals.setFormValue(this.value); // len ak je checked\n } else {\n this.removeAttribute('checked');\n this.internals.setFormValue(null); // ak nie je checked, nič sa neposiela\n }\n if (this.input) {\n this.input.checked = value;\n }\n }\n\n /**\n * Get checked attribute.\n * @returns {boolean} true if the toggle is checked, false otherwise\n */\n get checked() {\n return this.hasAttribute('checked');\n }\n\n static get cssStyleSheet() {\n return styles;\n }\n\n static get observedAttributes() {\n return ['checked', 'disabled', 'required'];\n }\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.#internalValue;\n this.pristine = false;\n }\n this.syncAria();\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n if (!this.input) return;\n if (name === 'checked') {\n const isChecked = this.hasAttribute('checked');\n this.input.checked = isChecked;\n // Reflect into form value\n if (isChecked) {\n this.internals.setFormValue(this.value);\n } else {\n this.internals.setFormValue(null);\n }\n } else if (name === 'disabled') {\n this.input.disabled = this.hasAttribute('disabled');\n } else if (name === 'indeterminate') {\n this.input.indeterminate = this.hasAttribute('indeterminate');\n } else if (name === 'value') {\n // keep payload in sync; do not toggle checked here\n this.#internalValue = newValue ?? undefined;\n this.input.value = this.value;\n // If currently checked, update the submitted payload\n if (this.input.checked) {\n this.internals.setFormValue(this.value);\n }\n }\n this.syncAria();\n }\n\n draw() {\n const fragment = document.createDocumentFragment();\n\n const native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-toggle');\n\n const input = document.createElement('input');\n input.setAttribute('part', 'input');\n input.type = 'checkbox';\n input.name = this.name;\n input.id = 'input';\n input.checked = this.hasAttribute('checked');\n input.disabled = this.hasAttribute('disabled');\n if (this.hasAttribute('required')) input.required = true;\n\n const label = document.createElement('label');\n label.setAttribute('for', 'input');\n\n const toggle = document.createElement('div');\n toggle.setAttribute('part', 'toggle');\n toggle.classList.add('label-wrapper');\n\n const text = document.createElement('div');\n text.classList.add('text');\n text.innerHTML = '<slot></slot>';\n\n // Error\n let errorSlot = document.createElement('slot');\n errorSlot.setAttribute('name', 'error');\n\n let error = document.createElement('div');\n error.setAttribute('slot', 'error');\n\n // APPEND\n if (this.placement === 'end') {\n native.classList.add('end');\n label.appendChild(text);\n label.appendChild(toggle);\n } else {\n label.appendChild(toggle);\n label.appendChild(text);\n }\n\n native.appendChild(input);\n native.appendChild(label);\n native.append(errorSlot);\n\n this.append(error);\n\n fragment.appendChild(native);\n\n this.input = input;\n\n return fragment;\n }\n\n afterDraw() {\n this.internals.setFormValue(this.checked ? this.value : null); // Set initial form value based on checked state\n this.syncAria();\n\n if (!this.disabled) {\n this.input.addEventListener('input', (e) => {\n this.validate();\n\n this.pristine = false;\n this.propagateValidation();\n\n this.indeterminate = false;\n this.checked = e.target.checked;\n this.syncAria();\n\n event.dispatchCustomEvent(this, 'wje-toggle:input');\n });\n\n this.input.addEventListener('change', (e) => {\n event.dispatchCustomEvent(this, 'wje-toggle:change');\n });\n\n this.addEventListener('invalid', (e) => {\n this.invalid = true;\n this.pristine = false;\n\n this.showInvalidMessage();\n });\n\n this.validate();\n\n if (this.invalid) {\n this.showInvalidMessage();\n }\n }\n }\n\n /**\n * Syncs ARIA attributes on the host element.\n */\n syncAria() {\n this.setAriaState({\n role: 'switch',\n checked: this.checked,\n disabled: this.disabled,\n required: this.required,\n invalid: this.invalid,\n });\n }\n\n /**\n * Removes the event listener when the checkbox is disconnected.\n */\n beforeDisconnect() {\n event.removeElement(this.input);\n }\n}\n","import Toggle from './toggle.element.js';\n\nexport default Toggle;\n\nToggle.define('wje-toggle', Toggle);\n"],"names":[],"mappings":";;;;;;;;;;;AA8Be,MAAM,eAAe,sBAAsB;AAAA,EAGtD,cAAc;AACV,UAAK;AAHT;AAKI,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AAA,MAC3B,CAAC;AAED,WAAK,SAAQ;AAEb,UAAI,KAAK,SAAS;AACd,aAAK,mBAAkB;AAAA,MAC3B;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAKA,WAAW;AACP,SAAK,aAAa;AAAA,MACd,MAAM;AAAA,MACN,SAAS,KAAK;AAAA,MACd,UAAU,KAAK;AAAA,MACf,UAAU,KAAK;AAAA,MACf,SAAS,KAAK;AAAA,IAC1B,CAAS;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,mBAAmB;AACf,UAAM,cAAc,KAAK,KAAK;AAAA,EAClC;AACJ;AAxPI;AC3BJ,OAAO,OAAO,cAAc,MAAM;"}
1
+ {"version":3,"file":"wje-toggle.js","sources":["../packages/wje-toggle/toggle.element.js","../packages/wje-toggle/toggle.js"],"sourcesContent":["import { FormAssociatedElement } from '../internals/form-associated-element.js';\nimport { event } from '../utils/event.js';\n\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Toggle` is a custom web component that represents a toggle input.\n * @summary This element represents a toggle input.\n * @documentation https://elements.webjet.sk/components/toggle\n * @status stable\n * @augments {FormAssociatedElement}\n * @csspart native - The native toggle wrapper.\n * @csspart input - The toggle input.\n * @csspart toggle - The toggle part.\n * @slot - The default slot for the toggle.\n * @cssproperty [--wje-toggle-color-base=var(--wje-color-contrast-3)] - The base background color of the toggle. Defines the default background color when the toggle is in an unselected state.\n * @cssproperty [--wje-toggle-width=30px] - The overall width of the toggle switch. Determines how wide the toggle component appears.\n * @cssproperty [--wje-toggle-height=18px] - The overall height of the toggle switch. Specifies how tall the toggle component appears.\n * @cssproperty [--wje-toggle-border-radius=50px] - The border radius of the toggle. Controls how rounded the corners of the toggle are.\n * @cssproperty [--wje-toggle-handle-width=14px] - The width of the toggle handle (knob). Determines the size of the handle for user interaction.\n * @cssproperty [--wje-toggle-handle-height=14px] - The height of the toggle handle (knob). Specifies the vertical size of the handle.\n * @cssproperty [--wje-toggle-handle-border-radius=9px] - The border radius of the toggle handle. Controls how rounded the handle is.\n * @cssproperty [--wje-toggle-handle-color=#fff] - The color of the toggle handle. Accepts any valid CSS color, such as `hex`, `rgb`, or `css variable`.\n * @cssproperty [--wje-toggle-handle-shadow=1px 0 1px 0.5px rgba(0,0,0,0.12), 2px 4px 6px rgba(0,0,0,0.2)] - The shadow applied to the toggle handle. Adds a subtle shadow effect for better visual clarity.\n * @cssproperty [--wje-toggle-handle-shadow-checked=1px 1px 0 rgba(0,0,0,0.08), -3px 3px 6px rgba(0,0,0,0.3)] - The shadow applied to the toggle handle when it is in the checked (on) state. Provides visual feedback to indicate the toggle state.\n * @cssproperty [--wje-toggle-duration=250ms] - The duration of the toggle animation in milliseconds. Controls how long the toggle animation lasts during state changes.\n * @cssproperty [--wje-toggle-curve=cubic-bezier(.4,0,.2,1)] - The easing curve used for the toggle animation. Defines the speed curve for the animation, enhancing the user experience with smooth transitions.\n * @tag wje-toggle\n */\n\nexport default class Toggle extends FormAssociatedElement {\n #internalValue;\n\n constructor() {\n super();\n\n this.invalid = false;\n this.pristine = true;\n }\n\n /**\n * Setter for the value attribute.\n * @param {string} value The value to set.\n */\n set value(value) {\n this.#internalValue = value;\n if (this.input) {\n this.input.value = value;\n }\n }\n\n /**\n * Getter for the value attribute.\n * @returns {string} The value of the attribute.\n */\n get value() {\n return this.#internalValue ?? this.getAttribute('value') ?? 'on';\n }\n\n /**\n * Getter for the customErrorDisplay attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get customErrorDisplay() {\n return this.hasAttribute('custom-error-display');\n }\n\n /**\n * Getter for the validateOnChange attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get validateOnChange() {\n return this.hasAttribute('validate-on-change');\n }\n\n /**\n * 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 * 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 * Set checked attribute.\n * @param {boolean} value true if the toggle is checked, false otherwise\n */\n set checked(value) {\n if (value) {\n this.setAttribute('checked', '');\n this.internals.setFormValue(this.value); // len ak je checked\n } else {\n this.removeAttribute('checked');\n this.internals.setFormValue(null); // ak nie je checked, nič sa neposiela\n }\n if (this.input) {\n this.input.checked = value;\n }\n }\n\n /**\n * Get checked attribute.\n * @returns {boolean} true if the toggle is checked, false otherwise\n */\n get checked() {\n return this.hasAttribute('checked');\n }\n\n static get cssStyleSheet() {\n return styles;\n }\n\n static get observedAttributes() {\n return ['checked', 'disabled', 'required'];\n }\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.#internalValue;\n this.pristine = false;\n }\n this.syncAria();\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n if (!this.input) return;\n if (name === 'checked') {\n const isChecked = this.hasAttribute('checked');\n this.input.checked = isChecked;\n // Reflect into form value\n if (isChecked) {\n this.internals.setFormValue(this.value);\n } else {\n this.internals.setFormValue(null);\n }\n } else if (name === 'disabled') {\n this.input.disabled = this.hasAttribute('disabled');\n } else if (name === 'indeterminate') {\n this.input.indeterminate = this.hasAttribute('indeterminate');\n } else if (name === 'value') {\n // keep payload in sync; do not toggle checked here\n this.#internalValue = newValue ?? undefined;\n this.input.value = this.value;\n // If currently checked, update the submitted payload\n if (this.input.checked) {\n this.internals.setFormValue(this.value);\n }\n }\n this.syncAria();\n }\n\n draw() {\n const fragment = document.createDocumentFragment();\n\n const native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-toggle');\n\n const input = document.createElement('input');\n input.setAttribute('part', 'input');\n input.type = 'checkbox';\n input.name = this.name;\n input.id = 'input';\n input.checked = this.hasAttribute('checked');\n input.disabled = this.hasAttribute('disabled');\n if (this.hasAttribute('required')) input.required = true;\n\n const label = document.createElement('label');\n label.setAttribute('for', 'input');\n\n const toggle = document.createElement('div');\n toggle.setAttribute('part', 'toggle');\n toggle.classList.add('label-wrapper');\n\n const text = document.createElement('div');\n text.classList.add('text');\n text.innerHTML = '<slot></slot>';\n\n // Error\n let errorSlot = document.createElement('slot');\n errorSlot.setAttribute('name', 'error');\n\n let error = document.createElement('div');\n error.setAttribute('slot', 'error');\n\n // APPEND\n if (this.placement === 'end') {\n native.classList.add('end');\n label.appendChild(text);\n label.appendChild(toggle);\n } else {\n label.appendChild(toggle);\n label.appendChild(text);\n }\n\n native.appendChild(input);\n native.appendChild(label);\n native.append(errorSlot);\n\n this.append(error);\n\n fragment.appendChild(native);\n\n this.input = input;\n\n return fragment;\n }\n\n afterDraw() {\n this.internals.setFormValue(this.checked ? this.value : null); // Set initial form value based on checked state\n this.syncAria();\n\n if (!this.disabled) {\n this.input.addEventListener('input', (e) => {\n this.validate();\n\n this.pristine = false;\n this.propagateValidation();\n\n this.indeterminate = false;\n this.checked = e.target.checked;\n this.syncAria();\n\n event.dispatchCustomEvent(this, 'wje-toggle:input');\n });\n\n this.input.addEventListener('change', (e) => {\n event.dispatchCustomEvent(this, 'wje-toggle:change');\n });\n\n this.addEventListener('invalid', (e) => {\n this.invalid = true;\n this.pristine = false;\n\n this.showInvalidMessage();\n });\n\n this.validate();\n\n if (this.invalid) {\n this.showInvalidMessage();\n }\n }\n }\n\n /**\n * Syncs ARIA attributes on the host element.\n */\n syncAria() {\n this.setAriaState({\n role: 'switch',\n checked: this.checked,\n disabled: this.disabled,\n required: this.required,\n invalid: this.invalid,\n });\n }\n\n /**\n * Removes the event listener when the checkbox is disconnected.\n */\n beforeDisconnect() {\n event.removeElement(this.input);\n }\n}\n","import Toggle from './toggle.element.js';\n\nexport default Toggle;\n\nToggle.define('wje-toggle', Toggle);\n"],"names":["Toggle","FormAssociatedElement","constructor","super","internalValue","this","invalid","pristine","value","input","getAttribute","customErrorDisplay","hasAttribute","validateOnChange","setAttribute","defaultValue","internals","setFormValue","removeAttribute","checked","cssStyleSheet","observedAttributes","isShadowRoot","syncAria","name","oldValue","newValue","isChecked","disabled","indeterminate","draw","fragment","document","createDocumentFragment","native","createElement","classList","add","type","id","required","label","toggle","text","innerHTML","errorSlot","error","placement","appendChild","append","afterDraw","addEventListener","e","validate","propagateValidation","target","event","dispatchCustomEvent","showInvalidMessage","setAriaState","role","beforeDisconnect","removeElement","define"],"mappings":";;;;;;;;;;AA8Be,MAAMA,UAAeC;EAGhC,cAAAC;AACIC,UAAAA;AAHJC;AAKIC,SAAKC,UAAAA,OACLD,KAAKE,WAAAA;AAAAA,EACT;AAAA,EAMA,IAAA,MAAUC;AACNH,uBAAAA,IAAsBG,KAClBH,KAAKI,UACLJ,KAAKI,MAAMD,QAAQA;AAAAA,EAE3B;AAAA,EAMA,IAAA,QAAIA;AACA,WAAOH,0BAAuBA,KAAKK,aAAa,OAAA,KAAY;AAAA,EAChE;AAAA,EAMA,yBAAIC;AACA,WAAON,KAAKO,aAAa,sBAAA;AAAA,EAC7B;AAAA,EAMA,uBAAIC;AACA,WAAOR,KAAKO,aAAa,oBAAA;AAAA,EAC7B;AAAA,EAQA,iBAAiBJ,IAAAA;AACbH,SAAKS,aAAa,SAASN,EAAAA;AAAAA,EAC/B;AAAA,EASA,IAAA,eAAIO;AACA,WAAOV,KAAKK,aAAa,OAAA,KAAY;AAAA,EACzC;AAAA,EAMA,IAAA,QAAYF,IAAAA;AACJA,IAAAA,MACAH,KAAKS,aAAa,WAAW,EAAA,GAC7BT,KAAKW,UAAUC,aAAaZ,KAAKG,WAEjCH,KAAKa,gBAAgB,SAAA,GACrBb,KAAKW,UAAUC,aAAa,QAE5BZ,KAAKI,UACLJ,KAAKI,MAAMU,UAAUX;AAAAA,EAE7B;AAAA,EAMA,IAAA,UAAIW;AACA,WAAOd,KAAKO,aAAa,SAAA;AAAA,EAC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