From 8cd77959bff55ae5d258989810e9e85fa0bb397d Mon Sep 17 00:00:00 2001 From: Irineu Junior Date: Tue, 20 Feb 2024 10:39:33 -0300 Subject: [PATCH] feat(components) cria componentes de date, time e datetime --- docs/form.md | 9 +++++++++ src/Providers/BladeServiceProvider.php | 3 +++ src/View/Components/Forms/Inputs/Date.php | 20 +++++++++++++++++++ src/View/Components/Forms/Inputs/Datetime.php | 20 +++++++++++++++++++ src/View/Components/Forms/Inputs/Input.php | 3 ++- src/View/Components/Forms/Inputs/Time.php | 20 +++++++++++++++++++ 6 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 src/View/Components/Forms/Inputs/Date.php create mode 100644 src/View/Components/Forms/Inputs/Datetime.php create mode 100644 src/View/Components/Forms/Inputs/Time.php diff --git a/docs/form.md b/docs/form.md index dbf174b..af90df9 100644 --- a/docs/form.md +++ b/docs/form.md @@ -46,6 +46,15 @@
+
+ +
+
+ +
+
+ +
diff --git a/src/Providers/BladeServiceProvider.php b/src/Providers/BladeServiceProvider.php index efb8637..030d8df 100644 --- a/src/Providers/BladeServiceProvider.php +++ b/src/Providers/BladeServiceProvider.php @@ -82,12 +82,15 @@ public function bootComponents(): void Blade::component($prefix . 'form.hint', Components\Forms\Hint::class); Blade::component($prefix . 'form.label', Components\Forms\Label::class); Blade::component($prefix . 'form.checkbox', Components\Forms\Inputs\Checkbox::class); + Blade::component($prefix . 'form.date', Components\Forms\Inputs\Date::class); + Blade::component($prefix . 'form.datetime', Components\Forms\Inputs\Datetime::class); Blade::component($prefix . 'form.input', Components\Forms\Inputs\Input::class); Blade::component($prefix . 'form.password', Components\Forms\Inputs\Password::class); Blade::component($prefix . 'form.plaintext', Components\Forms\Inputs\Plaintext::class); Blade::component($prefix . 'form.radio', Components\Forms\Inputs\Radio::class); Blade::component($prefix . 'form.select', Components\Forms\Inputs\Select::class); Blade::component($prefix . 'form.textarea', Components\Forms\Inputs\Textarea::class); + Blade::component($prefix . 'form.time', Components\Forms\Inputs\Time::class); Blade::component($prefix . 'form.toggle', Components\Forms\Inputs\Toggle::class); Blade::component($prefix . 'form.toggle-notification', Components\Forms\Inputs\ToggleNotification::class); Blade::component($prefix . 'page.body', Components\Pages\Body::class); diff --git a/src/View/Components/Forms/Inputs/Date.php b/src/View/Components/Forms/Inputs/Date.php new file mode 100644 index 0000000..64aad71 --- /dev/null +++ b/src/View/Components/Forms/Inputs/Date.php @@ -0,0 +1,20 @@ +uuid = '-' . str(serialize($this)) ->pipe('md5') @@ -29,7 +30,7 @@ public function render(): string|View @endif merge([ - 'type' => 'text', + 'type' => $type, 'id' => $name . $uuid, ])->class([ 'form-control', diff --git a/src/View/Components/Forms/Inputs/Time.php b/src/View/Components/Forms/Inputs/Time.php new file mode 100644 index 0000000..cd7db28 --- /dev/null +++ b/src/View/Components/Forms/Inputs/Time.php @@ -0,0 +1,20 @@ +