merge($getExtraAttributes(), escape: false) ->class([ 'fi-ta-toggle', 'px-3 py-4' => ! $isInline(), ])); ?> >
x-on:click.stop.prevent=" if (isLoading || $el.hasAttribute('disabled')) { return } const updatedState = ! state // Only update the state if the toggle is being turned off, // otherwise it will flicker on twice when Livewire replaces // the element. if (state) { state = false } isLoading = true const response = await $wire.updateTableColumnState( toHtml() ?>, toHtml() ?>, updatedState, ) error = response?.error ?? undefined // The state is only updated on the frontend if the toggle is // being turned off, so we only need to reset it then. if (! state && error) { state = ! state } isLoading = false " x-tooltip=" error === undefined ? false : { content: error, theme: $store.theme, } " x-bind:class=" (state ? ' 'bg-gray-200 dark:bg-gray-700', default => 'fi-color-custom bg-custom-600', }, is_string($onColor) ? "fi-color-{$onColor}" : null, ])); ?>' : ' 'bg-gray-200 dark:bg-gray-700', default => 'fi-color-custom bg-custom-600', }, is_string($offColor) ? "fi-color-{$offColor}" : null, ])); ?>') + (isLoading ? ' opacity-70 pointer-events-none' : '') " x-bind:style=" state ? '' : '' " class=" $isDisabled, ]); ?>" >