diff --git a/features/standard/UserCreation.feature b/features/standard/UserCreation.feature index 4bfe8d89d9..624e81c2e9 100644 --- a/features/standard/UserCreation.feature +++ b/features/standard/UserCreation.feature @@ -37,8 +37,8 @@ Feature: User management | First name | testuseredited | | Last name | lastnameedited | And I set content fields for user - | label | Username | Password | Confirm password | Email | - | User account | testuser | Test123456 | Test123456 | test@test.org | + | label | Username | Password | Confirm password | Email | Enabled | + | User account | testuser | Test123456 | Test123456 | test@test.org | Yes | And I perform the "Update" action Then I should be on Content view Page for "Users/testuseredited lastnameedited" And content attributes equal diff --git a/src/bundle/Resources/encore/ibexa.css.config.js b/src/bundle/Resources/encore/ibexa.css.config.js index 62dfba962e..283f45eb1f 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', diff --git a/src/bundle/Resources/encore/ibexa.js.config.js b/src/bundle/Resources/encore/ibexa.js.config.js index 30b8296fd9..89e6e1fedb 100644 --- a/src/bundle/Resources/encore/ibexa.js.config.js +++ b/src/bundle/Resources/encore/ibexa.js.config.js @@ -49,6 +49,7 @@ const layout = [ path.resolve(__dirname, '../public/js/scripts/admin.focus.mode.js'), path.resolve(__dirname, '../public/js/scripts/sidebar/main.menu.js'), path.resolve(__dirname, '../public/js/scripts/admin.input.text.js'), + path.resolve('./vendor/ibexa/design-system-twig/src/bundle/Resources/public/ts/init_components.ts'), path.resolve(__dirname, '../public/js/scripts/admin.table.js'), path.resolve(__dirname, '../public/js/scripts/core/collapse.js'), path.resolve(__dirname, '../public/js/scripts/admin.dropdown.js'), diff --git a/src/bundle/Resources/public/js/scripts/admin.notifications.filters.js b/src/bundle/Resources/public/js/scripts/admin.notifications.filters.js index 33fb21d9d9..f2027fbf72 100644 --- a/src/bundle/Resources/public/js/scripts/admin.notifications.filters.js +++ b/src/bundle/Resources/public/js/scripts/admin.notifications.filters.js @@ -1,4 +1,5 @@ (function (global, doc) { + const SELECTOR_FILTER_CHECKBOX = '.ids-input--checkbox:not([name="dropdown-checkbox"])'; const searchForm = doc.querySelector('.ibexa-list-search-form'); const filtersContainerNode = doc.querySelector('.ibexa-list-filters'); const applyFiltersBtn = filtersContainerNode.querySelector('.ibexa-btn--apply'); @@ -13,9 +14,7 @@ } const sourceSelect = filterNode.querySelector('.ibexa-list-filters__item-content .ibexa-dropdown__source .ibexa-input--select'); - const checkboxes = filterNode.querySelectorAll( - '.ibexa-list-filters__item-content .ibexa-input--checkbox:not([name="dropdown-checkbox"])', - ); + const checkboxes = filterNode.querySelectorAll(`.ibexa-list-filters__item-content ${SELECTOR_FILTER_CHECKBOX}`); const timePicker = filterNode.querySelector('.ibexa-date-time-picker__input'); if (sourceSelect) { @@ -45,9 +44,7 @@ return; } - const checkboxes = filterNode.querySelectorAll( - '.ibexa-list-filters__item-content .ibexa-input--checkbox:not([name="dropdown-checkbox"])', - ); + const checkboxes = filterNode.querySelectorAll(`.ibexa-list-filters__item-content ${SELECTOR_FILTER_CHECKBOX}`); checkboxes.forEach((checkbox) => { checkbox.addEventListener('change', filterChange, false); }); @@ -80,7 +77,7 @@ } const select = filterNode.querySelector('.ibexa-dropdown__source .ibexa-input--select'); - const checkedCheckboxes = filterNode.querySelectorAll('.ibexa-input--checkbox:checked'); + const checkedCheckboxes = filterNode.querySelectorAll(`${SELECTOR_FILTER_CHECKBOX}:checked`); if (isNodeDatePicker(filterNode)) { const timePicker = filterNode.querySelector('.ibexa-date-time-picker__input'); diff --git a/src/bundle/Resources/public/js/scripts/admin.notifications.list.js b/src/bundle/Resources/public/js/scripts/admin.notifications.list.js index e17cdcb55a..10ab3a0dee 100644 --- a/src/bundle/Resources/public/js/scripts/admin.notifications.list.js +++ b/src/bundle/Resources/public/js/scripts/admin.notifications.list.js @@ -1,6 +1,7 @@ import { isFirefox } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/browser.helper.js'; (function (global, doc, ibexa, Translator, Routing) { + const SELECTOR_NOTIFICATION_CHECKBOX = '.ibexa-notification-list__mark-row-checkbox'; const SELECTOR_MODAL_ITEM = '.ibexa-notifications-modal__item'; const SELECTOR_GO_TO_NOTIFICATION = '.ibexa-notification-view-all__show'; const SELECTOR_TOGGLE_NOTIFICATION = '.ibexa-notification-view-all__mail'; @@ -10,7 +11,7 @@ import { isFirefox } from '@ibexa-admin-ui/src/bundle/Resources/public/js/script const markAsReadBtn = doc.querySelector('.ibexa-notification-list__btn-mark-as-read'); const deleteBtn = doc.querySelector('.ibexa-notification-list__btn-delete'); const notificationsCheckboxes = [ - ...doc.querySelectorAll('.ibexa-notification-list .ibexa-table__cell--has-checkbox .ibexa-input--checkbox'), + ...doc.querySelectorAll(`.ibexa-notification-list .ibexa-table__cell--has-checkbox ${SELECTOR_NOTIFICATION_CHECKBOX}`), ]; const notificationsTable = doc.querySelector('.ibexa-table--notifications'); const uncheckCheckboxesEvent = new CustomEvent('ibexa-uncheck-checkboxes', { diff --git a/src/bundle/Resources/public/js/scripts/admin.table.js b/src/bundle/Resources/public/js/scripts/admin.table.js index cd95832999..325c822c9c 100644 --- a/src/bundle/Resources/public/js/scripts/admin.table.js +++ b/src/bundle/Resources/public/js/scripts/admin.table.js @@ -1,4 +1,5 @@ (function (global, doc) { + const SELECTOR_TABLE_CHECKBOX = '.ids-input--checkbox'; const ibexaTables = doc.querySelectorAll('.ibexa-table'); const setMainCheckboxState = (mainCheckbox, subCheckboxes, event) => { const isFromJS = event?.detail?.isFromJS ?? false; @@ -61,9 +62,9 @@ } const mainCheckboxIndex = [...headCells].indexOf(headCellWithCheckbox); - const mainCheckbox = headCellWithCheckbox.querySelector('.ibexa-input--checkbox'); + const mainCheckbox = headCellWithCheckbox.querySelector(SELECTOR_TABLE_CHECKBOX); const subCheckboxes = tableBody.querySelectorAll( - `.ibexa-table__cell--has-checkbox:nth-child(${mainCheckboxIndex + 1}) .ibexa-input--checkbox`, + `.ibexa-table__cell--has-checkbox:nth-child(${mainCheckboxIndex + 1}) ${SELECTOR_TABLE_CHECKBOX}`, ); if (!mainCheckbox) { @@ -138,7 +139,7 @@ const uncheckCheckboxes = (table) => { const mainCheckbox = table.querySelector('.ibexa-table__header-cell-checkbox'); - const subCheckboxes = [...table.querySelectorAll('.ibexa-table__cell--has-checkbox .ibexa-input--checkbox')]; + const subCheckboxes = [...table.querySelectorAll(`.ibexa-table__cell--has-checkbox ${SELECTOR_TABLE_CHECKBOX}`)]; mainCheckbox.checked = false; mainCheckbox.indeterminate = false; diff --git a/src/bundle/Resources/public/js/scripts/button.state.toggle.js b/src/bundle/Resources/public/js/scripts/button.state.toggle.js index a06a27b90f..e17acd6ac0 100644 --- a/src/bundle/Resources/public/js/scripts/button.state.toggle.js +++ b/src/bundle/Resources/public/js/scripts/button.state.toggle.js @@ -1,8 +1,9 @@ (function (global, doc) { + const SELECTOR_TABLE_CHECKBOX = '.ids-input--checkbox'; const toggleForms = doc.querySelectorAll('.ibexa-toggle-btn-state'); toggleForms.forEach((toggleForm) => { - const checkboxes = [...toggleForm.querySelectorAll('.ibexa-table__cell--has-checkbox .ibexa-input--checkbox')]; + const checkboxes = [...toggleForm.querySelectorAll(`.ibexa-table__cell--has-checkbox ${SELECTOR_TABLE_CHECKBOX}`)]; const buttonRemove = doc.querySelector(toggleForm.dataset.toggleButtonId); if (!buttonRemove) { diff --git a/src/bundle/Resources/public/js/scripts/core/dropdown.js b/src/bundle/Resources/public/js/scripts/core/dropdown.js index b69bf0c740..f587021d99 100644 --- a/src/bundle/Resources/public/js/scripts/core/dropdown.js +++ b/src/bundle/Resources/public/js/scripts/core/dropdown.js @@ -152,7 +152,7 @@ this.sourceInput.querySelectorAll('option').forEach((option) => (option.selected = false)); this.itemsListContainer.querySelectorAll('.ibexa-dropdown__item--selected').forEach((option) => { - const checkbox = option.querySelector('.ibexa-input--checkbox'); + const checkbox = option.querySelector('.ibexa-dropdown__item-checkbox'); option.classList.remove('ibexa-dropdown__item--selected'); @@ -211,7 +211,11 @@ const value = this.getValueFromElement(element); if (value && !this.canSelectOnlyOne) { - element.querySelector('.ibexa-input').checked = selected; + const checkbox = element.querySelector('.ibexa-dropdown__item-checkbox'); + + if (checkbox) { + checkbox.checked = selected; + } } this.itemsListContainer.querySelector(`[data-value=${value}]`).classList.toggle('ibexa-dropdown__item--selected', selected); @@ -314,7 +318,11 @@ itemSelected.classList.remove('ibexa-dropdown__item--selected'); if (!this.canSelectOnlyOne) { - itemSelected.querySelector('.ibexa-input').checked = false; + const checkbox = itemSelected.querySelector('.ibexa-dropdown__item-checkbox'); + + if (checkbox) { + checkbox.checked = false; + } } if (optionSelect) { diff --git a/src/bundle/Resources/public/js/scripts/core/toggle.button.js b/src/bundle/Resources/public/js/scripts/core/toggle.button.js index 19bf315f33..1a7a6580fe 100644 --- a/src/bundle/Resources/public/js/scripts/core/toggle.button.js +++ b/src/bundle/Resources/public/js/scripts/core/toggle.button.js @@ -4,7 +4,10 @@ class ToggleButton { constructor(config) { this.toggleNode = config.toggleNode; - this.inputsSelector = config?.inputsSelector || 'input'; + this.inputsSelector = config?.inputsSelector || (this.toggleNode.classList.contains('ids-toggle') ? '.ids-toggle__source input' : 'input'); + this.checkedClass = this.toggleNode.classList.contains('ids-toggle') ? 'ids-toggle--checked' : 'ibexa-toggle--is-checked'; + this.disabledClass = this.toggleNode.classList.contains('ids-toggle') ? 'ids-toggle--disabled' : 'ibexa-toggle--is-disabled'; + this.focusedClass = this.toggleNode.classList.contains('ids-toggle') ? 'ids-toggle--focused' : 'ibexa-toggle--is-focused'; this.toggleState = this.toggleState.bind(this); this.addFocus = this.addFocus.bind(this); @@ -18,18 +21,18 @@ const toggler = event.currentTarget; - if (toggler.classList.contains('ibexa-toggle--is-disabled')) { + if (toggler.classList.contains(this.disabledClass)) { return; } - const isChecked = toggler.classList.toggle('ibexa-toggle--is-checked'); + const isChecked = toggler.classList.toggle(this.checkedClass); if (toggler.classList.contains('ibexa-toggle--radio')) { const valueToSet = isChecked ? 1 : 0; toggler.querySelector(`.form-check input[value="${valueToSet}"]`).checked = true; } else { - const toggleInput = toggler.querySelector('.ibexa-toggle__input'); + const toggleInput = toggler.querySelector(this.inputsSelector); toggleInput.checked = isChecked; toggleInput.dispatchEvent(new Event('change')); @@ -39,25 +42,25 @@ addFocus(event) { event.preventDefault(); - const toggler = event.currentTarget.closest('.ibexa-toggle'); + const toggler = event.currentTarget.closest('.ibexa-toggle, .ids-toggle'); - if (toggler.classList.contains('ibexa-toggle--is-disabled')) { + if (toggler.classList.contains(this.disabledClass)) { return; } - toggler.classList.add('ibexa-toggle--is-focused'); + toggler.classList.add(this.focusedClass); } removeFocus(event) { event.preventDefault(); - const toggler = event.currentTarget.closest('.ibexa-toggle'); + const toggler = event.currentTarget.closest('.ibexa-toggle, .ids-toggle'); - if (toggler.classList.contains('ibexa-toggle--is-disabled')) { + if (toggler.classList.contains(this.disabledClass)) { return; } - toggler.classList.remove('ibexa-toggle--is-focused'); + toggler.classList.remove(this.focusedClass); } toggleStateOnSpacePressed(event) { diff --git a/src/bundle/Resources/public/js/scripts/fieldType/ibexa_author.js b/src/bundle/Resources/public/js/scripts/fieldType/ibexa_author.js index 117997bd48..94ee075d34 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/ibexa_author.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/ibexa_author.js @@ -1,6 +1,7 @@ (function (global, doc, ibexa) { const SELECTOR_REMOVE_AUTHOR = '.ibexa-btn--remove-author'; const SELECTOR_AUTHOR = '.ibexa-data-source__author'; + const SELECTOR_AUTHOR_CHECKBOX = '.ibexa-data-source__author-checkbox'; const SELECTOR_FIELD = '.ibexa-field-edit--ibexa_author'; const SELECTOR_LABEL = '.ibexa-data-source__label'; const SELECTOR_FIELD_EMAIL = '.ibexa-data-source__field--email'; @@ -104,7 +105,7 @@ toggleBulkDeleteButtonState(event) { const container = event.target.closest(SELECTOR_FIELD); - const checkboxes = container.querySelectorAll('.ibexa-input--checkbox'); + const checkboxes = container.querySelectorAll(SELECTOR_AUTHOR_CHECKBOX); const isAnyCheckboxSelected = [...checkboxes].some((checkbox) => checkbox.checked); const bulkDeleteButton = container.querySelector('.ibexa-btn--bulk-remove-author'); @@ -113,7 +114,7 @@ removeSelectedItems(event) { const container = event.target.closest(SELECTOR_FIELD); - const selectedCheckboxes = container.querySelectorAll('.ibexa-input--checkbox:checked'); + const selectedCheckboxes = container.querySelectorAll(`${SELECTOR_AUTHOR_CHECKBOX}:checked`); const bulkDeleteButton = container.querySelector('.ibexa-btn--bulk-remove-author'); selectedCheckboxes.forEach((checkbox) => checkbox.closest(SELECTOR_AUTHOR).remove()); @@ -246,7 +247,7 @@ }, { isValueValidator: false, - selector: '.ibexa-data-source__author .ibexa-input--checkbox', + selector: `.ibexa-data-source__author ${SELECTOR_AUTHOR_CHECKBOX}`, eventName: 'change', callback: 'toggleBulkDeleteButtonState', }, diff --git a/src/bundle/Resources/public/js/scripts/sidebar/btn/content.edit.js b/src/bundle/Resources/public/js/scripts/sidebar/btn/content.edit.js index a2d8d1287e..1813e212f6 100644 --- a/src/bundle/Resources/public/js/scripts/sidebar/btn/content.edit.js +++ b/src/bundle/Resources/public/js/scripts/sidebar/btn/content.edit.js @@ -3,7 +3,7 @@ editButtons.forEach((editButton) => { const languageRadioOption = doc.querySelector( - `.ibexa-extra-actions--edit.ibexa-extra-actions--prevent-show[data-actions="${editButton.dataset.actions}"] .ibexa-input--radio`, + `.ibexa-extra-actions--edit.ibexa-extra-actions--prevent-show[data-actions="${editButton.dataset.actions}"] .ids-input--radio`, ); if (!languageRadioOption) { diff --git a/src/bundle/Resources/public/js/scripts/sidebar/btn/contenttype.edit.js b/src/bundle/Resources/public/js/scripts/sidebar/btn/contenttype.edit.js index 437a1b5f8c..bc59a4d9e6 100644 --- a/src/bundle/Resources/public/js/scripts/sidebar/btn/contenttype.edit.js +++ b/src/bundle/Resources/public/js/scripts/sidebar/btn/contenttype.edit.js @@ -1,6 +1,6 @@ (function (global, doc) { const editButton = doc.querySelector('.ibexa-btn--edit'); - const languageRadioOption = doc.querySelector('.ibexa-extra-actions--edit.ibexa-extra-actions--prevent-show .ibexa-input--radio'); + const languageRadioOption = doc.querySelector('.ibexa-extra-actions--edit.ibexa-extra-actions--prevent-show .ids-input--radio'); const editActions = doc.querySelector('.ibexa-extra-actions--edit'); const btns = editActions.querySelectorAll('.form-check [type="radio"]'); const changeHandler = () => { diff --git a/src/bundle/Resources/public/js/scripts/sidebar/btn/user.edit.js b/src/bundle/Resources/public/js/scripts/sidebar/btn/user.edit.js index d2a8204ced..f17d3df02b 100644 --- a/src/bundle/Resources/public/js/scripts/sidebar/btn/user.edit.js +++ b/src/bundle/Resources/public/js/scripts/sidebar/btn/user.edit.js @@ -1,6 +1,6 @@ (function (global, doc) { const editButton = doc.querySelector('.ibexa-btn--edit-user'); - const languageRadioOption = doc.querySelector('.ibexa-extra-actions--edit-user.ibexa-extra-actions--prevent-show .ibexa-input--radio'); + const languageRadioOption = doc.querySelector('.ibexa-extra-actions--edit-user.ibexa-extra-actions--prevent-show .ids-input--radio'); const editActions = doc.querySelector('.ibexa-extra-actions--edit-user'); if (!editActions || !languageRadioOption) { diff --git a/src/bundle/Resources/public/scss/_custom-url-form.scss b/src/bundle/Resources/public/scss/_custom-url-form.scss index 7626b45f09..e9fa793638 100644 --- a/src/bundle/Resources/public/scss/_custom-url-form.scss +++ b/src/bundle/Resources/public/scss/_custom-url-form.scss @@ -25,13 +25,13 @@ &--checked { display: none; - .ibexa-toggle--is-checked + & { + .ids-toggle--checked + & { display: block; } } &--unchecked { - .ibexa-toggle--is-checked + .ibexa-custom-url-from__info-text--checked + & { + .ids-toggle--checked + .ibexa-custom-url-from__info-text--checked + & { display: none; } } diff --git a/src/bundle/Resources/public/scss/_dropdown.scss b/src/bundle/Resources/public/scss/_dropdown.scss index 5cb76a2d78..26f2965a36 100644 --- a/src/bundle/Resources/public/scss/_dropdown.scss +++ b/src/bundle/Resources/public/scss/_dropdown.scss @@ -281,7 +281,7 @@ } } - .ibexa-input { + .ibexa-dropdown__item-checkbox { flex-shrink: 0; margin: 0 calculateRem(16px) 0 0; } diff --git a/src/bundle/Resources/public/scss/_grid-view-item.scss b/src/bundle/Resources/public/scss/_grid-view-item.scss index 99362deb62..27f8a28a52 100644 --- a/src/bundle/Resources/public/scss/_grid-view-item.scss +++ b/src/bundle/Resources/public/scss/_grid-view-item.scss @@ -28,8 +28,8 @@ border-color: $ibexa-color-dark; text-decoration: none; - .ibexa-input--checkbox, - .ibexa-input--radio { + .ids-input--checkbox, + .ids-input--radio { border-color: $ibexa-color-primary; } } @@ -179,9 +179,16 @@ top: calculateRem(10px); display: none; - .ibexa-input { + .ibexa-input, + .ids-input { background-color: $ibexa-color-white; } + + &--hovered { + .ids-input { + border-color: $ibexa-color-primary; + } + } } &:hover { diff --git a/src/bundle/Resources/public/scss/_inputs.scss b/src/bundle/Resources/public/scss/_inputs.scss index 7ed963dee7..b80fd66d33 100644 --- a/src/bundle/Resources/public/scss/_inputs.scss +++ b/src/bundle/Resources/public/scss/_inputs.scss @@ -528,3 +528,15 @@ } } } + +.form-check-input:checked { + background-color: $ibexa-color-white; +} + +.form-check-input:checked[type=checkbox] { + --bs-form-check-bg-image: none; +} + +.form-check-input[type=checkbox] { + border-radius: calculateRem(2px); +} diff --git a/src/bundle/Resources/public/scss/_tables.scss b/src/bundle/Resources/public/scss/_tables.scss index 6f97f9a339..7ae670c80f 100644 --- a/src/bundle/Resources/public/scss/_tables.scss +++ b/src/bundle/Resources/public/scss/_tables.scss @@ -40,8 +40,8 @@ border-color: $ibexa-color-primary; } - .ibexa-input--checkbox, - .ibexa-input--radio { + .ids-input--checkbox, + .ids-input--radio { border-color: $ibexa-color-primary; } } @@ -149,7 +149,7 @@ } &__header-cell-checkbox { - &.ibexa-input--checkbox { + &.ids-input--checkbox { margin-bottom: 0; } } @@ -186,7 +186,7 @@ &--has-checkbox { width: calculateRem(48px); - .ibexa-input--checkbox { + .ids-input--checkbox { float: left; margin-bottom: 0; } @@ -212,12 +212,12 @@ &--content-center { text-align: center; - .ibexa-input--checkbox { + .ids-input--checkbox { margin-bottom: 0; } } - .ibexa-input--radio { + .ids-input--radio { vertical-align: middle; } } diff --git a/src/bundle/Resources/public/scss/fieldType/edit/_ibexa_media.scss b/src/bundle/Resources/public/scss/fieldType/edit/_ibexa_media.scss index f4dc7bb427..68b8c85f3a 100644 --- a/src/bundle/Resources/public/scss/fieldType/edit/_ibexa_media.scss +++ b/src/bundle/Resources/public/scss/fieldType/edit/_ibexa_media.scss @@ -44,7 +44,7 @@ row-gap: calculateRem(12px); column-gap: calculateRem(8px); - .ibexa-input--checkbox { + .ibexa-field-edit-preview__checkbox { margin-top: calculateRem(4px); } } diff --git a/src/bundle/Resources/public/scss/ui/modules/sub-items-list/_view-columns-toggler-list-element.scss b/src/bundle/Resources/public/scss/ui/modules/sub-items-list/_view-columns-toggler-list-element.scss index 7873b20f62..fdbfea30dc 100644 --- a/src/bundle/Resources/public/scss/ui/modules/sub-items-list/_view-columns-toggler-list-element.scss +++ b/src/bundle/Resources/public/scss/ui/modules/sub-items-list/_view-columns-toggler-list-element.scss @@ -9,7 +9,7 @@ align-items: center; } - .ibexa-input--checkbox { + &__checkbox { margin-right: calculateRem(8px); } diff --git a/src/bundle/Resources/public/scss/ui/modules/universal-discovery/_collapsible.scss b/src/bundle/Resources/public/scss/ui/modules/universal-discovery/_collapsible.scss index 40bf62707c..755a7256b9 100644 --- a/src/bundle/Resources/public/scss/ui/modules/universal-discovery/_collapsible.scss +++ b/src/bundle/Resources/public/scss/ui/modules/universal-discovery/_collapsible.scss @@ -78,7 +78,7 @@ overflow: hidden; } - .ibexa-input--checkbox { + .ids-input--checkbox { margin-right: calculateRem(8px); } } diff --git a/src/bundle/Resources/public/scss/ui/modules/universal-discovery/_content-type-selector-list.scss b/src/bundle/Resources/public/scss/ui/modules/universal-discovery/_content-type-selector-list.scss index c559ad6a7b..d2afb2f7ae 100644 --- a/src/bundle/Resources/public/scss/ui/modules/universal-discovery/_content-type-selector-list.scss +++ b/src/bundle/Resources/public/scss/ui/modules/universal-discovery/_content-type-selector-list.scss @@ -20,7 +20,7 @@ font-size: $ibexa-text-font-size-medium; } - .ibexa-input--checkbox { + .c-content-type-selector-list__checkbox { margin-right: calculateRem(8px); } } diff --git a/src/bundle/Resources/views/themes/admin/account/notifications/list_item_all.html.twig b/src/bundle/Resources/views/themes/admin/account/notifications/list_item_all.html.twig index 2f3d3a0f1c..3f1b97dd8b 100644 --- a/src/bundle/Resources/views/themes/admin/account/notifications/list_item_all.html.twig +++ b/src/bundle/Resources/views/themes/admin/account/notifications/list_item_all.html.twig @@ -87,11 +87,11 @@ {% embed '@ibexadesign/ui/component/table/table_body_cell.html.twig' with { class: 'ibexa-table__cell--has-checkbox' } %} {% block content %}
-
{% endblock %} @@ -153,4 +153,3 @@ {% endembed %} {% endblock %} {% endembed %} - diff --git a/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig b/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig index 0fa5775eeb..c86327daf9 100644 --- a/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/tab/locations/tab.html.twig @@ -32,14 +32,12 @@ ]) %} {% set col_raw %} - + :checked="location.main" + :disabled="not location.canEdit" + :value="location.id ~ ''" + /> {% endset %} {% set body_row_cols = body_row_cols|merge([{ content: col_raw, @@ -48,25 +46,25 @@ {% set col_raw %}
-
- - - {{ 'toggle_widget.label.on'|trans|desc('On') }} - - - {{ 'toggle_widget.label.off'|trans|desc('Off') }} - -
+ +
{% endblock %} - diff --git a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/ibexa_author.html.twig b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/ibexa_author.html.twig index e7c79d7343..ac41b62722 100644 --- a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/ibexa_author.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/ibexa_author.html.twig @@ -50,11 +50,11 @@
{{- form_widget(form.id) -}}
- +
{{- form_row(form.name, { label_wrapper_attr: { 'hidden': 'hidden' }, attr: { readonly: readonly }}) -}} {{- form_row(form.email, { label_wrapper_attr: { 'hidden': 'hidden' }, attr: {'class': 'ibexa-input--text', readonly: readonly }}) -}} diff --git a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/ibexa_boolean.html.twig b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/ibexa_boolean.html.twig index c6a286b4f7..930734b00f 100644 --- a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/ibexa_boolean.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/ibexa_boolean.html.twig @@ -1,4 +1,4 @@ -{% use '@ibexadesign/ui/form_fields/toggle_widget.html.twig' %} +{% use '@ibexadesign/ui/form_fields/toggle_widget_ds.html.twig' %} {% block ezplatform_fieldtype_ibexa_boolean_label %} {{ block('form_label') }} diff --git a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig index 97a9bb7939..ab4f20f12d 100644 --- a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig @@ -22,7 +22,7 @@ {% set col_raw_checkbox_template %} @@ -111,7 +111,7 @@ {% set col_raw_checkbox %} diff --git a/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig b/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig index 91a7092d11..ac7db64eb6 100644 --- a/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig @@ -1,6 +1,6 @@ {% extends 'bootstrap_5_layout.html.twig' %} -{% use '@ibexadesign/ui/form_fields/toggle_widget.html.twig' %} +{% use '@ibexadesign/ui/form_fields/toggle_widget_ds.html.twig' %} {% use '@ibexadesign/ui/form_fields/dropdown_widget.html.twig' %} {%- block button_widget -%} @@ -148,17 +148,51 @@ {%- endblock -%} {%- block checkbox_widget -%} - {%- set attr = attr|merge({class: 'ibexa-input ibexa-input--checkbox ' ~ attr.class|default('') }) -%} + {%- set attr_class = attr.class|default('') -%} + {%- if 'btn-check' not in attr_class -%} + {%- set attr_class = 'ids-input ids-input--checkbox form-check-input ' ~ attr_class -%} + {%- else -%} + {%- set attr_class = 'ids-input ids-input--checkbox ' ~ attr_class -%} + {%- endif -%} + {%- set attr = attr|merge({class: attr_class|trim }) -%} {{ parent() }} {%- endblock -%} {%- block radio_widget -%} - {%- set attr = attr|merge({class: 'ibexa-input ibexa-input--radio ' ~ attr.class|default('') }) -%} - {{ parent() }} + {%- set attr_class = attr.class|default('') -%} + {%- set row_class = '' -%} + {%- if 'btn-check' not in attr_class -%} + {%- set attr_class = attr_class ~ ' form-check-input' -%} + {%- set row_class = 'form-check' -%} + {%- endif -%} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} + {%- if 'radio-inline' in parent_label_class -%} + {%- set row_class = row_class ~ ' form-check-inline' -%} + {%- endif -%} + {%- set component_attr = attr|merge({ class: attr_class|trim }) -%} + {%- if row_class is not empty -%} +
+ {%- endif -%} + {{- form_label(form, null, { widget: block('radio_widget_input_ds') }) -}} + {%- if row_class is not empty -%} +
+ {%- endif -%} +{%- endblock -%} + +{%- block radio_widget_input_ds -%} + {%- endblock -%} {%- block trash_item_checkbox_widget -%} - + {%- endblock -%} {%- block _trash_item_restore_restore_widget -%} @@ -504,7 +538,7 @@ {%- endblock %} {% block content_type_meta_field_definition_enabled_row -%} - {% use '@ibexadesign/ui/form_fields/toggle_widget.html.twig' %} + {% use '@ibexadesign/ui/form_fields/toggle_widget_ds.html.twig' %}
{{ block('form_label') }} diff --git a/src/bundle/Resources/views/themes/admin/ui/form_fields/toggle_widget_ds.html.twig b/src/bundle/Resources/views/themes/admin/ui/form_fields/toggle_widget_ds.html.twig new file mode 100644 index 0000000000..456d0f3d26 --- /dev/null +++ b/src/bundle/Resources/views/themes/admin/ui/form_fields/toggle_widget_ds.html.twig @@ -0,0 +1,40 @@ +{%- block toggle_widget -%} + {% set default_label_on = 'toggle_widget.label.on'|trans|desc('On') %} + {% set default_label_off = 'toggle_widget.label.off'|trans|desc('Off') %} + {% set field_type = block_prefixes[1]|default('choice') %} + {% set attr = attr|default({}) %} + {% set is_disabled = disabled|default(false) or attr.readonly|default(false) %} + + {% if checked|default(false) %} + {% set attr = attr|merge({ 'checked': 'checked' }) %} + {% endif %} + {% if value is defined %} + {% set attr = attr|merge({ 'value': value ~ '' }) %} + {% endif %} + + {% set input_content %} + {% if custom_inputs is defined %} + {{ custom_inputs }} + {% elseif field_type == 'choice' %} + {{ block('choice_widget') }} + {% else %} + + {% endif %} + {% endset %} + + + + {{ input_content|raw }} + + +{%- endblock -%} diff --git a/src/bundle/ui-dev/src/modules/common/dropdown/dropdown.js b/src/bundle/ui-dev/src/modules/common/dropdown/dropdown.js index e913b9e104..afe558613a 100644 --- a/src/bundle/ui-dev/src/modules/common/dropdown/dropdown.js +++ b/src/bundle/ui-dev/src/modules/common/dropdown/dropdown.js @@ -2,6 +2,8 @@ import React, { useState, useEffect, useRef, useLayoutEffect } from 'react'; import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; +import { CheckboxInput } from '@ids-components/components/Checkbox'; + import { createCssClassNames } from '../../common/helpers/css.class.names'; import Icon from '../../common/icon/icon'; import { getTranslator } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper'; @@ -83,7 +85,11 @@ const Dropdown = ({ }} > {!single && ( - {}} /> + {}} + /> )} {item.label} {single && ( diff --git a/src/bundle/ui-dev/src/modules/sub-items/components/table-view/table.view.component.js b/src/bundle/ui-dev/src/modules/sub-items/components/table-view/table.view.component.js index 63173a2f1c..5ade196055 100644 --- a/src/bundle/ui-dev/src/modules/sub-items/components/table-view/table.view.component.js +++ b/src/bundle/ui-dev/src/modules/sub-items/components/table-view/table.view.component.js @@ -208,7 +208,7 @@ export default class TableViewComponent extends Component { checked={anyLocationSelected} onClick={this.selectAll} // We need onClick, because MS Edge does not trigger onChange when checkbox has indeterminate state. (ref: https://stackoverflow.com/a/33529024/5766602) onChange={() => {}} // Dummy callback to not trigger React warning as we cannot use onChange on MS Edge - className="ibexa-input ibexa-input--checkbox ibexa-table__header-cell-checkbox ibexa-table__header-cell-checkbox--custom-init" + className="ids-input ids-input--checkbox ibexa-table__header-cell-checkbox ibexa-table__header-cell-checkbox--custom-init" /> {this.renderBasicColumnsHeader()} diff --git a/src/bundle/ui-dev/src/modules/sub-items/components/table-view/table.view.item.component.js b/src/bundle/ui-dev/src/modules/sub-items/components/table-view/table.view.item.component.js index 76087cc155..4ec5c7f32d 100644 --- a/src/bundle/ui-dev/src/modules/sub-items/components/table-view/table.view.item.component.js +++ b/src/bundle/ui-dev/src/modules/sub-items/components/table-view/table.view.item.component.js @@ -1,6 +1,8 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; +import { CheckboxInput } from '@ids-components/components/Checkbox'; + import { getTranslator } from '@ibexa-admin-ui-helpers/context.helper'; import { getContentTypeIconUrl } from '@ibexa-admin-ui-helpers/content.type.helper'; import { formatShortDateTime } from '@ibexa-admin-ui-helpers/timezone.helper'; @@ -420,7 +422,7 @@ export default class TableViewItemComponent extends PureComponent { } componentDidMount() { - parseCheckbox('.c-table-view-item__cell .ibexa-input--checkbox', 'c-table-view-item--active'); + parseCheckbox('.c-table-view-item__cell .c-table-view-item__checkbox', 'c-table-view-item--active'); } render() { @@ -437,9 +439,8 @@ export default class TableViewItemComponent extends PureComponent { return ( - diff --git a/src/bundle/ui-dev/src/modules/sub-items/components/three-state-checkbox/three.state.checkbox.component.js b/src/bundle/ui-dev/src/modules/sub-items/components/three-state-checkbox/three.state.checkbox.component.js index 6eb85900f4..27cb1734e5 100644 --- a/src/bundle/ui-dev/src/modules/sub-items/components/three-state-checkbox/three.state.checkbox.component.js +++ b/src/bundle/ui-dev/src/modules/sub-items/components/three-state-checkbox/three.state.checkbox.component.js @@ -1,16 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { CheckboxInput } from '@ids-components/components/Checkbox'; + const ThreeStateCheckboxComponent = ({ indeterminate = false, ...restOfProps }) => ( - { - if (input) { - input.indeterminate = indeterminate; - } - }} - /> + ); ThreeStateCheckboxComponent.propTypes = { diff --git a/src/bundle/ui-dev/src/modules/sub-items/components/view-columns-toggler/view.columns.toggler.list.element.js b/src/bundle/ui-dev/src/modules/sub-items/components/view-columns-toggler/view.columns.toggler.list.element.js index 9a893e85e9..5fb7f1bbb8 100644 --- a/src/bundle/ui-dev/src/modules/sub-items/components/view-columns-toggler/view.columns.toggler.list.element.js +++ b/src/bundle/ui-dev/src/modules/sub-items/components/view-columns-toggler/view.columns.toggler.list.element.js @@ -1,13 +1,14 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { CheckboxInput } from '@ids-components/components/Checkbox'; + const ViewColumnsTogglerListElement = ({ label, isColumnVisible, toggleColumnVisibility, columnKey }) => { return (