@moises.ai/design-system 4.16.2 → 4.16.4

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.
@@ -0,0 +1,70 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react'
2
+ import WavesurferPlayer from '@wavesurfer/react'
3
+
4
+ const clamp = (value, min, max) => Math.min(Math.max(value, min), max)
5
+
6
+ export function PlayerSliderWaveform({
7
+ audio,
8
+ progress = 0,
9
+ currentTime = 0,
10
+ duration = 0,
11
+ }) {
12
+ const [isSafari, setIsSafari] = useState(false)
13
+ const waveSurferRef = useRef(null)
14
+
15
+ useEffect(() => {
16
+ if (typeof navigator !== 'undefined') {
17
+ setIsSafari(/^((?!chrome|android).)*safari/i.test(navigator.userAgent))
18
+ }
19
+ }, [])
20
+
21
+ const syncProgress = useCallback(
22
+ (ws = waveSurferRef.current) => {
23
+ if (!ws) return
24
+
25
+ const safeProgress = clamp(progress, 0, 100)
26
+ const waveformDuration = ws.getDuration?.()
27
+ const targetTime =
28
+ Number.isFinite(waveformDuration) && waveformDuration > 0
29
+ ? (safeProgress / 100) * waveformDuration
30
+ : currentTime
31
+
32
+ if (!Number.isFinite(targetTime)) return
33
+
34
+ ws.setTime(targetTime)
35
+ },
36
+ [currentTime, progress],
37
+ )
38
+
39
+ const handleReady = useCallback(
40
+ (ws) => {
41
+ waveSurferRef.current = ws
42
+ syncProgress(ws)
43
+ },
44
+ [syncProgress],
45
+ )
46
+
47
+ useEffect(() => {
48
+ syncProgress()
49
+ }, [duration, syncProgress])
50
+
51
+ if (!audio) return null
52
+
53
+ return (
54
+ <WavesurferPlayer
55
+ url={audio}
56
+ waveColor="rgba(255, 255, 255, 0.22)"
57
+ progressColor="rgba(0, 227, 254, 1)"
58
+ normalize
59
+ barWidth={2}
60
+ barHeight={1}
61
+ cursorWidth={0}
62
+ height={56}
63
+ interact={false}
64
+ onReady={handleReady}
65
+ backend={isSafari ? 'WebAudio' : 'MediaElement'}
66
+ />
67
+ )
68
+ }
69
+
70
+ PlayerSliderWaveform.displayName = 'PlayerSliderWaveform'
@@ -0,0 +1,9 @@
1
+ export const ForwardBarFillIcon = ({ width = 24, height = 24, className, ...props }) => (
2
+ <svg xmlns="http://www.w3.org/2000/svg" width={width} height={height} viewBox="0 0 24 24" fill="none" className={className} {...props}>
3
+ <path
4
+ d="M10.6187 10.6107V6.50075C10.6187 6.11585 11.0353 5.87529 11.3687 6.06774L19.2414 10.6131V6.57478C19.2414 6.29864 19.4652 6.07479 19.7414 6.07479H20.5007C20.7768 6.07479 21.0007 6.29864 21.0007 6.57479V17.0102C21.0007 17.2864 20.7768 17.5102 20.5007 17.5102H19.7414C19.4652 17.5102 19.2414 17.2864 19.2414 17.0102V12.9715L11.3687 17.5168C11.0353 17.7093 10.6187 17.4687 10.6187 17.0838V12.9738L2.75 17.5168C2.41667 17.7093 2 17.4687 2 17.0838L2 6.50075C2 6.11585 2.41667 5.87528 2.75 6.06773L10.6187 10.6107Z"
5
+ fill="currentColor" />
6
+ </svg>
7
+ )
8
+
9
+ ForwardBarFillIcon.displayName = 'ForwardBarFillIcon'
@@ -0,0 +1,7 @@
1
+ export const RewindBarFillIcon = ({ width = 24, height = 24, className, ...props }) => (
2
+ <svg xmlns="http://www.w3.org/2000/svg" width={width} height={height} viewBox="0 0 24 24" fill="none" className={className} {...props}>
3
+ <path d="M12.382 10.6107V6.50075C12.382 6.11585 11.9654 5.87529 11.632 6.06774L3.75931 10.6131V6.57478C3.75931 6.29864 3.53545 6.07479 3.25931 6.07479H2.50001C2.22387 6.07479 2.00001 6.29864 2.00001 6.57479V17.0102C2.00001 17.2864 2.22387 17.5102 2.50001 17.5102H3.25931C3.53545 17.5102 3.75931 17.2864 3.75931 17.0102V12.9715L11.632 17.5168C11.9654 17.7093 12.382 17.4687 12.382 17.0838V12.9738L20.2507 17.5168C20.584 17.7093 21.0007 17.4687 21.0007 17.0838L21.0007 6.50075C21.0007 6.11585 20.584 5.87528 20.2507 6.06773L12.382 10.6107Z" fill="currentColor" />
4
+ </svg>
5
+ )
6
+
7
+ RewindBarFillIcon.displayName = 'RewindBarFillIcon'
@@ -10,10 +10,12 @@ export const Share2Icon = ({
10
10
  viewBox="0 0 16 16"
11
11
  fill="none"
12
12
  xmlns="http://www.w3.org/2000/svg"
13
+ className={className}
14
+ {...props}
13
15
  >
14
16
  <path
15
17
  d="M10.1875 2.89583L8.00001 0.708328M8.00001 0.708328L5.81251 2.89583M8.00001 0.708328V10.1875M10.9167 5.08333C12.5275 5.08333 13.8333 6.38916 13.8333 7.99999V12.2917C13.8333 13.9485 12.4902 15.2917 10.8333 15.2917H5.16656C3.50968 15.2917 2.16653 13.9485 2.16656 12.2916L2.16663 7.99999C2.16666 6.38915 3.47251 5.08333 5.08335 5.08333"
16
- stroke="#B0B4BA"
18
+ stroke="currentColor"
17
19
  strokeLinecap="round"
18
20
  strokeLinejoin="round"
19
21
  />
package/src/icons.jsx CHANGED
@@ -433,3 +433,5 @@ export { ChartIcon } from './icons/ChartIcon'
433
433
  export { ThumbsUpIcon } from './icons/ThumbsUpIcon'
434
434
  export { ThumbsDownIcon } from './icons/ThumbsDownIcon'
435
435
  export { LightBulbIcon } from './icons/LightBulbIcon'
436
+ export { RewindBarFillIcon } from './icons/RewindBarFillIcon'
437
+ export { ForwardBarFillIcon } from './icons/ForwardBarFillIcon'
package/src/index.jsx CHANGED
@@ -1,40 +1,4 @@
1
- // Import and re-export components from Radix UI Themes
2
- import {
3
- AlertDialog,
4
- AspectRatio,
5
- Avatar,
6
- Badge,
7
- Blockquote,
8
- Box,
9
- Card,
10
- Code,
11
- Container,
12
- DataList,
13
- Dialog,
14
- Em,
15
- Flex,
16
- Grid,
17
- Heading,
18
- HoverCard,
19
- Inset,
20
- Kbd,
21
- Link,
22
- Popover,
23
- Progress,
24
- Quote,
25
- Radio,
26
- RadioGroup,
27
- ScrollArea,
28
- Section,
29
- Separator,
30
- Skeleton,
31
- Spinner,
32
- Strong,
33
- Switch,
34
- Table,
35
- Tabs,
36
- VisuallyHidden,
37
- } from '@radix-ui/themes'
1
+ // Export components from Radix UI Themes
38
2
 
39
3
  export {
40
4
  AlertDialog,
@@ -71,9 +35,10 @@ export {
71
35
  Table,
72
36
  Tabs,
73
37
  VisuallyHidden,
74
- }
38
+ } from '@radix-ui/themes'
75
39
 
76
40
  // Export our custom components
41
+
77
42
  export { AdditionalItems } from './components/AdditionalItems/AdditionalItems'
78
43
  export { BannerAnnouncement } from './components/BannerAnnouncement/BannerAnnouncement'
79
44
  export { Button } from './components/Button/Button'
@@ -115,6 +80,9 @@ export { MultiSelect } from './components/MultiSelect/MultiSelect'
115
80
  export { MultiSelectCards } from './components/MultiSelectCards/MultiSelectCards'
116
81
  export { PanControl } from './components/PanControl/PanControl'
117
82
  export { PeakLevel } from './components/PeakLevel/PeakLevel'
83
+ export { PlayerBar } from './components/PlayerBar/PlayerBar'
84
+ export { PlayerSlider } from './components/PlayerSlider/PlayerSlider'
85
+ export { PreviewCard } from './components/PreviewCard/PreviewCard'
118
86
  export { ProductsBrandPattern } from './components/ProductsBrandPattern/ProductsBrandPattern'
119
87
  export { ProductsList } from './components/ProductsList/ProductsList'
120
88
  export { ProfileMenu } from './components/ProfileMenu/ProfileMenu'
@@ -131,6 +99,7 @@ export { Sidebar } from './components/Sidebar/Sidebar'
131
99
  export { SidebarSection } from './components/Sidebar/SidebarSection/SidebarSection'
132
100
  export { Slider } from './components/Slider/Slider'
133
101
  export { SliderLibrary } from './components/SliderLibrary/SliderLibrary'
102
+ export { SpecialDialog } from './components/SpecialDialog/SpecialDialog'
134
103
  export { StemGenerationForm } from './components/StemGenerationForm/StemGenerationForm'
135
104
  export { GenerationStatus } from './components/StemSeparationForm/GenerationStatus/GenerationStatus'
136
105
  export { StemSeparationForm } from './components/StemSeparationForm/StemSeparationForm'
@@ -150,9 +119,6 @@ export { TrackControlButton } from './components/TrackControlButton'
150
119
  export { TrackControlsToggle } from './components/TrackControlsToggle/TrackControlsToggle'
151
120
  export { TrackHeader } from './components/TrackHeader/TrackHeader'
152
121
  export { useForm } from './components/useForm/useForm'
122
+ export { VerticalSegmentControl } from './components/VerticalSegmentControl/VerticalSegmentControl'
153
123
  export { VoiceConversionForm } from './components/VoiceConversionForm/VoiceConversionForm'
154
124
  export { Waveform } from './components/VoiceConversionForm/Waveform/Waveform'
155
- export { PreviewCard } from './components/PreviewCard/PreviewCard'
156
- export { SpecialDialog } from './components/SpecialDialog/SpecialDialog'
157
-
158
- export { VerticalSegmentControl } from './components/VerticalSegmentControl/VerticalSegmentControl'
@@ -80,7 +80,9 @@ export const createRenderItem = (MenuPrimitives) => {
80
80
  </div>
81
81
  </MenuPrimitives.SubTrigger>
82
82
 
83
- <MenuPrimitives.SubContent className={styles.menuSubContent}>
83
+ <MenuPrimitives.SubContent
84
+ className={classNames(styles.menuSubContent, opt.subContentClassName)}
85
+ >
84
86
  {opt?.children?.map((child) =>
85
87
  renderItem(
86
88
  child,