rockin 0.0.13 → 0.0.14
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/ui/index.d.ts +7 -2
- package/dist/ui/index.js +288 -197
- package/package.json +1 -1
package/dist/ui/index.d.ts
CHANGED
|
@@ -788,7 +788,7 @@ declare function RollingNumber({ value, format, className, }: {
|
|
|
788
788
|
format?: (value: number) => string;
|
|
789
789
|
className?: string;
|
|
790
790
|
}): React$1.JSX.Element;
|
|
791
|
-
|
|
791
|
+
type NumberStepperProps = {
|
|
792
792
|
label: string;
|
|
793
793
|
value: number;
|
|
794
794
|
onChange: (value: number) => void;
|
|
@@ -797,7 +797,12 @@ declare function NumberStepper({ label, value, onChange, min, max, step, classNa
|
|
|
797
797
|
step?: number;
|
|
798
798
|
className?: string;
|
|
799
799
|
size?: keyof typeof sizeStyles;
|
|
800
|
-
|
|
800
|
+
disabled?: boolean;
|
|
801
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
802
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
803
|
+
onKeyDownCapture?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
804
|
+
};
|
|
805
|
+
declare const NumberStepper: React$1.ForwardRefExoticComponent<NumberStepperProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
801
806
|
|
|
802
807
|
declare const EASE_OUT: readonly [0.16, 1, 0.3, 1];
|
|
803
808
|
declare const EASE_IN_OUT: readonly [0.77, 0, 0.175, 1];
|
package/dist/ui/index.js
CHANGED
|
@@ -6437,7 +6437,14 @@ function MessageScrollerButton({
|
|
|
6437
6437
|
// src/ui/numberstepper.tsx
|
|
6438
6438
|
import { cn as cn41 } from "cn";
|
|
6439
6439
|
import { AnimatePresence as AnimatePresence2, motion as motion6, useReducedMotion } from "motion/react";
|
|
6440
|
-
import {
|
|
6440
|
+
import {
|
|
6441
|
+
forwardRef as forwardRef3,
|
|
6442
|
+
useEffect as useEffect6,
|
|
6443
|
+
useId as useId3,
|
|
6444
|
+
useLayoutEffect,
|
|
6445
|
+
useRef as useRef4,
|
|
6446
|
+
useState as useState8
|
|
6447
|
+
} from "react";
|
|
6441
6448
|
import { jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6442
6449
|
var EASE_OUT = [0.23, 1, 0.32, 1];
|
|
6443
6450
|
var ROLL = { duration: 0.18, ease: EASE_OUT };
|
|
@@ -6447,10 +6454,34 @@ var FIRST_REPEAT = 150;
|
|
|
6447
6454
|
var ACCELERATION = 0.85;
|
|
6448
6455
|
var FASTEST = 40;
|
|
6449
6456
|
var sizeStyles = {
|
|
6450
|
-
xs: {
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6457
|
+
xs: {
|
|
6458
|
+
container: "h-6 p-0.5",
|
|
6459
|
+
button: "size-5",
|
|
6460
|
+
value: "w-6",
|
|
6461
|
+
text: "text-xs",
|
|
6462
|
+
icon: "size-3"
|
|
6463
|
+
},
|
|
6464
|
+
sm: {
|
|
6465
|
+
container: "h-7 p-0.5",
|
|
6466
|
+
button: "size-6",
|
|
6467
|
+
value: "w-7",
|
|
6468
|
+
text: "text-sm",
|
|
6469
|
+
icon: "size-3.5"
|
|
6470
|
+
},
|
|
6471
|
+
default: {
|
|
6472
|
+
container: "h-8 p-0.5",
|
|
6473
|
+
button: "size-7",
|
|
6474
|
+
value: "w-9",
|
|
6475
|
+
text: "text-sm",
|
|
6476
|
+
icon: "size-3.5"
|
|
6477
|
+
},
|
|
6478
|
+
lg: {
|
|
6479
|
+
container: "h-9 p-1",
|
|
6480
|
+
button: "size-8",
|
|
6481
|
+
value: "w-11",
|
|
6482
|
+
text: "text-[15px]",
|
|
6483
|
+
icon: "size-4"
|
|
6484
|
+
}
|
|
6454
6485
|
};
|
|
6455
6486
|
function useDirection(value) {
|
|
6456
6487
|
const [previous, setPrevious] = useState8(value);
|
|
@@ -6473,8 +6504,8 @@ function RollingNumber({
|
|
|
6473
6504
|
{
|
|
6474
6505
|
"aria-hidden": true,
|
|
6475
6506
|
className: cn41("relative inline-flex tabular-nums", className),
|
|
6476
|
-
children: /* @__PURE__ */ jsx42(AnimatePresence2, { mode: "popLayout", initial: false, custom: direction, children: chars.map((char,
|
|
6477
|
-
const place = chars.length -
|
|
6507
|
+
children: /* @__PURE__ */ jsx42(AnimatePresence2, { mode: "popLayout", initial: false, custom: direction, children: chars.map((char, index) => {
|
|
6508
|
+
const place = chars.length - index;
|
|
6478
6509
|
const digit = /\d/.test(char);
|
|
6479
6510
|
return /* @__PURE__ */ jsx42(Place, { digit, children: digit ? /* @__PURE__ */ jsx42(Digit, { char, direction }) : char }, digit ? `d${place}` : `s${place}${char}`);
|
|
6480
6511
|
}) })
|
|
@@ -6492,7 +6523,11 @@ function Place({
|
|
|
6492
6523
|
layout: reduceMotion ? false : "position",
|
|
6493
6524
|
initial: { opacity: 0, filter: "blur(4px)" },
|
|
6494
6525
|
animate: { opacity: 1, filter: "blur(0px)" },
|
|
6495
|
-
exit: {
|
|
6526
|
+
exit: {
|
|
6527
|
+
opacity: 0,
|
|
6528
|
+
filter: "blur(0px)",
|
|
6529
|
+
transition: { duration: 0.1 }
|
|
6530
|
+
},
|
|
6496
6531
|
transition: { ...ROLL, layout: SLIDE },
|
|
6497
6532
|
className: cn41("inline-grid", digit && "overflow-hidden"),
|
|
6498
6533
|
children
|
|
@@ -6501,15 +6536,24 @@ function Place({
|
|
|
6501
6536
|
}
|
|
6502
6537
|
function Digit({ char, direction }) {
|
|
6503
6538
|
const reduceMotion = useReducedMotion();
|
|
6504
|
-
const offset = (
|
|
6539
|
+
const offset = (value) => reduceMotion ? "0%" : `${value * 100}%`;
|
|
6505
6540
|
return /* @__PURE__ */ jsx42(AnimatePresence2, { initial: false, custom: direction, children: /* @__PURE__ */ jsx42(
|
|
6506
6541
|
motion6.span,
|
|
6507
6542
|
{
|
|
6508
6543
|
custom: direction,
|
|
6509
6544
|
variants: {
|
|
6510
|
-
enter: (
|
|
6511
|
-
|
|
6512
|
-
|
|
6545
|
+
enter: (value) => ({
|
|
6546
|
+
y: offset(value),
|
|
6547
|
+
opacity: 0
|
|
6548
|
+
}),
|
|
6549
|
+
center: {
|
|
6550
|
+
y: "0%",
|
|
6551
|
+
opacity: 1
|
|
6552
|
+
},
|
|
6553
|
+
exit: (value) => ({
|
|
6554
|
+
y: offset(-value),
|
|
6555
|
+
opacity: 0
|
|
6556
|
+
})
|
|
6513
6557
|
},
|
|
6514
6558
|
initial: "enter",
|
|
6515
6559
|
animate: "center",
|
|
@@ -6521,195 +6565,242 @@ function Digit({ char, direction }) {
|
|
|
6521
6565
|
char
|
|
6522
6566
|
) });
|
|
6523
6567
|
}
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
latest.current = { ...now, value: next };
|
|
6566
|
-
now.onChange(next);
|
|
6567
|
-
return true;
|
|
6568
|
-
};
|
|
6569
|
-
const stepBy = (delta) => setTo(latest.current.value + delta, delta > 0 ? 1 : -1);
|
|
6570
|
-
const stop = () => clearTimeout(timer.current);
|
|
6571
|
-
const hold = (delta) => {
|
|
6572
|
-
stop();
|
|
6573
|
-
if (!stepBy(delta)) return;
|
|
6574
|
-
let interval = FIRST_REPEAT;
|
|
6575
|
-
const repeat = () => {
|
|
6576
|
-
if (!stepBy(delta)) return;
|
|
6577
|
-
interval = Math.max(FASTEST, interval * ACCELERATION);
|
|
6578
|
-
timer.current = setTimeout(repeat, interval);
|
|
6579
|
-
};
|
|
6580
|
-
timer.current = setTimeout(repeat, HOLD_DELAY);
|
|
6581
|
-
};
|
|
6582
|
-
const commitDraft = () => {
|
|
6583
|
-
if (draft === null) return;
|
|
6584
|
-
const parsed = Number.parseInt(draft, 10);
|
|
6585
|
-
setDraft(null);
|
|
6586
|
-
if (Number.isNaN(parsed)) return;
|
|
6587
|
-
setTo(parsed, parsed > value ? 1 : -1);
|
|
6588
|
-
};
|
|
6589
|
-
const button = (delta, atLimit, name, path) => /* @__PURE__ */ jsx42(
|
|
6590
|
-
"button",
|
|
6591
|
-
{
|
|
6592
|
-
type: "button",
|
|
6593
|
-
"aria-label": `${name} ${label.toLowerCase()}`,
|
|
6594
|
-
"aria-controls": id,
|
|
6595
|
-
"aria-disabled": atLimit,
|
|
6596
|
-
tabIndex: -1,
|
|
6597
|
-
onPointerDown: (e) => {
|
|
6598
|
-
if (e.button !== 0) return;
|
|
6599
|
-
e.preventDefault();
|
|
6600
|
-
hold(delta);
|
|
6601
|
-
},
|
|
6602
|
-
onPointerUp: stop,
|
|
6603
|
-
onPointerLeave: stop,
|
|
6604
|
-
onPointerCancel: stop,
|
|
6605
|
-
onContextMenu: (e) => e.preventDefault(),
|
|
6606
|
-
onClick: (e) => {
|
|
6607
|
-
if (e.detail === 0) stepBy(delta);
|
|
6568
|
+
var NumberStepper = forwardRef3(
|
|
6569
|
+
function NumberStepper2({
|
|
6570
|
+
label,
|
|
6571
|
+
value,
|
|
6572
|
+
onChange,
|
|
6573
|
+
min = 0,
|
|
6574
|
+
max = 99,
|
|
6575
|
+
step = 1,
|
|
6576
|
+
className,
|
|
6577
|
+
size = "default",
|
|
6578
|
+
disabled = false,
|
|
6579
|
+
onFocus,
|
|
6580
|
+
onKeyDown,
|
|
6581
|
+
onKeyDownCapture
|
|
6582
|
+
}, ref) {
|
|
6583
|
+
const reduceMotion = useReducedMotion();
|
|
6584
|
+
const id = useId3();
|
|
6585
|
+
const [draft, setDraft] = useState8(null);
|
|
6586
|
+
const valueRef = useRef4(null);
|
|
6587
|
+
const bumpAnimation = useRef4(void 0);
|
|
6588
|
+
const timer = useRef4(void 0);
|
|
6589
|
+
const latest = useRef4({
|
|
6590
|
+
value,
|
|
6591
|
+
onChange,
|
|
6592
|
+
min,
|
|
6593
|
+
max,
|
|
6594
|
+
disabled
|
|
6595
|
+
});
|
|
6596
|
+
useLayoutEffect(() => {
|
|
6597
|
+
latest.current = {
|
|
6598
|
+
value,
|
|
6599
|
+
onChange,
|
|
6600
|
+
min,
|
|
6601
|
+
max,
|
|
6602
|
+
disabled
|
|
6603
|
+
};
|
|
6604
|
+
});
|
|
6605
|
+
useEffect6(
|
|
6606
|
+
() => () => {
|
|
6607
|
+
clearTimeout(timer.current);
|
|
6608
|
+
bumpAnimation.current?.cancel();
|
|
6608
6609
|
},
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
)
|
|
6615
|
-
|
|
6616
|
-
"svg",
|
|
6610
|
+
[]
|
|
6611
|
+
);
|
|
6612
|
+
const bump = (direction) => {
|
|
6613
|
+
const element = valueRef.current;
|
|
6614
|
+
if (!element || reduceMotion) return;
|
|
6615
|
+
bumpAnimation.current?.cancel();
|
|
6616
|
+
bumpAnimation.current = element.animate(
|
|
6617
6617
|
{
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
strokeWidth: 1.5,
|
|
6624
|
-
strokeLinecap: "round",
|
|
6625
|
-
children: /* @__PURE__ */ jsx42("path", { d: path })
|
|
6618
|
+
translate: ["0", `${direction * 3}px`, "0"]
|
|
6619
|
+
},
|
|
6620
|
+
{
|
|
6621
|
+
duration: 200,
|
|
6622
|
+
easing: "cubic-bezier(0.23, 1, 0.32, 1)"
|
|
6626
6623
|
}
|
|
6627
|
-
)
|
|
6628
|
-
}
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6624
|
+
);
|
|
6625
|
+
};
|
|
6626
|
+
const setTo = (target, direction) => {
|
|
6627
|
+
const current = latest.current;
|
|
6628
|
+
if (current.disabled) return false;
|
|
6629
|
+
const next = Math.min(Math.max(target, current.min), current.max);
|
|
6630
|
+
if (next !== target) {
|
|
6631
|
+
bump(direction);
|
|
6632
|
+
}
|
|
6633
|
+
if (next === current.value) return false;
|
|
6634
|
+
latest.current = {
|
|
6635
|
+
...current,
|
|
6636
|
+
value: next
|
|
6637
|
+
};
|
|
6638
|
+
current.onChange(next);
|
|
6639
|
+
return true;
|
|
6640
|
+
};
|
|
6641
|
+
const stepBy = (delta) => setTo(latest.current.value + delta, delta > 0 ? 1 : -1);
|
|
6642
|
+
const stop = () => {
|
|
6643
|
+
clearTimeout(timer.current);
|
|
6644
|
+
};
|
|
6645
|
+
const hold = (delta) => {
|
|
6646
|
+
if (disabled) return;
|
|
6647
|
+
stop();
|
|
6648
|
+
if (!stepBy(delta)) return;
|
|
6649
|
+
let interval = FIRST_REPEAT;
|
|
6650
|
+
const repeat = () => {
|
|
6651
|
+
if (!stepBy(delta)) return;
|
|
6652
|
+
interval = Math.max(FASTEST, interval * ACCELERATION);
|
|
6653
|
+
timer.current = setTimeout(repeat, interval);
|
|
6654
|
+
};
|
|
6655
|
+
timer.current = setTimeout(repeat, HOLD_DELAY);
|
|
6656
|
+
};
|
|
6657
|
+
const commitDraft = () => {
|
|
6658
|
+
if (draft === null) return;
|
|
6659
|
+
const parsed = Number.parseInt(draft, 10);
|
|
6660
|
+
setDraft(null);
|
|
6661
|
+
if (Number.isNaN(parsed)) return;
|
|
6662
|
+
setTo(parsed, parsed > latest.current.value ? 1 : -1);
|
|
6663
|
+
};
|
|
6664
|
+
const button = (delta, atLimit, name, path) => /* @__PURE__ */ jsx42(
|
|
6665
|
+
"button",
|
|
6666
|
+
{
|
|
6667
|
+
type: "button",
|
|
6668
|
+
disabled: disabled || atLimit,
|
|
6669
|
+
"aria-label": `${name} ${label.toLowerCase()}`,
|
|
6670
|
+
"aria-controls": id,
|
|
6671
|
+
"aria-disabled": disabled || atLimit,
|
|
6672
|
+
tabIndex: -1,
|
|
6673
|
+
onPointerDown: (event) => {
|
|
6674
|
+
if (event.button !== 0 || disabled) return;
|
|
6675
|
+
event.preventDefault();
|
|
6676
|
+
hold(delta);
|
|
6677
|
+
},
|
|
6678
|
+
onPointerUp: stop,
|
|
6679
|
+
onPointerLeave: stop,
|
|
6680
|
+
onPointerCancel: stop,
|
|
6681
|
+
onContextMenu: (event) => event.preventDefault(),
|
|
6682
|
+
onClick: (event) => {
|
|
6683
|
+
if (disabled) return;
|
|
6684
|
+
if (event.detail === 0) {
|
|
6685
|
+
stepBy(delta);
|
|
6686
|
+
}
|
|
6687
|
+
},
|
|
6688
|
+
className: cn41(
|
|
6689
|
+
"flex shrink-0 touch-manipulation items-center justify-center rounded-full text-foreground outline-hidden select-none",
|
|
6690
|
+
styles.button,
|
|
6691
|
+
"transition-[scale,opacity,background-color] duration-150 ease-out hover:bg-foreground/6 active:scale-[0.96] motion-reduce:transition-[opacity,background-color]",
|
|
6692
|
+
(disabled || atLimit) && "opacity-35 hover:bg-transparent"
|
|
6693
|
+
),
|
|
6694
|
+
children: /* @__PURE__ */ jsx42(
|
|
6695
|
+
"svg",
|
|
6644
6696
|
{
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
{
|
|
6654
|
-
id,
|
|
6655
|
-
"data-no-ring": true,
|
|
6656
|
-
role: "spinbutton",
|
|
6657
|
-
"aria-label": label,
|
|
6658
|
-
"aria-valuenow": value,
|
|
6659
|
-
"aria-valuemin": min,
|
|
6660
|
-
"aria-valuemax": max,
|
|
6661
|
-
inputMode: "numeric",
|
|
6662
|
-
autoComplete: "off",
|
|
6663
|
-
value: draft ?? String(value),
|
|
6664
|
-
onChange: (e) => setDraft(e.target.value.replace(/\D/g, "")),
|
|
6665
|
-
onFocus: (e) => e.currentTarget.select(),
|
|
6666
|
-
onBlur: commitDraft,
|
|
6667
|
-
onKeyDown: (e) => {
|
|
6668
|
-
const delta = {
|
|
6669
|
-
ArrowUp: step,
|
|
6670
|
-
ArrowDown: -step,
|
|
6671
|
-
PageUp: step * 10,
|
|
6672
|
-
PageDown: -step * 10
|
|
6673
|
-
};
|
|
6674
|
-
if (e.key in delta) {
|
|
6675
|
-
e.preventDefault();
|
|
6676
|
-
setDraft(null);
|
|
6677
|
-
stepBy(delta[e.key]);
|
|
6678
|
-
} else if (e.key === "Home" || e.key === "End") {
|
|
6679
|
-
e.preventDefault();
|
|
6680
|
-
setDraft(null);
|
|
6681
|
-
setTo(e.key === "Home" ? min : max, e.key === "Home" ? -1 : 1);
|
|
6682
|
-
} else if (e.key === "Enter") {
|
|
6683
|
-
commitDraft();
|
|
6684
|
-
} else if (e.key === "Escape") {
|
|
6685
|
-
setDraft(null);
|
|
6686
|
-
}
|
|
6687
|
-
},
|
|
6688
|
-
className: cn41(
|
|
6689
|
-
"col-start-1 row-start-1 w-full bg-transparent text-center font-medium tabular-nums caret-foreground outline-hidden",
|
|
6690
|
-
styles.text,
|
|
6691
|
-
editing ? "text-foreground" : "text-transparent"
|
|
6692
|
-
)
|
|
6693
|
-
}
|
|
6694
|
-
),
|
|
6695
|
-
!editing && /* @__PURE__ */ jsx42(
|
|
6696
|
-
RollingNumber,
|
|
6697
|
-
{
|
|
6698
|
-
value,
|
|
6699
|
-
className: cn41(
|
|
6700
|
-
"pointer-events-none col-start-1 row-start-1 font-medium text-foreground",
|
|
6701
|
-
styles.text
|
|
6702
|
-
)
|
|
6703
|
-
}
|
|
6704
|
-
)
|
|
6705
|
-
]
|
|
6697
|
+
viewBox: "0 0 16 16",
|
|
6698
|
+
"aria-hidden": true,
|
|
6699
|
+
className: styles.icon,
|
|
6700
|
+
fill: "none",
|
|
6701
|
+
stroke: "currentColor",
|
|
6702
|
+
strokeWidth: 1.5,
|
|
6703
|
+
strokeLinecap: "round",
|
|
6704
|
+
children: /* @__PURE__ */ jsx42("path", { d: path })
|
|
6706
6705
|
}
|
|
6706
|
+
)
|
|
6707
|
+
}
|
|
6708
|
+
);
|
|
6709
|
+
const editing = draft !== null;
|
|
6710
|
+
const styles = sizeStyles[size];
|
|
6711
|
+
return /* @__PURE__ */ jsxs24(
|
|
6712
|
+
"div",
|
|
6713
|
+
{
|
|
6714
|
+
className: cn41(
|
|
6715
|
+
"shadow-raised inline-flex items-center rounded-full border",
|
|
6716
|
+
disabled && "opacity-50",
|
|
6717
|
+
styles.container,
|
|
6718
|
+
className
|
|
6707
6719
|
),
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6720
|
+
children: [
|
|
6721
|
+
button(-step, value <= min, "Decrease", "M3.5 8h9"),
|
|
6722
|
+
/* @__PURE__ */ jsxs24(
|
|
6723
|
+
"span",
|
|
6724
|
+
{
|
|
6725
|
+
ref: valueRef,
|
|
6726
|
+
className: cn41("relative grid place-items-center", styles.value),
|
|
6727
|
+
children: [
|
|
6728
|
+
/* @__PURE__ */ jsx42(
|
|
6729
|
+
"input",
|
|
6730
|
+
{
|
|
6731
|
+
ref,
|
|
6732
|
+
id,
|
|
6733
|
+
disabled,
|
|
6734
|
+
"data-no-ring": true,
|
|
6735
|
+
role: "spinbutton",
|
|
6736
|
+
"aria-label": label,
|
|
6737
|
+
"aria-valuenow": value,
|
|
6738
|
+
"aria-valuemin": min,
|
|
6739
|
+
"aria-valuemax": max,
|
|
6740
|
+
inputMode: "numeric",
|
|
6741
|
+
autoComplete: "off",
|
|
6742
|
+
value: draft ?? String(value),
|
|
6743
|
+
onChange: (event) => {
|
|
6744
|
+
setDraft(event.target.value.replace(/\D/g, ""));
|
|
6745
|
+
},
|
|
6746
|
+
onFocus: (event) => {
|
|
6747
|
+
event.currentTarget.select();
|
|
6748
|
+
onFocus?.(event);
|
|
6749
|
+
},
|
|
6750
|
+
onBlur: commitDraft,
|
|
6751
|
+
onKeyDownCapture,
|
|
6752
|
+
onKeyDown: (event) => {
|
|
6753
|
+
onKeyDown?.(event);
|
|
6754
|
+
if (event.defaultPrevented) return;
|
|
6755
|
+
const delta = {
|
|
6756
|
+
ArrowUp: step,
|
|
6757
|
+
ArrowDown: -step,
|
|
6758
|
+
PageUp: step * 10,
|
|
6759
|
+
PageDown: -step * 10
|
|
6760
|
+
};
|
|
6761
|
+
if (event.key in delta) {
|
|
6762
|
+
event.preventDefault();
|
|
6763
|
+
setDraft(null);
|
|
6764
|
+
stepBy(delta[event.key]);
|
|
6765
|
+
} else if (event.key === "Home" || event.key === "End") {
|
|
6766
|
+
event.preventDefault();
|
|
6767
|
+
setDraft(null);
|
|
6768
|
+
setTo(
|
|
6769
|
+
event.key === "Home" ? min : max,
|
|
6770
|
+
event.key === "Home" ? -1 : 1
|
|
6771
|
+
);
|
|
6772
|
+
} else if (event.key === "Enter") {
|
|
6773
|
+
commitDraft();
|
|
6774
|
+
} else if (event.key === "Escape") {
|
|
6775
|
+
setDraft(null);
|
|
6776
|
+
}
|
|
6777
|
+
},
|
|
6778
|
+
className: cn41(
|
|
6779
|
+
"col-start-1 row-start-1 w-full bg-transparent text-center font-medium tabular-nums caret-foreground outline-hidden",
|
|
6780
|
+
styles.text,
|
|
6781
|
+
editing ? "text-foreground" : "text-transparent"
|
|
6782
|
+
)
|
|
6783
|
+
}
|
|
6784
|
+
),
|
|
6785
|
+
!editing && /* @__PURE__ */ jsx42(
|
|
6786
|
+
RollingNumber,
|
|
6787
|
+
{
|
|
6788
|
+
value,
|
|
6789
|
+
className: cn41(
|
|
6790
|
+
"pointer-events-none col-start-1 row-start-1 font-medium text-foreground",
|
|
6791
|
+
styles.text
|
|
6792
|
+
)
|
|
6793
|
+
}
|
|
6794
|
+
)
|
|
6795
|
+
]
|
|
6796
|
+
}
|
|
6797
|
+
),
|
|
6798
|
+
button(step, value >= max, "Increase", "M3.5 8h9M8 3.5v9")
|
|
6799
|
+
]
|
|
6800
|
+
}
|
|
6801
|
+
);
|
|
6802
|
+
}
|
|
6803
|
+
);
|
|
6713
6804
|
|
|
6714
6805
|
// src/ui/otp.tsx
|
|
6715
6806
|
import { cn as cn42 } from "cn";
|
|
@@ -7482,7 +7573,7 @@ function SelectScrollDownButton({
|
|
|
7482
7573
|
|
|
7483
7574
|
// src/ui/skeleton.tsx
|
|
7484
7575
|
import {
|
|
7485
|
-
forwardRef as
|
|
7576
|
+
forwardRef as forwardRef5,
|
|
7486
7577
|
useLayoutEffect as useLayoutEffect2
|
|
7487
7578
|
} from "react";
|
|
7488
7579
|
import { cn as cn47 } from "cn";
|
|
@@ -7584,7 +7675,7 @@ function resolveSkeletonA11yProps({
|
|
|
7584
7675
|
role: "status"
|
|
7585
7676
|
};
|
|
7586
7677
|
}
|
|
7587
|
-
var Skeleton =
|
|
7678
|
+
var Skeleton = forwardRef5(function Skeleton2({
|
|
7588
7679
|
animate: animate2 = true,
|
|
7589
7680
|
className,
|
|
7590
7681
|
decorative = true,
|