loco_motion-rails 0.0.7 → 0.0.8

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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +45 -1
  3. data/app/components/daisy/actions/button_component.rb +109 -8
  4. data/app/components/daisy/actions/dropdown_component.html.haml +5 -5
  5. data/app/components/daisy/actions/dropdown_component.rb +94 -25
  6. data/app/components/daisy/actions/modal_component.html.haml +3 -2
  7. data/app/components/daisy/actions/modal_component.rb +94 -45
  8. data/app/components/daisy/actions/swap_component.rb +114 -5
  9. data/app/components/daisy/actions/theme_controller_component.html.haml +1 -1
  10. data/app/components/daisy/actions/theme_controller_component.rb +36 -1
  11. data/app/components/daisy/data_display/accordion_component.rb +79 -3
  12. data/app/components/daisy/data_display/avatar_component.rb +36 -16
  13. data/app/components/daisy/data_display/badge_component.rb +35 -5
  14. data/app/components/daisy/data_display/card_component.html.haml +5 -13
  15. data/app/components/daisy/data_display/card_component.rb +74 -39
  16. data/app/components/daisy/data_display/carousel_component.rb +38 -0
  17. data/app/components/daisy/data_display/chat_component.rb +40 -10
  18. data/app/components/daisy/data_display/collapse_component.rb +58 -1
  19. data/app/components/daisy/data_display/countdown_component.rb +49 -0
  20. data/app/components/daisy/data_display/diff_component.rb +37 -0
  21. data/app/components/daisy/data_display/figure_component.rb +49 -0
  22. data/app/components/daisy/data_display/kbd_component.rb +50 -2
  23. data/app/components/daisy/data_display/stat_component.rb +64 -6
  24. data/app/components/daisy/data_display/table_component.rb +99 -34
  25. data/app/components/daisy/data_display/timeline_component.rb +45 -0
  26. data/app/components/daisy/data_display/timeline_event_component.rb +39 -1
  27. data/app/components/daisy/feedback/alert_component.rb +46 -1
  28. data/app/components/daisy/feedback/loading_component.rb +39 -0
  29. data/app/components/daisy/feedback/progress_component.rb +39 -1
  30. data/app/components/daisy/feedback/radial_progress_component.rb +44 -1
  31. data/app/components/daisy/feedback/skeleton_component.rb +44 -0
  32. data/app/components/daisy/feedback/toast_component.rb +36 -0
  33. data/app/components/daisy/feedback/tooltip_component.rb +46 -10
  34. data/app/components/daisy/layout/artboard_component.rb +48 -0
  35. data/app/components/daisy/layout/divider_component.rb +50 -10
  36. data/app/components/daisy/layout/drawer_component.rb +62 -17
  37. data/app/components/daisy/layout/footer_component.rb +51 -11
  38. data/app/components/daisy/layout/hero_component.rb +67 -5
  39. data/app/components/daisy/layout/indicator_component.rb +55 -8
  40. data/app/components/daisy/layout/join_component.rb +71 -0
  41. data/app/components/daisy/layout/stack_component.rb +59 -0
  42. data/app/components/daisy/mockup/browser_component.rb +78 -0
  43. data/app/components/daisy/mockup/code_component.rb +144 -0
  44. data/app/components/daisy/mockup/device_component.rb +81 -0
  45. data/app/components/daisy/mockup/frame_component.rb +62 -0
  46. data/app/components/daisy/navigation/bottom_nav_component.rb +81 -2
  47. data/app/components/daisy/navigation/breadcrumbs_component.rb +40 -3
  48. data/app/components/daisy/navigation/link_component.rb +31 -6
  49. data/app/components/daisy/navigation/menu_component.rb +52 -20
  50. data/app/components/daisy/navigation/navbar_component.html.haml +1 -1
  51. data/app/components/daisy/navigation/navbar_component.rb +63 -2
  52. data/app/components/daisy/navigation/steps_component.rb +76 -0
  53. data/app/components/daisy/navigation/tabs_component.rb +110 -7
  54. data/app/components/hero/icon_component.rb +40 -0
  55. data/lib/daisy.rb +5 -0
  56. data/lib/loco_motion/helpers.rb +7 -0
  57. data/lib/loco_motion/version.rb +5 -0
  58. metadata +25 -5
@@ -1,18 +1,103 @@
1
- # This is the Tabs component.
1
+ #
2
+ # Creates a tabbed navigation component that can be used either as links or radio
3
+ # buttons with associated content.
4
+ #
5
+ # @note When using radio button tabs, the titles must be simple strings and cannot
6
+ # contain HTML elements or icons.
7
+ #
8
+ # @slot tabs+ {Daisy::Navigation::TabsComponent::TabComponent} The individual
9
+ # tabs to display.
10
+ #
11
+ # @example Basic tabs with links
12
+ # = daisy_tabs(css: "tabs-bordered") do |tabs|
13
+ # - tabs.with_tab(title: "Home", active: true)
14
+ # - tabs.with_tab(title: "Click Me", html: { onclick: "alert('Clicked!')" })
15
+ # - tabs.with_tab(title: "Google", href: "https://google.com", target: "_blank")
16
+ #
17
+ # @example Radio button tabs with content
18
+ # = daisy_tabs(css: "tabs-lifted", radio: true) do |tabs|
19
+ # - tabs.with_tab(title: "Tab 1", checked: true) do
20
+ # %p Tab 1 content
21
+ # - tabs.with_tab(title: "Tab 2") do
22
+ # %p Tab 2 content
23
+ #
24
+ # @example Tabs with custom titles and content
25
+ # = daisy_tabs(css: "tabs-lifted") do |tabs|
26
+ # - tabs.with_tab do |tab|
27
+ # - tab.with_title do
28
+ # .flex.gap-2
29
+ # = hero_icon("home")
30
+ # Home
31
+ # - tab.with_custom_content(css: "tab-content p-4") do
32
+ # %p Welcome home!
33
+ #
2
34
  class Daisy::Navigation::TabsComponent < LocoMotion::BaseComponent
3
35
 
36
+ #
37
+ # A tab within a TabsComponent that can be either a link or a radio button.
38
+ #
39
+ # @part content_wrapper The wrapper for the tab's content when not using
40
+ # custom content.
41
+ #
42
+ # @slot title The title content for the tab. Only used if no `title` option
43
+ # is provided.
44
+ #
45
+ # @slot custom_content Custom content to be rendered after the tab. Use this
46
+ # instead of the block content for complete control over the content's HTML.
47
+ #
48
+ # @example Basic tab with title
49
+ # = tabs.with_tab(title: "Home")
50
+ #
51
+ # @example Tab with custom title
52
+ # = tabs.with_tab do |tab|
53
+ # - tab.with_title do
54
+ # .flex.gap-2
55
+ # = hero_icon("home")
56
+ # Home
57
+ #
58
+ # @example Tab with content
59
+ # = tabs.with_tab(title: "Content") do
60
+ # %p This is the tab's content
61
+ #
62
+ # @example Tab with custom content
63
+ # = tabs.with_tab do |tab|
64
+ # - tab.with_custom_content(css: "tab-content p-4") do
65
+ # %p Custom content with custom wrapper
66
+ #
4
67
  class TabComponent < LocoMotion::BasicComponent
5
68
  define_parts :content_wrapper
6
69
 
7
70
  renders_one :title
8
71
  renders_one :custom_content
9
72
 
10
- attr_reader :active
11
-
12
- # @return [String] Accessor for the `title` string passed via the component
13
- # config.
14
- attr_reader :simple_title
15
-
73
+ attr_reader :active, :simple_title
74
+
75
+ # Create a new instance of the TabComponent.
76
+ #
77
+ # @param args [Array] Not used.
78
+ #
79
+ # @param kws [Hash] The keyword arguments for the component.
80
+ #
81
+ # @option kws title [String] The text to display in the tab.
82
+ #
83
+ # @option kws active [Boolean] Whether this tab is active (default: false).
84
+ #
85
+ # @option kws checked [Boolean] Whether this tab is checked (default: false).
86
+ #
87
+ # @option kws disabled [Boolean] Whether this tab is disabled (default: false).
88
+ #
89
+ # @option kws href [String] The URL to visit when the tab is clicked.
90
+ #
91
+ # @option kws target [String] The target attribute for the tab (e.g., "_blank").
92
+ #
93
+ # @option kws value [String] The value attribute when using radio buttons.
94
+ #
95
+ # @option kws css [String] Additional CSS classes for styling. Common
96
+ # options include:
97
+ # - Size: `tab-lg`, `tab-md`, `tab-sm`, `tab-xs`
98
+ # - Width: `w-full`, `!w-14`
99
+ # - Cursor: `cursor-pointer`, `!cursor-auto`
100
+ #
16
101
  def initialize(*args, **kws, &block)
17
102
  super
18
103
 
@@ -88,6 +173,24 @@ class Daisy::Navigation::TabsComponent < LocoMotion::BaseComponent
88
173
 
89
174
  attr_reader :name, :radio
90
175
 
176
+ # Create a new instance of the TabsComponent.
177
+ #
178
+ # @param args [Array] Not used.
179
+ #
180
+ # @param kws [Hash] The keyword arguments for the component.
181
+ #
182
+ # @option kws name [String] The name attribute for radio button tabs
183
+ # (default: auto-generated UUID).
184
+ #
185
+ # @option kws radio [Boolean] Whether to use radio buttons instead of links
186
+ # (default: false).
187
+ #
188
+ # @option kws css [String] Additional CSS classes for styling. Common
189
+ # options include:
190
+ # - Style: `tabs-bordered`, `tabs-lifted`
191
+ # - Size: `tabs-lg`, `tabs-md`, `tabs-sm`, `tabs-xs`
192
+ # - Width: `w-full`, `w-[500px]`
193
+ #
91
194
  def initialize(*args, **kws, &block)
92
195
  super
93
196
 
@@ -1,6 +1,46 @@
1
+ #
2
+ # Creates an icon component using Heroicons, a set of free, MIT-licensed
3
+ # high-quality SVG icons. For a complete list of available icons, visit
4
+ # https://heroicons.com.
5
+ #
6
+ # @note By default, icons are displayed with the `size-5` Tailwind class. This
7
+ # can be overridden without using the `!` modifier because we utilize the
8
+ # `:where()` pseudo-class to ensure our default classes have the lowest CSS
9
+ # specificity.
10
+ #
11
+ # @example Basic icon usage
12
+ # = hero_icon("academic-cap")
13
+ # = hero_icon(icon: "adjustments-horizontal")
14
+ # %span.text-blue-500
15
+ # = hero_icon("archive-box")
16
+ #
17
+ # @example Customized icons
18
+ # = hero_icon("no-symbol", css: "size-4 text-red-600")
19
+ # = hero_icon("arrow-trending-up", css: "size-10 text-green-600")
20
+ # = hero_icon("exclamation-triangle", css: "size-14 text-yellow-400 animate-pulse")
21
+ #
1
22
  class Hero::IconComponent < LocoMotion::BaseComponent
2
23
  prepend LocoMotion::Concerns::TippableComponent
3
24
 
25
+ # Create a new instance of the IconComponent.
26
+ #
27
+ # @param args [Array] If provided, the first argument is considered the
28
+ # `icon` name.
29
+ #
30
+ # @param kws [Hash] The keyword arguments for the component.
31
+ #
32
+ # @option kws icon [String] The name of the icon to display. See
33
+ # https://heroicons.com for available icons.
34
+ #
35
+ # @option kws variant [Symbol] The variant of the icon to use
36
+ # (default: :outline).
37
+ #
38
+ # @option kws css [String] Additional CSS classes for styling. Common
39
+ # options include:
40
+ # - Size: `size-4`, `size-10`, `size-14`
41
+ # - Color: `text-red-600`, `text-green-600`, `text-yellow-400`
42
+ # - Animation: `animate-pulse`, `animate-spin`
43
+ #
4
44
  def initialize(*args, **kws, &block)
5
45
  super
6
46
 
data/lib/daisy.rb CHANGED
@@ -26,4 +26,9 @@ module Daisy
26
26
  # Holds all Layout-type components.
27
27
  #
28
28
  module Layout; end
29
+
30
+ #
31
+ # Holds all Mockup-type components.
32
+ #
33
+ module Mockup; end
29
34
  end
@@ -23,6 +23,7 @@ module LocoMotion
23
23
  "Daisy::DataDisplay::CollapseComponent" => { names: "collapse", group: "Data", title: "Collapses", example: "collapses" },
24
24
  "Daisy::DataDisplay::CountdownComponent" => { names: "countdown", group: "Data", title: "Countdowns", example: "countdowns" },
25
25
  "Daisy::DataDisplay::DiffComponent" => { names: "diff", group: "Data", title: "Diffs", example: "diffs" },
26
+ "Daisy::DataDisplay::FigureComponent" => { names: "figure", group: "Data", title: "Figures", example: "figures" },
26
27
  "Daisy::DataDisplay::KbdComponent" => { names: "kbd", group: "Data", title: "Keyboard (KBD)", example: "kbds" },
27
28
  "Daisy::DataDisplay::StatComponent" => { names: "stat", group: "Data", title: "Stats", example: "stats" },
28
29
  "Daisy::DataDisplay::TableComponent" => { names: "table", group: "Data", title: "Tables", example: "tables" },
@@ -57,6 +58,12 @@ module LocoMotion
57
58
  "Daisy::Layout::JoinComponent" => { names: "join", group: "Layout", title: "Joins", example: "joins" },
58
59
  "Daisy::Layout::MaskComponent" => { names: nil, group: "Layout", title: "Masks", example: "masks" },
59
60
  "Daisy::Layout::StackComponent" => { names: "stack", group: "Layout", title: "Stacks", example: "stacks" },
61
+
62
+ # Mockup
63
+ "Daisy::Mockup::BrowserComponent" => { names: "browser", group: "Mockup", title: "Browsers", example: "browsers" },
64
+ "Daisy::Mockup::CodeComponent" => { names: "code", group: "Mockup", title: "Code Blocks", example: "code_blocks" },
65
+ "Daisy::Mockup::DeviceComponent" => { names: "device", group: "Mockup", title: "Devices", example: "devices" },
66
+ "Daisy::Mockup::FrameComponent" => { names: "frame", group: "Mockup", title: "Frames", example: "frames" },
60
67
  }
61
68
 
62
69
  module Helpers
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LocoMotion
4
+ VERSION = "0.0.8"
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loco_motion-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topher Fangio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-19 00:00:00.000000000 Z
11
+ date: 2025-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml-rails
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '6.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '6.1'
55
55
  - !ruby/object:Gem::Dependency
@@ -220,6 +220,20 @@ dependencies:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
222
  version: '1.2'
223
+ - !ruby/object:Gem::Dependency
224
+ name: pry
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: 0.15.0
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: 0.15.0
223
237
  - !ruby/object:Gem::Dependency
224
238
  name: rails
225
239
  requirement: !ruby/object:Gem::Requirement
@@ -360,6 +374,7 @@ files:
360
374
  - app/components/daisy/data_display/countdown_controller.js
361
375
  - app/components/daisy/data_display/diff_component.html.haml
362
376
  - app/components/daisy/data_display/diff_component.rb
377
+ - app/components/daisy/data_display/figure_component.rb
363
378
  - app/components/daisy/data_display/kbd_component.rb
364
379
  - app/components/daisy/data_display/stat_component.html.haml
365
380
  - app/components/daisy/data_display/stat_component.rb
@@ -387,6 +402,10 @@ files:
387
402
  - app/components/daisy/layout/indicator_component.rb
388
403
  - app/components/daisy/layout/join_component.rb
389
404
  - app/components/daisy/layout/stack_component.rb
405
+ - app/components/daisy/mockup/browser_component.rb
406
+ - app/components/daisy/mockup/code_component.rb
407
+ - app/components/daisy/mockup/device_component.rb
408
+ - app/components/daisy/mockup/frame_component.rb
390
409
  - app/components/daisy/navigation/bottom_nav_component.rb
391
410
  - app/components/daisy/navigation/breadcrumbs_component.html.haml
392
411
  - app/components/daisy/navigation/breadcrumbs_component.rb
@@ -410,6 +429,7 @@ files:
410
429
  - lib/loco_motion/engine.rb
411
430
  - lib/loco_motion/errors.rb
412
431
  - lib/loco_motion/helpers.rb
432
+ - lib/loco_motion/version.rb
413
433
  homepage: https://rubygems.org/gems/loco_motion-rails
414
434
  licenses:
415
435
  - MIT
@@ -423,7 +443,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
423
443
  requirements:
424
444
  - - ">="
425
445
  - !ruby/object:Gem::Version
426
- version: '0'
446
+ version: '3.0'
427
447
  required_rubygems_version: !ruby/object:Gem::Requirement
428
448
  requirements:
429
449
  - - ">="