@obosbbl/grunnmuren-react 3.8.1 → 3.8.2
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.
|
@@ -340,8 +340,11 @@ const variants = cva.cva({
|
|
|
340
340
|
],
|
|
341
341
|
'full-bleed': [
|
|
342
342
|
oneColumnLayout,
|
|
343
|
-
//
|
|
344
|
-
|
|
343
|
+
// Break media out to full viewport width — except the VideoLoop wrapper (`:has(video)`), which
|
|
344
|
+
// stays container-width so its play button anchors to the grid container (see the video rule below).
|
|
345
|
+
'*:data-[slot=media]:*:not-has-[video]:absolute *:data-[slot=media]:*:not-has-[video]:left-0',
|
|
346
|
+
// Break only the VideoLoop's video out to full width; the wrapper (and its button) stay in the container.
|
|
347
|
+
'**:data-[slot=video]:relative **:data-[slot=video]:left-1/2 **:data-[slot=video]:min-w-screen **:data-[slot=video]:-translate-x-1/2',
|
|
345
348
|
// Special case for Carousel, where the Media is nested inside a CarouselItem
|
|
346
349
|
'*:data-[slot=carousel]:**:data-[slot=media]:w-full',
|
|
347
350
|
// Match the heights of the <Media> or <Carousel> wrapper for the Media content (e.g. image, VideoLoop, video etc.)
|
|
@@ -338,8 +338,11 @@ const variants = cva({
|
|
|
338
338
|
],
|
|
339
339
|
'full-bleed': [
|
|
340
340
|
oneColumnLayout,
|
|
341
|
-
//
|
|
342
|
-
|
|
341
|
+
// Break media out to full viewport width — except the VideoLoop wrapper (`:has(video)`), which
|
|
342
|
+
// stays container-width so its play button anchors to the grid container (see the video rule below).
|
|
343
|
+
'*:data-[slot=media]:*:not-has-[video]:absolute *:data-[slot=media]:*:not-has-[video]:left-0',
|
|
344
|
+
// Break only the VideoLoop's video out to full width; the wrapper (and its button) stay in the container.
|
|
345
|
+
'**:data-[slot=video]:relative **:data-[slot=video]:left-1/2 **:data-[slot=video]:min-w-screen **:data-[slot=video]:-translate-x-1/2',
|
|
343
346
|
// Special case for Carousel, where the Media is nested inside a CarouselItem
|
|
344
347
|
'*:data-[slot=carousel]:**:data-[slot=media]:w-full',
|
|
345
348
|
// Match the heights of the <Media> or <Carousel> wrapper for the Media content (e.g. image, VideoLoop, video etc.)
|
package/dist/index.d.mts
CHANGED
|
@@ -439,7 +439,7 @@ type HeadingProps = Omit<HTMLProps<HTMLHeadingElement>, 'size'> & VariantProps<t
|
|
|
439
439
|
};
|
|
440
440
|
declare const HeadingContext: react.Context<ContextValue<Partial<HeadingProps>, HTMLHeadingElement>>;
|
|
441
441
|
declare const headingVariants: (props?: ({
|
|
442
|
-
size?: "
|
|
442
|
+
size?: "s" | "xl" | "l" | "m" | "xs" | undefined;
|
|
443
443
|
} & ({
|
|
444
444
|
class?: cva.ClassValue;
|
|
445
445
|
className?: never;
|
package/dist/index.mjs
CHANGED
|
@@ -426,6 +426,16 @@ const translations$1 = {
|
|
|
426
426
|
nb: 'Fullført',
|
|
427
427
|
sv: 'Slutförd',
|
|
428
428
|
en: 'Completed'
|
|
429
|
+
},
|
|
430
|
+
playAnimation: {
|
|
431
|
+
nb: 'Spill av animasjon',
|
|
432
|
+
sv: 'Spela upp animation',
|
|
433
|
+
en: 'Play animation'
|
|
434
|
+
},
|
|
435
|
+
pauseAnimation: {
|
|
436
|
+
nb: 'Pause animasjon',
|
|
437
|
+
sv: 'Pausa animation',
|
|
438
|
+
en: 'Pause animation'
|
|
429
439
|
}
|
|
430
440
|
};
|
|
431
441
|
|
|
@@ -1238,8 +1248,11 @@ const variants = cva({
|
|
|
1238
1248
|
],
|
|
1239
1249
|
'full-bleed': [
|
|
1240
1250
|
oneColumnLayout,
|
|
1241
|
-
//
|
|
1242
|
-
|
|
1251
|
+
// Break media out to full viewport width — except the VideoLoop wrapper (`:has(video)`), which
|
|
1252
|
+
// stays container-width so its play button anchors to the grid container (see the video rule below).
|
|
1253
|
+
'*:data-[slot=media]:*:not-has-[video]:absolute *:data-[slot=media]:*:not-has-[video]:left-0',
|
|
1254
|
+
// Break only the VideoLoop's video out to full width; the wrapper (and its button) stay in the container.
|
|
1255
|
+
'**:data-[slot=video]:relative **:data-[slot=video]:left-1/2 **:data-[slot=video]:min-w-screen **:data-[slot=video]:-translate-x-1/2',
|
|
1243
1256
|
// Special case for Carousel, where the Media is nested inside a CarouselItem
|
|
1244
1257
|
'*:data-[slot=carousel]:**:data-[slot=media]:w-full',
|
|
1245
1258
|
// Match the heights of the <Media> or <Carousel> wrapper for the Media content (e.g. image, VideoLoop, video etc.)
|
|
@@ -3639,19 +3652,23 @@ const VideoLoop = ({ src, format, alt, className })=>{
|
|
|
3639
3652
|
}, [
|
|
3640
3653
|
shouldPlay
|
|
3641
3654
|
]);
|
|
3655
|
+
const togglePlayback = ()=>setShouldPlay((prevState)=>!prevState);
|
|
3656
|
+
const locale = _useLocale();
|
|
3642
3657
|
return /*#__PURE__*/ jsxs("div", {
|
|
3643
|
-
className: cx(className,
|
|
3658
|
+
className: cx(className, // group: hover anywhere reveals the button. @container: corner placement only when large.
|
|
3659
|
+
'group @container relative', prefersReducedMotion === null && 'opacity-0'),
|
|
3644
3660
|
"data-slot": "video-loop",
|
|
3645
3661
|
children: [
|
|
3646
3662
|
/*#__PURE__*/ jsx("video", {
|
|
3647
3663
|
"aria-hidden": true,
|
|
3648
3664
|
ref: videoRef,
|
|
3649
|
-
//
|
|
3665
|
+
// Click anywhere on the video to toggle playback (in addition to the button)
|
|
3650
3666
|
className: "size-full max-h-[inherit] cursor-pointer rounded-[inherit] object-cover",
|
|
3651
3667
|
playsInline: true,
|
|
3652
3668
|
loop: prefersReducedMotion === false,
|
|
3653
3669
|
autoPlay: prefersReducedMotion === false,
|
|
3654
3670
|
muted: true,
|
|
3671
|
+
onClick: togglePlayback,
|
|
3655
3672
|
onEnded: (event)=>{
|
|
3656
3673
|
if (prefersReducedMotion) {
|
|
3657
3674
|
// Reset the video to the beginning if the user prefers reduced motion, since the video will not loop
|
|
@@ -3666,27 +3683,25 @@ const VideoLoop = ({ src, format, alt, className })=>{
|
|
|
3666
3683
|
type: `video/${format}`
|
|
3667
3684
|
})
|
|
3668
3685
|
}),
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3686
|
+
alt && /*#__PURE__*/ jsx("p", {
|
|
3687
|
+
className: "sr-only",
|
|
3688
|
+
children: alt
|
|
3689
|
+
}),
|
|
3690
|
+
prefersReducedMotion !== null && /*#__PURE__*/ jsx(Button, {
|
|
3691
|
+
"aria-label": isPlaying ? translations$1.pauseAnimation[locale] : translations$1.playAnimation[locale],
|
|
3692
|
+
isIconOnly: true,
|
|
3693
|
+
variant: "primary",
|
|
3694
|
+
color: "white",
|
|
3695
|
+
onPress: togglePlayback,
|
|
3696
|
+
className: cx(// Centered in small containers; moved to the bottom-left corner in larger ones
|
|
3697
|
+
'absolute inset-0 m-auto size-fit', '@md:inset-auto @md:bottom-4 @md:left-4', // Opacity-only transition; overrides Button's `transition-colors` so the focus outline doesn't flash black→white
|
|
3698
|
+
'transition-opacity duration-200', // Start hidden so the button fades in once the video plays
|
|
3676
3699
|
shouldPlay && 'opacity-0', isPlaying && [
|
|
3677
|
-
'transition-opacity duration-200',
|
|
3678
3700
|
// Only show the pause button when the video is hovered or focused
|
|
3679
3701
|
'focus-visible:opacity-100',
|
|
3680
|
-
'hover:opacity-100'
|
|
3702
|
+
'group-hover:opacity-100'
|
|
3681
3703
|
]),
|
|
3682
|
-
children: /*#__PURE__*/ jsx(
|
|
3683
|
-
className: "grid size-12 place-items-center rounded-full bg-white outline-hidden",
|
|
3684
|
-
children: isPlaying ? /*#__PURE__*/ jsx(PlayerPause, {}) : /*#__PURE__*/ jsx(PlayerPlay, {})
|
|
3685
|
-
})
|
|
3686
|
-
}),
|
|
3687
|
-
alt && /*#__PURE__*/ jsx("p", {
|
|
3688
|
-
className: "sr-only",
|
|
3689
|
-
children: alt
|
|
3704
|
+
children: isPlaying ? /*#__PURE__*/ jsx(PlayerPause, {}) : /*#__PURE__*/ jsx(PlayerPlay, {})
|
|
3690
3705
|
})
|
|
3691
3706
|
]
|
|
3692
3707
|
});
|