@idealyst/svg 1.2.63
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 +178 -0
- package/package.json +69 -0
- package/src/examples/SvgExamples.tsx +363 -0
- package/src/examples/index.ts +14 -0
- package/src/index.native.ts +64 -0
- package/src/index.ts +64 -0
- package/src/primitives.native.tsx +496 -0
- package/src/primitives.web.tsx +537 -0
- package/src/types.ts +446 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import React, { forwardRef, SVGProps as ReactSVGProps } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
SvgProps,
|
|
4
|
+
GProps,
|
|
5
|
+
PathProps,
|
|
6
|
+
RectProps,
|
|
7
|
+
CircleProps,
|
|
8
|
+
EllipseProps,
|
|
9
|
+
LineProps,
|
|
10
|
+
PolylineProps,
|
|
11
|
+
PolygonProps,
|
|
12
|
+
TextProps,
|
|
13
|
+
TSpanProps,
|
|
14
|
+
TextPathProps,
|
|
15
|
+
UseProps,
|
|
16
|
+
SymbolProps,
|
|
17
|
+
DefsProps,
|
|
18
|
+
ImageProps,
|
|
19
|
+
ClipPathProps,
|
|
20
|
+
MaskProps,
|
|
21
|
+
LinearGradientProps,
|
|
22
|
+
RadialGradientProps,
|
|
23
|
+
StopProps,
|
|
24
|
+
PatternProps,
|
|
25
|
+
MarkerProps,
|
|
26
|
+
ForeignObjectProps,
|
|
27
|
+
} from './types';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Helper to convert props to native SVG attributes
|
|
31
|
+
*/
|
|
32
|
+
function convertCommonProps(props: Record<string, unknown>): ReactSVGProps<SVGElement> {
|
|
33
|
+
const {
|
|
34
|
+
testID,
|
|
35
|
+
onPress,
|
|
36
|
+
onLongPress,
|
|
37
|
+
onPressIn,
|
|
38
|
+
onPressOut,
|
|
39
|
+
children,
|
|
40
|
+
...rest
|
|
41
|
+
} = props;
|
|
42
|
+
|
|
43
|
+
const result: Record<string, unknown> = { ...rest };
|
|
44
|
+
|
|
45
|
+
// Convert testID to data-testid
|
|
46
|
+
if (testID) {
|
|
47
|
+
result['data-testid'] = testID;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Convert press handlers to click handlers
|
|
51
|
+
if (onPress) {
|
|
52
|
+
result.onClick = onPress;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return result as ReactSVGProps<SVGElement>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Helper to convert stroke-dasharray from array to string
|
|
60
|
+
*/
|
|
61
|
+
function convertStrokeDasharray(value: string | number[] | undefined): string | undefined {
|
|
62
|
+
if (Array.isArray(value)) {
|
|
63
|
+
return value.join(' ');
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Helper to convert points from array to string
|
|
70
|
+
*/
|
|
71
|
+
function convertPoints(points: string | number[]): string {
|
|
72
|
+
if (Array.isArray(points)) {
|
|
73
|
+
const pairs: string[] = [];
|
|
74
|
+
for (let i = 0; i < points.length; i += 2) {
|
|
75
|
+
if (i + 1 < points.length) {
|
|
76
|
+
pairs.push(`${points[i]},${points[i + 1]}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return pairs.join(' ');
|
|
80
|
+
}
|
|
81
|
+
return points;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Root SVG element
|
|
86
|
+
*/
|
|
87
|
+
export const Svg = forwardRef<SVGSVGElement, SvgProps>(
|
|
88
|
+
({ children, title, desc, xmlns = 'http://www.w3.org/2000/svg', xmlnsXlink, color, strokeDasharray, ...props }, ref) => {
|
|
89
|
+
const svgProps = convertCommonProps(props);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<svg
|
|
93
|
+
ref={ref}
|
|
94
|
+
xmlns={xmlns}
|
|
95
|
+
xmlnsXlink={xmlnsXlink}
|
|
96
|
+
style={color ? { color } : undefined}
|
|
97
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
98
|
+
{...(svgProps as ReactSVGProps<SVGSVGElement>)}
|
|
99
|
+
>
|
|
100
|
+
{title && <title>{title}</title>}
|
|
101
|
+
{desc && <desc>{desc}</desc>}
|
|
102
|
+
{children}
|
|
103
|
+
</svg>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
Svg.displayName = 'Svg';
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Group element
|
|
111
|
+
*/
|
|
112
|
+
export const G = forwardRef<SVGGElement, GProps>(
|
|
113
|
+
({ children, x, y, rotation, scale, originX, originY, strokeDasharray, ...props }, ref) => {
|
|
114
|
+
const gProps = convertCommonProps(props);
|
|
115
|
+
|
|
116
|
+
// Build transform string from convenience props
|
|
117
|
+
let transform = props.transform || '';
|
|
118
|
+
if (x !== undefined || y !== undefined) {
|
|
119
|
+
transform = `translate(${x || 0}, ${y || 0}) ${transform}`;
|
|
120
|
+
}
|
|
121
|
+
if (rotation !== undefined) {
|
|
122
|
+
const ox = originX || 0;
|
|
123
|
+
const oy = originY || 0;
|
|
124
|
+
transform = `${transform} rotate(${rotation}, ${ox}, ${oy})`;
|
|
125
|
+
}
|
|
126
|
+
if (scale !== undefined) {
|
|
127
|
+
transform = `${transform} scale(${scale})`;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<g
|
|
132
|
+
ref={ref}
|
|
133
|
+
transform={transform.trim() || undefined}
|
|
134
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
135
|
+
{...(gProps as ReactSVGProps<SVGGElement>)}
|
|
136
|
+
>
|
|
137
|
+
{children}
|
|
138
|
+
</g>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
G.displayName = 'G';
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Path element
|
|
146
|
+
*/
|
|
147
|
+
export const Path = forwardRef<SVGPathElement, PathProps>(
|
|
148
|
+
({ d, strokeDasharray, ...props }, ref) => {
|
|
149
|
+
const pathProps = convertCommonProps(props);
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<path
|
|
153
|
+
ref={ref}
|
|
154
|
+
d={d}
|
|
155
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
156
|
+
{...(pathProps as ReactSVGProps<SVGPathElement>)}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
Path.displayName = 'Path';
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Rectangle element
|
|
165
|
+
*/
|
|
166
|
+
export const Rect = forwardRef<SVGRectElement, RectProps>(
|
|
167
|
+
({ strokeDasharray, ...props }, ref) => {
|
|
168
|
+
const rectProps = convertCommonProps(props);
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<rect
|
|
172
|
+
ref={ref}
|
|
173
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
174
|
+
{...(rectProps as ReactSVGProps<SVGRectElement>)}
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
Rect.displayName = 'Rect';
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Circle element
|
|
183
|
+
*/
|
|
184
|
+
export const Circle = forwardRef<SVGCircleElement, CircleProps>(
|
|
185
|
+
({ strokeDasharray, ...props }, ref) => {
|
|
186
|
+
const circleProps = convertCommonProps(props);
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<circle
|
|
190
|
+
ref={ref}
|
|
191
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
192
|
+
{...(circleProps as ReactSVGProps<SVGCircleElement>)}
|
|
193
|
+
/>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
Circle.displayName = 'Circle';
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Ellipse element
|
|
201
|
+
*/
|
|
202
|
+
export const Ellipse = forwardRef<SVGEllipseElement, EllipseProps>(
|
|
203
|
+
({ strokeDasharray, ...props }, ref) => {
|
|
204
|
+
const ellipseProps = convertCommonProps(props);
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<ellipse
|
|
208
|
+
ref={ref}
|
|
209
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
210
|
+
{...(ellipseProps as ReactSVGProps<SVGEllipseElement>)}
|
|
211
|
+
/>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
Ellipse.displayName = 'Ellipse';
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Line element
|
|
219
|
+
*/
|
|
220
|
+
export const Line = forwardRef<SVGLineElement, LineProps>(
|
|
221
|
+
({ strokeDasharray, ...props }, ref) => {
|
|
222
|
+
const lineProps = convertCommonProps(props);
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<line
|
|
226
|
+
ref={ref}
|
|
227
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
228
|
+
{...(lineProps as ReactSVGProps<SVGLineElement>)}
|
|
229
|
+
/>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
Line.displayName = 'Line';
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Polyline element (open shape)
|
|
237
|
+
*/
|
|
238
|
+
export const Polyline = forwardRef<SVGPolylineElement, PolylineProps>(
|
|
239
|
+
({ points, strokeDasharray, ...props }, ref) => {
|
|
240
|
+
const polylineProps = convertCommonProps(props);
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<polyline
|
|
244
|
+
ref={ref}
|
|
245
|
+
points={convertPoints(points)}
|
|
246
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
247
|
+
{...(polylineProps as ReactSVGProps<SVGPolylineElement>)}
|
|
248
|
+
/>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
Polyline.displayName = 'Polyline';
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Polygon element (closed shape)
|
|
256
|
+
*/
|
|
257
|
+
export const Polygon = forwardRef<SVGPolygonElement, PolygonProps>(
|
|
258
|
+
({ points, strokeDasharray, ...props }, ref) => {
|
|
259
|
+
const polygonProps = convertCommonProps(props);
|
|
260
|
+
|
|
261
|
+
return (
|
|
262
|
+
<polygon
|
|
263
|
+
ref={ref}
|
|
264
|
+
points={convertPoints(points)}
|
|
265
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
266
|
+
{...(polygonProps as ReactSVGProps<SVGPolygonElement>)}
|
|
267
|
+
/>
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
Polygon.displayName = 'Polygon';
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Text element
|
|
275
|
+
*/
|
|
276
|
+
export const Text = forwardRef<SVGTextElement, TextProps>(
|
|
277
|
+
({ children, strokeDasharray, ...props }, ref) => {
|
|
278
|
+
const textProps = convertCommonProps(props);
|
|
279
|
+
|
|
280
|
+
return (
|
|
281
|
+
<text
|
|
282
|
+
ref={ref}
|
|
283
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
284
|
+
{...(textProps as ReactSVGProps<SVGTextElement>)}
|
|
285
|
+
>
|
|
286
|
+
{children}
|
|
287
|
+
</text>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
Text.displayName = 'Text';
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* TSpan element (text span)
|
|
295
|
+
*/
|
|
296
|
+
export const TSpan = forwardRef<SVGTSpanElement, TSpanProps>(
|
|
297
|
+
({ children, inlineSize, strokeDasharray, ...props }, ref) => {
|
|
298
|
+
const tspanProps = convertCommonProps(props);
|
|
299
|
+
|
|
300
|
+
return (
|
|
301
|
+
<tspan
|
|
302
|
+
ref={ref}
|
|
303
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
304
|
+
{...(tspanProps as ReactSVGProps<SVGTSpanElement>)}
|
|
305
|
+
>
|
|
306
|
+
{children}
|
|
307
|
+
</tspan>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
TSpan.displayName = 'TSpan';
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* TextPath element (text along a path)
|
|
315
|
+
*/
|
|
316
|
+
export const TextPath = forwardRef<SVGTextPathElement, TextPathProps>(
|
|
317
|
+
({ children, href, path, strokeDasharray, ...props }, ref) => {
|
|
318
|
+
const textPathProps = convertCommonProps(props);
|
|
319
|
+
|
|
320
|
+
return (
|
|
321
|
+
<textPath
|
|
322
|
+
ref={ref}
|
|
323
|
+
href={href}
|
|
324
|
+
path={path}
|
|
325
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
326
|
+
{...(textPathProps as ReactSVGProps<SVGTextPathElement>)}
|
|
327
|
+
>
|
|
328
|
+
{children}
|
|
329
|
+
</textPath>
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
TextPath.displayName = 'TextPath';
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Use element (reference another element)
|
|
337
|
+
*/
|
|
338
|
+
export const Use = forwardRef<SVGUseElement, UseProps>(
|
|
339
|
+
({ href, strokeDasharray, ...props }, ref) => {
|
|
340
|
+
const useProps = convertCommonProps(props);
|
|
341
|
+
|
|
342
|
+
return (
|
|
343
|
+
<use
|
|
344
|
+
ref={ref}
|
|
345
|
+
href={href}
|
|
346
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
347
|
+
{...(useProps as ReactSVGProps<SVGUseElement>)}
|
|
348
|
+
/>
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
Use.displayName = 'Use';
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Symbol element (reusable graphics)
|
|
356
|
+
*/
|
|
357
|
+
export const Symbol = forwardRef<SVGSymbolElement, SymbolProps>(
|
|
358
|
+
({ children, strokeDasharray, ...props }, ref) => {
|
|
359
|
+
const symbolProps = convertCommonProps(props);
|
|
360
|
+
|
|
361
|
+
return (
|
|
362
|
+
<symbol
|
|
363
|
+
ref={ref}
|
|
364
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
365
|
+
{...(symbolProps as ReactSVGProps<SVGSymbolElement>)}
|
|
366
|
+
>
|
|
367
|
+
{children}
|
|
368
|
+
</symbol>
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
Symbol.displayName = 'Symbol';
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Defs element (definitions container)
|
|
376
|
+
*/
|
|
377
|
+
export const Defs = forwardRef<SVGDefsElement, DefsProps>(
|
|
378
|
+
({ children, ...props }, ref) => {
|
|
379
|
+
const defsProps = convertCommonProps(props);
|
|
380
|
+
|
|
381
|
+
return (
|
|
382
|
+
<defs ref={ref} {...(defsProps as ReactSVGProps<SVGDefsElement>)}>
|
|
383
|
+
{children}
|
|
384
|
+
</defs>
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
Defs.displayName = 'Defs';
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Image element
|
|
392
|
+
*/
|
|
393
|
+
export const Image = forwardRef<SVGImageElement, ImageProps>(
|
|
394
|
+
({ href, strokeDasharray, ...props }, ref) => {
|
|
395
|
+
const imageProps = convertCommonProps(props);
|
|
396
|
+
|
|
397
|
+
return (
|
|
398
|
+
<image
|
|
399
|
+
ref={ref}
|
|
400
|
+
href={href}
|
|
401
|
+
strokeDasharray={convertStrokeDasharray(strokeDasharray)}
|
|
402
|
+
{...(imageProps as ReactSVGProps<SVGImageElement>)}
|
|
403
|
+
/>
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
Image.displayName = 'Image';
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* ClipPath element
|
|
411
|
+
*/
|
|
412
|
+
export const ClipPath = forwardRef<SVGClipPathElement, ClipPathProps>(
|
|
413
|
+
({ children, ...props }, ref) => {
|
|
414
|
+
const clipPathProps = convertCommonProps(props);
|
|
415
|
+
|
|
416
|
+
return (
|
|
417
|
+
<clipPath ref={ref} {...(clipPathProps as ReactSVGProps<SVGClipPathElement>)}>
|
|
418
|
+
{children}
|
|
419
|
+
</clipPath>
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
ClipPath.displayName = 'ClipPath';
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Mask element
|
|
427
|
+
*/
|
|
428
|
+
export const Mask = forwardRef<SVGMaskElement, MaskProps>(
|
|
429
|
+
({ children, ...props }, ref) => {
|
|
430
|
+
const maskProps = convertCommonProps(props);
|
|
431
|
+
|
|
432
|
+
return (
|
|
433
|
+
<mask ref={ref} {...(maskProps as ReactSVGProps<SVGMaskElement>)}>
|
|
434
|
+
{children}
|
|
435
|
+
</mask>
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
Mask.displayName = 'Mask';
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* LinearGradient element
|
|
443
|
+
*/
|
|
444
|
+
export const LinearGradient = forwardRef<SVGLinearGradientElement, LinearGradientProps>(
|
|
445
|
+
({ children, ...props }, ref) => {
|
|
446
|
+
const linearGradientProps = convertCommonProps(props);
|
|
447
|
+
|
|
448
|
+
return (
|
|
449
|
+
<linearGradient ref={ref} {...(linearGradientProps as ReactSVGProps<SVGLinearGradientElement>)}>
|
|
450
|
+
{children}
|
|
451
|
+
</linearGradient>
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
);
|
|
455
|
+
LinearGradient.displayName = 'LinearGradient';
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* RadialGradient element
|
|
459
|
+
*/
|
|
460
|
+
export const RadialGradient = forwardRef<SVGRadialGradientElement, RadialGradientProps>(
|
|
461
|
+
({ children, ...props }, ref) => {
|
|
462
|
+
const radialGradientProps = convertCommonProps(props);
|
|
463
|
+
|
|
464
|
+
return (
|
|
465
|
+
<radialGradient ref={ref} {...(radialGradientProps as ReactSVGProps<SVGRadialGradientElement>)}>
|
|
466
|
+
{children}
|
|
467
|
+
</radialGradient>
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
);
|
|
471
|
+
RadialGradient.displayName = 'RadialGradient';
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Stop element (for gradients)
|
|
475
|
+
*/
|
|
476
|
+
export const Stop = forwardRef<SVGStopElement, StopProps>(
|
|
477
|
+
({ offset, stopColor, stopOpacity, ...props }, ref) => {
|
|
478
|
+
return (
|
|
479
|
+
<stop
|
|
480
|
+
ref={ref}
|
|
481
|
+
offset={offset}
|
|
482
|
+
stopColor={stopColor}
|
|
483
|
+
stopOpacity={stopOpacity}
|
|
484
|
+
{...(props as ReactSVGProps<SVGStopElement>)}
|
|
485
|
+
/>
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
);
|
|
489
|
+
Stop.displayName = 'Stop';
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Pattern element
|
|
493
|
+
*/
|
|
494
|
+
export const Pattern = forwardRef<SVGPatternElement, PatternProps>(
|
|
495
|
+
({ children, ...props }, ref) => {
|
|
496
|
+
const patternProps = convertCommonProps(props);
|
|
497
|
+
|
|
498
|
+
return (
|
|
499
|
+
<pattern ref={ref} {...(patternProps as ReactSVGProps<SVGPatternElement>)}>
|
|
500
|
+
{children}
|
|
501
|
+
</pattern>
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
);
|
|
505
|
+
Pattern.displayName = 'Pattern';
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Marker element
|
|
509
|
+
*/
|
|
510
|
+
export const Marker = forwardRef<SVGMarkerElement, MarkerProps>(
|
|
511
|
+
({ children, ...props }, ref) => {
|
|
512
|
+
const markerProps = convertCommonProps(props);
|
|
513
|
+
|
|
514
|
+
return (
|
|
515
|
+
<marker ref={ref} {...(markerProps as ReactSVGProps<SVGMarkerElement>)}>
|
|
516
|
+
{children}
|
|
517
|
+
</marker>
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
Marker.displayName = 'Marker';
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* ForeignObject element (embed HTML in SVG)
|
|
525
|
+
*/
|
|
526
|
+
export const ForeignObject = forwardRef<SVGForeignObjectElement, ForeignObjectProps>(
|
|
527
|
+
({ children, ...props }, ref) => {
|
|
528
|
+
const foreignObjectProps = convertCommonProps(props);
|
|
529
|
+
|
|
530
|
+
return (
|
|
531
|
+
<foreignObject ref={ref} {...(foreignObjectProps as ReactSVGProps<SVGForeignObjectElement>)}>
|
|
532
|
+
{children}
|
|
533
|
+
</foreignObject>
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
ForeignObject.displayName = 'ForeignObject';
|