nitro_kit 0.1.0 → 0.3.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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -1
  4. data/Rakefile +6 -4
  5. data/app/components/nitro_kit/accordion.rb +69 -33
  6. data/app/components/nitro_kit/alert.rb +69 -0
  7. data/app/components/nitro_kit/avatar.rb +52 -0
  8. data/app/components/nitro_kit/badge.rb +47 -23
  9. data/app/components/nitro_kit/button.rb +97 -65
  10. data/app/components/nitro_kit/button_group.rb +18 -13
  11. data/app/components/nitro_kit/card.rb +49 -9
  12. data/app/components/nitro_kit/checkbox.rb +59 -41
  13. data/app/components/nitro_kit/checkbox_group.rb +38 -0
  14. data/app/components/nitro_kit/combobox.rb +138 -0
  15. data/app/components/nitro_kit/component.rb +46 -17
  16. data/app/components/nitro_kit/datepicker.rb +9 -0
  17. data/app/components/nitro_kit/dialog.rb +95 -0
  18. data/app/components/nitro_kit/dropdown.rb +116 -73
  19. data/app/components/nitro_kit/field.rb +281 -30
  20. data/app/components/nitro_kit/field_group.rb +10 -5
  21. data/app/components/nitro_kit/fieldset.rb +42 -7
  22. data/app/components/nitro_kit/form_builder.rb +45 -22
  23. data/app/components/nitro_kit/icon.rb +29 -8
  24. data/app/components/nitro_kit/input.rb +26 -0
  25. data/app/components/nitro_kit/label.rb +18 -5
  26. data/app/components/nitro_kit/pagination.rb +98 -0
  27. data/app/components/nitro_kit/radio_button.rb +28 -27
  28. data/app/components/nitro_kit/radio_button_group.rb +53 -0
  29. data/app/components/nitro_kit/select.rb +72 -0
  30. data/app/components/nitro_kit/switch.rb +49 -39
  31. data/app/components/nitro_kit/table.rb +56 -0
  32. data/app/components/nitro_kit/tabs.rb +98 -0
  33. data/app/components/nitro_kit/textarea.rb +26 -0
  34. data/app/components/nitro_kit/toast.rb +104 -0
  35. data/app/components/nitro_kit/tooltip.rb +53 -0
  36. data/app/helpers/nitro_kit/accordion_helper.rb +3 -1
  37. data/app/helpers/nitro_kit/alert_helper.rb +11 -0
  38. data/app/helpers/nitro_kit/avatar_helper.rb +9 -0
  39. data/app/helpers/nitro_kit/badge_helper.rb +3 -5
  40. data/app/helpers/nitro_kit/button_group_helper.rb +2 -0
  41. data/app/helpers/nitro_kit/button_helper.rb +37 -28
  42. data/app/helpers/nitro_kit/card_helper.rb +2 -0
  43. data/app/helpers/nitro_kit/checkbox_helper.rb +19 -16
  44. data/app/helpers/nitro_kit/combobox_helper.rb +9 -0
  45. data/app/helpers/nitro_kit/datepicker_helper.rb +9 -0
  46. data/app/helpers/nitro_kit/dialog_helper.rb +9 -0
  47. data/app/helpers/nitro_kit/dropdown_helper.rb +3 -1
  48. data/app/helpers/nitro_kit/field_group_helper.rb +9 -0
  49. data/app/helpers/nitro_kit/field_helper.rb +4 -2
  50. data/app/helpers/nitro_kit/fieldset_helper.rb +9 -0
  51. data/app/helpers/nitro_kit/form_helper.rb +13 -0
  52. data/app/helpers/nitro_kit/icon_helper.rb +3 -1
  53. data/app/helpers/nitro_kit/input_helper.rb +35 -0
  54. data/app/helpers/nitro_kit/label_helper.rb +12 -8
  55. data/app/helpers/nitro_kit/pagination_helper.rb +42 -0
  56. data/app/helpers/nitro_kit/radio_button_helper.rb +15 -12
  57. data/app/helpers/nitro_kit/select_helper.rb +24 -0
  58. data/app/helpers/nitro_kit/switch_helper.rb +4 -10
  59. data/app/helpers/nitro_kit/table_helper.rb +9 -0
  60. data/app/helpers/nitro_kit/tabs_helper.rb +9 -0
  61. data/app/helpers/nitro_kit/textarea_helper.rb +9 -0
  62. data/app/helpers/nitro_kit/toast_helper.rb +36 -0
  63. data/app/helpers/nitro_kit/tooltip_helper.rb +9 -0
  64. data/lib/generators/nitro_kit/add_generator.rb +38 -41
  65. data/lib/generators/nitro_kit/install_generator.rb +2 -1
  66. data/lib/nitro_kit/engine.rb +4 -0
  67. data/lib/nitro_kit/schema_builder.rb +90 -16
  68. data/lib/nitro_kit/version.rb +1 -1
  69. data/lib/nitro_kit.rb +39 -1
  70. data/lib/tasks/nitro_kit_tasks.rake +4 -0
  71. metadata +40 -12
  72. data/app/components/nitro_kit/radio_group.rb +0 -35
  73. data/app/helpers/application_helper.rb +0 -89
  74. data/lib/nitro_kit/railtie.rb +0 -8
@@ -1,20 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NitroKit
2
4
  module RadioButtonHelper
3
- def nk_radio_button(name, value, *args)
4
- if args.length >= 3
5
- raise ArgumentError, "wrong number of arguments (given #{args.length + 2}, expected 2..4)"
6
- end
7
-
8
- options = args.extract_options!
9
- checked = args.empty? ? false : args.first
10
-
11
- options[:checked] = "checked" if checked
5
+ def nk_radio_button(
6
+ compat_object_name = nil,
7
+ compat_method = nil,
8
+ compat_tag_value = nil,
9
+ compat_options = {},
10
+ label: nil,
11
+ **attrs
12
+ )
13
+ name = field_name(compat_object_name, compat_method)
14
+ value = compat_tag_value || attrs[:value]
12
15
 
13
- render(RadioButton.new(name, value:, name:, value:, **options))
16
+ render(RadioButton.new(label:, name:, value:, **attrs))
14
17
  end
15
18
 
16
- def nk_radio_group(name, **options, &block)
17
- render(RadioGroup.new(name, **options, &block))
19
+ def nk_radio_button_group(**attrs, &block)
20
+ render(RadioButtonGroup.new(**attrs), &block)
18
21
  end
19
22
  end
20
23
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NitroKit
4
+ module SelectHelper
5
+ def nk_select(
6
+ compat_object_name = nil,
7
+ compat_method = nil,
8
+ options = nil,
9
+ compat_options = {},
10
+ value: nil,
11
+ include_blank: false,
12
+ prompt: nil,
13
+ index: nil,
14
+ **attrs,
15
+ &block
16
+ )
17
+ name = field_name(compat_object_name, compat_method)
18
+
19
+ # TODO: support index
20
+
21
+ render(Select.new(options, value:, include_blank:, prompt:, **compat_options, **attrs), &block)
22
+ end
23
+ end
24
+ end
@@ -1,15 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NitroKit
2
4
  module SwitchHelper
3
- def nk_switch(
4
- name,
5
- checked: false,
6
- disabled: false,
7
- size: :base,
8
- description: nil,
9
- **attrs,
10
- &block
11
- )
12
- render(NitroKit::Switch.new(name, checked:, disabled:, size:, description:, **attrs), &block)
5
+ def nk_switch(**attrs, &block)
6
+ render(Switch.new(**attrs), &block)
13
7
  end
14
8
  end
15
9
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NitroKit
4
+ module TableHelper
5
+ def nk_table(**attrs, &block)
6
+ render(Table.new(**attrs), &block)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NitroKit
4
+ module TabsHelper
5
+ def nk_tabs(**attrs, &block)
6
+ render(Tabs.new(**attrs), &block)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NitroKit
4
+ module TextareaHelper
5
+ def nk_textarea(**attrs)
6
+ render(Textarea.new(**attrs))
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NitroKit
4
+ module ToastHelper
5
+ def nk_toast(**attrs, &block)
6
+ render(Toast.new(**attrs), &block)
7
+ end
8
+
9
+ def nk_toast_action(title: nil, description: nil, event: nil)
10
+ {
11
+ action: "#{event ? "#{event}->" : ""}nk--toast#toast",
12
+ nk__toast_title_param: title,
13
+ nk__toast_description_param: description
14
+ }
15
+ end
16
+
17
+ def nk_toast_flash_messages
18
+ capture do
19
+ flash.each do |severity, message|
20
+ concat(
21
+ render(
22
+ Toast::Item.new(
23
+ description: message,
24
+ variant: severity.to_sym == :alert ? :error : :default
25
+ )
26
+ )
27
+ )
28
+ end
29
+ end
30
+ end
31
+
32
+ def nk_toast_turbo_stream_refresh
33
+ turbo_stream.append("nk--toast-sink", nk_toast_flash_messages)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NitroKit
4
+ module TooltipHelper
5
+ def nk_tooltip(**attrs, &block)
6
+ render(Tooltip.new(**attrs), &block)
7
+ end
8
+ end
9
+ end
@@ -1,87 +1,84 @@
1
- require "nitro_kit/schema_builder"
2
-
3
1
  module NitroKit
4
2
  class AddGenerator < Rails::Generators::Base
5
3
  argument :component_names, type: :array
6
4
 
7
- source_root File.expand_path("../../../", __dir__)
8
-
9
- extend SchemaBuilder
10
-
11
- SCHEMA = build_schema do |s|
12
- s.add(:badge)
13
- s.add(
14
- :button,
15
- components: [:button, :button_group],
16
- helpers: [:button, :button_group]
17
- )
18
- s.add(
19
- :dropdown,
20
- js: [:dropdown],
21
- modules: ["@floating-ui/core", "@floating-ui/dom"]
22
- )
23
- s.add(
24
- :icon,
25
- gems: ["lucide-rails"]
26
- )
27
- end
5
+ source_root File.expand_path("../../../", __dir__).tap { |path| puts path }
28
6
 
29
7
  def copy_base_component
30
8
  copy_file("app/components/nitro_kit/component.rb", "app/components/nitro_kit/component.rb")
31
9
  end
32
10
 
33
11
  def copy_component_files
34
- components.each do |component|
35
- component.files.each do |path|
36
- copy_file(path, path)
37
- end
12
+ components.map(&:all_files).flatten.uniq.each do |path|
13
+ copy_file(path, path)
38
14
  end
39
15
  end
40
16
 
41
17
  def add_gems
42
- gems = components.flat_map(&:gems)
18
+ gems = components.flat_map(&:all_gems)
43
19
 
44
20
  return unless gems.any?
45
21
 
46
22
  gems.each do |name|
47
- gem(name)
23
+ gem(name) unless has_gem?(name)
48
24
  end
49
25
 
50
26
  run("bundle install")
51
27
  end
52
28
 
53
29
  def install_modules
54
- modules = components.flat_map(&:modules)
30
+ modules = components.flat_map(&:all_modules).uniq
55
31
 
56
32
  return unless modules.any?
57
33
 
58
- if importmaps?
34
+ case js_strategy
35
+ when :importmaps
59
36
  run("bin/importmap pin #{modules.join(" ")}")
37
+ when :yarn
38
+ run("yarn add #{modules.join(" ")}")
39
+ when :npm
40
+ run("npm install --save #{modules.join(" ")}")
41
+ when :bun
42
+ run("bun add #{modules.join(" ")}")
60
43
  else
61
- say("oh hai npm/yarn/bun")
44
+ say("Could not determine JS strategy. Please install one of: npm, yarn, bun, or importmaps")
62
45
  end
63
46
  end
64
47
 
65
48
  private
66
49
 
67
50
  def components
68
- list = component_names
51
+ return @components if @components
69
52
 
70
- if list == ["all"]
71
- list = SCHEMA.all
53
+ if component_names == ["all"]
54
+ return @components = SCHEMA.all
72
55
  end
73
56
 
74
- list.map do |name|
75
- unless component = SCHEMA[name.to_sym]
76
- raise "Unknown component `#{name}'"
57
+ # Component names + their dependencies
58
+ @components = component_names
59
+ .flat_map do |name|
60
+ component = SCHEMA.find(name)
61
+ [component] + component.dependencies
77
62
  end
63
+ end
78
64
 
79
- component
65
+ def js_strategy
66
+ if File.exist?(File.expand_path("bin/importmap", Rails.root))
67
+ :importmaps
68
+ elsif File.exist?(File.expand_path("yarn.lock", Rails.root))
69
+ :yarn
70
+ elsif File.exist?(File.expand_path("package-lock.json", Rails.root))
71
+ :npm
72
+ elsif File.exist?(File.expand_path("bun.lockb", Rails.root))
73
+ :bun
74
+ else
75
+ nil
80
76
  end
81
77
  end
82
78
 
83
- def importmaps?
84
- File.exist?(File.expand_path("bin/importmap", Rails.root))
79
+ def has_gem?(name)
80
+ gemfile = File.read(File.expand_path("Gemfile", Rails.root))
81
+ gemfile.include?("gem '#{name}'") || gemfile.include?("gem \"#{name}\"")
85
82
  end
86
83
  end
87
84
  end
@@ -2,7 +2,8 @@ module NitroKit
2
2
  module Generators
3
3
  class InstallGenerator < Rails::Generators::Base
4
4
  def one
5
- puts("hi")
5
+ puts("Maybe, maybe not. Seems complex. Maybe only support greenfield apps?")
6
+ puts("Manual instructions: https://nitrokit.dev/getting_started")
6
7
  end
7
8
  end
8
9
  end
@@ -0,0 +1,4 @@
1
+ module NitroKit
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -1,15 +1,69 @@
1
1
  module NitroKit
2
2
  module SchemaBuilder
3
- Component = Struct.new(:files, :modules, :gems)
3
+ class Component
4
+ def initialize(schema, name, dependencies:, files:, modules:, gems:)
5
+ @schema = schema
6
+ @name = name
7
+ @unresolved_dependencies = dependencies
8
+ @files = files
9
+ @modules = modules
10
+ @gems = gems
11
+ @resolved = false
12
+ end
13
+
14
+ attr_reader :name, :files, :modules, :gems, :unresolved_dependencies
15
+
16
+ def dependencies
17
+ raise "Component not resolved" unless resolved?
18
+ @dependencies
19
+ end
20
+
21
+ def resolve!
22
+ raise "Component already resolved" if resolved?
23
+
24
+ @dependencies = @unresolved_dependencies
25
+ .each_with_object(Set.new) do |name, list|
26
+ list.add(name)
27
+ list.merge(@schema.find(name).unresolved_dependencies)
28
+ end
29
+ .map { |name| @schema.find(name) }
30
+
31
+ @resolved = true
32
+ end
33
+
34
+ def resolved?
35
+ @resolved
36
+ end
37
+
38
+ def all_files
39
+ (files + dependencies.flat_map(&:files)).sort
40
+ end
41
+
42
+ def all_modules
43
+ (modules + dependencies.flat_map(&:modules)).sort
44
+ end
4
45
 
5
- class Builder
46
+ def all_gems
47
+ (gems + dependencies.flat_map(&:gems)).sort
48
+ end
49
+
50
+ def has_dependencies?
51
+ return true if gems.any?
52
+ return true if modules.any?
53
+ false
54
+ end
55
+ end
56
+
57
+ class Schema
6
58
  def initialize
7
- @schema = {}
59
+ @schema = []
8
60
  yield self
61
+ resolve!
9
62
  end
10
63
 
11
64
  def add(
12
65
  name,
66
+ dependencies = [],
13
67
  components: nil,
14
68
  helpers: nil,
15
69
  js: [],
@@ -20,28 +74,48 @@ module NitroKit
20
74
  components ||= [name]
21
75
  helpers ||= [name]
22
76
 
23
- @schema[name] = Component.new(
24
- [
25
- components.map { |c| "app/components/nitro_kit/#{c}.rb" },
26
- helpers.map { |c| "app/helpers/nitro_kit/#{c}_helper.rb" },
27
- js.map { |c| "app/javascript/controllers/nk/#{c}_controller.js" }
28
- ].flatten,
29
- modules,
30
- gems
77
+ files = [
78
+ components.map { |c| "app/components/nitro_kit/#{c}.rb" },
79
+ helpers.map { |c| "app/helpers/nitro_kit/#{c}_helper.rb" },
80
+ js.map { |c| "app/javascript/controllers/nk/#{c}_controller.js" }
81
+ ].flatten
82
+
83
+ component = Component.new(
84
+ self,
85
+ name,
86
+ dependencies:,
87
+ files:,
88
+ modules:,
89
+ gems:
31
90
  )
32
- end
33
91
 
34
- def [](key)
35
- @schema[key]
92
+ @schema.push(component)
36
93
  end
37
94
 
38
95
  def all
39
- @schema.keys.map(&:to_s)
96
+ @schema
97
+ end
98
+
99
+ def find(name)
100
+ component = @schema.find { |c| c.name == name.to_sym }
101
+ raise "Component not found: #{name}" unless component
102
+ component
103
+ end
104
+
105
+ def resolved?
106
+ @resolved
107
+ end
108
+
109
+ private
110
+
111
+ def resolve!
112
+ all.each(&:resolve!)
113
+ @resolved = true
40
114
  end
41
115
  end
42
116
 
43
117
  def build_schema(&block)
44
- Builder.new(&block)
118
+ Schema.new(&block)
45
119
  end
46
120
  end
47
121
  end
@@ -1,3 +1,3 @@
1
1
  module NitroKit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/nitro_kit.rb CHANGED
@@ -1,8 +1,46 @@
1
1
  require "tailwind_merge"
2
2
  require "phlex/rails"
3
3
 
4
+ require "nitro_kit/version"
5
+ require "nitro_kit/engine"
4
6
  require "nitro_kit/variants"
5
- require "nitro_kit/railtie"
7
+ require "nitro_kit/schema_builder"
6
8
 
7
9
  module NitroKit
10
+ extend SchemaBuilder
11
+
12
+ SCHEMA = build_schema do |s|
13
+ s.add(:accordion, js: [:accordion])
14
+ s.add(:alert)
15
+ s.add(:avatar)
16
+ s.add(:badge)
17
+ s.add(:button, [:icon], components: [:button, :button_group], helpers: [:button, :button_group])
18
+ s.add(:card)
19
+ s.add(:checkbox, [:label], components: [:checkbox, :checkbox_group])
20
+ s.add(
21
+ :combobox,
22
+ [:input],
23
+ js: [:combobox],
24
+ modules: ["@floating-ui/core", "@floating-ui/dom", "@github/combobox-nav"]
25
+ )
26
+ s.add(:datepicker)
27
+ s.add(:dialog, [:button, :icon], js: [:dialog])
28
+ s.add(:dropdown, [:button], js: [:dropdown], modules: ["@floating-ui/core", "@floating-ui/dom"])
29
+ s.add(:field, [:label, :checkbox, :combobox, :label, :radio_button, :select, :switch, :textarea])
30
+ s.add(:field_group)
31
+ s.add(:fieldset, [:field_group])
32
+ s.add(:form_builder, [:field], helpers: [:form])
33
+ s.add(:icon, gems: ["lucide-rails"])
34
+ s.add(:input)
35
+ s.add(:label)
36
+ s.add(:pagination, [:icon, :button])
37
+ s.add(:radio_button, [:label], components: [:radio_button, :radio_button_group])
38
+ s.add(:select)
39
+ s.add(:switch, js: [:switch])
40
+ s.add(:table)
41
+ s.add(:tabs, js: [:tabs])
42
+ s.add(:textarea)
43
+ s.add(:toast, js: [:toast])
44
+ s.add(:tooltip, js: [:tooltip], modules: ["@floating-ui/core", "@floating-ui/dom"])
45
+ end
8
46
  end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :nitro_kit do
3
+ # # Task goes here
4
+ # end
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nitro_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Malmberg
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-07 00:00:00.000000000 Z
10
+ date: 2025-02-07 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: activesupport
13
+ name: rails
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
@@ -30,14 +29,14 @@ dependencies:
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: '0'
32
+ version: 0.13.0
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: '0'
39
+ version: 0.13.0
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: phlex-rails
43
42
  requirement: !ruby/object:Gem::Requirement
@@ -59,45 +58,76 @@ executables: []
59
58
  extensions: []
60
59
  extra_rdoc_files: []
61
60
  files:
61
+ - MIT-LICENSE
62
62
  - README.md
63
63
  - Rakefile
64
64
  - app/components/nitro_kit/accordion.rb
65
+ - app/components/nitro_kit/alert.rb
66
+ - app/components/nitro_kit/avatar.rb
65
67
  - app/components/nitro_kit/badge.rb
66
68
  - app/components/nitro_kit/button.rb
67
69
  - app/components/nitro_kit/button_group.rb
68
70
  - app/components/nitro_kit/card.rb
69
71
  - app/components/nitro_kit/checkbox.rb
72
+ - app/components/nitro_kit/checkbox_group.rb
73
+ - app/components/nitro_kit/combobox.rb
70
74
  - app/components/nitro_kit/component.rb
75
+ - app/components/nitro_kit/datepicker.rb
76
+ - app/components/nitro_kit/dialog.rb
71
77
  - app/components/nitro_kit/dropdown.rb
72
78
  - app/components/nitro_kit/field.rb
73
79
  - app/components/nitro_kit/field_group.rb
74
80
  - app/components/nitro_kit/fieldset.rb
75
81
  - app/components/nitro_kit/form_builder.rb
76
82
  - app/components/nitro_kit/icon.rb
83
+ - app/components/nitro_kit/input.rb
77
84
  - app/components/nitro_kit/label.rb
85
+ - app/components/nitro_kit/pagination.rb
78
86
  - app/components/nitro_kit/radio_button.rb
79
- - app/components/nitro_kit/radio_group.rb
87
+ - app/components/nitro_kit/radio_button_group.rb
88
+ - app/components/nitro_kit/select.rb
80
89
  - app/components/nitro_kit/switch.rb
81
- - app/helpers/application_helper.rb
90
+ - app/components/nitro_kit/table.rb
91
+ - app/components/nitro_kit/tabs.rb
92
+ - app/components/nitro_kit/textarea.rb
93
+ - app/components/nitro_kit/toast.rb
94
+ - app/components/nitro_kit/tooltip.rb
82
95
  - app/helpers/nitro_kit/accordion_helper.rb
96
+ - app/helpers/nitro_kit/alert_helper.rb
97
+ - app/helpers/nitro_kit/avatar_helper.rb
83
98
  - app/helpers/nitro_kit/badge_helper.rb
84
99
  - app/helpers/nitro_kit/button_group_helper.rb
85
100
  - app/helpers/nitro_kit/button_helper.rb
86
101
  - app/helpers/nitro_kit/card_helper.rb
87
102
  - app/helpers/nitro_kit/checkbox_helper.rb
103
+ - app/helpers/nitro_kit/combobox_helper.rb
104
+ - app/helpers/nitro_kit/datepicker_helper.rb
105
+ - app/helpers/nitro_kit/dialog_helper.rb
88
106
  - app/helpers/nitro_kit/dropdown_helper.rb
107
+ - app/helpers/nitro_kit/field_group_helper.rb
89
108
  - app/helpers/nitro_kit/field_helper.rb
109
+ - app/helpers/nitro_kit/fieldset_helper.rb
110
+ - app/helpers/nitro_kit/form_helper.rb
90
111
  - app/helpers/nitro_kit/icon_helper.rb
112
+ - app/helpers/nitro_kit/input_helper.rb
91
113
  - app/helpers/nitro_kit/label_helper.rb
114
+ - app/helpers/nitro_kit/pagination_helper.rb
92
115
  - app/helpers/nitro_kit/radio_button_helper.rb
116
+ - app/helpers/nitro_kit/select_helper.rb
93
117
  - app/helpers/nitro_kit/switch_helper.rb
118
+ - app/helpers/nitro_kit/table_helper.rb
119
+ - app/helpers/nitro_kit/tabs_helper.rb
120
+ - app/helpers/nitro_kit/textarea_helper.rb
121
+ - app/helpers/nitro_kit/toast_helper.rb
122
+ - app/helpers/nitro_kit/tooltip_helper.rb
94
123
  - lib/generators/nitro_kit/add_generator.rb
95
124
  - lib/generators/nitro_kit/install_generator.rb
96
125
  - lib/nitro_kit.rb
97
- - lib/nitro_kit/railtie.rb
126
+ - lib/nitro_kit/engine.rb
98
127
  - lib/nitro_kit/schema_builder.rb
99
128
  - lib/nitro_kit/variants.rb
100
129
  - lib/nitro_kit/version.rb
130
+ - lib/tasks/nitro_kit_tasks.rake
101
131
  homepage: https://github.com/mikker/nitro_kit
102
132
  licenses:
103
133
  - MIT
@@ -105,7 +135,6 @@ metadata:
105
135
  homepage_uri: https://github.com/mikker/nitro_kit
106
136
  source_code_uri: https://github.com/mikker/nitro_kit
107
137
  changelog_uri: https://github.com/mikker/nitro_kit/releases
108
- post_install_message:
109
138
  rdoc_options: []
110
139
  require_paths:
111
140
  - lib
@@ -120,8 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
149
  - !ruby/object:Gem::Version
121
150
  version: '0'
122
151
  requirements: []
123
- rubygems_version: 3.5.23
124
- signing_key:
152
+ rubygems_version: 3.6.3
125
153
  specification_version: 4
126
154
  summary: WIP, not usable yet
127
155
  test_files: []
@@ -1,35 +0,0 @@
1
- module NitroKit
2
- class RadioGroup < Component
3
- include ActionView::Helpers::FormTagHelper
4
-
5
- def initialize(name, value: nil, **options)
6
- super(**options)
7
- @name = name
8
- @group_value = value
9
- end
10
-
11
- attr_reader :name, :id, :group_value
12
-
13
- def view_template
14
- div(class: "flex items-start flex-col gap-2") do
15
- yield
16
- end
17
- end
18
-
19
- def title(text = nil, **options)
20
- render(Label.new(**options)) { text || yield }
21
- end
22
-
23
- def item(value, text = nil, **options)
24
- render(
25
- RadioButton.new(
26
- name,
27
- id:,
28
- value:,
29
- checked: group_value.presence == value,
30
- **options
31
- )
32
- ) { text || yield }
33
- end
34
- end
35
- end