anubis-ui 1.2.23 → 1.2.24
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.
package/package.json
CHANGED
|
@@ -7,6 +7,15 @@
|
|
|
7
7
|
"prefix": "text",
|
|
8
8
|
"declaration": "color: ${color}"
|
|
9
9
|
},
|
|
10
|
+
{
|
|
11
|
+
"prefix": "text",
|
|
12
|
+
"declaration": "text-decoration: ${value}",
|
|
13
|
+
"variations": {
|
|
14
|
+
"underline": "underline",
|
|
15
|
+
"dashed": "dashed",
|
|
16
|
+
"dotted": "dotted"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
10
19
|
{
|
|
11
20
|
"prefix": "border",
|
|
12
21
|
"declaration": "border-width: ${value} !important; border-color: ${color} !important; border-style: solid;",
|
|
@@ -132,21 +132,25 @@ const getUtilityInfos = ({
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
const { colorExists } = getColorInfos(cleanedColor);
|
|
135
|
+
const possibleUtilityVariations = possibleUtility.filter(({ variations }) => Object.keys(variations || {})?.length)
|
|
135
136
|
|
|
136
137
|
/**
|
|
137
138
|
* Find the utility where the variations exist
|
|
138
139
|
* Logic:
|
|
139
|
-
* 1. If
|
|
140
|
+
* 1. If
|
|
141
|
+
* OR we have a valid color
|
|
142
|
+
* OR no color specified
|
|
143
|
+
* OR no possible utilities have variation
|
|
144
|
+
* Then use the first utility
|
|
140
145
|
* 2. Otherwise, find a utility with a matching variation
|
|
141
146
|
*/
|
|
142
147
|
let matchingUtility;
|
|
143
148
|
|
|
144
|
-
if (colorExists || !cleanedColor) {
|
|
145
|
-
// Valid color exists or no color specified - use first utility
|
|
149
|
+
if (colorExists || !cleanedColor || possibleUtilityVariations?.length <= 0) {
|
|
146
150
|
matchingUtility = possibleUtility[0];
|
|
147
151
|
} else {
|
|
148
152
|
// Find utility with matching variation
|
|
149
|
-
matchingUtility =
|
|
153
|
+
matchingUtility = possibleUtilityVariations.find(({ variations }) => {
|
|
150
154
|
if (!variations) return true;
|
|
151
155
|
|
|
152
156
|
const mappedVariations = Array.isArray(variations) ? variations : Object.keys(variations)
|