railwind 0.1.21 → 0.1.22
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +51 -0
- data/Rakefile +4 -0
- data/lib/railwind/generators/button_generator.rb +12 -0
- data/lib/railwind/generators/card_generator.rb +12 -0
- data/lib/railwind/generators/tab_generator.rb +13 -0
- data/lib/railwind/generators/templates/button/_button_component.html.erb +23 -0
- data/lib/railwind/generators/templates/button/button_component.rb +7 -0
- data/lib/railwind/generators/templates/card/_card_component.html.erb +15 -0
- data/lib/railwind/generators/templates/card/card_component.rb +4 -0
- data/lib/railwind/generators/templates/tabs/_tab_component.html.erb +29 -0
- data/lib/railwind/generators/templates/tabs/tab_component.rb +7 -0
- data/lib/railwind/generators/templates/tabs/tabs_controller.js +48 -0
- data/lib/railwind/version.rb +5 -0
- data/lib/railwind.rb +12 -0
- data/railwind.gemspec +41 -0
- data/sig/railwind.rbs +4 -0
- metadata +21 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6cf837cdb5f28533bc63a94cb9f7514b5a823783dcdc34f94e55584dbe3d110
|
4
|
+
data.tar.gz: 90cc46565b4091fd9172fb367c690a7aecbc56dac3e283297e90f4544d2aa888
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42e5379eac7632028eab000f4719ca841654cefa8e909aabd42d248f59a0e77339dcac551a69386db838e52a3bc862e1126403e01aba18f150f2e68f61e0b59b
|
7
|
+
data.tar.gz: 22b23867c36cbcc4d7a1fb3afa6799674aceb4f9977716063e5003e9fc9b107f62d0a2a7c96d6ff6fd14696d32288a9f794aea5df64501b8cef4dc0131b695e7
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Railwind
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/railwind)
|
4
|
+
|
5
|
+
Coming Soon!
|
6
|
+
|
7
|
+
Railwind is a customizable ViewComponent UI library that leverages the power of Tailwind CSS. It provides a set of reusable and configurable UI components that can be easily integrated into any Rails application. With Railwind, developers can rapidly build beautiful and responsive user interfaces with less effort and time.
|
8
|
+
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
13
|
+
|
14
|
+
Install the gem and add to the application's Gemfile by executing:
|
15
|
+
|
16
|
+
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
17
|
+
|
18
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
19
|
+
|
20
|
+
$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
TODO: Write usage instructions here
|
25
|
+
|
26
|
+
## Development
|
27
|
+
|
28
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
29
|
+
|
30
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/railwind.
|
35
|
+
|
36
|
+
## License
|
37
|
+
|
38
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
TODO:
|
44
|
+
|
45
|
+
|
46
|
+
- Building the gemspec: gem build railwind.gemspec
|
47
|
+
|
48
|
+
- Deploying: gem push railwind-<version>.gem
|
49
|
+
|
50
|
+
|
51
|
+
- Updating in consumer app: bundle update railwind
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Railwind
|
4
|
+
class ButtonGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('templates', __dir__)
|
6
|
+
|
7
|
+
def create_component_file
|
8
|
+
copy_file "button/button_component.rb", "app/components/button_component.rb"
|
9
|
+
copy_file "button/_button_component.html.erb", "app/components/button_component.html.erb"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Railwind
|
4
|
+
class CardGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('templates', __dir__)
|
6
|
+
|
7
|
+
def create_component_file
|
8
|
+
copy_file "card/card_component.rb", "app/components/card_component.rb"
|
9
|
+
copy_file "card/_card_component.html.erb", "app/components/card_component.html.erb"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Railwind
|
4
|
+
class TabGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('templates', __dir__)
|
6
|
+
|
7
|
+
def create_component_file
|
8
|
+
copy_file "tabs/tab_component.rb", "app/components/tab_component.rb"
|
9
|
+
copy_file "tabs/_tab_component.html.erb", "app/components/tab_component.html.erb"
|
10
|
+
copy_file "tabs/tabs_controller.js", "app/javascript/controllers/tabs_controller.js"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% base_classes =
|
2
|
+
"px-4 py-2 rounded-full transition hover:opacity-90 hover:shadow border-2 font-semibold flex items-center justify-center gap-2 w-full"
|
3
|
+
variant_classes =
|
4
|
+
case @variant
|
5
|
+
when "primary"
|
6
|
+
"border-black bg-black text-white"
|
7
|
+
when "secondary"
|
8
|
+
"border-gray-500 bg-gray-500 text-white"
|
9
|
+
when "outline"
|
10
|
+
"border-gray-500 text-gray-500"
|
11
|
+
when "ghost"
|
12
|
+
"border-transparent bg-transparent text-gray-500 hover:bg-gray-200"
|
13
|
+
when "danger"
|
14
|
+
"border-red-500 bg-red-500 text-white"
|
15
|
+
else
|
16
|
+
"bg-blue-500 text-white"
|
17
|
+
end
|
18
|
+
tailwind_classes = "#{base_classes} #{variant_classes}" %>
|
19
|
+
|
20
|
+
<button type="<%= @type %>" class="<%= tailwind_classes %>">
|
21
|
+
<%= content %>
|
22
|
+
<%= @text %>
|
23
|
+
</button>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<div data-id="<%= @id %>" class="tabs" data-controller="tabs">
|
2
|
+
|
3
|
+
<div
|
4
|
+
class="
|
5
|
+
flex
|
6
|
+
items-center
|
7
|
+
gap-4
|
8
|
+
mb-2
|
9
|
+
w-full
|
10
|
+
border-b-2
|
11
|
+
border-solid
|
12
|
+
border-gray-200
|
13
|
+
"
|
14
|
+
>
|
15
|
+
<% @tabs.each_with_index do |tab, index| %>
|
16
|
+
<button
|
17
|
+
class="border-b-2 border-solid mb-[-2px] font-semibold"
|
18
|
+
data-action="tabs#switchTab"
|
19
|
+
data-tab-index="<%= index %>"
|
20
|
+
>
|
21
|
+
<%= tab %>
|
22
|
+
</button>
|
23
|
+
<% end %>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="tab-content hidden">
|
27
|
+
<%= content %>
|
28
|
+
</div>
|
29
|
+
</div>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
2
|
+
|
3
|
+
export default class extends Controller {
|
4
|
+
activeIndex = 0;
|
5
|
+
|
6
|
+
connect() {
|
7
|
+
this.activeIndex = 0;
|
8
|
+
this.showTab();
|
9
|
+
const tabs = this.element.querySelectorAll(".tab-content");
|
10
|
+
tabs[0].classList.remove("hidden");
|
11
|
+
}
|
12
|
+
|
13
|
+
switchTab(event) {
|
14
|
+
this.activeIndex = parseInt(event.currentTarget.dataset.tabIndex);
|
15
|
+
this.showTab();
|
16
|
+
}
|
17
|
+
|
18
|
+
showTab() {
|
19
|
+
// Get all elements with the class "tab-content".
|
20
|
+
// Should only be the one within the tab_component.html.erb partial
|
21
|
+
const tabs = this.element.querySelectorAll(".tab-content");
|
22
|
+
|
23
|
+
// Iterate over each tab
|
24
|
+
tabs.forEach((tab, index) => {
|
25
|
+
// Get all direct children of the current tab
|
26
|
+
const directChildren = Array.from(tab.children);
|
27
|
+
|
28
|
+
// Iterate over each direct child to hide or show
|
29
|
+
directChildren.forEach((child, i) => {
|
30
|
+
let element = this.element.querySelector(
|
31
|
+
`button[data-tab-index="${i}"]`
|
32
|
+
);
|
33
|
+
|
34
|
+
if (i === this.activeIndex) {
|
35
|
+
child.classList.remove("hidden");
|
36
|
+
element.classList.add("border-gray-900");
|
37
|
+
element.classList.add("text-gray-900");
|
38
|
+
element.classList.remove("text-gray-400");
|
39
|
+
} else {
|
40
|
+
child.classList.add("hidden");
|
41
|
+
element.classList.remove("border-gray-900");
|
42
|
+
element.classList.remove("text-gray-900")
|
43
|
+
element.classList.add("text-gray-400");
|
44
|
+
}
|
45
|
+
});
|
46
|
+
});
|
47
|
+
}
|
48
|
+
}
|
data/lib/railwind.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "railwind/version"
|
4
|
+
require_relative "railwind/generators/button_generator"
|
5
|
+
require_relative "railwind/generators/callout_generator"
|
6
|
+
require_relative "railwind/generators/card_generator"
|
7
|
+
require_relative "railwind/generators/tab_generator"
|
8
|
+
|
9
|
+
module Railwind
|
10
|
+
class Error < StandardError; end
|
11
|
+
# Your code goes here...
|
12
|
+
end
|
data/railwind.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/railwind/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "railwind"
|
7
|
+
spec.version = Railwind::VERSION
|
8
|
+
spec.authors = ["Christian Bryant"]
|
9
|
+
spec.email = ["hi@christianlovescode.com"]
|
10
|
+
|
11
|
+
spec.summary = "a customizeable ViewComponent UI library baked with Tailwind CSS."
|
12
|
+
spec.description = "<COMING SOON> Railwind is a customizable ViewComponent UI library that leverages the power of Tailwind CSS. It provides a set of reusable and configurable UI components that can be easily integrated into any Rails application. With Railwind, developers can rapidly build beautiful and responsive user interfaces with less effort and time."
|
13
|
+
spec.homepage = "https://github.com/christianlovescode/railwind"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 3.2.0"
|
16
|
+
|
17
|
+
# spec.metadata["allowed_push_host"] = "https://christianbryant.dev"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/christianlovescode/railwind"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/christianlovescode/railwind"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(__dir__) do
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
(File.expand_path(f) == __FILE__) ||
|
28
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile]) ||
|
29
|
+
f.end_with?('.gem') # Exclude any .gem files
|
30
|
+
end
|
31
|
+
end
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = ["lib"]
|
35
|
+
|
36
|
+
spec.add_dependency "rails", "~> 7.0"
|
37
|
+
spec.add_dependency "view_component", "~> 3.0"
|
38
|
+
|
39
|
+
# For more information and examples about making a new gem, check out our
|
40
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
41
|
+
end
|
data/sig/railwind.rbs
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railwind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Bryant
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -48,7 +48,25 @@ email:
|
|
48
48
|
executables: []
|
49
49
|
extensions: []
|
50
50
|
extra_rdoc_files: []
|
51
|
-
files:
|
51
|
+
files:
|
52
|
+
- CHANGELOG.md
|
53
|
+
- LICENSE.txt
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- lib/railwind.rb
|
57
|
+
- lib/railwind/generators/button_generator.rb
|
58
|
+
- lib/railwind/generators/card_generator.rb
|
59
|
+
- lib/railwind/generators/tab_generator.rb
|
60
|
+
- lib/railwind/generators/templates/button/_button_component.html.erb
|
61
|
+
- lib/railwind/generators/templates/button/button_component.rb
|
62
|
+
- lib/railwind/generators/templates/card/_card_component.html.erb
|
63
|
+
- lib/railwind/generators/templates/card/card_component.rb
|
64
|
+
- lib/railwind/generators/templates/tabs/_tab_component.html.erb
|
65
|
+
- lib/railwind/generators/templates/tabs/tab_component.rb
|
66
|
+
- lib/railwind/generators/templates/tabs/tabs_controller.js
|
67
|
+
- lib/railwind/version.rb
|
68
|
+
- railwind.gemspec
|
69
|
+
- sig/railwind.rbs
|
52
70
|
homepage: https://github.com/christianlovescode/railwind
|
53
71
|
licenses:
|
54
72
|
- MIT
|