/*
 * CoolerControl - monitor and control your cooling and other devices
 * Copyright (c) 2021-2025  Guy Boldon and contributors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

export default {
    root: ({ props }) => ({
        class: [
            'relative',
            { 'flex [&>input]:w-full': props.fluid, 'inline-flex': !props.fluid },
            {
                'opacity-60 select-none pointer-events-none cursor-default': props.disabled,
            },
            { '[&>input]:pr-10': props.toggleMask },
        ],
    }),
    overlay: {
        class: [
            // Spacing
            'p-5',
            // for password change meter:
            'mt-[4.5rem]',

            // Shape
            'border border-border-one',
            'shadow-lg rounded-lg',

            // Colors
            'bg-bg-one',
            'text-text-color',
            // 'bg-surface-0 dark:bg-surface-900',
            // 'text-surface-700 dark:text-white/80',
            // 'dark:border-surface-700',
        ],
    },
    meter: {
        class: [
            // Position and Overflow
            'overflow-hidden',
            'relative',

            // Shape and Size
            'border border-border-one',
            'h-3',

            // Spacing
            'mb-2',

            // Colors
            'bg-bg-two',
        ],
    },
    meterLabel: ({ instance }) => ({
        class: [
            // Size
            'h-full',

            // Colors
            {
                'bg-error': instance?.meter?.strength === 'weak',
                'bg-warning': instance?.meter?.strength === 'medium',
                'bg-green': instance?.meter?.strength === 'strong',
            },

            // Transitions
            'transition-all duration-1000 ease-in-out',
        ],
    }),
    maskIcon: {
        class: ['absolute top-1/2 right-3 -mt-2 z-10', 'text-text-color-secondary'],
    },
    unmaskIcon: {
        class: ['absolute top-1/2 right-3 -mt-2 z-10', 'text-text-color-secondary'],
    },
    transition: {
        enterFromClass: 'opacity-0 scale-y-[0.8]',
        enterActiveClass:
            'transition-[transform,opacity] duration-[120ms] ease-[cubic-bezier(0,0,0.2,1)]',
        leaveActiveClass: 'transition-opacity duration-100 ease-linear',
        leaveToClass: 'opacity-0',
    },
}
