codengage_view_components 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ebf99eb2f36d77f141dd24398a34f78a016ac7b029afcb89e633a8a13793fcfa
4
+ data.tar.gz: 431697508165c85ae1ad6e8d87576163c3eba78e43d322001a9f0577866eea40
5
+ SHA512:
6
+ metadata.gz: a8b828d6ad4cf064b302e20ff16b5c4794a15374a295c552f23ff29ab7c04d8dfd90cf0cc0cd93f59153777112b50fea9e963304080b91bf643951af595048d4
7
+ data.tar.gz: 3cc821faac6e7b8356f393afe7fa5b5629154d668ab2089a7ae164b0f6ff773c17ae4fa696f6da6b6e5f1303a113e2a1d45137cb59c4e582c5cb7f0378290069
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright Gabriel Karlinski Baldo
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # CodengageViewComponents
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem "codengage_view_components"
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install codengage_view_components
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ require "bundler/gem_tasks"
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CodengageViewComponents
4
+ class ApplicationComponent < ViewComponent::Base
5
+ include Turbo::FramesHelper
6
+ include LucideRails::RailsHelper
7
+ end
8
+ end
@@ -0,0 +1,15 @@
1
+ .flash {
2
+ @apply flex items-center w-full max-w-sm p-4 rounded-base gap-4 text-white fixed right-0 bottom-12 mr-4 transition-transform transform translate-x-full;
3
+ }
4
+
5
+ .flash.flash--visible {
6
+ @apply translate-x-0;
7
+ }
8
+
9
+ .flash__icon {
10
+ @apply flex items-center justify-center bg-white rounded-full w-fit h-fit;
11
+ }
12
+
13
+ .flash__text {
14
+ @apply font-normal;
15
+ }
@@ -0,0 +1,6 @@
1
+ - @messages.each do |message|
2
+ .flash{ class: message.bg, data: { controller: "codengage-view-components--flash-component" } }
3
+ .flash__icon
4
+ = lucide_icon(message.icon, stroke: message.stroke)
5
+ .flash__text
6
+ = message.text
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CodengageViewComponents
4
+ class FlashComponent < ApplicationComponent
5
+ Message = Struct.new(:type, :text, :bg, :stroke, :icon, keyword_init: true)
6
+
7
+ STYLES = {
8
+ "notice" => { bg: "bg-green-700", stroke: "#48BB78", icon: "check" },
9
+ "alert" => { bg: "bg-red-700", stroke: "#DC3545", icon: "circle-alert" }
10
+ }.freeze
11
+
12
+ def initialize(flash:)
13
+ @messages = flash.map do |type, text|
14
+ style = STYLES[type]
15
+ Message.new(type:, text: text.to_s, **style)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,25 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ connect() {
5
+ requestAnimationFrame(() => {
6
+ this.element.classList.add('flash--visible')
7
+ })
8
+
9
+
10
+ this.timeout = setTimeout(() => {
11
+ this.hide()
12
+ }, 3000)
13
+ }
14
+
15
+ hide() {
16
+ this.element.classList.remove('flash--visible')
17
+ this.element.addEventListener('transitionend', () => {
18
+ this.element.remove()
19
+ }, { once: true })
20
+ }
21
+
22
+ disconnect() {
23
+ clearTimeout(this.timeout)
24
+ }
25
+ }
@@ -0,0 +1,4 @@
1
+ module CodengageViewComponents
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module CodengageViewComponents
2
+ class PagesController < ApplicationController
3
+ def home
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ module CodengageViewComponents
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module CodengageViewComponents
2
+ module PagesHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module CodengageViewComponents
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module CodengageViewComponents
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module CodengageViewComponents
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ <h1>Pages#home</h1>
2
+ <p>Find me in app/views/codengage_view_components/pages/home.html.erb</p>
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Codengage view components</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= yield :head %>
9
+
10
+ <%= stylesheet_link_tag "codengage_view_components/application", media: "all" %>
11
+ </head>
12
+ <body>
13
+ <%= render(CodengageViewComponents::FlashComponent.new(flash: { "notice" => "Funciona!", "alert" => "Erro de teste" })) %>
14
+ <%= yield %>
15
+
16
+ </body>
17
+ </html>
@@ -0,0 +1 @@
1
+ pin_all_from File.expand_path("../app/components", __dir__), under: "codengage_view_components"
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ CodengageViewComponents::Engine.routes.draw do
2
+ get "pages/home"
3
+ end
@@ -0,0 +1,17 @@
1
+ module CodengageViewComponents
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace CodengageViewComponents
4
+
5
+ initializer "codengage_view_components.assets" do |app|
6
+ if app.config.respond_to?(:assets)
7
+ app.config.assets.paths << root.join("app/components")
8
+ end
9
+ end
10
+
11
+ initializer "codengage_view_components.importmap", before: "importmap" do |app|
12
+ if app.config.respond_to?(:importmap)
13
+ app.config.importmap.paths << root.join("config/importmap.rb")
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module CodengageViewComponents
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "codengage_view_components/version"
2
+ require "codengage_view_components/engine"
3
+ require "view_component"
4
+
5
+ module CodengageViewComponents
6
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :codengage_view_components do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: codengage_view_components
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gabriel Karlinski Baldo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-01-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 8.1.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 8.1.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: view_component
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: lucide-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sqlite3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: puma
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Coleção de componentes reutilizáveis como Flash messages, botões e modais
84
+ para Ruby on Rails.
85
+ email:
86
+ - gabriel.k.baldo@gmail.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - MIT-LICENSE
92
+ - README.md
93
+ - Rakefile
94
+ - app/assets/stylesheets/codengage_view_components/application.css
95
+ - app/components/codengage_view_components/application_component.rb
96
+ - app/components/codengage_view_components/flash_component.css
97
+ - app/components/codengage_view_components/flash_component.html.haml
98
+ - app/components/codengage_view_components/flash_component.rb
99
+ - app/components/codengage_view_components/flash_component_controller.js
100
+ - app/controllers/codengage_view_components/application_controller.rb
101
+ - app/controllers/codengage_view_components/pages_controller.rb
102
+ - app/helpers/codengage_view_components/application_helper.rb
103
+ - app/helpers/codengage_view_components/pages_helper.rb
104
+ - app/jobs/codengage_view_components/application_job.rb
105
+ - app/mailers/codengage_view_components/application_mailer.rb
106
+ - app/models/codengage_view_components/application_record.rb
107
+ - app/views/codengage_view_components/pages/home.html.erb
108
+ - app/views/layouts/codengage_view_components/application.html.erb
109
+ - config/importmap.rb
110
+ - config/routes.rb
111
+ - lib/codengage_view_components.rb
112
+ - lib/codengage_view_components/engine.rb
113
+ - lib/codengage_view_components/version.rb
114
+ - lib/tasks/codengage_view_components_tasks.rake
115
+ homepage: https://github.com/gabriel-baldo/codengage_view_components
116
+ licenses:
117
+ - MIT
118
+ metadata:
119
+ homepage_uri: https://github.com/gabriel-baldo/codengage_view_components
120
+ source_code_uri: https://github.com/gabriel-baldo/codengage_view_components
121
+ changelog_uri: https://github.com/gabriel-baldo/codengage_view_components/blob/main/README.md
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubygems_version: 3.5.22
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Biblioteca de ViewComponents com Tailwind para projetos Codengage.
141
+ test_files: []