wj-elements 0.1.154 → 0.1.156

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 (92) hide show
  1. package/dist/dark.css +8 -5
  2. package/dist/light.css +9 -6
  3. package/dist/packages/utils/event.d.ts +1 -0
  4. package/dist/packages/utils/permissions-api.d.ts +2 -2
  5. package/dist/packages/wje-accordion/accordion.element.d.ts +2 -2
  6. package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +1 -1
  7. package/dist/packages/wje-animation/animation.element.d.ts +1 -1
  8. package/dist/packages/wje-aside/aside.element.d.ts +1 -1
  9. package/dist/packages/wje-avatar/avatar.element.d.ts +3 -3
  10. package/dist/packages/wje-badge/badge.element.d.ts +1 -1
  11. package/dist/packages/wje-breadcrumb/breadcrumb.element.d.ts +2 -2
  12. package/dist/packages/wje-breadcrumbs/breadcrumbs.element.d.ts +3 -3
  13. package/dist/packages/wje-button/button.element.d.ts +9 -5
  14. package/dist/packages/wje-button-group/button-group.element.d.ts +2 -2
  15. package/dist/packages/wje-card/card.element.d.ts +1 -1
  16. package/dist/packages/wje-card-content/card-content.element.d.ts +1 -1
  17. package/dist/packages/wje-card-controls/card-controls.element.d.ts +1 -1
  18. package/dist/packages/wje-card-header/card-header.element.d.ts +1 -1
  19. package/dist/packages/wje-card-subtitle/card-subtitle.element.d.ts +1 -1
  20. package/dist/packages/wje-card-title/card-title.element.d.ts +1 -1
  21. package/dist/packages/wje-carousel/carousel.element.d.ts +2 -2
  22. package/dist/packages/wje-color-picker/color-picker.element.d.ts +4 -4
  23. package/dist/packages/wje-container/container.element.d.ts +1 -1
  24. package/dist/packages/wje-dialog/dialog.element.d.ts +2 -2
  25. package/dist/packages/wje-dropdown/dropdown.element.d.ts +6 -7
  26. package/dist/packages/wje-element/element.d.ts +11 -9
  27. package/dist/packages/wje-file-upload/file-upload.element.d.ts +2 -2
  28. package/dist/packages/wje-file-upload-item/file-upload-item.element.d.ts +1 -1
  29. package/dist/packages/wje-footer/footer.element.d.ts +1 -1
  30. package/dist/packages/wje-format-digital/format-digital.element.d.ts +1 -1
  31. package/dist/packages/wje-header/header.element.d.ts +1 -1
  32. package/dist/packages/wje-icon/icon.element.d.ts +1 -1
  33. package/dist/packages/wje-icon-picker/icon-picker.element.d.ts +1 -1
  34. package/dist/packages/wje-img/img.element.d.ts +6 -5
  35. package/dist/packages/wje-img-comparer/img-comparer.element.d.ts +1 -1
  36. package/dist/packages/wje-infinite-scroll/infinite-scroll.element.d.ts +3 -3
  37. package/dist/packages/wje-input-file/input-file.element.d.ts +1 -1
  38. package/dist/packages/wje-item/item.element.d.ts +1 -1
  39. package/dist/packages/wje-kanban/kanban.element.d.ts +3 -3
  40. package/dist/packages/wje-label/label.element.d.ts +1 -1
  41. package/dist/packages/wje-level-indicator/level-indicator.element.d.ts +2 -2
  42. package/dist/packages/wje-main/main.element.d.ts +1 -1
  43. package/dist/packages/wje-menu/menu.element.d.ts +1 -1
  44. package/dist/packages/wje-menu-button/menu-button.element.d.ts +1 -1
  45. package/dist/packages/wje-menu-label/menu-label.element.d.ts +1 -1
  46. package/dist/packages/wje-option/option.element.d.ts +1 -1
  47. package/dist/packages/wje-options/options.element.d.ts +1 -1
  48. package/dist/packages/wje-pagination/pagination.element.d.ts +5 -5
  49. package/dist/packages/wje-popup/popup.element.d.ts +1 -10
  50. package/dist/packages/wje-progress-bar/progress-bar.element.d.ts +1 -1
  51. package/dist/packages/wje-radio/radio.element.d.ts +1 -1
  52. package/dist/packages/wje-rate/rate.element.d.ts +3 -3
  53. package/dist/packages/wje-relative-time/relative-time.element.d.ts +1 -1
  54. package/dist/packages/wje-reorder/reorder.element.d.ts +1 -1
  55. package/dist/packages/wje-route/route.element.d.ts +1 -1
  56. package/dist/packages/wje-router/router.element.d.ts +1 -1
  57. package/dist/packages/wje-router-link/router-link.element.d.ts +1 -1
  58. package/dist/packages/wje-select/select.element.d.ts +2 -2
  59. package/dist/packages/wje-slider/slider.element.d.ts +1 -1
  60. package/dist/packages/wje-split-view/split-view.element.d.ts +1 -1
  61. package/dist/packages/wje-textarea/textarea.element.d.ts +1 -1
  62. package/dist/packages/wje-tooltip/tooltip.element.d.ts +1 -0
  63. package/dist/packages/wje-tree-item/tree-item.element.d.ts +2 -2
  64. package/dist/{popup.element-tyYxow0p.js → popup.element-AaduHP2r.js} +44 -44
  65. package/dist/{popup.element-tyYxow0p.js.map → popup.element-AaduHP2r.js.map} +1 -1
  66. package/dist/wje-button.js +30 -0
  67. package/dist/wje-button.js.map +1 -1
  68. package/dist/wje-color-picker.js +8 -1
  69. package/dist/wje-color-picker.js.map +1 -1
  70. package/dist/wje-dialog.js +1 -3
  71. package/dist/wje-dialog.js.map +1 -1
  72. package/dist/wje-dropdown.js +32 -14
  73. package/dist/wje-dropdown.js.map +1 -1
  74. package/dist/wje-element.js +114 -59
  75. package/dist/wje-element.js.map +1 -1
  76. package/dist/wje-icon-picker.js +1 -1
  77. package/dist/wje-img.js +9 -4
  78. package/dist/wje-img.js.map +1 -1
  79. package/dist/wje-master.js +1 -1
  80. package/dist/wje-menu-item.js +4 -5
  81. package/dist/wje-menu-item.js.map +1 -1
  82. package/dist/wje-pagination.js +2 -4
  83. package/dist/wje-pagination.js.map +1 -1
  84. package/dist/wje-popup.js +1 -1
  85. package/dist/wje-select.js +1 -1
  86. package/dist/wje-sliding-container.js +2 -2
  87. package/dist/wje-sliding-container.js.map +1 -1
  88. package/dist/wje-tooltip.js +11 -0
  89. package/dist/wje-tooltip.js.map +1 -1
  90. package/package.json +7 -12
  91. package/dist/packages/wje-accordion/accordion.test.d.ts +0 -0
  92. package/dist/packages/wje-color-picker/color-picker.test.d.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"wje-pagination.js","sources":["../packages/wje-pagination/service/service.js","../packages/wje-pagination/pagination.element.js","../packages/wje-pagination/pagination.js"],"sourcesContent":["/**\n * Paginates items based on the total number of items, current page, page size, and maximum number of pages to display.\n * @param {number} totalItems The total number of items to paginate.\n * @param {number} [currentPage] The current page number (default is 1).\n * @param {number} [pageSize] The number of items per page (default is 10).\n * @param {number} [maxPages] The maximum number of pages to display in the pagination control (default is 5).\n * @returns {object} An object containing pagination details including total items, current page, page size, total pages, start/end page, start/end index, and the pages array.\n */\nexport function paginate(totalItems, currentPage = 1, pageSize = 10, maxPages = 5) {\n // Calculate total pages\n const totalPages = Math.ceil(totalItems / pageSize);\n\n // Ensure current page is within valid range\n if (currentPage < 1) {\n currentPage = 1;\n } else if (currentPage > totalPages) {\n currentPage = totalPages;\n }\n\n let startPage;\n let endPage;\n\n const pagesNearEnd = maxPages + 1; // Define how close to the end we switch back to 5 pages 4\n\n const boundary = pagesNearEnd + 3;\n\n if(totalPages > boundary) {\n if (currentPage < pagesNearEnd) {\n // If in the first 4 pages, show up to 5 pages\n startPage = 1;\n endPage = Math.min(pagesNearEnd + 1, totalPages); //5\n } else if (currentPage >= totalPages - pagesNearEnd) {\n // If within 4 pages from the end, show last 5 pages\n startPage = Math.max(totalPages - pagesNearEnd, 1); //4\n endPage = totalPages;\n } else {\n const halfPages = Math.floor(maxPages / 2);\n // Otherwise, only show 3 pages (current, previous, next)\n startPage = currentPage - halfPages + 1;\n endPage = maxPages % 2 === 1 ? currentPage + halfPages + 1 : currentPage + halfPages - 1;\n }\n } else {\n startPage = 1;\n endPage = totalPages;\n }\n\n // Calculate start and end item indexes\n const startIndex = (currentPage - 1) * pageSize;\n const endIndex = Math.min(startIndex + pageSize - 1, totalItems - 1);\n\n // Create an array of pages to display\n const pages = Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i);\n\n // Return object with all pager properties (preserving original format)\n return {\n boundary: boundary,\n currentPage: currentPage,\n endIndex: endIndex,\n endPage: endPage,\n totalPages: totalPages,\n pages: pages,\n pageSize: pageSize,\n startIndex: startIndex,\n startPage: startPage,\n totalItems: totalItems,\n };\n}\n","import { Localizer } from '../utils/localize.js';\nimport { default as WJElement, event } from '../wje-element/element.js';\nimport { paginate } from './service/service.js';\nimport Icon from '../wje-icon/icon.js';\nimport Button from '../wje-button/button.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents the Pagination component for navigating through paginated content and dynamically updating navigation elements based on attributes like the number of items, page size, etc. Extends the WJElement class.\n * @documentation https://elements.webjet.sk/components/pagination\n * @status stable\n * @augments WJElement\n * @dependency wje-icon, wje-button\n * @csspart native - The wrapper element for the pagination component.\n */\nexport default class Pagination extends WJElement {\n /**\n * Creates an instance of Pagination.\n */\n constructor() {\n super();\n this.localizer = new Localizer(this);\n\n this._paginateObj = null;\n }\n\n /**\n * Sets the value of the 'page' attribute for the object.\n * @param {string} value The value to set for the 'page' attribute.\n */\n set page(value) {\n this.setAttribute('page', value);\n }\n\n /**\n * Retrieves the current page number as a numeric value.\n * @returns {number} The current page number. Returns 0 if the attribute 'page' is not set or is not a numeric value.\n */\n get page() {\n return +this.getAttribute('page') || 0;\n }\n\n /**\n * Sets the maximum number of pages.\n * Updates the 'max-pages' attribute with the provided value.\n * @param {number|string} value The maximum number of pages to set. Can be a number or a parsable string representing a number.\n */\n set maxPages(value) {\n this.setAttribute('max-pages', value);\n }\n\n /**\n * Gets the maximum number of pages.\n * This getter retrieves the value of the \"max-pages\" attribute from the element.\n * If the attribute is not set or is invalid, it defaults to 3.\n * @returns {number} The maximum number of pages as a numeric value.\n */\n get maxPages() {\n return +this.getAttribute('max-pages') || 3;\n }\n\n /**\n * Sets the `pageSize` attribute to the specified value.\n * @param {number|string} value The desired page size value. This can be a number or a string representation of the size.\n */\n set pageSize(value) {\n this.setAttribute('page-size', value);\n }\n\n /**\n * Retrieves the value of the 'page-size' attribute and converts it to a number.\n * If the attribute is not set or is invalid, returns the default value of 3.\n * @returns {number} The numeric value of the 'page-size' attribute or the default value of 3.\n */\n get pageSize() {\n return +this.getAttribute('page-size') || 3;\n }\n\n /**\n * Sets the total number of items.\n * @param {number} value The new total number of items to set.\n */\n set totalItems(value) {\n this.setAttribute('total-items', value);\n }\n\n /**\n * Retrieves the total number of items represented by the 'total-items' attribute.\n * @returns {number} The total number of items. Defaults to 0 if the attribute is not set or is invalid.\n */\n get totalItems() {\n return +this.getAttribute('total-items') || 0;\n }\n\n /**\n * Sets the visibility of the first button based on the provided value.\n * Adds the 'show-first-button' attribute when the value is truthy, and removes it otherwise.\n * @param {boolean} value Determines whether to show the first button. If true, the 'show-first-button' attribute is added; if false, it is removed.\n */\n set showFirstButton(value) {\n this.removeAttribute('show-first-button');\n\n if (value) {\n this.setAttribute('show-first-button', '');\n }\n }\n\n /**\n * Determines whether the 'show-first-button' attribute is present on the element.\n * @returns {boolean} True if the 'show-first-button' attribute is set; otherwise, false.\n */\n get showFirstButton() {\n return this.hasAttribute('show-first-button');\n }\n\n /**\n * Sets the visibility of the \"last\" button. This method controls the presence\n * or absence of the \"show-last-button\" attribute based on the provided value.\n * @param {boolean} value A boolean value indicating whether to show the \"last\" button.\n * If true, the \"show-last-button\" attribute is added;\n * if false, the attribute is removed.\n */\n set showLastButton(value) {\n this.removeAttribute('show-last-button');\n\n if (value) {\n this.setAttribute('show-last-button', '');\n }\n }\n\n /**\n * Determines if the 'show-last-button' attribute is present on the element.\n * @returns {boolean} True if the 'show-last-button' attribute is present, otherwise false.\n */\n get showLastButton() {\n return this.hasAttribute('show-last-button');\n }\n\n /**\n * Sets the pagination object by calculating the pagination details\n * based on the total items, current page, page size, and maximum pages.\n * @param {object} value The value to set the pagination object. The pagination details are computed internally.\n */\n set paginateObj(value) {\n this._paginateObj = value;\n }\n\n /**\n * Retrieves the pagination object used for managing paginated data.\n * @returns {object} The pagination object containing details and functionality for paginating data.\n */\n get paginateObj() {\n return this._paginateObj;\n }\n\n /**\n * Sets the 'round' attribute on the element. If the provided value is truthy,\n * the 'round' attribute is added. If the value is falsy, the attribute is removed.\n * @param {boolean} value A boolean value determining whether to add or remove the 'round' attribute.\n */\n set round(value) {\n this.removeAttribute('round');\n\n if (value) {\n this.setAttribute('round', '');\n }\n }\n\n /**\n * Retrieves the value of the 'round' attribute for the current element.\n * @returns {boolean} A boolean indicating whether the 'round' attribute is present on the element.\n */\n get round() {\n return this.hasAttribute('round');\n }\n\n /**\n * Sets the `show-info` attribute on the element based on the provided value.\n * @param {boolean} value A boolean indicating whether to add or remove the `show-info` attribute.\n */\n set showInfo(value) {\n this.removeAttribute('show-info');\n\n if (value) {\n this.setAttribute('show-info', '');\n }\n }\n\n /**\n * Retrieves the value of the 'show-info' attribute.\n * Checks if the 'show-info' attribute is present on the element.\n * @returns {boolean} True if the 'show-info' attribute is present, otherwise false.\n */\n get showInfo() {\n return this.hasAttribute('show-info');\n }\n\n /**\n * Dependencies of the Button element.\n * @type {object}\n */\n dependencies = {\n 'wje-icon': Icon,\n 'wje-button': Button,\n };\n\n className = 'Pagination';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes attribute of the input element.\n * @returns {Array} The attributes to observe for changes.\n */\n static get observedAttributes() {\n return ['page', 'total-items'];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n async beforeDraw() {\n this.paginateObj = await paginate(this.totalItems, this.page, this.pageSize, this.maxPages)\n }\n\n /**\n * Creates a document fragment, appends a new slot element to it, and returns the fragment.\n * @returns {DocumentFragment} A document fragment containing a slot element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-pagination');\n\n native.append(this.htmlPagination());\n\n fragment.append(native);\n\n return fragment;\n }\n\n /**\n * Creates a pagination control for navigating between pages of content.\n * This method generates and returns a document fragment containing pagination controls, including buttons for navigating to the first, previous, next, and last pages, as well as optional informational text about the current set of displayed items and total number of items.\n * @returns {DocumentFragment} A document fragment containing the pagination controls.\n */\n htmlPagination() {\n let fragment = document.createDocumentFragment();\n\n let info = document.createElement('div');\n info.classList.add('info');\n info.innerHTML = `${this.paginateObj.startIndex + 1} - ${this.paginateObj.endIndex + 1} ${this.localizer.translate('wj.pagination.of')} ${this.totalItems}`;\n\n let pagination = document.createElement('div');\n pagination.classList.add('pages');\n\n const button = document.createElement('wje-button');\n button.setAttribute('fill', 'link');\n if (this.round) button.setAttribute('round', '');\n\n // First button\n let firstButton = button.cloneNode(true);\n firstButton.title = this.localizer.translate('wj.pagination.first');\n firstButton.innerHTML = `<wje-icon name=\"chevron-left-pipe\" slot=\"icon-only\"></wje-icon>`;\n firstButton.addEventListener('wje-button:click', (e) => this.pageClickAction(e, 0));\n\n // Previous button\n const prevButton = button.cloneNode(true);\n prevButton.title = this.localizer.translate('wj.pagination.prev');\n prevButton.innerHTML = `<wje-icon name=\"chevron-left\" slot=\"icon-only\"></wje-icon>`;\n if(this.page === 0)\n prevButton.disabled = true;\n prevButton.addEventListener('wje-button:click', (e) => this.pageClickAction(e, this.page - 1));\n\n // Next button\n const nextButton = button.cloneNode(true);\n nextButton.title = this.localizer.translate('wj.pagination.next');\n nextButton.innerHTML = `<wje-icon name=\"chevron-right\" slot=\"icon-only\"></wje-icon>`;\n if(this.page + 1 >= this.paginateObj.totalPages)\n nextButton.disabled = true;\n nextButton.addEventListener('wje-button:click', (e) => this.pageClickAction(e, this.page + 1));\n\n // Last button\n let lastButton = button.cloneNode(true);\n lastButton.title = this.localizer.translate('wj.pagination.last');\n lastButton.innerHTML = `<wje-icon name=\"chevron-right-pipe\" slot=\"icon-only\"></wje-icon>`;\n lastButton.disabled = this.paginateObj.endIndex + 1 >= this.totalItems;\n lastButton.addEventListener('wje-button:click', (e) =>\n this.pageClickAction(e, this.paginateObj.totalPages - 1)\n );\n\n if (this.showFirstButton) pagination.appendChild(firstButton);\n pagination.appendChild(prevButton);\n pagination.appendChild(this.htmlStackButtons(this.paginateObj));\n pagination.appendChild(nextButton);\n if (this.showLastButton) pagination.appendChild(lastButton);\n\n if (this.showInfo) fragment.appendChild(info);\n fragment.appendChild(pagination);\n\n return fragment;\n }\n\n /**\n * Creates and returns a DocumentFragment containing a series of buttons for pagination purposes,\n * based on the provided pagination object.\n * @param {object} paginateObj An object containing pagination details.\n * @param {number} paginateObj.currentPage The current active page index (1-based).\n * @param {Array<number>} paginateObj.pages An array of page numbers to display in the pagination.\n * @param {number} paginateObj.totalPages Total number of pages available for pagination.\n * @returns {DocumentFragment} A DocumentFragment containing the buttons and additional pagination elements.\n */\n htmlStackButtons(paginateObj) {\n let fragment = document.createDocumentFragment();\n\n const button = document.createElement('wje-button');\n button.setAttribute('fill', 'link');\n if (this.round) button.setAttribute('round', '');\n\n let dots = document.createElement('span');\n dots.classList.add('dots');\n\n const first = button.cloneNode(true);\n first.textContent = '1';\n first.addEventListener('wje-button:click', (e) => this.pageClickAction(e, 0));\n\n const last = button.cloneNode(true);\n last.textContent = paginateObj.totalPages;\n last.addEventListener('wje-button:click', (e) => this.pageClickAction(e, paginateObj.totalPages - 1));\n\n if (paginateObj.currentPage >= this.maxPages + 1 && paginateObj.boundary < paginateObj.totalPages) {\n fragment.appendChild(first);\n fragment.appendChild(dots);\n }\n\n paginateObj.pages.forEach((page) => {\n let newButton = button.cloneNode(true);\n newButton.textContent = page;\n\n if (page - 1 === this.page) {\n newButton.removeAttribute('fill');\n } else {\n newButton.addEventListener('wje-button:click', (e) => this.pageClickAction(e, page - 1));\n }\n\n fragment.appendChild(newButton);\n });\n\n if ((paginateObj.pages.length === this.maxPages || paginateObj.currentPage < this.maxPages + 1) && paginateObj.boundary < paginateObj.totalPages) {\n fragment.appendChild(dots.cloneNode(true));\n fragment.appendChild(last);\n }\n\n return fragment;\n }\n\n /**\n * Handles the click action for pagination and updates the current page.\n * If the clicked page number is the same as the current page, no action is performed.\n * Otherwise, the current page is updated to the new page number, and a custom event\n * 'wje-pagination:page-change' is dispatched with the pagination object.\n * @param {Event} e The event triggered by the page click.\n * @param {number} page The page number that was clicked.\n */\n pageClickAction = (e, page) => {\n if (+page === this.page || this.page > this.paginateObj.totalPages) return;\n this.page = page;\n event.dispatchCustomEvent(this, 'wje-pagination:page-change', {page: page});\n };\n}\n\nPagination.define('wje-pagination', Pagination);\n","import Pagination from './pagination.element.js';\n\nexport default Pagination;\n\nPagination.define('wje-pagination', Pagination);\n"],"names":[],"mappings":";;;;;;;AAQO,SAAS,SAAS,YAAY,cAAc,GAAG,WAAW,IAAI,WAAW,GAAG;AAE/E,QAAM,aAAa,KAAK,KAAK,aAAa,QAAQ;AAGlD,MAAI,cAAc,GAAG;AACjB,kBAAc;AAAA,EACtB,WAAe,cAAc,YAAY;AACjC,kBAAc;AAAA,EACtB;AAEI,MAAI;AACJ,MAAI;AAEJ,QAAM,eAAe,WAAW;AAEhC,QAAM,WAAW,eAAe;AAEhC,MAAG,aAAa,UAAU;AACtB,QAAI,cAAc,cAAc;AAE5B,kBAAY;AACZ,gBAAU,KAAK,IAAI,eAAe,GAAG,UAAU;AAAA,IAC3D,WAAmB,eAAe,aAAa,cAAc;AAEjD,kBAAY,KAAK,IAAI,aAAa,cAAc,CAAC;AACjD,gBAAU;AAAA,IACtB,OAAe;AACH,YAAM,YAAY,KAAK,MAAM,WAAW,CAAC;AAEzC,kBAAY,cAAc,YAAY;AACtC,gBAAU,WAAW,MAAM,IAAI,cAAc,YAAY,IAAI,cAAc,YAAY;AAAA,IACnG;AAAA,EACA,OAAW;AACH,gBAAY;AACZ,cAAU;AAAA,EAClB;AAGI,QAAM,cAAc,cAAc,KAAK;AACvC,QAAM,WAAW,KAAK,IAAI,aAAa,WAAW,GAAG,aAAa,CAAC;AAGnE,QAAM,QAAQ,MAAM,KAAK,EAAE,QAAQ,UAAU,YAAY,EAAG,GAAE,CAAC,GAAG,MAAM,YAAY,CAAC;AAGrF,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACH;AACL;;ACnDe,MAAM,mBAAmB,UAAU;AAAA;AAAA;AAAA;AAAA,EAI9C,cA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a,SAAS,EAAE;AAE/C,QAAI,OAAO,SAAS,cAAc,MAAM;AACxC,SAAK,UAAU,IAAI,MAAM;AAEzB,UAAM,QAAQ,OAAO,UAAU,IAAI;AACnC,UAAM,cAAc;AACpB,UAAM,iBAAiB,oBAAoB,CAAC,MAAM,KAAK,gBAAgB,GAAG,CAAC,CAAC;AAE5E,UAAM,OAAO,OAAO,UAAU,IAAI;AAClC,SAAK,cAAc,YAAY;AAC/B,SAAK,iBAAiB,oBAAoB,CAAC,MAAM,KAAK,gBAAgB,GAAG,YAAY,aAAa,CAAC,CAAC;AAEpG,QAAI,YAAY,eAAe,KAAK,WAAW,KAAK,YAAY,WAAW,YAAY,YAAY;AAC/F,eAAS,YAAY,KAAK;AAC1B,eAAS,YAAY,IAAI;AAAA,IACrC;AAEQ,gBAAY,MAAM,QAAQ,CAAC,SAAS;AAChC,UAAI,YAAY,OAAO,UAAU,IAAI;AACrC,gBAAU,cAAc;AAExB,UAAI,OAAO,MAAM,KAAK,MAAM;AACxB,kBAAU,gBAAgB,MAAM;AAAA,MAChD,OAAmB;AACH,kBAAU,iBAAiB,oBAAoB,CAAC,MAAM,KAAK,gBAAgB,GAAG,OAAO,CAAC,CAAC;AAAA,MACvG;AAEY,eAAS,YAAY,SAAS;AAAA,IAC1C,CAAS;AAED,SAAK,YAAY,MAAM,WAAW,KAAK,YAAY,YAAY,cAAc,KAAK,WAAW,MAAM,YAAY,WAAW,YAAY,YAAY;AAC9I,eAAS,YAAY,KAAK,UAAU,IAAI,CAAC;AACzC,eAAS,YAAY,IAAI;AAAA,IACrC;AAEQ,WAAO;AAAA,EACf;AAeA;AAEA,WAAW,OAAO,kBAAkB,UAAU;AC5X9C,WAAW,OAAO,kBAAkB,UAAU;"}
1
+ {"version":3,"file":"wje-pagination.js","sources":["../packages/wje-pagination/service/service.js","../packages/wje-pagination/pagination.element.js","../packages/wje-pagination/pagination.js"],"sourcesContent":["/**\n * Paginates items based on the total number of items, current page, page size, and maximum number of pages to display.\n * @param {number} totalItems The total number of items to paginate.\n * @param {number} [currentPage] The current page number (default is 1).\n * @param {number} [pageSize] The number of items per page (default is 10).\n * @param {number} [maxPages] The maximum number of pages to display in the pagination control (default is 5).\n * @returns {object} An object containing pagination details including total items, current page, page size, total pages, start/end page, start/end index, and the pages array.\n */\nexport function paginate(totalItems, currentPage = 1, pageSize = 10, maxPages = 5) {\n // Calculate total pages\n const totalPages = Math.ceil(totalItems / pageSize);\n\n // Ensure current page is within valid range\n if (currentPage < 1) {\n currentPage = 1;\n } else if (currentPage > totalPages) {\n currentPage = totalPages;\n }\n\n let startPage;\n let endPage;\n\n const pagesNearEnd = maxPages + 1; // Define how close to the end we switch back to 5 pages 4\n\n const boundary = pagesNearEnd + 3;\n\n if (totalPages > boundary) {\n if (currentPage < pagesNearEnd) {\n // If in the first 4 pages, show up to 5 pages\n startPage = 1;\n endPage = Math.min(pagesNearEnd + 1, totalPages); //5\n } else if (currentPage >= totalPages - pagesNearEnd) {\n // If within 4 pages from the end, show last 5 pages\n startPage = Math.max(totalPages - pagesNearEnd, 1); //4\n endPage = totalPages;\n } else {\n const halfPages = Math.floor(maxPages / 2);\n // Otherwise, only show 3 pages (current, previous, next)\n startPage = currentPage - halfPages + 1;\n endPage = maxPages % 2 === 1 ? currentPage + halfPages + 1 : currentPage + halfPages - 1;\n }\n } else {\n startPage = 1;\n endPage = totalPages;\n }\n\n // Calculate start and end item indexes\n const startIndex = (currentPage - 1) * pageSize;\n const endIndex = Math.min(startIndex + pageSize - 1, totalItems - 1);\n\n // Create an array of pages to display\n const pages = Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i);\n\n // Return object with all pager properties (preserving original format)\n return {\n boundary: boundary,\n currentPage: currentPage,\n endIndex: endIndex,\n endPage: endPage,\n totalPages: totalPages,\n pages: pages,\n pageSize: pageSize,\n startIndex: startIndex,\n startPage: startPage,\n totalItems: totalItems,\n };\n}\n","import { Localizer } from '../utils/localize.js';\nimport { default as WJElement, event } from '../wje-element/element.js';\nimport { paginate } from './service/service.js';\nimport Icon from '../wje-icon/icon.js';\nimport Button from '../wje-button/button.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents the Pagination component for navigating through paginated content and dynamically updating navigation elements based on attributes like the number of items, page size, etc. Extends the WJElement class.\n * @documentation https://elements.webjet.sk/components/pagination\n * @status stable\n * @augments WJElement\n * @dependency wje-icon, wje-button\n * @csspart native - The wrapper element for the pagination component.\n */\nexport default class Pagination extends WJElement {\n /**\n * Creates an instance of Pagination.\n */\n constructor() {\n super();\n this.localizer = new Localizer(this);\n\n this._paginateObj = null;\n }\n\n /**\n * Sets the value of the 'page' attribute for the object.\n * @param {string} value The value to set for the 'page' attribute.\n */\n set page(value) {\n this.setAttribute('page', value);\n }\n\n /**\n * Retrieves the current page number as a numeric value.\n * @returns {number} The current page number. Returns 0 if the attribute 'page' is not set or is not a numeric value.\n */\n get page() {\n return +this.getAttribute('page') || 0;\n }\n\n /**\n * Sets the maximum number of pages.\n * Updates the 'max-pages' attribute with the provided value.\n * @param {number|string} value The maximum number of pages to set. Can be a number or a parsable string representing a number.\n */\n set maxPages(value) {\n this.setAttribute('max-pages', value);\n }\n\n /**\n * Gets the maximum number of pages.\n * This getter retrieves the value of the \"max-pages\" attribute from the element.\n * If the attribute is not set or is invalid, it defaults to 3.\n * @returns {number} The maximum number of pages as a numeric value.\n */\n get maxPages() {\n return +this.getAttribute('max-pages') || 3;\n }\n\n /**\n * Sets the `pageSize` attribute to the specified value.\n * @param {number|string} value The desired page size value. This can be a number or a string representation of the size.\n */\n set pageSize(value) {\n this.setAttribute('page-size', value);\n }\n\n /**\n * Retrieves the value of the 'page-size' attribute and converts it to a number.\n * If the attribute is not set or is invalid, returns the default value of 3.\n * @returns {number} The numeric value of the 'page-size' attribute or the default value of 3.\n */\n get pageSize() {\n return +this.getAttribute('page-size') || 3;\n }\n\n /**\n * Sets the total number of items.\n * @param {number} value The new total number of items to set.\n */\n set totalItems(value) {\n this.setAttribute('total-items', value);\n }\n\n /**\n * Retrieves the total number of items represented by the 'total-items' attribute.\n * @returns {number} The total number of items. Defaults to 0 if the attribute is not set or is invalid.\n */\n get totalItems() {\n return +this.getAttribute('total-items') || 0;\n }\n\n /**\n * Sets the visibility of the first button based on the provided value.\n * Adds the 'show-first-button' attribute when the value is truthy, and removes it otherwise.\n * @param {boolean} value Determines whether to show the first button. If true, the 'show-first-button' attribute is added; if false, it is removed.\n */\n set showFirstButton(value) {\n this.removeAttribute('show-first-button');\n\n if (value) {\n this.setAttribute('show-first-button', '');\n }\n }\n\n /**\n * Determines whether the 'show-first-button' attribute is present on the element.\n * @returns {boolean} True if the 'show-first-button' attribute is set; otherwise, false.\n */\n get showFirstButton() {\n return this.hasAttribute('show-first-button');\n }\n\n /**\n * Sets the visibility of the \"last\" button. This method controls the presence\n * or absence of the \"show-last-button\" attribute based on the provided value.\n * @param {boolean} value A boolean value indicating whether to show the \"last\" button.\n * If true, the \"show-last-button\" attribute is added;\n * if false, the attribute is removed.\n */\n set showLastButton(value) {\n this.removeAttribute('show-last-button');\n\n if (value) {\n this.setAttribute('show-last-button', '');\n }\n }\n\n /**\n * Determines if the 'show-last-button' attribute is present on the element.\n * @returns {boolean} True if the 'show-last-button' attribute is present, otherwise false.\n */\n get showLastButton() {\n return this.hasAttribute('show-last-button');\n }\n\n /**\n * Sets the pagination object by calculating the pagination details\n * based on the total items, current page, page size, and maximum pages.\n * @param {object} value The value to set the pagination object. The pagination details are computed internally.\n */\n set paginateObj(value) {\n this._paginateObj = value;\n }\n\n /**\n * Retrieves the pagination object used for managing paginated data.\n * @returns {object} The pagination object containing details and functionality for paginating data.\n */\n get paginateObj() {\n return this._paginateObj;\n }\n\n /**\n * Sets the 'round' attribute on the element. If the provided value is truthy,\n * the 'round' attribute is added. If the value is falsy, the attribute is removed.\n * @param {boolean} value A boolean value determining whether to add or remove the 'round' attribute.\n */\n set round(value) {\n this.removeAttribute('round');\n\n if (value) {\n this.setAttribute('round', '');\n }\n }\n\n /**\n * Retrieves the value of the 'round' attribute for the current element.\n * @returns {boolean} A boolean indicating whether the 'round' attribute is present on the element.\n */\n get round() {\n return this.hasAttribute('round');\n }\n\n /**\n * Sets the `show-info` attribute on the element based on the provided value.\n * @param {boolean} value A boolean indicating whether to add or remove the `show-info` attribute.\n */\n set showInfo(value) {\n this.removeAttribute('show-info');\n\n if (value) {\n this.setAttribute('show-info', '');\n }\n }\n\n /**\n * Retrieves the value of the 'show-info' attribute.\n * Checks if the 'show-info' attribute is present on the element.\n * @returns {boolean} True if the 'show-info' attribute is present, otherwise false.\n */\n get showInfo() {\n return this.hasAttribute('show-info');\n }\n\n /**\n * Dependencies of the Button element.\n * @type {object}\n */\n dependencies = {\n 'wje-icon': Icon,\n 'wje-button': Button,\n };\n\n className = 'Pagination';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes attribute of the input element.\n * @returns {Array} The attributes to observe for changes.\n */\n static get observedAttributes() {\n return ['page', 'total-items'];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n async beforeDraw() {\n this.paginateObj = await paginate(this.totalItems, this.page, this.pageSize, this.maxPages);\n }\n\n /**\n * Creates a document fragment, appends a new slot element to it, and returns the fragment.\n * @returns {DocumentFragment} A document fragment containing a slot element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-pagination');\n\n native.append(this.htmlPagination());\n\n fragment.append(native);\n\n return fragment;\n }\n\n /**\n * Creates a pagination control for navigating between pages of content.\n * This method generates and returns a document fragment containing pagination controls, including buttons for navigating to the first, previous, next, and last pages, as well as optional informational text about the current set of displayed items and total number of items.\n * @returns {DocumentFragment} A document fragment containing the pagination controls.\n */\n htmlPagination() {\n let fragment = document.createDocumentFragment();\n\n let info = document.createElement('div');\n info.classList.add('info');\n info.innerHTML = `${this.paginateObj.startIndex + 1} - ${this.paginateObj.endIndex + 1} ${this.localizer.translate('wj.pagination.of')} ${this.totalItems}`;\n\n let pagination = document.createElement('div');\n pagination.classList.add('pages');\n\n const button = document.createElement('wje-button');\n button.setAttribute('fill', 'link');\n if (this.round) button.setAttribute('round', '');\n\n // First button\n let firstButton = button.cloneNode(true);\n firstButton.title = this.localizer.translate('wj.pagination.first');\n firstButton.innerHTML = `<wje-icon name=\"chevron-left-pipe\" slot=\"icon-only\"></wje-icon>`;\n firstButton.addEventListener('wje-button:click', (e) => this.pageClickAction(e, 0));\n\n // Previous button\n const prevButton = button.cloneNode(true);\n prevButton.title = this.localizer.translate('wj.pagination.prev');\n prevButton.innerHTML = `<wje-icon name=\"chevron-left\" slot=\"icon-only\"></wje-icon>`;\n if (this.page === 0) prevButton.disabled = true;\n prevButton.addEventListener('wje-button:click', (e) => this.pageClickAction(e, this.page - 1));\n\n // Next button\n const nextButton = button.cloneNode(true);\n nextButton.title = this.localizer.translate('wj.pagination.next');\n nextButton.innerHTML = `<wje-icon name=\"chevron-right\" slot=\"icon-only\"></wje-icon>`;\n if (this.page + 1 >= this.paginateObj.totalPages) nextButton.disabled = true;\n nextButton.addEventListener('wje-button:click', (e) => this.pageClickAction(e, this.page + 1));\n\n // Last button\n let lastButton = button.cloneNode(true);\n lastButton.title = this.localizer.translate('wj.pagination.last');\n lastButton.innerHTML = `<wje-icon name=\"chevron-right-pipe\" slot=\"icon-only\"></wje-icon>`;\n lastButton.disabled = this.paginateObj.endIndex + 1 >= this.totalItems;\n lastButton.addEventListener('wje-button:click', (e) =>\n this.pageClickAction(e, this.paginateObj.totalPages - 1)\n );\n\n if (this.showFirstButton) pagination.appendChild(firstButton);\n pagination.appendChild(prevButton);\n pagination.appendChild(this.htmlStackButtons(this.paginateObj));\n pagination.appendChild(nextButton);\n if (this.showLastButton) pagination.appendChild(lastButton);\n\n if (this.showInfo) fragment.appendChild(info);\n fragment.appendChild(pagination);\n\n return fragment;\n }\n\n /**\n * Creates and returns a DocumentFragment containing a series of buttons for pagination purposes,\n * based on the provided pagination object.\n * @param {object} paginateObj An object containing pagination details.\n * @param {number} paginateObj.currentPage The current active page index (1-based).\n * @param {Array<number>} paginateObj.pages An array of page numbers to display in the pagination.\n * @param {number} paginateObj.totalPages Total number of pages available for pagination.\n * @returns {DocumentFragment} A DocumentFragment containing the buttons and additional pagination elements.\n */\n htmlStackButtons(paginateObj) {\n let fragment = document.createDocumentFragment();\n\n const button = document.createElement('wje-button');\n button.setAttribute('fill', 'link');\n if (this.round) button.setAttribute('round', '');\n\n let dots = document.createElement('span');\n dots.classList.add('dots');\n\n const first = button.cloneNode(true);\n first.textContent = '1';\n first.addEventListener('wje-button:click', (e) => this.pageClickAction(e, 0));\n\n const last = button.cloneNode(true);\n last.textContent = paginateObj.totalPages;\n last.addEventListener('wje-button:click', (e) => this.pageClickAction(e, paginateObj.totalPages - 1));\n\n if (paginateObj.currentPage >= this.maxPages + 1 && paginateObj.boundary < paginateObj.totalPages) {\n fragment.appendChild(first);\n fragment.appendChild(dots);\n }\n\n paginateObj.pages.forEach((page) => {\n let newButton = button.cloneNode(true);\n newButton.textContent = page;\n\n if (page - 1 === this.page) {\n newButton.removeAttribute('fill');\n } else {\n newButton.addEventListener('wje-button:click', (e) => this.pageClickAction(e, page - 1));\n }\n\n fragment.appendChild(newButton);\n });\n\n if (\n (paginateObj.pages.length === this.maxPages || paginateObj.currentPage < this.maxPages + 1) &&\n paginateObj.boundary < paginateObj.totalPages\n ) {\n fragment.appendChild(dots.cloneNode(true));\n fragment.appendChild(last);\n }\n\n return fragment;\n }\n\n /**\n * Handles the click action for pagination and updates the current page.\n * If the clicked page number is the same as the current page, no action is performed.\n * Otherwise, the current page is updated to the new page number, and a custom event\n * 'wje-pagination:page-change' is dispatched with the pagination object.\n * @param {Event} e The event triggered by the page click.\n * @param {number} page The page number that was clicked.\n */\n pageClickAction = (e, page) => {\n if (+page === this.page || this.page > this.paginateObj.totalPages) return;\n this.page = page;\n event.dispatchCustomEvent(this, 'wje-pagination:page-change', { page: page });\n };\n}\n\nPagination.define('wje-pagination', Pagination);\n","import Pagination from './pagination.element.js';\n\nexport default Pagination;\n\nPagination.define('wje-pagination', Pagination);\n"],"names":[],"mappings":";;;;;;;AAQO,SAAS,SAAS,YAAY,cAAc,GAAG,WAAW,IAAI,WAAW,GAAG;AAE/E,QAAM,aAAa,KAAK,KAAK,aAAa,QAAQ;AAGlD,MAAI,cAAc,GAAG;AACjB,kBAAc;AAAA,EACtB,WAAe,cAAc,YAAY;AACjC,kBAAc;AAAA,EACtB;AAEI,MAAI;AACJ,MAAI;AAEJ,QAAM,eAAe,WAAW;AAEhC,QAAM,WAAW,eAAe;AAEhC,MAAI,aAAa,UAAU;AACvB,QAAI,cAAc,cAAc;AAE5B,kBAAY;AACZ,gBAAU,KAAK,IAAI,eAAe,GAAG,UAAU;AAAA,IAC3D,WAAmB,eAAe,aAAa,cAAc;AAEjD,kBAAY,KAAK,IAAI,aAAa,cAAc,CAAC;AACjD,gBAAU;AAAA,IACtB,OAAe;AACH,YAAM,YAAY,KAAK,MAAM,WAAW,CAAC;AAEzC,kBAAY,cAAc,YAAY;AACtC,gBAAU,WAAW,MAAM,IAAI,cAAc,YAAY,IAAI,cAAc,YAAY;AAAA,IACnG;AAAA,EACA,OAAW;AACH,gBAAY;AACZ,cAAU;AAAA,EAClB;AAGI,QAAM,cAAc,cAAc,KAAK;AACvC,QAAM,WAAW,KAAK,IAAI,aAAa,WAAW,GAAG,aAAa,CAAC;AAGnE,QAAM,QAAQ,MAAM,KAAK,EAAE,QAAQ,UAAU,YAAY,EAAG,GAAE,CAAC,GAAG,MAAM,YAAY,CAAC;AAGrF,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACH;AACL;;ACnDe,MAAM,mBAAmB,UAAU;AAAA;AA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,MAAO,QAAO,aAAa,SAAS,EAAE;AAE/C,QAAI,OAAO,SAAS,cAAc,MAAM;AACxC,SAAK,UAAU,IAAI,MAAM;AAEzB,UAAM,QAAQ,OAAO,UAAU,IAAI;AACnC,UAAM,cAAc;AACpB,UAAM,iBAAiB,oBAAoB,CAAC,MAAM,KAAK,gBAAgB,GAAG,CAAC,CAAC;AAE5E,UAAM,OAAO,OAAO,UAAU,IAAI;AAClC,SAAK,cAAc,YAAY;AAC/B,SAAK,iBAAiB,oBAAoB,CAAC,MAAM,KAAK,gBAAgB,GAAG,YAAY,aAAa,CAAC,CAAC;AAEpG,QAAI,YAAY,eAAe,KAAK,WAAW,KAAK,YAAY,WAAW,YAAY,YAAY;AAC/F,eAAS,YAAY,KAAK;AAC1B,eAAS,YAAY,IAAI;AAAA,IACrC;AAEQ,gBAAY,MAAM,QAAQ,CAAC,SAAS;AAChC,UAAI,YAAY,OAAO,UAAU,IAAI;AACrC,gBAAU,cAAc;AAExB,UAAI,OAAO,MAAM,KAAK,MAAM;AACxB,kBAAU,gBAAgB,MAAM;AAAA,MAChD,OAAmB;AACH,kBAAU,iBAAiB,oBAAoB,CAAC,MAAM,KAAK,gBAAgB,GAAG,OAAO,CAAC,CAAC;AAAA,MACvG;AAEY,eAAS,YAAY,SAAS;AAAA,IAC1C,CAAS;AAED,SACK,YAAY,MAAM,WAAW,KAAK,YAAY,YAAY,cAAc,KAAK,WAAW,MACzF,YAAY,WAAW,YAAY,YACrC;AACE,eAAS,YAAY,KAAK,UAAU,IAAI,CAAC;AACzC,eAAS,YAAY,IAAI;AAAA,IACrC;AAEQ,WAAO;AAAA,EACf;AAeA;AAEA,WAAW,OAAO,kBAAkB,UAAU;AC7X9C,WAAW,OAAO,kBAAkB,UAAU;"}
package/dist/wje-popup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as Popup } from "./popup.element-tyYxow0p.js";
1
+ import { P as Popup } from "./popup.element-AaduHP2r.js";
2
2
  Popup.define("wje-popup", Popup);
3
3
  export {
4
4
  Popup as default
@@ -10,7 +10,7 @@ import Chip from "./wje-chip.js";
10
10
  import Input from "./wje-input.js";
11
11
  import Option from "./wje-option.js";
12
12
  import Options from "./wje-options.js";
13
- import { P as Popup } from "./popup.element-tyYxow0p.js";
13
+ import { P as Popup } from "./popup.element-AaduHP2r.js";
14
14
  const styles = "/*\n[ WJ Select ]\n*/\n\n:host {\n --wje-select-border-width: 1px;\n --wje-select-border-style: solid;\n --wje-select-border-color: var(--wje-border-color);\n\n --wje-select-options-border-width: 1px;\n --wje-select-options-border-style: var(--wje-border-style);\n --wje-select-options-border-color: var(--wje-border-color);\n\n --wje-select-background: var(--wje-background);\n --wje-select-line-height: 20px;\n --wje-select-color: var(--wje-color);\n --wje-select-border-radius: var(--wje-border-radius-medium);\n\n --wje-select-margin-bottom: 0.5rem;\n margin-bottom: var(--wje-select-margin-bottom);\n\n width: 100%;\n display: block;\n [slot='arrow'] {\n transform: rotate(0deg);\n transition: all 0.2s ease-in;\n }\n}\n\n.native-select {\n &.default {\n .wrapper {\n display: block;\n border-width: var(--wje-select-border-width);\n border-style: var(--wje-select-border-style);\n border-color: var(--wje-select-border-color);\n border-radius: var(--wje-select-border-radius);\n padding-inline: 0.5rem;\n padding-top: 0.125rem;\n padding-bottom: 0.125rem;\n }\n .input-wrapper {\n padding: 0;\n min-height: 28px;\n margin-top: -4px;\n }\n &.focused {\n wje-label {\n opacity: 0.67;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n wje-label {\n margin: 0;\n display: block;\n opacity: 1;\n cursor: text;\n transition: opacity 0.2s ease 0s;\n line-height: var(--wje-select-line-height);\n &.fade {\n opacity: 0.5;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n }\n &.standard {\n .wrapper {\n background-color: var(--wje-select-background);\n border-width: var(--wje-select-border-width);\n border-style: var(--wje-select-border-style);\n border-color: var(--wje-select-border-color);\n border-radius: var(--wje-select-border-radius);\n }\n .input-wrapper {\n background: transparent;\n width: 100%;\n }\n }\n}\n\n.wrapper {\n display: flex;\n width: 100%;\n}\n\n.input-wrapper {\n display: grid;\n grid-template-columns: auto 1fr auto auto auto;\n align-items: center;\n background-color: var(--wje-select-background);\n min-height: 28px;\n color: var(--wje-select-color);\n line-height: var(--wje-select-line-height);\n appearance: none;\n padding: 2px 0.5rem;\n font-size: 14px !important;\n font-weight: normal;\n vertical-align: middle;\n}\n\ninput {\n color: var(--wje-select-color);\n line-height: var(--wje-select-line-height);\n font-size: 14px !important;\n font-weight: 400;\n letter-spacing: 0.01em;\n border: medium;\n height: 25px;\n min-height: 25px;\n padding: 0;\n background: none;\n box-shadow: none;\n width: 100%;\n outline: 0;\n font-size: 14px !important;\n}\n\n::placeholder {\n opacity: 1;\n}\n\n:host [active] {\n .wrapper {\n border-radius: var(--wje-select-border-radius) var(--wje-select-border-radius) 0 0;\n }\n [slot='arrow'] {\n transform: rotate(180deg);\n transition: all 0.2s ease-in;\n }\n}\n\n.options-wrapper {\n border-width: var(--wje-select-options-border-width);\n border-style: var(--wje-select-options-border-style);\n border-color: var(--wje-select-options-border-color);\n border-radius: 0 0 var(--wje-select-border-radius) var(--wje-select-border-radius);\n margin-top: calc(0px - var(--wje-select-border-width));\n background: var(--wje-select-background);\n overflow: hidden;\n}\n\n.find {\n --wje-input-border-radius: 0;\n --wje-input-border-width: 0 0 1px 0;\n}\n\n.list {\n overflow: auto;\n height: 100%;\n}\n\n.options-wrapper:has(.find) .list {\n height: calc(100% - 32px - 0.5rem);\n}\n\n:host([multiple]) input {\n position: absolute;\n z-index: -1;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n opacity: 0;\n}\n\n:host([multiple]) .chips {\n display: flex;\n flex: 1;\n align-items: center;\n flex-wrap: wrap;\n}\n\n:host([disabled]) .input-wrapper {\n opacity: 0.5;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n.counter {\n padding-inline: 0.5rem;\n}\n\nwje-chip {\n --wje-chip-margin: 0 0.25rem 0 0;\n}\n\nwje-button {\n --wje-padding-top: 0.25rem;\n --wje-padding-start: 0.25rem;\n --wje-padding-end: 0.25rem;\n --wje-padding-bottom: 0.25rem;\n --wje-button-margin-inline: 0 0.25rem;\n}\n\n.slot-start,\n.slot-end {\n &:not(:empty) {\n margin-right: 0.5rem;\n }\n}\n";
15
15
  class Select extends WJElement {
16
16
  /**
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import WJElement from "./wje-element.js";
5
- const styles = ":host {\n display: block;\n z-index: 1000;\n /* make css property for width height position and if it is on top lef bottom right */\n}\n\n.sliding-container-wrapper {\n height: 100%;\n position: relative;\n overflow: hidden;\n}\n\n.native-sliding-container {\n overflow: auto;\n}\n";
5
+ const styles = ":host {\n display: block;\n z-index: 1000;\n /* make css property for width height position and if it is on top lef bottom right */\n}\n\n.sliding-container-wrapper {\n height: 100%;\n position: relative;\n overflow: hidden;\n}\n\n.native-sliding-container {\n overflow: auto;\n}\n";
6
6
  class SlidingContainer extends WJElement {
7
7
  /**
8
8
  * Creates an instance of SlidingContainer.
@@ -233,7 +233,6 @@ class SlidingContainer extends WJElement {
233
233
  * Attaches an event listener to the document based on the specified trigger.
234
234
  * Sets the variant to "over" if the document width is smaller than the screen break point.
235
235
  * Calls the checkForVariant method with the current variant.
236
- * @returns {Promise<void>} A promise that resolves after the actions are completed.
237
236
  */
238
237
  afterDraw() {
239
238
  document.addEventListener(this.trigger, this.triggerEvent);
@@ -407,6 +406,7 @@ class SlidingContainer extends WJElement {
407
406
  composed: true
408
407
  })
409
408
  );
409
+ this.checkForVariant(this.variant);
410
410
  await this.doAnimateTransition();
411
411
  await Promise.resolve(this.afterOpen(event)).then(() => {
412
412
  this.dispatchEvent(
@@ -1 +1 @@
1
- {"version":3,"file":"wje-sliding-container.js","sources":["../experimental-packages/wje-sliding-container/sliding-container.element.js","../experimental-packages/wje-sliding-container/sliding-container.js"],"sourcesContent":["import { default as WJElement } from '../../packages/wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary SlidingContainer is a custom web component that extends WJElement.\n * @documentation https://elements.webjet.sk/components/SlidingContainer\n * @status stable\n * @augments WJElement\n * @csspart - Styles the element.\n * @slot - The default slot for the SlidingContainer.\n * @property {string} maxWidth - The maximum width of the SlidingContainer.\n * @property {string} maxHeight - The maximum height of the SlidingContainer.\n * @property {string} trigger - The trigger for the SlidingContainer.\n * @property {string} direction - The direction of the SlidingContainer.\n * @property {string} variant - The variant of the SlidingContainer.\n * @property {string} screenBreakPoint - The screen break point of the SlidingContainer.\n * @property {boolean} removeChildAfterClose - Removes the child after the SlidingContainer is closed.\n * @property {string} animationDuration - The duration of the animation.\n * @property {string} animationEasing - The easing of the animation.\n * @property {boolean} hasOpacity - Sets the opacity of the SlidingContainer.\n * @tag wje-sliding-container\n * @example\n * <wje-sliding-container trigger=\"test-resize-container-event-right\" id=\"left-in-place\" direction=\"left\" max-width=\"100px\" max-height=\"100%\">\n * <wje-card>\n * <wje-card-header>\n * <wje-card-subtitle>CONTENT Subtitle</wje-card-subtitle>\n * <wje-card-title>CONTENT Title</wje-card-title>\n * </wje-card-header>\n * <wje-card-content>\n * CONTENT Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n * </wje-card-content>\n * </wje-card>\n * </wje-sliding-container>\n */\nexport default class SlidingContainer extends WJElement {\n /**\n * Creates an instance of SlidingContainer.\n * @class\n */\n constructor() {\n super();\n\n this._isOpen = false;\n this._lastCaller = null;\n\n this._resizeObserver = new ResizeObserver((entries) => {\n for (let entry of entries) {\n if (entry.contentBoxSize) {\n if (this.drawingStatus < 3) return;\n\n if (this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint) {\n if (this.variant !== 'over') {\n this.variant = 'over';\n } else {\n this.checkForVariant(this.variant);\n }\n } else {\n if (this.variant !== 'in-place') {\n this.variant = 'in-place';\n } else {\n this.checkForVariant(this.variant);\n }\n }\n }\n }\n });\n\n this._resizeObserver.observe(document.documentElement);\n }\n\n set maxWidth(value) {\n this.setAttribute('max-width', value);\n }\n\n get maxWidth() {\n return this.getAttribute('max-width') ?? 'auto';\n }\n\n set maxHeight(value) {\n this.setAttribute('max-height', value);\n }\n\n get maxHeight() {\n return this.getAttribute('max-height') ?? 'auto';\n }\n\n set trigger(value) {\n this.setAttribute('trigger', value);\n }\n\n get trigger() {\n return this.getAttribute('trigger') ?? 'sliding-container';\n }\n\n set direction(value) {\n this.setAttribute('direction', value);\n }\n\n get direction() {\n return this.getAttribute('direction') ?? 'right';\n }\n\n set removeChildAfterClose(value) {\n this.setAttribute('remove-child-after-close', value);\n }\n\n get removeChildAfterClose() {\n return this.hasAttribute('remove-child-after-close') ?? false;\n }\n\n set variant(value) {\n this.setAttribute('variant', value);\n }\n\n get variant() {\n return this.getAttribute('variant') ?? 'in-place';\n }\n\n get screenBreakPoint() {\n return this.getAttribute('screen-break-point');\n }\n\n set screenBreakPoint(value) {\n this.setAttribute('screen-break-point', value);\n }\n\n get animationDuration() {\n return this.getAttribute('animation-duration') ?? '500';\n }\n\n set animationDuration(value) {\n this.setAttribute('animation-duration', value);\n }\n\n get animationEasing() {\n return this.getAttribute('animation-easing') ?? 'linear';\n }\n\n set animationEasing(value) {\n this.setAttribute('animation-easing', value);\n }\n\n get hasOpacity() {\n return this.hasAttribute('has-opacity') ?? false;\n }\n\n get addToHeight() {\n return this.getAttribute('add-to-height') ?? '0';\n }\n\n set addToHeight(value) {\n this.setAttribute('add-to-height', value);\n }\n\n className = 'SlidingContainer';\n\n /**\n * Returns the observed attributes for the component.\n * @returns {string[]}\n */\n static get observedAttributes() {\n return [\n 'max-width',\n 'max-height',\n 'trigger',\n 'direction',\n 'variant',\n 'screen-break-point',\n 'remove-child-after-close',\n 'animation-duration',\n 'animation-easing',\n 'has-opacity',\n ];\n }\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component.\n * @param {object} context The context for drawing.\n * @param {object} store The store for drawing.\n * @param {object} params The parameters for drawing.\n * @returns {DocumentFragment}\n */\n draw(context, store, params) {\n let fragment = document.createDocumentFragment();\n\n this.style.position = 'relative';\n this.style.height = '100%';\n this.style.right = 'unset';\n this.style.left = 'unset';\n\n this.wrapperDiv = document.createElement('div');\n this.wrapperDiv.classList.add('sliding-container-wrapper');\n\n this.transparentDiv = document.createElement('div');\n this.transparentDiv.classList.add('sliding-container-transparent');\n if (this._isOpen) {\n this.transparentDiv.style.width = this.maxWidth;\n }\n\n let native = document.createElement('div');\n native.style.position = 'absolute';\n native.style.width = 0;\n if (this.hasOpacity) {\n native.style.opacity = 0;\n }\n\n if (this._isOpen) {\n native.style.width = this.maxWidth;\n if (this.hasOpacity) {\n native.style.opacity = 1;\n }\n }\n\n native.style.height = '100%';\n\n native.classList.add('native-sliding-container');\n native.setAttribute('part', 'sliding-container');\n\n if (this.direction === 'right') {\n native.style.right = 0;\n } else {\n native.style.left = 0;\n }\n\n let slot = document.createElement('slot');\n\n const nativeInner = document.createElement('div');\n nativeInner.classList.add('native-sliding-container-inner');\n nativeInner.style.height = '100%';\n nativeInner.style.position = 'absolute';\n nativeInner.style.width = this.maxWidth;\n\n nativeInner.appendChild(slot);\n nativeInner.appendChild(this.getCloseButton());\n\n native.appendChild(nativeInner);\n this.wrapperDiv.appendChild(this.transparentDiv);\n this.wrapperDiv.appendChild(native);\n fragment.appendChild(this.wrapperDiv);\n\n this.nativeElement = native;\n\n return fragment;\n }\n\n /**\n * Creates and returns a close button element.\n * @returns {HTMLElement} The close button element.\n */\n getCloseButton() {\n let closeButton = document.createElement('wje-button');\n closeButton.setAttribute('part', 'close-button');\n closeButton.style.position = 'absolute';\n closeButton.style.top = '0';\n closeButton.style.right = '0';\n closeButton.style.zIndex = '1000';\n\n let icon = document.createElement('wje-icon');\n icon.setAttribute('slot', 'icon-only');\n icon.setAttribute('name', 'x');\n closeButton.appendChild(icon);\n\n closeButton.addEventListener('click', () => {\n this.close();\n });\n\n return closeButton;\n }\n\n /**\n * Executes before drawing the element.\n */\n beforeDraw() {\n this.animation?.cancel();\n this.nativeAnimation?.cancel();\n document.removeEventListener(this.trigger, this.triggerEvent);\n }\n\n /**\n * Performs actions after the element is drawn on the screen.\n * Attaches an event listener to the document based on the specified trigger.\n * Sets the variant to \"over\" if the document width is smaller than the screen break point.\n * Calls the checkForVariant method with the current variant.\n * @returns {Promise<void>} A promise that resolves after the actions are completed.\n */\n afterDraw() {\n document.addEventListener(this.trigger, this.triggerEvent);\n\n // if document width is on small screen set variant to over\n if (this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint) {\n this.variant = 'over';\n }\n\n this.checkForVariant(this.variant);\n }\n\n getParentElement() {\n let parentElement = this.parentElement;\n\n if (!parentElement) {\n parentElement = this.getRootNode().host;\n }\n\n return parentElement;\n }\n\n /**\n * Checks for a specific variant and applies corresponding styles.\n * @param {string} variant The variant to check for.\n */\n checkForVariant(variant) {\n if (variant === 'over') {\n this.style.position = 'fixed';\n let computentStyleOfParent = window.getComputedStyle(this.getParentElement());\n let parentElementBoundingbox = this.getParentElement().getBoundingClientRect();\n let heightOfParrentElement = parseFloat(computentStyleOfParent.height);\n\n let topOfParrentElement = parseFloat(computentStyleOfParent.top);\n\n this.style.height = heightOfParrentElement + +this.addToHeight + 'px';\n this.wrapperDiv.style.height = heightOfParrentElement + +this.addToHeight + 'px';\n this.style.top = topOfParrentElement + 'px';\n\n const leftSibling = this.previousElementSibling;\n const rightSibling = this.nextElementSibling;\n const leftSiblingBoundingbox = leftSibling?.getBoundingClientRect();\n const rightSiblingBoundingbox = rightSibling?.getBoundingClientRect();\n\n if (this.direction === 'right') {\n // attach to left sibling\n if (leftSiblingBoundingbox) {\n this.style.left = leftSiblingBoundingbox.left + leftSiblingBoundingbox.width + 'px';\n } else {\n this.style.left = parentElementBoundingbox.left + 'px';\n }\n } else {\n // attach to right sibling\n if (rightSiblingBoundingbox) {\n this.style.right = window.innerWidth - rightSiblingBoundingbox.left + 'px';\n } else {\n this.style.right =\n window.innerWidth - (parentElementBoundingbox.left + parentElementBoundingbox.width) + 'px';\n }\n }\n }\n }\n\n /**\n * Triggers the event based on the target element.\n * If the target element is different from the last caller, it refreshes the children by calling the `open` method.\n * If the target element is the same as the last caller, it toggles the state by calling the `toggle` method.\n * @param {Event} e The event object.\n */\n triggerEvent = async (e) => {\n if (this._lastCaller && this._lastCaller !== e.composedPath()[0]) {\n // same oppener event but different caller so just refresh inner content\n await this.open(e);\n } else {\n // came caller so toggle\n await this.toggle(e);\n }\n\n this._lastCaller = e.composedPath()[0];\n };\n\n /**\n * Executes before the element is opened.\n */\n beforeOpen(event) {\n // Hook for extending behavior before the dialog opens\n }\n\n /**\n * Callback function called after the element is opened.\n */\n afterOpen(event) {\n // Hook for extending behavior before the dialog opens\n }\n\n /**\n * Executes before closing the element.\n */\n beforeClose(event) {\n // Hook for extending behavior before the dialog opens\n }\n\n /**\n * Callback function that is called after the container is closed.\n */\n afterClose(event) {\n // Hook for extending behavior before the dialog opens\n }\n\n /**\n * Animates the transition of the element's width from 0 to the maximum width or vice versa.\n * @returns {Promise<void>} A promise that resolves when the animation is complete.\n */\n doAnimateTransition() {\n const options = {\n delay: 0,\n endDelay: 0,\n fill: 'forwards',\n duration: +this.animationDuration,\n iterationStart: 0,\n iterations: 1,\n direction: 'normal',\n easing: this.animationEasing,\n };\n\n if (this.animation && this.animation?.effect?.target !== this.transparentDiv) {\n this.animation.cancel();\n this.animation = null;\n }\n\n if (this.nativeAnimation && this.nativeAnimation?.effect?.target !== this.nativeElement) {\n this.nativeAnimation.cancel();\n this.nativeAnimation = null;\n }\n\n if (!this._isOpen) {\n if (this.animation && this.nativeAnimation) {\n this.animation.reverse();\n this.nativeAnimation.reverse();\n } else {\n this.animation = this.transparentDiv.animate(\n [\n {\n width: 0,\n },\n {\n width: this.maxWidth,\n },\n ],\n options,\n );\n\n this.nativeAnimation = this.nativeElement.animate(\n [\n {\n ...(this.hasOpacity ? { opacity: 0 } : {}),\n width: 0,\n },\n {\n ...(this.hasOpacity ? { opacity: 1 } : {}),\n width: this.maxWidth,\n },\n ],\n options,\n );\n }\n } else {\n if (this.animation && this.nativeAnimation) {\n this.animation.reverse();\n this.nativeAnimation.reverse();\n } else {\n this.animation = this.transparentDiv.animate(\n [\n {\n width: this.maxWidth,\n },\n {\n width: 0,\n },\n ],\n options,\n );\n\n this.nativeAnimation = this.nativeElement.animate(\n [\n {\n ...(this.hasOpacity ? { opacity: 1 } : {}),\n width: this.maxWidth,\n },\n {\n ...(this.hasOpacity ? { opacity: 0 } : {}),\n width: 0,\n },\n ],\n options,\n );\n }\n }\n\n return new Promise((resolve, reject) => {\n this.animation.onfinish = () => {\n this._isOpen = !this._isOpen;\n resolve();\n };\n });\n }\n\n /**\n * Opens the container with an animation.\n * @returns {Promise<void>} A promise that resolves when the container is opened.\n */\n async open(event) {\n await Promise.resolve(this.beforeOpen(event)).then(async () => {\n if (!this._isOpen) {\n this.dispatchEvent(\n new CustomEvent('wje-sliding-container:beforeOpen', {\n bubbles: true,\n composed: true,\n }),\n );\n\n await this.doAnimateTransition();\n\n await Promise.resolve(this.afterOpen(event)).then(() => {\n this.dispatchEvent(\n new CustomEvent('wje-sliding-container:open', {\n bubbles: true,\n composed: true,\n }),\n );\n });\n }\n });\n }\n\n /**\n * Closes the animation container.\n * @returns {Promise<void>} A promise that resolves when the container is closed.\n */\n async close(event) {\n await Promise.resolve(this.beforeClose(event)).then(async () => {\n if (this._isOpen) {\n this.dispatchEvent(\n new CustomEvent('wje-sliding-container:beforeClose', {\n bubbles: true,\n composed: true,\n }),\n );\n\n await this.doAnimateTransition();\n\n await Promise.resolve(this.afterClose(event)).then(() => {\n if (this.removeChildAfterClose) {\n this.childNodes.forEach((child) => {\n child.remove();\n });\n }\n\n this.dispatchEvent(\n new CustomEvent('wje-sliding-container:close', {\n bubbles: true,\n composed: true,\n }),\n );\n });\n }\n });\n }\n\n /**\n * Toggles the state of the element.\n * If the element is open, it will be closed. If it is closed, it will be opened.\n * @returns {Promise<void>} A promise that resolves when the toggle operation is complete.\n */\n async toggle(event) {\n if (this._isOpen) {\n await this.close(event);\n } else {\n await this.open(event);\n }\n }\n\n componentCleanup() {\n this._resizeObserver?.disconnect();\n this._resizeObserver = null;\n }\n}\n","import SlidingContainer from './sliding-container.element.js';\n\nexport default SlidingContainer;\n\nSlidingContainer.define('wje-sliding-container', SlidingContainer);\n"],"names":[],"mappings":";;;;;AAkCe,MAAM,yBAAyB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtD,cAAc;AACZ,UAAO;AAkHT,qCAAY;AAuNZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAAe,OAAO,MAAM;AAC1B,UAAI,KAAK,eAAe,KAAK,gBAAgB,EAAE,aAAY,EAAG,CAAC,GAAG;AAEhE,cAAM,KAAK,KAAK,CAAC;AAAA,MACvB,OAAW;AAEL,cAAM,KAAK,OAAO,CAAC;AAAA,MACzB;AAEI,WAAK,cAAc,EAAE,aAAY,EAAG,CAAC;AAAA,IACtC;AAjVC,SAAK,UAAU;AACf,SAAK,cAAc;AAEnB,SAAK,kBAAkB,IAAI,eAAe,CAAC,YAAY;AACrD,eAAS,SAAS,SAAS;AACzB,YAAI,MAAM,gBAAgB;AACxB,cAAI,KAAK,gBAAgB,EAAG;AAE5B,cAAI,KAAK,oBAAoB,OAAO,cAAc,KAAK,kBAAkB;AACvE,gBAAI,KAAK,YAAY,QAAQ;AAC3B,mBAAK,UAAU;AAAA,YAC7B,OAAmB;AACL,mBAAK,gBAAgB,KAAK,OAAO;AAAA,YAC/C;AAAA,UACA,OAAiB;AACL,gBAAI,KAAK,YAAY,YAAY;AAC/B,mBAAK,UA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AAAA,IAC5B,OAAW;AACL,YAAM,KAAK,KAAK,KAAK;AAAA,IAC3B;AAAA,EACA;AAAA,EAEE,mBAAmB;;AACjB,eAAK,oBAAL,mBAAsB;AACtB,SAAK,kBAAkB;AAAA,EAC3B;AACA;ACtkBA,iBAAiB,OAAO,yBAAyB,gBAAgB;"}
1
+ {"version":3,"file":"wje-sliding-container.js","sources":["../experimental-packages/wje-sliding-container/sliding-container.element.js","../experimental-packages/wje-sliding-container/sliding-container.js"],"sourcesContent":["import { default as WJElement } from '../../packages/wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary SlidingContainer is a custom web component that extends WJElement.\n * @documentation https://elements.webjet.sk/components/SlidingContainer\n * @status stable\n * @augments WJElement\n * @csspart - Styles the element.\n * @slot - The default slot for the SlidingContainer.\n * @property {string} maxWidth - The maximum width of the SlidingContainer.\n * @property {string} maxHeight - The maximum height of the SlidingContainer.\n * @property {string} trigger - The trigger for the SlidingContainer.\n * @property {string} direction - Specifies the sliding direction of the container (e.g., 'left' or 'right').\n * @property {string} variant - Determines how the SlidingContainer behaves, such as 'over' or 'in-place'.\n * @property {string} screenBreakPoint - The width (in pixels) at which the SlidingContainer switches to the \"over\" variant for smaller screens.\n * @property {boolean} removeChildAfterClose - Removes the child after the SlidingContainer is closed.\n * @property {string} animationDuration - Specifies the duration (in milliseconds) of the sliding animation.\n * @property {string} animationEasing - Specifies the easing function used for the sliding animation (e.g., 'linear', 'ease-in', 'ease-out').\n * @property {boolean} hasOpacity - Sets the opacity of the SlidingContainer.\n * @tag wje-sliding-container\n * @example\n * <wje-sliding-container trigger=\"test-resize-container-event-right\" id=\"left-in-place\" direction=\"left\" max-width=\"100px\" max-height=\"100%\">\n * <wje-card>\n * <wje-card-header>\n * <wje-card-subtitle>CONTENT Subtitle</wje-card-subtitle>\n * <wje-card-title>CONTENT Title</wje-card-title>\n * </wje-card-header>\n * <wje-card-content>\n * CONTENT Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n * </wje-card-content>\n * </wje-card>\n * </wje-sliding-container>\n */\nexport default class SlidingContainer extends WJElement {\n /**\n * Creates an instance of SlidingContainer.\n * @class\n */\n constructor() {\n super();\n\n this._isOpen = false;\n this._lastCaller = null;\n\n this._resizeObserver = new ResizeObserver((entries) => {\n for (let entry of entries) {\n if (entry.contentBoxSize) {\n if (this.drawingStatus < 3) return;\n\n if (this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint) {\n if (this.variant !== 'over') {\n this.variant = 'over';\n } else {\n this.checkForVariant(this.variant);\n }\n } else {\n if (this.variant !== 'in-place') {\n this.variant = 'in-place';\n } else {\n this.checkForVariant(this.variant);\n }\n }\n }\n }\n });\n\n this._resizeObserver.observe(document.documentElement);\n }\n\n set maxWidth(value) {\n this.setAttribute('max-width', value);\n }\n\n get maxWidth() {\n return this.getAttribute('max-width') ?? 'auto';\n }\n\n set maxHeight(value) {\n this.setAttribute('max-height', value);\n }\n\n get maxHeight() {\n return this.getAttribute('max-height') ?? 'auto';\n }\n\n set trigger(value) {\n this.setAttribute('trigger', value);\n }\n\n get trigger() {\n return this.getAttribute('trigger') ?? 'sliding-container';\n }\n\n set direction(value) {\n this.setAttribute('direction', value);\n }\n\n get direction() {\n return this.getAttribute('direction') ?? 'right';\n }\n\n set removeChildAfterClose(value) {\n this.setAttribute('remove-child-after-close', value);\n }\n\n get removeChildAfterClose() {\n return this.hasAttribute('remove-child-after-close') ?? false;\n }\n\n set variant(value) {\n this.setAttribute('variant', value);\n }\n\n get variant() {\n return this.getAttribute('variant') ?? 'in-place';\n }\n\n get screenBreakPoint() {\n return this.getAttribute('screen-break-point');\n }\n\n set screenBreakPoint(value) {\n this.setAttribute('screen-break-point', value);\n }\n\n get animationDuration() {\n return this.getAttribute('animation-duration') ?? '500';\n }\n\n set animationDuration(value) {\n this.setAttribute('animation-duration', value);\n }\n\n get animationEasing() {\n return this.getAttribute('animation-easing') ?? 'linear';\n }\n\n set animationEasing(value) {\n this.setAttribute('animation-easing', value);\n }\n\n get hasOpacity() {\n return this.hasAttribute('has-opacity') ?? false;\n }\n\n get addToHeight() {\n return this.getAttribute('add-to-height') ?? '0';\n }\n\n set addToHeight(value) {\n this.setAttribute('add-to-height', value);\n }\n\n className = 'SlidingContainer';\n\n /**\n * Returns the observed attributes for the component.\n * @returns {string[]}\n */\n static get observedAttributes() {\n return [\n 'max-width',\n 'max-height',\n 'trigger',\n 'direction',\n 'variant',\n 'screen-break-point',\n 'remove-child-after-close',\n 'animation-duration',\n 'animation-easing',\n 'has-opacity',\n ];\n }\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component.\n * @param {object} context The context for drawing.\n * @param {object} store The store for drawing.\n * @param {object} params The parameters for drawing.\n * @returns {DocumentFragment}\n */\n draw(context, store, params) {\n let fragment = document.createDocumentFragment();\n\n this.style.position = 'relative';\n this.style.height = '100%';\n this.style.right = 'unset';\n this.style.left = 'unset';\n\n this.wrapperDiv = document.createElement('div');\n this.wrapperDiv.classList.add('sliding-container-wrapper');\n\n this.transparentDiv = document.createElement('div');\n this.transparentDiv.classList.add('sliding-container-transparent');\n if (this._isOpen) {\n this.transparentDiv.style.width = this.maxWidth;\n }\n\n let native = document.createElement('div');\n native.style.position = 'absolute';\n native.style.width = 0;\n if (this.hasOpacity) {\n native.style.opacity = 0;\n }\n\n if (this._isOpen) {\n native.style.width = this.maxWidth;\n if (this.hasOpacity) {\n native.style.opacity = 1;\n }\n }\n\n native.style.height = '100%';\n\n native.classList.add('native-sliding-container');\n native.setAttribute('part', 'sliding-container');\n\n if (this.direction === 'right') {\n native.style.right = 0;\n } else {\n native.style.left = 0;\n }\n\n let slot = document.createElement('slot');\n\n const nativeInner = document.createElement('div');\n nativeInner.classList.add('native-sliding-container-inner');\n nativeInner.style.height = '100%';\n nativeInner.style.position = 'absolute';\n nativeInner.style.width = this.maxWidth;\n\n nativeInner.appendChild(slot);\n nativeInner.appendChild(this.getCloseButton());\n\n native.appendChild(nativeInner);\n this.wrapperDiv.appendChild(this.transparentDiv);\n this.wrapperDiv.appendChild(native);\n fragment.appendChild(this.wrapperDiv);\n\n this.nativeElement = native;\n\n return fragment;\n }\n\n /**\n * Creates and returns a close button element.\n * @returns {HTMLElement} The close button element.\n */\n getCloseButton() {\n let closeButton = document.createElement('wje-button');\n closeButton.setAttribute('part', 'close-button');\n closeButton.style.position = 'absolute';\n closeButton.style.top = '0';\n closeButton.style.right = '0';\n closeButton.style.zIndex = '1000';\n\n let icon = document.createElement('wje-icon');\n icon.setAttribute('slot', 'icon-only');\n icon.setAttribute('name', 'x');\n closeButton.appendChild(icon);\n\n closeButton.addEventListener('click', () => {\n this.close();\n });\n\n return closeButton;\n }\n\n /**\n * Executes before drawing the element.\n */\n beforeDraw() {\n this.animation?.cancel();\n this.nativeAnimation?.cancel();\n document.removeEventListener(this.trigger, this.triggerEvent);\n }\n\n /**\n * Performs actions after the element is drawn on the screen.\n * Attaches an event listener to the document based on the specified trigger.\n * Sets the variant to \"over\" if the document width is smaller than the screen break point.\n * Calls the checkForVariant method with the current variant.\n */\n afterDraw() {\n document.addEventListener(this.trigger, this.triggerEvent);\n\n // if document width is on small screen set variant to over\n if (this.screenBreakPoint && window.innerWidth <= this.screenBreakPoint) {\n this.variant = 'over';\n }\n\n this.checkForVariant(this.variant);\n }\n\n getParentElement() {\n let parentElement = this.parentElement;\n\n if (!parentElement) {\n parentElement = this.getRootNode().host;\n }\n\n return parentElement;\n }\n\n /**\n * Checks for a specific variant and applies corresponding styles.\n * @param {string} variant The variant to check for.\n */\n checkForVariant(variant) {\n if (variant === 'over') {\n this.style.position = 'fixed';\n let computentStyleOfParent = window.getComputedStyle(this.getParentElement());\n let parentElementBoundingbox = this.getParentElement().getBoundingClientRect();\n let heightOfParrentElement = parseFloat(computentStyleOfParent.height);\n\n let topOfParrentElement = parseFloat(computentStyleOfParent.top);\n\n this.style.height = heightOfParrentElement + +this.addToHeight + 'px';\n this.wrapperDiv.style.height = heightOfParrentElement + +this.addToHeight + 'px';\n this.style.top = topOfParrentElement + 'px';\n\n const leftSibling = this.previousElementSibling;\n const rightSibling = this.nextElementSibling;\n const leftSiblingBoundingbox = leftSibling?.getBoundingClientRect();\n const rightSiblingBoundingbox = rightSibling?.getBoundingClientRect();\n\n if (this.direction === 'right') {\n // attach to left sibling\n if (leftSiblingBoundingbox) {\n this.style.left = leftSiblingBoundingbox.left + leftSiblingBoundingbox.width + 'px';\n } else {\n this.style.left = parentElementBoundingbox.left + 'px';\n }\n } else {\n // attach to right sibling\n if (rightSiblingBoundingbox) {\n this.style.right = window.innerWidth - rightSiblingBoundingbox.left + 'px';\n } else {\n this.style.right =\n window.innerWidth - (parentElementBoundingbox.left + parentElementBoundingbox.width) + 'px';\n }\n }\n }\n }\n\n /**\n * Triggers the event based on the target element.\n * If the target element is different from the last caller, it refreshes the children by calling the `open` method.\n * If the target element is the same as the last caller, it toggles the state by calling the `toggle` method.\n * @param {Event} e The event object.\n */\n triggerEvent = async (e) => {\n if (this._lastCaller && this._lastCaller !== e.composedPath()[0]) {\n // same oppener event but different caller so just refresh inner content\n await this.open(e);\n } else {\n // came caller so toggle\n await this.toggle(e);\n }\n\n this._lastCaller = e.composedPath()[0];\n };\n\n /**\n * Executes before the element is opened.\n */\n beforeOpen(event) {\n // Hook for extending behavior before the dialog opens\n }\n\n /**\n * Callback function called after the element is opened.\n */\n afterOpen(event) {\n // Hook for extending behavior before the dialog opens\n }\n\n /**\n * Executes before closing the element.\n */\n beforeClose(event) {\n // Hook for extending behavior before the dialog opens\n }\n\n /**\n * Callback function that is called after the container is closed.\n */\n afterClose(event) {\n // Hook for extending behavior before the dialog opens\n }\n\n /**\n * Animates the transition of the element's width from 0 to the maximum width or vice versa.\n * @returns {Promise<void>} A promise that resolves when the animation is complete.\n */\n doAnimateTransition() {\n const options = {\n delay: 0,\n endDelay: 0,\n fill: 'forwards',\n duration: +this.animationDuration,\n iterationStart: 0,\n iterations: 1,\n direction: 'normal',\n easing: this.animationEasing,\n };\n\n if (this.animation && this.animation?.effect?.target !== this.transparentDiv) {\n this.animation.cancel();\n this.animation = null;\n }\n\n if (this.nativeAnimation && this.nativeAnimation?.effect?.target !== this.nativeElement) {\n this.nativeAnimation.cancel();\n this.nativeAnimation = null;\n }\n\n if (!this._isOpen) {\n if (this.animation && this.nativeAnimation) {\n this.animation.reverse();\n this.nativeAnimation.reverse();\n } else {\n this.animation = this.transparentDiv.animate(\n [\n {\n width: 0,\n },\n {\n width: this.maxWidth,\n },\n ],\n options\n );\n\n this.nativeAnimation = this.nativeElement.animate(\n [\n {\n ...(this.hasOpacity ? { opacity: 0 } : {}),\n width: 0,\n },\n {\n ...(this.hasOpacity ? { opacity: 1 } : {}),\n width: this.maxWidth,\n },\n ],\n options\n );\n }\n } else {\n if (this.animation && this.nativeAnimation) {\n this.animation.reverse();\n this.nativeAnimation.reverse();\n } else {\n this.animation = this.transparentDiv.animate(\n [\n {\n width: this.maxWidth,\n },\n {\n width: 0,\n },\n ],\n options\n );\n\n this.nativeAnimation = this.nativeElement.animate(\n [\n {\n ...(this.hasOpacity ? { opacity: 1 } : {}),\n width: this.maxWidth,\n },\n {\n ...(this.hasOpacity ? { opacity: 0 } : {}),\n width: 0,\n },\n ],\n options\n );\n }\n }\n\n return new Promise((resolve, reject) => {\n this.animation.onfinish = () => {\n this._isOpen = !this._isOpen;\n resolve();\n };\n });\n }\n\n /**\n * Opens the container with an animation.\n * @returns {Promise<void>} A promise that resolves when the container is opened.\n */\n async open(event) {\n await Promise.resolve(this.beforeOpen(event)).then(async () => {\n if (!this._isOpen) {\n this.dispatchEvent(\n new CustomEvent('wje-sliding-container:beforeOpen', {\n bubbles: true,\n composed: true,\n })\n );\n\n this.checkForVariant(this.variant);\n\n await this.doAnimateTransition();\n\n await Promise.resolve(this.afterOpen(event)).then(() => {\n this.dispatchEvent(\n new CustomEvent('wje-sliding-container:open', {\n bubbles: true,\n composed: true,\n })\n );\n });\n }\n });\n }\n\n /**\n * Closes the animation container.\n * @returns {Promise<void>} A promise that resolves when the container is closed.\n */\n async close(event) {\n await Promise.resolve(this.beforeClose(event)).then(async () => {\n if (this._isOpen) {\n this.dispatchEvent(\n new CustomEvent('wje-sliding-container:beforeClose', {\n bubbles: true,\n composed: true,\n })\n );\n\n await this.doAnimateTransition();\n\n await Promise.resolve(this.afterClose(event)).then(() => {\n if (this.removeChildAfterClose) {\n this.childNodes.forEach((child) => {\n child.remove();\n });\n }\n\n this.dispatchEvent(\n new CustomEvent('wje-sliding-container:close', {\n bubbles: true,\n composed: true,\n })\n );\n });\n }\n });\n }\n\n /**\n * Toggles the state of the element.\n * If the element is open, it will be closed. If it is closed, it will be opened.\n * @returns {Promise<void>} A promise that resolves when the toggle operation is complete.\n */\n async toggle(event) {\n if (this._isOpen) {\n await this.close(event);\n } else {\n await this.open(event);\n }\n }\n\n componentCleanup() {\n this._resizeObserver?.disconnect();\n this._resizeObserver = null;\n }\n}\n","import SlidingContainer from './sliding-container.element.js';\n\nexport default SlidingContainer;\n\nSlidingContainer.define('wje-sliding-container', SlidingContainer);\n"],"names":[],"mappings":";;;;;AAkCe,MAAM,yBAAyB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAKpD,cAAc;AACV,UAAO;AAkHX,qCAAY;AAsNZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAAe,OAAO,MAAM;AACxB,UAAI,KAAK,eAAe,KAAK,gBAAgB,EAAE,aAAY,EAAG,CAAC,GAAG;AAE9D,cAAM,KAAK,KAAK,CAAC;AAAA,MAC7B,OAAe;AAEH,cAAM,KAAK,OAAO,CAAC;AAAA,MAC/B;AAEQ,WAAK,cAAc,EAAE,aAAY,EAAG,CAAC;AAAA,IACxC;AAhVG,SAAK,UAAU;AACf,SAAK,cAAc;AAEnB,SAAK,kBAAkB,IAAI,eAAe,CAAC,Y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AAC5B,iBAAK,WAAW,QAAQ,CAAC,UAAU;AAC/B,oBAAM,OAAQ;AAAA,YAC1C,CAAyB;AAAA,UACzB;AAEoB,eAAK;AAAA,YACD,IAAI,YAAY,+BAA+B;AAAA,cAC3C,SAAS;AAAA,cACT,UAAU;AAAA,YACb,CAAA;AAAA,UACJ;AAAA,QACrB,CAAiB;AAAA,MACjB;AAAA,IACA,CAAS;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOI,MAAM,OAAO,OAAO;AAChB,QAAI,KAAK,SAAS;AACd,YAAM,KAAK,MAAM,KAAK;AAAA,IAClC,OAAe;AACH,YAAM,KAAK,KAAK,KAAK;AAAA,IACjC;AAAA,EACA;AAAA,EAEI,mBAAmB;;AACf,eAAK,oBAAL,mBAAsB;AACtB,SAAK,kBAAkB;AAAA,EAC/B;AACA;ACvkBA,iBAAiB,OAAO,yBAAyB,gBAAgB;"}
@@ -14,6 +14,9 @@ class Tooltip extends WJElement {
14
14
  * @type {string}
15
15
  */
16
16
  __publicField(this, "className", "Tooltip");
17
+ __publicField(this, "popupHideCallback", () => {
18
+ this.onHide();
19
+ });
17
20
  /**
18
21
  * Handles the logic for showing the component's popup or tooltip.
19
22
  * Adds the `active` class, invokes lifecycle hooks, and manages the popup visibility.
@@ -21,6 +24,7 @@ class Tooltip extends WJElement {
21
24
  */
22
25
  __publicField(this, "onShow", () => {
23
26
  var _a;
27
+ event.addListener(this, "wje-popup:hide", null, this.popupHideCallback);
24
28
  this.classList.add("active");
25
29
  if ((_a = this.querySelector("wje-dropdown")) == null ? void 0 : _a.classList.contains("active")) {
26
30
  return;
@@ -42,6 +46,7 @@ class Tooltip extends WJElement {
42
46
  * Removes the `active` class from the component and hides the popup element.
43
47
  */
44
48
  __publicField(this, "onHide", () => {
49
+ event.removeListener(this, "wje-popup:hide", null, this.popupHideCallback);
45
50
  this.classList.remove("active");
46
51
  this.popup.hide();
47
52
  });
@@ -132,6 +137,12 @@ class Tooltip extends WJElement {
132
137
  event.addListener(this, "wje-dropdown:open", null, this.onHide);
133
138
  event.addListener(this, "wje-dropdown:close", null, this.onShow);
134
139
  }
140
+ afterDisconnect() {
141
+ event.removeListener(this, "wje-dropdown:open", null, this.onHide);
142
+ event.removeListener(this, "wje-dropdown:close", null, this.onShow);
143
+ event.removeListener(this, "mouseenter", null, this.onShow);
144
+ event.removeListener(this, "mouseleave", null, this.onHide);
145
+ }
135
146
  dispatch(customEvent) {
136
147
  return new Promise((resolve) => {
137
148
  event.dispatchCustomEvent(this, customEvent, {
@@ -1 +1 @@
1
- {"version":3,"file":"wje-tooltip.js","sources":["../packages/wje-tooltip/tooltip.element.js","../packages/wje-tooltip/tooltip.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Tooltip` is a custom web component that represents a tooltip.\n * @summary This element represents a tooltip.\n * @documentation https://elements.webjet.sk/components/tooltip\n * @status stable\n * @augments {WJElement}\n * @attribute {string} content - The content of the tooltip element. Accepts any valid string value.\n * @slot arrow - The arrow slot for the tooltip.\n * @slot anchor - The anchor slot for the tooltip.\n * @csspart native - The native tooltip wrapper.\n * @cssproperty [--wje-tooltip-arrow-color=var(--wje-color-contrast-11)] - Specifies the color of the tooltip's arrow. This property determines the visual color of the arrow that points to the element the tooltip is attached to. Accepts any valid CSS color value such as `hex`, `rgb`, or `CSS variable`.\n * @tag wje-tooltip\n */\nexport default class Tooltip extends WJElement {\n /**\n * Creates an instance of Tooltip.\n */\n constructor() {\n super();\n }\n\n /**\n * Set active attribute for the tooltip element.\n * @param value\n */\n set content(value) {\n this.setAttribute('content', value);\n }\n\n /**\n * Get active attribute for the tooltip element.\n * @returns {string}\n */\n get content() {\n if (this.hasAttribute('content')) return this.getAttribute('content');\n\n return '';\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Tooltip';\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 * Returns the list of observed attributes.\n * @static\n * @returns {Array} An array of observed attributes\n */\n static get observedAttributes() {\n return ['active'];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the tooltip.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let popup = document.createElement('wje-popup');\n popup.setAttribute('placement', this.placement || 'top');\n popup.setAttribute('offset', this.offset || '0');\n\n // SLOT - Anchor\n let slot = document.createElement('slot');\n slot.setAttribute('slot', 'anchor');\n\n // let slot = this.querySelector(\"wje-button\");\n\n let arrow = document.createElement('div');\n arrow.classList.add('arrow');\n arrow.setAttribute('slot', 'arrow');\n\n // SLOT - Start\n let start = document.createElement('slot');\n start.setAttribute('name', 'start');\n\n // SLOT - End\n let end = document.createElement('slot');\n end.setAttribute('name', 'end');\n\n let content = document.createElement('div');\n content.innerHTML = this.content;\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-tooltip');\n\n native.appendChild(start);\n native.appendChild(content);\n native.appendChild(end);\n\n popup.appendChild(slot);\n popup.appendChild(arrow);\n popup.appendChild(native);\n\n this.mySlot = slot;\n this.popup = popup;\n this.native = native;\n\n fragment.appendChild(popup);\n\n return fragment;\n }\n\n /**\n * Draws the component for the tooltip.\n */\n afterDraw() {\n let anchorEl = this.mySlot.assignedElements()[0];\n if (this.selector) {\n anchorEl = this.checkSelector(anchorEl);\n }\n\n if (!anchorEl) return;\n\n event.addListener(anchorEl, 'mouseenter', null, this.onShow);\n event.addListener(anchorEl, 'mouseleave', null, this.onHide);\n event.addListener(this, 'wje-dropdown:open', null, this.onHide);\n event.addListener(this, 'wje-dropdown:close', null, this.onShow);\n }\n\n dispatch(customEvent) {\n return new Promise((resolve) => {\n event.dispatchCustomEvent(this, customEvent, {\n resolve: resolve,\n });\n });\n }\n\n beforeShow() {\n return this.native.innerHTML;\n }\n\n afterShow() {\n return true;\n }\n\n /**\n * Handles the logic for showing the component's popup or tooltip.\n * Adds the `active` class, invokes lifecycle hooks, and manages the popup visibility.\n * @throws {Error} If the `beforeShow` method returns a non-string value or `false`.\n */\n onShow = () => {\n this.classList.add('active');\n\n if (this.querySelector('wje-dropdown')?.classList.contains('active')) {\n return;\n }\n\n Promise.resolve(this.beforeShow(this))\n .then((res) => {\n if (!this.classList.contains('active') || !res || typeof res !== 'string') {\n throw new Error('beforeShow method returned false or not string');\n }\n\n this.native.innerHTML = res;\n\n this.popup.show(); // Show tooltip\n\n Promise.resolve(this.afterShow(this));\n })\n .catch(() => {\n // ak je nejaka chyba tak to len zatvorime\n this.classList.remove('active');\n this.popup.hide();\n });\n };\n\n /**\n * Hides the component's popup or tooltip.\n * Removes the `active` class from the component and hides the popup element.\n */\n onHide = () => {\n this.classList.remove('active');\n this.popup.hide();\n };\n\n /**\n * Validates if the specified selector exists within the provided element.\n * Logs an error if the selector is not found and returns the found element or `null`.\n * @param {HTMLElement} anchorEl The root element to search within.\n * @returns {HTMLElement|null} The first element matching the selector, or `null` if not found.\n */\n checkSelector(anchorEl) {\n const newAnchorEl = anchorEl.querySelector(this.selector);\n if (newAnchorEl === null) {\n console.error('Selector not found:', this.selector);\n }\n\n return newAnchorEl;\n }\n}\n","import Tooltip from './tooltip.element.js';\n\nexport default Tooltip;\n\nTooltip.define('wje-tooltip', Tooltip);\n"],"names":[],"mappings":";;;;;AAgBe,MAAM,gBAAgB,UAAU;AAAA;AAAA;AAAA;AAAA,EAI3C,cAAc;AACV,UAAO;AAyBX;AAAA;AAAA;AAAA;AAAA,qCAAY;AAsHZ;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAS,MAAM;;AACX,WAAK,UAAU,IAAI,QAAQ;AAE3B,WAAI,UAAK,cAAc,cAAc,MAAjC,mBAAoC,UAAU,SAAS,WAAW;AAClE;AAAA,MACZ;AAEQ,cAAQ,QAAQ,KAAK,WAAW,IAAI,CAAC,EA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EAC3B;AAAA,EAEI,YAAY;AACR,WAAO;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgDI,cAAc,UAAU;AACpB,UAAM,cAAc,SAAS,cAAc,KAAK,QAAQ;AACxD,QAAI,gBAAgB,MAAM;AACtB,cAAQ,MAAM,uBAAuB,KAAK,QAAQ;AAAA,IAC9D;AAEQ,WAAO;AAAA,EACf;AACA;ACjNA,QAAQ,OAAO,eAAe,OAAO;"}
1
+ {"version":3,"file":"wje-tooltip.js","sources":["../packages/wje-tooltip/tooltip.element.js","../packages/wje-tooltip/tooltip.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Tooltip` is a custom web component that represents a tooltip.\n * @summary This element represents a tooltip.\n * @documentation https://elements.webjet.sk/components/tooltip\n * @status stable\n * @augments {WJElement}\n * @attribute {string} content - The content of the tooltip element. Accepts any valid string value.\n * @slot arrow - The arrow slot for the tooltip.\n * @slot anchor - The anchor slot for the tooltip.\n * @csspart native - The native tooltip wrapper.\n * @cssproperty [--wje-tooltip-arrow-color=var(--wje-color-contrast-11)] - Specifies the color of the tooltip's arrow. This property determines the visual color of the arrow that points to the element the tooltip is attached to. Accepts any valid CSS color value such as `hex`, `rgb`, or `CSS variable`.\n * @tag wje-tooltip\n */\nexport default class Tooltip extends WJElement {\n /**\n * Creates an instance of Tooltip.\n */\n constructor() {\n super();\n }\n\n /**\n * Set active attribute for the tooltip element.\n * @param value\n */\n set content(value) {\n this.setAttribute('content', value);\n }\n\n /**\n * Get active attribute for the tooltip element.\n * @returns {string}\n */\n get content() {\n if (this.hasAttribute('content')) return this.getAttribute('content');\n\n return '';\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Tooltip';\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 * Returns the list of observed attributes.\n * @static\n * @returns {Array} An array of observed attributes\n */\n static get observedAttributes() {\n return ['active'];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the tooltip.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let popup = document.createElement('wje-popup');\n popup.setAttribute('placement', this.placement || 'top');\n popup.setAttribute('offset', this.offset || '0');\n\n // SLOT - Anchor\n let slot = document.createElement('slot');\n slot.setAttribute('slot', 'anchor');\n\n // let slot = this.querySelector(\"wje-button\");\n\n let arrow = document.createElement('div');\n arrow.classList.add('arrow');\n arrow.setAttribute('slot', 'arrow');\n\n // SLOT - Start\n let start = document.createElement('slot');\n start.setAttribute('name', 'start');\n\n // SLOT - End\n let end = document.createElement('slot');\n end.setAttribute('name', 'end');\n\n let content = document.createElement('div');\n content.innerHTML = this.content;\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-tooltip');\n\n native.appendChild(start);\n native.appendChild(content);\n native.appendChild(end);\n\n popup.appendChild(slot);\n popup.appendChild(arrow);\n popup.appendChild(native);\n\n this.mySlot = slot;\n this.popup = popup;\n this.native = native;\n\n fragment.appendChild(popup);\n\n return fragment;\n }\n\n /**\n * Draws the component for the tooltip.\n */\n afterDraw() {\n let anchorEl = this.mySlot.assignedElements()[0];\n if (this.selector) {\n anchorEl = this.checkSelector(anchorEl);\n }\n\n if (!anchorEl) return;\n\n event.addListener(anchorEl, 'mouseenter', null, this.onShow);\n event.addListener(anchorEl, 'mouseleave', null, this.onHide);\n event.addListener(this, 'wje-dropdown:open', null, this.onHide);\n event.addListener(this, 'wje-dropdown:close', null, this.onShow);\n }\n\n afterDisconnect() {\n event.removeListener(this, 'wje-dropdown:open', null, this.onHide);\n event.removeListener(this, 'wje-dropdown:close', null, this.onShow);\n event.removeListener(this, 'mouseenter', null, this.onShow);\n event.removeListener(this, 'mouseleave', null, this.onHide);\n }\n\n dispatch(customEvent) {\n return new Promise((resolve) => {\n event.dispatchCustomEvent(this, customEvent, {\n resolve: resolve,\n });\n });\n }\n\n beforeShow() {\n return this.native.innerHTML;\n }\n\n afterShow() {\n return true;\n }\n\n popupHideCallback = () => {\n this.onHide();\n };\n\n /**\n * Handles the logic for showing the component's popup or tooltip.\n * Adds the `active` class, invokes lifecycle hooks, and manages the popup visibility.\n * @throws {Error} If the `beforeShow` method returns a non-string value or `false`.\n */\n onShow = () => {\n event.addListener(this, 'wje-popup:hide', null, this.popupHideCallback);\n\n this.classList.add('active');\n\n if (this.querySelector('wje-dropdown')?.classList.contains('active')) {\n return;\n }\n\n Promise.resolve(this.beforeShow(this))\n .then((res) => {\n if (!this.classList.contains('active') || !res || typeof res !== 'string') {\n throw new Error('beforeShow method returned false or not string');\n }\n\n this.native.innerHTML = res;\n\n this.popup.show(); // Show tooltip\n\n Promise.resolve(this.afterShow(this));\n })\n .catch(() => {\n // ak je nejaka chyba tak to len zatvorime\n this.classList.remove('active');\n this.popup.hide();\n });\n };\n\n /**\n * Hides the component's popup or tooltip.\n * Removes the `active` class from the component and hides the popup element.\n */\n onHide = () => {\n event.removeListener(this, 'wje-popup:hide', null, this.popupHideCallback);\n\n this.classList.remove('active');\n this.popup.hide();\n };\n\n /**\n * Validates if the specified selector exists within the provided element.\n * Logs an error if the selector is not found and returns the found element or `null`.\n * @param {HTMLElement} anchorEl The root element to search within.\n * @returns {HTMLElement|null} The first element matching the selector, or `null` if not found.\n */\n checkSelector(anchorEl) {\n const newAnchorEl = anchorEl.querySelector(this.selector);\n if (newAnchorEl === null) {\n console.error('Selector not found:', this.selector);\n }\n\n return newAnchorEl;\n }\n}\n","import Tooltip from './tooltip.element.js';\n\nexport default Tooltip;\n\nTooltip.define('wje-tooltip', Tooltip);\n"],"names":[],"mappings":";;;;;AAgBe,MAAM,gBAAgB,UAAU;AAAA;AAAA;AAAA;AAAA,EAI3C,cAAc;AACV,UAAO;AAyBX;AAAA;AAAA;AAAA;AAAA,q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AM,KAAK,MAAM;AAC3D,UAAM,YAAY,UAAU,cAAc,MAAM,KAAK,MAAM;AAC3D,UAAM,YAAY,MAAM,qBAAqB,MAAM,KAAK,MAAM;AAC9D,UAAM,YAAY,MAAM,sBAAsB,MAAM,KAAK,MAAM;AAAA,EACvE;AAAA,EAEI,kBAAkB;AACd,UAAM,eAAe,MAAM,qBAAqB,MAAM,KAAK,MAAM;AACjE,UAAM,eAAe,MAAM,sBAAsB,MAAM,KAAK,MAAM;AAClE,UAAM,eAAe,MAAM,cAAc,MAAM,KAAK,MAAM;AAC1D,UAAM,eAAe,MAAM,cAAc,MAAM,KAAK,MAAM;AAAA,EAClE;AAAA,EAEI,SAAS,aAAa;AAClB,WAAO,IAAI,QAAQ,CAAC,YAAY;AAC5B,YAAM,oBAAoB,MAAM,aAAa;AAAA,QACzC;AAAA,MAChB,CAAa;AAAA,IACb,CAAS;AAAA,EACT;AAAA,EAEI,aAAa;AACT,WAAO,KAAK,OAAO;AAAA,EAC3B;AAAA,EAEI,YAAY;AACR,WAAO;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwDI,cAAc,UAAU;AACpB,UAAM,cAAc,SAAS,cAAc,KAAK,QAAQ;AACxD,QAAI,gBAAgB,MAAM;AACtB,cAAQ,MAAM,uBAAuB,KAAK,QAAQ;AAAA,IAC9D;AAEQ,WAAO;AAAA,EACf;AACA;AChOA,QAAQ,OAAO,eAAe,OAAO;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wj-elements",
3
3
  "description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
4
- "version": "0.1.154",
4
+ "version": "0.1.156",
5
5
  "homepage": "https://github.com/lencys/wj-elements",
6
6
  "author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
7
7
  "license": "MIT",
@@ -35,26 +35,22 @@
35
35
  "preview": "vite preview --mode production",
36
36
  "watch": "vite build --watch --mode development",
37
37
  "analyze": "cem analyze",
38
- "create-element": "node wje-cli-script/create-element.cjs paginationys",
38
+ "create-element": "node wje-cli-script/create-element.cjs",
39
39
  "copy-dist": "node wje-cli-script/copy-dist.cjs",
40
40
  "build:copy-dist": "npm run build && npm run copy-dist -- /Users/rastislavhrompa/Desktop/Interway-MFE/root/node_modules/wj-elements",
41
41
  "test": "web-test-runner --group default",
42
42
  "test:watch": "web-test-runner --watch --group default",
43
- "lint": "eslint packages --max-warnings 0",
44
- "lint:fix": "eslint packages --max-warnings 0 --fix",
45
- "prettier": "prettier --write ./packages",
43
+ "lint": "eslint packages experimental-packages --max-warnings 0",
44
+ "lint:fix": "eslint packages experimental-packages --max-warnings 0 --fix",
45
+ "prettier": "prettier --write ./packages ./experimental-packages",
46
46
  "test:animation": "web-test-runner --files packages/wje-animation/animation.test.js",
47
- "test:avatar": "web-test-runner --files packages/wje-avatar/avatar.test.js",
48
47
  "test:badge": "web-test-runner --files packages/wje-badge/badge.test.js",
49
48
  "test:breadcrumbs": "web-test-runner --files packages/wje-breadcrumbs/breadcrumbs.test.js",
50
49
  "test:button": "web-test-runner --files packages/wje-button/button.test.js",
51
50
  "test:color-picker": "web-test-runner --files packages/wje-color-picker/color-picker.test.js",
52
51
  "test:format-digital": "web-test-runner --files packages/wje-format-digital/format-digital.test.js",
53
52
  "test:relative-time": "web-test-runner --files packages/wje-relative-time/relative-time.test.js",
54
- "test:toast": "web-test-runner --files packages/wje-toast/toast.test.js",
55
- "test:pagination": "web-test-runner --files packages/wje-pagination/pagination.test.js",
56
- "test:tree": "web-test-runner --files packages/wje-tree/tree.test.js",
57
- "test:tree-item": "web-test-runner --files packages/wje-tree-item/tree-item.test.js"
53
+ "test:toast": "web-test-runner --files packages/wje-toast/toast.test.js"
58
54
  },
59
55
  "exports": {
60
56
  ".": {
@@ -76,7 +72,6 @@
76
72
  "@crowdin/cli": "^3.19.2",
77
73
  "@faker-js/faker": "^8.0.0",
78
74
  "@floating-ui/dom": "^1.5.1",
79
- "ajv": "^8.17.1",
80
75
  "animate.css": "^4.1.1",
81
76
  "qrious": "^4.0.2",
82
77
  "slick-router": "^3.0.1",
@@ -111,4 +106,4 @@
111
106
  "vite-plugin-dts": "^4.5.0",
112
107
  "vite-plugin-javascript-obfuscator": "^3.1.0"
113
108
  }
114
- }
109
+ }
File without changes
@@ -1 +0,0 @@
1
- export {};