@krizaka/ui 3.85.0 → 3.87.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.
Files changed (36) hide show
  1. package/dist/{chunk-FYPYJ6MW.js → chunk-GOGEYAYK.js} +25 -19
  2. package/dist/chunk-GOGEYAYK.js.map +1 -0
  3. package/dist/filter-bar.d.ts +3 -3
  4. package/dist/index.d.ts +13 -2
  5. package/dist/index.js +7 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/media-carousel.d.ts +10 -3
  8. package/dist/media-carousel.js +23 -14
  9. package/dist/media-carousel.js.map +1 -1
  10. package/dist/media-player.d.ts +16 -2
  11. package/dist/media-player.js +1 -1
  12. package/dist/pausable-loop.d.ts +27 -0
  13. package/dist/pausable-loop.js +68 -0
  14. package/dist/pausable-loop.js.map +1 -0
  15. package/dist/{player-lightbox-ETBQWDOT.js → player-lightbox-ASFOSUSD.js} +6 -3
  16. package/dist/{player-lightbox-ETBQWDOT.js.map → player-lightbox-ASFOSUSD.js.map} +1 -1
  17. package/dist/virtual.d.ts +3 -3
  18. package/package.json +18 -4
  19. package/registry/app-frame.json +1 -1
  20. package/registry/examples/media-gallery/carousel-loop.d.ts +4 -0
  21. package/registry/examples/media-gallery/carousel-loop.js +26 -0
  22. package/registry/examples/media-gallery/carousel-loop.tsx +24 -0
  23. package/registry/examples/media-gallery/carousel-single.d.ts +4 -0
  24. package/registry/examples/media-gallery/carousel-single.js +12 -0
  25. package/registry/examples/media-gallery/carousel-single.tsx +12 -0
  26. package/registry/examples/media-gallery/player-trigger.d.ts +4 -0
  27. package/registry/examples/media-gallery/player-trigger.js +20 -0
  28. package/registry/examples/media-gallery/player-trigger.tsx +19 -0
  29. package/registry/index.json +11 -10
  30. package/registry/map.json +1 -1
  31. package/registry/media-gallery.json +43 -7
  32. package/registry/nav-bar.json +1 -1
  33. package/registry/rail-nav.json +1 -1
  34. package/registry/shop.json +1 -1
  35. package/registry/site-footer.json +1 -1
  36. package/dist/chunk-FYPYJ6MW.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/media-gallery/pausable-loop.tsx"],"sourcesContent":["// @krizaka/ui/pausable-loop. Client (the page's load, the viewport, the reader's motion and data preferences). A muted, silent loop that previews a still or a\n// film: poster first, nothing fetched before the page's `load`, playing only while on screen, with a visible pause / play\n// control (WCAG 2.2.2). Under reduced motion or Save-Data the poster stays alone and there is nothing to pause.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { PauseGlyph, PlayGlyph } from \"../glyphs\";\nimport { playSafely, useInView, usePrefersReducedMotion } from \"../media\";\n\nexport type LoopSources = { webm?: string; mp4?: string };\nexport type LoopLabels = { pause: string; play: string };\nexport const loopLabels: LoopLabels = { pause: \"Pause the animation\", play: \"Play the animation\" };\n\nconst subscribeLoad = (notify: () => void) => {\n window.addEventListener(\"load\", notify);\n return () => window.removeEventListener(\"load\", notify);\n};\n/** `true` once the page has finished loading: a loop is not worth bytes before it. */\nfunction usePageLoaded(): boolean {\n return React.useSyncExternalStore(subscribeLoad, () => document.readyState === \"complete\", () => false);\n}\n\ntype SaveDataNavigator = Navigator & { connection?: { saveData?: boolean } };\n/** `true` when the person asked for less motion or less data: a loop stays a poster. */\nfunction useCalm(): boolean {\n const reduce = usePrefersReducedMotion();\n return reduce || (typeof navigator !== \"undefined\" && Boolean((navigator as SaveDataNavigator).connection?.saveData));\n}\n\nexport type PausableLoopProps = {\n /** The loop's files; `mp4` and / or `webm`. */\n sources: LoopSources;\n /** The still under the loop, shown first and kept under reduced motion or Save-Data. */\n poster: string;\n /** Plays only while `true` (e.g. the slide in view). Default `true`. */\n active?: boolean;\n /** The pause / play words, passed translated. English by default. */\n labels?: LoopLabels;\n /** Classes of the `<video>`; default fills its frame, cropped. */\n className?: string;\n};\n\n/** A muted, silent loop over a still, with a visible pause / play. Drop it into a frame that is `relative`: `MediaPlayer`'s `preview`, `MediaCarousel`'s `renderLoop`. */\nexport function PausableLoop({ sources, poster, active = true, labels = loopLabels, className = \"absolute inset-0 h-full w-full object-cover\" }: Readonly<PausableLoopProps>) {\n const calm = useCalm();\n const loaded = usePageLoaded();\n const mounted = !calm && loaded;\n const holder = React.useRef<HTMLDivElement>(null);\n const video = React.useRef<HTMLVideoElement>(null);\n const [onScreen, setOnScreen] = React.useState(() => typeof IntersectionObserver === \"undefined\");\n const [paused, setPaused] = React.useState(false);\n useInView(holder, setOnScreen, mounted);\n const playing = mounted && onScreen && active && !paused;\n React.useEffect(() => {\n if (!video.current) return;\n if (playing) playSafely(video.current);\n else video.current.pause?.();\n }, [playing]);\n const Glyph = paused ? PlayGlyph : PauseGlyph;\n return (\n <>\n <div ref={holder} className=\"absolute inset-0\">\n {mounted && (\n <video ref={video} className={className} poster={poster} muted loop playsInline preload=\"metadata\" aria-hidden tabIndex={-1}>\n {sources.webm && <source src={sources.webm} type=\"video/webm\" />}\n {sources.mp4 && <source src={sources.mp4} type=\"video/mp4\" />}\n </video>\n )}\n </div>\n {!calm && (\n <button\n type=\"button\"\n aria-label={paused ? labels.play : labels.pause}\n onClick={() => setPaused((p) => !p)}\n className={cn(\n \"absolute right-2 top-2 z-10 flex h-9 w-9 items-center justify-center rounded-full bg-scrim-strong text-fg-on-media transition-colors hover:bg-scrim \" +\n \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-reduce:transition-none\",\n )}\n >\n <Glyph className=\"h-4 w-4\" />\n </button>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,YAAY,WAAW;AAyDnB,mBAIyB,KADnB,YAHN;AAjDG,IAAM,aAAyB,EAAE,OAAO,uBAAuB,MAAM,qBAAqB;AAEjG,IAAM,gBAAgB,CAAC,WAAuB;AAC5C,SAAO,iBAAiB,QAAQ,MAAM;AACtC,SAAO,MAAM,OAAO,oBAAoB,QAAQ,MAAM;AACxD;AAEA,SAAS,gBAAyB;AAChC,SAAa,2BAAqB,eAAe,MAAM,SAAS,eAAe,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CAAC,CAAC;AAAA,QAClC,WAAW;AAAA,UACT;AAAA,QAEF;AAAA,QAEA,8BAAC,SAAM,WAAU,WAAU;AAAA;AAAA,IAC7B;AAAA,KAEJ;AAEJ;","names":[]}
@@ -5,7 +5,9 @@ import {
5
5
  import {
6
6
  VideoPlayer
7
7
  } from "./chunk-VYZFQE3P.js";
8
- import "./chunk-TN5JJ6JI.js";
8
+ import {
9
+ usePrefersReducedMotion
10
+ } from "./chunk-TN5JJ6JI.js";
9
11
  import "./chunk-S2O4NSN5.js";
10
12
  import "./chunk-NSLXEDIS.js";
11
13
 
@@ -137,12 +139,13 @@ var Dialog = {
137
139
  // src/media-gallery/player-lightbox.tsx
138
140
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
139
141
  function PlayerLightbox({ player, ratio, vertical, closeLabel, onClose }) {
142
+ const calm = usePrefersReducedMotion();
140
143
  return /* @__PURE__ */ jsx2(Dialog.Root, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs2(Dialog.Content, { size: vertical ? "sm" : "lg", closeLabel, className: "bg-media p-0", children: [
141
144
  /* @__PURE__ */ jsx2(Dialog.Title, { className: "sr-only", children: player.title }),
142
- /* @__PURE__ */ jsx2(VideoPlayer, { ...player, aspectRatio: ratio, playOnMount: true, pauseWhenHidden: false })
145
+ /* @__PURE__ */ jsx2(VideoPlayer, { ...player, aspectRatio: ratio, playOnMount: !calm, pauseWhenHidden: false })
143
146
  ] }) });
144
147
  }
145
148
  export {
146
149
  PlayerLightbox as default
147
150
  };
148
- //# sourceMappingURL=player-lightbox-ETBQWDOT.js.map
151
+ //# sourceMappingURL=player-lightbox-ASFOSUSD.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dialog/dialog.tsx","../src/dialog/return-focus.ts","../src/media-gallery/player-lightbox.tsx"],"sourcesContent":["// Client (a portal). Radix does the focus trap, the scroll lock, Escape, the outside click, aria-modal, the\n// aria-labelledby / aria-describedby wiring and the focus return: this file only holds the shape.\nimport { Dialog as DialogPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { useReturnFocus } from \"./return-focus\";\n\nexport const dialog = tv({\n slots: {\n overlay: \"kz-overlay fixed inset-0 z-50 bg-overlay\",\n content:\n \"kz-dialog fixed z-50 flex flex-col overflow-hidden border border-border-default bg-surface-1 text-fg shadow-lg focus:outline-hidden\",\n close: \"absolute right-3 top-3 h-9 w-9\",\n header: \"flex flex-col gap-1 px-5 pb-2 pr-14 pt-5\",\n title: \"text-base font-bold text-fg\",\n description: \"text-sm text-fg-secondary\",\n body: \"min-h-0 flex-1 overflow-y-auto px-5 pb-5\",\n footer:\n \"flex flex-wrap items-center justify-end gap-2 border-t border-border-subtle px-5 py-4 pb-[max(1rem,env(safe-area-inset-bottom))]\",\n },\n variants: {\n placement: {\n center: { content: \"left-1/2 top-1/2 max-h-[85dvh] w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl\" },\n /* A sheet: anchored at the bottom on a phone, centred from `sm` up. */\n bottom: {\n content:\n \"inset-x-0 bottom-0 max-h-[92dvh] rounded-t-[1.75rem] sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:w-full \" +\n \"sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-[1.75rem]\",\n },\n right: { content: \"inset-y-0 right-0 h-full w-full max-w-md rounded-none border-y-0 border-r-0\" },\n /* A navigation drawer: full height, from the left, clear of the notch. */\n left: { content: \"inset-y-0 left-0 h-full w-full max-w-md rounded-none border-y-0 border-l-0 pl-[env(safe-area-inset-left)]\" },\n },\n size: { sm: { content: \"sm:max-w-sm\" }, md: { content: \"sm:max-w-md\" }, lg: { content: \"sm:max-w-2xl\" } },\n },\n defaultVariants: { placement: \"center\", size: \"md\" },\n});\nconst s = dialog();\n\nexport type DialogVariants = VariantProps<typeof dialog>;\n\nfunction CloseIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" className=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n );\n}\n\ntype CloseButtonProps =\n | {\n /** The accessible name of the close button — passed translated. */\n closeLabel: string;\n /** Leaves the close button out (the content brings its own way out, or none: see `dismissible`). */\n hideClose?: false;\n }\n | { closeLabel?: string; hideClose: true };\n\nexport type DialogContentProps = React.ComponentProps<typeof DialogPrimitive.Content> &\n DialogVariants &\n CloseButtonProps & {\n /**\n * center · bottom (a sheet on a phone, centred from `sm` up) · right (a side panel, full height) · left (a\n * navigation drawer, full height).\n * @default \"center\"\n */\n placement?: DialogVariants[\"placement\"];\n /**\n * sm · md · lg: the width of the dialog.\n * @default \"md\"\n */\n size?: DialogVariants[\"size\"];\n /**\n * `false`: Escape and a click outside do not close it (a gate the user must answer: age, terms). It still closes\n * through `open` / `onOpenChange` and any `Dialog.Close` inside. Default `true`.\n */\n dismissible?: boolean;\n /** The element the portal renders into (default: document.body). */\n container?: HTMLElement | null;\n };\n\nconst prevent = (event: Event) => event.preventDefault();\n\n/** Radix's content, mounted only while open: it remembers the opener then and gives focus back on close (WCAG 2.4.3). */\nfunction ReturnFocusContent({ onCloseAutoFocus, ...props }: React.ComponentProps<typeof DialogPrimitive.Content>) {\n return <DialogPrimitive.Content onCloseAutoFocus={useReturnFocus(onCloseAutoFocus)} {...props} />;\n}\n\n/** The dialog itself, portalled over a dimmed overlay, with a close button. Give it a `Dialog.Title`. */\nexport function DialogContent({\n placement,\n size,\n closeLabel,\n hideClose,\n dismissible = true,\n container,\n className,\n children,\n onEscapeKeyDown,\n onPointerDownOutside,\n onInteractOutside,\n ...props\n}: DialogContentProps) {\n const v = dialog({ placement, size });\n return (\n <DialogPrimitive.Portal container={container}>\n <DialogPrimitive.Overlay className={v.overlay()} />\n <ReturnFocusContent\n data-placement={placement ?? \"center\"}\n data-dismissible={dismissible ? undefined : \"false\"}\n className={v.content({ className })}\n onEscapeKeyDown={dismissible ? onEscapeKeyDown : chain(onEscapeKeyDown, prevent)}\n onPointerDownOutside={dismissible ? onPointerDownOutside : chain(onPointerDownOutside, prevent)}\n onInteractOutside={dismissible ? onInteractOutside : chain(onInteractOutside, prevent)}\n {...props}\n >\n {children}\n {!hideClose && (\n <DialogPrimitive.Close asChild>\n <IconButton label={closeLabel as string} variant=\"ghost\" shape=\"pill\" className={v.close()}>\n <CloseIcon />\n </IconButton>\n </DialogPrimitive.Close>\n )}\n </ReturnFocusContent>\n </DialogPrimitive.Portal>\n );\n}\n\nfunction chain<E extends Event>(handler: ((event: E) => void) | undefined, then: (event: E) => void) {\n return (event: E) => {\n handler?.(event);\n then(event);\n };\n}\n\nexport function DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.header({ className })} {...props} />;\n}\n\nexport function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return <DialogPrimitive.Title className={s.title({ className })} {...props} />;\n}\n\nexport function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return <DialogPrimitive.Description className={s.description({ className })} {...props} />;\n}\n\nexport function DialogBody({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.body({ className })} {...props} />;\n}\n\nexport function DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.footer({ className })} {...props} />;\n}\n\n/** `Dialog.Root/Trigger/Content/Header/Title/Description/Body/Footer/Close`. `open`/`defaultOpen` + `onOpenChange`. */\nexport const Dialog = {\n Root: DialogPrimitive.Root,\n Trigger: DialogPrimitive.Trigger,\n Close: DialogPrimitive.Close,\n Content: DialogContent,\n Header: DialogHeader,\n Title: DialogTitle,\n Description: DialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n};\n\n/** `Omit` that keeps the close-button union (`closeLabel` required unless `hideClose`). */\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;\n\nexport type SheetProps = DistributiveOmit<DialogContentProps, \"placement\">;\n\n/** A sheet is a dialog anchored at the bottom (centred from `sm` up): `Dialog.Content placement=\"bottom\"`. */\nexport function Sheet(props: SheetProps) {\n return <DialogContent placement=\"bottom\" {...props} />;\n}\n","// Client. WCAG 2.4.3: when a dialog closes, focus goes back to what opened it. Radix only does it for `Dialog.Trigger`;\n// most app dialogs are controlled (`open` / `onOpenChange`) and opened by a plain button, so on Escape focus fell to\n// <body>. The content remembers the focused element when it mounts (it is still the opener: Radix moves focus in an\n// effect) and gives it back on close, unless the consumer's `onCloseAutoFocus` prevented the default.\nimport * as React from \"react\";\n\n/** The handler for `onCloseAutoFocus`: yours first, then focus back on the opener if it is still on the page. */\nexport function useReturnFocus(onCloseAutoFocus?: (event: Event) => void) {\n const [opener] = React.useState<Element | null>(() => (typeof document === \"undefined\" ? null : document.activeElement));\n return React.useCallback(\n (event: Event) => {\n onCloseAutoFocus?.(event);\n if (event.defaultPrevented) return;\n if (opener instanceof HTMLElement && opener !== document.body && opener.isConnected) {\n event.preventDefault();\n opener.focus();\n }\n },\n [opener, onCloseAutoFocus],\n );\n}\n","// Client. The lightbox's dialog and its player: loaded by `MediaPlayer` only when the poster is pressed.\nimport * as React from \"react\";\n\nimport { Dialog } from \"../dialog\";\nimport { VideoPlayer, type VideoPlayerProps } from \"../video-player\";\n\nexport type PlayerLightboxProps = {\n player: Omit<VideoPlayerProps, \"aspectRatio\" | \"className\">;\n ratio: string;\n vertical: boolean;\n closeLabel: string;\n onClose: () => void;\n};\n\n/** The open dialog holding the player, started by the press that opened it. */\nexport default function PlayerLightbox({ player, ratio, vertical, closeLabel, onClose }: Readonly<PlayerLightboxProps>) {\n return (\n <Dialog.Root open onOpenChange={(open) => !open && onClose()}>\n <Dialog.Content size={vertical ? \"sm\" : \"lg\"} closeLabel={closeLabel} className=\"bg-media p-0\">\n <Dialog.Title className=\"sr-only\">{player.title}</Dialog.Title>\n <VideoPlayer {...player} aspectRatio={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YAAwB,WAAU,gBAC9E;AAAA,oBAAAD,KAAC,OAAO,OAAP,EAAa,WAAU,WAAW,iBAAO,OAAM;AAAA,IAChD,gBAAAA,KAAC,eAAa,GAAG,QAAQ,aAAa,OAAO,aAAW,MAAC,iBAAiB,OAAO;AAAA,KACnF,GACF;AAEJ;","names":["jsx","jsxs"]}
1
+ {"version":3,"sources":["../src/dialog/dialog.tsx","../src/dialog/return-focus.ts","../src/media-gallery/player-lightbox.tsx"],"sourcesContent":["// Client (a portal). Radix does the focus trap, the scroll lock, Escape, the outside click, aria-modal, the\n// aria-labelledby / aria-describedby wiring and the focus return: this file only holds the shape.\nimport { Dialog as DialogPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { useReturnFocus } from \"./return-focus\";\n\nexport const dialog = tv({\n slots: {\n overlay: \"kz-overlay fixed inset-0 z-50 bg-overlay\",\n content:\n \"kz-dialog fixed z-50 flex flex-col overflow-hidden border border-border-default bg-surface-1 text-fg shadow-lg focus:outline-hidden\",\n close: \"absolute right-3 top-3 h-9 w-9\",\n header: \"flex flex-col gap-1 px-5 pb-2 pr-14 pt-5\",\n title: \"text-base font-bold text-fg\",\n description: \"text-sm text-fg-secondary\",\n body: \"min-h-0 flex-1 overflow-y-auto px-5 pb-5\",\n footer:\n \"flex flex-wrap items-center justify-end gap-2 border-t border-border-subtle px-5 py-4 pb-[max(1rem,env(safe-area-inset-bottom))]\",\n },\n variants: {\n placement: {\n center: { content: \"left-1/2 top-1/2 max-h-[85dvh] w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl\" },\n /* A sheet: anchored at the bottom on a phone, centred from `sm` up. */\n bottom: {\n content:\n \"inset-x-0 bottom-0 max-h-[92dvh] rounded-t-[1.75rem] sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:w-full \" +\n \"sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-[1.75rem]\",\n },\n right: { content: \"inset-y-0 right-0 h-full w-full max-w-md rounded-none border-y-0 border-r-0\" },\n /* A navigation drawer: full height, from the left, clear of the notch. */\n left: { content: \"inset-y-0 left-0 h-full w-full max-w-md rounded-none border-y-0 border-l-0 pl-[env(safe-area-inset-left)]\" },\n },\n size: { sm: { content: \"sm:max-w-sm\" }, md: { content: \"sm:max-w-md\" }, lg: { content: \"sm:max-w-2xl\" } },\n },\n defaultVariants: { placement: \"center\", size: \"md\" },\n});\nconst s = dialog();\n\nexport type DialogVariants = VariantProps<typeof dialog>;\n\nfunction CloseIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" className=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n );\n}\n\ntype CloseButtonProps =\n | {\n /** The accessible name of the close button — passed translated. */\n closeLabel: string;\n /** Leaves the close button out (the content brings its own way out, or none: see `dismissible`). */\n hideClose?: false;\n }\n | { closeLabel?: string; hideClose: true };\n\nexport type DialogContentProps = React.ComponentProps<typeof DialogPrimitive.Content> &\n DialogVariants &\n CloseButtonProps & {\n /**\n * center · bottom (a sheet on a phone, centred from `sm` up) · right (a side panel, full height) · left (a\n * navigation drawer, full height).\n * @default \"center\"\n */\n placement?: DialogVariants[\"placement\"];\n /**\n * sm · md · lg: the width of the dialog.\n * @default \"md\"\n */\n size?: DialogVariants[\"size\"];\n /**\n * `false`: Escape and a click outside do not close it (a gate the user must answer: age, terms). It still closes\n * through `open` / `onOpenChange` and any `Dialog.Close` inside. Default `true`.\n */\n dismissible?: boolean;\n /** The element the portal renders into (default: document.body). */\n container?: HTMLElement | null;\n };\n\nconst prevent = (event: Event) => event.preventDefault();\n\n/** Radix's content, mounted only while open: it remembers the opener then and gives focus back on close (WCAG 2.4.3). */\nfunction ReturnFocusContent({ onCloseAutoFocus, ...props }: React.ComponentProps<typeof DialogPrimitive.Content>) {\n return <DialogPrimitive.Content onCloseAutoFocus={useReturnFocus(onCloseAutoFocus)} {...props} />;\n}\n\n/** The dialog itself, portalled over a dimmed overlay, with a close button. Give it a `Dialog.Title`. */\nexport function DialogContent({\n placement,\n size,\n closeLabel,\n hideClose,\n dismissible = true,\n container,\n className,\n children,\n onEscapeKeyDown,\n onPointerDownOutside,\n onInteractOutside,\n ...props\n}: DialogContentProps) {\n const v = dialog({ placement, size });\n return (\n <DialogPrimitive.Portal container={container}>\n <DialogPrimitive.Overlay className={v.overlay()} />\n <ReturnFocusContent\n data-placement={placement ?? \"center\"}\n data-dismissible={dismissible ? undefined : \"false\"}\n className={v.content({ className })}\n onEscapeKeyDown={dismissible ? onEscapeKeyDown : chain(onEscapeKeyDown, prevent)}\n onPointerDownOutside={dismissible ? onPointerDownOutside : chain(onPointerDownOutside, prevent)}\n onInteractOutside={dismissible ? onInteractOutside : chain(onInteractOutside, prevent)}\n {...props}\n >\n {children}\n {!hideClose && (\n <DialogPrimitive.Close asChild>\n <IconButton label={closeLabel as string} variant=\"ghost\" shape=\"pill\" className={v.close()}>\n <CloseIcon />\n </IconButton>\n </DialogPrimitive.Close>\n )}\n </ReturnFocusContent>\n </DialogPrimitive.Portal>\n );\n}\n\nfunction chain<E extends Event>(handler: ((event: E) => void) | undefined, then: (event: E) => void) {\n return (event: E) => {\n handler?.(event);\n then(event);\n };\n}\n\nexport function DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.header({ className })} {...props} />;\n}\n\nexport function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return <DialogPrimitive.Title className={s.title({ className })} {...props} />;\n}\n\nexport function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return <DialogPrimitive.Description className={s.description({ className })} {...props} />;\n}\n\nexport function DialogBody({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.body({ className })} {...props} />;\n}\n\nexport function DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.footer({ className })} {...props} />;\n}\n\n/** `Dialog.Root/Trigger/Content/Header/Title/Description/Body/Footer/Close`. `open`/`defaultOpen` + `onOpenChange`. */\nexport const Dialog = {\n Root: DialogPrimitive.Root,\n Trigger: DialogPrimitive.Trigger,\n Close: DialogPrimitive.Close,\n Content: DialogContent,\n Header: DialogHeader,\n Title: DialogTitle,\n Description: DialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n};\n\n/** `Omit` that keeps the close-button union (`closeLabel` required unless `hideClose`). */\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;\n\nexport type SheetProps = DistributiveOmit<DialogContentProps, \"placement\">;\n\n/** A sheet is a dialog anchored at the bottom (centred from `sm` up): `Dialog.Content placement=\"bottom\"`. */\nexport function Sheet(props: SheetProps) {\n return <DialogContent placement=\"bottom\" {...props} />;\n}\n","// Client. WCAG 2.4.3: when a dialog closes, focus goes back to what opened it. Radix only does it for `Dialog.Trigger`;\n// most app dialogs are controlled (`open` / `onOpenChange`) and opened by a plain button, so on Escape focus fell to\n// <body>. The content remembers the focused element when it mounts (it is still the opener: Radix moves focus in an\n// effect) and gives it back on close, unless the consumer's `onCloseAutoFocus` prevented the default.\nimport * as React from \"react\";\n\n/** The handler for `onCloseAutoFocus`: yours first, then focus back on the opener if it is still on the page. */\nexport function useReturnFocus(onCloseAutoFocus?: (event: Event) => void) {\n const [opener] = React.useState<Element | null>(() => (typeof document === \"undefined\" ? null : document.activeElement));\n return React.useCallback(\n (event: Event) => {\n onCloseAutoFocus?.(event);\n if (event.defaultPrevented) return;\n if (opener instanceof HTMLElement && opener !== document.body && opener.isConnected) {\n event.preventDefault();\n opener.focus();\n }\n },\n [opener, onCloseAutoFocus],\n );\n}\n","// Client. The lightbox's dialog and its player: loaded by `MediaPlayer` only when the poster is pressed.\nimport * as React from \"react\";\n\nimport { Dialog } from \"../dialog\";\nimport { usePrefersReducedMotion } from \"../media\";\nimport { VideoPlayer, type VideoPlayerProps } from \"../video-player\";\n\nexport type PlayerLightboxProps = {\n player: Omit<VideoPlayerProps, \"aspectRatio\" | \"className\">;\n ratio: string;\n vertical: boolean;\n closeLabel: string;\n onClose: () => void;\n};\n\n/** The open dialog holding the player, started by the press that opened it, except under reduced motion: it waits on the poster. */\nexport default function PlayerLightbox({ player, ratio, vertical, closeLabel, onClose }: Readonly<PlayerLightboxProps>) {\n const calm = usePrefersReducedMotion();\n return (\n <Dialog.Root open onOpenChange={(open) => !open && onClose()}>\n <Dialog.Content size={vertical ? \"sm\" : \"lg\"} closeLabel={closeLabel} className=\"bg-media p-0\">\n <Dialog.Title className=\"sr-only\">{player.title}</Dialog.Title>\n <VideoPlayer {...player} aspectRatio={ratio} playOnMount={!calm} pauseWhenHidden={false} />\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA,SAAS,UAAU,uBAAuB;AAE1C,SAAS,UAA6B;;;ACAtC,YAAY,WAAW;AAGhB,SAAS,eAAe,kBAA2C;AACxE,QAAM,CAAC,MAAM,IAAU,eAAyB,MAAO,OAAO,aAAa,cAAc,OAAO,SAAS,aAAc;AACvH,SAAa;AAAA,IACX,CAAC,UAAiB;AAChB,yBAAmB,KAAK;AACxB,UAAI,MAAM,iBAAkB;AAC5B,UAAI,kBAAkB,eAAe,WAAW,SAAS,QAAQ,OAAO,aAAa;AACnF,cAAM,eAAe;AACrB,eAAO,MAAM;AAAA,MACf;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,gBAAgB;AAAA,EAC3B;AACF;;;AD0BM,cA+DA,YA/DA;AArCC,IAAM,SAAS,GAAG;AAAA,EACvB,OAAO;AAAA,IACL,SAAS;AAAA,IACT,SACE;AAAA,IACF,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,QACE;AAAA,EACJ;AAAA,EACA,UAAU;AAAA,IACR,WAAW;AAAA,MACT,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O,IAAM,SAAS;AAAA,EACpB,MAAM,gBAAgB;AAAA,EACtB,SAAS,gBAAgB;AAAA,EACzB,OAAO,gBAAgB;AAAA,EACvB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,QAAQ;AACV;;;AErJM,SACE,OAAAA,MADF,QAAAC,aAAA;AAJS,SAAR,eAAgC,EAAE,QAAQ,OAAO,UAAU,YAAY,QAAQ,GAAkC;AACtH,QAAM,OAAO,wBAAwB;AACrC,SACE,gBAAAD,KAAC,OAAO,MAAP,EAAY,MAAI,MAAC,cAAc,CAAC,SAAS,CAAC,QAAQ,QAAQ,GACzD,0BAAAC,MAAC,OAAO,SAAP,EAAe,MAAM,WAAW,OAAO,MAAM,YAAwB,WAAU,gBAC9E;AAAA,oBAAAD,KAAC,OAAO,OAAP,EAAa,WAAU,WAAW,iBAAO,OAAM;AAAA,IAChD,gBAAAA,KAAC,eAAa,GAAG,QAAQ,aAAa,OAAO,aAAa,CAAC,MAAM,iBAAiB,OAAO;AAAA,KAC3F,GACF;AAEJ;","names":["jsx","jsxs"]}
package/dist/virtual.d.ts CHANGED
@@ -6,8 +6,8 @@ import * as React from 'react';
6
6
  declare const virtual: tailwind_variants.TVReturnType<{
7
7
  [key: string]: {
8
8
  [key: string]: tailwind_variants.ClassValue | {
9
- viewport?: tailwind_variants.ClassValue;
10
9
  list?: tailwind_variants.ClassValue;
10
+ viewport?: tailwind_variants.ClassValue;
11
11
  item?: tailwind_variants.ClassValue;
12
12
  row?: tailwind_variants.ClassValue;
13
13
  empty?: tailwind_variants.ClassValue;
@@ -16,8 +16,8 @@ declare const virtual: tailwind_variants.TVReturnType<{
16
16
  } | {
17
17
  [x: string]: {
18
18
  [x: string]: tailwind_variants.ClassValue | {
19
- viewport?: tailwind_variants.ClassValue;
20
19
  list?: tailwind_variants.ClassValue;
20
+ viewport?: tailwind_variants.ClassValue;
21
21
  item?: tailwind_variants.ClassValue;
22
22
  row?: tailwind_variants.ClassValue;
23
23
  empty?: tailwind_variants.ClassValue;
@@ -32,8 +32,8 @@ declare const virtual: tailwind_variants.TVReturnType<{
32
32
  }, undefined, {
33
33
  [key: string]: {
34
34
  [key: string]: tailwind_variants.ClassValue | {
35
- viewport?: tailwind_variants.ClassValue;
36
35
  list?: tailwind_variants.ClassValue;
36
+ viewport?: tailwind_variants.ClassValue;
37
37
  item?: tailwind_variants.ClassValue;
38
38
  row?: tailwind_variants.ClassValue;
39
39
  empty?: tailwind_variants.ClassValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krizaka/ui",
3
- "version": "3.85.0",
3
+ "version": "3.87.0",
4
4
  "description": "The Krizaka front-end platform's components: the primitives (button, card, dialog, toast, menu, field, tabs, chip, switch, slider, command palette, theme, countdown…) on the semantic --kz-* tokens, the animated marks (Krizaka, Orazaka, Yomizaka, Akinaza) and the motion signature — web and /native.",
5
5
  "keywords": [
6
6
  "krizaka",
@@ -525,6 +525,10 @@
525
525
  "types": "./dist/media-carousel.d.ts",
526
526
  "import": "./dist/media-carousel.js"
527
527
  },
528
+ "./pausable-loop": {
529
+ "types": "./dist/pausable-loop.d.ts",
530
+ "import": "./dist/pausable-loop.js"
531
+ },
528
532
  "./sticky-action": {
529
533
  "types": "./dist/sticky-action.d.ts",
530
534
  "import": "./dist/sticky-action.js"
@@ -1001,7 +1005,7 @@
1001
1005
  ],
1002
1006
  "peerDependencies": {
1003
1007
  "@krizaka/query": ">=0.3.0",
1004
- "@krizaka/tailwind": ">=3.85.0",
1008
+ "@krizaka/tailwind": ">=3.87.0",
1005
1009
  "@maplibre/maplibre-react-native": ">=11",
1006
1010
  "@shopify/flash-list": ">=2",
1007
1011
  "expo-camera": ">=16",
@@ -2203,6 +2207,16 @@
2203
2207
  "clsx"
2204
2208
  ]
2205
2209
  },
2210
+ {
2211
+ "name": "./pausable-loop",
2212
+ "path": "dist/pausable-loop.js",
2213
+ "limit": "2 kB",
2214
+ "gzip": true,
2215
+ "ignore": [
2216
+ "tailwind-variants",
2217
+ "clsx"
2218
+ ]
2219
+ },
2206
2220
  {
2207
2221
  "name": "./media-gallery",
2208
2222
  "path": "dist/media-gallery.js",
@@ -3454,8 +3468,8 @@
3454
3468
  "tailwind-variants": "^3.3.1",
3455
3469
  "zod": "^4.6.7",
3456
3470
  "@krizaka/pacer": "^0.2.0",
3457
- "@krizaka/tokens": "^3.85.0",
3458
- "@krizaka/intl": "^0.4.1"
3471
+ "@krizaka/intl": "^0.4.1",
3472
+ "@krizaka/tokens": "^3.87.0"
3459
3473
  },
3460
3474
  "scripts": {
3461
3475
  "build": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true});for(const f of fs.readdirSync('registry/examples',{recursive:true}))if(/\\.(js|d\\.ts)$/.test(f))fs.rmSync('registry/examples/'+f)\" && tsup && node -e \"require('node:fs').copyFileSync('src/motion.css','dist/motion.css');require('node:fs').copyFileSync('src/blocks.css','dist/blocks.css');require('node:fs').copyFileSync('src/story.css','dist/story.css')\" && node scripts/build-registry.mjs",
@@ -370,7 +370,7 @@
370
370
  }
371
371
  ],
372
372
  "dependencies": [
373
- "@krizaka/tokens@^3.85.0"
373
+ "@krizaka/tokens@^3.87.0"
374
374
  ],
375
375
  "registryDependencies": [
376
376
  "account-menu",
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,26 @@
1
+ "use client";
2
+
3
+ // registry/examples/media-gallery/carousel-loop.tsx
4
+ import { MediaCarousel } from "@krizaka/ui/media-carousel";
5
+ import { PausableLoop } from "@krizaka/ui/pausable-loop";
6
+ import { jsx } from "react/jsx-runtime";
7
+ var POSTER = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><rect width='800' height='500' fill='#23496f'/></svg>")}`;
8
+ var FILM = "https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4";
9
+ function MediaCarouselLoopExample() {
10
+ return /* @__PURE__ */ jsx("div", { className: "max-w-xl", children: /* @__PURE__ */ jsx(
11
+ MediaCarousel,
12
+ {
13
+ label: "R\xE9alisations",
14
+ slides: [
15
+ { id: "a", src: POSTER, alt: "Le film de Krizaka", caption: "Fig. 1a", video: { mp4: FILM }, film: { src: FILM, title: "Film : le monde de Krizaka", playLabel: "Lire le film" } },
16
+ { id: "b", src: POSTER, alt: "Un bail lu en une minute", caption: "Fig. 1b", video: { mp4: FILM } }
17
+ ],
18
+ labels: { previous: "Pr\xE9c\xE9dent", next: "Suivant", close: "Fermer", slide: "{n} sur {total}" },
19
+ renderLoop: (video, { poster, inView }) => /* @__PURE__ */ jsx(PausableLoop, { sources: video, poster, active: inView, labels: { pause: "Mettre l\u2019animation en pause", play: "Lancer l\u2019animation" } }),
20
+ playerLabels: { play: "Lire", pause: "Pause", mute: "Couper le son", unmute: "Remettre le son", volume: "Volume", seek: "Position", fullscreen: "Plein \xE9cran", exitFullscreen: "Quitter le plein \xE9cran", loading: "Chargement", error: "Cette vid\xE9o ne peut pas \xEAtre lue.", retry: "R\xE9essayer" }
21
+ }
22
+ ) });
23
+ }
24
+ export {
25
+ MediaCarouselLoopExample as default
26
+ };
@@ -0,0 +1,24 @@
1
+ import { MediaCarousel } from "@krizaka/ui/media-carousel";
2
+ import { PausableLoop } from "@krizaka/ui/pausable-loop";
3
+
4
+ const POSTER = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><rect width='800' height='500' fill='#23496f'/></svg>")}`;
5
+ const FILM = "https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4";
6
+
7
+ // A French page: a silent loop previews the film (after the page's load, only on screen, with a visible pause), a press opens the
8
+ // film, and every word of the carousel and of the player is passed translated. A still under reduced motion.
9
+ export default function MediaCarouselLoopExample() {
10
+ return (
11
+ <div className="max-w-xl">
12
+ <MediaCarousel
13
+ label="Réalisations"
14
+ slides={[
15
+ { id: "a", src: POSTER, alt: "Le film de Krizaka", caption: "Fig. 1a", video: { mp4: FILM }, film: { src: FILM, title: "Film : le monde de Krizaka", playLabel: "Lire le film" } },
16
+ { id: "b", src: POSTER, alt: "Un bail lu en une minute", caption: "Fig. 1b", video: { mp4: FILM } },
17
+ ]}
18
+ labels={{ previous: "Précédent", next: "Suivant", close: "Fermer", slide: "{n} sur {total}" }}
19
+ renderLoop={(video, { poster, inView }) => <PausableLoop sources={video} poster={poster} active={inView} labels={{ pause: "Mettre l’animation en pause", play: "Lancer l’animation" }} />}
20
+ playerLabels={{ play: "Lire", pause: "Pause", mute: "Couper le son", unmute: "Remettre le son", volume: "Volume", seek: "Position", fullscreen: "Plein écran", exitFullscreen: "Quitter le plein écran", loading: "Chargement", error: "Cette vidéo ne peut pas être lue.", retry: "Réessayer" }}
21
+ />
22
+ </div>
23
+ );
24
+ }
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+
3
+ // registry/examples/media-gallery/carousel-single.tsx
4
+ import { MediaCarousel } from "@krizaka/ui/media-carousel";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var PIC = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><rect width='800' height='500' fill='#1d3f6b'/></svg>")}`;
7
+ function MediaCarouselSingleExample() {
8
+ return /* @__PURE__ */ jsx("div", { className: "max-w-xl", children: /* @__PURE__ */ jsx(MediaCarousel, { label: "Realisation", slides: [{ id: "a", src: PIC, alt: "A lease read in a minute", caption: "Fig. 1a" }] }) });
9
+ }
10
+ export {
11
+ MediaCarouselSingleExample as default
12
+ };
@@ -0,0 +1,12 @@
1
+ import { MediaCarousel } from "@krizaka/ui/media-carousel";
2
+
3
+ const PIC = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 500'><rect width='800' height='500' fill='#1d3f6b'/></svg>")}`;
4
+
5
+ // One slide: the frame alone, no arrows and no « 1 / 1 ». A page can pass one or many without branching.
6
+ export default function MediaCarouselSingleExample() {
7
+ return (
8
+ <div className="max-w-xl">
9
+ <MediaCarousel label="Realisation" slides={[{ id: "a", src: PIC, alt: "A lease read in a minute", caption: "Fig. 1a" }]} />
10
+ </div>
11
+ );
12
+ }
@@ -0,0 +1,4 @@
1
+ import type { ComponentType } from "react";
2
+ /** A named example of the @krizaka/ui registry; `defaultOpen` opens what it opens (a dialog, a menu, toasts) at load. */
3
+ declare const Example: ComponentType<{ defaultOpen?: boolean }>;
4
+ export default Example;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+
3
+ // registry/examples/media-gallery/player-trigger.tsx
4
+ import { Button } from "@krizaka/ui/button";
5
+ import { MediaPlayer } from "@krizaka/ui/media-player";
6
+ import * as React from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ var FILM = "https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4";
9
+ var POSTER = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 450'><rect width='800' height='450' fill='#1d3f6b'/></svg>")}`;
10
+ function MediaPlayerTriggerExample() {
11
+ const [open, setOpen] = React.useState(false);
12
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-3", children: [
13
+ /* @__PURE__ */ jsx(MediaPlayer, { mode: "lightbox", src: FILM, poster: POSTER, title: "Film: the world of Krizaka", trigger: (openIt) => /* @__PURE__ */ jsx(Button, { onClick: openIt, children: "Watch the film" }) }),
14
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => setOpen(true), children: "Open from outside" }),
15
+ /* @__PURE__ */ jsx(MediaPlayer, { mode: "lightbox", ratio: "19 / 16", src: FILM, poster: POSTER, title: "Film: the engine take", trigger: null, open, onOpenChange: setOpen })
16
+ ] });
17
+ }
18
+ export {
19
+ MediaPlayerTriggerExample as default
20
+ };
@@ -0,0 +1,19 @@
1
+ import { Button } from "@krizaka/ui/button";
2
+ import { MediaPlayer } from "@krizaka/ui/media-player";
3
+ import * as React from "react";
4
+
5
+ const FILM = "https://krizaka-assets.b-cdn.net/org/v1/films/film/le-monde-de-krizaka-16x9.b1c7c4ee51.mp4";
6
+ const POSTER = `data:image/svg+xml,${encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 450'><rect width='800' height='450' fill='#1d3f6b'/></svg>")}`;
7
+
8
+ // The page's own button opens the lightbox (`trigger`); a second one drives it from outside (`open`), on a free 19 / 16 frame.
9
+ // Under reduced motion the dialog opens on the poster and waits for the press on play.
10
+ export default function MediaPlayerTriggerExample() {
11
+ const [open, setOpen] = React.useState(false);
12
+ return (
13
+ <div className="flex flex-wrap gap-3">
14
+ <MediaPlayer mode="lightbox" src={FILM} poster={POSTER} title="Film: the world of Krizaka" trigger={(openIt) => <Button onClick={openIt}>Watch the film</Button>} />
15
+ <Button variant="secondary" onClick={() => setOpen(true)}>Open from outside</Button>
16
+ <MediaPlayer mode="lightbox" ratio="19 / 16" src={FILM} poster={POSTER} title="Film: the engine take" trigger={null} open={open} onOpenChange={setOpen} />
17
+ </div>
18
+ );
19
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krizaka/ui",
3
- "version": "3.85.0",
3
+ "version": "3.87.0",
4
4
  "templatePurposes": {
5
5
  "convince": {
6
6
  "title": "Convince",
@@ -1004,7 +1004,7 @@
1004
1004
  "native": 0
1005
1005
  },
1006
1006
  "dependencies": [
1007
- "@krizaka/tokens@^3.85.0"
1007
+ "@krizaka/tokens@^3.87.0"
1008
1008
  ],
1009
1009
  "registryDependencies": [
1010
1010
  "account-menu",
@@ -4008,7 +4008,7 @@
4008
4008
  "native": 2
4009
4009
  },
4010
4010
  "dependencies": [
4011
- "@krizaka/tokens@^3.85.0",
4011
+ "@krizaka/tokens@^3.87.0",
4012
4012
  "@protomaps/basemaps@5.7.2",
4013
4013
  "tailwind-variants@^3.3.1"
4014
4014
  ],
@@ -4268,8 +4268,8 @@
4268
4268
  "name": "media-gallery",
4269
4269
  "type": "primitive",
4270
4270
  "title": "Media gallery",
4271
- "summary": "Also `MediaCarousel` (3 to 4 realisations, one at a time) and `MediaPlayer` (the one video frame: inline, lightbox, 9:16). A shop's own photos and loops in tiles — the first featured, loops playing muted while their tile is on screen (a still under reduced motion), a caption on the foot of a tile.",
4272
- "description": "Also `MediaCarousel` (3 to 4 realisations, one at a time) and `MediaPlayer` (the one video frame: inline, lightbox, 9:16). A shop's own photos and loops in tiles — the first featured, loops playing muted while their tile is on screen (a still under reduced motion), a caption on the foot of a tile.",
4271
+ "summary": "Also `MediaCarousel` (3 to 4 realisations, one at a time), `MediaPlayer` (the one video frame: inline, lightbox, 9:16) and `PausableLoop` (a silent loop with a visible pause, its own entry). A shop's own photos and loops in tiles, the first featured, a caption on the foot of a tile.",
4272
+ "description": "Also `MediaCarousel` (3 to 4 realisations, one at a time), `MediaPlayer` (the one video frame: inline, lightbox, 9:16) and `PausableLoop` (a silent loop with a visible pause, its own entry). A shop's own photos and loops in tiles, the first featured, a caption on the foot of a tile.",
4273
4273
  "status": "beta",
4274
4274
  "category": "media",
4275
4275
  "platforms": "web",
@@ -4286,7 +4286,7 @@
4286
4286
  }
4287
4287
  },
4288
4288
  "examples": {
4289
- "web": 3,
4289
+ "web": 6,
4290
4290
  "native": 0
4291
4291
  },
4292
4292
  "dependencies": [
@@ -4294,6 +4294,7 @@
4294
4294
  ],
4295
4295
  "registryDependencies": [
4296
4296
  "button",
4297
+ "cn",
4297
4298
  "dialog",
4298
4299
  "video-player"
4299
4300
  ]
@@ -4420,7 +4421,7 @@
4420
4421
  "native": 0
4421
4422
  },
4422
4423
  "dependencies": [
4423
- "@krizaka/tokens@^3.85.0",
4424
+ "@krizaka/tokens@^3.87.0",
4424
4425
  "radix-ui@^1.8.1",
4425
4426
  "tailwind-variants@^3.3.1"
4426
4427
  ],
@@ -5288,7 +5289,7 @@
5288
5289
  "native": 0
5289
5290
  },
5290
5291
  "dependencies": [
5291
- "@krizaka/tokens@^3.85.0",
5292
+ "@krizaka/tokens@^3.87.0",
5292
5293
  "radix-ui@^1.8.1",
5293
5294
  "tailwind-variants@^3.3.1"
5294
5295
  ],
@@ -5735,7 +5736,7 @@
5735
5736
  "native": 0
5736
5737
  },
5737
5738
  "dependencies": [
5738
- "@krizaka/tokens@^3.85.0",
5739
+ "@krizaka/tokens@^3.87.0",
5739
5740
  "zod@^4.6.7"
5740
5741
  ],
5741
5742
  "registryDependencies": [
@@ -5955,7 +5956,7 @@
5955
5956
  "native": 0
5956
5957
  },
5957
5958
  "dependencies": [
5958
- "@krizaka/tokens@^3.85.0",
5959
+ "@krizaka/tokens@^3.87.0",
5959
5960
  "radix-ui@^1.8.1",
5960
5961
  "tailwind-variants@^3.3.1"
5961
5962
  ],
package/registry/map.json CHANGED
@@ -1158,7 +1158,7 @@
1158
1158
  }
1159
1159
  ],
1160
1160
  "dependencies": [
1161
- "@krizaka/tokens@^3.85.0",
1161
+ "@krizaka/tokens@^3.87.0",
1162
1162
  "@protomaps/basemaps@5.7.2",
1163
1163
  "tailwind-variants@^3.3.1"
1164
1164
  ],