@leitware/composables 3.2.0 → 3.4.0

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 CHANGED
@@ -54,6 +54,26 @@ import { FormInput } from '@leitware/composables'
54
54
  import { Card } from '@leitware/composables'
55
55
  ```
56
56
 
57
+ ### Images
58
+
59
+ `Image` requires `src`, `alt`, and intrinsic pixel `width`/`height`, or explicit `fill` mode. Dimensions reserve space before loading; images shrink to fit their container. Use `alt=""` for decorative images.
60
+
61
+ ```tsx
62
+ import { AspectRatio, Image } from '@leitware/composables'
63
+
64
+ <Image src="/mountains.jpg" alt="Snow on the mountain peaks" width={1200} height={800} />
65
+
66
+ <AspectRatio ratio={16 / 9}>
67
+ <Image src="/mountains.jpg" alt="Snow on the mountain peaks" fill />
68
+ </AspectRatio>
69
+ ```
70
+
71
+ `fill` absolutely positions the image inside a positioned parent with a defined size. For a background, use a relatively positioned container, `alt=""`, and place foreground content above the image. `fit="cover"` crops by default; `fit="contain"` shows the entire image against the muted background. `position` controls the focal point. `className`, `style`, and the forwarded ref target the actual image.
72
+
73
+ Images default to `loading="lazy"` and `decoding="async"`. For an above-the-fold hero, use `loading="eager"` and optionally `fetchPriority="high"`. Native `srcSet`, `sizes`, events, and other image attributes pass through. Supply `sizes` to describe the rendered width when using width-descriptor `srcSet` sources. This is a native browser image component: it does not generate responsive sources or provide Next.js image optimization. Captions and credits can be composed using `figure` and `figcaption`.
74
+
75
+ Image presentation uses the same CVA variant system as other components: `variant="default"` provides rounded corners and a muted background, `variant="outline"` adds a semantic border, and `variant="plain"` removes rounding and background for edge-to-edge media. The default appearance is unchanged. `imageVariants` is exported for reusing these styles; `className` overrides remain supported.
76
+
57
77
  ### Override the theme
58
78
 
59
79
  Override known semantic variables after the imports. Define both modes when a colour decision should change with the theme: