@hpcc-js/react 3.4.9 → 3.4.10
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/LICENSE +43 -43
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +3 -3
- package/src/ImageChar.tsx +42 -42
- package/src/__package__.ts +3 -3
- package/src/edge.tsx +45 -45
- package/src/icon.tsx +95 -95
- package/src/image.tsx +25 -25
- package/src/index.ts +17 -17
- package/src/preact-shim.ts +4 -4
- package/src/render.ts +78 -78
- package/src/shape.tsx +138 -138
- package/src/span.tsx +9 -9
- package/src/subgraph.tsx +45 -45
- package/src/text.tsx +257 -257
- package/src/vertex.tsx +119 -119
- package/src/vertex2.tsx +100 -100
- package/src/vertex3.tsx +238 -238
- package/src/vertex4.tsx +308 -308
package/src/text.tsx
CHANGED
|
@@ -1,257 +1,257 @@
|
|
|
1
|
-
import * as PReact from "./preact-shim.ts";
|
|
2
|
-
import { Utility } from "@hpcc-js/common";
|
|
3
|
-
import { Icon } from "./icon.tsx";
|
|
4
|
-
import { Rectangle } from "./shape.tsx";
|
|
5
|
-
|
|
6
|
-
export interface TextLineProps {
|
|
7
|
-
text: string;
|
|
8
|
-
height?: number;
|
|
9
|
-
anchor?: string;
|
|
10
|
-
baseline?: string;
|
|
11
|
-
fontFamily?: string;
|
|
12
|
-
fill?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const TextLine: PReact.FunctionComponent<TextLineProps> = ({
|
|
16
|
-
text,
|
|
17
|
-
height = 12,
|
|
18
|
-
anchor = "middle",
|
|
19
|
-
baseline = "middle",
|
|
20
|
-
fontFamily = "Verdana",
|
|
21
|
-
fill = "black"
|
|
22
|
-
}) => {
|
|
23
|
-
return <text
|
|
24
|
-
font-family={fontFamily}
|
|
25
|
-
font-size={`${height}px`}
|
|
26
|
-
text-anchor={anchor}
|
|
27
|
-
dominant-baseline={baseline}
|
|
28
|
-
fill={fill}
|
|
29
|
-
>{text}</text>;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export interface TextProps {
|
|
33
|
-
text: string;
|
|
34
|
-
height?: number;
|
|
35
|
-
fontFamily?: string;
|
|
36
|
-
fill?: string;
|
|
37
|
-
onSizeUpdate?: (size: { width: number, height: number }) => void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const Text: PReact.FunctionComponent<TextProps> = ({
|
|
41
|
-
text,
|
|
42
|
-
height = 12,
|
|
43
|
-
fontFamily = "Verdana",
|
|
44
|
-
fill = "black",
|
|
45
|
-
onSizeUpdate
|
|
46
|
-
}) => {
|
|
47
|
-
const [totalWidth, setTotalWidth] = PReact.useState(0);
|
|
48
|
-
const [totalHeight, setTotalHeight] = PReact.useState(0);
|
|
49
|
-
|
|
50
|
-
PReact.useEffect(() => {
|
|
51
|
-
if (onSizeUpdate) {
|
|
52
|
-
onSizeUpdate({ width: totalWidth, height: totalHeight });
|
|
53
|
-
}
|
|
54
|
-
}, [totalWidth, totalHeight, onSizeUpdate]);
|
|
55
|
-
|
|
56
|
-
const parts = PReact.useMemo(() => {
|
|
57
|
-
return text.split("\n");
|
|
58
|
-
}, [text]);
|
|
59
|
-
|
|
60
|
-
PReact.useLayoutEffect(() => {
|
|
61
|
-
const size = Utility.textSize(parts, fontFamily, height);
|
|
62
|
-
setTotalWidth(size.width);
|
|
63
|
-
setTotalHeight(size.height);
|
|
64
|
-
}, [fontFamily, height, parts]);
|
|
65
|
-
|
|
66
|
-
const TextLines = PReact.useMemo(() => {
|
|
67
|
-
const yOffset = -(totalHeight / 2) + (height / 2);
|
|
68
|
-
return parts.map((p, i) => {
|
|
69
|
-
return <g key={`key-${i}`} transform={`translate(0 ${yOffset + i * (height + 2)})`}>
|
|
70
|
-
<TextLine
|
|
71
|
-
text={p}
|
|
72
|
-
height={height}
|
|
73
|
-
fontFamily={fontFamily}
|
|
74
|
-
fill={fill}
|
|
75
|
-
/>
|
|
76
|
-
</g>;
|
|
77
|
-
});
|
|
78
|
-
}, [parts, totalHeight, height, fontFamily, fill]);
|
|
79
|
-
|
|
80
|
-
return <g>{TextLines}</g>;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export interface TextBoxProps {
|
|
84
|
-
text: string;
|
|
85
|
-
height?: number;
|
|
86
|
-
fontFamily?: string;
|
|
87
|
-
padding?: number;
|
|
88
|
-
fill?: string;
|
|
89
|
-
stroke?: string;
|
|
90
|
-
textFill?: string;
|
|
91
|
-
strokeWidth?: number;
|
|
92
|
-
cornerRadius?: number;
|
|
93
|
-
textOffsetY?: number;
|
|
94
|
-
onSizeUpdate?: (size: { width: number, height: number }) => void;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export const TextBox: PReact.FunctionComponent<TextBoxProps> = ({
|
|
98
|
-
text,
|
|
99
|
-
height = 12,
|
|
100
|
-
fontFamily = "Verdana",
|
|
101
|
-
padding = 4,
|
|
102
|
-
fill = "whitesmoke",
|
|
103
|
-
stroke = "lightgray",
|
|
104
|
-
textFill = "black",
|
|
105
|
-
strokeWidth = 1,
|
|
106
|
-
cornerRadius = 0,
|
|
107
|
-
onSizeUpdate
|
|
108
|
-
}) => {
|
|
109
|
-
const [textWidth, setTextWidthUpdate] = PReact.useState(0);
|
|
110
|
-
const [textHeight, setTextHeightUpdate] = PReact.useState(0);
|
|
111
|
-
|
|
112
|
-
PReact.useEffect(() => {
|
|
113
|
-
if (onSizeUpdate) {
|
|
114
|
-
onSizeUpdate({ width: textWidth, height: textHeight });
|
|
115
|
-
}
|
|
116
|
-
}, [textWidth, textHeight, onSizeUpdate]);
|
|
117
|
-
|
|
118
|
-
const onTextSizeUpdate = PReact.useCallback(size => {
|
|
119
|
-
setTextWidthUpdate(size.width);
|
|
120
|
-
setTextHeightUpdate(size.height);
|
|
121
|
-
}, []);
|
|
122
|
-
|
|
123
|
-
const w = textWidth + padding * 2 + strokeWidth;
|
|
124
|
-
const h = textHeight + padding * 2 + strokeWidth;
|
|
125
|
-
const textOffsetY = Math.floor(height / 10);
|
|
126
|
-
|
|
127
|
-
return <>
|
|
128
|
-
<Rectangle
|
|
129
|
-
width={w}
|
|
130
|
-
height={h}
|
|
131
|
-
fill={fill}
|
|
132
|
-
stroke={stroke}
|
|
133
|
-
strokeWidth={strokeWidth}
|
|
134
|
-
cornerRadius={cornerRadius}
|
|
135
|
-
/>
|
|
136
|
-
<g transform={`translate(0 ${textOffsetY})`}>
|
|
137
|
-
<Text
|
|
138
|
-
text={text}
|
|
139
|
-
fontFamily={fontFamily}
|
|
140
|
-
height={height}
|
|
141
|
-
fill={textFill}
|
|
142
|
-
onSizeUpdate={onTextSizeUpdate}
|
|
143
|
-
/>
|
|
144
|
-
</g>
|
|
145
|
-
</>;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export interface LabelledRect extends TextBoxProps {
|
|
149
|
-
width?: number;
|
|
150
|
-
fontSize?: number;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export const LabelledRect: PReact.FunctionComponent<LabelledRect> = ({
|
|
154
|
-
text,
|
|
155
|
-
height = 12,
|
|
156
|
-
width = 12,
|
|
157
|
-
fontFamily = "Verdana",
|
|
158
|
-
fontSize = 10,
|
|
159
|
-
padding = 3,
|
|
160
|
-
fill = "whitesmoke",
|
|
161
|
-
stroke = "lightgray",
|
|
162
|
-
textFill = "black",
|
|
163
|
-
strokeWidth = 1,
|
|
164
|
-
cornerRadius = 0,
|
|
165
|
-
onSizeUpdate
|
|
166
|
-
}) => {
|
|
167
|
-
|
|
168
|
-
const [actualWidth, setActualWidthUpdate] = PReact.useState(width);
|
|
169
|
-
const [actualHeight, setActualHeightUpdate] = PReact.useState(height);
|
|
170
|
-
|
|
171
|
-
PReact.useLayoutEffect(() => {
|
|
172
|
-
const size = Utility.textSize(text, fontFamily, fontSize);
|
|
173
|
-
setActualWidthUpdate(size.width + padding * 2);
|
|
174
|
-
setActualHeightUpdate(size.height + padding * 2);
|
|
175
|
-
}, [text, fontFamily, fontSize, padding]);
|
|
176
|
-
|
|
177
|
-
PReact.useLayoutEffect(() => {
|
|
178
|
-
if (onSizeUpdate) {
|
|
179
|
-
onSizeUpdate({ width: actualWidth, height: actualHeight });
|
|
180
|
-
}
|
|
181
|
-
}, [actualWidth, actualHeight, padding, onSizeUpdate]);
|
|
182
|
-
|
|
183
|
-
return <>
|
|
184
|
-
<Rectangle
|
|
185
|
-
width={width}
|
|
186
|
-
height={height}
|
|
187
|
-
fill={fill}
|
|
188
|
-
stroke={stroke}
|
|
189
|
-
strokeWidth={strokeWidth}
|
|
190
|
-
cornerRadius={cornerRadius}
|
|
191
|
-
/>
|
|
192
|
-
<g transform={`translate(${-(width / 2) + padding} ${-(height / 2) + padding})`}>
|
|
193
|
-
<TextLine
|
|
194
|
-
text={text}
|
|
195
|
-
fontFamily={fontFamily}
|
|
196
|
-
height={fontSize}
|
|
197
|
-
fill={textFill}
|
|
198
|
-
anchor="start"
|
|
199
|
-
baseline="hanging"
|
|
200
|
-
/>
|
|
201
|
-
</g>
|
|
202
|
-
</>;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
export interface IconLabelledRect extends LabelledRect {
|
|
206
|
-
icon: string;
|
|
207
|
-
iconFontFamily?: string;
|
|
208
|
-
iconFontSize?: number;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export const IconLabelledRect: PReact.FunctionComponent<IconLabelledRect> = ({
|
|
212
|
-
icon,
|
|
213
|
-
iconFontFamily,
|
|
214
|
-
text,
|
|
215
|
-
height = 12,
|
|
216
|
-
width = 12,
|
|
217
|
-
fontFamily = "Verdana",
|
|
218
|
-
fontSize = 10,
|
|
219
|
-
padding = 3,
|
|
220
|
-
fill = "whitesmoke",
|
|
221
|
-
stroke = "lightgray",
|
|
222
|
-
textFill = "black",
|
|
223
|
-
strokeWidth = 1,
|
|
224
|
-
cornerRadius = 0
|
|
225
|
-
}) => {
|
|
226
|
-
|
|
227
|
-
return <>
|
|
228
|
-
<Rectangle
|
|
229
|
-
width={width}
|
|
230
|
-
height={height}
|
|
231
|
-
fill={fill}
|
|
232
|
-
stroke={stroke}
|
|
233
|
-
strokeWidth={strokeWidth}
|
|
234
|
-
cornerRadius={cornerRadius}
|
|
235
|
-
/>
|
|
236
|
-
<g transform={`translate(${-(width / 2) + padding} ${-(height / 2) + padding})`}>
|
|
237
|
-
<Icon
|
|
238
|
-
shape="square"
|
|
239
|
-
imageFontFamily={iconFontFamily}
|
|
240
|
-
imageChar={icon}
|
|
241
|
-
height={height}
|
|
242
|
-
fill={fill}
|
|
243
|
-
imageCharFill={textFill}
|
|
244
|
-
/>
|
|
245
|
-
</g>
|
|
246
|
-
<g transform={`translate(${-(width / 2) + (padding * 2) + height} ${-(height / 2) + padding})`}>
|
|
247
|
-
<TextLine
|
|
248
|
-
text={text}
|
|
249
|
-
fontFamily={fontFamily}
|
|
250
|
-
height={fontSize}
|
|
251
|
-
fill={textFill}
|
|
252
|
-
anchor="start"
|
|
253
|
-
baseline="hanging"
|
|
254
|
-
/>
|
|
255
|
-
</g>
|
|
256
|
-
</>;
|
|
257
|
-
};
|
|
1
|
+
import * as PReact from "./preact-shim.ts";
|
|
2
|
+
import { Utility } from "@hpcc-js/common";
|
|
3
|
+
import { Icon } from "./icon.tsx";
|
|
4
|
+
import { Rectangle } from "./shape.tsx";
|
|
5
|
+
|
|
6
|
+
export interface TextLineProps {
|
|
7
|
+
text: string;
|
|
8
|
+
height?: number;
|
|
9
|
+
anchor?: string;
|
|
10
|
+
baseline?: string;
|
|
11
|
+
fontFamily?: string;
|
|
12
|
+
fill?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const TextLine: PReact.FunctionComponent<TextLineProps> = ({
|
|
16
|
+
text,
|
|
17
|
+
height = 12,
|
|
18
|
+
anchor = "middle",
|
|
19
|
+
baseline = "middle",
|
|
20
|
+
fontFamily = "Verdana",
|
|
21
|
+
fill = "black"
|
|
22
|
+
}) => {
|
|
23
|
+
return <text
|
|
24
|
+
font-family={fontFamily}
|
|
25
|
+
font-size={`${height}px`}
|
|
26
|
+
text-anchor={anchor}
|
|
27
|
+
dominant-baseline={baseline}
|
|
28
|
+
fill={fill}
|
|
29
|
+
>{text}</text>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export interface TextProps {
|
|
33
|
+
text: string;
|
|
34
|
+
height?: number;
|
|
35
|
+
fontFamily?: string;
|
|
36
|
+
fill?: string;
|
|
37
|
+
onSizeUpdate?: (size: { width: number, height: number }) => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const Text: PReact.FunctionComponent<TextProps> = ({
|
|
41
|
+
text,
|
|
42
|
+
height = 12,
|
|
43
|
+
fontFamily = "Verdana",
|
|
44
|
+
fill = "black",
|
|
45
|
+
onSizeUpdate
|
|
46
|
+
}) => {
|
|
47
|
+
const [totalWidth, setTotalWidth] = PReact.useState(0);
|
|
48
|
+
const [totalHeight, setTotalHeight] = PReact.useState(0);
|
|
49
|
+
|
|
50
|
+
PReact.useEffect(() => {
|
|
51
|
+
if (onSizeUpdate) {
|
|
52
|
+
onSizeUpdate({ width: totalWidth, height: totalHeight });
|
|
53
|
+
}
|
|
54
|
+
}, [totalWidth, totalHeight, onSizeUpdate]);
|
|
55
|
+
|
|
56
|
+
const parts = PReact.useMemo(() => {
|
|
57
|
+
return text.split("\n");
|
|
58
|
+
}, [text]);
|
|
59
|
+
|
|
60
|
+
PReact.useLayoutEffect(() => {
|
|
61
|
+
const size = Utility.textSize(parts, fontFamily, height);
|
|
62
|
+
setTotalWidth(size.width);
|
|
63
|
+
setTotalHeight(size.height);
|
|
64
|
+
}, [fontFamily, height, parts]);
|
|
65
|
+
|
|
66
|
+
const TextLines = PReact.useMemo(() => {
|
|
67
|
+
const yOffset = -(totalHeight / 2) + (height / 2);
|
|
68
|
+
return parts.map((p, i) => {
|
|
69
|
+
return <g key={`key-${i}`} transform={`translate(0 ${yOffset + i * (height + 2)})`}>
|
|
70
|
+
<TextLine
|
|
71
|
+
text={p}
|
|
72
|
+
height={height}
|
|
73
|
+
fontFamily={fontFamily}
|
|
74
|
+
fill={fill}
|
|
75
|
+
/>
|
|
76
|
+
</g>;
|
|
77
|
+
});
|
|
78
|
+
}, [parts, totalHeight, height, fontFamily, fill]);
|
|
79
|
+
|
|
80
|
+
return <g>{TextLines}</g>;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export interface TextBoxProps {
|
|
84
|
+
text: string;
|
|
85
|
+
height?: number;
|
|
86
|
+
fontFamily?: string;
|
|
87
|
+
padding?: number;
|
|
88
|
+
fill?: string;
|
|
89
|
+
stroke?: string;
|
|
90
|
+
textFill?: string;
|
|
91
|
+
strokeWidth?: number;
|
|
92
|
+
cornerRadius?: number;
|
|
93
|
+
textOffsetY?: number;
|
|
94
|
+
onSizeUpdate?: (size: { width: number, height: number }) => void;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const TextBox: PReact.FunctionComponent<TextBoxProps> = ({
|
|
98
|
+
text,
|
|
99
|
+
height = 12,
|
|
100
|
+
fontFamily = "Verdana",
|
|
101
|
+
padding = 4,
|
|
102
|
+
fill = "whitesmoke",
|
|
103
|
+
stroke = "lightgray",
|
|
104
|
+
textFill = "black",
|
|
105
|
+
strokeWidth = 1,
|
|
106
|
+
cornerRadius = 0,
|
|
107
|
+
onSizeUpdate
|
|
108
|
+
}) => {
|
|
109
|
+
const [textWidth, setTextWidthUpdate] = PReact.useState(0);
|
|
110
|
+
const [textHeight, setTextHeightUpdate] = PReact.useState(0);
|
|
111
|
+
|
|
112
|
+
PReact.useEffect(() => {
|
|
113
|
+
if (onSizeUpdate) {
|
|
114
|
+
onSizeUpdate({ width: textWidth, height: textHeight });
|
|
115
|
+
}
|
|
116
|
+
}, [textWidth, textHeight, onSizeUpdate]);
|
|
117
|
+
|
|
118
|
+
const onTextSizeUpdate = PReact.useCallback(size => {
|
|
119
|
+
setTextWidthUpdate(size.width);
|
|
120
|
+
setTextHeightUpdate(size.height);
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
123
|
+
const w = textWidth + padding * 2 + strokeWidth;
|
|
124
|
+
const h = textHeight + padding * 2 + strokeWidth;
|
|
125
|
+
const textOffsetY = Math.floor(height / 10);
|
|
126
|
+
|
|
127
|
+
return <>
|
|
128
|
+
<Rectangle
|
|
129
|
+
width={w}
|
|
130
|
+
height={h}
|
|
131
|
+
fill={fill}
|
|
132
|
+
stroke={stroke}
|
|
133
|
+
strokeWidth={strokeWidth}
|
|
134
|
+
cornerRadius={cornerRadius}
|
|
135
|
+
/>
|
|
136
|
+
<g transform={`translate(0 ${textOffsetY})`}>
|
|
137
|
+
<Text
|
|
138
|
+
text={text}
|
|
139
|
+
fontFamily={fontFamily}
|
|
140
|
+
height={height}
|
|
141
|
+
fill={textFill}
|
|
142
|
+
onSizeUpdate={onTextSizeUpdate}
|
|
143
|
+
/>
|
|
144
|
+
</g>
|
|
145
|
+
</>;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export interface LabelledRect extends TextBoxProps {
|
|
149
|
+
width?: number;
|
|
150
|
+
fontSize?: number;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export const LabelledRect: PReact.FunctionComponent<LabelledRect> = ({
|
|
154
|
+
text,
|
|
155
|
+
height = 12,
|
|
156
|
+
width = 12,
|
|
157
|
+
fontFamily = "Verdana",
|
|
158
|
+
fontSize = 10,
|
|
159
|
+
padding = 3,
|
|
160
|
+
fill = "whitesmoke",
|
|
161
|
+
stroke = "lightgray",
|
|
162
|
+
textFill = "black",
|
|
163
|
+
strokeWidth = 1,
|
|
164
|
+
cornerRadius = 0,
|
|
165
|
+
onSizeUpdate
|
|
166
|
+
}) => {
|
|
167
|
+
|
|
168
|
+
const [actualWidth, setActualWidthUpdate] = PReact.useState(width);
|
|
169
|
+
const [actualHeight, setActualHeightUpdate] = PReact.useState(height);
|
|
170
|
+
|
|
171
|
+
PReact.useLayoutEffect(() => {
|
|
172
|
+
const size = Utility.textSize(text, fontFamily, fontSize);
|
|
173
|
+
setActualWidthUpdate(size.width + padding * 2);
|
|
174
|
+
setActualHeightUpdate(size.height + padding * 2);
|
|
175
|
+
}, [text, fontFamily, fontSize, padding]);
|
|
176
|
+
|
|
177
|
+
PReact.useLayoutEffect(() => {
|
|
178
|
+
if (onSizeUpdate) {
|
|
179
|
+
onSizeUpdate({ width: actualWidth, height: actualHeight });
|
|
180
|
+
}
|
|
181
|
+
}, [actualWidth, actualHeight, padding, onSizeUpdate]);
|
|
182
|
+
|
|
183
|
+
return <>
|
|
184
|
+
<Rectangle
|
|
185
|
+
width={width}
|
|
186
|
+
height={height}
|
|
187
|
+
fill={fill}
|
|
188
|
+
stroke={stroke}
|
|
189
|
+
strokeWidth={strokeWidth}
|
|
190
|
+
cornerRadius={cornerRadius}
|
|
191
|
+
/>
|
|
192
|
+
<g transform={`translate(${-(width / 2) + padding} ${-(height / 2) + padding})`}>
|
|
193
|
+
<TextLine
|
|
194
|
+
text={text}
|
|
195
|
+
fontFamily={fontFamily}
|
|
196
|
+
height={fontSize}
|
|
197
|
+
fill={textFill}
|
|
198
|
+
anchor="start"
|
|
199
|
+
baseline="hanging"
|
|
200
|
+
/>
|
|
201
|
+
</g>
|
|
202
|
+
</>;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export interface IconLabelledRect extends LabelledRect {
|
|
206
|
+
icon: string;
|
|
207
|
+
iconFontFamily?: string;
|
|
208
|
+
iconFontSize?: number;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export const IconLabelledRect: PReact.FunctionComponent<IconLabelledRect> = ({
|
|
212
|
+
icon,
|
|
213
|
+
iconFontFamily,
|
|
214
|
+
text,
|
|
215
|
+
height = 12,
|
|
216
|
+
width = 12,
|
|
217
|
+
fontFamily = "Verdana",
|
|
218
|
+
fontSize = 10,
|
|
219
|
+
padding = 3,
|
|
220
|
+
fill = "whitesmoke",
|
|
221
|
+
stroke = "lightgray",
|
|
222
|
+
textFill = "black",
|
|
223
|
+
strokeWidth = 1,
|
|
224
|
+
cornerRadius = 0
|
|
225
|
+
}) => {
|
|
226
|
+
|
|
227
|
+
return <>
|
|
228
|
+
<Rectangle
|
|
229
|
+
width={width}
|
|
230
|
+
height={height}
|
|
231
|
+
fill={fill}
|
|
232
|
+
stroke={stroke}
|
|
233
|
+
strokeWidth={strokeWidth}
|
|
234
|
+
cornerRadius={cornerRadius}
|
|
235
|
+
/>
|
|
236
|
+
<g transform={`translate(${-(width / 2) + padding} ${-(height / 2) + padding})`}>
|
|
237
|
+
<Icon
|
|
238
|
+
shape="square"
|
|
239
|
+
imageFontFamily={iconFontFamily}
|
|
240
|
+
imageChar={icon}
|
|
241
|
+
height={height}
|
|
242
|
+
fill={fill}
|
|
243
|
+
imageCharFill={textFill}
|
|
244
|
+
/>
|
|
245
|
+
</g>
|
|
246
|
+
<g transform={`translate(${-(width / 2) + (padding * 2) + height} ${-(height / 2) + padding})`}>
|
|
247
|
+
<TextLine
|
|
248
|
+
text={text}
|
|
249
|
+
fontFamily={fontFamily}
|
|
250
|
+
height={fontSize}
|
|
251
|
+
fill={textFill}
|
|
252
|
+
anchor="start"
|
|
253
|
+
baseline="hanging"
|
|
254
|
+
/>
|
|
255
|
+
</g>
|
|
256
|
+
</>;
|
|
257
|
+
};
|