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
@@ -0,0 +1,81 @@
1
+ #
2
+ # The DeviceComponent creates realistic device mockups for showcasing mobile
3
+ # and tablet applications. Common use cases include:
4
+ # - Displaying mobile app screenshots.
5
+ # - Creating marketing materials.
6
+ # - Demonstrating responsive designs.
7
+ # - Building portfolio pieces.
8
+ #
9
+ # The component includes an optional camera element and a display area that
10
+ # can contain any content, typically an ArtboardComponent for proper sizing.
11
+ #
12
+ # @part camera The device's camera element, shown at the top by default.
13
+ # @part display The main display area of the device.
14
+ #
15
+ # @loco_example Phone with Camera
16
+ # = daisy_device(css: "mockup-phone") do
17
+ # = daisy_artboard(css: "phone-2") do
18
+ # .flex.flex-col.p-4
19
+ # .text-2xl.font-bold
20
+ # My App
21
+ # = image_tag("screenshot.jpg",
22
+ # class: "rounded-lg")
23
+ #
24
+ # @loco_example Tablet without Camera
25
+ # = daisy_device(css: "mockup-phone border-primary",
26
+ # show_camera: false) do
27
+ # = daisy_artboard(css: "artboard-horizontal phone-3") do
28
+ # .bg-base-100.p-4
29
+ # Tablet Content Here
30
+ #
31
+ # @loco_example Styled Device
32
+ # = daisy_device(css: "mockup-phone border-4
33
+ # border-accent shadow-xl") do
34
+ # = daisy_artboard(css: "phone-1") do
35
+ # .bg-gradient-to-br.from-primary.to-accent.p-4
36
+ # Premium App Design
37
+ #
38
+ class Daisy::Mockup::DeviceComponent < LocoMotion::BaseComponent
39
+
40
+ define_parts :camera, :display
41
+
42
+ #
43
+ # Creates a new Device component.
44
+ #
45
+ # @option kws show_camera [Boolean] Whether to show the camera element
46
+ # (default: true).
47
+ # @option kws css [String] Additional CSS classes for styling. Common
48
+ # options include:
49
+ # - Type: `mockup-phone`
50
+ # - Border: `border-2`, `border-primary`
51
+ # - Shadow: `shadow-lg`, `shadow-xl`
52
+ #
53
+ def initialize(**kws)
54
+ super(**kws)
55
+
56
+ @show_camera = config_option(:show_camera, true)
57
+ end
58
+
59
+ #
60
+ # Sets up the component's CSS classes.
61
+ #
62
+ def before_render
63
+ add_css(:camera, "camera")
64
+ add_css(:display, "display")
65
+ add_css(:display, "!mt-0") if !@show_camera
66
+ end
67
+
68
+ #
69
+ # Renders the device with its camera (if enabled) and display content.
70
+ #
71
+ def call
72
+ part(:component) do
73
+ concat(part(:camera)) if @show_camera
74
+
75
+ concat(part(:display) do
76
+ content
77
+ end)
78
+ end
79
+ end
80
+
81
+ end
@@ -0,0 +1,62 @@
1
+ #
2
+ # The FrameComponent creates a simple window-like container for showcasing
3
+ # content. Similar to the BrowserComponent but without the toolbar, it's
4
+ # perfect for:
5
+ # - Displaying application screenshots.
6
+ # - Creating simple window mockups.
7
+ # - Framing content in presentations.
8
+ # - Building marketing materials.
9
+ #
10
+ # The component provides a clean, minimal window frame that can be styled
11
+ # to match your design needs.
12
+ #
13
+ # @loco_example Basic Frame
14
+ # = daisy_frame(css: "border border-base-300") do
15
+ # .border-t.border-base-300.p-4
16
+ # Window content here
17
+ #
18
+ # @loco_example Styled Frame
19
+ # = daisy_frame(css: "bg-primary border-2") do
20
+ # .bg-base-100.border-t.p-8.text-center
21
+ # = image_tag("logo.png",
22
+ # class: "max-w-xs mx-auto")
23
+ # %p.mt-4
24
+ # Professional window mockup
25
+ #
26
+ # @loco_example Image Frame
27
+ # = daisy_frame(css: "shadow-xl") do
28
+ # .p-0
29
+ # = image_tag("screenshot.jpg",
30
+ # class: "w-full")
31
+ #
32
+ class Daisy::Mockup::FrameComponent < LocoMotion::BaseComponent
33
+ #
34
+ # Creates a new Frame component.
35
+ #
36
+ # @option kws css [String] Additional CSS classes for styling. Common
37
+ # options include:
38
+ # - Size: `w-full`, `max-w-4xl`
39
+ # - Border: `border`, `border-primary`
40
+ # - Background: `bg-base-100`, `bg-primary`
41
+ # - Shadow: `shadow-lg`, `shadow-xl`
42
+ #
43
+ def initialize(**kws)
44
+ super(**kws)
45
+ end
46
+
47
+ #
48
+ # Sets up the component's CSS classes.
49
+ #
50
+ def before_render
51
+ add_css(:component, "mockup-window")
52
+ end
53
+
54
+ #
55
+ # Renders the frame with its content.
56
+ #
57
+ def call
58
+ part(:component) do
59
+ content
60
+ end
61
+ end
62
+ end
@@ -1,11 +1,76 @@
1
+ #
2
+ # Creates a bottom navigation bar, typically used in mobile-friendly applications
3
+ # to provide quick access to important sections.
4
+ #
5
+ # @slot sections+ {Daisy::Navigation::BottomNavSectionComponent} The sections to display in the navigation bar.
6
+ #
7
+ # @example Basic bottom nav with icons
8
+ # = daisy_bottom_nav do |nav|
9
+ # - nav.with_section(icon: "home", href: "#")
10
+ # - nav.with_section(icon: "information-circle", href: "#", active: true)
11
+ # - nav.with_section(icon: "chart-bar", href: "#")
12
+ #
13
+ # @example Bottom nav with titles
14
+ # = daisy_bottom_nav do |nav|
15
+ # - nav.with_section(icon: "home", href: "#", title: "Home")
16
+ # - nav.with_section(icon: "information-circle", href: "#", title: "Info")
17
+ # - nav.with_section(icon: "chart-bar", href: "#", title: "Stats")
18
+ #
19
+ # @example Colored bottom nav
20
+ # = daisy_bottom_nav do |nav|
21
+ # - nav.with_section(icon: "home", href: "#", css: "text-primary")
22
+ # - nav.with_section(icon: "information-circle", href: "#", css: "text-secondary")
23
+ # - nav.with_section(icon: "chart-bar", href: "#", css: "text-accent")
24
+ #
1
25
  class Daisy::Navigation::BottomNavComponent < LocoMotion::BaseComponent
2
26
 
27
+ #
28
+ # A section within a Bottom Navigation component.
29
+ #
30
+ # @part icon The icon element for the section.
31
+ # @part title The title element for the section.
32
+ #
33
+ # @example Basic section with icon
34
+ # = daisy_bottom_nav do |nav|
35
+ # - nav.with_section(icon: "home", href: "#")
36
+ #
37
+ # @example Active section with title
38
+ # = daisy_bottom_nav do |nav|
39
+ # - nav.with_section(icon: "information-circle", href: "#", active: true, title: "Info")
40
+ #
41
+ # @example Custom title content
42
+ # = daisy_bottom_nav do |nav|
43
+ # - nav.with_section(icon: "chart-bar", href: "#") do
44
+ # .font-bold.text-xs
45
+ # Stats
46
+ #
3
47
  class Daisy::Navigation::BottomNavSectionComponent < LocoMotion::BaseComponent
4
48
 
5
49
  define_parts :icon, :title
6
50
 
7
- def initialize(*args, **kws, &block)
8
- super
51
+ # Creates a new bottom navigation section.
52
+ #
53
+ # @param kws [Hash] The keyword arguments for the component.
54
+ #
55
+ # @option kws icon [String] The name of the icon to display.
56
+ #
57
+ # @option kws icon_variant [Symbol] The variant of the icon to use (default: :outline).
58
+ #
59
+ # @option kws icon_css [String] Additional CSS classes for the icon.
60
+ #
61
+ # @option kws title [String] Optional text to display below the icon.
62
+ #
63
+ # @option kws href [String] Optional URL to make the section a link.
64
+ #
65
+ # @option kws active [Boolean] Whether this section is currently active (default: false).
66
+ #
67
+ # @option kws css [String] Additional CSS classes for styling. Common
68
+ # options include:
69
+ # - Text color: `text-primary`, `text-secondary`, `text-accent`
70
+ # - Custom colors: `text-[#449944]`
71
+ #
72
+ def initialize(**kws)
73
+ super(**kws)
9
74
 
10
75
  @icon = config_option(:icon)
11
76
  @icon_variant = config_option(:icon_variant, :outline)
@@ -42,6 +107,20 @@ class Daisy::Navigation::BottomNavComponent < LocoMotion::BaseComponent
42
107
 
43
108
  renders_many :sections, Daisy::Navigation::BottomNavSectionComponent
44
109
 
110
+ # Creates a new bottom navigation component.
111
+ #
112
+ # @param kws [Hash] The keyword arguments for the component.
113
+ #
114
+ # @option kws css [String] Additional CSS classes for styling. Common
115
+ # options include:
116
+ # - Position: `relative`, `fixed bottom-0`
117
+ # - Width: `w-full`, `max-w-[400px]`
118
+ # - Border: `border`, `border-base-200`
119
+ #
120
+ def initialize(**kws)
121
+ super(**kws)
122
+ end
123
+
45
124
  def before_render
46
125
  add_css(:component, "btm-nav")
47
126
  end
@@ -1,15 +1,52 @@
1
+ #
2
+ # Creates a breadcrumb navigation component to show the user's location within
3
+ # a website or app.
4
+ #
5
+ # @part list_wrapper The unordered list element that wraps the breadcrumb items.
6
+ #
7
+ # @slot items+ {LocoMotion::BasicComponent} The individual breadcrumb items.
8
+ # Each item is rendered as a list item (`<li>`) element.
9
+ #
10
+ # @example Basic breadcrumbs with text
11
+ # = daisy_breadcrumbs do |breadcrumbs|
12
+ # - breadcrumbs.with_item do
13
+ # = link_to "Home", "#"
14
+ # - breadcrumbs.with_item do
15
+ # = link_to "Docs", "#"
16
+ # - breadcrumbs.with_item do
17
+ # = link_to "Components", "#"
18
+ #
19
+ # @example Breadcrumbs with icons
20
+ # = daisy_breadcrumbs do |breadcrumbs|
21
+ # - breadcrumbs.with_item do
22
+ # = link_to "#" do
23
+ # = hero_icon("home", css: "size-4 mr-1")
24
+ # Home
25
+ # - breadcrumbs.with_item do
26
+ # = link_to "#" do
27
+ # = hero_icon("document", css: "size-4 mr-1")
28
+ # Docs
29
+ #
1
30
  class Daisy::Navigation::BreadcrumbsComponent < LocoMotion::BaseComponent
2
31
  define_parts :list_wrapper
3
32
 
4
33
  renders_many :items, LocoMotion::BasicComponent.build(tag_name: :li)
5
34
 
6
- def initialize(*args, **kws, &block)
7
- super
35
+ # Create a new instance of the BreadcrumbsComponent.
36
+ #
37
+ # @param kws [Hash] The keyword arguments for the component.
38
+ #
39
+ # @option kws css [String] Additional CSS classes for styling. Common
40
+ # options include:
41
+ # - Text: `text-sm`, `text-base-content`
42
+ # - Spacing: `space-x-2`, `gap-4`
43
+ #
44
+ def initialize(**kws)
45
+ super(**kws)
8
46
  end
9
47
 
10
48
  def before_render
11
49
  add_css(:component, "breadcrumbs")
12
-
13
50
  set_tag_name(:list_wrapper, :ul)
14
51
  end
15
52
  end
@@ -1,6 +1,20 @@
1
1
  #
2
- # The Daisy::Navigation::LinkComponent is a simple component that renders an
3
- # anchor tag.
2
+ # Creates a styled link component that can be used for navigation or inline text
3
+ # links. This component is designed to work similarly to Rails' `link_to` helper.
4
+ #
5
+ # @example Link with custom styling
6
+ # = daisy_link "Components", "#", css: "link-primary text-xl"
7
+ #
8
+ # @example Link with block content
9
+ # = daisy_link "#", css: "link-hover" do
10
+ # = hero_icon("home")
11
+ # Home
12
+ #
13
+ # @example Link with positional arguments
14
+ # = daisy_link "Documentation", "#"
15
+ #
16
+ # @example Basic link with keyword arguments
17
+ # = daisy_link(title: "Home", href: "#")
4
18
  #
5
19
  class Daisy::Navigation::LinkComponent < LocoMotion::BaseComponent
6
20
  prepend LocoMotion::Concerns::TippableComponent
@@ -12,13 +26,24 @@ class Daisy::Navigation::LinkComponent < LocoMotion::BaseComponent
12
26
  # and the second is considered the `href`.
13
27
  # - If passed only **one** positional argument, it is treated as the `href`
14
28
  # and we assume the `title` will be provided in the block.
15
- # - If no text is passed in the block, we will use the `href` as the title
29
+ # - If no text is passed in the block, we will use the `href` as the title.
30
+ #
16
31
  # @param kws [Hash] The keyword arguments for the component.
17
32
  #
18
- # @option kws title [String] The text to display in the link.
33
+ # @option kws title [String] The text to display in the link. Not required if
34
+ # providing block content.
35
+ #
19
36
  # @option kws href [String] The URL to visit when the link is clicked.
20
- # @option kws target [String] The target attribute for the anchor tag.
21
- def initialize(*args, **kws, &block)
37
+ #
38
+ # @option kws target [String] The target attribute for the anchor tag (e.g., "_blank").
39
+ #
40
+ # @option kws css [String] Additional CSS classes for styling. Common
41
+ # options include:
42
+ # - Style: `link-primary`, `link-secondary`, `link-accent`
43
+ # - State: `link-hover`
44
+ # - Text: `text-sm`, `text-xl`, `text-2xl`
45
+ #
46
+ def initialize(*args, **kws)
22
47
  super
23
48
 
24
49
  if args.size == 1
@@ -1,34 +1,53 @@
1
1
  #
2
- # A component that renders a menu with items.
2
+ # Creates a menu component for displaying a list of items, optionally with group titles.
3
3
  #
4
- # @slot item [Daisy::Navigation::MenuItemComponent] Renders one or more menu
5
- # items.
4
+ # @slot items+ {Daisy::Navigation::MenuItemComponent} The menu items to display.
6
5
  #
7
- # @loco_example Basic Usage
6
+ # @example Basic menu with items
8
7
  # = daisy_menu do |menu|
9
- # - # Menu Item with a grouping title via keyword argument
10
- # - menu.with_item(title: "Group 1") do
11
- # = link_to "Item 1 - 1", "#"
8
+ # - menu.with_item do
9
+ # = link_to "Item 1", "#"
10
+ # - menu.with_item do
11
+ # = link_to "Item 2", "#"
12
12
  #
13
- # - # Menu Item with a grouping title as the first positional argument
13
+ # @example Menu with group titles
14
+ # = daisy_menu do |menu|
15
+ # - menu.with_item(title: "Group 1") do
16
+ # = link_to "Item 1-1", "#"
17
+ # = link_to "Item 1-2", "#"
14
18
  # - menu.with_item("Group 2") do
15
- # = link_to "Item 2 - 1", "#"
19
+ # = link_to "Item 2-1", "#"
20
+ # = link_to "Item 2-2", "#"
16
21
  #
17
- # - # Menu Item with no grouping title
22
+ # @example Menu with disabled items
23
+ # = daisy_menu do |menu|
18
24
  # - menu.with_item do
19
- # = link_to "Item 2 - 2", "#"
25
+ # = link_to "Active Item", "#"
26
+ # - menu.with_item(disabled: true) do
27
+ # Disabled Item
20
28
  #
21
29
  class Daisy::Navigation::MenuComponent < LocoMotion::BaseComponent
22
30
 
23
31
  #
24
- # The items for the MenuComponent.
32
+ # A menu item component that can optionally have a title and be disabled.
33
+ #
34
+ # @part title The title element for the menu item.
25
35
  #
26
- # @part title Wrapper for the title of the menu item.
36
+ # @example Basic menu item
37
+ # = menu.with_item do
38
+ # = link_to "Item", "#"
39
+ #
40
+ # @example Menu item with title
41
+ # = menu.with_item(title: "Group") do
42
+ # = link_to "Item", "#"
43
+ #
44
+ # @example Disabled menu item
45
+ # = menu.with_item(disabled: true) do
46
+ # = link_to "Item", "#"
27
47
  #
28
48
  class Daisy::Navigation::MenuItemComponent < LocoMotion::BaseComponent
29
49
  define_part :title
30
50
 
31
- #
32
51
  # Create a new instance of the MenuItemComponent.
33
52
  #
34
53
  # @param args [Array] If provided, the first argument is considered the
@@ -37,10 +56,16 @@ class Daisy::Navigation::MenuComponent < LocoMotion::BaseComponent
37
56
  # @param kws [Hash] The keyword arguments for the component.
38
57
  #
39
58
  # @option kws title [String] Shows an additional title above the item.
59
+ #
40
60
  # @option kws disabled [Boolean] Sets the item in a disabled state.
41
61
  #
42
- def initialize(*args, **kws, &block)
43
- super
62
+ # @option kws css [String] Additional CSS classes for styling. Common
63
+ # options include:
64
+ # - Text: `text-sm`, `text-base-content`
65
+ # - Spacing: `mt-4`, `mb-2`
66
+ #
67
+ def initialize(*args, **kws)
68
+ super(**kws)
44
69
 
45
70
  @simple_title = config_option(:title, args[0])
46
71
  @disabled = config_option(:disabled)
@@ -71,12 +96,19 @@ class Daisy::Navigation::MenuComponent < LocoMotion::BaseComponent
71
96
 
72
97
  renders_many :items, Daisy::Navigation::MenuItemComponent
73
98
 
99
+ # Create a new instance of the MenuComponent.
100
+ #
101
+ # @param kws [Hash] The keyword arguments for the component.
74
102
  #
75
- # Create a new instance of the MenuComponent. Passes any arguments to the
76
- # BaseComponent.
103
+ # @option kws css [String] Additional CSS classes for styling. Common
104
+ # options include:
105
+ # - Size: `w-56`, `max-w-xs`
106
+ # - Background: `bg-base-100`, `bg-neutral`
107
+ # - Border: `border`, `rounded-box`
108
+ # - Shadow: `shadow`, `shadow-lg`
77
109
  #
78
- def initialize(*args, **kws, &block)
79
- super
110
+ def initialize(**kws)
111
+ super(**kws)
80
112
  end
81
113
 
82
114
  #
@@ -1,4 +1,4 @@
1
1
  = part(:component) do
2
2
  = start if start?
3
3
  = center if center?
4
- = tail if tail?
4
+ = end_content if end?
@@ -1,12 +1,73 @@
1
+ #
2
+ # Creates a navigation bar component typically used at the top of a page to
3
+ # organize navigation links and branding elements.
4
+ #
5
+ # @slot start {LocoMotion::BasicComponent} The left section of the navbar.
6
+ # Automatically gets the `navbar-start` CSS class.
7
+ #
8
+ # @slot center {LocoMotion::BasicComponent} The center section of the navbar.
9
+ # Automatically gets the `navbar-center` CSS class.
10
+ #
11
+ # @slot end {LocoMotion::BasicComponent} The right section of the navbar.
12
+ # Automatically gets the `navbar-end` CSS class.
13
+ #
14
+ # @example Basic navbar with logo and GitHub link
15
+ # = daisy_navbar(css: "bg-base-100") do |navbar|
16
+ # - navbar.with_start do
17
+ # = image_tag("logo.png", class: "h-8")
18
+ # %span.font-bold Company Name
19
+ #
20
+ # - navbar.with_end do
21
+ # = link_to "GitHub", "https://github.com", target: "_blank"
22
+ #
23
+ # @example Navbar with all sections and dropdown
24
+ # = daisy_navbar(css: "bg-base-100") do |navbar|
25
+ # - navbar.with_start do
26
+ # %span.text-lg.italic Brand
27
+ #
28
+ # - navbar.with_center do
29
+ # = hero_icon("code-bracket", css: "size-14")
30
+ #
31
+ # - navbar.with_end do
32
+ # = daisy_dropdown do |dropdown|
33
+ # - dropdown.with_button(title: "Menu")
34
+ # - dropdown.with_item do
35
+ # = link_to "Item 1", "#"
36
+ #
1
37
  class Daisy::Navigation::NavbarComponent < LocoMotion::BaseComponent
2
38
  renders_one :start, LocoMotion::BasicComponent.build(css: "navbar-start")
3
39
 
4
40
  renders_one :center, LocoMotion::BasicComponent.build(css: "navbar-center")
5
41
 
6
- # End is a reserved word in Ruby
7
- renders_one :tail, LocoMotion::BasicComponent.build(css: "navbar-end")
42
+ renders_one :end, LocoMotion::BasicComponent.build(css: "navbar-end")
43
+
44
+ # Create a new instance of the NavbarComponent.
45
+ #
46
+ # @param kws [Hash] The keyword arguments for the component.
47
+ #
48
+ # @option kws css [String] Additional CSS classes for styling. Common
49
+ # options include:
50
+ # - Background: `bg-base-100`, `bg-neutral`
51
+ # - Border: `border`, `border-base-200`, `rounded-lg`
52
+ # - Shadow: `shadow`, `shadow-lg`
53
+ # - Min Height: `min-h-8`, `min-h-16`
54
+ #
55
+ def initialize(**kws)
56
+ super(**kws)
57
+ end
8
58
 
9
59
  def before_render
10
60
  add_css(:component, "navbar")
11
61
  end
62
+
63
+ private
64
+
65
+ # Returns the end section content.
66
+ #
67
+ # Since `end` is a reserved word in Ruby, we need to use a different method
68
+ # name in the template.
69
+ #
70
+ def end_content
71
+ self.end
72
+ end
12
73
  end
@@ -1,7 +1,69 @@
1
+ #
2
+ # Creates a component for displaying a series of steps that users can follow to
3
+ # complete a task. Useful for onboarding, form completion, and progress tracking.
4
+ #
5
+ # @note Steps are automatically numbered and connected with lines. You can use
6
+ # colors to indicate progress through the steps.
7
+ #
8
+ # @slot steps+ {Daisy::Navigation::StepsComponent::StepComponent} The individual
9
+ # steps to display.
10
+ #
11
+ # @example Basic steps with progress
12
+ # = daisy_steps do |steps|
13
+ # - steps.with_step(title: "Write Code", css: "step-primary")
14
+ # - steps.with_step(title: "Release Code", css: "step-primary")
15
+ # - steps.with_step(title: "Profit", css: "step-secondary")
16
+ # - steps.with_step(title: "Rule the World")
17
+ #
18
+ # @example Vertical steps
19
+ # = daisy_steps(css: "steps-vertical") do |steps|
20
+ # - steps.with_step(title: "Write Code", css: "step-primary")
21
+ # - steps.with_step(title: "Release Code", css: "step-primary")
22
+ # - steps.with_step(title: "Profit", css: "step-secondary")
23
+ # - steps.with_step(title: "Rule the World")
24
+ #
25
+ # @example Custom step content
26
+ # = daisy_steps do |steps|
27
+ # - steps.with_step(number: "AB")
28
+ # - steps.with_step(number: "★")
29
+ # - steps.with_step(number: "✓", css: "after:!text-green-500")
30
+ #
1
31
  class Daisy::Navigation::StepsComponent < LocoMotion::BaseComponent
2
32
 
33
+ #
34
+ # A step within a StepsComponent.
35
+ #
36
+ # @example Basic step with title
37
+ # = steps.with_step(title: "Step 1")
38
+ #
39
+ # @example Step with custom number
40
+ # = steps.with_step(number: "★", title: "Special Step")
41
+ #
42
+ # @example Step with custom content
43
+ # = steps.with_step(number: "1") do
44
+ # .flex.gap-2
45
+ # = hero_icon("check")
46
+ # Complete
47
+ #
3
48
  class Daisy::Navigation::StepComponent < LocoMotion::BaseComponent
4
49
  attr_reader :simple
50
+
51
+ # Create a new instance of the StepComponent.
52
+ #
53
+ # @param args [Array] Not used.
54
+ #
55
+ # @param kws [Hash] The keyword arguments for the component.
56
+ #
57
+ # @option kws title [String] The text to display in the step.
58
+ #
59
+ # @option kws number [String] Custom content to display in the step's
60
+ # circle. Can be text, numbers, or emoji.
61
+ #
62
+ # @option kws css [String] Additional CSS classes for styling. Common
63
+ # options include:
64
+ # - Progress: `step-primary`, `step-secondary`, `step-accent`
65
+ # - Circle Content: `after:!text-green-500`, `after:!bg-black`
66
+ #
5
67
  def initialize(*args, **kws, &block)
6
68
  super
7
69
 
@@ -25,6 +87,20 @@ class Daisy::Navigation::StepsComponent < LocoMotion::BaseComponent
25
87
 
26
88
  renders_many :steps, Daisy::Navigation::StepComponent
27
89
 
90
+ # Create a new instance of the StepsComponent.
91
+ #
92
+ # @param kws [Hash] The keyword arguments for the component.
93
+ #
94
+ # @option kws css [String] Additional CSS classes for styling. Common
95
+ # options include:
96
+ # - Direction: `steps-vertical`
97
+ # - Size: `steps-mini`, `steps-sm`, `steps-md`, `steps-lg`
98
+ # - Width: `w-full`, `max-w-xs`
99
+ #
100
+ def initialize(**kws)
101
+ super(**kws)
102
+ end
103
+
28
104
  def before_render
29
105
  set_tag_name(:component, :ul)
30
106
  add_css(:component, "steps")