🎨 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:
HolgerHatGarKeineNode
2026-01-23 23:00:02 +01:00
parent 578e4f13fc
commit b30fec150c
792 changed files with 307541 additions and 117 deletions

View File

@@ -0,0 +1,2 @@
<flux:checkbox all :$attributes />

View File

@@ -0,0 +1,5 @@
@props([
'variant' => 'default',
])
<flux:delegate-component :component="'checkbox.group.variants.' . $variant">{{ $slot }}</flux:delegate-component>

View File

@@ -0,0 +1,25 @@
@props([
'variant' => null,
'size' => null,
'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 flex-wrap gap-2')
;
@endphp
<flux:with-field :$attributes>
<ui-checkbox-group {{ $attributes->class($classes) }} @if($showName) name="{{ $name }}" @endif data-flux-checkbox-group-buttons>
{{ $slot }}
</ui-checkbox-group>
</flux:with-field>

View File

@@ -0,0 +1,25 @@
@props([
'variant' => null,
'size' => null,
'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 gap-3')
;
@endphp
<flux:with-field :$attributes>
<ui-checkbox-group {{ $attributes->class($classes) }} @if($showName) name="{{ $name }}" @endif data-flux-checkbox-group-cards>
{{ $slot }}
</ui-checkbox-group>
</flux:with-field>

View File

@@ -0,0 +1,22 @@
@php
$classes = Flux::classes()
->add('*:data-flux-field:mb-3')
->add('[&>[data-flux-field]:has(>[data-flux-description])]:mb-4')
->add('[&>[data-flux-field]:last-child]:mb-0!')
;
// Support adding the .self modifier to the wire:model directive...
if (($wireModel = $attributes->wire('model')) && $wireModel->directive && ! $wireModel->hasModifier('self')) {
unset($attributes[$wireModel->directive]);
$wireModel->directive .= '.self';
$attributes = $attributes->merge([$wireModel->directive => $wireModel->value]);
}
@endphp
<flux:with-field :$attributes>
<ui-checkbox-group {{ $attributes->class($classes) }} data-flux-checkbox-group>
{{ $slot }}
</ui-checkbox-group>
</flux:with-field>

View File

@@ -0,0 +1,25 @@
@props([
'variant' => null,
'size' => null,
'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 flex-wrap gap-3')
;
@endphp
<flux:with-field :$attributes>
<ui-checkbox-group {{ $attributes->class($classes) }} @if($showName) name="{{ $name }}" @endif data-flux-checkbox-group-pills>
{{ $slot }}
</ui-checkbox-group>
</flux:with-field>

View File

@@ -0,0 +1,16 @@
@blaze
@aware([ 'variant' ])
@props([
'variant' => 'default',
])
@php
// This prevents variants picked up by `@aware()` from other wrapping components like flux::modal from being used here...
$variant = $variant !== 'default' && Flux::componentExists('checkbox.variants.' . $variant)
? $variant
: 'default';
@endphp
<flux:delegate-component :component="'checkbox.variants.' . $variant">{{ $slot }}</flux:delegate-component>

View File

@@ -0,0 +1,32 @@
@blaze
@php
$classes = Flux::classes()
->add('shrink-0 size-[1.125rem] rounded-[.3rem] flex justify-center items-center')
->add('text-sm text-zinc-700 dark:text-zinc-800')
->add('shadow-xs [ui-checkbox[disabled]_&]:opacity-75 [ui-checkbox[data-checked][disabled]_&]:opacity-50 [ui-checkbox[disabled]_&]:shadow-none [ui-checkbox[data-checked]_&]:shadow-none [ui-checkbox[data-indeterminate]_&]:shadow-none')
->add('[ui-checkbox[data-checked]:not([data-indeterminate])_&>svg:first-child]:block [ui-checkbox[data-indeterminate]_&>svg:last-child]:block')
->add([
'border',
'border-zinc-300 dark:border-white/10',
'[ui-checkbox[disabled]_&]:border-zinc-200 dark:[ui-checkbox[disabled]_&]:border-white/5',
'[ui-checkbox[data-checked]_&]:border-transparent [ui-checkbox[data-indeterminate]_&]:border-transparent',
'[ui-checkbox[disabled][data-checked]_&]:border-transparent [ui-checkbox[disabled][data-indeterminate]_&]:border-transparent',
'[print-color-adjust:exact]',
])
->add([
'bg-white dark:bg-white/10',
'[ui-checkbox[data-checked]_&]:bg-[var(--color-accent)]',
'hover:[ui-checkbox[data-checked]_&]:bg-(--color-accent)',
'focus:[ui-checkbox[data-checked]_&]:bg-(--color-accent)',
'[ui-checkbox[data-indeterminate]_&]:bg-[var(--color-accent)]',
'hover:[ui-checkbox[data-indeterminate]_&]:bg-(--color-accent)',
'focus:[ui-checkbox[data-indeterminate]_&]:bg-(--color-accent)',
])
;
@endphp
<div {{ $attributes->class($classes) }} data-flux-checkbox-indicator>
<flux:icon.check variant="micro" class="hidden text-[var(--color-accent-foreground)]" />
<flux:icon.minus variant="micro" class="hidden text-[var(--color-accent-foreground)]" />
</div>

View 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>

View 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>

View 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>

View 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>