diff --git a/composer.json b/composer.json index fa891f66a3..d5ae9f6cda 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "ibexa/content-forms": "~5.0.x-dev", "ibexa/core": "~5.0.x-dev", "ibexa/design-engine": "~5.0.x-dev", + "ibexa/design-system-twig": "~5.0.x-dev", "ibexa/polyfill-php82": "^1.0", "ibexa/rest": "~5.0.x-dev", "ibexa/search": "~5.0.x-dev", @@ -97,5 +98,11 @@ "branch-alias": { "dev-main": "5.0.x-dev" } - } + }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/ibexa/design-system-twig" + } + ] } diff --git a/src/bundle/Resources/encore/ibexa.css.config.js b/src/bundle/Resources/encore/ibexa.css.config.js index 62dfba962e..7fd3ddf71b 100644 --- a/src/bundle/Resources/encore/ibexa.css.config.js +++ b/src/bundle/Resources/encore/ibexa.css.config.js @@ -5,6 +5,7 @@ module.exports = (Encore) => { path.resolve(__dirname, '../public/scss/ibexa-bootstrap.scss'), path.resolve(__dirname, '../public/scss/ibexa.scss'), path.resolve(__dirname, '../public/scss/ui/ibexa-modules.scss'), + path.resolve('./vendor/ibexa/admin-ui-assets/src/bundle/Resources/public/vendors/ids-assets/dist/css/styles.css'), path.resolve('./vendor/ibexa/admin-ui-assets/src/bundle/Resources/public/vendors/flatpickr/dist/flatpickr.min.css'), path.resolve( './vendor/ibexa/admin-ui-assets/src/bundle/Resources/public/vendors/flatpickr/dist/plugins/confirmDate/confirmDate.css', @@ -18,6 +19,7 @@ module.exports = (Encore) => { ]) .addEntry('ibexa-admin-ui-security-base-css', [ path.resolve(__dirname, '../public/scss/ibexa-bootstrap.scss'), + path.resolve('./vendor/ibexa/admin-ui-assets/src/bundle/Resources/public/vendors/ids-assets/dist/css/styles.css'), path.resolve(__dirname, '../public/scss/ibexa.scss'), ]); }; diff --git a/src/bundle/Resources/public/js/scripts/admin.search.filters.js b/src/bundle/Resources/public/js/scripts/admin.search.filters.js index d8309b363d..9fb6be722f 100644 --- a/src/bundle/Resources/public/js/scripts/admin.search.filters.js +++ b/src/bundle/Resources/public/js/scripts/admin.search.filters.js @@ -1,9 +1,11 @@ +import Chip from '@ibexa-design-system/src/bundle/Resources/public/ts/components/chip'; + (function (global, doc, ibexa, flatpickr, React, ReactDOMClient) { const { escapeHTML, escapeHTMLAttribute } = ibexa.helpers.text; const { dangerouslySetInnerHTML } = ibexa.helpers.dom; const { getInstance } = ibexa.helpers.objectInstances; let getUsersTimeout; - const SELECTOR_TAG = '.ibexa-tag'; + const SELECTOR_TAG = '.ids-chip'; const token = doc.querySelector('meta[name="CSRF-Token"]').content; const siteaccess = doc.querySelector('meta[name="SiteAccess"]').content; const filters = doc.querySelector('.ibexa-filters'); @@ -233,7 +235,7 @@ form.submit(); }; const clearContentType = (event) => { - const checkbox = doc.querySelector(event.currentTarget.dataset.targetSelector); + const checkbox = doc.querySelector(event.currentTarget.closest('.ids-chip').dataset.targetSelector); checkbox.checked = false; removeSearchTag(event); @@ -264,6 +266,21 @@ 'last-modified': (event) => clearDataRange(event, lastModifiedSelect, lastModifiedDateRange), 'last-created': (event) => clearDataRange(event, lastCreatedSelect, lastCreatedDateRange), }; + const initSearchTagChips = () => { + for (const tagType in clearSearchTagBtnMethods) { + const chips = doc.querySelectorAll(`.ibexa-search-criteria-tags__tag--${tagType}.ids-chip`); + + chips.forEach((chip) => { + if (!chip.dataset.idsInitialized) { + const chipInstance = new Chip(chip); + + chipInstance.init(); + } + + chip.addEventListener('ids:chip:delete:before', clearSearchTagBtnMethods[tagType], false); + }); + } + }; const showMoreContentTypes = (event) => { const btn = event.currentTarget; const contentTypesList = btn @@ -314,11 +331,7 @@ sectionSelect.addEventListener('change', toggleDisabledStateOnApplyBtn, false); } - for (const tagType in clearSearchTagBtnMethods) { - const tagBtns = doc.querySelectorAll(`.ibexa-tag__remove-btn--${tagType}`); - - tagBtns.forEach((btn) => btn.addEventListener('click', clearSearchTagBtnMethods[tagType], false)); - } + initSearchTagChips(); lastModifiedPeriod.addEventListener('change', toggleDisabledStateOnApplyBtn, false); lastModifiedStartDate.addEventListener('change', toggleDisabledStateOnApplyBtn, false); diff --git a/src/bundle/Resources/views/themes/admin/ui/search/criteria_tags.html.twig b/src/bundle/Resources/views/themes/admin/ui/search/criteria_tags.html.twig index 4bf8b8dd65..1f76b25d90 100644 --- a/src/bundle/Resources/views/themes/admin/ui/search/criteria_tags.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/search/criteria_tags.html.twig @@ -2,13 +2,11 @@
diff --git a/src/bundle/Resources/views/themes/admin/ui/search_tag.html.twig b/src/bundle/Resources/views/themes/admin/ui/search_tag.html.twig index a762e503a2..a4cde363ac 100644 --- a/src/bundle/Resources/views/themes/admin/ui/search_tag.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/search_tag.html.twig @@ -1,19 +1,12 @@ -{% set btn_class = btn_class|default('') %} +{% set tag_class = tag_class|default('') %} {% set content = content|default('') %} {% set target_selector = target_selector|default('') %} {% set title = title|default('') %} - +