loco_motion-rails 0.0.8 → 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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +62 -14
  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 +106 -0
  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 +98 -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 +84 -0
  46. data/app/components/daisy/data_input/radio_button_component.rb +87 -0
  47. data/app/components/daisy/data_input/range_component.rb +95 -0
  48. data/app/components/daisy/data_input/rating_component.html.haml +11 -0
  49. data/app/components/daisy/data_input/rating_component.rb +139 -0
  50. data/app/components/daisy/data_input/select_component.html.haml +27 -0
  51. data/app/components/daisy/data_input/select_component.rb +320 -0
  52. data/app/components/daisy/data_input/text_area_component.rb +127 -0
  53. data/app/components/daisy/data_input/text_input_component.html.haml +27 -0
  54. data/app/components/daisy/data_input/text_input_component.rb +142 -0
  55. data/app/components/daisy/data_input/toggle_component.rb +48 -0
  56. data/app/components/daisy/feedback/alert_component.html.haml +1 -1
  57. data/app/components/daisy/feedback/alert_component.rb +86 -2
  58. data/app/components/daisy/feedback/loading_component.rb +10 -3
  59. data/app/components/daisy/feedback/skeleton_component.rb +1 -1
  60. data/app/components/daisy/layout/divider_component.rb +4 -2
  61. data/app/components/daisy/layout/drawer_component.html.haml +0 -1
  62. data/app/components/daisy/layout/footer_component.rb +6 -6
  63. data/app/components/daisy/mockup/device_component.rb +15 -18
  64. data/app/components/daisy/navigation/breadcrumbs_component.html.haml +0 -1
  65. data/app/components/daisy/navigation/breadcrumbs_component.rb +84 -9
  66. data/app/components/daisy/navigation/dock_component.rb +146 -0
  67. data/app/components/daisy/navigation/link_component.rb +18 -9
  68. data/app/components/daisy/navigation/menu_component.rb +15 -9
  69. data/app/components/daisy/navigation/navbar_component.html.haml +1 -1
  70. data/app/components/daisy/navigation/navbar_component.rb +2 -13
  71. data/app/components/daisy/navigation/steps_component.rb +6 -6
  72. data/app/components/daisy/navigation/tabs_component.html.haml +0 -1
  73. data/app/components/daisy/navigation/tabs_component.rb +26 -16
  74. data/app/components/hero/icon_component.rb +15 -5
  75. data/app/helpers/daisy/form_builder_helper.rb +186 -0
  76. data/app/views/examples/daisy/data_input/filters.html.haml +62 -0
  77. data/lib/daisy.rb +5 -0
  78. data/lib/hero.rb +1 -1
  79. data/lib/loco_motion/base_component.rb +53 -3
  80. data/lib/loco_motion/component_config.rb +1 -0
  81. data/lib/loco_motion/concerns/iconable_component.rb +134 -0
  82. data/lib/loco_motion/concerns/labelable_component.rb +142 -0
  83. data/lib/loco_motion/concerns/linkable_component.rb +40 -0
  84. data/lib/loco_motion/concerns/tippable_component.rb +25 -10
  85. data/lib/loco_motion/engine.rb +6 -0
  86. data/lib/loco_motion/helpers.rb +38 -17
  87. data/lib/loco_motion/patches/view_component/slot_loco_parent_patch.rb +37 -0
  88. data/lib/loco_motion/patches/view_component/slotable_default_patch.rb +21 -0
  89. data/lib/loco_motion/version.rb +1 -1
  90. data/lib/loco_motion.rb +12 -2
  91. metadata +93 -21
  92. data/app/components/daisy/actions/theme_controller_component.html.haml +0 -5
  93. data/app/components/daisy/layout/artboard_component.rb +0 -59
  94. data/app/components/daisy/navigation/bottom_nav_component.rb +0 -138
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loco_motion-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topher Fangio
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-03-01 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: benchmark
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '0.4'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '0.4'
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: haml-rails
15
28
  requirement: !ruby/object:Gem::Requirement
@@ -25,47 +38,53 @@ dependencies:
25
38
  - !ruby/object:Gem::Version
26
39
  version: '2.1'
27
40
  - !ruby/object:Gem::Dependency
28
- name: heroicons-rails
41
+ name: rails_heroicon
29
42
  requirement: !ruby/object:Gem::Requirement
30
43
  requirements:
31
44
  - - "~>"
32
45
  - !ruby/object:Gem::Version
33
- version: '1.2'
46
+ version: 2.3.0
34
47
  type: :runtime
35
48
  prerelease: false
36
49
  version_requirements: !ruby/object:Gem::Requirement
37
50
  requirements:
38
51
  - - "~>"
39
52
  - !ruby/object:Gem::Version
40
- version: '1.2'
53
+ version: 2.3.0
41
54
  - !ruby/object:Gem::Dependency
42
55
  name: rails
43
56
  requirement: !ruby/object:Gem::Requirement
44
57
  requirements:
45
- - - "~>"
58
+ - - ">="
46
59
  - !ruby/object:Gem::Version
47
60
  version: '6.1'
61
+ - - "<"
62
+ - !ruby/object:Gem::Version
63
+ version: '8.1'
48
64
  type: :runtime
49
65
  prerelease: false
50
66
  version_requirements: !ruby/object:Gem::Requirement
51
67
  requirements:
52
- - - "~>"
68
+ - - ">="
53
69
  - !ruby/object:Gem::Version
54
70
  version: '6.1'
71
+ - - "<"
72
+ - !ruby/object:Gem::Version
73
+ version: '8.1'
55
74
  - !ruby/object:Gem::Dependency
56
75
  name: view_component
57
76
  requirement: !ruby/object:Gem::Requirement
58
77
  requirements:
59
78
  - - "~>"
60
79
  - !ruby/object:Gem::Version
61
- version: '3.14'
80
+ version: '3.22'
62
81
  type: :runtime
63
82
  prerelease: false
64
83
  version_requirements: !ruby/object:Gem::Requirement
65
84
  requirements:
66
85
  - - "~>"
67
86
  - !ruby/object:Gem::Version
68
- version: '3.14'
87
+ version: '3.22'
69
88
  - !ruby/object:Gem::Dependency
70
89
  name: base64
71
90
  requirement: !ruby/object:Gem::Requirement
@@ -207,19 +226,19 @@ dependencies:
207
226
  - !ruby/object:Gem::Version
208
227
  version: '1.3'
209
228
  - !ruby/object:Gem::Dependency
210
- name: heroicons-rails
229
+ name: rails_heroicon
211
230
  requirement: !ruby/object:Gem::Requirement
212
231
  requirements:
213
232
  - - "~>"
214
233
  - !ruby/object:Gem::Version
215
- version: '1.2'
234
+ version: 2.3.0
216
235
  type: :development
217
236
  prerelease: false
218
237
  version_requirements: !ruby/object:Gem::Requirement
219
238
  requirements:
220
239
  - - "~>"
221
240
  - !ruby/object:Gem::Version
222
- version: '1.2'
241
+ version: 2.3.0
223
242
  - !ruby/object:Gem::Dependency
224
243
  name: pry
225
244
  requirement: !ruby/object:Gem::Requirement
@@ -238,16 +257,22 @@ dependencies:
238
257
  name: rails
239
258
  requirement: !ruby/object:Gem::Requirement
240
259
  requirements:
241
- - - "~>"
260
+ - - ">="
242
261
  - !ruby/object:Gem::Version
243
262
  version: '6.1'
263
+ - - "<"
264
+ - !ruby/object:Gem::Version
265
+ version: '8.0'
244
266
  type: :development
245
267
  prerelease: false
246
268
  version_requirements: !ruby/object:Gem::Requirement
247
269
  requirements:
248
- - - "~>"
270
+ - - ">="
249
271
  - !ruby/object:Gem::Version
250
272
  version: '6.1'
273
+ - - "<"
274
+ - !ruby/object:Gem::Version
275
+ version: '8.0'
251
276
  - !ruby/object:Gem::Dependency
252
277
  name: redcarpet
253
278
  requirement: !ruby/object:Gem::Requirement
@@ -338,6 +363,20 @@ dependencies:
338
363
  - - "~>"
339
364
  - !ruby/object:Gem::Version
340
365
  version: 0.9.34
366
+ - !ruby/object:Gem::Dependency
367
+ name: algoliasearch-rails
368
+ requirement: !ruby/object:Gem::Requirement
369
+ requirements:
370
+ - - "~>"
371
+ - !ruby/object:Gem::Version
372
+ version: '2.2'
373
+ type: :development
374
+ prerelease: false
375
+ version_requirements: !ruby/object:Gem::Requirement
376
+ requirements:
377
+ - - "~>"
378
+ - !ruby/object:Gem::Version
379
+ version: '2.2'
341
380
  description: Advanced components and Rails management with LocoMotion.
342
381
  email: topher@profoundry.us
343
382
  executables: []
@@ -354,8 +393,10 @@ files:
354
393
  - app/components/daisy/actions/modal_component.rb
355
394
  - app/components/daisy/actions/swap_component.html.haml
356
395
  - app/components/daisy/actions/swap_component.rb
357
- - app/components/daisy/actions/theme_controller_component.html.haml
396
+ - app/components/daisy/actions/theme_controller.js
358
397
  - app/components/daisy/actions/theme_controller_component.rb
398
+ - app/components/daisy/actions/theme_preview_component.html.haml
399
+ - app/components/daisy/actions/theme_preview_component.rb
359
400
  - app/components/daisy/data_display/accordion_component.html.haml
360
401
  - app/components/daisy/data_display/accordion_component.rb
361
402
  - app/components/daisy/data_display/avatar_component.html.haml
@@ -376,14 +417,41 @@ files:
376
417
  - app/components/daisy/data_display/diff_component.rb
377
418
  - app/components/daisy/data_display/figure_component.rb
378
419
  - app/components/daisy/data_display/kbd_component.rb
420
+ - app/components/daisy/data_display/list_component.html.haml
421
+ - app/components/daisy/data_display/list_component.rb
422
+ - app/components/daisy/data_display/list_item_component.rb
379
423
  - app/components/daisy/data_display/stat_component.html.haml
380
424
  - app/components/daisy/data_display/stat_component.rb
425
+ - app/components/daisy/data_display/status_component.rb
381
426
  - app/components/daisy/data_display/table_component.html.haml
382
427
  - app/components/daisy/data_display/table_component.rb
383
428
  - app/components/daisy/data_display/timeline_component.html.haml
384
429
  - app/components/daisy/data_display/timeline_component.rb
385
430
  - app/components/daisy/data_display/timeline_event_component.html.haml
386
431
  - app/components/daisy/data_display/timeline_event_component.rb
432
+ - app/components/daisy/data_input/cally_component.html.haml
433
+ - app/components/daisy/data_input/cally_component.rb
434
+ - app/components/daisy/data_input/cally_input_component.html.haml
435
+ - app/components/daisy/data_input/cally_input_component.rb
436
+ - app/components/daisy/data_input/cally_input_controller.js
437
+ - app/components/daisy/data_input/checkbox_component.html.haml
438
+ - app/components/daisy/data_input/checkbox_component.rb
439
+ - app/components/daisy/data_input/fieldset_component.html.haml
440
+ - app/components/daisy/data_input/fieldset_component.rb
441
+ - app/components/daisy/data_input/file_input_component.rb
442
+ - app/components/daisy/data_input/filter_component.html.haml
443
+ - app/components/daisy/data_input/filter_component.rb
444
+ - app/components/daisy/data_input/label_component.rb
445
+ - app/components/daisy/data_input/radio_button_component.rb
446
+ - app/components/daisy/data_input/range_component.rb
447
+ - app/components/daisy/data_input/rating_component.html.haml
448
+ - app/components/daisy/data_input/rating_component.rb
449
+ - app/components/daisy/data_input/select_component.html.haml
450
+ - app/components/daisy/data_input/select_component.rb
451
+ - app/components/daisy/data_input/text_area_component.rb
452
+ - app/components/daisy/data_input/text_input_component.html.haml
453
+ - app/components/daisy/data_input/text_input_component.rb
454
+ - app/components/daisy/data_input/toggle_component.rb
387
455
  - app/components/daisy/feedback/alert_component.html.haml
388
456
  - app/components/daisy/feedback/alert_component.rb
389
457
  - app/components/daisy/feedback/loading_component.rb
@@ -392,7 +460,6 @@ files:
392
460
  - app/components/daisy/feedback/skeleton_component.rb
393
461
  - app/components/daisy/feedback/toast_component.rb
394
462
  - app/components/daisy/feedback/tooltip_component.rb
395
- - app/components/daisy/layout/artboard_component.rb
396
463
  - app/components/daisy/layout/divider_component.rb
397
464
  - app/components/daisy/layout/drawer_component.html.haml
398
465
  - app/components/daisy/layout/drawer_component.rb
@@ -406,9 +473,9 @@ files:
406
473
  - app/components/daisy/mockup/code_component.rb
407
474
  - app/components/daisy/mockup/device_component.rb
408
475
  - app/components/daisy/mockup/frame_component.rb
409
- - app/components/daisy/navigation/bottom_nav_component.rb
410
476
  - app/components/daisy/navigation/breadcrumbs_component.html.haml
411
477
  - app/components/daisy/navigation/breadcrumbs_component.rb
478
+ - app/components/daisy/navigation/dock_component.rb
412
479
  - app/components/daisy/navigation/link_component.rb
413
480
  - app/components/daisy/navigation/menu_component.html.haml
414
481
  - app/components/daisy/navigation/menu_component.rb
@@ -418,23 +485,29 @@ files:
418
485
  - app/components/daisy/navigation/tabs_component.html.haml
419
486
  - app/components/daisy/navigation/tabs_component.rb
420
487
  - app/components/hero/icon_component.rb
488
+ - app/helpers/daisy/form_builder_helper.rb
489
+ - app/views/examples/daisy/data_input/filters.html.haml
421
490
  - lib/daisy.rb
422
491
  - lib/hero.rb
423
492
  - lib/loco_motion.rb
424
493
  - lib/loco_motion/base_component.rb
425
494
  - lib/loco_motion/basic_component.rb
426
495
  - lib/loco_motion/component_config.rb
496
+ - lib/loco_motion/concerns/iconable_component.rb
497
+ - lib/loco_motion/concerns/labelable_component.rb
498
+ - lib/loco_motion/concerns/linkable_component.rb
427
499
  - lib/loco_motion/concerns/tippable_component.rb
428
500
  - lib/loco_motion/configuration.rb
429
501
  - lib/loco_motion/engine.rb
430
502
  - lib/loco_motion/errors.rb
431
503
  - lib/loco_motion/helpers.rb
504
+ - lib/loco_motion/patches/view_component/slot_loco_parent_patch.rb
505
+ - lib/loco_motion/patches/view_component/slotable_default_patch.rb
432
506
  - lib/loco_motion/version.rb
433
507
  homepage: https://rubygems.org/gems/loco_motion-rails
434
508
  licenses:
435
509
  - MIT
436
510
  metadata: {}
437
- post_install_message:
438
511
  rdoc_options: []
439
512
  require_paths:
440
513
  - lib
@@ -450,8 +523,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
450
523
  - !ruby/object:Gem::Version
451
524
  version: '0'
452
525
  requirements: []
453
- rubygems_version: 3.5.16
454
- signing_key:
526
+ rubygems_version: 3.6.7
455
527
  specification_version: 4
456
528
  summary: Ruby on Rails, loco fast!
457
529
  test_files: []
@@ -1,5 +0,0 @@
1
- = part(:component) do
2
- - @themes.map do |theme|
3
- %label.label.cursor-pointer.gap-4
4
- %span.label-text= theme.titleize
5
- %input.radio.theme-controller{ name: "theme", type: "radio", value: theme, checked: theme == "light"}
@@ -1,59 +0,0 @@
1
- #
2
- # The ArtboardComponent provides a fixed-size container that mimics mobile
3
- # device screens. It's particularly useful for:
4
- # - Prototyping mobile interfaces.
5
- # - Displaying responsive design examples.
6
- # - Creating device-specific mockups.
7
- #
8
- # The component includes preset sizes for common mobile devices and supports
9
- # both portrait and landscape orientations.
10
- #
11
- # @loco_example Portrait Mode
12
- # = daisy_artboard(css: "phone-4") do
13
- # = daisy_hero do
14
- # iPhone 13 (375×812)
15
- #
16
- # @loco_example Landscape Mode
17
- # = daisy_artboard(css: "phone-4 artboard-horizontal") do
18
- # = daisy_hero do
19
- # iPhone 13 (812×375)
20
- #
21
- # @loco_example Custom Demo Style
22
- # = daisy_artboard(css: "phone-1 artboard-demo") do
23
- # iPhone SE (320×568)
24
- #
25
- class Daisy::Layout::ArtboardComponent < LocoMotion::BaseComponent
26
-
27
- #
28
- # Creates a new Artboard component.
29
- #
30
- # @param args [Array] Positional arguments passed to the parent class.
31
- # @param kws [Hash] Keyword arguments for customizing the artboard.
32
- #
33
- # @option kws css [String] Additional CSS classes for styling. Common
34
- # options include:
35
- # - Device sizes: `phone-1` (320×568), `phone-2` (375×667),
36
- # `phone-3` (414×736), `phone-4` (375×812), `phone-5` (414×896),
37
- # `phone-6` (320×1024)
38
- # - Orientation: `artboard-horizontal` for landscape mode
39
- # - Demo style: `artboard-demo` for visible borders and background
40
- #
41
- def initialize(*args, **kws, &block)
42
- super
43
- end
44
-
45
- #
46
- # Sets up the component's CSS classes.
47
- #
48
- def before_render
49
- add_css(:component, "artboard")
50
- end
51
-
52
- #
53
- # Renders the component and its content.
54
- #
55
- def call
56
- part(:component) { content }
57
- end
58
-
59
- end
@@ -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