Skip to content

Commit 2a923f0

Browse files
committed
fix(@clayui/css): Global Functions update setter to accept more than 2 variables (e.g., setter($var1, $var2, $var3, $var4, $var5))
fixes #4076
1 parent c0d38e6 commit 2a923f0

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

packages/clay-css/src/scss/functions/_global-functions.scss

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,21 @@
5858
@return $newMap;
5959
}
6060

61-
/// A helper function for setting default values in variables inside mixins if no value is declared. If the value of a variable is `clay-unset`, `setter` returns a value of `null` which prevents Sass from outputting the declaration. If the value of a variable is `null`, `setter` returns the default, `$val`.
62-
/// @param {Any} $var - The Sass variable
63-
/// @param {Any} $val - The default value to return if `$var` is `null`
61+
/// A helper function for setting default values in variables inside mixins if no value is declared. If the value of a variable is `clay-unset`, `setter` returns a value of `null` which prevents Sass from outputting the CSS property. If all the values in the arglist `$vars...` is `null`, `setter` returns `null`.
62+
/// @param {Arglist} $vars - A list of comma-delimited variables (e.g., $var1, $var2, $var3).
6463

65-
@function setter($var, $val: false) {
66-
@if ($var == clay-unset) {
67-
@return null;
68-
}
64+
@function setter($vars...) {
65+
@each $var in $vars {
66+
@if ($var == clay-unset) {
67+
@return null;
68+
}
6969

70-
@if ($var != null) {
71-
@return $var;
70+
@if ($var != null) {
71+
@return $var;
72+
}
7273
}
7374

74-
@return $val;
75+
@return null;
7576
}
7677

7778
/// A helper function that returns the opposite of a number, generally used for `null` values so Sass doesn't output a value `-null`. Returns `null` if `$num` is not a number.

0 commit comments

Comments
 (0)