Skip to content

Commit 8999a57

Browse files
Merge pull request #13 from CornellCustomDev/form-cxbx-slect-edit-updates
Form cxbx slect edit updates
2 parents a3d848b + 7ad5d36 commit 8999a57

File tree

3 files changed

+47
-31
lines changed

3 files changed

+47
-31
lines changed

resources/css/app.css

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
--color-cds-medium-gray: #808080;
3131
}
3232

33+
@utility default-focus-ring {
34+
outline: -webkit-focus-ring-color auto 1px;
35+
}
36+
37+
@utility focus-ring {
38+
@apply focus:default-focus-ring focus:shadow-none;
39+
}
40+
3341
/* Form fields */
3442
[data-flux-field] {
3543
@apply max-w-[600px];
@@ -63,34 +71,36 @@
6371
}
6472

6573
[data-flux-description] {
66-
@apply mb-5;
74+
@apply mb-1;
6775
@apply text-base text-cds-dark-silver dark:text-neutral-400;
6876
}
6977

7078
/* Checkboxes */
71-
[data-flux-checkbox] {
72-
@apply ml-[10px];
73-
@apply cursor-pointer;
74-
[data-flux-checkbox-indicator] {
75-
@apply mt-[1px];
76-
@apply w-[18px] h-[18px];
77-
@apply border border-gray-600 dark:border-white/50 rounded-xs;
78-
@apply bg-gray-300/20 bg-no-repeat bg-center;
79-
80-
[data-checked] & {
79+
[data-flux-checkbox-group] {
80+
[data-flux-field] {
81+
@apply mb-0;
82+
}
83+
[data-flux-checkbox] {
84+
@apply ml-0;
85+
@apply cursor-pointer;
86+
[data-flux-checkbox-indicator] {
87+
@apply mt-[1px] ml-0 mr-0;
8188
@apply w-[18px] h-[18px];
82-
@apply rounded-xs;
83-
@apply bg-cds-blue dark:bg-transparent;
84-
@apply text-white;
85-
svg {
86-
@apply dark:text-white;
89+
@apply border border-gray-600 dark:border-white/50 rounded-xs;
90+
@apply bg-gray-300/20 bg-no-repeat bg-center;
91+
92+
[data-checked] & {
93+
@apply rounded-xs;
94+
@apply bg-cds-blue dark:bg-transparent;
95+
@apply text-white;
96+
svg {
97+
@apply dark:text-white;
98+
}
8799
}
88100
}
89101
}
90-
}
91-
[data-flux-checkbox-group] {
92-
[data-flux-field] {
93-
@apply mb-0;
102+
[data-flux-label] {
103+
@apply ml-2;
94104
}
95105
+ [data-flux-error] {
96106
margin-top: calc(var(--spacing) * 0) !important;
@@ -133,9 +143,9 @@
133143
+ [data-flux-error] {
134144
margin-top: calc(var(--spacing) * 1) !important;
135145
}
136-
/* .ProseMirror-focused {
146+
.ProseMirror-focused {
137147
@apply focus:default-focus-ring;
138-
} */
148+
}
139149
}
140150
}
141151

resources/views/components/cds/checkbox.blade.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
'label', // group label OR single checkbox label
33
'name' => $attributes->whereStartsWith('wire:model')->first(),
44
'options' => null, // if array → group mode; if null → single mode
5+
'value' => null,
6+
'text' => null,
57
'badge' => null,
68
])
79

810
@php
911
$badge ??= $attributes->whereStartsWith('required')->isNotEmpty() ? 'Required' : null;
12+
$text ??= $value;
1013
@endphp
1114

1215
{{-- Group Mode (options array is passed) --}}
@@ -22,11 +25,10 @@
2225

2326
{{-- Single Checkbox Mode --}}
2427
@else
25-
<flux:field variant="inline">
26-
<flux:checkbox :$attributes />
27-
28-
<flux:label :$badge>{{ $label }}</flux:label>
29-
30-
<flux:error :$name />
31-
</flux:field>
28+
<flux:checkbox.group :$label :$badge :$attributes >
29+
<flux:checkbox
30+
:value="$value"
31+
:label="$text"
32+
/>
33+
</flux:checkbox.group>
3234
@endif

resources/views/examples/form.blade.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</div>
1414
</div>
1515
</div>
16-
<div class="region padded-small tint">
16+
<div class="region padded tint">
1717
<div class="container container-full">
1818
<div class="section">
1919
<h2>Basic Text</h2>
@@ -101,7 +101,9 @@ class="native-size"
101101
<form>
102102
<x-cds.checkbox
103103
name="terms"
104-
label="I agree to the terms and conditions"
104+
label="Terms and Conditions"
105+
description="Please review our terms and conditions before proceeding."
106+
value="I agree to the terms and conditions"
105107
required
106108
error:message="This field has an error."
107109

@@ -139,6 +141,8 @@ class="native-size"
139141
error:message="This field has an error."
140142

141143
/>
144+
<flux:separator class="mb-4" />
145+
142146
<x-cds.button type="submit">Submit</x-cds.button>
143147
<x-cds.button type="reset">Reset</x-cds.button>
144148
</form>

0 commit comments

Comments
 (0)