@moises.ai/design-system 3.11.11 → 3.11.12
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/colors/custom-styles.css +49 -99
- package/dist/index.js +3195 -3178
- package/package.json +1 -1
- package/src/colors/custom-styles.css +49 -99
- package/src/components/IconButton/IconButton.jsx +30 -3
- package/src/components/IconButton/IconButton.module.css +208 -147
- package/src/components/IconButton/IconButton.stories.jsx +354 -397
- package/src/components/InputLevelMeter/InputLevelMeter.jsx +2 -1
- package/src/components/PanControl/PanControl.jsx +51 -75
- package/src/components/PanControl/PanControl.module.css +0 -31
|
@@ -2,7 +2,7 @@ import styles from './PanControl.module.css'
|
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { useRef, useCallback, useMemo, useState, useEffect } from 'react'
|
|
4
4
|
import { useEventListener } from '../../utils/useEventListener'
|
|
5
|
-
import { Tooltip } from '
|
|
5
|
+
import { Tooltip } from '../../index'
|
|
6
6
|
|
|
7
7
|
const KNOB_CENTER_X = 10
|
|
8
8
|
const KNOB_CENTER_Y = 10
|
|
@@ -23,8 +23,6 @@ export const PanControl = ({
|
|
|
23
23
|
maxValue = 0.65,
|
|
24
24
|
}) => {
|
|
25
25
|
const containerRef = useRef(null)
|
|
26
|
-
const [open, setOpen] = useState(false)
|
|
27
|
-
const timeoutRef = useRef()
|
|
28
26
|
const [isDragging, setIsDragging] = useState(false)
|
|
29
27
|
const styleRef = useRef(null)
|
|
30
28
|
|
|
@@ -32,39 +30,26 @@ export const PanControl = ({
|
|
|
32
30
|
const pendingNormRef = useRef(value)
|
|
33
31
|
const rafRef = useRef(0)
|
|
34
32
|
|
|
35
|
-
const showTooltip = useCallback(() => {
|
|
36
|
-
clearTimeout(timeoutRef.current)
|
|
37
|
-
setOpen(true)
|
|
38
|
-
}, [])
|
|
39
|
-
|
|
40
|
-
const hideTooltip = useCallback(() => {
|
|
41
|
-
if (isDragging) return
|
|
42
|
-
timeoutRef.current = setTimeout(() => setOpen(false), 300)
|
|
43
|
-
}, [isDragging])
|
|
44
|
-
|
|
45
33
|
useEffect(() => {
|
|
46
34
|
if (isDragging) {
|
|
47
35
|
const style = document.createElement('style')
|
|
48
36
|
style.textContent = '* { cursor: ns-resize !important; }'
|
|
49
37
|
document.head.appendChild(style)
|
|
50
38
|
styleRef.current = style
|
|
51
|
-
showTooltip()
|
|
52
39
|
} else {
|
|
53
40
|
if (styleRef.current) {
|
|
54
41
|
document.head.removeChild(styleRef.current)
|
|
55
42
|
styleRef.current = null
|
|
56
43
|
}
|
|
57
|
-
hideTooltip()
|
|
58
44
|
}
|
|
59
45
|
return () => {
|
|
60
46
|
if (styleRef.current) {
|
|
61
47
|
document.head.removeChild(styleRef.current)
|
|
62
48
|
styleRef.current = null
|
|
63
49
|
}
|
|
64
|
-
hideTooltip()
|
|
65
50
|
if (rafRef.current) cancelAnimationFrame(rafRef.current)
|
|
66
51
|
}
|
|
67
|
-
}, [isDragging
|
|
52
|
+
}, [isDragging])
|
|
68
53
|
|
|
69
54
|
const scheduleEmit = useCallback(
|
|
70
55
|
(nextNormalized) => {
|
|
@@ -161,65 +146,56 @@ export const PanControl = ({
|
|
|
161
146
|
onClick={handleClick}
|
|
162
147
|
style={{ cursor: disabled ? 'default' : 'ns-resize' }}
|
|
163
148
|
>
|
|
164
|
-
<Tooltip
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
149
|
+
<Tooltip
|
|
150
|
+
content={panValueText}
|
|
151
|
+
open={isDragging}
|
|
152
|
+
side="bottom"
|
|
153
|
+
align="center"
|
|
154
|
+
sideOffset={10}
|
|
155
|
+
delayDuration={0}
|
|
156
|
+
>
|
|
157
|
+
<div
|
|
158
|
+
className={classNames(
|
|
159
|
+
styles.pan,
|
|
160
|
+
isDragging && styles.active,
|
|
161
|
+
disabled && styles.disabled,
|
|
162
|
+
)}
|
|
163
|
+
onPointerDown={onPointerDown}
|
|
164
|
+
onPointerMove={onPointerMove}
|
|
165
|
+
onPointerUp={onPointerUp}
|
|
166
|
+
onPointerCancel={onPointerUp}
|
|
167
|
+
>
|
|
168
|
+
<svg width={20} height={20} viewBox="0 0 20 20" fill="none">
|
|
169
|
+
<circle cx={KNOB_CENTER_X} cy={KNOB_CENTER_Y} r={10} />
|
|
170
|
+
<circle
|
|
171
|
+
cx={KNOB_CENTER_X}
|
|
172
|
+
cy={KNOB_CENTER_Y}
|
|
173
|
+
r={KNOB_RADIUS}
|
|
174
|
+
stroke="#D3EDF8"
|
|
175
|
+
strokeOpacity={0.113725}
|
|
176
|
+
/>
|
|
177
|
+
{value !== 0 && (
|
|
178
|
+
<path
|
|
179
|
+
d={arcPath}
|
|
180
|
+
stroke={arcColor}
|
|
181
|
+
strokeLinecap="round"
|
|
182
|
+
strokeWidth={1}
|
|
183
|
+
fill="none"
|
|
184
|
+
/>
|
|
185
|
+
)}
|
|
186
|
+
<g
|
|
187
|
+
transform={`rotate(${pointerRotation} ${KNOB_CENTER_X} ${KNOB_CENTER_Y})`}
|
|
177
188
|
>
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
<path
|
|
189
|
-
d={arcPath}
|
|
190
|
-
stroke={arcColor}
|
|
191
|
-
strokeLinecap="round"
|
|
192
|
-
strokeWidth={1}
|
|
193
|
-
fill="none"
|
|
194
|
-
/>
|
|
195
|
-
)}
|
|
196
|
-
<g
|
|
197
|
-
transform={`rotate(${pointerRotation} ${KNOB_CENTER_X} ${KNOB_CENTER_Y})`}
|
|
198
|
-
>
|
|
199
|
-
<path
|
|
200
|
-
d="M10 0.5 L10 6"
|
|
201
|
-
stroke={pointerColor}
|
|
202
|
-
strokeLinecap="round"
|
|
203
|
-
strokeWidth={1}
|
|
204
|
-
/>
|
|
205
|
-
</g>
|
|
206
|
-
</svg>
|
|
207
|
-
</div>
|
|
208
|
-
</Tooltip.Trigger>
|
|
209
|
-
|
|
210
|
-
<Tooltip.Content
|
|
211
|
-
className={styles.tooltipContent}
|
|
212
|
-
side="bottom"
|
|
213
|
-
align="center"
|
|
214
|
-
sideOffset={10}
|
|
215
|
-
>
|
|
216
|
-
<>
|
|
217
|
-
{panValueText}
|
|
218
|
-
<Tooltip.Arrow className={styles.tooltipArrow} />
|
|
219
|
-
</>
|
|
220
|
-
</Tooltip.Content>
|
|
221
|
-
</Tooltip.Root>
|
|
222
|
-
</Tooltip.Provider>
|
|
189
|
+
<path
|
|
190
|
+
d="M10 0.5 L10 6"
|
|
191
|
+
stroke={pointerColor}
|
|
192
|
+
strokeLinecap="round"
|
|
193
|
+
strokeWidth={1}
|
|
194
|
+
/>
|
|
195
|
+
</g>
|
|
196
|
+
</svg>
|
|
197
|
+
</div>
|
|
198
|
+
</Tooltip>
|
|
223
199
|
</div>
|
|
224
200
|
)
|
|
225
201
|
}
|
|
@@ -37,35 +37,4 @@
|
|
|
37
37
|
fill: #DDEAF8;
|
|
38
38
|
fill-opacity: 0.0784314;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
.tooltipContent {
|
|
42
|
-
background-color: var(--neutral-12);
|
|
43
|
-
color: var(--neutral-2);
|
|
44
|
-
font-size: 12px;
|
|
45
|
-
padding: 6px 10px;
|
|
46
|
-
border-radius: 8px;
|
|
47
|
-
z-index: 999;
|
|
48
|
-
white-space: nowrap;
|
|
49
|
-
animation: fadeIn 0.2s ease;
|
|
50
|
-
display: flex;
|
|
51
|
-
align-items: center;
|
|
52
|
-
width: 70px;
|
|
53
|
-
justify-content: center;
|
|
54
|
-
gap: 4px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.tooltipArrow {
|
|
58
|
-
fill: var(--neutral-12);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@keyframes fadeIn {
|
|
62
|
-
from {
|
|
63
|
-
opacity: 0;
|
|
64
|
-
transform: translateY(2px);
|
|
65
|
-
}
|
|
66
|
-
to {
|
|
67
|
-
opacity: 1;
|
|
68
|
-
transform: translateY(0);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
40
|
|