@uniweb/kit 0.9.4 → 0.9.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/kit",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "Standard component library for Uniweb foundations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"fuse.js": "^7.0.0",
|
|
39
39
|
"shiki": "^3.0.0",
|
|
40
40
|
"tailwind-merge": "^2.6.0",
|
|
41
|
-
"@uniweb/core": "0.7.
|
|
41
|
+
"@uniweb/core": "0.7.6"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -92,6 +92,9 @@ export function Image({
|
|
|
92
92
|
src,
|
|
93
93
|
url,
|
|
94
94
|
alt = "",
|
|
95
|
+
caption,
|
|
96
|
+
figureClassName,
|
|
97
|
+
captionClassName,
|
|
95
98
|
href,
|
|
96
99
|
rounded,
|
|
97
100
|
filter,
|
|
@@ -184,16 +187,27 @@ export function Image({
|
|
|
184
187
|
/>
|
|
185
188
|
);
|
|
186
189
|
|
|
187
|
-
// Wrap in link if href provided
|
|
188
|
-
|
|
190
|
+
// Wrap in link if href provided. The link wraps the bare <img>; if a
|
|
191
|
+
// caption is also set, the figure wraps the link below.
|
|
192
|
+
const linked = href
|
|
193
|
+
? <Link to={href} className="inline-block">{imageElement}</Link>
|
|
194
|
+
: imageElement;
|
|
195
|
+
|
|
196
|
+
// Caption present → wrap in <figure>/<figcaption> for HTML/EPUB output.
|
|
197
|
+
// Foundations that prefer their own figure styling can pass a richer
|
|
198
|
+
// wrapper component instead; this is the kit-level default.
|
|
199
|
+
if (caption) {
|
|
189
200
|
return (
|
|
190
|
-
<
|
|
191
|
-
{
|
|
192
|
-
|
|
201
|
+
<figure className={cn("uniweb-figure my-4", figureClassName)}>
|
|
202
|
+
{linked}
|
|
203
|
+
<figcaption className={cn("uniweb-figcaption text-sm text-subtle mt-2", captionClassName)}>
|
|
204
|
+
{caption}
|
|
205
|
+
</figcaption>
|
|
206
|
+
</figure>
|
|
193
207
|
);
|
|
194
208
|
}
|
|
195
209
|
|
|
196
|
-
return
|
|
210
|
+
return linked;
|
|
197
211
|
}
|
|
198
212
|
|
|
199
213
|
export default Image;
|