File tree Expand file tree Collapse file tree 4 files changed +39
-9
lines changed
stubs/resources/views/flux Expand file tree Collapse file tree 4 files changed +39
-9
lines changed Original file line number Diff line number Diff line change 1
1
@props ([
2
- ' name' => $attributes -> whereStartsWith ( ' wire:model ' ) -> first () ,
2
+ ' name' => null ,
3
3
] )
4
4
5
5
@php
6
+ // We only want to show the name attribute on the checkbox if it has been set
7
+ // manually, but not if it has been set from the wire:model attribute...
8
+ $showName = isset ($name );
9
+
10
+ if (! isset ($name )) {
11
+ $name = $attributes -> whereStartsWith (' wire:model' )-> first ();
12
+ }
13
+
6
14
$classes = Flux:: classes ()
7
15
-> add (' flex size-[1.125rem] rounded-[.3rem] mt-px outline-offset-2' )
8
16
;
9
17
@endphp
10
18
11
19
<flux:with-inline-field :$attributes >
12
- <ui-checkbox {{ $attributes -> class ($classes ) } } data-flux-control data-flux-checkbox >
20
+ <ui-checkbox {{ $attributes -> class ($classes ) } } @if ( $showName ) name = " {{ $name } } " @endif data-flux-control data-flux-checkbox >
13
21
<flux:checkbox .indicator />
14
22
</ui-checkbox >
15
23
</flux:with-inline-field >
Original file line number Diff line number Diff line change 1
1
@props ([
2
- ' name' => $attributes -> whereStartsWith ( ' wire:model ' ) -> first () ,
2
+ ' name' => null ,
3
3
' variant' => null ,
4
4
] )
5
5
6
6
@php
7
+ // We only want to show the name attribute it has been set manually
8
+ // but not if it has been set from the `wire:model` attribute...
9
+ $showName = isset ($name );
10
+ if (! isset ($name )) {
11
+ $name = $attributes -> whereStartsWith (' wire:model' )-> first ();
12
+ }
13
+
7
14
$classes = Flux:: classes ()
8
15
// Adjust spacing between fields...
9
16
-> add (' *:data-flux-field:mb-3' )
13
20
@endphp
14
21
15
22
<flux:with-field :$attributes >
16
- <ui-radio-group {{ $attributes -> class ($classes ) } } data-flux-radio-group >
23
+ <ui-radio-group {{ $attributes -> class ($classes ) } } @if ( $showName ) name = " {{ $name } } " @endif data-flux-radio-group >
17
24
{{ $slot } }
18
25
</ui-radio-group >
19
26
</flux:with-field >
Original file line number Diff line number Diff line change 1
1
@props ([
2
- ' name' => $attributes -> whereStartsWith ( ' wire:model ' ) -> first () ,
2
+ ' name' => null ,
3
3
' variant' => null ,
4
4
' size' => null ,
5
5
] )
6
6
7
7
@php
8
+ // We only want to show the name attribute on the checkbox if it has been set
9
+ // manually, but not if it has been set from the wire:model attribute...
10
+ $showName = isset ($name );
11
+
12
+ if (! isset ($name )) {
13
+ $name = $attributes -> whereStartsWith (' wire:model' )-> first ();
14
+ }
15
+
8
16
$classes = Flux:: classes ()
9
17
-> add (' block flex p-1' )
10
18
-> add (' rounded-lg bg-zinc-800/5 dark:bg-white/10' )
14
22
@endphp
15
23
16
24
<flux:with-field :$attributes >
17
- <ui-radio-group {{ $attributes -> class ($classes ) } } data-flux-radio-group-segmented >
25
+ <ui-radio-group {{ $attributes -> class ($classes ) } } @if ( $showName ) name = " {{ $name } } " @endif data-flux-radio-group-segmented >
18
26
{{ $slot } }
19
27
</ui-radio-group >
20
28
</flux:with-field >
Original file line number Diff line number Diff line change 1
1
@props ([
2
- ' name' => $attributes -> whereStartsWith ( ' wire:model ' ) -> first () ,
2
+ ' name' => null ,
3
3
' align' => ' right' ,
4
4
] )
5
5
6
6
@php
7
+ // We only want to show the name attribute it has been set manually
8
+ // but not if it has been set from the `wire:model` attribute...
9
+ $showName = isset ($name );
10
+ if (! isset ($name )) {
11
+ $name = $attributes -> whereStartsWith (' wire:model' )-> first ();
12
+ }
13
+
7
14
$classes = Flux:: classes ()
8
15
-> add (' group h-5 w-8 min-w-8 relative inline-flex items-center outline-offset-2' )
9
16
-> add (' rounded-full' )
29
36
30
37
@if ($align === ' left' || $align === ' start' )
31
38
<flux:with-inline-field :$attributes >
32
- <ui-switch {{ $attributes -> class ($classes ) } } data-flux-control data-flux-switch >
39
+ <ui-switch {{ $attributes -> class ($classes ) } } @if ( $showName ) name = " {{ $name } } " @endif data-flux-control data-flux-switch >
33
40
<span class =" {{ \Illuminate \Support \Arr:: toCssClasses ($indicatorClasses ) } }" ></span >
34
41
</ui-switch >
35
42
</flux:with-inline-field >
36
43
@else
37
44
<flux:with-reversed-inline-field :$attributes >
38
- <ui-switch {{ $attributes -> class ($classes ) } } data-flux-control data-flux-switch >
45
+ <ui-switch {{ $attributes -> class ($classes ) } } @if ( $showName ) name = " {{ $name } } " @endif data-flux-control data-flux-switch >
39
46
<span class =" {{ \Illuminate \Support \Arr:: toCssClasses ($indicatorClasses ) } }" ></span >
40
47
</ui-switch >
41
48
</flux:with-reversed-inline-field >
You can’t perform that action at this time.
0 commit comments