@moises.ai/design-system 4.20.5 → 4.20.7
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 +1695 -1690
- package/package.json +1 -1
- package/src/colors/Colors.stories.jsx +104 -83
- package/src/components/ProjectsList/ProjectItem/ProjectItem.jsx +56 -42
- package/src/components/ProjectsList/ProjectItem/ProjectItem.module.css +44 -0
- package/src/icons/Icons.stories.jsx +389 -36
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
2
|
-
import {
|
|
1
|
+
import { useState, useRef, useEffect, useCallback } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Flex,
|
|
4
|
+
Heading,
|
|
5
|
+
Text,
|
|
6
|
+
Box,
|
|
7
|
+
Grid,
|
|
8
|
+
Card,
|
|
9
|
+
Tabs,
|
|
10
|
+
Popover,
|
|
11
|
+
Button,
|
|
12
|
+
Tooltip,
|
|
13
|
+
} from '@radix-ui/themes'
|
|
3
14
|
import { Select } from '../components/Select/Select.jsx'
|
|
4
15
|
import { TextField } from '../components/TextField/TextField.jsx'
|
|
5
|
-
import {
|
|
16
|
+
import { Callout } from '../components/Callout/Callout.jsx'
|
|
17
|
+
import {
|
|
18
|
+
MagnifyingGlassIcon,
|
|
19
|
+
CheckCircledIcon,
|
|
20
|
+
ChevronDownIcon,
|
|
21
|
+
ResetIcon,
|
|
22
|
+
} from '@radix-ui/react-icons'
|
|
6
23
|
import * as IconsList from '../icons.jsx'
|
|
7
24
|
|
|
8
25
|
export default {
|
|
@@ -13,7 +30,8 @@ export default {
|
|
|
13
30
|
}
|
|
14
31
|
|
|
15
32
|
// List of icons that use gradients
|
|
16
|
-
const gradientIcons = [
|
|
33
|
+
const gradientIcons = [
|
|
34
|
+
'HiFiIcon',
|
|
17
35
|
'ProducerIcon',
|
|
18
36
|
'IsolateDrumsGradientIcon',
|
|
19
37
|
'HiFiGradientIcon',
|
|
@@ -21,11 +39,268 @@ const gradientIcons = ['HiFiIcon',
|
|
|
21
39
|
'SoundEffectsGradientIcon',
|
|
22
40
|
'SparklesGradientIcon',
|
|
23
41
|
'SpliterGradientIcon',
|
|
24
|
-
'SoundtrackGradientIcon'
|
|
42
|
+
'SoundtrackGradientIcon',
|
|
43
|
+
'FlashGradientIcon',
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
const SIZE_OPTIONS = [
|
|
47
|
+
{ value: '16', label: '16px' },
|
|
48
|
+
{ value: '24', label: '24px' },
|
|
49
|
+
{ value: '32', label: '32px' },
|
|
50
|
+
{ value: '48', label: '48px' },
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
const DEFAULT_COLOR = 'var(--neutral-12)'
|
|
54
|
+
|
|
55
|
+
const PRESET_COLORS = [
|
|
56
|
+
{ name: 'Neutral', value: 'var(--neutral-12)', hex: '#e9eef5' },
|
|
57
|
+
{ name: 'Neutral Alpha', value: 'var(--neutral-alpha-9)', hex: '#8e8e93' },
|
|
58
|
+
{ name: 'Aqua', value: 'var(--aqua-9)', hex: '#00dae8' },
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
const ColorPicker = ({ value, onChange }) => {
|
|
62
|
+
const [open, setOpen] = useState(false)
|
|
63
|
+
const [customInput, setCustomInput] = useState(value)
|
|
64
|
+
const colorInputRef = useRef(null)
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
setCustomInput(value)
|
|
68
|
+
}, [value])
|
|
69
|
+
|
|
70
|
+
const activePreset = PRESET_COLORS.find((p) => p.value === value)
|
|
71
|
+
const displayLabel = activePreset
|
|
72
|
+
? activePreset.name
|
|
73
|
+
: value.startsWith('var(')
|
|
74
|
+
? value.replace(/^var\(--?|\)$/g, '')
|
|
75
|
+
: value
|
|
76
|
+
|
|
77
|
+
const handleCustomChange = (val) => {
|
|
78
|
+
setCustomInput(val)
|
|
79
|
+
if (val.trim()) {
|
|
80
|
+
onChange(val.trim())
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Convert current value to a 6-digit hex suitable for <input type="color" />
|
|
85
|
+
const getHexForPicker = () => {
|
|
86
|
+
if (activePreset?.hex) return activePreset.hex
|
|
87
|
+
if (/^#[0-9a-fA-F]{6}$/.test(value)) return value
|
|
88
|
+
if (/^#[0-9a-fA-F]{3}$/.test(value)) {
|
|
89
|
+
return `#${value[1]}${value[1]}${value[2]}${value[2]}${value[3]}${value[3]}`
|
|
90
|
+
}
|
|
91
|
+
return '#0affa7'
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Box width="100%">
|
|
96
|
+
<Flex mb="2" align="center" gap="2">
|
|
97
|
+
<Text size="2" weight="medium">
|
|
98
|
+
Color
|
|
99
|
+
</Text>
|
|
100
|
+
</Flex>
|
|
101
|
+
|
|
102
|
+
<Popover.Root open={open} onOpenChange={setOpen}>
|
|
103
|
+
<Popover.Trigger>
|
|
104
|
+
<button
|
|
105
|
+
type="button"
|
|
106
|
+
style={{
|
|
107
|
+
all: 'unset',
|
|
108
|
+
boxSizing: 'border-box',
|
|
109
|
+
display: 'inline-flex',
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
justifyContent: 'space-between',
|
|
112
|
+
gap: '8px',
|
|
113
|
+
height: '32px',
|
|
114
|
+
padding: '0 12px',
|
|
115
|
+
borderRadius: '6px',
|
|
116
|
+
backgroundColor: 'var(--neutral-alpha-3)',
|
|
117
|
+
border: '1px solid var(--neutral-alpha-4)',
|
|
118
|
+
color: 'var(--neutral-12)',
|
|
119
|
+
fontSize: '14px',
|
|
120
|
+
cursor: 'pointer',
|
|
121
|
+
width: '100%',
|
|
122
|
+
userSelect: 'none',
|
|
123
|
+
transition: 'background-color 0.15s, border-color 0.15s',
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<Flex align="center" gap="2" style={{ minWidth: 0, flex: 1 }}>
|
|
127
|
+
<span
|
|
128
|
+
style={{
|
|
129
|
+
display: 'inline-block',
|
|
130
|
+
width: 14,
|
|
131
|
+
height: 14,
|
|
132
|
+
minWidth: 14,
|
|
133
|
+
borderRadius: '50%',
|
|
134
|
+
backgroundColor: value,
|
|
135
|
+
border: '1px solid var(--neutral-alpha-6)',
|
|
136
|
+
boxShadow: '0 0 0 1px rgba(0,0,0,0.1)',
|
|
137
|
+
}}
|
|
138
|
+
/>
|
|
139
|
+
<Text
|
|
140
|
+
size="2"
|
|
141
|
+
style={{
|
|
142
|
+
overflow: 'hidden',
|
|
143
|
+
textOverflow: 'ellipsis',
|
|
144
|
+
whiteSpace: 'nowrap',
|
|
145
|
+
}}
|
|
146
|
+
>
|
|
147
|
+
{displayLabel}
|
|
148
|
+
</Text>
|
|
149
|
+
</Flex>
|
|
150
|
+
<ChevronDownIcon style={{ color: 'var(--neutral-alpha-9)', flexShrink: 0 }} />
|
|
151
|
+
</button>
|
|
152
|
+
</Popover.Trigger>
|
|
153
|
+
|
|
154
|
+
<Popover.Content
|
|
155
|
+
style={{
|
|
156
|
+
width: '260px',
|
|
157
|
+
padding: '14px',
|
|
158
|
+
backgroundColor: 'var(--neutral-2)',
|
|
159
|
+
border: '1px solid var(--neutral-alpha-4)',
|
|
160
|
+
borderRadius: '10px',
|
|
161
|
+
boxShadow: '0 12px 32px rgba(0, 0, 0, 0.4)',
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
<Flex direction="column" gap="3">
|
|
165
|
+
<Flex justify="between" align="center">
|
|
166
|
+
<Text size="1" weight="bold" color="gray">
|
|
167
|
+
PRESET PALETTE
|
|
168
|
+
</Text>
|
|
169
|
+
{value !== DEFAULT_COLOR && (
|
|
170
|
+
<Button
|
|
171
|
+
size="1"
|
|
172
|
+
variant="ghost"
|
|
173
|
+
color="gray"
|
|
174
|
+
onClick={() => onChange(DEFAULT_COLOR)}
|
|
175
|
+
style={{ cursor: 'pointer', height: '20px', padding: '0 4px' }}
|
|
176
|
+
>
|
|
177
|
+
<ResetIcon width={12} height={12} />
|
|
178
|
+
Reset
|
|
179
|
+
</Button>
|
|
180
|
+
)}
|
|
181
|
+
</Flex>
|
|
182
|
+
|
|
183
|
+
{/* Presets Grid */}
|
|
184
|
+
<Grid columns="7" gap="2">
|
|
185
|
+
{PRESET_COLORS.map((preset) => {
|
|
186
|
+
const isSelected = value === preset.value
|
|
187
|
+
return (
|
|
188
|
+
<Tooltip key={preset.name} content={preset.name}>
|
|
189
|
+
<button
|
|
190
|
+
type="button"
|
|
191
|
+
onClick={() => onChange(preset.value)}
|
|
192
|
+
style={{
|
|
193
|
+
all: 'unset',
|
|
194
|
+
width: '24px',
|
|
195
|
+
height: '24px',
|
|
196
|
+
borderRadius: '50%',
|
|
197
|
+
backgroundColor: preset.value,
|
|
198
|
+
border: isSelected
|
|
199
|
+
? '2px solid var(--mint-9)'
|
|
200
|
+
: '1px solid var(--neutral-alpha-6)',
|
|
201
|
+
boxShadow: isSelected
|
|
202
|
+
? '0 0 0 2px var(--neutral-1), 0 0 8px var(--mint-9)'
|
|
203
|
+
: 'none',
|
|
204
|
+
cursor: 'pointer',
|
|
205
|
+
display: 'flex',
|
|
206
|
+
alignItems: 'center',
|
|
207
|
+
justifyContent: 'center',
|
|
208
|
+
boxSizing: 'border-box',
|
|
209
|
+
transition: 'transform 0.1s ease',
|
|
210
|
+
}}
|
|
211
|
+
/>
|
|
212
|
+
</Tooltip>
|
|
213
|
+
)
|
|
214
|
+
})}
|
|
215
|
+
</Grid>
|
|
216
|
+
|
|
217
|
+
<Box
|
|
218
|
+
style={{
|
|
219
|
+
height: '1px',
|
|
220
|
+
backgroundColor: 'var(--neutral-alpha-4)',
|
|
221
|
+
margin: '2px 0',
|
|
222
|
+
}}
|
|
223
|
+
/>
|
|
224
|
+
|
|
225
|
+
{/* Custom Color Input & Picker */}
|
|
226
|
+
<Flex direction="column" gap="2">
|
|
227
|
+
<Text size="1" weight="bold" color="gray">
|
|
228
|
+
CUSTOM COLOR
|
|
229
|
+
</Text>
|
|
230
|
+
<Flex gap="2" align="center">
|
|
231
|
+
{/* Visual color wheel / native picker trigger */}
|
|
232
|
+
<Tooltip content="Pick with color wheel">
|
|
233
|
+
<label
|
|
234
|
+
style={{
|
|
235
|
+
position: 'relative',
|
|
236
|
+
display: 'inline-flex',
|
|
237
|
+
alignItems: 'center',
|
|
238
|
+
justifyContent: 'center',
|
|
239
|
+
width: '32px',
|
|
240
|
+
height: '32px',
|
|
241
|
+
minWidth: '32px',
|
|
242
|
+
borderRadius: '6px',
|
|
243
|
+
backgroundColor: value,
|
|
244
|
+
border: '1px solid var(--neutral-alpha-6)',
|
|
245
|
+
cursor: 'pointer',
|
|
246
|
+
overflow: 'hidden',
|
|
247
|
+
boxShadow: '0 1px 3px rgba(0,0,0,0.2)',
|
|
248
|
+
}}
|
|
249
|
+
>
|
|
250
|
+
<input
|
|
251
|
+
ref={colorInputRef}
|
|
252
|
+
type="color"
|
|
253
|
+
value={getHexForPicker()}
|
|
254
|
+
onChange={(e) => onChange(e.target.value)}
|
|
255
|
+
style={{
|
|
256
|
+
position: 'absolute',
|
|
257
|
+
top: '-10px',
|
|
258
|
+
left: '-10px',
|
|
259
|
+
width: '60px',
|
|
260
|
+
height: '60px',
|
|
261
|
+
opacity: 0,
|
|
262
|
+
cursor: 'pointer',
|
|
263
|
+
}}
|
|
264
|
+
/>
|
|
265
|
+
</label>
|
|
266
|
+
</Tooltip>
|
|
267
|
+
|
|
268
|
+
{/* Text Input for HEX or CSS variable */}
|
|
269
|
+
<input
|
|
270
|
+
type="text"
|
|
271
|
+
placeholder="#0affa7 or var(--mint-9)"
|
|
272
|
+
value={customInput}
|
|
273
|
+
onChange={(e) => handleCustomChange(e.target.value)}
|
|
274
|
+
style={{
|
|
275
|
+
flex: 1,
|
|
276
|
+
height: '32px',
|
|
277
|
+
padding: '0 8px',
|
|
278
|
+
borderRadius: '6px',
|
|
279
|
+
backgroundColor: 'var(--neutral-alpha-2)',
|
|
280
|
+
border: '1px solid var(--neutral-alpha-4)',
|
|
281
|
+
color: 'var(--neutral-12)',
|
|
282
|
+
fontSize: '12px',
|
|
283
|
+
fontFamily: 'monospace',
|
|
284
|
+
outline: 'none',
|
|
285
|
+
boxSizing: 'border-box',
|
|
286
|
+
}}
|
|
287
|
+
/>
|
|
288
|
+
</Flex>
|
|
289
|
+
</Flex>
|
|
290
|
+
</Flex>
|
|
291
|
+
</Popover.Content>
|
|
292
|
+
</Popover.Root>
|
|
293
|
+
</Box>
|
|
294
|
+
)
|
|
295
|
+
}
|
|
25
296
|
|
|
26
297
|
export const Icons = () => {
|
|
298
|
+
const [activeTab, setActiveTab] = useState('regular')
|
|
27
299
|
const [searchTerm, setSearchTerm] = useState('')
|
|
28
300
|
const [size, setSize] = useState('24')
|
|
301
|
+
const [color, setColor] = useState(DEFAULT_COLOR)
|
|
302
|
+
const [copiedIcon, setCopiedIcon] = useState(null)
|
|
303
|
+
const timeoutRef = useRef(null)
|
|
29
304
|
|
|
30
305
|
const allIcons = Object.entries(IconsList)
|
|
31
306
|
|
|
@@ -41,6 +316,27 @@ export const Icons = () => {
|
|
|
41
316
|
name.toLowerCase().includes(searchTerm.toLowerCase()),
|
|
42
317
|
)
|
|
43
318
|
|
|
319
|
+
const handleCopy = useCallback((name) => {
|
|
320
|
+
navigator.clipboard.writeText(name)
|
|
321
|
+
setCopiedIcon(name)
|
|
322
|
+
|
|
323
|
+
if (timeoutRef.current) {
|
|
324
|
+
clearTimeout(timeoutRef.current)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
timeoutRef.current = setTimeout(() => {
|
|
328
|
+
setCopiedIcon(null)
|
|
329
|
+
}, 2500)
|
|
330
|
+
}, [])
|
|
331
|
+
|
|
332
|
+
useEffect(() => {
|
|
333
|
+
return () => {
|
|
334
|
+
if (timeoutRef.current) {
|
|
335
|
+
clearTimeout(timeoutRef.current)
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}, [])
|
|
339
|
+
|
|
44
340
|
const renderIconGrid = (icons) => (
|
|
45
341
|
<Grid
|
|
46
342
|
columns={{ initial: '2', xs: '3', sm: '4', md: '5', lg: '6' }}
|
|
@@ -48,34 +344,63 @@ export const Icons = () => {
|
|
|
48
344
|
>
|
|
49
345
|
{icons.map(([name, Icon]) => {
|
|
50
346
|
const isGradient = gradientIcons.includes(name)
|
|
347
|
+
const isCopied = copiedIcon === name
|
|
348
|
+
|
|
51
349
|
return (
|
|
52
|
-
<Card
|
|
350
|
+
<Card
|
|
351
|
+
key={name}
|
|
352
|
+
tabIndex={0}
|
|
353
|
+
role="button"
|
|
354
|
+
onClick={() => handleCopy(name)}
|
|
355
|
+
onKeyDown={(e) => {
|
|
356
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
357
|
+
e.preventDefault()
|
|
358
|
+
handleCopy(name)
|
|
359
|
+
}
|
|
360
|
+
}}
|
|
361
|
+
style={{
|
|
362
|
+
textAlign: 'center',
|
|
363
|
+
padding: '16px',
|
|
364
|
+
cursor: 'pointer',
|
|
365
|
+
userSelect: 'none',
|
|
366
|
+
transition: 'border-color 0.15s ease, box-shadow 0.15s ease',
|
|
367
|
+
borderColor: isCopied ? 'var(--mint-9)' : undefined,
|
|
368
|
+
}}
|
|
369
|
+
>
|
|
53
370
|
<Flex direction="column" align="center" gap="3">
|
|
54
371
|
<Box
|
|
55
372
|
style={{
|
|
56
373
|
display: 'flex',
|
|
57
374
|
alignItems: 'center',
|
|
58
375
|
justifyContent: 'center',
|
|
59
|
-
height:
|
|
60
|
-
|
|
61
|
-
: size === '16'
|
|
62
|
-
? '24px'
|
|
63
|
-
: size === '24'
|
|
64
|
-
? '32px'
|
|
65
|
-
: '48px',
|
|
66
|
-
minHeight: isGradient ? '48px' : 'auto',
|
|
376
|
+
height: '48px',
|
|
377
|
+
minHeight: '48px',
|
|
67
378
|
marginBottom: '8px',
|
|
68
379
|
marginTop: '8px',
|
|
380
|
+
color: isGradient ? undefined : color,
|
|
69
381
|
}}
|
|
70
382
|
>
|
|
71
|
-
<Icon
|
|
383
|
+
<Icon
|
|
384
|
+
{...(isGradient
|
|
385
|
+
? {}
|
|
386
|
+
: {
|
|
387
|
+
width: size,
|
|
388
|
+
height: size,
|
|
389
|
+
style: { color },
|
|
390
|
+
})}
|
|
391
|
+
/>
|
|
72
392
|
</Box>
|
|
73
393
|
<Flex direction="column" align="center" gap="1">
|
|
74
394
|
<Text
|
|
75
395
|
size="1"
|
|
76
|
-
style={{
|
|
396
|
+
style={{
|
|
397
|
+
wordBreak: 'break-word',
|
|
398
|
+
lineHeight: '1.2',
|
|
399
|
+
color: isCopied ? 'var(--mint-11)' : undefined,
|
|
400
|
+
fontWeight: isCopied ? '600' : 'normal',
|
|
401
|
+
}}
|
|
77
402
|
>
|
|
78
|
-
{name}
|
|
403
|
+
{isCopied ? 'Copied!' : name}
|
|
79
404
|
</Text>
|
|
80
405
|
</Flex>
|
|
81
406
|
</Flex>
|
|
@@ -86,42 +411,70 @@ export const Icons = () => {
|
|
|
86
411
|
)
|
|
87
412
|
|
|
88
413
|
return (
|
|
89
|
-
<Box p="6">
|
|
414
|
+
<Box p="6" style={{ position: 'relative' }}>
|
|
415
|
+
{copiedIcon && (
|
|
416
|
+
<Box
|
|
417
|
+
style={{
|
|
418
|
+
position: 'fixed',
|
|
419
|
+
top: 24,
|
|
420
|
+
right: 24,
|
|
421
|
+
zIndex: 9999,
|
|
422
|
+
maxWidth: 420,
|
|
423
|
+
boxShadow: '0 8px 24px rgba(0, 0, 0, 0.4)',
|
|
424
|
+
}}
|
|
425
|
+
>
|
|
426
|
+
<Callout
|
|
427
|
+
color="success"
|
|
428
|
+
size="2"
|
|
429
|
+
Icon={CheckCircledIcon}
|
|
430
|
+
title="Copied to clipboard"
|
|
431
|
+
text={copiedIcon}
|
|
432
|
+
/>
|
|
433
|
+
</Box>
|
|
434
|
+
)}
|
|
435
|
+
|
|
90
436
|
<Heading size="8" mb="4">
|
|
91
437
|
Icons
|
|
92
438
|
</Heading>
|
|
93
439
|
|
|
94
440
|
<Text mb="4">
|
|
95
441
|
Explore the complete icon library available in
|
|
96
|
-
@moises.ai/design-system/icons
|
|
442
|
+
@moises.ai/design-system/icons. Click any icon to copy its name.
|
|
97
443
|
</Text>
|
|
98
444
|
|
|
99
|
-
<Flex gap="4" my="6">
|
|
100
|
-
<
|
|
445
|
+
<Flex gap="4" my="6" align="flex-end" wrap="wrap">
|
|
446
|
+
<Box style={{ flex: '1 1 240px' }}>
|
|
101
447
|
<TextField
|
|
102
448
|
title="Search by name"
|
|
103
449
|
placeholder="Search..."
|
|
450
|
+
value={searchTerm}
|
|
104
451
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
105
452
|
size="2"
|
|
106
453
|
Icon={MagnifyingGlassIcon}
|
|
107
454
|
/>
|
|
108
|
-
</
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
455
|
+
</Box>
|
|
456
|
+
|
|
457
|
+
{activeTab === 'regular' && (
|
|
458
|
+
<>
|
|
459
|
+
<Box style={{ width: '140px' }}>
|
|
460
|
+
<Select
|
|
461
|
+
title="Size"
|
|
462
|
+
items={SIZE_OPTIONS}
|
|
463
|
+
size="2"
|
|
464
|
+
value={size}
|
|
465
|
+
onChange={(value) => setSize(value)}
|
|
466
|
+
variant="soft"
|
|
467
|
+
/>
|
|
468
|
+
</Box>
|
|
469
|
+
|
|
470
|
+
<Box style={{ width: '180px' }}>
|
|
471
|
+
<ColorPicker value={color} onChange={setColor} />
|
|
472
|
+
</Box>
|
|
473
|
+
</>
|
|
474
|
+
)}
|
|
122
475
|
</Flex>
|
|
123
476
|
|
|
124
|
-
<Tabs.Root
|
|
477
|
+
<Tabs.Root value={activeTab} onValueChange={setActiveTab}>
|
|
125
478
|
<Tabs.List>
|
|
126
479
|
<Tabs.Trigger value="regular">
|
|
127
480
|
Regular Icons ({regularIconsList.length})
|