Skip to content

Commit 5c3dcf9

Browse files
committed
Merge branch 'forms-2' into form-fields
2 parents eef7df7 + aa78fcb commit 5c3dcf9

8 files changed

Lines changed: 329 additions & 128 deletions

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/* GROUP FIELD CONNECTORS
2+
=================================================== */
3+
/* Notes...
4+
5+
Links fields to the right setting panel
6+
7+
*/
8+
@supports (animation-timeline: auto) and (anchor-name: --my-anchor) {
9+
:root {
10+
--global-header-height: 3.5rem;
11+
}
12+
13+
/* GROUP FIELD CONNECTORS / DEFINE ANCHORS
14+
=================================================== */
15+
[data-editing-field] {
16+
anchor-name: --editing-field;
17+
}
18+
[data-field-settings] {
19+
anchor-name: --field-settings;
20+
}
21+
22+
/* GROUP FIELD CONNECTORS / DEFINE TIMELINE SCOPES
23+
=================================================== */
24+
#main-content {
25+
scroll-timeline-name: --cp-main-scroll;
26+
timeline-scope: --editing-field-scroll;
27+
}
28+
[data-editing-field] {
29+
view-timeline-name: --editing-field-scroll;
30+
}
31+
32+
/* GROUP FIELD CONNECTORS / DEFINE ANIMATIONS
33+
=================================================== */
34+
@keyframes move-mask-upwards {
35+
to {
36+
top: var(--global-header-height);
37+
height: 7.5rem;
38+
}
39+
}
40+
@keyframes clip-upwards {
41+
0% {
42+
opacity: 0;
43+
/* Hide */
44+
clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0 100%);
45+
}
46+
1%, 100% {
47+
opacity: 1;
48+
}
49+
100% {
50+
height: 8rem;
51+
/* Release */
52+
clip-path: polygon(0 100%, 100% 100%, 100% 0, 0 0);
53+
}
54+
}
55+
56+
/* GROUP FIELD CONNECTORS / INITIAL CONNECTOR
57+
=================================================== */
58+
.field-to-panel-connector-initial {
59+
position: absolute;
60+
top: anchor(--field-settings center);
61+
right: anchor(--field-settings left);
62+
bottom: anchor(--editing-field center);
63+
width: 2.75rem;
64+
border-inline-start: 1px dashed var(--color-blue-400);
65+
&::before {
66+
--width: 1.5rem;
67+
content: '';
68+
background: white;
69+
position: fixed;
70+
top: calc(var(--global-header-height) + 1rem);
71+
height: 6rem;
72+
width: var(--width);
73+
translate: calc(0% - var(--width) / 2);
74+
/* Move the mask up to continue hiding the line now that we've moved past the padding of the container */
75+
animation: move-mask-upwards auto linear both;
76+
animation-timeline: --cp-main-scroll;
77+
animation-range: 0rem 2rem;
78+
}
79+
}
80+
81+
/* GROUP FIELD CONNECTORS / INITIAL CONNECTOR
82+
=================================================== */
83+
/* This connector points downwards and is visible once you scroll _past_ the field */
84+
.field-to-panel-connector-scroll-past {
85+
position: absolute;
86+
/* border: 3px solid blue!important; */
87+
top: anchor(--field-settings center);
88+
right: anchor(--field-settings left);
89+
bottom: anchor(--editing-field center);
90+
width: 2.75rem;
91+
&::before {
92+
content: '';
93+
border-inline-start: 1px dashed var(--color-blue-400);
94+
position: fixed;
95+
transform: translateY(-8rem);
96+
height: 8rem;
97+
animation: clip-upwards auto linear both;
98+
animation-timeline: --editing-field-scroll;
99+
animation-range: exit-crossing -38% exit-crossing 80%;
100+
}
101+
}
102+
}

resources/css/core/layout.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ main.nav-closed {
421421
.right-panel-popover__close-button {
422422
right: max(18rem, 33.33%);
423423
border-start-end-radius: 0;
424+
border-start-start-radius: 0;
424425
border-end-end-radius: 0;
425426
}
426427
}
@@ -443,3 +444,4 @@ main.nav-closed {
443444
body > .draggable-mirror {
444445
z-index: var(--z-index-draggable);
445446
}
447+

resources/css/cp.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
@import './components/index-fields.css';
1818
@import './components/notifications.css';
1919
@import './components/page-tree.css';
20+
@import './components/field-connectors.css';
2021
@import './components/pagination.css';
2122
@import './components/popover.css';
2223
@import './components/preview.css';

resources/js/components/ui/Label.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const props = defineProps({
1818

1919
<template>
2020
<label
21-
class="flex justify-between mb-1.5 text-sm font-medium [&_button]:font-medium text-gray-925 select-none dark:text-gray-300 [&_button:has(svg)]:h-auto"
21+
class="flex justify-between mb-1.5 @max-md:mb-1 text-sm font-medium [&_button]:font-medium text-gray-925 select-none dark:text-gray-300 [&_button:has(svg)]:h-auto"
2222
data-ui-label
2323
:for="for"
2424
>

resources/js/components/ui/Tabs/List.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const hasTabIndicatorComponent = hasComponent('TabsIndicator');
77

88
<template>
99
<TabsList
10-
class="relative flex shrink-0 mx-2 lg:mx-0 space-x-2 lg:space-x-4 border-b border-gray-200 text-sm text-gray-500
10+
class="relative flex shrink-0 mx-2 lg:mx-0 space-x-2 @container/@lg:space-x-4 border-b border-gray-200 text-sm text-gray-500
1111
dark:border-gray-700
1212
[.live-preview_&]:px-1 [.live-preview_&]:py-2 [.live-preview_&]:mb-3"
1313
data-ui-tabs-list

resources/js/pages/forms/Fields.vue

Lines changed: 96 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<script setup>
22
import Layout from '@/pages/layout/Layout.vue';
3+
import PanelLayout from '@/pages/layout/PanelLayout.vue';
34
import FormsLayout from './Layout.vue';
45
import { Button, Card, Checkbox, CheckboxGroup, Field, Header, Heading, Icon, Input, Panel, PanelHeader, Radio, RadioGroup, Select, StatusIndicator, Switch, Textarea, Tabs, TabList, TabTrigger, TabContent } from '@ui';
56
import LayoutPanel from '@/pages/layout/LayoutPanel.vue';
67
import { computed, ref } from 'vue';
78
8-
defineOptions({ layout: [Layout, FormsLayout] });
9+
defineOptions({ layout: [Layout, PanelLayout, FormsLayout] });
910
1011
const props = defineProps({
1112
form: Object,
@@ -21,6 +22,10 @@ const favoriteAlbum = ref(null);
2122
const secondFavoriteAlbum = ref(null);
2223
const emailNotifications = ref([]);
2324
const wantsFreeDrinkVoucher = ref(false);
25+
const settingsLabel = ref(__('Which album was your favorite?'));
26+
const settingsHelpText = ref('');
27+
const settingsPlaceholder = ref('');
28+
const settingsCharacterLimit = ref(null);
2429
const heardAboutOptions = [
2530
{ label: __('Instagram'), value: 'instagram' },
2631
{ label: __('Friend referral'), value: 'referral' },
@@ -43,6 +48,7 @@ const notificationOptions = [
4348
</script>
4449
4550
<template>
51+
4652
<Teleport to="#form-layout-actions">
4753
<Button variant="primary" :aria-label="__('Save')">
4854
<Icon name="save" class="sm:hidden" />
@@ -52,7 +58,7 @@ const notificationOptions = [
5258
5359
<Button
5460
class="
55-
min-[1000px]:hidden sticky top-3 mt-3 z-[var(--z-index-above)]
61+
min-[1000px]:hidden sticky top-3 mt-3 z-(--z-index-above)
5662
sm:-translate-x-3 md:-translate-x-9 col-start-1 row-start-1
5763
"
5864
popovertarget="popover-left-panel"
@@ -367,7 +373,9 @@ const notificationOptions = [
367373
</div>
368374
</LayoutPanel>
369375
376+
370377
<div class="col-span-full row-start-1 max-[1000px]:pt-14">
378+
371379
<Header class="mx-auto max-w-5xl">
372380
<template #title>
373381
<StatusIndicator status="published" />
@@ -392,9 +400,11 @@ const notificationOptions = [
392400
/>
393401
</Field>
394402
403+
<div data-editing-field>
395404
<Field :label="__('What do you like most about our band?')" required>
396405
<Textarea v-model="favoriteThing" :rows="4" resize="vertical" />
397406
</Field>
407+
</div>
398408
399409
<Field :label="__('How long have you been a fan?')" :instructions="__('If you don\'t remember, just give your best estimate.')">
400410
<Input v-model="fanLength" />
@@ -447,7 +457,7 @@ const notificationOptions = [
447457
448458
<Button
449459
class="
450-
min-[1000px]:hidden sticky top-3 mt-3 z-[var(--z-index-above)]
460+
min-[1000px]:hidden sticky top-3 mt-3 z-(--z-index-above)
451461
sm:translate-x-3 md:translate-x-9 mb-5 col-start-3 row-start-1"
452462
popovertarget="popover-right-panel"
453463
:text="__('Settings')"
@@ -463,7 +473,7 @@ const notificationOptions = [
463473
<button class="right-panel-popover__close-button" title="Close" popovertarget="popover-right-panel">
464474
<svg height="100pt" aria-hidden="true" viewBox="0 0 100 100" width="100pt" xmlns="http://www.w3.org/2000/svg"><path d="m91.668 13.676-5.3398-5.3398-36.328 36.324-36.328-36.324-5.3398 5.3398 36.328 36.324-36.328 36.324 5.3398 5.3398 36.328-36.324 36.328 36.324 5.3398-5.3398-36.328-36.324z"/></svg>
465475
</button>
466-
<div class="@container py-6 px-4">
476+
<div class="@container py-6 px-2.5">
467477
<Tabs v-model:modelValue="activeSettingsTab" :unmount-on-hide="false">
468478
<TabList class="inline-flex flex-wrap [&_button]:w-auto! mb-4 mx-0!">
469479
<TabTrigger name="settings" :text="__('Settings')" />
@@ -472,7 +482,28 @@ const notificationOptions = [
472482
</TabList>
473483
474484
<TabContent name="settings">
475-
<p class="text-sm text-gray-700 dark:text-gray-200">{{ __('Settings') }}</p>
485+
<div class="space-y-6 pt-8">
486+
<div class="flex items-center gap-2.5">
487+
<Icon name="fieldtype-radio" class="size-4 text-gray-500 dark:text-gray-300" />
488+
<h3 class="text-xl font-medium antialiased">{{ __('Multi Choice') }}</h3>
489+
</div>
490+
491+
<Field :label="__('Label')">
492+
<Input v-model="settingsLabel" />
493+
</Field>
494+
495+
<Field :label="__('Help Text')" :instructions="__('Additional field instructions like this.')">
496+
<Textarea v-model="settingsHelpText" :rows="2" resize="vertical" />
497+
</Field>
498+
499+
<Field :label="__('Placeholder')">
500+
<Input v-model="settingsPlaceholder" />
501+
</Field>
502+
503+
<Field :label="__('Character Limit')" :instructions="__('Set the recommended maximum number of enterable characters.')">
504+
<Input v-model="settingsCharacterLimit" type="number" />
505+
</Field>
506+
</div>
476507
</TabContent>
477508
<TabContent name="logic">
478509
<p class="text-sm text-gray-700 dark:text-gray-200">{{ __('Logic') }}</p>
@@ -484,8 +515,9 @@ const notificationOptions = [
484515
</div>
485516
</div>
486517
</div>
518+
487519
<!-- This is the desktop nav - the content is repeated from the right panel -->
488-
<div class="@container relative py-6 px-4 max-[1000px]:hidden">
520+
<div class="@container relative py-6 px-2.5 max-[1000px]:hidden">
489521
<Tabs v-model:modelValue="activeSettingsTab" :unmount-on-hide="false">
490522
<TabList class="inline-flex flex-wrap [&_button]:w-auto! mb-4 mx-0!">
491523
<TabTrigger name="settings" :text="__('Settings')" />
@@ -494,7 +526,64 @@ const notificationOptions = [
494526
</TabList>
495527
496528
<TabContent name="settings">
497-
<p class="text-sm text-gray-700 dark:text-gray-200">{{ __('Settings') }}</p>
529+
<div class="space-y-6 pt-8">
530+
<div data-field-settings class="flex items-center gap-2.5">
531+
<Icon name="fieldtype-radio" class="size-4 text-gray-500 dark:text-gray-300" />
532+
<h3 class="text-xl font-medium antialiased">{{ __('Multi Choice') }}</h3>
533+
</div>
534+
535+
<Field :label="__('Label')">
536+
<Input v-model="settingsLabel" />
537+
</Field>
538+
539+
<Field :label="__('Help Text')" :instructions="__('Additional field instructions like this.')">
540+
<Textarea v-model="settingsHelpText" :rows="2" resize="vertical" />
541+
</Field>
542+
543+
<Field :label="__('Placeholder')">
544+
<Input v-model="settingsPlaceholder" />
545+
</Field>
546+
547+
<Field :label="__('Character Limit')" :instructions="__('Set the recommended maximum number of enterable characters.')">
548+
<Input v-model="settingsCharacterLimit" type="number" />
549+
</Field>
550+
551+
<Field :label="__('Help Text')" :instructions="__('Additional field instructions like this.')">
552+
<Textarea v-model="settingsHelpText" :rows="2" resize="vertical" />
553+
</Field>
554+
555+
<Field :label="__('Placeholder')">
556+
<Input v-model="settingsPlaceholder" />
557+
</Field>
558+
559+
<Field :label="__('Character Limit')" :instructions="__('Set the recommended maximum number of enterable characters.')">
560+
<Input v-model="settingsCharacterLimit" type="number" />
561+
</Field>
562+
563+
<Field :label="__('Help Text')" :instructions="__('Additional field instructions like this.')">
564+
<Textarea v-model="settingsHelpText" :rows="2" resize="vertical" />
565+
</Field>
566+
567+
<Field :label="__('Placeholder')">
568+
<Input v-model="settingsPlaceholder" />
569+
</Field>
570+
571+
<Field :label="__('Character Limit')" :instructions="__('Set the recommended maximum number of enterable characters.')">
572+
<Input v-model="settingsCharacterLimit" type="number" />
573+
</Field>
574+
575+
<Field :label="__('Help Text')" :instructions="__('Additional field instructions like this.')">
576+
<Textarea v-model="settingsHelpText" :rows="2" resize="vertical" />
577+
</Field>
578+
579+
<Field :label="__('Placeholder')">
580+
<Input v-model="settingsPlaceholder" />
581+
</Field>
582+
583+
<Field :label="__('Character Limit')" :instructions="__('Set the recommended maximum number of enterable characters.')">
584+
<Input v-model="settingsCharacterLimit" type="number" />
585+
</Field>
586+
</div>
498587
</TabContent>
499588
<TabContent name="logic">
500589
<p class="text-sm text-gray-700 dark:text-gray-200">{{ __('Logic') }}</p>

0 commit comments

Comments
 (0)