Problem Statement
Rainbow Sprinkles currently doesn't accept style objects as values when defining dynamicProperties.
This could be useful when using complex CSS properties like transform, which lets you rotate, scale, skew, or translate an element.
The only way at the moment to rotate or translate an element with Rainbow Sprinkles is to define the transform property with dynamic values as follows:
const properties = defineProperties({
dynamicProperties: {
transform: true,
},
});
const rainbowSprinkles(properties);
Which forces you to dynamically construct the full transformation value, when only the length value could be provided
rainbowSprinkles({
transform: `translateX(${length})`
});
This also means you have to manually handle in JS things like rtl direction, while this could be automated 😞
rainbowSprinkles({
transform: `translateX(calc(${length} * ${transformDirection}))`
});
Proposed Solution
As with regular Sprinkles properties, it would be great if the values could be entire style objects. This would make for even more powerful classes.
const properties = defineProperties({
dynamicProperties: {
translateX: {
transform: `translateX(${true})`, // true being the placeholder for the dynamic value
selectors: {
'[dir="rtl"] &': {
transform: `translateX(${calc.negate(true)})`,
}
}
},
}
});
Which would automatically produce the following classes
.rainbowSprinkles_translateX__16s97g72c {
transform: translateX(var(--translateX__16s97g728));
}
[dir="rtl"] .rainbowSprinkles_translateX__16s97g72c {
transform: translateX(calc(var(--translateX__16s97g728)) * -1)),
}
Problem Statement
Rainbow Sprinkles currently doesn't accept style objects as values when defining
dynamicProperties.This could be useful when using complex CSS properties like
transform, which lets yourotate,scale,skew, ortranslatean element.The only way at the moment to
rotateortranslatean element with Rainbow Sprinkles is to define thetransformproperty with dynamic values as follows:Which forces you to dynamically construct the full transformation value, when only the
lengthvalue could be providedThis also means you have to manually handle in JS things like
rtldirection, while this could be automated 😞Proposed Solution
As with regular Sprinkles properties, it would be great if the values could be entire style objects. This would make for even more powerful classes.
Which would automatically produce the following classes