0.13.0
This release contains significant breaking changes. Check your component styles carefully when upgrading.
Added
- Add
:typeoption to modifiers, so that any attribute type can be used instead of only strings.
Changed
- Rename
mix dog.classestomix dog.safelist. - Rename
Doggo.classes/1toDoggo.safelist/1. - Include data attributes in
mix dog.safelistandDoggo.safelist/1output. - Use
data-attributes instead of classes for modifiers (see upgrade guide below). button_linkcomponent- Remove
disabled_classoption. - Use
data-disabledattribute instead of thedisabled_class(selector:[data-disabled]).
- Remove
fieldcomponent- Remove
addon_left_class,addon_right_class, andvisually_hidden_classoptions. - Use
data-addonattribute instead ofaddon_left_classandaddon_right_class(selectors:[data-addon~="left"],[data-addon~="right"]). - Use
data-visually-hiddenattribute instead ofvisually_hidden_class(selector:[data-visually-hidden]). - Use
data-invalidattribute instead ofhas-errorsclass (selector:[data-invalid]). - Use
data-stateattribute instead of{base_class}-switch-state-{on|off}classes (selectors:[data-state="on"],[data-state="off"]).
- Remove
frameandimagecomponent- Make
ratiorequired forframecomponent. - Change format of
ratioattribute (before:16-by-9, after:16:9). - Use
data-numeratoranddata-denominatorattributes instead of adding a class for the ratio (before:class="is-16-by-9", after:data-numerator="16" data-denominator="9").
- Make
iconandicon_spritecomponent- Remove
text_position_after_class,text_position_before_class,text_position_hidden_class, andvisually_hidden_classoptions. - Use
data-text-positionclass instead oftext_position_*classes (selectors:[data-text-position="before"],[data-text-position="after"],[data-text-position="hidden"]). - Use
data-visually-hiddenattribute instead ofvisually_hidden_class(selector:[data-visually-hidden]).
- Remove
stackcomponent- Remove
recursive_classoption. - Use
data-recursiveattribute instead ofrecursive_class(selector:[data-recursive]).
- Remove
stepscomponent- Remove
current_class,completed_class,upcoming_class, andvisually_hidden_classoptions. - Use
data-visually-hiddenattribute instead ofvisually_hidden_class(selector:[data-visually-hidden]). - Use
data-stateattribute instead ofcurrent_class,completed_class, andupcoming_class(selectors:[data-state="current"],[data-state="completed"],[data-state="upcoming"]).
- Remove
Removed
- Remove
class_name_funoption. - Remove
Doggo.modifier_class_name/2.
Upgrade Guide
In previous versions, modifier attribute values would be reflected with CSS classes in the HTML output.
For example, if you had a tag component with a size modifier like this:
build_tag(
modifiers: [
size: [values: ["small", "medium", "large"], default: "medium"]
]
)
And you used it like:
<.tag size="small">Hello</.tag>
This would result in the addition of an is-small class.
<span class="tag is-small">Hello</span>
The implementation was changed to use separate data attributes for each modifier instead. Now, the generated HTML will look like this:
<span class="tag" data-size="small">Hello</span>
In your CSS styles, you will need to change the selectors accordingly.
Before:
.tag.is-small {
}
After:
.tag[data-size="small"] {
}