@moises.ai/design-system 4.21.2 → 4.21.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moises.ai/design-system",
3
- "version": "4.21.2",
3
+ "version": "4.21.4",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -17,6 +17,8 @@ const ProjectItem = ({
17
17
  failed = false,
18
18
  children,
19
19
  labels = {},
20
+ duration: _duration,
21
+ toggleHifi: _toggleHifi,
20
22
  ...props
21
23
  }) => {
22
24
  const {
@@ -19,6 +19,8 @@ const ProjectItemStemSeparation = ({
19
19
  children,
20
20
  labels = {},
21
21
  stemSeparation,
22
+ duration: _duration,
23
+ toggleHifi: _toggleHifi,
22
24
  ...props
23
25
  }) => {
24
26
  const {
@@ -1,5 +1,6 @@
1
- import { Flex, Text } from '@radix-ui/themes'
1
+ import { Flex, Text, Switch, Separator } from '@radix-ui/themes'
2
2
  import { Button } from '../../Button/Button'
3
+ import { HiFi1Icon } from '../../../icons'
3
4
  import { Collapsible } from 'radix-ui'
4
5
  import { useContext, useState } from 'react'
5
6
  import { InstrumentSelect } from '../../InstrumentSelect/InstrumentSelect'
@@ -17,7 +18,7 @@ const StemSeparationForm = ({
17
18
  onSubmit,
18
19
  setIsChangingStems,
19
20
  }) => {
20
- const { openedItem, onShowPaywall } = useContext(ProjectsListContext)
21
+ const { openedItem, onShowPaywall, toggleHifi } = useContext(ProjectsListContext)
21
22
 
22
23
  const {
23
24
  stemsSelected,
@@ -36,21 +37,45 @@ const StemSeparationForm = ({
36
37
  setIsChangingStems(false)
37
38
  }
38
39
 
40
+ const handleToggleHifi = (e) => {
41
+ e.stopPropagation()
42
+ onShowPaywall?.('hiFiSeparation-stemSeparationExtension')
43
+ }
44
+
39
45
  return (
40
46
  <Collapsible.Root open={isOpen} className={styles.contentCollapsible}>
41
47
  <Collapsible.Content className={styles.content}>
42
- <Flex pt="3">
48
+ <Flex pt="3" direction="column" gap="2">
43
49
  <Button
44
50
  variant="solid"
45
51
  color="cyan"
46
52
  size="2"
47
- style={{ width: '100%' }}
53
+ style={{ width: '100%', position: 'relative' }}
48
54
  disabled={!hasChanges}
49
55
  loading={loading}
50
56
  onClick={handleSubmit}
51
57
  >
52
58
  {labels.changeStems || 'Change Stems'}
59
+ {!toggleHifi ? <HiFi1Icon className={styles.hiFiIcon} /> : null}
53
60
  </Button>
61
+
62
+ {
63
+ toggleHifi ?
64
+ <Flex
65
+ direction="row"
66
+ justify="between"
67
+ align="center"
68
+ gap="2"
69
+ className={styles.hiFiContainer}
70
+ onClick={handleToggleHifi}
71
+ >
72
+ <HiFi1Icon width={76} height={22} />
73
+ <Switch checked={false} />
74
+ </Flex>
75
+ : null
76
+ }
77
+
78
+ <Separator mt="1" className={styles.separator} />
54
79
  </Flex>
55
80
 
56
81
  <Flex
@@ -67,6 +92,7 @@ const StemSeparationForm = ({
67
92
  {option.title}
68
93
  </Text>
69
94
  <InstrumentSelect
95
+ columns={['auto-detect', 'basic-models'].includes(option.id) ? 1 : 2}
70
96
  items={option.items}
71
97
  selectedValue={stemsSelected}
72
98
  onSelect={onToggleStems}
@@ -38,3 +38,20 @@
38
38
  height: 0;
39
39
  }
40
40
  }
41
+
42
+ .hiFiIcon {
43
+ position: absolute;
44
+ top: 50%;
45
+ right: 16px;
46
+ transform: translateY(-50%);
47
+ display: flex;
48
+ align-items: center;
49
+ gap: 8px;
50
+ flex-shrink: 0;
51
+ line-height: 1;
52
+ }
53
+
54
+ .separator {
55
+ width: 100%;
56
+ background-color: var(--neutral-alpha-3);
57
+ }
@@ -16,7 +16,8 @@ export const ProjectsList = ({
16
16
  onSubmitStemSeparation,
17
17
  onShowPaywall,
18
18
  labels = {},
19
- showCover = true
19
+ showCover = true,
20
+ toggleHifi = false
20
21
  }) => {
21
22
  const [openedItem, setOpenedItem] = useState(null)
22
23
 
@@ -34,6 +35,7 @@ export const ProjectsList = ({
34
35
  setOpenedItem,
35
36
  labels,
36
37
  showCover,
38
+ toggleHifi,
37
39
  }}
38
40
  >
39
41
  <Flex direction="column" width="100%">
@@ -211,7 +211,7 @@ export const WithProjectFailed = {
211
211
 
212
212
  export const WithTrackSeparate = {
213
213
  args: {
214
- projects: projects.filter((project) => project.type === 'stems'),
214
+ projects: projects.filter((project) => project.id === '4817ab8e-bed6-4ef7-b633-ee79cc56ca30'),
215
215
  onProjectClick: (project, opened) => {
216
216
  console.log('project', project)
217
217
  console.log('opened', opened)
@@ -229,6 +229,7 @@ export const WithTrackSeparate = {
229
229
  onShowPaywall: (paywallId) => {
230
230
  console.log('show-paywall', paywallId)
231
231
  },
232
+ toggleHifi: false,
232
233
  },
233
234
  render: (args) => {
234
235
  return (
@@ -240,6 +241,56 @@ export const WithTrackSeparate = {
240
241
  onProjectClick={args.onProjectClick}
241
242
  onSubmitStemSeparation={args.onSubmitStemSeparation}
242
243
  onShowPaywall={args.onShowPaywall}
244
+ toggleHifi={args.toggleHifi}
245
+ >
246
+ {({ projectId, tracks }) =>
247
+ tracks.map((track) => (
248
+ <ProjectsList.Track
249
+ projectId={projectId}
250
+ key={track.id}
251
+ {...track}
252
+ />
253
+ ))
254
+ }
255
+ </ProjectsList>
256
+ </Flex>
257
+ )
258
+ },
259
+ }
260
+
261
+ export const WithTrackSeparateHifi = {
262
+ args: {
263
+ projects: projects.filter((project) => project.id === '4817ab8e-123bed6-4ef7-b633-ee79cc56ca30'),
264
+ onProjectClick: (project, opened) => {
265
+ console.log('project', project)
266
+ console.log('opened', opened)
267
+ },
268
+ onClickTrack: (track) => {
269
+ console.log('track', track)
270
+ },
271
+ onInsertAllTracks: (tracks) => {
272
+ console.log('insert-all-tracks', tracks)
273
+ },
274
+ onSubmitStemSeparation: async (project, stems) => {
275
+ await new Promise((resolve) => setTimeout(resolve, 1000))
276
+ console.log('submit-stem-separation', project, stems)
277
+ },
278
+ onShowPaywall: (paywallId) => {
279
+ console.log('show-paywall', paywallId)
280
+ },
281
+ toggleHifi: true,
282
+ },
283
+ render: (args) => {
284
+ return (
285
+ <Flex width="300px">
286
+ <ProjectsList
287
+ projects={args.projects}
288
+ onClickTrack={args.onClickTrack}
289
+ onInsertAllTracks={args.onInsertAllTracks}
290
+ onProjectClick={args.onProjectClick}
291
+ onSubmitStemSeparation={args.onSubmitStemSeparation}
292
+ onShowPaywall={args.onShowPaywall}
293
+ toggleHifi={args.toggleHifi}
243
294
  >
244
295
  {({ projectId, tracks }) =>
245
296
  tracks.map((track) => (
@@ -12,4 +12,5 @@ export const ProjectsListContext = createContext({
12
12
  setOpenedItem: () => { },
13
13
  labels: {},
14
14
  showCover: true,
15
+ toggleHifi: false,
15
16
  })
@@ -165,6 +165,18 @@ export const projects = [
165
165
  stemSeparation: {
166
166
  selected: ['vocals', 'guitars', 'drums'],
167
167
  options: [
168
+ {
169
+ id: 'auto-detect',
170
+ items: [
171
+ {
172
+ text: 'Auto Detect',
173
+ value: 'autoDetect',
174
+ category: 'premium',
175
+ paywallId: 'autoDetect-stemSeparationExtension',
176
+ locked: false,
177
+ }
178
+ ],
179
+ },
168
180
  {
169
181
  id: 'voice',
170
182
  title: 'Voice',
@@ -337,6 +349,87 @@ export const projects = [
337
349
  ]
338
350
  },
339
351
  },
352
+ {
353
+ id: '4817ab8e-123bed6-4ef7-b633-ee79cc56ca30',
354
+ title: 'Example free plan',
355
+ artist: null,
356
+ cover: null,
357
+ duration: 19.924,
358
+ type: 'stems',
359
+ toggleHifi: true,
360
+ tracks: [
361
+ {
362
+ id: 'vocals',
363
+ title: 'vocals',
364
+ audioUrl:
365
+ 'https://d3-stage.moises.ai/v3/download/moises-stage--tasks-us-east1/operations/SEPARATE_CUSTOM/134ecc8d-c3b5-4a75-a088-2e4ce374d6fb/vocals.m4a',
366
+ },
367
+ {
368
+ id: 'other',
369
+ title: 'other',
370
+ audioUrl:
371
+ 'https://d3-stage.moises.ai/v3/download/moises-stage--tasks2/operations/SEPARATE_CUSTOM/e21c0c85-7555-4280-ad72-9de7b274c24f/other.m4a',
372
+ },
373
+ ],
374
+ stemSeparation: {
375
+ selected: ['freeVocalsInstrumental'],
376
+ options: [
377
+ {
378
+ id: 'basic-models',
379
+ title: 'Basic Models',
380
+ items: [
381
+ {
382
+ text: 'Vocals, Instrumental',
383
+ value: 'freeVocalsInstrumental',
384
+ category: 'free',
385
+ paywallId: 'xxxx-stemSeparationExtension',
386
+ locked: false,
387
+ mutualExclusiveStems: ['freeVocalsDrumsBassOther'],
388
+ },
389
+ {
390
+ text: 'Vocals, Drums, Bass & Other',
391
+ value: 'freeVocalsDrumsBassOther',
392
+ category: 'free',
393
+ paywallId: 'xxxx-stemSeparationExtension',
394
+ locked: false,
395
+ mutualExclusiveStems: ['freeVocalsInstrumental'],
396
+ },
397
+ ],
398
+ },
399
+ {
400
+ id: 'voice',
401
+ title: 'Voice',
402
+ items: [
403
+ {
404
+ text: 'Vocals',
405
+ value: 'vocals',
406
+ category: 'premium',
407
+ paywallId: 'customSeparationVocals-stemSeparationExtension',
408
+ locked: false,
409
+ mutualExclusiveStems: ['leadVocals', 'backingVocals'],
410
+ },
411
+ {
412
+ text: 'Lead Vocals',
413
+ value: 'leadVocals',
414
+ category: 'premium',
415
+ paywallId: 'customSeparationLeadVocals-stemSeparationExtension',
416
+ locked: false,
417
+ mutualExclusiveStems: ['vocals'],
418
+ },
419
+ {
420
+ text: 'Backing Vocals',
421
+ value: 'backingVocals',
422
+ category: 'premium',
423
+ paywallId:
424
+ 'customSeparationBackgroundVocals-stemSeparationExtension',
425
+ locked: false,
426
+ mutualExclusiveStems: ['vocals'],
427
+ },
428
+ ],
429
+ }
430
+ ]
431
+ },
432
+ },
340
433
  {
341
434
  id: '2244f646-dd1c-4986-b885-1e1929593b46',
342
435
  title: 'Empty Project',