@moises.ai/design-system 3.9.24 → 3.9.26
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/dist/index.js +3688 -3746
- package/package.json +1 -1
- package/src/components/DataTable/DataTable.module.css +2 -2
- package/src/components/DropdownMenu/DropdownMenu.jsx +13 -3
- package/src/components/ProductsBrandPattern/Patterns/thumb-song-lyrics.jpg +0 -0
- package/src/components/ProductsBrandPattern/Patterns/thumb-song-master.jpg +0 -0
- package/src/components/ProductsBrandPattern/Patterns/thumb-song-stems.jpg +0 -0
- package/src/components/ProductsBrandPattern/Patterns/thumb-song-studio.jpg +0 -0
- package/src/components/ProductsBrandPattern/Patterns/thumb-song-voice.jpg +0 -0
- package/src/components/ProductsBrandPattern/ProductsBrandPattern.jsx +19 -95
- package/src/components/ProfileMenu/ProfileMenu.jsx +8 -0
- package/src/components/ProfileMenu/ProfileMenu.stories.jsx +2 -1
- package/src/components/Shell/Shell.stories.jsx +24 -0
- package/src/lib/menu/renderItem.jsx +3 -2
package/package.json
CHANGED
|
@@ -370,8 +370,8 @@
|
|
|
370
370
|
@media (max-width: 500px) {
|
|
371
371
|
.DataTable :global(.rt-TableColumnHeaderCell:nth-child(2)),
|
|
372
372
|
.DataTable :global(.rt-TableCell:nth-child(2)) {
|
|
373
|
-
max-width:
|
|
374
|
-
min-width:
|
|
373
|
+
max-width: 180px;
|
|
374
|
+
min-width: 100px;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ScrollArea } from '@radix-ui/themes'
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { DropdownMenu as DropdownMenuRadix } from 'radix-ui'
|
|
4
|
-
import React, { memo } from 'react'
|
|
4
|
+
import React, { memo, useState } from 'react'
|
|
5
5
|
import { createRenderItem, styles } from '../../lib/menu'
|
|
6
6
|
import { Theme } from '../theme/Theme'
|
|
7
7
|
|
|
@@ -20,8 +20,16 @@ export const DropdownMenu = memo(
|
|
|
20
20
|
closeOnSelect = true,
|
|
21
21
|
sideOffset = 5,
|
|
22
22
|
matchTriggerWidth = false,
|
|
23
|
+
wrapCloseMenu,
|
|
23
24
|
...props
|
|
24
25
|
}) => {
|
|
26
|
+
const isControlled = props.open !== undefined
|
|
27
|
+
const [internalOpen, setInternalOpen] = useState(false)
|
|
28
|
+
const open = isControlled ? props.open : internalOpen
|
|
29
|
+
const onOpenChange = isControlled ? props.onOpenChange : setInternalOpen
|
|
30
|
+
const baseClose = () => onOpenChange(false)
|
|
31
|
+
const closeMenu = wrapCloseMenu ? wrapCloseMenu(baseClose) : baseClose
|
|
32
|
+
|
|
25
33
|
const contentStyle = {
|
|
26
34
|
...(matchTriggerWidth && {
|
|
27
35
|
width: 'var(--radix-dropdown-menu-trigger-width)',
|
|
@@ -34,8 +42,8 @@ export const DropdownMenu = memo(
|
|
|
34
42
|
{options?.length > 0 && (
|
|
35
43
|
<DropdownMenuRadix.Root
|
|
36
44
|
{...props}
|
|
37
|
-
open={disabled ? false :
|
|
38
|
-
onOpenChange={disabled ? undefined :
|
|
45
|
+
open={disabled ? false : open}
|
|
46
|
+
onOpenChange={disabled ? undefined : onOpenChange}
|
|
39
47
|
>
|
|
40
48
|
<DropdownMenuRadix.Trigger
|
|
41
49
|
asChild
|
|
@@ -72,6 +80,7 @@ export const DropdownMenu = memo(
|
|
|
72
80
|
size,
|
|
73
81
|
onSelectionChange,
|
|
74
82
|
closeOnSelect,
|
|
83
|
+
closeMenu,
|
|
75
84
|
),
|
|
76
85
|
)}
|
|
77
86
|
</ScrollArea>
|
|
@@ -100,6 +109,7 @@ export const DropdownMenu = memo(
|
|
|
100
109
|
size,
|
|
101
110
|
onSelectionChange,
|
|
102
111
|
closeOnSelect,
|
|
112
|
+
closeMenu,
|
|
103
113
|
),
|
|
104
114
|
)}
|
|
105
115
|
</DropdownMenuRadix.Content>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,112 +1,36 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
2
1
|
import classNames from 'classnames'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
studio: ['#083838', '#0a4a4a', '#1a5a5a', '#0a3a3a', '#2a6a6a', '#0f5050'],
|
|
9
|
-
master: ['#1a1030', '#2a1a4a', '#3a2a5a', '#4a3a6a', '#2a1848', '#352060'],
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function hashSeed(str) {
|
|
13
|
-
let h = 0
|
|
14
|
-
for (let i = 0; i < str.length; i++) {
|
|
15
|
-
h = (Math.imul(31, h) + str.charCodeAt(i)) | 0
|
|
16
|
-
}
|
|
17
|
-
return h >>> 0
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function createRng(seed) {
|
|
21
|
-
let s = hashSeed(String(seed))
|
|
22
|
-
return () => {
|
|
23
|
-
s = (s + 0x6d2b79f5) | 0
|
|
24
|
-
let t = Math.imul(s ^ (s >>> 15), 1 | s)
|
|
25
|
-
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t
|
|
26
|
-
return ((t ^ (t >>> 14)) >>> 0) / 4294967296
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function generatePattern(type, seed) {
|
|
31
|
-
const rng = createRng(seed)
|
|
32
|
-
const colors = palettes[type] || palettes.lyrics
|
|
33
|
-
const pick = () => colors[Math.floor(rng() * colors.length)]
|
|
34
|
-
|
|
35
|
-
const bg = pick()
|
|
36
|
-
|
|
37
|
-
const blobCount = 6 + Math.floor(rng() * 3)
|
|
38
|
-
const blobs = Array.from({ length: blobCount }, () => {
|
|
39
|
-
const midStop = 10 + Math.floor(rng() * 20)
|
|
40
|
-
return {
|
|
41
|
-
x: -20 + rng() * 140,
|
|
42
|
-
y: -20 + rng() * 140,
|
|
43
|
-
size: 140 + rng() * 120,
|
|
44
|
-
fill: pick(),
|
|
45
|
-
midStop,
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
return { bg, blobs }
|
|
50
|
-
}
|
|
2
|
+
import lyrics from './Patterns/thumb-song-lyrics.jpg'
|
|
3
|
+
import mastering from './Patterns/thumb-song-master.jpg'
|
|
4
|
+
import stems from './Patterns/thumb-song-stems.jpg'
|
|
5
|
+
import studio from './Patterns/thumb-song-studio.jpg'
|
|
6
|
+
import voice from './Patterns/thumb-song-voice.jpg'
|
|
51
7
|
|
|
52
8
|
export const ProductsBrandPattern = ({
|
|
53
9
|
className,
|
|
54
10
|
size = '40px',
|
|
55
11
|
type = 'lyrics',
|
|
56
12
|
cover,
|
|
57
|
-
title,
|
|
58
13
|
...props
|
|
59
14
|
}) => {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
alt={`${type} pattern`}
|
|
67
|
-
width={size}
|
|
68
|
-
height={size}
|
|
69
|
-
draggable={false}
|
|
70
|
-
className={classNames(className)}
|
|
71
|
-
{...props}
|
|
72
|
-
/>
|
|
73
|
-
)
|
|
15
|
+
const patterns = {
|
|
16
|
+
'stems': stems,
|
|
17
|
+
'voice': voice,
|
|
18
|
+
'studio': studio,
|
|
19
|
+
'master': mastering,
|
|
20
|
+
'lyrics': lyrics,
|
|
74
21
|
}
|
|
75
22
|
|
|
76
|
-
const
|
|
77
|
-
const { bg, blobs } = generatePattern(type, effectiveSeed)
|
|
78
|
-
|
|
23
|
+
const pattern = cover || patterns[type]
|
|
79
24
|
return (
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
25
|
+
<img
|
|
26
|
+
src={pattern}
|
|
27
|
+
alt={`${type} pattern`}
|
|
28
|
+
width={size}
|
|
29
|
+
height={size}
|
|
30
|
+
draggable={false}
|
|
83
31
|
className={classNames(className)}
|
|
84
|
-
style={{
|
|
85
|
-
position: 'relative',
|
|
86
|
-
width: size,
|
|
87
|
-
height: size,
|
|
88
|
-
overflow: 'hidden',
|
|
89
|
-
backgroundColor: bg,
|
|
90
|
-
flexShrink: 0,
|
|
91
|
-
}}
|
|
92
32
|
{...props}
|
|
93
|
-
|
|
94
|
-
{blobs.map((b, i) => (
|
|
95
|
-
<div
|
|
96
|
-
key={i}
|
|
97
|
-
style={{
|
|
98
|
-
position: 'absolute',
|
|
99
|
-
left: `${b.x}%`,
|
|
100
|
-
top: `${b.y}%`,
|
|
101
|
-
width: `${b.size}%`,
|
|
102
|
-
height: `${b.size}%`,
|
|
103
|
-
borderRadius: '50%',
|
|
104
|
-
background: `radial-gradient(circle, ${b.fill} ${b.midStop}%, transparent 70%)`,
|
|
105
|
-
transform: 'translate(-50%, -50%)',
|
|
106
|
-
}}
|
|
107
|
-
/>
|
|
108
|
-
))}
|
|
109
|
-
</div>
|
|
33
|
+
/>
|
|
110
34
|
)
|
|
111
35
|
}
|
|
112
36
|
|
|
@@ -24,6 +24,13 @@ export const ProfileMenu = ({
|
|
|
24
24
|
if (isMobile) close()
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
const wrapCloseMenu = isMobile
|
|
28
|
+
? (baseClose) => () => {
|
|
29
|
+
baseClose()
|
|
30
|
+
close()
|
|
31
|
+
}
|
|
32
|
+
: undefined
|
|
33
|
+
|
|
27
34
|
const trigger = <MenuTrigger user={user} collapsed={collapsed} />
|
|
28
35
|
return (
|
|
29
36
|
<DropdownMenu
|
|
@@ -42,6 +49,7 @@ export const ProfileMenu = ({
|
|
|
42
49
|
options={menuOptions}
|
|
43
50
|
side={isMobileViewport ? 'top' : 'right'}
|
|
44
51
|
{...props}
|
|
52
|
+
wrapCloseMenu={wrapCloseMenu}
|
|
45
53
|
onSelectionChange={handleSelectionChange}
|
|
46
54
|
/>
|
|
47
55
|
)
|
|
@@ -18,7 +18,7 @@ export const Default = {
|
|
|
18
18
|
{
|
|
19
19
|
type: 'custom',
|
|
20
20
|
key: 'credits-header',
|
|
21
|
-
customRender: () => <div key="credits-header">
|
|
21
|
+
customRender: (closeMenu) => <div key="credits-header">
|
|
22
22
|
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }} className="showActiveTrigger">
|
|
23
23
|
<div>
|
|
24
24
|
<Text style={{ fontSize: 14, fontWeight: 'normal', lineHeight: '20px' }}>Credits:</Text>{` `}
|
|
@@ -31,6 +31,7 @@ export const Default = {
|
|
|
31
31
|
title="Upgrade"
|
|
32
32
|
style={{ border: 'none', cursor: 'pointer', backgroundColor: '#00dae8', color: '#061415', fontSize: 12, fontWeight: 500, padding: '4px 8px', borderRadius: 4 }}
|
|
33
33
|
onClick={() => {
|
|
34
|
+
closeMenu?.()
|
|
34
35
|
alert('Upgrade clicked')
|
|
35
36
|
}}
|
|
36
37
|
>
|
|
@@ -84,6 +84,30 @@ export const Default = {
|
|
|
84
84
|
name: 'Alex Smith',
|
|
85
85
|
plan: 'Premium',
|
|
86
86
|
menuOptions: [
|
|
87
|
+
{
|
|
88
|
+
type: 'custom',
|
|
89
|
+
key: 'credits-header',
|
|
90
|
+
customRender: (closeMenu) => (
|
|
91
|
+
<div key="credits-header">
|
|
92
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }} className="showActiveTrigger">
|
|
93
|
+
<Text as="span" style={{ fontSize: 14, fontWeight: 'normal', lineHeight: '20px' }}>Credits: </Text>
|
|
94
|
+
<Text as="span" style={{ color: 'var(--gray-12)', fontSize: 14 }}>45/60</Text>
|
|
95
|
+
<button
|
|
96
|
+
type="button"
|
|
97
|
+
aria-label="Upgrade"
|
|
98
|
+
style={{ border: 'none', cursor: 'pointer', backgroundColor: 'var(--cyan-9)', color: 'var(--gray-1)', fontSize: 12, fontWeight: 500, padding: '4px 8px', borderRadius: 4 }}
|
|
99
|
+
onClick={() => {
|
|
100
|
+
closeMenu?.()
|
|
101
|
+
console.log('Upgrade clicked - menu should close')
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
Upgrade
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
),
|
|
109
|
+
},
|
|
110
|
+
{ type: 'separator', key: 'sep-credits' },
|
|
87
111
|
{
|
|
88
112
|
type: 'item',
|
|
89
113
|
key: 'account-settings',
|
|
@@ -14,6 +14,7 @@ export const createRenderItem = (MenuPrimitives) => {
|
|
|
14
14
|
size = '2',
|
|
15
15
|
onSelectionChange,
|
|
16
16
|
closeOnSelect = true,
|
|
17
|
+
closeMenu,
|
|
17
18
|
) => {
|
|
18
19
|
switch (opt.type) {
|
|
19
20
|
case 'custom':
|
|
@@ -33,7 +34,7 @@ export const createRenderItem = (MenuPrimitives) => {
|
|
|
33
34
|
disabled={opt.disabled}
|
|
34
35
|
asChild
|
|
35
36
|
>
|
|
36
|
-
{opt.customRender()}
|
|
37
|
+
{opt.customRender(closeMenu)}
|
|
37
38
|
</MenuPrimitives.Item>
|
|
38
39
|
)
|
|
39
40
|
|
|
@@ -79,7 +80,7 @@ export const createRenderItem = (MenuPrimitives) => {
|
|
|
79
80
|
|
|
80
81
|
<MenuPrimitives.SubContent className={styles.menuSubContent}>
|
|
81
82
|
{opt?.children?.map((child) =>
|
|
82
|
-
renderItem(child, size, onSelectionChange, closeOnSelect),
|
|
83
|
+
renderItem(child, size, onSelectionChange, closeOnSelect, closeMenu),
|
|
83
84
|
)}
|
|
84
85
|
</MenuPrimitives.SubContent>
|
|
85
86
|
</MenuPrimitives.Sub>
|