@moises.ai/design-system 3.9.25 → 3.9.27

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": "3.9.25",
3
+ "version": "3.9.27",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -1,112 +1,36 @@
1
- import { useState } from 'react'
2
1
  import classNames from 'classnames'
3
-
4
- const palettes = {
5
- lyrics: ['#0f2a4f', '#1a3a6b', '#2a5a8b', '#1a4a7b', '#3a6a9b', '#152e55'],
6
- stems: ['#083a48', '#0a4a5a', '#1a5a6a', '#0f3a4a', '#2a6a7a', '#1a6070'],
7
- voice: ['#3a1a0a', '#5a2a10', '#7a3a1a', '#4a2010', '#8a4a2a', '#6a3018'],
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 [randomSeed] = useState(() => String(Math.random()))
61
-
62
- if (cover) {
63
- return (
64
- <img
65
- src={cover}
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 effectiveSeed = title != null ? title : randomSeed
77
- const { bg, blobs } = generatePattern(type, effectiveSeed)
78
-
23
+ const pattern = cover || patterns[type]
79
24
  return (
80
- <div
81
- aria-label={`${type} pattern`}
82
- role="img"
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