@idealyst/svg 1.2.95 → 1.2.97
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 +1 -1
- package/src/primitives.web.tsx +31 -24
package/package.json
CHANGED
package/src/primitives.web.tsx
CHANGED
|
@@ -26,6 +26,13 @@ import type {
|
|
|
26
26
|
ForeignObjectProps,
|
|
27
27
|
} from './types';
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Helper to cast forwardRef refs to native element refs.
|
|
31
|
+
* Works around React 19's stricter ref callback types.
|
|
32
|
+
*/
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
const asRef = <T,>(ref: unknown): any => ref;
|
|
35
|
+
|
|
29
36
|
/**
|
|
30
37
|
* Helper to convert props to native SVG attributes
|
|
31
38
|
*/
|
|
@@ -90,7 +97,7 @@ export const Svg = forwardRef<SVGSVGElement, SvgProps>(
|
|
|
90
97
|
|
|
91
98
|
return (
|
|
92
99
|
<svg
|
|
93
|
-
ref={ref}
|
|
100
|
+
ref={asRef<SVGSVGElement>(ref)}
|
|
94
101
|
xmlns={xmlns}
|
|
95
102
|
xmlnsXlink={xmlnsXlink}
|
|
96
103
|
style={color ? { color } : undefined}
|
|
@@ -129,7 +136,7 @@ export const G = forwardRef<SVGGElement, GProps>(
|
|
|
129
136
|
|
|
130
137
|
return (
|
|
131
138
|
<g
|
|
132
|
-
ref={ref}
|
|
139
|
+
ref={asRef<SVGGElement>(ref)}
|
|
133
140
|
transform={transform.trim() || undefined}
|
|
134
141
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
135
142
|
{...(gProps as ReactSVGProps<SVGGElement>)}
|
|
@@ -150,7 +157,7 @@ export const Path = forwardRef<SVGPathElement, PathProps>(
|
|
|
150
157
|
|
|
151
158
|
return (
|
|
152
159
|
<path
|
|
153
|
-
ref={ref}
|
|
160
|
+
ref={asRef<SVGPathElement>(ref)}
|
|
154
161
|
d={d}
|
|
155
162
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
156
163
|
{...(pathProps as ReactSVGProps<SVGPathElement>)}
|
|
@@ -169,7 +176,7 @@ export const Rect = forwardRef<SVGRectElement, RectProps>(
|
|
|
169
176
|
|
|
170
177
|
return (
|
|
171
178
|
<rect
|
|
172
|
-
ref={ref}
|
|
179
|
+
ref={asRef<SVGRectElement>(ref)}
|
|
173
180
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
174
181
|
{...(rectProps as ReactSVGProps<SVGRectElement>)}
|
|
175
182
|
/>
|
|
@@ -187,7 +194,7 @@ export const Circle = forwardRef<SVGCircleElement, CircleProps>(
|
|
|
187
194
|
|
|
188
195
|
return (
|
|
189
196
|
<circle
|
|
190
|
-
ref={ref}
|
|
197
|
+
ref={asRef<SVGCircleElement>(ref)}
|
|
191
198
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
192
199
|
{...(circleProps as ReactSVGProps<SVGCircleElement>)}
|
|
193
200
|
/>
|
|
@@ -205,7 +212,7 @@ export const Ellipse = forwardRef<SVGEllipseElement, EllipseProps>(
|
|
|
205
212
|
|
|
206
213
|
return (
|
|
207
214
|
<ellipse
|
|
208
|
-
ref={ref}
|
|
215
|
+
ref={asRef<SVGEllipseElement>(ref)}
|
|
209
216
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
210
217
|
{...(ellipseProps as ReactSVGProps<SVGEllipseElement>)}
|
|
211
218
|
/>
|
|
@@ -223,7 +230,7 @@ export const Line = forwardRef<SVGLineElement, LineProps>(
|
|
|
223
230
|
|
|
224
231
|
return (
|
|
225
232
|
<line
|
|
226
|
-
ref={ref}
|
|
233
|
+
ref={asRef<SVGLineElement>(ref)}
|
|
227
234
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
228
235
|
{...(lineProps as ReactSVGProps<SVGLineElement>)}
|
|
229
236
|
/>
|
|
@@ -241,7 +248,7 @@ export const Polyline = forwardRef<SVGPolylineElement, PolylineProps>(
|
|
|
241
248
|
|
|
242
249
|
return (
|
|
243
250
|
<polyline
|
|
244
|
-
ref={ref}
|
|
251
|
+
ref={asRef<SVGPolylineElement>(ref)}
|
|
245
252
|
points={convertPoints(points)}
|
|
246
253
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
247
254
|
{...(polylineProps as ReactSVGProps<SVGPolylineElement>)}
|
|
@@ -260,7 +267,7 @@ export const Polygon = forwardRef<SVGPolygonElement, PolygonProps>(
|
|
|
260
267
|
|
|
261
268
|
return (
|
|
262
269
|
<polygon
|
|
263
|
-
ref={ref}
|
|
270
|
+
ref={asRef<SVGPolygonElement>(ref)}
|
|
264
271
|
points={convertPoints(points)}
|
|
265
272
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
266
273
|
{...(polygonProps as ReactSVGProps<SVGPolygonElement>)}
|
|
@@ -279,7 +286,7 @@ export const Text = forwardRef<SVGTextElement, TextProps>(
|
|
|
279
286
|
|
|
280
287
|
return (
|
|
281
288
|
<text
|
|
282
|
-
ref={ref}
|
|
289
|
+
ref={asRef<SVGTextElement>(ref)}
|
|
283
290
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
284
291
|
{...(textProps as ReactSVGProps<SVGTextElement>)}
|
|
285
292
|
>
|
|
@@ -299,7 +306,7 @@ export const TSpan = forwardRef<SVGTSpanElement, TSpanProps>(
|
|
|
299
306
|
|
|
300
307
|
return (
|
|
301
308
|
<tspan
|
|
302
|
-
ref={ref}
|
|
309
|
+
ref={asRef<SVGTSpanElement>(ref)}
|
|
303
310
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
304
311
|
{...(tspanProps as ReactSVGProps<SVGTSpanElement>)}
|
|
305
312
|
>
|
|
@@ -319,7 +326,7 @@ export const TextPath = forwardRef<SVGTextPathElement, TextPathProps>(
|
|
|
319
326
|
|
|
320
327
|
return (
|
|
321
328
|
<textPath
|
|
322
|
-
ref={ref}
|
|
329
|
+
ref={asRef<SVGTextPathElement>(ref)}
|
|
323
330
|
href={href}
|
|
324
331
|
path={path}
|
|
325
332
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
@@ -341,7 +348,7 @@ export const Use = forwardRef<SVGUseElement, UseProps>(
|
|
|
341
348
|
|
|
342
349
|
return (
|
|
343
350
|
<use
|
|
344
|
-
ref={ref}
|
|
351
|
+
ref={asRef<SVGUseElement>(ref)}
|
|
345
352
|
href={href}
|
|
346
353
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
347
354
|
{...(useProps as ReactSVGProps<SVGUseElement>)}
|
|
@@ -360,7 +367,7 @@ export const Symbol = forwardRef<SVGSymbolElement, SymbolProps>(
|
|
|
360
367
|
|
|
361
368
|
return (
|
|
362
369
|
<symbol
|
|
363
|
-
ref={ref}
|
|
370
|
+
ref={asRef<SVGSymbolElement>(ref)}
|
|
364
371
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
365
372
|
{...(symbolProps as ReactSVGProps<SVGSymbolElement>)}
|
|
366
373
|
>
|
|
@@ -379,7 +386,7 @@ export const Defs = forwardRef<SVGDefsElement, DefsProps>(
|
|
|
379
386
|
const defsProps = convertCommonProps(props);
|
|
380
387
|
|
|
381
388
|
return (
|
|
382
|
-
<defs ref={ref} {...(defsProps as ReactSVGProps<SVGDefsElement>)}>
|
|
389
|
+
<defs ref={asRef<SVGDefsElement>(ref)} {...(defsProps as ReactSVGProps<SVGDefsElement>)}>
|
|
383
390
|
{children}
|
|
384
391
|
</defs>
|
|
385
392
|
);
|
|
@@ -396,7 +403,7 @@ export const Image = forwardRef<SVGImageElement, ImageProps>(
|
|
|
396
403
|
|
|
397
404
|
return (
|
|
398
405
|
<image
|
|
399
|
-
ref={ref}
|
|
406
|
+
ref={asRef<SVGImageElement>(ref)}
|
|
400
407
|
href={href}
|
|
401
408
|
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
402
409
|
{...(imageProps as ReactSVGProps<SVGImageElement>)}
|
|
@@ -414,7 +421,7 @@ export const ClipPath = forwardRef<SVGClipPathElement, ClipPathProps>(
|
|
|
414
421
|
const clipPathProps = convertCommonProps(props);
|
|
415
422
|
|
|
416
423
|
return (
|
|
417
|
-
<clipPath ref={ref} {...(clipPathProps as ReactSVGProps<SVGClipPathElement>)}>
|
|
424
|
+
<clipPath ref={asRef<SVGClipPathElement>(ref)} {...(clipPathProps as ReactSVGProps<SVGClipPathElement>)}>
|
|
418
425
|
{children}
|
|
419
426
|
</clipPath>
|
|
420
427
|
);
|
|
@@ -430,7 +437,7 @@ export const Mask = forwardRef<SVGMaskElement, MaskProps>(
|
|
|
430
437
|
const maskProps = convertCommonProps(props);
|
|
431
438
|
|
|
432
439
|
return (
|
|
433
|
-
<mask ref={ref} {...(maskProps as ReactSVGProps<SVGMaskElement>)}>
|
|
440
|
+
<mask ref={asRef<SVGMaskElement>(ref)} {...(maskProps as ReactSVGProps<SVGMaskElement>)}>
|
|
434
441
|
{children}
|
|
435
442
|
</mask>
|
|
436
443
|
);
|
|
@@ -446,7 +453,7 @@ export const LinearGradient = forwardRef<SVGLinearGradientElement, LinearGradien
|
|
|
446
453
|
const linearGradientProps = convertCommonProps(props);
|
|
447
454
|
|
|
448
455
|
return (
|
|
449
|
-
<linearGradient ref={ref} {...(linearGradientProps as ReactSVGProps<SVGLinearGradientElement>)}>
|
|
456
|
+
<linearGradient ref={asRef<SVGLinearGradientElement>(ref)} {...(linearGradientProps as ReactSVGProps<SVGLinearGradientElement>)}>
|
|
450
457
|
{children}
|
|
451
458
|
</linearGradient>
|
|
452
459
|
);
|
|
@@ -462,7 +469,7 @@ export const RadialGradient = forwardRef<SVGRadialGradientElement, RadialGradien
|
|
|
462
469
|
const radialGradientProps = convertCommonProps(props);
|
|
463
470
|
|
|
464
471
|
return (
|
|
465
|
-
<radialGradient ref={ref} {...(radialGradientProps as ReactSVGProps<SVGRadialGradientElement>)}>
|
|
472
|
+
<radialGradient ref={asRef<SVGRadialGradientElement>(ref)} {...(radialGradientProps as ReactSVGProps<SVGRadialGradientElement>)}>
|
|
466
473
|
{children}
|
|
467
474
|
</radialGradient>
|
|
468
475
|
);
|
|
@@ -477,7 +484,7 @@ export const Stop = forwardRef<SVGStopElement, StopProps>(
|
|
|
477
484
|
({ offset, stopColor, stopOpacity, ...props }, ref) => {
|
|
478
485
|
return (
|
|
479
486
|
<stop
|
|
480
|
-
ref={ref}
|
|
487
|
+
ref={asRef<SVGStopElement>(ref)}
|
|
481
488
|
offset={offset}
|
|
482
489
|
stopColor={stopColor}
|
|
483
490
|
stopOpacity={stopOpacity}
|
|
@@ -496,7 +503,7 @@ export const Pattern = forwardRef<SVGPatternElement, PatternProps>(
|
|
|
496
503
|
const patternProps = convertCommonProps(props);
|
|
497
504
|
|
|
498
505
|
return (
|
|
499
|
-
<pattern ref={ref} {...(patternProps as ReactSVGProps<SVGPatternElement>)}>
|
|
506
|
+
<pattern ref={asRef<SVGPatternElement>(ref)} {...(patternProps as ReactSVGProps<SVGPatternElement>)}>
|
|
500
507
|
{children}
|
|
501
508
|
</pattern>
|
|
502
509
|
);
|
|
@@ -512,7 +519,7 @@ export const Marker = forwardRef<SVGMarkerElement, MarkerProps>(
|
|
|
512
519
|
const markerProps = convertCommonProps(props);
|
|
513
520
|
|
|
514
521
|
return (
|
|
515
|
-
<marker ref={ref} {...(markerProps as ReactSVGProps<SVGMarkerElement>)}>
|
|
522
|
+
<marker ref={asRef<SVGMarkerElement>(ref)} {...(markerProps as ReactSVGProps<SVGMarkerElement>)}>
|
|
516
523
|
{children}
|
|
517
524
|
</marker>
|
|
518
525
|
);
|
|
@@ -528,7 +535,7 @@ export const ForeignObject = forwardRef<SVGForeignObjectElement, ForeignObjectPr
|
|
|
528
535
|
const foreignObjectProps = convertCommonProps(props);
|
|
529
536
|
|
|
530
537
|
return (
|
|
531
|
-
<foreignObject ref={ref} {...(foreignObjectProps as ReactSVGProps<SVGForeignObjectElement>)}>
|
|
538
|
+
<foreignObject ref={asRef<SVGForeignObjectElement>(ref)} {...(foreignObjectProps as ReactSVGProps<SVGForeignObjectElement>)}>
|
|
532
539
|
{children}
|
|
533
540
|
</foreignObject>
|
|
534
541
|
);
|