loco_motion-rails 0.4.0 → 0.5.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 (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -1
  3. data/app/components/daisy/actions/button_component.html.haml +2 -2
  4. data/app/components/daisy/actions/button_component.rb +98 -59
  5. data/app/components/daisy/actions/dropdown_component.html.haml +1 -2
  6. data/app/components/daisy/actions/dropdown_component.rb +7 -10
  7. data/app/components/daisy/actions/modal_component.html.haml +10 -8
  8. data/app/components/daisy/actions/modal_component.rb +6 -6
  9. data/app/components/daisy/actions/swap_component.rb +13 -9
  10. data/app/components/daisy/actions/theme_controller.js +113 -0
  11. data/app/components/daisy/actions/theme_controller_component.rb +58 -17
  12. data/app/components/daisy/actions/theme_preview_component.html.haml +5 -0
  13. data/app/components/daisy/actions/theme_preview_component.rb +68 -0
  14. data/app/components/daisy/data_display/accordion_component.html.haml +0 -1
  15. data/app/components/daisy/data_display/accordion_component.rb +10 -3
  16. data/app/components/daisy/data_display/avatar_component.html.haml +1 -1
  17. data/app/components/daisy/data_display/avatar_component.rb +17 -7
  18. data/app/components/daisy/data_display/badge_component.rb +122 -4
  19. data/app/components/daisy/data_display/card_component.html.haml +1 -1
  20. data/app/components/daisy/data_display/card_component.rb +20 -6
  21. data/app/components/daisy/data_display/chat_component.rb +2 -2
  22. data/app/components/daisy/data_display/collapse_component.rb +9 -5
  23. data/app/components/daisy/data_display/countdown_component.rb +15 -5
  24. data/app/components/daisy/data_display/figure_component.rb +8 -3
  25. data/app/components/daisy/data_display/kbd_component.rb +13 -4
  26. data/app/components/daisy/data_display/list_component.html.haml +5 -0
  27. data/app/components/daisy/data_display/list_component.rb +82 -0
  28. data/app/components/daisy/data_display/list_item_component.rb +39 -0
  29. data/app/components/daisy/data_display/stat_component.html.haml +5 -6
  30. data/app/components/daisy/data_display/stat_component.rb +21 -8
  31. data/app/components/daisy/data_display/status_component.rb +47 -0
  32. data/app/components/daisy/data_display/timeline_component.rb +1 -1
  33. data/app/components/daisy/data_input/cally_component.html.haml +14 -0
  34. data/app/components/daisy/data_input/cally_component.rb +182 -0
  35. data/app/components/daisy/data_input/cally_input_component.html.haml +5 -0
  36. data/app/components/daisy/data_input/cally_input_component.rb +165 -0
  37. data/app/components/daisy/data_input/cally_input_controller.js +235 -0
  38. data/app/components/daisy/data_input/checkbox_component.html.haml +20 -0
  39. data/app/components/daisy/data_input/checkbox_component.rb +21 -7
  40. data/app/components/daisy/data_input/fieldset_component.html.haml +8 -0
  41. data/app/components/daisy/data_input/fieldset_component.rb +57 -0
  42. data/app/components/daisy/data_input/file_input_component.rb +6 -0
  43. data/app/components/daisy/data_input/filter_component.html.haml +3 -0
  44. data/app/components/daisy/data_input/filter_component.rb +221 -0
  45. data/app/components/daisy/data_input/label_component.rb +2 -2
  46. data/app/components/daisy/data_input/radio_button_component.rb +1 -1
  47. data/app/components/daisy/data_input/rating_component.html.haml +0 -2
  48. data/app/components/daisy/data_input/rating_component.rb +3 -2
  49. data/app/components/daisy/data_input/select_component.html.haml +27 -15
  50. data/app/components/daisy/data_input/select_component.rb +152 -10
  51. data/app/components/daisy/data_input/text_area_component.rb +11 -8
  52. data/app/components/daisy/data_input/text_input_component.html.haml +25 -4
  53. data/app/components/daisy/data_input/text_input_component.rb +38 -36
  54. data/app/components/daisy/data_input/toggle_component.rb +12 -0
  55. data/app/components/daisy/feedback/alert_component.html.haml +1 -1
  56. data/app/components/daisy/feedback/alert_component.rb +86 -2
  57. data/app/components/daisy/feedback/loading_component.rb +10 -3
  58. data/app/components/daisy/feedback/skeleton_component.rb +1 -1
  59. data/app/components/daisy/layout/divider_component.rb +4 -2
  60. data/app/components/daisy/layout/drawer_component.html.haml +0 -1
  61. data/app/components/daisy/layout/footer_component.rb +6 -6
  62. data/app/components/daisy/mockup/device_component.rb +15 -18
  63. data/app/components/daisy/navigation/breadcrumbs_component.html.haml +0 -1
  64. data/app/components/daisy/navigation/breadcrumbs_component.rb +84 -9
  65. data/app/components/daisy/navigation/dock_component.rb +146 -0
  66. data/app/components/daisy/navigation/link_component.rb +18 -9
  67. data/app/components/daisy/navigation/menu_component.rb +15 -9
  68. data/app/components/daisy/navigation/navbar_component.html.haml +1 -1
  69. data/app/components/daisy/navigation/navbar_component.rb +2 -13
  70. data/app/components/daisy/navigation/steps_component.rb +6 -6
  71. data/app/components/daisy/navigation/tabs_component.html.haml +0 -1
  72. data/app/components/daisy/navigation/tabs_component.rb +26 -16
  73. data/app/components/hero/icon_component.rb +15 -5
  74. data/app/helpers/daisy/form_builder_helper.rb +30 -3
  75. data/app/views/examples/daisy/data_input/filters.html.haml +62 -0
  76. data/lib/hero.rb +1 -1
  77. data/lib/loco_motion/base_component.rb +44 -1
  78. data/lib/loco_motion/component_config.rb +1 -0
  79. data/lib/loco_motion/concerns/iconable_component.rb +134 -0
  80. data/lib/loco_motion/concerns/labelable_component.rb +142 -0
  81. data/lib/loco_motion/concerns/linkable_component.rb +40 -0
  82. data/lib/loco_motion/concerns/tippable_component.rb +25 -10
  83. data/lib/loco_motion/helpers.rb +27 -18
  84. data/lib/loco_motion/patches/view_component/slot_loco_parent_patch.rb +37 -0
  85. data/lib/loco_motion/patches/view_component/slotable_default_patch.rb +21 -0
  86. data/lib/loco_motion/version.rb +1 -1
  87. data/lib/loco_motion.rb +12 -2
  88. metadata +65 -19
  89. data/app/components/daisy/actions/theme_controller_component.html.haml +0 -5
  90. data/app/components/daisy/layout/artboard_component.rb +0 -59
  91. data/app/components/daisy/navigation/bottom_nav_component.rb +0 -138
@@ -1,138 +0,0 @@
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
- #
25
- class Daisy::Navigation::BottomNavComponent < LocoMotion::BaseComponent
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
- #
47
- class Daisy::Navigation::BottomNavSectionComponent < LocoMotion::BaseComponent
48
-
49
- define_parts :icon, :title
50
-
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)
74
-
75
- @icon = config_option(:icon)
76
- @icon_variant = config_option(:icon_variant, :outline)
77
- @title = config_option(:title)
78
- @href = config_option(:href)
79
- @active = config_option(:active, false)
80
- end
81
-
82
- def before_render
83
- if @href
84
- set_tag_name(:component, :a)
85
- add_html(:component, href: @href)
86
- else
87
- set_tag_name(:component, :button)
88
- end
89
-
90
- add_css(:component, "active") if @active
91
-
92
- add_css(:icon, "[:where(&)]:size-6")
93
-
94
- set_tag_name(:title, :span)
95
- add_css(:title, "btm-nav-label")
96
- end
97
-
98
- def call
99
- part(:component) do
100
- concat(hero_icon(@icon, variant: @icon_variant, html: rendered_html(:icon))) if @icon
101
- concat(part(:title) { @title }) if @title
102
- concat(content)
103
- end
104
- end
105
-
106
- end
107
-
108
- renders_many :sections, Daisy::Navigation::BottomNavSectionComponent
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
-
124
- def before_render
125
- add_css(:component, "btm-nav")
126
- end
127
-
128
- def call
129
- part(:component) do
130
- sections.each do |section|
131
- concat(section)
132
- end
133
-
134
- concat(content)
135
- end
136
- end
137
-
138
- end