@scripso-homepad/ui 0.4.33 → 0.4.35
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/index.cjs +91 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +91 -61
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs +15 -4
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +3 -1
- package/dist/web/index.d.ts +3 -1
- package/dist/web/index.js +15 -4
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DatePicker.tsx +41 -6
- package/src/web/components/TableActionsMenu.tsx +20 -3
package/dist/index.cjs
CHANGED
|
@@ -3282,7 +3282,9 @@ function DatePicker(props) {
|
|
|
3282
3282
|
labelClassName,
|
|
3283
3283
|
errorClassName,
|
|
3284
3284
|
hintClassName,
|
|
3285
|
-
defaultOpen = false
|
|
3285
|
+
defaultOpen = false,
|
|
3286
|
+
open: controlledOpen,
|
|
3287
|
+
onOpenChange
|
|
3286
3288
|
} = props;
|
|
3287
3289
|
const mode = props.mode ?? "single";
|
|
3288
3290
|
const closeOnRangeComplete = props.mode === "range" ? props.closeOnRangeComplete ?? true : false;
|
|
@@ -3292,11 +3294,18 @@ function DatePicker(props) {
|
|
|
3292
3294
|
const wrapperRef = react.useRef(null);
|
|
3293
3295
|
const triggerRef = react.useRef(null);
|
|
3294
3296
|
const helperRef = react.useRef(null);
|
|
3295
|
-
const
|
|
3297
|
+
const isControlled = controlledOpen !== void 0;
|
|
3298
|
+
const [uncontrolledOpen, setUncontrolledOpen] = react.useState(defaultOpen);
|
|
3299
|
+
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
3296
3300
|
const [anchor, setAnchor] = react.useState(null);
|
|
3297
3301
|
useApplyWebClassName(wrapperRef, className);
|
|
3298
3302
|
useApplyWebClassName(triggerRef, fieldClassName);
|
|
3299
3303
|
useApplyWebClassName(helperRef, error ? errorClassName : hintClassName);
|
|
3304
|
+
react.useEffect(() => {
|
|
3305
|
+
if (!open) {
|
|
3306
|
+
setAnchor(null);
|
|
3307
|
+
}
|
|
3308
|
+
}, [open]);
|
|
3300
3309
|
react.useEffect(() => {
|
|
3301
3310
|
if (!defaultOpen || disabled) {
|
|
3302
3311
|
return;
|
|
@@ -3304,7 +3313,7 @@ function DatePicker(props) {
|
|
|
3304
3313
|
const frame = requestAnimationFrame(() => {
|
|
3305
3314
|
triggerRef.current?.measureInWindow((x, y, width, height) => {
|
|
3306
3315
|
setAnchor({ x, y, width, height });
|
|
3307
|
-
|
|
3316
|
+
setOpenState(true);
|
|
3308
3317
|
});
|
|
3309
3318
|
});
|
|
3310
3319
|
return () => cancelAnimationFrame(frame);
|
|
@@ -3341,8 +3350,14 @@ function DatePicker(props) {
|
|
|
3341
3350
|
const panelWidth = CALENDAR_PANEL_WIDTH;
|
|
3342
3351
|
const panelLeft = anchor ? isDesktopCalendar ? resolveCalendarDropdownLeft(anchor, panelWidth) : resolveCalendarDropdownLeftCentered(panelWidth) : 0;
|
|
3343
3352
|
const dropdownTop = anchor ? resolveCalendarDropdownTop(anchor) : 0;
|
|
3353
|
+
function setOpenState(next) {
|
|
3354
|
+
if (!isControlled) {
|
|
3355
|
+
setUncontrolledOpen(next);
|
|
3356
|
+
}
|
|
3357
|
+
onOpenChange?.(next);
|
|
3358
|
+
}
|
|
3344
3359
|
function closePicker() {
|
|
3345
|
-
|
|
3360
|
+
setOpenState(false);
|
|
3346
3361
|
setAnchor(null);
|
|
3347
3362
|
}
|
|
3348
3363
|
function openPicker() {
|
|
@@ -3351,7 +3366,7 @@ function DatePicker(props) {
|
|
|
3351
3366
|
}
|
|
3352
3367
|
triggerRef.current?.measureInWindow((x, y, width, height) => {
|
|
3353
3368
|
setAnchor({ x, y, width, height });
|
|
3354
|
-
|
|
3369
|
+
setOpenState(true);
|
|
3355
3370
|
});
|
|
3356
3371
|
}
|
|
3357
3372
|
const resolvedDefaultViewDate = defaultViewDate ?? (props.mode === "range" ? props.value?.start : props.value) ?? today;
|
|
@@ -3424,64 +3439,76 @@ function DatePicker(props) {
|
|
|
3424
3439
|
}
|
|
3425
3440
|
),
|
|
3426
3441
|
helperMessage ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { ref: helperRef, style: error ? styles8.error : styles8.hint, children: helperMessage }) : null,
|
|
3427
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
}
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
{
|
|
3440
|
-
style: [
|
|
3441
|
-
styles8.panelPosition,
|
|
3442
|
-
{
|
|
3443
|
-
top: dropdownTop,
|
|
3444
|
-
left: panelLeft,
|
|
3445
|
-
width: panelWidth,
|
|
3446
|
-
height: CALENDAR_PANEL_HEIGHT
|
|
3447
|
-
}
|
|
3448
|
-
],
|
|
3449
|
-
children: props.mode === "range" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3450
|
-
Calendar,
|
|
3442
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3443
|
+
reactNative.Modal,
|
|
3444
|
+
{
|
|
3445
|
+
visible: open,
|
|
3446
|
+
transparent: true,
|
|
3447
|
+
animationType: "fade",
|
|
3448
|
+
onRequestClose: closePicker,
|
|
3449
|
+
statusBarTranslucent: true,
|
|
3450
|
+
...reactNative.Platform.OS === "ios" ? { presentationStyle: "overFullScreen" } : null,
|
|
3451
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles8.modalRoot, children: [
|
|
3452
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3453
|
+
reactNative.Pressable,
|
|
3451
3454
|
{
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
defaultViewDate: resolvedDefaultViewDate,
|
|
3457
|
-
onViewDateChange,
|
|
3458
|
-
locale: resolvedLocale,
|
|
3459
|
-
labels,
|
|
3460
|
-
minDate,
|
|
3461
|
-
maxDate,
|
|
3462
|
-
today,
|
|
3463
|
-
className: panelClassName
|
|
3455
|
+
style: styles8.backdrop,
|
|
3456
|
+
onPress: closePicker,
|
|
3457
|
+
accessibilityRole: "button",
|
|
3458
|
+
accessibilityLabel: labels?.closeCalendar ?? translations.closeCalendar
|
|
3464
3459
|
}
|
|
3465
|
-
)
|
|
3466
|
-
|
|
3460
|
+
),
|
|
3461
|
+
anchor ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3462
|
+
reactNative.View,
|
|
3467
3463
|
{
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3464
|
+
pointerEvents: "box-none",
|
|
3465
|
+
style: [
|
|
3466
|
+
styles8.panelPosition,
|
|
3467
|
+
{
|
|
3468
|
+
top: dropdownTop,
|
|
3469
|
+
left: panelLeft,
|
|
3470
|
+
width: panelWidth,
|
|
3471
|
+
height: CALENDAR_PANEL_HEIGHT
|
|
3472
|
+
}
|
|
3473
|
+
],
|
|
3474
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { pointerEvents: "auto", children: props.mode === "range" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3475
|
+
Calendar,
|
|
3476
|
+
{
|
|
3477
|
+
mode: "range",
|
|
3478
|
+
value: props.value,
|
|
3479
|
+
onChange: handleRangeSelect,
|
|
3480
|
+
viewDate,
|
|
3481
|
+
defaultViewDate: resolvedDefaultViewDate,
|
|
3482
|
+
onViewDateChange,
|
|
3483
|
+
locale: resolvedLocale,
|
|
3484
|
+
labels,
|
|
3485
|
+
minDate,
|
|
3486
|
+
maxDate,
|
|
3487
|
+
today,
|
|
3488
|
+
className: panelClassName
|
|
3489
|
+
}
|
|
3490
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3491
|
+
Calendar,
|
|
3492
|
+
{
|
|
3493
|
+
mode: "single",
|
|
3494
|
+
value: props.value,
|
|
3495
|
+
onChange: handleSingleSelect,
|
|
3496
|
+
viewDate,
|
|
3497
|
+
defaultViewDate: resolvedDefaultViewDate,
|
|
3498
|
+
onViewDateChange,
|
|
3499
|
+
locale: resolvedLocale,
|
|
3500
|
+
labels,
|
|
3501
|
+
minDate,
|
|
3502
|
+
maxDate,
|
|
3503
|
+
today,
|
|
3504
|
+
className: panelClassName
|
|
3505
|
+
}
|
|
3506
|
+
) })
|
|
3480
3507
|
}
|
|
3481
|
-
)
|
|
3482
|
-
}
|
|
3483
|
-
|
|
3484
|
-
|
|
3508
|
+
) : null
|
|
3509
|
+
] })
|
|
3510
|
+
}
|
|
3511
|
+
)
|
|
3485
3512
|
]
|
|
3486
3513
|
}
|
|
3487
3514
|
);
|
|
@@ -3521,11 +3548,14 @@ var styles8 = reactNative.StyleSheet.create({
|
|
|
3521
3548
|
flexShrink: 0
|
|
3522
3549
|
},
|
|
3523
3550
|
modalRoot: {
|
|
3524
|
-
flex: 1
|
|
3551
|
+
flex: 1,
|
|
3552
|
+
width: "100%",
|
|
3553
|
+
height: "100%"
|
|
3525
3554
|
},
|
|
3526
3555
|
backdrop: {
|
|
3527
3556
|
...reactNative.StyleSheet.absoluteFillObject,
|
|
3528
|
-
backgroundColor:
|
|
3557
|
+
backgroundColor: "rgba(0, 0, 0, 0.35)",
|
|
3558
|
+
zIndex: 0
|
|
3529
3559
|
},
|
|
3530
3560
|
panelPosition: {
|
|
3531
3561
|
position: "absolute",
|