diff --git a/lang/en/messages.php b/lang/en/messages.php index e09eedad4e5..dc39978a4de 100644 --- a/lang/en/messages.php +++ b/lang/en/messages.php @@ -226,6 +226,7 @@ 'publish_actions_publish' => 'Changes to the working copy will be applied to the entry and it will be published immediately.', 'publish_actions_schedule' => 'Changes to the working copy will be applied to the entry and it will appear published on the selected date.', 'publish_actions_unpublish' => 'The current revision will be unpublished.', + 'replicator_set_card_layout_instructions' => 'In a Replicator field, stacked instances of this set are displayed side by side as cards when there’s enough space.', 'relationship_item_unavailable' => 'This item is unavailable. It may have been deleted, or you may not have permission to view it.', 'reset_password_notification_body' => 'You are receiving this email because we received a password reset request for your account.', 'reset_password_notification_no_action' => 'If you did not request a password reset, no further action is required.', diff --git a/resources/css/components/fieldtypes/replicator-card-sets.css b/resources/css/components/fieldtypes/replicator-card-sets.css new file mode 100644 index 00000000000..dd140d80ab5 --- /dev/null +++ b/resources/css/components/fieldtypes/replicator-card-sets.css @@ -0,0 +1,116 @@ +/* GROUP REPLICATOR CARD SETS +=================================================== */ +[data-replicator-dragging] [data-replicator-connector], +[data-replicator-dragging] [data-replicator-set-picker], +.draggable-mirror [data-replicator-connector], +.draggable-mirror [data-replicator-set-picker] { + visibility: hidden; +} + +@container panel (width > 635px) { + .replicator-set-list { + display: flex; + flex-wrap: wrap; + column-gap: 0.75rem; + align-items: start; + } + + .replicator-set-slot--full, + .replicator-set-slot--card-cols-1 { + width: 100%; + min-width: 0; + } + + .replicator-set-slot--card-cols-2, + .replicator-set-slot--card-cols-3 { + position: relative; + width: calc((100% - 0.75rem) / 2); + min-width: 0; + padding-block-start: 1.5rem; + + /* Too narrow for the collapsed preview, it only shows as clipped text */ + [data-replicator-set-preview] { + display: none; + } + + > div > [data-replicator-set-picker] { + position: absolute; + z-index: var(--z-index-above); + margin-block-start: 0; + } + } + + @container panel (width > 935px) { + .replicator-set-slot--card-cols-3 { + width: calc((100% - 1.5rem) / 3); + min-width: 0; + } + } + + .replicator-set-slot--card-cols-2, + .replicator-set-slot--card-cols-3 { + > div > [data-replicator-set] > [data-replicator-set-fields] > div > .publish-fields { + /* Prevent columns and gaps exceeding the container */ + grid-column-gap: unset; + + > .form-group { + --col-span: var(--grid-columns); + } + } + } + + .replicator-card-set-row-start { + > div > [data-replicator-set-picker]:not([data-replicator-set-picker-end]) { + top: 0; + width: 100%; + height: 1.5rem; + align-items: center; + padding: 0; + } + } + + .replicator-card-set-inset-picker { + &:not(.replicator-card-set-row-start) > div > [data-replicator-set-picker] [data-replicator-connector] { + display: none; + } + + &:not(.replicator-card-set-row-start) > div > [data-replicator-set-picker]:not([data-replicator-set-picker-end]), + > div > [data-replicator-set-picker-end] { + display: flex; + position: absolute; + inset: 1.5rem auto 0 -0.75rem; + width: 0.75rem; + align-items: center; + padding: 0; + writing-mode: vertical-lr; + + [data-insert-handle] { + position: absolute; + top: 0; + left: 50%; + transform: translateX(-50%); + height: 100%; + width: 0.325rem; + background: linear-gradient(to bottom, var(--color-gray-100) 0%, var(--color-gray-200) 50%, var(--color-gray-100) 100%); + } + } + + > div > [data-replicator-set-picker][data-replicator-set-picker-end] { + right: -0.75rem; + left: auto; + } + } + + .replicator-card-set-row-start.replicator-card-set-has-entry-connector { + &.replicator-set-slot--card-cols-2 > div > [data-replicator-set-picker]:not([data-replicator-set-picker-end]), + &.replicator-set-slot--card-cols-3 > div > [data-replicator-set-picker]:not([data-replicator-set-picker-end]) { + width: calc(200% + 0.75rem); + } + + @container panel (width > 935px) { + &.replicator-set-slot--card-cols-3 > div > [data-replicator-set-picker]:not([data-replicator-set-picker-end]) { + width: calc(300% + 1.5rem); + } + } + } +} diff --git a/resources/css/components/fieldtypes/replicator.css b/resources/css/components/fieldtypes/replicator.css deleted file mode 100644 index cbf0f8dc3bf..00000000000 --- a/resources/css/components/fieldtypes/replicator.css +++ /dev/null @@ -1,3 +0,0 @@ -/* ========================================================================== - REPLICATOR FIELDTYPE - ========================================================================== */ diff --git a/resources/css/cp.css b/resources/css/cp.css index 481323b3b6f..05f145e24d0 100644 --- a/resources/css/cp.css +++ b/resources/css/cp.css @@ -36,6 +36,7 @@ @import './components/fieldtypes/markdown.css'; @import './components/fieldtypes/partial.css'; @import './components/fieldtypes/relationship.css'; +@import './components/fieldtypes/replicator-card-sets.css'; @import './components/fieldtypes/section.css'; @import './components/fieldtypes/table.css'; @import './components/fieldtypes/width.css'; diff --git a/resources/js/components/blueprints/Section.vue b/resources/js/components/blueprints/Section.vue index 90ccc4a84e8..337ab5a1a0c 100644 --- a/resources/js/components/blueprints/Section.vue +++ b/resources/js/components/blueprints/Section.vue @@ -1,11 +1,21 @@