wimui 0.51.1 → 0.51.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.
Files changed (56) hide show
  1. package/dist/components/ai/ChatUI/ChatUI.cjs +1 -1
  2. package/dist/components/ai/ChatUI/ChatUI.js +10 -10
  3. package/dist/components/ai/ModelSelector/ModelSelector.cjs +1 -1
  4. package/dist/components/ai/ModelSelector/ModelSelector.js +121 -120
  5. package/dist/components/ai/ThreadList/ThreadList.cjs +1 -1
  6. package/dist/components/ai/ThreadList/ThreadList.js +63 -62
  7. package/dist/components/data-display/Accordion/accordion.module.cjs +1 -1
  8. package/dist/components/data-display/Accordion/accordion.module.js +1 -1
  9. package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
  10. package/dist/components/data-display/Carousel/Carousel.js +46 -46
  11. package/dist/components/data-display/NodeGraph/NodeGraph.cjs +1 -1
  12. package/dist/components/data-display/NodeGraph/NodeGraph.js +48 -48
  13. package/dist/components/data-display/ScheduleView/ScheduleView.cjs +1 -1
  14. package/dist/components/data-display/ScheduleView/ScheduleView.js +49 -48
  15. package/dist/components/feedback/Tour/Tour.cjs +1 -1
  16. package/dist/components/feedback/Tour/Tour.js +125 -100
  17. package/dist/components/form/OtpInput/otp-input.module.cjs +1 -1
  18. package/dist/components/form/OtpInput/otp-input.module.js +1 -1
  19. package/dist/components/form/RangeSlider/RangeSlider.cjs +1 -1
  20. package/dist/components/form/RangeSlider/RangeSlider.js +116 -115
  21. package/dist/components/form/RangeSlider/range-slider.module.cjs +1 -1
  22. package/dist/components/form/RangeSlider/range-slider.module.js +1 -1
  23. package/dist/components/form/ThemeToggle/ThemeToggle.cjs +1 -1
  24. package/dist/components/form/ThemeToggle/ThemeToggle.js +66 -65
  25. package/dist/components/form/Transfer/Transfer.cjs +1 -1
  26. package/dist/components/form/Transfer/Transfer.d.ts +1 -1
  27. package/dist/components/form/Transfer/Transfer.js +104 -104
  28. package/dist/components/form/Transfer/transfer.module.cjs +1 -1
  29. package/dist/components/form/Transfer/transfer.module.js +6 -6
  30. package/dist/components/media/Audio/Audio.cjs +1 -1
  31. package/dist/components/media/Audio/Audio.js +45 -45
  32. package/dist/components/media/Audio/components/AudioCustomControls.cjs +1 -1
  33. package/dist/components/media/Audio/components/AudioCustomControls.js +113 -112
  34. package/dist/components/media/ImageCompare/ImageCompare.cjs +1 -1
  35. package/dist/components/media/ImageCompare/ImageCompare.js +73 -72
  36. package/dist/components/media/Video/Video.cjs +1 -1
  37. package/dist/components/media/Video/Video.js +36 -35
  38. package/dist/components/media/Video/components/VideoAdvancedMenu.cjs +1 -1
  39. package/dist/components/media/Video/components/VideoAdvancedMenu.js +138 -137
  40. package/dist/components/navigation/Tabs/tabs.module.cjs +1 -1
  41. package/dist/components/navigation/Tabs/tabs.module.js +1 -1
  42. package/dist/i18n/generated/keys.d.ts +1 -1
  43. package/dist/i18n/generated/resources.cjs +1 -1
  44. package/dist/i18n/generated/resources.js +192 -12
  45. package/dist/llms-full.txt +4 -4
  46. package/dist/llms.txt +1 -1
  47. package/dist/locales/en/common.json +53 -4
  48. package/dist/locales/en/components.json +3 -1
  49. package/dist/locales/ja/common.json +53 -4
  50. package/dist/locales/ja/components.json +3 -1
  51. package/dist/locales/pt/common.json +53 -4
  52. package/dist/locales/pt/components.json +3 -1
  53. package/dist/styles.css +2 -2
  54. package/dist/wimui.umd.css +1 -1
  55. package/dist/wimui.umd.js +3 -3
  56. package/package.json +7 -7
@@ -1,99 +1,100 @@
1
1
  "use client";
2
- import e from "../../../icon/chevron-left.js";
3
- import t from "../../../icon/chevron-right.js";
4
- import { Icon as n } from "../Icon/Icon.js";
5
- import r from "./image-compare.module.js";
6
- import i, { useCallback as a, useRef as o, useState as s } from "react";
7
- import c from "classnames";
8
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
2
+ import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
3
+ import t from "../../../icon/chevron-left.js";
4
+ import n from "../../../icon/chevron-right.js";
5
+ import { Icon as r } from "../Icon/Icon.js";
6
+ import i from "./image-compare.module.js";
7
+ import a, { useCallback as o, useRef as s, useState as c } from "react";
8
+ import l from "classnames";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
10
  //#region src/components/media/ImageCompare/ImageCompare.tsx
10
- var d = (e) => Math.max(0, Math.min(100, e)), f = i.forwardRef(({ before: i, after: f, beforeAlt: p = "", afterAlt: m = "", beforeLabel: h, afterLabel: g, defaultPosition: _ = 50, position: v, onPositionChange: y, orientation: b = "horizontal", width: x, height: S, radius: C = "md", labels: w, className: T, ...E }, D) => {
11
- let { handleAriaLabel: O = "Drag to compare" } = w ?? {}, k = v !== void 0, [A, j] = s(d(_)), M = d(k ? v : A), N = b === "vertical", P = o(null), F = o(!1), I = a((e) => {
12
- P.current = e, typeof D == "function" ? D(e) : D && (D.current = e);
13
- }, [D]), L = a((e) => {
14
- let t = d(e);
15
- k || j(t), y?.(t);
16
- }, [k, y]), R = a((e, t) => {
17
- let n = P.current?.getBoundingClientRect();
11
+ var f = (e) => Math.max(0, Math.min(100, e)), p = a.forwardRef(({ before: a, after: p, beforeAlt: m = "", afterAlt: h = "", beforeLabel: g, afterLabel: _, defaultPosition: v = 50, position: y, onPositionChange: b, orientation: x = "horizontal", width: S, height: C, radius: w = "md", labels: T, className: E, ...D }, O) => {
12
+ let { t: k } = e("common"), { handleAriaLabel: A = k("imageCompare.handle") } = T ?? {}, j = y !== void 0, [M, N] = c(f(v)), P = f(j ? y : M), F = x === "vertical", I = s(null), L = s(!1), R = o((e) => {
13
+ I.current = e, typeof O == "function" ? O(e) : O && (O.current = e);
14
+ }, [O]), z = o((e) => {
15
+ let t = f(e);
16
+ j || N(t), b?.(t);
17
+ }, [j, b]), B = o((e, t) => {
18
+ let n = I.current?.getBoundingClientRect();
18
19
  if (!n) return;
19
- let r = N ? (t - n.top) / n.height * 100 : (e - n.left) / n.width * 100;
20
- L(r);
21
- }, [N, L]), z = (e) => {
22
- F.current = !0, e.currentTarget.setPointerCapture(e.pointerId), R(e.clientX, e.clientY);
23
- }, B = (e) => {
24
- F.current && R(e.clientX, e.clientY);
25
- }, V = (e) => {
26
- F.current = !1, e.currentTarget.releasePointerCapture?.(e.pointerId);
20
+ let r = F ? (t - n.top) / n.height * 100 : (e - n.left) / n.width * 100;
21
+ z(r);
22
+ }, [F, z]), V = (e) => {
23
+ L.current = !0, e.currentTarget.setPointerCapture(e.pointerId), B(e.clientX, e.clientY);
27
24
  }, H = (e) => {
28
- let t = e.shiftKey ? 10 : 2, n = N ? "ArrowUp" : "ArrowLeft", r = N ? "ArrowDown" : "ArrowRight";
29
- e.key === n ? (e.preventDefault(), L(M - t)) : e.key === r ? (e.preventDefault(), L(M + t)) : e.key === "Home" ? (e.preventDefault(), L(0)) : e.key === "End" && (e.preventDefault(), L(100));
30
- }, U = N ? { clipPath: `inset(0 0 ${100 - M}% 0)` } : { clipPath: `inset(0 ${100 - M}% 0 0)` }, W = N ? { top: `${M}%` } : { left: `${M}%` };
31
- return /* @__PURE__ */ u("div", {
32
- ref: I,
33
- className: c("wim-image-compare", r.root, N && r.vertical, r[`radius-${C}`], T),
25
+ L.current && B(e.clientX, e.clientY);
26
+ }, U = (e) => {
27
+ L.current = !1, e.currentTarget.releasePointerCapture?.(e.pointerId);
28
+ }, W = (e) => {
29
+ let t = e.shiftKey ? 10 : 2, n = F ? "ArrowUp" : "ArrowLeft", r = F ? "ArrowDown" : "ArrowRight";
30
+ e.key === n ? (e.preventDefault(), z(P - t)) : e.key === r ? (e.preventDefault(), z(P + t)) : e.key === "Home" ? (e.preventDefault(), z(0)) : e.key === "End" && (e.preventDefault(), z(100));
31
+ }, G = F ? { clipPath: `inset(0 0 ${100 - P}% 0)` } : { clipPath: `inset(0 ${100 - P}% 0 0)` }, K = F ? { top: `${P}%` } : { left: `${P}%` };
32
+ return /* @__PURE__ */ d("div", {
33
+ ref: R,
34
+ className: l("wim-image-compare", i.root, F && i.vertical, i[`radius-${w}`], E),
34
35
  style: {
35
- width: x,
36
- height: S
36
+ width: S,
37
+ height: C
37
38
  },
38
- onPointerDown: z,
39
- onPointerMove: B,
40
- onPointerUp: V,
41
- ...E,
39
+ onPointerDown: V,
40
+ onPointerMove: H,
41
+ onPointerUp: U,
42
+ ...D,
42
43
  children: [
43
- /* @__PURE__ */ l("img", {
44
- className: r.image,
45
- src: f,
46
- alt: m,
44
+ /* @__PURE__ */ u("img", {
45
+ className: i.image,
46
+ src: p,
47
+ alt: h,
47
48
  draggable: !1
48
49
  }),
49
- g && /* @__PURE__ */ l("span", {
50
- className: c(r.label, r.afterLabel),
51
- children: g
50
+ _ && /* @__PURE__ */ u("span", {
51
+ className: l(i.label, i.afterLabel),
52
+ children: _
52
53
  }),
53
- /* @__PURE__ */ u("div", {
54
- className: r.beforeLayer,
55
- style: U,
56
- children: [/* @__PURE__ */ l("img", {
57
- className: r.image,
58
- src: i,
59
- alt: p,
54
+ /* @__PURE__ */ d("div", {
55
+ className: i.beforeLayer,
56
+ style: G,
57
+ children: [/* @__PURE__ */ u("img", {
58
+ className: i.image,
59
+ src: a,
60
+ alt: m,
60
61
  draggable: !1
61
- }), h && /* @__PURE__ */ l("span", {
62
- className: c(r.label, r.beforeLabel),
63
- children: h
62
+ }), g && /* @__PURE__ */ u("span", {
63
+ className: l(i.label, i.beforeLabel),
64
+ children: g
64
65
  })]
65
66
  }),
66
- /* @__PURE__ */ u("div", {
67
- className: r.divider,
68
- style: W,
69
- children: [/* @__PURE__ */ l("span", {
70
- className: r.line,
67
+ /* @__PURE__ */ d("div", {
68
+ className: i.divider,
69
+ style: K,
70
+ children: [/* @__PURE__ */ u("span", {
71
+ className: i.line,
71
72
  "aria-hidden": "true"
72
- }), /* @__PURE__ */ u("button", {
73
+ }), /* @__PURE__ */ d("button", {
73
74
  type: "button",
74
- className: r.handle,
75
+ className: i.handle,
75
76
  role: "slider",
76
- "aria-label": O,
77
- "aria-orientation": b,
78
- "aria-valuenow": Math.round(M),
77
+ "aria-label": A,
78
+ "aria-orientation": x,
79
+ "aria-valuenow": Math.round(P),
79
80
  "aria-valuemin": 0,
80
81
  "aria-valuemax": 100,
81
- onKeyDown: H,
82
- onPointerDown: z,
83
- children: [/* @__PURE__ */ l(n, {
84
- component: e,
85
- size: "sm",
86
- className: r.arrow
87
- }), /* @__PURE__ */ l(n, {
82
+ onKeyDown: W,
83
+ onPointerDown: V,
84
+ children: [/* @__PURE__ */ u(r, {
88
85
  component: t,
89
86
  size: "sm",
90
- className: r.arrow
87
+ className: i.arrow
88
+ }), /* @__PURE__ */ u(r, {
89
+ component: n,
90
+ size: "sm",
91
+ className: i.arrow
91
92
  })]
92
93
  })]
93
94
  })
94
95
  ]
95
96
  });
96
97
  });
97
- f.displayName = "ImageCompare";
98
+ p.displayName = "ImageCompare";
98
99
  //#endregion
99
- export { f as ImageCompare };
100
+ export { p as ImageCompare };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../Icon/Icon.cjs"),n=require("../../../hooks/useMediaLoader.cjs"),r=require("./hooks/useVideoPlayer.cjs"),i=require("./components/VideoAdvancedMenu.cjs"),a=require("./components/VideoControls.cjs"),o=require("./video.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=({src:e,width:u,height:d,autoPlay:f=!1,loop:p=!1,muted:m=!1,controls:h=!0,poster:g,radius:_=`none`,shadow:v=!1,border:y=!1,fit:b=`cover`,preload:x,caption:S,className:C,style:w,customControls:T=!1,advancedControls:E=!1,videoId:D,resumePlayback:O=!1,playlist:k,autoPlayNext:A=!1,qualities:j,loading:M=`lazy`,fadeIn:N=!1,demoDelay:P,labels:F={},tracks:I,...L})=>{let{videoAriaLabel:R=`Video`,seconds:z=`s`}=F,{containerRef:B,isLoaded:V,isIntersecting:H,notifyLoaded:U,shouldShowSkeleton:W}=n.useMediaLoader({loading:M,src:j?.[0]?.src||k?.[0]?.src||e,demoDelay:P}),G=r.useVideoPlayer({src:e,autoPlay:f,loop:p,muted:m,fit:b,videoId:D,resumePlayback:O,playlist:k,autoPlayNext:A,qualities:j,customControls:T,advancedControls:E,poster:g,containerRef:B}),{videoRef:K,isPlaying:q,activeSrc:J,activePoster:Y,showNativeControls:X,skipIndicator:Z,activeMenu:Q,setActiveMenu:$}=G;s.default.useEffect(()=>{let e=K.current;e&&(m?e.setAttribute(`muted`,``):e.removeAttribute(`muted`))},[m,K,J,H]);let ee={width:`100%`,height:d||`auto`,objectFit:G.activeFit,...w},te=_===`none`?null:o.default[`radius${_.charAt(0).toUpperCase()+_.slice(1)}`];return(0,l.jsxs)(`figure`,{className:(0,c.default)(`wim-video`,o.default.root,C),style:{width:`100%`},"aria-label":R,"data-testid":`video-root`,children:[(0,l.jsxs)(`div`,{className:(0,c.default)(o.default.inner,te,v&&o.default.shadow,y&&o.default.border,(T||E)&&o.default.custom,N&&o.default.fadeIn,N&&V&&o.default.isLoaded,W&&o.default.loading),ref:B,"data-testid":`video-inner`,children:[H&&(0,l.jsx)(`video`,{ref:K,src:J,className:o.default.video,style:ee,autoPlay:f&&V,loop:p&&(!k||k.length<=1),muted:m,controls:X&&h,poster:Y,preload:x,playsInline:!0,onTimeUpdate:G.handleTimeUpdate,onLoadedMetadata:G.handleLoadedMetadata,onLoadedData:U,onEnded:G.handleEnded,onPlay:()=>{},onPause:()=>{},onClick:G.handleVideoClick,"data-testid":`video-element`,...L,children:I?.map((e,t)=>(0,l.jsx)(`track`,{...e},t))}),Z.show&&(0,l.jsxs)(`div`,{className:o.default.skipIndicator,children:[(0,l.jsx)(t.Icon,{name:Z.direction===`forward`?`ChevronRightIcon`:`ChevronLeftIcon`,size:`lg`}),(0,l.jsx)(t.Icon,{name:Z.direction===`forward`?`ChevronRightIcon`:`ChevronLeftIcon`,size:`lg`}),(0,l.jsx)(t.Icon,{name:Z.direction===`forward`?`ChevronRightIcon`:`ChevronLeftIcon`,size:`lg`}),(0,l.jsxs)(`span`,{children:[`10`,z]})]}),(T||E)&&(0,l.jsxs)(`div`,{role:`none`,className:o.default.customControls,onClick:()=>Q&&$(null),children:[E&&(0,l.jsx)(i.VideoAdvancedMenu,{styles:o.default,activeMenu:Q,setActiveMenu:$,qualities:j,currentQualityIndex:G.currentQualityIndex,handleQualityChange:G.handleQualityChange,playbackRate:G.playbackRate,setPlaybackRate:G.setPlaybackRate,activeFit:G.activeFit,setActiveFit:G.setActiveFit,playlist:k,currentPlayIndex:G.currentPlayIndex,playPlaylistItem:G.playPlaylistItem,labels:F}),(0,l.jsx)(a.VideoControls,{styles:o.default,playlist:k,advancedControls:E,currentPlayIndex:G.currentPlayIndex,setCurrentPlayIndex:G.setCurrentPlayIndex,skip:G.skip,isPlaying:q,togglePlay:G.togglePlay,currentTime:G.currentTime,duration:G.duration,handleSeek:G.handleSeek,volume:G.volume,isMuted:G.isMuted,toggleMute:G.toggleMute,handleVolumeChange:G.handleVolumeChange,activeMenu:Q,setActiveMenu:$,togglePiP:G.togglePiP,isFullscreen:G.isFullscreen,toggleFullscreen:G.toggleFullscreen,formatTime:G.formatTime,labels:F})]})]}),S&&(0,l.jsx)(`figcaption`,{className:o.default.caption,"data-testid":`video-caption`,children:S})]})};exports.Video=u;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../Icon/Icon.cjs"),ee=require("../../../hooks/useMediaLoader.cjs"),r=require("./hooks/useVideoPlayer.cjs"),i=require("./components/VideoAdvancedMenu.cjs"),a=require("./components/VideoControls.cjs"),o=require("./video.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=({src:e,width:u,height:te,autoPlay:d=!1,loop:f=!1,muted:p=!1,controls:m=!0,poster:h,radius:g=`none`,shadow:_=!1,border:v=!1,fit:y=`cover`,preload:b,caption:x,className:S,style:C,customControls:w=!1,advancedControls:T=!1,videoId:E,resumePlayback:D=!1,playlist:O,autoPlayNext:k=!1,qualities:A,loading:j=`lazy`,fadeIn:M=!1,demoDelay:N,labels:P={},tracks:F,...I})=>{let{t:L}=t.useWimTranslation(`common`),{videoAriaLabel:R=L(`video.label`),seconds:z=`s`}=P,{containerRef:B,isLoaded:V,isIntersecting:H,notifyLoaded:U,shouldShowSkeleton:W}=ee.useMediaLoader({loading:j,src:A?.[0]?.src||O?.[0]?.src||e,demoDelay:N}),G=r.useVideoPlayer({src:e,autoPlay:d,loop:f,muted:p,fit:y,videoId:E,resumePlayback:D,playlist:O,autoPlayNext:k,qualities:A,customControls:w,advancedControls:T,poster:h,containerRef:B}),{videoRef:K,isPlaying:q,activeSrc:J,activePoster:Y,showNativeControls:X,skipIndicator:Z,activeMenu:Q,setActiveMenu:$}=G;s.default.useEffect(()=>{let e=K.current;e&&(p?e.setAttribute(`muted`,``):e.removeAttribute(`muted`))},[p,K,J,H]);let ne={width:`100%`,height:te||`auto`,objectFit:G.activeFit,...C},re=g===`none`?null:o.default[`radius${g.charAt(0).toUpperCase()+g.slice(1)}`];return(0,l.jsxs)(`figure`,{className:(0,c.default)(`wim-video`,o.default.root,S),style:{width:`100%`},"aria-label":R,"data-testid":`video-root`,children:[(0,l.jsxs)(`div`,{className:(0,c.default)(o.default.inner,re,_&&o.default.shadow,v&&o.default.border,(w||T)&&o.default.custom,M&&o.default.fadeIn,M&&V&&o.default.isLoaded,W&&o.default.loading),ref:B,"data-testid":`video-inner`,children:[H&&(0,l.jsx)(`video`,{ref:K,src:J,className:o.default.video,style:ne,autoPlay:d&&V,loop:f&&(!O||O.length<=1),muted:p,controls:X&&m,poster:Y,preload:b,playsInline:!0,onTimeUpdate:G.handleTimeUpdate,onLoadedMetadata:G.handleLoadedMetadata,onLoadedData:U,onEnded:G.handleEnded,onPlay:()=>{},onPause:()=>{},onClick:G.handleVideoClick,"data-testid":`video-element`,...I,children:F?.map((e,t)=>(0,l.jsx)(`track`,{...e},t))}),Z.show&&(0,l.jsxs)(`div`,{className:o.default.skipIndicator,children:[(0,l.jsx)(n.Icon,{name:Z.direction===`forward`?`ChevronRightIcon`:`ChevronLeftIcon`,size:`lg`}),(0,l.jsx)(n.Icon,{name:Z.direction===`forward`?`ChevronRightIcon`:`ChevronLeftIcon`,size:`lg`}),(0,l.jsx)(n.Icon,{name:Z.direction===`forward`?`ChevronRightIcon`:`ChevronLeftIcon`,size:`lg`}),(0,l.jsxs)(`span`,{children:[`10`,z]})]}),(w||T)&&(0,l.jsxs)(`div`,{role:`none`,className:o.default.customControls,onClick:()=>Q&&$(null),children:[T&&(0,l.jsx)(i.VideoAdvancedMenu,{styles:o.default,activeMenu:Q,setActiveMenu:$,qualities:A,currentQualityIndex:G.currentQualityIndex,handleQualityChange:G.handleQualityChange,playbackRate:G.playbackRate,setPlaybackRate:G.setPlaybackRate,activeFit:G.activeFit,setActiveFit:G.setActiveFit,playlist:O,currentPlayIndex:G.currentPlayIndex,playPlaylistItem:G.playPlaylistItem,labels:P}),(0,l.jsx)(a.VideoControls,{styles:o.default,playlist:O,advancedControls:T,currentPlayIndex:G.currentPlayIndex,setCurrentPlayIndex:G.setCurrentPlayIndex,skip:G.skip,isPlaying:q,togglePlay:G.togglePlay,currentTime:G.currentTime,duration:G.duration,handleSeek:G.handleSeek,volume:G.volume,isMuted:G.isMuted,toggleMute:G.toggleMute,handleVolumeChange:G.handleVolumeChange,activeMenu:Q,setActiveMenu:$,togglePiP:G.togglePiP,isFullscreen:G.isFullscreen,toggleFullscreen:G.toggleFullscreen,formatTime:G.formatTime,labels:P})]})]}),x&&(0,l.jsx)(`figcaption`,{className:o.default.caption,"data-testid":`video-caption`,children:x})]})};exports.Video=u;
@@ -1,7 +1,8 @@
1
1
  "use client";
2
- import { Icon as e } from "../Icon/Icon.js";
3
- import { useMediaLoader as t } from "../../../hooks/useMediaLoader.js";
4
- import { useVideoPlayer as n } from "./hooks/useVideoPlayer.js";
2
+ import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
3
+ import { Icon as t } from "../Icon/Icon.js";
4
+ import { useMediaLoader as n } from "../../../hooks/useMediaLoader.js";
5
+ import { useVideoPlayer as ee } from "./hooks/useVideoPlayer.js";
5
6
  import { VideoAdvancedMenu as r } from "./components/VideoAdvancedMenu.js";
6
7
  import { VideoControls as i } from "./components/VideoControls.js";
7
8
  import a from "./video.module.js";
@@ -9,24 +10,24 @@ import o from "react";
9
10
  import s from "classnames";
10
11
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
11
12
  //#region src/components/media/Video/Video.tsx
12
- var u = ({ src: u, width: ee, height: d, autoPlay: f = !1, loop: p = !1, muted: m = !1, controls: h = !0, poster: g, radius: _ = "none", shadow: v = !1, border: y = !1, fit: b = "cover", preload: x, caption: S, className: C, style: w, customControls: T = !1, advancedControls: E = !1, videoId: D, resumePlayback: O = !1, playlist: k, autoPlayNext: A = !1, qualities: j, loading: M = "lazy", fadeIn: N = !1, demoDelay: P, labels: F = {}, tracks: I, ...L }) => {
13
- let { videoAriaLabel: R = "Video", seconds: z = "s" } = F, { containerRef: B, isLoaded: V, isIntersecting: H, notifyLoaded: U, shouldShowSkeleton: W } = t({
14
- loading: M,
15
- src: j?.[0]?.src || k?.[0]?.src || u,
16
- demoDelay: P
17
- }), G = n({
13
+ var u = ({ src: u, width: te, height: d, autoPlay: f = !1, loop: p = !1, muted: m = !1, controls: h = !0, poster: g, radius: _ = "none", shadow: v = !1, border: y = !1, fit: b = "cover", preload: x, caption: S, className: C, style: ne, customControls: w = !1, advancedControls: T = !1, videoId: E, resumePlayback: D = !1, playlist: O, autoPlayNext: k = !1, qualities: A, loading: j = "lazy", fadeIn: M = !1, demoDelay: N, labels: P = {}, tracks: F, ...I }) => {
14
+ let { t: L } = e("common"), { videoAriaLabel: R = L("video.label"), seconds: z = "s" } = P, { containerRef: B, isLoaded: V, isIntersecting: H, notifyLoaded: U, shouldShowSkeleton: W } = n({
15
+ loading: j,
16
+ src: A?.[0]?.src || O?.[0]?.src || u,
17
+ demoDelay: N
18
+ }), G = ee({
18
19
  src: u,
19
20
  autoPlay: f,
20
21
  loop: p,
21
22
  muted: m,
22
23
  fit: b,
23
- videoId: D,
24
- resumePlayback: O,
25
- playlist: k,
26
- autoPlayNext: A,
27
- qualities: j,
28
- customControls: T,
29
- advancedControls: E,
24
+ videoId: E,
25
+ resumePlayback: D,
26
+ playlist: O,
27
+ autoPlayNext: k,
28
+ qualities: A,
29
+ customControls: w,
30
+ advancedControls: T,
30
31
  poster: g,
31
32
  containerRef: B
32
33
  }), { videoRef: K, isPlaying: q, activeSrc: J, activePoster: Y, showNativeControls: X, skipIndicator: Z, activeMenu: Q, setActiveMenu: $ } = G;
@@ -39,19 +40,19 @@ var u = ({ src: u, width: ee, height: d, autoPlay: f = !1, loop: p = !1, muted:
39
40
  J,
40
41
  H
41
42
  ]);
42
- let te = {
43
+ let re = {
43
44
  width: "100%",
44
45
  height: d || "auto",
45
46
  objectFit: G.activeFit,
46
- ...w
47
- }, ne = _ === "none" ? null : a[`radius${_.charAt(0).toUpperCase() + _.slice(1)}`];
47
+ ...ne
48
+ }, ie = _ === "none" ? null : a[`radius${_.charAt(0).toUpperCase() + _.slice(1)}`];
48
49
  return /* @__PURE__ */ l("figure", {
49
50
  className: s("wim-video", a.root, C),
50
51
  style: { width: "100%" },
51
52
  "aria-label": R,
52
53
  "data-testid": "video-root",
53
54
  children: [/* @__PURE__ */ l("div", {
54
- className: s(a.inner, ne, v && a.shadow, y && a.border, (T || E) && a.custom, N && a.fadeIn, N && V && a.isLoaded, W && a.loading),
55
+ className: s(a.inner, ie, v && a.shadow, y && a.border, (w || T) && a.custom, M && a.fadeIn, M && V && a.isLoaded, W && a.loading),
55
56
  ref: B,
56
57
  "data-testid": "video-inner",
57
58
  children: [
@@ -59,9 +60,9 @@ var u = ({ src: u, width: ee, height: d, autoPlay: f = !1, loop: p = !1, muted:
59
60
  ref: K,
60
61
  src: J,
61
62
  className: a.video,
62
- style: te,
63
+ style: re,
63
64
  autoPlay: f && V,
64
- loop: p && (!k || k.length <= 1),
65
+ loop: p && (!O || O.length <= 1),
65
66
  muted: m,
66
67
  controls: X && h,
67
68
  poster: Y,
@@ -75,50 +76,50 @@ var u = ({ src: u, width: ee, height: d, autoPlay: f = !1, loop: p = !1, muted:
75
76
  onPause: () => {},
76
77
  onClick: G.handleVideoClick,
77
78
  "data-testid": "video-element",
78
- ...L,
79
- children: I?.map((e, t) => /* @__PURE__ */ c("track", { ...e }, t))
79
+ ...I,
80
+ children: F?.map((e, t) => /* @__PURE__ */ c("track", { ...e }, t))
80
81
  }),
81
82
  Z.show && /* @__PURE__ */ l("div", {
82
83
  className: a.skipIndicator,
83
84
  children: [
84
- /* @__PURE__ */ c(e, {
85
+ /* @__PURE__ */ c(t, {
85
86
  name: Z.direction === "forward" ? "ChevronRightIcon" : "ChevronLeftIcon",
86
87
  size: "lg"
87
88
  }),
88
- /* @__PURE__ */ c(e, {
89
+ /* @__PURE__ */ c(t, {
89
90
  name: Z.direction === "forward" ? "ChevronRightIcon" : "ChevronLeftIcon",
90
91
  size: "lg"
91
92
  }),
92
- /* @__PURE__ */ c(e, {
93
+ /* @__PURE__ */ c(t, {
93
94
  name: Z.direction === "forward" ? "ChevronRightIcon" : "ChevronLeftIcon",
94
95
  size: "lg"
95
96
  }),
96
97
  /* @__PURE__ */ l("span", { children: ["10", z] })
97
98
  ]
98
99
  }),
99
- (T || E) && /* @__PURE__ */ l("div", {
100
+ (w || T) && /* @__PURE__ */ l("div", {
100
101
  role: "none",
101
102
  className: a.customControls,
102
103
  onClick: () => Q && $(null),
103
- children: [E && /* @__PURE__ */ c(r, {
104
+ children: [T && /* @__PURE__ */ c(r, {
104
105
  styles: a,
105
106
  activeMenu: Q,
106
107
  setActiveMenu: $,
107
- qualities: j,
108
+ qualities: A,
108
109
  currentQualityIndex: G.currentQualityIndex,
109
110
  handleQualityChange: G.handleQualityChange,
110
111
  playbackRate: G.playbackRate,
111
112
  setPlaybackRate: G.setPlaybackRate,
112
113
  activeFit: G.activeFit,
113
114
  setActiveFit: G.setActiveFit,
114
- playlist: k,
115
+ playlist: O,
115
116
  currentPlayIndex: G.currentPlayIndex,
116
117
  playPlaylistItem: G.playPlaylistItem,
117
- labels: F
118
+ labels: P
118
119
  }), /* @__PURE__ */ c(i, {
119
120
  styles: a,
120
- playlist: k,
121
- advancedControls: E,
121
+ playlist: O,
122
+ advancedControls: T,
122
123
  currentPlayIndex: G.currentPlayIndex,
123
124
  setCurrentPlayIndex: G.setCurrentPlayIndex,
124
125
  skip: G.skip,
@@ -137,7 +138,7 @@ var u = ({ src: u, width: ee, height: d, autoPlay: f = !1, loop: p = !1, muted:
137
138
  isFullscreen: G.isFullscreen,
138
139
  toggleFullscreen: G.toggleFullscreen,
139
140
  formatTime: G.formatTime,
140
- labels: F
141
+ labels: P
141
142
  })]
142
143
  })
143
144
  ]
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../../icon/check.cjs"),n=require("../../../../icon/chevron-left.cjs"),r=require("../../../../icon/chevron-right.cjs"),i=require("../../../../icon/close.cjs"),a=require("../../../../icon/play.cjs"),o=require("../../Icon/Icon.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=[.25,.5,.75,1,1.25,1.5,1.75,2],u=[`contain`,`cover`,`fill`,`scale-down`,`none`];function d({activeMenu:e,setActiveMenu:s,qualities:d,currentQualityIndex:f,handleQualityChange:p,playbackRate:m,setPlaybackRate:h,activeFit:g,setActiveFit:_,playlist:v,currentPlayIndex:y,playPlaylistItem:b,labels:x={},styles:S}){let{settings:C=`Settings`,quality:w=`Quality`,playbackRate:T=`Playback Speed`,aspectRatio:E=`Aspect Ratio`,standard:D=`Standard`,playlist:O=`Playlist`,contain:k=`Contain`,cover:A=`Cover`,fill:j=`Fill`,scaleDown:M=`Scale Down`,none:N=`None`}=x;if(!e)return null;let P=e=>{switch(e){case`contain`:return k;case`cover`:return A;case`fill`:return j;case`scale-down`:return M;case`none`:return N;default:return e}};return(0,c.jsxs)(c.Fragment,{children:[e===`main`&&(0,c.jsxs)(`div`,{className:S.advancedMenu,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&s(null)},role:`menu`,tabIndex:-1,children:[(0,c.jsx)(`div`,{className:S.menuTitle,children:(0,c.jsx)(`span`,{children:C})}),(0,c.jsxs)(`div`,{className:S.menuItems,children:[d&&d.length>0&&(0,c.jsxs)(`button`,{className:S.menuBtn,onClick:()=>s(`quality`),children:[(0,c.jsx)(`span`,{children:w}),(0,c.jsxs)(`span`,{style:{opacity:.7},children:[d[f].label,` `,(0,c.jsx)(o.Icon,{component:r.default,size:`sm`})]})]}),(0,c.jsxs)(`button`,{className:S.menuBtn,onClick:()=>s(`rate`),children:[(0,c.jsx)(`span`,{children:T}),(0,c.jsxs)(`span`,{style:{opacity:.7},children:[m,`x `,(0,c.jsx)(o.Icon,{component:r.default,size:`sm`})]})]}),(0,c.jsxs)(`button`,{className:S.menuBtn,onClick:()=>s(`fit`),children:[(0,c.jsx)(`span`,{children:E}),(0,c.jsxs)(`span`,{style:{opacity:.7},children:[P(g),` `,(0,c.jsx)(o.Icon,{component:r.default,size:`sm`})]})]})]})]}),e===`quality`&&(0,c.jsxs)(`div`,{className:S.advancedMenu,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&s(`main`)},role:`menu`,tabIndex:-1,children:[(0,c.jsxs)(`div`,{className:S.menuTitle,children:[(0,c.jsx)(`button`,{onClick:()=>s(`main`),className:S.btn,children:(0,c.jsx)(o.Icon,{component:n.default,size:`sm`})}),(0,c.jsx)(`span`,{children:w})]}),(0,c.jsx)(`div`,{className:S.menuItems,children:d?.map((e,n)=>(0,c.jsxs)(`button`,{className:S.menuBtn,"data-active":f===n,onClick:()=>p(n),children:[f===n&&(0,c.jsx)(o.Icon,{component:t.default,size:`sm`}),(0,c.jsx)(`span`,{style:{marginLeft:f===n?0:24},children:e.label})]},n))})]}),e===`rate`&&(0,c.jsxs)(`div`,{className:S.advancedMenu,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&s(`main`)},role:`menu`,tabIndex:-1,children:[(0,c.jsxs)(`div`,{className:S.menuTitle,children:[(0,c.jsx)(`button`,{onClick:()=>s(`main`),className:S.btn,children:(0,c.jsx)(o.Icon,{component:n.default,size:`sm`})}),(0,c.jsx)(`span`,{children:T})]}),(0,c.jsx)(`div`,{className:S.menuItems,children:l.map(e=>(0,c.jsxs)(`button`,{className:S.menuBtn,"data-active":m===e,onClick:()=>{h(e),s(`main`)},children:[m===e&&(0,c.jsx)(o.Icon,{component:t.default,size:`sm`}),(0,c.jsx)(`span`,{style:{marginLeft:m===e?0:24},children:e===1?D:`${e}x`})]},e))})]}),e===`fit`&&(0,c.jsxs)(`div`,{className:S.advancedMenu,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&s(`main`)},role:`menu`,tabIndex:-1,children:[(0,c.jsxs)(`div`,{className:S.menuTitle,children:[(0,c.jsx)(`button`,{onClick:()=>s(`main`),className:S.btn,children:(0,c.jsx)(o.Icon,{component:n.default,size:`sm`})}),(0,c.jsx)(`span`,{children:E})]}),(0,c.jsx)(`div`,{className:S.menuItems,children:u.map(e=>(0,c.jsxs)(`button`,{className:S.menuBtn,"data-active":g===e,onClick:()=>{_(e),s(`main`)},children:[g===e&&(0,c.jsx)(o.Icon,{component:t.default,size:`sm`}),(0,c.jsx)(`span`,{style:{marginLeft:g===e?0:24},children:P(e)})]},e))})]}),e===`playlist`&&(0,c.jsxs)(`div`,{className:S.advancedMenu,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&s(null)},style:{bottom:60,right:16,width:250},role:`menu`,tabIndex:-1,children:[(0,c.jsxs)(`div`,{className:S.menuTitle,children:[(0,c.jsx)(`span`,{children:O}),(0,c.jsx)(`button`,{onClick:()=>s(null),style:{marginLeft:`auto`},className:S.btn,children:(0,c.jsx)(o.Icon,{component:i.default,size:`sm`})})]}),(0,c.jsx)(`div`,{className:S.menuItems,children:v?.map((e,t)=>(0,c.jsx)(`button`,{className:S.menuBtn,"data-active":y===t,onClick:()=>b(t),style:{flexDirection:`column`,alignItems:`flex-start`,gap:4},children:(0,c.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[y===t?(0,c.jsx)(o.Icon,{component:a.default,size:`sm`}):(0,c.jsx)(`div`,{style:{width:20}}),(0,c.jsx)(`span`,{children:e.title||`Track ${t+1}`})]})},t))})]})]})}exports.VideoAdvancedMenu=d;
2
+ const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../../i18n/useWimTranslation.cjs"),n=require("../../../../icon/check.cjs"),r=require("../../../../icon/chevron-left.cjs"),i=require("../../../../icon/chevron-right.cjs"),a=require("../../../../icon/close.cjs"),o=require("../../../../icon/play.cjs"),s=require("../../Icon/Icon.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=[.25,.5,.75,1,1.25,1.5,1.75,2],d=[`contain`,`cover`,`fill`,`scale-down`,`none`];function f({activeMenu:e,setActiveMenu:c,qualities:f,currentQualityIndex:p,handleQualityChange:m,playbackRate:h,setPlaybackRate:g,activeFit:_,setActiveFit:v,playlist:y,currentPlayIndex:b,playPlaylistItem:x,labels:S={},styles:C}){let{t:w}=t.useWimTranslation(`common`),{settings:T=w(`a11y.settings`),quality:E=w(`quality`),playbackRate:D=w(`playback.speed`),aspectRatio:O=w(`aspect.ratio`),standard:k=w(`standard`),playlist:A=w(`a11y.playlist`),contain:j=w(`video.fit_contain`),cover:M=w(`video.fit_cover`),fill:N=w(`video.fit_fill`),scaleDown:P=w(`video.fit_scale_down`),none:F=w(`common.none`)}=S;if(!e)return null;let I=e=>{switch(e){case`contain`:return j;case`cover`:return M;case`fill`:return N;case`scale-down`:return P;case`none`:return F;default:return e}};return(0,l.jsxs)(l.Fragment,{children:[e===`main`&&(0,l.jsxs)(`div`,{className:C.advancedMenu,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&c(null)},role:`menu`,tabIndex:-1,children:[(0,l.jsx)(`div`,{className:C.menuTitle,children:(0,l.jsx)(`span`,{children:T})}),(0,l.jsxs)(`div`,{className:C.menuItems,children:[f&&f.length>0&&(0,l.jsxs)(`button`,{className:C.menuBtn,onClick:()=>c(`quality`),children:[(0,l.jsx)(`span`,{children:E}),(0,l.jsxs)(`span`,{style:{opacity:.7},children:[f[p].label,` `,(0,l.jsx)(s.Icon,{component:i.default,size:`sm`})]})]}),(0,l.jsxs)(`button`,{className:C.menuBtn,onClick:()=>c(`rate`),children:[(0,l.jsx)(`span`,{children:D}),(0,l.jsxs)(`span`,{style:{opacity:.7},children:[h,`x `,(0,l.jsx)(s.Icon,{component:i.default,size:`sm`})]})]}),(0,l.jsxs)(`button`,{className:C.menuBtn,onClick:()=>c(`fit`),children:[(0,l.jsx)(`span`,{children:O}),(0,l.jsxs)(`span`,{style:{opacity:.7},children:[I(_),` `,(0,l.jsx)(s.Icon,{component:i.default,size:`sm`})]})]})]})]}),e===`quality`&&(0,l.jsxs)(`div`,{className:C.advancedMenu,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&c(`main`)},role:`menu`,tabIndex:-1,children:[(0,l.jsxs)(`div`,{className:C.menuTitle,children:[(0,l.jsx)(`button`,{onClick:()=>c(`main`),className:C.btn,children:(0,l.jsx)(s.Icon,{component:r.default,size:`sm`})}),(0,l.jsx)(`span`,{children:E})]}),(0,l.jsx)(`div`,{className:C.menuItems,children:f?.map((e,t)=>(0,l.jsxs)(`button`,{className:C.menuBtn,"data-active":p===t,onClick:()=>m(t),children:[p===t&&(0,l.jsx)(s.Icon,{component:n.default,size:`sm`}),(0,l.jsx)(`span`,{style:{marginLeft:p===t?0:24},children:e.label})]},t))})]}),e===`rate`&&(0,l.jsxs)(`div`,{className:C.advancedMenu,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&c(`main`)},role:`menu`,tabIndex:-1,children:[(0,l.jsxs)(`div`,{className:C.menuTitle,children:[(0,l.jsx)(`button`,{onClick:()=>c(`main`),className:C.btn,children:(0,l.jsx)(s.Icon,{component:r.default,size:`sm`})}),(0,l.jsx)(`span`,{children:D})]}),(0,l.jsx)(`div`,{className:C.menuItems,children:u.map(e=>(0,l.jsxs)(`button`,{className:C.menuBtn,"data-active":h===e,onClick:()=>{g(e),c(`main`)},children:[h===e&&(0,l.jsx)(s.Icon,{component:n.default,size:`sm`}),(0,l.jsx)(`span`,{style:{marginLeft:h===e?0:24},children:e===1?k:`${e}x`})]},e))})]}),e===`fit`&&(0,l.jsxs)(`div`,{className:C.advancedMenu,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&c(`main`)},role:`menu`,tabIndex:-1,children:[(0,l.jsxs)(`div`,{className:C.menuTitle,children:[(0,l.jsx)(`button`,{onClick:()=>c(`main`),className:C.btn,children:(0,l.jsx)(s.Icon,{component:r.default,size:`sm`})}),(0,l.jsx)(`span`,{children:O})]}),(0,l.jsx)(`div`,{className:C.menuItems,children:d.map(e=>(0,l.jsxs)(`button`,{className:C.menuBtn,"data-active":_===e,onClick:()=>{v(e),c(`main`)},children:[_===e&&(0,l.jsx)(s.Icon,{component:n.default,size:`sm`}),(0,l.jsx)(`span`,{style:{marginLeft:_===e?0:24},children:I(e)})]},e))})]}),e===`playlist`&&(0,l.jsxs)(`div`,{className:C.advancedMenu,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&c(null)},style:{bottom:60,right:16,width:250},role:`menu`,tabIndex:-1,children:[(0,l.jsxs)(`div`,{className:C.menuTitle,children:[(0,l.jsx)(`span`,{children:A}),(0,l.jsx)(`button`,{onClick:()=>c(null),style:{marginLeft:`auto`},className:C.btn,children:(0,l.jsx)(s.Icon,{component:a.default,size:`sm`})})]}),(0,l.jsx)(`div`,{className:C.menuItems,children:y?.map((e,t)=>(0,l.jsx)(`button`,{className:C.menuBtn,"data-active":b===t,onClick:()=>x(t),style:{flexDirection:`column`,alignItems:`flex-start`,gap:4},children:(0,l.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[b===t?(0,l.jsx)(s.Icon,{component:o.default,size:`sm`}):(0,l.jsx)(`div`,{style:{width:20}}),(0,l.jsx)(`span`,{children:e.title||`Track ${t+1}`})]})},t))})]})]})}exports.VideoAdvancedMenu=f;