Skip to content

Commit bc3afd0

Browse files
authored
[6.x] More elegantly mask horizontal overflow for sets (#14753)
1 parent 018fbf3 commit bc3afd0

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

resources/css/core/utilities.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,27 @@
5555
}
5656
}
5757

58+
/* =Jay. Mask the horizontal overflow of an element, e.g. in a long Bard Set header that overflows its container. Override the default mask by changing the --mask-stop variable. */
59+
@utility st-mask-horizontal-overflow {
60+
--mask-stop: 1rem;
61+
--mask: linear-gradient(to left, transparent 0%, black var(--mask-stop));
62+
mask-image: var(--mask);
63+
mask-repeat: no-repeat;
64+
animation: mask-overflow-horizontal linear both;
65+
animation-timeline: scroll(self inline);
66+
animation-range: calc(100% - var(--mask-stop)) 100%;
67+
}
68+
69+
@keyframes mask-overflow-horizontal {
70+
from {
71+
mask-image: var(--mask);
72+
}
73+
74+
to {
75+
mask-image: unset;
76+
}
77+
}
78+
5879
/* UTILITIES / TEXT
5980
=================================================== */
6081
/* Avoid prefixing things with `st-text-` (st for Statamic) because `text-` is a Tailwind prefix */

resources/js/components/fieldtypes/bard/Set.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<span v-if="!isReadOnly" data-drag-handle class="flex cursor-grab" @mousedown="enableDragging">
2727
<Icon name="handles" class="size-4 text-gray-400" />
2828
</span>
29-
<button type="button" class="show-focus-within_target flex flex-1 min-w-0 cursor-pointer items-center gap-4 overflow-x-auto p-2 pe-4 focus:outline-none [--mask:linear-gradient(to_left,transparent_0%,black_1rem)] [-webkit-mask:var(--mask)] [mask:var(--mask)]" @click="toggleCollapsedState">
29+
<button type="button" class="show-focus-within_target flex flex-1 min-w-0 cursor-pointer items-center gap-4 overflow-x-auto p-2 pe-4 focus:outline-none st-mask-horizontal-overflow" @click="toggleCollapsedState">
3030
<Badge size="lg" :pill="true" color="white" class="px-3">
3131
<span v-if="isSetGroupVisible" class="flex items-center gap-2">
3232
{{ __(setGroup.display) }}

resources/js/components/fieldtypes/replicator/Set.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ reveal.use(rootEl, () => emit('expanded'));
152152
class="size-4 cursor-grab text-gray-400"
153153
v-if="!readOnly"
154154
/>
155-
<button type="button" class="show-focus-within_target flex flex-1 min-w-0 cursor-pointer items-center gap-4 overflow-x-auto p-2 py-1.75 pe-4 focus:outline-none [--mask:linear-gradient(to_left,transparent_0%,black_1rem)] [-webkit-mask:var(--mask)] [mask:var(--mask)]" @click="toggleCollapsedState">
155+
<button type="button" class="show-focus-within_target flex flex-1 min-w-0 cursor-pointer items-center gap-4 overflow-x-auto p-2 py-1.75 pe-4 focus:outline-none st-mask-horizontal-overflow" @click="toggleCollapsedState">
156156
<Badge size="lg" pill color="white" class="px-3">
157157
<span v-if="isSetGroupVisible" class="flex items-center gap-2">
158158
{{ __(setGroup.display) }}

0 commit comments

Comments
 (0)