jfs-components 0.0.67 → 0.0.68

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.
@@ -30,9 +30,10 @@ function normalizeSource(imageSource) {
30
30
  * its parent (`width: '100%'`, `height: '100%'`) — same default as the
31
31
  * most common usage in this library (background media, hero images).
32
32
  */
33
+ const DEFAULT_RATIO = 16 / 9;
33
34
  function Image({
34
35
  imageSource,
35
- ratio,
36
+ ratio = DEFAULT_RATIO,
36
37
  resizeMode = 'cover',
37
38
  width,
38
39
  height,
@@ -44,15 +45,21 @@ function Image({
44
45
  }) {
45
46
  const source = useMemo(() => normalizeSource(imageSource), [imageSource]);
46
47
  const layoutStyle = useMemo(() => {
47
- const s = {};
48
- if (ratio != null) {
49
- s.aspectRatio = ratio;
50
- s.width = width ?? '100%';
51
- if (height != null) s.height = height;
52
- } else {
53
- s.width = width ?? '100%';
54
- s.height = height ?? '100%';
55
- }
48
+ // If the caller has fully specified width AND height, they're doing a
49
+ // non-aspect layout (e.g. "fill the parent") — respect that and skip
50
+ // `aspectRatio` so it doesn't conflict.
51
+ const isExplicitBox = width != null && height != null;
52
+ const s = {
53
+ width: width ?? '100%',
54
+ ...(isExplicitBox ? {
55
+ height: height
56
+ } : {
57
+ aspectRatio: ratio,
58
+ ...(height != null ? {
59
+ height
60
+ } : {})
61
+ })
62
+ };
56
63
  if (borderRadius != null) s.borderRadius = borderRadius;
57
64
  return s;
58
65
  }, [ratio, width, height, borderRadius]);
@@ -25,18 +25,21 @@ export function MediaCard({
25
25
  style
26
26
  }) {
27
27
  const radius = parseFloat(getVariableByName('cardMedia/radius', modes) || '24');
28
- const gap = parseFloat(getVariableByName('cardMedia/gap', modes) || '0');
28
+
29
+ // No magic minHeight, no aspectRatio on the container. The card simply
30
+ // hugs whatever the background renders at: the <Image> sits in normal
31
+ // flow with `aspectRatio: ratio`, so its rendered height becomes the
32
+ // card's height. Header and Footer are absolutely positioned overlays
33
+ // and don't contribute to layout.
29
34
  const containerStyle = {
30
35
  borderRadius: radius,
31
- gap,
32
36
  overflow: 'hidden',
33
- position: 'relative',
34
- minHeight: 308
37
+ position: 'relative'
35
38
  };
36
39
 
37
- // `media` wins for back-compat / custom nodes; otherwise we delegate to
38
- // the shared <Image> for image-source backgrounds. All raster-rendering
39
- // concerns (URL-vs-{uri}, resizeMode, aspect-ratio) live in <Image>.
40
+ // `media` wins as an escape hatch (gradient/video/etc.). Otherwise we
41
+ // delegate to the shared <Image> for image-source backgrounds. The
42
+ // background renders in normal flow so its height drives the card.
40
43
  const background = media ?? (imageSource != null ? /*#__PURE__*/_jsx(Image, {
41
44
  imageSource: imageSource,
42
45
  ratio: ratio,
@@ -50,10 +53,11 @@ export function MediaCard({
50
53
  },
51
54
  children: /*#__PURE__*/_jsxs(View, {
52
55
  style: [containerStyle, style],
53
- children: [background ? /*#__PURE__*/_jsx(View, {
56
+ children: [background, children != null ? /*#__PURE__*/_jsx(View, {
54
57
  style: StyleSheet.absoluteFill,
55
- children: background
56
- }) : null, children]
58
+ pointerEvents: "box-none",
59
+ children: children
60
+ }) : null]
57
61
  })
58
62
  });
59
63
  }