loco_motion-rails 0.0.7 → 0.4.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/README.md +101 -14
  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/data_input/checkbox_component.rb +92 -0
  28. data/app/components/daisy/data_input/file_input_component.rb +92 -0
  29. data/app/components/daisy/data_input/label_component.rb +84 -0
  30. data/app/components/daisy/data_input/radio_button_component.rb +87 -0
  31. data/app/components/daisy/data_input/range_component.rb +95 -0
  32. data/app/components/daisy/data_input/rating_component.html.haml +13 -0
  33. data/app/components/daisy/data_input/rating_component.rb +138 -0
  34. data/app/components/daisy/data_input/select_component.html.haml +15 -0
  35. data/app/components/daisy/data_input/select_component.rb +178 -0
  36. data/app/components/daisy/data_input/text_area_component.rb +124 -0
  37. data/app/components/daisy/data_input/text_input_component.html.haml +6 -0
  38. data/app/components/daisy/data_input/text_input_component.rb +140 -0
  39. data/app/components/daisy/data_input/toggle_component.rb +36 -0
  40. data/app/components/daisy/feedback/alert_component.rb +46 -1
  41. data/app/components/daisy/feedback/loading_component.rb +39 -0
  42. data/app/components/daisy/feedback/progress_component.rb +39 -1
  43. data/app/components/daisy/feedback/radial_progress_component.rb +44 -1
  44. data/app/components/daisy/feedback/skeleton_component.rb +44 -0
  45. data/app/components/daisy/feedback/toast_component.rb +36 -0
  46. data/app/components/daisy/feedback/tooltip_component.rb +46 -10
  47. data/app/components/daisy/layout/artboard_component.rb +48 -0
  48. data/app/components/daisy/layout/divider_component.rb +50 -10
  49. data/app/components/daisy/layout/drawer_component.rb +62 -17
  50. data/app/components/daisy/layout/footer_component.rb +51 -11
  51. data/app/components/daisy/layout/hero_component.rb +67 -5
  52. data/app/components/daisy/layout/indicator_component.rb +55 -8
  53. data/app/components/daisy/layout/join_component.rb +71 -0
  54. data/app/components/daisy/layout/stack_component.rb +59 -0
  55. data/app/components/daisy/mockup/browser_component.rb +78 -0
  56. data/app/components/daisy/mockup/code_component.rb +144 -0
  57. data/app/components/daisy/mockup/device_component.rb +81 -0
  58. data/app/components/daisy/mockup/frame_component.rb +62 -0
  59. data/app/components/daisy/navigation/bottom_nav_component.rb +81 -2
  60. data/app/components/daisy/navigation/breadcrumbs_component.rb +40 -3
  61. data/app/components/daisy/navigation/link_component.rb +31 -6
  62. data/app/components/daisy/navigation/menu_component.rb +52 -20
  63. data/app/components/daisy/navigation/navbar_component.html.haml +1 -1
  64. data/app/components/daisy/navigation/navbar_component.rb +63 -2
  65. data/app/components/daisy/navigation/steps_component.rb +76 -0
  66. data/app/components/daisy/navigation/tabs_component.rb +110 -7
  67. data/app/components/hero/icon_component.rb +40 -0
  68. data/app/helpers/daisy/form_builder_helper.rb +159 -0
  69. data/lib/daisy.rb +10 -0
  70. data/lib/loco_motion/base_component.rb +9 -2
  71. data/lib/loco_motion/engine.rb +6 -0
  72. data/lib/loco_motion/helpers.rb +19 -0
  73. data/lib/loco_motion/version.rb +5 -0
  74. metadata +51 -5
@@ -1,29 +1,69 @@
1
1
  #
2
- # The divider component is a simple horizontal or vertical line that separates
3
- # content. It can be colored and have a label.
2
+ # The DividerComponent creates a visual separator between content sections,
3
+ # either horizontally or vertically. It can include optional text or content
4
+ # in the center and supports various colors to match your theme.
4
5
  #
5
- # @loco_example Basic Usage
6
+ # Common use cases include:
7
+ # - Separating sections of a page.
8
+ # - Creating visual breaks between cards or content blocks.
9
+ # - Providing alternative options with "OR" text.
10
+ # - Organizing form sections.
11
+ #
12
+ # @loco_example Basic Dividers
6
13
  # = daisy_divider
7
14
  #
8
- # @loco_example With Text
9
15
  # = daisy_divider do
10
- # Hello Dividers!
16
+ # OR
17
+ #
18
+ # @loco_example Vertical Dividers
19
+ # .flex.grow
20
+ # = daisy_card(css: "h-48") do
21
+ # Left Content
22
+ #
23
+ # = daisy_divider(css: "divider-horizontal") do
24
+ # OR
25
+ #
26
+ # = daisy_card(css: "h-48") do
27
+ # Right Content
28
+ #
29
+ # @loco_example Colored Dividers
30
+ # = daisy_divider(css: "divider-primary") do
31
+ # Primary
32
+ #
33
+ # = daisy_divider(css: "divider-accent") do
34
+ # Accent
11
35
  #
12
- # @loco_example Horizontal Accented With Text
13
- # = daisy_divider(css: "divider-horizontal divider-accent") do
14
- # Accent Divider
36
+ # = daisy_divider(css: "divider-success") do
37
+ # Success
15
38
  #
16
39
  class Daisy::Layout::DividerComponent < LocoMotion::BaseComponent
17
40
 
18
41
  #
19
- # Add the `divider` CSS class to the component.
42
+ # Creates a new Divider component.
43
+ #
44
+ # @param args [Array] Positional arguments passed to the parent class.
45
+ # @param kws [Hash] Keyword arguments for customizing the divider.
46
+ #
47
+ # @option kws css [String] Additional CSS classes for styling. Common
48
+ # options include:
49
+ # - Orientation: `divider-horizontal` for vertical divider
50
+ # - Colors: `divider-neutral`, `divider-primary`, `divider-secondary`,
51
+ # `divider-accent`, `divider-info`, `divider-success`,
52
+ # `divider-warning`, `divider-error`
53
+ #
54
+ def initialize(*args, **kws, &block)
55
+ super
56
+ end
57
+
58
+ #
59
+ # Sets up the component's CSS classes.
20
60
  #
21
61
  def before_render
22
62
  add_css(:component, "divider")
23
63
  end
24
64
 
25
65
  #
26
- # Render the component and it's content.
66
+ # Renders the component and its content.
27
67
  #
28
68
  def call
29
69
  part(:component) { content }
@@ -1,23 +1,60 @@
1
1
  #
2
- # The DrawerComponent shows a sidebar that can be toggled open and closed.
2
+ # The DrawerComponent provides a sliding sidebar panel that can be toggled
3
+ # open and closed. It's commonly used for:
4
+ # - Navigation menus
5
+ # - Filter panels
6
+ # - Additional information panels
7
+ # - Mobile-friendly navigation
3
8
  #
4
- # @part input [LocoMotion::BaseComponent] The input checkbox that toggles the
5
- # sidebar.
6
- # @part content_wrapper [LocoMotion::BaseComponent] The wrapper for the page
7
- # content.
8
- # @part overlay [LocoMotion::BaseComponent] The overlay that covers the page
9
- # when the sidebar is open.
9
+ # The drawer includes an overlay that covers the main content when open and
10
+ # can be configured to slide in from either the left or right side.
10
11
  #
11
- # @slot sidebar [Daisy::Layout::DrawerSidebarComponent] The sidebar that is
12
- # shown when the drawer is toggled open. Renders the overlay inside of itself.
12
+ # @part input [LocoMotion::BaseComponent] The input checkbox that
13
+ # toggles the sidebar visibility.
13
14
  #
14
- # @loco_example Basic Usage
15
+ # @part content_wrapper [LocoMotion::BaseComponent] The wrapper for the main
16
+ # page content that remains visible when the drawer is closed.
17
+ #
18
+ # @part overlay [LocoMotion::BaseComponent] The semi-transparent
19
+ # overlay that covers the main content when the drawer is open. Clicking it
20
+ # closes the drawer.
21
+ #
22
+ # @slot sidebar [Daisy::Layout::DrawerSidebarComponent] The sidebar
23
+ # panel that slides in when the drawer is opened. Contains the overlay
24
+ # within itself.
25
+ #
26
+ # @loco_example Basic Left Drawer
15
27
  # = daisy_drawer do |drawer|
16
28
  # - drawer.with_sidebar do
17
29
  # .bg-base-100.p-4.w-40
18
- # Hello sidebar!
30
+ # Menu Items
31
+ #
32
+ # = daisy_button(tag_name: "label",
33
+ # css: "btn btn-primary",
34
+ # title: "Open Menu",
35
+ # html: { for: drawer.id })
36
+ #
37
+ # @loco_example Right Drawer
38
+ # = daisy_drawer(css: "drawer-end") do |drawer|
39
+ # - drawer.with_sidebar do
40
+ # .bg-base-100.p-4.w-40
41
+ # Filter Options
42
+ #
43
+ # = daisy_button(tag_name: "label",
44
+ # css: "btn btn-secondary",
45
+ # title: "Show Filters",
46
+ # html: { for: drawer.id })
19
47
  #
20
- # = daisy_button(tag_name: "label", css: "btn btn-primary", title: "Open Drawer", html: { for: drawer.id })
48
+ # @loco_example Styled Drawer
49
+ # = daisy_drawer do |drawer|
50
+ # - drawer.with_sidebar do
51
+ # .bg-base-200.p-4.w-80.h-full
52
+ # .flex.justify-between.items-center.mb-4
53
+ # %h2.text-xl Settings
54
+ # = daisy_button(tag_name: "label",
55
+ # css: "btn btn-ghost btn-circle",
56
+ # icon: "x-mark",
57
+ # html: { for: drawer.id })
21
58
  #
22
59
  class Daisy::Layout::DrawerComponent < LocoMotion::BaseComponent
23
60
  #
@@ -26,14 +63,14 @@ class Daisy::Layout::DrawerComponent < LocoMotion::BaseComponent
26
63
  #
27
64
  class Daisy::Layout::DrawerSidebarComponent < LocoMotion::BaseComponent
28
65
  #
29
- # Add the `drawer-side` CSS class to the component.
66
+ # Sets up the component's CSS classes.
30
67
  #
31
68
  def before_render
32
69
  add_css(:component, "drawer-side")
33
70
  end
34
71
 
35
72
  #
36
- # Render the sidebar, the overlay, and the content.
73
+ # Renders the sidebar, the overlay, and its content.
37
74
  #
38
75
  def call
39
76
  part(:component) do
@@ -55,10 +92,18 @@ class Daisy::Layout::DrawerComponent < LocoMotion::BaseComponent
55
92
  attr_reader :id
56
93
 
57
94
  #
58
- # Create a new instance of the DrawerComponent.
95
+ # Creates a new Drawer component.
96
+ #
97
+ # @param kws [Hash] Keyword arguments for customizing the drawer.
98
+ #
99
+ # @option kws id [String] The ID of the drawer. Defaults to a random UUID.
100
+ # This is used to connect the toggle button with the drawer.
59
101
  #
60
- # @param kws [Hash] The keyword arguments passed to the component.
61
- # @option kws [String] :id The ID of the drawer. Defaults to a random UUID.
102
+ # @option kws css [String] Additional CSS classes for styling. Common
103
+ # options include:
104
+ # - Position: `drawer-end` to slide from right instead of left
105
+ # - Responsive: `lg:drawer-open` to keep drawer open on large screens
106
+ # - Z-index: `z-[100]` to control stacking order
62
107
  #
63
108
  def initialize(**kws)
64
109
  super
@@ -1,27 +1,67 @@
1
1
  #
2
- # The footer component is a simple container for the footer of a page. It can be
3
- # used to hold copyright information, links to other pages, or any other
4
- # information that should be displayed at the bottom of a page.
2
+ # The FooterComponent creates a responsive container for page footer content.
3
+ # Common use cases include:
4
+ # - Site navigation and sitemap links.
5
+ # - Copyright and legal information.
6
+ # - Contact details and social media links.
7
+ # - Newsletter signup forms.
5
8
  #
6
- # @loco_example Basic Usage
7
- # = daisy_footer(css: "bg-neutral text-neutral-content") do
9
+ # The component is responsive by default and will stack content on smaller
10
+ # screens.
11
+ #
12
+ # @loco_example Basic Navigation Footer
13
+ # = daisy_footer(css: "bg-neutral text-neutral-content p-10") do
14
+ # %nav
15
+ # %h6.footer-title Company
16
+ # = link_to "About", "/about", class: "link-hover"
17
+ # = link_to "Contact", "/contact", class: "link-hover"
18
+ # = link_to "Jobs", "/careers", class: "link-hover"
19
+ #
20
+ # @loco_example Multi-Column Footer
21
+ # = daisy_footer(css: "bg-base-200 text-base-content p-10") do
8
22
  # %nav
9
- # = link_to "Home", root_path
23
+ # %h6.footer-title Products
24
+ # = link_to "Features", "#", class: "link-hover"
25
+ # = link_to "Pricing", "#", class: "link-hover"
10
26
  #
11
- # @loco_example With Text
12
- # = daisy_footer(css: "bg-neutral text-neutral-content p-10 text-center text-sm") do
13
- # Copyright &copy; 2024
27
+ # %nav
28
+ # %h6.footer-title Support
29
+ # = link_to "Documentation", "#", class: "link-hover"
30
+ # = link_to "Help Center", "#", class: "link-hover"
31
+ #
32
+ # @loco_example Copyright Footer
33
+ # = daisy_footer(css: "bg-neutral text-neutral-content p-4 text-center") do
34
+ # %small
35
+ # Copyright &copy; 2024 Company Name.
36
+ # All rights reserved.
14
37
  #
15
38
  class Daisy::Layout::FooterComponent < LocoMotion::BaseComponent
16
39
  #
17
- # Add the `footer` CSS class to the component.
40
+ # Creates a new Footer component.
41
+ #
42
+ # @param kws [Hash] Keyword arguments for customizing the footer.
43
+ #
44
+ # @option kws css [String] Additional CSS classes for styling. Common
45
+ # options include:
46
+ # - Background: `bg-neutral`, `bg-base-200`
47
+ # - Text color: `text-neutral-content`, `text-base-content`
48
+ # - Spacing: `p-4`, `p-10`
49
+ # - Layout: `text-center`, `grid grid-cols-2 gap-4`
50
+ #
51
+ def initialize(**kws)
52
+ super
53
+ end
54
+
55
+ #
56
+ # Sets up the component's CSS classes and HTML tag.
18
57
  #
19
58
  def before_render
20
59
  add_css(:component, "footer")
60
+ set_tag_name(:component, :footer)
21
61
  end
22
62
 
23
63
  #
24
- # Render the component and it's content (inline).
64
+ # Renders the component and its content.
25
65
  #
26
66
  def call
27
67
  part(:component) { content }
@@ -1,10 +1,45 @@
1
1
  #
2
- # The HeroComponent is a layout component that is used to create a hero section.
2
+ # The HeroComponent creates an eye-catching, full-width section typically used
3
+ # at the top of a page. Common use cases include:
4
+ # - Landing page introductions.
5
+ # - Feature showcases.
6
+ # - Call-to-action sections.
7
+ # - Image-rich banners.
3
8
  #
4
- # @part content_wrapper The wrapper for the content of the hero.
9
+ # The component is responsive by default and provides flexible layout options
10
+ # for content positioning and image integration.
5
11
  #
6
- # @slot overlay [LocoMotion::BasicComponent] An optional `<div>` positioned to
7
- # overlay underneath the hero and allow for styling behind it.
12
+ # @part content_wrapper [LocoMotion::BaseComponent] The wrapper for the hero
13
+ # content, providing flex-based layout control.
14
+ #
15
+ # @slot overlay [LocoMotion::BasicComponent] An optional `<div>` positioned
16
+ # behind the content for background effects like semi-transparency or blur.
17
+ #
18
+ # @loco_example Basic Hero
19
+ # = daisy_hero(css: "bg-base-200 text-center") do
20
+ # %div
21
+ # %h1.text-5xl.font-bold Welcome
22
+ # %p.my-6 Discover amazing features.
23
+ # = daisy_button(css: "btn btn-primary",
24
+ # title: "Get Started")
25
+ #
26
+ # @loco_example Hero with Image
27
+ # = daisy_hero(css: "bg-base-200",
28
+ # content_wrapper_css: "flex-col md:flex-row") do
29
+ # %img.h-40.rounded{
30
+ # src: image_path("hero-image.jpg"),
31
+ # alt: "Hero Image" }
32
+ # %div
33
+ # %h1.text-5xl.font-bold Features
34
+ # %p.my-6 Explore what we offer.
35
+ #
36
+ # @loco_example Hero with Background Overlay
37
+ # = daisy_hero(css: "min-h-96",
38
+ # html: { style: "background-image: url('bg.jpg')" }) do |hero|
39
+ # - hero.with_overlay(css: "bg-black/50 backdrop-blur")
40
+ # %div.text-white
41
+ # %h1.text-5xl.font-bold Discover
42
+ # %p.my-6 Start your journey today.
8
43
  #
9
44
  class Daisy::Layout::HeroComponent < LocoMotion::BaseComponent
10
45
  define_part :content_wrapper
@@ -12,7 +47,34 @@ class Daisy::Layout::HeroComponent < LocoMotion::BaseComponent
12
47
  renders_one :overlay, LocoMotion::BasicComponent.build(css: "hero-overlay")
13
48
 
14
49
  #
15
- # Adds the necessary CSS classes to the component.
50
+ # Creates a new Hero component.
51
+ #
52
+ # @param kws [Hash] Keyword arguments for customizing the hero.
53
+ #
54
+ # @option kws css [String] Additional CSS classes for styling. Common
55
+ # options include:
56
+ # - Height: `min-h-screen`, `min-h-[50vh]`
57
+ # - Background: `bg-base-200`, `bg-primary`
58
+ # - Text: `text-center`, `text-primary-content`
59
+ #
60
+ # @option kws content_wrapper_css [String] CSS classes for the content
61
+ # wrapper. Common options include:
62
+ # - Layout: `flex-col`, `flex-col md:flex-row`
63
+ # - Spacing: `gap-4`, `space-y-4`
64
+ # - Alignment: `items-center`, `justify-between`
65
+ #
66
+ # @option kws html [Hash] HTML attributes for the hero container.
67
+ # Commonly used for background images:
68
+ # ```ruby
69
+ # html: { style: "background-image: url('image.jpg')" }
70
+ # ```
71
+ #
72
+ def initialize(**kws)
73
+ super
74
+ end
75
+
76
+ #
77
+ # Sets up the component's CSS classes.
16
78
  #
17
79
  def before_render
18
80
  add_css(:component, "hero")
@@ -1,28 +1,75 @@
1
1
  #
2
- # The IndicatorComponent provides items positioned around it's content with the
3
- # intention of indicating a callout or something needing attention.
2
+ # The IndicatorComponent positions notification elements around its content to
3
+ # draw attention to important information. Common use cases include:
4
+ # - Notification badges on avatars.
5
+ # - Cart item counters.
6
+ # - "New" badges on features.
7
+ # - Status indicators on elements.
4
8
  #
5
- # @slot item The items to be rendered around the content. Allows multiple.
9
+ # By default, indicators are positioned in the top-right corner, but they can
10
+ # be positioned anywhere around the content using CSS classes.
6
11
  #
7
- # @loco_example Basic Usage
12
+ # @slot item+ [LocoMotion::BasicComponent] The items to be rendered around
13
+ # the content. Multiple items can be added and positioned independently.
14
+ #
15
+ # @loco_example Basic Badge Indicator
8
16
  # = daisy_indicator do |indicator|
9
17
  # - indicator.with_item do
10
- # = daisy_badge(title: "New!", css: "badge-accent")
18
+ # = daisy_badge(title: "8",
19
+ # css: "badge-secondary")
20
+ #
21
+ # = daisy_avatar(src: "avatar.jpg")
22
+ #
23
+ # @loco_example Multiple Indicators
24
+ # = daisy_indicator do |indicator|
25
+ # - indicator.with_item(css: "indicator-top indicator-start") do
26
+ # = daisy_badge(title: "New",
27
+ # css: "badge-accent")
28
+ #
29
+ # - indicator.with_item(css: "indicator-bottom indicator-end") do
30
+ # = daisy_badge(title: "Sale",
31
+ # css: "badge-secondary")
32
+ #
33
+ # = daisy_button(title: "View Item")
34
+ #
35
+ # @loco_example Custom Positioning
36
+ # = daisy_indicator do |indicator|
37
+ # - # Center of left edge
38
+ # - indicator.with_item(css: "indicator-middle indicator-start") do
39
+ # Online
11
40
  #
12
- # = daisy_button(title: "Checkout", left_icon: "shopping-cart")
41
+ # - # Center of right edge
42
+ # - indicator.with_item(css: "indicator-middle indicator-end") do
43
+ # Available
44
+ #
45
+ # .w-40.h-40.bg-base-200
13
46
  #
14
47
  class Daisy::Layout::IndicatorComponent < LocoMotion::BaseComponent
15
48
  renders_many :items, LocoMotion::BasicComponent.build(css: "indicator-item")
16
49
 
17
50
  #
18
- # Adds the `indicator` CSS to the component
51
+ # Creates a new Indicator component.
52
+ #
53
+ # @param kws [Hash] Keyword arguments for customizing the indicator.
54
+ #
55
+ # @option kws css [String] Additional CSS classes for styling. Common
56
+ # options include:
57
+ # - Spacing: `p-2`, `m-4`
58
+ # - Alignment: `inline-flex`, `inline-grid`
59
+ #
60
+ def initialize(**kws)
61
+ super
62
+ end
63
+
64
+ #
65
+ # Sets up the component's CSS classes.
19
66
  #
20
67
  def before_render
21
68
  add_css(:component, "indicator")
22
69
  end
23
70
 
24
71
  #
25
- # Renders the component, all of the items, and any user-provided content.
72
+ # Renders the component, all indicator items, and the main content.
26
73
  #
27
74
  def call
28
75
  part(:component) do
@@ -1,10 +1,81 @@
1
+ #
2
+ # The JoinComponent combines multiple elements into a cohesive group without
3
+ # gaps between them. Common use cases include:
4
+ # - Button groups for toolbars.
5
+ # - Input fields with prefix/suffix elements.
6
+ # - Segmented navigation controls.
7
+ # - Pagination controls.
8
+ #
9
+ # Note: Each joined item must include the `join-item` CSS class manually, as
10
+ # automatic application could cause rendering issues in complex scenarios.
11
+ #
12
+ # @slot item+ [LocoMotion::BaseComponent] The elements to be joined together.
13
+ # Each item should include the `join-item` CSS class.
14
+ #
15
+ # @loco_example Basic Button Group
16
+ # = daisy_join do |join|
17
+ # - join.with_item do
18
+ # = daisy_button(title: "Previous",
19
+ # css: "join-item")
20
+ # - join.with_item do
21
+ # = daisy_button(title: "Current",
22
+ # css: "join-item btn-active")
23
+ # - join.with_item do
24
+ # = daisy_button(title: "Next",
25
+ # css: "join-item")
26
+ #
27
+ # @loco_example Icon Button Group
28
+ # = daisy_join do |join|
29
+ # - join.with_item do
30
+ # = daisy_button(icon: "chevron-left",
31
+ # css: "join-item")
32
+ # - join.with_item do
33
+ # = daisy_button(icon: "home",
34
+ # css: "join-item")
35
+ # - join.with_item do
36
+ # = daisy_button(icon: "chevron-right",
37
+ # css: "join-item")
38
+ #
39
+ # @loco_example Vertical Join
40
+ # = daisy_join(css: "join-vertical") do |join|
41
+ # - join.with_item do
42
+ # = daisy_button(title: "Menu",
43
+ # css: "w-full join-item")
44
+ # - join.with_item do
45
+ # = daisy_button(title: "Settings",
46
+ # css: "w-full join-item")
47
+ # - join.with_item do
48
+ # = daisy_button(title: "Account",
49
+ # css: "w-full join-item")
50
+ #
1
51
  class Daisy::Layout::JoinComponent < LocoMotion::BaseComponent
2
52
  renders_many :items
3
53
 
54
+ #
55
+ # Creates a new Join component.
56
+ #
57
+ # @param kws [Hash] Keyword arguments for customizing the join.
58
+ #
59
+ # @option kws css [String] Additional CSS classes for styling. Common
60
+ # options include:
61
+ # - Direction: `join-vertical` for vertical stacking
62
+ # - Size: `min-w-32`, `w-full`
63
+ # - Spacing: `gap-0`, `gap-px` (if gaps are needed)
64
+ #
65
+ def initialize(**kws)
66
+ super
67
+ end
68
+
69
+ #
70
+ # Sets up the component's CSS classes.
71
+ #
4
72
  def before_render
5
73
  add_css(:component, "join")
6
74
  end
7
75
 
76
+ #
77
+ # Renders all joined items in sequence.
78
+ #
8
79
  def call
9
80
  part(:component) do
10
81
  items.each do |item|
@@ -1,8 +1,67 @@
1
+ #
2
+ # The StackComponent creates a 3D stacking effect by layering elements on top
3
+ # of each other. Common use cases include:
4
+ # - Notification cards or alerts.
5
+ # - Photo galleries with overlap.
6
+ # - Interactive card games.
7
+ # - Animated content transitions.
8
+ #
9
+ # The component automatically positions children in a stack, with each element
10
+ # appearing on top of the previous one. This creates depth and visual interest
11
+ # in your layouts.
12
+ #
13
+ # @loco_example Basic Card Stack
14
+ # = daisy_stack do
15
+ # = daisy_card(css: "bg-base-100/80 shadow") do
16
+ # Top Card
17
+ # = daisy_card(css: "bg-base-100/80 shadow") do
18
+ # Middle Card
19
+ # = daisy_card(css: "bg-base-100/80 shadow") do
20
+ # Bottom Card
21
+ #
22
+ # @loco_example Animated Stack
23
+ # = daisy_stack do
24
+ # = daisy_card(css: "bg-primary cursor-pointer",
25
+ # html: { onclick: "anime({
26
+ # targets: this,
27
+ # translateY: '-100%',
28
+ # opacity: 0,
29
+ # complete: (el) => el.remove()
30
+ # })" }) do
31
+ # Click to Remove
32
+ #
33
+ # @loco_example Image Stack
34
+ # = daisy_stack(css: "w-96") do
35
+ # %img{ src: "image1.jpg" }
36
+ # %img{ src: "image2.jpg" }
37
+ # %img{ src: "image3.jpg" }
38
+ #
1
39
  class Daisy::Layout::StackComponent < LocoMotion::BaseComponent
40
+ #
41
+ # Creates a new Stack component.
42
+ #
43
+ # @param kws [Hash] Keyword arguments for customizing the stack.
44
+ #
45
+ # @option kws css [String] Additional CSS classes for styling. Common
46
+ # options include:
47
+ # - Size: `w-96`, `h-64`
48
+ # - Spacing: `gap-2`, `space-y-4`
49
+ # - Position: `relative`, `absolute`
50
+ #
51
+ def initialize(**kws)
52
+ super
53
+ end
54
+
55
+ #
56
+ # Sets up the component's CSS classes.
57
+ #
2
58
  def before_render
3
59
  add_css(:component, "stack")
4
60
  end
5
61
 
62
+ #
63
+ # Renders the component and its stacked content.
64
+ #
6
65
  def call
7
66
  part(:component) { content }
8
67
  end
@@ -0,0 +1,78 @@
1
+ #
2
+ # The BrowserComponent creates a realistic browser window mockup, perfect for:
3
+ # - Showcasing web applications.
4
+ # - Creating website previews.
5
+ # - Demonstrating responsive designs.
6
+ # - Building marketing materials.
7
+ #
8
+ # The component includes an optional toolbar for URL input and browser
9
+ # controls, and a content area that can contain any content you wish to
10
+ # display.
11
+ #
12
+ # @slot toolbar [LocoMotion::BasicComponent] An optional toolbar section,
13
+ # typically containing a URL input field or navigation controls.
14
+ #
15
+ # @loco_example Basic Browser with URL
16
+ # = daisy_browser(css: "w-full border border-base-300") do |browser|
17
+ # - browser.with_toolbar do
18
+ # %input.input.input-bordered{
19
+ # placeholder: "https://example.com" }
20
+ #
21
+ # .border-t.border-base-300.p-4
22
+ # Your website content here
23
+ #
24
+ # @loco_example Styled Browser
25
+ # = daisy_browser(css: "bg-primary border-2") do |browser|
26
+ # - browser.with_toolbar do
27
+ # .flex.gap-2.px-4
28
+ # = daisy_button(icon: "chevron-left",
29
+ # css: "btn-circle btn-sm")
30
+ # = daisy_button(icon: "chevron-right",
31
+ # css: "btn-circle btn-sm")
32
+ # %input.input.input-sm.flex-1{
33
+ # placeholder: "Search..." }
34
+ #
35
+ # .bg-base-100.p-8.text-center
36
+ # Professional website mockup
37
+ #
38
+ # @loco_example Content-Only Browser
39
+ # = daisy_browser(css: "border shadow-lg") do
40
+ # .p-4
41
+ # Simple browser frame without toolbar
42
+ #
43
+ class Daisy::Mockup::BrowserComponent < LocoMotion::BaseComponent
44
+
45
+ renders_one :toolbar, LocoMotion::BasicComponent.build(css: "mockup-browser-toolbar")
46
+
47
+ #
48
+ # Creates a new Browser component.
49
+ #
50
+ # @option kws css [String] Additional CSS classes for styling. Common
51
+ # options include:
52
+ # - Size: `w-full`, `max-w-4xl`
53
+ # - Border: `border`, `border-2`, `border-primary`
54
+ # - Background: `bg-base-100`, `bg-primary`
55
+ # - Shadow: `shadow`, `shadow-lg`
56
+ #
57
+ def initialize(**kws)
58
+ super(**kws)
59
+ end
60
+
61
+ #
62
+ # Sets up the component's CSS classes.
63
+ #
64
+ def before_render
65
+ add_css(:component, "mockup-browser")
66
+ end
67
+
68
+ #
69
+ # Renders the toolbar (if present) and content.
70
+ #
71
+ def call
72
+ part(:component) do
73
+ concat(toolbar) if toolbar
74
+ concat(content)
75
+ end
76
+ end
77
+
78
+ end