react-iro-gradient-picker 1.2.5 → 1.2.6
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/README.md +118 -24
- package/dist/index.es.js +15 -6
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -6440,9 +6440,7 @@ var validGradient = (function (input) {
|
|
6440
6440
|
var firstPart = parts[0];
|
6441
6441
|
var isDirection = false;
|
6442
6442
|
if (type === 'linear') {
|
6443
|
-
isDirection =
|
6444
|
-
/^\d+deg$/i.test(firstPart) ||
|
6445
|
-
/^to\s+/.test(firstPart);
|
6443
|
+
isDirection = /^\d+deg$/i.test(firstPart) || /^to\s+/.test(firstPart);
|
6446
6444
|
}
|
6447
6445
|
else if (type === 'radial') {
|
6448
6446
|
// For radial gradients, check for size, shape, or position keywords
|
@@ -6611,12 +6609,23 @@ var parseGradient = (function (str) {
|
|
6611
6609
|
var findF = (_a = LINEAR_POS.find(function (item) { return item.name === angle_1; })) === null || _a === void 0 ? void 0 : _a.angle;
|
6612
6610
|
var helperAngle = type === 'linear' ? '180' : 'circle at center';
|
6613
6611
|
var modifier = findF || angle_1 || helperAngle;
|
6612
|
+
// For radial gradients, preserve the full modifier string to maintain positioning
|
6613
|
+
var processedModifier = void 0;
|
6614
|
+
if (type === 'radial') {
|
6615
|
+
// Keep the full radial gradient specification
|
6616
|
+
processedModifier = modifier;
|
6617
|
+
}
|
6618
|
+
else {
|
6619
|
+
// For linear gradients, extract number if it's a degree value
|
6620
|
+
processedModifier =
|
6621
|
+
modifier.match(/\d+/) !== null
|
6622
|
+
? Number((_b = modifier.match(/\d+/)) === null || _b === void 0 ? void 0 : _b.join(''))
|
6623
|
+
: modifier;
|
6624
|
+
}
|
6614
6625
|
return {
|
6615
6626
|
gradient: typeof gradient !== 'string' ? gradient.original : str,
|
6616
6627
|
type: type,
|
6617
|
-
modifier:
|
6618
|
-
? Number((_b = modifier.match(/\d+/)) === null || _b === void 0 ? void 0 : _b.join(''))
|
6619
|
-
: modifier,
|
6628
|
+
modifier: processedModifier,
|
6620
6629
|
stops: stops.map(function (stop, index) {
|
6621
6630
|
var formatStop = ["".concat(stop.color), index];
|
6622
6631
|
if (stop.position || stop.position === 0) {
|