diff --git a/src/bundle/Resources/public/js/scripts/core/taggify.js b/src/bundle/Resources/public/js/scripts/core/taggify.js index e9e90232c2..6a8faa9e2b 100644 --- a/src/bundle/Resources/public/js/scripts/core/taggify.js +++ b/src/bundle/Resources/public/js/scripts/core/taggify.js @@ -18,7 +18,7 @@ return this.acceptKeys.includes(key); } - addTag(name, value) { + addTag(name, value, dataset = {}) { const tagTemplate = this.listNode.dataset.template; const renderedTemplate = tagTemplate.replace('{{ name }}', name).replace('{{ value }}', value); const div = doc.createElement('div'); @@ -27,6 +27,8 @@ const tag = div.querySelector('.ibexa-taggify__list-tag'); + Object.entries(dataset).forEach(([datasetKey, datasetValue]) => (tag.dataset[datasetKey] = datasetValue)); + this.attachEventsToTag(tag, value); this.listNode.insertBefore(tag, this.inputNode); this.tags.add(value); diff --git a/src/bundle/Resources/public/scss/_taggify.scss b/src/bundle/Resources/public/scss/_taggify.scss index 683939b1d0..2a689aae2a 100644 --- a/src/bundle/Resources/public/scss/_taggify.scss +++ b/src/bundle/Resources/public/scss/_taggify.scss @@ -27,6 +27,16 @@ opacity: 0; } } + + &--danger { + background: $ibexa-color-danger-100; + border-color: $ibexa-color-danger-100; + color: $ibexa-color-danger-600; + + .ibexa-icon { + fill: $ibexa-color-danger-600; + } + } } &__input {