From 22a4b6a3154da186d980f032a71acd4a1f8d120e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Mon, 20 May 2024 18:23:31 -0300 Subject: [PATCH 01/15] feat(table): finish table design --- .../views/components/api/event.blade.php | 3 -- .../views/components/api/events.blade.php | 27 +++++++++++++ .../views/components/api/prop.blade.php | 3 -- .../views/components/api/props.blade.php | 39 +++++++++++++++++++ .../views/components/api/slot.blade.php | 3 -- .../views/components/api/slots.blade.php | 27 +++++++++++++ .../views/sections/component-api.blade.php | 20 +++++++++- .../sections/components/select.blade.php | 6 +-- 8 files changed, 114 insertions(+), 14 deletions(-) delete mode 100644 src/resources/views/components/api/event.blade.php create mode 100644 src/resources/views/components/api/events.blade.php delete mode 100644 src/resources/views/components/api/prop.blade.php create mode 100644 src/resources/views/components/api/props.blade.php delete mode 100644 src/resources/views/components/api/slot.blade.php create mode 100644 src/resources/views/components/api/slots.blade.php diff --git a/src/resources/views/components/api/event.blade.php b/src/resources/views/components/api/event.blade.php deleted file mode 100644 index 1484a51..0000000 --- a/src/resources/views/components/api/event.blade.php +++ /dev/null @@ -1,3 +0,0 @@ -
- Event -
diff --git a/src/resources/views/components/api/events.blade.php b/src/resources/views/components/api/events.blade.php new file mode 100644 index 0000000..7f165ef --- /dev/null +++ b/src/resources/views/components/api/events.blade.php @@ -0,0 +1,27 @@ +@props(['events' => []]) + + + + + + + + + + + @foreach ($events as $key => $event) + + + + + @endforeach + +
+ Event + + Description +
+ {{ $key }} + + {{ data_get($event, 'description') }} +
diff --git a/src/resources/views/components/api/prop.blade.php b/src/resources/views/components/api/prop.blade.php deleted file mode 100644 index 516b56d..0000000 --- a/src/resources/views/components/api/prop.blade.php +++ /dev/null @@ -1,3 +0,0 @@ -
- Prop -
diff --git a/src/resources/views/components/api/props.blade.php b/src/resources/views/components/api/props.blade.php new file mode 100644 index 0000000..f361d2b --- /dev/null +++ b/src/resources/views/components/api/props.blade.php @@ -0,0 +1,39 @@ +@props(['props' => []]) + + + + + + + + + + + + + @foreach ($props as $key => $prop) + + + + + + + @endforeach + +
+ Prop + + Type + + Default + + Required +
+ {{ $key }} + + {{ data_get($prop, 'type') }} + + {{ data_get($prop, 'default') }} + + {{ data_get($prop, 'required') }} +
diff --git a/src/resources/views/components/api/slot.blade.php b/src/resources/views/components/api/slot.blade.php deleted file mode 100644 index 4aa7201..0000000 --- a/src/resources/views/components/api/slot.blade.php +++ /dev/null @@ -1,3 +0,0 @@ -
- Slot -
diff --git a/src/resources/views/components/api/slots.blade.php b/src/resources/views/components/api/slots.blade.php new file mode 100644 index 0000000..b5366d3 --- /dev/null +++ b/src/resources/views/components/api/slots.blade.php @@ -0,0 +1,27 @@ +@props(['slots' => []]) + + + + + + + + + + + @foreach ($slots as $key => $slot) + + + + + @endforeach + +
+ Slot + + Description +
+ {{ $key }} + + {{ data_get($slot, 'description') }} +
diff --git a/src/resources/views/sections/component-api.blade.php b/src/resources/views/sections/component-api.blade.php index 9610f5c..604babf 100644 --- a/src/resources/views/sections/component-api.blade.php +++ b/src/resources/views/sections/component-api.blade.php @@ -18,12 +18,28 @@ ?> - + @foreach ($items as $key => $item) @endforeach - @dump($this->getItems) + + @if ($this->tab === 'props') + + @endif + + @if ($this->tab === 'events') + + @endif + + @if ($this->tab === 'slots') + + @endif + diff --git a/src/resources/views/sections/components/select.blade.php b/src/resources/views/sections/components/select.blade.php index adb66f4..1e46821 100644 --- a/src/resources/views/sections/components/select.blade.php +++ b/src/resources/views/sections/components/select.blade.php @@ -21,7 +21,7 @@ - {{-- --}} + @@ -345,7 +345,7 @@ - {{-- + - @livewire("component-api", ['items' => WireUiDocs::getComponentApi('select')]) --}} + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('select')]) From 532fd7c2801863cea3f967b05c1e51a7d022b42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Mon, 20 May 2024 19:50:14 -0300 Subject: [PATCH 02/15] wip --- .../Unit/Support/{MenuDocsTest.php => WireUiDocsSupportTest.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/Unit/Support/{MenuDocsTest.php => WireUiDocsSupportTest.php} (100%) diff --git a/tests/Unit/Support/MenuDocsTest.php b/tests/Unit/Support/WireUiDocsSupportTest.php similarity index 100% rename from tests/Unit/Support/MenuDocsTest.php rename to tests/Unit/Support/WireUiDocsSupportTest.php From 2a7c33229319c5d15293e2c6276b230a19a37b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Tue, 21 May 2024 19:45:41 -0300 Subject: [PATCH 03/15] feat(packages): adding packages pages --- src/config.php | 18 ++-- .../{api => tables}/events.blade.php | 0 .../{api => tables}/props.blade.php | 0 .../{api => tables}/slots.blade.php | 0 .../{advanced => actions}/hooks.blade.php | 0 .../views/sections/component-api.blade.php | 6 +- .../alpinejs-hold-directive.blade.php | 91 +++++++++++++++++++ .../sections/packages/breadcrumbs.blade.php | 9 ++ .../sections/packages/heroicons.blade.php | 9 ++ .../packages/phosphor-icons.blade.php | 9 ++ 10 files changed, 132 insertions(+), 10 deletions(-) rename src/resources/views/components/{api => tables}/events.blade.php (100%) rename src/resources/views/components/{api => tables}/props.blade.php (100%) rename src/resources/views/components/{api => tables}/slots.blade.php (100%) rename src/resources/views/sections/{advanced => actions}/hooks.blade.php (100%) create mode 100644 src/resources/views/sections/packages/alpinejs-hold-directive.blade.php create mode 100644 src/resources/views/sections/packages/breadcrumbs.blade.php create mode 100644 src/resources/views/sections/packages/heroicons.blade.php create mode 100644 src/resources/views/sections/packages/phosphor-icons.blade.php diff --git a/src/config.php b/src/config.php index ecf215d..e38ab38 100644 --- a/src/config.php +++ b/src/config.php @@ -54,6 +54,7 @@ 'Actions' => [ 'Actions' => [ + 'Hooks', 'Dialogs', 'Notifications', ], @@ -67,9 +68,12 @@ ], ], - 'Advanced' => [ - 'Advanced' => [ - 'Hooks', + 'Packages' => [ + 'Packages' => [ + 'AlpineJS Hold Directive', + 'Breadcrumbs', + 'Heroicons', + 'Phosphor Icons', ], ], ], @@ -81,15 +85,15 @@ */ 'default_pages' => [ - 'advanced' => 'hooks', - - 'actions' => 'dialogs', + 'getting-started' => 'installation', 'components' => 'alert', + 'actions' => 'hooks', + 'customize' => 'colors', - 'getting-started' => 'installation', + 'packages' => 'alpinejs-hold-directive', ], /* diff --git a/src/resources/views/components/api/events.blade.php b/src/resources/views/components/tables/events.blade.php similarity index 100% rename from src/resources/views/components/api/events.blade.php rename to src/resources/views/components/tables/events.blade.php diff --git a/src/resources/views/components/api/props.blade.php b/src/resources/views/components/tables/props.blade.php similarity index 100% rename from src/resources/views/components/api/props.blade.php rename to src/resources/views/components/tables/props.blade.php diff --git a/src/resources/views/components/api/slots.blade.php b/src/resources/views/components/tables/slots.blade.php similarity index 100% rename from src/resources/views/components/api/slots.blade.php rename to src/resources/views/components/tables/slots.blade.php diff --git a/src/resources/views/sections/advanced/hooks.blade.php b/src/resources/views/sections/actions/hooks.blade.php similarity index 100% rename from src/resources/views/sections/advanced/hooks.blade.php rename to src/resources/views/sections/actions/hooks.blade.php diff --git a/src/resources/views/sections/component-api.blade.php b/src/resources/views/sections/component-api.blade.php index 604babf..9d8eacb 100644 --- a/src/resources/views/sections/component-api.blade.php +++ b/src/resources/views/sections/component-api.blade.php @@ -31,15 +31,15 @@ @if ($this->tab === 'props') - + @endif @if ($this->tab === 'events') - + @endif @if ($this->tab === 'slots') - + @endif diff --git a/src/resources/views/sections/packages/alpinejs-hold-directive.blade.php b/src/resources/views/sections/packages/alpinejs-hold-directive.blade.php new file mode 100644 index 0000000..604d73b --- /dev/null +++ b/src/resources/views/sections/packages/alpinejs-hold-directive.blade.php @@ -0,0 +1,91 @@ +
+ + + + + + + + + + + + + + + + + + + + + + Requirements + + + + + + + + + + + + Installation + + + + @verbatim + Installation + @endverbatim + + + + + + Publishing + + + + @verbatim + Publishing + @endverbatim + + + + + + Configure + + + + @verbatim + Configure + @endverbatim + + + + + + How to use it? + + + + @verbatim + How to use it? + @endverbatim + + + + + + Directive API + + + + @verbatim + Directive API + @endverbatim + +
diff --git a/src/resources/views/sections/packages/breadcrumbs.blade.php b/src/resources/views/sections/packages/breadcrumbs.blade.php new file mode 100644 index 0000000..75446d0 --- /dev/null +++ b/src/resources/views/sections/packages/breadcrumbs.blade.php @@ -0,0 +1,9 @@ +
+ + + + + + + +
diff --git a/src/resources/views/sections/packages/heroicons.blade.php b/src/resources/views/sections/packages/heroicons.blade.php new file mode 100644 index 0000000..363d92d --- /dev/null +++ b/src/resources/views/sections/packages/heroicons.blade.php @@ -0,0 +1,9 @@ +
+ + + + + + + +
diff --git a/src/resources/views/sections/packages/phosphor-icons.blade.php b/src/resources/views/sections/packages/phosphor-icons.blade.php new file mode 100644 index 0000000..098839e --- /dev/null +++ b/src/resources/views/sections/packages/phosphor-icons.blade.php @@ -0,0 +1,9 @@ +
+ + + + + + + +
From f84adae171d80b3269cfa26baf83cc9162cc3b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Tue, 21 May 2024 19:49:39 -0300 Subject: [PATCH 04/15] wip --- .../sections/packages/breadcrumbs.blade.php | 84 ++++++++++++++++++- .../sections/packages/heroicons.blade.php | 84 ++++++++++++++++++- .../packages/phosphor-icons.blade.php | 84 ++++++++++++++++++- 3 files changed, 249 insertions(+), 3 deletions(-) diff --git a/src/resources/views/sections/packages/breadcrumbs.blade.php b/src/resources/views/sections/packages/breadcrumbs.blade.php index 75446d0..36ac7e3 100644 --- a/src/resources/views/sections/packages/breadcrumbs.blade.php +++ b/src/resources/views/sections/packages/breadcrumbs.blade.php @@ -1,9 +1,91 @@
- + + + + + + + + + + + + + + + + Requirements + + + + + + + + + + + + Installation + + + + @verbatim + Installation + @endverbatim + + + + + + Publishing + + + + @verbatim + Publishing + @endverbatim + + + + + + Configure + + + + @verbatim + Configure + @endverbatim + + + + + + How to use it? + + + + @verbatim + How to use it? + @endverbatim + + + + + + Directive API + + + + @verbatim + Directive API + @endverbatim +
diff --git a/src/resources/views/sections/packages/heroicons.blade.php b/src/resources/views/sections/packages/heroicons.blade.php index 363d92d..f38a232 100644 --- a/src/resources/views/sections/packages/heroicons.blade.php +++ b/src/resources/views/sections/packages/heroicons.blade.php @@ -1,9 +1,91 @@
- + + + + + + + + + + + + + + + + Requirements + + + + + + + + + + + + Installation + + + + @verbatim + Installation + @endverbatim + + + + + + Publishing + + + + @verbatim + Publishing + @endverbatim + + + + + + Configure + + + + @verbatim + Configure + @endverbatim + + + + + + How to use it? + + + + @verbatim + How to use it? + @endverbatim + + + + + + Directive API + + + + @verbatim + Directive API + @endverbatim +
diff --git a/src/resources/views/sections/packages/phosphor-icons.blade.php b/src/resources/views/sections/packages/phosphor-icons.blade.php index 098839e..495ed08 100644 --- a/src/resources/views/sections/packages/phosphor-icons.blade.php +++ b/src/resources/views/sections/packages/phosphor-icons.blade.php @@ -1,9 +1,91 @@
- + + + + + + + + + + + + + + + + Requirements + + + + + + + + + + + + Installation + + + + @verbatim + Installation + @endverbatim + + + + + + Publishing + + + + @verbatim + Publishing + @endverbatim + + + + + + Configure + + + + @verbatim + Configure + @endverbatim + + + + + + How to use it? + + + + @verbatim + How to use it? + @endverbatim + + + + + + Directive API + + + + @verbatim + Directive API + @endverbatim +
From 83ddfd67eed613f0eca2aa51e6759d595e4bae68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Tue, 21 May 2024 20:42:42 -0300 Subject: [PATCH 05/15] feat(packages): finish alpinejs-hold-directive and breadcrumbs pages --- src/helpers.php | 8 +- .../views/components/code/block.blade.php | 4 +- .../views/components/code/preview.blade.php | 4 +- .../tables/alpinejs-hold-directive.blade.php | 88 ++++++++++ .../views/components/tables/index.blade.php | 9 + .../views/sections/component-api.blade.php | 8 +- .../customize/contribution-guide.blade.php | 16 ++ .../getting-started/installation.blade.php | 3 +- .../alpinejs-hold-directive.blade.php | 73 ++++---- .../sections/packages/breadcrumbs.blade.php | 162 +++++++++++++++--- 10 files changed, 309 insertions(+), 66 deletions(-) create mode 100644 src/resources/views/components/tables/alpinejs-hold-directive.blade.php create mode 100644 src/resources/views/components/tables/index.blade.php diff --git a/src/helpers.php b/src/helpers.php index 0b8d03a..4df7fc1 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -3,14 +3,16 @@ use Illuminate\Support\Str; if (! function_exists('serialize_slot')) { - function serialize_slot(mixed $slot): string + function serialize_slot(mixed $slot, mixed $size = null): string { $content = html_entity_decode($slot); $lines = collect(explode(PHP_EOL, $content)); - $tab = str_repeat(' ', strlen($lines->last()) - strlen(trim($lines->last()))); + $size ??= strlen($lines->last()) - strlen(trim($lines->last())); - return $lines->map(fn (string $line) => Str::replaceFirst($tab, '', $line))->implode(PHP_EOL); + return $lines->map(function (string $line) use ($size) { + return Str::replaceFirst(str_repeat(' ', $size), '', $line); + })->implode(PHP_EOL); } } diff --git a/src/resources/views/components/code/block.blade.php b/src/resources/views/components/code/block.blade.php index 66507da..e715da2 100644 --- a/src/resources/views/components/code/block.blade.php +++ b/src/resources/views/components/code/block.blade.php @@ -1,4 +1,4 @@ -@props(['language', 'clean' => false, 'noCopy' => false, 'lineNumbers' => true, 'render' => false]) +@props(['language', 'clean' => false, 'noCopy' => false, 'lineNumbers' => true, 'render' => false, 'tab' => null])
class([ @@ -16,7 +16,7 @@ @endif
- +
@if (!$noCopy) diff --git a/src/resources/views/components/code/preview.blade.php b/src/resources/views/components/code/preview.blade.php index ec64318..81cc4b7 100644 --- a/src/resources/views/components/code/preview.blade.php +++ b/src/resources/views/components/code/preview.blade.php @@ -1,4 +1,4 @@ -@props(['language', 'clean' => false, 'noCopy' => false, 'lineNumbers' => true, 'color' => false]) +@props(['language', 'clean' => false, 'noCopy' => false, 'lineNumbers' => true, 'color' => false, 'tab' => null])
class([ @@ -20,7 +20,7 @@
- +
diff --git a/src/resources/views/components/tables/alpinejs-hold-directive.blade.php b/src/resources/views/components/tables/alpinejs-hold-directive.blade.php new file mode 100644 index 0000000..64b1fec --- /dev/null +++ b/src/resources/views/components/tables/alpinejs-hold-directive.blade.php @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Modifier + + Description + + Default +
+ x-hold.500ms + + Set the wait time to repeat the action + + {{-- --}} +
+ x-hold.repeat + + Set the wait time to repeat the action + + 500ms +
+ x-hold.repeat.500ms + + Set the wait time to repeat the action + + {{-- --}} +
+ x-hold.delay + + Set the wait time to start holding + + 500ms +
+ x-hold.delay.500ms + + Set the wait time to start holding + + {{-- --}} +
+ x-hold.click + + Fire the hold action with the click event + + false +
+
+
diff --git a/src/resources/views/components/tables/index.blade.php b/src/resources/views/components/tables/index.blade.php new file mode 100644 index 0000000..18da897 --- /dev/null +++ b/src/resources/views/components/tables/index.blade.php @@ -0,0 +1,9 @@ + + @foreach ($__laravel_slots as $key => $value) + @slot($key, $value) + @endforeach + diff --git a/src/resources/views/sections/component-api.blade.php b/src/resources/views/sections/component-api.blade.php index 9d8eacb..4985471 100644 --- a/src/resources/views/sections/component-api.blade.php +++ b/src/resources/views/sections/component-api.blade.php @@ -18,11 +18,7 @@ ?> - + @foreach ($items as $key => $item) @@ -42,4 +38,4 @@ @endif - + diff --git a/src/resources/views/sections/customize/contribution-guide.blade.php b/src/resources/views/sections/customize/contribution-guide.blade.php index 4356246..f5261c5 100644 --- a/src/resources/views/sections/customize/contribution-guide.blade.php +++ b/src/resources/views/sections/customize/contribution-guide.blade.php @@ -1,6 +1,16 @@
+ + + + + + + + + + You can contribute to the project by making a pull request on GitHub. This guide will help you get started with contributing to the project. I'm happy with your contribution. @@ -62,4 +72,10 @@ composer require wireui/wireui @endverbatim + + + + + For the other packages developed by the WireUi team, you can follow the same installation process. +
diff --git a/src/resources/views/sections/getting-started/installation.blade.php b/src/resources/views/sections/getting-started/installation.blade.php index f018e18..0d4fbb5 100644 --- a/src/resources/views/sections/getting-started/installation.blade.php +++ b/src/resources/views/sections/getting-started/installation.blade.php @@ -49,8 +49,7 @@ - + diff --git a/src/resources/views/sections/packages/alpinejs-hold-directive.blade.php b/src/resources/views/sections/packages/alpinejs-hold-directive.blade.php index 604d73b..d9e4a2e 100644 --- a/src/resources/views/sections/packages/alpinejs-hold-directive.blade.php +++ b/src/resources/views/sections/packages/alpinejs-hold-directive.blade.php @@ -5,8 +5,6 @@ - - @@ -17,75 +15,88 @@ - - - Requirements + The hold directive enables you to add a hold action to an element, triggering it when the button is held down. + + - + - Installation + First, you need to install the package via npm or yarn. @verbatim - Installation - @endverbatim - + yarn add @wireui/alpinejs-hold-directive - + or - - Publishing - - - - @verbatim - Publishing + npm i @wireui/alpinejs-hold-directive --save @endverbatim - Configure + Next, you need to register the directive with Alpine.js. @verbatim - Configure + // resources/js/app.js + import Alpine from 'alpinejs' + + + import HoldDirective from '@wireui/alpinejs-hold-directive' + + HoldDirective.register(Alpine) + + // or + + + import { directive } from '@wireui/alpinejs-hold-directive' + + Alpine.directive('hold', directive) + + window.Alpine = Alpine + + Alpine.start() @endverbatim - How to use it? + You can use the x-hold directive to call any alpine.js action. - + @verbatim - How to use it? +
+ + + + + +
@endverbatim -
+ - - Directive API + + All modifiers can be used together. Just set the modifier duration after the modifer name, + x-hold.delay.500ms. - - @verbatim - Directive API - @endverbatim - +
diff --git a/src/resources/views/sections/packages/breadcrumbs.blade.php b/src/resources/views/sections/packages/breadcrumbs.blade.php index 36ac7e3..91cc744 100644 --- a/src/resources/views/sections/packages/breadcrumbs.blade.php +++ b/src/resources/views/sections/packages/breadcrumbs.blade.php @@ -7,85 +7,207 @@ - + - - + + WireUI Breadcrumbs package streamlines the process of implementing breadcrumbs in your web application. Our + package offers an elegant and customizable breadcrumbs API that can be easily defined in your routes or full + page livewire components. +

+ Simplify your users' navigation experience with our intuitive interface and straightforward code. +
+ + + + + + + + + + + + + + + + + - Requirements + If do you want to use the default breadcrumbs component, you need to install these packages. - + + + + + - Installation + First, you'll need to install the package via composer: @verbatim - Installation + composer require wireui/breadcrumbs @endverbatim - Publishing + Run the following command to create the breadcrumbs route file. + + + + @verbatim + php artisan vendor:publish --tag="wireui.breadcrumbs.route" + @endverbatim + + + + You can also publish the configuration file and views. @verbatim - Publishing + php artisan vendor:publish --tag="wireui.breadcrumbs.config" + php artisan vendor:publish --tag="wireui.breadcrumbs.views" @endverbatim - + - Configure + Add the breadcrumbs path to the content of your Tailwind config file. - + @verbatim - Configure + /** @type {import('tailwindcss').Config} */ + module.exports = { + content: [ + './vendor/wireui/breadcrumbs/src/Components/**/*.php', + './vendor/wireui/breadcrumbs/src/views/**/*.blade.php', + ], + } @endverbatim + + + + You can create multiple breadcrumbs files to register your breadcrumbs. + + + + + + + + + + + + Then, register these files in the breadcrumbs config file. See the + publish section. + + + + @verbatim + Breadcrumbs::for('users.view') + ->push('Users', route('users')) + ->push('View'); + @endverbatim + + + + + + You can define your breadcrumbs in the full page + Livewire Components. + The breadcrumbs in the livewire components is reactive. + + + + @verbatim + namespace App\Http\Livewire; + + use Livewire\Component; + use WireUi\Breadcrumbs\Trail; + + class Index extends Component + { + /* + * Don't forget + * - This method must return a `Trail` instance + * - It must be a public method + * - You can use dependency injection + */ + public function breadcrumbs(Trail $trail): Trail + { + return $trail + ->push('Users', route('users')) + ->push('Create 1'); + } + } + @endverbatim + + + + - How to use it? + When registering a route breadcrumb, you can use dependency injection. It is useful when you need to get the + current model in the route breadcrumb, or any other dependency. - + @verbatim - How to use it? + // route: /users/{user} + Breadcrumbs::for('users.view') + ->push('Users', route('users')) + ->push('View') + ->callback(function (Trail $trail, User $user, Request $request): Trail { + return $trail->push($user->name); + }); + + // route: /posts/{id} + Breadcrumbs::for('posts.view') + ->push('Users', route('users')) + ->push('View') + ->callback(function (Trail $trail, int $id): Trail { + return $trail->push($id); + }); @endverbatim - + - Directive API + Just add the breadcrumbs component in your layout. - + @verbatim - Directive API + @endverbatim
From 84fea67db9c443943eaee3ae49388086c4e1c697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Tue, 21 May 2024 20:58:39 -0300 Subject: [PATCH 06/15] feat(packages): finish heroicons and phosphor icons pages --- .../sections/packages/breadcrumbs.blade.php | 8 +- .../sections/packages/heroicons.blade.php | 75 +++++++++++-------- .../packages/phosphor-icons.blade.php | 73 ++++++++++-------- 3 files changed, 87 insertions(+), 69 deletions(-) diff --git a/src/resources/views/sections/packages/breadcrumbs.blade.php b/src/resources/views/sections/packages/breadcrumbs.blade.php index 91cc744..7bd8675 100644 --- a/src/resources/views/sections/packages/breadcrumbs.blade.php +++ b/src/resources/views/sections/packages/breadcrumbs.blade.php @@ -47,20 +47,18 @@ - + - + - First, you'll need to install the package via composer: + First, you need to install the package via Composer. diff --git a/src/resources/views/sections/packages/heroicons.blade.php b/src/resources/views/sections/packages/heroicons.blade.php index f38a232..eeabe25 100644 --- a/src/resources/views/sections/packages/heroicons.blade.php +++ b/src/resources/views/sections/packages/heroicons.blade.php @@ -7,16 +7,24 @@ - - - - + + This package doesn't have any WireUI dependency. +

+ WireUI Heroicons is a library of icons components to empower your Laravel and Livewire application development. + Stop creating all icons components from scratch. Get all WireUI Heroicons for free. +

+ A set of free MIT-licensed high-quality SVG icons for UI development made by + TailwindLabs. + See all + Heroicons. +
+ @@ -25,67 +33,68 @@ - + + + + + - Installation + First, you need to install the package via Composer. @verbatim - Installation + composer require wireui/heroicons @endverbatim - Publishing + Publish the configuration and views. It's optional. @verbatim - Publishing - @endverbatim - - - - - - Configure - - - - @verbatim - Configure + php artisan vendor:publish --tag="wireui.heroicons.config" + php artisan vendor:publish --tag="wireui.heroicons.views" @endverbatim - How to use it? + You can find a list of all icons and variants on the + Heroicons + website. - - @verbatim - How to use it? - @endverbatim - + - + + - - Directive API - + + + + - + @verbatim - Directive API + + + + + + + + + @endverbatim diff --git a/src/resources/views/sections/packages/phosphor-icons.blade.php b/src/resources/views/sections/packages/phosphor-icons.blade.php index 495ed08..b5c55c3 100644 --- a/src/resources/views/sections/packages/phosphor-icons.blade.php +++ b/src/resources/views/sections/packages/phosphor-icons.blade.php @@ -7,16 +7,22 @@ - - - - + + This package doesn't have any WireUI dependency. +

+ WireUI Phosphor Icons is a library of icon components to empower your Laravel and Livewire application + development. Stop creating all icon components from scratch. Get all WireUI Phosphor Icons for free. +

+ Phosphor is a flexible icon family for interfaces, diagrams, presentations — whatever, really. — Development + made by Phosphor Icons. +
+ @@ -25,67 +31,72 @@ - + + + + + - Installation + First, you need to install the package via Composer. @verbatim - Installation + composer require wireui/phosphoricons @endverbatim - Publishing + Publish the configuration and views. It's optional. @verbatim - Publishing + php artisan vendor:publish --tag="wireui.phosphoricons.config" + php artisan vendor:publish --tag="wireui.phosphoricons.views" @endverbatim - + - Configure + You can find a list of all icons and variants on the + Phosphor Icons + website. - - @verbatim - Configure - @endverbatim - + - + + - - How to use it? - + - - @verbatim - How to use it? - @endverbatim - + - + - - Directive API - + - + + + + @verbatim - Directive API + + + + + + + @endverbatim From 43e33d1ad95723153a3c12db080284e87bd773f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Tue, 21 May 2024 21:36:54 -0300 Subject: [PATCH 07/15] wip --- src/Support/ComponentAPI.php | 120 ++++++++++++++++++ src/config.php | 48 +++++++ .../views/sections/components/alert.blade.php | 6 + .../sections/components/avatar.blade.php | 6 + .../views/sections/components/badge.blade.php | 6 + .../sections/components/button.blade.php | 6 + .../views/sections/components/card.blade.php | 6 + .../sections/components/checkbox.blade.php | 6 + .../components/color-picker.blade.php | 6 + .../sections/components/currency.blade.php | 6 + .../components/datetime-picker.blade.php | 6 + .../sections/components/dropdown.blade.php | 6 + .../sections/components/errors.blade.php | 6 + .../views/sections/components/icon.blade.php | 14 ++ .../views/sections/components/input.blade.php | 6 + .../views/sections/components/link.blade.php | 6 + .../sections/components/maskable.blade.php | 6 + .../views/sections/components/modal.blade.php | 6 + .../components/native-select.blade.php | 6 + .../sections/components/number.blade.php | 6 + .../sections/components/password.blade.php | 6 + .../views/sections/components/phone.blade.php | 6 + .../views/sections/components/radio.blade.php | 6 + .../sections/components/textarea.blade.php | 6 + .../sections/components/time-picker.blade.php | 6 + .../sections/components/toggle.blade.php | 6 + 26 files changed, 320 insertions(+) diff --git a/src/Support/ComponentAPI.php b/src/Support/ComponentAPI.php index 9105c59..c8f0fab 100644 --- a/src/Support/ComponentAPI.php +++ b/src/Support/ComponentAPI.php @@ -4,6 +4,111 @@ class ComponentAPI { + public static function alert(): array + { + return []; + } + + public static function avatar(): array + { + return []; + } + + public static function badge(): array + { + return []; + } + + public static function button(): array + { + return []; + } + + public static function card(): array + { + return []; + } + + public static function dropdown(): array + { + return []; + } + + public static function icon(): array + { + return []; + } + + public static function link(): array + { + return []; + } + + public static function modal(): array + { + return []; + } + + public static function checkbox(): array + { + return []; + } + + public static function colorPicker(): array + { + return []; + } + + public static function currency(): array + { + return []; + } + + public static function datetimePicker(): array + { + return []; + } + + public static function errors(): array + { + return []; + } + + public static function input(): array + { + return []; + } + + public static function maskable(): array + { + return []; + } + + public static function nativeSelect(): array + { + return []; + } + + public static function number(): array + { + return []; + } + + public static function password(): array + { + return []; + } + + public static function phone(): array + { + return []; + } + + public static function radio(): array + { + return []; + } + public static function select(): array { return [ @@ -128,4 +233,19 @@ public static function select(): array ], ]; } + + public static function textarea(): array + { + return []; + } + + public static function timePicker(): array + { + return []; + } + + public static function toggle(): array + { + return []; + } } diff --git a/src/config.php b/src/config.php index e38ab38..9b47942 100644 --- a/src/config.php +++ b/src/config.php @@ -103,7 +103,55 @@ */ 'components_api' => [ + 'alert' => ComponentAPI::alert(), + + 'avatar' => ComponentAPI::avatar(), + + 'badge' => ComponentAPI::badge(), + + 'button' => ComponentAPI::button(), + + 'card' => ComponentAPI::card(), + + 'dropdown' => ComponentAPI::dropdown(), + + 'icon' => ComponentAPI::icon(), + + 'link' => ComponentAPI::link(), + + 'modal' => ComponentAPI::modal(), + + 'checkbox' => ComponentAPI::checkbox(), + + 'color-picker' => ComponentAPI::colorPicker(), + + 'currency' => ComponentAPI::currency(), + + 'datetime-picker' => ComponentAPI::datetimePicker(), + + 'errors' => ComponentAPI::errors(), + + 'input' => ComponentAPI::input(), + + 'maskable' => ComponentAPI::maskable(), + + 'native-select' => ComponentAPI::nativeSelect(), + + 'number' => ComponentAPI::number(), + + 'password' => ComponentAPI::password(), + + 'phone' => ComponentAPI::phone(), + + 'radio' => ComponentAPI::radio(), + 'select' => ComponentAPI::select(), + + 'textarea' => ComponentAPI::textarea(), + + 'time-picker' => ComponentAPI::timePicker(), + + 'toggle' => ComponentAPI::toggle(), ], ]; diff --git a/src/resources/views/sections/components/alert.blade.php b/src/resources/views/sections/components/alert.blade.php index 1a045a4..0b16f64 100644 --- a/src/resources/views/sections/components/alert.blade.php +++ b/src/resources/views/sections/components/alert.blade.php @@ -14,6 +14,8 @@ + + @@ -277,4 +279,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('alert')]) diff --git a/src/resources/views/sections/components/avatar.blade.php b/src/resources/views/sections/components/avatar.blade.php index dfbb5f7..97a3fd6 100644 --- a/src/resources/views/sections/components/avatar.blade.php +++ b/src/resources/views/sections/components/avatar.blade.php @@ -16,6 +16,8 @@ + + @@ -271,4 +273,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('avatar')]) diff --git a/src/resources/views/sections/components/badge.blade.php b/src/resources/views/sections/components/badge.blade.php index e931b2a..6e8c716 100644 --- a/src/resources/views/sections/components/badge.blade.php +++ b/src/resources/views/sections/components/badge.blade.php @@ -16,6 +16,8 @@ + + @@ -317,4 +319,8 @@ class="absolute inline-flex w-full h-full rounded-full opacity-75 bg-cyan-500 an @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('badge')]) diff --git a/src/resources/views/sections/components/button.blade.php b/src/resources/views/sections/components/button.blade.php index eb96db9..a1fe527 100644 --- a/src/resources/views/sections/components/button.blade.php +++ b/src/resources/views/sections/components/button.blade.php @@ -26,6 +26,8 @@ + + @@ -458,4 +460,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('button')]) diff --git a/src/resources/views/sections/components/card.blade.php b/src/resources/views/sections/components/card.blade.php index 460d186..d7dfa54 100644 --- a/src/resources/views/sections/components/card.blade.php +++ b/src/resources/views/sections/components/card.blade.php @@ -10,6 +10,8 @@ + + @@ -270,4 +272,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('card')]) diff --git a/src/resources/views/sections/components/checkbox.blade.php b/src/resources/views/sections/components/checkbox.blade.php index 6095ce7..5b4eaaa 100644 --- a/src/resources/views/sections/components/checkbox.blade.php +++ b/src/resources/views/sections/components/checkbox.blade.php @@ -16,6 +16,8 @@ + + @@ -137,4 +139,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('checkbox')]) diff --git a/src/resources/views/sections/components/color-picker.blade.php b/src/resources/views/sections/components/color-picker.blade.php index 4bc284a..c7af5f0 100644 --- a/src/resources/views/sections/components/color-picker.blade.php +++ b/src/resources/views/sections/components/color-picker.blade.php @@ -12,6 +12,8 @@ + + @@ -203,4 +205,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('color-picker')]) diff --git a/src/resources/views/sections/components/currency.blade.php b/src/resources/views/sections/components/currency.blade.php index 71d1421..ecde21b 100644 --- a/src/resources/views/sections/components/currency.blade.php +++ b/src/resources/views/sections/components/currency.blade.php @@ -6,6 +6,8 @@ + + @@ -94,4 +96,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('currency')]) diff --git a/src/resources/views/sections/components/datetime-picker.blade.php b/src/resources/views/sections/components/datetime-picker.blade.php index 5f9a473..b504989 100644 --- a/src/resources/views/sections/components/datetime-picker.blade.php +++ b/src/resources/views/sections/components/datetime-picker.blade.php @@ -27,6 +27,8 @@ + + @@ -196,4 +198,8 @@ formats. + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('datetime-picker')]) diff --git a/src/resources/views/sections/components/dropdown.blade.php b/src/resources/views/sections/components/dropdown.blade.php index 32da664..ef02486 100644 --- a/src/resources/views/sections/components/dropdown.blade.php +++ b/src/resources/views/sections/components/dropdown.blade.php @@ -18,6 +18,8 @@ + + @@ -514,4 +516,8 @@ interfaces. @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('dropdown')]) diff --git a/src/resources/views/sections/components/errors.blade.php b/src/resources/views/sections/components/errors.blade.php index 6cf30e0..23b5bc3 100644 --- a/src/resources/views/sections/components/errors.blade.php +++ b/src/resources/views/sections/components/errors.blade.php @@ -23,6 +23,8 @@ + + @@ -126,4 +128,8 @@ functionality. In summary, the errors component is a flexible tool for managing @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('errors')]) diff --git a/src/resources/views/sections/components/icon.blade.php b/src/resources/views/sections/components/icon.blade.php index 8207a4f..bd60346 100644 --- a/src/resources/views/sections/components/icon.blade.php +++ b/src/resources/views/sections/components/icon.blade.php @@ -1,6 +1,16 @@
+ + + + + + + + + + All Heroicons @@ -29,4 +39,8 @@ php artisan vendor:publish --tag="wireui.config" @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('icon')])
diff --git a/src/resources/views/sections/components/input.blade.php b/src/resources/views/sections/components/input.blade.php index 91f3752..5826d5d 100644 --- a/src/resources/views/sections/components/input.blade.php +++ b/src/resources/views/sections/components/input.blade.php @@ -20,6 +20,8 @@ + + @@ -224,4 +226,8 @@ class="h-full" @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('input')]) diff --git a/src/resources/views/sections/components/link.blade.php b/src/resources/views/sections/components/link.blade.php index 22c0f68..62736ed 100644 --- a/src/resources/views/sections/components/link.blade.php +++ b/src/resources/views/sections/components/link.blade.php @@ -6,6 +6,8 @@ + + @@ -78,4 +80,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('link')]) diff --git a/src/resources/views/sections/components/maskable.blade.php b/src/resources/views/sections/components/maskable.blade.php index c5cebe2..9789532 100644 --- a/src/resources/views/sections/components/maskable.blade.php +++ b/src/resources/views/sections/components/maskable.blade.php @@ -10,6 +10,8 @@ + + @@ -162,4 +164,8 @@ protected function getInputMask(): array } @endverbatim
+ + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('maskable')]) diff --git a/src/resources/views/sections/components/modal.blade.php b/src/resources/views/sections/components/modal.blade.php index 3b119f7..7e966c8 100644 --- a/src/resources/views/sections/components/modal.blade.php +++ b/src/resources/views/sections/components/modal.blade.php @@ -33,6 +33,8 @@ + + @@ -266,4 +268,8 @@ class="flex items-center justify-center col-span-1 bg-gray-100 shadow-md cursor- @endverbatim
+ + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('modal')]) diff --git a/src/resources/views/sections/components/native-select.blade.php b/src/resources/views/sections/components/native-select.blade.php index 2d95c25..3e2d6e7 100644 --- a/src/resources/views/sections/components/native-select.blade.php +++ b/src/resources/views/sections/components/native-select.blade.php @@ -8,6 +8,8 @@ + + @@ -99,4 +101,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('native-select')]) diff --git a/src/resources/views/sections/components/number.blade.php b/src/resources/views/sections/components/number.blade.php index 567a647..39f6f09 100644 --- a/src/resources/views/sections/components/number.blade.php +++ b/src/resources/views/sections/components/number.blade.php @@ -4,6 +4,8 @@ + + @@ -50,4 +52,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('number')]) diff --git a/src/resources/views/sections/components/password.blade.php b/src/resources/views/sections/components/password.blade.php index 95a51eb..5de5726 100644 --- a/src/resources/views/sections/components/password.blade.php +++ b/src/resources/views/sections/components/password.blade.php @@ -2,6 +2,8 @@ + + @@ -27,4 +29,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('password')]) diff --git a/src/resources/views/sections/components/phone.blade.php b/src/resources/views/sections/components/phone.blade.php index 3eaf8e9..e151e88 100644 --- a/src/resources/views/sections/components/phone.blade.php +++ b/src/resources/views/sections/components/phone.blade.php @@ -6,6 +6,8 @@ + + @@ -77,4 +79,8 @@ protected function getInputMask(): array } @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('phone')]) diff --git a/src/resources/views/sections/components/radio.blade.php b/src/resources/views/sections/components/radio.blade.php index d4b4ee0..93d69b1 100644 --- a/src/resources/views/sections/components/radio.blade.php +++ b/src/resources/views/sections/components/radio.blade.php @@ -16,6 +16,8 @@ + + @@ -136,4 +138,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('radio')]) diff --git a/src/resources/views/sections/components/textarea.blade.php b/src/resources/views/sections/components/textarea.blade.php index e573f84..41f3a91 100644 --- a/src/resources/views/sections/components/textarea.blade.php +++ b/src/resources/views/sections/components/textarea.blade.php @@ -2,6 +2,8 @@ + + @@ -35,4 +37,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('textarea')]) diff --git a/src/resources/views/sections/components/time-picker.blade.php b/src/resources/views/sections/components/time-picker.blade.php index 31a6a1e..5b692c6 100644 --- a/src/resources/views/sections/components/time-picker.blade.php +++ b/src/resources/views/sections/components/time-picker.blade.php @@ -18,6 +18,8 @@ + + @@ -100,4 +102,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('time-picker')]) diff --git a/src/resources/views/sections/components/toggle.blade.php b/src/resources/views/sections/components/toggle.blade.php index 4576ed4..bb04f79 100644 --- a/src/resources/views/sections/components/toggle.blade.php +++ b/src/resources/views/sections/components/toggle.blade.php @@ -8,6 +8,8 @@ + + @@ -127,4 +129,8 @@ @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('toggle')]) From f4b9a94c3efc24a488307c565196e07fa213bc56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Tue, 21 May 2024 22:35:10 -0300 Subject: [PATCH 08/15] docs(github): adding code of conduct and security docs --- .github/CODE_OF_CONDUCT.yml | 81 +++++++++++++++++++ .github/SECURITY.yml | 5 ++ .github/workflows/tests.yml | 36 +++++++++ LICENSE => LICENSE.md | 2 +- src/Commands/ClearCacheCommand.php | 11 ++- tests/TestCase.php | 12 ++- tests/Unit/Commands/ClearCacheCommandTest.php | 25 +++++- .../WireUiDocsTest.php} | 0 tests/Unit/Middleware/CheckDocsTest.php | 28 ++++++- 9 files changed, 190 insertions(+), 10 deletions(-) create mode 100644 .github/CODE_OF_CONDUCT.yml create mode 100644 .github/SECURITY.yml create mode 100644 .github/workflows/tests.yml rename LICENSE => LICENSE.md (97%) rename tests/Unit/{Support/WireUiDocsSupportTest.php => Facades/WireUiDocsTest.php} (100%) diff --git a/.github/CODE_OF_CONDUCT.yml b/.github/CODE_OF_CONDUCT.yml new file mode 100644 index 0000000..697aef6 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.yml @@ -0,0 +1,81 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall community +- All PR of new components should be own created or from a free source + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting +- Creating components using paid source code like Tailwind UI + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at GitHub. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of actions. + +**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. diff --git a/.github/SECURITY.yml b/.github/SECURITY.yml new file mode 100644 index 0000000..968b0c0 --- /dev/null +++ b/.github/SECURITY.yml @@ -0,0 +1,5 @@ +# Security Policy +**PLEASE DON'T DISCLOSE SECURITY RELATED ISSUES PUBLICLY!** + +## Reporting a Vulnerability +If you discover a security vulnerability within WireUi, please send an email to our team at **security@wireui.dev**. All security vulnerabilities will be promptly addressed. diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..2e37934 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,36 @@ +name: WireUi Docs Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: "8.3" + tools: composer:v2 + coverage: none + + - name: Install Composer Dependencies + run: | + composer install --no-scripts + + - name: Code Style Check + run: | + ./vendor/bin/pint --test + + - name: Run Pest PHP Tests + run: | + ./vendor/bin/pest --stop-on-failure diff --git a/LICENSE b/LICENSE.md similarity index 97% rename from LICENSE rename to LICENSE.md index 3328cc1..e29b49a 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 WireUi +Copyright (c) WireUi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Commands/ClearCacheCommand.php b/src/Commands/ClearCacheCommand.php index 762d6d0..0519f32 100644 --- a/src/Commands/ClearCacheCommand.php +++ b/src/Commands/ClearCacheCommand.php @@ -4,6 +4,7 @@ use Illuminate\Console\Command; use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Str; use WireUi\Docs\Facades\WireUiDocs; class ClearCacheCommand extends Command @@ -12,15 +13,17 @@ class ClearCacheCommand extends Command protected $description = 'Clear the Menu Cache'; - public function handle(): void + public function handle(): int { $this->clearMenuCache(); - $sections = WireUiDocs::getSections(); + $menu = WireUiDocs::getMenu()->flatten(); - $sections->each(fn ($section) => $this->removeCache($section)); + $menu->each(fn ($page) => $this->removeCache($page)); $this->info('The cache has been cleared.'); + + return self::SUCCESS; } private function clearMenuCache(): void @@ -30,6 +33,8 @@ private function clearMenuCache(): void private function removeCache(string $page): void { + $page = Str::slug($page); + Cache::forget("wireui::next::{$page}"); Cache::forget("wireui::previous::{$page}"); diff --git a/tests/TestCase.php b/tests/TestCase.php index c9f3145..a71239f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,11 +3,11 @@ namespace WireUi\Docs\Tests; use Livewire\LivewireServiceProvider; -use Orchestra\Testbench\TestCase as TestbenchTestCase; +use Orchestra\Testbench\TestCase as OrchestraTestCase; use ReflectionClass; use WireUi\Docs\ServiceProvider; -class TestCase extends TestbenchTestCase +class TestCase extends OrchestraTestCase { /** * Load package service provider. @@ -20,6 +20,14 @@ protected function getPackageProviders($app) ]; } + /** + * Define routes setup. + */ + protected function defineRoutes($router) + { + $router->get('/{section}/{page}', fn () => 'Page exists')->middleware('check.docs'); + } + /** * Call protected/private method of a class. */ diff --git a/tests/Unit/Commands/ClearCacheCommandTest.php b/tests/Unit/Commands/ClearCacheCommandTest.php index 61cd84c..1d6954b 100644 --- a/tests/Unit/Commands/ClearCacheCommandTest.php +++ b/tests/Unit/Commands/ClearCacheCommandTest.php @@ -1,5 +1,26 @@ toBeTrue(); +use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Str; +use WireUi\Docs\Facades\WireUiDocs; + +test('it should clear the cache', function () { + Cache::spy(); + + Cache::shouldReceive('sear') + ->with('wireui::menu', Closure::class) + ->andReturn(collect(config('docs.menu'))); + + $this->artisan('wire-docs:clear-cache') + ->expectsOutput('The cache has been cleared.') + ->assertSuccessful(); + + Cache::shouldHaveReceived('forget')->with('wireui::menu'); + + WireUiDocs::getMenu()->flatten()->each(function ($page) { + $page = Str::slug($page); + + Cache::shouldHaveReceived('forget')->with("wireui::next::{$page}"); + Cache::shouldHaveReceived('forget')->with("wireui::previous::{$page}"); + }); }); diff --git a/tests/Unit/Support/WireUiDocsSupportTest.php b/tests/Unit/Facades/WireUiDocsTest.php similarity index 100% rename from tests/Unit/Support/WireUiDocsSupportTest.php rename to tests/Unit/Facades/WireUiDocsTest.php diff --git a/tests/Unit/Middleware/CheckDocsTest.php b/tests/Unit/Middleware/CheckDocsTest.php index 61cd84c..78eef99 100644 --- a/tests/Unit/Middleware/CheckDocsTest.php +++ b/tests/Unit/Middleware/CheckDocsTest.php @@ -1,5 +1,29 @@ toBeTrue(); +use Illuminate\Support\Str; +use WireUi\Docs\Facades\WireUiDocs; + +test('it should check if all pages exist', function () { + $menu = WireUiDocs::getMenu(); + + $menu->each(function ($pages, $section) { + $section = Str::slug($section); + + $pages = collect($pages)->flatten(); + + $pages->each(function ($page) use ($section) { + $page = Str::slug($page); + + $this->get("/{$section}/{$page}")->assertOk(); + }); + }); +}); + +test('it should check if all pages do not exist', function () { + collect()->range(1, 10)->each(function () { + $page = fake()->slug(); + $section = fake()->slug(); + + $this->get("/{$section}/{$page}")->assertNotFound(); + }); }); From 9cf7b699c1dbc5563e366660c0887850e992cab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Tue, 21 May 2024 22:38:41 -0300 Subject: [PATCH 09/15] wip --- .github/CODE_OF_CONDUCT.yml | 81 ----------------- .github/SECURITY.yml | 5 -- .github/code-of-conduct.md | 130 +++++++++++++++++++++++++++ .github/{FUNDING.yml => funding.yml} | 0 .github/security.md | 9 ++ LICENSE.md => license.md | 0 README.md => readme.md | 0 7 files changed, 139 insertions(+), 86 deletions(-) delete mode 100644 .github/CODE_OF_CONDUCT.yml delete mode 100644 .github/SECURITY.yml create mode 100644 .github/code-of-conduct.md rename .github/{FUNDING.yml => funding.yml} (100%) create mode 100644 .github/security.md rename LICENSE.md => license.md (100%) rename README.md => readme.md (100%) diff --git a/.github/CODE_OF_CONDUCT.yml b/.github/CODE_OF_CONDUCT.yml deleted file mode 100644 index 697aef6..0000000 --- a/.github/CODE_OF_CONDUCT.yml +++ /dev/null @@ -1,81 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our community include: - -- Demonstrating empathy and kindness toward other people -- Being respectful of differing opinions, viewpoints, and experiences -- Giving and gracefully accepting constructive feedback -- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -- Focusing on what is best not just for us as individuals, but for the overall community -- All PR of new components should be own created or from a free source - -Examples of unacceptable behavior include: - -- The use of sexualized language or imagery, and sexual attention or advances of any kind -- Trolling, insulting or derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or email address, without their explicit permission -- Other conduct which could reasonably be considered inappropriate in a professional setting -- Creating components using paid source code like Tailwind UI - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at GitHub. All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series of actions. - -**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within the community. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. - -Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. diff --git a/.github/SECURITY.yml b/.github/SECURITY.yml deleted file mode 100644 index 968b0c0..0000000 --- a/.github/SECURITY.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Security Policy -**PLEASE DON'T DISCLOSE SECURITY RELATED ISSUES PUBLICLY!** - -## Reporting a Vulnerability -If you discover a security vulnerability within WireUi, please send an email to our team at **security@wireui.dev**. All security vulnerabilities will be promptly addressed. diff --git a/.github/code-of-conduct.md b/.github/code-of-conduct.md new file mode 100644 index 0000000..62ad600 --- /dev/null +++ b/.github/code-of-conduct.md @@ -0,0 +1,130 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community +- All PR of new components should be own created or from a free source + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting +- Creating components using paid source code like Tailwind UI + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +GitHub. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/.github/FUNDING.yml b/.github/funding.yml similarity index 100% rename from .github/FUNDING.yml rename to .github/funding.yml diff --git a/.github/security.md b/.github/security.md new file mode 100644 index 0000000..a3c0630 --- /dev/null +++ b/.github/security.md @@ -0,0 +1,9 @@ +# Security Policy + +**PLEASE DON'T DISCLOSE SECURITY RELATED ISSUES PUBLICLY!** + +## Reporting a Vulnerability + +If you discover a security vulnerability within WireUi, +please send an email to our team at **security@wireui.dev**. +All security vulnerabilities will be promptly addressed. diff --git a/LICENSE.md b/license.md similarity index 100% rename from LICENSE.md rename to license.md diff --git a/README.md b/readme.md similarity index 100% rename from README.md rename to readme.md From a7e03585f990007463dcc0098634bbf64789367e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Tue, 21 May 2024 22:55:06 -0300 Subject: [PATCH 10/15] wip --- tests/Unit/Facades/WireUiDocsTest.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/Unit/Facades/WireUiDocsTest.php b/tests/Unit/Facades/WireUiDocsTest.php index 61cd84c..e3193bf 100644 --- a/tests/Unit/Facades/WireUiDocsTest.php +++ b/tests/Unit/Facades/WireUiDocsTest.php @@ -1,5 +1,21 @@ toBeTrue(); +}); + +test('it should check default pages', function () { + expect(true)->toBeTrue(); +}); + +test('it should check components api', function () { + expect(true)->toBeTrue(); +}); + +test('it should check pages', function () { + expect(true)->toBeTrue(); +}); + +test('it should check links', function () { expect(true)->toBeTrue(); }); From f89a7845980f3da0ba97392b67a2e42b860f5c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Wed, 22 May 2024 08:54:08 -0300 Subject: [PATCH 11/15] feat(tables): adding new tables --- src/Support/ComponentAPI.php | 264 +++++++++++++++++- src/Support/WireUiDocsSupport.php | 12 +- .../views/sections/components/badge.blade.php | 10 +- .../sections/components/button.blade.php | 12 +- 4 files changed, 277 insertions(+), 21 deletions(-) diff --git a/src/Support/ComponentAPI.php b/src/Support/ComponentAPI.php index c8f0fab..8f2ae9e 100644 --- a/src/Support/ComponentAPI.php +++ b/src/Support/ComponentAPI.php @@ -6,22 +6,278 @@ class ComponentAPI { public static function alert(): array { - return []; + return [ + 'props' => [ + 'icon' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'title' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'shadow' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'padding' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'rounded' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'variant' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'iconless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'shadowless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'header' => [ + 'description' => 'Slot to add content to the header.', + ], + 'title' => [ + 'description' => 'Slot to add content to the title.', + ], + 'action' => [ + 'description' => 'Slot to add content to the actions.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + 'footer' => [ + 'description' => 'Slot to add content to the footer.', + ], + ], + ]; } public static function avatar(): array { - return []; + return [ + 'props' => [ + 'alt' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'src' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'icon' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'border' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'rounded' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'icon-size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'borderless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + ], + ]; } public static function badge(): array { - return []; + return [ + 'props' => [ + 'size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'full' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'icon' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'rounded' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'variant' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'icon-size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'right-icon' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + ], + 'slots' => [ + 'prepend' => [ + 'description' => 'Slot to add content before the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the label.', + ], + 'append' => [ + 'description' => 'Slot to add content after the label.', + ], + ], + ]; } public static function button(): array { - return []; + return [ + 'props' => [ + 'full' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'href' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'icon' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'rounded' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'variant' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'icon-size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'right-icon' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'wire-load-enabled' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'use-validation-colors' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'prepend' => [ + 'description' => 'Slot to add content before the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the label.', + ], + 'append' => [ + 'description' => 'Slot to add content after the label.', + ], + ], + ]; } public static function card(): array diff --git a/src/Support/WireUiDocsSupport.php b/src/Support/WireUiDocsSupport.php index 0c6a1a9..d19a79b 100644 --- a/src/Support/WireUiDocsSupport.php +++ b/src/Support/WireUiDocsSupport.php @@ -17,12 +17,9 @@ public function getMenu(): Collection public function hasSection(string $section): bool { - return $this->getSections()->contains($section); - } - - public function getSections(): Collection - { - return $this->getMenu()->keys()->transform(fn ($item) => Str::slug($item)); + return $this->getMenu()->keys()->transform(function ($item) { + return Str::slug($item); + })->contains($section); } public function getSection(string $section): ?array @@ -67,6 +64,9 @@ public function getNextLink(string $page): array }); } + /** + * Generic method to get the previous or next link. + */ private function getPositionMenu(string $page, callable $callback): array { $titles = $this->getMenu()->mapWithKeys(function ($section, $key) { diff --git a/src/resources/views/sections/components/badge.blade.php b/src/resources/views/sections/components/badge.blade.php index 6e8c716..d11c326 100644 --- a/src/resources/views/sections/components/badge.blade.php +++ b/src/resources/views/sections/components/badge.blade.php @@ -218,15 +218,11 @@ particularly with regards to rounding. In version 1, the only available option was the badge.circle. - - The attributes [full, right-icon, prepend, append] are not supported in mini-badge component. - - @verbatim - + @@ -322,5 +318,9 @@ class="absolute inline-flex w-full h-full rounded-full opacity-75 bg-cyan-500 an + + The props [full, right-icon] and slots [prepend, append] are not supported in mini-badge component. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('badge')]) diff --git a/src/resources/views/sections/components/button.blade.php b/src/resources/views/sections/components/button.blade.php index a1fe527..a156ce0 100644 --- a/src/resources/views/sections/components/button.blade.php +++ b/src/resources/views/sections/components/button.blade.php @@ -336,16 +336,12 @@ button.circle. - - The attributes [full, right-icon, prepend, append] are not supported in mini-button component. - - @verbatim - - + + @@ -463,5 +459,9 @@ + + The props [full, right-icon] and slot [prepend, append] are not supported in mini-button component. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('button')]) From ca4b01a0cdb00ee86ef09b07247ba8a844c1e24a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Wed, 22 May 2024 18:49:25 -0300 Subject: [PATCH 12/15] refactor(facades): adding tests to WireUiDocs Facade and refactored class --- src/Facades/WireUiDocs.php | 1 - src/ServiceProvider.php | 12 +++ src/Support/WireUiDocsSupport.php | 50 +++++---- tests/Unit/Facades/WireUiDocsTest.php | 147 +++++++++++++++++++++++++- 4 files changed, 182 insertions(+), 28 deletions(-) diff --git a/src/Facades/WireUiDocs.php b/src/Facades/WireUiDocs.php index e2b286d..f520af6 100644 --- a/src/Facades/WireUiDocs.php +++ b/src/Facades/WireUiDocs.php @@ -9,7 +9,6 @@ /** * @method static Collection getMenu() * @method static bool hasSection(string $section) - * @method static Collection getSections() * @method static ?array getSection(string $section) * @method static ?string getDefaultPage(string $section) * @method static mixed getComponentApi(string $component) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 4dfac6a..f1760e1 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -4,6 +4,8 @@ use Illuminate\Routing\Router; use Illuminate\Support; +use Illuminate\Support\Collection; +use Illuminate\Support\Str; use WireUi\Docs\Middleware\CheckDocs; use WireUi\Docs\View\Components\Code; @@ -15,6 +17,8 @@ public function boot(): void $this->bootConfig(); + $this->bootMacros(); + $this->bootCommands(); $this->bootMiddlewares(); @@ -32,6 +36,14 @@ private function bootViews(): void $this->loadViewsFrom(__DIR__.'/resources/views', 'docs'); } + private function bootMacros(): void + { + Collection::macro('slugify', function () { + /** @var Collection $this */ + return $this->map(fn ($value) => Str::slug($value)); + }); + } + private function bootCommands(): void { if ($this->app->runningInConsole()) { diff --git a/src/Support/WireUiDocsSupport.php b/src/Support/WireUiDocsSupport.php index d19a79b..aa26553 100644 --- a/src/Support/WireUiDocsSupport.php +++ b/src/Support/WireUiDocsSupport.php @@ -17,26 +17,22 @@ public function getMenu(): Collection public function hasSection(string $section): bool { - return $this->getMenu()->keys()->transform(function ($item) { - return Str::slug($item); - })->contains($section); + return $this->getMenu()->keys()->slugify()->contains($section); } - public function getSection(string $section): ?array + public function getSection(string $section): Collection { - return $this->getMenu()->mapWithKeys(function ($section, $key) { - return [Str::slug($key) => $section]; - })->get($section); + return collect($this->getMenu()->first(fn ($item, $key) => Str::slug($key) === $section)); } - public function getDefaultPage(string $slug): ?string + public function getDefaultPage(string $section): ?string { $options = config('docs.default_pages'); - return data_get($options, $slug); + return data_get($options, $section); } - public function getComponentApi(string $component): mixed + public function getComponentApi(string $component): ?array { $apis = config('docs.components_api'); @@ -45,19 +41,19 @@ public function getComponentApi(string $component): mixed public function hasPage(string $page, string $section): bool { - $pages = collect($this->getSection($section))->collapse(); + $pages = $this->getSection($section)->flatten(); - return $pages->transform(fn ($item) => Str::slug($item))->contains($page); + return $pages->slugify()->contains($page); } - public function getPreviousLink(string $page): array + public function getPreviousLink(string $page): ?array { return Cache::sear("wireui::previous::{$page}", function () use ($page) { return $this->getPositionMenu($page, fn ($position) => $position - 1); }); } - public function getNextLink(string $page): array + public function getNextLink(string $page): ?array { return Cache::sear("wireui::next::{$page}", function () use ($page) { return $this->getPositionMenu($page, fn ($position) => $position + 1); @@ -67,20 +63,30 @@ public function getNextLink(string $page): array /** * Generic method to get the previous or next link. */ - private function getPositionMenu(string $page, callable $callback): array + private function getSectionByPage(string $page): ?string { - $titles = $this->getMenu()->mapWithKeys(function ($section, $key) { - return [Str::slug($key) => collect($section)->collapse()->toArray()]; + return $this->getMenu()->search(function ($item) use ($page) { + return collect($item)->flatten()->slugify()->contains($page); }); + } - $titles1 = $titles->collapse()->reject(fn ($item) => in_array($item, $this->reject))->values(); + private function getPositionMenu(string $page, callable $callback): ?array + { + if (collect($this->reject)->slugify()->contains($page)) { + return null; + } - $titles2 = $titles1->map(fn ($item) => Str::slug($item)); + $pages = $this->getMenu()->flatten()->reject(function ($item) { + return in_array($item, $this->reject); + })->values(); - $title = $titles1->get($callback($titles2->search($page))); + $title = $pages->get($callback($pages->slugify()->search($page))); - $section = $titles->search(fn ($item) => in_array($title, $item)); + $section = $this->getSectionByPage(Str::slug($title)); - return ['title' => $title, 'href' => "/{$section}/".Str::slug($title)]; + return blank($title) ? null : [ + 'title' => $title, + 'href' => sprintf('/%s/%s', Str::slug($section), Str::slug($title)), + ]; } } diff --git a/tests/Unit/Facades/WireUiDocsTest.php b/tests/Unit/Facades/WireUiDocsTest.php index e3193bf..59627dc 100644 --- a/tests/Unit/Facades/WireUiDocsTest.php +++ b/tests/Unit/Facades/WireUiDocsTest.php @@ -1,21 +1,158 @@ toBeTrue(); + expect(WireUiDocs::hasSection('actions'))->toBeTrue(); + expect(WireUiDocs::hasSection('packages'))->toBeTrue(); + expect(WireUiDocs::hasSection('customize'))->toBeTrue(); + expect(WireUiDocs::hasSection('components'))->toBeTrue(); + expect(WireUiDocs::hasSection('getting-started'))->toBeTrue(); + + collect()->range(1, 5)->each(function () { + $section = fake()->word(); + + expect(WireUiDocs::hasSection($section))->toBeFalse(); + }); }); test('it should check default pages', function () { - expect(true)->toBeTrue(); + expect(WireUiDocs::getDefaultPage('actions'))->toBe('hooks'); + expect(WireUiDocs::getDefaultPage('customize'))->toBe('colors'); + expect(WireUiDocs::getDefaultPage('components'))->toBe('alert'); + expect(WireUiDocs::getDefaultPage('getting-started'))->toBe('installation'); + expect(WireUiDocs::getDefaultPage('packages'))->toBe('alpinejs-hold-directive'); }); test('it should check components api', function () { - expect(true)->toBeTrue(); + $apis = collect(config('docs.components_api'))->keys(); + + $apis->each(fn ($api) => expect(WireUiDocs::getComponentApi($api))->not->toBeNull()); }); test('it should check pages', function () { - expect(true)->toBeTrue(); + $menu = collect(config('docs.menu')); + + $menu->each(function ($pages, $section) { + $section = Str::slug($section); + + $pages = collect($pages)->flatten()->slugify(); + + $pages->each(fn ($page) => expect(WireUiDocs::hasPage($page, $section))->toBeTrue()); + }); + + collect()->range(1, 10)->each(function () { + $page = fake()->slug(); + $section = fake()->slug(); + + expect(WireUiDocs::hasPage($page, $section))->toBeFalse(); + }); }); test('it should check links', function () { - expect(true)->toBeTrue(); + expect(WireUiDocs::getPreviousLink('installation'))->toBeNull(); + expect(WireUiDocs::getNextLink('installation'))->toBe([ + 'title' => 'CSS Utilities', + 'href' => '/getting-started/css-utilities', + ]); + + expect(WireUiDocs::getPreviousLink('troubleshooting'))->toBe([ + 'title' => 'CSS Utilities', + 'href' => '/getting-started/css-utilities', + ]); + expect(WireUiDocs::getNextLink('troubleshooting'))->toBe([ + 'title' => 'Alert', + 'href' => '/components/alert', + ]); + + expect(WireUiDocs::getPreviousLink('alert'))->toBe([ + 'title' => 'Troubleshooting', + 'href' => '/getting-started/troubleshooting', + ]); + expect(WireUiDocs::getNextLink('alert'))->toBe([ + 'title' => 'Avatar', + 'href' => '/components/avatar', + ]); + + expect(WireUiDocs::getPreviousLink('modal'))->toBe([ + 'title' => 'Link', + 'href' => '/components/link', + ]); + expect(WireUiDocs::getNextLink('modal'))->toBe([ + 'title' => 'Checkbox', + 'href' => '/components/checkbox', + ]); + + expect(WireUiDocs::getPreviousLink('table'))->toBeNull(); + expect(WireUiDocs::getNextLink('table'))->toBeNull(); + + expect(WireUiDocs::getPreviousLink('checkbox'))->toBe([ + 'title' => 'Modal', + 'href' => '/components/modal', + ]); + expect(WireUiDocs::getNextLink('checkbox'))->toBe([ + 'title' => 'Color Picker', + 'href' => '/components/color-picker', + ]); + + expect(WireUiDocs::getPreviousLink('toggle'))->toBe([ + 'title' => 'Time Picker', + 'href' => '/components/time-picker', + ]); + expect(WireUiDocs::getNextLink('toggle'))->toBe([ + 'title' => 'Hooks', + 'href' => '/actions/hooks', + ]); + + expect(WireUiDocs::getPreviousLink('hooks'))->toBe([ + 'title' => 'Toggle', + 'href' => '/components/toggle', + ]); + expect(WireUiDocs::getNextLink('hooks'))->toBe([ + 'title' => 'Dialogs', + 'href' => '/actions/dialogs', + ]); + + expect(WireUiDocs::getPreviousLink('notifications'))->toBe([ + 'title' => 'Dialogs', + 'href' => '/actions/dialogs', + ]); + expect(WireUiDocs::getNextLink('notifications'))->toBe([ + 'title' => 'Colors', + 'href' => '/customize/colors', + ]); + + expect(WireUiDocs::getPreviousLink('colors'))->toBe([ + 'title' => 'Notifications', + 'href' => '/actions/notifications', + ]); + expect(WireUiDocs::getNextLink('colors'))->toBe([ + 'title' => 'Components', + 'href' => '/customize/components', + ]); + + expect(WireUiDocs::getPreviousLink('contribution-guide'))->toBe([ + 'title' => 'Components', + 'href' => '/customize/components', + ]); + expect(WireUiDocs::getNextLink('contribution-guide'))->toBe([ + 'title' => 'AlpineJS Hold Directive', + 'href' => '/packages/alpinejs-hold-directive', + ]); + + expect(WireUiDocs::getPreviousLink('alpinejs-hold-directive'))->toBe([ + 'title' => 'Contribution Guide', + 'href' => '/customize/contribution-guide', + ]); + expect(WireUiDocs::getNextLink('alpinejs-hold-directive'))->toBe([ + 'title' => 'Breadcrumbs', + 'href' => '/packages/breadcrumbs', + ]); + + expect(WireUiDocs::getPreviousLink('phosphor-icons'))->toBe([ + 'title' => 'Heroicons', + 'href' => '/packages/heroicons', + ]); + expect(WireUiDocs::getNextLink('phosphor-icons'))->toBeNull(); }); From 56bf6f588ac2a9397ca2a4733ab9ec2e81d5a231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Wed, 22 May 2024 21:46:57 -0300 Subject: [PATCH 13/15] feat(tables): adding new api tables --- src/Support/ComponentAPI.php | 1000 ++++++++++++++++- src/config.php | 32 +- .../sections/components/button.blade.php | 2 +- .../components/color-picker.blade.php | 6 + .../sections/components/currency.blade.php | 5 + .../components/datetime-picker.blade.php | 5 + .../sections/components/dropdown.blade.php | 12 + .../sections/components/errors.blade.php | 5 + .../sections/components/maskable.blade.php | 5 + .../views/sections/components/modal.blade.php | 6 + .../sections/components/number.blade.php | 5 + .../sections/components/password.blade.php | 6 +- .../views/sections/components/phone.blade.php | 5 + .../sections/components/select.blade.php | 12 + .../sections/components/textarea.blade.php | 5 + .../sections/components/time-picker.blade.php | 5 + 16 files changed, 1080 insertions(+), 36 deletions(-) diff --git a/src/Support/ComponentAPI.php b/src/Support/ComponentAPI.php index 8f2ae9e..9a7671c 100644 --- a/src/Support/ComponentAPI.php +++ b/src/Support/ComponentAPI.php @@ -282,87 +282,850 @@ public static function button(): array public static function card(): array { - return []; + return [ + 'props' => [ + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'title' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'shadow' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'padding' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'rounded' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'shadowless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'header' => [ + 'description' => 'Slot to add content to the header.', + ], + 'title' => [ + 'description' => 'Slot to add content to the title.', + ], + 'action' => [ + 'description' => 'Slot to add content to the actions.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + 'footer' => [ + 'description' => 'Slot to add content to the footer.', + ], + ], + ]; } public static function dropdown(): array { - return []; + return [ + 'props' => [ + 'icon' => [ + 'type' => 'string', + 'default' => 'ellipsis-vertical', + 'required' => 'false', + ], + 'width' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'height' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'position' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'persistent' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'trigger' => [ + 'description' => 'Slot to add content to the trigger.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + ], + ]; + } + + public static function dropdownItem(): array + { + return [ + 'props' => [ + 'icon' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'separator' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + ], + ]; + } + + public static function dropdownHeader(): array + { + return [ + 'props' => [ + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'separator' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + ], + ]; } public static function icon(): array { - return []; + return [ + 'props' => [ + 'name' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'true', + ], + 'variant' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + ], + ]; } public static function link(): array { - return []; + return [ + 'props' => [ + 'href' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'underline' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + ], + ]; } public static function modal(): array { - return []; + return [ + 'props' => [ + 'blur' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'name' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'show' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'type' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'align' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'width' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'spacing' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'z-index' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'blurless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'persistent' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + ], + 'events' => [ + 'open' => [ + 'description' => 'Event emitted when the modal is opened.', + ], + 'close' => [ + 'description' => 'Event emitted when the modal is closed.', + ], + ], + ]; + } + + public static function modalCard(): array + { + return [ + 'props' => [ + 'hide-close' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + ]; } public static function checkbox(): array { - return []; + return [ + 'props' => [ + 'id' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'rounded' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'disabled' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'readonly' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'errorless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'description' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'invalidated' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'right-label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'with-validation-colors' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + 'right-label' => [ + 'description' => 'Slot to add content to the right label.', + ], + 'description' => [ + 'description' => 'Slot to add content to the description.', + ], + ], + ]; } public static function colorPicker(): array { - return []; + return [ + 'props' => [ + 'colors' => [ + 'type' => 'array', + 'default' => '[]', + 'required' => 'false', + ], + 'right-icon' => [ + 'type' => 'string', + 'default' => 'swatch', + 'required' => 'false', + ], + 'color-name-as-value' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + ]; } public static function currency(): array { - return []; + return [ + 'props' => [ + 'decimal' => [ + 'type' => 'string', + 'default' => '.', + 'required' => 'false', + ], + 'precision' => [ + 'type' => 'number', + 'default' => '2', + 'required' => 'false', + ], + 'thousands' => [ + 'type' => 'string', + 'default' => ',', + 'required' => 'false', + ], + 'emit-formatted' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + ]; } public static function datetimePicker(): array { - return []; + return [ + 'props' => [ + 'max' => [ + 'type' => 'Carbon|string|timestamp|null', + 'default' => 'null', + 'required' => 'false', + ], + 'min' => [ + 'type' => 'Carbon|string|timestamp|null', + 'default' => 'null', + 'required' => 'false', + ], + 'interval' => [ + 'type' => 'string|number', + 'default' => '10', + 'required' => 'false', + ], + 'max-time' => [ + 'type' => 'number', + 'default' => '24', + 'required' => 'false', + ], + 'min-time' => [ + 'type' => 'number', + 'default' => '0', + 'required' => 'false', + ], + 'timezone' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'clearable' => [ + 'type' => 'boolean', + 'default' => 'true', + 'required' => 'false', + ], + 'right-icon' => [ + 'type' => 'string', + 'default' => 'calendar', + 'required' => 'false', + ], + 'time-format' => [ + 'type' => 'string', + 'default' => '12', + 'required' => 'false', + ], + 'parse-format' => [ + 'type' => 'string', + 'default' => 'ISO8601', + 'required' => 'false', + ], + 'without-time' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'without-tips' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'user-timezone' => [ + 'type' => 'string', + 'default' => 'real user timezone', + 'required' => 'false', + ], + 'display-format' => [ + 'type' => 'string', + 'default' => 'localeFormat', + 'required' => 'false', + ], + 'without-timezone' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + ]; } public static function errors(): array { - return []; + return [ + 'props' => [ + 'only' => [ + 'type' => 'array', + 'default' => '[]', + 'required' => 'false', + ], + 'title' => [ + 'type' => 'string', + 'default' => "trans('wireui::messages.errors.title')", + 'required' => 'false', + ], + ], + ]; } public static function input(): array { - return []; + return [ + 'props' => [ + 'id' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'icon' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'name' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'corner' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'prefix' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'shadow' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'suffix' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'padding' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'rounded' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'disabled' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'readonly' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'errorless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'right-icon' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'shadowless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'description' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'invalidated' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'with-error-icon' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'with-validation-colors' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + 'corner' => [ + 'description' => 'Slot to add content to the corner.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + 'prefix' => [ + 'description' => 'Slot to add content to the prefix.', + ], + 'suffix' => [ + 'description' => 'Slot to add content to the suffix.', + ], + 'prepend' => [ + 'description' => 'Slot to add content before the input.', + ], + 'append' => [ + 'description' => 'Slot to add content after the input.', + ], + 'description' => [ + 'description' => 'Slot to add content to the description.', + ], + ], + ]; } public static function maskable(): array { - return []; + return [ + 'props' => [ + 'mask' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'true', + ], + 'emit-formatted' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + ]; } public static function nativeSelect(): array { - return []; + return [ + 'props' => [ + 'options' => [ + 'type' => 'Collection|array', + 'default' => 'null', + 'required' => 'false', + ], + 'placeholder' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'flip-options' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'option-label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'option-value' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'empty-message' => [ + 'type' => 'string', + 'default' => "trans('wireui::messages.empty_options')", + 'required' => 'false', + ], + 'option-key-value' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'hide-empty-message' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'option-description' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + ], + ]; } public static function number(): array { - return []; - } - - public static function password(): array - { - return []; + return [ + 'props' => [ + 'icon' => [ + 'type' => 'string', + 'default' => 'minus', + 'required' => 'false', + ], + 'right-icon' => [ + 'type' => 'string', + 'default' => 'plus', + 'required' => 'false', + ], + ], + ]; } public static function phone(): array { - return []; + return [ + 'props' => [ + 'mask' => [ + 'type' => 'string', + 'default' => "['(###) ###-####', '+# ### ###-####', '+## ## ####-####']", + 'required' => 'false', + ], + ], + ]; } public static function radio(): array { - return []; + return [ + 'props' => [ + 'id' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'rounded' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'disabled' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'readonly' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'errorless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'description' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'invalidated' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'right-label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'with-validation-colors' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + 'right-label' => [ + 'description' => 'Slot to add content to the right label.', + ], + 'description' => [ + 'description' => 'Slot to add content to the description.', + ], + ], + ]; } public static function select(): array @@ -490,18 +1253,207 @@ public static function select(): array ]; } + public static function selectOption(): array + { + return [ + 'props' => [ + 'value' => [ + 'type' => 'any', + 'default' => 'null', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'option' => [ + 'type' => 'Model|stdClass|array|null', + 'default' => '[]', + 'required' => 'false', + ], + 'disabled' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'readonly' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'description' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + ], + ]; + } + + public static function selectUserOption(): array + { + return [ + 'props' => [ + 'src' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'true', + ], + 'value' => [ + 'type' => 'any', + 'default' => 'null', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'option' => [ + 'type' => 'Model|stdClass|array|null', + 'default' => '[]', + 'required' => 'false', + ], + 'disabled' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'readonly' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'description' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + ], + ]; + } + public static function textarea(): array { - return []; + return [ + 'props' => [ + 'cols' => [ + 'type' => 'string', + 'default' => 'auto', + 'required' => 'false', + ], + 'rows' => [ + 'type' => 'number', + 'default' => '4', + 'required' => 'false', + ], + ], + ]; } public static function timePicker(): array { - return []; + return [ + 'props' => [ + 'right-icon' => [ + 'type' => 'string', + 'default' => 'clock', + 'required' => 'false', + ], + 'military-time' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'without-seconds' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + ]; } public static function toggle(): array { - return []; + return [ + 'props' => [ + 'id' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'rounded' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'disabled' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'readonly' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'errorless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'description' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'invalidated' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'right-label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'with-validation-colors' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + 'right-label' => [ + 'description' => 'Slot to add content to the right label.', + ], + 'description' => [ + 'description' => 'Slot to add content to the description.', + ], + ], + ]; } } diff --git a/src/config.php b/src/config.php index 9b47942..975b789 100644 --- a/src/config.php +++ b/src/config.php @@ -113,14 +113,6 @@ 'card' => ComponentAPI::card(), - 'dropdown' => ComponentAPI::dropdown(), - - 'icon' => ComponentAPI::icon(), - - 'link' => ComponentAPI::link(), - - 'modal' => ComponentAPI::modal(), - 'checkbox' => ComponentAPI::checkbox(), 'color-picker' => ComponentAPI::colorPicker(), @@ -129,17 +121,33 @@ 'datetime-picker' => ComponentAPI::datetimePicker(), + // 'dialog' => ComponentAPI::dialog(), + + 'dropdown' => ComponentAPI::dropdown(), + + 'dropdown-item' => ComponentAPI::dropdownItem(), + + 'dropdown-header' => ComponentAPI::dropdownHeader(), + 'errors' => ComponentAPI::errors(), + 'icon' => ComponentAPI::icon(), + 'input' => ComponentAPI::input(), + 'link' => ComponentAPI::link(), + 'maskable' => ComponentAPI::maskable(), + 'modal' => ComponentAPI::modal(), + + 'modal-card' => ComponentAPI::modalCard(), + 'native-select' => ComponentAPI::nativeSelect(), - 'number' => ComponentAPI::number(), + // 'notifications' => ComponentAPI::notifications(), - 'password' => ComponentAPI::password(), + 'number' => ComponentAPI::number(), 'phone' => ComponentAPI::phone(), @@ -147,6 +155,10 @@ 'select' => ComponentAPI::select(), + 'select-option' => ComponentAPI::selectOption(), + + 'select-user-option' => ComponentAPI::selectUserOption(), + 'textarea' => ComponentAPI::textarea(), 'time-picker' => ComponentAPI::timePicker(), diff --git a/src/resources/views/sections/components/button.blade.php b/src/resources/views/sections/components/button.blade.php index a156ce0..1bbafcb 100644 --- a/src/resources/views/sections/components/button.blade.php +++ b/src/resources/views/sections/components/button.blade.php @@ -460,7 +460,7 @@ - The props [full, right-icon] and slot [prepend, append] are not supported in mini-button component. + The props [full, right-icon] and slots [prepend, append] are not supported in mini-button component. @livewire("component-api", ['items' => WireUiDocs::getComponentApi('button')]) diff --git a/src/resources/views/sections/components/color-picker.blade.php b/src/resources/views/sections/components/color-picker.blade.php index c7af5f0..070063a 100644 --- a/src/resources/views/sections/components/color-picker.blade.php +++ b/src/resources/views/sections/components/color-picker.blade.php @@ -208,5 +208,11 @@ + + The Color Picker component receives all options from + Input Component, + except the props [icon, prefix] and slots [prepend and append]. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('color-picker')]) diff --git a/src/resources/views/sections/components/currency.blade.php b/src/resources/views/sections/components/currency.blade.php index ecde21b..5e3d41d 100644 --- a/src/resources/views/sections/components/currency.blade.php +++ b/src/resources/views/sections/components/currency.blade.php @@ -99,5 +99,10 @@ + + The Currency component receives all options from + Input Component. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('currency')]) diff --git a/src/resources/views/sections/components/datetime-picker.blade.php b/src/resources/views/sections/components/datetime-picker.blade.php index b504989..e49f5c5 100644 --- a/src/resources/views/sections/components/datetime-picker.blade.php +++ b/src/resources/views/sections/components/datetime-picker.blade.php @@ -201,5 +201,10 @@ + + The Datetime Picker component receives all options from + Input Component. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('datetime-picker')]) diff --git a/src/resources/views/sections/components/dropdown.blade.php b/src/resources/views/sections/components/dropdown.blade.php index ef02486..4a723ec 100644 --- a/src/resources/views/sections/components/dropdown.blade.php +++ b/src/resources/views/sections/components/dropdown.blade.php @@ -20,6 +20,10 @@ + + + + @@ -520,4 +524,12 @@ interfaces. @livewire("component-api", ['items' => WireUiDocs::getComponentApi('dropdown')]) + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('dropdown-item')]) + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('dropdown-header')]) diff --git a/src/resources/views/sections/components/errors.blade.php b/src/resources/views/sections/components/errors.blade.php index 23b5bc3..e09e73e 100644 --- a/src/resources/views/sections/components/errors.blade.php +++ b/src/resources/views/sections/components/errors.blade.php @@ -131,5 +131,10 @@ functionality. In summary, the errors component is a flexible tool for managing + + The Errors component receives all options from + Alert Component. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('errors')]) diff --git a/src/resources/views/sections/components/maskable.blade.php b/src/resources/views/sections/components/maskable.blade.php index 9789532..7779568 100644 --- a/src/resources/views/sections/components/maskable.blade.php +++ b/src/resources/views/sections/components/maskable.blade.php @@ -167,5 +167,10 @@ protected function getInputMask(): array + + The Maskable component receives all options from + Input Component. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('maskable')]) diff --git a/src/resources/views/sections/components/modal.blade.php b/src/resources/views/sections/components/modal.blade.php index 7e966c8..0ef715c 100644 --- a/src/resources/views/sections/components/modal.blade.php +++ b/src/resources/views/sections/components/modal.blade.php @@ -35,6 +35,8 @@ + + @@ -272,4 +274,8 @@ class="flex items-center justify-center col-span-1 bg-gray-100 shadow-md cursor- @livewire("component-api", ['items' => WireUiDocs::getComponentApi('modal')]) + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('modal-card')]) diff --git a/src/resources/views/sections/components/number.blade.php b/src/resources/views/sections/components/number.blade.php index 39f6f09..63a4756 100644 --- a/src/resources/views/sections/components/number.blade.php +++ b/src/resources/views/sections/components/number.blade.php @@ -55,5 +55,10 @@ + + The Number component receives all options from + Input Component. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('number')]) diff --git a/src/resources/views/sections/components/password.blade.php b/src/resources/views/sections/components/password.blade.php index 5de5726..efc25a9 100644 --- a/src/resources/views/sections/components/password.blade.php +++ b/src/resources/views/sections/components/password.blade.php @@ -32,5 +32,9 @@ - @livewire("component-api", ['items' => WireUiDocs::getComponentApi('password')]) + + The Maskable component receives all options from + Input Component, + except the slot [append]. + diff --git a/src/resources/views/sections/components/phone.blade.php b/src/resources/views/sections/components/phone.blade.php index e151e88..fc5a5c8 100644 --- a/src/resources/views/sections/components/phone.blade.php +++ b/src/resources/views/sections/components/phone.blade.php @@ -82,5 +82,10 @@ protected function getInputMask(): array + + The Phone component receives all options from + Maskable Component. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('phone')]) diff --git a/src/resources/views/sections/components/select.blade.php b/src/resources/views/sections/components/select.blade.php index 1e46821..146a059 100644 --- a/src/resources/views/sections/components/select.blade.php +++ b/src/resources/views/sections/components/select.blade.php @@ -22,6 +22,10 @@ + + + + @@ -348,4 +352,12 @@ @livewire("component-api", ['items' => WireUiDocs::getComponentApi('select')]) + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('select-option')]) + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('select-user-option')]) diff --git a/src/resources/views/sections/components/textarea.blade.php b/src/resources/views/sections/components/textarea.blade.php index 41f3a91..797f300 100644 --- a/src/resources/views/sections/components/textarea.blade.php +++ b/src/resources/views/sections/components/textarea.blade.php @@ -40,5 +40,10 @@ + + The Textarea component receives all options from + Input Component. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('textarea')]) diff --git a/src/resources/views/sections/components/time-picker.blade.php b/src/resources/views/sections/components/time-picker.blade.php index 5b692c6..240181e 100644 --- a/src/resources/views/sections/components/time-picker.blade.php +++ b/src/resources/views/sections/components/time-picker.blade.php @@ -105,5 +105,10 @@ + + The Time Picker component receives all options from + Input Component. + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('time-picker')]) From 1d4ac0d9308fb5a6cb84b9e0d7d42cca56d5eb77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Wed, 22 May 2024 22:13:04 -0300 Subject: [PATCH 14/15] wip --- src/Support/ComponentAPI.php | 492 +++++++++--------- src/config.php | 4 +- .../views/sections/actions/dialogs.blade.php | 6 + .../sections/actions/notifications.blade.php | 6 + 4 files changed, 265 insertions(+), 243 deletions(-) diff --git a/src/Support/ComponentAPI.php b/src/Support/ComponentAPI.php index 9a7671c..74c6718 100644 --- a/src/Support/ComponentAPI.php +++ b/src/Support/ComponentAPI.php @@ -335,247 +335,6 @@ public static function card(): array ]; } - public static function dropdown(): array - { - return [ - 'props' => [ - 'icon' => [ - 'type' => 'string', - 'default' => 'ellipsis-vertical', - 'required' => 'false', - ], - 'width' => [ - 'type' => 'string', - 'default' => 'CONFIG', - 'required' => 'false', - ], - 'height' => [ - 'type' => 'string', - 'default' => 'CONFIG', - 'required' => 'false', - ], - 'position' => [ - 'type' => 'string', - 'default' => 'null', - 'required' => 'false', - ], - 'persistent' => [ - 'type' => 'boolean', - 'default' => 'false', - 'required' => 'false', - ], - ], - 'slots' => [ - 'trigger' => [ - 'description' => 'Slot to add content to the trigger.', - ], - 'slot' => [ - 'description' => 'Slot to add content to the body.', - ], - ], - ]; - } - - public static function dropdownItem(): array - { - return [ - 'props' => [ - 'icon' => [ - 'type' => 'string', - 'default' => 'null', - 'required' => 'false', - ], - 'label' => [ - 'type' => 'string', - 'default' => 'null', - 'required' => 'false', - ], - 'separator' => [ - 'type' => 'boolean', - 'default' => 'false', - 'required' => 'false', - ], - ], - 'slots' => [ - 'label' => [ - 'description' => 'Slot to add content to the label.', - ], - 'slot' => [ - 'description' => 'Slot to add content to the body.', - ], - ], - ]; - } - - public static function dropdownHeader(): array - { - return [ - 'props' => [ - 'label' => [ - 'type' => 'string', - 'default' => 'null', - 'required' => 'false', - ], - 'separator' => [ - 'type' => 'boolean', - 'default' => 'false', - 'required' => 'false', - ], - ], - 'slots' => [ - 'label' => [ - 'description' => 'Slot to add content to the label.', - ], - 'slot' => [ - 'description' => 'Slot to add content to the body.', - ], - ], - ]; - } - - public static function icon(): array - { - return [ - 'props' => [ - 'name' => [ - 'type' => 'string', - 'default' => 'null', - 'required' => 'true', - ], - 'variant' => [ - 'type' => 'string', - 'default' => 'CONFIG', - 'required' => 'false', - ], - ], - ]; - } - - public static function link(): array - { - return [ - 'props' => [ - 'href' => [ - 'type' => 'string', - 'default' => 'null', - 'required' => 'false', - ], - 'size' => [ - 'type' => 'string', - 'default' => 'CONFIG', - 'required' => 'false', - ], - 'color' => [ - 'type' => 'string', - 'default' => 'CONFIG', - 'required' => 'false', - ], - 'label' => [ - 'type' => 'string', - 'default' => 'null', - 'required' => 'false', - ], - 'underline' => [ - 'type' => 'boolean', - 'default' => 'false', - 'required' => 'false', - ], - ], - 'slots' => [ - 'label' => [ - 'description' => 'Slot to add content to the label.', - ], - 'slot' => [ - 'description' => 'Slot to add content to the body.', - ], - ], - ]; - } - - public static function modal(): array - { - return [ - 'props' => [ - 'blur' => [ - 'type' => 'string', - 'default' => 'CONFIG', - 'required' => 'false', - ], - 'name' => [ - 'type' => 'string', - 'default' => 'null', - 'required' => 'false', - ], - 'show' => [ - 'type' => 'boolean', - 'default' => 'false', - 'required' => 'false', - ], - 'type' => [ - 'type' => 'string', - 'default' => 'CONFIG', - 'required' => 'false', - ], - 'align' => [ - 'type' => 'string', - 'default' => 'CONFIG', - 'required' => 'false', - ], - 'width' => [ - 'type' => 'string', - 'default' => 'CONFIG', - 'required' => 'false', - ], - 'spacing' => [ - 'type' => 'string', - 'default' => 'null', - 'required' => 'false', - ], - 'z-index' => [ - 'type' => 'string', - 'default' => 'null', - 'required' => 'false', - ], - 'blurless' => [ - 'type' => 'boolean', - 'default' => 'false', - 'required' => 'false', - ], - 'persistent' => [ - 'type' => 'boolean', - 'default' => 'false', - 'required' => 'false', - ], - ], - 'slots' => [ - 'slot' => [ - 'description' => 'Slot to add content to the body.', - ], - ], - 'events' => [ - 'open' => [ - 'description' => 'Event emitted when the modal is opened.', - ], - 'close' => [ - 'description' => 'Event emitted when the modal is closed.', - ], - ], - ]; - } - - public static function modalCard(): array - { - return [ - 'props' => [ - 'hide-close' => [ - 'type' => 'boolean', - 'default' => 'false', - 'required' => 'false', - ], - ], - ]; - } - public static function checkbox(): array { return [ @@ -792,6 +551,109 @@ public static function datetimePicker(): array ]; } + public static function dialogs(): array + { + return []; + } + + public static function dropdown(): array + { + return [ + 'props' => [ + 'icon' => [ + 'type' => 'string', + 'default' => 'ellipsis-vertical', + 'required' => 'false', + ], + 'width' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'height' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'position' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'persistent' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'trigger' => [ + 'description' => 'Slot to add content to the trigger.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + ], + ]; + } + + public static function dropdownItem(): array + { + return [ + 'props' => [ + 'icon' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'separator' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + ], + ]; + } + + public static function dropdownHeader(): array + { + return [ + 'props' => [ + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'separator' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + ], + ]; + } + public static function errors(): array { return [ @@ -810,6 +672,24 @@ public static function errors(): array ]; } + public static function icon(): array + { + return [ + 'props' => [ + 'name' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'true', + ], + 'variant' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + ], + ]; + } + public static function input(): array { return [ @@ -944,6 +824,47 @@ public static function input(): array ]; } + public static function link(): array + { + return [ + 'props' => [ + 'href' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'size' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'color' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'label' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'underline' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'label' => [ + 'description' => 'Slot to add content to the label.', + ], + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + ], + ]; + } + public static function maskable(): array { return [ @@ -962,6 +883,90 @@ public static function maskable(): array ]; } + public static function modal(): array + { + return [ + 'props' => [ + 'blur' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'name' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'show' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'type' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'align' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'width' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'spacing' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'z-index' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'blurless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'persistent' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + 'slots' => [ + 'slot' => [ + 'description' => 'Slot to add content to the body.', + ], + ], + 'events' => [ + 'open' => [ + 'description' => 'Event emitted when the modal is opened.', + ], + 'close' => [ + 'description' => 'Event emitted when the modal is closed.', + ], + ], + ]; + } + + public static function modalCard(): array + { + return [ + 'props' => [ + 'hide-close' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + ], + ]; + } + public static function nativeSelect(): array { return [ @@ -1015,6 +1020,11 @@ public static function nativeSelect(): array ]; } + public static function notifications(): array + { + return []; + } + public static function number(): array { return [ diff --git a/src/config.php b/src/config.php index 975b789..0450e63 100644 --- a/src/config.php +++ b/src/config.php @@ -121,7 +121,7 @@ 'datetime-picker' => ComponentAPI::datetimePicker(), - // 'dialog' => ComponentAPI::dialog(), + 'dialogs' => ComponentAPI::dialogs(), 'dropdown' => ComponentAPI::dropdown(), @@ -145,7 +145,7 @@ 'native-select' => ComponentAPI::nativeSelect(), - // 'notifications' => ComponentAPI::notifications(), + 'notifications' => ComponentAPI::notifications(), 'number' => ComponentAPI::number(), diff --git a/src/resources/views/sections/actions/dialogs.blade.php b/src/resources/views/sections/actions/dialogs.blade.php index b897750..50eb07b 100644 --- a/src/resources/views/sections/actions/dialogs.blade.php +++ b/src/resources/views/sections/actions/dialogs.blade.php @@ -85,6 +85,8 @@ + + @@ -561,4 +563,8 @@ public function customDialog(): void @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('dialogs')]) diff --git a/src/resources/views/sections/actions/notifications.blade.php b/src/resources/views/sections/actions/notifications.blade.php index 180ca22..2d3f877 100644 --- a/src/resources/views/sections/actions/notifications.blade.php +++ b/src/resources/views/sections/actions/notifications.blade.php @@ -70,6 +70,8 @@ + + @@ -447,4 +449,8 @@ public function save(): void } @endverbatim + + + + @livewire("component-api", ['items' => WireUiDocs::getComponentApi('notifications')]) From 9b121ee3e1a4f47828c9de753bf43652a06146bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Wed, 22 May 2024 22:28:07 -0300 Subject: [PATCH 15/15] feat(tables): adding tables in actions --- src/Support/ComponentAPI.php | 70 ++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/src/Support/ComponentAPI.php b/src/Support/ComponentAPI.php index 74c6718..dafaec4 100644 --- a/src/Support/ComponentAPI.php +++ b/src/Support/ComponentAPI.php @@ -553,7 +553,60 @@ public static function datetimePicker(): array public static function dialogs(): array { - return []; + return [ + 'props' => [ + 'id' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'blur' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'type' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'align' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'title' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'width' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'spacing' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'z-index' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + 'blurless' => [ + 'type' => 'boolean', + 'default' => 'false', + 'required' => 'false', + ], + 'description' => [ + 'type' => 'string', + 'default' => 'null', + 'required' => 'false', + ], + ], + ]; } public static function dropdown(): array @@ -1022,7 +1075,20 @@ public static function nativeSelect(): array public static function notifications(): array { - return []; + return [ + 'props' => [ + 'z-index' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + 'position' => [ + 'type' => 'string', + 'default' => 'CONFIG', + 'required' => 'false', + ], + ], + ]; } public static function number(): array