@moises.ai/design-system 4.21.1 → 4.21.3

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.1",
3
+ "version": "4.21.3",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -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, lockHifi } = 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
+ {!lockHifi ? <HiFi1Icon className={styles.hiFiIcon} /> : null}
53
60
  </Button>
61
+
62
+ {
63
+ lockHifi ?
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
+ }
@@ -1,5 +1,4 @@
1
1
  import { useState, useMemo, useEffect } from 'react'
2
- import { stems } from './utils'
3
2
 
4
3
  function areStemSelectionsEqual(current = [], initial = []) {
5
4
  if (current.length !== initial.length) return false
@@ -15,12 +14,6 @@ export function useForm({ onShowPaywall, selected = [] }) {
15
14
  [stemsSelected, selected],
16
15
  )
17
16
 
18
- useEffect(() => {
19
- if (!hasChanges) {
20
- setStemsSelected(selected)
21
- }
22
- }, [selected, hasChanges])
23
-
24
17
  const onToggleStems = async (value) => {
25
18
  if (value.locked) {
26
19
  onShowPaywall(value.paywallId)
@@ -35,7 +28,7 @@ export function useForm({ onShowPaywall, selected = [] }) {
35
28
 
36
29
  // If the item is not selected, add it and remove the mutualExclusiveStems
37
30
  const newStems = [...prev, value.value]
38
- const mutualExclusiveStems = stems.find((s) => s.value === value.value)?.mutualExclusiveStems
31
+ const mutualExclusiveStems = value.mutualExclusiveStems
39
32
  return newStems.filter((stem) => !mutualExclusiveStems?.includes(stem))
40
33
  })
41
34
  }
@@ -16,7 +16,8 @@ export const ProjectsList = ({
16
16
  onSubmitStemSeparation,
17
17
  onShowPaywall,
18
18
  labels = {},
19
- showCover = true
19
+ showCover = true,
20
+ lockHifi = 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
+ lockHifi,
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
+ lockHifi: 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
+ lockHifi={args.lockHifi}
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
+ lockHifi: 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
+ lockHifi={args.lockHifi}
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
+ lockHifi: 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',
@@ -175,6 +187,7 @@ export const projects = [
175
187
  category: 'premium',
176
188
  paywallId: 'customSeparationVocals-stemSeparationExtension',
177
189
  locked: false,
190
+ mutualExclusiveStems: ['leadVocals', 'backingVocals'],
178
191
  },
179
192
  {
180
193
  text: 'Lead Vocals',
@@ -182,6 +195,7 @@ export const projects = [
182
195
  category: 'premium',
183
196
  paywallId: 'customSeparationLeadVocals-stemSeparationExtension',
184
197
  locked: false,
198
+ mutualExclusiveStems: ['vocals'],
185
199
  },
186
200
  {
187
201
  text: 'Backing Vocals',
@@ -190,6 +204,7 @@ export const projects = [
190
204
  paywallId:
191
205
  'customSeparationBackgroundVocals-stemSeparationExtension',
192
206
  locked: false,
207
+ mutualExclusiveStems: ['vocals'],
193
208
  },
194
209
  ],
195
210
  },
@@ -334,6 +349,87 @@ export const projects = [
334
349
  ]
335
350
  },
336
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
+ lockHifi: 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
+ },
337
433
  {
338
434
  id: '2244f646-dd1c-4986-b885-1e1929593b46',
339
435
  title: 'Empty Project',
@@ -1,170 +0,0 @@
1
- export const stems = [
2
- {
3
- value: 'freeVocalInstruments',
4
- name: 'Vocals & Instruments',
5
- category: 'free',
6
- stems: ['vocals', 'other'],
7
- mutualExclusiveStems: ['freeVocalBassDrumsOthers'],
8
- },
9
- {
10
- value: 'freeVocalBassDrumsOthers',
11
- name: 'Vocal, Bass, Drums & Others',
12
- category: 'free',
13
- stems: ['vocals', 'bass', 'drums', 'other'],
14
- mutualExclusiveStems: ['freeVocalInstruments'],
15
- },
16
- {
17
- value: 'vocals',
18
- name: 'Vocals',
19
- category: 'premium',
20
- paywallId: 'customSeparationVocals-stemSeparationExtension',
21
- stems: ['vocals'],
22
- mutualExclusiveStems: ['leadVocals', 'backingVocals'],
23
- },
24
- {
25
- value: 'leadVocals',
26
- name: 'Lead Vocals',
27
- category: 'premium',
28
- paywallId: 'customSeparationLeadVocals-stemSeparationExtension',
29
- stems: ['leadVocals'],
30
- mutualExclusiveStems: ['vocals'],
31
- },
32
- {
33
- value: 'backingVocals',
34
- name: 'Backing Vocals',
35
- category: 'premium',
36
- paywallId: 'customSeparationBackgroundVocals-stemSeparationExtension',
37
- stems: ['backingVocals'],
38
- mutualExclusiveStems: ['vocals'],
39
- },
40
- {
41
- value: 'bass',
42
- name: 'Bass',
43
- category: 'premium',
44
- paywallId: 'customSeparationBass-stemSeparationExtension',
45
- stems: ['bass'],
46
- },
47
- {
48
- value: 'guitars',
49
- name: 'Guitars',
50
- category: 'premium',
51
- paywallId: 'customSeparationGuitars-stemSeparationExtension',
52
- stems: ['guitars'],
53
- mutualExclusiveStems: ['rhythmGuitars', 'soloGuitars', 'acousticGuitar', 'electricGuitar'],
54
- },
55
- {
56
- value: 'rhythmGuitars',
57
- name: 'Rhythm Guitars',
58
- category: 'premium',
59
- paywallId: 'customSeparationRhythmGuitar-stemSeparationExtension',
60
- stems: ['rhythmGuitars'],
61
- mutualExclusiveStems: ['guitars', 'acousticGuitar', 'electricGuitar'],
62
- },
63
- {
64
- value: 'soloGuitars',
65
- name: 'Solo Guitars',
66
- category: 'premium',
67
- paywallId: 'customSeparationLeadGuitar-stemSeparationExtension',
68
- stems: ['soloGuitars'],
69
- mutualExclusiveStems: ['guitars', 'acousticGuitar', 'electricGuitar'],
70
- },
71
- {
72
- value: 'acousticGuitar',
73
- name: 'Acoustic Guitar',
74
- category: 'premium',
75
- paywallId: 'customSeparationAcousticGuitar-stemSeparationExtension',
76
- stems: ['acousticGuitar'],
77
- mutualExclusiveStems: ['guitars', 'rhythmGuitars', 'soloGuitars'],
78
- },
79
- {
80
- value: 'electricGuitar',
81
- name: 'Electric Guitar',
82
- category: 'premium',
83
- paywallId: 'customSeparationElectricGuitar-stemSeparationExtension',
84
- stems: ['electricGuitar'],
85
- mutualExclusiveStems: ['guitars', 'rhythmGuitars', 'soloGuitars'],
86
- },
87
- {
88
- value: 'strings',
89
- name: 'Strings',
90
- category: 'premium',
91
- paywallId: 'customSeparationStrings-stemSeparationExtension',
92
- stems: ['strings'],
93
- },
94
- {
95
- value: 'piano',
96
- name: 'Piano',
97
- category: 'premium',
98
- paywallId: 'customSeparationPiano-stemSeparationExtension',
99
- stems: ['piano'],
100
- },
101
- {
102
- value: 'keys',
103
- name: 'Keys',
104
- category: 'premium',
105
- paywallId: 'customSeparationKeys-stemSeparationExtension',
106
- stems: ['keys'],
107
- },
108
- {
109
- value: 'wind',
110
- name: 'Wind',
111
- category: 'premium',
112
- paywallId: 'customSeparationWind-stemSeparationExtension',
113
- stems: ['wind'],
114
- },
115
- {
116
- value: 'drums',
117
- name: 'Drums',
118
- category: 'premium',
119
- paywallId: 'customSeparationDrums-stemSeparationExtension',
120
- stems: ['drums'],
121
- mutualExclusiveStems: ['kickDrums', 'snareDrums', 'toms', 'hiHat', 'cymbals'],
122
- },
123
- {
124
- value: 'kickDrums',
125
- name: 'Kick Drums',
126
- category: 'pro',
127
- paywallId: 'customSeparationDrumPartsKickDrum-stemSeparationExtension',
128
- stems: ['kickDrums'],
129
- mutualExclusiveStems: ['drums'],
130
- },
131
- {
132
- value: 'snareDrums',
133
- name: 'Snare Drums',
134
- category: 'pro',
135
- paywallId: 'customSeparationDrumPartsSnare-stemSeparationExtension',
136
- stems: ['snareDrums'],
137
- mutualExclusiveStems: ['drums'],
138
- },
139
- {
140
- value: 'toms',
141
- name: 'Toms',
142
- category: 'pro',
143
- paywallId: 'customSeparationDrumPartsToms-stemSeparationExtension',
144
- stems: ['toms'],
145
- mutualExclusiveStems: ['drums'],
146
- },
147
- {
148
- value: 'hiHat',
149
- name: 'Hi-Hat',
150
- category: 'pro',
151
- paywallId: 'customSeparationDrumPartsHiHat-stemSeparationExtension',
152
- stems: ['hiHat'],
153
- mutualExclusiveStems: ['drums'],
154
- },
155
- {
156
- value: 'cymbals',
157
- name: 'Cymbals',
158
- category: 'pro',
159
- paywallId: 'customSeparationDrumPartsCymbals-stemSeparationExtension',
160
- stems: ['cymbals'],
161
- mutualExclusiveStems: ['drums'],
162
- },
163
- {
164
- value: 'other',
165
- name: 'Other',
166
- paywallId: 'customSeparationOther-stemSeparationExtension',
167
- category: 'pro',
168
- stems: ['other'],
169
- },
170
- ]