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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/phlex_forms/class_merge.rb +17 -7
- data/lib/phlex_forms/delegated_field.rb +4 -1
- data/lib/phlex_forms/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6247172989a97967a471140547a44b29058f77827ce8d699b2f8ae9d0aa60ce
|
|
4
|
+
data.tar.gz: 5aaeccec4ad938988ee09ad31f8b42ca92bc29f55fd3a5c481a1d1b21f17d1b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
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
|
|
47
|
-
# is not a recognized
|
|
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
|
-
|
|
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
|
data/lib/phlex_forms/version.rb
CHANGED