@rufous/ui 0.2.104 → 0.2.106
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/main.cjs +19 -19
- package/dist/main.css +14 -0
- package/dist/main.js +19 -19
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -3362,7 +3362,6 @@ var DateField = ({
|
|
|
3362
3362
|
const AMPMS = ["AM", "PM"];
|
|
3363
3363
|
const containerRef = (0, import_react21.useRef)(null);
|
|
3364
3364
|
const pickerRef = (0, import_react21.useRef)(null);
|
|
3365
|
-
const [dropUp, setDropUp] = (0, import_react21.useState)(false);
|
|
3366
3365
|
const inputId = (0, import_react21.useRef)(`rf-df-${Math.random().toString(36).substring(2, 11)}`).current;
|
|
3367
3366
|
const isInternalChange = (0, import_react21.useRef)(false);
|
|
3368
3367
|
(0, import_react21.useEffect)(() => {
|
|
@@ -3403,14 +3402,6 @@ var DateField = ({
|
|
|
3403
3402
|
document.addEventListener("mousedown", handler);
|
|
3404
3403
|
return () => document.removeEventListener("mousedown", handler);
|
|
3405
3404
|
}, [open]);
|
|
3406
|
-
(0, import_react21.useEffect)(() => {
|
|
3407
|
-
if (!open || !containerRef.current) return;
|
|
3408
|
-
const rect = containerRef.current.getBoundingClientRect();
|
|
3409
|
-
const PICKER_H = 420;
|
|
3410
|
-
const spaceBelow = window.innerHeight - rect.bottom;
|
|
3411
|
-
const spaceAbove = rect.top;
|
|
3412
|
-
setDropUp(spaceBelow < PICKER_H && spaceAbove > spaceBelow);
|
|
3413
|
-
}, [open]);
|
|
3414
3405
|
const commitDate = (0, import_react21.useCallback)((d, h, m, ap) => {
|
|
3415
3406
|
setSelectedDate(d);
|
|
3416
3407
|
if (!d) {
|
|
@@ -3615,28 +3606,37 @@ var DateField = ({
|
|
|
3615
3606
|
className: [
|
|
3616
3607
|
"rf-date-picker",
|
|
3617
3608
|
"rf-date-picker--portaled",
|
|
3618
|
-
isSideVariant ? "rf-date-picker--side" : ""
|
|
3619
|
-
dropUp ? "rf-date-picker--drop-up" : ""
|
|
3609
|
+
isSideVariant ? "rf-date-picker--side" : ""
|
|
3620
3610
|
].filter(Boolean).join(" "),
|
|
3621
3611
|
style: (() => {
|
|
3622
3612
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
3623
3613
|
if (!rect) return {};
|
|
3624
3614
|
const PICKER_H = 420;
|
|
3625
3615
|
const GAP2 = 6;
|
|
3626
|
-
const EDGE = 4;
|
|
3627
3616
|
const spaceBelow = window.innerHeight - rect.bottom - GAP2;
|
|
3628
3617
|
const spaceAbove = rect.top - GAP2;
|
|
3629
3618
|
const useDropUp = spaceBelow < PICKER_H && spaceAbove > spaceBelow;
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3619
|
+
if (useDropUp) {
|
|
3620
|
+
return {
|
|
3621
|
+
position: "fixed",
|
|
3622
|
+
left: rect.left,
|
|
3623
|
+
// bottom anchors picker's bottom edge exactly to field top — no gap regardless of actual height
|
|
3624
|
+
bottom: window.innerHeight - rect.top + GAP2,
|
|
3625
|
+
// prevent going above viewport
|
|
3626
|
+
maxHeight: rect.top - GAP2 - 4,
|
|
3627
|
+
overflowY: "auto",
|
|
3628
|
+
zIndex: 99999,
|
|
3629
|
+
animationName: "rf-date-picker-appear-up",
|
|
3630
|
+
transformOrigin: "bottom left"
|
|
3631
|
+
};
|
|
3632
|
+
}
|
|
3635
3633
|
return {
|
|
3636
3634
|
position: "fixed",
|
|
3637
3635
|
left: rect.left,
|
|
3638
|
-
top,
|
|
3639
|
-
zIndex: 99999
|
|
3636
|
+
top: rect.bottom + GAP2,
|
|
3637
|
+
zIndex: 99999,
|
|
3638
|
+
animationName: "rf-date-picker-appear",
|
|
3639
|
+
transformOrigin: "top left"
|
|
3640
3640
|
};
|
|
3641
3641
|
})(),
|
|
3642
3642
|
onMouseDown: (e) => e.preventDefault()
|
package/dist/main.css
CHANGED
|
@@ -1259,6 +1259,20 @@ pre {
|
|
|
1259
1259
|
transform: scale(1) translateY(0);
|
|
1260
1260
|
}
|
|
1261
1261
|
}
|
|
1262
|
+
@keyframes rf-date-picker-appear-up {
|
|
1263
|
+
from {
|
|
1264
|
+
opacity: 0;
|
|
1265
|
+
transform: scale(0.94) translateY(4px);
|
|
1266
|
+
}
|
|
1267
|
+
to {
|
|
1268
|
+
opacity: 1;
|
|
1269
|
+
transform: scale(1) translateY(0);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
.rf-date-picker--drop-up {
|
|
1273
|
+
animation-name: rf-date-picker-appear-up;
|
|
1274
|
+
transform-origin: bottom left;
|
|
1275
|
+
}
|
|
1262
1276
|
.rf-date-picker__header {
|
|
1263
1277
|
display: flex;
|
|
1264
1278
|
align-items: center;
|
package/dist/main.js
CHANGED
|
@@ -3213,7 +3213,6 @@ var DateField = ({
|
|
|
3213
3213
|
const AMPMS = ["AM", "PM"];
|
|
3214
3214
|
const containerRef = useRef6(null);
|
|
3215
3215
|
const pickerRef = useRef6(null);
|
|
3216
|
-
const [dropUp, setDropUp] = useState7(false);
|
|
3217
3216
|
const inputId = useRef6(`rf-df-${Math.random().toString(36).substring(2, 11)}`).current;
|
|
3218
3217
|
const isInternalChange = useRef6(false);
|
|
3219
3218
|
useEffect7(() => {
|
|
@@ -3254,14 +3253,6 @@ var DateField = ({
|
|
|
3254
3253
|
document.addEventListener("mousedown", handler);
|
|
3255
3254
|
return () => document.removeEventListener("mousedown", handler);
|
|
3256
3255
|
}, [open]);
|
|
3257
|
-
useEffect7(() => {
|
|
3258
|
-
if (!open || !containerRef.current) return;
|
|
3259
|
-
const rect = containerRef.current.getBoundingClientRect();
|
|
3260
|
-
const PICKER_H = 420;
|
|
3261
|
-
const spaceBelow = window.innerHeight - rect.bottom;
|
|
3262
|
-
const spaceAbove = rect.top;
|
|
3263
|
-
setDropUp(spaceBelow < PICKER_H && spaceAbove > spaceBelow);
|
|
3264
|
-
}, [open]);
|
|
3265
3256
|
const commitDate = useCallback3((d, h, m, ap) => {
|
|
3266
3257
|
setSelectedDate(d);
|
|
3267
3258
|
if (!d) {
|
|
@@ -3466,28 +3457,37 @@ var DateField = ({
|
|
|
3466
3457
|
className: [
|
|
3467
3458
|
"rf-date-picker",
|
|
3468
3459
|
"rf-date-picker--portaled",
|
|
3469
|
-
isSideVariant ? "rf-date-picker--side" : ""
|
|
3470
|
-
dropUp ? "rf-date-picker--drop-up" : ""
|
|
3460
|
+
isSideVariant ? "rf-date-picker--side" : ""
|
|
3471
3461
|
].filter(Boolean).join(" "),
|
|
3472
3462
|
style: (() => {
|
|
3473
3463
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
3474
3464
|
if (!rect) return {};
|
|
3475
3465
|
const PICKER_H = 420;
|
|
3476
3466
|
const GAP2 = 6;
|
|
3477
|
-
const EDGE = 4;
|
|
3478
3467
|
const spaceBelow = window.innerHeight - rect.bottom - GAP2;
|
|
3479
3468
|
const spaceAbove = rect.top - GAP2;
|
|
3480
3469
|
const useDropUp = spaceBelow < PICKER_H && spaceAbove > spaceBelow;
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3470
|
+
if (useDropUp) {
|
|
3471
|
+
return {
|
|
3472
|
+
position: "fixed",
|
|
3473
|
+
left: rect.left,
|
|
3474
|
+
// bottom anchors picker's bottom edge exactly to field top — no gap regardless of actual height
|
|
3475
|
+
bottom: window.innerHeight - rect.top + GAP2,
|
|
3476
|
+
// prevent going above viewport
|
|
3477
|
+
maxHeight: rect.top - GAP2 - 4,
|
|
3478
|
+
overflowY: "auto",
|
|
3479
|
+
zIndex: 99999,
|
|
3480
|
+
animationName: "rf-date-picker-appear-up",
|
|
3481
|
+
transformOrigin: "bottom left"
|
|
3482
|
+
};
|
|
3483
|
+
}
|
|
3486
3484
|
return {
|
|
3487
3485
|
position: "fixed",
|
|
3488
3486
|
left: rect.left,
|
|
3489
|
-
top,
|
|
3490
|
-
zIndex: 99999
|
|
3487
|
+
top: rect.bottom + GAP2,
|
|
3488
|
+
zIndex: 99999,
|
|
3489
|
+
animationName: "rf-date-picker-appear",
|
|
3490
|
+
transformOrigin: "top left"
|
|
3491
3491
|
};
|
|
3492
3492
|
})(),
|
|
3493
3493
|
onMouseDown: (e) => e.preventDefault()
|