@chekinapp/ui 0.0.91 → 0.0.93
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 +1128 -636
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +133 -12
- package/dist/index.d.ts +133 -12
- package/dist/index.js +1159 -660
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -203,6 +203,7 @@ __export(index_exports, {
|
|
|
203
203
|
LegacyTextarea: () => LegacyTextarea,
|
|
204
204
|
Link: () => Link,
|
|
205
205
|
LoadingBar: () => LoadingBar,
|
|
206
|
+
MobileWebcam: () => MobileWebcam,
|
|
206
207
|
Modal: () => Modal,
|
|
207
208
|
ModalButton: () => ModalButton,
|
|
208
209
|
ModalLoader: () => ModalLoader,
|
|
@@ -2105,6 +2106,25 @@ function toCssSize(size) {
|
|
|
2105
2106
|
return size;
|
|
2106
2107
|
}
|
|
2107
2108
|
}
|
|
2109
|
+
function getCanvasBlob(canvas) {
|
|
2110
|
+
return new Promise((resolve) => {
|
|
2111
|
+
canvas.toBlob((blob) => {
|
|
2112
|
+
resolve(blob);
|
|
2113
|
+
});
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
function toBase64(file) {
|
|
2117
|
+
return new Promise((resolve, reject) => {
|
|
2118
|
+
const reader = new FileReader();
|
|
2119
|
+
reader.readAsDataURL(file);
|
|
2120
|
+
reader.onload = () => resolve(String(reader.result));
|
|
2121
|
+
reader.onerror = () => reject(new Error("Failed to read file as base64"));
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
2124
|
+
function getFileSizeMB(file) {
|
|
2125
|
+
if (!file) return;
|
|
2126
|
+
return file.size / Math.pow(1024, 2);
|
|
2127
|
+
}
|
|
2108
2128
|
|
|
2109
2129
|
// src/tooltip/Tooltip.tsx
|
|
2110
2130
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -3035,7 +3055,7 @@ function useCombinedRef(...refs) {
|
|
|
3035
3055
|
var import_react15 = require("react");
|
|
3036
3056
|
var MOBILE_BREAKPOINT = 768;
|
|
3037
3057
|
function useIsMobile({ breakpoint = MOBILE_BREAKPOINT } = {}) {
|
|
3038
|
-
const [
|
|
3058
|
+
const [isMobile3, setIsMobile] = (0, import_react15.useState)(void 0);
|
|
3039
3059
|
(0, import_react15.useEffect)(() => {
|
|
3040
3060
|
const mediaQuery = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
3041
3061
|
const onChange = () => {
|
|
@@ -3047,7 +3067,7 @@ function useIsMobile({ breakpoint = MOBILE_BREAKPOINT } = {}) {
|
|
|
3047
3067
|
mediaQuery.removeEventListener("change", onChange);
|
|
3048
3068
|
};
|
|
3049
3069
|
}, [breakpoint]);
|
|
3050
|
-
return !!
|
|
3070
|
+
return !!isMobile3;
|
|
3051
3071
|
}
|
|
3052
3072
|
|
|
3053
3073
|
// src/hooks/use-is-mounted.ts
|
|
@@ -3195,7 +3215,11 @@ function useModalWithHistoryControls({
|
|
|
3195
3215
|
}, [resetHash]);
|
|
3196
3216
|
const toggleModal = (0, import_react20.useCallback)(() => {
|
|
3197
3217
|
setIsOpen(!isOpen);
|
|
3198
|
-
|
|
3218
|
+
if (isOpen) {
|
|
3219
|
+
resetHash();
|
|
3220
|
+
} else {
|
|
3221
|
+
addHash();
|
|
3222
|
+
}
|
|
3199
3223
|
}, [addHash, isOpen, resetHash]);
|
|
3200
3224
|
(0, import_react20.useEffect)(() => {
|
|
3201
3225
|
const targetWindow = getWindow();
|
|
@@ -3408,17 +3432,15 @@ function useScrollableArea(options = {}) {
|
|
|
3408
3432
|
const internalRef = (0, import_react25.useRef)(null);
|
|
3409
3433
|
const ref = options.ref ?? internalRef;
|
|
3410
3434
|
const [state, setState] = (0, import_react25.useState)({ canScrollUp: false, canScrollDown: false });
|
|
3411
|
-
const updateState = (0, import_react25.useCallback)(() => {
|
|
3412
|
-
const element = ref.current;
|
|
3413
|
-
if (!element) return;
|
|
3414
|
-
const newState = getScrollableAreaState(element);
|
|
3415
|
-
setState(
|
|
3416
|
-
(prev) => prev.canScrollUp !== newState.canScrollUp || prev.canScrollDown !== newState.canScrollDown ? newState : prev
|
|
3417
|
-
);
|
|
3418
|
-
}, [ref]);
|
|
3419
3435
|
(0, import_react25.useEffect)(() => {
|
|
3420
3436
|
const element = ref.current;
|
|
3421
3437
|
if (!element) return;
|
|
3438
|
+
const updateState = () => {
|
|
3439
|
+
const newState = getScrollableAreaState(element);
|
|
3440
|
+
setState(
|
|
3441
|
+
(prev) => prev.canScrollUp !== newState.canScrollUp || prev.canScrollDown !== newState.canScrollDown ? newState : prev
|
|
3442
|
+
);
|
|
3443
|
+
};
|
|
3422
3444
|
updateState();
|
|
3423
3445
|
const resizeObserver = new ResizeObserver(updateState);
|
|
3424
3446
|
resizeObserver.observe(element);
|
|
@@ -3427,7 +3449,7 @@ function useScrollableArea(options = {}) {
|
|
|
3427
3449
|
resizeObserver.disconnect();
|
|
3428
3450
|
element.removeEventListener("scroll", updateState);
|
|
3429
3451
|
};
|
|
3430
|
-
}, [ref
|
|
3452
|
+
}, [ref]);
|
|
3431
3453
|
return {
|
|
3432
3454
|
ref,
|
|
3433
3455
|
...state
|
|
@@ -5976,7 +5998,23 @@ var translation_default2 = {
|
|
|
5976
5998
|
past_dates: "Date cannot be before {{minDate}}",
|
|
5977
5999
|
future_dates: "Date cannot be after {{maxDate}}",
|
|
5978
6000
|
signature_placeholder_text: "Sign inside this box.<br/> Use your finger.<br/> Tap to start.",
|
|
6001
|
+
open_devices_camera: "Open device's camera",
|
|
6002
|
+
place_document_inside_frame: "Place your document inside the frame",
|
|
6003
|
+
close_other_application_that_may_be_using_your_camera: "Close other applications that may be using your camera",
|
|
6004
|
+
if_you_use_external_camera_disconnect_and_reconnect: "If you use an external camera, disconnect and reconnect it",
|
|
6005
|
+
close_the_browser_re_open_it: "Close the browser and reopen it",
|
|
5979
6006
|
camera_permissions_denied: "The camera doesn't open? Make sure to allow the browser permission to use the camera.",
|
|
6007
|
+
camera_errors: {
|
|
6008
|
+
experiencing_camera_issues: "Experiencing camera issues?",
|
|
6009
|
+
chekin_cant_use_your_camera: "Chekin can't use your camera",
|
|
6010
|
+
please_try_a_different_browser: "Your camera doesn't work in this browser. Please, try to open the link in a different browser.",
|
|
6011
|
+
permissions_denied: "Permission denied",
|
|
6012
|
+
camera_permissions_denied: "The camera doesn't open? Make sure to allow the browser permission to use the camera.",
|
|
6013
|
+
no_camera_device_found: "No camera device found. Please connect a camera.",
|
|
6014
|
+
constraints_camera_error: "Constraints cannot be satisfied by available devices.",
|
|
6015
|
+
safari_camera_error: "Safari could not satisfy the camera requirements",
|
|
6016
|
+
try_chrome_or_firefox: "Please try Chrome or Firefox"
|
|
6017
|
+
},
|
|
5980
6018
|
clear: "Clear",
|
|
5981
6019
|
show_less: "Show less",
|
|
5982
6020
|
show_more: "Show more"
|
|
@@ -8586,7 +8624,7 @@ var SidebarProvider = React28.forwardRef(
|
|
|
8586
8624
|
stateName = SIDEBAR_COOKIE_NAME_DEFAULT,
|
|
8587
8625
|
...props
|
|
8588
8626
|
}, ref) => {
|
|
8589
|
-
const
|
|
8627
|
+
const isMobile3 = useIsMobile({ breakpoint: 641 });
|
|
8590
8628
|
const [openMobile, setOpenMobile] = React28.useState(false);
|
|
8591
8629
|
const [_open, _setOpen] = React28.useState(defaultOpen);
|
|
8592
8630
|
const open = openProp ?? _open;
|
|
@@ -8603,8 +8641,8 @@ var SidebarProvider = React28.forwardRef(
|
|
|
8603
8641
|
[setOpenProp, open, stateName]
|
|
8604
8642
|
);
|
|
8605
8643
|
const toggleSidebar = React28.useCallback(() => {
|
|
8606
|
-
return
|
|
8607
|
-
}, [
|
|
8644
|
+
return isMobile3 ? setOpenMobile((value) => !value) : setOpen((value) => !value);
|
|
8645
|
+
}, [isMobile3, setOpen]);
|
|
8608
8646
|
React28.useEffect(() => {
|
|
8609
8647
|
const handleKeyDown = (event) => {
|
|
8610
8648
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
@@ -8621,12 +8659,12 @@ var SidebarProvider = React28.forwardRef(
|
|
|
8621
8659
|
state,
|
|
8622
8660
|
open,
|
|
8623
8661
|
setOpen,
|
|
8624
|
-
isMobile:
|
|
8662
|
+
isMobile: isMobile3,
|
|
8625
8663
|
openMobile,
|
|
8626
8664
|
setOpenMobile,
|
|
8627
8665
|
toggleSidebar
|
|
8628
8666
|
}),
|
|
8629
|
-
[state, open, setOpen,
|
|
8667
|
+
[state, open, setOpen, isMobile3, openMobile, setOpenMobile, toggleSidebar]
|
|
8630
8668
|
);
|
|
8631
8669
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
8632
8670
|
"div",
|
|
@@ -8653,7 +8691,7 @@ var Sidebar = React28.forwardRef(
|
|
|
8653
8691
|
children,
|
|
8654
8692
|
...props
|
|
8655
8693
|
}, ref) => {
|
|
8656
|
-
const { isMobile:
|
|
8694
|
+
const { isMobile: isMobile3, state, openMobile, setOpenMobile } = useSidebar();
|
|
8657
8695
|
if (collapsible === "none") {
|
|
8658
8696
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
8659
8697
|
"div",
|
|
@@ -8668,7 +8706,7 @@ var Sidebar = React28.forwardRef(
|
|
|
8668
8706
|
}
|
|
8669
8707
|
);
|
|
8670
8708
|
}
|
|
8671
|
-
if (
|
|
8709
|
+
if (isMobile3) {
|
|
8672
8710
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
8673
8711
|
SheetContent,
|
|
8674
8712
|
{
|
|
@@ -8739,7 +8777,7 @@ var Sidebar = React28.forwardRef(
|
|
|
8739
8777
|
);
|
|
8740
8778
|
Sidebar.displayName = "Sidebar";
|
|
8741
8779
|
var SidebarTrigger = React28.forwardRef(({ className, onClick, icon, ...props }, ref) => {
|
|
8742
|
-
const { toggleSidebar, open, isMobile:
|
|
8780
|
+
const { toggleSidebar, open, isMobile: isMobile3, openMobile } = useSidebar();
|
|
8743
8781
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
8744
8782
|
Button,
|
|
8745
8783
|
{
|
|
@@ -8758,7 +8796,7 @@ var SidebarTrigger = React28.forwardRef(({ className, onClick, icon, ...props },
|
|
|
8758
8796
|
},
|
|
8759
8797
|
...props,
|
|
8760
8798
|
children: [
|
|
8761
|
-
icon || (
|
|
8799
|
+
icon || (isMobile3 ? openMobile : open) ? icon || /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_lucide_react31.ArrowLeftFromLineIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_lucide_react31.ArrowRightFromLineIcon, {}),
|
|
8762
8800
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
8763
8801
|
]
|
|
8764
8802
|
}
|
|
@@ -8978,7 +9016,7 @@ var SidebarMenuButton = React28.forwardRef(
|
|
|
8978
9016
|
...props
|
|
8979
9017
|
}, ref) => {
|
|
8980
9018
|
const Comp = asChild ? import_react_slot4.Slot : "button";
|
|
8981
|
-
const { isMobile:
|
|
9019
|
+
const { isMobile: isMobile3, state } = useSidebar();
|
|
8982
9020
|
const button = /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
8983
9021
|
Comp,
|
|
8984
9022
|
{
|
|
@@ -9002,7 +9040,7 @@ var SidebarMenuButton = React28.forwardRef(
|
|
|
9002
9040
|
{
|
|
9003
9041
|
side: "right",
|
|
9004
9042
|
align: "center",
|
|
9005
|
-
hidden: state !== "collapsed" ||
|
|
9043
|
+
hidden: state !== "collapsed" || isMobile3,
|
|
9006
9044
|
className: "capitalize",
|
|
9007
9045
|
variant: "dark",
|
|
9008
9046
|
...tooltipProps
|
|
@@ -9031,8 +9069,8 @@ var SidebarMenuAction = React28.forwardRef(({ className, asChild = false, showOn
|
|
|
9031
9069
|
SidebarMenuAction.displayName = "SidebarMenuAction";
|
|
9032
9070
|
var SidebarMenuBadge = React28.forwardRef(
|
|
9033
9071
|
({ className, ...props }, ref) => {
|
|
9034
|
-
const { open, isMobile:
|
|
9035
|
-
const isOpen =
|
|
9072
|
+
const { open, isMobile: isMobile3, openMobile } = useSidebar();
|
|
9073
|
+
const isOpen = isMobile3 ? openMobile : open;
|
|
9036
9074
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
9037
9075
|
"div",
|
|
9038
9076
|
{
|
|
@@ -11091,147 +11129,611 @@ function VideoPlayer({
|
|
|
11091
11129
|
}
|
|
11092
11130
|
|
|
11093
11131
|
// src/webcam/Webcam.tsx
|
|
11094
|
-
var
|
|
11095
|
-
var
|
|
11096
|
-
var import_react_device_detect = require("react-device-detect");
|
|
11132
|
+
var import_react85 = require("react");
|
|
11133
|
+
var import_react_device_detect3 = require("react-device-detect");
|
|
11097
11134
|
var import_react_webcam = __toESM(require("react-webcam"), 1);
|
|
11098
11135
|
|
|
11099
|
-
// src/
|
|
11100
|
-
|
|
11101
|
-
|
|
11136
|
+
// src/lib/compression.ts
|
|
11137
|
+
var IDENTITY_VERIFICATION_PHOTOS_MAX_SIZE_MB = 6;
|
|
11138
|
+
var IDENTITY_VERIFICATION_PHOTOS_QUALITY = 0.8;
|
|
11139
|
+
async function compressFile(file, { convertSize }) {
|
|
11140
|
+
const { default: Compressor } = await import("compressorjs");
|
|
11141
|
+
return new Promise((resolve, reject) => {
|
|
11142
|
+
new Compressor(file, {
|
|
11143
|
+
convertSize: convertSize ? convertSize * 1e6 : void 0,
|
|
11144
|
+
quality: 1,
|
|
11145
|
+
success: (result) => resolve(result),
|
|
11146
|
+
error: reject
|
|
11147
|
+
});
|
|
11148
|
+
});
|
|
11149
|
+
}
|
|
11150
|
+
async function compressImage(image) {
|
|
11151
|
+
const { default: Compressor } = await import("compressorjs");
|
|
11152
|
+
const parsedImage = new File([image], image.name, { type: image.type });
|
|
11153
|
+
return new Promise((resolve, reject) => {
|
|
11154
|
+
new Compressor(parsedImage, {
|
|
11155
|
+
convertSize: IDENTITY_VERIFICATION_PHOTOS_MAX_SIZE_MB * 1e6,
|
|
11156
|
+
quality: IDENTITY_VERIFICATION_PHOTOS_QUALITY,
|
|
11157
|
+
success: (compressedResult) => {
|
|
11158
|
+
toBase64(compressedResult).then((result) => {
|
|
11159
|
+
console.log(
|
|
11160
|
+
"Before: ",
|
|
11161
|
+
getFileSizeMB(image)?.toFixed(2),
|
|
11162
|
+
"MB",
|
|
11163
|
+
"After: ",
|
|
11164
|
+
getFileSizeMB(compressedResult)?.toFixed(2),
|
|
11165
|
+
"MB"
|
|
11166
|
+
);
|
|
11167
|
+
resolve(result);
|
|
11168
|
+
}, reject);
|
|
11169
|
+
},
|
|
11170
|
+
error: (error) => {
|
|
11171
|
+
if (error.message.includes("Failed to load the image")) {
|
|
11172
|
+
reject(new Error("Unable to process the selected image. Please try a different image."));
|
|
11173
|
+
return;
|
|
11174
|
+
}
|
|
11175
|
+
reject(error);
|
|
11176
|
+
}
|
|
11177
|
+
});
|
|
11178
|
+
});
|
|
11102
11179
|
}
|
|
11103
11180
|
|
|
11104
|
-
// src/webcam/
|
|
11105
|
-
var
|
|
11106
|
-
var
|
|
11107
|
-
var
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
height: { ideal: 2160 }
|
|
11112
|
-
}
|
|
11113
|
-
};
|
|
11181
|
+
// src/webcam/useErrorHandler.ts
|
|
11182
|
+
var import_react84 = require("react");
|
|
11183
|
+
var import_react_i18next23 = require("react-i18next");
|
|
11184
|
+
var import_react_device_detect2 = require("react-device-detect");
|
|
11185
|
+
|
|
11186
|
+
// src/webcam/utils.ts
|
|
11187
|
+
var import_react_device_detect = require("react-device-detect");
|
|
11114
11188
|
var isMobileOrTablet = () => import_react_device_detect.isMobile || import_react_device_detect.isTablet;
|
|
11115
|
-
|
|
11189
|
+
var getLivenessOptimizedConstraints = (deviceId, additional) => {
|
|
11190
|
+
const additionalConstraints = typeof additional === "object" && additional !== null ? additional : {};
|
|
11191
|
+
const baseConstraints = {
|
|
11192
|
+
deviceId: deviceId ? { exact: deviceId } : void 0,
|
|
11193
|
+
facingMode: { ideal: "user" },
|
|
11194
|
+
width: { min: 320, ideal: 800 },
|
|
11195
|
+
height: { min: 240, ideal: 600 },
|
|
11196
|
+
frameRate: { ideal: 24 },
|
|
11197
|
+
resizeMode: "crop-and-scale",
|
|
11198
|
+
aspectRatio: { ideal: 1.333 },
|
|
11199
|
+
...additionalConstraints
|
|
11200
|
+
};
|
|
11116
11201
|
if (isMobileOrTablet()) {
|
|
11117
11202
|
return {
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
}
|
|
11203
|
+
...baseConstraints,
|
|
11204
|
+
width: { min: 320, ideal: 640 },
|
|
11205
|
+
height: { min: 240, ideal: 480 },
|
|
11206
|
+
aspectRatio: { ideal: 1 },
|
|
11207
|
+
facingMode: { ideal: "environment" },
|
|
11208
|
+
...additionalConstraints
|
|
11123
11209
|
};
|
|
11124
11210
|
}
|
|
11211
|
+
return baseConstraints;
|
|
11212
|
+
};
|
|
11213
|
+
function getReducedVideoConstraints({
|
|
11214
|
+
deviceId,
|
|
11215
|
+
facingMode,
|
|
11216
|
+
additional
|
|
11217
|
+
}) {
|
|
11218
|
+
const additionalConstraints = typeof additional === "object" ? additional : {};
|
|
11125
11219
|
return {
|
|
11126
|
-
|
|
11220
|
+
deviceId: deviceId ? { exact: deviceId } : void 0,
|
|
11221
|
+
facingMode: { ideal: facingMode || "user" },
|
|
11222
|
+
width: { min: 320, ideal: 640 },
|
|
11223
|
+
height: { min: 240, ideal: 480 },
|
|
11224
|
+
...additionalConstraints
|
|
11127
11225
|
};
|
|
11128
11226
|
}
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
|
|
11145
|
-
|
|
11146
|
-
|
|
11147
|
-
|
|
11227
|
+
function getMobileOrDesktopVideoConstraints({
|
|
11228
|
+
deviceId,
|
|
11229
|
+
facingMode,
|
|
11230
|
+
additional,
|
|
11231
|
+
optimizedForLiveness = false
|
|
11232
|
+
}) {
|
|
11233
|
+
const additionalConstraints = typeof additional === "object" ? additional : {};
|
|
11234
|
+
if (optimizedForLiveness) {
|
|
11235
|
+
return getLivenessOptimizedConstraints(deviceId, additionalConstraints);
|
|
11236
|
+
}
|
|
11237
|
+
const initialConstraints = {
|
|
11238
|
+
deviceId: deviceId ? { exact: deviceId } : void 0,
|
|
11239
|
+
facingMode: { ideal: facingMode || "user" },
|
|
11240
|
+
width: import_react_device_detect.isSafari ? { min: 320, ideal: 1920 } : { min: 320, ideal: 4096, max: 4096 },
|
|
11241
|
+
height: import_react_device_detect.isSafari ? { min: 240, ideal: 1080 } : { min: 240, ideal: 2160, max: 2160 },
|
|
11242
|
+
frameRate: { ideal: 30 },
|
|
11243
|
+
resizeMode: "none",
|
|
11244
|
+
aspectRatio: { ideal: 1.777 },
|
|
11245
|
+
...additionalConstraints
|
|
11246
|
+
};
|
|
11247
|
+
if (isMobileOrTablet()) {
|
|
11248
|
+
return {
|
|
11249
|
+
...initialConstraints,
|
|
11250
|
+
aspectRatio: { ideal: 1 },
|
|
11251
|
+
facingMode: { ideal: "environment" },
|
|
11252
|
+
...additionalConstraints
|
|
11253
|
+
};
|
|
11254
|
+
}
|
|
11255
|
+
if (import_react_device_detect.isSafari && !import_react_device_detect.isMobile) {
|
|
11256
|
+
return {
|
|
11257
|
+
deviceId: deviceId ? { ideal: deviceId } : void 0,
|
|
11258
|
+
width: { min: 320, ideal: 1920 },
|
|
11259
|
+
height: { min: 240, ideal: 1080 },
|
|
11260
|
+
...additionalConstraints
|
|
11261
|
+
};
|
|
11262
|
+
}
|
|
11263
|
+
return initialConstraints;
|
|
11264
|
+
}
|
|
11265
|
+
function isDOMException(error) {
|
|
11266
|
+
return error instanceof DOMException && Boolean(error?.name);
|
|
11267
|
+
}
|
|
11268
|
+
function getPhotoCanvas({
|
|
11269
|
+
player,
|
|
11270
|
+
container,
|
|
11271
|
+
scanArea,
|
|
11272
|
+
canvas,
|
|
11273
|
+
cropToScanArea
|
|
11274
|
+
}) {
|
|
11275
|
+
if (!canvas) return;
|
|
11276
|
+
const playerWidth = player?.videoWidth ?? 1280;
|
|
11277
|
+
const playerHeight = player?.videoHeight ?? 720;
|
|
11278
|
+
const playerAR = playerWidth / playerHeight;
|
|
11279
|
+
const canvasWidth = container?.offsetWidth ?? 1280;
|
|
11280
|
+
const canvasHeight = container?.offsetHeight ?? 1280;
|
|
11281
|
+
const canvasAR = canvasWidth / canvasHeight;
|
|
11282
|
+
let sourceX;
|
|
11283
|
+
let sourceY;
|
|
11284
|
+
let sourceWidth;
|
|
11285
|
+
let sourceHeight;
|
|
11286
|
+
if (playerAR > canvasAR) {
|
|
11287
|
+
sourceHeight = playerHeight;
|
|
11288
|
+
sourceWidth = playerHeight * canvasAR;
|
|
11289
|
+
sourceX = (playerWidth - sourceWidth) / 2;
|
|
11290
|
+
sourceY = 0;
|
|
11291
|
+
} else {
|
|
11292
|
+
sourceWidth = playerWidth;
|
|
11293
|
+
sourceHeight = playerWidth / canvasAR;
|
|
11294
|
+
sourceX = 0;
|
|
11295
|
+
sourceY = (playerHeight - sourceHeight) / 2;
|
|
11296
|
+
}
|
|
11297
|
+
if (cropToScanArea && scanArea && player) {
|
|
11298
|
+
const scanAreaRect = scanArea.getBoundingClientRect();
|
|
11299
|
+
const scaleY = playerHeight / player.clientHeight;
|
|
11300
|
+
const offsetX = (playerWidth - player.clientWidth * scaleY) / 2;
|
|
11301
|
+
const offsetY = (playerHeight - player.clientHeight * scaleY) / 2;
|
|
11302
|
+
const cropX = offsetX + (player.clientWidth - scanAreaRect.width) / 2 * scaleY;
|
|
11303
|
+
const cropY = offsetY + (player.clientHeight - scanAreaRect.height) / 2 * scaleY;
|
|
11304
|
+
const cropWidth = scanAreaRect.width * scaleY;
|
|
11305
|
+
const cropHeight = scanAreaRect.height * scaleY;
|
|
11306
|
+
canvas.width = cropWidth;
|
|
11307
|
+
canvas.height = cropHeight;
|
|
11308
|
+
const context2 = canvas.getContext("2d");
|
|
11309
|
+
if (context2) {
|
|
11310
|
+
context2.drawImage(
|
|
11311
|
+
player,
|
|
11312
|
+
cropX,
|
|
11313
|
+
cropY,
|
|
11314
|
+
cropWidth,
|
|
11315
|
+
cropHeight,
|
|
11316
|
+
0,
|
|
11317
|
+
0,
|
|
11318
|
+
cropWidth,
|
|
11319
|
+
cropHeight
|
|
11320
|
+
);
|
|
11321
|
+
}
|
|
11322
|
+
return canvas;
|
|
11323
|
+
}
|
|
11324
|
+
canvas.width = sourceWidth;
|
|
11325
|
+
canvas.height = sourceHeight;
|
|
11326
|
+
const context = canvas.getContext("2d");
|
|
11327
|
+
if (context && player) {
|
|
11328
|
+
context.drawImage(
|
|
11329
|
+
player,
|
|
11330
|
+
sourceX,
|
|
11331
|
+
sourceY,
|
|
11332
|
+
sourceWidth,
|
|
11333
|
+
sourceHeight,
|
|
11334
|
+
0,
|
|
11335
|
+
0,
|
|
11336
|
+
sourceWidth,
|
|
11337
|
+
sourceHeight
|
|
11148
11338
|
);
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11158
|
-
|
|
11159
|
-
|
|
11160
|
-
|
|
11161
|
-
|
|
11162
|
-
if (
|
|
11163
|
-
|
|
11164
|
-
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
|
|
11339
|
+
}
|
|
11340
|
+
return canvas;
|
|
11341
|
+
}
|
|
11342
|
+
|
|
11343
|
+
// src/webcam/useErrorHandler.ts
|
|
11344
|
+
var GET_USER_MEDIA_ERROR = "getUserMedia is not implemented in this browser";
|
|
11345
|
+
function useErrorHandler({ onError }) {
|
|
11346
|
+
const { t } = (0, import_react_i18next23.useTranslation)();
|
|
11347
|
+
const handleError = useEvent(onError);
|
|
11348
|
+
const handleUserMediaError = (0, import_react84.useCallback)(
|
|
11349
|
+
(error) => {
|
|
11350
|
+
console.error(error);
|
|
11351
|
+
let errorText = "";
|
|
11352
|
+
if (error?.message === GET_USER_MEDIA_ERROR) {
|
|
11353
|
+
errorText = t("camera_errors.chekin_cant_use_your_camera");
|
|
11354
|
+
handleError({
|
|
11355
|
+
title: errorText,
|
|
11356
|
+
message: t("camera_errors.please_try_a_different_browser")
|
|
11357
|
+
});
|
|
11358
|
+
} else if (isDOMException(error)) {
|
|
11359
|
+
switch (error.name) {
|
|
11360
|
+
case "PermissionDeniedError":
|
|
11361
|
+
case "NotAllowedError":
|
|
11362
|
+
errorText = `${t("camera_errors.permissions_denied")}. ${t(
|
|
11363
|
+
"camera_errors.camera_permissions_denied"
|
|
11364
|
+
)}`;
|
|
11365
|
+
import_sonner2.toast.error(errorText);
|
|
11366
|
+
break;
|
|
11367
|
+
case "NotFoundError":
|
|
11368
|
+
errorText = t("camera_errors.no_camera_device_found");
|
|
11369
|
+
import_sonner2.toast.error(errorText);
|
|
11370
|
+
break;
|
|
11371
|
+
case "NotReadableError":
|
|
11372
|
+
case "AbortError":
|
|
11373
|
+
errorText = t("camera_errors.chekin_cant_use_your_camera");
|
|
11374
|
+
handleError({
|
|
11375
|
+
title: errorText,
|
|
11376
|
+
message: `${t("close_other_application_that_may_be_using_your_camera")}.
|
|
11377
|
+
${t("if_you_use_external_camera_disconnect_and_reconnect")}.
|
|
11378
|
+
${t("close_the_browser_re_open_it")}.`
|
|
11379
|
+
});
|
|
11380
|
+
break;
|
|
11381
|
+
case "OverconstrainedError":
|
|
11382
|
+
errorText = t("camera_errors.constraints_camera_error");
|
|
11383
|
+
if (import_react_device_detect2.isSafari) {
|
|
11384
|
+
handleError({
|
|
11385
|
+
title: errorText,
|
|
11386
|
+
message: `${t("camera_errors.safari_camera_error")}. ${t(
|
|
11387
|
+
"camera_errors.try_chrome_or_firefox"
|
|
11388
|
+
)}.`
|
|
11389
|
+
});
|
|
11390
|
+
} else {
|
|
11391
|
+
import_sonner2.toast.error(errorText);
|
|
11177
11392
|
}
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11393
|
+
break;
|
|
11394
|
+
default:
|
|
11395
|
+
errorText = t("camera_errors.chekin_cant_use_your_camera");
|
|
11396
|
+
handleError({
|
|
11397
|
+
title: errorText,
|
|
11398
|
+
message: `${t("camera_errors.please_try_a_different_browser")} ${error}`
|
|
11399
|
+
});
|
|
11182
11400
|
}
|
|
11401
|
+
} else {
|
|
11402
|
+
errorText = t("camera_errors.chekin_cant_use_your_camera");
|
|
11403
|
+
handleError({
|
|
11404
|
+
title: errorText,
|
|
11405
|
+
message: `${t("camera_errors.please_try_a_different_browser")} ${error}`
|
|
11406
|
+
});
|
|
11183
11407
|
}
|
|
11184
|
-
},
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11408
|
+
},
|
|
11409
|
+
[handleError, t]
|
|
11410
|
+
);
|
|
11411
|
+
return { handleUserMediaError };
|
|
11412
|
+
}
|
|
11413
|
+
|
|
11414
|
+
// src/webcam/Webcam.tsx
|
|
11415
|
+
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
11416
|
+
var SCREENSHOT_FORMAT = "image/jpeg";
|
|
11417
|
+
var mirroredTransformStyle = { transform: "rotateY(180deg)" };
|
|
11418
|
+
var Webcam = (0, import_react85.memo)(
|
|
11419
|
+
(0, import_react85.forwardRef)(
|
|
11420
|
+
({
|
|
11421
|
+
onUserMedia,
|
|
11422
|
+
onDisabled,
|
|
11423
|
+
imageSmoothing,
|
|
11424
|
+
videoConstraints,
|
|
11425
|
+
additionalConstraints,
|
|
11426
|
+
hideScanArea,
|
|
11427
|
+
roundedScanArea,
|
|
11428
|
+
cropToScanArea,
|
|
11429
|
+
className,
|
|
11430
|
+
mirrored,
|
|
11431
|
+
children,
|
|
11432
|
+
isLoading,
|
|
11433
|
+
placeholderImage,
|
|
11434
|
+
screenshotMaxSize,
|
|
11435
|
+
minScreenshotH,
|
|
11436
|
+
minScreenshotW,
|
|
11437
|
+
videoSourceDeviceId,
|
|
11438
|
+
screenshotQuality = 1,
|
|
11439
|
+
compression,
|
|
11440
|
+
onError,
|
|
11441
|
+
...props
|
|
11442
|
+
}, ref) => {
|
|
11443
|
+
const [minScreenshotHeight, setMinScreenshotHeight] = (0, import_react85.useState)();
|
|
11444
|
+
const [minScreenshotWidth, setMinScreenshotWidth] = (0, import_react85.useState)();
|
|
11445
|
+
const [useReducedConstraints, setUseReducedConstraints] = (0, import_react85.useState)(false);
|
|
11446
|
+
const [numberOfCameras, setNumberOfCameras] = (0, import_react85.useState)(0);
|
|
11447
|
+
const constraints = (0, import_react85.useMemo)(() => {
|
|
11448
|
+
if (videoConstraints) {
|
|
11449
|
+
return videoConstraints;
|
|
11191
11450
|
}
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11451
|
+
if (useReducedConstraints) {
|
|
11452
|
+
return getReducedVideoConstraints({
|
|
11453
|
+
deviceId: videoSourceDeviceId,
|
|
11454
|
+
additional: additionalConstraints
|
|
11455
|
+
});
|
|
11456
|
+
}
|
|
11457
|
+
return getMobileOrDesktopVideoConstraints({
|
|
11458
|
+
deviceId: videoSourceDeviceId,
|
|
11459
|
+
additional: additionalConstraints
|
|
11460
|
+
});
|
|
11461
|
+
}, [
|
|
11462
|
+
additionalConstraints,
|
|
11463
|
+
useReducedConstraints,
|
|
11464
|
+
videoConstraints,
|
|
11465
|
+
videoSourceDeviceId
|
|
11466
|
+
]);
|
|
11467
|
+
const isMirroredInCSS = mirrored === void 0 && !isMobileOrTablet();
|
|
11468
|
+
const webcamRef = (0, import_react85.useRef)(null);
|
|
11469
|
+
const scanAreaRef = (0, import_react85.useRef)(null);
|
|
11470
|
+
const canvasRef = (0, import_react85.useRef)(null);
|
|
11471
|
+
const containerRef = (0, import_react85.useRef)(null);
|
|
11472
|
+
const { handleUserMediaError } = useErrorHandler({
|
|
11473
|
+
onError: (errorDetails) => {
|
|
11474
|
+
onDisabled?.(true);
|
|
11475
|
+
onError(errorDetails);
|
|
11476
|
+
}
|
|
11477
|
+
});
|
|
11478
|
+
const handleUserMediaErrorWithFallback = (0, import_react85.useCallback)(
|
|
11479
|
+
(error) => {
|
|
11480
|
+
if (error instanceof DOMException && error.name === "OverconstrainedError" && !useReducedConstraints && !videoConstraints) {
|
|
11481
|
+
console.warn("Camera constraints failed, trying reduced constraints:", error);
|
|
11482
|
+
setUseReducedConstraints(true);
|
|
11483
|
+
return;
|
|
11484
|
+
}
|
|
11485
|
+
handleUserMediaError(error);
|
|
11486
|
+
},
|
|
11487
|
+
[handleUserMediaError, useReducedConstraints, videoConstraints]
|
|
11488
|
+
);
|
|
11489
|
+
const compressImage2 = async (canvas) => {
|
|
11490
|
+
if (!canvas) return;
|
|
11491
|
+
const blobImage = await getCanvasBlob(canvas);
|
|
11492
|
+
if (!blobImage) return;
|
|
11493
|
+
const compressedFile = await compressFile(blobImage, {
|
|
11494
|
+
convertSize: screenshotMaxSize
|
|
11495
|
+
});
|
|
11496
|
+
console.log(
|
|
11497
|
+
"Before: ",
|
|
11498
|
+
getFileSizeMB(blobImage)?.toFixed(2),
|
|
11499
|
+
"MB",
|
|
11500
|
+
"After: ",
|
|
11501
|
+
getFileSizeMB(compressedFile)?.toFixed(2),
|
|
11502
|
+
"MB"
|
|
11503
|
+
);
|
|
11504
|
+
return toBase64(compressedFile);
|
|
11505
|
+
};
|
|
11506
|
+
const handleTakePhoto = () => {
|
|
11507
|
+
const takenPhotoCanvas = getPhotoCanvas({
|
|
11508
|
+
player: webcamRef.current?.video,
|
|
11509
|
+
container: containerRef.current,
|
|
11510
|
+
canvas: canvasRef.current,
|
|
11511
|
+
scanArea: scanAreaRef.current,
|
|
11512
|
+
cropToScanArea
|
|
11513
|
+
});
|
|
11514
|
+
if (!takenPhotoCanvas) return;
|
|
11515
|
+
if (compression) return compressImage2(takenPhotoCanvas);
|
|
11516
|
+
return Promise.resolve(
|
|
11517
|
+
takenPhotoCanvas.toDataURL(SCREENSHOT_FORMAT, screenshotQuality)
|
|
11518
|
+
);
|
|
11519
|
+
};
|
|
11520
|
+
(0, import_react85.useImperativeHandle)(
|
|
11521
|
+
ref,
|
|
11522
|
+
() => ({
|
|
11523
|
+
takePhoto: handleTakePhoto,
|
|
11524
|
+
numberOfCameras,
|
|
11525
|
+
...webcamRef.current
|
|
11526
|
+
})
|
|
11527
|
+
);
|
|
11528
|
+
const handleUserMediaSuccess = (0, import_react85.useCallback)(
|
|
11529
|
+
(stream) => {
|
|
11530
|
+
if (!import_react_device_detect3.isMobile) {
|
|
11531
|
+
const track = stream.getVideoTracks()[0];
|
|
11532
|
+
const capabilities = !import_react_device_detect3.isFirefox && track?.getCapabilities();
|
|
11533
|
+
if (capabilities) {
|
|
11534
|
+
setMinScreenshotHeight(capabilities.height?.max);
|
|
11535
|
+
setMinScreenshotWidth(capabilities.width?.max);
|
|
11536
|
+
}
|
|
11537
|
+
} else {
|
|
11538
|
+
setMinScreenshotWidth(minScreenshotW);
|
|
11539
|
+
setMinScreenshotHeight(minScreenshotH);
|
|
11540
|
+
}
|
|
11541
|
+
navigator.mediaDevices.enumerateDevices().then((devices) => {
|
|
11542
|
+
setNumberOfCameras(
|
|
11543
|
+
devices.filter((device) => device.kind === "videoinput").length
|
|
11544
|
+
);
|
|
11545
|
+
}).catch((error) => {
|
|
11546
|
+
console.warn("Failed to enumerate devices:", error);
|
|
11547
|
+
setNumberOfCameras(1);
|
|
11548
|
+
});
|
|
11549
|
+
onUserMedia?.();
|
|
11550
|
+
},
|
|
11551
|
+
[minScreenshotH, minScreenshotW, onUserMedia]
|
|
11552
|
+
);
|
|
11553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
|
|
11198
11554
|
"div",
|
|
11199
11555
|
{
|
|
11556
|
+
ref: containerRef,
|
|
11200
11557
|
className: cn(
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11558
|
+
className,
|
|
11559
|
+
"webcam relative z-[1] mx-auto flex h-[222px] w-[332px] items-center justify-center overflow-hidden rounded-[6px] text-center",
|
|
11560
|
+
"kiosko:h-[620px] kiosko:max-h-[620px] kiosko:w-[890px] kiosko:max-w-[890px]"
|
|
11204
11561
|
),
|
|
11205
|
-
|
|
11206
|
-
|
|
11562
|
+
style: isMirroredInCSS ? mirroredTransformStyle : void 0,
|
|
11563
|
+
children: [
|
|
11564
|
+
!hideScanArea && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
|
|
11565
|
+
"div",
|
|
11566
|
+
{
|
|
11567
|
+
ref: scanAreaRef,
|
|
11568
|
+
className: cn(
|
|
11569
|
+
"webcam__scan-area absolute inset-0 z-[2] m-auto flex w-[calc(100%-32px)] items-center justify-center shadow-[0_0_0_9999em_rgb(0_0_0_/_60%)]",
|
|
11570
|
+
"h-[200px] rounded-[15px] min-[479px]:h-[calc(100%-32px)]",
|
|
11571
|
+
roundedScanArea && "h-[197px] w-[165px] rounded-[45%] border-[3px] border-white shadow-[0_0_8px_#fff,inset_0_0_0_#fff,0_0_0_9999em_rgb(0_0_0_/_60%)]",
|
|
11572
|
+
"kiosko:h-[calc(100%-170px)] kiosko:w-[345px]"
|
|
11573
|
+
),
|
|
11574
|
+
style: isMirroredInCSS ? mirroredTransformStyle : void 0,
|
|
11575
|
+
children: [
|
|
11576
|
+
!roundedScanArea && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_jsx_runtime138.Fragment, { children: [
|
|
11577
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { className: "absolute left-[-2px] top-[-2px] h-[45px] w-[45px] rounded-tl-[15px] border-[4px] border-b-0 border-r-0 border-white" }),
|
|
11578
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { className: "absolute right-[-2px] top-[-2px] h-[45px] w-[45px] rounded-tr-[15px] border-[4px] border-b-0 border-l-0 border-white" }),
|
|
11579
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { className: "absolute bottom-[-2px] right-[-2px] h-[45px] w-[45px] rounded-br-[15px] border-[4px] border-l-0 border-t-0 border-white" }),
|
|
11580
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { className: "absolute bottom-[-2px] left-[-2px] h-[45px] w-[45px] rounded-bl-[15px] border-[4px] border-r-0 border-t-0 border-white" })
|
|
11581
|
+
] }),
|
|
11582
|
+
placeholderImage
|
|
11583
|
+
]
|
|
11584
|
+
}
|
|
11585
|
+
),
|
|
11586
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("canvas", { ref: canvasRef, className: "hidden" }),
|
|
11587
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { className: "h-10 w-10 animate-spin rounded-full border-4 border-white/30 border-t-white" }) }) : /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
11588
|
+
import_react_webcam.default,
|
|
11589
|
+
{
|
|
11590
|
+
ref: webcamRef,
|
|
11591
|
+
mirrored: !!mirrored,
|
|
11592
|
+
width: props.width,
|
|
11593
|
+
height: props.height,
|
|
11594
|
+
videoConstraints: constraints,
|
|
11595
|
+
imageSmoothing: !!imageSmoothing,
|
|
11596
|
+
screenshotFormat: SCREENSHOT_FORMAT,
|
|
11597
|
+
onUserMedia: handleUserMediaSuccess,
|
|
11598
|
+
screenshotQuality,
|
|
11599
|
+
onUserMediaError: handleUserMediaErrorWithFallback,
|
|
11600
|
+
minScreenshotWidth,
|
|
11601
|
+
minScreenshotHeight,
|
|
11602
|
+
className: "webcam__video z-[1] h-full w-full bg-[#e2e2e2] object-cover",
|
|
11603
|
+
audio: false,
|
|
11604
|
+
disablePictureInPicture: false,
|
|
11605
|
+
forceScreenshotSourceSize: false
|
|
11606
|
+
}
|
|
11607
|
+
),
|
|
11608
|
+
children
|
|
11609
|
+
]
|
|
11610
|
+
}
|
|
11611
|
+
);
|
|
11612
|
+
}
|
|
11613
|
+
)
|
|
11614
|
+
);
|
|
11615
|
+
Webcam.displayName = "Webcam";
|
|
11616
|
+
|
|
11617
|
+
// src/mobile-webcam/MobileWebcam.tsx
|
|
11618
|
+
var import_lucide_react41 = require("lucide-react");
|
|
11619
|
+
var import_react87 = require("react");
|
|
11620
|
+
var import_react_dom = require("react-dom");
|
|
11621
|
+
var import_react_i18next25 = require("react-i18next");
|
|
11622
|
+
|
|
11623
|
+
// src/mobile-webcam/DeviceCamera/DeviceCamera.tsx
|
|
11624
|
+
var import_react86 = require("react");
|
|
11625
|
+
var import_react_i18next24 = require("react-i18next");
|
|
11626
|
+
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
11627
|
+
function DeviceCamera({ onChange, facingMode, className }) {
|
|
11628
|
+
const { t } = (0, import_react_i18next24.useTranslation)();
|
|
11629
|
+
const handleNativeScreenshot = (0, import_react86.useCallback)(
|
|
11630
|
+
(event) => {
|
|
11631
|
+
const file = event.target.files?.[0];
|
|
11632
|
+
onChange(file ? compressImage(file) : void 0);
|
|
11633
|
+
},
|
|
11634
|
+
[onChange]
|
|
11635
|
+
);
|
|
11636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
11637
|
+
"div",
|
|
11638
|
+
{
|
|
11639
|
+
className: cn(
|
|
11640
|
+
"mobile-webcam-device-camera flex flex-col items-center gap-3 rounded-xl bg-[#1c1b1f] p-4 text-sm text-white",
|
|
11641
|
+
className
|
|
11642
|
+
),
|
|
11643
|
+
children: [
|
|
11644
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { children: t("camera_errors.experiencing_camera_issues") }),
|
|
11645
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("label", { className: "text-[16px] font-semibold uppercase leading-6 text-[var(--text-button-color)]", children: [
|
|
11646
|
+
t("open_devices_camera"),
|
|
11647
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
11648
|
+
"input",
|
|
11207
11649
|
{
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
imageSmoothing,
|
|
11214
|
-
mirrored,
|
|
11215
|
-
screenshotQuality,
|
|
11216
|
-
videoConstraints: constraints,
|
|
11217
|
-
screenshotFormat: SCREENSHOT_FORMAT,
|
|
11218
|
-
minScreenshotHeight,
|
|
11219
|
-
minScreenshotWidth
|
|
11650
|
+
className: "sr-only",
|
|
11651
|
+
type: "file",
|
|
11652
|
+
accept: "image/*",
|
|
11653
|
+
capture: facingMode || "environment",
|
|
11654
|
+
onChange: handleNativeScreenshot
|
|
11220
11655
|
}
|
|
11221
11656
|
)
|
|
11222
|
-
}
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11657
|
+
] })
|
|
11658
|
+
]
|
|
11659
|
+
}
|
|
11660
|
+
);
|
|
11661
|
+
}
|
|
11662
|
+
|
|
11663
|
+
// src/mobile-webcam/MobileWebcam.tsx
|
|
11664
|
+
var import_jsx_runtime140 = require("react/jsx-runtime");
|
|
11665
|
+
var webcamClasses = "fixed left-0 top-0 z-[6] h-full w-full rounded-none";
|
|
11666
|
+
var scanAreaClasses = String.raw`[&_.webcam\_\_scan-area]:h-full [&_.webcam\_\_scan-area]:max-h-[209px] landscape:[&_.webcam\_\_scan-area]:h-[80%] landscape:[&_.webcam\_\_scan-area]:max-h-full md:[&_.webcam\_\_scan-area]:h-auto md:[&_.webcam\_\_scan-area]:max-h-none md:[&_.webcam\_\_scan-area]:aspect-[2/1]`;
|
|
11667
|
+
var roundedWebcamClasses = String.raw`[&_.webcam\_\_scan-area]:top-[-60px] [&_.webcam\_\_scan-area]:h-full [&_.webcam\_\_scan-area]:w-full [&_.webcam\_\_scan-area]:max-h-[55%] [&_.webcam\_\_scan-area]:max-w-[80%] max-[375px]:[&_.webcam\_\_scan-area]:max-h-[369px] max-[375px]:[&_.webcam\_\_scan-area]:max-w-[261px] max-[320px]:[&_.webcam\_\_scan-area]:max-h-[318px] max-[320px]:[&_.webcam\_\_scan-area]:max-w-[220px] landscape:[&_.webcam\_\_scan-area]:h-full landscape:[&_.webcam\_\_scan-area]:w-full landscape:[&_.webcam\_\_scan-area]:max-h-[90%] landscape:[&_.webcam\_\_scan-area]:max-w-[261px] md:[&_.webcam\_\_scan-area]:aspect-square`;
|
|
11668
|
+
function getAndMapFacingMode(constraints) {
|
|
11669
|
+
if (typeof constraints === "boolean" || !constraints) return;
|
|
11670
|
+
if (constraints.facingMode === "user") return "user";
|
|
11671
|
+
if (constraints.facingMode === "environment") return "environment";
|
|
11672
|
+
}
|
|
11673
|
+
var MobileWebcam = (0, import_react87.forwardRef)(
|
|
11674
|
+
({ onScreenshot, onBack, title, text, disabled, className, ...props }, ref) => {
|
|
11675
|
+
const rootElement = getDocument()?.body;
|
|
11676
|
+
const { t } = (0, import_react_i18next25.useTranslation)();
|
|
11677
|
+
const handleNativeScreenshot = (0, import_react87.useCallback)(
|
|
11678
|
+
(photo) => onScreenshot({ isNative: true, photo }),
|
|
11679
|
+
[onScreenshot]
|
|
11680
|
+
);
|
|
11681
|
+
return (0, import_react_dom.createPortal)(
|
|
11682
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "mobile-camera flex justify-center", children: [
|
|
11683
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
11684
|
+
"button",
|
|
11685
|
+
{
|
|
11686
|
+
type: "button",
|
|
11687
|
+
onClick: onBack,
|
|
11688
|
+
className: "mobile-camera__back-btn fixed left-7 top-9 z-[7] flex border-0 bg-transparent p-0 landscape:left-[50px] landscape:top-[70px]",
|
|
11689
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_lucide_react41.ChevronLeft, { size: 32, strokeWidth: 3, className: "text-white" })
|
|
11690
|
+
}
|
|
11691
|
+
),
|
|
11692
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: "mobile-camera__title fixed left-1/2 top-8 z-[7] -translate-x-1/2 whitespace-nowrap text-[18px] font-bold text-white landscape:top-[5px]", children: title }),
|
|
11693
|
+
text ? /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "mobile-camera__subtitle fixed top-[76px] z-[7] mx-auto my-0 px-6 text-center text-white landscape:hidden [@media(min-height:838px)]:top-28", children: text }) : /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("p", { className: "mobile-camera__helper fixed top-[88px] z-[7] mx-auto my-0 px-6 text-center text-xs text-white landscape:hidden [@media(min-height:700px)]:[font-size:inherit]", children: t("place_document_inside_frame") }),
|
|
11694
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
11695
|
+
Webcam,
|
|
11696
|
+
{
|
|
11697
|
+
ref,
|
|
11698
|
+
...props,
|
|
11699
|
+
className: cn(
|
|
11700
|
+
className,
|
|
11701
|
+
webcamClasses,
|
|
11702
|
+
props.roundedScanArea ? roundedWebcamClasses : scanAreaClasses
|
|
11703
|
+
)
|
|
11704
|
+
}
|
|
11705
|
+
),
|
|
11706
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "fixed bottom-5 z-[7] flex w-[calc(100%-32px)] flex-col justify-between gap-5 self-center landscape:inset-y-0 landscape:right-10 landscape:my-auto landscape:h-auto landscape:w-auto landscape:justify-normal landscape:[&_.mobile-webcam-device-camera]:hidden", children: [
|
|
11707
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
11708
|
+
"button",
|
|
11709
|
+
{
|
|
11710
|
+
type: "button",
|
|
11711
|
+
disabled,
|
|
11712
|
+
onClick: () => onScreenshot({ isNative: false }),
|
|
11713
|
+
className: "mobile-camera__take-btn relative flex h-[75px] w-[75px] items-center justify-center self-center rounded-full border-0 bg-white p-[10px] shadow-[0_0_10px_#ffffff] hover:opacity-80 disabled:cursor-default disabled:opacity-60 disabled:hover:opacity-60",
|
|
11714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_lucide_react41.Camera, { size: 26, className: "text-[var(--primary)]" })
|
|
11715
|
+
}
|
|
11716
|
+
),
|
|
11717
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
11718
|
+
DeviceCamera,
|
|
11719
|
+
{
|
|
11720
|
+
onChange: handleNativeScreenshot,
|
|
11721
|
+
facingMode: getAndMapFacingMode(props.additionalConstraints)
|
|
11722
|
+
}
|
|
11723
|
+
)
|
|
11724
|
+
] })
|
|
11725
|
+
] }),
|
|
11726
|
+
rootElement
|
|
11727
|
+
);
|
|
11226
11728
|
}
|
|
11227
11729
|
);
|
|
11228
|
-
|
|
11730
|
+
MobileWebcam.displayName = "MobileWebcam";
|
|
11229
11731
|
|
|
11230
11732
|
// src/wide-button/WideButton.tsx
|
|
11231
|
-
var
|
|
11232
|
-
var
|
|
11233
|
-
var WideButton = (0,
|
|
11234
|
-
({ className, disabled, ...props }, ref) => /* @__PURE__ */ (0,
|
|
11733
|
+
var import_react88 = require("react");
|
|
11734
|
+
var import_jsx_runtime141 = require("react/jsx-runtime");
|
|
11735
|
+
var WideButton = (0, import_react88.forwardRef)(
|
|
11736
|
+
({ className, disabled, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
11235
11737
|
Button,
|
|
11236
11738
|
{
|
|
11237
11739
|
ref,
|
|
@@ -11253,22 +11755,22 @@ WideButton.displayName = "WideButton";
|
|
|
11253
11755
|
var React42 = __toESM(require("react"), 1);
|
|
11254
11756
|
var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
11255
11757
|
var import_react_draggable = __toESM(require("react-draggable"), 1);
|
|
11256
|
-
var
|
|
11758
|
+
var import_jsx_runtime142 = require("react/jsx-runtime");
|
|
11257
11759
|
var DRAWER_CLOSE_THRESHOLD = 72;
|
|
11258
11760
|
var DRAWER_MIN_OVERLAY_OPACITY = 0.1;
|
|
11259
11761
|
function Drawer({ ...props }) {
|
|
11260
|
-
return /* @__PURE__ */ (0,
|
|
11762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(DialogPrimitive2.Root, { "data-slot": "drawer", ...props });
|
|
11261
11763
|
}
|
|
11262
11764
|
function DrawerTrigger({ ...props }) {
|
|
11263
|
-
return /* @__PURE__ */ (0,
|
|
11765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(DialogPrimitive2.Trigger, { "data-slot": "drawer-trigger", ...props });
|
|
11264
11766
|
}
|
|
11265
11767
|
function DrawerPortal({ ...props }) {
|
|
11266
|
-
return /* @__PURE__ */ (0,
|
|
11768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(DialogPrimitive2.Portal, { "data-slot": "drawer-portal", ...props });
|
|
11267
11769
|
}
|
|
11268
11770
|
function DrawerClose({ ...props }) {
|
|
11269
|
-
return /* @__PURE__ */ (0,
|
|
11771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(DialogPrimitive2.Close, { "data-slot": "drawer-close", ...props });
|
|
11270
11772
|
}
|
|
11271
|
-
var DrawerOverlay = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
11773
|
+
var DrawerOverlay = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11272
11774
|
DialogPrimitive2.Overlay,
|
|
11273
11775
|
{
|
|
11274
11776
|
ref,
|
|
@@ -11318,14 +11820,14 @@ var DrawerContent = React42.forwardRef(
|
|
|
11318
11820
|
},
|
|
11319
11821
|
[onClose]
|
|
11320
11822
|
);
|
|
11321
|
-
return /* @__PURE__ */ (0,
|
|
11322
|
-
lockScroll ? /* @__PURE__ */ (0,
|
|
11823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(DrawerPortal, { container: finalContainer, children: [
|
|
11824
|
+
lockScroll ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11323
11825
|
DrawerOverlay,
|
|
11324
11826
|
{
|
|
11325
11827
|
style: { opacity: overlayOpacity },
|
|
11326
11828
|
onClick: closeOnOverlayClick ? onClose : void 0
|
|
11327
11829
|
}
|
|
11328
|
-
) : /* @__PURE__ */ (0,
|
|
11830
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11329
11831
|
"div",
|
|
11330
11832
|
{
|
|
11331
11833
|
className: cn(DrawerOverlayClasses),
|
|
@@ -11333,7 +11835,7 @@ var DrawerContent = React42.forwardRef(
|
|
|
11333
11835
|
onClick: closeOnOverlayClick ? onClose : void 0
|
|
11334
11836
|
}
|
|
11335
11837
|
),
|
|
11336
|
-
/* @__PURE__ */ (0,
|
|
11838
|
+
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11337
11839
|
DialogPrimitive2.Content,
|
|
11338
11840
|
{
|
|
11339
11841
|
asChild: true,
|
|
@@ -11349,7 +11851,7 @@ var DrawerContent = React42.forwardRef(
|
|
|
11349
11851
|
}
|
|
11350
11852
|
},
|
|
11351
11853
|
...props,
|
|
11352
|
-
children: /* @__PURE__ */ (0,
|
|
11854
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "fixed inset-x-0 bottom-0 top-auto z-50 outline-none", children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11353
11855
|
import_react_draggable.default,
|
|
11354
11856
|
{
|
|
11355
11857
|
axis: "y",
|
|
@@ -11360,7 +11862,7 @@ var DrawerContent = React42.forwardRef(
|
|
|
11360
11862
|
onDrag: handleDrag,
|
|
11361
11863
|
onStop: handleStop,
|
|
11362
11864
|
position: { x: 0, y: dragOffsetY },
|
|
11363
|
-
children: /* @__PURE__ */ (0,
|
|
11865
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
|
|
11364
11866
|
"div",
|
|
11365
11867
|
{
|
|
11366
11868
|
ref: nodeRef,
|
|
@@ -11369,7 +11871,7 @@ var DrawerContent = React42.forwardRef(
|
|
|
11369
11871
|
className
|
|
11370
11872
|
),
|
|
11371
11873
|
children: [
|
|
11372
|
-
showHandle && /* @__PURE__ */ (0,
|
|
11874
|
+
showHandle && /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11373
11875
|
"div",
|
|
11374
11876
|
{
|
|
11375
11877
|
"data-drawer-handle": true,
|
|
@@ -11377,10 +11879,10 @@ var DrawerContent = React42.forwardRef(
|
|
|
11377
11879
|
"mx-auto flex h-8 w-24 touch-none items-center justify-center",
|
|
11378
11880
|
disableDrag ? "cursor-default" : "cursor-grab active:cursor-grabbing"
|
|
11379
11881
|
),
|
|
11380
|
-
children: /* @__PURE__ */ (0,
|
|
11882
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("span", { className: "block h-1.5 w-12 rounded-full bg-[#D9D7D3]" })
|
|
11381
11883
|
}
|
|
11382
11884
|
),
|
|
11383
|
-
/* @__PURE__ */ (0,
|
|
11885
|
+
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children })
|
|
11384
11886
|
]
|
|
11385
11887
|
}
|
|
11386
11888
|
)
|
|
@@ -11392,7 +11894,7 @@ var DrawerContent = React42.forwardRef(
|
|
|
11392
11894
|
}
|
|
11393
11895
|
);
|
|
11394
11896
|
DrawerContent.displayName = DialogPrimitive2.Content.displayName;
|
|
11395
|
-
var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
11897
|
+
var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11396
11898
|
"div",
|
|
11397
11899
|
{
|
|
11398
11900
|
className: cn("flex flex-col gap-2 px-5 pt-2 text-center", className),
|
|
@@ -11400,9 +11902,9 @@ var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
11400
11902
|
}
|
|
11401
11903
|
);
|
|
11402
11904
|
DrawerHeader.displayName = "DrawerHeader";
|
|
11403
|
-
var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
11905
|
+
var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: cn("flex flex-col gap-2 p-5", className), ...props });
|
|
11404
11906
|
DrawerFooter.displayName = "DrawerFooter";
|
|
11405
|
-
var DrawerTitle = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
11907
|
+
var DrawerTitle = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11406
11908
|
DialogPrimitive2.Title,
|
|
11407
11909
|
{
|
|
11408
11910
|
ref,
|
|
@@ -11412,7 +11914,7 @@ var DrawerTitle = React42.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
11412
11914
|
}
|
|
11413
11915
|
));
|
|
11414
11916
|
DrawerTitle.displayName = DialogPrimitive2.Title.displayName;
|
|
11415
|
-
var DrawerDescription = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
11917
|
+
var DrawerDescription = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11416
11918
|
DialogPrimitive2.Description,
|
|
11417
11919
|
{
|
|
11418
11920
|
ref,
|
|
@@ -11439,7 +11941,7 @@ var DEVICE = {
|
|
|
11439
11941
|
};
|
|
11440
11942
|
|
|
11441
11943
|
// src/responsive-sheet/ResponsiveSheet.tsx
|
|
11442
|
-
var
|
|
11944
|
+
var import_jsx_runtime143 = require("react/jsx-runtime");
|
|
11443
11945
|
function ResponsiveSheet({
|
|
11444
11946
|
open,
|
|
11445
11947
|
onClose,
|
|
@@ -11458,8 +11960,8 @@ function ResponsiveSheet({
|
|
|
11458
11960
|
closeOnEscape = true,
|
|
11459
11961
|
disableDrag = false
|
|
11460
11962
|
}) {
|
|
11461
|
-
const { isMatch:
|
|
11462
|
-
const isMobileMode =
|
|
11963
|
+
const { isMatch: isMobile3 } = useScreenResize(DEVICE.tablet);
|
|
11964
|
+
const isMobileMode = isMobile3 && isMobileModalModeAvailable();
|
|
11463
11965
|
const handleOpenChange = (nextOpen) => {
|
|
11464
11966
|
if (!nextOpen) {
|
|
11465
11967
|
onClose();
|
|
@@ -11475,7 +11977,7 @@ function ResponsiveSheet({
|
|
|
11475
11977
|
event.preventDefault();
|
|
11476
11978
|
}
|
|
11477
11979
|
};
|
|
11478
|
-
const content = /* @__PURE__ */ (0,
|
|
11980
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
|
|
11479
11981
|
"div",
|
|
11480
11982
|
{
|
|
11481
11983
|
className: cn(
|
|
@@ -11483,7 +11985,7 @@ function ResponsiveSheet({
|
|
|
11483
11985
|
contentClassName
|
|
11484
11986
|
),
|
|
11485
11987
|
children: [
|
|
11486
|
-
title ? /* @__PURE__ */ (0,
|
|
11988
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
|
|
11487
11989
|
"div",
|
|
11488
11990
|
{
|
|
11489
11991
|
"aria-hidden": "true",
|
|
@@ -11494,7 +11996,7 @@ function ResponsiveSheet({
|
|
|
11494
11996
|
children: title
|
|
11495
11997
|
}
|
|
11496
11998
|
) : null,
|
|
11497
|
-
description ? /* @__PURE__ */ (0,
|
|
11999
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
|
|
11498
12000
|
"p",
|
|
11499
12001
|
{
|
|
11500
12002
|
"aria-hidden": "true",
|
|
@@ -11510,7 +12012,7 @@ function ResponsiveSheet({
|
|
|
11510
12012
|
}
|
|
11511
12013
|
);
|
|
11512
12014
|
if (isMobileMode) {
|
|
11513
|
-
return /* @__PURE__ */ (0,
|
|
12015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(Drawer, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
|
|
11514
12016
|
DrawerContent,
|
|
11515
12017
|
{
|
|
11516
12018
|
onClose,
|
|
@@ -11521,14 +12023,14 @@ function ResponsiveSheet({
|
|
|
11521
12023
|
onEscapeKeyDown: handleEscapeKeyDown,
|
|
11522
12024
|
className: cn(className, drawerClassName),
|
|
11523
12025
|
children: [
|
|
11524
|
-
title ? /* @__PURE__ */ (0,
|
|
11525
|
-
description ? /* @__PURE__ */ (0,
|
|
12026
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(DrawerTitle, { className: "sr-only", children: title }) : null,
|
|
12027
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(DrawerDescription, { className: "sr-only", children: description }) : null,
|
|
11526
12028
|
content
|
|
11527
12029
|
]
|
|
11528
12030
|
}
|
|
11529
12031
|
) });
|
|
11530
12032
|
}
|
|
11531
|
-
return /* @__PURE__ */ (0,
|
|
12033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(Dialog, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
|
|
11532
12034
|
DialogContent,
|
|
11533
12035
|
{
|
|
11534
12036
|
showCloseButton,
|
|
@@ -11538,8 +12040,8 @@ function ResponsiveSheet({
|
|
|
11538
12040
|
className: cn("max-w-[560px] border-0 p-0 shadow-xl", className, dialogClassName),
|
|
11539
12041
|
lockScroll: false,
|
|
11540
12042
|
children: [
|
|
11541
|
-
title ? /* @__PURE__ */ (0,
|
|
11542
|
-
description ? /* @__PURE__ */ (0,
|
|
12043
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(DialogTitle, { className: "sr-only", children: title }) : null,
|
|
12044
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(DialogDescription, { className: "sr-only", children: description }) : null,
|
|
11543
12045
|
content
|
|
11544
12046
|
]
|
|
11545
12047
|
}
|
|
@@ -11548,7 +12050,7 @@ function ResponsiveSheet({
|
|
|
11548
12050
|
|
|
11549
12051
|
// src/responsive-dropdown/ResponsiveDropdown.tsx
|
|
11550
12052
|
var React43 = __toESM(require("react"), 1);
|
|
11551
|
-
var
|
|
12053
|
+
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
11552
12054
|
function ResponsiveDropdown({
|
|
11553
12055
|
trigger,
|
|
11554
12056
|
options,
|
|
@@ -11561,8 +12063,8 @@ function ResponsiveDropdown({
|
|
|
11561
12063
|
dropdownClassName,
|
|
11562
12064
|
drawerClassName
|
|
11563
12065
|
}) {
|
|
11564
|
-
const { isMatch:
|
|
11565
|
-
const isMobileMode =
|
|
12066
|
+
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
12067
|
+
const isMobileMode = isMobile3 && isMobileModalModeAvailable();
|
|
11566
12068
|
const [open, setOpen] = React43.useState(false);
|
|
11567
12069
|
const visibleOptions = options?.filter((option) => !option.hidden) ?? [];
|
|
11568
12070
|
const renderTrigger = (isOpen) => typeof trigger === "function" ? trigger(isOpen) : trigger;
|
|
@@ -11580,8 +12082,8 @@ function ResponsiveDropdown({
|
|
|
11580
12082
|
setOpen(false);
|
|
11581
12083
|
};
|
|
11582
12084
|
if (isMobileMode) {
|
|
11583
|
-
return /* @__PURE__ */ (0,
|
|
11584
|
-
/* @__PURE__ */ (0,
|
|
12085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(import_jsx_runtime144.Fragment, { children: [
|
|
12086
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
11585
12087
|
"div",
|
|
11586
12088
|
{
|
|
11587
12089
|
className: "responsive-dropdown__mobile-trigger",
|
|
@@ -11589,16 +12091,16 @@ function ResponsiveDropdown({
|
|
|
11589
12091
|
children: renderTrigger(open)
|
|
11590
12092
|
}
|
|
11591
12093
|
),
|
|
11592
|
-
/* @__PURE__ */ (0,
|
|
12094
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Drawer, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
|
|
11593
12095
|
DrawerContent,
|
|
11594
12096
|
{
|
|
11595
12097
|
onClose: () => setOpen(false),
|
|
11596
12098
|
lockScroll: false,
|
|
11597
12099
|
className: cn("px-0 pb-2", className, drawerClassName),
|
|
11598
12100
|
children: [
|
|
11599
|
-
title ? /* @__PURE__ */ (0,
|
|
11600
|
-
/* @__PURE__ */ (0,
|
|
11601
|
-
visibleOptions.map((option) => /* @__PURE__ */ (0,
|
|
12101
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(DrawerTitle, { className: "sr-only", children: title }) : null,
|
|
12102
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "flex flex-col", children: [
|
|
12103
|
+
visibleOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
11602
12104
|
"div",
|
|
11603
12105
|
{
|
|
11604
12106
|
role: "button",
|
|
@@ -11620,16 +12122,16 @@ function ResponsiveDropdown({
|
|
|
11620
12122
|
) })
|
|
11621
12123
|
] });
|
|
11622
12124
|
}
|
|
11623
|
-
return /* @__PURE__ */ (0,
|
|
11624
|
-
/* @__PURE__ */ (0,
|
|
11625
|
-
/* @__PURE__ */ (0,
|
|
12125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(DropdownMenu, { open, onOpenChange: handleOpenChange, children: [
|
|
12126
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(DropdownMenuTrigger, { asChild: true, disabled, children: renderTrigger(open) }),
|
|
12127
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
|
|
11626
12128
|
DropdownMenuContent,
|
|
11627
12129
|
{
|
|
11628
12130
|
side,
|
|
11629
12131
|
align,
|
|
11630
12132
|
className: cn("min-w-[295px]", className, dropdownClassName),
|
|
11631
12133
|
children: [
|
|
11632
|
-
visibleOptions.map((option) => /* @__PURE__ */ (0,
|
|
12134
|
+
visibleOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
11633
12135
|
DropdownMenuItem,
|
|
11634
12136
|
{
|
|
11635
12137
|
disabled: option.disabled,
|
|
@@ -11647,11 +12149,11 @@ function ResponsiveDropdown({
|
|
|
11647
12149
|
|
|
11648
12150
|
// src/dashboard/input/Input.tsx
|
|
11649
12151
|
var React44 = __toESM(require("react"), 1);
|
|
11650
|
-
var
|
|
11651
|
-
var
|
|
12152
|
+
var import_lucide_react42 = require("lucide-react");
|
|
12153
|
+
var import_react_i18next26 = require("react-i18next");
|
|
11652
12154
|
|
|
11653
12155
|
// src/dashboard/_fieldset/Fieldset.tsx
|
|
11654
|
-
var
|
|
12156
|
+
var import_jsx_runtime145 = require("react/jsx-runtime");
|
|
11655
12157
|
function Fieldset({
|
|
11656
12158
|
isActivated,
|
|
11657
12159
|
isFocused,
|
|
@@ -11671,8 +12173,8 @@ function Fieldset({
|
|
|
11671
12173
|
}) {
|
|
11672
12174
|
const showLegendText = Boolean(legend || typeof label === "string");
|
|
11673
12175
|
const raised = !isEmpty || isFocused;
|
|
11674
|
-
return /* @__PURE__ */ (0,
|
|
11675
|
-
/* @__PURE__ */ (0,
|
|
12176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(import_jsx_runtime145.Fragment, { children: [
|
|
12177
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
|
|
11676
12178
|
"div",
|
|
11677
12179
|
{
|
|
11678
12180
|
onClick,
|
|
@@ -11688,7 +12190,7 @@ function Fieldset({
|
|
|
11688
12190
|
labelClassName
|
|
11689
12191
|
),
|
|
11690
12192
|
children: [
|
|
11691
|
-
/* @__PURE__ */ (0,
|
|
12193
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
11692
12194
|
"label",
|
|
11693
12195
|
{
|
|
11694
12196
|
id: labelId,
|
|
@@ -11700,7 +12202,7 @@ function Fieldset({
|
|
|
11700
12202
|
children: label
|
|
11701
12203
|
}
|
|
11702
12204
|
),
|
|
11703
|
-
tooltip && /* @__PURE__ */ (0,
|
|
12205
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "ml-1 inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
11704
12206
|
HelpTooltip,
|
|
11705
12207
|
{
|
|
11706
12208
|
content: tooltip,
|
|
@@ -11711,7 +12213,7 @@ function Fieldset({
|
|
|
11711
12213
|
]
|
|
11712
12214
|
}
|
|
11713
12215
|
),
|
|
11714
|
-
/* @__PURE__ */ (0,
|
|
12216
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
11715
12217
|
"fieldset",
|
|
11716
12218
|
{
|
|
11717
12219
|
"aria-hidden": "true",
|
|
@@ -11723,7 +12225,7 @@ function Fieldset({
|
|
|
11723
12225
|
invalid && "border-[var(--error-message-color)]",
|
|
11724
12226
|
className
|
|
11725
12227
|
),
|
|
11726
|
-
children: /* @__PURE__ */ (0,
|
|
12228
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
|
|
11727
12229
|
"legend",
|
|
11728
12230
|
{
|
|
11729
12231
|
className: cn(
|
|
@@ -11733,8 +12235,8 @@ function Fieldset({
|
|
|
11733
12235
|
!label && "w-0"
|
|
11734
12236
|
),
|
|
11735
12237
|
children: [
|
|
11736
|
-
showLegendText && /* @__PURE__ */ (0,
|
|
11737
|
-
tooltip && /* @__PURE__ */ (0,
|
|
12238
|
+
showLegendText && /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "visible inline-block pr-[6px] text-[14px] font-medium opacity-0", children: legend || label }),
|
|
12239
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "visible inline-block w-[20px] opacity-0", children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "inline-block h-4 w-4" }) })
|
|
11738
12240
|
]
|
|
11739
12241
|
}
|
|
11740
12242
|
)
|
|
@@ -11744,7 +12246,7 @@ function Fieldset({
|
|
|
11744
12246
|
}
|
|
11745
12247
|
|
|
11746
12248
|
// src/dashboard/input/Input.tsx
|
|
11747
|
-
var
|
|
12249
|
+
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
11748
12250
|
var checkIfEmpty = ({
|
|
11749
12251
|
empty,
|
|
11750
12252
|
defaultValue,
|
|
@@ -11795,7 +12297,7 @@ var DashboardInput = React44.forwardRef(
|
|
|
11795
12297
|
const generatedId = React44.useId();
|
|
11796
12298
|
const inputId = id ?? name ?? generatedId;
|
|
11797
12299
|
const errorId = `${inputId}-error`;
|
|
11798
|
-
const { t } = (0,
|
|
12300
|
+
const { t } = (0, import_react_i18next26.useTranslation)();
|
|
11799
12301
|
const isEmpty = checkIfEmpty({ empty, value, defaultValue });
|
|
11800
12302
|
const [inputType, setInputType] = React44.useState(type);
|
|
11801
12303
|
const [isPasswordRevealed, setIsPasswordRevealed] = React44.useState(false);
|
|
@@ -11835,18 +12337,18 @@ var DashboardInput = React44.forwardRef(
|
|
|
11835
12337
|
};
|
|
11836
12338
|
const showRightPaddingForReset = Boolean(onReset);
|
|
11837
12339
|
const showRightPaddingForReveal = isPasswordReveal;
|
|
11838
|
-
return /* @__PURE__ */ (0,
|
|
12340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
|
|
11839
12341
|
"div",
|
|
11840
12342
|
{
|
|
11841
12343
|
className: cn(
|
|
11842
|
-
"relative block min-h-[68px] max-w-[var(--dashboard-input-max-width,none)]",
|
|
12344
|
+
"relative block w-full min-h-[68px] max-w-[var(--dashboard-input-max-width,none)]",
|
|
11843
12345
|
disabled && "cursor-not-allowed opacity-50",
|
|
11844
12346
|
loading && "cursor-progress opacity-50",
|
|
11845
12347
|
wrapperClassName,
|
|
11846
12348
|
className
|
|
11847
12349
|
),
|
|
11848
12350
|
children: [
|
|
11849
|
-
topLabel && /* @__PURE__ */ (0,
|
|
12351
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11850
12352
|
"label",
|
|
11851
12353
|
{
|
|
11852
12354
|
htmlFor: inputId,
|
|
@@ -11854,7 +12356,7 @@ var DashboardInput = React44.forwardRef(
|
|
|
11854
12356
|
children: topLabel
|
|
11855
12357
|
}
|
|
11856
12358
|
),
|
|
11857
|
-
/* @__PURE__ */ (0,
|
|
12359
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
|
|
11858
12360
|
"div",
|
|
11859
12361
|
{
|
|
11860
12362
|
className: cn(
|
|
@@ -11863,8 +12365,8 @@ var DashboardInput = React44.forwardRef(
|
|
|
11863
12365
|
fieldClassName
|
|
11864
12366
|
),
|
|
11865
12367
|
children: [
|
|
11866
|
-
/* @__PURE__ */ (0,
|
|
11867
|
-
/* @__PURE__ */ (0,
|
|
12368
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: cn("relative w-full cursor-text", contentClassName), children: [
|
|
12369
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11868
12370
|
Fieldset,
|
|
11869
12371
|
{
|
|
11870
12372
|
isFocused: isFocused && !readOnly,
|
|
@@ -11885,8 +12387,8 @@ var DashboardInput = React44.forwardRef(
|
|
|
11885
12387
|
})
|
|
11886
12388
|
}
|
|
11887
12389
|
),
|
|
11888
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
11889
|
-
/* @__PURE__ */ (0,
|
|
12390
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("span", { className: "pointer-events-none absolute left-0 top-0 flex h-full max-w-10 items-center justify-center text-[var(--chekin-color-gray-2)]", children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("span", { className: "flex h-full w-10 items-center justify-center", children: leftIcon }) }),
|
|
12391
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11890
12392
|
"input",
|
|
11891
12393
|
{
|
|
11892
12394
|
...props,
|
|
@@ -11923,9 +12425,9 @@ var DashboardInput = React44.forwardRef(
|
|
|
11923
12425
|
)
|
|
11924
12426
|
}
|
|
11925
12427
|
),
|
|
11926
|
-
sign && /* @__PURE__ */ (0,
|
|
11927
|
-
trailingAdornment && /* @__PURE__ */ (0,
|
|
11928
|
-
onReset && !isEmpty && /* @__PURE__ */ (0,
|
|
12428
|
+
sign && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("span", { className: "pointer-events-none absolute right-[14px] top-0 flex h-full items-center text-[18px] font-medium leading-6 text-[var(--chekin-color-brand-navy)]", children: sign }),
|
|
12429
|
+
trailingAdornment && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("span", { className: "pointer-events-none absolute right-[14px] top-0 flex h-full items-center", children: trailingAdornment }),
|
|
12430
|
+
onReset && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11929
12431
|
"button",
|
|
11930
12432
|
{
|
|
11931
12433
|
type: "button",
|
|
@@ -11933,18 +12435,18 @@ var DashboardInput = React44.forwardRef(
|
|
|
11933
12435
|
disabled,
|
|
11934
12436
|
className: "absolute right-0 top-0 flex h-full w-10 items-center justify-center border-0 bg-transparent p-0 text-[#9696b9] hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50",
|
|
11935
12437
|
"aria-label": "Reset",
|
|
11936
|
-
children: /* @__PURE__ */ (0,
|
|
12438
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_lucide_react42.X, { size: 14 })
|
|
11937
12439
|
}
|
|
11938
12440
|
),
|
|
11939
|
-
isPasswordReveal && /* @__PURE__ */ (0,
|
|
12441
|
+
isPasswordReveal && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11940
12442
|
"button",
|
|
11941
12443
|
{
|
|
11942
12444
|
type: "button",
|
|
11943
12445
|
onClick: togglePasswordReveal,
|
|
11944
12446
|
className: "absolute right-[14px] top-[18px] flex h-[13px] w-[21px] cursor-pointer items-center justify-center border-0 bg-transparent p-0 hover:opacity-85",
|
|
11945
12447
|
"aria-label": isPasswordRevealed ? "Hide password" : "Show password",
|
|
11946
|
-
children: /* @__PURE__ */ (0,
|
|
11947
|
-
|
|
12448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
12449
|
+
import_lucide_react42.Eye,
|
|
11948
12450
|
{
|
|
11949
12451
|
size: 20,
|
|
11950
12452
|
className: cn(
|
|
@@ -11955,32 +12457,32 @@ var DashboardInput = React44.forwardRef(
|
|
|
11955
12457
|
}
|
|
11956
12458
|
)
|
|
11957
12459
|
] }),
|
|
11958
|
-
type === "number" && showNumberButtons && /* @__PURE__ */ (0,
|
|
11959
|
-
/* @__PURE__ */ (0,
|
|
12460
|
+
type === "number" && showNumberButtons && /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: "absolute right-[18px] top-[13px] inline-flex items-center text-right", children: [
|
|
12461
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11960
12462
|
"button",
|
|
11961
12463
|
{
|
|
11962
12464
|
type: "button",
|
|
11963
12465
|
onClick: onDecrement,
|
|
11964
12466
|
className: "mr-2 inline-flex h-[23px] w-8 cursor-pointer items-center justify-center rounded-[3px] border-0 bg-[var(--chekin-color-brand-blue)] p-0 text-[20px] font-bold text-white outline-none hover:opacity-90 active:opacity-100",
|
|
11965
12467
|
"aria-label": "Decrement",
|
|
11966
|
-
children: /* @__PURE__ */ (0,
|
|
12468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_lucide_react42.Minus, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
11967
12469
|
}
|
|
11968
12470
|
),
|
|
11969
|
-
/* @__PURE__ */ (0,
|
|
12471
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11970
12472
|
"button",
|
|
11971
12473
|
{
|
|
11972
12474
|
type: "button",
|
|
11973
12475
|
onClick: onIncrement,
|
|
11974
12476
|
className: "inline-flex h-[23px] w-8 cursor-pointer items-center justify-center rounded-[3px] border-0 bg-[var(--chekin-color-brand-blue)] p-0 text-[20px] font-bold text-white outline-none hover:opacity-90 active:opacity-100",
|
|
11975
12477
|
"aria-label": "Increment",
|
|
11976
|
-
children: /* @__PURE__ */ (0,
|
|
12478
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_lucide_react42.Plus, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
11977
12479
|
}
|
|
11978
12480
|
)
|
|
11979
12481
|
] })
|
|
11980
12482
|
]
|
|
11981
12483
|
}
|
|
11982
12484
|
),
|
|
11983
|
-
!errorMessage && optional && /* @__PURE__ */ (0,
|
|
12485
|
+
!errorMessage && optional && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11984
12486
|
"span",
|
|
11985
12487
|
{
|
|
11986
12488
|
"data-testid": `${name}-optional`,
|
|
@@ -11988,8 +12490,8 @@ var DashboardInput = React44.forwardRef(
|
|
|
11988
12490
|
children: typeof optional === "string" ? optional : t("optional")
|
|
11989
12491
|
}
|
|
11990
12492
|
),
|
|
11991
|
-
!errorMessage && helperText && /* @__PURE__ */ (0,
|
|
11992
|
-
errorMessage && renderErrorMessage && /* @__PURE__ */ (0,
|
|
12493
|
+
!errorMessage && helperText && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
12494
|
+
errorMessage && renderErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11993
12495
|
FieldErrorMessage,
|
|
11994
12496
|
{
|
|
11995
12497
|
id: errorId,
|
|
@@ -12008,11 +12510,11 @@ DashboardInput.displayName = "DashboardInput";
|
|
|
12008
12510
|
|
|
12009
12511
|
// src/dashboard/select/Select.tsx
|
|
12010
12512
|
var React48 = __toESM(require("react"), 1);
|
|
12011
|
-
var
|
|
12513
|
+
var import_react_i18next30 = require("react-i18next");
|
|
12012
12514
|
|
|
12013
12515
|
// src/dashboard/_select-internals/SelectFieldShell.tsx
|
|
12014
|
-
var
|
|
12015
|
-
var
|
|
12516
|
+
var import_react_i18next27 = require("react-i18next");
|
|
12517
|
+
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
12016
12518
|
function SelectFieldShell({
|
|
12017
12519
|
containerRef,
|
|
12018
12520
|
className,
|
|
@@ -12031,9 +12533,9 @@ function SelectFieldShell({
|
|
|
12031
12533
|
onBlur,
|
|
12032
12534
|
children
|
|
12033
12535
|
}) {
|
|
12034
|
-
const { t } = (0,
|
|
12536
|
+
const { t } = (0, import_react_i18next27.useTranslation)();
|
|
12035
12537
|
const wrapperWidth = toCssSize(width);
|
|
12036
|
-
return /* @__PURE__ */ (0,
|
|
12538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
|
|
12037
12539
|
"div",
|
|
12038
12540
|
{
|
|
12039
12541
|
ref: containerRef,
|
|
@@ -12046,9 +12548,9 @@ function SelectFieldShell({
|
|
|
12046
12548
|
),
|
|
12047
12549
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
12048
12550
|
children: [
|
|
12049
|
-
name && /* @__PURE__ */ (0,
|
|
12050
|
-
/* @__PURE__ */ (0,
|
|
12051
|
-
topLabel && /* @__PURE__ */ (0,
|
|
12551
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("input", { type: "hidden", name, value: hiddenValue ?? "" }),
|
|
12552
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "relative min-h-[68px] w-full", children: [
|
|
12553
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
12052
12554
|
"label",
|
|
12053
12555
|
{
|
|
12054
12556
|
htmlFor: triggerId,
|
|
@@ -12056,10 +12558,10 @@ function SelectFieldShell({
|
|
|
12056
12558
|
children: topLabel
|
|
12057
12559
|
}
|
|
12058
12560
|
),
|
|
12059
|
-
/* @__PURE__ */ (0,
|
|
12060
|
-
!errorMessage && optional && /* @__PURE__ */ (0,
|
|
12061
|
-
!errorMessage && helperText && /* @__PURE__ */ (0,
|
|
12062
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
12561
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "relative w-full", children }),
|
|
12562
|
+
!errorMessage && optional && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
12563
|
+
!errorMessage && helperText && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
12564
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
12063
12565
|
FieldErrorMessage,
|
|
12064
12566
|
{
|
|
12065
12567
|
id: errorId,
|
|
@@ -12074,7 +12576,7 @@ function SelectFieldShell({
|
|
|
12074
12576
|
}
|
|
12075
12577
|
|
|
12076
12578
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12077
|
-
var
|
|
12579
|
+
var import_react_i18next28 = require("react-i18next");
|
|
12078
12580
|
|
|
12079
12581
|
// src/dashboard/_select-internals/utils.ts
|
|
12080
12582
|
function getOptionIndex(options, option) {
|
|
@@ -12105,7 +12607,7 @@ function isOptionSelected(option, selectedValue, selectedValues) {
|
|
|
12105
12607
|
}
|
|
12106
12608
|
|
|
12107
12609
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12108
|
-
var
|
|
12610
|
+
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
12109
12611
|
function SelectMenu({
|
|
12110
12612
|
id,
|
|
12111
12613
|
options,
|
|
@@ -12127,10 +12629,10 @@ function SelectMenu({
|
|
|
12127
12629
|
emptyContent,
|
|
12128
12630
|
footer
|
|
12129
12631
|
}) {
|
|
12130
|
-
const { t } = (0,
|
|
12632
|
+
const { t } = (0, import_react_i18next28.useTranslation)();
|
|
12131
12633
|
const emptyMessage = noOptionsMessage?.() ?? t("no_options");
|
|
12132
12634
|
const hasOptions = options.length > 0;
|
|
12133
|
-
return /* @__PURE__ */ (0,
|
|
12635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
12134
12636
|
"div",
|
|
12135
12637
|
{
|
|
12136
12638
|
id,
|
|
@@ -12147,13 +12649,13 @@ function SelectMenu({
|
|
|
12147
12649
|
menuClassName
|
|
12148
12650
|
),
|
|
12149
12651
|
children: [
|
|
12150
|
-
!hasOptions && (emptyContent ?? /* @__PURE__ */ (0,
|
|
12652
|
+
!hasOptions && (emptyContent ?? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "mt-[10px] text-left text-[16px] text-[var(--chekin-color-brand-navy)]", children: emptyMessage })),
|
|
12151
12653
|
options.map((option, index) => {
|
|
12152
12654
|
const isSelected = isOptionSelected(option, selectedValue, selectedValues);
|
|
12153
12655
|
const isHighlighted = index === highlightedIndex;
|
|
12154
12656
|
const optionKey = `${String(option.value)}-${index}`;
|
|
12155
12657
|
const isOptionDisabled = Boolean(disabled || option.isDisabled);
|
|
12156
|
-
return /* @__PURE__ */ (0,
|
|
12658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
12157
12659
|
"button",
|
|
12158
12660
|
{
|
|
12159
12661
|
id: getOptionId2(index),
|
|
@@ -12176,8 +12678,8 @@ function SelectMenu({
|
|
|
12176
12678
|
isOptionDisabled && "cursor-default opacity-30"
|
|
12177
12679
|
),
|
|
12178
12680
|
children: [
|
|
12179
|
-
/* @__PURE__ */ (0,
|
|
12180
|
-
option.description && /* @__PURE__ */ (0,
|
|
12681
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "block break-words", children: option.label }),
|
|
12682
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "ml-2 mt-[3px] shrink-0 text-[12px] font-bold italic text-[#777e91]", children: option.description })
|
|
12181
12683
|
]
|
|
12182
12684
|
},
|
|
12183
12685
|
optionKey
|
|
@@ -12190,11 +12692,11 @@ function SelectMenu({
|
|
|
12190
12692
|
}
|
|
12191
12693
|
|
|
12192
12694
|
// src/dashboard/_select-internals/SelectMenuPanel.tsx
|
|
12193
|
-
var
|
|
12194
|
-
var
|
|
12695
|
+
var import_react_i18next29 = require("react-i18next");
|
|
12696
|
+
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
12195
12697
|
function SelectMenuPanel({
|
|
12196
12698
|
isOpen,
|
|
12197
|
-
isMobile:
|
|
12699
|
+
isMobile: isMobile3,
|
|
12198
12700
|
onClose,
|
|
12199
12701
|
title,
|
|
12200
12702
|
description,
|
|
@@ -12203,29 +12705,29 @@ function SelectMenuPanel({
|
|
|
12203
12705
|
drawerContentClassName,
|
|
12204
12706
|
children
|
|
12205
12707
|
}) {
|
|
12206
|
-
const { t } = (0,
|
|
12708
|
+
const { t } = (0, import_react_i18next29.useTranslation)();
|
|
12207
12709
|
if (!isOpen) return null;
|
|
12208
|
-
if (
|
|
12710
|
+
if (isMobile3) {
|
|
12209
12711
|
const fallbackTitle = t("select_option");
|
|
12210
12712
|
const titleText = typeof title === "string" || typeof title === "number" ? String(title) : fallbackTitle;
|
|
12211
12713
|
const descriptionText = typeof description === "string" || typeof description === "number" ? String(description) : titleText;
|
|
12212
|
-
return /* @__PURE__ */ (0,
|
|
12714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
12213
12715
|
Drawer,
|
|
12214
12716
|
{
|
|
12215
12717
|
open: isOpen,
|
|
12216
12718
|
onOpenChange: (next) => {
|
|
12217
12719
|
if (!next) onClose();
|
|
12218
12720
|
},
|
|
12219
|
-
children: /* @__PURE__ */ (0,
|
|
12721
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
|
|
12220
12722
|
DrawerContent,
|
|
12221
12723
|
{
|
|
12222
12724
|
onClose,
|
|
12223
12725
|
lockScroll: false,
|
|
12224
12726
|
className: cn("max-h-[calc(100vh-1rem)]", drawerClassName),
|
|
12225
12727
|
children: [
|
|
12226
|
-
/* @__PURE__ */ (0,
|
|
12227
|
-
/* @__PURE__ */ (0,
|
|
12228
|
-
/* @__PURE__ */ (0,
|
|
12728
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DrawerTitle, { className: "sr-only", children: titleText }),
|
|
12729
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DrawerDescription, { className: "sr-only", children: descriptionText }),
|
|
12730
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
12229
12731
|
"div",
|
|
12230
12732
|
{
|
|
12231
12733
|
className: cn(
|
|
@@ -12241,7 +12743,7 @@ function SelectMenuPanel({
|
|
|
12241
12743
|
}
|
|
12242
12744
|
);
|
|
12243
12745
|
}
|
|
12244
|
-
return /* @__PURE__ */ (0,
|
|
12746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
12245
12747
|
"div",
|
|
12246
12748
|
{
|
|
12247
12749
|
className: cn(
|
|
@@ -12254,7 +12756,7 @@ function SelectMenuPanel({
|
|
|
12254
12756
|
}
|
|
12255
12757
|
|
|
12256
12758
|
// src/dashboard/_select-internals/SelectSearchInput.tsx
|
|
12257
|
-
var
|
|
12759
|
+
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
12258
12760
|
function SelectSearchInput({
|
|
12259
12761
|
inputRef,
|
|
12260
12762
|
value,
|
|
@@ -12264,7 +12766,7 @@ function SelectSearchInput({
|
|
|
12264
12766
|
onChange,
|
|
12265
12767
|
onKeyDown
|
|
12266
12768
|
}) {
|
|
12267
|
-
return /* @__PURE__ */ (0,
|
|
12769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "border-b border-[#f2f4f8] px-4 pb-2 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
|
|
12268
12770
|
"input",
|
|
12269
12771
|
{
|
|
12270
12772
|
ref: inputRef,
|
|
@@ -12282,8 +12784,8 @@ function SelectSearchInput({
|
|
|
12282
12784
|
}
|
|
12283
12785
|
|
|
12284
12786
|
// src/dashboard/_select-internals/SelectTrigger.tsx
|
|
12285
|
-
var
|
|
12286
|
-
var
|
|
12787
|
+
var import_lucide_react43 = require("lucide-react");
|
|
12788
|
+
var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
12287
12789
|
function SelectTrigger({
|
|
12288
12790
|
triggerRef,
|
|
12289
12791
|
triggerId,
|
|
@@ -12304,7 +12806,7 @@ function SelectTrigger({
|
|
|
12304
12806
|
onBlur
|
|
12305
12807
|
}) {
|
|
12306
12808
|
const isEmpty = !hasValue;
|
|
12307
|
-
return /* @__PURE__ */ (0,
|
|
12809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
|
|
12308
12810
|
"button",
|
|
12309
12811
|
{
|
|
12310
12812
|
id: triggerId,
|
|
@@ -12328,11 +12830,11 @@ function SelectTrigger({
|
|
|
12328
12830
|
loading && "cursor-progress"
|
|
12329
12831
|
),
|
|
12330
12832
|
children: [
|
|
12331
|
-
/* @__PURE__ */ (0,
|
|
12332
|
-
/* @__PURE__ */ (0,
|
|
12333
|
-
loading && /* @__PURE__ */ (0,
|
|
12334
|
-
/* @__PURE__ */ (0,
|
|
12335
|
-
|
|
12833
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: valueLabel ?? (isOpen ? placeholder : null) }),
|
|
12834
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
12835
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
12836
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
12837
|
+
import_lucide_react43.ChevronDown,
|
|
12336
12838
|
{
|
|
12337
12839
|
size: 16,
|
|
12338
12840
|
className: cn(
|
|
@@ -12386,7 +12888,7 @@ function useSelectIds({
|
|
|
12386
12888
|
var React46 = __toESM(require("react"), 1);
|
|
12387
12889
|
function useSelectMenuState({
|
|
12388
12890
|
isBlocked,
|
|
12389
|
-
isMobile:
|
|
12891
|
+
isMobile: isMobile3,
|
|
12390
12892
|
onOutsideClick
|
|
12391
12893
|
}) {
|
|
12392
12894
|
const containerRef = React46.useRef(null);
|
|
@@ -12407,7 +12909,7 @@ function useSelectMenuState({
|
|
|
12407
12909
|
setIsOpen(false);
|
|
12408
12910
|
onOutsideClick?.();
|
|
12409
12911
|
},
|
|
12410
|
-
isDisabled: !isOpen ||
|
|
12912
|
+
isDisabled: !isOpen || isMobile3
|
|
12411
12913
|
});
|
|
12412
12914
|
React46.useEffect(() => {
|
|
12413
12915
|
if (isBlocked) setIsOpen(false);
|
|
@@ -12432,7 +12934,7 @@ function useSelectSearch({
|
|
|
12432
12934
|
}
|
|
12433
12935
|
|
|
12434
12936
|
// src/dashboard/select/Select.tsx
|
|
12435
|
-
var
|
|
12937
|
+
var import_jsx_runtime152 = require("react/jsx-runtime");
|
|
12436
12938
|
function DashboardSelectInternal({
|
|
12437
12939
|
options = [],
|
|
12438
12940
|
value,
|
|
@@ -12466,8 +12968,8 @@ function DashboardSelectInternal({
|
|
|
12466
12968
|
const listRef = React48.useRef(null);
|
|
12467
12969
|
const optionRefs = React48.useRef([]);
|
|
12468
12970
|
const [highlightedIndex, setHighlightedIndex] = React48.useState(-1);
|
|
12469
|
-
const
|
|
12470
|
-
const { t } = (0,
|
|
12971
|
+
const isMobile3 = useIsMobile();
|
|
12972
|
+
const { t } = (0, import_react_i18next30.useTranslation)();
|
|
12471
12973
|
const resolvedSearchPlaceholder = searchPlaceholder ?? t("search_placeholder");
|
|
12472
12974
|
const hasValue = Boolean(value);
|
|
12473
12975
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
@@ -12477,7 +12979,7 @@ function DashboardSelectInternal({
|
|
|
12477
12979
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
12478
12980
|
const { containerRef, isOpen, closeMenu, toggleMenu, setIsOpen } = useSelectMenuState({
|
|
12479
12981
|
isBlocked,
|
|
12480
|
-
isMobile:
|
|
12982
|
+
isMobile: isMobile3
|
|
12481
12983
|
});
|
|
12482
12984
|
const { triggerId, labelId, valueId, listboxId, describedErrorId, errorId, getOptionId: getOptionId2 } = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
12483
12985
|
const { searchValue, setSearchValue, filteredOptions } = useSelectSearch({
|
|
@@ -12556,7 +13058,7 @@ function DashboardSelectInternal({
|
|
|
12556
13058
|
setIsOpen(false);
|
|
12557
13059
|
}
|
|
12558
13060
|
};
|
|
12559
|
-
return /* @__PURE__ */ (0,
|
|
13061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
|
|
12560
13062
|
SelectFieldShell,
|
|
12561
13063
|
{
|
|
12562
13064
|
containerRef,
|
|
@@ -12574,7 +13076,7 @@ function DashboardSelectInternal({
|
|
|
12574
13076
|
name,
|
|
12575
13077
|
hiddenValue: value ? String(value.value) : "",
|
|
12576
13078
|
children: [
|
|
12577
|
-
/* @__PURE__ */ (0,
|
|
13079
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
12578
13080
|
SelectTrigger,
|
|
12579
13081
|
{
|
|
12580
13082
|
triggerRef,
|
|
@@ -12596,7 +13098,7 @@ function DashboardSelectInternal({
|
|
|
12596
13098
|
onBlur
|
|
12597
13099
|
}
|
|
12598
13100
|
),
|
|
12599
|
-
/* @__PURE__ */ (0,
|
|
13101
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
12600
13102
|
Fieldset,
|
|
12601
13103
|
{
|
|
12602
13104
|
isFocused: isOpen,
|
|
@@ -12613,17 +13115,17 @@ function DashboardSelectInternal({
|
|
|
12613
13115
|
onClick: !isBlocked ? toggleMenu : void 0
|
|
12614
13116
|
}
|
|
12615
13117
|
),
|
|
12616
|
-
/* @__PURE__ */ (0,
|
|
13118
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
|
|
12617
13119
|
SelectMenuPanel,
|
|
12618
13120
|
{
|
|
12619
13121
|
isOpen,
|
|
12620
|
-
isMobile:
|
|
13122
|
+
isMobile: isMobile3,
|
|
12621
13123
|
onClose: closeMenu,
|
|
12622
13124
|
title: typeof label === "string" ? label : void 0,
|
|
12623
13125
|
className: dropdownClassName,
|
|
12624
13126
|
drawerClassName,
|
|
12625
13127
|
children: [
|
|
12626
|
-
searchable && /* @__PURE__ */ (0,
|
|
13128
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
12627
13129
|
SelectSearchInput,
|
|
12628
13130
|
{
|
|
12629
13131
|
inputRef: searchInputRef,
|
|
@@ -12635,7 +13137,7 @@ function DashboardSelectInternal({
|
|
|
12635
13137
|
onKeyDown: handleSearchKeyDown
|
|
12636
13138
|
}
|
|
12637
13139
|
),
|
|
12638
|
-
/* @__PURE__ */ (0,
|
|
13140
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
12639
13141
|
SelectMenu,
|
|
12640
13142
|
{
|
|
12641
13143
|
id: listboxId,
|
|
@@ -12669,23 +13171,23 @@ var DashboardSelect = React48.forwardRef(
|
|
|
12669
13171
|
|
|
12670
13172
|
// src/dashboard/multi-select/MultiSelect.tsx
|
|
12671
13173
|
var React49 = __toESM(require("react"), 1);
|
|
12672
|
-
var
|
|
12673
|
-
var
|
|
13174
|
+
var import_lucide_react45 = require("lucide-react");
|
|
13175
|
+
var import_react_i18next32 = require("react-i18next");
|
|
12674
13176
|
|
|
12675
13177
|
// src/dashboard/multi-select/MultiSelectChip.tsx
|
|
12676
|
-
var
|
|
12677
|
-
var
|
|
12678
|
-
var
|
|
13178
|
+
var import_lucide_react44 = require("lucide-react");
|
|
13179
|
+
var import_react_i18next31 = require("react-i18next");
|
|
13180
|
+
var import_jsx_runtime153 = require("react/jsx-runtime");
|
|
12679
13181
|
function MultiSelectChip({
|
|
12680
13182
|
option,
|
|
12681
13183
|
readOnly,
|
|
12682
13184
|
onRemove
|
|
12683
13185
|
}) {
|
|
12684
|
-
const { t } = (0,
|
|
13186
|
+
const { t } = (0, import_react_i18next31.useTranslation)();
|
|
12685
13187
|
const labelText = typeof option.label === "string" ? option.label : String(option.value);
|
|
12686
|
-
return /* @__PURE__ */ (0,
|
|
12687
|
-
/* @__PURE__ */ (0,
|
|
12688
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("span", { className: "inline-flex items-center gap-2 rounded-[4px] border border-[#acacd5] bg-[#f0f0f8] py-[2px] pl-[10px] pr-1 text-[12px] font-medium text-[var(--chekin-color-brand-navy)]", children: [
|
|
13189
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "whitespace-nowrap", children: option.label }),
|
|
13190
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
12689
13191
|
"button",
|
|
12690
13192
|
{
|
|
12691
13193
|
type: "button",
|
|
@@ -12695,14 +13197,14 @@ function MultiSelectChip({
|
|
|
12695
13197
|
},
|
|
12696
13198
|
className: "flex h-[15px] w-[15px] items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] hover:shadow-[0_3px_3px_#0f477734]",
|
|
12697
13199
|
"aria-label": t("remove_item", { label: labelText }),
|
|
12698
|
-
children: /* @__PURE__ */ (0,
|
|
13200
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_lucide_react44.SquareX, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
12699
13201
|
}
|
|
12700
13202
|
)
|
|
12701
13203
|
] });
|
|
12702
13204
|
}
|
|
12703
13205
|
|
|
12704
13206
|
// src/dashboard/multi-select/MultiSelect.tsx
|
|
12705
|
-
var
|
|
13207
|
+
var import_jsx_runtime154 = require("react/jsx-runtime");
|
|
12706
13208
|
var isValueSelected = (selected, option) => selected.some((item) => item.value === option.value);
|
|
12707
13209
|
function DashboardMultiSelectInternal({
|
|
12708
13210
|
options = [],
|
|
@@ -12742,8 +13244,8 @@ function DashboardMultiSelectInternal({
|
|
|
12742
13244
|
const optionRefs = React49.useRef([]);
|
|
12743
13245
|
const [isFocused, setIsFocused] = React49.useState(false);
|
|
12744
13246
|
const [highlightedIndex, setHighlightedIndex] = React49.useState(-1);
|
|
12745
|
-
const
|
|
12746
|
-
const { t } = (0,
|
|
13247
|
+
const isMobile3 = useIsMobile();
|
|
13248
|
+
const { t } = (0, import_react_i18next32.useTranslation)();
|
|
12747
13249
|
const selectedValues = React49.useMemo(() => value ?? [], [value]);
|
|
12748
13250
|
const hasValue = selectedValues.length > 0;
|
|
12749
13251
|
const isEmpty = !hasValue;
|
|
@@ -12753,7 +13255,7 @@ function DashboardMultiSelectInternal({
|
|
|
12753
13255
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
12754
13256
|
const { containerRef, isOpen, closeMenu, setIsOpen } = useSelectMenuState({
|
|
12755
13257
|
isBlocked,
|
|
12756
|
-
isMobile:
|
|
13258
|
+
isMobile: isMobile3,
|
|
12757
13259
|
onOutsideClick: () => setIsFocused(false)
|
|
12758
13260
|
});
|
|
12759
13261
|
const { triggerId, labelId, valueId, listboxId, describedErrorId, errorId, getOptionId: getOptionId2 } = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
@@ -12795,12 +13297,12 @@ function DashboardMultiSelectInternal({
|
|
|
12795
13297
|
});
|
|
12796
13298
|
}, [isOpen, filteredOptions]);
|
|
12797
13299
|
React49.useEffect(() => {
|
|
12798
|
-
if (!isOpen || !
|
|
13300
|
+
if (!isOpen || !isMobile3) return;
|
|
12799
13301
|
const frame = window.requestAnimationFrame(
|
|
12800
13302
|
() => mobileSearchInputRef.current?.focus()
|
|
12801
13303
|
);
|
|
12802
13304
|
return () => window.cancelAnimationFrame(frame);
|
|
12803
|
-
}, [isOpen,
|
|
13305
|
+
}, [isOpen, isMobile3]);
|
|
12804
13306
|
const openMenu = () => {
|
|
12805
13307
|
if (isBlocked) return;
|
|
12806
13308
|
setIsOpen(true);
|
|
@@ -12897,7 +13399,7 @@ function DashboardMultiSelectInternal({
|
|
|
12897
13399
|
setIsFocused(false);
|
|
12898
13400
|
onBlur?.(event);
|
|
12899
13401
|
};
|
|
12900
|
-
return /* @__PURE__ */ (0,
|
|
13402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
|
|
12901
13403
|
SelectFieldShell,
|
|
12902
13404
|
{
|
|
12903
13405
|
containerRef,
|
|
@@ -12916,7 +13418,7 @@ function DashboardMultiSelectInternal({
|
|
|
12916
13418
|
hiddenValue: selectedValues.map((item) => String(item.value)).join(","),
|
|
12917
13419
|
onBlur: handleInputBlur,
|
|
12918
13420
|
children: [
|
|
12919
|
-
/* @__PURE__ */ (0,
|
|
13421
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
|
|
12920
13422
|
"div",
|
|
12921
13423
|
{
|
|
12922
13424
|
id: triggerId,
|
|
@@ -12939,7 +13441,7 @@ function DashboardMultiSelectInternal({
|
|
|
12939
13441
|
),
|
|
12940
13442
|
children: [
|
|
12941
13443
|
selectedValues.map(
|
|
12942
|
-
(option) => renderChip ? /* @__PURE__ */ (0,
|
|
13444
|
+
(option) => renderChip ? /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(React49.Fragment, { children: renderChip(option, () => removeOption(option)) }, String(option.value)) : /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
12943
13445
|
MultiSelectChip,
|
|
12944
13446
|
{
|
|
12945
13447
|
option,
|
|
@@ -12949,7 +13451,7 @@ function DashboardMultiSelectInternal({
|
|
|
12949
13451
|
String(option.value)
|
|
12950
13452
|
)
|
|
12951
13453
|
),
|
|
12952
|
-
/* @__PURE__ */ (0,
|
|
13454
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
12953
13455
|
"input",
|
|
12954
13456
|
{
|
|
12955
13457
|
ref: inputRef,
|
|
@@ -12978,9 +13480,9 @@ function DashboardMultiSelectInternal({
|
|
|
12978
13480
|
"aria-activedescendant": isOpen && highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0
|
|
12979
13481
|
}
|
|
12980
13482
|
),
|
|
12981
|
-
/* @__PURE__ */ (0,
|
|
12982
|
-
loading && /* @__PURE__ */ (0,
|
|
12983
|
-
hasValue && !readOnly && /* @__PURE__ */ (0,
|
|
13483
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("span", { className: "ml-auto flex items-center gap-2 pl-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
13484
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
13485
|
+
hasValue && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
12984
13486
|
"button",
|
|
12985
13487
|
{
|
|
12986
13488
|
type: "button",
|
|
@@ -12990,10 +13492,10 @@ function DashboardMultiSelectInternal({
|
|
|
12990
13492
|
},
|
|
12991
13493
|
className: "flex h-5 w-5 items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] hover:shadow-[0_3px_3px_#0f477734]",
|
|
12992
13494
|
"aria-label": t("clear_all"),
|
|
12993
|
-
children: /* @__PURE__ */ (0,
|
|
13495
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(import_lucide_react45.SquareX, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
12994
13496
|
}
|
|
12995
13497
|
),
|
|
12996
|
-
/* @__PURE__ */ (0,
|
|
13498
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
12997
13499
|
RotateArrow,
|
|
12998
13500
|
{
|
|
12999
13501
|
shouldRotate: isOpen,
|
|
@@ -13006,7 +13508,7 @@ function DashboardMultiSelectInternal({
|
|
|
13006
13508
|
]
|
|
13007
13509
|
}
|
|
13008
13510
|
),
|
|
13009
|
-
/* @__PURE__ */ (0,
|
|
13511
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
13010
13512
|
Fieldset,
|
|
13011
13513
|
{
|
|
13012
13514
|
isFocused: isFocused || isOpen,
|
|
@@ -13024,11 +13526,11 @@ function DashboardMultiSelectInternal({
|
|
|
13024
13526
|
onClick: handleContainerClick
|
|
13025
13527
|
}
|
|
13026
13528
|
),
|
|
13027
|
-
/* @__PURE__ */ (0,
|
|
13529
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
|
|
13028
13530
|
SelectMenuPanel,
|
|
13029
13531
|
{
|
|
13030
13532
|
isOpen,
|
|
13031
|
-
isMobile:
|
|
13533
|
+
isMobile: isMobile3,
|
|
13032
13534
|
onClose: () => {
|
|
13033
13535
|
closeMenu();
|
|
13034
13536
|
setIsFocused(false);
|
|
@@ -13037,7 +13539,7 @@ function DashboardMultiSelectInternal({
|
|
|
13037
13539
|
className: dropdownClassName,
|
|
13038
13540
|
drawerClassName,
|
|
13039
13541
|
children: [
|
|
13040
|
-
|
|
13542
|
+
isMobile3 && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)("div", { className: "border-b border-[#f2f4f8] px-4 pb-2 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
13041
13543
|
"input",
|
|
13042
13544
|
{
|
|
13043
13545
|
ref: mobileSearchInputRef,
|
|
@@ -13052,7 +13554,7 @@ function DashboardMultiSelectInternal({
|
|
|
13052
13554
|
className: "m-0 box-border h-9 w-full rounded-md border border-[var(--chekin-color-gray-3)] bg-white px-3 text-[16px] font-medium text-[var(--chekin-color-brand-navy)] outline-none transition-colors placeholder:text-[var(--chekin-color-gray-1)] focus:border-[var(--chekin-color-brand-blue)]"
|
|
13053
13555
|
}
|
|
13054
13556
|
) }),
|
|
13055
|
-
/* @__PURE__ */ (0,
|
|
13557
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
13056
13558
|
SelectMenu,
|
|
13057
13559
|
{
|
|
13058
13560
|
id: listboxId,
|
|
@@ -13074,7 +13576,7 @@ function DashboardMultiSelectInternal({
|
|
|
13074
13576
|
isMulti: true
|
|
13075
13577
|
}
|
|
13076
13578
|
),
|
|
13077
|
-
canCreateNewOption && /* @__PURE__ */ (0,
|
|
13579
|
+
canCreateNewOption && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
13078
13580
|
"button",
|
|
13079
13581
|
{
|
|
13080
13582
|
type: "button",
|
|
@@ -13096,20 +13598,20 @@ var DashboardMultiSelect = React49.forwardRef(
|
|
|
13096
13598
|
|
|
13097
13599
|
// src/dashboard/creatable-multi-select/CreatableMultiSelect.tsx
|
|
13098
13600
|
var React50 = __toESM(require("react"), 1);
|
|
13099
|
-
var
|
|
13601
|
+
var import_jsx_runtime155 = require("react/jsx-runtime");
|
|
13100
13602
|
var DashboardCreatableMultiSelect = React50.forwardRef(
|
|
13101
13603
|
function DashboardCreatableMultiSelect2(props, ref) {
|
|
13102
|
-
return /* @__PURE__ */ (0,
|
|
13604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(DashboardMultiSelect, { ref, ...props, isCreatable: true });
|
|
13103
13605
|
}
|
|
13104
13606
|
);
|
|
13105
13607
|
|
|
13106
13608
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
13107
13609
|
var React51 = __toESM(require("react"), 1);
|
|
13108
13610
|
var import_react_virtual2 = require("@tanstack/react-virtual");
|
|
13109
|
-
var
|
|
13611
|
+
var import_react_i18next33 = require("react-i18next");
|
|
13110
13612
|
|
|
13111
13613
|
// src/dashboard/infinite-scroll-select/InfiniteScrollList.tsx
|
|
13112
|
-
var
|
|
13614
|
+
var import_jsx_runtime156 = require("react/jsx-runtime");
|
|
13113
13615
|
function InfiniteScrollList({
|
|
13114
13616
|
scrollRef,
|
|
13115
13617
|
listboxId,
|
|
@@ -13130,13 +13632,13 @@ function InfiniteScrollList({
|
|
|
13130
13632
|
onHighlight
|
|
13131
13633
|
}) {
|
|
13132
13634
|
const virtualItems = virtualizer.getVirtualItems();
|
|
13133
|
-
return /* @__PURE__ */ (0,
|
|
13635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
13134
13636
|
"div",
|
|
13135
13637
|
{
|
|
13136
13638
|
ref: scrollRef,
|
|
13137
13639
|
className: cn("overflow-y-auto", menuClassName),
|
|
13138
13640
|
style: { height: `${height}px` },
|
|
13139
|
-
children: /* @__PURE__ */ (0,
|
|
13641
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
13140
13642
|
"div",
|
|
13141
13643
|
{
|
|
13142
13644
|
id: listboxId,
|
|
@@ -13153,7 +13655,7 @@ function InfiniteScrollList({
|
|
|
13153
13655
|
const isSelected = !isLoaderRow && option ? option.value === value?.value : false;
|
|
13154
13656
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
13155
13657
|
const isOptionDisabled = Boolean(isBlocked || option?.isDisabled);
|
|
13156
|
-
return /* @__PURE__ */ (0,
|
|
13658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
13157
13659
|
"div",
|
|
13158
13660
|
{
|
|
13159
13661
|
"data-index": virtualItem.index,
|
|
@@ -13162,10 +13664,10 @@ function InfiniteScrollList({
|
|
|
13162
13664
|
height: `${virtualItem.size}px`,
|
|
13163
13665
|
transform: `translateY(${virtualItem.start}px)`
|
|
13164
13666
|
},
|
|
13165
|
-
children: isLoaderRow ? /* @__PURE__ */ (0,
|
|
13166
|
-
/* @__PURE__ */ (0,
|
|
13167
|
-
/* @__PURE__ */ (0,
|
|
13168
|
-
] }) : /* @__PURE__ */ (0,
|
|
13667
|
+
children: isLoaderRow ? /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "flex h-full items-center justify-center gap-2 px-4 text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: [
|
|
13668
|
+
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)(ThreeDotsLoader, { height: 36, width: 36 }),
|
|
13669
|
+
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)("span", { children: loadingMoreText })
|
|
13670
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)(
|
|
13169
13671
|
"button",
|
|
13170
13672
|
{
|
|
13171
13673
|
id: getOptionId2(virtualItem.index),
|
|
@@ -13184,8 +13686,8 @@ function InfiniteScrollList({
|
|
|
13184
13686
|
isOptionDisabled && "cursor-default opacity-30"
|
|
13185
13687
|
),
|
|
13186
13688
|
children: [
|
|
13187
|
-
/* @__PURE__ */ (0,
|
|
13188
|
-
option?.description && /* @__PURE__ */ (0,
|
|
13689
|
+
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)("span", { className: "block break-words", children: option?.label }),
|
|
13690
|
+
option?.description && /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("span", { className: "ml-2 mt-[3px] shrink-0 text-[12px] font-bold italic text-[#777e91]", children: option.description })
|
|
13189
13691
|
]
|
|
13190
13692
|
}
|
|
13191
13693
|
)
|
|
@@ -13200,7 +13702,7 @@ function InfiniteScrollList({
|
|
|
13200
13702
|
}
|
|
13201
13703
|
|
|
13202
13704
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
13203
|
-
var
|
|
13705
|
+
var import_jsx_runtime157 = require("react/jsx-runtime");
|
|
13204
13706
|
var DEFAULT_ITEM_HEIGHT = 60;
|
|
13205
13707
|
var DEFAULT_LIST_HEIGHT = 322;
|
|
13206
13708
|
var DEFAULT_OVERSCAN = 5;
|
|
@@ -13248,8 +13750,8 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13248
13750
|
const previousHighlightedIndexRef = React51.useRef(-1);
|
|
13249
13751
|
const lastLoadMoreOptionsLengthRef = React51.useRef(null);
|
|
13250
13752
|
const [highlightedIndex, setHighlightedIndex] = React51.useState(-1);
|
|
13251
|
-
const
|
|
13252
|
-
const { t } = (0,
|
|
13753
|
+
const isMobile3 = useIsMobile();
|
|
13754
|
+
const { t } = (0, import_react_i18next33.useTranslation)();
|
|
13253
13755
|
const resolvedSearchPlaceholder = searchPlaceholder ?? t("search_placeholder");
|
|
13254
13756
|
const resolvedLoadingMoreText = loadingMoreText ?? t("loading_more");
|
|
13255
13757
|
const hasValue = Boolean(value);
|
|
@@ -13260,7 +13762,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13260
13762
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
13261
13763
|
const { containerRef, isOpen, closeMenu, toggleMenu, setIsOpen } = useSelectMenuState({
|
|
13262
13764
|
isBlocked,
|
|
13263
|
-
isMobile:
|
|
13765
|
+
isMobile: isMobile3
|
|
13264
13766
|
});
|
|
13265
13767
|
const { triggerId, labelId, valueId, listboxId, describedErrorId, errorId, getOptionId: getOptionId2 } = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
13266
13768
|
const { searchValue, setSearchValue, filteredOptions } = useSelectSearch({
|
|
@@ -13373,7 +13875,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13373
13875
|
const totalSize = virtualizer.getTotalSize();
|
|
13374
13876
|
const measuredListHeight = Math.min(listHeight, Math.max(totalSize, itemHeight));
|
|
13375
13877
|
const activeOptionId = highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0;
|
|
13376
|
-
return /* @__PURE__ */ (0,
|
|
13878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(
|
|
13377
13879
|
SelectFieldShell,
|
|
13378
13880
|
{
|
|
13379
13881
|
containerRef,
|
|
@@ -13391,7 +13893,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13391
13893
|
name,
|
|
13392
13894
|
hiddenValue: value ? String(value.value) : "",
|
|
13393
13895
|
children: [
|
|
13394
|
-
/* @__PURE__ */ (0,
|
|
13896
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
13395
13897
|
SelectTrigger,
|
|
13396
13898
|
{
|
|
13397
13899
|
triggerRef,
|
|
@@ -13413,7 +13915,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13413
13915
|
onBlur
|
|
13414
13916
|
}
|
|
13415
13917
|
),
|
|
13416
|
-
/* @__PURE__ */ (0,
|
|
13918
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
13417
13919
|
Fieldset,
|
|
13418
13920
|
{
|
|
13419
13921
|
isFocused: isOpen,
|
|
@@ -13430,17 +13932,17 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13430
13932
|
onClick: !isBlocked ? toggleMenu : void 0
|
|
13431
13933
|
}
|
|
13432
13934
|
),
|
|
13433
|
-
/* @__PURE__ */ (0,
|
|
13935
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(
|
|
13434
13936
|
SelectMenuPanel,
|
|
13435
13937
|
{
|
|
13436
13938
|
isOpen,
|
|
13437
|
-
isMobile:
|
|
13939
|
+
isMobile: isMobile3,
|
|
13438
13940
|
onClose: closeMenu,
|
|
13439
13941
|
title: typeof label === "string" ? label : void 0,
|
|
13440
13942
|
className: dropdownClassName,
|
|
13441
13943
|
drawerClassName,
|
|
13442
13944
|
children: [
|
|
13443
|
-
searchable && /* @__PURE__ */ (0,
|
|
13945
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
13444
13946
|
SelectSearchInput,
|
|
13445
13947
|
{
|
|
13446
13948
|
inputRef: searchInputRef,
|
|
@@ -13452,10 +13954,10 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13452
13954
|
onKeyDown: handleSearchKeyDown
|
|
13453
13955
|
}
|
|
13454
13956
|
),
|
|
13455
|
-
filteredOptions.length === 0 && isLoadingMore ? /* @__PURE__ */ (0,
|
|
13456
|
-
/* @__PURE__ */ (0,
|
|
13457
|
-
/* @__PURE__ */ (0,
|
|
13458
|
-
] }) : filteredOptions.length === 0 ? /* @__PURE__ */ (0,
|
|
13957
|
+
filteredOptions.length === 0 && isLoadingMore ? /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex items-center justify-center gap-2 px-4 py-[20px] text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: [
|
|
13958
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
13959
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)("span", { children: resolvedLoadingMoreText })
|
|
13960
|
+
] }) : filteredOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("div", { className: "px-4 py-[20px] text-left text-[16px] text-[var(--chekin-color-brand-navy)]", children: emptyMessage ?? t("no_options") }) : /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
13459
13961
|
InfiniteScrollList,
|
|
13460
13962
|
{
|
|
13461
13963
|
scrollRef,
|
|
@@ -13490,8 +13992,8 @@ var DashboardInfiniteScrollSelect = React51.forwardRef(
|
|
|
13490
13992
|
|
|
13491
13993
|
// src/dashboard/textarea/Textarea.tsx
|
|
13492
13994
|
var React52 = __toESM(require("react"), 1);
|
|
13493
|
-
var
|
|
13494
|
-
var
|
|
13995
|
+
var import_react_i18next34 = require("react-i18next");
|
|
13996
|
+
var import_jsx_runtime158 = require("react/jsx-runtime");
|
|
13495
13997
|
var LINE_HEIGHT = 20;
|
|
13496
13998
|
var VERTICAL_PADDING = 32;
|
|
13497
13999
|
function getEmptyState(empty, value, defaultValue) {
|
|
@@ -13527,7 +14029,7 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13527
14029
|
const combinedRef = useCombinedRef(ref, innerRef);
|
|
13528
14030
|
const reactId = React52.useId();
|
|
13529
14031
|
const textareaId = id ?? name ?? `dash-textarea-${reactId}`;
|
|
13530
|
-
const { t } = (0,
|
|
14032
|
+
const { t } = (0, import_react_i18next34.useTranslation)();
|
|
13531
14033
|
const isInvalid = Boolean(invalid || error);
|
|
13532
14034
|
const isEmpty = getEmptyState(empty, value, defaultValue);
|
|
13533
14035
|
const isBlocked = Boolean(disabled);
|
|
@@ -13548,7 +14050,7 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13548
14050
|
resize();
|
|
13549
14051
|
onInput?.(event);
|
|
13550
14052
|
};
|
|
13551
|
-
return /* @__PURE__ */ (0,
|
|
14053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
|
|
13552
14054
|
"div",
|
|
13553
14055
|
{
|
|
13554
14056
|
className: cn(
|
|
@@ -13558,18 +14060,18 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13558
14060
|
className
|
|
13559
14061
|
),
|
|
13560
14062
|
children: [
|
|
13561
|
-
label && /* @__PURE__ */ (0,
|
|
14063
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
|
|
13562
14064
|
"label",
|
|
13563
14065
|
{
|
|
13564
14066
|
htmlFor: textareaId,
|
|
13565
14067
|
className: "mb-2 flex select-none items-center text-[16px] font-medium text-[var(--chekin-color-brand-navy)]",
|
|
13566
14068
|
children: [
|
|
13567
14069
|
label,
|
|
13568
|
-
tooltip && /* @__PURE__ */ (0,
|
|
14070
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "ml-1 inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(HelpTooltip, { content: tooltip, size: 16 }) })
|
|
13569
14071
|
]
|
|
13570
14072
|
}
|
|
13571
14073
|
),
|
|
13572
|
-
/* @__PURE__ */ (0,
|
|
14074
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
13573
14075
|
"textarea",
|
|
13574
14076
|
{
|
|
13575
14077
|
ref: combinedRef,
|
|
@@ -13598,7 +14100,7 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13598
14100
|
...textareaProps
|
|
13599
14101
|
}
|
|
13600
14102
|
),
|
|
13601
|
-
error && /* @__PURE__ */ (0,
|
|
14103
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
13602
14104
|
FieldErrorMessage,
|
|
13603
14105
|
{
|
|
13604
14106
|
id: `${textareaId}-error`,
|
|
@@ -13606,8 +14108,8 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13606
14108
|
className: "mt-[1px] text-[14px]"
|
|
13607
14109
|
}
|
|
13608
14110
|
),
|
|
13609
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
13610
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
14111
|
+
!error && optional && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
14112
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText })
|
|
13611
14113
|
]
|
|
13612
14114
|
}
|
|
13613
14115
|
);
|
|
@@ -13616,8 +14118,8 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13616
14118
|
|
|
13617
14119
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
13618
14120
|
var React54 = __toESM(require("react"), 1);
|
|
13619
|
-
var
|
|
13620
|
-
var
|
|
14121
|
+
var import_lucide_react46 = require("lucide-react");
|
|
14122
|
+
var import_react_i18next35 = require("react-i18next");
|
|
13621
14123
|
|
|
13622
14124
|
// src/airbnb-fields/datepicker/useDatePickerWheel.ts
|
|
13623
14125
|
var React53 = __toESM(require("react"), 1);
|
|
@@ -14041,7 +14543,7 @@ function useDatePickerWheel({
|
|
|
14041
14543
|
}
|
|
14042
14544
|
|
|
14043
14545
|
// src/airbnb-fields/datepicker/DatePickerWheelColumn.tsx
|
|
14044
|
-
var
|
|
14546
|
+
var import_jsx_runtime159 = require("react/jsx-runtime");
|
|
14045
14547
|
var spacerHeight = DATE_PICKER_OPTION_HEIGHT * DATE_PICKER_WHEEL_BUFFER_OPTIONS;
|
|
14046
14548
|
function AirbnbDatePickerWheelColumn({
|
|
14047
14549
|
id,
|
|
@@ -14055,7 +14557,7 @@ function AirbnbDatePickerWheelColumn({
|
|
|
14055
14557
|
onOptionSelect,
|
|
14056
14558
|
column
|
|
14057
14559
|
}) {
|
|
14058
|
-
return /* @__PURE__ */ (0,
|
|
14560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { className: "relative z-10 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(
|
|
14059
14561
|
"div",
|
|
14060
14562
|
{
|
|
14061
14563
|
id,
|
|
@@ -14072,14 +14574,14 @@ function AirbnbDatePickerWheelColumn({
|
|
|
14072
14574
|
WebkitOverflowScrolling: "touch"
|
|
14073
14575
|
},
|
|
14074
14576
|
children: [
|
|
14075
|
-
/* @__PURE__ */ (0,
|
|
14577
|
+
/* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { style: { height: `${spacerHeight}px` } }),
|
|
14076
14578
|
items.map((item, index) => {
|
|
14077
14579
|
const { style } = getWheelOptionStyles(
|
|
14078
14580
|
index,
|
|
14079
14581
|
scrollTop,
|
|
14080
14582
|
DATE_PICKER_OPTION_HEIGHT
|
|
14081
14583
|
);
|
|
14082
|
-
return /* @__PURE__ */ (0,
|
|
14584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
14083
14585
|
"button",
|
|
14084
14586
|
{
|
|
14085
14587
|
id: `${id}-option-${index}`,
|
|
@@ -14095,14 +14597,14 @@ function AirbnbDatePickerWheelColumn({
|
|
|
14095
14597
|
`${column}-${item}-${index}`
|
|
14096
14598
|
);
|
|
14097
14599
|
}),
|
|
14098
|
-
/* @__PURE__ */ (0,
|
|
14600
|
+
/* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { style: { height: `${spacerHeight}px` } })
|
|
14099
14601
|
]
|
|
14100
14602
|
}
|
|
14101
14603
|
) });
|
|
14102
14604
|
}
|
|
14103
14605
|
|
|
14104
14606
|
// src/airbnb-fields/datepicker/DatePickerContent.tsx
|
|
14105
|
-
var
|
|
14607
|
+
var import_jsx_runtime160 = require("react/jsx-runtime");
|
|
14106
14608
|
function AirbnbDatePickerBody({
|
|
14107
14609
|
baseId,
|
|
14108
14610
|
label,
|
|
@@ -14124,19 +14626,19 @@ function AirbnbDatePickerBody({
|
|
|
14124
14626
|
onOptionSelect,
|
|
14125
14627
|
onDone
|
|
14126
14628
|
}) {
|
|
14127
|
-
return /* @__PURE__ */ (0,
|
|
14128
|
-
/* @__PURE__ */ (0,
|
|
14129
|
-
/* @__PURE__ */ (0,
|
|
14130
|
-
/* @__PURE__ */ (0,
|
|
14131
|
-
/* @__PURE__ */ (0,
|
|
14629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: "px-6 pb-4 pt-1 bg-white", children: [
|
|
14630
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: "relative overflow-hidden rounded-[24px]", children: [
|
|
14631
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)("div", { className: "pointer-events-none absolute inset-x-0 top-0 z-20 h-16 bg-gradient-to-b from-white via-white/80 to-transparent" }),
|
|
14632
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 z-20 h-16 bg-gradient-to-t from-white via-white/80 to-transparent" }),
|
|
14633
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
14132
14634
|
"div",
|
|
14133
14635
|
{
|
|
14134
14636
|
"aria-hidden": true,
|
|
14135
14637
|
className: "pointer-events-none absolute inset-x-0 top-1/2 z-0 h-8 -translate-y-1/2 rounded-[12px] bg-black/[0.04]"
|
|
14136
14638
|
}
|
|
14137
14639
|
),
|
|
14138
|
-
/* @__PURE__ */ (0,
|
|
14139
|
-
/* @__PURE__ */ (0,
|
|
14640
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: "relative grid grid-cols-[1.35fr_0.7fr_1fr] gap-1", children: [
|
|
14641
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
14140
14642
|
AirbnbDatePickerWheelColumn,
|
|
14141
14643
|
{
|
|
14142
14644
|
id: `${baseId}-month`,
|
|
@@ -14151,7 +14653,7 @@ function AirbnbDatePickerBody({
|
|
|
14151
14653
|
onOptionSelect
|
|
14152
14654
|
}
|
|
14153
14655
|
),
|
|
14154
|
-
/* @__PURE__ */ (0,
|
|
14656
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
14155
14657
|
AirbnbDatePickerWheelColumn,
|
|
14156
14658
|
{
|
|
14157
14659
|
id: `${baseId}-day`,
|
|
@@ -14166,7 +14668,7 @@ function AirbnbDatePickerBody({
|
|
|
14166
14668
|
onOptionSelect
|
|
14167
14669
|
}
|
|
14168
14670
|
),
|
|
14169
|
-
/* @__PURE__ */ (0,
|
|
14671
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
14170
14672
|
AirbnbDatePickerWheelColumn,
|
|
14171
14673
|
{
|
|
14172
14674
|
id: `${baseId}-year`,
|
|
@@ -14183,13 +14685,13 @@ function AirbnbDatePickerBody({
|
|
|
14183
14685
|
)
|
|
14184
14686
|
] })
|
|
14185
14687
|
] }),
|
|
14186
|
-
/* @__PURE__ */ (0,
|
|
14688
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
14187
14689
|
] });
|
|
14188
14690
|
}
|
|
14189
14691
|
function AirbnbDatePickerContent({
|
|
14190
14692
|
baseId,
|
|
14191
14693
|
open,
|
|
14192
|
-
isMobile:
|
|
14694
|
+
isMobile: isMobile3,
|
|
14193
14695
|
label,
|
|
14194
14696
|
title,
|
|
14195
14697
|
doneLabel,
|
|
@@ -14211,7 +14713,7 @@ function AirbnbDatePickerContent({
|
|
|
14211
14713
|
onColumnKeyDown,
|
|
14212
14714
|
onOptionSelect
|
|
14213
14715
|
}) {
|
|
14214
|
-
const body = /* @__PURE__ */ (0,
|
|
14716
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
14215
14717
|
AirbnbDatePickerBody,
|
|
14216
14718
|
{
|
|
14217
14719
|
baseId,
|
|
@@ -14235,28 +14737,28 @@ function AirbnbDatePickerContent({
|
|
|
14235
14737
|
onDone
|
|
14236
14738
|
}
|
|
14237
14739
|
);
|
|
14238
|
-
if (
|
|
14239
|
-
return /* @__PURE__ */ (0,
|
|
14740
|
+
if (isMobile3) {
|
|
14741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Drawer, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(
|
|
14240
14742
|
DrawerContent,
|
|
14241
14743
|
{
|
|
14242
14744
|
onClose: () => onOpenChange(false),
|
|
14243
14745
|
className: "rounded-none rounded-t-[32px] border-0 p-0",
|
|
14244
14746
|
children: [
|
|
14245
|
-
/* @__PURE__ */ (0,
|
|
14246
|
-
/* @__PURE__ */ (0,
|
|
14747
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(DrawerTitle, { className: "sr-only", children: title }),
|
|
14748
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
14247
14749
|
body
|
|
14248
14750
|
]
|
|
14249
14751
|
}
|
|
14250
14752
|
) });
|
|
14251
14753
|
}
|
|
14252
|
-
return /* @__PURE__ */ (0,
|
|
14754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(
|
|
14253
14755
|
DialogContent,
|
|
14254
14756
|
{
|
|
14255
14757
|
className: "max-w-[520px] rounded-[28px] border-0 p-0 shadow-xl",
|
|
14256
14758
|
showCloseButton: false,
|
|
14257
14759
|
children: [
|
|
14258
|
-
/* @__PURE__ */ (0,
|
|
14259
|
-
/* @__PURE__ */ (0,
|
|
14760
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(DialogTitle, { className: "sr-only", children: title }),
|
|
14761
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(DialogDescription, { className: "sr-only", children: label }),
|
|
14260
14762
|
body
|
|
14261
14763
|
]
|
|
14262
14764
|
}
|
|
@@ -14264,7 +14766,7 @@ function AirbnbDatePickerContent({
|
|
|
14264
14766
|
}
|
|
14265
14767
|
|
|
14266
14768
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
14267
|
-
var
|
|
14769
|
+
var import_jsx_runtime161 = require("react/jsx-runtime");
|
|
14268
14770
|
var MONTHS_IN_YEAR2 = 12;
|
|
14269
14771
|
function getMonthLabels2(locale) {
|
|
14270
14772
|
const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
@@ -14341,7 +14843,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14341
14843
|
const yearId = `${baseId}-year`;
|
|
14342
14844
|
const labelId = `${baseId}-label`;
|
|
14343
14845
|
const errorId = `${baseId}-error`;
|
|
14344
|
-
const { t } = (0,
|
|
14846
|
+
const { t } = (0, import_react_i18next35.useTranslation)();
|
|
14345
14847
|
const resolvedMonthLabels = React54.useMemo(
|
|
14346
14848
|
() => monthLabels ?? getMonthLabels2(locale),
|
|
14347
14849
|
[locale, monthLabels]
|
|
@@ -14364,7 +14866,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14364
14866
|
const [focusedField, setFocusedField] = React54.useState(null);
|
|
14365
14867
|
const [monthInputValue, setMonthInputValue] = React54.useState("");
|
|
14366
14868
|
const [monthHighlightIndex, setMonthHighlightIndex] = React54.useState(-1);
|
|
14367
|
-
const
|
|
14869
|
+
const isMobile3 = useIsMobile();
|
|
14368
14870
|
React54.useImperativeHandle(ref, () => dayInputRef.current, []);
|
|
14369
14871
|
React54.useEffect(() => {
|
|
14370
14872
|
if (!isControlled) return;
|
|
@@ -14414,7 +14916,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14414
14916
|
useOutsideClick({
|
|
14415
14917
|
elementRef: containerRef,
|
|
14416
14918
|
onOutsideClick: () => setIsMonthOpen(false),
|
|
14417
|
-
isDisabled: !isMonthOpen ||
|
|
14919
|
+
isDisabled: !isMonthOpen || isMobile3
|
|
14418
14920
|
});
|
|
14419
14921
|
const emitChange = React54.useCallback(
|
|
14420
14922
|
(nextDay, nextMonth, nextYear) => {
|
|
@@ -14523,8 +15025,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14523
15025
|
setIsWheelOpen(false);
|
|
14524
15026
|
mobileTriggerRef.current?.focus();
|
|
14525
15027
|
}, []);
|
|
14526
|
-
const
|
|
14527
|
-
const showCoverage = isEmpty && !isFocused && !isMobile2;
|
|
15028
|
+
const showCoverage = isEmpty && !isFocused && !isMobile3;
|
|
14528
15029
|
const wheel = useDatePickerWheel({
|
|
14529
15030
|
isOpen: isWheelOpen,
|
|
14530
15031
|
value: currentDate,
|
|
@@ -14548,7 +15049,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14548
15049
|
const triggerText = currentDate ? (formatValue ?? defaultFormatValue)(currentDate) : void 0;
|
|
14549
15050
|
const monthListboxId = `${monthId}-listbox`;
|
|
14550
15051
|
const getMonthOptionId = (index) => `${monthId}-option-${index}`;
|
|
14551
|
-
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */ (0,
|
|
15052
|
+
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("div", { className: "px-4 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: t("no_options") }) : /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14552
15053
|
"ul",
|
|
14553
15054
|
{
|
|
14554
15055
|
ref: monthListRef,
|
|
@@ -14559,7 +15060,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14559
15060
|
children: filteredMonths.map((option, position) => {
|
|
14560
15061
|
const isSelected = option.index === monthIndex;
|
|
14561
15062
|
const isHighlighted = position === monthHighlightIndex;
|
|
14562
|
-
return /* @__PURE__ */ (0,
|
|
15063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14563
15064
|
"button",
|
|
14564
15065
|
{
|
|
14565
15066
|
id: getMonthOptionId(option.index),
|
|
@@ -14586,7 +15087,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14586
15087
|
isBlocked && "cursor-not-allowed",
|
|
14587
15088
|
loading && "cursor-progress"
|
|
14588
15089
|
);
|
|
14589
|
-
return /* @__PURE__ */ (0,
|
|
15090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14590
15091
|
"div",
|
|
14591
15092
|
{
|
|
14592
15093
|
ref: containerRef,
|
|
@@ -14597,9 +15098,9 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14597
15098
|
className
|
|
14598
15099
|
),
|
|
14599
15100
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
14600
|
-
children: /* @__PURE__ */ (0,
|
|
14601
|
-
/* @__PURE__ */ (0,
|
|
14602
|
-
|
|
15101
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("div", { className: "relative min-h-[68px] w-full", children: [
|
|
15102
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("div", { className: "relative w-full", children: [
|
|
15103
|
+
isMobile3 ? /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)(
|
|
14603
15104
|
"button",
|
|
14604
15105
|
{
|
|
14605
15106
|
ref: mobileTriggerRef,
|
|
@@ -14618,11 +15119,11 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14618
15119
|
(isBlocked || readOnly) && "cursor-not-allowed"
|
|
14619
15120
|
),
|
|
14620
15121
|
children: [
|
|
14621
|
-
/* @__PURE__ */ (0,
|
|
14622
|
-
/* @__PURE__ */ (0,
|
|
14623
|
-
loading && /* @__PURE__ */ (0,
|
|
14624
|
-
/* @__PURE__ */ (0,
|
|
14625
|
-
|
|
15122
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { className: "block min-w-0 flex-1 truncate text-left", children: triggerText ?? (isWheelOpen ? mobilePlaceholder : null) }),
|
|
15123
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
15124
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
15125
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
15126
|
+
import_lucide_react46.ChevronDown,
|
|
14626
15127
|
{
|
|
14627
15128
|
size: 16,
|
|
14628
15129
|
className: cn(
|
|
@@ -14634,14 +15135,14 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14634
15135
|
] })
|
|
14635
15136
|
]
|
|
14636
15137
|
}
|
|
14637
|
-
) : /* @__PURE__ */ (0,
|
|
15138
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)(
|
|
14638
15139
|
"div",
|
|
14639
15140
|
{
|
|
14640
15141
|
className: cn(
|
|
14641
15142
|
"relative box-border grid h-12 w-full grid-cols-[minmax(0,1fr)_minmax(96px,140px)_minmax(0,1fr)] items-center rounded-[6px] text-[16px] font-medium text-[var(--chekin-color-brand-navy)]"
|
|
14642
15143
|
),
|
|
14643
15144
|
children: [
|
|
14644
|
-
/* @__PURE__ */ (0,
|
|
15145
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14645
15146
|
"input",
|
|
14646
15147
|
{
|
|
14647
15148
|
ref: dayInputRef,
|
|
@@ -14663,8 +15164,8 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14663
15164
|
className: subInputClass
|
|
14664
15165
|
}
|
|
14665
15166
|
) }),
|
|
14666
|
-
/* @__PURE__ */ (0,
|
|
14667
|
-
/* @__PURE__ */ (0,
|
|
15167
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("div", { className: "relative flex h-full min-w-0 items-center gap-1 border-x border-[var(--chekin-color-gray-3)] px-2 sm:px-3", children: [
|
|
15168
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14668
15169
|
"input",
|
|
14669
15170
|
{
|
|
14670
15171
|
ref: monthInputRef,
|
|
@@ -14707,8 +15208,8 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14707
15208
|
)
|
|
14708
15209
|
}
|
|
14709
15210
|
),
|
|
14710
|
-
/* @__PURE__ */ (0,
|
|
14711
|
-
|
|
15211
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
15212
|
+
import_lucide_react46.ChevronDown,
|
|
14712
15213
|
{
|
|
14713
15214
|
size: 14,
|
|
14714
15215
|
onMouseDown: (event) => {
|
|
@@ -14724,8 +15225,8 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14724
15225
|
}
|
|
14725
15226
|
)
|
|
14726
15227
|
] }),
|
|
14727
|
-
/* @__PURE__ */ (0,
|
|
14728
|
-
/* @__PURE__ */ (0,
|
|
15228
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: [
|
|
15229
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14729
15230
|
"input",
|
|
14730
15231
|
{
|
|
14731
15232
|
ref: yearInputRef,
|
|
@@ -14747,7 +15248,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14747
15248
|
className: subInputClass
|
|
14748
15249
|
}
|
|
14749
15250
|
),
|
|
14750
|
-
loading && /* @__PURE__ */ (0,
|
|
15251
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14751
15252
|
ThreeDotsLoader,
|
|
14752
15253
|
{
|
|
14753
15254
|
height: 18,
|
|
@@ -14759,7 +15260,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14759
15260
|
]
|
|
14760
15261
|
}
|
|
14761
15262
|
),
|
|
14762
|
-
showCoverage && /* @__PURE__ */ (0,
|
|
15263
|
+
showCoverage && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14763
15264
|
"div",
|
|
14764
15265
|
{
|
|
14765
15266
|
className: "absolute inset-0 cursor-text rounded-[6px] bg-[var(--chekin-color-surface-input-empty)]",
|
|
@@ -14767,7 +15268,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14767
15268
|
"aria-hidden": "true"
|
|
14768
15269
|
}
|
|
14769
15270
|
),
|
|
14770
|
-
/* @__PURE__ */ (0,
|
|
15271
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14771
15272
|
Fieldset,
|
|
14772
15273
|
{
|
|
14773
15274
|
isFocused,
|
|
@@ -14782,12 +15283,12 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14782
15283
|
legend: label,
|
|
14783
15284
|
label,
|
|
14784
15285
|
tooltip,
|
|
14785
|
-
onClick:
|
|
15286
|
+
onClick: isMobile3 ? openWheel : showCoverage ? focusDayInput : void 0
|
|
14786
15287
|
}
|
|
14787
15288
|
),
|
|
14788
|
-
isMonthOpen && !
|
|
15289
|
+
isMonthOpen && !isMobile3 && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("div", { className: "absolute left-0 right-0 top-full z-30 mx-auto mt-1 w-full max-w-[260px] overflow-hidden rounded-md bg-white shadow-[0_30px_30px_0_rgba(33,72,255,0.2)] sm:left-1/2 sm:right-auto sm:-translate-x-1/2", children: monthPanelContent })
|
|
14789
15290
|
] }),
|
|
14790
|
-
|
|
15291
|
+
isMobile3 && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14791
15292
|
AirbnbDatePickerContent,
|
|
14792
15293
|
{
|
|
14793
15294
|
baseId: wheelBaseId,
|
|
@@ -14815,9 +15316,9 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14815
15316
|
onOptionSelect: wheel.handleOptionSelect
|
|
14816
15317
|
}
|
|
14817
15318
|
),
|
|
14818
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
14819
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
14820
|
-
error && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
15319
|
+
!error && optional && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
15320
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
15321
|
+
error && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14821
15322
|
FieldErrorMessage,
|
|
14822
15323
|
{
|
|
14823
15324
|
id: errorId,
|
|
@@ -14833,7 +15334,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14833
15334
|
|
|
14834
15335
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
14835
15336
|
var React58 = __toESM(require("react"), 1);
|
|
14836
|
-
var
|
|
15337
|
+
var import_react_i18next36 = require("react-i18next");
|
|
14837
15338
|
|
|
14838
15339
|
// src/dashboard/date-range-picker/isDayBlocked.ts
|
|
14839
15340
|
var import_date_fns2 = require("date-fns");
|
|
@@ -14976,7 +15477,7 @@ function useRangeTextInputs({
|
|
|
14976
15477
|
}
|
|
14977
15478
|
setFromText(value?.from ? format2(value.from) : "");
|
|
14978
15479
|
return void 0;
|
|
14979
|
-
}, [format2, fromText, onBlur, onCommit, parse3, value
|
|
15480
|
+
}, [format2, fromText, onBlur, onCommit, parse3, value]);
|
|
14980
15481
|
const handleToBlur = React56.useCallback(() => {
|
|
14981
15482
|
if (!toText) {
|
|
14982
15483
|
const next = { from: value?.from, to: void 0 };
|
|
@@ -14992,7 +15493,7 @@ function useRangeTextInputs({
|
|
|
14992
15493
|
return;
|
|
14993
15494
|
}
|
|
14994
15495
|
setToText(value?.to ? format2(value.to) : "");
|
|
14995
|
-
}, [format2, onBlur, onCommit, parse3, toText, value
|
|
15496
|
+
}, [format2, onBlur, onCommit, parse3, toText, value]);
|
|
14996
15497
|
return {
|
|
14997
15498
|
fromText,
|
|
14998
15499
|
toText,
|
|
@@ -15043,8 +15544,8 @@ function resolveRangeSelection({
|
|
|
15043
15544
|
}
|
|
15044
15545
|
|
|
15045
15546
|
// src/dashboard/date-range-picker/components/DateRangeInputs.tsx
|
|
15046
|
-
var
|
|
15047
|
-
var
|
|
15547
|
+
var import_lucide_react47 = require("lucide-react");
|
|
15548
|
+
var import_jsx_runtime162 = require("react/jsx-runtime");
|
|
15048
15549
|
var DEFAULT_PLACEHOLDER = "00-00-0000";
|
|
15049
15550
|
var inputBaseClass = "m-0 box-border h-full w-full min-w-0 border-0 bg-transparent text-[16px] font-medium leading-5 text-[var(--chekin-color-brand-navy)] outline-none placeholder:text-[var(--chekin-color-gray-1)]";
|
|
15050
15551
|
var iconButtonClass = "flex h-5 w-5 items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] outline-none hover:shadow-[0_3px_3px_#0f477734] disabled:cursor-not-allowed";
|
|
@@ -15086,7 +15587,7 @@ function DateRangeInputs({
|
|
|
15086
15587
|
isBlocked && "cursor-not-allowed",
|
|
15087
15588
|
loading && "cursor-progress"
|
|
15088
15589
|
);
|
|
15089
|
-
return /* @__PURE__ */ (0,
|
|
15590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(
|
|
15090
15591
|
"div",
|
|
15091
15592
|
{
|
|
15092
15593
|
className: cn(
|
|
@@ -15095,7 +15596,7 @@ function DateRangeInputs({
|
|
|
15095
15596
|
),
|
|
15096
15597
|
onClick: onRowClick,
|
|
15097
15598
|
children: [
|
|
15098
|
-
/* @__PURE__ */ (0,
|
|
15599
|
+
/* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
15099
15600
|
"input",
|
|
15100
15601
|
{
|
|
15101
15602
|
ref: fromInputRef,
|
|
@@ -15119,7 +15620,7 @@ function DateRangeInputs({
|
|
|
15119
15620
|
)
|
|
15120
15621
|
}
|
|
15121
15622
|
),
|
|
15122
|
-
/* @__PURE__ */ (0,
|
|
15623
|
+
/* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
15123
15624
|
"span",
|
|
15124
15625
|
{
|
|
15125
15626
|
"aria-hidden": "true",
|
|
@@ -15130,7 +15631,7 @@ function DateRangeInputs({
|
|
|
15130
15631
|
children: "\u2192"
|
|
15131
15632
|
}
|
|
15132
15633
|
),
|
|
15133
|
-
/* @__PURE__ */ (0,
|
|
15634
|
+
/* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
15134
15635
|
"input",
|
|
15135
15636
|
{
|
|
15136
15637
|
ref: toInputRef,
|
|
@@ -15154,9 +15655,9 @@ function DateRangeInputs({
|
|
|
15154
15655
|
)
|
|
15155
15656
|
}
|
|
15156
15657
|
),
|
|
15157
|
-
/* @__PURE__ */ (0,
|
|
15158
|
-
loading && /* @__PURE__ */ (0,
|
|
15159
|
-
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */ (0,
|
|
15658
|
+
/* @__PURE__ */ (0, import_jsx_runtime162.jsxs)("span", { className: "ml-auto flex shrink-0 items-center gap-2 pl-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
15659
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
15660
|
+
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
15160
15661
|
"button",
|
|
15161
15662
|
{
|
|
15162
15663
|
type: "button",
|
|
@@ -15164,10 +15665,10 @@ function DateRangeInputs({
|
|
|
15164
15665
|
onClick: onReset,
|
|
15165
15666
|
className: iconButtonClass,
|
|
15166
15667
|
"aria-label": clearLabel,
|
|
15167
|
-
children: /* @__PURE__ */ (0,
|
|
15668
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(import_lucide_react47.SquareX, { size: 16, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
15168
15669
|
}
|
|
15169
15670
|
),
|
|
15170
|
-
!readOnly && !hideCalendarIcon && /* @__PURE__ */ (0,
|
|
15671
|
+
!readOnly && !hideCalendarIcon && /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
15171
15672
|
"button",
|
|
15172
15673
|
{
|
|
15173
15674
|
type: "button",
|
|
@@ -15179,7 +15680,7 @@ function DateRangeInputs({
|
|
|
15179
15680
|
focusedInput !== null || isOpen ? "text-[var(--chekin-color-brand-blue)]" : "text-[var(--chekin-color-gray-2)]"
|
|
15180
15681
|
),
|
|
15181
15682
|
"aria-label": openCalendarLabel,
|
|
15182
|
-
children: /* @__PURE__ */ (0,
|
|
15683
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(import_lucide_react47.CalendarDays, { size: 18 })
|
|
15183
15684
|
}
|
|
15184
15685
|
)
|
|
15185
15686
|
] })
|
|
@@ -15189,7 +15690,7 @@ function DateRangeInputs({
|
|
|
15189
15690
|
}
|
|
15190
15691
|
|
|
15191
15692
|
// src/dashboard/date-range-picker/components/DateRangeCalendar.tsx
|
|
15192
|
-
var
|
|
15693
|
+
var import_jsx_runtime163 = require("react/jsx-runtime");
|
|
15193
15694
|
function DateRangeCalendar({
|
|
15194
15695
|
value,
|
|
15195
15696
|
month,
|
|
@@ -15205,7 +15706,7 @@ function DateRangeCalendar({
|
|
|
15205
15706
|
components,
|
|
15206
15707
|
...dayPickerProps
|
|
15207
15708
|
}) {
|
|
15208
|
-
return /* @__PURE__ */ (0,
|
|
15709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
15209
15710
|
Calendar,
|
|
15210
15711
|
{
|
|
15211
15712
|
mode: "range",
|
|
@@ -15228,10 +15729,10 @@ function DateRangeCalendar({
|
|
|
15228
15729
|
}
|
|
15229
15730
|
|
|
15230
15731
|
// src/dashboard/date-range-picker/components/DateRangePopover.tsx
|
|
15231
|
-
var
|
|
15732
|
+
var import_jsx_runtime164 = require("react/jsx-runtime");
|
|
15232
15733
|
function DateRangePopover({
|
|
15233
15734
|
isOpen,
|
|
15234
|
-
isMobile:
|
|
15735
|
+
isMobile: isMobile3,
|
|
15235
15736
|
openDirection,
|
|
15236
15737
|
drawerTitle,
|
|
15237
15738
|
drawerDescription,
|
|
@@ -15239,31 +15740,31 @@ function DateRangePopover({
|
|
|
15239
15740
|
children
|
|
15240
15741
|
}) {
|
|
15241
15742
|
if (!isOpen) return null;
|
|
15242
|
-
if (
|
|
15243
|
-
return /* @__PURE__ */ (0,
|
|
15743
|
+
if (isMobile3) {
|
|
15744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
|
|
15244
15745
|
Drawer,
|
|
15245
15746
|
{
|
|
15246
15747
|
open: isOpen,
|
|
15247
15748
|
onOpenChange: (next) => {
|
|
15248
15749
|
if (!next) onClose();
|
|
15249
15750
|
},
|
|
15250
|
-
children: /* @__PURE__ */ (0,
|
|
15751
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(
|
|
15251
15752
|
DrawerContent,
|
|
15252
15753
|
{
|
|
15253
15754
|
onClose,
|
|
15254
15755
|
lockScroll: false,
|
|
15255
15756
|
className: "max-h-[calc(100vh-1rem)]",
|
|
15256
15757
|
children: [
|
|
15257
|
-
/* @__PURE__ */ (0,
|
|
15258
|
-
/* @__PURE__ */ (0,
|
|
15259
|
-
/* @__PURE__ */ (0,
|
|
15758
|
+
/* @__PURE__ */ (0, import_jsx_runtime164.jsx)(DrawerTitle, { className: "sr-only", children: drawerTitle }),
|
|
15759
|
+
/* @__PURE__ */ (0, import_jsx_runtime164.jsx)(DrawerDescription, { className: "sr-only", children: drawerDescription }),
|
|
15760
|
+
/* @__PURE__ */ (0, import_jsx_runtime164.jsx)("div", { className: "flex items-start justify-center overflow-x-auto px-2 pb-4 pt-1", children })
|
|
15260
15761
|
]
|
|
15261
15762
|
}
|
|
15262
15763
|
)
|
|
15263
15764
|
}
|
|
15264
15765
|
);
|
|
15265
15766
|
}
|
|
15266
|
-
return /* @__PURE__ */ (0,
|
|
15767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
|
|
15267
15768
|
"div",
|
|
15268
15769
|
{
|
|
15269
15770
|
className: cn(
|
|
@@ -15276,7 +15777,7 @@ function DateRangePopover({
|
|
|
15276
15777
|
}
|
|
15277
15778
|
|
|
15278
15779
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
15279
|
-
var
|
|
15780
|
+
var import_jsx_runtime165 = require("react/jsx-runtime");
|
|
15280
15781
|
var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePicker2({
|
|
15281
15782
|
label,
|
|
15282
15783
|
value: externalValue,
|
|
@@ -15349,8 +15850,8 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15349
15850
|
const [isOpen, setIsOpen] = React58.useState(false);
|
|
15350
15851
|
const [focusedInput, setFocusedInput] = React58.useState(null);
|
|
15351
15852
|
const [autoFocus, setAutoFocus] = React58.useState(false);
|
|
15352
|
-
const
|
|
15353
|
-
const { t } = (0,
|
|
15853
|
+
const isMobile3 = useIsMobile();
|
|
15854
|
+
const { t } = (0, import_react_i18next36.useTranslation)();
|
|
15354
15855
|
const drawerTitle = label ?? t("select_dates");
|
|
15355
15856
|
const drawerDescription = label ?? t("pick_date_range");
|
|
15356
15857
|
const isEmpty = !value?.from && !value?.to;
|
|
@@ -15358,7 +15859,7 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15358
15859
|
const isInvalid = Boolean(invalid || error);
|
|
15359
15860
|
const isFocused = focusedInput !== null || isOpen;
|
|
15360
15861
|
const wrapperWidth = toCssSize(width);
|
|
15361
|
-
const monthsToShow = numberOfMonths ?? (
|
|
15862
|
+
const monthsToShow = numberOfMonths ?? (isMobile3 ? 1 : 2);
|
|
15362
15863
|
const closeCalendar = React58.useCallback(() => {
|
|
15363
15864
|
setIsOpen(false);
|
|
15364
15865
|
setFocusedInput(null);
|
|
@@ -15372,7 +15873,7 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15372
15873
|
useOutsideClick({
|
|
15373
15874
|
elementRef: containerRef,
|
|
15374
15875
|
onOutsideClick: closeCalendar,
|
|
15375
|
-
isDisabled: !isOpen ||
|
|
15876
|
+
isDisabled: !isOpen || isMobile3
|
|
15376
15877
|
});
|
|
15377
15878
|
const handlePickerChange = React58.useCallback(
|
|
15378
15879
|
(range, pickedDate) => {
|
|
@@ -15437,7 +15938,7 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15437
15938
|
syncMonthToValue
|
|
15438
15939
|
]
|
|
15439
15940
|
);
|
|
15440
|
-
return /* @__PURE__ */ (0,
|
|
15941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15441
15942
|
"div",
|
|
15442
15943
|
{
|
|
15443
15944
|
ref: containerRef,
|
|
@@ -15448,9 +15949,9 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15448
15949
|
className
|
|
15449
15950
|
),
|
|
15450
15951
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
15451
|
-
children: /* @__PURE__ */ (0,
|
|
15452
|
-
/* @__PURE__ */ (0,
|
|
15453
|
-
/* @__PURE__ */ (0,
|
|
15952
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)("div", { className: "relative min-h-[68px] w-full", children: [
|
|
15953
|
+
/* @__PURE__ */ (0, import_jsx_runtime165.jsxs)("div", { className: "relative w-full", children: [
|
|
15954
|
+
/* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15454
15955
|
DateRangeInputs,
|
|
15455
15956
|
{
|
|
15456
15957
|
fromId,
|
|
@@ -15501,7 +16002,7 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15501
16002
|
onToggleCalendar: toggleCalendar
|
|
15502
16003
|
}
|
|
15503
16004
|
),
|
|
15504
|
-
/* @__PURE__ */ (0,
|
|
16005
|
+
/* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15505
16006
|
Fieldset,
|
|
15506
16007
|
{
|
|
15507
16008
|
isFocused,
|
|
@@ -15518,16 +16019,16 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15518
16019
|
tooltip
|
|
15519
16020
|
}
|
|
15520
16021
|
),
|
|
15521
|
-
/* @__PURE__ */ (0,
|
|
16022
|
+
/* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15522
16023
|
DateRangePopover,
|
|
15523
16024
|
{
|
|
15524
|
-
isOpen: isOpen && !
|
|
16025
|
+
isOpen: isOpen && !isMobile3,
|
|
15525
16026
|
isMobile: false,
|
|
15526
16027
|
openDirection,
|
|
15527
16028
|
drawerTitle,
|
|
15528
16029
|
drawerDescription,
|
|
15529
16030
|
onClose: closeCalendar,
|
|
15530
|
-
children: /* @__PURE__ */ (0,
|
|
16031
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15531
16032
|
DateRangeCalendar,
|
|
15532
16033
|
{
|
|
15533
16034
|
value,
|
|
@@ -15548,16 +16049,16 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15548
16049
|
}
|
|
15549
16050
|
)
|
|
15550
16051
|
] }),
|
|
15551
|
-
/* @__PURE__ */ (0,
|
|
16052
|
+
/* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15552
16053
|
DateRangePopover,
|
|
15553
16054
|
{
|
|
15554
|
-
isOpen: isOpen &&
|
|
16055
|
+
isOpen: isOpen && isMobile3,
|
|
15555
16056
|
isMobile: true,
|
|
15556
16057
|
openDirection,
|
|
15557
16058
|
drawerTitle,
|
|
15558
16059
|
drawerDescription,
|
|
15559
16060
|
onClose: closeCalendar,
|
|
15560
|
-
children: /* @__PURE__ */ (0,
|
|
16061
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15561
16062
|
DateRangeCalendar,
|
|
15562
16063
|
{
|
|
15563
16064
|
value,
|
|
@@ -15577,9 +16078,9 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15577
16078
|
)
|
|
15578
16079
|
}
|
|
15579
16080
|
),
|
|
15580
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
15581
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
15582
|
-
error && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
16081
|
+
!error && optional && /* @__PURE__ */ (0, import_jsx_runtime165.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
16082
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime165.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
16083
|
+
error && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15583
16084
|
FieldErrorMessage,
|
|
15584
16085
|
{
|
|
15585
16086
|
id: errorId,
|
|
@@ -15594,7 +16095,7 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15594
16095
|
|
|
15595
16096
|
// src/dashboard/date-range-picker/useValidateDates.ts
|
|
15596
16097
|
var React59 = __toESM(require("react"), 1);
|
|
15597
|
-
var
|
|
16098
|
+
var import_react_i18next37 = require("react-i18next");
|
|
15598
16099
|
var import_date_fns4 = require("date-fns");
|
|
15599
16100
|
var import_react_day_picker2 = require("react-day-picker");
|
|
15600
16101
|
function isAfterMax(date, maxDate) {
|
|
@@ -15613,7 +16114,7 @@ function useValidateDates({
|
|
|
15613
16114
|
onSuccess,
|
|
15614
16115
|
displayFormat
|
|
15615
16116
|
}) {
|
|
15616
|
-
const { t } = (0,
|
|
16117
|
+
const { t } = (0, import_react_i18next37.useTranslation)();
|
|
15617
16118
|
const handleError = useEvent(onError);
|
|
15618
16119
|
const handleSuccess = useEvent(onSuccess);
|
|
15619
16120
|
const errorFormatter = React59.useMemo(
|
|
@@ -15672,7 +16173,7 @@ function useValidateDates({
|
|
|
15672
16173
|
// src/dashboard/time-picker/TimePicker.tsx
|
|
15673
16174
|
var React60 = __toESM(require("react"), 1);
|
|
15674
16175
|
var import_date_fns5 = require("date-fns");
|
|
15675
|
-
var
|
|
16176
|
+
var import_jsx_runtime166 = require("react/jsx-runtime");
|
|
15676
16177
|
var SHORT_TIME_FORMAT = "HH:mm";
|
|
15677
16178
|
function parseTime(value) {
|
|
15678
16179
|
return (0, import_date_fns5.parse)(value, SHORT_TIME_FORMAT, /* @__PURE__ */ new Date());
|
|
@@ -15721,24 +16222,15 @@ var DashboardTimePicker = React60.forwardRef(
|
|
|
15721
16222
|
const settings = timeSettings ?? FORMAT_SETTINGS[formatName];
|
|
15722
16223
|
return buildOptions(settings);
|
|
15723
16224
|
}, [formatName, options, timeSettings]);
|
|
15724
|
-
return /* @__PURE__ */ (0,
|
|
16225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(DashboardSelect, { ref, ...selectProps, options: resolvedOptions });
|
|
15725
16226
|
}
|
|
15726
16227
|
);
|
|
15727
16228
|
|
|
15728
16229
|
// src/dashboard/file-input/FileInput.tsx
|
|
15729
16230
|
var React61 = __toESM(require("react"), 1);
|
|
15730
|
-
var
|
|
15731
|
-
var
|
|
15732
|
-
var
|
|
15733
|
-
function defaultFileNameFromUrl(url) {
|
|
15734
|
-
try {
|
|
15735
|
-
const parsed = new URL(url);
|
|
15736
|
-
const segments = parsed.pathname.split("/");
|
|
15737
|
-
return decodeURIComponent(segments[segments.length - 1] ?? url);
|
|
15738
|
-
} catch {
|
|
15739
|
-
return url;
|
|
15740
|
-
}
|
|
15741
|
-
}
|
|
16231
|
+
var import_lucide_react48 = require("lucide-react");
|
|
16232
|
+
var import_react_i18next38 = require("react-i18next");
|
|
16233
|
+
var import_jsx_runtime167 = require("react/jsx-runtime");
|
|
15742
16234
|
function defaultDownload(url) {
|
|
15743
16235
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
15744
16236
|
}
|
|
@@ -15763,12 +16255,11 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15763
16255
|
hideErrorMessage,
|
|
15764
16256
|
className,
|
|
15765
16257
|
width,
|
|
15766
|
-
downloadLabel
|
|
15767
|
-
fileNameFromUrl = defaultFileNameFromUrl
|
|
16258
|
+
downloadLabel
|
|
15768
16259
|
}, ref) {
|
|
15769
16260
|
const internalRef = React61.useRef(null);
|
|
15770
16261
|
const inputRef = useCombinedRef(ref, internalRef);
|
|
15771
|
-
const { t } = (0,
|
|
16262
|
+
const { t } = (0, import_react_i18next38.useTranslation)();
|
|
15772
16263
|
const resolvedLabel = label ?? t("upload_file");
|
|
15773
16264
|
const resolvedDownloadLabel = downloadLabel ?? t("download_attachment");
|
|
15774
16265
|
const reactId = React61.useId();
|
|
@@ -15797,7 +16288,7 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15797
16288
|
event.stopPropagation();
|
|
15798
16289
|
if (isUrl) onDownload(value);
|
|
15799
16290
|
};
|
|
15800
|
-
return /* @__PURE__ */ (0,
|
|
16291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
|
|
15801
16292
|
"label",
|
|
15802
16293
|
{
|
|
15803
16294
|
htmlFor: inputId,
|
|
@@ -15810,7 +16301,7 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15810
16301
|
),
|
|
15811
16302
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
15812
16303
|
children: [
|
|
15813
|
-
/* @__PURE__ */ (0,
|
|
16304
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
|
|
15814
16305
|
"input",
|
|
15815
16306
|
{
|
|
15816
16307
|
ref: inputRef,
|
|
@@ -15826,9 +16317,9 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15826
16317
|
"aria-invalid": isInvalid
|
|
15827
16318
|
}
|
|
15828
16319
|
),
|
|
15829
|
-
/* @__PURE__ */ (0,
|
|
15830
|
-
/* @__PURE__ */ (0,
|
|
15831
|
-
/* @__PURE__ */ (0,
|
|
16320
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "relative min-h-[68px] w-full", children: [
|
|
16321
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "relative w-full", children: [
|
|
16322
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
|
|
15832
16323
|
"div",
|
|
15833
16324
|
{
|
|
15834
16325
|
className: cn(
|
|
@@ -15836,25 +16327,25 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15836
16327
|
isEmpty && "bg-[var(--chekin-color-surface-input-empty)]"
|
|
15837
16328
|
),
|
|
15838
16329
|
children: [
|
|
15839
|
-
hasFileChip ? /* @__PURE__ */ (0,
|
|
16330
|
+
hasFileChip ? /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
|
|
15840
16331
|
"div",
|
|
15841
16332
|
{
|
|
15842
16333
|
className: "inline-flex h-6 max-w-[85%] items-center rounded-[4px] border border-[#acacd5] bg-[#f0f0f8] pl-[10px] pr-1",
|
|
15843
16334
|
onClick: (event) => event.preventDefault(),
|
|
15844
16335
|
children: [
|
|
15845
|
-
isUrl ? /* @__PURE__ */ (0,
|
|
16336
|
+
isUrl ? /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
|
|
15846
16337
|
"button",
|
|
15847
16338
|
{
|
|
15848
16339
|
type: "button",
|
|
15849
16340
|
onClick: handleDownload,
|
|
15850
16341
|
className: "inline-flex items-center gap-[7px] truncate border-0 bg-transparent p-0 text-[14px] font-medium text-[var(--chekin-color-brand-navy)] outline-none",
|
|
15851
16342
|
children: [
|
|
15852
|
-
/* @__PURE__ */ (0,
|
|
15853
|
-
/* @__PURE__ */ (0,
|
|
16343
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "truncate", children: resolvedDownloadLabel }),
|
|
16344
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(import_lucide_react48.Download, { size: 15 })
|
|
15854
16345
|
]
|
|
15855
16346
|
}
|
|
15856
|
-
) : /* @__PURE__ */ (0,
|
|
15857
|
-
/* @__PURE__ */ (0,
|
|
16347
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "truncate text-[14px] font-medium text-[var(--chekin-color-brand-navy)]", children: value.name }),
|
|
16348
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
|
|
15858
16349
|
"button",
|
|
15859
16350
|
{
|
|
15860
16351
|
type: "button",
|
|
@@ -15862,20 +16353,20 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15862
16353
|
onClick: handleClear,
|
|
15863
16354
|
className: "ml-2 flex h-[15px] w-[15px] items-center justify-center rounded-[3px] border-0 bg-transparent p-0 text-[#9696b9] outline-none hover:shadow-[0_3px_3px_#0f477734]",
|
|
15864
16355
|
"aria-label": t("remove_file"),
|
|
15865
|
-
children: /* @__PURE__ */ (0,
|
|
16356
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(import_lucide_react48.SquareX, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
15866
16357
|
}
|
|
15867
16358
|
)
|
|
15868
16359
|
]
|
|
15869
16360
|
}
|
|
15870
|
-
) : /* @__PURE__ */ (0,
|
|
15871
|
-
/* @__PURE__ */ (0,
|
|
15872
|
-
loading && /* @__PURE__ */ (0,
|
|
15873
|
-
/* @__PURE__ */ (0,
|
|
16361
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "block min-w-0 flex-1 truncate text-left text-[var(--chekin-color-gray-1)]", children: placeholder ?? "" }),
|
|
16362
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("span", { className: "ml-auto flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
16363
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
16364
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(import_lucide_react48.Paperclip, { size: 20 })
|
|
15874
16365
|
] })
|
|
15875
16366
|
]
|
|
15876
16367
|
}
|
|
15877
16368
|
),
|
|
15878
|
-
/* @__PURE__ */ (0,
|
|
16369
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
|
|
15879
16370
|
Fieldset,
|
|
15880
16371
|
{
|
|
15881
16372
|
isFocused: false,
|
|
@@ -15893,9 +16384,9 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15893
16384
|
}
|
|
15894
16385
|
)
|
|
15895
16386
|
] }),
|
|
15896
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
15897
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
15898
|
-
error && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
16387
|
+
!error && optional && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
16388
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
16389
|
+
error && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
|
|
15899
16390
|
FieldErrorMessage,
|
|
15900
16391
|
{
|
|
15901
16392
|
id: errorId,
|
|
@@ -15912,7 +16403,7 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15912
16403
|
|
|
15913
16404
|
// src/dashboard/select-icons-box/SelectIconsBox.tsx
|
|
15914
16405
|
var React62 = __toESM(require("react"), 1);
|
|
15915
|
-
var
|
|
16406
|
+
var import_jsx_runtime168 = require("react/jsx-runtime");
|
|
15916
16407
|
function DashboardSelectIconsBox({
|
|
15917
16408
|
children,
|
|
15918
16409
|
icons,
|
|
@@ -15948,7 +16439,7 @@ function DashboardSelectIconsBox({
|
|
|
15948
16439
|
onSelect(iconName);
|
|
15949
16440
|
setOpen(false);
|
|
15950
16441
|
};
|
|
15951
|
-
return /* @__PURE__ */ (0,
|
|
16442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
|
|
15952
16443
|
"div",
|
|
15953
16444
|
{
|
|
15954
16445
|
ref: containerRef,
|
|
@@ -15956,7 +16447,7 @@ function DashboardSelectIconsBox({
|
|
|
15956
16447
|
className: cn("relative inline-block", className),
|
|
15957
16448
|
children: [
|
|
15958
16449
|
children,
|
|
15959
|
-
isOpen && /* @__PURE__ */ (0,
|
|
16450
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
|
|
15960
16451
|
"div",
|
|
15961
16452
|
{
|
|
15962
16453
|
className: cn(
|
|
@@ -15967,7 +16458,7 @@ function DashboardSelectIconsBox({
|
|
|
15967
16458
|
boxClassName
|
|
15968
16459
|
),
|
|
15969
16460
|
style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` },
|
|
15970
|
-
children: icons.map((iconName) => /* @__PURE__ */ (0,
|
|
16461
|
+
children: icons.map((iconName) => /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
|
|
15971
16462
|
"button",
|
|
15972
16463
|
{
|
|
15973
16464
|
type: "button",
|
|
@@ -16048,14 +16539,14 @@ function getErrorMessage(error) {
|
|
|
16048
16539
|
|
|
16049
16540
|
// src/lib/toastResponseError.tsx
|
|
16050
16541
|
var import_i18next = __toESM(require("i18next"), 1);
|
|
16051
|
-
var
|
|
16542
|
+
var import_jsx_runtime169 = require("react/jsx-runtime");
|
|
16052
16543
|
function addSupportEmailToMessage(message, prefixText) {
|
|
16053
16544
|
if (typeof message !== "string") {
|
|
16054
16545
|
return message;
|
|
16055
16546
|
}
|
|
16056
16547
|
const builtMessage = `${prefixText ? `${prefixText} ` : ""}${message}`;
|
|
16057
|
-
return /* @__PURE__ */ (0,
|
|
16058
|
-
/* @__PURE__ */ (0,
|
|
16548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { children: [
|
|
16549
|
+
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { children: builtMessage }),
|
|
16059
16550
|
import_i18next.default.t("reach_us_at_email")
|
|
16060
16551
|
] });
|
|
16061
16552
|
}
|
|
@@ -16070,13 +16561,13 @@ function toastResponseError(error, options = {}) {
|
|
|
16070
16561
|
}
|
|
16071
16562
|
|
|
16072
16563
|
// src/legacy-fields/textarea/Textarea.tsx
|
|
16073
|
-
var
|
|
16074
|
-
var
|
|
16075
|
-
var LegacyTextarea = (0,
|
|
16564
|
+
var import_react89 = require("react");
|
|
16565
|
+
var import_jsx_runtime170 = require("react/jsx-runtime");
|
|
16566
|
+
var LegacyTextarea = (0, import_react89.forwardRef)(
|
|
16076
16567
|
({ className, textareaClassName, label, disabled, name, invalid, ...textareaProps }, ref) => {
|
|
16077
|
-
const inputId = (0,
|
|
16078
|
-
return /* @__PURE__ */ (0,
|
|
16079
|
-
/* @__PURE__ */ (0,
|
|
16568
|
+
const inputId = (0, import_react89.useId)();
|
|
16569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: cn("relative", className), children: [
|
|
16570
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
16080
16571
|
"textarea",
|
|
16081
16572
|
{
|
|
16082
16573
|
ref,
|
|
@@ -16092,7 +16583,7 @@ var LegacyTextarea = (0, import_react86.forwardRef)(
|
|
|
16092
16583
|
...textareaProps
|
|
16093
16584
|
}
|
|
16094
16585
|
),
|
|
16095
|
-
label && /* @__PURE__ */ (0,
|
|
16586
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
16096
16587
|
"label",
|
|
16097
16588
|
{
|
|
16098
16589
|
htmlFor: inputId,
|
|
@@ -16111,13 +16602,13 @@ LegacyTextarea.displayName = "LegacyTextarea";
|
|
|
16111
16602
|
|
|
16112
16603
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
16113
16604
|
var React64 = __toESM(require("react"), 1);
|
|
16114
|
-
var
|
|
16605
|
+
var import_lucide_react50 = require("lucide-react");
|
|
16115
16606
|
|
|
16116
16607
|
// src/airbnb-fields/field-trigger/FieldTrigger.tsx
|
|
16117
16608
|
var React63 = __toESM(require("react"), 1);
|
|
16118
|
-
var
|
|
16119
|
-
var
|
|
16120
|
-
var
|
|
16609
|
+
var import_lucide_react49 = require("lucide-react");
|
|
16610
|
+
var import_react_i18next39 = require("react-i18next");
|
|
16611
|
+
var import_jsx_runtime171 = require("react/jsx-runtime");
|
|
16121
16612
|
var AirbnbFieldTrigger = React63.forwardRef(
|
|
16122
16613
|
({
|
|
16123
16614
|
as = "button",
|
|
@@ -16149,20 +16640,20 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16149
16640
|
onKeyDown,
|
|
16150
16641
|
...props
|
|
16151
16642
|
}, ref) => {
|
|
16152
|
-
const { t } = (0,
|
|
16643
|
+
const { t } = (0, import_react_i18next39.useTranslation)();
|
|
16153
16644
|
const hasValue = Boolean(valueText);
|
|
16154
16645
|
const isRaised = hasValue || forceFloatingLabel;
|
|
16155
16646
|
const optionalLabel = optional ? typeof optional === "string" ? optional : t("optional") : void 0;
|
|
16156
16647
|
const visibleLabelText = labelText ?? label;
|
|
16157
16648
|
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
16158
|
-
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ (0,
|
|
16159
|
-
/* @__PURE__ */ (0,
|
|
16160
|
-
optionalLabel && /* @__PURE__ */ (0,
|
|
16649
|
+
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("span", { className: "inline-flex max-w-full items-center gap-1.5 align-middle", children: [
|
|
16650
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "min-w-0 truncate", children: visibleLabelText }),
|
|
16651
|
+
optionalLabel && /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("span", { className: "shrink-0 text-[12px] relative top-[1px] font-normal leading-4 text-current opacity-70", children: [
|
|
16161
16652
|
"(",
|
|
16162
16653
|
optionalLabel,
|
|
16163
16654
|
")"
|
|
16164
16655
|
] }),
|
|
16165
|
-
tooltip && /* @__PURE__ */ (0,
|
|
16656
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16166
16657
|
HelpTooltip,
|
|
16167
16658
|
{
|
|
16168
16659
|
content: tooltip,
|
|
@@ -16178,10 +16669,10 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16178
16669
|
const hasInvalidState = Boolean(error);
|
|
16179
16670
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
16180
16671
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
16181
|
-
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ (0,
|
|
16672
|
+
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
16182
16673
|
trailingAdornment,
|
|
16183
|
-
loading && /* @__PURE__ */ (0,
|
|
16184
|
-
|
|
16674
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16675
|
+
import_lucide_react49.Loader2,
|
|
16185
16676
|
{
|
|
16186
16677
|
"aria-hidden": "true",
|
|
16187
16678
|
className: "h-5 w-5 animate-spin text-[var(--chekin-color-gray-1)]"
|
|
@@ -16196,8 +16687,8 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16196
16687
|
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
|
|
16197
16688
|
className
|
|
16198
16689
|
);
|
|
16199
|
-
const sharedContent = /* @__PURE__ */ (0,
|
|
16200
|
-
/* @__PURE__ */ (0,
|
|
16690
|
+
const sharedContent = /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(import_jsx_runtime171.Fragment, { children: [
|
|
16691
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
|
|
16201
16692
|
"span",
|
|
16202
16693
|
{
|
|
16203
16694
|
className: cn(
|
|
@@ -16206,7 +16697,7 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16206
16697
|
contentClassName
|
|
16207
16698
|
),
|
|
16208
16699
|
children: [
|
|
16209
|
-
/* @__PURE__ */ (0,
|
|
16700
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16210
16701
|
"span",
|
|
16211
16702
|
{
|
|
16212
16703
|
id: labelId,
|
|
@@ -16219,7 +16710,7 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16219
16710
|
children: animatedLabel
|
|
16220
16711
|
}
|
|
16221
16712
|
),
|
|
16222
|
-
children ? children : hasValue ? /* @__PURE__ */ (0,
|
|
16713
|
+
children ? children : hasValue ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16223
16714
|
"span",
|
|
16224
16715
|
{
|
|
16225
16716
|
id: valueId,
|
|
@@ -16230,11 +16721,11 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16230
16721
|
),
|
|
16231
16722
|
children: valueText
|
|
16232
16723
|
}
|
|
16233
|
-
) : /* @__PURE__ */ (0,
|
|
16724
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { id: helperTextId, className: "sr-only", children: placeholder ?? label })
|
|
16234
16725
|
]
|
|
16235
16726
|
}
|
|
16236
16727
|
),
|
|
16237
|
-
resolvedTrailingAdornment && /* @__PURE__ */ (0,
|
|
16728
|
+
resolvedTrailingAdornment && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16238
16729
|
"span",
|
|
16239
16730
|
{
|
|
16240
16731
|
"aria-hidden": "true",
|
|
@@ -16246,9 +16737,9 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16246
16737
|
}
|
|
16247
16738
|
)
|
|
16248
16739
|
] });
|
|
16249
|
-
return /* @__PURE__ */ (0,
|
|
16250
|
-
topLabel && /* @__PURE__ */ (0,
|
|
16251
|
-
as === "button" ? /* @__PURE__ */ (0,
|
|
16740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "w-full", children: [
|
|
16741
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "mb-3 text-[16px] font-semibold leading-5 text-[#222222]", children: topLabel }),
|
|
16742
|
+
as === "button" ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16252
16743
|
"button",
|
|
16253
16744
|
{
|
|
16254
16745
|
id,
|
|
@@ -16265,7 +16756,7 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16265
16756
|
...props,
|
|
16266
16757
|
children: sharedContent
|
|
16267
16758
|
}
|
|
16268
|
-
) : /* @__PURE__ */ (0,
|
|
16759
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16269
16760
|
"div",
|
|
16270
16761
|
{
|
|
16271
16762
|
id,
|
|
@@ -16282,14 +16773,14 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16282
16773
|
children: sharedContent
|
|
16283
16774
|
}
|
|
16284
16775
|
),
|
|
16285
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
16776
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(FieldErrorMessage, { id: errorId, message: errorMessage })
|
|
16286
16777
|
] });
|
|
16287
16778
|
}
|
|
16288
16779
|
);
|
|
16289
16780
|
AirbnbFieldTrigger.displayName = "AirbnbFieldTrigger";
|
|
16290
16781
|
|
|
16291
16782
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
16292
|
-
var
|
|
16783
|
+
var import_jsx_runtime172 = require("react/jsx-runtime");
|
|
16293
16784
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
16294
16785
|
var AirbnbDatePicker = React64.forwardRef(
|
|
16295
16786
|
({
|
|
@@ -16316,7 +16807,7 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16316
16807
|
doneLabel = "Done",
|
|
16317
16808
|
formatValue = formatDateValue
|
|
16318
16809
|
}, ref) => {
|
|
16319
|
-
const { isMatch:
|
|
16810
|
+
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
16320
16811
|
const [isOpen, setIsOpen] = React64.useState(false);
|
|
16321
16812
|
const triggerId = React64.useId();
|
|
16322
16813
|
const pickerId = React64.useId();
|
|
@@ -16406,8 +16897,8 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16406
16897
|
setIsOpen(false);
|
|
16407
16898
|
}
|
|
16408
16899
|
}, [isBlocked]);
|
|
16409
|
-
return /* @__PURE__ */ (0,
|
|
16410
|
-
name && /* @__PURE__ */ (0,
|
|
16900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: cn("relative w-full max-w-[var(--max-field-width)]", className), children: [
|
|
16901
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
16411
16902
|
"input",
|
|
16412
16903
|
{
|
|
16413
16904
|
type: "hidden",
|
|
@@ -16415,7 +16906,7 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16415
16906
|
value: resolvedValue ? formatDateInputValue(resolvedValue) : ""
|
|
16416
16907
|
}
|
|
16417
16908
|
),
|
|
16418
|
-
/* @__PURE__ */ (0,
|
|
16909
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
16419
16910
|
AirbnbFieldTrigger,
|
|
16420
16911
|
{
|
|
16421
16912
|
id: triggerId,
|
|
@@ -16442,15 +16933,15 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16442
16933
|
onClick: handleTriggerClick,
|
|
16443
16934
|
onKeyDown: handleTriggerKeyDown,
|
|
16444
16935
|
onBlur,
|
|
16445
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
16936
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(import_lucide_react50.Calendar, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
|
|
16446
16937
|
}
|
|
16447
16938
|
),
|
|
16448
|
-
/* @__PURE__ */ (0,
|
|
16939
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
16449
16940
|
AirbnbDatePickerContent,
|
|
16450
16941
|
{
|
|
16451
16942
|
baseId: pickerId,
|
|
16452
16943
|
open: isOpen,
|
|
16453
|
-
isMobile:
|
|
16944
|
+
isMobile: isMobile3,
|
|
16454
16945
|
label,
|
|
16455
16946
|
title: mobileTitle ?? label,
|
|
16456
16947
|
doneLabel,
|
|
@@ -16480,7 +16971,7 @@ AirbnbDatePicker.displayName = "AirbnbDatePicker";
|
|
|
16480
16971
|
|
|
16481
16972
|
// src/airbnb-fields/input/Input.tsx
|
|
16482
16973
|
var React65 = __toESM(require("react"), 1);
|
|
16483
|
-
var
|
|
16974
|
+
var import_jsx_runtime173 = require("react/jsx-runtime");
|
|
16484
16975
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
16485
16976
|
var AirbnbInput = React65.forwardRef(
|
|
16486
16977
|
({
|
|
@@ -16563,7 +17054,7 @@ var AirbnbInput = React65.forwardRef(
|
|
|
16563
17054
|
setIsFocused(false);
|
|
16564
17055
|
onBlur?.(event);
|
|
16565
17056
|
};
|
|
16566
|
-
return /* @__PURE__ */ (0,
|
|
17057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
|
|
16567
17058
|
AirbnbFieldTrigger,
|
|
16568
17059
|
{
|
|
16569
17060
|
as: "div",
|
|
@@ -16595,7 +17086,7 @@ var AirbnbInput = React65.forwardRef(
|
|
|
16595
17086
|
forceFloatingLabel: shouldShowLabel,
|
|
16596
17087
|
forceLabelText: hasLabelMeta,
|
|
16597
17088
|
hideErrorMessage: !renderErrorMessage,
|
|
16598
|
-
children: /* @__PURE__ */ (0,
|
|
17089
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
|
|
16599
17090
|
"input",
|
|
16600
17091
|
{
|
|
16601
17092
|
...props,
|
|
@@ -16632,13 +17123,13 @@ AirbnbInput.displayName = "AirbnbInput";
|
|
|
16632
17123
|
|
|
16633
17124
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
16634
17125
|
var React71 = __toESM(require("react"), 1);
|
|
16635
|
-
var
|
|
17126
|
+
var import_lucide_react52 = require("lucide-react");
|
|
16636
17127
|
|
|
16637
17128
|
// src/airbnb-fields/select/Select.tsx
|
|
16638
17129
|
var React70 = __toESM(require("react"), 1);
|
|
16639
17130
|
|
|
16640
17131
|
// src/airbnb-fields/select/SelectDesktopMenu.tsx
|
|
16641
|
-
var
|
|
17132
|
+
var import_jsx_runtime174 = require("react/jsx-runtime");
|
|
16642
17133
|
function AirbnbSelectDesktopMenu({
|
|
16643
17134
|
id,
|
|
16644
17135
|
options,
|
|
@@ -16657,7 +17148,7 @@ function AirbnbSelectDesktopMenu({
|
|
|
16657
17148
|
noOptionsMessage
|
|
16658
17149
|
}) {
|
|
16659
17150
|
const emptyMessage = noOptionsMessage?.();
|
|
16660
|
-
return /* @__PURE__ */ (0,
|
|
17151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
|
|
16661
17152
|
"div",
|
|
16662
17153
|
{
|
|
16663
17154
|
id,
|
|
@@ -16670,12 +17161,12 @@ function AirbnbSelectDesktopMenu({
|
|
|
16670
17161
|
onKeyDown,
|
|
16671
17162
|
className: cn("max-h-[280px] overflow-y-auto p-2 outline-none", menuClassName),
|
|
16672
17163
|
children: [
|
|
16673
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0,
|
|
17164
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("div", { className: "px-4 py-3 text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
16674
17165
|
options.map((option, index) => {
|
|
16675
17166
|
const isSelected = selectedValue?.value === option.value;
|
|
16676
17167
|
const isHighlighted = index === highlightedIndex;
|
|
16677
17168
|
const optionKey = `${String(option.value)}-${index}`;
|
|
16678
|
-
return /* @__PURE__ */ (0,
|
|
17169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16679
17170
|
"button",
|
|
16680
17171
|
{
|
|
16681
17172
|
id: getOptionId2(index),
|
|
@@ -16707,7 +17198,7 @@ function AirbnbSelectDesktopMenu({
|
|
|
16707
17198
|
}
|
|
16708
17199
|
|
|
16709
17200
|
// src/airbnb-fields/select/SelectDesktopContent.tsx
|
|
16710
|
-
var
|
|
17201
|
+
var import_jsx_runtime175 = require("react/jsx-runtime");
|
|
16711
17202
|
function AirbnbSelectDesktopContent({
|
|
16712
17203
|
isOpen,
|
|
16713
17204
|
listboxId,
|
|
@@ -16728,14 +17219,14 @@ function AirbnbSelectDesktopContent({
|
|
|
16728
17219
|
noOptionsMessage
|
|
16729
17220
|
}) {
|
|
16730
17221
|
if (!isOpen) return null;
|
|
16731
|
-
return /* @__PURE__ */ (0,
|
|
17222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
16732
17223
|
"div",
|
|
16733
17224
|
{
|
|
16734
17225
|
className: cn(
|
|
16735
17226
|
"absolute left-0 right-0 top-[calc(100%+8px)] z-20 overflow-hidden rounded-[20px] border border-[#DEDAD2] bg-white shadow-[0_14px_30px_rgba(18,18,18,0.08)]",
|
|
16736
17227
|
dropdownClassName
|
|
16737
17228
|
),
|
|
16738
|
-
children: /* @__PURE__ */ (0,
|
|
17229
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
16739
17230
|
AirbnbSelectDesktopMenu,
|
|
16740
17231
|
{
|
|
16741
17232
|
id: listboxId,
|
|
@@ -16833,7 +17324,7 @@ function getMobileOptionStyles(index, scrollTop) {
|
|
|
16833
17324
|
}
|
|
16834
17325
|
|
|
16835
17326
|
// src/airbnb-fields/select/SelectMobileWheel.tsx
|
|
16836
|
-
var
|
|
17327
|
+
var import_jsx_runtime176 = require("react/jsx-runtime");
|
|
16837
17328
|
function AirbnbSelectMobileWheel({
|
|
16838
17329
|
id,
|
|
16839
17330
|
options,
|
|
@@ -16852,7 +17343,7 @@ function AirbnbSelectMobileWheel({
|
|
|
16852
17343
|
}) {
|
|
16853
17344
|
const spacerHeight2 = getWheelSpacerHeight();
|
|
16854
17345
|
const emptyMessage = noOptionsMessage?.();
|
|
16855
|
-
return /* @__PURE__ */ (0,
|
|
17346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
|
|
16856
17347
|
"div",
|
|
16857
17348
|
{
|
|
16858
17349
|
id,
|
|
@@ -16864,10 +17355,10 @@ function AirbnbSelectMobileWheel({
|
|
|
16864
17355
|
onKeyDown,
|
|
16865
17356
|
className: cn("relative overflow-hidden outline-none", menuClassName),
|
|
16866
17357
|
children: [
|
|
16867
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0,
|
|
16868
|
-
/* @__PURE__ */ (0,
|
|
16869
|
-
/* @__PURE__ */ (0,
|
|
16870
|
-
/* @__PURE__ */ (0,
|
|
17358
|
+
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "flex min-h-[160px] items-center justify-center px-4 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : null,
|
|
17359
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-white via-white/80 to-transparent" }),
|
|
17360
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-white via-white/80 to-transparent" }),
|
|
17361
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
16871
17362
|
"div",
|
|
16872
17363
|
{
|
|
16873
17364
|
"aria-hidden": true,
|
|
@@ -16877,7 +17368,7 @@ function AirbnbSelectMobileWheel({
|
|
|
16877
17368
|
)
|
|
16878
17369
|
}
|
|
16879
17370
|
),
|
|
16880
|
-
/* @__PURE__ */ (0,
|
|
17371
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
|
|
16881
17372
|
"div",
|
|
16882
17373
|
{
|
|
16883
17374
|
ref: listRef,
|
|
@@ -16892,11 +17383,11 @@ function AirbnbSelectMobileWheel({
|
|
|
16892
17383
|
WebkitOverflowScrolling: "touch"
|
|
16893
17384
|
},
|
|
16894
17385
|
children: [
|
|
16895
|
-
/* @__PURE__ */ (0,
|
|
17386
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { style: { height: `${spacerHeight2}px` } }),
|
|
16896
17387
|
options.map((option, index) => {
|
|
16897
17388
|
const { distance, style } = getMobileOptionStyles(index, scrollTop);
|
|
16898
17389
|
const optionKey = `${String(option.value)}-${index}`;
|
|
16899
|
-
return /* @__PURE__ */ (0,
|
|
17390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
16900
17391
|
"button",
|
|
16901
17392
|
{
|
|
16902
17393
|
id: getOptionId2(index),
|
|
@@ -16917,7 +17408,7 @@ function AirbnbSelectMobileWheel({
|
|
|
16917
17408
|
optionKey
|
|
16918
17409
|
);
|
|
16919
17410
|
}),
|
|
16920
|
-
/* @__PURE__ */ (0,
|
|
17411
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { style: { height: `${spacerHeight2}px` } })
|
|
16921
17412
|
]
|
|
16922
17413
|
}
|
|
16923
17414
|
)
|
|
@@ -16927,7 +17418,7 @@ function AirbnbSelectMobileWheel({
|
|
|
16927
17418
|
}
|
|
16928
17419
|
|
|
16929
17420
|
// src/airbnb-fields/select/SelectMobileContent.tsx
|
|
16930
|
-
var
|
|
17421
|
+
var import_jsx_runtime177 = require("react/jsx-runtime");
|
|
16931
17422
|
function AirbnbSelectMobileContent({
|
|
16932
17423
|
open,
|
|
16933
17424
|
onOpenChange,
|
|
@@ -16951,11 +17442,11 @@ function AirbnbSelectMobileContent({
|
|
|
16951
17442
|
getOptionId: getOptionId2,
|
|
16952
17443
|
noOptionsMessage
|
|
16953
17444
|
}) {
|
|
16954
|
-
return /* @__PURE__ */ (0,
|
|
16955
|
-
/* @__PURE__ */ (0,
|
|
16956
|
-
/* @__PURE__ */ (0,
|
|
16957
|
-
/* @__PURE__ */ (0,
|
|
16958
|
-
/* @__PURE__ */ (0,
|
|
17445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Drawer, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(DrawerContent, { onClose, lockScroll: false, children: [
|
|
17446
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
17447
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
17448
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("div", { className: "px-6 pb-4 pt-1", children: [
|
|
17449
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
16959
17450
|
AirbnbSelectMobileWheel,
|
|
16960
17451
|
{
|
|
16961
17452
|
id: listboxId,
|
|
@@ -16974,15 +17465,15 @@ function AirbnbSelectMobileContent({
|
|
|
16974
17465
|
noOptionsMessage
|
|
16975
17466
|
}
|
|
16976
17467
|
),
|
|
16977
|
-
/* @__PURE__ */ (0,
|
|
17468
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
16978
17469
|
] })
|
|
16979
17470
|
] }) });
|
|
16980
17471
|
}
|
|
16981
17472
|
|
|
16982
17473
|
// src/airbnb-fields/select/SelectTrigger.tsx
|
|
16983
17474
|
var React66 = __toESM(require("react"), 1);
|
|
16984
|
-
var
|
|
16985
|
-
var
|
|
17475
|
+
var import_lucide_react51 = require("lucide-react");
|
|
17476
|
+
var import_jsx_runtime178 = require("react/jsx-runtime");
|
|
16986
17477
|
var AirbnbSelectTrigger = React66.forwardRef(
|
|
16987
17478
|
({
|
|
16988
17479
|
id,
|
|
@@ -17008,7 +17499,7 @@ var AirbnbSelectTrigger = React66.forwardRef(
|
|
|
17008
17499
|
onKeyDown,
|
|
17009
17500
|
onBlur
|
|
17010
17501
|
}, ref) => {
|
|
17011
|
-
return /* @__PURE__ */ (0,
|
|
17502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17012
17503
|
AirbnbFieldTrigger,
|
|
17013
17504
|
{
|
|
17014
17505
|
id,
|
|
@@ -17037,8 +17528,8 @@ var AirbnbSelectTrigger = React66.forwardRef(
|
|
|
17037
17528
|
onClick,
|
|
17038
17529
|
onKeyDown,
|
|
17039
17530
|
onBlur,
|
|
17040
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
17041
|
-
|
|
17531
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17532
|
+
import_lucide_react51.ChevronDown,
|
|
17042
17533
|
{
|
|
17043
17534
|
className: open ? "h-6 w-6 rotate-180 text-[#1F1F1B] transition-transform" : "h-6 w-6 text-[#1F1F1B] transition-transform"
|
|
17044
17535
|
}
|
|
@@ -17052,7 +17543,7 @@ AirbnbSelectTrigger.displayName = "AirbnbSelectTrigger";
|
|
|
17052
17543
|
// src/airbnb-fields/select/useDesktopSelect.ts
|
|
17053
17544
|
var React67 = __toESM(require("react"), 1);
|
|
17054
17545
|
function useDesktopSelect({
|
|
17055
|
-
isMobile:
|
|
17546
|
+
isMobile: isMobile3,
|
|
17056
17547
|
isOpen,
|
|
17057
17548
|
options,
|
|
17058
17549
|
value,
|
|
@@ -17065,7 +17556,7 @@ function useDesktopSelect({
|
|
|
17065
17556
|
const optionRefs = React67.useRef([]);
|
|
17066
17557
|
const selectedIndex = getOptionIndex2(options, value);
|
|
17067
17558
|
React67.useEffect(() => {
|
|
17068
|
-
if (!isOpen ||
|
|
17559
|
+
if (!isOpen || isMobile3) return;
|
|
17069
17560
|
setHighlightedIndex((currentIndex) => {
|
|
17070
17561
|
if (currentIndex >= 0) {
|
|
17071
17562
|
return currentIndex;
|
|
@@ -17078,13 +17569,13 @@ function useDesktopSelect({
|
|
|
17078
17569
|
return () => {
|
|
17079
17570
|
window.cancelAnimationFrame(frameId);
|
|
17080
17571
|
};
|
|
17081
|
-
}, [
|
|
17572
|
+
}, [isMobile3, isOpen, options, selectedIndex]);
|
|
17082
17573
|
React67.useEffect(() => {
|
|
17083
|
-
if (!isOpen ||
|
|
17574
|
+
if (!isOpen || isMobile3 || highlightedIndex < 0) return;
|
|
17084
17575
|
optionRefs.current[highlightedIndex]?.scrollIntoView({
|
|
17085
17576
|
block: "nearest"
|
|
17086
17577
|
});
|
|
17087
|
-
}, [highlightedIndex,
|
|
17578
|
+
}, [highlightedIndex, isMobile3, isOpen]);
|
|
17088
17579
|
React67.useEffect(() => {
|
|
17089
17580
|
if (isOpen) return;
|
|
17090
17581
|
setHighlightedIndex(-1);
|
|
@@ -17202,7 +17693,7 @@ function useDesktopSelect({
|
|
|
17202
17693
|
|
|
17203
17694
|
// src/airbnb-fields/select/useMobileSelectWheel.ts
|
|
17204
17695
|
var React68 = __toESM(require("react"), 1);
|
|
17205
|
-
function useMobileSelectWheel({ isMobile:
|
|
17696
|
+
function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, disabled }) {
|
|
17206
17697
|
const [pendingValue, setPendingValue] = React68.useState(
|
|
17207
17698
|
value ?? null
|
|
17208
17699
|
);
|
|
@@ -17257,14 +17748,14 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
17257
17748
|
setPendingValue(value ?? null);
|
|
17258
17749
|
}, [value]);
|
|
17259
17750
|
React68.useLayoutEffect(() => {
|
|
17260
|
-
if (!
|
|
17751
|
+
if (!isMobile3 || !isOpen) return;
|
|
17261
17752
|
const frameId = window.requestAnimationFrame(() => {
|
|
17262
17753
|
syncScrollPosition(value ?? null, "instant");
|
|
17263
17754
|
});
|
|
17264
17755
|
return () => {
|
|
17265
17756
|
window.cancelAnimationFrame(frameId);
|
|
17266
17757
|
};
|
|
17267
|
-
}, [
|
|
17758
|
+
}, [isMobile3, isOpen, syncScrollPosition, value]);
|
|
17268
17759
|
const settleScroll = React68.useCallback(() => {
|
|
17269
17760
|
if (!mobileListRef.current) return;
|
|
17270
17761
|
const nextIndex = Math.round(mobileListRef.current.scrollTop / MOBILE_OPTION_HEIGHT);
|
|
@@ -17399,7 +17890,7 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
17399
17890
|
}
|
|
17400
17891
|
|
|
17401
17892
|
// src/airbnb-fields/select/Select.tsx
|
|
17402
|
-
var
|
|
17893
|
+
var import_jsx_runtime179 = require("react/jsx-runtime");
|
|
17403
17894
|
var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
17404
17895
|
options = [],
|
|
17405
17896
|
value,
|
|
@@ -17426,7 +17917,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17426
17917
|
name,
|
|
17427
17918
|
noOptionsMessage
|
|
17428
17919
|
}, ref) {
|
|
17429
|
-
const { isMatch:
|
|
17920
|
+
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
17430
17921
|
const [isOpen, setIsOpen] = React70.useState(false);
|
|
17431
17922
|
const containerRef = React70.useRef(null);
|
|
17432
17923
|
const hasValue = Boolean(value);
|
|
@@ -17457,7 +17948,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17457
17948
|
moveByStep,
|
|
17458
17949
|
moveToBoundary
|
|
17459
17950
|
} = useMobileSelectWheel({
|
|
17460
|
-
isMobile:
|
|
17951
|
+
isMobile: isMobile3,
|
|
17461
17952
|
isOpen,
|
|
17462
17953
|
options,
|
|
17463
17954
|
value,
|
|
@@ -17474,7 +17965,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17474
17965
|
handleMenuKeyDown,
|
|
17475
17966
|
handleTriggerKeyDown
|
|
17476
17967
|
} = useDesktopSelect({
|
|
17477
|
-
isMobile:
|
|
17968
|
+
isMobile: isMobile3,
|
|
17478
17969
|
isOpen,
|
|
17479
17970
|
options,
|
|
17480
17971
|
value,
|
|
@@ -17487,7 +17978,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17487
17978
|
useOutsideClick({
|
|
17488
17979
|
elementRef: containerRef,
|
|
17489
17980
|
onOutsideClick: () => setIsOpen(false),
|
|
17490
|
-
isDisabled: !isOpen ||
|
|
17981
|
+
isDisabled: !isOpen || isMobile3
|
|
17491
17982
|
});
|
|
17492
17983
|
React70.useEffect(() => {
|
|
17493
17984
|
if (isBlocked) {
|
|
@@ -17530,14 +18021,14 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17530
18021
|
if (isBlocked) return;
|
|
17531
18022
|
setIsOpen((prev) => {
|
|
17532
18023
|
const nextOpen = !prev;
|
|
17533
|
-
if (
|
|
18024
|
+
if (isMobile3) {
|
|
17534
18025
|
syncPendingValue(value ?? null);
|
|
17535
18026
|
}
|
|
17536
18027
|
return nextOpen;
|
|
17537
18028
|
});
|
|
17538
|
-
}, [isBlocked,
|
|
18029
|
+
}, [isBlocked, isMobile3, syncPendingValue, value]);
|
|
17539
18030
|
const handleRootTriggerKeyDown = (event) => {
|
|
17540
|
-
if (
|
|
18031
|
+
if (isMobile3) {
|
|
17541
18032
|
if (isBlocked) return;
|
|
17542
18033
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
17543
18034
|
event.preventDefault();
|
|
@@ -17579,13 +18070,13 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17579
18070
|
handleMobileOpenChange(false);
|
|
17580
18071
|
}
|
|
17581
18072
|
};
|
|
17582
|
-
return /* @__PURE__ */ (0,
|
|
18073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime179.jsxs)(
|
|
17583
18074
|
"div",
|
|
17584
18075
|
{
|
|
17585
18076
|
ref: containerRef,
|
|
17586
18077
|
className: cn("relative w-full max-w-[var(--max-field-width)]", className),
|
|
17587
18078
|
children: [
|
|
17588
|
-
name && /* @__PURE__ */ (0,
|
|
18079
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime179.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
17589
18080
|
renderTrigger ? renderTrigger({
|
|
17590
18081
|
id: triggerId,
|
|
17591
18082
|
open: isOpen,
|
|
@@ -17607,7 +18098,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17607
18098
|
onClick: handleTriggerClick,
|
|
17608
18099
|
onKeyDown: handleRootTriggerKeyDown,
|
|
17609
18100
|
onBlur
|
|
17610
|
-
}) : /* @__PURE__ */ (0,
|
|
18101
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
17611
18102
|
AirbnbSelectTrigger,
|
|
17612
18103
|
{
|
|
17613
18104
|
id: triggerId,
|
|
@@ -17635,7 +18126,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17635
18126
|
onBlur
|
|
17636
18127
|
}
|
|
17637
18128
|
),
|
|
17638
|
-
|
|
18129
|
+
isMobile3 ? /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
17639
18130
|
AirbnbSelectMobileContent,
|
|
17640
18131
|
{
|
|
17641
18132
|
open: isOpen,
|
|
@@ -17660,7 +18151,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17660
18151
|
getOptionId: getOptionId2,
|
|
17661
18152
|
noOptionsMessage
|
|
17662
18153
|
}
|
|
17663
|
-
) : /* @__PURE__ */ (0,
|
|
18154
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
17664
18155
|
AirbnbSelectDesktopContent,
|
|
17665
18156
|
{
|
|
17666
18157
|
isOpen,
|
|
@@ -17694,7 +18185,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17694
18185
|
});
|
|
17695
18186
|
|
|
17696
18187
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
17697
|
-
var
|
|
18188
|
+
var import_jsx_runtime180 = require("react/jsx-runtime");
|
|
17698
18189
|
function formatPhoneCodeOptionLabel(option) {
|
|
17699
18190
|
const label = String(option.label);
|
|
17700
18191
|
const value = String(option.value);
|
|
@@ -17741,9 +18232,9 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17741
18232
|
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
17742
18233
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
17743
18234
|
const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
|
|
17744
|
-
return /* @__PURE__ */ (0,
|
|
17745
|
-
name && /* @__PURE__ */ (0,
|
|
17746
|
-
codeName && /* @__PURE__ */ (0,
|
|
18235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
|
|
18236
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
18237
|
+
codeName && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
17747
18238
|
"input",
|
|
17748
18239
|
{
|
|
17749
18240
|
type: "hidden",
|
|
@@ -17752,7 +18243,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17752
18243
|
disabled
|
|
17753
18244
|
}
|
|
17754
18245
|
),
|
|
17755
|
-
numberName && /* @__PURE__ */ (0,
|
|
18246
|
+
numberName && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
17756
18247
|
"input",
|
|
17757
18248
|
{
|
|
17758
18249
|
type: "hidden",
|
|
@@ -17761,7 +18252,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17761
18252
|
disabled
|
|
17762
18253
|
}
|
|
17763
18254
|
),
|
|
17764
|
-
topLabel && /* @__PURE__ */ (0,
|
|
18255
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
17765
18256
|
"label",
|
|
17766
18257
|
{
|
|
17767
18258
|
htmlFor: inputId,
|
|
@@ -17769,8 +18260,8 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17769
18260
|
children: topLabel
|
|
17770
18261
|
}
|
|
17771
18262
|
),
|
|
17772
|
-
/* @__PURE__ */ (0,
|
|
17773
|
-
/* @__PURE__ */ (0,
|
|
18263
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsxs)("div", { className: "flex items-stretch", children: [
|
|
18264
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
17774
18265
|
AirbnbSelect,
|
|
17775
18266
|
{
|
|
17776
18267
|
ref,
|
|
@@ -17801,7 +18292,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17801
18292
|
onClick,
|
|
17802
18293
|
onKeyDown,
|
|
17803
18294
|
valueLabel
|
|
17804
|
-
}) => /* @__PURE__ */ (0,
|
|
18295
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(
|
|
17805
18296
|
"button",
|
|
17806
18297
|
{
|
|
17807
18298
|
id,
|
|
@@ -17823,9 +18314,9 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17823
18314
|
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
17824
18315
|
),
|
|
17825
18316
|
children: [
|
|
17826
|
-
/* @__PURE__ */ (0,
|
|
17827
|
-
/* @__PURE__ */ (0,
|
|
17828
|
-
|
|
18317
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { children: valueLabel ?? codePlaceholder }),
|
|
18318
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
18319
|
+
import_lucide_react52.ChevronDown,
|
|
17829
18320
|
{
|
|
17830
18321
|
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
17831
18322
|
strokeWidth: 2
|
|
@@ -17836,7 +18327,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17836
18327
|
)
|
|
17837
18328
|
}
|
|
17838
18329
|
),
|
|
17839
|
-
/* @__PURE__ */ (0,
|
|
18330
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
17840
18331
|
AirbnbInput,
|
|
17841
18332
|
{
|
|
17842
18333
|
id: inputId,
|
|
@@ -17868,7 +18359,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17868
18359
|
}
|
|
17869
18360
|
)
|
|
17870
18361
|
] }),
|
|
17871
|
-
error && /* @__PURE__ */ (0,
|
|
18362
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(FieldErrorMessage, { message: error })
|
|
17872
18363
|
] });
|
|
17873
18364
|
}
|
|
17874
18365
|
);
|
|
@@ -17876,10 +18367,10 @@ AirbnbPhoneField.displayName = "AirbnbPhoneField";
|
|
|
17876
18367
|
|
|
17877
18368
|
// src/airbnb-fields/searchable-select/SearchableSelect.tsx
|
|
17878
18369
|
var React72 = __toESM(require("react"), 1);
|
|
17879
|
-
var
|
|
18370
|
+
var import_lucide_react53 = require("lucide-react");
|
|
17880
18371
|
var import_react_virtual3 = require("@tanstack/react-virtual");
|
|
17881
|
-
var
|
|
17882
|
-
var
|
|
18372
|
+
var import_react90 = require("react");
|
|
18373
|
+
var import_jsx_runtime181 = require("react/jsx-runtime");
|
|
17883
18374
|
var ROW_HEIGHT = 48;
|
|
17884
18375
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
17885
18376
|
var MOBILE_LIST_HEIGHT = 420;
|
|
@@ -17919,7 +18410,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
17919
18410
|
noOptionsMessage,
|
|
17920
18411
|
loadingMessage
|
|
17921
18412
|
}, ref) => {
|
|
17922
|
-
const { isMatch:
|
|
18413
|
+
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
17923
18414
|
const reactId = React72.useId();
|
|
17924
18415
|
const [open, setOpen] = React72.useState(false);
|
|
17925
18416
|
const [internalSearchValue, setInternalSearchValue] = React72.useState("");
|
|
@@ -17954,10 +18445,10 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
17954
18445
|
useOutsideClick({
|
|
17955
18446
|
elementRef: containerRef,
|
|
17956
18447
|
onOutsideClick: () => closeSelect(),
|
|
17957
|
-
isDisabled: !open ||
|
|
18448
|
+
isDisabled: !open || isMobile3
|
|
17958
18449
|
});
|
|
17959
18450
|
const handleOnOpenChange = useEvent(onOpenChange);
|
|
17960
|
-
const setSelectOpen = (0,
|
|
18451
|
+
const setSelectOpen = (0, import_react90.useCallback)(
|
|
17961
18452
|
(nextOpen, options2) => {
|
|
17962
18453
|
setOpen(nextOpen);
|
|
17963
18454
|
handleOnOpenChange?.(nextOpen);
|
|
@@ -18048,7 +18539,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18048
18539
|
}
|
|
18049
18540
|
}
|
|
18050
18541
|
}
|
|
18051
|
-
const content = /* @__PURE__ */ (0,
|
|
18542
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18052
18543
|
AirbnbSearchableSelectContent,
|
|
18053
18544
|
{
|
|
18054
18545
|
inputId: searchInputId,
|
|
@@ -18067,7 +18558,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18067
18558
|
menuClassName,
|
|
18068
18559
|
noOptionsMessage,
|
|
18069
18560
|
loadingMessage,
|
|
18070
|
-
height:
|
|
18561
|
+
height: isMobile3 ? MOBILE_LIST_HEIGHT : DESKTOP_LIST_HEIGHT,
|
|
18071
18562
|
idPrefix: reactId,
|
|
18072
18563
|
onSearchChange: handleSearchChange,
|
|
18073
18564
|
onSearchKeyDown: handleSearchKeyDown,
|
|
@@ -18076,9 +18567,9 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18076
18567
|
}
|
|
18077
18568
|
);
|
|
18078
18569
|
React72.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
18079
|
-
return /* @__PURE__ */ (0,
|
|
18080
|
-
name && /* @__PURE__ */ (0,
|
|
18081
|
-
/* @__PURE__ */ (0,
|
|
18570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
18571
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
18572
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18082
18573
|
AirbnbFieldTrigger,
|
|
18083
18574
|
{
|
|
18084
18575
|
id: `${reactId}-trigger`,
|
|
@@ -18113,8 +18604,8 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18113
18604
|
},
|
|
18114
18605
|
onKeyDown: handleTriggerKeyDown,
|
|
18115
18606
|
onBlur,
|
|
18116
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
18117
|
-
|
|
18607
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18608
|
+
import_lucide_react53.ChevronDown,
|
|
18118
18609
|
{
|
|
18119
18610
|
className: cn(
|
|
18120
18611
|
"h-6 w-6 text-[#1F1F1B] transition-transform",
|
|
@@ -18124,7 +18615,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18124
18615
|
)
|
|
18125
18616
|
}
|
|
18126
18617
|
),
|
|
18127
|
-
|
|
18618
|
+
isMobile3 ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18128
18619
|
Drawer,
|
|
18129
18620
|
{
|
|
18130
18621
|
open,
|
|
@@ -18136,13 +18627,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18136
18627
|
}
|
|
18137
18628
|
closeSelect();
|
|
18138
18629
|
},
|
|
18139
|
-
children: /* @__PURE__ */ (0,
|
|
18140
|
-
/* @__PURE__ */ (0,
|
|
18141
|
-
/* @__PURE__ */ (0,
|
|
18142
|
-
/* @__PURE__ */ (0,
|
|
18630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
|
|
18631
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
18632
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
18633
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)("div", { className: "px-5 pb-5 pt-1", children: content })
|
|
18143
18634
|
] })
|
|
18144
18635
|
}
|
|
18145
|
-
) : open ? /* @__PURE__ */ (0,
|
|
18636
|
+
) : open ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18146
18637
|
"div",
|
|
18147
18638
|
{
|
|
18148
18639
|
className: cn(
|
|
@@ -18209,16 +18700,16 @@ function AirbnbSearchableSelectContent({
|
|
|
18209
18700
|
virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
|
|
18210
18701
|
}
|
|
18211
18702
|
}, [highlightedIndex, virtualizer]);
|
|
18212
|
-
return /* @__PURE__ */ (0,
|
|
18213
|
-
/* @__PURE__ */ (0,
|
|
18214
|
-
/* @__PURE__ */ (0,
|
|
18215
|
-
|
|
18703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)("div", { className: "p-2", children: [
|
|
18704
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsxs)("div", { className: "relative mb-2", children: [
|
|
18705
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18706
|
+
import_lucide_react53.Search,
|
|
18216
18707
|
{
|
|
18217
18708
|
"aria-hidden": "true",
|
|
18218
18709
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|
|
18219
18710
|
}
|
|
18220
18711
|
),
|
|
18221
|
-
/* @__PURE__ */ (0,
|
|
18712
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18222
18713
|
"input",
|
|
18223
18714
|
{
|
|
18224
18715
|
id: inputId,
|
|
@@ -18237,7 +18728,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18237
18728
|
}
|
|
18238
18729
|
)
|
|
18239
18730
|
] }),
|
|
18240
|
-
loading && options.length === 0 ? /* @__PURE__ */ (0,
|
|
18731
|
+
loading && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: loadingText }) : options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("div", { className: "px-4 py-5 text-center text-base leading-6 text-[#6C6C6C]", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18241
18732
|
"div",
|
|
18242
18733
|
{
|
|
18243
18734
|
id: listboxId,
|
|
@@ -18246,7 +18737,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18246
18737
|
"aria-labelledby": labelId,
|
|
18247
18738
|
className: cn("overflow-y-auto outline-none", menuClassName),
|
|
18248
18739
|
style: { height: Math.min(height, rowCount * ROW_HEIGHT) },
|
|
18249
|
-
children: /* @__PURE__ */ (0,
|
|
18740
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18250
18741
|
"div",
|
|
18251
18742
|
{
|
|
18252
18743
|
className: "relative w-full",
|
|
@@ -18254,7 +18745,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18254
18745
|
children: virtualItems.map((virtualItem) => {
|
|
18255
18746
|
const option = options[virtualItem.index];
|
|
18256
18747
|
if (!option) {
|
|
18257
|
-
return /* @__PURE__ */ (0,
|
|
18748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18258
18749
|
"div",
|
|
18259
18750
|
{
|
|
18260
18751
|
className: "absolute left-0 top-0 flex w-full items-center px-4 text-base leading-6 text-[#6C6C6C]",
|
|
@@ -18269,7 +18760,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18269
18760
|
}
|
|
18270
18761
|
const isSelected = value?.value === option.value;
|
|
18271
18762
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
18272
|
-
return /* @__PURE__ */ (0,
|
|
18763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18273
18764
|
"button",
|
|
18274
18765
|
{
|
|
18275
18766
|
id: getOptionId(idPrefix, virtualItem.index),
|
|
@@ -18291,7 +18782,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18291
18782
|
height: `${virtualItem.size}px`,
|
|
18292
18783
|
transform: `translateY(${virtualItem.start}px)`
|
|
18293
18784
|
},
|
|
18294
|
-
children: /* @__PURE__ */ (0,
|
|
18785
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("span", { className: "truncate text-center", children: String(option.label) })
|
|
18295
18786
|
},
|
|
18296
18787
|
`${String(option.value)}-${virtualItem.index}`
|
|
18297
18788
|
);
|
|
@@ -18321,15 +18812,15 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
18321
18812
|
|
|
18322
18813
|
// src/airbnb-fields/search-input/SearchInput.tsx
|
|
18323
18814
|
var React73 = __toESM(require("react"), 1);
|
|
18324
|
-
var
|
|
18325
|
-
var
|
|
18326
|
-
var
|
|
18815
|
+
var import_react_i18next40 = require("react-i18next");
|
|
18816
|
+
var import_lucide_react54 = require("lucide-react");
|
|
18817
|
+
var import_jsx_runtime182 = require("react/jsx-runtime");
|
|
18327
18818
|
var AirbnbSearchInput = React73.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
18328
|
-
const { t } = (0,
|
|
18819
|
+
const { t } = (0, import_react_i18next40.useTranslation)();
|
|
18329
18820
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
18330
|
-
return /* @__PURE__ */ (0,
|
|
18331
|
-
/* @__PURE__ */ (0,
|
|
18332
|
-
/* @__PURE__ */ (0,
|
|
18821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
18822
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)(import_lucide_react54.Search, { className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]" }),
|
|
18823
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
|
|
18333
18824
|
"input",
|
|
18334
18825
|
{
|
|
18335
18826
|
...props,
|
|
@@ -18348,13 +18839,13 @@ var AirbnbSearchInput = React73.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
18348
18839
|
)
|
|
18349
18840
|
}
|
|
18350
18841
|
),
|
|
18351
|
-
onReset && /* @__PURE__ */ (0,
|
|
18842
|
+
onReset && /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
|
|
18352
18843
|
Button,
|
|
18353
18844
|
{
|
|
18354
18845
|
variant: "ghost",
|
|
18355
18846
|
onClick: onReset,
|
|
18356
18847
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
18357
|
-
children: /* @__PURE__ */ (0,
|
|
18848
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(import_lucide_react54.X, { className: "h-5 w-5" })
|
|
18358
18849
|
}
|
|
18359
18850
|
)
|
|
18360
18851
|
] });
|
|
@@ -18535,6 +19026,7 @@ AirbnbSearchInput.displayName = "AirbnbSearchInput";
|
|
|
18535
19026
|
LegacyTextarea,
|
|
18536
19027
|
Link,
|
|
18537
19028
|
LoadingBar,
|
|
19029
|
+
MobileWebcam,
|
|
18538
19030
|
Modal,
|
|
18539
19031
|
ModalButton,
|
|
18540
19032
|
ModalLoader,
|