penseat 0.3.0 → 0.3.1
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
|
@@ -252,19 +252,12 @@ function ColorDot({ color: c, index: i, active, onChange, pressedId }: { color:
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
function ActionButton({ icon, ariaLabel, onClick, pressed }: { icon: ReactNode; ariaLabel: string; onClick: () => void; pressed: boolean }) {
|
|
255
|
-
const [hovered, setHovered] = useState(false);
|
|
256
|
-
const [active, setActive] = useState(false);
|
|
257
|
-
const isDown = pressed || active;
|
|
258
255
|
return (
|
|
259
256
|
<button
|
|
260
257
|
tabIndex={-1}
|
|
261
258
|
data-penseat-btn
|
|
262
259
|
aria-label={ariaLabel}
|
|
263
260
|
onClick={onClick}
|
|
264
|
-
onPointerEnter={() => setHovered(true)}
|
|
265
|
-
onPointerLeave={() => { setHovered(false); setActive(false); }}
|
|
266
|
-
onPointerDown={() => setActive(true)}
|
|
267
|
-
onPointerUp={() => setActive(false)}
|
|
268
261
|
style={{
|
|
269
262
|
display: 'flex',
|
|
270
263
|
alignItems: 'center',
|
|
@@ -274,9 +267,9 @@ function ActionButton({ icon, ariaLabel, onClick, pressed }: { icon: ReactNode;
|
|
|
274
267
|
flexShrink: 0,
|
|
275
268
|
cursor: 'pointer',
|
|
276
269
|
transition: 'all 150ms',
|
|
277
|
-
transform:
|
|
278
|
-
color:
|
|
279
|
-
backgroundColor:
|
|
270
|
+
transform: pressed ? 'scale(0.9)' : undefined,
|
|
271
|
+
color: pressed ? '#f4f4f5' : '#a1a1aa',
|
|
272
|
+
backgroundColor: pressed ? 'rgba(63,63,70,1)' : 'rgba(63,63,70,0)',
|
|
280
273
|
border: 'none',
|
|
281
274
|
outline: 'none',
|
|
282
275
|
borderRadius: '6px',
|
|
@@ -332,7 +325,6 @@ function AnchorIcon({ expanded, onToggle, onPointerDown, wasDragRef, pressed, ri
|
|
|
332
325
|
pressed?: boolean;
|
|
333
326
|
rightExpand: boolean;
|
|
334
327
|
}) {
|
|
335
|
-
const [hovered, setHovered] = useState(false);
|
|
336
328
|
// Spin toward the toolbar: clockwise when expanding right, counter-clockwise when left
|
|
337
329
|
const spinDeg = rightExpand ? 90 : -90;
|
|
338
330
|
return (
|
|
@@ -341,8 +333,6 @@ function AnchorIcon({ expanded, onToggle, onPointerDown, wasDragRef, pressed, ri
|
|
|
341
333
|
data-penseat="trigger"
|
|
342
334
|
onClick={(e) => { (e.currentTarget as HTMLElement).blur(); if (!wasDragRef.current) onToggle(); }}
|
|
343
335
|
onPointerDown={expanded ? undefined : onPointerDown}
|
|
344
|
-
onPointerEnter={() => setHovered(true)}
|
|
345
|
-
onPointerLeave={() => setHovered(false)}
|
|
346
336
|
style={{
|
|
347
337
|
position: 'relative',
|
|
348
338
|
display: 'flex',
|
|
@@ -350,7 +340,7 @@ function AnchorIcon({ expanded, onToggle, onPointerDown, wasDragRef, pressed, ri
|
|
|
350
340
|
justifyContent: 'center',
|
|
351
341
|
flexShrink: 0,
|
|
352
342
|
cursor: 'pointer',
|
|
353
|
-
backgroundColor:
|
|
343
|
+
backgroundColor: 'rgba(63,63,70,0)',
|
|
354
344
|
borderRadius: '9999px',
|
|
355
345
|
border: 'none',
|
|
356
346
|
outline: 'none',
|
|
@@ -410,9 +400,7 @@ function AnchorIcon({ expanded, onToggle, onPointerDown, wasDragRef, pressed, ri
|
|
|
410
400
|
}
|
|
411
401
|
|
|
412
402
|
function DoneBtn({ onClick, disabled, capturing, copied, pressed, shake }: { onClick: () => void; disabled: boolean; capturing: boolean; copied: boolean; pressed: boolean; shake?: boolean }) {
|
|
413
|
-
const
|
|
414
|
-
const [active, setActive] = useState(false);
|
|
415
|
-
const isDown = (pressed || active) && !shake;
|
|
403
|
+
const isDown = pressed && !shake;
|
|
416
404
|
const anim = copied ? "copy-bounce 600ms ease-out" : shake ? "nope-shake 320ms ease-out" : undefined;
|
|
417
405
|
return (
|
|
418
406
|
<div style={{
|
|
@@ -426,10 +414,6 @@ function DoneBtn({ onClick, disabled, capturing, copied, pressed, shake }: { onC
|
|
|
426
414
|
tabIndex={-1}
|
|
427
415
|
data-penseat-btn
|
|
428
416
|
onClick={onClick}
|
|
429
|
-
onPointerEnter={() => setHovered(true)}
|
|
430
|
-
onPointerLeave={() => { setHovered(false); setActive(false); }}
|
|
431
|
-
onPointerDown={() => setActive(true)}
|
|
432
|
-
onPointerUp={() => setActive(false)}
|
|
433
417
|
disabled={disabled && !copied}
|
|
434
418
|
aria-label="Done"
|
|
435
419
|
style={{
|
|
@@ -446,8 +430,8 @@ function DoneBtn({ onClick, disabled, capturing, copied, pressed, shake }: { onC
|
|
|
446
430
|
outline: 'none',
|
|
447
431
|
padding: 0,
|
|
448
432
|
borderRadius: '6px',
|
|
449
|
-
backgroundColor:
|
|
450
|
-
color:
|
|
433
|
+
backgroundColor: isDown ? 'rgba(63,63,70,1)' : 'rgba(63,63,70,0)',
|
|
434
|
+
color: isDown ? '#f4f4f5' : '#a1a1aa',
|
|
451
435
|
opacity: (disabled && !copied) ? 0.5 : 1,
|
|
452
436
|
}}
|
|
453
437
|
>
|
|
@@ -515,6 +499,13 @@ function DoneBtn({ onClick, disabled, capturing, copied, pressed, shake }: { onC
|
|
|
515
499
|
[data-penseat-btn]:active {
|
|
516
500
|
transform: scale(0.9) !important;
|
|
517
501
|
}
|
|
502
|
+
[data-penseat-btn]:hover {
|
|
503
|
+
background-color: rgba(63,63,70,1) !important;
|
|
504
|
+
color: #f4f4f5 !important;
|
|
505
|
+
}
|
|
506
|
+
[data-penseat="trigger"]:hover {
|
|
507
|
+
background-color: rgba(63,63,70,1) !important;
|
|
508
|
+
}
|
|
518
509
|
`}</style>
|
|
519
510
|
)}
|
|
520
511
|
</div>
|