mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-28 07:43:18 +00:00
🎨 Add new Flux icons: implement multiple reusable icon components (e.g., hand-raised, hand-thumb-up, heart, hashtag, home) with variant support for improved UI consistency.
This commit is contained in:
67
resources/views/flux/checkbox/variants/buttons.blade.php
Normal file
67
resources/views/flux/checkbox/variants/buttons.blade.php
Normal file
@@ -0,0 +1,67 @@
|
||||
@blaze
|
||||
|
||||
@props([
|
||||
'accent' => true,
|
||||
'size' => 'base',
|
||||
'label' => null,
|
||||
'icon' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
$classes = Flux::classes()
|
||||
->add('flex relative items-center font-medium justify-center gap-2 whitespace-nowrap')
|
||||
->add(match ($size) {
|
||||
'base' => 'h-10 text-sm rounded-lg px-4 [&:has(>:not(span):first-child)]:ps-3 [&:has(>:not(span):last-child)]:pe-3',
|
||||
'sm' => 'h-8 text-sm rounded-md px-3',
|
||||
'xs' => 'h-6 text-xs rounded-md px-2',
|
||||
})
|
||||
->add(match ($size) {
|
||||
'base' => 'shadow-xs',
|
||||
'sm' => 'shadow-xs',
|
||||
'xs' => 'shadow-none',
|
||||
})
|
||||
->add('text-zinc-800 dark:text-white')
|
||||
->add('bg-white dark:bg-zinc-700')
|
||||
->add('after:absolute after:-inset-px after:rounded-lg')
|
||||
->add('border border-zinc-200 border-b-zinc-300/80 dark:border-zinc-600')
|
||||
->add([
|
||||
'[--haze:color-mix(in_oklab,_var(--color-accent-content),_transparent_97.5%)]',
|
||||
'[--haze-border:color-mix(in_oklab,_var(--color-accent-content),_transparent_80%)]',
|
||||
'[--haze-light:color-mix(in_oklab,_var(--color-accent),_transparent_98%)]',
|
||||
'dark:[--haze:color-mix(in_oklab,_var(--color-accent-content),_transparent_90%)]',
|
||||
])
|
||||
->add(match ($accent) {
|
||||
true => [
|
||||
'hover:border-[var(--haze-border)] dark:hover:border-zinc-500',
|
||||
'dark:data-checked:bg-white/15 data-checked:border-(--color-accent) hover:data-checked:border-(--color-accent)',
|
||||
'hover:after:bg-[var(--haze-light)] dark:hover:after:bg-white/[4%] data-checked:after:bg-(--haze) hover:data-checked:after:bg-(--haze)',
|
||||
],
|
||||
false => [
|
||||
'hover:border-zinc-200 dark:hover:border-zinc-500',
|
||||
'data-checked:bg-zinc-50 dark:data-checked:bg-white/15 data-checked:border-zinc-800 dark:data-checked:border-white',
|
||||
'hover:bg-zinc-50 dark:hover:bg-zinc-600/75',
|
||||
],
|
||||
})
|
||||
->add('disabled:opacity-75 dark:disabled:opacity-75 disabled:cursor-default disabled:pointer-events-none')
|
||||
;
|
||||
|
||||
$iconAttributes = Flux::attributesAfter('icon:', $attributes, [
|
||||
'class' => 'text-zinc-300 dark:text-zinc-400 in-data-checked:text-zinc-800 dark:in-data-checked:text-white',
|
||||
'variant' => 'micro',
|
||||
]);
|
||||
@endphp
|
||||
|
||||
{{-- We have to put tabindex="-1" here because otherwise, Livewire requests will wipe out tabindex state, --}}
|
||||
{{-- even with durable attributes for some reason... --}}
|
||||
{{-- We have to put "data-flux-field" so that a single box can be disabled without "disabling" the group field label... --}}
|
||||
<ui-checkbox {{ $attributes->class($classes) }} data-flux-control data-flux-checkbox-buttons tabindex="-1" data-flux-field>
|
||||
<?php if (is_string($icon) && $icon !== ''): ?>
|
||||
<flux:icon :icon="$icon" :attributes="$iconAttributes" />
|
||||
<?php elseif ($icon): ?>
|
||||
{{ $icon }}
|
||||
<?php endif; ?>
|
||||
|
||||
@if (isset($label) || $slot->isNotEmpty())
|
||||
<span>{{ $label ?? $slot }}</span>
|
||||
@endif
|
||||
</ui-checkbox>
|
||||
78
resources/views/flux/checkbox/variants/cards.blade.php
Normal file
78
resources/views/flux/checkbox/variants/cards.blade.php
Normal file
@@ -0,0 +1,78 @@
|
||||
@blaze
|
||||
|
||||
@php $iconVariant ??= $attributes->pluck('icon:variant'); @endphp
|
||||
|
||||
@aware([ 'indicator' ])
|
||||
|
||||
@props([
|
||||
'iconVariant' => 'micro',
|
||||
'description' => null,
|
||||
'indicator' => true,
|
||||
'accent' => true,
|
||||
'label' => null,
|
||||
'icon' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
|
||||
$iconClasses = Flux::classes()
|
||||
->add('inline-block mt-0.5 text-zinc-400 [ui-checkbox[data-checked]_&]:text-zinc-800 dark:[ui-checkbox[data-checked]_&]:text-white')
|
||||
// When using the outline icon variant, we need to size it down to match the default icon sizes...
|
||||
->add($iconVariant === 'outline' ? 'size-4' : '')
|
||||
;
|
||||
|
||||
$classes = Flux::classes()
|
||||
->add('relative flex justify-between gap-3 flex-1 p-4')
|
||||
->add('rounded-lg shadow-xs')
|
||||
->add('bg-white dark:bg-white/10 dark:hover:bg-white/15 dark:data-checked:bg-white/15')
|
||||
->add('after:absolute after:-inset-px after:rounded-lg')
|
||||
->add('border border-zinc-800/15 dark:border-white/10')
|
||||
->add([
|
||||
'[--haze:color-mix(in_oklab,_var(--color-accent-content),_transparent_97.5%)]',
|
||||
'[--haze-border:color-mix(in_oklab,_var(--color-accent-content),_transparent_80%)]',
|
||||
'[--haze-light:color-mix(in_oklab,_var(--color-accent),_transparent_98%)]',
|
||||
'dark:[--haze:color-mix(in_oklab,_var(--color-accent-content),_transparent_90%)]',
|
||||
])
|
||||
->add(match ($accent) {
|
||||
true => [
|
||||
'[&:hover_[data-flux-checkbox-indicator]]:border-[var(--haze-border)] dark:[&:hover_[data-flux-checkbox-indicator]]:border-white/10',
|
||||
'hover:border-[var(--haze-border)] dark:hover:border-white/10',
|
||||
|
||||
'data-checked:border-(--color-accent) hover:data-checked:border-(--color-accent) dark:data-checked:bg-white/15 ',
|
||||
'hover:after:bg-[var(--haze-light)] dark:hover:after:bg-white/[4%] data-checked:after:bg-(--haze) hover:data-checked:after:bg-(--haze)',
|
||||
],
|
||||
false => [
|
||||
'data-checked:bg-zinc-50 dark:data-checked:bg-white/15 data-checked:border-zinc-800 dark:data-checked:border-white',
|
||||
'hover:bg-zinc-50 dark:hover:bg-white/15',
|
||||
],
|
||||
})
|
||||
->add('[&[disabled]]:opacity-50 dark:[&[disabled]]:opacity-75 [&[disabled]]:cursor-default [&[disabled]]:pointer-events-none')
|
||||
;
|
||||
@endphp
|
||||
|
||||
{{-- We have to put tabindex="-1" here because otherwise, Livewire requests will wipe out tabindex state, --}}
|
||||
{{-- even with durable attributes for some reason... --}}
|
||||
{{-- We have to put "data-flux-field" so that a single box can be disabled without "disabling" the group field label... --}}
|
||||
<ui-checkbox {{ $attributes->class($classes) }} data-flux-control data-flux-checkbox-cards tabindex="-1" data-flux-field>
|
||||
<?php if ($label): ?>
|
||||
<div class="flex-1 flex gap-2">
|
||||
<?php if (is_string($icon) && $icon !== ''): ?>
|
||||
<flux:icon :icon="$icon" :variant="$iconVariant" :class="$iconClasses" />
|
||||
<?php elseif ($icon): ?>
|
||||
{{ $icon }}
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="flex-1">
|
||||
<flux:heading>{{ $label ?? $slot }}</flux:heading>
|
||||
|
||||
<?php if ($description): ?>
|
||||
<flux:subheading size="sm">{{ $description }}</flux:subheading>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<flux:checkbox.indicator />
|
||||
<?php else: ?>
|
||||
{{ $slot }}
|
||||
<?php endif; ?>
|
||||
</ui-checkbox>
|
||||
25
resources/views/flux/checkbox/variants/default.blade.php
Normal file
25
resources/views/flux/checkbox/variants/default.blade.php
Normal file
@@ -0,0 +1,25 @@
|
||||
@blaze
|
||||
|
||||
@props([
|
||||
'name' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
// We only want to show the name attribute on the checkbox if it has been set
|
||||
// manually, but not if it has been set from the wire:model attribute...
|
||||
$showName = isset($name);
|
||||
|
||||
if (! isset($name)) {
|
||||
$name = $attributes->whereStartsWith('wire:model')->first();
|
||||
}
|
||||
|
||||
$classes = Flux::classes()
|
||||
->add('flex size-[1.125rem] rounded-[.3rem] mt-px outline-offset-2')
|
||||
;
|
||||
@endphp
|
||||
|
||||
<flux:with-inline-field :$attributes>
|
||||
<ui-checkbox {{ $attributes->class($classes) }} @if($showName) name="{{ $name }}" @endif data-flux-control data-flux-checkbox>
|
||||
<flux:checkbox.indicator />
|
||||
</ui-checkbox>
|
||||
</flux:with-inline-field>
|
||||
29
resources/views/flux/checkbox/variants/pills.blade.php
Normal file
29
resources/views/flux/checkbox/variants/pills.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
@blaze
|
||||
|
||||
@props([
|
||||
'accent' => true,
|
||||
'label' => null,
|
||||
])
|
||||
|
||||
@php
|
||||
$classes = Flux::classes()
|
||||
->add('flex whitespace-nowrap gap-2 items-center py-1 px-2 rounded-full text-sm font-medium leading-4')
|
||||
->add('bg-zinc-800/6 dark:bg-white/10 hover:bg-zinc-800/10 dark:hover:bg-white/15 text-zinc-800 hover:text-zinc-800 dark:text-white/70 dark:hover:text-white')
|
||||
->add(match ($accent) {
|
||||
true => 'data-checked:bg-(--color-accent) hover:data-checked:bg-(--color-accent)',
|
||||
false => 'data-checked:bg-zinc-800 dark:data-checked:bg-white',
|
||||
})
|
||||
->add(match ($accent) {
|
||||
true => 'data-checked:text-(--color-accent-foreground) hover:data-checked:text-(--color-accent-foreground)',
|
||||
false => 'data-checked:text-white dark:data-checked:text-zinc-800',
|
||||
})
|
||||
->add('[&[disabled]]:opacity-50 dark:[&[disabled]]:opacity-75 [&[disabled]]:cursor-default [&[disabled]]:pointer-events-none')
|
||||
;
|
||||
@endphp
|
||||
|
||||
{{-- We have to put tabindex="-1" here because otherwise, Livewire requests will wipe out tabindex state, --}}
|
||||
{{-- even with durable attributes for some reason... --}}
|
||||
{{-- We have to put "data-flux-field" so that a single box can be disabled without "disabling" the group field label... --}}
|
||||
<ui-checkbox {{ $attributes->class($classes) }} data-flux-control data-flux-checkbox-pills tabindex="-1" data-flux-field>
|
||||
{{ $label ?? $slot }}
|
||||
</ui-checkbox>
|
||||
Reference in New Issue
Block a user