phlex-forms 0.2.8 → 0.2.9

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: 9e69e13250ea52121abd2e7e16f91e17b63f7e470131d333513037ad57cbb4cb
4
- data.tar.gz: a5d9179052c02fa4462434d08df73164e5cca3506df42fdd6d5f78852a8cf0ab
3
+ metadata.gz: f6247172989a97967a471140547a44b29058f77827ce8d699b2f8ae9d0aa60ce
4
+ data.tar.gz: 5aaeccec4ad938988ee09ad31f8b42ca92bc29f55fd3a5c481a1d1b21f17d1b8
5
5
  SHA512:
6
- metadata.gz: 53ea74ca2f23ad56b79180c453dafb9dd766604dfb380f579b30bb76ca9fd5be957a4b0e77bb9035069074563b25d63b80e1d372057aefda0d7be8cf1eb313ea
7
- data.tar.gz: dc905da47d50a3a43f83adb65faa3f386dcfbcd70e1d7d25d7e646894f994331eb1c3c309eb666271cf03ef1e182c94a1ea19a2a42515af13d7fb1529ecd77b0
6
+ metadata.gz: 4dd96934af47c850597cd9f750bf03f97052301e6d9850239cb864f13fe914d17767b9c00f4b30fb23dcb0ea44c92b4e3d9f463d90e3832823d00dffd6700f70
7
+ data.tar.gz: 0a8acefb7a3bb47d002633482592aec0aa425b4b5df99d8a360efeb37455e1b9ea4ff9ba8dd918c4b15cdf08aa72ac8ab8bcbda6f37ef5c8d9f6091e966a540e
data/CHANGELOG.md CHANGED
@@ -45,6 +45,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
45
45
 
46
46
  ### Fixed
47
47
 
48
+ - **A caller width class stacked with the `w-full` default instead of replacing
49
+ it**: `DelegatedField#width_class` joined `"w-full"` and the caller's
50
+ `class:` verbatim, so `Forms::Select(class: "w-36")` emitted
51
+ `class="... w-full w-36"` and stylesheet source order — not author intent —
52
+ picked the winner (in practice `w-full`, which blew filter selects up to full
53
+ width; zazu#2934). `ClassMerge` gained a width family (anchored `w-*`, so
54
+ `min-w-*`/`max-w-*` still compose) and `width_class` merges through it —
55
+ last width wins, matching the daisyui size/color family semantics.
56
+
48
57
  - **`f.Radio` / `Field#radio` rendered the model's current value on every radio
49
58
  instead of each radio's own value**: `field_attributes` carried `value:
50
59
  field_value` and was splatted after the explicit positional value, clobbering
@@ -9,14 +9,21 @@ module PhlexForms
9
9
  # the same family, the LAST occurrence wins — matching Tailwind/daisyui
10
10
  # intuition (the later class overrides the earlier).
11
11
  #
12
- # We deliberately do NOT depend on tailwind_merge: on form fields, callers pass
13
- # daisyui modifiers (which this handles) rather than conflicting core Tailwind
14
- # utilities, so tailwind_merge would add a runtime dependency for a conflict
15
- # that does not occur here. Non-conflicting utilities (`w-full`, `py-0`, ...)
16
- # simply pass through in order.
12
+ # Width utilities (`w-*`) are the one core-Tailwind family this gem injects a
13
+ # default for (DelegatedField's `w-full`), so they conflict the same way: a
14
+ # caller's `w-36` must REPLACE the default, or both land on the element and
15
+ # stylesheet source order — not author intent decides which applies.
16
+ #
17
+ # We deliberately do NOT depend on tailwind_merge: daisyui modifier families
18
+ # and the width family are the only conflicts that occur on form fields, so
19
+ # tailwind_merge would add a runtime dependency for conflicts this handles.
20
+ # Other non-conflicting utilities (`py-0`, `min-w-32`, ...) pass through in
21
+ # order.
17
22
  module ClassMerge
18
23
  SIZE = /-(xs|sm|md|lg|xl)\z/
19
24
  COLOR = /-(primary|secondary|accent|neutral|info|success|warning|error)\z/
25
+ # Anchored so min-w-*/max-w-* (different CSS properties) stay out of the family.
26
+ WIDTH = /\Aw-/
20
27
 
21
28
  module_function
22
29
 
@@ -43,9 +50,12 @@ module PhlexForms
43
50
  end
44
51
  end
45
52
 
46
- # A stable bucket key like "input:size" / "select:color", or nil if the token
47
- # is not a recognized daisyui size/color modifier.
53
+ # A stable bucket key like "width" / "input:size" / "select:color", or nil if
54
+ # the token is not a recognized conflicting family. WIDTH is checked first so
55
+ # a `w-*` token can never be mis-bucketed as a daisyui modifier.
48
56
  def family_key(token)
57
+ return "width" if WIDTH.match?(token)
58
+
49
59
  if (m = token.match(SIZE))
50
60
  "#{token[0...m.begin(0)]}:size"
51
61
  elsif (m = token.match(COLOR))
@@ -42,10 +42,13 @@ module PhlexForms
42
42
  attrs.compact
43
43
  end
44
44
 
45
+ # Merged via ClassMerge so a caller width (`w-36`) REPLACES the default
46
+ # instead of stacking with it (`w-full w-36` leaves the winner to stylesheet
47
+ # source order — that's how admin filter selects went full-width, zazu#2934).
45
48
  def width_class
46
49
  return @attributes[:class] unless @full_width
47
50
 
48
- ["w-full", @attributes[:class]].compact.join(" ")
51
+ ClassMerge.merge("w-full", @attributes[:class])
49
52
  end
50
53
 
51
54
  # Unstyled variant of binding_attributes for the Plain theme: caller classes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexForms
4
- VERSION = "0.2.8"
4
+ VERSION = "0.2.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson