dev-idkwhoami/colored-inputs

0.1.0 2024-05-03 15:35 UTC

This package is auto-updated.

Last update: 2024-09-03 16:27:33 UTC


README

Latest Version on Packagist Total Downloads

此包为 Filament PHP(GitHub 链接)提供彩色文本值的 ColoredInput 字段。

安装

注意,此包目前仅与 Filament v3 兼容,目前没有计划发布兼容 v2 的版本。

您可以通过 composer 安装此包

composer require dev-idkwhoami/colored-inputs

如果资源未加载,请运行

php artisan filament:assets

ColoredInput 字段使用方法

以下样式可用

默认

Default Style

方形

Default Style

圆形

Default Style

完整

Default Style

要选择其中一个样式,只需将相应的方法链式附加到字段上,如下所示

ColoredInput::make('color')
    ->defaultStyle()
    ->squareStyle()
    ->circleStyle()
    ->fullStyle(),

可用方法概述

ColoredInput::make('color')
    ->defaultStyle()
    ->squareStyle()
    ->circleStyle()
    ->fullStyle()
    ->theme('large') // default|large|polaroid|pill
    ->themeMode('dark') // dark|light|auto !NOTE - auto uses the browsers preferred mode NOT from Filament!
    ->options(RawJs::make(<<<'JS'
            { alpha: false }
        JS)),

->options() 期望一个 RawJS 对象,该对象将被渲染为 JS 对象。

use DevIDKWHOAMI\ColoredInputs\Forms\Components\ColoredInput;

ColoredInput::make('color')
    ->squareStyle()
    ->options(RawJs::make(<<<'JS'
            { alpha: false }
        JS)),

以下选项由包使用,并且不应在选项对象中提供,因为它们由包本身设置

{
    themeMode, // is set by the package
    theme, // is set by the package
    el, // is internally set to the fields input
    defaultColor, // is set to the current state on init
    onChange // is used to update the state internally
}

有关如何自定义颜色选择器的更多信息,请参阅自定义指南

变更日志

有关最近更改的更多信息,请参阅变更日志

贡献

请参阅贡献指南以获取详细信息。

致谢

此包基于 JavaScript 库coloris

许可证

MIT 许可证(MIT)。有关更多信息,请参阅许可证文件