loco_motion-rails 0.5.1 → 0.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 291e3ba73e33d911e88db916a9c97f0f4ec7c5934d3f46809eb7135e9c34f748
4
- data.tar.gz: 2c8524a9eee93232f1baffbbe98d07bb307c9313a312a600f91df0ec75dc0d55
3
+ metadata.gz: 45493a564ee06b46d005e1b8fd3d0b6494ca86fed95644180b037e03d9929187
4
+ data.tar.gz: 0235c74fb512553dc2876491adcde9bbbf67df912c08da4576950f6017bf829e
5
5
  SHA512:
6
- metadata.gz: f52c7ab4b284b2bf5ddb4708a6e1a2cfde93f77f41addbd3f1ea03e2ea73671b24aacfc6cab78382384d33194e98506b65f1530a55e9d6336228b7717115d587
7
- data.tar.gz: 7ed78e04bb1839b1332ca18d64a26ba6847d4c67b355fd44e44c383963799dd53c96c8c0148e72024728fb06647db5e1fbc5e2fbefd71554ca702fd17926d6a9
6
+ metadata.gz: 1a9eeacda41e80c0bcc9be24ad40b6b678974b5991259fcf023d3f63763cf595b2de010fe75b34e68e7ad38edf854229d0e55ddfea6d81e3a62038bb836dffe8
7
+ data.tar.gz: 807ac93a53b5b8ca6cc4e7775f0e5c1f554f0d0ce9abf2781247fa2ff5b30f92f1d485c3bd1db88d49eb65bf628ef2c828d2117ca45b0e1efff751df7b4822d8
data/README.md CHANGED
@@ -994,6 +994,10 @@ the GitHub Discussions feature and let us know!
994
994
  the `lib/loco_motion/patches/view_component/slot_loco_parent_patch.rb`
995
995
  - [ ] Make the tooltips documentation button a component and use it for the
996
996
  Labelable concern docs too
997
+ - [x] Update LLM.txt with better examples showing actual usage scenarios
998
+ - Right now, LLMs don't see enough things like HREFs in buttons / links
999
+ - Cards still try to do a `card.with_body` or even `card.with_title` for
1000
+ just a string
997
1001
 
998
1002
  [1]: https://loco-motion.profoundry.us/
999
1003
  [2]: https://loco-motion-demo-staging.profoundry.us/
@@ -15,6 +15,10 @@
15
15
  # = daisy_figure do
16
16
  # Content when no image is provided
17
17
  #
18
+ # @loco_example Image Position Bottom
19
+ # = daisy_figure(src: "example.jpg", position: :bottom) do
20
+ # Caption appears above the image
21
+ #
18
22
  class Daisy::DataDisplay::FigureComponent < LocoMotion::BaseComponent
19
23
  include LocoMotion::Concerns::LinkableComponent
20
24
 
@@ -26,12 +30,18 @@ class Daisy::DataDisplay::FigureComponent < LocoMotion::BaseComponent
26
30
  #
27
31
  # @option kws src [String] URL of the image to display in the figure.
28
32
  #
33
+ # @option kws position [Symbol] Position of the image relative to content.
34
+ # Must be :top (default) or :bottom.
35
+ #
29
36
  # @option kws css [String] Additional CSS classes for styling.
30
37
  #
31
38
  def initialize(**kws, &block)
32
39
  super
33
40
 
34
41
  @src = kws[:src]
42
+ @position = kws[:position] || :top
43
+
44
+ validate_position!
35
45
  end
36
46
 
37
47
  def before_render
@@ -43,12 +53,23 @@ class Daisy::DataDisplay::FigureComponent < LocoMotion::BaseComponent
43
53
 
44
54
  def call
45
55
  part(:component) do
46
- if @src
47
- concat(part(:image))
56
+ if @position == :bottom
57
+ # Show content first, then image
58
+ concat(content)
59
+ concat(part(:image)) if @src
60
+ else
61
+ # Default: show image first, then content
62
+ concat(part(:image)) if @src
63
+ concat(content)
48
64
  end
65
+ end
66
+ end
67
+
68
+ private
49
69
 
50
- # Always show the content
51
- concat(content)
70
+ def validate_position!
71
+ unless %i[top bottom].include?(@position)
72
+ raise ArgumentError, "position must be :top or :bottom, got '#{@position}'"
52
73
  end
53
74
  end
54
75
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LocoMotion
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loco_motion-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topher Fangio