diff --git a/lang/en/messages.php b/lang/en/messages.php index 19d1cdad492..2388a3f3955 100644 --- a/lang/en/messages.php +++ b/lang/en/messages.php @@ -222,6 +222,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..4799624058f --- /dev/null +++ b/resources/css/components/fieldtypes/replicator-card-sets.css @@ -0,0 +1,106 @@ +/* GROUP REPLICATOR CARD SETS +=================================================== */ +.replicator-card-set-row-start { + --pull: 1.5rem; + + &:not(.replicator-card-set-has-entry-connector) { + [data-ui-popover-trigger] { + position: absolute; + z-index: var(--z-index-above); + transform: translateY(calc(0% - var(--pull))); + width: 100%; + } + } + + &.replicator-card-set-has-entry-connector { + [data-ui-popover-trigger] { + position: relative; + z-index: var(--z-index-above); + width: 100%; + } + } +} + +@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 { + width: calc((100% - 0.75rem) / 2); + min-width: 0; + } + + @container panel (width > 935px) { + .replicator-set-slot--card-cols-3 { + width: calc((100% - 1.5rem) / 3); + min-width: 0; + } + } + + .replicator-set-slot--full, + .replicator-set-slot--card-cols-1, + .replicator-set-slot--card-cols-2, + .replicator-set-slot--card-cols-3 { + .publish-fields { + /* Prevent columns and gaps exceeding the container */ + grid-column-gap: unset; + + * { + --col-span: 12; + } + } + } + + .replicator-card-set-inset-picker:not(.replicator-card-set-row-start) { + position: relative; + margin-block-start: 1.5rem; + + [data-replicator-connector] { + display: none; + } + + [data-ui-popover-trigger] { + position: absolute; + inset: 0; + left: -1.15rem; + writing-mode: vertical-lr; + + [data-insert-handle] { + position: absolute; + top: 0; + left: calc(0.5rem + 2px); + height: 100%; + width: 0.325rem; + background: linear-gradient(to bottom, var(--color-gray-200) 0%, var(--color-gray-100) 50%, var(--color-gray-200) 100%); + } + } + + /* Nudge to account for rounding error / subpixel positioning */ + &:nth-child(3n + 1) [data-ui-popover-trigger] { + [data-insert-handle] { + left: calc(0.5rem + 1.5px); + } + } + } + + .replicator-card-set-row-start.replicator-card-set-has-entry-connector { + &.replicator-set-slot--card-cols-2 [data-ui-popover-trigger] { + width: calc(200% + 0.75rem); + } + + &.replicator-set-slot--card-cols-3 [data-ui-popover-trigger] { + 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 dd8ab0f1172..97bab663169 100644 --- a/resources/css/cp.css +++ b/resources/css/cp.css @@ -35,6 +35,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 59f95fe09a4..21c152c41c9 100644 --- a/resources/js/components/blueprints/Section.vue +++ b/resources/js/components/blueprints/Section.vue @@ -1,11 +1,21 @@